1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4639],{10383:(e,t,s)=>{s.d(t,{A:()=>a});let a=(0,s(71847).A)("CalendarDays",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 18h.01",key:"lrp35t"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M16 18h.01",key:"kzsmim"}]])},19408:(e,t,s)=>{s.d(t,{A:()=>a});let a=(0,s(71847).A)("Building2",[["path",{d:"M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z",key:"1b4qmf"}],["path",{d:"M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2",key:"i71pzd"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2",key:"10jefs"}],["path",{d:"M10 6h4",key:"1itunk"}],["path",{d:"M10 10h4",key:"tcdvrf"}],["path",{d:"M10 14h4",key:"kelpxr"}],["path",{d:"M10 18h4",key:"1ulq68"}]])},23664:(e,t,s)=>{s.d(t,{A:()=>a});let a=(0,s(71847).A)("Mail",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}]])},24639:(e,t,s)=>{s.r(t),s.d(t,{default:()=>Y});var a=s(95155),l=s(12115),r=s(71847);let n=(0,r.A)("UtensilsCrossed",[["path",{d:"m16 2-2.3 2.3a3 3 0 0 0 0 4.2l1.8 1.8a3 3 0 0 0 4.2 0L22 8",key:"n7qcjb"}],["path",{d:"M15 15 3.3 3.3a4.2 4.2 0 0 0 0 6l7.3 7.3c.7.7 2 .7 2.8 0L15 15Zm0 0 7 7",key:"d0u48b"}],["path",{d:"m2.1 21.8 6.4-6.3",key:"yn04lh"}],["path",{d:"m19 5-7 7",key:"194lzd"}]]);var i=s(69587);let c=(0,r.A)("ShoppingBag",[["path",{d:"M6 2 3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4Z",key:"hou9p0"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M16 10a4 4 0 0 1-8 0",key:"1ltviw"}]]);var d=s(27937),o=s(95740),x=s(26983);let m=(0,r.A)("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);var h=s(6191),u=s(86651),g=s(35626),p=s(21873),y=s(10383),b=s(4480),f=s(95174),j=s(37354),N=s(20508),v=s(69141),w=s(23664),k=s(19408),_=s(65229),A=s(35299),S=s(24546),C=s(24924),D=s(62816),M=s(5218),E=s(13255);let F=e=>(0,E.t)(null!=e?e:0),I=e=>e?new Date(e).toLocaleDateString("en-NG",{day:"numeric",month:"short",year:"numeric"}):"â",L=e=>e?new Date(e).toLocaleString("en-NG",{day:"numeric",month:"short",hour:"2-digit",minute:"2-digit"}):null,P={CONFIRMED:{bg:"bg-sage-50",text:"text-sage-700",border:"border-sage-100"},PENDING:{bg:"bg-clay-50",text:"text-clay-700",border:"border-clay-100"},CANCELLED:{bg:"bg-red-50",text:"text-red-600",border:"border-red-100"},COMPLETED:{bg:"bg-gray-100",text:"text-gray-500",border:"border-gray-200"}};async function O(){let{page:e=1,limit:t=20}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return(await C.Ay$.get("/api/v1/shortlets",{params:{page:e,limit:t}})).data}let G={PENDING:{bg:"bg-clay-50",text:"text-clay-700"},CONFIRMED:{bg:"bg-sage-50",text:"text-sage-700"},FULFILLING:{bg:"bg-sage-50",text:"text-sage-700"},COMPLETED:{bg:"bg-gray-100",text:"text-gray-500"},CANCELLED:{bg:"bg-red-50",text:"text-red-600"},REFUNDED:{bg:"bg-red-50",text:"text-red-600"}},R=["FOOD","DRINKS"],q={FOOD:"Food",DRINKS:"Drinks"},U={FOOD:n,DRINKS:i.A},z=e=>(null==e?void 0:e.item_type)==="PRODUCT"&&R.includes(e.category),B=e=>{var t;return(null==e?void 0:e.item_type)==="SERVICE"&&e.requires_scheduling||(null==e?void 0:e.item_type)==="PACKAGE"&&(null!=(t=e.items)?t:[]).some(e=>"SERVICE"===e.item_type)},V=new Set(["PENDING","CONFIRMED","FULFILLING"]);function K(e){let{bookingId:t}=e,[s,r]=(0,l.useState)([]),[n,i]=(0,l.useState)([]),[u,g]=(0,l.useState)(!0),[p,y]=(0,l.useState)(!1),[b,f]=(0,l.useState)({}),[j,N]=(0,l.useState)({}),[v,w]=(0,l.useState)(null),[k,_]=(0,l.useState)(""),A=(0,l.useCallback)(async()=>{g(!0);try{var e,s;let[a,l]=await Promise.all([(0,C.pYh)(t),(0,C.H5c)({booking_id:t})]);r(null!=(e=null==a?void 0:a.data)?e:[]),i(null!=(s=null==l?void 0:l.data)?s:[])}catch(e){r([]),i([])}finally{g(!1)}},[t]);(0,l.useEffect)(()=>{A()},[A]);let S=new Set(n.flatMap(e=>{var t;return null!=(t=e.items)?t:[]}).map(e=>e.item_id)),M=(e,t)=>f(s=>({...s,[e]:Math.max(1,t)})),E=s.filter(e=>!z(e)),I=n.flatMap(e=>{var t;return(null!=(t=e.items)?t:[]).map(t=>({...t,orderStatus:e.status}))}).filter(e=>!z(s.find(t=>
1t.id===e.item_id))),L=async e=>{var s,a,l,r;let n=B(e);if(n&&!j[e.id])return void _("Pick a time for this service first.");w(e.id),_("");try{let l=await (0,C.AAJ)({booking_id:t,items:[{item_type:e.item_type,item_id:e.id,quantity:b[e.id]||1,scheduled_at:n?new Date(j[e.id]).toISOString():void 0}]}),r=null==l||null==(a=l.data)||null==(s=a.checkout)?void 0:s.authorization_url;if(r){window.location.href=r;return}await A()}catch(e){_((null==e||null==(r=e.response)||null==(l=r.data)?void 0:l.detail)||"Could not add this to your stay. Please try again.")}finally{w(null)}};if(u||0===E.length&&0===I.length)return null;let P=E.filter(e=>!S.has(e.id)),O=I.filter(e=>V.has(e.orderStatus)).length;return(0,a.jsxs)("div",{className:p?"bg-gray-50 rounded-2xl overflow-hidden":"",children:[(0,a.jsxs)("button",{type:"button",onClick:()=>y(e=>!e),className:"w-full flex items-center gap-3 p-4 transition-colors text-left ".concat(p?"hover:bg-gray-100":"bg-gray-50 hover:bg-gray-100 rounded-2xl"),children:[(0,a.jsx)("div",{className:"w-11 h-11 rounded-full bg-fo-primary-cont flex items-center justify-center shrink-0",children:(0,a.jsx)(c,{className:"w-5 h-5 text-fo-on-primary-cont"})}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"text-sm font-bold text-gray-900",children:"Add to your stay"}),(0,a.jsxs)("p",{className:"text-xs text-gray-500",children:[P.length," add-on",1!==P.length?"s":""," available"]})]}),O>0&&(0,a.jsxs)("span",{className:"shrink-0 px-2 py-0.5 rounded-full text-[10px] font-bold uppercase tracking-wider bg-sage-100 text-sage-700",children:[O," active"]}),(0,a.jsx)(d.A,{className:"w-4 h-4 text-gray-300 shrink-0 transition-transform ".concat(p?"rotate-90":"")})]}),p&&(0,a.jsxs)("div",{className:"px-4 pb-4",children:[I.length>0&&(0,a.jsxs)("div",{className:"space-y-2 mb-4",children:[(0,a.jsx)("p",{className:"text-xs font-bold text-gray-500 uppercase tracking-wide mb-2",children:"Your orders"}),I.map(e=>{var t,l,r;let n=null!=(l=G[e.orderStatus])?l:G.PENDING,i=s.find(t=>t.id===e.item_id),d=(null==i?void 0:i.item_type)==="SERVICE"?o.A:c;return(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2 bg-white rounded-xl p-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2.5 min-w-0",children:[(null==i||null==(t=i.images)?void 0:t[0])?(0,a.jsx)("div",{className:"w-9 h-9 rounded-lg overflow-hidden shrink-0 bg-gray-100",children:(0,a.jsx)("img",{src:(0,D.m)(i.images[0],"thumbnail"),alt:"",className:"w-full h-full object-cover"})}):(0,a.jsx)("div",{className:"w-9 h-9 rounded-lg bg-gray-50 flex items-center justify-center shrink-0",children:(0,a.jsx)(d,{className:"w-4 h-4 text-gray-300"})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsxs)("span",{className:"text-sm text-gray-800 truncate block",children:[null!=(r=null==i?void 0:i.name)?r:"Add-on",e.quantity>1?" \xd7 ".concat(e.quantity):""]}),e.scheduled_at&&(0,a.jsxs)("span",{className:"text-xs text-gray-400 flex items-center gap-1",children:[(0,a.jsx)(x.A,{className:"w-3 h-3"}),new Date(e.scheduled_at).toLocaleString("en-NG",{day:"numeric",month:"short",hour:"2-digit",minute:"2-digit"})]})]})]}),(0,a.jsx)("span",{className:"shrink-0 px-2 py-0.5 rounded-full text-[10px] font-bold uppercase tracking-wider ".concat(n.bg," ").concat(n.text),children:e.orderStatus})]},e.id)})]}),P.length>0&&(0,a.jsx)("div",{className:"space-y-3",children:P.map(e=>{var t,s;let l=b[e.id]||1,r="SERVICE"===e.item_type,n=B(e),i=r?o.A:c;return(0,a.jsxs)("div",{className:"bg-white rounded-2xl p-3 space-y-2",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2.5 min-w-0",children:[(null==(t=e.images)?void 0:t[0])?(0,a.jsx)("div",{className:"w-12 h-12 rounded-xl overflow-hidden shrink-0 bg-gray-100",children:(0,a.jsx)("img",{src:(0,D.m)(e.images[0],"thumbnail"),alt:"",className:"w-full h-full object-cover"})}):(0,a.jsx)("div",{className:"w-12 h-12 rounded-xl bg-gray-50 flex items-center justify-center shrink-0",children:(0,a.jsx)(i,{className:"w-5 h-5 text-gray-400"})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("p",{className:"text-sm font-semibold text-gray-900 truncate",children:e.name}),(0,a.jsxs)("p",{className:"text-xs text-gray-500",children:[F(e.price),e.duration_minutes>0?" \xb7 ".concat(e.duration_minutes," min"):""]})]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[!n&&(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)("button",{type:"button",onClick:()=>M(e.id,l-1),className:"w-6 h-6 rounded-full border border-gray-200 bg-white flex items-center justify-center text-gray-600 hover:bg-gray-100",children:(0,a.jsx)(m,{className:"w-3 h-3"})}),(0,a.jsx)("span",{className:"w-5 text-center text-sm font-medium text-gray-800",children:l}),(0,a.jsx)("button",{type:"button",onClick:()=>M(e.id,l+1),className:"w-6 h-6 rounded-full border border-gray-200 bg-white flex items-center justify-center text-gray-600 hover:bg-gray-100",children:(0,a.jsx)(h.A,{className:"w-3 h-3"})})]}),(0,a.jsx)("button",{onClick:()=>L(e),disabled:v===e.id,className:"px-3 py-1.5 rounded-full text-xs font-semibold bg-[#0052FF] hover:bg-[#0039B5] text-white disabled:opacity-60",children:v===e.id?"â¦":"Add"})]})]}),n&&(0,a.jsx)("input",{type:"datetime-local",value:null!=(s=j[e.id])?s:"",onCh
1ange:t=>N(s=>({...s,[e.id]:t.target.value})),className:"w-full border border-gray-200 rounded-xl px-3 py-2 text-sm text-gray-700 bg-white focus:outline-none focus:border-[#0052FF]"})]},e.id)})}),k&&(0,a.jsx)("p",{className:"text-xs text-rose-600 mt-2",children:k})]})]})}function T(e){let{bookingId:t}=e,[s,r]=(0,l.useState)([]),[i,c]=(0,l.useState)([]),[o,g]=(0,l.useState)(!0),[p,y]=(0,l.useState)(!1),[b,f]=(0,l.useState)(""),[j,N]=(0,l.useState)({}),[v,w]=(0,l.useState)(!1),[k,_]=(0,l.useState)(""),A=(0,l.useCallback)(async()=>{g(!0);try{var e,s;let[a,l]=await Promise.all([(0,C.pYh)(t),(0,C.H5c)({booking_id:t})]);r(null!=(e=null==a?void 0:a.data)?e:[]),c(null!=(s=null==l?void 0:l.data)?s:[])}catch(e){r([]),c([])}finally{g(!1)}},[t]);if((0,l.useEffect)(()=>{A()},[A]),o)return null;let S=s.filter(z),M=i.flatMap(e=>{var t;return(null!=(t=e.items)?t:[]).map(t=>({...t,orderStatus:e.status,orderedAt:e.created_at}))}).filter(e=>z(s.find(t=>t.id===e.item_id)));if(0===S.length&&0===M.length)return null;let E=M.filter(e=>V.has(e.orderStatus)).length,I=(e,t)=>N(s=>{let a=Math.max(0,t),l={...s};return 0===a?delete l[e]:l[e]=a,l}),P=Object.entries(j).filter(e=>{let[,t]=e;return t>0}),O=P.reduce((e,t)=>{let[,s]=t;return e+s},0),B=P.reduce((e,t)=>{let[s,a]=t,l=S.find(e=>e.id===s);return e+(l?l.price*a:0)},0),K=async()=>{var e,s,a,l;if(0!==P.length){w(!0),_("");try{let a=await (0,C.AAJ)({booking_id:t,items:P.map(e=>{let[t,s]=e;return{item_type:"PRODUCT",item_id:t,quantity:s}})}),l=null==a||null==(s=a.data)||null==(e=s.checkout)?void 0:e.authorization_url;if(l){window.location.href=l;return}N({}),await A()}catch(e){_((null==e||null==(l=e.response)||null==(a=l.data)?void 0:a.detail)||"Could not place your order. Please try again.")}finally{w(!1)}}},T=b.trim().toLowerCase(),H=T?S.filter(e=>{var t;return null==(t=e.name)?void 0:t.toLowerCase().includes(T)}):S,Y=R.filter(e=>H.some(t=>t.category===e));return(0,a.jsxs)("div",{className:p?"bg-gray-50 rounded-2xl overflow-hidden":"",children:[(0,a.jsxs)("button",{type:"button",onClick:()=>y(e=>!e),className:"w-full flex items-center gap-3 p-4 transition-colors text-left ".concat(p?"hover:bg-gray-100":"bg-gray-50 hover:bg-gray-100 rounded-2xl"),children:[(0,a.jsx)("div",{className:"w-11 h-11 rounded-full bg-clay-100 flex items-center justify-center shrink-0",children:(0,a.jsx)(n,{className:"w-5 h-5 text-clay-600"})}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"text-sm font-bold text-gray-900",children:"Food & Drinks"}),(0,a.jsxs)("p",{className:"text-xs text-gray-500",children:[S.length," item",1!==S.length?"s":""," on the menu"]})]}),E>0&&(0,a.jsxs)("span",{className:"shrink-0 px-2 py-0.5 rounded-full text-[10px] font-bold uppercase tracking-wider bg-sage-100 text-sage-700",children:[E," active"]}),(0,a.jsx)(d.A,{className:"w-4 h-4 text-gray-300 shrink-0 transition-transform ".concat(p?"rotate-90":"")})]}),p&&(0,a.jsxs)("div",{className:"px-4 pb-4",children:[M.length>0&&(0,a.jsxs)("div",{className:"space-y-2 mb-4",children:[(0,a.jsx)("p",{className:"text-xs font-bold text-gray-500 uppercase tracking-wide mb-2",children:"Your orders"}),M.map(e=>{var t,l,r,i;let c=null!=(l=G[e.orderStatus])?l:G.PENDING,d=s.find(t=>t.id===e.item_id),o=null!=(r=U[null==d?void 0:d.category])?r:n;return(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2 bg-white rounded-xl p-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2.5 min-w-0",children:[(null==d||null==(t=d.images)?void 0:t[0])?(0,a.jsx)("div",{className:"w-9 h-9 rounded-lg overflow-hidden shrink-0 bg-gray-100",children:(0,a.jsx)("img",{src:(0,D.m)(d.images[0],"thumbnail"),alt:"",className:"w-full h-full object-cover"})}):(0,a.jsx)("div",{className:"w-9 h-9 rounded-lg bg-gray-50 flex items-center justify-center shrink-0",children:(0,a.jsx)(o,{className:"w-4 h-4 text-gray-300"})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsxs)("span",{className:"text-sm text-gray-800 truncate block",children:[null!=(i=null==d?void 0:d.name)?i:"Item",e.quantity>1?" \xd7 ".concat(e.quantity):""]}),(0,a.jsxs)("span",{className:"text-xs text-gray-400 flex items-center gap-1",children:[(0,a.jsx)(x.A,{className:"w-3 h-3 shrink-0"}),"Ordered ",L(e.orderedAt),e.fulfilled_at&&" \xb7 Delivered ".concat(L(e.fulfilled_at))]})]})]}),(0,a.jsx)("span",{className:"shrink-0 px-2 py-0.5 rounded-full text-[10px] font-bold uppercase tracking-wider ".concat(c.bg," ").concat(c.text),children:e.orderStatus})]},e.id)})]}),M.length>0&&S.length>0&&(0,a.jsx)("hr",{className:"border-gray-100 mb-4"}),S.length>0&&(0,a.jsxs)("div",{className:"flex items-center gap-2 bg-white border border-gray-200 rounded-full px-3 py-2 mb-3",children:[(0,a.jsx)(u.A,{className:"w-4 h-4 text-gray-400 shrink-0"}),(0,a.jsx)("input",{className:"text-sm outline-none flex-1 min-w-0 placeholder-gray-400 bg-transparent",placeholder:"Search food & drinksâ¦",value:b,onChange:e=>f(e.target.value)})]}),Y.map(e=>{let t=U[e];return(0,a.jsxs)("div",{className:"mb-4",children:[(0,a.jsxs)("p",{className:"text-xs font-bold text-gray-500 uppercase tracking-wide mb-2 flex items-center gap-1.5",children:[(0,a.jsx)(t,{className:"w-3.5 h-3.5"})," ",q[e]]}),(0,a.jsx)("div",{className:"space-y-2",children:H.filter(t=>t.category===e).map(e=>{var s;let l=j[e.id]||0;return(0,a.jsxs)("div",{className:"flex items-center justify-between gap-3 bg-white rounded-2xl p-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2.5 min-w-0",children:[(null==(s=e.images)?void 0:s[0])?(0,a.jsx)("div",{className:"w-12 h-12 rounded-xl overflow-hidden shrink-0 bg-gray-100",children:(0,a.jsx)("img",{src:(0,D.m)(e.images[0],"thumbnail"),alt:"",className:"w-full h-full object-cover"})}):(0,a.jsx)("div",{className:"w-12 h-12 rounded-xl bg-gray-50 flex items-center justify-center shrink-0",children:(0,a.jsx)(t,{className:"w-5 h-5 text-gray-300"})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("p",{className:"text-sm font-semibold text-gray-900 truncate",children:e.name}),(0,a.jsxs)("p",{className:"text-xs text-gray-500",children:[F(e.price),e.lead_time_hours>0?" \xb7 ~".concat(e.lead_time_hours,"h prep"):""]})]})]}),0===l?(0,a.jsx)("button",{type:"button",onClick:()=>I(e.id,1),className:"shrink-0 px-3 py-1.5 rounded-full text-xs font-semibold bg-[#0052FF] hover:bg-[#0039B5] text-white",children:"Add"}):(0,a.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[(0,a.jsx)("button",{type:"button",onClick:()=>I(e.id,l-1),className:"w-6 h-6 rounded-full border border-gray-200 bg-white flex items-center justify-center text-gray-600 hover:bg-gray-100",children:(0,a.jsx)(m,{className:"w-3 h-3"})}),(0,a.jsx)("span",{className:"w-5 text-center text-sm font-medium text-gray-800",children:l}),(0,a.jsx)("button",{type:"button",onClick:()=>I(e.id,l+1),className:"w-6 h-6 rounded-full border border-gray-200 bg-white flex items-center justify-center text-gray-600 hover:bg-gray-100",children:(0,a.jsx)(h.A,{className:"w-3 h-3"})})]})]},e.id)})})]},e)}),T&&0===Y.length&&(0,a.jsx)("p",{className:"text-sm text-gray-400 text-center py-4",children:"No items match your search."}),O>0&&(0,a.jsxs)("div",{className:"flex items-center justify-between gap-3 bg-gray-900 rounded-xl p-3",children:[(0,a.jsxs)("span",{className:"text-sm text-white",children:[O," item",1!==O?"s":""," \xb7 ",F(B)]}),(0,a.jsx)("button",{onClick:K,disabled:v,className:"px-4 py-1.5 rounded-full text-xs font-semibold bg-white text-gray-900 hover:bg-gray-100 disabled:opacity-60",children:v?"Placingâ¦":"Place order"})]}
1),k&&(0,a.jsx)("p",{className:"text-xs text-rose-600 mt-2",children:k})]})]})}function H(e){var t,s,l,r,n;let{stay:i,onBack:c}=e,d=(null!=(s=i.status)?s:"PENDING").toUpperCase(),o=null!=(l=P[d])?l:P.PENDING,x=i.check_in&&i.check_out?Math.round((new Date(i.check_out)-new Date(i.check_in))/864e5):null,m=((null==(t=i.unit_images)?void 0:t.length)?i.unit_images:null!=(r=i.property_images)?r:[])[0],h=i.agent_name?{name:i.agent_name,email:i.agent_email,phone:i.agent_phone,role:"Agent"}:i.property_manager_name?{name:i.property_manager_name,email:i.property_manager_email,phone:i.property_manager_phone,role:"Property Manager"}:i.owner_name?{name:i.owner_name,email:i.owner_email,phone:i.owner_phone,role:"Host"}:null,u=i.company_name?{name:i.company_name,email:i.company_email,phone:i.company_phone}:null;return(0,a.jsxs)("div",{className:"flex flex-col h-full",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 p-5 border-b border-gray-100 shrink-0",children:[(0,a.jsx)("button",{onClick:c,className:"p-1.5 hover:bg-gray-100 rounded-full transition-colors",children:(0,a.jsx)(g.A,{className:"w-4 h-4 text-gray-600"})}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("h2",{className:"font-bold text-gray-900 truncate",children:null!=(n=i.property_name)?n:"Stay Details"}),i.unit_number&&(0,a.jsxs)("p",{className:"text-xs text-gray-500",children:["Unit ",i.unit_number]})]}),(0,a.jsx)("span",{className:"shrink-0 px-2 py-0.5 rounded-full text-[10px] font-bold uppercase tracking-wider border ".concat(o.bg," ").concat(o.text," ").concat(o.border),children:d})]}),(0,a.jsxs)("div",{className:"flex-1 overflow-y-auto",children:[m&&(0,a.jsx)("div",{className:"w-full h-48 bg-gray-100 overflow-hidden",children:(0,a.jsx)("img",{src:(0,D.m)(m,"card"),alt:i.property_name,className:"w-full h-full object-cover"})}),(0,a.jsxs)("div",{className:"p-5 space-y-5",children:[(i.property_address||i.property_location)&&(0,a.jsxs)("div",{className:"flex items-start gap-2",children:[(0,a.jsx)(p.A,{className:"w-4 h-4 text-gray-400 shrink-0 mt-0.5"}),(0,a.jsxs)("div",{children:[i.property_address&&(0,a.jsx)("p",{className:"text-sm text-gray-800 leading-relaxed",children:i.property_address}),i.property_location&&(0,a.jsx)("p",{className:"text-xs text-gray-500 mt-0.5",children:i.property_location})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-[10px] font-bold uppercase tracking-wider text-gray-400 mb-2",children:"Stay period"}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,a.jsxs)("div",{className:"bg-gray-50 rounded-xl p-3",children:[(0,a.jsx)("p",{className:"text-[9px] font-bold uppercase tracking-wider text-gray-400 mb-0.5",children:"Check-in"}),(0,a.jsx)("p",{className:"text-sm font-semibold text-gray-900",children:I(i.check_in)})]}),(0,a.jsxs)("div",{className:"bg-gray-50 rounded-xl p-3",children:[(0,a.jsx)("p",{className:"text-[9px] font-bold uppercase tracking-wider text-gray-400 mb-0.5",children:"Check-out"}),(0,a.jsx)("p",{className:"text-sm font-semibold text-gray-900",children:I(i.check_out)})]})]}),null!==x&&(0,a.jsxs)("div",{className:"flex items-center gap-1.5 mt-2 text-gray-500",children:[(0,a.jsx)(y.A,{className:"w-3.5 h-3.5"}),(0,a.jsxs)("span",{className:"text-xs font-medium",children:[x," night",1!==x?"s":""]})]})]}),(i.bedrooms||i.bathrooms||i.size_sqm)&&(0,a.jsxs)("div",{className:"flex items-center gap-4 py-3 border-y border-gray-100",children:[i.bedrooms>0&&(0,a.jsxs)("div",{className:"flex items-center gap-1.5 text-sm text-gray-700",children:[(0,a.jsx)(b.A,{className:"w-4 h-4 text-gray-400"}),(0,a.jsxs)("span",{children:[i.bedrooms," Bed",1!==i.bedrooms?"s":""]})]}),i.bathrooms>0&&(0,a.jsxs)("div",{className:"flex items-center gap-1.5 text-sm text-gray-700",children:[(0,a.jsx)(f.A,{className:"w-4 h-4 text-gray-400"}),(0,a.jsxs)("span",{children:[i.bathrooms," Bath",1!==i.bathrooms?"s":""]})]}),i.size_sqm&&(0,a.jsxs)("div",{className:"flex items-center gap-1.5 text-sm text-gray-700",children:[(0,a.jsx)(j.A,{className:"w-4 h-4 text-gray-400"}
1),(0,a.jsxs)("span",{children:[Number(i.size_sqm).toLocaleString("en-NG")," m\xb2"]})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-[10px] font-bold uppercase tracking-wider text-gray-400 mb-2",children:"Payment"}),(0,a.jsxs)("div",{className:"bg-gray-50 rounded-xl p-4 space-y-2",children:[x&&i.total_amount&&(0,a.jsxs)("div",{className:"flex justify-between text-sm",children:[(0,a.jsxs)("span",{className:"text-gray-500",children:[F(i.total_amount/x)," \xd7 ",x," night",1!==x?"s":""]}),(0,a.jsx)("span",{className:"font-medium text-gray-900",children:F(i.total_amount)})]}),(0,a.jsxs)("div",{className:"flex justify-between items-center pt-2 border-t border-gray-100",children:[(0,a.jsx)("span",{className:"text-sm font-semibold text-gray-900",children:"Total paid"}),(0,a.jsx)("span",{className:"text-base font-bold text-gray-900",children:F(i.total_amount)})]})]})]}),"CONFIRMED"===d&&(0,a.jsx)(T,{bookingId:i.id}),"CONFIRMED"===d&&(0,a.jsx)(K,{bookingId:i.id}),h&&(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-[10px] font-bold uppercase tracking-wider text-gray-400 mb-2",children:h.role}),(0,a.jsxs)("div",{className:"bg-gray-50 rounded-xl p-4 space-y-2.5",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,a.jsx)(N.A,{className:"w-4 h-4 text-gray-400 shrink-0"}),(0,a.jsx)("span",{className:"text-sm font-semibold text-gray-900",children:h.name})]}),h.phone&&(0,a.jsxs)("a",{href:"tel:".concat(h.phone),className:"flex items-center gap-2.5 hover:text-[#0052FF] transition-colors",children:[(0,a.jsx)(v.A,{className:"w-4 h-4 text-gray-400 shrink-0"}),(0,a.jsx)("span",{className:"text-sm text-gray-700",children:h.phone})]}),h.email&&(0,a.jsxs)("a",{href:"mailto:".concat(h.email),className:"flex items-center gap-2.5 hover:text-[#0052FF] transition-colors",children:[(0,a.jsx)(w.A,{className:"w-4 h-4 text-gray-400 shrink-0"}),(0,a.jsx)("span",{className:"text-sm text-gray-700",children:h.email})]})]})]}),u&&(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-[10px] font-bold uppercase tracking-wider text-gray-400 mb-2",children:"Managed By"}),(0,a.jsxs)("div",{className:"bg-gray-50 rounded-xl p-4 space-y-2.5",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,a.jsx)(k.A,{className:"w-4 h-4 text-gray-400 shrink-0"}),(0,a.jsx)("span",{className:"text-sm font-semibold text-gray-900",children:u.name})]}),u.phone&&(0,a.jsxs)("a",{href:"tel:".concat(u.phone),className:"flex items-center gap-2.5 hover:text-[#0052FF] transition-colors",children:[(0,a.jsx)(v.A,{className:"w-4 h-4 text-gray-400 shrink-0"}),(0,a.jsx)("span",{className:"text-sm text-gray-700",children:u.phone})]}),u.email&&(0,a.jsxs)("a",{href:"mailto:".concat(u.email),className:"flex items-center gap-2.5 hover:text-[#0052FF] transition-colors",children:[(0,a.jsx)(w.A,{className:"w-4 h-4 text-gray-400 shrink-0"}),(0,a.jsx)("span",{className:"text-sm text-gray-700",children:u.email})]})]})]})]})]})]})}function Y(e){let{open:t,onClose:s}=e;(0,M.K)(t);let{isAuthenticated:r}=(0,S.useAuthStore)(),[n,i]=(0,l.useState)([]),[c,d]=(0,l.useState)(!1),[o,x]=(0,l.useState)(1),[m,h]=(0,l.useState)(!1),[u,g]=(0,l.useState)(null);async function y(e){d(!0);try{var t,s,a,l,r,n;let c=await O({page:e,limit:20}),d=null!=(l=null!=(a=null==c||null==(t=c.data)?void 0:t.data)?a:null==c?void 0:c.data)?l:[],o=null!=(n=null!=(r=null==c||null==(s=c.data)?void 0:s.total)?r:null==c?void 0:c.total)?n:d.length;i(1===e?d:e=>[...e,...d]),h(o>20*e),x(e)}catch(t){1===e&&i([])}finally{d(!1)}}return((0,l.useEffect)(()=>{t&&r&&y(1)},[t,r]),(0,l.useEffect)(()=>{t||g(null)},[t]),t)?(0,a.jsxs)("div",{className:"fixed inset-0 z-[90] flex",children:[(0,a.jsx)("div",{className:"absolute inset-0 bg-black/30",onClick:s}),(0,a.jsx)("div",{className:"relative ml-auto w-full max-w-lg bg-[#F0F4F9] h-full flex flex-col gw-panel-right",children:u?(0,a.jsx)(H,{stay:u,onBack:()=>g(null)}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex items-center justify-between p-5 border-b border-gray-100 shrink-0",children:[(0,a.jsx)("h2",{className:"font-bold text-gray-900",children:"My Stay"}),(0,a.jsx)("button",{onClick:s,className:"p-2 hover:bg-gray-100 rounded-full transition-colors",children:(0,a.jsx)(_.A,{className:"w-4 h-4 text-gray-500"})})]}),(0,a.jsx)("div",{className:"flex-1 overflow-y-auto p-5",children:c&&0===n.length?(0,a.jsxs)("div",{className:"flex flex-col items-center py-16 text-gray-400",children:[(0,a.jsx)(A.A,{className:"w-6 h-6 animate-spin mb
1-3"}),(0,a.jsx)("p",{className:"text-sm",children:"Loadingâ¦"})]}):0===n.length?(0,a.jsxs)("div",{className:"flex flex-col items-center py-16 text-center text-gray-400",children:[(0,a.jsx)("div",{className:"w-14 h-14 bg-[#F1F3F4] rounded-full flex items-center justify-center mb-3",children:(0,a.jsx)(b.A,{className:"w-7 h-7 text-gray-200"})}),(0,a.jsx)("p",{className:"text-sm font-semibold text-gray-700 mb-1",children:"No stays yet"}),(0,a.jsx)("p",{className:"text-xs text-gray-400",children:"Browse shortlets and book a stay to get started."})]}):(0,a.jsxs)("div",{className:"space-y-3",children:[n.map(e=>{var t,s,l,r,n,i,c;let d=(null!=(l=e.status)?l:"PENDING").toUpperCase(),o=null!=(r=P[d])?r:P.PENDING,x=e.check_in&&e.check_out?Math.round((new Date(e.check_out)-new Date(e.check_in))/864e5):null,m=null!=(n=null==(t=e.unit_images)?void 0:t[0])?n:null==(s=e.property_images)?void 0:s[0];return(0,a.jsx)("button",{onClick:()=>g(e),className:"w-full text-left bg-white ring-1 ring-black/5 rounded-[28px] p-4 hover:border-gray-300 hover:shadow-sm transition-all",children:(0,a.jsxs)("div",{className:"flex items-start gap-3",children:[m?(0,a.jsx)("div",{className:"w-14 h-14 rounded-xl overflow-hidden shrink-0 bg-gray-100",children:(0,a.jsx)("img",{src:(0,D.m)(m,"thumbnail"),alt:"",className:"w-full h-full object-cover"})}):(0,a.jsx)("div",{className:"w-14 h-14 rounded-xl shrink-0 bg-gray-100 flex items-center justify-center",children:(0,a.jsx)(b.A,{className:"w-6 h-6 text-gray-300"})}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,a.jsx)("p",{className:"text-sm font-bold text-gray-900 truncate",children:null!=(i=e.property_name)?i:"Shortlet"}),(0,a.jsx)("span",{className:"shrink-0 px-2 py-0.5 rounded-full text-[10px] font-bold uppercase tracking-wider border ".concat(o.bg," ").concat(o.text," ").concat(o.border),children:d})]}),e.unit_number&&(0,a.jsxs)("p",{className:"text-xs text-gray-500 mt-0.5",children:["Unit ",e.unit_number]}),(e.property_address||e.property_location)&&(0,a.jsxs)("div",{className:"flex items-center gap-1 mt-1",children:[(0,a.jsx)(p.A,{className:"w-3 h-3 text-gray-400 shrink-0"}),(0,a.jsx)("span",{className:"text-xs text-gray-500 truncate",children:null!=(c=e.property_address)?c:e.property_location})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between mt-2",children:[(0,a.jsxs)("p",{className:"text-xs text-gray-400",children:[I(e.check_in),x?" \xb7 ".concat(x,"n"):""]}),(0,a.jsx)("p",{className:"text-sm font-bold text-gray-900",children:F(e.total_amount)})]})]})]})},e.id)}),m&&(0,a.jsxs)("button",{onClick:()=>y(o+1),disabled:c,className:"w-full flex items-center justify-center gap-2 border border-gray-200 hover:border-gray-900 text-gray-900 font-semibold py-2.5 rounded-xl text-sm transition-colors disabled:opacity-50",children:[c&&(0,a.jsx)(A.A,{className:"w-4 h-4 animate-spin"}),"Load more"]})]})})]})})]}):null}}}]);
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.