2 lines
24 KiB
JavaScript
2 lines
24 KiB
JavaScript
/*! For license information please see cart-page-container.js.LICENSE.txt */
|
|
(()=>{"use strict";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(){e=function(){return r};var r={},n=Object.prototype,o=n.hasOwnProperty,i=Object.defineProperty||function(t,e,r){t[e]=r.value},a="function"==typeof Symbol?Symbol:{},c=a.iterator||"@@iterator",u=a.asyncIterator||"@@asyncIterator",s=a.toStringTag||"@@toStringTag";function l(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,r){return t[e]=r}}function h(t,e,r,n){var o=e&&e.prototype instanceof d?e:d,a=Object.create(o.prototype),c=new O(n||[]);return i(a,"_invoke",{value:L(t,r,c)}),a}function p(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}r.wrap=h;var f={};function d(){}function y(){}function v(){}var m={};l(m,c,(function(){return this}));var g=Object.getPrototypeOf,w=g&&g(g(k([])));w&&w!==n&&o.call(w,c)&&(m=w);var b=v.prototype=d.prototype=Object.create(m);function x(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function S(e,r){function n(i,a,c,u){var s=p(e[i],e,a);if("throw"!==s.type){var l=s.arg,h=l.value;return h&&"object"==t(h)&&o.call(h,"__await")?r.resolve(h.__await).then((function(t){n("next",t,c,u)}),(function(t){n("throw",t,c,u)})):r.resolve(h).then((function(t){l.value=t,c(l)}),(function(t){return n("throw",t,c,u)}))}u(s.arg)}var a;i(this,"_invoke",{value:function(t,e){function o(){return new r((function(r,o){n(t,e,r,o)}))}return a=a?a.then(o,o):o()}})}function L(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return j()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=P(a,r);if(c){if(c===f)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=p(t,e,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===f)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}function P(t,e){var r=e.method,n=t.iterator[r];if(void 0===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=void 0,P(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),f;var o=p(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,f;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function E(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function O(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function k(t){if(t){var e=t[c];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,n=function e(){for(;++r<t.length;)if(o.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return n.next=n}}return{next:j}}function j(){return{value:void 0,done:!0}}return y.prototype=v,i(b,"constructor",{value:v,configurable:!0}),i(v,"constructor",{value:y,configurable:!0}),y.displayName=l(v,s,"GeneratorFunction"),r.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===y||"GeneratorFunction"===(e.displayName||e.name))},r.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,v):(t.__proto__=v,l(t,s,"GeneratorFunction")),t.prototype=Object.create(b),t},r.awrap=function(t){return{__await:t}},x(S.prototype),l(S.prototype,u,(function(){return this})),r.AsyncIterator=S,r.async=function(t,e,n,o,i){void 0===i&&(i=Promise);var a=new S(h(t,e,n,o),i);return r.isGeneratorFunction(e)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(b),l(b,s,"Generator"),l(b,c,(function(){return this})),l(b,"toString",(function(){return"[object Generator]"})),r.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},r.values=k,O.prototype={constructor:O,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(_),!t)for(var e in this)"t"===e.charAt(0)&&o.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n],a=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var c=o.call(i,"catchLoc"),u=o.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return r(i.catchLoc,!0);if(this.prev<i.finallyLoc)return r(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return r(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return r(i.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,f):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),f},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),_(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;_(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:k(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},r}function r(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function n(){var t;return t=e().mark((function t(){var r,n,o,i,a=arguments;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=a.length>0&&void 0!==a[0]?a[0]:{},window.Lara.auth.status){t.next=3;break}return t.abrupt("return",[]);case 3:return n=new URLSearchParams(r).toString(),o="".concat(window.Lara.routes.user.carts,"?").concat(n),t.next=7,fetch(o,{headers:{"Content-Type":"application/json"}});case 7:return i=t.sent,t.next=10,i.json();case 10:return t.abrupt("return",t.sent);case 11:case"end":return t.stop()}}),t)})),n=function(){var e=this,n=arguments;return new Promise((function(o,i){var a=t.apply(e,n);function c(t){r(a,o,i,c,u,"next",t)}function u(t){r(a,o,i,c,u,"throw",t)}c(void 0)}))},n.apply(this,arguments)}function o(t){return o="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},o(t)}function i(){i=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n=Object.defineProperty||function(t,e,r){t[e]=r.value},a="function"==typeof Symbol?Symbol:{},c=a.iterator||"@@iterator",u=a.asyncIterator||"@@asyncIterator",s=a.toStringTag||"@@toStringTag";function l(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,r){return t[e]=r}}function h(t,e,r,o){var i=e&&e.prototype instanceof d?e:d,a=Object.create(i.prototype),c=new O(o||[]);return n(a,"_invoke",{value:L(t,r,c)}),a}function p(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=h;var f={};function d(){}function y(){}function v(){}var m={};l(m,c,(function(){return this}));var g=Object.getPrototypeOf,w=g&&g(g(k([])));w&&w!==e&&r.call(w,c)&&(m=w);var b=v.prototype=d.prototype=Object.create(m);function x(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function S(t,e){function i(n,a,c,u){var s=p(t[n],t,a);if("throw"!==s.type){var l=s.arg,h=l.value;return h&&"object"==o(h)&&r.call(h,"__await")?e.resolve(h.__await).then((function(t){i("next",t,c,u)}),(function(t){i("throw",t,c,u)})):e.resolve(h).then((function(t){l.value=t,c(l)}),(function(t){return i("throw",t,c,u)}))}u(s.arg)}var a;n(this,"_invoke",{value:function(t,r){function n(){return new e((function(e,n){i(t,r,e,n)}))}return a=a?a.then(n,n):n()}})}function L(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return j()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=P(a,r);if(c){if(c===f)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=p(t,e,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===f)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}function P(t,e){var r=e.method,n=t.iterator[r];if(void 0===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=void 0,P(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),f;var o=p(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,f;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function E(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function O(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function k(t){if(t){var e=t[c];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:j}}function j(){return{value:void 0,done:!0}}return y.prototype=v,n(b,"constructor",{value:v,configurable:!0}),n(v,"constructor",{value:y,configurable:!0}),y.displayName=l(v,s,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===y||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,v):(t.__proto__=v,l(t,s,"GeneratorFunction")),t.prototype=Object.create(b),t},t.awrap=function(t){return{__await:t}},x(S.prototype),l(S.prototype,u,(function(){return this})),t.AsyncIterator=S,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new S(h(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(b),l(b,s,"Generator"),l(b,c,(function(){return this})),l(b,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},t.values=k,O.prototype={constructor:O,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(_),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,f):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),f},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),_(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;_(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:k(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},t}function a(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function c(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?a(Object(r),!0).forEach((function(e){u(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function u(t,e,r){return(e=function(t){var e=function(t,e){if("object"!==o(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!==o(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"===o(e)?e:String(e)}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function s(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}createApp({data:function(){return{locale:window.Lara.locale,routes:window.Lara.routes,products:[],productsPayment:0,totalPayment:0,translations:window.Lara.translations,orderShippingRegion:"ag",orderShippingBranch:0,orderTime:window.Lara.orderTime,todaysOptions:"",tomorrowsOptions:"",orderShippingMethod:"standart",shippingTotal:20,provinces:[],branches:[],regionsProvinces:[],regionsBranches:[],orderShippingProvince:"",regionDeliveryMessage:"Sargyt 3-7 gün aralygynda gowşurlar"}},methods:{routeFor:function(t){return this.routes.products.show.replace("slug",t)},imageFor:function(t){return"".concat(t," 1x, ").concat(t," 2x")},priceFor:function(t){return number_format(t.price_amount*t.quantity)},productTotalPriceId:function(t){return"productTotalPriceId-"+t},getProvinces:function(){var t=this;fetch(this.routes.provinces,{method:"GET"}).then((function(t){return t.json()})).then((function(e){t.provinces=e}))},getBranches:function(){var t=this;fetch(this.routes.branches,{method:"GET"}).then((function(t){return t.json()})).then((function(e){t.branches=e}))},shippingPrice:function(){if("ag"!=this.orderShippingRegion)switch(this.orderShippingMethod){case"express":return 60;case"on_own":return 0;default:return 40}switch(this.orderShippingMethod){case"standart":return 20;case"on_own":return 0;case"express":return 30}},getProductTotalPriceElement:function(t){return document.getElementById("productTotalPriceId-"+t)},removeCartItem:function(t){var e={product_id:t,_token:document.querySelector("meta[name=csrf-token]").getAttribute("value")};fetch(this.routes.carts.remove,{method:"POST",headers:{Accept:"application/json, text/plain, */*","Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify(e)}).then((function(t){return t.json()})).then((function(t){Event.fire("cartsUpdated")}))},productQuantityChanged:function(t,e){var r=t.target.value;0!=r&&null!=r||(r=1,t.target.value=1),new Number(e.optionsStock)<new Number(r)&&(t.target.value=e.optionsStock,r=e.optionsStock);var n={product_id:e.id,quantity:r,_token:document.querySelector("meta[name=csrf-token]").getAttribute("value")};$.ajax({method:"POST",url:window.Lara.routes.carts.update,data:n,success:function(t){"success"==t.message&&Event.fire("cartsUpdated")},error:function(t){}})},syncCarts:function(){var t=this;(function(){return n.apply(this,arguments)})({withProperties:1}).then((function(e){var r,n;t.products=e.data.products,t.cart_count=null!==(r=e.data.count)&&void 0!==r?r:0,(n=t.cart_count)&&Array.from(document.getElementsByClassName("top-header-cart-icons")).forEach((function(t){t.innerText=n})),t.productsPayment=0,t.products.forEach((function(e){t.productsPayment+=e.price_amount*e.quantity})),t.productsPayment=number_format(t.productsPayment),t.totalPayment=number_format(parseFloat(t.productsPayment)+t.shippingPrice())}))},openOrderModal:function(){var t,e=this;return(t=i().mark((function t(){var r,n,o,a,u;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r='\n <form action="">\n <p class="text-left text-black-600 mb-5" style="font-size: 1.135em;">'.concat(e.translations.name,' <span class="text-red">*</span> </p>\n <input\n id="order-client-name"\n name="name"\n value="').concat(window.Lara.auth.status?window.Lara.auth.user.first_name:"",'"\n type="text"\n class="swal2-input text-black-600 m-0 mb-3 w-100 placeholder-black focus:box-shadow-none"\n required\n >\n \n <p class="text-left text-black-600 mb-5" style="font-size: 1.135em;">').concat(e.translations.phone,' <span class="text-red">*</span></p>\n <input\n id="order-client-phone"\n value="').concat(window.Lara.auth.status?window.Lara.auth.user.phone_number.slice(-7):"",'"\n type="tel"\n class="swal2-input text-black-600 m-0 mb-3 w-100 placeholder-black focus:box-shadow-none"\n placeholder=""\n autofocus\n required>\n \n <p class="text-left text-black-600 mb-5" style="font-size: 1.135em;">\n ').concat(e.translations.address,"\n\n ").concat("on_own"!==e.orderShippingMethod?'<span class="text-red">*</span>':"",'\n </p>\n <input\n id="order-client-address"\n class="swal2-input text-black-600 m-0 mb-3 w-100 placeholder-black focus:box-shadow-none"\n type="text"\n name="adress"\n ').concat("on_own"!==e.orderShippingMethod?"required":"",'\n >\n\n <p class="text-left text-black-600 mb-5" style="font-size: 1.135em;">').concat(e.translations.note,'</p>\n <input id="order-client-note" class="swal2-input text-black-600 m-0 mb-3 w-100 placeholder-black focus:box-shadow-none" type="text" required>\n\n <p class="text-left text-black-600 mt-5 mb-0" style="font-size: 1.135em;">').concat(e.translations.paymentType,' <span class="text-red">*</span></p>\n <select class="swal2-select m-0 mb-1 rounded w-100 h-100" id="order-client-payment-method">\n <optgroup label="').concat(e.translations.nonVirtual,'">\n <option value="cash">').concat(e.translations.cash,'</option>\n <option value="atm">').concat(e.translations.atm,'</option>\n </optgroup>\n <optgroup label="').concat(e.translations.online,'">\n <option value="online">').concat(e.translations.altynAsyr,"</option>\n </optgroup>\n </select>\n </form>\n "),t.next=4,Swal.fire({imageUrl:"/logo.png",imageWidth:"13em",imageAlt:"Logo",confirmButtonText:e.translations.confirm,focusConfirm:!1,inputAutoFocus:!1,html:r,didRender:function(){$("#order-client-phone").inputmask("+(\\9\\93)-69-99-99-99")},preConfirm:function(){var t,r,n,o,i,a,c,u=null===(t=document.getElementById("order-client-name"))||void 0===t?void 0:t.value,s=null===(r=document.getElementById("order-client-phone"))||void 0===r?void 0:r.value,l=null===(n=document.getElementById("order-client-address"))||void 0===n?void 0:n.value,h=null===(o=document.getElementById("order-client-note"))||void 0===o?void 0:o.value,p=null===(i=document.getElementById("order-client-payment-method"))||void 0===i?void 0:i.value,f=e.orderShippingMethod,d=null!==(a=null===(c=document.getElementById("order-client-time"))||void 0===c?void 0:c.value)&&void 0!==a?a:"",y=e.orderShippingRegion,v=e.orderShippingProvince,m=e.orderShippingBranch;return""!=u&&""!=s&&""!=p&&""!=f||Swal.showValidationMessage("Maglumatlary giriziň"),"on_own"!==e.orderShippingMethod&&""==l&&Swal.showValidationMessage("Maglumatlary giriziň"),{name:u,phone:s,address:l,notes:h,payment_type:p,shipping_method:f,time:d,region:y,province:v,post_branch_id:m}},allowOutsideClick:function(){return!Swal.isLoading()}});case 4:n=t.sent,(o=n.value)&&(a=document.querySelector("meta[name=csrf-token]").getAttribute("value"),u=c(c({},o),{},{_token:a}),$.ajax({method:"POST",url:e.routes.orders.checkout,data:u,success:function(t){"online"!=u.payment_type?(Swal.fire("Siziň sargydyňyzyň kabul edildi!","Sargydy tassyklamak üçin siziň bilen operator habarlaşar.","success"),Event.fire("cartsUpdated")):window.location.href=t.data.data.url},error:function(t){}}));case 7:case"end":return t.stop()}}),t)})),function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){s(i,n,o,a,c,"next",t)}function c(t){s(i,n,o,a,c,"throw",t)}a(void 0)}))})()}},watch:{orderShippingRegion:function(){var t=this;this.shippingTotal=this.shippingPrice(),this.totalPayment=number_format(parseFloat(this.productsPayment)+this.shippingPrice()),this.regionsProvinces=this.provinces.filter((function(e){return e.region==t.orderShippingRegion})),this.orderShippingProvince=this.regionsProvinces[0]},orderShippingProvince:function(){var t=this;this.regionsBranches=this.branches.filter((function(e){return e.province_id===t.orderShippingProvince})),this.orderShippingBranch=this.regionsBranches[0]},orderShippingMethod:function(){if(this.shippingTotal=this.shippingPrice(),this.totalPayment=number_format(parseFloat(this.productsPayment)+this.shippingPrice()),"ag"!==this.orderShippingRegion)switch(this.orderShippingMethod){case"express":this.regionDeliveryMessage="Sargyt 2-5 gün aralygynda gowşurlar";break;case"on_own":this.regionDeliveryMessage="3-7 gün aralygynda sargydyňyzy saýlan şahamçaňyza baryp alyp bilersiňiz";break;default:this.regionDeliveryMessage="Sargyt 3-7 gün aralygynda gowşurlar"}}},mounted:function(){var t=this;window.Lara.auth.status&&this.syncCarts(),this.getProvinces(),this.getBranches(),Event.listen("cartsUpdated",(function(e){t.syncCarts()})),Event.listen("cartsUpdatedFromSidebar",(function(e){t.syncCarts()}))}}).mount("#cart-container")})(); |