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:
@@ -14,17 +14,17 @@ var MemberBaruJS = {
|
||||
PHP: '',
|
||||
KODE: '',
|
||||
|
||||
index: function(){
|
||||
index() {
|
||||
$('#butTambah').click(() => this.proses_add());
|
||||
$('#butSimpan').click(() => this.proses_save());
|
||||
this.data_query('view');
|
||||
},
|
||||
|
||||
proses_add: function(){
|
||||
proses_add() {
|
||||
this.data_query('add');
|
||||
},
|
||||
|
||||
proses_save: function(){
|
||||
proses_save() {
|
||||
new Request({
|
||||
url: this.PHP + '/proses_simpan',
|
||||
sendParam: ['MemberID','Grup_MemberID','Kode_Member','Nama_Member','Alamat_Member','Kota_Member','Telp_Member','KTP_Member','Tgl_Lahir','Tgl_Daftar'],
|
||||
@@ -39,7 +39,7 @@ var MemberBaruJS = {
|
||||
}).send()
|
||||
},
|
||||
|
||||
data_query: function(mode){
|
||||
data_query(mode) {
|
||||
new Request({
|
||||
url: this.PHP + '/form_master',
|
||||
sendParam: ['mode='+mode],
|
||||
|
||||
@@ -15,7 +15,7 @@ var MemberPointJS = {
|
||||
KODE: '',
|
||||
html5QrcodeScanner: null,
|
||||
|
||||
index: function(){
|
||||
index() {
|
||||
$('#butBrow').click(() => this.member_brow());
|
||||
if (FoniaJS.WEB_MOBILE){
|
||||
html5QrcodeScanner = new Html5Qrcode('qr-reader');
|
||||
@@ -27,7 +27,7 @@ var MemberPointJS = {
|
||||
this.data_query('table-point');
|
||||
},
|
||||
|
||||
ScanSukses: function(decodedText, decodedResult){
|
||||
ScanSukses(decodedText, decodedResult) {
|
||||
new Request({
|
||||
url: MemberPointJS.PHP + '/scan_member',
|
||||
sendParam: ['Cari_Member='+decodedText],
|
||||
@@ -41,7 +41,7 @@ var MemberPointJS = {
|
||||
}).send();
|
||||
},
|
||||
|
||||
member_brow: function(){
|
||||
member_brow() {
|
||||
var _isi = new String('<div class="row mb-1"><div class="col"><div class="input-group"><input class="form-control" id="Cari_Member" 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="divBrowMember"> </div>');
|
||||
this.winBMember = FoniaJS.showWindow('BMember', 'Daftar Member', _isi, 'xl', '', () => {
|
||||
$('#winBMember')
|
||||
@@ -58,7 +58,7 @@ var MemberPointJS = {
|
||||
});
|
||||
},
|
||||
|
||||
member_select: function(acell){
|
||||
member_select(acell) {
|
||||
FoniaJS.closeWindow(this.winBMember);
|
||||
$('#MemberID').val(acell[0]);
|
||||
$('#Kode_Member').val(acell[1]);
|
||||
@@ -67,7 +67,7 @@ var MemberPointJS = {
|
||||
this.data_query('table-point');
|
||||
},
|
||||
|
||||
data_query: function(tipe){
|
||||
data_query(tipe) {
|
||||
if (tipe=="table-point"){
|
||||
new Request_JSF({
|
||||
url: this.PHP + '/table_point',
|
||||
@@ -82,7 +82,7 @@ var MemberPointJS = {
|
||||
}
|
||||
},
|
||||
|
||||
Member_Comp: function(item){
|
||||
Member_Comp(item) {
|
||||
var adata = item.data.split(':');
|
||||
$('#MemberID').val(item.value);
|
||||
$('#Kode_Member').val(adata[0]);
|
||||
|
||||
+18
-18
@@ -14,7 +14,7 @@ var MemberTukarJS = {
|
||||
PHP: '',
|
||||
KODE: '',
|
||||
|
||||
index: function(q){
|
||||
index(q) {
|
||||
$('#butTambah').click(() => this.tx_tambah());
|
||||
$('#butUbah').click(() => this.tx_ubah());
|
||||
$('#butHapus').click(() => this.tx_hapus());
|
||||
@@ -24,7 +24,7 @@ var MemberTukarJS = {
|
||||
this.data_query('master', 'view', ((typeof(q)!=='undefined') ? q : ''));
|
||||
},
|
||||
|
||||
tx_brow: function(){
|
||||
tx_brow() {
|
||||
var _isi = new String('<div class="row mb-1"><div class="col"><div class="input-group"><input class="form-control" id="Cari_TX" 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="divBrowTX"> </div>');
|
||||
this.winBTX = FoniaJS.showWindow('BTX', 'Daftar Transaksi', _isi, 'xl', '', () => {
|
||||
$('#winBTX')
|
||||
@@ -41,17 +41,17 @@ var MemberTukarJS = {
|
||||
});
|
||||
},
|
||||
|
||||
tx_select: function(acell){
|
||||
tx_select(acell) {
|
||||
FoniaJS.closeWindow(this.winBTX);
|
||||
$('#No_TX').val(acell[0]);
|
||||
this.data_query('master', 'view');
|
||||
},
|
||||
|
||||
tx_tambah: function(){
|
||||
tx_tambah() {
|
||||
this.data_query('master', 'add');
|
||||
},
|
||||
|
||||
tx_ubah: function(){
|
||||
tx_ubah() {
|
||||
if (!$('#No_TX').val()){
|
||||
FoniaJS.showError("Silakan masukkan Nomor Transaksi !");
|
||||
return;
|
||||
@@ -59,7 +59,7 @@ var MemberTukarJS = {
|
||||
FoniaJS.showAuth(() => this.data_query('master', 'edit'), this, 'EDIT '+$('#No_TX').val());
|
||||
},
|
||||
|
||||
tx_hapus: function(){
|
||||
tx_hapus() {
|
||||
if (!$('#No_TX').val()){
|
||||
FoniaJS.showError("Silakan masukkan Nomor Transaksi !");
|
||||
return;
|
||||
@@ -83,7 +83,7 @@ var MemberTukarJS = {
|
||||
}, 'danger');
|
||||
},
|
||||
|
||||
tx_simpan: function(){
|
||||
tx_simpan() {
|
||||
if ($('#Point_TipeID').val()==0){
|
||||
FoniaJS.showError("Silakan pilih Tipe Point !");
|
||||
return;
|
||||
@@ -109,14 +109,14 @@ var MemberTukarJS = {
|
||||
this.data_query('master', 'save');
|
||||
},
|
||||
|
||||
tx_batal: function(){
|
||||
tx_batal() {
|
||||
FoniaJS.showConfirm('Konfirmasi', 'Yakin akan membatalkan ?', () => {
|
||||
this.data_query('master', 'cancel');
|
||||
$('#No_TX').val('');
|
||||
}, 'danger');
|
||||
},
|
||||
|
||||
tx_print: function(){
|
||||
tx_print() {
|
||||
if ($('#No_TX').val()) {
|
||||
var cetak = new PrinterPos('report/nota/tukarpoint_pos');
|
||||
cetak.add_param("Nomor_Cetak", $('#No_TX').val());
|
||||
@@ -126,7 +126,7 @@ var MemberTukarJS = {
|
||||
FoniaJS.showError("Silakan masukkan Nomor Transaksi !");
|
||||
},
|
||||
|
||||
member_brow: function(){
|
||||
member_brow() {
|
||||
if ($('#Point_TipeID').val()==0){
|
||||
FoniaJS.showError("Silakan pilih Tipe Point !");
|
||||
return;
|
||||
@@ -147,14 +147,14 @@ var MemberTukarJS = {
|
||||
});
|
||||
},
|
||||
|
||||
member_select: function(acell){
|
||||
member_select(acell) {
|
||||
FoniaJS.closeWindow(this.winBMember);
|
||||
$('#MemberID').val(acell[0]);
|
||||
$('#Nama_Member').val(acell[3]);
|
||||
$('#Sisa_Point').val(acell[6]);
|
||||
},
|
||||
|
||||
barang_brow: function(){
|
||||
barang_brow() {
|
||||
if ($('#Point_TipeID').val()==0){
|
||||
FoniaJS.showError("Silakan pilih Tipe Point !");
|
||||
return;
|
||||
@@ -175,7 +175,7 @@ var MemberTukarJS = {
|
||||
});
|
||||
},
|
||||
|
||||
barang_select: function(acell){
|
||||
barang_select(acell) {
|
||||
FoniaJS.closeWindow(this.winBBarang);
|
||||
$('#InvPID').val(acell[0]);
|
||||
$('#Nama_Barang').val(acell[2]);
|
||||
@@ -185,7 +185,7 @@ var MemberTukarJS = {
|
||||
this.Hitung_Point();
|
||||
},
|
||||
|
||||
data_query: function(tipe, mode, kd_tx){
|
||||
data_query(tipe, mode, kd_tx) {
|
||||
if (tipe=="master"){
|
||||
mode = (mode) ? mode : '';
|
||||
var sparam = ['mode='+mode,'No_TX'+((typeof(kd_tx)!=='undefined')?'='+kd_tx:'')];
|
||||
@@ -257,13 +257,13 @@ var MemberTukarJS = {
|
||||
}
|
||||
},
|
||||
|
||||
Member_Comp: function(item){
|
||||
Member_Comp(item) {
|
||||
$('#MemberID').val(item.value);
|
||||
$('#Sisa_Point').val(item.data);
|
||||
$('#Nama_Barang').focus();
|
||||
},
|
||||
|
||||
Barang_Comp: function(item){
|
||||
Barang_Comp(item) {
|
||||
var adata = item.data.split(':');
|
||||
$('#InvPID').val(item.value);
|
||||
$('#Nilai_Barang').val(adata[1]);
|
||||
@@ -273,11 +273,11 @@ var MemberTukarJS = {
|
||||
this.Hitung_Point();
|
||||
},
|
||||
|
||||
oc_Tipe: function(){
|
||||
oc_Tipe() {
|
||||
//
|
||||
},
|
||||
|
||||
Hitung_Point: function(){
|
||||
Hitung_Point() {
|
||||
var qty = FoniaJS.StrToFloat($('#Qty').val());
|
||||
var point = FoniaJS.StrToFloat($('#Point').val());
|
||||
$('#Nilai_Point').val(FoniaJS.FloatToStr(qty * point,0));
|
||||
|
||||
Reference in New Issue
Block a user