Skip to content
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: Job's time difference from next scheduled time in the Product Detail Page in timeline section (#192) #193

Merged
merged 7 commits into from
Sep 5, 2023
3 changes: 2 additions & 1 deletion src/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,8 @@
"Release preorder to a warehouse": "Release preorder to a warehouse",
"Release preorders to a warehouse": "Release preorders to a warehouse",
"Release to a warehouse": "Release to a warehouse",
"Removing from in": "Removing from {categoryName} in {removeTime}",
"Removing from": "Removing from {categoryName} {removeTime}",
"Removed from": "Removed from {categoryName} {removeTime}",
"Removed from category": "Removed from category",
"Removed from category on because there is no active PO but still listed on stores": "Removed from {category} category on {changeDatetime} because there is no active PO but still listed on {listedCount} stores",
"Reserve inventory": "Reserve inventory",
Expand Down
9 changes: 7 additions & 2 deletions src/views/catalog-product-details.vue
Original file line number Diff line number Diff line change
Expand Up @@ -881,7 +881,8 @@ export default defineComponent({
if (Object.keys(presellingJob).length === 0 || !presellingJob.runTime) {
this.poSummary.header = this.$t("Pre-sell processing disabled");
} else {
this.poSummary.header = this.$t("Removing from in", { categoryName, addingTime: this.timeTillJob(presellingJob.runTime) });
const headerMessage = this.isPastTime(presellingJob.runTime) ? "Removed from" : "Removing from";
this.poSummary.header = this.$t(headerMessage, { categoryName, removeTime: this.timeTillJob(presellingJob.runTime) });
}
if (this.atpCalcDetails.onlineAtp > 0) {
this.poSummary.body = this.$t("This product will be removed from because it is in stock", { categoryName });
Expand Down Expand Up @@ -1075,6 +1076,10 @@ export default defineComponent({
}
return externalId;
},
isPastTime(time: number) {
const timeDiff: any = DateTime.fromMillis(time).diff(DateTime.local());
return timeDiff.values.milliseconds <= 0;
},
async copyAuditMsg() {
const { Clipboard } = Plugins;
const auditMsg = this.poSummary.header + '\n' + this.poSummary.body
Expand All @@ -1084,7 +1089,7 @@ export default defineComponent({
}).then(() => {
showToast(this.$t("Copied to clipboard"));
})
},
}
},
setup() {
const store = useStore();
Expand Down
Loading