-
Notifications
You must be signed in to change notification settings - Fork 33
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
Implemented functionality to save auto cancel days(#2cxr1cx) #218
Merged
Merged
Changes from 6 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
fcbd440
Implemented: functionality to save auto cancel days (#2cxr1cx)
rathoreprashant 3de00c4
Implemented: code to get and populate auto cancel days and apply erro…
rathoreprashant 50a7c4b
Implemented: checks to handle error case and used getter to get curre…
rathoreprashant b0eba69
Fixed: indentation (#2cxr1cx)
rathoreprashant a60ca0b
Implemented a separate method for fetching auto cancel days(#2cxr1cx)
disha1202 95779e9
Updated: code to update auto cancel days only when value is changed(#…
disha1202 306250b
Improved: Implemented code to skip api call if product store is none(…
disha1202 4118270
Display toast while updating auto cancel days if none product store s…
disha1202 171bd18
Updated variable name, toast and disabled save button if auto cancel …
disha1202 0af8a6d
Improved variable name and code(#2cxr1cx)
disha1202 695553b
Updated code and added comments(#2cxr1cx)
disha1202 9475c0f
Reverted unwanted changes(#2cxr1cx)
disha1202 007a8c0
Fixed: auto cancel days value not updated in case of error(#2cxr1cx)
disha1202 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -82,7 +82,10 @@ | |
</ion-card-header> | ||
<ion-item> | ||
<ion-label class="ion-text-wrap">{{ $t("Days") }}</ion-label> | ||
<ion-input :placeholder="$t('before auto cancelation')" /> | ||
<ion-input :placeholder="$t('before auto cancelation')" v-model.number="updatedAutoCancelDays" type="number" /> | ||
<ion-button fill="clear" @click="updateAutoCancelDays()" slot="end"> | ||
{{ $t("Save") }} | ||
</ion-button> | ||
</ion-item> | ||
<ion-item> | ||
<ion-label class="ion-text-wrap">{{ $t("Check daily") }}</ion-label> | ||
|
@@ -183,6 +186,7 @@ import JobConfiguration from '@/components/JobConfiguration.vue'; | |
import { DateTime } from 'luxon'; | ||
import { hasError, isFutureDate, showToast } from '@/utils'; | ||
import emitter from '@/event-bus'; | ||
import { JobService } from '@/services/JobService' | ||
|
||
export default defineComponent({ | ||
name: 'Orders', | ||
|
@@ -220,7 +224,9 @@ export default defineComponent({ | |
currentJobStatus: '', | ||
freqType: '', | ||
isJobDetailAnimationCompleted: false, | ||
isDesktop: isPlatform('desktop') | ||
isDesktop: isPlatform('desktop'), | ||
autoCancelDays: '', | ||
updatedAutoCancelDays: '' | ||
} | ||
}, | ||
computed: { | ||
|
@@ -274,6 +280,26 @@ export default defineComponent({ | |
await this.store.dispatch('webhook/unsubscribeWebhook', { webhookId: webhook?.id, shopifyConfigId: this.shopifyConfigId }) | ||
} | ||
}, | ||
async updateAutoCancelDays(){ | ||
if(this.autoCancelDays != this.updatedAutoCancelDays){ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should check if selected product store is not the None while setting and getting There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Made the requested change. |
||
const payload = { | ||
'productStoreId': this.currentEComStore.productStoreId, | ||
'daysToCancelNonPay': this.updatedAutoCancelDays | ||
} | ||
try { | ||
const resp = await JobService.updateAutoCancelDays(payload); | ||
if (resp.status === 200 && !hasError(resp)) { | ||
showToast(translate("Auto cancel days updated")); | ||
this.autoCancelDays = this.updatedAutoCancelDays; | ||
} else { | ||
showToast(translate("Unable to edit auto cancel days")); | ||
} | ||
} catch (err) { | ||
showToast(translate('Something went wrong')) | ||
console.error(err) | ||
} | ||
} | ||
}, | ||
async addBatch() { | ||
const batchmodal = await modalController.create({ | ||
component: BatchModal | ||
|
@@ -408,9 +434,30 @@ export default defineComponent({ | |
] | ||
}); | ||
return jobAlert.present(); | ||
}, | ||
async getAutoCancelDays(){ | ||
const payload = { | ||
"inputFields": { | ||
'productStoreId': this.currentEComStore.productStoreId, | ||
}, | ||
"fieldList": [ 'daysToCancelNonPay' ], | ||
"entityName": "ProductStore", | ||
"noConditionFind": "Y" | ||
} | ||
try { | ||
const resp = await JobService.getAutoCancelDays(payload); | ||
if (resp.status === 200 && !hasError(resp) && resp.data.docs?.length > 0 ) { | ||
this.autoCancelDays = resp.data.docs[0].daysToCancelNonPay; | ||
this.updatedAutoCancelDays = resp.data.docs[0].daysToCancelNonPay; | ||
} else { | ||
console.error(resp) | ||
} | ||
} catch (err) { | ||
console.error(err) | ||
} | ||
} | ||
}, | ||
mounted () { | ||
async mounted () { | ||
ymaheshwari1 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
this.store.dispatch("job/fetchJobs", { | ||
"inputFields":{ | ||
"systemJobEnumId": Object.values(this.jobEnums), | ||
|
@@ -424,6 +471,7 @@ export default defineComponent({ | |
} | ||
}); | ||
this.store.dispatch('webhook/fetchWebhooks') | ||
this.getAutoCancelDays(); | ||
}, | ||
setup() { | ||
const store = useStore(); | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I think we could have variable names as
autoCancelDays
andcurrentAutoCancelDays
. Also, instead of checking in update method we should either disable the save button if both the values are sameThere 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.
Made the requested change.