1"use strict";(self["webpackChunkclient"]=self["webpackChunkclient"]||[]).push([[2320],{2269:function(e,t,s){s.d(t,{A:function(){return Ae}});s(44114);var i=s(20641),n=s(53751),l=s(90033);const a={class:"o-minwidth"},o={class:"nf-card"},r={class:"nf-card-title"},d={class:"nf-card-desc"},c={class:"nf-form-row"},u={class:"nf-form-row mt-5"},m={class:"nf-card"},h={class:"nf-card-title"},p={class:"nf-card-desc"},v={key:0,class:"nf-recipient-options"},b={class:"nf-recipient-option is-selected is-locked"},f={class:"nf-option-text"},L={class:"nf-option-title"},y={class:"nf-option-desc"},k={class:"nf-recipient-count"},g={key:1,class:"nf-recipient-options"},C={class:"nf-radio"},$={key:0,class:"nf-radio-dot"},E={class:"nf-option-text"},w={class:"nf-option-title"},T={class:"nf-option-desc"},N={key:0,class:"nf-recipient-count"},_={value:null},S=["value"],U={class:"nf-radio"},F={key:0,class:"nf-radio-dot"},V={class:"nf-option-text"},X={class:"nf-option-title"},Q={class:"nf-option-desc"},I={key:0,class:"nf-recipient-count"},A={class:"nf-radio"},R={key:0,class:"nf-radio-dot"},x={class:"nf-option-text"},B={class:"nf-option-title"},P={class:"nf-option-desc"},D={key:0,class:"nf-recipient-count"},O={value:null},j=["value"],q={class:"nf-radio"},M={key:0,class:"nf-radio-dot"},G={class:"nf-option-text"},W={class:"nf-option-title"},K={class:"nf-option-desc"},z={key:0,class:"nf-recipient-count"},H={class:"nf-radio"},J={key:0,class:"nf-radio-dot"},Y={class:"nf-option-text"},Z={class:"nf-option-title"},ee={class:"nf-option-desc"},te={key:0,class:"nf-recipient-count"},se={key:0,class:"nf-card"},ie={class:"nf-card-title"},ne={class:"nf-card-desc"},le={class:"nf-recipient-options"},ae={class:"nf-radio"},oe={key:0,class:"nf-radio-dot"},re={class:"nf-option-text"},de={class:"nf-option-title"},ce={class:"nf-option-desc"},ue={class:"nf-radio"},me={key:0,class:"nf-radio-dot"},he={class:"nf-option-text"},pe={class:"nf-option-title"},ve={class:"nf-option-desc"},be={key:1,class:"nf-card nf-card-inline"},fe={class:"nf-toggle-text"},Le={class:"nf-toggle-title"},ye={class:"nf-toggle-desc"},ke={key:2,class:"nf-form-actions"},ge=["disabled"],Ce=["disabled"];function $e(e,t,s,$e,Ee,we){const Te=(0,i.g2)("b-loading"),Ne=(0,i.g2)("b-input"),_e=(0,i.g2)("b-field"),Se=(0,i.g2)("b-select"),Ue=(0,i.g2)("MyGroupsSelect"),Fe=(0,i.g2)("UserListSelect"),Ve=(0,i.g2)("b-autocomplete"),Xe=(0,i.g2)("b-switch");return(0,i.uX)(),(0,i.CE)("section",a,[(0,i.bF)(Te,{modelValue:Ee.isLoading,"onUpdate:modelValue":t[0]||(t[0]=e=>Ee.isLoading=e),"is-full-page":!1},null,8,["modelValue"]),(0,i.Lk)("div",null,[(0,i.Lk)("form",{onSubmit:t[25]||(t[25]=(0,n.D$)((...e)=>we.save&&we.save(...e),["prevent"]))},[(0,i.Lk)("div",o,[(0,i.Lk)("div",r,(0,l.v_)(e.$t("Campaign details")),1),(0,i.Lk)("div",d,(0,l.v_)(e.$t("Basic information for your email campaign")),1),(0,i.Lk)("div",c,[(0,i.bF)(_e,{label:e.$t("Campaign title")},{default:(0,i.k6)(()=>[(0,i.bF)(Ne,{modelValue:s.item.name,"onUpdate:modelValue":t[1]||(t[1]=e=>s.item.name=e),placeholder:e.$t("e.g. Newsletter March 2026"),required:""},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),(0,i.bF)(_e,{label:e.$t("Email subject")},{default:(0,i.k6)(()=>[(0,i.bF)(Ne,{modelValue:s.item.subject,"onUpdate:modelValue":t[2]||(t[2]=e=>s.item.subject=e),placeholder:e.$t("e.g. News from March"),required:""},null,8,["modelValue","placeholder"])]),_:1},8,["label"])]),(0,i.Lk)("div",u,[(0,i.bF)(_e,{label:e.$t("Sender name")},{default:(0,i.k6)(()=>[(0,i.bF)(Ne,{modelValue:s.item.senderName,"onUpdate:modelValue":t[3]||(t[3]=e=>s.item.senderName=e),placeholder:e.tenant.shortName||e.tenant.name},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),(0,i.bF)(_e,{label:e.$t("Reply-to email")},{default:(0,i.k6)(()=>[(0,i.bF)(Ne,{modelValue:s.item.replyTo,"onUpdate:modelValue":t[4]||(t[4]=e=>s.item.replyTo=e),type:"email",placeholder:e.tenant.contactEmail},null,8,["modelValue","placeholder"])]),_:1},8,["label"])])]),(0,i.Lk)("div",m,[(0,i.Lk)("div",h,(0,l.v_)(e.$t("Recipients")),1),(0,i.Lk)("div",p,(0,l.v_)(e.$t("Who do you want to send this campaign to?")),1),we.isFollowUpNewsletter?((0,i.uX)(),(0,i.CE)("div",v,[(0,i.Lk)("div",b,[t[26]||(t[26]=(0,i.Lk)("div",{class:"nf-radio"},[(0,i.Lk)("div",{class:"nf-radio-dot"})],-1)),(0,i.Lk)("div",f,[(0,i.Lk)("div",L,(0,l.v_)(e.$t("Non-openers of"))+' "'+(0,l.v_)(we.parentNewsletterName)+'"',1),(0,i.Lk)("div",y,(0,l.v_)(e.$t("Recipients are recalculated at send time so anyone who opens before then is excluded.")),1)]),(0,i.Lk)("span",k,(0,l.v_)(s.item.recipients||0),1)])])):((0,i.uX)(),(0,i.CE)("div",g,[e.$route.query.eventUuid||we.isLocalCommsOnly?(0,i.Q3)("",!0):((0,i.uX)(),(0,i.CE)("div",{key:0,class:(0,l.C4)(["nf-recipient-option",{"is-selected":"everybody"===Ee.sendTo}]),onClick:t[7]||(t[7]=e=>Ee.sendTo="everybody")},[(0,i.Lk)("div",C,["everybody"===Ee.sendTo?((0,i.uX)(),(0,i.CE)("div",$)):(0,i.Q3)("",!0)]),(0,i.Lk)("div",E,[(0,i.Lk)("div",w,(0,l.v_)(e.$t("All members and contacts")),1),(0,i.Lk)("div",T,(0,l.v_)(e.$t("Send to all subscribed database")),1)]),"everybody"===Ee.sendTo&&null!==Ee.subscribedRecipients?((0,i.uX)(),(0,i.CE)("span",N,(0,l.v_)(Ee.subscribedRecipients),1)):(0,i.Q3)("",!0),"everybody"===Ee.sendTo&&e.tenant.settingFeatures.localCenter?.isActive&&Ee.localCenters.length>0?((0,i.uX)(),(0,i.CE)("div",{key:1,class:"nf-inline-selector",onClick:t[6]||(t[6]=(0,n.D$)(()=>{},["stop"]))},[(0,i.bF)(Se,{modelValue:Ee.selectedLocalCenterId,"onUpdate:modelValue":[t[5]||(t[5]=e=>Ee.selectedLocalCenterId=e),we.onLocalCenterChange],expanded:""},{default:(0,i.k6)(()=>[(0,i.Lk)("option",_,(0,l.v_)(e.$t("All local centers")),1),((0,i.uX)(!0),(0,i.CE)(i.FK,null,(0,i.pI)(Ee.localCenters,e=>((0,i.uX)(),(0,i.CE)("option",{key:e.id,value:e.id},(0,l.v_)(e.name),9,S))),128))]),_:1},8,["modelValue","onUpdate:modelValue"])])):(0,i.Q3)("",!0)],2)),e.$route.query.eventUuid?(0,i.Q3)("",!0):((0,i.uX)(),(0,i.CE)("div",{key:1,class:(0,l.C4)(["nf-recipient-option",{"is-selected":"members"===Ee.sendTo}]),onClick:t[11]||(t[11]=e=>Ee.sendTo="members")},[(0,i.Lk)("div",U,["members"===Ee.sendTo?((0,i.uX)(),(0,i.CE)("div",F)):(0,i.Q3)("",!0)]),(0,i.Lk)("div",V,[(0,i.Lk)("div",X,(0,l.v_)(e.$t("Members from a group")),1),(0,i.Lk)("div",Q,(0,l.v_)(e.$t("Select a specific member group")),1)]),"members"===Ee.sendTo&&null!==Ee.subscribedRecipients?((0,i.uX)(),(0,i.CE)("span",I,(0,l.v_)(Ee.subscribedRecipients),1)):(0,i.Q3)("",!0),"members"===Ee.sendTo?((0,i.uX)(),(0,i.CE)("div",{key:1,class:"nf-inline-selector",onClick:t[10
1]||(t[10]=(0,n.D$)(()=>{},["stop"]))},[(0,i.bF)(Ue,{modelValue:s.item.unit,"onUpdate:modelValue":[t[8]||(t[8]=e=>s.item.unit=e),t[9]||(t[9]=e=>s.item.unit=e)],item:s.item,required:"",namespace:"newsletter","strict-groups":!0,onChange:we.getSubscribedRecipients},null,8,["modelValue","item","onChange"])])):(0,i.Q3)("",!0)],2)),e.$route.query.eventUuid||we.isLocalCommsOnly?(0,i.Q3)("",!0):((0,i.uX)(),(0,i.CE)("div",{key:2,class:(0,l.C4)(["nf-recipient-option",{"is-selected":"contacts"===Ee.sendTo}]),onClick:t[14]||(t[14]=e=>Ee.sendTo="contacts")},[(0,i.Lk)("div",A,["contacts"===Ee.sendTo?((0,i.uX)(),(0,i.CE)("div",R)):(0,i.Q3)("",!0)]),(0,i.Lk)("div",x,[(0,i.Lk)("div",B,(0,l.v_)(e.$t("All subscribed contacts")),1),(0,i.Lk)("div",P,(0,l.v_)(e.$t("Only contacts with subscription")),1)]),"contacts"===Ee.sendTo&&null!==Ee.subscribedRecipients?((0,i.uX)(),(0,i.CE)("span",D,(0,l.v_)(Ee.subscribedRecipients),1)):(0,i.Q3)("",!0),"contacts"===Ee.sendTo&&e.contactChaptersEnabled&&Ee.localCenters.length>0?((0,i.uX)(),(0,i.CE)("div",{key:1,class:"nf-inline-selector",onClick:t[13]||(t[13]=(0,n.D$)(()=>{},["stop"]))},[(0,i.bF)(Se,{modelValue:Ee.selectedLocalCenterId,"onUpdate:modelValue":[t[12]||(t[12]=e=>Ee.selectedLocalCenterId=e),we.onLocalCenterChange],expanded:""},{default:(0,i.k6)(()=>[(0,i.Lk)("option",O,(0,l.v_)(e.$t("All local centers")),1),((0,i.uX)(!0),(0,i.CE)(i.FK,null,(0,i.pI)(Ee.localCenters,e=>((0,i.uX)(),(0,i.CE)("option",{key:e.id,value:e.id},(0,l.v_)(e.name),9,j))),128))]),_:1},8,["modelValue","onUpdate:modelValue"])])):(0,i.Q3)("",!0)],2)),e.$route.query.eventUuid||we.isLocalCommsOnly?(0,i.Q3)("",!0):((0,i.uX)(),(0,i.CE)("div",{key:3,class:(0,l.C4)(["nf-recipient-option",{"is-selected":"list"===Ee.sendTo}]),onClick:t[17]||(t[17]=e=>Ee.sendTo="list")},[(0,i.Lk)("div",q,["list"===Ee.sendTo?((0,i.uX)(),(0,i.CE)("div",M)):(0,i.Q3)("",!0)]),(0,i.Lk)("div",G,[(0,i.Lk)("div",W,(0,l.v_)(e.$t("From a list")),1),(0,i.Lk)("div",K,(0,l.v_)(e.$t("Use a predefined segmentation list")),1)]),"list"===Ee.sendTo&&null!==Ee.subscribedRecipients?((0,i.uX)(),(0,i.CE)("span",z,(0,l.v_)(Ee.subscribedRecipients),1)):(0,i.Q3)("",!0),"list"===Ee.sendTo?((0,i.uX)(),(0,i.CE)("div",{key:1,class:"nf-inline-selector",onClick:t[16]||(t[16]=(0,n.D$)(()=>{},["stop"]))},[(0,i.bF)(Fe,{modelValue:s.item.userList,"onUpdate:modelValue":[t[15]||(t[15]=e=>s.item.userList=e),we.userListSelected],required:""},null,8,["modelValue","onUpdate:modelValue"])])):(0,i.Q3)("",!0)],2)),we.isLocalCommsOnly?(0,i.Q3)("",!0):((0,i.uX)(),(0,i.CE)("div",{key:4,class:(0,l.C4)(["nf-recipient-option",{"is-selected":"event"===Ee.sendTo}]),onClick:t[20]||(t[20]=e=>Ee.sendTo="event")},[(0,i.Lk)("div",H,["event"===Ee.sendTo?((0,i.uX)(),(0,i.CE)("div",J)):(0,i.Q3)("",!0)]),(0,i.Lk)("div",Y,[(0,i.Lk)("div",Z,(0,l.v_)(e.$t("Event attendees")),1),(0,i.Lk)("div",ee,(0,l.v_)(e.$t("Send to participants of a specific event")),1)]),"event"===Ee.sendTo&&null!==Ee.subscribedRecipients?((0,i.uX)(),(0,i.CE)("span",te,(0,l.v_)(Ee.subscribedRecipients),1)):(0,i.Q3)("",!0),"event"===Ee.sendTo?((0,i.uX)(),(0,i.CE)("div",{key:1,class:"nf-inline-selector",onClick:t[19]||(t[19]=(0,n.D$)(()=>{},["stop"]))},[(0,i.bF)(Ve,{ref:"eventAutocomplete",modelValue:Ee.eventName,"onUpdate:modelValue":t[18]||(t[18]=e=>Ee.eventName=e),placeholder:e.$t("Type event name")+"...",data:Ee.filteredEvents,clearable:"",expanded:"","open-on-focus":!0,"dropdown-position":"bottom",field:"name",autocomplete:"on",onKeyup:we.filterEvents,onSelect:we.selectEvent},null,8,["modelValue","placeholder","data","onKeyup","onSelect"])])):(0,i.Q3)("",!0)],2))]))]),we.isFollowUpNewsletter?(0,i.Q3)("",!0):((0,i.uX)(),(0,i.CE)("div",se,[(0,i.Lk)("div",ie,(0,l.v_)(e.$t("Email type")),1),(0,i.Lk)("div",ne,(0,l.v_)(e.$t("Decides whether people who unsubscribed from the newsletter receive it")),1),(0,i.Lk)("div",le,[(0,i.Lk)("div",{class:(0,l.C4)(["nf-recipient-option",{"is-selected":!s.item.isInformational}]),onClick:t[21]||(t[21]=e=>s.item.isInformational=!1)},[(0,i.Lk)("div",ae,[s.item.isInformational?(0,i.Q3)("",!0):((0,i.uX)(),(0,i.CE)("div",oe))]),(0,i.Lk)("div",re,[(0,i.Lk)("div",de,(0,l.v_)(e.$t("Marketing")),1),(0,i.Lk)("div",ce,(0,l.v_)(e.$t("Sent only to people subscribed to the newsletter")),1)])],2),(0,i.Lk)("div",{class:(0,l.C4)(["nf-recipient-option",{"is-selected":s.item.isInformational}]),onClick:t[22]||(t[22]=e=>s.item.isInformational=!0)},[(0,i.Lk)("div",ue,[s.item.isInformational?((0,i.uX)(),(0,i.CE)("div",me)):(0,i.Q3)("",!0)]),(0,i.Lk)("div",he,[(0,i.Lk)("div",pe,(0,l.v_)(e.$t("Informational")),1),(0,i.Lk)("div",ve,(0,l.v_)(e.$t("Sent to everyone selected, regardless of newsletter subscription. Use only for essential notices, not promotions.")),1)])],2)])])),(0,i.RG)(e.$slots,"after-recipients",{},void 0,!0),"EventMessageCreate"===e.$route.name||e.$route.query.eventUuid?(0,i.Q3)("",!0):((0,i.uX)(),(0,i.CE)("div",be,[(0,i.Lk)("div",fe,[(0,i.Lk)("div",Le,(0,l.v_)(e.$t("Generate public link for this newsletter")),1),(0,i.Lk)("div",ye,(0,l.v_)(e.$t("Allows viewing the newsletter in a browser")),1)]),(0,i.bF)(Xe,{modelValue:s.item.isPublic,"onUpdate:modelValue":t[23]||(t[23]=e=>s.item.isPublic=e),name:"isPublic"},null,8,["modelValue"])])),s.embedded?(0,i.Q3)("",!0):((0,i.uX)(),(0,i.CE)("div",ke,[(0,i.Lk)("button",{class:(0,l.C4)(["button is-primary is-rounded",{"is-loading":Ee.isLoading}]),disabled:Ee.isLoading,type:"submit"},(0,l.v_)(e.$t("Save")),11,ge),"create"===s.operation?((0,i.uX)(),(0,i.CE)("button",{key:0,class:"button is-light is-rounded",disabled:Ee.isLoading,type:"button",onClick:t[24]||(t[24]=t=>e.$router.push({name:"NewsletterList"}))},(0,l.v_)(e.$t("cancel")),9,Ce)):(0,i.Q3)("",!0)]))],32)])])}s(14603),s(47566),s(98721);var Ee=s(40834),we=s(65284);const Te=["value"],Ne={class:"mt-2 is-size-7"};function _e(e,t,s,n,a,o){const r=(0,i.g2)("b-select"),d=(0,i.g2)("router-link");return(0,i.uX)(),(0,i.CE)("div",null,[(0,i.bF)(r,{modelValue:a.selected,"onUpdate:modelValue":t[0]||(t[0]=e=>a.selected=e),placeholder:e.$t("Select a list"),loading:a.isLoading,required:""},{default:(0,i.k6)(()=>[t[1]||(t[1]=(0,i.Lk)("option",{value:null},"...",-1)),((0,i.uX)(!0),(0,i.CE)(i.FK,null,(0,i.pI)(a.userLists,e=>((0,i.uX)(),(0,i.CE)("option",{key:e.id,value:e["@id"]},(0,l.v_)(e.name),9,Te))),128))]),_:1},8,["modelValue","placeholder","loading"]),(0,i.Lk)("p",Ne,[(0,i.bF)(d,{to:{name:"UserListIndex"}},{default:(0,i.k6)(()=>[(0,i.eW)((0,l.v_)(e.$t("Manage profile lists"))+" â",1)]),_:1})])])}s(18111),s(20116),s(7588);var Se={name:"UserListSelect",props:{modelValue:{type:[String,Object],default:null},label:{type:String,default:""},message:{type:String,default:""}},emits:["update:modelValue"],data(){return{userLists:[],selected:null,isLoading:!1}},computed:{...(0,Ee.L8)(["tenant"])},watch:{modelValue:{immediate:!0,handler(e){e?"string"===typeof e?this.selected=e:"object"===typeof e&&e["@id"]&&(this.selected=e["@i
1d"]):this.selected=null}},selected(e){this.$emit("update:modelValue",e)}},mounted(){this.fetchUserLists()},methods:{fetchUserLists(){this.isLoading=!0,this.$http.plain.get("/user_lists").then(e=>{if(e.data&&e.data["hydra:member"]){const t=e.data["hydra:member"];if(this.userLists=t,this.isLoading=!1,this.modelValue&&!this.selected){const e="string"===typeof this.modelValue?this.modelValue:this.modelValue["@id"]||this.modelValue.id;if(e){const t=this.userLists.find(t=>t["@id"]===e||String(t.id)===String(e.split("/").pop()));t&&(this.selected=t["@id"])}}t.forEach(e=>{const t=e.id||e["@id"].split("/").pop();this.$http.plain.get(`/newsletter/recipients/user_list/${t}`).then(t=>{e.recipientCount=t.data}).catch(t=>{console.error("Error fetching recipient count for list:",t),e.recipientCount=null})})}}).catch(e=>{console.error("Error fetching user lists:",e),this.isLoading=!1,this.$buefy.toast.open({message:this.$t("Failed to load lists"),type:"is-danger",duration:5e3})})}}},Ue=s(66262);const Fe=(0,Ue.A)(Se,[["render",_e]]);var Ve=Fe,Xe=s(78048),Qe={components:{BSwitch:Xe.Lf,MyGroupsSelect:we.A,UserListSelect:Ve},props:["item","operation","embedded"],data(){return{isLoading:!1,sendTo:"members",events:null,filteredEvents:[],subscribedRecipients:null,eventName:"",eventUuid:this.$route.query.eventUuid??null,currentEvent:null,localCenters:[],selectedLocalCenterId:null}},watch:{sendTo(e){"event"!==e&&this.resetEventSelection(),"list"!==e&&(this.item.userList=null),"everybody"!==e&&"contacts"!==e&&(this.selectedLocalCenterId=null,this.item.localCenter=null),"event"===e&&this.$nextTick(()=>{this.$refs.eventAutocomplete?.$el?.querySelector("input")?.focus()}),this.getSubscribedRecipients()}
1,"item.isInformational"(){this.isFollowUpNewsletter||this.getSubscribedRecipients()}},mounted(){this.initializeForm(),this.loadLocalCenters()},methods:{initializeForm(){if(!this.item?.parentNewsletter){if("create"===this.operation&&(this.item.senderName||(this.item.senderName=this.tenant.shortName||this.tenant.name||null),this.item.replyTo||(this.item.replyTo=this.tenant.contactEmail||null)),this.eventUuid)return this.sendTo="event",this.item.isPublic=!1,void this.fetchEventByUuid();this.item.localCenter&&(this.selectedLocalCenterId="object"===typeof this.item.localCenter?this.item.localCenter.id:parseInt(this.item.localCenter.split("/").pop())),this.item.isContacts?this.sendTo="contacts":this.item.event?(this.sendTo="event","object"===typeof this.item.event?(this.eventName=this.item.event.name??"",this.currentEvent=this.item.event,this.eventUuid=this.item.event.uuid??null):(this.eventUuid=this.item.event.split("/").pop(),this.currentEvent=this.item.event,this.fetchEventByUuid())):this.item.sendToEverybody?this.sendTo="everybody":this.item.userList?(this.sendTo="list",this.getSubscribedRecipients()):this.sendTo="members",this.isLocalCommsOnly&&(this.sendTo="members"),this.getSubscribedRecipients()}},loadLocalCenters(){this.tenant.settingFeatures.localCenter?.isActive&&this.$http.plain.get("/local_centers_all?isActive=1&tenantSlug="+this.tenant.slug).then(e=>{this.localCenters=e.data["hydra:member"]||[]}).catch(e=>{console.error(e)})},onLocalCenterChange(){this.selectedLocalCenterId?this.item.localCenter=`/api/v1/local_centers/${this.selectedLocalCenterId}`:this.item.localCenter=null,this.getSubscribedRecipients()},resetEventSelection(){this.eventName="",this.eventUuid=null,this.currentEvent=null,this.item.event=null},getSubscribedRecipients(){this.subscribedRecipients=null;let e=this.sendTo,t=null;switch(this.sendTo){case"unit":t=this.item.unit?.split("/").pop();break;case"event":if(!this.currentEvent)return;t=this.currentEvent.uuid||this.currentEvent.split("/").pop();break;case"members":t=this.item.unit?.split("/").pop()||0,e=this.item.unit?"unit":"general";break;case"list":if(!this.item.userList)return;"string"===typeof this.item.userList?t=this.item.userList.split("/").pop():this.item.userList.id&&(t=this.item.userList.id),e="user_list";break;case"everybody":e="all";break}const s=new URLSearchParams;this.selectedLocalCenterId&&("everybody"===this.sendTo||"contacts"===this.sendTo&&this.contactChaptersEnabled)&&s.set("localCenter",this.selectedLocalCenterId),this.item.isInformational&&s.set("informational","1");const i=s.toString(),n=`/newsletter/recipients/${e}/${t||0}`+(i?`?${i}`:"");this.$http.plain.get(n).then(e=>{this.subscribedRecipients=e.data}).catch(e=>{console.error(e),this.$buefy.toast.open({message:this.$t("Failed to get recipient count"),type:"is-danger",duration:6e3})})},filterEvents(){this.eventName.length<3||this.$http.plain.get(`/events/searchable?name=${encodeURIComponent(this.eventName)}`).then(e=>{this.filteredEvents=e.data["hydra:member"]||[]}).catch(e=>{console.error(e),this.filteredEvents=[]})},selectEvent(e){e&&(this.currentEvent=e,this.eventUuid=e.uuid,this.item.event=e["@id"],this.getSubscribedRecipients())},fetchEventByUuid(){this.isLoading=!0,this.$http.plain.get(`/events/${this.eventUuid}`).then(e=>{e.data?(this.currentEvent=e.data,this.eventName=e.data.name,this.item.event=e.data["@id"],this.item.name||(this.item.name=e.data.name+" | "+this.$t("Event")+" Newsletter"),this.item.subject||(this.item.subject=e.data.name)):this.handleEventNotFound()}).catch(e=>{console.error(e),this.handleEventNotFound()}).finally(()=>{this.isLoading=!1})},handleEventNotFound(){this.$buefy.toast.open({message:this.$t("Event not found"),type:"is-danger",duration:6e3}),this.resetEventSelection()},save(){if(!this.item.subject)return this.$buefy.toast.open({message:this.$t("Subject cannot be empty"),type:"is-danger",duration:6e3});if("list"===this.sendTo&&!this.item.userList)return this.$buefy.toast.open({message:this.$t("Please select a list before saving"),type:"is-danger",duration:6e3});let e;this.isLoading=!0;try{e=this.prepareEntityForSave()}
1catch(t){return this.isLoading=!1,void this.$buefy.toast.open({message:this.$t("Failed to save newsletter")+(t.message?": "+t.message:""),type:"is-danger",duration:6e3})}"update"===this.operation?this.updateNewsletter(e).catch(e=>{console.error(e),this.$buefy.toast.open({message:this.$t("Failed to save newsletter")+(e.message?": "+e.message:""),type:"is-danger",duration:6e3})}).finally(()=>{this.isLoading=!1}):this.createNewsletter(e).catch(e=>{console.error(e),this.$buefy.toast.open({message:this.$t("Failed to save newsletter")+(e.message?": "+e.message:""),type:"is-danger",duration:6e3})}).finally(()=>{this.isLoading=!1})},prepareEntityForSave(){const e={...this.item};if("contacts"===this.sendTo)e.isContacts=!0,e.unit=null,e.isGeneral=!1,e.event=null,e.userList=null,e.sendToEverybody=!1,e.localCenter=this.selectedLocalCenterId&&this.contactChaptersEnabled?`/api/v1/local_centers/${this.selectedLocalCenterId}`:null;else if("event"===this.sendTo){if(e.isGeneral=!1,e.isContacts=!1,e.unit=null,e.userList=null,e.sendToEverybody=!1,e.localCenter=null,!this.currentEvent)throw new Error("Event is required");"object"===typeof this.currentEvent?e.event=this.currentEvent["@id"]:e.event=this.currentEvent}else if("list"===this.sendTo){if(e.isGeneral=!1,e.isContacts=!1,e.unit=null,e.event=null,e.sendToEverybody=!1,e.localCenter=null,e.userList&&"object"===typeof e.userList&&(e.userList=e.userList["@id"]||null),!e.userList)throw this.$buefy.toast.open({message:this.$t("Please select a list before saving"),type:"is-danger",duration:6e3}),new Error("List is required")}else"everybody"===this.sendTo?(e.isGeneral=!1,e.isContacts=!1,e.unit=null,e.event=null,e.userList=null,e.sendToEverybody=!0,e.localCenter=this.selectedLocalCenterId?`/api/v1/local_centers/${this.selectedLocalCenterId}`:null):this.item.unit?this.item.unit&&this.item.isGeneral&&(e.isGeneral=!1,e.event=null,e.userList=null,e.sendToEverybody=!1,e.localCenter=null):(e.isGeneral=!0,e.event=null,e.userList=null,e.sendToEverybody=!1,e.localCenter=null,delete e.unit);return e.senderName||(e.senderName=this.tenant.shortName||this.tenant.name||null),e},updateNewsletter(e){return e.owner&&"object"===typeof e.owner&&(e.owner=e.owner["@id"]),e.unit&&"object"===typeof e.unit&&(e.unit=e.unit["@id"]),this.$http.plain.patch(`/newsletters/${e.uuid}`,e).then(()=>{this.$buefy.toast.open({message:this.$t("saved"),type:"is-success",duration:1e4}),this.$router.push({name:"NewsletterShow",params:{item:e.uuid}})})},createNewsletter(e){return delete e.id,delete e.uuid,e.userList?.["@id"]&&(e.userList=e.userList["@id"]),e.unit&&"object"===typeof e.unit&&(e.unit=e.unit["@id"]),this.$http.plain.post("/newsletters",e).then(e=>{this.$buefy.toast.open({message:this.$t("saved"),type:"is-success",duration:1e4}),e&&this.$router.push({name:"NewsletterBuilder",params:{item:e.data.uuid}})})},userListSelected(e){e?("string"===typeof e?this.item.userList=e:"object"===typeof e&&e["@id"]&&(this.item.userList=e["@id"]),this.getSubscribedRecipients()):this.item.userList=null}},computed:{...(0,Ee.L8)(["user","tenant","isGranted","contactChaptersEnabled"]),isLocalCommsOnly(){return this.isGranted("COMMUNICATION_LOCAL")&&!this.isGranted("COMMUNICATION_TENANT")&&!this.isGranted("EVENT_TENANT")&&!this.isGranted("EVENT_LOCAL")},isFollowUpNewsletter(){return!!this.item?.parentNewsletter},parentNewsletterName(){const e=this.item?.parentNewsletter;return e&&"object"===typeof e&&e.name||""}}};const Ie=(0,Ue.A)(Qe,[["render",$e],["__scopeId","data-v-e9ff34b2"]]);var Ae=Ie},62320:function(e,t,s){s.r(t),s.d(t,{default:function(){return f}});var i=s(20641),n=s(90033);const l={class:"o-minwidth"},a={key:0,class:"columns"},o={class:"column"},r={key:0},d={key:0,class:"buttons pt-3 is-right"};function c(e,t,s,c,u,m){const h=(0,i.g2)("b-loading"),p=(0,i.g2)("NewsletterSubmenu"),v=(0,i.g2)("Form");return(0,i.uX)(),(0,i.CE)("section",l,[(0,i.bF)(h,{modelValue:u.isLoading,"onUpdate:modelValue":t[0]||(t[0]=e=>u.isLoading=e),"is-full-page":!1},null,8,["modelValue"]),u.item?((0,i.uX)(),(0,i.CE)("div",a,[(0,i.bF)(p,{item:u.item},null,8,["item"]),(0,i.Lk)("div",o,[u.item?((0,i.uX)(),(0,i.CE)("div",r,[(0,i.bF)(v,{item:u.item,operation:"update"},null,8,["item"]),"Draft"===u.item.status?((0,i.uX)(),(0,i.CE)("div",d,[(0,i.Lk)("button",{class:"button is-danger is-outlined is-rounded",onClick:t[1]||(t[1]=e=>m.confirmDelete("deleting"))},(0,n.v_)(e.$t("delete")),1)])):(0,i.Q3)("",!0)])):(0,i.Q3)("",!0)])])):(0,i.Q3)("",!0)])}s(44114);var u=s(2269),m=s(40834),h=s(82235),p={data(){return{itemUuid:this.$route.params.item,item:null,isLoading:!1}},created(){this.isGranted("COMMUNICATION_TENANT")||this.isGranted("COMMUNICATION_LOCAL")||this.$router.push({name:"Dashboard"}),this.retrieve()},methods:{retrieve(){this.isLoading=!0,this.$http.plain.get("/newsletters/"+this.itemUuid).then(e=>{this.item=e.data}).catch(e=>console.error(e)).finally(()=>{this.isLoading=!1})},confirmDelete(e){this.$buefy.dialog.confirm({title:this.$t(e),confirmText:this.$t("deleting"===e?"delete":"archive"),type:"is-danger",message:this.$t("Are you sure to delete this voting? This cannot be undone."),onConfirm:()=>this.delete(e)})},delete(){this.isLoading=!0,this.$http.plain.delete("/newsletters/"+this.item.uuid).then(e=>this.deleteSuccess(e)).catch(e=>console.error(e)).finally(()=>{this.isLoading=!1})},deleteSuccess(){this.item.localCenter,this.$router.push({name:"NewsletterList"}
1),this.$buefy.toast.open(this.$t("saved"))},error(e){console.error(e)}},computed:{...(0,m.L8)(["user","isGranted","tenant"])},components:{Form:u.A,NewsletterSubmenu:h.A}},v=s(66262);const b=(0,v.A)(p,[["render",c]]);var f=b},82235:function(e,t,s){s.d(t,{A:function(){return O}});var i=s(20641),n=s(90033);const l={class:"column is-narrow"},a={key:0,class:"mb-3"},o={class:"icon-text"},r={class:"icon is-small ml-2"},d={key:1,class:"mb-3"},c={class:"icon-text"},u={class:"icon is-small ml-2"},m={key:2,class:"mb-5-half"},h={class:"icon-text"},p={class:"icon is-small ml-2"},v={key:3,class:"mb-3"},b=["disabled"],f={class:"icon-text"},L={class:"icon is-small ml-2"},y={key:4,class:"mb-3"},k=["disabled"],g={class:"icon-text"},C={class:"icon is-small ml-2"},$={key:5,class:"mb-3"},E=["disabled"],w={class:"icon-text"},T={class:"icon is-small ml-2"},N={key:6,class:"mb-3"},_=["disabled"],S={class:"icon-text"},U={class:"icon is-small ml-2"},F={key:7,class:"mb-3"},V=["disabled"],X={class:"icon-text"},Q={class:"icon is-small ml-2"},I={key:8,class:"mt-6 p-4"},A={class:"is-size-7 mb-5 has-text-dark"};function R(e,t,s,R,x,B){const P=(0,i.g2)("font-awesome-icon"),D=(0,i.g2)("router-link");return(0,i.uX)(),(0,i.CE)("div",l,[s.item?((0,i.uX)(),(0,i.CE)("p",a,[(0,i.bF)(D,{to:{name:"NewsletterShow",params:{item:s.item.uuid},query:B.eventQuery},class:(0,n.C4)(["button is-small is-rounded is-light level is-fullwidth",{"is-primary":B.isActive("NewsletterShow")}])},{default:(0,i.k6)(()=>[(0,i.Lk)("span",o,[(0,i.Lk)("span",r,[(0,i.bF)(P,{icon:"fa-light fa-info-circle"})]),(0,i.Lk)("span",null,(0,n.v_)(B.isEventMessage?e.$t("Message"):e.$t("Campaign")),1)])]),_:1},8,["to","class"])])):(0,i.Q3)("",!0),s.item&&"Draft"===s.item.status?((0,i.uX)(),(0,i.CE)("p",d,[(0,i.bF)(D,{to:{name:"NewsletterBuilder",params:{item:s.item.uuid},query:B.eventQuery},class:(0,n.C4)(["button is-rounded is-light is-small level is-fullwidth",{"is-primary":B.isActive("NewsletterBuilder")}])},{default:(0,i.k6)(()=>[(0,i.Lk)("span",c,[(0,i.Lk)("span",u,["Draft"===s.item.status?((0,i.uX)(),(0,i.Wv)(P,{key:0,icon:"fa-light fa-pencil-alt"})):((0,i.uX)(),(0,i.Wv)(P,{key:1,icon:"fa-light fa-eye"}))]),(0,i.Lk)("span",null,(0,n.v_)(e.$t("Content")),1)])]),_:1},8,["to","class"])])):(0,i.Q3)("",!0),s.item&&"Draft"===s.item.status?((0,i.uX)(),(0,i.CE)("p",m,[(0,i.bF)(D,{to:{name:"NewsletterUpdate",params:{item:s.item.uuid},query:B.eventQuery},class:(0,n.C4)(["button is-rounded is-light is-small is-fullwidth level",{"is-primary":B.isActive("NewsletterUpdate")}])},{default:(0,i.k6)(()=>[(0,i.Lk)("span",h,[(0,i.Lk)("span",p,[(0,i.bF)(P,{icon:"fa-light fa-cog"})]),(0,i.Lk)("span",null,(0,n.v_)(e.$t("Settings")),1)])]),_:1},8,["to","class"])])):(0,i.Q3)("",!0),B.showSaveButton?((0,i.uX)(),(0,i.CE)("p",v,[(0,i.Lk)("button",{class:(0,n.C4)(["button is-primary is-small is-rounded is-fullwidth level",{"is-loading":s.isLoadingSave}]),disabled:s.isLoadingSave,onClick:t[0]||(t[0]=t=>e.$emit("save"))},[(0,i.Lk)("span",f,[(0,i.Lk)("span",L,[(0,i.bF)(P,{icon:"fa-light fa-save"})]),(0,i.Lk)("span",null,(0,n.v_)(e.$t("save")),1)])],10,b)])):(0,i.Q3)("",!0),B.showSendButton?((0,i.uX)(),(0,i.CE)("p",y,[(0,i.Lk)("button",{class:(0,n.C4)(["button is-light is-small is-rounded is-fullwidth level",{"is-loading":s.isLoadingSave}]),disabled:s.isLoadingSave,onClick:t[1]||(t[1]=t=>e.$emit("save-send"))},[(0,i.Lk)("span",g,[(0,i.Lk)("span",C,[(0,i.bF)(P,{icon:"fa-light fa-paper-plane-top"})]),(0,i.Lk)("span",null,(0,n.v_)(e.$t("send")),1)])],10,k)])):(0,i.Q3)("",!0),B.showScheduleButton?((0,i.uX)(),(0,i.CE)("p",$,[(0,i.Lk)("button",{class:(0,n.C4)(["button is-light is-small is-rounded is-fullwidth level",{"is-loading":s.isLoadingSave}]),disabled:s.isLoadingSave,onClick:t[2]||(t[2]=t=>e.$emit("schedule"))},[(0,i.Lk)("span",w,[(0,i.Lk)("span",T,[(0,i.bF)(P,{icon:"fa-light fa-clock"})]),(0,i.Lk)("span",null,(0,n.v_)(e.$t("Schedule")),1)])],10,E)])):(0,i.Q3)("",!0),B.showPreviewButton?((0,i.uX)(),(0,i.CE)("p",N,[(0,i.Lk)("button",{class:(0,n.C4)(["button is-light is-rounded is-small is-fullwidth level",{"is-loading":s.isLoadingPreview}]),disabled:s.isLoadingPreview,onClick:t[3]||(t[3]=t=>e.$emit("send-preview-email"))},[(0,i.Lk)("span",S,[(0,i.Lk)("span",U,[(0,i.bF)(P,{icon:"fa-light fa-envelope"})]),(0,i.Lk)("span",null,(0,n.v_)(e.$t("Preview on my email")),1)])],10,_)])):(0,i.Q3)("",!0),B.showPreviewTemplateButton?((0,i.uX)(),(0,i.CE)("p",F,[(0,i.Lk)("button",{class:(0,n.C4)(["button is-light is-rounded is-small is-fullwidth level",{"is-loading":s.isLoadingPreview}]),disabled:s.isLoadingPreview,onClick:t[4]||(t[4]=t=>e.$emit("send-preview-email-template"))},[(0,i.Lk)("span",X,[(0,i.Lk)("span",Q,[(0,i.bF)(P,{icon:"fa-light fa-envelope"})]),(0,i.Lk)("span",null,(0,n.v_)(e.$t("Preview on my email")),1)])],10,V)])):(0,i.Q3)("",!0),"NewsletterBuilder"===e.$route.name?((0,i.uX)(),(0,i.CE)("div",I,[(0,i.Lk)("div",A,[(0,i.Lk)("b",null,(0,n.v_)(e.$t("Placeholders:")),1),t[22]||(t[22]=(0,i.Fv)('<hr class="mb-2 mt-2"> {firstName} <br> {fullName} <br> {preferencesUrl} <br> {unsubscribeUrl} <br> {membershipLevelName} <br> {membershipLevelPrice} <br> {userProfileURL} <br> {userPhoneNumber} <br> {userAddress} <br> {userPostalCode} <br> {userTown} <br> {userCountry} <br> {userCompanyName} <br> {companyName} <br> {contactEmail} <br> {currentPeriodEnd} ',32)),B.isEventMessage?((0,i.uX)(),(0,i.CE)(i.FK,{key:0},[t[5]||(t[5]=(0,i.Lk)("hr",{class:"mb-2 mt-2"},null,-1)),(0,i.Lk)("b",null,(0,n.v_)(e.$t("Event:")),1),t[6]||(t[6]=(0,i.Lk)("br",null,null,-1)),t[7]||
1(t[7]=(0,i.eW)(" {eventTitle} ",-1)),t[8]||(t[8]=(0,i.Lk)("br",null,null,-1)),t[9]||(t[9]=(0,i.eW)(" {eventDescription} ",-1)),t[10]||(t[10]=(0,i.Lk)("br",null,null,-1)),t[11]||(t[11]=(0,i.eW)(" {eventDateBegin} ",-1)),t[12]||(t[12]=(0,i.Lk)("br",null,null,-1)),t[13]||(t[13]=(0,i.eW)(" {eventDateEnd} ",-1)),t[14]||(t[14]=(0,i.Lk)("br",null,null,-1)),t[15]||(t[15]=(0,i.eW)(" {eventTimezone} ",-1)),t[16]||(t[16]=(0,i.Lk)("br",null,null,-1)),t[17]||(t[17]=(0,i.eW)(" {eventLocation} ",-1)),t[18]||(t[18]=(0,i.Lk)("br",null,null,-1)),t[19]||(t[19]=(0,i.eW)(" {eventRegisterUrl} ",-1)),t[20]||(t[20]=(0,i.Lk)("br",null,null,-1)),t[21]||(t[21]=(0,i.eW)(" {eventAgendaUrl} ",-1))],64)):(0,i.Q3)("",!0)])])):(0,i.Q3)("",!0)])}var x=s(61273),B={name:"NewsletterSubmenu",components:{FontAwesomeIcon:x.gc},props:{item:{type:Object,default:null},itemTemplate:{type:Object,default:null},createEditTemplate:{type:Boolean,default:!1},isLoadingSave:{type:Boolean,default:!1},isLoadingPreview:{type:Boolean,default:!1}},emits:["save","save-send","schedule","send-preview-email","send-preview-email-template"],computed:{isEventMessage(){return!!this.$route.query.eventUuid||!!this.item?.event},eventQuery(){return this.$route.query.eventUuid?{eventUuid:this.$route.query.eventUuid}:{}},showSaveButton(){return this.item&&"Draft"===this.item.status&&"NewsletterBuilder"===this.$route.name||this.createEditTemplate},showSendButton(){return this.item&&("Draft"===this.item.status||"Scheduled"===this.item.status)},showScheduleButton(){return this.item&&("Draft"===this.item.status||"Scheduled"===this.item.status)},showPreviewButton(){return!this.createEditTemplate&&this.item&&"Draft"===this.item.status&&("NewsletterBuilder"===this.$route.name||"NewsletterShow"===this.$route.name)},showPreviewTemplateButton(){return this.itemTemplate}},methods:{isActive(e){return this.$route.name===e}}},P=s(66262);const D=(0,P.A)(B,[["render",R]]);var O=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.