diff --git a/app/Http/Controllers/CustomerController.php b/app/Http/Controllers/CustomerController.php
new file mode 100644
index 0000000..6682993
--- /dev/null
+++ b/app/Http/Controllers/CustomerController.php
@@ -0,0 +1,134 @@
+ Customer::all(),
+ 'active' => 'menu-customer',
+ ];
+ return view('dashboard.Master_Data.Customer.index', $data);
+ }
+
+ /**
+ * Show the form for creating a new resource.
+ */
+ public function create()
+ {
+ $data = [
+ 'active' => 'menu-customer',
+ ];
+ return view('dashboard.Master_Data.Customer.create', $data);
+ }
+
+ /**
+ * Store a newly created resource in storage.
+ */
+ public function store(Request $request)
+ {
+ // dd('oke');
+ $request->validate([
+ 'name' => 'required',
+ 'code_customer' => 'required',
+ 'lot_no' => 'required',
+ 'nip' => '',
+ 'no_hp' => 'required',
+ 'tgl_lahir' => '',
+ 'jenis_kelamin' => '',
+ 'agama' => '',
+ 'address' => 'required',
+ ]);
+
+ try {
+ $currentUser = Auth::user();
+ $validatedData = $request->except('_token');
+ $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);
+ return redirect()->route('dashboard.customer.index')->with('success', 'Data customer berhasil ditambahkan');
+ } catch (\Throwable $th) {
+ return redirect()->back()->with('error', 'Data customer Gagal Ditambah.');
+ }
+ }
+
+ /**
+ * Display the specified resource.
+ */
+ public function show($id)
+ {
+ $data = [
+ 'customer' => Customer::findOrFail($id),
+ 'active' => 'menu-customer',
+ ];
+ return view('dashboard.Master_Data.Customer.show', $data);
+ }
+
+ /**
+ * Show the form for editing the specified resource.
+ */
+ public function edit($id)
+ {
+ $data = [
+ 'customer' => Customer::findOrFail($id),
+ 'active' => 'menu-customer',
+ ];
+ return view('dashboard.Master_Data.Customer.edit', $data);
+ }
+
+ /**
+ * Update the specified resource in storage.
+ */
+ public function update(Request $request, $id)
+ {
+ // dd($request->all());
+ $request->validate([
+ 'name' => 'required',
+ 'code_customer' => 'required',
+ 'lot_no' => 'required',
+ 'nip' => 'required',
+ 'no_hp' => 'required',
+ 'tgl_lahir' => 'required',
+ 'jenis_kelamin' => 'required',
+ 'agama' => 'required',
+ 'address' => 'required',
+ ]);
+ // dd($request);
+ try {
+ $customer = Customer::findOrFail($id);
+ $customerData = $request->all();
+
+ // Menambahkan nama pengguna yang melakukan pembaruan
+ $customerData['updated_by'] = Auth::user()->fullname;
+
+ $customer->update($customerData);
+ return redirect()->route('dashboard.customer.index')->with('success', 'Data customer berhasil diperbaharui');
+ } catch (\Throwable $th) {
+ return redirect()->back()->with('error', 'Data customer gagal diperbaharui');
+ }
+ }
+
+ /**
+ * Remove the specified resource from storage.
+ */
+ public function destroy($id)
+ {
+ // dd("oke");
+ try {
+ $customer = Customer::findOrFail($id);
+ $customer->delete();
+ return redirect()->back()->with('success', 'Data customer berhasil dihapus');
+ } catch (\Throwable $th) {
+ return redirect()->back()->with('error', 'Data customer gagal dihapus');
+ }
+ }
+}
diff --git a/app/Http/Controllers/PetiController.php b/app/Http/Controllers/PetiController.php
new file mode 100644
index 0000000..66ec3e5
--- /dev/null
+++ b/app/Http/Controllers/PetiController.php
@@ -0,0 +1,182 @@
+ Peti::all(),
+ 'active' => 'menu-peti',
+ ];
+ return view('dashboard.Master_Data.Manajemen_Peti.Peti.index', $data);
+ }
+
+ /**
+ * Show the form for creating a new resource.
+ */
+ public function create()
+ {
+ $data = [
+ 'typepeti' => Type_peti::all(),
+ 'customer' => Customer::all(),
+ 'warehouse' => m_warehouse::all(),
+ 'active' => 'menu-peti',
+ ];
+ return view('dashboard.Master_Data.Manajemen_Peti.Peti.create', $data);
+ }
+
+ /**
+ * Store a newly created resource in storage.
+ */
+ public function store(Request $request)
+ {
+ // dd($request->all());
+ $request->validate([
+ 'tipe_peti_id' => 'required',
+ 'warna' => 'required',
+ 'customer_id' => 'required',
+ 'warehouse_id' => 'required',
+ 'jumlah' => 'required|numeric|min:1',
+ 'date_pembuatan' => 'required',
+ 'status_disposal' => 'nullable',
+ 'packing_no' => 'nullable',
+ 'fix_lot' => 'nullable',
+ ]);
+ // dd($request);
+ try {
+ $currenttype = Auth::user();
+
+ for ($i = 0; $i < $request->jumlah; $i++) {
+ $validatedData = $request->except('_token');
+
+ // Ambil nomor urutan otomatis untuk packing_no
+ $latestPackingNo = Peti::max('packing_no');
+ $nextPackingNo = $latestPackingNo + 1;
+ $validatedData['packing_no'] = $nextPackingNo;
+
+ $code_customer = Customer::where('id', $validatedData['customer_id'])->first()->code_customer;
+ $type = Type_peti::where('id', $validatedData['tipe_peti_id'])->first()->type;
+ $size_peti = Type_peti::where('id', $validatedData['tipe_peti_id'])->first()->size_peti;
+ $lot_no = Customer::where('id', $validatedData['customer_id'])->first()->lot_no;
+ $packing_no = $validatedData['packing_no'];
+
+ // Generate nilai 'fix_lot' sesuai format yang diinginkan
+ $fixLot = $code_customer . $type . $size_peti . $lot_no . $packing_no;
+ $validatedData['fix_lot'] = $fixLot;
+
+ $validatedData['created_by'] = $currenttype->fullname; // Menggunakan nama pengguna sebagai created_by
+ $validatedData['updated_by'] = $currenttype->fullname; // Menggunakan nama pengguna sebagai updated_by
+
+ // Buat entri peti baru
+ Peti::create($validatedData);
+ }
+
+ return redirect()->route('dashboard.peti.index')->with('success', 'Data peti berhasil ditambahkan');
+ } catch (\Throwable $th) {
+ return redirect()->back()->with('error', 'Data peti Gagal Ditambah.');
+ }
+ }
+
+ /**
+ * Display the specified resource.
+ */
+ public function show($id)
+ {
+ $data = [
+ 'peti' => Peti::findOrFail($id),
+ 'typepeti' => Type_peti::all(),
+ 'customer' => Customer::all(),
+ 'warehouse' => m_warehouse::all(),
+ 'active' => 'menu-peti',
+ ];
+ return view('dashboard.Master_Data.Manajemen_Peti.Peti.show', $data);
+ }
+
+ /**
+ * Show the form for editing the specified resource.
+ */
+ public function edit($id)
+ {
+ $data = [
+ 'peti' => Peti::findOrFail($id),
+ 'typepeti' => Type_peti::all(),
+ 'customer' => Customer::all(),
+ 'warehouse' => m_warehouse::all(),
+ 'active' => 'menu-peti',
+ ];
+ return view('dashboard.Master_Data.Manajemen_Peti.Peti.edit', $data);
+ }
+
+ /**
+ * Update the specified resource in storage.
+ */
+ public function update(Request $request, $id)
+ {
+ $request->validate([
+ 'tipe_peti_id' => 'required',
+ 'warna' => 'required',
+ 'customer_id' => 'required',
+ 'warehouse_id' => 'required',
+ 'status_disposal' => 'nullable',
+ 'date_pembuatan' => 'required',
+ ]);
+
+ try {
+ $currentuser = Auth::user();
+ $typepeti = Peti::findOrFail($id);
+
+ if (!$typepeti) {
+ return redirect()->back()->with('error', 'Data peti tidak ditemukan.');
+ }
+
+ $validatedData = $request->except('_token', '_method');
+
+ $code_customer = Customer::where('id', $validatedData['customer_id'])->first()->code_customer;
+ $type = Type_peti::where('id', $validatedData['tipe_peti_id'])->first()->type;
+ $size_peti = Type_peti::where('id', $validatedData['tipe_peti_id'])->first()->size_peti;
+ $lot_no = Customer::where('id', $validatedData['customer_id'])->first()->lot_no;
+ $packing_no = $typepeti->packing_no; // Mengambil packing_no dari entitas yang sudah ada
+
+ // Generate nilai 'fix_lot' sesuai format yang diinginkan
+ $fixLot = $code_customer . $type . $size_peti . $lot_no . $packing_no;
+ $validatedData['fix_lot'] = $fixLot;
+
+ // 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');
+ }
+ }
+
+ /**
+ * Remove the specified resource from storage.
+ */
+ public function destroy($id)
+ {
+ try {
+ $typepeti = Peti::findOrFail($id);
+ $typepeti->delete();
+ return redirect()->back()->with('success', 'Data peti berhasil dihapus');
+ } catch (\Throwable $th) {
+ return redirect()->back()->with('error', 'Data peti gagal dihapus');
+ }
+ }
+}
diff --git a/app/Http/Controllers/TypePetiController.php b/app/Http/Controllers/TypePetiController.php
new file mode 100644
index 0000000..46332b9
--- /dev/null
+++ b/app/Http/Controllers/TypePetiController.php
@@ -0,0 +1,123 @@
+ Type_peti::all(),
+ 'active' => 'menu-typepeti',
+ ];
+ return view('dashboard.Master_Data.Manajemen_Peti.Type_peti.index', $data);
+ }
+
+ /**
+ * Show the form for creating a new resource.
+ */
+ public function create()
+ {
+ $data = [
+ 'active' => 'menu-typepeti',
+ ];
+ return view('dashboard.Master_Data.Manajemen_Peti.Type_peti.create', $data);
+ }
+
+ /**
+ * Store a newly created resource in storage.
+ */
+ public function store(Request $request)
+ {
+ // dd($request->all());
+ $request->validate([
+ 'type' => 'required',
+ 'size_peti' => 'required',
+ 'description' => 'required',
+ ]);
+ // dd($request);
+ try {
+ $currenttype = Auth::user();
+ $validatedData = $request->except('_token');
+ $validatedData['created_by'] = $currenttype->fullname; // Menggunakan nama pengguna sebagai created_by
+ $validatedData['updated_by'] = $currenttype->fullname; // Menggunakan nama pengguna sebagai updated_by
+ // dd($validatedData);
+ Type_peti::create($validatedData);
+ return redirect()->route('dashboard.typepeti.index')->with('success', 'Data Tipe Peti berhasil ditambahkan');
+ } catch (\Throwable $th) {
+ // dd($th);
+ return redirect()->back()->with('error', 'Data Tipe Peti Gagal Ditambah.');
+ }
+ }
+
+ /**
+ * Display the specified resource.
+ */
+ public function show($id)
+ {
+ $data = [
+ 'typepeti' => Type_peti::findOrFail($id), // Mengambil detail data yang sesuai dengan parameter $id
+ 'active' => 'menu-typepeti',
+ ];
+ return view('dashboard.Master_Data.Manajemen_Peti.Type_peti.show', $data);
+ }
+
+ /**
+ * Show the form for editing the specified resource.
+ */
+ public function edit($id)
+ {
+ $data = [
+ 'typepeti' => Type_peti::findOrFail($id),
+ 'active' => 'menu-typepeti',
+ ];
+ return view('dashboard.Master_Data.Manajemen_Peti.Type_peti.edit', $data);
+ }
+
+ /**
+ * Update the specified resource in storage.
+ */
+ public function update(Request $request, $id)
+ {
+ // dd($request->all());
+ $request->validate([
+ 'type' => 'required',
+ 'size_peti' => 'required',
+ 'description' => 'required',
+ ]);
+ // dd($request);
+ try {
+ $typepeti = Type_peti::findOrFail($id);
+ $typepetiData = $request->all();
+
+ // Menambahkan nama pengguna yang melakukan pembaruan
+ $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');
+ }
+ }
+
+ /**
+ * Remove the specified resource from storage.
+ */
+ public function destroy($id)
+ {
+ try {
+ $typepeti = Type_peti::findOrFail($id);
+ $typepeti->delete();
+ return redirect()->back()->with('success', 'Data tipe peti berhasil dihapus');
+ } catch (\Throwable $th) {
+ return redirect()->back()->with('error', 'Data tipe peti gagal dihapus');
+ }
+ }
+}
diff --git a/app/Models/Customer.php b/app/Models/Customer.php
new file mode 100644
index 0000000..2e5da6f
--- /dev/null
+++ b/app/Models/Customer.php
@@ -0,0 +1,27 @@
+belongsTo(Customer::class, 'customer_id');
+ }
+ public function warehouse()
+ {
+ return $this->belongsTo(m_warehouse::class, 'warehouse_id');
+ }
+ public function tipe_peti()
+ {
+ return $this->belongsTo(Type_peti::class, 'tipe_peti_id');
+ }
+}
diff --git a/app/Models/Type_peti.php b/app/Models/Type_peti.php
new file mode 100644
index 0000000..4d5dff4
--- /dev/null
+++ b/app/Models/Type_peti.php
@@ -0,0 +1,21 @@
+id();
+ $table->string('name', 200);
+ $table->string('code_customer', 50);
+ $table->string('lot_no', 50);
+ $table->string('nip', 20)->nullable();
+ $table->string('no_hp', 20)->nullable();
+ $table->date('tgl_lahir')->nullable();
+ $table->string('jenis_kelamin', 30)->nullable();
+ $table->string('agama', 30)->nullable();
+ $table->text('address')->nullable();
+ $table->timestamps();
+ $table->softDeletes();
+ $table->string('created_by', 200)->nullable();
+ $table->string('updated_by', 200)->nullable();
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ */
+ public function down(): void
+ {
+ Schema::dropIfExists('customers');
+ }
+};
diff --git a/database/migrations/2023_10_28_083930_create_type_petis_table.php b/database/migrations/2023_10_28_083930_create_type_petis_table.php
new file mode 100644
index 0000000..043f667
--- /dev/null
+++ b/database/migrations/2023_10_28_083930_create_type_petis_table.php
@@ -0,0 +1,33 @@
+id();
+ $table->string('type');
+ $table->string('size_peti');
+ $table->text('description')->nullable();
+ $table->timestamps();
+ $table->softDeletes();
+ $table->string('created_by', 200)->nullable();
+ $table->string('updated_by', 200)->nullable();
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ */
+ public function down(): void
+ {
+ Schema::dropIfExists('type_petis');
+ }
+};
diff --git a/database/migrations/2023_10_28_085238_create_petis_table.php b/database/migrations/2023_10_28_085238_create_petis_table.php
new file mode 100644
index 0000000..e87db62
--- /dev/null
+++ b/database/migrations/2023_10_28_085238_create_petis_table.php
@@ -0,0 +1,42 @@
+id();
+ $table->unsignedBigInteger('tipe_peti_id')->nullable();
+ $table->foreign('tipe_peti_id')->references('id')->on('type_petis')->onDelete('set null');
+ $table->string('warna', 50);
+ $table->string('fix_lot', 100);
+ $table->integer('packing_no');
+ $table->unsignedBigInteger('customer_id')->nullable();
+ $table->foreign('customer_id')->references('id')->on('customers')->onDelete('set null');
+ $table->integer('jumlah')->nullable();
+ $table->date('date_pembuatan', 100)->nullable();
+ $table->unsignedBigInteger('warehouse_id')->nullable();
+ $table->foreign('warehouse_id')->references('id')->on('m_warehouses')->onDelete('set null');
+ $table->string('status_disposal')->nullable();
+ $table->timestamps();
+ $table->softDeletes();
+ $table->string('created_by', 200)->nullable();
+ $table->string('updated_by', 200)->nullable();
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ */
+ public function down(): void
+ {
+ Schema::dropIfExists('petis');
+ }
+};
diff --git a/database/seeders/Customer.php b/database/seeders/Customer.php
new file mode 100644
index 0000000..206b1b8
--- /dev/null
+++ b/database/seeders/Customer.php
@@ -0,0 +1,43 @@
+insert([
+ 'name' => 'Gunawan',
+ 'code_customer' => 'G',
+ 'lot_no' => 'CWT',
+ 'nip' => '1234567890987654',
+ 'no_hp' => '085159079010',
+ // 'tgl_lahir' => '19-06-2001',
+ 'jenis_kelamin' => 'Laki-Laki',
+ 'agama' => 'Islam',
+ 'address' => 'CIwatu',
+ 'created_by' => 'Seeder',
+ 'updated_by' => 'Seeder',
+ ]);
+ DB::table('customers')->insert([
+ 'name' => 'Andra Ryandra',
+ 'code_customer' => 'AR',
+ 'lot_no' => 'KA',
+ 'nip' => '1234567890987',
+ 'no_hp' => '085159079011',
+ // 'tgl_lahir' => '19-06-2001',
+ 'jenis_kelamin' => 'Laki-Laki',
+ 'agama' => 'Islam',
+ 'address' => 'CIwatu',
+ 'created_by' => 'Seeder',
+ 'updated_by' => 'Seeder',
+ ]);
+ }
+}
diff --git a/database/seeders/DatabaseSeeder.php b/database/seeders/DatabaseSeeder.php
index 134eb44..c0ca39b 100644
--- a/database/seeders/DatabaseSeeder.php
+++ b/database/seeders/DatabaseSeeder.php
@@ -24,6 +24,8 @@ class DatabaseSeeder extends Seeder
RoleSeeder::class,
WarehouseSeeder::class,
UserSeeder::class,
+ Type_Peti::class,
+ Customer::class,
]);
}
}
diff --git a/database/seeders/Type_Peti.php b/database/seeders/Type_Peti.php
new file mode 100644
index 0000000..e37c037
--- /dev/null
+++ b/database/seeders/Type_Peti.php
@@ -0,0 +1,32 @@
+insert([
+ 'type' => 'BS',
+ 'size_peti' => '2 X 2 X 2 X 2',
+ 'description' => 'Detail BS',
+ 'created_by' => 'Seeder',
+ 'updated_by' => 'Seeder',
+ ]);
+ DB::table('type_petis')->insert([
+ 'type' => 'BCA',
+ 'size_peti' => '3 X 3 X 3 X 3',
+ 'description' => 'Detail BCA',
+ 'created_by' => 'Seeder',
+ 'updated_by' => 'Seeder',
+ ]);
+ }
+}
diff --git a/resources/views/dashboard/Master_Data/Asset/index.blade.php b/resources/views/dashboard/Master_Data/Asset/index.blade.php
index 8e76a8d..2ce586a 100644
--- a/resources/views/dashboard/Master_Data/Asset/index.blade.php
+++ b/resources/views/dashboard/Master_Data/Asset/index.blade.php
@@ -1,80 +1,76 @@
@extends('layouts.main')
@section('title', 'Setting Platform')
@section('content')
-