update pemilihan team hanya surveyor atau penilai dan update form foto menggunakan camera

This commit is contained in:
majid
2024-10-29 14:22:25 +07:00
parent 13d7b1c4fd
commit 4b08225403
33 changed files with 1477 additions and 314 deletions

View File

@@ -0,0 +1,192 @@
<div class=""max-w-4xl mx-auto bg-white rounded-lg shadow-md overflow-hidden">
<div class="py-4 px-6">
<h1 class="text-md font-medium text-gray-900">Identitas Debitur</h1>
</div>
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">Hubungan Calon Debitur</label>
<div class="flex flex-wrap items-baseline w-full">
<input type="text" name="bentuk_tanah" class="input"
placeholder="Masukkan Hubungan Calon Debitur">
@error('bentuk_tanah')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
</div>
<div class="py-4 px-6">
<h1 class="text-md font-medium text-gray-900">Lokasi Jaminan</h1>
</div>
<div class="grid gap-5">
@php
$inputDataLoaksi = [];
$inputDataLoaksi = [
['label' => 'Nama Jalan', 'index' => 0],
['label' => 'Perumahan/Gang', 'index' => 1],
['label' => 'Blok/Nomor', 'index' => 2],
['label' => 'Desa/Kelurahan', 'index' => 3],
['label' => 'Kecamatan', 'index' => 4],
['label' => 'Kota/Kotamadya', 'index' => 5],
['label' => 'Provinsi', 'index' => 6]
];
@endphp
@if (count($inputDataLoaksi) > 0)
@foreach ($inputDataLoaksi as $item)
<!-- Nomor Lambung -->
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">{{ $item['label'] }}</label>
<div class="flex flex-wrap items-baseline w-full">
<input type="text" name="bentuk_tanah" class="input"
placeholder="Masukkan {{ $item['label'] }}">
@error('bentuk_tanah')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
</div>
@endforeach
@endif
</div>
</div>
<div class=""max-w-4xl mx-auto bg-white rounded-lg shadow-md overflow-hidden">
<div class="py-4 px-6">
<h1 class="text-md font-medium text-gray-900">Data Data Jaminan</h1>
</div>
<div class="grid gap-5">
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">Model</label>
<div class="flex flex-wrap items-baseline w-full">
<select class="input tomselect w-full @error('hadapMataAngin') border-danger bg-danger-light @enderror"
name="hadapMataAngin">
<option value="">Select Model Kendaraan </option>
@if (isset($arahMataAngin))
@foreach ($arahMataAngin as $item)
<option value="{{ $item->name }}"
{{ old('hadapMataAngin') == $item->name ? 'selected' : '' }}>{{ $item->name }}
</option>
@endforeach
@endif
</select>
@error('hadapMataAngin')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
</div>
@php
$inputDataJaminan = [];
$inputDataJaminan = [
['label' => 'Nomor Lambung', 'index' => 0],
['label' => 'Model Unit', 'index' => 1],
['label' => 'Tahun Pembuatan', 'index' => 2],
['label' => 'Merk', 'index' => 3],
['label' => 'Negara Pembuat', 'index' => 4],
['label' => 'Tahun Pembelian', 'index' => 5],
['label' => 'Nomor Faktur/Invoice', 'index' => 6],
['label' => 'Nomor Kontrak Pembelian', 'index' => 7],
['label' => 'Nama Pemilik', 'index' => 8],
['label' => 'Alamaat Pemilik', 'index' => 9],
['label' => 'Nomor Asuransi', 'index' => 10],
['label' => 'Nomor Rangka', 'index' => 11],
['label' => 'Nomor Mesin', 'index' => 12],
['label' => 'Hour Mesin', 'index' => 13],
['label' => 'Overhaul Mesin', 'index' => 14],
];
@endphp
@if (count($inputDataJaminan) > 0)
@foreach ($inputDataJaminan as $item)
<!-- Nomor Lambung -->
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">{{ $item['label'] }}</label>
<div class="flex flex-wrap items-baseline w-full">
<input type="text" name="bentuk_tanah" class="input"
placeholder="Masukkan {{ $item['label'] }}">
@error('bentuk_tanah')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
</div>
@endforeach
@endif
</div>
</div>
<div class=""max-w-4xl mx-auto bg-white rounded-lg shadow-md overflow-hidden">
<div class="py-4 px-6">
<h1 class="text-md font-medium text-gray-900">Kondisi Objek Jaminan</h1>
</div>
<div class="grid gap-5">
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">Model</label>
<div class="flex flex-wrap items-baseline w-full">
<select class="input tomselect w-full @error('hadapMataAngin') border-danger bg-danger-light @enderror"
name="hadapMataAngin">
<option value="">Select Model Kendaraan </option>
@if (isset($arahMataAngin))
@foreach ($arahMataAngin as $item)
<option value="{{ $item->name }}"
{{ old('hadapMataAngin') == $item->name ? 'selected' : '' }}>{{ $item->name }}
</option>
@endforeach
@endif
</select>
@error('hadapMataAngin')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
</div>
@php
$kondisiObjeck = [];
$kondisiObjeck = [
['label' => 'Mesin dan Panel Instrument', 'index' => 0],
['label' => 'Fungsi mesin dan panel instrument', 'index' => 1],
['label' => 'Interior (jok, dll)', 'index' => 2],
['label' => 'Rangka dan Karoseri', 'index' => 3],
['label' => 'Ban', 'index' => 4],
['label' => 'Velg', 'index' => 5],
['label' => 'Air Conditioner', 'index' => 6],
['label' => 'Aksesoris Tambahan lainnya', 'index' => 7],
['label' => 'LCD', 'index' => 8],
['label' => 'Perlengkapan Keamanan', 'index' => 9],
['label' => 'Asuransi', 'index' => 10],
];
@endphp
@if (count($kondisiObjeck) > 0)
@foreach ($kondisiObjeck as $item)
<!-- Nomor Lambung -->
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">{{ $item['label'] }}</label>
<div class="flex flex-wrap items-baseline w-full">
<input type="text" name="bentuk_tanah" class="input"
placeholder="Masukkan {{ $item['label'] }}">
@error('bentuk_tanah')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
</div>
@endforeach
@endif
</div>
</div>

