Merge branch 'staging' of https://git.putrakuningan.com/daengdeni/lpj into tender

This commit is contained in:
2025-03-06 11:59:56 +07:00
14 changed files with 167 additions and 75 deletions

View File

@@ -4,6 +4,7 @@
use App\Http\Controllers\Controller;
use Exception;
use Illuminate\Http\Request;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\DB;
@@ -572,4 +573,40 @@
$combinedLegalitas = array_merge($existingLegalitas, $newLegalitas);
return response()->json($combinedLegalitas);
}
public function clearDetail(Request $request)
{
try {
DB::beginTransaction();
$detailId = $request->input('detail_id');
$detail = DetailDokumenJaminan::findOrFail($detailId);
// Delete associated files
if ($detail->dokumen_jaminan) {
$dokumen_jaminan = is_array(json_decode($detail->dokumen_jaminan))
? json_decode($detail->dokumen_jaminan)
: [$detail->dokumen_jaminan];
foreach ($dokumen_jaminan as $dokumen) {
if (Storage::exists($dokumen)) {
Storage::delete($dokumen);
}
}
}
// Delete the detail record
$detail->delete();
DB::commit();
return response()->json(['success' => true, 'message' => 'Detail berhasil dihapus']);
} catch (\Exception $e) {
DB::rollBack();
return response()->json([
'success' => false,
'message' => 'Gagal menghapus detail: ' . $e->getMessage()
], 500);
}
}
}

View File

@@ -10,6 +10,7 @@ use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Validator;
use Maatwebsite\Excel\Facades\Excel;
use Modules\Lpj\Http\Requests\PersetujuanPenawaranRequest;
use Modules\Lpj\Models\LaporanExternal;
use Modules\Lpj\Models\PenawaranTender;
use Modules\Lpj\Models\Permohonan;
use Modules\Lpj\Models\PersetujuanPenawaran;
@@ -235,6 +236,13 @@ class PembayaranController extends Controller
'updated_by' => Auth::id(),
'updated_at' => now(),
]);
LaporanExternal::create([
'permohonan_id' => $permohonan->id,
'nomor_laporan' => $permohonan->nomor_registrasi,
'tanggal_laporan' => now(),
'created_by' => Auth::id(),
]);
}
}

View File

