import{aX as c,n as h,r as n,k as u,j as e,S as x,T as l,ad as s,B as v}from"./vendor-BuNhBR-q.js";import{B as j,P as p}from"./ParentCard-DFHA8fzx.js";import{P as g}from"./index-DzxWaMzc.js";const P=()=>{const{id:r}=c(),d=h(),[a,i]=n.useState(null);n.useEffect(()=>{u.get(`/api/tasks/${r}`).then(t=>i(t.data))},[r]);const o=async()=>{await u.put(`/api/tasks/${r}`,a),d(`/tasks/${r}`)};return a?e.jsxs(g,{children:[e.jsx(j,{title:"EDIT TASK",items:[{to:"/",title:"Dashboard"},{to:"/tasks",title:"Tasks"},{title:"Edit"}]}),e.jsx(p,{children:e.jsxs(x,{spacing:2,maxWidth:500,children:[e.jsxs(l,{select:!0,label:"Status",value:a.status,onChange:t=>i({...a,status:t.target.value}),children:[e.jsx(s,{value:"OPEN",children:"Open"}),e.jsx(s,{value:"IN_PROGRESS",children:"In Progress"}),e.jsx(s,{value:"COMPLETED",children:"Completed"}),e.jsx(s,{value:"BLOCKED",children:"Blocked"})]}),e.jsxs(l,{select:!0,label:"Priority",value:a.priority,onChange:t=>i({...a,priority:t.target.value}),children:[e.jsx(s,{value:"LOW",children:"Low"}),e.jsx(s,{value:"MEDIUM",children:"Medium"}),e.jsx(s,{value:"HIGH",children:"High"})]}),e.jsx(l,{type:"date",label:"Due Date",InputLabelProps:{shrink:!0},value:a.due_date||"",onChange:t=>i({...a,due_date:t.target.value})}),e.jsx(v,{variant:"contained",onClick:o,children:"Save Changes"})]})})]}):null};export{P as default};
