2 lines
4.9 KiB
JavaScript
2 lines
4.9 KiB
JavaScript
import{y as k,q as N,K as S,J as c,N as V,D as M,ad as O,r as I,e as n,f as e,t as r,g as U,w as T,c as l,M as C,l as i,O as h,P as x,h as s,n as _,F as g,i as v,j as u,E as Q,L as q,k as F}from"./index.b5f1eb06.js";import{c as f,r as $,e as B,i as R,m as P,u as J}from"./index.esm.4ebf7a0e.js";const j={class:"intro-y flex items-center mt-8"},z={class:"text-lg font-medium mr-auto"},G={class:"grid grid-cols-12 gap-6 mt-5"},H={class:"intro-y col-span-12 lg:col-span-6"},K={class:"flex flex-col sm:flex-row items-center p-5 border-b border-slate-200/60 dark:border-darkmode-400"},W={class:"font-medium text-base mr-auto"},X={class:"p-5"},Y=["onSubmit"],Z={class:"input-form"},ee={for:"validation-form-6",class:"form-label w-full flex flex-col sm:flex-row"},te={class:"sm:ml-auto mt-1 sm:mt-0 text-xs text-slate-500"},se=e("span",{class:"text-red-600"},"*",-1),oe=["placeholder"],ae={class:"input-form mt-3"},re={for:"validation-form-2",class:"form-label w-full flex flex-col sm:flex-row"},le={class:"sm:ml-auto mt-1 sm:mt-0 text-xs text-slate-500"},ne=e("span",{class:"text-red-600"},"*",-1),ie=["placeholder"],de={class:"input-form mt-3"},me={for:"validation-form-4",class:"form-label w-full flex flex-col sm:flex-row"},ce={class:"sm:ml-auto mt-1 sm:mt-0 text-xs text-slate-500"},ue=e("span",{class:"text-red-600"},"*",-1),fe={class:"input-form mt-3"},pe={for:"validation-form-4",class:"form-label w-full flex flex-col sm:flex-row"},he={class:"sm:ml-auto mt-1 sm:mt-0 text-xs text-slate-500"},xe=e("span",{class:"text-red-600"},"*",-1),_e={type:"submit",class:"btn btn-primary mt-5"},be={__name:"Contacts",setup(ge){const w="https://panel.exchange.gov.tm/api",E=k(),p=N(!1),b=S({address:"",email:"",phone:"",fax:""}),y={email:{required:f.withMessage(c.global.t("REQUIRED_VALIDATION"),$),email:f.withMessage(c.global.t("EMAIL_VALIDATION"),B)},phone:{required:f.withMessage(c.global.t("REQUIRED_VALIDATION"),$),integer:R},fax:{required:f.withMessage(c.global.t("REQUIRED_VALIDATION"),$),integer:R},address:{required:f.withMessage(c.global.t("REQUIRED_VALIDATION"),$),minLength:P(10)}},t=J(y,V(b)),D=async()=>{if(t.value.$touch(),!t.value.$invalid)try{p.value=!0;const o=await q.put(`${w}/account/contacts`,b);p.value=!1,F.push({name:"profile",params:{loadFromLS:!0}})}catch{p.value=!1}};return M(()=>{const o=O.isEmpty(E.params)?JSON.parse(localStorage.getItem("contacts")):E.params;o&&(localStorage.setItem("contacts",JSON.stringify(o)),Object.assign(b,o))}),(o,d)=>{const A=I("LoadingIcon"),L=I("PreviewComponent");return l(),n("div",null,[e("div",j,[e("h2",z,r(o.$t("CONTACTS")),1)]),e("div",G,[e("div",H,[U(L,{class:"intro-y box"},{default:T(()=>[e("div",K,[e("h2",W,r(o.$t("CONTACTS_FORM")),1)]),e("div",X,[e("form",{class:"validate-form",onSubmit:C(D,["prevent"])},[e("div",Z,[e("label",ee,[i(r(o.$t("ADDRESS"))+" ",1),e("span",te,[se,i(" "+r(o.$t("REQUIRED")),1)])]),h(e("textarea",{id:"validation-form-6","onUpdate:modelValue":d[0]||(d[0]=a=>s(t).address.$model=a),class:_(["form-control",{"border-danger":s(t).address.$error}]),name:"address",placeholder:o.$t("ADDRESS")},null,10,oe),[[x,s(t).address.$model,void 0,{trim:!0}]]),s(t).address.$error?(l(!0),n(g,{key:0},v(s(t).address.$errors,(a,m)=>(l(),n("div",{key:m,class:"text-danger mt-2"},r(a.$message),1))),128)):u("",!0)]),e("div",ae,[e("label",re,[i(r(o.$t("EMAIL"))+" ",1),e("span",le,[ne,i(" "+r(o.$t("REQUIRED")),1)])]),h(e("input",{id:"validation-form-2","onUpdate:modelValue":d[1]||(d[1]=a=>s(t).email.$model=a),type:"email",name:"email",class:_(["form-control",{"border-danger":s(t).email.$error}]),placeholder:o.$t("EMAIL")},null,10,ie),[[x,s(t).email.$model,void 0,{trim:!0}]]),s(t).email.$error?(l(!0),n(g,{key:0},v(s(t).email.$errors,(a,m)=>(l(),n("div",{key:m,class:"text-danger mt-2"},r(a.$message),1))),128)):u("",!0)]),e("div",de,[e("label",me,[i(r(o.$t("PHONE"))+" ",1),e("span",ce,[ue,i(" "+r(o.$t("REQUIRED")),1)])]),h(e("input",{id:"validation-form-4","onUpdate:modelValue":d[2]||(d[2]=a=>s(t).phone.$model=a),type:"number",name:"phone",class:_(["form-control",{"border-danger":s(t).phone.$error}]),placeholder:"9936xxxxxxx"},null,2),[[x,s(t).phone.$model,void 0,{trim:!0}]]),s(t).phone.$error?(l(!0),n(g,{key:0},v(s(t).phone.$errors,(a,m)=>(l(),n("div",{key:m,class:"text-danger mt-2"},r(a.$message),1))),128)):u("",!0)]),e("div",fe,[e("label",pe,[i(r(o.$t("FAX"))+" ",1),e("span",he,[xe,i(" "+r(o.$t("REQUIRED")),1)])]),h(e("input",{id:"validation-form-4","onUpdate:modelValue":d[3]||(d[3]=a=>s(t).fax.$model=a),type:"number",name:"fax",class:_(["form-control",{"border-danger":s(t).fax.$error}]),placeholder:"99312xxxxxx"},null,2),[[x,s(t).fax.$model,void 0,{trim:!0}]]),s(t).fax.$error?(l(!0),n(g,{key:0},v(s(t).fax.$errors,(a,m)=>(l(),n("div",{key:m,class:"text-danger mt-2"},r(a.$message),1))),128)):u("",!0)]),e("button",_e,[i(r(o.$t("REGISTER"))+" ",1),p.value?(l(),Q(A,{key:0,icon:"oval",color:"white",class:"w-4 h-4 ml-2"})):u("",!0)])],40,Y)])]),_:1})])])])}}};export{be as default};
|