Gunawan19621
1 year ago
5 changed files with 310 additions and 5 deletions
@ -0,0 +1,96 @@ |
|||||||
|
<?php |
||||||
|
|
||||||
|
namespace App\Http\Controllers; |
||||||
|
|
||||||
|
use App\Http\Requests\ValidasiUpdatePengembalian; |
||||||
|
use App\Models\Peti; |
||||||
|
use App\Models\m_warehouse; |
||||||
|
use App\Models\asset_status; |
||||||
|
use Illuminate\Http\Request; |
||||||
|
use Illuminate\Support\Facades\Auth; |
||||||
|
|
||||||
|
class TransaksiKeluarMasukController extends Controller |
||||||
|
{ |
||||||
|
public function index() |
||||||
|
{ |
||||||
|
$data = [ |
||||||
|
'peminjaman' => asset_status::all(), |
||||||
|
'active' => 'menu-transaksi', |
||||||
|
]; |
||||||
|
return view('dashboard.transaksi.index', $data); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* Show the form for creating a new resource. |
||||||
|
*/ |
||||||
|
public function create() |
||||||
|
{ |
||||||
|
// |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* Store a newly created resource in storage. |
||||||
|
*/ |
||||||
|
public function store(Request $request) |
||||||
|
{ |
||||||
|
// |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* Display the specified resource. |
||||||
|
*/ |
||||||
|
public function show($id) |
||||||
|
{ |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* Show the form for editing the specified resource. |
||||||
|
*/ |
||||||
|
public function edit($id) |
||||||
|
{ |
||||||
|
$data = [ |
||||||
|
'peti' => Peti::get(), |
||||||
|
'peminjaman' => asset_status::findOrFail($id), |
||||||
|
'warehouse' => m_warehouse::get(), |
||||||
|
'active' => 'menu-pengembalian', |
||||||
|
]; |
||||||
|
return view('dashboard.Pengembalian.edit', $data); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* Update the specified resource in storage. |
||||||
|
*/ |
||||||
|
public function update(ValidasiUpdatePengembalian $request, $id) |
||||||
|
{ |
||||||
|
try { |
||||||
|
$peminjaman = asset_status::findOrFail($id); |
||||||
|
|
||||||
|
// Update atribut-atribut yang diperlukan |
||||||
|
$peminjaman->enter_pic = Auth::user()->fullname; |
||||||
|
$peminjaman->updated_by = Auth::user()->fullname; |
||||||
|
|
||||||
|
$peminjaman->peti_id = $request->input('peti_id'); |
||||||
|
$peminjaman->exit_at = $request->input('exit_at'); |
||||||
|
$peminjaman->est_pengembalian = $request->input('est_pengembalian'); |
||||||
|
$peminjaman->exit_warehouse = $request->input('exit_warehouse'); |
||||||
|
$peminjaman->enter_at = $request->input('enter_at'); |
||||||
|
$peminjaman->enter_warehouse = $request->input('enter_warehouse'); |
||||||
|
$peminjaman->kondisi_peti = $request->input('kondisi_peti'); |
||||||
|
|
||||||
|
$peminjaman->save(); |
||||||
|
|
||||||
|
return redirect()->route('dashboard.pengembalian.index')->with('success', 'Data peminjaman berhasil diperbaharui'); |
||||||
|
} catch (\Throwable $th) { |
||||||
|
// Tampilkan pesan kesalahan untuk debugging |
||||||
|
return redirect()->back()->with('error', 'Data peminjaman gagal diperbaharui: ' . $th->getMessage()); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* Remove the specified resource from storage. |
||||||
|
*/ |
||||||
|
public function destroy($id) |
||||||
|
{ |
||||||
|
// dd("oke"); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,77 @@ |
|||||||
|
@extends('layouts.main') |
||||||
|
@section('title', 'Update Data Pengembalian') |
||||||
|
@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">Update Pengembalian</h5> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
<div class="card-body"> |
||||||
|
<form action="{{ route('dashboard.pengembalian.update', [$peminjaman->id]) }}" method="POST" |
||||||
|
enctype="multipart/form-data" id="editForm"> |
||||||
|
@csrf |
||||||
|
@method('PUT') |
||||||
|
<div class="form-group"> |
||||||
|
<label for="peti_id" class="col-form-label">Pilih Detail Peti:</label> |
||||||
|
<div> |
||||||
|
<input class="form-control" hidden name="peti_id" type="text" id="peti_id" |
||||||
|
value="{{ $peminjaman->peti_id }}" readonly> |
||||||
|
<input class="form-control" value="{{ $peminjaman->peti->fix_lot }}" readonly> |
||||||
|
</div> |
||||||
|
|
||||||
|
<label for="exit_at" class="col-form-label">Tanggal Peminjaman:</label> |
||||||
|
<input class="form-control" name="exit_at" type="date" id="exit_at" |
||||||
|
value="{{ $peminjaman->exit_at }}" readonly> |
||||||
|
|
||||||
|
<label for="est_pengembalian" class="col-form-label">Estimasi Tanggal Pengembalian:</label> |
||||||
|
<input class="form-control" name="est_pengembalian" type="date" id="est_pengembalian" |
||||||
|
value="{{ $peminjaman->est_pengembalian }}" readonly> |
||||||
|
|
||||||
|
<label for="exit_warehouse" class="col-form-label">Asal Gudang :</label> |
||||||
|
<div> |
||||||
|
<input class="form-control" hidden name="exit_warehouse" type="text" id="exit_warehouse" |
||||||
|
value="{{ $peminjaman->exit_warehouse }}" readonly> |
||||||
|
<input class="form-control" value="{{ $peminjaman->warehouse->name }}" readonly> |
||||||
|
</div> |
||||||
|
|
||||||
|
<label for="enter_at" class="col-form-label">Tanggal Pengembalian: <span |
||||||
|
class="text-danger">*</span></label> |
||||||
|
<input class="form-control" name="enter_at" type="date" id="enter_at" |
||||||
|
value="{{ \Carbon\Carbon::parse($peminjaman->enter_at)->format('Y-m-d') }}" required> |
||||||
|
|
||||||
|
<label for="enter_warehouse" class="col-form-label">Tujuan Pengembalian Gudang: <span |
||||||
|
class="text-danger">*</span></label> |
||||||
|
<select class="form-control" name="enter_warehouse" type="text" id="enter_warehouse" required> |
||||||
|
<option disabled selected>Pilih Tujuan Gudang</option> |
||||||
|
@foreach ($warehouse as $data_warehouse) |
||||||
|
<option value="{{ $data_warehouse->id }}" |
||||||
|
@if ($data_warehouse->id == $peminjaman->enter_warehouse) selected |
||||||
|
@else @endif> |
||||||
|
{{ $data_warehouse->name }}</option> |
||||||
|
@endforeach |
||||||
|
</select> |
||||||
|
|
||||||
|
<label for="kondisi_peti" class="col-form-label">Kondisi Peti: <span |
||||||
|
class="text-danger">*</span></label> |
||||||
|
<input class="form-control" name="kondisi_peti" type="text" id="kondisi_peti" |
||||||
|
value="{{ old('kondisi_peti', $peminjaman->kondisi_peti) }}" placeholder="Masukan kondisi peti" |
||||||
|
pattern="[^0-9]+" oninput="this.value=this.value.replace(/[0-9]/g,'');" required> |
||||||
|
</div> |
||||||
|
<div class="modal-footer d-flex justify-content-center"> |
||||||
|
<a href="{{ route('dashboard.pengembalian.index') }}" class="btn btn-secondary">Kembali</a> |
||||||
|
<button type="submit" class="btn btn-primary" id="submitButton">Simpan</button> |
||||||
|
</div> |
||||||
|
</form> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
|
||||||
|
<script> |
||||||
|
document.getElementById('editForm').addEventListener('submit', function() { |
||||||
|
document.getElementById('submitButton').setAttribute('disabled', 'true'); |
||||||
|
}); |
||||||
|
</script> |
||||||
|
@endsection |
@ -0,0 +1,103 @@ |
|||||||
|
@extends('layouts.main') |
||||||
|
@section('content') |
||||||
|
@include('layouts.components.alert-prompt') |
||||||
|
<style> |
||||||
|
.table th { |
||||||
|
white-space: nowrap; |
||||||
|
} |
||||||
|
|
||||||
|
.table td { |
||||||
|
white-space: nowrap; |
||||||
|
} |
||||||
|
</style> |
||||||
|
@if (auth()->user()->role_id == 'D961AD96-211B-4F68-9FF2-111111111111') |
||||||
|
<div class="card shadow mb-4"> |
||||||
|
<div class="card-header py-3"> |
||||||
|
<h6 class="m-0 font-weight-bold text-primary">Data Pengembalian</h6> |
||||||
|
</div> |
||||||
|
<div class="card-body"> |
||||||
|
<div class="table-responsive"> |
||||||
|
<table class="table table-bordered" id="tablebarang" width="100%" cellspacing="0"> |
||||||
|
<thead> |
||||||
|
<tr> |
||||||
|
<th>No</th> |
||||||
|
<th>Kode Peti</th> |
||||||
|
<th>Customer</th> |
||||||
|
<th>Tgl Peinjaman</th> |
||||||
|
<th>Estimasi Pengembalian</th> |
||||||
|
<th>PJ Peminjaman</th> |
||||||
|
<th>Asal WH Peminjaman</th> |
||||||
|
<th>Tgl Pengembalian</th> |
||||||
|
<th>PJ Pengembalian</th> |
||||||
|
<th>Tujuan WH Pengembalian</th> |
||||||
|
<th>Kondisi Peti</th> |
||||||
|
<th>Status</th> |
||||||
|
<th class="text-center">Action</th> |
||||||
|
</tr> |
||||||
|
</thead> |
||||||
|
<tbody> |
||||||
|
@php |
||||||
|
$no_peminjaman = 1; |
||||||
|
@endphp |
||||||
|
@forelse ($peminjaman as $data) |
||||||
|
<tr> |
||||||
|
<td>{{ $no_peminjaman++ }}</td> |
||||||
|
<td>{{ $data->peti->fix_lot }}</td> |
||||||
|
<td>{{ $data->peti->customer->name }}</td> |
||||||
|
<td>{{ \Carbon\Carbon::parse($data->exit_at)->format('d/m/Y') }}</td> |
||||||
|
<td>{{ \Carbon\Carbon::parse($data->est_pengembalian)->format('d/m/Y') }}</td> |
||||||
|
<td>{{ $data->exit_pic }}</td> |
||||||
|
<td>{{ $data->warehouse->name }}</td> |
||||||
|
<td> |
||||||
|
@if ($data->enter_at) |
||||||
|
{{ \Carbon\Carbon::parse($data->enter_at)->format('d-m-Y') }} |
||||||
|
@else |
||||||
|
<p class="text-center font-weight-bold">-</p> |
||||||
|
@endif |
||||||
|
</td> |
||||||
|
<td> |
||||||
|
@if ($data->enter_pic) |
||||||
|
{{ $data->enter_pic }} |
||||||
|
@else |
||||||
|
<p class="text-center font-weight-bold">-</p> |
||||||
|
@endif |
||||||
|
</td> |
||||||
|
<td> |
||||||
|
@if ($data->enter_warehouse) |
||||||
|
{{ $data->warehouse->name }} |
||||||
|
@else |
||||||
|
<p class="text-center font-weight-bold">-</p> |
||||||
|
@endif |
||||||
|
</td> |
||||||
|
<td> |
||||||
|
@if ($data->kondisi_peti) |
||||||
|
{{ $data->kondisi_peti }} |
||||||
|
@else |
||||||
|
<p class="text-center font-weight-bold">-</p> |
||||||
|
@endif |
||||||
|
</td> |
||||||
|
<td> |
||||||
|
@if ($data->enter_warehouse === null) |
||||||
|
Not Return |
||||||
|
@else |
||||||
|
Return |
||||||
|
@endif |
||||||
|
</td> |
||||||
|
<td class="text-center"> |
||||||
|
<a href="{{ route('dashboard.pengembalian.edit', [$data->id]) }}" title="Edit"> |
||||||
|
<i class="fa fa-edit mr-2" style="font-size: 20px"></i> |
||||||
|
</a> |
||||||
|
</td> |
||||||
|
</tr> |
||||||
|
@empty |
||||||
|
<p>Data Kosong</p> |
||||||
|
@endforelse |
||||||
|
</tbody> |
||||||
|
</table> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
@else |
||||||
|
@include('pages.user.Pengembalian.index') |
||||||
|
@endif |
||||||
|
@endsection |
Loading…
Reference in new issue