From 8ed2f0e2fad856c7a3c471277b5b77365abf0373 Mon Sep 17 00:00:00 2001 From: Disha Talreja Date: Wed, 30 Mar 2022 15:30:20 +0530 Subject: [PATCH 01/12] Block user navigating to details page if no records after review action(#24pp0fm) --- src/views/PurchaseOrder.vue | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/views/PurchaseOrder.vue b/src/views/PurchaseOrder.vue index f8fc3a83..87ebf5fc 100644 --- a/src/views/PurchaseOrder.vue +++ b/src/views/PurchaseOrder.vue @@ -134,10 +134,14 @@ export default defineComponent({ orderItem.facilityId = item[this.facilityField] return orderItem }) - this.store.dispatch('order/updatedOrderList', this.orderItemsList); - this.router.push({ - name:'PurchaseOrderDetail' - }) + if(this.orderIdField && this.productSkuField && this.dateField && this.quantityField && this.facilityField && this.orderItemsList.length && this.content){ + this.store.dispatch('order/updatedOrderList', this.orderItemsList); + this.router.push({ + name:'PurchaseOrderDetail' + }) + } else { + showToast(translate("Something went wrong")); + } }, }, setup() { From 3686bca206c3f7406a0265118434fa8583440bff Mon Sep 17 00:00:00 2001 From: Disha Talreja Date: Wed, 30 Mar 2022 15:33:00 +0530 Subject: [PATCH 02/12] Added changelg entry(#24pp0fm) --- changelogs/unreleased/-24pp0fm.yml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 changelogs/unreleased/-24pp0fm.yml diff --git a/changelogs/unreleased/-24pp0fm.yml b/changelogs/unreleased/-24pp0fm.yml new file mode 100644 index 00000000..5fec5ad1 --- /dev/null +++ b/changelogs/unreleased/-24pp0fm.yml @@ -0,0 +1,6 @@ +--- +title: Block user navigating to details page if no records after review action +ticket_id: "#24pp0fm" +merge_request: 26 +author: Disha Talreja +type: performance From ebd5e114fb2585f715f33e9146a9153f15233984 Mon Sep 17 00:00:00 2001 From: Disha Talreja Date: Thu, 14 Apr 2022 15:03:53 +0530 Subject: [PATCH 03/12] Updated the logic to block user navigation and added a different toast when file is not uploaded(#24pp0fm) --- src/views/PurchaseOrder.vue | 40 ++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/src/views/PurchaseOrder.vue b/src/views/PurchaseOrder.vue index 87ebf5fc..cddf26a2 100644 --- a/src/views/PurchaseOrder.vue +++ b/src/views/PurchaseOrder.vue @@ -18,35 +18,35 @@ {{ $t("Select the column index for the following information in the uploaded CSV.") }} {{ $t("Order ID") }} - + {{ prop }} {{ $t("Shopify product SKU") }} - + {{ prop }} {{ $t("Arrival date") }} - + {{ prop }} {{ $t("Ordered quantity") }} - + {{ prop }} {{ $t("Facility ID") }} - + {{ prop }} @@ -90,12 +90,13 @@ export default defineComponent({ return { file: "", content: [], - orderIdField: "", - productSkuField: "", - productUpcField: "", - dateField: "", - quantityField: "", - facilityField: "", + fields:{ + orderIdField: "", + productSkuField: "", + dateField: "", + quantityField: "", + facilityField: "", + }, orderItemsList: [], } }, @@ -121,20 +122,23 @@ export default defineComponent({ const orderItem = { orderId: [], shopifyProductSKU: [], - shopifyProductUPC: [], arrivalDate: [], quantityOrdered: [], facilityId: [] } orderItem.orderId = item[this.orderIdField]; - orderItem.shopifyProductSKU = item[this.productSkuField]; - orderItem.shopifyProductUPC = item[this.productUpcField]; - orderItem.arrivalDate = item[this.dateField]; - orderItem.quantityOrdered = item[this.quantityField]; - orderItem.facilityId = item[this.facilityField] + orderItem.shopifyProductSKU = item[this.fields.productSkuField]; + orderItem.arrivalDate = item[this.fields.dateField]; + orderItem.quantityOrdered = item[this.fields.quantityField]; + orderItem.facilityId = item[this.fields.facilityField] return orderItem }) - if(this.orderIdField && this.productSkuField && this.dateField && this.quantityField && this.facilityField && this.orderItemsList.length && this.content){ + const review = Object.values(this.fields).some(field => { + return field === ""; + }) + if (this.content.length <= 0) { + showToast(translate("Please upload a purchase order to continue")); + } else if (!review) { this.store.dispatch('order/updatedOrderList', this.orderItemsList); this.router.push({ name:'PurchaseOrderDetail' From db6ddd63c255e0d86aced6f50da3fc4ef2007aa8 Mon Sep 17 00:00:00 2001 From: Disha Talreja Date: Thu, 14 Apr 2022 15:08:52 +0530 Subject: [PATCH 04/12] Updated the toast message(#24pp0fm) --- src/views/PurchaseOrder.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/views/PurchaseOrder.vue b/src/views/PurchaseOrder.vue index cddf26a2..44b100ba 100644 --- a/src/views/PurchaseOrder.vue +++ b/src/views/PurchaseOrder.vue @@ -144,7 +144,7 @@ export default defineComponent({ name:'PurchaseOrderDetail' }) } else { - showToast(translate("Something went wrong")); + showToast(translate("Select all the fields to continue")); } }, }, From 202add79152c3b274e532d6cfb309254074c3cb3 Mon Sep 17 00:00:00 2001 From: Disha Talreja Date: Mon, 18 Jul 2022 10:55:05 +0530 Subject: [PATCH 05/12] Updated the code(#24pp0fm) --- src/views/PurchaseOrder.vue | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/src/views/PurchaseOrder.vue b/src/views/PurchaseOrder.vue index 8c845b74..7aedc824 100644 --- a/src/views/PurchaseOrder.vue +++ b/src/views/PurchaseOrder.vue @@ -19,35 +19,35 @@ {{ $t("Select the column index for the following information in the uploaded CSV.") }} {{ $t("Order ID") }} - + {{ prop }} {{ $t("Shopify product SKU") }} - + {{ prop }} {{ $t("Arrival date") }} - + {{ prop }} {{ $t("Ordered quantity") }} - + {{ prop }} {{ $t("Facility ID") }} - + {{ prop }} @@ -122,18 +122,16 @@ export default defineComponent({ mapFields() { this.orderItemsList = this.content.map(item => { return { - orderId: item[this.orderIdField], - shopifyProductSKU: item[this.productSkuField], - shopifyProductUPC: item[this.productUpcField], - arrivalDate: item[this.dateField], - quantityOrdered: item[this.quantityField], - facilityId: '', - externalFacilityId: item[this.facilityField] + orderId: item[this.fields.orderIdField], + shopifyProductSKU: item[this.fields.productSkuField], + arrivalDate: item[this.fields.dateField], + quantityOrdered: item[this.fields.quantityField], + externalFacilityId: item[this.fields.facilityField] } }) const review = Object.values(this.fields).some(field => { return field === ""; - }) + }); if (this.content.length <= 0) { showToast(translate("Please upload a purchase order to continue")); } else if (!review) { From 835a0b8fce8b5e60b506dfd880c80f916bfb9a58 Mon Sep 17 00:00:00 2001 From: Aditya Sharma Date: Thu, 27 Oct 2022 11:24:11 +0530 Subject: [PATCH 06/12] Delete -24pp0fm.yml --- changelogs/unreleased/-24pp0fm.yml | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 changelogs/unreleased/-24pp0fm.yml diff --git a/changelogs/unreleased/-24pp0fm.yml b/changelogs/unreleased/-24pp0fm.yml deleted file mode 100644 index 5fec5ad1..00000000 --- a/changelogs/unreleased/-24pp0fm.yml +++ /dev/null @@ -1,6 +0,0 @@ ---- -title: Block user navigating to details page if no records after review action -ticket_id: "#24pp0fm" -merge_request: 26 -author: Disha Talreja -type: performance From 165c426338c0c304bd86bd4dee7a5b85072e1330 Mon Sep 17 00:00:00 2001 From: Disha Talreja Date: Mon, 31 Oct 2022 10:58:20 +0530 Subject: [PATCH 07/12] Updated toast message and added static text in en.json file(#24pp0fm) --- src/locales/en.json | 2 ++ src/views/PurchaseOrder.vue | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/locales/en.json b/src/locales/en.json index 2dc73919..0990c4fc 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -32,6 +32,7 @@ "Ordered": "Ordered", "Ordered quantity": "Ordered quantity", "Password": "Password", + "Please upload a valid purchase order csv to continue": "Please upload a valid purchase order csv to continue", "PO External Order ID": "PO External Order ID", "Preorder": "Preorder", "Purchase order": "Purchase order", @@ -43,6 +44,7 @@ "Search products": "Search products", "Search time zones": "Search time zones", "Select": "Select", + "Select all the fields to continue": "Select all the fields to continue", "Select time zone": "Select time zone", "Select the column index for the following information in the uploaded CSV.": "Select the column index for the following information in the uploaded CSV.", "Something went wrong": "Something went wrong", diff --git a/src/views/PurchaseOrder.vue b/src/views/PurchaseOrder.vue index 7aedc824..23c41693 100644 --- a/src/views/PurchaseOrder.vue +++ b/src/views/PurchaseOrder.vue @@ -133,7 +133,7 @@ export default defineComponent({ return field === ""; }); if (this.content.length <= 0) { - showToast(translate("Please upload a purchase order to continue")); + showToast(translate("Please upload a valid purchase order csv to continue")); } else if (!review) { this.store.dispatch('order/updatedOrderList', this.orderItemsList); this.router.push({ From 0a5cb30015c94f03125fb1d2ce1dbbbbef3de2da Mon Sep 17 00:00:00 2001 From: Disha Talreja Date: Mon, 31 Oct 2022 11:51:16 +0530 Subject: [PATCH 08/12] Updated code(#24pp0fm) --- src/views/PurchaseOrder.vue | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/views/PurchaseOrder.vue b/src/views/PurchaseOrder.vue index c0831bb5..37dba0c5 100644 --- a/src/views/PurchaseOrder.vue +++ b/src/views/PurchaseOrder.vue @@ -92,11 +92,13 @@ export default defineComponent({ return { file: "", content: [], - orderIdField: "", - productSkuField: "", - dateField: "", - quantityField: "", - facilityField: "", + fields:{ + orderIdField: "", + productSkuField: "", + dateField: "", + quantityField: "", + facilityField: "", + }, orderItemsList: [], } }, From d1dc837b9c7cb828f98d42a731e6558829334483 Mon Sep 17 00:00:00 2001 From: Disha Talreja Date: Mon, 31 Oct 2022 13:17:13 +0530 Subject: [PATCH 09/12] Updated the code to map fields only if all the fields are selected(#24pp0fm) --- src/views/PurchaseOrder.vue | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/src/views/PurchaseOrder.vue b/src/views/PurchaseOrder.vue index 37dba0c5..2e9aaf65 100644 --- a/src/views/PurchaseOrder.vue +++ b/src/views/PurchaseOrder.vue @@ -121,21 +121,19 @@ export default defineComponent({ }) }, mapFields() { - this.orderItemsList = this.content.map(item => { - return { - orderId: item[this.fields.orderIdField], - shopifyProductSKU: item[this.fields.productSkuField], - arrivalDate: item[this.fields.dateField], - quantityOrdered: item[this.fields.quantityField], - externalFacilityId: item[this.fields.facilityField] - } - }) - const review = Object.values(this.fields).some(field => { - return field === ""; - }); + const areAllFieldsSelected = Object.values(this.fields).some(field => field === ""); if (this.content.length <= 0) { showToast(translate("Please upload a valid purchase order csv to continue")); - } else if (!review) { + } else if (!areAllFieldsSelected) { + this.orderItemsList = this.content.map(item => { + return { + orderId: item[this.fields.orderIdField], + shopifyProductSKU: item[this.fields.productSkuField], + arrivalDate: item[this.fields.dateField], + quantityOrdered: item[this.fields.quantityField], + externalFacilityId: item[this.fields.facilityField] + } + }) this.store.dispatch('order/updatedOrderList', this.orderItemsList); this.router.push({ name:'PurchaseOrderDetail' From 35a350d96a0237edc585c7562e5af7c2525ba225 Mon Sep 17 00:00:00 2001 From: Disha Talreja Date: Mon, 31 Oct 2022 13:20:29 +0530 Subject: [PATCH 10/12] Improved code(#24pp0fm) --- src/views/PurchaseOrder.vue | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/views/PurchaseOrder.vue b/src/views/PurchaseOrder.vue index 2e9aaf65..0afa1599 100644 --- a/src/views/PurchaseOrder.vue +++ b/src/views/PurchaseOrder.vue @@ -125,15 +125,13 @@ export default defineComponent({ if (this.content.length <= 0) { showToast(translate("Please upload a valid purchase order csv to continue")); } else if (!areAllFieldsSelected) { - this.orderItemsList = this.content.map(item => { - return { - orderId: item[this.fields.orderIdField], - shopifyProductSKU: item[this.fields.productSkuField], - arrivalDate: item[this.fields.dateField], - quantityOrdered: item[this.fields.quantityField], - externalFacilityId: item[this.fields.facilityField] - } - }) + this.orderItemsList = this.content.map(item => ({ + orderId: item[this.fields.orderIdField], + shopifyProductSKU: item[this.fields.productSkuField], + arrivalDate: item[this.fields.dateField], + quantityOrdered: item[this.fields.quantityField], + externalFacilityId: item[this.fields.facilityField] + })) this.store.dispatch('order/updatedOrderList', this.orderItemsList); this.router.push({ name:'PurchaseOrderDetail' From 4a257c008883640a2768987d26029a4af949a151 Mon Sep 17 00:00:00 2001 From: Disha Talreja Date: Mon, 31 Oct 2022 14:39:28 +0530 Subject: [PATCH 11/12] Improved variable name(#24pp0fm) --- src/views/PurchaseOrder.vue | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/views/PurchaseOrder.vue b/src/views/PurchaseOrder.vue index 0afa1599..fc3d818b 100644 --- a/src/views/PurchaseOrder.vue +++ b/src/views/PurchaseOrder.vue @@ -19,35 +19,35 @@ {{ $t("Select the column index for the following information in the uploaded CSV.") }} {{ $t("Order ID") }} - + {{ prop }} {{ $t("Shopify product SKU") }} - + {{ prop }} {{ $t("Arrival date") }} - + {{ prop }} {{ $t("Ordered quantity") }} - + {{ prop }} {{ $t("Facility ID") }} - + {{ prop }} @@ -93,11 +93,11 @@ export default defineComponent({ file: "", content: [], fields:{ - orderIdField: "", - productSkuField: "", - dateField: "", - quantityField: "", - facilityField: "", + orderId: "", + productSku: "", + date: "", + quantity: "", + facility: "", }, orderItemsList: [], } @@ -126,11 +126,11 @@ export default defineComponent({ showToast(translate("Please upload a valid purchase order csv to continue")); } else if (!areAllFieldsSelected) { this.orderItemsList = this.content.map(item => ({ - orderId: item[this.fields.orderIdField], - shopifyProductSKU: item[this.fields.productSkuField], - arrivalDate: item[this.fields.dateField], - quantityOrdered: item[this.fields.quantityField], - externalFacilityId: item[this.fields.facilityField] + orderId: item[this.fields.orderId], + shopifyProductSKU: item[this.fields.productSku], + arrivalDate: item[this.fields.date], + quantityOrdered: item[this.fields.quantity], + externalFacilityId: item[this.fields.facility] })) this.store.dispatch('order/updatedOrderList', this.orderItemsList); this.router.push({ From 43eab402a62621e9da4ab2ce64b8ed403b04db2f Mon Sep 17 00:00:00 2001 From: Disha Talreja Date: Mon, 31 Oct 2022 14:48:51 +0530 Subject: [PATCH 12/12] Updated condition to check whether all fields are selected(#24pp0fm) --- src/views/PurchaseOrder.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/views/PurchaseOrder.vue b/src/views/PurchaseOrder.vue index fc3d818b..cbc665f1 100644 --- a/src/views/PurchaseOrder.vue +++ b/src/views/PurchaseOrder.vue @@ -121,10 +121,10 @@ export default defineComponent({ }) }, mapFields() { - const areAllFieldsSelected = Object.values(this.fields).some(field => field === ""); + const areAllFieldsSelected = Object.values(this.fields).every(field => field !== ""); if (this.content.length <= 0) { showToast(translate("Please upload a valid purchase order csv to continue")); - } else if (!areAllFieldsSelected) { + } else if (areAllFieldsSelected) { this.orderItemsList = this.content.map(item => ({ orderId: item[this.fields.orderId], shopifyProductSKU: item[this.fields.productSku],