Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ public/error_log
/.vscode

# Themes
# /themes/*
/themes/*
!/themes/opendk/
/themes/opendk/*
!/themes/opendk/default/
/storage/komplain

Expand Down
8 changes: 1 addition & 7 deletions public/js/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
45 changes: 45 additions & 0 deletions public/js/modal-helper.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
var confirmCallback = null;

function openAlert(message, title, type) {
var modal = $('#modal-alert');
modal.find('.modal-title').text(title || 'Pesan');
modal.find('.modal-body').html(message || '');
modal.find('.modal-content').removeClass('modal-danger modal-success modal-warning modal-info');
if (type) {
modal.find('.modal-content').addClass('modal-' + type);
}
modal.modal('show');
}

function openConfirm(message, title, callback, btnYesText) {
var modal = $('#modal-confirm');
modal.find('.modal-title').text(title || 'Konfirmasi');
modal.find('.modal-body').html(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) {
form[0].submit();
} else if (href) {
window.location.href = href;
}
}, btnText);
});
8 changes: 4 additions & 4 deletions resources/views/auth/2fa/verify-activation.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ function updateOtpValue() {
if (expirySeconds <= 0) {
clearInterval(expiryInterval);
clearInterval(resendInterval);
alert('Kode OTP telah kadaluarsa. Silakan minta kode baru.');
openAlert('Kode OTP telah kadaluarsa. Silakan minta kode baru.', 'Info');
window.location.href = '{{ route('otp2fa.index') }}';
}
}, 1000);
Expand Down Expand Up @@ -222,12 +222,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');
});
});
});
Expand Down
6 changes: 3 additions & 3 deletions resources/views/auth/2fa/verify-login.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ function updateOtpValue() {
if (expirySeconds <= 0) {
clearInterval(expiryInterval);
clearInterval(resendInterval);
alert('Kode 2FA telah kadaluarsa. Silakan minta kode baru.');
openAlert('Kode 2FA telah kadaluarsa. Silakan minta kode baru.', 'Info');
window.location.href = '{{ route('login') }}';
}
}, 1000);
Expand All @@ -256,7 +256,7 @@ function updateOtpValue() {
purpose: '2fa_login'
},
success: function(response) {
alert(response.message);
openAlert(response.message, 'Info', 'success');

// Reset expiry timer
expirySeconds = expiryMinutes * 60;
Expand All @@ -282,7 +282,7 @@ function updateOtpValue() {
}, 1000);
},
error: function(xhr) {
alert('Gagal mengirim ulang kode 2FA');
openAlert('Gagal mengirim ulang kode 2FA', 'Error', 'danger');
$('#resend-btn').prop('disabled', false).html(
'<i class="fa fa-refresh"></i> Kirim Ulang');
}
Expand Down
6 changes: 3 additions & 3 deletions resources/views/auth/otp/verify-activation.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ function updateOtpValue() {
if (expirySeconds <= 0) {
clearInterval(expiryInterval);
clearInterval(resendInterval);
alert('Kode OTP telah kadaluarsa. Silakan minta kode baru.');
openAlert('Kode OTP telah kadaluarsa. Silakan minta kode baru.', 'Info');
window.location.href = '{{ route('otp2fa.index') }}';
}
}, 1000);
Expand All @@ -209,7 +209,7 @@ function updateOtpValue() {
purpose: 'activation'
},
success: function(response) {
alert(response.message);
openAlert(response.message, 'Info', 'success');

// Reset timer
expirySeconds = expiryMinutes * 60;
Expand All @@ -235,7 +235,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(
'<i class="fa fa-refresh"></i> Kirim Ulang');
}
Expand Down
6 changes: 3 additions & 3 deletions resources/views/auth/otp/verify-login.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ function updateOtpValue() {
if (expirySeconds <= 0) {
clearInterval(expiryInterval);
clearInterval(resendInterval);
alert('Kode OTP telah kadaluarsa. Silakan minta kode baru.');
openAlert('Kode OTP telah kadaluarsa. Silakan minta kode baru.', 'Info');
window.location.href = '{{ route('otp.login') }}';
}
}, 1000);
Expand All @@ -256,7 +256,7 @@ function updateOtpValue() {
purpose: 'login'
},
success: function(response) {
alert(response.message);
openAlert(response.message, 'Info', 'success');

// Reset expiry timer
expirySeconds = expiryMinutes * 60;
Expand All @@ -282,7 +282,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(
'<i class="fa fa-refresh"></i> Kirim Ulang');
}
Expand Down
6 changes: 3 additions & 3 deletions resources/views/auth/otp2fa/verify-settings.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ function updateOtpValue() {
if (expirySeconds <= 0) {
clearInterval(expiryInterval);
clearInterval(resendInterval);
alert('Kode verifikasi telah kadaluarsa. Silakan minta kode baru.');
openAlert('Kode verifikasi telah kadaluarsa. Silakan minta kode baru.', 'Info');
window.location.href = '{{ route('otp2fa.index') }}';
}
}, 1000);
Expand All @@ -210,7 +210,7 @@ function updateOtpValue() {
purpose: 'settings_verification'
},
success: function(response) {
alert(response.message);
openAlert(response.message, 'Info', 'success');

// Reset timer
expirySeconds = expiryMinutes * 60;
Expand All @@ -236,7 +236,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(
'<i class="fa fa-refresh"></i> Kirim Ulang');
}
Expand Down
14 changes: 14 additions & 0 deletions resources/views/components/modal-alert.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<div class="modal fade" id="modal-alert" tabindex="-1" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="modal-alert-title">Pesan</h4>
</div>
<div class="modal-body" id="modal-alert-body"></div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" data-dismiss="modal">OK</button>
</div>
</div>
</div>
</div>
15 changes: 15 additions & 0 deletions resources/views/components/modal-confirm.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<div class="modal fade" id="modal-confirm" tabindex="-1" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="modal-confirm-title">Konfirmasi</h4>
</div>
<div class="modal-body" id="modal-confirm-body"></div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Batal</button>
<button type="button" class="btn btn-primary" id="modal-confirm-yes">Ya</button>
</div>
</div>
</div>
</div>
2 changes: 1 addition & 1 deletion resources/views/data/data_sarana/partials/action.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<form action="{{ $deleteUrl ?? '#' }}" method="POST" style="display:inline;">
@csrf
@method('DELETE')
<button type="submit" class="btn btn-icon btn-danger btn-sm" style="width: 40px" onclick="return confirm('Yakin ingin menghapus data ini?')">
<button type="submit" class="btn btn-icon btn-danger btn-sm" style="width: 40px" data-confirm="Yakin ingin menghapus data ini?">
<i class="fa fa-trash" aria-hidden="true"></i>
</button>
</form>
Expand Down
2 changes: 1 addition & 1 deletion resources/views/data/pengurus/create.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ function readURL(input) {
} else { //no
//warning
$("#foto").val('');
alert('File tersebut tidak diperbolehkan.');
openAlert('File tersebut tidak diperbolehkan.', 'Peringatan', 'warning');
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion resources/views/data/pengurus/edit.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ function readURL(input) {
} else { //no
//warning
$("#foto").val('');
alert('File tersebut tidak diperbolehkan.');
openAlert('File tersebut tidak diperbolehkan.', 'Peringatan', 'warning');
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion resources/views/data/pengurus/form_create_arsip.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
});
}
Expand Down
2 changes: 1 addition & 1 deletion resources/views/data/pengurus/form_edit_arsip.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
});
}
Expand Down
2 changes: 1 addition & 1 deletion resources/views/informasi/artikel/_form.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion resources/views/informasi/media_sosial/create.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ function readURL(input) {
} else { //no
//warning
$("#logo").val('');
alert('File tersebut tidak diperbolehkan.');
openAlert('File tersebut tidak diperbolehkan.', 'Peringatan', 'warning');
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion resources/views/informasi/media_sosial/edit.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ function readURL(input) {
} else { //no
//warning
$("#logo").val('');
alert('File tersebut tidak diperbolehkan.');
openAlert('File tersebut tidak diperbolehkan.', 'Peringatan', 'warning');
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion resources/views/informasi/prosedur/create.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion resources/views/informasi/prosedur/edit.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion resources/views/informasi/regulasi/form_create.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion resources/views/informasi/regulasi/form_update.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion resources/views/informasi/sinergi_program/create.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ function readURL(input) {
} else { //no
//warning
$("#gambar").val('');
alert('File tersebut tidak diperbolehkan.');
openAlert('File tersebut tidak diperbolehkan.', 'Peringatan', 'warning');
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion resources/views/informasi/sinergi_program/edit.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ function readURL(input) {
} else { //no
//warning
$("#gambar").val('');
alert('File tersebut tidak diperbolehkan.');
openAlert('File tersebut tidak diperbolehkan.', 'Peringatan', 'warning');
}
}
}
Expand Down
21 changes: 6 additions & 15 deletions resources/views/layouts/app.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,31 +195,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');
});
})
</script>

@livewireScripts

<x-modal-alert />
<x-modal-confirm />
<script src="{{ asset('/js/modal-helper.js') }}"></script>

</body>

</html>
Loading
Loading