fix(penilai/surveyor): perbaikkan call report, button camera, dan inspeksi berdasarkan dokument
This commit is contained in:
@@ -39,20 +39,57 @@
|
||||
@endphp
|
||||
<form id="formInspeksi" method="POST" enctype="multipart/form-data" class="grid gap-5">
|
||||
@csrf
|
||||
|
||||
@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) }}">
|
||||
@endif
|
||||
@endif
|
||||
@endforeach
|
||||
|
||||
<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') --}}
|
||||
|
||||
@php
|
||||
$paparan = $permohonan->status === 'proses-paparan' ? 'Paparan' : 'Pelaporan';
|
||||
@endphp
|
||||
<div class="card">
|
||||
<div class="card-header bg-agi-50">
|
||||
<h3 class="card-title uppercase">
|
||||
CALL Report
|
||||
</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' => $paparan]) }}"
|
||||
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">
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||
@@ -332,10 +369,10 @@
|
||||
<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)
|
||||
@if (!empty($forminspeksi['fakta']['fakta_positif']))
|
||||
@foreach ($forminspeksi['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>
|
||||
<textarea class="textarea mt-2" name="fakta_positif[]" rows="10">{{ 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>
|
||||
@@ -344,9 +381,8 @@
|
||||
@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;">
|
||||
<textarea class="textarea mt-2" name="fakta_positif[]" rows="10">{{ 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>
|
||||
@@ -361,10 +397,10 @@
|
||||
<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)
|
||||
@if (!empty($forminspeksi['fakta']['fakta_negatif']))
|
||||
@foreach ($forminspeksi['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>
|
||||
<textarea class="textarea mt-2" name="fakta_negatif[]" rows="10">{{ 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>
|
||||
@@ -373,9 +409,8 @@
|
||||
@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;">
|
||||
<textarea class="textarea mt-2" name="fakta_negatif[]" rows="10">{{ old('fakta_negatif.0', $forminspeksi['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>
|
||||
@@ -387,6 +422,42 @@
|
||||
</button>
|
||||
</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-container" class="flex items-baseline flex-wrap gap-2.5 w-full">
|
||||
@if (!empty($forminspeksi['fakta']['keterangan']) && is_array($forminspeksi['fakta']['keterangan']))
|
||||
@foreach ($forminspeksi['fakta']['keterangan'] as $index => $item)
|
||||
<div class="keterangan flex items-center gap-2 mt-2 textarea-group w-full">
|
||||
<textarea name="keterangan[]" class="textarea mt-2" placeholder="Masukkan catatan penting" rows="10">{{ old("keterangan.$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 flex items-center gap-2 mt-2 textarea-group w-full">
|
||||
<textarea name="keterangan[]" 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" class="alert text-danger text-sm"></em>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
<button type="button" onclick="addClonableItem('keterangan-container', 'keterangan')"
|
||||
class="btn btn-primary btn-sm mt-5 ">
|
||||
<i class="ki-outline ki-plus"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -402,9 +473,13 @@
|
||||
href="{{ route('penilai.lampiran') }}?permohonanId={{ request('permohonanId') }}&documentId={{ request('documentId') }}&inspeksiId={{ request('inspeksiId') }}&jaminanId={{ request('jaminanId') }}&statusLpj=1">
|
||||
LAMPIRAN FOTO DAN DOKUMEN
|
||||
</a>
|
||||
<a href="{{ route('surveyor.print_out_inspeksi', ['permohonan_id' => $permohonan->id, 'dokument_id' => request('documentId'), 'jenis_jaminan_id' => request('jaminanId')]) }}"
|
||||
class="btn btn-light">
|
||||
<i class="ki-filled ki-printer"></i> Hasil Inspeksi
|
||||
</a>
|
||||
<a class="btn btn-primary"
|
||||
onclick="checkLaporan('{{ $permohonan->id }}', '{{ request('documentId') }}', '{{ request('inspeksiId') }}', {{ request('jaminanId') }}, )">
|
||||
<i class="ki-filled ki-printer"></i> Print
|
||||
<i class="ki-filled ki-printer"></i> Print Laporan
|
||||
</a>
|
||||
@endif
|
||||
</div>
|
||||
@@ -413,7 +488,7 @@
|
||||
@endsection
|
||||
@push('scripts')
|
||||
<script type="text/javascript">
|
||||
const callReports = @json($callReport);
|
||||
const callReports = @json($forminspeksi);
|
||||
console.log('callReport', callReports)
|
||||
|
||||
|
||||
@@ -427,29 +502,11 @@
|
||||
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() || "";
|
||||
@@ -474,6 +531,24 @@
|
||||
const permohonanId = {{ $permohonan->id }};
|
||||
const documentId = urlParams.get('documentId');
|
||||
const inspeksiId = urlParams.get('inspeksiId');
|
||||
|
||||
const faktaPositif = Array.from(document.querySelectorAll('[name="fakta_positif[]"]'))
|
||||
.map(textarea => textarea.value.trim())
|
||||
.filter(value => value !== '');
|
||||
|
||||
const faktaNegatif = Array.from(document.querySelectorAll('[name="fakta_negatif[]"]'))
|
||||
.map(textarea => textarea.value.trim())
|
||||
.filter(value => value !== '');
|
||||
const keterangan = Array.from(document.querySelectorAll('[name="keterangan[]"]'))
|
||||
.map(textarea => textarea.value.trim())
|
||||
.filter(value => value !== '');
|
||||
|
||||
const action = Array.from(document.querySelectorAll('input[name="action"]'))
|
||||
.map(input => input.value)
|
||||
.join(',') || "";
|
||||
const type = Array.from(document.querySelectorAll('input[name="type"]'))
|
||||
.map(input => input.value)
|
||||
.join(',') || "";
|
||||
const requestUrl =
|
||||
`{{ route('penilai.storeCallReport') }}?permohonan_id=${permohonanId}&inspeksi_id=${inspeksiId}&dokument_id=${documentId}`;
|
||||
|
||||
@@ -487,6 +562,11 @@
|
||||
dokument_id: documentId,
|
||||
inspeksi_id: inspeksiId,
|
||||
data: jsonData,
|
||||
fakta_positif: faktaPositif,
|
||||
fakta_negatif: faktaNegatif,
|
||||
action: action,
|
||||
type: type,
|
||||
keterangan: keterangan
|
||||
}),
|
||||
contentType: 'application/json',
|
||||
headers: {
|
||||
|
||||
@@ -225,52 +225,52 @@
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@isset($report['fakta']['fakta_positif'])
|
||||
<table style="margin: 5px 0; border-collapse: collapse; width: 100%;">
|
||||
<tr>
|
||||
<td style="">
|
||||
<h6 style="text-transform: uppercase; margin: 0; ">Faktor positif</h2>
|
||||
<h6 style="text-transform: uppercase; margin: 0; ">Faktor Positif</h2>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@foreach ($report['fakta']['fakta_positif'] as $key => $item)
|
||||
@isset($forminspeksi['fakta']['fakta_positif'])
|
||||
@foreach ($forminspeksi['fakta']['fakta_positif'] as $key => $item)
|
||||
<tr>
|
||||
<td>{{ $item }}</td>
|
||||
<td>{!! nl2br(e($item)) !!}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tr>
|
||||
</table>
|
||||
@endisset
|
||||
@isset($report['fakta']['fakta_negatif'])
|
||||
</tr>
|
||||
</table>
|
||||
<table style="margin: 5px 0; border-collapse: collapse; width: 100%;">
|
||||
<tr>
|
||||
<td style="">
|
||||
<h6 style="text-transform: uppercase; margin: 0; ">Faktor negatif</h2>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@isset($forminspeksi['fakta']['fakta_negatif'])
|
||||
@foreach ($forminspeksi['fakta']['fakta_negatif'] as $key => $item)
|
||||
<tr>
|
||||
<td>{!! nl2br(e($item)) !!}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
@endisset
|
||||
</tr>
|
||||
</table>
|
||||
<table style="margin: 5px 0; border-collapse: collapse; width: 100%;">
|
||||
<tr>
|
||||
<td style="">
|
||||
<h6 style="text-transform: uppercase; margin: 0; ">Faktor negatif</h2>
|
||||
<h6 style="text-transform: uppercase; margin: 0; ">Catatan Yang Perlu Diperhatikan</h6>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@foreach ($report['fakta']['fakta_negatif'] as $key => $item)
|
||||
@isset($forminspeksi['fakta']['keterangan'])
|
||||
@foreach ($forminspeksi['fakta']['keterangan'] as $key => $item)
|
||||
<tr>
|
||||
<td>{{ $item }}</td>
|
||||
<td>{!! nl2br(e($item)) !!}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tr>
|
||||
</table>
|
||||
@endforeach
|
||||
@endisset
|
||||
<table style="margin: 5px 0; border-collapse: collapse; width: 100%;">
|
||||
<tr>
|
||||
<td style="">
|
||||
<h6 style="text-transform: uppercase; margin: 0; ">3. Catatan Yang Perlu Diperhatikan</h6>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@isset($report['kesimpulan_saran'])
|
||||
@foreach ($report['kesimpulan_saran'] as $key => $item)
|
||||
<tr>
|
||||
<td> {{ $item }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
@endisset
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user