1"use strict";(self["webpackChunkclient"]=self["webpackChunkclient"]||[]).push([[2687],{2687:function(e,t,i){i.r(t),i.d(t,{default:function(){return xe}});i(44114);var s=i(20641),a=i(90033),n=i(53751);const l={class:"o-maxwidth product-list-page"},o={class:"icon is-small"},r={key:0,class:"level"},u={class:"level-left"},c={class:"level-item"},d={class:"title has-text-dark"},m={class:"level-right"},p={class:"icon is-small"},h={class:"tabs-pill"},b={class:"tabs"},g={key:0,class:"prod-tab-badge is-active"},y={key:0,class:"prod-tab-badge is-active"},f={class:"icon-text"},v={class:"icon"},k={class:"icon is-small"},L={class:"has-text-weight-semibold is-size-6"},C={key:3,class:"mobile-product-list"},w=["onClick"],$={class:"mobile-product-card-top"},_={class:"mobile-product-logo-wrapper"},P=["alt","src"],F={key:1,class:"mobile-product-logo-placeholder"},x={class:"mobile-product-info"},V={class:"mobile-product-name"},M={class:"mobile-product-tags"},E={key:0,class:"tag is-rounded is-small is-success is-light"},A={key:1,class:"tag is-rounded is-small is-warning is-light"},S={class:"mobile-product-card-footer"},T={key:0,class:"prod-created-at-mobile"},X=["href"],I={class:"icon is-small"},N=["onClick"],D={class:"icon is-small"},Q={key:4,class:"orgo-table-wrap mt-5"},O={class:"is-flex is-align-items-center"},U={class:"prod-logo-wrapper mr-3"},R=["alt","src"],W={key:1,class:"prod-logo-placeholder"},G=["onClick"],H={key:1,class:"has-text-weight-semibold"},q={key:0},K={key:0},j={key:1},Y=["href"],B={class:"is-flex is-justify-content-center",style:{gap:"6px","flex-wrap":"wrap"}},z={key:0,class:"tag is-rounded is-small is-success"},J={key:1,class:"tag is-rounded is-small is-warning"},Z={class:"has-text-weight-bold"},ee={class:"prod-sub-text"},te={key:1,class:"has-text-grey"},ie={key:1,class:"has-text-grey"},se={key:1,class:"has-text-grey"},ae={key:0,class:"prod-identity-summary"},ne={class:"prod-identity-chip is-success"},le={class:"prod-identity-chip is-warning"},oe={class:"prod-identity-chip is-danger"},re={key:1,class:"has-text-grey"},ue={class:"prod-row-actions"},ce=["href"],de={class:"icon is-small"},me=["onClick"],pe={class:"icon is-small"},he={key:0},be={key:1},ge={key:0,class:"prod-created-at"};function ye(e,t,i,ye,fe,ve){const ke=(0,s.g2)("b-loading"),Le=(0,s.g2)("font-awesome-icon"),Ce=(0,s.g2)("MobileViewHeader"),we=(0,s.g2)("b-checkbox"),$e=(0,s.g2)("router-link"),_e=(0,s.g2)("b-table-column"),Pe=(0,s.g2)("b-tooltip"),Fe=(0,s.g2)("b-table"),xe=(0,s.g2)("ProductCreateWizard"),Ve=(0,s.g2)("ItemViewModal");return(0,s.uX)(),(0,s.CE)("section",l,[(0,s.bF)(ke,{modelValue:fe.isLoading,"onUpdate:modelValue":t[0]||(t[0]=e=>fe.isLoading=e),"is-full-page":!1},null,8,["modelValue"]),e.$isMobile()?((0,s.uX)(),(0,s.Wv)(Ce,{key:0,"back-route":"Dashboard",title:e.$t("products")},{actions:(0,s.k6)(()=>[ve.canCreateProduct?((0,s.uX)(),(0,s.CE)("button",{key:0,class:"button is-primary is-small is-rounded",onClick:t[1]||(t[1]=(...e)=>ve.openCreateModal&&ve.openCreateModal(...e))},[(0,s.Lk)("span",o,[(0,s.bF)(Le,{icon:"fa-light fa-plus"})])])):(0,s.Q3)("",!0)]),_:1},8,["title"])):(0,s.Q3)("",!0),(0,s.Lk)("div",{class:(0,a.C4)({"ml-5 mr-5":!e.$isMobile()})},[e.$isMobile()?(0,s.Q3)("",!0):((0,s.uX)(),(0,s.CE)("div",r,[(0,s.Lk)("div",u,[(0,s.Lk)("div",c,[(0,s.Lk)("h2",d,(0,a.v_)(e.$t("products"))+" "+(0,a.v_)(fe.isLocal?e.$t("Chapter"):""),1)])]),(0,s.Lk)("div",m,[ve.canCreateProduct?((0,s.uX)(),(0,s.CE)("button",{key:0,class:"button is-primary is-rounded",onClick:t[2]||(t[2]=(...e)=>ve.openCreateModal&&ve.openCreateModal(...e))},[(0,s.Lk)("span",p,[(0,s.bF)(Le,{icon:"fa-light fa-plus"})]),(0,s.Lk)("span",null,(0,a.v_)(e.$t("create"))+" "+(0,a.v_)(e.$t("product")),1)])):(0,s.Q3)("",!0)])])),fe.isLocal||!fe.isLocal&&e.isGranted("FINANCIAL_TENANT")?((0,s.uX)(),(0,s.CE)("div",{key:1,class:(0,a.C4)(["is-flex is-align-items-center is-flex-wrap-wrap",{"pl-4 pr-4":e.$isMobile()}]),style:{gap:"16px"}},[(0,s.Lk)("div",h,[(0,s.Lk)("nav",b,[(0,s.Lk)("ul",null,[(0,s.Lk)("li",{class:(0,a.C4)({"is-active":!fe.filters.isArchived})},[(0,s.Lk)("a",{onClick:t[3]||(t[3]=e=>ve.setArchiveFilter(!1))},[(0,s.eW)((0,a.v_)(e.$t("actives"))+" ",1),fe.filters.isArchived||null===fe.itemsTotal?(0,s.Q3)("",!0):((0,s.uX)(),(0,s.CE)("span",g,(0,a.v_)(fe.itemsTotal),1))])],2),(0,s.Lk)("li",{class:(0,a.C4)({"is-active":fe.filters.isArchived})},[(0,s.Lk)("a",{onClick:t[4]||(t[4]=e=>ve.setArchiveFilter(!0))},[(0,s.eW)((0,a.v_)(e.$t("archived_plural"))+" ",1),fe.filters.isArchived&&null!==fe.itemsTotal?((0,s.uX)(),(0,s.CE)("span",y,(0,a.v_)(fe.itemsTotal),1)):(0,s.Q3)("",!0)])],2)])])]),e.$isMobile()?(0,s.Q3)("",!0):((0,s.uX)(),(0,s.Wv)(we,{key:0,modelValue:fe.filters.showTotals,"onUpdate:modelValue":[t[5]||(t[5]=e=>fe.filters.showTotals=e),ve.onShowTotalsChange],class:"ml-3 is-small"},{default:(0,s.k6)(()=>[(0,s.eW)((0,a.v_)(e.$t("Display totals(slower)")),1)]),_:1},8,["modelValue","onUpdate:modelValue"])),fe.filters.showTotals&&!e.$isMobile()?((0,s.uX)(),(0,s.CE)("a",{key:1,class:"button is-small is-rounded is-ghost",onClick:t[6]||(t[6]=(...e)=>ve.loadItemsPage&&ve.loadItemsPage(...e))},[(0,s.Lk)("span",f,[(0,s.Lk)("span",v,[(0,s.bF)(Le,{icon:"fa-light fa-refresh"})]),(0,s.Lk)("span",null,(0,a.v_)(e.$t("Refresh")),1)])])):(0,s.Q3)("",!0),fe.items&&fe.items.length>4?((0,s.uX)(),(0,s.CE)("button",{key:2,class:"ml-auto button is-small is-rounded prod-sort-btn",onClick:t[7]||(t[7]=(...e)=>ve.toggleSort&&ve.toggleSort(...e))},[(0,s.Lk)("span",k,[(0,s.bF)(Le,{icon:"desc"===fe.sortOrder?"fa-light fa-arrow-down":"fa-light fa-arrow-up"},null,8,["icon"])]),(0,s.Lk)("span",null,(0,a.v_)("id"===fe.sortField?e.$t("Recent"):e.$t("name")),1)])):(0,s.Q3)("",!0)],2)):(0,s.Q3)("",!0),e.tenant.stripeAccount?(0,s.Q3)("",!0):((0,s.uX)(),(0,s.CE)("div",{key:2,class:(0,a.C4)(["card p-5 mt-5 has-text-centered",{"ml-4 mr-4":e.$isMobile()}])},[(0,s.Lk)("p",L,[(0,s.eW)((0,a.v_)(e.$t("Stripe account is not configured in organisation settings."))+" ",1),t[13]||(t[13]=(0,s.Lk)("br",null,null,-1)),(0,s.bF)($e,{to:{name:"TenantSettingsPayments"}},{default:(0,s.k6)(()=>
1[(0,s.eW)((0,a.v_)(e.$t("Click here to configure your Stripe account")),1)]),_:1})])],2)),e.$isMobile()&&ve.sortedItems&&ve.sortedItems.length>0&&!fe.isLoading?((0,s.uX)(),(0,s.CE)("div",C,[((0,s.uX)(!0),(0,s.CE)(s.FK,null,(0,s.pI)(ve.sortedItems,i=>((0,s.uX)(),(0,s.CE)("div",{key:"mobile-product-"+i.uuid,class:"mobile-product-card",onClick:e=>ve.navigateToProduct(i)},[(0,s.Lk)("div",$,[(0,s.Lk)("div",_,[i.logo?((0,s.uX)(),(0,s.CE)("img",{key:0,class:"mobile-product-logo",alt:i.name,src:ve.logoPublicUrl(i.logo,"product")},null,8,P)):((0,s.uX)(),(0,s.CE)("div",F,[(0,s.bF)(Le,{icon:ve.typeIcon(i.type)},null,8,["icon"])]))]),(0,s.Lk)("div",x,[(0,s.Lk)("span",V,(0,a.v_)(i.name),1),(0,s.Lk)("div",M,[(0,s.Lk)("span",{class:(0,a.C4)(["tag","is-rounded","is-small",ve.typeTagClass(i.type)])},(0,a.v_)(e.$t(i.type)),3),i.localCenter?((0,s.uX)(),(0,s.CE)("span",E,(0,a.v_)(e.$t("Chapter")),1)):(0,s.Q3)("",!0),i.isRestricted?((0,s.uX)(),(0,s.CE)("span",A,(0,a.v_)(e.$t("Restricted")),1)):(0,s.Q3)("",!0)])])]),(0,s.Lk)("div",S,[i.createdAt?((0,s.uX)(),(0,s.CE)("span",T,(0,a.v_)(e.$filters.format(i.createdAt)),1)):(0,s.Q3)("",!0),["fee","manual_invoice"].includes(i.type)?(0,s.Q3)("",!0):((0,s.uX)(),(0,s.CE)("a",{key:1,class:"mobile-product-action-btn",href:ve.paymentLink(i),target:"_blank",onClick:t[8]||(t[8]=(0,n.D$)(()=>{},["stop"]))},[(0,s.Lk)("span",I,[(0,s.bF)(Le,{icon:"fa-light fa-globe-pointer"})])],8,X)),["fee","manual_invoice"].includes(i.type)?(0,s.Q3)("",!0):((0,s.uX)(),(0,s.CE)("button",{key:2,class:(0,a.C4)(["mobile-product-action-btn",{"is-loading-btn":fe.isLoadingShareLink===i.uuid}]),onClick:(0,n.D$)(e=>ve.shareLink(i),["stop"])},[(0,s.Lk)("span",D,[fe.copiedProductUuid===i.uuid?((0,s.uX)(),(0,s.Wv)(Le,{key:0,icon:"fa-light fa-check"})):((0,s.uX)(),(0,s.Wv)(Le,{key:1,icon:"fa-light fa-link"}))])],10,N))])],8,w))),128))])):(0,s.Q3)("",!0),!e.$isMobile()&&ve.sortedItems&&ve.sortedItems.length>0&&!fe.isLoading?((0,s.uX)(),(0,s.CE)("div",Q,[(0,s.bF)(Fe,{data:ve.sortedItems,hoverable:!0,"mobile-cards":!1,scrollable:!0,class:"prod-table"},{default:(0,s.k6)(()=>[(0,s.bF)(_e,{label:e.$t("product"),"header-class":"prod-th"},{default:(0,s.k6)(i=>[(0,s.Lk)("div",O,[(0,s.Lk)("div",U,[i.row.logo?((0,s.uX)(),(0,s.CE)("img",{key:0,class:"prod-logo",alt:i.row.name,src:ve.logoPublicUrl(i.row.logo,"product")},null,8,R)):((0,s.uX)(),(0,s.CE)("div",W,[(0,s.bF)(Le,{icon:ve.typeIcon(i.row.type)},null,8,["icon"])]))]),(0,s.Lk)("div",null,[e.isGranted("FINANCIAL_LOCAL")?((0,s.uX)(),(0,s.CE)("span",{key:0,class:"has-text-weight-semibold is-clickable prod-name-link",onClick:t=>e.$router.push({name:"ProductShow",params:{item:i.row.uuid},query:ve.productShowQuery(i.row)})},(0,a.v_)(i.row.name),9,G)):((0,s.uX)(),(0,s.CE)("span",H,[i.row.hasLocalCenterOption?((0,s.uX)(),(0,s.CE)("span",q,[t[14]||(t[14]=(0,s.eW)(" - ",-1)),e.isGranted("FINANCIAL_PARENT_LOCAL")&&e.user.localCenterParent?((0,s.uX)(),(0,s.CE)("span",K,(0,a.v_)(e.$t("LP"))+" "+(0,a.v_)(e.user.localCenterParent.name),1)):((0,s.uX)(),(0,s.CE)("span",j,(0,a.v_)(e.$t("LC"))+" "+(0,a.v_)(e.user.localCenter.name),1))])):(0,s.Q3)("",!0)])),["fee","manual_invoice"].includes(i.row.type)?(0,s.Q3)("",!0):((0,s.uX)(),(0,s.CE)("a",{key:2,class:"prod-payment-url",href:ve.paymentLink(i.row),target:"_blank",onClick:t[9]||(t[9]=(0,n.D$)(()=>{},["stop"]))},(0,a.v_)(ve.paymentUrlDisplay(i.row)),9,Y))])])]),_:1},8,["label"]),(0,s.bF)(_e,{label:e.$t("type"),width:"150","header-class":"prod-th",centered:""},{default:(0,s.k6)(t=>[(0,s.Lk)("div",B,[(0,s.Lk)("span",{class:(0,a.C4)(["tag","is-rounded",ve.typeTagClass(t.row.type)])},(0,a.v_)(e.$t(t.row.type)),3),t.row.localCenter?((0,s.uX)(),(0,s.CE)("span",z,(0,a.v_)(e.$t("Chapter")),1)):(0,s.Q3)("",!0),t.row.isRestricted?((0,s.uX)(),(0,s.CE)("span",J,(0,a.v_)(e.$t("Restricted")),1)):(0,s.Q3)("",!0)])]),_:1},8,["label"]),fe.filters.showTotals?((0,s.uX)(),(0,s.Wv)(_e,{key:0,label:e.$t("Revenue"),width:"160","header-class":"prod-th",centered:""},{default:(0,s.k6)(e=>[e.row.totals?((0,s.uX)(),(0,s.CE)(s.FK,{key:0},[(0,s.Lk)("div",Z,(0,a.v_)(ve.totalRevenue(e.row)),1),(0,s.Lk)("div",ee,"avg "+(0,a.v_)(ve.avgRevenue(e.row)),1)],64)):((0,s.uX)(),(0,s.CE)("span",te," â "))]),_:1},8,["label"])):(0,s.Q3)("",!0),fe.filters.showTotals?((0,s.uX)(),(0,s.Wv)(_e,{key:1,label:e.$t("payments"),width:"120","header-class":"prod-th",centered:""},{default:(0,s.k6)(e=>[e.row.totals?((0,s.uX)(),(0,s.Wv)($e,{key:0,class:"has-text-weight-semibold prod-payments-link",to:{name:"ProductPayments",params:{item:e.row.uuid},query:{...ve.queryLink}}},{default:(0,s.k6)(()=>[(0,s.eW)((0,a.v_)(ve.totalPaymentsCount(e.row)),1)]),_:2},1032,["to"])):((0,s.uX)(),(0,s.CE)("span",ie," â "))]),_:1},8,["label"])):(0,s.Q3)("",!0),(0,s.bF)(_e,{label:e.$t("subscribers"),width:"120","header-class":"prod-th",centered:""},{default:(0,s.k6)(e=>[ve.subscribersCount(e.row)?((0,s.uX)(),(0,s.Wv)($e,{key:0,class:"has-text-weight-semibold prod-payments-link",to:{name:"ProductSubscribers",params:{item:e.row.uuid},query:{...ve.queryLink,status:"active"}}
1},{default:(0,s.k6)(()=>[(0,s.eW)((0,a.v_)(ve.subscribersCount(e.row)),1)]),_:2},1032,["to"])):((0,s.uX)(),(0,s.CE)("span",se," â "))]),_:1},8,["label"]),fe.filters.showTotals&&ve.hasIdentityValidation?((0,s.uX)(),(0,s.Wv)(_e,{key:2,label:e.$t("Identity"),width:"180","header-class":"prod-th",centered:""},{default:(0,s.k6)(t=>[t.row.totals?((0,s.uX)(),(0,s.CE)("div",ae,[(0,s.bF)(Pe,{label:e.$t("Validated"),position:"is-top",type:"is-dark"},{default:(0,s.k6)(()=>[(0,s.Lk)("span",ne,[(0,s.bF)(Le,{icon:"fa-light fa-check",class:"mr-1"}),(0,s.eW)(" "+(0,a.v_)(ve.identityValidated(t.row)),1)])]),_:2},1032,["label"]),(0,s.bF)(Pe,{label:e.$t("Pending validation"),position:"is-top",type:"is-dark"},{default:(0,s.k6)(()=>[(0,s.Lk)("span",le,[(0,s.bF)(Le,{icon:"fa-light fa-clock",class:"mr-1"}),(0,s.eW)(" "+(0,a.v_)(ve.identityPending(t.row)),1)])]),_:2},1032,["label"]),(0,s.bF)(Pe,{label:e.$t("Rejected"),position:"is-top",type:"is-dark"},{default:(0,s.k6)(()=>[(0,s.Lk)("span",oe,[(0,s.bF)(Le,{icon:"fa-light fa-xmark",class:"mr-1"}),(0,s.eW)(" "+(0,a.v_)(ve.identityRejected(t.row)),1)])]),_:2},1032,["label"])])):((0,s.uX)(),(0,s.CE)("span",re," â "))]),_:1},8,["label"])):(0,s.Q3)("",!0),(0,s.bF)(_e,{label:" ",width:"320","cell-class":"prod-actions-cell","header-class":"prod-th"},{default:(0,s.k6)(i=>[(0,s.Lk)("div",ue,[["fee","manual_invoice"].includes(i.row.type)?(0,s.Q3)("",!0):((0,s.uX)(),(0,s.CE)("a",{key:0,class:"prod-pill-btn",href:ve.paymentLink(i.row),target:"_blank",onClick:t[10]||(t[10]=(0,n.D$)(()=>{},["stop"]))},[(0,s.Lk)("span",de,[(0,s.bF)(Le,{icon:"fa-light fa-globe-pointer"})]),(0,s.Lk)("span",null,(0,a.v_)(e.$t("Landing page")),1)],8,ce)),["fee","manual_invoice"].includes(i.row.type)?(0,s.Q3)("",!0):((0,s.uX)(),(0,s.CE)("button",{key:1,class:(0,a.C4)(["prod-pill-btn",{"is-loading-btn":fe.isLoadingShareLink===i.row.uuid}]),onClick:e=>ve.shareLink(i.row)},[(0,s.Lk)("span",pe,[(0,s.bF)(Le,{icon:"fa-light fa-link"})]),fe.copiedProductUuid===i.row.uuid?((0,s.uX)(),(0,s.CE)("span",he,(0,a.v_)(e.$t("Copied!")),1)):((0,s.uX)(),(0,s.CE)("span",be,(0,a.v_)(e.$t("Copy link")),1))],10,me))]),i.row.createdAt?((0,s.uX)(),(0,s.CE)("div",ge,(0,a.v_)(e.$filters.format(i.row.createdAt)),1)):(0,s.Q3)("",!0)]),_:1})]),_:1},8,["data"])])):fe.isLoading||null===ve.sortedItems||0!==ve.sortedItems.length?(0,s.Q3)("",!0):((0,s.uX)(),(0,s.CE)("div",{key:5,class:(0,a.C4)(["card p-5 mt-5",{"ml-4 mr-4":e.$isMobile()}])},(0,a.v_)(e.$t("No products available at this time"))+". ",3))],2),(0,s.bF)(Ve,{modelValue:fe.showCreateModal,"onUpdate:modelValue":t[12]||(t[12]=e=>fe.showCreateModal=e),title:e.$t("create")+" "+e.$t("product"),"scroll-container-id":"createProductModalBody"},{default:(0,s.k6)(()=>[fe.showCreateModal?((0,s.uX)(),(0,s.Wv)(xe,{key:0,"local-center-id":fe.isLocal?ve.scopedLocalCenterId:null,onCreated:ve.onProductCreated,onCancel:t[11]||(t[11]=e=>fe.showCreateModal=!1)},null,8,["local-center-id","onCreated"])):(0,s.Q3)("",!0)]),_:1},8,["modelValue","title"])])}var fe=i(40834),ve=i(95256),ke=i(60259),Le=i(80762),Ce=i(81084),we=i(95572),$e=i(28994),_e={components:{ItemViewModal:Le.A,MobileViewHeader:Ce.A,ProductCreateWizard:we.A},mixins:[$e.A],data(){return{isLocal:"local"===this.$route.params.type,isLoadingShareLink:!1,copiedProductUuid:null,items:null,filters:{isArchived:!1,type:null,typeEvent:this.$store.state.productsListShowEvents??!1,showTotals:this.defaultShowTotals()},localCenter:null,itemsTotal:null,itemsPageCurrent:1,itemsPerPage:null,isLoading:!1,sortField:"id",sortOrder:"desc",showCreateModal:!1}},computed:{...(0,fe.L8)(["isGranted","tenant","user"]),sortedItems(){if(!this.items)return null;const e=[...this.items];return e.sort((e,t)=>{if("id"===this.sortField)return"desc"===this.sortOrder?t.id-e.id:e.id-t.id;const i=(e.name||"").toLowerCase(),s=(t.name||"").toLowerCase(),a=i.localeCompare(s);return"desc"===this.sortOrder?-a:a}),e},queryLink(){return this.isLocal?{isLocalSettings:1}:{}},queryLocalCenter(){return this.isGranted("FINANCIAL_TENANT")?{}:{localCenter:this.user.localCenter.id}},scopedLocalCenterId(){return this.isLocal?(0,ke.Ct)(this.$route,this.isGranted,this.user):null},canCreateProduct(){return this.isLocal?!!this.scopedLocalCenterId:this.isGranted("FINANCIAL_TENANT")},hasIdentityValidation(){return this.tenant.settingFeatures?.identityValidation?.isActive&&this.tenant.settingFeatures?.identityValidation?.onlinePayments}},created(){if(!this.isGranted("FINANCIAL_LOCAL"))return this.$router.push({name:"Dashboard"});this.loadItemsPage()},mounted(){this.loadLocalCenter()},methods:{copyToClipboard:ve.lW,logoPublicUrl:ve.YV,defaultShowTotals(){const e=this.$store.state.productsListShowTotals;return void 0!==e&&null!==e?e:!this.$store.getters.tenant?.settingFeatures?.onlinePayments?.isPolitics},typeIcon(e){const t={fee:"fa-light fa-building-columns",donation:"fa-light fa-hand-holding-heart",commerce:"fa-light fa-bag-shopping",digital_asset:"fa-light fa-file-arrow-down",event:"fa-light fa-calendar-star",manual_invoice:"fa-light fa-file-invoice"};return t[e]||"fa-light fa-box"},typeTagClass(e){const t={fee:"is-info is-light",donation:"is-danger is-light",commerce:"is-warning is-light",digital_asset:"is-link is-light",event:"is-primary is-light",manual_invoice:"is-dark is-light"};return t[e]||"is-light"},paymentUrlDisplay(e){if(!this.tenant.paymentHost)return"";const t=e.slug||e.uuid;return this.tenant.paymentHost+"/pay/"+t},paymentLink(e){let t="https://"+this.tenant.paymentHost+"/pay/";return t+=e.slug?e.slug:e.uuid,!this.isGranted("FINANCIAL_TENANT")&&this.user.localCenter&&this.user.localCenter.id&&(t+="?workspace="+this.tenant.slug+"&localCenter="+this.user.localCenter.id),t},formattedAmount(e){return e?new Intl.NumberFormat("en-US",{style:"decimal",maximumFractionDigits:0,notation:"standard"}).format(e):0},totalRevenue(e){if(!e.totals)return"â";let t=0;return e.totals.paymentsOnetime?.success&&(t+=parseFloat(e.totals.paymentsOnetime.success)),e.totals.paymentsSubscription?.success&&(t+=parseFloat(e.totals.paymentsSubscription.success)),this.$filters.money(t)},avgRevenue(e){if(!e.totals)return this.$filters.money(0);const t=parseFloat(e.totals.paymentsOnetime?.totalsAvg||0),i=parseFloat(e.totals.paymentsSubscription?.totalsAvg||0);return t&&i?this.$filters.money((t+i)/2):this.$filters.money(t||i)},totalPaymentsCount(e){if(!e.totals)return 0;let t=0;return e.totals.paymentsOnetime?.totalCountSuccess&&(t+=parseInt(e.totals.paymentsOnetime.totalCountSuccess)),e.totals.paymentsOnetime?.totalCountPending&&(t+=parseInt(e.totals.paymentsOnetime.totalCountPending)),e.totals.subscriptions?.activeCount&&(t+=parseInt(e.totals.subscriptions.activeCount)),this.formattedAmount(t)},subscribersCount(e){return e.totals?.subscriptions?.activeCount?this.formattedAmount(parseInt(e.totals.subscriptions.activeCount)):0},identityValidated(e){return this.formattedAmount(e.totals?.paymentsOnetime?.identityValidated||0)},identityPending(e){return this.formattedAmount(e.totals?.paymentsOnetime?.identityPending||0)},identityRejected(e){return this.formattedAmount(e.totals?.paymentsOnetime?.identityRejected||0)},toggleSort(){"id"===this.sortField?(this.sortField="name",this.sortOrder="asc"):(this.sortField="id",this.sortOrder="desc")},setArchiveFilter(e){this.filters.isArchived=e,this.itemsPageCurrent=1,this.loadItemsPage()},onShowTotalsChange(){this.$store.commit("setProductsListShowTotals",this.filters.showTotals),this.loadItemsPage()},navigateToProduct(e){this.isGranted("FINANCIAL_LOCAL")&&this.$router.push({name:"ProductShow",params:{item:e.uuid},query:this.productShowQuery(e)})},productShowQuery(e){return e.localCenter?{isLocalSettings:1}:{}},shareLink(e){this.isLoadingShareLink=e.uuid,this.copiedProductUuid=null,this.$http.plain.patch("/product-go-publish/"+e.uuid,{isEn:!1}).then(()=>{this.copyToClipboard("https://"+this.tenant.appHost+"/share/product/"+e.slugGo),this.copiedProductUuid=e.uuid,setTimeout(()=>{this.copiedProductUuid===e.uuid&&(this.copiedProductUuid=null)},2e3)}
1).catch(e=>console.error(e)).finally(()=>{this.isLoadingShareLink=!1})},getFiltersQueryString(){let e="";e+=this.filters.showTotals?"&showTotals=1":"",e+=this.filters.isArchived?"&exists[isArchived]=1":"&exists[isArchived]=0",e+="&excludeType=event";const t=this.isLocal&&this.isGranted("ADMIN_TENANT")?(0,ke.hz)(this.$route):null;return t&&(e+="&exists[localCenter]=1&localCenter="+encodeURIComponent(t)),e},loadLocalCenter(){(this.scopedLocalCenterId||this.user.localCenter)&&this.$http.plain.get("/local_centers/"+(this.scopedLocalCenterId||this.user.localCenter.id)).then(e=>{this.localCenter=e.data}).catch(e=>console.error(e))},loadItemsPage(){this.isLoading=!0;let e=this.getFiltersQueryString();this.$http.plain.get("/my-products?page="+this.itemsPageCurrent+e).then(e=>{this.items=e.data["hydra:member"],1===this.itemsPageCurrent&&(this.itemsTotal=e.data["hydra:totalItems"],this.itemsPerPage=this.items.length)}).catch(e=>console.error(e)).finally(()=>{this.isLoading=!1})},openCreateModal(){this.showCreateModal=!0},onProductCreated(e){this.showCreateModal=!1,this.$store.commit("setProductTab","prices"),this.$router.push({name:"ProductShow",params:{item:e.uuid}})}}},Pe=i(66262);const Fe=(0,Pe.A)(_e,[["render",ye],["__scopeId","data-v-1353ffb6"]]);var xe=Fe},27587:function(e,t,i){i.d(t,{A:function(){return P}});i(18111),i(13579);var s=i(20641),a=i(90033);const n={class:"pe-aside"},l={class:"pe-preview"},o={class:"pe-eyebrow"},r={key:0,class:"pe-fee-row is-selected"},u={class:"pe-fee-info"},c={class:"pe-chips"},d={class:"pe-chip is-other"},m={class:"pe-fee-info"},p={key:0},h={key:1,class:"pe-fee-age"},b={class:"pe-fee-amount"},g={key:0,class:"pe-note"},y={key:2,class:"pe-note"},f={key:0,class:"pe-preview"},v={class:"pe-eyebrow"},k={class:"pe-summary"};function L(e,t,i,L,C,w){return(0,s.uX)(),(0,s.CE)("aside",n,[(0,s.Lk)("div",l,[(0,s.Lk)("p",o,(0,a.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",u,[(0,s.Lk)("b",null,(0,a.v_)(i.flexible.name),1),(0,s.Lk)("span",null,(0,a.v_)(w.hasMin(i.flexible)?e.$t("Choose your amount, from {amount}",{amount:w.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,a.C4)(["pe-chip",{"is-suggested":e==i.flexible.suggestedPrice}])},(0,a.v_)(w.money(e)),3))),128)),(0,s.Lk)("span",d,(0,a.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,n)=>((0,s.uX)(),(0,s.CE)("div",{key:i.id||n,class:(0,a.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",m,[(0,s.Lk)("b",null,(0,a.v_)(i.name||e.$t("Untitled level")),1),i.description?((0,s.uX)(),(0,s.CE)("span",p,(0,a.v_)(i.description),1)):(0,s.Q3)("",!0),i.ageText?((0,s.uX)(),(0,s.CE)("span",h,(0,a.v_)(i.ageText),1)):(0,s.Q3)("",!0)]),(0,s.Lk)("span",b,(0,a.v_)(w.money(i.price)),1)],2))),128)),i.levels.some(e=>e.hidden)?((0,s.uX)(),(0,s.CE)("p",g,(0,a.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",y,(0,a.v_)(i.placeholder),1))]),i.summary&&i.summary.length?((0,s.uX)(),(0,s.CE)("div",f,[(0,s.Lk)("p",v,(0,a.v_)(e.$t("What this means")),1),(0,s.Lk)("ul",k,[((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,a.v_)(e),1))),128))])])):(0,s.Q3)("",!0)])}var C=i(95352),w={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,C.up)(e,this.currency,this.$t.bind(this))},hasMin(e){return(0,C.Ro)(e?.minPrice)>0}}},$=i(66262);const _=(0,$.A)(w,[["render",L]]);var P=_},56042:function(e,t,i){i.d(t,{A:function(){return et}});var s=i(20641),a=i(90033);const n={class:"product-form"},l={key:0,class:"pe-section"},o={class:"pe-section-head"},r={class:"pe-tiles"},u={class:"pe-tile-icon"},c={class:"pe-tile-check"},d={class:"pe-tile-icon"},m={class:"pe-tile-check"},p={class:"pe-section"},h={class:"control"},b={class:"button is-static"},g={key:1,class:"pe-section"},y={class:"pe-section-head"},f={class:"pe-row is-2"},v={value:1},k={value:3},L={value:6},C={value:12},w={value:null},$=["value"],_={key:0},P={class:"pe-switch-row"},F={key:0,class:"pe-sub mt-2"},x={value:null},V=["value"],M={class:"pe-section"},E={class:"pe-section-head"},A={class:"pe-tiles"},S=["disabled"],T={class:"pe-tile-icon"},X={class:"pe-tile-check"},I=["disabled","title"],N={class:"pe-tile-icon"},D={class:"pe-tile-check"},Q={key:0,class:"help is-danger"},O={key:2,class:"pe-section"},U={class:"pe-section-head"},R={class:"pe-tiles"},W={class:"pe-tile-icon"},G={class:"pe-tile-check"},H={class:"pe-tile-icon"},q={class:"pe-tile-check"},K={key:3,class:"pe-section"},j={class:"pe-section-head"},Y={class:"pe-switch-row"},B={key:0,class:"pe-sub"},z={key:1,class:"pe-switch-row"},J={key:1,class:"pe-section"},Z={class:"pe-section-head"},ee={class:"control"},te={class:"button is-static"},ie={class:"is-flex is-align-items-center is-flex-wrap-wrap mt-1"},se={key:1},ae=["aria-label","disabled","onClick"],ne={class:"icon is-small"},le={key:0,class:"help is-danger"},oe={key:2,class:"pe-section"},re={class:"pe-section-head"},ue={class:"pe-row is-3"},ce={class:"control"},de={class:"button is-static"},me={class:"control"},pe={class:"button is-static"},he={class:"control"},be={class:"button is-static"},ge={class:"pe-section"},ye={class:"pe-section-head"},fe={key:0},ve={class:"pe-switch-row"},ke={key:0,class:"pe-sub"},Le={class:"pe-row is-2"},Ce={class:"control"},we={class:"button is-static"},$e={class:"control"},_e={class:"button is-static"},Pe={key:0,class:"help"},Fe={class:"pe-section"},xe={class:"pe-section-head"},Ve={class:"pe-row is-3"},Me={value:"total"},Ee={value:"monthly"},Ae={class:"control"},Se={class:"button is-static"},Te={class:"control"},Xe={class:"button is-static"},Ie={key:0,class:"help"},Ne={key:0,class:"pe-section"},De={class:"pe-section-head"},Qe={class:"pe-switch-row"},Oe={class:"pe-switch-row"},Ue={class:"pe-switch-row"},Re={class:"pe-switch-row"},We={key:0,class:"pe-switch-row"},Ge={class:"pe-switch-row"};function He(e,t,i,He,qe,Ke){const je=(0,s.g2)("font-awesome-icon"),Ye=(0,s.g2)("b-input"),Be=(0,s.g2)("b-field"),ze=(0,s.g2)("b-select"),Je=(0,s.g2)("b-switch"),Ze=(0,s.g2)("b-datepicker"),et=(0,s.g2)("b-notification"),tt=(0,s.g2)("LocalCenterSelect"),it=(0,s.g2)("b-checkbox"),st=(0,s.g2)("SuggestedAmountsField");return(0,s.uX)(),(0,s.CE)("div",n,[Ke.showBasics?((0,s.uX)(),(0,s.CE)(s.FK,{key:0},[Ke.isNew?((0,s.uX)(),(0,s.CE)("div",l,[(0,s.Lk)("div",o,[(0,s.Lk)("h3",null,(0,a.v_)(e.$t("What are you selling?")),1)]),(0,s.Lk)("div",r,[(0,s.Lk)("button",{type:"button",class:(0,a.C4)(["pe-tile",{"is-on":"fee"===i.item.type}]),onClick:t[0]||(t[0]=e=>Ke.selectProductType("fee"))},[(0,s.Lk)("span",u,[(0,s.bF)(je,{icon:"fa-light fa-id-card"})]),(0,s.Lk)("span",null,[(0,s.Lk)("b",null,(0,a.v_)(e.$t("Membership Fee")),1),(0,s.Lk)("span",null,(0,a.v_)(e.$t("Members join or renew on a cycle. Levels, validity, reminders.")),1)]),(0,s.Lk)("span",c,[(0,s.bF)(je,{icon:"fa-light fa-circle-check"})])],2),(0,s.Lk)("button",{type:"button",class:(0,a.C4)(["pe-tile",{"is-on":"donation"===i.item.type}]),onClick:t[1]||(t[1]=e=>Ke.selectProductType("donation"))},[(0,s.Lk)("span",d,[(0,s.bF)(je,{icon:"fa-light fa-hand-holding-heart"})]),(0,s.Lk)("span",null,[(0,s.Lk)("b",null,(0,a.v_)(e.$t("Donation")),1),(0,s.Lk)("span",null,(0,a.v_)(e.$t("One-time or recurring gifts with a public landing page.")),1)]),(0,s.Lk)("span",m,[(0,s.bF)(je,{icon:"fa-light fa-circle-check"})])],2)])])):(0,s.Q3)("",!0),(0,s.Lk)("div",p,[(0,s.Lk)("div",{class:(0,a.C4)(["pe-row",{"is-2":!Ke.isFeeProduct}])},[(0,s.bF)(Be,{label:e.$t("Name"),type:qe.errors.name?"is-danger":"",message:qe.errors.name?e.$t("Give the product a name."):""},{default:(0,s.k6)(()=>[(0,s.bF)(Ye,{modelValue:i.item.name,"onUpdate:modelValue":[t[2]||(t[2]=e=>i.item.name=e),Ke.changeSlug],placeholder:Ke.isFeeProduct?e.$t("e.g. Annual membership"):e.$t("e.g. Winter appeal"),required:""},null,8,["modelValue","placeholder","onUpdate:modelValue"])]),_:1},8,["label","type","message"]),Ke.isFeeProduct||"manual_invoice"===i.item.type?(0,s.Q3)("",!0):((0,s.uX)(),(0,s.Wv)(Be,{key:0,label:e.$t("Payment page address"),message:i.item.id?e.$t("Fixed after creation."):""},{default:(0,s.k6)(()=>[(0,s.bF)(Be,null,{default:(0,s.k6)(()=>[(0,s.Lk)("p",h,[(0,s.Lk)("span",b,(0,a.v_)(e.tenant.paymentHost)+"/pay/",1)]),(0,s.bF)(Ye,{modelValue:i.item.slug,"onUpdate:modelValue":t[3]||(t[3]=e=>i.item.slug=e),disabled:!!i.item.id,expanded:""},null,8,["modelValue","disabled"])]),_:1})]),_:1},8,["label","message"]))],2)]),Ke.isFeeProduct?((0,s.uX)(),(0,s.CE)("div",g,[(0,s.Lk)("div",y,[(0,s.Lk)("h3",null,(0,a.v_)(e.$t("Billing cycle")),1),(0,s.Lk)("p",null,(0,a.v_)(Ke.isNew?e.$t("How long one payment keeps a membership valid. Cannot be changed later."):e.$t("The cycle length is locked once the product exists.")),1)]),(0,s.Lk)("div",f,[(0,s.bF)(Be,{label:e.$t("Cycle length")},{default:(0,s.k6)(()=>[(0,s.bF)(ze,{modelValue:i.item.monthPeriod,"onUpdate:modelValue":t[4]||(t[4]=e=>i.item.monthPeriod=e),disabled:!Ke.isNew,expanded:""},{default:(0,s.k6)(()=>[(0,s.Lk)("option",v,(0,a.v_)(e.$t("Monthly")),1),(0,s.Lk)("option",k,(0,a.v_)(e.$t("Every {n} months",{n:3})),1),(0,s.Lk)("option",L,(0,a.v_)(e.$t("Every {n} months",{n:6})),1),(0,s.Lk)("option",C,(0,a.v_)(e.$t("Yearly")),1)]),_:1},8,["modelValue","disabled"])]),_:1},8,["label"]),(0,s.bF)(Be,{label:e.$t("Cycle starts in"),message:Ke.fixedCycleEnabled?e.$t("Your organisation uses fixed-date cycles, so every member renews on the same date."):e.$t("Change it only if every member should renew in the same month.")},{default:(0,s.k6)(()=>[(0,s.bF)(ze,{modelValue:i.item.cycleMonth,"onUpdate:modelValue":t[5]||(t[5]=e=>i.item.cycleMonth=e),expanded:""},{default:(0,s.k6)(()=>[(0,s.Lk)("option",w,(0,a.v_)(e.$t("The month the member joins")),1
1),((0,s.uX)(),(0,s.CE)(s.FK,null,(0,s.pI)(12,e=>(0,s.Lk)("option",{key:e,value:e},(0,a.v_)(Ke.monthName(e)),9,$)),64))]),_:1},8,["modelValue"])]),_:1},8,["label","message"])]),i.item.monthPeriod>1?((0,s.uX)(),(0,s.CE)("div",_,[(0,s.Lk)("div",P,[(0,s.Lk)("div",null,[(0,s.Lk)("b",null,(0,a.v_)(e.$t("Pro-rate the first cycle")),1),(0,s.Lk)("span",null,(0,a.v_)(e.$t("Members who join mid-cycle pay only for the months left. The renewal date does not move.")),1)]),(0,s.bF)(Je,{modelValue:i.item.cycleHasProratio,"onUpdate:modelValue":t[6]||(t[6]=e=>i.item.cycleHasProratio=e)},null,8,["modelValue"])]),i.item.cycleHasProratio?((0,s.uX)(),(0,s.CE)("div",F,[(0,s.bF)(Be,{label:e.$t("Charge the full price when joining within"),message:e.$t("Stops tiny pro-rated charges right after a cycle begins."),style:{"max-width":"360px"}},{default:(0,s.k6)(()=>[(0,s.bF)(ze,{modelValue:i.item.proratioMinMonthsEnabler,"onUpdate:modelValue":t[7]||(t[7]=e=>i.item.proratioMinMonthsEnabler=e),expanded:""},{default:(0,s.k6)(()=>[(0,s.Lk)("option",x,(0,a.v_)(e.$t("Always pro-rate")),1),((0,s.uX)(),(0,s.CE)(s.FK,null,(0,s.pI)(12,t=>(0,s.Lk)("option",{key:t,value:t},(0,a.v_)(e.$t("{n} months of the cycle start",{n:t})),9,V)),64))]),_:1},8,["modelValue"])]),_:1},8,["label","message"])])):(0,s.Q3)("",!0)])):(0,s.Q3)("",!0),(0,s.bF)(Be,{label:e.$t("Fees start on"),message:e.$t("Nothing is owed before this date."),style:{"max-width":"280px"}},{default:(0,s.k6)(()=>[(0,s.bF)(Ze,{modelValue:Ke.startingDate,"onUpdate:modelValue":t[8]||(t[8]=e=>Ke.startingDate=e),placeholder:e.$t("Click to select..."),icon:"calendar","append-to-body":"",editable:"",expanded:""},null,8,["modelValue","placeholder"])]),_:1},8,["label","message"])])):(0,s.Q3)("",!0),(0,s.Lk)("div",M,[(0,s.Lk)("div",E,[(0,s.Lk)("h3",null,(0,a.v_)(e.$t("How people can pay")),1),(0,s.Lk)("p",null,(0,a.v_)(Ke.isFeeProduct?e.$t("Each level can offer either, within what is enabled here."):e.$t("Which options appear on the payment page.")),1)]),(0,s.Lk)("div",A,[Ke.recurringAvailable?((0,s.uX)(),(0,s.CE)("button",{key:0,type:"button",class:(0,a.C4)(["pe-tile",{"is-on":i.item.hasSubscription,"is-disabled":Ke.recurringLocked}]),disabled:Ke.recurringLocked,onClick:t[9]||(t[9]=e=>i.item.hasSubscription=!i.item.hasSubscription)},[(0,s.Lk)("span",T,[(0,s.bF)(je,{icon:"fa-light fa-repeat"})]),(0,s.Lk)("span",null,[(0,s.Lk)("b",null,(0,a.v_)(e.$t("Recurring")),1),(0,s.Lk)("span",null,(0,a.v_)(Ke.isFeeProduct?e.$t("Automatic renewal by card."):e.$t("Monthly or yearly gifts.")),1)]),(0,s.Lk)("span",X,[(0,s.bF)(je,{icon:"fa-light fa-circle-check"})])],10,S)):(0,s.Q3)("",!0),(0,s.Lk)("button",{type:"button",class:(0,a.C4)(["pe-tile",{"is-on":i.item.hasOneTimePayment,"is-disabled":Ke.oneTimeLocked}]),disabled:Ke.oneTimeLocked,title:Ke.oneTimeNeedsStripe?e.$t("Connect a Stripe account to accept one-off payments."):null,onClick:t[10]||(t[10]=e=>i.item.hasOneTimePayment=!i.item.hasOneTimePayment)},[(0,s.Lk)("span",N,[(0,s.bF)(je,{icon:"fa-light fa-credit-card"})]),(0,s.Lk)("span",null,[(0,s.Lk)("b",null,(0,a.v_)(e.$t("One-off")),1),(0,s.Lk)("span",null,(0,a.v_)(Ke.isFeeProduct?e.$t("Pay each cycle by card or bank transfer."):e.$t("A single gift.")),1)]),(0,s.Lk)("span",D,[(0,s.bF)(je,{icon:"fa-light fa-circle-check"})])],10,I)]),qe.errors.modes?((0,s.uX)(),(0,s.CE)("p",Q,(0,a.v_)(e.$t("Pick at least one way to pay.")),1)):(0,s.Q3)("",!0)]),Ke.isFeeProduct?((0,s.uX)(),(0,s.CE)("div",O,[(0,s.Lk)("div",U,[(0,s.Lk)("h3",null,(0,a.v_)(e.$t("Pricing model")),1),(0,s.Lk)("p",null,(0,a.v_)(Ke.isNew?e.$t("You set the levels or the amounts in the next step."):e.$t("Changing this archives the current levels or the flexible amount. Members keep their validity.")),1)]),(0,s.Lk)("div",R,[(0,s.Lk)("button",{type:"button",class:(0,a.C4)(["pe-tile",{"is-on":"fixed"===i.item.pricingMode}]),onClick:t[11]||(t[11]=e=>i.item.pricingMode="fixed")},[(0,s.Lk)("span",W,[(0,s.bF)(je,{icon:"fa-light fa-layer-group"})]),(0,s.Lk)("span",null,[(0,s.Lk)("b",null,(0,a.v_)(e.$t("Fixed levels")),1),(0,s.Lk)("span",null,(0,a.v_)(e.$t("Adult, Student, Family⦠each with its own price and rules.")),1)]),(0,s.Lk)("span",G,[(0,s.bF)(je,{icon:"fa-light fa-circle-check"})])],2),(0,s.Lk)("button",{type:"button",class:(0,a.C4)(["pe-tile",{"is-on":"flexible"===i.item.pricingMode}]),onClick:t[12]||(t[12]=e=>i.item.pricingMode="flexible")},[(0,s.Lk)("span",H,[(0,s.bF)(je,{icon:"fa-light fa-sliders"})]),(0,s.Lk)("span",null,[(0,s.Lk)("b",null,(0,a.v_)(e.$t("Flexible amount")),1),(0,s.Lk)("span",null,(0,a.v_)(e.$t("One level. Each member chooses how much, above a minimum.")),1)]),(0,s.Lk)("span",q,[(0,s.bF)(je,{icon:"fa-light fa-circle-check"})])],2)]),Ke.isNew||i.item.pricingMode===i.currentPricingMode?(0,s.Q3)("",!0):((0,s.uX)(),(0,s.Wv)(et,{key:0,t
1ype:"is-warning is-light",closable:!1},{default:(0,s.k6)(()=>[(0,s.eW)((0,a.v_)("flexible"===i.item.pricingMode?e.$t("Saving archives the {n} active levels. Per-member level assignments stop applying and you set the amounts next.",{n:i.activeLevelCount}):e.$t("Saving archives the flexible amount. You then add fixed levels and pick a default.")),1)]),_:1}))])):(0,s.Q3)("",!0),Ke.isDonationProduct&&e.tenant.settingFeatures.localCenter?.isActive?((0,s.uX)(),(0,s.CE)("div",K,[(0,s.Lk)("div",j,[(0,s.Lk)("h3",null,(0,a.v_)(e.$t("Ownership")),1)]),(0,s.Lk)("div",Y,[(0,s.Lk)("div",null,[(0,s.Lk)("b",null,(0,a.v_)(e.$t("Belongs to a chapter")),1),(0,s.Lk)("span",null,(0,a.v_)(e.$t("Only this chapter sells it and receives the money.")),1)]),(0,s.bF)(Je,{modelValue:qe.hasLocalCenter,"onUpdate:modelValue":t[13]||(t[13]=e=>qe.hasLocalCenter=e)},null,8,["modelValue"])]),qe.hasLocalCenter?((0,s.uX)(),(0,s.CE)("div",B,[(0,s.bF)(tt,{modelValue:i.item.localCenter,"onUpdate:modelValue":t[14]||(t[14]=e=>i.item.localCenter=e),label:e.$t("Chapter"),"use-autocomplete":!0,style:{"max-width":"420px"}},null,8,["modelValue","label"])])):(0,s.Q3)("",!0),e.tenant.settingFeatures.onlinePayments?.productsWithLocalCenterOption?((0,s.uX)(),(0,s.CE)("div",z,[(0,s.Lk)("div",null,[(0,s.Lk)("b",null,(0,a.v_)(e.$t("Let donors pick a chapter")),1),(0,s.Lk)("span",null,(0,a.v_)(e.$t("Adds a chapter selector at checkout; totals per chapter show for chapter finance.")),1)]),(0,s.bF)(Je,{modelValue:i.item.hasLocalCenterOption,"onUpdate:modelValue":t[15]||(t[15]=e=>i.item.hasLocalCenterOption=e)},null,8,["modelValue"])])):(0,s.Q3)("",!0)])):(0,s.Q3)("",!0)],64)):(0,s.Q3)("",!0),Ke.showDraftLevels?((0,s.uX)(),(0,s.CE)("div",J,[(0,s.Lk)("div",Z,[(0,s.Lk)("h3",null,(0,a.v_)(e.$t("Levels")),1),(0,s.Lk)("p",null,(0,a.v_)(e.$t("Add the basics now. Age bands, registration fees, company seats and visibility are edited per level afterwards.")),1)]),(0,s.Lk)("div",null,[((0,s.uX)(!0),(0,s.CE)(s.FK,null,(0,s.pI)(i.item.draftLevels,(t,n)=>((0,s.uX)(),(0,s.CE)("div",{key:n,class:"pe-draft"},[(0,s.bF)(Be,{label:e.$t("Level name"),type:qe.errors.draftLevels&&!t.name?"is-danger":""},{default:(0,s.k6)(()=>[(0,s.bF)(Ye,{modelValue:t.name,"onUpdate:modelValue":e=>t.name=e,placeholder:e.$t("e.g. Adult")},null,8,["modelValue","onUpdate:modelValue","placeholder"])]),_:2},1032,["label","type"]),(0,s.bF)(Be,{label:e.$t("Price"),type:qe.errors.draftLevels&&t.name&&!Ke.isMoney(t.price)?"is-danger":""},{default:(0,s.k6)(()=>[(0,s.bF)(Be,null,{default:(0,s.k6)(()=>[(0,s.bF)(Ye,{modelValue:t.price,"onUpdate:modelValue":e=>t.price=e,type:"number",step:"0.01",min:"0",expanded:""},null,8,["modelValue","onUpdate:modelValue"]),(0,s.Lk)("p",ee,[(0,s.Lk)("span",te,(0,a.v_)(Ke.currencyLabel),1)])]),_:2},1024)]),_:2},1032,["label","type"]),i.item.hasOneTimePayment&&i.item.hasSubscription?((0,s.uX)(),(0,s.Wv)(Be,{key:0,label:e.$t("Members can pay")},{default:(0,s.k6)(()=>[(0,s.Lk)("div",ie,[(0,s.bF)(it,{modelValue:t.oneTime,"onUpdate:modelValue":e=>t.oneTime=e,class:"mr-3"},{default:(0,s.k6)(()=>[(0,s.eW)((0,a.v_)(e.$t("One-off")),1)]),_:1},8,["modelValue","onUpdate:modelValue"]),(0,s.bF)(it,{modelValue:t.recurring,"onUpdate:modelValue":e=>t.recurring=e},{default:(0,s.k6)(()=>[(0,s.eW)((0,a.v_)(e.$t("Recurring")),1)]),_:1},8,["modelValue","onUpdate:modelValue"])])]),_:2},1032,["label"])):((0,s.uX)(),(0,s.CE)("div",se)),(0,s.bF)(Be,{label:"Â "},{default:(0,s.k6)(()=>[(0,s.Lk)("button",{type:"button",class:"button is-white is-rounded","aria-label":e.$t("Remove level"),disabled:1===i.item.draftLevels.length,onClick:e=>i.item.draftLevels.splice(n,1)},[(0,s.Lk)("span",ne,[(0,s.bF)(je,{icon:"fa-light fa-trash"})])],8,ae)]),_:2},1024)]))),128))]),qe.errors.draftLevels?((0,s.uX)(),(0,s.CE)("p",le,(0,a.v_)(e.$t("Every level needs a name and a price.")),1)):(0,s.Q3)("",!0),(0,s.Lk)("div",null,[(0,s.Lk)("button",{type:"button",class:"button is-light is-small is-rounded",onClick:t[16]||(t[16]=(...e)=>Ke.addDraftLevel&&Ke.addDraftLevel(...e))}," + "+(0,a.v_)(e.$t("Add another level")),1)]),(0,s.bF)(et,{type:"is-info is-light",closable:!1},{default:(0,s.k6)(()=>[(0,s.eW)((0,a.v_)(Ke.hasMembershipProduct?e.$t("The organisation already has a membership product; levels of this one are assigned from a member's profile."):e.$t("This becomes the organisation's membership product. The first level is the default for new members; change that on the product page.")),1)]),_:1})])):(0,s.Q3)("",!0),Ke.showFlexible?((0,s.uX)(),(0,s.CE)("div",oe,[(0,s.Lk)("div",re,[(0,s.Lk)("h3",null,(0,a.v_)(e.$t("Amounts")),1),(0,s.Lk)("p",null,(0,a.v_)(e.$t("The membership activates on any amount at or above the minimum. Whole amounts only.")),1)]),(0,s.Lk)("div",ue,[(0,s.bF)(Be,{label:e.$t("Minimum amount"),type:qe.errors.flexMin?"is-danger":"",message:qe.errors.flexMin?e.$t("Set a minimum amount greater than zero."):e.$t("Required. Below this, no membership.")},{default:(0,s.k6)(()=>[(0,s.bF)(Be,null,{default:(0,s.k6)(()=>[(0,s.bF)(Ye,{modelValue:i.item.donationMembership.minPrice,"onUpdate:modelValue":t[17]||(t[17]=e=>i.item.donationMembership.minPrice=e),type:"number",step:"1",min:"1",expanded:""},null,8,["modelValue"]),(0,s.Lk)("p",ce,[(0,s.Lk)("span",de,(0,a.v_)(Ke.currencyLabel),1)])]),_:1})]),_:1},8,["label","type","message"]),(0,s.bF)(Be,{label:e.$t("Maximum amount"),type:qe.errors.flexMax?"is-danger":"",message:qe.errors.flexMax?e.$t("The maximum amount cannot be lower than the minimum amount."):e.$t("Optional. Leave empty for no upper limit.")},{default:(0,s.k6)(()=>[(0,s.bF)(Be,null,{default:(0,s.k6)(()=>[(0,s.bF)(Ye,{modelValue:i.item.donationMembership.maxPrice,"onUpdate:modelValue":t[18]||(t[18]=e=>i.item.donationMembership.maxPrice=e),type:"number",step:"1",min:"0",placeholder:e.$t("No maximum"),expanded:""},null,8,["modelValue","placeholder"]),(0,s.Lk)("p",me,[(0,s.Lk)("span",pe,(0,a.v_)(Ke.currencyLabel),1)])]),_:1})]),_:1},8,["label","type","message"]),(0,s.bF)(Be,{label:e.$t("Prefilled amount"),message:e.$t("What the amount box shows first.")},{default:(0,s.k6)(()=>[(0,s.bF)(Be,null,{default:(0,s.k6)(()=>[(0,s.bF)(Ye,{modelValue:i.item.donationMembership.suggestedPrice,"onUpdate:modelValue":t[19]||(t[19]=e=>i.item.donationMembership.suggestedPrice=e),type:"number",step:"1",min:"0",expanded:""},null,8,["modelValue"]),(0,s.Lk)("p",he,[(0,s.Lk)("span",be,(0,a.v_)(Ke.currencyLabel),1)])]),_:1})]),_:1},8,["label","message"])]),(0,s.bF)(Be,{label:e.$t("Quick-pick amounts"),type:qe.errors.flexChips?"is-danger":"",message:qe.errors.flexChips?e.$t("Suggested amount {amount} is outside the minimum and maximum.",{amount:qe.errors.flexChips}
1):e.$t("Members tap one or type another amount. Each must sit inside the minimum and maximum.")},{default:(0,s.k6)(()=>[(0,s.bF)(st,{modelValue:i.item.donationMembership.suggestedAmounts,"onUpdate:modelValue":t[20]||(t[20]=e=>i.item.donationMembership.suggestedAmounts=e),currency:Ke.currencyLabel,min:i.item.donationMembership.minPrice,max:i.item.donationMembership.maxPrice},null,8,["modelValue","currency","min","max"])]),_:1},8,["label","type","message"])])):(0,s.Q3)("",!0),Ke.showDonationSettings?((0,s.uX)(),(0,s.CE)(s.FK,{key:3},[(0,s.Lk)("div",ge,[(0,s.Lk)("div",ye,[(0,s.Lk)("h3",null,(0,a.v_)(e.$t("Amounts")),1),Ke.isNew?((0,s.uX)(),(0,s.CE)("p",fe,(0,a.v_)(e.$t("Six suggested amounts are generated for you; edit them in the price list afterwards.")),1)):(0,s.Q3)("",!0)]),(0,s.Lk)("div",ve,[(0,s.Lk)("div",null,[(0,s.Lk)("b",null,(0,a.v_)(e.$t("Enable custom amount")),1),(0,s.Lk)("span",null,(0,a.v_)(e.$t("Donors can type any amount within the limits.")),1)]),(0,s.bF)(Je,{modelValue:i.item.hasCustomPriceValue,"onUpdate:modelValue":t[21]||(t[21]=e=>i.item.hasCustomPriceValue=e)},null,8,["modelValue"])]),i.item.hasCustomPriceValue?((0,s.uX)(),(0,s.CE)("div",ke,[(0,s.Lk)("div",Le,[(0,s.bF)(Be,{label:e.$t("Minimum")},{default:(0,s.k6)(()=>[(0,s.bF)(Be,null,{default:(0,s.k6)(()=>[(0,s.bF)(Ye,{modelValue:i.item.customMinPrice,"onUpdate:modelValue":t[22]||(t[22]=e=>i.item.customMinPrice=e),type:"number",min:"0",placeholder:e.$t("No minimum"),expanded:""},null,8,["modelValue","placeholder"]),(0,s.Lk)("p",Ce,[(0,s.Lk)("span",we,(0,a.v_)(Ke.currencyLabel),1)])]),_:1})]),_:1},8,["label"]),(0,s.bF)(Be,{label:e.$t("Maximum"),type:qe.errors.customMax?"is-danger":"",message:qe.errors.customMax?e.$t("The maximum amount cannot be lower than the minimum amount."):""},{default:(0,s.k6)(()=>[(0,s.bF)(Be,null,{default:(0,s.k6)(()=>[(0,s.bF)(Ye,{modelValue:i.item.customMaxPrice,"onUpdate:modelValue":t[23]||(t[23]=e=>i.item.customMaxPrice=e),type:"number",min:"0",placeholder:e.$t("No maximum"),expanded:""},null,8,["modelValue","placeholder"]),(0,s.Lk)("p",$e,[(0,s.Lk)("span",_e,(0,a.v_)(Ke.currencyLabel),1)])]),_:1})]),_:1},8,["label","type","message"])]),Ke.currencies.length>1?((0,s.uX)(),(0,s.CE)("p",Pe,(0,a.v_)(e.$t("For multi currency payments, it will apply the same values for all currencies")),1)):(0,s.Q3)("",!0)])):(0,s.Q3)("",!0)]),(0,s.Lk)("div",Fe,[(0,s.Lk)("div",xe,[(0,s.Lk)("h3",null,(0,a.v_)(e.$t("Campaign goal")),1),(0,s.Lk)("p",null,(0,a.v_)(e.$t("Optional. Shows a progress bar on the landing page.")),1)]),(0,s.Lk)("div",Ve,[i.item.hasSubscription&&i.item.hasOneTimePayment?((0,s.uX)(),(0,s.Wv)(Be,{key:0,label:e.$t("Goal type")},{default:(0,s.k6)(()=>[(0,s.bF)(ze,{modelValue:qe.campaignGoalType,"onUpdate:modelValue":t[24]||(t[24]=e=>qe.campaignGoalType=e),expanded:""},{default:(0,s.k6)(()=>[(0,s.Lk)("option",Me,(0,a.v_)(e.$t("Total goal")),1),(0,s.Lk)("option",Ee,(0,a.v_)(e.$t("Monthly goal")),1)]),_:1},8,["modelValue"])]),_:1},8,["label"])):(0,s.Q3)("",!0),Ke.showTotalGoal?((0,s.uX)(),(0,s.Wv)(Be,{key:1,label:e.$t("Goal value")},{default:(0,s.k6)(()=>[(0,s.bF)(Be,null,{default:(0,s.k6)(()=>[(0,s.bF)(Ye,{modelValue:i.item.goalValue,"onUpdate:modelValue":t[25]||(t[25]=e=>i.item.goalValue=e),type:"number",min:"0",placeholder:e.$t("No goal"),expanded:""},null,8,["modelValue","placeholder"]),(0,s.Lk)("p",Ae,[(0,s.Lk)("span",Se,(0,a.v_)(Ke.currencyLabel),1)])]),_:1})]),_:1},8,["label"])):(0,s.Q3)("",!0),Ke.showMonthlyGoal?((0,s.uX)(),(0,s.Wv)(Be,{key:2,label:e.$t("Goal value")+" / "+e.$t("month")},{default:(0,s.k6)(()=>[(0,s.bF)(Be,null,{default:(0,s.k6)(()=>[(0,s.bF)(Ye,{modelValue:i.item.goalValueSubscription,"onUpdate:modelValue":t[26]||(t[26]=e=>i.item.goalValueSubscription=e),type:"number",min:"0",placeholder:e.$t("No goal"),expanded:""},null,8,["modelValue","placeholder"]),(0,s.Lk)("p",Te,[(0,s.Lk)("span",Xe,(0,a.v_)(Ke.currencyLabel),1)])]),_:1})]),_:1},8,["label"])):(0,s.Q3)("",!0),i.item.goalValueSubscription||i.item.goalValue?((0,s.uX)(),(0,s.Wv)(Be,{key:3,label:e.$t("Target date"),message:e.$t("Shown to donors; nothing closes automatically.")},{default:(0,s.k6)(()=>[(0,s.bF)(Ze,{modelValue:i.item.maxDate,"onUpdate:modelValue":t[27]||(t[27]=e=>i.item.maxDate=e),placeholder:e.$t("Click to select..."),icon:"calendar","append-to-body":"",editable:"",expanded:"",onClick:Ke.initMaxDate},null,8,["modelValue","placeholder","onClick"])]),_:1},8,["label","message"])):(0,s.Q3)("",!0)]),Ke.currencies.length>1?((0,s.uX)(),(0,s.CE)("p",Ie,(0,a.v_)(e.$t("Not available for multi currency payments")),1)):(0,s.Q3)("",!0)]),i.item.settings?((0,s.uX)(),(0,s.CE)("div",Ne,[(0,s.Lk)("div",De,[(0,s.Lk)("h3",null,(0,a.v_)(e.$t("Landing page behaviour")),1)]),(0,s.Lk)("div",Qe,[(0,s.Lk)("div",null,[(0,s.Lk)("b",null,(0,a.v_)(e.$t("Messages of support from donors")),1),(0,s.Lk)("span",null,(0,a.v_)(e.$t("Donors can leave an encouraging message.")),1)]),(0,s.bF)(Je,{modelValue:i.item.settings.commentSection,"onUpdate:modelValue":t[28]||(t[28]=e=>i.item.settings.commentSection=e)},null,8,["modelValue"])]),(0,s.Lk)("div",Oe,[(0,s.Lk)("div",null,[(0,s.Lk)("b",null,(0,a.v_)(e.$t("Display top 50 recent donations")),1),(0,s.Lk)("span",null,(0,a.v_)(e.$t("Public anonymized display on landing page.")),1)]),(0,s.bF)(Je,{modelValue:i.item.settings.newestAndTopDonationSection,"onUpdate:modelValue":t[29]||(t[29]=e=>i.item.settings.newestAndTopDonationSection=e)},null,8,["modelValue"])]),(0,s.Lk)("div",Ue,[(0,s.Lk)("div",null,[(0,s.Lk)("b",null,(0,a.v_)(e.$t("Enable payment confidentiality")),1),(0,s.Lk)("span",null,(0,a.v_)(e.$t("The donor has the option to make their name anonymous on the donors page.")),1)]),(0,s.bF)(Je,{modelValue:i.item.hasConfidentialityEnabled,"onUpdate:modelValue":t[30]||(t[30]=e=>i.item.hasConfidentialityEnabled=e)},null,8,["modelValue"])]),(0,s.Lk)("div",Re,[(0,s.Lk)("div",null,[(0,s.Lk)("b",null,(0,a.v_)(e.$t("Disable newsletter subscription")),1),(0,s.Lk)("span",null,(0,a.v_)(e.$t("Will not display the newsletter checkbox on the payment page.")),1)]),(0,s.bF)(Je,{modelValue:i.item.settings.disableSubscribe,"onUpdate:modelValue":t[31]||(t[31]=e=>i.item.settings.disableSubscribe=e)},null,8,["modelValue"])]),e.tenant.settingFeatures.onlinePayments?.hasCreateAccountForExternalProfiles?((0,s.uX)(),(0,s.CE)("div",We,[(0,s.Lk)("div",null,[(0,s.Lk)("b",null,(0,a.v_)(e.$t("Disable register checkbox for non-members")),1),(0,s.Lk)("span",null,(0,a.v_)(e.$t("Non-members will not see the option to create an account.")),1)]),(0,s.bF)(Je,{modelValue:i.item.settings.disableRegister,"onUpdate:modelValue":t[32]||(t[32]=e=>i.item.settings.disableRegister=e)},null,8,["modelValue"])])):(0,s.Q3)("",!0),(0,s.Lk)("div",Ge,[(0,s.Lk)("div",null,[(0,s.Lk)("b",null,(0,a.v_)(e.$t("Require full address")),1),(0,s.Lk)("span",null,(0,a.v_)(e.$t("Will ask for the full name, address, and postal code.")),1)]),(0,s.bF)(Je,{modelValue:i.item.settings.requireFullAddress,"onUpdate:modelValue":t[33]||(t[33]=e=>i.item.settings.requireFullAddress=e)},null,8,["modelValue"])])])):(0,s.Q3)("",!0)],64)):(0,s.Q3)("",!0)])}i(44114),i(18111),i(22489),i(20116),i(13579);var qe=i(40834),Ke=i(95256),je=i(95352),Ye=i(93415),Be=i(29025),ze={name:"ProductForm",components:{SuggestedAmountsField:Ye.A,LocalCenterSelect:Be.A},props:{item:{type:Object,required:!0},mode:{type:String,default:"edit"},step:{type:Number,default:1},isLocal:{type:Boolean,default:!1},currentPricingMode:{type:String,default:"fixed"},activeLevelCount:{type:Number,default:0}},data(){return{errors:{},hasLocalCenter:!!this.item.localCenter,campaignGoalType:this.item.goalValueSubscription?"monthly":"total"}},computed:{...(0,qe.L8)(["tenant","user","isGranted"]),isNew(){return"create"===this.mode},isFeeProduct(){return"fee"===this.item.type||!0===this.item.isFee},isDonationProduct(){return"donation"===this.item.type},showBasics(){return!this.isNew||1===this.step},showDraftLevels(){return this.isNew&&2===this.step&&this.isFeeProduct&&"flexible"!==this.item.pricingMode}
1,showFlexible(){return this.isNew&&2===this.step&&this.isFeeProduct&&"flexible"===this.item.pricingMode},showDonationSettings(){return this.isDonationProduct&&(!this.isNew||2===this.step)},hasMembershipProduct(){return!!this.tenant?.settingFeatures?.fees?.productId},fixedCycleEnabled(){return!!this.tenant?.settingFeatures?.fees?.fixedStartingDateFee},currencyLabel(){return(this.tenant?.currency||"").toUpperCase()},currencies(){const e=[this.tenant.currency];return this.tenant.settingFeatures?.onlinePayments?.currencies&&e.push(...this.tenant.settingFeatures.onlinePayments.currencies.filter(e=>e!==this.tenant.currency)),e},recurringAvailable(){return!["event","manual_invoice"].includes(this.item.type)&&(!this.isLocal||!!this.user?.localCenter?.localCenterStripeAccount)},recurringLocked(){return!(!this.item.id||this.item.hasOneTimePayment)},oneTimeNeedsStripe(){return this.isLocal?!this.user?.localCenter?.localCenterStripeAccount:!this.tenant?.stripeAccount},oneTimeLocked(){return!!this.item.id&&!this.item.hasSubscription||this.oneTimeNeedsStripe},showTotalGoal(){return this.item.hasOneTimePayment&&(!this.item.hasSubscription||"total"===this.campaignGoalType)},showMonthlyGoal(){return this.item.hasSubscription&&(!this.item.hasOneTimePayment||"monthly"===this.campaignGoalType)},startingDate:{get(){return this.item.startingDate?(0,Ke.QE)(this.item.startingDate):null},set(e){this.item.startingDate=e?(0,Ke.vW)(e):null}}},watch:{hasLocalCenter(e){e||(this.item.localCenter=null)},"item.type"(){this.errors={}}},created(){void 0!==this.item.hasCustomPriceValue&&null!==this.item.hasCustomPriceValue||(this.item.hasCustomPriceValue=!0),this.item.pricingMode||(this.item.pricingMode=this.currentPricingMode||"fixed"),this.isNew&&(Array.isArray(this.item.draftLevels)&&this.item.draftLevels.length||(this.item.draftLevels=[],this.addDraftLevel()),this.item.donationMembership||(this.item.donationMembership={enabled:!1,minPrice:null,maxPrice:null,suggestedPrice:null,suggestedAmounts:[]}))},methods:{monthName(e){return(0,je.g6)(e,this.$i18n?.locale||"en")},isMoney(e){return null!==(0,je.Ro)(e)&&(0,je.Ro)(e)>=0},changeSlug(){this.item.id||!this.item.name||this.isFeeProduct||(this.item.slug=(0,Ke.Yv)(this.item.name))},selectProductType(e){this.item.type=e,"fee"===e&&(this.item.hasSubscription=!0,this.item.hasOneTimePayment=!1),"donation"===e&&(this.item.hasCustomPriceValue=!0,this.item.isInternal=!0,this.item.isExternal=!0,this.item.hasOneTimePayment=!this.oneTimeNeedsStripe,this.item.hasSubscription=!0,this.item.settings&&(this.item.settings.isThankYouSingular=!1),this.changeSlug())},addDraftLevel(){this.item.draftLevels.push({name:"",price:null,oneTime:!!this.item.hasOneTimePayment,recurring:!!this.item.hasSubscription})},initMaxDate(){this.item.maxDate||(this.item.maxDate=new Date)},validate(){const e={};if(this.showBasics&&((this.item.name||"").trim()||(e.name=!0),this.item.hasSubscription||this.item.hasOneTimePayment||(e.modes=!0)),this.showDraftLevels){const t=this.item.draftLevels||[],i=t.filter(e=>(e.name||"").trim());i.length&&!i.some(e=>!this.isMoney(e.price))||(e.draftLevels=!0),this.item.hasOneTimePayment&&this.item.hasSubscription&&i.some(e=>!e.oneTime&&!e.recurring)&&(e.draftLevels=!0)}
1if(this.showFlexible){const t=this.item.donationMembership,i=(0,je.Ro)(t.minPrice),s=(0,je.Ro)(t.maxPrice);i>0||(e.flexMin=!0),null!==s&&null!==i&&s<i&&(e.flexMax=!0);const a=(t.suggestedAmounts||[]).find(e=>null!==i&&e<i||null!==s&&s>0&&e>s);void 0!==a&&(e.flexChips=a)}if(this.showDonationSettings&&this.item.hasCustomPriceValue){const t=(0,je.Ro)(this.item.customMinPrice),i=(0,je.Ro)(this.item.customMaxPrice);null!==t&&null!==i&&i>0&&i<t&&(e.customMax=!0)}return this.errors=e,!Object.keys(e).length||(this.$buefy.toast.open({type:"is-danger",message:this.$t("Fix the highlighted fields")}),!1)}}},Je=i(66262);const Ze=(0,Je.A)(ze,[["render",He]]);var et=Ze},93415:function(e,t,i){i.d(t,{A:function(){return L}});var s=i(20641),a=i(90033),n=i(53751);const l={class:"suggested-amounts-field"},o={key:0,class:"tags mb-2"},r=["aria-label","onClick"],u={key:1,class:"suggested-amounts-add"},c={class:"field has-addons mb-0"},d={class:"control"},m=["min","max","placeholder"],p={class:"control"},h={class:"button is-static",style:{"text-transform":"uppercase","font-weight":"600"}},b=["disabled"],g={key:2,class:"help is-danger"};function y(e,t,i,y,f,v){return(0,s.uX)(),(0,s.CE)("div",l,[i.modelValue.length?((0,s.uX)(),(0,s.CE)("div",o,[((0,s.uX)(!0),(0,s.CE)(s.FK,null,(0,s.pI)(i.modelValue,t=>((0,s.uX)(),(0,s.CE)("span",{key:t,class:"tag is-medium is-primary is-rounded"},[(0,s.eW)((0,a.v_)(i.currency?e.$filters.money(t,i.currency):t)+" ",1),(0,s.Lk)("button",{type:"button",class:"delete is-small","aria-label":e.$t("Remove"),onClick:e=>v.remove(t)},null,8,r)]))),128))])):(0,s.Q3)("",!0),v.canAddMore?((0,s.uX)(),(0,s.CE)("div",u,[(0,s.Lk)("div",c,[(0,s.Lk)("div",d,[(0,s.bo)((0,s.Lk)("input",{"onUpdate:modelValue":t[0]||(t[0]=e=>f.draft=e),class:"input",type:"number",step:"1",min:i.min||1,max:i.max||null,placeholder:e.$t("Add amount"),style:{width:"120px"},onKeydown:t[1]||(t[1]=(0,n.jR)((0,n.D$)((...e)=>v.add&&v.add(...e),["prevent"]),["enter"]))},null,40,m),[[n.Jo,f.draft]])]),(0,s.Lk)("div",p,[(0,s.Lk)("span",h,(0,a.v_)(v.currencyLabel),1)])]),(0,s.Lk)("button",{type:"button",class:"button is-primary is-rounded",disabled:!v.draftIsValid,onClick:t[2]||(t[2]=(...e)=>v.add&&v.add(...e))},(0,a.v_)(e.$t("Add")),9,b)])):(0,s.Q3)("",!0),v.draftError?((0,s.uX)(),(0,s.CE)("p",g,(0,a.v_)(v.draftError),1)):(0,s.Q3)("",!0)])}i(18111),i(22489);var f={name:"SuggestedAmountsField",props:{modelValue:{type:Array,default:()=>[]},currency:{type:String,default:""},min:{type:[Number,String],default:null},max:{type:[Number,String],default:null},maxCount:{type:Number,default:8}},emits:["update:modelValue"],data(){return{draft:null}},computed:{currencyLabel(){return(this.currency||"").toUpperCase()},canAddMore(){return this.modelValue.length<this.maxCount},draftError(){if(null===this.draft||""===this.draft)return null;const e=parseFloat(this.draft);if(!Number.isFinite(e)||e<=0||!Number.isInteger(e))return this.$t("Suggested amounts must be whole numbers greater than zero.");const t=parseFloat(this.min);if(Number.isFinite(t)&&e<t)return this.$t("A suggested amount cannot be lower than the minimum amount.");const i=parseFloat(this.max);return Number.isFinite(i)&&i>0&&e>i?this.$t("A suggested amount cannot be higher than the maximum amount."):this.modelValue.includes(e)?this.$t("Suggested amounts must be unique."):null},draftIsValid(){return null!==this.draft&&""!==this.draft&&null===this.draftError}},methods:{add(){if(!this.draftIsValid||!this.canAddMore)return;const e=[...this.modelValue,parseInt(this.draft,10)].sort((e,t)=>e-t);this.$emit("update:modelValue",e),this.draft=null},remove(e){this.$emit("update:modelValue",this.modelValue.filter(t=>t!==e))}}},v=i(66262);const k=(0,v.A)(f,[["render",y],["__scopeId","data-v-3683d35e"]]);var L=k},95352:function(e,t,i){i.d(t,{$t:function(){return L},IQ:function(){return v},KS:function(){return x},RI:function(){return h},Ro:function(){return p},WA:function(){return E},XG:function(){return _},_p:function(){return V},bW:function(){return C},dD:function(){return $},g6:function(){return f},h3:function(){return M},lj:function(){return w},mZ:function(){return P},qW:function(){return y},s6:function(){return k},tC:function(){return a},tK:function(){return g},up:function(){return b}});i(44114),i(18111),i(22489),i(20116);var s=i(5833);const a=(e,t={})=>e.replace(/\{(\w+)\}
1/g,(e,i)=>t&&i in t?String(t[i]):e),n="fixed",l="flexible",o="product",r="own",u="lifetime",c="everyone",d="age",m="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 h(e){if(null===e||void 0===e||""===e)return null;const t=parseInt(e,10);return Number.isFinite(t)?t:null}function b(e,t,i=a){const n=p(e);return null===n?i("Free"):(0,s.u)(n,t||"eur")}function g(e,t=a){const i=h(e)||1;return 1===i?t("Monthly"):12===i?t("Yearly"):t("Every {n} months",{n:i})}function y(e,t=a){const i=h(e)||1;return 1===i?t("per month"):12===i?t("per year"):t("per {n} months",{n:i})}function f(e,t="en"){const i=h(e);return i?new Date(2e3,i-1,1).toLocaleString(t,{month:"long"}):""}function v(e,t){return h(e?.overwriteMonthPeriod)||h(t?.monthPeriod)||1}function k(e){return!!e&&("fee"===e.type||!0===e.isFee)}function L(e){return(e?.productPrices||[]).find(e=>e.isCustomAmount&&!e.isArchived)||null}function C(e){return L(e)?l:n}function w(e){return e?.isCompanyPrice?m:h(e?.ageUnder)||h(e?.ageOver)?d:c}function $(e){return e?.isLifetime?u:h(e?.overwriteMonthPeriod)?r:o}function _(e,t=a){const i=h(e?.ageUnder),s=h(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 P(e){return!!e?.isHidden&&null===p(e?.price)}function F(e){const t=!0===e?.isSubscription,i=e?.isOneTime??!t;return{oneTime:!!i,recurring:t}}function x(e,t=a){const{oneTime:i,recurring:s}=F(e);return i&&s?t("One-off or recurring"):s?t("Recurring"):i?t("One-off"):""}function V(e,t,i,s=a){const n=i?.settingFeatures?.fees||{},l=[],o=x(e,s);if(o&&l.push(o),e?.isLifetime)l.push(s("Lifetime"));else{const i=v(e,t);l.push(g(i,s).toLowerCase()+(h(e?.overwriteMonthPeriod)?" ("+s("own cycle")+")":""))}return n.hasRegistrationFee&&p(e?.registrationFee)&&l.push(s("{amount} registration fee",{amount:b(e.registrationFee,e.currency||i?.currency,s)})),n.hasVat&&!e?.priceVatExempt&&p(e?.priceVatRate)&&l.push("+"+p(e.priceVatRate)+"% "+s("VAT")),e?.previousVersion&&l.push(s("has earlier prices")),l.join(" · ")}function M({price:e,product:t,tenant:i,defaultPriceId:s=null},n=a){const l=i?.settingFeatures?.fees||{},o=e?.currency||i?.currency,r=[],u=p(e?.price);if(P(e))r.push(n("Exemption level: no payment. Assigning it grants a full cycle of validity."));else if(e?.isLifetime)r.push(n("{amount} once, valid for life.",{amount:b(u,o,n)}));else{const i=v(e,t);let s=b(u,o,n)+" "+y(i,n)+".";h(e?.overwriteMonthPeriod)&&h(e.overwriteMonthPeriod)!==h(t?.monthPeriod)&&
1(s+=" "+n("The product default is {cycle}.",{cycle:g(t?.monthPeriod,n).toLowerCase()})),r.push(s)}if(l.hasRegistrationFee&&p(e?.registrationFee)&&!e?.isCompanyPrice){let t=n("Plus {amount} registration fee on a member's first ever payment.",{amount:b(e.registrationFee,o,n)});l.hasVat&&!e?.registrationFeeVatExempt&&p(e?.registrationFeeVatRate)&&(t+=" (+"+p(e.registrationFeeVatRate)+"% "+n("VAT")+")"),r.push(t)}l.hasVat&&!P(e)&&(e?.priceVatExempt?r.push(n("No VAT on the fee.")):p(e?.priceVatRate)?r.push(n("{rate}% VAT added on top and shown on the invoice.",{rate:p(e.priceVatRate)})):r.push(n("VAT rate not set yet.")));const c=x(e,n);if(P(e)||r.push(c?n("Payable {modes}.",{modes:c.toLowerCase()}):n("Not payable until a payment mode is on.")),l.productPriceAgeRestriction&&w(e)===d&&r.push(n("Only for members {age}. Suggested automatically to members in that band.",{age:_(e,n).toLowerCase()})),e?.isCompanyPrice){const t=h(e?.companySlots);r.push(n("Company membership covering {slots} people. Never offered to individuals.",{slots:t||n("unlimited")}))}return e?.isHidden&&!P(e)&&r.push(n("Not shown to members. Only admins can assign it.")),e?.isBundle&&r.push(n("One person pays; the people they add get a free companion level.")),s&&e?.id&&parseInt(s,10)===e.id&&r.push(n("This is the default level for new members.")),r}function E({product:e,tenant:t,step:i=null,draftLevels:s=[],flexible:n=null,locale:o="en"},r=a){const u=[],c=t?.settingFeatures?.fees||{};if(k(e)){const a=h(e.monthPeriod)||1,d=h(e.cycleMonth);if(e.pricingMode===l&&u.push(r("Members choose their own amount above a minimum. No fixed levels.")),u.push(g(a,r)+" "+(d?r("membership, everyone renews in {month}.",{month:f(d,o)}):r("membership, renewal on each member's join date."))),a>1&&e.cycleHasProratio){const t=h(e.proratioMinMonthsEnabler);u.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?u.push(r("Members choose card renewal or a one-off payment each cycle.")):e.hasSubscription?u.push(r("Renewal is automatic by card.")):e.hasOneTimePayment?u.push(r("Members pay each cycle themselves.")):u.push(r("No way to pay yet.")),1!==a||e.hasSubscription?u.push(r("Reminders go out 30, 7 and 1 day before the renewal date, on the day, and 7, 14 and 30 days after.")):u.push(r("Monthly one-off fees get no renewal reminders.")),2===i)if(e.pricingMode===l)u.push(p(n?.minPrice)>0?r("One flexible level, minimum {amount}. No other level can be added while it is active.",{amount:b(n.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?u.push(r("Name at least one level. The first one becomes the default for new members.")):u.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&&d&&u.push(r("Cycle intervals are counted from {month}.",{month:f(d,o)}))}else{if(e.slug&&u.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:b(e.customMinPrice,t?.currency,r)})),p(e.customMaxPrice)&&(i+=" "+r("up to {amount}",{amount:b(e.customMaxPrice,t?.currency,r)})),u.push(i+".")}else u.push(r("Donors pick one of the suggested amounts."));const i=p(e.goalValue)||p(e.goalValueSubscription);i&&u.push(r("Progress bar towards {amount}{monthly}.",{amount:b(i,t?.currency,r),monthly:p(e.goalValueSubscription)?" "+r("per month"):""})),e.hasLocalCenterOption&&u.push(r("Donors pick a chapter at checkout."))}return u}},95572:function(e,t,i){i.d(t,{A:function(){return x}});var s=i(20641),a=i(90033);const n={class:"product-create-wizard"},l={class:"pe-steps"},o={class:"pe-step-n"},r={key:0,class:"pe-step-line"},u={class:"pe-layout mt-4"},c={class:"pe-footer"},d={class:"pe-footer-left"},m=["disabled"],p={class:"icon is-small"},h={class:"pe-footer-right"},b=["disabled"],g={class:"icon is-small"},y=["disabled"];function f(e,t,i,f,v,k){const L=(0,s.g2)("font-awesome-icon"),C=(0,s.g2)("ProductForm"),w=(0,s.g2)("PreviewAside");return(0,s.uX)(),(0,s.CE)("div",n,[(0,s.Lk)("div",l,[((0,s.uX)(!0),(0,s.CE)(s.FK,null,(0,s.pI)(k.stepLabels,(e,t)=>((0,s.uX)(),(0,s.CE)("span",{key:e,class:(0,a.C4)(["pe-step",{"is-on":v.step===t+1,"is-done":v.step>t+1}])},[(0,s.Lk)("span",o,[v.step>t+1?((0,s.uX)(),(0,s.Wv)(L,{key:0,icon:"fa-light fa-check"})):((0,s.uX)(),(0,s.CE)(s.FK,{key:1},[(0,s.eW)((0,a.v_)(t+1),1)],64))]),(0,s.eW)(" "+(0,a.v_)(e)+" ",1),t<k.stepLabels.length-1?((0,s.uX)(),(0,s.CE)("span",r)):(0,s.Q3)("",!0)],2))),128))]),(0,s.Lk)("div",u,[(0,s.Lk)("div",null,[(0,s.bF)(C,{ref:"form",item:v.item,mode:"create",step:v.step,"is-local":k.isLocal},null,8,["item","step","is-local"])]),(0,s.bF)(w,{levels:k.previewLevels,flexible:k.previewFlexible,summary:k.summary,placeholder:k.previewPlaceholder,currency:e.tenant.currency},null,8,["levels","flexible","summary","placeholder","currency"])]),(0,s.Lk)("div",c,[(0,s.Lk)("div",d,[2===v.step?((0,s.uX)(),(0,s.CE)("button",{key:0,t
1ype:"button",class:"button is-light is-rounded",disabled:v.isSaving,onClick:t[0]||(t[0]=e=>v.step=1)},[(0,s.Lk)("span",p,[(0,s.bF)(L,{icon:"fa-light fa-arrow-left"})]),(0,s.Lk)("span",null,(0,a.v_)(e.$t("Back")),1)],8,m)):(0,s.Q3)("",!0)]),(0,s.Lk)("div",h,[(0,s.Lk)("button",{type:"button",class:"button is-light is-rounded",disabled:v.isSaving,onClick:t[1]||(t[1]=t=>e.$emit("cancel"))},(0,a.v_)(e.$t("cancel")),9,b),1===v.step?((0,s.uX)(),(0,s.CE)("button",{key:0,type:"button",class:"button is-primary is-rounded",onClick:t[2]||(t[2]=(...e)=>k.next&&k.next(...e))},[(0,s.Lk)("span",null,(0,a.v_)(e.$t("Continue")),1),(0,s.Lk)("span",g,[(0,s.bF)(L,{icon:"fa-light fa-arrow-right"})])])):((0,s.uX)(),(0,s.CE)("button",{key:1,type:"button",class:(0,a.C4)(["button is-primary is-rounded",{"is-loading":v.isSaving}]),disabled:v.isSaving,onClick:t[3]||(t[3]=(...e)=>k.save&&k.save(...e))},(0,a.v_)(k.isFee&&"flexible"!==v.item.pricingMode?e.$t("Create product and levels"):e.$t("Create product")),11,y))])])])}i(44114),i(18111),i(22489),i(61701),i(18237);var v=i(40834),k=i(95093),L=i.n(k),C=i(56042),w=i(27587),$=i(95352),_={name:"ProductCreateWizard",components:{ProductForm:C.A,PreviewAside:w.A},props:{localCenterId:{type:[Number,String],default:null}},emits:["created","cancel"],data(){return{step:1,isSaving:!1,item:{settings:{tenantLogo:!0,heroRadius:null,showTitle:!0,colorSelection:null,colorButton:null,disableSubscribe:!1,disableRegister:!1,lightThemeOnly:!1,isThankYouSingular:!1,commentSection:!0,newestAndTopDonationSection:!0,requireFullAddress:!1,requirePhone:!1},type:"fee",name:"",slug:"",monthPeriod:12,cycleMonth:null,cycleHasProratio:!1,proratioMinMonthsEnabler:null,startingDate:L()().format("YYYY-MM-DD"),hasSubscription:!0,hasOneTimePayment:!1,hasCustomPriceValue:!0,customMinPrice:null,customMaxPrice:null,goalValue:null,goalValueSubscription:null,maxDate:null,hasConfidentialityEnabled:!1,hasLocalCenterOption:!1,localCenter:null,isExternal:!0,isInternal:!0,currency:this.$store.getters.tenant?.currency||"usd",pricingMode:"fixed",draftLevels:[],donationMembership:{enabled:!1,minPrice:null,maxPrice:null,suggestedPrice:null,suggestedAmounts:[]}}}},computed:{...(0,v.L8)(["tenant","user","isGranted"]),isLocal(){return!!this.localCenterId},isFee(){return"fee"===this.item.type},stepLabels(){return this.isFee?[this.$t("Product"),"flexible"===this.item.pricingMode?this.$t("Amounts"):this.$t("Levels")]:[this.$t("Product"),this.$t("Donation settings")]},summary(){return(0,$.WA)({product:this.item,tenant:this.tenant,step:this.step,draftLevels:this.item.draftLevels,flexible:this.item.donationMembership,locale:this.$i18n?.locale},this.$t.bind(this))},previewLevels(){return this.isFee&&2===this.step&&"flexible"!==this.item.pricingMode?(this.item.draftLevels||[]).filter(e=>(e.name||"").trim()).map((e,t)=>({name:e.name,price:(0,$.Ro)(e.price),selected:0===t})):(this.isFee,[])},previewFlexible(){return this.isFee&&2===this.step&&"flexible"===this.item.pricingMode?{name:this.item.name||this.$t("Membership"),...this.item.donationMembership}:null},previewPlaceholder(){return this.isFee?2===this.step?this.$t("Name the first level to see it here."):"flexible"===this.item.pricingMode?this.$t("Amounts come in the next step"):this.$t("Levels come in the next step"):this.$t("Donors will see the payment page with the suggested amounts.")}},methods:{next(){this.$refs.form.validate()&&(this.step=2,this.$nextTick(()=>this.$emit("step",2)))},buildProductPayload(){const e={...this.item};if(delete e.draftLevels,delete e.pricingMode,this.isFee&&"flexible"===this.item.pricingMode){const t=this.item.donationMembership;e.donationMembership={enabled:!0,minPrice:(0,$.Ro)(t.minPrice),maxPrice:(0,$.Ro)(t.maxPrice),suggestedPrice:(0,$.Ro)(t.suggestedPrice),suggestedAmounts:(t.suggestedAmounts||[]).map(e=>(0,$.RI)(e)).filter(e=>null!==e)}}else delete e.donationMembership;return e.customMinPrice=(0,$.RI)(e.customMinPrice),e.customMaxPrice=(0,$.RI)(e.customMaxPrice),e.goalValue=(0,$.RI)(e.goalValue),e.goalValueSubscription=(0,$.RI)(e.goalValueSubscription),e.proratioMinMonthsEnabler=e.cycleHasProratio?(0,$.RI)(e.proratioMinMonthsEnabler):null,e.cycleMonth=(0,$.RI)(e.cycleMonth),this.isFee||(e.monthPeriod=1,e.cycleMonth=null,e.cycleHasProratio=null,e.proratioMinMonthsEnabler=null),this.isLocal?e.localCenter="/api/v1/local_centers/"+this.localCenterId:this.isGranted("ADMIN_TENANT")&&(e.organisation="/api/v1/admin-tenant/"+this.tenant.id),e.maxDate&&(e.maxDate=L()(e.maxDate).utc(e.maxDate).toDate()),e.startingDate&&(e.startingDate=L()(e.startingDate).utc(e.startingDate).toDate()),e},buildLevelPayload(e,t){const i=this.item.hasOneTimePayment&&this.item.hasSubscription;return{name:t.name.trim(),price:(0,$.Ro)(t.price),currency:this.tenant.currency,product:"/api/v1/products/"+e.uuid,isOneTime:i?!!t.oneTime:!!this.item.hasOneTimePayment,isSubscription:i?!!t.recurring:!!this.item.hasSubscription,isDefault:!1,allowedFeeProductPrices:[]}},save(){if(!this.$refs.form.validate())return;this.isSaving=!0;let e=null;const t=this.isFee&&"flexible"!==this.item.pricingMode?this.item.draftLevels.filter(e=>(e.name||"").trim()):[],i=[];this.$http.plain.post("/products",this.buildProductPayload()).then(s=>(e=s.data,t.reduce((t,s)=>t.then(()=>this.$http.plain.post("/product_prices",this.buildLevelPayload(e,s)).then(e=>i.push(e.data))),Promise.resolve()))).then(()=>this.setDefaultLevel(e,i[0])).then(()=>
1{this.$buefy.toast.open({type:"is-success",duration:5e3,message:this.isFee&&"flexible"===this.item.pricingMode?this.$t('Created "{name}" with a flexible amount from {amount}',{name:e.name,amount:(0,$.up)(this.item.donationMembership.minPrice,this.tenant.currency,this.$t.bind(this))}):1===i.length?this.$t('Created "{name}" with 1 level',{name:e.name}):this.$t('Created "{name}" with {n} levels',{name:e.name,n:i.length||6})}),this.$emit("created",e)}).catch(t=>{console.error(t),this.$buefy.toast.open({type:"is-danger",duration:6e3,message:t.response?.data?.["hydra:description"]||t.response?.data?.detail||this.$t("Failed to save product")}),e&&this.$emit("created",e)}).finally(()=>{this.isSaving=!1})},setDefaultLevel(e,t){if(!t||!this.isFee||this.isLocal||!this.isGranted("ADMIN_TENANT"))return Promise.resolve();const i={...this.tenant.settingFeatures?.fees||{}};return i.productId&&i.productId!==e.id?Promise.resolve():(i.productId||(i.productId=e.id,i.productUuid=e.uuid),i.defaultProductPriceId=t.id,this.$http.plain.patch("/tenants/"+this.tenant.id,{settingFeatures:{...this.tenant.settingFeatures,fees:i}}).then(e=>{this.$store.commit("setTenant",e.data),this.$store.state.spaces?.[e.data.slug]&&(this.$store.state.spaces[e.data.slug].tenant=e.data)}).catch(e=>console.error(e)))}}},P=i(66262);const F=(0,P.A)(_,[["render",f]]);var x=F}}]);
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.