View File

@@ -1,5 +1,5 @@
<div class=""max-w-4xl mx-auto bg-white rounded-lg shadow-md overflow-hidden">
<div class="bg-blue-600 text-white py-4 px-6">
<div class=" py-4 px-6">
<h1 class="text-md font-medium text-gray-900">Analisa Unit</h1>
</div>
<div class="grid gap-5">
@@ -104,8 +104,8 @@
class="input tomselect w-full @error('lantai') border-danger bg-danger-light @enderror"
name="lantai">
<option value="">Select Lantai</option>
@if (isset($posisiKavling))
@foreach ($posisiKavling as $item)
@if (isset($lantai))
@foreach ($lantai as $item)
<option value="{{ $item->name }}" {{ old('lantai', isset($analisa) && optional($analisa->analisaUnit)->lantai) == $item->name ? 'selected' : '' }}>{{ $item->name }}</option>
@endforeach
@endif
@@ -126,8 +126,8 @@
class="input tomselect w-full @error('view') border-danger bg-danger-light @enderror"
name="view">
<option value="">Select View</option>
@if (isset($kondisiFisikTanah))
@foreach ($kondisiFisikTanah as $item)
@if (isset($viewUnit))
@foreach ($viewUnit as $item)
<option value="{{ $item->name }}" {{ old('view', isset($analisa) && optional($analisa->analisaUnit)->view) == $item->name ? 'selected' : '' }}>{{ $item->name }}</option>
@endforeach
@endif
@@ -146,8 +146,8 @@
class="input tomselect w-full @error('bentuk_unit') border-danger bg-danger-light @enderror"
name="bentuk_unit">
<option value="">Select Bentuk Unit</option>
@if (isset($kondisiFisikTanah))
@foreach ($kondisiFisikTanah as $item)
@if (isset($bentukTanah))
@foreach ($bentukTanah as $item)
<option value="{{ $item->name }}" {{ old('bentuk_unit', isset($analisa) && optional($analisa->analisaUnit)->bentuk_unit) == $item->name ? 'selected' : '' }}>{{ $item->name }}</option>
@endforeach
@endif

View File

