Browse Source

update revisi 15 desember

master
Gunawan19621 1 year ago
parent
commit
3ce800091b
  1. 10
      app/Http/Controllers/PeminjamanController.php
  2. 9
      app/Http/Controllers/PengembalianController.php
  3. 17
      app/Http/Controllers/PetiController.php
  4. 3
      app/Http/Requests/ValidasiCreatePeti.php
  5. 3
      app/Http/Requests/ValidasiUpdatePeti.php
  6. 15
      app/Imports/CustomerImport.php
  7. 8
      app/Imports/KondisiPetiImport.php
  8. 123
      app/Imports/PetiImport.php
  9. 10
      app/Imports/TipePetiImport.php
  10. 10
      app/Imports/WarehouseImport.php
  11. 24
      app/Models/Peti.php
  12. 22
      database/migrations/2023_11_06_085238_create_petis_table.php
  13. 2
      public/assets/file/Format_Import_Customer.csv
  14. 2
      public/assets/file/Format_Import_Kondisi_Peti.csv
  15. 2
      public/assets/file/Format_Import_Peti.csv
  16. 2
      public/assets/file/Format_Import_Tipe_Peti.csv
  17. 2
      public/assets/file/Format_Import_Warehouse.csv
  18. BIN
      public/assets/img/istw_black&white.jpg
  19. BIN
      public/assets/img/istw_grey.png
  20. 0
      public/assets/img/istw_red.jpg
  21. BIN
      public/assets/img/logo_istw.png
  22. 2
      resources/views/dashboard/Master_Data/Manajemen_Peti/Peti/all_print.blade.php
  23. 7
      resources/views/dashboard/Master_Data/Manajemen_Peti/Peti/create.blade.php
  24. 7
      resources/views/dashboard/Master_Data/Manajemen_Peti/Peti/edit.blade.php
  25. 24
      resources/views/dashboard/Master_Data/Manajemen_Peti/Peti/index.blade.php
  26. 2
      resources/views/dashboard/Master_Data/Manajemen_Peti/Peti/label_pdf.blade.php
  27. 7
      resources/views/dashboard/Master_Data/Manajemen_Peti/Peti/show.blade.php
  28. 22
      resources/views/dashboard/index.blade.php
  29. 4
      resources/views/layouts/sidebar.blade.php
  30. 4
      resources/views/pages/layouts/sidebar_user.blade.php

10
app/Http/Controllers/PeminjamanController.php

