From 315b657ee3f36983f3d6ef52ac64b16f3e7a4447 Mon Sep 17 00:00:00 2001 From: sasadib Date: Wed, 3 Jun 2026 17:11:38 +0700 Subject: [PATCH] add progress --- .../api/api.js | 21 ++++- .../components/dialogHandOver.vue | 76 ++++++++++++++---- .../components/dialogPrintBarcode.vue | 80 +++++++++---------- .../components/formReceiveItem.vue | 22 ++--- .../components/formReceiveItemEdit.vue | 22 ++--- .../components/oneRoLayout.vue | 1 + .../modules/ro.js | 36 ++++++++- 7 files changed, 172 insertions(+), 86 deletions(-) diff --git a/test/vuex/acc-one-receive-item-po-inventaris/api/api.js b/test/vuex/acc-one-receive-item-po-inventaris/api/api.js index c710a41..9f07dc0 100644 --- a/test/vuex/acc-one-receive-item-po-inventaris/api/api.js +++ b/test/vuex/acc-one-receive-item-po-inventaris/api/api.js @@ -323,6 +323,25 @@ export async function getBarcodes(params) { } } +export async function getInventarisBelumSerah(params) { + try { + var resp = await axios.post(URL + '/getInventarisBelumSerah', 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 template(params) { try { var resp = await axios.post(URL + '/', params); @@ -340,4 +359,4 @@ export async function template(params) { message: error.message }; } -} \ 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 1f752e9..ba3d194 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 @@ -8,18 +8,32 @@

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

- - - + + + + :rules="ruang_rules" outline item-value="M_RuanganID" + item-text="M_RuanganName"> (v && Object.keys(v).length > 0) || 'Lokasi ruangan 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: "", align: "center", sortable: false, value: "checked", + width: "10%", class: "pa-2 blue lighten-3 white--text", }, { - text: "QTY", align: "center", sortable: false, value: "qtyitem", + text: "ITEM", align: "center", sortable: false, value: "itemname", + width: "50%", class: "pa-2 blue lighten-3 white--text", + }, + { + text: "QTY DITERIMA", align: "center", sortable: false, value: "qtyitem", width: "20%", class: "pa-2 blue lighten-3 white--text", }, { - text: "HANDOVER", align: "center", sortable: false, value: "qtysend", + text: "QTY HANDOVER", align: "center", sortable: false, value: "qtysend", width: "20%", class: "pa-2 blue lighten-3 white--text", }, ], - items: [] } }, computed: { @@ -99,6 +117,14 @@ module.exports = { this.$store.commit("ro/update_selected_ro", val); } }, + list_itembelumserah: { + get() { + return this.$store.state.ro.list_itembelumserah + }, + set(val) { + this.$store.commit("ro/update_list_itembelumserah", val) + } + }, list_staff() { return this.$store.state.ro.list_staff }, @@ -107,6 +133,19 @@ module.exports = { }, }, methods: { + onChangeCheckbox(item) { + if (item.checked) { + item.serahQty = item.sisaQty + } else { + item.serahQty = item.originalQty - item.sisaQty + } + }, + qtyRules(originalQty) { + return [ + v => Number(v) > 0 || "Jumlah harus diatas 0", + v => Number(v) <= Number(originalQty) || "Jumlah melebihi inventaris yang diterima" + ]; + }, closeHandOver() { this.$store.commit("ro/update_selected_staff", {}); this.dialog_handover = false @@ -114,11 +153,20 @@ module.exports = { }, async simpanHandOver() { if (this.$refs.formhandover.validate()) { + let checked = this.list_itembelumserah.filter((ele) => ele.checked); + if (checked.length < 1) { + console.log("no item selected"); + return; + } + let prm = { staffID: this.selected_staff.M_UserID, receiveOrderPoID: this.selected_ro.ReceiveOrderPoID, - ruanganID: this.selected_ro.M_RuanganID + ruanganID: this.selected_ruangan, + item: checked } + + // console.log("parameter", prm); await this.$store.dispatch("ro/saveHandover", prm); this.$refs.formhandover.resetValidation(); } diff --git a/test/vuex/acc-one-receive-item-po-inventaris/components/dialogPrintBarcode.vue b/test/vuex/acc-one-receive-item-po-inventaris/components/dialogPrintBarcode.vue index 522c97a..c4598fd 100644 --- a/test/vuex/acc-one-receive-item-po-inventaris/components/dialogPrintBarcode.vue +++ b/test/vuex/acc-one-receive-item-po-inventaris/components/dialogPrintBarcode.vue @@ -1,45 +1,41 @@ @@ -174,4 +170,4 @@ module.exports = { }, }, } - \ No newline at end of file + diff --git a/test/vuex/acc-one-receive-item-po-inventaris/components/formReceiveItem.vue b/test/vuex/acc-one-receive-item-po-inventaris/components/formReceiveItem.vue index 4c6ace1..1378bf8 100644 --- a/test/vuex/acc-one-receive-item-po-inventaris/components/formReceiveItem.vue +++ b/test/vuex/acc-one-receive-item-po-inventaris/components/formReceiveItem.vue @@ -33,30 +33,30 @@ - + - + - - - - - - - + + + - - + - + + + + - + 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 156ae0f..1d3f67d 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 @@ -377,6 +377,7 @@ module.exports = { this.$store.commit("ro/update_selected_ro", data); this.$store.dispatch("ro/getRuangan"); this.$store.dispatch("ro/getListStaff", 'Y'); + this.$store.dispatch("ro/getItemSerahTerima"); this.$store.commit("ro/update_dialog_handover", true); }, uploadDoct(data) { diff --git a/test/vuex/acc-one-receive-item-po-inventaris/modules/ro.js b/test/vuex/acc-one-receive-item-po-inventaris/modules/ro.js index 6cffec3..66362f7 100644 --- a/test/vuex/acc-one-receive-item-po-inventaris/modules/ro.js +++ b/test/vuex/acc-one-receive-item-po-inventaris/modules/ro.js @@ -40,6 +40,7 @@ export default { indeterminatex: false, bar_chx_all: false, selected_barcode: [], + list_itembelumserah: [] }, mutations: { update_dialog_confirmation(state, data) { @@ -119,6 +120,9 @@ export default { }, update_selected_barcode(state, val) { state.selected_barcode = val + }, + update_list_itembelumserah(state, val) { + state.list_itembelumserah = val } }, actions: { @@ -243,7 +247,7 @@ export default { isUpfront: element.PurchaseOrderShippingCostStatus } - const isExist = context.rootState.form.shipping_info.some( + const isExist = temp_ship.some( item => item.num_po == element.PurchaseOrderNumber ); if (!isExist) { @@ -273,9 +277,9 @@ export default { note: context.state.selected_ro.ReceiveOrderPoNote } - context.commit("form/update_form_receive", form, {root: true}); - context.commit("form/update_shipping_info", temp_ship, {root: true}); - context.commit("form/update_form_receive_item", resp.data, {root: true}); + context.commit("form/update_form_receive", form, { root: true }); + context.commit("form/update_shipping_info", temp_ship, { root: true }); + context.commit("form/update_form_receive_item", resp.data, { root: true }); } } catch (error) { context.commit("update_snackbar", { @@ -342,6 +346,30 @@ export default { }); } }, + async getItemSerahTerima(context) { + try { + let param = { + token: one_token(), + ROID: context.state.selected_ro.ReceiveOrderPoID + } + let resp = await api.getInventarisBelumSerah(param); + if (resp.status != 'OK') { + context.commit("update_snackbar", { + color: 'error', + msg: resp.message, + isOpen: true + }); + } else { + context.commit("update_list_itembelumserah", resp.data); + } + } catch(error) { + context.commit("update_snackbar", { + color: 'error', + msg: error.message, + isOpen: true + }); + } + }, async saveHandover(context, param) { try { param.token = one_token()