diff --git a/catatan_rilis.md b/catatan_rilis.md
index be176f0908..339e775490 100644
--- a/catatan_rilis.md
+++ b/catatan_rilis.md
@@ -21,3 +21,4 @@ Terimakasih [isi disini] yang telah berkontribusi langsung mengembangkan aplikas
1. [#1619](https://github.com/OpenSID/OpenDK/issues/1619) Perbaikan teknis terkait upload tema di OpenDK.
2. [#1630](https://github.com/OpenSID/OpenDK/issues/1630) Sesuaikan perubahan tombol aksi agar konsisten.
3. [#1632](https://github.com/OpenSID/OpenDK/issues/1632) Penyesuaian pendaftaran kerjasama.
+4. [#1635](https://github.com/OpenSID/OpenDK/issues/1635) Penyesuaian alert agar konsisten.
\ No newline at end of file
diff --git a/public/js/admin.js b/public/js/admin.js
index 31480f3533..445a5c445a 100644
--- a/public/js/admin.js
+++ b/public/js/admin.js
@@ -11,13 +11,7 @@ function errorValidation(response) {
var errors = response.responseJSON?.errors;
if (!errors) {
- Swal.fire({
- title: 'Gagal!',
- text: response,
- icon: 'error',
- confirmButtonText: 'OK',
- timer: 1500
- });
+ openAlert(response, 'Gagal!', 'danger');
} else {
$.each(errors, function(key, value) {
$('#' + key)
diff --git a/public/js/modal-helper.js b/public/js/modal-helper.js
new file mode 100644
index 0000000000..e57a337b75
--- /dev/null
+++ b/public/js/modal-helper.js
@@ -0,0 +1,56 @@
+var confirmCallback = null;
+
+function openAlert(message, title, type, onClose) {
+ var modal = $('#modal-alert');
+ modal.find('.modal-title').text(title || 'Pesan');
+ modal.find('.modal-body').text(message || '');
+ modal.find('.modal-content').removeClass('modal-danger modal-success modal-warning modal-info');
+
+ if (type) {
+ modal.find('.modal-content').addClass('modal-' + type);
+ }
+
+ modal.off('hidden.bs.modal.alertCallback');
+ if (typeof onClose === 'function') {
+ modal.one('hidden.bs.modal.alertCallback', onClose);
+ }
+
+ modal.modal('show');
+}
+
+function openConfirm(message, title, callback, btnYesText) {
+ var modal = $('#modal-confirm');
+ modal.find('.modal-title').text(title || 'Konfirmasi');
+ modal.find('.modal-body').text(message || '');
+ confirmCallback = callback;
+ modal.find('#modal-confirm-yes').text(btnYesText || 'Ya');
+ modal.modal('show');
+}
+
+$(document).on('click', '#modal-confirm-yes', function () {
+ $('#modal-confirm').modal('hide');
+ if (typeof confirmCallback === 'function') {
+ confirmCallback();
+ }
+});
+
+$(document).on('click', '[data-confirm]', function (e) {
+ e.preventDefault();
+ var btn = $(this);
+ var message = btn.data('confirm');
+ var title = btn.data('confirm-title') || 'Konfirmasi';
+ var btnText = btn.data('confirm-btn') || 'Ya';
+ var form = btn.closest('form');
+ var href = btn.attr('href');
+ openConfirm(message, title, function () {
+ if (form.length) {
+ if (form[0].requestSubmit) {
+ form[0].requestSubmit(btn[0]);
+ } else {
+ form.trigger('submit');
+ }
+ } else if (href) {
+ window.location.href = href;
+ }
+ }, btnText);
+});
diff --git a/resources/views/auth/2fa/verify-activation.blade.php b/resources/views/auth/2fa/verify-activation.blade.php
index ef9c210f40..69b59bba4e 100644
--- a/resources/views/auth/2fa/verify-activation.blade.php
+++ b/resources/views/auth/2fa/verify-activation.blade.php
@@ -189,8 +189,9 @@ function updateOtpValue() {
if (expirySeconds <= 0) {
clearInterval(expiryInterval);
clearInterval(resendInterval);
- alert('Kode OTP telah kadaluarsa. Silakan minta kode baru.');
- window.location.href = '{{ route('otp2fa.index') }}';
+ openAlert('Kode OTP telah kadaluarsa. Silakan minta kode baru.', 'Info', 'warning', function () {
+ window.location.href = '{{ route('otp2fa.index') }}';
+ });
}
}, 1000);
@@ -222,12 +223,12 @@ function updateOtpValue() {
}
}, 1000);
- alert('Kode OTP baru telah dikirim.');
+ openAlert('Kode OTP baru telah dikirim.', 'Info', 'success');
} else {
- alert(response.message || 'Gagal mengirim ulang kode OTP.');
+ openAlert(response.message || 'Gagal mengirim ulang kode OTP.', 'Info', 'warning');
}
}).fail(function() {
- alert('Gagal mengirim ulang kode OTP.');
+ openAlert('Gagal mengirim ulang kode OTP.', 'Error', 'danger');
});
});
});
diff --git a/resources/views/auth/2fa/verify-login.blade.php b/resources/views/auth/2fa/verify-login.blade.php
index 022c7290b5..18386cf40b 100644
--- a/resources/views/auth/2fa/verify-login.blade.php
+++ b/resources/views/auth/2fa/verify-login.blade.php
@@ -141,8 +141,12 @@
+
+
+
+
@@ -237,8 +239,9 @@ function updateOtpValue() {
if (expirySeconds <= 0) {
clearInterval(expiryInterval);
clearInterval(resendInterval);
- alert('Kode OTP telah kadaluarsa. Silakan minta kode baru.');
- window.location.href = '{{ route('otp.login') }}';
+ openAlert('Kode OTP telah kadaluarsa. Silakan minta kode baru.', 'Info', 'warning', function () {
+ window.location.href = '{{ route('otp.login') }}';
+ });
}
}, 1000);
@@ -256,7 +259,7 @@ function updateOtpValue() {
purpose: 'login'
},
success: function(response) {
- alert(response.message);
+ openAlert(response.message, 'Info', 'success');
// Reset expiry timer
expirySeconds = expiryMinutes * 60;
@@ -282,7 +285,7 @@ function updateOtpValue() {
}, 1000);
},
error: function(xhr) {
- alert('Gagal mengirim ulang kode OTP');
+ openAlert('Gagal mengirim ulang kode OTP', 'Error', 'danger');
$('#resend-btn').prop('disabled', false).html(
' Kirim Ulang');
}
diff --git a/resources/views/auth/otp2fa/verify-settings.blade.php b/resources/views/auth/otp2fa/verify-settings.blade.php
index ff6e10c5f0..4267e9af23 100644
--- a/resources/views/auth/otp2fa/verify-settings.blade.php
+++ b/resources/views/auth/otp2fa/verify-settings.blade.php
@@ -191,8 +191,9 @@ function updateOtpValue() {
if (expirySeconds <= 0) {
clearInterval(expiryInterval);
clearInterval(resendInterval);
- alert('Kode verifikasi telah kadaluarsa. Silakan minta kode baru.');
- window.location.href = '{{ route('otp2fa.index') }}';
+ openAlert('Kode verifikasi telah kadaluarsa. Silakan minta kode baru.', 'Info', 'warning', function () {
+ window.location.href = '{{ route('otp2fa.index') }}';
+ });
}
}, 1000);
@@ -210,7 +211,7 @@ function updateOtpValue() {
purpose: 'settings_verification'
},
success: function(response) {
- alert(response.message);
+ openAlert(response.message, 'Info', 'success');
// Reset timer
expirySeconds = expiryMinutes * 60;
@@ -236,7 +237,7 @@ function updateOtpValue() {
}, 1000);
},
error: function(xhr) {
- alert('Gagal mengirim ulang kode verifikasi');
+ openAlert('Gagal mengirim ulang kode verifikasi', 'Error', 'danger');
$('#resend-btn').prop('disabled', false).html(
' Kirim Ulang');
}
diff --git a/resources/views/components/modal-alert.blade.php b/resources/views/components/modal-alert.blade.php
new file mode 100644
index 0000000000..0140e30d88
--- /dev/null
+++ b/resources/views/components/modal-alert.blade.php
@@ -0,0 +1,14 @@
+
diff --git a/resources/views/components/modal-confirm.blade.php b/resources/views/components/modal-confirm.blade.php
new file mode 100644
index 0000000000..cf7ace6cb6
--- /dev/null
+++ b/resources/views/components/modal-confirm.blade.php
@@ -0,0 +1,15 @@
+
diff --git a/resources/views/data/data_sarana/partials/action.blade.php b/resources/views/data/data_sarana/partials/action.blade.php
index 88e478b13f..3cb9ac1eb5 100644
--- a/resources/views/data/data_sarana/partials/action.blade.php
+++ b/resources/views/data/data_sarana/partials/action.blade.php
@@ -9,7 +9,7 @@
diff --git a/resources/views/data/pengurus/create.blade.php b/resources/views/data/pengurus/create.blade.php
index 58726b1fdf..9fd1c40b89 100644
--- a/resources/views/data/pengurus/create.blade.php
+++ b/resources/views/data/pengurus/create.blade.php
@@ -65,7 +65,7 @@ function readURL(input) {
} else { //no
//warning
$("#foto").val('');
- alert('File tersebut tidak diperbolehkan.');
+ openAlert('File tersebut tidak diperbolehkan.', 'Peringatan', 'warning');
}
}
}
diff --git a/resources/views/data/pengurus/edit.blade.php b/resources/views/data/pengurus/edit.blade.php
index a08c10a64c..13c8b4993e 100644
--- a/resources/views/data/pengurus/edit.blade.php
+++ b/resources/views/data/pengurus/edit.blade.php
@@ -66,7 +66,7 @@ function readURL(input) {
} else { //no
//warning
$("#foto").val('');
- alert('File tersebut tidak diperbolehkan.');
+ openAlert('File tersebut tidak diperbolehkan.', 'Peringatan', 'warning');
}
}
}
diff --git a/resources/views/data/pengurus/form_create_arsip.blade.php b/resources/views/data/pengurus/form_create_arsip.blade.php
index 6ea15dc604..4155cc2fff 100644
--- a/resources/views/data/pengurus/form_create_arsip.blade.php
+++ b/resources/views/data/pengurus/form_create_arsip.blade.php
@@ -74,7 +74,7 @@
},
error: function(xhr, status, error) {
console.error(error);
- alert("Terjadi kesalahan saat mengambil data.");
+ openAlert("Terjadi kesalahan saat mengambil data.", "Error", "danger");
}
});
}
diff --git a/resources/views/data/pengurus/form_edit_arsip.blade.php b/resources/views/data/pengurus/form_edit_arsip.blade.php
index 7f66ddf141..ab78723880 100644
--- a/resources/views/data/pengurus/form_edit_arsip.blade.php
+++ b/resources/views/data/pengurus/form_edit_arsip.blade.php
@@ -78,7 +78,7 @@
},
error: function(xhr, status, error) {
console.error(error);
- alert("Terjadi kesalahan saat mengambil data.");
+ openAlert("Terjadi kesalahan saat mengambil data.", "Error", "danger");
}
});
}
diff --git a/resources/views/informasi/artikel/_form.blade.php b/resources/views/informasi/artikel/_form.blade.php
index 4f6f3ffeea..2b69779466 100644
--- a/resources/views/informasi/artikel/_form.blade.php
+++ b/resources/views/informasi/artikel/_form.blade.php
@@ -107,7 +107,7 @@ function readURL(input) {
} else { //no
//warning
$("#file-artikel").val('');
- alert('File tersebut tidak diperbolehkan.');
+ openAlert('File tersebut tidak diperbolehkan.', 'Peringatan', 'warning');
}
}
}
diff --git a/resources/views/informasi/media_sosial/create.blade.php b/resources/views/informasi/media_sosial/create.blade.php
index 8da47df091..8915486551 100644
--- a/resources/views/informasi/media_sosial/create.blade.php
+++ b/resources/views/informasi/media_sosial/create.blade.php
@@ -73,7 +73,7 @@ function readURL(input) {
} else { //no
//warning
$("#logo").val('');
- alert('File tersebut tidak diperbolehkan.');
+ openAlert('File tersebut tidak diperbolehkan.', 'Peringatan', 'warning');
}
}
}
diff --git a/resources/views/informasi/media_sosial/edit.blade.php b/resources/views/informasi/media_sosial/edit.blade.php
index 3ea2192460..709911a54d 100644
--- a/resources/views/informasi/media_sosial/edit.blade.php
+++ b/resources/views/informasi/media_sosial/edit.blade.php
@@ -74,7 +74,7 @@ function readURL(input) {
} else { //no
//warning
$("#logo").val('');
- alert('File tersebut tidak diperbolehkan.');
+ openAlert('File tersebut tidak diperbolehkan.', 'Peringatan', 'warning');
}
}
}
diff --git a/resources/views/informasi/prosedur/create.blade.php b/resources/views/informasi/prosedur/create.blade.php
index 3dfc3445a5..25eb738c66 100644
--- a/resources/views/informasi/prosedur/create.blade.php
+++ b/resources/views/informasi/prosedur/create.blade.php
@@ -81,7 +81,7 @@ function readURL(input) {
} else { //no
//warning
$("#file_prosedur").val('');
- alert('File tersebut tidak diperbolehkan.');
+ openAlert('File tersebut tidak diperbolehkan.', 'Peringatan', 'warning');
}
}
}
diff --git a/resources/views/informasi/prosedur/edit.blade.php b/resources/views/informasi/prosedur/edit.blade.php
index 45ad780828..be1ff467f1 100644
--- a/resources/views/informasi/prosedur/edit.blade.php
+++ b/resources/views/informasi/prosedur/edit.blade.php
@@ -79,7 +79,7 @@ function readURL(input) {
} else { //no
//warning
$("#file_prosedur").val('');
- alert('File tersebut tidak diperbolehkan.');
+ openAlert('File tersebut tidak diperbolehkan.', 'Peringatan', 'warning');
}
}
}
diff --git a/resources/views/informasi/regulasi/form_create.blade.php b/resources/views/informasi/regulasi/form_create.blade.php
index 3fa493c59a..7aacb9cc3e 100644
--- a/resources/views/informasi/regulasi/form_create.blade.php
+++ b/resources/views/informasi/regulasi/form_create.blade.php
@@ -73,7 +73,7 @@ function readURL(input) {
} else { //no
//warning
$("#file_regulasi").val('');
- alert('File tersebut tidak diperbolehkan.');
+ openAlert('File tersebut tidak diperbolehkan.', 'Peringatan', 'warning');
}
}
}
diff --git a/resources/views/informasi/regulasi/form_update.blade.php b/resources/views/informasi/regulasi/form_update.blade.php
index 3e895429e3..9b34e95fa5 100644
--- a/resources/views/informasi/regulasi/form_update.blade.php
+++ b/resources/views/informasi/regulasi/form_update.blade.php
@@ -73,7 +73,7 @@ function readURL(input) {
} else { //no
//warning
$("#file_regulasi").val('');
- alert('File tersebut tidak diperbolehkan.');
+ openAlert('File tersebut tidak diperbolehkan.', 'Peringatan', 'warning');
}
}
}
diff --git a/resources/views/informasi/sinergi_program/create.blade.php b/resources/views/informasi/sinergi_program/create.blade.php
index d3455596ee..d421d3dcaf 100644
--- a/resources/views/informasi/sinergi_program/create.blade.php
+++ b/resources/views/informasi/sinergi_program/create.blade.php
@@ -73,7 +73,7 @@ function readURL(input) {
} else { //no
//warning
$("#gambar").val('');
- alert('File tersebut tidak diperbolehkan.');
+ openAlert('File tersebut tidak diperbolehkan.', 'Peringatan', 'warning');
}
}
}
diff --git a/resources/views/informasi/sinergi_program/edit.blade.php b/resources/views/informasi/sinergi_program/edit.blade.php
index effcccf0f2..c983464d13 100644
--- a/resources/views/informasi/sinergi_program/edit.blade.php
+++ b/resources/views/informasi/sinergi_program/edit.blade.php
@@ -77,7 +77,7 @@ function readURL(input) {
} else { //no
//warning
$("#gambar").val('');
- alert('File tersebut tidak diperbolehkan.');
+ openAlert('File tersebut tidak diperbolehkan.', 'Peringatan', 'warning');
}
}
}
diff --git a/resources/views/layouts/app.blade.php b/resources/views/layouts/app.blade.php
index 7b8304afdb..637c0f54b3 100644
--- a/resources/views/layouts/app.blade.php
+++ b/resources/views/layouts/app.blade.php
@@ -192,31 +192,22 @@
let livewireInstance = typeof window.livewire !== 'undefined' ? window.livewire : Livewire;
livewireInstance.on('success', (message) => {
- Swal.fire({
- position: 'center',
- icon: 'success',
- title: message,
- showConfirmButton: true,
- timer: 1500
- })
+ openAlert(message, 'Sukses', 'success');
$('#myModal').modal('hide');
});
livewireInstance.on('error', (message) => {
- Swal.fire({
- position: 'center',
- icon: 'error',
- title: message,
- showConfirmButton: true,
- timer: 1500
- })
-
+ openAlert(message, 'Error', 'danger');
});
})
@livewireScripts
+
+
+
+