@ -231,7 +231,15 @@ class PeminjamanController extends Controller
->where('fix_lot', 'LIKE', '%' . $request->get('q') . '%') ->where('fix_lot', 'LIKE', '%' . $request->get('q') . '%')
->where(function ($query) { ->where(function ($query) {
$query->whereHas('assetStatuses', function ($subquery) { $query->whereHas('assetStatuses', function ($subquery) {
$subquery->where('status', '!=', 0) $subquery->where(function ($statusQuery) {
// Tampilkan data jika status tidak sama dengan 0
$statusQuery->where('status', '!=', 0)
// Tampilkan data jika status sama dengan 0 dan deleted_at tidak null
->orWhere(function ($deletedQuery) {
$deletedQuery->where('status', 0)
->whereNotNull('deleted_at');
});
})
->where('created_at', '=', function ($maxQuery) { ->where('created_at', '=', function ($maxQuery) {
$maxQuery->selectRaw('MAX(created_at)') $maxQuery->selectRaw('MAX(created_at)')
->from('asset_statuses') ->from('asset_statuses')

9
app/Http/Controllers/PengembalianController.php

@ -8,6 +8,7 @@ use App\Models\asset_status;
use App\Models\Kondisi_Peti; use App\Models\Kondisi_Peti;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Auth;
use App\Http\Requests\ValidasiUpdatePengembalian; use App\Http\Requests\ValidasiUpdatePengembalian;
@ -19,7 +20,11 @@ class PengembalianController extends Controller
$perPage = $request->input('perPage', 5); $perPage = $request->input('perPage', 5);
$query = asset_status::with(['customer', 'warehouseId', 'warehouse', 'warehouseEnter', 'kondisi_peti']) $query = asset_status::with(['customer', 'warehouseId', 'warehouse', 'warehouseEnter', 'kondisi_peti'])
->where('status', '=', 1) ->where('status', '=', 1)
->orderBy('created_at', 'desc'); ->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')
->on('asset_statuses.updated_at', '=', 'latest_peti.latest_update');
})
->orderBy('asset_statuses.created_at', 'desc');
// Logika pencarian // Logika pencarian
$search = $request->input('search') ?? ''; $search = $request->input('search') ?? '';
@ -124,8 +129,6 @@ class PengembalianController extends Controller
return view('dashboard.Pengembalian.index', $data); return view('dashboard.Pengembalian.index', $data);
} }
/** /**
* Show the form for creating a new resource. * Show the form for creating a new resource.
*/ */

17
app/Http/Controllers/PetiController.php

@ -102,7 +102,6 @@ class PetiController extends Controller
*/ */
public function store(ValidasiCreatePeti $request) public function store(ValidasiCreatePeti $request)
{ {
// dd($request->all());
try { try {
$currenttype = Auth::user(); $currenttype = Auth::user();
@ -112,9 +111,7 @@ class PetiController extends Controller
// Ambil nomor urutan otomatis untuk packing_no // Ambil nomor urutan otomatis untuk packing_no
$latestPackingNo = Peti::max('packing_no'); $latestPackingNo = Peti::max('packing_no');
$nextPackingNo = $latestPackingNo + 1; $nextPackingNo = $latestPackingNo + 1;
// $validatedData['packing_no'] = $nextPackingNo;
$validatedData['packing_no'] = '0' . $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; $code_customer = Customer::where('id', $validatedData['customer_id'])->first()->code_customer;
$type = Type_peti::where('id', $validatedData['tipe_peti_id'])->first()->type; $type = Type_peti::where('id', $validatedData['tipe_peti_id'])->first()->type;
@ -126,10 +123,15 @@ class PetiController extends Controller
$fixLot = $code_customer . $type . $size_peti . $lot_no . $packing_no; $fixLot = $code_customer . $type . $size_peti . $lot_no . $packing_no;
$validatedData['fix_lot'] = $fixLot; $validatedData['fix_lot'] = $fixLot;
// Merubah warna menjadi kapital
$validatedData['warna'] = strtoupper($validatedData['warna']);
$validatedData['created_by'] = $currenttype->fullname; // Menggunakan nama pengguna sebagai created_by $validatedData['created_by'] = $currenttype->fullname; // Menggunakan nama pengguna sebagai created_by
$validatedData['updated_by'] = $currenttype->fullname; // Menggunakan nama pengguna sebagai updated_by $validatedData['updated_by'] = $currenttype->fullname; // Menggunakan nama pengguna sebagai updated_by
// Buat entri peti baru // Jika 't_warehouse_id' tidak diset, ambil nilainya dari 'warehouse_id'
$validatedData['t_warehouse_id'] = $validatedData['warehouse_id'];
// dd($validatedData);
Peti::create($validatedData); Peti::create($validatedData);
} }
@ -176,6 +178,7 @@ class PetiController extends Controller
*/ */
public function update(ValidasiUpdatePeti $request, $id) public function update(ValidasiUpdatePeti $request, $id)
{ {
// dd($request->all());
try { try {
$currentuser = Auth::user(); $currentuser = Auth::user();
$typepeti = Peti::findOrFail($id); $typepeti = Peti::findOrFail($id);
@ -195,12 +198,14 @@ class PetiController extends Controller
// Generate nilai 'fix_lot' sesuai format yang diinginkan // Generate nilai 'fix_lot' sesuai format yang diinginkan
$fixLot = $code_customer . $type . $size_peti . $lot_no . $packing_no; $fixLot = $code_customer . $type . $size_peti . $lot_no . $packing_no;
$validatedData['fix_lot'] = $fixLot; $validatedData['fix_lot'] = $fixLot;
$validatedData['updated_by'] = $currentuser->fullname;
$validatedData['t_warehouse_id'] = $validatedData['warehouse_id'];
// Tambahkan perubahan yang diperlukan ke entitas Peti // Tambahkan perubahan yang diperlukan ke entitas Peti
$typepeti->update($validatedData); $typepeti->update($validatedData);
// Menambahkan nama pengguna yang melakukan pembaruan // // Menambahkan nama pengguna yang melakukan pembaruan
$typepeti->update(['updated_by' => $currentuser->fullname]); // $typepeti->update(['updated_by' => $currentuser->fullname]);
return redirect()->route('dashboard.peti.index')->with('success', 'Data peti berhasil diperbaharui'); return redirect()->route('dashboard.peti.index')->with('success', 'Data peti berhasil diperbaharui');
} catch (\Throwable $th) { } catch (\Throwable $th) {

3
app/Http/Requests/ValidasiCreatePeti.php

@ -26,11 +26,13 @@ class ValidasiCreatePeti extends FormRequest
'warna' => 'required|string|max:50', 'warna' => 'required|string|max:50',
'customer_id' => 'required|exists:customers,id', 'customer_id' => 'required|exists:customers,id',
'warehouse_id' => 'required|exists:m_warehouses,id', 'warehouse_id' => 'required|exists:m_warehouses,id',
't_warehouse_id' => 'nullable',
'jumlah' => 'required|numeric|min:1', 'jumlah' => 'required|numeric|min:1',
'date_pembuatan' => 'required|date', 'date_pembuatan' => 'required|date',
'kondisipeti_id' => 'nullable', 'kondisipeti_id' => 'nullable',
'packing_no' => 'nullable|integer', 'packing_no' => 'nullable|integer',
'fix_lot' => 'nullable|string|max:100', 'fix_lot' => 'nullable|string|max:100',
'status_isi' => 'nullable|boolean',
]; ];
} }
@ -55,6 +57,7 @@ class ValidasiCreatePeti extends FormRequest
'packing_no.integer' => 'Packing No harus berupa angka!', 'packing_no.integer' => 'Packing No harus berupa angka!',
'fix_lot.string' => 'Fix Lot harus berupa string!', 'fix_lot.string' => 'Fix Lot harus berupa string!',
'fix_lot.max' => 'Fix Lot maksimal 100 karakter!', 'fix_lot.max' => 'Fix Lot maksimal 100 karakter!',
'status_isi.boolean' => 'Status Isi harus berupa true atau false!',
]; ];
} }
} }

3
app/Http/Requests/ValidasiUpdatePeti.php

@ -26,10 +26,12 @@ class ValidasiUpdatePeti extends FormRequest
'warna' => 'required|string|max:50', 'warna' => 'required|string|max:50',
'customer_id' => 'required|exists:customers,id', 'customer_id' => 'required|exists:customers,id',
'warehouse_id' => 'required|exists:m_warehouses,id', 'warehouse_id' => 'required|exists:m_warehouses,id',
't_warehouse_id' => 'nullable',
'date_pembuatan' => 'required|date', 'date_pembuatan' => 'required|date',
'kondisipeti_id' => 'nullable', 'kondisipeti_id' => 'nullable',
'packing_no' => 'nullable|integer', 'packing_no' => 'nullable|integer',
'fix_lot' => 'nullable|string|max:100', 'fix_lot' => 'nullable|string|max:100',
'status_isi' => 'nullable|boolean',
]; ];
} }
@ -53,6 +55,7 @@ class ValidasiUpdatePeti extends FormRequest
'packing_no.integer' => 'Packing No harus berupa angka', 'packing_no.integer' => 'Packing No harus berupa angka',
'fix_lot.string' => 'Fix Lot harus berupa string', 'fix_lot.string' => 'Fix Lot harus berupa string',
'fix_lot.max' => 'Fix Lot maksimal 100 karakter', 'fix_lot.max' => 'Fix Lot maksimal 100 karakter',
'status_isi.boolean' => 'Status Isi harus berupa true atau false!',
]; ];
} }
} }

