import{_ as k,u as I,b as L,a as S,c,l as h,m as T,k as d,o as f,d as g,e as t,g as o,v,U as V,j as n,T as u}from"./app-AsEGLHZE.js";const B={class:"main"},P={class:"page-content"},A={class:"payment-history"},C={class:"container-fluid"},R={class:"profile-info"},F={class:"form-group profile"},M={key:0,class:"attr",id:"img-output",src:"/image/default.jpg",style:{width:"150px",height:"150px"}},N=["src"],j={class:"current-address"},E={class:"row"},H={class:"col-sm-12"},Y={__name:"profile",setup(D){I(i=>({"76fe9222":o(p).color})),L();const s=S();let r=c(()=>s.state.user);c(()=>s.state.country);let p=c(()=>s.state.settings),m=h({image:"",userId:r.value.id}),a=h({address:r.value.address,name:r.value.name,phone:r.value.phone,email:r.value.email,tokenId:localStorage.getItem("HolesaleBagauthToken").split("|")[0]}),y=localStorage.getItem("HolesaleBagauthToken").split("|")[0];const _=async()=>{r.value.length==0&&(s.dispatch("Loader",!0),axios.post("/api/get-address/"+y).then(i=>{s.dispatch("Loader",!1);let e=i.data;s.dispatch("getCountry",e),s.dispatch("UserFirst",e.user),a.name=e.user.name,m.userId=e.user.id,a.phone=e.user.phone,a.email=e.user.email,a.address=e.user.address}))};T(async()=>{_(),window.scrollTo(0,0),s.dispatch("mobileMenuHideShow",!1),s.dispatch("SearchText",null),s.dispatch("rightSidebar",!1),s.dispatch("LeftCategorySidebar",!1)});let x=d(!0);const U=async()=>{s.dispatch("Loader",!0),axios.post("/api/user-update",a).then(i=>{s.dispatch("Loader",!1);let e=i.data.user;s.dispatch("UserFirst",e),x.value=!0})};d([]),d([]),d([]),d([]);const b=async i=>{let e=i.target.files[0],l=new FileReader;d(),l.onload=w=>{m.image=w.target.result,axios.post(p.value.frontend_img_url+"/api/update-profile-picture",m).then(z=>{})},l.readAsDataURL(e)};return(i,e)=>(f(),g("main",B,[e[8]||(e[8]=t("div",{class:"mt-4"},null,-1)),t("div",P,[t("div",A,[t("div",C,[e[7]||(e[7]=t("h1",{class:"page-title"},"Your Profile",-1)),t("div",R,[t("div",F,[o(r).image?v("",!0):(f(),g("img",M)),o(r).image?(f(),g("img",{key:1,class:"attr",id:"img-output",src:o(p).frontend_img_url+"/storage/image/profile/"+o(r).image,style:{width:"150px",height:"150px"}},null,8,N)):v("",!0),e[4]||(e[4]=t("label",{class:"profile-picture-label",for:"attrimg"},null,-1)),t("input",{type:"file",style:{display:"none"},onChange:b,class:"form-control hidden",id:"attrimg",onchange:"document.getElementById('img-output').src = window.URL.createObjectURL(this.files[0])",placeholder:"Price"},null,32)]),t("form",{onSubmit:V(U,["prevent"])},[n(t("input",{"onUpdate:modelValue":e[0]||(e[0]=l=>o(a).name=l),class:"form-control",type:"text",placeholder:"Your Name"},null,512),[[u,o(a).name]]),n(t("input",{"onUpdate:modelValue":e[1]||(e[1]=l=>o(a).email=l),class:"form-control",type:"email",placeholder:"Email Address"},null,512),[[u,o(a).email]]),n(t("input",{style:{"font-size":"20px","font-weight":"700"},"onUpdate:modelValue":e[2]||(e[2]=l=>o(a).phone=l),disabled:"",class:"form-control",type:"number",placeholder:"Your Phone Number"},null,512),[[u,o(a).phone]]),t("div",j,[t("div",E,[t("div",H,[e[5]||(e[5]=t("label",null,"Address",-1)),n(t("input",{"onUpdate:modelValue":e[3]||(e[3]=l=>o(a).address=l),type:"text",class:"form-control"},null,512),[[u,o(a).address]])])])]),e[6]||(e[6]=t("div",{class:"more text-center mt-2"},[t("button",null,"Update")],-1))],32)])])])])]))}},q=k(Y,[["__scopeId","data-v-3f63257d"]]);export{q as default};
