2024-08-29 03:56:32 +00:00
|
|
|
{{-- <script>
|
|
|
|
var HOST_URL = "https://preview.keenthemes.com/metronic/theme/html/tools/preview";
|
|
|
|
</script> --}}
|
|
|
|
|
|
|
|
<!--begin::Global Config(global config for global JS scripts)-->
|
|
|
|
<script>
|
|
|
|
var KTAppSettings = {
|
|
|
|
"breakpoints": {
|
|
|
|
"sm": 576,
|
|
|
|
"md": 768,
|
|
|
|
"lg": 992,
|
|
|
|
"xl": 1200,
|
|
|
|
"xxl": 1200
|
|
|
|
},
|
|
|
|
"colors": {
|
|
|
|
"theme": {
|
|
|
|
"base": {
|
|
|
|
"white": "#ffffff",
|
|
|
|
"primary": "#6993FF",
|
|
|
|
"secondary": "#E5EAEE",
|
|
|
|
"success": "#1BC5BD",
|
|
|
|
"info": "#8950FC",
|
|
|
|
"warning": "#FFA800",
|
|
|
|
"danger": "#F64E60",
|
|
|
|
"light": "#F3F6F9",
|
|
|
|
"dark": "#212121"
|
|
|
|
},
|
|
|
|
"light": {
|
|
|
|
"white": "#ffffff",
|
|
|
|
"primary": "#E1E9FF",
|
|
|
|
"secondary": "#ECF0F3",
|
|
|
|
"success": "#C9F7F5",
|
|
|
|
"info": "#EEE5FF",
|
|
|
|
"warning": "#FFF4DE",
|
|
|
|
"danger": "#FFE2E5",
|
|
|
|
"light": "#F3F6F9",
|
|
|
|
"dark": "#D6D6E0"
|
|
|
|
},
|
|
|
|
"inverse": {
|
|
|
|
"white": "#ffffff",
|
|
|
|
"primary": "#ffffff",
|
|
|
|
"secondary": "#212121",
|
|
|
|
"success": "#ffffff",
|
|
|
|
"info": "#ffffff",
|
|
|
|
"warning": "#ffffff",
|
|
|
|
"danger": "#ffffff",
|
|
|
|
"light": "#464E5F",
|
|
|
|
"dark": "#ffffff"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"gray": {
|
|
|
|
"gray-100": "#F3F6F9",
|
|
|
|
"gray-200": "#ECF0F3",
|
|
|
|
"gray-300": "#E5EAEE",
|
|
|
|
"gray-400": "#D6D6E0",
|
|
|
|
"gray-500": "#B5B5C3",
|
|
|
|
"gray-600": "#80808F",
|
|
|
|
"gray-700": "#464E5F",
|
|
|
|
"gray-800": "#1B283F",
|
|
|
|
"gray-900": "#212121"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"font-family": "Poppins"
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<!--end::Global Config-->
|
|
|
|
|
|
|
|
<!--begin::Global Theme Bundle(used by all pages)-->
|
|
|
|
<script src="{{ asset('assets/plugins/global/plugins.bundle.js') }}"></script>
|
|
|
|
<script src="{{ asset('assets/plugins/custom/prismjs/prismjs.bundle.js') }}"></script>
|
|
|
|
<script src="{{ asset('assets/js/scripts.bundle.js') }}"></script>
|
|
|
|
|
|
|
|
<!--end::Global Theme Bundle-->
|
|
|
|
|
|
|
|
<!--begin::Page Vendors(used by this page)-->
|
|
|
|
{{-- <script src="{{ asset('assets/plugins/custom/fullcalendar/fullcalendar.bundle.js') }}"></script> --}}
|
|
|
|
|
|
|
|
<!--end::Page Vendors-->
|
|
|
|
<script src="{{ asset('assets/plugins/custom/datatables/datatables.bundle.js?v=7.0.5') }}"></script>
|
|
|
|
<!--begin::Page Scripts-->
|
|
|
|
<script src="{{ asset('assets/js/pages/crud/forms/widgets/bootstrap-select.js?v=7.0.5') }}"></script>
|
|
|
|
<script src="{{ asset('assets/plugins/custom/kanban/kanban.bundle.js?v=7.0.5') }}"></script>
|
|
|
|
<!--end::Page Scripts-->
|
|
|
|
|
|
|
|
<!--begin::Global Script Manual-->
|
|
|
|
<script>
|
|
|
|
var base_url = "{{ url('/') }}"+"/";
|
|
|
|
var btnLoader = KTUtil.getById("znBtnLoader");
|
|
|
|
var validator_change_pass;
|
2024-08-29 06:34:58 +00:00
|
|
|
var validatorChangePass;
|
2024-08-29 03:56:32 +00:00
|
|
|
/* var KTSessionTimeoutDemo = function() {
|
|
|
|
var initDemo = function() {
|
|
|
|
$.sessionTimeout({
|
|
|
|
title: "Session Timeout",
|
|
|
|
message: "",
|
|
|
|
keepAlive:false,
|
|
|
|
redirUrl: "",
|
|
|
|
logoutUrl: "",
|
|
|
|
warnAfter: 1200000,
|
|
|
|
redirAfter: 1230000,
|
|
|
|
ignoreUserActivity: false,
|
|
|
|
countdownMessage: "Your session is about to expire in {timer} seconds.",
|
|
|
|
countdownBar: true
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
return {
|
|
|
|
//main function to initiate the module
|
|
|
|
init: function() {
|
|
|
|
initDemo();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}(); */
|
|
|
|
$.ajaxSetup({
|
|
|
|
headers: {
|
|
|
|
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
jQuery(document).ready(function() {
|
|
|
|
// KTSessionTimeoutDemo.init();
|
|
|
|
if($('.menu-item-active').length) {
|
|
|
|
$('.menu-item-active')[0].parentNode.parentNode.parentNode.classList.add('menu-item-here');
|
|
|
|
}
|
|
|
|
|
|
|
|
$('.znSelect2').select2({
|
|
|
|
placeholder: "Pilih"
|
|
|
|
});
|
|
|
|
|
|
|
|
$('.znDate').datepicker({
|
|
|
|
rtl: KTUtil.isRTL(),
|
|
|
|
orientation: "bottom left",
|
|
|
|
todayHighlight: true,
|
|
|
|
format: 'dd-mm-yyyy',
|
|
|
|
autoclose: true,
|
|
|
|
});
|
|
|
|
|
|
|
|
$('.max-notif').maxlength({
|
|
|
|
warningClass: "label label-warning label-rounded label-inline",
|
|
|
|
limitReachedClass: "label label-success label-rounded label-inline",
|
|
|
|
appendToParent: true
|
|
|
|
});
|
|
|
|
|
|
|
|
// INPUT FORM
|
|
|
|
$(".znDate").inputmask("99-99-9999", {
|
|
|
|
"placeholder": "dd-mm-yyyy"
|
|
|
|
});
|
|
|
|
|
|
|
|
$(".znNumber").inputmask('decimal', {
|
|
|
|
rightAlign: false
|
|
|
|
});
|
|
|
|
|
|
|
|
$(".znCurrency").inputmask('Rp 999.999.999,99', {
|
|
|
|
numericInput: true
|
|
|
|
});
|
|
|
|
|
|
|
|
$(".znPhone").inputmask({
|
|
|
|
"mask": "999999999999999",
|
|
|
|
placeholder: ""
|
|
|
|
});
|
|
|
|
|
|
|
|
$(".znNo").inputmask({
|
|
|
|
"mask": "9999999999999999999999999999999999999999",
|
|
|
|
placeholder: ""
|
|
|
|
});
|
|
|
|
|
|
|
|
$('.custom-file-input').on('change', function() {
|
|
|
|
var fileName = $(this).val();
|
|
|
|
$(this).next('.custom-file-label').addClass("selected").html(fileName);
|
|
|
|
});
|
|
|
|
|
|
|
|
validator_change_pass = FormValidation.formValidation(
|
|
|
|
KTUtil.getById('formChangePass'),
|
|
|
|
{
|
|
|
|
fields: {
|
|
|
|
change_pass: {
|
|
|
|
validators: {
|
|
|
|
notEmpty: {
|
|
|
|
message: 'Wajib diisi!'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
plugins: {
|
|
|
|
trigger: new FormValidation.plugins.Trigger(),
|
|
|
|
bootstrap: new FormValidation.plugins.Bootstrap()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
2024-08-29 06:34:58 +00:00
|
|
|
|
|
|
|
validatorChangePass = FormValidation.formValidation(
|
|
|
|
KTUtil.getById('mChangePasswordForm'),
|
|
|
|
{
|
|
|
|
fields: {
|
|
|
|
oldPassword: {
|
|
|
|
validators: {
|
|
|
|
notEmpty: {
|
|
|
|
message: 'Wajib diisi!'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
newPassword: {
|
|
|
|
validators: {
|
|
|
|
notEmpty: {
|
|
|
|
message: 'Wajib diisi!'
|
|
|
|
},
|
|
|
|
stringLength: {
|
|
|
|
min: 8,
|
|
|
|
message: 'Minimal 8 karakter'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
confirmPassword: {
|
|
|
|
validators: {
|
|
|
|
notEmpty: {
|
|
|
|
message: 'Wajib diisi!'
|
|
|
|
},
|
|
|
|
stringLength: {
|
|
|
|
min: 8,
|
|
|
|
message: 'Minimal 8 karakter'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
plugins: {
|
|
|
|
trigger: new FormValidation.plugins.Trigger(),
|
|
|
|
bootstrap: new FormValidation.plugins.Bootstrap()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
2024-08-29 03:56:32 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
function reInitForm() {
|
|
|
|
$('.znSelect2').select2({
|
|
|
|
placeholder: "Pilih"
|
|
|
|
});
|
|
|
|
|
|
|
|
$('.znDate').datepicker({
|
|
|
|
rtl: KTUtil.isRTL(),
|
|
|
|
orientation: "bottom left",
|
|
|
|
todayHighlight: true,
|
|
|
|
format: 'dd-mm-yyyy',
|
|
|
|
autoclose: true,
|
|
|
|
});
|
|
|
|
|
|
|
|
$('.max-notif').maxlength({
|
|
|
|
warningClass: "label label-warning label-rounded label-inline",
|
|
|
|
limitReachedClass: "label label-success label-rounded label-inline",
|
|
|
|
appendToParent: true
|
|
|
|
});
|
|
|
|
|
|
|
|
// INPUT FORM
|
|
|
|
$(".znDate").inputmask("99-99-9999", {
|
|
|
|
"placeholder": "dd-mm-yyyy"
|
|
|
|
});
|
|
|
|
|
|
|
|
$(".znNumber").inputmask('decimal', {
|
|
|
|
rightAlign: false
|
|
|
|
});
|
|
|
|
|
|
|
|
$(".znCurrency").inputmask('Rp 999.999.999,99', {
|
|
|
|
numericInput: true
|
|
|
|
});
|
|
|
|
|
|
|
|
$(".znPhone").inputmask({
|
|
|
|
"mask": "999999999999999",
|
|
|
|
placeholder: ""
|
|
|
|
});
|
|
|
|
|
|
|
|
$(".znNo").inputmask({
|
|
|
|
"mask": "9999999999999999999999999999999999999999",
|
|
|
|
placeholder: ""
|
|
|
|
});
|
|
|
|
|
|
|
|
$('.custom-file-input').on('change', function() {
|
|
|
|
var fileName = $(this).val();
|
|
|
|
$(this).next('.custom-file-label').addClass("selected").html(fileName);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function znGetTableScrolling(dAct,dColum,dColumStyle,id,dRowHeight=56) {
|
|
|
|
var table = $('#'+id).DataTable({
|
|
|
|
aaSorting: [],
|
|
|
|
responsive: true,
|
|
|
|
// aLengthMenu: [[5,10, 25, 50], [5, 10, 25, 50]],
|
|
|
|
processing: true,
|
|
|
|
serverSide: true,
|
|
|
|
// pageLength : 10,
|
|
|
|
/* deferRender: true,
|
|
|
|
scrollY: 300,
|
|
|
|
scrollCollapse: true,
|
|
|
|
scroller: true,
|
|
|
|
scroller: {
|
|
|
|
loadingIndicator: true,
|
|
|
|
rowHeight: dRowHeight,
|
|
|
|
}, */
|
|
|
|
searching: true,
|
|
|
|
destroy:true,
|
|
|
|
// dom: `<'row'<'col-sm-12'tr>><'row'<'col-sm-12 col-md-5'i><'col-sm-12 col-md-7 dataTables_pager'lp>>`,
|
|
|
|
/* language: {
|
|
|
|
'lengthMenu': 'Display _MENU_',
|
|
|
|
}, */
|
|
|
|
columnDefs: dColumStyle,
|
|
|
|
ajax: {
|
|
|
|
"url" : dAct,
|
|
|
|
/* "error": function(jqXHR, textStatus, errorThrown)
|
|
|
|
{
|
|
|
|
znNotif("warning","Koneksi Bermasalah, Terjadi Kesalahan Saat Pengambilan Data !");
|
|
|
|
}, */
|
|
|
|
},
|
|
|
|
initComplete: function(settings, json) {
|
|
|
|
// $('body').find('.dataTables_scrollBody').addClass("scrollbar");
|
|
|
|
// $('.dataTables_scroll').css('z-index', 1)
|
|
|
|
},
|
|
|
|
columns: dColum
|
|
|
|
});
|
|
|
|
|
|
|
|
return table;
|
|
|
|
}
|
|
|
|
|
|
|
|
function znNotif(type, text) {
|
|
|
|
var icon;
|
|
|
|
switch (type) {
|
|
|
|
case 'success':
|
|
|
|
$('#znAlert-title').html('Berhasil');
|
|
|
|
icon = `<i class="la la-check-circle zn-notif-icon text-success"></i>`;
|
|
|
|
break;
|
|
|
|
case 'danger':
|
|
|
|
$('#znAlert-title').html('Gagal');
|
|
|
|
icon = `<i class="la la-remove zn-notif-icon text-danger"></i>`;
|
|
|
|
break;
|
|
|
|
case 'warning':
|
|
|
|
$('#znAlert-title').html('Peringatan');
|
|
|
|
icon = `<i class="la la-comment-o zn-notif-icon text-warning"></i>`;
|
|
|
|
break;
|
|
|
|
case 'info':
|
|
|
|
$('#znAlert-title').html('Informasi');
|
|
|
|
icon = `<i class="la la-info-circle zn-notif-icon text-info"></i>`;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
$('#znAlertModal').addClass('modal-sm');
|
|
|
|
$('#znAlert-title').addClass('text-' + type);
|
|
|
|
$('.zn-card').addClass('wave-' + type);
|
|
|
|
$('#znAlert-icon').html(icon);
|
|
|
|
$('#znAlert-text').html(text);
|
|
|
|
$('#znAlert-action').hide();
|
|
|
|
$('#znAlert').modal('show');
|
|
|
|
setTimeout(function () {
|
|
|
|
$('#znAlert').modal('hide');
|
|
|
|
$('.zn-card').removeClass('wave-' + type);
|
|
|
|
$('#znAlert-title').removeClass('text-' + type);
|
|
|
|
}, 2000);
|
|
|
|
}
|
|
|
|
|
|
|
|
function znModal(id) {
|
|
|
|
$('#'+id).modal('show');
|
|
|
|
}
|
|
|
|
|
|
|
|
function znModalHide(id) {
|
|
|
|
$('#'+id).modal('hide');
|
|
|
|
}
|
|
|
|
|
|
|
|
function znNotifConfirmClose() {
|
|
|
|
$('#znNotif').modal('hide');
|
|
|
|
}
|
|
|
|
|
|
|
|
const animateCSS = (element, animation, prefix = 'animate__') =>
|
|
|
|
// We create a Promise and return it
|
|
|
|
new Promise((resolve, reject) => {
|
|
|
|
const animationName = `${prefix}${animation}`;
|
|
|
|
const node = document.querySelector(element);
|
|
|
|
|
|
|
|
node.classList.add(`${prefix}animated`, animationName);
|
|
|
|
|
|
|
|
// When the animation ends, we clean the classes and resolve the Promise
|
|
|
|
function handleAnimationEnd(event) {
|
|
|
|
event.stopPropagation();
|
|
|
|
node.classList.remove(`${prefix}animated`, animationName);
|
|
|
|
resolve('Animation ended');
|
|
|
|
}
|
|
|
|
node.addEventListener('animationend', handleAnimationEnd, {once: true});
|
|
|
|
});
|
|
|
|
|
|
|
|
function doPost(url, formData, callback) {
|
|
|
|
$.ajax({
|
|
|
|
processData: false,
|
|
|
|
contentType: false,
|
|
|
|
type: 'POST',
|
|
|
|
global: false,
|
|
|
|
url: url,
|
|
|
|
data: formData,
|
|
|
|
success: function (response) {
|
|
|
|
// todo improve sesuai kebutuhan nantiya
|
|
|
|
if (typeof callback == 'function') {
|
|
|
|
callback("", response);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
error: function (jqXHR, textStatus, errorThrown) {
|
|
|
|
if (typeof callback == 'function') {
|
|
|
|
callback("", null);
|
|
|
|
}
|
|
|
|
if(jqXHR.status === 401) {
|
|
|
|
window.location.replace("/login");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function doGet(url, callback) {
|
|
|
|
$.get(url, function (response, status, xhr) {
|
|
|
|
if (typeof callback == 'function') {
|
|
|
|
callback("", response);
|
|
|
|
}
|
|
|
|
}).fail(function (response) {
|
|
|
|
// console.log(response)
|
|
|
|
if (response.status === 404){
|
|
|
|
window.location.replace("/error404");
|
|
|
|
} else if(response.status === 401) {
|
|
|
|
window.location.replace("/login");
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function znLoadingModal(form) {
|
|
|
|
KTApp.block('#'+form+' .modal-content', {
|
|
|
|
overlayColor: '#000000',
|
|
|
|
state: 'primary',
|
|
|
|
message: 'Processing...'
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function znLoadingModalEnd(form) {
|
|
|
|
KTApp.unblock('#'+form+' .modal-content');
|
|
|
|
}
|
|
|
|
|
|
|
|
function znLoadingPage() {
|
|
|
|
KTApp.blockPage({
|
|
|
|
overlayColor: '#000000',
|
|
|
|
state: 'primary',
|
|
|
|
message: 'Processing...'
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function znLoadingPageEnd() {
|
|
|
|
KTApp.unblockPage();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function znToNumber(objek) {
|
|
|
|
var separator = "";
|
|
|
|
var a = objek.value;
|
|
|
|
var b = a.replace(/[^\d]/g, "");
|
|
|
|
var c = "";
|
|
|
|
var panjang = b.length;
|
|
|
|
var j = 0; for (var i = panjang; i > 0; i--) {
|
|
|
|
j = j + 1; if (((j % 3) == 1) && (j != 1)) {
|
|
|
|
c = b.substr(i - 1, 1) + separator + c;
|
|
|
|
} else {
|
|
|
|
c = b.substr(i - 1, 1) + c;
|
|
|
|
}
|
|
|
|
} objek.value = c;
|
|
|
|
}
|
|
|
|
|
|
|
|
function znClearNPWP(npwp){
|
|
|
|
var new_npwp = npwp.replace(/\./g, "");
|
|
|
|
new_npwp = new_npwp.replace(/\,/g, "");
|
|
|
|
new_npwp = new_npwp.replace(/\-/g, "");
|
|
|
|
return new_npwp;
|
|
|
|
}
|
|
|
|
|
|
|
|
function znNumFormatClear(data) {
|
|
|
|
return data.replace(/\./g,'');
|
|
|
|
}
|
|
|
|
|
|
|
|
function znToMoney(objek) {
|
|
|
|
var separator = ".";
|
|
|
|
var a = objek.value;
|
|
|
|
var b = a.replace(/[^\d]/g, "");
|
|
|
|
var c = "";
|
|
|
|
var panjang = b.length;
|
|
|
|
var j = 0; for (var i = panjang; i > 0; i--) {
|
|
|
|
j = j + 1; if (((j % 3) == 1) && (j != 1)) {
|
|
|
|
c = b.substr(i - 1, 1) + separator + c;
|
|
|
|
} else {
|
|
|
|
c = b.substr(i - 1, 1) + c;
|
|
|
|
}
|
|
|
|
} objek.value = c;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function znNumFormat(nStr) {
|
|
|
|
nStr += '';
|
|
|
|
x = nStr.split('.');
|
|
|
|
x1 = x[0];
|
|
|
|
x2 = x.length > 1 ? '.' + x[1] : '';
|
|
|
|
var rgx = /(\d+)(\d{3})/;
|
|
|
|
while (rgx.test(x1)) {
|
|
|
|
x1 = x1.replace(rgx, '$1' + '.' + '$2');
|
|
|
|
}
|
|
|
|
return x1 + x2;
|
|
|
|
}
|
|
|
|
|
|
|
|
function znNumFormatDec(amount, decimalCount = 2, decimal = ",", thousands = ".") {
|
|
|
|
try {
|
|
|
|
decimalCount = Math.abs(decimalCount);
|
|
|
|
decimalCount = isNaN(decimalCount) ? 2 : decimalCount;
|
|
|
|
|
|
|
|
const negativeSign = amount < 0 ? "-" : "";
|
|
|
|
|
|
|
|
let i = parseInt(amount = Math.abs(Number(amount) || 0).toFixed(decimalCount)).toString();
|
|
|
|
let j = (i.length > 3) ? i.length % 3 : 0;
|
|
|
|
|
|
|
|
return negativeSign + (j ? i.substr(0, j) + thousands : '') + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + thousands) + (decimalCount ? decimal + Math.abs(amount - i).toFixed(decimalCount).slice(2) : "");
|
|
|
|
} catch (e) {
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function popConfirm(title, text, callback) {
|
|
|
|
$('#znModal').removeClass('modal-sm');
|
|
|
|
let icon = `<i class="la la-question-circle zn-notif-icon text-success"></i>`;
|
|
|
|
$('#znNotif-title').addClass('text-success');
|
|
|
|
$('.zn-card').addClass('wave-success');
|
|
|
|
$('#znNotif-icon').html(icon);
|
|
|
|
$('#znNotif-text').html(text);
|
|
|
|
$('#znNotif-title').html(title);
|
|
|
|
$('#znNotif-action').show();
|
|
|
|
$('#btnNotifYes').prop("onclick", null).off("click");
|
|
|
|
$('#btnNotifYes').click(function () {
|
|
|
|
$('#znNotif').modal('hide');
|
|
|
|
if (typeof callback == 'function') {
|
|
|
|
callback();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
$('#znNotif').modal('show');
|
|
|
|
}
|
|
|
|
|
|
|
|
function G_formatDate(dates, type) {
|
|
|
|
var date = new Date(dates);
|
|
|
|
|
|
|
|
var monthNames = [
|
|
|
|
"Januari", "Februari", "Maret",
|
|
|
|
"April", "Mei", "Juni", "Juli",
|
|
|
|
"Agustus", "September", "Oktober",
|
|
|
|
"November", "Desember"
|
|
|
|
];
|
|
|
|
|
|
|
|
var monthNamesSmall = [
|
|
|
|
"Jan", "Feb", "Mar",
|
|
|
|
"Apr", "Mei", "Jun", "Jul",
|
|
|
|
"Ags", "Sep", "Okt",
|
|
|
|
"Nov", "Des"
|
|
|
|
];
|
|
|
|
|
|
|
|
var day = date.getDate();
|
|
|
|
var monthIndex = date.getMonth();
|
|
|
|
var year = date.getFullYear();
|
|
|
|
var hour = date.getHours();
|
|
|
|
var minute = date.getMinutes();
|
|
|
|
var sec = date.getSeconds();
|
|
|
|
|
|
|
|
switch (type) {
|
|
|
|
case 'd':
|
|
|
|
return day;
|
|
|
|
break;
|
|
|
|
case 'm':
|
|
|
|
return monthIndex + 1;
|
|
|
|
break;
|
|
|
|
case 'mm':
|
|
|
|
return monthNamesSmall[(monthIndex + 1)];
|
|
|
|
break;
|
|
|
|
case 'M':
|
|
|
|
return monthNames[(monthIndex)];
|
|
|
|
break;
|
|
|
|
case 'Y':
|
|
|
|
return year;
|
|
|
|
break;
|
|
|
|
case 'd-mm-Y':
|
|
|
|
return day + '-' + monthNamesSmall[(monthIndex)] + '-' + year;
|
|
|
|
break;
|
|
|
|
case 'd-m-Y':
|
|
|
|
return day + '-' + (monthIndex + 1) + '-' + year;
|
|
|
|
break;
|
|
|
|
case 'Y-m-d':
|
|
|
|
return year + '-' + (monthIndex + 1) + '-' + day;
|
|
|
|
break;
|
|
|
|
case 'd-M-Y':
|
|
|
|
return day + ' ' + monthNames[(monthIndex)] + ' ' + year;
|
|
|
|
break;
|
|
|
|
case 'd-m-Y H:i':
|
|
|
|
return day + '-' + (monthIndex + 1) + '-' + year + ', ' + hour + ':' + minute;
|
|
|
|
break;
|
|
|
|
case 'd-M-Y H:i':
|
|
|
|
return day + ' ' + monthNames[(monthIndex)] + ' ' + year + ', ' + hour + ':' + minute;
|
|
|
|
break;
|
|
|
|
case 'd-m-Y H:i:s':
|
|
|
|
return day + '-' + (monthIndex + 1) + '-' + year + ', ' + hour + ':' + minute + ':' + sec;
|
|
|
|
break;
|
|
|
|
case 'd-M-Y H:i:s':
|
|
|
|
return day + ' ' + monthNames[(monthIndex)] + ' ' + year + ', ' + hour + ':' + minute + ':' + sec;
|
|
|
|
break;
|
|
|
|
case 'H:i:s':
|
|
|
|
return hour + ':' + minute + ':' + sec;
|
|
|
|
break;
|
|
|
|
case 'H:i':
|
|
|
|
return hour + ':' + minute;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function G_formatDateM(dates) {
|
|
|
|
var date = new Date(dates);
|
|
|
|
|
|
|
|
var day = ('0' + date.getDate()).slice(-2);
|
|
|
|
var monthIndex = ('0' + (date.getMonth()+1)).slice(-2);
|
|
|
|
var year = date.getFullYear();
|
|
|
|
|
|
|
|
return day + '-' + monthIndex + '-' + year;
|
|
|
|
}
|
|
|
|
|
|
|
|
function G_limit(text, limit) {
|
|
|
|
return (text.length > limit) ? text.substring(0, limit) + "..." : text;
|
|
|
|
}
|
|
|
|
|
|
|
|
function znCheckAll(val) {
|
|
|
|
$('input[name="ck[]"]').prop('checked', val.checked);
|
|
|
|
}
|
|
|
|
|
|
|
|
function znFormatDate(dates) {
|
|
|
|
var date = new Date(dates);
|
|
|
|
|
|
|
|
var monthNames = [
|
|
|
|
"Januari", "Februari", "Maret",
|
|
|
|
"April", "Mei", "Juni", "Juli",
|
|
|
|
"Agustus", "September", "Oktober",
|
|
|
|
"November", "Desember"
|
|
|
|
];
|
|
|
|
|
|
|
|
var day = date.getDate();
|
|
|
|
var monthIndex = date.getMonth();
|
|
|
|
var year = date.getFullYear();
|
|
|
|
|
|
|
|
return day + ' ' + monthNames[(monthIndex)] + ' ' + year;
|
|
|
|
}
|
|
|
|
|
|
|
|
function znFormatDatetime(dates) {
|
|
|
|
var date = new Date(dates);
|
|
|
|
|
|
|
|
var monthNames = [
|
|
|
|
"Januari", "Februari", "Maret",
|
|
|
|
"April", "Mei", "Juni", "Juli",
|
|
|
|
"Agustus", "September", "Oktober",
|
|
|
|
"November", "Desember"
|
|
|
|
];
|
|
|
|
|
|
|
|
var day = date.getDate();
|
|
|
|
var monthIndex = date.getMonth();
|
|
|
|
var year = date.getFullYear();
|
|
|
|
var hour = date.getHours();
|
|
|
|
var minute = date.getMinutes();
|
|
|
|
var sec = date.getSeconds();
|
|
|
|
|
|
|
|
return day + ' ' + monthNames[(monthIndex)] + ' ' + year + ', '+hour+':'+minute+':'+sec;
|
|
|
|
}
|
|
|
|
|
|
|
|
function znRandomString(length) {
|
|
|
|
var result = '';
|
|
|
|
var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
|
|
|
var charactersLength = characters.length;
|
|
|
|
for ( var i = 0; i < length; i++ ) {
|
|
|
|
result += characters.charAt(Math.floor(Math.random() * charactersLength));
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
function znFormatDateNum(dates) {
|
|
|
|
var date = new Date(dates);
|
|
|
|
|
|
|
|
var day = date.getDate();
|
|
|
|
var monthIndex = date.getMonth();
|
|
|
|
var year = date.getFullYear();
|
|
|
|
|
|
|
|
console.log(day + '-' + monthIndex + '-' + year);
|
|
|
|
|
|
|
|
return ("0" + (day)).slice(-2) + '-' + ("0" + (monthIndex + 1)).slice(-2) + '-' + year;
|
|
|
|
}
|
|
|
|
|
|
|
|
function convertDate(dateInput) {
|
|
|
|
var startDate = dateInput;
|
|
|
|
var parts = startDate.split("-");
|
|
|
|
var sd = new Date(Number(parts[2]), Number(parts[1]) - 1, Number(parts[0]));
|
|
|
|
return sd;
|
|
|
|
}
|
|
|
|
|
|
|
|
function znFormatDateClear(dateInput) {
|
|
|
|
var startDate = dateInput;
|
|
|
|
var parts = startDate.split("-");
|
|
|
|
return parts[2] + '-' + parts[1] + '-' + parts[0];
|
|
|
|
}
|
|
|
|
|
|
|
|
/* function loadContent(url, event) {
|
|
|
|
znLoadingPage()
|
|
|
|
// $('.menu-item-active').removeClass('menu-item-active')
|
|
|
|
// event.target.parentNode.parentNode.classList.add('menu-item-active')
|
|
|
|
window.location.href = base_url + url;
|
|
|
|
} */
|
|
|
|
|
|
|
|
//todo ajax content loader
|
|
|
|
function loadContent(url, elm, e) {
|
|
|
|
e.preventDefault();
|
|
|
|
// let path = $(elm).attr('href').replace('#', '');
|
|
|
|
|
|
|
|
|
|
|
|
if(elm!=undefined) {
|
|
|
|
if (elm.id) {
|
|
|
|
$('.menu-item-rel').removeClass('menu-item-here')
|
|
|
|
$("[id^='sb-']").parent('.menu-item').removeClass('menu-item-active');
|
|
|
|
$("[id^='sb-']").parent('.menu-item').removeClass('menu-item-here');
|
|
|
|
$("#"+elm.id).parent('.menu-item').addClass('menu-item-active')
|
|
|
|
$('.menu-item-hover').addClass('menu-item-here')
|
|
|
|
}else{
|
|
|
|
// $('#kt_aside_close_btn').click();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// $('#kt_aside_close_btn').click();
|
|
|
|
// console.log(elm)
|
|
|
|
// $('.menu-item-active').removeClass('menu-item-active')
|
|
|
|
// $(elm).addClass('menu-item-active');
|
|
|
|
|
|
|
|
var path = base_url + url;
|
|
|
|
showPage(path);
|
|
|
|
}
|
|
|
|
|
|
|
|
function showPage(url) {
|
|
|
|
// $('#pageLoad').fadeOut();
|
|
|
|
znLoadingPage();
|
|
|
|
animateCSS('#pageLoad', 'fadeOutUp').then((message) => {
|
|
|
|
$('#pageLoad').html(``);
|
|
|
|
$('#script_master').html(``);
|
|
|
|
let state = {name: "name", page: 'History', url:url};
|
|
|
|
doGet(url, function (msg, data) {
|
|
|
|
znLoadingPageEnd();
|
|
|
|
if (data == null){
|
|
|
|
toastr.error(msg);
|
|
|
|
}else {
|
|
|
|
// znLoadingPageEnd();
|
|
|
|
$('#pageLoad').html(data);
|
|
|
|
$('#pageLoad').hide();
|
|
|
|
reInitForm()
|
|
|
|
window.history.replaceState(state, "History", url);
|
|
|
|
|
|
|
|
setTimeout(function () {
|
|
|
|
$('#pageLoad').show();
|
|
|
|
animateCSS('#pageLoad', 'fadeInUp').then((message) => {
|
|
|
|
// Do something after the animation
|
|
|
|
});
|
|
|
|
}, 200);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// animateCSS('#pageLoad', 'fadeInRight', function () {
|
|
|
|
// });
|
|
|
|
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function resetPassword() {
|
|
|
|
popConfirm("Konfirmasi Proses",
|
|
|
|
`<div class="mt-2">Yakin Akan Me-reset Password ?</div>`, function () {
|
|
|
|
let formData = new FormData();
|
|
|
|
znLoadingPage()
|
|
|
|
doPost(base_url+'user/reset', formData, function (msg, data) {
|
|
|
|
console.log(data);
|
|
|
|
znLoadingPageEnd()
|
|
|
|
if (data == null){
|
|
|
|
znNotif("danger", msg);
|
|
|
|
}else {
|
|
|
|
if(data.rc == 0){
|
|
|
|
znNotif('success','Berhasil Me-reset Password, Password Default: welcome1');
|
|
|
|
znLoadingPage()
|
|
|
|
$('#kt_form_logout').submit()
|
|
|
|
}else{
|
|
|
|
znNotif("danger", data.rm);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function storeChangePass() {
|
|
|
|
validator_change_pass.validate().then(function(status) {
|
|
|
|
if(status == 'Valid') {
|
|
|
|
popConfirm("Konfirmasi Proses",
|
|
|
|
`<div class="mt-2">Yakin Akan Mengubah Password ?</div>`, function () {
|
|
|
|
let formData = new FormData();
|
|
|
|
formData.append('password', $('#change_pass').val())
|
|
|
|
znLoadingModal('mChangePass')
|
|
|
|
doPost(base_url+'user/change', formData, function (msg, data) {
|
|
|
|
znLoadingModalEnd('mChangePass')
|
|
|
|
if (data == null){
|
|
|
|
znNotif("danger", msg);
|
|
|
|
}else {
|
|
|
|
if(data.rc == 0){
|
|
|
|
znNotif('success','Berhasil Mengubah Password');
|
|
|
|
$('#mChangePass').modal('hide')
|
|
|
|
znLoadingPage()
|
|
|
|
$('#kt_form_logout').submit()
|
|
|
|
}else{
|
|
|
|
znNotif("danger", data.data);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
});
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2024-08-29 06:34:58 +00:00
|
|
|
function znShowPassword() {
|
|
|
|
if($('.zn_sh_password input').attr("type") == "text"){
|
|
|
|
$('.zn_sh_password input').attr('type', 'password');
|
|
|
|
$('.zn-icon-eye i').addClass( "la-eye-slash" );
|
|
|
|
$('.zn-icon-eye i').removeClass( "la-eye" );
|
|
|
|
}
|
|
|
|
else if($('.zn_sh_password input').attr("type") == "password"){
|
|
|
|
$('.zn_sh_password input').attr('type', 'text');
|
|
|
|
$('.zn-icon-eye i').removeClass( "la-eye-slash" );
|
|
|
|
$('.zn-icon-eye i').addClass( "la-eye" );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// CHANGE PASSWORD
|
|
|
|
function changePasswordShow() {
|
|
|
|
znNotifConfirmClose()
|
|
|
|
$('#mChangePassword').modal('show');
|
|
|
|
}
|
|
|
|
|
|
|
|
function storeChangePassword() {
|
|
|
|
validatorChangePass.validate().then(function(status) {
|
|
|
|
if(status == 'Valid') {
|
|
|
|
popConfirm("Konfirmasi Proses",
|
|
|
|
`<div class="mt-2">Yakin Akan Mengubah Password ?</div>`, function () {
|
|
|
|
let myForm = document.getElementById('mChangePasswordForm');
|
|
|
|
let formData = new FormData(myForm);
|
|
|
|
znLoadingModal('mChangePassword')
|
|
|
|
doPost(base_url+'user/change-password', formData, function (msg, data) {
|
|
|
|
znLoadingModalEnd('mChangePassword')
|
|
|
|
if (data == null){
|
|
|
|
znNotif("danger", msg);
|
|
|
|
}else {
|
|
|
|
console.log(data)
|
|
|
|
if(data.rc == 0){
|
|
|
|
znNotif('success','Berhasil Mengubah Password');
|
|
|
|
$('#mChangePassword').modal('hide')
|
|
|
|
znLoadingPage()
|
|
|
|
$('#kt_form_logout').submit()
|
|
|
|
}else{
|
|
|
|
znNotif("danger", data.data);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
});
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2024-08-29 03:56:32 +00:00
|
|
|
function modalChangePp() {
|
|
|
|
var changePp = new KTImageInput('kt_image_2_change_pp');
|
|
|
|
znModal('mChangePp')
|
|
|
|
}
|
|
|
|
|
|
|
|
function storeChangePp() {
|
|
|
|
var pp = $('#foto_profil_change_pp').val();
|
|
|
|
var full_name = $('#full_name_change').val();
|
|
|
|
var user_code = $('#user_code_change').val();
|
|
|
|
var phone_number = $('#phone_number_change').val();
|
|
|
|
if(full_name && user_code && phone_number) {
|
|
|
|
popConfirm("Konfirmasi Proses",
|
|
|
|
`<div class="mt-2">Yakin Akan Mengubah Password ?</div>`, function () {
|
|
|
|
let form = document.getElementById('formChangePp');
|
|
|
|
let formData = new FormData(form);
|
|
|
|
znLoadingModal('mChangePp')
|
|
|
|
doPost(base_url+'user/change_pp', formData, function (msg, data) {
|
|
|
|
znLoadingModalEnd('mChangePp')
|
|
|
|
if (data == null){
|
|
|
|
znNotif("danger", msg);
|
|
|
|
}else {
|
|
|
|
if(data.rc == 0){
|
|
|
|
znNotif('success','Berhasil Mengubah Pp');
|
|
|
|
$('#mChangePp').modal('hide')
|
|
|
|
znLoadingPage()
|
|
|
|
location.reload()
|
|
|
|
}else{
|
|
|
|
znNotif("danger", data.data);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
znNotif('warning', 'Data Wajib diisi!');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function readURL(input, img) {
|
|
|
|
if (input.files && input.files[0]) {
|
|
|
|
var reader = new FileReader();
|
|
|
|
|
|
|
|
reader.onload = function(e) {
|
|
|
|
var ext = e.target.result.split(';')
|
|
|
|
if(ext[0] == 'data:application/pdf') {
|
|
|
|
$(img).attr('src','{{ asset('assets/media/logos/pdf.png') }}')
|
|
|
|
} else if(ext[0] == 'data:application/vnd.openxmlformats-officedocument.wordprocessingml.document') {
|
|
|
|
$(img).attr('src','{{ asset('assets/media/logos/word.jpg') }}')
|
|
|
|
} else if(ext[0] == 'data:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet') {
|
|
|
|
$(img).attr('src','{{ asset('assets/media/logos/Excel.png') }}')
|
|
|
|
} else {
|
|
|
|
$(img).attr('src', e.target.result);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
reader.readAsDataURL(input.files[0]); // convert to base64 string
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
<!--end::Global Script Manual-->
|