diff --git a/app/Exports/CustomerExport.php b/app/Exports/CustomerExport.php index ba39a1c..ca68d43 100644 --- a/app/Exports/CustomerExport.php +++ b/app/Exports/CustomerExport.php @@ -23,9 +23,6 @@ class CustomerExport implements FromCollection, WithHeadings 'address' )->get(); - // Inisialisasi nomor awal - // $nomor = 1; - // Modifikasi data dan tambahkan nomor $data = $customers->map(function ($customer) use (&$nomor) { return [ diff --git a/app/Exports/KondisiPetiExport.php b/app/Exports/KondisiPetiExport.php index c696b7c..86569a3 100644 --- a/app/Exports/KondisiPetiExport.php +++ b/app/Exports/KondisiPetiExport.php @@ -20,9 +20,6 @@ class KondisiPetiExport implements FromCollection, WithHeadings 'deskripsi_kondisi', )->get(); - // Inisialisasi nomor awal - // $nomor = 1; - // Modifikasi data dan tambahkan nomor $data = $kondisipetis->map(function ($kondisipeti) use (&$nomor) { return [ diff --git a/app/Exports/TipePetiExport.php b/app/Exports/TipePetiExport.php index 96b209f..82ed361 100644 --- a/app/Exports/TipePetiExport.php +++ b/app/Exports/TipePetiExport.php @@ -21,9 +21,6 @@ class TipePetiExport implements FromCollection, WithHeadings 'description', )->get(); - // Inisialisasi nomor awal - // $nomor = 1; - // Modifikasi data dan tambahkan nomor $data = $tipepetis->map(function ($tipepeti) use (&$nomor) { return [ diff --git a/app/Exports/WarehouseExport.php b/app/Exports/WarehouseExport.php index 30a2b34..5f3ca9a 100644 --- a/app/Exports/WarehouseExport.php +++ b/app/Exports/WarehouseExport.php @@ -21,9 +21,6 @@ class WarehouseExport implements FromCollection, WithHeadings 'address', )->get(); - // Inisialisasi nomor awal - // $nomor = 1; - // Modifikasi data dan tambahkan nomor $data = $warehouses->map(function ($warehouse) use (&$nomor) { return [ diff --git a/app/Http/Controllers/DisposalController.php b/app/Http/Controllers/DisposalController.php index 26ef85b..a9b3666 100644 --- a/app/Http/Controllers/DisposalController.php +++ b/app/Http/Controllers/DisposalController.php @@ -89,7 +89,6 @@ class DisposalController extends Controller */ public function edit($id) { - // $jenis_disposal = ['Pemusnaan', 'Perbaikan']; $data = [ 'disposal' => Disposal::findOrFail($id), 'peti' => Peti::get(), @@ -105,7 +104,6 @@ class DisposalController extends Controller */ public function update(ValidasiUpdateDisposal $request, $id) { - // dd($request->all()); // dd("oke"); try { // Mendapatkan informasi pengguna yang sedang login diff --git a/app/Http/Controllers/HistoryController.php b/app/Http/Controllers/HistoryController.php index ed8f847..7becc99 100644 --- a/app/Http/Controllers/HistoryController.php +++ b/app/Http/Controllers/HistoryController.php @@ -13,7 +13,6 @@ class HistoryController extends Controller { $data = [ - // 'peminjaman' => asset_status::get(), 'peminjaman' => asset_status::withTrashed()->orderBy('created_at', 'desc')->get(), 'warehouse' => m_warehouse::get(), 'active' => 'history-peminjaman', diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index 0c45ff7..56739f4 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -21,20 +21,6 @@ class HomeController extends Controller return view('dashboard.index', $data); } - //halaman User - // public function indexUser() - // { - // $data = [ - // 'reminder' => \App\Models\asset_status::whereNull('enter_at')->count(), - // 'jumlahPeti' => \App\Models\Peti::count(), - // 'jumlahPeminjaman' => \App\Models\asset_status::count(), - // 'jumlahPengembalian' => \App\Models\asset_status::whereNotNull('enter_at')->count(), - // 'active' => 'menu-admin', - // ]; - - // return view('pages.user.index', $data); - // } - public function notification() { $notification = \App\Models\asset_status::whereNull('enter_at') diff --git a/app/Http/Controllers/KondisiPetiController.php b/app/Http/Controllers/KondisiPetiController.php index d5faa94..5c3daec 100644 --- a/app/Http/Controllers/KondisiPetiController.php +++ b/app/Http/Controllers/KondisiPetiController.php @@ -24,7 +24,6 @@ class KondisiPetiController extends Controller public function store(ValidasiCreateKondisiPeti $request) { // dd('oke'); - // dd($request); try { $currentUser = Auth::user(); $validatedData = $request->except('_token'); diff --git a/app/Http/Controllers/PeminjamanController.php b/app/Http/Controllers/PeminjamanController.php index b3abba2..5b87d08 100644 --- a/app/Http/Controllers/PeminjamanController.php +++ b/app/Http/Controllers/PeminjamanController.php @@ -11,6 +11,7 @@ use Illuminate\Http\Request; use Symfony\Component\Uid\Uuid; use Illuminate\Http\JsonResponse; use Illuminate\Support\Collection; +use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Auth; use App\Http\Requests\ValidasiCreatePeminjaman; use App\Http\Requests\ValidasiUpdatePeminjaman; @@ -28,7 +29,7 @@ class PeminjamanController extends Controller ->where('status', '=', 0) ->orderBy('created_at', 'desc'); - // Tambahkan logika pencarian + //logika pencarian $search = $request->input('search') ?? ''; if ($search) { $query->where(function ($q) use ($search) { @@ -36,27 +37,59 @@ class PeminjamanController extends Controller ->orWhereHas('peti', function ($warehouseQuery) use ($search) { $warehouseQuery->where('fix_lot', 'like', "%$search%"); }) - ->orWhere('exit_at', 'like', "%$search%") - ->orWhere('est_pengembalian', 'like', "%$search%") - ->orWhere('exit_pic', 'like', "%$search%") ->orWhereHas('customer', function ($warehouseQuery) use ($search) { $warehouseQuery->where('name', 'like', "%$search%"); }) + ->orWhereHas('peti.customer', function ($customerQuery) use ($search) { + $customerQuery->where('code_customer', 'like', "%$search%"); + }) + ->orWhereHas('peti.tipe_peti', function ($tipePetiQuery) use ($search) { + $tipePetiQuery->where('type', 'like', "%$search%"); + }) + ->orWhere(function ($combinedQuery) use ($search) { + // Pisahkan code customer dan tipe peti dari pencarian + list($codeCustomer, $typePeti) = explode(' - ', $search); + + // Cek kesamaan code customer dan tipe peti + $combinedQuery->whereHas('peti.customer', function ($customerQuery) use ($codeCustomer) { + $customerQuery->where('code_customer', 'like', "%$codeCustomer%"); + })->whereHas('peti.tipe_peti', function ($tipePetiQuery) use ($typePeti) { + $tipePetiQuery->where('type', 'like', "%$typePeti%"); + }); + }) + ->orWhere('exit_pic', 'like', "%$search%") ->orWhereHas('warehouse', function ($warehouseQuery) use ($search) { $warehouseQuery->where('name', 'like', "%$search%") ->orWhere('address', 'like', "%$search%"); }) - ->orWhere('enter_at', 'like', "%$search%") - ->orWhere('enter_pic', 'like', "%$search%") - ->orWhereHas('warehouseEnter', function ($warehouseQuery) use ($search) { - $warehouseQuery->where('name', 'like', "%$search%"); + + ->orWhere(function ($dateQuery) use ($search) { + try { + // Format tanggal yang diharapkan dari input pengguna + $formattedDate = \Carbon\Carbon::createFromFormat('d-m-Y', $search)->format('Y-m-d'); + + // Cek kesamaan tanggal + $dateQuery->whereDate('exit_at', $formattedDate); + } catch (\Exception $e) { + Log::error('Error parsing date: ' . $e->getMessage()); + } }) - ->orWhereHas('kondisi_peti', function ($warehouseQuery) use ($search) { - $warehouseQuery->where('nama_kondisi', 'like', "%$search%"); + ->orWhere(function ($dateQuery) use ($search) { + try { + // Format tanggal yang diharapkan dari input pengguna + $formattedDate = \Carbon\Carbon::createFromFormat('d-m-Y', $search)->format('Y-m-d'); + + // Cek kesamaan tanggal + $dateQuery->whereDate('est_pengembalian', $formattedDate); + } catch (\Exception $e) { + Log::error('Error parsing date: ' . $e->getMessage()); + } }) - ->orWhere('status', 'like', "%$search%") - ->orWhere('created_by', 'like', "%$search%") - ->orWhere('updated_by', 'like', "%$search%"); + ->orWhere('exit_pic', 'like', "%$search%") + ->orWhereHas('warehouse', function ($warehouseQuery) use ($search) { + $warehouseQuery->where('name', 'like', "%$search%") + ->orWhere('address', 'like', "%$search%"); + }); }); } @@ -79,6 +112,7 @@ class PeminjamanController extends Controller $data = [ 'peminjaman' => $stores, 'warehouse' => m_warehouse::get(), + 'i' => ($stores->currentPage() - 1) * $stores->perPage() + 1, 'search' => $search, 'active' => 'menu-peminjaman', ]; diff --git a/app/Http/Controllers/PengembalianController.php b/app/Http/Controllers/PengembalianController.php index d9e2110..33639f1 100644 --- a/app/Http/Controllers/PengembalianController.php +++ b/app/Http/Controllers/PengembalianController.php @@ -2,28 +2,130 @@ namespace App\Http\Controllers; -use App\Http\Requests\ValidasiUpdatePengembalian; use App\Models\Peti; use App\Models\m_warehouse; use App\Models\asset_status; use App\Models\Kondisi_Peti; use Illuminate\Http\Request; +use Illuminate\Support\Collection; +use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Auth; +use App\Http\Requests\ValidasiUpdatePengembalian; class PengembalianController extends Controller { - public function index() + public function index(Request $request) { - $pengembalian = asset_status::orderBy('created_at', 'desc')->get(); + $perPage = $request->input('perPage', 5); + $query = asset_status::with(['customer', 'warehouseId', 'warehouse', 'warehouseEnter', 'kondisi_peti']) + ->where('status', '=', 1) + ->orderBy('created_at', 'desc'); + + // Logika pencarian + $search = $request->input('search') ?? ''; + if ($search) { + $query->where(function ($q) use ($search) { + $q->where('mobile_id', 'like', "%$search%") + ->orWhereHas('peti', function ($warehouseQuery) use ($search) { + $warehouseQuery->where('fix_lot', 'like', "%$search%"); + }) // sudah cari fix lot + ->orWhereHas('customer', function ($warehouseQuery) use ($search) { + $warehouseQuery->where('name', 'like', "%$search%"); + }) // sudah cari nama customer + ->orWhere(function ($dateQuery) use ($search) { + try { + // Format tanggal yang diharapkan dari input pengguna + $formattedDate = \Carbon\Carbon::createFromFormat('d-m-Y', $search)->format('Y-m-d'); + + // Cek kesamaan tanggal + $dateQuery->whereDate('exit_at', $formattedDate); + } catch (\Exception $e) { + Log::error('Error parsing date: ' . $e->getMessage()); + } + }) + ->orWhere(function ($dateQuery) use ($search) { + try { + // Format tanggal yang diharapkan dari input pengguna + $formattedDate = \Carbon\Carbon::createFromFormat('d-m-Y', $search)->format('Y-m-d'); + + // Cek kesamaan tanggal + $dateQuery->whereDate('est_pengembalian', $formattedDate); + } catch (\Exception $e) { + Log::error('Error parsing date: ' . $e->getMessage()); + } + }) // sudah cari est pengembalian (tanggal pengembalian) + ->orWhere('exit_pic', 'like', "%$search%") // sudah cari exit pic (nama peminjam) + ->orWhereHas('warehouse', function ($warehouseQuery) use ($search) { + $warehouseQuery->where('name', 'like', "%$search%") + ->orWhere('address', 'like', "%$search%"); + }) // sudah cari warehouse (lokasi peminjaman) + ->orWhere(function ($dateQuery) use ($search) { + try { + // Format tanggal yang diharapkan dari input pengguna + $formattedDate = \Carbon\Carbon::createFromFormat('d-m-Y', $search)->format('Y-m-d'); + + // Cek kesamaan tanggal + $dateQuery->whereDate('enter_at', $formattedDate); + } catch (\Exception $e) { + Log::error('Error parsing date: ' . $e->getMessage()); + } + }) // sudah cari enter at (tanggal pengembalian) + ->orWhere('enter_pic', 'like', "%$search%") // sudah cari enter pic (nama pengembali) + ->orWhereHas('warehouseEnter', function ($warehouseQuery) use ($search) { + $warehouseQuery->where('name', 'like', "%$search%"); + }) // sudah cari warehouse enter (lokasi pengembalian) + ->orWhereHas('kondisi_peti', function ($warehouseQuery) use ($search) { + $warehouseQuery->where('nama_kondisi', 'like', "%$search%"); + }) // sudah cari kondisi peti + ->orWhere(function ($statusQuery) use ($search) { + if (strtolower($search) === 'return') { + $statusQuery->where('status', 1); + } else { + $statusQuery->where('status', 'like', "%$search%"); + } + }); // sudah cari status + }); + } + + // Periksa apakah perPage adalah 'Semua' + if ($perPage == 'Semua') { + $chunkSize = 100; + $stores = new Collection(); + $currentPage = 1; + + $query->chunk($chunkSize, function ($storesChunk) use ($stores, &$currentPage) { + foreach ($storesChunk as $store) { + $store->setAttribute('i', ($currentPage - 1) * $storesChunk->perPage() + $store->getQueueableId()); + $stores->push($store); + $currentPage++; + } + }); + } else { + // Hitung halaman berdasarkan parameter halaman yang diberikan atau default ke halaman pertama + $page = $request->input('page') ?? 1; + + // Paginasi dengan parameter halaman + $stores = $query->paginate($perPage, ['*'], 'page', $page); + + // Hitung nomor urutan untuk setiap item di halaman + $stores->each(function ($store) use ($page, $perPage) { + $store->setAttribute('i', ($page - 1) * $perPage + $store->getQueueableId()); + }); + } $data = [ - 'peminjaman' => $pengembalian, + 'peminjaman' => $stores, + 'warehouse' => m_warehouse::get(), + 'i' => ($stores->currentPage() - 1) * $stores->perPage() + 1, + 'search' => $search, 'active' => 'menu-pengembalian', ]; return view('dashboard.Pengembalian.index', $data); } + + /** * Show the form for creating a new resource. */ diff --git a/app/Http/Controllers/PetiController.php b/app/Http/Controllers/PetiController.php index dc9fbef..fdde58d 100644 --- a/app/Http/Controllers/PetiController.php +++ b/app/Http/Controllers/PetiController.php @@ -32,8 +32,6 @@ class PetiController extends Controller ->orderBy('created_at', 'desc'); // Tambahkan logika pencarian $search = $request->input('search') ?? ''; - // Tambahkan logika pencarian - $search = $request->input('search') ?? ''; if ($search) { $query->where(function ($q) use ($search) { $q->where('fix_lot', 'like', "%$search%") @@ -114,7 +112,9 @@ class PetiController extends Controller // Ambil nomor urutan otomatis untuk packing_no $latestPackingNo = Peti::max('packing_no'); $nextPackingNo = $latestPackingNo + 1; - $validatedData['packing_no'] = $nextPackingNo; + // $validatedData['packing_no'] = $nextPackingNo; + $validatedData['packing_no'] = '0' . $nextPackingNo; + // $validatedData['packing_no'] = str_pad($nextPackingNo, 3, '0', STR_PAD_LEFT); // cara untuk menambahkan total digitnya adalah 3 $code_customer = Customer::where('id', $validatedData['customer_id'])->first()->code_customer; $type = Type_peti::where('id', $validatedData['tipe_peti_id'])->first()->type; diff --git a/app/Http/Controllers/ProfileController.php b/app/Http/Controllers/ProfileController.php index 27ff7e8..c36e0cf 100644 --- a/app/Http/Controllers/ProfileController.php +++ b/app/Http/Controllers/ProfileController.php @@ -59,11 +59,6 @@ class ProfileController extends Controller if ($pengguna->foto) { Storage::delete('public/' . $pengguna->foto); } - - // Generate nama file acak - // $randomFileName = Str::random(20) . '.' . $request->file('foto')->getClientOriginalExtension(); - // $fotoPath = $request->file('foto')->storeAs('public/Profile_foto', $randomFileName); - // $pengguna->foto = $randomFileName; $randomFileName = Str::random(20); // Menghasilkan nama file acak dengan panjang 20 karakter $fotoPath = $request->file('foto')->storeAs('public/Profile_foto', $randomFileName); $pengguna->foto = str_replace('public/', '', $fotoPath); @@ -86,22 +81,6 @@ class ProfileController extends Controller } } - //Proses update Profile Photo - // public function updatePhoto(Request $request) - // { - // // dd('okr'); - // $user = User::find(auth()->user()->id); - // if ($request->hasFile('foto')) { - // // Mengunggah file foto profil - // $file = $request->file('foto'); - // $foto = $file->store('profile-fotos'); - // $user->update(['foto' => $foto]); - // } - - // // Logika lain yang diperlukan setelah update foto profil - // return redirect()->back()->with('success', 'Foto profil berhasil diperbarui.'); - // } - //Proses update Profile Informasi public function update(ProfileUpdateRequest $request): RedirectResponse { @@ -115,44 +94,4 @@ class ProfileController extends Controller return Redirect::back()->with('status', 'profile-updated'); } - - /** - * Delete the user's account. - */ - // public function destroy(Request $request) - // { - // $user = Auth::user(); - - // // Validasi password - // if (!Hash::check($request->password, $user->password)) { - // return back()->withErrors([ - // 'password' => 'The provided password does not match your current password.', - // ]); - // } - - // // Hapus akun - // $user->delete(); - - // // Logout - // Auth::logout(); - - // return redirect('/'); - // } - // public function destroy(Request $request): RedirectResponse - // { - // $request->validateWithBag('userDeletion', [ - // 'password' => ['required', 'current_password'], - // ]); - - // $user = $request->user(); - - // Auth::logout(); - - // $user->delete(); - - // $request->session()->invalidate(); - // $request->session()->regenerateToken(); - - // return Redirect::to('/'); - // } } diff --git a/app/Http/Controllers/RecycleDataController.php b/app/Http/Controllers/RecycleDataController.php index d8255de..87fbd34 100644 --- a/app/Http/Controllers/RecycleDataController.php +++ b/app/Http/Controllers/RecycleDataController.php @@ -25,71 +25,6 @@ class RecycleDataController extends Controller return view('dashboard.Master_Data.Recycle_Data.index', $data); } - // public function pulihkanData($id) - // { - // // dd('oke'); - // $peti = Customer::withTrashed()->find($id); - - // if ($peti) { - // $peti->restore(); - // return redirect()->back()->with('success', 'Data berhasil dipulihkan.'); - // } else { - // return redirect()->back()->with('error', 'Data tidak ditemukan.'); - // } - // } - - // public function hapusPermanenData($id) - // { - // // dd('oke'); - // $peti = Peti::withTrashed()->find($id); - - // if ($peti) { - // $peti->forceDelete(); - // return redirect()->back()->with('success', 'Data berhasil dihapus permanen.'); - // } else { - // return redirect()->back()->with('error', 'Data tidak ditemukan.'); - // } - // } - - // public function pulihkanData(Request $request) - // { - // $peti = Peti::withTrashed() - // ->where('id', '=', $request->id) - // ->first(); - - // $customer = Customer::withTrashed() - // ->where('id', '=', $request->id) - // ->first(); - - // if ($peti) { - // $peti->restore(); - // return redirect()->back()->with('success', 'Data Peti berhasil dipulihkan.'); - // } elseif ($customer) { - // $customer->restore(); - // return redirect()->back()->with('success', 'Data Customer berhasil dipulihkan.'); - // } else { - // return redirect()->back()->with('error', 'Data tidak ditemukan.'); - // } - // } - - - // public function hapusPermanenData($id) - // { - // $peti = Peti::withTrashed()->find($id); - // $customer = Customer::withTrashed()->find($id); - - // if ($peti) { - // $peti->forceDelete(); - // return redirect()->back()->with('success', 'Data Peti berhasil dihapus permanen.'); - // } elseif ($customer) { - // $customer->forceDelete(); - // return redirect()->back()->with('success', 'Data Customer berhasil dihapus permanen.'); - // } else { - // return redirect()->back()->with('error', 'Data tidak ditemukan.'); - // } - // } - - public function pulihkanData(Request $request, $model, $id) { $data = null; diff --git a/app/Http/Controllers/Report/PetternLotPetiController.php b/app/Http/Controllers/Report/PetternLotPetiController.php index 7ebd17f..a3d7dab 100644 --- a/app/Http/Controllers/Report/PetternLotPetiController.php +++ b/app/Http/Controllers/Report/PetternLotPetiController.php @@ -12,14 +12,6 @@ use App\Exports\PetternLotPetiExport; class PetternLotPetiController extends Controller { - // public function index() - // { - // $data = [ - // 'peti' => Peti::withTrashed()->get(), - // 'active' => 'menu-Pettern_Lot_Peti' - // ]; - // return view('dashboard.Master_Data.Report.Pattern_lot_peti.index', $data); - // } public function index(Request $request) { $perPage = $request->input('perPage', 5); diff --git a/app/Http/Controllers/RoleController.php b/app/Http/Controllers/RoleController.php index 23362b4..2d91d55 100644 --- a/app/Http/Controllers/RoleController.php +++ b/app/Http/Controllers/RoleController.php @@ -22,14 +22,6 @@ class RoleController extends Controller return view('dashboard.Master_Data.Role.index', $data); } - /** - * Show the form for creating a new resource. - */ - // public function create() - // { - // return view('MasterData.role.create'); - // } - /** * Store a newly created resource in storage. */ @@ -47,25 +39,6 @@ class RoleController extends Controller } } - /** - * Display the specified resource. - */ - // public function show($id) - // { - // // dd('oke'); - // return view('MasterData.role.show'); - // } - - /** - * Show the form for editing the specified resource. - */ - // public function edit($id) - // { - // // dd('oke'); - // $role = m_role::find($id); - // return view('dashboard.Master_Data.Role.edit', compact('role')); - // } - /** * Update the specified resource in storage. */ diff --git a/app/Http/Controllers/WarehouseController.php b/app/Http/Controllers/WarehouseController.php index c4c6964..2fba685 100644 --- a/app/Http/Controllers/WarehouseController.php +++ b/app/Http/Controllers/WarehouseController.php @@ -26,13 +26,6 @@ class WarehouseController extends Controller ]; return view('dashboard.Master_Data.Warehouse.index', $data); } - /** - * Show the form for creating a new resource. - */ - // public function create() - // { - // // return view('dashboard.Master_Data.Warehouse.create'); - // } /** * Store a newly created resource in storage. @@ -54,24 +47,6 @@ class WarehouseController extends Controller } } - /** - * Display the specified resource. - */ - // public function show($id) - // { - // // dd('oke'); - // // return view('dashboard.Master_Data.Warehouse.show'); - // } - - /** - * Show the form for editing the specified resource. - */ - // public function edit() - // { - // // dd('oke'); - // // return view('dashboard.Master_Data.Warehouse.edit'); - // } - /** * Update the specified resource in storage. */ diff --git a/app/Http/Requests/Disposal/ValidasiUpdateDisposal.php b/app/Http/Requests/Disposal/ValidasiUpdateDisposal.php index 648ba0b..cca562f 100644 --- a/app/Http/Requests/Disposal/ValidasiUpdateDisposal.php +++ b/app/Http/Requests/Disposal/ValidasiUpdateDisposal.php @@ -22,20 +22,16 @@ class ValidasiUpdateDisposal extends FormRequest public function rules(): array { return [ - // 'peti_id' => 'required|integer', 'customer_id' => 'required|integer', 'warehouse_id' => 'required|integer', 'date_disposal' => 'nullable|date', 'description' => 'nullable|string', - // 'status_disposal' => 'nullable', ]; } public function messages(): array { return [ - // 'peti_id.required' => 'Peti harus dipilih.', - // 'peti_id.integer' => 'Peti harus berupa angka.', 'customer_id.required' => 'Customer harus dipilih.', 'customer_id.integer' => 'Customer harus berupa angka.', 'warehouse_id.required' => 'Gudang harus dipilih.', diff --git a/app/Http/Requests/ValidasiCreateCustomer.php b/app/Http/Requests/ValidasiCreateCustomer.php index 5087062..51766c1 100644 --- a/app/Http/Requests/ValidasiCreateCustomer.php +++ b/app/Http/Requests/ValidasiCreateCustomer.php @@ -43,7 +43,6 @@ class ValidasiCreateCustomer extends FormRequest 'lot_no.required' => 'Kolom lot_no wajib diisi.', 'lot_no.string' => 'Kolom lot_no harus berupa teks.', 'no_tlp.required' => 'Kolom no_tlp wajib diisi.', - // 'no_tlp.numeric' => 'Kolom no_tlp harus berisi angka.', 'no_tlp.max' => 'Kolom no_tlp tidak boleh lebih dari :max karakter.', 'address.required' => 'Kolom address wajib diisi.', 'address.string' => 'Kolom address harus berupa teks.', diff --git a/app/Models/Customer.php b/app/Models/Customer.php index 445ff94..169e117 100644 --- a/app/Models/Customer.php +++ b/app/Models/Customer.php @@ -2,6 +2,8 @@ namespace App\Models; +use App\Models\Peti; +use App\Models\Type_peti; use App\Traits\UUID; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\SoftDeletes; diff --git a/app/Models/asset_status.php b/app/Models/asset_status.php index 5322ee1..c0fbfee 100644 --- a/app/Models/asset_status.php +++ b/app/Models/asset_status.php @@ -33,11 +33,6 @@ class asset_status extends Model 'updated_by', ]; - // public function asset() - // { - // return $this->belongsTo(m_asset::class, 'asset_id')->withTrashed(); - // } - public function warehouseId() { return $this->belongsTo(m_warehouse::class, 'warehouse_id')->select('id', 'name', 'address')->withTrashed(); diff --git a/resources/views/dashboard/Peminjaman/index.blade.php b/resources/views/dashboard/Peminjaman/index.blade.php index 4858377..757d6af 100644 --- a/resources/views/dashboard/Peminjaman/index.blade.php +++ b/resources/views/dashboard/Peminjaman/index.blade.php @@ -70,6 +70,7 @@
No | @@ -39,136 +69,111 @@||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
{{ $no_peminjaman++ }} | -{{ $data->peti->fix_lot }} | -{{ $data->peti->customer->name }} | -{{ \Carbon\Carbon::parse($data->exit_at)->format('d/m/Y') }} | -{{ \Carbon\Carbon::parse($data->est_pengembalian)->format('d/m/Y') }} | -{{ $data->exit_pic }} | -
- @if ($data->exit_warehouse)
- {{ $data->warehouse->name }}
- @else
- - - @endif - |
-
- @if ($data->enter_at)
- {{ \Carbon\Carbon::parse($data->enter_at)->format('d-m-Y') }}
- @else
- - - @endif - |
-
- @if ($data->enter_pic)
- {{ $data->enter_pic }}
- @else
- - - @endif - |
-
- @if ($data->enter_warehouse)
- {{ $data->warehouseEnter->name }}
- @else
- - - @endif - |
-
- @if ($data->kondisi_peti)
- {{ $data->kondisi_peti->nama_kondisi }}
- @else
- - - @endif - |
- - @if ($data->enter_warehouse === null) - Not Return - @else - Return - @endif - | -- - - - | -
{{ $i++ }} | +{{ $data->peti->fix_lot }} | +{{ $data->peti->customer->name }} | +{{ \Carbon\Carbon::parse($data->exit_at)->format('d-m-Y') }} | +{{ \Carbon\Carbon::parse($data->est_pengembalian)->format('d-m-Y') }} | +{{ $data->exit_pic }} | +
+ @if ($data->exit_warehouse)
+ {{ $data->warehouse->name }}
+ @else
+ - + @endif + |
+
+ @if ($data->enter_at)
+ {{ \Carbon\Carbon::parse($data->enter_at)->format('d-m-Y') }}
+ @else
+ - + @endif + |
+
+ @if ($data->enter_pic)
+ {{ $data->enter_pic }}
+ @else
+ - + @endif + |
+
+ @if ($data->enter_warehouse)
+ {{ $data->warehouseEnter->name }}
+ @else
+ - + @endif + |
+
+ @if ($data->kondisi_peti)
+ {{ $data->kondisi_peti->nama_kondisi }}
+ @else
+ - + @endif + |
+ + @if ($data->status == 1) + Return + @elseif($data->status == 0) + Not Return + @endif + | ++ + + + | +
Data Kosong | +||||||||||||
{{ $no_peminjaman++ }} | -{{ $data->peti->fix_lot }} | -{{ $data->peti->customer->name }} | -{{ \Carbon\Carbon::parse($data->exit_at)->format('d/m/Y') }} | -{{ \Carbon\Carbon::parse($data->est_pengembalian)->format('d/m/Y') }} | -{{ $data->exit_pic }} | -
- @if ($data->exit_warehouse)
- {{ $data->warehouse->name }}
- @else
- - - @endif - |
-
- @if ($data->enter_at)
- {{ \Carbon\Carbon::parse($data->enter_at)->format('d-m-Y') }}
- @else
- - - @endif - |
-
- @if ($data->enter_pic)
- {{ $data->enter_pic }}
- @else
- - - @endif - |
-
- @if ($data->enter_warehouse)
- {{ $data->warehouseEnter->name }}
- @else
- - - @endif - |
-
- @if ($data->kondisi_peti)
- {{ $data->kondisi_peti->nama_kondisi }}
- @else
- - - @endif - |
- - @if ($data->enter_warehouse === null) - Not Return - @else - Return - @endif - | -- - - - | -
Showing {{ $peminjaman->firstItem() }} to + {{ $peminjaman->lastItem() }} of + {{ $peminjaman->total() }} entries
+ @endif +