diff --git a/.env.example b/.env.example index 7669ab1..1ce2c66 100644 --- a/.env.example +++ b/.env.example @@ -8,6 +8,6 @@ VUE_APP_ALIAS={} VUE_APP_MAPPING_TYPES={"PO": "PO_MAPPING_PREF","RSTINV": "INV_MAPPING_PREF","RSTSTK": "STK_MAPPING_PREF"} VUE_APP_MAPPING_PO={"orderId": { "label": "Order ID", "required": true }, "productSku": { "label": "Shopify product SKU", "required": true },"orderDate": { "label": "Arrival date", "required": true }, "quantity": { "label": "Ordered quantity", "required": true }, "facility": { "label": "Facility ID", "required": true }} VUE_APP_MAPPING_RSTINV={"productIdentification": { "label": "Product Identification", "required": true }, "quantity": { "label": "Quantity", "required": true }, "facility": { "label": "Facility ID", "required": true }} -VUE_APP_MAPPING_RSTSTK={"product": { "label": "Product", "required": true }, "facility": { "label": "Facility", "required": true }, "restockQuantity": { "label": "Restock quantity", "required": true }} +VUE_APP_MAPPING_RSTSTK={"productIdentification": { "label": "Product Identification", "required": true }, "facility": { "label": "Facility", "required": true }, "restockQuantity": { "label": "Restock quantity", "required": true }} VUE_APP_DEFAULT_LOG_LEVEL="error" VUE_APP_LOGIN_URL="http://launchpad.hotwax.io/login" \ No newline at end of file diff --git a/src/store/modules/stock/actions.ts b/src/store/modules/stock/actions.ts index 6145a79..4e25333 100644 --- a/src/store/modules/stock/actions.ts +++ b/src/store/modules/stock/actions.ts @@ -70,7 +70,7 @@ const actions: ActionTree = { }, async processUpdateRestockItems({ commit }, items) { - const productIds = items.filter((item: any) => item.product).map((item: any) => item.product); + const productIds = items.map((item: any) => item.identification); const payload = { productIds, @@ -87,7 +87,7 @@ const actions: ActionTree = { const cachedProducts = await store.dispatch("product/fetchProducts", payload); const initial = items.map((item: any) => { - const product = cachedProducts[item.product]; + const product = cachedProducts[item.identification]; if (product) { item.parentProductId = product?.parent?.id; @@ -103,9 +103,6 @@ const actions: ActionTree = { commit(types.STOCK_SCHEDULE_ITEMS_UPDATED, initial ); }, - clearRetockItems({ commit }) { - commit(types.STOCK_SCHEDULE_ITEMS_UPDATED, []); - }, async scheduledStock({ commit }, payload) { commit(types.STOCK_SCHEDULED_INFORMATION, payload) }, diff --git a/src/views/ScheduledRestock.vue b/src/views/ScheduledRestock.vue index 3b237fd..f746e6a 100644 --- a/src/views/ScheduledRestock.vue +++ b/src/views/ScheduledRestock.vue @@ -34,14 +34,21 @@ Required - + + Optional, or select during review @@ -164,6 +171,7 @@ export default defineComponent({ fileColumns: [], fieldMapping: {}, fields: process.env["VUE_APP_MAPPING_RSTSTK"] ? JSON.parse(process.env["VUE_APP_MAPPING_RSTSTK"]) : {}, + identificationTypeId: "SHOPIFY_PROD_SKU", schedule: '', isDateTimeModalOpen: false, shopifyShops: [], @@ -172,12 +180,13 @@ export default defineComponent({ selectedShopifyShopId: '', isUpdateDateTimeModalOpen: false, shopId: '', - currentJob: {} + currentJob: {}, } }, computed: { ...mapGetters({ fieldMappings: 'user/getFieldMappings', + goodIdentificationTypes: 'util/getGoodIdentificationTypes', jobs: 'stock/getScheduledJobs', productStores: 'util/getProductStores', userProfile: 'user/getUserProfile' @@ -196,6 +205,7 @@ export default defineComponent({ this.$refs.file.value = null; await this.store.dispatch('stock/fetchJobs') await this.store.dispatch('util/fetchProductStores') + await this.store.dispatch('util/fetchGoodIdentificationTypes'); }, methods: { @@ -338,8 +348,8 @@ export default defineComponent({ return { quantity: item[this.fieldMapping.restockQuantity], facilityId: '', - product: item[this.fieldMapping.product], - identificationTypeId: "SHOPIFY_PROD_SKU", + identification: item[this.fieldMapping.productIdentification], + identificationTypeId: this.identificationTypeId, externalFacilityId: item[this.fieldMapping.facility] } }) @@ -393,7 +403,7 @@ main { margin: var(--spacer-sm) auto 0; } -.review{ +.review { margin: var(--spacer-base) var(--spacer-sm); } diff --git a/src/views/ScheduledRestockReview.vue b/src/views/ScheduledRestockReview.vue index 43ed978..94f9676 100644 --- a/src/views/ScheduledRestockReview.vue +++ b/src/views/ScheduledRestockReview.vue @@ -253,7 +253,7 @@ export default defineComponent({ return; } const groupedItems = Object.keys(this.parsedItems).reduce((result, key) => { - const items = this.parsedItems[key]; + const items = this.parsedItems[key].filter(item => item.isSelected); items.forEach(item => { if (!result[item.externalFacilityId]) { result[item.externalFacilityId] = [];