Browse Source

update tambahan peti

master
Gunawan19621 1 year ago
parent
commit
223c76ea4c
  1. 7
      app/Http/Controllers/PeminjamanController.php
  2. 6
      app/Http/Controllers/PengembalianController.php
  3. 7
      resources/views/dashboard/Peminjaman/create.blade.php
  4. 69
      resources/views/dashboard/Peminjaman/edit.blade.php
  5. 39
      resources/views/dashboard/Peminjaman/index.blade.php
  6. 58
      resources/views/dashboard/Pengembalian/edit.blade.php
  7. 41
      resources/views/dashboard/Pengembalian/index.blade.php

7
app/Http/Controllers/PeminjamanController.php

@ -86,7 +86,7 @@ class PeminjamanController extends Controller
public function edit($id)
{
$data = [
'asset' => m_asset::all(),
'peti' => Peti::all(),
'peminjaman' => asset_status::find($id),
'warehouse' => m_warehouse::get(),
'active' => 'menu-peminjaman',
@ -100,10 +100,11 @@ class PeminjamanController extends Controller
public function update(Request $request, $id)
{
// dd('oke');
// dd($request->all());
$request->validate([
'asset_id' => 'required',
'peti_id' => 'required',
'exit_at' => 'required',
'exit_pic' => 'required',
'est_pengembalian' => 'required',
'exit_warehouse' => 'required',
]);
// dd($request);

6
app/Http/Controllers/PengembalianController.php

@ -2,9 +2,10 @@
namespace App\Http\Controllers;
use App\Models\asset_status;
use App\Models\Peti;
use App\Models\m_asset;
use App\Models\m_warehouse;
use App\Models\asset_status;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
@ -13,7 +14,7 @@ class PengembalianController extends Controller
public function index()
{
$data = [
'peminjaman' => asset_status::get(),
'peminjaman' => asset_status::all(),
'active' => 'menu-pengembalian',
];
return view('dashboard.Pengembalian.index', $data);
@ -48,6 +49,7 @@ class PengembalianController extends Controller
public function edit($id)
{
$data = [
'peti' => Peti::get(),
'peminjaman' => asset_status::findOrFail($id),
'warehouse' => m_warehouse::get(),
'active' => 'menu-pengembalian',

7
resources/views/dashboard/Peminjaman/create.blade.php

@ -13,13 +13,6 @@
<form action="{{ route('dashboard.peminjaman.store') }}" method="POST" enctype="multipart/form-data">
@csrf
<div class="form-group">
{{-- <label for="peti_id" class="col-form-label">Pilih Detail Peti:</label>
<select class="form-control" name="peti_id" type="text" id="peti_id">
<option disabled selected>Pilih Detail Peti</option>
@foreach ($peti as $data_peti)
<option value="{{ $data_peti->id }}">{{ $data_peti->fix_lot }}</option>
@endforeach
</select> --}}
<label for="peti_id" class="col-form-label">Pilih Detail Peti:</label>
<select class="form-control" name="peti_id" type="text" id="peti_id">
<option disabled selected>Pilih Detail Peti</option>

69
resources/views/dashboard/Peminjaman/edit.blade.php

@ -15,34 +15,39 @@
@csrf
@method('PUT')
<div class="form-group">
<label for="asset_id" class="col-form-label">Nama Asset:</label>
<select class="form-control" name="asset_id" type="text" id="asset_id">
<option disabled selected>Pilih Nama Asset</option>
@foreach ($asset as $data_asset)
<option value="{{ $data_asset->id }}"
@if ($data_asset->id == $peminjaman->id) selected
@else @endif>
{{ $data_asset->name }}</option>
<label for="peti_id" class="col-form-label">Pilih Detail Peti:</label>
<select class="form-control" name="peti_id" id="peti_id">
<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_peti->id == $peminjaman->peti_id ? 'selected' : '' }}>
{{ $data_peti->fix_lot }}
</option>
@endforeach
</select>
<label for="exit_at" class="col-form-label">Tanggal:</label>
</div>
<div class="form-group">
<label for="exit_at" class="col-form-label">Tanggal Peminjaman:</label>
<input class="form-control" name="exit_at" type="date" id="exit_at"
value="{{ \Carbon\Carbon::parse($peminjaman->exit_at)->format('Y-m-d') }}"
placeholder="Masukan Tanggal Keluar" required>
value="{{ $peminjaman->exit_at }}" required>
</div>
<label for="exit_pic" class="col-form-label">PJ Keluar:</label>
<input class="form-control" name="exit_pic" type="text" id="exit_pic"
value="{{ $peminjaman->exit_pic }}" placeholder="Masukan Nama PJ Keluar" pattern="[^0-9]+"
oninput="this.value=this.value.replace(/[0-9]/g,'');" required>
<div class="form-group">
<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 }}" required>
</div>
<label for="exit_warehouse" class="col-form-label">Asal Gudang :</label>
<select class="form-control" name="exit_warehouse" type="text" id="exit_warehouse">
<option disabled selected>Pilih Nama Asset</option>
@foreach ($warehouse as $data_warehouse)
<option value="{{ $data_warehouse->id }}"
@if ($data_warehouse->id == $peminjaman->id) selected
@else @endif>
{{ $data_warehouse->name }}</option>
<div class="form-group">
<label for="exit_warehouse" class="col-form-label">Asal Gudang:</label>
<select class="form-control" name="exit_warehouse" id="exit_warehouse">
<option disabled selected>Pilih Asal Gudang</option>
@foreach ($warehouse as $data)
<option value="{{ $data->id }}"
{{ $data->id == $peminjaman->exit_warehouse ? 'selected' : '' }}>
{{ $data->name }}
</option>
@endforeach
</select>
</div>
@ -53,4 +58,22 @@
</form>
</div>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
const petiSelect = document.getElementById('peti_id');
const exitWarehouseSelect = document.getElementById('exit_warehouse');
// Saat pilihan Detail Peti berubah
petiSelect.addEventListener('change', function() {
const selectedOption = petiSelect.options[petiSelect.selectedIndex];
const warehouseId = selectedOption.getAttribute('data-warehouse-id');
// Atur indeks pilihan Asal Gudang sesuai dengan data peti yang dipilih
if (warehouseId) {
exitWarehouseSelect.selectedIndex = [...exitWarehouseSelect.options].findIndex(option =>
option.value === warehouseId);
}
});
});
</script>
@endsection

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

