Browse Source

Perbaikan disposal, peminjaman dan pengembalian

master
Gunawan19621 1 year ago
parent
commit
ef4c563141
  1. 2
      app/Http/Controllers/CustomerController.php
  2. 56
      app/Http/Controllers/DisposalController.php
  3. 2
      app/Http/Controllers/KondisiPetiController.php
  4. 2
      app/Http/Controllers/M_userController.php
  5. 13
      app/Http/Controllers/PeminjamanController.php
  6. 6
      app/Http/Controllers/PengembalianController.php
  7. 2
      app/Http/Controllers/PetiController.php
  8. 1
      app/Http/Controllers/PetternLotPetiController.php
  9. 2
      app/Http/Controllers/RoleController.php
  10. 6
      app/Http/Controllers/TransferController.php
  11. 2
      app/Http/Controllers/TypePetiController.php
  12. 2
      app/Http/Controllers/WarehouseController.php
  13. 6
      app/Http/Requests/Disposal/ValidasiCreateDisposal.php
  14. 17
      app/Http/Requests/Disposal/ValidasiUpdateDisposal.php
  15. 1
      app/Http/Requests/ValidasiUpdatePengembalian.php
  16. 3
      app/Models/Disposal.php
  17. 1
      app/Models/Transfer.php
  18. 2
      app/Models/asset_status.php
  19. 1
      database/migrations/2023_11_06_085238_create_petis_table.php
  20. 3
      database/migrations/2023_11_06_122033_create_asset_statuses_table.php
  21. 11
      database/migrations/2023_11_08_132316_create_transfers_table.php
  22. 7
      database/migrations/2023_11_17_075418_create_disposals_table.php
  23. 22
      resources/views/dashboard/Disposal/create.blade.php
  24. 27
      resources/views/dashboard/Disposal/edit.blade.php
  25. 4
      resources/views/dashboard/Disposal/index.blade.php
  26. 30
      resources/views/dashboard/Peminjaman/index.blade.php
  27. 2
      resources/views/dashboard/Pengembalian/edit.blade.php
  28. 5
      resources/views/dashboard/Pengembalian/index.blade.php
  29. 10
      resources/views/dashboard/Transfer/create.blade.php
  30. 2
      routes/web.php

2
app/Http/Controllers/CustomerController.php

