577 lines
32 KiB
PHP
577 lines
32 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;
|
|
$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) {
|
|
$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'] ?? 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 ?? 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_laporan" class="input w-full cursor-not-allowed"
|
|
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 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 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 cursor-not-allowed" 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="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>
|
|
|
|
|
|
</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">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="{{ $callReport['lelang'] ?? old('lelang') }}">
|
|
</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="nilai_pasar"
|
|
class="input w-full nilai-pasar currency-format" placeholder="Masukkan likuidasi"
|
|
value="{{ $callReport['nilai_pasar'] ?? 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" class="input w-full likuidasi"
|
|
placeholder="Masukkan likuidasi dalam bentuk persen" onkeyup="calculateTotal(this)" value="{{ $callReport['persentase_likuidasi'] ?? old('likuidasi') }}">
|
|
</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>
|
|
</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 cursor-not-allowed" 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'] ?? $callReport['pihak_kjjpp'] ?? '' }}"
|
|
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 cursor-not-allowed" 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>
|
|
|
|
@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>
|
|
</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">
|
|
@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>
|
|
@endif
|
|
@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 callReports = @json($callReport);
|
|
console.log('callReport', callReports)
|
|
|
|
|
|
function formatJson(formElement) {
|
|
const formData = new FormData(formElement);
|
|
const jsonData = {
|
|
kepada: "",
|
|
tanggal: "",
|
|
nomor_laporan: "",
|
|
perihal: "",
|
|
pihak_kjjpp: "",
|
|
dari: "",
|
|
lelang: "",
|
|
fakta: {
|
|
fakta_positif: [],
|
|
fakta_negatif: []
|
|
},
|
|
nilai_pasar: "",
|
|
persentase_likuidasi: "",
|
|
hasil_nilai_likuidasi: ""
|
|
};
|
|
|
|
// Ambil fakta positif
|
|
document.querySelectorAll('textarea[name="fakta_positif[]"]').forEach(textarea => {
|
|
if (textarea.value.trim() !== "") {
|
|
jsonData.fakta.fakta_positif.push(textarea.value.trim());
|
|
}
|
|
});
|
|
|
|
// Ambil fakta negatif
|
|
document.querySelectorAll('textarea[name="fakta_negatif[]"]').forEach(textarea => {
|
|
if (textarea.value.trim() !== "") {
|
|
jsonData.fakta.fakta_negatif.push(textarea.value.trim());
|
|
}
|
|
});
|
|
|
|
|
|
jsonData.perihal = document.querySelector('input[name="perihal"]')?.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() || "";
|
|
|
|
// 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() || "");
|
|
|
|
return jsonData;
|
|
}
|
|
|
|
function submitData() {
|
|
showLoadingSwal('Mengirim data ke server...');
|
|
const formElement = document.querySelector('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.storeCallReport') }}?permohonan_id=${permohonanId}&inspeksi_id=${inspeksiId}&dokument_id=${documentId}`;
|
|
|
|
|
|
const jsonData = formatJson(formElement);
|
|
$.ajax({
|
|
url: requestUrl,
|
|
type: 'POST',
|
|
data: JSON.stringify({
|
|
permohonan_id: permohonanId,
|
|
dokument_id: documentId,
|
|
inspeksi_id: inspeksiId,
|
|
data: jsonData,
|
|
}),
|
|
contentType: 'application/json',
|
|
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);
|
|
}
|
|
});
|
|
}
|
|
</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());
|
|
}
|
|
|
|
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
// Initialize currency format for existing inputs
|
|
document.querySelectorAll('.currency-format').forEach(input => {
|
|
input.addEventListener('input', function() {
|
|
handleCurrencyInput(this);
|
|
});
|
|
|
|
// Format initial values if they exist
|
|
if (input.value) {
|
|
input.value = formatCurrency(input.value);
|
|
}
|
|
});
|
|
});
|
|
</script>
|
|
@include('lpj::surveyor.js.utils')
|
|
@endpush
|