diff --git a/app/Exports/KondisiPetiExport.php b/app/Exports/KondisiPetiExport.php index 86569a3..f90ddd0 100644 --- a/app/Exports/KondisiPetiExport.php +++ b/app/Exports/KondisiPetiExport.php @@ -24,7 +24,7 @@ class KondisiPetiExport implements FromCollection, WithHeadings $data = $kondisipetis->map(function ($kondisipeti) use (&$nomor) { return [ 'No' => $kondisipeti->id, - 'Nama Kondisi' => $kondisipeti->nama_kondisi, + 'Kondisi Peti' => $kondisipeti->nama_kondisi, 'Deskripsi' => $kondisipeti->deskripsi_kondisi, ]; }); @@ -36,7 +36,7 @@ class KondisiPetiExport implements FromCollection, WithHeadings { return [ 'No', - 'NAMA KONDISI', + 'KONDISI PETI', 'DESKRIPSI', ]; } diff --git a/app/Exports/PetternLotPetiExport.php b/app/Exports/PetternLotPetiExport.php index 954069c..e10b8c4 100644 --- a/app/Exports/PetternLotPetiExport.php +++ b/app/Exports/PetternLotPetiExport.php @@ -16,9 +16,12 @@ class PetternLotPetiExport implements FromCollection, WithHeadings 'warehouse_id', 'jumlah', 'tipe_peti_id', + 'kondisipeti_id', 'packing_no', 'fix_lot', - 'status' + 'status_isi', + 'warna', + 'status', )->get(); // Inisialisasi nomor awal @@ -29,14 +32,17 @@ class PetternLotPetiExport implements FromCollection, WithHeadings return [ 'No' => $nomor++, 'FIX LOT' => $peti->fix_lot, - 'Customer' => $peti->customer->name, - 'Warehouse' => $peti->warehouse->name, - 'CODE CUSTOMER' => $peti->customer->code_customer, - 'TYPE PETI' => $peti->tipe_peti->type, + 'CUSTOMER' => $peti->customer->name, + 'KODE CUSTOMER' => $peti->customer->code_customer, + 'TIPE PETI' => $peti->tipe_peti->type, 'UKURAN PETI' => $peti->tipe_peti->size_peti, 'LOT NO' => $peti->customer->lot_no, 'PACKING NO' => $peti->packing_no, - 'Status' => $peti->status, + 'GUDANG' => $peti->warehouse->name, + 'KONDISI PETI' => $peti->kondisipeti->nama_kondisi, + 'ISI PETI' => $peti->status_isi, + 'WARNA PETI' => $peti->warna, + 'STATUS' => $peti->status, ]; }); @@ -48,14 +54,17 @@ class PetternLotPetiExport implements FromCollection, WithHeadings return [ 'No', 'FIX LOT', - 'Customer', - 'WH', - 'CODE CUSTOMER', - 'TYPE PETI', + 'CUSTOMER', + 'KODE CUSTOMER', + 'TIPE PETI', 'UKURAN PETI', 'LOT NO', 'PACKING NO', - 'STATUS' + 'GUDANG', + 'KONDISI PETI', + 'ISI PETI', + 'WARNA PETI', + 'STATUS', ]; } } diff --git a/app/Http/Controllers/CustomerController.php b/app/Http/Controllers/CustomerController.php index b3ed763..7d9b0cf 100644 --- a/app/Http/Controllers/CustomerController.php +++ b/app/Http/Controllers/CustomerController.php @@ -44,6 +44,11 @@ class CustomerController extends Controller try { $currentUser = Auth::user(); $validatedData = $request->except('_token'); + + $validatedData['name'] = strtoupper($validatedData['name']); + $validatedData['code_customer'] = strtoupper($validatedData['code_customer']); + $validatedData['lot_no'] = strtoupper($validatedData['lot_no']); + $validatedData['address'] = strtoupper($validatedData['address']); $validatedData['created_by'] = $currentUser->fullname; // Menggunakan nama pengguna sebagai created_by $validatedData['updated_by'] = $currentUser->fullname; // Menggunakan nama pengguna sebagai updated_by Customer::create($validatedData); @@ -87,6 +92,11 @@ class CustomerController extends Controller $customerData = $request->all(); // Menambahkan nama pengguna yang melakukan pembaruan + $customerData['name'] = strtoupper($customerData['name']); + $customerData['code_customer'] = strtoupper($customerData['code_customer']); + $customerData['lot_no'] = strtoupper($customerData['lot_no']); + $customerData['address'] = strtoupper($customerData['address']); + $customerData['updated_by'] = Auth::user()->fullname; $customer->update($customerData); diff --git a/app/Http/Controllers/DisposalController.php b/app/Http/Controllers/DisposalController.php index a9b3666..6115537 100644 --- a/app/Http/Controllers/DisposalController.php +++ b/app/Http/Controllers/DisposalController.php @@ -68,6 +68,7 @@ class DisposalController extends Controller $validatedData['mobile_id'] = Uuid::v4(); // Menambahkan ID Mobile $validatedData['created_by'] = $currentUser->fullname; $validatedData['updated_by'] = $currentUser->fullname; + $validatedData['description'] = strtoupper($validatedData['description']); $validatedData['status_disposal'] = 'INAKTIF'; // Membuat entitas Disposal $disposal = Disposal::create($validatedData); @@ -114,6 +115,8 @@ class DisposalController extends Controller // Menambahkan informasi pengguna ke dalam data yang akan disimpan $validatedData['updated_by'] = $currentUser->fullname; + $validatedData['description'] = strtoupper($validatedData['description']); + // Mencari transfer berdasarkan ID $disposal = Disposal::find($id); diff --git a/app/Http/Controllers/HistoryController.php b/app/Http/Controllers/HistoryController.php index 0c48a10..edeeb83 100644 --- a/app/Http/Controllers/HistoryController.php +++ b/app/Http/Controllers/HistoryController.php @@ -16,7 +16,7 @@ class HistoryController extends Controller { $perPage = $request->input('perPage', 5); - $query = asset_status::with(['customer', 'warehouseId', 'warehouse', 'warehouseEnter', 'kondisi_peti']) + $query = asset_status::with(['customer', 'warehouse', 'warehouseEnter', 'kondisi_peti']) ->orderBy('created_at', 'desc'); //logika pencarian @@ -110,7 +110,7 @@ class HistoryController extends Controller public function historyPengembalian(Request $request) { $perPage = $request->input('perPage', 5); - $query = asset_status::with(['customer', 'warehouseId', 'warehouse', 'warehouseEnter', 'kondisi_peti']) + $query = asset_status::with(['customer', 'warehouse', 'warehouseEnter', 'kondisi_peti']) ->where('status', '=', 1) ->orderBy('created_at', 'desc'); diff --git a/app/Http/Controllers/KondisiPetiController.php b/app/Http/Controllers/KondisiPetiController.php index 5c3daec..e09b8cc 100644 --- a/app/Http/Controllers/KondisiPetiController.php +++ b/app/Http/Controllers/KondisiPetiController.php @@ -27,6 +27,8 @@ class KondisiPetiController extends Controller try { $currentUser = Auth::user(); $validatedData = $request->except('_token'); + $validatedData['nama_kondisi'] = strtoupper($validatedData['nama_kondisi']); // Menggunakan nama pengguna sebagai created_by + $validatedData['deskripsi_kondisi'] = strtoupper($validatedData['deskripsi_kondisi']); // Menggunakan nama pengguna sebagai created_by $validatedData['created_by'] = $currentUser->fullname; // Menggunakan nama pengguna sebagai created_by $validatedData['updated_by'] = $currentUser->fullname; // Menggunakan nama pengguna sebagai updated_by // dd($validatedData); @@ -44,6 +46,8 @@ class KondisiPetiController extends Controller $kondisiPeti = Kondisi_Peti::findOrFail($id); $validatedData = $request->except('_token'); + $validatedData['nama_kondisi'] = strtoupper($validatedData['nama_kondisi']); // Menggunakan nama pengguna sebagai created_by + $validatedData['deskripsi_kondisi'] = strtoupper($validatedData['deskripsi_kondisi']); $validatedData['updated_by'] = $currentUser->fullname; $kondisiPeti->update($validatedData); diff --git a/app/Http/Controllers/PeminjamanController.php b/app/Http/Controllers/PeminjamanController.php index 44b61d3..4d1a734 100644 --- a/app/Http/Controllers/PeminjamanController.php +++ b/app/Http/Controllers/PeminjamanController.php @@ -25,7 +25,7 @@ class PeminjamanController extends Controller { $perPage = $request->input('perPage', 5); - $query = asset_status::with(['customer', 'warehouseId', 'warehouse', 'warehouseEnter', 'kondisi_peti']) + $query = asset_status::with(['customer', 'warehouse', 'warehouseEnter', 'kondisi_peti']) ->where('status', '=', 0) ->orderBy('created_at', 'desc'); @@ -117,7 +117,6 @@ class PeminjamanController extends Controller return view('dashboard.Peminjaman.index', $data); } - /** * Halaman tambah data */ @@ -215,6 +214,7 @@ class PeminjamanController extends Controller 'peminjaman' => asset_status::findOrFail($id), 'warehouse' => m_warehouse::get(), 'kondisiPeti' => Kondisi_Peti::get(), + 'customer' => Customer::get(), 'active' => 'menu-pengembalian', ]; return view('dashboard.Peminjaman.pengembalian', $data); @@ -284,7 +284,7 @@ class PeminjamanController extends Controller $petiId = $request->get('peti_id'); // Fetch customer data and warehouse based on the selected peti - $peti = Peti::with(['customer', 'warehouse']) + $peti = Peti::with(['customer', 't_warehouse']) ->where('id', $petiId) ->first(); @@ -305,16 +305,16 @@ class PeminjamanController extends Controller $selectedCustomer = $peti->customer->id; } - if ($peti && $peti->warehouse) { + if ($peti && $peti->t_warehouse) { // Extract warehouse data from the related relationship $warehouseData[] = [ - 'id' => $peti->warehouse->id, - 'name' => $peti->warehouse->name, + 'id' => $peti->t_warehouse->id, + 'name' => $peti->t_warehouse->name, // Add any other fields you want to include ]; // Set the selectedWarehouse to the warehouse id - $selectedWarehouse = $peti->warehouse->id; + $selectedWarehouse = $peti->t_warehouse->id; } return response()->json([ diff --git a/app/Http/Controllers/PengembalianController.php b/app/Http/Controllers/PengembalianController.php index db407a8..03fd806 100644 --- a/app/Http/Controllers/PengembalianController.php +++ b/app/Http/Controllers/PengembalianController.php @@ -3,6 +3,7 @@ namespace App\Http\Controllers; use App\Models\Peti; +use App\Models\Customer; use App\Models\m_warehouse; use App\Models\asset_status; use App\Models\Kondisi_Peti; @@ -18,7 +19,7 @@ class PengembalianController extends Controller public function index(Request $request) { $perPage = $request->input('perPage', 5); - $query = asset_status::with(['customer', 'warehouseId', 'warehouse', 'warehouseEnter', 'kondisi_peti']) + $query = asset_status::with(['customer', 'warehouse', 'warehouseEnter', 'kondisi_peti']) ->where('status', '=', 1) ->join(DB::raw('(SELECT peti_id, MAX(updated_at) as latest_update FROM asset_statuses GROUP BY peti_id) as latest_peti'), function ($join) { $join->on('asset_statuses.peti_id', '=', 'latest_peti.peti_id') @@ -162,6 +163,7 @@ class PengembalianController extends Controller 'peminjaman' => asset_status::findOrFail($id), 'warehouse' => m_warehouse::get(), 'kondisiPeti' => Kondisi_Peti::get(), + 'customer' => Customer::get(), 'active' => 'menu-pengembalian', ]; return view('dashboard.Pengembalian.edit', $data); @@ -174,23 +176,32 @@ class PengembalianController extends Controller { // dd($request); try { + // Mendapatkan informasi pengguna yang sedang login + $currentUser = Auth::user(); + + // Validasi data dari request + $validatedData = $request->validated(); $peminjaman = asset_status::findOrFail($id); - // Update atribut-atribut yang diperlukan - $peminjaman->enter_pic = Auth::user()->fullname; - $peminjaman->updated_by = Auth::user()->fullname; - - $peminjaman->peti_id = $request->input('peti_id'); - $peminjaman->exit_at = $request->input('exit_at'); - $peminjaman->est_pengembalian = $request->input('est_pengembalian'); - $peminjaman->exit_warehouse = $request->input('exit_warehouse'); - $peminjaman->enter_at = $request->input('enter_at'); - $peminjaman->enter_warehouse = $request->input('enter_warehouse'); - $peminjaman->kondisi_peti_id = $request->input('kondisi_peti_id'); - // Mengatur status menjadi 1 secara otomatis - $peminjaman->status = 1; + $validatedData['updated_by'] = $currentUser->fullname; + $validatedData['enter_pic'] = $currentUser->fullname; + $validatedData['status'] = 1; + + $peminjaman = asset_status::find($id); + + if (!$peminjaman) { + return redirect()->route('dashboard.peminjaman.index')->with('error', 'Proses Pengembalian Peti tidak ditemukan'); + } + // dd($validatedData); + $peminjaman->update($validatedData); // dd($peminjaman); - $peminjaman->save(); + // Mengupdate warehouse_id pada model Peti + Peti::where('id', $peminjaman->peti_id) + ->update([ + 't_warehouse_id' => $peminjaman->enter_warehouse, + // 'customer_id' => $transfer->name_customer, + 'updated_by' => $currentUser->fullname, + ]); return redirect()->route('dashboard.pengembalian.index')->with('success', 'Data peminjaman berhasil diperbaharui'); } catch (\Throwable $th) { @@ -198,6 +209,34 @@ class PengembalianController extends Controller return redirect()->back()->with('error', 'Data peminjaman gagal diperbaharui: ' . $th->getMessage()); } } + // public function update(ValidasiUpdatePengembalian $request, $id) + // { + // dd($request); + // try { + // $peminjaman = asset_status::findOrFail($id); + + // // Update atribut-atribut yang diperlukan + // $peminjaman->enter_pic = Auth::user()->fullname; + // $peminjaman->updated_by = Auth::user()->fullname; + + // $peminjaman->peti_id = $request->input('peti_id'); + // $peminjaman->exit_at = $request->input('exit_at'); + // $peminjaman->est_pengembalian = $request->input('est_pengembalian'); + // $peminjaman->exit_warehouse = $request->input('exit_warehouse'); + // $peminjaman->enter_at = $request->input('enter_at'); + // $peminjaman->enter_warehouse = $request->input('enter_warehouse'); + // $peminjaman->kondisi_peti_id = $request->input('kondisi_peti_id'); + // // Mengatur status menjadi 1 secara otomatis + // $peminjaman->status = 1; + // // dd($peminjaman); + // $peminjaman->save(); + + // return redirect()->route('dashboard.pengembalian.index')->with('success', 'Data peminjaman berhasil diperbaharui'); + // } catch (\Throwable $th) { + // // Tampilkan pesan kesalahan untuk debugging + // return redirect()->back()->with('error', 'Data peminjaman gagal diperbaharui: ' . $th->getMessage()); + // } + // } /** * Remove the specified resource from storage. diff --git a/app/Http/Controllers/PetiController.php b/app/Http/Controllers/PetiController.php index ce45c4c..968e411 100644 --- a/app/Http/Controllers/PetiController.php +++ b/app/Http/Controllers/PetiController.php @@ -198,15 +198,13 @@ class PetiController extends Controller // Generate nilai 'fix_lot' sesuai format yang diinginkan $fixLot = $code_customer . $type . $size_peti . $lot_no . $packing_no; $validatedData['fix_lot'] = $fixLot; + $validatedData['warna'] = strtoupper($validatedData['warna']); $validatedData['updated_by'] = $currentuser->fullname; $validatedData['t_warehouse_id'] = $validatedData['warehouse_id']; // Tambahkan perubahan yang diperlukan ke entitas Peti $typepeti->update($validatedData); - // // Menambahkan nama pengguna yang melakukan pembaruan - // $typepeti->update(['updated_by' => $currentuser->fullname]); - return redirect()->route('dashboard.peti.index')->with('success', 'Data peti berhasil diperbaharui'); } catch (\Throwable $th) { return redirect()->back()->with('error', 'Data peti gagal diperbaharui'); diff --git a/app/Http/Controllers/Report/PetternLotPetiController.php b/app/Http/Controllers/Report/PetternLotPetiController.php index a3d7dab..e07e84f 100644 --- a/app/Http/Controllers/Report/PetternLotPetiController.php +++ b/app/Http/Controllers/Report/PetternLotPetiController.php @@ -12,6 +12,7 @@ use App\Exports\PetternLotPetiExport; class PetternLotPetiController extends Controller { + //report peti public function index(Request $request) { $perPage = $request->input('perPage', 5); @@ -85,6 +86,6 @@ class PetternLotPetiController extends Controller public function export() { // dd('test'); - return Excel::download(new PetternLotPetiExport, 'PATTERN_LOT_PETI.xlsx'); + return Excel::download(new PetternLotPetiExport, 'REPORT_PETI.xlsx'); } } diff --git a/app/Http/Controllers/TransferController.php b/app/Http/Controllers/TransferController.php index e9ec7be..a51a9a8 100644 --- a/app/Http/Controllers/TransferController.php +++ b/app/Http/Controllers/TransferController.php @@ -75,44 +75,21 @@ class TransferController extends Controller $validatedData['updated_by'] = $currentUser->fullname; // Membuat entitas Transfer - Transfer::create($validatedData); + $transfer = Transfer::create($validatedData); + // dd($transfer); + // Mengupdate warehouse_id pada model Peti + Peti::where('id', $transfer->peti_id) + ->update([ + 't_warehouse_id' => $transfer->destination_warehouse, + 'updated_by' => $currentUser->fullname, + // 'customer_id' => $transfer->name_customer, // tambahan update customer id + ]); return redirect()->route('dashboard.transfer.index')->with('success', 'Data Transfer Peti berhasil ditambahkan'); } catch (\Throwable $th) { return redirect()->back()->with('error', 'Data Transfer Peti gagal ditransfer'); } } - //proses tambah data transfer beserta update data peti - // public function store(ValidasiCreateTransfer $request) - // { - // // dd($request); - // try { - // // Mendapatkan informasi pengguna yang sedang login - // $currentUser = Auth::user(); - - // // Validasi data dari request - // $validatedData = $request->validated(); - - // // Menambahkan informasi pengguna ke dalam data yang akan disimpan - // $validatedData['mobile_id'] = Uuid::v4(); // Menambahkan ID Mobile - // $validatedData['created_by'] = $currentUser->fullname; - // $validatedData['updated_by'] = $currentUser->fullname; - - // // Membuat entitas Transfer - // $transfer = Transfer::create($validatedData); - // // dd($transfer); - // // Mengupdate warehouse_id pada model Peti - // Peti::where('id', $transfer->peti_id) - // ->update([ - // 'warehouse_id' => $transfer->destination_warehouse, - // 'customer_id' => $transfer->name_customer, // tambahan update customer id - // ]); - - // return redirect()->route('dashboard.transfer.index')->with('success', 'Data Transfer Peti berhasil ditambahkan'); - // } catch (\Throwable $th) { - // return redirect()->back()->with('error', 'Data Transfer Peti gagal ditransfer'); - // } - // } /** * Show the form for editing the specified resource. @@ -155,46 +132,19 @@ class TransferController extends Controller // Memperbarui data transfer $transfer->update($validatedData); + // Mengupdate warehouse_id pada model Peti + Peti::where('id', $transfer->peti_id) + ->update([ + 't_warehouse_id' => $transfer->destination_warehouse, + // 'customer_id' => $transfer->name_customer, + 'updated_by' => $currentUser->fullname, + ]); + return redirect()->route('dashboard.transfer.index')->with('success', 'Data Transfer Peti berhasil diperbaharui'); } catch (\Throwable $th) { return redirect()->back()->with('error', 'Data Transfer Peti gagal diperbaharui'); } } - //proses tambah data transfer beserta update data peti - // public function update(ValidasiUpdateTransfer $request, $id) - // { - // try { - // // Mendapatkan informasi pengguna yang sedang login - // $currentUser = Auth::user(); - - // // Validasi data dari request - // $validatedData = $request->validated(); - - // // Menambahkan informasi pengguna ke dalam data yang akan disimpan - // $validatedData['updated_by'] = $currentUser->fullname; - - // // Mencari transfer berdasarkan ID - // $transfer = Transfer::find($id); - - // if (!$transfer) { - // return redirect()->route('dashboard.transfer.index')->with('error', 'Data Transfer Peti tidak ditemukan'); - // } - - // // Memperbarui data transfer - // $transfer->update($validatedData); - - // // Mengupdate warehouse_id pada model Peti - // Peti::where('id', $transfer->peti_id) - // ->update([ - // 'warehouse_id' => $transfer->destination_warehouse, - // 'customer_id' => $transfer->name_customer, - // ]); - - // return redirect()->route('dashboard.transfer.index')->with('success', 'Data Transfer Peti berhasil diperbaharui'); - // } catch (\Throwable $th) { - // return redirect()->back()->with('error', 'Data Transfer Peti gagal diperbaharui'); - // } - // } /** * Remove the specified resource from storage. @@ -268,7 +218,7 @@ class TransferController extends Controller $petiId = $request->get('peti_id'); // Fetch customer data and warehouse based on the selected peti - $peti = Peti::with(['customer', 'warehouse']) + $peti = Peti::with(['customer', 't_warehouse']) ->where('id', $petiId) ->first(); @@ -289,16 +239,16 @@ class TransferController extends Controller $selectedCustomer = $peti->customer->id; } - if ($peti && $peti->warehouse) { + if ($peti && $peti->t_warehouse) { // Extract warehouse data from the related relationship $warehouseData[] = [ - 'id' => $peti->warehouse->id, - 'name' => $peti->warehouse->name, + 'id' => $peti->t_warehouse->id, + 'name' => $peti->t_warehouse->name, // Add any other fields you want to include ]; // Set the selectedWarehouse to the warehouse id - $selectedWarehouse = $peti->warehouse->id; + $selectedWarehouse = $peti->t_warehouse->id; } return response()->json([ diff --git a/app/Http/Controllers/TypePetiController.php b/app/Http/Controllers/TypePetiController.php index 56bb5fa..cbe6073 100644 --- a/app/Http/Controllers/TypePetiController.php +++ b/app/Http/Controllers/TypePetiController.php @@ -43,6 +43,10 @@ class TypePetiController extends Controller try { $currenttype = Auth::user(); $validatedData = $request->except('_token'); + + $validatedData['type'] = strtoupper($validatedData['type']); + $validatedData['size_peti'] = strtoupper($validatedData['size_peti']); + $validatedData['description'] = strtoupper($validatedData['description']); $validatedData['created_by'] = $currenttype->fullname; // Menggunakan nama pengguna sebagai created_by $validatedData['updated_by'] = $currenttype->fullname; // Menggunakan nama pengguna sebagai updated_by // dd($validatedData); @@ -88,9 +92,12 @@ class TypePetiController extends Controller $typepetiData = $request->all(); // Menambahkan nama pengguna yang melakukan pembaruan + $typepetiData['type'] = strtoupper($typepetiData['type']); + $typepetiData['size_peti'] = strtoupper($typepetiData['size_peti']); + $typepetiData['description'] = strtoupper($typepetiData['description']); $typepetiData['updated_by'] = Auth::user()->fullname; - $typepeti->update($typepetiData); + return redirect()->route('dashboard.typepeti.index')->with('success', 'Data typepeti berhasil diperbaharui'); } catch (\Throwable $th) { return redirect()->back()->with('error', 'Data typepeti gagal diperbaharui'); diff --git a/app/Http/Controllers/WarehouseController.php b/app/Http/Controllers/WarehouseController.php index 2fba685..7c72103 100644 --- a/app/Http/Controllers/WarehouseController.php +++ b/app/Http/Controllers/WarehouseController.php @@ -36,6 +36,10 @@ class WarehouseController extends Controller $currentUser = Auth::user(); $validatedData = $request->except('_token'); + + $validatedData['name'] = strtoupper($validatedData['name']); + $validatedData['description'] = strtoupper($validatedData['description']); + $validatedData['address'] = strtoupper($validatedData['address']); $validatedData['created_by'] = $currentUser->fullname; $validatedData['updated_by'] = $currentUser->fullname; @@ -54,10 +58,14 @@ class WarehouseController extends Controller { try { $warehouse = m_warehouse::findOrFail($id); + $warehouseData = $request->all(); + $warehouseData['name'] = strtoupper($warehouseData['name']); + $warehouseData['description'] = strtoupper($warehouseData['description']); + $warehouseData['address'] = strtoupper($warehouseData['address']); + // Menambahkan nama pengguna yang melakukan pembaruan + $warehouseData['updated_by'] = Auth::user()->fullname; $warehouse->update($request->all()); - // Menambahkan nama pengguna yang melakukan pembaruan - $userData['updated_by'] = Auth::user()->fullname; return redirect()->back()->with('success', 'Data Gudang Berhasil Diperbaharui'); } catch (\Throwable $th) { diff --git a/app/Http/Requests/ValidasiCreatePeminjaman.php b/app/Http/Requests/ValidasiCreatePeminjaman.php index 1285003..3d13a3b 100644 --- a/app/Http/Requests/ValidasiCreatePeminjaman.php +++ b/app/Http/Requests/ValidasiCreatePeminjaman.php @@ -27,7 +27,6 @@ class ValidasiCreatePeminjaman extends FormRequest 'exit_at' => 'required|date', 'est_pengembalian' => 'required|date', // Estimasi pengembalian harus setelah exit_at 'warehouse_id' => 'required|integer', // Pastikan warehouse_id ada dalam tabel m_warehouses - 'exit_warehouse' => 'required|integer', ]; } @@ -44,8 +43,6 @@ class ValidasiCreatePeminjaman extends FormRequest 'est_pengembalian.date' => 'Bidang Estimasi Tanggal Pengembalian harus berupa tanggal.', 'warehouse_id.required' => 'Bidang Asal Gudang wajib diisi.', 'warehouse_id.integer' => 'Bidang Asal Gudang harus berupa angka.', - 'exit_warehouse.required' => 'Bidang Tujuan Gudang wajib diisi.', - 'exit_warehouse.integer' => 'Bidang Tujuan Gudang harus berupa angka.', ]; } } diff --git a/app/Http/Requests/ValidasiUpdatePeminjaman.php b/app/Http/Requests/ValidasiUpdatePeminjaman.php index 7acdf27..08e9c9b 100644 --- a/app/Http/Requests/ValidasiUpdatePeminjaman.php +++ b/app/Http/Requests/ValidasiUpdatePeminjaman.php @@ -27,7 +27,6 @@ class ValidasiUpdatePeminjaman extends FormRequest 'exit_at' => 'required|date', 'est_pengembalian' => 'required|date', // Estimasi pengembalian harus setelah exit_at 'warehouse_id' => 'required|integer', // Pastikan warehouse_id ada dalam tabel m_warehouses - 'exit_warehouse' => 'required|integer', ]; } @@ -44,8 +43,6 @@ class ValidasiUpdatePeminjaman extends FormRequest 'est_pengembalian.date' => 'Bidang Estimasi Tanggal Pengembalian harus berupa tanggal.', 'warehouse_id.required' => 'Bidang Asal Gudang wajib diisi.', 'warehouse_id.integer' => 'Bidang Asal Gudang harus berupa angka.', - 'exit_warehouse.required' => 'Bidang Tujuan Gudang wajib diisi.', - 'exit_warehouse.integer' => 'Bidang Tujuan Gudang harus berupa angka.', ]; } } diff --git a/app/Http/Requests/ValidasiUpdatePengembalian.php b/app/Http/Requests/ValidasiUpdatePengembalian.php index 9527331..72fe312 100644 --- a/app/Http/Requests/ValidasiUpdatePengembalian.php +++ b/app/Http/Requests/ValidasiUpdatePengembalian.php @@ -25,10 +25,10 @@ class ValidasiUpdatePengembalian extends FormRequest 'peti_id' => 'required|integer', 'exit_at' => 'required|date', 'est_pengembalian' => 'required|date', - 'exit_warehouse' => 'required|integer', 'enter_at' => 'required|date', 'enter_warehouse' => 'required|integer', 'kondisi_peti_id' => 'required|integer', + 'customer_id' => 'required|integer', 'status' => '', ]; } @@ -42,14 +42,14 @@ class ValidasiUpdatePengembalian extends FormRequest 'exit_at.date' => 'Kolom exit_at harus berupa tanggal.', 'est_pengembalian.required' => 'Kolom est_pengembalian wajib diisi.', 'est_pengembalian.date' => 'Kolom est_pengembalian harus berupa tanggal.', - 'exit_warehouse.required' => 'Kolom exit_warehouse wajib diisi.', - 'exit_warehouse.integer' => 'Kolom exit_warehouse harus berupa angka.', 'enter_at.required' => 'Kolom enter_at wajib diisi.', 'enter_at.date' => 'Kolom enter_at harus berupa tanggal.', 'enter_warehouse.required' => 'Kolom enter_warehouse wajib diisi.', 'enter_warehouse.integer' => 'Kolom enter_warehouse harus berupa angka.', 'kondisi_peti_id.required' => 'Kolom kondisi_peti_id wajib diisi.', 'kondisi_peti_id.integer' => 'Kolom kondisi_peti_id harus berupa angka.', + 'customer_id.required' => 'Kolom customer_id wajib diisi.', + 'customer_id.integer' => 'Kolom customer_id harus berupa angka.', ]; } } diff --git a/app/Imports/CustomerImport.php b/app/Imports/CustomerImport.php index b199738..f26927e 100644 --- a/app/Imports/CustomerImport.php +++ b/app/Imports/CustomerImport.php @@ -56,6 +56,7 @@ class CustomerImport implements ToModel, WithHeadingRow 'no_tlp' => $row['no_telepon'], 'address' => strtoupper($row['alamat']), 'created_by' => $user->fullname, + 'updated_by' => $user->fullname, ]); } diff --git a/app/Imports/KondisiPetiImport.php b/app/Imports/KondisiPetiImport.php index 5155a4e..4988f3a 100644 --- a/app/Imports/KondisiPetiImport.php +++ b/app/Imports/KondisiPetiImport.php @@ -53,6 +53,7 @@ class KondisiPetiImport implements ToModel, WithHeadingRow 'nama_kondisi' => strtoupper($row['kondisi_peti']), 'deskripsi_kondisi' => strtoupper($row['deskripsi_kondisi']), 'created_by' => $user->fullname, + 'updated_by' => $user->fullname, ]); } diff --git a/app/Imports/TipePetiImport.php b/app/Imports/TipePetiImport.php index d6dc151..3bd772d 100644 --- a/app/Imports/TipePetiImport.php +++ b/app/Imports/TipePetiImport.php @@ -55,6 +55,7 @@ class TipePetiImport implements ToModel, WithHeadingRow 'size_peti' => strtoupper($row['ukuran_peti']), 'description' => strtoupper($row['deskripsi_tipe']), 'created_by' => $user->fullname, + 'updated_by' => $user->fullname, ]); } diff --git a/app/Models/Peti.php b/app/Models/Peti.php index d83a789..1861d0a 100644 --- a/app/Models/Peti.php +++ b/app/Models/Peti.php @@ -45,6 +45,10 @@ class Peti extends Model { return $this->belongsTo(m_warehouse::class, 'warehouse_id')->select('id', 'name', 'address')->withTrashed(); } + public function t_warehouse() + { + return $this->belongsTo(m_warehouse::class, 't_warehouse_id'); + } public function tipe_peti() { return $this->belongsTo(Type_peti::class, 'tipe_peti_id')->select( diff --git a/app/Models/asset_status.php b/app/Models/asset_status.php index c0fbfee..0df91e7 100644 --- a/app/Models/asset_status.php +++ b/app/Models/asset_status.php @@ -23,7 +23,7 @@ class asset_status extends Model 'exit_pic', 'customer_id', 'warehouse_id', - 'exit_warehouse', + // 'exit_warehouse', 'enter_at', 'enter_pic', 'enter_warehouse', @@ -33,14 +33,14 @@ class asset_status extends Model 'updated_by', ]; - public function warehouseId() - { - return $this->belongsTo(m_warehouse::class, 'warehouse_id')->select('id', 'name', 'address')->withTrashed(); - } + // public function warehouseId() + // { + // return $this->belongsTo(m_warehouse::class, 'warehouse_id')->select('id', 'name', 'address')->withTrashed(); + // } public function warehouse() { - return $this->belongsTo(m_warehouse::class, 'exit_warehouse')->select('id', 'name', 'address')->withTrashed(); + return $this->belongsTo(m_warehouse::class, 'warehouse_id')->select('id', 'name', 'address')->withTrashed(); } public function warehouseEnter() diff --git a/database/migrations/2023_11_06_122033_create_asset_statuses_table.php b/database/migrations/2023_11_06_122033_create_asset_statuses_table.php index 7f68673..1bc8ea6 100644 --- a/database/migrations/2023_11_06_122033_create_asset_statuses_table.php +++ b/database/migrations/2023_11_06_122033_create_asset_statuses_table.php @@ -13,18 +13,17 @@ return new class extends Migration { Schema::create('asset_statuses', function (Blueprint $table) { $table->id(); - $table->uuid('mobile_id')->nullable(); - // $table->foreignId('peti_id')->nullable()->constrained('petis'); - $table->foreignId('peti_id')->nullable()->constrained('petis')->onDelete('cascade'); - $table->date('exit_at')->nullable(); - $table->date('est_pengembalian')->nullable(); - $table->string('exit_pic', 200)->nullable(); - $table->foreignId('customer_id')->nullable()->constrained('customers'); - $table->foreignId('warehouse_id')->nullable()->constrained('m_warehouses'); - $table->foreignId('exit_warehouse')->nullable()->constrained('m_warehouses'); - $table->date('enter_at')->nullable(); - $table->string('enter_pic', 200)->nullable(); - $table->foreignId('enter_warehouse')->nullable()->constrained('m_warehouses'); + $table->uuid('mobile_id')->nullable(); // proses untuk mobile_app + $table->foreignId('peti_id')->nullable()->constrained('petis')->onDelete('cascade'); // proses untuk inputan kode peti + $table->date('exit_at')->nullable(); // proses untuk inputan tanggal keluar peti + $table->date('est_pengembalian')->nullable(); // proses untuk inputan tanggal estimasi pengembalian peti + $table->string('exit_pic', 200)->nullable(); // proses untuk pj keluar peti + $table->foreignId('customer_id')->nullable()->constrained('customers'); // proses untuk inputan customer + $table->foreignId('warehouse_id')->nullable()->constrained('m_warehouses'); // proses untuk asal peminjaman gudang peti + // $table->foreignId('exit_warehouse')->nullable()->constrained('m_warehouses'); // tidak di pakai + $table->date('enter_at')->nullable(); // proses untuk inputan tanggal masuk peti + $table->string('enter_pic', 200)->nullable(); // proses untuk pj masuk peti + $table->foreignId('enter_warehouse')->nullable()->constrained('m_warehouses'); // proses untuk tujuan pengembalian gudang peti $table->foreignId('kondisi_peti_id')->nullable()->constrained('kondisi_petis'); $table->boolean('status')->default(0); $table->timestamps(); diff --git a/public/assets/file/Format_Import_Tipe_Peti.csv b/public/assets/file/Format_Import_Tipe_Peti.csv index cc6ba0f..6870111 100644 --- a/public/assets/file/Format_Import_Tipe_Peti.csv +++ b/public/assets/file/Format_Import_Tipe_Peti.csv @@ -1 +1 @@ -TIpe Peti,Ukuran Peti,Deskripsi Tipe +Tipe Peti,Ukuran Peti,Deskripsi Tipe diff --git a/public/assets/img/logo_istw.png b/public/assets/img/logo_istw.png new file mode 100644 index 0000000..1fd93e9 Binary files /dev/null and b/public/assets/img/logo_istw.png differ diff --git a/resources/views/dashboard/History/Peminjaman/index.blade.php b/resources/views/dashboard/History/Peminjaman/index.blade.php index 8a415e8..84fff5b 100644 --- a/resources/views/dashboard/History/Peminjaman/index.blade.php +++ b/resources/views/dashboard/History/Peminjaman/index.blade.php @@ -53,12 +53,13 @@ No - Kode Peti + Fix Lot Nama Customer Kode Tgl Peminjaman + Est Pengembalian + Asal Gudang PJ Peminjaman - GD Peminjam @@ -70,8 +71,9 @@ {{ $data_peminjaman->peti->customer->code_customer }} - {{ $data_peminjaman->peti->tipe_peti->type }} {{ \Carbon\Carbon::parse($data_peminjaman->exit_at)->format('d-m-Y') }} - {{ $data_peminjaman->exit_pic }} + {{ \Carbon\Carbon::parse($data_peminjaman->est_pengembalian)->format('d-m-Y') }} {{ $data_peminjaman->warehouse->name }} + {{ $data_peminjaman->exit_pic }} @empty diff --git a/resources/views/dashboard/History/Pengembalian/index.blade.php b/resources/views/dashboard/History/Pengembalian/index.blade.php index bcb978e..f02c05c 100644 --- a/resources/views/dashboard/History/Pengembalian/index.blade.php +++ b/resources/views/dashboard/History/Pengembalian/index.blade.php @@ -52,15 +52,15 @@ No - Kode Peti - Customer - Tgl Peinjaman + Fix Lot + Nama Customer + Tgl Peminjaman Estimasi Pengembalian PJ Peminjaman - Asal GD Peminjaman + GD Peminjaman Tgl Pengembalian PJ Pengembalian - Tujuan GD Pengembalian + GD Pengembalian Kondisi Peti Status @@ -75,7 +75,7 @@ {{ \Carbon\Carbon::parse($data->est_pengembalian)->format('d-m-Y') }} {{ $data->exit_pic }} - @if ($data->exit_warehouse) + @if ($data->warehouse_id) {{ $data->warehouse->name }} @else