@@ -153,7 +153,6 @@ class RegistrasiController extends Controller
if ($tindakan == 0) {
$dataku['jenis_penilaian_id'] = $request->jenis_penilaian;
$dataku['region_id'] = $request->region;
$dataku['sla'] = $request->sla;
$dataku['status'] = 'registered';
if ($request->catatan2) {
$dataku['registrasi_catatan'] = $request->catatan2;
@@ -209,11 +208,7 @@ class RegistrasiController extends Controller
if (1 == $jenis_penilaian) {
$validateIt['region'] = ['required'];
$messageIt ['region.required'] = 'Silahkan pilih Region';
} else {
$validateIt['sla'] = ['required'];
$messageIt ['sla.required'] = 'Silahkan isi SLA';
}
} elseif ($tindakan == 1) {
$validateIt['catatan'] = ['required'];
$messageIt ['catatan.required'] = 'Silahkan isi Catatan';

View File

@@ -3256,6 +3256,8 @@ class SurveyorController extends Controller
private function getUnitData($data, $request): array
{
$luas_unit_key = ($data['luas_unit'] ?? null) === 'sesuai' ? 'sesuai' : 'tidak sesuai';
$luas_unit = [];
@@ -3264,11 +3266,11 @@ class SurveyorController extends Controller
: ($data['luas_unit_tidak_sesuai'] ?? null);
// Masukkan key baru yang sesuai
$luas_luas_unit[$luas_luas_unit_key] = preg_replace('/[^0-9.,]/', '', $hasil_luas_unit);
$luas_unit[$luas_unit_key] = preg_replace('/[^0-9.,]/', '', $hasil_luas_unit);
return [
'action' => $data['action'] ?? null,
'luas_unit' => $luas_luas_unit,
'luas_unit' => $luas_unit,
'kondisi_unit' => $data['kondisi_unit'] ?? null,
'posisi_unit' => $data['posisi_unit'] ?? null,
'lantai' => $data['lantai'] ?? null,

View File

@@ -16,16 +16,16 @@ use Illuminate\Support\Facades\Schema;
$table->id();
$table->foreignIdFor(Permohonan::class)->constrained('permohonan')->onDelete('cascade');
$table->string('nomor_laporan');
$table->date('tgl_final_laporan');
$table->decimal('nilai_pasar', 15, 2);
$table->decimal('indikasi_nilai_likuidasi', 15, 2);
$table->decimal('indikasi_nilai_pasar_tanah', 15, 2);
$table->decimal('estimasi_harga_tanah', 15, 2);
$table->decimal('estimasi_harga_bangunan', 15, 2);
$table->decimal('indikasi_nilai_pasar_bangunan', 15, 2);
$table->decimal('indikasi_nilai_pasar_sarana_pelengkap', 15, 2);
$table->decimal('indikasi_nilai_pasar_mesin', 15, 2);
$table->decimal('indikasi_nilai_pasar_kendaraan_alat_berat', 15, 2);
$table->date('tgl_final_laporan')->nullable();
$table->decimal('nilai_pasar', 15, 2)->nullable();
$table->decimal('indikasi_nilai_likuidasi', 15, 2)->nullable();
$table->decimal('indikasi_nilai_pasar_tanah', 15, 2)->nullable();
$table->decimal('estimasi_harga_tanah', 15, 2)->nullable();
$table->decimal('estimasi_harga_bangunan', 15, 2)->nullable();
$table->decimal('indikasi_nilai_pasar_bangunan', 15, 2)->nullable();
$table->decimal('indikasi_nilai_pasar_sarana_pelengkap', 15, 2)->nullable();
$table->decimal('indikasi_nilai_pasar_mesin', 15, 2)->nullable();
$table->decimal('indikasi_nilai_pasar_kendaraan_alat_berat', 15, 2)->nullable();
$table->string('file_resume')->nullable(); // New field for resume file
$table->string('file_laporan')->nullable(); // New field for report file
$table->timestamps();

View File

@@ -258,12 +258,7 @@
Alamat Jaminan:
</h3>
<span class="text-2sm text-gray-700">
{{ $dokumen->pemilik->address ?? '' }},
<br> {{ $dokumen->pemilik->village->name ?? '' }},
{{ $dokumen->pemilik->district->name ?? '' }},
{{ $dokumen->pemilik->city->name ?? '' }},
{{ $dokumen->pemilik->province->name ?? '' }} -
{{ $dokumen->pemilik->village->postal_code ?? '' }}
{{ formatAlamat($dokumen) }}
</span>
</div>
</div>

View File

@@ -262,7 +262,16 @@
<label class="form-label max-w-56 font-bold">
{{ $n + 1 }}. {{ $detail->jenisLegalitasJaminan->name }}
</label>
<input type="hidden" name="jenis_legalitas_jaminan_id[]" value=" {{ $detail->jenis_legalitas_jaminan_id }}">
<input type="hidden" name="jenis_legalitas_jaminan_id[]" value="{{ $detail->jenis_legalitas_jaminan_id }}">
<button type="button" class="btn btn-danger btn-sm" onclick="clearDetail({{ $detail->id }})">
<i class="ki-duotone ki-trash-square fs-2">
<span class="path1"></span>
<span class="path2"></span>
<span class="path3"></span>
<span class="path4"></span>
</i>
Reset
</button>
</div>
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
@@ -713,5 +722,75 @@
return `<input class="input" type="text" name="custom_field[${itemId}][${fieldName}]" value="${value}">`;
}
}
function clearDetail(detailId) {
Swal.fire({
title: 'Apakah Anda yakin?',
text: "Anda akan menghapus detail ini!",
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Ya, yakin!',
cancelButtonText: 'Batal'
}).then((result) => {
if (result.isConfirmed) {
Swal.fire({
title: 'Apakah Anda yakin?',
text: "Data yang telah di hapus tidak dapat di kembalikan",
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Ya, hapus!',
cancelButtonText: 'Batal'
}).then((result2) => {
if (result2.isConfirmed) {
// Hapus input fields
$(`input[name="detail_dokumen_jaminan_id[]"][value="${detailId}"]`).closest('.grid.gap-5').remove();
// Kirim request AJAX untuk menghapus data dari database
$.ajax({
url: '{{ route("debitur.jaminan.clearDetail", $debitur->id ) }}',
type: 'POST',
data: {
_token: '{{ csrf_token() }}',
detail_id: detailId
},
success: function (response) {
if (response.success) {
Swal.fire({
title: 'Berhasil!',
text: 'Detail berhasil dihapus',
icon: 'success',
confirmButtonText: 'OK'
}).then((result) => {
if (result.isConfirmed) {
location.reload();
}
});
} else {
Swal.fire({
title: 'Gagal!',
text: 'Detail gagal dihapus',
icon: 'error',
confirmButtonText: 'OK'
});
}
},
error: function () {
Swal.fire({
title: 'Gagal!',
text: 'Terjadi kesalahan saat menghapus detail',
icon: 'error',
confirmButtonText: 'OK'
});
}
});
}
});
}
});
}
</script>
@endpush

View File

@@ -8,7 +8,6 @@
@endphp
@section('content')
<div class="w-full grid gap-5 lg:gap-7.5 mx-auto">
<div class="card border border-agi-100 pb-2.5">
@php
$buttonProses='';
$buttonProses='<a href="'. route('otorisasitender.penawaran.edit', $id) .'" class="btn btn-xs btn-primary" title="Otorisasi Penawaran"><i class="ki-outline ki-arrow-circle-right"></i> Otorisasi Penawaran</a>';
@@ -22,7 +21,6 @@
])
</div>
</div>

