From 369afeffba6989b1eca3792bf9d605b0508f7af6 Mon Sep 17 00:00:00 2001 From: R-Sourabh Date: Wed, 11 Dec 2024 15:39:52 +0530 Subject: [PATCH 1/2] Fixed: Disable upload button until all required fields are mapped correctly(#533) --- src/views/BulkUpload.vue | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/views/BulkUpload.vue b/src/views/BulkUpload.vue index b0868a3e..7bef4044 100644 --- a/src/views/BulkUpload.vue +++ b/src/views/BulkUpload.vue @@ -58,7 +58,7 @@ - + {{ translate("Upload") }} @@ -130,6 +130,7 @@ let fieldMapping = ref({}) let fileColumns = ref([]) let selectedMappingId = ref(null) const fileUploaded = ref(false); +const isUploadDisabled = ref(true); const fields = process.env["VUE_APP_MAPPING_INVCOUNT"] ? JSON.parse(process.env["VUE_APP_MAPPING_INVCOUNT"]) : {} @@ -288,8 +289,12 @@ function mapFields(mapping, mappingId) { const missingFields = Object.values(fieldMappingData.value).filter(field => { if(!csvFields.includes(field)) return field; }); - - if(missingFields.length) showToast(translate("Some of the mapping fields are missing in the CSV: ", { missingFields: missingFields.join(", ") })) + if(missingFields.length) { + isUploadDisabled.value = true + showToast(translate("Some of the mapping fields are missing in the CSV: ", { missingFields: missingFields.join(", ") })) + } else { + isUploadDisabled.value = false; + } Object.keys(fieldMappingData).map((key) => { if(!csvFields.includes(fieldMappingData.value[key])){ From 5cca610815ed0be27913371f8adf0de05b6a35af Mon Sep 17 00:00:00 2001 From: R-Sourabh Date: Thu, 12 Dec 2024 12:29:04 +0530 Subject: [PATCH 2/2] Fixed: field mapping iteration by accessing nested 'value' property on fieldMappingData(#533) --- src/views/BulkUpload.vue | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/views/BulkUpload.vue b/src/views/BulkUpload.vue index 7bef4044..9047db22 100644 --- a/src/views/BulkUpload.vue +++ b/src/views/BulkUpload.vue @@ -58,7 +58,7 @@ - + {{ translate("Upload") }} @@ -130,7 +130,6 @@ let fieldMapping = ref({}) let fileColumns = ref([]) let selectedMappingId = ref(null) const fileUploaded = ref(false); -const isUploadDisabled = ref(true); const fields = process.env["VUE_APP_MAPPING_INVCOUNT"] ? JSON.parse(process.env["VUE_APP_MAPPING_INVCOUNT"]) : {} @@ -289,14 +288,9 @@ function mapFields(mapping, mappingId) { const missingFields = Object.values(fieldMappingData.value).filter(field => { if(!csvFields.includes(field)) return field; }); - if(missingFields.length) { - isUploadDisabled.value = true - showToast(translate("Some of the mapping fields are missing in the CSV: ", { missingFields: missingFields.join(", ") })) - } else { - isUploadDisabled.value = false; - } + if(missingFields.length) showToast(translate("Some of the mapping fields are missing in the CSV: ", { missingFields: missingFields.join(", ") })) - Object.keys(fieldMappingData).map((key) => { + Object.keys(fieldMappingData.value).map((key) => { if(!csvFields.includes(fieldMappingData.value[key])){ fieldMappingData.value[key] = ""; }