diff --git a/app/Http/Controllers/PetiController.php b/app/Http/Controllers/PetiController.php index d69a6ca..dc9fbef 100644 --- a/app/Http/Controllers/PetiController.php +++ b/app/Http/Controllers/PetiController.php @@ -322,31 +322,6 @@ class PetiController extends Controller ); } - // public function importPeti(Request $request) - // { - // $import = new PetiImport; - // Excel::import($import, request()->file('file')); - - // // Cek apakah ada data yang berhasil diimpor - // if ($import->getRowCount() > 0) { - // return redirect()->route('dashboard.peti.index')->with('success', 'Data Peti berhasil diimport'); - // } else { - // $errors = $import->getErrors(); - - // if ($errors) { - // foreach ($errors as $error) { - // foreach ($error->all() as $message) { - // // Tampilkan pesan kesalahan untuk setiap baris - // // Simpan pesan flash dengan kategori 'error' - // session()->flash('error', $message); - // } - // } - // } - - // // Redirect back with import data and error message - // return redirect()->back()->with('import', $import)->with('error', 'Data Import Peti gagal di import.'); - // } - // } public function importPeti(Request $request) { $import = new PetiImport; @@ -373,4 +348,17 @@ class PetiController extends Controller } } } + + public function deleteSelected(Request $request) + { + $petiIds = $request->input('peti_ids'); + + if (!empty($petiIds)) { + Peti::destroy($petiIds); + + return response()->json(['message' => 'Data peti terpilih berhasil dihapus.']); + } else { + return response()->json(['error' => 'Tidak ada data peti terpilih untuk dihapus.'], 400); + } + } } diff --git a/resources/views/dashboard/Master_Data/Manajemen_Peti/Peti/index.blade.php b/resources/views/dashboard/Master_Data/Manajemen_Peti/Peti/index.blade.php index 9491c42..be785a8 100644 --- a/resources/views/dashboard/Master_Data/Manajemen_Peti/Peti/index.blade.php +++ b/resources/views/dashboard/Master_Data/Manajemen_Peti/Peti/index.blade.php @@ -20,21 +20,26 @@
No | -- | Fix Lot | -User | -Customer | -WH | -Kode Customer | -Tipe Peti | -Ukuran Peti | -Lot No | -Kondisi Peti | -Packing No | -Status | -Action | -
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
{{ $i++ }} | -- | {{ $data_peti->fix_lot }} | -{{ $data_peti->created_by }} | -{{ $data_peti->customer->name }} | -{{ $data_peti->warehouse->name }} | -{{ $data_peti->customer->code_customer }} | -{{ $data_peti->tipe_peti->type }} | -{{ $data_peti->tipe_peti->size_peti }} | -{{ $data_peti->customer->lot_no }} | -{{ $data_peti->kondisipeti->nama_kondisi }} | -{{ $data_peti->packing_no }} | -{{ $data_peti->status }} | -- - - - - - - - | -