1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9212],{88762:function(e,a,l){(window.__NEXT_P=window.__NEXT_P||[]).push(["/customers/upload-document",function(){return l(72312)}])},72312:function(e,a,l){"use strict";l.r(a),l.d(a,{default:function(){return _}});var s=l(85893),t=l(28646),r=l(59417),n=l(99603),d=l(88446),i=l(41664),o=l.n(i),c=l(67294),u=l(86501),p=l(29552),x=l(61839),m=l(11163),f=l(9008),h=l.n(f),g=()=>{var e;let a=(0,m.useRouter)(),[l,t]=(0,c.useState)({loading:!1,success:"",error:""}),[i,f]=(0,c.useState)({loading:!1,success:"",error:""}),[g,v]=(0,c.useState)({id:-1,user_name:"",passport_details:"",passport_upload:"",bank_details:"",bank_upload:"",aadhaar_details:"",aadhaar_upload:"",other_details:"",other_upload:"",pan_details:"",pan_upload:"",email_v:-1,mobile_v:-1}),[j,_]=(0,c.useState)({passport_details:"",passport_upload:"",bank_details:"",bank_upload:"",aadhaar_details:"",aadhaar_upload:"",other_details:"",other_upload:"",pan_details:"",pan_upload:""}),[y,N]=(0,c.useState)({pan:"",aadhar:"",passport:"",other:"",bank:""}),[b,w]=(0,c.useState)({}),[k,C]=(0,c.useState)({}),[U,F]=(0,c.useState)({}),[R,P]=(0,c.useState)({}),[D,L]=(0,c.useState)({}),[Z,E]=(0,c.useState)(!1),S=(0,c.useRef)(null),T=(0,c.useRef)(null),I=(0,c.useRef)(null),O=(0,c.useRef)(null),A=(0,c.useRef)(null),G=async()=>{try{var e;let l=await d.Z.get("/user/viewuser");v(null==l?void 0:l.data),(null==l?void 0:null===(e=l.data)||void 0===e?void 0:e.email_v)!==1&&(u.ZP.error("You need to verify your email",{duration:3e3,icon:(0,s.jsx)(n.G,{icon:r.FU$})}),a.push("/customers/profile")),t({loading:!1,success:"success",error:""})}catch(e){console.error(e),t({loading:!1,success:"error",error:""})}};(0,c.useEffect)(()=>{G()},[Z]);let B=async()=>{try{let e=!1,a={passport_details:"",passport_upload:"",bank_details:"",bank_upload:"",aadhaar_details:"",aadhaar_upload:"",other_details:"",other_upload:"",pan_details:"",pan_upload:""};if(a.pan_details="",0===g.pan_details.length?(a.pan_details="required",e=!0):g.pan_details.length<10?(a.pan_details="Pan Card number should have 10 character",e=!0):/^[A-Z]{5}[0-9]{4}[A-Z]{1}$/.test(g.pan_details)||(a.pan_details="Enter a valid Pan Card no",e=!0),a.aadhaar_details="",0===g.aadhaar_details.length?(a.aadhaar_details="required",e=!0):/^[0-9]{12}$/.test(g.aadhaar_details)||(a.aadhaar_details="Enter a Valid Aadhar number!",e=!0),a.passport_details="",g.passport_details.length>20&&(a.passport_details="Only allow 20 digits.",e=!0),a.other_details="",g.other_details.length>=20&&(a.other_details="Only allow 20 digits",e=!0),_({...j,...a}),e)return!0;return!1}catch(e){console.error(e)}},K=async e=>{let{imageType:a,selectedFilesRaw:l}=e;try{if(!l)return!1;if("object"!=typeof l)return u.ZP.error("Please select at least one file"),!1;let e=[];for(let a=0;a<l.length;a++){let s=l[a],t="";if(0===s.size&&(t="For file "+s.name+", is empty."),""===t&&("image/jpeg"===s.type||"image/png"===s.type||(t="For file ".concat(s.name,", It can be jpeg, jpg, or png extension."))),""!==t)return u.ZP.error(t),!1;e.push(l[a])}if(!1===Array.isArray(e)||0===e.length)return u.ZP.error("Please select at least one file"),!1;let s=u.ZP.loading("File uploading..."),t=new FormData;t.append("uploadFile",e[0]);let r=await d.Z.post("/upload-file-client/uploadTempFile",t,{headers:{"Content-Type":"multipart/form-data"}});if(200!==r.status)return u.ZP.error("File upload failed"),!1;{let e=await d.Z.post("/upload-file-client/userMoveFileForUploadDocuments",{imageType:a,objectKey:r.data.data.objectKey});if(200===e.status)return u.ZP.success("Uploaded file successfully."),u.ZP.dismiss(s),{fileName:e.data.data.fileName,status:"Success"};return u.ZP.error("Something happened while uploading"),!1}}catch(e){return console.error("Error during file upload:",e),u.ZP.error("An error occurred while uploading the file"),!1}},$=async()=>{try{let e=await B();if(e){f({loading:!1,success:"",error:"Enter all the required fields"});return}f({loading:!0,success:"",error:""});let a={pan_details:g.pan_details,pan_upload:g.pan_upload,passport_details:g.passport_details,passport_upload:g.passport_upload,bank_details:g.bank_details,bank_upload:g.bank_upload,aadhaar_details:g.aadhaar_details,aadhaar_upload:g.aadhaar_upload,other_details:g.other_details,other_upload:g.other_upload,datetime:""};if(a.datetime=(0,x.Z)(Date.now(),""),b.length>
1=1&&b){let e=await K({imageType:"pan_card_image",selectedFilesRaw:b});e&&(a.pan_upload=null==e?void 0:e.fileName)}if(k.length>=1&&k){let e=await K({imageType:"aadhar_card_image",selectedFilesRaw:k});e&&(a.aadhaar_upload=null==e?void 0:e.fileName)}if(U.length>=1&&U){let e=await K({imageType:"passport_image",selectedFilesRaw:U});e&&(a.passport_upload=null==e?void 0:e.fileName)}if(R.length>=1&&R){let e=await K({imageType:"gst_detail",selectedFilesRaw:R});e&&(a.other_upload=null==e?void 0:e.fileName)}if(D.length>=1&&D){let e=await K({imageType:"bank_detail",selectedFilesRaw:D});e&&(a.bank_upload=null==e?void 0:e.fileName)}await d.Z.post("/user/edituser",{...a}).then(()=>{E(e=>!e),u.ZP.success("Profile Update successfully"),N({pan:"",aadhar:"",passport:"",other:"",bank:""}),f({loading:!1,success:"profile updated successfully",error:""})})}catch(e){console.error(e),u.ZP.error("something went wrong"),f({loading:!1,success:"",error:"Unexpected error occured"})}};return(0,s.jsxs)("div",{className:"lg:mx-28 ",children:[(0,s.jsx)(s.Fragment,{children:(0,s.jsx)(h(),{children:(0,s.jsx)("title",{children:"Upload Documents"})})}),(0,s.jsxs)("div",{className:"container grid mx-auto ",children:[(0,s.jsxs)("div",{className:"container mx-auto bg-gray-200 h-10 lg:my-3 rounded-md p-2 text-gray-500",children:[(0,s.jsx)(o(),{className:"hover:text-red-700",href:"/",children:"Home"}),"\xa0/\xa0",(0,s.jsx)(o(),{className:"hover:text-red-700",href:"/customers",children:"Dashboard"}),"\xa0/\xa0",(0,s.jsx)(o(),{className:"hover:text-red-700",href:"/customers/upload-document",children:"Upload Document"})]}),1===g.email_v&&(0,s.jsxs)("div",{children:[(0,s.jsx)("h1",{className:"text-2xl p-3 text-red-600",children:"To become a vendor, Please upload your documents."}),(0,s.jsxs)("div",{className:"border mt-3",children:[(0,s.jsx)("div",{className:"border-b p-3",children:(0,s.jsx)("h1",{children:"Upload Documents"})}),(0,s.jsxs)("div",{className:"mt-5 grid grid-cols-1 justify-center lg:justify-end lg:grid-cols-2 ",children:[(0,s.jsxs)("div",{className:(null==y?void 0:y.pan)?"flex flex-col md:flex-row md:justify-around md:px-20":(null==g?void 0:g.pan_upload)?" flex flex-col md:flex-row md:justify-around md:px-20 ":"",children:[(0,s.jsxs)("div",{className:"flex flex-col lg:w-[230px] p-3 gap-y-2",children:[(0,s.jsxs)("label",{htmlFor:"panFile",children:[(0,s.jsx)("strong",{children:"Pan Card"})," only jpg, png format"," ",(0,s.jsx)("strong",{className:"text-red-500",children:"*"})]}),(0,s.jsx)("input",{className:"max-w-min file:bg-gray-200 file:hover:bg-gray-300 file:cursor-pointer file:border-none file:text-gray-700 file:hover:translate-y-[.05rem] file:rounded-md file:p-2",type:"file",name:"panFile",ref:S,accept:"image/*",onChange:e=>{let a=e.target.files;a&&(w(a),N({...y,pan:URL.createObjectURL(a[0])}))}}),(0,s.jsx)("div",{className:"text-end",children:(null==j?void 0:j.pan_details.length)!==0&&(0,s.jsxs)("div",{className:"text-red-500 text-xs text-end",children:[(0,s.jsx)(n.G,{icon:r.RLE}),(0,s.jsx)("span",{className:"px-1",children:null==j?void 0:j.pan_details})]})}),(0,s.jsx)("input",{value:g.pan_details,maxLength:10,onChange:e=>{let a=e.target.value;v({...g,pan_details:a.toUpperCase()})},className:"border p-2 rounded-md outline-none".concat((null==g?void 0:null===(e=g.pan_details)||void 0===e?void 0:e.length)===10?" focus:border-green-500 focus:outline-none focus:ring-1":" focus:border-red-500 focus:outline-none focus:ring-1"),type:"text",name:"panInput",placeholder:"Enter your PAN card Details"})]}),(null==y?void 0:y.pan)?(0,s.jsxs)("div",{className:"p-3 flex flex-col justify-center space-y-2 md:flex-none md:p-5",children:[(0,s.jsx)("img",{className:"w-32",src:null==y?void 0:y.pan,alt:""}),(0,s.jsx)("div",{className:"flex justify-center",children:(0,s.jsx)("button",{onClick:()=>{S.current.value="",N({...y,pan:""})},className:"p-2 bg-red-500 text-white rounded-lg",children:"remove"})})]}):(0,s.jsx)("div",{className:"p-3 flex justify-center space-x-2 md:flex-none md:p-5",children:(0,s.jsx)("img",{className:"w-32",src:"".concat(p.Z.CDN_URL_PUBLIC,"/uploads/users/").concat(null==g?void 0:g.id,"/").concat(null==g?void 0:g.pan_upload),alt:""})})]}),(0,s.jsxs)("div",{className:(null==y?void 0:y.aadhar)?"flex flex-col md:flex-row md:justify-around md:px-20 ":(null==g?void 0:g.aadhaar_upload)?"container flex flex-col md:flex-row md:justify-around md:px-20 ":"",children:[(0,s.jsxs)("div",{className:"flex flex-col lg:w-[230px] p-3 gap-y-2",children:[(0,s.jsxs)("label",{htmlFor:"aadharFile",children:[(0,s.jsx)("strong",{children:"Aadhaar Details"})," only jpg, png format"," ",(0,s.jsx)("strong",{className:"text-red-500",children:"*"})]}),(0,s.jsx)("input",{className:"max-w-min file:bg-gray-200 file:hover:bg-gray-300 file:cursor-pointer file:text-gray-700 file:hover:translate-y-[.05rem] file:border-none file:rounded-md file:p-2",type:"file",multiple:!0,ref:T,accept:"image/*",name:"aadharFile",onChange:e=>{let a=e.target.files;a&&(C(a),N({...y,aadhar:URL.createObjectURL(a[0])}))}}),(0,s.jsx)("div",{className:"text-end",children:(null==j?void 0:j.aadhaar_details.length)!==0&&(0,s.jsxs)("div",{className:"text-red-500 text-xs text-end",children:[(0,s.jsx)(n.G,{icon:r.RLE}),(0,s.jsx)("span",{className:"px-1",children:null==j?void 0:j.aadhaar_details})]})}),(0,s.jsx)("input",{className:"border p-2 rounded-md outline-none focus:border-blue-500 focus:outline-none focus:ring-1",type:"text",name:"aadharInput",value:g.aadhaar_details,onChange:e=>{let a=e.target.value;v({...g,aadhaar_details:a})},placeholder:"Enter your A card Details"})]}),(null==y?void 0:y.aadhar)?(0,s.jsxs)("div",{className:"p-3 flex flex-col justify-center space-y-2 md:flex-none md:p-5",children:[(0,s.jsx)("img",{className:"w-32",src:null==y?void 0:y.aadhar,alt:""}),(0,s.jsx)("div",{className:"flex justify-center ",children:(0,s.jsx)("button",{onClick:()=>{T.current.value="",N({...y,aadhar:""})},className:"p-2 bg-red-500 text-white rounded-lg",children:"remove"})})]}):(0,s.jsx)("div",{className:"p-3 flex justify-center space-x-2 md:flex-none md:p-5",children:(0,s.jsx)("img",{className:"w-32",src:"".concat(p.Z.CDN_URL_PUBLIC,"/uploads/users/").concat(null==g?void 0:g.id,"/").concat(null==g?void 0:g.aadhaar_upload),alt:""})})]}),(0,s.jsxs)("div",{className:(null==y?void 0:y.passport)?"flex flex-col md:flex-row md:justify-around md:px-20 ":(null==g?void 0:g.passport_upload)?"flex flex-col md:flex-row md:justify-around md:px-20 ":"",children:[(0,s.jsxs)("div",{className:"flex flex-col lg:w-[230px] p-3 gap-y-2",children:[(0,s.jsxs)("label",{htmlFor:"passportFile",children:[(0,s.jsx)("strong",{children:"Passport Details"})," only jpg, png format"," "]}),(0,s.jsx)("input",{className:"max-w-min file:bg-gray-200 file:hover:bg-gray-300 file:text-gray-700 file:hover:translate-y-[.05rem] file:cursor-pointer file:border-none file:rounded-md file:p-2",type:"file",multiple:!0,ref:I,accept:"image/*",name:"passportFile",onChange:e=>{let a=e.target.files;a&&(F(a),N({...y,passport:URL.createObjectURL(a[0])}))}}),(0,s.jsx)("div",{className:"text-end",children:(null==j?void 0:j.passport_details.length)!==0&&(0,s.jsxs)("div",{className:"text-red-500 text-xs text-end",children:[(0,s.jsx)(n.G,{icon:r.RLE}),(0,s.jsx)("span",{className:"px-1",children:null==j?void 0:j.passport_details})]})}),(0,s.jsx)("input",{className:"border p-2 rounded-md outline-none focus:border-blue-500 focus:outline-none focus:ring-1",type:"text",name:"passportInput",value:null==g?void 0:g.passport_details,onChange:e=>{let a=e.target.value;v({...g,passport_details:a})},placeholder:"Enter your Passport Details"})]}),(null==y?void 0:y.passport)?(0,s.jsxs)("div",{className:"p-3 flex flex-col justify-center space-y-2 md:flex-none md:p-5",children:[(0,s.jsx)("img",{className:"w-32",src:null==y?void 0:y.passport,alt:""}),(0,s.jsx)("div",{className:"flex justify-center",children:(0,s.jsx)("button",{onClick:()=>{I.current.value="",N({...y,passport:""})},className:"p-2 bg-red-500 text-white rounded-lg",children:"remove"})})]}):(0,s.jsx)("div",{className:"p-3 flex justify-center space-x-2 md:flex-none md:p-5",children:(0,s.jsx)("img",{className:"w-32",src:"".concat(p.Z.CDN_URL_PUBLIC,"/uploads/users/").concat(null==g?void 0:g.id,"/").concat(null==g?void 0:g.passport_upload),alt:""})})]}),(0,s.jsxs)("div",{className:(null==y?void 0:y.other)||(null==g?void 0:g.other_upload)?"flex flex-col md:flex-row md:justify-around md:px-20 ":"",children:[(0,s.jsxs)("div",{className:"flex flex-col lg:w-[230px] p-3 gap-y-2",children:[(0,s.jsxs)("label",{htmlFor:"gstFile",children:[(0,s.jsx)("strong",{children:"GST Details/Other Details"})," only jpg, png format"," "]}),(0,s.jsx)("input",{className:" max-w-min file:bg-gray-200 file:text-gray-700 file:hover:bg-gray-300 file:hover:translate-y-[.05rem] file:cursor-pointer file:border-none file:rounded-md file:p-2",type:"file",ref:O,accept:"image/*",name:"gstFile",onChange:e=>{let a=e.target.files;a&&(P(a),N({...y,other:URL.createObjectURL(a[0])}))}}),(0,s.jsx)("div",{className:"text-end",children:(null==j?void 0:j.other_details.length)!==0&&(0,s.jsxs)("div",{className:"text-red-500 text-xs text-end",children:[(0,s.jsx)(n.G,{icon:r.RLE}),(0,s.jsx)("span",{className:"px-1",children:null==j?void 0:j.other_details})]})}),(0,s.jsx)("input",{className:"border p-2 rounded-md outline-none focus:border-blue-500 focus:outline-none focus:ring-1",type:"text",name:"gstInput",value:null==g?void 0:g.other_details,onChange:e=>{let a=e.target.value;v({...g,other_details:a})},placeholder:"Enter your GST Details/Other Details"})]}),(null==y?void 0:y.other)?(0,s.jsxs)("div",{className:"p-3 flex flex-col justify-center space-y-2 md:flex-none md:p-5",children:[(0,s.jsx)("img",{className:"w-32",src:null==y?void 0:y.other,alt:""}),(0,s.jsx)("div",{className:"flex justify-center",children:(0,s.jsx)("button",{onClick:()=>{O.current.value="",N({...y,other:""})},className:"p-2 bg-red-500 text-white rounded-lg",children:"remove"})})]}):(0,s.jsx)("div",{className:"p-3 flex justify-center space-x-2 md:flex-none md:p-5",children:(0,s.jsx)("img",{className:"w-32",src:"".concat(p.Z.CDN_URL_PUBLIC,"/uploads/users/").concat(null==g?void 0:g.id,"/").concat(null==g?void 0:g.other_upload),alt:""})})]})]}),(0,s.jsxs)("div",{className:(null==y?void 0:y.bank)?"flex flex-col md:flex-row md:justify-around md:px-20 ":(null==g?void 0:g.bank_upload)?"flex flex-col md:flex-row md:justify-around md:px-20 ":"",children:[(0,s.jsxs)("div",{className:"flex flex-col w-full p-3 gap-y-2",children:[(0,s.jsxs)("label",{htmlFor:"panFile",children:[(0,s.jsx)("strong",{children:"Bank Details"})," only jpg, png format"," "]}),(0,s.jsx)("input",{className:"max-w-min file:bg-gray-200 file:text-gray-700 file:hover:translate-y-[.05rem] file:hover:bg-gray-300 file:cursor-pointer file:border-none file:rounded-md file:p-2",type:"file",ref:A,accept:"image/*",onChange:e=>{let a=e.target.files;a&&(L(a),N({...y,bank:URL.createObjectURL(a[0])}))}}),(0,s.jsx)("div",{className:"text-end",children:(null==j?void 0:j.bank_details.length)!==0&&(0,s.jsxs)("div",{className:"text-red-500 text-xs text-end",children:[(0,s.jsx)(n.G,{icon:r.RLE}),(0,s.jsx)("span",{className:"px-1",children:null==j?void 0:j.bank_details})]})}),(0,s.jsx)("textarea",{className:"border p-2 rounded-md outline-none focus:border-blue-500 focus:outline-none focus:ring-1",name:"",id:"",rows:3,value:null==g?void 0:g.bank_details,onChange:e=>{let a=e.target.value;v({...g,bank_details:a})},placeholder:"Enter your Bank Details"})]}),y.bank?(0,s.jsxs)("div",{className:"p-3 flex justify-center space-x-2 md:flex-none md:p-5",children:[(0,s.jsx)("img",{className:"w-32",src:null==y?void 0:y.bank,alt:""}),(0,s.jsx)("div",{className:"flex items-center",children:(0,s.jsx)("button",{onClick:()=>{A.current.value="",N({...y,bank:""})},className:"p-2 bg-red-500 text-white rounded-lg",children:"remove"})})]}):(0,s.jsx)("div",{className:"p-3 flex justify-center space-x-2 md:flex-none md:p-5",children:(0,s.jsx)("img",{className:"w-32",src:"".concat(p.Z.CDN_URL_PUBLIC,"/uploads/users/").concat(null==g?void 0:g.id,"/").concat(null==g?void 0:g.bank_upload),alt:""})})]}),(0,s.jsx)("div",{className:"p-3",children:(0,s.jsxs)("button",{onClick:$,className:"p-2 border rounded-md bg-green-500 text-white hover:bg-green-600",children:[(0,s.jsx)(n.G,{icon:r.cf$})," Save Details"]}
1)})]})]})]})]})},v=l(94543),j=l(48583),_=()=>{let e=(0,j.Dv)(v.ZP);return e.loading?(0,s.jsx)("p",{className:"md:mx-28 text-center p-5",children:"Loading..."}):e.isLoggedIn?(0,s.jsx)(g,{}):(0,s.jsx)(t.Z,{})}},28646:function(e,a,l){"use strict";var s=l(85893),t=l(41664),r=l.n(t),n=l(11163);l(67294),a.Z=()=>{let e=(0,n.useRouter)(),a=e.asPath;return(0,s.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,s.jsx)("br",{}),(0,s.jsx)(r(),{className:"text-blue-500",href:"/login?re_url=".concat(a),children:"Click here to Login"})]})}},61839:function(e,a,l){"use strict";var s=l(30120);a.Z=(e,a)=>{try{if(!e)return"Date does not exist";let l=new Date(e),t=l.valueOf();if("number"!=typeof t||isNaN(t))return"Invalid Date";let r={year:l.getUTCFullYear(),month:l.getUTCMonth(),date:l.getUTCDate(),hours:l.getUTCHours(),minutes:l.getUTCMinutes(),seconds:l.getUTCSeconds()},n=s.ou.fromObject({year:r.year,month:r.month+1,day:r.date,hour:r.hours,minute:r.minutes,second:r.seconds});if(a.length>0)return n.setZone("Asia/Kolkata").toFormat(a).toString();return n.setZone("Asia/Kolkata").toString()}catch(e){return console.error(e),"Invalid Date"}}},9008:function(e,a,l){e.exports=l(42636)}},function(e){e.O(0,[120,9774,2888,179],function(){return e(e.s=88762)}),_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.