From d018e85927b31761a10eac43441322d99dba539e Mon Sep 17 00:00:00 2001 From: sasadib Date: Wed, 13 May 2026 16:52:20 +0700 Subject: [PATCH] update proses add akun pusat media jurnal & move barcode to serah terima --- .../api/journal.js | 282 ++++ .../components/dialogCloseJurnal.vue | 77 + .../components/dialogEditJurnal.vue | 223 +++ .../components/dialogPostingJurnal.vue | 68 + .../components/dialogRequestEditJurnal.vue | 58 + .../components/oneMediaJournalList.vue | 1075 +++++++++++++ .../index.php | 73 + .../modules/journal.js | 581 +++++++ .../acc-one-jurnal-penerimaan-barang/store.js | 23 + .../acc-one-pendapatan-cash-v2/api/journal.js | 276 ++++ .../components/dialogCloseJurnal.vue | 76 + .../components/dialogEditJurnal.vue | 223 +++ .../components/dialogPostingJurnal.vue | 68 + .../components/dialogRequestEditJurnal.vue | 58 + .../components/oneMediaJournalList.vue | 1099 +++++++++++++ .../vuex/acc-one-pendapatan-cash-v2/index.php | 73 + .../modules/journal.js | 584 +++++++ test/vuex/acc-one-pendapatan-cash-v2/store.js | 23 + .../components/dialogHandOver.vue | 50 +- .../components/oneRoLayout.vue | 5 +- .../api/bill.js | 59 + .../api/payment.js | 118 ++ .../api/paymentmanual.js | 231 +++ .../components/oneBillList.vue | 978 ++++++++++++ .../components/oneBillPaymentAuto.vue | 855 ++++++++++ .../components/oneBillPaymentManual.vue | 1401 +++++++++++++++++ .../components/oneBillPaymentMulti.vue | 1372 ++++++++++++++++ .../components/oneBillPaymentNew.vue | 815 ++++++++++ .../index.php | 96 ++ .../modules/bill.js | 364 +++++ .../modules/paymentmanual.js | 604 +++++++ .../modules/paymentnew.js | 255 +++ .../store.js | 31 + test/vuex/one-md-usergroup-user-v6/action.js | 0 test/vuex/one-md-usergroup-user-v6/api.js | 31 + .../vuex/one-md-usergroup-user-v6/api/user.js | 98 ++ .../one-md-usergroup-user-v6/api/usergroup.js | 192 +++ .../components/oneMdUserGroupList.vue | 458 ++++++ .../components/oneMdUserList.vue | 872 ++++++++++ test/vuex/one-md-usergroup-user-v6/index.php | 76 + .../one-md-usergroup-user-v6/modules/user.js | 295 ++++ .../modules/usergroup.js | 437 +++++ .../vuex/one-md-usergroup-user-v6/mutation.js | 0 test/vuex/one-md-usergroup-user-v6/store.js | 25 + 44 files changed, 14646 insertions(+), 12 deletions(-) create mode 100644 test/vuex/acc-one-jurnal-penerimaan-barang/api/journal.js create mode 100644 test/vuex/acc-one-jurnal-penerimaan-barang/components/dialogCloseJurnal.vue create mode 100644 test/vuex/acc-one-jurnal-penerimaan-barang/components/dialogEditJurnal.vue create mode 100644 test/vuex/acc-one-jurnal-penerimaan-barang/components/dialogPostingJurnal.vue create mode 100644 test/vuex/acc-one-jurnal-penerimaan-barang/components/dialogRequestEditJurnal.vue create mode 100644 test/vuex/acc-one-jurnal-penerimaan-barang/components/oneMediaJournalList.vue create mode 100644 test/vuex/acc-one-jurnal-penerimaan-barang/index.php create mode 100644 test/vuex/acc-one-jurnal-penerimaan-barang/modules/journal.js create mode 100644 test/vuex/acc-one-jurnal-penerimaan-barang/store.js create mode 100644 test/vuex/acc-one-pendapatan-cash-v2/api/journal.js create mode 100644 test/vuex/acc-one-pendapatan-cash-v2/components/dialogCloseJurnal.vue create mode 100644 test/vuex/acc-one-pendapatan-cash-v2/components/dialogEditJurnal.vue create mode 100644 test/vuex/acc-one-pendapatan-cash-v2/components/dialogPostingJurnal.vue create mode 100644 test/vuex/acc-one-pendapatan-cash-v2/components/dialogRequestEditJurnal.vue create mode 100644 test/vuex/acc-one-pendapatan-cash-v2/components/oneMediaJournalList.vue create mode 100644 test/vuex/acc-one-pendapatan-cash-v2/index.php create mode 100644 test/vuex/acc-one-pendapatan-cash-v2/modules/journal.js create mode 100644 test/vuex/acc-one-pendapatan-cash-v2/store.js create mode 100644 test/vuex/acc-one-supplier-payment-cashier-v5/api/bill.js create mode 100644 test/vuex/acc-one-supplier-payment-cashier-v5/api/payment.js create mode 100644 test/vuex/acc-one-supplier-payment-cashier-v5/api/paymentmanual.js create mode 100644 test/vuex/acc-one-supplier-payment-cashier-v5/components/oneBillList.vue create mode 100644 test/vuex/acc-one-supplier-payment-cashier-v5/components/oneBillPaymentAuto.vue create mode 100644 test/vuex/acc-one-supplier-payment-cashier-v5/components/oneBillPaymentManual.vue create mode 100644 test/vuex/acc-one-supplier-payment-cashier-v5/components/oneBillPaymentMulti.vue create mode 100644 test/vuex/acc-one-supplier-payment-cashier-v5/components/oneBillPaymentNew.vue create mode 100644 test/vuex/acc-one-supplier-payment-cashier-v5/index.php create mode 100644 test/vuex/acc-one-supplier-payment-cashier-v5/modules/bill.js create mode 100644 test/vuex/acc-one-supplier-payment-cashier-v5/modules/paymentmanual.js create mode 100644 test/vuex/acc-one-supplier-payment-cashier-v5/modules/paymentnew.js create mode 100644 test/vuex/acc-one-supplier-payment-cashier-v5/store.js create mode 100644 test/vuex/one-md-usergroup-user-v6/action.js create mode 100644 test/vuex/one-md-usergroup-user-v6/api.js create mode 100644 test/vuex/one-md-usergroup-user-v6/api/user.js create mode 100644 test/vuex/one-md-usergroup-user-v6/api/usergroup.js create mode 100644 test/vuex/one-md-usergroup-user-v6/components/oneMdUserGroupList.vue create mode 100644 test/vuex/one-md-usergroup-user-v6/components/oneMdUserList.vue create mode 100644 test/vuex/one-md-usergroup-user-v6/index.php create mode 100644 test/vuex/one-md-usergroup-user-v6/modules/user.js create mode 100644 test/vuex/one-md-usergroup-user-v6/modules/usergroup.js create mode 100644 test/vuex/one-md-usergroup-user-v6/mutation.js create mode 100644 test/vuex/one-md-usergroup-user-v6/store.js diff --git a/test/vuex/acc-one-jurnal-penerimaan-barang/api/journal.js b/test/vuex/acc-one-jurnal-penerimaan-barang/api/journal.js new file mode 100644 index 0000000..05ecfc2 --- /dev/null +++ b/test/vuex/acc-one-jurnal-penerimaan-barang/api/journal.js @@ -0,0 +1,282 @@ +const URL = "/one-api/mockup/masterdata/accounting/"; + +export async function getPeriode(prm) { + try { + var resp = await axios.post(URL + "Journalgoodreceive/getPeriode", prm); + if (resp.status != 200) { + return { + status: "ERR", + message: resp.statusText + }; + } + let data = resp.data; + return data; + } catch (e) { + return { + status: "ERR", + message: e.message + }; + } +} + +export async function search( + token, + xdate, + periodeid, + current_page, + search, + branchCode, + regionalId +) { + try { + var resp = await axios.post(URL + "Journalgoodreceive/search", { + token: token, + xdate: xdate, + periodeid: periodeid, + current_page: current_page, + search: search, + branchCode: branchCode, + regionalId: regionalId + }); + if (resp.status != 200) { + return { + status: "ERR", + message: resp.statusText + }; + } + let data = resp.data; + return data; + } catch (e) { + return { + status: "ERR", + message: e.message + }; + } +} + +export async function insertSales(branchCode, date, jurnalno) { + try { + var resp = await axios.get( + URL + `mediajurnalauto/insertSales/${branchCode}/${date}?isregen=1&jurnalno=${jurnalno}` + ); + if (resp.status != 200) { + return { + status: "ERR", + message: resp.statusText + }; + } + let data = resp.data; + return data; + } catch (e) { + return { + status: "ERR", + message: e.message + }; + } +} + +export async function getRegional(prm) { + try { + var resp = await axios.post(URL + "Journalgoodreceive/getRegional", prm); + if (resp.status !== 200) { + return { + status: "ERR", + message: resp.statusText + }; + } + + let data = resp.data; + return data; + } catch (e) { + return { + status: "ERR", + message: e.message + }; + } +} + +export async function getBranch(prm) { + try { + var resp = await axios.post(URL + "Journalgoodreceive/getBranch", prm); + if (resp.status !== 200) { + return { + status: "ERR", + message: resp.statusText + }; + } + + let data = resp.data; + return data; + } catch (e) { + return { + status: "ERR", + message: e.message + }; + } +} + +export async function getUserApproveLevel(params) { + try { + var resp = await axios.post(URL + "Journalgoodreceive/getUserApproveLevel", params); + if (resp.status != 200) { + return { + status: "ERR", + message: resp.statusText + }; + } + + let data = resp.data; + return data; + } catch (error) { + return { + status: "ERR", + message: error.message + }; + } +} + +export async function getListingCOA(params) { + try { + var resp = await axios.post(URL + "Journalgoodreceive/getListingCOA", params); + if (resp.status != 200) { + return { + status: "ERR", + message: resp.statusText + }; + } + + let data = resp.data; + return data; + } catch (error) { + return { + status: "ERR", + message: error.message + }; + } +} + +export async function requestEditJurnal(params) { + try { + const resp = await axios.post(URL + "JournalVerifEdit/requestEditJurnal", params); + if (resp.status !== 200) { + return { + status: "ERR", + message: resp.statusText + }; + } + + const data = resp.data; + return data; + } catch (error) { + return { + status: "ERR", + message: error.message + }; + } +} + +export async function saveEditJurnal(params) { + try { + var resp = await axios.post(URL + "JournalVerifEdit/saveEditJurnal", params); + if (resp.status != 200) { + return { + status: "ERR", + message: resp.statusText + }; + } + + let data = resp.data; + return data; + } catch (error) { + return { + status: "ERR", + message: error.message + }; + } +} + +export async function changeJurnalToPosted(params) { + try { + var resp = await axios.post(URL + "Journalgoodreceive/changeJurnalToPosted", params); + if (resp.status != 200) { + return { + status: "ERR", + message: resp.statusText + }; + } + + let data = resp.data; + return data; + } catch (error) { + return { + status: "ERR", + message: error.message + }; + } +} + +export async function getTotalJurnalNotPostedPerPeriod(params) { + try { + var resp = await axios.post( + URL + "Journalgoodreceive/getTotalJurnalNotPostedPerPeriod", + params + ); + if (resp.status != 200) { + return { + status: "ERR", + message: resp.statusText + }; + } + + let data = resp.data; + return data; + } catch (error) { + return { + status: "ERR", + message: error.message + }; + } +} + +export async function closeJurnalPerPeriode(params) { + try { + var resp = await axios.post(URL + "Journalgoodreceive/closeJurnalPerPeriode", params); + if (resp.status != 200) { + return { + status: "ERR", + message: resp.statusText + }; + } + + let data = resp.data; + return data; + } catch (error) { + return { + status: "ERR", + message: error.message + }; + } +} + +export async function getDataJurnalNotClosedPerPeriod(params) { + try { + var resp = await axios.post( + URL + "Journalgoodreceive/getDataJurnalNotClosedPerPeriod", + params + ); + if (resp.status != 200) { + return { + status: "ERR", + message: resp.statusText + }; + } + + let data = resp.data; + return data; + } catch (error) { + return { + status: "ERR", + message: error.message + }; + } +} diff --git a/test/vuex/acc-one-jurnal-penerimaan-barang/components/dialogCloseJurnal.vue b/test/vuex/acc-one-jurnal-penerimaan-barang/components/dialogCloseJurnal.vue new file mode 100644 index 0000000..f8028dc --- /dev/null +++ b/test/vuex/acc-one-jurnal-penerimaan-barang/components/dialogCloseJurnal.vue @@ -0,0 +1,77 @@ + + + diff --git a/test/vuex/acc-one-jurnal-penerimaan-barang/components/dialogEditJurnal.vue b/test/vuex/acc-one-jurnal-penerimaan-barang/components/dialogEditJurnal.vue new file mode 100644 index 0000000..fa4fcb8 --- /dev/null +++ b/test/vuex/acc-one-jurnal-penerimaan-barang/components/dialogEditJurnal.vue @@ -0,0 +1,223 @@ + + + \ No newline at end of file diff --git a/test/vuex/acc-one-jurnal-penerimaan-barang/components/dialogPostingJurnal.vue b/test/vuex/acc-one-jurnal-penerimaan-barang/components/dialogPostingJurnal.vue new file mode 100644 index 0000000..0ae425c --- /dev/null +++ b/test/vuex/acc-one-jurnal-penerimaan-barang/components/dialogPostingJurnal.vue @@ -0,0 +1,68 @@ + + + \ No newline at end of file diff --git a/test/vuex/acc-one-jurnal-penerimaan-barang/components/dialogRequestEditJurnal.vue b/test/vuex/acc-one-jurnal-penerimaan-barang/components/dialogRequestEditJurnal.vue new file mode 100644 index 0000000..92715a8 --- /dev/null +++ b/test/vuex/acc-one-jurnal-penerimaan-barang/components/dialogRequestEditJurnal.vue @@ -0,0 +1,58 @@ + + + diff --git a/test/vuex/acc-one-jurnal-penerimaan-barang/components/oneMediaJournalList.vue b/test/vuex/acc-one-jurnal-penerimaan-barang/components/oneMediaJournalList.vue new file mode 100644 index 0000000..3bc9489 --- /dev/null +++ b/test/vuex/acc-one-jurnal-penerimaan-barang/components/oneMediaJournalList.vue @@ -0,0 +1,1075 @@ + + + + + diff --git a/test/vuex/acc-one-jurnal-penerimaan-barang/index.php b/test/vuex/acc-one-jurnal-penerimaan-barang/index.php new file mode 100644 index 0000000..a736dd6 --- /dev/null +++ b/test/vuex/acc-one-jurnal-penerimaan-barang/index.php @@ -0,0 +1,73 @@ + + + + + + + + One + + + + + +
+ + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/vuex/acc-one-jurnal-penerimaan-barang/modules/journal.js b/test/vuex/acc-one-jurnal-penerimaan-barang/modules/journal.js new file mode 100644 index 0000000..394dbf1 --- /dev/null +++ b/test/vuex/acc-one-jurnal-penerimaan-barang/modules/journal.js @@ -0,0 +1,581 @@ +// 1 => LOADING +// 2 => DONE +// 3 => ERROR +import * as api from "../api/journal.js"; + +export default { + namespaced: true, + state: { + search_status: 0, + current_page: 1, + x_search: "", + search_error_message: "", + last_id: -1, + coas: [], + total_coas: 0, + selected_coa: {}, + dialog_form_coa: false, + act: "new", + save_status: 0, + save_error_message: "", + errors: [], + alert_success: false, + msg_success: "", + alert_error: false, + dialog_error: false, + open_print: false, + + // ---- + xdate: moment(new Date()).format("YYYY-MM-DD"), + end_date: moment(new Date()).format("YYYY-MM-DD"), + journals: [], + selected_journal: {}, + summary: { debit: 0, credit: 0, balance: 0 }, + dialog_form_detail: false, + periodeList: [], + selected_periode: {}, + loading: false, + dialog_form_periode: false, + autocomplete_status: 0, + search_status: 0, + total_journal: 0, + user: one_user(), + jurnaldetails: [], + dialog_error_jurnal: false, + msgerrjurnallist: [], + regionals: [], + selected_regional: {}, + branchs: [], + selected_branch: {}, + xsearch: "", + open_dialog_info: false, + msg_info: "", + + // -- + dialog_edit_journal: false, + user_level: {}, + list_coa: [], + journal_edit: [], + dialog_confirm_posting: false, + total_jurnal_not_posted: [], + dialog_request_edit: false, + + // --- + dialog_close_jurnal: false, + jurnal_to_close: [] + }, + mutations: { + update_search_status(state, val) { + state.search_status = val; + }, + update_current_page(state, val) { + state.current_page = val; + }, + update_x_search(state, val) { + state.x_search = val; + state.current_page = 1; + }, + update_search_error_message(state, val) { + state.search_error_message = val; + }, + update_last_id(state, val) { + state.last_id = val; + }, + update_coas(state, val) { + state.coas = val; + }, + update_total_coas(state, val) { + state.total_coas = val; + }, + update_selected_coa(state, val) { + state.selected_coa = val; + }, + update_dialog_form_coa(state, val) { + state.dialog_form_coa = val; + }, + update_act(state, val) { + state.act = val; + }, + update_save_status(state, val) { + state.save_status = val; + }, + update_save_error_message(state, val) { + state.save_error_message = val; + }, + update_errors(state, val) { + state.errors = val; + }, + update_alert_success(state, val) { + state.alert_success = val; + }, + update_msg_success(state, val) { + state.msg_success = val; + }, + update_alert_error(state, val) { + state.alert_error = val; + }, + update_dialog_error(state, val) { + state.dialog_error = val; + }, + update_open_print(state, value) { + state.open_print = value; + }, + + // --- + update_xdate(state, val) { + state.xdate = val; + }, + update_end_date(state, val) { + state.end_date = val; + }, + update_journals(state, val) { + state.journals = val; + }, + update_selected_journal(state, val) { + state.selected_journal = val; + }, + update_summary(state, val) { + state.summary = val; + }, + update_dialog_form_detail(state, val) { + state.dialog_form_detail = val; + }, + update_periodeList(state, val) { + state.periodeList = val; + }, + update_selected_periode(state, val) { + state.selected_periode = val; + }, + update_loading(state, val) { + state.loading = val; + }, + update_dialog_form_periode(state, val) { + state.dialog_form_periode = val; + }, + update_autocomplete_status(state, val) { + state.autocomplete_status = val; + }, + update_search_status(state, val) { + state.search_status = val; + }, + update_total_journal(state, val) { + state.total_journal = val; + }, + update_user(state, val) { + state.user = val; + }, + update_jurnaldetails(state, val) { + state.jurnaldetails = val; + }, + update_dialog_error_jurnal(state, val) { + state.dialog_error_jurnal = val; + }, + update_msgerrjurnallist(state, val) { + state.msgerrjurnallist = val; + }, + update_regionals(state, val) { + state.regionals = val; + }, + update_selected_regional(state, val) { + state.selected_regional = val; + }, + update_branchs(state, val) { + state.branchs = val; + }, + update_selected_branch(state, val) { + state.selected_branch = val; + }, + update_xsearch(state, val) { + state.xsearch = val; + state.current_page = 1; + }, + update_open_dialog_info(state, val) { + state.open_dialog_info = val; + }, + update_msg_info(state, val) { + state.msg_info = val; + }, + + update_dialog_edit_journal(state, val) { + state.dialog_edit_journal = val; + }, + update_user_level(state, val) { + state.user_level = val; + }, + update_list_coa(state, val) { + state.list_coa = val; + }, + update_journal_edit(state, val) { + state.journal_edit = val; + }, + update_dialog_confirm_posting(state, val) { + state.dialog_confirm_posting = val; + }, + update_total_jurnal_not_posted(state, val) { + state.total_jurnal_not_posted = val; + }, + update_dialog_request_edit(state, val) { + state.dialog_request_edit = val; + }, + + update_dialog_close_jurnal(state, val) { + state.dialog_close_jurnal = val; + }, + update_jurnal_to_close(state, val) { + state.jurnal_to_close = val; + } + }, + actions: { + async getPeriode(context) { + context.commit("update_autocomplete_status", 1); + try { + let prm = {}; + prm.token = one_token(); + let resp = await api.getPeriode(prm); + if (resp.status != "OK") { + context.commit("update_autocomplete_status", 3); + } else { + context.commit("update_autocomplete_status", 2); + let data = resp.data; + context.commit("update_periodeList", resp.data); + + // Ambil bulan dan tahun sekarang + let now = new Date(); + let currentMonth = now.getMonth() + 1; // getMonth() dimulai dari 0 (Jan = 0) + let currentYear = now.getFullYear().toString(); // Ambil tahun dalam bentuk string + + // Cari data dengan periodeMonth dan periodeYear yang cocok + let selectedPeriode = data.find( + (p) => + p.periodeMonth == currentMonth.toString() && + p.periodeYear == currentYear + ); + + // Jika tidak ditemukan, gunakan data pertama sebagai default + if (!selectedPeriode) { + selectedPeriode = data[0]; + } + + context.commit("update_selected_periode", selectedPeriode); + } + } catch (e) { + context.commit("update_autocomplete_status", 3); + } + }, + async search(context, prm) { + context.commit("update_search_status", 1); + try { + let resp = await api.search( + one_token(), + prm.xdate, + prm.periodeid, + prm.current_page, + prm.search, + prm.branchCode, + prm.regionalId + ); + if (resp.status != "OK") { + context.commit("update_search_status", 3); + context.commit("update_search_error_message", resp.message); + } else { + context.commit("update_search_status", 2); + context.commit("update_search_error_message", ""); + let data = { + records: resp.data.records, + total: resp.data.total + }; + + context.commit("update_journals", data.records); + context.commit("update_total_journal", data.total); + } + } catch (e) { + context.commit("update_search_status", 3); + context.commit("update_search_error_message", e.message); + } + }, + + async insertSales(context, prm) { + context.commit("update_save_status", 1); + try { + let branchCode = prm.branchCode; + let date = prm.date; + let jurnalno = prm.jurnalno; + let resp = await api.insertSales(branchCode, date, jurnalno); + if (resp.status != "OK") { + context.commit("update_save_status", 3); + context.commit("update_save_error_message", resp.message); + context.commit("update_alert_error", true); + } else { + context.commit("update_save_status", 2); + context.commit("update_save_error_message", resp.message); + let data = { + total: resp.data.total + }; + + context.commit("update_alert_success", true); + var msg = resp.data.msg; + context.commit("update_msg_success", msg); + context.dispatch("search", { + current_page: context.state.current_page, + xdate: context.state.xdate, + periodeid: context.state.selected_periode.id + }); + } + } catch (e) { + context.commit("update_save_status", 3); + context.commit("update_save_error_message", e.message); + context.commit("update_alert_error", true); + } + }, + + async getRegional(context) { + context.commit("update_autocomplete_status", 1); + try { + let resp = await api.getRegional({ + token: one_token(), + regionalId: context.state.user.S_RegionalID + }); + if (resp.status != "OK") { + context.commit("update_search_error_message", resp.message); + context.commit("update_autocomplete_status", 3); + } else { + context.commit("update_search_error_message", ""); + context.commit("update_autocomplete_status", 2); + let data = { + records: resp.data.records, + selected: resp.data.selected + }; + + context.commit("update_regionals", data.records); + context.commit("update_selected_regional", data.selected); + } + } catch (e) { + context.commit("update_search_error_message", e.message); + context.commit("update_autocomplete_status", 3); + } + }, + + async getBranch(context) { + context.commit("update_autocomplete_status", 1); + try { + let resp = await api.getBranch({ + token: one_token(), + regionalId: context.state.selected_regional.S_RegionalID, + branchCode: context.state.user.M_BranchCode + }); + if (resp.status != "OK") { + context.commit("update_search_error_message", resp.message); + context.commit("update_autocomplete_status", 3); + } else { + context.commit("update_search_error_message", ""); + context.commit("update_autocomplete_status", 2); + let data = { + records: resp.data.records, + selected: resp.data.selected + }; + + context.commit("update_branchs", data.records); + context.commit("update_selected_branch", data.selected); + } + } catch (e) { + context.commit("update_search_error_message", e.message); + context.commit("update_autocomplete_status", 3); + } + }, + + async postingJurnal(context, typeid) { + try { + let param = { + token: one_token(), + jurnalTypeID: typeid, + periodeID: context.state.selected_periode.id + }; + const resp = await api.changeJurnalToPosted(param); + if (resp.status != "OK") { + context.commit("update_alert_error", true); + context.commit("update_save_error_message", resp.message); + } else { + context.commit("update_msg_success", resp.data); + context.commit("update_alert_success", true); + + context.dispatch("search", { + branchCode: context.state.selected_branch.M_BranchCode ?? "", + regionalId: context.state.selected_regional.S_RegionalID, + search: context.state.x_search, + current_page: context.state.current_page, + xdate: context.state.xdate, + periodeid: context.state.selected_periode.id + }); + + context.commit("update_total_jurnal_not_posted", 0); + context.commit("update_dialog_confirm_posting", false); + } + } catch (error) { + context.commit("update_alert_error", true); + context.commit("update_save_error_message", error.message); + } + }, + + async getUserApprovalLevel(context) { + try { + let param = { token: one_token() }; + const resp = await api.getUserApproveLevel(param); + if (resp.status != "OK") { + context.commit("update_alert_error", true); + context.commit("update_save_error_message", resp.message); + } else { + context.commit("update_user_level", resp.data); + } + } catch (error) { + context.commit("update_alert_error", true); + context.commit("update_save_error_message", error.message); + } + }, + + async getListingCOA(context) { + try { + let param = { + token: one_token(), + keyword: "" + }; + const resp = await api.getListingCOA(param); + if (resp.status != "OK") { + context.commit("update_alert_error", true); + context.commit("update_save_error_message", resp.message); + } else { + context.commit("update_list_coa", resp.data); + } + } catch (error) { + context.commit("update_alert_error", true); + context.commit("update_save_error_message", error.message); + } + }, + + async requestEditJurnal(context) { + try { + let param = { + token: one_token(), + jurnalID: context.state.selected_journal.jurnalID, + staffID: context.state.user.M_UserID, + staffName: context.state.user.M_UserUsername + }; + const resp = await api.requestEditJurnal(param); + if (resp.status != "OK") { + context.commit("update_alert_error", true); + context.commit("update_save_error_message", resp.message); + } else { + context.commit("update_msg_success", resp.data); + context.commit("update_alert_success", true); + context.commit("update_dialog_request_edit", false); + } + } catch (error) { + context.commit("update_alert_error", true); + context.commit("update_save_error_message", error.message); + } + }, + + async saveEditJurnal(context, newdetail) { + try { + let param = { + token: one_token(), + jurnalID: context.state.selected_journal.jurnalID, + jurnalRequestEditID: context.state.selected_journal.JurnalRequestEditID, + oldjurnaltx: context.state.selected_journal.detailtx, + newjurnaltx: newdetail + }; + const resp = await api.saveEditJurnal(param); + if (resp.status != "OK") { + context.commit("update_alert_error", true); + context.commit("update_save_error_message", resp.message); + } else { + context.dispatch("search", { + branchCode: context.state.selected_branch.M_BranchCode ?? "", + regionalId: context.state.selected_regional.S_RegionalID, + search: context.state.x_search, + current_page: context.state.current_page, + xdate: context.state.xdate, + periodeid: context.state.selected_periode.id + }); + + context.commit("update_dialog_edit_journal", false); + context.commit("update_msg_success", resp.data); + context.commit("update_alert_success", true); + } + } catch (error) { + context.commit("update_alert_error", true); + context.commit("update_save_error_message", error.message); + } + }, + + async totalJurnalNotPostedPerPeriod(context) { + try { + let param = { + token: one_token(), + periodeID: context.state.selected_periode.id + }; + const resp = await api.getTotalJurnalNotPostedPerPeriod(param); + if (resp.status != "OK") { + context.commit("update_alert_error", true); + context.commit("update_save_error_message", resp.message); + } else { + context.commit("update_total_jurnal_not_posted", resp.data ?? []); + } + } catch (error) { + context.commit("update_alert_error", true); + context.commit("update_save_error_message", error.message); + } + }, + + async getDataJurnalNotClosedPerPeriod(context) { + try { + let param = { + token: one_token(), + periodeID: context.state.selected_periode.id + }; + const resp = await api.getDataJurnalNotClosedPerPeriod(param); + if (resp.status != "OK") { + context.commit("update_alert_error", true); + context.commit("update_save_error_message", resp.message); + } else { + context.commit("update_jurnal_to_close", resp.data ?? []); + } + } catch (error) { + context.commit("update_alert_error", true); + context.commit("update_save_error_message", error.message); + } + }, + + async closeJurnalPerPeriode(context, typeid) { + try { + let param = { + token: one_token(), + jurnalTypeID: typeid, + periodeID: context.state.selected_periode.id + }; + const resp = await api.closeJurnalPerPeriode(param); + if (resp.status != "OK") { + context.commit("update_alert_error", true); + context.commit("update_save_error_message", resp.message); + } else { + context.commit("update_msg_success", resp.data); + context.commit("update_alert_success", true); + + context.dispatch("search", { + branchCode: context.state.selected_branch.M_BranchCode ?? "", + regionalId: context.state.selected_regional.S_RegionalID, + search: context.state.x_search, + current_page: context.state.current_page, + xdate: context.state.xdate, + periodeid: context.state.selected_periode.id + }); + + context.commit("update_jurnal_to_close", []); + context.commit("update_dialog_close_jurnal", false); + } + } catch (error) { + context.commit("update_alert_error", true); + context.commit("update_save_error_message", error.message); + } + } + } +}; diff --git a/test/vuex/acc-one-jurnal-penerimaan-barang/store.js b/test/vuex/acc-one-jurnal-penerimaan-barang/store.js new file mode 100644 index 0000000..292d3b1 --- /dev/null +++ b/test/vuex/acc-one-jurnal-penerimaan-barang/store.js @@ -0,0 +1,23 @@ +// State +// data ... +// Mutations +// +// +// Actions +import journal from "./modules/journal.js"; +import system from "../../../apps/modules/system/system.js"; +export const store = new Vuex.Store({ + modules: { + journal: journal, + system:system + }, + state: { + + }, + mutations: { + + }, + actions: { + + } +}); \ No newline at end of file diff --git a/test/vuex/acc-one-pendapatan-cash-v2/api/journal.js b/test/vuex/acc-one-pendapatan-cash-v2/api/journal.js new file mode 100644 index 0000000..b488809 --- /dev/null +++ b/test/vuex/acc-one-pendapatan-cash-v2/api/journal.js @@ -0,0 +1,276 @@ +const URL = "/one-api/mockup/masterdata/accounting/"; + +export async function getPeriode(prm) { + try { + var resp = await axios.post(URL + "journalcashv2/getPeriode", prm); + if (resp.status != 200) { + return { + status: "ERR", + message: resp.statusText + }; + } + let data = resp.data; + return data; + } catch (e) { + return { + status: "ERR", + message: e.message + }; + } +} + +export async function search( + token, + xdate, + periodeid, + current_page, + search, + branchCode, + regionalId +) { + try { + var resp = await axios.post(URL + "journalcashv2/search", { + token: token, + xdate: xdate, + periodeid: periodeid, + current_page: current_page, + search: search, + branchCode: branchCode, + regionalId: regionalId + }); + if (resp.status != 200) { + return { + status: "ERR", + message: resp.statusText + }; + } + let data = resp.data; + return data; + } catch (e) { + return { + status: "ERR", + message: e.message + }; + } +} + +export async function insertSales(branchCode, date, jurnalno) { + try { + var resp = await axios.get( + URL + `mediajurnalauto/insertSales/${branchCode}/${date}?isregen=1&jurnalno=${jurnalno}` + ); + if (resp.status != 200) { + return { + status: "ERR", + message: resp.statusText + }; + } + let data = resp.data; + return data; + } catch (e) { + return { + status: "ERR", + message: e.message + }; + } +} + +export async function getRegional(prm) { + try { + var resp = await axios.post(URL + "journalcashv2/getRegional", prm); + if (resp.status !== 200) { + return { + status: "ERR", + message: resp.statusText + }; + } + + let data = resp.data; + return data; + } catch (e) { + return { + status: "ERR", + message: e.message + }; + } +} + +export async function getBranch(prm) { + try { + var resp = await axios.post(URL + "journalcashv2/getBranch", prm); + if (resp.status !== 200) { + return { + status: "ERR", + message: resp.statusText + }; + } + + let data = resp.data; + return data; + } catch (e) { + return { + status: "ERR", + message: e.message + }; + } +} + +export async function getUserApproveLevel(params) { + try { + var resp = await axios.post(URL + "journalcashv2/getUserApproveLevel", params); + if (resp.status != 200) { + return { + status: "ERR", + message: resp.statusText + }; + } + + let data = resp.data; + return data; + } catch (error) { + return { + status: "ERR", + message: error.message + }; + } +} + +export async function getListingCOA(params) { + try { + var resp = await axios.post(URL + "journalcashv2/getListingCOA", params); + if (resp.status != 200) { + return { + status: "ERR", + message: resp.statusText + }; + } + + let data = resp.data; + return data; + } catch (error) { + return { + status: "ERR", + message: error.message + }; + } +} + +export async function requestEditJurnal(params) { + try { + const resp = await axios.post(URL + "JournalVerifEdit/requestEditJurnal", params); + if (resp.status !== 200) { + return { + status: "ERR", + message: resp.statusText + }; + } + + const data = resp.data; + return data; + } catch (error) { + return { + status: "ERR", + message: error.message + }; + } +} + +export async function saveEditJurnal(params) { + try { + var resp = await axios.post(URL + "JournalVerifEdit/saveEditJurnal", params); + if (resp.status != 200) { + return { + status: "ERR", + message: resp.statusText + }; + } + + let data = resp.data; + return data; + } catch (error) { + return { + status: "ERR", + message: error.message + }; + } +} + +export async function changeJurnalToPosted(params) { + try { + var resp = await axios.post(URL + "journalcashv2/changeJurnalToPosted", params); + if (resp.status != 200) { + return { + status: "ERR", + message: resp.statusText + }; + } + + let data = resp.data; + return data; + } catch (error) { + return { + status: "ERR", + message: error.message + }; + } +} + +export async function getTotalJurnalNotPostedPerPeriod(params) { + try { + var resp = await axios.post(URL + "journalcashv2/getTotalJurnalNotPostedPerPeriod", params); + if (resp.status != 200) { + return { + status: "ERR", + message: resp.statusText + }; + } + + let data = resp.data; + return data; + } catch (error) { + return { + status: "ERR", + message: error.message + }; + } +} + +export async function closeJurnalPerPeriode(params) { + try { + var resp = await axios.post(URL + "journalcashv2/closeJurnalPerPeriode", params); + if (resp.status != 200) { + return { + status: "ERR", + message: resp.statusText + }; + } + + let data = resp.data; + return data; + } catch (error) { + return { + status: "ERR", + message: error.message + }; + } +} + +export async function getDataJurnalNotClosedPerPeriod(params) { + try { + var resp = await axios.post(URL + "journalcashv2/getDataJurnalNotClosedPerPeriod", params); + if (resp.status != 200) { + return { + status: "ERR", + message: resp.statusText + }; + } + + let data = resp.data; + return data; + } catch (error) { + return { + status: "ERR", + message: error.message + }; + } +} diff --git a/test/vuex/acc-one-pendapatan-cash-v2/components/dialogCloseJurnal.vue b/test/vuex/acc-one-pendapatan-cash-v2/components/dialogCloseJurnal.vue new file mode 100644 index 0000000..417ffbb --- /dev/null +++ b/test/vuex/acc-one-pendapatan-cash-v2/components/dialogCloseJurnal.vue @@ -0,0 +1,76 @@ + + + diff --git a/test/vuex/acc-one-pendapatan-cash-v2/components/dialogEditJurnal.vue b/test/vuex/acc-one-pendapatan-cash-v2/components/dialogEditJurnal.vue new file mode 100644 index 0000000..328bc8d --- /dev/null +++ b/test/vuex/acc-one-pendapatan-cash-v2/components/dialogEditJurnal.vue @@ -0,0 +1,223 @@ + + + \ No newline at end of file diff --git a/test/vuex/acc-one-pendapatan-cash-v2/components/dialogPostingJurnal.vue b/test/vuex/acc-one-pendapatan-cash-v2/components/dialogPostingJurnal.vue new file mode 100644 index 0000000..0ae425c --- /dev/null +++ b/test/vuex/acc-one-pendapatan-cash-v2/components/dialogPostingJurnal.vue @@ -0,0 +1,68 @@ + + + \ No newline at end of file diff --git a/test/vuex/acc-one-pendapatan-cash-v2/components/dialogRequestEditJurnal.vue b/test/vuex/acc-one-pendapatan-cash-v2/components/dialogRequestEditJurnal.vue new file mode 100644 index 0000000..92715a8 --- /dev/null +++ b/test/vuex/acc-one-pendapatan-cash-v2/components/dialogRequestEditJurnal.vue @@ -0,0 +1,58 @@ + + + diff --git a/test/vuex/acc-one-pendapatan-cash-v2/components/oneMediaJournalList.vue b/test/vuex/acc-one-pendapatan-cash-v2/components/oneMediaJournalList.vue new file mode 100644 index 0000000..e8509f1 --- /dev/null +++ b/test/vuex/acc-one-pendapatan-cash-v2/components/oneMediaJournalList.vue @@ -0,0 +1,1099 @@ + + + + + diff --git a/test/vuex/acc-one-pendapatan-cash-v2/index.php b/test/vuex/acc-one-pendapatan-cash-v2/index.php new file mode 100644 index 0000000..a736dd6 --- /dev/null +++ b/test/vuex/acc-one-pendapatan-cash-v2/index.php @@ -0,0 +1,73 @@ + + + + + + + + One + + + + + +
+ + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/vuex/acc-one-pendapatan-cash-v2/modules/journal.js b/test/vuex/acc-one-pendapatan-cash-v2/modules/journal.js new file mode 100644 index 0000000..0ff2734 --- /dev/null +++ b/test/vuex/acc-one-pendapatan-cash-v2/modules/journal.js @@ -0,0 +1,584 @@ +// 1 => LOADING +// 2 => DONE +// 3 => ERROR +import * as api from "../api/journal.js"; + +export default { + namespaced: true, + state: { + search_status: 0, + current_page: 1, + x_search: "", + search_error_message: "", + last_id: -1, + coas: [], + total_coas: 0, + selected_coa: {}, + dialog_form_coa: false, + act: "new", + save_status: 0, + save_error_message: "", + errors: [], + alert_success: false, + msg_success: "", + alert_error: false, + dialog_error: false, + open_print: false, + + // ---- + xdate: moment(new Date()).format("YYYY-MM-DD"), + end_date: moment(new Date()).format("YYYY-MM-DD"), + journals: [], + selected_journal: {}, + summary: { debit: 0, credit: 0, balance: 0 }, + dialog_form_detail: false, + periodeList: [], + selected_periode: {}, + loading: false, + dialog_form_periode: false, + autocomplete_status: 0, + search_status: 0, + total_journal: 0, + user: one_user(), + jurnaldetails: [], + dialog_error_jurnal: false, + msgerrjurnallist: [], + regionals: [], + selected_regional: {}, + branchs: [], + selected_branch: {}, + open_dialog_info: false, + msg_info: "", + xsearch: "", + + // -- + dialog_edit_journal: false, + user_level: {}, + list_coa: [], + journal_edit: [], + dialog_confirm_posting: false, + total_jurnal_not_posted: [], + dialog_request_edit: false, + + // --- + dialog_close_jurnal: false, + jurnal_to_close: [] + }, + mutations: { + update_search_status(state, val) { + state.search_status = val; + }, + update_current_page(state, val) { + state.current_page = val; + }, + update_x_search(state, val) { + state.x_search = val; + state.current_page = 1; + }, + update_search_error_message(state, val) { + state.search_error_message = val; + }, + update_last_id(state, val) { + state.last_id = val; + }, + update_coas(state, val) { + state.coas = val; + }, + update_total_coas(state, val) { + state.total_coas = val; + }, + update_selected_coa(state, val) { + state.selected_coa = val; + }, + update_dialog_form_coa(state, val) { + state.dialog_form_coa = val; + }, + update_act(state, val) { + state.act = val; + }, + update_save_status(state, val) { + state.save_status = val; + }, + update_save_error_message(state, val) { + state.save_error_message = val; + }, + update_errors(state, val) { + state.errors = val; + }, + update_alert_success(state, val) { + state.alert_success = val; + }, + update_msg_success(state, val) { + state.msg_success = val; + }, + update_alert_error(state, val) { + state.alert_error = val; + }, + update_dialog_error(state, val) { + state.dialog_error = val; + }, + update_open_print(state, value) { + state.open_print = value; + }, + + // --- + update_xdate(state, val) { + state.xdate = val; + }, + update_end_date(state, val) { + state.end_date = val; + }, + update_journals(state, val) { + state.journals = val; + }, + update_selected_journal(state, val) { + state.selected_journal = val; + }, + update_summary(state, val) { + state.summary = val; + }, + update_dialog_form_detail(state, val) { + state.dialog_form_detail = val; + }, + update_periodeList(state, val) { + state.periodeList = val; + }, + update_selected_periode(state, val) { + state.selected_periode = val; + }, + update_loading(state, val) { + state.loading = val; + }, + update_dialog_form_periode(state, val) { + state.dialog_form_periode = val; + }, + update_autocomplete_status(state, val) { + state.autocomplete_status = val; + }, + update_search_status(state, val) { + state.search_status = val; + }, + update_total_journal(state, val) { + state.total_journal = val; + }, + update_user(state, val) { + state.user = val; + }, + update_jurnaldetails(state, val) { + state.jurnaldetails = val; + }, + update_dialog_error_jurnal(state, val) { + state.dialog_error_jurnal = val; + }, + update_msgerrjurnallist(state, val) { + state.msgerrjurnallist = val; + }, + update_regionals(state, val) { + state.regionals = val; + }, + update_selected_regional(state, val) { + state.selected_regional = val; + }, + update_branchs(state, val) { + state.branchs = val; + }, + update_selected_branch(state, val) { + state.selected_branch = val; + }, + update_open_dialog_info(state, val) { + state.open_dialog_info = val; + }, + update_msg_info(state, val) { + state.msg_info = val; + }, + update_xsearch(state, val) { + state.xsearch = val; + state.current_page = 1; + }, + + update_dialog_edit_journal(state, val) { + state.dialog_edit_journal = val; + }, + update_user_level(state, val) { + state.user_level = val; + }, + update_list_coa(state, val) { + state.list_coa = val; + }, + update_journal_edit(state, val) { + state.journal_edit = val; + }, + update_dialog_confirm_posting(state, val) { + state.dialog_confirm_posting = val; + }, + update_total_jurnal_not_posted(state, val) { + state.total_jurnal_not_posted = val; + }, + update_dialog_request_edit(state, val) { + state.dialog_request_edit = val; + }, + + update_dialog_close_jurnal(state, val) { + state.dialog_close_jurnal = val; + }, + update_jurnal_to_close(state, val) { + state.jurnal_to_close = val; + } + }, + actions: { + async getPeriode(context) { + context.commit("update_autocomplete_status", 1); + try { + let prm = {}; + prm.token = one_token(); + let resp = await api.getPeriode(prm); + if (resp.status != "OK") { + context.commit("update_autocomplete_status", 3); + } else { + context.commit("update_autocomplete_status", 2); + let data = resp.data; + context.commit("update_periodeList", resp.data); + + // Ambil bulan dan tahun sekarang + let now = new Date(); + let currentMonth = now.getMonth() + 1; // getMonth() dimulai dari 0 (Jan = 0) + let currentYear = now.getFullYear().toString(); // Ambil tahun dalam bentuk string + + // Cari data dengan periodeMonth dan periodeYear yang cocok + let selectedPeriode = data.find( + (p) => + p.periodeMonth == currentMonth.toString() && + p.periodeYear == currentYear + ); + + // Jika tidak ditemukan, gunakan data pertama sebagai default + if (!selectedPeriode) { + selectedPeriode = data[0]; + } + + context.commit("update_selected_periode", selectedPeriode); + } + } catch (e) { + context.commit("update_autocomplete_status", 3); + } + }, + async search(context, prm) { + context.commit("update_search_status", 1); + try { + let resp = await api.search( + one_token(), + prm.xdate, + prm.periodeid, + prm.current_page, + prm.search, + prm.branchCode, + prm.regionalId + ); + if (resp.status != "OK") { + context.commit("update_search_status", 3); + context.commit("update_search_error_message", resp.message); + } else { + context.commit("update_search_status", 2); + context.commit("update_search_error_message", ""); + let data = { + records: resp.data.records, + total: resp.data.total + }; + + context.commit("update_journals", data.records); + context.commit("update_total_journal", data.total); + } + } catch (e) { + context.commit("update_search_status", 3); + context.commit("update_search_error_message", e.message); + } + }, + + async insertSales(context, prm) { + context.commit("update_save_status", 1); + try { + let branchCode = prm.branchCode; + let date = prm.date; + let jurnalno = prm.jurnalno; + let resp = await api.insertSales(branchCode, date, jurnalno); + if (resp.status != "OK") { + context.commit("update_save_status", 3); + context.commit("update_save_error_message", resp.message); + context.commit("update_alert_error", true); + } else { + context.commit("update_save_status", 2); + context.commit("update_save_error_message", resp.message); + let data = { + total: resp.data.total + }; + + context.commit("update_alert_success", true); + var msg = resp.data.msg; + context.commit("update_msg_success", msg); + context.dispatch("search", { + branchCode: prm.branchCode, + regionalId: context.state.selected_regional.S_RegionalID, + search: context.state.x_search, + current_page: context.state.current_page, + xdate: context.state.xdate, + periodeid: context.state.selected_periode.id + }); + } + } catch (e) { + context.commit("update_save_status", 3); + context.commit("update_save_error_message", e.message); + context.commit("update_alert_error", true); + } + }, + + async getRegional(context) { + context.commit("update_autocomplete_status", 1); + try { + let resp = await api.getRegional({ + token: one_token(), + regionalId: context.state.user.S_RegionalID + }); + if (resp.status != "OK") { + context.commit("update_search_error_message", resp.message); + context.commit("update_autocomplete_status", 3); + } else { + context.commit("update_search_error_message", ""); + context.commit("update_autocomplete_status", 2); + let data = { + records: resp.data.records, + selected: resp.data.selected + }; + + context.commit("update_regionals", data.records); + context.commit("update_selected_regional", data.selected); + } + } catch (e) { + context.commit("update_search_error_message", e.message); + context.commit("update_autocomplete_status", 3); + } + }, + + async getBranch(context) { + context.commit("update_autocomplete_status", 1); + try { + let resp = await api.getBranch({ + token: one_token(), + regionalId: context.state.selected_regional.S_RegionalID, + branchCode: context.state.user.M_BranchCode + }); + if (resp.status != "OK") { + context.commit("update_search_error_message", resp.message); + context.commit("update_autocomplete_status", 3); + } else { + context.commit("update_search_error_message", ""); + context.commit("update_autocomplete_status", 2); + let data = { + records: resp.data.records, + selected: resp.data.selected + }; + + context.commit("update_branchs", data.records); + context.commit("update_selected_branch", data.selected); + } + } catch (e) { + context.commit("update_search_error_message", e.message); + context.commit("update_autocomplete_status", 3); + } + }, + + async postingJurnal(context, typeid) { + try { + let param = { + token: one_token(), + jurnalTypeID: typeid, + periodeID: context.state.selected_periode.id + }; + const resp = await api.changeJurnalToPosted(param); + if (resp.status != "OK") { + context.commit("update_alert_error", true); + context.commit("update_save_error_message", resp.message); + } else { + context.commit("update_msg_success", resp.data); + context.commit("update_alert_success", true); + + context.dispatch("search", { + branchCode: context.state.selected_branch.M_BranchCode ?? "", + regionalId: context.state.selected_regional.S_RegionalID, + search: context.state.x_search, + current_page: context.state.current_page, + xdate: context.state.xdate, + periodeid: context.state.selected_periode.id + }); + + context.commit("update_total_jurnal_not_posted", []); + context.commit("update_dialog_confirm_posting", false); + } + } catch (error) { + context.commit("update_alert_error", true); + context.commit("update_save_error_message", error.message); + } + }, + + async getUserApprovalLevel(context) { + try { + let param = { token: one_token() }; + const resp = await api.getUserApproveLevel(param); + if (resp.status != "OK") { + context.commit("update_alert_error", true); + context.commit("update_save_error_message", resp.message); + } else { + context.commit("update_user_level", resp.data); + } + } catch (error) { + context.commit("update_alert_error", true); + context.commit("update_save_error_message", error.message); + } + }, + + async getListingCOA(context) { + try { + let param = { + token: one_token(), + keyword: "" + }; + const resp = await api.getListingCOA(param); + if (resp.status != "OK") { + context.commit("update_alert_error", true); + context.commit("update_save_error_message", resp.message); + } else { + context.commit("update_list_coa", resp.data); + } + } catch (error) { + context.commit("update_alert_error", true); + context.commit("update_save_error_message", error.message); + } + }, + + async requestEditJurnal(context) { + try { + let param = { + token: one_token(), + jurnalID: context.state.selected_journal.jurnalID, + staffID: context.state.user.M_UserID, + staffName: context.state.user.M_UserUsername + }; + const resp = await api.requestEditJurnal(param); + if (resp.status != "OK") { + context.commit("update_alert_error", true); + context.commit("update_save_error_message", resp.message); + } else { + context.commit("update_msg_success", resp.data); + context.commit("update_alert_success", true); + context.commit("update_dialog_request_edit", false); + } + } catch (error) { + context.commit("update_alert_error", true); + context.commit("update_save_error_message", error.message); + } + }, + + async saveEditJurnal(context, newdetail) { + try { + let param = { + token: one_token(), + jurnalID: context.state.selected_journal.jurnalID, + jurnalRequestEditID: context.state.selected_journal.JurnalRequestEditID, + oldjurnaltx: context.state.selected_journal.detailtx, + newjurnaltx: newdetail + }; + const resp = await api.saveEditJurnal(param); + if (resp.status != "OK") { + context.commit("update_alert_error", true); + context.commit("update_save_error_message", resp.message); + } else { + context.dispatch("search", { + branchCode: context.state.selected_branch.M_BranchCode ?? "", + regionalId: context.state.selected_regional.S_RegionalID, + search: context.state.x_search, + current_page: context.state.current_page, + xdate: context.state.xdate, + periodeid: context.state.selected_periode.id + }); + + context.commit("update_dialog_edit_journal", false); + context.commit("update_msg_success", resp.data); + context.commit("update_alert_success", true); + } + } catch (error) { + context.commit("update_alert_error", true); + context.commit("update_save_error_message", error.message); + } + }, + + async totalJurnalNotPostedPerPeriod(context) { + try { + let param = { + token: one_token(), + periodeID: context.state.selected_periode.id + }; + const resp = await api.getTotalJurnalNotPostedPerPeriod(param); + if (resp.status != "OK") { + context.commit("update_alert_error", true); + context.commit("update_save_error_message", resp.message); + } else { + context.commit("update_total_jurnal_not_posted", resp.data.total_jurnal ?? []); + } + } catch (error) { + context.commit("update_alert_error", true); + context.commit("update_save_error_message", error.message); + } + }, + + async getDataJurnalNotClosedPerPeriod(context) { + try { + let param = { + token: one_token(), + periodeID: context.state.selected_periode.id + }; + const resp = await api.getDataJurnalNotClosedPerPeriod(param); + if (resp.status != "OK") { + context.commit("update_alert_error", true); + context.commit("update_save_error_message", resp.message); + } else { + context.commit("update_jurnal_to_close", resp.data ?? []); + } + } catch (error) { + context.commit("update_alert_error", true); + context.commit("update_save_error_message", error.message); + } + }, + + async closeJurnalPerPeriode(context, typeid) { + try { + let param = { + token: one_token(), + jurnalTypeID: typeid, + periodeID: context.state.selected_periode.id + }; + const resp = await api.closeJurnalPerPeriode(param); + if (resp.status != "OK") { + context.commit("update_alert_error", true); + context.commit("update_save_error_message", resp.message); + } else { + context.commit("update_msg_success", resp.data); + context.commit("update_alert_success", true); + + context.dispatch("search", { + branchCode: context.state.selected_branch.M_BranchCode ?? "", + regionalId: context.state.selected_regional.S_RegionalID, + search: context.state.x_search, + current_page: context.state.current_page, + xdate: context.state.xdate, + periodeid: context.state.selected_periode.id + }); + + context.commit("update_jurnal_to_close", []); + context.commit("update_dialog_close_jurnal", false); + } + } catch (error) { + context.commit("update_alert_error", true); + context.commit("update_save_error_message", error.message); + } + } + } +}; diff --git a/test/vuex/acc-one-pendapatan-cash-v2/store.js b/test/vuex/acc-one-pendapatan-cash-v2/store.js new file mode 100644 index 0000000..292d3b1 --- /dev/null +++ b/test/vuex/acc-one-pendapatan-cash-v2/store.js @@ -0,0 +1,23 @@ +// State +// data ... +// Mutations +// +// +// Actions +import journal from "./modules/journal.js"; +import system from "../../../apps/modules/system/system.js"; +export const store = new Vuex.Store({ + modules: { + journal: journal, + system:system + }, + state: { + + }, + mutations: { + + }, + actions: { + + } +}); \ No newline at end of file diff --git a/test/vuex/acc-one-receive-item-po-inventaris/components/dialogHandOver.vue b/test/vuex/acc-one-receive-item-po-inventaris/components/dialogHandOver.vue index a3957fa..1f752e9 100644 --- a/test/vuex/acc-one-receive-item-po-inventaris/components/dialogHandOver.vue +++ b/test/vuex/acc-one-receive-item-po-inventaris/components/dialogHandOver.vue @@ -6,17 +6,25 @@ -

Apakah Anda yakin ingin melakukan serah terima barang inventaris kepada user pemohon di ruangan {{ selected_ro.M_RuanganName }}?

+

Apakah Anda yakin ingin melakukan serah terima barang inventaris kepada user pemohon

+ + + - + + + + @@ -35,8 +43,27 @@ module.exports = { data() { return { + selected_ruangan: 0, + temp_list: [ + { M_RuanganID: 1, M_RuanganName: "bonde" } + ], valid_formhandover: true, - rules_staff: [v => (v && Object.keys(v).length > 0) || 'Staff harus diisi'], + rules_staff: [v => (v && Object.keys(v).length > 0) || 'Staff harus diisi'], + headers: [ + { + text: "ITEM", align: "center", sortable: false, value: "itemname", + width: "60%", class: "pa-2 blue lighten-3 white--text", + }, + { + text: "QTY", align: "center", sortable: false, value: "qtyitem", + width: "20%", class: "pa-2 blue lighten-3 white--text", + }, + { + text: "HANDOVER", align: "center", sortable: false, value: "qtysend", + width: "20%", class: "pa-2 blue lighten-3 white--text", + }, + ], + items: [] } }, computed: { @@ -74,7 +101,10 @@ module.exports = { }, list_staff() { return this.$store.state.ro.list_staff - } + }, + list_lokasi() { + return this.$store.state.ro.list_lokasi + }, }, methods: { closeHandOver() { @@ -95,4 +125,4 @@ module.exports = { }, }, } - \ No newline at end of file + diff --git a/test/vuex/acc-one-receive-item-po-inventaris/components/oneRoLayout.vue b/test/vuex/acc-one-receive-item-po-inventaris/components/oneRoLayout.vue index 1ed6b55..156ae0f 100644 --- a/test/vuex/acc-one-receive-item-po-inventaris/components/oneRoLayout.vue +++ b/test/vuex/acc-one-receive-item-po-inventaris/components/oneRoLayout.vue @@ -190,7 +190,7 @@ style="min-width: 30px; height: 30px; margin: 0;" outline small @click="handOverRO(props.item)" color="green lighten-2" > - send + move_to_inbox Serah Terima @@ -375,8 +375,9 @@ module.exports = { }, handOverRO(data) { this.$store.commit("ro/update_selected_ro", data); - this.$store.commit("ro/update_dialog_handover", true); + this.$store.dispatch("ro/getRuangan"); this.$store.dispatch("ro/getListStaff", 'Y'); + this.$store.commit("ro/update_dialog_handover", true); }, uploadDoct(data) { this.$store.commit("ro/update_selected_ro", data); diff --git a/test/vuex/acc-one-supplier-payment-cashier-v5/api/bill.js b/test/vuex/acc-one-supplier-payment-cashier-v5/api/bill.js new file mode 100644 index 0000000..78af996 --- /dev/null +++ b/test/vuex/acc-one-supplier-payment-cashier-v5/api/bill.js @@ -0,0 +1,59 @@ +const URL = "/one-api/mockup/supplierpaymentcashierv5/"; + +export async function search(prm) { + try { + var resp = await axios.post(URL + 'bill/search', prm); + if (resp.status != 200) { + return { + status: "ERR", + message: resp.statusText + }; + } + let data = resp.data; + return data; + } catch (e) { + return { + status: "ERR", + message: e.message + }; + } +} + +export async function selectpaymenttype(prm) { + try { + var resp = await axios.post(URL + 'payment/selectpaymenttype',prm); + if (resp.status != 200) { + return { + status: "ERR", + message: resp.statusText + }; + } + let data = resp.data; + return data; + } catch(e) { + return { + status: "ERR", + message: e.message + }; + } + } + + export async function pay(prm) { + try { + // var resp = await axios.post(URL + 'payment/paymulti',prm); + var resp = await axios.post(URL + 'PaymentV2/payinvoicemulti',prm); + if (resp.status != 200) { + return { + status: "ERR", + message: resp.statusText + }; + } + let data = resp.data; + return data; + } catch(e) { + return { + status: "ERR", + message: e.message + }; + } + } diff --git a/test/vuex/acc-one-supplier-payment-cashier-v5/api/payment.js b/test/vuex/acc-one-supplier-payment-cashier-v5/api/payment.js new file mode 100644 index 0000000..8454bf0 --- /dev/null +++ b/test/vuex/acc-one-supplier-payment-cashier-v5/api/payment.js @@ -0,0 +1,118 @@ +const URL = "/one-api/mockup/supplierpaymentcashierv5/"; + +export async function lookup_type(token) { + try { + var resp = await axios.post(URL + 'payment/lookup_type',{token:token}); + if (resp.status != 200) { + return { + status: "ERR", + message: resp.statusText + }; + } + let data = resp.data; + return data; + } catch (e) { + return { + status: "ERR", + message: e.message + }; + } +} + + +export async function lookup_banks(token) { + try { + var resp = await axios.post(URL + 'payment/lookup_banks',{token:token}); + if (resp.status != 200) { + return { + status: "ERR", + message: resp.statusText + }; + } + let data = resp.data; + return data; + } catch (e) { + return { + status: "ERR", + message: e.message + }; + } +} + + +export async function lookup_accounts(token) { + try { + var resp = await axios.post(URL + 'payment/lookup_accounts',{token:token}); + if (resp.status != 200) { + return { + status: "ERR", + message: resp.statusText + }; + } + let data = resp.data; + return data; + } catch (e) { + return { + status: "ERR", + message: e.message + }; + } +} + + +export async function searchcard(token,prm) { + try { + var resp = await axios.post(URL + 'payment/searchcard',{token:token,search:prm}); + if (resp.status != 200) { + return { + status: "ERR", + message: resp.statusText + }; + } + let data = resp.data; + return data; + } catch(e) { + return { + status: "ERR", + message: e.message + }; + } + } + +export async function pay(prm) { + try { + var resp = await axios.post(URL + 'payment/pay',prm); + if (resp.status != 200) { + return { + status: "ERR", + message: resp.statusText + }; + } + let data = resp.data; + return data; + } catch (e) { + return { + status: "ERR", + message: e.message + }; + } +} + +export async function delete_note(prm) { + try { + var resp = await axios.post(URL + 'payment/delete_note',prm); + if (resp.status != 200) { + return { + status: "ERR", + message: resp.statusText + }; + } + let data = resp.data; + return data; + } catch (e) { + return { + status: "ERR", + message: e.message + }; + } +} diff --git a/test/vuex/acc-one-supplier-payment-cashier-v5/api/paymentmanual.js b/test/vuex/acc-one-supplier-payment-cashier-v5/api/paymentmanual.js new file mode 100644 index 0000000..2254cde --- /dev/null +++ b/test/vuex/acc-one-supplier-payment-cashier-v5/api/paymentmanual.js @@ -0,0 +1,231 @@ +const URL = "/one-api/mockup/supplierpaymentcashierv5/"; + +export async function lookup_type(token) { + try { + var resp = await axios.post(URL + 'payment/lookup_type',{token:token}); + if (resp.status != 200) { + return { + status: "ERR", + message: resp.statusText + }; + } + let data = resp.data; + return data; + } catch (e) { + return { + status: "ERR", + message: e.message + }; + } +} +export async function lookup_banks(token) { + try { + var resp = await axios.post(URL + 'payment/lookup_banks',{token:token}); + if (resp.status != 200) { + return { + status: "ERR", + message: resp.statusText + }; + } + let data = resp.data; + return data; + } catch (e) { + return { + status: "ERR", + message: e.message + }; + } +} + + +export async function lookup_accounts(token) { + try { + var resp = await axios.post(URL + 'payment/lookup_accounts',{token:token}); + if (resp.status != 200) { + return { + status: "ERR", + message: resp.statusText + }; + } + let data = resp.data; + return data; + } catch (e) { + return { + status: "ERR", + message: e.message + }; + } +} + + +export async function searchcard(token,prm) { + try { + var resp = await axios.post(URL + 'payment/searchcard',{token:token,search:prm}); + if (resp.status != 200) { + return { + status: "ERR", + message: resp.statusText + }; + } + let data = resp.data; + return data; + } catch(e) { + return { + status: "ERR", + message: e.message + }; + } + } + +export async function pay(prm) { + try { + // var resp = await axios.post(URL + 'payment/paymanual',prm); + var resp = await axios.post(URL + 'PaymentV2/paymanual',prm); + if (resp.status != 200) { + return { + status: "ERR", + message: resp.statusText + }; + } + let data = resp.data; + return data; + } catch (e) { + return { + status: "ERR", + message: e.message + }; + } +} + +export async function delete_note(prm) { + try { + var resp = await axios.post(URL + 'payment/delete_note',prm); + if (resp.status != 200) { + return { + status: "ERR", + message: resp.statusText + }; + } + let data = resp.data; + return data; + } catch (e) { + return { + status: "ERR", + message: e.message + }; + } +} + +export async function edit_note(prm) { + try { + var resp = await axios.post(URL + 'payment/edit_note',prm); + if (resp.status != 200) { + return { + status: "ERR", + message: resp.statusText + }; + } + let data = resp.data; + return data; + } catch (e) { + return { + status: "ERR", + message: e.message + }; + } +} + +export async function selecttagihan(prm) { + try { + var resp = await axios.post(URL + 'payment/selecttagihan',prm); + if (resp.status != 200) { + return { + status: "ERR", + message: resp.statusText + }; + } + let data = resp.data; + return data; + } catch(e) { + return { + status: "ERR", + message: e.message + }; + } + } + +export async function selectpaymenttype(prm) { + try { + var resp = await axios.post(URL + 'payment/selectpaymenttype',prm); + if (resp.status != 200) { + return { + status: "ERR", + message: resp.statusText + }; + } + let data = resp.data; + return data; + } catch(e) { + return { + status: "ERR", + message: e.message + }; + } + } + + export async function selectsupplier(prm) { + try { + var resp = await axios.post(URL + 'payment/selectsupplier',prm); + if (resp.status != 200) { + return { + status: "ERR", + message: resp.statusText + }; + } + let data = resp.data; + return data; + } catch(e) { + return { + status: "ERR", + message: e.message + }; + } + } + + export async function selectcard(token) { + try { + var resp = await axios.post(URL + 'payment/selectbank',{token:token}); + if (resp.status != 200) { + return { + status: "ERR", + message: resp.statusText + }; + } + let data = resp.data; + return data; + } catch(e) { + return { + status: "ERR", + message: e.message + }; + } + } + + export async function selectedc(token) { + try { + var resp = await axios.post(URL + 'payment/selectaccount',{token:token}); + if (resp.status != 200) { + return { + status: "ERR", + message: resp.statusText + }; + } + let data = resp.data; + return data; + } catch(e) { + return { + status: "ERR", + message: e.message + }; + } + } diff --git a/test/vuex/acc-one-supplier-payment-cashier-v5/components/oneBillList.vue b/test/vuex/acc-one-supplier-payment-cashier-v5/components/oneBillList.vue new file mode 100644 index 0000000..a0dacbd --- /dev/null +++ b/test/vuex/acc-one-supplier-payment-cashier-v5/components/oneBillList.vue @@ -0,0 +1,978 @@ + + + + + + diff --git a/test/vuex/acc-one-supplier-payment-cashier-v5/components/oneBillPaymentAuto.vue b/test/vuex/acc-one-supplier-payment-cashier-v5/components/oneBillPaymentAuto.vue new file mode 100644 index 0000000..e327e13 --- /dev/null +++ b/test/vuex/acc-one-supplier-payment-cashier-v5/components/oneBillPaymentAuto.vue @@ -0,0 +1,855 @@ + + + \ No newline at end of file diff --git a/test/vuex/acc-one-supplier-payment-cashier-v5/components/oneBillPaymentManual.vue b/test/vuex/acc-one-supplier-payment-cashier-v5/components/oneBillPaymentManual.vue new file mode 100644 index 0000000..f52a7e1 --- /dev/null +++ b/test/vuex/acc-one-supplier-payment-cashier-v5/components/oneBillPaymentManual.vue @@ -0,0 +1,1401 @@ + + + diff --git a/test/vuex/acc-one-supplier-payment-cashier-v5/components/oneBillPaymentMulti.vue b/test/vuex/acc-one-supplier-payment-cashier-v5/components/oneBillPaymentMulti.vue new file mode 100644 index 0000000..9922677 --- /dev/null +++ b/test/vuex/acc-one-supplier-payment-cashier-v5/components/oneBillPaymentMulti.vue @@ -0,0 +1,1372 @@ + + + + + diff --git a/test/vuex/acc-one-supplier-payment-cashier-v5/components/oneBillPaymentNew.vue b/test/vuex/acc-one-supplier-payment-cashier-v5/components/oneBillPaymentNew.vue new file mode 100644 index 0000000..d959543 --- /dev/null +++ b/test/vuex/acc-one-supplier-payment-cashier-v5/components/oneBillPaymentNew.vue @@ -0,0 +1,815 @@ + + + \ No newline at end of file diff --git a/test/vuex/acc-one-supplier-payment-cashier-v5/index.php b/test/vuex/acc-one-supplier-payment-cashier-v5/index.php new file mode 100644 index 0000000..c9d92eb --- /dev/null +++ b/test/vuex/acc-one-supplier-payment-cashier-v5/index.php @@ -0,0 +1,96 @@ + + + + + + + + One + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + diff --git a/test/vuex/acc-one-supplier-payment-cashier-v5/modules/bill.js b/test/vuex/acc-one-supplier-payment-cashier-v5/modules/bill.js new file mode 100644 index 0000000..954c546 --- /dev/null +++ b/test/vuex/acc-one-supplier-payment-cashier-v5/modules/bill.js @@ -0,0 +1,364 @@ +// 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'), + init_sdate: moment(new Date()).format('YYYY-MM-DD'), + init_edate: moment(new Date()).format('YYYY-MM-DD'), + search: '', + ssupplier: '', + 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' + }, + selected_multibill: [], + 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: '', + total_payment : 0, + xdialogmulti: false, + xrounding: 0, + paymenttypes: [], + paymenttype: {}, + xtanggalbayar: '', + a_coa_search: '', + a_loading_coa: false, + in_saving: false, + dialog_pay_success: false, + paynumber: '', + bar_chx_all: false, + indeterminatex: false + }, + mutations: { + update_bar_chx_all(state, val) { + state.bar_chx_all = val + }, + update_indeterminatex(state, val) { + state.indeterminatex = val + }, + update_paynumber(state, val) { + state.paynumber = val + }, + update_dialog_pay_success(state, val) { + state.dialog_pay_success = val + }, + update_in_saving(state, val) { + state.in_saving = val + }, + update_a_loading_coa(state, val) { + state.a_loading_coa = val + }, + update_a_coa_search(state, val) { + state.a_coa_search = val + }, + update_xtanggalbayar(state, val) { + state.xtanggalbayar = val + }, + update_paymenttypes(state, data) { + state.paymenttypes = data + }, + update_paymenttype(state, val) { + state.paymenttype = val + }, + update_xrounding(state, val) { + state.xrounding = val + }, + update_xdialogmulti(state, val) { + state.xdialogmulti = val + }, + update_total_payment(state, val) { + state.total_payment = val + }, + update_selected_multibill(state, val) { + state.selected_multibill = val + }, + update_init_sdate(state, val) { + state.init_sdate = val + }, + update_init_edate(state, val) { + state.init_edate = val + }, + 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_ssupplier(state, val) { + state.ssupplier = 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("paymentmanual/update_xbayar", data.records[0].totalbill, {root: true}) + context.commit("paymentmanual/update_xtanggalbayar", data.records[0].SupplierInvoiceDraftPaymentDate, {root: true}) + 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 + }) + } + + var arr = context.rootState.paymentmanual.tagihans + var value = true + context.commit("paymentmanual/update_indeterminatex", false, {root: true}) + context.commit("paymentmanual/update_bar_chx_all", value, {root: true}) + + arr.forEach((el) => { + el.chex = value + el.tagihan_bayar = value == true ? el.tagihan_tagihan : 0 + }) + + var selected = _.filter(arr, function (o) { + return o.chex; + }) + context.commit("paymentmanual/update_selected_tagihan", selected, { + root: true + }) + + var xval = context.rootState.paymentmanual.selected_tagihan + var valx = 0 + xval.forEach(function (obj) { + valx += parseInt(obj.tagihan_bayar) + }) + let totpaid = valx + context.commit("paymentmanual/update_total_payment", totpaid, {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[0]) + context.commit("paymentmanual/update_xbayar", data.records[0].totalbill, { + root: true + }) + context.commit("paymentnew/update_notes", data.records[prm.lastidx].notes, { + root: true + }) + context.commit("paymentmanual/update_notes", data.records[prm.lastidx].notes, { + root: true + }) + context.commit("paymentmanual/update_xtanggalbayar", data.records[prm.lastidx].SupplierInvoiceDraftPaymentDate, { + 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 + }) + } + var arr = context.rootState.paymentmanual.tagihans + var value = true + context.commit("paymentmanual/update_indeterminatex", false, {root: true}) + context.commit("paymentmanual/update_bar_chx_all", value, {root: true}) + + arr.forEach((el) => { + el.chex = value + el.tagihan_bayar = value == true ? el.tagihan_tagihan : 0 + }) + + var selected = _.filter(arr, function (o) { + return o.chex; + }) + context.commit("paymentmanual/update_selected_tagihan", selected, { + root: true + }) + + var xval = context.rootState.paymentmanual.selected_tagihan + var valx = 0 + xval.forEach(function (obj) { + valx += parseInt(obj.tagihan_bayar) + }) + let totpaid = valx + context.commit("paymentmanual/update_total_payment", totpaid, {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 + }) + context.commit("paymentmanual/update_xtanggalbayar", '', { + root: true + }) + context.commit("paymentmanual/update_xbayar", 0, { + root: true + }) + context.commit("paymentmanual/update_total_payment", 0, {root: true}) + context.commit("paymentmanual/update_bar_chx_all", false, {root: true}) + } + + } + } catch (e) { + context.commit("update_search_bill", 3) + context.commit("update_search_error_message", e.message) + console.log(e) + } + }, + async selectpaymenttype(context,payload) { + context.commit("update_get_data_status", 1) + try { + let prm = {}; + prm.token = one_token() + prm.search = payload.search + let resp = await api.selectpaymenttype(prm) + if (resp.status != "OK") { + context.commit("update_get_data_status", 3) + context.commit("update_get_data_error_message", resp.message) + } else { + context.commit("update_get_data_status", 2) + context.commit("update_get_data_error_message", "") + context.commit("update_paymenttypes", resp.data.records.paymenttypes) + context.commit("update_paymenttypes_edit", resp.data.records.paymenttypes) + + } + } catch (e) { + context.commit("update_get_data_status", 3) + context.commit("update_get_data_error_message", e.message) + console.log(e) + } + }, + async pay(context, prm) { + context.commit("paymentmanual/update_lookup_status", 1, {root: true}) + try { + prm.token = one_token() + let resp = await api.pay(prm) + if (resp.status != "OK") { + context.commit("paymentmanual/update_lookup_status", 3, {root: true}) + context.commit("paymentmanual/update_lookup_error_message", resp.message, {root: true}) + } else { + context.commit("paymentmanual/update_lookup_status", 2, {root: true}) + context.commit("paymentmanual/update_lookup_error_message", "", {root: true}) + context.commit("update_paynumber", "Pembayaran multi telah berhasil") + context.commit("update_dialog_pay_success", true) + context.commit("update_in_saving", false) + context.commit("update_xdialogmulti", false) + console.log('berhasil bayar') + context.dispatch("search", { + supplier: context.state.ssupplier, + search: context.state.search, + status: context.state.selected_status.value, + current_page: 1, + startdate: context.state.init_sdate, + enddate: context.state.init_edate, + lastidx: 0 + }) + } + } catch (e) { + context.commit("paymentmanual/update_lookup_status", 3, {root: true}) + context.commit("paymentmanual/update_lookup_error_message", e.message, {root: true}) + } + }, + } +} diff --git a/test/vuex/acc-one-supplier-payment-cashier-v5/modules/paymentmanual.js b/test/vuex/acc-one-supplier-payment-cashier-v5/modules/paymentmanual.js new file mode 100644 index 0000000..818780e --- /dev/null +++ b/test/vuex/acc-one-supplier-payment-cashier-v5/modules/paymentmanual.js @@ -0,0 +1,604 @@ +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: {}, + dialog_edit: false, + msg_edit: '', + note_edit: '', + nota_edit: {}, + open_print_note: false, + idx: 0, + last_payments: {}, + payment_total: 0, + banks: [], + disable_btn_pay: 'Y', + ordertests: [], + isauto: 'N', + paymenttypes: [], + paymenttype: {}, + paymenttypes_edit: [], + paymenttype_edit: {}, + suppliers: [], + supplier: {}, + cards: [], + card: {}, + edcs: [], + edc: {}, + accounts: [], + account: {}, + bar_chx_all: false, + selected_tagihan: {}, + indeterminatex: false, + in_saving: false, + xbayar: 0, + xrounding: 0, + open_dialog_info:false, + msg_info:'', + a_coa_search: '', + a_supplier_search: '', + a_loading_coa: false, + a_loading_supplier: false, + xtanggalbayar: '' + }, + mutations: { + update_xtanggalbayar(state, val) { + state.xtanggalbayar = val + }, + update_a_coa_search(state, val) { + state.a_coa_search = val + }, + update_a_supplier_search(state, val) { + state.a_supplier_search = val + }, + update_a_loading_coa(state, val) { + state.a_loading_coa = val + }, + update_a_loading_supplier(state, val) { + state.a_loading_supplier = val + }, + update_open_dialog_info(state,val){ + state.open_dialog_info = val + }, + update_msg_info(state,val){ + state.msg_info = val + }, + update_xbayar(state, val) { + state.xbayar = val + }, + update_xrounding(state, val) { + state.xrounding = 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_dialog_edit(state, val) { + state.dialog_edit = val + }, + update_note_edit(state, val) { + state.note_edit = val + }, + update_msg_edit(state, val) { + state.msg_edit = val + }, + update_nota_edit(state, val) { + state.nota_edit = 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_suppliers(state, data) { + state.suppliers = data + }, + update_supplier(state, val) { + state.supplier = val + }, + update_paymenttypes(state, data) { + state.paymenttypes = data + }, + update_paymenttype(state, val) { + state.paymenttype = val + }, + update_paymenttypes_edit(state, data) { + state.paymenttypes_edit = data + }, + update_paymenttype_edit(state, val) { + state.paymenttype_edit = 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) + context.commit("update_paymenttypes_edit", resp.data.records.paymenttypes_edit) + } + } 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 = prm.xnumber + let id = prm.orderid + + context.commit("update_disable_btn_pay", 'Y') + context.commit("update_idx", id) + context.commit("update_total_payment", 0) + context.commit("update_paynumber", "Pembayaran nomor " + xnumber + " telah berhasil") + context.commit("update_dialog_pay_success", true) + + console.log("dialogtext", context.state.paynumber) + console.log("dialogsuccesss", context.state.dialog_pay_success) + + context.commit("update_in_saving", false) + context.commit("update_xbayar", 0) + + this.$store.dispatch("bill/search", { + supplier: context.rootState.bill.searchsupplier, + search: context.rootState.bill.searchnamelab, + status: context.rootState.bill.status.value, + current_page: context.rootState.bill.current_page, + startdate: context.rootState.bill.init_sdate, + enddate: context.rootState.bill.init_edate, + lastidx: id + }, { root: true }) + } + } catch (e) { + context.commit("update_lookup_status", 3) + context.commit("update_lookup_error_message", e.message) + } + }, + async edit_note(context, prm) { + context.commit("update_lookup_status", 1) + try { + prm.token = one_token() + let resp = await api.edit_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 " + prm.note_number + " telah diubah" + context.commit("update_msg_edit", xmsg) + //context.commit("update_dialog_edit", false) + context.commit("update_nota_edit", {}) + } + } 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 " + prm.nota.note_number + " 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 selecttagihan(context,payload) { + context.commit("bill/update_get_data_status", 1, { + root: true + }) + try { + let prm = {}; + prm.token = one_token() + prm.id = payload.id + let resp = await api.selecttagihan(prm) + 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_tagihans", resp.data.records.tagihans) + + } + } 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 selectpaymenttype(context,payload) { + context.commit("bill/update_get_data_status", 1, { + root: true + }) + try { + let prm = {}; + prm.token = one_token() + prm.search = payload.search + let resp = await api.selectpaymenttype(prm) + 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) + context.commit("update_paymenttypes_edit", 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 selectsupplier(context,payload) { + context.commit("bill/update_get_data_status", 1, { + root: true + }) + try { + let prm = {}; + prm.token = one_token() + prm.search = payload.search + let resp = await api.selectsupplier(prm) + 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_suppliers", resp.data.records.suppliers) + + } + } 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 selectpaymenttypeold(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) + context.commit("update_paymenttypes_edit", resp.data.records.paymenttypes) + + context.commit("update_paymenttype", resp.data.records.paymenttypes[0]) + } + } 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) + } + } + } +} diff --git a/test/vuex/acc-one-supplier-payment-cashier-v5/modules/paymentnew.js b/test/vuex/acc-one-supplier-payment-cashier-v5/modules/paymentnew.js new file mode 100644 index 0000000..983631b --- /dev/null +++ b/test/vuex/acc-one-supplier-payment-cashier-v5/modules/paymentnew.js @@ -0,0 +1,255 @@ +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, + open_dialog_info:false, + msg_info:'' + }, + mutations: { + update_open_dialog_info(state,val){ + state.open_dialog_info = val + }, + update_msg_info(state,val){ + state.msg_info = val + }, + 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 "+xnumber+" 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 "+prm.nota.note_number+" 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 ) + } + } + } +} \ No newline at end of file diff --git a/test/vuex/acc-one-supplier-payment-cashier-v5/store.js b/test/vuex/acc-one-supplier-payment-cashier-v5/store.js new file mode 100644 index 0000000..b24b8ff --- /dev/null +++ b/test/vuex/acc-one-supplier-payment-cashier-v5/store.js @@ -0,0 +1,31 @@ +// State +// data ... +// Mutations +// +// +// Actions +import bill from "./modules/bill.js"; +import paymentnew from "./modules/paymentnew.js"; +import paymentmanual from "./modules/paymentmanual.js"; +import system from "../../../apps/modules/system/system.js"; +export const store = new Vuex.Store({ + modules: { + bill: bill, + paymentnew:paymentnew, + paymentmanual: paymentmanual, + system:system + }, + state: { + tab_selected: 'pasien-dokter' + }, + mutations: { + change_tab(state, ntab) { + state.tab_selected = ntab + } + }, + actions: { + change_tab(context, ntab) { + context.commit('change_tab', ntab) + } + } +}); \ No newline at end of file diff --git a/test/vuex/one-md-usergroup-user-v6/action.js b/test/vuex/one-md-usergroup-user-v6/action.js new file mode 100644 index 0000000..e69de29 diff --git a/test/vuex/one-md-usergroup-user-v6/api.js b/test/vuex/one-md-usergroup-user-v6/api.js new file mode 100644 index 0000000..47e14ba --- /dev/null +++ b/test/vuex/one-md-usergroup-user-v6/api.js @@ -0,0 +1,31 @@ +// API : +// search bank +// paramater : query , page , rowPerPage +const URL = + "http://lebaran.aplikasi.web.id/smartlab_api/vuex/t02/search_bank"; + +export async function searchBank(query, page, rowPerPage = 15) { + try { + var resp = await axios.post(URL, { + query: query, + page: page, + rowPerPage: rowPerPage + }); + if (resp.status != 200) { + return { + status: "ERR", + query: query, + message: resp.statusText + }; + } + let data = resp.data; + data.query = query; + return data; + } catch (e) { + return { + status: "ERR", + query: query, + message: e.message + }; + } +} diff --git a/test/vuex/one-md-usergroup-user-v6/api/user.js b/test/vuex/one-md-usergroup-user-v6/api/user.js new file mode 100644 index 0000000..de66293 --- /dev/null +++ b/test/vuex/one-md-usergroup-user-v6/api/user.js @@ -0,0 +1,98 @@ +const URL = "/one-api/mockup/usergroup/"; + +console.log("user new v5") +export async function reset_password(prm) { + try { + var resp = await axios.post(URL + 'usergroupv6/reset_password', prm); + if (resp.status != 200) { + return { + status: "ERR", + message: resp.statusText + }; + } + let data = resp.data; + return data; + } catch (e) { + return { + status: "ERR", + message: e.message + }; + } +} + +export async function save(prm) { + try { + var resp = await axios.post(URL + 'usergroupv6/addnewuser', prm); + if (resp.status != 200) { + return { + status: "ERR", + message: resp.statusText + }; + } + let data = resp.data; + return data; + } catch (e) { + return { + status: "ERR", + message: e.message + }; + } +} + +export async function save_edit(prm) { + try { + var resp = await axios.post(URL + 'usergroupv6/edituser', prm); + if (resp.status != 200) { + return { + status: "ERR", + message: resp.statusText + }; + } + let data = resp.data; + return data; + } catch (e) { + return { + status: "ERR", + message: e.message + }; + } +} + + +export async function xdelete(token,id) { + try { + var resp = await axios.post(URL + 'usergroupv6/deleteuser', { id: id ,token:token}); + if (resp.status != 200) { + return { + status: "ERR", + message: resp.statusText + }; + } + let data = resp.data; + return data; + } catch (e) { + return { + status: "ERR", + message: e.message + }; + } +} + +export async function lookup(token,id) { + try { + var resp = await axios.post(URL + 'usergroupv6/lookupuser', { id: id, token:token }); + if (resp.status != 200) { + return { + status: "ERR", + message: resp.statusText + }; + } + let data = resp.data; + return data; + } catch (e) { + return { + status: "ERR", + message: e.message + }; + } +} diff --git a/test/vuex/one-md-usergroup-user-v6/api/usergroup.js b/test/vuex/one-md-usergroup-user-v6/api/usergroup.js new file mode 100644 index 0000000..e186962 --- /dev/null +++ b/test/vuex/one-md-usergroup-user-v6/api/usergroup.js @@ -0,0 +1,192 @@ +const URL = "/one-api/mockup/usergroup/"; + +export async function lookup(token, search,all ) { + try { + var resp = await axios.post(URL + 'usergroupv6/lookup', { token: token, search: search, all:all }); + if (resp.status != 200) { + return { + status: "ERR", + message: resp.statusText + }; + } + let data = resp.data; + return data; + } catch (e) { + return { + status: "ERR", + message: e.message + }; + } +} + +export async function getdashboards(prm) { + try { + var resp = await axios.post(URL + 'usergroupv6/getdashboards', prm); + if (resp.status != 200) { + return { + status: "ERR", + message: resp.statusText + }; + } + let data = resp.data; + return data; + } catch (e) { + return { + status: "ERR", + message: e.message + }; + } +} + + + +export async function getreportsample(token) { + try { + var resp = await axios.post(URL + 'usergroupv6/getreportsample',{token:token}); + if (resp.status != 200) { + return { + status: "ERR", + message: resp.statusText + }; + } + let data = resp.data; + return data; + } catch (e) { + return { + status: "ERR", + message: e.message + }; + } +} + +export async function save(prm) { + try { + var resp = await axios.post(URL + 'usergroupv6/addnewusergroup', prm); + if (resp.status != 200) { + return { + status: "ERR", + message: resp.statusText + }; + } + let data = resp.data; + return data; + } catch (e) { + return { + status: "ERR", + message: e.message + }; + } +} + +export async function update(prm) { + try { + var resp = await axios.post(URL + 'usergroupv6/editusergroup', prm); + if (resp.status != 200) { + return { + status: "ERR", + message: resp.statusText + }; + } + let data = resp.data; + return data; + } catch (e) { + return { + status: "ERR", + message: e.message + }; + } +} + + +export async function xdelete(token,id) { + try { + var resp = await axios.post(URL + 'usergroupv6/deleteusergroup', { id: id, token:token }); + if (resp.status != 200) { + return { + status: "ERR", + message: resp.statusText + }; + } + let data = resp.data; + return data; + } catch (e) { + return { + status: "ERR", + message: e.message + }; + } +} + +export async function search_regional(prm) { + try { + var resp = await axios.post(URL + 'usergroupv6/search_regional', prm); + if (resp.status != 200) { + return { + status: "ERR", + message: resp.statusText + }; + } + let data = resp.data; + return data; + } catch (e) { + return { + status: "ERR", + message: e.message + }; + } +} + +export async function search_branch(prm) { + try { + var resp = await axios.post(URL + 'usergroupv6/search_branch', prm); + if (resp.status != 200) { + return { + status: "ERR", + message: resp.statusText + }; + } + let data = resp.data; + return data; + } catch (e) { + return { + status: "ERR", + message: e.message + }; + } +} +export async function getapprovelevel(prm) { + try { + var resp = await axios.post(URL + 'usergroupv6/search_approvelevel', prm); + if (resp.status != 200) { + return { + status: "ERR", + message: resp.statusText + }; + } + let data = resp.data; + return data; + } catch (e) { + return { + status: "ERR", + message: e.message + }; + } +} +export async function getdivision(prm) { + try { + var resp = await axios.post(URL + 'usergroupv6/getdivision', prm); + if (resp.status != 200) { + return { + status: "ERR", + message: resp.statusText + }; + } + let data = resp.data; + return data; + } catch (e) { + return { + status: "ERR", + message: e.message + }; + } +} diff --git a/test/vuex/one-md-usergroup-user-v6/components/oneMdUserGroupList.vue b/test/vuex/one-md-usergroup-user-v6/components/oneMdUserGroupList.vue new file mode 100644 index 0000000..70b008a --- /dev/null +++ b/test/vuex/one-md-usergroup-user-v6/components/oneMdUserGroupList.vue @@ -0,0 +1,458 @@ + + + + + diff --git a/test/vuex/one-md-usergroup-user-v6/components/oneMdUserList.vue b/test/vuex/one-md-usergroup-user-v6/components/oneMdUserList.vue new file mode 100644 index 0000000..acb1dba --- /dev/null +++ b/test/vuex/one-md-usergroup-user-v6/components/oneMdUserList.vue @@ -0,0 +1,872 @@ + + + + + diff --git a/test/vuex/one-md-usergroup-user-v6/index.php b/test/vuex/one-md-usergroup-user-v6/index.php new file mode 100644 index 0000000..3c05e8c --- /dev/null +++ b/test/vuex/one-md-usergroup-user-v6/index.php @@ -0,0 +1,76 @@ + + + + + + + + One + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + diff --git a/test/vuex/one-md-usergroup-user-v6/modules/user.js b/test/vuex/one-md-usergroup-user-v6/modules/user.js new file mode 100644 index 0000000..b113ac9 --- /dev/null +++ b/test/vuex/one-md-usergroup-user-v6/modules/user.js @@ -0,0 +1,295 @@ +// 1 => LOADING +// 2 => DONE +// 3 => ERROR +import * as api from "../api/user.js" + +export default { + namespaced: true, + state: { + users: [], + save_status: 0, + save_error_message: '', + dialog_form_user: false, + dialog_form_user_edit: false, + lookup_user: 0, + error_username: false, + + error_password: false, + error_xreport: false, + error_xusergroupname: false, + error_xstaff: false, + error_xsamplestation: false, + error_iscoordinator: false, + update_error_xusergroup: false, + show_all: 'N', + reports: [], + selected_report: {}, + staffs: [], + selected_staff: {}, + samplestations: [], + selected_samplestation: {}, + usergroupnames: [], + selected_usergroupname: {}, + + errors: [], + dialog_resetpassword: false, + reason: '', + show_reason: false, + pass_reset: '', + + branches: [], + selected_branch: {}, + regionals: [], + selected_regional: {}, + selected_userlocationflag: { M_UserLocationFlagName: 'REGIONAL', M_UserLocationFlag: 'R' }, + selected_userapprovelevel: {}, + selected_userdivision: {}, + errors: { + regional: false, branch: false, regbranch: false, division: false + } + }, + mutations: { + update_branches(state, val) { + state.branches = val + }, + update_selected_branch(state, val) { + state.selected_branch = val + }, + update_selected_userapprovelevel(state, val){ + state.selected_userapprovelevel = val + }, + update_selected_userdivision(state, val){ + state.selected_userdivision = val + }, + update_regionals(state, val) { + state.regionals = val + }, + update_selected_regional(state, val) { + state.selected_regional = val + }, + update_selected_userlocationflag(state, val) { + state.selected_userlocationflag = val + }, + update_errors(state, status) { + state.errors = status + }, + update_pass_reset(state, val) { + state.pass_reset = val + }, + update_show_reason(state, val) { + state.show_reason = val + }, + update_reason(state, val) { + state.reason = val + }, + update_dialog_resetpassword(state, val) { + state.dialog_resetpassword = val + }, + update_errors(state, val) { + state.errors = val + }, + update_error_username(state, val) { + state.error_username = val + }, + update_error_password(state, val) { + state.error_password = val + }, + update_error_xreport(state, val) { + state.error_xreport = val + }, + update_error_xstaff(state, val) { + state.error_xstaff = val + }, + update_error_xusergroupname(state, val) { + state.error_xusergroupname = val + }, + update_error_xsamplestation(state, val) { + state.error_xsamplestation = val + }, + update_error_iscoordinator(state, val) { + state.error_iscoordinator = val + }, + update_error_xusergroup(state, val) { + state.error_xusergroup = val + }, + update_users(state, data) { + state.users = data + }, + update_save_status(state, val) { + state.save_status = val + }, + update_save_error_message(state, val) { + state.save_error_message = val + }, + update_dialog_form_user(state, val) { + state.dialog_form_user = val + }, + update_dialog_form_user_edit(state, val) { + state.dialog_form_user_edit = val + }, + update_reports(state, val) { + state.reports = val + }, + update_selected_report(state, val) { + state.selected_report = val + }, + + update_staffs(state, val) { + state.staffs = val + }, + update_selected_staff(state, val) { + state.selected_staff = val + }, + update_usergroupnames(state, val) { + state.usergroupnames = val + }, + update_selected_usergroupname(state, val) { + state.selected_usergroupname = val + }, + update_samplestations(state, val) { + state.samplestations = val + }, + update_selected_samplestation(state, val) { + state.selected_samplestation = val + }, + update_lookup_user(state, val) { + state.lookup_user = val + } + }, + actions: { + async resetPassword(context, prm) { + context.commit("update_save_status", 1) + try { + prm.token = one_token() + let resp = await api.reset_password(prm) + if (resp.status != "OK") { + context.commit("usergroup/update_save_status", 3, { root: true }) + context.commit("usergroup/update_save_error_message", resp.message, { root: true }) + } else { + + context.commit("update_pass_reset", resp.data.password) + context.commit("update_show_reason", false) + + } + } catch (e) { + context.commit("update_save_status", 3) + context.commit("update_save_error_message", e.message) + console.log(e) + } + }, + async save_edit(context, prm) { + context.commit("update_save_status", 1) + try { + prm.token = one_token() + let resp = await api.save_edit(prm) + if (resp.status != "OK") { + context.commit("usergroup/update_save_status", 3, { root: true }) + context.commit("usergroup/update_save_error_message", resp.message, { root: true }) + } else { + var data = { + records: resp.data.records, + total: resp.data.total + } + if (data.total !== -1) { + context.commit("usergroup/update_save_status", 2, { root: true }) + context.commit("usergroup/update_save_error_message", resp.message, { root: true }) + context.commit("usergroup/update_alert_success", true, { root: true }) + + context.commit("update_dialog_form_user_edit", false) + var msg = "User " + prm.username + " sudah update dong" + context.commit("usergroup/update_msg_success", msg, { root: true }) + context.commit("usergroup/update_alert_success", true, { root: true }) + context.dispatch("lookup", { + id: prm.usergroupid + }) + } else { + context.commit("update_errors", resp.data.errors) + } + } + } catch (e) { + context.commit("update_save_status", 3) + context.commit("update_save_error_message", e.message) + console.log(e) + } + }, + async save(context, prm) { + context.commit("update_save_status", 1) + try { + prm.token = one_token() + let resp = await api.save(prm) + if (resp.status != "OK") { + context.commit("usergroup/update_save_status", 3, { root: true }) + context.commit("usergroup/update_save_error_message", resp.message, { root: true }) + } else { + var data = { + records: resp.data.records, + total: resp.data.total + } + if (data.total !== -1) { + context.commit("usergroup/update_save_status", 2, { root: true }) + context.commit("usergroup/update_save_error_message", resp.message, { root: true }) + context.commit("usergroup/update_alert_success", true, { root: true }) + + context.commit("update_dialog_form_user", false) + var msg = "User " + prm.username + " sudah update dong" + context.commit("usergroup/update_msg_success", msg, { root: true }) + context.commit("usergroup/update_alert_success", true, { root: true }) + context.dispatch("lookup", { + id: prm.usergroupid + }) + } else { + context.commit("update_errors", resp.data.errors) + } + } + } catch (e) { + context.commit("update_save_status", 3) + context.commit("update_save_error_message", e.message) + console.log(e) + } + }, + async lookup(context, prm) { + context.commit("update_lookup_user", 1) + try { + let resp = await api.lookup(one_token(), prm.id) + if (resp.status != "OK") { + context.commit("update_lookup_user", 3) + } else { + context.commit("update_lookup_user", 2) + let data = { + records: resp.data.records, + total: resp.data.total + } + context.commit("update_users", data.records) + } + } catch (e) { + context.commit("update_lookup_user", 3) + } + }, + async delete(context, prm) { + context.commit("update_save_status", 1) + try { + let resp = await api.xdelete(one_token(), prm.xid) + if (resp.status != "OK") { + context.commit("usergroup/update_save_status", 3, { root: true }) + context.commit("usergroup/update_save_error_message", resp.message, { root: true }) + } else { + context.commit("usergroup/update_save_status", 2, { root: true }) + context.commit("usergroup/update_save_error_message", resp.message, { root: true }) + context.commit("usergroup/update_alert_success", true, { root: true }) + + //context.commit("update_dialog_form_schedule_promise", false) + var msg = "User " + prm.username + " dari usergroup " + prm.usergroupname + " sudah dihapus dong" + context.commit("usergroup/update_msg_success", msg, { root: true }) + context.commit("usergroup/update_alert_success", true, { root: true }) + context.dispatch("lookup", { + id: prm.usergroupid + }) + } + } catch (e) { + context.commit("update_save_status", 3) + context.commit("update_save_error_message", e.message) + console.log(e) + } + } + } +} diff --git a/test/vuex/one-md-usergroup-user-v6/modules/usergroup.js b/test/vuex/one-md-usergroup-user-v6/modules/usergroup.js new file mode 100644 index 0000000..913d701 --- /dev/null +++ b/test/vuex/one-md-usergroup-user-v6/modules/usergroup.js @@ -0,0 +1,437 @@ +// 1 => LOADING +// 2 => DONE +// 3 => ERROR +import * as api from "../api/usergroup.js" + +export default { + namespaced: true, + state: { + act: 'new', + lookup_usergroup: 0, + get_data_status: 0, + lookup_error_message: '', + usergroups: [], + total_usergroups: 0, + total_filter_usergroups: 0, + selected_usergroup: { name: "[ Belum memilih User Group ]" }, + save_status: 0, + save_error_message: '', + dialog_form_usergroup: false, + dialog_edit_form_usergroup: false, + alert_success: false, + msg_success: "", + error_clinic: false, + error_name: false, + error_dashboard: false, + reports: [], + selected_report: {}, + staffs: [], + selected_staff: {}, + regionals: [], + selected_regional: {}, + branches: [], + approvelevels: [], + divisions: [], + selected_branch: {}, + usergroupnames: [], + selected_usergroupname: {}, + samplestations: [], + selected_samplestation: {}, + dashboards: [], + selected_dashboard: {}, + show_all: 'N', + userlocationflags: [ + { M_UserLocationFlagName: 'PUSAT', M_UserLocationFlag: 'P' }, + { M_UserLocationFlagName: 'REGIONAL', M_UserLocationFlag: 'R' }, + { M_UserLocationFlagName: 'CABANG', M_UserLocationFlag: 'B' } + ], + selected_userlocationflag: { M_UserLocationFlagName: 'REGIONAL', M_UserLocationFlag: 'R' }, + autocomplete_status: 0, + errors: [] + }, + mutations: { + update_autocomplete_status(state, val) { + state.autocomplete_status = val + }, + update_branches(state, val) { + state.branches = val + }, + update_selected_branch(state, val) { + state.selected_branch = val + }, + update_regionals(state, val) { + state.regionals = val + }, + update_selected_regional(state, val) { + state.selected_regional = val + }, + update_selected_userlocationflag(state, val) { + state.selected_userlocationflag = val + }, + update_dashboards(state, val) { + state.dashboards = val + }, + update_selected_dashboard(state, val) { + state.selected_dashboard = val + }, + update_act(state, val) { + state.act = val + }, + update_error_code(state, val) { + state.error_code = val + }, + update_error_name(state, val) { + state.error_name = val + }, + update_error_clinic(state, val) { + state.error_clinic = val + }, + update_error_dashboard(state, val) { + state.error_dashboard = val + }, + update_errors(state, val) { + state.errors = val + }, + update_show_all(state, val) { + state.show_all = val + }, + update_lookup_error_message(state, status) { + state.lookup_error_message = status + }, + update_lookup_usergroup(state, status) { + state.lookup_usergroup = status + }, + update_usergroups(state, data) { + state.usergroups = data.records + state.total_usergroups = data.total + state.total_filter_usergroups = data.total_filter + }, + update_selected_usergroup(state, val) { + state.selected_usergroup = val + }, + update_save_status(state, val) { + state.save_status = val + }, + update_save_error_message(state, val) { + state.save_error_message = val + }, + update_dialog_form_usergroup(state, val) { + state.dialog_form_usergroup = val + }, + update_dialog_edit_form_usergroup(state, val) { + state.dialog_edit_form_usergroup = val + }, + update_alert_success(state, val) { + state.alert_success = val + }, + update_msg_success(state, val) { + state.msg_success = val + }, + update_reports(state, val) { + state.reports = val + }, + update_selected_report(state, val) { + state.selected_report = val + }, + update_staffs(state, val) { + state.staffs = val + }, + update_selected_staff(state, val) { + state.selected_staff = val + }, + update_samplestations(state, val) { + state.samplestations = val + }, + update_selected_samplestation(state, val) { + state.selected_samplestation = val + }, + update_usergroupnames(state, val) { + state.usergroupnames = val + }, + update_selected_usergroupname(state, val) { + state.selected_usergroupname = val + }, + update_approvelevels(state, val) { + state.approvelevels = val + }, + update_divisions(state, val) { + state.divisions = val + }, + + update_get_data_status(state, val) { + state.get_data_status = val + } + + }, + actions: { + async lookup(context, prm) { + context.commit("update_lookup_usergroup", 1) + try { + let resp = await api.lookup(one_token(), prm.search, prm.all) + if (resp.status != "OK") { + context.commit("update_lookup_usergroup", 3) + context.commit("update_lookup_error_message", resp.message) + } else { + context.commit("update_lookup_usergroup", 2) + context.commit("update_lookup_error_message", "") + let data = { + records: resp.data.records, + total: resp.data.total, + total_filter: resp.data.total_filter + } + context.commit("update_usergroups", data) + } + } catch (e) { + context.commit("update_lookup_usergroup", 3) + context.commit("update_lookup_error_message", e.message) + } + }, + async getdashboards(context, prm) { + context.commit("update_lookup_usergroup", 1) + try { + console.log("dasdsa") + prm.token = one_token() + console.log(prm) + let resp = await api.getdashboards(prm) + if (resp.status != "OK") { + context.commit("update_lookup_usergroup", 3) + context.commit("update_lookup_error_message", resp.message) + } else { + context.commit("update_lookup_usergroup", 2) + context.commit("update_lookup_error_message", "") + let data = { + records: resp.data.records, + total: resp.data.total + } + context.commit("update_dashboards", data.records) + if (prm.cat === 'new') { + if (data.records.length > 0) + context.commit("update_selected_dashboard", data.records[0]) + else + context.commit("update_selected_dashboard", {}) + } + else { + var xdata = data.records + var idx = _.findIndex(xdata, function (o) { return o.url == prm.dashboard }) + context.commit("update_selected_dashboard", data.records[idx]) + } + + } + } catch (e) { + context.commit("update_lookup_usergroup", 3) + context.commit("update_lookup_error_message", e.message) + } + }, + + async save(context, prm) { + context.commit("update_save_status", 1) + context.commit("update_error_name", false) + context.commit("update_error_dashboard", false) + context.commit("update_error_clinic", false) + try { + prm.token = one_token() + let resp = await api.save(prm) + if (resp.status != "OK") { + context.commit("update_save_status", 3) + context.commit("update_save_error_message", resp.message) + } else { + context.commit("update_save_status", 2) + context.commit("update_save_error_message", resp.message) + context.commit("update_save_error_message", resp.message) + var data = { + records: resp.data.records, + total: resp.data.total + } + + if (data.total !== -1) { + context.commit("update_errors", []) + context.commit("update_alert_success", true) + context.commit("update_dialog_form_usergroup", false) + var msg = "User Group " + prm.name + " sudah tersimpan dong ..." + context.commit("update_msg_success", msg) + context.dispatch("lookup", { search: "", all: context.show_all }) + } else { + context.commit("update_errors", resp.data.errors) + + } + + } + } catch (e) { + context.commit("update_save_status", 3) + context.commit("update_save_error_message", e.message) + console.log(e) + } + }, + async update(context, prm) { + context.commit("update_save_status", 1) + context.commit("update_error_name", false) + context.commit("update_error_dashboard", false) + context.commit("update_error_clinic", false) + try { + prm.token = one_token() + let resp = await api.update(prm) + if (resp.status != "OK") { + context.commit("update_save_status", 3) + context.commit("update_save_error_message", resp.message) + } else { + context.commit("update_save_status", 2) + context.commit("update_save_error_message", resp.message) + context.commit("update_save_error_message", resp.message) + let data = { + records: resp.data.records, + total: resp.data.total + } + + if (data.total !== -1) { + context.commit("update_error_name", false) + context.commit("update_error_dashboard", false) + context.commit("update_error_clinic", false) + + context.commit("update_alert_success", true) + context.commit("update_dialog_form_usergroup", false) + var msg = "User Group " + prm.name + " sudah terupdate dong ..." + context.commit("update_msg_success", msg) + context.dispatch("lookup", { search: "", all: context.show_all }) + } else { + if (resp.data.errorcode === 'Y') { + context.commit("update_error_code", true) + } + if (resp.data.errorname === 'Y') { + context.commit("update_error_name", true) + } + } + + } + } catch (e) { + context.commit("update_save_status", 3) + context.commit("update_save_error_message", e.message) + console.log(e) + } + }, + async delete(context, prm) { + context.commit("update_save_status", 1) + try { + let resp = await api.xdelete(one_token(), prm.usergroupid) + if (resp.status != "OK") { + context.commit("update_save_status", 3) + context.commit("update_save_error_message", resp.message) + } else { + context.commit("update_save_status", 2) + context.commit("update_save_error_message", resp.message) + context.commit("update_alert_success", true) + + var msg = "Schedule " + prm.usergroupname + " sudah dihapus dong" + context.commit("update_msg_success", msg) + context.commit("update_alert_success", true) + context.commit("update_selected_usergroup", {}) + context.dispatch("lookup", { search: "" }) + context.commit("user/update_usergroup_user", [], { root: true }) + } + } catch (e) { + context.commit("update_save_status", 3) + console.log(e) + } + }, + async getreportsample(context) { + context.commit("update_get_data_status", 1) + try { + let resp = await api.getreportsample(one_token()) + if (resp.status != "OK") { + context.commit("update_get_data_status", 3) + } else { + context.commit("update_get_data_status", 2) + let data = { + records: resp.data.records, + total: resp.data.total + } + context.commit("update_staffs", data.records.staffs) + context.commit("update_reports", data.records.reports) + context.commit("update_regionals", data.records.regionals) + // context.commit("update_samplestations",data.records.samplestations) + context.commit("update_usergroupnames", data.records.usergroupnames) + } + } catch (e) { + context.commit("update_get_data_status", 3) + } + }, + async search_regional(context, prm) { + context.commit("update_autocomplete_status", 1) + try { + prm.token = one_token() + let resp = await api.search_regional(prm) + if (resp.status != "OK") { + context.commit("update_autocomplete_status", 3) + } else { + context.commit("update_autocomplete_status", 2) + let data = { + records: resp.data.records, + total: resp.data.total + } + context.commit("update_regionals", resp.data.records) + } + } catch (e) { + context.commit("update_autocomplete_status", 3) + } + }, + async search_branch(context, prm) { + context.commit("update_autocomplete_status", 1) + console.log(prm) + try { + prm.token = one_token() + let resp = await api.search_branch(prm) + if (resp.status != "OK") { + context.commit("update_autocomplete_status", 3) + } else { + context.commit("update_autocomplete_status", 2) + let data = { + records: resp.data.records, + total: resp.data.total + } + context.commit("update_branches", resp.data.records) + } + } catch (e) { + context.commit("update_autocomplete_status", 3) + } + }, + async getapprovelevel(context) { + // context.commit("update_autocomplete_status", 1) + try { + let prm = {} + prm.token = one_token() + let resp = await api.getapprovelevel(prm) + if (resp.status != "OK") { + // context.commit("update_autocomplete_status", 3) + } else { + // context.commit("update_autocomplete_status", 2) + let data = { + records: resp.data.records, + total: resp.data.total + } + context.commit("update_approvelevels", data.records) + } + } catch (e) { + // context.commit("update_autocomplete_status", 3) + } + }, + async getdivision(context) { + // context.commit("update_autocomplete_status", 1) + try { + let prm = {} + prm.token = one_token() + let resp = await api.getdivision(prm) + if (resp.status != "OK") { + // context.commit("update_autocomplete_status", 3) + } else { + // context.commit("update_autocomplete_status", 2) + let data = { + records: resp.data.records, + total: resp.data.total + } + context.commit("update_divisions", data.records) + } + } catch (e) { + // context.commit("update_autocomplete_status", 3) + } + }, + } +} diff --git a/test/vuex/one-md-usergroup-user-v6/mutation.js b/test/vuex/one-md-usergroup-user-v6/mutation.js new file mode 100644 index 0000000..e69de29 diff --git a/test/vuex/one-md-usergroup-user-v6/store.js b/test/vuex/one-md-usergroup-user-v6/store.js new file mode 100644 index 0000000..bf18e89 --- /dev/null +++ b/test/vuex/one-md-usergroup-user-v6/store.js @@ -0,0 +1,25 @@ +// State +// data ... +// Mutations +// +// +// Actions +import usergroup from "./modules/usergroup.js"; +import user from "./modules/user.js"; +import system from "../../../apps/modules/system/system.js"; +export const store = new Vuex.Store({ + modules: { + usergroup: usergroup, + user: user, + system:system + }, + state: { + + }, + mutations: { + + }, + actions: { + + } +});