diff --git a/app/Exports/AssetExport.php b/app/Exports/AssetExport.php deleted file mode 100644 index 2363c09..0000000 --- a/app/Exports/AssetExport.php +++ /dev/null @@ -1,17 +0,0 @@ -get(); + + // Inisialisasi nomor awal + // $nomor = 1; + + // Modifikasi data dan tambahkan nomor + $data = $customers->map(function ($customer) use (&$nomor) { + return [ + 'No' => $customer->id, + 'Nama Customer' => $customer->name, + 'Kode Customer' => $customer->code_customer, + 'Lot No' => $customer->lot_no, + 'No Telepon' => $customer->no_tlp, + 'Alamat' => $customer->address, + ]; + }); + + return $data; + } + + public function headings(): array + { + return [ + 'No', + 'NAMA CUSTOMER', + 'kODE CUSTOMER', + 'LOT NO', + 'NO TELEPONE', + 'ALAMAT', + ]; + } +} diff --git a/app/Exports/KondisiPetiExport.php b/app/Exports/KondisiPetiExport.php new file mode 100644 index 0000000..c696b7c --- /dev/null +++ b/app/Exports/KondisiPetiExport.php @@ -0,0 +1,46 @@ +get(); + + // Inisialisasi nomor awal + // $nomor = 1; + + // Modifikasi data dan tambahkan nomor + $data = $kondisipetis->map(function ($kondisipeti) use (&$nomor) { + return [ + 'No' => $kondisipeti->id, + 'Nama Kondisi' => $kondisipeti->nama_kondisi, + 'Deskripsi' => $kondisipeti->deskripsi_kondisi, + ]; + }); + + return $data; + } + + public function headings(): array + { + return [ + 'No', + 'NAMA KONDISI', + 'DESKRIPSI', + ]; + } +} diff --git a/app/Exports/PetternLotPetiExport.php b/app/Exports/PetternLotPetiExport.php index 7b20eba..954069c 100644 --- a/app/Exports/PetternLotPetiExport.php +++ b/app/Exports/PetternLotPetiExport.php @@ -28,6 +28,7 @@ class PetternLotPetiExport implements FromCollection, WithHeadings $data = $petis->map(function ($peti) use (&$nomor) { return [ 'No' => $nomor++, + 'FIX LOT' => $peti->fix_lot, 'Customer' => $peti->customer->name, 'Warehouse' => $peti->warehouse->name, 'CODE CUSTOMER' => $peti->customer->code_customer, @@ -35,7 +36,6 @@ class PetternLotPetiExport implements FromCollection, WithHeadings 'UKURAN PETI' => $peti->tipe_peti->size_peti, 'LOT NO' => $peti->customer->lot_no, 'PACKING NO' => $peti->packing_no, - 'FIX LOT' => $peti->fix_lot, 'Status' => $peti->status, ]; }); @@ -47,6 +47,7 @@ class PetternLotPetiExport implements FromCollection, WithHeadings { return [ 'No', + 'FIX LOT', 'Customer', 'WH', 'CODE CUSTOMER', @@ -54,7 +55,6 @@ class PetternLotPetiExport implements FromCollection, WithHeadings 'UKURAN PETI', 'LOT NO', 'PACKING NO', - 'FIX LOT', 'STATUS' ]; } diff --git a/app/Exports/TipePetiExport.php b/app/Exports/TipePetiExport.php new file mode 100644 index 0000000..96b209f --- /dev/null +++ b/app/Exports/TipePetiExport.php @@ -0,0 +1,49 @@ +get(); + + // Inisialisasi nomor awal + // $nomor = 1; + + // Modifikasi data dan tambahkan nomor + $data = $tipepetis->map(function ($tipepeti) use (&$nomor) { + return [ + 'No' => $tipepeti->id, + 'Tipe' => $tipepeti->type, + 'Ukuran Peti' => $tipepeti->size_peti, + 'Deskripsi' => $tipepeti->description, + ]; + }); + + return $data; + } + + public function headings(): array + { + return [ + 'No', + 'TIPE', + 'UKURAN PETI', + 'DESKRIPSI', + ]; + } +} diff --git a/app/Exports/WarehouseExport.php b/app/Exports/WarehouseExport.php new file mode 100644 index 0000000..30a2b34 --- /dev/null +++ b/app/Exports/WarehouseExport.php @@ -0,0 +1,49 @@ +get(); + + // Inisialisasi nomor awal + // $nomor = 1; + + // Modifikasi data dan tambahkan nomor + $data = $warehouses->map(function ($warehouse) use (&$nomor) { + return [ + 'No' => $warehouse->id, + 'Nama Gudang' => $warehouse->name, + 'Deskripsi' => $warehouse->description, + 'Alamat' => $warehouse->address, + ]; + }); + + return $data; + } + + public function headings(): array + { + return [ + 'No', + 'NAMA GUDANG', + 'DESKRIPSI', + 'ALAMAT', + ]; + } +} diff --git a/app/Http/Controllers/CustomerController.php b/app/Http/Controllers/CustomerController.php index 95422cd..4fadcfb 100644 --- a/app/Http/Controllers/CustomerController.php +++ b/app/Http/Controllers/CustomerController.php @@ -113,10 +113,7 @@ class CustomerController extends Controller public function importCustomer(Request $request) { - // dd('oke'); - //melakukan import file Excel::import(new CustomerImport, request()->file('file')); - return redirect()->route('dashboard.customer.index')->with('success', 'Data customer berhasil Di Import'); } } diff --git a/app/Http/Controllers/KondisiPetiController.php b/app/Http/Controllers/KondisiPetiController.php index 76a341a..bc19142 100644 --- a/app/Http/Controllers/KondisiPetiController.php +++ b/app/Http/Controllers/KondisiPetiController.php @@ -2,11 +2,13 @@ namespace App\Http\Controllers; +use App\Models\Kondisi_Peti; use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; +use Maatwebsite\Excel\Facades\Excel; use App\Http\Requests\ValidasiCreateKondisiPeti; use App\Http\Requests\ValidasiUpdateKondisiPeti; -use App\Models\Kondisi_Peti; +use App\Imports\KondisiPetiImport; class KondisiPetiController extends Controller { @@ -64,4 +66,10 @@ class KondisiPetiController extends Controller return redirect()->back()->with('error', 'Data kondisi peti gagal dihapus'); } } + + public function importKondisiPeti(Request $request) + { + Excel::import(new KondisiPetiImport, request()->file('file')); + return redirect()->route('dashboard.kondisipeti.index')->with('success', 'Data kondisi peti berhasil di import'); + } } diff --git a/app/Http/Controllers/PetiController.php b/app/Http/Controllers/PetiController.php index 51fe33b..bd9dfbc 100644 --- a/app/Http/Controllers/PetiController.php +++ b/app/Http/Controllers/PetiController.php @@ -2,18 +2,20 @@ namespace App\Http\Controllers; -use App\Http\Requests\ValidasiCreatePeti; -use App\Http\Requests\ValidasiUpdatePeti; use Dompdf\Dompdf; use Dompdf\Options; use App\Models\Peti; use App\Models\Customer; use App\Models\Type_peti; -use App\Models\Kondisi_Peti; use Mockery\Matcher\Type; +use App\Imports\PetiImport; use App\Models\m_warehouse; +use App\Models\Kondisi_Peti; use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; +use Maatwebsite\Excel\Facades\Excel; +use App\Http\Requests\ValidasiCreatePeti; +use App\Http\Requests\ValidasiUpdatePeti; use SimpleSoftwareIO\QrCode\Facades\QrCode; class PetiController extends Controller @@ -268,4 +270,10 @@ class PetiController extends Controller ] ); } + + public function importPeti(Request $request) + { + Excel::import(new PetiImport, request()->file('file')); + return redirect()->route('dashboard.peti.index')->with('success', 'Data peti berhasil di import'); + } } diff --git a/app/Http/Controllers/PetternLotPetiController.php b/app/Http/Controllers/Report/PetternLotPetiController.php similarity index 92% rename from app/Http/Controllers/PetternLotPetiController.php rename to app/Http/Controllers/Report/PetternLotPetiController.php index ed225cf..5e50c9a 100644 --- a/app/Http/Controllers/PetternLotPetiController.php +++ b/app/Http/Controllers/Report/PetternLotPetiController.php @@ -1,12 +1,13 @@ Customer::get(), + 'active' => 'menu-ReportCustomer' + ]; + return view('dashboard.Master_Data.Report.Customer.index', $data); + } + + public function export() + { + // dd('export'); + return Excel::download(new CustomerExport, 'Report_Customer.xlsx'); + } +} diff --git a/app/Http/Controllers/Report/ReportKondisiPetiController.php b/app/Http/Controllers/Report/ReportKondisiPetiController.php new file mode 100644 index 0000000..549d35f --- /dev/null +++ b/app/Http/Controllers/Report/ReportKondisiPetiController.php @@ -0,0 +1,28 @@ + Kondisi_Peti::get(), + 'active' => 'menu-ReportKondisiPeti' + ]; + return view('dashboard.Master_Data.Report.Kondisi_Peti.index', $data); + } + + public function export() + { + // dd('export'); + return Excel::download(new KondisiPetiExport, 'Report_Kondisi_Peti.xlsx'); + } +} diff --git a/app/Http/Controllers/Report/ReportTipePetiController.php b/app/Http/Controllers/Report/ReportTipePetiController.php new file mode 100644 index 0000000..f0625ee --- /dev/null +++ b/app/Http/Controllers/Report/ReportTipePetiController.php @@ -0,0 +1,28 @@ + Type_peti::get(), + 'active' => 'menu-ReportTypePeti' + ]; + return view('dashboard.Master_Data.Report.Tipe_Peti.index', $data); + } + + public function export() + { + // dd('export'); + return Excel::download(new TipePetiExport, 'Report_Tipe_Peti.xlsx'); + } +} diff --git a/app/Http/Controllers/Report/ReportWarehouseController.php b/app/Http/Controllers/Report/ReportWarehouseController.php new file mode 100644 index 0000000..c6b9b8b --- /dev/null +++ b/app/Http/Controllers/Report/ReportWarehouseController.php @@ -0,0 +1,28 @@ + m_warehouse::get(), + 'active' => 'menu-ReportWarehouse' + ]; + return view('dashboard.Master_Data.Report.Warehouse.index', $data); + } + + public function export() + { + // dd('export'); + return Excel::download(new WarehouseExport, 'Report_Warehouse.xlsx'); + } +} diff --git a/app/Http/Controllers/StokOpNameController.php b/app/Http/Controllers/Report/StokOpNameController.php similarity index 98% rename from app/Http/Controllers/StokOpNameController.php rename to app/Http/Controllers/Report/StokOpNameController.php index deea5b8..c7fcea5 100644 --- a/app/Http/Controllers/StokOpNameController.php +++ b/app/Http/Controllers/Report/StokOpNameController.php @@ -1,12 +1,13 @@ back()->with('error', 'Data tipe peti gagal dihapus'); } } + + public function importTipePeti(Request $request) + { + Excel::import(new TipePetiImport, request()->file('file')); + return redirect()->route('dashboard.typepeti.index')->with('success', 'Data tipe peti berhasil di import'); + } } diff --git a/app/Http/Controllers/WarehouseController.php b/app/Http/Controllers/WarehouseController.php index c26df98..7f021b5 100644 --- a/app/Http/Controllers/WarehouseController.php +++ b/app/Http/Controllers/WarehouseController.php @@ -2,11 +2,13 @@ namespace App\Http\Controllers; -use App\Http\Requests\ValidasiCreateWarehouse; -use App\Http\Requests\ValidasiUpdateWarehouse; use App\Models\m_warehouse; use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; +use Maatwebsite\Excel\Facades\Excel; +use App\Http\Requests\ValidasiCreateWarehouse; +use App\Http\Requests\ValidasiUpdateWarehouse; +use App\Imports\WarehouseImport; class WarehouseController extends Controller { @@ -99,4 +101,10 @@ class WarehouseController extends Controller return redirect()->back()->with('error', 'Data Gudang gagal dihapus'); } } + + public function importWarehouse(Request $request) + { + Excel::import(new WarehouseImport, request()->file('file')); + return redirect()->route('dashboard.warehouse.index')->with('success', 'Data Warehouse berhasil diimport'); + } } diff --git a/app/Imports/CustomerImport.php b/app/Imports/CustomerImport.php index 58e549a..7381f2d 100644 --- a/app/Imports/CustomerImport.php +++ b/app/Imports/CustomerImport.php @@ -3,6 +3,7 @@ namespace App\Imports; use App\Models\Customer; +use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Hash; use Maatwebsite\Excel\Concerns\ToModel; use Maatwebsite\Excel\Concerns\WithHeadingRow; @@ -16,12 +17,16 @@ class CustomerImport implements ToModel, WithHeadingRow */ public function model(array $row) { + // Mendapatkan informasi pengguna yang sedang login + $user = Auth::user(); + return new Customer([ 'name' => $row['name'], 'code_customer' => $row['code_customer'], 'lot_no' => $row['lot_no'], 'no_tlp' => $row['no_tlp'], 'address' => $row['address'], + 'created_by' => $user->fullname, ]); } } diff --git a/app/Imports/KondisiPetiImport.php b/app/Imports/KondisiPetiImport.php new file mode 100644 index 0000000..f750a04 --- /dev/null +++ b/app/Imports/KondisiPetiImport.php @@ -0,0 +1,30 @@ + $row['nama_kondisi'], + 'deskripsi_kondisi' => $row['deskripsi_kondisi'], + 'created_by' => $user->fullname, + ]); + } +} diff --git a/app/Imports/PetiImport.php b/app/Imports/PetiImport.php new file mode 100644 index 0000000..87ea035 --- /dev/null +++ b/app/Imports/PetiImport.php @@ -0,0 +1,37 @@ + $user->fullname, + 'tipe_peti_id' => $row['tipe_peti_id'], + 'warna' => $row['warna'], + 'customer_id' => $row['customer_id'], + 'warehouse_id' => $row['warehouse_id'], + 'date_pembuatan' => now(), + 'kondisipeti_id' => $row['kondisipeti_id'], + 'packing_no' => $row['packing_no'], + 'fix_lot' => $row['fix_lot'], + 'status' => $row['status'], + ]); + } +} diff --git a/app/Imports/TipePetiImport.php b/app/Imports/TipePetiImport.php new file mode 100644 index 0000000..62d3fae --- /dev/null +++ b/app/Imports/TipePetiImport.php @@ -0,0 +1,32 @@ + $row['type'], + 'size_peti' => $row['size_peti'], + 'description' => $row['description'], + 'created_by' => $user->fullname, + ]); + } +} diff --git a/app/Imports/WarehouseImport.php b/app/Imports/WarehouseImport.php new file mode 100644 index 0000000..c0025b2 --- /dev/null +++ b/app/Imports/WarehouseImport.php @@ -0,0 +1,31 @@ + $row['name'], + 'description' => $row['description'], + 'address' => $row['address'], + 'created_by' => $user->fullname, + ]); + } +} diff --git a/app/Models/Customer.php b/app/Models/Customer.php index 6c5f5a9..445ff94 100644 --- a/app/Models/Customer.php +++ b/app/Models/Customer.php @@ -13,6 +13,7 @@ class Customer extends Model protected $table = 'customers'; protected $fillable = [ + 'id', 'name', 'code_customer', 'lot_no', diff --git a/app/Models/Kondisi_Peti.php b/app/Models/Kondisi_Peti.php index 3224a0f..56b229a 100644 --- a/app/Models/Kondisi_Peti.php +++ b/app/Models/Kondisi_Peti.php @@ -13,6 +13,7 @@ class Kondisi_Peti extends Model protected $table = 'kondisi_petis'; protected $fillable = [ + 'id', 'nama_kondisi', 'deskripsi_kondisi', 'created_by', diff --git a/app/Models/Type_peti.php b/app/Models/Type_peti.php index 7f1fad9..19814fa 100644 --- a/app/Models/Type_peti.php +++ b/app/Models/Type_peti.php @@ -13,6 +13,7 @@ class Type_peti extends Model protected $table = 'type_petis'; protected $fillable = [ + 'id', 'type', 'size_peti', 'description', diff --git a/app/Models/m_warehouse.php b/app/Models/m_warehouse.php index 2558dbd..035cacb 100644 --- a/app/Models/m_warehouse.php +++ b/app/Models/m_warehouse.php @@ -13,6 +13,7 @@ class m_warehouse extends Model protected $table = 'm_warehouses'; protected $fillable = [ + 'id', 'name', 'description', 'address', diff --git a/database/seeders/DatabaseSeeder.php b/database/seeders/DatabaseSeeder.php index 1b8b256..78e6113 100644 --- a/database/seeders/DatabaseSeeder.php +++ b/database/seeders/DatabaseSeeder.php @@ -24,10 +24,10 @@ class DatabaseSeeder extends Seeder RoleSeeder::class, WarehouseSeeder::class, UserSeeder::class, - Type_Peti::class, - Customer::class, - Kondisi_PetiSeeder::class, - PetiSeeder::class, + // Type_Peti::class, + // Customer::class, + // Kondisi_PetiSeeder::class, + // PetiSeeder::class, ]); } } diff --git a/public/assets/file/Format Import Customer.csv b/public/assets/file/Format_Import_Customer.csv similarity index 100% rename from public/assets/file/Format Import Customer.csv rename to public/assets/file/Format_Import_Customer.csv diff --git a/public/assets/file/Format_Import_Kondisi_Peti.csv b/public/assets/file/Format_Import_Kondisi_Peti.csv new file mode 100644 index 0000000..0212980 --- /dev/null +++ b/public/assets/file/Format_Import_Kondisi_Peti.csv @@ -0,0 +1 @@ +nama_kondisi,deskripsi_kondisi diff --git a/public/assets/file/Format_Import_Peti.csv b/public/assets/file/Format_Import_Peti.csv new file mode 100644 index 0000000..5f4ec5d --- /dev/null +++ b/public/assets/file/Format_Import_Peti.csv @@ -0,0 +1 @@ +tipe_peti_id,warna,customer_id,warehouse_id,jumlah,date_pembuatan,kondisipeti_id,packing_no,fix_lot,status diff --git a/public/assets/file/Format_Import_Tipe_Peti.csv b/public/assets/file/Format_Import_Tipe_Peti.csv new file mode 100644 index 0000000..9641d92 --- /dev/null +++ b/public/assets/file/Format_Import_Tipe_Peti.csv @@ -0,0 +1 @@ +type,size_peti,description diff --git a/public/assets/file/Format_Import_Warehouse.csv b/public/assets/file/Format_Import_Warehouse.csv new file mode 100644 index 0000000..bef77f3 --- /dev/null +++ b/public/assets/file/Format_Import_Warehouse.csv @@ -0,0 +1 @@ +name,description,address diff --git a/resources/views/dashboard/History/Pengembalian/index.blade.php b/resources/views/dashboard/History/Pengembalian/index.blade.php index 7dac629..217aba9 100644 --- a/resources/views/dashboard/History/Pengembalian/index.blade.php +++ b/resources/views/dashboard/History/Pengembalian/index.blade.php @@ -13,7 +13,7 @@