fix(surveyor/penilai): perbaikkan data pembanding dan tambah tombol freaze di penilai
This commit is contained in:
@@ -653,7 +653,7 @@ class PenilaiController extends Controller
|
||||
'permohonan_id' => 'required|integer',
|
||||
'document_id' => 'required|integer',
|
||||
'inspeksi_id' => 'required|integer',
|
||||
'kertas_kerja' => 'required|file|mimes:pdf,doc,docx,xls,xlsx,xlsx',
|
||||
'kertas_kerja' => 'required|file|mimes:pdf',
|
||||
]);
|
||||
|
||||
try {
|
||||
|
||||
@@ -448,6 +448,7 @@ class PermohonanController extends Controller
|
||||
'nomor_registrasi' => 'required',
|
||||
'reschedule_note' => 'required',
|
||||
'reschedule_date' => 'required',
|
||||
'keterangan' => 'required'
|
||||
]);
|
||||
|
||||
DB::beginTransaction();
|
||||
|
||||
@@ -2479,6 +2479,11 @@ class SurveyorController extends Controller
|
||||
: ($data['hadap_mata_angin_tidak_sesuai'] ?? null);
|
||||
$hadap_mata_angin[$hadap_mata_angin_key] = $hasil_hadap_mata_angin;
|
||||
|
||||
$tusuk_sate_key = ($data['tusuk_sate'] ?? null) === 'Ya' ? 'Ya' : 'Tidak';
|
||||
|
||||
$tusuk_sate = [];
|
||||
$tusuk_sate[$tusuk_sate_key] = $data['tusuk_sate_ya'] ?? null;
|
||||
|
||||
|
||||
return [
|
||||
'tanah' => [
|
||||
@@ -2505,7 +2510,7 @@ class SurveyorController extends Controller
|
||||
'lainnya'
|
||||
),
|
||||
|
||||
'tusuk_sate' => $data['tusuk_sate'] ?? null,
|
||||
'tusuk_sate' => $tusuk_sate,
|
||||
'lockland' => $data['lockland'] ?? null,
|
||||
'kondisi_fisik_tanah' => $this->getFieldData(
|
||||
$data,
|
||||
@@ -3620,6 +3625,8 @@ class SurveyorController extends Controller
|
||||
|
||||
// Generate PDF
|
||||
$pdf = PDF::loadView($templateView, compact('permohonan', 'basicData', 'forminspeksi', 'alamat'));
|
||||
|
||||
$pdf = view($templateView, compact('permohonan', 'basicData', 'forminspeksi', 'alamat'));
|
||||
$pdf->setPaper('A4', 'portrait');
|
||||
|
||||
// Tentukan nama file PDF
|
||||
@@ -3681,6 +3688,7 @@ class SurveyorController extends Controller
|
||||
'permohonan_id' => 'required|exists:permohonan,id',
|
||||
'rejected_note' => 'required|string|max:255',
|
||||
'nomor_registrasi' => 'required|string',
|
||||
'keterangan' => 'required|string',
|
||||
]);
|
||||
|
||||
// Memulai transaksi
|
||||
|
||||
@@ -194,9 +194,15 @@
|
||||
if (data.status === 'survey-completed' || data.status === 'proses-laporan' || data.status === 'paparan' || data.status === 'proses-paparan' || data.status === 'paparan' || data.status == 'revisi-laporan' || data.status === 'done' || data.status === 'revisi-paparan') {
|
||||
return `
|
||||
<div class="flex flex-nowrap justify-center gap-1.5">
|
||||
<a class="btn btn-sm btn-outline btn-info" href="penilai/${data.id}/show">
|
||||
<a class="btn btn-sm btn-icon btn-clear btn-info" href="penilai/${data.id}/show">
|
||||
<i class="ki-outline ki-eye"></i>
|
||||
</a>
|
||||
<button type="button"
|
||||
class="btn btn-sm btn-icon btn-clear btn-warning"
|
||||
onclick="surveyorFreeze('${data.id}', '${data.nomor_registrasi}', '${data.debiture?.name}')"
|
||||
title="Freeze SLA">
|
||||
<i class="ki-filled ki-arrow-circle-right"></i>
|
||||
</button>
|
||||
</div>`;
|
||||
} else {
|
||||
return `<div class="flex flex-nowrap justify-center">
|
||||
@@ -221,6 +227,57 @@
|
||||
</script>
|
||||
|
||||
<script>
|
||||
function surveyorFreeze(permohonanId, noReg, debitur) {
|
||||
|
||||
Swal.fire({
|
||||
title: 'Apakah Anda yakin?',
|
||||
text: "Yakin akan Request Freeze dengan " + noReg + " untuk Debitur " + debitur +
|
||||
" ?",
|
||||
icon: 'warning',
|
||||
input: 'textarea',
|
||||
inputLabel: 'Keterangan',
|
||||
inputPlaceholder: 'Masukkan keterangan...',
|
||||
inputAttributes: {
|
||||
'aria-label': 'Masukkan keterangan'
|
||||
},
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#3085d6',
|
||||
cancelButtonColor: '#d33',
|
||||
confirmButtonText: 'Ya, Lanjutkan!',
|
||||
cancelButtonText: 'Batal',
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
const userMessage = result.value || ''; // Ambil pesan dari textarea
|
||||
$.ajaxSetup({
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': '{{ csrf_token() }}'
|
||||
},
|
||||
});
|
||||
$.ajax({
|
||||
url: `/surveyor/storeFreeze/${permohonanId}`,
|
||||
type: 'POST',
|
||||
data: {
|
||||
message: userMessage
|
||||
},
|
||||
success: (response) => {
|
||||
Swal.fire('Berhasil!',
|
||||
response.message,
|
||||
'success').then(() => {
|
||||
window.location.reload();
|
||||
});
|
||||
console.log(response);
|
||||
},
|
||||
error: (error) => {
|
||||
console.error('Error:', error);
|
||||
Swal.fire('Gagal!', 'Terjadi kesalahan saat melakukan Freeze.',
|
||||
'error');
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function showLoadingSwal(message, duration = 5000) {
|
||||
Swal.fire({
|
||||
title: message,
|
||||
|
||||
@@ -400,17 +400,13 @@
|
||||
onclick="uploadKertasKerja({{ $permohonan->id }}, '{{ $documentId }}', '{{ $inspeksiId }}', '{{ $jenisJaminanId }}')">Upload</button>
|
||||
</div>
|
||||
</div>
|
||||
{{-- <div class="form-group flex items-baseline flex-wrap">
|
||||
|
||||
@if ($jenisJaminanId)
|
||||
<a class="btn btn-outline btn-primary w-full"
|
||||
href="{{ route('penilai.export.kertas-kerja') }}?permohonanId={{ $permohonan->id }}&documentId={{ $documentId }}&inspeksiId={{ $inspeksiId }}&jaminanId={{ $jenisJaminanId }}">
|
||||
Export Kertas Kerja
|
||||
</a>
|
||||
@else
|
||||
<p class="text-red-500">Tidak ada dokumen yang memiliki jenis jaminan.</p>
|
||||
@endif
|
||||
</div> --}}
|
||||
<div class="flex justify-between items-center">
|
||||
@if ($permohonan->penilai->kertas_kerja)
|
||||
<span data-modal-dismiss="true" class="btn btn-warning btn-outline"
|
||||
onclick="viewPDF('{{ Storage::url($permohonan->penilai->kertas_kerja) }}')"><i
|
||||
class="ki-filled ki-eye mr-2"></i>Lihat Kertas Kerja</span>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
@@ -420,6 +416,7 @@
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@include('lpj::component.pdfviewer')
|
||||
|
||||
<script>
|
||||
function seletSederhanaStandart(permohonanId, documentId, inspeksiId, jaminanId, fasilitasKredit, statusBayar) {
|
||||
|
||||
@@ -209,10 +209,10 @@
|
||||
<a onclick="surveyorRescheduleJadwalSurvey(
|
||||
${data.id},
|
||||
${data.penilaian.id},
|
||||
${data.nomor_registrasi},
|
||||
${data.debiture.name},
|
||||
${data.penilaian.waktu_penilaian},
|
||||
${JSON.stringify(data.penilaian.rejected_note)}
|
||||
'${data.nomor_registrasi}',
|
||||
'${data.debiture ? data.debiture.name.replace(/'/g, "\\'") : ""}',
|
||||
'${data.penilaian.waktu_penilaian}',
|
||||
'${data.penilaian.rejected_note ? JSON.stringify(data.penilaian.rejected_note).replace(/'/g, "\\'").replace(/"/g, '"') : '{}'}'
|
||||
)" class="delete btn btn-sm btn-outline btn-light" title="Reschedule Jadwal Survey">
|
||||
<i class="ki-filled ki-calendar-remove"></i>
|
||||
</a>`;
|
||||
@@ -379,7 +379,8 @@
|
||||
nomor_registrasi: noReg,
|
||||
permohonan_id: permohonanId,
|
||||
reschedule_date: rescheduleDate,
|
||||
reschedule_note: rescheduleNote
|
||||
reschedule_note: rescheduleNote,
|
||||
keterangan: rejectedNote
|
||||
};
|
||||
|
||||
$.ajax({
|
||||
|
||||
@@ -79,42 +79,38 @@
|
||||
let columnCount = 1;
|
||||
// Fungsi calculate prices yang diperbaiki
|
||||
function calculatePrices(type = 'main', index = null) {
|
||||
let hargaInput, diskonInput, totalInput, hargaDiskonInput, hargaPenawaranInput;
|
||||
let hargaInput, diskonInput, totalInput, hargaDiskonInput;
|
||||
|
||||
// Tentukan input berdasarkan tipe (main atau pembanding)
|
||||
if (type === 'main') {
|
||||
hargaPenawaranInput = document.querySelector('input[name="harga_penawaran"]');
|
||||
// hargaPenawaranInput = document.querySelector('input[name="harga_penawaran"]');
|
||||
hargaInput = document.querySelector('input[name="harga"]');
|
||||
diskonInput = document.querySelector('input[name="diskon"]');
|
||||
totalInput = document.querySelector('input[name="total"]');
|
||||
hargaDiskonInput = document.querySelector('input[name="harga_diskon"]');
|
||||
} else {
|
||||
// Untuk pembanding, gunakan array input dengan index
|
||||
const hargaPenawarans = document.getElementsByName('harga_penawaran_pembanding[]');
|
||||
|
||||
const hargaInputs = document.getElementsByName('harga_pembanding[]');
|
||||
const diskonInputs = document.getElementsByName('diskon_pembanding[]');
|
||||
const totalInputs = document.getElementsByName('total_pembanding[]');
|
||||
const hargaDiskonInputs = document.getElementsByName('harga_diskon_pembanding[]');
|
||||
|
||||
|
||||
// Pastikan index valid
|
||||
if (index !== null && index < hargaInputs.length) {
|
||||
hargaPenawaranInput = hargaPenawarans[index]
|
||||
// hargaPenawaranInput = hargaPenawarans[index]
|
||||
hargaInput = hargaInputs[index];
|
||||
diskonInput = diskonInputs[index];
|
||||
totalInput = totalInputs[index];
|
||||
hargaDiskonInput = hargaDiskonInputs[index];
|
||||
// hargaDiskonInput = hargaDiskonInputs[index];
|
||||
} else {
|
||||
return; // Keluar jika index tidak valid
|
||||
}
|
||||
}
|
||||
|
||||
// Validasi input
|
||||
if (!hargaPenawaranInput || !hargaInput || !diskonInput || !totalInput || !hargaDiskonInput) {
|
||||
if (!hargaInput || !diskonInput || !totalInput) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Ambil nilai numerik dari input
|
||||
const hargaPenawaran = parseFloat(hargaPenawaranInput.value.replace(/[^\d]/g, '') || '0');
|
||||
const harga = parseFloat(hargaInput.value.replace(/[^\d]/g, '') || '0');
|
||||
let diskonInput_value = diskonInput.value.replace(',', '.');
|
||||
let diskon = parseFloat(diskonInput_value.replace(/[^\d.]/g, '') || '0');
|
||||
@@ -123,13 +119,15 @@
|
||||
// Batasi diskon maksimal 100%
|
||||
diskon = Math.min(diskon, 100);
|
||||
|
||||
|
||||
const total = harga;
|
||||
const hargaPermeterSetelahDiskon = harga - (harga * (diskon / 100))
|
||||
const hargaSetelahDiskon = hargaPenawaran - (hargaPenawaran * (diskon / 100));
|
||||
|
||||
console.log(hargaPermeterSetelahDiskon);
|
||||
|
||||
// Update nilai dengan format currency
|
||||
totalInput.value = formatCurrency(hargaPermeterSetelahDiskon.toString());
|
||||
hargaDiskonInput.value = formatCurrency(hargaSetelahDiskon.toString());
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -217,7 +215,7 @@
|
||||
'telepon_pembanding[]': currentData.telepon,
|
||||
'penawaran_pembanding[]': currentData.penawaran,
|
||||
'tanggal_pembanding[]': currentData.tanggal,
|
||||
'harga_penawaran_pembanding[]':currentData.harga_penawaran
|
||||
// 'harga_penawaran_pembanding[]':currentData.harga_penawaran
|
||||
|
||||
};
|
||||
|
||||
@@ -267,15 +265,15 @@
|
||||
function initializePriceCalculation() {
|
||||
// Event listener untuk input utama
|
||||
const mainHargaInput = document.querySelector('input[name="harga"]');
|
||||
const mainHargaPenawaranInput = document.querySelector('input[name="harga_penawaran"]');
|
||||
// const mainHargaPenawaranInput = document.querySelector('input[name="harga_penawaran"]');
|
||||
const mainDiskonInput = document.querySelector('input[name="diskon"]');
|
||||
|
||||
if (mainHargaInput) {
|
||||
mainHargaInput.addEventListener('input', () => calculatePrices('main'));
|
||||
}
|
||||
if (mainHargaPenawaranInput) {
|
||||
mainHargaPenawaranInput.addEventListener('input', () => calculatePrices('main'));
|
||||
}
|
||||
// if (mainHargaPenawaranInput) {
|
||||
// mainHargaPenawaranInput.addEventListener('input', () => calculatePrices('main'));
|
||||
// }
|
||||
|
||||
if (mainDiskonInput) {
|
||||
mainDiskonInput.addEventListener('input', () => calculatePrices('main'));
|
||||
@@ -283,7 +281,7 @@
|
||||
|
||||
// Event listener untuk input pembanding
|
||||
const pembandingHargaInputs = document.getElementsByName('harga_pembanding[]');
|
||||
const pembandingHargaPenawaranInput = document.getElementsByName('harga_penawaran_pembanding[]');
|
||||
// const pembandingHargaPenawaranInput = document.getElementsByName('harga_penawaran_pembanding[]');
|
||||
|
||||
|
||||
const pembandingDiskonInputs = document.getElementsByName('diskon_pembanding[]');
|
||||
@@ -291,9 +289,9 @@
|
||||
pembandingHargaInputs.forEach((input, index) => {
|
||||
input.addEventListener('input', () => calculatePrices('pembanding', index));
|
||||
});
|
||||
pembandingHargaPenawaranInput.forEach((input, index) => {
|
||||
input.addEventListener('input', () => calculatePrices('pembanding', index));
|
||||
});
|
||||
// pembandingHargaPenawaranInput.forEach((input, index) => {
|
||||
// input.addEventListener('input', () => calculatePrices('pembanding', index));
|
||||
// });
|
||||
|
||||
pembandingDiskonInputs.forEach((input, index) => {
|
||||
input.addEventListener('input', () => calculatePrices('pembanding', index));
|
||||
|
||||
@@ -114,7 +114,7 @@
|
||||
@endphp
|
||||
<td class="px-4 py-2">
|
||||
<input type="text" name="luas_tanah" class="input "
|
||||
value="{{ $inspectionData['tanah']['luas_tanah']['sesuai'] ?? ($inspectionData['tanah']['luas_tanah']['tidak sesuai'] ?? '') }}">
|
||||
value="{{ $inspectionData['tanah']['luas_tanah']['sesuai'] ?? ($inspectionData['tanah']['luas_tanah']['tidak sesuai'] ?? '') }}">
|
||||
</td>
|
||||
<td class="px-4 py-2">
|
||||
|
||||
@@ -188,7 +188,7 @@
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
{{-- <tr>
|
||||
<td class="px-4 py-2">Harga Penawaran/ Transaksi(Rp)</td>
|
||||
<td class="px-4 py-2">
|
||||
<input type="text" name="harga_penawaran" class="input currency-format"
|
||||
@@ -197,7 +197,7 @@
|
||||
<td class="px-4 py-2">
|
||||
<input type="text" name="harga_penawaran_pembanding[]" class="input currency-format">
|
||||
</td>
|
||||
</tr>
|
||||
</tr> --}}
|
||||
|
||||
|
||||
<tr>
|
||||
@@ -412,11 +412,11 @@
|
||||
</tr>
|
||||
|
||||
<tr class="bg-gray-100">
|
||||
<td colspan="3" class="px-4 py-2 font-semibold">Harga Per Meter</td>
|
||||
<td colspan="3" class="px-4 py-2 font-semibold">Harga</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="px-4 py-2">Harga</td>
|
||||
<td class="px-4 py-2">Harga Penawaran/ Transaksi(Rp)</td>
|
||||
<td class="px-4 py-2">
|
||||
<input type="text" name="harga" class="input currency-format"
|
||||
value="{{ $inspectionData['asset']['harga'] ?? '' }}">
|
||||
@@ -448,8 +448,8 @@
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr style="">
|
||||
<td class="px-4 py-2"></td>
|
||||
{{-- <tr style="">
|
||||
<td class="px-4 py-2">Harga Setelah Diskon</td>
|
||||
<td class="px-4 py-2">
|
||||
<input type="text" name="total" class="input currency"
|
||||
value="{{ $inspectionData['asset']['total'] ?? '' }}" readonly>
|
||||
@@ -457,15 +457,15 @@
|
||||
<td class="px-4 py-2">
|
||||
<input type="text" name="total_pembanding[]" class="input currency-format" readonly>
|
||||
</td>
|
||||
</tr>
|
||||
</tr> --}}
|
||||
<tr>
|
||||
<td class="px-4 py-2">Harga Setelah Diskon</td>
|
||||
<td class="px-4 py-2">
|
||||
<input type="text" name="harga_diskon" class="input currency-format" readonly
|
||||
value="{{ $inspectionData['asset']['harga_diskon'] ?? '' }}">
|
||||
<input type="text" name="total" class="input currency-format" readonly
|
||||
value="{{ $inspectionData['asset']['total'] ?? '' }}">
|
||||
</td>
|
||||
<td class="px-4 py-2">
|
||||
<input type="text" name="harga_diskon_pembanding[]" readonly
|
||||
<input type="text" name="total_pembanding[]" readonly
|
||||
class="input currency-format">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -104,56 +104,6 @@
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/flatpickr/dist/flatpickr.min.css">
|
||||
<script src="https://cdn.jsdelivr.net/npm/flatpickr"></script>
|
||||
<script>
|
||||
function surveyorFreeze(permohonanId, noReg, debitur) {
|
||||
|
||||
Swal.fire({
|
||||
title: 'Apakah Anda yakin?',
|
||||
text: "Yakin akan Request Freeze dengan " + noReg + " untuk Debitur " + debitur +
|
||||
" ?",
|
||||
icon: 'warning',
|
||||
input: 'textarea',
|
||||
inputLabel: 'Keterangan',
|
||||
inputPlaceholder: 'Masukkan keterangan...',
|
||||
inputAttributes: {
|
||||
'aria-label': 'Masukkan keterangan'
|
||||
},
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#3085d6',
|
||||
cancelButtonColor: '#d33',
|
||||
confirmButtonText: 'Ya, Lanjutkan!',
|
||||
cancelButtonText: 'Batal',
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
const userMessage = result.value || ''; // Ambil pesan dari textarea
|
||||
$.ajaxSetup({
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': '{{ csrf_token() }}'
|
||||
},
|
||||
});
|
||||
$.ajax({
|
||||
url: `/surveyor/storeFreeze/${permohonanId}`,
|
||||
type: 'POST',
|
||||
data: {
|
||||
message: userMessage
|
||||
},
|
||||
success: (response) => {
|
||||
Swal.fire('Berhasil!',
|
||||
response.message,
|
||||
'success').then(() => {
|
||||
window.location.reload();
|
||||
});
|
||||
console.log(response);
|
||||
},
|
||||
error: (error) => {
|
||||
console.error('Error:', error);
|
||||
Swal.fire('Gagal!', 'Terjadi kesalahan saat melakukan Freeze.',
|
||||
'error');
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function approveReschedule(penilaianId, permohonanId, noReg, debitur, reschedule_date, reschedule_note) {
|
||||
Swal.fire({
|
||||
@@ -223,7 +173,8 @@
|
||||
_token: token,
|
||||
permohonan_id: permohonanId,
|
||||
nomor_registrasi: noReg,
|
||||
rejected_note: rejectResult.value
|
||||
rejected_note: rejectResult.value,
|
||||
keterangan: rejectResult.value
|
||||
}
|
||||
$.ajax({
|
||||
url: useURL,
|
||||
@@ -642,12 +593,7 @@
|
||||
title="Lihat Form Inspeksi">
|
||||
<i class="ki-outline ki-eye"></i>
|
||||
</a>
|
||||
<button type="button"
|
||||
class="btn btn-sm btn-icon btn-clear btn-info"
|
||||
onclick="surveyorFreeze('${data.id}', '${data.nomor_registrasi}', '${data.debiture?.name}')"
|
||||
title="Freeze Survey">
|
||||
<i class="ki-filled ki-arrow-circle-right"></i>
|
||||
</button>
|
||||
|
||||
`;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user