import{t as C,a as E}from"./CUaqldoV.js";import{p as F,K as d,L as f,g as a,a as P,s as i,c as s,M as v,r as l,n as D}from"./BSRAYoh9.js";import{e as I}from"./Dvr0EhCJ.js";import{r as h}from"./DFaclXwQ.js";import{b as y}from"./BEmMrY3m.js";import{i as K,g as L}from"./BeGXM4cT.js";import{E as M,f as A}from"./DBld0cGI.js";import{s as U}from"./lGUXrafz.js";var W=C('<form class="form-group"><div><label for="name" class="form-label">Imię</label> <input type="text" id="name" class="form-control"></div> <div><label for="name" class="form-label">Nazwisko</label> <input type="text" id="lastname" class="form-control"></div> <div><label for="name" class="form-label">Tytuł naukowy</label> <input type="text" id="academicTitle" class="form-control"></div> <div><label for="description" class="form-label">Opis</label> <!></div> <div class="place-end"><button class="btn">Zapisz</button></div></form>');function Y(J,t){var w,O,N,S;F(t,!0);let r=d(f(((w=t.teacher)==null?void 0:w.firstname)||"")),o=d(f(((O=t.teacher)==null?void 0:O.lastname)||"")),n=d(f((N=t.teacher)!=null&&N.description?JSON.parse(t.teacher.description):[])),m=d(f(((S=t.teacher)==null?void 0:S.academicTitle)||""));async function j(e){e.preventDefault();const g=await(t.teacher?A("/mgr/kadra/",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({slug:t.teacher.slug,firstname:a(r),lastname:a(o),description:a(n),academicTitle:a(m)})}):A("/mgr/kadra/",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({firstname:a(r),lastname:a(o),description:a(n),slug:U(a(r)),academicTitle:a(m)})}));g!=null&&g.ok&&(await K(),await L("/mgr/kadra"))}var c=W(),p=s(c),T=i(s(p),2);h(T),l(p);var u=i(p,2),_=i(s(u),2);h(_),l(u);var b=i(u,2),k=i(s(b),2);h(k),l(b);var x=i(b,2),z=i(s(x),2);M(z,{get value(){return a(n)},set value(e){v(n,e,!0)}}),l(x),D(2),l(c),I("submit",c,e=>j(e)),y(T,()=>a(r),e=>v(r,e)),y(_,()=>a(o),e=>v(o,e)),y(k,()=>a(m),e=>v(m,e)),E(J,c),P()}export{Y as F};
