Files
cmasa/app/Scripts/table/ppob/produk.js
T
siaupheng aaaf0a9215 Refactor member and product scripts to use concise method definitions
- Updated all function declarations to use ES6 shorthand method syntax in member.js, member_grup.js, point_barang.js, point_skema.js, point_tipe.js, kategori.js, operator.js, produk.js, produk_grup.js, rekpos.js, satuan.js, supplier.js, and varian.js.
2026-11-01 14:57:54 +07:00

116 lines
4.1 KiB
JavaScript

/*******************************************************************
PHP Class : /Controller/Table/Ppob/ProdukController
Description : Master Produk PPOB
Created By : Siau Pheng ([email protected]).
Created Date : May 19th, 2010.
Last Modified : September 1st, 2026.
(c) 3FONIA Software; WWW.3FONIA.COM.
*******************************************************************/
var PPOBProdukJS = {
PHP: '',
KODE: '',
index() {
this.data_query('tabel-produk');
$('#butPrint').click(() => this.print_show());
$('#butUpdate').click(() => this.update_show());
$('#Cari_Produk').keydown((e) => {
var key = e.keyCode || e.which || 0;
if (key==13 && e.target.value!='') this.data_query('tabel-produk');
});
$('#butSearch').click((e) => this.data_query('tabel-produk'));
$('#butAll').click(() => {
$('#Cari_Produk').val('');
this.data_query('tabel-produk');
});
FoniaJS.setFocus('#Cari_Produk');
},
print_show() {
new Request({
url: this.PHP + '/detail_print',
onSuccess: (ajson) => {
this.winDPrint = FoniaJS.showWindow('DPrint', 'Cetak Daftar Produk PPOB', ajson.html, 'lg', [{},{"i":"butWCetak","v":"Cetak","c":"info"},{"i":"butWPreview","v":"Pratinjau","c":"secondary"}], () => {
$('#winDPrint')
.find('#butWCetak').click(() => this.print_produk(true)).end()
.find('#butWPreview').click(() => this.print_produk());
});
}
}).send();
},
print_produk(prt) {
var cetak = new Printer(this.PHP + '/print_produk');
cetak.add_param("KateID");
cetak.add_param("OpeID");
cetak.add_param("Tgl_Cetak");
if (prt) cetak.doPrint(); else cetak.doPreview();
FoniaJS.closeWindow(this.winDPrint);
},
update_show() {
new Request({
url: this.PHP + '/detail_update',
onSuccess: (ajson) => {
this.winDUpdate = FoniaJS.showWindow('DUpdate', 'Update Produk PPOB', ajson.html, 'lg', [{},{i:'butTutup'},{i:'butWSimpan',v:'Proses',c:'success'}], () => {
$('#winDUpdate').find('#butWSimpan').click(() => this.update_proses());
});
}
}).send();
},
update_proses() {
new Request_JSF({
url: this.PHP + '/proses_update',
sendParam: ['K_Kate','K_Ope'],
onSuccess: (ajson) => {
FoniaJS.closeWindow(this.winDUpdate);
this.data_query('tabel-produk');
}
}).send();
},
produk_show(mode, ID) {
new Request({
url: this.PHP + '/form_produk',
sendParam: ['mode_detail='+mode,'ProdukID='+ID],
onSuccess: (ajson) => {
this.winDetail = FoniaJS.showWindow('Detail', 'Detail Produk PPOB', ajson.html, 'xl', [{},{i:'butBatal'},{i:'butWSimpan',v:'Simpan',c:'success'}], () => {
$('#winDetail').find('#butWSimpan').click(() => this.produk_simpan());
});
}
}).send();
},
produk_ubah(acell) {
this.produk_show('update', acell[0]);
},
produk_simpan() {
new Request_JSF({
url: this.PHP + '/table_produk',
sendParam: ['mode_detail','ProdukID','OpeID','KateID','Nama_Produk='+encodeURIComponent($('#Nama_Produk').val()),'Kode','Harga_Pokok','Harga_Jual','Status','Cari_Produk'],
onSuccess: (adata) => {
if (adata.status){
FoniaJS.showInfo('Proses simpan data sukses!');
} else FoniaJS.showInfo('Ada masalah dalam proses simpan data!');
FoniaJS.closeWindow(this.winDetail);
}
}).send();
},
data_query(tipe, mode) {
if (tipe=="tabel-produk"){
new Request_JSF({
url: this.PHP + '/table_produk',
sendParam: ['Cari_Produk']
}).send();
}
}
};