Initial Commit

This commit is contained in:
2025-05-06 15:05:09 +07:00
commit 7b885d7d45
695 changed files with 119779 additions and 0 deletions

View File

@@ -0,0 +1,360 @@
@if (!isset($status))
<div class="card border border-agi-100 {{ isset($hidePermohonan) ? 'hidden' : '' }}">
<div class="card-header bg-agi-50" id="advanced_settings_appearance">
@php
$title = $title ?? 'Data Permohonan';
@endphp
<h3 class="card-title">
{{ $title }}
</h3>
<div class="flex items-center gap-2">
{!! $customlink ?? "" !!}
@if (isset($id))
@php
$parameters = isset($id) ? ['id' => $id] : [];
if (isset($type)) {
$parameters['type'] = $type;
}
if (isset($additionalParam)) {
$parameters['additional'] = $additionalParam;
}
@endphp
<a href="{{ route($backLink, $parameters) }}" class="btn btn-xs btn-info">
<i class="ki-filled ki-exit-left"></i> Back
</a>
@else
<a href="{{ route($backLink, $queryParams ?? []) }}" class="btn btn-xs btn-info">
<i class="ki-filled ki-exit-left"></i> Back
</a>
@endif
</div>
</div>
<div class="card-body lg:py-7.5 grid grid-cols-3">
<div class="mb-5">
<h3 class="text-md font-medium text-gray-900">
Nomor Register Permohonan:
</h3>
<span class="text-2sm text-gray-700">
{{ $permohonan->nomor_registrasi }}
</span>
</div>
<div class="mb-5">
<h3 class="text-md font-medium text-gray-900">
Pemohon:
</h3>
<span class="text-2sm text-gray-700">
{{ $permohonan->user->nik }} | {{ $permohonan->user->name }} | {{ $permohonan->user->branch->name }}
</span>
</div>
@if(isset($penawaran))
<div class="mb-5">
<h3 class="text-md font-medium text-gray-900">
Nomor Penawaran:
</h3>
<span class="text-2sm text-gray-700">
{{ $penawaran->code }}
</span>
</div>
<div class="mb-5">
<h3 class="text-md font-medium text-gray-900">
Nomor Penawaran:
</h3>
<span class="text-2sm text-gray-700">
{{ $penawaran->tujuanPenilaianKjpp->name }}
</span>
</div>
@else
<div class="mb-5">
<h3 class="text-md font-medium text-gray-900">
Tujan Permohonan:
</h3>
<span class="text-2sm text-gray-700">
{{ $permohonan->tujuanPenilaian->name }}
</span>
</div>
<div class="mb-5">
<h3 class="text-md font-medium text-gray-900">
Nilai Plafond:
</h3>
<span class="text-2sm text-gray-700">
{{ $permohonan->nilaiPlafond->name }}
</span>
</div>
<div class="mb-5">
<h3 class="text-md font-medium text-gray-900">
Status Bayar:
</h3>
<span
class="text-md font-bold {{ $permohonan->status_bayar === 'belum_bayar' ? 'text-red-600' : 'text-green-600' }} uppercase">
{{ str_replace('_', ' ', $permohonan->status_bayar) }}
</span>
</div>
@endif
</div>
</div>
<div class="card border border-agi-100 min-w-full">
<div class="card-header light:bg-agi-50">
<h3 class="card-title">
Detail Debitur
</h3>
</div>
<div class="card-table scrollable-x-auto pb-3">
<div class="grid grid-cols-1 xl:grid-cols-2 gap-5 lg:gap-7.5">
<div class="col-span-1">
<table class="table align-middle text-sm text-gray-500">
<tr>
<td class="py-2 text-gray-600 font-normal">
Nama
</td>
<td class="py-2 text-gray-800 font-normaltext-sm">
{{ $permohonan->debiture->name ?? '' }}
</td>
</tr>
<tr>
<td class="py-3">
Email
</td>
<td class="py-3 text-gray-700 text-2sm font-normal">
{{ $permohonan->debiture->email ?? '' }}
</td>
</tr>
<tr>
<td class="py-3">
No Hp
</td>
<td class="py-3 text-gray-700 text-2sm font-normal">
{{ $permohonan->debiture->phone ?? '' }}
</td>
</tr>
<tr>
<td class="py-3 text-gray-600 font-normal">
Alamat
</td>
<td class="py-3 text-gray-700 text-sm font-normal">
{{ $permohonan->debiture->address ?? '' }}
</td>
</tr>
<tr>
<td class="py-3 text-gray-600 font-normal">
&nbsp;
</td>
<td class="py-3 text-gray-700 text-sm font-normal">
{{ $permohonan->debiture->village->name ?? '' }},
{{ $permohonan->debiture->district->name ?? '' }},
{{ $permohonan->debiture->city->name ?? '' }},
{{ $permohonan->debiture->province->name ?? '' }} -
{{ $permohonan->debiture->village->postal_code ?? '' }}
</td>
</tr>
</table>
</div>
<div class="col-span-1">
<table class="table align-middle text-sm text-gray-500">
<tr>
<td class="py-3 text-gray-600 font-normal">
Cabang
</td>
<td class="py-2 text-gray-800 font-normaltext-sm">
{{ $permohonan->debiture->branch->name ?? '' }}
</td>
</tr>
<tr>
<td class="py-3 text-gray-600 font-normal">
CIF
</td>
<td class="py-2 text-gray-800 font-normaltext-sm">
{{ $permohonan->debiture->cif ?? '' }}
</td>
</tr>
<tr>
<td class="py-3 text-gray-600 font-normal">
Nomor Rekening
</td>
<td class="py-3 text-gray-700 text-sm font-normal">
{{ $permohonan->debiture->nomor_rekening ?? '' }}
</td>
</tr>
<tr>
<td class="py-3">
NPWP
</td>
<td class="py-3 text-gray-700 text-2sm font-normal">
{{ $permohonan->debiture->npwp ?? '' }}
</td>
</tr>
</table>
</div>
</div>
</div>
</div>
<div class="card border border-agi-100 min-w-full">
<div class="card-header light:bg-agi-50">
<h3 class="card-title">
Data Jaminan
</h3>
</div>
@endif
<div data-accordion="true">
@foreach ($permohonan->documents as $dokumen)
<div class="accordion-item {{ count($permohonan->documents) == 1 ? 'active' : '' }} [&:not(:last-child)]:border-b border-b-gray-200"
data-accordion-item="true" id="accordion_detail_jaminan">
<button @class(['accordion-toggle py-4 group', 'mx-8' => !isset($status)])"
data-accordion-toggle="#accordion_detail_jaminan_{{ $loop->index }}">
<span class="text-base text-gray-900 font-medium">
@if (count($permohonan->documents) > 1)
Jaminan {{ $loop->index + 1 }}
@else
Jaminan
@endif
</span>
<i class="ki-outline ki-plus text-gray-600 text-2sm accordion-active:hidden block">
</i>
<i class="ki-outline ki-minus text-gray-600 text-2sm accordion-active:block hidden">
</i>
</button>
<div class="accordion-content {{ count($permohonan->documents) > 1 ? 'hidden' : '' }}"
id="accordion_detail_jaminan_{{ $loop->index }}">
@if (!isset($status))
<div class="card-body lg:py-7.5 grid grid-cols-2">
<div class="mb-5">
<h3 class="text-md font-medium text-gray-900">
Pemilik Jaminan:
</h3>
<span class="text-2sm text-gray-700">
{{ $dokumen->pemilik->name ?? '' }}
</span>
</div>
<div class="mb-5">
<h3 class="text-md font-medium text-gray-900">
Jenis Jaminan:
</h3>
<span class="text-2sm text-gray-700">
{{ $dokumen->jenisJaminan->name ?? '' }}
</span>
</div>
<div class="mb-5">
<h3 class="text-md font-medium text-gray-900">
Hubungan Pemilik Jaminan:
</h3>
<span class="text-2sm text-gray-700">
{{ $dokumen->pemilik->hubungan_pemilik->name ?? '' }}
</span>
</div>
<div class="mb-5">
<h3 class="text-md font-medium text-gray-900">
Alamat Jaminan:
</h3>
<span class="text-2sm text-gray-700">
{{ formatAlamat($dokumen) }}
</span>
</div>
</div>
@endif
<div class="card-table scrollable-x-auto pb-3">
<a href="{{ route('debitur.jaminan.bulk.download', ['id' => $permohonan->debiture->id, 'jaminan' => $dokumen->id]) }}"
class="ml-6 btn btn-dark dark:btn-light">
<i class="ki-outline ki-cloud-download"></i> Download Semua Dokumen
</a>
<table class="table align-middle text-sm text-gray-500">
@php $document = $dokumen; @endphp
@foreach($document->detail as $detail)
@if(isset($detail->dokumen_jaminan))
<tr>
<td colspan="2">
<strong class="text-2xs text-gray-600 uppercase">
{{ $loop->index+1 }}. {{ $detail->jenisLegalitasJaminan->name }}
</strong>
</td>
</tr>
@if(isset($detail->dokumen_jaminan))
@php
$dokumen_jaminan = is_array(json_decode($detail->dokumen_jaminan)) ? json_decode($detail->dokumen_jaminan) : [$detail->dokumen_jaminan];
$dokumen_nomor = is_array(json_decode($detail->dokumen_nomor)) ? json_decode($detail->dokumen_nomor) : ($detail->dokumen_nomor ? [$detail->dokumen_nomor] : []);
@endphp
@foreach($dokumen_jaminan as $index => $dokumen)
<tr>
<td>
<span class="text-2xs text-gray-600 uppercase pl-3">
{{ $loop->index+1 }}. Nomor : {{ $dokumen_nomor[$index] }}
</span>
</td>
<td class="text-left">
@if(in_array(Auth::user()->roles[0]->name,['administrator','pemohon-eo']))
<a href="{{ route('debitur.jaminan.download', ['id' => $permohonan->debiture->id, 'dokumen' => $detail->id, 'index' => $index]) }}"
class="flex-none badge badge-sm badge-outline mt-2 mr-2">
{{ basename($dokumen) }}
<i class="ki-filled ki-cloud-download"></i>
</a>
@endif
<span class="badge badge-sm badge-outline badge-warning mt-2" onclick="viewPDF('{{ Storage::url($dokumen_jaminan[$index]) }}')">
<i class="ki-filled ki-eye mr-2"></i>Preview
</span>
</td>
</tr>
@if(isset($detail->details) && isset(json_decode($detail->details)[$index]))
@foreach (json_decode($detail->details)[$index] as $key => $value)
<tr>
<td>
<span class="text-2xs text-gray-600 uppercase pl-3">
- {{ str_replace("_"," ",$key) ?? "" }}
</span>
</td>
<td class="text-left">
<p class="text-2xs text-gray-600 max-w-[250px]">
{{ $value }}
</p>
</td>
</tr>
@endforeach
@endif
@endforeach
@endif
<tr>
<td>
<span class="text-2xs text-gray-600 uppercase pl-3">
- keterangan
</span>
</td>
<td class="text-right">
<p class="text-2xs text-gray-600 max-w-[250px]">
{{ $detail->keterangan }}
</p>
</td>
</tr>
@endif
@endforeach
</table>
</div>
</div>
</div>
@endforeach
</div>
@if (!isset($status))
</div>
@include('lpj::component.lampiran-dokumen')
@include('lpj::component.history-permohonan')
@endif
@include('lpj::component.pdfviewer')

