1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[304],{49284:function(e,t,a){(window.__NEXT_P=window.__NEXT_P||[]).push(["/upload-image",function(){return a(98568)}])},98568:function(e,t,a){"use strict";a.r(t),a.d(t,{default:function(){return y}});var i=a(85893),s=a(59417),l=a(99603),r=a(67294),n=a(11876),o=a(88446),c=a(86501),d=a(11163),m=a(9008),u=a.n(m),p=a(75052),x=()=>{let[e,t]=(0,r.useState)(!1),a=(0,r.useRef)(null),m=(0,r.useRef)(null),[x,g]=(0,r.useState)(0),[h,f]=(0,r.useState)([]),[v,y]=(0,r.useState)([]),[b,j]=(0,r.useState)(!1),[_,N]=(0,r.useState)(!1),[w,P]=(0,r.useState)(!1),F=(0,d.useRouter)(),{order_id:k}=F.query,[Z,E]=(0,r.useState)({status:"",no_of_items:0,unit_price:0,sub_total:0,tax:0,gst:0,grand_total:0}),[A,C]=(0,r.useState)(!0);(0,r.useEffect)(()=>{let e=async()=>{try{var e,t,a;if(!k){C(!1);return}let i=await o.Z.post("/payment/checkstatus_kbc",{orderId:Number(k)}).catch(e=>{var t,a,i,s,l,r,n,o,c,d;(null===(t=e.response)||void 0===t?void 0:t.status)===400&&((null==e?void 0:null===(a=e.response)||void 0===a?void 0:null===(i=a.data)||void 0===i?void 0:i.status)==="Aborted"?(E(null==e?void 0:null===(o=e.response)||void 0===o?void 0:o.data),j(!0)):(null==e?void 0:null===(s=e.response)||void 0===s?void 0:null===(l=s.data)||void 0===l?void 0:l.status)==="Failure"?(E(null==e?void 0:null===(c=e.response)||void 0===c?void 0:c.data),N(!0)):(null==e?void 0:null===(r=e.response)||void 0===r?void 0:null===(n=r.data)||void 0===n?void 0:n.status)==="Timeout"&&(E(null==e?void 0:null===(d=e.response)||void 0===d?void 0:d.data),P(!0)))});(null==i?void 0:null===(e=i.data)||void 0===e?void 0:e.status)==="Success"&&(g(null==i?void 0:null===(t=i.data)||void 0===t?void 0:t.no_of_items),f(Array.from({length:null==i?void 0:null===(a=i.data)||void 0===a?void 0:a.no_of_items},(e,t)=>({imagesFront:[],imagesBack:[],estimatePrice:"",description:""}))))}catch(e){console.error("Error fetching collectibles:",e)}finally{C(!1)}};e()},[k]);let S=()=>(0,p.Z)({total_amount:null==Z?void 0:Z.grand_total,no_collect:null==Z?void 0:Z.no_of_items,group_category:0,payment_type:"original",payment_details:{order_id:Number(k)},price:null==Z?void 0:Z.sub_total,gst:null==Z?void 0:Z.gst,gstAmount:null==Z?void 0:Z.tax,singleUnitPrice:null==Z?void 0:Z.unit_price}),R=async e=>{let{selectedFilesRaw:t}=e;try{if(!t)return!1;if(0===t.length)return c.ZP.error("Please select atleast one file"),!1;let e=[],a="";if(0===t.size&&(a="For file "+t.name+", is empty."),""===a&&("image/jpeg"===t.type||"image/png"===t.type||(a="For file ".concat(t.name,", It can be jpeg, jpg or png extension."))),""!==a)return c.ZP.error(a),!1;if(e.push(t),!1===Array.isArray(e)||0===e.length)return c.ZP.error("Please select atleast one file"),!1;let i=c.ZP.loading("File uploading..."),s=new FormData;s.append("uploadFile",e[0]);let l=await o.Z.post("/upload-file-client/uploadTempFile",s,{headers:{"Content-Type":"multipart/form-data"}});if(200!==l.status)return c.ZP.error("File upload failed"),!1;{let e=await o.Z.post("/upload-file-client/userMoveFileForKnownAboutCollection",{objectKey:l.data.data.objectKey});if(200===e.status)return c.ZP.success("Uploaded file successfully."),c.ZP.dismiss(i),{fileName:e.data.data.fileName,status:"Success"};return c.ZP.error("Something happened while uploading"),!1}}catch(e){return console.error("Error during file upload:",e),c.ZP.error("An error occurred while uploading the file"),!1}},T=(e,t,a)=>{if(a&&a.length>0){let i=Array.from(a);f(a=>a.map((a,s)=>s===t?{...a,[e]:i}:a)),y(a=>a.map((a,i)=>i===t?{...a,[e]:""}:a))}else y(a=>a.map((a,i)=>i===t?{...a,[e]:"Please select a ".concat("imagesFront"===e?"front":"back"," image.")}:a))},B=e=>{let t={bfile:"",ffile:"",estimate_price:"",description:""};if(e.forEach(e=>{let{frontImageName:a,backImageName:i,estimatePrice:s,description:l}=e;t.bfile+="".concat(i,","),t.ffile+="".concat(a,","),t.estimate_price+="".concat(s,","),t.description+="".concat(l,"~")}),t.bfile=t.bfile.slice(0,-1),t.ffile=t.ffile.slice(0,-1),t.estimate_price=t.estimate_price.slice(0,-1),t.description=t.description.slice(0,-1),""===t.bfile||""===t.ffile||""===t.estimate_price||""===t.description){c.ZP.error("Please fill all the fields");return}return t},U=e=>{var t,r,n,o;let c=h[e];return(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)("div",{className:"w-full flex flex-wrap border-b-4 lg:p-2 md:p-4 xl:p-2",children:[(0,i.jsx)("div",{className:"w-1/5 mt-2",children:(0,i.jsxs)("h1",{children:["Item No:",e+1]})}),(0,i.jsxs)("div",{className:"flex flex-wrap 4/5 mt-2",children:[(0,i.jsxs)("div",{className:"flex flex-col space-y-2",children:[(0,i.jsx)("label",{htmlFor:"image1Front-".concat(e),children:"Front image (maximum size is 2Mb.)"}),(null===(t=v[e])||void 0===t?void 0:t.imagesFront)&&(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)("div",{className:"text-red-500 ",children:[(0,i.jsx)(l.G,{icon:s.RLE}),(0,i.jsx)("span",{className:"px-1",children:v[e].imagesFront})]})}),(0,i.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",id:"image1Front-".concat(e),ref:a,onChange:t=>T("imagesFront",e,t.target.files)}),c.imagesFront.map((e,t)=>(0,i.jsx)("img",{className:"w-44",src:URL.createObjectURL(e),alt:""},t))]}),(0,i.jsxs)("div",{className:"flex flex-col space-y-2",children:[(0,i.jsx)("label",{htmlFor:"image1Back-".concat(e),children:"Back image (maximum size is 2Mb.)"}),(null===(r=v[e])||void 0===r?void 0:r.imagesBack)&&(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)("div",{className:"text-red-500 ",children:[(0,i.jsx)(l.G,{icon:s.RLE}),(0,i.jsx)("span",{className:"px-1",children:v[e].imagesBack})]})}),(0,i.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",id:"image1Back-".concat(e),ref:m,onCh
1ange:t=>T("imagesBack",e,t.target.files)}),c.imagesBack.map((e,t)=>(0,i.jsx)("img",{className:"w-44",src:URL.createObjectURL(e),alt:""},t))]}),(0,i.jsx)("div",{children:(0,i.jsxs)("div",{className:"flex flex-col space-y-5",children:[(0,i.jsxs)("div",{className:"flex flex-col gap-x-2",children:[(0,i.jsxs)("label",{htmlFor:"estimatePrice",children:["Your estimate price: ",(0,i.jsx)("strong",{className:"text-red-500",children:"*"})]}),(null===(n=v[e])||void 0===n?void 0:n.estimate_price)&&(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)("div",{className:"text-red-500 ",children:[(0,i.jsx)(l.G,{icon:s.RLE}),(0,i.jsx)("span",{className:"px-1",children:v[e].estimate_price})]})})]}),(0,i.jsx)("input",{className:"outline-none border rounded-lg p-3",type:"number",value:c.estimatePrice,onChange:t=>f(a=>a.map((a,i)=>i===e?{...a,estimatePrice:t.target.value}:a))}),(0,i.jsxs)("div",{className:"flex flex-col gap-x-2",children:[(0,i.jsxs)("label",{htmlFor:"description",children:["Your description ",(0,i.jsx)("strong",{className:"text-red-500",children:"*"})]}),(null===(o=v[e])||void 0===o?void 0:o.description)&&(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)("div",{className:"text-red-500 ",children:[(0,i.jsx)(l.G,{icon:s.RLE}),(0,i.jsx)("span",{className:"px-1",children:v[e].description})]})})]}),(0,i.jsx)("textarea",{className:"outline-none border rounded-lg p-3",id:"description",cols:30,rows:5,value:c.description,onChange:t=>f(a=>a.map((a,i)=>i===e?{...a,description:t.target.value}:a))})]})})]})]})})},G=h.map((e,t)=>U(t)),L=async()=>{try{let t=!0,a=[];for(let e=0;e<h.length;e++){let i=h[e],s={title:"",name:"",email:"",mobile:"",city:"",city_name:"",state:"",state_name:"",country:"",country_name:"",description:"",estimate_price:"",imagesFront:"",imagesBack:""};""===i.estimatePrice.trim()&&(s.estimate_price="Please enter estimate price.",t=!1),""===i.description.trim()&&(s.description="Please enter description.",t=!1),0===i.imagesFront.length&&(s.imagesFront="Please select front image.",t=!1),0===i.imagesBack.length&&(s.imagesBack="Please select back image.",t=!1),a.push(s)}if(y(a),t){var e;let t=[];for(let e=0;e<h.length;e++){let a=await R({selectedFilesRaw:h[e].imagesFront[0]}),i=a?a.fileName:"",s=await R({selectedFilesRaw:h[e].imagesBack[0]}),l=s?null==s?void 0:s.fileName:"";t.push({frontImageName:i,backImageName:l,estimatePrice:h[e].estimatePrice,description:h[e].description})}let a=await B(t),i=await o.Z.post("/contact_us/addknowAboutYourCollection",{...a,status:0,order_id:Number(k),upload_status:1}),s={tracking_id:null==i?void 0:null===(e=i.data)||void 0===e?void 0:e.tracking_id,page:"know about your collection"};F.push({pathname:"/contact",query:s})}else{let e=document.querySelector(".error-message");e&&e.scrollIntoView({behavior:"smooth",block:"center"}),c.ZP.error("Please fill all the required fields.")}}catch(e){console.log(e)}};return(0,i.jsxs)("div",{className:"md:mx-8 px-3 lg:mx-28 xl:mx-28 lg:px-0 md:p-0",children:[(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(u(),{children:(0,i.jsx)("title",{children:"Upload Images"})})}),A?(0,i.jsx)("div",{className:"flex justify-center items-center h-auto p-4",children:(0,i.jsx)(l.G,{icon:s.LM3,spin:!0,size:"3x",className:"text-gray-500"})}):_||b||w?(0,i.jsx)("section",{className:"bg-white shadow-md rounded-lg max-w-2xl mx-auto p-8",children:(0,i.jsxs)("div",{className:"text-center",children:[b&&(0,i.jsxs)("div",{className:"mb-6",children:[(0,i.jsx)(l.G,{icon:s.xHz,className:"h-16 w-16 text-red-500 mb-4"}),(0,i.jsx)("h3",{className:"text-2xl font-bold text-gray-900 mb-2",children:"Order is Aborted"}),(0,i.jsx)("p",{className:"text-gray-600 mb-6",children:"Sorry, You abort this transaction."}),(0,i.jsx)("button",{onClick:S,className:"px-6 py-2 bg-green-500 text-white rounded-md hover:bg-green-600 transition duration-300",children:"Try Again"})]}),_&&(0,i.jsxs)("div",{className:"mb-6",children:[(0,i.jsx)(l.G,{icon:s.nYk,className:"h-16 w-16 text-red-500 mb-4"}),(0,i.jsx)("h3",{className:"text-2xl font-bold text-gray-900 mb-2",children:"Order is Failed"}),(0,i.jsx)("p",{className:"text-gray-600 mb-6",children:"Sorry, Try Again."}),(0,i.jsx)("button",{onClick:S,className:"px-6 py-2 bg-green-500 text-white rounded-md hover:bg-green-600 transition duration-300",children:"Try Again"})]}),w&&(0,i.jsxs)("div",{className:"mb-6",children:[(0,i.jsx)(l.G,{icon:s.nYk,className:"h-16 w-16 text-red-500 mb-4"}),(0,i.jsx)("h3",{className:"text-2xl font-bold text-gray-900 mb-2",children:"Your payment session has expired due to inactivity."}),(0,i.jsx)("p",{className:"text-gray-600 mb-6",children:"Please click below to restart your payment"}),(0,i.jsx)("button",{onClick:S,className:"px-6 py-2 bg-green-500 text-white rounded-md hover:bg-green-600 transition duration-300",children:"Try Again"})]})]})}):(0,i.jsx)("div",{className:"container mx-auto",children:(0,i.jsx)(n.UQ,{allowZeroExpanded:!0,children:(0,i.jsxs)(n.Qd,{children:[(0,i.jsx)(n.Ol,{children:(0,i.jsx)(n.on,{children:(0,i.jsx)("div",{onClick:()=>t(e=>!e),children:(0,i.jsxs)("div",{className:"container mx-auto bg-gray-50 flex hover:text-blue-500 border items-center shadow-md justify-between mt-3 p-3",children:[(0,i.jsx)("h1",{className:"text-lg",children:"Upload Images"}),(0,i.jsx)(l.G,{className:"text-3xl text-gray-600",icon:e?s.El_:s.CPW})]})})})}),(0,i.jsxs)(n.Mt,{children:[G,(0,i.jsx)("div",{className:"flex justify-start items-start border-b-4 p-3",children:(0,i.jsx)("button",{onClick:L,className:"bg-green-400 text-white p-1 rounded-md ",children:"Submit"})})]})]})})})]})},g=a(48583),h=a(94543),f=a(28646),v=a(15635),y=()=>{var e;let t=(0,d.useRouter)(),a=(0,g.Dv)(h.ZP),s=(null===(e=t.query)||void 0===e?void 0:e.order_id)!==void 0;return a.isLoggedIn?s?(0,i.jsx)(x,{}):(0,i.jsx)(v.Z,{}):(0,i.jsx)(f.Z,{})}},75052:function(e,t,a){"use strict";var i=a(85893);a(67294);var s=a(88446),l=a(29552),r=a(93729);let n=async e=>{try{var t;let a=e.group_category,i=e.no_collect,n=e.payment_type,o=e.total_amount,c=null==e?void 0:null===(t=e.payment_details)||void 0===t?void 0:t.order_id,d=e.price,m=e.gst,u=e.gstAmount,p=e.singleUnitPrice,x=async e=>{try{if(e){let t=await s.Z.post("/payment/initiate_kbcpayment",{orderId:e}).catch(e=>{(0,r.Z)({type:"error",msg:e.response.data}),window.location.href="/customers/buyer-address"});return null==t?void 0:t.data.payload}}catch(e){return console.error(e),""}},g=async(e,t,a)=>{try{let l=await s.Z.post("/contact_us/createKbcOrder",{total_amount:a,no_collect:e,group_category:t,subtotal_price:d,gst_percentage:m,gstAmount:u,singleUnitPrice:p});if(200===l.status){var i;let e=null==l?void 0:null===(i=l.data)||void 0===i?void 0:i.oder_id;return{orderID:e,status:"success"}}}catch(e){return console.error(e),{}}},h=0;
1if("number"==typeof i&&"number"==typeof a){let e="";if("string"==typeof n&&"original"===n){let e=await g(i,a,o);"object"==typeof e&&Object.keys(e).length>0&&"string"==typeof e.status&&"success"===e.status&&(h=e.orderID)}"string"==typeof n&&"try-again"===n&&(h=c);let t=await x(h);if(t.length>0){e=t;let a=document.createElement("form");a.method="POST",a.action="".concat(l.Z.PAYMENT_GATEWAY_URL);let i=document.createElement("input");i.type="hidden",i.name="encRequest",i.value=e,a.appendChild(i);let s=document.createElement("input");s.type="hidden",s.name="access_code",s.value="".concat(l.Z.PAYMENT_GATEWAY_ACCESS_CODE),a.appendChild(s),document.body.appendChild(a),a.submit()}}}catch(e){console.error(e)}return(0,i.jsx)(i.Fragment,{children:(0,i.jsx)("div",{className:"text-center",children:(0,i.jsx)("h4",{children:"please do not refresh the page........"})})})};t.Z=n}},function(e){e.O(0,[484,1439,9774,2888,179],function(){return e(e.s=49284)}),_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.