Flatten nested repos
This commit is contained in:
183
test/vuex/one-bill-payment/modules/bill.js
Normal file
183
test/vuex/one-bill-payment/modules/bill.js
Normal file
@@ -0,0 +1,183 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
import * as api from "../api/bill.js"
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
search_bill: 0,
|
||||
search_error_message: '',
|
||||
start_date: moment(new Date()).format('YYYY-MM-DD'),
|
||||
end_date: moment(new Date()).format('YYYY-MM-DD'),
|
||||
search: '',
|
||||
scompany: '',
|
||||
isauto:'N',
|
||||
bills: [],
|
||||
total_bill: 0,
|
||||
selected_bill: {
|
||||
totalbill: 0,
|
||||
mindp_percent: 0
|
||||
},
|
||||
save_error_message: '',
|
||||
statuses: [{
|
||||
name: 'Belum Lunas',
|
||||
value: 'N'
|
||||
}, {
|
||||
name: 'Lunas',
|
||||
value: 'Y'
|
||||
}],
|
||||
selected_status: {
|
||||
name: 'Belum Lunas',
|
||||
value: 'N'
|
||||
},
|
||||
open_alert_no_pay: false,
|
||||
msg_alert_no_pay: "Loh ... Gak jadi bayar dong ?",
|
||||
current_page: 1,
|
||||
total_page: 0,
|
||||
pay_disabled: 'Y',
|
||||
get_data_status: 0,
|
||||
get_data_error_message: ''
|
||||
},
|
||||
mutations: {
|
||||
update_pay_disabled(state, val) {
|
||||
state.pay_disabled = val
|
||||
},
|
||||
update_total_page(state, val) {
|
||||
state.total_page = val
|
||||
},
|
||||
update_current_page(state, val) {
|
||||
state.current_page = val
|
||||
},
|
||||
update_search_error_message(state, bill) {
|
||||
state.search_error_message = bill
|
||||
},
|
||||
update_search_bill(state, bill) {
|
||||
state.search_bill = bill
|
||||
},
|
||||
update_bills(state, data) {
|
||||
state.bills = data.records
|
||||
state.total_bill = data.total
|
||||
state.total_page = data.total
|
||||
},
|
||||
update_selected_bill(state, val) {
|
||||
state.selected_bill = val
|
||||
},
|
||||
update_start_date(state, val) {
|
||||
state.start_date = val
|
||||
},
|
||||
update_end_date(state, val) {
|
||||
state.end_date = val
|
||||
},
|
||||
update_search(state, val) {
|
||||
state.search = val
|
||||
},
|
||||
update_scompany(state, val) {
|
||||
state.scompany = val
|
||||
},
|
||||
update_selected_status(state, val) {
|
||||
state.selected_status = val
|
||||
},
|
||||
update_open_alert_no_pay(state, val) {
|
||||
state.open_alert_no_pay = val
|
||||
},
|
||||
update_msg_alert_no_pay(state, val) {
|
||||
state.msg_alert_no_pay = val
|
||||
},
|
||||
update_isauto(state, val) {
|
||||
state.isauto = val
|
||||
},
|
||||
update_get_data_status(state, val) {
|
||||
state.get_data_status = val
|
||||
},
|
||||
update_get_data_error_message(state, val) {
|
||||
state.get_data_error_message = val
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
async search(context, prm) {
|
||||
context.commit("update_search_bill", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.search(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_search_bill", 3)
|
||||
context.commit("update_search_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_search_bill", 2)
|
||||
context.commit("update_search_error_message", "")
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_bills", data)
|
||||
context.commit("update_total_page", data.total)
|
||||
if (prm.lastidx === 0 && data.total > 0) {
|
||||
context.commit("update_selected_bill", data.records[0])
|
||||
if (!_.isEmpty(data.records[0])) {
|
||||
context.commit("paymentnew/update_notes", data.records[0].notes, {
|
||||
root: true
|
||||
})
|
||||
context.commit("paymentmanual/update_notes", data.records[0].notes, {
|
||||
root: true
|
||||
})
|
||||
if (data.records[0].flaglunas === 'N') {
|
||||
context.commit("paymentmanual/update_tagihans", data.records[0].tagihans, {
|
||||
root: true
|
||||
})
|
||||
} else {
|
||||
context.commit("paymentmanual/update_tagihans", [], {
|
||||
root: true
|
||||
})
|
||||
}
|
||||
} else {
|
||||
context.commit("paymentnew/update_notes", [], {
|
||||
root: true
|
||||
})
|
||||
context.commit("paymentmanual/update_notes", [], {
|
||||
root: true
|
||||
})
|
||||
context.commit("paymentmanual/update_tagihans", [], {
|
||||
root: true
|
||||
})
|
||||
|
||||
}
|
||||
} else if (prm.lastidx > 0 && data.total > 0) {
|
||||
context.commit("update_selected_bill", data.records[prm.lastidx])
|
||||
context.commit("paymentnew/update_notes", data.records[prm.lastidx].notes, {
|
||||
root: true
|
||||
})
|
||||
context.commit("paymentmanual/update_notes", data.records[prm.lastidx].notes, {
|
||||
root: true
|
||||
})
|
||||
if (data.records[prm.lastidx].flaglunas === 'N') {
|
||||
context.commit("paymentmanual/update_tagihans", data.records[prm.lastidx].tagihans, {
|
||||
root: true
|
||||
})
|
||||
} else {
|
||||
context.commit("paymentmanual/update_tagihans", [], {
|
||||
root: true
|
||||
})
|
||||
}
|
||||
} else {
|
||||
context.commit("update_selected_bill", '')
|
||||
context.commit("paymentnew/update_notes", [], {
|
||||
root: true
|
||||
})
|
||||
context.commit("paymentmanual/update_notes", [], {
|
||||
root: true
|
||||
})
|
||||
context.commit("paymentmanual/update_tagihans", [], {
|
||||
root: true
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_search_bill", 3)
|
||||
context.commit("update_search_error_message", e.message)
|
||||
console.log(e)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
392
test/vuex/one-bill-payment/modules/paymentmanual.js
Normal file
392
test/vuex/one-bill-payment/modules/paymentmanual.js
Normal file
@@ -0,0 +1,392 @@
|
||||
import * as api from "../api/paymentmanual.js"
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
lookup_status: 0,
|
||||
lookup_error_message: '',
|
||||
types: [],
|
||||
total_payment: 0,
|
||||
reload_after_save: false,
|
||||
dialog_pay_success: false,
|
||||
paynumber: '',
|
||||
notes: [],
|
||||
tagihans: [],
|
||||
dialog_delete: false,
|
||||
msg_delete: '',
|
||||
note_delete: '',
|
||||
nota_delete: {},
|
||||
open_print_note: false,
|
||||
idx: 0,
|
||||
last_payments: {},
|
||||
payment_total: 0,
|
||||
banks: [],
|
||||
disable_btn_pay: 'Y',
|
||||
ordertests: [],
|
||||
isauto: 'N',
|
||||
paymenttypes: [],
|
||||
paymenttype: {
|
||||
M_PaymentTypeID: '1',
|
||||
M_PaymentTypeName: 'Cash'
|
||||
},
|
||||
cards: [],
|
||||
card: {},
|
||||
edcs: [],
|
||||
edc: {},
|
||||
accounts: [],
|
||||
account: {},
|
||||
bar_chx_all: false,
|
||||
selected_tagihan: {},
|
||||
indeterminatex: false,
|
||||
in_saving: false,
|
||||
xbayar: 0
|
||||
},
|
||||
mutations: {
|
||||
update_xbayar(state, val) {
|
||||
state.xbayar = val
|
||||
},
|
||||
update_in_saving(state, val) {
|
||||
state.in_saving = val
|
||||
},
|
||||
update_disable_btn_pay(state, val) {
|
||||
state.disable_btn_pay = val
|
||||
},
|
||||
update_banks(state, val) {
|
||||
state.banks = val
|
||||
},
|
||||
update_lookup_error_message(state, val) {
|
||||
state.lookup_error_message = val
|
||||
},
|
||||
update_lookup_status(state, status) {
|
||||
state.lookup_status = status
|
||||
},
|
||||
update_types(state, data) {
|
||||
state.types = data.records
|
||||
state.total_type = data.total
|
||||
},
|
||||
update_selected_status(state, val) {
|
||||
state.selected_status = val
|
||||
},
|
||||
update_total_payment(state, val) {
|
||||
state.total_payment = val
|
||||
},
|
||||
update_reload_after_save(state, val) {
|
||||
state.reload_after_save = val
|
||||
},
|
||||
update_dialog_pay_success(state, val) {
|
||||
state.dialog_pay_success = val
|
||||
},
|
||||
update_paynumber(state, val) {
|
||||
state.paynumber = val
|
||||
},
|
||||
update_notes(state, val) {
|
||||
state.notes = val
|
||||
},
|
||||
update_tagihans(state, val) {
|
||||
state.tagihans = val
|
||||
},
|
||||
update_dialog_delete(state, val) {
|
||||
state.dialog_delete = val
|
||||
},
|
||||
update_note_delete(state, val) {
|
||||
state.note_delete = val
|
||||
},
|
||||
update_msg_delete(state, val) {
|
||||
state.msg_delete = val
|
||||
},
|
||||
update_nota_delete(state, val) {
|
||||
state.nota_delete = val
|
||||
},
|
||||
update_open_print_note(state, val) {
|
||||
state.open_print_note = val
|
||||
},
|
||||
update_idx(state, val) {
|
||||
state.idx = val
|
||||
},
|
||||
update_last_payments(state, val) {
|
||||
state.last_payments = val
|
||||
},
|
||||
update_ordertests(state, data) {
|
||||
state.ordertests = data
|
||||
},
|
||||
update_isauto(state, val) {
|
||||
state.isauto = val
|
||||
},
|
||||
update_paymenttypes(state, data) {
|
||||
state.paymenttypes = data
|
||||
},
|
||||
update_paymenttype(state, val) {
|
||||
state.paymenttype = val
|
||||
},
|
||||
update_cards(state, data) {
|
||||
state.cards = data
|
||||
},
|
||||
update_card(state, val) {
|
||||
state.card = val
|
||||
},
|
||||
update_edcs(state, data) {
|
||||
state.edcs = data
|
||||
},
|
||||
update_edc(state, val) {
|
||||
state.edc = val
|
||||
},
|
||||
update_accounts(state, data) {
|
||||
state.accounts = data
|
||||
},
|
||||
update_account(state, val) {
|
||||
state.account = val
|
||||
},
|
||||
update_bar_chx_all(state, val) {
|
||||
state.bar_chx_all = val
|
||||
},
|
||||
update_indeterminatex(state, val) {
|
||||
state.indeterminatex = val
|
||||
},
|
||||
update_selected_tagihan(state, val) {
|
||||
state.selected_tagihan = val
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
async lookup_type(context, prm) {
|
||||
context.commit("update_lookup_status", 1)
|
||||
try {
|
||||
let resp = await api.lookup_type(one_token())
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_lookup_status", 3)
|
||||
context.commit("update_lookup_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_lookup_status", 2)
|
||||
context.commit("update_lookup_error_message", "")
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_types", data)
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_lookup_status", 3)
|
||||
context.commit("update_lookup_error_message", e.message)
|
||||
}
|
||||
},
|
||||
async lookup_banks(context) {
|
||||
context.commit("bill/update_get_data_status", 1, {
|
||||
root: true
|
||||
})
|
||||
try {
|
||||
let resp = await api.lookup_banks(one_token())
|
||||
if (resp.status != "OK") {
|
||||
context.commit("bill/update_get_data_status", 3, {
|
||||
root: true
|
||||
})
|
||||
context.commit("bill/update_get_data_error_message", resp.message, {
|
||||
root: true
|
||||
})
|
||||
} else {
|
||||
context.commit("bill/update_get_data_status", 2, {
|
||||
root: true
|
||||
})
|
||||
context.commit("bill/update_get_data_error_message", "", {
|
||||
root: true
|
||||
})
|
||||
context.commit("update_paymenttypes", resp.data.records.paymenttypes)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("bill/update_get_data_status", 3, {
|
||||
root: true
|
||||
})
|
||||
context.commit("bill/update_get_data_error_message", e.message, {
|
||||
root: true
|
||||
})
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async lookup_accounts(context) {
|
||||
context.commit("update_lookup_status", 1)
|
||||
try {
|
||||
let resp = await api.lookup_accounts(one_token())
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_lookup_status", 3)
|
||||
context.commit("update_lookup_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_lookup_status", 2)
|
||||
context.commit("update_lookup_error_message", "")
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_accounts", data.records)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_lookup_status", 3)
|
||||
context.commit("update_lookup_error_message", e.message)
|
||||
}
|
||||
},
|
||||
async searchcard(context, prm) {
|
||||
context.commit("update_lookup_status", 1)
|
||||
try {
|
||||
let resp = await api.searchcard(one_token(), prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_lookup_status", 3)
|
||||
} else {
|
||||
context.commit("update_lookup_status", 2)
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_cards", resp.data.records)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_lookup_status", 3)
|
||||
}
|
||||
},
|
||||
async pay(context, prm) {
|
||||
context.commit("update_lookup_status", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.pay(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_lookup_status", 3)
|
||||
context.commit("update_lookup_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_lookup_status", 2)
|
||||
context.commit("update_lookup_error_message", "")
|
||||
let data = {
|
||||
records: resp.data.records.types,
|
||||
total: resp.data.total
|
||||
}
|
||||
let xnumber = resp.data.records.data.numberx
|
||||
let id = resp.data.records.data.idx
|
||||
context.commit("update_disable_btn_pay", 'Y')
|
||||
context.commit("update_idx", id)
|
||||
context.commit("update_total_payment", 0)
|
||||
context.commit("update_paynumber", "Pembayaran nomor <span style='color:red'>" + xnumber + "</span> telah berhasil")
|
||||
context.commit("update_dialog_pay_success", true)
|
||||
context.commit("update_in_saving", false)
|
||||
context.commit("update_xbayar", 0)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_lookup_status", 3)
|
||||
context.commit("update_lookup_error_message", e.message)
|
||||
}
|
||||
},
|
||||
async delete_note(context, prm) {
|
||||
context.commit("update_lookup_status", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.delete_note(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_lookup_status", 3)
|
||||
context.commit("update_lookup_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_lookup_status", 2)
|
||||
context.commit("update_lookup_error_message", "")
|
||||
let xmsg = "Nota nomor <span style='color:red'>" + prm.nota.note_number + "</span> telah dihapus"
|
||||
context.commit("update_msg_delete", xmsg)
|
||||
context.commit("update_note_delete", '')
|
||||
context.commit("update_nota_delete", {})
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_lookup_status", 3)
|
||||
context.commit("update_lookup_error_message", e.message)
|
||||
}
|
||||
},
|
||||
async selectpaymenttype(context) {
|
||||
context.commit("bill/update_get_data_status", 1, {
|
||||
root: true
|
||||
})
|
||||
try {
|
||||
let resp = await api.selectpaymenttype(one_token())
|
||||
if (resp.status != "OK") {
|
||||
context.commit("bill/update_get_data_status", 3, {
|
||||
root: true
|
||||
})
|
||||
context.commit("bill/update_get_data_error_message", resp.message, {
|
||||
root: true
|
||||
})
|
||||
} else {
|
||||
context.commit("bill/update_get_data_status", 2, {
|
||||
root: true
|
||||
})
|
||||
context.commit("bill/update_get_data_error_message", "", {
|
||||
root: true
|
||||
})
|
||||
context.commit("update_paymenttypes", resp.data.records.paymenttypes)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("bill/update_get_data_status", 3, {
|
||||
root: true
|
||||
})
|
||||
context.commit("bill/update_get_data_error_message", e.message, {
|
||||
root: true
|
||||
})
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async selectcard(context) {
|
||||
context.commit("bill/update_get_data_status", 1, {
|
||||
root: true
|
||||
})
|
||||
try {
|
||||
let resp = await api.selectcard(one_token())
|
||||
if (resp.status != "OK") {
|
||||
context.commit("bill/update_get_data_status", 3, {
|
||||
root: true
|
||||
})
|
||||
context.commit("bill/update_get_data_error_message", resp.message, {
|
||||
root: true
|
||||
})
|
||||
} else {
|
||||
context.commit("bill/update_get_data_status", 2, {
|
||||
root: true
|
||||
})
|
||||
context.commit("bill/update_get_data_error_message", "", {
|
||||
root: true
|
||||
})
|
||||
context.commit("update_cards", resp.data.records.banks)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("bill/update_get_data_status", 3, {
|
||||
root: true
|
||||
})
|
||||
context.commit("bill/update_get_data_error_message", e.message, {
|
||||
root: true
|
||||
})
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async selectedc(context) {
|
||||
context.commit("bill/update_get_data_status", 1, {
|
||||
root: true
|
||||
})
|
||||
try {
|
||||
let resp = await api.selectedc(one_token())
|
||||
if (resp.status != "OK") {
|
||||
context.commit("bill/update_get_data_status", 3, {
|
||||
root: true
|
||||
})
|
||||
context.commit("bill/update_get_data_error_message", resp.message, {
|
||||
root: true
|
||||
})
|
||||
} else {
|
||||
context.commit("bill/update_get_data_status", 2, {
|
||||
root: true
|
||||
})
|
||||
context.commit("bill/update_get_data_error_message", "", {
|
||||
root: true
|
||||
})
|
||||
context.commit("update_edcs", resp.data.records.accounts)
|
||||
context.commit("update_accounts", resp.data.records.accounts)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("bill/update_get_data_status", 3, {
|
||||
root: true
|
||||
})
|
||||
context.commit("bill/update_get_data_error_message", e.message, {
|
||||
root: true
|
||||
})
|
||||
console.log(e)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
247
test/vuex/one-bill-payment/modules/paymentnew.js
Normal file
247
test/vuex/one-bill-payment/modules/paymentnew.js
Normal file
@@ -0,0 +1,247 @@
|
||||
import * as api from "../api/payment.js"
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
lookup_status:0,
|
||||
lookup_error_message:'',
|
||||
types: [],
|
||||
total_payment:0,
|
||||
reload_after_save: false,
|
||||
dialog_pay_success:false,
|
||||
paynumber :'',
|
||||
notes :[],
|
||||
dialog_delete:false,
|
||||
msg_delete:'',
|
||||
note_delete:'',
|
||||
nota_delete:{},
|
||||
open_print_note:false,
|
||||
idx:0,
|
||||
last_payments:{},
|
||||
payment_total: 0,
|
||||
banks:[],
|
||||
disable_btn_pay:'Y',
|
||||
accounts:[],
|
||||
ordertests:[],
|
||||
isauto: 'N',
|
||||
in_saving: false
|
||||
},
|
||||
mutations: {
|
||||
update_in_saving(state, val) {
|
||||
state.in_saving = val
|
||||
},
|
||||
update_accounts(state,val) {
|
||||
state.accounts = val
|
||||
},
|
||||
update_disable_btn_pay(state,val) {
|
||||
state.disable_btn_pay = val
|
||||
},
|
||||
update_banks(state,val) {
|
||||
state.banks = val
|
||||
},
|
||||
update_lookup_error_message(state,val) {
|
||||
state.lookup_error_message = val
|
||||
},
|
||||
update_lookup_status(state,status) {
|
||||
state.lookup_status = status
|
||||
},
|
||||
update_types(state,data) {
|
||||
state.types = data.records
|
||||
state.total_type = data.total
|
||||
},
|
||||
update_selected_status(state,val) {
|
||||
state.selected_status=val
|
||||
},
|
||||
update_total_payment(state,val) {
|
||||
state.total_payment=val
|
||||
},
|
||||
update_reload_after_save(state,val) {
|
||||
state.reload_after_save=val
|
||||
},
|
||||
update_dialog_pay_success(state,val) {
|
||||
state.dialog_pay_success=val
|
||||
},
|
||||
update_paynumber(state,val) {
|
||||
state.paynumber=val
|
||||
},
|
||||
update_notes(state,val) {
|
||||
state.notes=val
|
||||
},
|
||||
update_dialog_delete(state,val) {
|
||||
state.dialog_delete=val
|
||||
},
|
||||
update_note_delete(state,val) {
|
||||
state.note_delete=val
|
||||
},
|
||||
update_msg_delete(state,val) {
|
||||
state.msg_delete=val
|
||||
},
|
||||
update_nota_delete(state,val) {
|
||||
state.nota_delete=val
|
||||
},
|
||||
update_open_print_note(state,val) {
|
||||
state.open_print_note=val
|
||||
},
|
||||
update_idx(state,val) {
|
||||
state.idx=val
|
||||
},
|
||||
update_last_payments(state,val) {
|
||||
state.last_payments=val
|
||||
},
|
||||
update_ordertests(state,data){
|
||||
state.ordertests = data
|
||||
},
|
||||
update_isauto(state, val) {
|
||||
state.isauto = val
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
async lookup_type(context,prm) {
|
||||
context.commit("update_lookup_status",1)
|
||||
try {
|
||||
let resp= await api.lookup_type(one_token())
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_lookup_status",3)
|
||||
context.commit("update_lookup_error_message",resp.message)
|
||||
} else {
|
||||
context.commit("update_lookup_status",2)
|
||||
context.commit("update_lookup_error_message","")
|
||||
let data = {
|
||||
records : resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_types",data)
|
||||
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_lookup_status",3)
|
||||
context.commit("update_lookup_error_message",e.message )
|
||||
}
|
||||
},
|
||||
async lookup_banks(context) {
|
||||
context.commit("update_lookup_status",1)
|
||||
try {
|
||||
let resp= await api.lookup_banks(one_token())
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_lookup_status",3)
|
||||
context.commit("update_lookup_error_message",resp.message)
|
||||
} else {
|
||||
context.commit("update_lookup_status",2)
|
||||
context.commit("update_lookup_error_message","")
|
||||
let data = {
|
||||
records : resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_banks",data.records)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_lookup_status",3)
|
||||
context.commit("update_lookup_error_message",e.message )
|
||||
}
|
||||
},
|
||||
async lookup_accounts(context) {
|
||||
context.commit("update_lookup_status",1)
|
||||
try {
|
||||
let resp= await api.lookup_accounts(one_token())
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_lookup_status",3)
|
||||
context.commit("update_lookup_error_message",resp.message)
|
||||
} else {
|
||||
context.commit("update_lookup_status",2)
|
||||
context.commit("update_lookup_error_message","")
|
||||
let data = {
|
||||
records : resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_accounts",data.records)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_lookup_status",3)
|
||||
context.commit("update_lookup_error_message",e.message )
|
||||
}
|
||||
},
|
||||
async searchcard(context,prm) {
|
||||
context.commit("update_lookup_status",1)
|
||||
try {
|
||||
let resp= await api.searchcard(one_token(),prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_lookup_status",3)
|
||||
} else {
|
||||
context.commit("update_lookup_status",2)
|
||||
let data = {
|
||||
records : resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_cards",resp.data.records)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_lookup_status",3)
|
||||
}
|
||||
},
|
||||
async pay(context,prm) {
|
||||
context.commit("update_lookup_status",1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp= await api.pay(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_lookup_status",3)
|
||||
context.commit("update_lookup_error_message",resp.message)
|
||||
} else {
|
||||
context.commit("update_lookup_status",2)
|
||||
context.commit("update_lookup_error_message","")
|
||||
let data = {
|
||||
records : resp.data.records.types,
|
||||
total: resp.data.total
|
||||
}
|
||||
let xnumber = resp.data.records.data.numberx
|
||||
let id = resp.data.records.data.idx
|
||||
var xobj = context.state.types
|
||||
//console.log(xobj)
|
||||
xobj.forEach(function(obj){
|
||||
obj.chex = false
|
||||
obj.leftvalue = 0
|
||||
obj.rightvalue = 0
|
||||
obj.selected_card = {id:0,name:''}
|
||||
obj.selected_edc = {id:0,name:''}
|
||||
obj.selected_account = {id:0,name:''}
|
||||
})
|
||||
var xray = {records:xobj,total:xobj.length}
|
||||
context.commit("update_types",xray)
|
||||
context.commit("update_disable_btn_pay",'Y')
|
||||
console.log(context.state.types)
|
||||
context.commit("update_last_payments",prm.payments)
|
||||
context.commit("update_idx",id)
|
||||
context.commit("update_total_payment",0)
|
||||
context.commit("update_paynumber","Pembayaran nomor <span style='color:red'>"+xnumber+"</span> telah berhasil")
|
||||
context.commit("update_dialog_pay_success",true)
|
||||
context.commit("update_in_saving", false)
|
||||
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_lookup_status",3)
|
||||
context.commit("update_lookup_error_message",e.message )
|
||||
}
|
||||
},
|
||||
async delete_note(context,prm) {
|
||||
context.commit("update_lookup_status",1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp= await api.delete_note(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_lookup_status",3)
|
||||
context.commit("update_lookup_error_message",resp.message)
|
||||
} else {
|
||||
context.commit("update_lookup_status",2)
|
||||
context.commit("update_lookup_error_message","")
|
||||
let xmsg = "Nota nomor <span style='color:red'>"+prm.nota.note_number+"</span> telah dihapus"
|
||||
context.commit("update_msg_delete",xmsg)
|
||||
context.commit("update_note_delete",'')
|
||||
context.commit("update_nota_delete",{})
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_lookup_status",3)
|
||||
context.commit("update_lookup_error_message",e.message )
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user