119 lines
4.2 KiB
JavaScript
119 lines
4.2 KiB
JavaScript
/*******************************************************************
|
|
|
|
App. Name : INVENTORY AND SALES SYSTEMS
|
|
Module : /apps/js/promo/iklan.js
|
|
Desc. : JS - Pengaturan Promo Iklan
|
|
Created By : Siau Pheng ([email protected]).
|
|
Created Date : September 28th, 2014.
|
|
Last Modified : December 10th, 2025.
|
|
|
|
(c) 2014 - 2025, 3FONIA Software; WWW.3FONIA.COM.
|
|
|
|
*******************************************************************/
|
|
|
|
var PromoIklanJS = {
|
|
PHP: '',
|
|
KODE: '',
|
|
|
|
loading: function(){
|
|
this.data_query('detail');
|
|
$('#Cari_Promo').keydown(function(e){
|
|
var key = e.keyCode || e.which || 0;
|
|
if (key==13 && e.target.value!='') this.data_query('detail');
|
|
}.bind(this));
|
|
$('#butSearch').click(function(e){
|
|
this.data_query('detail');
|
|
}.bind(this));
|
|
$('#butAll').click(function(){
|
|
$('#Cari_Promo').val('');
|
|
this.data_query('detail');
|
|
}.bind(this));
|
|
FoniaJS.setFocus('#Cari_Promo');
|
|
},
|
|
|
|
detail_show: function(mode, ID){
|
|
new Request({
|
|
url: this.PHP,
|
|
sendParam: ['data=promo-detail','mode_detail='+mode,'PromoNotaID='+ID],
|
|
onSuccess: function(txt){
|
|
this.winDetail = FoniaJS.showWindow('Detail', 'Detail Promo', txt, 'xl', [{},{i:'butTutup'},{i:'butWSimpan',v:'Simpan',c:'success'}], function(){
|
|
$('#winDetail').find('#butWSimpan').click(function(){this.detail_save();}.bind(this));
|
|
}.bind(this));
|
|
}.bind(this)
|
|
}).send();
|
|
},
|
|
|
|
detail_tambah: function(){
|
|
this.detail_show('insert', 0);
|
|
},
|
|
|
|
detail_ubah: function(acell){
|
|
this.detail_show('update', acell[0]);
|
|
},
|
|
|
|
detail_hapus: function(acell){
|
|
FoniaJS.showConfirm('Konfirmasi', 'Yakin akan hapus <b>"'+acell[2]+'"</b> ?', function(){
|
|
new Request.JSONF({
|
|
url: this.PHP,
|
|
sendParam: ['data=detail','mode_detail=delete','PromoNotaID='+acell[0],'Cari_Promo'],
|
|
onSuccess: function(){
|
|
FoniaJS.showInfo('Proses hapus data sukses!');
|
|
}.bind(this)
|
|
}).send();
|
|
}.bind(this), 'danger');
|
|
},
|
|
|
|
detail_save: function(){
|
|
new Request.JSONF({
|
|
url: this.PHP,
|
|
sendParam: ['data=detail','mode_detail','PromoNotaID','Nama_Promo','Jual_Min','Jual_Grup','CabID','Promo_Iklan','Jumlah_Promo','Tgl_Mulai','Tgl_Akhir','Aktif','Cari_Promo'],
|
|
onSuccess: function(){
|
|
FoniaJS.showInfo('Proses simpan data sukses!');
|
|
FoniaJS.closeWindow(this.winDetail);
|
|
}.bind(this)
|
|
}).send();
|
|
},
|
|
|
|
grup_list: function(){
|
|
new Request.JSON({
|
|
url: this.PHP,
|
|
sendParam: ['data=grup-list','Jual_Grup'],
|
|
onSuccess: function(ajson){
|
|
this.winGrup = FoniaJS.showWindow('Grup', 'Daftar Grup Barang', ajson.html, 'lg', [{i:'butWSAll',v:'Cek Semua',c:'info'},{i:'butWCAll',v:'Hapus Semua',c:'info'},{},{i:'butTutup'},{i:'butWSimpan',v:'Simpan',c:'success'}], function(){
|
|
$('#winGrup')
|
|
.find('#butWSAll').click(function(){this.grup_semua();}.bind(this)).end()
|
|
.find('#butWCAll').click(function(){this.grup_clear();}.bind(this)).end()
|
|
.find('#butWSimpan').click(function(){this.grup_save();}.bind(this));
|
|
}.bind(this));
|
|
}.bind(this)
|
|
}).send();
|
|
},
|
|
|
|
grup_semua: function(){
|
|
$('#tabGrupList').find('input:checkbox').prop('checked', true);
|
|
},
|
|
|
|
grup_clear: function(){
|
|
$('#tabGrupList').find('input:checkbox').prop('checked', false);
|
|
},
|
|
|
|
grup_save: function(){
|
|
var alist = [];
|
|
$('#tabGrupList').find('input:checkbox:checked').each(function(){
|
|
alist.push($(this).val());
|
|
})
|
|
$('#Jual_Grup').val(alist.join());
|
|
FoniaJS.closeWindow(this.winGrup);
|
|
},
|
|
|
|
data_query: function(tipe, mode){
|
|
if (tipe=="detail"){
|
|
new Request.JSONF({
|
|
url: this.PHP,
|
|
sendParam: ['data=detail','Cari_Promo']
|
|
}).send();
|
|
}
|
|
}
|
|
|
|
};
|