Ffix(surveyor/penilai): perbaikkan edit foto dan call report
This commit is contained in:
@@ -181,7 +181,13 @@ class PembayaranController extends Controller
|
||||
$permohonan = Permohonan::find($id);
|
||||
|
||||
if ($permohonan) {
|
||||
$data['status_bayar'] = 'sudah_bayar';
|
||||
|
||||
if ($request->type === 'revisi') {
|
||||
$data['status_bayar'] = 'belum_bayar';
|
||||
} else {
|
||||
$data['status_bayar'] = 'sudah_bayar';
|
||||
}
|
||||
|
||||
if ($permohonan->jenis_penilaian_id == 2) {
|
||||
$data['status'] = 'spk';
|
||||
}
|
||||
|
||||
@@ -1056,7 +1056,8 @@ class PenilaiController extends Controller
|
||||
'fakta_negatif' => 'nullable|array',
|
||||
'type' => 'required',
|
||||
'action' => 'required',
|
||||
'keterangan' => 'nullable|array'
|
||||
'keterangan' => 'nullable|array',
|
||||
|
||||
]);
|
||||
|
||||
|
||||
|
||||
@@ -682,6 +682,7 @@ class SurveyorController extends Controller
|
||||
$request->validate([
|
||||
'edited_image' => 'required|string',
|
||||
'original_path' => 'required|string',
|
||||
'nomor_registrasi' => 'required',
|
||||
]);
|
||||
|
||||
// Decode base64 image
|
||||
@@ -701,7 +702,7 @@ class SurveyorController extends Controller
|
||||
// Path asli
|
||||
$originalPath = $request->input('original_path');
|
||||
$fileName = basename($originalPath);
|
||||
$newFilePath = 'edited_images/' . $fileName;
|
||||
$newFilePath = 'surveyor/upload_foto/'. $request->input('nomor_registrasi') . '/' . $fileName;
|
||||
|
||||
// Simpan file ke storage
|
||||
Storage::disk('public')->put($newFilePath, $decodedImage);
|
||||
@@ -1675,10 +1676,6 @@ class SurveyorController extends Controller
|
||||
'basicData',
|
||||
'cekAlamat'
|
||||
));
|
||||
|
||||
// return response()->json([
|
||||
// 'daya'=> $permohonan
|
||||
// ]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -106,11 +106,14 @@
|
||||
|
||||
@push('scripts')
|
||||
<script type="text/javascript">
|
||||
function pembayaranOtorisator(id) {
|
||||
// alert('hai id = ' + id);
|
||||
function handlePembayaran(id, type) {
|
||||
let rv = type
|
||||
let title = type === 'revisi' ? 'Apakah Anda yakin ingin merevisi pembayaran ini?' : 'Apakah Anda yakin?';
|
||||
let text = type === 'revisi' ? 'Untuk melakukan revisi pembayaran!' : 'Untuk melakukan approve pembayaran!';
|
||||
|
||||
Swal.fire({
|
||||
title: 'Apakah Anda yakin?',
|
||||
text: `Untuk melakukan approve Pembayaran!`,
|
||||
title: title,
|
||||
text: text,
|
||||
icon: 'warning',
|
||||
input: 'textarea', // Menambahkan input textarea
|
||||
inputLabel: 'Keterangan',
|
||||
@@ -133,6 +136,7 @@
|
||||
input_data._method = 'PUT';
|
||||
input_data.id = id;
|
||||
input_data.keterangan = keterangan;
|
||||
input_data.type = rv;
|
||||
|
||||
$.ajaxSetup({
|
||||
headers: {
|
||||
@@ -324,10 +328,10 @@
|
||||
}
|
||||
|
||||
if(permohonan) {
|
||||
return `${permohonan.approve_keterangan_bayar}`;
|
||||
return `${permohonan.approve_keterangan_bayar}` || '-';
|
||||
}
|
||||
|
||||
return "";
|
||||
return "-";
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
@@ -339,12 +343,16 @@
|
||||
var permohonan = data.penawaran.permohonan;
|
||||
}
|
||||
|
||||
var iconPembayaranOtorisator = '';
|
||||
if(permohonan) {
|
||||
var iconPembayaranOtorisator = '';
|
||||
if (!permohonan.approve_bayar_by) {
|
||||
iconPembayaranOtorisator = `<a class="btn btn-sm btn-icon btn-clear btn-primary " onclick="pembayaranOtorisator(${permohonan.id})">
|
||||
iconPembayaranOtorisator = `<a class="btn btn-sm btn-icon btn-clear btn-primary " onclick="handlePembayaran(${permohonan.id},'otorisator')">
|
||||
<i class="ki-filled ki-double-check"></i>
|
||||
</a>`;
|
||||
}else{
|
||||
iconPembayaranOtorisator = `<a class="btn btn-sm btn-icon btn-clear btn-primary " onclick="handlePembayaran(${permohonan.id}, 'revisi')">
|
||||
<i class="ki-filled ki-arrow-circle-left"></i>
|
||||
</a>`;
|
||||
}
|
||||
|
||||
return `<div class="flex flex-nowrap justify-center">` + iconPembayaranOtorisator + `</div>`;
|
||||
|
||||
@@ -65,8 +65,8 @@
|
||||
{{-- @include('lpj::surveyor.components.header')
|
||||
@include('lpj::surveyor.components.callReport') --}}
|
||||
@php
|
||||
$paparan = $permohonan->status === 'proses-paparan' ? 'Paparan' : 'Pelaporan';
|
||||
@endphp
|
||||
$paparan = $permohonan->status === 'proses-paparan' ? 'Paparan' : 'Pelaporan';
|
||||
@endphp
|
||||
<div class="card">
|
||||
<div class="card-header bg-agi-50">
|
||||
<h3 class="card-title uppercase">
|
||||
@@ -251,40 +251,81 @@
|
||||
@include('lpj::component.detail-jaminan', ['status' => true])
|
||||
</div>
|
||||
</div>
|
||||
<div class="card border border-agi-100 w-full bg-white rounded-lg shadow-md">
|
||||
<div class="card-header bg-agi-50">
|
||||
<h1 class="text-md font-medium text-gray-900 uppercase">Nilai Likuidasi</h1>
|
||||
|
||||
<div class="w-full grid grid-cols-1 lg:grid-cols-2 gap-4">
|
||||
|
||||
<!-- Bagian Nilai KJPP -->
|
||||
<div class="card border border-agi-100 w-full bg-white rounded-lg shadow-md">
|
||||
<div class="card-header bg-agi-50">
|
||||
<h1 class="text-md font-medium text-gray-900 uppercase">Nilai KJPP</h1>
|
||||
</div>
|
||||
<div class="card-body grid gap-5 w-full">
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5 w-full">
|
||||
<label for="lelang-1" class="form-label max-w-56">Lelang ke </label>
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
<input type="text" id="lelang-1" name="lelang_kjpp" class="input w-full"
|
||||
placeholder="Masukkan Lelang" value="{{ $callReport['lelang_kjpp'] ?? '' }}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5 w-full">
|
||||
<label for="nilai-pasar-1" class="form-label max-w-56">Nilai Pasar Wajar (NPW)</label>
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
<input type="text" id="nilai-pasar-1" name="nilai_pasar_kjpp"
|
||||
class="input w-full nilai-pasar currency-format" placeholder="Masukkan likuidasi" value="{{ $callReport['nilai_pasar_kjpp'] ?? '' }}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5 w-full">
|
||||
<label for="likuidasi-1" class="form-label max-w-56">Nilai Likuidasi(%)</label>
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
<input type="text" id="likuidasi-1" name="persentase_likuidasi_kjpp" class="input w-full likuidasi"
|
||||
placeholder="Masukkan likuidasi dalam bentuk persen" onkeyup="calculateTotal(this)"
|
||||
data-group="1" value="{{ $callReport['persentase_likuidasi_kjpp'] ?? '' }}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5 w-full">
|
||||
<label for="total-likuidasi-1" class="form-label max-w-56">Total Nilai Likuidasi (NL)</label>
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
<input type="text" id="total-likuidasi-1" name="hasil_nilai_likuidasi_kjpp"
|
||||
class="input w-full total-likuidasi currency-format" placeholder="Hasil perhitungan" value="{{ $callReport['hasil_nilai_likuidasi_kjpp'] ?? '' }}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card-body grid gap-5 w-full">
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5 w-full">
|
||||
<label for="Lelang" class="form-label max-w-56">Lelang ke </label>
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
<input type="text" id="lelang" name="lelang" class="input w-full"
|
||||
placeholder="Masukkan Lelang" value="{{ $callReport['lelang'] ?? old('lelang') }}">
|
||||
</div>
|
||||
<!-- Bagian Nilai Internal -->
|
||||
<div class="card border border-agi-100 w-full bg-white rounded-lg shadow-md">
|
||||
<div class="card-header bg-agi-50">
|
||||
<h1 class="text-md font-medium text-gray-900 uppercase">Nilai Internal</h1>
|
||||
</div>
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5 w-full">
|
||||
<label for="penilai" class="form-label max-w-56">Nilai Pasar Wajar (NPW)</label>
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
<input type="text" id="nilai-pasar" name="nilai_pasar"
|
||||
class="input w-full nilai-pasar currency-format" placeholder="Masukkan likuidasi"
|
||||
value="{{ $callReport['nilai_pasar'] ?? old('likuidasi') }}">
|
||||
<div class="card-body grid gap-5 w-full">
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5 w-full">
|
||||
<label for="lelang-2" class="form-label max-w-56">Lelang ke </label>
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
<input type="text" id="lelang-2" name="lelang_internal" class="input w-full"
|
||||
placeholder="Masukkan Lelang" value="{{ $callReport['lelang_internal'] ?? '' }}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5 w-full">
|
||||
<label for="likuidasi_nilai_1" class="form-label max-w-56">Nilai Likuidasi(%)</label>
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
<input type="text" id="likuidasi" name="likuidasi" class="input w-full likuidasi"
|
||||
placeholder="Masukkan likuidasi dalam bentuk persen" onkeyup="calculateTotal(this)" value="{{ $callReport['persentase_likuidasi'] ?? old('likuidasi') }}">
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5 w-full">
|
||||
<label for="nilai-pasar-2" class="form-label max-w-56">Nilai Pasar Wajar (NPW)</label>
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
<input type="text" id="nilai-pasar-2" name="nilai_pasar_internal"
|
||||
class="input w-full nilai-pasar currency-format" placeholder="Masukkan likuidasi" value="{{ $callReport['nilai_pasar_internal'] ?? '' }}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5 w-full">
|
||||
<label for="total-likuidasi" class="form-label max-w-56">Total Nilai Likuidasi
|
||||
(NL)</label>
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
<input type="text" id="total-likuidasi" name="likuidasi_nilai_1"
|
||||
class="input w-full total-likuidasi currency-format" placeholder="Masukkan likuidasi" value="{{ $callReport['hasil_nilai_likuidasi'] ?? old('likuidasi') }}">
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5 w-full">
|
||||
<label for="likuidasi-2" class="form-label max-w-56">Nilai Likuidasi(%)</label>
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
<input type="text" id="likuidasi-2" name="persentase_likuidasi_internal" class="input w-full likuidasi"
|
||||
placeholder="Masukkan likuidasi dalam bentuk persen" onkeyup="calculateTotal(this)"
|
||||
data-group="2" value="{{ $callReport['persentase_likuidasi_internal'] ?? '' }}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5 w-full">
|
||||
<label for="total-likuidasi-2" class="form-label max-w-56">Total Nilai Likuidasi (NL)</label>
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
<input type="text" id="total-likuidasi-2" name="hasil_nilai_likuidasi_internal"
|
||||
class="input w-full total-likuidasi currency-format" placeholder="Hasil perhitungan" value="{{ $callReport['hasil_nilai_likuidasi_internal'] ?? '' }}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -315,10 +356,9 @@
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5 w-full">
|
||||
<label for="penilai" class="form-label max-w-56">Pihak KJPP</label>
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
<input type="text" id="penilai" name="pihak_kjjpp"
|
||||
class="input w-full "
|
||||
value="{{ $forminspeksi['signature']['kjjp']['name'] ?? $callReport['pihak_kjjpp'] ?? '' }}"
|
||||
placeholder="Masukkan Nama KJPP">
|
||||
<input type="text" id="penilai" name="pihak_kjjpp" class="input w-full "
|
||||
value="{{ $callReport['pihak_kjjpp'] ?? ($forminspeksi['signature']['kjjp']['name'] ?? '') }}"
|
||||
placeholder="Masukkan Nama KJPP">
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5 w-full">
|
||||
@@ -382,7 +422,8 @@
|
||||
@else
|
||||
<div class="fakta_positif flex items-center gap-2 mt-2 textarea-group w-full">
|
||||
<textarea class="textarea mt-2" name="fakta_positif[]" rows="10">{{ old('fakta_positif.0', '') }}</textarea>
|
||||
<button class="btn btn-danger btn-sm remove-btn" type="button" style="display: none;">
|
||||
<button class="btn btn-danger btn-sm remove-btn" type="button"
|
||||
style="display: none;">
|
||||
<i class="ki-outline ki-trash"></i>
|
||||
</button>
|
||||
</div>
|
||||
@@ -410,7 +451,8 @@
|
||||
@else
|
||||
<div class="fakta_negatif flex items-center gap-2 mt-2 textarea-group w-full">
|
||||
<textarea class="textarea mt-2" name="fakta_negatif[]" rows="10">{{ old('fakta_negatif.0', $forminspeksi['fakta']['fakta_negatif'][0] ?? '') }}</textarea>
|
||||
<button class="btn btn-danger btn-sm remove-btn" type="button" style="display: none;">
|
||||
<button class="btn btn-danger btn-sm remove-btn" type="button"
|
||||
style="display: none;">
|
||||
<i class="ki-outline ki-trash"></i>
|
||||
</button>
|
||||
<em id="error-fakta_negatif" class="alert text-danger text-sm"></em>
|
||||
@@ -463,10 +505,10 @@
|
||||
|
||||
<div class="flex justify-end gap-2" style="margin-right: 20px; margin-top: 20px">
|
||||
@if (Auth::user()->hasAnyRole(['senior-officer', 'surveyor', 'administrator']))
|
||||
<button type="button" class="btn btn-primary" id="saveButton" onclick="submitData()">
|
||||
<i class="ki-filled ki-save-2"></i>
|
||||
<span id="saveButtonText">Save</span>
|
||||
</button>
|
||||
<button type="button" class="btn btn-primary" id="saveButton" onclick="submitData()">
|
||||
<i class="ki-filled ki-save-2"></i>
|
||||
<span id="saveButtonText">Save</span>
|
||||
</button>
|
||||
@endif
|
||||
@if (Auth::user()->hasAnyRole(['senior-officer', 'EO Appraisal', 'DD Appraisal']))
|
||||
<a class="btn btn-info"
|
||||
@@ -501,24 +543,41 @@
|
||||
perihal: "",
|
||||
pihak_kjjpp: "",
|
||||
dari: "",
|
||||
lelang: "",
|
||||
nilai_pasar: "",
|
||||
persentase_likuidasi: "",
|
||||
hasil_nilai_likuidasi: ""
|
||||
lelang_kjpp: "",
|
||||
nilai_pasar_kjpp: "",
|
||||
persentase_likuidasi_kjpp: "",
|
||||
hasil_nilai_likuidasi_kjpp: "",
|
||||
lelang_internal: "",
|
||||
nilai_pasar_internal: "",
|
||||
persentase_likuidasi_internal: "",
|
||||
hasil_nilai_likuidasi_internal: "",
|
||||
|
||||
};
|
||||
|
||||
|
||||
jsonData.perihal = document.querySelector('input[name="perihal"]')?.value.trim() || "";
|
||||
jsonData.pihak_kjjpp = document.querySelector('input[name="pihak_kjjpp"]')?.value.trim() || "";
|
||||
jsonData.dari = document.querySelector('input[name="dari"]')?.value.trim() || "";
|
||||
jsonData.tanggal = document.querySelector('input[name="tanggal"]')?.value.trim() || "";
|
||||
jsonData.kepada = document.querySelector('input[name="kepada"]')?.value.trim() || "";
|
||||
jsonData.nomor_laporan = document.querySelector('input[name="nomor_laporan"]')?.value.trim() || "";
|
||||
jsonData.lelang = document.querySelector('input[name="lelang"]')?.value.trim() || "";
|
||||
jsonData.lelang_kjpp = document.querySelector('input[name="lelang_kjpp"]')?.value.trim() || "";
|
||||
|
||||
// Ambil nilai lainnya
|
||||
jsonData.nilai_pasar = cleanCurrencyValue(document.querySelector('input[name="nilai_pasar"]')?.value.trim() || "");
|
||||
jsonData.persentase_likuidasi = cleanCurrencyValue(document.querySelector('input[name="likuidasi"]')?.value.trim() || "");
|
||||
jsonData.hasil_nilai_likuidasi = cleanCurrencyValue(document.querySelector('input[name="likuidasi_nilai_1"]')?.value.trim() || "");
|
||||
jsonData.nilai_pasar_kjpp = cleanCurrencyValue(document.querySelector('input[name="nilai_pasar_kjpp"]')?.value.trim() ||
|
||||
"");
|
||||
jsonData.persentase_likuidasi_kjpp = cleanCurrencyValue(document.querySelector('input[name="persentase_likuidasi_kjpp"]')?.value
|
||||
.trim() || "");
|
||||
jsonData.hasil_nilai_likuidasi_kjpp = cleanCurrencyValue(document.querySelector('input[name="hasil_nilai_likuidasi_kjpp"]')
|
||||
?.value.trim() || "");
|
||||
|
||||
jsonData.lelang_internal = document.querySelector('input[name="lelang_internal"]')?.value.trim() || "";
|
||||
jsonData.nilai_pasar_internal = cleanCurrencyValue(document.querySelector('input[name="nilai_pasar_internal"]')?.value.trim() ||
|
||||
"");
|
||||
jsonData.persentase_likuidasi_internal = cleanCurrencyValue(document.querySelector('input[name="persentase_likuidasi_internal"]')?.value
|
||||
.trim() || "");
|
||||
jsonData.hasil_nilai_likuidasi_internal = cleanCurrencyValue(document.querySelector('input[name="hasil_nilai_likuidasi_internal"]')
|
||||
?.value.trim() || "");
|
||||
|
||||
return jsonData;
|
||||
}
|
||||
@@ -533,22 +592,22 @@
|
||||
const inspeksiId = urlParams.get('inspeksiId');
|
||||
|
||||
const faktaPositif = Array.from(document.querySelectorAll('[name="fakta_positif[]"]'))
|
||||
.map(textarea => textarea.value.trim())
|
||||
.filter(value => value !== '');
|
||||
.map(textarea => textarea.value.trim())
|
||||
.filter(value => value !== '');
|
||||
|
||||
const faktaNegatif = Array.from(document.querySelectorAll('[name="fakta_negatif[]"]'))
|
||||
.map(textarea => textarea.value.trim())
|
||||
.filter(value => value !== '');
|
||||
const keterangan = Array.from(document.querySelectorAll('[name="keterangan[]"]'))
|
||||
.map(textarea => textarea.value.trim())
|
||||
.filter(value => value !== '');
|
||||
const faktaNegatif = Array.from(document.querySelectorAll('[name="fakta_negatif[]"]'))
|
||||
.map(textarea => textarea.value.trim())
|
||||
.filter(value => value !== '');
|
||||
const keterangan = Array.from(document.querySelectorAll('[name="keterangan[]"]'))
|
||||
.map(textarea => textarea.value.trim())
|
||||
.filter(value => value !== '');
|
||||
|
||||
const action = Array.from(document.querySelectorAll('input[name="action"]'))
|
||||
.map(input => input.value)
|
||||
.join(',') || "";
|
||||
const type = Array.from(document.querySelectorAll('input[name="type"]'))
|
||||
.map(input => input.value)
|
||||
.join(',') || "";
|
||||
const action = Array.from(document.querySelectorAll('input[name="action"]'))
|
||||
.map(input => input.value)
|
||||
.join(',') || "";
|
||||
const type = Array.from(document.querySelectorAll('input[name="type"]'))
|
||||
.map(input => input.value)
|
||||
.join(',') || "";
|
||||
const requestUrl =
|
||||
`{{ route('penilai.storeCallReport') }}?permohonan_id=${permohonanId}&inspeksi_id=${inspeksiId}&dokument_id=${documentId}`;
|
||||
|
||||
@@ -563,10 +622,10 @@
|
||||
inspeksi_id: inspeksiId,
|
||||
data: jsonData,
|
||||
fakta_positif: faktaPositif,
|
||||
fakta_negatif: faktaNegatif,
|
||||
action: action,
|
||||
type: type,
|
||||
keterangan: keterangan
|
||||
fakta_negatif: faktaNegatif,
|
||||
action: action,
|
||||
type: type,
|
||||
keterangan: keterangan
|
||||
}),
|
||||
contentType: 'application/json',
|
||||
headers: {
|
||||
@@ -613,29 +672,33 @@
|
||||
}
|
||||
</script>
|
||||
<script>
|
||||
function calculateTotal() {
|
||||
let nilaiPasarInput = document.getElementById('nilai-pasar');
|
||||
let nilaiLikuidasi = document.getElementById('likuidasi');
|
||||
let totalLikuidasi = document.getElementById('total-likuidasi');
|
||||
const cleanNilaiPasar = cleanCurrencyValue(nilaiPasarInput.value);
|
||||
let cleanLikuidasi = cleanCurrencyValue(nilaiLikuidasi.value);
|
||||
function calculateTotal(event) {
|
||||
const group = event.dataset.group;
|
||||
|
||||
// Batasi likuidasi maksimal hingga 100
|
||||
cleanLikuidasi = Math.min(parseFloat(cleanLikuidasi) || 0, 100);
|
||||
// Ambil elemen-elemen terkait berdasarkan group
|
||||
const nilaiPasarInput = document.querySelector(`#nilai-pasar-${group}`);
|
||||
const nilaiLikuidasi = document.querySelector(`#likuidasi-${group}`);
|
||||
const totalLikuidasi = document.querySelector(`#total-likuidasi-${group}`);
|
||||
|
||||
// Format nilai likuidasi dengan simbol %
|
||||
nilaiLikuidasi.value = cleanLikuidasi;
|
||||
const cleanNilaiPasar = cleanCurrencyValue(nilaiPasarInput.value);
|
||||
let cleanLikuidasi = cleanCurrencyValue(nilaiLikuidasi.value);
|
||||
|
||||
// Konversi ke angka untuk perhitungan
|
||||
const nilaiPasar = parseFloat(cleanNilaiPasar) || 0;
|
||||
const likuidasi = cleanLikuidasi / 100; // Konversi persentase ke desimal
|
||||
// Batasi likuidasi maksimal hingga 100
|
||||
cleanLikuidasi = Math.min(parseFloat(cleanLikuidasi) || 0, 100);
|
||||
|
||||
// Hitung total likuidasi
|
||||
const totalNilaiLikuidasi = nilaiPasar * likuidasi;
|
||||
// Format nilai likuidasi dengan simbol %
|
||||
nilaiLikuidasi.value = cleanLikuidasi;
|
||||
|
||||
// Tampilkan hasil dengan format yang benar
|
||||
totalLikuidasi.value = formatCurrency(totalNilaiLikuidasi.toString());
|
||||
}
|
||||
// Konversi ke angka untuk perhitungan
|
||||
const nilaiPasar = parseFloat(cleanNilaiPasar) || 0;
|
||||
const likuidasi = cleanLikuidasi / 100; // Konversi persentase ke desimal
|
||||
|
||||
// Hitung total likuidasi
|
||||
const totalNilaiLikuidasi = nilaiPasar * likuidasi;
|
||||
|
||||
// Tampilkan hasil dengan format yang benar
|
||||
totalLikuidasi.value = formatCurrency(totalNilaiLikuidasi.toString());
|
||||
}
|
||||
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
|
||||
@@ -206,7 +206,14 @@
|
||||
|
||||
if (data.status === 'proses-survey' || data.status == 'rejected-reschedule') {
|
||||
actionHtml += `
|
||||
<a onclick="surveyorRescheduleJadwalSurvey(${data.id},${data.penilaian.id},'${data.nomor_registrasi}', '${data.debiture.name}', '${data.penilaian.waktu_penilaian}', ${JSON.stringify(data.penilaian.rejected_note)})" class="delete btn btn-sm btn-outline btn-light" title="Reschedule Jadwal Survey">
|
||||
<a onclick="surveyorRescheduleJadwalSurvey(
|
||||
${data.id},
|
||||
${data.penilaian.id},
|
||||
${data.nomor_registrasi},
|
||||
${data.debiture.name},
|
||||
${data.penilaian.waktu_penilaian},
|
||||
${JSON.stringify(data.penilaian.rejected_note)}
|
||||
)" class="delete btn btn-sm btn-outline btn-light" title="Reschedule Jadwal Survey">
|
||||
<i class="ki-filled ki-calendar-remove"></i>
|
||||
</a>`;
|
||||
}
|
||||
|
||||
@@ -5,8 +5,6 @@
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<link rel="stylesheet" href="https://unpkg.com/dropzone@5/dist/min/dropzone.min.css" type="text/css" />
|
||||
{{-- <link rel="stylesheet" href="https://uicdn.toast.com/tui-image-editor/latest/tui-image-editor.css" /> --}}
|
||||
<style>
|
||||
.dropzone {
|
||||
border: 2px dashed #3498db;
|
||||
@@ -266,9 +264,6 @@
|
||||
@include('lpj::surveyor.js.fotojs')
|
||||
@include('lpj::surveyor.js.utils')
|
||||
@push('scripts')
|
||||
<script src="https://unpkg.com/dropzone@5/dist/min/dropzone.min.js"></script>
|
||||
<script src="https://scaleflex.cloudimg.io/v7/plugins/filerobot-image-editor/latest/filerobot-image-editor.min.js">
|
||||
</script>
|
||||
<script>
|
||||
let jsonDataContoh = @json($formFoto);
|
||||
Dropzone.autoDiscover = false;
|
||||
@@ -609,7 +604,7 @@
|
||||
e.preventDefault();
|
||||
// Get the file path from hidden input
|
||||
const filePath = document.getElementById('editDataFilePath').value;
|
||||
|
||||
|
||||
if (filePath) {
|
||||
openFilerobotEditor(filePath);
|
||||
} else {
|
||||
@@ -632,20 +627,9 @@
|
||||
const config = {
|
||||
source: imagePath || '',
|
||||
onSave: (editedImageObject, designState) => {
|
||||
console.log('Image saved', editedImageObject);
|
||||
|
||||
// Save the edited image
|
||||
saveEditedImage(editedImageObject, document.getElementById('editDataFilePath').value);
|
||||
window.FilerobotImageEditor.terminate();
|
||||
|
||||
// Close the editor
|
||||
FilerobotImageEditor.terminate();
|
||||
|
||||
// Hide the modal
|
||||
document.getElementById('modal_10').setAttribute('data-modal-dismiss', 'true');
|
||||
|
||||
|
||||
// Update the preview if needed
|
||||
updateImagePreview(editedImageObject.imageBase64 || editedImageObject.imageCanvas.toDataURL());
|
||||
},
|
||||
annotationsCommon: {
|
||||
fill: '#ff0000'
|
||||
@@ -681,17 +665,29 @@
|
||||
config
|
||||
);
|
||||
|
||||
// Render the editor
|
||||
|
||||
filerobotImageEditor.render({
|
||||
onClose: (closingReason) => {
|
||||
console.log('Editor closed:', closingReason);
|
||||
|
||||
filerobotImageEditor.terminate();
|
||||
|
||||
// Hide the modal
|
||||
document.querySelector('#modal_10').setAttribute('data-modal-dismiss', 'true');
|
||||
let closeButton = document.getElementById('modal_10');
|
||||
|
||||
if (!closeButton) {
|
||||
closeButton = document.createElement('button');
|
||||
closeButton.setAttribute('data-modal-dismiss', 'true');
|
||||
closeButton.setAttribute('type', 'button');
|
||||
closeButton.setAttribute('class', 'btn btn-primary');
|
||||
closeButton.setAttribute('data-modal-toggle', '#modal_10');
|
||||
document.body.appendChild(closeButton);
|
||||
}
|
||||
|
||||
closeButton.click();
|
||||
console.log('Modal closed via close button simulation');
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
window.addEditAndDeleteButtons = function(file, response) {
|
||||
|
||||
@@ -828,16 +824,23 @@
|
||||
formData.append('original_path', originalFilePath);
|
||||
|
||||
formData.forEach((value, key) => {
|
||||
console.log(`${key}:`, value);
|
||||
});
|
||||
console.log(`${key}:`, value);
|
||||
});
|
||||
|
||||
fetch('/api/save-edited-image', {
|
||||
method: 'POST',
|
||||
body: formData
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
|
||||
$.ajax({
|
||||
url: `{{ route('surveyor.saveEditedImage') }}`,
|
||||
type: 'POST',
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': '{{ csrf_token() }}'
|
||||
},
|
||||
data: {
|
||||
edited_image: imageData,
|
||||
original_path: originalFilePath,
|
||||
nomor_registrasi: '{{ $permohonan->nomor_registrasi }}'
|
||||
},
|
||||
|
||||
success: function(response) {
|
||||
Swal.fire({
|
||||
icon: 'success',
|
||||
title: 'Perubahan Disimpan',
|
||||
@@ -848,17 +851,23 @@
|
||||
window.location.reload();
|
||||
|
||||
}
|
||||
});;
|
||||
|
||||
})
|
||||
.catch(error => {
|
||||
});
|
||||
},
|
||||
error: function(xhr) {
|
||||
const errorMessage = xhr.responseJSON?.message || 'Terjadi kesalahan';
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Gagal Menyimpan',
|
||||
text: errorMessage,
|
||||
}).then((response) => {
|
||||
if (response.isConfirmed) {
|
||||
window.location.reload();
|
||||
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
@@ -101,6 +101,8 @@
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
<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) {
|
||||
|
||||
@@ -308,12 +310,33 @@
|
||||
<div class="text-left space-y-4">
|
||||
<p class="text-gray-700 text-center">Untuk membuat jadwal kunjungan, silahkan isi form berikut!</p>
|
||||
<div>
|
||||
<label for="waktu_penilaian" class="block text-sm font-medium text-gray-700 mb-1 " style="text-align: start;">Jadwal Kunjungan <span class="text-danger">*</span></label>
|
||||
<input type="datetime-local" id="waktu_penilaian" class="input" style="margin-top: 10px;" required>
|
||||
<label for="tanggal_kunjungan" class="block text-sm font-medium text-gray-700 mb-1" style="text-align: start;">Tanggal Kunjungan <span class="text-danger">*</span></label>
|
||||
<input type="date" id="tanggal_kunjungan" class="input" style="margin-top: 10px; width: 100%;" required>
|
||||
</div>
|
||||
<div>
|
||||
<label for="deskripsi_penilaian" class="block text-sm font-medium text-gray-700 mb-1 mt-2" style="text-align: start;">Keterangan <span class="text-danger">*</span> </label>
|
||||
<textarea id="deskripsi-penilaian" class="textarea" placeholder="Masukkan keterangan" style="margin-top: 10px;" required></textarea>
|
||||
<label class="block text-sm font-medium text-gray-700 mb-1 mt-2" style="text-align: start;">Waktu Kunjungan (Format 24 Jam) <span class="text-danger">*</span></label>
|
||||
<div style="display: flex; align-items: center; gap: 10px; margin-top: 10px;">
|
||||
<div style="position: relative; flex: 1;">
|
||||
<input type="text" id="jam_kunjungan" class="input" maxlength="2" style="width: 100%; text-align: center; padding-right: 30px;" placeholder="00">
|
||||
<div style="position: absolute; right: 5px; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column;">
|
||||
<button type="button" id="jam_up" class="btn btn-xs btn-light" style="height: 12px; padding: 0 4px; font-size: 10px; margin-bottom: 2px;">▲</button>
|
||||
<button type="button" id="jam_down" class="btn btn-xs btn-light" style="height: 12px; padding: 0 4px; font-size: 10px;">▼</button>
|
||||
</div>
|
||||
</div>
|
||||
<span style="font-weight: bold;">:</span>
|
||||
<div style="position: relative; flex: 1;">
|
||||
<input type="text" id="menit_kunjungan" class="input" maxlength="2" style="width: 100%; text-align: center; padding-right: 30px;" placeholder="00">
|
||||
<div style="position: absolute; right: 5px; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column;">
|
||||
<button type="button" id="menit_up" class="btn btn-xs btn-light" style="height: 12px; padding: 0 4px; font-size: 10px; margin-bottom: 2px;">▲</button>
|
||||
<button type="button" id="menit_down" class="btn btn-xs btn-light" style="height: 12px; padding: 0 4px; font-size: 10px;">▼</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div>
|
||||
<label for="deskripsi-penilaian" class="block text-sm font-medium text-gray-700 mb-1 mt-2" style="text-align: start;">Keterangan <span class="text-danger">*</span> </label>
|
||||
<textarea id="deskripsi-penilaian" class="textarea" placeholder="Masukkan keterangan" style="margin-top: 10px;" required></textarea>
|
||||
</div>
|
||||
</div>
|
||||
`,
|
||||
@@ -322,14 +345,120 @@
|
||||
cancelButtonColor: '#d33',
|
||||
confirmButtonText: 'Submit',
|
||||
cancelButtonText: 'Batal',
|
||||
didOpen: () => {
|
||||
// Set default value ke waktu saat ini
|
||||
const now = new Date();
|
||||
const dateString = now.toISOString().slice(0, 10);
|
||||
const hours = now.getHours();
|
||||
const minutes = now.getMinutes();
|
||||
|
||||
// Set default values
|
||||
document.getElementById('tanggal_kunjungan').value = dateString;
|
||||
document.getElementById('jam_kunjungan').value = hours.toString().padStart(2, '0');
|
||||
document.getElementById('menit_kunjungan').value = minutes.toString().padStart(2, '0');
|
||||
|
||||
// Handler untuk input jam
|
||||
const jamInput = document.getElementById('jam_kunjungan');
|
||||
const jamUp = document.getElementById('jam_up');
|
||||
const jamDown = document.getElementById('jam_down');
|
||||
|
||||
// Validasi hanya angka untuk jam
|
||||
jamInput.addEventListener('input', function(e) {
|
||||
this.value = this.value.replace(/[^0-9]/g, '').substring(0, 2);
|
||||
let value = parseInt(this.value, 10);
|
||||
|
||||
if (!isNaN(value)) {
|
||||
if (value > 23) {
|
||||
this.value = "00";
|
||||
} else {
|
||||
this.value = value.toString().padStart(2, '0');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
jamInput.addEventListener('blur', function() {
|
||||
if (this.value === "" || isNaN(parseInt(this.value, 10))) {
|
||||
this.value = "00";
|
||||
} else {
|
||||
this.value = parseInt(this.value, 10).toString().padStart(2, '0');
|
||||
}
|
||||
});
|
||||
|
||||
// Button handlers untuk jam
|
||||
jamUp.addEventListener('click', function() {
|
||||
let value = parseInt(jamInput.value, 10);
|
||||
if (isNaN(value)) value = 0;
|
||||
|
||||
value = (value + 1) % 24;
|
||||
jamInput.value = value.toString().padStart(2, '0');
|
||||
});
|
||||
|
||||
jamDown.addEventListener('click', function() {
|
||||
let value = parseInt(jamInput.value, 10);
|
||||
if (isNaN(value)) value = 0;
|
||||
|
||||
value = (value - 1 + 24) % 24;
|
||||
jamInput.value = value.toString().padStart(2, '0');
|
||||
});
|
||||
|
||||
// Handler untuk input menit
|
||||
const menitInput = document.getElementById('menit_kunjungan');
|
||||
const menitUp = document.getElementById('menit_up');
|
||||
const menitDown = document.getElementById('menit_down');
|
||||
|
||||
// Validasi hanya angka untuk menit
|
||||
menitInput.addEventListener('input', function(e) {
|
||||
this.value = this.value.replace(/[^0-9]/g, '').substring(0, 2);
|
||||
let value = parseInt(this.value, 10);
|
||||
|
||||
if (!isNaN(value)) {
|
||||
if (value > 59) {
|
||||
this.value = "00";
|
||||
} else {
|
||||
this.value = value.toString().padStart(2, '0');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
menitInput.addEventListener('blur', function() {
|
||||
if (this.value === "" || isNaN(parseInt(this.value, 10))) {
|
||||
this.value = "00";
|
||||
} else {
|
||||
this.value = parseInt(this.value, 10).toString().padStart(2, '0');
|
||||
}
|
||||
});
|
||||
|
||||
// Button handlers untuk menit
|
||||
menitUp.addEventListener('click', function() {
|
||||
let value = parseInt(menitInput.value, 10);
|
||||
if (isNaN(value)) value = 0;
|
||||
|
||||
value = (value + 1) % 60;
|
||||
menitInput.value = value.toString().padStart(2, '0');
|
||||
});
|
||||
|
||||
menitDown.addEventListener('click', function() {
|
||||
let value = parseInt(menitInput.value, 10);
|
||||
if (isNaN(value)) value = 0;
|
||||
|
||||
value = (value - 1 + 60) % 60;
|
||||
menitInput.value = value.toString().padStart(2, '0');
|
||||
});
|
||||
},
|
||||
preConfirm: () => {
|
||||
// Ambil nilai input
|
||||
const tanggalInspeksi = document.getElementById('waktu_penilaian').value;
|
||||
const tanggalKunjungan = document.getElementById('tanggal_kunjungan').value;
|
||||
let jamKunjungan = document.getElementById('jam_kunjungan').value;
|
||||
let menitKunjungan = document.getElementById('menit_kunjungan').value;
|
||||
const keteranganInspeksi = document.getElementById('deskripsi-penilaian').value;
|
||||
|
||||
// Validasi input: cek apakah input kosong
|
||||
if (!tanggalInspeksi.trim()) {
|
||||
Swal.showValidationMessage('Harap mengisi Jadwal Kunjungan.');
|
||||
if (!tanggalKunjungan.trim()) {
|
||||
Swal.showValidationMessage('Harap mengisi Tanggal Kunjungan.');
|
||||
return false;
|
||||
}
|
||||
if (!jamKunjungan || !menitKunjungan) {
|
||||
Swal.showValidationMessage('Harap mengisi Waktu Kunjungan.');
|
||||
return false;
|
||||
}
|
||||
if (!keteranganInspeksi.trim()) {
|
||||
@@ -337,9 +466,16 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
// Pastikan format 2 digit
|
||||
jamKunjungan = parseInt(jamKunjungan, 10).toString().padStart(2, '0');
|
||||
menitKunjungan = parseInt(menitKunjungan, 10).toString().padStart(2, '0');
|
||||
|
||||
// Gabungkan tanggal dan waktu dalam format ISO
|
||||
const datetimeValue = `${tanggalKunjungan}T${jamKunjungan}:${menitKunjungan}`;
|
||||
|
||||
// Jika semua valid, kembalikan data
|
||||
return {
|
||||
tanggal: tanggalInspeksi,
|
||||
tanggal: datetimeValue,
|
||||
keterangan: keteranganInspeksi
|
||||
};
|
||||
}
|
||||
@@ -360,17 +496,15 @@
|
||||
deskripsi_penilaian: keterangan
|
||||
};
|
||||
|
||||
// Change from PUT to POST method
|
||||
$.ajax({
|
||||
url: useURL,
|
||||
type: "POST", // Changed from PUT to POST
|
||||
type: "POST",
|
||||
cache: false,
|
||||
data: input_data,
|
||||
success: function(response) {
|
||||
if (response.success) {
|
||||
// Arahkan langsung ke halaman inspeksi
|
||||
Swal.fire('Berhasil!', 'Data berhasil disimpan.', 'success').then(
|
||||
() => {
|
||||
Swal.fire('Berhasil!', 'Berhasil membuat jadwal.', 'success').then(
|
||||
() => {
|
||||
window.location.reload();
|
||||
});
|
||||
} else {
|
||||
|
||||
@@ -3,19 +3,7 @@
|
||||
const ruteLainnyaDiv = document.getElementById("ruteLainnya");
|
||||
const lantaiLainnyaDiv = document.getElementById("lantaiLainnya");
|
||||
|
||||
// Function to add delete event listeners to existing buttons
|
||||
function addDeleteListeners(container) {
|
||||
container.querySelectorAll(".delete-btn").forEach(button => {
|
||||
button.addEventListener("click", function() {
|
||||
this.closest(
|
||||
".flex.items-baseline.flex-wrap.lg\\:flex-nowrap.gap-2\\.5.mb-5")
|
||||
.remove();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// Add delete listeners to existing buttons
|
||||
addDeleteListeners(ruteLainnyaDiv);
|
||||
|
||||
// Create new div for additional items
|
||||
function createNewDiv(container, inputName) {
|
||||
@@ -64,13 +52,8 @@
|
||||
}
|
||||
|
||||
// Event listener for adding more items
|
||||
document.getElementById("btnAddMore").addEventListener("click", function() {
|
||||
createNewDiv(ruteLainnyaDiv, "rute_lainnya");
|
||||
});
|
||||
|
||||
document.getElementById("btnAddMoreObject").addEventListener("click", function() {
|
||||
createNewDiv(lantaiLainnyaDiv, "lantai_lainnya");
|
||||
});
|
||||
|
||||
|
||||
function setupInputHandlers(containerId, buttonId, labelText, inputDataClass, buttonDeleteClass) {
|
||||
const addButton = document.getElementById(buttonId);
|
||||
|
||||
@@ -583,6 +583,7 @@ Route::middleware(['auth'])->group(function () {
|
||||
Route::put('store-approve-reschedule/{id}', [SurveyorController::class, 'approveReschedule'])->name('approveReschedule');
|
||||
Route::put('store-rejected-reschedule/{id}', [SurveyorController::class, 'rejectReschedule'])->name('rejectReschedule');
|
||||
Route::put('store-proses-survey/{id}', [SurveyorController::class, 'storeProsesSurvey'])->name('storeProsesSurvey');
|
||||
Route::post('save-edited-image/', [SurveyorController::class, 'saveEditedImage'])->name('saveEditedImage');
|
||||
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user