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:
+39
-39
@@ -14,7 +14,7 @@ var ProdukJS = {
|
||||
PHP: '',
|
||||
KODE: '',
|
||||
|
||||
index: function(){
|
||||
index() {
|
||||
this.data_query('tabel-produk');
|
||||
$('#butPrint').click(() => this.print_show());
|
||||
$('#butFilter').click(() => this.filter_show());
|
||||
@@ -30,7 +30,7 @@ var ProdukJS = {
|
||||
FoniaJS.setFocus('#Cari_Produk');
|
||||
},
|
||||
|
||||
print_show: function(){
|
||||
print_show() {
|
||||
new Request({
|
||||
url: this.PHP + '/detail_print',
|
||||
onSuccess: (ajson) => {
|
||||
@@ -43,7 +43,7 @@ var ProdukJS = {
|
||||
}).send();
|
||||
},
|
||||
|
||||
print_produk: function(prt){
|
||||
print_produk(prt) {
|
||||
var cetak = new Printer(this.PHP + '/print_barang');
|
||||
cetak.add_param("SupID");
|
||||
cetak.add_param("Grup_InvID");
|
||||
@@ -53,7 +53,7 @@ var ProdukJS = {
|
||||
FoniaJS.closeWindow(this.winDPrint);
|
||||
},
|
||||
|
||||
filter_show: function(){
|
||||
filter_show() {
|
||||
new Request({
|
||||
url: this.PHP + '/detail_filter',
|
||||
sendParam: ['Filter_Produk'],
|
||||
@@ -66,13 +66,13 @@ var ProdukJS = {
|
||||
}).send();
|
||||
},
|
||||
|
||||
filter_simpan: function(){
|
||||
filter_simpan() {
|
||||
$('#Filter_Produk').val($('#Fi_Produk').val());
|
||||
FoniaJS.closeWindow(this.winFilter);
|
||||
this.data_query('tabel-produk');
|
||||
},
|
||||
|
||||
produk_show: function(mode, ID){
|
||||
produk_show(mode, ID) {
|
||||
new Request({
|
||||
url: this.PHP + '/detail_produk',
|
||||
sendParam: ['mode='+mode,'InvID='+ID],
|
||||
@@ -89,7 +89,7 @@ var ProdukJS = {
|
||||
}).send();
|
||||
},
|
||||
|
||||
produk_restore: function(acell){
|
||||
produk_restore(acell) {
|
||||
new Request({
|
||||
url: this.PHP + '/detail_restore',
|
||||
sendParam: ['InvID='+acell[0]],
|
||||
@@ -99,7 +99,7 @@ var ProdukJS = {
|
||||
}).send();
|
||||
},
|
||||
|
||||
produk_restore_select: function(acell){
|
||||
produk_restore_select(acell) {
|
||||
FoniaJS.showConfirm('Konfirmasi', 'Yakin akan restore data Barang ke versi tanggal : <b>"'+acell[0]+'"</b> ?<br><br><span class="text-danger fw-bold">HARAP KONFIRMASI KEMBALI, TERIMA KASIH!</span>', () => {
|
||||
new Request({
|
||||
url: this.PHP + '/proses_restore',
|
||||
@@ -111,7 +111,7 @@ var ProdukJS = {
|
||||
}, 'danger');
|
||||
},
|
||||
|
||||
produk_restore_form: function(acell, div){
|
||||
produk_restore_form(acell, div) {
|
||||
new Request({
|
||||
url: this.PHP + '/form_restore',
|
||||
sendParam: ['InvID','MD5Key='+acell[1]],
|
||||
@@ -119,15 +119,15 @@ var ProdukJS = {
|
||||
}).send();
|
||||
},
|
||||
|
||||
produk_tambah: function(){
|
||||
produk_tambah() {
|
||||
this.produk_show('add', 0);
|
||||
},
|
||||
|
||||
produk_ubah: function(acell){
|
||||
produk_ubah(acell) {
|
||||
this.produk_show('edit', acell[0]);
|
||||
},
|
||||
|
||||
produk_hapus: function(acell){
|
||||
produk_hapus(acell) {
|
||||
FoniaJS.showConfirm('Konfirmasi', 'Yakin akan hapus <b>"'+acell[1]+'"</b> ?', () => {
|
||||
FoniaJS.showAuth(() => {
|
||||
new Request({
|
||||
@@ -146,7 +146,7 @@ var ProdukJS = {
|
||||
}, 'danger');
|
||||
},
|
||||
|
||||
produk_simpan: function(){
|
||||
produk_simpan() {
|
||||
new Request({
|
||||
url: this.PHP + '/proses_simpan',
|
||||
sendParam: ['mode','InvID','Grup_InvID','Nama_Produk='+encodeURIComponent($('#Nama_Produk').val()),'StokID','NormalID','PPN','Harga_Beli','Harga_Tambah','Stok_Min','Stok_Max','Aktif'],
|
||||
@@ -162,7 +162,7 @@ var ProdukJS = {
|
||||
}).send();
|
||||
},
|
||||
|
||||
produk_batal: function(){
|
||||
produk_batal() {
|
||||
if ($('#mode').val()=='add'){
|
||||
FoniaJS.showConfirm('Konfirmasi', 'Yakin akan batalkan Penambahan Barang ?', () => {
|
||||
new Request({
|
||||
@@ -185,7 +185,7 @@ var ProdukJS = {
|
||||
}, 'danger');
|
||||
},
|
||||
|
||||
brow_produk: function(){
|
||||
brow_produk() {
|
||||
var _isi = new String('<div class="row mb-1"><div class="col"><div class="input-group"><input class="form-control" id="Cari_Produk2" 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').find('#Cari_Produk2').keydown((e) => {
|
||||
@@ -202,7 +202,7 @@ var ProdukJS = {
|
||||
});
|
||||
},
|
||||
|
||||
produk_select: function(acell){
|
||||
produk_select(acell) {
|
||||
FoniaJS.closeWindow(this.winBProduk);
|
||||
new Request({
|
||||
url: this.PHP + '/proses_copy',
|
||||
@@ -220,11 +220,11 @@ var ProdukJS = {
|
||||
}).send();
|
||||
},
|
||||
|
||||
kemasan_copy: function(){
|
||||
kemasan_copy() {
|
||||
FoniaJS.showConfirm('Konfirmasi', 'Yakin akan salin data dari barang lain ?<br><br><span class="text-danger fw-bold">KEMASAN & HARGA YANG ADA<br>SEKARANG AKAN DIHAPUS!</span>', () => this.brow_produk(), 'warning');
|
||||
},
|
||||
|
||||
kemasan_batal: function(){
|
||||
kemasan_batal() {
|
||||
var dt = $('#divKemasanTabel').DataTable(), tr, l_row;
|
||||
tr = $('#butBatalKemasan').closest('tr');
|
||||
l_row = dt.row(tr.prev('tr'));
|
||||
@@ -232,7 +232,7 @@ var ProdukJS = {
|
||||
if (l_row.data()[0]=='0') l_row.remove().draw(true);
|
||||
},
|
||||
|
||||
kemasan_add: function(){
|
||||
kemasan_add() {
|
||||
var dt = $('#divKemasanTabel').DataTable(), l_row;
|
||||
dt.order([0,'desc']);
|
||||
l_row = dt.row(':last');
|
||||
@@ -243,7 +243,7 @@ var ProdukJS = {
|
||||
if (!l_row.child.isShown()) l_row.nodes().to$().find('.fon-tabel-dt').click();
|
||||
},
|
||||
|
||||
kemasan_form: function(acell, div){
|
||||
kemasan_form(acell, div) {
|
||||
new Request({
|
||||
url: this.PHP + '/form_kemasan',
|
||||
sendParam: ['InvID','InvKemasanID='+acell[0],'Satuan_Stok='+$('#StokID').find(':selected').text()],
|
||||
@@ -256,7 +256,7 @@ var ProdukJS = {
|
||||
}).send();
|
||||
},
|
||||
|
||||
kemasan_del: function(acell){
|
||||
kemasan_del(acell) {
|
||||
FoniaJS.showConfirm('Konfirmasi', 'Yakin akan hapus <b>"'+acell[2]+'"</b> ?', () => {
|
||||
new Request_JSF({
|
||||
url: this.PHP + '/tabel_kemasan',
|
||||
@@ -270,7 +270,7 @@ var ProdukJS = {
|
||||
}, 'danger');
|
||||
},
|
||||
|
||||
kemasan_save: function(){
|
||||
kemasan_save() {
|
||||
if ($('#Qty').val()==0){
|
||||
FoniaJS.showInfo('Mohon isi jumlah Qty / Kemasan !');
|
||||
return false;
|
||||
@@ -288,7 +288,7 @@ var ProdukJS = {
|
||||
}).send();
|
||||
},
|
||||
|
||||
kemasan_check: function(){
|
||||
kemasan_check() {
|
||||
if ($('#SatuanID').val()==$('#SatuanLamaID').val()) {
|
||||
this.kemasan_save();
|
||||
return;
|
||||
@@ -306,7 +306,7 @@ var ProdukJS = {
|
||||
}).send();
|
||||
},
|
||||
|
||||
varian_batal: function(){
|
||||
varian_batal() {
|
||||
var dt = $('#divVarianTabel').DataTable(), tr, l_row;
|
||||
tr = $('#butBatalVarian').closest('tr');
|
||||
l_row = dt.row(tr.prev('tr'));
|
||||
@@ -314,7 +314,7 @@ var ProdukJS = {
|
||||
if (l_row.data()[0]=='0') l_row.remove().draw(true);
|
||||
},
|
||||
|
||||
varian_add: function(){
|
||||
varian_add() {
|
||||
var dt = $('#divVarianTabel').DataTable(), l_row;
|
||||
dt.order([0,'desc']);
|
||||
l_row = dt.row(':last');
|
||||
@@ -325,7 +325,7 @@ var ProdukJS = {
|
||||
if (!l_row.child.isShown()) l_row.nodes().to$().find('.fon-tabel-dt').click();
|
||||
},
|
||||
|
||||
varian_form: function(acell, div){
|
||||
varian_form(acell, div) {
|
||||
new Request({
|
||||
url: this.PHP + '/form_varian',
|
||||
sendParam: ['InvID','InvVarianID='+acell[0]],
|
||||
@@ -338,7 +338,7 @@ var ProdukJS = {
|
||||
}).send();
|
||||
},
|
||||
|
||||
varian_del: function(acell){
|
||||
varian_del(acell) {
|
||||
FoniaJS.showConfirm('Konfirmasi', 'Yakin akan hapus <b>"'+acell[4]+'"</b> ?', () => {
|
||||
new Request_JSF({
|
||||
url: this.PHP + '/tabel_varian',
|
||||
@@ -348,7 +348,7 @@ var ProdukJS = {
|
||||
}, 'danger');
|
||||
},
|
||||
|
||||
varian_save: function(){
|
||||
varian_save() {
|
||||
new Request_JSF({
|
||||
url: this.PHP + '/tabel_varian',
|
||||
sendParam: ['mode','mode_detail=update','InvID','InvVarianID','SatuanID','VarianID','Kode_Barcode'],
|
||||
@@ -356,7 +356,7 @@ var ProdukJS = {
|
||||
}).send();
|
||||
},
|
||||
|
||||
varian_check: function(){
|
||||
varian_check() {
|
||||
if (($('#SatuanID').val()==$('#SatuanLamaID').val()) && ($('#VarianID').val()==$('#VarianLamaID').val()) && ($('#Kode_Barcode').val()==$('#Kode_BarcodeLama').val())) {
|
||||
this.varian_save();
|
||||
return;
|
||||
@@ -374,7 +374,7 @@ var ProdukJS = {
|
||||
}).send();
|
||||
},
|
||||
|
||||
harga_batal: function(){
|
||||
harga_batal() {
|
||||
var dt = $('#divHargaTabel').DataTable(), tr, l_row;
|
||||
tr = $('#butBatalHarga').closest('tr');
|
||||
l_row = dt.row(tr.prev('tr'));
|
||||
@@ -382,7 +382,7 @@ var ProdukJS = {
|
||||
if (l_row.data()[0]=='0') l_row.remove().draw(true);
|
||||
},
|
||||
|
||||
harga_add: function(){
|
||||
harga_add() {
|
||||
var dt = $('#divHargaTabel').DataTable(), l_row;
|
||||
dt.order([0,'desc']);
|
||||
l_row = dt.row(':last');
|
||||
@@ -395,7 +395,7 @@ var ProdukJS = {
|
||||
if (!l_row.child.isShown()) l_row.nodes().to$().find('.fon-tabel-dt').click();
|
||||
},
|
||||
|
||||
harga_form: function(acell, div){
|
||||
harga_form(acell, div) {
|
||||
new Request({
|
||||
url: this.PHP + '/form_harga',
|
||||
sendParam: ['InvID','InvHargaID='+acell[0]],
|
||||
@@ -410,7 +410,7 @@ var ProdukJS = {
|
||||
}).send();
|
||||
},
|
||||
|
||||
harga_del: function(acell){
|
||||
harga_del(acell) {
|
||||
FoniaJS.showConfirm('Konfirmasi', 'Yakin akan hapus <b>"'+acell[1]+' - '+acell[2]+'"</b> ?', () => {
|
||||
new Request_JSF({
|
||||
url: this.PHP + '/tabel_harga',
|
||||
@@ -420,7 +420,7 @@ var ProdukJS = {
|
||||
}, 'danger');
|
||||
},
|
||||
|
||||
harga_save: function(){
|
||||
harga_save() {
|
||||
new Request_JSF({
|
||||
url: this.PHP + '/tabel_harga',
|
||||
sendParam: ['mode','mode_detail=update','InvID','InvHargaID','SatuanID','Grup_MemberID','Harga_Jual'],
|
||||
@@ -428,7 +428,7 @@ var ProdukJS = {
|
||||
}).send();
|
||||
},
|
||||
|
||||
harga_check: function(){
|
||||
harga_check() {
|
||||
if (($('#SatuanID').val()==$('#SatuanLamaID').val()) && ($('#Grup_MemberID').val()==$('#GrupLamaID').val())) {
|
||||
this.harga_save();
|
||||
return;
|
||||
@@ -446,7 +446,7 @@ var ProdukJS = {
|
||||
}).send();
|
||||
},
|
||||
|
||||
data_query: function(tipe, mode){
|
||||
data_query(tipe, mode) {
|
||||
if (tipe=="tabel-produk"){
|
||||
new Request_JSF({
|
||||
url: this.PHP + '/tabel_produk',
|
||||
@@ -485,11 +485,11 @@ var ProdukJS = {
|
||||
}
|
||||
},
|
||||
|
||||
hitung_HPP: function(){
|
||||
hitung_HPP() {
|
||||
$('#Harga_Pokok').val(FoniaJS.FloatToStr(FoniaJS.StrToFloat($('#Harga_Beli').val()) + FoniaJS.StrToFloat($('#Harga_Tambah').val()), 0));
|
||||
},
|
||||
|
||||
calc_Modal: function(){
|
||||
calc_Modal() {
|
||||
new Request({
|
||||
url: this.PHP + '/check_modal',
|
||||
sendParam: ['InvID','SatuanID'],
|
||||
@@ -502,7 +502,7 @@ var ProdukJS = {
|
||||
}).send();
|
||||
},
|
||||
|
||||
calc_Harga: function(tipe){
|
||||
calc_Harga(tipe) {
|
||||
var harga = FoniaJS.StrToFloat($('#Harga_Jual').val());
|
||||
var pjual = FoniaJS.StrToFloat($('#Persen_Jual').val());
|
||||
var hmodal = FoniaJS.StrToFloat($('#Harga_Modal').val());
|
||||
|
||||
Reference in New Issue
Block a user