Skip to content

Commit

Permalink
Merge pull request #331 from Mozu/feature/B2B-phase-2-fixes
Browse files Browse the repository at this point in the history
B2B phase 2 fixes
  • Loading branch information
Michael Sadlon authored Apr 29, 2021
2 parents f0f8b81 + 2376ab6 commit b051b97
Show file tree
Hide file tree
Showing 11 changed files with 88 additions and 24 deletions.
3 changes: 3 additions & 0 deletions labels/de-DE.json
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,7 @@
"quoteDiscount": "Rabatt",
"quoteDetails": "Angebotsdetails",
"quoteExpirationDate": "Haltbarkeitsdatum",
"quoteExpirationDateMsg": "Das Ablaufdatum sollte größer als heute sein.",
"quoteExpiredBuyerBlob1": "Bonjour, <br /> <br /> <br /> 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, <br /> <br /> <br /> le devis \"{0}\" (# {1}) a expiré le",
Expand All @@ -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",
Expand Down
3 changes: 3 additions & 0 deletions labels/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,7 @@
"quoteDiscount": "Discount",
"quoteDetails": "Quote Details",
"quoteExpirationDate": "Expiration Date",
"quoteExpirationDateMsg": "Expiration Date should be greater than today.",
"quoteExpiredBuyerBlob1": "Hi, <br /><br /><br /> Quote \"{0}\" (#{1}) has expired as of",
"quoteExpiredBuyerBlob2": "Please submit a new request or contact your sales representative for help",
"quoteExpiredSeller": "Hi, <br /><br /><br /> Quote \"{0}\" (#{1}) has expired as of",
Expand All @@ -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",
Expand Down
37 changes: 31 additions & 6 deletions scripts/modules/b2b-account/edit-quote.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -442,6 +452,7 @@ define([
});
}
else {
self.model.isLoading(false);
self.render();
}
},
Expand Down Expand Up @@ -613,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);
Expand All @@ -626,7 +638,12 @@ define([
self.render();
}
else {
self.exitQuote();
if (previousStatus == "Expired") {
window.location.reload();
}
else {
self.exitQuote();
}
}
}, function (error) {
self.showMessageBar(error);
Expand All @@ -638,7 +655,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);
Expand Down Expand Up @@ -902,7 +927,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);
}
Expand All @@ -924,7 +949,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);
}
Expand Down
5 changes: 2 additions & 3 deletions scripts/modules/b2b-account/view-quote.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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);
}
Expand Down
3 changes: 3 additions & 0 deletions scripts/modules/models-checkout.js
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,9 @@
this.isLoading(true);
var order = this.getOrder();
if (order) {
// Don't update fulfillment info if order is created from a quote.
if (order.get('originalQuoteId')) return false;

order.apiModel.update({ fulfillmentInfo: me.toJSON() })
.then(function (o) {
var billingInfo = me.parent.get('billingInfo');
Expand Down
2 changes: 1 addition & 1 deletion scripts/modules/xpress-paypal.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function($, Api, CartModels, hyprlivecontext, _) {
environment: environment.value,
click: function(event) {
event.preventDefault();
var url = "../paypal/token?id=" + id + (!document.URL.split('?')[1] ? "": "&" + document.URL.split('?')[1].replace("id="+id,"").replace("&&", "&"));
var url = window.location.protocol + "//" + window.location.host + "/paypal/token?id=" + id + (!document.URL.split('?')[1] ? "": "&" + document.URL.split('?')[1].replace("id="+id,"").replace("&&", "&"));
if (isCart)
url += "&isCart="+ isCart;
window.paypal.checkout.initXO();
Expand Down
10 changes: 8 additions & 2 deletions stylesheets/modules/b2b-account/quotes.less
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@
display:inline;
}
}
.view-quote-form {
#view-quote-summary,.view-quote-form {
.quote-details-section {
.mz-contact-actions {
float: right;
Expand Down Expand Up @@ -653,7 +653,7 @@
}
}
.adjustment-row-2 td:first-child {
width: 230px;
width: 230px;
}
}
.grand-total {
Expand Down Expand Up @@ -847,4 +847,10 @@

.mz-discount-name {
font-weight: normal;
}
.mz-revive-btn {
margin-right: 1%
}
.mz-revive-alert {
color: red;
}
29 changes: 26 additions & 3 deletions templates/modules/b2b-account/quotes/edit-quote.hypr.live
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,17 @@
<h2 class="quote-name">
{{model.name}} {% if model.isDraft == true %} ({{labels.draft}}) {% endif %}
<button class="mz-button" data-mz-action="exitQuote">{{labels.exitQuote}}</button>

{% if model.isSalesRep==true and model.status=="Expired" %}
<button class="mz-button mz-revive-btn" data-mz-action="reviveQuote">{{labels.quoteRevive}}</button>
{% endif %}
</h2>
<div class="modal fade" id="mz-location-selector">
{% if model.isSalesRep==true and model.status=="Expired" %}
<h4 class="quote-name mz-revive-alert">{{labels.quoteReviveAlert}}</h4>
{% endif %}


<div class="modal fade" id="mz-location-selector">
{% include "modules/cart/cart-location-select" %}
</div>
<ul class="mz-orderlist edit-quote-form">
Expand All @@ -14,15 +23,29 @@
{% include "modules/b2b-account/quotes/edit-quote/quote-details" with model=model %}
</li>
<li>
{% if model.isSalesRep==true and model.status=="Expired" %}
<div id="view-quote-summary">
{% include "modules/b2b-account/quotes/view-quote/quote-summary" with model=model %}
<div>
{% else %}
{% include "modules/b2b-account/quotes/edit-quote/quote-summary" with model=model %}
{% endif %}
</li>
{% if model.isShippable %}
<li>
{% include "modules/b2b-account/quotes/edit-quote/quote-shipping" with model=model %}
{% if model.isSalesRep==true and model.status=="Expired" %}
{% include "modules/b2b-account/quotes/view-quote/quote-shipping" with model=model %}
{% else %}
{% include "modules/b2b-account/quotes/edit-quote/quote-shipping" with model=model %}
{% endif %}
</li>
{% endif %}
<li>
{% include "modules/b2b-account/quotes/edit-quote/quote-comments" with model=model %}
{% if model.isSalesRep==true and model.status=="Expired" %}
{% include "modules/b2b-account/quotes/view-quote/quote-comments" with model=model %}
{% else %}
{% include "modules/b2b-account/quotes/edit-quote/quote-comments" with model=model %}
{% endif %}
</li>
<li>
{% include "modules/b2b-account/quotes/quote-history" with model=model %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<b>{{labels.quoteName}}:</b>
</dt>
<dd>
{% if model.isEditQuoteName==true %}
{% if model.isEditQuoteName==true and model.status != "Expired" %}
<input type="text" id="quoteName" />
<span>
<button class="mz-button mz-button" data-mz-action="updateQuoteName">{{labels.save}}</button> &nbsp;&nbsp;&nbsp;
Expand All @@ -36,7 +36,9 @@
{% else %}
{{model.name}}
<span>
<img src="/resources/images/edit.png" data-mz-action="startEditingQuoteName" />
{% if model.status != "Expired" %}
<img src="/resources/images/edit.png" data-mz-action="startEditingQuoteName" />
{% endif %}
</span>
{% endif %}

Expand All @@ -53,7 +55,7 @@
<b>{{labels.createdBy}}:</b>
</dt>
<dd>
{% if model.isEditSubmittedBy==true and model.isSalesRep==true and model.status=="Pending" %}
{% if model.isEditSubmittedBy==true and model.isSalesRep==true and model.status=="Pending" and model.status!="Expired" %}
<select id="submittedBy">
{% for user in model.b2bUsers %}
<option value="{{user.userId}}" {% if user.userId==model.userId %} selected {% endif %}>{{user.firstName}} {{user.lastName}}</option>
Expand All @@ -65,7 +67,7 @@
</span>
{% else %}
{{ model.fullName }}
{% if model.isSalesRep==true and model.status=="Pending" %}
{% if model.isSalesRep==true and model.status=="Pending" and model.status!="Expired" %}
<span>
<img src="/resources/images/edit.png" data-mz-action="startEditingSubmittedBy" />
</span>
Expand Down
4 changes: 2 additions & 2 deletions templates/modules/checkout/payment-selector.hypr.live
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
{% endif %}
</div>
{% endif %}
{% if model.originalQuoteId == "" %}

{% with siteContext.checkoutSettings.externalPaymentWorkflowSettings|findwhere("isEnabled", true) as externalPaymentWorkflowsEnabled %}
{% if externalPaymentWorkflowsEnabled %}
<div class="mz-l-formfieldgroup-row">
Expand Down Expand Up @@ -130,7 +130,7 @@
{% endfor %}
{% endif %}
{% endwith %}
{% endif %}

<div class="mz-l-formfieldgroup-row mz-paymentselector-validation">
<div class="mz-formfieldgroup-cell">
</div>
Expand Down
6 changes: 3 additions & 3 deletions templates/modules/checkout/step-payment-info.hypr.live
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
</div>
{% endif %}

{% if model.originalQuoteId == "" %}

{% if payment.billingInfo.paymentType|lower == "paypalexpress2" || payment.paymentType|lower == "token" || payment.paymentType|lower == "paywithamazon" %}
{% if model.nonStoreCreditOrGiftCardTotal > 0%}
{%if model.isExternalCheckoutFlowComplete%}
Expand Down Expand Up @@ -114,9 +114,9 @@
{%endif%}

{% endif %}
{% endif %}

{% endfor %}



<div class="mz-l-stack-section mz-paymentselector-separator mz-checkoutform">
<p>
Expand Down

0 comments on commit b051b97

Please sign in to comment.