- 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.
115 lines
4.0 KiB
JavaScript
115 lines
4.0 KiB
JavaScript
/*******************************************************************
|
|
|
|
PHP Class : /Controller/Display/IklanController
|
|
Description : Konfigurasi Display Iklan POS
|
|
Created By : Siau Pheng ([email protected]).
|
|
Created Date : January 15th, 2015.
|
|
Last Modified : August 31st, 2026.
|
|
|
|
(c) 3FONIA Software; WWW.3FONIA.COM.
|
|
|
|
*******************************************************************/
|
|
|
|
var DISPIklanJS = {
|
|
PHP: '',
|
|
KODE: '',
|
|
|
|
index() {
|
|
this.data_query('detail');
|
|
$('#Cari_Iklan').keydown((e) => {
|
|
var key = e.keyCode || e.which || 0;
|
|
if (key==13 && e.target.value!='') this.data_query('detail');
|
|
});
|
|
$('#butSearch').click(() => this.data_query('detail'));
|
|
$('#butAll').click(() => {
|
|
$('#Cari_Iklan').val('');
|
|
this.data_query('detail');
|
|
});
|
|
FoniaJS.setFocus('#Cari_Iklan');
|
|
},
|
|
|
|
detail_show(mode, ID) {
|
|
new Request({
|
|
url: this.PHP + '/form_iklan',
|
|
sendParam: ['mode_detail='+mode,'PromoID='+ID],
|
|
onSuccess: (ajson) => {
|
|
this.winDetail = FoniaJS.showWindow('Detail', 'Detail Informasi Iklan', ajson.html, 900, [{},{i:'butTutup'},{i:'butWSimpan',v:'Simpan',c:'success'}], () => {
|
|
$('#winDetail')
|
|
.find('#butWSimpan').click(() => this.detail_save()).end()
|
|
.find('#FileGambar').off('change').change(() => {
|
|
var fd = new FormData(), files = $('#FileGambar')[0].files[0];
|
|
fd.append('Gambar1', files);
|
|
fd.append('PromoID', $('#PromoID').val());
|
|
$.ajax({
|
|
url: this.PHP + '/upload_picture',
|
|
type: 'post',
|
|
data: fd,
|
|
contentType: false,
|
|
processData: false,
|
|
success: (ares) => {
|
|
if (ares.result != 0){
|
|
FoniaJS.showInfo('Sukses upload file Gambar !');
|
|
$('#PromoID').val(ares.PromoID);
|
|
this.get_picture();
|
|
} else {
|
|
FoniaJS.showError(ares.message);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
this.get_picture();
|
|
});
|
|
}
|
|
}).send();
|
|
},
|
|
|
|
detail_tambah() {
|
|
this.detail_show('insert', 0);
|
|
},
|
|
|
|
detail_ubah(acell) {
|
|
this.detail_show('update', acell[0]);
|
|
},
|
|
|
|
detail_hapus(acell) {
|
|
FoniaJS.showConfirm('Konfirmasi', 'Yakin akan hapus <b>"'+acell[2]+'"</b> ?', () => {
|
|
new Request_JSF({
|
|
url: this.PHP + '/table_detail',
|
|
sendParam: ['mode_detail=delete','PromoID='+acell[0],'Cari_Iklan'],
|
|
onSuccess: () => FoniaJS.showInfo('Proses hapus data sukses!')
|
|
}).send();
|
|
}, 'danger');
|
|
},
|
|
|
|
detail_save() {
|
|
new Request_JSF({
|
|
url: this.PHP + '/table_detail',
|
|
sendParam: ['mode_detail','PromoID','CabID','Tanggal','Info','Aktif','Cari_Iklan'],
|
|
onSuccess: () => {
|
|
FoniaJS.showInfo('Proses simpan data sukses!');
|
|
FoniaJS.closeWindow(this.winDetail);
|
|
}
|
|
}).send();
|
|
},
|
|
|
|
data_query(tipe, mode) {
|
|
if (tipe=="detail"){
|
|
new Request_JSF({
|
|
url: this.PHP + '/table_detail',
|
|
sendParam: ['Cari_Iklan']
|
|
}).send();
|
|
}
|
|
},
|
|
|
|
get_picture() {
|
|
new Request({
|
|
url: this.PHP + '/get_picture',
|
|
sendParam: ['PromoID'],
|
|
onSuccess: (ajson) => {
|
|
$('#imgPhoto').attr('src', ajson.src);
|
|
}
|
|
}).send();
|
|
}
|
|
|
|
};
|