feature: po pay downpayment
This commit is contained in:
@@ -25,29 +25,15 @@ export default {
|
||||
currpage: 1,
|
||||
selected_roasset: {},
|
||||
|
||||
/* form receive */
|
||||
dialog_receive_aset: false,
|
||||
form_receive: {
|
||||
date: moment(new Date()).format('YYYY-MM-DD'),
|
||||
supplier: "",
|
||||
reference: "",
|
||||
ponumber: "",
|
||||
contractlength: 0,
|
||||
datepayment: "",
|
||||
cicilan: 0,
|
||||
downpayment: 0,
|
||||
totalbill: 0,
|
||||
catatan: ""
|
||||
},
|
||||
item_receive: [],
|
||||
dialog_pick_contract: false,
|
||||
|
||||
/* upload attachment */
|
||||
dialog_attachment: false,
|
||||
preview_attachment: [],
|
||||
|
||||
/* delete */
|
||||
dialog_delete: false
|
||||
dialog_delete: false,
|
||||
|
||||
/* confirm */
|
||||
dialog_confirm: false
|
||||
},
|
||||
mutations: {
|
||||
/* common */
|
||||
@@ -75,20 +61,6 @@ export default {
|
||||
state.selected_roasset = val
|
||||
},
|
||||
|
||||
/* form receive */
|
||||
update_dialog_receive_aset(state, val) {
|
||||
state.dialog_receive_aset = val
|
||||
},
|
||||
update_form_receive(state, val) {
|
||||
state.form_receive = val
|
||||
},
|
||||
update_item_receive(state, val) {
|
||||
state.item_receive = val
|
||||
},
|
||||
update_dialog_pick_contract(state, val) {
|
||||
state.dialog_pick_contract = val
|
||||
},
|
||||
|
||||
/* attachment */
|
||||
update_dialog_attachment(state, val) {
|
||||
state.dialog_attachment = val
|
||||
@@ -100,45 +72,143 @@ export default {
|
||||
/* delete */
|
||||
update_dialog_delete(state, val) {
|
||||
state.dialog_delete = val
|
||||
},
|
||||
|
||||
update_dialog_confirm(state, val) {
|
||||
state.dialog_confirm = val
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
async lookupOrderAssetReceived(context) {
|
||||
try {
|
||||
// const param = {
|
||||
// token: one_token(),
|
||||
// }
|
||||
|
||||
// const resp = await api.lookupOrderAssetReceived(param);
|
||||
// if (resp.status != "OK") {
|
||||
// throw new Error(resp.message);
|
||||
// }
|
||||
|
||||
// context.commit("update_list_roasset", resp.data);
|
||||
|
||||
const dummy = {
|
||||
records: [
|
||||
{
|
||||
date: moment(new Date()).format('YYYY-MM-DD'),
|
||||
receiveordernumber: "GR-003/SDM-14/SM-1/VI/2026",
|
||||
purchaseordernumber: "PO-002/OPR-RL/SM-2/VI/2026",
|
||||
suppliername: "PT MEJA ABADI",
|
||||
uangmuka: 4000000,
|
||||
totaltagihan: 10000000,
|
||||
besarcicilan: 500000,
|
||||
numbercicilan: 12,
|
||||
cicilanterbayar: 0,
|
||||
status: "Unconfirmed"
|
||||
}
|
||||
],
|
||||
total: 1
|
||||
const param = {
|
||||
token: one_token(),
|
||||
currpage: context.state.currpage,
|
||||
...context.state.filterasset
|
||||
}
|
||||
|
||||
context.commit("update_list_roasset", dummy);
|
||||
const resp = await api.getListingROAsset(param);
|
||||
if (resp.status != "OK") {
|
||||
throw new Error(resp.message);
|
||||
}
|
||||
|
||||
context.commit("update_list_roasset", resp.data);
|
||||
} catch (e) {
|
||||
const snac = { color: 'error', msg: e.message, state: false };
|
||||
context.commit("update_snackbar", snac);
|
||||
}
|
||||
},
|
||||
async lookupAttachment(context, roID) {
|
||||
try {
|
||||
const param = {
|
||||
token: one_token(),
|
||||
roID: roID
|
||||
}
|
||||
|
||||
const resp = await api.getListAttachment(param);
|
||||
if (resp.status != "OK") {
|
||||
throw new Error(resp.message);
|
||||
}
|
||||
|
||||
context.commit('update_preview_attachment', resp.data);
|
||||
} catch (e) {
|
||||
const snac = { color: 'error', msg: e.message, state: false };
|
||||
context.commit("update_snackbar", snac);
|
||||
}
|
||||
},
|
||||
async getDetailDataROAsset(context, roid) {
|
||||
try {
|
||||
context.commit('update_loading_process', true);
|
||||
let params = {
|
||||
token: one_token(),
|
||||
roid: roid
|
||||
}
|
||||
const resp = await api.getDetailDataROAsset(params);
|
||||
if (resp.status != "OK") {
|
||||
throw new Error(resp.message);
|
||||
}
|
||||
|
||||
context.commit('orderAsset/update_form_receive', resp.data.header, { root: true })
|
||||
context.dispatch('orderAsset/listingGudang', resp.data.header.branchID, { root: true });
|
||||
|
||||
context.commit('orderAsset/update_order_received', resp.data.detail, { root: true })
|
||||
|
||||
context.commit('update_loading_process', false);
|
||||
} catch (e) {
|
||||
context.commit('update_loading_process', false);
|
||||
const snac = { color: 'error', msg: e.message, state: false };
|
||||
context.commit("update_snackbar", snac);
|
||||
}
|
||||
},
|
||||
async uploadAttachment(context, params) {
|
||||
try {
|
||||
context.commit('update_loading_process', true);
|
||||
const resp = await api.uploadAttachment(params);
|
||||
if (resp.status != "OK") {
|
||||
throw new Error(resp.message);
|
||||
}
|
||||
|
||||
const snac = { color: 'success', msg: resp.data, state: true };
|
||||
context.commit("update_snackbar", snac);
|
||||
|
||||
context.dispatch('lookupOrderAssetReceived');
|
||||
context.commit('update_loading_process', false);
|
||||
context.state.dialog_attachment = false;
|
||||
} catch (e) {
|
||||
context.commit('update_loading_process', false);
|
||||
const snac = { color: 'error', msg: e.message, state: false };
|
||||
context.commit("update_snackbar", snac);
|
||||
}
|
||||
},
|
||||
async deleteReceiveAsset(context, roID) {
|
||||
try {
|
||||
context.commit('update_loading_process', true);
|
||||
const param = {
|
||||
token: one_token(),
|
||||
roid: roID
|
||||
}
|
||||
|
||||
const resp = await api.deleteReceiveOrder(param);
|
||||
if (resp.status != "OK") {
|
||||
throw new Error(resp.message);
|
||||
}
|
||||
|
||||
const snac = { color: 'success', msg: resp.data, state: true };
|
||||
context.commit("update_snackbar", snac);
|
||||
|
||||
context.dispatch('lookupOrderAssetReceived');
|
||||
context.commit('update_loading_process', false);
|
||||
context.state.dialog_delete = false;
|
||||
} catch (e) {
|
||||
context.commit('update_loading_process', false);
|
||||
const snac = { color: 'error', msg: e.message, state: false };
|
||||
context.commit("update_snackbar", snac);
|
||||
}
|
||||
},
|
||||
async confirmReceiveOrder(context, roID) {
|
||||
try {
|
||||
context.commit('update_loading_process', true);
|
||||
const param = {
|
||||
token: one_token(),
|
||||
roid: roID
|
||||
}
|
||||
|
||||
const resp = await api.confirmReceiveOrder(param);
|
||||
if (resp.status != "OK") {
|
||||
throw new Error(resp.message);
|
||||
}
|
||||
|
||||
const snac = { color: 'success', msg: resp.data, state: true };
|
||||
context.commit("update_snackbar", snac);
|
||||
|
||||
context.dispatch('lookupOrderAssetReceived');
|
||||
context.commit('update_loading_process', false);
|
||||
context.state.dialog_confirm = false;
|
||||
} catch (e) {
|
||||
context.commit('update_loading_process', false);
|
||||
const snac = { color: 'error', msg: e.message, state: false };
|
||||
context.commit("update_snackbar", snac);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user