@ -24,7 +24,7 @@
<th>Kode Peti</th>
<th>Nama Customer</th>
<th>Tgl Peminjaman</th>
<th>PJ Keluar</th>
<th>PJ Peminjaman</th>
<th>Asal Gudang</th>
<th class="text-center">Action</th>
</tr>
@ -35,29 +35,19 @@
@endphp
@forelse ($peminjaman as $data_peminjaman)
<tr>
<td>{{ $no_peminjaman++ }}</td>
<td class="text-center">{{ $no_peminjaman++ }}</td>
<td>{{ $data_peminjaman->peti->customer->code_customer }} -
{{ $data_peminjaman->peti->tipe_peti->type }}</td>
<td>{{ $data_peminjaman->peti->customer->name }}</td>
<td>{{ $data_peminjaman->exit_at }}</td>
</tr>
@empty
<p>Data Kosong</p>
@endforelse
{{--
@foreach ($peminjaman as $data)
<tr>
<td class="text-center">{{ $no_peminjaman++ }}</td>
<td>{{ $data->asset->name }}</td>
<td>{{ \Carbon\Carbon::parse($data->exit_at)->format('d-m-Y') }}</td>
<td>{{ $data->exit_pic }}</td>
<td>{{ $data->warehouse->name }}</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->id) }}" title="Edit">
<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->id) }}" method="POST"
style="display: inline;">
<form action="{{ route('dashboard.peminjaman.destroy', $data_peminjaman->id) }}"
method="POST" style="display: inline;">
@csrf
@method('DELETE')
<button type="submit"
@ -68,6 +58,19 @@
</form>
</td>
</tr>
@empty
<p>Data Kosong</p>
@endforelse
{{--
@foreach ($peminjaman as $data)
<tr>
<td class="text-center">{{ $no_peminjaman++ }}</td>
<td>{{ $data->asset->name }}</td>
<td>{{ \Carbon\Carbon::parse($data->exit_at)->format('d-m-Y') }}</td>
<td>{{ $data->exit_pic }}</td>
<td>{{ $data->warehouse->name }}</td>
</tr>
@endforeach --}}
</tbody>
</table>

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

