1175 lines
58 KiB
PHP
1175 lines
58 KiB
PHP
<div style="display: none">
|
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5" style="margin-top: 20px">
|
|
|
|
<label class="form-label max-w-56">Debitur/Perwakilan</label>
|
|
|
|
@if (isset($forminspeksi['asset']['debitur_perwakilan']) && !empty($forminspeksi['asset']['debitur_perwakilan']))
|
|
<div id="perwakilan" class="flex flex-wrap items-baseline w-full gap-5">
|
|
@foreach ($forminspeksi['asset']['debitur_perwakilan'] as $key => $item)
|
|
<div class="perwakilan flex flex-wrap w-full items-baseline gap-2 ">
|
|
<input type="text" class="input form-control" name="debitur_perwakilan[]"
|
|
value="{{ old('debitur_perwakilan.' . $key, $item) }}"
|
|
placeholder="Masukkan Debitur/Perwakilan" />
|
|
<button type="button" class="btn btn-danger btn-outline btn-xs remove-btn">Hapus</button>
|
|
</div>
|
|
@endforeach
|
|
</div>
|
|
@else
|
|
<div id="perwakilan" class="flex flex-wrap items-baseline w-full gap-5">
|
|
<div class="perwakilan flex flex-wrap w-full items-baseline gap-2 ">
|
|
<input type="text" class="input form-control" name="debitur_perwakilan[]"
|
|
value="{{ old('debitur_perwakilan') }}" placeholder="Masukkan Debitur/Perwakilan" />
|
|
<button type="button" class="btn btn-danger btn-outline btn-xs remove-btn"
|
|
style="display: none">Hapus
|
|
</button>
|
|
</div>
|
|
</div>
|
|
@endif
|
|
|
|
<button onclick="addClonableItem('perwakilan', 'perwakilan')" type="button" class="btn-md btn btn-primary">
|
|
<i class="ki-filled ki-plus"></i>
|
|
</button>
|
|
<em id="error-debitur_perwakilan" class="alert text-danger text-sm"></em>
|
|
</div>
|
|
|
|
|
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5" style="margin-top: 20px">
|
|
<label class="form-label max-w-56">Pihak Bank</label>
|
|
<div id="perwakilan" class="flex items-baseline w-full gap-5">
|
|
<div class="flex gap-4 items-center w-full">
|
|
<input class="input" type="text" placeholder="Masukan Pihak Bank Selain Pj" type="text"
|
|
name="pihak_bank" id="lat"
|
|
value="{{ old('pihak_bank', isset($forminspeksi['asset']['pihak_bank']) ? $forminspeksi['asset']['pihak_bank'] : '') }}">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="card border border-agi-100 w-full bg-white rounded-lg shadow-md overflow-hidden">
|
|
<div class="card-header bg-agi-50">
|
|
<h1 class="text-md font-medium text-gray-900 uppercase">Nama Cadeb/Debitur</h1>
|
|
</div>
|
|
<div class="card-body">
|
|
|
|
|
|
<div class="grid gap-5">
|
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
|
<label class="form-label max-w-56">Nama</label>
|
|
<div class="flex flex-wrap items-baseline w-full">
|
|
@if (isset($permohonan->debiture))
|
|
<p class="text-2sm text-gray-700">{{ $permohonan->debiture->name }}</p>
|
|
@endif
|
|
</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">Deskripsi Aset jaminan</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">
|
|
<label class="form-label max-w-56">Jenis Aset</label>
|
|
<div>
|
|
<div class="flex flex-wrap items-baseline w-full">
|
|
@if (isset($permohonan->documents))
|
|
@foreach ($permohonan->documents as $item)
|
|
<p class="text-2sm text-gray-700">{{ $item->jenisJaminan->name }}</p>
|
|
<input type="hidden" name="jenis_asset_name"
|
|
value="{{ $item->jenisJaminan->name }}">
|
|
@endforeach
|
|
@endif
|
|
</div>
|
|
<div class="flex-wrap items-stretch">
|
|
<div class="grid grid-cols-3 md:grid-cols-3 gap-4 mt-2">
|
|
<label class="form-label flex items-center gap-3 text-nowrap">
|
|
<input
|
|
onclick="toggleFieldVisibility('jenis_asset', 'jenis_asset', ['tidak sesuai'])"
|
|
type="radio" class="radio" name="jenis_asset" value="sesuai"
|
|
{{ isset($forminspeksi['asset']['jenis_asset']['sesuai']) ? 'checked' : '' }}>
|
|
<span class="ml-2">Ya</span>
|
|
</label>
|
|
<label class="form-label flex items-center gap-2.5 text-nowrap">
|
|
<input
|
|
onclick="toggleFieldVisibility('jenis_asset', 'jenis_asset', ['tidak sesuai'])"
|
|
type="radio" class="radio" name="jenis_asset" value="tidak sesuai"
|
|
{{ isset($forminspeksi['asset']['jenis_asset']['tidak sesuai']) ? 'checked' : '' }}>
|
|
<span class="ml-2">Tidak</span>
|
|
</label>
|
|
<!-- Select dropdown untuk "Tidak Sesuai" -->
|
|
@php
|
|
$statusKey = isset($forminspeksi['asset']['jenis_asset']['sesuai'])
|
|
? 'sesuai'
|
|
: 'tidak sesuai';
|
|
$selectedValue = $forminspeksi['asset']['jenis_asset'][$statusKey] ?? null;
|
|
@endphp
|
|
<div id="jenis_asset" class="flex items-baseline gap-2"
|
|
style="{{ isset($selectedValue) === 'tidak sesuai' ? '' : 'display: none;' }}">
|
|
<select id="jenis_asset_tidak_sesuai" class="input w-full"
|
|
name="jenis_asset_tidak_sesuai">
|
|
<option value="">Select Jenis asset</option>
|
|
@if (isset($basicData['jenisJaminan']))
|
|
@foreach ($basicData['jenisJaminan'] as $item)
|
|
<option value="{{ $item->id }}"
|
|
{{ old('jenis_asset_tidak_sesuai', $forminspeksi['asset']['jenis_asset_tidak_sesuai'] ?? '') == $item->name ? 'selected' : '' }}>
|
|
{{ $item->name }}
|
|
</option>
|
|
@endforeach
|
|
@endif
|
|
</select>
|
|
{{-- <button type="button" class="btn btn-md btn-primary"
|
|
onclick="updateAnalisa('jenis_asset')">Save</button> --}}
|
|
</div>
|
|
</div>
|
|
<em id="error-jenis_asset" class="alert text-danger text-sm"></em>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
|
<label class="form-label max-w-56">Alamat</label>
|
|
<div class="w-full">
|
|
|
|
<span class="text-2sm text-gray-700">
|
|
{{ formatAlamat($permohonan->debiture) }}
|
|
</span>
|
|
|
|
|
|
<div class="flex-wrap items-stretch">
|
|
<div class="grid grid-cols-3 md:grid-cols-3 gap-4 mt-2">
|
|
<label class="form-label flex items-center gap-3 text-nowrap">
|
|
<input onclick="createAlamat('sesuai')" type="radio" class="radio"
|
|
name="alamat_sesuai" value="sesuai"
|
|
{{ old('jenis_asset', isset($forminspeksi['asset']['alamat']['sesuai'])) ? 'checked' : '' }}>
|
|
<span class="ml-2">Ya</span>
|
|
</label>
|
|
<label class="form-label flex items-center gap-3 text-nowrap">
|
|
<input onclick="createAlamat('tidak sesuai')" type="radio" class="radio"
|
|
name="alamat_sesuai" value="tidak sesuai"
|
|
{{ old('jenis_asset', isset($forminspeksi['asset']['alamat']['tidak sesuai'])) ? 'checked' : '' }}>
|
|
<span class="ml-2">Tidak</span>
|
|
</label>
|
|
</div>
|
|
<em id="error-alamat_sesuai" class="alert text-danger text-sm"></em>
|
|
<em id="error-alamat_sesuai" class="alert text-danger text-sm"></em>
|
|
</div>
|
|
|
|
@php
|
|
$statusKey = isset($forminspeksi['asset']['alamat']['sesuai']) ? 'sesuai' : 'tidak sesuai';
|
|
$address = $forminspeksi['asset']['alamat'][$statusKey] ?? null;
|
|
|
|
@endphp
|
|
|
|
<div id="alamat_form" class="grid gap-2 mt-5" style="display: none;">
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div class="card border border-agi-100 w-full bg-white rounded-lg shadow-md overflow-hidden">
|
|
<div class="card-header bg-agi-50">
|
|
<h1 class="text-md font-medium text-gray-900 uppercase">Titik Koordinat Google Maps</h1>
|
|
</div>
|
|
<div class="card-body">
|
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
|
<label class="form-label max-w-56">Koordinat</label>
|
|
<div id="perwakilan" class="flex items-baseline w-full gap-5">
|
|
<div class="grid grid-cols-2 gap-4 items-center w-full">
|
|
<input class="input" type="text" placeholder="Masukan Koordinat Latitude" type="text"
|
|
name="kordinat_lat" id="lat"
|
|
value="{{ old('kordinat_lat', isset($forminspeksi['asset']['kordinat_lat']) ? $forminspeksi['asset']['kordinat_lat'] : '') }}">
|
|
<input class="input" type="text" placeholder="Masukan Koordinat Longitude"
|
|
name="kordinat_lng" id="lng"
|
|
value="{{ old('kordinat_lng', isset($forminspeksi['asset']['kordinat_lng']) ? $forminspeksi['asset']['kordinat_lng'] : '') }}">
|
|
</div>
|
|
<a onclick="getCoordinates()" type="button" class="btn btn-md btn-outline btn-primary">
|
|
<i class="ki-filled ki-map"></i>Ambil
|
|
Koordinat </a>
|
|
<a target="_blank" href="https://www.google.com/maps" type="button"
|
|
class="btn btn-md btn-outline btn-success">
|
|
<i class="ki-filled ki-map"></i>Ke google Maps</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card">
|
|
<div class="card-header bg-agi-50">
|
|
<h1 class="text-md font-medium text-gray-900 uppercase">Status</h1>
|
|
</div>
|
|
<div class="card-body">
|
|
|
|
<div class=" mx-auto rounded-lg overflow-hidden">
|
|
<div class="py-4 ">
|
|
<h1 class="text-md font-medium text-gray-900">Hubungan cadeb/debitur dengan Pemilik Jaminan
|
|
</h1>
|
|
</div>
|
|
|
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
|
<label class="form-label max-w-56">Pemilik Jaminan</label>
|
|
<div>
|
|
<div class="flex flex-wrap items-baseline w-full">
|
|
@foreach ($permohonan->documents as $dokumen)
|
|
@php
|
|
$hubCadebPemilik = $dokumen->pemilik->hubungan_pemilik->name ?? 'N/A';
|
|
@endphp
|
|
{{ $hubCadebPemilik }}
|
|
|
|
<input type="hidden" name="hub_cadeb_sesuai" value="{{ $hubCadebPemilik }}"
|
|
id="">
|
|
@endforeach
|
|
</div>
|
|
|
|
<div class="flex-wrap items-stretch">
|
|
<div class="grid grid-cols-3 md:grid-cols-3 gap-4 mt-2">
|
|
<label class="form-label flex items-center gap-3 text-nowrap">
|
|
<input
|
|
onclick="toggleFieldVisibility('hub_cadeb','hub_cadeb_tidak_sesuai', ['tidak sesuai'])"
|
|
type="radio" class="radio" name="hub_cadeb" value="sesuai"
|
|
{{ old('hub_cadeb', isset($forminspeksi['asset']['hub_cadeb']['sesuai'])) ? 'checked' : '' }}>
|
|
<span class="ml-2">Ya</span>
|
|
</label>
|
|
<label class="form-label flex items-center gap-2.5 text-nowrap">
|
|
<input
|
|
onclick="toggleFieldVisibility('hub_cadeb','hub_cadeb_tidak_sesuai', ['tidak sesuai'])"
|
|
type="radio" class="radio" name="hub_cadeb" value="tidak sesuai"
|
|
{{ old('hub_cadeb', isset($forminspeksi['asset']['hub_cadeb']['tidak sesuai'])) ? 'checked' : '' }}>
|
|
<span class="ml-2">Tidak</span>
|
|
</label>
|
|
<!-- Select dropdown untuk "Tidak Sesuai" -->
|
|
@php
|
|
$statusKey = isset($forminspeksi['asset']['hub_cadeb']['sesuai'])
|
|
? 'sesuai'
|
|
: 'tidak sesuai';
|
|
$selectedData = $forminspeksi['asset']['hub_cadeb'][$statusKey] ?? null;
|
|
@endphp
|
|
|
|
<select id="hub_cadeb_tidak_sesuai" class="input w-full"
|
|
name="hub_cadeb_tidak_sesuai"
|
|
style="{{ old('hub_cadeb_tidak_sesuai', $selectedData) ? '' : 'display: none;' }}">
|
|
<option value="">Select Hubungan Cadeb</option>
|
|
@if (isset($basicData['hubCadeb']))
|
|
@foreach ($basicData['hubCadeb'] as $item)
|
|
@if ($item->name != $hubCadebPemilik)
|
|
<option value="{{ $item->name }}"
|
|
{{ old('hub_cadeb_tidak_sesuai', $selectedData) == $item->name ? 'selected' : '' }}>
|
|
{{ $item->name }}
|
|
</option>
|
|
@endif
|
|
@endforeach
|
|
@endif
|
|
</select>
|
|
|
|
</div>
|
|
<em id="error-hub_cadeb" class="alert text-danger text-sm"></em>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class=" mx-auto bg-white rounded-lg overflow-hidden">
|
|
<div class="py-4 ">
|
|
<h1 class="text-md font-medium text-gray-900">Hubungan Cadeb/Debitur dengan Penghuni Jaminan
|
|
</h1>
|
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
|
<label class="form-label max-w-56">Penghuni Jaminan</label>
|
|
|
|
<div class="mt-2">
|
|
<div class="flex flex-wrap items-baseline w-full text-sm">
|
|
<input type="hidden" name="hub_cadeb_penghuni_sesuai" value="ditempati sendiri"
|
|
id="">
|
|
</div>
|
|
|
|
<div class="flex-wrap items-stretch">
|
|
<div class="grid grid-cols-3 md:grid-cols-3 gap-4 mt-2">
|
|
<label class="form-label flex items-center gap-3 text-nowrap">
|
|
|
|
<input
|
|
onclick="toggleFieldVisibility('hub_cadeb_penghuni','hub_penghuni_tidak_sesuai', ['tidak sesuai'])"
|
|
type="radio" class="radio" name="hub_cadeb_penghuni" value="sesuai"
|
|
{{ old('hub_cadeb_penghuni', isset($forminspeksi['asset']['hub_cadeb_penghuni'])) ? 'checked' : '' }}>
|
|
|
|
<span class="ml-2">Ditempati Sendiri</span>
|
|
</label>
|
|
<label class="form-label flex items-center gap-2.5 text-nowrap">
|
|
<input
|
|
onclick="toggleFieldVisibility('hub_cadeb_penghuni','hub_penghuni_tidak_sesuai', ['tidak sesuai'])"
|
|
type="radio" class="radio" name="hub_cadeb_penghuni"
|
|
value="tidak sesuai"
|
|
{{ old('hub_cadeb_penghuni', $forminspeksi['asset']['hub_cadeb_penghuni']['tidak sesuai'] ?? false) ? 'checked' : '' }}>
|
|
<span class="ml-2">Tidak</span>
|
|
</label>
|
|
<!-- Select dropdown untuk "Tidak Sesuai" -->
|
|
@php
|
|
$statusKey = isset($forminspeksi['asset']['hub_cadeb_penghuni']['sesuai'])
|
|
? 'sesuai'
|
|
: 'tidak sesuai';
|
|
$selectedData =
|
|
$forminspeksi['asset']['hub_cadeb_penghuni'][$statusKey] ?? null;
|
|
@endphp
|
|
|
|
|
|
<input id="hub_penghuni_tidak_sesuai" class="input"
|
|
name="hub_penghuni_tidak_sesuai"
|
|
placeholder="Masukkan Hubungan penghuni jaminan"
|
|
value="{{ old('hub_penghuni_tidak_sesuai', isset($selectedData) ? $selectedData : '') }}"
|
|
style="{{ old('hub_penghuni_tidak_sesuai', $selectedData ?? false) ? '' : 'display: none;' }}">
|
|
</div>
|
|
<em id="error-hub_cadeb_penghuni" class="alert text-danger text-sm"></em>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="w-full grid gap-5 lg:gap-7.5 mx-auto">
|
|
<div class="card border border-agi-100 min-w-full">
|
|
<div class="card border border-agi-100 min-w-full">
|
|
<div class="card-header bg-agi-50">
|
|
<h3 class="card-title">
|
|
{{ $title ?? 'Data Jaminan' }}
|
|
</h3>
|
|
@php
|
|
use Illuminate\Support\Facades\Route;
|
|
@endphp
|
|
<div class="flex items-center gap-2">
|
|
@if (Auth::user()->hasAnyRole(['administrator', 'senior-officer', 'EO Appraisal', 'DD Appraisal']) &&
|
|
Route::currentRouteName('otorisator.show'))
|
|
<a href="{{ route('otorisator.show', ['id' => $permohonan->id, 'type' => 'Pelaporan']) }}"
|
|
class="btn btn-xs btn-info">
|
|
<i class="ki-filled ki-exit-left"></i> Back
|
|
</a>
|
|
@elseif (Auth::user()->hasAnyRole(['administrator', 'surveyor']) && Route::currentRouteName('penilai.show'))
|
|
<a href="{{ route('penilai.show', $permohonan->id) }}" class="btn btn-xs btn-info">
|
|
<i class="ki-filled ki-exit-left"></i> Back
|
|
</a>
|
|
@endif
|
|
</div>
|
|
</div>
|
|
<div class="card-body grid gap-5 grid-cols-2">
|
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
|
<label class="form-label max-w-56">Nama Debitur</label>
|
|
<div class="flex flex-wrap items-baseline w-full">
|
|
@if (isset($permohonan->debiture))
|
|
<p class="text-2sm text-gray-700">{{ $permohonan->debiture->name }}</p>
|
|
@endif
|
|
</div>
|
|
</div>
|
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
|
<label class="form-label max-w-56">Alamat Object</label>
|
|
<div class="flex flex-wrap items-baseline w-full">
|
|
@foreach ($permohonan->documents as $dokumen)
|
|
<span class="text-2sm text-gray-700">
|
|
{{ formatAlamat($dokumen->pemilik) }}
|
|
{{ formatAlamat($dokumen->pemilik) }}
|
|
</span>
|
|
@endforeach
|
|
</div>
|
|
</div>
|
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
|
<label class="form-label max-w-56">Nomor Registrasi</label>
|
|
<div class="flex flex-wrap items-base line w-full">
|
|
<p class="text-2sm text-gray-700">{{ $permohonan->nomor_registrasi }}</p>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
|
<label class="form-label max-w-56">Cab/Direktorat</label>
|
|
<div class="flex flex-wrap items-baseline w-full">
|
|
@if (isset($permohonan->branch))
|
|
<p class="text-2sm text-gray-700">{{ $permohonan->branch->name }}</p>
|
|
@endif
|
|
</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">
|
|
<p class="text-2sm text-gray-700">{{ $permohonan->nomor_registrasi }}</p>
|
|
</div>
|
|
</div>
|
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
|
<label class="form-label max-w-56">AO</label>
|
|
<div class="flex flex-wrap items-baseline w-full">
|
|
@if (isset($permohonan->user))
|
|
<p class="text-2sm text-gray-700">{{ $permohonan->user->name }}</p>
|
|
@endif
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card">
|
|
<div class="card-header bg-agi-50">
|
|
<h3 class="card-title uppercase">
|
|
Identitas Cadeb/Debitur
|
|
</h3>
|
|
</div>
|
|
<div class="card-body grid gap-2.5 w-full">
|
|
|
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
|
<label class="form-label max-w-56">Nama</label>
|
|
<div class="flex flex-wrap items-baseline w-full">
|
|
<span>
|
|
@if (isset($permohonan->debiture))
|
|
<p class="text-2sm text-gray-700">{{ $permohonan->debiture->name }}</p>
|
|
@endif
|
|
</span>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
|
<label class="form-label max-w-56">Perwakilan Cadeb/Debitur Di lokasi</label>
|
|
<div class="flex flex-wrap items-baseline w-full">
|
|
<span>
|
|
{{ $forminspeksi['asset']['debitur_perwakilan'][0] ?? '' }}
|
|
</span>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
|
<label class="form-label max-w-56">Pihak Bank Selain Appraisal</label>
|
|
<div class="flex flex-wrap items-baseline w-full">
|
|
<span> {{ $forminspeksi['asset']['pihak_bank'] ?? '' }}</span>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div class="card">
|
|
<div class="card-header bg-agi-50">
|
|
<h3 class="card-title uppercase">
|
|
Deskripsi dan Alamat Aset
|
|
</h3>
|
|
</div>
|
|
<div class="card-body grid gap-2.5 w-full">
|
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
|
<label class="form-label max-w-56">Jenis Asset</label>
|
|
@php
|
|
$statusKey = isset($forminspeksi['asset']['jenis_asset']['sesuai']) ? 'sesuai' : 'tidak sesuai';
|
|
$selectedValue = $forminspeksi['asset']['jenis_asset'][$statusKey] ?? null;
|
|
@endphp
|
|
<div class="flex flex-wrap items-baseline w-full">
|
|
<span>{{ $selectedValue }}</span>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
|
@php
|
|
$statusKey = isset($forminspeksi['asset']['alamat']['sesuai']) ? 'sesuai' : 'tidak sesuai';
|
|
$selectedValue = $forminspeksi['asset']['alamat'][$statusKey] ?? null;
|
|
@endphp
|
|
<label class="form-label max-w-56">Terletak di</label>
|
|
<div class="flex flex-wrap items-baseline w-full">
|
|
<span>{{ $selectedValue['address'] ?? '' }}</span>
|
|
</div>
|
|
</div>
|
|
|
|
<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">
|
|
<div class="card-header bg-agi-50">
|
|
<h3 class="card-title uppercase">
|
|
dokumen
|
|
</h3>
|
|
</div>
|
|
<div class="card-body">
|
|
@include('lpj::component.detail-jaminan', ['status' => true])
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card">
|
|
<div class="card-header bg-agi-50">
|
|
<h3 class="card-title uppercase">
|
|
Hubungan Cadeb/Debitur dengan pemilik dan penghuni
|
|
</h3>
|
|
</div>
|
|
@php
|
|
$statusKey = isset($forminspeksi['asset']['hub_cadeb']['sesuai']) ? 'sesuai' : 'tidak sesuai';
|
|
$selectedData = $forminspeksi['asset']['hub_cadeb'][$statusKey] ?? null;
|
|
@endphp
|
|
<div class="card-body">
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
@foreach ($permohonan->documents as $dokumen)
|
|
@if ($dokumen->jenisJaminan)
|
|
@php
|
|
$formKategori = json_decode($dokumen->jenisJaminan->form_kategori, true);
|
|
$jenisAset = $dokumen->jenisJaminan->name;
|
|
@endphp
|
|
@if (isset($formKategori) && $formKategori)
|
|
@php
|
|
$kategoriArray = is_array($formKategori) ? $formKategori : [$formKategori];
|
|
$kategoriUnik = array_unique($kategoriArray);
|
|
@endphp
|
|
<input type="hidden" name="action" value="{{ implode(',', $kategoriUnik) }}">
|
|
<input type="hidden" name="type" value="{{ implode(',', $kategoriUnik) }}">
|
|
|
|
|
|
@foreach ($kategoriUnik as $kategori)
|
|
{{-- Tampilkan komponen sesuai kategori --}}
|
|
@include('lpj::surveyor.components.' . str_replace('-', '-', $kategori), [
|
|
'dokumen' => $dokumen,
|
|
])
|
|
@endforeach
|
|
@endif
|
|
@endif
|
|
@endforeach
|
|
|
|
|
|
<div class="card">
|
|
<div class="card-header bg-agi-50">
|
|
<h3 class="card-title uppercase">
|
|
Informasi dan pembanding
|
|
</h3>
|
|
</div>
|
|
@include('lpj::penilai.components.informasi-pembanding')
|
|
</div>
|
|
|
|
<div class="card">
|
|
<div class="card-header bg-agi-50">
|
|
<h3 class="card-title uppercase">
|
|
total nilai pasar wajar
|
|
</h3>
|
|
</div>
|
|
<div class="card-body gap-5">
|
|
<div>
|
|
<label for="total_nilai_pasar_wajar" class="form-label">Total Nilai Pasar Wajar</label>
|
|
<div class="card-body grid gap-2.5 ">
|
|
|
|
@php
|
|
$labelNilai = [
|
|
'bangunan' => 'Luas Bangunan',
|
|
'tanah' => 'Luas Tanah',
|
|
'apartement-kantor' => 'Luas Apartemen/Kantor',
|
|
'alat-berat' => 'Luas Alat Berat',
|
|
'mesin' => 'Luas Mesin',
|
|
'kendaraan' => 'Luas Kendaraan',
|
|
'pesawat' => 'Luas Pesawat',
|
|
'kapal' => 'Luas Kapal',
|
|
];
|
|
|
|
if (strcasecmp($jenisAset, 'RUKO/RUKAN') === 0) {
|
|
$labelNilai['bangunan'] = 'Luas Unit';
|
|
unset($labelNilai['tanah']);
|
|
}
|
|
@endphp
|
|
|
|
@foreach ($kategoriUnik as $item)
|
|
@if (isset($labelNilai[$item]))
|
|
<div class="flex grid-col-3 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">
|
|
{{ $labelNilai[$item] }}
|
|
</label>
|
|
<input type="text" id="luas_{{ $item }}" class="input w-full"
|
|
name="luas_{{ $item }}"
|
|
value="{{ old('luas_' . $item, $lpjData['luas_' . $item] ?? null) }}"
|
|
oninput="calculateTotal()">
|
|
</div>
|
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5 w-full">
|
|
<label for="province" class="">X</label>
|
|
<label class="input">
|
|
<i class="">Rp</i>
|
|
<input type="text" id="nilai_{{ $item }}_1"
|
|
class="w-full currency" name="nilai_{{ $item }}_1"
|
|
value="{{ old('nilai_' . $item . '_1', $lpjData['nilai_' . $item . '_1'] ?? null) }}"
|
|
oninput="calculateTotal()">
|
|
</label>
|
|
</div>
|
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5 w-full">
|
|
<label class="input">
|
|
<i class="">Rp</i>
|
|
<input id="nilai_{{ $item }}_2" type="text"
|
|
class="w-full currency-format" name="nilai_{{ $item }}_2"
|
|
value="{{ old('nilai_' . $item . '_2', $lpjData['nilai_' . $item . '_2'] ?? null) }}">
|
|
</label>
|
|
</div>
|
|
</div>
|
|
@endif
|
|
@endforeach
|
|
|
|
<div>
|
|
<div id="add_pasar_wajar" class="flex flex-wrap gap-2.5 w-full">
|
|
</div>
|
|
</div>
|
|
|
|
<div class="flex justify-end gap-2 ">
|
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5 w-full grid-col-2">
|
|
<label class="form-label max-w-56" for="">Total Nilai</label>
|
|
<label for="province" class="input">
|
|
<i class="">Rp
|
|
</i>
|
|
<input type="text" class=" w-full currency-format" id="total_nilai_pasar_wajar"
|
|
name="total_nilai_pasar_wajar"
|
|
value="{{ old('total_nilai_pasar_wajar', $lpjData['total_nilai_pasar_wajar'] ?? null) }}">
|
|
</label>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="tambah mb-10" style="margin-bottom: 20px;">
|
|
<button type="button" id="tambah-npw" class="btn btn-primary">
|
|
<i class="ki-filled ki-plus"></i>
|
|
Tambah NPW </button>
|
|
</div>
|
|
|
|
<div>
|
|
<label for="total_nilai_pasar_wajar" class="form-label uppercase">TOTAL NILAI
|
|
LIKUIDASI</label>
|
|
<div class="card-body grid gap-2.5 w-full">
|
|
<div class="flex grid-col-3 gap-2.5 w-full">
|
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5 w-full">
|
|
<div class="w-full">
|
|
<label class="input">
|
|
|
|
<input type="text" id="likuidasi" name="likuidasi" class=" w-full currency"
|
|
value="{{ old('likuidasi', $lpjData['likuidasi'] ?? null) }}"
|
|
oninput="calculateTotal()">
|
|
<i class="">%
|
|
</i>
|
|
</label>
|
|
<span class="text-xs"> <span class="text-xs text-danger">*</span> Masukkan Angka Saja
|
|
</span>
|
|
</div>
|
|
</div>
|
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5 w-full">
|
|
<label for="province" class="">X</label>
|
|
<label class="input">
|
|
<i class="">Rp
|
|
</i>
|
|
<input type="text" class=" w-full currency-format" id="likuidasi_nilai_1"
|
|
name="likuidasi_nilai_1"
|
|
value="{{ old('likuidasi_nilai_1', $lpjData['likuidasi_nilai_1'] ?? null) }}"
|
|
oninput="calculateTotal()">
|
|
</label>
|
|
</div>
|
|
<div class="grid gap-2.5 w-full">
|
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5 w-full">
|
|
|
|
<label class="input">
|
|
<i class="">Rp
|
|
</i>
|
|
<input type="text" class=" w-full currency-format" name="likuidasi_nilai_2"
|
|
value="{{ old('likuidasi_nilai_2', $lpjData['likuidasi_nilai_2'] ?? null) }}">
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5" style="margin-top: 20px">
|
|
|
|
<label class="form-label lg:form-label max-w-56 ">Catatan yang Perlu Diperhatikan
|
|
</label>
|
|
<div class="w-full">
|
|
<div id="keterangan_penilai-container" class="flex items-baseline flex-wrap gap-2.5 w-full">
|
|
@if (!empty($lpjData['keterangan_penilai']) && is_array($lpjData['keterangan_penilai']))
|
|
@foreach ($lpjData['keterangan_penilai'] as $index => $item)
|
|
<div class="keterangan_penilai flex items-center gap-2 mt-2 textarea-group w-full">
|
|
<textarea name="keterangan_penilai[]" class="textarea mt-2 " placeholder="Masukkan catatan penting" rows="10">{{ old("keterangan_penilai.$index", $item) }}</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="keterangan_penilai flex items-center gap-2 mt-2 textarea-group w-full">
|
|
<textarea name="keterangan_penilai[]" class="textarea mt-2 " placeholder="Masukkan catatan penting" rows="10"></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-keterangan_penilai" class="alert text-danger text-sm"></em>
|
|
</div>
|
|
@endif
|
|
</div>
|
|
<button type="button"
|
|
onclick="addClonableItem('keterangan_penilai-container', 'keterangan_penilai')"
|
|
class="btn btn-primary btn-sm mt-5 ">
|
|
<i class="ki-outline ki-plus"></i>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card">
|
|
<div class="card-header bg-agi-50">
|
|
<h3 class="card-title uppercase">
|
|
nilai asuransi
|
|
</h3>
|
|
</div>
|
|
<div class="card-body">
|
|
<div>
|
|
<label for="total_nilai_pasar_wajar" class="form-label uppercase">TOTAL NILAI ASURANSI</label>
|
|
<div class="card-body grid gap-2.5 w-full">
|
|
<div class="flex grid-col-3 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">Luas Bangunan</label>
|
|
<input type="text" class="input w-full" id="asuransi_luas_bangunan"
|
|
name="asuransi_luas_bangunan"
|
|
value="{{ old('asuransi_luas_bangunan', $lpjData['asuransi_luas_bangunan'] ?? null) }}"
|
|
oninput="calculateTotal()">
|
|
</div>
|
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5 w-full">
|
|
<label for="province" class="">X</label>
|
|
<label class="input">
|
|
<i class="">Rp
|
|
</i>
|
|
<input type="text" class="input w-full currency" id="asuransi_nilai_1"
|
|
name="asuransi_nilai_1"
|
|
value="{{ old('asuransi_nilai_1', $lpjData['asuransi_nilai_1'] ?? null) }}"
|
|
oninput="calculateTotal()">
|
|
</label>
|
|
</div>
|
|
|
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5 w-full">
|
|
<label class="input">
|
|
<i class="">Rp
|
|
</i>
|
|
<input type="text" class="input w-full currency-format" name="asuransi_nilai_2"
|
|
value="{{ old('asuransi_nilai_2', $lpjData['asuransi_nilai_2'] ?? null) }}">
|
|
</label>
|
|
</div>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
<script type="text/javascript">
|
|
const datas = @json($forminspeksi);
|
|
console.log(datas);
|
|
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
|
|
|
|
const tambahNPWButton = document.getElementById('tambah-npw');
|
|
const addPasarWajarContainer = document.getElementById('add_pasar_wajar');
|
|
let npwCounter = 0;
|
|
|
|
tambahNPWButton.addEventListener('click', function() {
|
|
npwCounter++;
|
|
|
|
const newNPWRow = document.createElement('div');
|
|
newNPWRow.className = 'flex grid-col-3 gap-2.5 w-full npw-row';
|
|
newNPWRow.innerHTML = `
|
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5 w-full">
|
|
<input type="text"
|
|
id="name_npw_${npwCounter}"
|
|
class="input w-full"
|
|
name="name_npw_${npwCounter}"
|
|
placeholder="Nama NPW">
|
|
|
|
<input type="text"
|
|
id="luas_npw_${npwCounter}"
|
|
class="input w-full "
|
|
name="luas_npw_${npwCounter}"
|
|
placeholder="Luas NPW"
|
|
oninput="calculateTotal()">
|
|
</div>
|
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5 w-full">
|
|
<label for="province" class="">X</label>
|
|
<label class="input">
|
|
<i class="">Rp
|
|
</i>
|
|
<input type="text"
|
|
id="nilai_npw_${npwCounter}_1"
|
|
class=" w-full currency"
|
|
name="nilai_npw_${npwCounter}_1"
|
|
placeholder="Harga per meter"
|
|
oninput="calculateTotal()">
|
|
</label>
|
|
</div>
|
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5 w-full">
|
|
<label class="input">
|
|
<i class="">Rp
|
|
</i>
|
|
<input type="text"
|
|
id="nilai_npw_${npwCounter}_2"
|
|
class="input w-full currency-format"
|
|
name="nilai_npw_${npwCounter}_2"
|
|
placeholder="Total Nilai"
|
|
readonly>
|
|
</label>
|
|
<button type="button" class="btn btn-danger remove-npw">
|
|
<i class="ki-filled ki-minus"></i>
|
|
</button>
|
|
</div>
|
|
`;
|
|
|
|
// Tambahkan event listener untuk remove button
|
|
newNPWRow.querySelector('.remove-npw').addEventListener('click', function() {
|
|
newNPWRow.remove();
|
|
calculateTotal();
|
|
});
|
|
|
|
// Tambahkan event listener untuk currency format
|
|
newNPWRow.querySelectorAll('.currency-format').forEach(input => {
|
|
input.addEventListener('input', function() {
|
|
formatCurrency(this);
|
|
});
|
|
});
|
|
|
|
addPasarWajarContainer.appendChild(newNPWRow);
|
|
});
|
|
|
|
function loadSavedNPW() {
|
|
// Cek apakah ada data LPJ yang sudah tersimpan
|
|
const lpjDataElement = document.getElementById('lpj-data');
|
|
if (lpjDataElement) {
|
|
const lpjData = JSON.parse(lpjDataElement.value);
|
|
|
|
// Periksa apakah ada NPW tambahan
|
|
if (lpjData.npw_tambahan && lpjData.npw_tambahan.length > 0) {
|
|
lpjData.npw_tambahan.forEach((npw, index) => {
|
|
// Increment counter
|
|
npwCounter++;
|
|
|
|
// Buat row baru
|
|
const newNPWRow = document.createElement('div');
|
|
newNPWRow.className = 'flex grid-col-3 gap-2.5 w-full npw-row mb-3';
|
|
newNPWRow.innerHTML = `
|
|
|
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5 w-full">
|
|
<input type="text"
|
|
id="name_npw_${npwCounter}"
|
|
class="input w-full"
|
|
name="name_npw_${npwCounter}"
|
|
placeholder="Nama NPW"
|
|
value="${npw.name || ''}">
|
|
<input type="text"
|
|
id="luas_npw_${npwCounter}"
|
|
class="input w-full currency-format"
|
|
name="luas_npw_${npwCounter}"
|
|
placeholder="Luas NPW"
|
|
value="${npw.luas || ''}"
|
|
oninput="calculateTotal()">
|
|
</div>
|
|
|
|
|
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5 w-full">
|
|
<label for="province" class="">X</label>
|
|
<label class="input">
|
|
<i class="">Rp
|
|
</i>
|
|
<input type="text"
|
|
id="nilai_npw_${npwCounter}_1"
|
|
class=" w-full currency"
|
|
name="nilai_npw_${npwCounter}_1"
|
|
placeholder="Harga per meter"
|
|
value="${npw.nilai_1 || ''}"
|
|
oninput="calculateTotal()">
|
|
</label>
|
|
</div>
|
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5 w-full">
|
|
<label class="input">
|
|
<i class="">Rp
|
|
</i>
|
|
<input type="text"
|
|
id="nilai_npw_${npwCounter}_2"
|
|
class=" w-full currency-format"
|
|
name="nilai_npw_${npwCounter}_2"
|
|
placeholder="Total Nilai"
|
|
value="${npw.nilai_2 || ''}"
|
|
readonly>
|
|
</label>
|
|
<div>
|
|
<button type="button" class="btn btn-danger remove-npw h-full">
|
|
<i class="ki-filled ki-minus"></i>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
`;
|
|
|
|
// Tambahkan event listener untuk remove button
|
|
newNPWRow.querySelector('.remove-npw').addEventListener('click', function() {
|
|
newNPWRow.remove();
|
|
calculateTotal();
|
|
});
|
|
|
|
// Tambahkan event listener untuk currency format
|
|
newNPWRow.querySelectorAll('.currency-format').forEach(input => {
|
|
input.addEventListener('input', function() {
|
|
formatCurrency(this);
|
|
});
|
|
});
|
|
|
|
// Tambahkan row baru di bagian bawah
|
|
addPasarWajarContainer.appendChild(newNPWRow);
|
|
});
|
|
|
|
// Hitung total setelah memuat data
|
|
calculateTotal();
|
|
}
|
|
}
|
|
}
|
|
|
|
// Panggil fungsi load NPW saat halaman dimuat
|
|
loadSavedNPW();
|
|
document.querySelectorAll('.currency-format').forEach(input => {
|
|
input.addEventListener('input', function() {
|
|
formatCurrency(this);
|
|
});
|
|
});
|
|
|
|
});
|
|
|
|
function formatPercentage(value) {
|
|
// Hapus semua karakter kecuali angka dan koma
|
|
let numericValue = value.replace(/[^0-9,]/g, '');
|
|
|
|
// Pastikan hanya satu koma yang ada
|
|
let parts = numericValue.split(',');
|
|
if (parts.length > 2) {
|
|
numericValue = parts[0] + ',' + parts[1]; // Pertahankan hanya bagian pertama dan kedua
|
|
}
|
|
|
|
// Jika nilai melebihi 100, batasi menjadi 100
|
|
let numericFloat = parseFloat(numericValue.replace(',', '.')) || 0;
|
|
if (numericFloat > 100) {
|
|
numericFloat = 100;
|
|
numericValue = '100';
|
|
}
|
|
|
|
// Kembalikan nilai dengan simbol %
|
|
return numericValue;
|
|
}
|
|
|
|
function calculateTotal() {
|
|
const parseInput = (value) => {
|
|
if (!value) return 0;
|
|
return parseFloat(value.replace(/[^0-9]/g, '')) || 0;
|
|
};
|
|
|
|
// Function to format currency
|
|
function formatCurrency(value) {
|
|
// Ensure we have a valid number to format
|
|
const num = parseFloat(value.replace(/[^0-9]/g, '')) || 0;
|
|
return num.toLocaleString('id-ID');
|
|
}
|
|
|
|
// Function to format percentage
|
|
function formatPercentage(value) {
|
|
if (!value) return '';
|
|
const num = parseFloat(value.replace(/[^0-9.]/g, '')) || 0;
|
|
return num.toString();
|
|
}
|
|
|
|
// Calculate total nilai pasar wajar
|
|
let totalNilaiPasarWajar = 0;
|
|
|
|
// Get all kategori unik elements dynamically
|
|
const kategoriItems = document.querySelectorAll('[id^="luas_"]');
|
|
|
|
kategoriItems.forEach(item => {
|
|
const kategori = item.id.replace('luas_', '');
|
|
const luasInput = document.getElementById(`luas_${kategori}`);
|
|
const nilaiInput = document.querySelector(`input[name="nilai_${kategori}_1"]`);
|
|
const outputElement = document.querySelector(`input[name="nilai_${kategori}_2"]`);
|
|
|
|
if (luasInput && nilaiInput && outputElement) {
|
|
const luas = parseInput(luasInput.value);
|
|
const nilai = parseInput(nilaiInput.value);
|
|
const hasil = luas * nilai;
|
|
|
|
outputElement.value = formatCurrency(hasil.toString());
|
|
totalNilaiPasarWajar += hasil;
|
|
}
|
|
});
|
|
|
|
// Tambahkan perhitungan untuk NPW tambahan
|
|
const npwRows = document.querySelectorAll('.npw-row');
|
|
npwRows.forEach(row => {
|
|
const luasInput = row.querySelector('input[id^="luas_npw_"]');
|
|
const nilaiInput = row.querySelector('input[id^="nilai_npw_"][id$="_1"]');
|
|
const outputElement = row.querySelector('input[id^="nilai_npw_"][id$="_2"]');
|
|
|
|
if (luasInput && nilaiInput && outputElement) {
|
|
const luas = parseInput(luasInput.value);
|
|
const nilai = parseInput(nilaiInput.value);
|
|
const hasil = luas * nilai;
|
|
|
|
outputElement.value = formatCurrency(hasil.toString());
|
|
totalNilaiPasarWajar += hasil;
|
|
}
|
|
});
|
|
|
|
// Update total nilai pasar wajar
|
|
const totalElement = document.getElementById('total_nilai_pasar_wajar');
|
|
if (totalElement) {
|
|
totalElement.value = formatCurrency(totalNilaiPasarWajar.toString());
|
|
}
|
|
|
|
// Bagian Likuidasi
|
|
const persentaseLikuidasiInput = document.getElementById('likuidasi');
|
|
if (persentaseLikuidasiInput) {
|
|
let persentaseLikuidasi = parseInput(persentaseLikuidasiInput.value);
|
|
persentaseLikuidasiInput.value = formatPercentage(persentaseLikuidasiInput.value);
|
|
|
|
const totalNilaiPasarLikuidasi = document.querySelector('input[name="likuidasi_nilai_1"]');
|
|
const totalLikuidasi = document.querySelector('input[name="likuidasi_nilai_2"]');
|
|
|
|
if (totalNilaiPasarLikuidasi && totalLikuidasi) {
|
|
totalNilaiPasarLikuidasi.value = formatCurrency(totalNilaiPasarWajar.toString());
|
|
|
|
// Perhitungan Likuidasi
|
|
const hasilLikuidasi = (persentaseLikuidasi / 100) * totalNilaiPasarWajar;
|
|
totalLikuidasi.value = formatCurrency(hasilLikuidasi.toString());
|
|
}
|
|
}
|
|
|
|
// Bagian Asuransi (jika ada)
|
|
const luasBangunanAsuransi = document.getElementById('asuransi_luas_bangunan');
|
|
const hargaPerMeterAsuransi = document.querySelector('input[name="asuransi_nilai_1"]');
|
|
const totalNilaiAsuransi = document.querySelector('input[name="asuransi_nilai_2"]');
|
|
|
|
if (luasBangunanAsuransi && hargaPerMeterAsuransi && totalNilaiAsuransi) {
|
|
const luas = parseInput(luasBangunanAsuransi.value);
|
|
const nilai = parseInput(hargaPerMeterAsuransi.value);
|
|
const hasilAsuransi = luas * nilai;
|
|
|
|
totalNilaiAsuransi.value = formatCurrency(hasilAsuransi.toString());
|
|
}
|
|
}
|
|
|
|
|
|
function saveLpjSederhanadanStandard() {
|
|
const form = document.getElementById('form-lpj');
|
|
const formData = new FormData(form);
|
|
showLoadingSwal('Mengirim data ke server...');
|
|
|
|
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.storeLpjSederhanadanStandard') }}?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]);
|
|
});
|
|
}
|
|
hideLoadingSwal();
|
|
console.log(errors);
|
|
}
|
|
});
|
|
}
|
|
|
|
function formatCurrencyInput(input) {
|
|
const value = input.value.replace(/[^0-9]/g, ''); // Hapus karakter non-angka
|
|
if (!value) {
|
|
input.value = ''; // Kosongkan jika tidak ada angka
|
|
return;
|
|
}
|
|
|
|
// Format ke mata uang
|
|
const formattedValue = new Intl.NumberFormat('id-ID', {
|
|
style: 'currency',
|
|
currency: 'IDR'
|
|
}).format(value);
|
|
|
|
input.value = formattedValue;
|
|
}
|
|
</script>
|