@@ -5,6 +5,7 @@
@endsection --}}
@section('content')
<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">
@@ -120,7 +121,6 @@
</div>
<div class="card">
<div class="card-body">
<form action="{{ route('surveyor.storeFoto') }}" method="POST" class="grid gap-5"
@@ -167,6 +167,8 @@
}
@endphp
<input type="hidden" name="analisa_type" value="{{ $analisaType }}">
<div class="bg-white rounded-lg shadow-md">
<div class="bg-blue-600 text-white py-4 px-6 flex items-center justify-between">
<h1 class="text-md font-medium text-gray-900">Rute Menuju Lokasi</h1>
@@ -177,25 +179,33 @@
@if (isset($fotoJaminan))
@foreach ($fotoJaminan->ruteJaminan as $item)
@if (isset($item->foto_rute))
<img src="{{ asset('storage/' . old('foto_rute', $item->foto_rute)) }}"
alt="Gambar Pendamping" style="width: 12rem;">
@endif
<div id="inputContainerRute" style="margin-top: 10px">
<div class="flex w-full items-center justify-center gap-4 mb-4">
<label class="form-label max-w-56">
<span class="form-label">Foto Rute Menuju Lokasi</span>
</label>
<div class="w-full grid gap-5">
@if (isset($item->foto_rute))
<img src="{{ asset('storage/' . old('foto_rute', $item->foto_rute)) }}"
alt="Gambar Pendamping" style="width: 12rem;">
@endif
<input class="name_rute" type="hidden" name="name_rute[]" value="rute">
<input id="inputRute" type="file" name="foto_rute[]"
class="file-input file-input-bordered w-full" accept="image/*" capture="camera">
<button type="button" class="btn btn-danger btn-sm delete-btn"
style="display: none;" id="btnDelete">
<i class="ki-filled ki-trash"></i>
</button>
</div>
<div class="input-group w-full flex gap-2">
<input class="name_rute" type="hidden" name="name_rute[]" value="rute">
<input id="inputRute" type="file" name="foto_rute[]"
class="file-input file-input-bordered w-full" accept="image/*"
capture="camera">
<button type="button" id="btnCamera" class="btn btn-light"
data-modal-toggle="#cameraModal">
<i class="ki-outline ki-abstract-33"></i> Camera
</button>
</div>
<button type="button" class="btn btn-danger btn-sm delete-btn"
style="display: none;" id="btnDelete">
<i class="ki-filled ki-trash"></i>
</button>
</div>
</div>
@error('foto_rute.*')
<span class="alert text-danger text-sm">{{ $message }}</span>
@@ -211,9 +221,17 @@
<label class="form-label max-w-56">
<span class="form-label">Foto Rute Menuju Lokasi</span>
</label>
<input class="name_rute" type="hidden" name="name_rute[]" value="rute">
<input id="inputRute" type="file" name="foto_rute[]"
class="file-input file-input-bordered w-full" accept="image/*" capture="camera">
<div class="input-group w-full flex gap-2">
<input class="name_rute" type="hidden" name="name_rute[]" value="rute">
<input id="inputRute" type="file" name="foto_rute[]"
class="file-input file-input-bordered w-full" accept="image/*"
capture="camera">
<button type="button" id="btnCamera" class="btn btn-light"
data-modal-toggle="#cameraModal">
<i class="ki-outline ki-abstract-33"></i> Camera
</button>
</div>
<button type="button" class="btn btn-danger btn-sm delete-btn"
style="display: none;" id="btnDelete">
<i class="ki-filled ki-trash"></i>
@@ -231,7 +249,7 @@
<div class="bg-white rounded-lg shadow-md">
<div class="bg-blue-600 text-white py-4 px-6 flex items-center justify-between">
<div class=" text-white py-4 px-6 flex items-center justify-between">
<h1 class="text-md font-medium text-gray-900">Objek Jaminan</h1>
</div>
@php
@@ -267,9 +285,16 @@
alt="{{ $view['label'] }}" class="mb-2 w-48 h-auto"
style="width: 12rem;">
@endif
<input type="file" name="foto_objek[]"
class="file-input file-input-bordered w-full" accept="image/*"
capture="camera">
<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">
<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="name_objek[]" class="textarea" rows="3" placeholder="Deskripsi">{{ isset($fotoJaminan) && isset($fotoJaminan->objekJaminan[$view['index']]) ? str_replace($view['label'] . ': ', '', $fotoJaminan->objekJaminan[$view['index']]->name_objek) : '' }}</textarea>
</div>
</div>
@@ -289,7 +314,7 @@
<div class="flex flex-wrap gap-4 w-full">
<div class="bg-blue-600 text-white py-4 px-6 flex items-center justify-between w-full">
<div class=" text-white py-4 px-6 flex items-center justify-between w-full">
<label class="form-label">
<span class="form-label">Lantai</span>
</label>
@@ -336,10 +361,16 @@
<label class="form-label max-w-56">
<span class="form-label">Foto Lantai 1</span>
</label>
<input type="hidden" name="name_lantai_unit[]" value="lantai">
<input id="inputLantai" type="file" name="foto_lantai_unit[]"
class="file-input file-input-bordered w-full" accept="image/*"
capture="camera">
<div class="input-group w-full flex gap-2">
<input type="hidden" name="name_lantai_unit[]" value="lantai">
<input id="inputLantai" type="file" name="foto_lantai_unit[]"
class="file-input file-input-bordered w-full" accept="image/*"
capture="camera">
<button type="button" id="btnCamera" class="btn btn-light"
data-modal-toggle="#cameraModal">
<i class="ki-outline ki-abstract-33"></i> Camera
</button>
</div>
<button type="button" class="btn btn-danger btn-sm delete-btn"
style="display: none;" id="btnDelete">
<i class="ki-filled ki-trash"></i>
@@ -377,10 +408,16 @@
<img src="{{ asset('storage/' . old('foto_lingkungan', $item->foto_lingkungan)) }}"
alt="Gambar Pendamping" style="width: 12rem;">
@endif
<input type="hidden" name="name_lingkungan[]" value="lingkungan">
<input id="inputLingkungan" type="file" name="foto_lingkungan[]"
class="file-input file-input-bordered w-full" accept="image/*"
capture="camera">
<div class="input-group w-full flex gap-2">
<input type="hidden" name="name_lingkungan[]" value="lingkungan">
<input id="inputLingkungan" type="file" name="foto_lingkungan[]"
class="file-input file-input-bordered w-full" accept="image/*"
capture="camera">
<button type="button" id="btnCamera" class="btn btn-light"
data-modal-toggle="#cameraModal">
<i class="ki-outline ki-abstract-33"></i> Camera
</button>
</div>
<button type="button" class="btn btn-danger btn-sm delete-btn"
style="display: none;" id="btnDelete">
<i class="ki-filled ki-trash"></i>
@@ -401,9 +438,18 @@
<label class="form-label max-w-56">
<span class="form-label">Lingkungan</span>
</label>
<input type="hidden" name="name_lingkungan[]" value="lingkungan">
<input id="inputLingkungan" type="file" name="foto_lingkungan[]"
class="file-input file-input-bordered w-full" accept="image/*" capture="camera">
<div class="input-group w-full flex gap-2">
<input type="hidden" name="name_lingkungan[]" value="lingkungan">
<input id="inputLingkungan" type="file" name="foto_lingkungan[]"
class="file-input file-input-bordered w-full" accept="image/*"
capture="camera">
<button type="button" id="btnCamera" class="btn btn-light"
data-modal-toggle="#cameraModal">
<i class="ki-outline ki-abstract-33"></i> Camera
</button>
</div>
<button type="button" class="btn btn-danger btn-sm delete-btn"
style="display: none;" id="btnDelete">
<i class="ki-filled ki-trash"></i>
@@ -436,8 +482,16 @@
<img src="{{ asset('storage/' . old('pendamping', $fotoJaminan->pendamping)) }}"
alt="Gambar Pendamping" style="width: 12rem;">
@endif
<input id="inputPendamping" type="file" name="pendamping"
class="file-input file-input-bordered w-full" accept="image/*" capture="camera">
<div class="input-group w-full flex gap-2">
<input id="inputPendamping" type="file" name="pendamping"
class="file-input file-input-bordered w-full" accept="image/*"
capture="camera">
<button type="button" id="btnCamera" class="btn btn-light"
data-modal-toggle="#cameraModal">
<i class="ki-outline ki-abstract-33"></i> Camera
</button>
</div>
<button type="button" class="btn btn-danger btn-sm delete-btn"
style="display: none;" id="btnDelete">
<i class="ki-filled ki-trash"></i>
@@ -459,11 +513,266 @@
</div>
</div>
</div>
<!-- Modal Kamera -->
<div class="modal fade" data-modal="true" id="cameraModal" data-backdrop="" data-keyboard="false">
<div class="modal-content">
<div class="modal-header">
<h3 class="modal-title">Ambil Foto</h3>
<button class="btn btn-xs btn-icon btn-light" data-modal-dismiss="true" id="closeModal">
<i class="ki-outline ki-cross"></i>
</button>
</div>
<!-- Camera Interface -->
<div class="modal-body">
<div class="camera-container relative">
<video id="video" class="w-full h-auto" autoplay playsinline></video>
<canvas id="canvas" class="hidden w-full h-auto"></canvas>
<canvas id="drawingCanvas" class="hidden absolute top-0 left-0 w-full h-full"></canvas>
<div id="textOverlay" class="position-absolute top-0 left-0 w-100 h-100 pointer-events-none">
<!-- Text elements will be added here dynamically -->
</div>
</div>
<div class="modal-footer mt-2">
<div id="cameraControls" class="flex justify-center gap-2 mt-4">
<button id="startButton" class="btn btn-primary">
<i class="ki-outline ki-camera"></i> Start Camera
</button>
<button id="takePhotoButton" class="btn btn-success" disabled>
<i class="ki-outline ki-photograph"></i> Ambil Foto
</button>
<button id="switchButton" class="btn btn-info" disabled>
<i class="ki-outline ki-arrows-circle"></i> Switch Camera
</button>
</div>
<!-- Editor Controls -->
<div id="editorControls" class=" flex flex-wrap gap-2 mt-4">
<div class="drawing-tools flex gap-2">
<button class="tool-btn btn btn-sm" data-tool="brush">
<i class="ki-filled ki-brush"></i>
</button>
<button class="tool-btn btn btn-sm" data-tool="rectangle">
<i class="ki-filled ki-frame"></i>
</button>
<button class="btn btn-light btn-sm tool-btn" data-tool="arrow">
<i class="ki-duotone ki-arrow-right fs-2"></i>
</button>
<button class="tool-btn btn btn-sm" data-tool="circle">
<i class="ki-filled ki-mouse-circle"></i>
</button>
<button class="tool-btn btn btn-sm" data-tool="text">
<i class="ki-filled ki-text"></i>
</button>
</div>
<div class="drawing-settings flex gap-2">
<input type="color" id="colorPicker" class="w-8 h-8 rounded">
<div class="flex items-center gap-2">
<input type="range" id="brushSize" min="1" max="20" value="5"
class="range range-sm">
<span id="brushSizeValue" class="text-sm">5px</span>
</div>
<input type="text" id="textInput" class="input" placeholder="Enter text">
<button type="button" class="btn btn-primary" id="confirmTextBtn">Add Text</button>
</div>
<div class="history-controls flex gap-2">
<button id="undoButton" class="btn btn-sm">
<i class="ki-filled ki-arrows-loop"></i>
</button>
<button id="resetButton" class="btn btn-sm">
<i class="ki-outline ki-trash"></i>
</button>
</div>
<div class="final-controls flex gap-2">
<button type="button" class="btn btn-light btn-sm" data-modal-dismiss="true">Cancel</button>
<button id="backButton" class="btn btn-warning btn-sm">
<i class="ki-outline ki-arrow-left"></i> Kembali
</button>
<button id="saveButton" class="btn btn-success btn-sm">
<i class="ki-outline ki-check"></i> Simpan
</button>
</div>
</div>
</div>
</div>
</div>
</div>
@endsection
@push('scripts')
<script src="{{ asset('js/camera-editor.js') }}"></script>
<script>
const style = document.createElement('style');
style.textContent = `
.draggable-text {
z-index: 1000;
}
.draggable-text:hover {
outline: 1px dashed #666;
}
`;
document.head.appendChild(style);
document.addEventListener('DOMContentLoaded', function() {
// Initialize camera editor
const editor = new UniversalCameraEditor();
// Get all camera buttons
const cameraButtons = document.querySelectorAll('#btnCamera');
const modal = document.getElementById('cameraModal');
const closeModal = document.getElementById('closeModal');
// Current input field to update
let currentInputField = null;
// Confirm text button
// Handle camera button click
cameraButtons.forEach(button => {
button.addEventListener('click', function(e) {
e.preventDefault();
const inputContainer = this.closest('.input-group');
currentInputField = inputContainer.querySelector('input[type="file"]');
modal.classList.remove('hidden');
modal.classList.add('modal-open');
editor.startCamera();
});
});
closeModal.addEventListener('click', function() {
modal.classList.add('hidden');
editor.closeCamera();
});
// Override save function
editor.saveAndUpload = async function() {
try {
// Membuat canvas akhir
const finalCanvas = document.createElement('canvas');
finalCanvas.width = this.canvas.width;
finalCanvas.height = this.canvas.height;
const ctx = finalCanvas.getContext('2d');
// Menggambar foto asli dan hasil edit di canvas akhir
ctx.drawImage(this.canvas, 0, 0);
ctx.drawImage(this.drawingCanvas, 0, 0);
// Konversi canvas ke Blob dan buat file
finalCanvas.toBlob(async (blob) => {
const file = new File([blob], `camera_photo_${Date.now()}.jpg`, {
type: "image/jpeg"
});
// Membuat FileList dan memperbarui field input
const dataTransfer = new DataTransfer();
dataTransfer.items.add(file);
if (currentInputField) {
currentInputField.files = dataTransfer.files;
// Trigger event "change" untuk memperbarui tampilan
const event = new Event('change', {
bubbles: true
});
currentInputField.dispatchEvent(event);
// Tampilkan preview jika container preview ada
const previewContainer = currentInputField.closest('.input-group')
.querySelector('.preview-container');
if (previewContainer) {
const img = document.createElement('img');
img.src = URL.createObjectURL(file);
img.className = 'w-full h-32 object-cover rounded-lg';
previewContainer.innerHTML = ''; // Bersihkan container preview
previewContainer.appendChild(img); // Tambah gambar preview
}
}
// Menutup modal
const modal = document.getElementById('cameraModal');
modal.classList.remove('show');
modal.style.display = 'none';
modal.setAttribute('aria-hidden', 'true');
document.body.classList.remove('modal-open');
// Menghapus backdrop modal jika ada
const backdrop = document.querySelector('.modal-backdrop');
if (backdrop) {
backdrop.remove();
}
// Hentikan stream kamera
if (editor.stream) {
editor.stream.getTracks().forEach(track => track.stop());
editor.stream = null;
}
// Mengatur ulang ke kondisi awal (reset kamera)
editor.closeCamera()
}, 'image/jpeg', 0.8);
} catch (error) {
console.error('Error saving photo:', error);
alert('Error saving photo. Please try again.');
}
};
});
// Preview for regular file input change
document.addEventListener('change', function(e) {
if (e.target && e.target.type === 'file') {
const file = e.target.files[0];
if (file && file.type.startsWith('image/')) {
const previewContainer = e.target.closest('.input-group').querySelector('.preview-container');
if (previewContainer) {
const img = document.createElement('img');
img.src = URL.createObjectURL(file);
img.className = 'w-full h-32 object-cover rounded-lg';
previewContainer.innerHTML = '';
previewContainer.appendChild(img);
}
}
}
});
// Handle escape key
document.addEventListener('keydown', function(e) {
if (e.key === 'Escape') {
const modal = document.getElementById('cameraModal');
if (modal.classList.contains('modal-open')) {
modal.classList.remove('modal-open');
modal.classList.add('hidden');
if (editor.stream) {
editor.stream.getTracks().forEach(track => track.stop());
}
}
}
});
document.addEventListener('DOMContentLoaded', function() {
// Generic function to handle adding new input and delete functionality

View File

@@ -139,34 +139,35 @@
<input type="hidden" name="jenis_jaminan_id" value="{{ request('jenis_jaminan') }}">
@php
$analisaType = 'unknown';
$data = [
'tanah' => 'Tanah',
'unit_rumah' => 'Rumah Tinggal / Ruko (Unit) / Apartemen (Unit) / Gudang',
'tanah_bangunan' => 'Kawasan Industrial / Komersil / Residensial - Perumahan',
'unit_gedung' => 'Gedung Apartement / Kantor / Condotel (Strata Title)',
'tanah_bangunan' => 'Mall',
];
$analisaType = 'unknown';
$data = [
'tanah' => 'Tanah',
'unit_rumah' => 'Rumah Tinggal / Ruko (Unit) / Apartemen (Unit) / Gudang',
'tanah_bangunan' => 'Kawasan Industrial / Komersil / Residensial - Perumahan',
'unit_gedung' => 'Gedung Apartement / Kantor / Condotel (Strata Title)',
'tanah_bangunan' => 'Mall',
];
if (isset($analisa->id)) {
$analisaType = $analisa->type;
} else {
foreach ($data as $key => $value) {
if (isset($jenisJaminanData) &&
trim(strtolower($jenisJaminanData)) === trim(strtolower($value))) {
$analisaType = $key;
break;
if (isset($analisa->id)) {
$analisaType = $analisa->type;
} else {
foreach ($data as $key => $value) {
if (
isset($jenisJaminanData) &&
trim(strtolower($jenisJaminanData)) === trim(strtolower($value))
) {
$analisaType = $key;
break;
}
}
}
}
if ($analisaType === 'tanah') {
$analisaType = 'tanah_bangunan';
}
if ($analisaType === 'tanah') {
$analisaType = 'kendaraan';
}
if ($analisaType === 'unit_rumah' || $analisaType === 'unit_gedung') {
$analisaType = 'unit';
}
if ($analisaType === 'unit_rumah' || $analisaType === 'unit_gedung') {
$analisaType = 'unit';
}
@endphp
<input type="hidden" name="action" value="{{ $analisaType }}">
@@ -174,13 +175,15 @@
@if ($analisaType == 'tanah_bangunan')
@include('lpj::surveyor.components.tanah-bangunan')
@else
@elseif($analisaType == 'unit')
@include('lpj::surveyor.components.apartemen-kantor')
@elseif($analisaType == 'kendaraan')
@include('lpj::surveyor.components.alat-berat')
@endif
<div class=" bg-white rounded-lg shadow-md overflow-hidden">
<div class="bg-green-600 text-white py-4 px-6">
<div class=" text-white py-4 px-6">
<h1 class="text-md font-medium text-gray-900">Analisis Lingkungan</h1>
</div>
<div class="grid gap-5">
@@ -244,9 +247,9 @@
<select
class="input tomselect w-full @error('lalu_lintas') border-danger bg-danger-light @enderror"
name="lalu_lintas">
<option value="">Select PLalulintas Depan Lokasi</option>
@if (isset($konturTanah))
@foreach ($konturTanah as $item)
<option value="">Select Lalulintas Depan Lokasi</option>
@if (isset($laluLintasLokasi))
@foreach ($laluLintasLokasi as $item)
<option value="{{ $item->name }}"
{{ old('lalu_lintas', isset($analisa->analisaLingkungan) ? $analisa->analisaLingkungan->lalu_lintas : '') == $item->name ? 'selected' : '' }}>
{{ $item->name }}</option>
@@ -268,8 +271,9 @@
class="input tomselect w-full @error('gol_mas_sekitar') border-danger bg-danger-light @enderror"
name="gol_mas_sekitar">
<option value="">Select Golongan Hidup Sekitar</option>
@if (isset($konturTanah))
@foreach ($konturTanah as $item)
@if (isset($golMasySekitar))
@foreach ($golMasySekitar as $item)
<option value="{{ $item->name }}"
{{ old('gol_mas_sekitar', isset($analisa->analisaLingkungan) ? $analisa->analisaLingkungan->gol_mas_sekitar : '') == $item->name ? 'selected' : '' }}>
{{ $item->name }}</option>
@@ -291,8 +295,8 @@
class="input tomselect w-full @error('tingkat_keramaian') border-danger bg-danger-light @enderror"
name="tingkat_keramaian">
<option value="">Select Tingkat Keramaian</option>
@if (isset($konturTanah))
@foreach ($konturTanah as $item)
@if (isset($tingkatKeramaian))
@foreach ($tingkatKeramaian as $item)
<option value="{{ $item->name }}"
{{ old('tingkat_keramaian', isset($analisa->analisaLingkungan) ? $analisa->analisaLingkungan->tingkat_keramaian : '') == $item->name ? 'selected' : '' }}>
{{ $item->name }}</option>
@@ -448,7 +452,7 @@
</div>
<div class=" bg-white rounded-lg shadow-md overflow-hidden">
<div class="bg-blue-600 text-white py-4 px-6">
<div class=" py-4 px-6">
<h1 class="text-md font-medium text-gray-900">Analisis Fakta</h1>
</div>
<div class="grid gap-5">
@@ -544,9 +548,9 @@
</div>
<div class="container mx-auto ">
<div class="">
<!-- Header -->
<div class="bg-blue-600 text-white py-4 px-6">
<div class="py-4 px-6">
<h1 class="text-md font-medium text-gray-900">Informasi Dinas Tata Ruang</h1>
</div>
@@ -656,9 +660,37 @@
@enderror
</div>
</div>
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">
<span class="form-label">Gistaru</span>
</label>
<div class="input-group w-full flex gap-2">
<input class="name_rute" type="hidden" name="name_rute[]" value="rute">
<input id="inputRute" type="file" name="foto_rute" class="file-input file-input-bordered w-full" accept="image/*">
<button id="mod" type="button" class="btn btn-light" onclick="openModal('gistaru')">
<i class="ki-outline ki-abstract-33"></i> Gistaru
</button>
</div>
</div>
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">
<span class="form-label">Bumi</span>
</label>
<div class="input-group w-full flex gap-2">
<input class="name_rute" type="hidden" name="name_rute[]" value="rute">
<input id="inputRute" type="file" name="foto_rute" class="file-input file-input-bordered w-full" accept="image/*" capture="camera">
<button id="mod" type="button" class="btn btn-light" onclick="openModal('bumi')">
<i class="ki-outline ki-abstract-33"></i> Bumi
</button>
</div>
</div>
</div>
<!-- Peta Section -->
<div class="mt-2" style="margin-top: 20px">
<input type="hidden" name="lat" id="lat"
value="{{ old('lat', isset($analisa->analisaFakta) ? $analisa->analisaFakta->lat : '') }}">
@@ -717,8 +749,68 @@
</div>
</div>
<div class="modal fade" data-modal="true" id="modal" data-backdrop="static" data-keyboard="false">
<div class="modal-content">
<div class="modal-header">
<h3 class="modal-title">Kunjungan</h3>
<button class="btn btn-xs btn-icon btn-light" data-modal-dismiss="true">
<i class="ki-outline ki-cross"></i>
</button>
</div>
<div class="modal-body" id="screenshotContainer" style="height: 500px">
<iframe id="mapFrameGis" frameborder="0" style="width: 100%; height: 100%;"></iframe>
</div>
<div class="modal-footer flex justify-end">
<button id="takeScreenshot" class="btn btn-success">Take Screenshot</button>
</div>
</div>
</div>
@endsection
@push('scripts')
<script>
function getMap(params) {
const iframe = document.getElementById('mapFrameGis');
const maps = [
'https://gistaru.atrbpn.go.id/rtronline/',
'https://bhumi.atrbpn.go.id/peta'
];
iframe.src = maps[params];
}
function openModal(type) {
const modal = document.getElementById('mod');
modal.setAttribute('data-modal-toggle', '#modal');
getMap(type === 'gistaru' ? 0 : 1);
}
document.getElementById('takeScreenshot').addEventListener('click', () => {
const screenshotContainer = document.getElementById('screenshotContainer');
const canvas = document.createElement('canvas');
canvas.width = screenshotContainer.offsetWidth;
canvas.height = screenshotContainer.offsetHeight;
const ctx = canvas.getContext('2d');
ctx.drawImage(document.getElementById('mapFrame'), 0, 0, canvas.width, canvas.height);
const dataURL = canvas.toDataURL('image/jpeg');
// Tampilkan gambar di atas input
const inputRute = document.getElementById('inputRute');
const img = document.createElement('img');
img.src = dataURL;
img.style.maxWidth = '100%';
img.style.maxHeight = '200px';
inputRute.parentNode.insertBefore(img, inputRute);
// Isi input dengan data URL gambar
inputRute.value = dataURL;
});
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.1/html2canvas.min.js"></script>
<script>
// Fungsi untuk mengambil lokasi pengguna
function getUserLocation() {

View File

@@ -1,5 +1,5 @@
<div class=""max-w-4xl mx-auto bg-white rounded-lg shadow-md overflow-hidden">
<div class="bg-blue-600 text-white py-4 px-6">
<div class="py-4 px-6">
<h1 class="text-md font-medium text-gray-900">Analisa Tanah</h1>
</div>
<div class="grid gap-5">

View File

@@ -1,8 +1,8 @@
@extends('layouts.main')
{{-- @section('breadcrumbs')
@section('breadcrumbs')
{{ Breadcrumbs::render(request()->route()->getName()) }}
@endsection --}}
@endsection
@section('content')
<div class="w-full grid gap-5 lg:gap-7.5 mx-auto">
@@ -33,7 +33,7 @@
</label>
<div class="flex flex-wrap items-baseline w-full">
<input class="input @error('code') border-danger bg-danger-light @enderror" type="text"
name="code" value="{{ $model->code ?? '' }}" >
name="code" value="{{ $model->code ?? '' }}">
@error('code')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
@@ -51,6 +51,41 @@
@enderror
</div>
</div>
@if (isset($header[1]) && $header[1] == 'spek-bangunan')
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">
Kategori
</label>
<div class="flex flex-wrap items-baseline w-full">
<select
class="input tomselect w-full @error('spek_kategori_bangunan_id') border-danger bg-danger-light @enderror"
name="spek_kategori_bangunan_id">
<option value="">Select Kategori Bangunan</option>
@if (isset($spekKategoriBagunan))
@foreach ($spekKategoriBagunan as $item)
@if (isset($model->spek_kategori_bangunan_id))
<option value="{{ $model->spek_kategori_bangunan_id }}"
{{ $model->spek_kategori_bangunan_id == $item->id ? 'selected' : '' }}>
{{ $item->name }}
</option>
@else
<option value="{{ $item->id }}"
{{ old('spek_kategori_bangunan_id') == $item->id ? 'selected' : '' }}>
{{ $item->name }}
</option>
@endif
@endforeach
@endif
</select>
@error('spek_kategori_bangunan_id')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
</div>
@endif
<div class="flex justify-end">
<button type="submit" class="btn btn-primary">
Save

View File

@@ -1,8 +1,8 @@
@extends('layouts.main')
{{-- @section('breadcrumbs')
{{ Breadcrumbs::render('surveyor.bentuk-tanah') }}
@endsection --}}
@section('breadcrumbs')
{{ Breadcrumbs::render('basicdata.' . $header[1]) }}
@endsection
@section('content')
<div class="grid">

View File

@@ -8,6 +8,7 @@
@push('styles')
<style>
.modal {
width: 50%;
display: flex;
justify-content: center;