PageSourceSearch

https://web.pgmanager.in/static/js/7230.600a0c68.chunk.js

js pgmanager.in collected 2026-09-24 15:03:47 UTC 19,865 bytes, 2 lines download raw bytes

1"use strict";(self.webpackChunkpg_manager=self.webpackChunkpg_manager||[]).push([[7230],{80640:(e,n,o)=>{o.d(n,{Z:()=>t});var i=o(20890),l=o(80184);function t(e){let{title:n,autoHide:o=!0,caption:t}=e;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(i.Z,{className:"page-title accent-secondary-dark",variant:"h6",component:"h6",sx:{fontWeight:400},children:n}),t&&(0,l.jsx)(i.Z,{variant:"caption",color:"grey",children:t})]})}},3928:(e,n,o)=>{o.d(n,{Z:()=>h});var i=o(36314),l=o(20890),t=o(13400),s=o(72791),r=o(24518),a=o(5574),d=o(97123),c=o(39157),u=o(29823),m=o(65661),g=o(46995),x=o(80184);function h(e){const n=(0,s.useMemo)((()=>e.showCloseIcon||!1),[e.showCloseIcon]),o=(0,s.useMemo)((()=>e.disableDialogActions||!1),[e.disableDialogActions]),h=(0,s.useMemo)((()=>"function"===typeof e.onApplyButtonClick||e.showApplyButton||!1),[e.showApplyButton,e.onApplyButtonClick]),b=(0,s.useMemo)((()=>e.applyButtonLabel||"Apply"),[e.applyButtonLabel]),[f,p]=(0,s.useState)(!1),[k]=(0,s.useState)("paper"),j=(0,s.useRef)(null),v=(n,o)=>{"backdropClick"===o&&null!==e&&void 0!==e&&e.preventBackdropClickClose||(null!==e&&void 0!==e&&e.onModalClose&&e.onModalClose(),p(!1))},Z=(0,s.useRef)(null);return(0,s.useEffect)((()=>{if(f){const{current:e}=Z;null!==e&&e.focus()}}),[f]),(0,s.useEffect)((()=>{e.open!==f&&p(e.open)}),[e.open,p,f]),(0,x.jsxs)(a.Z,{fullWidth:"boolean"===typeof(null===e||void 0===e?void 0:e.fullWidth)?e.fullWidth:!(null!==e&&void 0!==e&&e.isFullScreen),fullScreen:(null===e||void 0===e?void 0:e.isFullScreen)||!1,maxWidth:e.maxWidth||"sm",disableEscapeKeyDown:(null===e||void 0===e?void 0:e.disableEscapeKeyDown)||!1,open:f,onClose:v,scroll:k,"aria-labelledby":"scroll-dialog-title","aria-describedby":"scroll-dialog-description",ref:j,sx:{".MuiDialog-paper":{borderRadius:{xs:null!==e&&void 0!==e&&e.isFullScreen?0:4,sm:4}}},children:[(0,x.jsxs)(m.Z,{id:"scroll-dialog-title",children:[null!==e&&void 0!==e&&e.isFullScreen||e.title?(0,x.jsxs)(i.Z,{direction:"row",alignItems:"center",children:[null!==e&&void 0!==e&&e.isFullScreen?(0,x.jsx)(t.Z,{onClick:v,children:(0,x.jsx)(g.Z,{})}):null,e.title?(0,x.jsx)(l.Z,{variant:"h6",fontWeight:400,fontSize:"1.2rem",children:e.title}):""]}):null,e.caption?(0,x.jsx)(l.Z,{sx:{px:null!==e&&void 0!==e&&e.isFullScreen?1:0},display:"block",variant:"caption",color:"textSecondary",children:e.caption}):null,n?(0,x.jsx)(t.Z,{"aria-label":"close",onClick:v,sx:{position:"absolute",right:8,top:8,color:e=>e.palette.grey[500]},children:(0,x.jsx)(u.Z,{})}):null]}),(0,x.jsx)(c.Z,{dividers:"paper"!==k,children:s.cloneElement(e.children,{handleClose:v,dialogRef:j})}),!0===o?null:(0,x.jsxs)(d.Z,{sx:{my:1,mx:1},children:[(0,x.jsx)(r.Z,{color:"secondary",onClick:v,children:"Close"}),h?(0,x.jsx)(r.Z,{variant:"tonal",color:"secondary",onClick:()=>{null!==e&&void 0!==e&&e.onApplyButtonClick&&e.onApplyButtonClick()},children:b}):null]})]})}},61696:(e,n,o)=>{o.d(n,{Z:()=>t});var i=o(21568),l=o(72791);const t=()=>(0,l.useContext)(i.Z)},85300:(e,n,o)=>{o.d(n,{Z:()=>y});var i=o(24518),l=o(61889),t=o(48550),s=o(52739),r=o(57482),a=o(20883),d=o(72791),c=o(61134),u=o(76450),m=o(35552),g=o(42021),x=o(16386),h=o(71652),b=o(30218),f=o(63118),p=o(38140),k=o(11087),j=o(38002),v=o(80184);const Z={name:"",mobileNumber:"",email:"",joiningDate:null,bookingAmount:"",bedId:"",comments:"",bedInfo:null},y=(0,d.memo)((function(e){let{closeModal:n,businessId:o,onBookingAdded:y,bookingData:C,bedSelection:w,openModal:B=!1}=e;a.k.info("[AddBooking] mounting...");const{enqueueSnackbar:S}=(0,m.Ds)(),[I,D]=(0,d.useState)(!1),{handleSubmit:M,control:A,formState:{errors:W},reset:z,watch:F,setValue:P}=(0,c.cI)({mode:"onTouched",defaultValues:{...Z}}),[N]=(0,k.lr)(),R=N.get("bs");return(0,d.useEffect)((()=>{if(C){const{joiningDate:e}=C;z({...C,...e?{joiningDate:(0,g.Z)(e,"dd-MM-yyyy",new Date)}:{}})}else if(w){const{bedId:e,bedInfo:n=null}=w;z({...Z,bedId:e,bedInfo:n})}else{const n=decodeURIComponent(R);try{const e=JSON.parse(n),{bedId:o,bedInfo:i=null}=e;z({...Z,bedId:o,bedInfo:i})}catch(e){z({...Z})}}}),[z,C,R,w]),(0,d.useEffect)((()=>{if(!B||C||!o)return;const e=new AbortController;return(0,j.Fn)({businessId:o},{signal:e.signal}).then((e=>{let{response:n,error:o}=e;"canceled"!==(null===o||void 0===o?void 0:o.message)&&(o?S(null===o||void 0===o?void 0:o.message,{variant:"error"}):n&&Object.keys(n).length>
10&&n.booking&&P("bookingAmount",n.booking))})),()=>{e.abort()}}),[C,o,S,B,P]),(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(s.Z,{sx:{position:"absolute",zIndex:1},open:I,children:(0,v.jsx)(r.Z,{color:"primary",sx:{position:"absolute",width:"100%",top:0,left:0}})}),(0,v.jsxs)(l.ZP,{container:!0,alignItems:"center",rowSpacing:1,noValidate:!0,component:"form",onSubmit:M((function(e){const i=(0,u.X3)(e);delete i.bedInfo;const l={...i,joiningDate:(0,x.Z)(i.joiningDate,"dd-MM-yyyy")};i.id?function(e){a.k.debug("[AddBooking]:{updateBookingDetails} saving data"),D(!0),(0,p.Wp)(o,e,{backgroundRequest:!0}).then((e=>{let{error:o}=e;if(D(!1),o)return S(null===o||void 0===o?void 0:o.message,{variant:"error"});S("Booking details updated successfully",{variant:"success"}),z({...Z}),"function"===typeof y&&y(),n()}))}(l):function(e){a.k.debug("[AddBooking]:{saveBookingDetails} saving data"),D(!0),(0,p.Uv)(o,e,{backgroundRequest:!0}).then((e=>{let{error:o}=e;if(D(!1),o)return S(null===o||void 0===o?void 0:o.message,{variant:"error"});S("New booking has been added",{variant:"success"}),z({...Z}),"function"===typeof y&&y(),n()}))}(l)})),children:[(0,v.jsx)(l.ZP,{item:!0,xs:12,sm:12,md:12,lg:12,xl:12,children:(0,v.jsx)(c.Qr,{control:A,name:"name",id:"name",rules:{required:"Name is required"},render:e=>{let{field:n}=e;return(0,v.jsx)(t.Z,{...n,margin:"normal",label:"Name",error:!(null===W||void 0===W||!W.name),fullWidth:!0})}})}),(0,v.jsx)(l.ZP,{item:!0,xs:12,sm:12,md:12,lg:12,xl:12,children:(0,v.jsx)(c.Qr,{control:A,name:"mobileNumber",id:"mobileNumber",rules:{required:"You must provide a mobile number",pattern:{value:/^[0-9]{10}$/i,message:"Enter valid mobile number"}},render:e=>{var n;let{field:o}=e;return(0,v.jsx)(t.Z,{...o,error:!(null===W||void 0===W||!W.mobileNumber),helperText:(null===W||void 0===W||null===(n=W.mobileNumber)||void 0===n?void 0:n.message)||"",margin:"normal",label:"Mobile Number",fullWidth:!0})}})}),(0,v.jsx)(l.ZP,{item:!0,xs:12,sm:12,md:12,lg:12,xl:12,children:(0,v.jsx)(c.Qr,{control:A,name:"email",id:"email",rules:{required:!1,pattern:{value:/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i,message:"Invalid email address"}},render:e=>{var n;let{field:o}=e;return(0,v.jsx)(t.Z,{...o,value:o.value||"",type:"email",margin:"normal",label:"Email ID",helperText:(null===W||void 0===W||null===(n=W.email)||void 0===n?void 0:n.message)||"",error:!(null===W||void 0===W||!W.email),fullWidth:!0})}})}),(0,v.jsx)(l.ZP,{item:!0,xs:12,sm:12,md:6,mt:1.5,children:(0,v.jsx)(c.Qr,{control:A,name:"joiningDate",id:"joiningDate",required:!0,rules:{required:!0},render:e=>{let{field:n}=e;return(0,v.jsx)(h._,{dateAdapter:f.H,children:(0,v.jsx)(b.O,{...n,required:!0,label:"Joining Date",format:"dd-MMM-yyyy",clearable:!1,disablePast:!0,value:n.value,onChange:e=>{n.onChange(e)},closeOnSelect:!0,openTo:"day",views:["year","month","day"],textField:e=>(0,v.jsx)(t.Z,{value:n.value,...e,margin:"normal",sx:{width:"100%"}}),slotProps:{actionBar:{actions:["today"]},textField:{error:!(null===W||void 0===W||!W.joiningDate)}}})})}})}),(0,v.jsx)(l.ZP,{item:!0,xs:12,sm:12,md:6,mt:1.5,children:(0,v.jsx)(c.Qr,{control:A,name:"bookingAmount",id:"bookingAmount",render:e=>{let{field:n}=e;return(0,v.jsx)(t.Z,{...n,type:"number",onWheel:e=>e.target.blur(),label:"Booking Amount",fullWidth:!0})}})}),F("bedInfo")?(0,v.jsx)(l.ZP,{item:!0,xs:12,sm:12,md:12,lg:12,xl:12,children:(0,v.jsx)(c.Qr,{control:A,name:"bedInfo",id:"bedInfo",render:e=>{let{field:n}=e;return(0,v.jsx)(t.Z,{...n,disabled:!0,margin:"normal",label:"Bed Info",fullWidth:!0})}})}):null,(0,v.jsx)(l.ZP,{item:!0,xs:12,sm:12,md:12,lg:12,xl:12,children:(0,v.jsx)(c.Qr,{control:A,name:"comments",id:"comments",render:e=>{let{field:n}=e;return(0,v.jsx)(t.Z,{...n,value:n.value||"",margin:"normal",label:"Comments",fullWidth:!0,multiline:!0,minRows:3})}})}),(0,v.jsx)(l.ZP,{item:!0,xs:12,sm:12,md:12,lg:12,textAlign:"center",children:(0,v.jsx)(i.Z,{type:"submit",variant:"contained",color:"primary",sx:{mt:3},children:C?"Update":"Add"})})]})]})}))},67230:(e,n,o)=>{o.r(n),o.d(n,{default:()=>G});var i=o(61889),l=o(95193),t=o(72791),s=o(20883),r=o(57689),a=o(11087),d=o(58278),c=o(38140),u=o(35552),m=o(80640),g=o(36314),x=o(84206),h=o(24518),b=o(38001),f=o(20890),p=o(68870),k=o(76450),j=o(16386),v=o(42021),Z=o(34265),y=o(33788),C=o(52093),w=o(80184);const B=e=>{let{bookings:n=[],refreshData:o,addBooking:l,editBooking:s,onDeleteBtnClick:r,checkInInmate:a,permissions:d={}}=e;const{isAddBookingsAllowed:c,isEditBookingsAllowed:u}=d,[m,B]=(0,t.useState)(25),S=e=>{let{children:n}=e;return(0,w.jsx)(p.Z,{sx:{my:1,width:"100%"},children:n})};const I=(0,t.useMemo)((()=>[{field:"bookingDate",headerName:"Booking date",flex:1,minWidth:140,sortable:!1,renderCell:e=>{let{row:n}=e;return(0,w.jsxs)(S,{children:[(0,w.jsx)(f.Z,{variant:"subtitle2",fontWeight:500,children:(0,j.Z)((0,v.Z)(n.bookingDate,"dd-MM-yyyy",new Date),"dd-MMM-yyyy")}
1),null!==n&&void 0!==n&&n.bookingAmount?(0,w.jsxs)(f.Z,{variant:"caption",children:["Amount Paid: ",k.oB.format(n.bookingAmount)]}):null]})}},{field:"name",headerName:"Contact details",flex:1,minWidth:180,renderCell:e=>{let{row:n}=e;return(0,w.jsxs)(S,{children:[(0,w.jsx)(f.Z,{variant:"subtitle1",fontWeight:500,children:n.name}),(0,w.jsx)(f.Z,{variant:"body2",children:n.mobileNumber}),null!==n&&void 0!==n&&n.email?(0,w.jsx)(f.Z,{variant:"caption",children:n.email}):null]})},getApplyQuickFilterFn:e=>n=>{var o,i,l,t,s,r,a,d;const{joiningDate:c,bookingDate:u,bedInfo:m,bookingAmount:g="",comments:x}=(null===n||void 0===n?void 0:n.row)||{};return n&&((null===n||void 0===n||null===(o=n.value)||void 0===o?void 0:o.includes(e))||(null===n||void 0===n||null===(i=n.row)||void 0===i||null===(l=i.mobileNumber)||void 0===l?void 0:l.includes(e))||(null===n||void 0===n||null===(t=n.row)||void 0===t||null===(s=t.email)||void 0===s?void 0:s.includes(e))||c&&(null===(r=(0,j.Z)((0,v.Z)(c,"dd-MM-yyyy",new Date),"MMM dd, yyyy"))||void 0===r?void 0:r.includes(e))||u&&(null===(a=(0,j.Z)((0,v.Z)(u,"dd-MM-yyyy",new Date),"dd-MMM-yyyy"))||void 0===a?void 0:a.includes(e))||(null===m||void 0===m?void 0:m.includes(e))||(null===g||void 0===g||null===(d=g.toString())||void 0===d?void 0:d.includes(e))||(null===x||void 0===x?void 0:x.includes(e)))}},{field:"joiningDate",headerName:"Joining date",type:"date",flex:1,minWidth:140,valueGetter:e=>{let{value:n}=e;return n&&(0,v.Z)(n,"dd-MM-yyyy",new Date)},renderCell:e=>{let{value:n}=e;return(0,w.jsx)(S,{children:(0,w.jsx)(f.Z,{variant:"body2",children:n?(0,j.Z)(n,"MMM dd, yyyy"):"-"})})}},{field:"comments",headerName:"Comments",flex:1,minWidth:220},{field:"actions",type:"actions",minWidth:320,flex:2,align:"left",getActions:e=>{let{row:n}=e;return[(0,w.jsx)(h.Z,{startIcon:(0,w.jsx)(b.Z,{}),size:"small",sx:{ml:1,px:2,fontSize:13,fontWeight:400},variant:"tonal",color:"primary",onClick:()=>a(n),children:"Check-In"}),u?(0,w.jsx)(h.Z,{startIcon:(0,w.jsx)(x.Z,{}),size:"small",sx:{ml:1,px:1.8,fontSize:13,fontWeight:400},variant:"outlined",color:"secondary",onClick:()=>s(n),children:"Edit"}):(0,w.jsx)(w.Fragment,{}),u?(0,w.jsx)(h.Z,{size:"small",sx:{px:1,fontSize:13,fontWeight:400},color:"error",onClick:()=>r(n.id),children:"Cancel"}):(0,w.jsx)(w.Fragment,{})]}}]),[s,r,a,u]);return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(i.ZP,{item:!0,xs:12,display:{xs:"none",md:"block"},children:(0,w.jsxs)(g.Z,{direction:"row",columnGap:1,justifyContent:"right",children:[(0,w.jsx)(h.Z,{onClick:o,children:"Refresh"}),c?(0,w.jsx)(h.Z,{color:"tertiary",variant:"tonal",onClick:l,children:"New Booking"}):null]})}),(0,w.jsx)(i.ZP,{item:!0,xs:12,sm:12,md:12,lg:12,xl:12,sx:{mt:2,mb:{xs:10,md:2}},children:(0,w.jsx)(p.Z,{sx:{height:"500px",width:"100%"},children:(0,w.jsx)(C._$,{rows:n,columns:I,pageSize:m,onPageSizeChange:e=>B(e),rowsPerPageOptions:[10,25,50,100,150],getRowId:e=>e.id,getRowHeight:()=>"auto",hideFooterSelectedRowCount:!0,disableSelectionOnClick:!0,autoHeight:n.length<=8,sx:{...k._Q},disableColumnSelector:!0,disableDensitySelector:!0,disableRowSelectionOnClick:!0,slots:{toolbar:function(){return(0,w.jsx)(Z.D,{sx:{justifyContent:"right"},children:(0,w.jsx)(y.T,{})})}},slotProps:{toolbar:{showQuickFilter:!0,quickFilterProps:{debounceMs:500}}},localeText:{noRowsLabel:"No bookings to show"}})})})]})};var S=o(3928),I=o(85300),D=o(61696),M=o(61084),A=o(75335),W=o(99168),z=o(42419),F=o(57621),P=o(72363),N=o(21051),R=o(27247),E=o(13400),T=o(39504),q=o(93979),$=o(13771),O=o(85108);const Q=e=>{let{bookings:n=[],addBooking:o,editBooking:l,onDeleteBtnClick:s,permissions:r={},checkInInmate:a}=e;const{isAddBookingsAllowed:d,isEditBookingsAllowed:c}=r,[u,m]=(0,t.useState)(!1),[p,k]=(0,t.useState)(null),j=(0,t.useCallback)((()=>{m(!1),setTimeout((()=>k(null)),400)}),[]),v=(0,t.useCallback)((e=>{k(e),m(!0)}),[]);return(0,w.jsxs)(i.ZP,{container:!0,item:!0,xs:12,sm:12,md:12,lg:12,xl:12,spacing:2,mb:5,children:[n.map((e=>(0,w.jsx)(i.ZP,{item:!0,xs:12,sm:6,md:6,lg:6,children:(0,w.jsxs)(F.Z,{children:[(0,w.jsxs)(T.Z,{children:[(0,w.jsxs)(f.Z,{sx:{fontSize:12},color:"grey",children:["Booked on ",e.bookingDate]}),(0,w.jsx)(f.Z,{variant:"h6",component:"div",fontSize:"1rem",gutterBottom:!0,children:e.name}),(0,w.jsxs)(g.Z,{direction:"row",alignItems:"center",gap:.5,children:[(0,w.jsx)(q.Z,{sx:{fontSize:"1rem",color:$.Z[200]}}),(0,w.jsx)(f.Z,{sx:{fontSize:14.5,color:$.Z[700],fontWeight:500},children:e.mobileNumber})]}),(0,w.jsxs)(g.Z,{direction:"row",alignItems:"center",gap:.5,children:[(0,w.jsx)(O.Z,{sx:{fontSize:"1rem",color:$.Z[200]}}),(0,w.jsxs)(f.Z,{sx:{fontSize:14.5,color:$.Z[700]},children:["Joining on ",(0,w.jsx)("strong",{style:{fontWeight:500},children:e.joiningDate})]})]})]}),(0,w.jsx)(P.Z,{children:(0,w.jsxs)(g.Z,{direction:"row",justifyContent:"space-around",gap:2,sx:{flexFlow:"wrap"},width:"100%",mb:1,children:[c?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(E.Z,{"aria-label":"delete",onClick:()=>l(e),children:(0,w.jsx)(x.Z,{fontSize:"inherit",color:"warning"})}),(0,w.jsx)(E.Z,{"aria-label":"delete",onClick:()=>s(e.id),children:(0,w.jsx)(R.Z,{fontSize:"inherit",color:"error"})})]}):null,(0,w.jsx)(E.Z,{"aria-label":"delete",onClick:()=>v(e),children:(0,w.jsx)(N.Z,{fontSize:"inherit",color:"info"})}),(0,w.jsx)(h.Z,{startIcon:(0,w.jsx)(b.Z,{}),size:"small",sx:{fontSize:13,fontWeight:400},variant:"tonal",color:"primary",onClick:()=>a(e),children:"Check-In"})]})})]})},e.id))),d?(0,w.jsx)(W.Z,{ariaLabel:"Add Booking",sx:{position:"fixed",bottom:16,right:32,display:{xs:"block",md:"none"}},icon:(0,w.jsx)(z.Z,{}),color:"primary",onClick:o}
1):null,(0,w.jsx)(U,{openModal:u,onModalClose:j,bookingData:p})]})};function U(e){let{openModal:n,onModalClose:o,bookingData:i={}}=e;const{bookingDate:l,name:t,mobileNumber:s,joiningDate:r,email:a,bookingAmount:d,comments:c}=i||{};return(0,w.jsx)(S.Z,{isFullScreen:!1,maxWidth:"sm",onModalClose:o,open:n,title:"Booking Details",disableDialogActions:!0,showCloseIcon:!0,children:(0,w.jsx)(F.Z,{elevation:0,children:(0,w.jsxs)(T.Z,{p:0,children:[(0,w.jsxs)(f.Z,{sx:{fontSize:12},color:"grey",children:["Booked on ",l]}),(0,w.jsx)(f.Z,{variant:"h6",component:"div",fontSize:"1rem",children:t}),(0,w.jsxs)(f.Z,{sx:{fontSize:14.5,color:$.Z[700]},gutterBottom:!0,children:["Joining on ",(0,w.jsx)("strong",{style:{fontWeight:500},children:r})]}),(0,w.jsxs)(g.Z,{direction:"row",alignItems:"center",gap:.5,mb:.5,children:[(0,w.jsx)(q.Z,{sx:{fontSize:"1rem",color:$.Z[200]}}),(0,w.jsx)(f.Z,{sx:{fontSize:14.5,color:$.Z[700],fontWeight:500},children:s})]}),a?(0,w.jsxs)(g.Z,{direction:"row",alignItems:"center",gap:.5,mb:.5,children:[(0,w.jsx)(A.Z,{sx:{fontSize:"1rem",color:$.Z[200]}}),(0,w.jsx)(f.Z,{sx:{fontSize:14.5,color:$.Z[700]},children:a})]}):null,d?(0,w.jsxs)(f.Z,{sx:{fontSize:14.5,color:$.Z[700]},gutterBottom:!0,children:["Booking amount paid:  ",(0,w.jsx)(M.Z,{sx:{fontSize:14,verticalAlign:"middle"}}),(0,w.jsx)("strong",{style:{fontWeight:500},children:parseFloat(d).toFixed(2)})]}):null,c?(0,w.jsx)(f.Z,{sx:{fontSize:14.5,color:$.Z[700]},gutterBottom:!0,children:c}):null]})})})}var _=o(92686),J=o(71198),L=o(26211);function H(e){let{openModal:n,onModalClose:o,businessId:i,refreshData:t,bookingData:s}=e;const r=(0,l.Z)((e=>e.breakpoints.up("sm")));return(0,w.jsx)(S.Z,{isFullScreen:!r,maxWidth:"sm",onModalClose:o,open:n,title:s?"Update Booking Details":"New Booking",handleClose:o,disableDialogActions:!0,showCloseIcon:!!r,children:(0,w.jsx)(I.Z,{businessId:i,closeModal:o,onBookingAdded:t,bookingData:s,openModal:n})})}const G=e=>{let{pageRef:n}=e;s.k.info("[BookingsPage] mounting...");const[o,g]=(0,t.useState)(!1),{enqueueSnackbar:x}=(0,u.Ds)(),[h,b]=(0,t.useState)([]),[f,p]=(0,t.useState)(null),{businessId:k}=(0,r.UO)(),j=(0,D.Z)(),[v,Z]=(0,a.lr)(),y=(0,r.s0)(),C=(0,l.Z)((e=>e.breakpoints.up("md"))),{permissions:S}=(0,t.useContext)(J.Il),I=(0,t.useMemo)((()=>(0,L._L)(["Add bookings"],S)),[S]),M=(0,t.useMemo)((()=>(0,L._L)(["Edit bookings"],S)),[S]),A=(0,t.useCallback)((e=>{s.k.debug("[BookingsPage]:{getBookings} fetching bookings data...");const o=new AbortController;return(0,c.pX)(k,{signal:o.signal,pageRef:n}).then((e=>{let{response:n,error:o}=e;if("canceled"!==(null===o||void 0===o?void 0:o.message))return o?(b([]),x(null===o||void 0===o?void 0:o.message,{variant:"error"})):void b(n)})),o}),[n,k,x]);(0,t.useEffect)((()=>{const e=A();return()=>{e.abort()}}),[A]);const W=(0,t.useCallback)((()=>{A()}),[A]),z=(0,t.useCallback)((()=>{g(!1),p(null),"t"===v.get("o")&&(v.delete("o"),v.delete("bs"),Z(v,{replace:!0}))}),[Z,v]),F=(0,t.useCallback)((e=>{p(e),g(!0)}),[]),P=(0,t.useCallback)((e=>{s.k.debug("[BookingsPage]:{cancelBooking} deleting booking data"),(0,c.FF)(k,e,{pageRef:n}).then((n=>{let{error:o}=n;if(o)return x(null===o||void 0===o?void 0:o.message,{variant:"error"});x("Booking has been cancelled.",{variant:"success"}),b((n=>n.filter((n=>n.id!==e))))}))}),[x,n,k]),N=(0,t.useCallback)((e=>{j({title:"",description:"Are you sure you want to cancel this booking?"}).then((()=>{P(e)})).catch((()=>{}))}),[j,P]);(0,t.useEffect)((()=>{"t"===v.get("o")&&g(!0)}),[v]);const R=(0,t.useCallback)((e=>{const{name:n,mobileNumber:o,email:i="",joiningDate:l,bedId:t,sharingType:s,bedInfo:r}=e||{};let a="";const c={name:n,mobileNumber:o,email:i,joiningDate:l};t&&s&&r&&(a={sharingType:s,bedInfo:r,bedId:t},a=`&bs=${encodeURIComponent(JSON.stringify(a))}`);const u=encodeURIComponent(JSON.stringify(c));y(`${(0,d.Gn)(_.Z.CHECK_IN,{businessId:k})}?iDfB=${u}${a}`)}),[k,y]);return(0,w.jsxs)(i.ZP,{container:!0,marginBottom:3,children:[(0,w.jsx)(i.ZP,{item:!0,xs:12,sm:12,md:12,lg:12,xl:12,children:(0,w.jsx)(m.Z,{title:"Bookings",caption:"Take bookings and block beds for prospective tenants"})}),(0,w.jsx)(i.ZP,{item:!0,xs:12,children:C?(0,w.jsx)(B,{bookings:h,addB
1ooking:()=>g(!0),refreshData:W,editBooking:F,onDeleteBtnClick:N,checkInInmate:R,permissions:{isAddBookingsAllowed:I,isEditBookingsAllowed:M}}):(0,w.jsx)(Q,{bookings:h,addBooking:()=>g(!0),refreshData:W,editBooking:F,checkInInmate:R,onDeleteBtnClick:N,permissions:{isAddBookingsAllowed:I,isEditBookingsAllowed:M}})}),(0,w.jsx)(H,{businessId:k,onModalClose:z,openModal:o,refreshData:W,bookingData:f})]})}},38140:(e,n,o)=>{o.d(n,{FF:()=>r,Uv:()=>t,Wp:()=>s,pX:()=>l});var i=o(6895);async function l(e,n){return i.R.GET({url:`/${e}/booking`},n)}async function t(e,n,o){return i.R.POST({url:`/${e}/booking`,body:n},o)}async function s(e,n,o){return i.R.PUT({url:`/${e}/booking`,body:n},o)}async function r(e,n,o){return i.R.DELETE({url:`/${e}/booking/${n}`},o)}}}]);
2//# sourceMappingURL=7230.600a0c68.chunk.js.map

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.