コード例 #1
0
    public function getAllretur(Request $req)
    {
        if ($req->ajax()) {
            $res = [];
            $out = '';
            $items = data_retur::gudang($req->all())->paginate($req->limit);
            if ($items->total() > 0) {
                $no = $items->currentPage() == 1 ? 1 : $items->perPage() * $items->currentPage() - $items->perPage() + 1;
                foreach ($items as $item) {
                    $out .= '
					<tr>
						<td>' . $no . '</td>
						<td>' . $item->no_retur . '</td>
						<td>
							' . \Format::indoDate2($item->created_at) . '<br />
							<small class="text-muted">' . \Format::hari($item->created_at) . ', ' . \Format::jam($item->created_at) . '</small>
						</td>
						<td class="text-right">
							<a class="btn btn-white" href="' . url('/returgudang/print/' . $item->id_retur) . '" target="_blank"><i class="fa fa-print"></i></a>
						</td>
					</tr>
				';
                    $no++;
                }
            } else {
                $out = '
					<tr>
						<td colspan="4">Tidak ditemukan!</td>
					</tr>
				';
            }
            $res['content'] = $out;
            $res['pagin'] = $items->render();
            return json_encode($res);
        }
    }