perbaikan print out call report
This commit is contained in:
@@ -9,11 +9,13 @@
|
||||
@php
|
||||
$senior_officer = null;
|
||||
$jenisJaminan = null;
|
||||
$tanggalPenilaian = null;
|
||||
if ($permohonan->debiture && $permohonan->documents) {
|
||||
foreach ($permohonan->documents as $dokumen) {
|
||||
$penilai = $permohonan->penilaian->userPenilai->where('role', 'penilai')->first();
|
||||
$teams = $permohonan->region->teams;
|
||||
|
||||
$tanggalPenilaian = $permohonan->penilaian->waktu_penilaian;
|
||||
$jenisJaminan = $dokumen->jenisJaminan->name;
|
||||
if ($teams) {
|
||||
foreach ($teams as $team) {
|
||||
@@ -57,21 +59,21 @@
|
||||
<label class="form-label max-w-56">Kepada</label>
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
<input type="text" name="kepada" class="input w-full" placeholder="Masukkan..."
|
||||
value=" {{ $callReport['kepada'] ?? '' }}">
|
||||
value="{{ $callReport['kepada'] ?? old('kepada') }}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||
<label class="form-label max-w-56">Dari</label>
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
<input type="text" name="dari" class="input w-full" placeholder="Masukkan..."
|
||||
value="{{ $callReport['dari'] ?? $permohonan->branch->name ?? "" }}">
|
||||
value="{{ $callReport['dari'] ?? ($permohonan->branch->name ?? old('dari')) }}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||
<label class="form-label max-w-56">Nomor Laporan</label>
|
||||
<div class="flex flex-wrap items-base line w-full">
|
||||
<input type="text" name="nomor_rap" class="input w-full" placeholder="Masukkan..."
|
||||
value="{{ $nomorLaporan ?? '' }}" @readonly(true)>
|
||||
<input type="text" name="nomor_rap" class="input w-full cursor-not-allowed"
|
||||
placeholder="Masukkan..." value="{{ $nomorLaporan ?? '' }}" @readonly(true)>
|
||||
</div>
|
||||
</div>
|
||||
{{-- 250109828129/ --}}
|
||||
@@ -106,34 +108,36 @@
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="grid gap-5 w-full">
|
||||
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||
<div class="grid gap-2.5 w-full">
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5 w-full">
|
||||
<label for="nama_debiture" class="form-label max-w-56">Nama Debitur</label>
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
<input type="text" id="nama_debiture" name="nama_debiture" class="input w-full"
|
||||
placeholder="Nama Debiture"
|
||||
value="{{ $permohonan->debiture->name ?? old('nama_debiture') }}" @readonly(true)>
|
||||
<input type="text" id="nama_debiture" name="nama_debiture"
|
||||
class="input w-full cursor-not-allowed" placeholder="Nama Debiture"
|
||||
value="{{ $permohonan->debiture->name ?? old('nama_debiture') }}"
|
||||
@readonly(true)>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5 w-full">
|
||||
<label for="kjjp" class="form-label max-w-56">KJPP</label>
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
<input type="text" id="kjjp" name="kjjp" class="input w-full"
|
||||
placeholder="Masukkan kjjp"
|
||||
>
|
||||
<div class="flex flex-wrap items-baseline w-full ">
|
||||
<input type="text" id="kjjp" name="kjjp"
|
||||
class="input w-full cursor-not-allowed" placeholder="Masukkan kjjp"
|
||||
value="{{ preg_replace('/^K\\d+ - /', '', $permohonan->penawaran->nama_kjpp_sebelumnya ?? old('kjjp')) }}
|
||||
"
|
||||
@readonly(true)>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||
<label class="form-label max-w-56">Jenis Aset</label>
|
||||
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
<input type="text" id="jenis_asset" name="jenis_asset" class="input w-full"
|
||||
placeholder="Masukkan jenis_asset" value="{{ $jenisJaminan ?? old('jenis_asset') }}"
|
||||
@readonly(true)>
|
||||
<input type="text" id="jenis_asset" name="jenis_asset"
|
||||
class="input w-full cursor-not-allowed" placeholder="Masukkan jenis_asset"
|
||||
value="{{ $jenisJaminan ?? old('jenis_asset') }}" @readonly(true)>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -141,34 +145,14 @@
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5 w-full">
|
||||
<label for="penilai" class="form-label max-w-56">Tanggal Penilaian </label>
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
<input type="date" id="tanggal_penilaian" name="tanggal_penilaian" class="input w-full"
|
||||
placeholder="Masukkan Tanggal Penilai"
|
||||
value="{{ $memo->lokasi->penilai ?? old('penilai') }}">
|
||||
</div>
|
||||
</div>
|
||||
<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="{{ $memo->lokasi->penilai ?? old('penilai') }}">
|
||||
</div>
|
||||
</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="likuidasi" name="likuidasi" class="input w-full"
|
||||
placeholder="Masukkan likuidasi" value="{{ old('likuidasi') }}">
|
||||
</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 (NL)</label>
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
<input type="text" id="likuidasi_nilai_1" name="likuidasi_nilai_1" class="input w-full"
|
||||
placeholder="Masukkan likuidasi_nilai_1" value="">
|
||||
<input type="datetime" id="tanggal_penilaian" name="tanggal_penilaian"
|
||||
class="input w-full cursor-not-allowed" placeholder="Masukkan Tanggal Penilai"
|
||||
value="{{ $tanggalPenilaian ?? old('penilai') }}" @readonly(true)>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -177,6 +161,98 @@
|
||||
</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">lokasi objek
|
||||
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
<div class="card-body grid gap-2.5 w-full">
|
||||
|
||||
<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 : '' }}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<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 : '' }}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<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 : '' }}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<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 : '' }}">
|
||||
</div>
|
||||
</div>
|
||||
</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">Dokument</h1>
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
@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>
|
||||
|
||||
<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="{{ $memo->lokasi->penilai ?? old('penilai') }}">
|
||||
</div>
|
||||
</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="likuidasi"
|
||||
class="input w-full nilai-pasar currency-format" placeholder="Masukkan likuidasi"
|
||||
value="{{ old('likuidasi') }}">
|
||||
</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_nilai_1" class="input w-full likuidasi"
|
||||
placeholder="Masukkan likuidasi dalam bentuk persen" onkeyup="calculateTotal(this)">
|
||||
</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" placeholder="Masukkan likuidasi" value="">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="card border border-agi-100 w-full bg-white rounded-lg shadow-md ">
|
||||
<div class="card-header bg-agi-50">
|
||||
@@ -192,8 +268,8 @@
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5 w-full">
|
||||
<label for="staf" class="form-label max-w-56">Staf Subdit Appraisal </label>
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
<input type="text" id="staf" name="staf" class="input w-full"
|
||||
placeholder="Masukkan Nama Staff"
|
||||
<input type="text" id="staf" name="staf"
|
||||
class="input w-full cursor-not-allowed" placeholder="Masukkan Nama Staff"
|
||||
value="{{ $penilai->userPenilaiTeam->name ?? '' }}" @readonly(true)>
|
||||
</div>
|
||||
</div>
|
||||
@@ -202,16 +278,19 @@
|
||||
<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'] ?? ''}}" @readonly(true) placeholder="Masukkan Nama KJPP">
|
||||
<input type="text" id="penilai" name="pihak_kjjpp"
|
||||
class="input w-full cursor-not-allowed"
|
||||
value="{{ $forminspeksi['signature']['kjjp']['name'] ?? '' }}"
|
||||
@readonly(true) placeholder="Masukkan Nama KJPP">
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5 w-full">
|
||||
<label for="pihak_bag" class="form-label max-w-56">Pihak BAGI Cab </label>
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
|
||||
<input type="text" id="pihak_bag" name="pihak_bag" class="input w-full"
|
||||
placeholder="Masukkan Pihak Bag" value="{{ $permohonan->user->name ?? '' }} || {{ $permohonan->branch->name }}"
|
||||
<input type="text" id="pihak_bag" name="pihak_bag"
|
||||
class="input w-full cursor-not-allowed" placeholder="Masukkan Pihak Bag"
|
||||
value="{{ $permohonan->user->name ?? '' }} || {{ $permohonan->branch->name }}"
|
||||
@readonly(true)>
|
||||
</div>
|
||||
</div>
|
||||
@@ -219,11 +298,23 @@
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5 w-full">
|
||||
<label for="debitur_perwakilan" class="form-label max-w-56">Debitur/perwakilan debitur
|
||||
</label>
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
<input type="text" id="debitur_perwakilan" name="debitur_perwakilan"
|
||||
class="input w-full" placeholder="Masukkan Penilai"
|
||||
value="{{ $permohonan->debiture->name ?? '' }}" @readonly(true)>
|
||||
</div>
|
||||
|
||||
@if (isset($forminspeksi['asset']['debitur_perwakilan']))
|
||||
@foreach ($forminspeksi['asset']['debitur_perwakilan'] as $item)
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
<input type="text" id="debitur_perwakilan" name="debitur_perwakilan"
|
||||
class="input w-full cursor-not-allowed" placeholder="Masukkan Penilai"
|
||||
value="{{ $item ?? '' }}" @readonly(true)>
|
||||
</div>
|
||||
@endforeach
|
||||
@else
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
<input type="text" id="debitur_perwakilan" name="debitur_perwakilan"
|
||||
class="input w-full cursor-not-allowed" placeholder="Masukkan Penilai"
|
||||
value="{{ $permohonan->debiture->name ?? '' }}" @readonly(true)>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -319,132 +410,10 @@
|
||||
</div>
|
||||
@endsection
|
||||
@push('scripts')
|
||||
{{-- <script type="text/javascript">
|
||||
<script type="text/javascript">
|
||||
const callReport = @json($forminspeksi ?? '');
|
||||
console.log('callReport', callReport)
|
||||
|
||||
function updateAlamatFields(status) {
|
||||
// Ambil elemen formulir
|
||||
const addressForm = document.getElementById('alamat_form');
|
||||
const inputs = addressForm.querySelectorAll('input, select');
|
||||
const addressInput = document.getElementById('address');
|
||||
|
||||
if (status === 'sesuai') {
|
||||
addressInput.value = "{{ $dokumen->address ?? '' }}";
|
||||
inputs.forEach(element => {
|
||||
if (element.tagName === 'INPUT') {
|
||||
element.setAttribute('readonly', true);
|
||||
} else if (element.tagName === 'SELECT') {
|
||||
element.setAttribute('disabled', true);
|
||||
element.classList.add('disabled-input')
|
||||
}
|
||||
});
|
||||
|
||||
addressForm.style.display = 'grid';
|
||||
addressForm.disabled = true;
|
||||
addressForm.classList.add('disabled-input')
|
||||
|
||||
|
||||
} else if (status === 'tidak sesuai') {
|
||||
addressForm.style.display = 'grid';
|
||||
|
||||
addressForm.removeAttribute('disabled');
|
||||
addressForm.classList.remove('disabled-input')
|
||||
const formInspeksi = @json($forminspeksi);
|
||||
const addressInput = document.getElementById('address');
|
||||
|
||||
if (formInspeksi && formInspeksi.asset && formInspeksi.asset.alamat) {
|
||||
if (formInspeksi.asset.alamat['tidak sesuai'] && formInspeksi.asset.alamat['tidak sesuai'].address) {
|
||||
addressInput.value = formInspeksi.asset.alamat['tidak sesuai'].address;
|
||||
} else if (formInspeksi.asset.alamat['sesuai'] && formInspeksi.asset.alamat['sesuai'].address) {
|
||||
addressInput.value = formInspeksi.asset.alamat['sesuai'].address;
|
||||
} else {
|
||||
addressInput.value = "";
|
||||
}
|
||||
}
|
||||
|
||||
inputs.forEach(element => {
|
||||
if (element.tagName === 'INPUT') {
|
||||
element.removeAttribute('readonly');
|
||||
} else if (element.tagName === 'SELECT') {
|
||||
element.removeAttribute('disabled');
|
||||
element.classList.remove('disabled-input')
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function toggleFieldVisibility(fieldName, inputId, visibleValues = []) {
|
||||
const selectedValue = $(`[name="${fieldName}"]:checked`).val();
|
||||
const inputField = $(`#${inputId}`);
|
||||
|
||||
if (visibleValues.includes(selectedValue)) {
|
||||
inputField.show();
|
||||
} else {
|
||||
inputField.hide().val('');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function toggleCheckboxVisibility(fieldName, inputId, visibleValues = []) {
|
||||
const selectedValues = $(`[name="${fieldName}[]"]:checked`)
|
||||
.map(function() {
|
||||
return $(this).val().toLowerCase(); // Konversi nilai ke huruf kecil
|
||||
})
|
||||
.get();
|
||||
|
||||
const inputField = $(`#${inputId}`);
|
||||
|
||||
// Cek apakah salah satu nilai yang dipilih cocok dengan visibleValues
|
||||
const shouldShow = visibleValues.some(value => selectedValues.includes(value.toLowerCase()));
|
||||
|
||||
if (shouldShow) {
|
||||
inputField.show();
|
||||
} else {
|
||||
inputField.hide().val('');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function toggleMultipleFields(fieldName, mappings) {
|
||||
// Ambil semua nilai checkbox yang dicentang
|
||||
const selectedValues = $(`[name="${fieldName}[]"]:checked`)
|
||||
.map(function() {
|
||||
return $(this).val().toLowerCase(); // Konversi nilai ke huruf kecil
|
||||
})
|
||||
.get();
|
||||
|
||||
// Iterasi melalui setiap mapping
|
||||
for (const [key, inputId] of Object.entries(mappings)) {
|
||||
const inputField = $(`#${inputId}`);
|
||||
|
||||
// Tampilkan input jika nilai yang relevan dipilih
|
||||
if (selectedValues.includes(key.toLowerCase())) {
|
||||
inputField.show();
|
||||
} else {
|
||||
inputField.hide().val(''); // Sembunyikan dan reset nilai
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function toggleAlamatVisibility(idSesuai, idTidakSesuai, selectedValue) {
|
||||
// Ambil elemen berdasarkan ID
|
||||
const alamatSesuai = document.getElementById(idSesuai);
|
||||
const alamatTidakSesuai = document.getElementById(idTidakSesuai);
|
||||
|
||||
// Periksa nilai yang dipilih dan tampilkan elemen yang sesuai
|
||||
if (selectedValue === 'sesuai') {
|
||||
alamatSesuai.style.display = 'grid'; // Tampilkan "Alamat Sesuai"
|
||||
alamatTidakSesuai.style.display = 'none'; // Sembunyikan "Alamat Tidak Sesuai"
|
||||
} else if (selectedValue === 'tidak sesuai') {
|
||||
alamatSesuai.style.display = 'none'; // Sembunyikan "Alamat Sesuai"
|
||||
alamatTidakSesuai.style.display = 'grid'; // Tampilkan "Alamat Tidak Sesuai"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function submitData() {
|
||||
showLoadingSwal('Mengirim data ke server...');
|
||||
const form = document.querySelector('form');
|
||||
@@ -455,7 +424,7 @@
|
||||
const documentId = urlParams.get('documentId');
|
||||
const inspeksiId = urlParams.get('inspeksiId');
|
||||
const requestUrl =
|
||||
`{{ route('penilai.storeRap') }}?permohonanId=${permohonanId}&inspeksiId=${inspeksiId}&documentId=${documentId}`;
|
||||
`{{ route('penilai.storeCallReport') }}?permohonanId=${permohonanId}&inspeksiId=${inspeksiId}&documentId=${documentId}`;
|
||||
$.ajax({
|
||||
url: requestUrl,
|
||||
type: 'POST',
|
||||
@@ -504,75 +473,46 @@
|
||||
}
|
||||
});
|
||||
}
|
||||
</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);
|
||||
|
||||
// Batasi likuidasi maksimal hingga 100
|
||||
cleanLikuidasi = Math.min(parseFloat(cleanLikuidasi) || 0, 100);
|
||||
|
||||
// Format nilai likuidasi dengan simbol %
|
||||
nilaiLikuidasi.value = cleanLikuidasi;
|
||||
|
||||
// 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());
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Ensure existing remove buttons are functional
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
const removeButtons = document.querySelectorAll('.remove-btn');
|
||||
removeButtons.forEach(button => {
|
||||
button.addEventListener('click', function() {
|
||||
this.closest('.perwakilan').remove();
|
||||
});
|
||||
});
|
||||
|
||||
document.querySelectorAll('.number-format').forEach(input => {
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
// Initialize currency format for existing inputs
|
||||
document.querySelectorAll('.currency-format').forEach(input => {
|
||||
input.addEventListener('input', function() {
|
||||
formatNumber(this);
|
||||
handleCurrencyInput(this);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
function updateAnalisa(params) {
|
||||
const inputMap = {
|
||||
jenis_asset: 'jenis_asset_tidak_sesuai',
|
||||
analisa_tanah: 'analisa_tanah_tidak_sesuai',
|
||||
analisa_unit: 'analisa_luas_unit_tidak_sesuai',
|
||||
analisa_bangunan: 'analisa_bangunan_tidak_sesuai',
|
||||
};
|
||||
|
||||
// Pastikan elemen ID ada di inputMap
|
||||
if (!inputMap[params]) {
|
||||
console.error('Parameter tidak valid:', params);
|
||||
return;
|
||||
}
|
||||
|
||||
// Ambil nilai berdasarkan parameter
|
||||
const inputValue = document.getElementById(inputMap[params]).value;
|
||||
const data = {
|
||||
[params === 'jenis_asset' ? 'jenis_asset' : params.replace('analisa_', 'luas_')]: inputValue,
|
||||
types: params
|
||||
};
|
||||
|
||||
$.ajax({
|
||||
url: '{{ route('surveyor.update_analisa', ['id' => $permohonan->id]) }}',
|
||||
type: 'POST',
|
||||
data: data,
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': '{{ csrf_token() }}'
|
||||
},
|
||||
success: function(response) {
|
||||
console.log(response);
|
||||
if (response.success) {
|
||||
// window.location.href =
|
||||
// '{{ route('surveyor.show', ['id' => $permohonan->id]) }}';
|
||||
toastrSuccessBuild(response.message);
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error('Terjadi error:', error);
|
||||
console.log('Status:', status);
|
||||
console.log('Response:', xhr.responseText);
|
||||
if (xhr.responseJSON.message) {
|
||||
toastrErrorBuild(xhr.responseJSON.message);
|
||||
} else {
|
||||
toastrErrorBuild('Terjadi kesalahan');
|
||||
}
|
||||
// Format initial values if they exist
|
||||
if (input.value) {
|
||||
input.value = formatCurrency(input.value);
|
||||
}
|
||||
});
|
||||
}
|
||||
</script> --}}
|
||||
});
|
||||
</script>
|
||||
@include('lpj::surveyor.js.utils')
|
||||
@endpush
|
||||
|
||||
@@ -782,14 +782,7 @@
|
||||
});
|
||||
});
|
||||
|
||||
function handleCurrencyInput(input) {
|
||||
const value = input.value.replace(/[^\d]/g, '');
|
||||
input.value = formatCurrency(value);
|
||||
}
|
||||
|
||||
function cleanCurrencyValue(value) {
|
||||
return value.replace(/[^\d]/g, '');
|
||||
}
|
||||
|
||||
function calculateTotal(element) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user