import{u,j as e}from"./render-D1ZqzUbP.js";import{g as m}from"./utils-VIUIl18e.js";import{D as g,a as h}from"./DialogTitle-J__fqFcw.js";import{D as f}from"./DialogContentText-BSyscD7T.js";import{D as x}from"./DialogActions-JiHQNj-t.js";import{B as s}from"./Button-DJ_uYab0.js";import"./Dialog-aanaDG86.js";import"./formControlState-C1XOL3mQ.js";const $=({courseId:i,action:r,courseTitle:a,handleClose:n,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":m("csrftoken")},body:JSON.stringify({enabled:r==="enable",image:"SKIP"})}).then(o=>o.json()).then(o=>{console.log("Course state updated successfully:",o),c(o),n()}).catch(o=>{console.error("Error updating course state:",o)})};return e.jsxs(e.Fragment,{children:[e.jsx(g,{id:"alert-dialog-title",children:t[`${r}_course`].replace("COURSE_NAME",a)}),e.jsx(h,{children:e.jsx(f,{id:"alert-dialog-description",children:t[`course_${r}_confirmation`].replace("COURSE_NAME",a)})}),e.jsxs(x,{children:[e.jsx(s,{onClick:n,children:t.cancel}),e.jsx(s,{onClick:d,autoFocus:!0,variant:"contained",children:t.continue})]})]})};export{$ as default};
//# sourceMappingURL=EnableCourseSwitchPopup-BF2s0nbI.js.map
