update data pembading surveyor
This commit is contained in:
@@ -51,13 +51,12 @@
|
||||
@php
|
||||
|
||||
$sortedTeamsActivity = $teamsActivity->sortBy(function ($item) {
|
||||
return $item->team->penilaianTeam
|
||||
->filter(function ($penilaianTeam) use ($item) {
|
||||
return $penilaianTeam->user_id == $item->user->id;
|
||||
return $item->team->regions->penilaiTeam
|
||||
->filter(function ($penilaiTeam) use ($item) {
|
||||
return $penilaiTeam->user_id == $item->user->id;
|
||||
})
|
||||
->count();
|
||||
});
|
||||
|
||||
@endphp
|
||||
|
||||
@foreach ($sortedTeamsActivity as $index => $item)
|
||||
@@ -75,9 +74,9 @@
|
||||
<th class="min-w-[150px]">
|
||||
<span class="text-base text-gray-900 font-normal">
|
||||
@php
|
||||
$totalTasks = $item->team->penilaianTeam
|
||||
->filter(function ($penilaianTeam) use ($item) {
|
||||
return $penilaianTeam->user_id == $item->user->id;
|
||||
$totalTasks = $item->team->regions->penilaiTeam
|
||||
->filter(function ($penilaiTeam) use ($item) {
|
||||
return $penilaiTeam->user_id == $item->user->id;
|
||||
})
|
||||
->count();
|
||||
@endphp
|
||||
@@ -208,7 +207,7 @@
|
||||
tanggal_kunjungan: {
|
||||
title: 'Tgl Kunjungan',
|
||||
render: (item, data) =>
|
||||
`${formatDateFromISO(data.tanggal_kunjungan) || ''}`,
|
||||
`${formatDateFromISO(data.waktu_penilaian) || ''}`,
|
||||
},
|
||||
progress: {
|
||||
title: 'Progress',
|
||||
@@ -222,6 +221,7 @@
|
||||
return `${mulai.getDate()}-${mulai.getMonth() + 1}-${mulai.getFullYear()} - ${selesai.getDate()}-${selesai.getMonth() + 1}-${selesai.getFullYear()}`
|
||||
},
|
||||
},
|
||||
|
||||
paparan: {
|
||||
title: 'Paparan',
|
||||
render: (item, data) => `${data.paparan || ''}`,
|
||||
|
||||
@@ -8,47 +8,52 @@
|
||||
<label class="form-label max-w-56">Luas Bagunan</label>
|
||||
<div class="mt-2">
|
||||
|
||||
@if (isset($permohonan->debiture->documents))
|
||||
@foreach ($permohonan->debiture->documents as $item)
|
||||
@php
|
||||
$luas = $item->detail;
|
||||
$details = json_decode($luas[0]->details, true);
|
||||
$luas_bangunan = isset($details['luas_bangunan']) ? $details['luas_bangunan'] : 'N/A';
|
||||
@endphp
|
||||
<input type="hidden" name="luas_bangunan_sesuai" class="input" value="{{ $luas_bangunan }}">
|
||||
<p class="text-2sm text-gray-700">{{ $luas_bangunan }} m<sup>2</sup></p>
|
||||
@endforeach
|
||||
@if (isset($permohonan->debiture->documents))
|
||||
@foreach ($permohonan->debiture->documents as $item)
|
||||
@php
|
||||
$luas = $item->detail;
|
||||
$details = json_decode($luas[0]->details, true);
|
||||
$luas_bangunan = isset($details['luas_bangunan']) ? $details['luas_bangunan'] : 'N/A';
|
||||
@endphp
|
||||
<input type="hidden" name="luas_bangunan_sesuai" class="input" value="{{ $luas_bangunan }}">
|
||||
<p class="text-2sm text-gray-700">{{ $luas_bangunan }} m<sup>2</sup></p>
|
||||
@endforeach
|
||||
|
||||
@endif
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
<div class="grid grid-cols-2 md:grid-cols-3 gap-4 mt-2">
|
||||
<label class="form-label flex items-center gap-3 text-nowrap">
|
||||
<input type="radio"
|
||||
onclick="toggleFieldVisibility('luas_tanah_bagunan', 'luas_tanah_bagunan_tidak_sesuai', ['tidak sesuai'])"
|
||||
class="radio" name="luas_tanah_bagunan" value="sesuai"
|
||||
{{ old('luas_tanah_bagunan', $forminspeksi['bangunan']['luas_tanah_bagunan'] ?? '') == 'sesuai' ? 'checked' : '' }}>
|
||||
<span class="ml-2">Sesuai</span>
|
||||
</label>
|
||||
<label class="form-label flex items-center gap-2.5 text-nowrap">
|
||||
<input type="radio" class="radio" name="luas_tanah_bagunan"
|
||||
onclick="toggleFieldVisibility('luas_tanah_bagunan', 'luas_tanah_bagunan_tidak_sesuai', ['tidak sesuai'])"
|
||||
value="tidak sesuai"
|
||||
{{ old('luas_tanah_bagunan', $forminspeksi['bangunan']['luas_tanah_bagunan'] ?? '') == 'tidak sesuai' ? 'checked' : '' }}>
|
||||
<span class="ml-2">Tidak Sesuai</span>
|
||||
</label>
|
||||
@endif
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
<div class="grid grid-cols-2 md:grid-cols-3 gap-4 mt-2">
|
||||
<label class="form-label flex items-center gap-3 text-nowrap">
|
||||
<input type="radio"
|
||||
onclick="toggleFieldVisibility('luas_tanah_bagunan', 'luas_tanah_bagunan_tidak_sesuai', ['tidak sesuai'])"
|
||||
class="radio" name="luas_tanah_bagunan" value="sesuai"
|
||||
{{ old('luas_tanah_bagunan', isset($forminspeksi['bangunan']['luas_tanah_bagunan']['sesuai'])) ? 'checked' : '' }}>
|
||||
<span class="ml-2">Sesuai</span>
|
||||
</label>
|
||||
<label class="form-label flex items-center gap-2.5 text-nowrap">
|
||||
<input type="radio" class="radio" name="luas_tanah_bagunan"
|
||||
onclick="toggleFieldVisibility('luas_tanah_bagunan', 'luas_tanah_bagunan_tidak_sesuai', ['tidak sesuai'])"
|
||||
value="tidak sesuai"
|
||||
{{ old('luas_tanah_bagunan', isset($forminspeksi['bangunan']['luas_tanah_bagunan']['tidak sesuai'])) ? 'checked' : '' }}>
|
||||
<span class="ml-2">Tidak Sesuai</span>
|
||||
</label>
|
||||
|
||||
<div id="luas_tanah_bagunan_tidak_sesuai" class="flex items-baseline gap-2"
|
||||
style="{{ isset($forminspeksi['bangunan']['luas_tanah_bagunan']['tidak_sesuai']) ? '' : 'display: none;' }}">
|
||||
<input type="text" id="analisa_bangunan_tidak_sesuai"
|
||||
name="luas_tanah_bagunan_tidak_sesuai" class="input w-full"
|
||||
placeholder="Masukan Luas Bangunan Tidak Sesuai..."
|
||||
value="{{ old('luas_tanah_bagunan_tidak_sesuai', $forminspeksi['bangunan']['luas_tanah_bagunan']['tidak_sesuai'] ?? '') }}">
|
||||
<button type="button" class="btn btn-md btn-primary"
|
||||
onclick="updateAnalisa('analisa_bangunan')">
|
||||
Save
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div id="luas_tanah_bagunan_tidak_sesuai" class="flex items-baseline gap-2"
|
||||
style="{{ old('luas_tanah_bagunan_bagunan', $forminspeksi['bangunan']['luas_tanah_bagunan_bagunan'] ?? '') == 'tidak sesuai' ? '' : 'display: none;' }}">
|
||||
<input type="text"id="analisa_bangunan_tidak_sesuai" name="luas_tanah_bagunan_tidak_sesuai" class="input w-full"
|
||||
placeholder="Masukan Luas Bangunan Tidak Sesuai..."
|
||||
value="{{ old('luas_tanah_bagunan_tidak_sesuai', $forminspeksi['bangunan']['luas_tanah_bagunan_tidak_sesuai'] ?? '') }}">
|
||||
<button type="button" class="btn btn-md btn-primary" onclick="updateAnalisa('analisa_bangunan')">Save</button>
|
||||
</div>
|
||||
<em id="error-luas_tanah_bagunan" class="alert text-danger text-sm"></em>
|
||||
</div>
|
||||
<em id="error-luas_tanah_bagunan" class="alert text-danger text-sm"></em>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Jenis Bangunan -->
|
||||
@@ -62,15 +67,14 @@
|
||||
<input class="checkbox" name="jenis_bangunan[]" type="checkbox"
|
||||
value="{{ $item->name }}"
|
||||
{{ old('jenis_bangunan') == $item->name || isset($forminspeksi['bangunan']['jenis_bangunan']) == $item->name ? 'checked' : '' }}
|
||||
onclick="toggleCheckboxVisibility('jenis_bangunan', 'jenis_bangunan_lainnya', ['lainnya'])"
|
||||
/>
|
||||
onclick="toggleCheckboxVisibility('jenis_bangunan', 'jenis_bangunan_lainnya', ['lainnya'])" />
|
||||
{{ $item->name }}
|
||||
</label>
|
||||
@if (strcasecmp($item->name, 'Lainnya') == 0)
|
||||
<input id="jenis_bangunan_lainnya" type="text" style="display: none;"
|
||||
name="jenis_bangunan_lainnya" class="input w-full mt-2"
|
||||
placeholder="Masukkan lainnya..." />
|
||||
@endif
|
||||
<input id="jenis_bangunan_lainnya" type="text" style="display: none;"
|
||||
name="jenis_bangunan_lainnya" class="input w-full mt-2"
|
||||
placeholder="Masukkan lainnya..." />
|
||||
@endif
|
||||
@endforeach
|
||||
@endif
|
||||
</div>
|
||||
@@ -160,7 +164,7 @@
|
||||
@if ($spek->spek_kategori_bangunan_id == $item->id)
|
||||
<label class="form-label flex items-center gap-2.5">
|
||||
<input class="checkbox"
|
||||
name="spek_bangunan[{{ $item->name }}][]"
|
||||
name="spek_bangunan[{{ $item->name }}][]"
|
||||
type="checkbox" value="{{ $spek->name }}" />
|
||||
{{ $spek->name }}
|
||||
</label>
|
||||
@@ -196,16 +200,28 @@
|
||||
<div class="flex flex-col items-start gap-4">
|
||||
@if (isset($saranaPelengkap))
|
||||
@foreach ($saranaPelengkap as $item)
|
||||
@php
|
||||
$isChecked = false;
|
||||
$inputValue = '';
|
||||
|
||||
if (isset($forminspeksi['bangunan']['sarana_pelengkap'])) {
|
||||
foreach ($forminspeksi['bangunan']['sarana_pelengkap'] as $key => $value) {
|
||||
if ($key === $item->name) {
|
||||
$isChecked = true;
|
||||
$inputValue = $value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@endphp
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||
<label class="form-label max-w-56 gap-2.5" style="width: 500px">
|
||||
<input class="checkbox" name="sarana_pelengkap[]" type="checkbox"
|
||||
value="{{ $item->name }}"
|
||||
{{ in_array($item->name, old('sarana_pelengkap', $forminspeksi['bangunan']['sarana_pelengkap'] ?? [])) ? 'checked' : '' }} />
|
||||
value="{{ $item->name }}" {{ $isChecked ? 'checked' : '' }} />
|
||||
{{ $item->name }}
|
||||
</label>
|
||||
<input type="text" name="sarana_pelengkap_input[]" class="input w-full"
|
||||
id="bentukTanahInput" placeholder="Masukkan {{ $item->name }}..."
|
||||
value="{{ old('sarana_pelengkap_input.' . $loop->index, $forminspeksi['bangunan']['sarana_pelengkap_input'][$loop->index] ?? '') }}">
|
||||
placeholder="Masukkan {{ $item->name }}..." value="{{ $inputValue }}">
|
||||
</div>
|
||||
@endforeach
|
||||
@endif
|
||||
@@ -213,6 +229,7 @@
|
||||
<em id="error-sarana_pelengkap" class="alert text-danger text-sm"></em>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
@php
|
||||
$jaminanId = $dokumen->jenisJaminan->id;
|
||||
$currentInspeksi = $inspeksiData[$jaminanId] ?? null;
|
||||
|
||||
|
||||
$tanahBangunanTypes = ['KAPAL', 'PESAWAT', 'KENDARAAN', 'ALAT BERAT'];
|
||||
|
||||
|
||||
$href = [
|
||||
[
|
||||
'label' => 'form inspeksi',
|
||||
@@ -57,7 +57,14 @@
|
||||
<div class="card-group flex items-center flex-wrap sm:flex-nowrap justify-between py-4 gap-2.5">
|
||||
<div class="flex items-center gap-3.5">
|
||||
<div class="relative size-[50px] shrink-0">
|
||||
<!-- SVG code remains the same -->
|
||||
<svg class="w-full h-full stroke-brand-clarity fill-light" fill="none" height="48"
|
||||
viewBox="0 0 44 48" width="44" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M16 2.4641C19.7128 0.320509 24.2872 0.320508 28 2.4641L37.6506 8.0359C41.3634 10.1795 43.6506 14.141 43.6506 18.4282V29.5718C43.6506 33.859 41.3634 37.8205 37.6506 39.9641L28 45.5359C24.2872 47.6795 19.7128 47.6795 16 45.5359L6.34937 39.9641C2.63655 37.8205 0.349365 33.859 0.349365 29.5718V18.4282C0.349365 14.141 2.63655 10.1795 6.34937 8.0359L16 2.4641Z" fill=""></path>
|
||||
<path d="M16.25 2.89711C19.8081 0.842838 24.1919 0.842837 27.75 2.89711L37.4006 8.46891C40.9587 10.5232 43.1506 14.3196 43.1506 18.4282V29.5718C43.1506 33.6804 40.9587 37.4768 37.4006 39.5311L27.75 45.1029C24.1919 47.1572 19.8081 47.1572 16.25 45.1029L6.59937 39.5311C3.04125 37.4768 0.849365 33.6803 0.849365 29.5718V18.4282C0.849365 14.3196 3.04125 10.5232 6.59937 8.46891L16.25 2.89711Z" stroke=""></path>
|
||||
</svg>
|
||||
<div class="absolute leading-none left-2/4 top-2/4 -translate-y-2/4 -translate-x-2/4">
|
||||
<i class="ki-filled ki-additem text-2xl text-brand"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex items-center gap-2.5">
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -5,7 +5,7 @@
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
@include('lpj::assetsku.includenya')
|
||||
@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">
|
||||
@@ -142,7 +142,8 @@
|
||||
<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;' }}">
|
||||
alt="Gambar foto_denah"
|
||||
style="{{ isset($formDenah['foto_denah']) ? 'width: 30rem;' : 'display: none;' }}">
|
||||
|
||||
|
||||
|
||||
@@ -150,9 +151,7 @@
|
||||
<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')"
|
||||
>
|
||||
accept="image/*" onchange="previewImage(this, 'foto_denah-preview')">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -178,29 +177,32 @@
|
||||
|
||||
</div>
|
||||
|
||||
<em id="error-luas" class="alert text-danger text-sm"></em>
|
||||
<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>
|
||||
|
||||
<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')
|
||||
<script>
|
||||
function previewImage(input, previewId) {
|
||||
function previewImage(input, previewId) {
|
||||
if (input.files && input.files[0]) {
|
||||
var reader = new FileReader();
|
||||
reader.onload = function(e) {
|
||||
@@ -213,15 +215,13 @@
|
||||
}
|
||||
|
||||
function submitDenah() {
|
||||
const loadingOverlay = document.getElementById('loadingOverlay');
|
||||
loadingOverlay.classList.remove('hidden');
|
||||
loadingOverlay.classList.add('flex');
|
||||
|
||||
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',
|
||||
@@ -233,9 +233,24 @@
|
||||
},
|
||||
success: function(response) {
|
||||
if (response.success) {
|
||||
window.location.href =
|
||||
'{{ route('surveyor.show', ['id' => $permohonan->id]) }}?form=denah';
|
||||
toastrSuccessBuild(response.message);
|
||||
Swal.fire({
|
||||
title: 'Berhasil!',
|
||||
text: response.message,
|
||||
icon: 'success',
|
||||
confirmButtonText: 'OK'
|
||||
}).then((response) => {
|
||||
if (response.isConfirmed) {
|
||||
window.location.href =
|
||||
'{{ route('surveyor.show', ['id' => $permohonan->id]) }}';
|
||||
}
|
||||
});
|
||||
} else {
|
||||
Swal.fire({
|
||||
title: 'Error!',
|
||||
text: response.message || 'Terjadi kesalahan',
|
||||
icon: 'error',
|
||||
confirmButtonText: 'OK'
|
||||
});
|
||||
}
|
||||
console.log(response);
|
||||
},
|
||||
@@ -255,13 +270,32 @@
|
||||
|
||||
},
|
||||
complete: function() {
|
||||
// Re-enable the button and hide the spinner
|
||||
$('#saveButton').prop('disabled', false);
|
||||
$('#saveButtonText').show();
|
||||
$('#saveButtonSpinner').hide();
|
||||
loadingOverlay.classList.add('hidden');
|
||||
loadingOverlay.classList.remove('flex');
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
</script>
|
||||
@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>
|
||||
|
||||
@@ -76,19 +76,32 @@
|
||||
<label class="form-label max-w-56">Batas batas</label>
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
<div class="grid grid-cols-1 gap-4 items-center w-full">
|
||||
|
||||
@if (isset($arahMataAngin))
|
||||
@foreach ($arahMataAngin as $item)
|
||||
@php
|
||||
$isChecked = false;
|
||||
$inputValue = '';
|
||||
|
||||
if (isset($forminspeksi['fakta']['batas_batas'])) {
|
||||
foreach ($forminspeksi['fakta']['batas_batas'] as $key => $value) {
|
||||
if ($key === $item->name) {
|
||||
$isChecked = true;
|
||||
$inputValue = $value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@endphp
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||
<label class="form-label max-w-56 gap-2.5" style="width: 500px">
|
||||
<input class="checkbox" name="batas_batas[]" type="checkbox"
|
||||
value="{{ $item->name }}"
|
||||
{{ in_array($item->name, old('batas_batas', $forminspeksi['fakta']['batas_batas'] ?? [])) ? 'checked' : '' }} />
|
||||
{{ $isChecked ? 'checked' : '' }} />
|
||||
{{ $item->name }}
|
||||
</label>
|
||||
<input type="text" name="batas_batas_input[]" class="input w-full"
|
||||
id="bentukTanahInput" placeholder="Masukkan Batas {{ $item->name }}..."
|
||||
value="{{ old('batas_batas_input.' . $loop->index, $forminspeksi['fakta']['batas_batas_input'][$loop->index] ?? '') }}">
|
||||
placeholder="Masukkan Batas {{ $item->name }}..."
|
||||
value="{{ $inputValue }}">
|
||||
</div>
|
||||
@endforeach
|
||||
@endif
|
||||
@@ -98,6 +111,7 @@
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||
<label class="form-label max-w-56">Kondisi lain terkait lingkungan</label>
|
||||
<div class="flex flex-wrap items-baseline w-full" id="kondisi-lingkungan-container">
|
||||
|
||||
@@ -585,8 +585,12 @@
|
||||
</div>
|
||||
|
||||
</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 -->
|
||||
@@ -598,17 +602,16 @@
|
||||
@push('scripts')
|
||||
<script>
|
||||
function submitFoto() {
|
||||
const loadingOverlay = document.getElementById('loadingOverlay');
|
||||
loadingOverlay.classList.remove('hidden');
|
||||
loadingOverlay.classList.add('flex');
|
||||
|
||||
const formElement = $('#formFoto')[0];
|
||||
const formData = new FormData(formElement);
|
||||
// for (const [key, value] of formData.entries()) {
|
||||
// console.log(`Key: ${key}, Value: ${value}`);
|
||||
// }
|
||||
|
||||
// Disable the button and show the spinner
|
||||
$('#saveButtonFoto').prop('disabled', true);
|
||||
$('#saveButtonFotoText').hide();
|
||||
$('#saveButtonSpinner').show();
|
||||
|
||||
$.ajax({
|
||||
url: '{{ route('surveyor.storeFoto') }}',
|
||||
type: 'POST',
|
||||
@@ -621,12 +624,27 @@
|
||||
},
|
||||
success: function(response) {
|
||||
if (response.success) {
|
||||
// window.location.href =
|
||||
// '{{ route('surveyor.show', ['id' => $permohonan->id]) }}?form=foto';
|
||||
toastrSuccessBuild(response.message);
|
||||
Swal.fire({
|
||||
title: 'Berhasil!',
|
||||
text: response.message,
|
||||
icon: 'success',
|
||||
confirmButtonText: 'OK'
|
||||
}).then((response) => {
|
||||
if (response.isConfirmed) {
|
||||
window.location.href =
|
||||
'{{ route('surveyor.show', ['id' => $permohonan->id]) }}';
|
||||
}
|
||||
});
|
||||
} else {
|
||||
Swal.fire({
|
||||
title: 'Error!',
|
||||
text: response.message || 'Terjadi kesalahan',
|
||||
icon: 'error',
|
||||
confirmButtonText: 'OK'
|
||||
});
|
||||
}
|
||||
console.log(response);
|
||||
|
||||
|
||||
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
@@ -645,9 +663,8 @@
|
||||
},
|
||||
complete: function() {
|
||||
// Re-enable the button and hide the spinner
|
||||
$('#saveButtonFoto').prop('disabled', false);
|
||||
$('#saveButtonFotoText').show();
|
||||
$('#saveButtonSpinner').hide();
|
||||
loadingOverlay.classList.add('hidden');
|
||||
loadingOverlay.classList.remove('flex');
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -655,6 +672,28 @@
|
||||
@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>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -37,12 +37,20 @@
|
||||
<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>
|
||||
|
||||
<!-- 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')
|
||||
<script type="text/javascript">
|
||||
@@ -118,14 +126,14 @@
|
||||
|
||||
|
||||
function submitData() {
|
||||
|
||||
const loadingOverlay = document.getElementById('loadingOverlay');
|
||||
loadingOverlay.classList.remove('hidden');
|
||||
loadingOverlay.classList.add('flex');
|
||||
|
||||
const formElement = $('#formInspeksi')[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.store') }}',
|
||||
type: 'POST',
|
||||
@@ -136,12 +144,26 @@
|
||||
'X-CSRF-TOKEN': '{{ csrf_token() }}'
|
||||
},
|
||||
success: function(response) {
|
||||
// if (response.success) {
|
||||
// toastrSuccessBuild(response.message)
|
||||
// window.location.href =
|
||||
// '{{ route('surveyor.show', ['id' => $permohonan->id]) }}?form=inspeksi';
|
||||
// }
|
||||
|
||||
if (response.success) {
|
||||
Swal.fire({
|
||||
title: 'Berhasil!',
|
||||
text: response.message,
|
||||
icon: 'success',
|
||||
confirmButtonText: 'OK'
|
||||
}).then((response) => {
|
||||
if (response.isConfirmed) {
|
||||
window.location.href =
|
||||
'{{ route('surveyor.show', ['id' => $permohonan->id]) }}';
|
||||
}
|
||||
});
|
||||
} else {
|
||||
Swal.fire({
|
||||
title: 'Error!',
|
||||
text: response.message || 'Terjadi kesalahan',
|
||||
icon: 'error',
|
||||
confirmButtonText: 'OK'
|
||||
});
|
||||
}
|
||||
console.log(response);
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
@@ -160,9 +182,8 @@
|
||||
},
|
||||
complete: function() {
|
||||
// Re-enable the button and hide the spinner
|
||||
$('#saveButton').prop('disabled', false);
|
||||
$('#saveButtonText').show();
|
||||
$('#saveButtonSpinner').hide();
|
||||
loadingOverlay.classList.add('hidden');
|
||||
loadingOverlay.classList.remove('flex');
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -239,10 +260,9 @@
|
||||
success: function(response) {
|
||||
console.log(response);
|
||||
if (response.success) {
|
||||
if (response.jenis_asset) {
|
||||
window.location.href =
|
||||
'{{ route('surveyor.show', ['id' => $permohonan->id]) }}?form=inspeksi';
|
||||
}
|
||||
window.location.href =
|
||||
'{{ route('surveyor.show', ['id' => $permohonan->id]) }}';
|
||||
|
||||
toastrSuccessBuild(response.message);
|
||||
}
|
||||
},
|
||||
@@ -260,3 +280,34 @@
|
||||
}
|
||||
</script>
|
||||
@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);
|
||||
}
|
||||
}
|
||||
|
||||
.scrollable-x-auto {
|
||||
overflow-x: auto;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.table {
|
||||
min-width: 100%;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -169,25 +169,38 @@
|
||||
<span class="ml-2">Telah ada bangunan</span>
|
||||
</label>
|
||||
<div class="flex w-full items-center gap-4">
|
||||
|
||||
<div id="disekitar_lokasi_sesuai" class="grid grid-cols-2 gap-4 mt-5 mb-5"
|
||||
style="display: none;">
|
||||
style="{{ old('disekitar_lokasi', $forminspeksi['lingkungan']['disekitar_lokasi'] ?? '') == 'ya' ? '' : 'display: none;' }}">
|
||||
<div class="flex items-center gap-2">
|
||||
<label for="" class="text-sm text-gray-700">Kondisi bangunan</label>
|
||||
|
||||
@php
|
||||
$kondisi = ['Cukup', 'Baik', 'Kurang'];
|
||||
@endphp
|
||||
|
||||
<select class="select" name="kondisi_bagunan_disekitar_lokasi" id="">
|
||||
<option value="">pilih kondisi</option>
|
||||
<option value="Cukup">Cukup</option>
|
||||
<option value="Baik">Baik</option>
|
||||
<option value="Kurang">Kurang</option>
|
||||
@foreach ($kondisi as $item)
|
||||
<option value="{{ $item }}"
|
||||
{{ old('kondisi_bagunan_disekitar_lokasi', $forminspeksi['lingkungan']['disekitar_lokasi'] ?? '') == $item ? 'selected' : '' }}>
|
||||
{{ $item }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div class="flex items-center gap-2">
|
||||
<label for="" class="text-sm text-gray-700">Sifat bangunan</label>
|
||||
@php
|
||||
$sifat = ['Permanen', 'Semi Permanen', 'Tidak Permanen'];
|
||||
@endphp
|
||||
<select class="select" name="sifat_bagunan_disekitar_lokasi" id="">
|
||||
<option value="">pilih sifat bagunan</option>
|
||||
<option value="Permanen">Permanen</option>
|
||||
<option value="Semi Permanen">Semi Permanen</option>
|
||||
<option value="Tidak Permanen">Tidak Permanen</option>
|
||||
@foreach ($sifat as $item)
|
||||
<option value="{{ $item }}"
|
||||
{{ old('sifat_bagunan_disekitar_lokasi', $forminspeksi['lingkungan']['disekitar_lokasi'] ?? '') == $item ? 'selected' : '' }}>
|
||||
{{ $item }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
style="{{ old('luas_tanah', isset($forminspeksi['tanah']['luas_tanah']['tidak sesuai'])) ? '' : 'display: none;' }}">
|
||||
<input id="analisa_tanah_tidak_sesuai" type="text" name="luas_tanah_tidak_sesuai"
|
||||
class="input w-full" placeholder="Masukan Luas Tanah"
|
||||
value="{{ old('luas_tanah_tidak_sesuai', $forminspeksi['tanah']['luas_tanah_tidak_sesuai'] ?? '') }}">
|
||||
value="{{ old('luas_tanah_tidak_sesuai', $forminspeksi['tanah']['luas_tanah']['tidak sesuai'] ?? '') }}">
|
||||
<button type="button" class="btn btn-md btn-primary"
|
||||
onclick="updateAnalisa('analisa_tanah')">Save</button>
|
||||
</div>
|
||||
@@ -85,6 +85,7 @@
|
||||
</label>
|
||||
|
||||
<!-- Select dropdown untuk "Tidak Sesuai" -->
|
||||
|
||||
<div id="hadap_mata_angin_tidak_sesuai" class="flex items-baseline gap-2"
|
||||
style="{{ old('hadap_mata_angin', isset($forminspeksi['tanah']['hadap_mata_angin']['tidak sesuai'])) ? '' : 'display: none;' }}">
|
||||
<select class="input w-full
|
||||
@@ -94,7 +95,7 @@
|
||||
@if (isset($arahMataAngin))
|
||||
@foreach ($arahMataAngin as $item)
|
||||
<option value="{{ $item->name }}"
|
||||
{{ old('hadap_mata_angin_tidak_sesuai', $forminspeksi['tanah']['hadap_mata_angin_tidak_sesuai'] ?? '') == $item->name ? 'selected' : '' }}>
|
||||
{{ old('hadap_mata_angin_tidak_sesuai', $forminspeksi['tanah']['hadap_mata_angin']['tidak sesuai'] ?? '') == $item->name ? 'selected' : '' }}>
|
||||
{{ $item->name }}
|
||||
</option>
|
||||
@endforeach
|
||||
@@ -233,14 +234,14 @@
|
||||
<label class="form-label flex items-center gap-2.5 text-nowrap">
|
||||
<input class="checkbox" name="posisi_kavling[]" type="checkbox"
|
||||
value="{{ $item->name }}"
|
||||
{{ in_array($item->name, old('posisi_kavling', $forminspeksi['tanah']['posisi_kavling'] ?? [])) ? 'checked' : '' }}
|
||||
{{ in_array($item->name, old('posisi_kavling', $forminspeksi['tanah']['posisi_kavling']['posisi_kavling'] ?? [])) ? 'checked' : '' }}
|
||||
onclick="toggleCheckboxVisibility('posisi_kavling', 'posisi_kavling_lainnya', ['Lainnya'])" />
|
||||
{{ $item->name }}
|
||||
</label>
|
||||
@if (strcasecmp($item->name, 'Lainnya') == 0)
|
||||
<input id="posisi_kavling_lainnya" type="text" style="display: none;"
|
||||
name="posisi_kavling_lainnya" class="input w-full mt-2"
|
||||
placeholder="Masukkan Posisi Kavling lainnya..." />
|
||||
placeholder="Masukkan Posisi Kavling lainnya..." value="{{ old('posisi_kavling_lainnya', $forminspeksi['tanah']['posisi_kavling']['lainnya'] ?? '') }}" />
|
||||
@endif
|
||||
</div>
|
||||
@endforeach
|
||||
|
||||
Reference in New Issue
Block a user