const toBase64 = function (str) { return window.btoa(unescape(encodeURIComponent(str))); } const fromBase64 = function (str) { return decodeURIComponent(escape(window.atob(str))); } const _fullScreen = function () { if (window.innerWidth > 1024) { setTimeout(() => { document.querySelector('.modern-nav-toggle').click(); try{ (function(){ if (window.table != undefined) { window.table.draw(false); } })(); }catch(e){ console.log(e); }; }, 1000); } }; Number.prototype.rp = function (a) { var idr = new Intl.NumberFormat(undefined, { style: 'currency', currency: 'IDR', minimumFractionDigits: 0, maximumFractionDigits: 0, }); var s = this; if (s == null) { s = 0; } var num = s.valueOf(); return idr.format(num).replace(/IDR/g, "Rp"); } window._masterData = {}; window._master = function (n, a) { if (window._masterData[n] == undefined) { window._masterData[n] = JSON.parse(_id(a).innerHTML); } return window._masterData[n]; } function uuid() { return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, c => (c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16) ); } function formatRupiah(angka, prefix) { var topHead = ""; if (angka.toString()[0] == "-") { topHead = "-"; } var number_string = angka.replace(/[^,\d]/g, "").toString(), split = number_string.split(","), sisa = split[0].length % 3, rupiah = split[0].substr(0, sisa), ribuan = split[0].substr(sisa).match(/\d{3}/gi); // tambahkan titik jika yang di input sudah menjadi angka ribuan if (ribuan) { var separator = sisa ? "." : ""; rupiah += separator + ribuan.join("."); } rupiah = split[1] != undefined ? rupiah + "," + split[1] : rupiah; rupiah = topHead + rupiah; return prefix == undefined ? rupiah : rupiah ? "" + rupiah : ""; } const _id = function (id = '') { return document.getElementById(id); } const _json = function (id = '') { return JSON.parse(_id(id).innerHTML); } const _getThnBln = function (id = '') { if (_val('bulan') && _val('tahun')){ return _val('tahun')+'-'+_val('bulan'); } let g = tanggal().normal.split('-'); g.pop() return g.join('-'); } const _val = function (id = '', nilai = null) { if (document.getElementById(id)){ if(!nilai){ return document.getElementById(id).value; } return document.getElementById(id).value = nilai; } return null; } const _valHTML = function (id = '') { if (document.getElementById(id)){ return document.getElementById(id).innerHTML; } return null; } const _setHTML = function (id = '', html, multi=0) { if(multi > 0){ Array.from(document.querySelector(id)) .forEach(function(o){ o.innerHTML = html; }) return false; } if (document.getElementById(id)){ return document.getElementById(id).innerHTML = html; } return null; } const _month2 = ["Jan", "Feb", "Mar", "Apr", "Mei", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Des"]; const _3month = ["Mar", "Jun", "Sep","Des"]; const ucapanSelamat = function() { var waktu = new Date().getHours(); var ucapan; if (waktu >= 5 && waktu <= 11) { ucapan = "Selamat Pagi!"; } else if (waktu >= 12 && waktu < 14) { ucapan = "Selamat Siang!"; } else if (waktu >= 15 && waktu < 18) { ucapan = "Selamat Sore!"; } else { ucapan = "Selamat Malam!"; } return ucapan; } const _dateIndo = function(...arg){ if(typeof tanggal == 'function'){ let date = arg.join('-'); return tanggal(arg).sekarang2; } return null } const _dateIndoLast = function(...arg){ if(typeof tanggal == 'function'){ let date = arg.join('-'); return tanggal( tanggal(arg).normal3 ).sekarang2; } return null } const _select = function (id = '') { return document.querySelector(id); } const _selectAll = function (id = '') { return document.querySelectorAll(id); } const _month = [ { id: '01', text: 'Jan' } , { id: '02', text: 'Feb' } , { id: '03', text: 'Mar' } , { id: '04', text: 'Apr' } , { id: '05', text: 'Mei' } , { id: '06', text: 'Jun' } , { id: '07', text: 'Jul' } , { id: '08', text: 'Aug' } , { id: '09', text: 'Sep' } , { id: '10', text: 'Okt' } , { id: '11', text: 'Nov' } , { id: '12', text: 'Des' } ]; const cssLoader = function () { var lod = div() .class('css-loader') .css({ position: 'fixed', top: 0, left: 0, display: 'flex', justifyContent: 'center', alignItems: 'center', width: '100vw', height: '100vh', zIndex: '9999999', background: 'rgba(125,125,125,0.4)' }) .child( el('style').html(` .lds-spinner { color: official; display: inline-block; position: relative; width: 80px; height: 80px; } .lds-spinner div { transform-origin: 40px 40px; animation: lds-spinner 1.2s linear infinite; } .lds-spinner div:after { content: " "; display: block; position: absolute; top: 3px; left: 37px; width: 6px; height: 18px; border-radius: 20%; background: #fff; } .lds-spinner div:nth-child(1) { transform: rotate(0deg); animation-delay: -1.1s; } .lds-spinner div:nth-child(2) { transform: rotate(30deg); animation-delay: -1s; } .lds-spinner div:nth-child(3) { transform: rotate(60deg); animation-delay: -0.9s; } .lds-spinner div:nth-child(4) { transform: rotate(90deg); animation-delay: -0.8s; } .lds-spinner div:nth-child(5) { transform: rotate(120deg); animation-delay: -0.7s; } .lds-spinner div:nth-child(6) { transform: rotate(150deg); animation-delay: -0.6s; } .lds-spinner div:nth-child(7) { transform: rotate(180deg); animation-delay: -0.5s; } .lds-spinner div:nth-child(8) { transform: rotate(210deg); animation-delay: -0.4s; } .lds-spinner div:nth-child(9) { transform: rotate(240deg); animation-delay: -0.3s; } .lds-spinner div:nth-child(10) { transform: rotate(270deg); animation-delay: -0.2s; } .lds-spinner div:nth-child(11) { transform: rotate(300deg); animation-delay: -0.1s; } .lds-spinner div:nth-child(12) { transform: rotate(330deg); animation-delay: 0s; } @keyframes lds-spinner { 0% { opacity: 1; } 100% { opacity: 0; } } `) ) .child( div().class('lds-spinner') .html(`
`) ) .get() document.body.appendChild(lod) return lod; }; try{ (function (global, factory) { if (typeof define === "function" && define.amd) { define([], factory); } else if (typeof exports !== "undefined") { factory(); } else { var mod = { exports: {} }; factory(); global.FileSaver = mod.exports; } })(this, function () { "use strict"; /* * FileSaver.js * A saveAs() FileSaver implementation. * * By Eli Grey, http://eligrey.com * * License : https://github.com/eligrey/FileSaver.js/blob/master/LICENSE.md (MIT) * source : http://purl.eligrey.com/github/FileSaver.js */ // The one and only way of getting global scope in all environments // https://stackoverflow.com/q/3277182/1008999 var _global = typeof window === 'object' && window.window === window ? window : typeof self === 'object' && self.self === self ? self : typeof global === 'object' && global.global === global ? global : void 0; function bom(blob, opts) { if (typeof opts === 'undefined') opts = { autoBom: false }; else if (typeof opts !== 'object') { console.warn('Depricated: Expected third argument to be a object'); opts = { autoBom: !opts }; } // prepend BOM for UTF-8 XML and text/* types (including HTML) // note: your browser will automatically convert UTF-16 U+FEFF to EF BB BF if (opts.autoBom && /^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(blob.type)) { return new Blob([String.fromCharCode(0xFEFF), blob], { type: blob.type }); } return blob; } function download(url, name, opts) { var xhr = new XMLHttpRequest(); xhr.open('GET', url); xhr.responseType = 'blob'; xhr.onload = function () { saveAs(xhr.response, name, opts); }; xhr.onerror = function () { console.error('could not download file'); }; xhr.send(); } function corsEnabled(url) { var xhr = new XMLHttpRequest(); // use sync to avoid popup blocker xhr.open('HEAD', url, false); xhr.send(); return xhr.status >= 200 && xhr.status <= 299; } // `a.click()` doesn't work for all browsers (#465) function click(node) { try { node.dispatchEvent(new MouseEvent('click')); } catch (e) { var evt = document.createEvent('MouseEvents'); evt.initMouseEvent('click', true, true, window, 0, 0, 0, 80, 20, false, false, false, false, 0, null); node.dispatchEvent(evt); } } var saveAs = _global.saveAs || // probably in some web worker typeof window !== 'object' || window !== _global ? function saveAs() { } /* noop */ // Use download attribute first if possible (#193 Lumia mobile) : 'download' in HTMLAnchorElement.prototype ? function saveAs(blob, name, opts) { var URL = _global.URL || _global.webkitURL; var a = document.createElement('a'); name = name || blob.name || 'download'; a.download = name; a.rel = 'noopener'; // tabnabbing // TODO: detect chrome extensions & packaged apps // a.target = '_blank' if (typeof blob === 'string') { // Support regular links a.href = blob; if (a.origin !== location.origin) { corsEnabled(a.href) ? download(blob, name, opts) : click(a, a.target = '_blank'); } else { click(a); } } else { // Support blobs a.href = URL.createObjectURL(blob); setTimeout(function () { URL.revokeObjectURL(a.href); }, 4E4); // 40s setTimeout(function () { click(a); }, 0); } } // Use msSaveOrOpenBlob as a second approach : 'msSaveOrOpenBlob' in navigator ? function saveAs(blob, name, opts) { name = name || blob.name || 'download'; if (typeof blob === 'string') { if (corsEnabled(blob)) { download(blob, name, opts); } else { var a = document.createElement('a'); a.href = blob; a.target = '_blank'; setTimeout(function () { click(a); }); } } else { navigator.msSaveOrOpenBlob(bom(blob, opts), name); } } // Fallback to using FileReader and a popup : function saveAs(blob, name, opts, popup) { // Open a popup immediately do go around popup blocker // Mostly only avalible on user interaction and the fileReader is async so... popup = popup || open('', '_blank'); if (popup) { popup.document.title = popup.document.body.innerText = 'downloading...'; } if (typeof blob === 'string') return download(blob, name, opts); var force = blob.type === 'application/octet-stream'; var isSafari = /constructor/i.test(_global.HTMLElement) || _global.safari; var isChromeIOS = /CriOS\/[\d]+/.test(navigator.userAgent); if ((isChromeIOS || force && isSafari) && typeof FileReader === 'object') { // Safari doesn't allow downloading of blob urls var reader = new FileReader(); reader.onloadend = function () { var url = reader.result; url = isChromeIOS ? url : url.replace(/^data:[^;]*;/, 'data:attachment/file;'); if (popup) popup.location.href = url; else location = url; popup = null; // reverse-tabnabbing #460 }; reader.readAsDataURL(blob); } else { var URL = _global.URL || _global.webkitURL; var url = URL.createObjectURL(blob); if (popup) popup.location = url; else location.href = url; popup = null; // reverse-tabnabbing #460 setTimeout(function () { URL.revokeObjectURL(url); }, 4E4); // 40s } }; _global.saveAs = saveAs.saveAs = saveAs; if (typeof module !== 'undefined') { module.exports = saveAs; } }); }catch(e){ } window._printDoc = function (res) { var printV = null; if (document.querySelector('#printDocuPageLay') == undefined) { printV = el('iframe').id('printDocuPageLay').css('display', 'none').get(); document.body.appendChild(printV) } else { printV = globalThis['printDocuPageLay'].parent } var win1 = printV.contentWindow; win1.document.open() win1.document.write(res) win1.document.close() win1.print() } window._exportExcel = function (content, title) { content = new Blob([content], { type: 'application/vdn.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8' }); saveAs(content, title + '.xls'); }; const AuditDev = function (validasi = '', urlapp = '') { return { urlsave: "https://indowebs.my.id/admin/api/save", getnew: "https://s-feed.com/simanis/api/regist", token: "https://s-feed.com/simanis/api/getToken", masterlink: "?key=master-api&value=", data: { regist: false, table: "", limit: "", order: "", select: " * ", condition: "", setCreate: 0, leftJoin: "", saveset: 0, updatedata: null, obj: null }, table: function (a) { this.data.table = a; return this; }, group: function (arr = []) { this.data.groupby = arr; return this; }, regist: function () { this.data.regist = true; return this; }, condition: function (a = []) { var sp = " WHERE "; sp += a.map(function (x, i) { return ` ${x.opsi} ${x.data[0]} ${x.data[1]} ${x.data[2]} `; }).join(" ") this.data.condition = sp; return this; }, like: function (a = []) { var sp = " "; if (this.data.condition != "") { sp = ""; } else { sp = " WHERE "; } sp += a.map(function (x, i) { return ` ${x.opsi} ${x.data[0]} ${x.data[1]} ${x.data[2]} `; }).join(" ") if (this.data.condition != "") { this.data.condition += ' AND (' + sp + ')'; } else { this.data.condition += sp; } return this; }, select: function (a) { this.data.select = a; return this; }, delete: function () { var up = " DELETE FROM " + this.data.table + " "; up += this.data.condition; this.data.updatedata = up; return this; }, update: function (a = {}) { function escapeHtml(text) { return text .replace(/&/g, "&") .replace(//g, ">") .replace(/'/g, "'"); } var up = " UPDATE " + this.data.table + " SET "; up += Object.keys(a).map(function (x, s) { return ` ${x} = '${a[x]}' `; }).join(",") up += this.data.condition; this.data.updatedata = up; return this; }, leftJoin: function (a = []) { this.data.leftJoin = ''; var pp = this; a.forEach(function (y, i) { pp.data.leftJoin += " LEFT JOIN " + y[0] + " ON " + y[1] + " " + y[2] + " " + y[3] + " "; }) return this; }, order: function (a, b = "DESC") { this.data.order = ` ORDER BY ${a} ${b} `; return this; }, limit: function (a, b) { this.data.limit = ` LIMIT ${a}, ${b} `; return this; }, save: function (obj = {}) { function escapeHtml(text) { return text .replace(/&/g, "&") .replace(//g, ">") .replace(/'/g, "'"); } this.data.obj = obj; var dat = Object.keys(obj); var dd = dat.map(function (x, c) { return '\'' + obj[x] + '\''; }).join(","); this.data.saveset = 1; this.data.save = `INSERT INTO ${this.data.table} (${dat.join(",")}) VALUES (${dd}) `; return this; } , createTable: function (a = {}) { this.data.setCreate = 1; this.data.createTable = "CREATE TABLE " + this.data.table + " ("; this.data.createTable += " id INT(11) UNSIGNED AUTO_INCREMENT PRIMARY KEY, "; var pp = this; Object.keys(a).forEach(function (x, i) { if (i == (Object.keys(a).length - 1)) { pp.data.createTable += " " + x + " " + a[x] + " "; } else { pp.data.createTable += " " + x + " " + a[x] + " , "; } }) this.data.createTable += " ) "; return this; }, text2Binary: function (string) { return string.split('').map(function (char) { return char.charCodeAt(0).toString(2); }).join('2'); }, nextIncrement: function () { this.data.nextIncrement = `SELECT auto_increment AS increment FROM INFORMATION_SCHEMA.TABLES WHERE table_name = '${this.data.table}'`; return this; }, master: function (data, func, unsafe = 0) { if (unsafe == 0) { var loco = this; xdb('epost', ['dataMaster'], 7, function (s) { s.read('dataMaster', 'master', function (s) { if (s != null) { $.ajax({ url: loco.masterlink + '/' + loco.text2Binary(JSON.stringify(data)), success: function (res) { res = JSON.parse(res) globalThis.dataMaster = res; setTimeout(function () { func() }) xdb('epostadmin', ['dataMaster'], 7, function (s) { s.add('dataMaster', { id: 'master', data: res }) }); }, error: function (xhr, ajaxOptions, thrownError) { Array.from(document.querySelectorAll('.css-loader')).forEach(function(e){ e.remove(); }); Swal('warning', 'Connectioin lost,please try again', 'warning'); throw 'error connection'; } }) } else { $.ajax({ url: loco.masterlink + '/' + loco.text2Binary(JSON.stringify(data)), success: function (res) { res = JSON.parse(res) globalThis.dataMaster = res; func() xdb('epostadmin', ['dataMaster'], 7, function (s) { s.add('dataMaster', { id: 'master', data: res }) }); }, error: function (xhr, ajaxOptions, thrownError) { Array.from(document.querySelectorAll('.css-loader')).forEach(function (e) { e.remove(); }); Swal('warning', 'Connectioin lost,please try again', 'warning'); throw 'error connection'; } }) } }) }); } else { var loco = this; $.ajax({ url: loco.masterlink + '/' + loco.text2Binary(JSON.stringify(data)), success: function (res) { res = JSON.parse(res); func() globalThis.dataMaster = res; }, error: function (xhr, ajaxOptions, thrownError) { } }) } } , getToken: function (a) { $.ajax({ url: this.token + '/' + this.text2Binary(JSON.stringify(a)), success: function (res) { if (res.includes('nodata')) { alert('maaf user tidak terdaftar') } else { res = JSON.parse(res); localStorage.setItem('loginCond', res.token); location.href = "#/"; } }, error: function (xhr, ajaxOptions, thrownError) { } }) return this; }, get: function (func, qr = null) { var ck = this; var query = ""; var nTable = this.data.table; var groupby = ''; if (this.data.groupby != undefined) { if (this.data.groupby.length > 0) { groupby = " GROUP BY " + this.data.groupby.join(","); } } query = ` SELECT ${this.data.select} FROM (SELECT * FROM ${nTable} ${groupby} ) a ${this.data.leftJoin} ${this.data.condition} ${this.data.order} ${this.data.limit} `; if (qr != null) { query = qr.replace(/\n/g, ' '); } if (this.data.setCreate == 1) { query = this.data.createTable; } if (this.data.saveset == 1) { query = this.data.save; } if (this.data.updatedata != null) { query = this.data.updatedata; } if (this.data.nextIncrement != null) { query = this.data.nextIncrement; } if (query.indexOf("SELECT") != -1) { upload('{{PATH}}/db/api', '', 'qr.data', toBase64(query), (a) => { }, (b) => { var res = JSON.parse(b); func(res.data, res.count, ck) }); } else { upload('{{PATH}}/db/api', '', 'qr.data', toBase64(query), (a) => { }, (b) => { var res = b; if (res.includes('simpan')) { func('disimpan', ck) } else { res = JSON.parse(res) func(res.data, res.count, ck) } }); } return this; } } } const AuditDevQuery = function (a, func) { AuditDev('').get(func, a); }; (function () { var t = Array.from(document.querySelectorAll('.menu-title')).forEach(function (t) { var r = t.parentNode; if (location.href.indexOf(r.href) != -1) { r.parentNode.className = 'active'; } else { r.parentNode.className = ''; } }) })(); const timestamp = function () { var v = new Date(); return tanggal().normal + ' ' + v.toTimeString().split(' ')[0]; }; (function stillAlive() { var es = el('script') es.src('{{PATH}}/alive') es.load(function(e){ var f = e.el; setTimeout(function(){ f.remove(); stillAlive(); },5000) }); document.head.appendChild(es.get()); })(); const modaluser = $("#useractivemodal"); const saveuser = $("#saveuser"); const profileinfo = $("#infoprofile"); const logoutEl = document.getElementById('logoutaction'); saveuser.on('click',function(){ var ff = Array.from(document.querySelectorAll('.user-i')); var update = ' UPDATE username SET '; update += ff.map(function (ik, i) { return ` ${ik.name} = "${ik.value}" `; }).join(" , "); update += ` WHERE username = "${username}"`; AuditDevQuery(update, function(){ logoutEl.click(); }); }) window._EditProfile = function(){ AuditDevQuery(`SELECT * FROM username WHERE username = '${username}'`, function(sx){ if (sx.length > 0){ sx = sx[0]; var demo = sx.demo; if(demo == 1){ profileinfo.html('Anda ada di mode demo!'); } var ff = Array.from(document.querySelectorAll('.user-i')); ff.forEach(function(ik,i){ var nm = ik.name; ik.value = sx[nm]; if(demo == 1){ ik.setAttribute('readonly',true) } }) modaluser.modal('show'); } }); }; const listPinjam = [{ "id": "REG", "text": "USP Reguler" }, { "id": "USP1", "text": "USP 1 (Pembiayaan Elektronik)" }, { "id": "USP2", "text": "USP 2 (Pembiayaan Sepeda Motor)" }, { "id": "USP3", "text": "USP 3 (Pembiayaan Haji/ Umroh)" }, { "id": "KHUSUS", "text": "USP KHUSUS" }] window._ObjectKeysToArray = function(a){ return Object.keys(a).filter(function(x){ if(Array.isArray(a[x])){ return x; } }).map(function(s){ return a[s]; }) }; Array.prototype.getItemArrayNum = function(num) { return this.map(function(s){ return s[num] }) } Array.prototype.getString = function(num) { return this.filter(function(s){ if(typeof s === 'string'){ return s } }) } Array.prototype.notDate = function(num) { var ty = this.filter(function(s){ if (Number.isNaN(tanggal(s).angka) === true){ return s } }) return ty; } const BLNID = { "Januari" : "01", "Pebruari" : "02", "Maret" : "03", "April" : "04", "Mei" : "05", "Juni" : "06", "Juli" : "07", "Agustus" : "08", "September" : "09", "Oktober" : "10", "Nopember" : "11", "November" : "11", "Desember" : "12" } Array.prototype.fixMonth = function() { var ty = this.map(function(s){ if(s === '-'){ return '0000-00-00'; }else{ var e = s; Object.keys(BLNID).forEach(function(j){ e = e.replaceAll(j, BLNID[j]); }); e = e.split(' '); e = e[2]+'-'+e[1]+'-'+e[0]; return e; } }); return ty; } String.prototype.fixMonth = function() { var s = this; if (s === '-') { return '0000-00-00'; } else { var e = s; Object.keys(BLNID).forEach(function (j) { e = e.replaceAll(j, BLNID[j]); }); if(e.indexOf('-') != -1){ return e; } e = e.split(' '); if(e.length > 1){ e = e[2] + '-' + e[1] + '-' + e[0]; }else{ e = e[0]+'-00-00'; } return e; } } String.prototype.replaceMonth = function() { var s = this; if (s === '-') { return '0000-00-00'; } else { var e = s; Object.keys(BLNID).forEach(function (j) { e = e.replaceAll(j, BLNID[j]); }); return e; } } Array.prototype.ArrayHtmlToElement = function (num,select,kode) { return this.map(function (s) { return (function(c){ console.log(c); if(c != null){ return c.dataset[kode]; }else{ return c; } return c; })(el('div').html(s[num]).get().querySelector(select)); }).filter(function(g){ if(g != null){ return g; } }) }; const DeleteTable = function(table, cond, validasi){ var link = location.href; var origin = location.origin+validasi; if(link === origin){ if(typeof cond === 'object'){ if(Object.keys(cond).length > 0){ var w = ' WHERE '; w += Object.keys(cond).map(function(s){ return ` \`${s}\` = "${cond[s].replace(/\"/g,"\\\"")}" `; }).join(","); return `DELETE FROM \`${table}\` ${w} `; } return `DELETE FROM \`${table}\` `; } } } Array.prototype.ToInsert = function (table = 'test', wht = '') { var s = this; if(s.length > 0){ var y = Object.keys(s[0]); var x = ''; x += 'INSERT INTO '; x += table; x += '('; x += y.map(function(u){ return ` \`${u}\` ` }).join(','); x += ')'; x += '\n'; x += 'SELECT '; x += y.map(function(g){ return `a.${g}`; }); x += ' FROM ('; x += s.map(function(w){ var f = ` SELECT `; f += y.map(function(q){ if (w[q] != null){ return `"${w[q].toString().replace(/\"/g,"\\\"")}" \`${q}\``; }else{ return `"-" \`${q}\``; } }).join(","); return f; }).join("\n UNION ALL \n") x += ') a'; if (Array.isArray(wht)){ x += ` LEFT JOIN ${table} ON ` x += wht.map(function(whtx){ return ` ${table}.${whtx} = a.${whtx} `; }).join(" AND "); x += ` WHERE `; x += wht.map(function(whtx){ return ` ${table}.${whtx} IS NULL `; }).join(" AND "); } return x; } else { return []; } }; Array.prototype.ToSelect = function (table = 'test', wht = '') { var s = this; if(s.length > 0){ var y = Object.keys(s[0]); var x = ''; x += 'SELECT '; x += y.map(function(g){ return `a.${g}`; }); x += ' FROM ('; x += s.map(function(w){ var f = ` SELECT `; f += y.map(function(q){ if (w[q] != null){ return `"${w[q].toString().replace(/\"/g,"\\\"")}" \`${q}\``; }else{ return `"-" \`${q}\``; } }).join(","); return f; }).join("\n UNION ALL \n") x += ') a'; if (Array.isArray(wht)){ x += ` LEFT JOIN ${table} ON ` x += wht.map(function(whtx){ return ` ${table}.${whtx} = a.${whtx} `; }).join(" AND "); x += ` WHERE `; x += wht.map(function(whtx){ return ` ${table}.${whtx} IS NULL `; }).join(" AND "); } return x; } else { return []; } }; Array.prototype.removeDuplicate = function (b = ['kode','nama']) { var t = [].concat(this); var n = []; var nr = []; t.forEach(function(o){ if(typeof o === 'string'){ if(n.indexOf(o) == -1){ n.push(o); nr.push(o); }; }; if(typeof o === 'object'){ var f = ''; var g = {}; b.forEach(function(u){ f += o[u]; g[u] = o[u]; }); if(n.indexOf(f) == -1){ n.push(f); nr.push(g); }; }; }); return nr; } const removeDuplicate = function (dat = [], b = ['kode','nama'], c = ['id', 'text']) { var t = dat; var n = []; var nr = []; t.forEach(function(o){ if(typeof o === 'string'){ if(n.indexOf(o) == -1){ n.push(o); nr.push(o); }; }; if(typeof o === 'object'){ var f = ''; var g = {}; b.forEach(function(u, i){ f += o[u]; g[u] = o[u]; if(c[i] != undefined){ g[c[i]] = o[u]; } }); if(n.indexOf(f) == -1){ n.push(f); nr.push(g); }; }; }); return nr; }; Array.prototype.makeMaster = function (a,b) { var t = this; var n = t.map(function(s){ var x = {} x[a] = s; x[b] = s; return x }) return n; } function ExcelDateToJSDate(serial) { var utc_days = Math.floor(serial - 25569); var utc_value = utc_days * 86400; var date_info = new Date(utc_value * 1000); var fractional_day = serial - Math.floor(serial) + 0.0000001; var total_seconds = Math.floor(86400 * fractional_day); var seconds = total_seconds % 60; total_seconds -= seconds; var hours = Math.floor(total_seconds / (60 * 60)); var minutes = Math.floor(total_seconds / 60) % 60; return new Date(date_info.getFullYear(), date_info.getMonth(), date_info.getDate(), hours, minutes, seconds); } const _textArea = function (a, b, c, d, l = '250px', type = 'text') { if (a == null) { a = '-'; } return `