Files
simple-kurir/assets/my-js.js
2025-05-13 05:45:36 +08:00

78 lines
1.9 KiB
JavaScript
Executable File

function logout() {
return swal({
title: "Yakin?",
text: "Anda akan keluar dari sistem",
type: "warning",
showCancelButton: !0,
confirmButtonColor: "#DD6B55",
confirmButtonText: "Ya, logout!",
cancelButtonText: "Tidak, batal!",
closeOnConfirm: !1,
closeOnCancel: !1,
confirmButtonColor: "#f60e0e"
}, function (t) {
if (t) {
window.location.href = "/"
}else{
// close swal
swal.close()
}
})
}
function blockUI(message) {
$.blockUI({
message: message,
css: {
border: 'none',
padding: '15px',
backgroundColor: '#000',
'-webkit-border-radius': '10px',
'-moz-border-radius': '10px',
opacity: .5,
color: '#fff'
}
});
}
function notAvailable() {
return swal({
title: "Belum Tersedia",
text: "Maaf, fitur ini belum tersedia",
type: "info",
timer: 2000,
showConfirmButton: !1
})
}
function thousandSeparator(x) {
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}
function enableInput(stat) {
var inputs = document.querySelectorAll('#form-modal input');
for (var i = 0; i < inputs.length; i++) {
inputs[i].disabled = stat;
}
// disable all select in #form-modal
var selects = document.querySelectorAll('#form-modal select');
for (var i = 0; i < selects.length; i++) {
selects[i].disabled = stat;
}
// disable all textarea in #form-modal
var textareas = document.querySelectorAll('#form-modal textarea');
for (var i = 0; i < textareas.length; i++) {
textareas[i].disabled = stat;
}
}
function numberOnly(element) { //only number and remove comma
element.value = element.value.replace(/[^0-9]/g, '');
element.value = element.value.replace(/,/g, '');
}