View File

@@ -131,7 +131,7 @@
<a href="/tender/penawaran/${nomor_registrasi}/edit" class="btn btn-sm btn-icon btn-clear btn-info" title="Penawaran">
<i class="ki-outline ki-arrow-circle-right"></i>
</a>
<a href="/tender/penawaran/${nomor_registrasi}/showKirimEmail" class="btn btn-sm btn-icon btn-clear btn-success" title="Kirim Email">
<a href="/tender/penawaran/${nomor_registrasi}/showKirimEmail" class="btn btn-sm btn-icon btn-clear btn-success hidden" title="Kirim Email">
<i class="ki-filled ki-paper-plane"></i>
</a>
`;

View File

@@ -72,15 +72,7 @@
<em id="{{$route[0]}}_catatan_msg" class="alert text-danger text-sm"></em>
</div>
</div>
<div id="{{ $route[0] }}_div_sla" class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">
SLA (dalam satuan hari)
</label>
<div class="flex flex-wrap items-baseline w-full">
<input class="inputku input" name="{{$route[0]}}_sla" id="{{$route[0]}}_sla" placeholder="dalam satuan hari" type="text" />
<em id="{{$route[0]}}_sla_msg" class="alert text-danger text-sm"></em>
</div>
</div>
<div id="{{ $route[0] }}_div_region" class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">
Region

View File

@@ -1,7 +1,7 @@
@push('scripts')
@include('lpj::assetsku.includenya')
<script type="module">
<script type="module">
$(document).ready(function() {
prepareForm();
});
@@ -13,7 +13,6 @@
$("#{{ $route[0] }}_div_jenis_pilihan").show();
$("#{{ $route[0] }}_div_catatan").hide();
$("#{{ $route[0] }}_div_region").hide();
$("#{{ $route[0] }}_div_sla").hide();
$("#{{ $route[0] }}_div_catatan2").show();
// prepare data
setData();
@@ -40,7 +39,7 @@
// }
},
success: function(response) {
if ('success' == response.status)
{
$("#textReg").text(response.datas.nomor_registrasi);
@@ -50,7 +49,7 @@
// success
// var message = response.message;
// toastrku("success", message);
}
else if('error' == response.status)
{
@@ -96,7 +95,7 @@
$("#{{ $route[0] }}_div_jenis_pilihan").show();
$("#{{ $route[0] }}_catatan").val('');
$("#{{ $route[0] }}_div_catatan").hide();
$("#{{ $route[0] }}_div_catatan2").show();
}
else
@@ -105,7 +104,6 @@
$("#{{ $route[0] }}_div_jenis_pilihan").hide();
$("#{{ $route[0] }}_div_catatan").show();
$("#{{ $route[0] }}_div_catatan2").hide();
$("#{{ $route[0] }}_div_sla").hide();
}
});
@@ -122,7 +120,6 @@
let region = $("#{{$route[0]}}_region").val();
let catatan = $("#{{$route[0]}}_catatan").val();
let catatan2 = $("#{{$route[0]}}_catatan2").val();
let sla = $("#{{$route[0]}}_sla").val();
if(jenis_penilaian==0)
jenis_penilaian='';
@@ -138,7 +135,6 @@
input_data.region= region;
input_data.catatan = catatan;
input_data.catatan2 = catatan2;
input_data.sla = sla;
let useURL= '{{ route($route[0].'.update', $id) }}';
$.ajax({
@@ -169,11 +165,7 @@
$("#{{$route[0]}}_region").addClass(" border-danger");
$("#{{$route[0]}}_region_msg").text(value);
}
if ("sla" === index) {
$("#{{$route[0]}}_sla").addClass(" border-danger");
$("#{{$route[0]}}_sla_msg").text(value);
}
});
}
else
@@ -182,7 +174,7 @@
var message = response.message;
toastrku("success", message);
setTimeout(function () {
setTimeout(function () {
var url = "{{ route('registrasi.index') }}";
$(location).attr('href',url);
// window.location.href = "https://www.newurl.com";
@@ -214,18 +206,15 @@
{
// INTERNAL, show region
$("#{{ $route[0] }}_div_region").show();
$("#{{ $route[0] }}_div_sla").hide();
}
else if('2' == idNya)
{
$("#{{ $route[0] }}_div_sla").show();
$("#{{ $route[0] }}_div_region").hide();
}
else if('0' == idNya)
{
// selain INTERNAL, hide region
$("#{{ $route[0] }}_div_region").hide();
$("#{{ $route[0] }}_div_sla").hide();
}
});

View File

@@ -68,16 +68,7 @@
<em id="{{ $route[0] }}_catatan_msg" class="alert text-danger text-sm"></em>
</div>
</div>
<div id="{{ $route[0] }}_div_sla" class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">
SLA (dalam satuan hari)
</label>
<div class="flex flex-wrap items-baseline w-full">
<input class="inputku input" name="{{ $route[0] }}_sla" id="{{ $route[0] }}_sla"
placeholder="dalam satuan hari" type="text" />
<em id="{{ $route[0] }}_sla_msg" class="alert text-danger text-sm"></em>
</div>
</div>
<div id="{{ $route[0] }}_div_region"
class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">

View File

@@ -207,9 +207,13 @@
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">Alamat</label>
<div class="w-full">
@foreach ($permohonan->documents as $dokumen)
@php
$alamat = $dokumen;
@endphp
@endforeach
<span class="text-2sm text-gray-700">
{{ formatAlamat($permohonan->debiture) }}
{{ formatAlamat($dokumen) }}
</span>
@@ -481,43 +485,43 @@
<label for="address" class="form-label max-w-56">Terletak di.</label>
<div class="flex flex-wrap items-baseline w-full">
<input type="text" id="address" name="address" class="input w-full "
value="{{ isset($permohonan->debiture->address) ? $permohonan->debiture->address : old('address') }}">
value="{{ isset($alamat->address) ? $alamat->address : old('address') }}">
</div>
</div>
<input type="hidden" name="province_code"
value="{{ isset($permohonan->debiture->province) ? $permohonan->debiture->province->code : '' }}">
value="{{ isset($alamat->province) ? $alamat->province->code : '' }}">
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5 w-full">
<label for="province" class="form-label max-w-56">Provinsi</label>
<div class="flex flex-wrap items-baseline w-full">
<input type="text" id="province" class="input w-full cursor-not-allowed" readonly
value="{{ isset($permohonan->debiture->province) ? $permohonan->debiture->province->name : '' }}">
value="{{ isset($alamat->province) ? $alamat->province->name : '' }}">
</div>
</div>
<input type="hidden" name="city_code"
value="{{ isset($permohonan->debiture->city) ? $permohonan->debiture->city->code : '' }}">
value="{{ isset($alamat->city) ? $alamat->city->code : '' }}">
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5 w-full">
<label for="city" class="form-label max-w-56">Kabupaten/Kota</label>
<div class="flex flex-wrap items-baseline w-full">
<input type="text" id="city" class="input w-full cursor-not-allowed" readonly
value="{{ isset($permohonan->debiture->city) ? $permohonan->debiture->city->name : '' }}">
value="{{ isset($alamat->city) ? $alamat->city->name : '' }}">
</div>
</div>
<input type="hidden" name="district_code"
value="{{ isset($permohonan->debiture->district) ? $permohonan->debiture->district->code : '' }}">
value="{{ isset($alamat->district) ? $alamat->district->code : '' }}">
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5 w-full">
<label for="district" class="form-label max-w-56">Kecamatan</label>
<div class="flex flex-wrap items-baseline w-full">
<input type="text" id="district" class="input w-full cursor-not-allowed" readonly
value="{{ isset($permohonan->debiture->district) ? $permohonan->debiture->district->name : '' }}">
value="{{ isset($alamat->district) ? $alamat->district->name : '' }}">
</div>
</div>
<input type="hidden" name="village_code"
value="{{ isset($permohonan->debiture->village) ? $permohonan->debiture->village->code : '' }}">
value="{{ isset($alamat->village) ? $alamat->village->code : '' }}">
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5 w-full">
<label for="village" class="form-label max-w-56">Desa/Kelurahan</label>
<div class="flex flex-wrap items-baseline w-full">
<input type="text" id="village" class="input w-full cursor-not-allowed" readonly
value="{{ isset($permohonan->debiture->village) ? $permohonan->debiture->village->name : '' }}">
value="{{ isset($alamat->village) ? $alamat->village->name : '' }}">
</div>
</div>
</div>

View File

@@ -349,6 +349,8 @@ Route::middleware(['auth'])->group(function () {
Route::put('{jaminan}', [DokumenJaminanController::class, 'update'])->name('update');
Route::post('store', [DokumenJaminanController::class, 'store'])->name('store');
Route::delete('{jaminan}', [DokumenJaminanController::class, 'destroy'])->name('destroy');
Route::post('clear-detail', [DokumenJaminanController::class, 'clearDetail'])->name('clearDetail');
});
Route::name('pemilik.')->prefix('{id}/pemilik')->group(function () {