Gunawan19621 1 year ago
parent
commit
68479ef6b9
  1. 96
      app/Http/Controllers/TransaksiKeluarMasukController.php
  2. 77
      resources/views/dashboard/Transaksi/edit.blade.php
  3. 103
      resources/views/dashboard/Transaksi/index.blade.php
  4. 28
      resources/views/layouts/sidebar.blade.php
  5. 11
      routes/web.php

96
app/Http/Controllers/TransaksiKeluarMasukController.php

@ -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");
}
}

77
resources/views/dashboard/Transaksi/edit.blade.php

@ -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

103
resources/views/dashboard/Transaksi/index.blade.php

@ -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

28
resources/views/layouts/sidebar.blade.php

@ -22,20 +22,21 @@
</li> </li>
<!-- Divider --> <!-- Divider -->
<hr class="sidebar-divider"> <hr class="sidebar-divider">
<li class="nav-item {{ $active == 'menu-peminjaman' ? 'active' : '' }}"> <li class="nav-item {{ $active == 'menu-transaksi' ? 'active' : '' }}">
<a class="nav-link" href="{{ route('dashboard.peminjaman.index') }}"> <a class="nav-link" href="{{ route('dashboard.transaksikeluamasuk.index') }}">
<i class="fas fa-fw fa-upload"></i> <i class="fas fa-fw fa-upload"></i>
<span>Peminjaman</span> <span>Transaksi</span>
</a> </a>
</li> </li>
<li class="nav-item {{ $active == 'menu-pengembalian' ? 'active' : '' }}"> <!-- <li class="nav-item {{ $active == 'menu-pengembalian' ? 'active' : '' }}">
<a class="nav-link" href="{{ route('dashboard.pengembalian.index') }}"> <a class="nav-link" href="{{ route('dashboard.pengembalian.index') }}">
<i class="fas fa-fw fa-download"></i> <i class="fas fa-fw fa-download"></i>
<span>Pengembalian</span> <span>Pengembalian</span>
</a> </a>
</li> </li> -->
<li class="nav-item {{ $active == 'menu-transfer' ? 'active' : '' }}"> <li class="nav-item {{ $active == 'menu-transfer' ? 'active' : '' }}">
<a class="nav-link" href="{{ route('dashboard.transfer.index') }}"> <a class="nav-link" href="{{ route('dashboard.transfer.index') }}">
<i class="fas fa-fw fa-exchange-alt"></i> <i class="fas fa-fw fa-exchange-alt"></i>
@ -49,6 +50,23 @@
</a> </a>
</li> </li>
<li class="nav-item">
<a class="nav-link collapsed" href="#" data-toggle="collapse" data-target="#collapseTwo"
aria-controls="collapseTwo">
<i class="fas fa-fw fa-user"></i>
<span>History</span>
</a>
<div id="collapseTwo" class="collapse" aria-labelledby="headingTwo" data-parent="#accordionSidebar">
<div class="bg-white py-2 collapse-inner rounded">
<a class="collapse-item {{ $active == 'menu-user' ? 'active' : '' }}"
href="{{ route('dashboard.peminjaman.index') }}">Peminjaman</a>
<a class="collapse-item {{ $active == 'menu-role' ? 'active' : '' }}"
href="{{ route('dashboard.pengembalian.index') }}">Pengembalian</a>
</div>
</div>
</li>
<!-- Divider --> <!-- Divider -->
<hr class="sidebar-divider"> <hr class="sidebar-divider">

11
routes/web.php

@ -14,6 +14,7 @@ use App\Http\Controllers\WarehouseController;
use App\Http\Controllers\PeminjamanController; use App\Http\Controllers\PeminjamanController;
use App\Http\Controllers\KondisiPetiController; use App\Http\Controllers\KondisiPetiController;
use App\Http\Controllers\PengembalianController; use App\Http\Controllers\PengembalianController;
use App\Http\Controllers\TransaksiKeluarMasukController;
use App\Http\Controllers\PetternLotPetiController; use App\Http\Controllers\PetternLotPetiController;
/* /*
@ -70,6 +71,16 @@ Route::prefix('dashboard')->name('dashboard.')->middleware(['auth'])->group(func
Route::delete('pengembalian/delete/{id}', 'destroy')->name('pengembalian.destroy'); Route::delete('pengembalian/delete/{id}', 'destroy')->name('pengembalian.destroy');
}); });
Route::controller(TransaksiKeluarMasukController::class)->group(function() {
Route::get('transaksikeluamasuk', 'index')->name('transaksikeluamasuk.index');
Route::get('transaksikeluamasuk/create', 'create')->name('transaksikeluamasuk.create');
Route::post('transaksikeluamasuk/store', 'store')->name('transaksikeluamasuk.store');
Route::get('transaksikeluamasuk/{id}', 'show')->name('transaksikeluamasuk.show');
Route::get('transaksikeluamasuk/{id}/edit', 'edit')->name('transaksikeluamasuk.edit');
Route::put('transaksikeluamasuk/{id}', 'update')->name('transaksikeluamasuk.update');
Route::delete('transaksikeluamasuk/delete/{id}', 'destroy')->name('transaksikeluamasuk.destroy');
});
//Halaman Transfer //Halaman Transfer
Route::controller(TransferController::class)->group(function () { Route::controller(TransferController::class)->group(function () {
Route::get('transfer', 'index')->name('transfer.index'); Route::get('transfer', 'index')->name('transfer.index');

Loading…
Cancel
Save