✨(pembayaran): Implementasi fitur pengembalian lebih bayar
- Menambahkan method editLebih() di PembayaranController untuk menampilkan form pengembalian lebih bayar
- Menambahkan logika pengembalian lebih bayar di method store() dengan validasi type 'lebih_bayar'
- Menambahkan penyimpanan bukti KSL lebih bayar dengan upload file ke storage
- Menambahkan update bukti KSL ke tabel noc untuk pengembalian lebih bayar
- Menambahkan filter bukti_ksl_lebih_bayar null pada query dataForDatatablesLebih untuk menampilkan data yang belum diproses
- Menambahkan validasi file upload untuk bukti_ksl_lebih_bayar dengan format pdf,jpg,jpeg,png maksimal 2MB
- Menambahkan view form-lebih.blade.php dengan tampilan detail pembayaran dan form pengembalian
- Menambahkan validasi JavaScript untuk memastikan format dan ukuran file yang diupload
- Menambahkan route pembayaran/{pembayaran}/lebih untuk mengakses form pengembalian lebih bayar
- Mengubah link action di lebih.blade.php dari edit ke lebih untuk mengarahkan ke form pengembalian
- Menambahkan redirect ke pembayaran.lebih.index setelah berhasil menyimpan pengembalian
- Menambahkan field catatan opsional untuk memberikan keterangan tambahan pada proses pengembalian
- Menambahkan validasi client-side untuk memastikan file yang diupload sesuai format dan ukuran
- Menambahkan informasi detail pembayaran yang komprehensif di form pengembalian
- Menambahkan styling yang konsisten dengan form kurang bayar untuk user experience yang baik
This commit is contained in:
@@ -123,6 +123,13 @@ class PembayaranController extends Controller
|
||||
$persetujuanPenawaran = PersetujuanPenawaran::where('permohonan_id', $permohonan->id)->first();
|
||||
return view('lpj::pembayaran.form-kurang', compact('noc','permohonan','persetujuanPenawaran'));
|
||||
}
|
||||
|
||||
public function editLebih($id){
|
||||
$noc = Noc::find($id);
|
||||
$permohonan = Permohonan::find($noc->permohonan_id);
|
||||
$persetujuanPenawaran = PersetujuanPenawaran::where('permohonan_id', $permohonan->id)->first();
|
||||
return view('lpj::pembayaran.form-lebih', compact('noc','permohonan','persetujuanPenawaran'));
|
||||
}
|
||||
public function store(PersetujuanPenawaranRequest $request)
|
||||
{
|
||||
if($req['type'] == 'kurang_bayar'){
|
||||
@@ -141,6 +148,19 @@ class PembayaranController extends Controller
|
||||
return redirect()
|
||||
->route('pembayaran.kurang.index')->with('success', 'Pelunasan Kurang Bayar berhasil disimpan.');
|
||||
}
|
||||
|
||||
if($req['type'] == 'lebih_bayar'){
|
||||
$noc = Noc::find($req['noc_id']);
|
||||
if (request()->hasFile('bukti_ksl_lebih_bayar')) {
|
||||
$folderPath = 'persetujuan_penawaran/bukti_ksl_lebih_bayar/' . $req['noc_id'];
|
||||
$noc->bukti_ksl_lebih_bayar = $request->file('bukti_ksl_lebih_bayar')->store($folderPath, 'public');
|
||||
}
|
||||
$noc->save();
|
||||
|
||||
return redirect()
|
||||
->route('pembayaran.lebih.index')->with('success', 'Pengembalian Lebih Bayar berhasil disimpan.');
|
||||
}
|
||||
|
||||
$validated = $request->validated();
|
||||
$validated['created_by'] = Auth::id();
|
||||
$validated['status'] = '0';
|
||||
@@ -438,7 +458,8 @@ class PembayaranController extends Controller
|
||||
}
|
||||
|
||||
$query = Noc::query()->where(function ($query) {
|
||||
$query->where(['status_lebih_bayar' => '1']);
|
||||
$query->where(['status_lebih_bayar' => '1'])
|
||||
->where('bukti_ksl_lebih_bayar',null);
|
||||
});
|
||||
|
||||
// Sorting berdasarkan sortField dan sortOrder
|
||||
|
||||
141
resources/views/pembayaran/form-lebih.blade.php
Normal file
141
resources/views/pembayaran/form-lebih.blade.php
Normal file
@@ -0,0 +1,141 @@
|
||||
@extends('layouts.main')
|
||||
|
||||
@section('breadcrumbs')
|
||||
{{ Breadcrumbs::render('pembayaran') }}
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<div class="grid gap-5 mx-auto w-full lg:gap-7.5">
|
||||
<div class="pb-2.5 border card border-agi-100">
|
||||
<div class="card-header bg-agi-50" id="basic_settings">
|
||||
<div class="flex flex-row gap-1.5 card-title">
|
||||
Form Pembayaran Lebih Bayar
|
||||
</div>
|
||||
<div class="flex gap-2 items-center">
|
||||
<a href="{{ route('pembayaran.lebih.index') }}" class="btn btn-xs btn-info"><i
|
||||
class="ki-filled ki-exit-left"></i> Back</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<!-- Detail Informasi -->
|
||||
<div class="p-4 mb-6 bg-gray-50 rounded-lg">
|
||||
<h4 class="mb-4 text-lg font-semibold text-gray-800">Detail Pembayaran</h4>
|
||||
<div class="grid grid-cols-1 gap-4 md:grid-cols-2">
|
||||
<div>
|
||||
<label class="text-sm font-medium text-gray-600">Nomor Registrasi:</label>
|
||||
<p class="text-sm font-bold text-gray-800">{{ $noc->permohonan->nomor_registrasi ?? '-' }}</p>
|
||||
</div>
|
||||
<div>
|
||||
<label class="text-sm font-medium text-gray-600">Nomor Tiket:</label>
|
||||
<p class="text-sm font-bold text-gray-800">{{ $noc->nomor_tiket ?? '-' }}</p>
|
||||
</div>
|
||||
<div>
|
||||
<label class="text-sm font-medium text-gray-600">Tanggal Permohonan:</label>
|
||||
<p class="text-sm font-bold text-gray-800">{{ $noc->permohonan->tanggal_permohonan ?? '-' }}</p>
|
||||
</div>
|
||||
<div>
|
||||
<label class="text-sm font-medium text-gray-600">User Pemohon:</label>
|
||||
<p class="text-sm font-bold text-gray-800">{{ $noc->permohonan->user->name ?? '-' }}</p>
|
||||
</div>
|
||||
<div>
|
||||
<label class="text-sm font-medium text-gray-600">Cabang Pemohon:</label>
|
||||
<p class="text-sm font-bold text-gray-800">
|
||||
@if ($noc->permohonan->branch ?? null)
|
||||
{{ $noc->permohonan->branch->code }} - {{ $noc->permohonan->branch->name }}
|
||||
@else
|
||||
-
|
||||
@endif
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
<label class="text-sm font-medium text-gray-600">Debitur:</label>
|
||||
<p class="text-sm font-bold text-gray-800">{{ $noc->permohonan->debiture->name ?? '-' }}</p>
|
||||
</div>
|
||||
<div>
|
||||
<label class="text-sm font-medium text-gray-600">Status Bayar:</label>
|
||||
<p class="text-sm font-bold text-green-600 uppercase">Lebih Bayar</p>
|
||||
</div>
|
||||
<div>
|
||||
<label class="text-sm font-medium text-gray-600">Nominal Lebih Bayar:</label>
|
||||
<p class="text-sm font-bold text-green-600">
|
||||
{{ formatRupiah($noc->nominal_lebih_bayar ?? 0, 2) }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<form action="{{ route('pembayaran.store') }}" method="POST" class="grid gap-5"
|
||||
enctype="multipart/form-data">
|
||||
@csrf
|
||||
<input type="hidden" name="noc_id" value="{{ $noc->id ?? '' }}">
|
||||
<input type="hidden" name="type" value="lebih_bayar">
|
||||
|
||||
<div class="flex flex-wrap gap-2.5 items-baseline lg:flex-nowrap">
|
||||
<label class="form-label max-w-56">
|
||||
Bukti KSL Lebih Bayar <span class="text-red-500">*</span>
|
||||
</label>
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
<input type="file" name="bukti_ksl_lebih_bayar" id="bukti_ksl_lebih_bayar"
|
||||
class="file-input w-full @error('bukti_ksl_lebih_bayar') border-danger bg-danger-light @enderror"
|
||||
accept=".pdf,.jpg,.jpeg,.png" required>
|
||||
@error('bukti_ksl_lebih_bayar')
|
||||
<em class="text-sm alert text-danger">{{ $message }}</em>
|
||||
@enderror
|
||||
<small class="mt-1 text-xs text-gray-500">
|
||||
Format yang diizinkan: PDF, JPG, JPEG, PNG (Max: 2MB)
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-wrap gap-2.5 items-baseline lg:flex-nowrap">
|
||||
<label class="form-label max-w-56">
|
||||
Catatan
|
||||
</label>
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
<textarea name="catatan" id="catatan" rows="4"
|
||||
class="textarea w-full @error('catatan') border-danger bg-danger-light @enderror"
|
||||
placeholder="Masukkan catatan (opsional)">{{ old('catatan') }}</textarea>
|
||||
@error('catatan')
|
||||
<em class="text-sm alert text-danger">{{ $message }}</em>
|
||||
@enderror
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex gap-2 justify-end">
|
||||
<a href="{{ route('pembayaran.lebih.index') }}" class="btn btn-secondary">
|
||||
Batal
|
||||
</a>
|
||||
<button type="submit" class="btn btn-primary">
|
||||
<i class="ki-filled ki-check"></i>
|
||||
Proses Pengembalian
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
<script>
|
||||
// Validasi file upload
|
||||
document.getElementById('bukti_ksl_lebih_bayar').addEventListener('change', function() {
|
||||
const file = this.files[0];
|
||||
if (file) {
|
||||
// Validasi ukuran file (max 2MB)
|
||||
if (file.size > 2 * 1024 * 1024) {
|
||||
alert('Ukuran file tidak boleh lebih dari 2MB');
|
||||
this.value = '';
|
||||
return;
|
||||
}
|
||||
|
||||
// Validasi tipe file
|
||||
const allowedTypes = ['application/pdf', 'image/jpeg', 'image/jpg', 'image/png'];
|
||||
if (!allowedTypes.includes(file.type)) {
|
||||
alert('Format file tidak didukung. Gunakan PDF, JPG, JPEG, atau PNG');
|
||||
this.value = '';
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
@@ -222,7 +222,7 @@
|
||||
title: 'Status',
|
||||
render: (item, data) => {
|
||||
return `<div class="flex gap-2 justify-center">
|
||||
<a class="btn btn-icon btn-clear btn-warning" href="pembayaran/${data.id}/edit" title="Lakukan Pembayaran">
|
||||
<a class="btn btn-icon btn-clear btn-warning" href="pembayaran/${data.id}/lebih" title="Lakukan Pembayaran">
|
||||
<i class="ki-outline ki-credit-cart"></i>
|
||||
</a>
|
||||
</div>`;
|
||||
|
||||
@@ -140,6 +140,8 @@ Route::middleware(['auth'])->group(function () {
|
||||
Route::get('/pembayaran/datatables-lebih','dataForDatatablesLebih')->name('pembayaran.lebih.datatables');
|
||||
|
||||
Route::get('/pembayaran/{pembayaran}/kurang', 'editKurang')->name('pembayaran.kurang');
|
||||
Route::get('/pembayaran/{pembayaran}/lebih', 'editLebih')->name('pembayaran.lebih');
|
||||
|
||||
Route::put('/pembayaran/{pembayaran}', 'update')->name('pembayaran.update');
|
||||
|
||||
Route::get('/pembayaran/approval', 'approval')->name('pembayaran.approval.index');
|
||||
|
||||
Reference in New Issue
Block a user