import{n as u,j as e}from"./render-BEL5IN7j.js";import{g}from"./utils-MPtJ5ynp.js";import{D as m,a as h,b as x}from"./DialogTitle-D3yk6KnK.js";import{D as C}from"./DialogActions-CUWg4ydV.js";import{B as a}from"./Button-CGPZXh3G.js";import"./Dialog-CGu6k_Gi.js";import"./formControlState-YO0xWqIm.js";const k=({courseId:i,action:n,courseTitle:r,handleClose:s,handleSuccess:c})=>{const l=localStorage.getItem("activeOrganizationId"),{localeMessages:t,apiBaseUrl:p}=u(),d=()=>{fetch(`${p}/organizations/${l}/courses/${i}/`,{method:"POST",headers:{"Content-Type":"application/json","X-CSRFToken":g("csrftoken")},body:JSON.stringify({enabled:n==="enable"})}).then(o=>o.json()).then(o=>{console.log("Course state updated successfully:",o),c(o),s()}).catch(o=>{console.error("Error updating course state:",o)})};return e.jsxs(e.Fragment,{children:[e.jsx(m,{id:"alert-dialog-title",children:t[`${n}_course`].replace("COURSE_NAME",r)}),e.jsx(h,{children:e.jsx(x,{id:"alert-dialog-description",children:t[`course_${n}_confirmation`].replace("COURSE_NAME",r)})}),e.jsxs(C,{children:[e.jsx(a,{onClick:s,children:t.cancel}),e.jsx(a,{onClick:d,autoFocus:!0,variant:"contained",children:t.continue})]})]})};export{k as default};
//# sourceMappingURL=EnableCourseSwitchPopup-BvckVNvS.js.map
