89 lines
2.9 KiB
JavaScript
89 lines
2.9 KiB
JavaScript
/*******************************************************************
|
|
|
|
Module : /apps/js/disp/config.js
|
|
Desc. : JS - Konfigurasi Display POS
|
|
Created By : Siau Pheng ([email protected]).
|
|
Created Date : August 4th, 2013.
|
|
Last Modified : December 7th, 2025.
|
|
|
|
(c) 2013 - 2025, 3FONIA Software; WWW.3FONIA.COM.
|
|
|
|
*******************************************************************/
|
|
|
|
var DISPConfigJS = {
|
|
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-display');
|
|
},
|
|
|
|
cab_brow: function(){
|
|
var _isi = new String('<div id="divBrowCab"> </div>');
|
|
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-display', 'view');
|
|
},
|
|
|
|
proses_edit: function(){
|
|
this.data_query('form-display', 'edit');
|
|
this.load_port();
|
|
},
|
|
|
|
proses_save: function(){
|
|
this.data_query('form-display', 'save');
|
|
},
|
|
|
|
data_query: function(tipe, mode){
|
|
if (tipe=='form-display'){
|
|
new Request.JSON({
|
|
url: this.PHP,
|
|
sendParam: ['data=form-display','mode='+mode,'REG_ID','MON_ENABLE','Text_Run','Warna','Font','Promo_Idle','Promo_Durasi','POLE_ENABLE','POLE_PORT','POLE_START1','POLE_START2','POLE_END1','POLE_END2'],
|
|
onSuccess: function(a){
|
|
$('#divDisplay').html(a.html);
|
|
$('#Nama_Cabang').val(a.Nama_Cabang);
|
|
this.update_event();
|
|
if (a.sukses) FoniaJS.showInfo('Konfigurasi display POS 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);
|
|
}
|
|
},
|
|
|
|
load_port: function(){
|
|
var parent = this;
|
|
qz.serial.findPorts().then(function(data){
|
|
var _selport = $('#POLE_PORT').val();
|
|
$('#POLE_PORT').empty();
|
|
for (var i = 0; i < data.length; i++){
|
|
$('<option/>', {value: data[i]}).text(data[i]).appendTo('#POLE_PORT');
|
|
};
|
|
$('#POLE_PORT').val(_selport);
|
|
});
|
|
}
|
|
|
|
};
|