1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[561],{3588:(e,a,n)=>{"use strict";n.r(a),n.d(a,{__N_SSP:()=>ei,default:()=>er});var t=n(7876),l=n(4232),s=n(9099),o=n(1188),i=n(7514),r=n(9917),c=n(3732),d=n(4587),m=n.n(d),g=n(6838);let b=(0,g.A)("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);var x=n(8170),u=n(2759);let h=(0,g.A)("EllipsisVertical",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]]);var p=n(3818),k=n(1359),f=n(2579),j=n(714),y=n(1844),N=n(3716),v=n(8162),w=n(1676),C=n(7552),I=n(6822),_=n(6326),S="Checkbox",[D,E]=(0,y.A)(S),[A,T]=D(S),R=l.forwardRef((e,a)=>{let{__scopeCheckbox:n,name:s,checked:o,defaultChecked:i,required:r,disabled:c,value:d="on",onCheckedChange:m,form:g,...b}=e,[x,u]=l.useState(null),h=(0,j.s)(a,e=>u(e)),p=l.useRef(!1),k=!x||g||!!x.closest("form"),[f,y]=(0,v.i)({prop:o,defaultProp:i??!1,onChange:m,caller:S}),w=l.useRef(f);return l.useEffect(()=>{let e=x?.form;if(e){let a=()=>y(w.current);return e.addEventListener("reset",a),()=>e.removeEventListener("reset",a)}},[x,y]),(0,t.jsxs)(A,{scope:n,state:f,disabled:c,children:[(0,t.jsx)(_.sG.button,{type:"button",role:"checkbox","aria-checked":q(f)?"mixed":f,"aria-required":r,"data-state":B(f),"data-disabled":c?"":void 0,disabled:c,value:d,...b,ref:h,onKeyDown:(0,N.m)(e.onKeyDown,e=>{"Enter"===e.key&&e.preventDefault()}),onClick:(0,N.m)(e.onClick,e=>{y(e=>!!q(e)||!e),k&&(p.current=e.isPropagationStopped(),p.current||e.stopPropagation())})}),k&&(0,t.jsx)(O,{control:x,bubbles:!p.current,name:s,value:d,checked:f,required:r,disabled:c,form:g,style:{transform:"translateX(-100%)"},defaultChecked:!q(i)&&i})]})});R.displayName=S;var P="CheckboxIndicator",L=l.forwardRef((e,a)=>{let{__scopeCheckbox:n,forceMount:l,...s}=e,o=T(P,n);return(0,t.jsx)(I.C,{present:l||q(o.state)||!0===o.state,children:(0,t.jsx)(_.sG.span,{"data-state":B(o.state),"data-disabled":o.disabled?"":void 0,...s,ref:a,style:{pointerEvents:"none",...e.style}})})});L.displayName=P;var O=l.forwardRef(({__scopeCheckbox:e,control:a,checked:n,bubbles:s=!0,defaultChecked:o,...i},r)=>{let c=l.useRef(null),d=(0,j.s)(c,r),m=(0,w.Z)(n),g=(0,C.X)(a);l.useEffect(()=>{let e=c.current;if(!e)return;let a=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"checked").set;if(m!==n&&a){let t=new Event("click",{bubbles:s});e.indeterminate=q(n),a.call(e,!q(n)&&n),e.dispatchEvent(t)}},[m,n,s]);let b=l.useRef(!q(n)&&n);return(0,t.jsx)(_.sG.input,{type:"checkbox","aria-hidden":!0,defaultChecked:o??b.current,...i,tabIndex:-1,ref:d,style:{...i.style,...g,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});function q(e){return"indeterminate"===e}function B(e){return q(e)?"indeterminate":e?"checked":"unchecked"}O.displayName="CheckboxBubbleInput";var F=n(5755),W=n(5565);let M=l.forwardRef((e,a)=>{let{className:n,...l}=e;return(0,t.jsx)(R,{ref:a,className:(0,W.cn)("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground be-ui-checkbox",n),...l,children:(0,t.jsx)(L,{className:(0,W.cn)("flex items-center justify-center text-current be-ui-checkbox-indicator"),children:(0,t.jsx)(F.A,{className:"h-4 w-4 be-ui-checkbox-check-icon"})})})});M.displayName=R.displayName;var $=n(2285),z=n(5734),U=n(6690),G=n(6983),J=n(1006);function V(e){var a;let{open:n,onClose:l,onConfirm:s,bookingDetails:o,selectedBookingIds:i,cancellationDetails:c,isLoading:d,isSingleBooking:m,propertyName:g,cancellationPolicy:b}=e,{initialData:x}=(0,U.B)(),{themeColor:u}=x,{formatPriceWithCode:h,formatPriceWithoutCode:p}=(0,J.f)(),k=o.bookings.filter(e=>i.includes(e.booking.bookingId)),f=k.reduce((e,a)=>e+a.booking.totalAmount,0),j=k.reduce((e,a)=>e+a.booking.amountPaid,0),y=c.filter(e=>i.includes(e.booking_id)).reduce((e,a)=>e+a.total_cancellation_penalty,0),N=c.filter(e=>i.includes(e.booking_id)).reduce((e,a)=>e+a.pg_fee,0),v=j-y,w=(null==o?void 0:o.amountPaid)-(null==(a=c[0])?void 0:a.total_cancellation_penalty);return(0,t.jsx)(z.lG,{open:n,onOpenChange:l,children:(0,t.jsxs)(z.Cf,{className:"max-w-2xl be-manage-cancel-booking-dialog-content",children:[(0,t.jsx)(G.A,{loading:d}),(0,t.jsx)(z.c7,{className:"be-manage-cancel-booking-dialog-header",children:(0,t.jsx)("h2",{className:"text-lg text-center font-semibold be-manage-cancel-booking-dialog-title",children:"Cancel Booking"})}),(0,t.jsx)($.w,{className:"be-manage-cancel-booking-dialog-separator"}),(0,t.jsx)("div",{className:"p-6 be-manage-cancel-booking-dialog-body",children:(0,t.jsxs)("div",{className:"space-y-4 be-manage-cancel-booking-dialog-content",children:[(0,t.jsxs)("div",{className:"grid grid-cols-2 pb-4 gap-6 border-b-[1px] border-[#d9d9d9] border-dotted be-manage-cancel-booking-dialog-info-grid",children:[(0,t.jsxs)("div",{className:"md:pr-6 md:border-r md:border-dotted md:border-[#d9d9d9] be-manage-cancel-booking-dialog-guest-section",children:[(0,t.jsx)("h3",{className:"text-sm text-gray-500 mb-1 be-manage-cancel-booking-dialog-guest-label",children:"Guest Information"}),(0,t.jsx)("h3",{className:"font-semibold break-all be-manage-cancel-booking-dialog-guest-name",children:o.guestDetails.name}),(0,t.jsx)("p",{className:"text-gray-700 break-all be-manage-cancel-booking-dialog-guest-email",children:o.guestDetails.email}),(0,t.jsx)("p",{className:"text-gray-700 break-all be-manage-cancel-booking-dialog-guest-phone",children:o.guestDetails.phone})]}),(0,t.jsxs)("div",{className:"md:pl-6 flex flex-col items-end whitespace-nowrap be-manage-cancel-booking-dialog-booking-section",children:[(0,t.jsx)("h2",{className:"text-sm text-gray-500 mb-1 be-manage-cancel-booking-dialog-booking-label",children:i.length>1?"Itinerary ID":"Booking ID"}),(0,t.jsx)("h3",{className:"font-semibold be-manage-cancel-booking-dialog-booking-id",children:i.length>1?o.bookingId:i[0]})]})]}),(0,t.jsxs)("div",{className:"be-manage-cancel-booking-dialog-reservations-section",children:[(0,t.jsxs)("h3",{className:"mb-2 be-manage-cancel-booking-dialog-reservations-title",children:["Your reservations at the following"," ",k.length>1?"hotels":"hotel"," will be cancelled:"]}),(0,t.jsxs)("ul",{className:"list-disc pl-9 space-y-1 be-manage-cancel-booking-dialog-reservations-list",children:[k.map(e=>{var a;return(0,t.jsx)("li",{className:"font-medium be-manage-cancel-booking-dialog-reservation-item",children:null==(a=e.content[e.booking.propertyId.toString()])?void 0:a["en-US"].name},e.booking.bookingId)}),m&&(0,t.jsx)("li",{className:"font-medium be-manage-cancel-booking-dialog-single-reservation-item",children:g})]})]}),(0,t.jsx)("div",{className:"be-manage-cancel-booking-dialog-refund-section",children:(0,t.jsxs)("p",{className:"be-manage-cancel-booking-dialog-refund-text",children:["The refundable amount will be"," ",m?(0,t.jsx)("b",{className:"be-manage-cancel-booking-dialog-refund-amount",children:h(w)}):(0,t.jsx)("b",{className:"be-manage-cancel-booking-dialog-refund-amount",children:h(v)})]})}),(0,t.jsxs)("div",{className:"border rounded-md p-4 space-y-2 text-sm be-manage-cancel-booking-dialog-breakdown",children:[(0,t.jsxs)("div",{className:"flex justify-between be-manage-cancel-booking-dialog-breakdown-total",children:[(0,t.jsx)("span",{className:"be-manage-cancel-booking-dialog-breakdown-total-label",children:"Total booking amount"}),m?(0,t.jsx)("span",{className:"be-manage-cancel-booking-dialog-breakdown-total-value",children:p(o.totalAmount)}):(0,t.jsx)("span",{className:"be-manage-cancel-booking-dialog-breakdown-total-value",children:p(f)})]}),(0,t.jsxs)("div",{className:"flex justify-between be-manage-cancel-booking-dialog-breakdown-collected",children:[(0,t.jsx)("span",{className:"be-manage-cancel-booking-dialog-breakdown-collected-label",children:"Amount collected from guest"}),m?(0,t.jsx)("span",{className:"be-manage-cancel-booking-dialog-breakdown-collected-value",children:p(o.amountPaid)}):(0,t.jsx)("span",{className:"be-manage-cancel-booking-dialog-breakdown-collected-value",children:p(j)})]}),(0,t.jsxs)("div",{className:"flex justify-between be-manage-cancel-booking-dialog-breakdown-penalty",children:[(0,t.jsx)("span",{className:"be-manage-cancel-booking-dialog-breakdown-penalty-label",children:"Cancellation penalty"}),m?(0,t.jsx)("span",{className:"be-manage-cancel-booking-dialog-breakdown-penalty-value",children:p(c[0].total_cancellation_penalty)}):(0,t.jsx)("span",{className:"be-manage-cancel-booking-dialog-breakdown-penalty-value",children:p(y)})]}),(0,t.jsxs)("div",{className:"flex justify-between be-manage-cancel-booking-dialog-breakdown-fees",children:[(0,t.jsx)("span",{className:"be-manage-cancel-booking-dialog-breakdown-fees-label",children:"Payment gateway fees"}),m?(0,t.jsx)("span",{className:"be-manage-cancel-booking-dialog-breakdown-fees-value",children:p(c[0].pg_fee)}):(0,t.jsx)("span",{className:"be-manage-cancel-booking-dialog-breakdown-fees-value",children:p(N)})]}),(0,t.jsxs)("div",{className:"flex justify-between font-medium be-manage-cancel-booking-dialog-breakdown-refund",children:[(0,t.jsx)("span",{className:"be-manage-cancel-booking-dialog-breakdown-refund-label",children:"Refund amount"}),m?(0,t.jsx)("span",{className:"be-manage-cancel-booking-dialog-breakdown-refund-value",children:p(w)}):(0,t.jsx)("span",{className:"be-manage-cancel-booking-dialog-breakdown-refund-value",children:p(v)})]})]}),(0,t.jsxs)("div",{className:"be-manage-cancel-booking-dialog-rules-section",children:[(0,t.jsx)("h3",{className:"font-medium mb-2 be-manage-cancel-booking-dialog-rules-title",children:"Cancellation Rules"}),k.map(e=>{var a,n,l,s,o,i;return(0,t.jsxs)("div",{className:"mb-4 last:mb-0 be-manage-cancel-booking-dialog-rule-item",children:[(0,t.jsx)("h4",{className:"text-sm font-bold mb-1 be-manage-cancel-booking-dialog-rule-hotel-name",children:null==(a=e.content[e.booking.propertyId.toString()])?void 0:a["en-US"].name}),(0,t.jsx)("p",{className:"text-sm text-gray-600 be-manage-cancel-booking-dialog-rule-description",children:(null==(i=e.booking.lineItems)||null==(o=i[0])||null==(s=o.room)||null==(l=s.rate_plan)||null==(n=l.penalty)?void 0:n.description)||"Cancellation policy not available."})]},e.booking.bookingId)}),m&&(0,t.jsx)("p",{className:"text-sm text-gray-600 be-manage-cancel-booking-dialog-single-rule",children:b})]})]})}),(0,t.jsx)($.w,{className:"be-manage-cancel-booking-dialog-separator"}),(0,t.jsxs)(z.Es,{className:"gap-2 sm:gap-0 be-manage-cancel-booking-dialog-footer",children:[(0,t.jsx)(r.$,{variant:"ghost",onClick:l,style:{color:u},className:"be-manage-cancel-booking-dialog-close-button",children:"Close"}),(0,t.jsx)(r.$,{onClick:s,style:{background:u},className:"be-manage-cancel-booking-dialog-confirm-button",children:"Cancel Booking"})]})]})})}var H=n(704),Y=n(6455);function K(e){let{open:a,onClose:n,handleSubmit:l,request:s,setRequest:o,setIsRequestChangeDialogOpen:i,isLoading:c}=e,{allButtonsBgColor:d,allButtonsTextColor:m,allButtonsBorderColor:g,allButtonsBorderStyle:b,allButtonsBorderWidth:x,allButtonsTextFontWeight:u,allButtonsHoverTextColor:h,allButtonsHoverBgColor:p}=(0,Y.A)();return(0,t.jsx)(z.lG,{open:a,onOpenChange:i,children:(0,t.jsxs)(z.Cf,{className:"max-w-2xl be-manage-request-change-dialog-content",children:[(0,t.jsx)(G.A,{loading:c}),(0,t.jsx)(z.c7,{className:"be-manage-request-change-dialog-header",children:(0,t.jsx)(z.L3,{className:"text-lg font-semibold text-center be-manage-request-change-dialog-title",children:"Request a Change"})}),(0,t.jsx)($.w,{className:"be-manage-request-change-dialog-separator"}),(0,t.jsxs)("div",{className:"flex flex-col md:flex-row p-6 be-manage-request-change-dialog-body",children:[(0,t.jsxs)("label",{className:"font-md be-manage-request-change-dialog-label",children:["Booking amendment request",(0,t.jsx)("span",{className:"text-red-500 be-manage-request-change-dialog-required",children:"*"})]}),(0,t.jsx)(H.T,{value:s,onChange:e=>o(e.target.value),placeholder:"Enter your request...",className:"h-24 border rounded-md p-2 be-manage-request-change-dialog-textarea"})]}),(0,t.jsx)($.w,{className:"be-manage-request-change-dialog-separator"}),(0,t.jsxs)(z.Es,{className:"flex justify-end md:space-x-4 be-manage-request-change-dialog-footer",children:[(0,t.jsx)(r.$,{variant:"ghost",onClick:n,hoverBgColor:p,hoverTextColor:h,bgColor:d,textColor:m,borderColor:g,borderStyle:b,borderWidth:x,fontWeight:u,className:"be-manage-request-change-dialog-close-button",children:"Close"}),(0,t.jsx)(r.$,{disabled:!s||""===s.trim(),onClick:l,hoverBgColor:p,hoverTextColor:h,bgColor:d,textColor:m,borderColor:g,borderStyle:b,borderWidth:x,fontWeight:u,className:"be-manage-request-change-dialog-submit-button",children:"Submit Amendment Request"})]})]})})}var X=n(379);let Z=e=>{let a=(0,X.gv)(e),n=a.getDate(),t=new Intl.DateTimeFormat("en-US",{month:"short"}).format(a),l=a.getFullYear(),s=new Intl.DateTimeFormat("en-US",{weekday:"short"}).format(a);return"".concat(n," ").concat(t," ").concat(l,", ").concat(s)};var Q=n(3344);let ee=e=>{var a;let{lineItem:n,index:s,bookingDetails:o}=e,{formatPriceWithoutCode:i}=(0,J.f)(),[r,c]=(0,l.useState)(!1);return(0,t.jsxs)("div",{className:"be-manage-line-item-details-container",children:[(0,t.jsx)("div",{className:"space-y-2 mb-4 be-manage-line-item-details-content",children:(0,t.jsxs)("div",{className:"be-manage-line-item-details-room-section",children:[(0,t.jsxs)("div",{className:"flex justify-between be-manage-line-item-details-room-header",children:[(0,t.jsxs)("p",{className:"text-black text-sm be-manage-line-item-details-room-title",children:["Room ",s+1," -"," ",(0,t.jsx)("b",{className:"be-manage-line-item-details-room-name",children:null==n?void 0:n.room.name})]}),(0,t.jsx)("p",{className:"text-black text-sm be-manage-line-item-details-room-price",children:i((Number(null==n?void 0:n.room.rate_plan.total_room_price)||0)+(Number(null==n?void 0:n.room.rate_plan.total_addon_price)||0))})]}),(0,t.jsxs)("p",{className:"text-sm text-gray-600 be-manage-line-item-details-room-occupancy",children:[null==n?void 0:n.adults," ",(null==n?void 0:n.adults)===1?"Adult":"Adults",(null==n?void 0:n.children)>0&&(0,t.jsxs)(t.Fragment,{children:[", ",null==n?void 0:n.children," ",(null==n?void 0:n.children)===1?"Child":"Children"]})]}),(0,t.jsxs)("div",{className:"space-y-1 be-manage-line-item-details-rate-plan-section",children:[(0,t.jsxs)("div",{onClick:()=>c(!r),className:"text-sm text-black be-manage-line-item-details-rate-plan-toggle",children:[(0,t.jsx)("span",{className:"be-manage-line-item-details-rate-plan-name",children:null==n?void 0:n.room.rate_plan.name}),(0,t.jsx)(f.P.span,{initial:{rotate:0},animate:{rotate:180*!!r},transition:{duration:.3,ease:"easeInOut"},onClick:()=>c(!r),className:"text-sm text-gray-600 inline-block align-middle be-manage-line-item-details-rate-plan-chevron",children:(0,t.jsx)(k.A,{size:14})})]}),r&&(0,t.jsx)(f.P.div,{initial:{height:0,opacity:0}
1,exit:{height:0,opacity:0},animate:{height:r?"auto":0,opacity:+!!r},transition:{duration:.3,ease:"easeInOut"},className:"overflow-hidden be-manage-line-item-details-price-breakdown",children:(0,t.jsx)(Q.A,{dailyRoomPrices:null==n?void 0:n.room.rate_plan.prices.map(e=>({date:e.date,amount:Number(e.price||0)})),totalAddonPrice:Number((null==n?void 0:n.room.rate_plan.total_addon_price)||0),addons:null==n||null==(a=n.room.rate_plan.addons)?void 0:a.map(e=>({name:e.name,prices:e.prices.map(e=>({date:e.date,amount:Number(e.total_price||0)}))}))})})]})]})}),(0,t.jsx)("div",{className:"border-t border-dotted border-gray-300 mt-3 mb-4 be-manage-line-item-details-separator"})]},s)};var ea=n(657),en=n(5852),et=n(1854),el=n(5171);function es(e){let{addons:a,total_independent_addon_price:n}=e,{formatPriceWithoutCode:l}=(0,J.f)();return a.length?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex flex-col gap-[6px]",children:[(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsx)("p",{className:"text-[#333333] text-[14px]",children:"Add-Ons"}),(0,t.jsx)("p",{translate:"no",className:"text-[#333333] text-[14px]",children:l(n)})]}),a.map(e=>(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsxs)("p",{className:"text-[#4A4A4A] text-[13px]",children:[e.name," x ",e.adult_units]}),(0,t.jsx)("p",{translate:"no",className:"text-[#4A4A4A] text-[13px]",children:l(e.total_price)})]},e.id))]}),(0,t.jsx)($.w,{className:"border-t-[0.8px] border-[#BBC7CC] border-dashed bg-white mt-4"})]}):null}function eo(e){var a,n,s,i,c,d,g,j,y,N,v,w;let{propertyId:C,itinaryDetails:I}=e,{booking_details:_,booking_cancellation_detail:S,cancellation_token:D}=I,E=(null==_||null==(a=_.bookings)?void 0:a.length)===1,A=null==_||null==(i=_.bookings)||null==(s=i[0])||null==(n=s.booking)?void 0:n.bookingId,[T,R]=(0,l.useState)([]),[P,L]=(0,l.useState)(()=>E&&A?[A]:[]),[O,q]=(0,l.useState)(!1),[B,F]=(0,l.useState)(!1),[W,H]=(0,l.useState)(!1),[Q,eo]=(0,l.useState)(""),[ei,er]=(0,l.useState)(!0),[ec,ed]=(0,l.useState)(!1),[em,eg]=(0,l.useState)(""),[eb,ex]=(0,l.useState)(!0),[eu,eh]=(0,l.useState)(!1),[ep,ek]=(0,l.useState)(""),[ef,ej]=(0,l.useState)(!1),[ey,eN]=(0,l.useState)(""),{initialData:ev,selectedDisplayCurrencySymbol:ew,getShowTaxBreakup:eC,getHideBalanceAndPayLaterFlag:eI}=(0,U.B)(),{themeColor:e_}=ev,{formatPriceWithCode:eS,formatPriceWithoutCode:eD}=(0,J.f)(),eE=eI(null==(g=_.bookings)||null==(d=g[0])||null==(c=d.booking)?void 0:c.propertyId,null==(y=_.bookings)||null==(j=y[0])?void 0:j.booking),{allButtonsBgColor:eA,allButtonsTextColor:eT,allButtonsBorderColor:eR,allButtonsBorderStyle:eP,allButtonsBorderWidth:eL,allButtonsTextFontWeight:eO,allButtonsHoverTextColor:eq,allButtonsHoverBgColor:eB}=(0,Y.A)();(0,l.useEffect)(()=>{if(eu){let e=setTimeout(()=>{eh(!1)},3e3);return()=>{clearTimeout(e)}}},[eu]),(0,l.useEffect)(()=>{if(ec){let e=setTimeout(()=>{ed(!1)},3e3);return()=>{clearTimeout(e)}}},[ec]);let eF=async()=>{er(!0);let e=S[0];try{F(!0);let a=await fetch((0,el.cV)("/api/cancel-booking/?propertyId=".concat(C)),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({booking:e,cancellation_token:D})}),n=await a.json();if(!a.ok){H(!0),eo(n.error),q(!1);return}_.status=n.booking.booking_status,_.bookings[0].booking.status=n.booking.booking_status,q(!1),R([])}catch(e){H(!0),eo(String(e))}finally{F(!1)}},eW=async()=>{er(!0);let e={booking_id:_.bookingId,bookings:S.map(e=>T.includes(e.booking_id)?{...e,hotel_id:(e=>{var a;let n=_.bookings.find(a=>a.booking.bookingId===e);return null==n||null==(a=n.booking)?void 0:a.propertyId})(e.booking_id)}:null).filter(e=>null!==e)};try{F(!0);let a=await fetch((0,el.cV)("/api/cancel-booking/?propertyId=".concat(C)),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({booking:e,cancellation_token:D})}),n=await a.json();if(!a.ok){H(!0),eo(n.error),q(!1);return}_.status=n.booking_status,n.bookings.forEach(e=>{let a=_.bookings.find(a=>a.booking.bookingId===e.booking_id);a&&(a.booking.status=e.booking_status);let n=S.find(a=>a.booking_id===e.booking_id);n&&(n.refund_amount=Number(e.refund_amount))}),q(!1),R([])}catch(e){H(!0),eo(String(e))}finally{F(!1)}},eM=async()=>{E?await eF():await eW()},e$=S.filter(e=>{let a=_.bookings.find(a=>a.booking.bookingId===e.booking_id);return(null==a?void 0:a.booking.status)==="CANCELLED"}).reduce((e,a)=>e+a.refund_amount,0),ez=_.bookings.filter(e=>
1e.booking.status===en.fy.CONFIRMED),eU=_.bookings.filter(e=>e.booking.status===en.fy.CONFIRMED&&new Date((0,X.gv)(e.booking.checkIn).toDateString())>new Date(new Date().toDateString())),eG=e=>{R([e.booking.bookingId]),q(!0)},eJ=e=>{R([e.booking.bookingId]),ej(!0)},eV=e=>{R([e.booking.bookingId]),eX(e.booking.bookingId)},eH=()=>{q(!0)},eY=async()=>{er(!0);let{bookingId:e,guestDetails:a}=_,{email:n}=a;try{F(!0);let a=await fetch((0,el.cV)("/api/resendEmail"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({booking_id:e,email:n})}),t=await a.json();if(!a.ok){er(!0),H(!0),eo(t.error||"An error occurred");return}ek(null==t?void 0:t.message),eh(!0),er(!1)}catch(e){console.error("Error resending email:",e)}finally{F(!1)}},eK=async e=>{let a=e?[e]:T;er(!0);let{bookingId:n,guestDetails:t}=_,{email:l}=t;try{var s;F(!0);let e=await fetch((0,el.cV)("/api/resendEmail"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({booking_id:n,booking_ids:a,email:l})}),t=await e.json();if(!e.ok){er(!0),H(!0),eo(t.error||"An error occurred");return}ek(null==(s=t[T[0]])?void 0:s.message),eh(!0),er(!1)}catch(e){console.error("Error resending email:",e)}finally{F(!1)}},eX=async e=>{E?await eY():await eK(e)},eZ=async()=>{let{bookingId:e,guestDetails:a}=_,{email:n}=a;try{F(!0);let a=await fetch((0,el.cV)("/api/amendmentEmail?bookingId=".concat(e)),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({booking_id:e,email:n,amendment_request_text:ey})}),t=await a.json();if(!a.ok){er(!0),H(!0),eo(t.error||"An error occurred"),eh(!1);return}ed(!0),eg(t.message||"Request sent successfully"),ex(!0),er(!1)}catch(e){console.error("Error requesting change:",e)}finally{ej(!1),F(!1)}},eQ=async()=>{let{bookingId:e,guestDetails:a}=_,{email:n}=a;try{F(!0);let a=await fetch((0,el.cV)("/api/amendmentEmail?bookingId=".concat(e)),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({booking_id:e,booking_ids:T,email:n,amendment_request_text:ey})}),t=await a.json();if(!a.ok){er(!0),H(!0),eo(t.error||"An error occurred"),eh(!1);return}ed(!0),eg(t.message||"Request sent successfully"),ex(!0),er(!1)}catch(e){console.error("Error requesting change:",e)}finally{ej(!1),F(!1)}},e0=async()=>{E?await eZ():await eQ()},e1=async(e,a)=>{try{let t=await fetch((0,el.cV)("/api/payLaterPaymentToPg?bookingId=".concat(e,"&payLinkKey=").concat(a))),l=await t.text();if(l.includes("error")){let e=JSON.parse(l);if(null==e?void 0:e.error){var n;F(!1),H(!0),eo(null==e||null==(n=e.error)?void 0:n.message)}else H(!1),eo("")}let s=document.createElement("div");s.innerHTML=l;let o=s.querySelector("form");if(o){try{let e=new URL(o.action,window.location.origin);o.action=e.pathname,console.log("Manage itinerary form action (relative):",o.action)}catch(e){F(!1),console.error("Invalid form.action:",e)}document.body.appendChild(o),o.submit()}else F(!1),console.error("Form not found in response")}catch(e){F(!1),console.error("Error in initiate-itinerary API:",e)}},[e4,e3]=(0,l.useState)(!1),e2=(0,l.useRef)(null);return(0,l.useEffect)(()=>{let e=e=>{e2.current&&!e2.current.contains(e.target)&&e3(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]),(0,t.jsxs)("div",{className:"w-full max-w-6xl mx-auto be-manage-itinerary-details-container",children:[(0,t.jsx)(G.A,{loading:B}),(0,t.jsxs)("div",{className:"bg-custom-gray pb-4 mb-4 md:grid md:grid-cols-2 max-md:flex max-md:justify-between gap-6 border-b-[1px] border-[#d9d9d9] border-dotted be-manage-itinerary-details-header",children:[(0,t.jsxs)("div",{className:"md:pr-6 md:border-r md:border-dotted md:border-[#d9d9d9] be-manage-itinerary-details-guest-section",children:[(0,t.jsx)("h2",{className:"text-gray-500 mb-1 be-manage-itinerary-details-guest-label",children:"Guest Information"}),(0,t.jsx)("h3",{className:"text-xl font-semibold break-all be-manage-itinerary-details-guest-name",children:_.guestDetails.name}),(0,t.jsx)("p",{className:"text-gray-700 break-all be-manage-itinerary-details-guest-email",children:_.guestDetails.email}),(0,t.jsx)("p",{className:"text-gray-700 break-all be-manage-itinerary-details-guest-phone",children:_.guestDetails.phone})]}),(0,t.jsxs)("div",{className:"md:pl-6 flex flex-col max-md:text-end whitespace-nowrap be-manage-itinerary-details-booking-section",children:[(0,t.jsx)("h2",{className:"text-gray-500 mb-1 be-manage-itinerary-details-booking-label",children:E?"Booking ID":"Itinerary ID"}),(0,t.jsx)("h3",{className:"text-xl font-semibold be-manage-itinerary-details-booking-id",children:_.bookingId}),(0,t.jsx)("h3",{style:{color:_.status.toUpperCase()===en.fy.CONFIRMED?"green":"red"},className:"text-lg font-semibold be-manage-itinerary-details-booking-status",children:"PARTIAL CONFIRMED"===_.status?"PARTIALLY CONFIRMED":_.status}),ez.length!==_.bookings.length&&e$>0&&(0,t.jsxs)("h3",{className:"text-gray-700 mt-2 be-manage-itinerary-details-refund-amount",children:["Your total refund amount is"," ",(0,t.jsx)("span",{className:"font-bold be-manage-itinerary-details-refund-value",children:eS(e$)})]})]})]}),!eE&&E&&(null==(v=_.bookings[0])||null==(N=v.booking)?void 0:N.payLaterDetails)&&
1(null==(w=_.bookings[0].booking.payLaterDetails)?void 0:w.paymentRequired)?(0,t.jsxs)("div",{className:"bg-custom-gray mb-4 be-manage-itinerary-details-total-section",children:[(0,t.jsxs)("p",{className:"text-gray-800 be-manage-itinerary-details-total-text",children:["The total booking amount is"," ",(0,t.jsx)("span",{className:"font-bold be-manage-itinerary-details-total-value",children:eS(_.totalAmount)}),"."]}),(0,t.jsx)("p",{className:"text-gray-800",children:(0,t.jsx)(et.A,{isManagePage:!0,payLaterDetails:_.bookings[0].booking.payLaterDetails,currencySymbol:ew,amountPaid:parseFloat(String(_.bookings[0].booking.amountPaid)).toFixed(2)})}),(0,t.jsx)("p",{className:"text-gray-800",children:(0,t.jsx)(et.A,{isManagePageLastStep:!0,payLaterDetails:_.bookings[0].booking.payLaterDetails,currencySymbol:ew,amountPaid:parseFloat(String(_.bookings[0].booking.amountPaid)).toFixed(2)})}),(0,t.jsx)(r.$,{onClick:()=>e1(_.bookings[0].booking.bookingId,_.bookings[0].booking.payLaterDetails.payLinkKey),className:"mt-4 text-white",hoverBgColor:eB,hoverTextColor:eq,bgColor:eA,textColor:eT,borderColor:eR,borderStyle:eP,borderWidth:eL,fontWeight:eO,children:"Pay Now"})]}):null,W&&ei&&(0,t.jsxs)("div",{className:" bg-red-50 flex items-start gap-2 text-red-700 mb-2",children:[(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"}),(0,t.jsx)("button",{className:"top-4 text-red-700 hover:text-red-900 text-lg font-bold focus:outline-none",onClick:()=>er(!1),"aria-label":"Close",children:"\xd7"}),(0,t.jsx)("span",{children:Q})]}),ec&&eb&&(0,t.jsxs)("div",{className:" bg-green-50 flex items-start gap-2 text-green-700 mb-2",children:[(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"}),(0,t.jsx)("button",{className:"top-4 text-green-700 hover:text-green-900 text-lg font-bold focus:outline-none",onClick:()=>ex(!1),"aria-label":"Close",children:"\xd7"}),(0,t.jsx)("span",{children:em})]}),!E&&(0,t.jsxs)("div",{className:"flex max-md:justify-between items-center mb-2 gap-8",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",style:{color:"black"},children:[(0,t.jsx)(M,{id:"select-all",checked:T.length===eU.length&&eU.length>0,onCheckedChange:()=>{T.length===eU.length?R([]):R(eU.map(e=>e.booking.bookingId))},disabled:0===eU.length}),(0,t.jsx)("label",{htmlFor:"select-all",className:"text-md font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:"Select All"})]}),(0,t.jsx)("div",{className:"\n flex gap-1 items-center\n transition-opacity duration-200\n ".concat(T.length>0?"opacity-100":"opacity-0","\n "),style:{minHeight:"36px"},children:T.length>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"hidden md:flex",children:[(0,t.jsxs)(r.$,{variant:"link",size:"sm",className:"flex items-center gap-1",onClick:()=>eX(),textColor:"black",fontWeight:eO,hoverTextColor:"black",children:[(0,t.jsx)(b,{className:"h-4 w-4"})," Resend Email"]}),(0,t.jsxs)(r.$,{variant:"link",size:"sm",className:"flex items-center gap-1",onClick:()=>ej(!0),textColor:"black",fontWeight:eO,hoverTextColor:"black",children:[(0,t.jsx)(x.A,{className:"h-4 w-4"})," Request a Change"]}),(0,t.jsxs)(r.$,{variant:"link",size:"sm",className:"flex items-center gap-1",onClick:eH,textColor:"black",fontWeight:eO,hoverTextColor:"black",children:[(0,t.jsx)(u.A,{className:"h-4 w-4"})," Cancel Booking"]})]}),(0,t.jsxs)("div",{className:"flex items-center md:hidden",children:[(0,t.jsxs)(r.$,{variant:"link",size:"sm",style:{color:e_},className:"flex items-center gap-1",onClick:()=>eX(),children:[(0,t.jsx)(b,{className:"h-4 w-4"})," Resend Email"]}),(0,t.jsxs)("div",{className:"relative",ref:e2,children:[(0,t.jsx)(r.$,{variant:"ghost",size:"xs",onClick:()=>e3(!e4),children:(0,t.jsx)(h,{style:{color:e_},className:"h-5 w-5"})}),(0,t.jsxs)(f.P.div,{initial:{opacity:0,y:-8},animate:e4?{opacity:1,y:0}:{opacity:0,y:-8},transition:{duration:.2,ease:"easeInOut"},className:"absolute right-0 mt-2 w-44 bg-white border rounded-lg shadow-lg p-2 z-20 ".concat(e4?"block":"hidden"),children:[(0,t.jsxs)(r.$,{variant:"link",size:"sm",className:"flex items-center gap-1",onClick:()=>{e3(!1),ej(!0)},textColor:eA,fontWeight:eO,hoverTextColor:eB,children:[(0,t.jsx)(x.A,{className:"h-4 w-4"})," Request a Change"]}),(0,t.jsxs)(r.$,{variant:"link",size:"sm",className:"flex items-center gap-1",onClick:()=>{e3(!1),eH()},textColor:eA,fontWeight:eO,hoverTextColor:eB,children:[(0,t.jsx)(u.A,{className:"h-4 w-4"})," Cancel Booking"]})]})]})]})]})})]}),_.bookings.map(e=>{var a,n,l,s,i,c;let{booking:d,content:g}=e,h=null==(a=g[d.propertyId.toString()])?void 0:a["en-US"],f=E||P.includes(d.bookingId),j=((e,a)=>{let n=(0,X.gv)(e);return Math.ceil(Math.abs((0,X.gv)(a).getTime()-n.getTime())/864e5)})(d.checkIn,d.checkOut),y=eC(d.propertyId,d),N=null==(n=d.lineItems[0])?void 0:n.room.room_type,v=null==h?void 0:h.rooms.find(e=>e.id===N),w=(null==v||null==(s=v.photos)||null==(l=s[0])?void 0:l.src)||"/placeholder.svg",C=null==d||null==(i=d.lineItems)?void 0:i.map(e=>{var a,n,t;return null==(t=e.room)||null==(n=t.rate_plan)||null==(a=n.penalty)?void 0:a.description}
1).filter(Boolean),I=new Date((0,X.gv)(d.checkIn).toDateString())<=new Date(new Date().toDateString());return(0,t.jsx)(o.Zp,{className:"mb-6 overflow-hidden bg-white",children:(0,t.jsx)("div",{className:"flex items-start",children:(0,t.jsxs)("div",{className:"flex-1 p-6",children:[(0,t.jsxs)("div",{className:"grid md:grid-cols-[260px_1fr_auto] gap-6",children:[(0,t.jsxs)("div",{className:"relative w-full md:w-[260px] h-[162px] sm:h-[240px] md:h-[152px] rounded-md overflow-hidden",children:[(0,t.jsx)(m(),{src:w,alt:(null==h?void 0:h.name)||"Hotel room",fill:!0,className:"object-cover hover:brightness-90"}),(0,t.jsx)("div",{className:"absolute inset-0 bg-gradient-to-t from-[#33333300] to-[#33333399] pointer-events-none"}),!E&&(0,t.jsx)("div",{className:"absolute top-2 left-2 z-10",children:(0,t.jsx)(M,{className:"block border-secondary data-[state=checked]:bg-secondary data-[state=checked]:text-secondary-foreground",checked:null==T?void 0:T.includes(d.bookingId),onCheckedChange:()=>(e=>{let a=e.booking;T.includes(a.bookingId)?R(T.filter(e=>e!==a.bookingId)):R([...T,a.bookingId])})(e),disabled:d.status!==en.fy.CONFIRMED||I})})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-4 ".concat(E?"":"justify-between"),children:[(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsxs)("div",{className:"flex flex-col justify-between",children:[(0,t.jsxs)("div",{className:"flex flex-1 flex-wrap items-baseline gap-x-1",children:[(0,t.jsx)("h3",{className:"text-lg font-semibold",children:null==h?void 0:h.name}),!E&&(0,t.jsx)("h3",{className:"text-sm text-gray-600",children:"(Booking ID - ".concat(null==d?void 0:d.bookingId,")")})]}),(0,t.jsxs)("p",{className:"text-sm text-gray-600",children:[d.lineItems.reduce((e,a)=>e+a.adults,0)," ",1===d.lineItems.reduce((e,a)=>e+a.adults,0)?"Adult":"Adults",d.lineItems.reduce((e,a)=>e+a.children,0)>0&&(0,t.jsxs)(t.Fragment,{children:[", ",d.lineItems.reduce((e,a)=>e+a.children,0)," ",1===d.lineItems.reduce((e,a)=>e+a.children,0)?"Child":"Children"]})]})]}),(0,t.jsxs)("div",{className:"text-right md:-mr-6",children:[(0,t.jsx)("p",{className:"text-lg font-bold",children:eD(d.totalAmount)}),(0,t.jsx)("p",{style:{color:(null==d||null==(c=d.status)?void 0:c.toUpperCase())==="CONFIRMED"?"green":"red"},className:"p-0 text-md font-bold ",children:d.status})]})]}),(0,t.jsxs)("div",{className:"max-w-[400px] flex justify-between items-center gap-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-sm text-gray-500",children:"Check In"}),(0,t.jsx)("p",{className:"font-medium",children:Z(d.checkIn)})]}),(0,t.jsx)("div",{children:(0,t.jsxs)("span",{className:"px-3 py-1 bg-gray-100 text-sm rounded-full whitespace-nowrap",children:[j," ",j>1?"nights":"night"]})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-sm text-gray-500",children:"Check Out"}),(0,t.jsx)("p",{className:"font-medium",children:Z(d.checkOut)})]})]}),d.status===en.fy.CONFIRMED&&!I&&(0,t.jsxs)("div",{className:"flex flex-wrap gap-y-2 gap-x-4 md:hidden",children:[(0,t.jsxs)(r.$,{variant:"link",size:"sm",style:{color:e_,paddingLeft:0},className:"flex items-center gap-1 h-auto px-0",onClick:()=>eV(e),textColor:eA,fontWeight:eO,hoverTextColor:eB,children:[(0,t.jsx)(b,{className:"h-4 w-4"})," ",(0,t.jsx)("span",{className:"text-md",children:"Resend Email"})]}),(0,t.jsxs)(r.$,{variant:"link",style:{color:e_},size:"sm",className:"flex items-center gap-1 h-auto px-0",onClick:()=>eJ(e),textColor:eA,fontWeight:eO,hoverTextColor:eB,children:[(0,t.jsx)(x.A,{className:"h-4 w-4"})," ",(0,t.jsx)("span",{className:"text-md",children:"Request a Change"})]}),(0,t.jsxs)(r.$,{variant:"link",size:"sm",className:"flex items-center gap-1 h-auto px-0",style:{color:e_},onClick:()=>eG(e),textColor:eA,fontWeight:eO,hoverTextColor:eB,children:[(0,t.jsx)(u.A,{className:"h-4 w-4"})," ",(0,t.jsx)("span",{className:"text-md",children:"Cancel Booking"})]})]}),!E&&(0,t.jsx)("button",{className:" text-sm font-medium flex items-center",style:{color:e_},onClick:()=>{var e;return e=d.bookingId,void(P.includes(e)?L(P.filter(a=>a!==e)):L([...P,e]))},children:f?(0,t.jsxs)(t.Fragment,{children:["Hide Details ",(0,t.jsx)(p.A,{className:"h-4 w-4 ml-1"})]}):(0,t.jsxs)(t.Fragment,{children:["View Details ",(0,t.jsx)(k.A,{className:"h-4 w-4 ml-1"})]})})]})]}),f&&f&&(0,t.jsx)("div",{className:"pt-4",children:(0,t.jsxs)("div",{className:"grid md:grid-cols-2 md:gap-8 ",children:[(0,t.jsxs)("div",{children:[(null==C?void 0:C.length)>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"mb-4",children:[(0,t.jsx)("h4",{className:"font-semibold mb-2",children:"Cancellation Rules"}),(0,t.jsx)("p",{className:"text-sm text-gray-700 whitespace-pre-line break-words",children:C[0]})]}),(0,t.jsx)($.w,{className:"my-4 hidden md:block"})]}),"CONFIRMED"===d.status&&!I&&(0,t.jsxs)("div",{className:"md:flex flex-wrap gap-4 mb-6 hidden",children:[(0,t.jsxs)(r.$,{variant:"link",size:"sm",style:{color:e_,paddingLeft:0},className:"flex items-center gap-1 h-auto px-0",onClick:()=>eV(e),textColor:eA,fontWeight:eO,hoverTextColor:eB,children:[(0,t.jsx)(b,{className:"h-4 w-4"})," ",(0,t.jsx)("span",{className:"text-md",children:"Resend Email"})]}),(0,t.jsxs)(r.$,{variant:"link",style:{color:e_},size:"sm",className:"flex items-center gap-1 h-auto px-0",onClick:()=>eJ(e),textColor:eA,fontWeight:eO,hoverTextColor:eB,children:[(0,t.jsx)(x.A,{className:"h-4 w-4"})," ",(0,t.jsx)("span",{className:"text-md",children:"Request a Change"})]}),(0,t.jsxs)(r.$,{variant:"link",size:"sm",className:"flex items-center gap-1 h-auto px-0",style:{color:e_},onClick:()=>eG(e),textColor:eA,hoverTextColor:eB,fontWeight:eO,children:[(0,t.jsx)(u.A,{className:"h-4 w-4"})," ",(0,t.jsx)("span",{className:"text-md",children:"Cancel Booking"})]})]})]}),(0,t.jsxs)("div",{className:" bg-white p-4 rounded-md border border-gray-200 ",children:[(0,t.jsx)("h4",{className:"font-semibold mb-4",children:"Your Booking Details"}),(0,t.jsx)("div",{className:"border-t border-dotted border-gray-300 mt-3 mb-4"}),(0,t.jsxs)("div",{className:"flex justify-between items-start mb-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h5",{className:"font-semibold",children:null==h?void 0:h.name}),(0,t.jsxs)("p",{className:"text-sm text-gray-600",children:[d.lineItems.reduce((e,a)=>e+a.adults,0)," ",1===d.lineItems.reduce((e,a)=>e+a.adults,0)?"Adult":"Adults",d.lineItems.reduce((e,a)=>e+a.children,0)>0&&(0,t.jsxs)(t.Fragment,{children:[", ",d.lineItems.reduce((e,a)=>e+a.children,0)," ",1===d.lineItems.reduce((e,a)=>e+a.children,0)?"Child":"Children"]})]})]}),(0,t.jsx)("p",{className:"font-semibold",children:eD(d.totalAmount)})]}),(0,t.jsx)("div",{className:"border-t border-dotted border-gray-300 mt-3 mb-4"}),d.lineItems.map((e,a)=>(0,t.jsx)(ee,{lineItem:e,index:a,bookingDetails:d},a)),(0,t.jsx)(es,{addons:d.independent_addons,total_independent_addon_price:d.total_independent_addon_price}),(0,t.jsxs)("div",{className:"mt-4 space-y-2",children:[(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsx)("p",{children:"Sub Total"}),(0,t.jsx)("p",{className:"",children:eD(d.sub_total)})]}),Number(d.tax_total)>0&&(0,t.jsx)(ea.A,{taxBreakup:(0,X.ck)(d),showTaxBreakup:y,totalTaxAmount:Number(d.tax_total),formatPriceWithoutCode:eD})]}),!eE&&(0,t.jsxs)("div",{className:"mt-4 space-y-2 pt-2 border-t border-dotted border-gray-300",children:[(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsx)("span",{children:"You've Paid"}),(0,t.jsx)("span",{className:"text-green-600",children:eS(d.amountPaid)})]}),(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsx)("span",{children:"Balance (Pay Later)"}),(0,t.jsx)("span",{className:"text-red-600",children:eS(d.totalAmount-d.amountPaid)})]})]})]})]})})]})})},d.bookingId)}),T&&(0,t.jsx)(V,{open:O,onClose:()=>q(!1),onConfirm:eM,bookingDetails:_,selectedBookingIds:T,cancellationDetail
1s:S,isLoading:B}),(0,t.jsx)(K,{open:ef,onClose:()=>ej(!1),handleSubmit:e0,request:ey,setRequest:eN,setIsRequestChangeDialogOpen:ej,isLoading:B}),(0,t.jsx)(z.lG,{open:eu,onOpenChange:eh,children:(0,t.jsxs)(z.Cf,{className:"sm:max-w-lg p-2",children:[(0,t.jsxs)(z.HM,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[(0,t.jsx)(u.A,{className:"h-4 w-4"}),(0,t.jsx)("span",{className:"sr-only",children:"Close"})]}),(0,t.jsx)(z.L3,{className:"text-lg text-center font-[600px]",children:"Email Status"}),(0,t.jsx)(z.rr,{className:"text-base text-center font-[600px]",children:ep})]})})]})}var ei=!0;function er(e){let{initialData:a}=e,n=(0,s.useRouter)(),[d,m]=(0,l.useState)(n.query.propertyId);(0,l.useEffect)(()=>{m(null==a?void 0:a.propertyId)},[a]);let[g,b]=(0,l.useState)(""),[x,u]=(0,l.useState)(""),[h,p]=(0,l.useState)(!1),[k,f]=(0,l.useState)(null),[j,y]=(0,l.useState)(null),[N,v]=(0,l.useState)("booking"),[w,C]=(0,l.useState)(""),{themeColor:I}=a,{allButtonsBgColor:_,allButtonsTextColor:S,allButtonsBorderColor:D,allButtonsBorderStyle:E,allButtonsBorderWidth:A,allButtonsTextFontWeight:T,allButtonsHoverTextColor:R,allButtonsHoverBgColor:P}=(0,Y.A)(),L=async e=>{e.preventDefault(),p(!0),C(""),f(null);try{let e=await fetch((0,el.cV)("/api/manageBooking"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({booking_id:g,email:x,propertyId:d})});if(!e.ok)throw Error("Booking not found or invalid");let a=await e.json();a.error?C(a.error):a.booking_details.bookingId.startsWith("ITR-")?(v("itinerary"),y(a)):(v("booking"),f(a))}catch(e){C("Unable to fetch booking details. Please try again.")}finally{p(!1)}};return(0,t.jsxs)("div",{className:" flex flex-col items-center justify-start py-5 md:px-4 be-pages-manage-booking-container",children:[(0,t.jsx)(G.A,{loading:h}),(0,t.jsxs)(o.Zp,{className:"w-full border-x-0 bg-custom-gray max-w-6xl rounded-none shadow-none be-pages-manage-booking-card",children:[(0,t.jsx)(o.aR,{className:"bg-gradient-to-b from-[#6E6E6E] to-[#4E4E4E] px-5 md:px-10 py-4 be-pages-manage-booking-header",children:(0,t.jsx)(o.ZB,{className:"text-white text-lg",children:"Manage Booking"})}),(0,t.jsxs)(o.Wu,{className:"w-full bg-custom-gray px-5 md:px-10 py-4 space-y-6 be-pages-manage-booking-content",children:[k||j?(0,t.jsx)(()=>{if("itinerary"===N)return(0,t.jsx)(eo,{propertyId:d,itinaryDetails:j});{let e=(e=>{var a,n,t;if(!(null==e?void 0:e.booking_details))return null;let l=e.booking_details,s=null==(a=l.roomContent)?void 0:a[l.propertyId],o={[l.propertyId]:{"en-US":{name:(null==(n=l.propertyDetails)?void 0:n.propertyName)||"",rooms:(null==s||null==(t=s["en-US"])?void 0:t.rooms)||[]}}};return{booking_details:{bookings:[{booking:l,content:o}],...l},booking_cancellation_detail:e.booking_cancellation_detail?[e.booking_cancellation_detail]:[],cancellation_token:e.cancellation_token}})(k);return e?(0,t.jsx)(eo,{propertyId:d,itinaryDetails:e}):null}},{}):(0,t.jsxs)("form",{onSubmit:L,className:"space-y-6 ",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)(c.J,{htmlFor:"bookingId",children:["Booking ID / Itinerary ID"," ",(0,t.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,t.jsx)(i.p,{id:"bookingId",value:g,onChange:e=>b(e.target.value),placeholder:"Enter your Booking ID / Itinerary ID",required:!0})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)(c.J,{htmlFor:"email",children:["Email ",(0,t.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,t.jsx)(i.p,{id:"email",type:"email",value:x,onChange:e=>u(e.target.value),placeholder:"Enter your email",required:!0})]}),(0,t.jsx)(r.$,{type:"submit",className:"text-base",hoverBgColor:P,hoverTextColor:R,bgColor:_,textColor:S,borderColor:D,borderStyle:E,borderWidth:A,fontWeight:T,children:h?"Loading...":"Get Details"})]}),w&&(0,t.jsx)("p",{className:"text-red-500 font-medium",children:w})]})]})]})}},9012:(e,a,n)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/property/[propertyId]/bookings/manage",function(){return n(3588)}])},9099:(e,a,n)=>{e.exports=n(6296)},9773:(e,a,n)=>{"use strict";n.d(a,{b:()=>i});var t=n(4232),l=n(6326),s=n(7876),o=t.forwardRef((e,a)=>(0,s.jsx)(l.sG.label,{...e,ref:a,onMouseDown:a=>{a.target.closest("button, input, select, textarea")||(e.onMouseDown?.(a),!a.defaultPrevented&&a.detail>1&&a.preventDefault())}}));o.displayName="Label";var i=o}},e=>{e.O(0,[679,888,636,593,792],()=>e(e.s=9012)),_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.