/******************************************************************* PHP Class : /Controller/System/PrinterController Description : Printer POS Created By : Siau Pheng (siaupheng@3fonia.com). 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', '
 
', '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); } } };