1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2942],{27613:function(e,t,s){(window.__NEXT_P=window.__NEXT_P||[]).push(["/customers/buyer-address",function(){return s(65288)}])},65288:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return _}});var a=s(85893),l=s(59417),n=s(99603),r=s(88446),d=s(41664),i=s.n(d),o=s(67294),c=s(86501),u=s(11163),m=s(34994),x=s(977),h=s(54464),g=s(61839),v=s(48583),y=s(94543),p=s(9008),f=s.n(p),b=function(){var e,t,s,d;let p=(0,u.useRouter)(),{page:b}=p.query,j=(0,v.Dv)(y.ZP);null==j||null===(e=j.userDetails)||void 0===e||e.status;let[_,N]=(0,o.useState)({loading:!1,success:"",error:""}),[w,k]=(0,o.useState)({loading:!1,success:"",error:""}),[S,Z]=(0,o.useState)({id:-1,userid:-1,name:"",email:"",mobile:"",address:"",landMark:"",city:-1,city_name:"",state:-1,state_name:"",country:-1,countryDetails:[{id:-1,name:""}],zipcode:0,gst_number:""}),[D,C]=(0,o.useState)({id:-1,userid:-1,name:"",email:"",mobile:"",address:"",landMark:"",city:-1,city_name:"",state:-1,state_name:"",country:-1,countryDetails:[{id:-1,name:""}],zipcode:-1,gst_number:""}),[z,E]=(0,o.useState)({name:"",email:"",mobile:"",address:"",landMark:"",city:"",city_name:"",state:"",state_name:"",country:"",country_name:"",zipcode:"",gst_number:"",datetime:""}),[F,M]=(0,o.useState)({address:"",city:"",state:"",country:"",zipcode:"",gst_number:""}),[T,A]=(0,o.useState)(0),[L,P]=(0,o.useState)({}),I=async()=>{try{let s=await r.Z.get("/user/viewuser");if((null==s?void 0:s.status)===200){var e,t;if(A(null==s?void 0:null===(e=s.data)||void 0===e?void 0:e.id),P(null==s?void 0:s.data),1!==s.data.email_v&&(null==s?void 0:null===(t=s.data)||void 0===t?void 0:t.mobile_v)!==2){c.ZP.error("You need to verify your email and mobile",{duration:3e3,icon:(0,a.jsx)(n.G,{icon:l.FU$})}),p.push("/customers/profile");return}}N({loading:!1,success:"success",error:""})}catch(e){console.error(e),N({loading:!1,success:"error",error:""})}},U=async()=>{try{let t=await r.Z.post("/shipping_address/getshipping_address_user",{sortDetails:{sortKey:"id",sortType:1},searchDetails:[]}),s=null==t?void 0:t.data.data;for(let t=0;t<s.length;t++)if(2===s[t].status){var e;let a=null===(e=s[t])||void 0===e?void 0:e.address.split("LandMark:");Z({...s[t],address:a[0],landMark:a[1]?a[1]:""}),C(s[t])}N({loading:!1,success:"success",error:""})}catch(e){console.error(e),N({loading:!1,success:"error",error:""})}};(0,o.useEffect)(()=>{I()},[]),(0,o.useEffect)(()=>{U()},[T]);let G=async()=>{try{var e,t,s,a;let l=!1,n={address:"",country_name:"",state_name:"",city_name:"",zipcode:"",gst_number:"",landMark:""};if(n.zipcode="",(null==S?void 0:S.zipcode)===0&&(n.zipcode="required",l=!0),(null===(e=null==S?void 0:null===(t=S.zipcode)||void 0===t?void 0:t.toString())||void 0===e?void 0:e.length)<4&&(n.zipcode="Enter a valid Zipcode",l=!0),n.gst_number="",(null==S?void 0:null===(s=S.gst_number)||void 0===s?void 0:s.length)===0?l=!1:S.gst_number.length>15?(n.gst_number="Enter all 15 character",l=!0):!1===/^([0-9]{2}[A-Z]{5}[0-9]{4}[A-Z]{1}[1-9A-Z]{1}Z[0-9A-Z]{1})$/.test(S.gst_number)&&""!==S.gst_number&&(n.gst_number="Enter a valid GST Number",l=!0),n.address="",(null==S?void 0:S.address.length)===0?(l=!0,n.address="required"):(null==S?void 0:S.address.length)>120&&(l=!0,n.address="only 120 character allowed"),n.landMark="",(null==S?void 0:null===(a=S.landMark)||void 0===a?void 0:a.length)===0&&(l=!0,n.landMark="required"),n.country_name="",0===S.countryDetails[0].name.length&&(n.country_name="required",l=!0),n.state_name="",0===S.state.toString().length&&(n.state_name="required",l=!0),n.city_name="",0===S.city_name.length&&(n.city_name="required",l=!0),E({...z,...n}),l)return!0;return!1}catch(e){console.error(e)}},q=async()=>{try{var e;let t=await G(),s=!1;if(t){k({loading:!1,success:"",error:"Enter all the required fields"});return}for(let e of Object.values(F))if("yes"===e){s=!0;break}if(!1===s){k({loading:!1,success:"",error:"Update the field before clicking update button"});return}k({loading:!0,success:"",error:""});let a={id:null==S?void 0:S.id,userid:null==L?void 0:L.id,name:null==L?void 0:L.name,email:null==L?void 0:L.email,mobile:null==L?void 0:L.mobile,address:"".concat(null==S?void 0:S.address,",LandMark:").concat(null==S?void 0:S.landMark," "),country:null==S?void 0:S.country,country_name:null===(e=null==S?void 0:S.countryDetails[0])||void 0===e?void 0:e.name,state:null==S?void 0:S.state,state_name:null==S?void 0:S.state_name,city:null==S?void 0:S.city,city_name:null==S?void 0:S.city_name,zipcode:null==S?void 0:S.zipcode,gst_number:null==S?void 0:S.gst_number,status:2,datetime:""};if(a.datetime=(0,g.Z)(Date.now(),""),-1!==S.id){let e=await r.Z.post("/shipping_address/editshipping_address",{...a});c.ZP.success("Basic Details Updated successfully"),k({loading:!1,success:"Basic Details updated successfully",error:""}),200===e.status&&("checkoutPage"===b?p.push("/checkout"):p.push("/customers"))}else{let e=await r.Z.post("/shipping_address/insertshipping_address",{...a});c.ZP.success("Basic Details Updated successfully"),k({loading:!1,success:"Basic Details updated successfully",error:""}),200===e.status&&("checkoutPage"===b?p.push("/checkout"):p.push("/customers"))}}catch(e){console.error(e),c.ZP.error("something went wrong:".concat(e)),k({loading:!1,success:"",error:"Unexpected error occured"})}};return(0,a.jsxs)("div",{className:"lg:mx-28",children:[(0,a.jsx)(a.Fragment,{children:(0,a.jsx)(f(),{children:(0,a.jsx)("title",{children:"Permanent Address"})})}),1===L.email_v&&2===L.mobile_v?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"container mx-auto bg-gray-200 h-10 lg:my-3 rounded-md p-2 text-gray-500",children:[(0,a.jsx)(i(),{className:"hover:text-red-700",href:"/",children:"Home"}),"\xa0/\xa0",(0,a.jsx)(i(),{className:"hover:text-red-700",href:"/customers",children:"Dashboard"}),"\xa0/\xa0",(0,a.jsx)(i(),{className:"hover:text-red-700",href:"/customers/buyer-address",children:"Permanent Address"})]}),(0,a.jsxs)("div",{className:"container mx-auto",children:[(0,a.jsx)("div",{className:"border p-3 mt-3 bg-gray-100",children:(0,a.jsx)("h1",{children:"Billing Address"})}),(0,a.jsxs)("div",{className:"border ",children:[(0,a.jsxs)("div",{className:"flex flex-col md:flex-row gap-5 p-5",children:[(0,a.jsxs)("div",{className:"flex flex-col md:w-1/3 ",children:[(0,a.jsxs)("label",{htmlFor:"name",children:["Your Name",(0,a.jsx)("strong",{className:"text-red-500",children:"*"})]}),(0,a.jsx)("input",{className:"bg-gray-200 p-1.5 border outline-none rounded-md focus:border-blue-500 focus:outline-none focus:ring-1",type:"text",name:"name",disabled:!0,value:null==L?void 0:L.name})]}),(0,a.jsxs)("div",{className:"flex flex-col md:w-1/3",children:[(0,a.jsxs)("label",{htmlFor:"email",children:["Your Email",(0,a.jsx)("strong",{className:"text-red-500",children:"*"})]}),(0,a.jsx)("input",{className:"bg-gray-200 p-1.5 outline-none border rounded-md focus:border-blue-500 focus:outline-none focus:ring-1",type:"text",name:"email",disabled:!0,value:null==L?void 0:L.email})]}),(0,a.jsxs)("div",{className:"flex flex-col md:w-1/3",children:[(0,a.jsxs)("label",{htmlFor:"mobile",children:["Mobile",(0,a.jsx)("strong",{className:"text-red-500",children:"*"})]}),(0,a.jsx)("input",{className:"bg-gray-200 p-1.5 outline-none border rounded-md focus:border-blue-500 focus:outline-none focus:ring-1 ",type:"text",name:"mobile",disabled:!0,value:null==L?void 0:L.mobile})]})]}),(0,a.jsxs)("div",{className:"flex flex-col md:flex-row",children:[(0,a.jsxs)("div",{className:"flex flex-col md:w-2/3",children:[(0,a.jsxs)("div",{className:"p-5 ",children:[(0,a.jsxs)("div",{className:"flex justify-center",children:[(0,a.jsxs)("label",{children:["Full Address",(0,a.jsx)("strong",{className:"text-red-500",children:"*"})]}),(null==z?void 0:z.address.length)!==0&&(0,a.jsxs)("div",{className:"text-red-500 text-xs text-end",children:[(0,a.jsx)(n.G,{icon:l.RLE}),(0,a.jsx)("span",{className:"px-1",children:null==z?void 0:z.address})]})]}),(0,a.jsx)("textarea",{className:"p-2 w-full border outline-none focus:border-blue-500 focus:outline-none focus:ring-1",name:"full_address",id:"",rows:3,value:null==S?void 0:S.address,onChange:e=>{let t=e.target.value;Z({...S,address:t}),M({...F,address:"yes"})}}),(0,a.jsxs)("div",{className:"flex flex-col mt-3 gap-x-3 items-center md:flex-row",children:[(0,a.jsxs)("div",{className:"flex justify-center",children:[(0,a.jsxs)("label",{htmlFor:"",children:["Land Mark",(0,a.jsx)("strong",{className:"text-red-500",children:"*"})," "]}),(null==z?void 0:z.landMark.length)!==0&&(0,a.jsxs)("div",{className:"text-red-500 text-xs text-end",children:[(0,a.jsx)(n.G,{icon:l.RLE}),(0,a.jsx)("span",{className:"px-1",children:null==z?void 0:z.landMark})]})]}),(0,a.jsx)("input",{type:"text",value:null==S?void 0:S.landMark,onChange:e=>{let t=e.target.value;Z({...S,landMark:t}),M({...F,landMark:"yes"})},className:"border outline-none rounded-md p-1 "})]})]}),(0,a.jsxs)("div",{className:"flex flex-col md:flex-row gap-5 p-5",children:[(0,a.jsxs)("div",{className:"flex flex-col md:w-1/2 ",children:[(0,a.jsxs)("div",{className:"flex justify-between",children:[(0,a.jsxs)("label",{htmlFor:"zipCode",children:["Pin Code/Zip Code",(0,a.jsx)("strong",{className:"text-red-500",children:"*"})]}),(null==z?void 0:z.zipcode.length)!==0&&(0,a.jsxs)("div",{className:"text-red-500 text-xs text-end",children:[(0,a.jsx)(n.G,{icon:l.RLE}),(0,a.jsx)("span",{className:"px-1",children:null==z?void 0:z.zipcode})]})]}),(0,a.jsx)("input",{className:"p-1.5 border rounded-md focus:border-blue-500 focus:outline-none focus:ring-1",type:"tel",name:"zipCode",value:(null==S?void 0:S.zipcode)!==0?null==S?void 0:S.zipcode:"",onChange:e=>{let t=e.target.value;/[0-9]/.test(t)?Z({...S,zipcode:parseInt(t)}):Z({...S,zipcode:0}),M({...F,zipcode:"yes"})},placeholder:"Enter zip code",maxLength:11})]}),(0,a.jsxs)("div",{className:"flex flex-col md:w-1/2",children:[(0,a.jsxs)("div",{className:"flex justify-between",children:[(0,a.jsx)("label",{htmlFor:"gstin",children:"GSTIN Number"}),(null==z?void 0:z.gst_number.length)!==0&&(0,a.jsxs)("div",{className:"text-red-500 text-xs text-end",children:[(0,a.jsx)(n.G,{icon:l.RLE}),(0,a.jsx)("span",{className:"px-1",children:null==z?void 0:z.gst_number})]})]}),(0,a.jsx)("input",{className:"p-1.5 border rounded-md focus:border-blue-500 focus:outline-none focus:ring-1",type:"text",name:"gstin",value:S.gst_number,onChange:e=>{let t=e.target.value;Z({...S,gst_number:t.toUpperCase()}),M({...F,gst_number:"yes"})},maxLength:15,placeholder:"Enter your GSTIN"})]})]})]}),(0,a.jsxs)("div",{className:"md:w-1/3 px-4 py-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex justify-between",children:[(0,a.jsxs)("label",{htmlFor:"country_id",children:["Country",(0,a.jsx)("strong",{className:"text-red-500",children:"*"})]}),(null===(t=z.country_name)||void 0===t?void 0:t.length)!==0&&(0,a.jsx)("div",{className:"block w-100 text-red-300",children:null==z?void 0:z.country_name})]}),(0,a.jsx)(m.Z,{name:"country_id",onChange:e=>{let t=e.target.value,s=e.target.options[e.target.selectedIndex].getAttribute("data-name"),a=parseInt(t);s&&(Z({...S,country:a,countryDetails:[{id:a,name:s}],state:-1,state_name:"",city:-1,city_name:""}),M({...F,country:"yes"}))},value:null==S?void 0:S.country})]}),(0,a.jsxs)("div",{className:"mt-3",children:[(0,a.jsxs)("div",{className:"flex justify-between",children:[(0,a.jsxs)("label",{htmlFor:"state_id",children:["State",(0,a.jsx)("strong",{className:"text-red-500",children:"*"})]}),(null===(s=z.state_name)||void 0===s?void 0:s.length)!==0&&(0,a.jsx)("div",{className:"block w-100 text-red-500",children:null==z?void 0:z.state_name})]}),(0,a.jsx)(x.Z,{country_id:null==S?void 0:S.country,name:"state_id",onChange:e=>{let t=e.target.value,s=e.target.options[e.target.selectedIndex].getAttribute("data-name"),a=parseInt(t);s&&(Z({...S,state:a,state_name:s,city:-1,city_name:""}),M({...F,state:"yes"}))},value:null==S?void 0:S.state})]}),(0,a.jsxs)("div",{className:"mt-3",children:[(0,a.jsxs)("div",{className:"flex justify-between",children:[(0,a.jsxs)("label",{htmlFor:"city_id",children:["City",(0,a.jsx)("strong",{className:"text-red-500",children:"*"})]}),(null===(d=z.city_name)||void 0===d?void 0:d.length)!==0&&(0,a.jsx)("div",{className:"block w-100 text-red-500",children:null==z?void 0:z.city_name})]}),(0,a.jsx)(h.Z,{country_id:null==S?void 0:S.country,state_id:null==S?void 0:S.state,name:"city_id",onChange:e=>{let t=e.target.value,s=e.target.options[e.target.selectedIndex].getAttribute("data-name"),a=parseInt(t);s&&(Z({...S,city:a,city_name:s}),M({...F,city:"yes"}))},value:null==S?void 0:S.city})]})]})]}),(0,a.jsx)("div",{className:"text-center p-3 ".concat(""!==w.success?"text-green-500":"text-red-500"," "),children:!0===w.loading?(0,a.jsx)(a.Fragment,{children:"Loading..."}):""!==w.success?(0,a.jsx)(a.Fragment,{children:w.success}):""!==w.error?(0,a.jsx)(a.Fragment,{children:w.error}):null}),(0,a.jsx)("div",{className:" flex justify-end p-3",children:(0,a.jsxs)("button",{onClick:()=>{q()},className:"border rounded-lg p-2 bg-blue-400 text-white",children:["Save Billing Address"," ",(0,a.jsx)(n.G,{className:"text-white",icon:l.eFW})]})})]})]})]}):(0,a.jsx)("h1",{className:"text-center text-xl",children:"You need to Verify your email and mobile"})]})},j=s(28646),_=()=>{let e=(0,v.Dv)(y.ZP);return e.loading?(0,a.jsx)("p",{className:"md:mx-28 text-center p-5",children:"Loading..."}):e.isLoggedIn?(0,a.jsx)(b,{}):(0,a.jsx)(j.Z,{})}},28646:function(e,t,s){"use strict";var a=s(85893),l=s(41664),n=s.n(l),r=s(11163);s(67294),t.Z=()=>{let e=(0,r.useRouter)(),t=e.asPath;return(0,a.jsxs)("div",{className:"md:mx-28 text-center text-red-500 p-10 bg-gray-100 text-xl",children:["Your are not Logged in to use this functionality .......! ",(0,a.jsx)("br",{}),(0,a.jsx)(n(),{className:"text-blue-500",href:"/login?re_url=".concat(t),children:"Click here to Login"})]})}},54464:function(e,t,s){"use strict";var a=s(85893),l=s(88446),n=s(67294);let r=(e,t)=>
1{let[s,a]=(0,n.useState)([]),[r,d]=(0,n.useState)(!1);return(0,n.useEffect)(()=>{d(!0);let t=async()=>{try{e&&await l.Z.post("/world_city/getworld_city",{page_enabled:"n",page:1,limit:100,sortDetails:{sortKey:"id",sortType:1},searchDetails:[{basicSearchKey:"state_id",basicSearchValue:e,basicSearchType:"number"}],searchDetailsAnd:[],searchQuery:""}).then(e=>{var t;a(null===(t=e.data)||void 0===t?void 0:t.data)}).catch(()=>{a([])}).finally(()=>{d(!1)})}catch(e){console.error(e)}};t()},[t,e,a,d]),{data:s,loading:r}};t.Z=e=>{let{country_id:t,state_id:s,value:l,...n}=e,{data:d,loading:i}=r(s,t);return(0,a.jsxs)("select",{value:l,...n,className:"shadow appearance-none text-sm border-gray-200 rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline",disabled:i,children:[(0,a.jsxs)("option",{value:-1,children:[" ",i?"loading...":"Select city"]}),d.map(e=>(0,a.jsx)("option",{value:e.id,"data-name":e.name,children:[e.name]},e.id))]})}},34994:function(e,t,s){"use strict";var a=s(85893),l=s(88446),n=s(67294);t.Z=e=>{let[t,s]=(0,n.useState)([]);return(0,n.useEffect)(()=>{let e=async()=>{try{var e;let t=await l.Z.post("/world_country/getworld_country",{page_enabled:"n",page:1,limit:10,sortDetails:{sortKey:"name",sortType:1},searchDetails:[]});s(null==t?void 0:null===(e=t.data)||void 0===e?void 0:e.data)}catch(e){console.error("Error",e)}};e()},[]),(0,a.jsx)(a.Fragment,{children:(0,a.jsxs)("select",{...e,className:"shadow appearance-none text-sm border-gray-200 rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline ",children:[(0,a.jsx)("option",{value:"-1",children:"Select Country"}),t.map((e,t)=>(0,a.jsx)("option",{value:e.id,"data-name":e.name,children:[e.name]},e.id))]})})}},977:function(e,t,s){"use strict";var a=s(85893),l=s(88446),n=s(67294);let r=e=>{let[t,s]=(0,n.useState)([]),[a,r]=(0,n.useState)(!1);return(0,n.useEffect)(()=>{r(!0),e&&l.Z.post("world_state/getworld_state",{page_enabled:"n",page:1,limit:25,sortDetails:{sortKey:"123",sortType:-1},searchDetails:[{basicSearchKey:"country_id",basicSearchValue:e,basicSearchType:"number"}]}).then(e=>{let{data:t}=e;s(null==t?void 0:t.data)}).catch(()=>{s([])}).finally(()=>{r(!1)})},[e,s,r]),{data:t,loading:a}};t.Z=e=>{let{country_id:t,value:s,...l}=e,{data:n,loading:d}=r(t);return(0,a.jsxs)("select",{value:s,...l,disabled:d,className:"shadow appearance-none text-sm border-gray-200 rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline",children:[(0,a.jsx)("option",{value:-1,children:d?"loading...":"Select State"}),n.map(e=>(0,a.jsx)("option",{value:e.id,"data-name":e.name,children:[e.name]},e.id))]})}},61839:function(e,t,s){"use strict";var a=s(30120);t.Z=(e,t)=>{try{if(!e)return"Date does not exist";let s=new Date(e),l=s.valueOf();if("number"!=typeof l||isNaN(l))return"Invalid Date";let n={year:s.getUTCFullYear(),month:s.getUTCMonth(),date:s.getUTCDate(),hours:s.getUTCHours(),minutes:s.getUTCMinutes(),seconds:s.getUTCSeconds()},r=a.ou.fromObject({year:n.year,month:n.month+1,day:n.date,hour:n.hours,minute:n.minutes,second:n.seconds});if(t.length>0)return r.setZone("Asia/Kolkata").toFormat(t).toString();return r.setZone("Asia/Kolkata").toString()}catch(e){return console.error(e),"Invalid Date"}}},9008:function(e,t,s){e.exports=s(42636)}},function(e){e.O(0,[120,9774,2888,179],function(){return e(e.s=27613)}),_N_E=e.O()}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.