1import{F as k,_ as A}from"./CJt9i5HL.js";import{_ as z}from"./BdI_WVju.js";import{e as M,f as S,J as q,l as p,i as $,c as g,o as h,a,q as I,s as U,t as r,g as e,w as v,b as c,D as T,d as w,n as B,p as _,X as F,K as H}from"./BwpL3H6q.js";import{u as O}from"./CGcXypFs.js";import"./DeHp9kj6.js";import"./Dd6rXT-4.js";const j={class:"flex flex-col gap-6"},J={class:"text-slate-600 text-sm"},K={class:"bg-slate-100 rounded-lg p-4 text-center"},R={class:"text-xs text-slate-500 mb-1"},X={class:"font-mono font-bold text-xl tracking-widest text-primary-300"},G={class:"pt-6 flex flex-col gap-3"},P=["disabled"],Q={key:0,class:"animate-spin h-4 w-4",fill:"none",viewBox:"0 0 24 24"},W=M({__name:"delete-account",setup(D){const{t:s}=S(),u=q(),f=p(!1),n=p(""),m=p(""),{execute:V,status:o}=O(`/Users/${u.user.id}`,{},{method:"DELETE",immediate:!1}),b=$(()=>o.value==="pending");function t(){return Math.random().toString(36).substring(2,8).toUpperCase()}function l(){n.value=t(),m.value="",f.value=!0}function d(){f.value=!1}const y=$(()=>B({confirm:_().required(s("fields.yup.required")).oneOf([n.value],s("auth.deleteAccount.codeError"))}));async function i(){var C;(C=u.user)!=null&&C.id&&(await V(),d(),u.setUser(null),u.setLicenses(null),F({name:"index"}))}return(C,x)=>{const E=A,L=z;return h(),g("div",null,[a("button",{type:"button",class:"btn-error bt
1n",onClick:l},r(e(s)("auth.deleteAccount.button")),1),e(f)?(h(),I(L,{key:0,onClose:d},{header:v(()=>[w(r(e(s)("auth.deleteAccount.modalTitle")),1)]),default:v(()=>[a("div",j,[a("p",J,r(e(s)("auth.deleteAccount.modalDescription")),1),a("div",K,[a("p",R,r(e(s)("auth.deleteAccount.codeLabel")),1),a("span",X,r(e(n)),1)]),c(e(k),{"validation-schema":e(y),onSubmit:i},{default:v(()=>[c(E,{modelValue:e(m),"onUpdate:modelValue":x[0]||(x[0]=N=>T(m)?m.value=N:null),name:"confirm",type:"text",label:e(s)("auth.deleteAccount.inputLabel"),placeholder:e(n),class:"flex-col"},null,8,["modelValue","label","placeholder"]),a("div",G,[a("button",{type:"submit",disabled:e(b),class:"btn btn-error w-full flex items-center justify-center gap-2"},[e(b)?(h(),g("svg",Q,x[1]||(x[1]=[a("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"},null,-1),a("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"},null,-1)]))):U("",!0),w(" "+r(e(s)("auth.deleteAccount.confirm")),1)],8,P)])]),_:1},8,["validation-schema"])])]),_:1})):U("",!0)])}}}),Y={class:"flex flex-col gap-6"},Z={class:"font-bold text-primary-300"},ee={class:"grid md:grid-cols-2 gap-4"},te={class:"pt-4"},ae=["disabled"],se={key:0,class:"animate-spin -ml-1 mr-3 h-5 w-5 text-white",fill:"none",viewBox:"0 0 24 24"},le={class:"border-t border-slate-200 pt-6"},de=M({__name:"edit",setup(D){const{t:s}=S(),u=q(),f=p(null),n=p(!1);H(()=>{const t=u.user;t&&(o.value={...o.value,first_name:t.first_name,last_name:t.last_name,birthdate:t.birthdate,phone:t.phone})});function m(t){}function V(t){f.value=null,n.value=!0;const l={first_name:t.first_name,last_name:t.last_name,email:t.email,birthdate:t.birthdate,phone:t.phone,optin_mail:t.optin_mail,school:t.school,language:t.language};u.updateUserData(l).finally(()=>{n.value=!1})}const o=p({first_name:"",last_name:"",birthdate:"",phone:""}),b=B({first_name:_().required(),last_name:_().required(),birthdate:_().required(),phone:_().required()});return(t,l)=>{const d=A,y=W;return h(),g("div",Y,[a("h3",Z,r(e(s)("auth.modify.title")),1),c(e(k),{onSubmit:V,onInvalidSubmit:m,"validation-schema":e(b)},{default:v(()=>[a("div",ee,[c(d,{modelValue:e(o).first_name,"onUpdate:modelValue":l[0]||(l[0]=i=>e(o).first_name=i),name:"first_name",type:"text",label:e(s)("fields.firstName"),class:"flex-col"},null,8,["modelValue","label"]),c(d,{modelValue:e(o).last_name,"onUpdate:modelValue":l[1]||(l[1]=i=>e(o).last_name=i),name:"last_name",type:"text",label:e(s)("fields.lastName"),class:"flex-col"},null,8,["modelValue","label"]),c(d,{modelValue:e(o).birthdate,"onUpdate:modelValue":l[2]||(l[2]=i=>e(o).birthdate=i),name:"birthdate",type:"birthdate",label:e(s)("fields.birthday"),class:"flex-col"},null,8,["modelValue","label"]),c(d,{modelValue:e(o).phone,"onUpdate:modelValue":l[3]||(l[3]=i=>e(o).phone=i),name:"phone",type:"phone",label:e(s)("fields.phone"),class:"flex-col"},null,8,["modelValue","label"])]),a("div",te,[a("button",{type:"submit",disabled:e(n),class:"btn-action"},[e(n)?(h(),g("svg",se,l[4]||(l[4]=[a("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"},null,-1),a("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"},null,-1)]))):U("",!0),w(" "+r(e(n)?"Enregistrement...":e(s)("auth.modify.saveChanges")),1)],8,ae)])]),_:1},8,["validation-schema"]),a("div",le,[c(y)])])}}});export{de as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.