-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed: SAVE MAPPING button saves empty mapping when file not uploaded(#326re7p) #114
Conversation
src/views/PurchaseOrder.vue
Outdated
@@ -133,11 +133,20 @@ export default defineComponent({ | |||
return !this.fieldMappings[id] ? id : this.generateUniqueMappingPrefId(); | |||
}, | |||
saveMapping() { | |||
if (this.mappingName) { | |||
if (this.mappingName && this.file && this.areAllFieldsSelected()) { | |||
showToast(translate("Mapping saved successfully")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should after the operation completion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes sir. Fixed it
src/views/PurchaseOrder.vue
Outdated
const mappingPrefId = this.generateUniqueMappingPrefId(); | ||
this.store.dispatch('user/updateFieldMappings', { mappingPrefId, mappingPrefName: this.mappingName, mappingPrefValue: JSON.parse(JSON.stringify(this.fieldMapping)) }) | ||
} else { | ||
showToast(translate("Enter mapping name")); | ||
if(!this.mappingName) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could add these conditions at the top and return control, if they are fulfilled. The code if then doesn't need any if else
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done sir.
@@ -198,6 +207,9 @@ export default defineComponent({ | |||
this.mappingName = fieldMapping.mappingPrefName; | |||
} | |||
}, | |||
areAllFieldsSelected() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could use it for other use cases in the page
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes sir.
… name, earlier we were having two checks for missing mapping name, imcomplete field mapping or missing file upload in IF & ELSE block, now optimised code to do it in a single scope(#326re7p)
6269e09
to
48f9f17
Compare
…tive logic on PurchaseOrder page(#326re7p)
…s called earlier without using this(#326re7p)
Related Issues
Closes #110
Short Description and Why It's Useful
Now user can only save mapping if file is uploaded, a mapping name is provided & all fields are selected.
Screenshots of Visual Changes before/after (If There Are Any)
Screen.Recording.2022-12-05.at.12.25.02.PM.mov
IMPORTANT NOTICE - Remember to add changelog entry
Contribution and Currently Important Rules Acceptance