"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[19727],{19727:(e,r,t)=>{t.r(r),t.d(r,{default:()=>o});var s=t(95155),n=t(12115),c=t(73321),i=t(80026),a=t(94111),u=t(2581);function o({params:e}){let r=(0,c.useRouter)(),t=(0,n.use)(e).id,[o,l]=(0,n.useState)(null),[d,h]=(0,n.useState)(!0),[m,f]=(0,n.useState)(!1);(0,n.useEffect)(()=>{t&&x()},[t]);let x=async()=>{try{h(!0);let e=await a.g9(t);l(e)}catch(e){console.error("Error fetching instructor:",e),(0,u.Qg)(Object(e).message||"An error occurred"),r.push("/admin/instructors")}finally{h(!1)}},j=async e=>{try{f(!0),await a.Bl(t,e),(0,u.Te)("Instructor updated successfully!"),r.push("/admin/instructors")}catch(e){console.error("Error updating instructor:",e),(0,u.Qg)(Object(e).message||"An error occurred")}finally{f(!1)}};return d?(0,s.jsx)("div",{className:"flex items-center justify-center min-h-[400px]",children:(0,s.jsx)("div",{children:"Loading..."})}):o?(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"mb-8",children:[(0,s.jsx)("h1",{className:"text-3xl font-bold text-[var(--foreground)]",children:"Edit Instructor"}),(0,s.jsx)("p",{className:"text-[var(--muted-foreground)] mt-2",children:"Update instructor details below"})]}),(0,s.jsx)(i._,{instructor:o,onSubmit:j,onCancel:()=>{r.push("/admin/instructors")},isLoading:m})]}):(0,s.jsx)("div",{className:"flex items-center justify-center min-h-[400px]",children:(0,s.jsx)("div",{children:"Instructor not found"})})}}}]);