-

diff --git a/resources/views/dashboard/History/Transfer/index.blade.php b/resources/views/dashboard/History/Transfer/index.blade.php index e6f1980..e221704 100644 --- a/resources/views/dashboard/History/Transfer/index.blade.php +++ b/resources/views/dashboard/History/Transfer/index.blade.php @@ -23,7 +23,7 @@ No - Kode Peti + Fix Lot Nama Customer Tgl Transfer Asal Gudang diff --git a/resources/views/dashboard/Master_Data/Customer/create.blade.php b/resources/views/dashboard/Master_Data/Customer/create.blade.php index 18d6d35..c4378a3 100644 --- a/resources/views/dashboard/Master_Data/Customer/create.blade.php +++ b/resources/views/dashboard/Master_Data/Customer/create.blade.php @@ -31,8 +31,10 @@ + placeholder="Masukkan Nomor Telepon customer" pattern="[0-9\+\-\(\)\s]+" + title="Hanya angka, simbol +, -, (, ), dan spasi yang diperbolehkan" + oninput="this.value = this.value.replace(/[^0-9\+\-\(\)\s]+/, '')" required> + diff --git a/resources/views/dashboard/Master_Data/Customer/edit.blade.php b/resources/views/dashboard/Master_Data/Customer/edit.blade.php index f7a92b6..9bfd3dc 100644 --- a/resources/views/dashboard/Master_Data/Customer/edit.blade.php +++ b/resources/views/dashboard/Master_Data/Customer/edit.blade.php @@ -31,13 +31,12 @@ - + - + diff --git a/resources/views/dashboard/Master_Data/Customer/index.blade.php b/resources/views/dashboard/Master_Data/Customer/index.blade.php index 1cd6b1c..0ddbc89 100644 --- a/resources/views/dashboard/Master_Data/Customer/index.blade.php +++ b/resources/views/dashboard/Master_Data/Customer/index.blade.php @@ -30,7 +30,7 @@ No - Nama + Nama Customer Kode Customer No. Telepon Alamat diff --git a/resources/views/dashboard/Master_Data/Customer/show.blade.php b/resources/views/dashboard/Master_Data/Customer/show.blade.php index b128760..7dd9883 100644 --- a/resources/views/dashboard/Master_Data/Customer/show.blade.php +++ b/resources/views/dashboard/Master_Data/Customer/show.blade.php @@ -20,10 +20,10 @@ - + - +