import{R as y,k as S,l as f,o as E,j as t,E as P,a9 as a}from"./app-BgLa5dit.js";import{C as o}from"./CdBbWXza.chunk.js";function j(e){var s,l,i;const[r,d]=y.useState(!1),u=S(),c=f(),n=E(o.getSpecialEvent(e.specialEventId)),p=(l=(s=n.data)==null?void 0:s.policies)==null?void 0:l.find(h=>h.id.toString()===e.specialEventPolicyId.toString());async function v(){d(!0);try{await u(o.deleteSpecialEventPolicy(e.specialEventPolicyId,e.specialEventId)),c.success(`Successfully deleted calendar event for ${n.data.name}.`)}catch{c.error("Failed to delete calendar event")}finally{e.closePopup()}}return t.jsx(P,{title:`Delete calendar event for ${(i=n.data)==null?void 0:i.name}`,closePopup:e.closePopup,backdrop:"static",showLoadingSpinner:!n.hasCompleted,children:p&&t.jsxs("div",{children:[t.jsx("p",{children:"Are you sure you want to delete this calendar event?"}),t.jsxs(a,{children:[t.jsx(a.Cancel,{onClick:e.closePopup}),t.jsx(a.Submit,{text:"Delete calendar event",type:"button",variant:"danger",onClick:v,showSpinner:r})]})]})})}export{j as DeleteSpecialEventPolicyView};
//# sourceMappingURL=gqG369aI.chunk.js.map
