716 lines
34 KiB
PHP
716 lines
34 KiB
PHP
@extends('layouts.main')
|
|
|
|
@section('breadcrumbs')
|
|
{{ Breadcrumbs::render(request()->route()->getName()) }}
|
|
@endsection
|
|
|
|
@section('content')
|
|
@include('lpj::assetsku.includenya')
|
|
<div class="w-full grid gap-5 lg:gap-7.5 mx-auto">
|
|
<div class="card border border-agi-100 pb-2.5">
|
|
<div class="card-header light:light:bg-agi-50" id="basic_settings">
|
|
<h3 class="card-title">
|
|
Detail Penilaian
|
|
</h3>
|
|
<div class="flex items-center gap-2">
|
|
<a href="{{ route('penilai.index') }}" class="btn btn-xs btn-info"><i class="ki-filled ki-exit-left"></i>
|
|
Back</a>
|
|
</div>
|
|
</div>
|
|
<div class="card-body grid gap-5">
|
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
|
<label class="form-label max-w-56">
|
|
Nomor Registrasi
|
|
</label>
|
|
<div class="flex flex-wrap items-baseline w-full">
|
|
<p class="flex w-full text-gray-600 font-medium text-sm">
|
|
{{ isset($permohonan->nomor_registrasi) ? $permohonan->nomor_registrasi : '' }}</p>
|
|
</div>
|
|
<label class="form-label max-w-56">
|
|
Nama Debitur
|
|
</label>
|
|
<div class="flex flex-wrap items-baseline w-full">
|
|
<p class="flex w-full text-gray-600 font-medium text-sm">
|
|
{{ isset($permohonan->debiture->name) ? $permohonan->debiture->name : '' }}</p>
|
|
</div>
|
|
</div>
|
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
|
<label class="form-label max-w-56">
|
|
Cabang
|
|
</label>
|
|
<div class="flex flex-wrap items-baseline w-full">
|
|
<p class="flex w-full text-gray-600 font-medium text-sm">
|
|
{{ isset($permohonan->branch->name) ? $permohonan->branch->name : '' }}</p>
|
|
</div>
|
|
<label class="form-label max-w-56">
|
|
Alamat Jaminan
|
|
</label>
|
|
<div class="flex flex-wrap items-baseline w-full">
|
|
<p class="flex w-full text-gray-600 font-medium text-sm">
|
|
{{ formatAlamat($permohonan->debiture) }}
|
|
</p>
|
|
</div>
|
|
</div>
|
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
|
<label class="form-label max-w-56">
|
|
Nama AO/Pemohon
|
|
</label>
|
|
<div class="flex flex-wrap items-baseline w-full">
|
|
<p class="flex w-full text-gray-600 font-medium text-sm">
|
|
{{ isset($permohonan->user->name) ? $permohonan->user->name : '' }}</p>
|
|
</div>
|
|
<label class="form-label max-w-56">
|
|
Fasilitas Kredit
|
|
</label>
|
|
<div class="flex flex-wrap items-baseline w-full">
|
|
<p class="flex w-full text-gray-600 font-medium text-sm">
|
|
{{ isset($permohonan->jenisFasilitasKredit->name) ? $permohonan->jenisFasilitasKredit->name : '' }}
|
|
</p>
|
|
</div>
|
|
</div>
|
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
|
<label class="form-label max-w-56">
|
|
Tanggal Permohonan
|
|
</label>
|
|
<div class="flex flex-wrap items-baseline w-full">
|
|
<p class="flex w-full text-gray-600 font-medium text-sm">
|
|
{{ formatTanggalIndonesia($permohonan->created_at) }}</p>
|
|
</div>
|
|
<label class="form-label max-w-56">
|
|
CIF
|
|
</label>
|
|
<div class="flex flex-wrap items-baseline w-full">
|
|
<p class="flex w-full text-gray-600 font-medium text-sm">
|
|
{{ isset($permohonan->debiture->cif) ? $permohonan->debiture->cif : '' }}</p>
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
|
<label class="form-label max-w-56">
|
|
Tanggal Konfirmasi Kunjungan
|
|
</label>
|
|
<div class="flex flex-wrap items-baseline w-full">
|
|
<p class="flex w-full text-gray-600 font-medium text-sm">
|
|
{{ formatTanggalIndonesia($permohonan->penilaian->tanggal_kunjungan) ?? '' }}</p>
|
|
</div>
|
|
@if (!in_array(strtolower($permohonan->tujuanPenilaian->name), ['penilaian ulang', 'asuransi', 'lelang']))
|
|
|
|
<label class="form-label max-w-56 ">
|
|
Status Bayar
|
|
</label>
|
|
<div class="flex flex-wrap items-baseline w-full">
|
|
<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>
|
|
</div>
|
|
@endif
|
|
</div>
|
|
</div>
|
|
|
|
|
|
@foreach ($permohonan->documents as $dokumen)
|
|
<div class="card border border-agi-100">
|
|
<div class="card-body grid gap-5">
|
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
|
@php
|
|
$surveyor = $permohonan->penilaian->userPenilai->where('role', 'surveyor')->first();
|
|
$penilai = $permohonan->penilaian->userPenilai->where('role', 'penilai')->first();
|
|
@endphp
|
|
<label class="form-label max-w-56">
|
|
Surveyor
|
|
</label>
|
|
<div class="flex flex-wrap items-baseline w-full">
|
|
|
|
<p class="flex w-full text-gray-600 font-medium text-sm">
|
|
{{ $surveyor->userPenilaiTeam->name }}
|
|
</p>
|
|
|
|
<p class="flex w-full text-gray-600 font-medium text-sm">
|
|
{{ checkRegionUserName($surveyor->userPenilaiTeam->id) }}
|
|
</p>
|
|
</div>
|
|
<label class="form-label max-w-56">
|
|
Penilai
|
|
</label>
|
|
<div class="flex flex-wrap items-baseline w-full">
|
|
|
|
<p class="flex w-full text-gray-600 font-medium text-sm">
|
|
{{ $penilai->userPenilaiTeam->name }}
|
|
</p>
|
|
|
|
<p class="flex w-full text-gray-600 font-medium text-sm">
|
|
{{ checkRegionUserName($penilai->userPenilaiTeam->id) }}
|
|
</p>
|
|
</div>
|
|
</div>
|
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
|
<label class="form-label max-w-56">
|
|
Tujuan Penilaian
|
|
</label>
|
|
<p class="flex text-gray-600 font-medium text-sm w-full">
|
|
{{ $permohonan->tujuanPenilaian->name }}</p>
|
|
<label class="form-label max-w-56">
|
|
Jenis Jaminan
|
|
</label>
|
|
<p class="flex text-gray-600 font-medium text-sm w-full">
|
|
@foreach ($permohonan->documents as $document)
|
|
{{ $document->jenisjaminan->name }}
|
|
@endforeach
|
|
</p>
|
|
</div>
|
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
|
<label class="form-label max-w-56">
|
|
Tanggal Survei
|
|
</label>
|
|
<div class="flex flex-wrap items-baseline w-full">
|
|
<p class="flex w-full text-gray-600 font-medium text-sm">
|
|
{{ formatTanggalIndonesia($permohonan->created_at) }}</p>
|
|
</div>
|
|
</div>
|
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
|
<label class="form-label max-w-56">
|
|
Tanggal Laporan
|
|
</label>
|
|
<div class="flex flex-wrap items-baseline w-full">
|
|
<p class="flex w-full text-gray-600 font-medium text-sm">
|
|
{{ formatTanggalIndonesia($permohonan->created_at) }}</p>
|
|
</div>
|
|
</div>
|
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
|
<label class="form-label max-w-56">
|
|
No. Laporan
|
|
</label>
|
|
<div class="flex flex-wrap items-baseline w-full">
|
|
<p class="flex w-full text-gray-600 font-medium text-sm">
|
|
{{ getNomorLaporan($permohonan->id, $dokumen->id) ?? '-' }}
|
|
</p>
|
|
</div>
|
|
</div>
|
|
|
|
@if ($permohonan->status == 'revisi-laporan')
|
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
|
<label class="form-label max-w-56">
|
|
Catatan Revisi
|
|
</label>
|
|
<div class="flex flex-wrap items-baseline w-full">
|
|
<p class="flex w-full text-gray-600 font-medium text-sm">
|
|
{{ $permohonan->keterangan ?? '' }}
|
|
</p>
|
|
</div>
|
|
</div>
|
|
@endif
|
|
|
|
</div>
|
|
@php
|
|
$inspeksiId = null;
|
|
foreach ($dokumen->inspeksi as $item) {
|
|
$inspeksiId = $item->id;
|
|
}
|
|
|
|
$jaminanId = $dokumen->id;
|
|
$currentInspeksi = $inspeksiData[$jaminanId] ?? null;
|
|
$tanahBangunanTypes = ['KAPAL', 'PESAWAT', 'ALAT BERAT'];
|
|
@endphp
|
|
|
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5 w-full card-footer mt-2 ">
|
|
<div class="flex gap-5">
|
|
<a class="btn btn-primary"
|
|
href="{{ route('penilai.lampiran') }}?permohonanId={{ $permohonan->id }}&documentId={{ $dokumen->id }}&inspeksiId={{ $inspeksiId }}&jaminanId={{ $dokumen->jenis_jaminan_id }}">
|
|
Lampiran Foto dan Dokumen
|
|
</a>
|
|
@if (strtolower($permohonan->tujuanPenilaian->name) != 'rap')
|
|
<a class="btn btn-primary" data-modal-toggle="#modal_2">
|
|
Kertas Kerja
|
|
</a>
|
|
@endif
|
|
<a class="btn btn-primary"
|
|
onclick="paparan({{ $permohonan->id }}, {{ $dokumen->id }}, {{ $inspeksiId }}, {{ $dokumen->jenis_jaminan_id }})">
|
|
Paparan
|
|
</a>
|
|
|
|
<div class="dropdown" data-dropdown="true" data-dropdown-trigger="click">
|
|
<button class="dropdown-toggle btn btn-primary ">
|
|
Pembuatan Laporan
|
|
</button>
|
|
|
|
{{-- kios tanah bangunan kalo dalam mall ruko --}}
|
|
<div class="dropdown-content w-full max-w-56 py-2">
|
|
<div class="menu menu-default flex flex-col w-full">
|
|
@if (strtolower($permohonan->tujuanPenilaian->name) == 'rap')
|
|
<div class="menu-item">
|
|
<a class="menu-link"
|
|
onclick="rap('{{ $permohonan->id }}', '{{ $dokumen->id }}', '{{ $inspeksiId }}', {{ $dokumen->jenis_jaminan_id }})">
|
|
<span class="menu-icon">
|
|
<i class="ki-outline ki-message-programming">
|
|
</i>
|
|
</span>
|
|
<span class="menu-title">
|
|
RAP
|
|
</span>
|
|
</a>
|
|
</div>
|
|
@else
|
|
{{-- pendapingan kjjp leleang --}}
|
|
{{-- memo pendapingan lelang --}}
|
|
{{-- existing di --}}
|
|
<div class="menu-item">
|
|
<a class="menu-link"
|
|
onclick="memo('{{ $permohonan->id }}', '{{ $dokumen->id }}', '{{ $inspeksiId }}', {{ $dokumen->jenis_jaminan_id }})">
|
|
<span class="menu-icon">
|
|
<i class="ki-outline ki-badge">
|
|
</i>
|
|
</span>
|
|
<span class="menu-title">
|
|
MEMO
|
|
</span>
|
|
</a>
|
|
</div>
|
|
@if (!in_array(strtoupper($dokumen->jenisJaminan->name), $tanahBangunanTypes))
|
|
@if ($permohonan->status_bayar === 'belum_bayar')
|
|
<div class="menu-item">
|
|
<a class="menu-link"
|
|
onclick="resume('{{ $permohonan->id }}', '{{ $dokumen->id }}', '{{ $inspeksiId }}', {{ $dokumen->jenis_jaminan_id }})">
|
|
<span class="menu-icon">
|
|
<i class="ki-outline ki-profile-circle">
|
|
</i>
|
|
</span>
|
|
<span class="menu-title">
|
|
RESUME
|
|
</span>
|
|
</a>
|
|
</div>
|
|
@endif
|
|
|
|
{{-- untuk laporan standart itu non kerjasama tapi sederhanan in kerjasama --}}
|
|
|
|
<div class="menu-item">
|
|
<a class="menu-link"
|
|
onclick="seletSederhanaStandart('{{ $permohonan->id }}', '{{ $dokumen->id }}', '{{ $inspeksiId }}', {{ $dokumen->jenis_jaminan_id }}, '{{ $permohonan->jenisFasilitasKredit->name }}', '{{ $permohonan->status_bayar }}')">
|
|
<span class="menu-icon">
|
|
<i class="ki-outline ki-setting-2"></i>
|
|
</span>
|
|
<span class="menu-title">LPJ</span>
|
|
</a>
|
|
</div>
|
|
@endif
|
|
<div class="menu-item">
|
|
<a class="menu-link"
|
|
onclick="callReport('{{ $permohonan->id }}', '{{ $dokumen->id }}', '{{ $inspeksiId }}', {{ $dokumen->jenis_jaminan_id }})">
|
|
<span class="menu-icon">
|
|
<i class="ki-outline ki-profile-circle">
|
|
</i>
|
|
</span>
|
|
<span class="menu-title">
|
|
CALL REPORT
|
|
</span>
|
|
</a>
|
|
</div>
|
|
@endif
|
|
|
|
{{-- @if ($permohonan->penilaian->jenis_penilaian_id == 2 && $permohonan->tujuanPenilaian->id == 4) --}}
|
|
|
|
{{-- @endif --}}
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="flex justify-end gap-5">
|
|
|
|
<a href="{{ route('surveyor.print_out_inspeksi', ['permohonan_id' => $permohonan->id, 'dokument_id' => $dokumen->id, 'jenis_jaminan_id' => $dokumen->jenis_jaminan_id]) }}"
|
|
class="btn btn-light">
|
|
<i class="ki-filled ki-printer"></i> Cetak Hasil Inspeksi
|
|
</a>
|
|
|
|
<a class="btn btn-outline btn-info "
|
|
onclick="checkLaporan('{{ $permohonan->id }}', '{{ $dokumen->id }}', '{{ $inspeksiId }}', {{ $dokumen->jenis_jaminan_id }}, 1 )">
|
|
<i class="ki-filled ki-eye"></i>
|
|
Lihat Laporan
|
|
</a>
|
|
|
|
<a class="btn btn-success"
|
|
onclick="checkLaporan('{{ $permohonan->id }}', '{{ $dokumen->id }}', '{{ $inspeksiId }}', {{ $dokumen->jenis_jaminan_id }}, 0 )">
|
|
<i class="ki-filled ki-printer"></i>
|
|
Cetak Laporan
|
|
</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@endforeach
|
|
<div class="flex justify-start gap-5">
|
|
<a class="btn btn-success" onclick="savePenilai()">
|
|
<i class="ki-filled ki-paper-plane"></i>
|
|
REPORT
|
|
</a>
|
|
|
|
<a class="btn btn-warning"
|
|
{{ $permohonan->status == 'proses-paparan' || $permohonan->status == 'proses-laporan' ? 'disabled' : '' }}
|
|
onclick="revisiSurveyor('{{ $permohonan->id }}', '{{ $permohonan->debiture->name }}', '{{ $permohonan->nomor_registrasi }}')">
|
|
<i class="ki-filled ki-arrow-circle-right"></i>
|
|
REVISI
|
|
</a>
|
|
</div>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="modal" data-modal="true" id="modal_2">
|
|
<div class="modal-content modal-center-y max-w-[600px]">
|
|
<div class="modal-header">
|
|
<h3 class="modal-title">
|
|
Kertas Kerja
|
|
</h3>
|
|
<button class="btn btn-xs btn-icon btn-light" data-modal-dismiss="true">
|
|
<i class="ki-outline ki-cross">
|
|
</i>
|
|
</button>
|
|
</div>
|
|
<div class="modal-body grid gap-5">
|
|
@php
|
|
$jenisJaminanId = null;
|
|
$inspeksiId = null;
|
|
$documentId = null;
|
|
$firstDocument = $permohonan->documents->first(); // Ambil dokumen pertama
|
|
|
|
if ($firstDocument) {
|
|
$documentId = $firstDocument->id;
|
|
|
|
// Ambil ID inspeksi pertama (jika ada)
|
|
if ($firstDocument->inspeksi->isNotEmpty()) {
|
|
$inspeksiId = $firstDocument->inspeksi->first()->id;
|
|
}
|
|
|
|
// Ambil jenis jaminan jika ada
|
|
if ($firstDocument->jenisjaminan) {
|
|
$jenisJaminanId = $firstDocument->jenisjaminan->id;
|
|
}
|
|
} else {
|
|
$documentId = 'Tidak ada dokumen';
|
|
$inspeksiId = 'Tidak ada inspeksi';
|
|
$jenisJaminanId = 'Tidak ada jenis jaminan';
|
|
}
|
|
|
|
@endphp
|
|
|
|
<div class="flex items-baseline w-full">
|
|
<label for="" class="form-label max-w-56">Import Kertas Kerja</label>
|
|
<div class="flex justify-center items-center gap-2">
|
|
<input type="file" id="kertas_kerja" class="file-input">
|
|
<button type="button" class="btn btn-outline btn-success"
|
|
onclick="uploadKertasKerja({{ $permohonan->id }}, '{{ $documentId }}', '{{ $inspeksiId }}', '{{ $jenisJaminanId }}')">Upload</button>
|
|
</div>
|
|
</div>
|
|
<div class="flex justify-between items-center">
|
|
@if (isset($permohonan->penilai) && isset($permohonan->penilai->kertas_kerja) && $permohonan->penilai->kertas_kerja)
|
|
<span data-modal-dismiss="true" class="btn btn-warning btn-outline"
|
|
onclick="viewPDF('{{ Storage::url($permohonan->penilai->kertas_kerja) }}')"><i
|
|
class="ki-filled ki-eye mr-2"></i>Lihat Kertas Kerja</span>
|
|
@endif
|
|
</div>
|
|
|
|
</div>
|
|
<div class="modal-footer">
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@endsection
|
|
|
|
@include('lpj::component.pdfviewer')
|
|
|
|
<script>
|
|
function seletSederhanaStandart(permohonanId, documentId, inspeksiId, jaminanId, fasilitasKredit, statusBayar) {
|
|
if (statusBayar === 'belum_bayar') {
|
|
Swal.fire({
|
|
title: 'Jenis LPJ Ditentukan',
|
|
text: 'Satus Pembayaran belum bayar. LPJ akan diarahkan ke resum.',
|
|
icon: 'info',
|
|
confirmButtonText: 'Lanjutkan',
|
|
confirmButtonColor: '#3085d6',
|
|
}).then(() => {
|
|
resume(permohonanId, documentId, inspeksiId, jaminanId)
|
|
});
|
|
|
|
} else {
|
|
fetch(
|
|
`{{ url('/penilai/check-status-lpj') }}?permohonanId=${permohonanId}&documentId=${documentId}&inspeksiId=${inspeksiId}`
|
|
)
|
|
.then(response => response.json())
|
|
.then(data => {
|
|
if (data.status) {
|
|
// Jika status LPJ sudah ada, arahkan langsung ke halaman
|
|
if (data.status === 'standard') {
|
|
showLoadingSwal('Tunggu ...');
|
|
window.location.href =
|
|
`{{ route('penilai.standard', $permohonan->id) }}?documentId=${documentId}&inspeksiId=${inspeksiId}&jaminanId=${jaminanId}`;
|
|
} else if (data.status === 'sederhana') {
|
|
showLoadingSwal('Tunggu ...');
|
|
window.location.href =
|
|
`{{ route('penilai.sederhana', $permohonan->id) }}?documentId=${documentId}&inspeksiId=${inspeksiId}&jaminanId=${jaminanId}`;
|
|
}
|
|
} else {
|
|
if (fasilitasKredit.toUpperCase() === 'KPR KERJASAMA') {
|
|
Swal.fire({
|
|
title: 'Jenis LPJ Ditentukan',
|
|
text: 'Jenis fasilitas kredit adalah KPR Kerjasama. LPJ akan diarahkan ke Sederhana.',
|
|
icon: 'info',
|
|
confirmButtonText: 'Lanjutkan',
|
|
confirmButtonColor: '#3085d6',
|
|
}).then(() => {
|
|
saveStatusLpj(permohonanId, documentId, inspeksiId, 'sederhana', jaminanId);
|
|
});
|
|
} else {
|
|
Swal.fire({
|
|
title: 'Pilih Jenis LPJ',
|
|
text: 'Apakah kamu akan memilih LPJ Standard?',
|
|
icon: 'question',
|
|
showCloseButton: true,
|
|
showDenyButton: true,
|
|
confirmButtonText: 'LPJ Standard',
|
|
denyButtonText: 'LPJ Sederhana',
|
|
confirmButtonColor: '#3085d6',
|
|
denyButtonColor: '#d33',
|
|
}).then((result) => {
|
|
if (result.isConfirmed) {
|
|
saveStatusLpj(permohonanId, documentId, inspeksiId, 'standard',
|
|
jaminanId);
|
|
} else if (result.isDenied) {
|
|
saveStatusLpj(permohonanId, documentId, inspeksiId, 'sederhana',
|
|
jaminanId);
|
|
}
|
|
});
|
|
}
|
|
}
|
|
console.log(data);
|
|
|
|
});
|
|
}
|
|
|
|
}
|
|
|
|
function saveStatusLpj(permohonanId, documentId, inspeksiId, type, jaminanId) {
|
|
fetch(`{{ url('/penilai/save-status-lpj') }}`, {
|
|
method: 'POST',
|
|
headers: {
|
|
'Content-Type': 'application/json',
|
|
'X-CSRF-TOKEN': '{{ csrf_token() }}',
|
|
},
|
|
body: JSON.stringify({
|
|
permohonan_id: permohonanId,
|
|
document_id: documentId,
|
|
inspeksi_id: inspeksiId,
|
|
type: type,
|
|
}),
|
|
}).then(response => response.json())
|
|
.then(data => {
|
|
if (data.success) {
|
|
if (type === 'standard') {
|
|
window.location.href =
|
|
`{{ route('penilai.standard', $permohonan->id) }}?documentId=${documentId}&inspeksiId=${inspeksiId}&jaminanId=${jaminanId}`;
|
|
} else if (type === 'sederhana') {
|
|
window.location.href =
|
|
`{{ route('penilai.sederhana', $permohonan->id) }}?documentId=${documentId}&inspeksiId=${inspeksiId}&jaminanId=${jaminanId}`;
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
function uploadKertasKerja(permohonanId, documentId, inspeksiId, jaminanId) {
|
|
const kertasKerjaInput = document.getElementById('kertas_kerja');
|
|
if (!kertasKerjaInput.files.length) {
|
|
Swal.fire({
|
|
title: 'Error!',
|
|
text: 'Silakan pilih file sebelum mengupload.',
|
|
icon: 'error',
|
|
confirmButtonText: 'OK'
|
|
});
|
|
return;
|
|
}
|
|
|
|
const kertasKerja = kertasKerjaInput.files[0];
|
|
const formData = new FormData();
|
|
formData.append('permohonan_id', permohonanId);
|
|
formData.append('document_id', documentId);
|
|
formData.append('inspeksi_id', inspeksiId);
|
|
formData.append('jenis_jaminan_id', jaminanId);
|
|
formData.append('kertas_kerja', kertasKerja);
|
|
|
|
fetch(`{{ url('/penilai/import/kertas-kerja') }}`, {
|
|
method: 'POST',
|
|
headers: {
|
|
'X-CSRF-TOKEN': '{{ csrf_token() }}',
|
|
},
|
|
body: formData,
|
|
})
|
|
.then(response => response.json()) // Pastikan respons diurai menjadi JSON
|
|
.then(data => {
|
|
if (data.success) {
|
|
Swal.fire({
|
|
title: 'Berhasil!',
|
|
text: data.message || 'Kertas kerja berhasil diunggah.',
|
|
icon: 'success',
|
|
confirmButtonText: 'OK'
|
|
}).then(result => {
|
|
if (result.isConfirmed) {
|
|
window.location.reload();
|
|
}
|
|
});
|
|
} else {
|
|
Swal.fire({
|
|
title: 'Error!',
|
|
text: data.message || 'Terjadi kesalahan.',
|
|
icon: 'error',
|
|
confirmButtonText: 'OK'
|
|
});
|
|
}
|
|
})
|
|
.catch(error => {
|
|
Swal.fire({
|
|
title: 'Error!',
|
|
text: 'Terjadi kesalahan saat mengunggah file.',
|
|
icon: 'error',
|
|
confirmButtonText: 'OK'
|
|
});
|
|
console.error('Error:', error); // Debug error di konsol
|
|
});
|
|
}
|
|
|
|
function resume(permohonanId, documentId, inspeksiId, jaminanId) {
|
|
showLoadingSwal('Tunggu ...');
|
|
window.location.href =
|
|
`{{ route('penilai.resume') }}?permohonanId=${permohonanId}&documentId=${documentId}&inspeksiId=${inspeksiId}&jaminanId=${jaminanId}`;
|
|
}
|
|
|
|
function memo(permohonanId, documentId, inspeksiId, jaminanId) {
|
|
showLoadingSwal('Tunggu ...');
|
|
window.location.href =
|
|
`{{ route('penilai.memo') }}?permohonanId=${permohonanId}&documentId=${documentId}&inspeksiId=${inspeksiId}&jaminanId=${jaminanId}`;
|
|
}
|
|
|
|
function rap(permohonanId, documentId, inspeksiId, jaminanId) {
|
|
showLoadingSwal('Tunggu ...');
|
|
window.location.href =
|
|
`{{ route('penilai.rap') }}?permohonanId=${permohonanId}&documentId=${documentId}&inspeksiId=${inspeksiId}&jaminanId=${jaminanId}`;
|
|
}
|
|
|
|
|
|
function paparan(permohonanId, documentId, inspeksiId, jaminanId) {
|
|
Swal.fire({
|
|
title: 'Apakah Kamu yakin ingin melakukan paparan',
|
|
icon: 'warning',
|
|
showCancelButton: true,
|
|
confirmButtonColor: '#3085d6',
|
|
cancelButtonColor: '#d33',
|
|
confirmButtonText: 'Yes'
|
|
}).then((result) => {
|
|
if (result.isConfirmed) {
|
|
window.location.href =
|
|
`/penilai/${permohonanId}/edit?document_id=${documentId}&inspeksi_id=${inspeksiId}&jaminanId=${jaminanId}`;
|
|
}
|
|
});
|
|
}
|
|
|
|
function callReport(permohonanId, documentId, inspeksiId, jaminanId) {
|
|
showLoadingSwal('Tunggu ...');
|
|
window.location.href =
|
|
`{{ route('penilai.call-report') }}?permohonanId=${permohonanId}&documentId=${documentId}&inspeksiId=${inspeksiId}&jaminanId=${jaminanId}`;
|
|
}
|
|
|
|
|
|
function savePenilai() {
|
|
showLoadingSwal('Mengirim data keserver ...');
|
|
$.ajax({
|
|
url: "{{ route('penilai.proses.laporan', ['id' => $permohonan->id]) }}",
|
|
type: "POST",
|
|
headers: {
|
|
'X-CSRF-TOKEN': '{{ csrf_token() }}'
|
|
},
|
|
success: function(response) {
|
|
if (response.success) {
|
|
// window.location.reload();
|
|
hideLoadingSwal();
|
|
toastrSuccessBuild(response.message);
|
|
} else {
|
|
// hideLoadingSwal();
|
|
Swal.fire('Perhatian!', response.message, 'warning');
|
|
}
|
|
},
|
|
error: function(xhr, status, error) {
|
|
console.log('Error checking button status:', error, status, xhr);
|
|
if (xhr.responseJSON.message) {
|
|
// window.location.reload();
|
|
toastrErrorBuild(xhr.responseJSON.message);
|
|
} else {
|
|
// window.location.reload();
|
|
toastrErrorBuild('Terjadi kesalahan');
|
|
}
|
|
hideLoadingSwal();
|
|
|
|
}
|
|
});
|
|
|
|
}
|
|
|
|
function revisiSurveyor(dataId, debitur, noreg) {
|
|
|
|
Swal.fire({
|
|
title: 'Apakah Anda yakin?',
|
|
text: `Untuk melakukan Revisi nomor registrasi ${noreg} atas nama debiture ${debitur} !`,
|
|
icon: 'warning',
|
|
input: 'textarea',
|
|
inputLabel: 'Keterangan',
|
|
inputPlaceholder: 'Masukkan keterangan...',
|
|
inputAttributes: {
|
|
'aria-label': 'Masukkan keterangan'
|
|
},
|
|
showCancelButton: true,
|
|
confirmButtonColor: '#3085d6',
|
|
cancelButtonColor: '#d33',
|
|
confirmButtonText: 'Ya, Lanjutkan!',
|
|
cancelButtonText: 'Batal',
|
|
}).then((result) => {
|
|
if (result.isConfirmed) {
|
|
const userMessage = result.value || '';
|
|
$.ajaxSetup({
|
|
headers: {
|
|
'X-CSRF-TOKEN': '{{ csrf_token() }}'
|
|
},
|
|
});
|
|
$.ajax({
|
|
url: `/penilai/revisi-surveyor/${dataId}`,
|
|
type: 'PUT',
|
|
data: {
|
|
keterangan: userMessage
|
|
},
|
|
success: (response) => {
|
|
Swal.fire('Berhasil!', response.message, 'success').then(
|
|
() => {
|
|
window.location.href =
|
|
'{{ route('penilai.index') }}';
|
|
});
|
|
console.log(response);
|
|
},
|
|
error: (error) => {
|
|
console.error('Error:', error);
|
|
Swal.fire('Gagal!', 'Terjadi kesalahan saat melakukan Revisi.',
|
|
'error');
|
|
}
|
|
});
|
|
}
|
|
});
|
|
}
|
|
</script>
|
|
|
|
@include('lpj::surveyor.js.utils')
|