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