/******************************************************************* Module : /apps/js/sys/printer.js Desc. : JS - Konfigurasi Printer POS Created By : Siau Pheng (siaupheng@3fonia.com). Created Date : August 4th, 2013. Last Modified : December 7th, 2025. (c) 2013 - 2025, 3FONIA Software; WWW.3FONIA.COM. *******************************************************************/ var PrinterJS = { PHP: '', KODE: '', loading: function(){ $('#butBrow').click(function(){this.cab_brow();}.bind(this)); $('#butUbah').click(function(){this.proses_edit();}.bind(this)); $('#butSimpan').click(function(){this.proses_save();}.bind(this)); this.data_query('form-printer'); }, cab_brow: function(){ var _isi = new String('
 
'); this.winBCab = FoniaJS.showWindow('BCab', 'Daftar Cabang', _isi, 'lg', '', function(){ this.data_query('brow-cabang'); }.bind(this)); }, cab_select: function(acell){ FoniaJS.closeWindow(this.winBCab); $('#REG_ID').val(acell[0]); this.data_query('form-printer', 'view'); }, proses_edit: function(){ this.data_query('form-printer', 'edit'); }, proses_save: function(){ this.data_query('form-printer', 'save'); }, data_query: function(tipe, mode){ if (tipe=='form-printer'){ new Request.JSON({ url: this.PHP, sendParam: ['data=form-printer','mode='+mode,'REG_ID','PRINT_AUTO','PRINT_OPENCD','PRINT_AUTOCUT','PRINT_ROW','TITLE_END'], onSuccess: function(a){ $('#divPrinter').html(a.html); $('#Nama_Cabang').val(a.Nama_Cabang); this.update_event(); if (a.sukses) FoniaJS.showInfo('Konfigurasi printer sukses disimpan!'); }.bind(this) }).send(); } else if (tipe=='brow-cabang'){ new Request.JSONF({ url: this.PHP, sendParam: ['data=brow-cabang'] }).send(); } }, update_event: function(){ if ($.inArray($('#mode').val(), ['edit']) >= 0) { $('#butUbah').prop('disabled', true); $('#butSimpan').prop('disabled', false); } else { $('#butUbah').prop('disabled', false); $('#butSimpan').prop('disabled', true); } } };