| Current Path : /home/users/unlimited/www/ondemand.codeskitter.site/build/static/js/ |
| Current File : /home/users/unlimited/www/ondemand.codeskitter.site/build/static/js/282.dd5feb82.chunk.js |
"use strict";(self.webpackChunkproject=self.webpackChunkproject||[]).push([[282],{33438:(e,s,l)=>{l.d(s,{A:()=>a});var t=l(59662),d=l(70579);const a=(0,t.A)((0,d.jsx)("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}),"Close")},39282:(e,s,l)=>{l.r(s),l.d(s,{default:()=>U});var t=l(96446),d=l(19252),a=l(22698),i=l(85865),r=l(68903),n=l(65043),o=l(72653),c=l(90573),x=l(42518),h=l(83462),u=l(17392),m=l(39336),A=l(44978),p=l(69369),j=l(53193),v=l(74050),g=l(15795),b=l(32143),y=l(51962),f=l(23768),w=l(25581),C=l(36171),k=l(95367),_=l(79456),N=l(4868),S=l(86054),W=l(70579);const q=e=>{let{closeModal:s}=e;const[l,d]=(0,n.useState)(null),[a,o]=(0,n.useState)(1),[c,h]=(0,n.useState)(!1),[u,m]=(0,n.useState)(""),[p,q]=(0,n.useState)("home"),[R,z]=(0,n.useState)(""),[B,D]=(0,n.useState)(""),[I,M]=(0,n.useState)(""),L=(0,_.wA)(),F=async()=>{await C.A.AddAddress({mobile:l,address:R,city_name:null!==u&&void 0!==u&&u.city?null===u||void 0===u?void 0:u.city:I,latitude:null===u||void 0===u?void 0:u.lat,longitude:null===u||void 0===u?void 0:u.lng,area:B,type:p,is_default:a?1:0}).then((async e=>{if(h(!1),e.error)for(let s of Object.keys(e.message))"address"==s&&f.Ay.error("Address is required"),"city_name"==s&&f.Ay.error("City Name is required"),"area"==s&&f.Ay.error("Area/Appartment Name is required"),"mobile"==s&&f.Ay.error("Mobile Number is required");else d(""),await C.A.getAddress().then((e=>{h(!1),L((0,N.vD)(e.data))})).then((e=>{s()}))})).catch((e=>console.log("error",e)))};return(0,n.useEffect)((()=>{}),[L]),(0,W.jsx)("div",{children:(0,W.jsxs)(r.Ay,{container:!0,spacing:3,children:[(0,W.jsxs)(r.Ay,{item:!0,xs:12,md:6,children:[(0,W.jsx)(i.A,{children:(0,A.t)("click_drag_map_pointer")}),(0,W.jsx)(t.A,{sx:{height:"100%",maxHeight:"100%"},children:(0,W.jsx)(k.A,{apiKey:w.cu,onSelectLocation:e=>{m(e)}})})]}),(0,W.jsx)(r.Ay,{item:!0,xs:12,md:6,children:(0,W.jsxs)(t.A,{children:[(0,W.jsx)(i.A,{ml:1,gutterBottom:!0,children:(0,A.t)("provide_additional")}),(0,W.jsxs)(t.A,{display:"flex",flexWrap:"wrap",children:[(0,W.jsxs)("div",{children:[(0,W.jsx)(j.A,{className:"m-1-w-52",sx:{mb:2},fullWidth:!0,variant:"outlined",children:(0,W.jsx)(v.A,{id:"area",value:R,onChange:e=>{z(e.target.value)},required:!0,placeholder:"House/ Flat/ Block"})}),(0,W.jsx)(j.A,{className:"m-1-w-52",sx:{mb:2},fullWidth:!0,variant:"outlined",children:(0,W.jsx)(v.A,{id:"appartment",placeholder:"Appartment/ Road/ Area",value:B,onChange:e=>D(e.target.value)})}),(0,W.jsx)(j.A,{className:"m-1-w-52",sx:{mb:2},fullWidth:!0,variant:"outlined",children:(0,W.jsx)(v.A,{id:"city",placeholder:"City",value:null!==u&&void 0!==u&&u.city?null===u||void 0===u?void 0:u.city:I,onChange:e=>M(e.target.value)})}),(0,W.jsx)(j.A,{className:"m-1-w-52",sx:{mb:2},fullWidth:!0,children:(0,W.jsx)(v.A,{id:"mobile",placeholder:"Mobile no",value:l,type:"tel",required:!0,inputProps:{min:0,maxLength:16,pattern:"[0-9]*"},onChange:e=>{const s=e.target.value.replace(/\D/g,"");((null===s||void 0===s?void 0:s.length)<=16||""===s)&&d(s)}})})]}),(0,W.jsxs)(t.A,{width:"100%",children:[(0,W.jsxs)(g.A,{select:!0,label:"",id:"location-type",className:"m-1-w-52",sx:{mb:2},fullWidth:!0,placeholder:"type",value:p,defaultValue:"home",onChange:e=>q(e.target.value),children:[(0,W.jsx)(b.A,{value:"home",selected:!0,children:(0,A.t)("home")}),(0,W.jsx)(b.A,{value:"office",children:(0,A.t)("office")}),(0,W.jsx)(b.A,{value:"other",children:(0,A.t)("other")})]}),(0,W.jsxs)(t.A,{alignItems:"center",display:"flex",children:[(0,W.jsx)(y.A,{checked:a,onClick:e=>o(!a)}),(0,W.jsx)(i.A,{children:(0,A.t)("default_address")})]})]}),(0,W.jsx)(t.A,{width:"52ch",children:(0,W.jsxs)(x.A,{variant:"contained",color:"primary",onClick:e=>{e.preventDefault(),h(!0),F()},className:"address-btn",fullWidth:!0,disabled:c,children:[c&&(0,W.jsx)(S.A,{}),(0,A.t)("add_address_button")]})})]})]})})]})})};l(76513);const R=()=>{const[e,s]=(0,n.useState)(!1),l=()=>{s(!1)},d=(0,p.u)();return(0,W.jsx)(W.Fragment,{children:(0,W.jsxs)(t.A,{mx:2,children:[(0,W.jsxs)(x.A,{variant:"outlined",className:"mt-3-h-100",fullWidth:!0,onClick:()=>{s(!0)},children:["+",(0,A.t)("add_address")]}),(0,W.jsx)(h.A,{open:e,sx:{zIndex:1101,width:"100%"},maxWidth:"lg",PaperProps:{sx:{overflow:{xs:"auto",sm:"auto",md:"hidden",lg:"hidden",xl:"hidden"}},className:"custom-paper-class"},children:(0,W.jsxs)(t.A,{sx:{background:d.palette.background.box},borderRadius:"10px",padding:1,className:"ddddd",children:[(0,W.jsxs)(t.A,{display:"flex",justifyContent:"space-between",className:"rrrrrr",children:[(0,W.jsx)(i.A,{variant:"h6",children:(0,A.t)("add_address")}),(0,W.jsx)(u.A,{className:"mt-m1",onClick:l,children:(0,W.jsx)(c.A,{})})]}),(0,W.jsx)(m.A,{}),(0,W.jsx)(q,{closeModal:l})]})})]})})};var z=l(26240),B=l(41503),D=l(84289),I=l(5065),M=l(43845),L=l(12220),F=l(71245),O=l(33438),H=l(48177);const P=e=>{var s,l,d,a,o,c,h,k,q;let{open:R,setOpen:z,selectedAddress:B}=e;const D=(0,p.u)(),I=(0,_.wA)(),[M,L]=(0,n.useState)(R),[P,E]=(0,n.useState)(parseFloat(null===(s=B[0])||void 0===s?void 0:s.lattitude)),[T,K]=(0,n.useState)(parseFloat(null===(l=B[0])||void 0===l?void 0:l.longitude)),[V,U]=(0,n.useState)(null===(d=B[0])||void 0===d?void 0:d.address),[G,J]=(0,n.useState)(null===(a=B[0])||void 0===a?void 0:a.city_name),[Q,X]=(0,n.useState)(null===(o=B[0])||void 0===o?void 0:o.mobile),[Y,Z]=(0,n.useState)(null===(c=B[0])||void 0===c?void 0:c.area),[$,ee]=(0,n.useState)(null===(h=B[0])||void 0===h?void 0:h.type.toLowerCase()),[se,le]=(0,n.useState)("1"===(null===(k=B[0])||void 0===k?void 0:k.is_default)||1===(null===(q=B[0])||void 0===q?void 0:q.is_default)),[te,de]=(0,n.useState)(!1),ae=()=>{z(!1),L(!1)},ie={editLatitude:P,editLongitude:T};return(0,W.jsx)(t.A,{children:(0,W.jsx)(F.A,{open:M,onClose:ae,"aria-labelledby":"modal-modal-title","aria-describedby":"modal-modal-description",children:(0,W.jsxs)(t.A,{sx:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:{xs:"90%",md:"60%"},bgcolor:"background.paper",boxShadow:24,borderRadius:"var(--global-border-radius)",p:2},className:"updateAddressModal",children:[(0,W.jsxs)(t.A,{mt:1,display:"flex",justifyContent:"space-between",alignItems:"center",children:[(0,W.jsx)(i.A,{color:D.palette.text.primary,variant:"h6",children:(0,A.t)("update_address")}),(0,W.jsx)(u.A,{onClick:ae,children:(0,W.jsx)(O.A,{})})]}),(0,W.jsx)(m.A,{sx:{width:"100%",mb:3}}),(0,W.jsxs)(r.Ay,{container:!0,spacing:3,children:[(0,W.jsx)(r.Ay,{item:!0,xs:12,md:6,children:(0,W.jsx)(W.Fragment,{children:(0,W.jsx)(H.A,{apiKey:w.cu,onSelectLocation:e=>{let s=null===e||void 0===e?void 0:e.lat,l=null===e||void 0===e?void 0:e.lng;E(s),K(l),Z(null===e||void 0===e?void 0:e.areaName),J(null===e||void 0===e?void 0:e.city)},...ie})})}),(0,W.jsx)(r.Ay,{item:!0,xs:12,md:6,children:(0,W.jsxs)(t.A,{children:[(0,W.jsx)(i.A,{ml:1,gutterBottom:!0,color:D.palette.text.primary,children:(0,A.t)("provide_additional")}),(0,W.jsxs)(t.A,{display:"flex",flexWrap:"wrap",children:[(0,W.jsxs)("div",{children:[(0,W.jsx)(j.A,{className:"m-1-w-52",sx:{mb:2},fullWidth:!0,variant:"outlined",children:(0,W.jsx)(v.A,{id:"area",value:V,onChange:e=>{U(e.target.value)},required:!0,placeholder:"House/ Flat/ Block"})}),(0,W.jsx)(j.A,{className:"m-1-w-52",sx:{mb:2},fullWidth:!0,variant:"outlined",children:(0,W.jsx)(v.A,{id:"appartment",placeholder:"Appartment/ Road/ Area",value:Y,onChange:e=>Z(e.target.value)})}),(0,W.jsx)(j.A,{className:"m-1-w-52",sx:{mb:2},fullWidth:!0,variant:"outlined",children:(0,W.jsx)(v.A,{id:"city",placeholder:"City",value:G,onChange:e=>J(e.target.value)})}),(0,W.jsx)(j.A,{className:"m-1-w-52",sx:{mb:2},fullWidth:!0,children:(0,W.jsx)(v.A,{id:"mobile",placeholder:"Mobile no",value:Q,type:"tel",required:!0,inputProps:{min:0,maxLength:16,pattern:"[0-9]*"},onChange:e=>{const s=e.target.value.replace(/\D/g,"");((null===s||void 0===s?void 0:s.length)<=16||""===s)&&X(s)}})})]}),(0,W.jsxs)(t.A,{width:"100%",children:[(0,W.jsxs)(g.A,{select:!0,label:"",id:"location-type",className:"m-1-w-52",sx:{mb:2},fullWidth:!0,placeholder:"type",value:$,defaultValue:"home",onChange:e=>ee(e.target.value),children:[(0,W.jsx)(b.A,{value:"home",selected:!0,children:(0,A.t)("home")}),(0,W.jsx)(b.A,{value:"office",children:(0,A.t)("office")}),(0,W.jsx)(b.A,{value:"other",children:(0,A.t)("other")})]}),(0,W.jsxs)(t.A,{alignItems:"center",display:"flex",children:[(0,W.jsx)(y.A,{checked:se,onClick:e=>le(!se)}),(0,W.jsx)(i.A,{color:D.palette.text.primary,children:(0,A.t)("default_address")})]})]}),(0,W.jsx)(t.A,{width:"52ch",children:(0,W.jsxs)(x.A,{fullWidth:!0,sx:{mt:2,textTransform:"none"},variant:"contained",color:"primary",onClick:e=>(async()=>{var e;await C.A.AddAddress({id:null===(e=B[0])||void 0===e?void 0:e.id,mobile:Q,address:V,city_id:0,city_name:G,latitude:P,longitude:T,area:Y,type:$,country_code:91,is_default:se?1:0}).then((async e=>{if(de(!1),e.error)for(var s of Object.keys(e.message))"address"===s&&f.Ay.error("Address is required"),"city_name"===s&&f.Ay.error("City Name is required"),"area"===s&&f.Ay.error("Area/Appartment Name is required"),"mobile"===s&&f.Ay.error("Mobile Number is required");else U(""),Z(""),X(""),J(""),await C.A.getAddress().then((e=>{I((0,N.vD)(null===e||void 0===e?void 0:e.data)),de(!1)})).then((e=>{ae()}))})).catch((e=>{f.Ay.error(e.message)}))})(),disabled:!0===te,children:[!0===te?(0,W.jsx)(S.A,{}):"",(0,A.t)("location_update")]})})]})]})})]})]})})})};var E=l(85369);const T=()=>{var e;const[s,l]=(0,n.useState)(null),[d,a]=(0,n.useState)(""),[o,c]=(0,n.useState)(!1),h=null===(e=(0,_.d4)((e=>e.UserAddress)))||void 0===e?void 0:e.address,m=()=>{l(null)},j=(0,_.wA)(),v=(0,p.u)(),g=h&&(null===h||void 0===h?void 0:h.filter((e=>e.id===d)));return(0,n.useEffect)((()=>((async()=>{try{const e=await C.A.getAddress();e.data&&j((0,N.vD)(e.data))}catch(e){console.error("Error fetching address:",e)}})(),()=>{})),[]),(0,W.jsx)(t.A,{sx:{gridTemplateColumns:"repeat(auto-fill, minmax(300px, 1fr))",my:2},width:"100%",alignContent:"center",children:(0,W.jsxs)(r.Ay,{container:!0,width:"100%",spacing:2,children:[(null===h||void 0===h?void 0:h.length)>0?h.map(((e,d)=>(0,W.jsx)(r.Ay,{item:!0,width:"100%",sm:12,md:6,children:(0,W.jsxs)(t.A,{display:"block",sx:{mx:2,maxWidth:"100%",border:"1px solid gray",borderRadius:"5px",p:1},children:[(0,W.jsx)(r.Ay,{container:!0,width:"100%",children:(0,W.jsxs)(r.Ay,{item:!0,xs:!0,width:"100%",sm:12,height:{xs:"auto",sm:"auto",md:"120px"},children:[(0,W.jsxs)(t.A,{display:"flex",alignItems:"center",justifyContent:"space-between",children:[(0,W.jsxs)(t.A,{pl:1,display:"flex",alignItems:"center",children:[(0,W.jsx)(t.A,{children:(0,W.jsx)(i.A,{gutterBottom:!0,variant:"p",component:"div",mb:0,children:e.city_name})}),(0,W.jsx)(t.A,{children:(0,W.jsx)(M.A,{variant:"outlined",size:"small",color:"primary",sx:{width:"auto",ml:1,borderRadius:"5px",borderColor:"gray"},label:e.type})})]}),(0,W.jsxs)(t.A,{display:"flex",alignItems:"center",gap:1,children:[(0,W.jsx)(u.A,{"aria-label":"edit",size:"small",onClick:()=>{c(!0),a(e.id)},sx:{backgroundColor:"green",color:"white",borderRadius:2,"&:hover":{backgroundColor:"green"}},children:(0,W.jsx)(I.A,{sx:{fontSize:"17px"}})},d),(0,W.jsx)(u.A,{"aria-label":"delete",size:"small",sx:{backgroundColor:"red",color:"white",borderRadius:2,"&:hover":{backgroundColor:"red"}},onClick:()=>(e=>{l(e)})(d),children:(0,W.jsx)(E.qbC,{size:20})})]})]}),(0,W.jsxs)(t.A,{textAlign:"left",children:[(0,W.jsxs)(i.A,{color:"text.secondary",variant:"body2",p:1,sx:{wordBreak:"break-word",overflow:{xs:"visible",sm:"visible",md:"hidden"},textOverflow:{xs:"clip",sm:"clip",md:"ellipsis"},display:{xs:"block",sm:"block",md:"-webkit-box"},WebkitLineClamp:{xs:"none",sm:"none",md:"2"},WebkitBoxOrient:{xs:"horizontal",sm:"horizontal",md:"vertical"}},children:[e.address,", ",e.area]}),(0,W.jsx)(i.A,{color:"text.secondary",variant:"body2",p:1,children:e.mobile})]})]})}),(0,W.jsx)(L.A,{open:s===d,sx:{zIndex:1101},children:(0,W.jsxs)(t.A,{sx:{background:v.palette.background.box},p:4,display:"flex",flexDirection:"column",gap:3,children:[(0,W.jsx)(i.A,{textAlign:"center",children:(0,A.t)("delete_address")}),(0,W.jsxs)(t.A,{display:"flex",justifyContent:"center",alignItems:"center",gap:2,children:[(0,W.jsx)(x.A,{onClick:m,children:(0,A.t)("close")}),(0,W.jsx)(x.A,{variant:"contained",color:"error",onClick:()=>(async e=>{await C.A.DeleteAddress({address_id:e}).then((e=>{f.Ay.success(e.message)})).catch((e=>console.log("error",e)));const s=null===h||void 0===h?void 0:h.filter((s=>s.id!==e));j((0,N.vD)(s)),m()})(e.id),children:(0,A.t)("delete")})]})]})})]},d)},e.id))):(0,W.jsx)(t.A,{width:"100%",children:(0,W.jsx)(i.A,{py:4,width:"100%",textAlign:"center",children:(0,A.t)("no_address")})}),!0===o?(0,W.jsx)(W.Fragment,{children:(0,W.jsx)(P,{open:o,setOpen:c,selectedAddress:g})}):""]})})},K=()=>(0,W.jsx)("div",{children:(0,W.jsx)(t.A,{children:(0,W.jsx)(T,{})})});var V=l(7416);const U=()=>{(0,n.useEffect)((()=>{document.title="Profile - Address | HausMate"}),[]);const e=(0,z.A)();return(0,W.jsxs)(D.A,{children:[(0,W.jsx)(t.A,{paddingTop:"35px",paddingBottom:"35px",mt:2,children:(0,W.jsxs)(d.A,{maxWidth:"lg",className:"mainContainer",children:[(0,W.jsxs)(a.A,{separator:"|","aria-label":"breadcrumb",className:"mb-1 mt-1",children:[(0,W.jsx)(V.w1,{to:"/",className:"breadcrumb",sx:{mb:0},children:(0,W.jsx)("strong",{children:(0,A.t)("home")})}),(0,W.jsx)(i.A,{color:"text.primary",children:(0,W.jsx)("strong",{children:(0,A.t)("profile")})})]}),(0,W.jsx)(i.A,{variant:"h4",gutterBottom:!0,sx:{mt:"12px"},children:(0,W.jsx)("strong",{children:(0,A.t)("manage_addresses")})})]})}),(0,W.jsx)(d.A,{className:"mainContainer",sx:{mt:"-40px"},children:(0,W.jsxs)(r.Ay,{container:!0,spacing:3,mb:3,children:[(0,W.jsx)(r.Ay,{item:!0,xs:12,md:4,children:(0,W.jsx)(B.A,{})}),(0,W.jsx)(r.Ay,{item:!0,xs:12,md:8,maxHeight:"100%",children:(0,W.jsxs)(t.A,{sx:{backgroundColor:e.palette.background.box,mb:2},borderRadius:4,mb:2,height:"100%",children:[(0,W.jsxs)(t.A,{sx:{mt:3,bgcolor:e.palette.background.box,borderRadius:"10px",pb:3},children:[(0,W.jsx)(o.A,{heading:(0,A.t)("manage_address")}),(0,W.jsx)(r.Ay,{container:!0,sx:{borderRadius:"10px",mt:2},children:(0,W.jsx)(r.Ay,{item:!0,xs:12,children:(0,W.jsx)(R,{})})})]}),(0,W.jsx)(t.A,{sx:{my:2},children:(0,W.jsx)(K,{})})]})})]})})]})}}}]);
//# sourceMappingURL=282.dd5feb82.chunk.js.map