feat(ReduksiSampahSatpel) : add modal form
parent
e3107f948b
commit
6d448d3abf
|
|
@ -18,34 +18,115 @@
|
|||
<option>2021</option>
|
||||
<option>2020</option>
|
||||
</select>
|
||||
<button type="button" class="btn btn-sm bg-bank-sampah-primary-500 rounded-full text-white"><i class="ph ph-plus"></i>Tambah</button>
|
||||
<button type="button" class="btn btn-sm bg-bank-sampah-primary-500 rounded-full text-white" onclick="modal_tambah.showModal()"><i class="ph ph-plus"></i>Tambah</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Modal Filter -->
|
||||
<dialog id="modal_filter" class="modal modal-bottom sm:modal-middle">
|
||||
<div class="modal-box w-full sm:max-w-sm">
|
||||
<h3 class="text-lg font-bold">Filter</h3>
|
||||
<form id="formFilter" onsubmit="applyFilter(event)">
|
||||
<!-- Modal Tambah/Edit Data -->
|
||||
<dialog id="modal_tambah" class="modal modal-bottom sm:modal-middle">
|
||||
<div class="modal-box w-full max-w-2xl p-6 bg-white rounded-2xl">
|
||||
<h3 id="modal_title" class="text-gray-900 text-xl font-semibold font-['Plus_Jakarta_Sans'] leading-8 mb-8">Tambah Reduksi Sampah</h3>
|
||||
<form id="formTambah" onsubmit="submitForm(event)">
|
||||
<input type="hidden" id="edit_mode" value="false">
|
||||
<div class="flex flex-col gap-6">
|
||||
<!-- Fiel Jenis Lokasi -->
|
||||
<div class="flex flex-col">
|
||||
<fieldset class="fieldset">
|
||||
<legend class="fieldset-legend">Periiode Bulan</legend>
|
||||
<input type="date" id="periode_bulan" class="input w-full" />
|
||||
</fieldset>
|
||||
<fieldset class="fieldset">
|
||||
<legend class="fieldset-legend">Kecamatan</legend>
|
||||
<select id="filterKecamatan" class="select w-full">
|
||||
<option value="">Pilih salah satu</option>
|
||||
<legend class="fieldset-legend">
|
||||
Jenis Lokasi
|
||||
<span class="text-red-500">*</span>
|
||||
</legend>
|
||||
<select id="jenis_lokasi" class="select w-full" required>
|
||||
<option value="" disabled selected>Pilih salah satu</option>
|
||||
<option>Komposting</option>
|
||||
<option>Maggot</option>
|
||||
</select>
|
||||
</fieldset>
|
||||
</div>
|
||||
<div id="formDetail" class="hidden flex flex-col gap-6">
|
||||
<!-- Field Lokasi -->
|
||||
<div class="flex flex-col">
|
||||
<fieldset class="fieldset">
|
||||
<legend class="fieldset-legend">
|
||||
Lokasi<span class="text-red-500">*</span>
|
||||
</legend>
|
||||
<select id="lokasi" class="select w-full" required>
|
||||
<option value="" disabled selected>Pilih salah satu</option>
|
||||
</select>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<div class="modal-action">
|
||||
<button type="button" class="btn btn-outline rounded-full" onclick="modal_filter.close()">Tutup</button>
|
||||
<button type="submit" class="btn bg-bank-sampah-primary-500 rounded-full text-white">Terapkan</button>
|
||||
<!-- Field alamat -->
|
||||
<div class="flex flex-col">
|
||||
<fieldset class="fieldset">
|
||||
<legend class="fieldset-legend">
|
||||
Alamat
|
||||
</legend>
|
||||
<textarea id="alamat" rows="4" readonly class="textarea textarea-bordered w-full"></textarea>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<!-- Field Bukti Kegiatan -->
|
||||
<div class="flex flex-col">
|
||||
<fieldset class="fieldset">
|
||||
<legend class="fieldset-legend">
|
||||
Bukti Kegiatan
|
||||
<span class="text-red-500">*</span>
|
||||
</legend>
|
||||
<input type="file" class="file-input w-full" />
|
||||
<label class="label">Ukuran Maksimal 5MB</label>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<!-- Field Keterangan -->
|
||||
<div class="flex flex-col">
|
||||
<fieldset class="fieldset">
|
||||
<legend class="fieldset-legend">
|
||||
Keterangan Kegiatan<span class="text-red-500">*</span>
|
||||
</legend>
|
||||
<textarea id="keterangan_kegiatan" rows="4" readonly class="textarea textarea-bordered w-full"></textarea>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<!-- Field Tanggal Pelaksanaan Kegiatan -->
|
||||
<div class="flex flex-col">
|
||||
<fieldset class="fieldset">
|
||||
<legend class="fieldset-legend">
|
||||
Tanggal Pelaksanaan Kegiatan
|
||||
<span class="text-red-500">*</span>
|
||||
</legend>
|
||||
<input type="date" id="tgl_pelaksanaan_kegiatan" class="input w-full" required />
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<!-- Pelaksana kegiatan -->
|
||||
<div class="flex flex-col">
|
||||
<fieldset class="fieldset">
|
||||
<legend class="fieldset-legend">
|
||||
Pelaksana Kegiatan<span class="text-red-500">*</span>
|
||||
</legend>
|
||||
<input type="text" id="preview" class="input w-full" placeholder="Preview Text Artikel" required />
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Buttons -->
|
||||
<div class="flex flex-col sm:flex-row gap-3 justify-end">
|
||||
<button type="button" class="px-8 py-2.5 bg-white rounded-full outline outline-1 -outline-offset-1 outline-gray-300 text-slate-800 text-base font-semibold font-['Plus_Jakarta_Sans'] leading-6 hover:bg-gray-50 w-full sm:w-auto" onclick="closeModal()">
|
||||
Batal
|
||||
</button>
|
||||
<button type="submit" class="px-8 py-2.5 bg-green-800 rounded-full text-white text-base font-semibold font-['Plus_Jakarta_Sans'] leading-6 hover:bg-green-900 w-full sm:w-auto">
|
||||
Simpan
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<form method="dialog" class="modal-backdrop">
|
||||
<button>close</button>
|
||||
</form>
|
||||
</dialog>
|
||||
<!-- /modal filter -->
|
||||
<!-- /modal tambah/edit -->
|
||||
|
||||
<div class="h-6"></div>
|
||||
|
||||
|
|
@ -93,6 +174,28 @@
|
|||
{ data: 'gambar' },
|
||||
]
|
||||
});
|
||||
|
||||
$('#jenis_lokasi').on('change', function() {
|
||||
const jenisLokasi = $(this).val();
|
||||
|
||||
if (jenisLokasi) {
|
||||
$('#formDetail').removeClass('hidden').hide().fadeIn(300);
|
||||
populateLokasiDropdown(jenisLokasi);
|
||||
resetForm();
|
||||
} else {
|
||||
$('#formDetail').fadeOut(300);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function closeModal() {
|
||||
// Reset form
|
||||
$('#formTambah')[0].reset();
|
||||
$('#edit_mode').val('false');
|
||||
$('#modal_title').text('Tambah Reduksi Sampah');
|
||||
|
||||
// Close modal
|
||||
modal_tambah.close();
|
||||
}
|
||||
</script>
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue