Ejemplo n.º 1
0
    public function getAllgudang(Request $req)
    {
        if ($req->ajax()) {
            $res = [];
            $out = '';
            $items = ref_gudang::listgudang($req->all())->paginate($req->limit);
            if ($items->total() > 0) {
                $no = $items->currentPage() == 1 ? 1 : $items->perPage() * $items->currentPage() - $items->perPage() + 1;
                $permission = \Auth::user()->permission;
                foreach ($items as $item) {
                    $link = $permission > 2 ? '<small>[<a href="' . url('/gudang/edit/' . $item->id_gudang) . '">Rubah</a> |<a href="javascript:void(0);" onclick="del({{ $item->id_gudang }});" class="text-danger">Hapus</a> ]</small>' : '';
                    $out .= '
						<tr class="item-' . $item->id_gudang . '">
							<td>' . $no . '</td>
							<td>
								' . $item->kode_gudang . '<br />
								' . $link . '
							</td>
							<td>
								' . $item->nm_gudang . '
							</td>
							<td>
								' . \Format::indoDate($item->created_at) . '<br />
								<small class="text-muted">' . \Format::hari($item->created_at) . ', ' . \Format::jam($item->created_at) . '</small>
							</td>
							<?php $no++; ?>
						</tr>
					';
                }
            } else {
                $out = '
					<tr>
						<td colspan="4">Tidak ditemukan</td>
					</tr>
				';
            }
        }
        $res['content'] = $out;
        $res['pagin'] = $items->render();
        return json_encode($res);
    }
 public function getLpb()
 {
     $items = ref_gudang::listgudang()->get();
     return view('Laporan.Logistik.Lpb', ['items' => $items]);
 }