(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["39203f94"],{1825:function(t,i,e){"use strict";e.r(i);var n=function(){var t=this,i=t.$createElement,e=t._self._c||i;return e("item-ticket-basic-with-slot",{attrs:{title:t.showName?t.ticketInformation.name:"",description:t.ticketInformation.price_description,type:t.ticketInformation.price_type,price:t.ticketInformation.price,"extra-amounts":t.ticketInformation.extra_amounts,"convenience-fee":t.ticketInformation.convenience_fee,"event-date-id":t.eventDateId,"price-id":t.ticketInformation.price_special_id,"show-convenience-fee":t.showConvenienceFee,coupon:t.coupon||t.ticketInformation.coupon,discount:t.ticketInformation.discount,loading:t.loading,ticketiavi:t.ticketiav,showavailability:t.showAvailability,quantity:t.ticketQuantityForDisplay,sector:t.getSector,"is-area":t.isArea,"is-blocked-to-edit-participant":t.ticketInformation.isBlockedToEditParticipant,"have-to-be-cloudy":!t.canShowSelectorUsingVisibility,"show-amount":t.showAmount}},[e("template",{slot:"main"},[t.shouldShowCardBinValidator?e("q-field",{attrs:{"data-test":t.CypressTarget("NumberField"),helper:t.$t("label.required")}},[e("q-input",{staticClass:"bin-card",attrs:{disabled:t.card_bin_validating||t.loading,loading:t.card_bin_validating||t.loading,"data-test":t.CypressTarget("Input"),"float-label":t.$t("field.promotion.ruleBinCard"),type:t.$q.platform.is.mobile?"tel":"text",clearable:"","numeric-keyboard-toggle":""},on:{input:function(i){t.cardBinInput()}},model:{value:t.card_bin,callback:function(i){t.card_bin="string"===typeof i?i.trim():i},expression:"card_bin"}})],1):t._e()],1),t.showQuantitySelectorResult?[t.thereIsTicketsAvailable?e("q-item-side",{attrs:{"data-test":t.CypressTarget("Buttons"),right:""}},[e("button-group-quantity",{attrs:{loading:t.loading,quantity:t.ticketQuantityForDisplay,"can-decrease":t.canDecrease&&!t.isCourtesy,"can-increase":t.canIncrease&&!t.isCourtesy},on:{increase:function(i){t.updateItem(1)},decrease:function(i){t.updateItem(-1)},"emit-cant-increase":t.cantUpdate}})],1):t.checkTicketsInCart()?e("q-item-side",{attrs:{right:""}},[e("status-in-cart")],1):e("q-item-side",{attrs:{right:""}},[e("status-sold-out")],1)]:t._e(),t.showQuantitySelectorResult||"visibility"!==t.showQuantitySelectorReason?t._e():[e(t.visibilityComponent,{tag:"component"})]],2)},o=[];n._withStripped=!0;e("7f7f"),e("96cf");var a=e("c973"),c=e.n(a),r=(e("a481"),e("895c")),s=e.n(r),u=(e("ac6a"),e("3156")),d=e.n(u),l=(e("c5f6"),e("2f62")),h=e("6971"),f=e("00ac"),p=e("73f0"),m=e("c8e3"),_=e("2c6e"),k=e("be20"),v=e("f6ea"),I=e("f9dd"),b={name:"ActiveTicketItemTicketBasicQuantity",components:{ButtonGroupQuantity:function(){return e.e("d04a1d64").then(e.bind(null,"6f2a"))},ItemTicketBasicWithSlot:function(){return Promise.all([e.e("vuelidate"),e.e("luxon"),e.e("2d226d26"),e.e("2d0a44aa"),e.e("0b2d7343")]).then(e.bind(null,"b295"))},StatusInCart:function(){return e.e("264cb3ba").then(e.bind(null,"ccd6"))},StatusSoldOut:function(){return e.e("232ee728").then(e.bind(null,"71c3"))}},mixins:[f["a"],h["b"],m["a"],p["a"]],props:{ticketInformation:{type:Object,required:!0,default:function(){return{associated:1,amount:0,name:"",description:"",price_id:0,price_special:!1,price_special_id:null,event_coupon_id:void 0,tickets_available:0,tickets_in_cart:!1,sector_id:null,sector_tickets:null,visibility:null,lot_start_sales:null,lot_end_sales:null,lot_is_active:null,next_lot_is_active:null,previous_lot_is_active:null,next_lot_id:null,previous_lot_id:null,price_lot_id:null,already_active:null}}},showName:{type:Boolean,required:!1,default:!0},eventDateId:{type:Number,required:!0,default:0},eventId:{type:Number,required:!1,default:0},isSoldOut:{type:Boolean,required:!1,default:!1},dispatchToSingleEvent:{type:Boolean,required:!1,default:!1},ticketsInCart:{type:Number,default:0},ticketiav:{type:Object,default:function(){}},showConvenienceFee:{type:Boolean,required:!1,default:!1},showCardBinValidator:{type:Boolean,required:!1,default:!1},isBlockedToEditParticipant:{type:Boolean,required:!1,default:!1},isCourtesy:{type:Boolean,required:!1,default:!1}},data:function(){return{card_bin_validating:!1,card_bin:""}},computed:d()({},Object(l["c"])("ticketShoppingCart",["ticketQuantityInCart","remainingTickets","sumOfTicketsInDate","cartOrderItemByEventDateId","cartOrderCode","loading","trueTotalEventTicketsById","trueTotalEventTicketsOnDateById"]),Object(l["c"])("ticketSale",["singleEventInformation","isBinListValidated","priceCoupon"]),Object(l["c"])("settings",["isStatusInCartEnabled"]),{coupon:function(){return this.priceCoupon(this.singleEventInformation.code,this.eventDateId,this.ticketInformation.price_special_id)},ticketCoupon:function(){return this.ticketInformation.coupon()},hasCoupon:function(){return this.coupon},getSector:function(){return this.isArea?this.ticketInformation.seat_location.sector:null},isArea:function(){return this.ticketInformation.seat_type===_["e"].area},eventTicketsLimit:function(){return this.singleEventInformation.event_tickets_limit},maxTicketsByPrice:function(){return this.ticketInformation.max_tickets},showAvailability:function(){return this.singleEventInformation.showAvailability},showAmount:function(){return!Object(I["c"])(this.singleEventInformation.type)},ticketData:function(){var t=d()({event_coupon_id:null},this.ticketInformation);return this.ticketInformation.coupon?(t.event_coupon_id=this.ticketInformation.coupon.event_coupon_id,t.coupon={event_coupon_id:this.ticketInformation.coupon.event_coupon_id,amount:this.ticketInformation.coupon.amount,original_amount:this.ticketInformation.price,convenience_fee:this.ticketInformation.coupon.convenience_fee}):void 0===this.coupon||void 0!==t.event_coupon_id&&null!==t.event_coupon_id||(t.event_coupon_id=this.coupon.event_coupon_id,t.coupon={event_coupon_id:this.coupon.event_coupon_id,amount:this.coupon.amount,original_amount:this.ticketInformation.price,convenience_fee:this.coupon.convenience_fee}),t},canPurchaseEventTicket:{cache:!1,get:function(){return!this.eventTicketsLimit||this.eventTicketsLimit-this.ticketQuantityInCart(this.eventDateId,this.ticketInformation)>0}},ticketsLeft:{cache:!1,get:function(){return this.eventTicketsLimit?this.ticketInformation.tickets_available:this.remainingTickets(this.eventDateId,this.ticketInformation)}},ticketQuantityForDisplay:{get:function(){return void 0!==this.ticketInformation.event_coupon_id?this.ticketQuantityWithCoupon:this.ticketQuantity},cache:!1},ticketQuantity:{get:function(){return this.ticketQuantityInCart(this.eventDateId,this.ticketData,!1)||0},cache:!1},ticketQuantityWithCoupon:{get:function(){return this.ticketQuantityInCart(this.eventDateId,this.ticketData,!0)||0},cache:!1},maxOrderItem:function(){return void 0===this.cartOrderItemByEventDateId(this.eventDateId)?0:this.cartOrderItemByEventDateId(this.eventDateId).order_quantity_limit},ticketsInDate:function(){return this.sumOfTicketsInDate(this.eventDateId)||0},trueTotalEventTicketsOnDate:function(){return this.trueTotalEventTicketsOnDateById(this.eventDateId)||0},trueTotalEventTicketsInCart:function(){return this.trueTotalEventTicketsById(this.eventId)},thereIsTicketsAvailable:function(){return this.ticketInformation.tickets_available+this.ticketQuantity>0&&(this.canIncrease||this.canDecrease)},canIncrease:function(){return(this.ticketsLeft>0&&!this.isSoldOut||!this.showAvailability)&&(null===this.ticketInformation.event_coupon_id||void 0===this.ticketInformation.event_coupon_id||this.ticketInformation.visibility===v["j"])},canDecrease:function(){return this.ticketQuantity>0?!!this.ticketQuantity:!this.isSoldOut},shouldShowCardBinValidator:function(){return!!this.ticketInformation.bin_config_id&&(!!this.showCardBinValidator&&(!!this.card_bin_validating||!this.isBinListValidated(this.singleEventInformation.code,this.singleEventInformation.slug,this.ticketInformation.bin_config_id)&&this.thereIsTicketsAvailable))},visibilityComponent:function(){return this.getVisibilityComponent(this.ticketInformation)},canShowSelectorUsingVisibility:function(){return this.getCanShowSelectorUsingVisibility(this.ticketInformation)},showQuantitySelector:function(){var t=this,i={bin:{enabled:this.ticketInformation.bin_config_id,validation:function(){return!t.card_bin_validating&&(!t.ticketInformation.bin_config_id||(!t.thereIsTicketsAvailable||(!t.showCardBinValidator||!!t.isBinListValidated(t.singleEventInformation.code,t.singleEventInformation.slug,t.ticketInformation.bin_config_id))))}},visibility:{enabled:this.singleEventInformation.is_visibility_feature_enabled,validation:function(){return t.canShowSelectorUsingVisibility}}},e={success:[],failed:"",status:!0},n=!0;return s()(i).forEach(function(t){i[t].enabled&&n&&(n=i[t].validation(),n?e.success.push(t):(e.status=!1,e.failed=t))}),e},showQuantitySelectorResult:function(){return this.showQuantitySelector.status},showQuantitySelectorReason:function(){return this.showQuantitySelector.failed}}),mounted:function(){this.incrementsLoadedPrice({dateId:this.eventDateId,isSpecial:null!==this.ticketInformation.price_special_id,priceId:null!==this.ticketInformation.price_special_id?this.ticketInformation.price_special_id:this.ticketInformation.price_id})},methods:d()({},Object(l["b"])("ticketShoppingCart",["updateCartItemQuantity","populateCart","getBlockedByIp","blockedByIp"]),Object(l["b"])("ticketSale",["validateCreditCardBin","incrementsLoadedPrice"]),{cardBinInput:function(){this.card_bin=this.card_bin.replace(/\D/g,""),8===this.card_bin.length&&this.validateCardBin()},validateCardBin:function(){var t=this;this.card_bin_validating=!0,this.validateCreditCardBin({configId:this.ticketInformation.bin_config_id,bin:this.card_bin,eventCode:this.singleEventInformation.code||this.singleEventInformation.slug}).catch(function(i){t.toastError(t.$t("label.bin_refused"))}).finally(function(){t.card_bin_validating=!1,t.$emit("updatedBin")})},cantUpdate:function(){var t=0===this.ticketsLeft,i=this.maxOrderItem>0&&this.ticketsInDate>=this.maxOrderItem;return this.canPurchaseEventTicket?i?(this.showAlertCantUpdate(h["a"].maxQuantity),!1):!t||(this.showAlertCantUpdate(h["a"].noStock),!1):(this.showAlertCantUpdate(h["a"].maxQuantity),!1)},updateItem:function(){var t=c()(regeneratorRuntime.mark(function t(i){var e,n,o,a,c,r,s;return regeneratorRuntime.wrap(function(t){while(1)switch(t.prev=t.next){case 0:return t.next=2,this.getBlockedByIp();case 2:if(!t.sent){t.next=8;break}return e=this.$t("".concat(k["a"],".title")),n=this.$t("".concat(k["a"],".message")),this.$q.dialog({title:e,message:n}),this.blockedByIp(),t.abrupt("return",!1);case 8:if(o=this.ticketQuantityWithCoupon+i,this.areValidQuantities(i,o)){t.next=11;break}return t.abrupt("return",!1);case 11:a={eventCode:this.singleEventInformation.code,eventId:this.eventId,eventDateId:this.eventDateId,ticket:{price_id:this.ticketInformation.price_id,price_special_id:this.ticketInformation.price_special_id,price_description:this.ticketInformation.price_description,event_coupon_id:null,bin_config_id:this.ticketInformation.bin_config_id,seat_id:this.ticketInformation.seat_id,visibility:this.ticketInformation.visibility,ticket:this.ticketInformation,quantity:o,action:i}},this.ticketInformation.coupon?(a.ticket.event_coupon_id=this.ticketInformation.coupon.event_coupon_id,a.ticket.coupon={event_coupon_id:this.ticketInformation.coupon.event_coupon_id,amount:this.ticketInformation.coupon.amount,original_amount:this.ticketInformation.price,convenience_fee:this.ticketInformation.coupon.convenience_fee}):this.coupon&&(a.ticket.event_coupon_id=this.coupon.event_coupon_id,a.ticket.coupon={event_coupon_id:this.coupon.event_coupon_id,amount:this.coupon.amount,original_amount:this.ticketInformation.price,convenience_fee:this.coupon.convenience_fee});try{this.updateCartItemQuantity(d()({},a,{dispatchToSingleEvent:this.dispatchToSingleEvent}))}catch(t){this.toastError(t)}return c=this.ticketInformation.extra_amounts||null,r=0,s="",Array.isArray(c)&&c.forEach(function(t){r+=parseFloat(t.amount),s+=" - ".concat(t.name)}),this.trackProduct({id:"".concat(this.SET_ENTITY).concat(this.ticketInformation.price_id||"").concat(this.ticketInformation.price_special_id||""),name:this.ticketInformation.name||this.ticketInformation.price_type||"",price_description:this.ticketInformation.price_description,cartId:this.cartOrderCode,amount:parseFloat(this.ticketInformation.price)+r,brand:this.SET_PAGE_NAME,category:(this.ticketInformation.price_type||"")+s,quantity:o,event_code:this.singleEventInformation.code,remove:-1===i}),this.$emit("item-update",a),t.abrupt("return",!0);case 21:case"end":return t.stop()}},t,this)}));return function(i){return t.apply(this,arguments)}}(),areValidQuantities:function(t,i){var e=this.eventTicketsLimit,n=this.maxOrderItem,o=this.maxTicketsByPrice,a=this.trueTotalEventTicketsInCart+t*this.ticketInformation.associated,c=this.trueTotalEventTicketsOnDate+t*this.ticketInformation.associated,r=(this.ticketQuantity+t)*this.ticketInformation.associated;return!(i<0)&&(a>e?(this.showNotification(this.$t("error.server.cart.maxLimitPerCpf"),"negative"),!1):r>n||c>n?(this.showNotification(this.$t("error.server.cart.maxLimitPerDate"),"negative"),!1):!(r>o&&o)||(this.showNotification(this.$t("error.server.cart.maxLimitPerPrice"),"negative"),!1))},checkTicketsInCart:function(){return!!this.isStatusInCartEnabled&&(!!this.ticketInformation.tickets_in_cart||this.sectorTicketsInCart()&&this.ticketInformation.total_quantity>0)},sectorTicketsInCart:function(){if(!this.isStatusInCartEnabled)return!1;var t=this.ticketInformation.sector_id,i=this.ticketInformation.sector_tickets;return i&&i.some(function(i){var e=null===t&&null===i.price_sector||i.price_sector&&i.price_sector.id===t;return!e||i.tickets_in_cart})}})},y=b,g=(e("b221"),e("2877")),C=Object(g["a"])(y,n,o,!1,null,"1a10f9c6",null);C.options.__file="basicQuantity.vue";i["default"]=C.exports},b221:function(t,i,e){"use strict";var n=e("e4c2"),o=e.n(n);o.a},c8e3:function(t,i,e){"use strict";i["a"]={data:function(){return{dismissNotification:null}},methods:{showNotification:function(t,i){this.dismissNotification&&this.dismissNotification(),this.dismissNotification=this.$q.notify({message:t,color:i,icon:"info"})}}}},e4c2:function(t,i,e){}}]);
//# sourceMappingURL=39203f94.faad8d70.2024-10-22T18:36:13.257Z.js.map