1import{d as U,b as q,D as I,B as f,c as h,l,t as T,g as j,h as i,q as F,G as R,R as A,aa as B,aj as L,j as y,Q as H}from"./CiKtckVa.js";import{_ as E}from"./B1_FshQ4.js";import{V as v}from"./DjYJYkEl.js";import{_ as J}from"./5DDz-OcZ.js";import{V as O}from"./CHCaeQPP.js";import{a as Z}from"./BFX4lM9_.js";import{u as $}from"./kyA1SXwn.js";import{o as z,u as G,s as _,d as K,Z as Q}from"./DTVzw1wU.js";const M={class:"p-4 md:p-8 flex-1 flex flex-col justify-center"},W={class:"max-w-md w-full mx-auto space-y-6"},X={class:"p-4 md:p-8 flex-1 flex flex-col justify-center"},Y={class:"max-w-md w-full mx-auto space-y-6"},ee={key:0,class:"bg-red-50 dark:bg-red-900/50 text-red-500 dark:text-red-400 px-4 py-3 rounded-md"},ae={class:"grid grid-cols-1 md:grid-cols-2 gap-4"},te={class:"mt-6 space-y-3"},se=U({__name:"index",setup(re){q({title:"Compléter mon profil"});const d=L(),u=f(!1),n=f(""),{user:m,setAuthUser:x}=R(),{getUserData:D,setUserData:V}=I(),N=Z(),{getCampaigns:w,fetchHomeInfo:S}=$(),a=f({firstName:m.value?.first_name||"",lastName:m.value?.last_name||"",birthDate:m.value?.birthday?new Date(m.value.birthday):null,description:""}),k=z({firstName:_().trim().min(1,"Le prénom est requis"),lastName:_().trim().min(1,"Le nom est requis"),birthDate:G([_(),K()]).nullable().refine(t=>!!t,{message:"La date de naissance est requise"})}),C=()=>{let t=!0;n.value="";try{k.parse(a.value)}catch(e){e instanceof Q&&(n.value=e.errors[0].message),t=!1}return t},P=async()=>{if(C()){u.value=!0;try{const t=a.value.firstName.trim(),e=a.value.lastName.trim(),r=a.value.birthDate?new Intl.DateTimeFormat("fr-FR",{day:"2-digit",month:"2-digit",year:"numeric"}).format(new Date(a.value.birthDate)):"",o=m.value||D()||{},s=new FormData;s.append("mobile_general_form[first_name]",t),s.append("mobile_general_form[last_name]",e),s.append("mobile_general_form[birthday]",r),s.append("mobile_general_form[birthdayShow]","0"),s.append("mobile_general_form[email]",o.email||""),s.append("mobile_general_form[username]",o.username||o.email||"");const p=String(o.civility||"").trim().toLowerCase(),b=p==="mme"?"mrs":p==="mlle"?"ms":p;s.append("mobile_general_form[civility]",["mr","mrs","ms"].includes(b)?b:""),s.append("mobile_general_form[profession]",o.profession||""),s.append("mobile_general_form[picture]",o.profile_picture||""),await A("/api/user",{method:"POST",data:s});const c={...o,first_name:t,last_name:e};if(a.value.birthDate&&(c.birthday=B(new Date(a.value.birthDate))),V(c),x(c),N.value)d.push("/app/signup/select-club");else{try{await S()}catch{}const g=w.value?.[0];g?.action?d.push("/app/admin/vpdive?route="+g.action):d.push("/app")}}catch(t){n.value=t?.data?.message||"Une erreur est survenue lors de la sauvegarde des informations."}finally{u.value=!1}}};return(t,e)=>(y(),h("div",M,[l("div",W,[l("div",X,[l("div",Y,[e[4]||(e[4]=l("div",{class:"space-y-2"},[l("h1",{class:"text-3xl font-bold text-gray-900 dark:text-white"},"Compléter mon profil"),l("p",{class:"text-gray-600 dark:text-gray-400"}," Renseignez vos informations pour continuer ")],-1)),n.value?(y(),h("div",ee,T(n.value),1)):j("",!0),i(E,{class:"space-y-4",onSubmit:P},{default:F(()=>[l("div",ae,[i(v,{name:"firstName",type:"text",label:"Prénom",placeholder:"John",modelValue:a.value.firstName,"onUpdate:modelValue":e[0]||(e[0]=r=>a.value.firstName=r),vertical:"",required:""},null,8,["modelValue"]),i(v,{name:"lastName",type:"text",label:"Nom",placeholder:"Doe",modelValue:a.value.lastName,"onUpdate:modelValue":e[1]||(e[1]=r=>a.value.lastName=r),vertical:"",required:""},null,8,["modelValue"])]),i(O,{name:"birthDate",type:"date",label:"Date de naissance",modelValue:a.value.birthDate,"onUpdate:modelValue":e[2]||(e[2]=r=>a.value.birthDate=r),required:""},null,8,["modelValue"]),i(v,{name:"description","is-textarea":"",rows:2,label:"Raison de votre demande d'adhésion",modelValue:a.value.description,"onUpdate:modelValue":e[3]||(e[3]=r=>a.value.description=r),placeholder:"Je souhaite adhérer pour rejoindre mon club"},null,8,["modelValue"]),l("div",te,[i(J,{type:"submit",loading:u.value,text:"Suivant",icon:"material-symbols:trending-flat",iconPosition:"right",customClass:"w-full"},null,8,["loading"])])]),_:1})])])])]))}}),ce=H(se,[["__scopeId","data-v-a046954f"]]);export{ce 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.