From e924e87dc56c2997101df123f646f809462629db Mon Sep 17 00:00:00 2001 From: Rajesh D <32330565+rajeshdatir@users.noreply.github.com> Date: Thu, 29 Apr 2021 06:20:07 +0530 Subject: [PATCH 1/4] COM-3585 B2B P2: Refresh Edit Quote page after discarding changes (#320) When discarding changes on the Edit Quote page automatically refresh the Quote model from the API and re-render the page. Co-authored-by: RajeshDatir --- scripts/modules/b2b-account/edit-quote.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/scripts/modules/b2b-account/edit-quote.js b/scripts/modules/b2b-account/edit-quote.js index b17718748..65ce1b782 100644 --- a/scripts/modules/b2b-account/edit-quote.js +++ b/scripts/modules/b2b-account/edit-quote.js @@ -442,6 +442,7 @@ define([ }); } else { + self.model.isLoading(false); self.render(); } }, @@ -638,7 +639,15 @@ define([ id: self.model.get('id'), draft: true }; - return this.model.apiDelete(data).then(function (response) { + return this.model.apiDelete(data).then(function () { + self.model.set("adjustment", null); + self.model.set("handlingAdjustment", null); + self.model.set("shippingAdjustment", null); + self.model.set("quoteUpdatedAdjustments", null); + self.model.set('fullName', ''); + self.populateWithUsers();//Set intial creator of the quote + self.model.set('name', ''); + self.model.set('expirationDate', ''); self.refreshQuote(); }, function (error) { self.showMessageBar(error); From 391c09d62ac020e0d2d1ae99e2f01b1f312ba73e Mon Sep 17 00:00:00 2001 From: Michael Sadlon Date: Wed, 28 Apr 2021 20:21:07 -0500 Subject: [PATCH 2/4] Revert "COM-3484 B2B P2: Fix local time zone issues (#312)" The fix incorrectly changed the underlying data instead of just converting the time for display purposes. This reverts commit e86b324c107aed1c6b879f4dd74b1ca277dc74ea. --- scripts/modules/b2b-account/edit-quote.js | 4 ++-- scripts/modules/b2b-account/view-quote.js | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/scripts/modules/b2b-account/edit-quote.js b/scripts/modules/b2b-account/edit-quote.js index 65ce1b782..a1944a1dd 100644 --- a/scripts/modules/b2b-account/edit-quote.js +++ b/scripts/modules/b2b-account/edit-quote.js @@ -911,7 +911,7 @@ define([ } } //Need this for hypr filters. Hypr filter not working on complex/nested objects. - comments[c].createDate = new Date(comments[c].auditInfo.createDate).toLocaleDateString(); + comments[c].createDate = comments[c].auditInfo.createDate; } this.model.set('comments', comments); } @@ -933,7 +933,7 @@ define([ } } //Need this for hypr filters. Hypr filter not working on complex/nested objects. - auditHistory[a].createDate = new Date(auditHistory[a].auditInfo.createDate).toLocaleDateString(); + auditHistory[a].createDate = auditHistory[a].auditInfo.createDate; } this.model.set('auditHistory', auditHistory); } diff --git a/scripts/modules/b2b-account/view-quote.js b/scripts/modules/b2b-account/view-quote.js index 489dee3c5..6034d7867 100644 --- a/scripts/modules/b2b-account/view-quote.js +++ b/scripts/modules/b2b-account/view-quote.js @@ -340,8 +340,7 @@ define([ } } //Need this for hypr filters. Hypr filter not working on complex/nested objects. - comments[c].createDate = new Date(comments[c].auditInfo.createDate).toLocaleDateString(); - + comments[c].createDate = comments[c].auditInfo.createDate; } this.model.set('comments', comments); } @@ -361,7 +360,7 @@ define([ } } //Need this for hypr filters. Hypr filter not working on complex/nested objects. - auditHistory[a].createDate = new Date(auditHistory[a].auditInfo.createDate).toLocaleDateString(); + auditHistory[a].createDate = auditHistory[a].auditInfo.createDate; } this.model.set('auditHistory', auditHistory); } From 183568903736eeb81e28d09602f48b3078fb157a Mon Sep 17 00:00:00 2001 From: Rajesh D <32330565+rajeshdatir@users.noreply.github.com> Date: Thu, 29 Apr 2021 06:58:25 +0530 Subject: [PATCH 3/4] COM-3313 B2B P2: Support reviving expired quotes (#323) A seller can now revive an expired quote. When editing a quote in the Expired status the Expiration Date can be changed to a future date. No other fields are editable. After editing the expiration date the seller can submit the changes and move the quote back to the In Review status. Co-authored-by: RajeshDatir --- labels/de-DE.json | 3 ++ labels/en-US.json | 3 ++ scripts/modules/b2b-account/edit-quote.js | 22 ++++++++++++-- stylesheets/modules/b2b-account/quotes.less | 10 +++++-- .../b2b-account/quotes/edit-quote.hypr.live | 29 +++++++++++++++++-- .../quotes/edit-quote/quote-details.hypr.live | 10 ++++--- 6 files changed, 65 insertions(+), 12 deletions(-) diff --git a/labels/de-DE.json b/labels/de-DE.json index edd7275d5..cefb04104 100644 --- a/labels/de-DE.json +++ b/labels/de-DE.json @@ -496,6 +496,7 @@ "quoteDiscount": "Rabatt", "quoteDetails": "Angebotsdetails", "quoteExpirationDate": "Haltbarkeitsdatum", + "quoteExpirationDateMsg": "Das Ablaufdatum sollte größer als heute sein.", "quoteExpiredBuyerBlob1": "Bonjour,


le devis \"{0}\" (# {1}) a expiré le", "quoteExpiredBuyerBlob2": "Bitte senden Sie eine neue Anfrage oder wenden Sie sich an Ihren Vertriebsmitarbeiter, um Hilfe zu erhalten", "quoteExpiredSeller": "Bonjour,


le devis \"{0}\" (# {1}) a expiré le", @@ -506,6 +507,8 @@ "quoteName": "Zitat Name", "quoteNumber": "Angebotsnummer", "quotePrint": "Angebot drucken", + "quoteRevive": "Zitat wiederbeleben", + "quoteReviveAlert": "Le devis est expiré. Veuillez mettre à jour la date d'expiration en cliquant sur Revive Quote.", "quoteShippingAddress": "Lieferanschrift", "quoteSummary": "Zitat Zusammenfassung", "quotes": "Zitate", diff --git a/labels/en-US.json b/labels/en-US.json index 1b7e588f5..53f34827e 100644 --- a/labels/en-US.json +++ b/labels/en-US.json @@ -602,6 +602,7 @@ "quoteDiscount": "Discount", "quoteDetails": "Quote Details", "quoteExpirationDate": "Expiration Date", + "quoteExpirationDateMsg": "Expiration Date should be greater than today.", "quoteExpiredBuyerBlob1": "Hi,


Quote \"{0}\" (#{1}) has expired as of", "quoteExpiredBuyerBlob2": "Please submit a new request or contact your sales representative for help", "quoteExpiredSeller": "Hi,


Quote \"{0}\" (#{1}) has expired as of", @@ -612,6 +613,8 @@ "quoteName": "Quote Name", "quoteNumber": "Quote Number", "quotePrint": "Print Quote", + "quoteRevive": "Revive Quote", + "quoteReviveAlert": "Quote is expired. Please update the expiration date by clicking Revive Quote.", "quotes": "Quotes", "quoteShippingAddress": "Shipping Address", "quoteSummary": "Quote Summary", diff --git a/scripts/modules/b2b-account/edit-quote.js b/scripts/modules/b2b-account/edit-quote.js index a1944a1dd..b75325e19 100644 --- a/scripts/modules/b2b-account/edit-quote.js +++ b/scripts/modules/b2b-account/edit-quote.js @@ -406,22 +406,32 @@ define([ expirationDate = new Date(expirationDate); if (expirationDate > today) { + self.model.set("error", null); self.model.set('expirationDate', expirationDate); self.model.set("isEditExpirationDate", false); - self.updateQuote(); + if (self.model.apiModel.data.status == "Expired") { + self.updateQuote(applyAndCommit); + } else { + self.updateQuote(); + } } else { self.showMessageBar({ - message: 'Expiration Date should be greater than today.' + message: Hypr.getLabel("quoteExpirationDateMsg") }); } } }, cancelExpirationDateUpdate: function () { var self = this; + self.model.set("error", null); self.model.set("isEditExpirationDate", false); self.render(); }, + reviveQuote: function () { + var self = this; + self.startEditingExpirationDate(); + }, startEditingSubmittedBy: function () { var self = this; self.model.isLoading(true); @@ -614,6 +624,7 @@ define([ self.model.set('updatemode', updateMode); self.model.isLoading(true); + var previousStatus = self.model.apiModel.data.status; return this.model.apiUpdate().then(function (response) { if (updateMode === applyToDraft) { self.model.isLoading(false); @@ -627,7 +638,12 @@ define([ self.render(); } else { - self.exitQuote(); + if (previousStatus == "Expired") { + window.location.reload(); + } + else { + self.exitQuote(); + } } }, function (error) { self.showMessageBar(error); diff --git a/stylesheets/modules/b2b-account/quotes.less b/stylesheets/modules/b2b-account/quotes.less index 9d1dd33ab..8fe258c72 100644 --- a/stylesheets/modules/b2b-account/quotes.less +++ b/stylesheets/modules/b2b-account/quotes.less @@ -350,7 +350,7 @@ display:inline; } } -.view-quote-form { +#view-quote-summary,.view-quote-form { .quote-details-section { .mz-contact-actions { float: right; @@ -653,7 +653,7 @@ } } .adjustment-row-2 td:first-child { - width: 230px; + width: 230px; } } .grand-total { @@ -847,4 +847,10 @@ .mz-discount-name { font-weight: normal; +} +.mz-revive-btn { + margin-right: 1% +} +.mz-revive-alert { + color: red; } \ No newline at end of file diff --git a/templates/modules/b2b-account/quotes/edit-quote.hypr.live b/templates/modules/b2b-account/quotes/edit-quote.hypr.live index be18fc96a..fbe69cc4e 100644 --- a/templates/modules/b2b-account/quotes/edit-quote.hypr.live +++ b/templates/modules/b2b-account/quotes/edit-quote.hypr.live @@ -2,8 +2,17 @@

{{model.name}} {% if model.isDraft == true %} ({{labels.draft}}) {% endif %} + + {% if model.isSalesRep==true and model.status=="Expired" %} + + {% endif %}

-