View File

@@ -0,0 +1,623 @@
<div class="w-full grid gap-5 lg:gap-7.5 mx-auto">
@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) }}">
@if (array_intersect($kategoriUnik, ['tanah', 'bangunan', 'apartemen-kantor']))
@include('lpj::surveyor.components.header')
@endif
@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 class="card-tools">
<a href="{{ route('penilai.showDataPembanding', ['id' => $permohonan->id]) }}?dokument={{ request()->documentId }}&jenis_jaminan={{ request()->jaminanId }}"
class="btn btn-primary" data-bs-toggle="modal">
Edit Data Pembanding
</a>
</div>
</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',
'apartemen-kantor' => 'Luas Unit',
'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)
@php
if ($item === 'bangunan') {
$luas =
$forminspeksi['bangunan']['luas_tanah_bagunan']['tidak sesuai'] ??
($forminspeksi['bangunan']['luas_tanah_bagunan']['sesuai'] ?? null);
} elseif ($item === 'tanah') {
$luas =
$forminspeksi['tanah']['luas_tanah']['tidak sesuai'] ??
($forminspeksi['tanah']['luas_tanah']['sesuai'] ?? null);
} else if ($item === 'apartemen-kantor') {
$luas = $forminspeksi['luas_unit']['sesuai'] ?? ($forminspeksi['luas_unit']['tidak sesuai'] ?? null);
} else {
$luas = null;
}
$luas = old('luas_' . $item, $lpjData['luas_' . $item] ?? $luas);
$luasKey = 'luas_' . $item;
$nilaiKey1 = 'nilai_' . $item . '_1';
$nilaiKey2 = 'nilai_' . $item . '_2';
@endphp
@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="{{ $luasKey }}" class="input w-full"
name="{{ $luasKey }}"
value="{{ old($luasKey, $lpjData[$luasKey] ?? 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="{{ $nilaiKey1 }}" class="w-full currency"
name="{{ $nilaiKey1 }}"
value="{{ old($nilaiKey1, $lpjData[$nilaiKey1] ?? 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="{{ $nilaiKey2 }}" type="text"
class="w-full currency-format"
name="{{ $nilaiKey2 }}"
value="{{ old($nilaiKey2, $lpjData[$nilaiKey2] ?? 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>
<script type="text/javascript">
const datas = @json($lpjData);
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="ls_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="ls_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 => {
console.log(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^="ls_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 = Math.ceil((persentaseLikuidasi / 100) * totalNilaiPasarWajar / 10) * 10;
console.log('hasilLikuidasi', hasilLikuidasi);
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>

View File

@@ -0,0 +1,77 @@
<div class="card border border-agi-100 min-w-full">
<div class="card-header light:bg-agi-50">
<h3 class="card-title">
Activity
</h3>
</div>
<div class="card-body">
<div class="flex flex-col">
@foreach($permohonan->histories as $activity)
<div class="flex items-start relative">
@if($loop->first)
<div
class="w-9 left-0 top-9 absolute bottom-0 translate-x-1/2 border-l border-l-primary">
</div>
@endif
@if(!$loop->last && !$loop->first)
<div
class="w-9 left-0 top-9 absolute bottom-0 translate-x-1/2 border-l border-l-gray-300">
</div>
@endif
<div
class="flex items-center justify-center shrink-0 rounded-full
{{ $loop->first ? 'btn-outline btn-primary' : 'bg-gray-100 border-gray-300 text-gray-600' }}
size-9">
@switch(strtolower($activity->status))
@case('preregister')
<i class="ki-filled ki-note-2 text-base"></i>
@break
@case('order')
<i class="ki-filled ki-handcart text-base"></i>
@break
@case('revisi')
<i class="ki-filled ki-notepad-edit text-base"></i>
@break
@case('register')
<i class="ki-filled ki-note-2 text-base"></i>
@break
@case('assign')
<i class="ki-filled ki-file-added"></i>
@break
@case('survey')
<i class="ki-filled ki-map text-base"></i>
@break
@case('proses laporan')
<i class="ki-filled ki-paper-plane text-base"></i>
@break
@case('approved')
<i class="ki-filled ki-check text-base"></i>
@break
@case('delivered')
<i class="ki-filled ki-delivery-3 text-base"></i>
@break
@default
<i class="ki-filled ki-information text-base"></i>
@endswitch
</div>
<div class="ml-3 mb-5">
<span class="text-sm text-gray-700 capitalize font-medium">{{ str_replace('-',' ',$activity->status) }}</span>
<p class="text-xs text-gray-500 mt-1">{{ $activity->keterangan ? 'Catatan : '.$activity->keterangan : '' }}</p>
<div class="flex items-center mt-2">
<span class="text-xs text-gray-400">{{ $activity->created_by ? $activity->creator->name : 'System' }}</span>
<span class="text-xs text-gray-400 ml-2">{{ $activity->created_at->format('d M Y H:i') }}</span>
</div>
@if($activity->file_path)
<a href="{{ route('activity.download', $activity->permohonan_id) }}" class="text-xs text-blue-600 hover:underline mt-2 inline-block">
<i class="ki-outline ki-attachment"></i> Attachment
</a>
@endif
</div>
</div>
@endforeach
</div>
</div>
</div>

View File

@@ -0,0 +1,547 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Penilaian Aset</title>
<style>
* {
box-sizing: border-box;
}
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 15px;
font-size: 12px;
line-height: 1.4;
}
.header-table,
.data-table {
width: 100%;
border-collapse: collapse;
margin-bottom: 15px;
}
.header-table td {
padding: 5px 8px;
border: 1px solid #ddd;
vertical-align: top;
}
.header-table .title {
font-weight: bold;
background-color: #f1f3f5;
width: 30%;
}
.header-table .value {
background-color: #f9f9f9;
width: 70%;
}
.data-table th,
.data-table td {
border: 1px solid #ddd;
padding: 5px 8px;
text-align: left;
word-wrap: break-word;
max-width: 150px;
overflow: hidden;
text-overflow: ellipsis;
}
.data-table th {
background-color: #f1f3f5;
text-align: center;
font-weight: bold;
}
.data-table tr:nth-child(even) {
background-color: #f9f9f9;
}
.text-center {
text-align: center;
}
@media print {
body {
font-size: 10px;
}
}
</style>
</head>
<body>
<table class="header-table">
<tr>
<td class="title">Pendekatan Pasar</td>
<td class="value">Metode Perbandingan Data Pasar</td>
</tr>
<tr>
<td class="title">Tanggal Penilaian</td>
<td class="value">{{ $tanggal_penilaian ?? '-' }}</td>
</tr>
<tr>
<td class="title">Nama Pemilik Aset</td>
<td class="value">-</td>
</tr>
<tr>
<td class="title">Nama Pemberi Tugas</td>
<td class="value">-</td>
</tr>
<tr>
<td class="title">Lokasi</td>
<td class="value">{{ $lokasi ?? '-' }}</td>
</tr>
<tr>
<td class="title">Nama Debitur</td>
<td class="value">-</td>
</tr>
</table>
<h4>A Informasi Umum
</h4>
<table class="data-table">
<thead>
<tr>
<th width="5">No.</th>
<th width="20">Uraian</th>
<th width="15">Objek Penilaian</th>
<th width="20">Data Pembanding 1</th>
<th width="20">Data Pembanding 2</th>
<th width="20">Data Pembanding 3</th>
</tr>
</thead>
<tbody>
@php
$dataform = json_decode(isset($data->data_form) ? $data->data_form : '', true) ?? [];
$dataPembanding = json_decode(isset($data->data_pembanding) ? $data->data_pembanding : '', true) ?? [];
// print_r($dataform);
// echo $dataform;
@endphp
@php
function getNestedValue($data, $keyPath, $default = '-')
{
// Pecah path kunci menjadi array
$keys = explode('.', $keyPath);
// Mulai dari data awal
$value = $data;
// Telusuri setiap kunci
foreach ($keys as $key) {
// Cek apakah kunci ada di level saat ini
if (is_array($value) && array_key_exists($key, $value)) {
$value = $value[$key];
} else {
// Jika kunci tidak ditemukan, kembalikan default
return $default;
}
}
// Kembalikan nilai akhir atau default jika kosong
return $value ?? $default;
}
$rows = [
[
'label' => 'Jenis Aset',
'key' => 'asset.jenis_aset',
'default' => 'Rumah Tinggal',
'variants' => [
'sesuai' => 'Sesuai',
'tidak sesuai' => 'Tidak Sesuai',
],
],
[
'label' => 'Luas Tanah (M²)',
'key' => 'tanah.luas_tanah',
'default' => '-',
'variants' => [
'sesuai' => 'Sesuai',
'tidak sesuai' => 'Tidak Sesuai',
],
],
[
'label' => 'Luas Bangunan (M²)',
'key' => 'bangunan.luas_tanah_bangunan',
'default' => '-',
'variants' => [
'sesuai' => 'Sesuai',
'tidak sesuai' => 'Tidak Sesuai',
],
],
[
'label' => 'Penawaran Transaksi',
'key' => '-',
'default' => '-',
'variants' => [
'sesuai' => 'Sesuai',
'tidak sesuai' => 'Tidak Sesuai',
],
],
[
'label' => 'Tanggal Penawaran',
'key' => 'bangunan.luas_tanah_bangunan',
'default' => '-',
'variants' => [
'sesuai' => 'Sesuai',
'tidak sesuai' => 'Tidak Sesuai',
],
],
[
'label' => 'Discon',
'key' => 'bangunan.luas_tanah_bangunan',
'default' => '-',
'variants' => [
'sesuai' => 'Sesuai',
'tidak sesuai' => 'Tidak Sesuai',
],
],
[
'label' => 'Estimasi Harga',
'key' => 'bangunan.luas_tanah_bangunan',
'default' => '-',
'variants' => [
'sesuai' => 'Sesuai',
'tidak sesuai' => 'Tidak Sesuai',
],
],
[
'label' => 'Telepon Contact person',
'key' => 'bangunan.luas_tanah_bangunan',
'default' => '-',
'variants' => [
'sesuai' => 'Sesuai',
'tidak sesuai' => 'Tidak Sesuai',
],
],
[
'label' => 'Nama Nara Sumber',
'key' => 'bangunan.luas_tanah_bangunan',
'default' => '-',
'variants' => [
'sesuai' => 'Sesuai',
'tidak sesuai' => 'Tidak Sesuai',
],
],
[
'label' => 'Status Nara Sumber',
'key' => 'bangunan.luas_tanah_bangunan',
'default' => '-',
'variants' => [
'sesuai' => 'Sesuai',
'tidak sesuai' => 'Tidak Sesuai',
],
],
[
'label' => 'Waktu Penawaran',
'key' => 'bangunan.luas_tanah_bangunan',
'default' => '-',
'variants' => [
'sesuai' => 'Sesuai',
'tidak sesuai' => 'Tidak Sesuai',
],
],
[
'label' => 'Alamat',
'key' => 'bangunan.luas_tanah_bangunan',
'default' => '-',
'variants' => [
'sesuai' => 'Sesuai',
'tidak sesuai' => 'Tidak Sesuai',
],
],
[
'label' => 'Jalan',
'key' => 'bangunan.luas_tanah_bangunan',
'default' => '-',
'variants' => [
'sesuai' => 'Sesuai',
'tidak sesuai' => 'Tidak Sesuai',
],
],
[
'label' => 'Desa/Kelurahan',
'key' => 'bangunan.luas_tanah_bangunan',
'default' => '-',
'variants' => [
'sesuai' => 'Sesuai',
'tidak sesuai' => 'Tidak Sesuai',
],
],
[
'label' => 'Kecamatan',
'key' => 'bangunan.luas_tanah_bangunan',
'default' => '-',
'variants' => [
'sesuai' => 'Sesuai',
'tidak sesuai' => 'Tidak Sesuai',
],
],
[
'label' => 'Kota/Kabupaten',
'key' => 'bangunan.luas_tanah_bangunan',
'default' => '-',
'variants' => [
'sesuai' => 'Sesuai',
'tidak sesuai' => 'Tidak Sesuai',
],
],
[
'label' => 'Provinsi',
'key' => 'bangunan.luas_tanah_bangunan',
'default' => '-',
'variants' => [
'sesuai' => 'Sesuai',
'tidak sesuai' => 'Tidak Sesuai',
],
],
[
'label' => 'Jarak Pembanding dengan Objek',
'key' => 'bangunan.luas_tanah_bangunan',
'default' => '-',
'variants' => [
'sesuai' => 'Sesuai',
'tidak sesuai' => 'Tidak Sesuai',
],
],
[
'label' => 'Esitmasi Rangking Tanah',
'key' => 'bangunan.luas_tanah_bangunan',
'default' => '-',
'variants' => [
'sesuai' => 'Sesuai',
'tidak sesuai' => 'Tidak Sesuai',
],
],
[
'label' => 'Estimasi Ranking bangunan',
'key' => 'bangunan.luas_tanah_bangunan',
'default' => '-',
'variants' => [
'sesuai' => 'Sesuai',
'tidak sesuai' => 'Tidak Sesuai',
],
],
];
@endphp
@foreach ($rows as $index => $item)
<tr>
<td class="text-center">{{ $index + 1 }}</td>
<td>{{ $item['label'] }}</td>
<td>
@php
// Coba berbagai varian kunci
$objekValue = '-';
foreach (['sesuai', 'tidak sesuai'] as $variant) {
$fullKey = $item['key'] . '.' . $variant;
$objekValue = getNestedValue($dataform, $fullKey, $item['default']);
// Jika nilai ditemukan, hentikan pencarian
if ($objekValue !== $item['default']) {
break;
}
}
@endphp
{{ $objekValue }}
</td>
@for ($i = 0; $i < 3; $i++)
<td>
@php
$pembandingValue = '-';
// Pastikan data pembanding tersedia
if (isset($dataPembanding['data_pembanding'][$i])) {
$pembandingItem = $dataPembanding['data_pembanding'][$i];
// Mapping key berdasarkan label
switch ($item['label']) {
case 'Jenis Aset':
$pembandingValue = $pembandingItem['jenis_aset'] ?? '-';
break;
case 'Luas Tanah (M²)':
$pembandingValue = $pembandingItem['luas_tanah'] ?? '-';
break;
case 'Luas Bangunan (M²)':
$pembandingValue = $pembandingItem['luas_bangunan'] ?? '-';
break;
default:
$pembandingValue = '-';
}
}
@endphp
{{ $pembandingValue }}
</td>
@endfor
</tr>
@endforeach
</tbody>
</table>
<h4> B. Estimasi Nilai Tanah Pembanding dengan Teknik Penyisaan Tanah untuk mendapatkan per meter persegi estimasi
Nilai Tanah Pembanding</h4>
<table>
<table class="data-table">
<thead>
<tr>
<th width="5">No.</th>
<th width="20">Uraian</th>
<th width="15">Objek Penilaian</th>
<th width="20">Data Pembanding 1</th>
<th width="20">Data Pembanding 2</th>
<th width="20">Data Pembanding 3</th>
</tr>
</thead>
<tbody>
@php
$estimasi = [
[
'label' => 'Biaya Teknis Bangunan',
],
[
'label' => 'Estimasi Biaya Pengganti Baru Bangunan',
],
[
'label' => 'Estimasi Biaya Pengganti SPL (Rp)',
],
[
'label' => 'Penyusutan Fisik Banguan',
],
];
@endphp
@foreach ($estimasi as $index => $item)
<tr>
<td class="text-center">{{ $index + 1 }}</td>
<td>{{ $item['label'] }}</td>
<td>-</td>
@for ($i = 0; $i < 3; $i++)
<td>
@php
$pembandingValue = '-';
// Pastikan data pembanding tersedia
if (isset($dataPembanding['data_pembanding'][$i])) {
$pembandingItem = $dataPembanding['data_pembanding'][$i];
// Mapping key berdasarkan label
switch ($item['label']) {
case 'Jenis Aset':
$pembandingValue = $pembandingItem['jenis_aset'] ?? '-';
break;
case 'Luas Tanah (M²)':
$pembandingValue = $pembandingItem['luas_tanah'] ?? '-';
break;
case 'Luas Bangunan (M²)':
$pembandingValue = $pembandingItem['luas_bangunan'] ?? '-';
break;
default:
$pembandingValue = '-';
}
}
@endphp
{{ $pembandingValue }}
</td>
@endfor
</tr>
@endforeach
</tbody>
</table>
<h4>Peta Objek dan Pembanding</h4>
@php
$fotoTypes = ['foto_gistaru', 'foto_bhumi', 'foto_argis_region', 'foto_tempat'];
@endphp
<div class="grid grid-cols-4 gap-4">
@forelse ($fotoTypes as $type)
<div class="text-center">
@php
$imagePath = $dataform[$type];
@endphp
@if ($imagePath && Storage::exists($imagePath))
<img
src="{{ asset('storage/' . $imagePath) }}"
alt="{{ $type }}"
class="max-w-full h-auto mx-auto"
onerror="this.src='{{ asset('default-image.png') }}'"
>
<p class="mt-2 text-sm">{{ Str::title(str_replace('_', ' ', $type)) }}</p>
@else
<div class="bg-gray-200 p-4 text-center">
<p>Tidak ada gambar</p>
</div>
@endif
</div>
@empty
<p>Tidak ada tipe foto yang tersedia</p>
@endforelse
</div>
<h4 class="mt-6">FOTO OBJEK DAN DATA PEMBANDING</h4>
<div class="grid grid-cols-4 gap-4">
@forelse ($dataPembanding['data_pembanding'] ?? [] as $index => $item)
<div class="text-center">
@php
$fotoObjek = $item['foto_objek'];
@endphp
@if ($fotoObjek && Storage::exists($fotoObjek))
<img
src="{{ asset('storage/' . $fotoObjek) }}"
alt="Foto Objek Pembanding {{ $loop->iteration }}"
class="max-w-full h-auto mx-auto"
onerror="this.src='{{ asset('default-image.png') }}'"
>
<p class="mt-2 text-sm">Data Pembanding {{ $loop->iteration }}</p>
@else
<div class="bg-gray-200 p-4 text-center">
<p>Tidak ada gambar pembanding</p>
</div>
@endif
</div>
@empty
<p class="col-span-4">Tidak ada data pembanding</p>
@endforelse
</div>
<h4 class="mt-6">FOTO OBJEK</h4>
</body>
</html>
<script>
const data = @json($dataform);
console.log(data);
</script>

View File

@@ -0,0 +1,75 @@
<!-- New section for Lampiran Dokumen -->
<div class="card border border-agi-100 min-w-full mt-5">
<div class="card-header light:bg-agi-50">
<h3 class="card-title">
Lampiran Dokumen
</h3>
</div>
<div class="card-body">
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
@forelse($permohonan->lampiranDokumen as $lampiran)
<div class="border p-4 rounded-lg">
<h4 class="font-semibold mb-2">{{ $lampiran->nama_file }}</h4>
<p class="text-sm text-gray-600 mb-2">Keterangan : {{ $lampiran->keterangan }}</p>
<p class="text-sm text-gray-600 mb-2 capitalize">Jenis Lampiran : {{ str_replace('-',' ',$lampiran->jenisLampiran->nama) }}</p>
<div class="flex justify-between items-center">
<div>
<a href="{{ Storage::url($lampiran->path_file) }}" target="_blank" class="text-blue-600 hover:underline">
<i class="ki-filled ki-eye mr-2"></i>View
</a>
<a href="{{ Storage::url($lampiran->path_file) }}" download="{{ Storage::url($lampiran->path_file) }}" class="text-green-600 hover:underline ml-4">
<i class="ki-filled ki-cloud-download mr-2"></i>Download
</a>
</div>
@if(Auth::user()->hasRole('administrator'))
<form action="{{ route('lampiran.delete', $lampiran->id) }}" method="POST" onsubmit="return confirm('Are you sure you want to delete this lampiran?');">
@csrf
@method('DELETE')
<button type="submit" class="text-red-600 hover:underline">
<i class="ki-filled ki-trash mr-2"></i>Delete
</button>
</form>
@endif
</div>
</div>
@empty
<p class="col-span-3 text-center text-gray-500">Tidak ada lampiran dokumen.</p>
@endforelse
</div>
@if(Auth::user()->hasRole(['Penilai', 'administrator','penilai','admin','surveyor']))
<form action="{{ route('lampiran.upload') }}" method="POST" enctype="multipart/form-data" class="mt-6">
@csrf
<input type="hidden" name="permohonan_id" value="{{ $permohonan->id }}">
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
<div>
<label for="nama_file" class="block text-sm font-medium text-gray-700">Nama File</label>
<input type="text" name="nama_file" id="nama_file" required class="input mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm sm:text-sm border-gray-300 rounded-md">
</div>
<div>
<label for="file" class="block text-sm font-medium text-gray-700">File</label>
<input type="file" name="file" id="file" required class="file-input mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm sm:text-sm border-gray-300 rounded-md">
</div>
<div>
<label for="jenis_lampiran_id" class="block text-sm font-medium text-gray-700">Jenis Lampiran</label>
<select name="jenis_lampiran_id" id="jenis_lampiran_id" required class="tomselect mt-1 block w-full py-2 px-3 border border-gray-300 bg-white rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm">
<option value="">Pilih Jenis Lampiran</option>
@foreach(\Modules\Lpj\Models\JenisLampiran::all() as $jenisLampiran)
<option value="{{ $jenisLampiran->id }}">{{ $jenisLampiran->nama }}</option>
@endforeach
</select>
</div>
<div class="md:col-span-2">
<label for="keterangan" class="block text-sm font-medium text-gray-700">Keterangan</label>
<textarea name="keterangan" id="keterangan" rows="3" class="textarea mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm sm:text-sm border-gray-300 rounded-md"></textarea>
</div>
</div>
<div class="mt-4">
<button type="submit" class="inline-flex justify-center py-2 px-4 border border-transparent shadow-sm text-sm font-medium rounded-md text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500">
Upload Lampiran
</button>
</div>
</form>
@endif
</div>
</div>

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,66 @@
<!-- Modal for PDF and Image viewing -->
<div id="previewModal" class="fixed inset-0 bg-gray-800 bg-opacity-75 flex items-center justify-center hidden w-full z-50">
<div class="bg-white rounded-lg overflow-hidden shadow-xl transform transition-all min-w-3xl w-[1280px] h-[768px]">
<div class="p-4 h-full flex flex-col">
<div class="flex justify-between items-center mb-4">
<button type="button" id="downloadBtn" class="btn btn-primary btn-sm">
<i class="ki-duotone ki-cloud-download me-1"><span class="path1"></span><span class="path2"></span></i>
Download File
</button>
<button type="button" onclick="closePreviewModal()" class="text-2xl">
<i class="ki-filled ki-cross-square text-red-600"></i>
</button>
</div>
<div id="previewContent" class="flex-grow"></div>
</div>
</div>
</div>
@push('scripts')
<script src="{{ asset('vendor/pdfobject.min.js') }}"></script>
<script>
let currentFileUrl = '';
function viewPDF(url) {
currentFileUrl = url;
const fileExtension = url.split('.').pop().toLowerCase();
const previewContent = document.getElementById('previewContent');
if (['pdf'].includes(fileExtension)) {
PDFObject.embed(url, "#previewContent");
} else if (['jpg', 'jpeg', 'png', 'gif'].includes(fileExtension)) {
previewContent.innerHTML = `<img src="${url}" alt="Preview" class="max-w-full max-h-full object-contain">`;
} else {
previewContent.innerHTML = '<p class="text-center">Unsupported file type</p>';
}
document.getElementById('previewModal').classList.remove('hidden');
document.addEventListener('keydown', handleEscKey);
}
function closePreviewModal() {
document.getElementById('previewModal').classList.add('hidden');
document.removeEventListener('keydown', handleEscKey);
}
function handleEscKey(event) {
if (event.key === 'Escape') {
closePreviewModal();
}
}
// Close modal when clicking outside the content
document.getElementById('previewModal').addEventListener('click', function(event) {
if (event.target === this) {
closePreviewModal();
}
});
// Download functionality
document.getElementById('downloadBtn').addEventListener('click', function() {
if (currentFileUrl) {
window.open(currentFileUrl, '_blank');
}
});
</script>
@endpush

View File

@@ -0,0 +1,42 @@
@if (@isset($dokumen))
@foreach ($dokumen->detail as $detail)
@if (!empty($detail->name) && isset($detail->details) && !empty($detail->dokumen_jaminan))
<tr>
<td width="25%"><strong>{{ $detail->name ?? '' }}</strong></td>
</tr>
@endif
@if (isset($detail->details))
@php
$details = json_decode($detail->details, true);
@endphp
@if (is_array($details) && count($details) > 0)
@foreach ($details as $value)
@if (is_array($value))
@foreach ($value as $key => $item)
@if (!empty($item))
<tr>
<td style="padding: 2px;">
{{ formatLabel($key) }}
</td>
<td style="width:1%; padding: 2px; vertical-align: top;">:</td>
<td style="padding: 2px;">
@if (strpos(strtolower($key), 'tanggal') !== false)
{{ formatTanggalIndonesia($item) }}
@else
{{ $item }}
@if ($key == 'luas_bangunan' || $key == 'luas_tanah')
<span></span>
@endif
@endif
</td>
</tr>
@endif
@endforeach
@endif
@endforeach
@endif
@endif
@endforeach
@endif

View File

@@ -0,0 +1,63 @@
<style>
.signature-pad-container canvas {
max-width: 100%;
max-height: 100%;
object-fit: contain;
overflow: hidden;
}
.signature-pad-container {
position: relative;
display: flex;
flex-direction: column;
align-items: stretch;
}
.signature-pad {
width: 100%;
height: auto;
aspect-ratio: 2/1;
object-fit: contain;
}
</style>
<div class="signature-pad-container mx-auto border p-4 max-w-md sm:max-w-lg lg:max-w-xl">
<h3 class="signature-title text-md sm:text-lg mb-2 uppercase">{{ ucfirst($type) }}</h3>
<div class="w-full aspect-w-2 aspect-h-1">
<canvas
id="signature-pad-{{ $type }}"
class="signature-pad w-full h-full bg-white border rounded"
></canvas>
</div>
<input
type="text"
class="input w-full border p-2 mt-2 rounded"
name="name-{{ $type }}"
id="name-{{ $type }}"
placeholder="Enter your name"
/>
<div class="button-container flex justify-between py-4">
<button
type="button"
id="save-{{ $type }}"
class="btn btn-primary px-4 py-2 rounded "
>
Save
</button>
<button
type="button"
id="clear-{{ $type }}"
class="btn btn-light px-4 py-2 rounded"
>
Clear
</button>
<button
type="button"
id="delete-{{ $type }}"
class="btn btn-danger text-white px-4 py-2 rounded hover:bg-red-600"
>
Delete
</button>
</div>
<div id="status-{{ $type }}" class="status-message text-sm text-gray-600 mt-2"></div>
</div>