diff --git a/src/elements/traits/OrderElementTrait.php b/src/elements/traits/OrderElementTrait.php index 7538661a54..c966de7a20 100644 --- a/src/elements/traits/OrderElementTrait.php +++ b/src/elements/traits/OrderElementTrait.php @@ -301,7 +301,6 @@ protected static function defineSources(string $context = null): array 'label' => Craft::t('commerce', 'All Orders'), 'criteria' => ['isCompleted' => true], 'defaultSort' => ['dateOrdered', 'desc'], - 'badgeCount' => 0, 'data' => [ 'date-attr' => 'dateOrdered', ], @@ -320,7 +319,6 @@ protected static function defineSources(string $context = null): array 'label' => Craft::t('site', $orderStatus->name), 'criteria' => $criteriaStatus, 'defaultSort' => ['dateOrdered', 'desc'], - 'badgeCount' => 0, 'data' => [ 'handle' => $orderStatus->handle, 'date-attr' => 'dateOrdered', diff --git a/src/web/assets/commercecp/dist/commercecp.js b/src/web/assets/commercecp/dist/commercecp.js index 191221a30b..a15f50c7d5 100644 --- a/src/web/assets/commercecp/dist/commercecp.js +++ b/src/web/assets/commercecp/dist/commercecp.js @@ -1,2 +1,2 @@ -!function(){var t={528:function(){function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}!function(e){"undefined"===t(Craft.Commerce)&&(Craft.Commerce={}),Craft.Commerce.initUnlimitedStockCheckbox=function(t){t.find("input.unlimited-stock:first").change(Craft.Commerce.handleUnlimitedStockCheckboxChange)},Craft.Commerce.handleUnlimitedStockCheckboxChange=function(t){var n=e(t.currentTarget),a=n.parent().prevAll(".textwrapper:first").children(".text:first");n.prop("checked")?a.prop("disabled",!0).addClass("disabled").val(""):a.prop("disabled",!1).removeClass("disabled").focus()}}(jQuery)},322:function(){function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}"undefined"===t(Craft.Commerce)&&(Craft.Commerce={}),Craft.Commerce.OrderEdit=Garnish.Base.extend({orderId:null,paymentForm:null,paymentAmount:null,paymentCurrency:null,$makePayment:null,init:function(t){this.setSettings(t),this.orderId=this.settings.orderId,this.paymentForm=this.settings.paymentForm,this.paymentAmount=this.settings.paymentAmount,this.paymentCurrency=this.settings.paymentCurrency,this.$makePayment=$("#make-payment"),this.addListener(this.$makePayment,"click","makePayment"),Object.keys(this.paymentForm.errors).length>0&&this.openPaymentModal()},openPaymentModal:function(){this.paymentModal?this.paymentModal.show():this.paymentModal=new Craft.Commerce.PaymentModal({orderId:this.orderId,paymentForm:this.paymentForm,paymentAmount:this.paymentAmount,paymentCurrency:this.paymentCurrency})},makePayment:function(t){t.preventDefault(),this.openPaymentModal()},_getCountries:function(){return window.countries}},{defaults:{orderId:null,paymentForm:null,paymentAmount:null,paymentCurrency:null,$makePayment:null}})},588:function(){function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}"undefined"===t(Craft.Commerce)&&(Craft.Commerce={}),Craft.Commerce.OrderIndex=Craft.BaseElementIndex.extend({startDate:null,endDate:null,init:function(t,e,n){if(this.on("selectSource",$.proxy(this,"updateSelectedSource")),this.base(t,e,n),Craft.ui.createDateRangePicker({onChange:function(t,e){this.startDate=t,this.endDate=e,this.updateElements()}.bind(this)}).appendTo(this.$toolbar),window.orderEdit&&window.orderEdit.currentUserPermissions["commerce-editOrders"]){var a=$("",{class:"btn submit icon add",href:Craft.getUrl("commerce/orders/create"),text:Craft.t("commerce","New Order")});this.addButton(a)}},updateSelectedSource:function(){var t="all"!==(this.$source?this.$source:"all")?this.$source.data("handle"):null;if("index"===this.settings.context&&"undefined"!=typeof history){var e="commerce/orders";t&&(e+="/"+t),history.replaceState({},"",Craft.getUrl(e))}},getDefaultSourceKey:function(){var t=window.defaultStatusHandle;if(t)for(var e=0;e="+this.startDate.getTime()/1e3),this.endDate&&t.criteria[e].push("<"+(this.endDate.getTime()/1e3+86400))}return t},updateSourcesBadgeCounts:function(){$.ajax({url:Craft.getActionUrl("commerce/orders/get-index-sources-badge-counts"),type:"GET",dataType:"json",success:$.proxy((function(t){if(t.counts){var e=this.$sidebar;$.each(t.counts,(function(t,n){var a=e.find('nav a[data-key="orderStatus:'+n.handle+'"]');if(a){var s=a.find(".badge");s.length||(s=$('').appendTo(a)),a.find(".badge").text(n.orderCount)}}))}if(t.total){var n=this.$sidebar.find('nav a[data-key="*"]');if(n){var a=n.find(".badge");a.length||(a=$('').appendTo(n)),n.find(".badge").text(t.total)}}}),this)})},setIndexAvailable:function(){this.updateSourcesBadgeCounts(),this.base()}}),Craft.registerElementIndexClass("craft\\commerce\\elements\\Order",Craft.Commerce.OrderIndex)},255:function(){function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}"undefined"===t(Craft.Commerce)&&(Craft.Commerce={}),Craft.Commerce.PaymentModal=Garnish.Modal.extend({$container:null,$body:null,init:function(t){var e=this;this.$container=$("
",{id:"paymentmodal",class:"modal fitted loading"}).appendTo(Garnish.$bod),this.base(this.$container,$.extend({resizable:!1},t));var n={orderId:t.orderId,paymentForm:t.paymentForm,paymentAmount:t.paymentAmount,paymentCurrency:t.paymentCurrency};Craft.sendActionRequest("POST","commerce/orders/get-payment-modal",{data:n}).then((function(t){e.$container.removeClass("loading");var n=e;e.$container.append(t.data.modalHtml),Craft.appendHeadHtml(t.data.headHtml),Craft.appendFootHtml(t.data.footHtml);var a=$(".buttons",e.$container),s=$('
'+Craft.t("commerce","Cancel")+"
").prependTo(a);e.addListener(s,"click","cancelPayment"),$("select#payment-form-select").change($.proxy((function(t){var e=$(t.currentTarget).val();$(".gateway-form").addClass("hidden"),$("#gateway-"+e+"-form").removeClass("hidden"),setTimeout((function(){Craft.initUiElements(this.$container),n.updateSizeAndPosition()}),200)}),e)).trigger("change"),setTimeout((function(){Craft.initUiElements(this.$container),n.updateSizeAndPosition()}),200)})).catch((function(t){var n=t.response;e.$container.removeClass("loading");var a=Craft.t("commerce","An unknown error occurred.");n.data.message&&(a=n.data.message),e.$container.append('
'+a+"
")}))},cancelPayment:function(){this.hide()}},{})},166:function(){function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}"undefined"===t(Craft.Commerce)&&(Craft.Commerce={}),Craft.Commerce.ProductSalesModal=Garnish.Modal.extend({id:null,$newSale:null,$cancelBtn:null,$select:null,$saveBtn:null,$spinner:null,$purchasableCheckboxes:[],init:function(t,e){this.id=Math.floor(1e9*Math.random()),this.setSettings(e,this.defaults),this.$form=$('