Merge remote-tracking branch 'composer/feature/senior-officer' into staging
# Conflicts: # database/seeders/KJPPSeeder.php
This commit is contained in:
@@ -1,16 +1,18 @@
|
||||
@extends('layouts.main')
|
||||
|
||||
@section('breadcrumbs')
|
||||
{{ Breadcrumbs::render('otorisator.'. strtolower($header)) }}
|
||||
{{ Breadcrumbs::render('otorisator.' . strtolower($header)) }}
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<div class="w-full grid gap-5 lg:gap-7.5 mx-auto">
|
||||
<div class="card pb-2.5">
|
||||
<div class=" card-grid min-w-full" data-datatable="false" data-datatable-page-size="5" data-datatable-state-save="false" id="permohonan-table" data-api-url="{{ route('otorisator.datatables', ['otorisator' => $header ]) }}">
|
||||
<div class=" card-grid min-w-full" data-datatable="false" data-datatable-page-size="5"
|
||||
data-datatable-state-save="false" id="permohonan-table"
|
||||
data-api-url="{{ route('otorisator.datatables', ['otorisator' => $header]) }}">
|
||||
<div class="card-header py-5 flex-wrap">
|
||||
<h3 class="card-title">
|
||||
Daftar {{$header}}
|
||||
Daftar {{ $header }}
|
||||
</h3>
|
||||
<div class="flex flex-wrap gap-2 lg:gap-5">
|
||||
<div class="flex">
|
||||
@@ -27,46 +29,56 @@
|
||||
|
||||
<div class="card-body">
|
||||
<div class="scrollable-x-auto">
|
||||
<table class="table table-auto table-border align-middle text-gray-700 font-medium text-sm" data-datatable-table="true">
|
||||
<table class="table table-auto table-border align-middle text-gray-700 font-medium text-sm"
|
||||
data-datatable-table="true">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="w-14">
|
||||
<input class="checkbox checkbox-sm" data-datatable-check="true" type="checkbox"/>
|
||||
</th>
|
||||
<th class="min-w-[150px]" data-datatable-column="nomor_registrasi">
|
||||
<span class="sort"> <span class="sort-label"> Nomor Registrasi </span>
|
||||
<span class="sort-icon"> </span> </span>
|
||||
</th>
|
||||
<th class="min-w-[150px]" data-datatable-column="tanggal_permohonan">
|
||||
<span class="sort"> <span class="sort-label"> Tanggal Permohonan </span>
|
||||
<span class="sort-icon"> </span> </span>
|
||||
</th>
|
||||
<th class="min-w-[150px]" data-datatable-column="user_id">
|
||||
<span class="sort"> <span class="sort-label"> User Pemohon </span>
|
||||
<span class="sort-icon"> </span> </span>
|
||||
</th>
|
||||
<th class="min-w-[150px]" data-datatable-column="branch_id">
|
||||
<span class="sort"> <span class="sort-label"> Cabang Pemohon </span>
|
||||
<span class="sort-icon"> </span> </span>
|
||||
</th>
|
||||
<th class="min-w-[150px]" data-datatable-column="debitur_id">
|
||||
<span class="sort"> <span class="sort-label"> Debitur </span>
|
||||
<span class="sort-icon"> </span> </span>
|
||||
</th>
|
||||
<th class="min-w-[150px]" data-datatable-column="tujuan_penilaian_id">
|
||||
<span class="sort"> <span class="sort-label"> Tujuan Penilaian </span>
|
||||
<span class="sort-icon"> </span> </span>
|
||||
</th>
|
||||
<tr>
|
||||
<th class="w-14">
|
||||
<input class="checkbox checkbox-sm" data-datatable-check="true" type="checkbox" />
|
||||
</th>
|
||||
<th class="min-w-[150px]" data-datatable-column="nomor_registrasi">
|
||||
<span class="sort"> <span class="sort-label"> Nomor Registrasi </span>
|
||||
<span class="sort-icon"> </span> </span>
|
||||
</th>
|
||||
<th class="min-w-[150px]" data-datatable-column="tanggal_permohonan">
|
||||
<span class="sort"> <span class="sort-label"> Tanggal Permohonan </span>
|
||||
<span class="sort-icon"> </span> </span>
|
||||
</th>
|
||||
<th class="min-w-[150px]" data-datatable-column="user_id">
|
||||
<span class="sort"> <span class="sort-label"> User Pemohon </span>
|
||||
<span class="sort-icon"> </span> </span>
|
||||
</th>
|
||||
<th class="min-w-[150px]" data-datatable-column="branch_id">
|
||||
<span class="sort"> <span class="sort-label"> Cabang Pemohon </span>
|
||||
<span class="sort-icon"> </span> </span>
|
||||
</th>
|
||||
<th class="min-w-[150px]" data-datatable-column="debitur_id">
|
||||
<span class="sort"> <span class="sort-label"> Debitur </span>
|
||||
<span class="sort-icon"> </span> </span>
|
||||
</th>
|
||||
<th class="min-w-[150px]" data-datatable-column="tujuan_penilaian_id">
|
||||
<span class="sort"> <span class="sort-label"> Tujuan Penilaian </span>
|
||||
<span class="sort-icon"> </span> </span>
|
||||
</th>
|
||||
|
||||
<th class="min-w-[50px] text-center" data-datatable-column="actions">Action</th>
|
||||
</tr>
|
||||
@if ($header == 'Pembayaran')
|
||||
<th class="min-w-[150px]" data-datatable-column="tujuan_penilaian_id">
|
||||
<span class="sort"> <span class="sort-label"> Status Bayar </span>
|
||||
<span class="sort-icon"> </span> </span>
|
||||
</th>
|
||||
@endif
|
||||
|
||||
<th class="min-w-[50px] text-center" data-datatable-column="actions">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
</div>
|
||||
<div class="card-footer justify-center md:justify-between flex-col md:flex-row gap-3 text-gray-600 text-2sm font-medium">
|
||||
<div
|
||||
class="card-footer justify-center md:justify-between flex-col md:flex-row gap-3 text-gray-600 text-2sm font-medium">
|
||||
<div class="flex items-center gap-2">
|
||||
Show
|
||||
<select class="select select-sm w-16" data-datatable-size="true" name="perpage"> </select> per page
|
||||
<select class="select select-sm w-16" data-datatable-size="true" name="perpage"> </select> per
|
||||
page
|
||||
</div>
|
||||
<div class="flex items-center gap-4">
|
||||
<span data-datatable-info="true"> </span>
|
||||
@@ -83,9 +95,8 @@
|
||||
|
||||
|
||||
@push('scripts')
|
||||
|
||||
<script>
|
||||
function otorisator(){
|
||||
function otorisator() {
|
||||
Swal.fire({
|
||||
title: 'Are you sure?',
|
||||
text: "You won't be able to revert this!",
|
||||
@@ -119,10 +130,11 @@
|
||||
|
||||
|
||||
|
||||
<script type="module">
|
||||
<script type="module">
|
||||
const element = document.querySelector('#permohonan-table');
|
||||
const searchInput = document.getElementById('search');
|
||||
|
||||
const dataHeader = @json($header);
|
||||
|
||||
|
||||
const apiUrl = element.getAttribute('data-api-url');
|
||||
@@ -170,14 +182,43 @@
|
||||
return `${data.tujuan_penilaian.name}`;
|
||||
},
|
||||
},
|
||||
...(dataHeader === 'Pembayaran' && {
|
||||
status_bayar: {
|
||||
title: 'Status Bayar',
|
||||
render: (item, data) => {
|
||||
const status = data.status_bayar.replace(/_/g,
|
||||
' ');
|
||||
const statusClass = data.status_bayar === 'belum_bayar' ? 'text-red-600' :
|
||||
'text-green-600';
|
||||
return `<span class="text-md font-bold ${statusClass} uppercase">
|
||||
${status}
|
||||
</span>`;
|
||||
},
|
||||
},
|
||||
}),
|
||||
|
||||
actions: {
|
||||
title: 'Status',
|
||||
render: (item, data) => {
|
||||
return `<div class="flex flex-nowrap justify-center">
|
||||
<a class="btn btn-sm btn-icon btn-clear btn-warning " href="otorisator/show/${data.id}">
|
||||
if (data.status != 'proses laporan' && dataHeader != 'Pelaporan') {
|
||||
return `<div class="flex flex-nowrap justify-center">
|
||||
<a class="btn btn-sm btn-icon btn-clear btn-warning " href="otorisator/show/${data.id}/${dataHeader}">
|
||||
<i class="ki-outline ki-eye"></i>
|
||||
</a>
|
||||
|
||||
<a class="btn btn-sm btn-icon btn-clear btn-primary " onclick="otorisatorData(${data.id})">
|
||||
<i class="ki-filled ki-double-check"></i>
|
||||
</a>
|
||||
</div>`;
|
||||
} else {
|
||||
return `<div class="flex flex-nowrap justify-center">
|
||||
<a class="btn btn-sm btn-icon btn-clear btn-success" onclick="showLoadingSwal('Masih Menunggu proses selesai dari penilai...')">
|
||||
<i class="ki-filled ki-watch"></i>
|
||||
|
||||
</a>
|
||||
</div>`
|
||||
}
|
||||
|
||||
},
|
||||
}
|
||||
},
|
||||
@@ -185,10 +226,65 @@
|
||||
|
||||
let dataTable = new KTDataTable(element, dataTableOptions);
|
||||
// Custom search functionality
|
||||
searchInput.addEventListener('input', function () {
|
||||
searchInput.addEventListener('input', function() {
|
||||
const searchValue = this.value.trim();
|
||||
dataTable.search(searchValue, true);
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
<script>
|
||||
function otorisatorData(dataId) {
|
||||
const dataHeader = @json($header);
|
||||
Swal.fire({
|
||||
title: 'Apakah Anda yakin?',
|
||||
text: `Untuk melakukan otorisator ${dataHeader}!`,
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#3085d6',
|
||||
cancelButtonColor: '#d33',
|
||||
confirmButtonText: 'Ya, Lanjutkan!',
|
||||
cancelButtonText: 'Batal',
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
$.ajaxSetup({
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': '{{ csrf_token() }}'
|
||||
},
|
||||
});
|
||||
$.ajax({
|
||||
url: `/otorisator/otorisator/${dataId}/${dataHeader}`,
|
||||
type: 'POST',
|
||||
success: (response) => {
|
||||
Swal.fire('Berhasil!', 'Data berhasil diotorisasi.', 'success').then(() => {
|
||||
window.location.reload();
|
||||
});
|
||||
console.log(response);
|
||||
},
|
||||
error: (error) => {
|
||||
console.error('Error:', error);
|
||||
Swal.fire('Gagal!', 'Terjadi kesalahan saat melakukan otorisator.',
|
||||
'error');
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function showLoadingSwal(message, duration = 5000) {
|
||||
Swal.fire({
|
||||
title: message,
|
||||
allowOutsideClick: false,
|
||||
didOpen: () => {
|
||||
Swal.showLoading();
|
||||
},
|
||||
timer: duration, // Durasi dalam milidetik
|
||||
timerProgressBar: true, // Menampilkan progres bar timer
|
||||
}).then((result) => {
|
||||
if (result.dismiss === Swal.DismissReason.timer) {
|
||||
console.log('Dialog loading otomatis ditutup.');
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
@@ -1,193 +1,67 @@
|
||||
@extends('layouts.main')
|
||||
|
||||
{{-- @section('breadcrumbs')
|
||||
{{ Breadcrumbs::render(request()->route()->getName()) }}
|
||||
@endsection --}}
|
||||
@section('breadcrumbs')
|
||||
{{ Breadcrumbs::render(request()->route()->getName(), $permohonan->id, $header) }}
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<div class="w-full grid gap-5 lg:gap-7.5 mx-auto">
|
||||
<div class="card">
|
||||
<div class="card-header" id="advanced_settings_appearance">
|
||||
<h3 class="card-title">
|
||||
Data Permohonan
|
||||
</h3>
|
||||
|
||||
@php
|
||||
$dataHeader = strtolower($header ?? '');
|
||||
@endphp
|
||||
|
||||
@include('lpj::component.detail-jaminan', ['backLink' => 'otorisator.'. $dataHeader . '.index'])
|
||||
|
||||
<div>
|
||||
<div>
|
||||
<button onclick="otorisatorData({{ $permohonan->id }})" type="button" class="btn btn-primary">
|
||||
<i class="ki-filled ki-double-check"></i>
|
||||
Otorisator {{ $header ?? '' }}
|
||||
</button>
|
||||
</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>
|
||||
|
||||
<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>
|
||||
</div>
|
||||
|
||||
<div class="card min-w-full">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title">
|
||||
Detail Debutur
|
||||
</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">
|
||||
Name
|
||||
</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">
|
||||
Phone
|
||||
</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">
|
||||
Address
|
||||
</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">
|
||||
|
||||
</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 min-w-full">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title">
|
||||
Laporan
|
||||
</h3>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<form id="approveForm" action="{{ route('authorization.update', $permohonan->id) }}" method="POST">
|
||||
<input type="hidden" name="_method" value="PUT">
|
||||
@csrf
|
||||
<div class="card-body lg:py-7.5">
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||
<label class="form-label max-w-56">
|
||||
Catatan
|
||||
</label>
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
<textarea class="textarea" rows="3" type="number" id="address" name="address"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer flex justify-end">
|
||||
<button onclick="return otorisator()" type="button" name="status" value="preregister" class="btn btn-success">
|
||||
Approve
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
<script>
|
||||
function otorisatorData(dataId) {
|
||||
const dataHeader = {!! json_encode($header ?? '') !!};
|
||||
|
||||
|
||||
<script>
|
||||
function otorisator(){
|
||||
Swal.fire({
|
||||
title: 'Are you sure?',
|
||||
text: "You won't be able to revert this!",
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#3085d6',
|
||||
cancelButtonColor: '#d33',
|
||||
confirmButtonText: 'Yes!'
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
document.getElementById('approveForm').submit();
|
||||
}
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
Swal.fire({
|
||||
title: 'Apakah Anda yakin?',
|
||||
text: `Untuk melakukan otorisator ${dataHeader}!`,
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#3085d6',
|
||||
cancelButtonColor: '#d33',
|
||||
confirmButtonText: 'Ya, Lanjutkan!',
|
||||
cancelButtonText: 'Batal',
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
$.ajaxSetup({
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': '{{ csrf_token() }}'
|
||||
},
|
||||
});
|
||||
$.ajax({
|
||||
url: `/otorisator/otorisator/${dataId}/${dataHeader}`,
|
||||
type: 'POST',
|
||||
success: (response) => {
|
||||
Swal.fire('Berhasil!', 'Data berhasil diotorisasi.', 'success').then(() => {
|
||||
window.location.reload();
|
||||
});
|
||||
console.log(response);
|
||||
},
|
||||
error: (error) => {
|
||||
console.error('Error:', error);
|
||||
Swal.fire('Gagal!', 'Terjadi kesalahan saat melakukan otorisator.',
|
||||
'error');
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
@@ -112,11 +112,16 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="px-4 py-2">Luas Tanah (m²)</td>
|
||||
@php
|
||||
$cekLuas = $inspectionData['tanah']['luas_tanah'] == 'sesuai' ? 'sesuai' :'tidak sesuai';
|
||||
|
||||
@endphp
|
||||
<td class="px-4 py-2">
|
||||
<input type="text" name="luas_tanah" class="input number-format"
|
||||
value="{{ $inspectionData['tanah']['luas_tanah']['tidak sesuai'] ?? ($inspectionData['tanah']['luas_tanah']['sesuai'] ?? '') }}">
|
||||
value="{{ $inspectionData['tanah']['luas_tanah']['sesuai'] ?? $inspectionData['tanah']['luas_tanah']['tidak sesuai'] ?? '' }}">
|
||||
</td>
|
||||
<td class="px-4 py-2">
|
||||
|
||||
<input type="text" name="luas_tanah_pembanding[]"
|
||||
class="input number-format">
|
||||
</td>
|
||||
@@ -124,8 +129,9 @@
|
||||
<tr>
|
||||
<td class="px-4 py-2">Luas Bangunan (m²)</td>
|
||||
<td class="px-4 py-2">
|
||||
|
||||
<input type="text" name="luas_tanah_bagunan" class="input number-format"
|
||||
value="{{ $inspectionData['bangunan']['luas_tanah_bagunan']['tidak sesuai'] ?? ($inspectionData['bangunan']['luas_tanah_bagunan']['sesuai'] ?? '') }}">
|
||||
value="{{ $inspectionData['bangunan']['luas_tanah_bagunan']['sesuai'] ?? $inspectionData['bangunan']['luas_tanah_bagunan']['tidak sesuai'] ?? '' }}">
|
||||
</td>
|
||||
<td class="px-4 py-2">
|
||||
<input type="text" name="luas_bangunan_pembanding[]"
|
||||
@@ -141,8 +147,8 @@
|
||||
<tr>
|
||||
<td class="px-4 py-2">Status Narasumber</td>
|
||||
<td class="px-4 py-2">
|
||||
<input type="text" name="nama_nara_sumber" class="input"
|
||||
value="{{ $inspectionData['nama_nara_sumber'] ?? '' }}">
|
||||
<input type="text" name="status_nara_sumber" class="input"
|
||||
value="{{ $inspectionData['asset']['status_nara_sumber'] ?? '' }}">
|
||||
</td>
|
||||
<td class="px-4 py-2">
|
||||
<input type="text" name="status_nara_sumber_pembanding[]"
|
||||
@@ -153,7 +159,7 @@
|
||||
<td class="px-4 py-2">Nama Narasumber</td>
|
||||
<td class="px-4 py-2">
|
||||
<input type="text" name="nama_nara_sumber" class="input"
|
||||
value="{{ $inspectionData['nama_nara_sumber'] ?? '' }}">
|
||||
value="{{ $inspectionData['asset']['nama_nara_sumber'] ?? '' }}">
|
||||
</td>
|
||||
<td class="px-4 py-2">
|
||||
<input type="text" name="nama_nara_sumber_pembanding[]"
|
||||
@@ -358,7 +364,7 @@
|
||||
<td class="px-4 py-2">Harga</td>
|
||||
<td class="px-4 py-2">
|
||||
<input type="text" name="harga" class="input currency-format"
|
||||
value="{{ $inspectionData['harga'] ?? '' }}">
|
||||
value="{{ $inspectionData['asset']['harga'] ?? '' }}">
|
||||
</td>
|
||||
<td class="px-4 py-2">
|
||||
<input type="text" name="harga_pembanding[]"
|
||||
@@ -368,8 +374,8 @@
|
||||
<tr>
|
||||
<td class="px-4 py-2">Diskon</td>
|
||||
<td class="px-4 py-2">
|
||||
<input type="text" name="harga" class="input currency-format"
|
||||
value="{{ $inspectionData['diskon'] ?? '' }}">
|
||||
<input type="text" name="diskon" class="input currency-format"
|
||||
value="{{ $inspectionData['asset']['diskon'] ?? '' }}">
|
||||
</td>
|
||||
<td class="px-4 py-2">
|
||||
<input type="text" name="diskon_pembanding[]"
|
||||
@@ -380,7 +386,7 @@
|
||||
<td class="px-4 py-2">Total</td>
|
||||
<td class="px-4 py-2">
|
||||
<input type="text" name="total" class="input currency-format"
|
||||
value="{{ $inspectionData['total'] ?? '' }}">
|
||||
value="{{ $inspectionData['asset']['total'] ?? '' }}">
|
||||
</td>
|
||||
<td class="px-4 py-2">
|
||||
<input type="text" name="total_pembanding[]"
|
||||
@@ -391,7 +397,7 @@
|
||||
<td class="px-4 py-2">Harga Setelah Diskon</td>
|
||||
<td class="px-4 py-2">
|
||||
<input type="text" name="harga_diskon" class="input currency-format"
|
||||
value="{{ $inspectionData['harga_diskon'] ?? '' }}">
|
||||
value="{{ $inspectionData['asset']['harga_diskon'] ?? '' }}">
|
||||
</td>
|
||||
<td class="px-4 py-2">
|
||||
<input type="text" name="harga_diskon_pembanding[]"
|
||||
@@ -417,43 +423,64 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Loading Overlay -->
|
||||
<div id="loadingOverlay" class="fixed inset-0 bg-black bg-opacity-50 hidden items-center justify-center z-50">
|
||||
<div class="bg-white p-4 rounded-lg">
|
||||
<div class="loader"></div>
|
||||
<p class="mt-2 text-center">Sedang memproses...</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
@include('lpj::surveyor.js.utils')
|
||||
<script>
|
||||
let columnCount = 1;
|
||||
|
||||
|
||||
|
||||
// Fungsi calculate prices yang diperbaiki
|
||||
function calculatePrices(index) {
|
||||
const hargaInput = document.getElementsByName('harga_pembanding[]')[index];
|
||||
const diskonInput = document.getElementsByName('diskon_pembanding[]')[index];
|
||||
const totalInput = document.getElementsByName('total_pembanding[]')[index];
|
||||
const hargaDiskonInput = document.getElementsByName('harga_diskon_pembanding[]')[index];
|
||||
|
||||
if (hargaInput && diskonInput && totalInput && hargaDiskonInput) {
|
||||
// Ambil nilai numerik dari input
|
||||
const harga = parseFloat(hargaInput.value.replace(/[^\d]/g, '') || '0');
|
||||
const diskon = parseFloat(diskonInput.value.replace(/[^\d]/g, '') || '0');
|
||||
|
||||
// Hitung total dan harga setelah diskon
|
||||
const total = harga;
|
||||
const hargaSetelahDiskon = harga - (harga * (diskon / 100));
|
||||
|
||||
// Update nilai dengan format currency
|
||||
if (totalInput) totalInput.value = formatCurrency(total.toString());
|
||||
if (hargaDiskonInput) hargaDiskonInput.value = formatCurrency(hargaSetelahDiskon.toString());
|
||||
}
|
||||
}
|
||||
|
||||
// Update fungsi fillPembandingData
|
||||
function fillPembandingData(data, index) {
|
||||
if (!data) return;
|
||||
|
||||
// Helper function untuk mengisi nilai input array dengan aman
|
||||
function setArrayInputValue(name, value, index) {
|
||||
const element = document.getElementsByName(name)[index];
|
||||
if (element) {
|
||||
if (element.tagName === "SELECT") {
|
||||
// Jika elemen adalah select, set selected value
|
||||
const options = Array.from(element.options);
|
||||
const optionToSelect = options.find(option => option.value === value);
|
||||
if (optionToSelect) {
|
||||
optionToSelect.selected = true;
|
||||
} else {
|
||||
element.selectedIndex = 0; // Pilih default jika tidak ditemukan
|
||||
element.selectedIndex = 0;
|
||||
}
|
||||
} else {
|
||||
// Jika elemen bukan select, langsung set value
|
||||
element.value = value || '';
|
||||
// Format currency untuk input harga
|
||||
if (name.includes('harga') || name.includes('total') || name.includes('diskon')) {
|
||||
element.value = formatCurrency(value ? value.toString() : '0');
|
||||
} else {
|
||||
element.value = value || '';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Isi data pembanding
|
||||
const inputs = {
|
||||
'jenis_aset_pembanding[]': data.jenis_aset,
|
||||
'luas_tanah_pembanding[]': data.luas_tanah,
|
||||
@@ -471,15 +498,13 @@
|
||||
'harga_diskon_pembanding[]': data.harga_diskon,
|
||||
'total_pembanding[]': data.total,
|
||||
'diskon_pembanding[]': data.diskon,
|
||||
|
||||
};
|
||||
|
||||
// Isi semua input fields
|
||||
Object.entries(inputs).forEach(([name, value]) => {
|
||||
setArrayInputValue(name, value, index);
|
||||
});
|
||||
|
||||
// Handle foto pembanding jika ada
|
||||
// Handle foto objek
|
||||
if (data.foto_objek) {
|
||||
const imageId = `uploadedImage${index + 2}`;
|
||||
const preview = document.getElementById(imageId);
|
||||
@@ -488,15 +513,59 @@
|
||||
preview.classList.remove('hidden');
|
||||
}
|
||||
}
|
||||
|
||||
// Handle lokasi secara berurutan
|
||||
if (data.province_code) {
|
||||
setTimeout(() => {
|
||||
getCity(data.province_code, index + 1).then(() => {
|
||||
if (data.city_code) {
|
||||
setArrayInputValue('city_code_pembanding[]', data.city_code, index);
|
||||
getDistrict(data.city_code, index + 1).then(() => {
|
||||
if (data.district_code) {
|
||||
setArrayInputValue('district_code_pembanding[]', data
|
||||
.district_code, index);
|
||||
getVillage(data.district_code, index + 1).then(() => {
|
||||
if (data.village_code) {
|
||||
setArrayInputValue('village_code_pembanding[]',
|
||||
data.village_code, index);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}, 100);
|
||||
}
|
||||
|
||||
// Hitung harga setelah data terisi
|
||||
setTimeout(() => calculatePrices(index), 200);
|
||||
}
|
||||
|
||||
// Update event listener untuk input harga dan diskon
|
||||
function initializePriceCalculation() {
|
||||
document.querySelectorAll('[name="harga_pembanding[]"], [name="diskon_pembanding[]"]').forEach((input) => {
|
||||
input.addEventListener('input', function() {
|
||||
const inputs = document.getElementsByName(this.name);
|
||||
const index = Array.from(inputs).indexOf(this);
|
||||
calculatePrices(index);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// Event listener dengan pengecekan data
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
try {
|
||||
const inspectionData = {!! isset($inspectionData) ? json_encode($inspectionData) : 'null' !!};
|
||||
const comparisons = {!! isset($comparisons) ? json_encode($comparisons) : 'null' !!};
|
||||
|
||||
console.log('inspectionData:', inspectionData);
|
||||
console.log('comparisons:', comparisons);
|
||||
|
||||
initializeFirstPembandingListeners();
|
||||
ensureLocationEventListeners();
|
||||
initializePriceCalculation();
|
||||
|
||||
if (comparisons) {
|
||||
comparisons.data_pembanding.forEach((comparison, index) => {
|
||||
if (index > 0) {
|
||||
@@ -513,30 +582,26 @@
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
function addColumn() {
|
||||
columnCount++;
|
||||
const table = document.getElementById('dataTable');
|
||||
const headerRow = table.querySelector('thead tr');
|
||||
const bodyRows = table.querySelectorAll('tbody tr');
|
||||
|
||||
// Add header
|
||||
const newHeader = document.createElement('th');
|
||||
newHeader.className = 'px-4 py-3 min-w-[250px]';
|
||||
newHeader.textContent = `Data Pembanding ${columnCount}`;
|
||||
headerRow.appendChild(newHeader);
|
||||
|
||||
// Add cells to each row
|
||||
bodyRows.forEach(row => {
|
||||
const newCell = document.createElement('td');
|
||||
newCell.className = 'px-4 py-2';
|
||||
|
||||
const lastInputCell = row.querySelector('td:last-child');
|
||||
if (lastInputCell) {
|
||||
const clonedContent = lastInputCell.innerHTML;
|
||||
const firstInputCell = row.querySelector('td:last-child');
|
||||
if (firstInputCell) {
|
||||
const clonedContent = firstInputCell.innerHTML;
|
||||
newCell.innerHTML = clonedContent;
|
||||
|
||||
// Update IDs and names for the new cell
|
||||
const inputs = newCell.querySelectorAll('input, select, textarea');
|
||||
inputs.forEach((input) => {
|
||||
if (input.type === 'file') {
|
||||
@@ -552,41 +617,63 @@
|
||||
}
|
||||
}
|
||||
|
||||
// Menangani select alamat
|
||||
if (input.tagName === 'SELECT') {
|
||||
const oldId = input.id;
|
||||
const newId = `${oldId}_${columnCount}`;
|
||||
const baseId = input.id.replace(/_\d+$/, '').replace('_pembanding', '');
|
||||
const newId = `${baseId}_pembanding_${columnCount}`;
|
||||
input.id = newId;
|
||||
|
||||
// Menambahkan event listener untuk select alamat
|
||||
if (oldId.includes('city')) {
|
||||
if (input.name.includes('jenis_aset')) {
|
||||
const originalOptions = document.querySelector(
|
||||
'select[name="jenis_aset_pembanding[]"]').innerHTML;
|
||||
input.innerHTML = originalOptions;
|
||||
} else if (!input.id.includes('province')) {
|
||||
// Reset opsi untuk select lokasi
|
||||
input.innerHTML = `<option value="">Pilih ${
|
||||
input.id.includes('city') ? 'Kota/Kabupaten' :
|
||||
input.id.includes('district') ? 'Kecamatan' :
|
||||
'Desa/Kelurahan'
|
||||
}</option>`;
|
||||
}
|
||||
|
||||
if (input.id.includes('province')) {
|
||||
input.onchange = function() {
|
||||
handleProvinceChange(this);
|
||||
};
|
||||
} else if (input.id.includes('city')) {
|
||||
input.onchange = function() {
|
||||
handleCityChange(this);
|
||||
};
|
||||
} else if (oldId.includes('district')) {
|
||||
} else if (input.id.includes('district')) {
|
||||
input.onchange = function() {
|
||||
handleDistrictChange(this);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// Clear values
|
||||
if (input.type !== 'file') {
|
||||
if (input.type !== 'file' && input.tagName !== 'SELECT') {
|
||||
input.value = '';
|
||||
}
|
||||
|
||||
if (input.classList.contains('currency-format')) {
|
||||
input.addEventListener('input', function() {
|
||||
formatCurrency(this);
|
||||
});
|
||||
}
|
||||
if (input.classList.contains('number-format')) {
|
||||
input.addEventListener('input', function() {
|
||||
formatNumber(this);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
row.appendChild(newCell);
|
||||
});
|
||||
|
||||
updateRemoveButtonVisibility();
|
||||
reinitializeEventListeners();
|
||||
}
|
||||
|
||||
|
||||
function updateDynamicId(currentId, columnCount) {
|
||||
return `${currentId.split('_')[0]}_${'code_pembanding'}_${columnCount}`;
|
||||
}
|
||||
|
||||
|
||||
function removeColumn() {
|
||||
if (columnCount > 1) {
|
||||
@@ -609,166 +696,36 @@
|
||||
}
|
||||
}
|
||||
|
||||
function fillComparisonData(comparison, index) {
|
||||
Object.entries(comparison).forEach(([key, value]) => {
|
||||
if (key === 'foto_objek') {
|
||||
const imageId = `uploadedImage${index + 1}`;
|
||||
const preview = document.getElementById(imageId);
|
||||
if (preview && value) {
|
||||
preview.src = `{{ asset('storage/pembanding/') }}/${value}`;
|
||||
preview.classList.remove('hidden');
|
||||
}
|
||||
} else {
|
||||
const input = document.querySelector(`[name="${key}_pembanding[]"]:nth-of-type(${index})`);
|
||||
if (input) {
|
||||
input.value = value;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function previewImage(input, imageId) {
|
||||
const preview = document.getElementById(imageId);
|
||||
if (input.files && input.files[0]) {
|
||||
const reader = new FileReader();
|
||||
reader.onload = function(e) {
|
||||
preview.src = e.target.result;
|
||||
preview.classList.remove('hidden');
|
||||
}
|
||||
reader.readAsDataURL(input.files[0]);
|
||||
}
|
||||
}
|
||||
|
||||
function formatCurrency(input) {
|
||||
let value = input.value.replace(/[^\d]/g, '');
|
||||
value = new Intl.NumberFormat('id-ID').format(value);
|
||||
input.value = value;
|
||||
}
|
||||
|
||||
function formatNumber(input) {
|
||||
let value = input.value.replace(/[^\d.]/g, '');
|
||||
input.value = value;
|
||||
}
|
||||
|
||||
function initializeEventListeners() {
|
||||
// Button event listeners
|
||||
document.getElementById('addColumnBtn').addEventListener('click', addColumn);
|
||||
document.getElementById('removeColumnBtn').addEventListener('click', removeColumn);
|
||||
|
||||
// Form submission
|
||||
|
||||
reinitializeEventListeners();
|
||||
}
|
||||
|
||||
|
||||
function reinitializeEventListeners() {
|
||||
// Currency format
|
||||
// Event listener yang sudah ada
|
||||
document.querySelectorAll('.currency-format').forEach(input => {
|
||||
input.addEventListener('input', function() {
|
||||
formatCurrency(this);
|
||||
});
|
||||
});
|
||||
|
||||
// Number format
|
||||
document.querySelectorAll('.number-format').forEach(input => {
|
||||
input.addEventListener('input', function() {
|
||||
formatNumber(this);
|
||||
});
|
||||
});
|
||||
|
||||
// Tambahkan kalkulasi harga
|
||||
initializePriceCalculation();
|
||||
|
||||
// Location event listeners
|
||||
ensureLocationEventListeners();
|
||||
}
|
||||
|
||||
function submitData() {
|
||||
const loadingOverlay = document.getElementById('loadingOverlay');
|
||||
loadingOverlay.classList.remove('hidden');
|
||||
loadingOverlay.classList.add('flex');
|
||||
const form = document.querySelector('form');
|
||||
const formData = new FormData(form);
|
||||
|
||||
console.log('Form data entries:', Array.from(formData.entries()));
|
||||
|
||||
$.ajax({
|
||||
url: '{{ route('surveyor.storeDataPembanding') }}',
|
||||
type: 'POST',
|
||||
data: formData,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': '{{ csrf_token() }}'
|
||||
},
|
||||
success: function(result) {
|
||||
if (result.success) {
|
||||
Swal.fire({
|
||||
title: 'Berhasil!',
|
||||
text: result.message,
|
||||
icon: 'success',
|
||||
confirmButtonText: 'OK'
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
window.location.href =
|
||||
'{{ route('surveyor.show', ['id' => $permohonan->id]) }}';
|
||||
}
|
||||
console.log(result);
|
||||
|
||||
});
|
||||
} else {
|
||||
Swal.fire({
|
||||
title: 'Error!',
|
||||
text: result.message || 'Terjadi kesalahan',
|
||||
icon: 'error',
|
||||
confirmButtonText: 'OK'
|
||||
});
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error('Error:', error);
|
||||
Swal.fire({
|
||||
title: 'Error!',
|
||||
text: 'Terjadi kesalahan pada server',
|
||||
icon: 'error',
|
||||
confirmButtonText: 'OK'
|
||||
});
|
||||
},
|
||||
complete: function() {
|
||||
loadingOverlay.classList.add('hidden');
|
||||
loadingOverlay.classList.remove('flex');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function loadIdSelectAddres(inputs) {
|
||||
const data = [
|
||||
'province_code_pembanding',
|
||||
'city_code_pembanding',
|
||||
'district_code_pembanding',
|
||||
'village_code_pembanding'
|
||||
]
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
// Inisialisasi event listener untuk data pembanding pertama
|
||||
initializeFirstPembandingListeners();
|
||||
|
||||
try {
|
||||
const inspectionData = {!! isset($inspectionData) ? json_encode($inspectionData) : 'null' !!};
|
||||
const comparisons = {!! isset($comparisons) ? json_encode($comparisons) : 'null' !!};
|
||||
|
||||
if (comparisons) {
|
||||
comparisons.data_pembanding.forEach((comparison, index) => {
|
||||
if (index > 0) {
|
||||
addColumn();
|
||||
}
|
||||
fillPembandingData(comparison, index);
|
||||
});
|
||||
}
|
||||
|
||||
updateRemoveButtonVisibility();
|
||||
initializeEventListeners();
|
||||
} catch (error) {
|
||||
console.error('Error initializing form:', error);
|
||||
}
|
||||
});
|
||||
|
||||
function initializeFirstPembandingListeners() {
|
||||
// Event listener untuk province pembanding pertama
|
||||
const firstProvinceSelect = document.getElementById('province_code_pembanding');
|
||||
if (firstProvinceSelect) {
|
||||
firstProvinceSelect.addEventListener('change', function() {
|
||||
@@ -779,7 +736,6 @@
|
||||
});
|
||||
}
|
||||
|
||||
// Event listener untuk city pembanding pertama
|
||||
const firstCitySelect = document.getElementById('city_code_pembanding');
|
||||
if (firstCitySelect) {
|
||||
firstCitySelect.addEventListener('change', function() {
|
||||
@@ -790,7 +746,6 @@
|
||||
});
|
||||
}
|
||||
|
||||
// Event listener untuk district pembanding pertama
|
||||
const firstDistrictSelect = document.getElementById('district_code_pembanding');
|
||||
if (firstDistrictSelect) {
|
||||
firstDistrictSelect.addEventListener('change', function() {
|
||||
@@ -802,11 +757,30 @@
|
||||
}
|
||||
}
|
||||
|
||||
function ensureLocationEventListeners() {
|
||||
document.querySelectorAll('[id^="province_code_pembanding"]').forEach(select => {
|
||||
select.onchange = function() {
|
||||
handleProvinceChange(this);
|
||||
};
|
||||
});
|
||||
|
||||
document.querySelectorAll('[id^="city_code_pembanding"]').forEach(select => {
|
||||
select.onchange = function() {
|
||||
handleCityChange(this);
|
||||
};
|
||||
});
|
||||
|
||||
document.querySelectorAll('[id^="district_code_pembanding"]').forEach(select => {
|
||||
select.onchange = function() {
|
||||
handleDistrictChange(this);
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
function handleProvinceChange(provinceSelect) {
|
||||
const provinceId = provinceSelect.value;
|
||||
let columnIndex;
|
||||
|
||||
// Cek apakah ini pembanding pertama atau tambahan
|
||||
if (provinceSelect.id === 'province_code_pembanding') {
|
||||
columnIndex = 1;
|
||||
} else {
|
||||
@@ -853,7 +827,6 @@
|
||||
const response = await fetch(`/locations/cities/province/${provinceId}`);
|
||||
const data = await response.json();
|
||||
|
||||
// Pilih dropdown berdasarkan index
|
||||
const cityDropdown = columnIndex === 1 ?
|
||||
document.getElementById('city_code_pembanding') :
|
||||
document.getElementById(`city_code_pembanding_${columnIndex}`);
|
||||
@@ -910,41 +883,60 @@
|
||||
}
|
||||
}
|
||||
|
||||
function submitData() {
|
||||
showLoadingSwal('Mengirim data ke server...');
|
||||
const form = document.querySelector('form');
|
||||
const formData = new FormData(form);
|
||||
|
||||
function resetDropdown(elementId, placeholder) {
|
||||
const dropdown = document.getElementById(elementId);
|
||||
dropdown.innerHTML = `<option value="">${placeholder}</option>`;
|
||||
console.log('Form data entries:', Array.from(formData.entries()));
|
||||
|
||||
$.ajax({
|
||||
url: '{{ route('surveyor.storeDataPembanding') }}',
|
||||
type: 'POST',
|
||||
data: formData,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': '{{ csrf_token() }}'
|
||||
},
|
||||
success: function(result) {
|
||||
hideLoadingSwal();
|
||||
console.log(result);
|
||||
if (result.success) {
|
||||
Swal.fire({
|
||||
title: 'Berhasil!',
|
||||
text: result.message,
|
||||
icon: 'success',
|
||||
confirmButtonText: 'OK'
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
window.location.href =
|
||||
'{{ route('surveyor.show', ['id' => $permohonan->id]) }}';
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
} else {
|
||||
Swal.fire({
|
||||
title: 'Error!',
|
||||
text: result.message || 'Terjadi kesalahan',
|
||||
icon: 'error',
|
||||
confirmButtonText: 'OK'
|
||||
});
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
hideLoadingSwal();
|
||||
console.error('Error:', error);
|
||||
Swal.fire({
|
||||
title: 'Error!',
|
||||
text: 'Terjadi kesalahan pada server',
|
||||
icon: 'error',
|
||||
confirmButtonText: 'OK'
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.loader {
|
||||
border: 4px solid #f3f3f3;
|
||||
border-radius: 50%;
|
||||
border-top: 4px solid #3498db;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
animation: spin 1s linear infinite;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
0% {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
|
||||
100% {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
.scrollable-x-auto {
|
||||
overflow-x: auto;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.table {
|
||||
min-width: 100%;
|
||||
}
|
||||
</style>
|
||||
@endpush
|
||||
|
||||
@@ -268,9 +268,7 @@
|
||||
|
||||
|
||||
function submitDenah() {
|
||||
const loadingOverlay = document.getElementById('loadingOverlay');
|
||||
loadingOverlay.classList.remove('hidden');
|
||||
loadingOverlay.classList.add('flex');
|
||||
showLoadingSwal('Mengirim data ke server...');
|
||||
|
||||
const formElement = $('#formDenah')[0];
|
||||
const formData = new FormData(formElement);
|
||||
@@ -286,6 +284,7 @@
|
||||
},
|
||||
success: function(response) {
|
||||
if (response.success) {
|
||||
hideLoadingSwal();
|
||||
Swal.fire({
|
||||
title: 'Berhasil!',
|
||||
text: response.message,
|
||||
@@ -319,36 +318,14 @@
|
||||
console.log('Status:', status);
|
||||
console.log('Response:', xhr.responseText);
|
||||
console.log(errors);
|
||||
hideLoadingSwal();
|
||||
toastrErrorBuild(error);
|
||||
|
||||
},
|
||||
complete: function() {
|
||||
loadingOverlay.classList.add('hidden');
|
||||
loadingOverlay.classList.remove('flex');
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
@include('lpj::surveyor.js.utils')
|
||||
@endpush
|
||||
<style>
|
||||
.loader {
|
||||
border: 4px solid #f3f3f3;
|
||||
border-radius: 50%;
|
||||
border-top: 4px solid #3498db;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
animation: spin 1s linear infinite;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
0% {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
|
||||
100% {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
@foreach ($permohonan->debiture->documents as $dokumen)
|
||||
<span class="text-2sm text-gray-700">
|
||||
{{formatAlamat($dokumen->pemilik)}}
|
||||
{{ formatAlamat($dokumen->pemilik) }}
|
||||
</span>
|
||||
@endforeach
|
||||
</div>
|
||||
@@ -118,8 +118,7 @@
|
||||
</div>
|
||||
|
||||
<!-- Delete button to remove photo -->
|
||||
<button type="button" class="btn btn-danger btn-sm delete-btn"
|
||||
id="btnDelete">
|
||||
<button type="button" class="btn btn-danger btn-sm delete-btn" id="btnDelete">
|
||||
<i class="ki-filled ki-trash"></i>
|
||||
</button>
|
||||
</div>
|
||||
@@ -190,9 +189,8 @@
|
||||
</label>
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
<img id="foto_rute_lainnya-preview-{{ $index }}"
|
||||
src="{{ asset('storage/' . $photo['foto_rute_lainnya']) }}"
|
||||
alt="Foto Rute " class="mt-2 max-w-full h-auto"
|
||||
style="width: 30rem;">
|
||||
src="{{ asset('storage/' . $photo['foto_rute_lainnya']) }}" alt="Foto Rute "
|
||||
class="mt-2 max-w-full h-auto" style="width: 30rem;">
|
||||
<div class="flex flex-col lg:flex-row gap-2 w-full">
|
||||
|
||||
<div class="flex flex-wrap items-baseline px-2">
|
||||
@@ -260,7 +258,6 @@
|
||||
['label' => 'Tampak Samping Kiri', 'index' => 1],
|
||||
['label' => 'Tampak Samping Kanan', 'index' => 2],
|
||||
['label' => 'Nomor Rumah/Unit', 'index' => 3],
|
||||
|
||||
];
|
||||
} elseif ($kategori === 'apartemen-kantor') {
|
||||
$objekViews = [
|
||||
@@ -332,35 +329,34 @@
|
||||
|
||||
@if (count($objekViews) > 0)
|
||||
@foreach ($objekViews as $view)
|
||||
<div class="flex flex-wrap gap-4 {{ !$loop->first ? 'mt-2' : '' }}">
|
||||
<div class="flex w-full gap-4">
|
||||
<label class="form-label max-w-56"><span
|
||||
class="form-label">{{ $view['label'] }}</span></label>
|
||||
<input type="hidden" class="form-control"
|
||||
name="name_objek[]" value="{{ $view['label'] }}" />
|
||||
<div class="w-full grid gap-5">
|
||||
<img id="foto_object_jaminan_preview_{{ $view['index'] }}"
|
||||
src="{{ isset($formFoto['object_jaminan'][$view['index']]['foto_objek']) ? asset('storage/' . $formFoto['object_jaminan'][$view['index']]['foto_objek']) : '' }}"
|
||||
alt="{{ $view['label'] }}" class="mb-2 h-auto"
|
||||
|
||||
style="{{ isset($formFoto['object_jaminan'][$view['index']]['foto_objek']) ? 'width: 30rem;' : 'display: none;' }}"
|
||||
onerror="this.style.display='none';" />
|
||||
<div class="input-group w-full flex gap-2">
|
||||
<input type="file" name="foto_objek[]"
|
||||
class="file-input file-input-bordered w-full"
|
||||
accept="image/*" capture="camera"
|
||||
onchange="previewImage(this, 'foto_object_jaminan_preview_{{ $view['index'] }}')">
|
||||
<button type="button" id="btnCamera"
|
||||
class="btn btn-light"
|
||||
data-modal-toggle="#cameraModal">
|
||||
<i class="ki-outline ki-abstract-33"></i> Camera
|
||||
</button>
|
||||
<div class="flex flex-wrap gap-4 {{ !$loop->first ? 'mt-2' : '' }}">
|
||||
<div class="flex w-full gap-4">
|
||||
<label class="form-label max-w-56"><span
|
||||
class="form-label">{{ $view['label'] }}</span></label>
|
||||
<input type="hidden" class="form-control"
|
||||
name="name_objek[]" value="{{ $view['label'] }}" />
|
||||
<div class="w-full grid gap-5">
|
||||
<img id="foto_object_jaminan_preview_{{ $view['index'] }}"
|
||||
src="{{ isset($formFoto['object_jaminan'][$view['index']]['foto_objek']) ? asset('storage/' . $formFoto['object_jaminan'][$view['index']]['foto_objek']) : '' }}"
|
||||
alt="{{ $view['label'] }}" class="mb-2 h-auto"
|
||||
style="{{ isset($formFoto['object_jaminan'][$view['index']]['foto_objek']) ? 'width: 30rem;' : 'display: none;' }}"
|
||||
onerror="this.style.display='none';" />
|
||||
<div class="input-group w-full flex gap-2">
|
||||
<input type="file" name="foto_objek[]"
|
||||
class="file-input file-input-bordered w-full"
|
||||
accept="image/*" capture="camera"
|
||||
onchange="previewImage(this, 'foto_object_jaminan_preview_{{ $view['index'] }}')">
|
||||
<button type="button" id="btnCamera"
|
||||
class="btn btn-light"
|
||||
data-modal-toggle="#cameraModal">
|
||||
<i class="ki-outline ki-abstract-33"></i> Camera
|
||||
</button>
|
||||
</div>
|
||||
<textarea name="deskripsi_objek[]" class="textarea" rows="3" placeholder="Deskripsi">{{ isset($formFoto['object_jaminan'][$view['index']]) ? str_replace($view['label'] . ': ', '', $formFoto['object_jaminan'][$view['index']]['deskripsi_objek']) : '' }}</textarea>
|
||||
</div>
|
||||
<textarea name="deskripsi_objek[]" class="textarea" rows="3" placeholder="Deskripsi">{{ isset($formFoto['object_jaminan'][$view['index']]) ? str_replace($view['label'] . ': ', '', $formFoto['object_jaminan'][$view['index']]['deskripsi_objek']) : '' }}</textarea>
|
||||
</div>
|
||||
<span class="alert text-danger text-sm"></span>
|
||||
</div>
|
||||
<span class="alert text-danger text-sm"></span>
|
||||
</div>
|
||||
@endforeach
|
||||
@endif
|
||||
|
||||
@@ -596,24 +592,17 @@
|
||||
|
||||
</form>
|
||||
</div>
|
||||
<div id="loadingOverlay" class="fixed inset-0 bg-black bg-opacity-50 hidden items-center justify-center z-50">
|
||||
<div class="bg-white p-4 rounded-lg">
|
||||
<div class="loader"></div>
|
||||
<p class="mt-2 text-center">Sedang memproses...</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Modal Kamera -->
|
||||
@include('lpj::surveyor.components.modal-kamera')
|
||||
@endsection
|
||||
@endsection
|
||||
|
||||
@include('lpj::surveyor.js.fotojs')
|
||||
@include('lpj::surveyor.js.fotojs')
|
||||
@include('lpj::surveyor.js.utils')
|
||||
@push('scripts')
|
||||
<script>
|
||||
function submitFoto() {
|
||||
const loadingOverlay = document.getElementById('loadingOverlay');
|
||||
loadingOverlay.classList.remove('hidden');
|
||||
loadingOverlay.classList.add('flex');
|
||||
showLoadingSwal('Mengirim data ke server...');
|
||||
|
||||
const formElement = $('#formFoto')[0];
|
||||
const formData = new FormData(formElement);
|
||||
@@ -630,6 +619,7 @@
|
||||
},
|
||||
success: function(response) {
|
||||
if (response.success) {
|
||||
hideLoadingSwal();
|
||||
Swal.fire({
|
||||
title: 'Berhasil!',
|
||||
text: response.message,
|
||||
@@ -644,6 +634,7 @@
|
||||
|
||||
});
|
||||
} else {
|
||||
hideLoadingSwal();
|
||||
Swal.fire({
|
||||
title: 'Error!',
|
||||
text: response.message || 'Terjadi kesalahan',
|
||||
@@ -652,8 +643,6 @@
|
||||
});
|
||||
}
|
||||
console.log(response);
|
||||
|
||||
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
let errors = xhr.responseJSON?.errors;
|
||||
@@ -663,41 +652,11 @@
|
||||
$(`#error-${key}`).text(value[0]);
|
||||
});
|
||||
}
|
||||
console.error('Terjadi error:', error); // Menampilkan pesan error di konsol
|
||||
console.log('Status:', status);
|
||||
console.log('Response:', xhr.responseText);
|
||||
console.log(errors);
|
||||
hideLoadingSwal();
|
||||
toastrErrorBuild(error);
|
||||
},
|
||||
complete: function() {
|
||||
// Re-enable the button and hide the spinner
|
||||
loadingOverlay.classList.add('hidden');
|
||||
loadingOverlay.classList.remove('flex');
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
@include('lpj::surveyor.js.camera-editor')
|
||||
@endpush
|
||||
|
||||
<style>
|
||||
.loader {
|
||||
border: 4px solid #f3f3f3;
|
||||
border-radius: 50%;
|
||||
border-top: 4px solid #3498db;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
animation: spin 1s linear infinite;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
0% {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
|
||||
100% {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -57,8 +57,8 @@
|
||||
@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"/>
|
||||
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
|
||||
@@ -67,9 +67,9 @@
|
||||
<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"/>
|
||||
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
|
||||
style="display: none">Hapus
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -125,13 +125,13 @@
|
||||
<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"
|
||||
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"
|
||||
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>
|
||||
@@ -143,9 +143,9 @@
|
||||
$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;' }}">
|
||||
style="{{ isset($selectedValue) === 'tidak sesuai' ? '' : 'display: none;' }}">
|
||||
<select id="jenis_asset_tidak_sesuai" class="input w-full"
|
||||
name="jenis_asset_tidak_sesuai">
|
||||
name="jenis_asset_tidak_sesuai">
|
||||
<option value="">Select Jenis asset</option>
|
||||
@if (isset($basicData['jenisJaminan']))
|
||||
@foreach ($basicData['jenisJaminan'] as $item)
|
||||
@@ -179,13 +179,13 @@
|
||||
<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="updateAlamatFields('sesuai')" type="radio" class="radio"
|
||||
name="alamat_sesuai" value="sesuai"
|
||||
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="updateAlamatFields('tidak sesuai')" type="radio" class="radio"
|
||||
name="alamat_sesuai" value="tidak sesuai"
|
||||
name="alamat_sesuai" value="tidak sesuai"
|
||||
{{ old('jenis_asset', isset($forminspeksi['asset']['alamat']['tidak sesuai'])) ? 'checked' : '' }}>
|
||||
<span class="ml-2">Tidak</span>
|
||||
</label>
|
||||
@@ -200,13 +200,13 @@
|
||||
@endphp
|
||||
|
||||
<div id="alamat_form" class="grid gap-2 mt-5"
|
||||
style="{{ isset($address) ? '' : 'display: none;' }}">
|
||||
style="{{ isset($address) ? '' : 'display: none;' }}">
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5 w-full">
|
||||
<label for="address" class="form-label max-w-56">Jl.</label>
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
<input type="text" id="address" name="address" class="input w-full"
|
||||
placeholder="Masukkan Jl."
|
||||
value="{{ isset($forminspeksi['asset']['alamat']['tidak sesuai']['address'])
|
||||
placeholder="Masukkan Jl."
|
||||
value="{{ isset($forminspeksi['asset']['alamat']['tidak sesuai']['address'])
|
||||
? $forminspeksi['asset']['alamat']['tidak sesuai']['address']
|
||||
: (isset($forminspeksi['asset']['alamat']['sesuai']['address'])
|
||||
? $forminspeksi['asset']['alamat']['sesuai']['address']
|
||||
@@ -222,12 +222,11 @@
|
||||
<option value="">Select Province</option>
|
||||
@foreach ($provinces as $province)
|
||||
<option value="{{ $province->code }}"
|
||||
@if (
|
||||
(isset($cekAlamat['province_code']) && $cekAlamat['province_code'] == $province->code) ||
|
||||
(!isset($cekAlamat['province_code']) && isset($debitur->province_code) && $debitur->province_code == $province->code)
|
||||
)
|
||||
selected
|
||||
@endif>
|
||||
@if (
|
||||
(isset($cekAlamat['province_code']) && $cekAlamat['province_code'] == $province->code) ||
|
||||
(!isset($cekAlamat['province_code']) &&
|
||||
isset($debitur->province_code) &&
|
||||
$debitur->province_code == $province->code)) selected @endif>
|
||||
{{ $province->name }}
|
||||
</option>
|
||||
@endforeach
|
||||
@@ -243,15 +242,11 @@
|
||||
@if (isset($cities))
|
||||
@foreach ($cities as $city)
|
||||
<option value="{{ $city->code }}"
|
||||
@if (
|
||||
(isset($cekAlamat['city_code']) && $cekAlamat['city_code'] == $city->code) ||
|
||||
(!isset($cekAlamat['city_code']) && isset($debitur->city_code) && $debitur->city_code == $city->code)
|
||||
)
|
||||
selected
|
||||
@endif>
|
||||
@if (
|
||||
(isset($cekAlamat['city_code']) && $cekAlamat['city_code'] == $city->code) ||
|
||||
(!isset($cekAlamat['city_code']) && isset($debitur->city_code) && $debitur->city_code == $city->code)) selected @endif>
|
||||
{{ $city->name }}
|
||||
</option>
|
||||
|
||||
@endforeach
|
||||
@endif
|
||||
</select>
|
||||
@@ -268,15 +263,13 @@
|
||||
@if (isset($districts))
|
||||
@foreach ($districts as $district)
|
||||
<option value="{{ $district->code }}"
|
||||
@if (
|
||||
(isset($cekAlamat['district_code']) && $cekAlamat['district_code'] == $district->code) ||
|
||||
(!isset($cekAlamat['district_code']) && isset($debitur->district_code) && $debitur->district_code == $district->code)
|
||||
)
|
||||
selected
|
||||
@endif>
|
||||
@if (
|
||||
(isset($cekAlamat['district_code']) && $cekAlamat['district_code'] == $district->code) ||
|
||||
(!isset($cekAlamat['district_code']) &&
|
||||
isset($debitur->district_code) &&
|
||||
$debitur->district_code == $district->code)) selected @endif>
|
||||
{{ $district->name }}
|
||||
</option>
|
||||
|
||||
@endforeach
|
||||
|
||||
@endif
|
||||
@@ -292,15 +285,13 @@
|
||||
@if (isset($villages))
|
||||
@foreach ($villages as $village)
|
||||
<option value="{{ $village->code }}"
|
||||
@if (
|
||||
(isset($cekAlamat['village_code']) && $cekAlamat['village_code'] == $village->code) ||
|
||||
(!isset($cekAlamat['village_code']) && isset($debitur->village_code) && $debitur->village_code == $village->code)
|
||||
)
|
||||
selected
|
||||
@endif>
|
||||
@if (
|
||||
(isset($cekAlamat['village_code']) && $cekAlamat['village_code'] == $village->code) ||
|
||||
(!isset($cekAlamat['village_code']) &&
|
||||
isset($debitur->village_code) &&
|
||||
$debitur->village_code == $village->code)) selected @endif>
|
||||
{{ $village->name }}
|
||||
</option>
|
||||
|
||||
@endforeach
|
||||
|
||||
@endif
|
||||
@@ -327,14 +318,14 @@
|
||||
<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'] : '') }}">
|
||||
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'] : '') }}">
|
||||
name="kordinat_lng" id="lng"
|
||||
value="{{ old('kordinat_lng', isset($forminspeksi['asset']['kordinat_lng']) ? $forminspeksi['asset']['kordinat_lng'] : '') }}">
|
||||
</div>
|
||||
<a target="_blank" href="https://www.google.com/maps" type="button"
|
||||
class="btn btn-md btn-outline btn-primary">
|
||||
class="btn btn-md btn-outline btn-primary">
|
||||
<i class="ki-filled ki-map"></i>Ambil
|
||||
Kordinat</a>
|
||||
</div>
|
||||
@@ -350,9 +341,9 @@
|
||||
<div data-accordion="true">
|
||||
@foreach ($permohonan->debiture->documents as $dokumen)
|
||||
<div class="accordion-item [&:not(:last-child)]:border-b border-b-gray-200" data-accordion-item="true"
|
||||
id="accordion_detail_jaminan">
|
||||
id="accordion_detail_jaminan">
|
||||
<button class="accordion-toggle py-4 group "
|
||||
data-accordion-toggle="#accordion_detail_jaminan_{{ $loop->index }}">
|
||||
data-accordion-toggle="#accordion_detail_jaminan_{{ $loop->index }}">
|
||||
<span class="text-base text-gray-900 font-medium">
|
||||
Dokument Kepemilikan
|
||||
</span>
|
||||
@@ -365,7 +356,7 @@
|
||||
<div class="accordion-content hidden" id="accordion_detail_jaminan_{{ $loop->index }}">
|
||||
<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">
|
||||
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">
|
||||
@@ -403,7 +394,7 @@
|
||||
{{ $dokumen_nomor[$index] }}</span>
|
||||
@endif
|
||||
<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">
|
||||
class="flex-none badge badge-sm badge-outline mt-2 mr-2">
|
||||
{{ basename($dokumen) }}
|
||||
<i class="ki-filled ki-cloud-download"></i>
|
||||
</a>
|
||||
@@ -448,7 +439,7 @@
|
||||
@foreach ($permohonan->debiture->documents as $dokumen)
|
||||
{{ $dokumen->pemilik->hubungan_pemilik->name ?? '' }}
|
||||
<input type="hidden" name="hub_cadeb_sesuai"
|
||||
value="{{ $dokumen->pemilik->hubungan_pemilik->name }}" id="">
|
||||
value="{{ $dokumen->pemilik->hubungan_pemilik->name }}" id="">
|
||||
@endforeach
|
||||
</div>
|
||||
|
||||
@@ -477,7 +468,7 @@
|
||||
@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;' }}">
|
||||
style="{{ old('hub_cadeb_tidak_sesuai', $selectedData) ? '' : 'display: none;' }}">
|
||||
<option value="">Select Hubungan Cadeb</option>
|
||||
@if (isset($basicData['hubCadeb']))
|
||||
@foreach ($basicData['hubCadeb'] as $item)
|
||||
@@ -508,8 +499,8 @@
|
||||
@foreach ($permohonan->debiture->documents as $dokumen)
|
||||
{{ $dokumen->penghuni->hubungan_penghuni->name ?? 'N/A' }}
|
||||
<input type="hidden" name="hub_cadeb_penghuni_sesuai"
|
||||
value="{{ isset($dokumen->penghuni->hubungan_penghuni->name) ?? '' }}"
|
||||
id="">
|
||||
value="{{ isset($dokumen->penghuni->hubungan_penghuni->name) ?? '' }}"
|
||||
id="">
|
||||
@endforeach
|
||||
</div>
|
||||
|
||||
@@ -520,7 +511,6 @@
|
||||
<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">Ya</span>
|
||||
@@ -539,20 +529,19 @@
|
||||
: 'tidak sesuai';
|
||||
$selectedData = $forminspeksi['asset']['hub_cadeb_penghuni'][$statusKey] ?? null;
|
||||
@endphp
|
||||
<select id="hub_penghuni_tidak_sesuai"
|
||||
class="input w-full
|
||||
name=" hub_penghuni_tidak_sesuai"
|
||||
style="{{ old('hub_penghuni_tidak_sesuai', $selectedData) ? '' : 'display: none;' }}">
|
||||
<option value="">Select Hubungan Cadeb</option>
|
||||
@if (isset($basicData['hubPenghuni']))
|
||||
@foreach ($basicData['hubPenghuni'] as $item)
|
||||
<option value="{{ $item->name }}"
|
||||
{{ old('hub_penghuni_tidak_sesuai', $selectedData) == $item->name ? 'selected' : '' }}>
|
||||
{{ $item->name }}
|
||||
</option>
|
||||
<select id="hub_penghuni_tidak_sesuai" name="hub_penghuni_tidak_sesuai"
|
||||
class="input w-full"
|
||||
style="{{ old('hub_penghuni_tidak_sesuai', $selectedData) ? '' : 'display: none;' }}">
|
||||
<option value="">Select Hubungan Cadeb</option>
|
||||
@if (isset($basicData['hubPenghuni']))
|
||||
@foreach ($basicData['hubPenghuni'] as $item)
|
||||
<option value="{{ $item->name }}"
|
||||
{{ old('hub_penghuni_tidak_sesuai', $selectedData) == $item->name ? 'selected' : '' }}>
|
||||
{{ $item->name }}
|
||||
</option>
|
||||
@endforeach
|
||||
@endif
|
||||
</select>
|
||||
@endif
|
||||
</select>
|
||||
</div>
|
||||
<em id="error-hub_cadeb" class="alert text-danger text-sm"></em>
|
||||
</div>
|
||||
|
||||
@@ -43,14 +43,6 @@
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<!-- Loading Overlay -->
|
||||
<div id="loadingOverlay" class="fixed inset-0 bg-black bg-opacity-50 hidden items-center justify-center z-50">
|
||||
<div class="bg-white p-4 rounded-lg">
|
||||
<div class="loader"></div>
|
||||
<p class="mt-2 text-center">Sedang memproses...</p>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
@@ -178,15 +170,11 @@
|
||||
|
||||
|
||||
function submitData() {
|
||||
const loadingOverlay = document.getElementById('loadingOverlay');
|
||||
loadingOverlay.classList.remove('hidden');
|
||||
loadingOverlay.classList.add('flex');
|
||||
|
||||
showLoadingSwal('Mengirim data ke server...');
|
||||
const form = document.querySelector('form');
|
||||
const formData = new FormData(form);
|
||||
console.log('Form data entries:', Array.from(formData.entries()));
|
||||
|
||||
|
||||
$.ajax({
|
||||
url: '{{ route('surveyor.store') }}',
|
||||
type: 'POST',
|
||||
@@ -197,6 +185,7 @@
|
||||
'X-CSRF-TOKEN': '{{ csrf_token() }}'
|
||||
},
|
||||
success: function(response) {
|
||||
hideLoadingSwal();
|
||||
if (response.success) {
|
||||
Swal.fire({
|
||||
title: 'Berhasil!',
|
||||
@@ -205,8 +194,8 @@
|
||||
confirmButtonText: 'OK'
|
||||
}).then((response) => {
|
||||
if (response.isConfirmed) {
|
||||
window.location.href =
|
||||
'{{ route('surveyor.show', ['id' => $permohonan->id]) }}';
|
||||
// window.location.href =
|
||||
// '{{ route('surveyor.show', ['id' => $permohonan->id]) }}';
|
||||
}
|
||||
});
|
||||
} else {
|
||||
@@ -220,6 +209,7 @@
|
||||
console.log(response);
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
|
||||
let errors = xhr.responseJSON?.errors;
|
||||
$('.alert').text('');
|
||||
if (errors) {
|
||||
@@ -227,16 +217,12 @@
|
||||
$(`#error-${key}`).text(value[0]);
|
||||
});
|
||||
}
|
||||
hideLoadingSwal();
|
||||
console.error('Terjadi error:', error); // Menampilkan pesan error di konsol
|
||||
console.log('Status:', status);
|
||||
console.log('Response:', xhr.responseText);
|
||||
console.log(errors);
|
||||
toastrErrorBuild(error);
|
||||
},
|
||||
complete: function() {
|
||||
// Re-enable the button and hide the spinner
|
||||
loadingOverlay.classList.add('hidden');
|
||||
loadingOverlay.classList.remove('flex');
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -349,45 +335,5 @@
|
||||
});
|
||||
}
|
||||
</script>
|
||||
@include('lpj::surveyor.js.utils')
|
||||
@endpush
|
||||
|
||||
<style>
|
||||
.loader {
|
||||
border: 4px solid #f3f3f3;
|
||||
border-radius: 50%;
|
||||
border-top: 4px solid #3498db;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
animation: spin 1s linear infinite;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
0% {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
|
||||
100% {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
div[disabled] {
|
||||
background-color: #f5f5f5;
|
||||
color: #a0a0a0;
|
||||
border: 1px solid #d1d1d1;
|
||||
cursor: not-allowed;
|
||||
|
||||
pointer-events: none;
|
||||
|
||||
}
|
||||
|
||||
div[disabled]:hover {
|
||||
background-color: #e8e8e8;
|
||||
}
|
||||
|
||||
div.disabled-input {
|
||||
opacity: 0.6;
|
||||
transition: opacity 0.3s ease;
|
||||
}
|
||||
</style>
|
||||
|
||||
55
resources/views/surveyor/js/utils.blade.php
Normal file
55
resources/views/surveyor/js/utils.blade.php
Normal file
@@ -0,0 +1,55 @@
|
||||
<script>
|
||||
function showLoadingSwal(message) {
|
||||
Swal.fire({
|
||||
title: message,
|
||||
allowOutsideClick: false,
|
||||
didOpen: () => {
|
||||
Swal.showLoading();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function hideLoadingSwal() {
|
||||
Swal.close();
|
||||
}
|
||||
|
||||
function previewImage(input, imageId) {
|
||||
const preview = document.getElementById(imageId);
|
||||
if (input.files && input.files[0]) {
|
||||
const reader = new FileReader();
|
||||
reader.onload = function(e) {
|
||||
preview.src = e.target.result;
|
||||
preview.classList.remove('hidden');
|
||||
}
|
||||
reader.readAsDataURL(input.files[0]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function formatNumber(input) {
|
||||
let value = input.value.replace(/[^\d.]/g, '');
|
||||
input.value = value;
|
||||
}
|
||||
|
||||
|
||||
function formatCurrency(value) {
|
||||
if (!value) return '';
|
||||
|
||||
// Jika input adalah elemen, ambil nilainya
|
||||
const numericValue = typeof value === 'string' ? value : value.value;
|
||||
|
||||
// Hapus semua karakter non-digit
|
||||
const cleanValue = numericValue.toString().replace(/[^\d]/g, '');
|
||||
|
||||
// Format ke currency
|
||||
const formattedValue = new Intl.NumberFormat('id-ID').format(cleanValue);
|
||||
|
||||
// Jika input adalah elemen, update nilainya
|
||||
if (typeof value !== 'string') {
|
||||
value.value = formattedValue;
|
||||
}
|
||||
|
||||
return formattedValue;
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user