268 lines
14 KiB
PHP
268 lines
14 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 min-w-full">
|
|
<div class="card min-w-full">
|
|
<div class="card-header">
|
|
<h3 class="card-title">
|
|
Denah
|
|
</h3>
|
|
<div class="flex items-center gap-2">
|
|
<a href="{{ route('surveyor.show', ['id' => request('denah')]) }}?form=denah"
|
|
class="btn btn-xs btn-info">
|
|
<i class="ki-filled ki-exit-left"></i> Back
|
|
</a>
|
|
</div>
|
|
</div>
|
|
<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_1_item_1">
|
|
<button class="accordion-toggle py-4 group mx-8"
|
|
data-accordion-toggle="#accoordion_detail_jaminan_{{ $loop->index }}">
|
|
<span class="text-base text-gray-900 font-medium">
|
|
Jaminan {{ $loop->index + 1 }}
|
|
</span>
|
|
<i class="ki-outline ki-plus text-gray-600 text-2sm accordion-active:hidden block">
|
|
</i>
|
|
<i class="ki-outline ki-minus text-gray-600 text-2sm accordion-active:block hidden">
|
|
</i>
|
|
</button>
|
|
<div class="accordion-content hidden" id="accoordion_detail_jaminan_{{ $loop->index }}">
|
|
<div class="card-body lg:py-7.5 grid grid-cols-2">
|
|
<div class="mb-5">
|
|
<h3 class="text-md font-medium text-gray-900">
|
|
Pemilik Jaminan:
|
|
</h3>
|
|
<span class="text-2sm text-gray-700">
|
|
{{ $dokumen->pemilik->name ?? '' }}
|
|
</span>
|
|
</div>
|
|
<div class="mb-5">
|
|
<h3 class="text-md font-medium text-gray-900">
|
|
Jenis Jaminan:
|
|
</h3>
|
|
<span class="text-2sm text-gray-700">
|
|
{{ $dokumen->jenisJaminan->name ?? '' }}
|
|
</span>
|
|
</div>
|
|
<div class="mb-5">
|
|
<h3 class="text-md font-medium text-gray-900">
|
|
Hubungan Pemilik Jaminan:
|
|
</h3>
|
|
<span class="text-2sm text-gray-700">
|
|
{{ $dokumen->pemilik->hubungan_pemilik->name ?? '' }}
|
|
</span>
|
|
</div>
|
|
<div class="mb-5">
|
|
<h3 class="text-md font-medium text-gray-900">
|
|
Alamat Pemilik Jaminan:
|
|
</h3>
|
|
<span class="text-2sm text-gray-700">
|
|
{{ $dokumen->pemilik->address ?? '' }},
|
|
<br> {{ $dokumen->pemilik->village->name ?? '' }},
|
|
{{ $dokumen->pemilik->district->name ?? '' }},
|
|
{{ $dokumen->pemilik->city->name ?? '' }},
|
|
{{ $dokumen->pemilik->province->name ?? '' }} -
|
|
{{ $dokumen->pemilik->village->postal_code ?? '' }}
|
|
</span>
|
|
</div>
|
|
</div>
|
|
<div class="card-table scrollable-x-auto pb-3">
|
|
<table class="table align-middle text-sm text-gray-500">
|
|
@foreach ($dokumen->detail as $detail)
|
|
<tr>
|
|
<td class="py-2 text-gray-600 font-normal max-w-[100px]">
|
|
{{ $loop->index + 1 }}. {{ $detail->jenisLegalitasJaminan->name }}
|
|
</td>
|
|
<td class="py-2 text-gray-800 font-normaltext-sm">
|
|
{{ $detail->name ?? '' }}
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="py-3 max-w-[100px]">
|
|
Dokumen Jaminan
|
|
</td>
|
|
<td class="py-3 text-gray-700 text-2sm font-normal">
|
|
@if (isset($detail->dokumen_jaminan))
|
|
<a href="{{ route('debitur.jaminan.download', ['id' => $permohonan->debiture->id, 'dokumen' => $detail->id]) }}"
|
|
class="badge badge-sm badge-outline mt-2">{{ basename($detail->dokumen_jaminan) }}
|
|
<i class="ki-filled ki-cloud-download"></i></a>
|
|
@endif
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="py-3 max-w-[100px]">
|
|
Keterangan
|
|
</td>
|
|
<td class="py-3 text-gray-700 text-2sm font-normal">
|
|
{{ $detail->keterangan ?? '' }}
|
|
</td>
|
|
</tr>
|
|
@endforeach
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@endforeach
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
<div class="card">
|
|
<div class="card-body">
|
|
|
|
<form id="formDenah" method="POST" class="grid gap-5" enctype="multipart/form-data">
|
|
@if (isset($debitur->id))
|
|
<input type="hidden" name="id" value="{{ $debitur->id }}">
|
|
@method('PUT')
|
|
@endif
|
|
@csrf
|
|
|
|
<input type="hidden" value="{{ $permohonan->id }}" name="permohonan_id">
|
|
<input type="hidden" name="jenis_jaminan_id" value="{{ request('jenis_jaminan') }}">
|
|
<div class="mt-2">
|
|
<div class=""max-w-4xl mx-auto bg-white rounded-lg shadow-md overflow-hidden">
|
|
|
|
<div>
|
|
</div>
|
|
<div class="flex flex-wrap gap-4" style="margin-top: 20px">
|
|
<div class="flex w-full items-center justify-center gap-4">
|
|
<label class="form-label max-w-56">
|
|
<span class="form-label">Upload Denah</span>
|
|
</label>
|
|
<div class="w-full grid gap-5">
|
|
<img id="foto_denah-preview"
|
|
src="{{ isset($formDenah['foto_denah']) ? asset('storage/' . old('foto_denah', $formDenah['foto_denah'])) : '' }}"
|
|
alt="Gambar foto_denah" style="{{ isset($formDenah['foto_denah']) ? 'width: 30rem;' : 'display: none;' }}">
|
|
|
|
|
|
|
|
<div class="input-group w-full flex gap-2">
|
|
<input type="file"
|
|
value="{{ old('foto_denah', isset($formDenah['foto_denah']) ? $formDenah['foto_denah'] : '') }}"
|
|
name="foto_denah" class="file-input file-input-bordered w-full "
|
|
accept="image/*"
|
|
onchange="previewImage(this, 'foto_denah-preview')"
|
|
>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<em id="error-foto_denah" class="alert text-danger text-sm"></em>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="mt-2">
|
|
<div class=""max-w-4xl mx-auto bg-white rounded-lg shadow-md overflow-hidden">
|
|
|
|
<div class="flex flex-wrap gap-4">
|
|
<div class="flex w-full items-center justify-center gap-4">
|
|
|
|
<label class="form-label max-w-56">
|
|
<span class="form-label">Masukkan total luas tanah</span>
|
|
</label>
|
|
<input type="text" name="luas" class="input w-full "
|
|
value="{{ old('luas', isset($formDenah['luas']) ? $formDenah['luas'] : '') }}">
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<em id="error-luas" class="alert text-danger text-sm"></em>
|
|
|
|
</div>
|
|
</div>
|
|
<div class="flex justify-end gap-2" style="margin-right: 20px; margin-top: 20px">
|
|
<button type="button" class="btn btn-success" id="saveButton" onclick="submitDenah()">
|
|
<span id="saveButtonText">Save</span>
|
|
<div class="spinner-border spinner-border-sm text-light" role="status" style="display: none;"
|
|
id="saveButtonSpinner">
|
|
<span class="visually-hidden">Loading...</span>
|
|
</div>
|
|
</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@endsection
|
|
|
|
|
|
@push('scripts')
|
|
<script>
|
|
function previewImage(input, previewId) {
|
|
if (input.files && input.files[0]) {
|
|
var reader = new FileReader();
|
|
reader.onload = function(e) {
|
|
$('#' + previewId).attr('src', e.target.result).show();
|
|
}
|
|
reader.readAsDataURL(input.files[0]);
|
|
} else {
|
|
$('#' + previewId).hide();
|
|
}
|
|
}
|
|
|
|
function submitDenah() {
|
|
|
|
const formElement = $('#formDenah')[0];
|
|
const formData = new FormData(formElement);
|
|
|
|
// Disable the button and show the spinner
|
|
$('#saveButton').prop('disabled', true);
|
|
$('#saveButtonText').hide();
|
|
$('#saveButtonSpinner').show();
|
|
|
|
$.ajax({
|
|
url: '{{ route('surveyor.storeDenah') }}',
|
|
type: 'POST',
|
|
data: formData,
|
|
processData: false,
|
|
contentType: false,
|
|
headers: {
|
|
'X-CSRF-TOKEN': '{{ csrf_token() }}'
|
|
},
|
|
success: function(response) {
|
|
if (response.success) {
|
|
window.location.href =
|
|
'{{ route('surveyor.show', ['id' => $permohonan->id]) }}?form=denah';
|
|
toastrSuccessBuild(response.message);
|
|
}
|
|
console.log(response);
|
|
},
|
|
error: function(xhr, status, error) {
|
|
let errors = xhr.responseJSON?.errors;
|
|
$('.alert').text('');
|
|
if (errors) {
|
|
$.each(errors, function(key, value) {
|
|
$(`#error-${key}`).text(value[0]);
|
|
});
|
|
}
|
|
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
|
|
$('#saveButton').prop('disabled', false);
|
|
$('#saveButtonText').show();
|
|
$('#saveButtonSpinner').hide();
|
|
}
|
|
});
|
|
|
|
}
|
|
</script>
|
|
@endpush
|