Gunawan19621
1 year ago
12 changed files with 336 additions and 21 deletions
@ -0,0 +1,84 @@
|
||||
<?php |
||||
|
||||
namespace App\Http\Controllers; |
||||
|
||||
use App\Models\Peti; |
||||
use App\Models\m_warehouse; |
||||
use Illuminate\Http\Request; |
||||
|
||||
class DisposalController extends Controller |
||||
{ |
||||
public function index() |
||||
{ |
||||
$data = [ |
||||
'active' => 'menu-disposal', |
||||
]; |
||||
return view('dashboard.Disposal.index', $data); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* Show the form for creating a new resource. |
||||
*/ |
||||
public function create() |
||||
{ |
||||
$data = [ |
||||
'peti' => Peti::get(), |
||||
'warehouse' => m_warehouse::get(), |
||||
'active' => 'menu-disposal', |
||||
]; |
||||
return view('dashboard.Disposal.create', $data); |
||||
} |
||||
|
||||
/** |
||||
* Store a newly created resource in storage. |
||||
*/ |
||||
public function store($request) |
||||
{ |
||||
// |
||||
} |
||||
|
||||
/** |
||||
* Display the specified resource. |
||||
*/ |
||||
public function show($id) |
||||
{ |
||||
$data = [ |
||||
'active' => 'menu-disposal', |
||||
]; |
||||
return view('dashboard.Disposal.show', $data); |
||||
} |
||||
|
||||
/** |
||||
* Show the form for editing the specified resource. |
||||
*/ |
||||
public function edit($id) |
||||
{ |
||||
$data = [ |
||||
'active' => 'menu-disposal', |
||||
]; |
||||
return view('dashboard.Disposal.edit', $data); |
||||
} |
||||
|
||||
/** |
||||
* Update the specified resource in storage. |
||||
*/ |
||||
public function update($request, $id) |
||||
{ |
||||
// |
||||
} |
||||
|
||||
/** |
||||
* 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'); |
||||
// } |
||||
} |
||||
} |
@ -0,0 +1,75 @@
|
||||
@extends('layouts.main') |
||||
@section('content') |
||||
@include('layouts.components.alert-prompt') |
||||
<div class="card shadow mb-4"> |
||||
<div class="card-header py-3"> |
||||
<div class="row"> |
||||
<div class="col-6"> |
||||
<h5 class="m-0 font-weight-bold text-primary mt-2">Disposal Peti</h5> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
<div class="card-body"> |
||||
<form action="{{ route('dashboard.transfer.store') }}" method="POST" enctype="multipart/form-data" |
||||
id="transferForm"> |
||||
@csrf |
||||
<div class="form-group"> |
||||
<label for="peti_id" class="col-form-label">Pilih Detail Peti: <span |
||||
class="text-danger">*</span></label> |
||||
<select class="form-control" name="peti_id" type="text" id="peti_id" required> |
||||
<option disabled selected>Pilih Detail Peti</option> |
||||
@foreach ($peti as $data_peti) |
||||
<option value="{{ $data_peti->id }}" data-warehouse-id="{{ $data_peti->warehouse_id }}" |
||||
data-customer-name="{{ $data_peti->customer->name }}"> |
||||
{{ $data_peti->fix_lot }} |
||||
</option> |
||||
@endforeach |
||||
</select> |
||||
|
||||
<label for="name" class="col-form-label">Customer: <span class="text-danger">*</span></label> |
||||
<input class="form-control" name="name" type="text" id="name" |
||||
placeholder="Nama Customer akan otomatis terpilih ketika memilih detail peti."> |
||||
</div> |
||||
<div class="modal-footer d-flex justify-content-center"> |
||||
<a href="{{ route('dashboard.disposal.index') }}" class="btn btn-secondary">Kembali</a> |
||||
<button type="submit" class="btn btn-primary" id="submitButton">Simpan</button> |
||||
</div> |
||||
</form> |
||||
</div> |
||||
</div> |
||||
|
||||
<!-- auto disable form pada saat sudah di simpan--> |
||||
<script> |
||||
document.getElementById('transferForm').addEventListener('submit', function() { |
||||
document.getElementById('submitButton').setAttribute('disabled', 'true'); |
||||
}); |
||||
</script> |
||||
|
||||
<!-- otomatis asal gudang dan Customer berdasarkan detail peti --> |
||||
<script> |
||||
// Mendapatkan elemen select detail peti |
||||
const petiSelect = document.getElementById('peti_id'); |
||||
|
||||
// Mendapatkan elemen select asal gudang |
||||
const exitWarehouseSelect = document.getElementById('exit_warehouse'); |
||||
|
||||
// Mendapatkan elemen input Customer |
||||
const nameInput = document.getElementById('name'); |
||||
|
||||
// Menambahkan event listener ke select detail peti |
||||
petiSelect.addEventListener('change', function() { |
||||
// Mendapatkan data-warehouse-id dari option yang dipilih |
||||
const selectedOption = this.options[this.selectedIndex]; |
||||
const warehouseId = selectedOption.getAttribute('data-warehouse-id'); |
||||
|
||||
// Mendapatkan data-customer-name dari option yang dipilih |
||||
const customerName = selectedOption.getAttribute('data-customer-name'); |
||||
|
||||
// Memilih asal gudang berdasarkan data-warehouse-id |
||||
exitWarehouseSelect.value = warehouseId; |
||||
|
||||
// Mengisi input Customer dengan nama pelanggan |
||||
nameInput.value = customerName; |
||||
}); |
||||
</script> |
||||
@endsection |
@ -0,0 +1,5 @@
|
||||
@extends('layouts.main') |
||||
@section('content') |
||||
@include('layouts.components.alert-prompt') |
||||
<p>Halaman Edit Disposal</p> |
||||
@endsection |
@ -0,0 +1,104 @@
|
||||
@extends('layouts.main') |
||||
@section('content') |
||||
<style> |
||||
.table th { |
||||
white-space: nowrap; |
||||
} |
||||
|
||||
.table td { |
||||
white-space: nowrap; |
||||
} |
||||
</style> |
||||
@include('layouts.components.alert-prompt') |
||||
<div class="card shadow mb-4"> |
||||
<div class="card-header py-3"> |
||||
<div class="row"> |
||||
<div class="col-6"> |
||||
<h5 class="m-0 font-weight-bold text-primary mt-2">Data Disposal</h5> |
||||
</div> |
||||
<div class="col-6 text-right"> |
||||
<a href="{{ route('dashboard.disposal.create') }}" class="btn btn-success btn-icon-split"> |
||||
<span class="text">Disposal Peti</span> |
||||
</a> |
||||
</a> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
<div class="card-body"> |
||||
<div class="table-responsive"> |
||||
<table class="table table-bordered" id="tablebarang" width="100%" cellspacing="0"> |
||||
<thead> |
||||
<tr> |
||||
<th class="text-center">No</th> |
||||
<th>Kode Peti</th> |
||||
<th>Nama Customer</th> |
||||
<th>Tgl Transfer</th> |
||||
<th>Asal Gudang</th> |
||||
<th>Tujuan Gudang</th> |
||||
<th class="text-center">Action</th> |
||||
</tr> |
||||
</thead> |
||||
<tbody> |
||||
<tr> |
||||
<td>1</td> |
||||
<td>kode dari Peti</td> |
||||
<td>Gunawan</td> |
||||
<td>13-11-2023</td> |
||||
<td>Gudang A</td> |
||||
<td>Gudang B</td> |
||||
<td class="text-center"> |
||||
<a href="#" title="Edit"> |
||||
<i class="fa fa-edit mr-2" style="font-size: 20px"></i> |
||||
</a> |
||||
<form action="#" 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> |
||||
{{-- @php |
||||
$no_peminjaman = 1; |
||||
@endphp |
||||
@forelse ($peminjaman as $data_peminjaman) |
||||
@if ($data_peminjaman->enter_warehouse == null) |
||||
<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> |
||||
@endif |
||||
@empty |
||||
<p>Data Kosong</p> |
||||
@endforelse --}} |
||||
</tbody> |
||||
</table> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
@endsection |
@ -0,0 +1,5 @@
|
||||
@extends('layouts.main') |
||||
@section('content') |
||||
@include('layouts.components.alert-prompt') |
||||
<p>Halaman Show Disposal</p> |
||||
@endsection |
Loading…
Reference in new issue