import{R as y,k as P,l as m,o as E,j as e,E as x,a9 as c}from"./app-BgLa5dit.js";import{a as i}from"./4qGb1BIY.chunk.js";import{C as p}from"./CdBbWXza.chunk.js";function b(t){var l,u,d;const[h,v]=y.useState(!1),S=P(),o=m(),a=E(p.getSpecialEvent(t.specialEventId)),r=(u=(l=a.data)==null?void 0:l.policies)==null?void 0:u.find(n=>n.id.toString()===t.specialEventPolicyId.toString());async function f(){v(!0);try{const n={...r,status:t.status};await S(p.editSpecialEventPolicy(t.specialEventPolicyId,t.specialEventId,n)),o.success(`Calendar event for ${a.data.name} ${s().toLowerCase()}d successfully`)}catch{o.error("Failed to update calendar event status")}finally{t.closePopup()}}function s(){switch(t.status){case i.Archived:return"Archive";case i.Draft:return"Draft";case i.Published:return"Publish"}}return e.jsx(x,{title:`Edit calendar event ${(d=a.data)==null?void 0:d.name}`,closePopup:t.closePopup,backdrop:"static",showLoadingSpinner:!a.hasCompleted,children:r&&e.jsxs("div",{children:[e.jsxs("p",{children:["Are you sure you want to ",e.jsx("strong",{children:s().toLowerCase()})," this calendar event?"]}),e.jsxs(c,{children:[e.jsx(c.Cancel,{onClick:t.closePopup}),e.jsx(c.Submit,{text:`${s()} calendar event`,type:"button",variant:"dark",onClick:f,showSpinner:h})]})]})})}export{b as UpdatePolicyStatusView};
//# sourceMappingURL=DqvjIgdT.chunk.js.map
