update foto lantai

This commit is contained in:
majid
2024-12-27 16:52:02 +07:00
parent 78184094f6
commit 2005f546c5
4 changed files with 126 additions and 124 deletions

View File

@@ -372,97 +372,96 @@
@endforeach
@if (isset($formFoto['foto_lantai_unit']))
<div class="flex flex-wrap gap-4 w-full">
<div class="w-full">
<div class="text-white py-4 flex items-center justify-between w-full">
<label class="form-label">
<span class="form-label">Lantai</span>
</label>
<button type="button" id="btnAddLantai" class="btn btn-primary btn-sm">
<i class="ki-filled ki-plus text-lg"></i> Tambah Lantai
</button>
</div>
<div class="flex flex-wrap gap-4 w-full">
<div class="w-full">
<div class="text-white py-4 flex items-center justify-between w-full">
<label class="form-label">
<span class="form-label">Lantai</span>
</label>
<button type="button" id="btnAddLantai" class="btn btn-primary btn-sm">
<i class="ki-filled ki-plus text-lg"></i> Tambah Lantai
</button>
</div>
<div id="lantaiContainer" class="w-full">
@foreach ($formFoto['foto_lantai_unit'] as $lantaiKey => $lantaiFotos)
<div class="lantai-item w-full mb-4">
<div class="flex w-full items-center justify-between">
<label class="form-label">Lantai {{ $lantaiKey }}</label>
<button type="button" class="btn btn-danger btn-sm btnRemoveLantai"
style="{{ $lantaiKey == 1 ? 'display: none;' : '' }}">
Hapus
</button>
</div>
<div class="dropzone w-full border-2 border-dashed border-gray-400 rounded-lg p-4 mt-2"
ondrop="handleDrop(event)" ondragover="allowDrop(event)">
<div class="preview-container grid grid-cols-2 md:grid-cols-4 gap-4">
@foreach ($lantaiFotos as $foto)
<div class="preview-item relative">
<img src="{{ asset('storage/' . $foto['path']) }}"
alt="{{ $foto['name'] }}"
class="w-full h-40 object-cover rounded-lg">
<button type="button"
class="absolute top-2 right-2 btn btn-sm btn-danger btn-icon btnRemoveFoto"
data-path="{{ $foto['path'] }}">
<i class="ki-solid ki-cross"></i>
</button>
</div>
@endforeach
<div id="lantaiContainer" class="w-full">
@foreach ($formFoto['foto_lantai_unit'] as $lantaiKey => $lantaiFotos)
<div class="lantai-item w-full mb-4">
<div class="flex w-full items-center justify-between">
<label class="form-label">Lantai {{ $lantaiKey }}</label>
<button type="button" class="btn btn-danger btn-sm btnRemoveLantai"
style="{{ $lantaiKey == 1 ? 'display: none;' : '' }}">
Hapus
</button>
</div>
<div class="dropzone w-full border-2 border-dashed border-gray-400 rounded-lg p-4 mt-2"
ondrop="handleDrop(event)" ondragover="allowDrop(event)">
<div class="preview-container grid grid-cols-2 md:grid-cols-4 gap-4">
@foreach ($lantaiFotos as $foto)
@if (is_array($foto) && isset($foto['path']) && isset($foto['name']))
<div class="preview-item relative">
<img src="{{ asset('storage/' . $foto['path']) }}"
alt="{{ $foto['name'] }}"
class="w-full h-40 object-cover rounded-lg">
<button type="button"
class="absolute top-2 right-2 btn btn-sm btn-danger btn-icon btnRemoveFoto"
data-path="{{ $foto['path'] }}">
<i class="ki-solid ki-cross"></i>
</button>
</div>
@else
<p>Invalid photo data.</p>
@endif
@endforeach
</div>
<input type="file" name="foto_lantai_unit[{{ $lantaiKey }}][]"
class="file-input hidden" multiple accept="image/*"
onchange="handleFileInput(this)" data-lantai="{{ $lantaiKey }}">
<button type="button" class="btn btn-light btn-sm btnUploadFiles mt-2">
<i class="ki-outline ki-upload"></i> Unggah Gambar
</button>
</div>
</div>
@endforeach
</div>
</div>
<input type="file"
name="foto_lantai_unit[{{ $lantaiKey }}][]"
class="file-input hidden"
multiple
accept="image/*"
onchange="handleFileInput(this)"
data-lantai="{{ $lantaiKey }}">
<button type="button" class="btn btn-light btn-sm btnUploadFiles mt-2">
<i class="ki-outline ki-upload"></i> Unggah Gambar
</button>
</div>
</div>
@endforeach
</div>
</div>
</div>
@else
@else
<div class="flex flex-wrap gap-4 w-full">
<div class="w-full">
<div class="text-white py-4 flex items-center justify-between w-full">
<label class="form-label">
<span class="form-label">Lantai</span>
</label>
<button type="button" id="btnAddLantai" class="btn btn-primary btn-sm">
<i class="ki-filled ki-plus text-lg"></i> Tambah Lantai
</button>
</div>
<div class="flex flex-wrap gap-4 w-full">
<div class="w-full">
<div class="text-white py-4 flex items-center justify-between w-full">
<label class="form-label">
<span class="form-label">Lantai</span>
</label>
<button type="button" id="btnAddLantai" class="btn btn-primary btn-sm">
<i class="ki-filled ki-plus text-lg"></i> Tambah Lantai
</button>
</div>
<div id="lantaiContainer" class="w-full">
<!-- Template Lantai -->
<div class="lantai-item w-full mb-4">
<div class="flex w-full items-center justify-between">
<label class="form-label">Lantai 1</label>
<button type="button" class="btn btn-danger btn-sm btnRemoveLantai"
style="display: none;">
Hapus
</button>
</div>
<div class="dropzone w-full border-2 border-dashed border-gray-400 rounded-lg p-4 mt-2"
ondrop="handleDrop(event)" ondragover="allowDrop(event)">
<div class="preview-container grid grid-cols-2 md:grid-cols-4 gap-4"></div>
<input type="file" name="foto_lantai_unit[1][]" class="file-input hidden"
multiple accept="image/*" onchange="handleFileInput(this)" data-lantai="1">
<button type="button" class="btn btn-light btn-sm btnUploadFiles mt-2">
<i class="ki-outline ki-upload"></i> Unggah Gambar
</button>
<div id="lantaiContainer" class="w-full">
<!-- Template Lantai -->
<div class="lantai-item w-full mb-4">
<div class="flex w-full items-center justify-between">
<label class="form-label">Lantai 1</label>
<button type="button" class="btn btn-danger btn-sm btnRemoveLantai"
style="display: none;">
Hapus
</button>
</div>
<div class="dropzone w-full border-2 border-dashed border-gray-400 rounded-lg p-4 mt-2"
ondrop="handleDrop(event)" ondragover="allowDrop(event)">
<div class="preview-container grid grid-cols-2 md:grid-cols-4 gap-4"></div>
<input type="file" name="foto_lantai_unit[1][]" class="file-input hidden"
multiple accept="image/*" onchange="handleFileInput(this)"
data-lantai="1">
<button type="button" class="btn btn-light btn-sm btnUploadFiles mt-2">
<i class="ki-outline ki-upload"></i> Unggah Gambar
</button>
</div>
</div>
</div>
</div>
</div>
</div>
@endif
@endif
</div>
</div>
@@ -602,8 +601,7 @@
@include('lpj::surveyor.js.utils')
@push('scripts')
<script>
console.log('@json($formFoto)');
// console.log('@json($formFoto)');
document.addEventListener("DOMContentLoaded", () => {
const lantaiContainer = document.getElementById("lantaiContainer");
@@ -783,7 +781,7 @@
}
});
console.log(formData.value);
@@ -810,7 +808,7 @@
window.location.href =
'{{ route('surveyor.show', ['id' => $permohonan->id]) }}';
}
// console.log(response);
console.log(response);
});
} else {