Files
soft_usite/dist/assets/RegisterGasView-BUYUOr63.js
T
2025-02-06 14:22:29 -05:00

2 lines
7.9 KiB
JavaScript

import{b,d as w,e as o,t as D,i as Z,F as H,g as O,_ as J,p as K,B as Q,C as f,D as W,r as E,l as i,w as U,E as u,h as t,G as c,z as X,x as $,H as Y,I as ee,m as q}from"./index-BmU8V2V2.js";import{S as oe}from"./SectionTitle-CrHOP_mf.js";import{P as te}from"./PrimaryButton-Bm01EosZ.js";import{u as re}from"./vee-validate-uNXg2txt.js";const le="/assets/factura-ZjGpLx5w.webp",se=["for"],ae=["type","id","value"],x={__name:"RegisterGasInput",props:{label:{type:String,required:!0},id:{type:String,required:!0},type:{type:String,required:!0},error:{type:String},modelValue:{type:String||Number}},emits:["update:modelValue","blur"],setup(a){return(n,d)=>(b(),w(H,null,[o("label",{for:a.id,class:"md:w-1/3 text-left md:pr-4"},D(a.label),9,se),o("input",{type:a.type,id:a.id,value:a.modelValue,onInput:d[0]||(d[0]=p=>n.$emit("update:modelValue",p.target.value)),onBlur:d[1]||(d[1]=p=>n.$emit("blur")),class:Z(["w-full md:w-2/3 p-2 py-3 border border-gray-100 rounded-xl shadow-[0_5px_25px_rgba(0,0,0,0.1)]",{"border-red-500":a.error}])},null,42,ae)],64))}},de=async a=>{var n,d;try{const{data:p}=await O.post("/users_gas",a);return p}catch(p){throw new Error(((d=(n=p.response)==null?void 0:n.data)==null?void 0:d.message)||"Error desconocido en la solicitud")}},ie={class:"p-1 max-w-5xl mx-auto"},ne={class:"p-8 rounded-xl shadow-[0_5px_25px_rgba(0,0,0,0.1)]"},me={class:"space-y-4"},ue={class:"grid grid-cols-1 gap-3"},ce={class:"flex flex-col md:flex-row md:items-center"},pe={class:"flex flex-col md:flex-row md:items-center"},fe={class:"flex flex-col md:flex-row md:items-center"},xe={class:"flex flex-col md:flex-row md:items-center"},be={class:"flex flex-col md:flex-row md:items-center"},we={class:"flex flex-col md:flex-row md:items-center relative"},ge={key:0,xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"size-6"},ve={key:1,xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"size-6"},ye={key:0,class:"text-sm text-red-500 mt-1"},Ve={class:"flex flex-col md:flex-row md:items-center"},_e={class:"flex flex-col md:flex-row md:items-start"},ke={class:"md:w-2/3"},Ce={class:"flex flex-col md:flex-row md:items-center"},Ae=["href"],he={class:"mt-8 flex justify-center md:justify-start"},Se={__name:"RegisterGasView",setup(a){const n=K(),d=Q({codigo:f().required("El código es obligatorio."),medidor:f().required("El número de medidor es obligatorio."),documento:f().required("El documento es obligatorio."),name:f().required("El nombre es obligatorio."),email:f().email("Correo electrónico no válido.").required("El correo es obligatorio."),celular:f().required("El número de celular es obligatorio."),acepto_info:W().required("Debe aceptar recibir información."),password:f().required("La contraseña es obligatoria.").min(8,"La contraseña debe tener al menos 8 caracteres.").matches(/[A-Z]/,"La contraseña debe contener al menos una letra mayúscula.").matches(/[0-9]/,"La contraseña debe contener al menos un número.")}),{values:p,defineField:m,errors:l,handleSubmit:j,resetForm:B}=re({validationSchema:d}),[v,G]=m("codigo"),[y,L]=m("medidor"),[V,M]=m("documento"),[_,N]=m("name"),[k,P]=m("email"),[C,R]=m("celular"),[A,I]=m("acepto_info"),[h,F]=m("password"),S=E(!1),g=E(!1),T=()=>{g.value=!g.value},z=j(s=>{const e={nombre_usuario:s.codigo.trim(),numero_medidor:s.medidor.trim(),documento:s.documento,name:s.name,email:s.email,celular:s.celular,acepto_info:s.acepto_info,password:s.password,tipo:"gas"};de(e).then(()=>{n.success(`Registro exitoso. Hemos enviado un email de verificación a ${e.email}.`),B(),setTimeout(()=>{window.location.href="/login"},2e3)}).catch(r=>{n.error(`Error: ${r.message||"Error: Contacta con soporte"}`)})});return(s,e)=>(b(),w("div",ie,[i(oe,{class:"mt-8"},{default:U(()=>e[9]||(e[9]=[q("Registro para Usuarios del Gas natural")])),_:1}),o("div",ne,[o("form",me,[o("div",ue,[o("div",ce,[i(x,u({label:"Código:",id:"codigo",type:"number",modelValue:t(v),"onUpdate:modelValue":e[0]||(e[0]=r=>c(v)?v.value=r:null)},t(G),{error:t(l).codigo}),null,16,["modelValue","error"])]),o("div",pe,[i(x,u({label:"Medidor:",type:"text",id:"medidor",modelValue:t(y),"onUpdate:modelValue":e[1]||(e[1]=r=>c(y)?y.value=r:null)},t(L),{error:t(l).medidor}),null,16,["modelValue","error"])]),o("div",fe,[i(x,u({label:"Documento:",type:"number",id:"documento",modelValue:t(V),"onUpdate:modelValue":e[2]||(e[2]=r=>c(V)?V.value=r:null)},t(M),{error:t(l).documento}),null,16,["modelValue","error"])]),o("div",xe,[i(x,u({label:"Nombre completo:",type:"text",id:"nombre_completo",modelValue:t(_),"onUpdate:modelValue":e[3]||(e[3]=r=>c(_)?_.value=r:null)},t(N),{error:t(l).name}),null,16,["modelValue","error"])]),o("div",be,[i(x,u({label:"Correo electrónico:",type:"email",id:"correo_electronico",modelValue:t(k),"onUpdate:modelValue":e[4]||(e[4]=r=>c(k)?k.value=r:null)},t(P),{error:t(l).email}),null,16,["modelValue","error"])]),o("div",we,[i(x,u({label:"Contraseña:",type:g.value?"text":"password",id:"password",modelValue:t(h),"onUpdate:modelValue":e[5]||(e[5]=r=>c(h)?h.value=r:null)},t(F),{error:t(l).password}),null,16,["type","modelValue","error"]),o("button",{type:"button",onClick:T,class:"absolute right-4 top-1/2 transform -translate-y-1/2"},[g.value?(b(),w("svg",ge,e[10]||(e[10]=[o("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M3.98 8.223A10.477 10.477 0 0 0 1.934 12C3.226 16.338 7.244 19.5 12 19.5c.993 0 1.953-.138 2.863-.395M6.228 6.228A10.451 10.451 0 0 1 12 4.5c4.756 0 8.773 3.162 10.065 7.498a10.522 10.522 0 0 1-4.293 5.774M6.228 6.228 3 3m3.228 3.228 3.65 3.65m7.894 7.894L21 21m-3.228-3.228-3.65-3.65m0 0a3 3 0 1 0-4.243-4.243m4.242 4.242L9.88 9.88"},null,-1)]))):(b(),w("svg",ve,e[11]||(e[11]=[o("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M2.036 12.322a1.012 1.012 0 0 1 0-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178Z"},null,-1),o("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"},null,-1)])))])]),t(l).password?(b(),w("p",ye,D(t(l).password),1)):X("",!0),o("div",Ve,[i(x,u({label:"Celular:",type:"text",id:"celular",modelValue:t(C),"onUpdate:modelValue":e[6]||(e[6]=r=>c(C)?C.value=r:null)},t(R),{error:t(l).celular}),null,16,["modelValue","error"])]),o("div",_e,[e[14]||(e[14]=o("label",{for:"acepto",class:"md:w-1/3 text-left md:pr-4"},"Acepto:",-1)),o("div",ke,[e[13]||(e[13]=o("p",{class:"mb-2"},"Recibir información vía correo electrónico y/o mensajes de texto sobre facturas, cartera, crédito, suspensiones, reconexiones y otros.",-1)),$(o("select",u({id:"acepto","onUpdate:modelValue":e[7]||(e[7]=r=>c(A)?A.value=r:null)},t(I),{class:["w-full p-2 py-3 border border-gray-100 rounded-xl shadow-[0_5px_25px_rgba(0,0,0,0.1)] bg-white",{"border-red-500":t(l).acepto_info}]}),e[12]||(e[12]=[o("option",{value:""},"Seleccione una opción",-1),o("option",{value:!0},"Sí",-1),o("option",{value:!1},"No",-1)]),16),[[Y,t(A)]])])]),o("div",Ce,[e[15]||(e[15]=o("label",{for:"acepto_politica",class:"md:w-1/3 text-left md:pr-4"},"Acepto Política de Protección de Datos",-1)),$(o("input",{"onUpdate:modelValue":e[8]||(e[8]=r=>S.value=r),type:"checkbox",id:"acepto_politica",class:"custom-checkbox drop-shadow-md w-6 h-6 focus:ring-0 focus:outline-none"},null,512),[[ee,S.value]]),o("a",{href:s.$router.resolve({name:"protectionData"}).href,target:"_blank",rel:"noopener noreferrer",class:"ml-2 text-base hover:underline"}," Ver política de protección de datos ",8,Ae)])])])]),o("div",he,[i(te,{onClick:t(z),disabled:!S.value},{default:U(()=>e[16]||(e[16]=[q(" ENVIAR SOLICITUD ")])),_:1},8,["onClick","disabled"])]),e[17]||(e[17]=o("div",{class:"flex justify-center mt-8"},[o("img",{src:le,alt:"Factura de Gas",class:"w-full h-auto"})],-1)),e[18]||(e[18]=o("div",{class:"mt-12"},[o("div",{class:"h-2 bg-[#274e93] mt-4 mb-16 rounded-xl"})],-1))]))}},De=J(Se,[["__scopeId","data-v-ed7881e3"]]);export{De as default};