@ -1,18 +1,46 @@
@extends('layouts.main')
@section('title', 'Update Data Pengembalian')
@section('content')
<div class="card m-3">
<div class="card-body m-2">
<h3>Data Pengembalian</h3>
<hr class="border">
<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">
@csrf
@method('PUT')
<div class="form-group">
<!-- Input tersembunyi untuk menyimpan ID aset -->
<input type="hidden" name="asset_id" value="{{ $peminjaman->asset_id }}">
<label for="peti_id" class="col-form-label">Pilih Detail Peti:</label>
<select class="form-control" name="peti_id" type="text" id="peti_id">
<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_peti->fix_lot }}
</option>
@endforeach
</select>
<label for="exit_at" class="col-form-label">Tanggal Peminjaman:</label>
<input class="form-control" name="exit_at" type="date" id="exit_at" value="{{ old('exit_at') }}"
placeholder="Masukan Tanggal Peminjaman" required>
<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="{{ old('est_pengembalian') }}" placeholder="Masukan Estimasi Tanggal Peminjaman" required>
<label for="exit_warehouse" class="col-form-label">Asal Gudang :</label>
<select class="form-control" name="exit_warehouse" type="text" id="exit_warehouse">
<option disabled selected>Pilih Asal Gudang</option>
@foreach ($warehouse as $data)
<option value="{{ $data->id }}">{{ $data->name }}</option>
@endforeach
</select>
</div>
{{--
<!-- Elemen input readonly untuk menampilkan nama aset -->
<label for="asset_name" class="col-form-label">Nama Asset:</label>
<input class="form-control" name="asset_name" type="text" id="asset_name"
@ -28,20 +56,9 @@
value="{{ $peminjaman->exit_pic }}" placeholder="Masukan Nama PJ Keluar" readonly required>
<label for="exit_warehouse" class="col-form-label">Asal Gudang :</label>
{{-- <select class="form-control" name="enter_warehouse" id="enter_warehouse" required>
<option disabled selected>Pilih Nama Asset</option>
@foreach ($warehouse as $data_warehouse)
<option value="{{ $data_warehouse->id }}"
{{ $data_warehouse->id == $peminjaman->enter_warehouse ? 'selected' : '' }}>
{{ $data_warehouse->name }}
</option>
@endforeach
</select> --}}
<input type="hidden" name="exit_warehouse" id="exit_warehouse"
value="{{ $peminjaman->exit_warehouse }}">
<input class="form-control" type="text" value="{{ $peminjaman->warehouse->name }}" readonly required>
{{-- <input class="form-control" name="exit_warehouse" type="text" id="exit_warehouse"
value="{{ $peminjaman->warehouse->id }}" placeholder="Masukan Nama PJ Keluar" readonly required> --}}
<label for="enter_at" class="col-form-label">Tanggal Pengembalian:</label>
<input class="form-control" name="enter_at" type="date" id="enter_at"
@ -63,10 +80,9 @@
{{ $data_warehouse->name }}</option>
@endforeach
</select>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary"
onclick="window.location.href = '{{ route('dashboard.pengembalian.index') }}'">Kembali</button>
</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">Simpan</button>
</div>
</form>

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

@ -1,8 +1,15 @@
@extends('layouts.main')
@section('title', 'Pengembalian')
@section('content')
<style>
.table th {
white-space: nowrap;
}
.table td {
white-space: nowrap;
}
</style>
<div class="container-fluid">
<!-- <h1 class="h3 mb-2 text-gray-800">Tabel Pengembalian</h1> -->
<div class="card shadow mb-4">
<div class="card-header py-3">
<h6 class="m-0 font-weight-bold text-primary">Data Pengembalian</h6>
@ -13,13 +20,14 @@
<thead>
<tr>
<th>No</th>
<th>Nama Asset</th>
<th>Kode Peti</th>
<th>Tgl Peinjaman</th>
<th>PJ Peinjaman</th>
<th>Asal Gudang</th>
<th>PJ Peminjaman</th>
<th>Asal WH Peminjaman</th>
<th>Tgl Pengembalian</th>
<th>PJ Pengembalian</th>
<th>Tujuan Gudang</th>
<th>Tujuan WH Pengembalian</th>
<th>Kondisi Peti</th>
<th>Status</th>
<th class="text-center">Action</th>
</tr>
@ -28,11 +36,15 @@
@php
$no_peminjaman = 1;
@endphp
@foreach ($peminjaman as $data)
{{-- @foreach ($peminjaman as $data)
@endforeach --}}
@forelse ($peminjaman as $data)
<tr>
<td>{{ $no_peminjaman++ }}</td>
<td>{{ $data->asset->name }}</td>
<td>{{ \Carbon\Carbon::parse($data->exit_at)->format('d-m-Y') }}</td>
<td>{{ $data->peti->customer->code_customer }} -
{{ $data->peti->tipe_peti->type }}</td>
<td>{{ \Carbon\Carbon::parse($data->exit_at)->format('d/m/Y') }}</td>
<td>{{ $data->exit_pic }}</td>
<td>{{ $data->warehouse->name }}</td>
<td>
@ -56,6 +68,13 @@
<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
@ -69,7 +88,9 @@
</a>
</td>
</tr>
@endforeach
@empty
<p>Data Kosong</p>
@endforelse
</tbody>
</table>
</div>

Loading…
Cancel
Save