update lokasi otomatis dan print out

This commit is contained in:
majid
2024-12-24 11:51:00 +07:00
parent 310fdff0ed
commit 1ecc82b243
5 changed files with 71 additions and 17 deletions

View File

@@ -211,8 +211,6 @@
}
</style>
</head>
<body>
@@ -537,9 +535,12 @@
</tr>
<tr>
@endif
<td>
<input type="checkbox" {{ in_array($item->name, $forminspeksi['tanah']['bentuk_tanah']['bentuk_tanah']) ? 'checked' : '' }}> {{ $item->name }}
</td>
<td>
<input type="checkbox"
{{ isset($forminspeksi['tanah']['bentuk_tanah']['bentuk_tanah']) && in_array($item->name, $forminspeksi['tanah']['bentuk_tanah']['bentuk_tanah']) ? 'checked' : '' }}>
{{ $item->name }}
</td>
@endforeach
</tr>
</table>

View File

@@ -51,18 +51,20 @@
@php
$inspeksiId = null;
$documentId = null;
$jenisJaminanId = null;
foreach ($permohonan->debiture->documents as $item) {
foreach ($item->inspeksi as $key => $value) {
$inspeksiId = $item->id;
}
$documentId = $item->dokumen_id;
$documentId = $item->id;
$jenisJaminanId = $item->jenis_jaminan_id;
}
@endphp
@if ($dataHeader == 'pelaporan')
<a class="btn btn-success"
href="{{ route('penilai.print-out') }}?permohonanId={{ $permohonan->id }}&documentId={{ $documentId }}&inspeksiId={{ $inspeksiId }}&jaminanId={{ $dokumen->jenis_jaminan_id }}">
PRINT OUT
href="{{ route('penilai.print-out') }}?permohonanId={{ $permohonan->id }}&documentId={{ $documentId }}&inspeksiId={{ $inspeksiId }}&jaminanId={{ $jenisJaminanId }}">
Lihat Laporan
</a>
@endif

View File

@@ -107,7 +107,7 @@
value="rute_{{ $index }}">
<input id="inputRute-{{ $index }}" type="file" name="foto_rute[]"
class="file-input file-input-bordered w-full" accept="image/*"
capture="camera" onchange="previewImage(this, 'foto_rute-preview')">
capture="camera" onchange="previewImage(this, 'foto_rute-preview-{{ $index }}')">
<button type="button" id="btnCamera-{{ $index }}" class="btn btn-light"
@@ -390,7 +390,7 @@
</label>
<div class="input-group w-full grid gap-5">
<div class="preview-container">
<img id="foto_lantai-preview-{{ $loop->index }}"
<img id="foto_lantai-preview-{{ $loop->iteration }}"
src="{{ asset('storage/' . old('foto_lantai_unit', $item['foto_lantai_unit'])) }}"
alt="Foto Lantai" class="mt-2 h-auto"
style="{{ old('foto_lantai_unit', $item['foto_lantai_unit']) ? 'display: block;' : 'display: none;' }} width: 30rem;">

View File

@@ -218,7 +218,7 @@
</div>
<div class="card-body">
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">Koordinat</label>
<label class="form-label max-w-56">Koordinat</label>
<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"
@@ -228,10 +228,12 @@
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">
<a onclick="getCoordinates()" type="button" class="btn btn-md btn-outline btn-primary">
<i class="ki-filled ki-map"></i>Ambil
Koordinat </a>
<a target="_blank" href="https://www.google.com/maps" type="button"
class="btn btn-md btn-outline btn-success">
<i class="ki-filled ki-map"></i>Ke google Maps</a>
</div>
</div>
</div>
@@ -443,11 +445,9 @@
@endphp
<input id="hub_penghuni_tidak_sesuai" class="input"
name="hub_penghuni_tidak_sesuai"
<input id="hub_penghuni_tidak_sesuai" class="input" name="hub_penghuni_tidak_sesuai"
placeholder="Masukkan Hubungin penghuni jaminan"
value="{{ old('hub_penghuni_tidak_sesuai', isset($selectedData) ? $selectedData : '') }}"
style="{{ old('hub_penghuni_tidak_sesuai', $selectedData ?? false) ? '' : 'display: none;' }}">
</div>
<em id="error-hub_cadeb_penghuni" class="alert text-danger text-sm"></em>
@@ -460,6 +460,43 @@
</div>
</div>
<script>
function getCoordinates() {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(
(position) => {
// Ambil latitude dan longitude
const lat = position.coords.latitude;
const lng = position.coords.longitude;
// Masukkan ke dalam input field
document.getElementById('lat').value = lat;
document.getElementById('lng').value = lng;
toastrSuccessBuild('Koordinat berhasil diambil!');
},
(error) => {
// Handle error
switch (error.code) {
case error.PERMISSION_DENIED:
toastrErrorBuild('Pengguna menolak permintaan geolokasi.');
break;
case error.POSITION_UNAVAILABLE:
toastrErrorBuild('Informasi lokasi tidak tersedia.');
break;
case error.TIMEOUT:
toastrErrorBuild('Permintaan geolokasi mengalami timeout.');
break;
case error.UNKNOWN_ERROR:
toastrErrorBuild('Terjadi kesalahan yang tidak diketahui.');
break;
}
}
);
} else {
toastrErrorBuild('Geolocation tidak didukung oleh browser ini.');
}
}
document.addEventListener('DOMContentLoaded', function() {
// Cek radio button saat halaman dimuat
const sesuaiRadio = document.querySelector('input[name="alamat_sesuai"][value="sesuai"]');

View File

@@ -1,3 +1,17 @@
<style>
.camera-container {
position: relative;
width: 100%;
height: auto;
}
video, canvas {
width: 100%;
height: auto;
}
</style>
<div class="modal fade" data-modal="true" id="cameraModal" data-backdrop="" data-keyboard="false">
<div class="modal-content">
@@ -85,4 +99,4 @@
</div>
</div>
</div>
</div>
</div>