import{aZ as a,a_ as i,aP as e,aB as t,ap as s}from"../../../../vendor-element-plus.js?ver=3.1.0";import{r as n,c,o as r,b as m,L as g,d,w as p,O as l,P as o,n as _,bk as u}from"../../../../vendor.js?ver=3.1.0";import{S as h}from"../../../../TestEmail.js?ver=3.1.0";import{_ as f}from"../../../../fc-bits-ui.js?ver=3.1.0";const v={class:"fcrm_single_recurring_camp_page"},y={class:"fcrm-layout-width"},b={key:0,class:"fcrm_page_header"},$={class:"fcrm_page_header_content"},k={class:"fcrm_page_header_breadcrumb"},x={class:"fcrm_page_header_actions"},S={key:1,class:"fcrm_single_recurring_camp_body fcrm_body_boxed"},w={class:"fcrm_single_recurring_camp_body_header"},j={class:"fcrm_single_recurring_camp_body_header--left"},E={key:0,class:"fcrm_action_menu"},C={class:"fcrm_single_recurring_camp_body_header--right"},T={class:"fcrm_single_recurring_camp_body--email-body fcrm_sticky_block_composer_page"},V={key:2,class:"fluentcrm_body fluentcrm_body_boxed"};const A=f({name:"ViewSingleCampaign",components:{SendTestEmail:h},props:["campaign_id"],data:()=>({ArrowRightBold:u(s),campaign:{},loading:!0}),methods:{fetchCampaign(){this.loading=!0,this.$get("recurring-campaigns/"+this.campaign_id).then(a=>{this.campaign=a.campaign}).catch(a=>{this.handleError(a)}).finally(()=>{this.loading=!1})},changeStatus(){const a=this.campaign.status,i=()=>this.$post("recurring-campaigns/"+this.campaign.id+"/change-status",{status:a}).then(a=>{this.$notify.success(a.message)});"active"===a?this.$post("recurring-campaigns/update-campaign-data",{campaign:JSON.stringify(this.campaign),campaign_id:this.campaign.id,validate_subject:"yes"}).then(i).catch(a=>{this.handleError(a),this.campaign.status="draft"}):i().catch(a=>{this.handleError(a),this.campaign.status="active"})},campaignStatusText(a){return{active:this.$t("Active"),draft:this.$t("Draft")}[a]||a}},mounted(){this.fetchCampaign()}},[["render",function(s,u,h,f,A,B){const R=a,O=i,P=n("send-test-email"),D=n("router-link"),H=e,J=n("router-view"),L=t;return r(),c("div",v,[m("div",y,[A.campaign?(r(),c("div",b,[m("div",$,[m("div",k,[d(O,{"separator-icon":A.ArrowRightBold},{default:p(()=>[d(R,{to:{name:"recurring_campaigns"}},{default:p(()=>[l(o(s.$t("Recurring Campaigns")),1)],void 0,!0),_:1}),d(R,null,{default:p(()=>[l(o(A.campaign.title),1)],void 0,!0),_:1})],void 0),_:1},8,["separator-icon"])])]),m("div",x,[d(P,{campaign:{email_subject:A.campaign.email_subject,email_pre_header:A.campaign.post_excerpt,email_body:A.campaign.post_content||A.campaign.email_body,design_template:A.campaign.design_template,settings:A.campaign.settings}},null,8,["campaign"])])])):g("",!0),A.campaign&&A.campaign.id?(r(),c("div",S,[m("div",w,[m("div",j,[A.campaign.id?(r(),c("ul",E,[m("li",null,[d(D,{to:{name:"view_recurring_campaign",params:{campaign_id:A.campaign.id}}},{default:p(()=>[l(o(s.$t("Email Configuration")),1)],void 0),_:1},8,["to"])]),m("li",null,[d(D,{to:{name:"recurring_campaign_settings",params:{campaign_id:A.campaign.id}}},{default:p(()=>[l(o(s.$t("Settings")),1)],void 0),_:1},8,["to"])]),m("li",null,[d(D,{to:{name:"past_recurring_emails",params:{campaign_id:A.campaign.id}}},{default:p(()=>[l(o(s.$t("Email History")),1)],void 0),_:1},8,["to"])])])):g("",!0)]),m("div",C,[d(H,{onChange:u[0]||(u[0]=a=>B.changeStatus()),modelValue:A.campaign.status,"onUpdate:modelValue":u[1]||(u[1]=a=>A.campaign.status=a),"active-value":"active","inactive-value":"draft","active-text":B.campaignStatusText(A.campaign.status)},null,8,["modelValue","active-text"])])]),m("div",T,[A.campaign.id?(r(),c("div",{key:0,class:_([s.$route.name,"fcrm_single_recurring_camp_body--email-body-inner"])},[d(J,{campaign:A.campaign},null,8,["campaign"])],2)):g("",!0)])])):A.loading?(r(),c("div",V,[d(L,{animated:!0,style:{padding:"20px"},rows:7})])):g("",!0)])])}]]);export{A as default};
