import{u as v,r as N,b as _,j as e}from"./vendor-BKmmeuxg.js";import{I as n}from"./input-error-LaPr_4wd.js";import{L as C}from"./loading-button-BnTVAMJ7.js";import{T as I}from"./tag-input-BqUWHOBp.js";import{B as u}from"./button-BpNwv2aE.js";import{C as E}from"./card-D9_SJYq6.js";import{I as h}from"./input-DM0goJrn.js";import{L as o}from"./label-HmIcv5Yx.js";import{T}from"./textarea-CyndvowL.js";import{o as d}from"./inertia-SZXqLvQm.js";import"./utils-DxSsnXxD.js";import"./index-WW_1X1qx.js";const R=()=>{const{auth:g,instructor:s,translate:x}=v().props,{button:l,input:t,frontend:p}=x,[j,f]=N.useState(!s),b=s!=null&&s.skills?typeof s.skills=="string"?JSON.parse(s.skills):s.skills:[],{data:m,setData:r,post:c,processing:y,errors:i}=_({user_id:g.user.id,skills:b,designation:(s==null?void 0:s.designation)||"",biography:(s==null?void 0:s.biography)||"",resume:null}),k=a=>{a.preventDefault(),c(s?route("become-instructor.update",s.id):route("become-instructor.store"))};return e.jsx(E,{className:"p-4 sm:p-6",children:j?e.jsxs("form",{onSubmit:k,className:"relative space-y-4",children:[e.jsxs("div",{children:[e.jsx(o,{children:t.designation}),e.jsx(h,{type:"text",name:"designation",onChange:a=>d(a,r),placeholder:t.designation_placeholder}),e.jsx(n,{message:i.designation})]}),e.jsxs("div",{children:[e.jsx(o,{children:t.resume}),e.jsx(h,{readOnly:!0,type:"file",name:"resume",onChange:a=>d(a,r)}),e.jsx(n,{message:i.resume})]}),e.jsxs("div",{children:[e.jsx(o,{children:t.skills}),e.jsx(I,{defaultTags:m.skills,placeholder:t.skills_tag_placeholder,onChange:a=>r("skills",a)}),e.jsx(n,{message:i.skills})]}),e.jsxs("div",{className:"pb-3",children:[e.jsx(o,{children:t.biography}),e.jsx(T,{rows:5,required:!0,name:"biography",value:m.biography,onChange:a=>d(a,r),placeholder:t.biography_placeholder}),e.jsx(n,{message:i.biography})]}),e.jsx(C,{loading:y,className:"mt-2",children:s?l.submit:l.update})]}):e.jsx("div",{className:"space-y-6 text-center",children:s.status==="rejected"?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-red-600",children:p.application_rejected}),e.jsx(u,{type:"button",onClick:()=>f(!0),variant:"destructive",className:"text-primary-foreground capitalize",children:l.reapply})]}):e.jsxs(e.Fragment,{children:[e.jsx("p",{children:p.application_under_review}),e.jsxs(u,{type:"button",className:"capitalize",children:[p.application_status,": ",s.status]})]})})})};export{R as default};
