import{g as w,e as _,b as V}from"./primevue-CfIk0_DY.js";import{a1 as k,h as I,b as u,c as m,d as t,v as i,I as c,t as C,p as A,l as E,f as L,E as T,a as g}from"./vue-core-Di3IuVqe.js";import{_ as B,a as N,b,s as r}from"./index-BxIwIJfy.js";import"./cjs-helpers-psZwOBky.js";import"./vue-cal-DKMVGERa.js";import"./moment-BeHQNF8T.js";const R={class:"login-page"},O={class:"login-container"},P={class:"login-card"},S={class:"p-8 space-y-6"},$={class:"space-y-2"},K={class:"login-input-wrapper"},M={class:"space-y-2"},U={class:"login-input-wrapper"},z={class:"space-y-2"},D={key:0,class:"rounded-lg bg-red-50 p-3 text-center text-sm text-red-600"},G={class:"text-center mt-6"},j={__name:"PortailCabinetLogin",setup(q){const v=k(),s=T({uid:"",email:"",password:""}),d=g(!1),a=g(""),n=async()=>{if(a.value="",!s.uid||!s.email||!s.password){a.value="Tous les champs sont obligatoires.";return}d.value=!0;try{const o=await b.post(`${r.lienApi}/portail-cabinet/login`,{uid:s.uid.trim(),email:s.email,password:s.password});r.commit("PORTAIL_CABINET_LOGIN",{token:o.data.token,contact:o.data.contact,societe:o.data.societe,nomCabinet:o.data.nomCabinet,sessionId:o.data.sessionId});try{const e=await b.get(`${r.lienApi}/portail-cabinet/modules`,{headers:{Authorization:`Bearer ${o.data.token}`}});r.commit("PORTAIL_CABINET_SET_MODULES",e.data||[])}catch{}v.push("/portail-cabinet/accueil")}catch(o){a.value=o.response?.data?.message||"Erreur de connexion."}finally{d.value=!1}};return(o,e)=>{const p=w,f=_,x=V,y=I("RouterLink");return u(),m("section",R,[e[12]||(e[12]=t("div",{class:"login-bg-circle login-bg-circle-1"},null,-1)),e[13]||(e[13]=t("div",{class:"login-bg-circle login-bg-circle-2"},null,-1)),e[14]||(e[14]=t("div",{class:"login-bg-circle login-bg-circle-3"},null,-1)),t("div",O,[e[11]||(e[11]=t("div",{class:"flex justify-center mb-6"},[t("img",{src:N,alt:"OMAG",class:"h-16 logo-omag"})],-1)),t("div",P,[t("div",S,[e[10]||(e[10]=t("div",{class:"text-center"},[t("h1",{class:"text-2xl font-bold text-gray-900"},"Espace cabinet"),t("p",{class:"text-gray-500 mt-1"},"Suivez vos declarations fiscales et vos echeances")],-1)),t("div",$,[e[4]||(e[4]=t("label",{class:"block text-sm font-medium text-gray-700"},"Identifiant cabinet",-1)),t("div",K,[e[3]||(e[3]=t("i",{class:"pi pi-briefcase login-input-icon"},null,-1)),i(p,{modelValue:s.uid,"onUpdate:modelValue":e[0]||(e[0]=l=>s.uid=l),class:"w-full login-input",placeholder:"Identifiant fourni par votre cabinet",onKeydown:c(n,["enter"])},null,8,["modelValue"])]),e[5]||(e[5]=t("p",{class:"text-xs text-gray-400"},"Code unique de votre cabinet comptable",-1))]),t("div",M,[e[7]||(e[7]=t("label",{class:"block text-sm font-medium text-gray-700"},"Email",-1)),t("div",U,[e[6]||(e[6]=t("i",{class:"pi pi-envelope login-input-icon"},null,-1)),i(p,{modelValue:s.email,"onUpdate:modelValue":e[1]||(e[1]=l=>s.email=l),type:"email",class:"w-full login-input",placeholder:"Votre adresse email",onKeydown:c(n,["enter"])},null,8,["modelValue"])])]),t("div",z,[e[8]||(e[8]=t("label",{class:"block text-sm font-medium text-gray-700"},"Mot de passe",-1)),i(f,{modelValue:s.password,"onUpdate:modelValue":e[2]||(e[2]=l=>s.password=l),feedback:!1,toggleMask:"",class:"w-full",inputClass:"w-full login-input",placeholder:"Votre mot de passe",onKeydown:c(n,["enter"])},null,8,["modelValue"])]),i(x,{label:"Se connecter",class:"w-full login-btn",icon:"pi pi-sign-in",onClick:n,loading:d.value},null,8,["loading"]),a.value?(u(),m("p",D,C(a.value),1)):A("",!0),t("div",G,[i(y,{to:"/login",class:"text-gray-500 hover:text-gray-700 text-xs transition-colors"},{default:E(()=>[...e[9]||(e[9]=[L(" Acces gestion (administrateur) ",-1)])]),_:1})])])])])])}}},Y=B(j,[["__scopeId","data-v-7d9a7437"]]);export{Y as default};
