diff --git a/src/locales/en.json b/src/locales/en.json index 63b425ef..b7222b36 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -91,6 +91,7 @@ "No new file upload. Please try again": "No new file upload. Please try again", "No results found": "No results found", "No time zone found": "No time zone found", + "of": "of", "OMS": "OMS", "OMS instance": "OMS instance", "Only select": "Only select", @@ -115,6 +116,7 @@ "Review": "Review", "Review PO details": "Review PO details", "Review purchase order": "Review purchase order", + "Reviewing uploaded file": "Reviewing uploaded file", "Reset": "Reset", "Reset inventory": "Reset inventory", "Reset password": "Reset password", diff --git a/src/store/modules/stock/actions.ts b/src/store/modules/stock/actions.ts index 4504a725..324ba61f 100644 --- a/src/store/modules/stock/actions.ts +++ b/src/store/modules/stock/actions.ts @@ -3,11 +3,11 @@ import store from '@/store' import RootState from '@/store/RootState' import StockState from './StockState' import * as types from './mutation-types' -import emitter from "@/event-bus"; const actions: ActionTree = { async processUpdateStockItems ({ commit, rootGetters }, items) { - emitter.emit('fileProcessing'); + this.dispatch('util/updateFileProcessingStatus', true); + //Fetching only top const productIds = items.slice(0, process.env['VUE_APP_VIEW_SIZE']).map((item: any) => item.identification); @@ -55,7 +55,7 @@ const actions: ActionTree = { const original = JSON.parse(JSON.stringify(items)); commit(types.STOCK_ITEMS_UPDATED, { parsed, original, initial }); - emitter.emit('fileProcessed'); + this.dispatch('util/updateFileProcessingStatus', false); }, updateStockItems({ commit }, stockItems){ commit(types.STOCK_ITEMS_UPDATED, stockItems); diff --git a/src/store/modules/util/UtilState.ts b/src/store/modules/util/UtilState.ts index 297adf23..859d779c 100644 --- a/src/store/modules/util/UtilState.ts +++ b/src/store/modules/util/UtilState.ts @@ -1,5 +1,6 @@ export default interface UserState { facilities: [], facilityLocationsByFacilityId: any; - goodIdentificationTypes: [] + goodIdentificationTypes: [], + isProcessingFile: false, } \ No newline at end of file diff --git a/src/store/modules/util/actions.ts b/src/store/modules/util/actions.ts index ebc1919f..259cad2e 100644 --- a/src/store/modules/util/actions.ts +++ b/src/store/modules/util/actions.ts @@ -104,7 +104,10 @@ const actions: ActionTree = { logger.error(err) } return state.facilities; - } + }, + async updateFileProcessingStatus({ commit }, status){ + commit(types.UTIL_FILE_PROCESSING_STATUS_UPDATED, { status }); + }, } diff --git a/src/store/modules/util/getters.ts b/src/store/modules/util/getters.ts index 32381f20..47e6948d 100644 --- a/src/store/modules/util/getters.ts +++ b/src/store/modules/util/getters.ts @@ -11,6 +11,9 @@ const getters: GetterTree = { }, getGoodIdentificationTypes(state) { return state.goodIdentificationTypes; + }, + getFileProcessingStatus(state) { + return state.isProcessingFile; } } export default getters; \ No newline at end of file diff --git a/src/store/modules/util/index.ts b/src/store/modules/util/index.ts index 4021ef1a..3b3c25b5 100644 --- a/src/store/modules/util/index.ts +++ b/src/store/modules/util/index.ts @@ -11,6 +11,7 @@ const userModule: Module = { facilities: [], facilityLocationsByFacilityId: {}, goodIdentificationTypes: [], + isProcessingFile: false }, getters, actions, diff --git a/src/store/modules/util/mutation-types.ts b/src/store/modules/util/mutation-types.ts index ae81db7d..31c4f81a 100644 --- a/src/store/modules/util/mutation-types.ts +++ b/src/store/modules/util/mutation-types.ts @@ -2,4 +2,5 @@ export const SN_UTIL = 'util' export const UTIL_FACILITIES_UPDATED = SN_UTIL + '/FACILITIES_UPDATED' export const UTIL_FACILITY_LOCATIONS_BY_FACILITY_ID = SN_UTIL + '/FACILITY_LOCATIONS_BY_FACILITY_ID' export const UTIL_GOOD_IDENTIFICATION_TYPES_UPDATED = SN_UTIL + '/GOOD_IDENTIFICATION_TYPES_UPDATED' +export const UTIL_FILE_PROCESSING_STATUS_UPDATED = SN_UTIL + '/FILE_PROCESSING_STATUS_UPDATED' diff --git a/src/store/modules/util/mutations.ts b/src/store/modules/util/mutations.ts index 896867b9..9080fad7 100644 --- a/src/store/modules/util/mutations.ts +++ b/src/store/modules/util/mutations.ts @@ -13,6 +13,9 @@ const mutations: MutationTree = { }, [types.UTIL_GOOD_IDENTIFICATION_TYPES_UPDATED](state, payload) { state.goodIdentificationTypes = payload - } + }, + [types.UTIL_FILE_PROCESSING_STATUS_UPDATED] (state, payload) { + state.isProcessingFile = payload.status; + } } export default mutations; \ No newline at end of file diff --git a/src/views/InventoryReview.vue b/src/views/InventoryReview.vue index b9b312f2..51150423 100644 --- a/src/views/InventoryReview.vue +++ b/src/views/InventoryReview.vue @@ -3,6 +3,9 @@ + {{stockItems.parsed.length}} {{ $t('items') }} + {{ stockItems.initial.length }} {{ $t('of') }} {{ stockItems.parsed.length }} {{ $t('items') }} + @@ -101,8 +104,7 @@ import { mapGetters, useStore } from "vuex"; import { useRouter } from 'vue-router'; import { showToast } from '@/utils'; import { translate } from "@/i18n"; -import emitter from "@/event-bus"; -import { IonCard, IonCardContent, IonPage, IonHeader, IonToolbar, IonBackButton, IonContent, IonItem, IonThumbnail, IonLabel, IonChip, IonIcon, IonButton, IonButtons, popoverController, IonFab, IonFabButton, modalController, alertController, IonNote } from '@ionic/vue' +import { IonCard, IonCardContent, IonPage, IonHeader, IonToolbar, IonBackButton, IonContent, IonItem, IonThumbnail, IonLabel, IonChip, IonIcon, IonButton, IonButtons, popoverController, IonFab, IonFabButton, modalController, alertController, IonNote, IonSpinner, IonTitle } from '@ionic/vue' import { businessOutline, calculatorOutline, chevronForwardOutline, ellipsisVerticalOutline, locationOutline, shirtOutline, checkboxOutline, cloudUploadOutline, arrowUndoOutline, warningOutline } from 'ionicons/icons' export default defineComponent({ @@ -125,11 +127,14 @@ export default defineComponent({ IonButtons, IonFab, IonFabButton, - IonNote + IonNote, + IonSpinner, + IonTitle }, computed: { ...mapGetters({ stockItems: 'stock/getStockItems', + isProcessingFile: 'util/getFileProcessingStatus', getProduct: 'product/getProduct', instanceUrl: 'user/getInstanceUrl', facilities: 'util/getFacilities', @@ -143,21 +148,12 @@ export default defineComponent({ isParentProductUpdated: false, isCsvUploadedSuccessfully: false, facilityLocations: {}, - isProcessingFile: true, viewSize: process.env['VUE_APP_VIEW_SIZE'] } }, ionViewDidEnter(){ this.store.dispatch('util/fetchFacilities'); }, - async mounted() { - emitter.on('fileProcessing', this.fileProcessing); - emitter.on('fileProcessed', this.fileProcessed); - }, - unmounted() { - emitter.off('fileProcessing', this.fileProcessing); - emitter.off('fileProcessed', this.fileProcessed); - }, async beforeRouteLeave(to) { if(to.path === '/login') return; let canLeave = false; @@ -188,12 +184,6 @@ export default defineComponent({ }, methods: { - async fileProcessing() { - this.isProcessingFile = true; - }, - async fileProcessed() { - this.isProcessingFile = false; - }, getFacilityName(facilityId: any, externalFacilityId: any) { if (facilityId) { const facility = this.facilities.find((facility: any) => facilityId === facility.facilityId );