Refactor member and product scripts to use concise method definitions
- 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.
This commit is contained in:
+12
-12
@@ -14,7 +14,7 @@ var PromoBarangJS = {
|
||||
PHP: '',
|
||||
KODE: '',
|
||||
|
||||
index: function(){
|
||||
index() {
|
||||
this.data_query('detail');
|
||||
$('#Cari_Promo').keydown((e) => {
|
||||
var key = e.keyCode || e.which || 0;
|
||||
@@ -28,7 +28,7 @@ var PromoBarangJS = {
|
||||
FoniaJS.setFocus('#Cari_Promo');
|
||||
},
|
||||
|
||||
detail_show: function(mode, ID){
|
||||
detail_show(mode, ID) {
|
||||
new Request({
|
||||
url: this.PHP + '/form_promo',
|
||||
sendParam: ['mode_detail='+mode,'PromoID='+ID],
|
||||
@@ -49,15 +49,15 @@ var PromoBarangJS = {
|
||||
}).send();
|
||||
},
|
||||
|
||||
detail_tambah: function(){
|
||||
detail_tambah() {
|
||||
this.detail_show('insert', 0);
|
||||
},
|
||||
|
||||
detail_ubah: function(acell){
|
||||
detail_ubah(acell) {
|
||||
this.detail_show('update', acell[0]);
|
||||
},
|
||||
|
||||
detail_hapus: function(acell){
|
||||
detail_hapus(acell) {
|
||||
FoniaJS.showConfirm('Konfirmasi', 'Yakin akan hapus <b>"'+acell[2]+'"</b> ?', () => {
|
||||
new Request_JSF({
|
||||
url: this.PHP + '/table_promo',
|
||||
@@ -67,7 +67,7 @@ var PromoBarangJS = {
|
||||
}, 'danger');
|
||||
},
|
||||
|
||||
detail_save: function(){
|
||||
detail_save() {
|
||||
new Request_JSF({
|
||||
url: this.PHP + '/table_promo',
|
||||
sendParam: ['mode_detail','PromoID','InvID','SatuanID','CabID','Grup_MemberID','Pilih_Qty','Qty_Min','Qty_Kali','Tipe_Promo','Promo_Disc','Promo_InvID','Promo_SatuanID','Promo_Qty','Jumlah_Promo','Tgl_Mulai','Tgl_Akhir','Aktif','Cari_Promo'],
|
||||
@@ -78,7 +78,7 @@ var PromoBarangJS = {
|
||||
}).send();
|
||||
},
|
||||
|
||||
produk_brow: function(tipe){
|
||||
produk_brow(tipe) {
|
||||
var _isi = new String('<div class="row mb-1"><div class="col"><div class="input-group"><input class="form-control" id="Cari_Produk" placeholder="Kunci Pencarian" type="text"><button class="btn btn-info shadow-none" type="button" id="butSearch">Cari</button><button class="btn btn-secondary shadow-none" type="button" id="butAll">Semua</button><input type="hidden" id="Tipe_Brow" value="'+tipe+'" /></div></div></div><div id="divBrowProduk"> </div>');
|
||||
this.winBProduk = FoniaJS.showWindow('BProduk', 'Daftar Barang', _isi, 'lg', '', () => {
|
||||
$('#winBProduk')
|
||||
@@ -96,7 +96,7 @@ var PromoBarangJS = {
|
||||
});
|
||||
},
|
||||
|
||||
produk_select: function(acell){
|
||||
produk_select(acell) {
|
||||
FoniaJS.closeWindow(this.winBProduk);
|
||||
var itipe = parseInt($('#Tipe_Brow').val());
|
||||
if (itipe == 1){
|
||||
@@ -110,7 +110,7 @@ var PromoBarangJS = {
|
||||
}
|
||||
},
|
||||
|
||||
data_query: function(tipe, mode){
|
||||
data_query(tipe, mode) {
|
||||
if (tipe=="detail"){
|
||||
new Request_JSF({
|
||||
url: this.PHP + '/table_promo',
|
||||
@@ -125,7 +125,7 @@ var PromoBarangJS = {
|
||||
}
|
||||
},
|
||||
|
||||
update_Items: function(InvID, SatuanID, Tipe){
|
||||
update_Items(InvID, SatuanID, Tipe) {
|
||||
const elSatuan = (Tipe==1) ? $('#SatuanID') : $('#Promo_SatuanID');
|
||||
elSatuan.empty();
|
||||
if (InvID==0) return false;
|
||||
@@ -141,7 +141,7 @@ var PromoBarangJS = {
|
||||
}).send();
|
||||
},
|
||||
|
||||
oc_PilihQ: function(){
|
||||
oc_PilihQ() {
|
||||
var i = parseInt($('#Pilih_Qty').val());
|
||||
if (i == 1){
|
||||
$('#Qty_Min').prop('disabled', false);
|
||||
@@ -152,7 +152,7 @@ var PromoBarangJS = {
|
||||
}
|
||||
},
|
||||
|
||||
oc_PilihP: function(){
|
||||
oc_PilihP() {
|
||||
var i = parseInt($('#Tipe_Promo').val());
|
||||
if (i == 1){
|
||||
$('.promo1').removeClass('d-none');
|
||||
|
||||
@@ -14,7 +14,7 @@ var PromoBeliDiscJS = {
|
||||
PHP: '',
|
||||
KODE: '',
|
||||
|
||||
index: function(q){
|
||||
index(q) {
|
||||
$('#butTambah').click(() => this.promo_tambah());
|
||||
$('#butUbah').click(() => this.promo_ubah());
|
||||
$('#butHapus').click(() => this.promo_hapus());
|
||||
@@ -23,7 +23,7 @@ var PromoBeliDiscJS = {
|
||||
this.data_query('master', 'view', ((typeof(q)!=='undefined') ? q : ''));
|
||||
},
|
||||
|
||||
promo_brow: function(){
|
||||
promo_brow() {
|
||||
var _isi = new String('<div class="row mb-1"><div class="col"><div class="input-group"><input class="form-control" id="Cari_Promo" placeholder="Kunci Pencarian" type="text"><button class="btn btn-info shadow-none" type="button" id="butSearch">Cari</button><button class="btn btn-secondary shadow-none" type="button" id="butAll">Semua</button></div></div></div><div id="divBrowPromo"> </div>');
|
||||
this.winBPromo = FoniaJS.showWindow('BPromo', 'Daftar Promo', _isi, 'xl', '', () => {
|
||||
$('#winBPromo')
|
||||
@@ -40,17 +40,17 @@ var PromoBeliDiscJS = {
|
||||
});
|
||||
},
|
||||
|
||||
promo_select: function(acell){
|
||||
promo_select(acell) {
|
||||
FoniaJS.closeWindow(this.winBPromo);
|
||||
$('#Grup_PromoID').val(acell[0]);
|
||||
this.data_query('master', 'view');
|
||||
},
|
||||
|
||||
promo_tambah: function(){
|
||||
promo_tambah() {
|
||||
this.data_query('master', 'add');
|
||||
},
|
||||
|
||||
promo_ubah: function(){
|
||||
promo_ubah() {
|
||||
if ($('#Grup_PromoID').val() == 0){
|
||||
FoniaJS.showError("Silakan pilih Nama Promo !");
|
||||
return;
|
||||
@@ -58,7 +58,7 @@ var PromoBeliDiscJS = {
|
||||
this.data_query('master', 'edit');
|
||||
},
|
||||
|
||||
promo_hapus: function(){
|
||||
promo_hapus() {
|
||||
if ($('#Grup_PromoID').val() == 0){
|
||||
FoniaJS.showError("Silakan pilih Nama Promo !");
|
||||
return;
|
||||
@@ -80,18 +80,18 @@ var PromoBeliDiscJS = {
|
||||
}, 'danger');
|
||||
},
|
||||
|
||||
promo_simpan: function(mode){
|
||||
promo_simpan(mode) {
|
||||
this.data_query('master', 'save');
|
||||
},
|
||||
|
||||
promo_batal: function(){
|
||||
promo_batal() {
|
||||
FoniaJS.showConfirm('Konfirmasi', 'Yakin akan membatalkan ?', () => {
|
||||
this.data_query('master', 'cancel');
|
||||
$('#Grup_PromoID').val(0);
|
||||
}, 'danger');
|
||||
},
|
||||
|
||||
produk_brow: function(){
|
||||
produk_brow() {
|
||||
var _isi = new String('<div class="row mb-1"><div class="col"><div class="input-group"><input class="form-control" id="Cari_Produk" placeholder="Kunci Pencarian" type="text"><button class="btn btn-info shadow-none" type="button" id="butSearch">Cari</button><button class="btn btn-secondary shadow-none" type="button" id="butAll">Semua</button></div></div></div><div id="divBrowProduk"> </div>');
|
||||
this.winBProduk = FoniaJS.showWindow('BProduk', 'Daftar Barang', _isi, 'xl', '', () => {
|
||||
$('#winBProduk')
|
||||
@@ -108,12 +108,12 @@ var PromoBeliDiscJS = {
|
||||
});
|
||||
},
|
||||
|
||||
produk_select: function(acell){
|
||||
produk_select(acell) {
|
||||
FoniaJS.closeWindow(this.winBProduk);
|
||||
this.detail_produk('insert', 0, acell[0], acell[1], '0');
|
||||
},
|
||||
|
||||
detail_produk: function(mode, PromoID, InvID, SatuanID, Kode_Varian){
|
||||
detail_produk(mode, PromoID, InvID, SatuanID, Kode_Varian) {
|
||||
new Request({
|
||||
url: this.PHP + '/form_produk',
|
||||
sendParam: ['mode','mode_detail='+mode,'Grup_PromoID','PromoID='+PromoID,'InvID='+InvID,'SatuanID='+SatuanID,'Kode_Varian='+Kode_Varian],
|
||||
@@ -132,15 +132,15 @@ var PromoBeliDiscJS = {
|
||||
}).send();
|
||||
},
|
||||
|
||||
detail_tambah: function() {
|
||||
detail_tambah() {
|
||||
this.detail_produk('insert', 0, 0, 0, '0');
|
||||
},
|
||||
|
||||
detail_ubah: function(acell){
|
||||
detail_ubah(acell) {
|
||||
this.detail_produk('update', acell[0], acell[1], acell[2], acell[3]);
|
||||
},
|
||||
|
||||
detail_hapus: function(acell){
|
||||
detail_hapus(acell) {
|
||||
FoniaJS.showConfirm('Konfirmasi', 'Hapus item <strong>"'+acell[5]+'"</strong> ?', () => {
|
||||
new Request_JSF({
|
||||
url: this.PHP + '/table_detail',
|
||||
@@ -149,7 +149,7 @@ var PromoBeliDiscJS = {
|
||||
}, 'danger');
|
||||
},
|
||||
|
||||
detail_simpan: function(){
|
||||
detail_simpan() {
|
||||
if ($('#InvID').val() == 0) {
|
||||
FoniaJS.showError('Silakan masukkan Nama Barang Promo !');
|
||||
return;
|
||||
@@ -161,14 +161,14 @@ var PromoBeliDiscJS = {
|
||||
}).send();
|
||||
},
|
||||
|
||||
varian_show: function(){
|
||||
varian_show() {
|
||||
new Request_JSF({
|
||||
url: this.PHP + '/form_varian',
|
||||
sendParam: ['InvID','SatuanID','Kode_Varian']
|
||||
}).send();
|
||||
},
|
||||
|
||||
data_query: function(tipe, mode, kd_tx){
|
||||
data_query(tipe, mode, kd_tx) {
|
||||
if (tipe=="master"){
|
||||
mode = (mode) ? mode : '';
|
||||
var sparam = ['mode='+mode,'Grup_PromoID'+((typeof(kd_tx)!=='undefined')?'='+kd_tx:'')];
|
||||
@@ -221,13 +221,13 @@ var PromoBeliDiscJS = {
|
||||
}
|
||||
},
|
||||
|
||||
Produk_Comp: function(item){
|
||||
Produk_Comp(item) {
|
||||
$('#InvID').val(item.value);
|
||||
$('#Nama_Produk').val(item.text);
|
||||
PromoBeliDiscJS.update_items(item.value, item.data);
|
||||
},
|
||||
|
||||
update_items: function(InvID, SatuanID){
|
||||
update_items(InvID, SatuanID) {
|
||||
new Request_JSF({
|
||||
url: this.PHP + '/option_satuan',
|
||||
sendParam: ['InvID='+InvID,'SatuanID='+SatuanID],
|
||||
|
||||
+15
-15
@@ -14,7 +14,7 @@ var PromoTotalJS = {
|
||||
PHP: '',
|
||||
KODE: '',
|
||||
|
||||
index: function(){
|
||||
index() {
|
||||
this.data_query('detail');
|
||||
$('#Cari_Promo').keydown((e) => {
|
||||
var key = e.keyCode || e.which || 0;
|
||||
@@ -28,7 +28,7 @@ var PromoTotalJS = {
|
||||
FoniaJS.setFocus('#Cari_Promo');
|
||||
},
|
||||
|
||||
detail_show: function(mode, ID){
|
||||
detail_show(mode, ID) {
|
||||
new Request({
|
||||
url: this.PHP + '/form_promo',
|
||||
sendParam: ['mode_detail='+mode,'PromoID='+ID],
|
||||
@@ -47,15 +47,15 @@ var PromoTotalJS = {
|
||||
}).send();
|
||||
},
|
||||
|
||||
detail_tambah: function(){
|
||||
detail_tambah() {
|
||||
this.detail_show('insert', 0);
|
||||
},
|
||||
|
||||
detail_ubah: function(acell){
|
||||
detail_ubah(acell) {
|
||||
this.detail_show('update', acell[0]);
|
||||
},
|
||||
|
||||
detail_hapus: function(acell){
|
||||
detail_hapus(acell) {
|
||||
FoniaJS.showConfirm('Konfirmasi', 'Yakin akan hapus <b>"'+acell[2]+'"</b> ?', () => {
|
||||
new Request_JSF({
|
||||
url: this.PHP + '/table_promo',
|
||||
@@ -65,7 +65,7 @@ var PromoTotalJS = {
|
||||
}, 'danger');
|
||||
},
|
||||
|
||||
detail_save: function(){
|
||||
detail_save() {
|
||||
new Request_JSF({
|
||||
url: this.PHP + '/table_promo',
|
||||
sendParam: ['mode_detail','PromoID','Nama_Promo','Jual_Min','Jual_Grup','CabID','Grup_MemberID','Tipe_Promo','Promo_Jual','Promo_InvID','Promo_SatuanID','Promo_Qty','Jumlah_Promo','Tgl_Mulai','Tgl_Akhir','Aktif','Cari_Promo'],
|
||||
@@ -76,7 +76,7 @@ var PromoTotalJS = {
|
||||
}).send();
|
||||
},
|
||||
|
||||
grup_show: function(){
|
||||
grup_show() {
|
||||
new Request({
|
||||
url: this.PHP + '/form_grup',
|
||||
sendParam: ['Jual_Grup'],
|
||||
@@ -91,15 +91,15 @@ var PromoTotalJS = {
|
||||
}).send();
|
||||
},
|
||||
|
||||
grup_semua: function(){
|
||||
grup_semua() {
|
||||
$('#tabGrupList input.form-check-input[type=checkbox]').prop('checked', true);
|
||||
},
|
||||
|
||||
grup_clear: function(){
|
||||
grup_clear() {
|
||||
$('#tabGrupList input.form-check-input[type=checkbox]').prop('checked', false);
|
||||
},
|
||||
|
||||
grup_save: function(){
|
||||
grup_save() {
|
||||
var alist = [];
|
||||
$('#tabGrupList tbody input.form-check-input[type=checkbox]:checked').map((i, b) => {
|
||||
alist.push($(b).val());
|
||||
@@ -108,7 +108,7 @@ var PromoTotalJS = {
|
||||
FoniaJS.closeWindow(this.winGrup);
|
||||
},
|
||||
|
||||
produk_brow: function(){
|
||||
produk_brow() {
|
||||
var _isi = new String('<div class="row mb-1"><div class="col"><div class="input-group"><input class="form-control" id="Cari_Produk" placeholder="Kunci Pencarian" type="text"><button class="btn btn-info shadow-none" type="button" id="butSearch">Cari</button><button class="btn btn-secondary shadow-none" type="button" id="butAll">Semua</button></div></div></div><div id="divBrowProduk"> </div>');
|
||||
this.winBProduk = FoniaJS.showWindow('BProduk', 'Daftar Barang', _isi, 'lg', '', () => {
|
||||
$('#winBProduk')
|
||||
@@ -126,14 +126,14 @@ var PromoTotalJS = {
|
||||
});
|
||||
},
|
||||
|
||||
produk_select: function(acell){
|
||||
produk_select(acell) {
|
||||
FoniaJS.closeWindow(this.winBProduk);
|
||||
$('#Promo_InvID').val(acell[0]);
|
||||
$('#Promo_Produk').val(acell[1]);
|
||||
this.update_Items(acell[0], 0);
|
||||
},
|
||||
|
||||
data_query: function(tipe, mode){
|
||||
data_query(tipe, mode) {
|
||||
if (tipe=="detail"){
|
||||
new Request_JSF({
|
||||
url: this.PHP + '/table_promo',
|
||||
@@ -148,7 +148,7 @@ var PromoTotalJS = {
|
||||
}
|
||||
},
|
||||
|
||||
update_Items: function(InvID, SatuanID){
|
||||
update_Items(InvID, SatuanID) {
|
||||
$('#Promo_SatuanID').empty();
|
||||
if (InvID==0) return false;
|
||||
new Request({
|
||||
@@ -163,7 +163,7 @@ var PromoTotalJS = {
|
||||
}).send();
|
||||
},
|
||||
|
||||
oc_PilihP: function(){
|
||||
oc_PilihP() {
|
||||
var i = parseInt($('#Tipe_Promo').val());
|
||||
if (i == 4){
|
||||
$('.promo1').removeClass('d-none');
|
||||
|
||||
Reference in New Issue
Block a user