Browse Source

update tambahan pengembalian

master
Gunawan19621 1 year ago
parent
commit
7881412e90
  1. 17
      app/Http/Controllers/PeminjamanController.php
  2. 14
      app/Http/Controllers/PengembalianController.php
  3. 6
      resources/views/dashboard/Peminjaman/index.blade.php
  4. 79
      resources/views/dashboard/Peminjaman/pengembalian.blade.php
  5. 6
      resources/views/dashboard/Pengembalian/edit.blade.php
  6. 1
      routes/web.php

17
app/Http/Controllers/PeminjamanController.php

@ -8,6 +8,7 @@ use App\Models\Peti;
use App\Models\m_warehouse; use App\Models\m_warehouse;
use App\Models\asset_status; use App\Models\asset_status;
use App\Models\Customer; use App\Models\Customer;
use App\Models\Kondisi_Peti;
use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Auth;
use Symfony\Component\Uid\Uuid; use Symfony\Component\Uid\Uuid;
@ -135,4 +136,20 @@ class PeminjamanController extends Controller
return redirect()->back()->with('error', 'Data peminjaman gagal dihapus'); return redirect()->back()->with('error', 'Data peminjaman gagal dihapus');
} }
} }
/**
* Show the form for editing the specified resource.
*/
public function pengembalian($id)
{
// dd('oke');
$data = [
'peti' => Peti::get(),
'peminjaman' => asset_status::findOrFail($id),
'warehouse' => m_warehouse::get(),
'kondisiPeti' => Kondisi_Peti::get(),
'active' => 'menu-pengembalian',
];
return view('dashboard.Peminjaman.pengembalian', $data);
}
} }

14
app/Http/Controllers/PengembalianController.php

@ -12,20 +12,6 @@ use Illuminate\Support\Facades\Auth;
class PengembalianController extends Controller class PengembalianController extends Controller
{ {
// public function index()
// {
// $pengembalian = asset_status::orderBy('created_at', 'desc')->get();
// $latestpengembalian = $pengembalian->groupBy('peti_id')->map(function ($group) {
// return $group->first();
// });
// $data = [
// 'peminjaman' => $latestpengembalian,
// 'active' => 'menu-pengembalian',
// ];
// return view('dashboard.Pengembalian.index', $data);
// }
public function index() public function index()
{ {
$pengembalian = asset_status::orderBy('created_at', 'desc')->get(); $pengembalian = asset_status::orderBy('created_at', 'desc')->get();

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

@ -55,10 +55,14 @@
<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) }}" <a href="{{ route('dashboard.peminjaman.pengembalian', $data_peminjaman->id) }}"
title="Pengembalian"> title="Pengembalian">
<i class="fa fa-reply mr-2" style="font-size: 20px"></i> <i class="fa fa-reply mr-2" style="font-size: 20px"></i>
</a> </a>
{{-- <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>

79
resources/views/dashboard/Peminjaman/pengembalian.blade.php

@ -0,0 +1,79 @@
@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">Pengembalian Peti</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->warehouse_id) selected
@else @endif>
{{ $data_warehouse->name }}</option>
@endforeach
</select>
<label for="kondisi_peti_id" class="col-form-label">Kondisi Peti: <span
class="text-danger">*</span></label>
<select class="form-control" name="kondisi_peti_id" type="text" id="kondisi_peti_id" required>
<option disabled selected>Pilih Kondisi Peti</option>
@foreach ($kondisiPeti as $data_kondisiPeti)
<option value="{{ $data_kondisiPeti->id }}">{{ $data_kondisiPeti->nama_kondisi }}</option>
@endforeach
</select>
</div>
<div class="modal-footer d-flex justify-content-center">
<a href="{{ route('dashboard.peminjaman.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

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

@ -1,5 +1,4 @@
@extends('layouts.main') @extends('layouts.main')
@section('title', 'Update Data Pengembalian')
@section('content') @section('content')
@include('layouts.components.alert-prompt') @include('layouts.components.alert-prompt')
<div class="card shadow mb-4"> <div class="card shadow mb-4">
@ -60,7 +59,10 @@
<select class="form-control" name="kondisi_peti_id" type="text" id="kondisi_peti_id" required> <select class="form-control" name="kondisi_peti_id" type="text" id="kondisi_peti_id" required>
<option disabled selected>Pilih Kondisi Peti</option> <option disabled selected>Pilih Kondisi Peti</option>
@foreach ($kondisiPeti as $data_kondisiPeti) @foreach ($kondisiPeti as $data_kondisiPeti)
<option value="{{ $data_kondisiPeti->id }}">{{ $data_kondisiPeti->nama_kondisi }}</option> <option value="{{ $data_kondisiPeti->id }}"
@if ($data_kondisiPeti->id == $peminjaman->kondisi_peti_id) selected
@else @endif>
{{ $data_kondisiPeti->nama_kondisi }}</option>
@endforeach @endforeach
</select> </select>
</div> </div>

1
routes/web.php

@ -61,6 +61,7 @@ Route::prefix('dashboard')->name('dashboard.')->middleware(['auth'])->group(func
Route::get('peminjaman/{id}/edit', 'edit')->name('peminjaman.edit'); Route::get('peminjaman/{id}/edit', 'edit')->name('peminjaman.edit');
Route::put('peminjaman/{id}', 'update')->name('peminjaman.update'); Route::put('peminjaman/{id}', 'update')->name('peminjaman.update');
Route::delete('peminjaman/delete/{id}', 'destroy')->name('peminjaman.destroy'); Route::delete('peminjaman/delete/{id}', 'destroy')->name('peminjaman.destroy');
Route::get('peminjaman/{id}/pengembalian', 'pengembalian')->name('peminjaman.pengembalian');
}); });
//Halaman Pengembalian //Halaman Pengembalian

Loading…
Cancel
Save