Files
cmasa/app/Scripts/system/printer.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

74 lines
2.3 KiB
JavaScript

/*******************************************************************
PHP Class : /Controller/System/PrinterController
Description : Printer POS
Created By : Siau Pheng ([email protected]).
Created Date : August 4th, 2013.
Last Modified : October 12th, 2026.
(c) 3FONIA Software; WWW.3FONIA.COM.
*******************************************************************/
var PrinterJS = {
PHP: '',
KODE: '',
index() {
$('#butBrow').click(() => this.cab_brow());
$('#butUbah').click(() => this.proses_edit());
$('#butSimpan').click(() => this.proses_save());
this.data_query('form-printer');
},
cab_brow() {
this.winBCab = FoniaJS.showWindow('BCab', 'Daftar Cabang', '<div id="divBrowCab">&nbsp;</div>', 'lg', '', () => this.data_query('brow-cabang'));
},
cab_select(acell) {
FoniaJS.closeWindow(this.winBCab);
$('#REG_ID').val(acell[0]);
this.data_query('form-printer', 'view');
},
proses_edit() {
this.data_query('form-printer', 'edit');
},
proses_save() {
this.data_query('form-printer', 'save');
},
data_query(tipe, mode) {
if (tipe === 'form-printer'){
new Request({
url: this.PHP + '/form_printer',
sendParam: ['mode='+mode,'REG_ID','PRINT_AUTO','PRINT_OPENCD','PRINT_AUTOCUT','PRINT_ROW','TITLE_BEGIN','TITLE_END'],
onSuccess: (ajson) => {
$('#divPrinter').html(ajson.html);
$('#Nama_Cabang').val(ajson.Nama_Cab);
this.update_event();
if (ajson.sukses) FoniaJS.showInfo('Konfigurasi printer sukses disimpan!');
}
}).send();
} else if (tipe=='brow-cabang'){
new Request_JSF({
url: this.PHP + '/brow_cabang',
}).send();
}
},
update_event() {
if ($.inArray($('#mode').val(), ['edit']) >= 0) {
$('#butBrow').prop('disabled', true);
$('#butUbah').prop('disabled', true);
$('#butSimpan').prop('disabled', false);
} else {
$('#butBrow').prop('disabled', false);
$('#butUbah').prop('disabled', false);
$('#butSimpan').prop('disabled', true);
}
}
};