1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8260],{68260:function(e,a,s){s.r(a);var t=s(85893),n=s(67294),l=s(5616),r=s(96664),i=s(11163),d=s(85574),o=s(82940),c=s(14762),m=s(51649),u=s(66285);s(86455);let x={position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:600,bgcolor:"background.paper",border:"1px solid #000",boxShadow:24,p:4},p=e=>{let{formModelOpen:a,isEditable:s,setIsEditable:p,setCountryEditable:h,setLandmarkEditable:b,landmarkEditable:g,countryEditable:y,countryData:N,setFormModelOpen:j,fetchAddresses:v,activeAddressId:C,newAddressFormData:k,setNewAddressFromData:w,fromManageAddress:f}=e,_=(0,o.b)(),{isMobile:A,isTablet:S}=(0,u.B)(),R=(0,i.useRouter)(),[q,z]=(0,n.useState)(!1),[B,L]=(0,n.useState)({}),T=()=>{j(!1),G(),E("")},[Z,E]=(0,n.useState)(""),{userId:I,token:O,userDetails:P}=(0,n.useContext)(d.UserContext),D=e=>{L(e),z(!0)},U=()=>{z(!1)},[W,F]=(0,n.useState)([]);(0,n.useEffect)(()=>{Array.isArray(k.landmark)&&(F(k.landmark),w(e=>({...e,landmark:""})))},[k.landmark]);let G=()=>{var e;w({name:"",email:null!==(e=k.email)&&void 0!==e?e:"",countryRegion:"",streetAddress:"",landmark:"",townCity:"",state:"",zip:"",phone:"",gstNumber:"",aadhar_no:"",pan_no:""})},H=async function(){var e,a;let s=arguments.length>0&&void 0!==arguments[0]?arguments[0]:C,t={name:k.name,mobile:k.phone,city:k.townCity,address:k.streetAddress,pincode:k.zip,state:k.state,country:k.countryRegion,email:k.email,gst_no:k.gstNumber,aadhar_no:null!==(e=k.aadhar_no)&&void 0!==e?e:"",landmark:k.landmark,pan_no:null!==(a=k.pan_no)&&void 0!==a?a:"",save_address:1,user_id:P.user_id,...s&&{address_id:s}};try{let n=await _.post("".concat(s?"user/updateUserAddress":"user/addUserAddress"),t);n.data&&1===n.data.status&&(D({type:"success",subText:"Address saved Successfully",onConfirm:U,onClose:U,showConfirmButton:!1,showCancelButton:!1,cancelLabel:"close",autoClose:2}),v())}catch(l){D({type:"error",subText:"Something Went Wrong",onConfirm:U,onClose:U,showConfirmButton:!1,showCancelButton:!1,cancelLabel:"close",autoClose:2})}},M=()=>{var e,a;let s=!0,t={};k.name.trim()||(s=!1,t.name="Name is required."),k.email.trim()?/\S+@\S+\.\S+/.test(k.email)||(s=!1,t.email="Email address is invalid."):(s=!1,t.email="Email address is required."),k.countryRegion.trim()||(s=!1,t.countryRegion="Country/Region is required."),k.streetAddress.trim()||(s=!1,t.streetAddress="Street address is required."),k.townCity.trim()||(s=!1,t.townCity="Town/City is required."),k.state.trim()||(s=!1,t.state="State is required."),k.zip.trim()||(s=!1,t.zip="ZIP code is required."),k.phone.trim()||(s=!1,t.phone="Phone number is required."),k.landmark.trim()||(s=!1,t.landmark="landmark is required.");let n=null===(e=k.aadhar_no)||void 0===e?void 0:e.trim();n&&!/^\d{12}$/.test(n)&&(s=!1,t.aadhar_no="Aadhar number must be 12 digits.");let l=null===(a=k.pan_no)||void 0===a?void 0:a.trim();return l&&!/[A-Z]{5}[0-9]{4}[A-Z]{1}/.test(l)&&(s=!1,t.pan_no="PAN number is invalid."),E(t),s},$=async e=>{let{name:a,value:s}=e.target;w(e=>({...e,[a]:s})),"countryRegion"===a&&s&&w(e=>({...e,zip:"",state:"",townCity:"",streetAddress:"",landmark:""}));let t=async e=>{try{let a=await _.post("user/pincodeWiseData",{pincode:e});if(1==a.data.status){let{city_name:s,country_name:t,state_name:n,city_id:l,state_id:r,area_name:i}=a.data.msg.pincode[0];w(e=>({...e,state:n,townCity:s,countryRegion:t,landmark:i}))}}catch(d){}};"zip"===a&&6===s.length&&"India"==k.countryRegion?(t(s),b(!1),p(!1)):(h(!0),b(!0),p(!0))},J=e=>{e.preventDefault(),M()&&(H(),j(!1),G())},K=()=>{let{address_id:e,...a}=R.query;R.push({pathname:R.pathname,query:a},void 0,{shallow:!0}),j(!1)};return(0,t.jsxs)("div",{children:[(0,t.jsx)(r.Z,{open:a,onClose:T,"aria-labelledby":"modal-modal-title","aria-describedby":"modal-modal-description",children:(0,t.jsxs)(l.Z,{sx:x,className:A?"w-full h-full max-w-md overflow-y-scroll":"",children:[(0,t.jsx)("div",{className:"flex justify-end",children:(0,t.jsx)(m.FMH,{onClick:K,className:"h-8 w-8 cursor-pointer"})}),(0,t.jsx)("form",{onSubmit:J,className:"space-y-4 px-3",children:(0,t.jsxs)("div",{className:"space-y-4 px-3",children:[(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"md:col-start-1",children:[(0,t.jsxs)("label",{className:"text-gray-600 mb-2 block",children:["Name ",(0,t.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,t.jsx)("input",{type:"text",name:"name",value:k.name,onChange:$,className:"input-box"}),Z.name&&(0,t.jsx)("p",{className:"text-red-500",children:Z.name})]}),(0,t.jsxs)("div",{className:"md:col-start-2",children:[(0,t.jsxs)("label",{className:"text-gray-600 mb-2 block",children:["Email Address ",(0,t.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,t.jsx)("input",{type:"email",name:"email",value:k.email,onChange:$,className:"input-box"}),Z.email&&(0,t.jsx)("p",{className:"text-red-500",children:Z.email})]})]}),(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"md:col-start-1",children:[(0,t.jsxs)("label",{className:"text-gray-600 mb-2 block",children:["Country/Region ",(0,t.jsx)("span",{className:"text-red-500",children:"*"})]}),y?(0,t.jsxs)("select",{name:"countryRegion",value:k.countryRegion,onChange:$,className:"input-box",children:[(0,t.jsx)("option",{value:"",disabled:!0,children:"Select country"}),N.map((e,a)=>(0,t.jsx)("option",{value:e,children:e},a))]}):(0,t.jsx)("input",{name:"countryRegion",value:k.countryRegion,onChange:$,className:"input-box opacity-70 cursor-not-allowed",readOnly:!0}),Z.countryRegion&&(0,t.jsx)("p",{className:"text-red-500",children:Z.countryRegion})]}),(0,t.jsxs)("div",{className:"md:col-start-2",children:[(0,t.jsxs)("label",{className:"text-gray-600 mb-2 block",children:["Zip Code ",(0,t.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,t.jsx)("input",{type:"text",name:"zip",value:k.zip,onChange:$,className:"input-box",maxLength:"10",pattern:"\\d*",onInput:e=>{"India"===k.countryRegion?e.target.value=e.target.value.replace(/\D/g,"").slice(0,6):e.target.value=e.target.value.replace(/\D/g,"").slice(0,10)}}),Z.zip&&(0,t.jsx)("p",{className:"text-red-500",children:Z.zip})]})]}),(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"md:col-start-1",children:[(0,t.jsxs)("label",{className:"text-gray-600 mb-2 block",children:["State ",(0,t.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,t.jsx)("input",{type:"text",name:"state",value:k.state,onChange:$,className:"input-box ".concat(s?"":"opacity-70 cursor-not-allowed"),readOnly:!s}),Z.state&&(0,t.jsx)("p",{className:"text-red-500",children:Z.state})]}),(0,t.jsxs)("div",{className:"md:col-start-2",children:[(0,t.jsxs)("label",{className:"text-gray-600 mb-2 block",children:["Town/City ",(0,t.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,t.jsx)("input",{type:"text",name:"townCity",value:k.townCity,onChange:$,className:"input-box ".concat(s?"":"opacity-70 cursor-not-allowed"),readOnly:!s}),Z.townCity&&(0,t.jsx)("p",{className:"text-red-500",children:Z.townCity})]})]}),(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"md:col-start-1",children:[(0,t.jsxs)("label",{className:"text-gray-600 mb-2 block",children:["Landmark/Area ",(0,t.jsx)("span",{className:"text-red-500",children:"*"})]}),g?(0,t.jsx)("input",{type:"text",name:"landmark",value:k.landmark,onChange:$,className:"input-box"}):(0,t.jsxs)("select",{name:"landmark",value:k.landmark,onChange:$,className:"input-box ".concat(""),readOnly:!s,children:[(0,t.jsx)("option",{value:"",disabled:!0,children:k.landmark||"Select landmark"}),W.map((e,a)=>(0,t.jsx)("option",{value:e,children:e},a))]}),Z.landmark&&(0,t.jsx)("p",{className:"text-red-500",children:Z.landmark})]}),(0,t.jsxs)("div",{className:"md:col-start-2",children:[(0,t.jsxs)("label",{className:"text-gray-600 mb-2 block",children:["Street Address ",(0,t.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,t.jsx)("input",{type:"text",name:"streetAddress",value:k.streetAddress,onChange:$,className:"input-box"}),Z.streetAddress&&(0,t.jsx)("p",{className:"text-red-500",children:Z.streetAddress})]})]}),(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"md:col-start-1",children:[(0,t.jsxs)("label",{className:"text-gray-600 mb-2 block",children:["Phone Number ",(0,t.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,t.jsx)("input",{type:"text",name:"phone",value:k.phone,onChange:$,className:"input-box"}),Z.phone&&(0,t.jsx)("p",{className:"text-red-500",children:Z.phone})]}),(0,t.jsxs)("div",{className:"md:col-start-2",children:[(0,t.jsx)("label",{className:"text-gray-600 mb-2 block",children:"GST Number "}),(0,t.jsx)("input",{type:"text",name:"gstNumber",value:k.gstNumber,onChange:$,className:"input-box"})]})]}),f&&(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"md:col-start-1",children:[(0,t.jsx)("label",{className:"text-gray-600 mb-2 block",children:"Adhar Number "}),(0,t.jsx)("input",{type:"text",name:"aadhar_no",value:k.aadhar_no,onChange:$,className:"input-box"}),Z.aadhar_no&&(0,t.jsx)("p",{className:"text-red-500",children:Z.aadhar_no})]}),(0,t.jsxs)("div",{className:"md:col-start-2",children:[(0,t.jsx)("label",{className:"text-gray-600 mb-2 block",children:"PAN Number "}),(0,t.jsx)("input",{type:"text",name:"pan_no",value:k.pan_no,onChange:$,className:"input-box"}),Z.pan_no&&(0,t.jsx)("p",{className:"text-red-500",children:Z.pan_no})]})]}),(0,t.jsx)("div",{className:"flex justify-center",children:(0,t.jsx)("button",{type:"submit",className:"bg-primary text-white px-4 py-1 rounded-md",children:"Save"})})]})})]})}),(0,t.jsx)(c.Z,{isOpen:q,type:B.type,title:B.title,subText:B.subText,confirmLabel:B.confirmLabel,cancelLabel:B.cancelLabel,onConfirm:B.onConfirm,showCloseIcon:B.showCloseIcon,onClose:B.onClose,autoClose:B.autoClose,showConfirmButton:B.showConfirmButton,showCancelButton:B.showCancelButton})]})};a.default=p},66285:function(e,a,s){s.d(a,{B:function(){return n}});var t=s(84990);function n(){let e=(0,t.a)("(max-width: 640px)"),a=(0,t.a)("(max-width: 1023px)");return{isMobile:e,isTablet:a}}}}]);
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.