1"use strict";(self["webpackChunkclient"]=self["webpackChunkclient"]||[]).push([[2480],{2480:function(e,t,i){i.r(t),i.d(t,{default:function(){return W}});i(18111),i(61701);var s=i(20641),n=i(90033);const a={key:0,class:"o-minwidth"},o={class:"is-flex is-align-items-flex-start is-justify-content-space-between is-flex-wrap-wrap mb-4"},l={class:"title mb-2"},r={class:"tags"},d={class:"tag is-rounded is-light"},c={key:1,class:"card p-5 mb-4"},u={class:"pe-switch-row"};function h(e,t,i,h,p,m){const v=(0,s.g2)("b-loading"),k=(0,s.g2)("b-notification"),f=(0,s.g2)("b-switch"),y=(0,s.g2)("TicketingBoard"),g=(0,s.g2)("TicketEditor"),b=(0,s.g2)("AddonEditor"),$=(0,s.g2)("VoucherEditor"),L=(0,s.g2)("LinkEditor");return p.item&&e.isGrantedOwner(p.item)?((0,s.uX)(),(0,s.CE)("section",a,[(0,s.bF)(v,{modelValue:p.isLoading,"onUpdate:modelValue":t[0]||(t[0]=e=>p.isLoading=e),"is-full-page":!1},null,8,["modelValue"]),(0,s.Lk)("div",o,[(0,s.Lk)("div",null,[(0,s.Lk)("h2",l,(0,n.v_)(e.$t("Tickets")),1),(0,s.Lk)("div",r,[(0,s.Lk)("span",{class:(0,n.C4)(["tag is-rounded",p.item.isPublic?"is-success is-light":"is-warning is-light"])},(0,n.v_)(p.item.isPublic?e.$t("Public event"):e.$t("Members-only event")),3),(0,s.Lk)("span",{class:(0,n.C4)(["tag is-rounded",p.item.registrationManuallyClosed?"is-light":"is-success is-light"])},(0,n.v_)(p.item.registrationManuallyClosed?e.$t("Registration closed"):e.$t("Registration open")),3),(0,s.Lk)("span",d,(0,n.v_)(e.$t("{n} sold",{n:m.totalSold})),1)])])]),p.item.isPublic?(0,s.Q3)("",!0):((0,s.uX)(),(0,s.Wv)(k,{key:0,type:"is-info is-light",closable:!1,class:"mb-4"},{default:(0,s.k6)(()=>[(0,s.eW)((0,n.v_)(e.$t("This event is not public, so every ticket is members only. Make the event public in Settings to sell tickets to guests.")),1)]),_:1})),p.item.settings?((0,s.uX)(),(0,s.CE)("div",c,[(0,s.Lk)("div",u,[(0,s.Lk)("div",null,[(0,s.Lk)("b",null,(0,n.v_)(e.$t("Allow only one ticket per order")),1),(0,s.Lk)("span",null,(0,n.v_)(e.$t("Buyers can select only one ticket at a time. Quantity controls are hidden.")),1)]),(0,s.bF)(f,{modelValue:p.item.settings.singleTicketPurchase,"onUpdate:modelValue":[t[1]||(t[1]=e=>p.item.settings.singleTicketPurchase=e),m.saveSingleTicketPurchase]},null,8,["modelValue","onUpdate:modelValue"])])])):(0,s.Q3)("",!0),(0,s.bF)(y,{mode:"live",tickets:p.tickets,addons:p.addons,vouchers:p.vouchers,currency:m.currency,levels:p.feeLevels,chapters:p.chapters,onAddTicket:t[2]||(t[2]=e=>m.openTicket(null)),onEditTicket:m.openTicket,onDuplicateTicket:m.duplicateTicket,onArchiveTicket:m.archiveTicket,onDeleteTicket:m.deleteTicket,onAddAddon:t[3]||(t[3]=e=>m.openAddon(null)),onEditAddon:m.openAddon,onArchiveAddon:m.archiveAddon,onDeleteAddon:m.deleteAddon,onAddVoucher:t[4]||(t[4]=e=>m.openVoucher(null)),onEditVoucher:m.openVoucher,onToggleVoucher:m.toggleVoucher,onDeleteVoucher:m.deleteVoucher,"can-create-links":e.isGranted("EVENT_TENANT"),"link-redemptions":p.linkRedemptions,"links-unavailable-reason":p.item.isPublic?"":e.$t("Registration links need a public event: members-only events have no public page to open them on."),onAddLink:t[5]||(t[5]=e=>m.openLink(null,e)),onCopyLink:m.copyLink},null,8,["tickets","addons","vouchers","currency","levels","chapters","onEditTicket","onDuplicateTicket","onArchiveTicket","onDeleteTicket","onEditAddon","onArchiveAddon","onDeleteAddon","onEditVoucher","onToggleVoucher","onDeleteVoucher","can-create-links","link-redemptions","links-unavailable-reason","onCopyLink"]),p.product?((0,s.uX)(),(0,s.Wv)(g,{key:2,modelValue:p.isTicketOpen,"onUpdate:modelValue":t[6]||(t[6]=e=>p.isTicketOpen=e),mode:"live",ticket:p.editingTicket,event:p.item,product:p.product,levels:p.feeLevels,chapters:p.chapters,onSaved:m.reloadTickets},null,8,["modelValue","ticket","event","product","levels","chapters","onSaved"])):(0,s.Q3)("",!0),p.product?((0,s.uX)(),(0,s.Wv)(b,{key:3,modelValue:p.isAddonOpen,"onUpdate:modelValue":t[7]||(t[7]=e=>p.isAddonOpen=e),mode:"live",addon:p.editingAddon,tickets:p.tickets,product:p.product,onSaved:m.retrieveAddons},null,8,["modelValue","addon","tickets","product","onSaved"])):(0,s.Q3)("",!0),(0,s.bF)($,{modelValue:p.isVoucherOpen,"onUpdate:modelValue":t[8]||(t[8]=e=>p.isVoucherOpen=e),mode:"live",voucher:p.editingVoucher,event:p.item,tickets:p.tickets,addons:p.addons,"existing-codes":p.vouchers.map(e=>e.code),onSaved:m.retrieveVouchers},null,8,["modelValue","voucher","event","tickets","addons","existing-codes","onSaved"]),(0,s.bF)(L,{modelValue:p.isLinkOpen,"onUpdate:modelValue":t[9]||(t[9]=e=>p.isLinkOpen=e),link:p.editingLink,"link-type":p.newLinkType,event:p.item,tickets:p.tickets,"app-host":e.tenant?.appHost||"",workspace:e.tenant?.slug||"",redemptions:p.editingLink&&p.linkRedemptions[p.editingLink.uuid]||[],onSaved:m.retrieveVouchers,onCreated:t[10]||(t[10]=e=>p.editingLink=e)},null,8,["modelValue","link","link-type","event","tickets","app-host","workspace","redemptions","onSaved"])])):(0,s.Q3)("",!0)}i(22489),i(7588),i(18237),i(13579);var p=i(40834),m=i(88697),v=i(15591),k=i(5168),f=i(50823);const y={key:0,class:"pe-layout is-single"},g={class:"pe-section"},b={class:"pe-note"},$={class:"pe-row is-2"},L=["value"],C={key:1,class:"tag is-primary is-light is-rounded"},w={key:0,class:"pe-switch-row"},T={key:1,class:"pe-switch-row"},A={class:"control"},x={key:1,class:"pe-footer"},V={class:"pe-footer-left"},_={key:0,class:"pe-confirm"},F={class:"icon is-small"},E={class:"pe-footer-right"},O=["disabled"],P=["disabled"];function D(e,t,i,a,o,l){const r=(0,s.g2)("b-select"),d=(0,s.g2)("b-field"),c=(0,s.g2)("b-datepicker"),u=(0,s.g2)("b-switch"),h=(0,s.g2)("b-input"),p=(0,s.g2)("font-awesome-icon"),m=(0,s.g2)("ItemViewModal");return(0,s.uX)(),(0,s.Wv)(m,{"model-value":i.modelValue,title:l.title,"scroll-container-id":"linkEditorModalBody","onUpdate:modelValue":t[9]||(t[9]=t=>e.$emit("update:modelValue",t)),onClose:t[10]||(t[10]=t=>e.$emit("update:modelValue",!1))},{default:(0,s.k6)(()=>[i.modelValue&&o.draft?((0,s.uX)(),(0,s.CE)("div",y,[(0,s.Lk)("div",null,[(0,s.Lk)("div",g,[(0,s.Lk)("p",b,(0,n.v_)(l.isInvitation?e.$t("The link registers one person on the chosen ticket for free. It works once and stops working at the expiry date."):e.$t("The link lets one person buy the chosen ticket at its price, even outside its sale window. It works once and stops working at the expiry date."))+" "+(0,n.v_)(e.$t("The registration form still has to be filled
1in.")),1),(0,s.Lk)("div",$,[(0,s.bF)(d,{label:e.$t("Ticket"),type:o.errors.ticket?"is-danger":"",message:o.errors.ticket?e.$t("Choose a ticket."):""},{default:(0,s.k6)(()=>[l.isNew?((0,s.uX)(),(0,s.Wv)(r,{key:0,modelValue:o.draft.ticket,"onUpdate:modelValue":t[0]||(t[0]=e=>o.draft.ticket=e),placeholder:e.$t("Choose a ticket."),expanded:""},{default:(0,s.k6)(()=>[((0,s.uX)(!0),(0,s.CE)(s.FK,null,(0,s.pI)(l.activeTickets,e=>((0,s.uX)(),(0,s.CE)("option",{key:e.id,value:e["@id"]},(0,n.v_)(e.name),9,L))),128))]),_:1},8,["modelValue","placeholder"])):((0,s.uX)(),(0,s.CE)("span",C,(0,n.v_)(l.ticketName),1))]),_:1},8,["label","type","message"]),(0,s.bF)(d,{label:e.$t("Valid to"),type:o.errors.validTo?"is-danger":"",message:o.errors.validTo?e.$t("The expiry must be in the future."):""},{default:(0,s.k6)(()=>[(0,s.bF)(c,{modelValue:l.validTo,"onUpdate:modelValue":t[1]||(t[1]=e=>l.validTo=e),"min-date":new Date,icon:"calendar",expanded:"","append-to-body":""},null,8,["modelValue","min-date"])]),_:1},8,["label","type","message"])]),l.isNew?(0,s.Q3)("",!0):((0,s.uX)(),(0,s.CE)("div",w,[(0,s.Lk)("div",null,[(0,s.Lk)("b",null,(0,n.v_)(e.$t("Active")),1),(0,s.Lk)("span",null,(0,n.v_)(e.$t("Switch off to revoke the link.")),1)]),(0,s.bF)(u,{modelValue:o.draft.isActive,"onUpdate:modelValue":t[2]||(t[2]=e=>o.draft.isActive=e)},null,8,["modelValue"])])),!l.isNew&&i.redemptions.length?((0,s.uX)(),(0,s.CE)("div",T,[(0,s.Lk)("div",null,[(0,s.Lk)("b",null,(0,n.v_)(e.$t("Registrations")),1),((0,s.uX)(!0),(0,s.CE)(s.FK,null,(0,s.pI)(i.redemptions,(t,i)=>((0,s.uX)(),(0,s.CE)("span",{key:i},(0,n.v_)(l.linkRedemptionText(t,e.$t.bind(this))),1))),128))])])):(0,s.Q3)("",!0),l.isNew?(0,s.Q3)("",!0):((0,s.uX)(),(0,s.Wv)(d,{key:2,label:e.$t("Link")},{default:(0,s.k6)(()=>[(0,s.bF)(h,{"model-value":l.url,readonly:"",expanded:""},null,8,["model-value"]),(0,s.Lk)("p",A,[(0,s.Lk)("button",{type:"button",class:"button is-primary",onClick:t[3]||(t[3]=(...e)=>l.copy&&l.copy(...e))},(0,n.v_)(e.$t("Copy link")),1)])]),_:1},8,["label"]))])])])):(0,s.Q3)("",!0),i.modelValue&&o.draft?((0,s.uX)(),(0,s.CE)("div",x,[(0,s.Lk)("div",V,[l.isNew?(0,s.Q3)("",!0):((0,s.uX)(),(0,s.CE)(s.FK,{key:0},[o.confirm?((0,s.uX)(),(0,s.CE)("span",_,[(0,s.eW)((0,n.v_)(e.$t("Are you sure you want to delete this link? It stops working immediately."))+" ",1),(0,s.Lk)("button",{type:"button",class:(0,n.C4)(["button is-danger is-small is-rounded",{"is-loading":o.isBusy}]),onClick:t[4]||(t[4]=(...e)=>l.runDelete&&l.runDelete(...e))},(0,n.v_)(e.$t("Yes")),3),(0,s.Lk)("button",{type:"button",class:"button is-white is-small is-rounded",onClick:t[5]||(t[5]=e=>o.confirm=!1)},(0,n.v_)(e.$t("No")),1)])):((0,s.uX)(),(0,s.CE)("button",{key:1,type:"button",class:"button is-danger is-outlined is-rounded",onClick:t[6]||(t[6]=e=>o.confirm=!0)},[(0,s.Lk)("span",F,[(0,s.bF)(p,{icon:"fa-light fa-trash"})]),(0,s.Lk)("span",null,(0,n.v_)(e.$t("Delete")),1)]))],64))]),(0,s.Lk)("div",E,[(0,s.Lk)("button",{type:"button",class:"button is-light is-rounded",disabled:o.isBusy,onClick:t[7]||(t[7]=t=>e.$emit("update:modelValue",!1))},(0,n.v_)(e.$t("cancel")),9,O),(0,s.Lk)("button",{type:"button",class:(0,n.C4)(["button is-primary is-rounded",{"is-loading":o.isBusy}]),disabled:o.isBusy,onClick:t[8]||(t[8]=(...e)=>l.save&&l.save(...e))},(0,n.v_)(l.isNew?e.$t("Create link"):e.$t("save")),11,P)])])):(0,s.Q3)("",!0)]),_:1},8,["model-value","title"])}var R=i(80762),X=i(95256),S=i(80461),U={name:"LinkEditor",components:{ItemViewModal:R.A},props:{modelValue:{type:Boolean,required:!0},link:{type:Object,default:null},linkType:{type:String,default:"invitation"},event:{type:Object,default:null},tickets:{type:Array,default:()=>[]},appHost:{type:String,default:""},workspace:{type:String,default:""},redemptions:{type:Array,default:()=>[]}},emits:["update:modelValue","saved","created"],data(){return{draft:null,errors:{},confirm:!1,isBusy:!1}},computed:{isNew(){return!this.link?.uuid},type(){return this.isNew?this.linkType:this.link.type},isInvitation(){return"invitation"===this.type},title(){return this.isNew?this.isInvitation?this.$t("Invite one person free"):this.$t("Create ticket link"):this.isInvitation?this.$t("Invitation"):this.$t("Ticket link")},activeTickets(){return this.tickets.filter(e=>!e.isArchived)},ticketName(){return(0,S.tL)(this.link,this.tickets).join(", ")},url(){return(0,S.te)(this.link,this.event?.uuid,this.appHost,this.workspace)},validTo:{get(){return this.draft.validTo?new Date(this.draft.validTo):null},set(e){this.draft.validTo=e?e.toISOString():null}}},watch:{modelValue(e){e&&this.reset()},link(e,t){this.modelValue&&e?.uuid!==t?.uuid&&this.reset()}},created(){this.modelValue&&this.reset()},methods:{linkRedemptionText:S.nA,reset(){this.errors={},this.confirm=!1;const e=new Date;e.setDate(e.getDate()+30),this.draft={ticket:1===this.activeTickets.length?this.activeTickets[0]["@id"]:null,validTo:this.link?.validTo||e.toISOString(),isActive:!this.link||!!this.link.isActive}},validate(){const e={};return this.isNew&&!this.draft.ticket&&(e.ticket=!0),(!this.draft.validTo||new Date(this.draft.validTo)<=new Date)&&(e.validTo=!0),this.errors=e,0===Object.keys(e).length}
1,copy(){(0,X.lW)(this.url),this.$buefy.toast.open({type:"is-success",message:this.$t("Link copied")})},save(){if(!this.validate())return;this.isBusy=!0;const e=this.isNew,t=this.isNew?this.$http.plain.post("/event_vouchers",{type:this.type,event:this.event["@id"],allowedTicketTypes:[this.draft.ticket],validTo:this.draft.validTo}):this.$http.plain.patch("/event_vouchers/"+this.link.uuid,{validTo:this.draft.validTo,isActive:!!this.draft.isActive});t.then(t=>{e?((0,X.lW)((0,S.te)(t.data,this.event?.uuid,this.appHost,this.workspace)),this.$buefy.toast.open({type:"is-success",message:this.$t("Link copied")})):this.$buefy.toast.open({type:"is-success",message:this.$t("updatedSuccessfully")}),this.$emit("saved",t.data),e?this.$emit("created",t.data):this.$emit("update:modelValue",!1)}).catch(e=>{console.error(e),this.$buefy.toast.open({type:"is-danger",duration:7e3,message:e.response?.data?.["hydra:description"]||e.response?.data?.detail||this.$t("Error saving voucher")})}).finally(()=>{this.isBusy=!1})},runDelete(){this.isBusy=!0,this.$http.plain.delete("/event_vouchers/"+this.link.uuid).then(()=>{this.$buefy.toast.open({type:"is-success",message:this.$t("Link deleted")}),this.$emit("saved",null),this.$emit("update:modelValue",!1)}).catch(e=>{console.error(e),this.$buefy.toast.open({type:"is-danger",duration:7e3,message:e.response?.data?.["hydra:description"]||e.response?.data?.detail||this.$t("Error deleting item")})}).finally(()=>{this.isBusy=!1,this.confirm=!1})}}},N=i(66262);const I=(0,N.A)(U,[["render",D]]);var Q=I,B=i(95352),M={name:"EventTicketingSettings",components:{TicketingBoard:m.A,TicketEditor:v.A,AddonEditor:k.A,VoucherEditor:f.A,LinkEditor:Q},data(){return{item:null,product:null,tickets:[],addons:[],vouchers:[],feeLevels:[],chapters:[],isLoading:!1,isTicketOpen:!1,isAddonOpen:!1,isVoucherOpen:!1,isLinkOpen:!1,editingTicket:null,editingAddon:null,editingVoucher:null,editingLink:null,newLinkType:"invitation",linkRedemptions:{}}},computed:{...(0,p.L8)(["user","isGrantedOwner","isGranted","tenant"]),currency(){return this.product?.currency||this.tenant?.currency},totalSold(){return this.tickets.reduce((e,t)=>e+((0,B.RI)(t.soldCount)||0),0)}},created(){this.retrieve(),this.retrieveFeeLevels()},methods:{retrieve(){this.isLoading=!0,this.$http.plain.get("/events/"+this.$route.params.item).then(e=>{this.item=e.data,this.item.settings||(this.item.settings={}),this.item.settings.singleTicketPurchase=this.item.settings.singleTicketPurchase??!1,this.item.product&&this.retrieveProduct(this.item.product.uuid||this.item.product),this.retrieveVouchers()}).catch(e=>console.log(e)).finally(()=>{this.isLoading=!1})},retrieveProduct(e){this.isLoading=!0,this.$http.plain.get("/products/"+e).then(e=>{this.product=e.data,this.tickets=this.product.productPrices||[],this.collectChapters(),this.retrieveAddons()}).catch(e=>console.log(e)).finally(()=>{this.isLoading=!1})},reloadTickets(){this.product&&this.retrieveProduct(this.product.uuid)},retrieveAddons(){this.product&&this.$http.plain.get("/product_price_addons?product="+this.product.id).then(e=>{this.addons=e.data["hydra:member"]||[]}).catch(e=>console.log(e))},retrieveVouchers(){this.item&&this.$http.plain.get("/event_vouchers?event="+this.item["@id"]).then(e=>{this.vouchers=e.data["hydra:member"]||[],this.retrieveLinkRedemptions()}).catch(e=>console.log(e))},retrieveLinkRedemptions(){const e=this.vouchers.some(e=>(0,S.kL)(e)&&(e.usedCount||0)>0);e&&this.isGranted("EVENT_TENANT")?this.$http.plain.get("/events/"+this.item.uuid+"/link-redemptions").then(e=>{this.linkRedemptions=e.data||{}}).catch(e=>{console.log(e),this.linkRedemptions={}}):this.linkRedemptions={}},retrieveFeeLevels(){const e=this.tenant?.settingFeatures?.fees?.productUuid;e?this.$http.plain.get("/products/"+e).then(e=>{this.feeLevels=(e.data.productPrices||[]).filter(e=>!e.isArchived&&!e.isDonationOption&&!e.isCustomAmount)}).catch(()=>{this.feeLevels=[]}):this.feeLevels=[]},collectChapters(){const e=new Map;this.tickets.forEach(t=>{(t.allowedLocalCenters||[]).forEach(t=>{t&&"object"===typeof t&&t.id&&e.set(t.id,{id:t.id,name:t.name})})}),this.chapters=[...e.values()]},saveSingleTicketPurchase(e){this.$http.plain.patch("/events/"+this.$route.params.item,{settings:this.item.settings}).then(()=>
1{this.$buefy.toast.open({message:this.$t("updatedSuccessfully"),type:"is-success",duration:1500})}).catch(t=>{console.log(t),this.item.settings.singleTicketPurchase=!e,this.$buefy.toast.open({message:t.response?.data?.detail||this.$t("An error occurred"),type:"is-danger",duration:3e3})})},openTicket(e){this.editingTicket=e&&e.id?e:null,this.isTicketOpen=!0},duplicateTicket(e){const t={name:e.name+" ("+this.$t("copy")+")",price:e.price,fullDescription:e.fullDescription||"",isRestricted:"members"===e.isRestricted?"members":null,allowedFeeProductPrices:(0,S.mq)(e.allowedFeeProductPrices).map(e=>"/api/v1/product_prices/"+e),allowedLocalCenters:(0,S.mq)(e.allowedLocalCenters).map(e=>"/api/v1/local_centers/"+e),maxSeats:e.maxSeats,validFrom:e.validFrom,validTo:e.validTo,displayNameOnPaymentPage:!0,product:this.product["@id"],currency:this.currency};this.isLoading=!0,this.$http.plain.post("/product_prices",t).then(()=>{this.$buefy.toast.open({type:"is-success",message:this.$t("Ticket duplicated, including its restrictions")}),this.reloadTickets()}).catch(e=>{console.log(e),this.$buefy.toast.open({type:"is-danger",message:e.response?.data?.["hydra:description"]||e.response?.data?.detail||this.$t("Error saving ticket")})}).finally(()=>{this.isLoading=!1})},archiveTicket(e,t){this.$http.plain.patch("/product_prices/"+e.id,{isArchived:t}).then(()=>{this.$buefy.toast.open({type:"is-success",message:t?this.$t("Ticket archived"):this.$t("Ticket restored")}),this.reloadTickets()}).catch(e=>{console.log(e),this.$buefy.toast.open({type:"is-danger",message:e.response?.data?.detail||this.$t("Failed to save")})})},deleteTicket(e){this.$buefy.dialog.confirm({title:this.$t("Delete ticket"),message:this.$t("Delete this ticket type? This cannot be undone."),confirmText:this.$t("Delete"),cancelText:this.$t("cancel"),type:"is-danger",onConfirm:()=>{this.$http.plain.delete("/product_prices/"+e.id).then(()=>{this.$buefy.toast.open({type:"is-success",message:this.$t("Ticket deleted")}),this.reloadTickets()}).catch(e=>{console.log(e),this.$buefy.toast.open({type:"is-danger",duration:7e3,message:e.response?.data?.["hydra:description"]||e.response?.data?.detail||this.$t("Error deleting item")})})}})},openAddon(e){this.editingAddon=e&&e.id?e:null,this.isAddonOpen=!0},archiveAddon(e,t){this.$http.plain.patch("/product_price_addons/"+e.id,{isArchived:t}).then(()=>{this.$buefy.toast.open({type:"is-success",message:t?this.$t("Add-on archived"):this.$t("Add-on restored")}),this.retrieveAddons()}).catch(e=>{console.log(e),this.$buefy.toast.open({type:"is-danger",message:e.response?.data?.detail||this.$t("Failed to save")})})},deleteAddon(e){this.$buefy.dialog.confirm({title:this.$t("Delete add-on"),message:this.$t("Delete this add-on? This cannot be undone."),confirmText:this.$t("Delete"),cancelText:this.$t("cancel"),type:"is-danger",onConfirm:()=>{this.$http.plain.delete("/product_price_addons/"+e.id).then(()=>{this.$buefy.toast.open({type:"is-success",message:this.$t("Add-on deleted")}),this.retrieveAddons()}).catch(e=>{console.log(e),this.$buefy.toast.open({type:"is-danger",duration:7e3,message:e.response?.data?.["hydra:description"]||e.response?.data?.detail||this.$t("Error deleting item")})})}})},openVoucher(e){(0,S.kL)(e)?this.openLink(e):(this.editingVoucher=e&&e.uuid?e:null,this.isVoucherOpen=!0)},openLink(e,t){this.editingLink=e&&e.uuid?e:null,this.newLinkType="ticket"===t?"ticket":"invitation",this.isLinkOpen=!0},copyLink(e){(0,X.lW)((0,S.te)(e,this.item?.uuid,this.tenant?.appHost||"",this.tenant?.slug||"")),this.$buefy.toast.open({type:"is-success",message:this.$t("Link copied")})},toggleVoucher(e,t){this.$http.plain.patch("/event_vouchers/"+e.uuid,{isActive:t}).then(()=>{this.$buefy.toast.open({type:"is-success",message:t?this.$t("Voucher activated"):this.$t("Voucher deactivated")}),this.retrieveVouchers()}).catch(e=>{console.log(e),this.$buefy.toast.open({type:"is-danger",message:e.response?.data?.detail||this.$t("Failed to save")})})},deleteVoucher(e){this.$buefy.dialog.confirm({title:this.$t("Delete voucher"),message:this.$t("Delete this voucher? Orders that already used it keep their discount."),confirmText:this.$t("Delete"),cancelText:this.$t("cancel"),type:"is-danger",onConfirm:()=>{this.$http.plain.delete("/event_vouchers/"+e.uuid).then(()=>
1{this.$buefy.toast.open({type:"is-success",message:this.$t("Voucher deleted")}),this.retrieveVouchers()}).catch(e=>{console.log(e),this.$buefy.toast.open({type:"is-danger",duration:7e3,message:e.response?.data?.["hydra:description"]||e.response?.data?.detail||this.$t("Error deleting item")})})}})}}};const K=(0,N.A)(M,[["render",h]]);var W=K},5168:function(e,t,i){i.d(t,{A:function(){return N}});var s=i(20641),n=i(90033);const a={key:0,class:"pe-layout"},o={class:"pe-section"},l={class:"pe-section-head"},r={class:"pe-row is-2"},d={class:"control"},c={class:"button is-static"},u={class:"pe-section"},h={class:"pe-section-head"},p={class:"pe-checklist"},m={class:"has-text-grey"},v={key:0,class:"help has-text-danger"},k={class:"pe-section"},f={class:"pe-section-head"},y={class:"pe-row is-2"},g={class:"pe-switch-row"},b={key:1,class:"pe-note"},$={key:1,class:"pe-footer"},L={class:"pe-footer-left"},C={key:0,class:"pe-confirm"},w=["title"],T={class:"icon is-small"},A={class:"pe-footer-right"},x=["disabled"],V=["disabled"];function _(e,t,i,_,F,E){const O=(0,s.g2)("b-input"),P=(0,s.g2)("b-field"),D=(0,s.g2)("b-checkbox"),R=(0,s.g2)("b-switch"),X=(0,s.g2)("TicketPreviewCard"),S=(0,s.g2)("PreviewAside"),U=(0,s.g2)("font-awesome-icon"),N=(0,s.g2)("ItemViewModal");return(0,s.uX)(),(0,s.Wv)(N,{"model-value":i.modelValue,title:E.title,"scroll-container-id":"addonEditorModalBody","onUpdate:modelValue":t[12]||(t[12]=t=>e.$emit("update:modelValue",t)),onClose:t[13]||(t[13]=t=>e.$emit("update:modelValue",!1))},{default:(0,s.k6)(()=>[i.modelValue&&F.draft?((0,s.uX)(),(0,s.CE)("div",a,[(0,s.Lk)("div",null,[(0,s.Lk)("div",o,[(0,s.Lk)("div",l,[(0,s.Lk)("h3",null,(0,n.v_)(e.$t("Basics")),1)]),(0,s.Lk)("div",r,[(0,s.bF)(P,{label:e.$t("Name"),type:F.errors.name?"is-danger":"",message:F.errors.name?e.$t("Give the add-on a name."):""},{default:(0,s.k6)(()=>[(0,s.bF)(O,{modelValue:F.draft.name,"onUpdate:modelValue":t[0]||(t[0]=e=>F.draft.name=e),placeholder:e.$t("e.g. Partner seat, Wine pairing, Parking"),required:""},null,8,["modelValue","placeholder"])]),_:1},8,["label","type","message"]),(0,s.bF)(P,{label:e.$t("Price"),type:F.errors.price?"is-danger":"",message:F.errors.price?e.$t("Enter a price, or 0."):E.locked?e.$t("Locked after the first sale."):e.$t("0 makes it a free extra.")},{default:(0,s.k6)(()=>[(0,s.bF)(P,null,{default:(0,s.k6)(()=>[(0,s.bF)(O,{modelValue:F.draft.price,"onUpdate:modelValue":t[1]||(t[1]=e=>F.draft.price=e),type:"number",step:"0.01",min:"0",disabled:E.locked,expanded:""},null,8,["modelValue","disabled"]),(0,s.Lk)("p",d,[(0,s.Lk)("span",c,(0,n.v_)(E.currencyLabel),1)])]),_:1})]),_:1},8,["label","type","message"])]),(0,s.bF)(P,{label:e.$t("Description")+" ("+e.$t("optional")+")"},{default:(0,s.k6)(()=>[(0,s.bF)(O,{modelValue:F.draft.description,"onUpdate:modelValue":t[2]||(t[2]=e=>F.draft.description=e),type:"textarea",rows:"2"},null,8,["modelValue"])]),_:1},8,["label"])]),(0,s.Lk)("div",u,[(0,s.Lk)("div",h,[(0,s.Lk)("h3",null,(0,n.v_)(e.$t("Offered with")),1),(0,s.Lk)("p",null,(0,n.v_)(E.locked?e.$t("Locked after the first sale."):e.$t("Tick the tickets this add-on appears under.")),1)]),(0,s.Lk)("div",p,[((0,s.uX)(!0),(0,s.CE)(s.FK,null,(0,s.pI)(E.activeTickets,e=>((0,s.uX)(),(0,s.Wv)(D,{key:E.ticketKeyOf(e),"model-value":F.draft.tickets.includes(E.ticketKeyOf(e)),disabled:E.locked,"onUpdate:modelValue":t=>E.toggleTicket(E.ticketKeyOf(e),t)},{default:(0,s.k6)(()=>[(0,s.eW)((0,n.v_)(e.name)+" ",1),(0,s.Lk)("span",m,"· "+(0,n.v_)(E.money(e.price)),1)]),_:2},1032,["model-value","disabled","onUpdate:modelValue"]))),128))]),F.errors.tickets?((0,s.uX)(),(0,s.CE)("p",v,(0,n.v_)(e.$t("Pick at least one ticket.")),1)):(0,s.Q3)("",!0)]),(0,s.Lk)("div",k,[(0,s.Lk)("div",f,[(0,s.Lk)("h3",null,(0,n.v_)(e.$t("Limits")),1)]),(0,s.Lk)("div",y,[(0,s.bF)(P,{label:e.$t("Max per ticket"),message:e.$t("How many of these one ticket can add.")},{default:(0,s.k6)(()=>[(0,s.bF)(O,{modelValue:F.draft.maxQuantityPerTicket,"onUpdate:modelValue":t[3]||(t[3]=e=>F.draft.maxQuantityPerTicket=e),type:"number",min:"1",placeholder:e.$t("Unlimited")},null,8,["modelValue","placeholder"])]),_:1},8,["label","message"]),(0,s.bF)(P,{label:e.$t("Total available"),type:F.errors.total?"is-danger":"",message:F.errors.total?e.$t("{n} already sold, so the minimum is {n}.",{n:E.soldCount}):"draft"===i.mode?e.$t("Across the whole event."):e.$t("Across the whole event. {n} sold so far.",{n:E.soldCount})},{default:(0,s.k6)(()=>[(0,s.bF)(O,{modelValue:F.draft.maxTotal,"onUpdate:modelValue":t[4]||(t[4]=e=>F.draft.maxTotal=e),type:"number",min:E.soldCount,placeholder:e.$t("Unlimited")},null,8,["modelValue","min","placeholder"])]),_:1},8,["label","type","message"])]),(0,s.Lk)("div",g,[(0,s.Lk)("div",null,[(0,s.Lk)("b",null,(0,n.v_)(e.$t("Adds a separate attendee")),1),(0,s.Lk)("span",null,(0,n.v_)(e.$t("The buyer fills in a name for each one; they get their own badge and check-in. Use it for partner or child seats, not for meals or parking.")),1)]),(0,s.bF)(R,{modelValue:F.draft.createsAttendee,"onUpdate:modelValue":t[5]||(t[5]=e=>F.draft.createsAttendee=e),disabled:E.locked},null,8,["modelValue","disabled"])])])]),(0,s.bF)(S,{summary:E.summary,"preview-title":e.$t("How buyers see it"),currency:E.currency},{preview:(0,s.k6)(()=>[E.previewTicket?((0,s.uX)(),(0,s.Wv)(X,{key:0,ticket:E.previewTicket,addon:F.draft,currency:E.currency,selected:""},null,8,["ticket","addon","currency"])):((0,s.uX)(),(0,s.CE)("p",b,(0,n.v_)(e.$t("Add a ticket first.")),1))]),_:1},8,["summary","preview-title","currency"])])):(0,s.Q3)("",!0),i.modelValue&&F.draft?((0,s.uX)(),(0,s.CE)("div",$,[(0,s.Lk)("div",L,[E.isNew?(0,s.Q3)("",!0):((0,s.uX)(),(0,s.CE)(s.FK,{key:0},[F.confirm?((0,s.uX)(),(0,s.CE)("span",C,[(0,s.eW)((0,n.v_)("ar
1chive"===F.confirm?e.$t("Archive this add-on? Existing sales are kept; nobody can buy it."):"restore"===F.confirm?e.$t("Restore it?"):e.$t("Delete permanently?"))+" ",1),(0,s.Lk)("button",{type:"button",class:(0,n.C4)(["button is-danger is-small is-rounded",{"is-loading":F.isBusy}]),onClick:t[6]||(t[6]=(...e)=>E.runDanger&&E.runDanger(...e))},(0,n.v_)(e.$t("Yes")),3),(0,s.Lk)("button",{type:"button",class:"button is-white is-small is-rounded",onClick:t[7]||(t[7]=e=>F.confirm=null)},(0,n.v_)(e.$t("No")),1)])):((0,s.uX)(),(0,s.CE)(s.FK,{key:1},["live"===i.mode?((0,s.uX)(),(0,s.CE)("button",{key:0,type:"button",class:"button is-white is-rounded has-text-danger",onClick:t[8]||(t[8]=e=>F.confirm=F.draft.isArchived?"restore":"archive")},(0,n.v_)(F.draft.isArchived?e.$t("Restore"):e.$t("Archive")),1)):(0,s.Q3)("",!0),E.soldCount>0&&"live"===i.mode?((0,s.uX)(),(0,s.CE)("button",{key:1,type:"button",class:"button is-white is-rounded",disabled:"",title:e.$t("Has sales")},[(0,s.Lk)("span",T,[(0,s.bF)(U,{icon:"fa-light fa-lock"})]),(0,s.Lk)("span",null,(0,n.v_)(e.$t("Delete")),1)],8,w)):((0,s.uX)(),(0,s.CE)("button",{key:2,type:"button",class:"button is-white is-rounded has-text-danger",onClick:t[9]||(t[9]=e=>F.confirm="delete")},(0,n.v_)(e.$t("Delete")),1))],64))],64))]),(0,s.Lk)("div",A,[(0,s.Lk)("button",{type:"button",class:"button is-light is-rounded",disabled:F.isBusy,onClick:t[10]||(t[10]=t=>e.$emit("update:modelValue",!1))},(0,n.v_)(e.$t("cancel")),9,x),(0,s.Lk)("button",{type:"button",class:(0,n.C4)(["button is-primary is-rounded",{"is-loading":F.isBusy}]),disabled:F.isBusy,onClick:t[11]||(t[11]=(...e)=>E.save&&E.save(...e))},(0,n.v_)(E.isNew?"draft"===i.mode?e.$t("Add to template"):e.$t("Add add-on"):e.$t("Save add-on")),11,V)])])):(0,s.Q3)("",!0)]),_:1},8,["model-value","title"])}i(44114),i(18111),i(22489),i(20116),i(61701);var F=i(40834),E=i(80762),O=i(27587),P=i(8382),D=i(95352),R=i(80461),X={name:"AddonEditor",components:{ItemViewModal:E.A,PreviewAside:O.A,TicketPreviewCard:P.A},props:{modelValue:{type:Boolean,required:!0},mode:{type:String,default:"live"},addon:{type:Object,default:null},tickets:{type:Array,default:()=>[]},product:{type:Object,default:null}},emits:["update:modelValue","saved","save","remove"],data(){return{draft:null,errors:{},confirm:null,isBusy:!1}},computed:{...(0,F.L8)(["tenant"]),isNew(){return!this.addon||("live"===this.mode?!this.addon.id:!this.addon.key)},title(){return this.isNew?this.$t("New add-on"):this.$t("Edit add-on")+(this.draft?.name?" · "+this.draft.name:"")},currency(){return this.product?.currency||this.tenant?.currency},currencyLabel(){return(this.currency||"").toUpperCase()},soldCount(){return"live"===this.mode&&(0,D.RI)(this.addon?.soldCount)||0},locked(){return this.soldCount>0},activeTickets(){return this.tickets.filter(e=>!e.isArchived)},previewTicket(){return this.activeTickets.find(e=>this.draft.tickets.includes(this.ticketKeyOf(e)))||this.activeTickets[0]||null},summary(){const e=this.tickets.map(e=>({id:e.id,key:e.key,name:e.name})),t="draft"===this.mode?{...this.draft,ticketKeys:this.draft.tickets}:{...this.draft,productPrices:this.draft.tickets,soldCount:this.soldCount};return(0,R.JD)({addon:t,tickets:e,currency:this.currency,mode:this.mode},this.$t.bind(this))}},watch:{modelValue(e){e&&this.reset()}},created(){this.modelValue&&this.reset()},methods:{money(e){return(0,D.up)(e,this.currency,this.$t.bind(this))},ticketKeyOf(e){return"draft"===this.mode?e.key:e["@id"]},reset(){this.errors={},this.confirm=null;const e=this.addon?JSON.parse(JSON.stringify(this.addon)):{},t="draft"===this.mode?[...e.ticketKeys||[]]:(e.productPrices||[]).map(e=>"string"===typeof e?e:e["@id"]).filter(Boolean);this.draft={name:e.name||"",description:e.description||"",price:e.price??0,maxQuantityPerTicket:e.maxQuantityPerTicket??1,maxTotal:e.maxTotal??null,createsAttendee:!!e.createsAttendee,isArchived:!!e.isArchived,tickets:this.isNew?this.activeTickets.map(e=>this.ticketKeyOf(e)):t}},toggleTicket(e,t){const i=this.draft.tickets.indexOf(e);t&&i<0&&this.draft.tickets.push(e),!t&&i>=0&&this.draft.tickets.splice(i,1)},validate(){const e={};(this.draft.name||"").trim()||(e.name=!0);const t=(0,D.Ro)(this.draft.price);(null===t||t<0)&&(e.price=!0),this.draft.tickets.length||(e.tickets=!0);const i=(0,D.RI)(this.draft.maxTotal);return null!==i&&i<this.soldCount&&(e.total=!0),this.errors=e,!Object.keys(e).length||(this.$buefy.toast.o
1pen({type:"is-danger",message:this.$t("Fix the highlighted fields")}),!1)},save(){if(!this.validate())return;const e=this.draft,t=(0,D.RI)(e.maxQuantityPerTicket),i={name:e.name.trim(),description:e.description||null,price:(0,D.Ro)(e.price)||0,maxQuantityPerTicket:t&&t>0?t:null,maxTotal:(0,D.RI)(e.maxTotal),createsAttendee:!!e.createsAttendee};if("draft"===this.mode)return this.$emit("save",{...this.addon,...i,key:this.addon?.key||(0,R.bO)(),ticketKeys:[...e.tickets]}),void this.$emit("update:modelValue",!1);let s;if(this.isBusy=!0,this.isNew)s=this.$http.plain.post("/product_price_addons",{...i,productPrices:[...e.tickets],currency:this.currency,sortOrder:null});else{const t={...i,isArchived:!!e.isArchived};this.locked?delete t.price:t.productPrices=[...e.tickets],s=this.$http.plain.patch("/product_price_addons/"+this.addon.id,t)}s.then(e=>{this.$buefy.toast.open({type:"is-success",message:this.isNew?this.$t("Add-on added"):this.$t("Add-on saved")}),this.$emit("saved",e.data),this.$emit("update:modelValue",!1)}).catch(e=>{console.error(e),this.$buefy.toast.open({type:"is-danger",duration:7e3,message:e.response?.data?.["hydra:description"]||e.response?.data?.detail||this.$t("Error saving add-on")})}).finally(()=>{this.isBusy=!1})},runDanger(){if("draft"===this.mode)return this.$emit("remove",this.addon),this.$emit("update:modelValue",!1),void(this.confirm=null);this.isBusy=!0;const e="delete"===this.confirm?this.$http.plain.delete("/product_price_addons/"+this.addon.id):this.$http.plain.patch("/product_price_addons/"+this.addon.id,{isArchived:"archive"===this.confirm});e.then(()=>{this.$buefy.toast.open({type:"is-success",message:"delete"===this.confirm?this.$t("Add-on deleted"):"archive"===this.confirm?this.$t("Add-on archived"):this.$t("Add-on restored")}),this.$emit("saved",null),this.$emit("update:modelValue",!1)}).catch(e=>{console.error(e),this.$buefy.toast.open({type:"is-danger",duration:7e3,message:e.response?.data?.["hydra:description"]||e.response?.data?.detail||this.$t("Error deleting item")})}).finally(()=>{this.isBusy=!1,this.confirm=null})}}},S=i(66262);const U=(0,S.A)(X,[["render",_]]);var N=U},8382:function(e,t,i){i.d(t,{A:function(){return y}});var s=i(20641),n=i(90033);const a={class:"tk-top"},o={class:"tk-price"},l={key:0,class:"tk-desc"},r={key:1,class:"tk-lock"},d={key:2,class:"tk-line"},c={key:0,class:"has-text-grey"},u={key:3,class:"tag is-danger is-light is-rounded is-small"},h={key:4,class:"tk-qty"};function p(e,t,i,p,m,v){const k=(0,s.g2)("font-awesome-icon");return(0,s.uX)(),(0,s.CE)("div",{class:(0,n.C4)(["tk-card",{"is-selected":i.selected,"is-dim":i.dim}])},[(0,s.Lk)("div",a,[(0,s.Lk)("b",null,(0,n.v_)(i.ticket.name||e.$t("Untitled ticket")),1),(0,s.Lk)("span",o,(0,n.v_)(v.money(i.ticket.price)),1)]),i.ticket.fullDescription?((0,s.uX)(),(0,s.CE)("p",l,(0,n.v_)(i.ticket.fullDescription),1)):(0,s.Q3)("",!0),i.audienceText?((0,s.uX)(),(0,s.CE)("p",r,[(0,s.bF)(k,{icon:"fa-light fa-lock"}),(0,s.eW)(" "+(0,n.v_)(i.audienceText),1)])):(0,s.Q3)("",!0),i.addon?((0,s.uX)(),(0,s.CE)("div",d,[(0,s.Lk)("span",null,[(0,s.eW)(" + "+(0,n.v_)(i.addon.name||e.$t("Add-on"))+" ",1),i.addon.maxQuantityPerTicket?((0,s.uX)(),(0,s.CE)("span",c," ("+(0,n.v_)(e.$t("max {n}",{n:i.addon.maxQuantityPerTicket}))+") ",1)):(0,s.Q3)("",!0)]),(0,s.Lk)("span",null,(0,n.v_)(v.money(i.addon.price)),1)])):(0,s.Q3)("",!0),v.soldOut?((0,s.uX)(),(0,s.CE)("span",u,(0,n.v_)(e.$t("Sold out")),1)):((0,s.uX)(),(0,s.CE)("span",h," â Â 1Â + "))],2)}var m=i(95352),v={name:"TicketPreviewCard",props:{ticket:{type:Object,required:!0},addon:{type:Object,default:null},currency:{type:String,default:null},audienceText:{type:String,default:""},selected:{type:Boolean,default:!1},dim:{type:Boolean,default:!1}},computed:{soldOut(){const e=(0,m.RI)(this.ticket.maxSeats);return null!==e&&((0,m.RI)(this.ticket.soldCount)||0)>=e}},methods:{money(e){const t=(0,m.Ro)(e);return null===t||0===t?this.$t("Free"):(0,m.up)(t,this.currency,this.$t.bind(this))}}},k=i(66262);const f=(0,k.A)(v,[["render",p]]);var y=f},15591:function(e,t,i){i.d(t,{A:function(){return M}});var s=i(20641),n=i(90033);const a={key:0,class:"pe-layout"},o={class:"pe-section"},l={class:"pe-section-head"},r={class:"pe-row is-2"},d={class:"control"},c={class:"button is-static"},u={class:"pe-section"},h={class:"pe-section-head"},p={key:0},m={key:0,class:"pe-sub"},v={class:"pe-checklist"},k={key:2,class:"help"},f={class:"pe-section"},y={class:"pe-section-head"},g={class:"pe-row is-2"},b={key:0,class:"pe-section"},$={class:"pe-section-head"},L={class:"pe-row is-2"},C={key:1,class:"pe-footer"},w={class:"pe-footer-left"},T={key:0,class:"pe-confirm"},A=["title"],x={class:"icon is-small"},V={class:"pe-footer-right"},_=["disabled"],F=["disabled"];function E(e,t,i,E,O,P){const D=(0,s.g2)("b-input"),R=(0,s.g2)("b-field"),X=(0,s.g2)("SegmentedChoice"),S=(0,s.g2)("b-checkbox"),U=(0,s.g2)("LocalCenterSelect"),N=(0,s.g2)("b-datetimepicker"),I=(0,s.g2)("TicketPreviewCard"),Q=(0,s.g2)("PreviewAside"),B=(0,s.g2)("font-awesome-icon"),M=(0,s.g2)("ItemViewModal");return(0,s.uX)(),(0,s.Wv)(M,{"model-value":i.modelValue,title:P.title,"scroll-container-id":"ticketEditorModalBody","onUpdate:modelValue":t[13]||(t[13]=t=>e.$emit("update:modelValue",t)),onClose:t[14]||(t[14]=t=>e.$emit("update:modelValue",!1))},{default:(0,s.k6)(()=>[i.modelValue&&O.draft?((0,s.uX)(),(0,s.CE)("div",a,[(0,s.Lk)("div",null,[(0,s.Lk)("div",o,[(0,s.Lk)("div",l,[(0,s.Lk)("h3",null,(0,n.v_)(e.$t("Basics")),1)]),(0,s.Lk)("div",r,[(0,s.bF)(R,{label:e.$t("Name"),type:O.errors.name?"is-danger":"",message:O.errors.name?e.$t("Give the ticket a name."):""},{default:(0,s.k6)(()=>[(0,s.bF)(D,{modelValue:O.draft.name,"onUpdate:modelValue":t[0]||(t[0]=e=>O.draft.name=e),placeholder:e.$t("e.g. Member, Guest, Early bird"),required:""},null,8,["modelValue","placeholder"])]),_:1},8,["label","type","message"]),(0,s.bF)(R,{label:e.$t("Price"),type:O.errors.price?"is-danger":"",message:O.errors.price?e.$t("Enter a price, or 0 for free."):P.priceLocked?e.$t("Locked after the first sale. Archive this ticket and add a new one to change the price."):e.$t("Leave at 0 for a free ticket.")},{default:(0,s.k6)(()=>[(0,s.bF)(R,null,{default:(0,s.k6)(()=>[(0,s.bF)(D,{modelValue:O.draft.price,"onUpdate:modelValue":t[1]||(t[1]=e=>O.draft.price=e),type:"number",step:"0.01",min:"0",disabled:P.priceLocked,expanded:""},null,8,["modelValue","disabled"]),(0,s.Lk)("p",d,[(0,s.Lk)("span",c,(0,n.v_)(P.currencyLabel),1)])]),_:1})]),_:1},8,["label","type","message"])]),(0,s.bF)(R,{label:e.$t("Description")+" ("+e.$t("optional")+")"},{default:(0,s.k6)(()=>[(0,s.bF)(D,{modelValue:O.draft.fullDescription,"onUpdate:modelValue":t[2]||(t[2]=e=>O.draft.fullDescription=e),type:"textarea",rows:"2",placeholder:e.$t("What is included")},null,8,["modelValue","placeholder"])]),_:1},8,["label"])]),(0,s.Lk)("div",u,[(0,s.Lk)("div",h,[(0,s.Lk)("h3",null,(0,n.v_)(e.$t("Who can buy it")),1),P.membersOnlyEvent?((0,s.uX)(),(0,s.CE)("p",p,(0,n.v_)(e.$t("This event is not public, so tickets are members only. Make the event public to open a ticket to guests.")),1)):(0,s.Q3)("",!0)]),(0,s.bF)(X,{"model-value":P.audie
1nce,options:P.audienceOptions,name:e.$t("Who can buy it"),"onUpdate:modelValue":P.pickAudience},null,8,["model-value","options","name","onUpdate:modelValue"]),"specific"===P.audience?((0,s.uX)(),(0,s.CE)("div",m,[P.hasLevels?((0,s.uX)(),(0,s.Wv)(R,{key:0,label:e.$t("Membership levels"),message:e.$t("Members on any ticked level qualify.")+(P.hasChapters?" "+e.$t("Nothing ticked means every level."):"")},{default:(0,s.k6)(()=>[(0,s.Lk)("div",v,[((0,s.uX)(!0),(0,s.CE)(s.FK,null,(0,s.pI)(i.levels,e=>((0,s.uX)(),(0,s.Wv)(S,{key:e.id,"model-value":O.draft.allowedFeeProductPrices.includes(e["@id"]),"onUpdate:modelValue":t=>P.toggleRef("allowedFeeProductPrices",e["@id"],t)},{default:(0,s.k6)(()=>[(0,s.eW)((0,n.v_)(e.name),1)]),_:2},1032,["model-value","onUpdate:modelValue"]))),128))])]),_:1},8,["label","message"])):(0,s.Q3)("",!0),P.hasChapters?((0,s.uX)(),(0,s.Wv)(U,{key:1,modelValue:O.draft.allowedLocalCenters,"onUpdate:modelValue":t[3]||(t[3]=e=>O.draft.allowedLocalCenters=e),label:e.$t("Chapters"),multiple:"","auto-load":""},null,8,["modelValue","label"])):(0,s.Q3)("",!0),P.hasChapters?((0,s.uX)(),(0,s.CE)("p",k,(0,n.v_)(e.$t("Members of a ticked chapter or its sub-chapters qualify."))+" "+(0,n.v_)(P.hasLevels?e.$t("Nothing ticked means every chapter."):""),1)):(0,s.Q3)("",!0),(0,s.Lk)("p",{class:(0,n.C4)(["help",{"has-text-danger":O.errors.specific}])},(0,n.v_)(O.errors.specific?P.specificError:P.hasLevels&&P.hasChapters?e.$t("Both ticked: the member must match a level AND a chapter."):""),3)])):(0,s.Q3)("",!0)]),(0,s.Lk)("div",f,[(0,s.Lk)("div",y,[(0,s.Lk)("h3",null,(0,n.v_)(e.$t("Capacity")),1)]),(0,s.Lk)("div",g,[(0,s.bF)(R,{label:e.$t("Seats"),type:O.errors.seats?"is-danger":"",message:O.errors.seats||P.soldCount>0?e.$t("{n} already sold, so the minimum is {n}.",{n:P.soldCount}):e.$t("Leave empty for unlimited.")},{default:(0,s.k6)(()=>[(0,s.bF)(D,{modelValue:O.draft.maxSeats,"onUpdate:modelValue":t[4]||(t[4]=e=>O.draft.maxSeats=e),type:"number",min:P.soldCount,step:"1",placeholder:e.$t("Unlimited")},null,8,["modelValue","min","placeholder"])]),_:1},8,["label","type","message"])])]),"live"===i.mode?((0,s.uX)(),(0,s.CE)("div",b,[(0,s.Lk)("div",$,[(0,s.Lk)("h3",null,(0,n.v_)(e.$t("Sales window")),1),(0,s.Lk)("p",null,(0,n.v_)(e.$t("Outside this window the ticket shows as not yet on sale or sales ended. Leave both empty to sell while registration is open.")),1)]),(0,s.Lk)("div",L,[(0,s.bF)(R,{label:e.$t("On sale from")},{default:(0,s.k6)(()=>[(0,s.bF)(N,{modelValue:P.validFrom,"onUpdate:modelValue":t[5]||(t[5]=e=>P.validFrom=e),placeholder:e.$t("Click to select..."),"min-datetime":P.minDatetime,"max-datetime":P.maxDatetime,timepicker:{hourFormat:"24"},icon:"calendar","append-to-body":"",editable:"",expanded:""},null,8,["modelValue","placeholder","min-datetime","max-datetime"])]),_:1},8,["label"]),(0,s.bF)(R,{label:e.$t("On sale until"),type:O.errors.window?"is-danger":"",message:O.errors.window?e.$t("The end must come after the start."):""},{default:(0,s.k6)(()=>[(0,s.bF)(N,{modelValue:P.validTo,"onUpdate:modelValue":t[6]||(t[6]=e=>P.validTo=e),placeholder:e.$t("Click to select..."),"min-datetime":P.validFrom||P.minDatetime,"max-datetime":P.maxDatetime,timepicker:{hourFormat:"24"},icon:"calendar","append-to-body":"",editable:"",expanded:""},null,8,["modelValue","placeholder","min-datetime","max-datetime"])]),_:1},8,["label","type","message"])])])):(0,s.Q3)("",!0)]),(0,s.bF)(Q,{summary:P.summary,"preview-title":e.$t("How buyers see it"),currency:P.currency},{preview:(0,s.k6)(()=>[(0,s.bF)(I,{ticket:O.draft,currency:P.currency,"audience-text":P.audiencePreview,selected:""},null,8,["ticket","currency","audience-text"])]),_:1},8,["summary","preview-title","currency"])])):(0,s.Q3)("",!0),i.modelValue&&O.draft?((0,s.uX)(),(0,s.CE)("div",C,[(0,s.Lk)("div",w,[P.isNew?(0,s.Q3)("",!0):((0,s.uX)(),(0,s.CE)(s.FK,{key:0},[O.confirm?((0,s.uX)(),(0,s.CE)("span",T,[(0,s.eW)((0,n.v_)("archive"===O.confirm?e.$t("Archive this ticket? Existing sales are kept; nobody can buy it."):"restore"===O.confirm?e.$t("Restore this ticket?"):e.$t("Delete permanently?"))+" ",1),(0,s.Lk)("button",{type:"button",class:(0,n.C4)(["button is-danger is-small is-rounded",{"is-loading":O.isBusy}]),onClick:t[7]||(t[7]=(...e)=>P.runDanger&&P.runDanger(...e))},(0,n.v_)(e.$t("Yes")),3),(0,s.Lk)("button",{type:"button",class:"button is-white is-small is-rounded",onClick:t[8]||(t[8]=e=>O.confirm=null)},(0,n.v_)(e.$t("No")),1)])):((0,s.uX)(),(0,s.CE)(s.FK,{key:1}
1,["live"===i.mode?((0,s.uX)(),(0,s.CE)("button",{key:0,type:"button",class:"button is-white is-rounded has-text-danger",onClick:t[9]||(t[9]=e=>O.confirm=O.draft.isArchived?"restore":"archive")},(0,n.v_)(O.draft.isArchived?e.$t("Restore"):e.$t("Archive")),1)):(0,s.Q3)("",!0),P.soldCount>0&&"live"===i.mode?((0,s.uX)(),(0,s.CE)("button",{key:1,type:"button",class:"button is-white is-rounded",disabled:"",title:e.$t("Has sales")},[(0,s.Lk)("span",x,[(0,s.bF)(B,{icon:"fa-light fa-lock"})]),(0,s.Lk)("span",null,(0,n.v_)(e.$t("Delete")),1)],8,A)):((0,s.uX)(),(0,s.CE)("button",{key:2,type:"button",class:"button is-white is-rounded has-text-danger",onClick:t[10]||(t[10]=e=>O.confirm="delete")},(0,n.v_)(e.$t("Delete")),1))],64))],64))]),(0,s.Lk)("div",V,[(0,s.Lk)("button",{type:"button",class:"button is-light is-rounded",disabled:O.isBusy,onClick:t[11]||(t[11]=t=>e.$emit("update:modelValue",!1))},(0,n.v_)(e.$t("cancel")),9,_),(0,s.Lk)("button",{type:"button",class:(0,n.C4)(["button is-primary is-rounded",{"is-loading":O.isBusy}]),disabled:O.isBusy,onClick:t[12]||(t[12]=(...e)=>P.save&&P.save(...e))},(0,n.v_)(P.isNew?"draft"===i.mode?e.$t("Add to template"):e.$t("Add ticket"):e.$t("Save ticket")),11,F)])])):(0,s.Q3)("",!0)]),_:1},8,["model-value","title"])}i(44114),i(18111),i(22489),i(61701);var O=i(40834),P=i(80762),D=i(50681),R=i(27587),X=i(29025),S=i(8382),U=i(95352),N=i(80461),I={name:"TicketEditor",components:{ItemViewModal:P.A,SegmentedChoice:D.A,PreviewAside:R.A,LocalCenterSelect:X.A,TicketPreviewCard:S.A},props:{modelValue:{type:Boolean,required:!0},mode:{type:String,default:"live"},ticket:{type:Object,default:null},event:{type:Object,default:null},product:{type:Object,default:null},levels:{type:Array,default:()=>[]},chapters:{type:Array,default:()=>[]}},emits:["update:modelValue","saved","save","remove"],data(){return{draft:null,errors:{},confirm:null,isBusy:!1,specific:!1}},computed:{...(0,O.L8)(["tenant"]),isNew(){return!this.ticket||("live"===this.mode?!this.ticket.id:!this.ticket.key)},title(){return this.isNew?this.$t("New ticket"):this.$t("Edit ticket")+(this.draft?.name?" · "+this.draft.name:"")},currency(){return this.product?.currency||this.tenant?.currency},currencyLabel(){return(this.currency||"").toUpperCase()},hasChapters(){return!!this.tenant?.settingFeatures?.localCenter?.isActive},hasLevels(){return this.levels.length>0},membersOnlyEvent(){return"live"===this.mode&&!!this.event&&!this.event.isPublic},soldCount(){return"live"===this.mode&&(0,U.RI)(this.ticket?.soldCount)||0},priceLocked(){return this.soldCount>0},audience(){return this.specific&&"members"===this.draft.isRestricted&&(this.hasLevels||this.hasChapters)?"specific":(0,N.b8)(this.draft,{hasLevels:this.hasLevels,hasChapters:this.hasChapters})},audienceOptions(){const e=[{value:"all",label:this.$t("Everyone"),description:this.$t("Guests and members, no account needed."),disabled:this.membersOnlyEvent,disabledReason:this.$t("The event is not public")},{value:"members",label:this.$t("All members"),description:this.$t("Any signed-in member. Hidden from guests.")}];return(this.hasLevels||this.hasChapters)&&e.push({value:"specific",label:this.$t("Specific members"),description:this.hasLevels&&this.hasChapters?this.$t("Only certain membership levels or chapters."):this.hasLevels?this.$t("Only certain membership levels."):this.$t("Only certain chapters.")}),e},specificError(){return this.hasLevels&&this.hasChapters?this.$t("Tick at least one level or chapter, or choose All members."):this.hasLevels?this.$t("Tick at least one level, or choose All members."):this.$t("Tick at least one chapter, or choose All members.")},summaryContext(){return{levels:this.levelCatalogue,chapters:this.chapters,hasLevels:this.hasLevels,hasChapters:this.hasChapters}},levelCatalogue(){return this.levels.map(e=>({id:e.id,name:e.name}))},audiencePreview(){const e=this.audience;if("all"===e)return"";const t=(0,N.Gk)(this.draft,this.summaryContext,this.$t.bind(this));return"members"===e?this.$t("Members only"):this.$t("For {who}",{who:t.replace(this.$t("Specific members")+" · ","")})},summary(){return(0,N.jy)({ticket:{...this.draft,soldCount:this.soldCount},currency:this.currency,...this.summaryContext,mode:this.mode},this.$t.bind(this))},minDatetime(){return this.event?.dateCreated?new Date(this.event.dateCreated):null},maxDatetime(){return this.event?.dateTimeEnd?new Date(this.event.dateTimeEnd):this.event?.dateTimeBegin?new Date(this.event.dateTimeBegin):null},validFrom:{get(){return this.draft.validFrom?new Date(this.draft.validFrom):null},set(e){this.draft.validFrom=e?e.toISOString():null}},validTo:{get(){return this.draft.validTo?new Date(this.draft.validTo):null},set(e){this.draft.validTo=e?e.toISOString():null}}},watch:{modelValue(e){e&&this.reset()}},created(){this.modelValue&&this.reset()},methods:{reset(){this.errors={},this.confirm=null;const e=this.ticket?JSON.parse(JSON.stringify(this.ticket)):{},t={name:"",price:0,fullDescription:"",isRestricted:this.membersOnlyEvent?"members":null,allowedFeeProductPrices:[],allowedLocalCenters:[],maxSeats:null,validFrom:null,validTo:null,isArchived:!1,...e};!0===t.isRestricted&&(t.isRestricted="members"),"members"!==t.isRestricted&&(t.isRestricted=null),this.membersOnlyEvent&&(t.isRestricted="members"),t.allowedFeeProductPrices=(t.allowedFeeProductPrices||[]).map(e=>
1"string"===typeof e?e:e["@id"]).filter(Boolean),t.allowedLocalCenters=(t.allowedLocalCenters||[]).map(e=>"string"===typeof e?e:e["@id"]).filter(Boolean),null!==t.fullDescription&&void 0!==t.fullDescription||(t.fullDescription=t.description||""),delete t.product,delete t.addons,delete t.activeAddons,delete t.productPriceVariationValues,this.draft=t,this.specific="specific"===(0,N.b8)(t,{hasLevels:this.hasLevels,hasChapters:this.hasChapters})},pickAudience(e){"all"===e?(this.draft.isRestricted=null,this.draft.allowedFeeProductPrices=[],this.draft.allowedLocalCenters=[],this.specific=!1):"members"===e?(this.draft.isRestricted="members",this.draft.allowedFeeProductPrices=[],this.draft.allowedLocalCenters=[],this.specific=!1):(this.draft.isRestricted="members",this.specific=!0),this.errors={}},toggleRef(e,t,i){const s=this.draft[e],n=s.indexOf(t);i&&n<0&&s.push(t),!i&&n>=0&&s.splice(n,1)},validate(){const e={};(this.draft.name||"").trim()||(e.name=!0);const t=(0,U.Ro)(this.draft.price);(null===t||t<0)&&(e.price=!0),"specific"!==this.audience||(0,N.mq)(this.draft.allowedFeeProductPrices).length||(0,N.mq)(this.draft.allowedLocalCenters).length||(e.specific=!0);const i=(0,U.RI)(this.draft.maxSeats);return null!==i&&i<this.soldCount&&(e.seats=!0),this.draft.validFrom&&this.draft.validTo&&new Date(this.draft.validTo)<new Date(this.draft.validFrom)&&(e.window=!0),this.errors=e,!Object.keys(e).length||(this.$buefy.toast.open({type:"is-danger",message:this.$t("Fix the highlighted fields")}),!1)},buildPayload(){const e=this.draft,t="members"===e.isRestricted;return{name:e.name.trim(),price:(0,U.Ro)(e.price)||0,fullDescription:e.fullDescription||"",isRestricted:t?"members":null,allowedFeeProductPrices:t&&this.hasLevels?[...e.allowedFeeProductPrices]:[],allowedLocalCenters:t&&this.hasChapters?[...e.allowedLocalCenters]:[],maxSeats:(0,U.RI)(e.maxSeats),validFrom:e.validFrom||null,validTo:e.validTo||null,displayNameOnPaymentPage:!0}},save(){if(!this.validate())return;const e=this.buildPayload();if("draft"===this.mode){const t=this.ticket?.key||(0,N.bO)();return delete e.validFrom,delete e.validTo,this.$emit("save",{...this.ticket,...e,key:t}),void this.$emit("update:modelValue",!1)}this.isBusy=!0;const t=this.isNew?this.$http.plain.post("/product_prices",{...e,product:this.product["@id"],currency:this.currency}):this.$http.plain.patch("/product_prices/"+this.ticket.id,e);t.then(e=>{this.$buefy.toast.open({type:"is-success",message:this.isNew?this.$t("Ticket added"):this.$t("Ticket saved")}),this.$emit("saved",e.data),this.$emit("update:modelValue",!1)}).catch(e=>{console.error(e),this.$buefy.toast.open({type:"is-danger",duration:7e3,message:e.response?.data?.["hydra:description"]||e.response?.data?.detail||this.$t("Error saving ticket")})}).finally(()=>{this.isBusy=!1})},runDanger(){if("draft"===this.mode)return this.$emit("remove",this.ticket),this.$emit("update:modelValue",!1),void(this.confirm=null);this.isBusy=!0;const e="delete"===this.confirm?this.$http.plain.delete("/product_prices/"+this.ticket.id):this.$http.plain.patch("/product_prices/"+this.ticket.id,{isArchived:"archive"===this.confirm});e.then(()=>{this.$buefy.toast.open({type:"is-success",message:"delete"===this.confirm?this.$t("Ticket deleted"):"archive"===this.confirm?this.$t("Ticket archived"):this.$t("Ticket restored")}),this.$emit("saved",null),this.$emit("update:modelValue",!1)}).catch(e=>{console.error(e),this.$buefy.toast.open({type:"is-danger",duration:7e3,message:e.response?.data?.["hydra:description"]||e.response?.data?.detail||this.$t("Error deleting item")})}).finally(()=>{this.isBusy=!1,this.confirm=null})}}},Q=i(66262);const B=(0,Q.A)(I,[["render",E]]);var M=B},27587:function(e,t,i){i.d(t,{A:function(){return A}});i(18111),i(13579);var s=i(20641),n=i(90033);const a={class:"pe-aside"},o={class:"pe-preview"},l={class:"pe-eyebrow"},r={key:0,class:"pe-fee-row is-selected"},d={class:"pe-fee-info"},c={class:"pe-chips"},u={class:"pe-chip is-other"},h={class:"pe-fee-info"},p={key:0},m={key:1,class:"pe-fee-age"},v={class:"pe-fee-amount"},k={key:0,class:"pe-note"},f={key:2,class:"pe-note"},y={key:0,class:"pe-preview"},g={class:"pe-eyebrow"},b={class:"pe-summary"};function $(e,t,i,$,L,C){return(0,s.uX)(),(0,s.CE)("aside",a,[(0,s.Lk)("div",o,[(0,s.Lk)("p",l,(0,n.v_)(i.previewTitle||e.$t("How members see it")),1),(0,s.RG)(e.$slots,"preview"),!e.$slots.preview&&i.flexible?((0,s.uX)(),(0,s.CE)("div",r,[t[0]||(t[0]=(0,s.Lk)("span",{class:"pe-fee-circle"},null,-1)),(0,s.Lk)("span",d,[(0,s.Lk)("b",null,(0,n.v_)(i.flexible.name),1),(0,s.Lk)("span",null,(0,n.v_)(C.hasMin(i.flexible)?e.$t("Choose your amount, from {amount}",{amount:C.money(i.flexible.minPrice)}):e.$t("Choose your amount")),1),(0,s.Lk)("span",c,[((0,s.uX)(!0),(0,s.CE)(s.FK,null,(0,s.pI)(i.flexible.suggestedAmounts||[],e=>((0,s.uX)(),(0,s.CE)("span",{key:e,class:(0,n.C4)(["pe-chip",{"is-suggested":e==i.flexible.suggestedPrice}])},(0,n.v_)(C.money(e)),3))),128)),(0,s.Lk)("span",u,(0,n.v_)(e.$t("Other amount")),1)])])])):!e.$slots.preview&&i.levels&&i.levels.length?((0,s.uX)(),(0,s.CE)(s.FK,{key:1},[((0,s.uX)(!0),(0,s.CE)(s.FK,null,(0,s.pI)(i.levels,(i,a)=>((0,s.uX)(),(0,s.CE)("div",{key:i.id||a,class:(0,n.C4)(["pe-fee-row",{"is-selected":i.selected,"is-hidden":i.hidden}])},[t[1]||(t[1]=(0,s.Lk)("span",{class:"pe-fee-circle"},null,-1)),(0,s.Lk)("span",h,[(0,s.Lk)("b",null,(0,n.v_)(i.name||e.$t("Untitled level")),1),i.description?((0,s.uX)(),(0,s.CE)("span",p,(0,n.v_)(i.description),1)):(0,s.Q3)("",!0),i.ageText?((0,s.uX)(),(0,s.CE)("span",m,(0,n.v_)(i.ageText),1)):(0,s.Q3)("",!0)]),(0,s.Lk)("span",v,(0,n.v_)(C.money(i.price)),1)],2))),128)),i.levels.some(e=>e.hidden)?((0,s.uX)(),(0,s.CE)("p",k,(0,n.v_)(e.$t("Hidden from members.")),1)):(0,s.Q3)("",!0)],64)):e.$slots.preview?(0,s.Q3)("",!0):((0,s.uX)(),(0,s.CE)("p",f,(0,n.v_)(i.placeholder),1))]),i.summary&&i.summary.length?((0,s.uX)(),(0,s.CE)("div",y,[(0,s.Lk)("p",g,(0,n.v_)(e.$t("What this means")),1
1),(0,s.Lk)("ul",b,[((0,s.uX)(!0),(0,s.CE)(s.FK,null,(0,s.pI)(i.summary,(e,t)=>((0,s.uX)(),(0,s.CE)("li",{key:t},(0,n.v_)(e),1))),128))])])):(0,s.Q3)("",!0)])}var L=i(95352),C={name:"ProductPreviewAside",props:{levels:{type:Array,default:()=>[]},flexible:{type:Object,default:null},summary:{type:Array,default:()=>[]},placeholder:{type:String,default:""},currency:{type:String,default:null},previewTitle:{type:String,default:""}},methods:{money(e){return(0,L.up)(e,this.currency,this.$t.bind(this))},hasMin(e){return(0,L.Ro)(e?.minPrice)>0}}},w=i(66262);const T=(0,w.A)(C,[["render",$]]);var A=T},50681:function(e,t,i){i.d(t,{A:function(){return h}});var s=i(20641),n=i(90033);const a=["aria-label"],o=["aria-checked","disabled","title","onClick"],l={key:0};function r(e,t,i,r,d,c){return i.options.length>1?((0,s.uX)(),(0,s.CE)("div",{key:0,class:"pe-segmented",role:"radiogroup","aria-label":i.name},[((0,s.uX)(!0),(0,s.CE)(s.FK,null,(0,s.pI)(i.options,e=>((0,s.uX)(),(0,s.CE)("button",{key:e.value,type:"button",role:"radio",class:(0,n.C4)(["pe-segmented-option",{"is-on":e.value===i.modelValue}]),"aria-checked":e.value===i.modelValue?"true":"false",disabled:e.disabled,title:e.disabled&&e.disabledReason?e.disabledReason:null,onClick:t=>c.pick(e)},[(0,s.Lk)("b",null,(0,n.v_)(e.label),1),e.description?((0,s.uX)(),(0,s.CE)("span",l,(0,n.v_)(e.description),1)):(0,s.Q3)("",!0)],10,o))),128))],8,a)):(0,s.Q3)("",!0)}var d={name:"SegmentedChoice",props:{modelValue:{type:[String,Number,Boolean],default:null},options:{type:Array,required:!0},name:{type:String,default:""}},emits:["update:modelValue"],methods:{pick(e){e.disabled||e.value===this.modelValue||this.$emit("update:modelValue",e.value)}}},c=i(66262);const u=(0,c.A)(d,[["render",r]]);var h=u},50823:function(e,t,i){i.d(t,{A:function(){return z}});var s=i(20641),n=i(90033);const a={key:0,class:"pe-layout"},o={class:"pe-section"},l={class:"pe-section-head"},r={class:"pe-row is-2"},d={class:"control"},c={class:"pe-switch-row"},u={class:"pe-section"},h={class:"pe-section-head"},p={class:"pe-row is-3"},m={class:"control"},v={class:"button is-static"},k={class:"control"},f={class:"button is-static"},y={class:"pe-section"},g={class:"pe-section-head"},b={class:"pe-row is-2"},$={class:"pe-section"},L={class:"pe-section-head"},C={class:"pe-checklist"},w={class:"has-text-grey"},T={key:0,class:"voucher-calc"},A={class:"num"},x={key:0},V={class:"num"},_={class:"is-discount"},F={class:"num"},E={class:"is-total"},O={class:"num"},P={key:1,class:"pe-note"},D={key:1,class:"pe-footer"},R={class:"pe-footer-left"},X={key:0,class:"pe-confirm"},S={class:"pe-footer-right"},U=["disabled"],N=["disabled"];function I(e,t,i,I,Q,B){const M=(0,s.g2)("b-input"),K=(0,s.g2)("b-field"),W=(0,s.g2)("b-switch"),j=(0,s.g2)("SegmentedChoice"),q=(0,s.g2)("b-datepicker"),H=(0,s.g2)("b-checkbox"),G=(0,s.g2)("PreviewAside"),z=(0,s.g2)("ItemViewModal");return(0,s.uX)(),(0,s.Wv)(z,{"model-value":i.modelValue,title:B.title,"scroll-container-id":"voucherEditorModalBody","onUpdate:modelValue":t[15]||(t[15]=t=>e.$emit("update:modelValue",t)),onClose:t[16]||(t[16]=t=>e.$emit("update:modelValue",!1))},{default:(0,s.k6)(()=>[i.modelValue&&Q.draft?((0,s.uX)(),(0,s.CE)("div",a,[(0,s.Lk)("div",null,[(0,s.Lk)("div",o,[(0,s.Lk)("div",l,[(0,s.Lk)("h3",null,(0,n.v_)(e.$t("Code")),1)]),(0,s.Lk)("div",r,[(0,s.bF)(K,{label:e.$t("Voucher code"),type:Q.errors.code?"is-danger":"",message:Q.errors.code?e.$t("A code is required and must be unique for this event."):e.$t("Letters, numbers and dashes. Buyers type it at checkout.")},{default:(0,s.k6)(()=>[(0,s.bF)(K,null,{default:(0,s.k6)(()=>[(0,s.bF)(M,{modelValue:B.code,"onUpdate:modelValue":t[0]||(t[0]=e=>B.code=e),class:"voucher-code-input",placeholder:e.$t("e.g. EARLYBIRD"),maxlength:"50",expanded:""},null,8,["modelValue","placeholder"]),(0,s.Lk)("p",d,[(0,s.Lk)("button",{type:"button",class:"button",onClick:t[1]||(t[1]=e=>B.code=B.suggestCode())},(0,n.v_)(e.$t("Generate")),1)])]),_:1})]),_:1},8,["label","type","message"]),(0,s.Lk)("div",c,[(0,s.Lk)("div",null,[(0,s.Lk)("b",null,(0,n.v_)(e.$t("Active")),1),(0,s.Lk)("span",null,(0,n.v_)(e.$t("Inactive codes are refused at checkout. Prepare a code now, switch it on later.")),1)]),(0,s.bF)(W,{modelValue:Q.draft.isActive,"onUpdate:modelValue":t[2]||(t[2]=e=>Q.draft.isActive=e)},null,8,["modelValue"])])])]),(0,s.Lk)("div",u,[(0,s.Lk)("div",h,[(0,s.Lk)("h3",null,(0,n.v_)(e.$t("Discount")),1)]),(0,s.bF)(j,{modelValue:Q.draft.discountType,"onUpdate:modelValue":t[3]||(t[3]=e=>Q.draft.discountType=e),options:[{value:"percentage",label:e.$t("Percentage"),description:e.$t("A share of each ticket.")},{value:"fixed",label:e.$t("Fixed amount"),description:e.$t("A sum off the order total.")}],name:e.$t("Discount")},null,8,["modelValue","options","name"]),(0,s.Lk)("div",p,[(0,s.bF)(K,{label:"percentage"===Q.draft.discountType?e.$t("Percent off"):e.$t("Amount off"),type:Q.errors.value?"is-danger":"",message:Q.errors.value?"percentage"===Q.draft.discountType?e.$t("Between 1 and 100."):e.$t("Greater than zero."):""},{default:(0,s.k6)(()=>[(0,s.bF)(K,null,{default:(0,s.k6)(()=>[(0,s.bF)(M,{modelValue:Q.draft.discountValue,"onUpdate:modelValue":t[4]||(t[4]=e=>Q.draft.discountValue=e),type:"number",min:"percentage"===Q.draft.discountType?1:.01,max:"percentage"===Q.draft.discountType?100:null,step:"percentage"===Q.draft.discountType?1:.01,expanded:""},null,8,["modelValue","min","max","step"]),(0,s.Lk)("p",m,[(0,s.Lk)("span",v,(0,n.v_)("percentage"===Q.draft.discountType?"%":B.currencyLabel),1)])]),_:1})]),_:1},8,["label","type","message"]),"percentage"===Q.draft.discountType?((0,s.uX)(),(0,s.Wv)(K,{key:0,label:e.$t("Never more than"),message:e.$t("Caps the discount per order.")},{default:(0,s.k6)(()=>[(0,s.bF)(K,null,{default:(0,s.k6)(()=>[(0,s.bF)(M,{modelValue:Q.draft.maxDiscountAmount,"onUpdate:modelValue":t[5]||(t[5]=e=>Q.draft.maxDiscountAmount=e),type:"number",step:"0.01",min:"0",placeholder:e.$t("No cap"),expanded:""},null,8,["modelValue","placeholder"]),(0,s.Lk)("p",k,[(0,s.Lk)("span",f,(0,n.v_)(B.currencyLabel),1)])]),_:1})]),_:1},8,["label","message"])):(0,s.Q3)("",!0),"percentage"===Q.draft.discountType?((0,s.uX)(),(0,s.Wv)(K,{key:1,label:e.$t("Tickets per order"),message:e.$t("Discount only the first N tickets in an order.")},{default:(0,s.k6)(()=>[(0,s.bF)(M,{modelValue:Q.draft.maxTickets,"onUpdate:modelValue":t[6]||(t[6]=e=>Q.draft.maxTickets=e),type:"number",min:"1",placeholder:e.$t("All tickets")},null,8,["modelValue","placeholder"])]),_:1},8,["label","message"])):(0,s.Q3)("",!0)])]),(0,s.Lk)("div",y,[(0,s.Lk)("div",g,[(0,s.Lk)("h3",null,(0,n.v_)(e.$t("Limits")),1)]),(0,s.Lk)("div",b,[(0,s.bF)(K,{label:e.$t("Max orders"),type:Q.errors.uses?"is-danger":"",message:Q.errors.uses?e.$t("{n} already used, so the minimum is {n}.",{n:B.usedCount}):"draft"===i.mode?e.$t("Each checkout that uses the code counts once, whatever the ticket count."):e.$t("Each checkout that uses the code counts once, whatever the ticket count. {n} used so far.",{n:B.usedCount})},{default:(0,s.k6)(()=>[(0,s.bF)(M,{modelValue:Q.draft.maxUses,"onUpdate:modelValue":t[7]||(t[7]=e=>Q.draft.maxUses=e),type:"number",min:Math.max(1,B.usedCount),placeholder:e.$t("Unlimited")},null,8,["modelValue","min","placeholder"])]),_:1},8,["label","type","message"]),"live"===i.mode?((0,s.uX)(),(0,s.Wv)(K,{key:0,label:e.$t("Valid"),type:Q.errors.window?"is-danger":"",message:Q.errors.window?e.$t("The end date must come after the start."):e.$t("Leave empty for no start or end.")},{default:(0,s.k6)(()=>[(0,s.bF)(K,null,{default:(0,s.k6)(()=>[(0,s.bF)(q,{modelValue:B.validFrom,"onUpdate:modelValue":t[8]||(t[8]=e=>B.validFrom=e),placeholder:e.$t("No start date"),icon:"calendar","append-to-body":"",editable:"",expanded:""},null,8,["modelValue","placeholder"]),(0,s.bF)(q,{modelValue:B.validTo,"onUpdate:modelValue":t[9]||(t[9]=e=>B.validTo=e),placeholder:e.$t("No end date"),"min-date":B.validFrom,icon:"calendar","append-to-body":"",editable:"",expanded:""},null,8,["modelValue","placeholder","min-date"])]),_:1})]),_:1},8,["label","type","message"])):(0,s.Q3)("",!0)])]),(0,s.Lk)("div",$,[(0,s.Lk)("div",L,[(0,s.Lk)("h3",null,(0,n.v_)(e.$t("Applies to")),1
1),(0,s.Lk)("p",null,(0,n.v_)(e.$t("Nothing ticked means every ticket type, and add-ons in the same order. Tick tickets to limit it; add-ons are then left out.")),1)]),(0,s.Lk)("div",C,[((0,s.uX)(!0),(0,s.CE)(s.FK,null,(0,s.pI)(B.activeTickets,e=>((0,s.uX)(),(0,s.Wv)(H,{key:B.ticketKeyOf(e),"model-value":Q.draft.tickets.includes(B.ticketKeyOf(e)),"onUpdate:modelValue":t=>B.toggleTicket(B.ticketKeyOf(e),t)},{default:(0,s.k6)(()=>[(0,s.eW)((0,n.v_)(e.name)+" ",1),(0,s.Lk)("span",w,"· "+(0,n.v_)(B.money(e.price)),1)]),_:2},1032,["model-value","onUpdate:modelValue"]))),128))])])]),(0,s.bF)(G,{summary:B.summary,"preview-title":e.$t("Example order"),currency:B.currency},{preview:(0,s.k6)(()=>[B.example?((0,s.uX)(),(0,s.CE)("div",T,[(0,s.Lk)("div",null,[(0,s.Lk)("span",null,(0,n.v_)(B.example.qty)+" à "+(0,n.v_)(B.example.ticket.name),1),(0,s.Lk)("span",A,(0,n.v_)(B.money(B.example.ticketsTotal)),1)]),B.example.addon?((0,s.uX)(),(0,s.CE)("div",x,[(0,s.Lk)("span",null,"1 à "+(0,n.v_)(B.example.addon.name),1),(0,s.Lk)("span",V,(0,n.v_)(B.money(B.example.addonTotal)),1)])):(0,s.Q3)("",!0),(0,s.Lk)("div",_,[(0,s.Lk)("span",null,(0,n.v_)(Q.draft.code||e.$t("CODE"))+(0,n.v_)(B.example.capped?" ("+e.$t("capped")+")":""),1),(0,s.Lk)("span",F,"â "+(0,n.v_)(B.money(B.example.discount)),1)]),(0,s.Lk)("div",E,[(0,s.Lk)("span",null,(0,n.v_)(e.$t("Total")),1),(0,s.Lk)("span",O,(0,n.v_)(B.money(B.example.total)),1)])])):((0,s.uX)(),(0,s.CE)("p",P,(0,n.v_)(e.$t("Add a ticket first.")),1))]),_:1},8,["summary","preview-title","currency"])])):(0,s.Q3)("",!0),i.modelValue&&Q.draft?((0,s.uX)(),(0,s.CE)("div",D,[(0,s.Lk)("div",R,[B.isNew?(0,s.Q3)("",!0):((0,s.uX)(),(0,s.CE)(s.FK,{key:0},[Q.confirm?((0,s.uX)(),(0,s.CE)("span",X,[(0,s.eW)((0,n.v_)(e.$t("Delete this voucher? Orders that already used it keep their discount."))+" ",1),(0,s.Lk)("button",{type:"button",class:(0,n.C4)(["button is-danger is-small is-rounded",{"is-loading":Q.isBusy}]),onClick:t[10]||(t[10]=(...e)=>B.runDelete&&B.runDelete(...e))},(0,n.v_)(e.$t("Yes")),3),(0,s.Lk)("button",{type:"button",class:"button is-white is-small is-rounded",onClick:t[11]||(t[11]=e=>Q.confirm=!1)},(0,n.v_)(e.$t("No")),1)])):((0,s.uX)(),(0,s.CE)("button",{key:1,type:"button",class:"button is-white is-rounded has-text-danger",onClick:t[12]||(t[12]=e=>Q.confirm=!0)},(0,n.v_)(e.$t("Delete")),1))],64))]),(0,s.Lk)("div",S,[(0,s.Lk)("button",{type:"button",class:"button is-light is-rounded",disabled:Q.isBusy,onClick:t[13]||(t[13]=t=>e.$emit("update:modelValue",!1))},(0,n.v_)(e.$t("cancel")),9,U),(0,s.Lk)("button",{type:"button",class:(0,n.C4)(["button is-primary is-rounded",{"is-loading":Q.isBusy}]),disabled:Q.isBusy,onClick:t[14]||(t[14]=(...e)=>B.save&&B.save(...e))},(0,n.v_)(B.isNew?"draft"===i.mode?e.$t("Add to template"):e.$t("Add voucher"):e.$t("Save voucher")),11,N)])])):(0,s.Q3)("",!0)]),_:1},8,["model-value","title"])}i(44114),i(18111),i(22489),i(61701),i(13579);var Q=i(40834),B=i(80762),M=i(50681),K=i(27587),W=i(95352),j=i(80461),q={name:"VoucherEditor",components:{ItemViewModal:B.A,SegmentedChoice:M.A,PreviewAside:K.A},props:{modelValue:{type:Boolean,required:!0},mode:{type:String,default:"live"},voucher:{type:Object,default:null},event:{type:Object,default:null},tickets:{type:Array,default:()=>[]},addons:{type:Array,default:()=>[]},existingCodes:{type:Array,default:()=>[]}},emits:["update:modelValue","saved","save","remove"],data(){return{draft:null,errors:{},confirm:!1,isBusy:!1}},computed:{...(0,Q.L8)(["tenant"]),isNew(){return!this.voucher||("live"===this.mode?!this.voucher.uuid:!this.voucher.key)},title(){return this.isNew?this.$t("New voucher"):this.$t("Edit voucher")+(this.draft?.code?" · "+this.draft.code:"")},currency(){return this.tenant?.currency},currencyLabel(){return(this.currency||"").toUpperCase()},usedCount(){return"live"===this.mode&&(0,W.RI)(this.voucher?.usedCount)||0},activeTickets(){return this.tickets.filter(e=>!e.isArchived)},code:{get(){return this.draft.code},set(e){this.draft.code=String(e||"").toUpperCase().replace(/[^A-Z0-9-]/g,"")}},validFrom:{get(){return this.draft.validFrom?new Date(this.draft.validFrom):null},set(e){this.draft.validFrom=e?e.toISOString():null}},validTo:{get(){return this.draft.validTo?new Date(this.draft.validTo):null},set(e){this.draft.validTo=e?e.toISOString():null}},voucherForSummary(){const e={...this.draft,usedCount:this.usedCount};return"draft"===this.mode?{...e,ticketKeys:this.draft.tickets}:{...e,allowedTicketTypes:this.draft.tickets}},example(){return(0,j.Fm)({voucher:this.voucherForSummary,tickets:this.tickets,addons:this.addons})},summary(){const e=this.tickets.map(e=>({id:e.id,key:e.key,name:e.name}));return(0,j.Hw)({voucher:this.voucherForSummary,tickets:e,currency:this.currency,mode:this.mode},this.$t.bind(this))}},watch:{modelValue(e){e&&this.reset()}},created(){this.modelValue&&this.reset()},methods:{suggestCode:j.Cy,money(e){return(0,W.up)(e,this.currency,this.$t.bind(this))},ticketKeyOf(e){return"draft"===this.mode?e.key:e["@id"]},reset(){this.errors={},this.confirm=!1;const e=this.voucher?JSON.parse(JSON.stringify(this.voucher)):{},t="draft"===this.mode?[...e.ticketKeys||[]]:(e.allowedTicketTypes||[]).map(e=>
1"string"===typeof e?e:e["@id"]).filter(Boolean);this.draft={code:e.code||"",discountType:"fixed"===e.discountType?"fixed":"percentage",discountValue:e.discountValue??null,maxDiscountAmount:e.maxDiscountAmount??null,maxTickets:e.maxTickets??null,maxUses:e.maxUses??null,isActive:void 0===e.isActive||!!e.isActive,validFrom:e.validFrom||null,validTo:e.validTo||null,tickets:t}},toggleTicket(e,t){const i=this.draft.tickets.indexOf(e);t&&i<0&&this.draft.tickets.push(e),!t&&i>=0&&this.draft.tickets.splice(i,1)},validate(){const e={},t=(this.draft.code||"").trim(),i=this.existingCodes.some(e=>e===t&&e!==(this.voucher?.code||null));t&&!i||(e.code=!0);const s=(0,W.Ro)(this.draft.discountValue);(null===s||s<=0||"percentage"===this.draft.discountType&&s>100)&&(e.value=!0);const n=(0,W.RI)(this.draft.maxUses);return null!==n&&n<this.usedCount&&(e.uses=!0),this.draft.validFrom&&this.draft.validTo&&new Date(this.draft.validTo)<new Date(this.draft.validFrom)&&(e.window=!0),this.errors=e,!Object.keys(e).length||(this.$buefy.toast.open({type:"is-danger",message:this.$t("Fix the highlighted fields")}),!1)},save(){if(!this.validate())return;const e=this.draft,t="percentage"===e.discountType,i={code:e.code.trim(),discountType:e.discountType,discountValue:(0,W.Ro)(e.discountValue),maxDiscountAmount:t?(0,W.Ro)(e.maxDiscountAmount):null,maxTickets:t?(0,W.RI)(e.maxTickets):null,maxUses:(0,W.RI)(e.maxUses),isActive:!!e.isActive};if("draft"===this.mode)return this.$emit("save",{...this.voucher,...i,key:this.voucher?.key||(0,j.bO)(),ticketKeys:[...e.tickets]}),void this.$emit("update:modelValue",!1);const s={...i,discountValue:String(i.discountValue),maxDiscountAmount:null===i.maxDiscountAmount?null:String(i.maxDiscountAmount),allowedTicketTypes:[...e.tickets],validFrom:e.validFrom||null,validTo:e.validTo||null,currency:t?null:(this.currency||"eur").toUpperCase()};this.isBusy=!0;const n=this.isNew?this.$http.plain.post("/event_vouchers",{...s,event:this.event["@id"]}):this.$http.plain.patch("/event_vouchers/"+this.voucher.uuid,s);n.then(e=>{this.$buefy.toast.open({type:"is-success",message:this.isNew?this.$t("Voucher created"):this.$t("Voucher saved")}),this.$emit("saved",e.data),this.$emit("update:modelValue",!1)}).catch(e=>{console.error(e),this.$buefy.toast.open({type:"is-danger",duration:7e3,message:e.response?.data?.["hydra:description"]||e.response?.data?.detail||this.$t("Error saving voucher")})}).finally(()=>{this.isBusy=!1})},runDelete(){if("draft"===this.mode)return this.$emit("remove",this.voucher),this.$emit("update:modelValue",!1),void(this.confirm=!1);this.isBusy=!0,this.$http.plain.delete("/event_vouchers/"+this.voucher.uuid).then(()=>{this.$buefy.toast.open({type:"is-success",message:this.$t("Voucher deleted")}),this.$emit("saved",null),this.$emit("update:modelValue",!1)}).catch(e=>{console.error(e),this.$buefy.toast.open({type:"is-danger",duration:7e3,message:e.response?.data?.["hydra:description"]||e.response?.data?.detail||this.$t("Error deleting item")})}).finally(()=>{this.isBusy=!1,this.confirm=!1})}}},H=i(66262);const G=(0,H.A)(q,[["render",I]]);var z=G},80461:function(e,t,i){i.d(t,{Cy:function(){return S},DZ:function(){return D},Fm:function(){return C},Gk:function(){return k},Hw:function(){return X},JD:function(){return y},PQ:function(){return T},R7:function(){return R},Rx:function(){return O},UW:function(){return P},Ux:function(){return V},XV:function(){return p},b8:function(){return c},bO:function(){return U},gl:function(){return h},is:function(){return F},jy:function(){return f},kL:function(){return w},mq:function(){return d},nA:function(){return x},pT:function(){return u},tL:function(){return b},te:function(){return A},xP:function(){return g}});i(44114),i(18111),i(22489),i(20116),i(61701);var s=i(95352);const n="all",a="members",o="specific",l=8;function r(e){if(null===e||void 0===e)return null;if("number"===typeof e)return e;if("object"===typeof e)return(0,s.RI)(e.id)??r(e["@id"]);const t=String(e).match(/(\d+)$/);return t?parseInt(t[1],10):null}function d(e){return(e||[]).map(r).filter(e=>null!==e)}function c(e,{hasLevels:t=!0,hasChapters:i=!0}={}){if("members"!==e?.isRestricted)return n;const s=t&&d(e.allowedFeeProductPrices).length>0,l=i&&d(e.allowedLocalCenters).length>0;return s||l?o:a}function u(e,t=new Date){if(e?.isArchived)return"archived";if(e?.validFrom&&new Date(e.validFrom)>t)return"upcoming";if(e?.validTo&&new Date(e.validTo)<t)return"ended";const i=(0,s.RI)(e?.maxSeats);return null!==i&&(0,s.RI)(e?.soldCount)>=i?"soldOut":"onSale"}function h(e,t=s.tC,i=new Date){switch(u(e,i)){case"archived":return t("Archived");case"upcoming":return t("On sale from {date}",{date:p(e.validFrom)});case"ended":return t("Sales ended");case"soldOut":return t("Sold out");default:return t("On sale")}}function p(e){if(!e)return"";const t=new Date(e);return Number.isNaN(t.getTime())?String(e):t.toLocaleDateString(void 0,{day:"numeric",month:"short",year:"numeric"})}function m(e){if(!e)return"";const t=new Date(e);
1return Number.isNaN(t.getTime())?String(e):t.toLocaleString(void 0,{day:"numeric",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit"})}function v(e,t){const i=d(e);return i.map(e=>t.find(t=>t.id===e)?.name).filter(Boolean)}function k(e,{levels:t=[],chapters:i=[],hasLevels:o=!0,hasChapters:l=!0}={},r=s.tC){const d=c(e,{hasLevels:o,hasChapters:l});if(d===n)return r("Everyone");if(d===a)return r("All members");const u=[r("Specific members")],h=o?v(e.allowedFeeProductPrices,t):[],p=l?v(e.allowedLocalCenters,i):[];return h.length&&u.push(h.join(", ")),p.length&&u.push(p.join(", ")+" · "+(p.length>1?r("chapters"):r("chapter"))),u.join(" · ")}function f({ticket:e,currency:t,levels:i=[],chapters:a=[],hasLevels:o=!0,hasChapters:r=!0,mode:d="live"},u=s.tC){const h=[],p=(0,s.Ro)(e?.price);h.push(p>0?u("Buyers pay {amount} per ticket.",{amount:(0,s.up)(p,t,u)}):u("A free ticket: buyers register without paying."));const k=c(e,{hasLevels:o,hasChapters:r});if(k===n)h.push(u("Anyone with the link can buy it, no account needed."));else{let t=u("Only signed-in members");const s=o?v(e.allowedFeeProductPrices,i):[],n=r?v(e.allowedLocalCenters,a):[];s.length&&(t+=" "+u("on {levels}",{levels:s.join(" "+u("or")+" ")})),n.length&&(t+=(s.length?", "+u("and")+" ":" ")+u("in {chapters} (including sub-chapters)",{chapters:n.join(" "+u("or")+" ")})),h.push(t+" "+u("can buy it. Guests do not see it on the public page.")),h.push(u("One members-only ticket per order, in the buyer's own name."))}const f=(0,s.RI)(e?.maxSeats),y=(0,s.RI)(e?.soldCount)||0;return null!==f?h.push("draft"===d?u("{n} seats per event.",{n:f}):u("{max} seats, {sold} sold, {left} left. Seats in an open checkout are held for {minutes} minutes.",{max:f,sold:y,left:Math.max(0,f-y),minutes:l})):h.push(u("Unlimited seats.")),"draft"!==d&&(e?.validFrom||e?.validTo?h.push(u("On sale {from}{until}.",{from:e.validFrom?u("from {date}",{date:m(e.validFrom)}):u("now"),until:e.validTo?" "+u("until {date}",{date:m(e.validTo)}):""})):h.push(u("On sale as long as registration is open.")),y>0&&h.push(u("{n} sold: the price can no longer change. Archive this ticket and add a new one for a new price.",{n:y}))),h}function y({addon:e,tickets:t=[],currency:i,mode:n="live"},a=s.tC){const o=[],l=g(e,t);o.push(l.length?a("Offered with {tickets}.",{tickets:l.join(", ")}):a("Not offered with any ticket yet, so nobody can buy it.")),o.push(a("{amount} each, added to the order total.",{amount:(0,s.up)((0,s.Ro)(e?.price)||0,i,a)}));const r=(0,s.RI)(e?.maxQuantityPerTicket);o.push(r?a("Up to {n} per ticket.",{n:r}):a("No limit per ticket."));const d=(0,s.RI)(e?.maxTotal),c=(0,s.RI)(e?.soldCount)||0;return null!==d?o.push("draft"===n?a("{n} in total per event.",{n:d}):a("{total} in total, {sold} sold, {left} left.",{total:d,sold:c,left:Math.max(0,d-c)})):o.push(a("Unlimited stock.")),o.push(a(e?.createsAttendee?"Each one adds a separate attendee with their own details, badge and check-in.":"Counted as a quantity on the buyer's ticket; no extra attendee.")),"draft"!==n&&c>0&&o.push(a("{n} sold: price and tickets are locked. Archive it and add a new one to change them.",{n:c})),o}function g(e,t){return Array.isArray(e?.ticketKeys)?e.ticketKeys.map(e=>t.find(t=>t.key===e)?.name).filter(Boolean):v(e?.productPrices,t)}function b(e,t){return Array.isArray(e?.ticketKeys)?e.ticketKeys.map(e=>t.find(t=>t.key===e)?.name).filter(Boolean):v(e?.allowedTicketTypes,t)}function $(e,t){if(Array.isArray(e?.ticketKeys))return 0===e.ticketKeys.length||e.ticketKeys.includes(t.key);const i=d(e?.allowedTicketTypes);return 0===i.length||i.includes(t.id)}function L(e,t){return Array.isArray(e?.ticketKeys)?e.ticketKeys.includes(t.key):d(e?.productPrices).includes(t.id)}function C({voucher:e,tickets:t=[],addons:i=[]}){const n=t.filter(t=>!t.isArchived&&$(e,t)),a=n[0]||t.find(e=>!e.isArchived);if(!a)return null;const o=2,l=(0,s.Ro)(a.price)||0,r=l*o,c=i.find(e=>!e.isArchived&&L(e,a))||null,u=c&&(0,s.Ro)(c.price)||0,h=Array.isArray(e?.ticketKeys)?e.ticketKeys.length>0:d(e?.allowedTicketTypes).length>0,p=(0,s.Ro)(e?.discountValue)||0;let m=0,v=!1;if("fixed"===e?.discountType)m=Math.min(p,r+u);else{const t=(0,s.RI)(e?.maxTickets)?Math.min(o,(0,s.RI)(e.maxTickets)):o,i=l*t+(h||(0,s.RI)(e?.maxTickets)?0:u);m=i*p/100;const n=(0,s.Ro)(e?.maxDiscountAmount);null!==n&&n>0&&m>n&&(m=n,v=!0)}return m=Math.round(100*m)/100,{ticket:a,qty:o,ticketsTotal:r,addon:c,addonTotal:u,discount:m,capped:v,total:Math.max(0,r+u-m)}}function w(e){return"invitation"===e?.type||"ticket"===e?.type}function T(e,t=s.tC){return t("invitation"===e?.type?"Invitation":"Ticket link")}function A(e,t,i="",s=""){if(!e?.code||!t)return"";const n=i?"https://"+String(i).replace(/^https?:\/\//,"").replace(/\/+$/,""):"undefined"!==typeof window?window.location.origin:"",a="ticket"===e.type?"ticket":"invitation",o=s?`&workspace=${encodeURIComponent(s)}`:"";return`${n}/public/event/${t}?${a}=${e.code}${o}`}function x(e,t=s.tC){if(!e)return"";const i=e.name?e.email?`${e.name} (${e.email})`:e.name:e.email||t("Unknown"),n=[t("Used by {who}",{who:i})];return e.registeredAt&&n.push(p(e.registeredAt)),"canceled"===e.status&&n.push(t("Canceled")),"awaiting_invoice_payment"===e.status&&n.push(t("Awaiting payment")),n.join(" · ")}function V(e,t,i=s.tC){if(w(e))return"invitation"===e.type?i("One free ticket, single use"):i("One ticket at its price, single use");const n=(0,s.Ro)(e?.discountValue)||0;if("fixed"===e?.discountType)return i("{amount} off the order",{amount:(0,s.up)(n,t,i)});let a=i("{n}% off",{n:n});(0,s.Ro)(e?.maxDiscountAmount)&&(a+=" "+i("up to {amount}",{amount:(0,s.up)(e.maxDiscountAmount,t,i)}));const o=(0,s.RI)(e?.maxTickets);return o&&(a+=" "+(1===o?i("on 1 ticket per order"):i("on {n} tickets per order",{n:o}))),a}function _(e,t=new Date){if(!e?.isActive)return"inactive";const i=(0,s.RI)(e?.maxUses);return null!==i&&(0,s.RI)(e?.usedCount)>=i?"exhausted":e?.validTo&&new Date(e.validTo)<t?"expired":e?.validFrom&&new Date(e.validFrom)>t?"upcoming":"active"}function F(e,t=s.tC,i=new Date){switch(_(e,i)){case"inactive":return w(e)?t("Revoked"):t("Inactive");case"exhausted":return w(e)?t("Used"):t("All uses taken");case"expired":return t("Expired");case"upcoming":return t("Starts {date}",{date:p(e.validFrom)});default:return t("Active")}}const E={active:{tone:"is-success",icon:"fa-light fa-circle-check"},upcoming:{tone:"is-info",icon:"fa-light fa-clock"},expired:{tone:"is-warning",icon:"fa-light fa-hourglass-half"},exhausted:{tone:"is-default",icon:"fa-light fa-user-check"},inactive:{tone:"is-default",icon:"fa-light fa-pause"}};function O(e,t=new Date){return E[_(e,t)].tone}function P(e,t=new Date){return E[_(e,t)].icon}function D(e,t=new Date){const i=_(e,t);return"active"===i||"upcoming"===i}function R(e,t=new Date,i={}){const s=[],n=[];for(const a of e||[]){const e=a.uuid||a.key,o=e in i?i[e]:D(a,t);(o?s:n).push(a)}return[...s,...n]}function X({voucher:e,tickets:t=[],currency:i,mode:n="live"},a=s.tC){const o=[],l=(0,s.Ro)(e?.discountValue)||0;if("fixed"===e?.discountType)o.push(a("{amount} off the order total, never below zero. The per-ticket limit and cap do not apply to fixed amounts.",{amount:(0,s.up)(l,i,a)}));else{const t=(0,s.RI)(e?.maxTickets);let n=a("{n}% off",{n:l})+" ";n+=t?a("the first {n} tickets in an order",{n:t}):a("every ticket in the order"),(0,s.Ro)(e?.maxDiscountAmount)&&(n+=", "+a("never more than {amount}",{amount:(0,s.up)(e.maxDiscountAmount,i,a)})),o.push(n+".")}const r=b(e,t);o.push(r.length?a("Only counts tickets of type {tickets}. Add-ons are not discounted.",{tickets:r.join(", ")}):a("Applies to every ticket type, and to add-ons in the same order."));const d=(0,s.RI)(e?.maxUses);return d?o.push(("draft"===n?a("Can be used on {n} orders.",{n:d}):a("Can be used on {n} orders, {used} so far.",{n:d,used:(0,s.RI)(e?.usedCount)||0}))+" "+a("One order is one use, however many tickets it holds.")):o.push(a("Unlimited uses.")),(e?.validFrom||e?.validTo)&&o.push(a("Valid {from}{to}.",{from:e.validFrom?a("from {date}",{date:p(e.validFrom)}):a("now"),to:e.validTo?" "+a("to {date}",{date:p(e.validTo)}):", "+a("no end date")})),e&&!1===e.isActive&&o.push(a("Inactive: the code is refused at checkout until you activate it.")),"fixed"!==e?.discountType&&l>=100&&o.push(a("100% makes the order free; the buyer registers without paying.")),o}function S(e=Math.random()){const t=["EARLY","FRIENDS","TEAM","GUEST","SPRING","GALA","CLUB","WELCOME"],i=t[Math.floor(e*t.length)%t.length];return i+String(100+Math.floor(7919*e%900))}
1function U(){return"k"+Date.now().toString(36)+Math.random().toString(36).slice(2,7)}},88697:function(e,t,i){i.d(t,{A:function(){return Je}});var s=i(20641),n=i(90033),a=i(53751);const o={class:"ticketing-board"},l={class:"card p-5"},r={class:"is-flex is-align-items-center is-justify-content-space-between is-flex-wrap-wrap mb-2"},d={class:"is-size-5 has-text-weight-bold"},c={class:"is-size-7 has-text-grey mt-1"},u={class:"is-flex is-align-items-center is-flex-wrap-wrap"},h={key:0,class:"pe-levels mt-3"},p={class:"pe-level-name"},m=["onClick"],v={key:1,class:"tag is-primary is-light is-rounded is-small"},k={class:"pe-level-meta"},f={key:0,class:"has-text-grey-light"},y={class:"pe-level-amount"},g={key:0},b={key:1,class:"pe-capbar"},$=["aria-label","onPointerdown","onKeydown"],L={class:"icon is-small"},C={class:"icon-text"},w={class:"icon is-small"},T={class:"icon-text"},A={class:"icon is-small"},x={class:"icon-text"},V={class:"icon is-small"},_={class:"icon-text"},F={class:"icon is-small"},E={class:"icon-text"},O={class:"icon is-small"},P={key:1,class:"has-text-centered has-text-grey py-6"},D={class:"has-text-weight-semibold has-text-dark"},R={class:"is-size-7"},X={class:"card p-5 mt-5"},S={class:"is-flex is-align-items-center is-justify-content-space-between is-flex-wrap-wrap mb-2"},U={class:"is-size-5 has-text-weight-bold"},N={class:"is-size-7 has-text-grey mt-1"},I=["disabled","title"],Q={key:0,class:"pe-levels mt-3"},B={class:"pe-level-name"},M=["onClick"],K={key:0,class:"tag is-light is-rounded is-small"},W={key:1,class:"tag is-light is-rounded is-small"},j={class:"pe-level-meta"},q={key:0},H={key:1,class:"has-text-grey-light"},G={class:"pe-level-amount"},z={key:0},J=["aria-label","onPointerdown","onKeydown"],Y={class:"icon is-small"},Z={class:"icon-text"},ee={class:"icon is-small"},te={class:"icon-text"},ie={class:"icon is-small"},se={class:"icon-text"},ne={class:"icon is-small"},ae={class:"icon-text"},oe={class:"icon is-small"},le={key:1,class:"has-text-centered has-text-grey py-5"},re={class:"has-text-weight-semibold has-text-dark"},de={class:"is-size-7"},ce={class:"card p-5 mt-5"},ue={class:"is-flex is-align-items-center is-justify-content-space-between is-flex-wrap-wrap mb-2"},he={class:"is-size-5 has-text-weight-bold"},pe={class:"is-size-7 has-text-grey mt-1"},me={class:"buttons mb-0"},ve=["disabled","title"],ke=["disabled","title"],fe=["disabled","title"],ye={key:0,class:"pe-levels mt-3"},ge={class:"pe-level-name"},be=["onClick"],$e={class:"icon is-small mr-1"},Le=["onClick"],Ce={class:"icon is-small mr-1"},we={class:"pe-level-meta"},Te={key:0},Ae={class:"is-small mr-1"},xe={class:"pe-level-amount",style:{"font-size":"0.85rem"}},Ve=["aria-label","onPointerdown","onKeydown"],_e={class:"icon is-small"},Fe={class:"icon-text"},Ee={class:"icon is-small"},Oe={class:"icon-text"},Pe={class:"icon is-small"},De={class:"icon-text"},Re={class:"icon is-small"},Xe={class:"icon-text"},Se={class:"icon is-small"},Ue={class:"icon-text"},Ne={class:"icon is-small"},Ie={key:1,class:"has-text-centered has-text-grey py-5"},Qe={class:"has-text-weight-semibold has-text-dark"},Be={class:"is-size-7"};function Me(e,t,i,Me,Ke,We){const je=(0,s.g2)("font-awesome-icon"),qe=(0,s.g2)("b-dropdown-item"),He=(0,s.g2)("b-dropdown");return(0,s.uX)(),(0,s.CE)("div",o,[(0,s.Lk)("div",l,[(0,s.Lk)("div",r,[(0,s.Lk)("div",null,[(0,s.Lk)("p",d,(0,n.v_)(e.$t("Ticket types")),1),(0,s.Lk)("p",c,(0,n.v_)("draft"===i.mode?e.$t("Created on every event made from this template."):e.$t("What buyers can choose on the event page.")),1)]),(0,s.Lk)("div",u,[We.archivedTickets?((0,s.uX)(),(0,s.CE)("button",{key:0,class:"button is-white is-small is-rounded mr-2",onClick:t[0]||(t[0]=e=>Ke.showArchived=!Ke.showArchived)},(0,n.v_)(Ke.showArchived?e.$t("Hide archived"):e.$t("Show {n} archived",{n:We.archivedTickets})),1)):(0,s.Q3)("",!0),(0,s.Lk)("button",{class:"button is-primary is-small is-rounded",onClick:t[1]||(t[1]=t=>e.$emit("add-ticket"))}," + "+(0,n.v_)(e.$t("Add ticket")),1)])]),We.visibleTickets.length?((0,s.uX)(),(0,s.CE)("div",h,[((0,s.uX)(!0),(0,s.CE)(s.FK,null,(0,s.pI)(We.visibleTickets,o=>((0,s.uX)(),(0,s.CE)("div",{key:We.keyOf(o),class:(0,n.C4)(["pe-level",{"is-archived":o.isArchived}])},[(0,s.Lk)("div",null,[(0,s.Lk)("div",p,[(0,s.Lk)("a",{onClick:t=>e.$emit("edit-ticket",o)},(0,n.v_)(o.name||e.$t("Untitled ticket")),9,m),"live"===i.mode?((0,s.uX)(),(0,s.CE)("span",{key:0,class:(0,n.C4)(["tag is-rounded is-small",We.statusClass(o)])},(0,n.v_)(We.statusText(o)),3)):(0,s.Q3)("",!0),"all"!==We.audienceOf(o)?((0,s.uX)(),(0,s.CE)("span",v,(0,n.v_)("specific"===We.audienceOf(o)?e.$t("Specific members"):e.$t("All members")),1)):(0,s.Q3)("",!0)]),(0,s.Lk)("div",k,[(0,s.eW)((0,n.v_)(We.audienceText(o))+" ",1),o.fullDescription?((0,s.uX)(),(0,s.CE)("span",f," · "+(0,n.v_)(We.truncate(o.fullDescription)),1)):(0,s.Q3)("",!0)])]),(0,s.Lk)("div",y,[(0,s.eW)((0,n.v_)(We.money(o.price))+" ",1),"live"===i.mode?((0,s.uX)(),(0,s.CE)("small",g,(0,n.v_)(We.seatsText(o)),1)):(0,s.Q3)("",!0),"live"===i.mode&&null!==We.capacityPercent(o)?((0,s.uX)(),(0,s.CE)("div",b,[(0,s.Lk)("i",{style:(0,n.Tr)({width:We.capacityPercent(o)+"%"})},null,4)])):(0,s.Q3)("",!0)]),(0,s.bF)(He,{position:We.menuPosition("ticket-"+We.keyOf(o)),"append-to-body":"","aria-role":"list"},{trigger:(0,s.k6)(()=>[(0,s.Lk)("button",{class:"button is-white is-small is-rounded","aria-label":e.$t("More"),onPointerdown:e=>
1We.placeMenu("ticket-"+We.keyOf(o),e),onKeydown:(0,a.jR)(e=>We.placeMenu("ticket-"+We.keyOf(o),e),["enter"])},[(0,s.Lk)("span",L,[(0,s.bF)(je,{icon:"fa-light fa-ellipsis-vertical"})])],40,$)]),default:(0,s.k6)(()=>[(0,s.bF)(qe,{"aria-role":"listitem",onClick:t=>e.$emit("edit-ticket",o)},{default:(0,s.k6)(()=>[(0,s.Lk)("span",C,[(0,s.Lk)("span",w,[(0,s.bF)(je,{icon:"fa-light fa-pencil-alt"})]),(0,s.Lk)("span",null,(0,n.v_)(e.$t("Edit ticket")),1)])]),_:1},8,["onClick"]),(0,s.bF)(qe,{"aria-role":"listitem",onClick:t=>e.$emit("duplicate-ticket",o)},{default:(0,s.k6)(()=>[(0,s.Lk)("span",T,[(0,s.Lk)("span",A,[(0,s.bF)(je,{icon:"fa-light fa-copy"})]),(0,s.Lk)("span",null,(0,n.v_)(e.$t("Duplicate")),1)])]),_:1},8,["onClick"]),"live"===i.mode?((0,s.uX)(),(0,s.CE)(s.FK,{key:0},[t[6]||(t[6]=(0,s.Lk)("hr",{class:"dropdown-divider"},null,-1)),(0,s.bF)(qe,{"aria-role":"listitem",onClick:t=>e.$emit("archive-ticket",o,!o.isArchived)},{default:(0,s.k6)(()=>[(0,s.Lk)("span",x,[(0,s.Lk)("span",V,[(0,s.bF)(je,{icon:o.isArchived?"fa-light fa-rotate-left":"fa-light fa-box-archive"},null,8,["icon"])]),(0,s.Lk)("span",null,(0,n.v_)(o.isArchived?e.$t("Restore"):e.$t("Archive")),1)])]),_:2},1032,["onClick"])],64)):(0,s.Q3)("",!0),"live"===i.mode&&We.soldOf(o)>0?((0,s.uX)(),(0,s.Wv)(qe,{key:1,"aria-role":"listitem",disabled:""},{default:(0,s.k6)(()=>[(0,s.Lk)("span",_,[(0,s.Lk)("span",F,[(0,s.bF)(je,{icon:"fa-light fa-lock"})]),(0,s.Lk)("span",null,(0,n.v_)(e.$t("Delete ({n} sold)",{n:We.soldOf(o)})),1)])]),_:2},1024)):((0,s.uX)(),(0,s.Wv)(qe,{key:2,"aria-role":"listitem",class:"has-text-danger",onClick:t=>e.$emit("delete-ticket",o)},{default:(0,s.k6)(()=>[(0,s.Lk)("span",E,[(0,s.Lk)("span",O,[(0,s.bF)(je,{icon:"fa-light fa-trash"})]),(0,s.Lk)("span",null,(0,n.v_)(e.$t("Delete")),1)])]),_:1},8,["onClick"]))]),_:2},1032,["position"])],2))),128))])):((0,s.uX)(),(0,s.CE)("div",P,[(0,s.Lk)("p",D,(0,n.v_)(e.$t("No tickets yet")),1),(0,s.Lk)("p",R,(0,n.v_)(e.$t("Add the first ticket type so people can register.")),1)]))]),(0,s.Lk)("div",X,[(0,s.Lk)("div",S,[(0,s.Lk)("div",null,[(0,s.Lk)("p",U,(0,n.v_)(e.$t("Add-ons")),1),(0,s.Lk)("p",N,(0,n.v_)(e.$t("Extras bought together with a ticket: a partner seat, a meal, parking.")),1)]),(0,s.Lk)("button",{class:"button is-light is-small is-rounded",disabled:!We.activeTickets.length,title:We.activeTickets.length?"":e.$t("Add a ticket first."),onClick:t[2]||(t[2]=t=>e.$emit("add-addon"))}," + "+(0,n.v_)(e.$t("Add add-on")),9,I)]),We.visibleAddons.length?((0,s.uX)(),(0,s.CE)("div",Q,[((0,s.uX)(!0),(0,s.CE)(s.FK,null,(0,s.pI)(We.visibleAddons,o=>((0,s.uX)(),(0,s.CE)("div",{key:We.keyOf(o),class:(0,n.C4)(["pe-level",{"is-archived":o.isArchived}])},[(0,s.Lk)("div",null,[(0,s.Lk)("div",B,[(0,s.Lk)("a",{onClick:t=>e.$emit("edit-addon",o)},(0,n.v_)(o.name),9,M),o.createsAttendee?((0,s.uX)(),(0,s.CE)("span",K,(0,n.v_)(e.$t("Adds an attendee")),1)):(0,s.Q3)("",!0),o.isArchived?((0,s.uX)(),(0,s.CE)("span",W,(0,n.v_)(e.$t("Archived")),1)):(0,s.Q3)("",!0)]),(0,s.Lk)("div",j,[(0,s.eW)((0,n.v_)(We.addonTicketsText(o))+" ",1),o.maxQuantityPerTicket?((0,s.uX)(),(0,s.CE)("span",q,"· "+(0,n.v_)(e.$t("max {n} per ticket",{n:o.maxQuantityPerTicket})),1)):(0,s.Q3)("",!0),o.description?((0,s.uX)(),(0,s.CE)("span",H," · "+(0,n.v_)(We.truncate(o.description)),1)):(0,s.Q3)("",!0)])]),(0,s.Lk)("div",G,[(0,s.eW)((0,n.v_)(We.money(o.price))+" ",1),"live"===i.mode?((0,s.uX)(),(0,s.CE)("small",z,(0,n.v_)(o.maxTotal?e.$t("{sold} / {max} sold",{sold:o.soldCount||0,max:o.maxTotal}):e.$t("{n} sold",{n:o.soldCount||0})),1)):(0,s.Q3)("",!0)]),(0,s.bF)(He,{position:We.menuPosition("addon-"+We.keyOf(o)),"append-to-body":"","aria-role":"list"},{trigger:(0,s.k6)(()=>[(0,s.Lk)("button",{class:"button is-white is-small is-rounded","aria-label":e.$t("More"),onPointerdown:e=>We.placeMenu("addon-"+We.keyOf(o),e),onKeydown:(0,a.jR)(e=>We.placeMenu("addon-"+We.keyOf(o),e),["enter"])},[(0,s.Lk)("span",Y,[(0,s.bF)(je,{icon:"fa-light fa-ellipsis-vertical"})])],40,J)]),default:(0,s.k6)(()=>[(0,s.bF)(qe,{"aria-role":"listitem",onClick:t=>e.$emit("edit-addon",o)},{default:(0,s.k6)(()=>[(0,s.Lk)("span",Z,[(0,s.Lk)("span",ee,[(0,s.bF)(je,{icon:"fa-light fa-pencil-alt"})]),(0,s.Lk)("span",null,(0,n.v_)(e.$t("Edit add-on")),1)])]),_:1},8,["onClick"]),"live"===i.mode?((0,s.uX)(),(0,s.CE)(s.FK,{key:0},[t[7]||(t[7]=(0,s.Lk)("hr",{class:"dropdown-divider"},null,-1)),(0,s.bF)(qe,{"aria-role":"listitem",onClick:t=>e.$emit("archive-addon",o,!o.isArchived)},{default:(0,s.k6)(()=>[(0,s.Lk)("span",te,[(0,s.Lk)("span",ie,[(0,s.bF)(je,{icon:o.isArchived?"fa-light fa-rotate-left":"fa-light fa-box-archive"},null,8,["icon"])]),(0,s.Lk)("span",null,(0,n.v_)(o.isArchived?e.$t("Restore"):e.$t("Archive")),1)])]),_:2},1032,["onClick"])],64)):(0,s.Q3)("",!0),"live"===i.mode&&(o.soldCount||0)>0?((0,s.uX)(),(0,s.Wv)(qe,{key:1,"aria-role":"listitem",disabled:""},{default:(0,s.k6)(()=>[(0,s.Lk)("span",se,[(0,s.Lk)("span",ne,[(0,s.bF)(je,{icon:"fa-light fa-lock"})]),(0,s.Lk)("span",null,(0,n.v_)(e.$t("Delete ({n}
1 sold)",{n:o.soldCount})),1)])]),_:2},1024)):((0,s.uX)(),(0,s.Wv)(qe,{key:2,"aria-role":"listitem",class:"has-text-danger",onClick:t=>e.$emit("delete-addon",o)},{default:(0,s.k6)(()=>[(0,s.Lk)("span",ae,[(0,s.Lk)("span",oe,[(0,s.bF)(je,{icon:"fa-light fa-trash"})]),(0,s.Lk)("span",null,(0,n.v_)(e.$t("Delete")),1)])]),_:1},8,["onClick"]))]),_:2},1032,["position"])],2))),128))])):((0,s.uX)(),(0,s.CE)("div",le,[(0,s.Lk)("p",re,(0,n.v_)(e.$t("No add-ons")),1),(0,s.Lk)("p",de,(0,n.v_)(We.activeTickets.length?e.$t("Optional. Add extras buyers can add to their ticket."):e.$t("Add a ticket first.")),1)]))]),(0,s.Lk)("div",ce,[(0,s.Lk)("div",ue,[(0,s.Lk)("div",null,[(0,s.Lk)("p",he,(0,n.v_)(e.$t("Vouchers")),1),(0,s.Lk)("p",pe,(0,n.v_)(e.$t("Discount codes entered at checkout. Each use is one order, whatever the ticket count.")),1)]),(0,s.Lk)("div",me,[(0,s.Lk)("button",{class:"button is-light is-small is-rounded",disabled:!We.activeTickets.length,title:We.activeTickets.length?"":e.$t("Add a ticket first."),onClick:t[3]||(t[3]=t=>e.$emit("add-voucher"))}," + "+(0,n.v_)(e.$t("Add voucher")),9,ve),"live"===i.mode&&i.canCreateLinks?((0,s.uX)(),(0,s.CE)(s.FK,{key:0},[(0,s.Lk)("button",{class:"button is-light is-small is-rounded",disabled:!We.activeTickets.length||!!i.linksUnavailableReason,title:i.linksUnavailableReason||(We.activeTickets.length?"":e.$t("Add a ticket first.")),onClick:t[4]||(t[4]=t=>e.$emit("add-link","ticket"))}," + "+(0,n.v_)(e.$t("Ticket link")),9,ke),(0,s.Lk)("button",{class:"button is-light is-small is-rounded",disabled:!We.activeTickets.length||!!i.linksUnavailableReason,title:i.linksUnavailableReason||(We.activeTickets.length?"":e.$t("Add a ticket first.")),onClick:t[5]||(t[5]=t=>e.$emit("add-link","invitation"))}," + "+(0,n.v_)(e.$t("Invitation")),9,fe)],64)):(0,s.Q3)("",!0)])]),i.vouchers.length?((0,s.uX)(),(0,s.CE)("div",ye,[((0,s.uX)(!0),(0,s.CE)(s.FK,null,(0,s.pI)(We.orderedVouchers,o=>((0,s.uX)(),(0,s.CE)("div",{key:We.keyOf(o),class:(0,n.C4)(["pe-level",{"is-archived":"live"===i.mode?!We.isVoucherUsable(o):!1===o.isActive}])},[(0,s.Lk)("div",null,[(0,s.Lk)("div",ge,[We.isRegistrationLink(o)?((0,s.uX)(),(0,s.CE)("a",{key:0,class:"tag is-primary is-rounded",onClick:t=>e.$emit("edit-voucher",o)},[(0,s.Lk)("span",$e,[(0,s.bF)(je,{icon:"invitation"===o.type?"fa-light fa-envelope-open":"fa-light fa-link"},null,8,["icon"])]),(0,s.eW)(" "+(0,n.v_)(We.registrationLinkTypeText(o,e.$t.bind(this))),1)],8,be)):((0,s.uX)(),(0,s.CE)("a",{key:1,class:"pe-code",onClick:t=>e.$emit("edit-voucher",o)},(0,n.v_)(o.code),9,Le)),"live"===i.mode?((0,s.uX)(),(0,s.CE)("span",{key:2,class:(0,n.C4)(["tag is-rounded is-small",We.voucherStatusTone(o)])},[(0,s.Lk)("span",Ce,[(0,s.bF)(je,{icon:We.voucherStatusIcon(o)},null,8,["icon"])]),(0,s.eW)(" "+(0,n.v_)(We.voucherStatusText(o,e.$t.bind(this))),1)],2)):(0,s.Q3)("",!0)]),(0,s.Lk)("div",we,[(0,s.eW)((0,n.v_)(We.voucherRuleText(o,i.currency,e.$t.bind(this)))+" · "+(0,n.v_)(We.voucherTicketsText(o))+" ",1),o.validFrom||o.validTo?((0,s.uX)(),(0,s.CE)("span",Te,"· "+(0,n.v_)(o.validFrom?We.shortDate(o.validFrom):e.$t("now"))+" â "+(0,n.v_)(o.validTo?We.shortDate(o.validTo):e.$t("no end")),1)):(0,s.Q3)("",!0)]),((0,s.uX)(!0),(0,s.CE)(s.FK,null,(0,s.pI)(i.linkRedemptions[o.uuid]||[],(t,i)=>((0,s.uX)(),(0,s.CE)("div",{key:o.uuid+"-redemption-"+i,class:"pe-level-meta has-text-dark"},[(0,s.Lk)("span",Ae,[(0,s.bF)(je,{icon:"fa-light fa-user-check"})]),(0,s.eW)(" "+(0,n.v_)(We.linkRedemptionText(t,e.$t.bind(this))),1)]))),128))]),(0,s.Lk)("div",xe,["live"===i.mode?((0,s.uX)(),(0,s.CE)(s.FK,{key:0},[(0,s.eW)((0,n.v_)(o.maxUses?(o.usedCount||0)+" / "+o.maxUses:o.usedCount||0)+" ",1),(0,s.Lk)("small",null,(0,n.v_)(e.$t("orders used")),1)],64)):(0,s.Q3)("",!0)]),(0,s.bF)(He,{position:We.menuPosition("voucher-"+We.keyOf(o)),"append-to-body":"","aria-role":"list"},{trigger:(0,s.k6)(()=>[(0,s.Lk)("button",{class:"button is-white is-small is-rounded","aria-label":e.$t("More"),onPointerdown:e=>We.placeMenu("voucher-"+We.keyOf(o),e),onKeydown:(0,a.jR)(e=>We.placeMenu("voucher-"+We.keyOf(o),e),["enter"])},[(0,s.Lk)("span",_e,[(0,s.bF)(je,{icon:"fa-light fa-ellipsis-vertical"})])],40,Ve)]),default:(0,s.k6)(()=>[(0,s.bF)(qe,{"aria-role":"listitem",onClick:t=>e.$emit("edit-voucher",o)},{default:(0,s.k6)(()=>[(0,s.Lk)("span",Fe,[(0,s.Lk)("span",Ee,[(0,s.bF)(je,{icon:"fa-light fa-pencil-alt"}
1)]),(0,s.Lk)("span",null,(0,n.v_)(We.isRegistrationLink(o)?e.$t("Edit link"):e.$t("Edit voucher")),1)])]),_:2},1032,["onClick"]),We.isRegistrationLink(o)?((0,s.uX)(),(0,s.Wv)(qe,{key:0,"aria-role":"listitem",onClick:t=>e.$emit("copy-link",o)},{default:(0,s.k6)(()=>[(0,s.Lk)("span",Oe,[(0,s.Lk)("span",Pe,[(0,s.bF)(je,{icon:"fa-light fa-link"})]),(0,s.Lk)("span",null,(0,n.v_)(e.$t("Copy link")),1)])]),_:1},8,["onClick"])):((0,s.uX)(),(0,s.Wv)(qe,{key:1,"aria-role":"listitem",onClick:e=>We.copyCode(o)},{default:(0,s.k6)(()=>[(0,s.Lk)("span",De,[(0,s.Lk)("span",Re,[(0,s.bF)(je,{icon:"fa-light fa-copy"})]),(0,s.Lk)("span",null,(0,n.v_)(e.$t("Copy code")),1)])]),_:1},8,["onClick"])),"live"===i.mode?((0,s.uX)(),(0,s.CE)(s.FK,{key:2},[t[8]||(t[8]=(0,s.Lk)("hr",{class:"dropdown-divider"},null,-1)),(0,s.bF)(qe,{"aria-role":"listitem",onClick:t=>e.$emit("toggle-voucher",o,!o.isActive)},{default:(0,s.k6)(()=>[(0,s.Lk)("span",Xe,[(0,s.Lk)("span",Se,[(0,s.bF)(je,{icon:o.isActive?"fa-light fa-pause":"fa-light fa-play"},null,8,["icon"])]),(0,s.Lk)("span",null,(0,n.v_)(o.isActive?e.$t("Deactivate"):e.$t("Activate")),1)])]),_:2},1032,["onClick"])],64)):(0,s.Q3)("",!0),(0,s.bF)(qe,{"aria-role":"listitem",class:"has-text-danger",onClick:t=>e.$emit("delete-voucher",o)},{default:(0,s.k6)(()=>[(0,s.Lk)("span",Ue,[(0,s.Lk)("span",Ne,[(0,s.bF)(je,{icon:"fa-light fa-trash"})]),(0,s.Lk)("span",null,(0,n.v_)(e.$t("Delete")),1)])]),_:1},8,["onClick"])]),_:2},1032,["position"])],2))),128))])):((0,s.uX)(),(0,s.CE)("div",Ie,[(0,s.Lk)("p",Qe,(0,n.v_)(e.$t("No vouchers")),1),(0,s.Lk)("p",Be,(0,n.v_)(e.$t("Optional. Create codes for early birds, partners or the press.")),1)]))])])}i(18111),i(22489),i(61701);var Ke=i(40834),We=i(95256),je=i(95352),qe=i(80461),He={name:"TicketingBoard",props:{mode:{type:String,default:"live"},tickets:{type:Array,default:()=>[]},addons:{type:Array,default:()=>[]},vouchers:{type:Array,default:()=>[]},currency:{type:String,default:null},levels:{type:Array,default:()=>[]},chapters:{type:Array,default:()=>[]},canCreateLinks:{type:Boolean,default:!1},linksUnavailableReason:{type:String,default:""},linkRedemptions:{type:Object,default:()=>({})}},emits:["add-ticket","edit-ticket","duplicate-ticket","archive-ticket","delete-ticket","add-addon","edit-addon","archive-addon","delete-addon","add-voucher","edit-voucher","toggle-voucher","delete-voucher","add-link","copy-link"],data(){return{showArchived:!1,menuOpensUp:{},knownVoucherUsability:{}}},computed:{orderedVouchers(){return"live"===this.mode?(0,qe.R7)(this.vouchers,new Date,this.knownVoucherUsability):this.vouchers},...(0,Ke.L8)(["tenant"]),hasChapters(){return!!this.tenant?.settingFeatures?.localCenter?.isActive},hasLevels(){return this.levels.length>0},audienceContext(){return{levels:this.levels,chapters:this.chapters,hasLevels:this.hasLevels,hasChapters:this.hasChapters}},activeTickets(){return this.tickets.filter(e=>!e.isArchived)},archivedTickets(){return this.tickets.filter(e=>e.isArchived).length},visibleTickets(){const e=this.tickets.filter(e=>this.showArchived||!e.isArchived);return[...e].sort((e,t)=>(e.sortOrder??0)-(t.sortOrder??0)||(e.id??0)-(t.id??0))},visibleAddons(){return this.addons.filter(e=>this.showArchived||!e.isArchived)},ticketCatalogue(){return this.tickets.map(e=>({id:e.id,key:e.key,name:e.name}))}},watch:{vouchers:{immediate:!0,handler(e){const t={...this.knownVoucherUsability};let i=!1;for(const s of e||[]){const e=s.uuid||s.key;e&&!(e in t)&&(t[e]=(0,qe.DZ)(s),i=!0)}i&&(this.knownVoucherUsability=t)}}},methods:{placeMenu(e,t){const i=t?.currentTarget?.getBoundingClientRect?.();if(!i)return;const s=window.innerHeight-i.bottom,n=s<240&&i.top>s;this.menuOpensUp[e]!==n&&(this.menuOpensUp={...this.menuOpensUp,[e]:n})},menuPosition(e){return this.menuOpensUp[e]?"is-top-left":"is-bottom-left"},voucherRuleText:qe.Ux,voucherStatusText:qe.is,voucherStatusTone:qe.Rx,voucherStatusIcon:qe.UW,isVoucherUsable:qe.DZ,isRegistrationLink:qe.kL,registrationLinkTypeText:qe.PQ,linkRedemptionText:qe.nA,shortDate:qe.XV,keyOf(e){return e.key||e.uuid||e.id},money(e){const t=(0,je.Ro)(e);return null===t||0===t?this.$t("Free"):(0,je.up)(t,this.currency,this.$t.bind(this))},truncate(e){return e.length>80?e.substring(0,80)+"â¦":e},soldOf(e){return(0,je.RI)(e.soldCount)||0},audienceOf(e){return(0,qe.b8)(e,this.audienceContext)},audienceText(e){return(0,qe.Gk)(e,this.audienceContext,this.$t.bind(this))},statusText(e){return(0,qe.gl)(e,this.$t.bind(this))},statusClass(e){const t=(0,qe.pT)(e);return{"is-success is-light":"onSale"===t,"is-warning is-light":"upcoming"===t,"is-danger is-light":"soldOut"===t,"is-light":"ended"===t||"archived"===t}},seatsText(e){const t=(0,je.RI)(e.maxSeats),i=this.soldOf(e);return null!==t?this.$t("{sold} / {max} sold",{sold:i,max:t}):this.$t("{n} sold · unlimited",{n:i})},capacityPercent(e){const t=(0,je.RI)(e.maxSeats);return t?Math.min(100,Math.round(this.soldOf(e)/t*100)):null},addonTicketsText(e){const t=(0,qe.xP)(e,this.ticketCatalogue);return t.length?this.$t("With {tickets}",{tickets:t.join(", ")}):this.$t("Not attached to any ticket")},voucherTicketsText(e){const t=(0,qe.tL)(e,this.ticketCatalogue);return t.length?t.join(", "):this.$t("any ticket")}
1,copyCode(e){(0,We.lW)(e.code),this.$buefy.toast.open({type:"is-success",message:this.$t("Code copied")})}}},Ge=i(66262);const ze=(0,Ge.A)(He,[["render",Me]]);var Je=ze},95352:function(e,t,i){i.d(t,{$t:function(){return $},IQ:function(){return g},KS:function(){return V},RI:function(){return m},Ro:function(){return p},WA:function(){return E},XG:function(){return T},_p:function(){return _},bW:function(){return L},dD:function(){return w},g6:function(){return y},h3:function(){return F},lj:function(){return C},mZ:function(){return A},qW:function(){return f},s6:function(){return b},tC:function(){return n},tK:function(){return k},up:function(){return v}});i(44114),i(18111),i(22489),i(20116);var s=i(5833);const n=(e,t={})=>e.replace(/\{(\w+)\}/g,(e,i)=>t&&i in t?String(t[i]):e),a="fixed",o="flexible",l="product",r="own",d="lifetime",c="everyone",u="age",h="company";function p(e){if(null===e||void 0===e||""===e)return null;const t="number"===typeof e?e:parseFloat(e);return Number.isFinite(t)?t:null}function m(e){if(null===e||void 0===e||""===e)return null;const t=parseInt(e,10);return Number.isFinite(t)?t:null}function v(e,t,i=n){const a=p(e);return null===a?i("Free"):(0,s.u)(a,t||"eur")}function k(e,t=n){const i=m(e)||1;return 1===i?t("Monthly"):12===i?t("Yearly"):t("Every {n} months",{n:i})}function f(e,t=n){const i=m(e)||1;return 1===i?t("per month"):12===i?t("per year"):t("per {n} months",{n:i})}function y(e,t="en"){const i=m(e);return i?new Date(2e3,i-1,1).toLocaleString(t,{month:"long"}):""}function g(e,t){return m(e?.overwriteMonthPeriod)||m(t?.monthPeriod)||1}function b(e){return!!e&&("fee"===e.type||!0===e.isFee)}function $(e){return(e?.productPrices||[]).find(e=>e.isCustomAmount&&!e.isArchived)||null}function L(e){return $(e)?o:a}function C(e){return e?.isCompanyPrice?h:m(e?.ageUnder)||m(e?.ageOver)?u:c}function w(e){return e?.isLifetime?d:m(e?.overwriteMonthPeriod)?r:l}function T(e,t=n){const i=m(e?.ageUnder),s=m(e?.ageOver);return i&&s?t("Under {under} or over {over}",{under:i,over:s}):i?t("Under {age}",{age:i}):s?t("Over {age}",{age:s}):""}function A(e){return!!e?.isHidden&&null===p(e?.price)}function x(e){const t=!0===e?.isSubscription,i=e?.isOneTime??!t;return{oneTime:!!i,recurring:t}}function V(e,t=n){const{oneTime:i,recurring:s}=x(e);return i&&s?t("One-off or recurring"):s?t("Recurring"):i?t("One-off"):""}function _(e,t,i,s=n){const a=i?.settingFeatures?.fees||{},o=[],l=V(e,s);if(l&&o.push(l),e?.isLifetime)o.push(s("Lifetime"));else{const i=g(e,t);o.push(k(i,s).toLowerCase()+(m(e?.overwriteMonthPeriod)?" ("+s("own cycle")+")":""))}return a.hasRegistrationFee&&p(e?.registrationFee)&&o.push(s("{amount} registration fee",{amount:v(e.registrationFee,e.currency||i?.currency,s)})),a.hasVat&&!e?.priceVatExempt&&p(e?.priceVatRate)&&o.push("+"+p(e.priceVatRate)+"% "+s("VAT")),e?.previousVersion&&o.push(s("has earlier prices")),o.join(" · ")}function F({price:e,product:t,tenant:i,defaultPriceId:s=null},a=n){const o=i?.settingFeatures?.fees||{},l=e?.currency||i?.currency,r=[],d=p(e?.price);if(A(e))r.push(a("Exemption level: no payment. Assigning it grants a full cycle of validity."));else if(e?.isLifetime)r.push(a("{amount} once, valid for life.",{amount:v(d,l,a)}));else{const i=g(e,t);let s=v(d,l,a)+" "+f(i,a)+".";m(e?.overwriteMonthPeriod)&&m(e.overwriteMonthPeriod)!==m(t?.monthPeriod)&&
1(s+=" "+a("The product default is {cycle}.",{cycle:k(t?.monthPeriod,a).toLowerCase()})),r.push(s)}if(o.hasRegistrationFee&&p(e?.registrationFee)&&!e?.isCompanyPrice){let t=a("Plus {amount} registration fee on a member's first ever payment.",{amount:v(e.registrationFee,l,a)});o.hasVat&&!e?.registrationFeeVatExempt&&p(e?.registrationFeeVatRate)&&(t+=" (+"+p(e.registrationFeeVatRate)+"% "+a("VAT")+")"),r.push(t)}o.hasVat&&!A(e)&&(e?.priceVatExempt?r.push(a("No VAT on the fee.")):p(e?.priceVatRate)?r.push(a("{rate}% VAT added on top and shown on the invoice.",{rate:p(e.priceVatRate)})):r.push(a("VAT rate not set yet.")));const c=V(e,a);if(A(e)||r.push(c?a("Payable {modes}.",{modes:c.toLowerCase()}):a("Not payable until a payment mode is on.")),o.productPriceAgeRestriction&&C(e)===u&&r.push(a("Only for members {age}. Suggested automatically to members in that band.",{age:T(e,a).toLowerCase()})),e?.isCompanyPrice){const t=m(e?.companySlots);r.push(a("Company membership covering {slots} people. Never offered to individuals.",{slots:t||a("unlimited")}))}return e?.isHidden&&!A(e)&&r.push(a("Not shown to members. Only admins can assign it.")),e?.isBundle&&r.push(a("One person pays; the people they add get a free companion level.")),s&&e?.id&&parseInt(s,10)===e.id&&r.push(a("This is the default level for new members.")),r}function E({product:e,tenant:t,step:i=null,draftLevels:s=[],flexible:a=null,locale:l="en"},r=n){const d=[],c=t?.settingFeatures?.fees||{};if(b(e)){const n=m(e.monthPeriod)||1,u=m(e.cycleMonth);if(e.pricingMode===o&&d.push(r("Members choose their own amount above a minimum. No fixed levels.")),d.push(k(n,r)+" "+(u?r("membership, everyone renews in {month}.",{month:y(u,l)}):r("membership, renewal on each member's join date."))),n>1&&e.cycleHasProratio){const t=m(e.proratioMinMonthsEnabler);d.push(t?r("Joining mid-cycle is pro-rated, except in the first {n} months which are charged in full.",{n:t}):r("Joining mid-cycle is pro-rated."))}if(e.hasSubscription&&e.hasOneTimePayment?d.push(r("Members choose card renewal or a one-off payment each cycle.")):e.hasSubscription?d.push(r("Renewal is automatic by card.")):e.hasOneTimePayment?d.push(r("Members pay each cycle themselves.")):d.push(r("No way to pay yet.")),1!==n||e.hasSubscription?d.push(r("Reminders go out 30, 7 and 1 day before the renewal date, on the day, and 7, 14 and 30 days after.")):d.push(r("Monthly one-off fees get no renewal reminders.")),2===i)if(e.pricingMode===o)d.push(p(a?.minPrice)>0?r("One flexible level, minimum {amount}. No other level can be added while it is active.",{amount:v(a.minPrice,t?.currency,r)}):r("One flexible level; set the minimum members must pay. No other level can be added while it is active."));else{const e=s.filter(e=>(e.name||"").trim());0===e.length?d.push(r("Name at least one level. The first one becomes the default for new members.")):d.push(1===e.length?r('1 level will be created; "{first}" becomes the default.',{first:e[0].name}):r('{n} levels will be created; "{first}" becomes the default.',{n:e.length,first:e[0].name}))}!1===c.fixedStartingDateFee&&u&&d.push(r("Cycle intervals are counted from {month}.",{month:y(u,l)}))}else{if(e.slug&&d.push(r("Public payment page at {url}.",{url:(t?.paymentHost||"")+"/pay/"+e.slug})),e.hasCustomPriceValue){let i=r("Donors can give any amount");p(e.customMinPrice)&&(i+=" "+r("from {amount}",{amount:v(e.customMinPrice,t?.currency,r)})),p(e.customMaxPrice)&&(i+=" "+r("up to {amount}",{amount:v(e.customMaxPrice,t?.currency,r)})),d.push(i+".")}else d.push(r("Donors pick one of the suggested amounts."));const i=p(e.goalValue)||p(e.goalValueSubscription);i&&d.push(r("Progress bar towards {amount}{monthly}.",{amount:v(i,t?.currency,r),monthly:p(e.goalValueSubscription)?" "+r("per month"):""})),e.hasLocalCenterOption&&d.push(r(e.settings?.localCenterOptionTopLevelOnly&&!e.localCenter?"Donors pick a top-level chapter at checkout.":"Donors pick a chapter at checkout."))}return d}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.