15
app/Imports/CustomerImport.php

@ -23,8 +23,9 @@ class CustomerImport implements ToModel, WithHeadingRow
public function model(array $row) public function model(array $row)
{ {
// dd($row); // Tambahkan ini untuk debug, lihat apakah data yang diterima sesuai
// Pemeriksaan apakah semua kolom yang dibutuhkan ada dalam format yang benar // Pemeriksaan apakah semua kolom yang dibutuhkan ada dalam format yang benar
$requiredColumns = ['name', 'code_customer', 'lot_no', 'no_tlp', 'address']; $requiredColumns = ['nama_customer', 'kode_customer', 'lot_number', 'no_telepon', 'alamat'];
foreach ($requiredColumns as $column) { foreach ($requiredColumns as $column) {
if (!array_key_exists($column, $row) || empty($row[$column])) { if (!array_key_exists($column, $row) || empty($row[$column])) {
@ -37,7 +38,7 @@ class CustomerImport implements ToModel, WithHeadingRow
$user = Auth::user(); $user = Auth::user();
// Cek apakah nama warehouse sudah ada dalam database // Cek apakah nama warehouse sudah ada dalam database
$existingCustomer = Customer::where('name', $row['name'])->first(); $existingCustomer = Customer::where('name', $row['nama_customer'])->first();
if ($existingCustomer) { if ($existingCustomer) {
// Jika nama warehouse sudah ada, tambahkan pesan kesalahan ke dalam array $errors // Jika nama warehouse sudah ada, tambahkan pesan kesalahan ke dalam array $errors
@ -49,11 +50,11 @@ class CustomerImport implements ToModel, WithHeadingRow
$this->rowCount++; $this->rowCount++;
return new Customer([ return new Customer([
'name' => $row['name'], 'name' => strtoupper($row['nama_customer']),
'code_customer' => $row['code_customer'], 'code_customer' => strtoupper($row['kode_customer']),
'lot_no' => $row['lot_no'], 'lot_no' => strtoupper($row['lot_number']),
'no_tlp' => $row['no_tlp'], 'no_tlp' => $row['no_telepon'],
'address' => $row['address'], 'address' => strtoupper($row['alamat']),
'created_by' => $user->fullname, 'created_by' => $user->fullname,
]); ]);
} }

8
app/Imports/KondisiPetiImport.php

@ -25,7 +25,7 @@ class KondisiPetiImport implements ToModel, WithHeadingRow
public function model(array $row) public function model(array $row)
{ {
// Pemeriksaan apakah semua kolom yang dibutuhkan ada dalam format yang benar // Pemeriksaan apakah semua kolom yang dibutuhkan ada dalam format yang benar
$requiredColumns = ['nama_kondisi', 'deskripsi_kondisi']; $requiredColumns = ['kondisi_peti', 'deskripsi_kondisi'];
foreach ($requiredColumns as $column) { foreach ($requiredColumns as $column) {
if (!array_key_exists($column, $row) || empty($row[$column])) { if (!array_key_exists($column, $row) || empty($row[$column])) {
@ -38,7 +38,7 @@ class KondisiPetiImport implements ToModel, WithHeadingRow
$user = Auth::user(); $user = Auth::user();
// Cek apakah nama warehouse sudah ada dalam database // Cek apakah nama warehouse sudah ada dalam database
$existingKondisiPeti = Kondisi_Peti::where('nama_kondisi', $row['nama_kondisi'])->first(); $existingKondisiPeti = Kondisi_Peti::where('nama_kondisi', $row['kondisi_peti'])->first();
if ($existingKondisiPeti) { if ($existingKondisiPeti) {
// Jika nama warehouse sudah ada, tambahkan pesan kesalahan ke dalam array $errors // Jika nama warehouse sudah ada, tambahkan pesan kesalahan ke dalam array $errors
@ -50,8 +50,8 @@ class KondisiPetiImport implements ToModel, WithHeadingRow
$this->rowCount++; $this->rowCount++;
return new Kondisi_Peti([ return new Kondisi_Peti([
'nama_kondisi' => $row['nama_kondisi'], 'nama_kondisi' => strtoupper($row['kondisi_peti']),
'deskripsi_kondisi' => $row['deskripsi_kondisi'], 'deskripsi_kondisi' => strtoupper($row['deskripsi_kondisi']),
'created_by' => $user->fullname, 'created_by' => $user->fullname,
]); ]);
} }

123
app/Imports/PetiImport.php

@ -15,6 +15,95 @@ use Maatwebsite\Excel\Events\AfterImport;
use Maatwebsite\Excel\Concerns\ToCollection; use Maatwebsite\Excel\Concerns\ToCollection;
use Maatwebsite\Excel\Concerns\WithHeadingRow; use Maatwebsite\Excel\Concerns\WithHeadingRow;
// class PetiImport implements ToModel, WithHeadingRow
// {
// private $rowCount = 0;
// private $errors;
// public function model(array $row)
// {
// // Pemeriksaan apakah semua kolom yang dibutuhkan ada dalam format yang benar
// $requiredColumns = ['tipe_peti_id', 'warna', 'customer_id', 'warehouse_id', 'kondisipeti_id', 'packing_no', 'fix_lot', 'status', 'status_isi_peti'];
// foreach ($requiredColumns as $column) {
// if (!array_key_exists($column, $row) || empty($row[$column])) {
// $this->errors[] = 'Kolom ' . $column . ' pada baris ' . $this->rowCount . ' tidak boleh kosong.';
// return null; // Abaikan data dengan kolom yang tidak sesuai
// }
// }
// $user = Auth::user();
// $existingPeti = Peti::where('fix_lot', $row['fix_lot'])->first();
// if ($existingPeti) {
// $this->errors[] = new MessageBag(['Row ' . $this->rowCount => 'Data Peti sudah ada dalam database.']);
// return null;
// }
// $tipePeti = Type_peti::firstOrCreate(
// ['type' => $row['tipe_peti_id']],
// ['size_peti' => 'Default Size', 'description' => 'Default Description']
// );
// $customer = Customer::firstOrCreate(
// ['name' => $row['customer_id']],
// ['code_customer' => 'Default Code', 'lot_no' => 'Default Lot No', 'no_tlp' => 'Default No Tlp', 'address' => 'Default Address']
// );
// $warehouse = m_warehouse::firstOrCreate(
// ['name' => $row['warehouse_id']],
// ['description' => 'Default Description', 'address' => 'Default Address']
// );
// $kondisiPeti = Kondisi_Peti::firstOrCreate(
// ['nama_kondisi' => $row['kondisipeti_id']],
// ['deskripsi_kondisi' => 'Default Deskripsi']
// );
// $this->rowCount++;
// return new Peti([
// 'created_by' => $user->fullname,
// 'updated_by' => $user->fullname,
// 'tipe_peti_id' => $tipePeti->id,
// 'warna' => $row['warna'],
// 'customer_id' => $customer->id,
// 'warehouse_id' => $warehouse->id,
// 't_warehouse_id' => $warehouse->id,
// 'date_pembuatan' => now(),
// 'kondisipeti_id' => $kondisiPeti->id,
// 'packing_no' => $row['packing_no'],
// 'fix_lot' => $row['fix_lot'],
// 'status' => $row['status'],
// 'status_isi' => $row['status_isi_peti'],
// ]);
// }
// public function registerEvents(): array
// {
// return [
// AfterImport::class => function (AfterImport $event) {
// $importedData = $event->getReader()->getDelegate()->getActiveSheet()->toArray();
// $filteredData = array_filter($importedData, function ($row) {
// return $row[0] !== null;
// });
// $event->getReader()->getDelegate()->getActiveSheet()->fromArray($filteredData);
// },
// ];
// }
// public function getErrors()
// {
// return $this->errors;
// }
// public function getRowCount()
// {
// return $this->rowCount;
// }
// }
class PetiImport implements ToModel, WithHeadingRow class PetiImport implements ToModel, WithHeadingRow
{ {
private $rowCount = 0; private $rowCount = 0;
@ -22,8 +111,9 @@ class PetiImport implements ToModel, WithHeadingRow
public function model(array $row) public function model(array $row)
{ {
// dd($row);
// Pemeriksaan apakah semua kolom yang dibutuhkan ada dalam format yang benar // Pemeriksaan apakah semua kolom yang dibutuhkan ada dalam format yang benar
$requiredColumns = ['tipe_peti_id', 'warna', 'customer_id', 'warehouse_id', 'kondisipeti_id', 'packing_no', 'fix_lot', 'status']; $requiredColumns = ['tipe_peti', 'warna', 'nama_customer', 'nama_gudang', 'kondisi_peti', 'packing_no', 'fix_lot', 'status', 'status_isi_peti'];
foreach ($requiredColumns as $column) { foreach ($requiredColumns as $column) {
if (!array_key_exists($column, $row) || empty($row[$column])) { if (!array_key_exists($column, $row) || empty($row[$column])) {
@ -32,6 +122,18 @@ class PetiImport implements ToModel, WithHeadingRow
} }
} }
// Validasi untuk kolom 'status_isi_peti'
$validStatusIsiPeti = ['Ada', 'Tidak Ada'];
$statusIsiPeti = ucwords(strtolower(trim($row['status_isi_peti']))); // Ubah kapitalisasi
if (!in_array($statusIsiPeti, $validStatusIsiPeti)) {
$this->errors[] = 'Nilai pada kolom status_isi_peti pada baris ' . $this->rowCount . ' tidak valid.';
return null;
}
// Set nilai status_isi berdasarkan 'Ada Isinya' atau 'Tidak Ada Isinya'
$statusIsi = ($statusIsiPeti === 'Ada') ? 1 : 0;
$user = Auth::user(); $user = Auth::user();
$existingPeti = Peti::where('fix_lot', $row['fix_lot'])->first(); $existingPeti = Peti::where('fix_lot', $row['fix_lot'])->first();
@ -42,22 +144,22 @@ class PetiImport implements ToModel, WithHeadingRow
} }
$tipePeti = Type_peti::firstOrCreate( $tipePeti = Type_peti::firstOrCreate(
['type' => $row['tipe_peti_id']], ['type' => $row['tipe_peti']],
['size_peti' => 'Default Size', 'description' => 'Default Description'] ['size_peti' => 'Default Size', 'description' => 'Default Description']
); );
$customer = Customer::firstOrCreate( $customer = Customer::firstOrCreate(
['name' => $row['customer_id']], ['name' => $row['nama_customer']],
['code_customer' => 'Default Code', 'lot_no' => 'Default Lot No', 'no_tlp' => 'Default No Tlp', 'address' => 'Default Address'] ['code_customer' => 'Default Code', 'lot_no' => 'Default Lot No', 'no_tlp' => 'Default No Tlp', 'address' => 'Default Address']
); );
$warehouse = m_warehouse::firstOrCreate( $warehouse = m_warehouse::firstOrCreate(
['name' => $row['warehouse_id']], ['name' => $row['nama_gudang']],
['description' => 'Default Description', 'address' => 'Default Address'] ['description' => 'Default Description', 'address' => 'Default Address']
); );
$kondisiPeti = Kondisi_Peti::firstOrCreate( $kondisiPeti = Kondisi_Peti::firstOrCreate(
['nama_kondisi' => $row['kondisipeti_id']], ['nama_kondisi' => $row['kondisi_peti']],
['deskripsi_kondisi' => 'Default Deskripsi'] ['deskripsi_kondisi' => 'Default Deskripsi']
); );
@ -65,15 +167,18 @@ class PetiImport implements ToModel, WithHeadingRow
return new Peti([ return new Peti([
'created_by' => $user->fullname, 'created_by' => $user->fullname,
'updated_by' => $user->fullname,
'tipe_peti_id' => $tipePeti->id, 'tipe_peti_id' => $tipePeti->id,
'warna' => $row['warna'], 'warna' => strtoupper($row['warna']),
'customer_id' => $customer->id, 'customer_id' => $customer->id,
'warehouse_id' => $warehouse->id, 'warehouse_id' => $warehouse->id,
't_warehouse_id' => $warehouse->id,
'date_pembuatan' => now(), 'date_pembuatan' => now(),
'kondisipeti_id' => $kondisiPeti->id, 'kondisipeti_id' => $kondisiPeti->id,
'packing_no' => $row['packing_no'], 'packing_no' => strtoupper($row['packing_no']),
'fix_lot' => $row['fix_lot'], 'fix_lot' => strtoupper($row['fix_lot']),
'status' => $row['status'], 'status' => strtoupper($row['status']),
'status_isi' => $statusIsi,
]); ]);
} }

10
app/Imports/TipePetiImport.php

@ -26,7 +26,7 @@ class TipePetiImport implements ToModel, WithHeadingRow
public function model(array $row) public function model(array $row)
{ {
// Pemeriksaan apakah semua kolom yang dibutuhkan ada dalam format yang benar // Pemeriksaan apakah semua kolom yang dibutuhkan ada dalam format yang benar
$requiredColumns = ['type', 'size_peti', 'description']; $requiredColumns = ['tipe_peti', 'ukuran_peti', 'deskripsi_tipe'];
foreach ($requiredColumns as $column) { foreach ($requiredColumns as $column) {
if (!array_key_exists($column, $row) || empty($row[$column])) { if (!array_key_exists($column, $row) || empty($row[$column])) {
@ -39,7 +39,7 @@ class TipePetiImport implements ToModel, WithHeadingRow
$user = Auth::user(); $user = Auth::user();
// Cek apakah nama warehouse sudah ada dalam database // Cek apakah nama warehouse sudah ada dalam database
$existingTipePeti = Type_peti::where('type', $row['type'])->first(); $existingTipePeti = Type_peti::where('type', $row['tipe_peti'])->first();
if ($existingTipePeti) { if ($existingTipePeti) {
// Jika nama warehouse sudah ada, tambahkan pesan kesalahan ke dalam array $errors // Jika nama warehouse sudah ada, tambahkan pesan kesalahan ke dalam array $errors
@ -51,9 +51,9 @@ class TipePetiImport implements ToModel, WithHeadingRow
$this->rowCount++; $this->rowCount++;
return new Type_peti([ return new Type_peti([
'type' => $row['type'], 'type' => strtoupper($row['tipe_peti']),
'size_peti' => $row['size_peti'], 'size_peti' => strtoupper($row['ukuran_peti']),
'description' => $row['description'], 'description' => strtoupper($row['deskripsi_tipe']),
'created_by' => $user->fullname, 'created_by' => $user->fullname,
]); ]);
} }

10
app/Imports/WarehouseImport.php

@ -24,7 +24,7 @@ class WarehouseImport implements ToModel, WithHeadingRow
public function model(array $row) public function model(array $row)
{ {
$requiredColumns = ['name', 'description', 'address']; $requiredColumns = ['nama_gudang', 'deskripsi_gudang', 'alamat'];
foreach ($requiredColumns as $column) { foreach ($requiredColumns as $column) {
if (!array_key_exists($column, $row) || empty($row[$column])) { if (!array_key_exists($column, $row) || empty($row[$column])) {
@ -37,7 +37,7 @@ class WarehouseImport implements ToModel, WithHeadingRow
$user = Auth::user(); $user = Auth::user();
// Cek apakah nama warehouse sudah ada dalam database // Cek apakah nama warehouse sudah ada dalam database
$existingWarehouse = m_warehouse::where('name', $row['name'])->first(); $existingWarehouse = m_warehouse::where('name', $row['nama_gudang'])->first();
if ($existingWarehouse) { if ($existingWarehouse) {
// Jika nama warehouse sudah ada, tambahkan pesan kesalahan ke dalam array $errors // Jika nama warehouse sudah ada, tambahkan pesan kesalahan ke dalam array $errors
@ -50,9 +50,9 @@ class WarehouseImport implements ToModel, WithHeadingRow
// Buat model baru jika nama warehouse belum ada // Buat model baru jika nama warehouse belum ada
return new m_warehouse([ return new m_warehouse([
'name' => $row['name'], 'name' => strtoupper($row['nama_gudang']),
'description' => $row['description'], 'description' => strtoupper($row['deskripsi_gudang']),
'address' => $row['address'], 'address' => strtoupper($row['alamat']),
'created_by' => $user->fullname, 'created_by' => $user->fullname,
]); ]);
} }

24
app/Models/Peti.php

@ -16,18 +16,20 @@ class Peti extends Model
protected $table = 'petis'; protected $table = 'petis';
protected $fillable = [ protected $fillable = [
'tipe_peti_id', 'tipe_peti_id', //
'warna', 'warna', //
'customer_id', 'customer_id', //
'warehouse_id', 'warehouse_id', //
't_warehouse_id', //
'kondisipeti_id', //
'jumlah', 'jumlah',
'date_pembuatan', 'date_pembuatan', //
'kondisipeti_id', 'packing_no', //
'packing_no', 'fix_lot', //
'fix_lot', 'status', //
'status', 'status_isi', //
'created_by', 'created_by', //
'updated_by', 'updated_by', //
]; ];
public function customer() public function customer()

22
database/migrations/2023_11_06_085238_create_petis_table.php

@ -13,16 +13,18 @@ return new class extends Migration
{ {
Schema::create('petis', function (Blueprint $table) { Schema::create('petis', function (Blueprint $table) {
$table->id(); $table->id();
$table->foreignId('tipe_peti_id')->nullable()->constrained('type_petis'); $table->foreignId('tipe_peti_id')->nullable()->constrained('type_petis'); // untuk inputan tipe peti
$table->string('warna', 50); $table->string('warna', 50); // untuk inputan warna peti
$table->string('fix_lot', 100); $table->foreignId('customer_id')->nullable()->constrained('customers')->onDelete('cascade'); // untuk inputan customer
$table->integer('packing_no'); $table->foreignId('warehouse_id')->nullable()->constrained('m_warehouses'); // untuk inputan Gudang
$table->foreignId('customer_id')->nullable()->constrained('customers')->onDelete('cascade'); $table->foreignId('t_warehouse_id')->nullable()->constrained('m_warehouses'); // untuk proses semua perubahan gudang peti
$table->integer('jumlah')->nullable(); $table->foreignId('kondisipeti_id')->nullable()->constrained('kondisi_petis'); // untuk inputan kondisi peti
$table->date('date_pembuatan', 100)->nullable(); $table->integer('jumlah')->nullable(); // untuk inputan jumlah peti
$table->foreignId('warehouse_id')->nullable()->constrained('m_warehouses'); $table->date('date_pembuatan', 100)->nullable(); // untuk inputan tanggal pembuatan
$table->foreignId('kondisipeti_id')->nullable()->constrained('kondisi_petis'); $table->integer('packing_no'); // untuk pembuatan packing no otomatis
$table->string('status', 50)->default('AKTIF'); $table->string('fix_lot', 100); // untuk proses pembuatan fixlot otomatis
$table->string('status', 50)->default('AKTIF'); // untuk pembuatan status peti otomatis menjadi aktif
$table->boolean('status_isi')->nullable(); // untuk pembuatan status isi peti 1 = isi, 0 = kosong
$table->timestamps(); $table->timestamps();
$table->softDeletes(); $table->softDeletes();
$table->string('created_by', 200)->nullable(); $table->string('created_by', 200)->nullable();

2
public/assets/file/Format_Import_Customer.csv

@ -1 +1 @@
name,code_customer,lot_no,no_tlp,address Nama Customer,Kode Customer,Lot Number,No Telepon,Alamat

1 name Nama Customer code_customer Kode Customer lot_no Lot Number no_tlp No Telepon address Alamat

2
public/assets/file/Format_Import_Kondisi_Peti.csv

@ -1 +1 @@
nama_kondisi,deskripsi_kondisi Kondisi Peti,Deskripsi Kondisi

1 nama_kondisi Kondisi Peti deskripsi_kondisi Deskripsi Kondisi

2
public/assets/file/Format_Import_Peti.csv

@ -1 +1 @@
tipe_peti_id,warna,customer_id,warehouse_id,jumlah,date_pembuatan,kondisipeti_id,packing_no,fix_lot,status Tipe Peti,Warna,Nama Customer,Nama Gudang,Kondisi Peti,Packing_no,Fix_lot,Status,Status Isi Peti

1 tipe_peti_id Tipe Peti warna Warna customer_id Nama Customer warehouse_id Nama Gudang jumlah Kondisi Peti date_pembuatan Packing_no kondisipeti_id Fix_lot packing_no Status fix_lot Status Isi Peti status

2
public/assets/file/Format_Import_Tipe_Peti.csv

@ -1 +1 @@
type,size_peti,description TIpe Peti,Ukuran Peti,Deskripsi Tipe

1 type TIpe Peti size_peti Ukuran Peti description Deskripsi Tipe

2
public/assets/file/Format_Import_Warehouse.csv

@ -1 +1 @@
name,description,address Nama Gudang,Deskripsi Gudang,Alamat

1 name Nama Gudang description Deskripsi Gudang address Alamat

BIN
public/assets/img/istw_black&white.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 83 KiB

BIN
public/assets/img/istw_grey.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 501 KiB

0
public/assets/img/logo istw.jpg → public/assets/img/istw_red.jpg

Before

Width:  |  Height:  |  Size: 1005 KiB

After

Width:  |  Height:  |  Size: 1005 KiB

BIN
public/assets/img/logo_istw.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 KiB

2
resources/views/dashboard/Master_Data/Manajemen_Peti/Peti/all_print.blade.php

@ -75,7 +75,7 @@
<table style="width:100%; margin-top: 10px;" class="table table-bordered"> <table style="width:100%; margin-top: 10px;" class="table table-bordered">
<tr> <tr>
<td rowspan="2"> <td rowspan="2">
<img src="data:image/jpeg;base64,<?= base64_encode(file_get_contents('assets/img/logo istw.jpg')) ?>" <img src="data:image/jpeg;base64,<?= base64_encode(file_get_contents('assets/img/istw_black&white.jpg')) ?>"
alt="Logo ISTW" class="logo"> alt="Logo ISTW" class="logo">
</td> </td>
<td>PETI NUMBER</td> <td>PETI NUMBER</td>

7
resources/views/dashboard/Master_Data/Manajemen_Peti/Peti/create.blade.php

@ -61,6 +61,13 @@
<input class="form-control" name="date_pembuatan" type="date" id="date_pembuatan" <input class="form-control" name="date_pembuatan" type="date" id="date_pembuatan"
value="{{ old('date_pembuatan') }}" required> value="{{ old('date_pembuatan') }}" required>
<label for="status_isi" class="col-form-label">Isi Peti: <span class="text-danger">*</span></label>
<select class="form-control" name="status_isi" id="status_isi" required>
<option disabled selected>Pilih Status Isi Peti</option>
<option value="1">Ada</option>
<option value="0">Tidak Ada</option>
</select>
</div> </div>
<div class="modal-footer d-flex justify-content-center"> <div class="modal-footer d-flex justify-content-center">
<a href="{{ route('dashboard.peti.index') }}" class="btn btn-secondary">Kembali</a> <a href="{{ route('dashboard.peti.index') }}" class="btn btn-secondary">Kembali</a>

7
resources/views/dashboard/Master_Data/Manajemen_Peti/Peti/edit.blade.php

@ -71,6 +71,13 @@
<input class="form-control" name="date_pembuatan" type="date" id="date_pembuatan" <input class="form-control" name="date_pembuatan" type="date" id="date_pembuatan"
value="{{ $peti->date_pembuatan }}" required> value="{{ $peti->date_pembuatan }}" required>
<label for="status_isi" class="col-form-label">Isi Peti: <span class="text-danger">*</span></label>
<select class="form-control" name="status_isi" id="status_isi" required>
<option disabled selected>Pilih Status Isi Peti</option>
<option value="1" @if ($peti->status_isi == 1) selected @endif>Ada</option>
<option value="0" @if ($peti->status_isi == 0) selected @endif>Tidak Ada</option>
</select>
</div> </div>
<div class="modal-footer d-flex justify-content-center"> <div class="modal-footer d-flex justify-content-center">
<a href="{{ route('dashboard.peti.index') }}" class="btn btn-secondary">Kembali</a> <a href="{{ route('dashboard.peti.index') }}" class="btn btn-secondary">Kembali</a>

24
resources/views/dashboard/Master_Data/Manajemen_Peti/Peti/index.blade.php

@ -78,16 +78,16 @@
<th class="text-center" style="width: 10px">No</th> <th class="text-center" style="width: 10px">No</th>
<th><input type="checkbox" class="checkbox " id="selectAll"></th> <th><input type="checkbox" class="checkbox " id="selectAll"></th>
<th>Fix Lot</th> <th>Fix Lot</th>
<th>User</th>
<th>Customer</th> <th>Customer</th>
<th>GD</th>
<th>Kode Customer</th> <th>Kode Customer</th>
<th>Tipe Peti</th> <th>Tipe Peti</th>
<th>Ukuran Peti</th> <th>Ukuran Peti</th>
<th>Lot No</th> <th>Lot No</th>
<th>Kondisi Peti</th>
<th>Packing No</th> <th>Packing No</th>
<th>Status</th> <th>GD</th>
<th>Kondisi Peti</th>
<th>Isi Peti</th>
<th>Warna Peti</th>
<th class="text-center">Action</th> <th class="text-center">Action</th>
</tr> </tr>
</thead> </thead>
@ -98,16 +98,24 @@
<td><input type="checkbox" class="checkbox" value="{{ $data_peti->id }}"> <td><input type="checkbox" class="checkbox" value="{{ $data_peti->id }}">
</td> </td>
<td>{{ $data_peti->fix_lot }}</td> <td>{{ $data_peti->fix_lot }}</td>
<td>{{ $data_peti->created_by }}</td>
<td>{{ $data_peti->customer->name }}</td> <td>{{ $data_peti->customer->name }}</td>
<td>{{ $data_peti->warehouse->name }}</td>
<td>{{ $data_peti->customer->code_customer }}</td> <td>{{ $data_peti->customer->code_customer }}</td>
<td>{{ $data_peti->tipe_peti->type }}</td> <td>{{ $data_peti->tipe_peti->type }}</td>
<td>{{ $data_peti->tipe_peti->size_peti }}</td> <td>{{ $data_peti->tipe_peti->size_peti }}</td>
<td>{{ $data_peti->customer->lot_no }}</td> <td>{{ $data_peti->customer->lot_no }}</td>
<td>{{ $data_peti->kondisipeti->nama_kondisi }}</td>
<td class="text-right">{{ $data_peti->packing_no }}</td> <td class="text-right">{{ $data_peti->packing_no }}</td>
<td>{{ $data_peti->status }}</td> <td>{{ $data_peti->warehouse->name }}</td>
<td>{{ $data_peti->kondisipeti->nama_kondisi }}</td>
<td>
@if ($data_peti->status_isi == 1)
Ada
@elseif($data_peti->status_isi == 0)
Tidak Ada
@else
Tidak Ada
@endif
</td>
<td>{{ $data_peti->warna }}</td>
<td class="text-center"> <td class="text-center">
<a href="{{ route('dashboard.peti.show', [$data_peti->id]) }}"> <a href="{{ route('dashboard.peti.show', [$data_peti->id]) }}">
<i class="fa fa-eye mr-2" style="font-size: 20px"></i> <i class="fa fa-eye mr-2" style="font-size: 20px"></i>

2
resources/views/dashboard/Master_Data/Manajemen_Peti/Peti/label_pdf.blade.php

@ -39,7 +39,7 @@
<table style="width:100%" class="table table-bordered"> <table style="width:100%" class="table table-bordered">
<tr> <tr>
<td rowspan="2"> <td rowspan="2">
<img src="data:image/jpeg;base64,<?= base64_encode(file_get_contents('assets/img/logo istw.jpg')) ?>" <img src="data:image/jpeg;base64,<?= base64_encode(file_get_contents('assets/img/istw_black&white.jpg')) ?>"
alt="Logo ISTW" width="100" height="100"> alt="Logo ISTW" width="100" height="100">
</td> </td>
<td>PETI NUMBER</td> <td>PETI NUMBER</td>

7
resources/views/dashboard/Master_Data/Manajemen_Peti/Peti/show.blade.php

@ -25,13 +25,14 @@
<label for="kondisipeti_id" class="col-form-label">Kondisi Peti:</label> <label for="kondisipeti_id" class="col-form-label">Kondisi Peti:</label>
<input class="form-control" value="{{ $peti->kondisipeti->nama_kondisi }}" readonly> <input class="form-control" value="{{ $peti->kondisipeti->nama_kondisi }}" readonly>
<label for="jumlah" class="col-form-label">Jumlah Peti:</label>
<input class="form-control" value="{{ $peti->jumlah }}" readonly>
<label for="date_pembuatan" class="col-form-label">Tanggal Pembuatan Peti:</label> <label for="date_pembuatan" class="col-form-label">Tanggal Pembuatan Peti:</label>
<input class="form-control" value="{{ \Carbon\Carbon::parse($peti->date_pembuatan)->format('d/m/Y') }}" <input class="form-control" value="{{ \Carbon\Carbon::parse($peti->date_pembuatan)->format('d/m/Y') }}"
readonly> readonly>
<label for="status_isi" class="col-form-label">Isi Peti:</label>
{{-- <input class="form-control" value="{{ $peti->status_isi }}" readonly> --}}
<input class="form-control" value="{{ $peti->status_isi == 1 ? 'Ada' : 'Tidak Ada' }}" readonly>
<div class="col-md-3"> <div class="col-md-3">
<label for="fix_lot" class="col-form-label d-flex justify-content-center align-items-center">QR <label for="fix_lot" class="col-form-label d-flex justify-content-center align-items-center">QR
Code:</label> Code:</label>

22
resources/views/dashboard/index.blade.php

@ -218,7 +218,7 @@
</select> </select>
<!-- Add a container div for the chart with 100% height --> <!-- Add a container div for the chart with 100% height -->
<div id="chartContainer" style="position: relative; flex: 1;"> <div id="chartContainer" style="position: relative; flex: 1; height:600px;">
<canvas id="ChartAssetStatus"></canvas> <canvas id="ChartAssetStatus"></canvas>
</div> </div>
</div> </div>
@ -458,26 +458,6 @@
downloadReport('StokOpname/export'); downloadReport('StokOpname/export');
}); });
</script> </script>
{{-- <script>
var chartContainerPie = document.getElementById('chartContainerPie');
var pieChartCanvas = document.getElementById('myPieChartsiopas');
function updatePieChartSize() {
var containerWidth = chartContainerPie.clientWidth * 0.9; // 90% of container width
var containerHeight = chartContainerPie.clientHeight;
// Set canvas dimensions based on container size
pieChartCanvas.width = containerWidth;
pieChartCanvas.height = containerHeight;
}
// Add event listener for window resize
window.addEventListener('resize', updatePieChartSize);
// Initial setup
updatePieChartSize();
</script> --}}
@endpush @endpush
@elseif(auth()->user()->role_id == 2) @elseif(auth()->user()->role_id == 2)
@include('pages.user.dashboard.index') @include('pages.user.dashboard.index')

4
resources/views/layouts/sidebar.blade.php

@ -37,9 +37,9 @@
aria-labelledby="headingTransaksi" data-parent="#accordionSidebar"> aria-labelledby="headingTransaksi" data-parent="#accordionSidebar">
<div class="bg-white py-2 collapse-inner rounded"> <div class="bg-white py-2 collapse-inner rounded">
<a class="collapse-item {{ $active == 'menu-peminjaman' ? 'active' : '' }}" <a class="collapse-item {{ $active == 'menu-peminjaman' ? 'active' : '' }}"
href="{{ route('dashboard.peminjaman.index') }}">Peminjaman</a> href="{{ route('dashboard.peminjaman.index') }}">Peti Out</a>
<a class="collapse-item {{ $active == 'menu-pengembalian' ? 'active' : '' }}" <a class="collapse-item {{ $active == 'menu-pengembalian' ? 'active' : '' }}"
href="{{ route('dashboard.pengembalian.index') }}">Pengembalian</a> href="{{ route('dashboard.pengembalian.index') }}">Peti In</a>
<a class="collapse-item {{ $active == 'menu-transfer' ? 'active' : '' }}" <a class="collapse-item {{ $active == 'menu-transfer' ? 'active' : '' }}"
href="{{ route('dashboard.transfer.index') }}">Transfer</a> href="{{ route('dashboard.transfer.index') }}">Transfer</a>
</div> </div>

4
resources/views/pages/layouts/sidebar_user.blade.php

@ -35,9 +35,9 @@
aria-labelledby="headingTransaksi" data-parent="#accordionSidebar"> aria-labelledby="headingTransaksi" data-parent="#accordionSidebar">
<div class="bg-white py-2 collapse-inner rounded"> <div class="bg-white py-2 collapse-inner rounded">
<a class="collapse-item {{ $active == 'menu-peminjaman' ? 'active' : '' }}" <a class="collapse-item {{ $active == 'menu-peminjaman' ? 'active' : '' }}"
href="{{ route('dashboard.peminjaman.index') }}">Peminjaman</a> href="{{ route('dashboard.peminjaman.index') }}">Peti Out</a>
<a class="collapse-item {{ $active == 'menu-pengembalian' ? 'active' : '' }}" <a class="collapse-item {{ $active == 'menu-pengembalian' ? 'active' : '' }}"
href="{{ route('dashboard.pengembalian.index') }}">Pengembalian</a> href="{{ route('dashboard.pengembalian.index') }}">Peti In</a>
<a class="collapse-item {{ $active == 'menu-transfer' ? 'active' : '' }}" <a class="collapse-item {{ $active == 'menu-transfer' ? 'active' : '' }}"
href="{{ route('dashboard.transfer.index') }}">Transfer</a> href="{{ route('dashboard.transfer.index') }}">Transfer</a>
</div> </div>

Loading…
Cancel
Save