File: //proc/self/cwd/nueva/admin346k89tef/themes/new-theme/public/catalog_product.bundle.js
(()=>{var e={80559:(e,i,t)=>{"use strict";Object.defineProperty(i,"__esModule",{value:!0});var r=o(t(99663)),c=o(t(22600));function o(e){return e&&e.__esModule?e:{default:e}}
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/OSL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to https://devdocs.prestashop.com/ for more information.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
*/var n=window.$,a=function(){function e(){(0,r.default)(this,e),this.prefixCreateForm="form_step2_specific_price_",this.prefixEditForm="form_modal_",this.editModalIsOpen=!1,this.$createPriceFormDefaultValues={},this.storePriceFormDefaultValues(),this.loadAndDisplayExistingSpecificPricesList(),this.configureAddPriceFormBehavior(),this.configureEditPriceModalBehavior(),this.configureDeletePriceButtonsBehavior(),this.configureMultipleModalsBehavior()}return(0,c.default)(e,[{key:"loadAndDisplayExistingSpecificPricesList",value:function(){var e=this,i=n("#js-specific-price-list"),t=i.data("listingUrl").replace(/list\/\d+/,"list/"+this.getProductId());n.ajax({type:"GET",url:t}).done((function(t){var r=i.find("tbody");r.find("tr").remove(),t.length>0?i.removeClass("hide"):i.addClass("hide");var c=e.renderSpecificPricesListingAsHtml(t);r.append(c)}))}},{key:"renderSpecificPricesListingAsHtml",value:function(e){var i="",t=this;return n.each(e,(function(e,r){var c=n("#js-specific-price-list").attr("data-action-delete").replace(/delete\/\d+/,"delete/"+r.id_specific_price),o=t.renderSpecificPriceRow(r,c);i+=o})),i}},{key:"renderSpecificPriceRow",value:function(e,i){var t=e.id_specific_price,r=e.can_delete?'<a href="'+i+'" class="js-delete delete btn tooltip-link delete pl-0 pr-0"><i class="material-icons">delete</i></a>':"",c=e.can_edit?'<a href="#" data-specific-price-id="'+t+'" class="js-edit edit btn tooltip-link delete pl-0 pr-0"><i class="material-icons">edit</i></a>':"";return"<tr> <td>"+e.id_specific_price+"</td> <td>"+e.rule_name+"</td> <td>"+e.attributes_name+"</td> <td>"+e.currency+"</td> <td>"+e.country+"</td> <td>"+e.group+"</td> <td>"+e.customer+"</td> <td>"+e.fixed_price+"</td> <td>"+e.impact+"</td> <td>"+e.period+"</td> <td>"+e.from_quantity+"</td> <td>"+r+"</td> <td>"+c+"</td></tr>"}},{key:"configureAddPriceFormBehavior",value:function(){var e=this,i=!0,t=this.getPrefixSelector(i);n("#specific_price_form .js-cancel").click((function(){e.resetCreatePriceFormDefaultValues(),n("#specific_price_form").collapse("hide")})),n("#specific_price_form .js-save").on("click",(function(){return e.submitCreatePriceForm()})),n("#js-open-create-specific-price-form").on("click",(function(){return e.loadAndFillOptionsForSelectCombinationInput(i)})),n(t+"leave_bprice").on("click",(function(){return e.enableSpecificPriceFieldIfEligible(i)})),n(t+"sp_reduction_type").on("change",(function(){return e.enableSpecificPriceTaxFieldIfEligible(i)}))}},{key:"configureEditPriceFormInsideModalBehavior",value:function(){var e=this,i=!1,t=this.getPrefixSelector(i);n("#form_modal_cancel").click((function(){return e.closeEditPriceModalAndRemoveForm()})),n("#form_modal_close").click((function(){return e.closeEditPriceModalAndRemoveForm()})),n("#form_modal_save").click((function(){return e.submitEditPriceForm()})),this.loadAndFillOptionsForSelectCombinationInput(i),n(t+"leave_bprice").on("click",(function(){return e.enableSpecificPriceFieldIfEligible(i)})),n(t+"sp_reduction_type").on("change",(function(){return e.enableSpecificPriceTaxFieldIfEligible(i)})),this.reinitializeDatePickers(),this.initializeLeaveBPriceField(i),this.enableSpecificPriceTaxFieldIfEligible(i)}},{key:"reinitializeDatePickers",value:function(){n(".datepicker input").datetimepicker({format:"YYYY-MM-DD"})}},{key:"initializeLeaveBPriceField",value:function(e){var i=this.getPrefixSelector(e);""!==n(i+"sp_price").val()&&(n(i+"sp_price").prop("disabled",!1),n(i+"leave_bprice").prop("checked",!1))}},{key:"configureEditPriceModalBehavior",value:function(){var e=this;n(document).on("click","#js-specific-price-list .js-edit",(function(i){i.preventDefault();var t=n(i.currentTarget).data("specificPriceId");e.openEditPriceModalAndLoadForm(t)}))}},{key:"configureDeletePriceButtonsBehavior",value:function(){var e=this;n(document).on("click","#js-specific-price-list .js-delete",(function(i){i.preventDefault(),e.deleteSpecificPrice(i.currentTarget)}))}},{key:"configureMultipleModalsBehavior",value:function(){var e=this;n(".modal").on("hidden.bs.modal",(function(){e.editModalIsOpen&&n("body").addClass("modal-open")}))}},{key:"submitCreatePriceForm",value:function(){var e=this,i=n("#specific_price_form").attr("data-action"),t=n("#specific_price_form input, #specific_price_form select, #form_id_product").serialize();n("#specific_price_form .js-save").attr("disabled","disabled"),n.ajax({type:"POST",url:i,data:t}).done((function(){window.showSuccessMessage(window.translate_javascripts["Form update success"]),e.resetCreatePriceFormDefaultValues(),n("#specific_price_form").collapse("hide"),e.loadAndDisplayExistingSpecificPricesList(),n("#specific_price_form .js-save").removeAttr("disabled")})).fail((function(e){window.showErrorMessage(e.responseJSON),n("#specific_price_form .js-save").removeAttr("disabled")}))}},{key:"submitEditPriceForm",value:function(){var e=this,i=n("#edit-specific-price-modal-form").attr("data-action"),t=n("#edit-specific-price-modal-form").data("specificPriceId"),r=i.replace(/update\/\d+/,"update/"+t),c=n("#edit-specific-price-modal-form input, #edit-specific-price-modal-form select, #form_id_product").serialize();n("#edit-specific-price-modal-form .js-save").attr("disabled","disabled"),n.ajax({type:"POST",url:r,data:c}).done((function(){window.showSuccessMessage(window.translate_javascripts["Form update success"]),e.closeEditPriceModalAndRemoveForm(),e.loadAndDisplayExistingSpecificPricesList(),n("#edit-specific-price-modal-form .js-save").removeAttr("disabled")})).fail((function(e){window.showErrorMessage(e.responseJSON),n("#edit-specific-price-modal-form .js-save").removeAttr("disabled")}))}},{key:"deleteSpecificPrice",value:function(e){var i=this;window.modalConfirmation.create(window.translate_javascripts["Are you sure you want to delete this item?"],null,{onContinue:function(){var t=n(e).attr("href");n(e).attr("disabled","disabled"),n.ajax({type:"GET",url:t}).done((function(t){i.loadAndDisplayExistingSpecificPricesList(),window.showSuccessMessage(t),n(e).removeAttr("disabled")})).fail((function(i){window.showErrorMessage(i.responseJSON),n(e).removeAttr("disabled")}))}}).show()}},{key:"storePriceFormDefaultValues",value:function(){var e=this.$createPriceFormDefaultValues;n("#specific_price_form").find("select,input").each((function(i,t){e[n(t).attr("id")]=n(t).val()})),n("#specific_price_form").find("input:checkbox").each((function(i,t){e[n(t).attr("id")]=n(t).prop("checked")})),this.$createPriceFormDefaultValues=e}},{key:"loadAndFillOptionsForSelectCombinationInput",value:function(e){var i=this.getPrefixSelector(e),t=n(i+"sp_id_product_attribute"),r=t.attr("data-action").replace(/product-combinations\/\d+/,"product-combinations/"+this.getProductId());n.ajax({type:"GET",url:r}).done((function(e){t.find("option:gt(0)").remove(),n.each(e,(function(e,i){t.append('<option value="'+i.id+'">'+i.name+"</option>")})),"0"!==t.data("selectedAttribute")&&t.val(t.data("selectedAttribute")).trigger("change")}))}},{key:"enableSpecificPriceTaxFieldIfEligible",value:function(e){var i=this.getPrefixSelector(e);"percentage"===n(i+"sp_reduction_type").val()?n(i+"sp_reduction_tax").hide():n(i+"sp_reduction_tax").show()}},{key:"resetCreatePriceFormDefaultValues",value:function(){var e=this.$createPriceFormDefaultValues;n("#specific_price_form").find("input").each((function(i,t){n(t).val(e[n(t).attr("id")])})),n("#specific_price_form").find("select").each((function(i,t){n(t).val(e[n(t).attr("id")]).change()})),n("#specific_price_form").find("input:checkbox").each((function(e,i){n(i).prop("checked",!0)}))}},{key:"enableSpecificPriceFieldIfEligible",value:function(e){var i=this.getPrefixSelector(e);n(i+"sp_price").prop("disabled",n(i+"leave_bprice").is(":checked")).val("")}},{key:"openEditPriceModalAndLoadForm",value:function(e){var i=this,t=n("#js-specific-price-list").data("actionEdit").replace(/form\/\d+/,"form/"+e);n("#edit-specific-price-modal").modal("show"),this.editModalIsOpen=!0,n.ajax({type:"GET",url:t}).done((function(t){i.insertEditSpecificPriceFormIntoModal(t),n("#edit-specific-price-modal-form").data("specificPriceId",e),i.configureEditPriceFormInsideModalBehavior()})).fail((function(e){window.showErrorMessage(e.responseJSON)}))}},{key:"closeEditPriceModalAndRemoveForm",value:function(){n("#edit-specific-price-modal").modal("hide"),this.editModalIsOpen=!1,n("#edit-specific-price-modal-form").empty()}},{key:"insertEditSpecificPriceFormIntoModal",value:function(e){var i=n("#edit-specific-price-modal-form");i.empty(),i.append(e)}},{key:"getProductId",value:function(){return n("#form_id_product").val()}},{key:"getPrefixSelector",value:function(e){return e?"#"+this.prefixCreateForm:"#"+this.prefixEditForm}}]),e}();i.default=a},32242:(e,i,t)=>{e.exports={default:t(33391),__esModule:!0}},99663:(e,i)=>{"use strict";i.__esModule=!0,i.default=function(e,i){if(!(e instanceof i))throw new TypeError("Cannot call a class as a function")}},22600:(e,i,t)=>{"use strict";i.__esModule=!0;var r,c=t(32242),o=(r=c)&&r.__esModule?r:{default:r};i.default=function(){function e(e,i){for(var t=0;t<i.length;t++){var r=i[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),(0,o.default)(e,r.key,r)}}return function(i,t,r){return t&&e(i.prototype,t),r&&e(i,r),i}}()},33391:(e,i,t)=>{t(31477);var r=t(34579).Object;e.exports=function(e,i,t){return r.defineProperty(e,i,t)}},85663:e=>{e.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},12159:(e,i,t)=>{var r=t(36727);e.exports=function(e){if(!r(e))throw TypeError(e+" is not an object!");return e}},34579:e=>{var i=e.exports={version:"2.6.11"};"number"==typeof __e&&(__e=i)},19216:(e,i,t)=>{var r=t(85663);e.exports=function(e,i,t){if(r(e),void 0===i)return e;switch(t){case 1:return function(t){return e.call(i,t)};case 2:return function(t,r){return e.call(i,t,r)};case 3:return function(t,r,c){return e.call(i,t,r,c)}}return function(){return e.apply(i,arguments)}}},89666:(e,i,t)=>{e.exports=!t(7929)((function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}))},97467:(e,i,t)=>{var r=t(36727),c=t(33938).document,o=r(c)&&r(c.createElement);e.exports=function(e){return o?c.createElement(e):{}}},83856:(e,i,t)=>{var r=t(33938),c=t(34579),o=t(19216),n=t(41818),a=t(27069),s=function(e,i,t){var d,l,u,f=e&s.F,p=e&s.G,m=e&s.S,v=e&s.P,h=e&s.B,_=e&s.W,y=p?c:c[i]||(c[i]={}),P=y.prototype,b=p?r:m?r[i]:(r[i]||{}).prototype;for(d in p&&(t=i),t)(l=!f&&b&&void 0!==b[d])&&a(y,d)||(u=l?b[d]:t[d],y[d]=p&&"function"!=typeof b[d]?t[d]:h&&l?o(u,r):_&&b[d]==u?function(e){var i=function(i,t,r){if(this instanceof e){switch(arguments.length){case 0:return new e;case 1:return new e(i);case 2:return new e(i,t)}return new e(i,t,r)}return e.apply(this,arguments)};return i.prototype=e.prototype,i}(u):v&&"function"==typeof u?o(Function.call,u):u,v&&((y.virtual||(y.virtual={}))[d]=u,e&s.R&&P&&!P[d]&&n(P,d,u)))};s.F=1,s.G=2,s.S=4,s.P=8,s.B=16,s.W=32,s.U=64,s.R=128,e.exports=s},7929:e=>{e.exports=function(e){try{return!!e()}catch(e){return!0}}},33938:e=>{var i=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=i)},27069:e=>{var i={}.hasOwnProperty;e.exports=function(e,t){return i.call(e,t)}},41818:(e,i,t)=>{var r=t(4743),c=t(83101);e.exports=t(89666)?function(e,i,t){return r.f(e,i,c(1,t))}:function(e,i,t){return e[i]=t,e}},33758:(e,i,t)=>{e.exports=!t(89666)&&!t(7929)((function(){return 7!=Object.defineProperty(t(97467)("div"),"a",{get:function(){return 7}}).a}))},36727:e=>{e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},4743:(e,i,t)=>{var r=t(12159),c=t(33758),o=t(33206),n=Object.defineProperty;i.f=t(89666)?Object.defineProperty:function(e,i,t){if(r(e),i=o(i,!0),r(t),c)try{return n(e,i,t)}catch(e){}if("get"in t||"set"in t)throw TypeError("Accessors not supported!");return"value"in t&&(e[i]=t.value),e}},83101:e=>{e.exports=function(e,i){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:i}}},33206:(e,i,t)=>{var r=t(36727);e.exports=function(e,i){if(!r(e))return e;var t,c;if(i&&"function"==typeof(t=e.toString)&&!r(c=t.call(e)))return c;if("function"==typeof(t=e.valueOf)&&!r(c=t.call(e)))return c;if(!i&&"function"==typeof(t=e.toString)&&!r(c=t.call(e)))return c;throw TypeError("Can't convert object to primitive value")}},31477:(e,i,t)=>{var r=t(83856);r(r.S+r.F*!t(89666),"Object",{defineProperty:t(4743).f})}},i={};function t(r){var c=i[r];if(void 0!==c)return c.exports;var o=i[r]={exports:{}};return e[r](o,o.exports,t),o.exports}(()=>{"use strict";var e,i=t(80559),r=(e=i)&&e.__esModule?e:{default:e};
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/OSL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to https://devdocs.prestashop.com/ for more information.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
*/
(0,window.$)((function(){new r.default}))})(),window.catalog_product={}})();