579 lines
30 KiB
PHP
579 lines
30 KiB
PHP
@extends('layouts.main')
|
|
|
|
@section('breadcrumbs')
|
|
{{ Breadcrumbs::render(request()->route()->getName()) }}
|
|
@endsection
|
|
|
|
@section('content')
|
|
<div class="w-full grid gap-5 lg:gap-7.5 mx-auto">
|
|
@php
|
|
$senior_officer = null;
|
|
$jenisJaminan = null;
|
|
if ($permohonan->debiture && $permohonan->documents) {
|
|
foreach ($permohonan->documents as $dokumen) {
|
|
$penilai = $permohonan->penilaian->userPenilai->where('role', 'penilai')->first();
|
|
$teams = $permohonan->region->teams;
|
|
|
|
$jenisJaminan = $dokumen->jenisJaminan->name;
|
|
if ($teams) {
|
|
foreach ($teams as $team) {
|
|
$team_users = $team->teamsUsers;
|
|
// print_r($team_users);
|
|
if ($team_users) {
|
|
foreach ($team_users as $team_user) {
|
|
$user = $team_user->user;
|
|
|
|
if ($user && $user->hasRole('senior-officer')) {
|
|
$senior_officer = $user;
|
|
break 3;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
@endphp
|
|
<form id="formInspeksi" method="POST" enctype="multipart/form-data" class="grid gap-5">
|
|
@csrf
|
|
<input type="hidden" name="nomor_registrasi" value="{{ $permohonan->nomor_registrasi ?? '' }}">
|
|
<input type="hidden" name="permohonan_id" value="{{ $permohonan->id ?? '' }}">
|
|
<input type="hidden" name="dokument_id" value="{{ request('documentId') }}">
|
|
<input type="hidden" name="action" value="callReport">
|
|
<input type="hidden" name="type" value="callReport">
|
|
@include('lpj::assetsku.includenya')
|
|
{{-- @include('lpj::surveyor.components.header')
|
|
@include('lpj::surveyor.components.callReport') --}}
|
|
|
|
<div class="card">
|
|
<div class="card-header bg-agi-50">
|
|
<h3 class="card-title uppercase">
|
|
CALL Report
|
|
</h3>
|
|
</div>
|
|
<div class="card-body grid gap-5">
|
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
|
<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'] ?? '' }}">
|
|
</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 ?? "" }}">
|
|
</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)>
|
|
</div>
|
|
</div>
|
|
{{-- 250109828129/ --}}
|
|
|
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
|
<label class="form-label max-w-56">Tanggal</label>
|
|
<div class="flex flex-wrap items-baseline w-full">
|
|
<input type="date" name="tanggal" class="input w-full" placeholder="Masukkan..."
|
|
value="{{ $callReport['tanggal'] ?? '' }}">
|
|
</div>
|
|
</div>
|
|
|
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
|
<label class="form-label max-w-56">Perihal</label>
|
|
<div class="flex flex-wrap items-base line w-full">
|
|
<input type="text" name="perihal" class="input w-full" placeholder="Masukkan..."
|
|
value="{{ $callReport['perihal'] ?? '' }}">
|
|
</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">Menindak lanjuti permintaan <b>
|
|
{{ $permohonan->tujuanPenilaian->name ?? '' }}</b>, BAG CABang
|
|
<b>{{ $permohonan->branch->name }}</b>
|
|
disampaikan hal sebagai berikut:
|
|
</h1>
|
|
</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)>
|
|
</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>
|
|
</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)>
|
|
</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">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="">
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</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">Penilaian ke lokasi objek telah dilakukan oleh
|
|
:
|
|
</h1>
|
|
</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="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"
|
|
value="{{ $penilai->userPenilaiTeam->name ?? '' }}" @readonly(true)>
|
|
</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">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">
|
|
</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 }}"
|
|
@readonly(true)>
|
|
</div>
|
|
</div>
|
|
|
|
<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>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card">
|
|
<div class="card-header bg-agi-50">
|
|
<h3 class="card-title uppercase">
|
|
Informasi yang didapatkan sebagai berikut :
|
|
</h3>
|
|
</div>
|
|
<div class="card-body grid gap-5">
|
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
|
<label class="form-label max-w-56">Faktor Positif</label>
|
|
<div id="fakta-positif-container" class="flex flex-wrap items-baseline w-full">
|
|
@if (!empty($callReport['fakta']['fakta_positif']))
|
|
@foreach ($callReport['fakta']['fakta_positif'] as $index => $positif)
|
|
<div class="fakta_positif flex items-center gap-2 mt-2 textarea-group w-full">
|
|
<textarea class="textarea mt-2" name="fakta_positif[]" rows="3">{{ old("fakta_positif.$index", $positif) }}</textarea>
|
|
<button class="btn btn-danger btn-sm remove-btn" type="button"
|
|
style="display: none;">
|
|
<i class="ki-outline ki-trash"></i>
|
|
</button>
|
|
</div>
|
|
@endforeach
|
|
@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="3">{{ old('fakta_positif.0', '') }}</textarea>
|
|
<button class="btn btn-danger btn-sm remove-btn" type="button"
|
|
style="display: none;">
|
|
<i class="ki-outline ki-trash"></i>
|
|
</button>
|
|
</div>
|
|
@endif
|
|
<button type="button" class="btn btn-primary btn-sm mt-5"
|
|
onclick="addClonableItem('fakta-positif-container', 'fakta_positif')">
|
|
<i class="ki-outline ki-plus"></i>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
|
<label class="form-label max-w-56">Faktor Negatif</label>
|
|
<div id="fakta-negatif-container" class="flex flex-wrap items-baseline w-full">
|
|
@if (!empty($callReport['fakta']['fakta_negatif']))
|
|
@foreach ($callReport['fakta']['fakta_negatif'] as $index => $negatif)
|
|
<div class="fakta_negatif flex items-center gap-2 mt-2 textarea-group w-full">
|
|
<textarea class="textarea mt-2" name="fakta_negatif[]" rows="3">{{ old("fakta_negatif.$index", $negatif) }}</textarea>
|
|
<button class="btn btn-danger btn-sm remove-btn" type="button"
|
|
style="display: none;">
|
|
<i class="ki-outline ki-trash"></i>
|
|
</button>
|
|
</div>
|
|
@endforeach
|
|
@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="3">{{ old('fakta_negatif.0', $callReport['fakta']['fakta_negatif'][0] ?? '') }}</textarea>
|
|
<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>
|
|
</div>
|
|
@endif
|
|
<button type="button" class="btn btn-primary btn-sm mt-5"
|
|
onclick="addClonableItem('fakta-negatif-container', 'fakta_negatif')">
|
|
<i class="ki-outline ki-plus"></i>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="flex justify-end gap-2" style="margin-right: 20px; margin-top: 20px">
|
|
<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>
|
|
@if (Auth::user()->hasAnyRole(['senior-officer', 'EO Appraisal', 'DD Appraisal']))
|
|
<a class="btn btn-info"
|
|
href="{{ route('penilai.lampiran') }}?permohonanId={{ request('permohonanId') }}&documentId={{ request('documentId') }}&inspeksiId={{ request('inspeksiId') }}&jaminanId={{ request('jaminanId') }}&statusLpj=1">
|
|
LAMPIRAN FOTO DAN DOKUMEN
|
|
</a>
|
|
<a class="btn btn-primary"
|
|
onclick="checkLaporan('{{ $permohonan->id }}', '{{ request('documentId') }}', '{{ request('inspeksiId') }}', {{ request('jaminanId') }}, )">
|
|
<i class="ki-filled ki-printer"></i> Print
|
|
</a>
|
|
@endif
|
|
</div>
|
|
</form>
|
|
</div>
|
|
@endsection
|
|
@push('scripts')
|
|
{{-- <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');
|
|
const formData = new FormData(form);
|
|
console.log('Form data entries:', Array.from(formData.entries()));
|
|
const urlParams = new URLSearchParams(window.location.search);
|
|
const permohonanId = {{ $permohonan->id }};
|
|
const documentId = urlParams.get('documentId');
|
|
const inspeksiId = urlParams.get('inspeksiId');
|
|
const requestUrl =
|
|
`{{ route('penilai.storeRap') }}?permohonanId=${permohonanId}&inspeksiId=${inspeksiId}&documentId=${documentId}`;
|
|
$.ajax({
|
|
url: requestUrl,
|
|
type: 'POST',
|
|
data: formData,
|
|
processData: false,
|
|
contentType: false,
|
|
headers: {
|
|
'X-CSRF-TOKEN': '{{ csrf_token() }}'
|
|
},
|
|
success: function(response) {
|
|
hideLoadingSwal();
|
|
if (response.success) {
|
|
Swal.fire({
|
|
title: 'Berhasil!',
|
|
text: response.message,
|
|
icon: 'success',
|
|
confirmButtonText: 'OK'
|
|
}).then((response) => {
|
|
if (response.isConfirmed) {
|
|
// window.location.reload();
|
|
}
|
|
});
|
|
} else {
|
|
Swal.fire({
|
|
title: 'Error!',
|
|
text: response.message || 'Terjadi kesalahan',
|
|
icon: 'error',
|
|
confirmButtonText: 'OK'
|
|
});
|
|
}
|
|
console.log(response);
|
|
},
|
|
error: function(xhr, status, error) {
|
|
|
|
let errors = xhr.responseJSON?.errors;
|
|
$('.alert').text('');
|
|
if (errors) {
|
|
$.each(errors, function(key, value) {
|
|
$(`#error-${key}`).text(value[0]);
|
|
toastrErrorBuild(value[0]);
|
|
});
|
|
// toastrErrorBuild(error);
|
|
}
|
|
hideLoadingSwal();
|
|
console.log(errors);
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
|
|
// 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 => {
|
|
input.addEventListener('input', function() {
|
|
formatNumber(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');
|
|
}
|
|
}
|
|
});
|
|
}
|
|
</script> --}}
|
|
@include('lpj::surveyor.js.utils')
|
|
@endpush
|