@ -18,7 +18,7 @@ class CustomerController extends Controller
public function index() public function index()
{ {
$data = [ $data = [
'customer' => Customer::all(), 'customer' => Customer::orderBy('created_at', 'desc')->get(),
'active' => 'menu-customer', 'active' => 'menu-customer',
]; ];
return view('dashboard.Master_Data.Customer.index', $data); return view('dashboard.Master_Data.Customer.index', $data);

56
app/Http/Controllers/DisposalController.php

@ -4,18 +4,20 @@ namespace App\Http\Controllers;
use App\Models\Peti; use App\Models\Peti;
use App\Models\Customer; use App\Models\Customer;
use App\Models\Disposal;
use App\Models\m_warehouse; use App\Models\m_warehouse;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Symfony\Component\Uid\Uuid;
use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Auth;
use App\Http\Requests\Disposal\ValidasiCreateDisposal; use App\Http\Requests\Disposal\ValidasiCreateDisposal;
use App\Models\Disposal; use App\Http\Requests\Disposal\ValidasiUpdateDisposal;
class DisposalController extends Controller class DisposalController extends Controller
{ {
public function index() public function index()
{ {
$data = [ $data = [
'disposal' => Disposal::all(), 'disposal' => Disposal::orderBy('created_at', 'desc')->get(),
'active' => 'menu-disposal', 'active' => 'menu-disposal',
]; ];
return view('dashboard.Disposal.index', $data); return view('dashboard.Disposal.index', $data);
@ -42,6 +44,7 @@ class DisposalController extends Controller
public function store(ValidasiCreateDisposal $request) public function store(ValidasiCreateDisposal $request)
{ {
// dd($request->all()); // dd($request->all());
// dd($request);
try { try {
// Mendapatkan informasi pengguna yang sedang login // Mendapatkan informasi pengguna yang sedang login
$currentUser = Auth::user(); $currentUser = Auth::user();
@ -50,11 +53,18 @@ class DisposalController extends Controller
$validatedData = $request->validated(); $validatedData = $request->validated();
// Menambahkan informasi pengguna ke dalam data yang akan disimpan // Menambahkan informasi pengguna ke dalam data yang akan disimpan
$validatedData['mobile_id'] = Uuid::v4(); // Menambahkan ID Mobile
$validatedData['created_by'] = $currentUser->fullname; $validatedData['created_by'] = $currentUser->fullname;
$validatedData['updated_by'] = $currentUser->fullname; $validatedData['updated_by'] = $currentUser->fullname;
// Membuat entitas Transfer // Membuat entitas Disposal
Disposal::create($validatedData); $disposal = Disposal::create($validatedData);
// Mengupdate warehouse_id pada model Peti
Peti::where('id', $disposal->peti_id)
->update([
'status' => $disposal->status_disposal,
]);
return redirect()->route('dashboard.disposal.index')->with('success', 'Data Disposal Peti berhasil ditambahkan'); return redirect()->route('dashboard.disposal.index')->with('success', 'Data Disposal Peti berhasil ditambahkan');
} catch (\Throwable $th) { } catch (\Throwable $th) {
@ -92,10 +102,40 @@ class DisposalController extends Controller
/** /**
* Update the specified resource in storage. * Update the specified resource in storage.
*/ */
// public function update($request, $id) public function update(ValidasiUpdateDisposal $request, $id)
// { {
// // // dd("oke");
// } 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
$disposal = Disposal::find($id);
if (!$disposal) {
return redirect()->route('dashboard.disposal.index')->with('error', 'Data Disposal Peti tidak ditemukan');
}
// Memperbarui data transfer
$disposal->update($validatedData);
// Mengupdate warehouse_id pada model Peti
Peti::where('id', $disposal->peti_id)
->update([
'status' => $disposal->status_disposal,
]);
return redirect()->route('dashboard.disposal.index')->with('success', 'Data Disposal Peti berhasil diperbaharui');
} catch (\Throwable $th) {
return redirect()->back()->with('error', 'Data Disposal Peti gagal diperbaharui');
}
}
/** /**
* Remove the specified resource from storage. * Remove the specified resource from storage.

2
app/Http/Controllers/KondisiPetiController.php

@ -13,7 +13,7 @@ class KondisiPetiController extends Controller
public function index() public function index()
{ {
$data = [ $data = [
'kondisiPeti' => Kondisi_Peti::all(), 'kondisiPeti' => Kondisi_Peti::orderBy('created_at', 'desc')->get(),
'active' => 'menu-kondisipeti' 'active' => 'menu-kondisipeti'
]; ];
return view('dashboard.Master_Data.Manajemen_Peti.Kondisi_Peti.index', $data); return view('dashboard.Master_Data.Manajemen_Peti.Kondisi_Peti.index', $data);

2
app/Http/Controllers/M_userController.php

@ -17,9 +17,9 @@ class M_userController extends Controller
public function index() public function index()
{ {
$data = [ $data = [
'user' => User::orderBy('created_at', 'desc')->get(),
'warehouse' => m_warehouse::get(), 'warehouse' => m_warehouse::get(),
'role' => m_role::get(), 'role' => m_role::get(),
'user' => User::get(),
'active' => 'menu-user', 'active' => 'menu-user',
]; ];
return view('dashboard.Master_Data.User.index', $data); return view('dashboard.Master_Data.User.index', $data);

13
app/Http/Controllers/PeminjamanController.php

@ -5,12 +5,10 @@ namespace App\Http\Controllers;
use App\Http\Requests\ValidasiCreatePeminjaman; use App\Http\Requests\ValidasiCreatePeminjaman;
use App\Http\Requests\ValidasiUpdatePeminjaman; use App\Http\Requests\ValidasiUpdatePeminjaman;
use App\Models\Peti; use App\Models\Peti;
use App\Models\m_asset;
use App\Models\m_warehouse; use App\Models\m_warehouse;
use App\Models\asset_status; use App\Models\asset_status;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Auth;
use SimpleSoftwareIO\QrCode\Facades\QrCode; use Symfony\Component\Uid\Uuid;
class PeminjamanController extends Controller class PeminjamanController extends Controller
{ {
@ -22,7 +20,7 @@ class PeminjamanController extends Controller
$data = [ $data = [
// 'peminjaman' => asset_status::get(), // 'peminjaman' => asset_status::get(),
'peminjaman' => asset_status::get(), 'peminjaman' => asset_status::orderBy('created_at', 'desc')->get(),
'warehouse' => m_warehouse::get(), 'warehouse' => m_warehouse::get(),
'active' => 'menu-peminjaman', 'active' => 'menu-peminjaman',
]; ];
@ -39,7 +37,10 @@ class PeminjamanController extends Controller
'peti' => Peti::all(), 'peti' => Peti::all(),
'peminjaman' => asset_status::get(), 'peminjaman' => asset_status::get(),
'warehouse' => m_warehouse::get(), 'warehouse' => m_warehouse::get(),
'peti_block' => Peti::whereNotIn('id', asset_status::pluck('peti_id')->toArray())->get(), 'peti_block' => Peti::whereNotIn('id', asset_status::where('status', 0)->pluck('peti_id')->toArray())
->where('status', 'AKTIF') // Sesuaikan dengan nama kolom yang benar
->get(),
'existingPeti' => asset_status::pluck('peti_id')->toArray(), 'existingPeti' => asset_status::pluck('peti_id')->toArray(),
'active' => 'menu-peminjaman', 'active' => 'menu-peminjaman',
]; ];
@ -56,8 +57,10 @@ class PeminjamanController extends Controller
$validatedData = $request->except('_token'); $validatedData = $request->except('_token');
$validatedData['exit_pic'] = $currentUser->fullname; // Menambahkan ID pengguna sebagai created_by $validatedData['exit_pic'] = $currentUser->fullname; // Menambahkan ID pengguna sebagai created_by
$validatedData['mobile_id'] = Uuid::v4(); // Menambahkan ID Mobile
$validatedData['created_by'] = $currentUser->fullname; // Menambahkan ID pengguna sebagai created_by $validatedData['created_by'] = $currentUser->fullname; // Menambahkan ID pengguna sebagai created_by
$validatedData['updated_by'] = $currentUser->fullname; // Menambahkan ID pengguna sebagai updated_by $validatedData['updated_by'] = $currentUser->fullname; // Menambahkan ID pengguna sebagai updated_by
// dd($validatedData); // dd($validatedData);
asset_status::create($validatedData); asset_status::create($validatedData);
return redirect()->route('dashboard.peminjaman.index')->with('success', 'Data peminjaman berhasil ditambah.'); return redirect()->route('dashboard.peminjaman.index')->with('success', 'Data peminjaman berhasil ditambah.');

6
app/Http/Controllers/PengembalianController.php

@ -14,7 +14,7 @@ class PengembalianController extends Controller
public function index() public function index()
{ {
$data = [ $data = [
'peminjaman' => asset_status::all(), 'peminjaman' => asset_status::orderBy('created_at', 'desc')->get(),
'active' => 'menu-pengembalian', 'active' => 'menu-pengembalian',
]; ];
return view('dashboard.Pengembalian.index', $data); return view('dashboard.Pengembalian.index', $data);
@ -76,7 +76,9 @@ class PengembalianController extends Controller
$peminjaman->enter_at = $request->input('enter_at'); $peminjaman->enter_at = $request->input('enter_at');
$peminjaman->enter_warehouse = $request->input('enter_warehouse'); $peminjaman->enter_warehouse = $request->input('enter_warehouse');
$peminjaman->kondisi_peti = $request->input('kondisi_peti'); $peminjaman->kondisi_peti = $request->input('kondisi_peti');
// Mengatur status menjadi 0 secara otomatis
$peminjaman->status = 0;
// dd($peminjaman);
$peminjaman->save(); $peminjaman->save();
return redirect()->route('dashboard.pengembalian.index')->with('success', 'Data peminjaman berhasil diperbaharui'); return redirect()->route('dashboard.pengembalian.index')->with('success', 'Data peminjaman berhasil diperbaharui');

2
app/Http/Controllers/PetiController.php

@ -24,8 +24,8 @@ class PetiController extends Controller
public function index() public function index()
{ {
$data = [ $data = [
'peti' => Peti::orderBy('created_at', 'desc')->get(),
'kondisiPeti' => Kondisi_Peti::all(), 'kondisiPeti' => Kondisi_Peti::all(),
'peti' => Peti::all(),
'active' => 'menu-peti', 'active' => 'menu-peti',
]; ];
return view('dashboard.Master_Data.Manajemen_Peti.Peti.index', $data); return view('dashboard.Master_Data.Manajemen_Peti.Peti.index', $data);

1
app/Http/Controllers/PetternLotPetiController.php

@ -12,6 +12,7 @@ class PetternLotPetiController extends Controller
public function index() public function index()
{ {
$data = [ $data = [
// 'warehouses' => m_warehouse::orderBy('created_at', 'desc')->get(),
'peti' => Peti::get(), 'peti' => Peti::get(),
'active' => 'menu-Pettern_Lot_Peti' 'active' => 'menu-Pettern_Lot_Peti'
]; ];

2
app/Http/Controllers/RoleController.php

@ -16,7 +16,7 @@ class RoleController extends Controller
public function index() public function index()
{ {
$data = [ $data = [
'role' => m_role::all(), 'role' => m_role::orderBy('created_at', 'desc')->get(),
'active' => 'menu-role', 'active' => 'menu-role',
]; ];
return view('dashboard.Master_Data.Role.index', $data); return view('dashboard.Master_Data.Role.index', $data);

6
app/Http/Controllers/TransferController.php

@ -3,6 +3,7 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Models\Peti; use App\Models\Peti;
use Symfony\Component\Uid\Uuid;
use App\Models\Customer; use App\Models\Customer;
use App\Models\Transfer; use App\Models\Transfer;
use App\Models\m_warehouse; use App\Models\m_warehouse;
@ -16,7 +17,7 @@ class TransferController extends Controller
public function index() public function index()
{ {
$data = [ $data = [
'transfer' => Transfer::all(), 'transfer' => Transfer::orderBy('created_at', 'desc')->get(),
'active' => 'menu-transfer', 'active' => 'menu-transfer',
]; ];
return view('dashboard.Transfer.index', $data); return view('dashboard.Transfer.index', $data);
@ -50,12 +51,13 @@ class TransferController extends Controller
$validatedData = $request->validated(); $validatedData = $request->validated();
// Menambahkan informasi pengguna ke dalam data yang akan disimpan // Menambahkan informasi pengguna ke dalam data yang akan disimpan
$validatedData['mobile_id'] = Uuid::v4(); // Menambahkan ID Mobile
$validatedData['created_by'] = $currentUser->fullname; $validatedData['created_by'] = $currentUser->fullname;
$validatedData['updated_by'] = $currentUser->fullname; $validatedData['updated_by'] = $currentUser->fullname;
// Membuat entitas Transfer // Membuat entitas Transfer
$transfer = Transfer::create($validatedData); $transfer = Transfer::create($validatedData);
// dd($transfer);
// Mengupdate warehouse_id pada model Peti // Mengupdate warehouse_id pada model Peti
Peti::where('id', $transfer->peti_id) Peti::where('id', $transfer->peti_id)
->update([ ->update([

2
app/Http/Controllers/TypePetiController.php

@ -16,7 +16,7 @@ class TypePetiController extends Controller
public function index() public function index()
{ {
$data = [ $data = [
'typepeti' => Type_peti::all(), 'typepeti' => Type_peti::orderBy('created_at', 'desc')->get(),
'active' => 'menu-typepeti', 'active' => 'menu-typepeti',
]; ];
return view('dashboard.Master_Data.Manajemen_Peti.Type_peti.index', $data); return view('dashboard.Master_Data.Manajemen_Peti.Type_peti.index', $data);

2
app/Http/Controllers/WarehouseController.php

@ -16,7 +16,7 @@ class WarehouseController extends Controller
public function index() public function index()
{ {
$data = [ $data = [
'warehouses' => m_warehouse::all(), 'warehouses' => m_warehouse::orderBy('created_at', 'desc')->get(),
'active' => 'menu-warehouse', 'active' => 'menu-warehouse',
]; ];
return view('dashboard.Master_Data.Warehouse.index', $data); return view('dashboard.Master_Data.Warehouse.index', $data);

6
app/Http/Requests/Disposal/ValidasiCreateDisposal.php

@ -22,12 +22,12 @@ class ValidasiCreateDisposal extends FormRequest
public function rules(): array public function rules(): array
{ {
return [ return [
'peti_id' => 'nullable', 'peti_id' => 'required',
'customer_id' => 'nullable', 'customer_id' => 'nullable',
'warehouse_id' => 'nullable', 'warehouse_id' => 'nullable',
'date_disposal' => 'nullable|date', 'date_disposal' => 'nullable|date',
'description' => 'nullable|string', 'description' => 'nullable|string',
'jenis_disposal' => 'nullable|string|max:50', 'status_disposal' => 'nullable',
]; ];
} }
@ -36,8 +36,6 @@ class ValidasiCreateDisposal extends FormRequest
return [ return [
'date_disposal.date' => 'Format tanggal disposal tidak valid.', 'date_disposal.date' => 'Format tanggal disposal tidak valid.',
'description.string' => 'Deskripsi harus berupa teks.', 'description.string' => 'Deskripsi harus berupa teks.',
'jenis_disposal.string' => 'Jenis disposal harus berupa teks.',
'jenis_disposal.max' => 'Jenis disposal tidak boleh lebih dari :max karakter.',
]; ];
} }
} }

17
app/Http/Requests/Disposal/ValidasiUpdateDisposal.php

@ -11,7 +11,7 @@ class ValidasiUpdateDisposal extends FormRequest
*/ */
public function authorize(): bool public function authorize(): bool
{ {
return false; return true;
} }
/** /**
@ -22,7 +22,20 @@ class ValidasiUpdateDisposal extends FormRequest
public function rules(): array public function rules(): array
{ {
return [ return [
// 'peti_id' => 'required',
'customer_id' => 'nullable',
'warehouse_id' => 'nullable',
'date_disposal' => 'nullable|date',
'description' => 'nullable|string',
'status_disposal' => 'nullable',
];
}
public function messages(): array
{
return [
'date_disposal.date' => 'Format tanggal disposal tidak valid.',
'description.string' => 'Deskripsi harus berupa teks.',
]; ];
} }
} }

1
app/Http/Requests/ValidasiUpdatePengembalian.php

@ -29,6 +29,7 @@ class ValidasiUpdatePengembalian extends FormRequest
'enter_at' => 'required|date', 'enter_at' => 'required|date',
'enter_warehouse' => 'required', 'enter_warehouse' => 'required',
'kondisi_peti' => 'required|string', 'kondisi_peti' => 'required|string',
'status' => '',
]; ];
} }

3
app/Models/Disposal.php

@ -13,12 +13,13 @@ class Disposal extends Model
protected $table = 'disposals'; protected $table = 'disposals';
protected $fillable = [ protected $fillable = [
'mobile_id',
'peti_id', 'peti_id',
'customer_id', 'customer_id',
'date_disposal', 'date_disposal',
'warehouse_id', 'warehouse_id',
'description', 'description',
'jenis_disposal', 'status_disposal',
'created_by', 'created_by',
'updated_by', 'updated_by',
]; ];

1
app/Models/Transfer.php

@ -14,6 +14,7 @@ class Transfer extends Model
protected $table = 'transfers'; protected $table = 'transfers';
protected $fillable = [ protected $fillable = [
'mobile_id',
'peti_id', 'peti_id',
'source_warehouse', 'source_warehouse',
'destination_warehouse', 'destination_warehouse',

2
app/Models/asset_status.php

@ -15,6 +15,7 @@ class asset_status extends Model
protected $table = 'asset_statuses'; protected $table = 'asset_statuses';
protected $fillable = [ protected $fillable = [
'mobile_id',
'peti_id', 'peti_id',
'exit_at', 'exit_at',
'est_pengembalian', 'est_pengembalian',
@ -24,6 +25,7 @@ class asset_status extends Model
'enter_pic', 'enter_pic',
'enter_warehouse', 'enter_warehouse',
'kondisi_peti', 'kondisi_peti',
'status',
'created_by', 'created_by',
'updated_by', 'updated_by',
]; ];

1
database/migrations/2023_11_06_085238_create_petis_table.php

@ -23,6 +23,7 @@ return new class extends Migration
$table->date('date_pembuatan', 100)->nullable(); $table->date('date_pembuatan', 100)->nullable();
$table->foreignUuid('warehouse_id')->nullable()->constrained('m_warehouses')->onDelete('set null'); $table->foreignUuid('warehouse_id')->nullable()->constrained('m_warehouses')->onDelete('set null');
$table->foreignUuid('kondisipeti_id')->nullable()->constrained('kondisi_petis')->onDelete('set null'); $table->foreignUuid('kondisipeti_id')->nullable()->constrained('kondisi_petis')->onDelete('set null');
$table->string('status', 50)->default('AKTIF');
$table->timestamps(); $table->timestamps();
$table->softDeletes(); $table->softDeletes();
$table->string('created_by', 200)->nullable(); $table->string('created_by', 200)->nullable();

3
database/migrations/2023_11_06_122033_create_asset_statuses_table.php

@ -13,6 +13,7 @@ return new class extends Migration
{ {
Schema::create('asset_statuses', function (Blueprint $table) { Schema::create('asset_statuses', function (Blueprint $table) {
$table->uuid('id')->primary(); $table->uuid('id')->primary();
$table->uuid('mobile_id')->nullable();
$table->foreignUuid('peti_id')->nullable()->constrained('petis')->onDelete('set null'); $table->foreignUuid('peti_id')->nullable()->constrained('petis')->onDelete('set null');
$table->date('exit_at')->nullable(); $table->date('exit_at')->nullable();
$table->date('est_pengembalian')->nullable(); $table->date('est_pengembalian')->nullable();
@ -22,6 +23,8 @@ return new class extends Migration
$table->string('enter_pic', 200)->nullable(); $table->string('enter_pic', 200)->nullable();
$table->foreignUuid('enter_warehouse')->nullable()->constrained('m_warehouses'); $table->foreignUuid('enter_warehouse')->nullable()->constrained('m_warehouses');
$table->string('kondisi_peti')->nullable(); $table->string('kondisi_peti')->nullable();
// $table->string('status')->default('DIPINJAM');
$table->boolean('status')->default(1);
$table->timestamps(); $table->timestamps();
$table->softDeletes(); $table->softDeletes();
$table->string('created_by', 200)->nullable(); $table->string('created_by', 200)->nullable();

11
database/migrations/2023_11_08_132316_create_transfers_table.php

@ -13,11 +13,12 @@ return new class extends Migration
{ {
Schema::create('transfers', function (Blueprint $table) { Schema::create('transfers', function (Blueprint $table) {
$table->uuid('id')->primary(); $table->uuid('id')->primary();
$table->foreignUuid('peti_id')->nullable()->constrained('petis')->onDelete('set null'); $table->uuid('mobile_id')->nullable();
$table->foreignUuid('name_customer')->nullable()->constrained('customers'); $table->foreignUuid('peti_id')->constrained('petis');
$table->foreignUuid('source_warehouse')->nullable()->constrained('m_warehouses'); $table->foreignUuid('name_customer')->constrained('customers');
$table->foreignUuid('destination_warehouse')->nullable()->constrained('m_warehouses'); $table->foreignUuid('source_warehouse')->constrained('m_warehouses');
$table->date('date')->nullable(); $table->foreignUuid('destination_warehouse')->constrained('m_warehouses');
$table->date('date');
$table->timestamps(); $table->timestamps();
$table->softDeletes(); $table->softDeletes();
$table->string('created_by', 200)->nullable(); $table->string('created_by', 200)->nullable();

7
database/migrations/2023_11_17_075418_create_disposals_table.php

@ -13,12 +13,13 @@ return new class extends Migration
{ {
Schema::create('disposals', function (Blueprint $table) { Schema::create('disposals', function (Blueprint $table) {
$table->uuid('id')->primary(); $table->uuid('id')->primary();
$table->foreignUuid('peti_id')->nullable()->constrained('petis')->onDelete('set null'); $table->uuid('mobile_id')->nullable();
$table->foreignUuid('peti_id')->constrained('petis');
$table->foreignUuid('customer_id')->nullable()->constrained('customers'); $table->foreignUuid('customer_id')->nullable()->constrained('customers');
$table->foreignUuid('warehouse_id')->nullable()->constrained('m_warehouses'); $table->foreignUuid('warehouse_id')->nullable()->constrained('m_warehouses');
$table->date('date_disposal')->nullable(); $table->date('date_disposal');
$table->text('description')->nullable(); $table->text('description')->nullable();
$table->string('jenis_disposal', 50)->nullable(); $table->string('status_disposal', 50);
$table->timestamps(); $table->timestamps();
$table->softDeletes(); $table->softDeletes();
$table->string('created_by', 200)->nullable(); $table->string('created_by', 200)->nullable();

22
resources/views/dashboard/Disposal/create.blade.php

@ -27,7 +27,7 @@
</select> </select>
<label for="customer_id" class="col-form-label">Customer: <span class="text-danger">*</span></label> <label for="customer_id" class="col-form-label">Customer: <span class="text-danger">*</span></label>
<select class="form-control" name="customer_id" type="text" id="customer_id"> <select class="form-control" name="customer_id" type="text" id="customer_id" required>
<option disabled selected>Nama Customer akan otomatis terpilih ketika memilih detail peti.</option> <option disabled selected>Nama Customer akan otomatis terpilih ketika memilih detail peti.</option>
@foreach ($customer as $data_customer) @foreach ($customer as $data_customer)
<option value="{{ $data_customer->id }}">{{ $data_customer->name }}</option> <option value="{{ $data_customer->id }}">{{ $data_customer->name }}</option>
@ -37,27 +37,27 @@
<label for="date_disposal" class="col-form-label">Tanggal Disposal: <span <label for="date_disposal" class="col-form-label">Tanggal Disposal: <span
class="text-danger">*</span></label> class="text-danger">*</span></label>
<input class="form-control" name="date_disposal" type="date" id="date_disposal" <input class="form-control" name="date_disposal" type="date" id="date_disposal"
value="{{ old('date_disposal') }}"> value="{{ old('date_disposal') }}" required>
<label for="warehouse_id" class="col-form-label">Asal Gudang: <span class="text-danger">*</span></label> <label for="warehouse_id" class="col-form-label">Asal Gudang: <span class="text-danger">*</span></label>
<select class="form-control" name="warehouse_id" type="text" id="warehouse_id"> <select class="form-control" name="warehouse_id" type="text" id="warehouse_id" required>
<option disabled selected>Asal gudang akan otomatis terpilih ketika memilih detail peti.</option> <option disabled selected>Asal gudang akan otomatis terpilih ketika memilih detail peti.</option>
@foreach ($warehouse as $data) @foreach ($warehouse as $data)
<option value="{{ $data->id }}">{{ $data->name }}</option> <option value="{{ $data->id }}">{{ $data->name }}</option>
@endforeach @endforeach
</select> </select>
<label for="description" class="col-form-label">Alasan Disposal: <span <label for="status_disposal" class="col-form-label">Status Peti: <span
class="text-danger">*</span></label> class="text-danger">*</span></label>
<textarea class="form-control" name="description" id="description" placeholder="Masukan Alasan Disposal" required>{{ old('description') }}</textarea> <select class="form-control" name="status_disposal" id="status_disposal" required>
<option disabled selected>Pilih Jenis Status Peti</option>
<option value="AKTIF">AKTIF</option>
<option value="INAKTIF">INAKTIF</option>
</select>
<label for="jenis_disposal" class="col-form-label">Jenis Disposal: <span <label for="description" class="col-form-label">Alasan Disposal: <span
class="text-danger">*</span></label> class="text-danger">*</span></label>
<select class="form-control" name="jenis_disposal" id="jenis_disposal"> <textarea class="form-control" name="description" id="description" placeholder="Masukan Alasan Disposal" required>{{ old('description') }}</textarea>
<option disabled selected>Pilih Jenis Disposal</option>
<option value="Pemusnaan">Pemusnaan</option>
<option value="Perbaikan">Perbaikan</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.disposal.index') }}" class="btn btn-secondary">Kembali</a> <a href="{{ route('dashboard.disposal.index') }}" class="btn btn-secondary">Kembali</a>

27
resources/views/dashboard/Disposal/edit.blade.php

@ -11,9 +11,10 @@
</div> </div>
</div> </div>
<div class="card-body"> <div class="card-body">
<form action="{{ route('dashboard.disposal.store') }}" method="POST" enctype="multipart/form-data" <form action="{{ route('dashboard.disposal.update', $disposal->id) }}" method="POST" enctype="multipart/form-data"
id="disposalForm"> id="disposalForm">
@csrf @csrf
@method('PUT')
<div class="form-group"> <div class="form-group">
<label for="peti_id" class="col-form-label">Pilih Detail Peti: <span <label for="peti_id" class="col-form-label">Pilih Detail Peti: <span
class="text-danger">*</span></label> class="text-danger">*</span></label>
@ -44,10 +45,6 @@
<input class="form-control" name="date_disposal" type="date" id="date_disposal" <input class="form-control" name="date_disposal" type="date" id="date_disposal"
value="{{ $disposal->date_disposal }}"> value="{{ $disposal->date_disposal }}">
<label for="warehouse_id" class="col-form-label">Asal Gudang: <span class="text-danger">*</span></label> <label for="warehouse_id" class="col-form-label">Asal Gudang: <span class="text-danger">*</span></label>
<select class="form-control" name="warehouse_id" type="text" id="warehouse_id" required> <select class="form-control" name="warehouse_id" type="text" id="warehouse_id" required>
<option disabled selected>Pilih Asal gudang</option> <option disabled selected>Pilih Asal gudang</option>
@ -63,13 +60,23 @@
class="text-danger">*</span></label> class="text-danger">*</span></label>
<textarea class="form-control" name="description" id="description" placeholder="Masukan Alasan Disposal" required>{{ $disposal->description }}</textarea> <textarea class="form-control" name="description" id="description" placeholder="Masukan Alasan Disposal" required>{{ $disposal->description }}</textarea>
<label for="jenis_disposal" class="col-form-label">Jenis Disposal: <span {{-- <label for="status_disposal" class="col-form-label">Status Peti: <span
class="text-danger">*</span></label> class="text-danger">*</span></label>
<select class="form-control" name="jenis_disposal" id="jenis_disposal"> <select class="form-control" name="status_disposal" id="status_disposal">
<option disabled selected>Pilih Jenis Disposal</option> <option disabled selected>Pilih Jenis Status Peti</option>
<option value="Pemusnaan">Pemusnaan</option> <option value="AKTIF">AKTIF</option>
<option value="Perbaikan">Perbaikan</option> <option value="INAKTIF">INAKTIF</option>
</select> --}}
<label for="status_disposal" class="col-form-label">Status Peti: <span
class="text-danger">*</span></label>
<select class="form-control" name="status_disposal" id="status_disposal">
<option disabled>Pilih Jenis Status Peti</option>
<option value="AKTIF" {{ $disposal->status_disposal === 'AKTIF' ? 'selected' : '' }}>AKTIF
</option>
<option value="INAKTIF" {{ $disposal->status_disposal === 'INAKTIF' ? 'selected' : '' }}>INAKTIF
</option>
</select> </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.disposal.index') }}" class="btn btn-secondary">Kembali</a> <a href="{{ route('dashboard.disposal.index') }}" class="btn btn-secondary">Kembali</a>

4
resources/views/dashboard/Disposal/index.blade.php

@ -71,7 +71,7 @@
<th>Nama Customer</th> <th>Nama Customer</th>
<th>Tanggal Disposal</th> <th>Tanggal Disposal</th>
<th>Alasan Disposal</th> <th>Alasan Disposal</th>
<th>Jenis Disposal</th> <th>Status Peti</th>
<th class="text-center">Action</th> <th class="text-center">Action</th>
</tr> </tr>
</thead> </thead>
@ -86,7 +86,7 @@
<td>{{ $data_disposal->customer->name }}</td> <td>{{ $data_disposal->customer->name }}</td>
<td>{{ \Carbon\Carbon::parse($data_disposal->date_disposal)->format('d/m/Y') }}</td> <td>{{ \Carbon\Carbon::parse($data_disposal->date_disposal)->format('d/m/Y') }}</td>
<td>{{ $data_disposal->description }}</td> <td>{{ $data_disposal->description }}</td>
<td>{{ $data_disposal->jenis_disposal }}</td> <td>{{ $data_disposal->status_disposal }}</td>
<td class="text-center"> <td class="text-center">
<a href="{{ route('dashboard.disposal.edit', $data_disposal->id) }}" title="Edit"> <a href="{{ route('dashboard.disposal.edit', $data_disposal->id) }}" title="Edit">
<i class="fa fa-edit mr-2" style="font-size: 20px"></i> <i class="fa fa-edit mr-2" style="font-size: 20px"></i>

30
resources/views/dashboard/Peminjaman/index.blade.php

@ -57,6 +57,10 @@
<td>{{ $data_peminjaman->exit_pic }}</td> <td>{{ $data_peminjaman->exit_pic }}</td>
<td>{{ $data_peminjaman->warehouse->name }}</td> <td>{{ $data_peminjaman->warehouse->name }}</td>
<td class="text-center"> <td class="text-center">
<a href="{{ route('dashboard.pengembalian.edit', $data_peminjaman->id) }}"
title="Pengembalian">
<i class="fa fa-reply mr-2" style="font-size: 20px"></i>
</a>
<a href="{{ route('dashboard.peminjaman.edit', $data_peminjaman->id) }}" <a href="{{ route('dashboard.peminjaman.edit', $data_peminjaman->id) }}"
title="Edit"> title="Edit">
<i class="fa fa-edit mr-2" style="font-size: 20px"></i> <i class="fa fa-edit mr-2" style="font-size: 20px"></i>
@ -75,32 +79,6 @@
</td> </td>
</tr> </tr>
@endif @endif
{{-- <tr>
<td class="text-center">{{ $no_peminjaman++ }}</td>
<td>{{ $data_peminjaman->peti->fix_lot }}</td>
<td>{{ $data_peminjaman->peti->customer->name }}</td>
<td>{{ $data_peminjaman->peti->customer->code_customer }} -
{{ $data_peminjaman->peti->tipe_peti->type }}</td>
<td>{{ \Carbon\Carbon::parse($data_peminjaman->exit_at)->format('d/m/Y') }}</td>
<td>{{ $data_peminjaman->exit_pic }}</td>
<td>{{ $data_peminjaman->warehouse->name }}</td>
<td class="text-center">
<a href="{{ route('dashboard.peminjaman.edit', $data_peminjaman->id) }}"
title="Edit">
<i class="fa fa-edit mr-2" style="font-size: 20px"></i>
</a>
<form action="{{ route('dashboard.peminjaman.destroy', $data_peminjaman->id) }}"
method="POST" style="display: inline;">
@csrf
@method('DELETE')
<button type="submit"
onclick="return confirm('Apakah Anda yakin ingin menghapus data ini?')"
title="Delete" style="border: none; background: none; cursor: pointer;">
<i class="fa fa-trash text-danger" style="font-size: 20px"></i>
</button>
</form>
</td>
</tr> --}}
@empty @empty
<p>Data Kosong</p> <p>Data Kosong</p>
@endforelse @endforelse

2
resources/views/dashboard/Pengembalian/edit.blade.php

@ -62,7 +62,7 @@
pattern="[^0-9]+" oninput="this.value=this.value.replace(/[0-9]/g,'');" required> pattern="[^0-9]+" oninput="this.value=this.value.replace(/[0-9]/g,'');" required>
</div> </div>
<div class="modal-footer d-flex justify-content-center"> <div class="modal-footer d-flex justify-content-center">
<a href="{{ route('dashboard.pengembalian.index') }}" class="btn btn-secondary">Kembali</a> <a href="{{ route('dashboard.peminjaman.index') }}" class="btn btn-secondary">Kembali</a>
<button type="submit" class="btn btn-primary" id="submitButton">Simpan</button> <button type="submit" class="btn btn-primary" id="submitButton">Simpan</button>
</div> </div>
</form> </form>

5
resources/views/dashboard/Pengembalian/index.blade.php

@ -40,6 +40,7 @@
$no_peminjaman = 1; $no_peminjaman = 1;
@endphp @endphp
@forelse ($peminjaman as $data) @forelse ($peminjaman as $data)
@if ($data->enter_warehouse !== null)
<tr> <tr>
<td>{{ $no_peminjaman++ }}</td> <td>{{ $no_peminjaman++ }}</td>
<td>{{ $data->peti->fix_lot }}</td> <td>{{ $data->peti->fix_lot }}</td>
@ -84,11 +85,13 @@
@endif @endif
</td> </td>
<td class="text-center"> <td class="text-center">
<a href="{{ route('dashboard.pengembalian.edit', [$data->id]) }}" title="Edit"> <a href="{{ route('dashboard.pengembalian.edit', [$data->id]) }}"
title="Edit">
<i class="fa fa-edit mr-2" style="font-size: 20px"></i> <i class="fa fa-edit mr-2" style="font-size: 20px"></i>
</a> </a>
</td> </td>
</tr> </tr>
@endif
@empty @empty
<p>Data Kosong</p> <p>Data Kosong</p>
@endforelse @endforelse

10
resources/views/dashboard/Transfer/create.blade.php

@ -28,10 +28,11 @@
<label for="date" class="col-form-label">Tanggal Transfer: <span <label for="date" class="col-form-label">Tanggal Transfer: <span
class="text-danger">*</span></label> class="text-danger">*</span></label>
<input class="form-control" name="date" type="date" id="date" value="{{ old('date') }}"> <input class="form-control" name="date" type="date" id="date" value="{{ old('date') }}"
required>
<label for="name_customer" class="col-form-label">Customer: <span class="text-danger">*</span></label> <label for="name_customer" class="col-form-label">Customer: <span class="text-danger">*</span></label>
<select class="form-control" name="name_customer" type="text" id="name_customer"> <select class="form-control" name="name_customer" type="text" id="name_customer" required>
<option disabled selected>Nama Customer akan otomatis terpilih ketika memilih detail peti.</option> <option disabled selected>Nama Customer akan otomatis terpilih ketika memilih detail peti.</option>
@foreach ($customer as $data_customer) @foreach ($customer as $data_customer)
<option value="{{ $data_customer->id }}">{{ $data_customer->name }}</option> <option value="{{ $data_customer->id }}">{{ $data_customer->name }}</option>
@ -40,15 +41,16 @@
<label for="source_warehouse" class="col-form-label">Asal Gudang: <span <label for="source_warehouse" class="col-form-label">Asal Gudang: <span
class="text-danger">*</span></label> class="text-danger">*</span></label>
<select class="form-control" name="source_warehouse" type="text" id="source_warehouse" disabled> <select class="form-control" name="source_warehouse" type="text" id="source_warehouse" required>
<option disabled selected>Asal gudang akan otomatis terpilih ketika memilih detail peti.</option> <option disabled selected>Asal gudang akan otomatis terpilih ketika memilih detail peti.</option>
@foreach ($warehouse as $data) @foreach ($warehouse as $data)
<option value="{{ $data->id }}">{{ $data->name }}</option> <option value="{{ $data->id }}">{{ $data->name }}</option>
@endforeach @endforeach
</select> </select>
<label for="destination_warehouse" class="col-form-label">Tujuan Gudang: <span <label for="destination_warehouse" class="col-form-label">Tujuan Gudang: <span
class="text-danger">*</span></label> class="text-danger">*</span></label>
<select class="form-control" name="destination_warehouse" type="text"> <select class="form-control" name="destination_warehouse" type="text" required>
<option disabled selected>Pilih Tujuan Gudang</option> <option disabled selected>Pilih Tujuan Gudang</option>
@foreach ($warehouse as $data) @foreach ($warehouse as $data)
<option value="{{ $data->id }}">{{ $data->name }}</option> <option value="{{ $data->id }}">{{ $data->name }}</option>

2
routes/web.php

@ -87,7 +87,7 @@ Route::prefix('dashboard')->name('dashboard.')->middleware(['auth'])->group(func
Route::post('disposal/store', 'store')->name('disposal.store'); Route::post('disposal/store', 'store')->name('disposal.store');
// Route::get('disposal/{id}', 'show')->name('disposal.show'); // Route::get('disposal/{id}', 'show')->name('disposal.show');
Route::get('disposal/{id}/edit', 'edit')->name('disposal.edit'); Route::get('disposal/{id}/edit', 'edit')->name('disposal.edit');
// Route::put('disposal/{id}', 'update')->name('disposal.update'); Route::put('disposal/{id}', 'update')->name('disposal.update');
Route::delete('disposal/delete/{id}', 'destroy')->name('disposal.destroy'); Route::delete('disposal/delete/{id}', 'destroy')->name('disposal.destroy');
}); });

Loading…
Cancel
Save