238 lines
8.2 KiB
Plaintext
238 lines
8.2 KiB
Plaintext
@{
|
||
ViewData["Title"] = "Input Checklist Rumah";
|
||
}
|
||
|
||
<div class="flex items-center gap-2 text-sm mb-6">
|
||
<span class="text-gray-600">Checklist Harian</span>
|
||
<span class="text-gray-400">›</span>
|
||
<span class="font-medium">Input</span>
|
||
</div>
|
||
|
||
<div class="flex justify-between items-center mb-6">
|
||
<h2 class="text-2xl font-semibold">Input Checklist Rumah</h2>
|
||
<button id="BtnSimpanInput" class="btn btn-primary rounded-full text-white">
|
||
<span class="icon me-1">save</span>
|
||
Simpan
|
||
</button>
|
||
</div>
|
||
|
||
<div class="flex flex-wrap items-center gap-6 mb-6">
|
||
<div class="flex items-center gap-3">
|
||
<label class="text-sm font-medium text-gray-700">Tanggal :</label>
|
||
<input type="date" class="input input-bordered rounded-lg px-4 py-2" id="tanggalInput" style="width: 180px;" />
|
||
</div>
|
||
<div class="flex items-center gap-3">
|
||
<label class="text-sm font-medium text-gray-700">RW :</label>
|
||
<select class="select select-bordered rounded-lg px-4 py-2" id="rwInput" style="width: 120px;">
|
||
<option value="">Pilih RW</option>
|
||
@for (int i = 1; i <= 10; i++)
|
||
{
|
||
<option>@i.ToString("D2")</option>
|
||
}
|
||
</select>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="card bg-white shadow-sm rounded-xl">
|
||
<div class="card-body p-0">
|
||
<table class="table w-full" id="inputChecklistTable">
|
||
<thead class="bg-gray-50">
|
||
<tr>
|
||
<th class="text-left">No</th>
|
||
<th class="text-left">Alamat Rumah</th>
|
||
<th class="text-left">RW</th>
|
||
<th class="text-center">Mudah Terurai</th>
|
||
<th class="text-center">Material Daur</th>
|
||
<th class="text-center">B3</th>
|
||
<th class="text-center">Residu</th>
|
||
<th class="text-center">Photo</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody></tbody>
|
||
</table>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Upload Modal -->
|
||
<dialog id="modalUpload" class="modal modal-bottom sm:modal-middle">
|
||
<div class="modal-box w-full sm:max-w-md">
|
||
|
||
<div class="flex items-start justify-between">
|
||
<div>
|
||
<h3 class="text-lg font-semibold">Upload Kegiatan</h3>
|
||
<p class="text-sm text-gray-500">Unggah foto dokumentasi kegiatan harian.</p>
|
||
</div>
|
||
|
||
<form method="dialog">
|
||
<button type="submit" class="btn btn-sm btn-circle btn-ghost">✕</button>
|
||
</form>
|
||
</div>
|
||
|
||
<div class="mt-6">
|
||
<div class="flex justify-center mb-6">
|
||
<img src="/images/clean.png" class="w-52" />
|
||
</div>
|
||
|
||
<fieldset class="fieldset w-full">
|
||
<input type="file" id="fileDokumentasi" class="file-input w-full" accept="image/*" />
|
||
<span class="text-xs text-gray-500 mt-1 block">
|
||
Ukuran foto maksimal 600KB
|
||
</span>
|
||
</fieldset>
|
||
</div>
|
||
|
||
<div class="modal-action">
|
||
<button type="button" class="btn rounded-full" onclick="modalUpload.close()">
|
||
<span class="icon me-1">close</span>
|
||
Batal
|
||
</button>
|
||
|
||
<button id="BtnSimpanKegiatan" class="btn btn-primary rounded-full text-white">
|
||
<span class="icon me-1">save</span>
|
||
Simpan
|
||
</button>
|
||
</div>
|
||
|
||
</div>
|
||
</dialog>
|
||
|
||
|
||
<script src="/lib/jquery/jquery-3.7.1.js"></script>
|
||
<script src="/lib/datatables/dataTables.js"></script>
|
||
<script src="/plugins/datatables/dataTables.tailwindcss.js"></script>
|
||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
||
|
||
<script type="text/javascript">
|
||
$(document).ready(function () {
|
||
let table = new DataTable('#inputChecklistTable', {
|
||
ajax: '@Url.Action("InputTable","ChecklistHarian")',
|
||
scrollX: true,
|
||
autoWidth: false,
|
||
pageLength: 10,
|
||
initComplete: function () {
|
||
$('div.dt-scroll-body thead').css('visibility', 'collapse');
|
||
},
|
||
columns: [
|
||
{
|
||
data: 'no',
|
||
className: '!align-middle'
|
||
},
|
||
{
|
||
data: 'alamat_rumah',
|
||
className: '!align-middle'
|
||
},
|
||
{
|
||
data: 'rw',
|
||
className: '!align-middle'
|
||
},
|
||
{
|
||
data: null,
|
||
className: '!align-middle !text-center',
|
||
render: () => `<input type="checkbox" class="chk-field checkbox checkbox-success checked:text-white" />`
|
||
},
|
||
{
|
||
data: null,
|
||
className: '!align-middle !text-center',
|
||
render: () => `<input type="checkbox" class="chk-field checkbox checkbox-success checked:text-white" />`
|
||
},
|
||
{
|
||
data: null,
|
||
className: '!align-middle !text-center',
|
||
render: () => `<input type="checkbox" class="chk-field checkbox checkbox-success checked:text-white" />`
|
||
},
|
||
{
|
||
data: null,
|
||
className: '!align-middle !text-center',
|
||
render: () => `<input type="checkbox" class="chk-field checkbox checkbox-success checked:text-white" />`
|
||
},
|
||
{
|
||
data: null,
|
||
className: '!align-middle !text-center',
|
||
render: () => `
|
||
<button class="btn btn-sm rounded-full btn-upload bg-gray-200 text-gray-500" disabled>
|
||
Upload
|
||
</button>`
|
||
}
|
||
]
|
||
});
|
||
|
||
$(document).on("change", ".chk-field", function () {
|
||
const row = $(this).closest("tr");
|
||
const checked = row.find(".chk-field:checked").length > 0;
|
||
const btn = row.find(".btn-upload");
|
||
|
||
if (checked) {
|
||
btn.prop("disabled", false)
|
||
.removeClass("bg-gray-200 text-gray-500")
|
||
.addClass("bg-white text-gray-700");
|
||
} else {
|
||
btn.prop("disabled", true)
|
||
.removeClass("bg-white text-gray-700")
|
||
.addClass("bg-gray-200 text-gray-500");
|
||
}
|
||
});
|
||
|
||
$(document).on("click", ".btn-upload", function () {
|
||
if (!$(this).prop("disabled")) {
|
||
modalUpload.showModal();
|
||
}
|
||
});
|
||
|
||
$('#BtnSimpanInput').on('click', function (e) {
|
||
e.preventDefault();
|
||
|
||
Swal.fire({
|
||
title: 'Simpan Input Checklist Rumah?',
|
||
text: "Pastikan Input Sudah Benar.",
|
||
icon: 'question',
|
||
showCancelButton: true,
|
||
confirmButtonColor: '#22c55e',
|
||
cancelButtonColor: '#6b7280',
|
||
confirmButtonText: 'Simpan',
|
||
cancelButtonText: 'Batal'
|
||
}).then((result) => {
|
||
if (result.isConfirmed) {
|
||
Swal.fire({
|
||
title: 'Berhasil!',
|
||
text: 'Input Checklist Rumah Berhasil Disimpan.',
|
||
icon: 'success',
|
||
confirmButtonText: 'OK',
|
||
confirmButtonColor: '#22c55e'
|
||
}).then(() => {
|
||
window.location.href = '@Url.Action("Index", "ChecklistHarian")';
|
||
});
|
||
}
|
||
});
|
||
});
|
||
|
||
$('#BtnSimpanKegiatan').on('click', function (e) {
|
||
e.preventDefault();
|
||
|
||
modalUpload.close();
|
||
|
||
Swal.fire({
|
||
title: 'Upload Foto Kegiatan?',
|
||
text: "Pastikan foto sudah sesuai.",
|
||
icon: 'question',
|
||
showCancelButton: true,
|
||
confirmButtonColor: '#22c55e',
|
||
cancelButtonColor: '#6b7280',
|
||
confirmButtonText: 'Upload',
|
||
cancelButtonText: 'Batal'
|
||
}).then((result) => {
|
||
if (result.isConfirmed) {
|
||
Swal.fire({
|
||
title: 'Berhasil!',
|
||
text: 'Foto kegiatan berhasil diupload.',
|
||
icon: 'success',
|
||
confirmButtonText: 'OK',
|
||
confirmButtonColor: '#22c55e'
|
||
});
|
||
document.getElementById('fileDokumentasi').value = '';
|
||
} else {
|
||
modalUpload.showModal();
|
||
}
|
||
});
|
||
});
|
||
});
|
||
</script> |