You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
119 lines
3.9 KiB
JavaScript
119 lines
3.9 KiB
JavaScript
function addLine(w, a, b) {
|
|
let f = _ff[a](b);
|
|
console.log(f);
|
|
w.appendChild(f);
|
|
}
|
|
|
|
export const addRow = function(par, t = {}) {
|
|
if (_id('second-form') == undefined) {
|
|
let n = div().id('second-form').class('col-12')
|
|
.html(`
|
|
<div style="overflow-x:scroll;border:1px dotted #ddd; padding: 10px;">
|
|
<div style="min-width:800px;grid-gap:5px;display:grid;grid-template-columns:50px auto auto auto" class="mb-1 form">
|
|
</div>
|
|
</div>
|
|
<div style="text-align:center;padding-top:10px;">
|
|
<button style="margin-top:5px;" class="btn btn-success newt"><i class="icon-plus"></i> Tambah Rekening</button>
|
|
</div>
|
|
`);
|
|
_insertAfter(n.get(), par);
|
|
let nm = _id('second-form').querySelector(".form");
|
|
nm.innerHTML = '';
|
|
let nw = _id('second-form').querySelector(".newt");
|
|
nw.datas = t;
|
|
window.globalEventsAdd = nw;
|
|
nw.addEventListener('click', function () {
|
|
let ds = this.datas;
|
|
if (Object.keys(ds).length > 0) {
|
|
window.xnum = ds.tr.number(2);
|
|
} else {
|
|
window.xnum++;
|
|
}
|
|
let f = [
|
|
{
|
|
title: '',
|
|
type: 'num',
|
|
name: 'tr',
|
|
row: 6,
|
|
readonly: true,
|
|
val: (function (ds) {
|
|
if (Object.keys(ds).length > 0) {
|
|
return ds.tr
|
|
}
|
|
return window.xnum;
|
|
})(ds),
|
|
action: function () {
|
|
|
|
},
|
|
},
|
|
{
|
|
title: '',
|
|
type: 'select',
|
|
name: 'akun',
|
|
row: 6,
|
|
readonly: false,
|
|
val: (function (ds) {
|
|
if (Object.keys(ds).length > 0) {
|
|
return ds.akun
|
|
}
|
|
return '';
|
|
})(ds),
|
|
data: acc,
|
|
action: function () {
|
|
|
|
},
|
|
}
|
|
, {
|
|
title: '',
|
|
type: 'text',
|
|
name: 'ket',
|
|
row: 6,
|
|
readonly: false,
|
|
val: (function (ds) {
|
|
if (Object.keys(ds).length > 0) {
|
|
return ds.ket
|
|
}
|
|
return '';
|
|
})(ds),
|
|
action: function () {
|
|
|
|
},
|
|
}
|
|
, {
|
|
title: '',
|
|
type: 'num',
|
|
name: 'jumlah',
|
|
row: 6,
|
|
readonly: false,
|
|
val: (function (ds) {
|
|
if (Object.keys(ds).length > 0) {
|
|
return ds.jumlah.number(2);
|
|
}
|
|
return '0';
|
|
})(ds),
|
|
action: function () {
|
|
|
|
},
|
|
}
|
|
];
|
|
f.forEach(function (x) {
|
|
addLine(nm, x.type, x);
|
|
})
|
|
let v = _getval('app');
|
|
let m = _json('acc').map(function(a){
|
|
return {
|
|
id:a.kode,
|
|
text:a.nama,
|
|
app:a.app,
|
|
}
|
|
}).sortArrayObjectAsc('id');
|
|
if (v.indexOf('acc') == -1 || v.indexOf('usp') == -1) {
|
|
m = m.like('app', v);
|
|
}
|
|
if (_id('second-form') != undefined) {
|
|
_setoptionmulti('second-form', 'akun', m);
|
|
}
|
|
this.datas = {};
|
|
}, false);
|
|
};
|
|
} |