refactor: Adjust the Add button to display only on the Location tab
parent
7fb32bf4cc
commit
7a104907df
|
|
@ -16,11 +16,11 @@
|
|||
<h3 class="mb-2">Profil Rw</h3>
|
||||
</div>
|
||||
<div class="justify-self-end lg:self-center">
|
||||
<label for="modal-tambah"
|
||||
class="btn rounded-full bg-green-600 hover:bg-green-700 text-white border-0 shadow-sm transition duration-200">
|
||||
<span class="icon icon-fill me-2">add</span>
|
||||
Tambah
|
||||
</label>
|
||||
<label id="btn-tambah" for="modal-tambah"
|
||||
class="btn rounded-full bg-green-600 hover:bg-green-700 text-white border-0 shadow-sm transition duration-200">
|
||||
<span class="icon icon-fill me-2">add</span>
|
||||
Tambah
|
||||
</label>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -192,4 +192,22 @@
|
|||
console.log('Detail clicked for ID:', id);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
// Toggle "Tambah" button visibility based on active tab
|
||||
const toggleTambahButton = () => {
|
||||
const active = $('input[name="tab_profil_rw"]:checked').attr('aria-label');
|
||||
if (active === "Lokasi TP3SR & Parkir Pengumpulan Sampah") {
|
||||
$('#btn-tambah').show();
|
||||
} else {
|
||||
$('#btn-tambah').hide();
|
||||
}
|
||||
};
|
||||
|
||||
// initial check
|
||||
toggleTambahButton();
|
||||
|
||||
// bind change event
|
||||
$('input[name="tab_profil_rw"]').on('change', toggleTambahButton);
|
||||
|
||||
</script>
|
||||
|
|
|
|||
Loading…
Reference in New Issue