import{aZ as a,a_ as i,aP as e,aB as t,ap as s}from"../../../../vendor-element-plus.js?ver=3.1.10";import{aQ as n,W as c,X as r,Z as m,ab as g,a5 as d,a9 as p,aa as l,a8 as o,a0 as _,av as u}from"../../../../vendor.js?ver=3.1.10";import{S as h}from"../../../../TestEmail.js?ver=3.1.10";import{_ as f}from"../../../../fc-bits-ui.js?ver=3.1.10";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"},x={class:"fcrm_page_header_breadcrumb"},S={class:"fcrm_page_header_actions"},k={key:1,class:"fcrm_single_recurring_camp_body fcrm_body_boxed"},j={class:"fcrm_single_recurring_camp_body_header"},w={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,Z=i,D=n("send-test-email"),H=n("router-link"),J=e,N=n("router-view"),O=t;return c(),r("div",v,[m("div",y,[A.campaign?(c(),r("div",b,[m("div",$,[m("div",x,[g(Z,{"separator-icon":A.ArrowRightBold},{default:d(()=>[g(R,{to:{name:"recurring_campaigns"}},{default:d(()=>[p(l(s.$t("Recurring Campaigns")),1)],void 0,!0),_:1}),g(R,null,{default:d(()=>[p(l(A.campaign.title),1)],void 0,!0),_:1})],void 0),_:1},8,["separator-icon"])])]),m("div",S,[g(D,{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"])])])):o("",!0),A.campaign&&A.campaign.id?(c(),r("div",k,[m("div",j,[m("div",w,[A.campaign.id?(c(),r("ul",E,[m("li",null,[g(H,{to:{name:"view_recurring_campaign",params:{campaign_id:A.campaign.id}}},{default:d(()=>[p(l(s.$t("Email Configuration")),1)],void 0),_:1},8,["to"])]),m("li",null,[g(H,{to:{name:"recurring_campaign_settings",params:{campaign_id:A.campaign.id}}},{default:d(()=>[p(l(s.$t("Settings")),1)],void 0),_:1},8,["to"])]),m("li",null,[g(H,{to:{name:"past_recurring_emails",params:{campaign_id:A.campaign.id}}},{default:d(()=>[p(l(s.$t("Email History")),1)],void 0),_:1},8,["to"])])])):o("",!0)]),m("div",C,[g(J,{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?(c(),r("div",{key:0,class:_([s.$route.name,"fcrm_single_recurring_camp_body--email-body-inner"])},[g(N,{campaign:A.campaign},null,8,["campaign"])],2)):o("",!0)])])):A.loading?(c(),r("div",V,[g(O,{animated:!0,style:{padding:"20px"},rows:7})])):o("",!0)])])}]]);export{A as default};
