feat: create an alert on each action button
parent
d09e50b798
commit
10d905fe2f
|
|
@ -130,10 +130,11 @@
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="https://code.jquery.com/jquery-3.7.1.js"></script>
|
<script src="https://code.jquery.com/jquery-3.7.1.js"></script>
|
||||||
<script src="https://cdn.datatables.net/2.3.4/js/dataTables.js"></script>
|
<script src="https://cdn.datatables.net/2.3.4/js/dataTables.js"></script>
|
||||||
<script src="/plugins/datatables/dataTables.tailwindcss.js"></script>
|
<script src="/plugins/datatables/dataTables.tailwindcss.js"></script>
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var table;
|
var table;
|
||||||
|
|
||||||
|
|
@ -182,16 +183,6 @@
|
||||||
modalCreateElement?.showModal();
|
modalCreateElement?.showModal();
|
||||||
});
|
});
|
||||||
|
|
||||||
formCreateRumah?.addEventListener('submit', (event) => {
|
|
||||||
event.preventDefault();
|
|
||||||
modalCreateElement?.close();
|
|
||||||
});
|
|
||||||
|
|
||||||
formEditRumah?.addEventListener('submit', (event) => {
|
|
||||||
event.preventDefault();
|
|
||||||
modalEditElement?.close();
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#example').on('click', '.btn-edit-rumah', function () {
|
$('#example').on('click', '.btn-edit-rumah', function () {
|
||||||
const rowData = table.row($(this).closest('tr')).data();
|
const rowData = table.row($(this).closest('tr')).data();
|
||||||
|
|
||||||
|
|
@ -205,5 +196,65 @@
|
||||||
|
|
||||||
modalEditElement?.showModal();
|
modalEditElement?.showModal();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Success Alert on Create
|
||||||
|
$('#form-create-rumah').on('submit', function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
modalCreateElement.close();
|
||||||
|
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Simpan Data Rumah?',
|
||||||
|
text: "Pastikan semua data sudah benar.",
|
||||||
|
icon: 'question',
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonColor: '#22c55e',
|
||||||
|
cancelButtonColor: '#6b7280',
|
||||||
|
confirmButtonText: 'Ya, Simpan',
|
||||||
|
cancelButtonText: 'Batal'
|
||||||
|
}).then((result) => {
|
||||||
|
if (result.isConfirmed) {
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Berhasil!',
|
||||||
|
text: 'Data rumah berhasil ditambahkan.',
|
||||||
|
icon: 'success',
|
||||||
|
confirmButtonText: 'OK',
|
||||||
|
confirmButtonColor: '#22c55e'
|
||||||
|
}).then(() => {
|
||||||
|
document.getElementById("form-create-rumah").submit();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Success Alert on Edit
|
||||||
|
$('#form-edit-rumah').on('submit', function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
modalEditElement.close();
|
||||||
|
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Perbarui Data Rumah?',
|
||||||
|
text: "Perubahan akan disimpan.",
|
||||||
|
icon: 'question',
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonColor: '#22c55e',
|
||||||
|
cancelButtonColor: '#6b7280',
|
||||||
|
confirmButtonText: 'Ya, Simpan',
|
||||||
|
cancelButtonText: 'Batal'
|
||||||
|
}).then((result) => {
|
||||||
|
if (result.isConfirmed) {
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Berhasil!',
|
||||||
|
text: 'Data rumah berhasil diperbarui.',
|
||||||
|
icon: 'success',
|
||||||
|
confirmButtonText: 'OK',
|
||||||
|
confirmButtonColor: '#22c55e'
|
||||||
|
}).then(() => {
|
||||||
|
document.getElementById("form-edit-rumah").submit();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
@ -111,7 +111,9 @@
|
||||||
<a href="@Url.Action("Index", "LaporanRwRw")" class="btn rounded-full">
|
<a href="@Url.Action("Index", "LaporanRwRw")" class="btn rounded-full">
|
||||||
Batalkan
|
Batalkan
|
||||||
</a>
|
</a>
|
||||||
<button type="submit"
|
<button
|
||||||
|
id="btnSimpanLaporan"
|
||||||
|
type="submit"
|
||||||
class="btn btn-success rounded-full text-white border-none">
|
class="btn btn-success rounded-full text-white border-none">
|
||||||
Simpan
|
Simpan
|
||||||
</button>
|
</button>
|
||||||
|
|
@ -119,3 +121,34 @@
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<script src="https://code.jquery.com/jquery-3.7.1.js"></script>
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(document).ready(function () {
|
||||||
|
$('#btnSimpanLaporan').on('click', function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Simpan Profil RW?',
|
||||||
|
text: "Pastikan semua data sudah benar.",
|
||||||
|
icon: 'question',
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonColor: '#22c55e',
|
||||||
|
cancelButtonColor: '#6b7280',
|
||||||
|
confirmButtonText: 'Ya, Simpan',
|
||||||
|
cancelButtonText: 'Batal'
|
||||||
|
}).then((result) => {
|
||||||
|
if (result.isConfirmed) {
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Berhasil!',
|
||||||
|
text: 'Profil RW berhasil disimpan.',
|
||||||
|
icon: 'success',
|
||||||
|
confirmButtonText: 'OK',
|
||||||
|
confirmButtonColor: '#22c55e'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -154,6 +154,8 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@section Scripts {
|
@section Scripts {
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
(() => {
|
(() => {
|
||||||
const listEl = document.getElementById('sarprasFormList');
|
const listEl = document.getElementById('sarprasFormList');
|
||||||
|
|
@ -206,6 +208,35 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
updateIndexes();
|
updateIndexes();
|
||||||
|
|
||||||
|
// Success Alert
|
||||||
|
const form = document.querySelector("form");
|
||||||
|
|
||||||
|
form.addEventListener("submit", function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Simpan Kebutuhan Sarpras?',
|
||||||
|
text: "Pastikan semua data sudah benar.",
|
||||||
|
icon: 'question',
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonColor: '#22c55e',
|
||||||
|
cancelButtonColor: '#6b7280',
|
||||||
|
confirmButtonText: 'Ya, Simpan',
|
||||||
|
cancelButtonText: 'Batal'
|
||||||
|
}).then((result) => {
|
||||||
|
if (result.isConfirmed) {
|
||||||
|
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Berhasil!',
|
||||||
|
text: 'Kebutuhan Sarpras berhasil disimpan.',
|
||||||
|
icon: 'success',
|
||||||
|
confirmButtonText: 'OK',
|
||||||
|
confirmButtonColor: '#22c55e'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
})();
|
})();
|
||||||
</script>
|
</script>
|
||||||
}
|
}
|
||||||
|
|
@ -80,9 +80,37 @@
|
||||||
|
|
||||||
<!-- Submit Button -->
|
<!-- Submit Button -->
|
||||||
<div class="flex justify-end mt-10">
|
<div class="flex justify-end mt-10">
|
||||||
<button type="submit" class="btn btn-success text-white rounded-full px-16">
|
<button id="btnSimpanBpsRw" type="submit" class="btn btn-success text-white rounded-full px-16">
|
||||||
Simpan
|
Simpan
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(document).ready(function () {
|
||||||
|
$('#btnSimpanBpsRw').on('click', function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Simpan BPS-RW?',
|
||||||
|
text: "Pastikan semua data sudah benar.",
|
||||||
|
icon: 'question',
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonColor: '#22c55e',
|
||||||
|
cancelButtonColor: '#6b7280',
|
||||||
|
confirmButtonText: 'Ya, Simpan',
|
||||||
|
cancelButtonText: 'Batal'
|
||||||
|
}).then((result) => {
|
||||||
|
if (result.isConfirmed) {
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Berhasil!',
|
||||||
|
text: 'Data BPS-RW berhasil disimpan.',
|
||||||
|
icon: 'success',
|
||||||
|
confirmButtonText: 'OK',
|
||||||
|
confirmButtonColor: '#22c55e'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
@ -102,7 +102,7 @@
|
||||||
<span class="icon me-1">cancel</span>
|
<span class="icon me-1">cancel</span>
|
||||||
Batalkan
|
Batalkan
|
||||||
</button>
|
</button>
|
||||||
<button type="submit" class="btn btn-primary btn-sm text-white">
|
<button id="btnSimpanLokasi" type="submit" class="btn btn-primary btn-sm text-white">
|
||||||
<span class="icon me-1">save</span>
|
<span class="icon me-1">save</span>
|
||||||
Simpan
|
Simpan
|
||||||
</button>
|
</button>
|
||||||
|
|
@ -110,3 +110,38 @@
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</dialog>
|
</dialog>
|
||||||
|
|
||||||
|
<script src="https://code.jquery.com/jquery-3.7.1.js"></script>
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(document).ready(function () {
|
||||||
|
$('#btnSimpanLokasi').on('click', function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
modal_add_lokasi.close();
|
||||||
|
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Simpan Lokasi?',
|
||||||
|
text: "Pastikan semua data sudah benar.",
|
||||||
|
icon: 'question',
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonColor: '#22c55e',
|
||||||
|
cancelButtonColor: '#6b7280',
|
||||||
|
confirmButtonText: 'Ya, Simpan',
|
||||||
|
cancelButtonText: 'Batal'
|
||||||
|
}).then((result) => {
|
||||||
|
|
||||||
|
if (result.isConfirmed) {
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Berhasil!',
|
||||||
|
text: 'Lokasi berhasil disimpan.',
|
||||||
|
icon: 'success',
|
||||||
|
confirmButtonText: 'OK',
|
||||||
|
confirmButtonColor: '#22c55e'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -91,9 +91,40 @@
|
||||||
|
|
||||||
<!-- Submit Button -->
|
<!-- Submit Button -->
|
||||||
<div class="flex justify-end mt-10">
|
<div class="flex justify-end mt-10">
|
||||||
<button type="submit" class="btn btn-primary text-white rounded-full px-16">
|
<button id="btnSimpanProfil" type="submit" class="btn btn-primary text-white rounded-full px-16">
|
||||||
Simpan
|
Simpan
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<script src="https://code.jquery.com/jquery-3.7.1.js"></script>
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(document).ready(function () {
|
||||||
|
$('#btnSimpanProfil').on('click', function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Simpan Profil RW?',
|
||||||
|
text: "Pastikan semua data sudah benar.",
|
||||||
|
icon: 'question',
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonColor: '#22c55e',
|
||||||
|
cancelButtonColor: '#6b7280',
|
||||||
|
confirmButtonText: 'Ya, Simpan',
|
||||||
|
cancelButtonText: 'Batal'
|
||||||
|
}).then((result) => {
|
||||||
|
if (result.isConfirmed) {
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Berhasil!',
|
||||||
|
text: 'Profil RW berhasil disimpan.',
|
||||||
|
icon: 'success',
|
||||||
|
confirmButtonText: 'OK',
|
||||||
|
confirmButtonColor: '#22c55e'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
@ -69,7 +69,7 @@
|
||||||
<span class="icon me-1">cancel</span>
|
<span class="icon me-1">cancel</span>
|
||||||
Batalkan
|
Batalkan
|
||||||
</button>
|
</button>
|
||||||
<button type="submit" class="btn btn-primary btn-sm text-white">
|
<button id="btnSimpanSuratUsulan" type="submit" class="btn btn-primary btn-sm text-white">
|
||||||
<span class="icon me-1">save</span>
|
<span class="icon me-1">save</span>
|
||||||
Simpan
|
Simpan
|
||||||
</button>
|
</button>
|
||||||
|
|
@ -77,3 +77,38 @@
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</dialog>
|
</dialog>
|
||||||
|
|
||||||
|
<script src="https://code.jquery.com/jquery-3.7.1.js"></script>
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(document).ready(function () {
|
||||||
|
$('#btnSimpanSuratUsulan').on('click', function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
modal_add_surat_usulan.close();
|
||||||
|
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Simpan Profil RW?',
|
||||||
|
text: "Pastikan semua data sudah benar.",
|
||||||
|
icon: 'question',
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonColor: '#22c55e',
|
||||||
|
cancelButtonColor: '#6b7280',
|
||||||
|
confirmButtonText: 'Ya, Simpan',
|
||||||
|
cancelButtonText: 'Batal'
|
||||||
|
}).then((result) => {
|
||||||
|
|
||||||
|
if (result.isConfirmed) {
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Berhasil!',
|
||||||
|
text: 'Profil RW berhasil disimpan.',
|
||||||
|
icon: 'success',
|
||||||
|
confirmButtonText: 'OK',
|
||||||
|
confirmButtonColor: '#22c55e'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue