feature: po pay downpayment
This commit is contained in:
53
test/vuex/acc-one-map-inventaris-coa/modules/datacoa.js
Normal file
53
test/vuex/acc-one-map-inventaris-coa/modules/datacoa.js
Normal file
@@ -0,0 +1,53 @@
|
||||
import * as api from "../api/api.js";
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
invCoa: [],
|
||||
debtCoa: [],
|
||||
bebanCoa: [],
|
||||
accumCoa: [],
|
||||
labaCoa: [],
|
||||
rugiCoa: []
|
||||
},
|
||||
mutations: {
|
||||
update_invCoa(state, val) {
|
||||
state.invCoa = val
|
||||
},
|
||||
update_debtCoa(state, val) {
|
||||
state.debtCoa = val
|
||||
},
|
||||
update_bebanCoa(state, val) {
|
||||
state.bebanCoa = val
|
||||
},
|
||||
update_accumCoa(state, val) {
|
||||
state.accumCoa = val
|
||||
},
|
||||
update_labaCoa(state, val) {
|
||||
state.labaCoa = val
|
||||
},
|
||||
update_rugiCoa(state, val) {
|
||||
state.rugiCoa = val
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
async getListCoa(context, param) {
|
||||
try {
|
||||
let params = {
|
||||
token: one_token(),
|
||||
keyword: param.keyword
|
||||
}
|
||||
const resp = await api.getListCoa(params);
|
||||
if (resp.status != 'OK') {
|
||||
throw new Error(resp.message);
|
||||
}
|
||||
|
||||
let update = "update_" + param.key;
|
||||
context.commit(update, resp.data);
|
||||
} catch (e) {
|
||||
const snac = { state: true, msg: e.message, color: "error" };
|
||||
context.commit('invMap/update_snackbar', snac, { root: true });
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
113
test/vuex/acc-one-map-inventaris-coa/modules/invItemMap.js
Normal file
113
test/vuex/acc-one-map-inventaris-coa/modules/invItemMap.js
Normal file
@@ -0,0 +1,113 @@
|
||||
import * as api from "../api/api.js";
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
list_item_inventaris: {
|
||||
records: [],
|
||||
total: 0
|
||||
},
|
||||
dialog_add_mapping_item: false,
|
||||
selected_inventaris_item: {},
|
||||
form: {
|
||||
invCoaID: 0,
|
||||
debtCoaID: 0,
|
||||
bebanCoaID: 0,
|
||||
accumCoaID: 0,
|
||||
labaCoaID: 0,
|
||||
rugiCoaID: 0
|
||||
},
|
||||
dialog_confirm_item: false
|
||||
},
|
||||
mutations: {
|
||||
update_dialog_add_mapping_item(state, val) {
|
||||
state.dialog_add_mapping_item = val
|
||||
},
|
||||
update_selected_inventaris_item(state, val) {
|
||||
state.selected_inventaris_item = val
|
||||
},
|
||||
update_list_item_inventaris(state, val) {
|
||||
state.list_item_inventaris = val;
|
||||
},
|
||||
update_form(state, val) {
|
||||
state.form = val
|
||||
},
|
||||
update_dialog_confirm_item(state, val) {
|
||||
state.dialog_confirm_item = val
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
async createInvItemCoaMapping(context, params) {
|
||||
try {
|
||||
context.commit("invMap/update_loading_process", true, {root: true});
|
||||
params.token = one_token();
|
||||
const resp = await api.createInvItemCoaMapping(params);
|
||||
if (resp.status != 'OK') {
|
||||
throw new Error(resp.message);
|
||||
}
|
||||
|
||||
const snac = { state: true, msg: resp.data, color: "success" };
|
||||
context.commit('invMap/update_snackbar', snac, {root: true});
|
||||
|
||||
const golID = context.state.selected_inventaris_item.itemGolID;
|
||||
context.dispatch("invMap/getListItemInventaris", golID, {root: true});
|
||||
|
||||
context.commit("update_selected_inventaris_item", {});
|
||||
context.commit("invMap/update_loading_process", false, {root: true});
|
||||
context.commit('update_dialog_add_mapping_item', false);
|
||||
} catch (error) {
|
||||
context.commit("invMap/update_loading_process", false, {root: true});
|
||||
const snac = { state: true, msg: error.message, color: "error" };
|
||||
context.commit('invMap/update_snackbar', snac, {root: true});
|
||||
}
|
||||
},
|
||||
async editInvItemCoaMapping(context, params) {
|
||||
try {
|
||||
context.commit("invMap/update_loading_process", true, {root: true});
|
||||
params.token = one_token();
|
||||
const resp = await api.editInvItemCoaMapping(params);
|
||||
if (resp.status != 'OK') {
|
||||
throw new Error(resp.message);
|
||||
}
|
||||
|
||||
const snac = { state: true, msg: resp.data, color: "success" };
|
||||
context.commit('invMap/update_snackbar', snac, {root: true});
|
||||
|
||||
const golID = context.state.selected_inventaris_item.itemGolID;
|
||||
context.dispatch("invMap/getListItemInventaris", golID, {root: true});
|
||||
|
||||
context.commit("update_selected_inventaris_item", {});
|
||||
context.commit("invMap/update_loading_process", false, {root: true});
|
||||
context.commit('update_dialog_add_mapping_item', false);
|
||||
} catch (error) {
|
||||
context.commit("invMap/update_loading_process", false, {root: true});
|
||||
const snac = { state: true, msg: error.message, color: "error" };
|
||||
context.commit('invMap/update_snackbar', snac, {root: true});
|
||||
}
|
||||
},
|
||||
async deleteInvItemCoaMapping(context, params) {
|
||||
try {
|
||||
context.commit("invMap/update_loading_process", true, {root: true});
|
||||
params.token = one_token();
|
||||
const resp = await api.deleteInvItemCoaMapping(params);
|
||||
if (resp.status != 'OK') {
|
||||
throw new Error(resp.message);
|
||||
}
|
||||
|
||||
const snac = { state: true, msg: resp.data, color: "success" };
|
||||
context.commit('invMap/update_snackbar', snac, {root: true});
|
||||
|
||||
const golID = context.state.selected_inventaris_item.itemGolID;
|
||||
context.dispatch("invMap/getListItemInventaris", golID, {root: true});
|
||||
|
||||
context.commit("update_selected_inventaris_item", {});
|
||||
context.commit("invMap/update_loading_process", false, {root: true});
|
||||
context.commit("update_dialog_confirm_item", false);
|
||||
} catch (error) {
|
||||
context.commit("invMap/update_loading_process", false, {root: true});
|
||||
const snac = { state: true, msg: error.message, color: "error" };
|
||||
context.commit('invMap/update_snackbar', snac, {root: true});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
179
test/vuex/acc-one-map-inventaris-coa/modules/invMap.js
Normal file
179
test/vuex/acc-one-map-inventaris-coa/modules/invMap.js
Normal file
@@ -0,0 +1,179 @@
|
||||
import * as api from "../api/api.js";
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
snackbar: {
|
||||
state: false,
|
||||
msg: "",
|
||||
color: "error"
|
||||
},
|
||||
loading_process: false,
|
||||
list_inventarisMapping: {
|
||||
records: [],
|
||||
total: 0
|
||||
},
|
||||
selected_inventaris_gol: {},
|
||||
|
||||
/* dialog inventaris gol for default */
|
||||
dialog_add_mapping_default: false,
|
||||
form_gol: {
|
||||
golID: 0,
|
||||
invCoaID: 0,
|
||||
debtCoaID: 0,
|
||||
bebanCoaID: 0,
|
||||
accumCoaID: 0,
|
||||
labaCoaID: 0,
|
||||
rugiCoaID: 0
|
||||
},
|
||||
list_gol_inventaris: {
|
||||
records: [],
|
||||
total: 0
|
||||
},
|
||||
|
||||
dialog_confirm: false
|
||||
},
|
||||
mutations: {
|
||||
update_snackbar(state, val) {
|
||||
state.snackbar = val;
|
||||
},
|
||||
update_loading_process(state, val) {
|
||||
state.loading_process = val;
|
||||
},
|
||||
update_list_inventarisMapping(state, val) {
|
||||
state.list_inventarisMapping = val
|
||||
},
|
||||
update_selected_inventaris_gol(state, val) {
|
||||
state.selected_inventaris_gol = val
|
||||
},
|
||||
|
||||
/* dialog invetaris gol for default */
|
||||
update_dialog_add_mapping_default(state, val) {
|
||||
state.dialog_add_mapping_default = val
|
||||
},
|
||||
update_form_gol(state, val) {
|
||||
state.form_gol = val
|
||||
},
|
||||
update_list_gol_inventaris(state, val) {
|
||||
state.list_gol_inventaris = val;
|
||||
},
|
||||
update_dialog_confirm(state, val) {
|
||||
state.dialog_confirm = val
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
async getListingInventarisGol(context) {
|
||||
try {
|
||||
let params = { token: one_token() }
|
||||
const resp = await api.getListingInventarisGol(params);
|
||||
if (resp.status != 'OK') {
|
||||
throw new Error(resp.message);
|
||||
}
|
||||
|
||||
context.commit('update_list_gol_inventaris', resp.data);
|
||||
} catch (e) {
|
||||
const snac = { state: true, msg: e.message, color: "error" };
|
||||
context.commit('update_snackbar', snac);
|
||||
}
|
||||
},
|
||||
async getListItemInventaris(context, id) {
|
||||
try {
|
||||
let params = {
|
||||
token: one_token(),
|
||||
golID: id
|
||||
}
|
||||
const resp = await api.getListItemInventaris(params);
|
||||
if (resp.status != 'OK') {
|
||||
throw new Error(resp.message);
|
||||
}
|
||||
|
||||
context.commit('invItemMap/update_list_item_inventaris', resp.data, {root: true});
|
||||
} catch (e) {
|
||||
const snac = { state: true, msg: e.message, color: "error" };
|
||||
context.commit('update_snackbar', snac);
|
||||
}
|
||||
},
|
||||
async getListInventorygolMapping(context, keyword) {
|
||||
try {
|
||||
let params = {
|
||||
token: one_token(),
|
||||
keyword: keyword,
|
||||
currpage: 1
|
||||
}
|
||||
const resp = await api.getListInventorygolMapping(params);
|
||||
if (resp.status != 'OK') {
|
||||
throw new Error(resp.message);
|
||||
}
|
||||
|
||||
context.commit("update_list_inventarisMapping", resp.data);
|
||||
} catch (e) {
|
||||
const snac = { state: true, msg: e.message, color: "error" };
|
||||
context.commit('update_snackbar', snac);
|
||||
}
|
||||
},
|
||||
async createInventarisGolMapping(context, params) {
|
||||
try {
|
||||
context.state.loading_process = true;
|
||||
params.token = one_token();
|
||||
const resp = await api.createInvCoaMapping(params);
|
||||
if (resp.status != 'OK') {
|
||||
throw new Error(resp.message);
|
||||
}
|
||||
|
||||
const snac = { state: true, msg: resp.data, color: "success" };
|
||||
context.commit('update_snackbar', snac);
|
||||
context.dispatch("getListInventorygolMapping");
|
||||
|
||||
context.state.loading_process = false;
|
||||
context.state.dialog_add_mapping_default = false;
|
||||
} catch (e) {
|
||||
context.state.loading_process = false;
|
||||
const snac = { state: true, msg: e.message, color: "error" };
|
||||
context.commit('update_snackbar', snac);
|
||||
}
|
||||
},
|
||||
async editInventarisGolMapping(context, params) {
|
||||
try {
|
||||
context.state.loading_process = true;
|
||||
params.token = one_token();
|
||||
const resp = await api.editInvCoaMapping(params);
|
||||
if (resp.status != 'OK') {
|
||||
throw new Error(resp.message);
|
||||
}
|
||||
|
||||
const snac = { state: true, msg: resp.data, color: "success" };
|
||||
context.commit('update_snackbar', snac);
|
||||
|
||||
context.state.loading_process = false;
|
||||
context.state.dialog_add_mapping_default = false;
|
||||
} catch (e) {
|
||||
context.state.loading_process = false;
|
||||
const snac = { state: true, msg: e.message, color: "error" };
|
||||
context.commit('update_snackbar', snac);
|
||||
}
|
||||
},
|
||||
async deleteInventarisGolMapping(context, id) {
|
||||
try {
|
||||
context.state.loading_process = true;
|
||||
params = {
|
||||
token: one_token(),
|
||||
M_InventarisCoaMappingID: id
|
||||
};
|
||||
const resp = await api.deleteInvCoaMapping(params);
|
||||
if (resp.status != 'OK') {
|
||||
throw new Error(resp.message);
|
||||
}
|
||||
|
||||
const snac = { state: true, msg: resp.data, color: "success" };
|
||||
context.commit('update_snackbar', snac);
|
||||
|
||||
context.state.loading_process = false;
|
||||
context.state.dialog_add_mapping_default = false;
|
||||
} catch (e) {
|
||||
context.state.loading_process = false;
|
||||
const snac = { state: true, msg: e.message, color: "error" };
|
||||
context.commit('update_snackbar', snac);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user