Your IP : 216.73.217.77


Current Path : /home/users/unlimited/www/ondemand.codeskitter.site/build/static/js/
Upload File :
Current File : /home/users/unlimited/www/ondemand.codeskitter.site/build/static/js/929.ec8b7802.chunk.js

"use strict";(self.webpackChunkproject=self.webpackChunkproject||[]).push([[929],{46929:(e,t,s)=>{s.r(t),s.d(t,{default:()=>be});var i=s(65043),a=s(69131),n=s(49844),o=s(38848),l=s(17296),r=s(26240),d=s(19252),c=s(68903),h=s(96446),x=s(85865),u=s(42518),m=s(17392),p=s(39336),v=s(83462),g=s(26600),j=s(51292),y=s(14256),_=s(12110),A=s(36591),b=s(94109),f=s(44978),w=s(72653),k=s(73216),C=s(84289),N=s(41503),S=s(36171),D=s(23768),E=s(46726),W=s(60446),z=s.n(W),I=s(69369),O=s(53193),F=s(39948),T=s(30802),M=s(68641),R=s(97412),P=s(89876),B=s(41434),L=s(50050),U=s(74975),V=s(74802),Y=s(79456),q=s(70549),H=s(46941),$=s(70579);const G=e=>{let{open:t,setOpen:s,service:a,company:n}=e;const[o,l]=(0,i.useState)(t),r=()=>{l(!1),s(!1)},d=(0,I.u)(),c=(0,H.Wz)(),v=(0,Y.wA)(),[g,y]=(0,i.useState)([]),[_,A]=(0,i.useState)([]),[w,k]=(0,i.useState)({defaultComment:a.comment,defaultRating:a.rating});(0,i.useEffect)((()=>{(async()=>{const e=(a.images||[]).map((async e=>{const t=await fetch(e);return await t.blob()})),t=await Promise.all(e);A(t)})()}),[a.images]);return(0,$.jsx)(b.Ay,{anchor:c?"left":"right",open:o,onClose:r,"aria-labelledby":"modal-modal-title","aria-describedby":"modal-modal-description",sx:{p:5,display:{xs:"block",sm:"block"},"& .MuiDrawer-paper":{boxSizing:"border-box",width:{md:"45%",xs:"100%",sm:"100%"}}},children:(0,$.jsxs)(h.A,{sx:{p:1},children:[(0,$.jsxs)(h.A,{display:"flex",alignItems:"center",maxWidth:"100%",children:[(0,$.jsx)(m.A,{"aria-label":"Close Button",onClick:()=>r(),children:(0,$.jsx)(M.A,{})}),(0,$.jsx)(x.A,{id:"modal-modal-title",variant:"h6",component:"h6",color:d.palette.color.navLink,children:n})]}),(0,$.jsx)(p.A,{}),(0,$.jsx)(h.A,{display:"flex",flexDirection:"column",justifyContent:"center",alignSelf:"center",p:2,children:(0,$.jsxs)(h.A,{children:[(0,$.jsx)(x.A,{id:"modal-modal-title",variant:"subtitle1",component:"h6",color:d.palette.color.navLink,children:a.service_title}),(0,$.jsxs)(h.A,{sx:{width:{xs:"100%",md:"100%"},mt:.5},children:[(0,$.jsx)(h.A,{children:(0,$.jsxs)(O.A,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:1},children:[(0,$.jsx)(x.A,{variant:"subtitle1",children:(0,f.t)("rate")}),(0,$.jsx)(h.A,{display:"flex",flexWrap:"wrap",gap:2,children:[1,2,3,4,5].map((e=>(0,$.jsx)(F.A,{variant:"contained",size:"small","aria-label":`rating ${e}`,children:(0,$.jsx)(u.A,{sx:{backgroundColor:e===Number(w.defaultRating)?"#FFEB8E":"transparent",borderColor:"gray",color:"inherit"},onClick:()=>(e=>{k({...w,defaultRating:e})})(e),endIcon:(0,$.jsx)(R.A,{sx:{color:"#F4BE18"}}),children:e})},e)))})]})}),(0,$.jsx)(h.A,{mt:2,children:(0,$.jsxs)(O.A,{sx:{maxWidth:"100%",width:"100%"},children:[(0,$.jsxs)(j.A,{sx:{mb:1},children:[" ",(0,f.t)("message")," "]}),(0,$.jsx)(h.A,{component:T.A,id:"comment",p:2,placeholder:(0,f.t)("write_review"),size:"small",defaultValue:w.defaultComment,onChange:e=>k({...w,defaultComment:e.target.value}),name:"name",required:!0,color:d.palette.color.textColor,minRows:5,sx:{borderRadius:"10px",backgroundColor:d.palette.background.paper}})]})}),(0,$.jsx)("div",{className:"other_image mb-2",children:(0,$.jsx)(P.Ay,{onDrop:e=>{const t=e.filter((e=>e.type.startsWith("image/")));e.length===t.length?y([...g,...e]):D.Ay.error("Only image files are allowed.")},multiple:!0,children:e=>{let{getRootProps:t,getInputProps:s}=e;return(0,$.jsxs)("div",{...t(),className:"dropzone",children:[(0,$.jsx)("input",{...s(),className:"",accept:"image/*"}),(0,$.jsx)(B.UPU,{className:"me-1"}),(0,f.t)("uploadImage")]})}})}),(0,$.jsx)("div",{className:"image_slider",children:(0,$.jsxs)(U.RC,{loop:!1,speed:750,spaceBetween:10,slidesPerView:3.5,navigation:!1,autoplay:!1,breakpoints:{0:{slidesPerView:2.5},768:{slidesPerView:2.5},992:{slidesPerView:3},1200:{slidesPerView:4.5}},modules:[L.dK,L.Vx],children:[_&&(null===_||void 0===_?void 0:_.map(((e,t)=>(0,$.jsx)(U.qr,{children:(0,$.jsx)(h.A,{position:"relative",children:(0,$.jsx)("img",{src:e?URL.createObjectURL(e):"",alt:`Uploaded ${t}`,style:{width:"100%",height:"auto"},onError:e=>{e.target.src="../../../public/edemand_logo.ico"}})})},t)))),g&&g.map(((e,t)=>(0,$.jsx)(U.qr,{children:(0,$.jsxs)(h.A,{position:"relative",children:[(0,$.jsx)("img",{src:URL.createObjectURL(e),alt:`Uploaded ${t}`,style:{width:"100%",height:"auto"},onError:H.jM}),(0,$.jsx)(m.A,{onClick:()=>function(e){arguments.length>1&&void 0!==arguments[1]&&arguments[1]?A(_.filter(((t,s)=>s!==e))):y(g.filter(((t,s)=>s!==e)))}(t),sx:{position:"absolute",top:5,right:5,backgroundColor:"rgba(0, 0, 0, 0.5)",color:"white","&:hover":{backgroundColor:"rgba(0, 0, 0, 0.7)"}},children:(0,$.jsx)(V.A,{fontSize:"small"})})]})},t)))]})}),(0,$.jsx)(h.A,{mt:2,children:(0,$.jsx)(u.A,{fullWidth:!0,variant:"contained",sx:{textTransform:"none"},onClick:e=>(async()=>{try{const e=[..._,...g];await S.A.apply_rating({id:a.service_id,rating:w.defaultRating,comment:w.defaultComment,images:e,custom_job_request_id:null!==a&&void 0!==a&&a.custom_job_request_id?a.custom_job_request_id:""}).then((e=>{const t=e.data,s=null===a||void 0===a?void 0:a.service_id,i=null===a||void 0===a?void 0:a.order_id,n=null===t||void 0===t?void 0:t.rating,o=null===t||void 0===t?void 0:t.comment,l=null===t||void 0===t?void 0:t.images;!1===e.error?(v((0,q.ik)({serviceID:s,mainID:i,ratingUpdate:n,commentData:o,imagesData:l})),D.Ay.success(e.message),r()):"object"==typeof e.message?Object.values(e.message).forEach((e=>{D.Ay.error(e)})):D.Ay.error(e.message)}))}catch(e){console.log(e)}})(),children:(0,f.t)("submit")})})]})]})})]})})};var K=s(95539),Z=s(74763),J=(s(66097),s(48729)),Q=s(6135),X=s(85129),ee=s(25581),te=s(11382),se=s(38463),ie=s(15078),ae=s(84511),ne=s(15795),oe=s(4253),le=s(76513),re=s(42625);const de=e=>{var t,s,a,n,o,l,r,d,c,v;let{setForm:g,isSelectedSlote:j,MyFun:y,setCart:_,setBooking:A}=e;const b=(0,Y.wA)(),w=null===(t=(0,Y.d4)((e=>e.OrderCartDetails)))||void 0===t?void 0:t.orderDetails,k=w&&w.slot,C=null===(s=(0,Y.d4)((e=>e.UserAddress)))||void 0===s?void 0:s.address,N=null===(a=(0,Y.d4)((e=>e.DeliveryAddress)))||void 0===a?void 0:a.deliveryType,E=null===(n=(0,Y.d4)((e=>e.DeliveryAddress)))||void 0===n?void 0:n.delivery,W=(0,Y.d4)((e=>e.cart)),z=w&&w.date,[O,F]=(0,i.useState)(w.orderNote);(0,i.useEffect)((()=>{var e,t,s,i;"1"===(null===W||void 0===W||null===(e=W.reOrder)||void 0===e?void 0:e.at_store)&&"1"===(null===W||void 0===W||null===(t=W.reOrder)||void 0===t?void 0:t.at_doorstep)||"0"===(null===W||void 0===W||null===(s=W.reOrder)||void 0===s?void 0:s.at_store)&&"1"===(null===W||void 0===W||null===(i=W.reOrder)||void 0===i?void 0:i.at_doorstep)&&b((0,re.VE)("Home"))}),[null===W||void 0===W||null===(o=W.reOrder)||void 0===o?void 0:o.at_store,null===W||void 0===W||null===(l=W.reOrder)||void 0===l?void 0:l.at_doorstep,b]);const T=async(e,t)=>{await S.A.providerAvailable({latitude:e,longitude:t,isCheckout:1}).then((e=>{!1===e.error?(D.Ay.success(e.message),(0,ee.ho)(g),(0,ee.dh)(A)):D.Ay.error(e.message)}))};function M(){var e,t,s,i;if("1"===(null===W||void 0===W||null===(e=W.reOrder)||void 0===e?void 0:e.at_store)&&"1"===(null===W||void 0===W||null===(t=W.reOrder)||void 0===t?void 0:t.at_doorstep)){if(null===(null===W||void 0===W?void 0:W.selectedView))return void D.Ay.error("Please select delivery type");if(""===z.trim()||""===k.trim())return void D.Ay.error("Please select date, time before continuing.")}N&&""===N?D.Ay.error("Please select Delivery method before continuing."):"Home"!==N||0!==(null===C||void 0===C?void 0:C.length)?("1"===(null===W||void 0===W||null===(s=W.reOrder)||void 0===s?void 0:s.at_store)&&"0"===(null===W||void 0===W||null===(i=W.reOrder)||void 0===i?void 0:i.at_doorstep)&&b((0,re.VE)("shop")),(async()=>{var e,t,s;const i=W&&(null===W||void 0===W||null===(e=W.reOrder)||void 0===e?void 0:e.provider_id),a=W&&(null===W||void 0===W||null===(t=W.reOrder)||void 0===t||null===(s=t.data[0])||void 0===s?void 0:s.id);await S.A.checkSlots({partner_id:i,date:z,time:k,order_id:a}).then((e=>{!1===e.error?""!==E&&"Home"===N?T(E.lattitude,E.longitude):((0,ee.ho)(g),(0,ee.dh)(A)):D.Ay.error(e.message)})).catch((e=>console.log(e)))})()):D.Ay.error("Please select an address before continuing.")}const R=(0,I.u)();return(0,$.jsxs)("div",{className:"overflow-hidden",children:[(0,$.jsxs)(h.A,{mt:1,mb:1,display:"flex",sx:{fontWeight:"bold"},alignItems:"center",children:[(0,$.jsx)(m.A,{onClick:function(){(0,ee.ho)(g),(0,ee.dh)(_)},children:(0,$.jsx)(se.A,{fontSize:"large"})}),(0,$.jsxs)("h3",{children:[(0,f.t)("from")," ",W&&(null===W||void 0===W||null===(r=W.reOrder)||void 0===r?void 0:r.company_name)]})]}),(0,$.jsx)(p.A,{}),"1"===(null===W||void 0===W||null===(d=W.reOrder)||void 0===d?void 0:d.at_store)&&"1"===(null===W||void 0===W||null===(c=W.reOrder)||void 0===c?void 0:c.at_doorstep)?(0,$.jsxs)(h.A,{py:4,px:"8px",children:[(0,$.jsx)(x.A,{fontSize:16,children:(0,f.t)("choose_location")}),(0,$.jsxs)(ie.A,{orientation:"vertical",exclusive:!0,fullWidth:!0,onChange:(e,t)=>{b((0,K.M$)(t))},children:[(0,$.jsx)(ae.A,{value:"list","aria-label":"list",onClick:e=>{b((0,re.VE)("Home"))},children:(0,$.jsxs)("div",{children:[(0,$.jsx)(x.A,{children:(0,f.t)("at_door")}),(0,$.jsx)(x.A,{variant:"body2",color:"gray",textTransform:"none",children:(0,f.t)("door_details")})]})}),(0,$.jsx)(ae.A,{value:"module","aria-label":"module",onClick:e=>{b((0,re.VE)("shop"))},children:(0,$.jsxs)("div",{children:[(0,$.jsx)(x.A,{children:(0,f.t)("at_store")}),(0,$.jsx)(x.A,{variant:"body2",color:"gray",textTransform:"none",children:(0,f.t)("store_details")})]})})]})]}):null,(0,$.jsxs)(h.A,{display:"block",px:"8px",py:1,children:[(0,$.jsxs)(h.A,{display:"flex",justifyContent:"space-between",alignItems:"center",gap:3,children:[(0,$.jsxs)(h.A,{width:"100%",children:[(0,$.jsx)(x.A,{fontSize:16,children:(0,f.t)("select_date")}),(0,$.jsx)(ne.A,{id:"date",type:"date",fullWidth:!0,sx:{borderRadius:"8px"},value:z||"",disabled:!0})]}),(0,$.jsxs)(h.A,{width:"100%",children:[(0,$.jsx)(x.A,{fontSize:16,children:(0,f.t)("select_time")}),(0,$.jsx)(ne.A,{id:"time",type:"time",fullWidth:!0,value:k||"",disabled:!0})]})]}),(0,$.jsx)(h.A,{mt:2,mb:2,children:(0,$.jsx)(u.A,{className:"drawer-button",variant:"contained",fullWidth:!0,sx:{backgroundColor:R.palette.background.buttonColor,borderRadius:"var( --global-border-radius)",textTransform:"none","&:hover":{backgroundColor:R.palette.background.buttonColor}},onClick:()=>((0,ee.ho)(g),void(0,ee.dh)(j)),children:(0,f.t)("select_date_time")})})]}),"1"===(null===W||void 0===W||null===(v=W.reOrder)||void 0===v?void 0:v.at_doorstep)&&"Home"===N?(0,$.jsx)($.Fragment,{children:(0,$.jsxs)(h.A,{display:"block",children:[(0,$.jsx)(x.A,{px:"8px",fontSize:18,children:(0,f.t)("your_address")}),(0,$.jsx)(le.B,{}),(0,$.jsx)(h.A,{px:"8px",mb:2,children:(0,$.jsx)(u.A,{variant:"outlined",sx:{textTransform:"none"},fullWidth:!0,className:"drawer-button-address",onClick:y,children:(0,f.t)("add_address_button")})})]})}):"",(0,$.jsxs)(h.A,{px:"8px",children:[(0,$.jsx)(x.A,{fontSize:16,mb:.5,children:(0,f.t)("provider_instruction")}),(0,$.jsx)(ne.A,{fullWidth:!0,multiline:!0,rows:4,variant:"outlined",value:O,onChange:e=>{return t=e.target.value,F(t),void b((0,oe.Ly)({orderNote:t}));var t}})]}),(0,$.jsx)(h.A,{px:"8px",pt:2,mb:2,children:(0,$.jsx)(u.A,{variant:"contained",sx:{backgroundColor:R.palette.background.buttonColor,padding:1,textTransform:"none",borderRadius:"var( --global-border-radius)","&:hover":{backgroundColor:R.palette.background.buttonColor}},fullWidth:!0,onClick:()=>M(),children:(0,f.t)("continue")})})]})};var ce=s(56458),he=s(27628),xe=s(27149),ue=s(46983),me=s(71245),pe=s(74605),ve=s(81972),ge=s(6477),je=s(63393),ye=s(95206);const _e=e=>{var t,a,n;let{AdditionalModalOpen:o,close:l,data:r,isAdditionalCharges:d}=e;const c=null===(t=(0,Y.d4)((e=>e.UserData)))||void 0===t?void 0:t.profile,m=null===r||void 0===r?void 0:r.id,p=(0,k.Zp)(),v=(0,I.u)(),[g,j]=(0,i.useState)(""),[_,A]=(0,i.useState)([]),[b,w]=(0,i.useState)(null),[C,N]=(0,i.useState)(""),[E,W]=(0,i.useState)(""),[z,O]=(0,i.useState)(!1),F=null===r||void 0===r?void 0:r.total_additional_charge,T=null===(a=(0,Y.d4)((e=>e.Settings)))||void 0===a?void 0:a.settings,M=null===T||void 0===T?void 0:T.payment_gateways_settings,R=null===M||void 0===M?void 0:M.stripe_publishable_key,P=(0,ve.c)(R),B=null===T||void 0===T||null===(n=T.payment_gateways_settings)||void 0===n?void 0:n.stripe_currency;let L=null===M||void 0===M?void 0:M.stripe_secret_key;const U=s(75792)(L),V=null===M||void 0===M?void 0:M.payment_gateway_setting,q=1===(null===M||void 0===M?void 0:M.cod_setting),G=1===(null===M||void 0===M?void 0:M.payment_gateway_setting),K=1===V?M.stripe_status:"disable",Z=1===V?M.razorpayApiStatus:"disable",J=1===V?M.paypal_status:"disable",Q=1===V?M.paystack_status:"disable",X=1===V?M.flutterwave_status:"disable",ee=T.payment_gateways_settings.razorpay_key,te=c.email?c.email:null===c||void 0===c?void 0:c.data.email,[se,ie]=(0,i.useState)(!1);(0,i.useEffect)((()=>{j(G&&!q?"online":!G&&q?"cod":"")}),[M]),(0,i.useEffect)((()=>{if("online"===g){const e=[];"enable"===K&&e.push({paymentType:"stripe",enable:!0}),"enable"===Z&&e.push({paymentType:"razorpay",enable:!0}),"enable"===J&&e.push({paymentType:"paypal",enable:!0}),"enable"===Q&&e.push({paymentType:"paystack",enable:!0}),"enable"===X&&e.push({paymentType:"flutterwave",enable:!0}),A(e),1===e.length&&w(e[0].paymentType)}else A([]),w("")}),[M,g]);const ae=e=>{j(e)},ne={clientSecret:E,appearance:{theme:"stripe"}};(0,i.useEffect)((()=>{}),[E,z,C]);return(0,$.jsx)(me.A,{open:o,onClose:l,"aria-labelledby":"modal-title","aria-describedby":"modal-description",children:(0,$.jsxs)(h.A,{sx:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",bgcolor:"background.paper",boxShadow:24,p:4,borderRadius:2,width:400},children:[(0,$.jsxs)(h.A,{sx:{display:"flex",justifyContent:"space-between",mb:3},children:[(0,$.jsx)(x.A,{id:"modal-title",variant:"h6",component:"h2",children:(0,f.t)("select_payment_method")}),(0,$.jsx)("span",{onClick:l,children:(0,$.jsx)(xe.m6K,{size:22})})]}),(0,$.jsxs)(h.A,{sx:{display:"flex",justifyContent:"space-between",mt:3,gap:"20px"},children:[G&&(0,$.jsx)("button",{className:"paymentBtns "+("online"===g?"activeBtn":""),onClick:()=>ae("online"),children:(0,f.t)("online_payment")}),q&&(0,$.jsx)("button",{className:"paymentBtns "+("cod"===g?"activeBtn":""),onClick:()=>ae("cod"),children:(0,f.t)("cod")})]}),"online"===g&&_.length>0&&(0,$.jsxs)(h.A,{mt:3,children:[(0,$.jsx)(x.A,{variant:"subtitle1",children:(0,f.t)("choose_payment_mode")}),_&&_.map((e=>(0,$.jsx)(i.Fragment,{children:(0,$.jsx)(pe.A,{value:e.paymentType,control:(0,$.jsx)(y.A,{checked:b===e.paymentType,onChange:t=>((e,t)=>{e.preventDefault(),w(t)})(t,e.paymentType)}),style:{textTransform:"capitalize"},label:`${(0,f.t)("pay_using")}  ${e.paymentType}`})},e.paymentType)))]}),z&&(0,$.jsx)(je.Elements,{stripe:P,options:ne,children:(0,$.jsx)(ge.A,{isAdditionalCharges:d,clientKey:E,amount:F,additionalServiceOrderId:null===r||void 0===r?void 0:r.id,paymentMethod:b,transactionId:C,open:se,setOpen:ie,renderStripeElement:z,setrenderStripeElement:O})}),(0,$.jsxs)(h.A,{mt:3,display:"flex",justifyContent:"flex-end",width:"100%",children:["stripe"===b&&(0,$.jsxs)(u.A,{onClick:async()=>{try{var e;const t=await S.A.add_transactions({orderID:m,status:"pending",is_additional_charge:1,payment_method:b}),s=null===t||void 0===t||null===(e=t.data)||void 0===e?void 0:e.id;(async(e,t)=>{if(F)try{const s=await U.paymentIntents.create({amount:Math.round(100*F),currency:B,description:"payment",metadata:{additional_charges_transaction_id:e,order_id:t}});W(s.client_secret),O(!0)}catch(s){console.error("Error creating payment intent:",s)}})(s,m),N(s)}catch(t){(0,H.YV)(t)}},sx:{width:"100%",textTransform:"capitalize"},children:[(0,f.t)("pay_with")," ",b]}),"razorpay"===b&&(0,$.jsxs)(u.A,{onClick:async()=>{try{var e;const t=await S.A.add_transactions({orderID:m,status:"pending",is_additional_charge:1,payment_method:b}),s=null===t||void 0===t||null===(e=t.data)||void 0===e?void 0:e.id;(async(e,t)=>{var s,i;let a="";await S.A.createRazorOrder({orderId:t,is_additional_charge:1}).then((e=>{var t;a=null===e||void 0===e||null===(t=e.data)||void 0===t?void 0:t.id}));const n={key:ee,currency:B,name:"HausMate",order_id:a,notes:{additional_charges_transaction_id:e,order_id:t},description:"Payment for Your Product",handler:async function(s){s&&s.razorpay_payment_id&&await S.A.add_transactions({orderID:t,status:"success",is_additional_charge:1,payment_method:b,transaction_id:e}).then((e=>{l(),p("/profile/booking/services/"+t)})).catch((e=>{console.error("Error occurred during transaction completion:",e)}))},theme:{color:null===v||void 0===v||null===(s=v.palette)||void 0===s||null===(i=s.primary)||void 0===i?void 0:i.main},modal:{ondismiss:async function(){await S.A.add_transactions({orderID:t,status:"cancelled"}).then((e=>{})).catch((e=>{console.error("Error occurred during transaction cancellation:",e)}))}}};window.Razorpay.open(n)})(s,m),N(s)}catch(t){console.log(t)}},sx:{width:"100%",textTransform:"capitalize"},children:[(0,f.t)("pay_with")," ",b]}),"paystack"===b&&(0,$.jsxs)(u.A,{onClick:async()=>{try{var e;const t=await S.A.add_transactions({orderID:m,status:"pending",is_additional_charge:1,payment_method:b}),s=null===t||void 0===t||null===(e=t.data)||void 0===e?void 0:e.id;((e,t)=>{try{ye.A.setup({key:M.paystack_key,email:te,amount:100*F,currency:M.paystack_currency,reference:(new Date).getTime().toString(),callback:function(s){"success"===s.status?S.A.add_transactions({orderID:t,status:"success",is_additional_charge:1,payment_method:b,transaction_id:e}).then((e=>{!0===e.error?D.Ay.error(e.message):D.Ay.success("Service Booked successfully")})).then((e=>{})).then((e=>{p("/profile/booking/services/"+t)})):D.Ay.error("Payment failed. Please try again.")},onClose:function(){D.Ay.error("Payment window closed."),S.A.add_transactions({orderID:t,status:"cancelled"}).then((e=>{}))},metadata:{order_id:t,additional_charges_transaction_id:e}}).openIframe()}catch(s){console.error("An error occurred while processing the payment:",s),D.Ay.error("An unexpected error occurred. Please try again.")}})(s,m),N(s)}catch(t){console.log(t)}},sx:{width:"100%",textTransform:"capitalize"},children:[(0,f.t)("pay_with")," ",b]}),"paypal"===b&&(0,$.jsx)("div",{className:"paypal_buttons",style:{width:"100%"},children:(0,$.jsxs)(u.A,{onClick:async()=>{try{var e;const t=await S.A.add_transactions({orderID:m,status:"pending",is_additional_charge:1,payment_method:"paypal"}),s=null===t||void 0===t||null===(e=t.data)||void 0===e?void 0:e.id,i=t.paypal_link;N(s),i&&(l(),window.location.href=i)}catch(t){console.log(t)}},sx:{width:"100%",textTransform:"capitalize"},children:[(0,f.t)("pay_with")," ",b]})}),"flutterwave"===b&&(0,$.jsxs)(u.A,{onClick:async()=>{try{var e;const t=await S.A.add_transactions({orderID:m,status:"pending",is_additional_charge:1,payment_method:"flutterwave"}),s=null===t||void 0===t||null===(e=t.data)||void 0===e?void 0:e.id,i=null===t||void 0===t?void 0:t.flutterwave_link;N(s),i&&(l(),window.location.href=i)}catch(t){console.log(t)}},sx:{width:"100%",textTransform:"capitalize"},children:[(0,f.t)("pay_with")," ",b]}),"cod"===g&&(0,$.jsx)("div",{style:{width:"100%"},children:(0,$.jsx)(u.A,{sx:{width:"100%",textTransform:"capitalize"},onClick:async()=>{try{await S.A.add_transactions({orderID:m,status:"pending",is_additional_charge:1,payment_method:"cod"});D.Ay.success((0,f.t)("Service booked successfully")),p("/profile/booking/services/"+m)}catch(e){console.log(e)}},children:(0,f.t)("pay_on_seervice")})})]})]})})};var Ae=s(86054);const be=()=>{var e,t,s,W,I,O,F,T,M,R,P,B;const L=(0,r.A)(),U=(0,H.Wz)(),[V,q]=(0,i.useState)([]),{id:se}=(0,k.g)(),ie=null===(e=(0,Y.d4)((e=>e.Settings)))||void 0===e?void 0:e.settings,ae=null===ie||void 0===ie||null===(t=ie.general_settings)||void 0===t?void 0:t.otp_system,ne=null===ie||void 0===ie||null===(s=ie.app_settings)||void 0===s?void 0:s.currency,oe=null===(W=(0,Y.d4)((e=>e.authentication)))||void 0===W?void 0:W.isLoggedIn,le="1"===(null===ie||void 0===ie?void 0:ie.general_settings.allow_post_booking_chat),re="1"===(null===(I=V[0])||void 0===I?void 0:I.post_booking_chat),me=null===(O=V[0])||void 0===O?void 0:O.services[0].custom_job_request_id,[pe,ve]=(0,i.useState)(0),[ge,je]=(0,i.useState)(""),[ye,be]=(0,i.useState)(!1),[fe,we]=(0,i.useState)(),[ke,Ce]=(0,i.useState)(!1),[Ne,Se]=(0,i.useState)(""),[De,Ee]=(0,i.useState)([]),[We,ze]=(0,i.useState)(""),[Ie,Oe]=(0,i.useState)(!1),[Fe,Te]=(0,i.useState)(!1),[Me,Re]=(0,i.useState)(0),[Pe,Be]=(0,i.useState)(!1),[Le,Ue]=(null===(F=(0,Y.d4)((e=>e.cart)))||void 0===F||F.base_cart,(0,i.useState)([])),[Ve,Ye]=(0,i.useState)(z()().format("YYYY-MM-DD")),qe=(0,Y.d4)((e=>e.Location)),He=null===(T=(0,Y.d4)((e=>e.OrderCartDetails)))||void 0===T?void 0:T.orderDetails,$e=(0,Y.wA)(),Ge=He&&He.date,Ke=async e=>{const t=z()(Ve).format("YYYY-MM-DD");try{var s;const i=await S.A.get_providers({latitude:qe.lat,longitude:qe.lng,id:e});Ue(i.data);const a=await S.A.get_available_slot({partner_id:e,selectedDate:t});Ee(null===a||void 0===a||null===(s=a.data)||void 0===s?void 0:s.all_slots),ze(null===a||void 0===a?void 0:a.message),Re(e),a.error&&ze(null===a||void 0===a?void 0:a.message)}catch(i){ze(""),console.log("error",i)}};(0,i.useEffect)((()=>{ke&&Ve&&Ke(Me)}),[Ve]),(0,i.useEffect)((()=>{(async()=>{try{const e=await S.A.getOrders({id:se});q(e.data)}catch(e){console.log("error",e)}})()}),[Ve,ye,se]),(0,i.useEffect)((()=>{document.title="My Booking - Bookings | HausMate"}),[]);const Ze=Le&&(null===(M=Le[0])||void 0===M?void 0:M.advance_booking_days),Je=z()().add(Ze-1,"day"),Qe=(0,k.Zp)(),Xe=async e=>{if(!oe)return D.Ay.error("You need to login before adding Items to your account"),!0;try{$e((0,Z.R9)([]));const t=await S.A.get_cart({order_id:e[0].order_id});$e((0,K.yr)(null===t||void 0===t?void 0:t.reorder_data)),$e((0,K.J3)("reorder")),(0,ee.dh)(at)}catch(t){console.log("error",t)}},et=e=>{const t=parseInt(e.split(":")[0]);return t>=0&&t<6?"Night":t<12?"Morning":t<14?"Noon":t<18?"Afternoon":t<20?"Evening":t<24?"Night":"Midnight"},[tt,st]=(0,i.useState)(!1),[it,at]=(0,i.useState)(!1),[nt,ot]=(0,i.useState)(!1),[lt,rt]=(0,i.useState)(!1),[dt,ct]=(0,i.useState)(!1),[ht,xt]=(0,i.useState)(!1),[ut,mt]=(0,i.useState)(!1);const pt=null===(R=V[0])||void 0===R?void 0:R.additional_charges,vt=(null===(P=V[0])||void 0===P||null===(B=P.additional_charges)||void 0===B?void 0:B.length)>0,[gt,jt]=(0,i.useState)(!1),yt=()=>{jt(!0)};return(0,i.useEffect)((()=>{}),[De]),(0,$.jsxs)(C.A,{children:[(0,$.jsxs)(d.A,{className:"mainContainer",children:[(0,$.jsxs)(c.Ay,{spacing:3,container:!0,children:[(0,$.jsx)(c.Ay,{item:!0,xs:12,md:4,children:(0,$.jsx)(N.A,{})}),(0,$.jsxs)(c.Ay,{item:!0,xs:12,md:8,children:[(0,$.jsx)(w.A,{heading:(0,f.t)("booking_information")}),(0,$.jsx)(h.A,{padding:2,maxWidth:"100%",borderColor:"#707070",className:"details_specific_service",borderRadius:"10px",marginBottom:"20px",children:V?V.map((e=>{var t,s,i,l,r,d;return(0,$.jsxs)(h.A,{border:"1px solid",borderColor:"#707070",borderRadius:3,children:[(0,$.jsxs)(h.A,{display:"flex",justifyContent:"space-between",p:1,maxWidth:"100%",sx:{flexDirection:{xs:"column",md:"row"}},alignItems:"center",mb:1,children:[(0,$.jsxs)(h.A,{display:"flex",sx:{flexDirection:{xs:"column",md:"row"},textAlign:{xs:"center",md:"left"}},alignItems:"center",children:[(0,$.jsx)(h.A,{height:"100px",width:"100px",children:(0,$.jsx)("img",{src:e.profile_image,height:"100%",width:"100%",alt:"serviceimage",className:"border-radius-10",onError:H.jM})}),(0,$.jsxs)(h.A,{display:"block",children:[(0,$.jsx)(x.A,{variant:"h5",ml:2,fontWeight:"bold",children:e.company_name}),(0,$.jsxs)(x.A,{ml:2,display:"flex",gap:1,children:[(0,$.jsxs)("span",{children:[(0,f.t)("invoice"),":"]}),(0,$.jsx)(h.A,{sx:{color:"#0277FA"},children:e.invoice_no})]}),(0,$.jsxs)(x.A,{ml:2,display:"flex",gap:1,children:[(0,$.jsxs)("span",{children:[(0,f.t)("service_at"),":"]}),(0,$.jsx)(h.A,{sx:{color:"#0277FA"},children:"0"==e.address_id?"STORE":"DOORSTEP"})]}),(0,$.jsxs)(x.A,{ml:2,mt:.2,sx:{color:"#0277FA"},fontWeight:"bolder",children:[ne," ",e.final_total]})]})]}),(0,$.jsxs)(h.A,{p:1,children:[(0,$.jsx)(u.A,{variant:"outlined",size:"small",sx:{width:"100%"},className:`mt-1 mr-1 ${(0,H.UB)(e.status)}`,children:(0,f.t)(e.status)}),"completed"!==e.status||"started"!==e.status||"awaiting"!==e.status||"confirmed"!==e.status?(0,$.jsx)(h.A,{children:"cancelled"!==e.status?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)($.Fragment,{children:"awaiting"==e.status||"confirmed"==e.status?(0,$.jsx)($.Fragment,{children:(0,$.jsx)(m.A,{variant:"contained",className:"reschedule",size:"small",sx:{fontSize:"small",border:" 1px solid",borderRadius:"5px",marginTop:"5px",fontWeight:"600",width:"100%"},color:"primary",onClick:t=>{(async e=>{ve(e),Ce(!ke)})(1),Ke(e.partner_id)},children:(0,f.t)("reschedule")},e.id)}):""}),1==e.is_cancelable?(0,$.jsx)(m.A,{variant:"contained",className:"button-background cancel-btn",size:"small",color:"error",onClick:e=>(async()=>{Te(!0),await S.A.change_order_status({order_id:se,status:"cancelled"}).then((e=>{var t;Te(!1),1==e.error?"string"==typeof e.message?D.Ay.error(e.message):Object.values(e.message).forEach((e=>{D.Ay.error(e)})):(q(null===e||void 0===e||null===(t=e.data)||void 0===t?void 0:t.data),D.Ay.success(e.message))}))})(),disabled:1==Fe,children:(0,$.jsx)($.Fragment,{children:(0,f.t)("cancel_order")})},e.id):""]}):null}):"","1"===ae&&(0,$.jsx)(h.A,{sx:{marginTop:"5px"},children:(0,$.jsxs)(u.A,{size:"medium",sx:{border:"1px solid #ffc200",color:"#bd8d00",backgroundColor:"#FFF3CD",textTransform:"none",width:"100%",height:"30.75px"},onClick:()=>(async e=>{try{await navigator.clipboard.writeText(e),D.Ay.success("OTP copied successfully!")}catch(t){D.Ay.error("Failed to copy OTP")}})(e.otp),children:[(0,f.t)("otp")," ",e.otp]})}),"completed"==e.status?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(u.A,{sx:{marginTop:"5px"},variant:"outlined",className:"button-background",size:"small",onClick:t=>(async()=>{Be(!0),await S.A.download_invoices({order_id:se}).then((async e=>{const t=new Blob([e],{type:"application/pdf"}),s=document.createElement("a");s.href=URL.createObjectURL(t),s.download=`eDemand-invoice-${se}.pdf`,document.body.appendChild(s),s.click(),document.body.removeChild(s),Be(!1)}))})(e.id),disabled:!0===Pe,children:!1===Pe?(0,$.jsxs)($.Fragment,{children:[(0,f.t)("download"),"",(0,f.t)("invoice")]}):(0,$.jsxs)($.Fragment,{children:[(0,f.t)("download"),(0,f.t)("invoice")]})},e.id),"1"===(null===e||void 0===e?void 0:e.is_reorder_allowed)&&(0,$.jsx)(h.A,{mt:1,children:(0,$.jsx)(u.A,{variant:"outlined",size:"medium",sx:{textTransform:"none",width:"100%",height:"30.75px"},onClick:()=>Xe(e.services),children:(0,f.t)("reorder")})})]}):null,le&&re&&(0,$.jsx)("div",{className:"chat_button",children:(0,$.jsxs)("button",{className:"",type:"button",onClick:t=>((e,t)=>{if(e.preventDefault(),!oe)return D.Ay.error("you need to login first!"),!1;try{(0,ue.zB)({booking_id:null===t||void 0===t?void 0:t.id,partner_id:null===t||void 0===t?void 0:t.partner_id,partner_name:null===t||void 0===t?void 0:t.company_name,image:null===t||void 0===t?void 0:t.profile_image,order_status:null===t||void 0===t?void 0:t.status}),Qe("/chat")}catch(s){console.log(s)}})(t,e),children:[(0,$.jsx)("span",{children:(0,f.t)("chat")}),(0,$.jsx)("span",{children:(0,$.jsx)(xe.liL,{size:18})})]})}),"booking_ended"===(null===(t=V[0])||void 0===t?void 0:t.status)&&(null===(s=V[0])||void 0===s?void 0:s.additional_charges.length)>0&&""===(null===(i=V[0])||void 0===i?void 0:i.payment_status_of_additional_charge)&&(0,$.jsx)("div",{className:"pay_pending_amount",onClick:()=>{yt()},children:(0,$.jsx)("button",{className:"",type:"button",children:(0,$.jsx)("span",{children:(0,f.t)("pay_pending_amount")})})})]})]}),(0,$.jsx)(p.A,{}),(0,$.jsxs)(h.A,{mx:1,my:2,px:2,maxWidth:"100%",display:"flex",flexDirection:"column",gap:2,children:[(0,$.jsxs)(h.A,{display:"flex",alignItems:"flex-start",gap:3,children:[(0,$.jsx)(a.A,{}),(0,$.jsxs)(h.A,{children:[(0,$.jsx)(x.A,{fontSize:"16px",fontWeight:"bold",children:e.new_start_time_with_date}),(0,$.jsx)(x.A,{variant:"caption",children:(0,f.t)("schedule")})]})]}),(0,$.jsxs)(h.A,{display:"flex",width:"100%",alignItems:"flex-start",gap:3,overflow:"auto",children:[(0,$.jsx)(n.A,{}),(0,$.jsx)(h.A,{children:"0"!=e.address_id?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(x.A,{fontSize:"16px",fontWeight:"bold",sx:{overflow:"hidden"},className:"booking-information",children:e.address}),(0,$.jsx)(x.A,{variant:"caption",className:"booking-information",children:(0,f.t)("address")})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(x.A,{fontSize:"16px",fontWeight:"bold",sx:{overflow:"hidden"},className:"booking-information",children:e.partner_address}),(0,$.jsx)(x.A,{variant:"caption",className:"booking-information",children:(0,f.t)("provider_address")})]})})]}),null!==e&&void 0!==e&&e.remarks?(0,$.jsxs)(h.A,{display:"flex",alignItems:"flex-start",gap:3,children:[(0,$.jsx)(o.A,{}),(0,$.jsxs)(h.A,{sx:{maxWidth:{xs:"80%",sm:"90%",md:"93%"}},children:[" ",(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(x.A,{fontSize:"16px",fontWeight:"bold",sx:{whiteSpace:"pre-line",wordWrap:"break-word"},children:e.remarks}),(0,$.jsx)(x.A,{variant:"caption",children:(0,f.t)("notes")})]})]})]}):null]}),(0,$.jsxs)(h.A,{mx:1,my:2,px:2,maxWidth:"100%",display:"flex",flexDirection:"column",gap:2,children:[e&&(null===e||void 0===e||null===(l=e.work_started_proof)||void 0===l?void 0:l.length)>0?(0,$.jsx)($.Fragment,{children:(0,$.jsxs)(h.A,{className:"started_proof",children:[(0,$.jsx)(x.A,{fontSize:"16px",fontWeight:"bold",children:(0,f.t)("work_start_proof")}),(0,$.jsx)(J.A,{urls:e.work_started_proof})]})}):null,e&&(null===e||void 0===e||null===(r=e.work_completed_proof)||void 0===r?void 0:r.length)>0?(0,$.jsx)($.Fragment,{children:(0,$.jsxs)(h.A,{className:"completed_proof",children:[(0,$.jsx)(x.A,{fontSize:"16px",fontWeight:"bold",children:(0,f.t)("work_complete_proof")}),(0,$.jsx)(J.A,{urls:e.work_completed_proof})]})}):null]}),(0,$.jsx)(p.A,{}),(0,$.jsx)(h.A,{mt:1,ml:3,mr:3,children:(0,$.jsx)(h.A,{mt:2,mb:2,children:e&&e.services.map((t=>(0,$.jsxs)(h.A,{display:"flex",sx:{justifyContent:"space-between",flexDirection:{xs:"column",md:"row"}},gap:2,mb:2,children:[(0,$.jsx)(h.A,{children:me?(0,$.jsx)($.Fragment,{children:(0,$.jsxs)("div",{className:"custom_service_spec_details",children:[(0,$.jsxs)("div",{className:"title_desc",children:[(0,$.jsx)("span",{className:"title",children:(0,f.t)("req_serv_title")}),(0,$.jsxs)("span",{className:"value",children:[" ",null===t||void 0===t?void 0:t.service_title]})]}),(0,$.jsxs)("div",{className:"title_desc",children:[(0,$.jsx)("span",{className:"title",children:(0,f.t)("req_serv_desc")}),(0,$.jsxs)("span",{className:"value",children:[" ",null===t||void 0===t?void 0:t.service_short_description]})]}),(0,$.jsxs)("div",{className:"title_desc",children:[(0,$.jsx)("span",{className:"title",children:(0,f.t)("provider_note")}),(0,$.jsxs)("span",{className:"value",children:[" ",null===t||void 0===t?void 0:t.note]})]})]})}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(x.A,{children:t.service_title}),(0,$.jsxs)(x.A,{children:[t.quantity," * ",ne,t.price_with_tax]})]})}),(0,$.jsxs)(h.A,{children:[!me&&(0,$.jsxs)(x.A,{color:"var(--global-theme)",fontWeight:"bold",children:[ne," ",t.price_with_tax]}),"completed"==e.status?(0,$.jsx)(u.A,{variant:"contained",className:"button-background",size:"small",sx:{backgroundColor:L.palette.background.buttonColor,"&:hover":{backgroundColor:L.palette.background.buttonColor}},onClick:s=>((e,t)=>{ve(e),je(t),be(!ye)})(t,e.company_name),children:(0,f.t)("rate")},t.id):""]})]},t.id)))})}),(0,$.jsx)(p.A,{}),(0,$.jsx)(h.A,{bgcolor:"#2560FC1A",children:(0,$.jsxs)("div",{className:"summry_div",children:[(0,$.jsxs)("div",{className:"details",children:[(0,$.jsx)("div",{className:"title",children:(0,$.jsx)(x.A,{fontWeight:"bold",className:"booking-information",children:(0,f.t)("sub_total")})}),(0,$.jsx)("div",{className:"value",children:(0,$.jsxs)(x.A,{className:"booking-information textEnd",color:"var(--global-theme)",fontWeight:"bold",children:[ne,(0,H.ej)((null===e||void 0===e?void 0:e.total)-(null===e||void 0===e?void 0:e.tax_amount))]})})]}),0!=(null===e||void 0===e?void 0:e.tax_amount)&&(0,$.jsxs)("div",{className:"details",children:[(0,$.jsx)("div",{className:"title",children:(0,$.jsx)(x.A,{fontWeight:"bold",className:"booking-information",children:(0,f.t)("Tax")})}),(0,$.jsx)("div",{className:"value",children:(0,$.jsxs)(x.A,{className:"booking-information textEnd",color:"var(--global-theme)",fontWeight:"bold",children:["+ ",ne,(0,H.ej)(null===e||void 0===e?void 0:e.tax_amount)]})})]}),0!=(null===e||void 0===e?void 0:e.visiting_charges)&&(0,$.jsxs)("div",{className:"details",children:[(0,$.jsx)("div",{className:"title",children:(0,$.jsx)(x.A,{fontWeight:"bold",className:"booking-information",children:(0,f.t)("visiting_charge")})}),(0,$.jsx)("div",{className:"value",children:(0,$.jsxs)(x.A,{className:"booking-information textEnd",color:"var(--global-theme)",fontWeight:"bold",children:["+ ",ne,(0,H.ej)(null===e||void 0===e?void 0:e.visiting_charges)]})})]}),vt&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)("div",{className:"details",children:(0,$.jsx)("div",{className:"title",children:(0,$.jsx)(x.A,{fontWeight:"bold",className:"booking-information",children:(0,f.t)("additionalCharges")})})}),(0,$.jsxs)(h.A,{children:[pt&&pt.map((e=>(0,$.jsxs)(h.A,{display:"flex",sx:{justifyContent:"space-between",flexDirection:{xs:"column",md:"row"}},gap:2,children:[(0,$.jsx)(h.A,{children:(0,$.jsx)(x.A,{children:null===e||void 0===e?void 0:e.name})}),(0,$.jsx)(h.A,{children:(0,$.jsxs)(x.A,{className:"booking-information textEnd",children:[ne," ",null===e||void 0===e?void 0:e.charge]})})]},null===e||void 0===e?void 0:e.id))),(0,$.jsxs)(h.A,{display:"flex",sx:{justifyContent:"space-between",flexDirection:{xs:"column",md:"row"}},gap:2,children:[(0,$.jsx)(h.A,{children:(0,$.jsxs)(x.A,{fontWeight:"bold",children:[" ",(0,f.t)("totalAdditionalCharges")]})}),(0,$.jsx)(h.A,{children:(0,$.jsxs)(x.A,{className:"booking-information textEnd",color:"var(--global-theme)",fontWeight:"bold",children:["+ ",ne," ",null===(d=V[0])||void 0===d?void 0:d.total_additional_charge]})})]})]})]}),""!==e.promo_code&&(0,$.jsxs)("div",{className:"details",children:[(0,$.jsx)("div",{className:"title",children:(0,$.jsx)(x.A,{className:"booking-information",fontWeight:"bold",children:(0,f.t)("promo_code_discount")})}),(0,$.jsx)("div",{className:"value",children:(0,$.jsxs)(x.A,{className:"booking-information textEnd",color:"var(--global-theme)",fontWeight:"bold",children:["- ",ne,e.promo_discount]})})]}),(0,$.jsxs)("div",{className:"details",children:[(0,$.jsx)("div",{className:"title",children:(0,$.jsx)(x.A,{className:"booking-information",color:"var(--global-theme)",fontWeight:"bold",children:(0,f.t)("total")})}),(0,$.jsx)("div",{className:"value",children:(0,$.jsxs)(x.A,{className:"booking-information textEnd",color:"var(--global-theme)",fontWeight:"bold",children:[ne,(0,H.ej)(e.final_total)]})})]}),(0,$.jsxs)("div",{className:"details",children:[(0,$.jsx)("div",{className:"title",children:(0,$.jsxs)(x.A,{className:"booking-information",sx:{display:"flex",gap:"3px"},children:[(0,$.jsx)(x.A,{fontWeight:"bold",children:(0,f.t)("paymentStatus")})," ",":"," ",(0,$.jsxs)(x.A,{fontWeight:"bold",color:"var(--global-theme)",children:[" ",(0,H.jR)(V[0].payment_method)]})]})}),(0,$.jsxs)("div",{className:"value",children:["success"===V[0].payment_status&&(0,$.jsx)("div",{className:"payment_status_success",children:(0,$.jsx)("span",{children:V[0].payment_status})}),"failed"===V[0].payment_status&&(0,$.jsx)("div",{className:"payment_status_failed",children:(0,$.jsx)("span",{children:V[0].payment_status})}),""===V[0].payment_status||"pending"===V[0].payment_status?(0,$.jsx)("div",{className:"payment_status_pending",children:(0,$.jsx)("span",{children:(0,f.t)("pending")})}):null]})]}),""!==V[0].payment_status_of_additional_charge?(0,$.jsxs)("div",{className:"details",children:[(0,$.jsx)("div",{className:"title",children:(0,$.jsxs)(x.A,{className:"booking-information",sx:{display:"flex",gap:"3px"},children:[(0,$.jsx)(x.A,{fontWeight:"bold",children:(0,f.t)("additionalChargePaymentStatus")})," ",":"," ",(0,$.jsxs)(x.A,{fontWeight:"bold",color:"var(--global-theme)",children:[" ",(0,H.jR)(V[0].payment_method_of_additional_charge)]})]})}),(0,$.jsx)("div",{className:"value",children:(0,$.jsxs)(x.A,{className:"booking-information textEnd",fontWeight:"bold",children:["0"===V[0].payment_status_of_additional_charge&&(0,$.jsx)("div",{className:"payment_status_pending",children:(0,$.jsx)("span",{children:(0,f.t)("pending")})}),"1"===V[0].payment_status_of_additional_charge&&(0,$.jsx)("div",{className:"payment_status_success",children:(0,$.jsx)("span",{children:(0,f.t)("success")})}),"2"===V[0].payment_status_of_additional_charge&&(0,$.jsx)("div",{className:"payment_status_failed",children:(0,$.jsx)("span",{children:(0,f.t)("failed")})})]})})]}):null]})})]},e.id)})):(0,$.jsxs)(h.A,{className:"textaling-center minHeight-550",display:"flex",flexDirection:"column",gap:3,children:[(0,$.jsx)("h2",{children:(0,f.t)("no_bookings_yet")}),(0,$.jsx)(h.A,{display:"flex",justifyContent:"center",textAlign:"center",children:(0,$.jsx)("img",{src:he,height:"300px",width:"300px",alt:"no bookings",onError:H.jM})}),(0,$.jsx)("p",{children:(0,f.t)("book_first_service")}),(0,$.jsx)(u.A,{variant:"outlined",onClick:()=>Qe("/providers"),children:(0,f.t)("explore")})]})})]})]}),!0===ye?(0,$.jsx)(G,{open:ye,setOpen:be,service:pe,company:ge}):"",ke&&(0,$.jsxs)(v.A,{maxWidth:"lg",sx:{"& .MuiDialog-container":{"& .MuiPaper-root":{margin:{xs:1}}},maxWidth:{xs:"100%",md:"100%"}},open:ke,children:[(0,$.jsx)(g.A,{children:(0,$.jsxs)(h.A,{display:"flex",justifyContent:"space-between",children:[(0,$.jsx)(x.A,{variant:"h6",children:(0,f.t)("order_reschedule")}),(0,$.jsx)(m.A,{"aria-label":"Close Button",onClick:e=>Ce(!ke),children:(0,$.jsx)(l.A,{})})]})}),(0,$.jsx)(p.A,{}),(0,$.jsx)(h.A,{sx:{width:{xs:"100%",md:700}},display:"flex",flexDirection:"column",gap:3,m:1,children:(0,$.jsxs)(h.A,{children:[(0,$.jsxs)(j.A,{htmlFor:"select_date",children:[" ",(0,f.t)("select_date")]}),(0,$.jsx)(h.A,{sx:{mt:1},children:(0,$.jsx)(E.Ay,{value:Ge||z()(Ve),onChange:e=>{var t;t=e,Ye(z()(t).format("YYYY-MM-DD"))},tileDisabled:e=>{let{date:t,view:s}=e;return(e=>{const t=z()().startOf("day");return e.isBefore(t)||e.isAfter(Je)})(z()(t))},prev2Label:null,next2Label:null})}),(0,$.jsxs)(j.A,{htmlFor:"time",sx:{py:"15px"},children:[" ",(0,f.t)("select_time")]}),(0,$.jsx)(h.A,{className:"slot_data",children:De&&0!==(null===De||void 0===De?void 0:De.length)?De.map(((e,t)=>(0,$.jsxs)(h.A,{sx:{width:{xs:"46%",md:"15%"},display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",border:"1px solid",borderRadius:"15px",p:1,backgroundColor:0===e.is_available?"gray":""},children:[(0,$.jsx)(y.A,{checked:t===fe,onChange:()=>((e,t)=>{we(t),Se(e.time)})(e,t),value:t,name:"radio-buttons",inputProps:{"aria-label":e.time},disabled:0===e.is_available,sx:{p:"2px"}}),(0,$.jsx)(p.A,{sx:{width:"100%"}}),(0,$.jsxs)(h.A,{pt:"5px",textAlign:"center",children:[(0,$.jsx)(x.A,{variant:"subtitle2",children:et(e.time)}),(0,$.jsx)(x.A,{variant:"body2",children:e.time})]})]},e.time))):(0,$.jsx)(h.A,{display:"flex",justifyContent:"center",alignItems:"center",textAlign:"center",children:(0,$.jsxs)(h.A,{children:[(0,$.jsx)(_.A,{sx:{boxShadow:"none"},children:(0,$.jsx)(A.A,{component:"img",src:he,alt:"no time slot",sx:{width:260,height:260}})}),(0,$.jsx)(x.A,{variant:"h6",sx:{width:260},children:We})]})})}),(0,$.jsx)(h.A,{mt:2,children:(0,$.jsxs)(u.A,{variant:"contained",onClick:e=>(async()=>{if(""===Ne)return D.Ay.error("Please select a time from the available slots");Oe(!0);try{const t=await S.A.checkSlots({partner_id:Me,date:Ve,time:Ne,order_id:se,custom_job_request_id:me||""});Oe(!1),t.error&&D.Ay.error(t.message);const s=await S.A.change_order_status({order_id:se,status:"rescheduled",date:Ve,time:Ne});var e;Oe(!1),s.error?"string"===typeof s.message?D.Ay.error(s.message):Object.values(s.message).forEach((e=>{D.Ay.error(e)})):(D.Ay.success(s.message),q(null===s||void 0===s||null===(e=s.data)||void 0===e?void 0:e.data),Ce(!ke))}catch(t){Oe(!1),D.Ay.error("An error occurred while processing your request.")}})(),disabled:1==Ie,startIcon:1==Ie?(0,$.jsx)(Ae.A,{}):"",children:[(0,f.t)("change_schedule")," "]})})]})})]}),(0,$.jsx)(b.Ay,{open:it,anchor:U?"left":"right",sx:{display:{xs:"block",sm:"block"},"& .MuiDrawer-paper":{boxSizing:"border-box",width:{md:580,xs:"100%"}}},children:(0,$.jsx)(h.A,{children:(0,$.jsx)(de,{setCart:st,setForm:at,isSelectedSlote:xt,continueFun:function(){(0,ee.ho)(at),(0,ee.dh)(rt)},MyFun:function(){(0,ee.dh)(mt),(0,ee.ho)(at)},setBooking:rt})})}),(0,$.jsx)(b.Ay,{open:ht,anchor:U?"left":"right",sx:{display:{xs:"block",sm:"block"},"& .MuiDrawer-paper":{boxSizing:"border-box",width:{md:580,xs:"100%"}}},children:(0,$.jsx)(h.A,{children:(0,$.jsx)(Q.A,{setForm:at,isSelectSlote:xt,booking:function(){(0,ee.ho)(xt),(0,ee.dh)(rt)}})})}),(0,$.jsx)(b.Ay,{open:ut,anchor:U?"left":"right",sx:{display:{xs:"block",sm:"block"},"& .MuiDrawer-paper":{boxSizing:"border-box",width:{md:580,xs:"100%"}}},children:(0,$.jsx)(h.A,{children:(0,$.jsx)(te.A,{CompleteAddress:function(){(0,ee.ho)(mt),(0,ee.dh)(ot)},setForm:at,addAddress:mt})})}),(0,$.jsx)(b.Ay,{open:lt,anchor:U?"left":"right",sx:{display:{xs:"block",sm:"block"},"& .MuiDrawer-paper":{boxSizing:"border-box",width:{md:580,xs:"100%"}}},children:(0,$.jsx)(h.A,{children:(0,$.jsx)(ce.A,{setForm:at,setBooking:rt,setPromo:ct,isAdditionalCharges:vt,bookingInfo:V})})}),(0,$.jsx)(b.Ay,{open:dt,anchor:U?"left":"right",sx:{display:{xs:"block",sm:"block"},"& .MuiDrawer-paper":{boxSizing:"border-box",width:{md:580,xs:"100%"}}},children:(0,$.jsx)(h.A,{children:(0,$.jsx)(X.A,{setBooking:rt,setPromo:ct})})})]}),(0,$.jsx)(_e,{AdditionalModalOpen:gt,close:()=>{jt(!1)},data:V[0],isAdditionalCharges:vt})]})}},48729:(e,t,s)=>{s.d(t,{A:()=>c});var i=s(65043),a=s(22963),n=s.n(a),o=s(77548),l=s(46941),r=s(19540),d=s(70579);n().setAppElement("#root");const c=e=>{var t;let{urls:s}=e;const[a,n]=(0,i.useState)(!1),[c,h]=(0,i.useState)(0),[x,u]=(0,i.useState)(!1),[m,p]=(0,i.useState)(""),v=null===s||void 0===s||null===(t=s.filter((e=>(0,l.Ir)(e)===l.id.IMAGE)))||void 0===t?void 0:t.map((e=>({src:e})));return(0,d.jsxs)("div",{className:"main-lightbox",children:[(0,d.jsx)("div",{className:"all-images",children:(()=>{try{return s.map(((e,t)=>{const s=(0,l.Ir)(e);return(0,d.jsx)("div",{onClick:()=>((e,t,s)=>{try{t===l.id.IMAGE?(h(s),n(!0)):t===l.id.VIDEO&&(p(e),u(!0))}catch(i){console.error("Error handling click:",i)}})(e,s,t),className:"parent_div",children:s===l.id.IMAGE?(0,d.jsx)("img",{src:e,alt:"work evidence",onError:l.jM}):(0,d.jsx)("video",{className:"video_data",src:e})},t)}))}catch(e){return console.error("Error rendering URLs:",e),null}})()}),a&&(0,d.jsx)(d.Fragment,{children:(0,d.jsx)(r.A,{lightboxOpen:a,currentImages:v,currentImageIndex:c,handleCloseLightbox:()=>n(!1),gotoNext:()=>h((e=>(e+1)%(null===v||void 0===v?void 0:v.length))),gotoPrevious:()=>{const e=(c+(null===v||void 0===v?void 0:v.length)-1)%(null===v||void 0===v?void 0:v.length);h(e)}})}),x&&(0,d.jsx)(o.A,{isOpen:x,videoUrl:m,onClose:()=>u(!1)})]})}},77548:(e,t,s)=>{s.d(t,{A:()=>c});var i=s(49788),a=s(44978),n=s(65043),o=s(85369),l=s(22963),r=s.n(l),d=s(70579);const c=e=>{let{isOpen:t,videoUrl:s,onClose:l}=e;const c=(0,n.useRef)(null);return(0,n.useEffect)((()=>{if(t&&c.current){const e=c.current;if(i.Ay.isSupported()){const t=new i.Ay;t.loadSource(s),t.attachMedia(e),t.on(i.Ay.Events.MANIFEST_PARSED,(()=>{e.play()}))}else e.canPlayType("application/vnd.apple.mpegurl")&&(e.src=s,e.addEventListener("loadedmetadata",(()=>{e.play()})))}}),[t,s]),(0,d.jsx)(r(),{isOpen:t,onRequestClose:l,contentLabel:"Video Modal",children:(0,d.jsxs)("div",{className:"video_parent",children:[(0,d.jsxs)("video",{ref:c,controls:!0,className:"video_controls",children:[(0,d.jsx)("source",{src:s,type:"video/mp4"}),(0,d.jsx)("source",{src:s,type:"video/webm"}),(0,d.jsx)("source",{src:s,type:"video/ogg"}),(0,d.jsx)("source",{src:s,type:"video/3gpp"}),(0,d.jsx)("source",{src:s,type:"video/x-msvideo"}),(0,d.jsx)("source",{src:s,type:"video/x-matroska"}),(0,d.jsx)("source",{src:s,type:"video/quicktime"}),(0,d.jsx)("source",{src:s,type:"video/x-flv"}),(0,a.t)("browser_not_support_tag")]}),(0,d.jsxs)("button",{onClick:l,className:"close_button",children:[" ",(0,d.jsx)(o.QCr,{})]})]})})}}}]);
//# sourceMappingURL=929.ec8b7802.chunk.js.map