diff --git a/CHECKSUMS.txt b/CHECKSUMS.txt index 0635d7425ed558923272f3652b2fd2e1148871ae..f878c63ee3b0536a3ce7953bdb5cc55da65c90bc 100644 --- a/CHECKSUMS.txt +++ b/CHECKSUMS.txt @@ -1,28 +1,28 @@ -Cover Charge v0.3.12.160: web apps, plus the Cover Charge for Display tablet app for Android (downloads/android/, its SHA-256 is in downloads/android/SHA256.txt). No phone APKs were built for v0.1.2 to v0.3.12.160. +Cover Charge v0.3.12.161: web apps, plus the Cover Charge for Display tablet app for Android (downloads/android/, its SHA-256 is in downloads/android/SHA256.txt). No phone APKs were built for v0.1.2 to v0.3.12.161. SHA-256 of each web app's start page, service worker, manifest and logo: -98e4755d919c77c93008687882b073e45dde2422a624540488818c18f7ef474f owner-app/index.html -3f4ef0434def63ec59a4f3d4f212dafb27793871d4926874d370afcf72462881 owner-app/sw.js +017b2f9785ee37cdd3ebc779f3d36060e44db2cb9869f49672c6a882bc4f1713 owner-app/index.html +f63002834c22399a6e679e69fb2c21f9bec0c21a05e1c259c97cbcf688d5317b owner-app/sw.js e305c44d11a9c25f37372f3fa4d329d4ffb04df2edee6e7b4b9ac91f3875ac67 owner-app/manifest.webmanifest cc3dd9b8a359ba6c3f28d625c27cc6a01a46233311c2a5f5c8aaf09e91be8239 owner-app/brand-logo.png -d6452d9a907bced38a90d1f34dd9adcc9dc1d25a6561755140790b6c18e65618 staff-app/index.html -a8f9878b8e8a5065455b523755c50be6e8b136d426f40d40fea2d6514251fab5 staff-app/sw.js +2fb891fed56837880f13fb9b6e78063cde3963ae66a5a52de284c944f0c9aca5 staff-app/index.html +c3395babc15d14ea16c4131cce3521577544915822c161190caba822d724ab59 staff-app/sw.js bd1d310ebf8e2a80808e100c41fb7fe1c4369d3026478f3ad8eececaeadaf4ac staff-app/manifest.webmanifest cc3dd9b8a359ba6c3f28d625c27cc6a01a46233311c2a5f5c8aaf09e91be8239 staff-app/brand-logo.png -aa60eab6fd98b38b3990ed8cd4858871980a191ea8a322271ed4161b2f3636f0 customer-app/index.html -2b09fd0d676a9e17f79953337f258033295beb268182942a057b5f34a656b28f customer-app/sw.js +2c4014a4997b2f185b6056c8b03e186c52c064a394c90f10f35877ed7648704c customer-app/index.html +8309e55c82489181dd1eb5fadcc2b21aa041b34c4e8b416e4100f3e0d5903180 customer-app/sw.js 3bfb1fd10cc13f09ca6be65c461e1f6b5750ae51a3ece12e079750b2a066052e customer-app/manifest.webmanifest cc3dd9b8a359ba6c3f28d625c27cc6a01a46233311c2a5f5c8aaf09e91be8239 customer-app/brand-logo.png -fc1df609fdf1decfbe4f84279a9c7a858f8aaf03437f0ffbcc33daa21545f021 display-app/index.html -1a680c1457158f3d0c5d3d038bd6f32561babf9e5a6e25ce99a5cc7cefab38e3 display-app/sw.js +dd02394e39f1570cf66df8051f965ed4e1a8bdae9dd67e42362ace41cb68cbe3 display-app/index.html +c0aa42d9c80180768216f9565428cc5d991ae269401c90659833f22e8118288b display-app/sw.js 35e2721b86eb1ae1605e55bee64177adcee72f4e53a24ac417d19ea2873434a1 display-app/manifest.webmanifest cc3dd9b8a359ba6c3f28d625c27cc6a01a46233311c2a5f5c8aaf09e91be8239 display-app/brand-logo.png -c8b03bea5a791816b9b799695a795b626d1447e2b9572f0a296055bd75e8488a chef-app/index.html -96e71f5d4e9c754824515e5f1bcdc5fc45c63f5171096982cebed0924d46d027 chef-app/sw.js +80b69ac107bf0fb57395b58ea388c2f1b04479a5e7022d2c6d9877abfe7dcd86 chef-app/index.html +e655d33fdd9d35e1c7c1a24b5eec7b9075b252a19ebd0da2d177a08d8aa62239 chef-app/sw.js 97ed43decde8a888e22b7411e13a2122c6f8b9944cf38b2e28e8f62ef2e25397 chef-app/manifest.webmanifest cc3dd9b8a359ba6c3f28d625c27cc6a01a46233311c2a5f5c8aaf09e91be8239 chef-app/brand-logo.png -6541edcc16d7d05bf3c0e39504de81892e585bf647c6db8320261977bae216a4 car-app/index.html -729fe87be02a388a41b2dcb3833eabf4a73d8d8f1baa0c5f209524e7811db60d car-app/sw.js +7bcca576e11424785470cf5c9999f272cea43ab714e222200e2b923ba22a66e7 car-app/index.html +b49b03ab45e005d42ef05adb8f8f5a7afaa583d9abe2eeb23b3a0dd4e63ef629 car-app/sw.js 091b9f96d36153d270b44dbf458aa99e4fd5e2f127769d030436fcd1d51e724a car-app/manifest.webmanifest cc3dd9b8a359ba6c3f28d625c27cc6a01a46233311c2a5f5c8aaf09e91be8239 car-app/brand-logo.png fb1f73283c30e03612191eb339980b1b4922f3929cc60fa4780340c53d6434f1 car.html diff --git a/car-app/_expo/static/js/web/bundle.js b/car-app/_expo/static/js/web/bundle.js index 14d59a07414af6ce3b184f7b3940b6bb9a195966..000ecf65dde999f492e6b7accf67cf6582278e9e 100644 --- a/car-app/_expo/static/js/web/bundle.js +++ b/car-app/_expo/static/js/web/bundle.js @@ -872,7 +872,7 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{v __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},789,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},790,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},791,[]); -__d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ChefApp=function({section:e}={}){const{r:s,rid:o,me:n,now:L}=(0,M.useChef)(3e4);(0,fe.useReviewAlerts)(o);const _=(0,N.useSignedIn)(),U=_?.id??M.CHEF_ID,q=_?.ownerAccess&&'owner'!==_.role?'owner privileges':_?.managerAccess&&'staff'===_.role?'manager privileges':'',be=(0,xe.useSync)(e=>e.perms),ye=be.includes('*')||be.includes('takings.view');(0,i.useSoldOutLink)(!0,(_?.name??n).replace(' (example)',''));const Se=e?Te[e]:void 0,[Ie,He]=(0,I.useState)(Se?.tab??'home'),[Re,Ae]=(0,I.useState)(Se?.k??null),[De,Be]=(0,I.useState)(Se?.stock??'levels'),[$e,Oe]=(0,I.useState)(void 0),[Ee,Fe]=(0,I.useState)(Se?.gp??'dishes'),Le=(0,I.useRef)(null),Ge=(0,k.ymd)(L),Ne=(0,k.ymd)(new Date(L.getTime()+864e5));(0,p.useTipsPosted)(o,Ge);const Me=(0,X.useTravelDay)('chef',Ge),We='home'===Ie&&!Me;(0,P.useKitchenTodoChime)(o,Ge,()=>Ue('kitchen','bookings')),(0,he.useAlertWatcher)(o,{kinds:['takeaway']}),(0,I.useEffect)(()=>{(0,N.ensureAttendance)((new Date).toISOString().slice(0,10),L)},[]);const Ke=(0,I.useRef)({t:'home',k:null});Ke.current={t:Ie,k:Re};const Ve=(0,I.useRef)([]),ze=(0,l.useScrollMemory)(Le),Ue=(0,I.useCallback)((e,t=null)=>{'takings'!==t||ye||(t=null);const s=Ke.current;s.t===e&&s.k===t||(Ve.current=[...Ve.current,{...s,y:ze.leave()}].slice(-30),ze.restore(0)),He(e),Ae(t)},[ye]),qe=(0,I.useCallback)(()=>{if((0,r.runBackLayer)())return!0;const e=Ke.current;let t=Ve.current.pop();for(;t&&t.t===e.t&&t.k===e.k;)t=Ve.current.pop();if(!t&&'home'===e.t&&!e.k)return!1;const s=t??{t:'home',k:null};return ze.leave(),He(s.t),Ae(s.k),ze.restore(s.y??0),!0},[]);(0,r.useWebBack)(qe);const Qe=(0,r.useInnerBackShown)();(0,I.useEffect)(()=>{c.PITCH&&(globalThis.__pitchGo=(e,t=null,s)=>{'stock'===e&&s&&Be(s),'gp'===e&&s&&Fe(s),Ue(e,t)})},[Ue]),(0,f.useShiftReminders)({rid:o,staffId:U,name:n,kitchen:!0}),(0,C.useScheduledNotices)({rid:o,staffId:_?.id??'',name:n,onOpen:e=>{'orderlists'===e&&Ue('kitchen','orderlists'),'chat'===e&&Ue('kitchen','live')}}),(0,T.useOffRotaPrompt)({rid:o,staffId:_?.id??''}),(0,I.useEffect)(()=>{const e=H.default.addEventListener('hardwareBackPress',qe);return()=>e.remove()},[qe]),(0,I.useEffect)(()=>{'takings'!==Re||ye||(Ae(null),He('kitchen'))},[Re,ye]);const Ye=Ce.filter(e=>'takings'!==e.id||ye),Je=Re&&('takings'!==Re||ye)?Ce.find(e=>e.id===Re):null,Xe=((0,D.default)().width,Je?Je.title:{home:'Today in the kitchen',stock:c.PITCH?'Stock':'Deliveries & stock',gp:'GP & costing',creator:le.CREATOR_TITLE,orders:'Orders',kitchen:'Kitchen'}[Ie]);return(0,ve.jsxs)($.SafeAreaView,{style:{flex:1,backgroundColor:G.colours.bg},edges:['top','bottom'],children:[(0,ve.jsxs)(B.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:G.colours.border,gap:6},children:[(0,ve.jsx)(B.default,{style:{position:'absolute',top:4,right:6,zIndex:5,flexDirection:'row',alignItems:'center'},children:(0,ve.jsx)(E.VoiceSlot,{size:44})}),(0,ve.jsx)(B.default,{testID:"header-me-wrap",style:{alignItems:'flex-start',minHeight:44,justifyContent:'center',maxWidth:'70%'},children:(0,ve.jsx)(B.default,{testID:"header-me",accessibilityLabel:`Signed in as ${n.replace(' (example)','')}, Head Chef${q?`, ${q}`:''}`,style:{borderWidth:1,borderColor:G.colours.gold,borderRadius:16,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%'},children:(0,ve.jsxs)(F.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,ve.jsx)(ie.StaffAvatar,{id:M.CHEF_ID,size:24,ring:!1}),(0,ve.jsxs)(B.default,{style:{flexShrink:1},children:[(0,ve.jsxs)(F.T,{size:13,weight:"semibold",colour:G.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[n.replace(' (example)','')," \xb7 Head Chef"]}),q?(0,ve.jsx)(F.Muted,{center:!1,size:10,numberOfLines:1,children:q}):null]})]})})}),(0,ve.jsx)(O.VenueHeaderBlock,{rid:o,name:s.name,badge:"CHEF",place:"Head Chef app"}),(0,ve.jsx)(R.default,{accessibilityRole:"button",accessibilityLabel:"Open CoverCharge for Staff",onPress:()=>{const e=(0,ae.appUrl)('staff');e&&window.location.assign(e)},style:{alignSelf:'center',borderWidth:1,borderColor:G.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:3,minHeight:44,justifyContent:'center'},children:(0,ve.jsx)(F.T,{size:13,colour:G.colours.gold,children:"Staff app \u203a"})})]}),(0,ve.jsxs)(A.default,{ref:Le,...ze.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:[(0,ve.jsx)(r.BackTitleRow,{back:!('home'===Ie&&!Re||Qe),onBack:qe,title:Xe}),'home'===Ie?(0,ve.jsx)(X.DayBar,{app:"chef",today:Ge}):null,'home'===Ie&&Me?(0,ve.jsx)(X.DayView,{rid:o,day:Me,today:Ge,app:"chef"}):null,'home'===Ie?(0,ve.jsx)(oe.WhoBar,{}):null,We&&_?(0,ve.jsx)(h.MyTasksToday,{rid:o,staffId:_.id,name:_.name,onShift:(0,f.shiftNow)(_.id,L.getTime()).on}):null,We?(0,ve.jsx)(p.TodaysTipsCard,{rid:o,today:Ge}):null,We?(0,ve.jsx)(p.TipsPotCard,{rid:o,today:Ge}):null,We?(0,ve.jsx)(b.CoversToday,{rid:o,onPress:()=>Ue('kitchen','bookings')}):null,We?(0,ve.jsx)(y.LastFoodBanner,{rid:o,now:L}):null,We?(0,ve.jsx)(x.NextTableFreeCard,{rid:o,now:L}):null,We?(0,ve.jsx)(j.KitchenSignoffs,{rid:o,today:Ge,by:n,app:"chef"}):null,We?(0,ve.jsxs)(B.default,{style:{gap:4},children:[(0,ve.jsx)(j.PlattersBooked,{rid:o,date:Ge,label:"Platters booked today"}),(0,ve.jsx)(j.PlattersBooked,{rid:o,date:Ne,label:"Platters booked tomorrow"})]}):null,We?(0,ve.jsx)(me.ChefAssistantButton,{}):null,We?(0,ve.jsx)(Pe,{go:(e,t)=>{'stock'===e&&t&&Be(t),'gp'===e&&t&&Fe(t),'orders'===e&&Oe(t),Ue(e,'kitchen'===e?t??null:null)}}):null,'stock'!==Ie||c.PITCH?null:(0,ve.jsx)(Y.KitchenCosts,{rid:o,me:(_?.name??n).replace(' (example)',''),actor:{name:(_?.name??n).replace(' (example)',''),role:'head-chef'},initial:'deliveries'===De?'deliveries':'take'===De?'count':'deliveries'},`s-${De}`),'gp'!==Ie||c.PITCH?null:(0,ve.jsx)(Y.KitchenCosts,{rid:o,me:(_?.name??n).replace(' (example)',''),actor:{name:(_?.name??n).replace(' (example)',''),role:'head-chef'},initial:"dishgp"},`g-${Ee}`),'stock'===Ie&&c.PITCH?(0,ve.jsx)(Q.StockScreen,{initial:De},De):null,'gp'===Ie&&c.PITCH?(0,ve.jsx)(W.GpScreen,{initial:Ee},Ee):null,'creator'===Ie?(0,ve.jsx)(le.DishCreator,{rid:o,canPublish:!1}):null,'orders'===Ie?(0,ve.jsx)(z.OrdersScreen,{focus:$e},$e??'all'):null,'kitchen'!==Ie||Je?null:(0,ve.jsxs)(B.default,{style:{gap:10},children:[(0,ve.jsx)(B.default,{style:{borderRadius:14,borderWidth:1,borderColor:G.colours.border,backgroundColor:G.colours.surface,overflow:'hidden'},children:Ye.map((e,t)=>(0,ve.jsx)(R.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>Ue(Ie,e.id),style:({pressed:e})=>({padding:12,borderTopWidth:t?1:0,borderColor:G.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,ve.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,ve.jsxs)(B.default,{style:{flex:1},children:[(0,ve.jsx)(F.T,{weight:"medium",children:e.title}),(0,ve.jsx)(F.Muted,{children:e.sub})]}),(0,ve.jsx)(F.T,{colour:G.colours.muted,children:"\u203a"})]})},e.id))}),(0,ve.jsx)(F.Muted,{children:"Head Chef sees kitchen, stock, food costs and GP. Payroll, wages and the restaurant's billing stay in CoverCharge for Managers."}),(0,ve.jsxs)(F.Muted,{center:!0,children:["Head Chef app \xb7 ",d.APP_VERSION," \xb7 ",'live'===xe.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),'myshift'===Re&&U?(0,ve.jsxs)(B.default,{style:{gap:10},testID:"chef-myshift",children:[(0,ve.jsx)(te.ClockInOut,{}),(0,ve.jsx)(se.MyUpcomingShifts,{staffId:U,team:!0})]}):null,'mypay'===Re?(0,ve.jsxs)(B.default,{style:{gap:10},testID:"chef-mypay",children:[(0,ve.jsx)(Z.MyPeriods,{staffId:U}),(0,ve.jsx)(J.MyHoursPay,{staffId:U}),(0,ve.jsx)(ee.MyTips,{staffId:U}),(0,ve.jsx)(F.Card,{children:(0,ve.jsx)(u.PhoneAlerts,{})})]}):null,'alerts'===Re?(0,ve.jsx)(B.default,{testID:"chef-alerts",children:(0,ve.jsx)(u.PhoneAlerts,{})}):null,'avatar'===Re?(0,ve.jsx)(t.AvatarMaker,{meId:_?.id??M.CHEF_ID,me:n}):null,'reviews'===Re?(0,ve.jsx)(ge.ReviewsSection,{rid:o,mode:"read",venueName:s.name}):null,'bookings'===Re?(0,ve.jsx)(S.TodaysBookings,{rid:o,today:Ge,by:n,app:"chef"}):null,'specials'===Re?(0,ve.jsx)(de.SpecialsEditor,{rid:o,me:n,app:"chef",now:L}):null,'forecast'===Re?(0,ve.jsx)(K.ChefForecast,{openPrep:()=>Ue('kitchen','prep')}):null,'prep'===Re?(0,ve.jsx)(V.PrepScreen,{}):null,'live'===Re?(0,ve.jsx)(V.TeamScreen,{}):null,'waste'===Re?(0,ve.jsx)(V.WasteScreen,{}):null,'recipes'===Re?(0,ve.jsx)(pe.RecipeCards,{rid:o,actor:{name:n,role:'head-chef'},mode:"edit"}):null,'allergens'===Re?(0,ve.jsx)(V.AllergenScreen,{openCards:()=>Ue('kitchen','recipes')}):null,'compliance'===Re?(0,ve.jsx)(V.ComplianceScreen,{}):null,'takings'===Re&&ye?(0,ve.jsx)(p.CashUpScreen,{rid:o,today:Ge,canEdit:!1,chartsOnly:!0,who:{id:U,name:n.replace(' (example)','')}}):null,'board'===Re?(0,ve.jsx)(ke.QuestionBoard,{rid:o,today:Ge,manager:!1,by:""}):null,'teamtasks'===Re?(0,ve.jsx)(h.KitchenTeamTasks,{rid:o,actor:_}):null,'orderlists'===Re?(0,ve.jsx)(v.OrderListsScreen,{rid:o,today:Ge,editor:!0,who:{id:U,name:n.replace(' (example)','')}}):null,'foodsafety'===Re?(0,ve.jsx)(w.FoodSafetyCard,{children:(0,ve.jsx)(R.default,{accessibilityRole:"button",onPress:()=>Ue('kitchen','haccp'),children:(0,ve.jsx)(F.T,{colour:G.colours.gold,children:"Today\u2019s temperature log \u203a"})})}):null,'haccp'===Re?(0,ve.jsx)(re.HaccpLog,{mode:"chef",me:n,meId:M.CHEF_ID,now:L}):null,'accidents'===Re?(0,ve.jsx)(ne.AccidentBook,{app:"chef",me:n,meId:M.CHEF_ID,now:L,seeAll:!1}):null]}),(0,ve.jsx)(je.BottomTabs,{tablist:!0,background:G.colours.surface,active:Ie,onPress:e=>Ue(e),tabs:we.map(e=>({id:e.id,label:e.label,short:'creator'===e.id?'Creator':void 0,icon:e.icon}))}),(0,ve.jsx)(me.ChefAssistantSheet,{go:(e,t)=>{'orders'===e?(Oe(t),Ue('orders')):'gp'===e?Ue('gp'):Ue('kitchen',e)}}),(0,ve.jsx)(ce.AlertHost,{variant:"chef",rid:o,skipTakeaway:!0}),(0,ve.jsx)(ue.KitchenFlash,{rid:o,me:n})]})};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),i=_r(_d[3]),n=_r(_d[4]),l=_r(_d[5]),r=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),f=_r(_d[12]),k=_r(_d[13]),b=_r(_d[14]),y=_r(_d[15]),x=_r(_d[16]),j=_r(_d[17]),v=_r(_d[18]),w=_r(_d[19]),C=_r(_d[20]),T=_r(_d[21]),P=_r(_d[22]),S=_r(_d[23]),I=_r(_d[24]),H=e(_r(_d[25]));_r(_d[26]);var R=e(_r(_d[27])),A=e(_r(_d[28])),D=e(_r(_d[29])),B=e(_r(_d[30])),$=_r(_d[31]),O=_r(_d[32]),E=_r(_d[33]),F=_r(_d[34]),L=_r(_d[35]),G=_r(_d[36]),N=_r(_d[37]),_=_r(_d[38]),M=_r(_d[39]),W=_r(_d[40]),K=_r(_d[41]),V=_r(_d[42]),z=_r(_d[43]),U=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),Y=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),se=_r(_d[53]),oe=_r(_d[54]),ie=_r(_d[55]),ae=_r(_d[56]),ne=_r(_d[57]),le=_r(_d[58]),re=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),pe=_r(_d[64]),ge=_r(_d[65]),fe=_r(_d[66]),ke=_r(_d[67]),be=_r(_d[68]),me=_r(_d[69]),ye=_r(_d[70]),xe=_r(_d[71]),je=_r(_d[72]),ve=_r(_d[73]);s.LIVE_HEAD_CHEF&&(0,o.requireRealData)();const we=[{id:'home',label:'Home',icon:'home'},{id:'stock',label:'Stock',icon:'box'},{id:'gp',label:'GP',icon:'forecast'},{id:'creator',label:le.CREATOR_TITLE,icon:'sparkle'},{id:'orders',label:'Orders',icon:'orders'},{id:'kitchen',label:'Kitchen',icon:'platter'}],Ce=[{id:'alerts',title:'Turn on alerts',sub:'Get your reminders on this phone, even with the app closed'},{id:'avatar',title:'My avatar',sub:'Animals, Bar & kitchen, sea, sport, colours, patterns or your own photo'},{id:'reviews',title:'Reviews',sub:'Published reviews, newest first'},{id:'myshift',title:'My shifts & clock in',sub:'Clock in and out (checks you are at the venue), breaks, and your shifts on the rota'},{id:'mypay',title:'My pay & tips',sub:'Your hours, tips share, tip goal, paydays and payslip info. Only you see this'},{id:'takings',title:'Takings & tips graphs',sub:'Daily cash ups, weekly sales, this week vs last, categories and the Tips pot (view only)'},{id:'bookings',title:'Today\u2019s bookings',sub:'Covers, allergens to sign off, platters and other reservations, dogs, access and vegan/vegetarian'},{id:'recipes',title:'Recipe cards',sub:'Plating photo, ingredients, method, allergens, section and price; you sign each card off before it goes live'},{id:'specials',title:'Specials board',sub:'Photo of the chalkboard or typed specials with allergens; shown in the customer app'},{id:'board',title:'Question board',sub:'Ask the team anything anonymously, and vote'},{id:'teamtasks',title:'Kitchen team tasks',sub:'Daily tasks for your chefs, commis and KPs'},{id:'orderlists',title:'Order lists',sub:'Alsons drinks, Cash and carry: add items, tick on the day, finish and carry over'},{id:'foodsafety',title:'Food safety (CookSafe)',sub:'Based on CookSafe (Food Standards Scotland). Full logs coming in the next update'},{id:'haccp',title:'Food safety log (HACCP)',sub:'Temperatures, cleaning and allergen checks; voice entry; limits; EHO export'},{id:'accidents',title:'Accident book',sub:'Accidents and near misses; you see your own entries'},{id:'forecast',title:'Forecast',sub:'Covers per day for the week ahead, and prep from the forecast'},{id:'prep',title:'Prep list',sub:'From the forecast and bookings, tick off as you go'},{id:'live',title:'Live tickets, sold out, team & chat',sub:'Orders, readiness alerts, sold out, who\u2019s on, rota, team chat and private messages'},{id:'waste',title:'Waste log',sub:'Item, quantity, reason and cost; weekly total and % of sales'},{id:'allergens',title:'Allergens',sub:'14-allergen matrix from the recipe cards, costing cross-check and audit log'},{id:'compliance',title:'Kitchen compliance',sub:'Fridge, freezer, cooking and cooling temps; cleaning; daily checks'}],Te={stock:{tab:'stock',stock:'levels'},'stock-take':{tab:'stock',stock:'take'},deliveries:{tab:'stock',stock:'deliveries'},gp:{tab:'gp',gp:'dishes'},'price-changes':{tab:'gp',gp:'changes'},'gp-week':{tab:'gp',gp:'week'},'menu-engineering':{tab:'gp',gp:'engineering'},orders:{tab:'orders'},forecast:{tab:'kitchen',k:'forecast'},prep:{tab:'kitchen',k:'prep'},live:{tab:'kitchen',k:'live'},waste:{tab:'kitchen',k:'waste'},recipes:{tab:'kitchen',k:'recipes'},'recipe-cards':{tab:'kitchen',k:'recipes'},allergens:{tab:'kitchen',k:'allergens'},compliance:{tab:'kitchen',k:'compliance'},haccp:{tab:'kitchen',k:'haccp'},specials:{tab:'kitchen',k:'specials'},accidents:{tab:'kitchen',k:'accidents'},'new-dish':{tab:'creator'}};function Pe({go:e}){const{k:t,c:s,menu:o,now:i,rid:l,me:r}=(0,M.useChef)(3e4),d=(0,U.useSheetReminders)(),u=(0,M.useWeek)(),{covers:h,label:p,enough:f,booked:k}=(0,M.useForecast)(),b=(0,z.useSuggestions)(),y=t.ingredients.filter(e=>e.onHand<=0||(0,M.isLow)(e.onHand,e.par)),x=b.filter(e=>e.ordersToday&&!e.placedToday),j=(0,_.priceImpacts)(o,t.recipes,t.ingredients,t.targetGp).filter(e=>e.dropped.length),v=t.deliveries.filter(e=>'expected'===e.status),w=!t.recipes.length||!t.ingredients.length,C=w?[]:s.filter(e=>e.below),T=(0,n.useLiveState)(),P=(0,be.useRecipeCards)(l).filter(e=>!e.signOff),S=(0,Y.useKitchenSummary)(l),[H,A]=(0,I.useState)(!1);return(0,ve.jsxs)(B.default,{style:{gap:12},testID:"chef-dashboard",children:[(0,ve.jsx)(re.MissedBanner,{mode:"chef",now:i,onPress:()=>e('kitchen','haccp')}),d.map(t=>(0,ve.jsx)(R.default,{accessibilityRole:"button",onPress:()=>e('orders',t.supplierId),children:(0,ve.jsxs)(F.Banner,{kind:'red'===t.tone?'danger':'warn',title:`\u23f0 ${t.text}`,children:["Tap to open the ",t.name," order sheet. Nothing is sent until you press Send."]})},t.supplierId)),P.length?(0,ve.jsx)(R.default,{testID:"cards-awaiting",accessibilityRole:"button",onPress:()=>e('kitchen','recipes'),children:(0,ve.jsxs)(F.Banner,{kind:"warn",title:`${P.length} recipe card${1===P.length?'':'s'} awaiting your sign-off`,children:[P.slice(0,4).map(e=>e.dish).join(', '),". Guests see \"awaiting allergen sign-off\" and cannot order these until you sign them off."]})}):null,(0,ve.jsx)(q.ShellfishTile,{rid:l,by:r,app:"chef",onOrder:()=>e('orders','os-kittyfisher')}),(0,ve.jsx)(F.Button,{testID:"chef-add-soldout",label:"Add sold out",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>A(!0),style:{minHeight:56}}),(0,ve.jsxs)(F.Row,{wrap:!0,gap:10,children:[c.PITCH?null:(0,ve.jsx)(M.Tile,{testID:"tile-gp",label:"Dishes under target GP",value:S.costed?`${S.below} of ${S.costed}`:'Nothing yet',sub:S.costed?`Average ${(0,M.pct1)(S.avgGp??0)} \xb7 target ${S.target}%`:'Record a delivery, then cost your recipe cards',tone:S.costed?S.below?'amber':'ok':void 0,onPress:()=>e('gp','dishes')}),c.PITCH?w?(0,ve.jsx)(M.Tile,{testID:"tile-gp",label:"GP this week vs target",value:"Nothing yet",sub:"Add ingredients and recipe costs to see GP",onPress:()=>e('gp','week')}):(0,ve.jsx)(M.Tile,{testID:"tile-gp",label:"GP this week vs target",value:(0,M.pct1)(u.theo),sub:`Target ${t.targetGp}% \xb7 actual ${(0,M.pct1)(u.actual)}`,tone:u.theoe('gp','week')}):null,c.PITCH?null:(0,ve.jsx)(M.Tile,{testID:"tile-stock",label:"Stock value",value:null!=S.stockValue?(0,L.gbp)(S.stockValue):'Nothing yet',sub:S.lastCount?`At cost, counted ${S.lastCount}`:'No stock counted yet',onPress:()=>e('stock','take')}),c.PITCH?(0,ve.jsx)(M.Tile,{testID:"tile-stock",label:"Stock value",value:t.ingredients.length?(0,L.gbp)((0,M.stockValue)(t.ingredients)):'Nothing yet',sub:t.ingredients.length?'At cost':'No stock counted yet',onPress:()=>e('stock','levels')}):null,(0,ve.jsx)(M.Tile,{label:"Items low or out",value:t.ingredients.length?`${y.length}`:'Nothing yet',sub:t.ingredients.length?y.slice(0,3).map(e=>e.name).join(', '):'No stock counted yet',tone:y.some(e=>e.onHand<=0)?'red':y.length?'amber':'ok',onPress:()=>e('stock','levels')}),(0,ve.jsx)(M.Tile,{label:"Waste this week",value:t.waste.length?(0,L.gbp)(u.wasteWeek):'Nothing yet',sub:u.sales?`${(0,M.pct1)(u.wasteWeek/u.sales*100)} of food sales`:'',onPress:()=>e('kitchen','waste')}),f?(0,ve.jsx)(M.Tile,{testID:"tile-forecast",label:"Covers forecast today",value:`${h}`,sub:p,onPress:()=>e('kitchen','forecast')}):(0,ve.jsx)(M.Tile,{testID:"tile-booked",label:"Booked so far today",value:'ready'===T?`${k}`:'connecting'===T?'Connecting\u2026':'Not connected',sub:"Not enough history for a forecast yet",onPress:()=>e('kitchen','bookings')}),(0,ve.jsx)(M.Tile,{label:"Orders due today",value:`${x.length}`,sub:x.map(e=>`${e.s.name} by ${e.s.cutoff}`).join(' \xb7 ')||'None',tone:x.some(e=>e.cutPassed)?'red':x.length?'amber':'ok',onPress:()=>e('orders')})]}),j.map(e=>(0,ve.jsxs)(F.Banner,{kind:"danger",title:`${e.ing.name} ${e.pct>0?'+':''}${e.pct.toFixed(0)}%: ${e.dropped.length} dish${1===e.dropped.length?'':'es'} drop below target`,children:[e.dropped.map(e=>e.item.name).join(', '),". Open GP \u203a Price changes."]},e.ing.id)),v.length?(0,ve.jsx)(R.default,{accessibilityRole:"button",onPress:()=>e('stock','deliveries'),children:(0,ve.jsx)(F.Banner,{kind:"info",title:`${v.length} deliver${1===v.length?'y':'ies'} to check in today`,children:"Count in against the order, flag shorts and price changes."})}):null,C.length?(0,ve.jsx)(R.default,{accessibilityRole:"button",onPress:()=>e('gp','dishes'),children:(0,ve.jsxs)(F.Banner,{kind:"warn",title:`${C.length} dishes below ${t.targetGp}% GP`,children:[C.slice(0,4).map(e=>e.item.name).join(', '),C.length>4?'\u2026':'']})}):null,(0,ve.jsx)(F.Row,{wrap:!0,gap:8,children:[['Recipe cards','recipes'],['Food safety log','haccp'],['Specials board','specials'],[le.CREATOR_TITLE,'creator'],['Forecast','forecast'],['Prep list','prep'],['Live tickets & sold out','live'],['Allergens','allergens'],['Accident book','accidents']].map(([t,s])=>(0,ve.jsx)(R.default,{accessibilityRole:"button",accessibilityLabel:t,onPress:()=>'creator'===s?e('creator'):e('kitchen',s),style:{flexGrow:1,flexBasis:140,padding:12,borderRadius:12,borderWidth:1.5,borderColor:G.colours.gold,backgroundColor:G.colours.surface},children:(0,ve.jsxs)(F.T,{weight:"semibold",children:[t," \u203a"]})},s))}),(0,ve.jsx)(F.Badge,{kind:"neutral",label:"Nothing is ordered or sent from here"}),(0,ve.jsx)(ye.SoldOutSheet,{visible:H,onClose:()=>A(!1),rid:l,by:r,hideLinks:!0,testID:"chef-soldout-sheet"})]})}},792,[793,978,884,979,986,1051,1052,1015,2,1053,1057,1058,1090,858,1095,1099,1100,1103,1104,1107,1108,1110,1111,1112,34,373,236,402,295,426,102,36,873,1137,794,867,821,1084,1139,1145,1148,1149,1152,1167,1168,1169,1171,1172,1179,1182,1185,1193,1194,1198,1199,925,1003,1200,1158,1201,1208,1213,1222,1215,1156,1224,1228,1195,874,1229,1154,987,1230,25]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ChefApp=function({section:e}={}){const{r:s,rid:i,me:n,now:L}=(0,_.useChef)(3e4);(0,be.useReviewAlerts)(i);const M=(0,G.useSignedIn)(),q=M?.id??_.CHEF_ID,Q=M?.ownerAccess&&'owner'!==M.role?'owner privileges':M?.managerAccess&&'staff'===M.role?'manager privileges':'',me=(0,je.useSync)(e=>e.perms),xe=me.includes('*')||me.includes('takings.view');(0,o.useSoldOutLink)(!0,(M?.name??n).replace(' (example)',''));const Re=e?Se[e]:void 0,[He,Ae]=(0,I.useState)(Re?.tab??'home'),[De,$e]=(0,I.useState)(Re?.k??null),[Be,Oe]=(0,I.useState)(Re?.stock??'levels'),[Ee,Fe]=(0,I.useState)(void 0),[Le,Ne]=(0,I.useState)(Re?.gp??'dishes'),Ge=(0,I.useRef)(null),Me=(0,b.ymd)(L),We=(0,b.ymd)(new Date(L.getTime()+864e5));(0,p.useTipsPosted)(i,Me);const Ke=(0,Z.useTravelDay)('chef',Me),Ve='home'===He&&!Ke;(0,P.useKitchenTodoChime)(i,Me,()=>Qe('kitchen','bookings')),(0,pe.useAlertWatcher)(i,{kinds:['takeaway']}),(0,I.useEffect)(()=>{(0,G.ensureAttendance)((new Date).toISOString().slice(0,10),L)},[]);const ze=(0,I.useRef)({t:'home',k:null});ze.current={t:He,k:De};const Ue=(0,I.useRef)([]),qe=(0,l.useScrollMemory)(Ge),Qe=(0,I.useCallback)((e,t=null)=>{'takings'!==t||xe||(t=null);const s=ze.current;s.t===e&&s.k===t||(Ue.current=[...Ue.current,{...s,y:qe.leave()}].slice(-30),qe.restore(0)),Ae(e),$e(t)},[xe]),Ye=(0,I.useCallback)(()=>{if((0,r.runBackLayer)())return!0;const e=ze.current;let t=Ue.current.pop();for(;t&&t.t===e.t&&t.k===e.k;)t=Ue.current.pop();if(!t&&'home'===e.t&&!e.k)return!1;const s=t??{t:'home',k:null};return qe.leave(),Ae(s.t),$e(s.k),qe.restore(s.y??0),!0},[]);(0,r.useWebBack)(Ye);const Je=(0,r.useInnerBackShown)();(0,I.useEffect)(()=>{c.PITCH&&(globalThis.__pitchGo=(e,t=null,s)=>{'stock'===e&&s&&Oe(s),'gp'===e&&s&&Ne(s),Qe(e,t)})},[Qe]),(0,f.useShiftReminders)({rid:i,staffId:q,name:n,kitchen:!0}),(0,C.useScheduledNotices)({rid:i,staffId:M?.id??'',name:n,onOpen:e=>{'orderlists'===e&&Qe('kitchen','orderlists'),'chat'===e&&Qe('kitchen','live')}}),(0,T.useOffRotaPrompt)({rid:i,staffId:M?.id??''}),(0,I.useEffect)(()=>{const e=R.default.addEventListener('hardwareBackPress',Ye);return()=>e.remove()},[Ye]),(0,I.useEffect)(()=>{'takings'!==De||xe||($e(null),Ae('kitchen'))},[De,xe]);const Xe=Pe.filter(e=>'takings'!==e.id||xe),Ze=De&&('takings'!==De||xe)?Pe.find(e=>e.id===De):null,et=((0,D.default)().width,Ze?Ze.title:{home:'Today in the kitchen',stock:c.PITCH?'Stock':'Deliveries & stock',gp:'GP & costing',creator:re.CREATOR_TITLE,orders:'Orders',rota:'Rota',kitchen:'Kitchen'}[He]);return(0,ve.jsxs)(B.SafeAreaView,{style:{flex:1,backgroundColor:N.colours.bg},edges:['top','bottom'],children:[(0,ve.jsxs)($.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:N.colours.border,gap:6},children:[(0,ve.jsx)($.default,{style:{position:'absolute',top:4,right:6,zIndex:5,flexDirection:'row',alignItems:'center'},children:(0,ve.jsx)(E.VoiceSlot,{size:44})}),(0,ve.jsx)($.default,{testID:"header-me-wrap",style:{alignItems:'flex-start',minHeight:44,justifyContent:'center',maxWidth:'70%'},children:(0,ve.jsx)($.default,{testID:"header-me",accessibilityLabel:`Signed in as ${n.replace(' (example)','')}, Head Chef${Q?`, ${Q}`:''}`,style:{borderWidth:1,borderColor:N.colours.gold,borderRadius:16,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%'},children:(0,ve.jsxs)(F.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,ve.jsx)(oe.StaffAvatar,{id:_.CHEF_ID,size:24,ring:!1}),(0,ve.jsxs)($.default,{style:{flexShrink:1},children:[(0,ve.jsxs)(F.T,{size:13,weight:"semibold",colour:N.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[n.replace(' (example)','')," \xb7 Head Chef"]}),Q?(0,ve.jsx)(F.Muted,{center:!1,size:10,numberOfLines:1,children:Q}):null]})]})})}),(0,ve.jsx)(O.VenueHeaderBlock,{rid:i,name:s.name,badge:"CHEF",place:"Head Chef app"}),(0,ve.jsx)(H.default,{accessibilityRole:"button",accessibilityLabel:"Open CoverCharge for Staff",onPress:()=>{const e=(0,ne.appUrl)('staff');e&&window.location.assign(e)},style:{alignSelf:'center',borderWidth:1,borderColor:N.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:3,minHeight:44,justifyContent:'center'},children:(0,ve.jsx)(F.T,{size:13,colour:N.colours.gold,children:"Staff app \u203a"})})]}),(0,ve.jsxs)(A.default,{ref:Ge,...qe.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:[(0,ve.jsx)(r.BackTitleRow,{back:!('home'===He&&!De||Je),onBack:Ye,title:et}),'home'===He?(0,ve.jsx)(Z.DayBar,{app:"chef",today:Me}):null,'home'===He&&Ke?(0,ve.jsx)(Z.DayView,{rid:i,day:Ke,today:Me,app:"chef"}):null,'home'===He?(0,ve.jsx)(ae.WhoBar,{}):null,Ve&&M?(0,ve.jsx)(h.MyTasksToday,{rid:i,staffId:M.id,name:M.name,onShift:(0,f.shiftNow)(M.id,L.getTime()).on}):null,Ve?(0,ve.jsx)(p.TodaysTipsCard,{rid:i,today:Me}):null,Ve?(0,ve.jsx)(p.TipsPotCard,{rid:i,today:Me}):null,Ve?(0,ve.jsx)(k.CoversToday,{rid:i,onPress:()=>Qe('kitchen','bookings')}):null,Ve?(0,ve.jsx)(y.LastFoodBanner,{rid:i,now:L}):null,Ve?(0,ve.jsx)(x.NextTableFreeCard,{rid:i,now:L}):null,Ve?(0,ve.jsx)(j.KitchenSignoffs,{rid:i,today:Me,by:n,app:"chef"}):null,Ve?(0,ve.jsxs)($.default,{style:{gap:4},children:[(0,ve.jsx)(j.PlattersBooked,{rid:i,date:Me,label:"Platters booked today"}),(0,ve.jsx)(j.PlattersBooked,{rid:i,date:We,label:"Platters booked tomorrow"})]}):null,Ve?(0,ve.jsx)(ye.ChefAssistantButton,{}):null,Ve?(0,ve.jsx)(Ie,{go:(e,t)=>{'stock'===e&&t&&Oe(t),'gp'===e&&t&&Ne(t),'orders'===e&&Fe(t),Qe(e,'kitchen'===e?t??null:null)}}):null,'stock'!==He||c.PITCH?null:(0,ve.jsx)(J.KitchenCosts,{rid:i,me:(M?.name??n).replace(' (example)',''),actor:{name:(M?.name??n).replace(' (example)',''),role:'head-chef'},initial:'deliveries'===Be?'deliveries':'take'===Be?'count':'deliveries'},`s-${Be}`),'gp'!==He||c.PITCH?null:(0,ve.jsx)(J.KitchenCosts,{rid:i,me:(M?.name??n).replace(' (example)',''),actor:{name:(M?.name??n).replace(' (example)',''),role:'head-chef'},initial:"dishgp"},`g-${Le}`),'stock'===He&&c.PITCH?(0,ve.jsx)(Y.StockScreen,{initial:Be},Be):null,'gp'===He&&c.PITCH?(0,ve.jsx)(W.GpScreen,{initial:Le},Le):null,'creator'===He?(0,ve.jsx)(re.DishCreator,{rid:i,canPublish:!1}):null,'orders'===He?(0,ve.jsx)(z.OrdersScreen,{focus:Ee},Ee??'all'):null,'rota'===He?(0,ve.jsx)(F.Card,{children:(0,ve.jsx)(U.KitchenRotaTab,{today:Me})}):null,'kitchen'!==He||Ze?null:(0,ve.jsxs)($.default,{style:{gap:10},children:[(0,ve.jsxs)($.default,{style:{borderRadius:14,borderWidth:1,borderColor:N.colours.border,backgroundColor:N.colours.surface,overflow:'hidden'},children:[Te.map(e=>(0,ve.jsx)(H.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:`${e.title}. ${e.sub}`,onPress:()=>Qe(e.id),style:({pressed:e})=>({padding:12,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,ve.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,ve.jsxs)($.default,{style:{flex:1},children:[(0,ve.jsx)(F.T,{weight:"medium",children:e.title}),(0,ve.jsx)(F.Muted,{children:e.sub})]}),(0,ve.jsx)(F.T,{colour:N.colours.muted,children:"\u203a"})]})},e.id)),Xe.map(e=>(0,ve.jsx)(H.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>Qe(He,e.id),style:({pressed:e})=>({padding:12,borderTopWidth:1,borderColor:N.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,ve.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,ve.jsxs)($.default,{style:{flex:1},children:[(0,ve.jsx)(F.T,{weight:"medium",children:e.title}),(0,ve.jsx)(F.Muted,{children:e.sub})]}),(0,ve.jsx)(F.T,{colour:N.colours.muted,children:"\u203a"})]})},e.id))]}),(0,ve.jsx)(F.Muted,{children:"Head Chef sees kitchen, stock, food costs and GP. Payroll, wages and the restaurant's billing stay in CoverCharge for Managers."}),(0,ve.jsxs)(F.Muted,{center:!0,children:["Head Chef app \xb7 ",d.APP_VERSION," \xb7 ",'live'===je.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),'myshift'===De&&q?(0,ve.jsxs)($.default,{style:{gap:10},testID:"chef-myshift",children:[(0,ve.jsx)(se.ClockInOut,{}),(0,ve.jsx)(ie.MyUpcomingShifts,{staffId:q,team:!0})]}):null,'mypay'===De?(0,ve.jsxs)($.default,{style:{gap:10},testID:"chef-mypay",children:[(0,ve.jsx)(ee.MyPeriods,{staffId:q}),(0,ve.jsx)(X.MyHoursPay,{staffId:q}),(0,ve.jsx)(te.MyTips,{staffId:q}),(0,ve.jsx)(F.Card,{children:(0,ve.jsx)(u.PhoneAlerts,{})})]}):null,'alerts'===De?(0,ve.jsx)($.default,{testID:"chef-alerts",children:(0,ve.jsx)(u.PhoneAlerts,{})}):null,'avatar'===De?(0,ve.jsx)(t.AvatarMaker,{meId:M?.id??_.CHEF_ID,me:n}):null,'reviews'===De?(0,ve.jsx)(fe.ReviewsSection,{rid:i,mode:"read",venueName:s.name}):null,'bookings'===De?(0,ve.jsx)(S.TodaysBookings,{rid:i,today:Me,by:n,app:"chef"}):null,'specials'===De?(0,ve.jsx)(ce.SpecialsEditor,{rid:i,me:n,app:"chef",now:L}):null,'forecast'===De?(0,ve.jsx)(K.ChefForecast,{openPrep:()=>Qe('kitchen','prep')}):null,'prep'===De?(0,ve.jsx)(V.PrepScreen,{}):null,'live'===De?(0,ve.jsx)(V.TeamScreen,{}):null,'waste'===De?(0,ve.jsx)(V.WasteScreen,{}):null,'recipes'===De?(0,ve.jsx)(ge.RecipeCards,{rid:i,actor:{name:n,role:'head-chef'},mode:"edit"}):null,'allergens'===De?(0,ve.jsx)(V.AllergenScreen,{openCards:()=>Qe('kitchen','recipes')}):null,'compliance'===De?(0,ve.jsx)(V.ComplianceScreen,{}):null,'takings'===De&&xe?(0,ve.jsx)(p.CashUpScreen,{rid:i,today:Me,canEdit:!1,chartsOnly:!0,who:{id:q,name:n.replace(' (example)','')}}):null,'board'===De?(0,ve.jsx)(ke.QuestionBoard,{rid:i,today:Me,manager:!1,by:""}):null,'teamtasks'===De?(0,ve.jsx)(h.KitchenTeamTasks,{rid:i,actor:M}):null,'orderlists'===De?(0,ve.jsx)(w.OrderListsScreen,{rid:i,today:Me,editor:!0,who:{id:q,name:n.replace(' (example)','')}}):null,'foodsafety'===De?(0,ve.jsx)(v.FoodSafetyCard,{children:(0,ve.jsx)(H.default,{accessibilityRole:"button",onPress:()=>Qe('kitchen','haccp'),children:(0,ve.jsx)(F.T,{colour:N.colours.gold,children:"Today\u2019s temperature log \u203a"})})}):null,'haccp'===De?(0,ve.jsx)(de.HaccpLog,{mode:"chef",me:n,meId:_.CHEF_ID,now:L}):null,'accidents'===De?(0,ve.jsx)(le.AccidentBook,{app:"chef",me:n,meId:_.CHEF_ID,now:L,seeAll:!1}):null]}),(0,ve.jsx)(we.BottomTabs,{tablist:!0,background:N.colours.surface,active:'orders'===He?'kitchen':He,onPress:e=>Qe(e),tabs:Ce.map(e=>({id:e.id,label:e.label,short:'creator'===e.id?'Creator':void 0,icon:e.icon,a11y:'rota'===e.id?'Rota, the kitchen rota':void 0}))}),(0,ve.jsx)(ye.ChefAssistantSheet,{go:(e,t)=>{'orders'===e?(Fe(t),Qe('orders')):'gp'===e?Qe('gp'):Qe('kitchen',e)}}),(0,ve.jsx)(ue.AlertHost,{variant:"chef",rid:i,skipTakeaway:!0}),(0,ve.jsx)(he.KitchenFlash,{rid:i,me:n})]})};var t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),o=_r(_d[3]),n=_r(_d[4]),l=_r(_d[5]),r=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),f=_r(_d[12]),b=_r(_d[13]),k=_r(_d[14]),y=_r(_d[15]),x=_r(_d[16]),j=_r(_d[17]),w=_r(_d[18]),v=_r(_d[19]),C=_r(_d[20]),T=_r(_d[21]),P=_r(_d[22]),S=_r(_d[23]),I=_r(_d[24]),R=e(_r(_d[25]));_r(_d[26]);var H=e(_r(_d[27])),A=e(_r(_d[28])),D=e(_r(_d[29])),$=e(_r(_d[30])),B=_r(_d[31]),O=_r(_d[32]),E=_r(_d[33]),F=_r(_d[34]),L=_r(_d[35]),N=_r(_d[36]),G=_r(_d[37]),M=_r(_d[38]),_=_r(_d[39]),W=_r(_d[40]),K=_r(_d[41]),V=_r(_d[42]),z=_r(_d[43]),U=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),Y=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),se=_r(_d[53]),ie=_r(_d[54]),ae=_r(_d[55]),oe=_r(_d[56]),ne=_r(_d[57]),le=_r(_d[58]),re=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),pe=_r(_d[64]),ge=_r(_d[65]),fe=_r(_d[66]),be=_r(_d[67]),ke=_r(_d[68]),me=_r(_d[69]),ye=_r(_d[70]),xe=_r(_d[71]),je=_r(_d[72]),we=_r(_d[73]),ve=_r(_d[74]);s.LIVE_HEAD_CHEF&&(0,i.requireRealData)();const Ce=[{id:'home',label:'Home',icon:'home'},{id:'stock',label:'Stock',icon:'box'},{id:'gp',label:'GP',icon:'forecast'},{id:'creator',label:re.CREATOR_TITLE,icon:'sparkle'},{id:'rota',label:'Rota',icon:'rota'},{id:'kitchen',label:'Kitchen',icon:'platter'}],Te=[{id:'orders',title:'Orders',sub:'Supplier order sheets, what is due today and cut-off times. Nothing is sent until you press Send'}],Pe=[{id:'alerts',title:'Turn on alerts',sub:'Get your reminders on this phone, even with the app closed'},{id:'avatar',title:'My avatar',sub:'Animals, Bar & kitchen, sea, sport, colours, patterns or your own photo'},{id:'reviews',title:'Reviews',sub:'Published reviews, newest first'},{id:'myshift',title:'My shifts & clock in',sub:'Clock in and out (checks you are at the venue), breaks, and your shifts on the rota'},{id:'mypay',title:'My pay & tips',sub:'Your hours, tips share, tip goal, paydays and payslip info. Only you see this'},{id:'takings',title:'Takings & tips graphs',sub:'Daily cash ups, weekly sales, this week vs last, categories and the Tips pot (view only)'},{id:'bookings',title:'Today\u2019s bookings',sub:'Covers, allergens to sign off, platters and other reservations, dogs, access and vegan/vegetarian'},{id:'recipes',title:'Recipe cards',sub:'Plating photo, ingredients, method, allergens, section and price; you sign each card off before it goes live'},{id:'specials',title:'Specials board',sub:'Photo of the chalkboard or typed specials with allergens; shown in the customer app'},{id:'board',title:'Question board',sub:'Ask the team anything anonymously, and vote'},{id:'teamtasks',title:'Kitchen team tasks',sub:'Daily tasks for your chefs, commis and KPs'},{id:'orderlists',title:'Order lists',sub:'Alsons drinks, Cash and carry: add items, tick on the day, finish and carry over'},{id:'foodsafety',title:'Food safety (CookSafe)',sub:'Based on CookSafe (Food Standards Scotland). Full logs coming in the next update'},{id:'haccp',title:'Food safety log (HACCP)',sub:'Temperatures, cleaning and allergen checks; voice entry; limits; EHO export'},{id:'accidents',title:'Accident book',sub:'Accidents and near misses; you see your own entries'},{id:'forecast',title:'Forecast',sub:'Covers per day for the week ahead, and prep from the forecast'},{id:'prep',title:'Prep list',sub:'From the forecast and bookings, tick off as you go'},{id:'live',title:'Live tickets, sold out, team & chat',sub:'Orders, readiness alerts, sold out, who\u2019s on, rota, team chat and private messages'},{id:'waste',title:'Waste log',sub:'Item, quantity, reason and cost; weekly total and % of sales'},{id:'allergens',title:'Allergens',sub:'14-allergen matrix from the recipe cards, costing cross-check and audit log'},{id:'compliance',title:'Kitchen compliance',sub:'Fridge, freezer, cooking and cooling temps; cleaning; daily checks'}],Se={stock:{tab:'stock',stock:'levels'},'stock-take':{tab:'stock',stock:'take'},deliveries:{tab:'stock',stock:'deliveries'},gp:{tab:'gp',gp:'dishes'},'price-changes':{tab:'gp',gp:'changes'},'gp-week':{tab:'gp',gp:'week'},'menu-engineering':{tab:'gp',gp:'engineering'},orders:{tab:'orders'},rota:{tab:'rota'},'kitchen-rota':{tab:'rota'},forecast:{tab:'kitchen',k:'forecast'},prep:{tab:'kitchen',k:'prep'},live:{tab:'kitchen',k:'live'},waste:{tab:'kitchen',k:'waste'},recipes:{tab:'kitchen',k:'recipes'},'recipe-cards':{tab:'kitchen',k:'recipes'},allergens:{tab:'kitchen',k:'allergens'},compliance:{tab:'kitchen',k:'compliance'},haccp:{tab:'kitchen',k:'haccp'},specials:{tab:'kitchen',k:'specials'},accidents:{tab:'kitchen',k:'accidents'},'new-dish':{tab:'creator'}};function Ie({go:e}){const{k:t,c:s,menu:i,now:o,rid:l,me:r}=(0,_.useChef)(3e4),d=(0,q.useSheetReminders)(),u=(0,_.useWeek)(),{covers:h,label:p,enough:f,booked:b}=(0,_.useForecast)(),k=(0,z.useSuggestions)(),y=t.ingredients.filter(e=>e.onHand<=0||(0,_.isLow)(e.onHand,e.par)),x=k.filter(e=>e.ordersToday&&!e.placedToday),j=(0,M.priceImpacts)(i,t.recipes,t.ingredients,t.targetGp).filter(e=>e.dropped.length),w=t.deliveries.filter(e=>'expected'===e.status),v=!t.recipes.length||!t.ingredients.length,C=v?[]:s.filter(e=>e.below),T=(0,n.useLiveState)(),P=(0,me.useRecipeCards)(l).filter(e=>!e.signOff),S=(0,J.useKitchenSummary)(l),[R,A]=(0,I.useState)(!1);return(0,ve.jsxs)($.default,{style:{gap:12},testID:"chef-dashboard",children:[(0,ve.jsx)(de.MissedBanner,{mode:"chef",now:o,onPress:()=>e('kitchen','haccp')}),d.map(t=>(0,ve.jsx)(H.default,{accessibilityRole:"button",onPress:()=>e('orders',t.supplierId),children:(0,ve.jsxs)(F.Banner,{kind:'red'===t.tone?'danger':'warn',title:`\u23f0 ${t.text}`,children:["Tap to open the ",t.name," order sheet. Nothing is sent until you press Send."]})},t.supplierId)),P.length?(0,ve.jsx)(H.default,{testID:"cards-awaiting",accessibilityRole:"button",onPress:()=>e('kitchen','recipes'),children:(0,ve.jsxs)(F.Banner,{kind:"warn",title:`${P.length} recipe card${1===P.length?'':'s'} awaiting your sign-off`,children:[P.slice(0,4).map(e=>e.dish).join(', '),". Guests see \"awaiting allergen sign-off\" and cannot order these until you sign them off."]})}):null,(0,ve.jsx)(Q.ShellfishTile,{rid:l,by:r,app:"chef",onOrder:()=>e('orders','os-kittyfisher')}),(0,ve.jsx)(F.Button,{testID:"chef-add-soldout",label:"Add sold out",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>A(!0),style:{minHeight:56}}),(0,ve.jsxs)(F.Row,{wrap:!0,gap:10,children:[c.PITCH?null:(0,ve.jsx)(_.Tile,{testID:"tile-gp",label:"Dishes under target GP",value:S.costed?`${S.below} of ${S.costed}`:'Nothing yet',sub:S.costed?`Average ${(0,_.pct1)(S.avgGp??0)} \xb7 target ${S.target}%`:'Record a delivery, then cost your recipe cards',tone:S.costed?S.below?'amber':'ok':void 0,onPress:()=>e('gp','dishes')}),c.PITCH?v?(0,ve.jsx)(_.Tile,{testID:"tile-gp",label:"GP this week vs target",value:"Nothing yet",sub:"Add ingredients and recipe costs to see GP",onPress:()=>e('gp','week')}):(0,ve.jsx)(_.Tile,{testID:"tile-gp",label:"GP this week vs target",value:(0,_.pct1)(u.theo),sub:`Target ${t.targetGp}% \xb7 actual ${(0,_.pct1)(u.actual)}`,tone:u.theoe('gp','week')}):null,c.PITCH?null:(0,ve.jsx)(_.Tile,{testID:"tile-stock",label:"Stock value",value:null!=S.stockValue?(0,L.gbp)(S.stockValue):'Nothing yet',sub:S.lastCount?`At cost, counted ${S.lastCount}`:'No stock counted yet',onPress:()=>e('stock','take')}),c.PITCH?(0,ve.jsx)(_.Tile,{testID:"tile-stock",label:"Stock value",value:t.ingredients.length?(0,L.gbp)((0,_.stockValue)(t.ingredients)):'Nothing yet',sub:t.ingredients.length?'At cost':'No stock counted yet',onPress:()=>e('stock','levels')}):null,(0,ve.jsx)(_.Tile,{label:"Items low or out",value:t.ingredients.length?`${y.length}`:'Nothing yet',sub:t.ingredients.length?y.slice(0,3).map(e=>e.name).join(', '):'No stock counted yet',tone:y.some(e=>e.onHand<=0)?'red':y.length?'amber':'ok',onPress:()=>e('stock','levels')}),(0,ve.jsx)(_.Tile,{label:"Waste this week",value:t.waste.length?(0,L.gbp)(u.wasteWeek):'Nothing yet',sub:u.sales?`${(0,_.pct1)(u.wasteWeek/u.sales*100)} of food sales`:'',onPress:()=>e('kitchen','waste')}),f?(0,ve.jsx)(_.Tile,{testID:"tile-forecast",label:"Covers forecast today",value:`${h}`,sub:p,onPress:()=>e('kitchen','forecast')}):(0,ve.jsx)(_.Tile,{testID:"tile-booked",label:"Booked so far today",value:'ready'===T?`${b}`:'connecting'===T?'Connecting\u2026':'Not connected',sub:"Not enough history for a forecast yet",onPress:()=>e('kitchen','bookings')}),(0,ve.jsx)(_.Tile,{label:"Orders due today",value:`${x.length}`,sub:x.map(e=>`${e.s.name} by ${e.s.cutoff}`).join(' \xb7 ')||'None',tone:x.some(e=>e.cutPassed)?'red':x.length?'amber':'ok',onPress:()=>e('orders')})]}),j.map(e=>(0,ve.jsxs)(F.Banner,{kind:"danger",title:`${e.ing.name} ${e.pct>0?'+':''}${e.pct.toFixed(0)}%: ${e.dropped.length} dish${1===e.dropped.length?'':'es'} drop below target`,children:[e.dropped.map(e=>e.item.name).join(', '),". Open GP \u203a Price changes."]},e.ing.id)),w.length?(0,ve.jsx)(H.default,{accessibilityRole:"button",onPress:()=>e('stock','deliveries'),children:(0,ve.jsx)(F.Banner,{kind:"info",title:`${w.length} deliver${1===w.length?'y':'ies'} to check in today`,children:"Count in against the order, flag shorts and price changes."})}):null,C.length?(0,ve.jsx)(H.default,{accessibilityRole:"button",onPress:()=>e('gp','dishes'),children:(0,ve.jsxs)(F.Banner,{kind:"warn",title:`${C.length} dishes below ${t.targetGp}% GP`,children:[C.slice(0,4).map(e=>e.item.name).join(', '),C.length>4?'\u2026':'']})}):null,(0,ve.jsx)(F.Row,{wrap:!0,gap:8,children:[['Recipe cards','recipes'],['Food safety log','haccp'],['Specials board','specials'],[re.CREATOR_TITLE,'creator'],['Forecast','forecast'],['Prep list','prep'],['Live tickets & sold out','live'],['Allergens','allergens'],['Accident book','accidents']].map(([t,s])=>(0,ve.jsx)(H.default,{accessibilityRole:"button",accessibilityLabel:t,onPress:()=>'creator'===s?e('creator'):e('kitchen',s),style:{flexGrow:1,flexBasis:140,padding:12,borderRadius:12,borderWidth:1.5,borderColor:N.colours.gold,backgroundColor:N.colours.surface},children:(0,ve.jsxs)(F.T,{weight:"semibold",children:[t," \u203a"]})},s))}),(0,ve.jsx)(F.Badge,{kind:"neutral",label:"Nothing is ordered or sent from here"}),(0,ve.jsx)(xe.SoldOutSheet,{visible:R,onClose:()=>A(!1),rid:l,by:r,hideLinks:!0,testID:"chef-soldout-sheet"})]})}},792,[793,978,884,979,986,1051,1052,1015,2,1053,1057,1058,1090,858,1095,1099,1100,1103,1104,1107,1108,1110,1111,1112,34,373,236,402,295,426,102,36,873,1137,794,867,821,1084,1139,1145,1148,1149,1152,1167,1165,1168,1169,1171,1172,1179,1182,1185,1193,1194,1198,1199,925,1003,1200,1158,1201,1208,1213,1222,1215,1156,1224,1228,1195,874,1229,1154,987,1230,25]); __d(function(_g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.styliseOnDevice=b,_e.pickPhoto=p,_e.AvatarMaker=function({meId:e,me:u}){const g=(0,i.useAvatars)(t=>t.photos[e]),[f,v]=(0,t.useState)(null),[y,x]=(0,t.useState)(null),[j,w]=(0,t.useState)(!1),[I,P]=(0,t.useState)(!1),[k,M]=(0,t.useState)('');(0,t.useEffect)(()=>()=>{f&&URL.revokeObjectURL(f)},[f]);const R='undefined'!=typeof document,S=async e=>{M('');const t=await p(e);if(t){P(!0),w(!1);try{const e=await b(t);f&&URL.revokeObjectURL(f),v(URL.createObjectURL(t)),x(e)}catch{M("That photo couldn't be opened. Try a different one (JPEG or PNG).")}finally{P(!1)}}},U=()=>{f&&URL.revokeObjectURL(f),v(null),x(null),w(!1)},B=u.replace(' (example)','');return(0,h.jsxs)(o.default,{style:{gap:12},testID:"avatar-maker",children:[(0,h.jsxs)(d.Box,{children:[(0,h.jsxs)(s.Row,{gap:14,children:[(0,h.jsx)(l.StaffAvatar,{id:e,size:88}),(0,h.jsxs)(o.default,{style:{flex:1,gap:4},children:[(0,h.jsx)(s.T,{weight:"semibold",size:17,children:B}),(0,h.jsxs)(s.Muted,{children:[g?`Your chosen avatar (saved ${new Date(g.at).toLocaleDateString('en-GB')}).`:'Your original crew avatar.'," It shows on rotas, chat, clock-in and sign-offs."]})]})]}),g?(0,h.jsx)(s.Button,{small:!0,kind:"secondary",label:"Back to my default avatar",testID:"avatar-own-reset",onPress:()=>{i.useAvatars.getState().reset(e,{id:e,role:'staff',name:B}),M('Back to your default avatar.')}}):null]}),(0,h.jsx)(d.Box,{children:(0,h.jsx)(n.AvatarOptions,{value:g?.dataUrl,onSelect:t=>{const a=i.useAvatars.getState().setOwn(e,e,t.dataUrl,B);M(a?`${t.name} is your avatar now.`:'Could not save your avatar.')}})}),(0,h.jsxs)(d.Box,{testID:"avatar-create",children:[(0,h.jsx)(s.T,{weight:"semibold",size:17,children:"Create my avatar from a photo"}),(0,h.jsx)(s.Muted,{children:"Upload a photo or take a selfie. Your phone turns it into a retro space-age avatar. The photo never leaves this device and isn't saved: only the finished avatar is kept."}),R?y?(0,h.jsxs)(o.default,{style:{gap:10},testID:"avatar-preview",children:[(0,h.jsxs)(s.Row,{gap:12,style:{justifyContent:'center'},children:[(0,h.jsxs)(o.default,{style:{alignItems:'center',gap:4},children:[f?(0,h.jsx)(a.default,{source:{uri:f},style:{width:96,height:96,borderRadius:12},accessibilityLabel:"Your photo"}):null,(0,h.jsx)(s.Muted,{children:"Your photo"})]}),(0,h.jsx)(s.T,{size:22,colour:c.colours.gold,children:"\u2192"}),(0,h.jsxs)(o.default,{style:{alignItems:'center',gap:4},children:[(0,h.jsx)(a.default,{source:{uri:y},style:{width:120,height:120,borderRadius:60,borderWidth:3,borderColor:c.colours.gold},accessibilityLabel:"Your new avatar preview",testID:"avatar-result"}),(0,h.jsx)(s.Muted,{children:"Your avatar"})]})]}),(0,h.jsxs)(r.default,{accessibilityRole:"checkbox",accessibilityState:{checked:j},accessibilityLabel:"I agree to use this avatar",testID:"avatar-consent",onPress:()=>w(!j),style:{flexDirection:'row',gap:10,alignItems:'flex-start',padding:10,borderRadius:12,borderWidth:1,borderColor:j?c.colours.gold:c.colours.border},children:[(0,h.jsx)(o.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:c.colours.gold,backgroundColor:j?c.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:j?(0,h.jsx)(s.T,{size:15,weight:"bold",colour:"#111",children:"\u2713"}):null}),(0,h.jsx)(s.T,{size:14,style:{flex:1},children:"I\u2019m happy for this avatar, made from my photo, to be shown to my team in CoverCharge. Only the finished avatar is shared; my photo isn\u2019t uploaded or kept, and a manager can reset my avatar."})]}),(0,h.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,h.jsx)(s.Button,{label:"Use as my avatar",testID:"avatar-save",disabled:!j,onPress:()=>{const t=i.useAvatars.getState().setOwn(e,e,y,B);M(t?'Saved: this is your avatar now.':"Couldn't save the avatar."),t&&U()}}),(0,h.jsx)(s.Button,{kind:"secondary",label:"Try another photo",onPress:U})]})]}):(0,h.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,h.jsx)(s.Button,{label:I?'Making your avatar\u2026':'Upload a photo',testID:"avatar-upload",disabled:I,onPress:()=>S(!1)}),(0,h.jsx)(s.Button,{kind:"secondary",label:"Take a selfie",testID:"avatar-selfie",disabled:I,onPress:()=>S(!0)})]}):(0,h.jsx)(s.Muted,{children:"Available in the web app."}),k?(0,h.jsx)(o.default,{testID:"avatar-msg",children:(0,h.jsx)(s.T,{size:14,colour:c.colours.ok,children:k})}):null]})]})};var t=_r(_d[0]),a=e(_r(_d[1]));_r(_d[2]);var r=e(_r(_d[3])),o=e(_r(_d[4])),s=_r(_d[5]),l=_r(_d[6]),n=_r(_d[7]),i=_r(_d[8]),c=_r(_d[9]),d=_r(_d[10]),h=_r(_d[11]);const u=['#1B1B1B','#4A3F35','#B89A72','#E9B949','#FFF4E0'].map(e=>[1,3,5].map(t=>parseInt(e.slice(t,t+2),16))),g=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5];function f(e){return new Promise((t,a)=>{const r=URL.createObjectURL(e),o=new window.Image;o.onload=()=>t({img:o,url:r}),o.onerror=()=>{URL.revokeObjectURL(r),a(new Error('bad image'))},o.src=r})}function v(e,t,a,r){e.beginPath(),e.moveTo(t,a-r),e.quadraticCurveTo(t+.18*r,a-.18*r,t+r,a),e.quadraticCurveTo(t+.18*r,a+.18*r,t,a+r),e.quadraticCurveTo(t-.18*r,a+.18*r,t-r,a),e.quadraticCurveTo(t-.18*r,a-.18*r,t,a-r),e.fill()}async function b(e){const{img:t,url:a}=await f(e);try{const e=112,a=256,r=document.createElement('canvas');r.width=e,r.height=e;const o=r.getContext('2d'),s=Math.min(t.width,t.height);o.drawImage(t,(t.width-s)/2,Math.max(0,(t.height-s)/2-.04*s),s,s,0,0,e,e);const l=o.getImageData(0,0,e,e),n=l.data,i=[];for(let e=0;ee-t),d=c[Math.floor(.04*c.length)],h=c[Math.floor(.96*c.length)]||255;for(let t=0;t{const a=document.createElement('input');a.type='file',a.accept='image/*',e&&a.setAttribute('capture','user'),a.onchange=()=>t(a.files?.[0]??null),a.click()})}},793,[34,336,236,402,102,794,925,929,926,821,930,25]); __d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"webLine",{enumerable:!0,get:function(){return W.webLine}}),_e.T=D,Object.defineProperty(_e,"H1",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"H2",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"Muted",{enumerable:!0,get:function(){return z}}),_e.BrandBar=A,_e.Screen=function({children:e,title:t,subtitle:r,back:o=!0,right:l,maxWidth:n=640,footer:s,scroll:c=!0}){const u=(0,B.jsxs)(x.default,{style:{width:'100%',maxWidth:n,alignSelf:'center',padding:16,gap:12,alignItems:'stretch'},children:[e,'customer'===S.APP_VARIANT?(0,B.jsx)(H,{}):null]});return(0,B.jsxs)(j.SafeAreaView,{style:{flex:1,backgroundColor:C.colours.bg},edges:['top','left','right'],children:[(0,B.jsx)(x.default,{style:{width:'100%',maxWidth:n,alignSelf:'center'},children:(0,B.jsx)(A,{title:t,subtitle:r,back:o,right:l})}),c?(0,B.jsx)(b.default,{contentContainerStyle:{paddingBottom:40},children:u}):(0,B.jsx)(x.default,{style:{flex:1},children:u}),s?(0,B.jsx)(x.default,{style:N.footer,children:(0,B.jsx)(x.default,{style:{width:'100%',maxWidth:n,alignSelf:'center'},children:s})}):null]})},_e.Button=v,_e.Card=F,_e.Badge=function({label:e,kind:t="neutral"}){const r={neutral:[C.colours.surface2,C.colours.muted,C.colours.border],gold:[C.colours.goldTint,C.colours.goldLight,C.colours.gold],red:[C.colours.redBg,'#FFD9D4',C.colours.red],amber:[C.colours.amberBg,'#FFE2A8',C.colours.amber],ok:[C.colours.okBg,C.colours.goldLight,C.colours.ok],blue:[C.colours.blueBg,C.colours.goldLight,C.colours.blue]}[t];return(0,B.jsx)(x.default,{style:[N.badge,{backgroundColor:r[0],borderColor:r[2],maxWidth:'100%',alignSelf:L?'center':'flex-start'}],children:(0,B.jsx)(D,{size:13,weight:"medium",colour:r[1],style:{flexShrink:1},children:e})})},_e.Banner=E,Object.defineProperty(_e,"ExampleAllergenNotice",{enumerable:!0,get:function(){return V}}),Object.defineProperty(_e,"DemoPaymentNotice",{enumerable:!0,get:function(){return $}}),_e.Row=O,Object.defineProperty(_e,"Divider",{enumerable:!0,get:function(){return _}}),_e.Field=function({label:e,...t}){return(0,B.jsxs)(x.default,{style:{gap:4,alignSelf:'stretch',width:'100%',minWidth:0,maxWidth:'100%'},children:[(0,B.jsx)(D,{size:C.font.small,weight:"medium",colour:C.colours.muted,center:!0,children:e}),(0,B.jsx)(o.TextInput,{accessibilityLabel:e,placeholderTextColor:"#7D776C",...t,style:[N.input,t.multiline&&{minHeight:70,textAlignVertical:'top'},t.style]})]})},_e.Chip=function({label:e,selected:t,onPress:r,disabled:o,sub:l,testID:n,accessibilityLabel:s}){return(0,B.jsxs)(h.default,{testID:n,accessibilityRole:"button",accessibilityState:{selected:!!t,disabled:!!o},accessibilityLabel:`${s??e}${!s&&l?`, ${l}`:''}${t?', selected':''}`,'aria-pressed':!!t,disabled:o,onPress:r,style:[N.chip,t&&{backgroundColor:C.colours.gold,borderColor:C.colours.gold},o&&{opacity:.35}],children:[(0,B.jsx)(D,{size:C.font.small,weight:"medium",colour:t?C.colours.onGold:C.colours.text,center:!0,children:e.trim()}),l?(0,B.jsx)(D,{size:12,colour:t?C.colours.onGold:C.colours.muted,center:!0,children:l}):null]})},_e.Toggle=function({value:e,onChange:t,label:r,testID:o,disabled:l,a11y:n}){return(0,B.jsxs)(O,{style:{justifyContent:'space-between',flexShrink:1,minWidth:0},children:[(0,B.jsx)(D,{style:{flex:1,flexShrink:1},children:r}),(0,B.jsx)(y.default,{testID:o,disabled:l,accessibilityLabel:n??r,value:e,onValueChange:t,trackColor:{true:C.colours.gold,false:'#444'},thumbColor:e?'#FFF6E0':'#BBB',activeThumbColor:'#FFF6E0',activeTrackColor:C.colours.gold})]})},_e.Stepper=function({value:e,onChange:t,min:r=1,max:o=20,label:l,step:n=1,format:s,testID:c}){const u=s?s(e):String(e),b=e=>Math.round(e/n)*n;return(0,B.jsxs)(O,{gap:10,children:[(0,B.jsx)(h.default,{testID:c?`${c}-down`:void 0,accessibilityRole:"button",accessibilityLabel:`Decrease ${l??''}`,disabled:e<=r,onPress:()=>t(Math.max(r,b(e-n))),style:[N.stepBtn,e<=r?{opacity:.4}:null],children:(0,B.jsx)(D,{size:20,colour:C.colours.gold,children:"\u2212"})}),(0,B.jsx)(x.default,{testID:c?`${c}-value`:void 0,accessibilityLabel:l?`${l}: ${u}`:u,children:(0,B.jsx)(D,{weight:"semibold",size:C.font.large,style:{minWidth:s?64:28,textAlign:'center'},children:u})}),(0,B.jsx)(h.default,{testID:c?`${c}-up`:void 0,accessibilityRole:"button",accessibilityLabel:`Increase ${l??''}`,disabled:e>=o,onPress:()=>t(Math.min(o,b(e+n))),style:[N.stepBtn,e>=o?{opacity:.4}:null],children:(0,B.jsx)(D,{size:20,colour:C.colours.gold,children:"+"})})]})},_e.Sheet=function({visible:e,onClose:o,title:l,children:n,maxWidth:c,testID:f,footer:y}){const{height:w}=(0,p.default)(),W=s.default.useContext(j.SafeAreaInsetsContext)??{top:0,bottom:0,left:0,right:0},k=(0,r.useTyping)(),S=(0,r.useVisibleArea)(),I=k&&S&&S.height({minHeight:44,minWidth:72,paddingHorizontal:14,borderRadius:22,borderWidth:1.5,borderColor:C.colours.gold,backgroundColor:e?'rgba(201,162,77,0.22)':'rgba(201,162,77,0.10)',alignItems:'center',justifyContent:'center'}),children:(0,B.jsx)(D,{size:15,weight:"semibold",colour:C.colours.goldLight,center:!0,children:"Done"})}):null,R?(0,B.jsx)(h.default,{accessibilityRole:"button",accessibilityLabel:"Close",onPress:o,hitSlop:8,testID:"sheet-close",style:{minWidth:72,minHeight:48,alignItems:'center',justifyContent:'center',marginRight:-8},children:(0,B.jsx)(D,{size:18,colour:C.colours.text,children:"Close"})}):(0,B.jsx)(t.GoldClose,{onPress:o,testID:"sheet-close",style:{marginRight:-6,minWidth:48,minHeight:48}})]}),(0,B.jsx)(b.default,{style:{flexShrink:1},contentContainerStyle:{gap:12,paddingTop:2,paddingBottom:4},children:n}),y?(0,B.jsx)(x.default,{style:{borderTopWidth:1,borderTopColor:C.colours.border,paddingTop:10,marginTop:8},testID:f?`${f}-footer`:void 0,children:y}):null]})})})},_e.SectionTitle=function({children:e}){return(0,B.jsx)(D,{weight:"semibold",size:12,colour:C.colours.goldMuted,center:!0,style:{textTransform:'uppercase',letterSpacing:1.6,marginTop:8},children:e})},Object.defineProperty(_e,"styles",{enumerable:!0,get:function(){return N}}),_r(d[0]);var t=_r(d[1]),r=_r(d[2]),o=_r(d[3]),l=_r(d[4]),n=_r(d[5]),s=e(_r(d[6])),c=e(_r(d[7])),u=e(_r(d[8]));_r(d[9]);var h=e(_r(d[10])),b=e(_r(d[11])),f=e(_r(d[12])),y=e(_r(d[13])),x=e(_r(d[14])),p=e(_r(d[15])),j=_r(d[16]),C=_r(d[17]),w=_r(d[18]),W=_r(d[19]),k=_r(d[20]),S=_r(d[21]),I=_r(d[22]),B=_r(d[23]);const R=['kirkton','abbotsford'].includes(k.VENUE_RID),L='display'!==S.APP_VARIANT;function D({children:e,style:t,size:r=C.font.body,weight:l="regular",colour:n=C.colours.text,numberOfLines:s,center:c,testID:u,accessibilityRole:h,accessibilityLabel:b}){const y='string'==typeof e&&/^(https?:\/\/|www\.)\S+$/.test(e.trim()),x=y?{minWidth:0,maxWidth:'100%',overflowWrap:'anywhere',wordBreak:'break-all',alignSelf:'stretch'}:void 0,p=f.default.flatten(t)||{},j=1===p.flex||1===p.flexGrow||'number'==typeof p.width||'left'===p.textAlign,k=c??(L&&('semibold'===l||'bold'===l)&&!j);return(0,B.jsx)(o.Text,{testID:u??(y?'cc-url':void 0),...k?{dataSet:{centre:'heading'}}:{},accessibilityRole:h,accessibilityLabel:b,numberOfLines:s,style:[{minWidth:0,fontFamily:C.fonts[l],fontSize:r,color:n,lineHeight:(0,w.lineFor)(r)},k&&{textAlign:'center',alignSelf:'center',maxWidth:'100%'},t,x,(0,W.webLine)(t,r),k&&'left'!==p.textAlign?{textAlign:'center'}:null],children:e})}const P=e=>(0,B.jsx)(D,{size:C.font.title,weight:"semibold",center:!0,...e}),T=e=>(0,B.jsx)(D,{size:C.font.large,weight:"semibold",center:!0,...e}),z=e=>(0,B.jsx)(D,{colour:C.colours.muted,size:C.font.small,...e,center:e.center??L});function A({title:e,back:t=!0,right:r,subtitle:o}){return(0,B.jsxs)(x.default,{style:N.brandBar,children:[(0,B.jsxs)(x.default,{style:N.row,children:[(0,B.jsx)(x.default,{style:N.brandSide,children:t?(0,B.jsx)(h.default,{accessibilityRole:"button",accessibilityLabel:"Back",onPress:()=>l.router.canGoBack()?l.router.back():l.router.replace(S.ENTRY[S.APP_VARIANT]),style:N.backBtn,hitSlop:10,children:(0,B.jsx)(D,{size:18,weight:"semibold",colour:C.colours.gold,children:"\u2039 Back"})}):null}),(0,B.jsx)(h.default,{onPress:()=>l.router.push(S.ENTRY[S.APP_VARIANT]),accessibilityLabel:"Home",style:N.brandCenter,children:(0,B.jsx)(I.RestaurantBrand,{size:I.HEADER_LOGO})}),(0,B.jsx)(x.default,{style:[N.brandSide,{alignItems:'flex-end'}],children:r?(0,B.jsx)(x.default,{style:{flexShrink:0},children:r}):null})]}),e?(0,B.jsx)(P,{style:{marginTop:10,alignSelf:'stretch'},children:e}):null,o?(0,B.jsx)(z,{center:!0,style:{alignSelf:'stretch'},children:o}):null]})}function H(){const e=(0,l.useLocalSearchParams)().rid??k.VENUE_RID,t=(0,n.useStore)(t=>t.restaurants.find(t=>t.id===e)?.contactEmail);return t?(0,B.jsx)(h.default,{accessibilityRole:"link",accessibilityLabel:`Email ${t}`,onPress:()=>{c.default.openURL(`mailto:${t}`)},style:{minHeight:44,justifyContent:'center',alignItems:'center',maxWidth:'100%'},children:(0,B.jsx)(D,{center:!0,size:14,colour:C.colours.gold,children:t})}):null}function v({label:e,sub:t,onPress:r,kind:o="primary",disabled:l,small:n,style:s,accessibilityLabel:c,accessibilityHint:u,testID:b}){const f={primary:C.colours.gold,secondary:C.colours.tile,danger:C.colours.redSolid,ghost:'transparent',success:C.colours.accentBg}[o],y={primary:C.colours.onGold,secondary:C.colours.text,danger:'#FFFFFF',ghost:C.colours.gold,success:C.colours.goldLight}[o],x={primary:'transparent',secondary:C.colours.hairline,danger:'transparent',ghost:'transparent',success:C.colours.accentBorder}[o];return(0,B.jsxs)(h.default,{testID:b,accessibilityRole:"button",accessibilityLabel:c??e,accessibilityHint:u,accessibilityState:{disabled:!!l},disabled:l,onPress:r,style:({pressed:e})=>[N.btn,{backgroundColor:e&&'secondary'===o?C.colours.tilePressed:f,borderColor:x,opacity:l?.4:e?.85:1},n&&{paddingVertical:8,paddingHorizontal:14,minHeight:w.control.min,minWidth:44},s],children:[(0,B.jsx)(D,{weight:"semibold",size:n?C.font.small:C.font.body,colour:y,center:!0,children:e.trim()}),t?(0,B.jsx)(D,{size:n?C.font.small-2:C.font.small,colour:y,center:!0,testID:b?`${b}-sub`:void 0,children:t}):null]})}function F({children:e,style:t,onPress:r,highlight:o}){const l=o===C.colours.gold||o===C.colours.accentBorder,n=(0,B.jsx)(x.default,{testID:"cc-card",style:[N.card,{alignItems:'stretch'},o?{borderColor:l?C.colours.accentBorder:o,borderWidth:l?1:2}:null,t],children:e});return r?(0,B.jsx)(h.default,{accessibilityRole:"button",onPress:r,style:({pressed:e})=>({opacity:e?.85:1}),children:n}):n}function E({kind:e="info",title:t,children:r}){const o={info:[C.colours.surface,C.colours.gold,C.colours.text],warn:[C.colours.amberBg,C.colours.amber,'#FFE2A8'],danger:[C.colours.redBg,C.colours.red,'#FFE3DF'],success:[C.colours.okBg,C.colours.ok,C.colours.goldLight],example:[C.colours.amberBg,C.colours.amber,'#FFE2A8'],demo:[C.colours.goldTint,C.colours.gold,C.colours.goldLight]}[e];return(0,B.jsxs)(x.default,{accessibilityRole:"summary",style:[N.banner,{backgroundColor:o[0],borderLeftColor:o[1]}],children:[t?(0,B.jsx)(D,{weight:"semibold",colour:o[2],center:!0,children:t}):null,s.default.Children.toArray(r).every(e=>'string'==typeof e||'number'==typeof e)?(0,B.jsx)(D,{size:C.font.small,colour:o[2],center:!0,children:r}):r]})}z.statusLine=!0,v.centreRow=!0;const V=()=>(0,B.jsx)(E,{kind:"example",title:"Allergens awaiting kitchen verification",children:"This allergen information has not been verified by the kitchen. Head chef sign-off is required. Always speak to staff about allergies."}),$=()=>(0,B.jsx)(E,{kind:"demo",title:"Card payments: not set up yet",children:"No card is charged and no payment provider is contacted."});function O({children:e,style:t,gap:r=8,wrap:o}){const l=s.default.Children.map(e,e=>{if(!s.default.isValidElement(e))return e;const t=e,r=f.default.flatten(t.props.style)||{};return 1!==r.flex&&1!==r.flexGrow?e:s.default.cloneElement(t,{style:[t.props.style,{minWidth:Math.max(t.type===F?240:180,'number'==typeof r.minWidth?r.minWidth:0)}]})}),n=f.default.flatten(t)||{},c=s.default.Children.toArray(l).filter(s.default.isValidElement),u=e=>e.type;if(L&&'space-between'===n.justifyContent&&1!==n.flex&&2===c.length&&c.some(e=>u(e).statusLine))return(0,B.jsx)(x.default,{dataSet:{centre:'status'},style:{alignItems:'center',alignSelf:'stretch',width:'100%',gap:r},children:c});const h=L&&c.length>=2&&c.every(e=>u(e).centreRow)&&'flex-start'!==n.justifyContent&&'space-between'!==n.justifyContent;return(0,B.jsx)(x.default,{...h?{dataSet:{centre:'buttons'}}:{},style:[N.row,{gap:r},h&&{justifyContent:'center',flexWrap:'wrap'},o&&{flexWrap:'wrap',justifyContent:'center'},t],children:l})}const _=()=>(0,B.jsx)(x.default,{style:{height:1,backgroundColor:C.colours.border,marginVertical:4}});const N=f.default.create({row:{flexDirection:'row',alignItems:'center',flexWrap:'wrap',minWidth:0,maxWidth:'100%'},brandBar:{paddingHorizontal:16,paddingTop:8,paddingBottom:8,borderBottomWidth:1,borderBottomColor:C.colours.border},brandSide:{width:96,minHeight:48,justifyContent:'center'},brandCenter:{flex:1,alignItems:'center',justifyContent:'center',minHeight:48},backBtn:{paddingRight:12,minHeight:48,minWidth:88,justifyContent:'center'},btn:{minWidth:0,maxWidth:'100%',flexShrink:1,borderRadius:w.radii.button,paddingVertical:12,paddingHorizontal:18,borderWidth:1,alignItems:'center',justifyContent:'center',minHeight:w.control.min,alignSelf:'stretch'},card:{minWidth:0,maxWidth:'100%',backgroundColor:C.colours.surface,borderRadius:C.radius.l,padding:16,borderWidth:1,borderColor:C.colours.hairline,gap:8},badge:{borderRadius:999,paddingHorizontal:9,paddingVertical:2,borderWidth:1,alignSelf:'flex-start'},banner:{borderRadius:C.radius.m,padding:12,borderLeftWidth:5,gap:2},input:{minWidth:0,boxSizing:'border-box',backgroundColor:C.colours.surface2,borderColor:C.colours.border,borderWidth:1,borderRadius:C.radius.m,paddingHorizontal:12,paddingVertical:10,color:C.colours.text,fontSize:C.font.body,fontFamily:C.fonts.regular},chip:{maxWidth:'100%',flexShrink:0,borderWidth:1,borderColor:C.colours.border,borderRadius:C.radius.m,paddingHorizontal:12,paddingVertical:8,backgroundColor:C.colours.surface2,minWidth:64,minHeight:44,justifyContent:'center'},stepBtn:{width:44,height:44,borderRadius:22,borderWidth:1.5,borderColor:C.colours.gold,alignItems:'center',justifyContent:'center'},overlay:{flex:1,backgroundColor:'rgba(0,0,0,0.7)',justifyContent:'center',alignItems:'center',padding:16},sheet:{backgroundColor:C.colours.surface,borderRadius:w.radii.xl,padding:18,width:'100%',maxWidth:520,maxHeight:'90%',borderWidth:1,borderColor:C.colours.gold},footer:{borderTopWidth:1,borderTopColor:C.colours.border,backgroundColor:C.colours.surface,padding:12}})},794,[795,796,830,827,30,831,34,379,395,236,402,295,41,410,102,426,36,821,826,871,5,872,873,25]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"RESPONSIVE_CSS",{enumerable:!0,get:function(){return t}});const t="\n*,*::before,*::after { box-sizing:border-box !important; }\nhtml,body { max-width:100%; overflow-x:hidden; }\ninput,select,textarea { box-sizing:border-box !important; min-width:0; max-width:100%; }\n[dir=\"auto\"] { overflow-wrap:break-word; }\n[data-testid^=\"area-summary-\"] [dir=\"auto\"] { overflow-wrap:normal; word-break:keep-all; text-align:center; }\n[data-testid=\"venue-header-name\"],\n[data-testid^=\"avatar-option-\"] [dir=\"auto\"] { overflow-wrap:normal !important; word-break:keep-all !important; }\n[data-testid=\"cc-card\"] { min-width:0; max-width:100%; overflow-x:hidden; }\n[data-testid=\"cc-card\"] > [dir=\"auto\"] { text-align:center; }\n[data-testid=\"cc-card\"] > * { min-width:0; max-width:100%; }\n";if('undefined'!=typeof document&&!document.getElementById('cc-responsive-sizing')){const n=document.createElement('style');n.id='cc-responsive-sizing',n.textContent=t,document.head.appendChild(n)}},795,[]); @@ -1095,7 +1095,7 @@ __d(function(g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule' __d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.setClockServer=function(t){s=t,c()},e.markClockUnsent=function(t){o.set(t,Date.now()),c()},e.markClockSent=function(t){o.delete(t)&&c()},e.clockNotSent=l,e.useClockNotSent=function(o){const[,c]=(0,t.useState)(0);return(0,t.useEffect)(()=>{const t=()=>c(t=>t+1);u.add(t);const o=n.mutationQueue.subscribe(t);return()=>{u.delete(t),o()}},[]),l(o)};var t=r(d[0]),n=r(d[1]);const o=new Map,u=new Set,c=()=>{for(const t of u)t()};let s=()=>!1;function l(t){if(!t)return!1;return n.mutationQueue.pending.some(n=>'attendance'===n.table&&n.rowKey===t)||o.has(t)&&s()}n.mutationQueue.onDone(t=>{'attendance'===t.table&&o.delete(t.rowKey)&&c()})},1012,[34,1013]); __d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"MutationQueue",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"mutationQueue",{enumerable:!0,get:function(){return o}});var t=_r(d[0]),e=_r(d[1]),s=_r(d[2]);const n='queue:v1',r='queue:failed:v1',h=t=>`${t.table}|${t.venueId}|${t.rowKey}`;class l{items=[];failedItems=[];loaded=null;flushing=null;flushingSince=0;exec=null;listeners=new Set;onFailure=new Set;onSaved=new Set;retryTimer=null;waitTimer=null;backoffMs=2e3;now=()=>Date.now();constructor(){(0,t.onConnectivity)(t=>{t&&this.flush()})}setExecutor(t){this.exec=t}load(){return this.loaded||(this.loaded=(async()=>{const t=await e.kv.get(n,[]);this.items=[...t.map(t=>({...t,nextAt:void 0})),...this.items],this.failedItems=await e.kv.get(r,[]),this.emit()})()),this.loaded}get pending(){return this.items}get waiting(){return this.items.filter(t=>t.attempts>0)}get failed(){return this.failedItems}hasPending(t,e,s){return this.items.some(n=>n.table===t&&n.venueId===e&&n.rowKey===s)}async enqueue(t){await this.load();const s={...t,id:(0,e.uuid)(),createdAt:(new Date).toISOString(),attempts:0};return this.items.push(s),await this.persist(),this.flush(),s}nextReady(){const t=new Set,e=this.now();for(const s of this.items){const n=h(s);if(!t.has(n)){if(!(s.nextAt&&s.nextAt>e))return s;t.add(n)}}}remove(t){this.items=this.items.filter(e=>e!==t)}flush(){if(this.flushing&&Date.now()-this.flushingSince<6e4)return this.flushing;this.flushingSince=Date.now();let e=null;return e=(async()=>{for(await this.load();this.exec;){if(this.flushing&&this.flushing!==e)return;const n=this.nextReady();if(!n)break;if(!(0,t.isOnline)()){this.scheduleRetry();break}try{const t=await this.exec(n);this.remove(n),this.backoffMs=2e3,'conflict'===t?this.fail(n,'conflict','Row changed on the server (version conflict) or is not visible to you'):this.onSaved.forEach(t=>t(n))}catch(e){n.attempts+=1,n.lastError=String(e?.message??e);const r=e??{};n.lastErr={code:r.code?String(r.code):void 0,status:Number(r.status)||void 0,message:n.lastError.slice(0,300)};const h=(0,s.classifyWriteError)(e);if('network'===h){n.attempts-=1,(0,t.setOnline)(!1),this.scheduleRetry(),await this.persist();break}'retry'===h?n.nextAt=this.now()+(0,s.retryDelayMs)(n.attempts):(this.remove(n),this.fail(n,'rejected',n.lastError))}await this.persist()}this.flushing===e&&(this.flushing=null),this.scheduleWaiting()})(),this.flushing=e,e}retryNow(){for(const t of this.items)t.nextAt=void 0;return this.flush()}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}onFailed(t){return this.onFailure.add(t),()=>{this.onFailure.delete(t)}}onDone(t){return this.onSaved.add(t),()=>{this.onSaved.delete(t)}}async clearFailed(){this.failedItems=[],await e.kv.set(r,[]),this.emit()}fail(t,s,n){const h={...t,lastError:n,failedAt:(new Date).toISOString(),reason:s};this.failedItems=[h,...this.failedItems].slice(0,100),e.kv.set(r,this.failedItems),this.onFailure.forEach(t=>t(h))}scheduleWaiting(){this.waitTimer&&(clearTimeout(this.waitTimer),this.waitTimer=null);const t=this.items.map(t=>t.nextAt??0).filter(t=>t>0);if(!t.length)return;const e=Math.max(500,Math.min(...t)-this.now());this.waitTimer=setTimeout(()=>{this.waitTimer=null,this.flush()},e)}scheduleRetry(){if(this.retryTimer)return;const e=this.backoffMs;this.backoffMs=Math.min(2*this.backoffMs,6e4),this.retryTimer=setTimeout(()=>{this.retryTimer=null,(0,t.setOnline)(!0),this.flush()},e)}async persist(){await e.kv.set(n,this.items),this.emit()}emit(){this.listeners.forEach(t=>t())}}const o=new l},1013,[1010,977,1014]); __d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.classifyWriteError=function(o){if((0,e.isNetworkError)(o))return'network';const{code:n,status:c,msg:l}=t(o);return s(o)?'refused':/^(08|53|57|58)/.test(n)||['40001','40P01','55P03','23505','23503'].includes(n)||/^PGRST30[0-3]$/.test(n)||/jwt|token.*expired/i.test(l)||401===c||408===c||425===c||429===c||c>=500?'retry':409!==c||n?'refused':'retry'},Object.defineProperty(_e,"retryDelayMs",{enumerable:!0,get:function(){return o}}),_e.describeWrite=function(e){const t='rpc'===e.kind?(e.fn??'change').replace(/_/g,' '):n[e.table]??e.table.replace(/_/g,' ').replace(/s$/,''),s=e.values??{},o=s.guest_name??s.name??s.display_name??s.title??s.reason,c='string'==typeof o&&o.trim()?` for ${o.trim().slice(0,60)}`:'';return'delete'===e.kind?`deleting a ${t}${c}`:`the ${t}${c}`},_e.plainReason=function(e,o){const{code:n,status:c,msg:l}=t(e);if('refused'===o)return s(e)?'more than 20 deletes in 10 minutes from one sign-in are stopped to keep your data safe':'42501'===n||403===c||/row-level security|permission/i.test(l)?'your sign-in isn\u2019t allowed to change this':'conflict'===n?'it was changed or removed on another device first':/^(22|23)/.test(n)?'the shared system says some of the details aren\u2019t valid':'P0001'===n&&l?l.slice(0,140):l?`the shared system said: ${l.slice(0,120)}`:'the shared system refused it';return'23505'===n?'the shared system already has another copy of it':'23503'===n?'a related change has to save first':/^PGRST30/.test(n)||401===c||/jwt/i.test(l)?'your sign-in is being refreshed':'the shared system is busy'};var e=r(d[0]);const t=e=>{const t=e&&'object'==typeof e?e:{};return{msg:String(t.message??e??''),code:String(t.code??''),status:Number(t.status??0)||0,hint:String(t.hint??'')}},s=e=>{const s=t(e);return/delete guard/i.test(s.hint)||/too many .* deleted in 10 minutes/i.test(s.msg)};const o=e=>Math.min(5e3*Math.pow(3,Math.max(0,e-1)),3e5),n={bookings:'booking',walk_ins:'walk-in',blocks:'blocked time',sold_out_items:'sold-out mark',sold_out_links:'dish stock link',staff:'staff details',rota_shifts:'rota shift',stock_items:'stock item',stock_events:'stock count',stock_counts:'stock count',chat_messages:'chat message',recipe_cards:'recipe card',order_lists:'order list',order_list_items:'order list item',daily_task_ticks:'task tick',daily_tasks:'daily task',attendance:'clock in or out',cash_ups:'cash-up',table_plans:'table plan',guest_profiles:'guest profile',floor_live:'table status',venues:'venue settings',time_requests:'clock correction request',staff_leave:'time off',scheduled_notifications:'reminder',suppliers:'supplier',supplier_orders:'supplier order',takeaway_orders:'takeaway order'}},1014,[1010]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"APP_VERSION",{enumerable:!0,get:function(){return t}});const t='v0.3.12.160'},1015,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"APP_VERSION",{enumerable:!0,get:function(){return t}});const t='v0.3.12.161'},1015,[]); __d(function(g,_r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"TableRepository",{enumerable:!0,get:function(){return c}}),e.executeMutation=async function(t){const s=(t,s)=>{throw Object.assign(t,{status:s})};if('rpc'===t.kind){const{error:n,status:r}=await u().rpc(t.fn,t.values??{});return n&&s(n,r),'ok'}const n=u().from(t.table);if('upsert'===t.kind||'insert'===t.kind){const{error:r,status:o}=await n.upsert(t.values??{},{onConflict:t.conflictKey??'id',ignoreDuplicates:'insert'===t.kind});return r&&s(r,o),'ok'}let r='update'===t.kind?n.update(t.values??{}):n.delete();for(const[s,n]of Object.entries(t.match??{}))r=r.eq(s,n);const{data:o,error:c,status:h}=await r.select();c&&s(c,h);return'update'!==t.kind||o&&0!==o.length?'ok':'conflict'};var t=_r(d[0]),s=_r(d[1]),n=_r(d[2]),r=_r(d[3]),o=_r(d[4]);const u=()=>(0,n.getSupabase)();class c{constructor(t,s={}){this.table=t,this.opts=s,this.keyOf=s.keyOf??(t=>String(t.id)),this.keyColumns=s.keyColumns??['id'],this.venueCol=s.venueColumn??'venue_id'}rows(t){return s.cache.rows(this.table,t)}get(t,n){return s.cache.get(this.table,t,n)}subscribe(t,n){return s.cache.subscribe(this.table,t,n)}hydrate(t){return s.cache.hydrate(this.table,t)}async refresh(n,r={}){const c=()=>{let t=u().from(this.table).select('*').eq(this.venueCol,n);return this.opts.orderBy&&(t=t.order(this.opts.orderBy.column,{ascending:this.opts.orderBy.ascending??!0})),r.filter&&(t=r.filter(t)),t},h='bookings'===this.table?await(0,t.readPages)(async(t,s)=>{const{data:n,error:r}=await c().order('id').range(t,s);if(r)throw r;return n??[]}):await(async()=>{const{data:t,error:s}=await c().limit(this.opts.limit??1e3);if(s)throw s;return t??[]})();return s.cache.replace(this.table,n,h.map(t=>[this.keyOf(t),t]),t=>o.mutationQueue.hasPending(this.table,n,t)),h}async create(t,n){const u={...1===this.keyColumns.length&&'id'===this.keyColumns[0]?{id:(0,r.uuid)()}:{},...n,[this.venueCol]:t},c=this.keyOf(u);return s.cache.put(this.table,t,c,u),await o.mutationQueue.enqueue({table:this.table,venueId:t,kind:'insert'===this.opts.writeMode?'insert':'upsert',rowKey:c,values:u,conflictKey:this.opts.conflictKey??'id'}),u}async update(t,n,r,u={}){const c=s.cache.get(this.table,t,n),h={...this.matchFor(n,c),...u,[this.venueCol]:t};s.cache.patch(this.table,t,n,{...r,updated_at:(new Date).toISOString()}),await o.mutationQueue.enqueue({table:this.table,venueId:t,kind:'update',rowKey:n,values:r,match:h})}async remove(t,n){const r=s.cache.get(this.table,t,n),u={...this.matchFor(n,r),[this.venueCol]:t};s.cache.remove(this.table,t,n),await o.mutationQueue.enqueue({table:this.table,venueId:t,kind:'delete',rowKey:n,match:u})}matchFor(t,s){if(1===this.keyColumns.length&&'id'===this.keyColumns[0])return{id:t};const n={};for(const t of this.keyColumns)n[t]=s?.[t];return n}}},1016,[1017,1018,933,977,1013]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.readPages=async function(t,n=1e3){const s=[];for(let c=0;;c+=n){const o=await t(c,c+n-1);if(s.push(...o),o.length`cache:${t}:${n}`;function f(t){let s=n.get(t);return s||(s=new Map,n.set(t,s)),s}function p(n){s.delete(n),c.get(n)?.forEach(t=>t());const u=o.get(n);u&&clearTimeout(u),o.set(n,setTimeout(()=>{o.delete(n),t.kv.set(n,Array.from(f(n).entries()))},250))}const w={async hydrate(n,s){const c=l(n,s);if(u.has(c))return;u.add(c);const o=await t.kv.get(c,[]),w=f(c);let h=0;for(const[t,n]of o)w.has(t)||(w.set(t,n),h++);h&&p(c)},rows(t,n){const c=l(t,n);let o=s.get(c);return o||(o=Array.from(f(c).values()),s.set(c,o)),o},get:(t,n,s)=>f(l(t,n)).get(s),put(t,n,s,c){f(l(t,n)).set(s,c),p(l(t,n))},patch(t,n,s,c){const o=f(l(t,n)),u=o.get(s);u&&(o.set(s,{...u,...c}),p(l(t,n)))},remove(t,n,s){f(l(t,n)).delete(s)&&p(l(t,n))},replace(t,s,c,o=()=>!1){const u=l(t,s),w=f(u),h=new Map(c);w.forEach((t,n)=>{o(n)&&h.set(n,t)}),n.set(u,h),p(u)},subscribe(t,n,s){const o=l(t,n);let u=c.get(o);return u||(u=new Set,c.set(o,u)),u.add(s),()=>{u?.delete(s)}},async clearVenue(o,f){for(const p of f){const f=l(p,o);n.delete(f),s.delete(f),u.delete(f),await t.kv.remove(f),c.get(f)?.forEach(t=>t())}}}},1018,[977]); @@ -1197,7 +1197,7 @@ __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule', __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SEATED_BG",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"SEATED_FG",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"SEATED_MUTED",{enumerable:!0,get:function(){return u}}),e.isSeatedHighlight=function(t,o){return'seated'===t&&!o?.otherDay},e.seatedHighlightStyle=function(u){return{backgroundColor:o,borderColor:t.colours.goldLight,borderWidth:1.5,borderLeftWidth:8,borderLeftColor:n,...u}};var t=r(d[0]);const o=t.colours.gold,n=t.colours.onGold,u='#3F3218'},1114,[821]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.BookingTableButton=function({rid:e,booking:l,readOnly:y,turnBase:B=90,testID:f}){const[h,j]=(0,t.useState)(!1),k=(0,s.tableButtonLabel)(l.table),x=f??`table-btn-${l.id}`;if(y)return(0,c.jsx)(n.default,{testID:x,accessible:!0,accessibilityLabel:(0,s.tableButtonA11y)(l.table,!0),style:{minHeight:44,justifyContent:'center'},children:(0,c.jsx)(b.T,{size:16,weight:"semibold",colour:o.colours.goldLight,children:k})});return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(b.Button,{kind:"secondary",label:k,testID:x,accessibilityLabel:(0,s.tableButtonA11y)(l.table),onPress:()=>j(!0),style:{minHeight:44}}),h?(0,c.jsx)(u.TablePicker,{rid:e,booking:l,name:l.walkIn?'Walk-in':(l.name??'').replace(' (example)',''),turnBase:B,onClose:()=>j(!1)}):null]})};var e,t=r(d[0]),l=r(d[1]),n=(e=l)&&e.__esModule?e:{default:e},s=r(d[2]),o=r(d[3]),u=r(d[4]),b=r(d[5]),c=r(d[6])},1115,[34,102,1116,821,1117,794,25]); __d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"tableButtonLabel",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"tableButtonA11y",{enumerable:!0,get:function(){return s}}),e.tableOptions=function(t,n,o){const s=t.tables.map(t=>t.name).sort(l),c=new Set;return(t.joins??[]).forEach(t=>{t.tables.length>1&&c.add(t.tables.slice().sort(l).join('+'))}),[...n.map(t=>t.table),o].forEach(t=>{const n=a(t);n.length>1&&c.add(n.slice().sort(l).join('+'))}),[...s,...[...c].sort(l)]},e.tableOverlaps=function(t,l,o,s=90){const c=a(l);if(!c.length)return[];const b={...t,table:l};return o.filter(l=>l.id!==t.id&&l.date===t.date&&!['cancelled','noshow','finished'].includes(l.status)&&a(l.table).some(t=>c.includes(t))&&(0,n.startOf)(b)<(0,n.endOf)(l,s)&&(0,n.startOf)(l)<(0,n.endOf)(b,s))},Object.defineProperty(e,"tablePatch",{enumerable:!0,get:function(){return c}});var t=r(d[0]),n=r(d[1]);const a=t=>t?t.split('+').map(t=>t.trim()).filter(Boolean):[],l=(t,n)=>t.localeCompare(n,'en-GB',{numeric:!0}),o=n=>(0,t.tableNumbers)(n)||'No table',s=(n,a)=>`${(0,t.tableNumbersA11y)(n)}${a?'':', change table'}`;const c=t=>({table:t||void 0,tableSetHere:!0})},1116,[860,1101]); -__d(function(_g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.saveBookingTables=v,_e.TablePicker=function({rid:e,booking:u,name:g,turnBase:k=90,onClose:$,onSaved:w,onPickOnPlan:C}){const L=(0,b.usePlan)(e),S=(0,c.useBookings)(e),[T,P]=(0,l.useState)(()=>(0,b.tablesOf)((0,h.tableKey)((0,b.tablesOf)(u.table)))),W=(0,l.useMemo)(()=>(0,h.pickGroups)(L),[L]),z=S.filter(e=>e.date===u.date),I=(0,h.seatsOf)(L,T),D=(0,h.seatLine)(I.total,u.partySize),B=(0,h.pickClashes)(u,T,z,k),O=e=>(0,h.pickClashes)(u,[e],z,k)[0]?.with,R=(0,h.tableKey)(T)!==(0,h.tableKey)((0,b.tablesOf)(u.table)),M=(0,f.useBlocks)(e=>e.blocks),N=(0,f.blockAt)(M,e,u.date,u.time),[_,A]=(0,l.useState)(null),G=e=>{A(null),P(t=>(0,h.toggleTable)(t,e))},Y=async t=>{try{await v(e,u,t),w?.((0,h.savedWords)(g,u.partySize,t,(0,h.seatsOf)(L,t).total)),$()}catch(e){w?.(`Couldn\u2019t save tables for ${g}: ${String(e?.message??e).slice(0,120)}`)}},K=(0,x.jsxs)(n.default,{style:{gap:8},children:[(0,x.jsxs)(n.default,{testID:"table-pick-total",accessible:!0,accessibilityLabel:`${(0,h.tablesWords)(T)} picked. ${D.text}.`,children:[(0,x.jsx)(p.T,{size:18,weight:"semibold",center:!0,colour:y.colours.goldLight,children:(0,h.tablesWords)(T)}),(0,x.jsx)(p.T,{size:17,center:!0,colour:y.colours.text,children:D.text})]}),N?(0,x.jsx)(n.default,{testID:"table-pick-pause",accessible:!0,accessibilityLabel:`Note. New bookings are paused ${N.from} to ${N.to}${N.reason?` (${N.reason})`:''}. You can still assign tables to this booking.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:y.colours.goldMuted},children:(0,x.jsxs)(p.T,{size:16,center:!0,colour:y.colours.goldLight,children:["New bookings paused ",N.from,"\u2013",N.to,N.reason?` \xb7 ${N.reason}`:'',". You can still save tables for this booking."]})}):null,B.length?(0,x.jsx)(n.default,{testID:"table-pick-clash",accessible:!0,accessibilityLabel:`Warning. ${(0,h.clashWords)(B)} You can still save.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:y.colours.gold},children:(0,x.jsxs)(p.T,{size:16,weight:"semibold",center:!0,colour:y.colours.goldLight,children:[(0,h.clashWords)(B)," You can still save."]})}):null,_?(0,x.jsxs)(n.default,{testID:"table-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:_,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:y.colours.amber,backgroundColor:y.colours.amberBg,alignItems:'stretch'},children:[(0,x.jsx)(p.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:_}),(0,x.jsxs)(p.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,x.jsx)(p.Button,{testID:"table-pick-overcap-yes",label:"Use it anyway",accessibilityLabel:`Use it anyway, ${(0,h.tablesWords)(T)} for ${g}, ${u.partySize} people`,onPress:()=>{Y(T)},style:[j,{flexGrow:1}]}),(0,x.jsx)(p.Button,{testID:"table-pick-overcap-no",kind:"secondary",label:"Pick another table",onPress:()=>A(null),style:j})]})]}):null,(0,x.jsxs)(p.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[_?null:(0,x.jsx)(p.Button,{testID:"table-pick-save",label:B.length?'Save anyway':'Save tables',disabled:!R||!T.length,accessibilityLabel:`${B.length?'Save anyway, ':'Save, '}${(0,h.tablesWords)(T)} for ${g}. ${D.text}.${B.length?` ${(0,h.clashWords)(B)}`:''}`,onPress:()=>{const e=(0,h.overCapacityAsk)(T,I.total,u.partySize);!e||_?Y(T):A(e)},style:[j,{flexGrow:1}]}),(0,b.tablesOf)(u.table).length?(0,x.jsx)(p.Button,{testID:"table-pick-clear",kind:"secondary",label:"Clear table",accessibilityLabel:`Clear table, take ${(0,h.tablesWords)((0,b.tablesOf)(u.table)).toLowerCase()} off ${g}`,onPress:()=>Y([]),style:j}):null,(0,x.jsx)(p.Button,{testID:"table-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",onPress:$,style:j})]})]});return(0,x.jsxs)(p.Sheet,{visible:!0,onClose:$,title:`Tables \xb7 ${u.time} ${g} \xb7 ${u.partySize} Covers`,maxWidth:760,testID:"table-picker",footer:K,children:[(0,x.jsx)(t.TableNumberWarning,{plan:L}),(0,x.jsx)(p.T,{size:16,center:!0,colour:y.colours.text,children:"Tap one table, or several to join them. Tap again to take one off. Smaller tables can still be used."}),C?(0,x.jsx)(p.Button,{kind:"secondary",testID:"table-pick-on-plan",label:"Pick on the table plan",accessibilityLabel:`Pick on the table plan instead, for ${g}`,onPress:()=>C(T),style:j}):null,W.map(e=>(0,x.jsxs)(n.default,{style:{gap:6},accessibilityLabel:e.area,children:[(0,x.jsx)(p.T,{size:15,weight:"semibold",center:!0,colour:y.colours.gold,children:e.area}),(0,x.jsx)(p.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:e.tables.map(e=>{const t=T.includes(e.name),l=O(e.name);return(0,x.jsxs)(o.default,{testID:`table-pick-${e.name}`,accessibilityRole:"checkbox",accessibilityState:{checked:t},'aria-checked':t,accessibilityLabel:(0,h.pickA11y)(e.name,e.seats,t,l),onPress:()=>G(e.name),style:({pressed:e})=>({minWidth:92,minHeight:64,paddingHorizontal:10,paddingVertical:6,borderRadius:12,alignItems:'center',justifyContent:'center',borderWidth:t?2:1,borderColor:t?y.colours.gold:l?y.colours.goldMuted:y.colours.hairline,borderStyle:l&&!t?'dashed':'solid',backgroundColor:t?y.colours.gold:e?y.colours.tilePressed:y.colours.tile}),children:[(0,x.jsx)(p.T,{size:18,weight:"semibold",colour:t?y.colours.onGold:y.colours.text,children:(0,s.tableNumbers)(e.name)}),(0,x.jsxs)(p.T,{size:14,colour:t?y.colours.onGold:y.colours.muted,children:[e.seats," seats",l?' \xb7 booked':'']})]},e.name)})})]},e.area)),W.length?null:(0,x.jsx)(p.Muted,{center:!0,children:"No tables on the plan yet. Add them in Setup \u203a Table plan."})]})};var t=r(d[0]),s=r(d[1]),l=r(d[2]),o=e(r(d[3])),n=e(r(d[4])),c=r(d[5]),b=r(d[6]),u=r(d[7]),h=r(d[8]),y=r(d[9]),g=r(d[10]),p=r(d[11]),k=r(d[12]),f=r(d[13]),x=r(d[14]);const j={minHeight:56};async function v(e,t,s){const l=(0,h.tableKey)(s),o=(0,b.tablesOf)(t.table);await c.repo.bookings.update(t.id,(0,u.tablePatch)(l||null)),'seated'===t.status&&t.date===(0,g.venueYmd)(new Date)&&(o.filter(e=>!(0,b.tablesOf)(l).includes(e)).forEach(t=>b.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!0})),l&&(0,k.resetTableLive)(e,l))}},1117,[1118,860,34,402,102,874,1025,1116,1119,821,858,794,1120,1022,25]); +__d(function(_g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.saveBookingTables=v,_e.TablePicker=function({rid:e,booking:u,name:g,turnBase:k=90,onClose:$,onSaved:w,onPickOnPlan:C}){const L=(0,b.usePlan)(e),S=(0,c.useBookings)(e),[T,P]=(0,l.useState)(()=>(0,b.tablesOf)((0,h.tableKey)((0,b.tablesOf)(u.table)))),W=(0,l.useMemo)(()=>(0,h.pickGroups)(L),[L]),z=S.filter(e=>e.date===u.date),I=(0,h.seatsOf)(L,T),D=(0,h.seatLine)(I.total,u.partySize),B=(0,h.pickClashes)(u,T,z,k),O=e=>(0,h.pickClashes)(u,[e],z,k)[0]?.with,R=(0,h.tableKey)(T)!==(0,h.tableKey)((0,b.tablesOf)(u.table)),M=(0,f.useBlocks)(e=>e.blocks),N=(0,f.blockAt)(M,e,u.date,u.time),[_,A]=(0,l.useState)(null),G=e=>{A(null),P(t=>(0,h.toggleTable)(t,e))},Y=async t=>{try{await v(e,u,t),w?.((0,h.savedWords)(g,u.partySize,t,(0,h.seatsOf)(L,t).total)),$()}catch(e){w?.(`Couldn\u2019t save tables for ${g}: ${String(e?.message??e).slice(0,120)}`)}},K=(0,x.jsxs)(n.default,{style:{gap:8},children:[(0,x.jsxs)(n.default,{testID:"table-pick-total",accessible:!0,accessibilityLabel:`${(0,h.tablesWords)(T)} picked. ${D.text}.`,children:[(0,x.jsx)(p.T,{size:18,weight:"semibold",center:!0,colour:y.colours.goldLight,children:(0,h.tablesWords)(T)}),(0,x.jsx)(p.T,{size:17,center:!0,colour:y.colours.text,children:D.text})]}),N?(0,x.jsx)(n.default,{testID:"table-pick-pause",accessible:!0,accessibilityLabel:`Note. New bookings are paused ${N.from} to ${N.to}${N.reason?` (${N.reason})`:''}. You can still assign tables to this booking.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:y.colours.goldMuted},children:(0,x.jsxs)(p.T,{size:16,center:!0,colour:y.colours.goldLight,children:["New bookings paused ",N.from,"\u2013",N.to,N.reason?` \xb7 ${N.reason}`:'',". You can still save tables for this booking."]})}):null,B.length?(0,x.jsx)(n.default,{testID:"table-pick-clash",accessible:!0,accessibilityLabel:`Warning. ${(0,h.clashWords)(B)} You can still save.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:y.colours.gold},children:(0,x.jsxs)(p.T,{size:16,weight:"semibold",center:!0,colour:y.colours.goldLight,children:[(0,h.clashWords)(B)," You can still save."]})}):null,_?(0,x.jsxs)(n.default,{testID:"table-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:_,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:y.colours.gold,backgroundColor:y.colours.amberBg,alignItems:'stretch'},children:[(0,x.jsx)(p.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:_}),(0,x.jsxs)(p.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,x.jsx)(p.Button,{testID:"table-pick-overcap-yes",label:"Use it anyway",accessibilityLabel:`Use it anyway, ${(0,h.tablesWords)(T)} for ${g}, ${u.partySize} people`,onPress:()=>{Y(T)},style:[j,{flexGrow:1}]}),(0,x.jsx)(p.Button,{testID:"table-pick-overcap-no",kind:"secondary",label:"Pick another table",onPress:()=>A(null),style:j})]})]}):null,(0,x.jsxs)(p.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[_?null:(0,x.jsx)(p.Button,{testID:"table-pick-save",label:B.length?'Save anyway':'Save tables',disabled:!R||!T.length,accessibilityLabel:`${B.length?'Save anyway, ':'Save, '}${(0,h.tablesWords)(T)} for ${g}. ${D.text}.${B.length?` ${(0,h.clashWords)(B)}`:''}`,onPress:()=>{const e=(0,h.overCapacityAsk)(T,I.total,u.partySize);!e||_?Y(T):A(e)},style:[j,{flexGrow:1}]}),(0,b.tablesOf)(u.table).length?(0,x.jsx)(p.Button,{testID:"table-pick-clear",kind:"secondary",label:"Clear table",accessibilityLabel:`Clear table, take ${(0,h.tablesWords)((0,b.tablesOf)(u.table)).toLowerCase()} off ${g}`,onPress:()=>Y([]),style:j}):null,(0,x.jsx)(p.Button,{testID:"table-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",onPress:$,style:j})]})]});return(0,x.jsxs)(p.Sheet,{visible:!0,onClose:$,title:`Tables \xb7 ${u.time} ${g} \xb7 ${u.partySize} Covers`,maxWidth:760,testID:"table-picker",footer:K,children:[(0,x.jsx)(t.TableNumberWarning,{plan:L}),(0,x.jsx)(p.T,{size:16,center:!0,colour:y.colours.text,children:"Tap one table, or several to join them. Tap again to take one off. Smaller tables can still be used."}),C?(0,x.jsx)(p.Button,{kind:"secondary",testID:"table-pick-on-plan",label:"Pick on the table plan",accessibilityLabel:`Pick on the table plan instead, for ${g}`,onPress:()=>C(T),style:j}):null,W.map(e=>(0,x.jsxs)(n.default,{style:{gap:6},accessibilityLabel:e.area,children:[(0,x.jsx)(p.T,{size:15,weight:"semibold",center:!0,colour:y.colours.gold,children:e.area}),(0,x.jsx)(p.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:e.tables.map(e=>{const t=T.includes(e.name),l=O(e.name);return(0,x.jsxs)(o.default,{testID:`table-pick-${e.name}`,accessibilityRole:"checkbox",accessibilityState:{checked:t},'aria-checked':t,accessibilityLabel:(0,h.pickA11y)(e.name,e.seats,t,l),onPress:()=>G(e.name),style:({pressed:e})=>({minWidth:92,minHeight:64,paddingHorizontal:10,paddingVertical:6,borderRadius:12,alignItems:'center',justifyContent:'center',borderWidth:t?2:1,borderColor:t?y.colours.gold:l?y.colours.goldMuted:y.colours.hairline,borderStyle:l&&!t?'dashed':'solid',backgroundColor:t?y.colours.gold:e?y.colours.tilePressed:y.colours.tile}),children:[(0,x.jsx)(p.T,{size:18,weight:"semibold",colour:t?y.colours.onGold:y.colours.text,children:(0,s.tableNumbers)(e.name)}),(0,x.jsxs)(p.T,{size:14,colour:t?y.colours.onGold:y.colours.muted,children:[e.seats," seats",l?' \xb7 booked':'']})]},e.name)})})]},e.area)),W.length?null:(0,x.jsx)(p.Muted,{center:!0,children:"No tables on the plan yet. Add them in Setup \u203a Table plan."})]})};var t=r(d[0]),s=r(d[1]),l=r(d[2]),o=e(r(d[3])),n=e(r(d[4])),c=r(d[5]),b=r(d[6]),u=r(d[7]),h=r(d[8]),y=r(d[9]),g=r(d[10]),p=r(d[11]),k=r(d[12]),f=r(d[13]),x=r(d[14]);const j={minHeight:56};async function v(e,t,s){const l=(0,h.tableKey)(s),o=(0,b.tablesOf)(t.table);await c.repo.bookings.update(t.id,(0,u.tablePatch)(l||null)),'seated'===t.status&&t.date===(0,g.venueYmd)(new Date)&&(o.filter(e=>!(0,b.tablesOf)(l).includes(e)).forEach(t=>b.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!0})),l&&(0,k.resetTableLive)(e,l))}},1117,[1118,860,34,402,102,874,1025,1116,1119,821,858,794,1120,1022,25]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.TableNumberWarning=function({plan:u}){const c=(0,n.numberClashes)(u.tables),o=[...new Set([...c.acrossAreas,...u.tables.filter(n=>c.sameArea.has(n.name)).map(n.tableNumber)])];return o.length?(0,l.jsxs)(t.T,{testID:"duplicate-table-numbers",size:16,colour:s.colours.goldLight,children:["Duplicate table numbers: ",o.join(', '),". Kept unchanged. Ask a manager to check the areas before assigning."]}):null},r(d[0]);var n=r(d[1]),s=r(d[2]),t=r(d[3]),l=r(d[4])},1118,[34,859,821,794,25]); __d(function(_g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"byNum",{enumerable:!0,get:function(){return s}}),e.tableKey=o,e.toggleTable=function(t,n){return t.includes(n)?t.filter(t=>t!==n):a(o([...t,n]))},e.seatsOf=function(t,n){const a={};for(const s of n)a[s]=t.tables.find(t=>t.name===s)?.maxSeats??0;return{per:a,total:Object.values(a).reduce((t,n)=>t+n,0)}},e.seatLine=function(t,n){const a=Math.max(0,n-t);return{text:`${t} ${1===t?'seat':'seats'} for ${l(n)}${a?`: ${a} short`:''}`,short:a,fits:0===a&&t>0}},e.pickClashes=function(t,l,u,c=90){if(!l.length)return[];const f={...t,table:o(l)},b=[];for(const s of u)if(s.id!==t.id&&s.date===t.date&&!['cancelled','noshow','finished'].includes(s.status)&&(0,n.startOf)(f)<(0,n.endOf)(s,c)&&(0,n.startOf)(s)<(0,n.endOf)(f,c))for(const t of a(s.table))l.includes(t)&&b.push({table:t,with:s});return b.sort((t,n)=>s(t.table,n.table))},e.overCapacityAsk=function(n,s,l){const u=a(o(n));if(!u.length||s>=l)return null;const c=u.map(n=>(0,t.tableNumbers)(n));return`${1===c.length?`Table ${c[0]} seats`:`Tables ${c.slice(0,-1).join(', ')} and ${c[c.length-1]} seat`} ${s} \u2013 this booking is ${l}. Use it anyway?`},e.clashWords=function(n){return n.map(n=>`${(0,t.tableNumbers)(n.table)} has ${n.with.walkIn?'a walk-in':(n.with.name||'a booking').replace(' (example)','')} at ${n.with.time}`).join('. ')+(n.length?'.':'')},e.tablesWords=u,e.pickA11y=function(n,a,s,l){return`Table ${(0,t.tableNumbers)(n)}, ${a} ${1===a?'seat':'seats'}${s?', selected':''}${l?`, has ${l.walkIn?'a walk-in':l.name} at ${l.time}`:''}`},e.pickGroups=function(t){return t.areas.map(n=>({area:n.name,tables:t.tables.filter(t=>t.areaId===n.id).map(t=>({name:t.name,seats:t.maxSeats})).sort((t,n)=>s(t.name,n.name))})).filter(t=>t.tables.length)},e.savedWords=function(t,n,a,s){return a.length?`${t}, ${l(n)}: ${u(a)} (${s} seats).`:`${t}: table taken off.`},e.tableActions=function(t,n){const s=a(t.table);if(['cancelled','noshow'].includes(t.status))return[];const o=[s.length?{id:'assign',label:'Change table',a11y:`Change table for ${n}, ${l(t.partySize)}, now ${u(s).toLowerCase()}. You can pick several tables to join.`}:{id:'assign',label:'Assign table',a11y:`Assign table for ${n}, ${l(t.partySize)}. You can pick several tables to join.`}];s.length&&o.push({id:'clear',label:'Clear table',a11y:`Clear table for ${n}, take ${u(s).toLowerCase()} off this booking`});return o},e.dragTables=function(t,n,s){if(!s||'__none'===s||s===n)return null;const l=a(t);if(l.includes(s))return null;return o('__none'!==n&&l.includes(n)?l.map(t=>t===n?s:t):[s])};var t=r(d[0]),n=r(d[1]);const a=t=>t?t.split('+').map(t=>t.trim()).filter(Boolean):[],s=(t,n)=>t.localeCompare(n,'en-GB',{numeric:!0}),l=t=>`${t} ${1===t?'person':'people'}`;function o(t){return[...new Set(t.map(t=>String(t).trim()).filter(Boolean))].sort(s).join('+')}function u(n){const s=a(o(n));return s.length?(0,t.tableListNumbers)(s):'No table'}},1119,[860,1101]); __d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"TABLES",{enumerable:!0,get:function(){return O}}),_e.useTableNames=N,_e.resetTableLive=M,_e.seatBookingNow=L,_e.finishBookingNow=async function(e,t){await f.repo.bookings.setStatus(t.id,'finished'),(0,S.tablesOf)(t.table).forEach(t=>S.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!0}))},_e.useTableUse=F,Object.defineProperty(_e,"walkInLabel",{enumerable:!0,get:function(){return R}}),_e.TablePicker=W,_e.WalkInSheet=E,_e.WalkInMatchPrompt=H,_e.AssignTableSheet=_,_e.undoNotice=Y,_e.NewBookingSheet=U,_e.useFrontDoor=function(e,t){const[s,o]=(0,r.useState)(!1),[l,a]=(0,r.useState)(!1),[i,d]=(0,r.useState)(null);return{openWalkIn:()=>o({}),openWalkInAt:e=>o({table:e}),openBooking:()=>a(!0),assignTable:e=>d({b:e}),combineTables:e=>d({b:e,combine:!0}),elements:(0,B.jsxs)(B.Fragment,{children:[s?(0,B.jsx)(E,{wide:t,initialTable:s.table,onClose:()=>o(!1),onSeated:Y}):null,l?(0,B.jsx)(U,{wide:t,date:e,onClose:()=>a(!1),onSaved:e=>(0,n.notify)({id:`booked:${Date.now()}`,testID:'booking-saved-toast',timeoutMs:5e3,icon:'\u2713',title:`Booked: ${e.name} \xb7 ${(0,x.niceDate)((0,x.parseYmd)(e.date))} at ${e.time}`})}):null,i?(0,B.jsx)(_,{booking:i.b,combine:i.combine,onClose:()=>d(null)}):null]})}};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),a=_r(_d[4]),i=_r(_d[5]),n=_r(_d[6]),r=_r(_d[7]),d=e(r),u=_r(_d[8]),c=e(_r(_d[9])),b=e(_r(_d[10])),h=_r(_d[11]),p=_r(_d[12]),f=_r(_d[13]),y=_r(_d[14]),k=_r(_d[15]),x=_r(_d[16]),j=_r(_d[17]),w=_r(_d[18]),T=_r(_d[19]),S=_r(_d[20]),v=_r(_d[21]),C=_r(_d[22]),D=_r(_d[23]),I=_r(_d[24]),$=_r(_d[25]),P=_r(_d[26]),z=_r(_d[27]),B=_r(_d[28]);const O=Array.from({length:12},(e,t)=>String(t+1));function N(e){const t=(0,S.usePlan)(e);return t.areas.flatMap(e=>t.tables.filter(t=>t.areaId===e.id).map(e=>e.name))}function M(e,t){(0,S.tablesOf)(t).forEach(t=>S.useFloor.getState().setLive(e,t,{stage:'seated',dirty:!1}))}async function L(e,t){await f.repo.bookings.setStatus(t.id,'seated'),M(e,t.table)}function F(e,t){const s=(0,f.useBookings)(e),o=(0,f.useOrders)(e),l=N(e),a=(0,S.useFloor)(t=>t.live[e])??{},i=(0,S.usePlan)(e),n=(0,v.useBlocks)(e=>e.blocks),r=(0,x.ymd)(t),d=(0,v.closedAreasAt)(n,e,r,(0,x.hm)(t)),u={};for(const e of l)u[e]=a[e]?.blocked||d.has(`tbl:${e}`)?{busy:!0,label:'Blocked'}:d.has(i.tables.find(t=>t.name===e)?.areaId??'')?{busy:!0,label:'Closed'}:a[e]?.dirty?{busy:!0,label:'Needs clearing'}:{busy:!1,label:'Free'};for(const e of s)if(e.date===r&&e.table)for(const s of(0,S.tablesOf)(e.table))if(u[s])if('seated'===e.status)u[s]={busy:!0,label:`${e.walkIn?'Walk-in':`${e.name.slice(0,1)}.`} \xb7 ${e.partySize}`};else if('confirmed'===e.status&&!u[s].busy){const o=(0,x.minsBetween)(t,new Date(`${e.date}T${e.time}:00`));o>=-15&&o<=90&&(u[s]={...u[s],soon:`Booked ${e.time}`})}for(const e of o)'table'===e.type&&e.tableNo&&u[e.tableNo]&&!['closed','cancelled','collected'].includes(e.status)&&!u[e.tableNo].busy&&(u[e.tableNo]={busy:!0,label:'Open order'});return u}const R=e=>e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;function W({use:e,value:t,onPick:s,big:o,best:a,dense:i,bestSet:n,picked:d}){const u=Object.keys(e),[h,p]=(0,r.useState)(0),f=i?6:8,y=i?64:o?92:76,k=h?Math.max(3,Math.floor((h+f)/(y+f))):0,x=k?Math.floor((h-f*(k-1))/k):y,w=new Set(n??[]),v=a?(0,S.tablesOf)(a)[0]:null;return(0,B.jsx)(b.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:f},testID:"table-picker",onLayout:e=>p(Math.floor(e.nativeEvent.layout.width)),children:u.map(o=>{const a=e[o],n=t===o||!!d?.includes(o),r=w.has(o),u=v===o&&!n,h=a.busy?['Blocked','Needs clearing','Closed'].includes(a.label)?a.label:'In use':a.soon??'Free';return(0,B.jsxs)(c.default,{accessibilityRole:"button",testID:`pick-table-${o}`,accessibilityLabel:`Table ${(0,l.tableNumbers)(o)}${d?n?', picked':', not picked':''}, ${a.busy?`in use (${a.label})`:a.soon?`free, ${a.soon}`:'free'}${r?', best table':''}${u?', suggested for this party':''}`,accessibilityState:{selected:n,disabled:'Closed'===a.label},disabled:'Closed'===a.label,onPress:()=>s(o),style:{width:x,minHeight:i?58:64,borderRadius:12,borderWidth:n||u?2.5:1.5,paddingVertical:i?3:6,paddingHorizontal:4,alignItems:'center',justifyContent:'center',gap:2,borderColor:n||u?j.colours.gold:a.busy?j.colours.red:j.colours.ok,backgroundColor:n?j.colours.goldTint:a.busy?j.colours.redBg:j.colours.surface2,opacity:'Closed'!==a.label||n?1:.55},children:[(0,B.jsxs)(b.default,{style:{flexDirection:'row',alignItems:'center',gap:4},children:[(0,B.jsx)(T.T,{weight:"bold",size:22,colour:n?j.colours.goldLight:j.colours.text,children:(0,l.tableNumbers)(o)}),r?(0,B.jsx)(b.default,{testID:"best-table",style:{backgroundColor:j.colours.gold,borderRadius:5,paddingHorizontal:4,paddingVertical:1},children:(0,B.jsx)(T.T,{size:11,weight:"bold",colour:j.colours.onGold,children:"BEST"})}):null]}),(0,B.jsx)(T.T,{size:i?13:14,colour:a.busy?'#FFD9D4':a.soon?'#FFE2A8':'#E2C489',center:!0,numberOfLines:1,children:h})]},o)})})}const A=[1,2,3,4,5,6,7,8];function E({onClose:e,onSeated:a,wide:i,initialTable:y}){const{rid:w,r:C,now:D}=(0,p.useCtx)(15e3),I=F(w,D),[$,P]=(0,r.useState)(2),[O,N]=(0,r.useState)(!1),[R,E]=(0,r.useState)(y??null),_=(0,S.usePlan)(w),Y=(0,f.useBookings)(w),U=(0,v.useBlocks)(e=>e.blocks),q=(0,v.closedAreasAt)(U,w,(0,x.ymd)(D),(0,x.hm)(D)),Q=d.default.useMemo(()=>{const e=Object.fromEntries(Object.entries(I).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,k.suggestTable)(_,Y.filter(e=>e.date===(0,x.ymd)(D)),e,$,D,(0,k.turnFor)($,C.settings.turnMins),90,void 0,{closed:q})?.table??null},[_,Y,I,$,q.size,D.getTime()]);(0,r.useEffect)(()=>{R&&(0,S.tablesOf)(R).some(e=>'Closed'===I[e]?.label)&&E(null)},[R,q.size]);const[V,G]=(0,r.useState)(!1),[K,X]=(0,r.useState)(''),J=(e,t=String(e),s=()=>{N(!1),P(e)})=>{const o='9+'===t?O:!O&&$===e;return(0,B.jsx)(c.default,{accessibilityRole:"button",accessibilityLabel:'9+'===t?'Party of 9 or more':`Party of ${e}`,accessibilityState:{selected:o},onPress:s,style:{width:i?58:60,height:i?58:56,borderRadius:14,borderWidth:2,borderColor:j.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:o?j.colours.gold:'transparent'},children:(0,B.jsx)(T.T,{weight:"bold",size:22,colour:o?j.colours.onGold:j.colours.gold,children:t})},t)},Z=(0,B.jsx)(s.PartySizeInput,{value:$,onChange:P,min:9,max:o.MAX_PARTY,label:"Walk-in party size",testID:"walkin-party-size"}),ee=(0,B.jsxs)(b.default,{style:{gap:8,width:i?256:void 0},children:[(0,B.jsx)(T.T,{weight:"semibold",children:"How many people?"}),(0,B.jsxs)(b.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},testID:"walkin-party",children:[A.map(e=>J(e)),J(9,'9+',()=>{N(!0),P(e=>e>=9?e:9)})]}),O?Z:null]}),[te,se]=(0,r.useState)(!1),[oe,le]=(0,r.useState)(null),ae=async(t=R,s=!1)=>{if(!te){if(!s){const e=(0,z.bookingsNearWalkIn)(Y,D,$);if(e.length)return void le({at:t,list:e})}se(!0);try{const s=await f.repo.bookings.seatWalkIn(w,$,t??void 0,K);M(w,t??void 0),a(s),e()}finally{se(!1)}}},ie=async(t,s)=>{if(!te){se(!0);try{const o=s??t.table??null;o&&o!==t.table&&await f.repo.bookings.assignTable(t.id,o),await L(w,{...t,table:o??void 0}),(0,n.notify)({id:`seated:${t.id}`,testID:'walkin-match-toast',timeoutMs:5e3,icon:'\u2713',title:`${t.name} seated \xb7 ${t.partySize} \xb7 ${o?(0,l.tableNumbers)(o):'table to assign'} (booking ${t.ref})`}),le(null),e()}finally{se(!1)}}},ne=(0,B.jsxs)(b.default,{style:{gap:8,flex:i?1:void 0,minWidth:0},children:[(0,B.jsxs)(T.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsxs)(T.T,{weight:"semibold",children:["Table ",(0,B.jsx)(T.T,{colour:j.colours.muted,size:14,children:"(optional)"})]}),R?(0,B.jsx)(T.Button,{small:!0,kind:"ghost",label:"Clear table",onPress:()=>E(null)}):null]}),(0,B.jsx)(W,{use:I,value:R,onPick:e=>{I[e]&&!I[e].busy?ae(e):E(R===e?null:e)},big:i,dense:i,best:Q,bestSet:(0,u.bestTables)(_)}),(0,B.jsxs)(T.Muted,{children:["Tap a free table to seat them there",Q&&!R?` (suggested for ${$}: ${(0,l.tableNumbers)(Q)})`:'',", or Seat for no table yet. BEST marks the venue\u2019s best tables."]})]});return(0,B.jsxs)(T.Sheet,{visible:!0,onClose:e,title:`Walk-in \xb7 ${(0,x.hm)(D)}`,maxWidth:i?1100:void 0,testID:"walkin-sheet",children:[(0,B.jsx)(T.Button,{label:`Seat walk-in \xb7 ${$} ${1===$?'person':'people'}${R?` \xb7 ${(0,l.tableNumbers)(R)}`:''}`,disabled:te,onPress:()=>{ae()},testID:"seat-walkin",style:{minHeight:52}}),i?(0,B.jsxs)(T.Row,{gap:16,style:{alignItems:'flex-start'},children:[ee,ne]}):(0,B.jsxs)(B.Fragment,{children:[ee,ne]}),(0,B.jsxs)(T.Row,{gap:10,wrap:!0,style:{alignItems:'center'},children:[V?(0,B.jsx)(t.TextInput,{accessibilityLabel:"Walk-in note",placeholder:"Note (optional), e.g. high chair",placeholderTextColor:"#7D776C",value:K,onChangeText:X,style:[T.styles.input,{flex:1,minWidth:220}],autoFocus:!0}):(0,B.jsx)(T.Button,{small:!0,kind:"ghost",label:"Add a note (optional)",onPress:()=>G(!0)}),(0,B.jsx)(b.default,{style:{flex:1,minWidth:220},children:(0,B.jsxs)(T.Muted,{children:["No name needed. Counts in today's covers.",'staff'!==h.APP_VARIANT?' Using website bookings too? Mark the table there as well.':'']})})]}),oe?(0,B.jsx)(H,{list:oe.list,busy:te,onYes:e=>{ie(e,oe.at)},onNo:()=>{const e=oe.at;le(null),ae(e,!0)},onClose:()=>le(null)}):null]})}function H({list:e,busy:t,onYes:s,onNo:o,onClose:a}){return(0,B.jsx)(T.Sheet,{visible:!0,onClose:a,title:"Booked party?",maxWidth:720,testID:"walkin-match",children:(0,B.jsxs)(b.default,{style:{gap:14},children:[e.map((e,o)=>(0,B.jsxs)(b.default,{testID:`walkin-match-${o}`,style:{gap:12,padding:16,borderRadius:16,borderWidth:2,borderColor:j.colours.gold,backgroundColor:'#15130F'},children:[(0,B.jsx)(b.default,{accessibilityRole:"header",accessibilityLiveRegion:"polite",children:(0,B.jsx)(T.T,{size:26,weight:"bold",colour:j.colours.goldLight,testID:"walkin-match-question",children:(0,z.walkInMatchQuestion)(e)})}),e.table?(0,B.jsxs)(T.T,{size:17,colour:j.colours.text,children:["Booked table ",(0,l.tableNumbers)(e.table)," \xb7 ",e.ref]}):(0,B.jsx)(T.T,{size:17,colour:j.colours.text,children:e.ref}),(0,B.jsx)(T.Button,{label:"Yes, seat booking",testID:"walkin-match-yes",disabled:t,accessibilityLabel:`Yes, seat ${e.name}'s booking, ${e.partySize} people`,onPress:()=>s(e),style:{minHeight:64}})]},e.id)),(0,B.jsx)(T.Button,{kind:"secondary",label:"No, new walk-in",testID:"walkin-match-no",disabled:t,onPress:o,style:{minHeight:64}})]})})}function _({booking:e,onClose:t,combine:s}){const{rid:o,r:a,now:i}=(0,p.useCtx)(15e3),n=F(o,i),c=(0,S.usePlan)(o),h=(0,f.useBookings)(o),y=(0,S.tablesOf)(e.table),w=d.default.useMemo(()=>Object.fromEntries(Object.entries(n).map(([e,t])=>[e,y.includes(e)?{busy:!1,label:'This party',soon:'This party'}:t])),[n,e.table]),v=d.default.useMemo(()=>{const t=Object.fromEntries(Object.entries(w).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,k.suggestTable)(c,h.filter(e=>e.date===(0,x.ymd)(i)),t,e.partySize,i,(0,k.turnFor)(e.partySize,a.settings.turnMins),90,e.id)?.table??null},[c,h,w,e.partySize,i.getTime()]),[C,D]=(0,r.useState)(!!s||y.length>1),[I,$]=(0,r.useState)(y),P=e=>c.tables.find(t=>t.name===e)?.maxSeats??0,z=I.reduce((e,t)=>e+P(t),0),O=I.length>0&&z{const l=(0,S.joinTables)(s);await f.repo.bookings.assignTable(e.id,l);y.filter(e=>!s.includes(e)).forEach(t=>S.useFloor.getState().setLive(o,t,{stage:void 0,dirty:'seated'===e.status})),'seated'===e.status&&M(o,l),t()},L=C?(0,B.jsxs)(b.default,{style:{gap:8},testID:"assign-table-tip",children:[(0,B.jsx)(b.default,{accessibilityLiveRegion:"polite",children:(0,B.jsx)(T.T,{size:17,weight:"semibold",colour:j.colours.text,children:I.length?`${(0,S.tablesLabel)((0,S.joinTables)(I))} \xb7 ${z} seats for ${e.partySize} Covers`:'No tables picked yet'})}),O?(0,B.jsx)(b.default,{testID:"combine-short",children:(0,B.jsxs)(T.T,{size:15,weight:"semibold",colour:"#FFD9D4",children:["Not enough seats yet: ",e.partySize-z," more needed. Add another table."]})}):null,(0,B.jsx)(T.T,{size:15,colour:j.colours.text,children:"Tap each table to add or remove it, then tap Done. All of them show as taken until the party has finished."}),(0,B.jsxs)(T.Row,{gap:8,wrap:!0,children:[(0,B.jsx)(T.Button,{label:"Done",testID:"combine-done",disabled:!I.length,accessibilityLabel:I.length?`Done, save ${(0,S.tableCardLabel)((0,S.joinTables)(I))}`:'Done',onPress:()=>N(I)}),(0,B.jsx)(T.Button,{kind:"ghost",label:"Cancel",onPress:t})]})]}):(0,B.jsx)(b.default,{style:{gap:8},testID:"assign-table-tip",children:(0,B.jsx)(T.T,{size:15,colour:j.colours.text,children:"Red tables are in use right now; you can still pick one (e.g. joining a table). BEST marks the venue\u2019s best tables. Big party? Tap Combine tables."})});return(0,B.jsxs)(T.Sheet,{visible:!0,onClose:t,title:`${C?'Combine tables':'Assign table'} \xb7 ${R(e)}`,testID:"assign-table-sheet",footer:L,children:[v&&!C?(0,B.jsx)(b.default,{testID:"assign-suggested",children:(0,B.jsxs)(T.T,{size:16,weight:"semibold",colour:j.colours.goldLight,accessibilityLabel:`Suggested for ${e.partySize}: ${(0,S.tableCardLabel)(v)}`,children:["Suggested for ",e.partySize,": ",(0,l.tableNumbers)(v)]})}):null,C?null:(0,B.jsx)(T.Button,{kind:"secondary",label:"Combine tables",testID:"combine-start",accessibilityLabel:"Combine tables: pick several tables for this party",onPress:()=>D(!0)}),(0,B.jsx)(W,{use:w,best:C?null:v,bestSet:(0,u.bestTables)(c),picked:C?I:void 0,onPick:C?e=>$(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]):async e=>{await N([e])}})]})}function Y(e){(0,n.notify)({id:`walkin:${e.id}`,testID:'walkin-toast',timeoutMs:6e3,title:`${R(e)} seated \xb7 ${e.table?`${(0,l.tableNumbers)(e.table)}`:'table to assign'} (${e.ref})`,actions:[{label:'Undo',testID:'undo-walkin',onPress:()=>f.repo.bookings.undoWalkIn(e.id)},{label:'OK',kind:'ghost'}]})}function U({date:e,onClose:t,wide:n,onSaved:d}){const{rid:u,r:c,now:h,role:z,meId:O}=(0,p.useCtx)(6e4),N=(0,x.ymd)(h),[M,L]=(0,r.useState)(ee.blocks),[W,A]=(0,r.useState)(!1),[E,H]=(0,r.useState)(''),[_,Y]=(0,r.useState)(2),[U,q]=(0,r.useState)(null),[Q,V]=(0,r.useState)(''),[G,K]=(0,r.useState)(''),[X,J]=(0,r.useState)(''),[Z,ee]=(0,r.useState)('phone'),[te,se]=(0,r.useState)((0,D.emptyNeeds)()),oe=(0,D.needsMissing)(te),[le,ae]=(0,r.useState)(null),ie=(0,S.usePlan)(u),ne=(0,P.dogSetUp)(ie),re=!0===te.dog&&ne,de=te.dog?te.dogs:0,ue=(0,x.parseYmd)(M),ce=(0,k.turnFor)(_,c.settings.turnMins),be=F.filter(e=>e.date===M),he=e=>(0,k.freeTablesAt)(ie,be,_,new Date(`${M}${(0,l.tableNumbers)(e)}:00`),ce,c.settings.turnMins,{dog:!0,closed:(0,v.closedAreasAt)(R,u,M,e)}),ge=re&&U?he(U):[];(0,r.useEffect)(()=>{ae(null)},[re,U,_]);const pe=(0,y.bookingSlots)(c,ue,e=>F.filter(t=>t.date===M&&t.time===e&&'cancelled'!==t.status&&!t.walkIn).reduce((e,t)=>e+t.partySize,0),_,M===(0,x.ymd)(h)?h:(0,x.addMins)(ue,0),e=>F.filter(t=>t.date===M&&t.time===e&&'cancelled'!==t.status&&!t.walkIn).length),me=(0,w.ukPhone)(G),[fe,ye]=(0,r.useState)(!1),ke=U?pe.find(e=>e.time===U):void 0,xe=ke&&ke.left<_?{left:Math.max(0,ke.left),time:ke.time}:null,je=ke&&null!=ke.partiesLeft&&ke.partiesLeft<1?{time:ke.time,cap:ke.partiesCap??0}:null,we=xe||je,Te=U?(0,v.blockAt)(R,u,M,U):void 0,Se='staff'!==z,ve=!!U&&!(0,D.dogTimeOk)(c,F,M,U,de),Ce=!oe.length&&E.trim().length>=2&&!!U&&(!we||fe)&&(0,o.validParty)(_)&&me.ok&&(0,w.emailOk)(X)&&(!Te||Se&&W)&&(!re||ge.length>0)&&!ve,De=te.wheelchair>0||te.stepFree;return(0,B.jsxs)(T.Sheet,{visible:!0,onClose:t,title:`New booking \xb7 ${(0,x.niceDate)(ue)}`,maxWidth:n?760:void 0,testID:"booking-sheet",children:[(0,B.jsx)(D.FirstQuestions,{rid:u,value:te,onChange:se,party:_,audience:"staff"}),te.dog&&!ne?(0,B.jsx)(T.T,{size:13,colour:j.colours.amber,children:"Dog-friendly tables aren\u2019t marked yet. Managers \u203a Booking options \u203a Tables. Booking is allowed; check where the dog can sit."}):null,(0,B.jsx)(C.BookingDatePicker,{r:c,today:h,value:M,onChange:e=>{e!==M&&(L(e),q(null),A(!1))}}),(0,B.jsxs)(T.Row,{gap:6,children:[(0,B.jsx)(T.Chip,{label:"Phone",selected:'phone'===Z,onPress:()=>ee('phone')}),(0,B.jsx)(T.Chip,{label:"In person",selected:'in-person'===Z,onPress:()=>ee('in-person')})]}),(0,B.jsx)(T.Field,{label:"Name",value:E,onChangeText:H,placeholder:"e.g. Reid",testID:"nb-name"}),(0,B.jsx)(T.Field,{label:"Mobile or phone number (needed)",value:G,onChangeText:K,keyboardType:"phone-pad",placeholder:"e.g. 07700 900123",testID:"nb-phone"}),!me.ok&&G?(0,B.jsx)(T.T,{size:13,colour:j.colours.amber,children:me.error}):null,(0,B.jsx)(T.Field,{label:"Email (optional)",value:X,onChangeText:J,keyboardType:"email-address",autoCapitalize:"none",placeholder:"For an email confirmation too",testID:"nb-email"}),(0,w.emailOk)(X)?null:(0,B.jsx)(T.T,{size:13,colour:j.colours.amber,children:"That email doesn\u2019t look quite right."}),(0,B.jsxs)(b.default,{style:{gap:6,alignItems:'center'},children:[(0,B.jsx)(T.T,{center:!0,children:"Covers"}),(0,B.jsx)(s.PartySizeInput,{value:_,onChange:e=>{Y(e),ye(!1)},label:"Covers",testID:"nb-party"})]}),(0,B.jsx)(T.Row,{wrap:!0,gap:6,children:pe.map(e=>{const t=re&&e.available&&!he(e.time).length||!(0,D.dogTimeOk)(c,F,M,e.time,de);return(0,B.jsx)(T.Chip,{testID:`nb-slot-${e.time}`,label:e.time,sub:(0,v.blockAt)(R,u,M,e.time)?'Paused':t?'Dogs full':e.drinksOnly?'Drinks only':null!=e.partiesLeft&&e.partiesLeft<1||e.left<=0?'Full':`${e.left} left`,disabled:(e.past??!e.available)||t,selected:U===e.time,onPress:()=>{q(e.time),A(!1),ye(!1)}},e.time)})}),we?(0,B.jsxs)(b.default,{testID:"nb-over-capacity",accessible:!0,accessibilityLiveRegion:"polite",style:{borderWidth:1.5,borderColor:j.colours.amber,backgroundColor:j.colours.amberBg,borderRadius:12,padding:10,gap:6},children:[xe?(0,B.jsx)(T.T,{weight:"semibold",colour:j.colours.amber,children:(0,o.overCapacityNote)(_,xe.left,xe.time)}):null,je?(0,B.jsx)(T.T,{weight:"semibold",colour:j.colours.amber,children:(0,o.overPartiesNote)(je.time,je.cap)}):null,(0,B.jsx)(T.Chip,{label:fe?'Booking over the limit: on':'Book anyway (over the limit)',selected:fe,onPress:()=>ye(e=>!e),testID:"nb-over-ok"})]}):null,re&&U?(0,B.jsxs)(b.default,{style:{gap:6},testID:"nb-dog-tables",children:[(0,B.jsxs)(T.T,{size:14,weight:"semibold",children:["Dog-friendly table ",(0,B.jsxs)(T.T,{size:13,colour:j.colours.muted,children:["(",ie.areas.filter(e=>e.dogs).map(e=>e.name).join(' or '),")"]})]}),ge.length?(0,B.jsx)(T.Row,{wrap:!0,gap:6,children:ge.slice(0,10).map((e,t)=>(0,B.jsx)(T.Chip,{label:`${(0,l.tableNumbers)(e.table)}`,sub:`${e.area} \xb7 ${e.seats}${0===t?' \xb7 best':''}${De&&(0,P.accessibleSetUp)(ie)&&!(0,P.isAccessible)(ie,e.table)?' \xb7 not step-free':''}`,selected:(le??ge[0].table)===e.table,onPress:()=>ae(e.table)},e.table))}):(0,B.jsxs)(T.T,{size:14,colour:j.colours.amber,children:["No dog-friendly table free for ",_," at ",U,". Try another time."]})]}):null,Te?(0,B.jsxs)(b.default,{testID:"nb-block-warning",style:{borderWidth:1.5,borderColor:j.colours.amber,backgroundColor:j.colours.amberBg,borderRadius:12,padding:10,gap:6},children:[(0,B.jsxs)(T.T,{weight:"semibold",colour:j.colours.amber,children:["Bookings are paused ",Te.from,"\u2013",Te.to,Te.reason?` (${Te.reason})`:'']}),Se?(0,B.jsx)(T.Chip,{label:W?'Manager override on':'Override and book anyway',selected:W,onPress:()=>A(e=>!e)}):(0,B.jsx)(T.Muted,{children:"Ask a manager to override, or pick another time."})]}):null,pe.length?null:(0,B.jsx)(b.default,{testID:"nb-closed",children:(0,B.jsxs)(T.T,{size:14,weight:"semibold",colour:j.colours.amber,children:["Closed on ",(0,x.niceDate)(ue)," (per the venue\u2019s opening hours). Pick another date."]})}),(0,B.jsx)(D.MoreQuestions,{rid:u,r:c,value:te,onChange:se,party:_,date:M,time:U,today:(0,x.ymd)(h),bookings:F,audience:"staff",showTables:!1!==c.settings.tableRequests}),De&&!(0,P.accessibleSetUp)(ie)?(0,B.jsx)(T.T,{size:13,colour:j.colours.amber,children:"Step-free tables aren\u2019t marked yet (Managers \u203a Booking options \u203a Tables). Check the table works for a wheelchair."}):null,(0,B.jsx)(T.Field,{label:"Notes (optional)",value:Q,onChangeText:V,placeholder:I.NOTES_PLACEHOLDER,multiline:!0,numberOfLines:3,testID:"nb-notes"}),(0,i.depositDue)((0,i.depositOf)(c.settings),_)?(0,B.jsxs)(T.Muted,{children:["Deposit due: ",(0,a.gbp)((0,i.depositDue)((0,i.depositOf)(c.settings),_))," (",(0,a.gbp)((0,i.depositOf)(c.settings).perPersonPence)," per person for ",(0,i.depositOf)(c.settings).fromParty,"+). Deposits are paid through website bookings or to you, never in CoverCharge: tick Deposit paid on the booking once the guest has paid."]}):null,(0,B.jsxs)(T.Muted,{children:["The guest gets a confirmation text",X.trim()?' and email':''," automatically (preview mode: shown in the Outbox, not sent)."]}),ve?(0,B.jsxs)(T.T,{size:14,colour:j.colours.amber,children:["We already have the most dogs we can look after at ",U,". Try another time: dogs are very welcome then."]}):null,(0,B.jsx)(T.Button,{label:oe.length?oe[0]:'Save booking',testID:"nb-save",disabled:!Ce,onPress:()=>{if(M<(0,x.ymd)(h))return;const e=(0,D.needsPatch)(te),s=te.tableReq.find(e=>!re||ge.some(t=>t.table===e));f.repo.bookings.create({restaurantId:u,customerId:null,name:E.trim(),partySize:_,date:M,time:U,notes:Q.trim(),security:(0,i.depositDue)((0,i.depositOf)(c.settings),_)?'deposit':'none',depositPaid:0,...(0,i.depositDue)((0,i.depositOf)(c.settings),_)?{depositDue:(0,i.depositDue)((0,i.depositOf)(c.settings),_),depositPolicy:(0,i.depositWords)((0,i.depositOf)(c.settings),_,c.name).join(' '),depositRefundable:(0,i.depositOf)(c.settings).refundable,depositCutoffHours:(0,i.depositOf)(c.settings).cutoffHours}:{},phone:me.pretty,email:X.trim()||void 0,source:Z,...e,...pe.find(e=>e.time===U)?.drinksOnly?{drinksOnly:!0}:{},allergies:e.allergies??[],...re?{table:le??s??ge[0]?.table}:{}}).then(e=>(0,$.postNewBookingToKitchen)(e,O)).catch(()=>{}),d?.({date:M,time:U,name:E.trim()}),t()}})]})}},1120,[827,1121,1122,860,867,14,1123,34,859,402,102,872,1084,874,1124,1101,858,821,864,794,1025,1022,1125,1126,1131,1103,1097,1132,25]); @@ -1245,7 +1245,7 @@ __d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule' __d(function(g,_r,i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.gamesOn=function(){const e=b.useStore.getState().restaurants.find(e=>e.id===p.VENUE_RID);return!1!==e?.settings?.games},_e.useGameClock=I,_e.usePlayable=function(e,t){return(0,y.gamePlayable)(I(e,t))},Object.defineProperty(_e,"LENNY_GAME_URL",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"validGameUrl",{enumerable:!0,get:function(){return C}}),_e.gameBase=function(){const e=b.useStore.getState().restaurants.find(e=>e.id===p.VENUE_RID);return C(e?.settings?.gameUrl)??v},_e.BreakRoomCard=function({staffId:e,name:t,now:s}){const n=(0,b.useStore)(e=>!1!==e.restaurants.find(e=>e.id===p.VENUE_RID)?.settings?.games),[o,l]=(0,r.useState)(!1),c=I(e,s),u=(0,y.gamePlayable)(c);return n?(0,w.jsxs)(d.Card,{children:[(0,w.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(d.T,{weight:"semibold",children:"\ud83e\uded6 Break room"}),(0,w.jsx)(d.T,{size:13,colour:u?x.colours.ok:x.colours.muted,children:u?'Open':'Locked'})]}),(0,w.jsx)(d.Muted,{children:"Lenny\u2019s Kitchen Chaos, with the team as characters and a shared leaderboard. Playable on a break or when you\u2019re not clocked in."}),u?null:(0,w.jsx)(d.Muted,{testID:"break-room-locked-text",children:y.GAME_LOCKED_TEXT}),(0,w.jsx)(d.Button,{testID:"break-room-open",kind:"secondary",label:"Open the Break room",onPress:()=>l(!0)}),o?(0,w.jsx)(R,{staffId:e,name:t,playable:u,clock:c,onClose:()=>l(!1)}):null]}):null},Object.defineProperty(_e,"displayName",{enumerable:!0,get:function(){return T}}),_e.BreakRoom=R;var t=_r(_d[0]),s=_r(_d[1]),r=_r(_d[2]),n=e(r),o=e(_r(_d[3]));_r(_d[4]);var l=e(_r(_d[5])),c=e(_r(_d[6])),u=_r(_d[7]),d=_r(_d[8]),f=_r(_d[9]),m=_r(_d[10]),y=_r(_d[11]),h=_r(_d[12]),b=_r(_d[13]),p=_r(_d[14]),k=_r(_d[15]),j=_r(_d[16]),x=_r(_d[17]),w=_r(_d[18]);function I(e,t){const s=(0,m.useOwner)(e=>e.attendance);return(0,y.gameClock)(s,e,t)}const v='https://lennys-kitchen-chaos-13e285.deed.page/',C=e=>{try{const t=new URL(String(e??'').trim());return'https:'!==t.protocol||t.username||t.password?null:t.toString()}catch{return null}};function S(e){if('undefined'==typeof window)return null;const t=new URL(e);for(const e of['demo','unlock','name','staffId'])t.searchParams.delete(e);return t.searchParams.set('host','covercharge'),t.searchParams.set('hostOrigin',window.location.origin),{src:t.toString(),origin:t.origin}}const T=e=>String(e??'').replace(/\s*\(.*\)$/,'').replace(/\s+/g,' ').trim().slice(0,24).trim();function R({staffId:e,name:I,playable:R,clock:P,onClose:L,car:M}){const D=(0,m.useOwner)(e=>e.staff),O=(0,f.useAvatars)(e=>e.photos),_=(0,h.useSetup)(e=>e.looks),z=(0,r.useRef)(null),[N,U]=(0,r.useState)({}),[A,B]=(0,r.useState)(!1),[G,q]=(0,r.useState)(null),H=(0,b.useStore)(e=>C(e.restaurants.find(e=>e.id===p.VENUE_RID)?.settings?.gameUrl)??v),V=(0,r.useMemo)(()=>S(H),[H]),W=V?.origin??'',$=(0,j.useSync)(e=>'staff'===e.kind?e.staffRef??null:null),K=!(!$||!e||$===e),X=K?null:$??e??null,Y=T(I),[F,J]=(0,r.useState)(''),[Q,Z]=(0,r.useState)(null),ee=(0,r.useRef)(null),te=(0,r.useRef)(0),se=(0,r.useRef)(null),re=(0,r.useRef)(R);re.current=R;const ne=(0,r.useMemo)(()=>D.filter(e=>e.active&&!e.name.includes('(example)')),[D]);(0,r.useEffect)(()=>{const e=setTimeout(()=>{const e={};for(const s of ne){const r=null!=_[s.id]&&_[s.id]>=1e3?t.AVATAR_OPTIONS.find(e=>e.look===_[s.id]):void 0;if(r){e[s.id]=r.dataUrl;continue}const n=document.getElementById(`cc-av-${s.id}`)?.querySelector('svg');n&&(e[s.id]=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(n.outerHTML.includes('xmlns')?n.outerHTML:n.outerHTML.replace('clearTimeout(e)},[ne,_]);const oe=(0,r.useMemo)(()=>ne.map(e=>{const t=O[e.id]?.dataUrl??N[e.id],s={id:e.id,name:T(e.name),role:e.job||e.level||e.role};return t&&(s.avatarUrl=t),s}),[ne,O,N]),le=(0,r.useCallback)(e=>{try{W&&z.current?.contentWindow?.postMessage(e,W)}catch{}},[W]);return(0,r.useEffect)(()=>{const e=async e=>{if(!W||e.origin!==W||e.source!==z.current?.contentWindow)return;const t=e.data;if('string'!=typeof t?.type||!t.type.startsWith('lenny:'))return;if('lenny:ready'===t.type)return q('string'==typeof t.version?String(t.version).slice(0,12):null),void B(!0);const s=String(t.levelId??'').slice(0,40);if('lenny:scores:list'===t.type&&le({type:'lenny:scores:result',reqId:t.reqId,result:await(0,k.listScores)(s,Math.min(50,Number(t.limit)||10))}),'lenny:scores:submit'===t.type){const e=t.entry??{};if(!X||'string'==typeof e.staffId&&e.staffId!==X)return void le({type:'lenny:scores:result',reqId:t.reqId,result:{rank:null,entries:await(0,k.listScores)(s,10),id:null}});const r='string'==typeof e.characterId?e.characterId.slice(0,80):void 0;le({type:'lenny:scores:result',reqId:t.reqId,result:await(0,k.submitScore)(s,{score:Number(e.score)||0,stars:Number(e.stars)||0,badges:Array.isArray(e.badges)?e.badges.map(String).slice(0,30):[],stats:'object'==typeof e.stats&&e.stats?e.stats:{},characterId:r,character:'string'==typeof e.character?e.character.slice(0,60):void 0,staffId:X,name:Y})})}'lenny:roundAbandoned'===t.type&&J('The last round was stopped because the player changed. No score was saved.'),'lenny:roundStart'===t.type&&J(''),'lenny:progress'===t.type&&X&&t.staffId===X&&(0,k.saveProgress)(X,t.progress),'lenny:gameComplete'===t.type&&X&&t.staffId===X&&J(!0===t.firstTime?'Game complete! Character select is now unlocked.':'Game complete again. Nice work!')};return window.addEventListener('message',e),()=>window.removeEventListener('message',e)},[le,X,Y,W]),(0,r.useEffect)(()=>{B(!1),ee.current=null,se.current=null},[V?.src]),(0,r.useEffect)(()=>{if(!A)return;const e=e=>{se.current!==e&&(se.current=e,le({type:'lenny:setPlayable',playable:e}))},t=K?null:`${X??''}|${Y}`;if(t&&ee.current===t)return void e(R);const s=++te.current;ee.current=null,se.current&&e(!1),t&&(0,k.loadProgress)(X).catch(()=>null).then(r=>{s===te.current&&(le({type:'lenny:setPlayer',name:Y,staffId:X,...r?{progress:r}:{}}),ee.current=t,e(re.current))})},[A,K,X,Y,R,le]),(0,r.useEffect)(()=>{A&&le({type:'lenny:setRoster',staff:oe})},[A,oe,le]),(0,r.useEffect)(()=>{A&&null!==Q&&le({type:'lenny:setMuted',muted:Q})},[A,Q,le]),(0,w.jsx)(o.default,{visible:!0,animationType:"slide",onRequestClose:L,children:(0,w.jsxs)(c.default,{testID:"break-room",style:{flex:1,backgroundColor:(0,s.soutersSurface)('#000')},children:[M?(0,w.jsx)(E,{status:K?'Switching player\u2026':R?'Parked only \xb7 enjoy!':'Game locked',muted:!!Q,onPause:()=>le({type:'lenny:pause'}),onMute:()=>Z(!Q),onClose:L}):(0,w.jsxs)(d.Row,{style:{justifyContent:'space-between',padding:10,backgroundColor:x.colours.bg},children:[(0,w.jsx)(d.T,{weight:"semibold",children:"\ud83e\uded6 Break room"}),(0,w.jsx)(c.default,{testID:R&&!K?'break-playable':'break-locked',accessibilityLabel:G?`Game version ${G}`:void 0,children:(0,w.jsx)(d.T,{size:13,colour:R?x.colours.ok:x.colours.gold,children:K?'Switching player\u2026':R?'off'===P?'Off shift: enjoy!':'On your break: enjoy!':'Game locked'})}),(0,w.jsxs)(d.Row,{gap:4,children:[(0,w.jsx)(l.default,{testID:"break-room-mute",accessibilityRole:"button",accessibilityLabel:Q?'Turn sound and voice on':'Mute sound and voice',onPress:()=>Z(!Q),style:{padding:6},children:(0,w.jsx)(d.T,{weight:"semibold",colour:x.colours.gold,children:Q?'Sound on':'Mute'})}),(0,w.jsx)(l.default,{testID:"break-room-close",accessibilityRole:"button",onPress:L,style:{padding:6},children:(0,w.jsx)(d.T,{weight:"semibold",colour:x.colours.gold,children:"Close"})})]})]}),R||K?null:(0,w.jsx)(c.default,{testID:"break-locked-text",style:{paddingHorizontal:10,paddingVertical:6,backgroundColor:x.colours.surface},children:(0,w.jsx)(d.T,{size:13,colour:x.colours.text,children:y.GAME_LOCKED_TEXT})}),F?(0,w.jsx)(c.default,{testID:"break-notice",style:{paddingHorizontal:10,paddingVertical:6,backgroundColor:x.colours.surface},children:(0,w.jsx)(d.T,{size:13,colour:x.colours.muted,children:F})}):null,V?n.default.createElement('iframe',{ref:z,src:V.src,key:V.src,title:'Lenny\u2019s Kitchen Chaos','data-testid':'break-game',allow:'autoplay; fullscreen',style:{flex:1,width:'100%',height:'100%',border:0,background:'#000'}}):(0,w.jsx)(c.default,{style:{flex:1,alignItems:'center',justifyContent:'center'},children:(0,w.jsx)(d.Muted,{children:"The Break room opens in the web app."})}),(0,w.jsx)(c.default,{style:{position:'absolute',left:-9999,top:0,width:64,height:64,opacity:0},pointerEvents:"none",children:ne.map(e=>(0,w.jsx)(c.default,{nativeID:`cc-av-${e.id}`,children:(0,w.jsx)(u.AvatarLook,{look:_[e.id],id:e.id,name:e.name,size:96})},e.id))})]})})}function E({status:e,muted:t,onPause:s,onMute:r,onClose:n}){const o={minHeight:72,minWidth:150,paddingHorizontal:22,borderRadius:18,borderWidth:1.5,borderColor:x.colours.gold,alignItems:'center',justifyContent:'center'};return(0,w.jsxs)(c.default,{testID:"car-game-bar",style:{flexDirection:'row',alignItems:'center',gap:14,paddingHorizontal:16,paddingVertical:10,backgroundColor:x.colours.bg,borderBottomWidth:1,borderColor:x.colours.border},children:[(0,w.jsx)(l.default,{testID:"break-room-close",accessibilityRole:"button",accessibilityLabel:"Close the game",onPress:n,style:o,children:(0,w.jsx)(d.T,{size:20,weight:"semibold",colour:x.colours.gold,children:"Close"})}),(0,w.jsx)(l.default,{testID:"car-game-pause",accessibilityRole:"button",accessibilityLabel:"Pause the game",onPress:s,style:o,children:(0,w.jsx)(d.T,{size:20,weight:"semibold",colour:x.colours.gold,children:"Pause"})}),(0,w.jsxs)(c.default,{style:{flex:1,alignItems:'center',minWidth:0},children:[(0,w.jsx)(d.T,{size:22,weight:"semibold",center:!0,numberOfLines:1,children:"Lenny\u2019s Kitchen Chaos"}),(0,w.jsx)(d.T,{size:15,colour:x.colours.goldLight,center:!0,numberOfLines:1,children:`${e} \xb7 touch the big buttons on the game`})]}),(0,w.jsx)(l.default,{testID:"break-room-mute",accessibilityRole:"button",accessibilityLabel:t?'Turn sound and voice on':'Mute sound and voice',onPress:r,style:o,children:(0,w.jsx)(d.T,{size:20,weight:"semibold",colour:x.colours.gold,children:t?'Sound on':'Mute'})}),(0,w.jsx)(c.default,{testID:"car-game-parked",style:{...o,minWidth:0,borderColor:x.colours.goldMuted,backgroundColor:'rgba(201,162,74,0.12)'},children:(0,w.jsx)(d.T,{size:16,weight:"semibold",colour:x.colours.goldLight,children:"PARKED ONLY"})})]})}},1162,[928,828,34,395,236,402,102,925,794,926,891,1163,927,831,5,1164,987,821,25]); __d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"GAME_LOCKED_TEXT",{enumerable:!0,get:function(){return t}}),e.gameClock=function(t,n,o){if(!n)return'off';const a=new Date(o).getTime(),c=t.filter(t=>t.staffId===n&&t.in&&!t.out&&a-new Date(t.in).getTime()<72e6).sort((t,n)=>String(n.in).localeCompare(String(t.in)))[0];return c?c.breaks?.some(t=>!t.end)?'break':'working':'off'},Object.defineProperty(e,"gamePlayable",{enumerable:!0,get:function(){return n}});const t='You\u2019re clocked in, so the game is locked. Start your break or clock out in CoverCharge to play.';const n=t=>'working'!==t},1163,[]); __d(function(g,_r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.listScores=o,_e.submitScore=async function(e,t){const f=r.useSync.getState(),l=Math.max(0,Math.round(Number(t.score)||0));if(c()&&f.staffRef&&t.staffId===f.staffRef)try{const{data:r,error:s}=await a().from('game_scores').insert({venue_id:f.venueId,game:'lenny',level_id:e,staff_ref:f.staffRef??null,name:String(t.name||'Crew').replace(/\s+/g,' ').trim().slice(0,24),character_id:t.characterId??null,score:l,stars:Math.max(0,Math.min(3,Number(t.stars)||0)),stats:{...t.stats??{},badges:t.badges??[],character:t.character??null}}).select('id').single();if(s)throw s;const{count:n}=await a().from('game_scores').select('id',{count:'exact',head:!0}).eq('venue_id',f.venueId).eq('game','lenny').eq('level_id',e).gt('score',l);return{rank:(n??0)+1,entries:await o(e,10),id:r.id}}catch{}const u=await s.kv.get(n,{}),y=[...u[e]??[],{...t,score:l,date:(new Date).toISOString()}].sort((e,t)=>t.score-e.score).slice(0,50);return await s.kv.set(n,{...u,[e]:y}),{rank:y.findIndex(e=>e.score===l)+1,entries:y.slice(0,10),id:null}},_e.loadProgress=async function(e){if(!e)return null;const t=r.useSync.getState();if(l(e))try{const{data:r,error:s}=await a().from('game_progress').select('progress').eq('venue_id',t.venueId).eq('game','lenny').eq('staff_ref',e).maybeSingle();if(s)throw s;if(r)return v(r.progress)}catch{}return v((await s.kv.get(f,{}))[e])},Object.defineProperty(_e,"LENNY_LAST_WORLD",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"LENNY_LEVELS",{enumerable:!0,get:function(){return y}}),_e.cleanProgress=v,_e.saveProgress=async function(e,t){const n=v(t);if(!e||!n||JSON.stringify(n).length>16e3)return;const c=await s.kv.get(f,{});await s.kv.set(f,{...c,[e]:n});const o=r.useSync.getState();if(l(e))try{await a().from('game_progress').upsert({venue_id:o.venueId,game:'lenny',staff_ref:e,progress:n,updated_at:(new Date).toISOString()},{onConflict:'venue_id,game,staff_ref'})}catch{}};var e=_r(d[0]),t=_r(d[1]),r=_r(d[2]),s=_r(d[3]);const a=()=>(0,e.getSupabase)(),n='lenny:scores:v1',c=()=>(0,t.isSupabaseConfigured)()&&!!r.useSync.getState().venueId&&'staff'===r.useSync.getState().kind;async function o(e,t=10){if(c())try{const{data:s,error:n}=await a().from('game_scores').select('*').eq('venue_id',r.useSync.getState().venueId).eq('game','lenny').eq('level_id',e).order('score',{ascending:!1}).limit(t);if(n)throw n;return(s??[]).map(e=>({name:e.name,staffId:e.staff_ref,characterId:e.character_id??void 0,character:e.stats?.character,score:e.score,stars:e.stars,badges:e.stats?.badges??[],stats:e.stats,date:e.created_at}))}catch{}return((await s.kv.get(n,{}))[e]??[]).sort((e,t)=>t.score-e.score).slice(0,t)}const f='lenny:progress:v1',l=e=>{const t=r.useSync.getState();return c()&&!!t.staffRef&&e===t.staffRef};const u='festival',y=['mop','dsoap','dish','dtower','dscrub','mussels','ppeel','pfifo','bin1','bin2','bin3','mothersday','bin4','creel1','creel2','dsundae','dplate','pass','rush','delivery','death','line','steak','festival'];function v(e){if(!e||'object'!=typeof e||Array.isArray(e))return null;const t=e,r=e=>('string'==typeof e||'number'==typeof e)&&String(e).length>0&&String(e).length<=60?String(e):null,s={};if(t.stars&&'object'==typeof t.stars&&!Array.isArray(t.stars))for(const[e,a]of Object.entries(t.stars).slice(0,300)){const t=r(e),n=Math.max(0,Math.min(3,Math.floor(Number(a)||0)));t&&(s[t]=n)}const a={},n=t.badges;if(Array.isArray(n))for(const e of n.slice(0,100)){const t=r(e);t&&(a[t]=!0)}else if(n&&'object'==typeof n)for(const[e,t]of Object.entries(n).slice(0,100)){const s=r(e);s&&t&&(a[s]=!0)}const c={stars:s,badges:a,charactersUnlocked:!0===t.charactersUnlocked};return'number'==typeof t.v&&Number.isInteger(t.v)&&t.v>=0&&t.v<=9999&&(c.v=t.v),Array.isArray(t.legacyWorlds)&&t.legacyWorlds.length<=50&&t.legacyWorlds.every(e=>null!==r(e)&&'string'==typeof e)&&(c.legacyWorlds=[...t.legacyWorlds]),c}},1164,[933,976,987,977]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.KitchenRotaEditor=function({today:e=(0,o.ymd)(new Date)}){const $=(0,a.useOwner)(e=>e.staff),j=(0,a.useOwner)(e=>e.shifts),p=(0,t.useMemo)(()=>(0,l.kitchenTeam)($),[$]),k=(0,t.useMemo)(()=>new Set(p.map(e=>e.id)),[p]),[S,I]=(0,t.useState)(0),[w,D]=(0,t.useState)(null),[v,T]=(0,t.useState)(''),H=(0,a.addDays)((0,a.mondayOfDate)(e),7*S),C=(0,a.addDays)(H,6),P=u.map((e,t)=>(0,a.addDays)(H,t)),L=(0,l.kitchenPending)(j,k,H,C).length,M=e=>{T(e),(0,d.announce)(e)},R=0===S?'This week':1===S?'Next week':-1===S?'Last week':`Week of ${b(H)}`;return(0,h.jsxs)(i.default,{testID:"kitchen-rota-editor",style:{gap:10,alignItems:'center'},children:[(0,h.jsx)(n.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Kitchen rota"}),(0,h.jsxs)(n.Row,{gap:8,style:{justifyContent:'center',alignItems:'center'},children:[(0,h.jsx)(n.Button,{small:!0,kind:"ghost",testID:"krota-prev",label:"\u2039 Prev",accessibilityLabel:"Previous week",onPress:()=>{I(S-1),T('')},style:{minWidth:84,minHeight:48}}),(0,h.jsxs)(i.default,{accessible:!0,accessibilityLabel:`${R}, ${f[0]} ${b(H)} to ${f[6]} ${b(C)}`,style:{alignItems:'center',minWidth:120},children:[(0,h.jsx)(n.T,{weight:"semibold",center:!0,children:R}),(0,h.jsxs)(n.Muted,{center:!0,children:[m(H)," \u2013 ",m(C)]})]}),(0,h.jsx)(n.Button,{small:!0,kind:"ghost",testID:"krota-next",label:"Next \u203a",accessibilityLabel:"Next week",onPress:()=>{I(S+1),T('')},style:{minWidth:84,minHeight:48}})]}),p.map(t=>(0,h.jsxs)(i.default,{testID:"krota-row",style:{gap:4,alignItems:'center',alignSelf:'stretch'},children:[(0,h.jsxs)(n.T,{size:14,weight:"semibold",center:!0,children:[y(t.nickname||t.name),t.job?(0,h.jsx)(n.T,{size:12,colour:c.colours.muted,children:` ${t.job}`}):null]}),(0,h.jsx)(n.Row,{gap:4,style:{justifyContent:'center',flexWrap:'nowrap'},children:P.map((i,a)=>{const l=j.find(e=>e.staffId===t.id&&e.date===i),o=!(!l||l.published&&!l.changed),d=`${y(t.nickname||t.name)}, ${f[a]} ${b(i)}, ${l?`${(0,r.fmtH)(l.start)} to ${(0,r.fmtH)(l.end)}${o?', draft, not published yet':''}. Change shift`:'off. Add a shift'}`;return(0,h.jsxs)(s.default,{testID:`krota-cell-${t.id}-${a}`,accessibilityRole:"button",accessibilityLabel:d,onPress:()=>D({staffId:t.id,date:i,shift:l}),style:({pressed:e})=>({width:44,minHeight:52,borderRadius:8,paddingVertical:4,alignItems:'center',justifyContent:'center',borderWidth:1,borderStyle:o?'dashed':'solid',borderColor:l?o?c.colours.amber:c.colours.gold:c.colours.border,backgroundColor:e||l?c.colours.goldTint:c.colours.surface2}),children:[(0,h.jsx)(n.T,{size:10,center:!0,colour:i===e?c.colours.gold:c.colours.muted,children:u[a]}),(0,h.jsx)(n.T,{size:10,center:!0,children:l?`${(0,r.fmtH)(l.start).slice(0,5)}`:'off'}),l?(0,h.jsx)(n.T,{size:10,center:!0,children:(0,r.fmtH)(l.end).slice(0,5)}):(0,h.jsx)(n.T,{size:10,center:!0,colour:c.colours.muted,children:"+"})]},i)})})]},t.id)),p.length?null:(0,h.jsx)(n.Muted,{center:!0,children:"No kitchen team on the staff list yet."}),(0,h.jsx)(n.Button,{testID:"krota-publish",kind:L?'primary':'secondary',disabled:!L,label:L?`Publish kitchen rota (${L} ${1===L?'change':'changes'})`:'Kitchen rota published',accessibilityLabel:L?`Publish the kitchen rota for ${R.toLowerCase()}, ${L} ${1===L?'change':'changes'}`:'Kitchen rota published for this week',onPress:()=>{const e=(0,l.publishKitchen)(a.useOwner.getState().shifts,k,H,C);a.useOwner.getState().setShifts(e.shifts),M(e.n?`Published ${e.n} kitchen ${1===e.n?'shift':'shifts'}. The kitchen team see them in their app now.`:'Nothing new to publish this week.')},style:{minHeight:56,alignSelf:'stretch'}}),v?(0,h.jsx)(i.default,{testID:"krota-msg",children:(0,h.jsx)(n.T,{center:!0,colour:c.colours.goldLight,children:v})}):null,(0,h.jsx)(n.Muted,{center:!0,children:"Tap a day to add or change a shift. Dashed amber = draft, only you see it until you publish. Front of house shifts are made in CoverCharge for Managers."}),w?(0,h.jsx)(x,{init:w,onClose:()=>D(null),onSaid:M}):null]})};var t=_r(_d[0]),s=e(_r(_d[1])),i=e(_r(_d[2])),n=_r(_d[3]),a=_r(_d[4]),l=_r(_d[5]),r=_r(_d[6]),o=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]);const u=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],f=['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'],m=e=>`${e.slice(8,10)}/${e.slice(5,7)}`,b=e=>`${e.slice(8,10)}/${e.slice(5,7)}/${e.slice(0,4)}`,y=e=>e.replace(/\s*\(.*\)$/,''),$=[['Lunch',11,16],['Dinner',16.5,22.5],['Double',11,21],['Close',17,23.5]];function x({init:e,onClose:s,onSaid:d}){const u=(0,a.useOwner)(t=>t.staff.find(t=>t.id===e.staffId)),f=y(u?.nickname||u?.name||''),[m,x]=(0,t.useState)(e.shift?.start??11),[j,p]=(0,t.useState)(e.shift?.end??21),[k,S]=(0,t.useState)(!1),[I,w]=(0,t.useState)(''),D=`${(0,o.niceDate)((0,o.parseYmd)(e.date))} (${b(e.date)})`;return(0,h.jsx)(n.Sheet,{visible:!0,onClose:s,title:`${f} \xb7 ${D}`,testID:"krota-sheet",children:(0,h.jsxs)(i.default,{style:{gap:10,alignItems:'center'},children:[(0,h.jsx)(n.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:$.map(([e,t,s])=>(0,h.jsx)(n.Chip,{testID:`krota-preset-${e.toLowerCase()}`,label:`${e} ${(0,r.fmtH)(t)}\u2013${(0,r.fmtH)(s)}`,selected:m===t&&j===s,onPress:()=>{x(t),p(s)}},e))}),(0,h.jsx)(n.T,{center:!0,children:"Start"}),(0,h.jsx)(n.Stepper,{testID:"krota-start",value:m,step:.5,min:r.SHIFT_MIN_START,max:j-1,onChange:x,format:r.fmtH,label:"Start time"}),(0,h.jsxs)(n.T,{center:!0,children:["End",j>=24?' (next day)':'']}),(0,h.jsx)(n.Stepper,{testID:"krota-end",value:j,step:.5,min:m+1,max:r.SHIFT_MAX_END,onChange:p,format:r.fmtH,label:"End time"}),(0,h.jsxs)(n.Muted,{center:!0,children:[(j-m).toFixed(1)," hours"]}),I?(0,h.jsx)(i.default,{accessibilityLiveRegion:"assertive",children:(0,h.jsx)(n.T,{center:!0,colour:c.colours.amber,children:I})}):null,(0,h.jsx)(n.Button,{testID:"krota-save",label:e.shift?'Save shift':'Add shift',accessibilityLabel:`${e.shift?'Save':'Add'} ${f}'s shift, ${D}, ${(0,r.fmtH)(m)} to ${(0,r.fmtH)(j)}`,onPress:()=>{const t=a.useOwner.getState();(0,l.clashes)(t.shifts,e.staffId,e.date,m,j,e.shift?.id)?w(`${f} already has a shift that overlaps on ${D}.`):(e.shift?t.setShifts(t.shifts.map(t=>t.id===e.shift.id?{...t,start:m,end:j,changed:!!t.published||t.changed}:t)):t.addShift({staffId:e.staffId,date:e.date,start:m,end:j}),d(`${e.shift?'Changed':'Added'}: ${f}, ${D}, ${(0,r.fmtH)(m)} to ${(0,r.fmtH)(j)}. Draft until you publish the kitchen rota.`),s())},style:{minHeight:56,alignSelf:'stretch'}}),e.shift&&!k?(0,h.jsx)(n.Button,{testID:"krota-remove",kind:"danger",label:"Remove shift",onPress:()=>S(!0),style:{minHeight:52,alignSelf:'stretch'}}):null,e.shift&&k?(0,h.jsxs)(i.default,{testID:"krota-remove-ask",accessibilityLiveRegion:"assertive",style:{gap:8,alignItems:'center',alignSelf:'stretch'},children:[(0,h.jsxs)(n.T,{center:!0,weight:"semibold",children:["Remove ",f,"\u2019s shift on ",D,"?"]}),(0,h.jsx)(n.Button,{testID:"krota-remove-yes",kind:"danger",label:"Yes, remove it",onPress:()=>{a.useOwner.getState().removeShift(e.shift.id),d(`Removed ${f}'s shift on ${D}.`),s()},style:{minHeight:52,alignSelf:'stretch'}}),(0,h.jsx)(n.Button,{testID:"krota-remove-no",kind:"secondary",label:"No, keep it",onPress:()=>S(!1),style:{minHeight:52,alignSelf:'stretch'}})]}):null]})})}},1165,[34,402,102,794,891,988,1087,858,1166,821,25]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.KitchenRotaEditor=p,_e.KitchenRotaTab=function({today:e=(0,h.ymd)(new Date)}){const t=(0,r.canEditKitchenRota)((0,d.useSync)(e=>e.perms));return(0,m.jsx)(i.default,{testID:"chef-rota-tab",style:{alignSelf:'stretch',alignItems:'center'},children:t?(0,m.jsx)(p,{today:e}):(0,m.jsx)(w,{today:e})})},_e.KitchenRotaRead=w;var t=_r(_d[0]),s=e(_r(_d[1])),i=e(_r(_d[2])),n=_r(_d[3]),a=_r(_d[4]),r=_r(_d[5]),l=_r(_d[6]),o=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]),u=_r(_d[11]),f=_r(_d[12]),m=_r(_d[13]);const y=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],b=['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'],x=e=>`${e.slice(8,10)}/${e.slice(5,7)}`,j=e=>`${e.slice(8,10)}/${e.slice(5,7)}/${e.slice(0,4)}`,$=e=>e.replace(/\s*\(.*\)$/,''),k=[['Lunch',11,16],['Dinner',16.5,22.5],['Double',11,21],['Close',17,23.5]];function p({today:e=(0,h.ymd)(new Date)}){const l=(0,a.useOwner)(e=>e.staff),o=(0,a.useOwner)(e=>e.shifts),d=(0,t.useMemo)(()=>(0,r.kitchenTeam)(l),[l]),k=(0,t.useMemo)(()=>new Set(d.map(e=>e.id)),[d]),[p,w]=(0,t.useState)(0),[I,D]=(0,t.useState)(null),[T,v]=(0,t.useState)(''),H=(0,a.addDays)((0,a.mondayOfDate)(e),7*p),C=(0,a.addDays)(H,6),L=y.map((e,t)=>(0,a.addDays)(H,t)),P=(0,r.kitchenPending)(o,k,H,C).length,R=e=>{v(e),(0,u.announce)(e)},M=0===p?'This week':1===p?'Next week':-1===p?'Last week':`Week of ${j(H)}`;return(0,m.jsxs)(i.default,{testID:"kitchen-rota-editor",style:{gap:10,alignItems:'center'},children:[(0,m.jsx)(n.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Kitchen rota"}),(0,m.jsxs)(n.Row,{gap:8,style:{justifyContent:'center',alignItems:'center'},children:[(0,m.jsx)(n.Button,{small:!0,kind:"ghost",testID:"krota-prev",label:"\u2039 Prev",accessibilityLabel:"Previous week",onPress:()=>{w(p-1),v('')},style:{minWidth:84,minHeight:48}}),(0,m.jsxs)(i.default,{accessible:!0,accessibilityLabel:`${M}, ${b[0]} ${j(H)} to ${b[6]} ${j(C)}`,style:{alignItems:'center',minWidth:120},children:[(0,m.jsx)(n.T,{weight:"semibold",center:!0,children:M}),(0,m.jsxs)(n.Muted,{center:!0,children:[x(H)," \u2013 ",x(C)]})]}),(0,m.jsx)(n.Button,{small:!0,kind:"ghost",testID:"krota-next",label:"Next \u203a",accessibilityLabel:"Next week",onPress:()=>{w(p+1),v('')},style:{minWidth:84,minHeight:48}})]}),d.map(t=>(0,m.jsxs)(i.default,{testID:"krota-row",style:{gap:4,alignItems:'center',alignSelf:'stretch'},children:[(0,m.jsxs)(n.T,{size:14,weight:"semibold",center:!0,children:[$(t.nickname||t.name),t.job?(0,m.jsx)(n.T,{size:12,colour:f.colours.muted,children:` ${t.job}`}):null]}),(0,m.jsx)(n.Row,{gap:4,style:{justifyContent:'center',flexWrap:'nowrap'},children:L.map((i,a)=>{const r=o.find(e=>e.staffId===t.id&&e.date===i),l=!(!r||r.published&&!r.changed),d=`${$(t.nickname||t.name)}, ${b[a]} ${j(i)}, ${r?`${(0,c.fmtH)(r.start)} to ${(0,c.fmtH)(r.end)}${l?', draft, not published yet':''}. Change shift`:'off. Add a shift'}`;return(0,m.jsxs)(s.default,{testID:`krota-cell-${t.id}-${a}`,accessibilityRole:"button",accessibilityLabel:d,onPress:()=>D({staffId:t.id,date:i,shift:r}),style:({pressed:e})=>({width:44,minHeight:52,borderRadius:8,paddingVertical:4,alignItems:'center',justifyContent:'center',borderWidth:1,borderStyle:l?'dashed':'solid',borderColor:r?l?f.colours.amber:f.colours.gold:f.colours.border,backgroundColor:e||r?f.colours.goldTint:f.colours.surface2}),children:[(0,m.jsx)(n.T,{size:10,center:!0,colour:i===e?f.colours.gold:f.colours.muted,children:y[a]}),(0,m.jsx)(n.T,{size:10,center:!0,children:r?`${(0,c.fmtH)(r.start).slice(0,5)}`:'off'}),r?(0,m.jsx)(n.T,{size:10,center:!0,children:(0,c.fmtH)(r.end).slice(0,5)}):(0,m.jsx)(n.T,{size:10,center:!0,colour:f.colours.muted,children:"+"})]},i)})})]},t.id)),d.length?null:(0,m.jsx)(n.Muted,{center:!0,children:"No kitchen team on the staff list yet."}),(0,m.jsx)(n.Button,{testID:"krota-publish",kind:P?'primary':'secondary',disabled:!P,label:P?`Publish kitchen rota (${P} ${1===P?'change':'changes'})`:'Kitchen rota published',accessibilityLabel:P?`Publish the kitchen rota for ${M.toLowerCase()}, ${P} ${1===P?'change':'changes'}`:'Kitchen rota published for this week',onPress:()=>{const e=(0,r.publishKitchen)(a.useOwner.getState().shifts,k,H,C);a.useOwner.getState().setShifts(e.shifts),R(e.n?`Published ${e.n} kitchen ${1===e.n?'shift':'shifts'}. The kitchen team see them in their app now.`:'Nothing new to publish this week.')},style:{minHeight:56,alignSelf:'stretch'}}),T?(0,m.jsx)(i.default,{testID:"krota-msg",children:(0,m.jsx)(n.T,{center:!0,colour:f.colours.goldLight,children:T})}):null,(0,m.jsx)(n.Muted,{center:!0,children:"Tap a day to add or change a shift. Dashed amber = draft, only you see it until you publish. Front of house shifts are made in CoverCharge for Managers."}),I?(0,m.jsx)(S,{init:I,onClose:()=>D(null),onSaid:R}):null]})}function w({today:e=(0,h.ymd)(new Date)}){const{staff:s,shifts:r}=(0,o.rotaView)('chef',(0,a.useOwner)(e=>e.staff),(0,a.useOwner)(e=>e.shifts)),d=(0,a.useOwner)(e=>e.leave),[u,k]=(0,t.useState)(0),p=(0,a.addDays)((0,a.mondayOfDate)(e),7*u),w=(0,a.addDays)(p,6),S=y.map((e,t)=>(0,a.addDays)(p,t)),I=s.filter(e=>/kitchen|chef|kp/i.test(`${e.job??''} ${e.name}`)),D=0===u?'This week':1===u?'Next week':-1===u?'Last week':`Week of ${j(p)}`,[T,v]=(0,t.useState)(0),H=T?Math.max(30,Math.min(44,Math.floor((T-12)/7))):40;return(0,m.jsxs)(i.default,{testID:"kitchen-rota-read",onLayout:e=>v(e.nativeEvent.layout.width),style:{gap:10,alignItems:'center',alignSelf:'stretch'},children:[(0,m.jsx)(n.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Kitchen rota"}),(0,m.jsxs)(n.Row,{gap:8,style:{justifyContent:'center',alignItems:'center'},children:[(0,m.jsx)(n.Button,{small:!0,kind:"ghost",testID:"krota-read-prev",label:"\u2039 Prev",accessibilityLabel:"Previous week",onPress:()=>k(u-1),style:{minWidth:84,minHeight:48}}),(0,m.jsxs)(i.default,{accessible:!0,accessibilityLabel:`${D}, ${b[0]} ${j(p)} to ${b[6]} ${j(w)}`,style:{alignItems:'center',minWidth:120},children:[(0,m.jsx)(n.T,{weight:"semibold",center:!0,children:D}),(0,m.jsxs)(n.Muted,{center:!0,children:[x(p)," \u2013 ",x(w)]})]}),(0,m.jsx)(n.Button,{small:!0,kind:"ghost",testID:"krota-read-next",label:"Next \u203a",accessibilityLabel:"Next week",onPress:()=>k(u+1),style:{minWidth:84,minHeight:48}})]}),I.map(t=>(0,m.jsxs)(i.default,{testID:"krota-read-row",style:{gap:4,alignItems:'center',alignSelf:'stretch'},children:[(0,m.jsx)(n.T,{size:14,weight:"semibold",center:!0,children:$(t.nickname||t.name)}),(0,m.jsx)(n.Row,{gap:2,style:{justifyContent:'center',flexWrap:'nowrap'},children:S.map((s,a)=>{const o=r.find(e=>e.staffId===t.id&&e.date===s),h=o?(0,l.leaveCovering)(d,t.id,s):void 0,u=o?h?(0,l.leaveLabel)(h):`${(0,c.fmtH)(o.start)} to ${(0,c.fmtH)(o.end)}`:'off';return(0,m.jsxs)(i.default,{testID:`krota-read-cell-${t.id}-${a}`,accessible:!0,accessibilityLabel:`${$(t.nickname||t.name)}, ${b[a]} ${j(s)}, ${u}`,style:{width:H,minHeight:52,borderRadius:8,paddingVertical:4,paddingHorizontal:0,alignItems:'center',justifyContent:'center',borderWidth:1,borderColor:o?f.colours.gold:f.colours.border,backgroundColor:o?f.colours.goldTint:f.colours.surface2},children:[(0,m.jsx)(n.T,{size:10,center:!0,colour:s===e?f.colours.gold:f.colours.muted,children:y[a]}),o&&h?(0,m.jsx)(n.T,{size:9,center:!0,colour:f.colours.blue,children:(0,l.leaveLabel)(h).toLowerCase()}):(0,m.jsx)(n.T,{size:10,center:!0,children:o?(0,c.fmtH)(o.start).slice(0,5):'off'}),o&&!h?(0,m.jsx)(n.T,{size:10,center:!0,children:(0,c.fmtH)(o.end).slice(0,5)}):null]},s)})})]},t.id)),I.length?null:(0,m.jsx)(n.Muted,{center:!0,children:"No kitchen shifts on the rota yet."}),(0,m.jsx)(n.Muted,{center:!0,children:"This shows published shifts only. To change the kitchen rota here, an owner can tick \u201cMake the kitchen rota\u201d for you on the Permissions screen."})]})}function S({init:e,onClose:s,onSaid:l}){const o=(0,a.useOwner)(t=>t.staff.find(t=>t.id===e.staffId)),d=$(o?.nickname||o?.name||''),[u,y]=(0,t.useState)(e.shift?.start??11),[b,x]=(0,t.useState)(e.shift?.end??21),[p,w]=(0,t.useState)(!1),[S,I]=(0,t.useState)(''),D=`${(0,h.niceDate)((0,h.parseYmd)(e.date))} (${j(e.date)})`;return(0,m.jsx)(n.Sheet,{visible:!0,onClose:s,title:`${d} \xb7 ${D}`,testID:"krota-sheet",children:(0,m.jsxs)(i.default,{style:{gap:10,alignItems:'center'},children:[(0,m.jsx)(n.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:k.map(([e,t,s])=>(0,m.jsx)(n.Chip,{testID:`krota-preset-${e.toLowerCase()}`,label:`${e} ${(0,c.fmtH)(t)}\u2013${(0,c.fmtH)(s)}`,selected:u===t&&b===s,onPress:()=>{y(t),x(s)}},e))}),(0,m.jsx)(n.T,{center:!0,children:"Start"}),(0,m.jsx)(n.Stepper,{testID:"krota-start",value:u,step:.5,min:c.SHIFT_MIN_START,max:b-1,onChange:y,format:c.fmtH,label:"Start time"}),(0,m.jsxs)(n.T,{center:!0,children:["End",b>=24?' (next day)':'']}),(0,m.jsx)(n.Stepper,{testID:"krota-end",value:b,step:.5,min:u+1,max:c.SHIFT_MAX_END,onChange:x,format:c.fmtH,label:"End time"}),(0,m.jsxs)(n.Muted,{center:!0,children:[(b-u).toFixed(1)," hours"]}),S?(0,m.jsx)(i.default,{accessibilityLiveRegion:"assertive",children:(0,m.jsx)(n.T,{center:!0,colour:f.colours.amber,children:S})}):null,(0,m.jsx)(n.Button,{testID:"krota-save",label:e.shift?'Save shift':'Add shift',accessibilityLabel:`${e.shift?'Save':'Add'} ${d}'s shift, ${D}, ${(0,c.fmtH)(u)} to ${(0,c.fmtH)(b)}`,onPress:()=>{const t=a.useOwner.getState();(0,r.clashes)(t.shifts,e.staffId,e.date,u,b,e.shift?.id)?I(`${d} already has a shift that overlaps on ${D}.`):(e.shift?t.setShifts(t.shifts.map(t=>t.id===e.shift.id?{...t,start:u,end:b,changed:!!t.published||t.changed}:t)):t.addShift({staffId:e.staffId,date:e.date,start:u,end:b}),l(`${e.shift?'Changed':'Added'}: ${d}, ${D}, ${(0,c.fmtH)(u)} to ${(0,c.fmtH)(b)}. Draft until you publish the kitchen rota.`),s())},style:{minHeight:56,alignSelf:'stretch'}}),e.shift&&!p?(0,m.jsx)(n.Button,{testID:"krota-remove",kind:"danger",label:"Remove shift",onPress:()=>w(!0),style:{minHeight:52,alignSelf:'stretch'}}):null,e.shift&&p?(0,m.jsxs)(i.default,{testID:"krota-remove-ask",accessibilityLiveRegion:"assertive",style:{gap:8,alignItems:'center',alignSelf:'stretch'},children:[(0,m.jsxs)(n.T,{center:!0,weight:"semibold",children:["Remove ",d,"\u2019s shift on ",D,"?"]}),(0,m.jsx)(n.Button,{testID:"krota-remove-yes",kind:"danger",label:"Yes, remove it",onPress:()=>{a.useOwner.getState().removeShift(e.shift.id),l(`Removed ${d}'s shift on ${D}.`),s()},style:{minHeight:52,alignSelf:'stretch'}}),(0,m.jsx)(n.Button,{testID:"krota-remove-no",kind:"secondary",label:"No, keep it",onPress:()=>w(!1),style:{minHeight:52,alignSelf:'stretch'}})]}):null]})})}},1165,[34,402,102,794,891,988,1094,993,987,1087,858,1166,821,25]); __d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.primeAnnouncer=function(){u()},_e.announce=function(t){const e=String(t??'').trim();if(!e)return;{const t=u();if(!t)return;const n=++o;return t.textContent='',void setTimeout(()=>{n===o&&(t.textContent=e)},80)}},Object.defineProperty(_e,"lastAnnounced",{enumerable:!0,get:function(){return c}});var t,e=r(d[0]);(t=e)&&t.__esModule;r(d[1]);let n=null,o=0;function u(){if('undefined'==typeof document||!document.body)return null;if(n&&document.body.contains(n))return n;const t=document.createElement('div');return t.id='cc-announcer',t.setAttribute('aria-live','assertive'),t.setAttribute('aria-atomic','true'),t.setAttribute('role','status'),t.setAttribute('data-testid','cc-announcer'),Object.assign(t.style,{position:'absolute',width:'1px',height:'1px',margin:'-1px',padding:'0',overflow:'hidden',clip:'rect(0 0 0 0)',whiteSpace:'nowrap',border:'0'}),document.body.appendChild(t),n=t,t}const c=()=>n?.textContent??''},1166,[281,236]); __d(function(g,r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useSuggestions=j,_e.OrdersScreen=function({focus:e}={}){const[s,t]=(0,n.useState)('sheets');return(0,x.jsxs)(l.default,{style:{gap:12},children:[(0,x.jsx)(y.Seg,{value:s,onChange:t,options:[{id:'sheets',label:'Order sheets'},{id:'suggested',label:'Suggested orders'},{id:'history',label:'Order history'}]}),'sheets'===s?(0,x.jsx)(m.OrderSheets,{focus:e}):'suggested'===s?(0,x.jsx)(w,{}):(0,x.jsx)($,{})]})};var s=r(_d[0]),t=r(_d[1]),n=r(_d[2]),i=e(r(_d[3])),l=e(r(_d[4])),d=r(_d[5]),o=r(_d[6]),u=r(_d[7]),c=r(_d[8]),h=r(_d[9]),p=r(_d[10]),y=r(_d[11]),f=r(_d[12]),m=r(_d[13]),x=r(_d[14]);const b=(e,s)=>'kg'===s?Math.ceil(2*e)/2:Math.ceil(e);function j(){const{k:e,now:s,rid:n}=(0,y.useChef)(6e4),{pct:i}=(0,y.useForecast)(),l=(0,u.supplierView)('chef',(0,o.useOwner)(e=>e.suppliers)).filter(e=>!e.archived),d=1+Math.max(0,i)/100;return l.map(i=>{const l=e.ingredients.filter(e=>e.supplierId===i.id).map(e=>({i:e,qty:(0,t.fishInStone)(n,e)?(0,t.fromStone)(Math.ceil(2*(0,t.toStone)(Math.max(0,e.par*d-e.onHand),e.unit))/2,e.unit):b(Math.max(0,e.par*d-e.onHand),e.unit)})).filter(e=>e.qty>0),o=(0,p.weekday)(s),u=i.orderDays.includes(o),[c,h]=(i.cutoff||'23:59').split(':').map(Number),y=new Date(s);y.setHours(c,h,0,0);const f=e.orders.some(e=>e.supplierId===i.id&&new Date(e.at).toDateString()===s.toDateString()),m=[1,2,3,4,5,6,7].map(e=>(o+e)%7).find(e=>i.orderDays.includes(e));return{s:i,lines:l,ordersToday:u,cutPassed:s>y,placedToday:f,nextDay:m,total:Math.round(l.reduce((e,s)=>e+s.qty*s.i.cost,0))}}).filter(e=>e.lines.length||e.ordersToday)}function w(){const{me:e,rid:o}=(0,y.useChef)(),{label:u,covers:m,enough:b,booked:w}=(0,y.useForecast)(),$=(0,f.useKitchen)(e=>e.addOrder),S=j(),[C,M]=(0,n.useState)({}),[O,k]=(0,n.useState)('');return(0,x.jsxs)(l.default,{style:{gap:10},children:[(0,x.jsxs)(d.Muted,{children:[b?`Built from par levels and today's forecast (${m} Covers, ${u} vs a typical day).`:`Built from par levels (no forecast yet: not enough history; ${w} Covers booked so far).`," Adjust, then call the supplier or use their ordering website. Nothing is sent by CoverCharge."]}),O?(0,x.jsx)(d.Banner,{kind:"success",title:"Saved to order history",children:O}):null,S.map(({s:n,lines:u,ordersToday:y,cutPassed:f,placedToday:m,nextDay:b,total:j})=>{const w=u.map(e=>({...e,q:C[`${n.id}:${e.i.id}`]??e.qty})),S=Math.round(w.reduce((e,s)=>e+s.q*s.i.cost,0)),O=s=>{$({supplierId:n.id,by:e,status:s,lines:w.filter(e=>e.q>0).map(e=>({ing:e.i.id,qty:e.q,cost:e.i.cost})),total:S}),k(`${n.name}: ${(0,c.gbp)(S)} (${s}).`)};return(0,x.jsxs)(d.Card,{highlight:!y||m||f?void 0:h.colours.gold,children:[(0,x.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsxs)(l.default,{style:{flex:1},children:[(0,x.jsx)(d.T,{weight:"semibold",children:n.name}),(0,x.jsxs)(d.Muted,{children:[n.category," \xb7 min order ",(0,c.gbp)(n.minOrder)]})]}),m?(0,x.jsx)(d.Badge,{kind:"ok",label:"ORDERED TODAY"}):y?(0,x.jsx)(d.Badge,{kind:f?'red':'amber',label:f?`CUT-OFF ${n.cutoff} PASSED`:`ORDER BY ${n.cutoff}`}):(0,x.jsx)(d.Badge,{label:`NEXT ${null!=b?p.DAY3[b].toUpperCase():'\u2014'}`})]}),w.length?w.map(e=>(0,x.jsxs)(d.Row,{wrap:!0,style:{justifyContent:'space-between'},children:[(0,x.jsxs)(l.default,{style:{flex:1},children:[(0,x.jsx)(d.T,{size:14,children:e.i.name}),(0,x.jsxs)(d.Muted,{children:["On hand ",(0,s.ingredientQty)(o,e.i,e.i.onHand)," \xb7 par ",(0,s.ingredientQty)(o,e.i,e.i.par)]})]}),(0,x.jsx)(d.Button,{small:!0,kind:"ghost",label:"Less",accessibilityLabel:`${(0,t.fishInStone)(o,e.i)?'Half a stone less':'Less'} ${e.i.name}`,onPress:()=>M(s=>({...s,[`${n.id}:${e.i.id}`]:(0,t.stepQuantity)(o,e.i,e.q,-1)}))}),(0,x.jsx)(l.default,{accessible:!0,accessibilityLabel:(0,s.ingredientSpeech)(o,e.i,e.q),children:(0,x.jsx)(d.T,{size:16,style:{minWidth:76,textAlign:'center'},children:(0,s.ingredientQty)(o,e.i,e.q)})}),(0,x.jsx)(d.Button,{small:!0,kind:"ghost",label:"More",accessibilityLabel:`${(0,t.fishInStone)(o,e.i)?'Half a stone more':'More'} ${e.i.name}`,onPress:()=>M(s=>({...s,[`${n.id}:${e.i.id}`]:(0,t.stepQuantity)(o,e.i,e.q,1)}))})]},e.i.id)):(0,x.jsx)(d.Muted,{children:"Everything is at par."}),w.length?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsxs)(d.T,{weight:"semibold",children:["Estimated ",(0,c.gbp)(S)]}),S{i.default.openURL(`tel:${n.phones[0].replace(/\s/g,'')}`).catch(()=>{}),O('placed (by phone)')}}):null,n.website?(0,x.jsx)(d.Button,{small:!0,kind:"secondary",label:"Open website",onPress:()=>{i.default.openURL(n.website).catch(()=>{}),O('placed (on website)')}}):null]})]}):null,void 0]},n.id)})]})}function $(){const{k:e,rid:t}=(0,y.useChef)(),n=(0,o.useOwner)(e=>e.suppliers);return(0,x.jsx)(l.default,{style:{gap:8},children:e.orders.map(i=>(0,x.jsxs)(d.Card,{children:[(0,x.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(d.T,{weight:"semibold",style:{flex:1},children:n.find(e=>e.id===i.supplierId)?.name}),(0,x.jsx)(d.Badge,{kind:"neutral",label:i.status.toUpperCase()})]}),(0,x.jsxs)(d.Muted,{children:[new Date(i.at).toLocaleString('en-GB',{weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})," \xb7 ",i.by,i.total?` \xb7 ${(0,c.gbp)(i.total)}`:'']}),i.lines.length?(0,x.jsx)(d.Muted,{children:i.lines.map(n=>{const i=e.ingredients.find(e=>e.id===n.ing);return`${(0,s.ingredientQty)(t,i??{name:n.ing,unit:''},n.qty)} ${i?.name??n.ing}`}).join(', ')}):null]},i.id))})}},1167,[1153,984,34,379,102,794,891,993,867,821,1084,1145,1029,1168,25]); __d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.openLink=j,_e.useSheetReminders=T,_e.OrderSheets=function({focus:e}){const{rid:t,now:l}=(0,x.useChef)(3e4),o=(0,u.useSheets)(t).filter(e=>(0,n.chefCanSee)(t,e)&&!e.placeholder),[h,c]=(0,s.useState)(e??null),p=T(),f=(0,b.wd)(l);return(0,y.jsxs)(d.default,{style:{gap:10},testID:"order-sheets",children:[(0,y.jsx)(i.Banner,{kind:"info",title:"Nothing is sent for you",children:"Text, WhatsApp and phone orders open your phone\u2019s own app with the order already written. Check it, then press Send yourself."}),p.map(e=>(0,y.jsx)(r.default,{accessibilityRole:"button",onPress:()=>c(e.supplierId),children:(0,y.jsxs)(i.Banner,{kind:'red'===e.tone?'danger':'warn',title:`\u23f0 ${e.text}`,children:["Tap to open the ",e.name," order sheet."]})},e.supplierId)),(0,y.jsxs)(i.Muted,{children:["Today is ",b.DAYS[f],". Edit suppliers in Managers \u203a Settings \u203a Supplier order sheets."]}),o.map(e=>(0,y.jsx)(C,{s:e,open:h===e.id,onToggle:()=>c(h===e.id?null:e.id)},e.id)),o.length?null:(0,y.jsx)(i.Muted,{children:"No order sheets yet. Add suppliers in Managers \u203a Settings \u203a Supplier order sheets."})]})};var t=_r(_d[0]),n=_r(_d[1]),l=_r(_d[2]),s=_r(_d[3]),o=e(_r(_d[4]));_r(_d[5]);var r=e(_r(_d[6])),d=e(_r(_d[7])),i=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),c=_r(_d[11]),p=_r(_d[12]),b=_r(_d[13]),f=_r(_d[14]),x=_r(_d[15]),y=_r(_d[16]);function j(e){if('undefined'!=typeof window){const t=window;return'function'==typeof t.__ccOpenLink?void t.__ccOpenLink(e):void(/^https?:/.test(e)?window.open(e,'_blank','noopener'):window.location.href=e)}o.default.openURL(e).catch(()=>{})}async function w(e){try{const t='undefined'!=typeof navigator?navigator:null;if(t?.clipboard?.writeText)return await t.clipboard.writeText(e),!0}catch{}return!1}const k={online:'\ud83c\udf10',phone:'\ud83d\udcde',text:'\ud83d\udcac',whatsapp:'\u2706',tbc:'\ud83d\udd8a\ufe0f'},S={borderWidth:1,borderColor:f.colours.border,borderRadius:10,paddingHorizontal:12,paddingVertical:10,color:f.colours.text,backgroundColor:f.colours.surface2,fontSize:f.font.body};function T(){const{rid:e,now:t}=(0,x.useChef)(6e4),l=(0,u.useSheets)(e).filter(t=>(0,n.chefCanSee)(e,t)&&!t.placeholder),s=(0,u.useOrderSheets)(e=>e.opened),o=(0,h.useShellfish)(e,'','chef'),r=(0,b.remindersFor)(l,t,s);for(const n of l){const l=o.items.filter(e=>(e.supplierId===n.id||!e.supplierId&&n.shellfish)&&o.isLow(e.key));!l.length||s[n.id]&&new Date(s[n.id]).toDateString()===t.toDateString()||r.push({supplierId:n.id,name:n.name,text:`${'text'===n.method||'whatsapp'===n.method?'Text':'Order from'} ${n.contact||n.name}: ${l.map(t=>`${(0,c.fmtStockCount)(e,t,o.counts[t.key]??0)} ${t.plural.toLowerCase()}`).join(' and ')} left`,tone:'amber',cutoffPassed:!1})}return r}function C({s:e,open:n,onToggle:o}){const{rid:T,r:C,me:$,now:D}=(0,x.useChef)(3e4),v=(0,u.useOrderSheets)(e=>e.patch),I=(0,u.useOrderSheets)(e=>e.markOpened),M=(0,u.useOrderSheets)(t=>t.opened[e.id]),[B,L]=(0,s.useState)({}),[P,O]=(0,s.useState)(''),[R,A]=(0,s.useState)(''),[z,_]=(0,s.useState)(!1),W=(0,h.useShellfish)(T,$,'chef'),H=(0,b.nextDelivery)(e,D),K=(0,b.orderLines)(e,B,P,T),E=(C.address??C.location??'').split(',').map(e=>e.trim()).filter(Boolean),q=E.length>=3?E[1]:E[0]??'',N=(0,b.orderMessage)(e,C.name,q,K,$.split(' ')[0],D),U=e.orderDays.includes((0,b.wd)(D)),Q=(e,t)=>L(n=>({...n,[e.id]:(0,l.stepQuantity)(T,e,n[e.id]||0,t)})),Y=t=>{I(e.id,D.toISOString()),j(t)},F='text'===e.method||'whatsapp'===e.method||'phone'===e.method,G=Math.round(100*parseFloat(R.replace(/[\xa3,]/g,''))),V=W.items.filter(t=>t.supplierId===e.id||!t.supplierId&&e.shellfish),J=V.filter(e=>W.isLow(e.key));return(0,y.jsxs)(d.default,{testID:`sheet-${e.id}`,style:{borderRadius:14,borderWidth:1.5,borderColor:U||J.length?f.colours.amber:n?f.colours.gold:f.colours.border,backgroundColor:f.colours.surface,overflow:'hidden'},children:[(0,y.jsxs)(r.default,{accessibilityRole:"button",accessibilityLabel:`${e.name} order sheet`,onPress:o,style:{padding:12,gap:4},children:[(0,y.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsxs)(i.T,{weight:"semibold",size:f.font.large,style:{flex:1},children:[k[e.method]," ",e.name]}),(0,y.jsx)(i.Badge,{kind:e.placeholder?'amber':'gold',label:e.placeholder?'To fill in':b.METHOD_LABEL[e.method]})]}),(0,y.jsx)(i.Muted,{children:e.goods}),(0,y.jsxs)(i.Row,{wrap:!0,gap:6,children:[e.deliveryDays.length?(0,y.jsx)(i.Badge,{kind:"neutral",label:`Delivers ${(0,b.dayRange)(e.deliveryDays)}`}):null,e.orderDays.length?(0,y.jsx)(i.Badge,{kind:U?'amber':'neutral',label:`Order ${(0,b.dayRange)(e.orderDays)}${e.cutoff?` by ${e.cutoff}`:''}`}):null,e.frequency?(0,y.jsx)(i.Badge,{kind:"neutral",label:e.frequency}):null,e.priceCapPerKg?(0,y.jsx)(i.Badge,{kind:"blue",label:`Cap ${(0,p.gbp)(e.priceCapPerKg)}/kg`}):null,V.length?(0,y.jsx)(i.Badge,{kind:J.length?'amber':'ok',label:V.map(e=>`${e.icon} ${(0,c.fmtStockCount)(T,e,W.counts[e.key]??0)}`).join(' \xb7 ')}):null,M&&new Date(M).toDateString()===D.toDateString()?(0,y.jsx)(i.Badge,{kind:"ok",label:"Opened today \u2713"}):null]})]}),n?(0,y.jsxs)(d.default,{style:{padding:12,paddingTop:0,gap:10},children:[H?(0,y.jsxs)(i.Muted,{children:["Next delivery if you order now: ",(0,b.niceDay)(H),"."]}):null,e.reminder?(0,y.jsxs)(i.Muted,{children:["Reminder on ",e.orderDays.map(e=>b.DAYS[e]).join(', '),": ",e.reminder]}):null,e.notes?(0,y.jsx)(i.T,{size:f.font.small,colour:f.colours.muted,children:e.notes}):null,e.placeholder?(0,y.jsx)(i.Banner,{kind:"warn",title:"Still to be set up",children:"Add the supplier, how to order and delivery days in Managers \u203a Settings \u203a Supplier order sheets."}):null,e.items.map(e=>(0,y.jsxs)(d.default,{style:{gap:6},children:[(0,y.jsxs)(i.T,{children:[e.name,e.unit?(0,y.jsxs)(i.T,{size:f.font.small,colour:f.colours.muted,children:[" (",(0,l.quantityUnit)(T,e),")"]}):null]}),(0,y.jsxs)(i.Row,{wrap:!0,gap:8,style:{justifyContent:'space-between'},children:[(0,y.jsx)(i.Button,{small:!0,kind:"secondary",label:"Less",accessibilityLabel:`${(0,l.fishInStone)(T,e)?'Half a stone less':'Less'} ${e.name}`,onPress:()=>Q(e,-1),style:{minWidth:44,minHeight:44}}),(0,y.jsx)(d.default,{accessible:!0,accessibilityLabel:(0,l.fishQtySpeech)(T,e,B[e.id]||0),children:(0,y.jsx)(i.T,{weight:"bold",size:20,style:{minWidth:76,textAlign:'center'},children:(0,l.fishInStone)(T,e)?(0,l.fishQtyText)(T,e,B[e.id]||0):B[e.id]||0})}),(0,y.jsx)(i.Button,{small:!0,kind:"secondary",label:"More",accessibilityLabel:`${(0,l.fishInStone)(T,e)?'Half a stone more':'More'} ${e.name}`,testID:`qty-${e.id}`,onPress:()=>Q(e,1),style:{minWidth:44,minHeight:44}})]})]},e.id)),(0,y.jsxs)(d.default,{style:{gap:4},children:[(0,y.jsx)(i.T,{size:f.font.small,weight:"medium",colour:f.colours.muted,children:"Anything else (one line each)"}),(0,y.jsx)(t.TextInput,{value:P,onChangeText:O,multiline:!0,placeholder:"e.g. 2 boxes lemons",placeholderTextColor:f.colours.muted,style:[S,{minHeight:60}]})]}),F?(0,y.jsxs)(d.default,{style:{gap:4},children:[(0,y.jsxs)(i.T,{size:f.font.small,weight:"medium",colour:f.colours.muted,children:['whatsapp'===e.method?'WhatsApp number':'phone'===e.method?'Phone number':'Mobile number',e.number?'':' (blank: fill in once, it is saved)']}),(0,y.jsx)(t.TextInput,{testID:`number-${e.id}`,value:e.number,onChangeText:t=>v(T,e.id,{number:t}),keyboardType:"phone-pad",placeholder:"07\u2026",placeholderTextColor:f.colours.muted,style:S})]}):null,'online'===e.method?(0,y.jsxs)(d.default,{style:{gap:4},children:[(0,y.jsxs)(i.T,{size:f.font.small,weight:"medium",colour:f.colours.muted,children:['Open Coldweb'===e.urlLabel?'Coldweb ordering link':'Website link',e.url?'':' (blank: paste it in once, it is saved)']}),(0,y.jsx)(t.TextInput,{testID:`url-${e.id}`,value:e.url,onChangeText:t=>v(T,e.id,{url:t.trim()}),autoCapitalize:"none",keyboardType:"url",placeholder:"https://\u2026",placeholderTextColor:f.colours.muted,style:S})]}):null,e.priceCapPerKg?(0,y.jsxs)(d.default,{style:{gap:6,padding:10,borderRadius:12,backgroundColor:f.colours.blueBg},children:[(0,y.jsxs)(i.T,{weight:"semibold",colour:"#E2C489",children:["Price cap ",(0,p.gbp)(e.priceCapPerKg),"/kg \xb7 buy from the cheapest UK seller under it"]}),(0,y.jsxs)(i.Muted,{children:["Seller: ",e.seller||'to be chosen']}),(0,y.jsxs)(i.Row,{gap:8,children:[(0,y.jsx)(i.T,{size:f.font.small,style:{flex:1},children:"Price you found (\xa3/kg)"}),(0,y.jsx)(t.TextInput,{testID:"price-found",value:R,onChangeText:A,keyboardType:"decimal-pad",placeholder:"e.g. 22.50",placeholderTextColor:f.colours.muted,style:[S,{width:120}]})]}),G>0?(0,y.jsx)(i.Badge,{kind:G<=e.priceCapPerKg?'ok':'red',label:G<=e.priceCapPerKg?`${(0,p.gbp)(G)}/kg is under the cap \u2713`:`${(0,p.gbp)(G)}/kg is over the ${(0,p.gbp)(e.priceCapPerKg)} cap: look for a cheaper seller`}):null]}):null,'online'!==e.method&&'tbc'!==e.method?(0,y.jsxs)(d.default,{testID:`preview-${e.id}`,style:{padding:10,borderRadius:12,borderWidth:1,borderColor:f.colours.border,backgroundColor:f.colours.surface2},children:[(0,y.jsx)(i.T,{size:12,weight:"semibold",colour:f.colours.gold,children:'phone'===e.method?'READ THIS OUT':'YOUR MESSAGE'}),(0,y.jsx)(i.T,{size:f.font.small,children:K.length?N:'Add quantities above to write the order.'})]}):null,(0,y.jsxs)(i.Row,{wrap:!0,gap:8,children:['text'===e.method?(0,y.jsx)(i.Button,{testID:`send-${e.id}`,kind:"success",label:"\ud83d\udcac Open in Messages",disabled:!K.length,onPress:()=>Y((0,b.smsLink)(e.number,N))}):null,'whatsapp'===e.method?(0,y.jsx)(i.Button,{testID:`send-${e.id}`,kind:"success",label:"Open in WhatsApp",disabled:!K.length,onPress:()=>Y((0,b.waLink)(e.number,N))}):null,'phone'===e.method?(0,y.jsx)(i.Button,{testID:`send-${e.id}`,kind:"success",label:`\ud83d\udcde Call ${e.name}`,disabled:!e.number,onPress:()=>Y((0,b.telLink)(e.number))}):null,'online'===e.method?(0,y.jsx)(i.Button,{testID:`send-${e.id}`,kind:"success",label:`\ud83c\udf10 ${e.urlLabel??'Open website'}`,disabled:!e.url,onPress:()=>Y(e.url)}):null,'online'!==e.method&&'tbc'!==e.method&&K.length?(0,y.jsx)(i.Button,{kind:"ghost",label:z?'Copied \u2713':'Copy order',onPress:async()=>{const e=await w(N);_(e),e&&setTimeout(()=>_(!1),2e3)}}):null]}),'text'===e.method&&!e.number&&K.length?(0,y.jsx)(i.Muted,{children:"No number saved: Messages opens with the order written and asks who to send it to."}):null,'whatsapp'===e.method&&!e.number&&K.length?(0,y.jsx)(i.Muted,{children:"No number saved: WhatsApp opens with the order written and asks who to send it to."}):null,'phone'!==e.method||e.number?null:(0,y.jsx)(i.Muted,{children:"Add the phone number above to call from here."}),'online'!==e.method||e.url?null:(0,y.jsx)(i.Muted,{children:"Add the link above and the button opens it."})]}):null]})}},1168,[827,835,984,34,379,236,402,102,794,1027,983,985,867,1028,821,1145,25]); @@ -1267,7 +1267,7 @@ __d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{ __d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.waNumber=o,_e.waMeLink=function(e,t){const n=o(e);return n?t?`https://wa.me/${n}?text=${encodeURIComponent(t)}`:`https://wa.me/${n}`:null},Object.defineProperty(_e,"guestWhatsAppText",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"staffWhatsAppTexts",{enumerable:!0,get:function(){return p}}),_e.openWhatsApp=async function(e){try{return await n.default.openURL(e),!0}catch{return!1}};var e,t=r(_d[0]),n=(e=t)&&e.__esModule?e:{default:e};function o(e,t="44"){if(!e)return null;let n=String(e).trim().replace(/[\s().\-]/g,'');return n.startsWith('+')?n=n.slice(1):n.startsWith('00')?n=n.slice(2):n.startsWith('0')&&(n=t+n.slice(1)),n=n.replace(/^440/,'44'),/^[1-9][0-9]{6,14}$/.test(n)?n:null}const s=e=>{const[t,n,o]=e.split('-').map(Number);return new Date(t,n-1,o).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long',year:'numeric'})},u=e=>{const[t,n,o]=e.split('-').map(Number);return new Date(t,n-1,o).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'})},c=e=>e.slice(0,5),l=e=>e.replace(' (example)','').trim().split(/\s+/)[0]||'there',m=(e,t)=>`Hi ${t}, it's ${e.name.trim()} about my booking${e.ref?` ${e.ref}`:''}: ${s(e.date)} at ${c(e.time)}, table for ${e.partySize}. `,p=(e,t,n)=>({confirm:`Hi ${l(e.name)}, it's ${t}${n?` in ${n}`:''}. Just confirming your table for ${e.partySize} on ${u(e.date)} at ${c(e.time)}${e.ref?` (ref ${e.ref})`:''}. Any questions, just reply here.`,change:`Hi ${l(e.name)}, it's ${t} about your booking on ${u(e.date)} at ${c(e.time)}. `})},1184,[379]); __d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"payFor",{enumerable:!0,get:function(){return k.payFor}}),Object.defineProperty(_e,"useVenuePay",{enumerable:!0,get:function(){return k.useVenuePay}}),_e.PayTipsSettings=function({go:e}){const{rid:s,today:o}=(0,P.useCtx)(6e4),{pay:r,source:d}=(0,k.useVenuePay)(s),[a,l]=(0,n.useState)(r),[u,c]=(0,n.useState)((0,f.ukDate)(r.tipsAnchorPayday)),[y,x]=(0,n.useState)(null),j=(0,f.parseUk)(u),w=(0,f.cleanPay)({...a,tipsAnchorPayday:j??a.tipsAnchorPayday}),C=JSON.stringify(w)!==JSON.stringify(r)||'settings'!==d,S=(0,f.nextToPay)(w,'tips',o).period,D=(0,f.nextToPay)(w,'wage',o).period,I=(0,f.tipsPeriod)(w,S.start,1),z=(0,f.wagePeriod)(w,D.start,1),H=e=>{l({...a,...e}),x(null)};return(0,v.jsxs)(i.default,{style:{gap:12},testID:"pay-settings",children:['none'===d?(0,v.jsx)(h.Banner,{kind:"warn",title:"Pay dates not set up yet",children:"Set your tips and wage dates here. Until then the app uses calendar months and weekly tips."}):null,'questionnaire'===d?(0,v.jsx)(h.Banner,{kind:"info",title:"From your sign-up answers",children:"These dates came from your questionnaire. Check them and tap Save to make them your venue's pay dates."}):null,(0,v.jsx)(T.SectionHead,{title:"Tips",sub:"How often tips are paid out, and which days each payout covers."}),(0,v.jsxs)(h.Card,{children:[(0,v.jsx)(h.T,{weight:"semibold",children:"How often"}),(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:['weekly','fortnightly','monthly'].map(e=>(0,v.jsx)(h.Chip,{label:M[e],selected:a.tipsFrequency===e,onPress:()=>H({tipsFrequency:e})},e))}),(0,v.jsx)(h.Field,{label:"Next tips payday (DD/MM/YYYY)",value:u,onChangeText:e=>{c((0,t.slashDate)(e,u)),x(null)},maxLength:10,placeholder:"02/11/2026",keyboardType:"numbers-and-punctuation"}),j?(0,v.jsxs)(h.Muted,{children:[(0,f.dayMonth)(j)," ",j.slice(0,4)]}):(0,v.jsx)(h.T,{size:13,colour:b.colours.red,children:"Enter a date like 02/11/2026"}),(0,v.jsx)(h.T,{weight:"semibold",children:"Each tips period ends"}),(0,v.jsxs)(h.Row,{children:[(0,v.jsx)(h.Stepper,{label:"days before payday",value:a.tipsEndsDaysBefore,min:0,max:13,onChange:e=>H({tipsEndsDaysBefore:e})}),(0,v.jsx)(h.Muted,{style:{flex:1},children:0===a.tipsEndsDaysBefore?'on payday':1===a.tipsEndsDaysBefore?'day before payday (a Monday payday covers up to the Sunday)':'days before payday'})]})]}),(0,v.jsx)(T.SectionHead,{title:"Wages",sub:"Monthly pay: the cut-off starts each pay period."}),(0,v.jsxs)(h.Card,{children:[(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(h.T,{weight:"semibold",style:{flex:1},children:"Pay day of the month"}),(0,v.jsx)(h.Stepper,{label:"pay day",value:a.wagePayDay,min:1,max:31,onChange:e=>H({wagePayDay:e})})]}),(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(h.T,{weight:"semibold",style:{flex:1},children:"Cut-off (first day of each period)"}),(0,v.jsx)(h.Stepper,{label:"cut-off day",value:a.wageCutoffDay,min:1,max:28,onChange:e=>H({wageCutoffDay:e})})]}),(0,v.jsxs)(h.Muted,{children:["Period runs the ",B(a.wageCutoffDay)," to the ",B(1===a.wageCutoffDay?31:a.wageCutoffDay-1),1===a.wageCutoffDay?' (end of the month)':' of the next month',". A pay day past the month end uses the last day."]}),(0,v.jsx)(h.T,{weight:"semibold",children:"A pay day on a weekend"}),(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:['none','before','after'].map(e=>(0,v.jsx)(h.Chip,{label:$[e],selected:(a.weekendRule??'none')===e,onPress:()=>H({weekendRule:e})},e))})]}),(0,v.jsx)(T.SectionHead,{title:"Preview"}),(0,v.jsxs)(h.Card,{highlight:b.colours.gold,children:[(0,v.jsx)(R,{label:"Next tips payday",day:S.payday,period:S}),(0,v.jsx)(R,{label:"Then",day:I.payday,period:I}),(0,v.jsx)(i.default,{style:{height:1,backgroundColor:b.colours.border}}),(0,v.jsx)(R,{label:"Next payday",day:D.payday,period:D}),(0,v.jsx)(R,{label:"Then",day:z.payday,period:z})]}),(0,v.jsx)(h.Button,{kind:"success",label:'settings'===d?'Save pay dates':'Save as our pay dates',disabled:!j||!C,testID:"save-pay",onPress:()=>{p.useStore.getState().updateSettings(s,{pay:w}),x('Saved. Everyone in the venue sees these dates.')}}),y?(0,v.jsx)(h.Banner,{kind:"success",title:y}):null,(0,v.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,v.jsx)(h.Button,{small:!0,kind:"secondary",label:"Payroll hours",onPress:()=>e('more','hours')}),(0,v.jsx)(h.Button,{small:!0,kind:"secondary",label:"Tips day",onPress:()=>e('more','tipsday')})]})]})},_e.hoursIn=z,Object.defineProperty(_e,"toTsv",{enumerable:!0,get:function(){return N}}),Object.defineProperty(_e,"toCsv",{enumerable:!0,get:function(){return F}}),_e.summaryTable=V,_e.detailTable=E,_e.copyText=Y,_e.periodOptions=G,_e.PayrollHours=function({go:e}){const{rid:s,today:t,now:r,r:p,me:w,meId:T,role:M}=(0,P.useCtx)(6e4),$=(0,C.canSeeHoursEdit)({role:M,isCar:S.IS_CAR}),[B,R]=(0,n.useState)(!1),{pay:I,source:A}=(0,k.useVenuePay)(s),W=(0,y.useOwner)(e=>e.staff),L=(0,y.useOwner)(e=>(0,y.liveAttendance)(e.attendance)),q=(0,P.useHourly)(),J=(0,a.default)().width<700,[K,Q]=(0,n.useState)(null),[X,Z]=(0,n.useState)(null),ee=e=>{const s=y.useOwner.getState().confirmEntries([e.id],w,T,(new Date).toISOString());we(s?'Approved. It now counts in the hours and pay.':'Nothing to approve.')},se=e=>(0,v.jsxs)(i.default,{style:{gap:8,marginBottom:8},testID:`daily-${e.person.id}`,children:[e.days.map(e=>(0,v.jsx)(u.ShiftCard,{d:e,manager:!0,onApprove:()=>ee(e.a),onEdit:()=>Q(e.a),onRemove:()=>Z(e.a)},e.a.id)),e.days.length?null:(0,v.jsx)(h.Muted,{center:!0,children:"No clocked shifts in this period."})]}),te=(0,n.useMemo)(()=>G(I,t),[I,t]),[oe,ne]=(0,n.useState)('wage'),[re,de]=(0,n.useState)(null),[ae,ie]=(0,n.useState)(!1),[le,ue]=(0,n.useState)({}),[ce,he]=(0,n.useState)(null),pe='custom'===oe&&re?re:(te.find(e=>e.id===oe)??te[0]).period,ye=(0,n.useMemo)(()=>z(pe,W,L,r,q),[pe.key,W,L,q,Math.floor(r.getTime()/6e4)]),ge=ye.some(e=>null!=e.rate),xe='tips'===pe.kind,fe=ye.reduce((e,s)=>({c:e.c+s.confirmed,p:e.p+s.pending,s:e.s+s.shifts,g:e.g+(s.gross??0)}),{c:0,p:0,s:0,g:0}),me=ye.filter(e=>e.pending>0).length,be=`${p.name}: hours ${(0,f.rangeText)(pe.start,pe.end)}`,je=`hours-${pe.start}-to-${pe.end}`,we=e=>{he(e),setTimeout(()=>he(null),6e3)};return(0,v.jsxs)(i.default,{style:{gap:10},testID:"payroll-hours",children:['none'===A?(0,v.jsxs)(h.Banner,{kind:"warn",title:"Pay dates not set up",children:[(0,v.jsx)(h.Muted,{children:"Using calendar months for now."}),(0,v.jsx)(h.Button,{small:!0,kind:"ghost",label:"Set your pay dates \u203a",onPress:()=>e('more','paysettings')})]}):null,(0,v.jsxs)(h.Row,{wrap:!0,gap:6,children:[te.map(e=>(0,v.jsx)(h.Chip,{label:e.label,sub:e.sub,selected:oe===e.id,onPress:()=>{ne(e.id),ie(!1)}},e.id)),(0,v.jsx)(h.Chip,{label:"Custom dates",sub:re&&'custom'===oe?(0,f.rangeText)(re.start,re.end):'Pick any range',selected:'custom'===oe,onPress:()=>ie(!ae)})]}),ae?(0,v.jsx)(U,{onSet:e=>{de(e),ne('custom'),ie(!1)}}):null,(0,v.jsx)(h.Card,{highlight:b.colours.gold,children:(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,v.jsxs)(i.default,{style:{flexShrink:1,minWidth:0},children:[(0,v.jsxs)(h.T,{weight:"bold",size:18,children:[(0,f.rangeText)(pe.start,pe.end)," ",pe.end.slice(0,4)]}),(0,v.jsxs)(h.Muted,{children:[(0,f.ukDate)(pe.start)," to ",(0,f.ukDate)(pe.end),pe.payday?` \xb7 ${pe.payday>=t?'pays':'paid'} ${(0,f.dayMonth)(pe.payday)}`:'',xe?' \xb7 tips period':'wage'===pe.kind?' \xb7 wage period':'']})]}),(0,v.jsxs)(i.default,{style:{alignItems:'flex-end'},children:[(0,v.jsx)(h.T,{size:22,weight:"bold",colour:b.colours.gold,children:(0,l.durText)(fe.c)}),(0,v.jsxs)(h.Muted,{children:["approved",fe.p?` \xb7 ${(0,l.durText)(fe.p)} pending`:'']})]})]})}),$?(0,v.jsx)(i.default,{style:{alignItems:'center'},children:(0,v.jsx)(h.Button,{testID:"add-past-shift",label:"Add past shift",accessibilityLabel:"Add past shift",onPress:()=>R(!0),style:{minHeight:48,minWidth:180}})}):null,me?(0,v.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:"Sign off pending hours",onPress:()=>e('more','signoff'),testID:"pending-banner",children:(0,v.jsxs)(i.default,{style:{backgroundColor:b.colours.amberBg,borderRadius:12,padding:12,borderLeftWidth:6,borderLeftColor:b.colours.amber,gap:4},children:[(0,v.jsxs)(h.T,{weight:"bold",colour:b.colours.amber,children:["\u26a0 ",(0,l.durText)(fe.p)," still waiting for approval (",me," ",1===me?'person':'people',")"]}),(0,v.jsx)(h.T,{size:14,children:"Pending hours are not in the totals or the exports' confirmed columns. Sign them off first so everyone is paid in full."}),(0,v.jsx)(h.T,{weight:"semibold",colour:b.colours.gold,children:"Sign off hours \u203a"})]})}):(0,v.jsx)(h.Banner,{kind:"success",title:"All hours in this period are signed off"}),(0,v.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,v.jsx)(h.Button,{small:!0,kind:"success",label:"Copy for spreadsheet",testID:"copy-tsv",onPress:async()=>{const e=await Y(N(V(ye,pe,ge,xe)));we(e?`Copied ${ye.length} rows. Paste into the first cell of your spreadsheet.`:'Copy is not available here. Use Download CSV.')}}),(0,v.jsx)(h.Button,{small:!0,kind:"secondary",label:"Download CSV",onPress:()=>{(0,j.downloadText)(`${je}.csv`,F(V(ye,pe,ge,xe))),we('CSV downloaded (summary).')}}),(0,v.jsx)(h.Button,{small:!0,kind:"secondary",label:"Download CSV (daily detail)",onPress:()=>{(0,j.downloadText)(`${je}-daily.csv`,F(E(ye))),we('CSV downloaded (one line per shift).')}}),(0,v.jsx)(h.Button,{small:!0,kind:"secondary",label:"Print / PDF",onPress:()=>{const e=V(ye,pe,ge,xe);(0,j.printTable)(be,`${(0,f.ukDate)(pe.start)} to ${(0,f.ukDate)(pe.end)} \xb7 confirmed hours only in the totals \xb7 printed ${(0,f.ukDate)(t)}`,e[0],e.slice(1))}})]}),ce?(0,v.jsx)(h.Banner,{kind:"success",title:ce}):null,J?(0,v.jsxs)(i.default,{testID:"hours-table",style:{gap:10},children:[ye.map(e=>{const s=!!le[e.person.id];return(0,v.jsxs)(i.default,{style:{borderRadius:16,borderWidth:1,borderColor:'rgba(212,175,106,0.45)',backgroundColor:b.colours.surface,padding:12,gap:10},children:[(0,v.jsx)(u.HoursSummaryCard,{name:O(e.person),role:H(e.person),approved:e.confirmed,pending:e.pending,rate:e.rate}),(0,v.jsx)(h.Button,{kind:"secondary",testID:`hours-open-${e.person.id}`,label:s?'Hide shifts':`Show ${e.days.length} ${1===e.days.length?'shift':'shifts'}`,accessibilityLabel:`${s?'Hide':'Show'} ${O(e.person)}'s shifts`,onPress:()=>ue({...le,[e.person.id]:!s}),style:{minHeight:48}}),s?se(e):null]},e.person.id)}),(0,v.jsxs)(h.Muted,{center:!0,children:["Total: ",(0,l.durText)(fe.c)," approved",ge?` \xb7 ${(0,x.gbp)(fe.g)} gross`:'',fe.p?` \xb7 ${(0,l.durText)(fe.p)} pending`:'']})]}):(0,v.jsx)(o.WideTable,{children:(0,v.jsxs)(i.default,{testID:"hours-table",children:[(0,v.jsx)(o.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:b.colours.border,paddingBottom:4},children:['Name','Shifts','Approved','Pending',xe?'Tips h':'Hours',ge?'Rate':'',ge?'Gross':''].map((e,s)=>(0,v.jsx)(h.T,{size:12,weight:"semibold",colour:b.colours.gold,style:{width:_[s]},children:e},s))}),ye.map(e=>{const s=!!le[e.person.id];return(0,v.jsxs)(i.default,{style:{borderBottomWidth:1,borderColor:'#222'},children:[(0,v.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:`${O(e.person)} daily hours`,onPress:()=>ue({...le,[e.person.id]:!s}),style:{paddingVertical:7},children:(0,v.jsxs)(o.TRow,{heads:['Name','Shifts','Approved','Pending',xe?'Tips h':'Hours',ge?'Rate':'',ge?'Gross':''],children:[(0,v.jsxs)(i.default,{style:{width:_[0]},children:[(0,v.jsxs)(h.T,{size:14,weight:"semibold",numberOfLines:1,children:[s?'\u25be':'\u25b8'," ",O(e.person)]}),(0,v.jsx)(h.Muted,{children:H(e.person)})]}),(0,v.jsx)(h.T,{size:14,style:{width:_[1]},children:e.shifts}),(0,v.jsx)(h.T,{size:14,weight:"semibold",style:{width:_[2]},children:(0,l.durText)(e.confirmed)}),(0,v.jsx)(h.T,{size:14,weight:e.pending?'bold':'regular',colour:e.pending?b.colours.amber:b.colours.muted,style:{width:_[3]},children:e.pending?`\u26a0 ${(0,l.durText)(e.pending)}`:'0m'}),(0,v.jsx)(h.T,{size:14,style:{width:_[4]},children:xe?(0,f.decH)(e.confirmed):(0,l.durText)(e.confirmed)}),(0,v.jsx)(h.T,{size:14,colour:b.colours.muted,style:{width:_[5]},children:ge?null!=e.rate?(0,x.gbp)(e.rate):'\u2013':''}),(0,v.jsxs)(h.T,{size:14,weight:"semibold",style:{width:_[6]},children:[ge?null!=e.gross?(0,x.gbp)(e.gross):'\u2013':'',ge&&null!=e.rate&&e.pending?(0,v.jsx)(h.T,{size:12,colour:b.colours.amber,children:`\n+ ${(0,x.gbp)(Math.round(e.pending/60*e.rate))} pending`}):null]})]})}),s?se(e):null]},e.person.id)}),(0,v.jsxs)(o.TRow,{heads:['','Shifts','Approved','Pending',xe?'Tips h':'Hours','',ge?'Gross':''],style:{paddingVertical:8,borderTopWidth:2,borderColor:b.colours.gold},children:[(0,v.jsxs)(h.T,{size:14,weight:"bold",style:{width:_[0]},children:["Total (",ye.length,")"]}),(0,v.jsx)(h.T,{size:14,weight:"bold",style:{width:_[1]},children:fe.s}),(0,v.jsx)(h.T,{size:14,weight:"bold",colour:b.colours.gold,style:{width:_[2]},children:(0,l.durText)(fe.c)}),(0,v.jsx)(h.T,{size:14,weight:"bold",colour:fe.p?b.colours.amber:b.colours.muted,style:{width:_[3]},children:(0,l.durText)(fe.p)}),(0,v.jsx)(h.T,{size:14,weight:"bold",style:{width:_[4]},children:xe?(0,f.decH)(fe.c):(0,l.durText)(fe.c)}),(0,v.jsx)(h.T,{size:14,style:{width:_[5]},children:" "}),(0,v.jsx)(h.T,{size:14,weight:"bold",style:{width:_[6]},children:ge?(0,x.gbp)(fe.g):''})]})]})}),K?(0,v.jsx)(c.OverrideSheet,{a:K,staffId:K.staffId,date:K.date,onClose:()=>Q(null)}):null,X?(0,v.jsx)(u.RemoveShiftSheet,{a:X,who:{name:w,id:T},onClose:()=>{Z(null),we('Removed from hours. It is kept in the history.')}}):null,B?(0,v.jsx)(D.AddPastShiftSheet,{onClose:()=>R(!1),onSaved:()=>{R(!1),we('Saved. It counts in the hours and pay.')}}):null,(0,v.jsxs)(h.Muted,{children:["Tap a name for each day. Hours read 37h 30m. The export also has decimal hours (37.50) and h:mm for your spreadsheet. Paid hours = clock out \u2212 clock in \u2212 break. ",ge?'Gross is before tax, from confirmed hours only.':'Rates and gross show once you sign in with your personal link.']}),xe?(0,v.jsx)(h.Button,{kind:"success",label:"Tips day: split tips for this period \u203a",onPress:()=>e('more','tipsday')}):null]})},_e.TipsDay=function({go:e}){const{rid:t,today:r,now:a}=(0,P.useCtx)(6e4),{pay:u,source:c}=(0,k.useVenuePay)(t),p=(0,y.useOwner)(e=>e.staff),T=(0,y.useOwner)(e=>(0,y.liveAttendance)(e.attendance)),C=(0,y.useOwner)(e=>e.tronc),S=(0,f.nextToPay)(u,'tips',r),[D,M]=(0,n.useState)(0),$=(0,f.tipsPeriod)(u,S.period.start,D),[B,R]=(0,n.useState)(''),[I,W]=(0,n.useState)({}),[L,V]=(0,n.useState)(null),E=(0,n.useMemo)(()=>z($,p,T,a,{}),[$.key,p,T]),G=e=>'owner'===e.role&&!C.includeOwner||'manager'===e.role&&!C.includeManagers,U=e=>I[e.id]??G(e),_=E.filter(e=>e.confirmed>0||e.pending>0),q=Math.round(100*Number(B.replace(/[\xa3,\s]/g,''))),J=Number.isFinite(q)&&q>0&&q<=1e8&&/^\s*\xa3?\s*[\d,]+(\.\d{0,2})?\s*$/.test(B),K=_.filter(e=>!U(e.person)&&e.confirmed>0),{amounts:Q}=(0,w.allocate)(J?q:0,K.map(e=>e.confirmed)),X={};K.forEach((e,s)=>{X[e.person.id]=Q[s]});const Z=K.reduce((e,s)=>e+s.confirmed,0),ee=Object.values(X).reduce((e,s)=>e+s,0),se=_.filter(e=>e.pending>0&&!U(e.person)),te=se.reduce((e,s)=>e+s.pending,0),oe=()=>[['Name','Role','Period start','Period end','Payday','Confirmed hours','Confirmed h:mm','Share %','Tips \xa3'],..._.map(e=>{const s=!U(e.person)&&e.confirmed>0;return[O(e.person),H(e.person),(0,f.ukDate)($.start),(0,f.ukDate)($.end),$.payday?(0,f.ukDate)($.payday):'',(0,f.decH)(e.confirmed),(0,f.hMm)(e.confirmed),s&&Z?(e.confirmed/Z*100).toFixed(2):'0.00',s?A(X[e.person.id]??0):U(e.person)?'excluded':'0.00']}),['TOTAL','',(0,f.ukDate)($.start),(0,f.ukDate)($.end),$.payday?(0,f.ukDate)($.payday):'',(0,f.decH)(Z),(0,f.hMm)(Z),Z?'100.00':'0.00',A(ee)]],ne=e=>{V(e),setTimeout(()=>V(null),6e3)};return(0,v.jsxs)(i.default,{style:{gap:10},testID:"tips-day",children:[(0,v.jsx)(h.Banner,{kind:"info",title:"Saving payouts and notifying staff are coming next",children:"For now this works out the split and exports it. Nothing is saved to the team, sent or paid."}),'none'===c?(0,v.jsxs)(h.Banner,{kind:"warn",title:"Tips dates not set up",children:[(0,v.jsx)(h.Muted,{children:"Using weekly tips for now."}),(0,v.jsx)(h.Button,{small:!0,kind:"ghost",label:"Set your pay dates \u203a",onPress:()=>e('more','paysettings')})]}):null,(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(h.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",disabled:D<=-6,onPress:()=>M(D-1)}),(0,v.jsxs)(i.default,{style:{alignItems:'center',flex:1},children:[(0,v.jsx)(h.T,{weight:"bold",size:18,children:(0,f.rangeText)($.start,$.end)}),(0,v.jsxs)(h.Muted,{children:[(0,f.ukDate)($.start)," to ",(0,f.ukDate)($.end)," \xb7 ",$.payday>=r?'paid':'was paid'," ",(0,f.dayMonth)($.payday)]}),0===D?(0,v.jsx)(h.Badge,{kind:"gold",label:"Paid next"}):null]}),(0,v.jsx)(h.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:D>=1,onPress:()=>M(D+1)})]}),(0,v.jsxs)(h.Card,{highlight:b.colours.gold,children:[(0,v.jsx)(h.T,{weight:"semibold",children:"Total tips to share"}),(0,v.jsxs)(h.Row,{style:{alignItems:'center'},children:[(0,v.jsx)(h.T,{size:28,weight:"bold",colour:b.colours.gold,children:"\xa3"}),(0,v.jsx)(s.TextInput,{testID:"tips-total",accessibilityLabel:"Total tips in pounds",value:B,onChangeText:R,placeholder:"0.00",placeholderTextColor:"#7D776C",keyboardType:"decimal-pad",style:[h.styles.input,{flex:1,fontSize:26,fontWeight:'700'}]})]}),B&&!J?(0,v.jsx)(h.T,{size:13,colour:b.colours.red,children:"Enter an amount like 1250.00"}):(0,v.jsx)(h.Muted,{children:"Shared by confirmed hours: share = total \xd7 (their hours \xf7 everyone's hours). Rounded to the penny; leftover pennies go to the largest shares so it adds up exactly."})]}),se.length?(0,v.jsx)(d.default,{accessibilityRole:"button",onPress:()=>e('more','signoff'),testID:"tips-pending",children:(0,v.jsxs)(i.default,{style:{backgroundColor:b.colours.redBg,borderRadius:12,padding:12,borderLeftWidth:6,borderLeftColor:b.colours.red,gap:4},children:[(0,v.jsxs)(h.T,{weight:"bold",colour:b.colours.red,children:["\u26a0 Don't pay out yet: ",(0,l.durText)(te)," not approved yet"]}),(0,v.jsxs)(h.T,{size:14,children:[se.map(e=>`${O(e.person)} (${(0,l.durText)(e.pending)})`).join(', '),". Pending hours are left out of the split, so these people would get less than they should."]}),(0,v.jsx)(h.T,{weight:"semibold",colour:b.colours.gold,children:"Sign off hours \u203a"})]})}):_.length?(0,v.jsx)(h.Banner,{kind:"success",title:"All hours in this fortnight are signed off"}):null,(0,v.jsx)(o.WideTable,{children:(0,v.jsxs)(i.default,{testID:"tips-table",children:[(0,v.jsx)(o.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:b.colours.border,paddingBottom:4},children:['Include','Name','Confirmed','Share','Tips'].map((e,s)=>(0,v.jsx)(h.T,{size:12,weight:"semibold",colour:b.colours.gold,style:{width:[64,150,100,64,84][s]},children:e},e))}),_.map(e=>{const s=U(e.person),t=X[e.person.id]??0;return(0,v.jsxs)(o.TRow,{heads:['Include','Name','Confirmed','Share','Tips'],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222',opacity:s?.5:1},children:[(0,v.jsx)(d.default,{accessibilityRole:"checkbox",accessibilityState:{checked:!s},accessibilityLabel:`Include ${O(e.person)}`,onPress:()=>W({...I,[e.person.id]:!s}),style:{width:64,minHeight:44,justifyContent:'center'},children:(0,v.jsx)(i.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:s?b.colours.muted:b.colours.ok,backgroundColor:s?'transparent':b.colours.okBg,alignItems:'center',justifyContent:'center'},children:(0,v.jsx)(h.T,{size:14,colour:b.colours.ok,children:s?'':'\u2713'})})}),(0,v.jsxs)(i.default,{style:{width:150},children:[(0,v.jsx)(h.T,{size:14,weight:"semibold",numberOfLines:1,children:O(e.person)}),(0,v.jsxs)(h.Muted,{numberOfLines:1,children:[s?'Excluded':H(e.person),e.pending?` \xb7 \u26a0 ${(0,f.decH)(e.pending)} h pending`:'']})]}),(0,v.jsxs)(h.T,{size:14,style:{width:80},children:[(0,f.decH)(e.confirmed)," h"]}),(0,v.jsx)(h.T,{size:14,colour:b.colours.muted,style:{width:64},children:!s&&Z?`${(e.confirmed/Z*100).toFixed(1)}%`:'\u2013'}),(0,v.jsx)(h.T,{size:15,weight:"bold",colour:s?b.colours.muted:b.colours.gold,style:{width:84},children:s?'\u2013':(0,x.gbp)(t)})]},e.person.id)}),(0,v.jsxs)(o.TRow,{heads:['','','Confirmed','Share','Tips'],style:{paddingVertical:8,borderTopWidth:2,borderColor:b.colours.gold},children:[(0,v.jsx)(h.T,{size:14,style:{width:64},children:" "}),(0,v.jsxs)(h.T,{size:14,weight:"bold",style:{width:150},children:["Total (",K.length," people)"]}),(0,v.jsxs)(h.T,{size:14,weight:"bold",style:{width:80},children:[(0,f.decH)(Z)," h"]}),(0,v.jsx)(h.T,{size:14,style:{width:64},children:Z?'100%':'\u2013'}),(0,v.jsx)(h.T,{size:15,weight:"bold",colour:J&&ee===q?b.colours.ok:b.colours.text,style:{width:84},children:(0,x.gbp)(ee)})]})]})}),_.length?null:(0,v.jsx)(h.Muted,{children:"No clocked hours in this fortnight yet."}),J&&Z?(0,v.jsxs)(h.Muted,{children:["Check: ",K.length," shares add up to ",(0,x.gbp)(ee)," of ",(0,x.gbp)(q)," ",ee===q?'\u2713':'',". \xa3",(q/100/(Z/60)).toFixed(4)," per confirmed hour."]}):null,(0,v.jsxs)(h.Muted,{children:["Owner ",C.includeOwner?'included':'left out'," and managers ",C.includeManagers?'included':'left out'," by default (your tipping policy in Tips). Tick or untick anyone for this split."]}),(0,v.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,v.jsx)(h.Button,{small:!0,kind:"success",label:"Copy for spreadsheet",testID:"tips-copy",disabled:!J,onPress:async()=>{const e=await Y(N(oe()));ne(e?'Copied. Paste into the first cell of your spreadsheet.':'Copy is not available here. Use Download CSV.')}}),(0,v.jsx)(h.Button,{small:!0,kind:"secondary",label:"Download CSV",disabled:!J,onPress:()=>{(0,j.downloadText)(`tips-${$.start}-to-${$.end}.csv`,F(oe())),ne('CSV downloaded.')}}),(0,v.jsx)(h.Button,{small:!0,kind:"secondary",label:"Print / PDF",disabled:!J,onPress:()=>{const e=oe();(0,j.printTable)(`Tips ${(0,f.rangeText)($.start,$.end)} (paid ${(0,f.dayMonth)($.payday)})`,`Total ${(0,x.gbp)(q)} shared by confirmed hours${se.length?` \xb7 WARNING ${(0,f.decH)(te)} h not signed off`:''}`,e[0],e.slice(1))}})]}),L?(0,v.jsx)(h.Banner,{kind:"success",title:L}):null]})},_e.PaydaysCard=function({go:e}){const{rid:s,today:t}=(0,P.useCtx)(6e4),{pay:o,source:n}=(0,k.useVenuePay)(s),d=(0,f.nextToPay)(o,'tips',t).period,a=(0,f.nextToPay)(o,'wage',t).period;return(0,v.jsxs)(i.default,{testID:"paydays-card",style:{backgroundColor:b.colours.surface,borderRadius:16,borderWidth:1,borderColor:b.colours.hairline,padding:16,gap:8},children:[(0,v.jsx)(r.CardHeading,{right:'none'===n?(0,v.jsx)(h.Badge,{kind:"amber",label:"Not set up"}):null,children:"Paydays"}),(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,v.jsxs)(h.T,{children:["Next tips payday: ",(0,v.jsx)(h.T,{weight:"semibold",colour:b.colours.goldLight,children:d.payday===t?'today':(0,f.dayMonth)(d.payday)})]}),(0,v.jsx)(h.Muted,{children:(0,f.rangeText)(d.start,d.end)})]}),(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,v.jsxs)(h.T,{children:["Next payday: ",(0,v.jsx)(h.T,{weight:"semibold",colour:b.colours.goldLight,children:a.payday===t?'today':(0,f.dayMonth)(a.payday)})]}),(0,v.jsxs)(h.Muted,{children:["period ",(0,f.rangeText)(a.start,a.end)]})]}),(0,v.jsxs)(r.ActionGrid,{testID:"paydays-actions",children:[(0,v.jsx)(r.ActionTile,{primary:!0,icon:"payroll",label:"Payroll hours",sub:"Copy or export",onPress:()=>e('more','hours'),testID:"paydays-hours"}),(0,v.jsx)(r.ActionTile,{icon:"tips",label:"Tips day",sub:"Share out tips",onPress:()=>e('more','tipsday'),testID:"paydays-tips"})]}),'settings'!==n?(0,v.jsx)(h.Button,{small:!0,kind:"ghost",label:"Pay & tips settings",onPress:()=>e('more','paysettings'),style:{alignSelf:'flex-start'}}):null]})},_e.MyPeriods=function({staffId:e}){const{rid:s,today:t,now:o,meId:n}=(0,P.useCtx)(6e4),r=e??n,{pay:d}=(0,k.useVenuePay)(s),a=(0,y.useOwner)(e=>(0,y.liveAttendance)(e.attendance)),u=(0,y.useOwner)(e=>e.staff.find(e=>e.id===r)),c=(0,f.wagePeriod)(d,t,0),p=(0,f.tipsPeriod)(d,t,0),x=e=>u?z(e,[u],a,o,{})[0]??null:null,j=(e,s,o)=>(0,v.jsxs)(i.default,{style:{flexGrow:1,flexBasis:160,backgroundColor:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.border,padding:12,gap:2},children:[(0,v.jsx)(h.T,{size:13,weight:"semibold",colour:b.colours.gold,children:e.toUpperCase()}),(0,v.jsxs)(h.Muted,{children:[(0,f.rangeText)(s.start,s.end)," \xb7 ",s.payday>=t?'paid':'was paid'," ",(0,f.dayMonth)(s.payday)]}),(0,v.jsx)(h.T,{size:24,weight:"bold",children:(0,l.durText)(o?.confirmed??0)}),(0,v.jsxs)(h.Muted,{children:["approved \xb7 ",o?.shifts??0," shifts"]}),o?.pending?(0,v.jsxs)(h.T,{size:13,colour:b.colours.amber,children:["+ ",(0,l.durText)(o.pending)," waiting for approval"]}):null]},e);return(0,v.jsx)(h.Row,{wrap:!0,gap:8,style:{alignItems:'stretch'},children:[j('This pay period',c,x(c)),j('This tips fortnight',p,x(p))]})};var s=_r(_d[0]),t=_r(_d[1]),o=_r(_d[2]),n=_r(_d[3]),r=_r(_d[4]);_r(_d[5]);var d=e(_r(_d[6])),a=e(_r(_d[7])),i=e(_r(_d[8])),l=_r(_d[9]),u=_r(_d[10]),c=_r(_d[11]),h=_r(_d[12]),p=_r(_d[13]),y=_r(_d[14]),x=_r(_d[15]),f=_r(_d[16]),b=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),T=_r(_d[20]),P=_r(_d[21]),k=_r(_d[22]),C=_r(_d[23]),S=_r(_d[24]),D=_r(_d[25]),v=_r(_d[26]);const M={weekly:'Weekly',fortnightly:'Fortnightly',monthly:'Monthly'},$={none:'Keep the date',before:'Friday before',after:'Monday after'};const B=e=>`${e}${e%10==1&&11!==e?'st':e%10==2&&12!==e?'nd':e%10==3&&13!==e?'rd':'th'}`;function R({label:e,day:s,period:t}){return(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,v.jsxs)(h.T,{children:[e,": ",(0,v.jsx)(h.T,{weight:"bold",colour:b.colours.gold,children:(0,f.dayMonth)(s)})]}),(0,v.jsx)(h.Muted,{children:(0,f.rangeText)(t.start,t.end)})]})}const I=e=>{if(!e)return'';const s=new Date(e);return`${String(s.getHours()).padStart(2,'0')}:${String(s.getMinutes()).padStart(2,'0')}`};function z(e,s,t,o,n){const r=t.filter(s=>s.in&&s.date>=e.start&&s.date<=e.end);return s.map(e=>{const s=r.filter(s=>s.staffId===e.id).sort((e,s)=>e.date.localeCompare(s.date)||(e.in??'').localeCompare(s.in??'')).map(e=>{const s=(0,P.paidMins)(e,o),t=(0,y.attStatus)(e);return{a:e,date:e.date,inT:I(e.in),outT:I(e.out),brk:s.brk,paid:s.paid,status:'open'===t?'On now':'awaiting'===t?'Pending':'Confirmed'}}),t=e=>s.filter(s=>s.status===e).reduce((e,s)=>e+s.paid,0),d=t('Confirmed'),a=n[e.id];return{person:e,confirmed:d,pending:t('Pending'),open:t('On now'),shifts:s.filter(e=>'On now'!==e.status).length,days:s,rate:a,gross:null!=a?Math.round(d/60*a):void 0}}).filter(e=>e.days.length>0||e.person.active&&'owner'!==e.person.role)}const H=e=>`${y.ROLE_LABEL[e.role]}${e.job?` \xb7 ${e.job}`:''}`,O=e=>e.name.replace(' (example)',''),A=e=>null==e?'':(e/100).toFixed(2),W=e=>e.replace(/[\t\r\n]+/g,' '),L=e=>/[",\n]/.test(e)?`"${e.replace(/"/g,'""')}"`:e,N=e=>e.map(e=>e.map(W).join('\t')).join('\n'),F=e=>e.map(e=>e.map(L).join(',')).join('\r\n');function V(e,s,t,o){const n=['Name','Role','Period start','Period end','Confirmed hours','Confirmed h:mm','Pending hours','Pending h:mm','Shifts',...o?['Tips hours']:[],...t?['Rate \xa3/h','Gross \xa3']:[]],r=e.map(e=>[O(e.person),H(e.person),(0,f.ukDate)(s.start),(0,f.ukDate)(s.end),(0,f.decH)(e.confirmed),(0,f.hMm)(e.confirmed),(0,f.decH)(e.pending),(0,f.hMm)(e.pending),String(e.shifts),...o?[(0,f.decH)(e.confirmed)]:[],...t?[A(e.rate),A(e.gross)]:[]]),d=e.reduce((e,s)=>({c:e.c+s.confirmed,p:e.p+s.pending,s:e.s+s.shifts,g:e.g+(s.gross??0)}),{c:0,p:0,s:0,g:0});return[n,...r,['TOTAL','',(0,f.ukDate)(s.start),(0,f.ukDate)(s.end),(0,f.decH)(d.c),(0,f.hMm)(d.c),(0,f.decH)(d.p),(0,f.hMm)(d.p),String(d.s),...o?[(0,f.decH)(d.c)]:[],...t?['',A(d.g)]:[]]]}function E(e){return[['Name','Role','Date','In','Out','Break mins','Paid hours','Paid h:mm','Status'],...e.flatMap(e=>e.days.map(s=>[O(e.person),H(e.person),(0,f.ukDate)(s.date),s.inT,s.outT,'On now'===s.status?'':String(s.brk),'On now'===s.status?'':(0,f.decH)(s.paid),'On now'===s.status?'':(0,f.hMm)(s.paid),s.status]))]}async function Y(e){if('undefined'==typeof document)return!1;try{if(navigator.clipboard?.writeText)return await navigator.clipboard.writeText(e),!0}catch{}try{const s=document.createElement('textarea');s.value=e,s.style.position='fixed',s.style.opacity='0',document.body.appendChild(s),s.select();const t=document.execCommand('copy');return s.remove(),t}catch{return!1}}function G(e,s){const t=(0,f.nextToPay)(e,'wage',s),o=(0,f.nextToPay)(e,'tips',s),n=(0,f.wagePeriod)(e,t.period.start,-1),r=(0,f.tipsPeriod)(e,o.period.start,-1),d=e=>e.payday>=s?e.payday===s?'Pays today':`Pays ${(0,f.dayMonth)(e.payday)}`:`Paid ${(0,f.dayMonth)(e.payday)}`;return[{id:'wage',label:`Wages ${(0,f.rangeText)(t.period.start,t.period.end)}`,sub:d(t.period),period:t.period},{id:'wagePrev',label:`Wages ${(0,f.rangeText)(n.start,n.end)}`,sub:d(n),period:n},{id:'tips',label:`Tips ${(0,f.rangeText)(o.period.start,o.period.end)}`,sub:d(o.period),period:o.period},{id:'tipsPrev',label:`Tips ${(0,f.rangeText)(r.start,r.end)}`,sub:d(r),period:r}]}function U({onSet:e}){const[s,o]=(0,n.useState)(''),[r,d]=(0,n.useState)(''),a=(0,f.parseUk)(s),l=(0,f.parseUk)(r),u=!!a&&!!l&&l>=a&&(0,f.plusDays)(a,92)>=l;return(0,v.jsxs)(h.Row,{wrap:!0,gap:6,style:{alignItems:'flex-end'},children:[(0,v.jsx)(i.default,{style:{flexBasis:130,flexGrow:1},children:(0,v.jsx)(h.Field,{label:"From (DD/MM/YYYY)",value:s,onChangeText:e=>o((0,t.slashDate)(e,s)),placeholder:"23/10/2026",keyboardType:"numbers-and-punctuation",maxLength:10})}),(0,v.jsx)(i.default,{style:{flexBasis:130,flexGrow:1},children:(0,v.jsx)(h.Field,{label:"To (DD/MM/YYYY)",value:r,onChangeText:e=>d((0,t.slashDate)(e,r)),placeholder:"22/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10})}),(0,v.jsx)(h.Button,{small:!0,kind:"success",label:"Show",disabled:!u,onPress:()=>u&&e((0,f.customPeriod)(a,l))}),s&&r&&!u?(0,v.jsx)(h.T,{size:13,colour:b.colours.red,children:"Use two dates, the second on or after the first, up to 3 months apart."}):null]})}const _=[150,54,100,90,48,62,70]},1185,[827,1059,1180,34,1186,236,402,426,102,1188,1189,1190,794,831,891,867,1060,821,930,1193,1181,1084,1061,1191,872,1192,25]); __d(function(g,_r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ActionTile=function({label:e,sub:r,icon:c,onPress:u,primary:h,tone:b="gold",count:f,testID:x,accessibilityLabel:y}){const j='blue'===b?i.colours.blue:i.colours.gold;return(0,s.jsxs)(t.default,{testID:x,accessibilityRole:"button",accessibilityLabel:y??(r?`${e}, ${r}`:e),onPress:u,style:({pressed:e})=>({flex:1,minWidth:0,minHeight:68,borderRadius:16,borderWidth:1,borderColor:h?i.colours.accentBorder:i.colours.hairline,backgroundColor:e?i.colours.tilePressed:i.colours.tile,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:12,paddingHorizontal:14,paddingVertical:12}),children:[(0,s.jsx)(o.default,{style:{width:40,height:40,borderRadius:12,alignItems:'center',justifyContent:'center',backgroundColor:h?i.colours.accentBg:'rgba(255,255,255,0.04)',borderWidth:1,borderColor:h?i.colours.accentBorder:i.colours.hairline},children:(0,s.jsx)(l.Icon,{name:c,size:21,colour:j})}),(0,s.jsxs)(o.default,{style:{flexShrink:1,minWidth:0},children:[(0,s.jsx)(n.T,{size:15,weight:"semibold",numberOfLines:1,colour:i.colours.text,children:e}),r?(0,s.jsx)(n.T,{size:12,numberOfLines:1,colour:i.colours.muted,children:r}):null]}),f?(0,s.jsx)(o.default,{style:{backgroundColor:i.colours.amber,borderRadius:10,minWidth:22,paddingHorizontal:6},children:(0,s.jsx)(n.T,{size:12,weight:"bold",colour:i.colours.onGold,center:!0,children:f})}):null]})},_e.ActionGrid=function({children:e,testID:t="action-grid"}){const l=r.default.Children.toArray(e).filter(Boolean),i=[];for(let e=0;e(0,s.jsxs)(o.default,{style:{flexDirection:'row',gap:12},children:[e,1===e.length?(0,s.jsx)(o.default,{style:{flex:1}}):null]},r))})},Object.defineProperty(_e,"CardHeading",{enumerable:!0,get:function(){return c}});var r=e(_r(d[0])),t=e(_r(d[1])),o=e(_r(d[2])),l=_r(d[3]),i=_r(d[4]),n=_r(d[5]),s=_r(d[6]);const c=({children:e,right:r})=>(0,s.jsxs)(o.default,{style:{flexDirection:'row',alignItems:'center',justifyContent:'space-between'},children:[(0,s.jsx)(n.T,{size:12,weight:"semibold",colour:i.colours.goldMuted,style:{letterSpacing:1.6,textTransform:'uppercase'},children:e}),r]})},1186,[34,402,102,1187,821,794,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Icon=function({name:l,size:x=22,colour:t}){const n={stroke:t,strokeWidth:2,fill:'none',strokeLinecap:'round',strokeLinejoin:'round'};return(0,e.jsxs)(h.default,{width:x,height:x,viewBox:"0 0 24 24",children:['home'===l?(0,e.jsx)(s.Path,{d:"M3 11l9-7 9 7v9a1 1 0 0 1-1 1h-5v-6H9v6H4a1 1 0 0 1-1-1z",...n}):null,'signoff'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"11",r:"8",...n}),(0,e.jsx)(s.Path,{d:"M11 6.5V11l3 2",...n}),(0,e.jsx)(s.Path,{d:"M15.5 19.5l2 2 4-4.2",...n})]}):null,'orders'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"5",y:"3",width:"14",height:"18",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M9 8h6M9 12h6M9 16h4",...n})]}):null,'bookings'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4",...n})]}):null,'forecast'===l?(0,e.jsx)(s.Path,{d:"M4 20V10M10 20V4M16 20v-7M22 20H2",...n}):null,'more'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"5",cy:"12",r:"1.6",fill:t}),(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"1.6",fill:t}),(0,e.jsx)(s.Circle,{cx:"19",cy:"12",r:"1.6",fill:t})]}):null,'search'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"11",r:"7",...n}),(0,e.jsx)(s.Path,{d:"M20 20l-4-4",...n})]}):null,'bell'===l?(0,e.jsx)(s.Path,{d:"M6 16V11a6 6 0 0 1 12 0v5l2 2H4zM10 20a2 2 0 0 0 4 0",...n}):null,'chat'===l?(0,e.jsx)(s.Path,{d:"M4 5h16v11H9l-5 4z",...n}):null,'clock'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M12 7v5l3 2",...n})]}):null,'user'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"8",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M4 21a8 8 0 0 1 16 0",...n})]}):null,'walkin'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"13",cy:"4.5",r:"1.8",...n}),(0,e.jsx)(s.Path,{d:"M10 21l2-6 3 3v3M9 12l2-4 4 1 2 3M11 8l-1 5",...n})]}):null,'calendarPlus'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4M12 13v5M9.5 15.5h5",...n})]}):null,'pause'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M10 9v6M14 9v6",...n})]}):null,'rain'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M7 15a4 4 0 0 1-.6-7.95A5.5 5.5 0 0 1 17 7.5a3.75 3.75 0 0 1 .5 7.5z",...n}),(0,e.jsx)(s.Path,{d:"M9 18l-1 2.5M13 18l-1 2.5M17 18l-1 2.5",...n})]}):null,'sun'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M12 2v2M12 20v2M2 12h2M20 12h2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4",...n})]}):null,'payroll'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"4",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M7 9h6M7 13h4M15 12.5a2 2 0 1 0 0 .01M7 17h10",...n})]}):null,'tips'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M14.5 9a2.5 2.5 0 0 0-5 0c0 2.5 0 4-1.5 6h7M9 12.5h4",...n})]}):null,'sparkle'===l?(0,e.jsx)(s.Path,{d:"M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8zM19 16l.7 1.8 1.8.7-1.8.7L19 21l-.7-1.8-1.8-.7 1.8-.7z",...n}):null,'platter'===l?(0,e.jsx)(e.Fragment,{children:(0,e.jsx)(s.Path,{d:"M3 15h18M5 15a7 7 0 0 1 14 0M12 6v2M2 18h20",...n})}):null,'check'===l?(0,e.jsx)(s.Path,{d:"M5 12.5l4.5 4.5L19 7.5",...n}):null,'alert'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M12 3l9.5 17h-19z",...n}),(0,e.jsx)(s.Path,{d:"M12 10v4M12 17.2v.1",...n})]}):null,'access'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"4.5",r:"1.8",...n}),(0,e.jsx)(s.Path,{d:"M11 7.5v6h5l2.5 5M11 10h5M8 11.5a5.5 5.5 0 1 0 7.5 6.5",...n})]}):null,'dog'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 10l1-5 3 3h4l3-3 1 5v4a5 5 0 0 1-5 5h-2a5 5 0 0 1-5-5z",...n}),(0,e.jsx)(s.Path,{d:"M10 13v.1M14 13v.1M11 16h2",...n})]}):null,'leaf'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 19c0-8 5-14 15-14 0 10-6 15-14 15",...n}),(0,e.jsx)(s.Path,{d:"M5 19l8-8",...n})]}):null,'table'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"4",y:"8",width:"16",height:"8",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M8 16v4M16 16v4M8 4v4M16 4v4",...n})]}):null,'bag'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 8h14l-1 12H6z",...n}),(0,e.jsx)(s.Path,{d:"M9 10V7a3 3 0 0 1 6 0v3",...n})]}):null,'phone'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"7",y:"2.5",width:"10",height:"19",rx:"2.5",...n}),(0,e.jsx)(s.Path,{d:"M11 18.5h2",...n})]}):null,'swap'===l?(0,e.jsx)(s.Path,{d:"M7 4L3 8l4 4M3 8h14M17 20l4-4-4-4M21 16H7",...n}):null,'box'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M3.5 8L12 4l8.5 4v8L12 20l-8.5-4z",...n}),(0,e.jsx)(s.Path,{d:"M3.5 8L12 12l8.5-4M12 12v8",...n})]}):null,'star'===l?(0,e.jsx)(s.Path,{d:"M12 3.5l2.6 5.4 5.9.8-4.3 4.1 1 5.8L12 16.8l-5.2 2.8 1-5.8L3.5 9.7l5.9-.8z",...n}):null,'userPlus'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"10",cy:"8",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M3 21a7 7 0 0 1 14 0M19 8v6M16 11h6",...n})]}):null,'gift'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3.5",y:"8.5",width:"17",height:"4",rx:"1",...n}),(0,e.jsx)(s.Path,{d:"M5 12.5V20h14v-7.5M12 8.5V20M12 8.5C10 8.5 7.5 7.8 7.5 5.8S10.5 4 12 8.5c1.5-4.5 4.5-4.7 4.5-2.7S14 8.5 12 8.5z",...n})]}):null,'tag'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M3.5 12.5V4h8.5l8.5 8.5-8.5 8.5z",...n}),(0,e.jsx)(s.Circle,{cx:"8",cy:"8.5",r:"1.4",...n})]}):null,'hanger'===l?(0,e.jsx)(s.Path,{d:"M12 7.5a2 2 0 1 1 2-2M12 7.5v2L3 16.5h18L12 9.5",...n}):null]})},r(d[0]);var l,s=r(d[1]),h=(l=s)&&l.__esModule?l:{default:l},e=r(d[2])},1187,[34,797,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Icon=function({name:l,size:x=22,colour:t}){const n={stroke:t,strokeWidth:2,fill:'none',strokeLinecap:'round',strokeLinejoin:'round'};return(0,e.jsxs)(h.default,{width:x,height:x,viewBox:"0 0 24 24",children:['home'===l?(0,e.jsx)(s.Path,{d:"M3 11l9-7 9 7v9a1 1 0 0 1-1 1h-5v-6H9v6H4a1 1 0 0 1-1-1z",...n}):null,'signoff'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"11",r:"8",...n}),(0,e.jsx)(s.Path,{d:"M11 6.5V11l3 2",...n}),(0,e.jsx)(s.Path,{d:"M15.5 19.5l2 2 4-4.2",...n})]}):null,'orders'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"5",y:"3",width:"14",height:"18",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M9 8h6M9 12h6M9 16h4",...n})]}):null,'rota'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4M7 14h4M13 14h4M7 18h6",...n})]}):null,'bookings'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4",...n})]}):null,'forecast'===l?(0,e.jsx)(s.Path,{d:"M4 20V10M10 20V4M16 20v-7M22 20H2",...n}):null,'more'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"5",cy:"12",r:"1.6",fill:t}),(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"1.6",fill:t}),(0,e.jsx)(s.Circle,{cx:"19",cy:"12",r:"1.6",fill:t})]}):null,'search'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"11",r:"7",...n}),(0,e.jsx)(s.Path,{d:"M20 20l-4-4",...n})]}):null,'bell'===l?(0,e.jsx)(s.Path,{d:"M6 16V11a6 6 0 0 1 12 0v5l2 2H4zM10 20a2 2 0 0 0 4 0",...n}):null,'chat'===l?(0,e.jsx)(s.Path,{d:"M4 5h16v11H9l-5 4z",...n}):null,'clock'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M12 7v5l3 2",...n})]}):null,'user'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"8",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M4 21a8 8 0 0 1 16 0",...n})]}):null,'walkin'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"13",cy:"4.5",r:"1.8",...n}),(0,e.jsx)(s.Path,{d:"M10 21l2-6 3 3v3M9 12l2-4 4 1 2 3M11 8l-1 5",...n})]}):null,'calendarPlus'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4M12 13v5M9.5 15.5h5",...n})]}):null,'pause'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M10 9v6M14 9v6",...n})]}):null,'rain'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M7 15a4 4 0 0 1-.6-7.95A5.5 5.5 0 0 1 17 7.5a3.75 3.75 0 0 1 .5 7.5z",...n}),(0,e.jsx)(s.Path,{d:"M9 18l-1 2.5M13 18l-1 2.5M17 18l-1 2.5",...n})]}):null,'sun'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M12 2v2M12 20v2M2 12h2M20 12h2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4",...n})]}):null,'payroll'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"4",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M7 9h6M7 13h4M15 12.5a2 2 0 1 0 0 .01M7 17h10",...n})]}):null,'tips'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M14.5 9a2.5 2.5 0 0 0-5 0c0 2.5 0 4-1.5 6h7M9 12.5h4",...n})]}):null,'sparkle'===l?(0,e.jsx)(s.Path,{d:"M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8zM19 16l.7 1.8 1.8.7-1.8.7L19 21l-.7-1.8-1.8-.7 1.8-.7z",...n}):null,'platter'===l?(0,e.jsx)(e.Fragment,{children:(0,e.jsx)(s.Path,{d:"M3 15h18M5 15a7 7 0 0 1 14 0M12 6v2M2 18h20",...n})}):null,'check'===l?(0,e.jsx)(s.Path,{d:"M5 12.5l4.5 4.5L19 7.5",...n}):null,'alert'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M12 3l9.5 17h-19z",...n}),(0,e.jsx)(s.Path,{d:"M12 10v4M12 17.2v.1",...n})]}):null,'access'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"4.5",r:"1.8",...n}),(0,e.jsx)(s.Path,{d:"M11 7.5v6h5l2.5 5M11 10h5M8 11.5a5.5 5.5 0 1 0 7.5 6.5",...n})]}):null,'dog'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 10l1-5 3 3h4l3-3 1 5v4a5 5 0 0 1-5 5h-2a5 5 0 0 1-5-5z",...n}),(0,e.jsx)(s.Path,{d:"M10 13v.1M14 13v.1M11 16h2",...n})]}):null,'leaf'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 19c0-8 5-14 15-14 0 10-6 15-14 15",...n}),(0,e.jsx)(s.Path,{d:"M5 19l8-8",...n})]}):null,'table'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"4",y:"8",width:"16",height:"8",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M8 16v4M16 16v4M8 4v4M16 4v4",...n})]}):null,'bag'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 8h14l-1 12H6z",...n}),(0,e.jsx)(s.Path,{d:"M9 10V7a3 3 0 0 1 6 0v3",...n})]}):null,'phone'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"7",y:"2.5",width:"10",height:"19",rx:"2.5",...n}),(0,e.jsx)(s.Path,{d:"M11 18.5h2",...n})]}):null,'swap'===l?(0,e.jsx)(s.Path,{d:"M7 4L3 8l4 4M3 8h14M17 20l4-4-4-4M21 16H7",...n}):null,'box'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M3.5 8L12 4l8.5 4v8L12 20l-8.5-4z",...n}),(0,e.jsx)(s.Path,{d:"M3.5 8L12 12l8.5-4M12 12v8",...n})]}):null,'star'===l?(0,e.jsx)(s.Path,{d:"M12 3.5l2.6 5.4 5.9.8-4.3 4.1 1 5.8L12 16.8l-5.2 2.8 1-5.8L3.5 9.7l5.9-.8z",...n}):null,'userPlus'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"10",cy:"8",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M3 21a7 7 0 0 1 14 0M19 8v6M16 11h6",...n})]}):null,'gift'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3.5",y:"8.5",width:"17",height:"4",rx:"1",...n}),(0,e.jsx)(s.Path,{d:"M5 12.5V20h14v-7.5M12 8.5V20M12 8.5C10 8.5 7.5 7.8 7.5 5.8S10.5 4 12 8.5c1.5-4.5 4.5-4.7 4.5-2.7S14 8.5 12 8.5z",...n})]}):null,'tag'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M3.5 12.5V4h8.5l8.5 8.5-8.5 8.5z",...n}),(0,e.jsx)(s.Circle,{cx:"8",cy:"8.5",r:"1.4",...n})]}):null,'hanger'===l?(0,e.jsx)(s.Path,{d:"M12 7.5a2 2 0 1 1 2-2M12 7.5v2L3 16.5h18L12 9.5",...n}):null]})},r(d[0]);var l,s=r(d[1]),h=(l=s)&&l.__esModule?l:{default:l},e=r(d[2])},1187,[34,797,25]); __d(function(_g,_r,i,_a,_m,e,d){"use strict";function t(t){const n=Math.max(0,Math.round(t||0)),o=Math.floor(n/60),r=n%60;return o?`${o}h ${String(r).padStart(2,'0')}m`:`${r}m`}function n(t){const n=Math.max(0,Math.round(t||0)),o=Math.floor(n/60),r=n%60;return[o?`${o} ${1===o?'hour':'hours'}`:'',r||!o?`${r} ${1===r?'minute':'minutes'}`:''].filter(Boolean).join(' ')}Object.defineProperty(e,'__esModule',{value:!0}),e.durText=t,e.durWords=n,e.isZeroShift=function(t){return!(!t.in||!t.out)&&Date.parse(t.out)-Date.parse(t.in)<6e4},Object.defineProperty(e,"isVoided",{enumerable:!0,get:function(){return o}}),e.shiftSentence=function(t,o){if('On now'===t.status)return`${o}, clocked in at ${t.inT}, still on shift.`;const r=t.zero?' Check: 0 minutes, clocked in and out at the same moment.':'';return`${o}, ${t.inT} to ${t.outT}, break ${n(t.brk)}, paid ${n(t.paid)}, ${'Approved'===t.status?'approved':'pending approval'}.${r}`},e.hoursSummary=function(n,o,r){const u=t=>null!=r?Math.round(t/60*r):null;return{approved:{mins:n,text:t(n),gross:u(n)},pending:{mins:o,text:t(o),gross:u(o)}}};const o=t=>!!t.voided},1188,[]); __d(function(g,r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ShiftCard=function({d:e,manager:t,onApprove:s,onEdit:d,onRemove:l}){const a='Confirmed'===e.status?'Approved':e.status,y=(0,u.isZeroShift)(e.a),x={date:e.date,dateText:b(e.date),inT:e.inT,outT:e.outT,brk:e.brk,paid:e.paid,status:a,zero:y};return(0,h.jsxs)(n.default,{testID:`shift-${e.a.id}`,style:{borderRadius:14,borderWidth:1,borderColor:y?c.colours.amber:'rgba(212,175,106,0.35)',backgroundColor:'#15130F',padding:12,gap:8,alignItems:'center'},children:[(0,h.jsxs)(n.default,{accessible:!0,accessibilityLabel:(0,u.shiftSentence)(x,p(e.date)),style:{alignItems:'center',gap:4,width:'100%'},children:[(0,h.jsx)(o.T,{size:16,weight:"bold",colour:c.colours.goldLight,center:!0,children:b(e.date)}),(0,h.jsx)(o.T,{size:17,weight:"semibold",center:!0,children:'On now'===e.status?`${e.inT} to now`:`${e.inT} to ${e.outT}`}),'On now'!==e.status?(0,h.jsxs)(o.T,{size:15,colour:c.colours.text,center:!0,children:["Break ",(0,u.durText)(e.brk)," \xb7 Paid ",(0,h.jsx)(o.T,{size:15,weight:"bold",colour:c.colours.gold,children:(0,u.durText)(e.paid)})]}):null,(0,h.jsx)(o.Badge,{kind:'Approved'===a?'ok':'Pending'===a?'amber':'neutral',label:'Pending'===a?'Pending approval':a}),y?(0,h.jsx)(n.default,{testID:`shift-zero-${e.a.id}`,style:{borderRadius:8,borderWidth:1,borderColor:c.colours.amber,paddingHorizontal:10,paddingVertical:4},children:(0,h.jsx)(o.T,{size:14,weight:"bold",colour:c.colours.amber,center:!0,children:"Check: 0 minutes"})}):null,e.a.added&&e.a.signOff?(0,h.jsxs)(o.Muted,{center:!0,testID:`shift-entered-${e.a.id}`,children:["Entered by ",e.a.signOff.by]}):null]}),t?(0,h.jsxs)(o.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:['Pending'===e.status&&!y&&s?(0,h.jsx)(o.Button,{label:"Approve",testID:`shift-approve-${e.a.id}`,accessibilityLabel:`Approve ${p(e.date)}, paid ${(0,u.durWords)(e.paid)}`,onPress:s,style:{minHeight:48,minWidth:120}}):null,(y||'Pending'===e.status)&&d?(0,h.jsx)(o.Button,{kind:"secondary",label:"Edit",testID:`shift-edit-${e.a.id}`,accessibilityLabel:`Edit the shift on ${p(e.date)}`,onPress:d,style:{minHeight:48,minWidth:96}}):null,y&&'Confirmed'!==e.status&&l?(0,h.jsx)(o.Button,{kind:"secondary",label:"Remove",testID:`shift-remove-${e.a.id}`,accessibilityLabel:`Remove the 0-minute shift on ${p(e.date)}. It is kept in the history.`,onPress:l,style:{minHeight:48,minWidth:96}}):null]}):null]})},_e.HoursSummaryCard=function({name:e,role:t,approved:s,pending:d,rate:l}){const p=(0,u.hoursSummary)(s,d,l),b=`${e}. Approved ${(0,u.durWords)(s)}${null!=p.approved.gross?`, ${(0,a.gbp)(p.approved.gross)}`:''}. Pending approval ${(0,u.durWords)(d)}${null!=p.pending.gross?`, ${(0,a.gbp)(p.pending.gross)} once approved`:''}.${null!=l?` Rate ${(0,a.gbp)(l)} an hour.`:''}`;return(0,h.jsxs)(n.default,{accessible:!0,accessibilityLabel:b,testID:"hours-summary-card",style:{alignItems:'center',gap:6,width:'100%'},children:[(0,h.jsx)(o.T,{size:18,weight:"bold",center:!0,children:e}),t?(0,h.jsx)(o.Muted,{center:!0,children:t}):null,(0,h.jsxs)(o.Row,{wrap:!0,gap:10,style:{justifyContent:'center'},children:[(0,h.jsxs)(n.default,{style:{minWidth:150,borderRadius:12,borderWidth:1,borderColor:c.colours.ok,padding:10,alignItems:'center'},children:[(0,h.jsx)(o.T,{size:13,weight:"semibold",colour:c.colours.ok,children:"APPROVED"}),(0,h.jsx)(o.T,{size:20,weight:"bold",testID:"sum-approved",children:p.approved.text}),(0,h.jsx)(o.Muted,{children:null!=p.approved.gross?`${(0,a.gbp)(p.approved.gross)} gross`:'no rate'})]}),(0,h.jsxs)(n.default,{style:{minWidth:150,borderRadius:12,borderWidth:1,borderColor:c.colours.amber,padding:10,alignItems:'center'},children:[(0,h.jsx)(o.T,{size:13,weight:"semibold",colour:c.colours.amber,children:"PENDING"}),(0,h.jsx)(o.T,{size:20,weight:"bold",testID:"sum-pending",children:p.pending.text}),(0,h.jsx)(o.Muted,{children:null!=p.pending.gross?`${(0,a.gbp)(p.pending.gross)} once approved`:'no rate'})]})]}),null!=l?(0,h.jsxs)(o.Muted,{center:!0,children:["Rate ",(0,a.gbp)(l)," an hour",(y=null,null==y?'':` \xb7 ${(0,a.gbp)(y)}`)]}):null]});var y},_e.RemoveShiftSheet=function({a:e,who:s,onClose:n}){const[a,u]=(0,t.useState)('Clocked in and out by mistake (0 minutes)'),p=a.trim().length>=3;return(0,h.jsxs)(o.Sheet,{visible:!0,onClose:n,title:`Remove the shift on ${b(e.date)}?`,maxWidth:520,testID:"remove-shift",children:[(0,h.jsx)(o.T,{size:16,center:!0,children:"It comes out of hours, pay and exports. It isn\u2019t deleted: it stays in the history with your name and the reason."}),(0,h.jsx)(d.TextInput,{accessibilityLabel:"Reason for removing the shift",value:a,onChangeText:u,style:{minHeight:48,borderRadius:10,borderWidth:1,borderColor:c.colours.gold,color:c.colours.text,paddingHorizontal:12}}),(0,h.jsxs)(o.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,h.jsx)(o.Button,{label:"Remove shift",testID:"remove-shift-yes",disabled:!p,onPress:()=>{l.useOwner.getState().voidEntry(e.id,s.name,s.id,a.trim(),(new Date).toISOString()),n()},style:{minHeight:56}}),(0,h.jsx)(o.Button,{kind:"secondary",label:"Keep it",onPress:n,style:{minHeight:56}})]})]})};var e,t=r(_d[0]),s=r(_d[1]),n=(e=s)&&e.__esModule?e:{default:e},o=r(_d[2]),d=r(_d[3]),l=r(_d[4]),a=r(_d[5]),u=r(_d[6]),c=r(_d[7]),h=r(_d[8]);const p=e=>new Date(`${e}T12:00:00Z`).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long',timeZone:'UTC'}),b=e=>new Date(`${e}T12:00:00Z`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',timeZone:'UTC'})},1189,[34,102,794,827,891,867,1188,821,25]); __d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"REASONS",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"isoAt",{enumerable:!0,get:function(){return S}}),_e.flagsFor=D,_e.notesFor=$,Object.defineProperty(_e,"statusLabel",{enumerable:!0,get:function(){return M}}),Object.defineProperty(_e,"statusKind",{enumerable:!0,get:function(){return O}}),_e.AuditTrail=B,_e.TimeEdit=R,_e.OverrideSheet=A,_e.outstandingDays=P,_e.useOutstanding=function(){const e=(0,r.useOwner)(e=>(0,r.liveAttendance)(e.attendance)),t=(0,r.useOwner)(e=>e.timeRequests),n=(0,u.ymd)(new Date);return(0,s.useMemo)(()=>({days:P(e,n),requests:t.filter(e=>'open'===e.status).length}),[e,t,n])},_e.SignOff=function(){const{now:e,today:t,me:n,meId:m}=(0,h.useCtx)(3e4),p=(0,r.useOwner)(e=>e.staff),x=(0,r.useOwner)(e=>(0,r.liveAttendance)(e.attendance)),j=(0,r.useOwner)(e=>e.shifts),k=(0,r.useOwner)(e=>e.timeRequests),w=(0,r.useOwner)(e=>e.leave),S=(0,s.useMemo)(()=>P(x,t),[x,t]),[I,T]=(0,s.useState)(t),[B,R]=(0,s.useState)(null),[q,z]=(0,s.useState)(null),H=(0,s.useMemo)(()=>{const n=x.filter(e=>e.date===I&&e.in),s=n.map(n=>{const s=(0,r.shiftOf)(j,n.staffId,I);return{key:n.id,staffId:n.staffId,a:n,sh:s,flags:D(n,s,e,t,k)}});j.filter(e=>e.date===I&&!1!==e.published&&!n.some(t=>t.staffId===e.staffId)).forEach(n=>{const o=(0,d.leaveCovering)(w,n.staffId,I);if(o)return void(s.some(e=>e.leave&&e.staffId===n.staffId)||s.push({key:`leave-${n.id}`,staffId:n.staffId,sh:n,flags:[],leave:o}));(I60*n.start+15)&&s.push({key:`miss-${n.id}`,staffId:n.staffId,sh:n,flags:[{key:'noin',label:'No clock-in'}]})});const o=e=>e.leave?4:e.a?'confirmed'===(0,r.attStatus)(e.a)?3:e.flags.length?0:2:1;return s.sort((e,t)=>o(e)-o(t)||(p.find(t=>t.id===e.staffId)?.name??'').localeCompare(p.find(e=>e.id===t.staffId)?.name??''))},[x,j,k,w,I,e.getMinutes(),p]),N=k.filter(e=>'open'===e.status&&e.date===I),F=k.filter(e=>'open'===e.status&&e.date!==I),E=H.filter(e=>e.a&&'awaiting'===(0,r.attStatus)(e.a)&&!e.flags.length),_=H.reduce((t,n)=>{if(!n.a)return t;const s=(0,h.paidMins)(n.a,e).paid;return'confirmed'===(0,r.attStatus)(n.a)?t.conf+=s:t.pend+=s,t},{conf:0,pend:0}),Y={confirmed:H.filter(e=>e.a&&'confirmed'===(0,r.attStatus)(e.a)).length,awaiting:H.filter(e=>e.a&&'awaiting'===(0,r.attStatus)(e.a)).length,open:H.filter(e=>e.a&&'open'===(0,r.attStatus)(e.a)).length,flagged:H.filter(e=>e.flags.length&&!(e.a&&'confirmed'===(0,r.attStatus)(e.a))).length,off:H.filter(e=>e.leave).length},L=[t,...S.map(e=>e.date).filter(e=>e!==t)];for(let e=1;L.length<8&&e<=7;e++){const n=v(t,-e);L.includes(n)||L.push(n)}const W=t=>{const s=r.useOwner.getState().confirmEntries(t,n,m,e.toISOString());z(s?`${s} ${1===s?'entry':'entries'} confirmed`:null)};return(0,b.jsxs)(a.default,{style:{gap:10},testID:"signoff",children:[S.filter(e=>e.date!==I).length?(0,b.jsx)(o.default,{accessibilityRole:"button",onPress:()=>T(S.filter(e=>e.date!==I)[S.filter(e=>e.date!==I).length-1].date),children:(0,b.jsx)(l.Banner,{kind:"warn",title:`${S.filter(e=>e.date!==I).length} earlier ${1===S.filter(e=>e.date!==I).length?'day':'days'} still to sign off`,children:"Hours only count for pay once they\u2019re confirmed. Tap to open the oldest."})}):null,(0,b.jsx)(l.Row,{wrap:!0,gap:6,children:L.slice(0,10).sort((e,t)=>t.localeCompare(e)).map(e=>{const n=S.find(t=>t.date===e);return(0,b.jsx)(l.Chip,{label:C(e,t),sub:n?`${n.n} to sign off`:void 0,selected:I===e,onPress:()=>{T(e),z(null)}},e)})}),(0,b.jsx)(l.Card,{children:(0,b.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,b.jsxs)(a.default,{style:{flex:1},children:[(0,b.jsxs)(l.T,{size:18,weight:"bold",children:[C(I,t),I===t||I===v(t,-1)?` \xb7 ${(0,u.niceDate)((0,u.parseYmd)(I))}`:'']}),(0,b.jsxs)(l.Muted,{children:[Y.confirmed," confirmed \xb7 ",Y.awaiting," awaiting \xb7 ",Y.open," still clocked in",Y.flagged?` \xb7 ${Y.flagged} flagged`:'',Y.off?` \xb7 ${Y.off} on time off`:'']})]}),(0,b.jsxs)(a.default,{style:{alignItems:'flex-end'},children:[(0,b.jsx)(l.T,{size:18,weight:"bold",colour:c.colours.ok,children:(0,h.hmDur)(_.conf)}),(0,b.jsx)(l.Muted,{children:"confirmed"}),_.pend?(0,b.jsxs)(l.T,{size:13,colour:c.colours.amber,children:[(0,h.hmDur)(_.pend)," pending"]}):null]})]})}),q?(0,b.jsx)(l.Banner,{kind:"success",title:q}):null,N.length||F.length?(0,b.jsx)(f.SectionHead,{title:"Correction requests",sub:"From the Staff app. Apply opens the times to check; declining keeps the times as clocked."}):null,[...N,...F].map(t=>{const s=p.find(e=>e.id===t.staffId),o=t.attendanceId&&x.find(e=>e.id===t.attendanceId)||x.find(e=>e.staffId===t.staffId&&e.date===t.date&&e.in);return(0,b.jsxs)(l.Card,{highlight:c.colours.blue,children:[(0,b.jsxs)(l.Row,{gap:8,children:[(0,b.jsx)(i.StaffAvatar,{id:t.staffId,size:30}),(0,b.jsxs)(a.default,{style:{flex:1},children:[(0,b.jsxs)(l.T,{weight:"semibold",children:[y(s?.name)," \xb7 ",(0,u.niceDate)((0,u.parseYmd)(t.date))]}),(0,b.jsxs)(l.Muted,{children:['in'===t.kind?'Forgot to clock in':'out'===t.kind?'Forgot to clock out':'Forgot to clock in and out',t.suggestedIn?` \xb7 in ${(0,u.hm)(new Date(t.suggestedIn))}`:'',t.suggestedOut?` \xb7 out ${(0,u.hm)(new Date(t.suggestedOut))}`:'',t.note?` \xb7 \u201c${t.note}\u201d`:'']})]}),(0,b.jsx)(l.Badge,{kind:"blue",label:"Request"})]}),(0,b.jsxs)(l.Row,{gap:6,children:[(0,b.jsx)(l.Button,{small:!0,kind:"success",label:"Review & apply",onPress:()=>R({staffId:t.staffId,a:o,request:t})}),(0,b.jsx)(l.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>r.useOwner.getState().resolveTimeRequest(t.id,'declined',n,e.toISOString())})]})]},t.id)}),(0,b.jsx)(f.SectionHead,{title:"Hours",sub:"Rostered vs actual. Flagged rows need a look and are confirmed one by one."}),H.map(t=>{const n=p.find(e=>e.id===t.staffId),s=t.a,o=s?(0,h.paidMins)(s,e):null,f=s?(0,r.attStatus)(s):null,m=s?.audit?.filter(e=>'confirmed'!==e.action).slice(-1)[0];return(0,b.jsx)(l.Card,{highlight:t.leave?c.colours.blue:'confirmed'===f?c.colours.ok:t.flags.length?c.colours.amber:void 0,children:(0,b.jsxs)(a.default,{testID:`so-row-${t.staffId}`,style:{gap:8},children:[(0,b.jsxs)(l.Row,{gap:10,children:[(0,b.jsx)(i.StaffAvatar,{id:t.staffId,size:36}),(0,b.jsxs)(a.default,{style:{flex:1},children:[(0,b.jsx)(l.T,{weight:"semibold",children:y(n?.name)}),(0,b.jsx)(l.Muted,{children:[n?.job,...$(s,n?.temp)].filter(Boolean).join(' \xb7 ')})]}),n?.temp||s?.temp?(0,b.jsx)(l.Badge,{kind:"gold",label:"Temp"}):null,s?(0,b.jsx)(l.Badge,{kind:O(s),label:M(s)}):t.leave?(0,b.jsx)(l.Badge,{kind:"blue",label:(0,d.leaveLabel)(t.leave)}):(0,b.jsx)(l.Badge,{kind:"red",label:"Missing"})]}),(0,b.jsx)(l.Row,{gap:0,style:{flexWrap:'wrap',rowGap:6},children:[['Rota',t.sh?`${(0,h.fmtH)(t.sh.start)}\u2013${(0,h.fmtH)(t.sh.end)}`:'\u2014'],['Actual',s?.in?`${(0,u.hm)(new Date(s.in))}\u2013${s.out?(0,u.hm)(new Date(s.out)):'on'}`:t.leave?(0,d.leaveLabel)(t.leave):'no clock-in'],['Break',s?.out?`${o.brk}m`:s?`${s.breakMins??0}m so far`:'\u2014'],['Paid',s?s.out?(0,h.hmDur)(o.paid):`${(0,h.hmDur)(o.worked)}\u2026`:'\u2014']].map(([e,t])=>(0,b.jsxs)(a.default,{style:{minWidth:92,flexGrow:1},children:[(0,b.jsx)(l.T,{size:11,colour:c.colours.muted,children:e.toUpperCase()}),(0,b.jsx)(l.T,{size:15,weight:"semibold",colour:'Paid'===e&&'confirmed'===f?c.colours.ok:c.colours.text,children:t})]},e))}),t.flags.length&&'confirmed'!==f?(0,b.jsx)(l.Row,{wrap:!0,gap:6,children:t.flags.map(e=>(0,b.jsx)(l.Badge,{kind:'noin'===e.key||'noout'===e.key?'red':'amber',label:e.label},e.key))}):null,t.leave?(0,b.jsxs)(l.Muted,{testID:`so-leave-${t.staffId}`,children:[(0,d.leaveNote)(t.leave),". Rota shift covered by leave: no hours counted."]}):null,m?(0,b.jsxs)(l.Muted,{children:["Adjusted by ",y(m.by),m.reason?`: ${m.reason}`:'']}):null,s?.signOff?(0,b.jsxs)(l.Muted,{children:["Confirmed by ",y(s.signOff.by)," \xb7 ",(0,u.niceDate)(new Date(s.signOff.at))," ",(0,u.hm)(new Date(s.signOff.at))]}):null,(0,b.jsxs)(l.Row,{gap:8,children:[(0,b.jsx)(l.Button,{small:!0,kind:"secondary",label:s?'Edit':'Add entry',accessibilityLabel:`${s?'Edit':'Add entry for'} ${y(n?.name)}`,onPress:()=>R({staffId:t.staffId,a:s})}),s&&'awaiting'===f?(0,b.jsx)(l.Button,{small:!0,kind:"success",label:"Confirm",accessibilityLabel:`Confirm ${y(n?.name)}`,onPress:()=>W([s.id])}):null,s&&'open'===f?(0,b.jsx)(l.Muted,{style:{alignSelf:'center'},children:"Needs a clock-out before it can be confirmed"}):null]})]})},t.key)}),H.length?null:(0,b.jsx)(l.Card,{children:(0,b.jsx)(l.Muted,{children:"No clock records or rostered shifts for this day."})}),H.length?(0,b.jsx)(l.Button,{testID:"confirm-unflagged",kind:"success",label:E.length?`Confirm all unflagged (${E.length})`:'Nothing unflagged to confirm',disabled:!E.length,onPress:()=>W(E.map(e=>e.a.id))}):null,(0,b.jsx)(l.Muted,{children:"Flags: no clock-out, 30 min or more off the rota, over 12 hours, no break on a shift over 6 hours, not on the rota, off-site, or a correction request. Editing a confirmed entry puts it back to Awaiting sign-off. Only confirmed hours count for pay, tips and exports."}),B?(0,b.jsx)(A,{a:B.a,staffId:B.staffId,date:B.request?.date??B.a?.date??I,request:B.request,onClose:()=>R(null)}):null]})};var t=_r(_d[0]),n=_r(_d[1]),s=_r(_d[2]),o=e(_r(_d[3])),a=e(_r(_d[4])),l=_r(_d[5]),i=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),f=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),p=_r(_d[14]),x=_r(_d[15]),b=_r(_d[16]);const j=['Forgot to clock in','Forgot to clock out','Wrong time'],k=[0,15,20,30,45,60],y=e=>(e??'').replace(' (example)',''),w=e=>{const t=new Date(e);return 60*t.getHours()+t.getMinutes()},S=(e,t)=>{const n=(0,u.parseYmd)(e);return n.setMinutes(t),n.toISOString()},I=e=>{const t=(e%1440+1440)%1440;return`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`},v=(e,t)=>{const n=(0,u.parseYmd)(e);return n.setDate(n.getDate()+t),(0,u.ymd)(n)},C=(e,t)=>e===t?'Today':e===v(t,-1)?'Yesterday':(0,u.niceDate)((0,u.parseYmd)(e));function D(e,t,s,o,a=[]){const l=[],i=(0,h.paidMins)(e,s),r=60*s.getHours()+s.getMinutes();if(!e.out&&(e.date60*t.end+60||i.worked>840)&&l.push({key:'noout',label:'No clock-out'}),t&&e.in){const n=w(e.in)-Math.round(60*t.start),s=e.out?w(e.out)+(e.out.slice(0,10)!==e.in.slice(0,10)&&w(e.out)=30&&l.push({key:'diff',label:`${a>=60?(0,h.hmDur)(a):`${a}m`} off the rota`})}return(0,n.isZeroShift)(e)&&l.push({key:'zero',label:'Check: 0 minutes'}),t||l.push({key:'unrostered',label:'Not on the rota'}),i.worked>720&&l.push({key:'long',label:`Very long shift (${(0,h.hmDur)(i.worked)})`}),e.out&&i.worked>360&&0===i.brk&&l.push({key:'nobreak',label:'No break (over 6h)'}),!1!==e.inSite&&!1!==e.outSite||l.push({key:'offsite',label:'Clocked off-site'}),a.some(t=>'open'===t.status&&t.staffId===e.staffId&&t.date===e.date)&&l.push({key:'request',label:'Correction requested'}),e.breakAddedAtClockOut&&l.push({key:'breakadded',label:`Break added at clock-out (${e.breakAddedAtClockOut}m)`}),e.offRota&&t&&l.push({key:'offrota',label:'Signed in off rota'}),l}function $(e,t){const n=[];return(t||e?.temp)&&n.push('Temp'),'display'!==e?.via&&'display'!==e?.outVia||n.push('via Display'),'rota'===e?.auto&&n.push(e.autoNote?`Auto from rota \xb7 ${e.autoNote}`:'Auto from rota'),n}const M=e=>{const t=(0,r.attStatus)(e);return'open'===t?'Open':'awaiting'===t?e.adjusted?'Adjusted \xb7 awaiting sign-off':'Awaiting sign-off':e.adjusted?'Confirmed \xb7 adjusted':'Confirmed'},O=e=>{const t=(0,r.attStatus)(e);return'confirmed'===t?'ok':'open'===t?'blue':'amber'},T={added:'Added entry',clock_in:'Clock-in',clock_out:'Clock-out',break:'Break',confirmed:'Confirmed',reopened:'Reopened',request_applied:'Correction request applied',request_declined:'Correction request declined',voided:'Removed (kept in history)'};function B({a:e,limit:t}){const n=[...e.audit??[]].reverse().slice(0,t??50);return n.length?(0,b.jsx)(a.default,{style:{gap:6},testID:"audit-trail",children:n.map((e,t)=>(0,b.jsxs)(a.default,{style:{flexDirection:'row',gap:8},children:[(0,b.jsx)(a.default,{style:{width:3,borderRadius:2,backgroundColor:'confirmed'===e.action?c.colours.ok:'reopened'===e.action?c.colours.amber:c.colours.gold}}),(0,b.jsxs)(a.default,{style:{flex:1},children:[(0,b.jsxs)(l.T,{size:13,weight:"semibold",children:[T[e.action],e.from||e.to?`: ${e.from??'\u2013'} \u2192 ${e.to??'\u2013'}`:'']}),(0,b.jsxs)(l.Muted,{children:[y(e.by)," \xb7 ",(0,u.niceDate)(new Date(e.at))," ",(0,u.hm)(new Date(e.at)),e.reason?` \xb7 \u201c${e.reason}\u201d`:'']})]})]},t))}):(0,b.jsx)(l.Muted,{children:"No changes yet. Times are as clocked."})}function R({label:e,mins:n,onChange:o,testID:i}){const[r,d]=(0,s.useState)(null),u=e=>{const t=/^(\d{1,2})[:.]?(\d{2})$/.exec(e.trim());t&&+t[1]<24&&+t[2]<60&&o(60*+t[1]+ +t[2]+(n>=1440&&60*+t[1]+ +t[2]<360?1440:0)),d(null)};return(0,b.jsxs)(a.default,{style:{gap:6},children:[(0,b.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(l.T,{size:13,colour:c.colours.muted,children:e}),n>=1440?(0,b.jsx)(l.Muted,{children:"next day"}):null]}),(0,b.jsxs)(l.Row,{gap:6,children:[(0,b.jsx)(l.Button,{small:!0,kind:"ghost",label:"\u221215",onPress:()=>o(n-15)}),(0,b.jsx)(l.Button,{small:!0,kind:"ghost",label:"\u22125",onPress:()=>o(n-5)}),(0,b.jsx)(t.TextInput,{testID:i,accessibilityLabel:e,value:r??I(n),onChangeText:d,onBlur:()=>null!=r&&u(r),onSubmitEditing:()=>null!=r&&u(r),style:[l.styles.input,{flex:1,textAlign:'center',fontSize:22,fontWeight:'700',paddingVertical:6,color:c.colours.text}]}),(0,b.jsx)(l.Button,{small:!0,kind:"ghost",label:"+5",onPress:()=>o(n+5)}),(0,b.jsx)(l.Button,{small:!0,kind:"ghost",label:"+15",onPress:()=>o(n+15)})]})]})}function A({a:e,staffId:t,date:n,request:o,onClose:i}){const{me:d,meId:I,now:v,role:C}=(0,h.useCtx)(3e4),[D,$]=(0,s.useState)(!1),T=!!e&&(0,m.canSeeHoursEdit)({role:C,isCar:p.IS_CAR}),A=(0,r.useOwner)(e=>e.staff.find(e=>e.id===t)?.name),P=(0,r.useOwner)(e=>e.shifts),q=(0,r.shiftOf)(P,t,n),z=o?.suggestedIn?w(o.suggestedIn):e?.in?Math.round((new Date(e.in).getTime()-(0,u.parseYmd)(n).getTime())/6e4):q?Math.round(60*q.start):720,H=o?.suggestedOut??e?.out,N=H?(F=H,Math.round((new Date(F).getTime()-(0,u.parseYmd)(n).getTime())/6e4)):e&&e.in&&!e.out?null:q?Math.round(60*q.end):z+480;var F;const[E,_]=(0,s.useState)(z),[Y,L]=(0,s.useState)(N),[W,V]=(0,s.useState)(e?.breakMins??(q&&q.end-q.start>6?30:0)),[G,K]=(0,s.useState)(o?'out'===o.kind?j[1]:j[0]:e?e.in&&!e.out?j[1]:null:j[0]),[U,Z]=(0,s.useState)(''),[J,Q]=(0,s.useState)(null),X=[G,U.trim()].filter(Boolean).join(': ')+(o&&o.note?` (request: ${o.note})`:''),ee=null!=Y?Y-E:0,te=e?(0,h.paidMins)(e,v):null,ne=null!=Y?Math.max(0,ee-W):null,se=e&&'confirmed'===(0,r.attStatus)(e),oe=null!=Y&&Y<=E?'Clock-out must be after clock-in.':ee>1200?'A shift can\u2019t be longer than 20 hours.':null!=Y&&W>=ee?'The break is longer than the shift.':null,ae=e?.in&&!o&&E===z?e.in:S(n,E),le=null==Y?void 0:e?.out&&!o&&Y===N?e.out:S(n,Y),ie=!e||ae!==e.in||(le??'')!==(e.out??'')||(e.breakMins??0)!==W;return(0,b.jsxs)(l.Sheet,{visible:!0,onClose:i,title:`${e?'Edit hours':'Add missing entry'} \xb7 ${y(A)} \xb7 ${(0,u.niceDate)((0,u.parseYmd)(n))}`,testID:"override-sheet",children:[(0,b.jsxs)(l.Row,{gap:8,style:{flexWrap:'wrap'},children:[e?(0,b.jsx)(l.Badge,{kind:O(e),label:M(e)}):(0,b.jsx)(l.Badge,{kind:"red",label:"No clock record"}),q?(0,b.jsx)(l.Badge,{kind:"neutral",label:`Rota ${(0,h.fmtH)(q.start)}\u2013${(0,h.fmtH)(q.end)}`}):(0,b.jsx)(l.Badge,{kind:"neutral",label:"Not on the rota"}),e?.in?(0,b.jsx)(l.Badge,{kind:"neutral",label:`Clocked ${(0,u.hm)(new Date(e.in))}\u2013${e.out?(0,u.hm)(new Date(e.out)):'still on'}`}):null]}),o?(0,b.jsxs)(l.Banner,{kind:"info",title:`${y(A)} asked for a correction`,children:['in'===o.kind?'Forgot to clock in':'out'===o.kind?'Forgot to clock out':'Forgot to clock in and out',o.suggestedIn?` \xb7 in ${(0,u.hm)(new Date(o.suggestedIn))}`:'',o.suggestedOut?` \xb7 out ${(0,u.hm)(new Date(o.suggestedOut))}`:'',o.note?` \xb7 \u201c${o.note}\u201d`:'',". The suggested times are filled in below."]}):null,(0,b.jsx)(R,{label:"Clock in",mins:E,onChange:_,testID:"ov-in"}),null!=Y?(0,b.jsx)(R,{label:"Clock out",mins:Y,onChange:L,testID:"ov-out"}):(0,b.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(l.Muted,{children:"No clock-out yet."}),(0,b.jsx)(l.Button,{small:!0,kind:"secondary",label:"Add clock-out",onPress:()=>L(q?Math.round(60*q.end):Math.min(E+480,60*v.getHours()+v.getMinutes()>E?60*v.getHours()+v.getMinutes():E+480))})]}),(0,b.jsx)(l.T,{size:13,colour:c.colours.muted,children:"Break"}),(0,b.jsxs)(l.Row,{wrap:!0,gap:6,children:[k.map(e=>(0,b.jsx)(l.Chip,{label:0===e?'None':`${e} min`,selected:W===e,onPress:()=>V(e)},e)),(0,b.jsx)(l.Stepper,{value:W,min:0,max:240,onChange:V,label:"break minutes"})]}),(0,b.jsx)(l.T,{size:13,colour:c.colours.muted,children:"Reason (required, kept in the audit trail)"}),(0,b.jsx)(l.Row,{wrap:!0,gap:6,children:j.map(e=>(0,b.jsx)(l.Chip,{label:e,selected:G===e,onPress:()=>K(G===e?null:e)},e))}),(0,b.jsx)(l.Field,{label:G?'Add detail (optional)':'Or type a reason',value:U,onChangeText:Z,placeholder:"e.g. stayed late for a function",maxLength:150}),(0,b.jsxs)(l.Card,{style:{backgroundColor:c.colours.surface2},children:[(0,b.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(l.T,{children:"Paid hours"}),(0,b.jsx)(l.T,{weight:"bold",colour:c.colours.gold,children:null!=ne?(0,h.hmDur)(ne):'still on shift'})]}),te&&e?.out?(0,b.jsxs)(l.Muted,{children:["Was ",(0,h.hmDur)(te.paid)," (",(0,u.hm)(new Date(e.in)),"\u2013",(0,u.hm)(new Date(e.out)),", ",te.brk,"m break)"]}):null,se?(0,b.jsx)(l.T,{size:13,colour:c.colours.amber,children:"This entry was confirmed. Saving puts it back to Awaiting sign-off (logged)."}):null]}),oe?(0,b.jsx)(l.T,{size:13,colour:c.colours.red,children:oe}):null,J?(0,b.jsx)(l.T,{size:13,colour:c.colours.red,children:J}):null,(0,b.jsx)(l.Button,{testID:"ov-save",kind:"success",label:e?'Save change':'Add entry',disabled:!!oe||!ie||X.trim().length<3,onPress:()=>{r.useOwner.getState().overrideEntry({id:e?.id,staffId:t,date:n,in:ae,out:le,breakMins:W,reason:X.slice(0,200),by:d,byId:I,now:v.toISOString(),request:o?.id})?(o&&r.useOwner.getState().resolveTimeRequest(o.id,'applied',d,v.toISOString()),i()):Q('Couldn\u2019t save: check the times and the reason.')}}),T?(0,b.jsx)(a.default,{style:{alignItems:'center',width:'100%'},children:(0,b.jsx)(l.Button,{testID:"ov-delete-entry",kind:"ghost",label:"Delete entry",accessibilityLabel:"Delete entry",onPress:()=>$(!0),style:{minHeight:48,minWidth:160}})}):null,e&&D?(0,b.jsx)(x.DeleteShiftSheet,{a:e,onClose:()=>$(!1),onDeleted:i}):null,e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(f.SectionHead,{title:"Audit trail",sub:"Every change: what, from, to, who, when and why"}),(0,b.jsx)(B,{a:e})]}):null]})}function P(e,t){const n=new Map;return e.forEach(e=>{e.date({date:e,n:t})).sort((e,t)=>t.date.localeCompare(e.date))}},1190,[827,1188,34,402,102,794,925,891,1094,858,821,1181,1084,1191,872,1192,25]); diff --git a/car-app/index.html b/car-app/index.html index 4fb9db7765b22ef13cf72e21adad6d991aeec3e9..91251481a551d561a5f8423e4a748e89fe8099b7 100644 --- a/car-app/index.html +++ b/car-app/index.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/car-app/owner.html b/car-app/owner.html index 67d655b429ade907d4633274aafeee3189bb81fe..8da905446015c8258279c4efaa94eb57dd19a578 100644 --- a/car-app/owner.html +++ b/car-app/owner.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/car-app/sw.js b/car-app/sw.js index 8dbc0e7470c3084917cdb733fc735e02c78d466c..7fbb64550b8608a298a0d27998e407b5db302516 100644 --- a/car-app/sw.js +++ b/car-app/sw.js @@ -1,7 +1,7 @@ // Anchorage car screen service worker: precache the app shell so it opens offline after the first visit. -const V = "cc-car-88696f42cc"; +const V = "cc-car-5a9b244664"; const BASE = "/car-app/"; -const PRECACHE = ["/car-app/assets/assets/brand/3idiots-hero.e5dfd53739f05086b1956e72d585a66a.png", "/car-app/assets/assets/brand/3idiots.df4a76d2130f0e5b0042f06a8c88693a.png", "/car-app/assets/assets/brand/abbotsford-hero.78fcb8ee06ee22c4ca659c9254db7512.png", "/car-app/assets/assets/brand/abbotsford.b26602bba5ce4969733c5422a45ad053.png", "/car-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/car-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/car-app/assets/assets/brand/brae.8de9e89ac30966c6669de990370d8e40.png", "/car-app/assets/assets/brand/cecchinis-hero.f77780fcc94fd668cf35d66d6dc52d81.png", "/car-app/assets/assets/brand/cecchinis.ebf752fef363247848ae7c0d91938765.png", "/car-app/assets/assets/brand/drunkencoo-hero.65c21c4da9e466cf4bffc969639a1427.png", "/car-app/assets/assets/brand/drunkencoo.f6d92af3b14e4205a3deaf4434754c51.png", "/car-app/assets/assets/brand/greenside-hero.1caec5a6cb939434cccb5f3a613b50f8.png", "/car-app/assets/assets/brand/greenside.9d1556db97dcb903a3c57e2063ee2255.png", "/car-app/assets/assets/brand/kirkmichael-hero.63b13cde7fd82eb622622b39ac80c394.png", "/car-app/assets/assets/brand/kirkmichael.63b13cde7fd82eb622622b39ac80c394.png", "/car-app/assets/assets/brand/kirkton-hero.9d0837b292c2f4f30f4521d806bb28c3.png", "/car-app/assets/assets/brand/kirkton.bcf8d846df4861474d224a7a77f498fb.png", "/car-app/assets/assets/brand/mrbasrais-hero.4ce74641cfcf52d099157c84005b9d2a.png", "/car-app/assets/assets/brand/mrbasrais.7cc4086dd12ace82529795f1c9f8c900.png", "/car-app/assets/assets/brand/pizzaioli-hero.1896657c08264cefb49b401891d5448d.png", "/car-app/assets/assets/brand/pizzaioli.db8c000b62ee407121aa8b90ce45e170.png", "/car-app/assets/assets/brand/rupeeroom-hero.969fa372add526aaacf3a6c009b8ac92.png", "/car-app/assets/assets/brand/rupeeroom.689e6fb536dc0845eeb174a1ec7bd346.png", "/car-app/assets/assets/brand/saltmarsh.85a6a65732635e5148478d743d9ca884.png", "/car-app/assets/assets/brand/smokinggoat-hero.0588f17ef0eed7f757f22916cd4d37db.png", "/car-app/assets/assets/brand/smokinggoat.20a3a1970596ab43c5d6468d4ed549a7.png", "/car-app/assets/assets/brand/souters.f4c58d9349b6e1700fe5abcc9e9b665c.png", "/car-app/assets/assets/brand/wildings-hero-logo-text.4661e4b935726f2511f9c17a1567c89a.png", "/car-app/assets/assets/brand/wildings.076f4fcd06d19a0af0205c410f461b14.png", "/car-app/assets/assets/brand/williewastles-hero.b9d53d27b66f903b5618a7177b2ffad4.png", "/car-app/assets/assets/brand/williewastles.055a77893ced99bf3a6c5402ba5baac6.png", "/car-app/assets/assets/brand/yasmins-hero.a5aef62e37dfcecbe0afc056186f4ad9.png", "/car-app/assets/assets/brand/yasmins.8482602e9f0a965655924835625cb02b.png", "/car-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/car-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/car-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/car-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/car-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/car-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/car-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/car-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/car-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/car-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/car-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/car-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/car-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/car-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/car-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/car-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/car-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/car-app/favicon.ico", "/car-app/index.html", "/car-app/_expo/static/js/web/bundle.js?v=88696f42cccf587475493db3cb1d78cafa8aebaee2b615629c713c6543b61706"]; +const PRECACHE = ["/car-app/assets/assets/brand/3idiots-hero.e5dfd53739f05086b1956e72d585a66a.png", "/car-app/assets/assets/brand/3idiots.df4a76d2130f0e5b0042f06a8c88693a.png", "/car-app/assets/assets/brand/abbotsford-hero.78fcb8ee06ee22c4ca659c9254db7512.png", "/car-app/assets/assets/brand/abbotsford.b26602bba5ce4969733c5422a45ad053.png", "/car-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/car-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/car-app/assets/assets/brand/brae.8de9e89ac30966c6669de990370d8e40.png", "/car-app/assets/assets/brand/cecchinis-hero.f77780fcc94fd668cf35d66d6dc52d81.png", "/car-app/assets/assets/brand/cecchinis.ebf752fef363247848ae7c0d91938765.png", "/car-app/assets/assets/brand/drunkencoo-hero.65c21c4da9e466cf4bffc969639a1427.png", "/car-app/assets/assets/brand/drunkencoo.f6d92af3b14e4205a3deaf4434754c51.png", "/car-app/assets/assets/brand/greenside-hero.1caec5a6cb939434cccb5f3a613b50f8.png", "/car-app/assets/assets/brand/greenside.9d1556db97dcb903a3c57e2063ee2255.png", "/car-app/assets/assets/brand/kirkmichael-hero.63b13cde7fd82eb622622b39ac80c394.png", "/car-app/assets/assets/brand/kirkmichael.63b13cde7fd82eb622622b39ac80c394.png", "/car-app/assets/assets/brand/kirkton-hero.9d0837b292c2f4f30f4521d806bb28c3.png", "/car-app/assets/assets/brand/kirkton.bcf8d846df4861474d224a7a77f498fb.png", "/car-app/assets/assets/brand/mrbasrais-hero.4ce74641cfcf52d099157c84005b9d2a.png", "/car-app/assets/assets/brand/mrbasrais.7cc4086dd12ace82529795f1c9f8c900.png", "/car-app/assets/assets/brand/pizzaioli-hero.1896657c08264cefb49b401891d5448d.png", "/car-app/assets/assets/brand/pizzaioli.db8c000b62ee407121aa8b90ce45e170.png", "/car-app/assets/assets/brand/rupeeroom-hero.969fa372add526aaacf3a6c009b8ac92.png", "/car-app/assets/assets/brand/rupeeroom.689e6fb536dc0845eeb174a1ec7bd346.png", "/car-app/assets/assets/brand/saltmarsh.85a6a65732635e5148478d743d9ca884.png", "/car-app/assets/assets/brand/smokinggoat-hero.0588f17ef0eed7f757f22916cd4d37db.png", "/car-app/assets/assets/brand/smokinggoat.20a3a1970596ab43c5d6468d4ed549a7.png", "/car-app/assets/assets/brand/souters.f4c58d9349b6e1700fe5abcc9e9b665c.png", "/car-app/assets/assets/brand/wildings-hero-logo-text.4661e4b935726f2511f9c17a1567c89a.png", "/car-app/assets/assets/brand/wildings.076f4fcd06d19a0af0205c410f461b14.png", "/car-app/assets/assets/brand/williewastles-hero.b9d53d27b66f903b5618a7177b2ffad4.png", "/car-app/assets/assets/brand/williewastles.055a77893ced99bf3a6c5402ba5baac6.png", "/car-app/assets/assets/brand/yasmins-hero.a5aef62e37dfcecbe0afc056186f4ad9.png", "/car-app/assets/assets/brand/yasmins.8482602e9f0a965655924835625cb02b.png", "/car-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/car-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/car-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/car-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/car-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/car-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/car-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/car-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/car-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/car-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/car-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/car-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/car-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/car-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/car-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/car-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/car-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/car-app/favicon.ico", "/car-app/index.html", "/car-app/_expo/static/js/web/bundle.js?v=5a9b244664da289f5864b51e734ccafe16c9aead441e0aed8620e2f77b6b019d"]; // Hugging Face serves large files (fonts) through a redirect to its CDN. Browsers refuse to hand a *redirected* cached // response to a page, so store a plain copy instead (otherwise fonts, and so the app, fail to load offline). const plain = r => r.redirected ? r.blob().then(b => new Response(b, { status: 200, headers: { 'Content-Type': r.headers.get('Content-Type') || b.type || 'application/octet-stream' } })) : Promise.resolve(r); diff --git a/chef-app/_expo/static/js/web/bundle.js b/chef-app/_expo/static/js/web/bundle.js index 2af4084ac8d2e09942535f5b13218beeae3d5f2c..1b52d91d76f0fbf0369320df60508f16b937b2bd 100644 --- a/chef-app/_expo/static/js/web/bundle.js +++ b/chef-app/_expo/static/js/web/bundle.js @@ -872,7 +872,7 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{v __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},789,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},790,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},791,[]); -__d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ChefApp=function({section:e}={}){const{r:s,rid:o,me:n,now:L}=(0,M.useChef)(3e4);(0,fe.useReviewAlerts)(o);const _=(0,N.useSignedIn)(),U=_?.id??M.CHEF_ID,q=_?.ownerAccess&&'owner'!==_.role?'owner privileges':_?.managerAccess&&'staff'===_.role?'manager privileges':'',be=(0,xe.useSync)(e=>e.perms),ye=be.includes('*')||be.includes('takings.view');(0,i.useSoldOutLink)(!0,(_?.name??n).replace(' (example)',''));const Se=e?Te[e]:void 0,[Ie,He]=(0,I.useState)(Se?.tab??'home'),[Re,Ae]=(0,I.useState)(Se?.k??null),[De,Be]=(0,I.useState)(Se?.stock??'levels'),[$e,Oe]=(0,I.useState)(void 0),[Ee,Fe]=(0,I.useState)(Se?.gp??'dishes'),Le=(0,I.useRef)(null),Ge=(0,k.ymd)(L),Ne=(0,k.ymd)(new Date(L.getTime()+864e5));(0,p.useTipsPosted)(o,Ge);const Me=(0,X.useTravelDay)('chef',Ge),We='home'===Ie&&!Me;(0,P.useKitchenTodoChime)(o,Ge,()=>Ue('kitchen','bookings')),(0,he.useAlertWatcher)(o,{kinds:['takeaway']}),(0,I.useEffect)(()=>{(0,N.ensureAttendance)((new Date).toISOString().slice(0,10),L)},[]);const Ke=(0,I.useRef)({t:'home',k:null});Ke.current={t:Ie,k:Re};const Ve=(0,I.useRef)([]),ze=(0,l.useScrollMemory)(Le),Ue=(0,I.useCallback)((e,t=null)=>{'takings'!==t||ye||(t=null);const s=Ke.current;s.t===e&&s.k===t||(Ve.current=[...Ve.current,{...s,y:ze.leave()}].slice(-30),ze.restore(0)),He(e),Ae(t)},[ye]),qe=(0,I.useCallback)(()=>{if((0,r.runBackLayer)())return!0;const e=Ke.current;let t=Ve.current.pop();for(;t&&t.t===e.t&&t.k===e.k;)t=Ve.current.pop();if(!t&&'home'===e.t&&!e.k)return!1;const s=t??{t:'home',k:null};return ze.leave(),He(s.t),Ae(s.k),ze.restore(s.y??0),!0},[]);(0,r.useWebBack)(qe);const Qe=(0,r.useInnerBackShown)();(0,I.useEffect)(()=>{c.PITCH&&(globalThis.__pitchGo=(e,t=null,s)=>{'stock'===e&&s&&Be(s),'gp'===e&&s&&Fe(s),Ue(e,t)})},[Ue]),(0,f.useShiftReminders)({rid:o,staffId:U,name:n,kitchen:!0}),(0,C.useScheduledNotices)({rid:o,staffId:_?.id??'',name:n,onOpen:e=>{'orderlists'===e&&Ue('kitchen','orderlists'),'chat'===e&&Ue('kitchen','live')}}),(0,T.useOffRotaPrompt)({rid:o,staffId:_?.id??''}),(0,I.useEffect)(()=>{const e=H.default.addEventListener('hardwareBackPress',qe);return()=>e.remove()},[qe]),(0,I.useEffect)(()=>{'takings'!==Re||ye||(Ae(null),He('kitchen'))},[Re,ye]);const Ye=Ce.filter(e=>'takings'!==e.id||ye),Je=Re&&('takings'!==Re||ye)?Ce.find(e=>e.id===Re):null,Xe=((0,D.default)().width,Je?Je.title:{home:'Today in the kitchen',stock:c.PITCH?'Stock':'Deliveries & stock',gp:'GP & costing',creator:le.CREATOR_TITLE,orders:'Orders',kitchen:'Kitchen'}[Ie]);return(0,ve.jsxs)($.SafeAreaView,{style:{flex:1,backgroundColor:G.colours.bg},edges:['top','bottom'],children:[(0,ve.jsxs)(B.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:G.colours.border,gap:6},children:[(0,ve.jsx)(B.default,{style:{position:'absolute',top:4,right:6,zIndex:5,flexDirection:'row',alignItems:'center'},children:(0,ve.jsx)(E.VoiceSlot,{size:44})}),(0,ve.jsx)(B.default,{testID:"header-me-wrap",style:{alignItems:'flex-start',minHeight:44,justifyContent:'center',maxWidth:'70%'},children:(0,ve.jsx)(B.default,{testID:"header-me",accessibilityLabel:`Signed in as ${n.replace(' (example)','')}, Head Chef${q?`, ${q}`:''}`,style:{borderWidth:1,borderColor:G.colours.gold,borderRadius:16,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%'},children:(0,ve.jsxs)(F.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,ve.jsx)(ie.StaffAvatar,{id:M.CHEF_ID,size:24,ring:!1}),(0,ve.jsxs)(B.default,{style:{flexShrink:1},children:[(0,ve.jsxs)(F.T,{size:13,weight:"semibold",colour:G.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[n.replace(' (example)','')," \xb7 Head Chef"]}),q?(0,ve.jsx)(F.Muted,{center:!1,size:10,numberOfLines:1,children:q}):null]})]})})}),(0,ve.jsx)(O.VenueHeaderBlock,{rid:o,name:s.name,badge:"CHEF",place:"Head Chef app"}),(0,ve.jsx)(R.default,{accessibilityRole:"button",accessibilityLabel:"Open CoverCharge for Staff",onPress:()=>{const e=(0,ae.appUrl)('staff');e&&window.location.assign(e)},style:{alignSelf:'center',borderWidth:1,borderColor:G.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:3,minHeight:44,justifyContent:'center'},children:(0,ve.jsx)(F.T,{size:13,colour:G.colours.gold,children:"Staff app \u203a"})})]}),(0,ve.jsxs)(A.default,{ref:Le,...ze.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:[(0,ve.jsx)(r.BackTitleRow,{back:!('home'===Ie&&!Re||Qe),onBack:qe,title:Xe}),'home'===Ie?(0,ve.jsx)(X.DayBar,{app:"chef",today:Ge}):null,'home'===Ie&&Me?(0,ve.jsx)(X.DayView,{rid:o,day:Me,today:Ge,app:"chef"}):null,'home'===Ie?(0,ve.jsx)(oe.WhoBar,{}):null,We&&_?(0,ve.jsx)(h.MyTasksToday,{rid:o,staffId:_.id,name:_.name,onShift:(0,f.shiftNow)(_.id,L.getTime()).on}):null,We?(0,ve.jsx)(p.TodaysTipsCard,{rid:o,today:Ge}):null,We?(0,ve.jsx)(p.TipsPotCard,{rid:o,today:Ge}):null,We?(0,ve.jsx)(b.CoversToday,{rid:o,onPress:()=>Ue('kitchen','bookings')}):null,We?(0,ve.jsx)(y.LastFoodBanner,{rid:o,now:L}):null,We?(0,ve.jsx)(x.NextTableFreeCard,{rid:o,now:L}):null,We?(0,ve.jsx)(j.KitchenSignoffs,{rid:o,today:Ge,by:n,app:"chef"}):null,We?(0,ve.jsxs)(B.default,{style:{gap:4},children:[(0,ve.jsx)(j.PlattersBooked,{rid:o,date:Ge,label:"Platters booked today"}),(0,ve.jsx)(j.PlattersBooked,{rid:o,date:Ne,label:"Platters booked tomorrow"})]}):null,We?(0,ve.jsx)(me.ChefAssistantButton,{}):null,We?(0,ve.jsx)(Pe,{go:(e,t)=>{'stock'===e&&t&&Be(t),'gp'===e&&t&&Fe(t),'orders'===e&&Oe(t),Ue(e,'kitchen'===e?t??null:null)}}):null,'stock'!==Ie||c.PITCH?null:(0,ve.jsx)(Y.KitchenCosts,{rid:o,me:(_?.name??n).replace(' (example)',''),actor:{name:(_?.name??n).replace(' (example)',''),role:'head-chef'},initial:'deliveries'===De?'deliveries':'take'===De?'count':'deliveries'},`s-${De}`),'gp'!==Ie||c.PITCH?null:(0,ve.jsx)(Y.KitchenCosts,{rid:o,me:(_?.name??n).replace(' (example)',''),actor:{name:(_?.name??n).replace(' (example)',''),role:'head-chef'},initial:"dishgp"},`g-${Ee}`),'stock'===Ie&&c.PITCH?(0,ve.jsx)(Q.StockScreen,{initial:De},De):null,'gp'===Ie&&c.PITCH?(0,ve.jsx)(W.GpScreen,{initial:Ee},Ee):null,'creator'===Ie?(0,ve.jsx)(le.DishCreator,{rid:o,canPublish:!1}):null,'orders'===Ie?(0,ve.jsx)(z.OrdersScreen,{focus:$e},$e??'all'):null,'kitchen'!==Ie||Je?null:(0,ve.jsxs)(B.default,{style:{gap:10},children:[(0,ve.jsx)(B.default,{style:{borderRadius:14,borderWidth:1,borderColor:G.colours.border,backgroundColor:G.colours.surface,overflow:'hidden'},children:Ye.map((e,t)=>(0,ve.jsx)(R.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>Ue(Ie,e.id),style:({pressed:e})=>({padding:12,borderTopWidth:t?1:0,borderColor:G.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,ve.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,ve.jsxs)(B.default,{style:{flex:1},children:[(0,ve.jsx)(F.T,{weight:"medium",children:e.title}),(0,ve.jsx)(F.Muted,{children:e.sub})]}),(0,ve.jsx)(F.T,{colour:G.colours.muted,children:"\u203a"})]})},e.id))}),(0,ve.jsx)(F.Muted,{children:"Head Chef sees kitchen, stock, food costs and GP. Payroll, wages and the restaurant's billing stay in CoverCharge for Managers."}),(0,ve.jsxs)(F.Muted,{center:!0,children:["Head Chef app \xb7 ",d.APP_VERSION," \xb7 ",'live'===xe.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),'myshift'===Re&&U?(0,ve.jsxs)(B.default,{style:{gap:10},testID:"chef-myshift",children:[(0,ve.jsx)(te.ClockInOut,{}),(0,ve.jsx)(se.MyUpcomingShifts,{staffId:U,team:!0})]}):null,'mypay'===Re?(0,ve.jsxs)(B.default,{style:{gap:10},testID:"chef-mypay",children:[(0,ve.jsx)(Z.MyPeriods,{staffId:U}),(0,ve.jsx)(J.MyHoursPay,{staffId:U}),(0,ve.jsx)(ee.MyTips,{staffId:U}),(0,ve.jsx)(F.Card,{children:(0,ve.jsx)(u.PhoneAlerts,{})})]}):null,'alerts'===Re?(0,ve.jsx)(B.default,{testID:"chef-alerts",children:(0,ve.jsx)(u.PhoneAlerts,{})}):null,'avatar'===Re?(0,ve.jsx)(t.AvatarMaker,{meId:_?.id??M.CHEF_ID,me:n}):null,'reviews'===Re?(0,ve.jsx)(ge.ReviewsSection,{rid:o,mode:"read",venueName:s.name}):null,'bookings'===Re?(0,ve.jsx)(S.TodaysBookings,{rid:o,today:Ge,by:n,app:"chef"}):null,'specials'===Re?(0,ve.jsx)(de.SpecialsEditor,{rid:o,me:n,app:"chef",now:L}):null,'forecast'===Re?(0,ve.jsx)(K.ChefForecast,{openPrep:()=>Ue('kitchen','prep')}):null,'prep'===Re?(0,ve.jsx)(V.PrepScreen,{}):null,'live'===Re?(0,ve.jsx)(V.TeamScreen,{}):null,'waste'===Re?(0,ve.jsx)(V.WasteScreen,{}):null,'recipes'===Re?(0,ve.jsx)(pe.RecipeCards,{rid:o,actor:{name:n,role:'head-chef'},mode:"edit"}):null,'allergens'===Re?(0,ve.jsx)(V.AllergenScreen,{openCards:()=>Ue('kitchen','recipes')}):null,'compliance'===Re?(0,ve.jsx)(V.ComplianceScreen,{}):null,'takings'===Re&&ye?(0,ve.jsx)(p.CashUpScreen,{rid:o,today:Ge,canEdit:!1,chartsOnly:!0,who:{id:U,name:n.replace(' (example)','')}}):null,'board'===Re?(0,ve.jsx)(ke.QuestionBoard,{rid:o,today:Ge,manager:!1,by:""}):null,'teamtasks'===Re?(0,ve.jsx)(h.KitchenTeamTasks,{rid:o,actor:_}):null,'orderlists'===Re?(0,ve.jsx)(v.OrderListsScreen,{rid:o,today:Ge,editor:!0,who:{id:U,name:n.replace(' (example)','')}}):null,'foodsafety'===Re?(0,ve.jsx)(w.FoodSafetyCard,{children:(0,ve.jsx)(R.default,{accessibilityRole:"button",onPress:()=>Ue('kitchen','haccp'),children:(0,ve.jsx)(F.T,{colour:G.colours.gold,children:"Today\u2019s temperature log \u203a"})})}):null,'haccp'===Re?(0,ve.jsx)(re.HaccpLog,{mode:"chef",me:n,meId:M.CHEF_ID,now:L}):null,'accidents'===Re?(0,ve.jsx)(ne.AccidentBook,{app:"chef",me:n,meId:M.CHEF_ID,now:L,seeAll:!1}):null]}),(0,ve.jsx)(je.BottomTabs,{tablist:!0,background:G.colours.surface,active:Ie,onPress:e=>Ue(e),tabs:we.map(e=>({id:e.id,label:e.label,short:'creator'===e.id?'Creator':void 0,icon:e.icon}))}),(0,ve.jsx)(me.ChefAssistantSheet,{go:(e,t)=>{'orders'===e?(Oe(t),Ue('orders')):'gp'===e?Ue('gp'):Ue('kitchen',e)}}),(0,ve.jsx)(ce.AlertHost,{variant:"chef",rid:o,skipTakeaway:!0}),(0,ve.jsx)(ue.KitchenFlash,{rid:o,me:n})]})};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),i=_r(_d[3]),n=_r(_d[4]),l=_r(_d[5]),r=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),f=_r(_d[12]),k=_r(_d[13]),b=_r(_d[14]),y=_r(_d[15]),x=_r(_d[16]),j=_r(_d[17]),v=_r(_d[18]),w=_r(_d[19]),C=_r(_d[20]),T=_r(_d[21]),P=_r(_d[22]),S=_r(_d[23]),I=_r(_d[24]),H=e(_r(_d[25]));_r(_d[26]);var R=e(_r(_d[27])),A=e(_r(_d[28])),D=e(_r(_d[29])),B=e(_r(_d[30])),$=_r(_d[31]),O=_r(_d[32]),E=_r(_d[33]),F=_r(_d[34]),L=_r(_d[35]),G=_r(_d[36]),N=_r(_d[37]),_=_r(_d[38]),M=_r(_d[39]),W=_r(_d[40]),K=_r(_d[41]),V=_r(_d[42]),z=_r(_d[43]),U=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),Y=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),se=_r(_d[53]),oe=_r(_d[54]),ie=_r(_d[55]),ae=_r(_d[56]),ne=_r(_d[57]),le=_r(_d[58]),re=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),pe=_r(_d[64]),ge=_r(_d[65]),fe=_r(_d[66]),ke=_r(_d[67]),be=_r(_d[68]),me=_r(_d[69]),ye=_r(_d[70]),xe=_r(_d[71]),je=_r(_d[72]),ve=_r(_d[73]);s.LIVE_HEAD_CHEF&&(0,o.requireRealData)();const we=[{id:'home',label:'Home',icon:'home'},{id:'stock',label:'Stock',icon:'box'},{id:'gp',label:'GP',icon:'forecast'},{id:'creator',label:le.CREATOR_TITLE,icon:'sparkle'},{id:'orders',label:'Orders',icon:'orders'},{id:'kitchen',label:'Kitchen',icon:'platter'}],Ce=[{id:'alerts',title:'Turn on alerts',sub:'Get your reminders on this phone, even with the app closed'},{id:'avatar',title:'My avatar',sub:'Animals, Bar & kitchen, sea, sport, colours, patterns or your own photo'},{id:'reviews',title:'Reviews',sub:'Published reviews, newest first'},{id:'myshift',title:'My shifts & clock in',sub:'Clock in and out (checks you are at the venue), breaks, and your shifts on the rota'},{id:'mypay',title:'My pay & tips',sub:'Your hours, tips share, tip goal, paydays and payslip info. Only you see this'},{id:'takings',title:'Takings & tips graphs',sub:'Daily cash ups, weekly sales, this week vs last, categories and the Tips pot (view only)'},{id:'bookings',title:'Today\u2019s bookings',sub:'Covers, allergens to sign off, platters and other reservations, dogs, access and vegan/vegetarian'},{id:'recipes',title:'Recipe cards',sub:'Plating photo, ingredients, method, allergens, section and price; you sign each card off before it goes live'},{id:'specials',title:'Specials board',sub:'Photo of the chalkboard or typed specials with allergens; shown in the customer app'},{id:'board',title:'Question board',sub:'Ask the team anything anonymously, and vote'},{id:'teamtasks',title:'Kitchen team tasks',sub:'Daily tasks for your chefs, commis and KPs'},{id:'orderlists',title:'Order lists',sub:'Alsons drinks, Cash and carry: add items, tick on the day, finish and carry over'},{id:'foodsafety',title:'Food safety (CookSafe)',sub:'Based on CookSafe (Food Standards Scotland). Full logs coming in the next update'},{id:'haccp',title:'Food safety log (HACCP)',sub:'Temperatures, cleaning and allergen checks; voice entry; limits; EHO export'},{id:'accidents',title:'Accident book',sub:'Accidents and near misses; you see your own entries'},{id:'forecast',title:'Forecast',sub:'Covers per day for the week ahead, and prep from the forecast'},{id:'prep',title:'Prep list',sub:'From the forecast and bookings, tick off as you go'},{id:'live',title:'Live tickets, sold out, team & chat',sub:'Orders, readiness alerts, sold out, who\u2019s on, rota, team chat and private messages'},{id:'waste',title:'Waste log',sub:'Item, quantity, reason and cost; weekly total and % of sales'},{id:'allergens',title:'Allergens',sub:'14-allergen matrix from the recipe cards, costing cross-check and audit log'},{id:'compliance',title:'Kitchen compliance',sub:'Fridge, freezer, cooking and cooling temps; cleaning; daily checks'}],Te={stock:{tab:'stock',stock:'levels'},'stock-take':{tab:'stock',stock:'take'},deliveries:{tab:'stock',stock:'deliveries'},gp:{tab:'gp',gp:'dishes'},'price-changes':{tab:'gp',gp:'changes'},'gp-week':{tab:'gp',gp:'week'},'menu-engineering':{tab:'gp',gp:'engineering'},orders:{tab:'orders'},forecast:{tab:'kitchen',k:'forecast'},prep:{tab:'kitchen',k:'prep'},live:{tab:'kitchen',k:'live'},waste:{tab:'kitchen',k:'waste'},recipes:{tab:'kitchen',k:'recipes'},'recipe-cards':{tab:'kitchen',k:'recipes'},allergens:{tab:'kitchen',k:'allergens'},compliance:{tab:'kitchen',k:'compliance'},haccp:{tab:'kitchen',k:'haccp'},specials:{tab:'kitchen',k:'specials'},accidents:{tab:'kitchen',k:'accidents'},'new-dish':{tab:'creator'}};function Pe({go:e}){const{k:t,c:s,menu:o,now:i,rid:l,me:r}=(0,M.useChef)(3e4),d=(0,U.useSheetReminders)(),u=(0,M.useWeek)(),{covers:h,label:p,enough:f,booked:k}=(0,M.useForecast)(),b=(0,z.useSuggestions)(),y=t.ingredients.filter(e=>e.onHand<=0||(0,M.isLow)(e.onHand,e.par)),x=b.filter(e=>e.ordersToday&&!e.placedToday),j=(0,_.priceImpacts)(o,t.recipes,t.ingredients,t.targetGp).filter(e=>e.dropped.length),v=t.deliveries.filter(e=>'expected'===e.status),w=!t.recipes.length||!t.ingredients.length,C=w?[]:s.filter(e=>e.below),T=(0,n.useLiveState)(),P=(0,be.useRecipeCards)(l).filter(e=>!e.signOff),S=(0,Y.useKitchenSummary)(l),[H,A]=(0,I.useState)(!1);return(0,ve.jsxs)(B.default,{style:{gap:12},testID:"chef-dashboard",children:[(0,ve.jsx)(re.MissedBanner,{mode:"chef",now:i,onPress:()=>e('kitchen','haccp')}),d.map(t=>(0,ve.jsx)(R.default,{accessibilityRole:"button",onPress:()=>e('orders',t.supplierId),children:(0,ve.jsxs)(F.Banner,{kind:'red'===t.tone?'danger':'warn',title:`\u23f0 ${t.text}`,children:["Tap to open the ",t.name," order sheet. Nothing is sent until you press Send."]})},t.supplierId)),P.length?(0,ve.jsx)(R.default,{testID:"cards-awaiting",accessibilityRole:"button",onPress:()=>e('kitchen','recipes'),children:(0,ve.jsxs)(F.Banner,{kind:"warn",title:`${P.length} recipe card${1===P.length?'':'s'} awaiting your sign-off`,children:[P.slice(0,4).map(e=>e.dish).join(', '),". Guests see \"awaiting allergen sign-off\" and cannot order these until you sign them off."]})}):null,(0,ve.jsx)(q.ShellfishTile,{rid:l,by:r,app:"chef",onOrder:()=>e('orders','os-kittyfisher')}),(0,ve.jsx)(F.Button,{testID:"chef-add-soldout",label:"Add sold out",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>A(!0),style:{minHeight:56}}),(0,ve.jsxs)(F.Row,{wrap:!0,gap:10,children:[c.PITCH?null:(0,ve.jsx)(M.Tile,{testID:"tile-gp",label:"Dishes under target GP",value:S.costed?`${S.below} of ${S.costed}`:'Nothing yet',sub:S.costed?`Average ${(0,M.pct1)(S.avgGp??0)} \xb7 target ${S.target}%`:'Record a delivery, then cost your recipe cards',tone:S.costed?S.below?'amber':'ok':void 0,onPress:()=>e('gp','dishes')}),c.PITCH?w?(0,ve.jsx)(M.Tile,{testID:"tile-gp",label:"GP this week vs target",value:"Nothing yet",sub:"Add ingredients and recipe costs to see GP",onPress:()=>e('gp','week')}):(0,ve.jsx)(M.Tile,{testID:"tile-gp",label:"GP this week vs target",value:(0,M.pct1)(u.theo),sub:`Target ${t.targetGp}% \xb7 actual ${(0,M.pct1)(u.actual)}`,tone:u.theoe('gp','week')}):null,c.PITCH?null:(0,ve.jsx)(M.Tile,{testID:"tile-stock",label:"Stock value",value:null!=S.stockValue?(0,L.gbp)(S.stockValue):'Nothing yet',sub:S.lastCount?`At cost, counted ${S.lastCount}`:'No stock counted yet',onPress:()=>e('stock','take')}),c.PITCH?(0,ve.jsx)(M.Tile,{testID:"tile-stock",label:"Stock value",value:t.ingredients.length?(0,L.gbp)((0,M.stockValue)(t.ingredients)):'Nothing yet',sub:t.ingredients.length?'At cost':'No stock counted yet',onPress:()=>e('stock','levels')}):null,(0,ve.jsx)(M.Tile,{label:"Items low or out",value:t.ingredients.length?`${y.length}`:'Nothing yet',sub:t.ingredients.length?y.slice(0,3).map(e=>e.name).join(', '):'No stock counted yet',tone:y.some(e=>e.onHand<=0)?'red':y.length?'amber':'ok',onPress:()=>e('stock','levels')}),(0,ve.jsx)(M.Tile,{label:"Waste this week",value:t.waste.length?(0,L.gbp)(u.wasteWeek):'Nothing yet',sub:u.sales?`${(0,M.pct1)(u.wasteWeek/u.sales*100)} of food sales`:'',onPress:()=>e('kitchen','waste')}),f?(0,ve.jsx)(M.Tile,{testID:"tile-forecast",label:"Covers forecast today",value:`${h}`,sub:p,onPress:()=>e('kitchen','forecast')}):(0,ve.jsx)(M.Tile,{testID:"tile-booked",label:"Booked so far today",value:'ready'===T?`${k}`:'connecting'===T?'Connecting\u2026':'Not connected',sub:"Not enough history for a forecast yet",onPress:()=>e('kitchen','bookings')}),(0,ve.jsx)(M.Tile,{label:"Orders due today",value:`${x.length}`,sub:x.map(e=>`${e.s.name} by ${e.s.cutoff}`).join(' \xb7 ')||'None',tone:x.some(e=>e.cutPassed)?'red':x.length?'amber':'ok',onPress:()=>e('orders')})]}),j.map(e=>(0,ve.jsxs)(F.Banner,{kind:"danger",title:`${e.ing.name} ${e.pct>0?'+':''}${e.pct.toFixed(0)}%: ${e.dropped.length} dish${1===e.dropped.length?'':'es'} drop below target`,children:[e.dropped.map(e=>e.item.name).join(', '),". Open GP \u203a Price changes."]},e.ing.id)),v.length?(0,ve.jsx)(R.default,{accessibilityRole:"button",onPress:()=>e('stock','deliveries'),children:(0,ve.jsx)(F.Banner,{kind:"info",title:`${v.length} deliver${1===v.length?'y':'ies'} to check in today`,children:"Count in against the order, flag shorts and price changes."})}):null,C.length?(0,ve.jsx)(R.default,{accessibilityRole:"button",onPress:()=>e('gp','dishes'),children:(0,ve.jsxs)(F.Banner,{kind:"warn",title:`${C.length} dishes below ${t.targetGp}% GP`,children:[C.slice(0,4).map(e=>e.item.name).join(', '),C.length>4?'\u2026':'']})}):null,(0,ve.jsx)(F.Row,{wrap:!0,gap:8,children:[['Recipe cards','recipes'],['Food safety log','haccp'],['Specials board','specials'],[le.CREATOR_TITLE,'creator'],['Forecast','forecast'],['Prep list','prep'],['Live tickets & sold out','live'],['Allergens','allergens'],['Accident book','accidents']].map(([t,s])=>(0,ve.jsx)(R.default,{accessibilityRole:"button",accessibilityLabel:t,onPress:()=>'creator'===s?e('creator'):e('kitchen',s),style:{flexGrow:1,flexBasis:140,padding:12,borderRadius:12,borderWidth:1.5,borderColor:G.colours.gold,backgroundColor:G.colours.surface},children:(0,ve.jsxs)(F.T,{weight:"semibold",children:[t," \u203a"]})},s))}),(0,ve.jsx)(F.Badge,{kind:"neutral",label:"Nothing is ordered or sent from here"}),(0,ve.jsx)(ye.SoldOutSheet,{visible:H,onClose:()=>A(!1),rid:l,by:r,hideLinks:!0,testID:"chef-soldout-sheet"})]})}},792,[793,978,884,979,986,1051,1052,1015,2,1053,1057,1058,1090,858,1095,1099,1100,1103,1104,1107,1108,1110,1111,1112,34,373,236,402,295,426,102,36,873,1137,794,867,821,1084,1139,1145,1148,1149,1152,1167,1168,1169,1171,1172,1179,1182,1185,1193,1194,1198,1199,925,1003,1200,1158,1201,1208,1213,1222,1215,1156,1224,1228,1195,874,1229,1154,987,1230,25]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ChefApp=function({section:e}={}){const{r:s,rid:i,me:n,now:L}=(0,_.useChef)(3e4);(0,be.useReviewAlerts)(i);const M=(0,G.useSignedIn)(),q=M?.id??_.CHEF_ID,Q=M?.ownerAccess&&'owner'!==M.role?'owner privileges':M?.managerAccess&&'staff'===M.role?'manager privileges':'',me=(0,je.useSync)(e=>e.perms),xe=me.includes('*')||me.includes('takings.view');(0,o.useSoldOutLink)(!0,(M?.name??n).replace(' (example)',''));const Re=e?Se[e]:void 0,[He,Ae]=(0,I.useState)(Re?.tab??'home'),[De,$e]=(0,I.useState)(Re?.k??null),[Be,Oe]=(0,I.useState)(Re?.stock??'levels'),[Ee,Fe]=(0,I.useState)(void 0),[Le,Ne]=(0,I.useState)(Re?.gp??'dishes'),Ge=(0,I.useRef)(null),Me=(0,b.ymd)(L),We=(0,b.ymd)(new Date(L.getTime()+864e5));(0,p.useTipsPosted)(i,Me);const Ke=(0,Z.useTravelDay)('chef',Me),Ve='home'===He&&!Ke;(0,P.useKitchenTodoChime)(i,Me,()=>Qe('kitchen','bookings')),(0,pe.useAlertWatcher)(i,{kinds:['takeaway']}),(0,I.useEffect)(()=>{(0,G.ensureAttendance)((new Date).toISOString().slice(0,10),L)},[]);const ze=(0,I.useRef)({t:'home',k:null});ze.current={t:He,k:De};const Ue=(0,I.useRef)([]),qe=(0,l.useScrollMemory)(Ge),Qe=(0,I.useCallback)((e,t=null)=>{'takings'!==t||xe||(t=null);const s=ze.current;s.t===e&&s.k===t||(Ue.current=[...Ue.current,{...s,y:qe.leave()}].slice(-30),qe.restore(0)),Ae(e),$e(t)},[xe]),Ye=(0,I.useCallback)(()=>{if((0,r.runBackLayer)())return!0;const e=ze.current;let t=Ue.current.pop();for(;t&&t.t===e.t&&t.k===e.k;)t=Ue.current.pop();if(!t&&'home'===e.t&&!e.k)return!1;const s=t??{t:'home',k:null};return qe.leave(),Ae(s.t),$e(s.k),qe.restore(s.y??0),!0},[]);(0,r.useWebBack)(Ye);const Je=(0,r.useInnerBackShown)();(0,I.useEffect)(()=>{c.PITCH&&(globalThis.__pitchGo=(e,t=null,s)=>{'stock'===e&&s&&Oe(s),'gp'===e&&s&&Ne(s),Qe(e,t)})},[Qe]),(0,f.useShiftReminders)({rid:i,staffId:q,name:n,kitchen:!0}),(0,C.useScheduledNotices)({rid:i,staffId:M?.id??'',name:n,onOpen:e=>{'orderlists'===e&&Qe('kitchen','orderlists'),'chat'===e&&Qe('kitchen','live')}}),(0,T.useOffRotaPrompt)({rid:i,staffId:M?.id??''}),(0,I.useEffect)(()=>{const e=R.default.addEventListener('hardwareBackPress',Ye);return()=>e.remove()},[Ye]),(0,I.useEffect)(()=>{'takings'!==De||xe||($e(null),Ae('kitchen'))},[De,xe]);const Xe=Pe.filter(e=>'takings'!==e.id||xe),Ze=De&&('takings'!==De||xe)?Pe.find(e=>e.id===De):null,et=((0,D.default)().width,Ze?Ze.title:{home:'Today in the kitchen',stock:c.PITCH?'Stock':'Deliveries & stock',gp:'GP & costing',creator:re.CREATOR_TITLE,orders:'Orders',rota:'Rota',kitchen:'Kitchen'}[He]);return(0,ve.jsxs)(B.SafeAreaView,{style:{flex:1,backgroundColor:N.colours.bg},edges:['top','bottom'],children:[(0,ve.jsxs)($.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:N.colours.border,gap:6},children:[(0,ve.jsx)($.default,{style:{position:'absolute',top:4,right:6,zIndex:5,flexDirection:'row',alignItems:'center'},children:(0,ve.jsx)(E.VoiceSlot,{size:44})}),(0,ve.jsx)($.default,{testID:"header-me-wrap",style:{alignItems:'flex-start',minHeight:44,justifyContent:'center',maxWidth:'70%'},children:(0,ve.jsx)($.default,{testID:"header-me",accessibilityLabel:`Signed in as ${n.replace(' (example)','')}, Head Chef${Q?`, ${Q}`:''}`,style:{borderWidth:1,borderColor:N.colours.gold,borderRadius:16,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%'},children:(0,ve.jsxs)(F.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,ve.jsx)(oe.StaffAvatar,{id:_.CHEF_ID,size:24,ring:!1}),(0,ve.jsxs)($.default,{style:{flexShrink:1},children:[(0,ve.jsxs)(F.T,{size:13,weight:"semibold",colour:N.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[n.replace(' (example)','')," \xb7 Head Chef"]}),Q?(0,ve.jsx)(F.Muted,{center:!1,size:10,numberOfLines:1,children:Q}):null]})]})})}),(0,ve.jsx)(O.VenueHeaderBlock,{rid:i,name:s.name,badge:"CHEF",place:"Head Chef app"}),(0,ve.jsx)(H.default,{accessibilityRole:"button",accessibilityLabel:"Open CoverCharge for Staff",onPress:()=>{const e=(0,ne.appUrl)('staff');e&&window.location.assign(e)},style:{alignSelf:'center',borderWidth:1,borderColor:N.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:3,minHeight:44,justifyContent:'center'},children:(0,ve.jsx)(F.T,{size:13,colour:N.colours.gold,children:"Staff app \u203a"})})]}),(0,ve.jsxs)(A.default,{ref:Ge,...qe.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:[(0,ve.jsx)(r.BackTitleRow,{back:!('home'===He&&!De||Je),onBack:Ye,title:et}),'home'===He?(0,ve.jsx)(Z.DayBar,{app:"chef",today:Me}):null,'home'===He&&Ke?(0,ve.jsx)(Z.DayView,{rid:i,day:Ke,today:Me,app:"chef"}):null,'home'===He?(0,ve.jsx)(ae.WhoBar,{}):null,Ve&&M?(0,ve.jsx)(h.MyTasksToday,{rid:i,staffId:M.id,name:M.name,onShift:(0,f.shiftNow)(M.id,L.getTime()).on}):null,Ve?(0,ve.jsx)(p.TodaysTipsCard,{rid:i,today:Me}):null,Ve?(0,ve.jsx)(p.TipsPotCard,{rid:i,today:Me}):null,Ve?(0,ve.jsx)(k.CoversToday,{rid:i,onPress:()=>Qe('kitchen','bookings')}):null,Ve?(0,ve.jsx)(y.LastFoodBanner,{rid:i,now:L}):null,Ve?(0,ve.jsx)(x.NextTableFreeCard,{rid:i,now:L}):null,Ve?(0,ve.jsx)(j.KitchenSignoffs,{rid:i,today:Me,by:n,app:"chef"}):null,Ve?(0,ve.jsxs)($.default,{style:{gap:4},children:[(0,ve.jsx)(j.PlattersBooked,{rid:i,date:Me,label:"Platters booked today"}),(0,ve.jsx)(j.PlattersBooked,{rid:i,date:We,label:"Platters booked tomorrow"})]}):null,Ve?(0,ve.jsx)(ye.ChefAssistantButton,{}):null,Ve?(0,ve.jsx)(Ie,{go:(e,t)=>{'stock'===e&&t&&Oe(t),'gp'===e&&t&&Ne(t),'orders'===e&&Fe(t),Qe(e,'kitchen'===e?t??null:null)}}):null,'stock'!==He||c.PITCH?null:(0,ve.jsx)(J.KitchenCosts,{rid:i,me:(M?.name??n).replace(' (example)',''),actor:{name:(M?.name??n).replace(' (example)',''),role:'head-chef'},initial:'deliveries'===Be?'deliveries':'take'===Be?'count':'deliveries'},`s-${Be}`),'gp'!==He||c.PITCH?null:(0,ve.jsx)(J.KitchenCosts,{rid:i,me:(M?.name??n).replace(' (example)',''),actor:{name:(M?.name??n).replace(' (example)',''),role:'head-chef'},initial:"dishgp"},`g-${Le}`),'stock'===He&&c.PITCH?(0,ve.jsx)(Y.StockScreen,{initial:Be},Be):null,'gp'===He&&c.PITCH?(0,ve.jsx)(W.GpScreen,{initial:Le},Le):null,'creator'===He?(0,ve.jsx)(re.DishCreator,{rid:i,canPublish:!1}):null,'orders'===He?(0,ve.jsx)(z.OrdersScreen,{focus:Ee},Ee??'all'):null,'rota'===He?(0,ve.jsx)(F.Card,{children:(0,ve.jsx)(U.KitchenRotaTab,{today:Me})}):null,'kitchen'!==He||Ze?null:(0,ve.jsxs)($.default,{style:{gap:10},children:[(0,ve.jsxs)($.default,{style:{borderRadius:14,borderWidth:1,borderColor:N.colours.border,backgroundColor:N.colours.surface,overflow:'hidden'},children:[Te.map(e=>(0,ve.jsx)(H.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:`${e.title}. ${e.sub}`,onPress:()=>Qe(e.id),style:({pressed:e})=>({padding:12,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,ve.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,ve.jsxs)($.default,{style:{flex:1},children:[(0,ve.jsx)(F.T,{weight:"medium",children:e.title}),(0,ve.jsx)(F.Muted,{children:e.sub})]}),(0,ve.jsx)(F.T,{colour:N.colours.muted,children:"\u203a"})]})},e.id)),Xe.map(e=>(0,ve.jsx)(H.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>Qe(He,e.id),style:({pressed:e})=>({padding:12,borderTopWidth:1,borderColor:N.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,ve.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,ve.jsxs)($.default,{style:{flex:1},children:[(0,ve.jsx)(F.T,{weight:"medium",children:e.title}),(0,ve.jsx)(F.Muted,{children:e.sub})]}),(0,ve.jsx)(F.T,{colour:N.colours.muted,children:"\u203a"})]})},e.id))]}),(0,ve.jsx)(F.Muted,{children:"Head Chef sees kitchen, stock, food costs and GP. Payroll, wages and the restaurant's billing stay in CoverCharge for Managers."}),(0,ve.jsxs)(F.Muted,{center:!0,children:["Head Chef app \xb7 ",d.APP_VERSION," \xb7 ",'live'===je.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),'myshift'===De&&q?(0,ve.jsxs)($.default,{style:{gap:10},testID:"chef-myshift",children:[(0,ve.jsx)(se.ClockInOut,{}),(0,ve.jsx)(ie.MyUpcomingShifts,{staffId:q,team:!0})]}):null,'mypay'===De?(0,ve.jsxs)($.default,{style:{gap:10},testID:"chef-mypay",children:[(0,ve.jsx)(ee.MyPeriods,{staffId:q}),(0,ve.jsx)(X.MyHoursPay,{staffId:q}),(0,ve.jsx)(te.MyTips,{staffId:q}),(0,ve.jsx)(F.Card,{children:(0,ve.jsx)(u.PhoneAlerts,{})})]}):null,'alerts'===De?(0,ve.jsx)($.default,{testID:"chef-alerts",children:(0,ve.jsx)(u.PhoneAlerts,{})}):null,'avatar'===De?(0,ve.jsx)(t.AvatarMaker,{meId:M?.id??_.CHEF_ID,me:n}):null,'reviews'===De?(0,ve.jsx)(fe.ReviewsSection,{rid:i,mode:"read",venueName:s.name}):null,'bookings'===De?(0,ve.jsx)(S.TodaysBookings,{rid:i,today:Me,by:n,app:"chef"}):null,'specials'===De?(0,ve.jsx)(ce.SpecialsEditor,{rid:i,me:n,app:"chef",now:L}):null,'forecast'===De?(0,ve.jsx)(K.ChefForecast,{openPrep:()=>Qe('kitchen','prep')}):null,'prep'===De?(0,ve.jsx)(V.PrepScreen,{}):null,'live'===De?(0,ve.jsx)(V.TeamScreen,{}):null,'waste'===De?(0,ve.jsx)(V.WasteScreen,{}):null,'recipes'===De?(0,ve.jsx)(ge.RecipeCards,{rid:i,actor:{name:n,role:'head-chef'},mode:"edit"}):null,'allergens'===De?(0,ve.jsx)(V.AllergenScreen,{openCards:()=>Qe('kitchen','recipes')}):null,'compliance'===De?(0,ve.jsx)(V.ComplianceScreen,{}):null,'takings'===De&&xe?(0,ve.jsx)(p.CashUpScreen,{rid:i,today:Me,canEdit:!1,chartsOnly:!0,who:{id:q,name:n.replace(' (example)','')}}):null,'board'===De?(0,ve.jsx)(ke.QuestionBoard,{rid:i,today:Me,manager:!1,by:""}):null,'teamtasks'===De?(0,ve.jsx)(h.KitchenTeamTasks,{rid:i,actor:M}):null,'orderlists'===De?(0,ve.jsx)(w.OrderListsScreen,{rid:i,today:Me,editor:!0,who:{id:q,name:n.replace(' (example)','')}}):null,'foodsafety'===De?(0,ve.jsx)(v.FoodSafetyCard,{children:(0,ve.jsx)(H.default,{accessibilityRole:"button",onPress:()=>Qe('kitchen','haccp'),children:(0,ve.jsx)(F.T,{colour:N.colours.gold,children:"Today\u2019s temperature log \u203a"})})}):null,'haccp'===De?(0,ve.jsx)(de.HaccpLog,{mode:"chef",me:n,meId:_.CHEF_ID,now:L}):null,'accidents'===De?(0,ve.jsx)(le.AccidentBook,{app:"chef",me:n,meId:_.CHEF_ID,now:L,seeAll:!1}):null]}),(0,ve.jsx)(we.BottomTabs,{tablist:!0,background:N.colours.surface,active:'orders'===He?'kitchen':He,onPress:e=>Qe(e),tabs:Ce.map(e=>({id:e.id,label:e.label,short:'creator'===e.id?'Creator':void 0,icon:e.icon,a11y:'rota'===e.id?'Rota, the kitchen rota':void 0}))}),(0,ve.jsx)(ye.ChefAssistantSheet,{go:(e,t)=>{'orders'===e?(Fe(t),Qe('orders')):'gp'===e?Qe('gp'):Qe('kitchen',e)}}),(0,ve.jsx)(ue.AlertHost,{variant:"chef",rid:i,skipTakeaway:!0}),(0,ve.jsx)(he.KitchenFlash,{rid:i,me:n})]})};var t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),o=_r(_d[3]),n=_r(_d[4]),l=_r(_d[5]),r=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),f=_r(_d[12]),b=_r(_d[13]),k=_r(_d[14]),y=_r(_d[15]),x=_r(_d[16]),j=_r(_d[17]),w=_r(_d[18]),v=_r(_d[19]),C=_r(_d[20]),T=_r(_d[21]),P=_r(_d[22]),S=_r(_d[23]),I=_r(_d[24]),R=e(_r(_d[25]));_r(_d[26]);var H=e(_r(_d[27])),A=e(_r(_d[28])),D=e(_r(_d[29])),$=e(_r(_d[30])),B=_r(_d[31]),O=_r(_d[32]),E=_r(_d[33]),F=_r(_d[34]),L=_r(_d[35]),N=_r(_d[36]),G=_r(_d[37]),M=_r(_d[38]),_=_r(_d[39]),W=_r(_d[40]),K=_r(_d[41]),V=_r(_d[42]),z=_r(_d[43]),U=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),Y=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),se=_r(_d[53]),ie=_r(_d[54]),ae=_r(_d[55]),oe=_r(_d[56]),ne=_r(_d[57]),le=_r(_d[58]),re=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),pe=_r(_d[64]),ge=_r(_d[65]),fe=_r(_d[66]),be=_r(_d[67]),ke=_r(_d[68]),me=_r(_d[69]),ye=_r(_d[70]),xe=_r(_d[71]),je=_r(_d[72]),we=_r(_d[73]),ve=_r(_d[74]);s.LIVE_HEAD_CHEF&&(0,i.requireRealData)();const Ce=[{id:'home',label:'Home',icon:'home'},{id:'stock',label:'Stock',icon:'box'},{id:'gp',label:'GP',icon:'forecast'},{id:'creator',label:re.CREATOR_TITLE,icon:'sparkle'},{id:'rota',label:'Rota',icon:'rota'},{id:'kitchen',label:'Kitchen',icon:'platter'}],Te=[{id:'orders',title:'Orders',sub:'Supplier order sheets, what is due today and cut-off times. Nothing is sent until you press Send'}],Pe=[{id:'alerts',title:'Turn on alerts',sub:'Get your reminders on this phone, even with the app closed'},{id:'avatar',title:'My avatar',sub:'Animals, Bar & kitchen, sea, sport, colours, patterns or your own photo'},{id:'reviews',title:'Reviews',sub:'Published reviews, newest first'},{id:'myshift',title:'My shifts & clock in',sub:'Clock in and out (checks you are at the venue), breaks, and your shifts on the rota'},{id:'mypay',title:'My pay & tips',sub:'Your hours, tips share, tip goal, paydays and payslip info. Only you see this'},{id:'takings',title:'Takings & tips graphs',sub:'Daily cash ups, weekly sales, this week vs last, categories and the Tips pot (view only)'},{id:'bookings',title:'Today\u2019s bookings',sub:'Covers, allergens to sign off, platters and other reservations, dogs, access and vegan/vegetarian'},{id:'recipes',title:'Recipe cards',sub:'Plating photo, ingredients, method, allergens, section and price; you sign each card off before it goes live'},{id:'specials',title:'Specials board',sub:'Photo of the chalkboard or typed specials with allergens; shown in the customer app'},{id:'board',title:'Question board',sub:'Ask the team anything anonymously, and vote'},{id:'teamtasks',title:'Kitchen team tasks',sub:'Daily tasks for your chefs, commis and KPs'},{id:'orderlists',title:'Order lists',sub:'Alsons drinks, Cash and carry: add items, tick on the day, finish and carry over'},{id:'foodsafety',title:'Food safety (CookSafe)',sub:'Based on CookSafe (Food Standards Scotland). Full logs coming in the next update'},{id:'haccp',title:'Food safety log (HACCP)',sub:'Temperatures, cleaning and allergen checks; voice entry; limits; EHO export'},{id:'accidents',title:'Accident book',sub:'Accidents and near misses; you see your own entries'},{id:'forecast',title:'Forecast',sub:'Covers per day for the week ahead, and prep from the forecast'},{id:'prep',title:'Prep list',sub:'From the forecast and bookings, tick off as you go'},{id:'live',title:'Live tickets, sold out, team & chat',sub:'Orders, readiness alerts, sold out, who\u2019s on, rota, team chat and private messages'},{id:'waste',title:'Waste log',sub:'Item, quantity, reason and cost; weekly total and % of sales'},{id:'allergens',title:'Allergens',sub:'14-allergen matrix from the recipe cards, costing cross-check and audit log'},{id:'compliance',title:'Kitchen compliance',sub:'Fridge, freezer, cooking and cooling temps; cleaning; daily checks'}],Se={stock:{tab:'stock',stock:'levels'},'stock-take':{tab:'stock',stock:'take'},deliveries:{tab:'stock',stock:'deliveries'},gp:{tab:'gp',gp:'dishes'},'price-changes':{tab:'gp',gp:'changes'},'gp-week':{tab:'gp',gp:'week'},'menu-engineering':{tab:'gp',gp:'engineering'},orders:{tab:'orders'},rota:{tab:'rota'},'kitchen-rota':{tab:'rota'},forecast:{tab:'kitchen',k:'forecast'},prep:{tab:'kitchen',k:'prep'},live:{tab:'kitchen',k:'live'},waste:{tab:'kitchen',k:'waste'},recipes:{tab:'kitchen',k:'recipes'},'recipe-cards':{tab:'kitchen',k:'recipes'},allergens:{tab:'kitchen',k:'allergens'},compliance:{tab:'kitchen',k:'compliance'},haccp:{tab:'kitchen',k:'haccp'},specials:{tab:'kitchen',k:'specials'},accidents:{tab:'kitchen',k:'accidents'},'new-dish':{tab:'creator'}};function Ie({go:e}){const{k:t,c:s,menu:i,now:o,rid:l,me:r}=(0,_.useChef)(3e4),d=(0,q.useSheetReminders)(),u=(0,_.useWeek)(),{covers:h,label:p,enough:f,booked:b}=(0,_.useForecast)(),k=(0,z.useSuggestions)(),y=t.ingredients.filter(e=>e.onHand<=0||(0,_.isLow)(e.onHand,e.par)),x=k.filter(e=>e.ordersToday&&!e.placedToday),j=(0,M.priceImpacts)(i,t.recipes,t.ingredients,t.targetGp).filter(e=>e.dropped.length),w=t.deliveries.filter(e=>'expected'===e.status),v=!t.recipes.length||!t.ingredients.length,C=v?[]:s.filter(e=>e.below),T=(0,n.useLiveState)(),P=(0,me.useRecipeCards)(l).filter(e=>!e.signOff),S=(0,J.useKitchenSummary)(l),[R,A]=(0,I.useState)(!1);return(0,ve.jsxs)($.default,{style:{gap:12},testID:"chef-dashboard",children:[(0,ve.jsx)(de.MissedBanner,{mode:"chef",now:o,onPress:()=>e('kitchen','haccp')}),d.map(t=>(0,ve.jsx)(H.default,{accessibilityRole:"button",onPress:()=>e('orders',t.supplierId),children:(0,ve.jsxs)(F.Banner,{kind:'red'===t.tone?'danger':'warn',title:`\u23f0 ${t.text}`,children:["Tap to open the ",t.name," order sheet. Nothing is sent until you press Send."]})},t.supplierId)),P.length?(0,ve.jsx)(H.default,{testID:"cards-awaiting",accessibilityRole:"button",onPress:()=>e('kitchen','recipes'),children:(0,ve.jsxs)(F.Banner,{kind:"warn",title:`${P.length} recipe card${1===P.length?'':'s'} awaiting your sign-off`,children:[P.slice(0,4).map(e=>e.dish).join(', '),". Guests see \"awaiting allergen sign-off\" and cannot order these until you sign them off."]})}):null,(0,ve.jsx)(Q.ShellfishTile,{rid:l,by:r,app:"chef",onOrder:()=>e('orders','os-kittyfisher')}),(0,ve.jsx)(F.Button,{testID:"chef-add-soldout",label:"Add sold out",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>A(!0),style:{minHeight:56}}),(0,ve.jsxs)(F.Row,{wrap:!0,gap:10,children:[c.PITCH?null:(0,ve.jsx)(_.Tile,{testID:"tile-gp",label:"Dishes under target GP",value:S.costed?`${S.below} of ${S.costed}`:'Nothing yet',sub:S.costed?`Average ${(0,_.pct1)(S.avgGp??0)} \xb7 target ${S.target}%`:'Record a delivery, then cost your recipe cards',tone:S.costed?S.below?'amber':'ok':void 0,onPress:()=>e('gp','dishes')}),c.PITCH?v?(0,ve.jsx)(_.Tile,{testID:"tile-gp",label:"GP this week vs target",value:"Nothing yet",sub:"Add ingredients and recipe costs to see GP",onPress:()=>e('gp','week')}):(0,ve.jsx)(_.Tile,{testID:"tile-gp",label:"GP this week vs target",value:(0,_.pct1)(u.theo),sub:`Target ${t.targetGp}% \xb7 actual ${(0,_.pct1)(u.actual)}`,tone:u.theoe('gp','week')}):null,c.PITCH?null:(0,ve.jsx)(_.Tile,{testID:"tile-stock",label:"Stock value",value:null!=S.stockValue?(0,L.gbp)(S.stockValue):'Nothing yet',sub:S.lastCount?`At cost, counted ${S.lastCount}`:'No stock counted yet',onPress:()=>e('stock','take')}),c.PITCH?(0,ve.jsx)(_.Tile,{testID:"tile-stock",label:"Stock value",value:t.ingredients.length?(0,L.gbp)((0,_.stockValue)(t.ingredients)):'Nothing yet',sub:t.ingredients.length?'At cost':'No stock counted yet',onPress:()=>e('stock','levels')}):null,(0,ve.jsx)(_.Tile,{label:"Items low or out",value:t.ingredients.length?`${y.length}`:'Nothing yet',sub:t.ingredients.length?y.slice(0,3).map(e=>e.name).join(', '):'No stock counted yet',tone:y.some(e=>e.onHand<=0)?'red':y.length?'amber':'ok',onPress:()=>e('stock','levels')}),(0,ve.jsx)(_.Tile,{label:"Waste this week",value:t.waste.length?(0,L.gbp)(u.wasteWeek):'Nothing yet',sub:u.sales?`${(0,_.pct1)(u.wasteWeek/u.sales*100)} of food sales`:'',onPress:()=>e('kitchen','waste')}),f?(0,ve.jsx)(_.Tile,{testID:"tile-forecast",label:"Covers forecast today",value:`${h}`,sub:p,onPress:()=>e('kitchen','forecast')}):(0,ve.jsx)(_.Tile,{testID:"tile-booked",label:"Booked so far today",value:'ready'===T?`${b}`:'connecting'===T?'Connecting\u2026':'Not connected',sub:"Not enough history for a forecast yet",onPress:()=>e('kitchen','bookings')}),(0,ve.jsx)(_.Tile,{label:"Orders due today",value:`${x.length}`,sub:x.map(e=>`${e.s.name} by ${e.s.cutoff}`).join(' \xb7 ')||'None',tone:x.some(e=>e.cutPassed)?'red':x.length?'amber':'ok',onPress:()=>e('orders')})]}),j.map(e=>(0,ve.jsxs)(F.Banner,{kind:"danger",title:`${e.ing.name} ${e.pct>0?'+':''}${e.pct.toFixed(0)}%: ${e.dropped.length} dish${1===e.dropped.length?'':'es'} drop below target`,children:[e.dropped.map(e=>e.item.name).join(', '),". Open GP \u203a Price changes."]},e.ing.id)),w.length?(0,ve.jsx)(H.default,{accessibilityRole:"button",onPress:()=>e('stock','deliveries'),children:(0,ve.jsx)(F.Banner,{kind:"info",title:`${w.length} deliver${1===w.length?'y':'ies'} to check in today`,children:"Count in against the order, flag shorts and price changes."})}):null,C.length?(0,ve.jsx)(H.default,{accessibilityRole:"button",onPress:()=>e('gp','dishes'),children:(0,ve.jsxs)(F.Banner,{kind:"warn",title:`${C.length} dishes below ${t.targetGp}% GP`,children:[C.slice(0,4).map(e=>e.item.name).join(', '),C.length>4?'\u2026':'']})}):null,(0,ve.jsx)(F.Row,{wrap:!0,gap:8,children:[['Recipe cards','recipes'],['Food safety log','haccp'],['Specials board','specials'],[re.CREATOR_TITLE,'creator'],['Forecast','forecast'],['Prep list','prep'],['Live tickets & sold out','live'],['Allergens','allergens'],['Accident book','accidents']].map(([t,s])=>(0,ve.jsx)(H.default,{accessibilityRole:"button",accessibilityLabel:t,onPress:()=>'creator'===s?e('creator'):e('kitchen',s),style:{flexGrow:1,flexBasis:140,padding:12,borderRadius:12,borderWidth:1.5,borderColor:N.colours.gold,backgroundColor:N.colours.surface},children:(0,ve.jsxs)(F.T,{weight:"semibold",children:[t," \u203a"]})},s))}),(0,ve.jsx)(F.Badge,{kind:"neutral",label:"Nothing is ordered or sent from here"}),(0,ve.jsx)(xe.SoldOutSheet,{visible:R,onClose:()=>A(!1),rid:l,by:r,hideLinks:!0,testID:"chef-soldout-sheet"})]})}},792,[793,978,884,979,986,1051,1052,1015,2,1053,1057,1058,1090,858,1095,1099,1100,1103,1104,1107,1108,1110,1111,1112,34,373,236,402,295,426,102,36,873,1137,794,867,821,1084,1139,1145,1148,1149,1152,1167,1165,1168,1169,1171,1172,1179,1182,1185,1193,1194,1198,1199,925,1003,1200,1158,1201,1208,1213,1222,1215,1156,1224,1228,1195,874,1229,1154,987,1230,25]); __d(function(_g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.styliseOnDevice=b,_e.pickPhoto=p,_e.AvatarMaker=function({meId:e,me:u}){const g=(0,i.useAvatars)(t=>t.photos[e]),[f,v]=(0,t.useState)(null),[y,x]=(0,t.useState)(null),[j,w]=(0,t.useState)(!1),[I,P]=(0,t.useState)(!1),[k,M]=(0,t.useState)('');(0,t.useEffect)(()=>()=>{f&&URL.revokeObjectURL(f)},[f]);const R='undefined'!=typeof document,S=async e=>{M('');const t=await p(e);if(t){P(!0),w(!1);try{const e=await b(t);f&&URL.revokeObjectURL(f),v(URL.createObjectURL(t)),x(e)}catch{M("That photo couldn't be opened. Try a different one (JPEG or PNG).")}finally{P(!1)}}},U=()=>{f&&URL.revokeObjectURL(f),v(null),x(null),w(!1)},B=u.replace(' (example)','');return(0,h.jsxs)(o.default,{style:{gap:12},testID:"avatar-maker",children:[(0,h.jsxs)(d.Box,{children:[(0,h.jsxs)(s.Row,{gap:14,children:[(0,h.jsx)(l.StaffAvatar,{id:e,size:88}),(0,h.jsxs)(o.default,{style:{flex:1,gap:4},children:[(0,h.jsx)(s.T,{weight:"semibold",size:17,children:B}),(0,h.jsxs)(s.Muted,{children:[g?`Your chosen avatar (saved ${new Date(g.at).toLocaleDateString('en-GB')}).`:'Your original crew avatar.'," It shows on rotas, chat, clock-in and sign-offs."]})]})]}),g?(0,h.jsx)(s.Button,{small:!0,kind:"secondary",label:"Back to my default avatar",testID:"avatar-own-reset",onPress:()=>{i.useAvatars.getState().reset(e,{id:e,role:'staff',name:B}),M('Back to your default avatar.')}}):null]}),(0,h.jsx)(d.Box,{children:(0,h.jsx)(n.AvatarOptions,{value:g?.dataUrl,onSelect:t=>{const a=i.useAvatars.getState().setOwn(e,e,t.dataUrl,B);M(a?`${t.name} is your avatar now.`:'Could not save your avatar.')}})}),(0,h.jsxs)(d.Box,{testID:"avatar-create",children:[(0,h.jsx)(s.T,{weight:"semibold",size:17,children:"Create my avatar from a photo"}),(0,h.jsx)(s.Muted,{children:"Upload a photo or take a selfie. Your phone turns it into a retro space-age avatar. The photo never leaves this device and isn't saved: only the finished avatar is kept."}),R?y?(0,h.jsxs)(o.default,{style:{gap:10},testID:"avatar-preview",children:[(0,h.jsxs)(s.Row,{gap:12,style:{justifyContent:'center'},children:[(0,h.jsxs)(o.default,{style:{alignItems:'center',gap:4},children:[f?(0,h.jsx)(a.default,{source:{uri:f},style:{width:96,height:96,borderRadius:12},accessibilityLabel:"Your photo"}):null,(0,h.jsx)(s.Muted,{children:"Your photo"})]}),(0,h.jsx)(s.T,{size:22,colour:c.colours.gold,children:"\u2192"}),(0,h.jsxs)(o.default,{style:{alignItems:'center',gap:4},children:[(0,h.jsx)(a.default,{source:{uri:y},style:{width:120,height:120,borderRadius:60,borderWidth:3,borderColor:c.colours.gold},accessibilityLabel:"Your new avatar preview",testID:"avatar-result"}),(0,h.jsx)(s.Muted,{children:"Your avatar"})]})]}),(0,h.jsxs)(r.default,{accessibilityRole:"checkbox",accessibilityState:{checked:j},accessibilityLabel:"I agree to use this avatar",testID:"avatar-consent",onPress:()=>w(!j),style:{flexDirection:'row',gap:10,alignItems:'flex-start',padding:10,borderRadius:12,borderWidth:1,borderColor:j?c.colours.gold:c.colours.border},children:[(0,h.jsx)(o.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:c.colours.gold,backgroundColor:j?c.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:j?(0,h.jsx)(s.T,{size:15,weight:"bold",colour:"#111",children:"\u2713"}):null}),(0,h.jsx)(s.T,{size:14,style:{flex:1},children:"I\u2019m happy for this avatar, made from my photo, to be shown to my team in CoverCharge. Only the finished avatar is shared; my photo isn\u2019t uploaded or kept, and a manager can reset my avatar."})]}),(0,h.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,h.jsx)(s.Button,{label:"Use as my avatar",testID:"avatar-save",disabled:!j,onPress:()=>{const t=i.useAvatars.getState().setOwn(e,e,y,B);M(t?'Saved: this is your avatar now.':"Couldn't save the avatar."),t&&U()}}),(0,h.jsx)(s.Button,{kind:"secondary",label:"Try another photo",onPress:U})]})]}):(0,h.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,h.jsx)(s.Button,{label:I?'Making your avatar\u2026':'Upload a photo',testID:"avatar-upload",disabled:I,onPress:()=>S(!1)}),(0,h.jsx)(s.Button,{kind:"secondary",label:"Take a selfie",testID:"avatar-selfie",disabled:I,onPress:()=>S(!0)})]}):(0,h.jsx)(s.Muted,{children:"Available in the web app."}),k?(0,h.jsx)(o.default,{testID:"avatar-msg",children:(0,h.jsx)(s.T,{size:14,colour:c.colours.ok,children:k})}):null]})]})};var t=_r(_d[0]),a=e(_r(_d[1]));_r(_d[2]);var r=e(_r(_d[3])),o=e(_r(_d[4])),s=_r(_d[5]),l=_r(_d[6]),n=_r(_d[7]),i=_r(_d[8]),c=_r(_d[9]),d=_r(_d[10]),h=_r(_d[11]);const u=['#1B1B1B','#4A3F35','#B89A72','#E9B949','#FFF4E0'].map(e=>[1,3,5].map(t=>parseInt(e.slice(t,t+2),16))),g=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5];function f(e){return new Promise((t,a)=>{const r=URL.createObjectURL(e),o=new window.Image;o.onload=()=>t({img:o,url:r}),o.onerror=()=>{URL.revokeObjectURL(r),a(new Error('bad image'))},o.src=r})}function v(e,t,a,r){e.beginPath(),e.moveTo(t,a-r),e.quadraticCurveTo(t+.18*r,a-.18*r,t+r,a),e.quadraticCurveTo(t+.18*r,a+.18*r,t,a+r),e.quadraticCurveTo(t-.18*r,a+.18*r,t-r,a),e.quadraticCurveTo(t-.18*r,a-.18*r,t,a-r),e.fill()}async function b(e){const{img:t,url:a}=await f(e);try{const e=112,a=256,r=document.createElement('canvas');r.width=e,r.height=e;const o=r.getContext('2d'),s=Math.min(t.width,t.height);o.drawImage(t,(t.width-s)/2,Math.max(0,(t.height-s)/2-.04*s),s,s,0,0,e,e);const l=o.getImageData(0,0,e,e),n=l.data,i=[];for(let e=0;ee-t),d=c[Math.floor(.04*c.length)],h=c[Math.floor(.96*c.length)]||255;for(let t=0;t{const a=document.createElement('input');a.type='file',a.accept='image/*',e&&a.setAttribute('capture','user'),a.onchange=()=>t(a.files?.[0]??null),a.click()})}},793,[34,336,236,402,102,794,925,929,926,821,930,25]); __d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"webLine",{enumerable:!0,get:function(){return W.webLine}}),_e.T=D,Object.defineProperty(_e,"H1",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"H2",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"Muted",{enumerable:!0,get:function(){return z}}),_e.BrandBar=A,_e.Screen=function({children:e,title:t,subtitle:r,back:o=!0,right:l,maxWidth:n=640,footer:s,scroll:c=!0}){const u=(0,B.jsxs)(x.default,{style:{width:'100%',maxWidth:n,alignSelf:'center',padding:16,gap:12,alignItems:'stretch'},children:[e,'customer'===S.APP_VARIANT?(0,B.jsx)(H,{}):null]});return(0,B.jsxs)(j.SafeAreaView,{style:{flex:1,backgroundColor:C.colours.bg},edges:['top','left','right'],children:[(0,B.jsx)(x.default,{style:{width:'100%',maxWidth:n,alignSelf:'center'},children:(0,B.jsx)(A,{title:t,subtitle:r,back:o,right:l})}),c?(0,B.jsx)(b.default,{contentContainerStyle:{paddingBottom:40},children:u}):(0,B.jsx)(x.default,{style:{flex:1},children:u}),s?(0,B.jsx)(x.default,{style:N.footer,children:(0,B.jsx)(x.default,{style:{width:'100%',maxWidth:n,alignSelf:'center'},children:s})}):null]})},_e.Button=v,_e.Card=F,_e.Badge=function({label:e,kind:t="neutral"}){const r={neutral:[C.colours.surface2,C.colours.muted,C.colours.border],gold:[C.colours.goldTint,C.colours.goldLight,C.colours.gold],red:[C.colours.redBg,'#FFD9D4',C.colours.red],amber:[C.colours.amberBg,'#FFE2A8',C.colours.amber],ok:[C.colours.okBg,C.colours.goldLight,C.colours.ok],blue:[C.colours.blueBg,C.colours.goldLight,C.colours.blue]}[t];return(0,B.jsx)(x.default,{style:[N.badge,{backgroundColor:r[0],borderColor:r[2],maxWidth:'100%',alignSelf:L?'center':'flex-start'}],children:(0,B.jsx)(D,{size:13,weight:"medium",colour:r[1],style:{flexShrink:1},children:e})})},_e.Banner=E,Object.defineProperty(_e,"ExampleAllergenNotice",{enumerable:!0,get:function(){return V}}),Object.defineProperty(_e,"DemoPaymentNotice",{enumerable:!0,get:function(){return $}}),_e.Row=O,Object.defineProperty(_e,"Divider",{enumerable:!0,get:function(){return _}}),_e.Field=function({label:e,...t}){return(0,B.jsxs)(x.default,{style:{gap:4,alignSelf:'stretch',width:'100%',minWidth:0,maxWidth:'100%'},children:[(0,B.jsx)(D,{size:C.font.small,weight:"medium",colour:C.colours.muted,center:!0,children:e}),(0,B.jsx)(o.TextInput,{accessibilityLabel:e,placeholderTextColor:"#7D776C",...t,style:[N.input,t.multiline&&{minHeight:70,textAlignVertical:'top'},t.style]})]})},_e.Chip=function({label:e,selected:t,onPress:r,disabled:o,sub:l,testID:n,accessibilityLabel:s}){return(0,B.jsxs)(h.default,{testID:n,accessibilityRole:"button",accessibilityState:{selected:!!t,disabled:!!o},accessibilityLabel:`${s??e}${!s&&l?`, ${l}`:''}${t?', selected':''}`,'aria-pressed':!!t,disabled:o,onPress:r,style:[N.chip,t&&{backgroundColor:C.colours.gold,borderColor:C.colours.gold},o&&{opacity:.35}],children:[(0,B.jsx)(D,{size:C.font.small,weight:"medium",colour:t?C.colours.onGold:C.colours.text,center:!0,children:e.trim()}),l?(0,B.jsx)(D,{size:12,colour:t?C.colours.onGold:C.colours.muted,center:!0,children:l}):null]})},_e.Toggle=function({value:e,onChange:t,label:r,testID:o,disabled:l,a11y:n}){return(0,B.jsxs)(O,{style:{justifyContent:'space-between',flexShrink:1,minWidth:0},children:[(0,B.jsx)(D,{style:{flex:1,flexShrink:1},children:r}),(0,B.jsx)(y.default,{testID:o,disabled:l,accessibilityLabel:n??r,value:e,onValueChange:t,trackColor:{true:C.colours.gold,false:'#444'},thumbColor:e?'#FFF6E0':'#BBB',activeThumbColor:'#FFF6E0',activeTrackColor:C.colours.gold})]})},_e.Stepper=function({value:e,onChange:t,min:r=1,max:o=20,label:l,step:n=1,format:s,testID:c}){const u=s?s(e):String(e),b=e=>Math.round(e/n)*n;return(0,B.jsxs)(O,{gap:10,children:[(0,B.jsx)(h.default,{testID:c?`${c}-down`:void 0,accessibilityRole:"button",accessibilityLabel:`Decrease ${l??''}`,disabled:e<=r,onPress:()=>t(Math.max(r,b(e-n))),style:[N.stepBtn,e<=r?{opacity:.4}:null],children:(0,B.jsx)(D,{size:20,colour:C.colours.gold,children:"\u2212"})}),(0,B.jsx)(x.default,{testID:c?`${c}-value`:void 0,accessibilityLabel:l?`${l}: ${u}`:u,children:(0,B.jsx)(D,{weight:"semibold",size:C.font.large,style:{minWidth:s?64:28,textAlign:'center'},children:u})}),(0,B.jsx)(h.default,{testID:c?`${c}-up`:void 0,accessibilityRole:"button",accessibilityLabel:`Increase ${l??''}`,disabled:e>=o,onPress:()=>t(Math.min(o,b(e+n))),style:[N.stepBtn,e>=o?{opacity:.4}:null],children:(0,B.jsx)(D,{size:20,colour:C.colours.gold,children:"+"})})]})},_e.Sheet=function({visible:e,onClose:o,title:l,children:n,maxWidth:c,testID:f,footer:y}){const{height:w}=(0,p.default)(),W=s.default.useContext(j.SafeAreaInsetsContext)??{top:0,bottom:0,left:0,right:0},k=(0,r.useTyping)(),S=(0,r.useVisibleArea)(),I=k&&S&&S.height({minHeight:44,minWidth:72,paddingHorizontal:14,borderRadius:22,borderWidth:1.5,borderColor:C.colours.gold,backgroundColor:e?'rgba(201,162,77,0.22)':'rgba(201,162,77,0.10)',alignItems:'center',justifyContent:'center'}),children:(0,B.jsx)(D,{size:15,weight:"semibold",colour:C.colours.goldLight,center:!0,children:"Done"})}):null,R?(0,B.jsx)(h.default,{accessibilityRole:"button",accessibilityLabel:"Close",onPress:o,hitSlop:8,testID:"sheet-close",style:{minWidth:72,minHeight:48,alignItems:'center',justifyContent:'center',marginRight:-8},children:(0,B.jsx)(D,{size:18,colour:C.colours.text,children:"Close"})}):(0,B.jsx)(t.GoldClose,{onPress:o,testID:"sheet-close",style:{marginRight:-6,minWidth:48,minHeight:48}})]}),(0,B.jsx)(b.default,{style:{flexShrink:1},contentContainerStyle:{gap:12,paddingTop:2,paddingBottom:4},children:n}),y?(0,B.jsx)(x.default,{style:{borderTopWidth:1,borderTopColor:C.colours.border,paddingTop:10,marginTop:8},testID:f?`${f}-footer`:void 0,children:y}):null]})})})},_e.SectionTitle=function({children:e}){return(0,B.jsx)(D,{weight:"semibold",size:12,colour:C.colours.goldMuted,center:!0,style:{textTransform:'uppercase',letterSpacing:1.6,marginTop:8},children:e})},Object.defineProperty(_e,"styles",{enumerable:!0,get:function(){return N}}),_r(d[0]);var t=_r(d[1]),r=_r(d[2]),o=_r(d[3]),l=_r(d[4]),n=_r(d[5]),s=e(_r(d[6])),c=e(_r(d[7])),u=e(_r(d[8]));_r(d[9]);var h=e(_r(d[10])),b=e(_r(d[11])),f=e(_r(d[12])),y=e(_r(d[13])),x=e(_r(d[14])),p=e(_r(d[15])),j=_r(d[16]),C=_r(d[17]),w=_r(d[18]),W=_r(d[19]),k=_r(d[20]),S=_r(d[21]),I=_r(d[22]),B=_r(d[23]);const R=['kirkton','abbotsford'].includes(k.VENUE_RID),L='display'!==S.APP_VARIANT;function D({children:e,style:t,size:r=C.font.body,weight:l="regular",colour:n=C.colours.text,numberOfLines:s,center:c,testID:u,accessibilityRole:h,accessibilityLabel:b}){const y='string'==typeof e&&/^(https?:\/\/|www\.)\S+$/.test(e.trim()),x=y?{minWidth:0,maxWidth:'100%',overflowWrap:'anywhere',wordBreak:'break-all',alignSelf:'stretch'}:void 0,p=f.default.flatten(t)||{},j=1===p.flex||1===p.flexGrow||'number'==typeof p.width||'left'===p.textAlign,k=c??(L&&('semibold'===l||'bold'===l)&&!j);return(0,B.jsx)(o.Text,{testID:u??(y?'cc-url':void 0),...k?{dataSet:{centre:'heading'}}:{},accessibilityRole:h,accessibilityLabel:b,numberOfLines:s,style:[{minWidth:0,fontFamily:C.fonts[l],fontSize:r,color:n,lineHeight:(0,w.lineFor)(r)},k&&{textAlign:'center',alignSelf:'center',maxWidth:'100%'},t,x,(0,W.webLine)(t,r),k&&'left'!==p.textAlign?{textAlign:'center'}:null],children:e})}const P=e=>(0,B.jsx)(D,{size:C.font.title,weight:"semibold",center:!0,...e}),T=e=>(0,B.jsx)(D,{size:C.font.large,weight:"semibold",center:!0,...e}),z=e=>(0,B.jsx)(D,{colour:C.colours.muted,size:C.font.small,...e,center:e.center??L});function A({title:e,back:t=!0,right:r,subtitle:o}){return(0,B.jsxs)(x.default,{style:N.brandBar,children:[(0,B.jsxs)(x.default,{style:N.row,children:[(0,B.jsx)(x.default,{style:N.brandSide,children:t?(0,B.jsx)(h.default,{accessibilityRole:"button",accessibilityLabel:"Back",onPress:()=>l.router.canGoBack()?l.router.back():l.router.replace(S.ENTRY[S.APP_VARIANT]),style:N.backBtn,hitSlop:10,children:(0,B.jsx)(D,{size:18,weight:"semibold",colour:C.colours.gold,children:"\u2039 Back"})}):null}),(0,B.jsx)(h.default,{onPress:()=>l.router.push(S.ENTRY[S.APP_VARIANT]),accessibilityLabel:"Home",style:N.brandCenter,children:(0,B.jsx)(I.RestaurantBrand,{size:I.HEADER_LOGO})}),(0,B.jsx)(x.default,{style:[N.brandSide,{alignItems:'flex-end'}],children:r?(0,B.jsx)(x.default,{style:{flexShrink:0},children:r}):null})]}),e?(0,B.jsx)(P,{style:{marginTop:10,alignSelf:'stretch'},children:e}):null,o?(0,B.jsx)(z,{center:!0,style:{alignSelf:'stretch'},children:o}):null]})}function H(){const e=(0,l.useLocalSearchParams)().rid??k.VENUE_RID,t=(0,n.useStore)(t=>t.restaurants.find(t=>t.id===e)?.contactEmail);return t?(0,B.jsx)(h.default,{accessibilityRole:"link",accessibilityLabel:`Email ${t}`,onPress:()=>{c.default.openURL(`mailto:${t}`)},style:{minHeight:44,justifyContent:'center',alignItems:'center',maxWidth:'100%'},children:(0,B.jsx)(D,{center:!0,size:14,colour:C.colours.gold,children:t})}):null}function v({label:e,sub:t,onPress:r,kind:o="primary",disabled:l,small:n,style:s,accessibilityLabel:c,accessibilityHint:u,testID:b}){const f={primary:C.colours.gold,secondary:C.colours.tile,danger:C.colours.redSolid,ghost:'transparent',success:C.colours.accentBg}[o],y={primary:C.colours.onGold,secondary:C.colours.text,danger:'#FFFFFF',ghost:C.colours.gold,success:C.colours.goldLight}[o],x={primary:'transparent',secondary:C.colours.hairline,danger:'transparent',ghost:'transparent',success:C.colours.accentBorder}[o];return(0,B.jsxs)(h.default,{testID:b,accessibilityRole:"button",accessibilityLabel:c??e,accessibilityHint:u,accessibilityState:{disabled:!!l},disabled:l,onPress:r,style:({pressed:e})=>[N.btn,{backgroundColor:e&&'secondary'===o?C.colours.tilePressed:f,borderColor:x,opacity:l?.4:e?.85:1},n&&{paddingVertical:8,paddingHorizontal:14,minHeight:w.control.min,minWidth:44},s],children:[(0,B.jsx)(D,{weight:"semibold",size:n?C.font.small:C.font.body,colour:y,center:!0,children:e.trim()}),t?(0,B.jsx)(D,{size:n?C.font.small-2:C.font.small,colour:y,center:!0,testID:b?`${b}-sub`:void 0,children:t}):null]})}function F({children:e,style:t,onPress:r,highlight:o}){const l=o===C.colours.gold||o===C.colours.accentBorder,n=(0,B.jsx)(x.default,{testID:"cc-card",style:[N.card,{alignItems:'stretch'},o?{borderColor:l?C.colours.accentBorder:o,borderWidth:l?1:2}:null,t],children:e});return r?(0,B.jsx)(h.default,{accessibilityRole:"button",onPress:r,style:({pressed:e})=>({opacity:e?.85:1}),children:n}):n}function E({kind:e="info",title:t,children:r}){const o={info:[C.colours.surface,C.colours.gold,C.colours.text],warn:[C.colours.amberBg,C.colours.amber,'#FFE2A8'],danger:[C.colours.redBg,C.colours.red,'#FFE3DF'],success:[C.colours.okBg,C.colours.ok,C.colours.goldLight],example:[C.colours.amberBg,C.colours.amber,'#FFE2A8'],demo:[C.colours.goldTint,C.colours.gold,C.colours.goldLight]}[e];return(0,B.jsxs)(x.default,{accessibilityRole:"summary",style:[N.banner,{backgroundColor:o[0],borderLeftColor:o[1]}],children:[t?(0,B.jsx)(D,{weight:"semibold",colour:o[2],center:!0,children:t}):null,s.default.Children.toArray(r).every(e=>'string'==typeof e||'number'==typeof e)?(0,B.jsx)(D,{size:C.font.small,colour:o[2],center:!0,children:r}):r]})}z.statusLine=!0,v.centreRow=!0;const V=()=>(0,B.jsx)(E,{kind:"example",title:"Allergens awaiting kitchen verification",children:"This allergen information has not been verified by the kitchen. Head chef sign-off is required. Always speak to staff about allergies."}),$=()=>(0,B.jsx)(E,{kind:"demo",title:"Card payments: not set up yet",children:"No card is charged and no payment provider is contacted."});function O({children:e,style:t,gap:r=8,wrap:o}){const l=s.default.Children.map(e,e=>{if(!s.default.isValidElement(e))return e;const t=e,r=f.default.flatten(t.props.style)||{};return 1!==r.flex&&1!==r.flexGrow?e:s.default.cloneElement(t,{style:[t.props.style,{minWidth:Math.max(t.type===F?240:180,'number'==typeof r.minWidth?r.minWidth:0)}]})}),n=f.default.flatten(t)||{},c=s.default.Children.toArray(l).filter(s.default.isValidElement),u=e=>e.type;if(L&&'space-between'===n.justifyContent&&1!==n.flex&&2===c.length&&c.some(e=>u(e).statusLine))return(0,B.jsx)(x.default,{dataSet:{centre:'status'},style:{alignItems:'center',alignSelf:'stretch',width:'100%',gap:r},children:c});const h=L&&c.length>=2&&c.every(e=>u(e).centreRow)&&'flex-start'!==n.justifyContent&&'space-between'!==n.justifyContent;return(0,B.jsx)(x.default,{...h?{dataSet:{centre:'buttons'}}:{},style:[N.row,{gap:r},h&&{justifyContent:'center',flexWrap:'wrap'},o&&{flexWrap:'wrap',justifyContent:'center'},t],children:l})}const _=()=>(0,B.jsx)(x.default,{style:{height:1,backgroundColor:C.colours.border,marginVertical:4}});const N=f.default.create({row:{flexDirection:'row',alignItems:'center',flexWrap:'wrap',minWidth:0,maxWidth:'100%'},brandBar:{paddingHorizontal:16,paddingTop:8,paddingBottom:8,borderBottomWidth:1,borderBottomColor:C.colours.border},brandSide:{width:96,minHeight:48,justifyContent:'center'},brandCenter:{flex:1,alignItems:'center',justifyContent:'center',minHeight:48},backBtn:{paddingRight:12,minHeight:48,minWidth:88,justifyContent:'center'},btn:{minWidth:0,maxWidth:'100%',flexShrink:1,borderRadius:w.radii.button,paddingVertical:12,paddingHorizontal:18,borderWidth:1,alignItems:'center',justifyContent:'center',minHeight:w.control.min,alignSelf:'stretch'},card:{minWidth:0,maxWidth:'100%',backgroundColor:C.colours.surface,borderRadius:C.radius.l,padding:16,borderWidth:1,borderColor:C.colours.hairline,gap:8},badge:{borderRadius:999,paddingHorizontal:9,paddingVertical:2,borderWidth:1,alignSelf:'flex-start'},banner:{borderRadius:C.radius.m,padding:12,borderLeftWidth:5,gap:2},input:{minWidth:0,boxSizing:'border-box',backgroundColor:C.colours.surface2,borderColor:C.colours.border,borderWidth:1,borderRadius:C.radius.m,paddingHorizontal:12,paddingVertical:10,color:C.colours.text,fontSize:C.font.body,fontFamily:C.fonts.regular},chip:{maxWidth:'100%',flexShrink:0,borderWidth:1,borderColor:C.colours.border,borderRadius:C.radius.m,paddingHorizontal:12,paddingVertical:8,backgroundColor:C.colours.surface2,minWidth:64,minHeight:44,justifyContent:'center'},stepBtn:{width:44,height:44,borderRadius:22,borderWidth:1.5,borderColor:C.colours.gold,alignItems:'center',justifyContent:'center'},overlay:{flex:1,backgroundColor:'rgba(0,0,0,0.7)',justifyContent:'center',alignItems:'center',padding:16},sheet:{backgroundColor:C.colours.surface,borderRadius:w.radii.xl,padding:18,width:'100%',maxWidth:520,maxHeight:'90%',borderWidth:1,borderColor:C.colours.gold},footer:{borderTopWidth:1,borderTopColor:C.colours.border,backgroundColor:C.colours.surface,padding:12}})},794,[795,796,830,827,30,831,34,379,395,236,402,295,41,410,102,426,36,821,826,871,5,872,873,25]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"RESPONSIVE_CSS",{enumerable:!0,get:function(){return t}});const t="\n*,*::before,*::after { box-sizing:border-box !important; }\nhtml,body { max-width:100%; overflow-x:hidden; }\ninput,select,textarea { box-sizing:border-box !important; min-width:0; max-width:100%; }\n[dir=\"auto\"] { overflow-wrap:break-word; }\n[data-testid^=\"area-summary-\"] [dir=\"auto\"] { overflow-wrap:normal; word-break:keep-all; text-align:center; }\n[data-testid=\"venue-header-name\"],\n[data-testid^=\"avatar-option-\"] [dir=\"auto\"] { overflow-wrap:normal !important; word-break:keep-all !important; }\n[data-testid=\"cc-card\"] { min-width:0; max-width:100%; overflow-x:hidden; }\n[data-testid=\"cc-card\"] > [dir=\"auto\"] { text-align:center; }\n[data-testid=\"cc-card\"] > * { min-width:0; max-width:100%; }\n";if('undefined'!=typeof document&&!document.getElementById('cc-responsive-sizing')){const n=document.createElement('style');n.id='cc-responsive-sizing',n.textContent=t,document.head.appendChild(n)}},795,[]); @@ -1095,7 +1095,7 @@ __d(function(g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule' __d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.setClockServer=function(t){s=t,c()},e.markClockUnsent=function(t){o.set(t,Date.now()),c()},e.markClockSent=function(t){o.delete(t)&&c()},e.clockNotSent=l,e.useClockNotSent=function(o){const[,c]=(0,t.useState)(0);return(0,t.useEffect)(()=>{const t=()=>c(t=>t+1);u.add(t);const o=n.mutationQueue.subscribe(t);return()=>{u.delete(t),o()}},[]),l(o)};var t=r(d[0]),n=r(d[1]);const o=new Map,u=new Set,c=()=>{for(const t of u)t()};let s=()=>!1;function l(t){if(!t)return!1;return n.mutationQueue.pending.some(n=>'attendance'===n.table&&n.rowKey===t)||o.has(t)&&s()}n.mutationQueue.onDone(t=>{'attendance'===t.table&&o.delete(t.rowKey)&&c()})},1012,[34,1013]); __d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"MutationQueue",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"mutationQueue",{enumerable:!0,get:function(){return o}});var t=_r(d[0]),e=_r(d[1]),s=_r(d[2]);const n='queue:v1',r='queue:failed:v1',h=t=>`${t.table}|${t.venueId}|${t.rowKey}`;class l{items=[];failedItems=[];loaded=null;flushing=null;flushingSince=0;exec=null;listeners=new Set;onFailure=new Set;onSaved=new Set;retryTimer=null;waitTimer=null;backoffMs=2e3;now=()=>Date.now();constructor(){(0,t.onConnectivity)(t=>{t&&this.flush()})}setExecutor(t){this.exec=t}load(){return this.loaded||(this.loaded=(async()=>{const t=await e.kv.get(n,[]);this.items=[...t.map(t=>({...t,nextAt:void 0})),...this.items],this.failedItems=await e.kv.get(r,[]),this.emit()})()),this.loaded}get pending(){return this.items}get waiting(){return this.items.filter(t=>t.attempts>0)}get failed(){return this.failedItems}hasPending(t,e,s){return this.items.some(n=>n.table===t&&n.venueId===e&&n.rowKey===s)}async enqueue(t){await this.load();const s={...t,id:(0,e.uuid)(),createdAt:(new Date).toISOString(),attempts:0};return this.items.push(s),await this.persist(),this.flush(),s}nextReady(){const t=new Set,e=this.now();for(const s of this.items){const n=h(s);if(!t.has(n)){if(!(s.nextAt&&s.nextAt>e))return s;t.add(n)}}}remove(t){this.items=this.items.filter(e=>e!==t)}flush(){if(this.flushing&&Date.now()-this.flushingSince<6e4)return this.flushing;this.flushingSince=Date.now();let e=null;return e=(async()=>{for(await this.load();this.exec;){if(this.flushing&&this.flushing!==e)return;const n=this.nextReady();if(!n)break;if(!(0,t.isOnline)()){this.scheduleRetry();break}try{const t=await this.exec(n);this.remove(n),this.backoffMs=2e3,'conflict'===t?this.fail(n,'conflict','Row changed on the server (version conflict) or is not visible to you'):this.onSaved.forEach(t=>t(n))}catch(e){n.attempts+=1,n.lastError=String(e?.message??e);const r=e??{};n.lastErr={code:r.code?String(r.code):void 0,status:Number(r.status)||void 0,message:n.lastError.slice(0,300)};const h=(0,s.classifyWriteError)(e);if('network'===h){n.attempts-=1,(0,t.setOnline)(!1),this.scheduleRetry(),await this.persist();break}'retry'===h?n.nextAt=this.now()+(0,s.retryDelayMs)(n.attempts):(this.remove(n),this.fail(n,'rejected',n.lastError))}await this.persist()}this.flushing===e&&(this.flushing=null),this.scheduleWaiting()})(),this.flushing=e,e}retryNow(){for(const t of this.items)t.nextAt=void 0;return this.flush()}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}onFailed(t){return this.onFailure.add(t),()=>{this.onFailure.delete(t)}}onDone(t){return this.onSaved.add(t),()=>{this.onSaved.delete(t)}}async clearFailed(){this.failedItems=[],await e.kv.set(r,[]),this.emit()}fail(t,s,n){const h={...t,lastError:n,failedAt:(new Date).toISOString(),reason:s};this.failedItems=[h,...this.failedItems].slice(0,100),e.kv.set(r,this.failedItems),this.onFailure.forEach(t=>t(h))}scheduleWaiting(){this.waitTimer&&(clearTimeout(this.waitTimer),this.waitTimer=null);const t=this.items.map(t=>t.nextAt??0).filter(t=>t>0);if(!t.length)return;const e=Math.max(500,Math.min(...t)-this.now());this.waitTimer=setTimeout(()=>{this.waitTimer=null,this.flush()},e)}scheduleRetry(){if(this.retryTimer)return;const e=this.backoffMs;this.backoffMs=Math.min(2*this.backoffMs,6e4),this.retryTimer=setTimeout(()=>{this.retryTimer=null,(0,t.setOnline)(!0),this.flush()},e)}async persist(){await e.kv.set(n,this.items),this.emit()}emit(){this.listeners.forEach(t=>t())}}const o=new l},1013,[1010,977,1014]); __d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.classifyWriteError=function(o){if((0,e.isNetworkError)(o))return'network';const{code:n,status:c,msg:l}=t(o);return s(o)?'refused':/^(08|53|57|58)/.test(n)||['40001','40P01','55P03','23505','23503'].includes(n)||/^PGRST30[0-3]$/.test(n)||/jwt|token.*expired/i.test(l)||401===c||408===c||425===c||429===c||c>=500?'retry':409!==c||n?'refused':'retry'},Object.defineProperty(_e,"retryDelayMs",{enumerable:!0,get:function(){return o}}),_e.describeWrite=function(e){const t='rpc'===e.kind?(e.fn??'change').replace(/_/g,' '):n[e.table]??e.table.replace(/_/g,' ').replace(/s$/,''),s=e.values??{},o=s.guest_name??s.name??s.display_name??s.title??s.reason,c='string'==typeof o&&o.trim()?` for ${o.trim().slice(0,60)}`:'';return'delete'===e.kind?`deleting a ${t}${c}`:`the ${t}${c}`},_e.plainReason=function(e,o){const{code:n,status:c,msg:l}=t(e);if('refused'===o)return s(e)?'more than 20 deletes in 10 minutes from one sign-in are stopped to keep your data safe':'42501'===n||403===c||/row-level security|permission/i.test(l)?'your sign-in isn\u2019t allowed to change this':'conflict'===n?'it was changed or removed on another device first':/^(22|23)/.test(n)?'the shared system says some of the details aren\u2019t valid':'P0001'===n&&l?l.slice(0,140):l?`the shared system said: ${l.slice(0,120)}`:'the shared system refused it';return'23505'===n?'the shared system already has another copy of it':'23503'===n?'a related change has to save first':/^PGRST30/.test(n)||401===c||/jwt/i.test(l)?'your sign-in is being refreshed':'the shared system is busy'};var e=r(d[0]);const t=e=>{const t=e&&'object'==typeof e?e:{};return{msg:String(t.message??e??''),code:String(t.code??''),status:Number(t.status??0)||0,hint:String(t.hint??'')}},s=e=>{const s=t(e);return/delete guard/i.test(s.hint)||/too many .* deleted in 10 minutes/i.test(s.msg)};const o=e=>Math.min(5e3*Math.pow(3,Math.max(0,e-1)),3e5),n={bookings:'booking',walk_ins:'walk-in',blocks:'blocked time',sold_out_items:'sold-out mark',sold_out_links:'dish stock link',staff:'staff details',rota_shifts:'rota shift',stock_items:'stock item',stock_events:'stock count',stock_counts:'stock count',chat_messages:'chat message',recipe_cards:'recipe card',order_lists:'order list',order_list_items:'order list item',daily_task_ticks:'task tick',daily_tasks:'daily task',attendance:'clock in or out',cash_ups:'cash-up',table_plans:'table plan',guest_profiles:'guest profile',floor_live:'table status',venues:'venue settings',time_requests:'clock correction request',staff_leave:'time off',scheduled_notifications:'reminder',suppliers:'supplier',supplier_orders:'supplier order',takeaway_orders:'takeaway order'}},1014,[1010]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"APP_VERSION",{enumerable:!0,get:function(){return t}});const t='v0.3.12.160'},1015,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"APP_VERSION",{enumerable:!0,get:function(){return t}});const t='v0.3.12.161'},1015,[]); __d(function(g,_r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"TableRepository",{enumerable:!0,get:function(){return c}}),e.executeMutation=async function(t){const s=(t,s)=>{throw Object.assign(t,{status:s})};if('rpc'===t.kind){const{error:n,status:r}=await u().rpc(t.fn,t.values??{});return n&&s(n,r),'ok'}const n=u().from(t.table);if('upsert'===t.kind||'insert'===t.kind){const{error:r,status:o}=await n.upsert(t.values??{},{onConflict:t.conflictKey??'id',ignoreDuplicates:'insert'===t.kind});return r&&s(r,o),'ok'}let r='update'===t.kind?n.update(t.values??{}):n.delete();for(const[s,n]of Object.entries(t.match??{}))r=r.eq(s,n);const{data:o,error:c,status:h}=await r.select();c&&s(c,h);return'update'!==t.kind||o&&0!==o.length?'ok':'conflict'};var t=_r(d[0]),s=_r(d[1]),n=_r(d[2]),r=_r(d[3]),o=_r(d[4]);const u=()=>(0,n.getSupabase)();class c{constructor(t,s={}){this.table=t,this.opts=s,this.keyOf=s.keyOf??(t=>String(t.id)),this.keyColumns=s.keyColumns??['id'],this.venueCol=s.venueColumn??'venue_id'}rows(t){return s.cache.rows(this.table,t)}get(t,n){return s.cache.get(this.table,t,n)}subscribe(t,n){return s.cache.subscribe(this.table,t,n)}hydrate(t){return s.cache.hydrate(this.table,t)}async refresh(n,r={}){const c=()=>{let t=u().from(this.table).select('*').eq(this.venueCol,n);return this.opts.orderBy&&(t=t.order(this.opts.orderBy.column,{ascending:this.opts.orderBy.ascending??!0})),r.filter&&(t=r.filter(t)),t},h='bookings'===this.table?await(0,t.readPages)(async(t,s)=>{const{data:n,error:r}=await c().order('id').range(t,s);if(r)throw r;return n??[]}):await(async()=>{const{data:t,error:s}=await c().limit(this.opts.limit??1e3);if(s)throw s;return t??[]})();return s.cache.replace(this.table,n,h.map(t=>[this.keyOf(t),t]),t=>o.mutationQueue.hasPending(this.table,n,t)),h}async create(t,n){const u={...1===this.keyColumns.length&&'id'===this.keyColumns[0]?{id:(0,r.uuid)()}:{},...n,[this.venueCol]:t},c=this.keyOf(u);return s.cache.put(this.table,t,c,u),await o.mutationQueue.enqueue({table:this.table,venueId:t,kind:'insert'===this.opts.writeMode?'insert':'upsert',rowKey:c,values:u,conflictKey:this.opts.conflictKey??'id'}),u}async update(t,n,r,u={}){const c=s.cache.get(this.table,t,n),h={...this.matchFor(n,c),...u,[this.venueCol]:t};s.cache.patch(this.table,t,n,{...r,updated_at:(new Date).toISOString()}),await o.mutationQueue.enqueue({table:this.table,venueId:t,kind:'update',rowKey:n,values:r,match:h})}async remove(t,n){const r=s.cache.get(this.table,t,n),u={...this.matchFor(n,r),[this.venueCol]:t};s.cache.remove(this.table,t,n),await o.mutationQueue.enqueue({table:this.table,venueId:t,kind:'delete',rowKey:n,match:u})}matchFor(t,s){if(1===this.keyColumns.length&&'id'===this.keyColumns[0])return{id:t};const n={};for(const t of this.keyColumns)n[t]=s?.[t];return n}}},1016,[1017,1018,933,977,1013]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.readPages=async function(t,n=1e3){const s=[];for(let c=0;;c+=n){const o=await t(c,c+n-1);if(s.push(...o),o.length`cache:${t}:${n}`;function f(t){let s=n.get(t);return s||(s=new Map,n.set(t,s)),s}function p(n){s.delete(n),c.get(n)?.forEach(t=>t());const u=o.get(n);u&&clearTimeout(u),o.set(n,setTimeout(()=>{o.delete(n),t.kv.set(n,Array.from(f(n).entries()))},250))}const w={async hydrate(n,s){const c=l(n,s);if(u.has(c))return;u.add(c);const o=await t.kv.get(c,[]),w=f(c);let h=0;for(const[t,n]of o)w.has(t)||(w.set(t,n),h++);h&&p(c)},rows(t,n){const c=l(t,n);let o=s.get(c);return o||(o=Array.from(f(c).values()),s.set(c,o)),o},get:(t,n,s)=>f(l(t,n)).get(s),put(t,n,s,c){f(l(t,n)).set(s,c),p(l(t,n))},patch(t,n,s,c){const o=f(l(t,n)),u=o.get(s);u&&(o.set(s,{...u,...c}),p(l(t,n)))},remove(t,n,s){f(l(t,n)).delete(s)&&p(l(t,n))},replace(t,s,c,o=()=>!1){const u=l(t,s),w=f(u),h=new Map(c);w.forEach((t,n)=>{o(n)&&h.set(n,t)}),n.set(u,h),p(u)},subscribe(t,n,s){const o=l(t,n);let u=c.get(o);return u||(u=new Set,c.set(o,u)),u.add(s),()=>{u?.delete(s)}},async clearVenue(o,f){for(const p of f){const f=l(p,o);n.delete(f),s.delete(f),u.delete(f),await t.kv.remove(f),c.get(f)?.forEach(t=>t())}}}},1018,[977]); @@ -1197,7 +1197,7 @@ __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule', __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SEATED_BG",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"SEATED_FG",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"SEATED_MUTED",{enumerable:!0,get:function(){return u}}),e.isSeatedHighlight=function(t,o){return'seated'===t&&!o?.otherDay},e.seatedHighlightStyle=function(u){return{backgroundColor:o,borderColor:t.colours.goldLight,borderWidth:1.5,borderLeftWidth:8,borderLeftColor:n,...u}};var t=r(d[0]);const o=t.colours.gold,n=t.colours.onGold,u='#3F3218'},1114,[821]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.BookingTableButton=function({rid:e,booking:l,readOnly:y,turnBase:B=90,testID:f}){const[h,j]=(0,t.useState)(!1),k=(0,s.tableButtonLabel)(l.table),x=f??`table-btn-${l.id}`;if(y)return(0,c.jsx)(n.default,{testID:x,accessible:!0,accessibilityLabel:(0,s.tableButtonA11y)(l.table,!0),style:{minHeight:44,justifyContent:'center'},children:(0,c.jsx)(b.T,{size:16,weight:"semibold",colour:o.colours.goldLight,children:k})});return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(b.Button,{kind:"secondary",label:k,testID:x,accessibilityLabel:(0,s.tableButtonA11y)(l.table),onPress:()=>j(!0),style:{minHeight:44}}),h?(0,c.jsx)(u.TablePicker,{rid:e,booking:l,name:l.walkIn?'Walk-in':(l.name??'').replace(' (example)',''),turnBase:B,onClose:()=>j(!1)}):null]})};var e,t=r(d[0]),l=r(d[1]),n=(e=l)&&e.__esModule?e:{default:e},s=r(d[2]),o=r(d[3]),u=r(d[4]),b=r(d[5]),c=r(d[6])},1115,[34,102,1116,821,1117,794,25]); __d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"tableButtonLabel",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"tableButtonA11y",{enumerable:!0,get:function(){return s}}),e.tableOptions=function(t,n,o){const s=t.tables.map(t=>t.name).sort(l),c=new Set;return(t.joins??[]).forEach(t=>{t.tables.length>1&&c.add(t.tables.slice().sort(l).join('+'))}),[...n.map(t=>t.table),o].forEach(t=>{const n=a(t);n.length>1&&c.add(n.slice().sort(l).join('+'))}),[...s,...[...c].sort(l)]},e.tableOverlaps=function(t,l,o,s=90){const c=a(l);if(!c.length)return[];const b={...t,table:l};return o.filter(l=>l.id!==t.id&&l.date===t.date&&!['cancelled','noshow','finished'].includes(l.status)&&a(l.table).some(t=>c.includes(t))&&(0,n.startOf)(b)<(0,n.endOf)(l,s)&&(0,n.startOf)(l)<(0,n.endOf)(b,s))},Object.defineProperty(e,"tablePatch",{enumerable:!0,get:function(){return c}});var t=r(d[0]),n=r(d[1]);const a=t=>t?t.split('+').map(t=>t.trim()).filter(Boolean):[],l=(t,n)=>t.localeCompare(n,'en-GB',{numeric:!0}),o=n=>(0,t.tableNumbers)(n)||'No table',s=(n,a)=>`${(0,t.tableNumbersA11y)(n)}${a?'':', change table'}`;const c=t=>({table:t||void 0,tableSetHere:!0})},1116,[860,1101]); -__d(function(_g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.saveBookingTables=v,_e.TablePicker=function({rid:e,booking:u,name:g,turnBase:k=90,onClose:$,onSaved:w,onPickOnPlan:C}){const L=(0,b.usePlan)(e),S=(0,c.useBookings)(e),[T,P]=(0,l.useState)(()=>(0,b.tablesOf)((0,h.tableKey)((0,b.tablesOf)(u.table)))),W=(0,l.useMemo)(()=>(0,h.pickGroups)(L),[L]),z=S.filter(e=>e.date===u.date),I=(0,h.seatsOf)(L,T),D=(0,h.seatLine)(I.total,u.partySize),B=(0,h.pickClashes)(u,T,z,k),O=e=>(0,h.pickClashes)(u,[e],z,k)[0]?.with,R=(0,h.tableKey)(T)!==(0,h.tableKey)((0,b.tablesOf)(u.table)),M=(0,f.useBlocks)(e=>e.blocks),N=(0,f.blockAt)(M,e,u.date,u.time),[_,A]=(0,l.useState)(null),G=e=>{A(null),P(t=>(0,h.toggleTable)(t,e))},Y=async t=>{try{await v(e,u,t),w?.((0,h.savedWords)(g,u.partySize,t,(0,h.seatsOf)(L,t).total)),$()}catch(e){w?.(`Couldn\u2019t save tables for ${g}: ${String(e?.message??e).slice(0,120)}`)}},K=(0,x.jsxs)(n.default,{style:{gap:8},children:[(0,x.jsxs)(n.default,{testID:"table-pick-total",accessible:!0,accessibilityLabel:`${(0,h.tablesWords)(T)} picked. ${D.text}.`,children:[(0,x.jsx)(p.T,{size:18,weight:"semibold",center:!0,colour:y.colours.goldLight,children:(0,h.tablesWords)(T)}),(0,x.jsx)(p.T,{size:17,center:!0,colour:y.colours.text,children:D.text})]}),N?(0,x.jsx)(n.default,{testID:"table-pick-pause",accessible:!0,accessibilityLabel:`Note. New bookings are paused ${N.from} to ${N.to}${N.reason?` (${N.reason})`:''}. You can still assign tables to this booking.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:y.colours.goldMuted},children:(0,x.jsxs)(p.T,{size:16,center:!0,colour:y.colours.goldLight,children:["New bookings paused ",N.from,"\u2013",N.to,N.reason?` \xb7 ${N.reason}`:'',". You can still save tables for this booking."]})}):null,B.length?(0,x.jsx)(n.default,{testID:"table-pick-clash",accessible:!0,accessibilityLabel:`Warning. ${(0,h.clashWords)(B)} You can still save.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:y.colours.gold},children:(0,x.jsxs)(p.T,{size:16,weight:"semibold",center:!0,colour:y.colours.goldLight,children:[(0,h.clashWords)(B)," You can still save."]})}):null,_?(0,x.jsxs)(n.default,{testID:"table-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:_,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:y.colours.amber,backgroundColor:y.colours.amberBg,alignItems:'stretch'},children:[(0,x.jsx)(p.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:_}),(0,x.jsxs)(p.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,x.jsx)(p.Button,{testID:"table-pick-overcap-yes",label:"Use it anyway",accessibilityLabel:`Use it anyway, ${(0,h.tablesWords)(T)} for ${g}, ${u.partySize} people`,onPress:()=>{Y(T)},style:[j,{flexGrow:1}]}),(0,x.jsx)(p.Button,{testID:"table-pick-overcap-no",kind:"secondary",label:"Pick another table",onPress:()=>A(null),style:j})]})]}):null,(0,x.jsxs)(p.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[_?null:(0,x.jsx)(p.Button,{testID:"table-pick-save",label:B.length?'Save anyway':'Save tables',disabled:!R||!T.length,accessibilityLabel:`${B.length?'Save anyway, ':'Save, '}${(0,h.tablesWords)(T)} for ${g}. ${D.text}.${B.length?` ${(0,h.clashWords)(B)}`:''}`,onPress:()=>{const e=(0,h.overCapacityAsk)(T,I.total,u.partySize);!e||_?Y(T):A(e)},style:[j,{flexGrow:1}]}),(0,b.tablesOf)(u.table).length?(0,x.jsx)(p.Button,{testID:"table-pick-clear",kind:"secondary",label:"Clear table",accessibilityLabel:`Clear table, take ${(0,h.tablesWords)((0,b.tablesOf)(u.table)).toLowerCase()} off ${g}`,onPress:()=>Y([]),style:j}):null,(0,x.jsx)(p.Button,{testID:"table-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",onPress:$,style:j})]})]});return(0,x.jsxs)(p.Sheet,{visible:!0,onClose:$,title:`Tables \xb7 ${u.time} ${g} \xb7 ${u.partySize} Covers`,maxWidth:760,testID:"table-picker",footer:K,children:[(0,x.jsx)(t.TableNumberWarning,{plan:L}),(0,x.jsx)(p.T,{size:16,center:!0,colour:y.colours.text,children:"Tap one table, or several to join them. Tap again to take one off. Smaller tables can still be used."}),C?(0,x.jsx)(p.Button,{kind:"secondary",testID:"table-pick-on-plan",label:"Pick on the table plan",accessibilityLabel:`Pick on the table plan instead, for ${g}`,onPress:()=>C(T),style:j}):null,W.map(e=>(0,x.jsxs)(n.default,{style:{gap:6},accessibilityLabel:e.area,children:[(0,x.jsx)(p.T,{size:15,weight:"semibold",center:!0,colour:y.colours.gold,children:e.area}),(0,x.jsx)(p.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:e.tables.map(e=>{const t=T.includes(e.name),l=O(e.name);return(0,x.jsxs)(o.default,{testID:`table-pick-${e.name}`,accessibilityRole:"checkbox",accessibilityState:{checked:t},'aria-checked':t,accessibilityLabel:(0,h.pickA11y)(e.name,e.seats,t,l),onPress:()=>G(e.name),style:({pressed:e})=>({minWidth:92,minHeight:64,paddingHorizontal:10,paddingVertical:6,borderRadius:12,alignItems:'center',justifyContent:'center',borderWidth:t?2:1,borderColor:t?y.colours.gold:l?y.colours.goldMuted:y.colours.hairline,borderStyle:l&&!t?'dashed':'solid',backgroundColor:t?y.colours.gold:e?y.colours.tilePressed:y.colours.tile}),children:[(0,x.jsx)(p.T,{size:18,weight:"semibold",colour:t?y.colours.onGold:y.colours.text,children:(0,s.tableNumbers)(e.name)}),(0,x.jsxs)(p.T,{size:14,colour:t?y.colours.onGold:y.colours.muted,children:[e.seats," seats",l?' \xb7 booked':'']})]},e.name)})})]},e.area)),W.length?null:(0,x.jsx)(p.Muted,{center:!0,children:"No tables on the plan yet. Add them in Setup \u203a Table plan."})]})};var t=r(d[0]),s=r(d[1]),l=r(d[2]),o=e(r(d[3])),n=e(r(d[4])),c=r(d[5]),b=r(d[6]),u=r(d[7]),h=r(d[8]),y=r(d[9]),g=r(d[10]),p=r(d[11]),k=r(d[12]),f=r(d[13]),x=r(d[14]);const j={minHeight:56};async function v(e,t,s){const l=(0,h.tableKey)(s),o=(0,b.tablesOf)(t.table);await c.repo.bookings.update(t.id,(0,u.tablePatch)(l||null)),'seated'===t.status&&t.date===(0,g.venueYmd)(new Date)&&(o.filter(e=>!(0,b.tablesOf)(l).includes(e)).forEach(t=>b.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!0})),l&&(0,k.resetTableLive)(e,l))}},1117,[1118,860,34,402,102,874,1025,1116,1119,821,858,794,1120,1022,25]); +__d(function(_g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.saveBookingTables=v,_e.TablePicker=function({rid:e,booking:u,name:g,turnBase:k=90,onClose:$,onSaved:w,onPickOnPlan:C}){const L=(0,b.usePlan)(e),S=(0,c.useBookings)(e),[T,P]=(0,l.useState)(()=>(0,b.tablesOf)((0,h.tableKey)((0,b.tablesOf)(u.table)))),W=(0,l.useMemo)(()=>(0,h.pickGroups)(L),[L]),z=S.filter(e=>e.date===u.date),I=(0,h.seatsOf)(L,T),D=(0,h.seatLine)(I.total,u.partySize),B=(0,h.pickClashes)(u,T,z,k),O=e=>(0,h.pickClashes)(u,[e],z,k)[0]?.with,R=(0,h.tableKey)(T)!==(0,h.tableKey)((0,b.tablesOf)(u.table)),M=(0,f.useBlocks)(e=>e.blocks),N=(0,f.blockAt)(M,e,u.date,u.time),[_,A]=(0,l.useState)(null),G=e=>{A(null),P(t=>(0,h.toggleTable)(t,e))},Y=async t=>{try{await v(e,u,t),w?.((0,h.savedWords)(g,u.partySize,t,(0,h.seatsOf)(L,t).total)),$()}catch(e){w?.(`Couldn\u2019t save tables for ${g}: ${String(e?.message??e).slice(0,120)}`)}},K=(0,x.jsxs)(n.default,{style:{gap:8},children:[(0,x.jsxs)(n.default,{testID:"table-pick-total",accessible:!0,accessibilityLabel:`${(0,h.tablesWords)(T)} picked. ${D.text}.`,children:[(0,x.jsx)(p.T,{size:18,weight:"semibold",center:!0,colour:y.colours.goldLight,children:(0,h.tablesWords)(T)}),(0,x.jsx)(p.T,{size:17,center:!0,colour:y.colours.text,children:D.text})]}),N?(0,x.jsx)(n.default,{testID:"table-pick-pause",accessible:!0,accessibilityLabel:`Note. New bookings are paused ${N.from} to ${N.to}${N.reason?` (${N.reason})`:''}. You can still assign tables to this booking.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:y.colours.goldMuted},children:(0,x.jsxs)(p.T,{size:16,center:!0,colour:y.colours.goldLight,children:["New bookings paused ",N.from,"\u2013",N.to,N.reason?` \xb7 ${N.reason}`:'',". You can still save tables for this booking."]})}):null,B.length?(0,x.jsx)(n.default,{testID:"table-pick-clash",accessible:!0,accessibilityLabel:`Warning. ${(0,h.clashWords)(B)} You can still save.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:y.colours.gold},children:(0,x.jsxs)(p.T,{size:16,weight:"semibold",center:!0,colour:y.colours.goldLight,children:[(0,h.clashWords)(B)," You can still save."]})}):null,_?(0,x.jsxs)(n.default,{testID:"table-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:_,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:y.colours.gold,backgroundColor:y.colours.amberBg,alignItems:'stretch'},children:[(0,x.jsx)(p.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:_}),(0,x.jsxs)(p.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,x.jsx)(p.Button,{testID:"table-pick-overcap-yes",label:"Use it anyway",accessibilityLabel:`Use it anyway, ${(0,h.tablesWords)(T)} for ${g}, ${u.partySize} people`,onPress:()=>{Y(T)},style:[j,{flexGrow:1}]}),(0,x.jsx)(p.Button,{testID:"table-pick-overcap-no",kind:"secondary",label:"Pick another table",onPress:()=>A(null),style:j})]})]}):null,(0,x.jsxs)(p.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[_?null:(0,x.jsx)(p.Button,{testID:"table-pick-save",label:B.length?'Save anyway':'Save tables',disabled:!R||!T.length,accessibilityLabel:`${B.length?'Save anyway, ':'Save, '}${(0,h.tablesWords)(T)} for ${g}. ${D.text}.${B.length?` ${(0,h.clashWords)(B)}`:''}`,onPress:()=>{const e=(0,h.overCapacityAsk)(T,I.total,u.partySize);!e||_?Y(T):A(e)},style:[j,{flexGrow:1}]}),(0,b.tablesOf)(u.table).length?(0,x.jsx)(p.Button,{testID:"table-pick-clear",kind:"secondary",label:"Clear table",accessibilityLabel:`Clear table, take ${(0,h.tablesWords)((0,b.tablesOf)(u.table)).toLowerCase()} off ${g}`,onPress:()=>Y([]),style:j}):null,(0,x.jsx)(p.Button,{testID:"table-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",onPress:$,style:j})]})]});return(0,x.jsxs)(p.Sheet,{visible:!0,onClose:$,title:`Tables \xb7 ${u.time} ${g} \xb7 ${u.partySize} Covers`,maxWidth:760,testID:"table-picker",footer:K,children:[(0,x.jsx)(t.TableNumberWarning,{plan:L}),(0,x.jsx)(p.T,{size:16,center:!0,colour:y.colours.text,children:"Tap one table, or several to join them. Tap again to take one off. Smaller tables can still be used."}),C?(0,x.jsx)(p.Button,{kind:"secondary",testID:"table-pick-on-plan",label:"Pick on the table plan",accessibilityLabel:`Pick on the table plan instead, for ${g}`,onPress:()=>C(T),style:j}):null,W.map(e=>(0,x.jsxs)(n.default,{style:{gap:6},accessibilityLabel:e.area,children:[(0,x.jsx)(p.T,{size:15,weight:"semibold",center:!0,colour:y.colours.gold,children:e.area}),(0,x.jsx)(p.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:e.tables.map(e=>{const t=T.includes(e.name),l=O(e.name);return(0,x.jsxs)(o.default,{testID:`table-pick-${e.name}`,accessibilityRole:"checkbox",accessibilityState:{checked:t},'aria-checked':t,accessibilityLabel:(0,h.pickA11y)(e.name,e.seats,t,l),onPress:()=>G(e.name),style:({pressed:e})=>({minWidth:92,minHeight:64,paddingHorizontal:10,paddingVertical:6,borderRadius:12,alignItems:'center',justifyContent:'center',borderWidth:t?2:1,borderColor:t?y.colours.gold:l?y.colours.goldMuted:y.colours.hairline,borderStyle:l&&!t?'dashed':'solid',backgroundColor:t?y.colours.gold:e?y.colours.tilePressed:y.colours.tile}),children:[(0,x.jsx)(p.T,{size:18,weight:"semibold",colour:t?y.colours.onGold:y.colours.text,children:(0,s.tableNumbers)(e.name)}),(0,x.jsxs)(p.T,{size:14,colour:t?y.colours.onGold:y.colours.muted,children:[e.seats," seats",l?' \xb7 booked':'']})]},e.name)})})]},e.area)),W.length?null:(0,x.jsx)(p.Muted,{center:!0,children:"No tables on the plan yet. Add them in Setup \u203a Table plan."})]})};var t=r(d[0]),s=r(d[1]),l=r(d[2]),o=e(r(d[3])),n=e(r(d[4])),c=r(d[5]),b=r(d[6]),u=r(d[7]),h=r(d[8]),y=r(d[9]),g=r(d[10]),p=r(d[11]),k=r(d[12]),f=r(d[13]),x=r(d[14]);const j={minHeight:56};async function v(e,t,s){const l=(0,h.tableKey)(s),o=(0,b.tablesOf)(t.table);await c.repo.bookings.update(t.id,(0,u.tablePatch)(l||null)),'seated'===t.status&&t.date===(0,g.venueYmd)(new Date)&&(o.filter(e=>!(0,b.tablesOf)(l).includes(e)).forEach(t=>b.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!0})),l&&(0,k.resetTableLive)(e,l))}},1117,[1118,860,34,402,102,874,1025,1116,1119,821,858,794,1120,1022,25]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.TableNumberWarning=function({plan:u}){const c=(0,n.numberClashes)(u.tables),o=[...new Set([...c.acrossAreas,...u.tables.filter(n=>c.sameArea.has(n.name)).map(n.tableNumber)])];return o.length?(0,l.jsxs)(t.T,{testID:"duplicate-table-numbers",size:16,colour:s.colours.goldLight,children:["Duplicate table numbers: ",o.join(', '),". Kept unchanged. Ask a manager to check the areas before assigning."]}):null},r(d[0]);var n=r(d[1]),s=r(d[2]),t=r(d[3]),l=r(d[4])},1118,[34,859,821,794,25]); __d(function(_g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"byNum",{enumerable:!0,get:function(){return s}}),e.tableKey=o,e.toggleTable=function(t,n){return t.includes(n)?t.filter(t=>t!==n):a(o([...t,n]))},e.seatsOf=function(t,n){const a={};for(const s of n)a[s]=t.tables.find(t=>t.name===s)?.maxSeats??0;return{per:a,total:Object.values(a).reduce((t,n)=>t+n,0)}},e.seatLine=function(t,n){const a=Math.max(0,n-t);return{text:`${t} ${1===t?'seat':'seats'} for ${l(n)}${a?`: ${a} short`:''}`,short:a,fits:0===a&&t>0}},e.pickClashes=function(t,l,u,c=90){if(!l.length)return[];const f={...t,table:o(l)},b=[];for(const s of u)if(s.id!==t.id&&s.date===t.date&&!['cancelled','noshow','finished'].includes(s.status)&&(0,n.startOf)(f)<(0,n.endOf)(s,c)&&(0,n.startOf)(s)<(0,n.endOf)(f,c))for(const t of a(s.table))l.includes(t)&&b.push({table:t,with:s});return b.sort((t,n)=>s(t.table,n.table))},e.overCapacityAsk=function(n,s,l){const u=a(o(n));if(!u.length||s>=l)return null;const c=u.map(n=>(0,t.tableNumbers)(n));return`${1===c.length?`Table ${c[0]} seats`:`Tables ${c.slice(0,-1).join(', ')} and ${c[c.length-1]} seat`} ${s} \u2013 this booking is ${l}. Use it anyway?`},e.clashWords=function(n){return n.map(n=>`${(0,t.tableNumbers)(n.table)} has ${n.with.walkIn?'a walk-in':(n.with.name||'a booking').replace(' (example)','')} at ${n.with.time}`).join('. ')+(n.length?'.':'')},e.tablesWords=u,e.pickA11y=function(n,a,s,l){return`Table ${(0,t.tableNumbers)(n)}, ${a} ${1===a?'seat':'seats'}${s?', selected':''}${l?`, has ${l.walkIn?'a walk-in':l.name} at ${l.time}`:''}`},e.pickGroups=function(t){return t.areas.map(n=>({area:n.name,tables:t.tables.filter(t=>t.areaId===n.id).map(t=>({name:t.name,seats:t.maxSeats})).sort((t,n)=>s(t.name,n.name))})).filter(t=>t.tables.length)},e.savedWords=function(t,n,a,s){return a.length?`${t}, ${l(n)}: ${u(a)} (${s} seats).`:`${t}: table taken off.`},e.tableActions=function(t,n){const s=a(t.table);if(['cancelled','noshow'].includes(t.status))return[];const o=[s.length?{id:'assign',label:'Change table',a11y:`Change table for ${n}, ${l(t.partySize)}, now ${u(s).toLowerCase()}. You can pick several tables to join.`}:{id:'assign',label:'Assign table',a11y:`Assign table for ${n}, ${l(t.partySize)}. You can pick several tables to join.`}];s.length&&o.push({id:'clear',label:'Clear table',a11y:`Clear table for ${n}, take ${u(s).toLowerCase()} off this booking`});return o},e.dragTables=function(t,n,s){if(!s||'__none'===s||s===n)return null;const l=a(t);if(l.includes(s))return null;return o('__none'!==n&&l.includes(n)?l.map(t=>t===n?s:t):[s])};var t=r(d[0]),n=r(d[1]);const a=t=>t?t.split('+').map(t=>t.trim()).filter(Boolean):[],s=(t,n)=>t.localeCompare(n,'en-GB',{numeric:!0}),l=t=>`${t} ${1===t?'person':'people'}`;function o(t){return[...new Set(t.map(t=>String(t).trim()).filter(Boolean))].sort(s).join('+')}function u(n){const s=a(o(n));return s.length?(0,t.tableListNumbers)(s):'No table'}},1119,[860,1101]); __d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"TABLES",{enumerable:!0,get:function(){return O}}),_e.useTableNames=N,_e.resetTableLive=M,_e.seatBookingNow=L,_e.finishBookingNow=async function(e,t){await f.repo.bookings.setStatus(t.id,'finished'),(0,S.tablesOf)(t.table).forEach(t=>S.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!0}))},_e.useTableUse=F,Object.defineProperty(_e,"walkInLabel",{enumerable:!0,get:function(){return R}}),_e.TablePicker=W,_e.WalkInSheet=E,_e.WalkInMatchPrompt=H,_e.AssignTableSheet=_,_e.undoNotice=Y,_e.NewBookingSheet=U,_e.useFrontDoor=function(e,t){const[s,o]=(0,r.useState)(!1),[l,a]=(0,r.useState)(!1),[i,d]=(0,r.useState)(null);return{openWalkIn:()=>o({}),openWalkInAt:e=>o({table:e}),openBooking:()=>a(!0),assignTable:e=>d({b:e}),combineTables:e=>d({b:e,combine:!0}),elements:(0,B.jsxs)(B.Fragment,{children:[s?(0,B.jsx)(E,{wide:t,initialTable:s.table,onClose:()=>o(!1),onSeated:Y}):null,l?(0,B.jsx)(U,{wide:t,date:e,onClose:()=>a(!1),onSaved:e=>(0,n.notify)({id:`booked:${Date.now()}`,testID:'booking-saved-toast',timeoutMs:5e3,icon:'\u2713',title:`Booked: ${e.name} \xb7 ${(0,x.niceDate)((0,x.parseYmd)(e.date))} at ${e.time}`})}):null,i?(0,B.jsx)(_,{booking:i.b,combine:i.combine,onClose:()=>d(null)}):null]})}};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),a=_r(_d[4]),i=_r(_d[5]),n=_r(_d[6]),r=_r(_d[7]),d=e(r),u=_r(_d[8]),c=e(_r(_d[9])),b=e(_r(_d[10])),h=_r(_d[11]),p=_r(_d[12]),f=_r(_d[13]),y=_r(_d[14]),k=_r(_d[15]),x=_r(_d[16]),j=_r(_d[17]),w=_r(_d[18]),T=_r(_d[19]),S=_r(_d[20]),v=_r(_d[21]),C=_r(_d[22]),D=_r(_d[23]),I=_r(_d[24]),$=_r(_d[25]),P=_r(_d[26]),z=_r(_d[27]),B=_r(_d[28]);const O=Array.from({length:12},(e,t)=>String(t+1));function N(e){const t=(0,S.usePlan)(e);return t.areas.flatMap(e=>t.tables.filter(t=>t.areaId===e.id).map(e=>e.name))}function M(e,t){(0,S.tablesOf)(t).forEach(t=>S.useFloor.getState().setLive(e,t,{stage:'seated',dirty:!1}))}async function L(e,t){await f.repo.bookings.setStatus(t.id,'seated'),M(e,t.table)}function F(e,t){const s=(0,f.useBookings)(e),o=(0,f.useOrders)(e),l=N(e),a=(0,S.useFloor)(t=>t.live[e])??{},i=(0,S.usePlan)(e),n=(0,v.useBlocks)(e=>e.blocks),r=(0,x.ymd)(t),d=(0,v.closedAreasAt)(n,e,r,(0,x.hm)(t)),u={};for(const e of l)u[e]=a[e]?.blocked||d.has(`tbl:${e}`)?{busy:!0,label:'Blocked'}:d.has(i.tables.find(t=>t.name===e)?.areaId??'')?{busy:!0,label:'Closed'}:a[e]?.dirty?{busy:!0,label:'Needs clearing'}:{busy:!1,label:'Free'};for(const e of s)if(e.date===r&&e.table)for(const s of(0,S.tablesOf)(e.table))if(u[s])if('seated'===e.status)u[s]={busy:!0,label:`${e.walkIn?'Walk-in':`${e.name.slice(0,1)}.`} \xb7 ${e.partySize}`};else if('confirmed'===e.status&&!u[s].busy){const o=(0,x.minsBetween)(t,new Date(`${e.date}T${e.time}:00`));o>=-15&&o<=90&&(u[s]={...u[s],soon:`Booked ${e.time}`})}for(const e of o)'table'===e.type&&e.tableNo&&u[e.tableNo]&&!['closed','cancelled','collected'].includes(e.status)&&!u[e.tableNo].busy&&(u[e.tableNo]={busy:!0,label:'Open order'});return u}const R=e=>e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;function W({use:e,value:t,onPick:s,big:o,best:a,dense:i,bestSet:n,picked:d}){const u=Object.keys(e),[h,p]=(0,r.useState)(0),f=i?6:8,y=i?64:o?92:76,k=h?Math.max(3,Math.floor((h+f)/(y+f))):0,x=k?Math.floor((h-f*(k-1))/k):y,w=new Set(n??[]),v=a?(0,S.tablesOf)(a)[0]:null;return(0,B.jsx)(b.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:f},testID:"table-picker",onLayout:e=>p(Math.floor(e.nativeEvent.layout.width)),children:u.map(o=>{const a=e[o],n=t===o||!!d?.includes(o),r=w.has(o),u=v===o&&!n,h=a.busy?['Blocked','Needs clearing','Closed'].includes(a.label)?a.label:'In use':a.soon??'Free';return(0,B.jsxs)(c.default,{accessibilityRole:"button",testID:`pick-table-${o}`,accessibilityLabel:`Table ${(0,l.tableNumbers)(o)}${d?n?', picked':', not picked':''}, ${a.busy?`in use (${a.label})`:a.soon?`free, ${a.soon}`:'free'}${r?', best table':''}${u?', suggested for this party':''}`,accessibilityState:{selected:n,disabled:'Closed'===a.label},disabled:'Closed'===a.label,onPress:()=>s(o),style:{width:x,minHeight:i?58:64,borderRadius:12,borderWidth:n||u?2.5:1.5,paddingVertical:i?3:6,paddingHorizontal:4,alignItems:'center',justifyContent:'center',gap:2,borderColor:n||u?j.colours.gold:a.busy?j.colours.red:j.colours.ok,backgroundColor:n?j.colours.goldTint:a.busy?j.colours.redBg:j.colours.surface2,opacity:'Closed'!==a.label||n?1:.55},children:[(0,B.jsxs)(b.default,{style:{flexDirection:'row',alignItems:'center',gap:4},children:[(0,B.jsx)(T.T,{weight:"bold",size:22,colour:n?j.colours.goldLight:j.colours.text,children:(0,l.tableNumbers)(o)}),r?(0,B.jsx)(b.default,{testID:"best-table",style:{backgroundColor:j.colours.gold,borderRadius:5,paddingHorizontal:4,paddingVertical:1},children:(0,B.jsx)(T.T,{size:11,weight:"bold",colour:j.colours.onGold,children:"BEST"})}):null]}),(0,B.jsx)(T.T,{size:i?13:14,colour:a.busy?'#FFD9D4':a.soon?'#FFE2A8':'#E2C489',center:!0,numberOfLines:1,children:h})]},o)})})}const A=[1,2,3,4,5,6,7,8];function E({onClose:e,onSeated:a,wide:i,initialTable:y}){const{rid:w,r:C,now:D}=(0,p.useCtx)(15e3),I=F(w,D),[$,P]=(0,r.useState)(2),[O,N]=(0,r.useState)(!1),[R,E]=(0,r.useState)(y??null),_=(0,S.usePlan)(w),Y=(0,f.useBookings)(w),U=(0,v.useBlocks)(e=>e.blocks),q=(0,v.closedAreasAt)(U,w,(0,x.ymd)(D),(0,x.hm)(D)),Q=d.default.useMemo(()=>{const e=Object.fromEntries(Object.entries(I).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,k.suggestTable)(_,Y.filter(e=>e.date===(0,x.ymd)(D)),e,$,D,(0,k.turnFor)($,C.settings.turnMins),90,void 0,{closed:q})?.table??null},[_,Y,I,$,q.size,D.getTime()]);(0,r.useEffect)(()=>{R&&(0,S.tablesOf)(R).some(e=>'Closed'===I[e]?.label)&&E(null)},[R,q.size]);const[V,G]=(0,r.useState)(!1),[K,X]=(0,r.useState)(''),J=(e,t=String(e),s=()=>{N(!1),P(e)})=>{const o='9+'===t?O:!O&&$===e;return(0,B.jsx)(c.default,{accessibilityRole:"button",accessibilityLabel:'9+'===t?'Party of 9 or more':`Party of ${e}`,accessibilityState:{selected:o},onPress:s,style:{width:i?58:60,height:i?58:56,borderRadius:14,borderWidth:2,borderColor:j.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:o?j.colours.gold:'transparent'},children:(0,B.jsx)(T.T,{weight:"bold",size:22,colour:o?j.colours.onGold:j.colours.gold,children:t})},t)},Z=(0,B.jsx)(s.PartySizeInput,{value:$,onChange:P,min:9,max:o.MAX_PARTY,label:"Walk-in party size",testID:"walkin-party-size"}),ee=(0,B.jsxs)(b.default,{style:{gap:8,width:i?256:void 0},children:[(0,B.jsx)(T.T,{weight:"semibold",children:"How many people?"}),(0,B.jsxs)(b.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},testID:"walkin-party",children:[A.map(e=>J(e)),J(9,'9+',()=>{N(!0),P(e=>e>=9?e:9)})]}),O?Z:null]}),[te,se]=(0,r.useState)(!1),[oe,le]=(0,r.useState)(null),ae=async(t=R,s=!1)=>{if(!te){if(!s){const e=(0,z.bookingsNearWalkIn)(Y,D,$);if(e.length)return void le({at:t,list:e})}se(!0);try{const s=await f.repo.bookings.seatWalkIn(w,$,t??void 0,K);M(w,t??void 0),a(s),e()}finally{se(!1)}}},ie=async(t,s)=>{if(!te){se(!0);try{const o=s??t.table??null;o&&o!==t.table&&await f.repo.bookings.assignTable(t.id,o),await L(w,{...t,table:o??void 0}),(0,n.notify)({id:`seated:${t.id}`,testID:'walkin-match-toast',timeoutMs:5e3,icon:'\u2713',title:`${t.name} seated \xb7 ${t.partySize} \xb7 ${o?(0,l.tableNumbers)(o):'table to assign'} (booking ${t.ref})`}),le(null),e()}finally{se(!1)}}},ne=(0,B.jsxs)(b.default,{style:{gap:8,flex:i?1:void 0,minWidth:0},children:[(0,B.jsxs)(T.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsxs)(T.T,{weight:"semibold",children:["Table ",(0,B.jsx)(T.T,{colour:j.colours.muted,size:14,children:"(optional)"})]}),R?(0,B.jsx)(T.Button,{small:!0,kind:"ghost",label:"Clear table",onPress:()=>E(null)}):null]}),(0,B.jsx)(W,{use:I,value:R,onPick:e=>{I[e]&&!I[e].busy?ae(e):E(R===e?null:e)},big:i,dense:i,best:Q,bestSet:(0,u.bestTables)(_)}),(0,B.jsxs)(T.Muted,{children:["Tap a free table to seat them there",Q&&!R?` (suggested for ${$}: ${(0,l.tableNumbers)(Q)})`:'',", or Seat for no table yet. BEST marks the venue\u2019s best tables."]})]});return(0,B.jsxs)(T.Sheet,{visible:!0,onClose:e,title:`Walk-in \xb7 ${(0,x.hm)(D)}`,maxWidth:i?1100:void 0,testID:"walkin-sheet",children:[(0,B.jsx)(T.Button,{label:`Seat walk-in \xb7 ${$} ${1===$?'person':'people'}${R?` \xb7 ${(0,l.tableNumbers)(R)}`:''}`,disabled:te,onPress:()=>{ae()},testID:"seat-walkin",style:{minHeight:52}}),i?(0,B.jsxs)(T.Row,{gap:16,style:{alignItems:'flex-start'},children:[ee,ne]}):(0,B.jsxs)(B.Fragment,{children:[ee,ne]}),(0,B.jsxs)(T.Row,{gap:10,wrap:!0,style:{alignItems:'center'},children:[V?(0,B.jsx)(t.TextInput,{accessibilityLabel:"Walk-in note",placeholder:"Note (optional), e.g. high chair",placeholderTextColor:"#7D776C",value:K,onChangeText:X,style:[T.styles.input,{flex:1,minWidth:220}],autoFocus:!0}):(0,B.jsx)(T.Button,{small:!0,kind:"ghost",label:"Add a note (optional)",onPress:()=>G(!0)}),(0,B.jsx)(b.default,{style:{flex:1,minWidth:220},children:(0,B.jsxs)(T.Muted,{children:["No name needed. Counts in today's covers.",'staff'!==h.APP_VARIANT?' Using website bookings too? Mark the table there as well.':'']})})]}),oe?(0,B.jsx)(H,{list:oe.list,busy:te,onYes:e=>{ie(e,oe.at)},onNo:()=>{const e=oe.at;le(null),ae(e,!0)},onClose:()=>le(null)}):null]})}function H({list:e,busy:t,onYes:s,onNo:o,onClose:a}){return(0,B.jsx)(T.Sheet,{visible:!0,onClose:a,title:"Booked party?",maxWidth:720,testID:"walkin-match",children:(0,B.jsxs)(b.default,{style:{gap:14},children:[e.map((e,o)=>(0,B.jsxs)(b.default,{testID:`walkin-match-${o}`,style:{gap:12,padding:16,borderRadius:16,borderWidth:2,borderColor:j.colours.gold,backgroundColor:'#15130F'},children:[(0,B.jsx)(b.default,{accessibilityRole:"header",accessibilityLiveRegion:"polite",children:(0,B.jsx)(T.T,{size:26,weight:"bold",colour:j.colours.goldLight,testID:"walkin-match-question",children:(0,z.walkInMatchQuestion)(e)})}),e.table?(0,B.jsxs)(T.T,{size:17,colour:j.colours.text,children:["Booked table ",(0,l.tableNumbers)(e.table)," \xb7 ",e.ref]}):(0,B.jsx)(T.T,{size:17,colour:j.colours.text,children:e.ref}),(0,B.jsx)(T.Button,{label:"Yes, seat booking",testID:"walkin-match-yes",disabled:t,accessibilityLabel:`Yes, seat ${e.name}'s booking, ${e.partySize} people`,onPress:()=>s(e),style:{minHeight:64}})]},e.id)),(0,B.jsx)(T.Button,{kind:"secondary",label:"No, new walk-in",testID:"walkin-match-no",disabled:t,onPress:o,style:{minHeight:64}})]})})}function _({booking:e,onClose:t,combine:s}){const{rid:o,r:a,now:i}=(0,p.useCtx)(15e3),n=F(o,i),c=(0,S.usePlan)(o),h=(0,f.useBookings)(o),y=(0,S.tablesOf)(e.table),w=d.default.useMemo(()=>Object.fromEntries(Object.entries(n).map(([e,t])=>[e,y.includes(e)?{busy:!1,label:'This party',soon:'This party'}:t])),[n,e.table]),v=d.default.useMemo(()=>{const t=Object.fromEntries(Object.entries(w).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,k.suggestTable)(c,h.filter(e=>e.date===(0,x.ymd)(i)),t,e.partySize,i,(0,k.turnFor)(e.partySize,a.settings.turnMins),90,e.id)?.table??null},[c,h,w,e.partySize,i.getTime()]),[C,D]=(0,r.useState)(!!s||y.length>1),[I,$]=(0,r.useState)(y),P=e=>c.tables.find(t=>t.name===e)?.maxSeats??0,z=I.reduce((e,t)=>e+P(t),0),O=I.length>0&&z{const l=(0,S.joinTables)(s);await f.repo.bookings.assignTable(e.id,l);y.filter(e=>!s.includes(e)).forEach(t=>S.useFloor.getState().setLive(o,t,{stage:void 0,dirty:'seated'===e.status})),'seated'===e.status&&M(o,l),t()},L=C?(0,B.jsxs)(b.default,{style:{gap:8},testID:"assign-table-tip",children:[(0,B.jsx)(b.default,{accessibilityLiveRegion:"polite",children:(0,B.jsx)(T.T,{size:17,weight:"semibold",colour:j.colours.text,children:I.length?`${(0,S.tablesLabel)((0,S.joinTables)(I))} \xb7 ${z} seats for ${e.partySize} Covers`:'No tables picked yet'})}),O?(0,B.jsx)(b.default,{testID:"combine-short",children:(0,B.jsxs)(T.T,{size:15,weight:"semibold",colour:"#FFD9D4",children:["Not enough seats yet: ",e.partySize-z," more needed. Add another table."]})}):null,(0,B.jsx)(T.T,{size:15,colour:j.colours.text,children:"Tap each table to add or remove it, then tap Done. All of them show as taken until the party has finished."}),(0,B.jsxs)(T.Row,{gap:8,wrap:!0,children:[(0,B.jsx)(T.Button,{label:"Done",testID:"combine-done",disabled:!I.length,accessibilityLabel:I.length?`Done, save ${(0,S.tableCardLabel)((0,S.joinTables)(I))}`:'Done',onPress:()=>N(I)}),(0,B.jsx)(T.Button,{kind:"ghost",label:"Cancel",onPress:t})]})]}):(0,B.jsx)(b.default,{style:{gap:8},testID:"assign-table-tip",children:(0,B.jsx)(T.T,{size:15,colour:j.colours.text,children:"Red tables are in use right now; you can still pick one (e.g. joining a table). BEST marks the venue\u2019s best tables. Big party? Tap Combine tables."})});return(0,B.jsxs)(T.Sheet,{visible:!0,onClose:t,title:`${C?'Combine tables':'Assign table'} \xb7 ${R(e)}`,testID:"assign-table-sheet",footer:L,children:[v&&!C?(0,B.jsx)(b.default,{testID:"assign-suggested",children:(0,B.jsxs)(T.T,{size:16,weight:"semibold",colour:j.colours.goldLight,accessibilityLabel:`Suggested for ${e.partySize}: ${(0,S.tableCardLabel)(v)}`,children:["Suggested for ",e.partySize,": ",(0,l.tableNumbers)(v)]})}):null,C?null:(0,B.jsx)(T.Button,{kind:"secondary",label:"Combine tables",testID:"combine-start",accessibilityLabel:"Combine tables: pick several tables for this party",onPress:()=>D(!0)}),(0,B.jsx)(W,{use:w,best:C?null:v,bestSet:(0,u.bestTables)(c),picked:C?I:void 0,onPick:C?e=>$(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]):async e=>{await N([e])}})]})}function Y(e){(0,n.notify)({id:`walkin:${e.id}`,testID:'walkin-toast',timeoutMs:6e3,title:`${R(e)} seated \xb7 ${e.table?`${(0,l.tableNumbers)(e.table)}`:'table to assign'} (${e.ref})`,actions:[{label:'Undo',testID:'undo-walkin',onPress:()=>f.repo.bookings.undoWalkIn(e.id)},{label:'OK',kind:'ghost'}]})}function U({date:e,onClose:t,wide:n,onSaved:d}){const{rid:u,r:c,now:h,role:z,meId:O}=(0,p.useCtx)(6e4),N=(0,x.ymd)(h),[M,L]=(0,r.useState)(ee.blocks),[W,A]=(0,r.useState)(!1),[E,H]=(0,r.useState)(''),[_,Y]=(0,r.useState)(2),[U,q]=(0,r.useState)(null),[Q,V]=(0,r.useState)(''),[G,K]=(0,r.useState)(''),[X,J]=(0,r.useState)(''),[Z,ee]=(0,r.useState)('phone'),[te,se]=(0,r.useState)((0,D.emptyNeeds)()),oe=(0,D.needsMissing)(te),[le,ae]=(0,r.useState)(null),ie=(0,S.usePlan)(u),ne=(0,P.dogSetUp)(ie),re=!0===te.dog&&ne,de=te.dog?te.dogs:0,ue=(0,x.parseYmd)(M),ce=(0,k.turnFor)(_,c.settings.turnMins),be=F.filter(e=>e.date===M),he=e=>(0,k.freeTablesAt)(ie,be,_,new Date(`${M}${(0,l.tableNumbers)(e)}:00`),ce,c.settings.turnMins,{dog:!0,closed:(0,v.closedAreasAt)(R,u,M,e)}),ge=re&&U?he(U):[];(0,r.useEffect)(()=>{ae(null)},[re,U,_]);const pe=(0,y.bookingSlots)(c,ue,e=>F.filter(t=>t.date===M&&t.time===e&&'cancelled'!==t.status&&!t.walkIn).reduce((e,t)=>e+t.partySize,0),_,M===(0,x.ymd)(h)?h:(0,x.addMins)(ue,0),e=>F.filter(t=>t.date===M&&t.time===e&&'cancelled'!==t.status&&!t.walkIn).length),me=(0,w.ukPhone)(G),[fe,ye]=(0,r.useState)(!1),ke=U?pe.find(e=>e.time===U):void 0,xe=ke&&ke.left<_?{left:Math.max(0,ke.left),time:ke.time}:null,je=ke&&null!=ke.partiesLeft&&ke.partiesLeft<1?{time:ke.time,cap:ke.partiesCap??0}:null,we=xe||je,Te=U?(0,v.blockAt)(R,u,M,U):void 0,Se='staff'!==z,ve=!!U&&!(0,D.dogTimeOk)(c,F,M,U,de),Ce=!oe.length&&E.trim().length>=2&&!!U&&(!we||fe)&&(0,o.validParty)(_)&&me.ok&&(0,w.emailOk)(X)&&(!Te||Se&&W)&&(!re||ge.length>0)&&!ve,De=te.wheelchair>0||te.stepFree;return(0,B.jsxs)(T.Sheet,{visible:!0,onClose:t,title:`New booking \xb7 ${(0,x.niceDate)(ue)}`,maxWidth:n?760:void 0,testID:"booking-sheet",children:[(0,B.jsx)(D.FirstQuestions,{rid:u,value:te,onChange:se,party:_,audience:"staff"}),te.dog&&!ne?(0,B.jsx)(T.T,{size:13,colour:j.colours.amber,children:"Dog-friendly tables aren\u2019t marked yet. Managers \u203a Booking options \u203a Tables. Booking is allowed; check where the dog can sit."}):null,(0,B.jsx)(C.BookingDatePicker,{r:c,today:h,value:M,onChange:e=>{e!==M&&(L(e),q(null),A(!1))}}),(0,B.jsxs)(T.Row,{gap:6,children:[(0,B.jsx)(T.Chip,{label:"Phone",selected:'phone'===Z,onPress:()=>ee('phone')}),(0,B.jsx)(T.Chip,{label:"In person",selected:'in-person'===Z,onPress:()=>ee('in-person')})]}),(0,B.jsx)(T.Field,{label:"Name",value:E,onChangeText:H,placeholder:"e.g. Reid",testID:"nb-name"}),(0,B.jsx)(T.Field,{label:"Mobile or phone number (needed)",value:G,onChangeText:K,keyboardType:"phone-pad",placeholder:"e.g. 07700 900123",testID:"nb-phone"}),!me.ok&&G?(0,B.jsx)(T.T,{size:13,colour:j.colours.amber,children:me.error}):null,(0,B.jsx)(T.Field,{label:"Email (optional)",value:X,onChangeText:J,keyboardType:"email-address",autoCapitalize:"none",placeholder:"For an email confirmation too",testID:"nb-email"}),(0,w.emailOk)(X)?null:(0,B.jsx)(T.T,{size:13,colour:j.colours.amber,children:"That email doesn\u2019t look quite right."}),(0,B.jsxs)(b.default,{style:{gap:6,alignItems:'center'},children:[(0,B.jsx)(T.T,{center:!0,children:"Covers"}),(0,B.jsx)(s.PartySizeInput,{value:_,onChange:e=>{Y(e),ye(!1)},label:"Covers",testID:"nb-party"})]}),(0,B.jsx)(T.Row,{wrap:!0,gap:6,children:pe.map(e=>{const t=re&&e.available&&!he(e.time).length||!(0,D.dogTimeOk)(c,F,M,e.time,de);return(0,B.jsx)(T.Chip,{testID:`nb-slot-${e.time}`,label:e.time,sub:(0,v.blockAt)(R,u,M,e.time)?'Paused':t?'Dogs full':e.drinksOnly?'Drinks only':null!=e.partiesLeft&&e.partiesLeft<1||e.left<=0?'Full':`${e.left} left`,disabled:(e.past??!e.available)||t,selected:U===e.time,onPress:()=>{q(e.time),A(!1),ye(!1)}},e.time)})}),we?(0,B.jsxs)(b.default,{testID:"nb-over-capacity",accessible:!0,accessibilityLiveRegion:"polite",style:{borderWidth:1.5,borderColor:j.colours.amber,backgroundColor:j.colours.amberBg,borderRadius:12,padding:10,gap:6},children:[xe?(0,B.jsx)(T.T,{weight:"semibold",colour:j.colours.amber,children:(0,o.overCapacityNote)(_,xe.left,xe.time)}):null,je?(0,B.jsx)(T.T,{weight:"semibold",colour:j.colours.amber,children:(0,o.overPartiesNote)(je.time,je.cap)}):null,(0,B.jsx)(T.Chip,{label:fe?'Booking over the limit: on':'Book anyway (over the limit)',selected:fe,onPress:()=>ye(e=>!e),testID:"nb-over-ok"})]}):null,re&&U?(0,B.jsxs)(b.default,{style:{gap:6},testID:"nb-dog-tables",children:[(0,B.jsxs)(T.T,{size:14,weight:"semibold",children:["Dog-friendly table ",(0,B.jsxs)(T.T,{size:13,colour:j.colours.muted,children:["(",ie.areas.filter(e=>e.dogs).map(e=>e.name).join(' or '),")"]})]}),ge.length?(0,B.jsx)(T.Row,{wrap:!0,gap:6,children:ge.slice(0,10).map((e,t)=>(0,B.jsx)(T.Chip,{label:`${(0,l.tableNumbers)(e.table)}`,sub:`${e.area} \xb7 ${e.seats}${0===t?' \xb7 best':''}${De&&(0,P.accessibleSetUp)(ie)&&!(0,P.isAccessible)(ie,e.table)?' \xb7 not step-free':''}`,selected:(le??ge[0].table)===e.table,onPress:()=>ae(e.table)},e.table))}):(0,B.jsxs)(T.T,{size:14,colour:j.colours.amber,children:["No dog-friendly table free for ",_," at ",U,". Try another time."]})]}):null,Te?(0,B.jsxs)(b.default,{testID:"nb-block-warning",style:{borderWidth:1.5,borderColor:j.colours.amber,backgroundColor:j.colours.amberBg,borderRadius:12,padding:10,gap:6},children:[(0,B.jsxs)(T.T,{weight:"semibold",colour:j.colours.amber,children:["Bookings are paused ",Te.from,"\u2013",Te.to,Te.reason?` (${Te.reason})`:'']}),Se?(0,B.jsx)(T.Chip,{label:W?'Manager override on':'Override and book anyway',selected:W,onPress:()=>A(e=>!e)}):(0,B.jsx)(T.Muted,{children:"Ask a manager to override, or pick another time."})]}):null,pe.length?null:(0,B.jsx)(b.default,{testID:"nb-closed",children:(0,B.jsxs)(T.T,{size:14,weight:"semibold",colour:j.colours.amber,children:["Closed on ",(0,x.niceDate)(ue)," (per the venue\u2019s opening hours). Pick another date."]})}),(0,B.jsx)(D.MoreQuestions,{rid:u,r:c,value:te,onChange:se,party:_,date:M,time:U,today:(0,x.ymd)(h),bookings:F,audience:"staff",showTables:!1!==c.settings.tableRequests}),De&&!(0,P.accessibleSetUp)(ie)?(0,B.jsx)(T.T,{size:13,colour:j.colours.amber,children:"Step-free tables aren\u2019t marked yet (Managers \u203a Booking options \u203a Tables). Check the table works for a wheelchair."}):null,(0,B.jsx)(T.Field,{label:"Notes (optional)",value:Q,onChangeText:V,placeholder:I.NOTES_PLACEHOLDER,multiline:!0,numberOfLines:3,testID:"nb-notes"}),(0,i.depositDue)((0,i.depositOf)(c.settings),_)?(0,B.jsxs)(T.Muted,{children:["Deposit due: ",(0,a.gbp)((0,i.depositDue)((0,i.depositOf)(c.settings),_))," (",(0,a.gbp)((0,i.depositOf)(c.settings).perPersonPence)," per person for ",(0,i.depositOf)(c.settings).fromParty,"+). Deposits are paid through website bookings or to you, never in CoverCharge: tick Deposit paid on the booking once the guest has paid."]}):null,(0,B.jsxs)(T.Muted,{children:["The guest gets a confirmation text",X.trim()?' and email':''," automatically (preview mode: shown in the Outbox, not sent)."]}),ve?(0,B.jsxs)(T.T,{size:14,colour:j.colours.amber,children:["We already have the most dogs we can look after at ",U,". Try another time: dogs are very welcome then."]}):null,(0,B.jsx)(T.Button,{label:oe.length?oe[0]:'Save booking',testID:"nb-save",disabled:!Ce,onPress:()=>{if(M<(0,x.ymd)(h))return;const e=(0,D.needsPatch)(te),s=te.tableReq.find(e=>!re||ge.some(t=>t.table===e));f.repo.bookings.create({restaurantId:u,customerId:null,name:E.trim(),partySize:_,date:M,time:U,notes:Q.trim(),security:(0,i.depositDue)((0,i.depositOf)(c.settings),_)?'deposit':'none',depositPaid:0,...(0,i.depositDue)((0,i.depositOf)(c.settings),_)?{depositDue:(0,i.depositDue)((0,i.depositOf)(c.settings),_),depositPolicy:(0,i.depositWords)((0,i.depositOf)(c.settings),_,c.name).join(' '),depositRefundable:(0,i.depositOf)(c.settings).refundable,depositCutoffHours:(0,i.depositOf)(c.settings).cutoffHours}:{},phone:me.pretty,email:X.trim()||void 0,source:Z,...e,...pe.find(e=>e.time===U)?.drinksOnly?{drinksOnly:!0}:{},allergies:e.allergies??[],...re?{table:le??s??ge[0]?.table}:{}}).then(e=>(0,$.postNewBookingToKitchen)(e,O)).catch(()=>{}),d?.({date:M,time:U,name:E.trim()}),t()}})]})}},1120,[827,1121,1122,860,867,14,1123,34,859,402,102,872,1084,874,1124,1101,858,821,864,794,1025,1022,1125,1126,1131,1103,1097,1132,25]); @@ -1245,7 +1245,7 @@ __d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule' __d(function(g,_r,i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.gamesOn=function(){const e=b.useStore.getState().restaurants.find(e=>e.id===p.VENUE_RID);return!1!==e?.settings?.games},_e.useGameClock=I,_e.usePlayable=function(e,t){return(0,y.gamePlayable)(I(e,t))},Object.defineProperty(_e,"LENNY_GAME_URL",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"validGameUrl",{enumerable:!0,get:function(){return C}}),_e.gameBase=function(){const e=b.useStore.getState().restaurants.find(e=>e.id===p.VENUE_RID);return C(e?.settings?.gameUrl)??v},_e.BreakRoomCard=function({staffId:e,name:t,now:s}){const n=(0,b.useStore)(e=>!1!==e.restaurants.find(e=>e.id===p.VENUE_RID)?.settings?.games),[o,l]=(0,r.useState)(!1),c=I(e,s),u=(0,y.gamePlayable)(c);return n?(0,w.jsxs)(d.Card,{children:[(0,w.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(d.T,{weight:"semibold",children:"\ud83e\uded6 Break room"}),(0,w.jsx)(d.T,{size:13,colour:u?x.colours.ok:x.colours.muted,children:u?'Open':'Locked'})]}),(0,w.jsx)(d.Muted,{children:"Lenny\u2019s Kitchen Chaos, with the team as characters and a shared leaderboard. Playable on a break or when you\u2019re not clocked in."}),u?null:(0,w.jsx)(d.Muted,{testID:"break-room-locked-text",children:y.GAME_LOCKED_TEXT}),(0,w.jsx)(d.Button,{testID:"break-room-open",kind:"secondary",label:"Open the Break room",onPress:()=>l(!0)}),o?(0,w.jsx)(R,{staffId:e,name:t,playable:u,clock:c,onClose:()=>l(!1)}):null]}):null},Object.defineProperty(_e,"displayName",{enumerable:!0,get:function(){return T}}),_e.BreakRoom=R;var t=_r(_d[0]),s=_r(_d[1]),r=_r(_d[2]),n=e(r),o=e(_r(_d[3]));_r(_d[4]);var l=e(_r(_d[5])),c=e(_r(_d[6])),u=_r(_d[7]),d=_r(_d[8]),f=_r(_d[9]),m=_r(_d[10]),y=_r(_d[11]),h=_r(_d[12]),b=_r(_d[13]),p=_r(_d[14]),k=_r(_d[15]),j=_r(_d[16]),x=_r(_d[17]),w=_r(_d[18]);function I(e,t){const s=(0,m.useOwner)(e=>e.attendance);return(0,y.gameClock)(s,e,t)}const v='https://lennys-kitchen-chaos-13e285.deed.page/',C=e=>{try{const t=new URL(String(e??'').trim());return'https:'!==t.protocol||t.username||t.password?null:t.toString()}catch{return null}};function S(e){if('undefined'==typeof window)return null;const t=new URL(e);for(const e of['demo','unlock','name','staffId'])t.searchParams.delete(e);return t.searchParams.set('host','covercharge'),t.searchParams.set('hostOrigin',window.location.origin),{src:t.toString(),origin:t.origin}}const T=e=>String(e??'').replace(/\s*\(.*\)$/,'').replace(/\s+/g,' ').trim().slice(0,24).trim();function R({staffId:e,name:I,playable:R,clock:P,onClose:L,car:M}){const D=(0,m.useOwner)(e=>e.staff),O=(0,f.useAvatars)(e=>e.photos),_=(0,h.useSetup)(e=>e.looks),z=(0,r.useRef)(null),[N,U]=(0,r.useState)({}),[A,B]=(0,r.useState)(!1),[G,q]=(0,r.useState)(null),H=(0,b.useStore)(e=>C(e.restaurants.find(e=>e.id===p.VENUE_RID)?.settings?.gameUrl)??v),V=(0,r.useMemo)(()=>S(H),[H]),W=V?.origin??'',$=(0,j.useSync)(e=>'staff'===e.kind?e.staffRef??null:null),K=!(!$||!e||$===e),X=K?null:$??e??null,Y=T(I),[F,J]=(0,r.useState)(''),[Q,Z]=(0,r.useState)(null),ee=(0,r.useRef)(null),te=(0,r.useRef)(0),se=(0,r.useRef)(null),re=(0,r.useRef)(R);re.current=R;const ne=(0,r.useMemo)(()=>D.filter(e=>e.active&&!e.name.includes('(example)')),[D]);(0,r.useEffect)(()=>{const e=setTimeout(()=>{const e={};for(const s of ne){const r=null!=_[s.id]&&_[s.id]>=1e3?t.AVATAR_OPTIONS.find(e=>e.look===_[s.id]):void 0;if(r){e[s.id]=r.dataUrl;continue}const n=document.getElementById(`cc-av-${s.id}`)?.querySelector('svg');n&&(e[s.id]=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(n.outerHTML.includes('xmlns')?n.outerHTML:n.outerHTML.replace('clearTimeout(e)},[ne,_]);const oe=(0,r.useMemo)(()=>ne.map(e=>{const t=O[e.id]?.dataUrl??N[e.id],s={id:e.id,name:T(e.name),role:e.job||e.level||e.role};return t&&(s.avatarUrl=t),s}),[ne,O,N]),le=(0,r.useCallback)(e=>{try{W&&z.current?.contentWindow?.postMessage(e,W)}catch{}},[W]);return(0,r.useEffect)(()=>{const e=async e=>{if(!W||e.origin!==W||e.source!==z.current?.contentWindow)return;const t=e.data;if('string'!=typeof t?.type||!t.type.startsWith('lenny:'))return;if('lenny:ready'===t.type)return q('string'==typeof t.version?String(t.version).slice(0,12):null),void B(!0);const s=String(t.levelId??'').slice(0,40);if('lenny:scores:list'===t.type&&le({type:'lenny:scores:result',reqId:t.reqId,result:await(0,k.listScores)(s,Math.min(50,Number(t.limit)||10))}),'lenny:scores:submit'===t.type){const e=t.entry??{};if(!X||'string'==typeof e.staffId&&e.staffId!==X)return void le({type:'lenny:scores:result',reqId:t.reqId,result:{rank:null,entries:await(0,k.listScores)(s,10),id:null}});const r='string'==typeof e.characterId?e.characterId.slice(0,80):void 0;le({type:'lenny:scores:result',reqId:t.reqId,result:await(0,k.submitScore)(s,{score:Number(e.score)||0,stars:Number(e.stars)||0,badges:Array.isArray(e.badges)?e.badges.map(String).slice(0,30):[],stats:'object'==typeof e.stats&&e.stats?e.stats:{},characterId:r,character:'string'==typeof e.character?e.character.slice(0,60):void 0,staffId:X,name:Y})})}'lenny:roundAbandoned'===t.type&&J('The last round was stopped because the player changed. No score was saved.'),'lenny:roundStart'===t.type&&J(''),'lenny:progress'===t.type&&X&&t.staffId===X&&(0,k.saveProgress)(X,t.progress),'lenny:gameComplete'===t.type&&X&&t.staffId===X&&J(!0===t.firstTime?'Game complete! Character select is now unlocked.':'Game complete again. Nice work!')};return window.addEventListener('message',e),()=>window.removeEventListener('message',e)},[le,X,Y,W]),(0,r.useEffect)(()=>{B(!1),ee.current=null,se.current=null},[V?.src]),(0,r.useEffect)(()=>{if(!A)return;const e=e=>{se.current!==e&&(se.current=e,le({type:'lenny:setPlayable',playable:e}))},t=K?null:`${X??''}|${Y}`;if(t&&ee.current===t)return void e(R);const s=++te.current;ee.current=null,se.current&&e(!1),t&&(0,k.loadProgress)(X).catch(()=>null).then(r=>{s===te.current&&(le({type:'lenny:setPlayer',name:Y,staffId:X,...r?{progress:r}:{}}),ee.current=t,e(re.current))})},[A,K,X,Y,R,le]),(0,r.useEffect)(()=>{A&&le({type:'lenny:setRoster',staff:oe})},[A,oe,le]),(0,r.useEffect)(()=>{A&&null!==Q&&le({type:'lenny:setMuted',muted:Q})},[A,Q,le]),(0,w.jsx)(o.default,{visible:!0,animationType:"slide",onRequestClose:L,children:(0,w.jsxs)(c.default,{testID:"break-room",style:{flex:1,backgroundColor:(0,s.soutersSurface)('#000')},children:[M?(0,w.jsx)(E,{status:K?'Switching player\u2026':R?'Parked only \xb7 enjoy!':'Game locked',muted:!!Q,onPause:()=>le({type:'lenny:pause'}),onMute:()=>Z(!Q),onClose:L}):(0,w.jsxs)(d.Row,{style:{justifyContent:'space-between',padding:10,backgroundColor:x.colours.bg},children:[(0,w.jsx)(d.T,{weight:"semibold",children:"\ud83e\uded6 Break room"}),(0,w.jsx)(c.default,{testID:R&&!K?'break-playable':'break-locked',accessibilityLabel:G?`Game version ${G}`:void 0,children:(0,w.jsx)(d.T,{size:13,colour:R?x.colours.ok:x.colours.gold,children:K?'Switching player\u2026':R?'off'===P?'Off shift: enjoy!':'On your break: enjoy!':'Game locked'})}),(0,w.jsxs)(d.Row,{gap:4,children:[(0,w.jsx)(l.default,{testID:"break-room-mute",accessibilityRole:"button",accessibilityLabel:Q?'Turn sound and voice on':'Mute sound and voice',onPress:()=>Z(!Q),style:{padding:6},children:(0,w.jsx)(d.T,{weight:"semibold",colour:x.colours.gold,children:Q?'Sound on':'Mute'})}),(0,w.jsx)(l.default,{testID:"break-room-close",accessibilityRole:"button",onPress:L,style:{padding:6},children:(0,w.jsx)(d.T,{weight:"semibold",colour:x.colours.gold,children:"Close"})})]})]}),R||K?null:(0,w.jsx)(c.default,{testID:"break-locked-text",style:{paddingHorizontal:10,paddingVertical:6,backgroundColor:x.colours.surface},children:(0,w.jsx)(d.T,{size:13,colour:x.colours.text,children:y.GAME_LOCKED_TEXT})}),F?(0,w.jsx)(c.default,{testID:"break-notice",style:{paddingHorizontal:10,paddingVertical:6,backgroundColor:x.colours.surface},children:(0,w.jsx)(d.T,{size:13,colour:x.colours.muted,children:F})}):null,V?n.default.createElement('iframe',{ref:z,src:V.src,key:V.src,title:'Lenny\u2019s Kitchen Chaos','data-testid':'break-game',allow:'autoplay; fullscreen',style:{flex:1,width:'100%',height:'100%',border:0,background:'#000'}}):(0,w.jsx)(c.default,{style:{flex:1,alignItems:'center',justifyContent:'center'},children:(0,w.jsx)(d.Muted,{children:"The Break room opens in the web app."})}),(0,w.jsx)(c.default,{style:{position:'absolute',left:-9999,top:0,width:64,height:64,opacity:0},pointerEvents:"none",children:ne.map(e=>(0,w.jsx)(c.default,{nativeID:`cc-av-${e.id}`,children:(0,w.jsx)(u.AvatarLook,{look:_[e.id],id:e.id,name:e.name,size:96})},e.id))})]})})}function E({status:e,muted:t,onPause:s,onMute:r,onClose:n}){const o={minHeight:72,minWidth:150,paddingHorizontal:22,borderRadius:18,borderWidth:1.5,borderColor:x.colours.gold,alignItems:'center',justifyContent:'center'};return(0,w.jsxs)(c.default,{testID:"car-game-bar",style:{flexDirection:'row',alignItems:'center',gap:14,paddingHorizontal:16,paddingVertical:10,backgroundColor:x.colours.bg,borderBottomWidth:1,borderColor:x.colours.border},children:[(0,w.jsx)(l.default,{testID:"break-room-close",accessibilityRole:"button",accessibilityLabel:"Close the game",onPress:n,style:o,children:(0,w.jsx)(d.T,{size:20,weight:"semibold",colour:x.colours.gold,children:"Close"})}),(0,w.jsx)(l.default,{testID:"car-game-pause",accessibilityRole:"button",accessibilityLabel:"Pause the game",onPress:s,style:o,children:(0,w.jsx)(d.T,{size:20,weight:"semibold",colour:x.colours.gold,children:"Pause"})}),(0,w.jsxs)(c.default,{style:{flex:1,alignItems:'center',minWidth:0},children:[(0,w.jsx)(d.T,{size:22,weight:"semibold",center:!0,numberOfLines:1,children:"Lenny\u2019s Kitchen Chaos"}),(0,w.jsx)(d.T,{size:15,colour:x.colours.goldLight,center:!0,numberOfLines:1,children:`${e} \xb7 touch the big buttons on the game`})]}),(0,w.jsx)(l.default,{testID:"break-room-mute",accessibilityRole:"button",accessibilityLabel:t?'Turn sound and voice on':'Mute sound and voice',onPress:r,style:o,children:(0,w.jsx)(d.T,{size:20,weight:"semibold",colour:x.colours.gold,children:t?'Sound on':'Mute'})}),(0,w.jsx)(c.default,{testID:"car-game-parked",style:{...o,minWidth:0,borderColor:x.colours.goldMuted,backgroundColor:'rgba(201,162,74,0.12)'},children:(0,w.jsx)(d.T,{size:16,weight:"semibold",colour:x.colours.goldLight,children:"PARKED ONLY"})})]})}},1162,[928,828,34,395,236,402,102,925,794,926,891,1163,927,831,5,1164,987,821,25]); __d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"GAME_LOCKED_TEXT",{enumerable:!0,get:function(){return t}}),e.gameClock=function(t,n,o){if(!n)return'off';const a=new Date(o).getTime(),c=t.filter(t=>t.staffId===n&&t.in&&!t.out&&a-new Date(t.in).getTime()<72e6).sort((t,n)=>String(n.in).localeCompare(String(t.in)))[0];return c?c.breaks?.some(t=>!t.end)?'break':'working':'off'},Object.defineProperty(e,"gamePlayable",{enumerable:!0,get:function(){return n}});const t='You\u2019re clocked in, so the game is locked. Start your break or clock out in CoverCharge to play.';const n=t=>'working'!==t},1163,[]); __d(function(g,_r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.listScores=o,_e.submitScore=async function(e,t){const f=r.useSync.getState(),l=Math.max(0,Math.round(Number(t.score)||0));if(c()&&f.staffRef&&t.staffId===f.staffRef)try{const{data:r,error:s}=await a().from('game_scores').insert({venue_id:f.venueId,game:'lenny',level_id:e,staff_ref:f.staffRef??null,name:String(t.name||'Crew').replace(/\s+/g,' ').trim().slice(0,24),character_id:t.characterId??null,score:l,stars:Math.max(0,Math.min(3,Number(t.stars)||0)),stats:{...t.stats??{},badges:t.badges??[],character:t.character??null}}).select('id').single();if(s)throw s;const{count:n}=await a().from('game_scores').select('id',{count:'exact',head:!0}).eq('venue_id',f.venueId).eq('game','lenny').eq('level_id',e).gt('score',l);return{rank:(n??0)+1,entries:await o(e,10),id:r.id}}catch{}const u=await s.kv.get(n,{}),y=[...u[e]??[],{...t,score:l,date:(new Date).toISOString()}].sort((e,t)=>t.score-e.score).slice(0,50);return await s.kv.set(n,{...u,[e]:y}),{rank:y.findIndex(e=>e.score===l)+1,entries:y.slice(0,10),id:null}},_e.loadProgress=async function(e){if(!e)return null;const t=r.useSync.getState();if(l(e))try{const{data:r,error:s}=await a().from('game_progress').select('progress').eq('venue_id',t.venueId).eq('game','lenny').eq('staff_ref',e).maybeSingle();if(s)throw s;if(r)return v(r.progress)}catch{}return v((await s.kv.get(f,{}))[e])},Object.defineProperty(_e,"LENNY_LAST_WORLD",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"LENNY_LEVELS",{enumerable:!0,get:function(){return y}}),_e.cleanProgress=v,_e.saveProgress=async function(e,t){const n=v(t);if(!e||!n||JSON.stringify(n).length>16e3)return;const c=await s.kv.get(f,{});await s.kv.set(f,{...c,[e]:n});const o=r.useSync.getState();if(l(e))try{await a().from('game_progress').upsert({venue_id:o.venueId,game:'lenny',staff_ref:e,progress:n,updated_at:(new Date).toISOString()},{onConflict:'venue_id,game,staff_ref'})}catch{}};var e=_r(d[0]),t=_r(d[1]),r=_r(d[2]),s=_r(d[3]);const a=()=>(0,e.getSupabase)(),n='lenny:scores:v1',c=()=>(0,t.isSupabaseConfigured)()&&!!r.useSync.getState().venueId&&'staff'===r.useSync.getState().kind;async function o(e,t=10){if(c())try{const{data:s,error:n}=await a().from('game_scores').select('*').eq('venue_id',r.useSync.getState().venueId).eq('game','lenny').eq('level_id',e).order('score',{ascending:!1}).limit(t);if(n)throw n;return(s??[]).map(e=>({name:e.name,staffId:e.staff_ref,characterId:e.character_id??void 0,character:e.stats?.character,score:e.score,stars:e.stars,badges:e.stats?.badges??[],stats:e.stats,date:e.created_at}))}catch{}return((await s.kv.get(n,{}))[e]??[]).sort((e,t)=>t.score-e.score).slice(0,t)}const f='lenny:progress:v1',l=e=>{const t=r.useSync.getState();return c()&&!!t.staffRef&&e===t.staffRef};const u='festival',y=['mop','dsoap','dish','dtower','dscrub','mussels','ppeel','pfifo','bin1','bin2','bin3','mothersday','bin4','creel1','creel2','dsundae','dplate','pass','rush','delivery','death','line','steak','festival'];function v(e){if(!e||'object'!=typeof e||Array.isArray(e))return null;const t=e,r=e=>('string'==typeof e||'number'==typeof e)&&String(e).length>0&&String(e).length<=60?String(e):null,s={};if(t.stars&&'object'==typeof t.stars&&!Array.isArray(t.stars))for(const[e,a]of Object.entries(t.stars).slice(0,300)){const t=r(e),n=Math.max(0,Math.min(3,Math.floor(Number(a)||0)));t&&(s[t]=n)}const a={},n=t.badges;if(Array.isArray(n))for(const e of n.slice(0,100)){const t=r(e);t&&(a[t]=!0)}else if(n&&'object'==typeof n)for(const[e,t]of Object.entries(n).slice(0,100)){const s=r(e);s&&t&&(a[s]=!0)}const c={stars:s,badges:a,charactersUnlocked:!0===t.charactersUnlocked};return'number'==typeof t.v&&Number.isInteger(t.v)&&t.v>=0&&t.v<=9999&&(c.v=t.v),Array.isArray(t.legacyWorlds)&&t.legacyWorlds.length<=50&&t.legacyWorlds.every(e=>null!==r(e)&&'string'==typeof e)&&(c.legacyWorlds=[...t.legacyWorlds]),c}},1164,[933,976,987,977]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.KitchenRotaEditor=function({today:e=(0,o.ymd)(new Date)}){const $=(0,a.useOwner)(e=>e.staff),j=(0,a.useOwner)(e=>e.shifts),p=(0,t.useMemo)(()=>(0,l.kitchenTeam)($),[$]),k=(0,t.useMemo)(()=>new Set(p.map(e=>e.id)),[p]),[S,I]=(0,t.useState)(0),[w,D]=(0,t.useState)(null),[v,T]=(0,t.useState)(''),H=(0,a.addDays)((0,a.mondayOfDate)(e),7*S),C=(0,a.addDays)(H,6),P=u.map((e,t)=>(0,a.addDays)(H,t)),L=(0,l.kitchenPending)(j,k,H,C).length,M=e=>{T(e),(0,d.announce)(e)},R=0===S?'This week':1===S?'Next week':-1===S?'Last week':`Week of ${b(H)}`;return(0,h.jsxs)(i.default,{testID:"kitchen-rota-editor",style:{gap:10,alignItems:'center'},children:[(0,h.jsx)(n.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Kitchen rota"}),(0,h.jsxs)(n.Row,{gap:8,style:{justifyContent:'center',alignItems:'center'},children:[(0,h.jsx)(n.Button,{small:!0,kind:"ghost",testID:"krota-prev",label:"\u2039 Prev",accessibilityLabel:"Previous week",onPress:()=>{I(S-1),T('')},style:{minWidth:84,minHeight:48}}),(0,h.jsxs)(i.default,{accessible:!0,accessibilityLabel:`${R}, ${f[0]} ${b(H)} to ${f[6]} ${b(C)}`,style:{alignItems:'center',minWidth:120},children:[(0,h.jsx)(n.T,{weight:"semibold",center:!0,children:R}),(0,h.jsxs)(n.Muted,{center:!0,children:[m(H)," \u2013 ",m(C)]})]}),(0,h.jsx)(n.Button,{small:!0,kind:"ghost",testID:"krota-next",label:"Next \u203a",accessibilityLabel:"Next week",onPress:()=>{I(S+1),T('')},style:{minWidth:84,minHeight:48}})]}),p.map(t=>(0,h.jsxs)(i.default,{testID:"krota-row",style:{gap:4,alignItems:'center',alignSelf:'stretch'},children:[(0,h.jsxs)(n.T,{size:14,weight:"semibold",center:!0,children:[y(t.nickname||t.name),t.job?(0,h.jsx)(n.T,{size:12,colour:c.colours.muted,children:` ${t.job}`}):null]}),(0,h.jsx)(n.Row,{gap:4,style:{justifyContent:'center',flexWrap:'nowrap'},children:P.map((i,a)=>{const l=j.find(e=>e.staffId===t.id&&e.date===i),o=!(!l||l.published&&!l.changed),d=`${y(t.nickname||t.name)}, ${f[a]} ${b(i)}, ${l?`${(0,r.fmtH)(l.start)} to ${(0,r.fmtH)(l.end)}${o?', draft, not published yet':''}. Change shift`:'off. Add a shift'}`;return(0,h.jsxs)(s.default,{testID:`krota-cell-${t.id}-${a}`,accessibilityRole:"button",accessibilityLabel:d,onPress:()=>D({staffId:t.id,date:i,shift:l}),style:({pressed:e})=>({width:44,minHeight:52,borderRadius:8,paddingVertical:4,alignItems:'center',justifyContent:'center',borderWidth:1,borderStyle:o?'dashed':'solid',borderColor:l?o?c.colours.amber:c.colours.gold:c.colours.border,backgroundColor:e||l?c.colours.goldTint:c.colours.surface2}),children:[(0,h.jsx)(n.T,{size:10,center:!0,colour:i===e?c.colours.gold:c.colours.muted,children:u[a]}),(0,h.jsx)(n.T,{size:10,center:!0,children:l?`${(0,r.fmtH)(l.start).slice(0,5)}`:'off'}),l?(0,h.jsx)(n.T,{size:10,center:!0,children:(0,r.fmtH)(l.end).slice(0,5)}):(0,h.jsx)(n.T,{size:10,center:!0,colour:c.colours.muted,children:"+"})]},i)})})]},t.id)),p.length?null:(0,h.jsx)(n.Muted,{center:!0,children:"No kitchen team on the staff list yet."}),(0,h.jsx)(n.Button,{testID:"krota-publish",kind:L?'primary':'secondary',disabled:!L,label:L?`Publish kitchen rota (${L} ${1===L?'change':'changes'})`:'Kitchen rota published',accessibilityLabel:L?`Publish the kitchen rota for ${R.toLowerCase()}, ${L} ${1===L?'change':'changes'}`:'Kitchen rota published for this week',onPress:()=>{const e=(0,l.publishKitchen)(a.useOwner.getState().shifts,k,H,C);a.useOwner.getState().setShifts(e.shifts),M(e.n?`Published ${e.n} kitchen ${1===e.n?'shift':'shifts'}. The kitchen team see them in their app now.`:'Nothing new to publish this week.')},style:{minHeight:56,alignSelf:'stretch'}}),v?(0,h.jsx)(i.default,{testID:"krota-msg",children:(0,h.jsx)(n.T,{center:!0,colour:c.colours.goldLight,children:v})}):null,(0,h.jsx)(n.Muted,{center:!0,children:"Tap a day to add or change a shift. Dashed amber = draft, only you see it until you publish. Front of house shifts are made in CoverCharge for Managers."}),w?(0,h.jsx)(x,{init:w,onClose:()=>D(null),onSaid:M}):null]})};var t=_r(_d[0]),s=e(_r(_d[1])),i=e(_r(_d[2])),n=_r(_d[3]),a=_r(_d[4]),l=_r(_d[5]),r=_r(_d[6]),o=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]);const u=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],f=['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'],m=e=>`${e.slice(8,10)}/${e.slice(5,7)}`,b=e=>`${e.slice(8,10)}/${e.slice(5,7)}/${e.slice(0,4)}`,y=e=>e.replace(/\s*\(.*\)$/,''),$=[['Lunch',11,16],['Dinner',16.5,22.5],['Double',11,21],['Close',17,23.5]];function x({init:e,onClose:s,onSaid:d}){const u=(0,a.useOwner)(t=>t.staff.find(t=>t.id===e.staffId)),f=y(u?.nickname||u?.name||''),[m,x]=(0,t.useState)(e.shift?.start??11),[j,p]=(0,t.useState)(e.shift?.end??21),[k,S]=(0,t.useState)(!1),[I,w]=(0,t.useState)(''),D=`${(0,o.niceDate)((0,o.parseYmd)(e.date))} (${b(e.date)})`;return(0,h.jsx)(n.Sheet,{visible:!0,onClose:s,title:`${f} \xb7 ${D}`,testID:"krota-sheet",children:(0,h.jsxs)(i.default,{style:{gap:10,alignItems:'center'},children:[(0,h.jsx)(n.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:$.map(([e,t,s])=>(0,h.jsx)(n.Chip,{testID:`krota-preset-${e.toLowerCase()}`,label:`${e} ${(0,r.fmtH)(t)}\u2013${(0,r.fmtH)(s)}`,selected:m===t&&j===s,onPress:()=>{x(t),p(s)}},e))}),(0,h.jsx)(n.T,{center:!0,children:"Start"}),(0,h.jsx)(n.Stepper,{testID:"krota-start",value:m,step:.5,min:r.SHIFT_MIN_START,max:j-1,onChange:x,format:r.fmtH,label:"Start time"}),(0,h.jsxs)(n.T,{center:!0,children:["End",j>=24?' (next day)':'']}),(0,h.jsx)(n.Stepper,{testID:"krota-end",value:j,step:.5,min:m+1,max:r.SHIFT_MAX_END,onChange:p,format:r.fmtH,label:"End time"}),(0,h.jsxs)(n.Muted,{center:!0,children:[(j-m).toFixed(1)," hours"]}),I?(0,h.jsx)(i.default,{accessibilityLiveRegion:"assertive",children:(0,h.jsx)(n.T,{center:!0,colour:c.colours.amber,children:I})}):null,(0,h.jsx)(n.Button,{testID:"krota-save",label:e.shift?'Save shift':'Add shift',accessibilityLabel:`${e.shift?'Save':'Add'} ${f}'s shift, ${D}, ${(0,r.fmtH)(m)} to ${(0,r.fmtH)(j)}`,onPress:()=>{const t=a.useOwner.getState();(0,l.clashes)(t.shifts,e.staffId,e.date,m,j,e.shift?.id)?w(`${f} already has a shift that overlaps on ${D}.`):(e.shift?t.setShifts(t.shifts.map(t=>t.id===e.shift.id?{...t,start:m,end:j,changed:!!t.published||t.changed}:t)):t.addShift({staffId:e.staffId,date:e.date,start:m,end:j}),d(`${e.shift?'Changed':'Added'}: ${f}, ${D}, ${(0,r.fmtH)(m)} to ${(0,r.fmtH)(j)}. Draft until you publish the kitchen rota.`),s())},style:{minHeight:56,alignSelf:'stretch'}}),e.shift&&!k?(0,h.jsx)(n.Button,{testID:"krota-remove",kind:"danger",label:"Remove shift",onPress:()=>S(!0),style:{minHeight:52,alignSelf:'stretch'}}):null,e.shift&&k?(0,h.jsxs)(i.default,{testID:"krota-remove-ask",accessibilityLiveRegion:"assertive",style:{gap:8,alignItems:'center',alignSelf:'stretch'},children:[(0,h.jsxs)(n.T,{center:!0,weight:"semibold",children:["Remove ",f,"\u2019s shift on ",D,"?"]}),(0,h.jsx)(n.Button,{testID:"krota-remove-yes",kind:"danger",label:"Yes, remove it",onPress:()=>{a.useOwner.getState().removeShift(e.shift.id),d(`Removed ${f}'s shift on ${D}.`),s()},style:{minHeight:52,alignSelf:'stretch'}}),(0,h.jsx)(n.Button,{testID:"krota-remove-no",kind:"secondary",label:"No, keep it",onPress:()=>S(!1),style:{minHeight:52,alignSelf:'stretch'}})]}):null]})})}},1165,[34,402,102,794,891,988,1087,858,1166,821,25]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.KitchenRotaEditor=p,_e.KitchenRotaTab=function({today:e=(0,h.ymd)(new Date)}){const t=(0,r.canEditKitchenRota)((0,d.useSync)(e=>e.perms));return(0,m.jsx)(i.default,{testID:"chef-rota-tab",style:{alignSelf:'stretch',alignItems:'center'},children:t?(0,m.jsx)(p,{today:e}):(0,m.jsx)(w,{today:e})})},_e.KitchenRotaRead=w;var t=_r(_d[0]),s=e(_r(_d[1])),i=e(_r(_d[2])),n=_r(_d[3]),a=_r(_d[4]),r=_r(_d[5]),l=_r(_d[6]),o=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]),u=_r(_d[11]),f=_r(_d[12]),m=_r(_d[13]);const y=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],b=['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'],x=e=>`${e.slice(8,10)}/${e.slice(5,7)}`,j=e=>`${e.slice(8,10)}/${e.slice(5,7)}/${e.slice(0,4)}`,$=e=>e.replace(/\s*\(.*\)$/,''),k=[['Lunch',11,16],['Dinner',16.5,22.5],['Double',11,21],['Close',17,23.5]];function p({today:e=(0,h.ymd)(new Date)}){const l=(0,a.useOwner)(e=>e.staff),o=(0,a.useOwner)(e=>e.shifts),d=(0,t.useMemo)(()=>(0,r.kitchenTeam)(l),[l]),k=(0,t.useMemo)(()=>new Set(d.map(e=>e.id)),[d]),[p,w]=(0,t.useState)(0),[I,D]=(0,t.useState)(null),[T,v]=(0,t.useState)(''),H=(0,a.addDays)((0,a.mondayOfDate)(e),7*p),C=(0,a.addDays)(H,6),L=y.map((e,t)=>(0,a.addDays)(H,t)),P=(0,r.kitchenPending)(o,k,H,C).length,R=e=>{v(e),(0,u.announce)(e)},M=0===p?'This week':1===p?'Next week':-1===p?'Last week':`Week of ${j(H)}`;return(0,m.jsxs)(i.default,{testID:"kitchen-rota-editor",style:{gap:10,alignItems:'center'},children:[(0,m.jsx)(n.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Kitchen rota"}),(0,m.jsxs)(n.Row,{gap:8,style:{justifyContent:'center',alignItems:'center'},children:[(0,m.jsx)(n.Button,{small:!0,kind:"ghost",testID:"krota-prev",label:"\u2039 Prev",accessibilityLabel:"Previous week",onPress:()=>{w(p-1),v('')},style:{minWidth:84,minHeight:48}}),(0,m.jsxs)(i.default,{accessible:!0,accessibilityLabel:`${M}, ${b[0]} ${j(H)} to ${b[6]} ${j(C)}`,style:{alignItems:'center',minWidth:120},children:[(0,m.jsx)(n.T,{weight:"semibold",center:!0,children:M}),(0,m.jsxs)(n.Muted,{center:!0,children:[x(H)," \u2013 ",x(C)]})]}),(0,m.jsx)(n.Button,{small:!0,kind:"ghost",testID:"krota-next",label:"Next \u203a",accessibilityLabel:"Next week",onPress:()=>{w(p+1),v('')},style:{minWidth:84,minHeight:48}})]}),d.map(t=>(0,m.jsxs)(i.default,{testID:"krota-row",style:{gap:4,alignItems:'center',alignSelf:'stretch'},children:[(0,m.jsxs)(n.T,{size:14,weight:"semibold",center:!0,children:[$(t.nickname||t.name),t.job?(0,m.jsx)(n.T,{size:12,colour:f.colours.muted,children:` ${t.job}`}):null]}),(0,m.jsx)(n.Row,{gap:4,style:{justifyContent:'center',flexWrap:'nowrap'},children:L.map((i,a)=>{const r=o.find(e=>e.staffId===t.id&&e.date===i),l=!(!r||r.published&&!r.changed),d=`${$(t.nickname||t.name)}, ${b[a]} ${j(i)}, ${r?`${(0,c.fmtH)(r.start)} to ${(0,c.fmtH)(r.end)}${l?', draft, not published yet':''}. Change shift`:'off. Add a shift'}`;return(0,m.jsxs)(s.default,{testID:`krota-cell-${t.id}-${a}`,accessibilityRole:"button",accessibilityLabel:d,onPress:()=>D({staffId:t.id,date:i,shift:r}),style:({pressed:e})=>({width:44,minHeight:52,borderRadius:8,paddingVertical:4,alignItems:'center',justifyContent:'center',borderWidth:1,borderStyle:l?'dashed':'solid',borderColor:r?l?f.colours.amber:f.colours.gold:f.colours.border,backgroundColor:e||r?f.colours.goldTint:f.colours.surface2}),children:[(0,m.jsx)(n.T,{size:10,center:!0,colour:i===e?f.colours.gold:f.colours.muted,children:y[a]}),(0,m.jsx)(n.T,{size:10,center:!0,children:r?`${(0,c.fmtH)(r.start).slice(0,5)}`:'off'}),r?(0,m.jsx)(n.T,{size:10,center:!0,children:(0,c.fmtH)(r.end).slice(0,5)}):(0,m.jsx)(n.T,{size:10,center:!0,colour:f.colours.muted,children:"+"})]},i)})})]},t.id)),d.length?null:(0,m.jsx)(n.Muted,{center:!0,children:"No kitchen team on the staff list yet."}),(0,m.jsx)(n.Button,{testID:"krota-publish",kind:P?'primary':'secondary',disabled:!P,label:P?`Publish kitchen rota (${P} ${1===P?'change':'changes'})`:'Kitchen rota published',accessibilityLabel:P?`Publish the kitchen rota for ${M.toLowerCase()}, ${P} ${1===P?'change':'changes'}`:'Kitchen rota published for this week',onPress:()=>{const e=(0,r.publishKitchen)(a.useOwner.getState().shifts,k,H,C);a.useOwner.getState().setShifts(e.shifts),R(e.n?`Published ${e.n} kitchen ${1===e.n?'shift':'shifts'}. The kitchen team see them in their app now.`:'Nothing new to publish this week.')},style:{minHeight:56,alignSelf:'stretch'}}),T?(0,m.jsx)(i.default,{testID:"krota-msg",children:(0,m.jsx)(n.T,{center:!0,colour:f.colours.goldLight,children:T})}):null,(0,m.jsx)(n.Muted,{center:!0,children:"Tap a day to add or change a shift. Dashed amber = draft, only you see it until you publish. Front of house shifts are made in CoverCharge for Managers."}),I?(0,m.jsx)(S,{init:I,onClose:()=>D(null),onSaid:R}):null]})}function w({today:e=(0,h.ymd)(new Date)}){const{staff:s,shifts:r}=(0,o.rotaView)('chef',(0,a.useOwner)(e=>e.staff),(0,a.useOwner)(e=>e.shifts)),d=(0,a.useOwner)(e=>e.leave),[u,k]=(0,t.useState)(0),p=(0,a.addDays)((0,a.mondayOfDate)(e),7*u),w=(0,a.addDays)(p,6),S=y.map((e,t)=>(0,a.addDays)(p,t)),I=s.filter(e=>/kitchen|chef|kp/i.test(`${e.job??''} ${e.name}`)),D=0===u?'This week':1===u?'Next week':-1===u?'Last week':`Week of ${j(p)}`,[T,v]=(0,t.useState)(0),H=T?Math.max(30,Math.min(44,Math.floor((T-12)/7))):40;return(0,m.jsxs)(i.default,{testID:"kitchen-rota-read",onLayout:e=>v(e.nativeEvent.layout.width),style:{gap:10,alignItems:'center',alignSelf:'stretch'},children:[(0,m.jsx)(n.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Kitchen rota"}),(0,m.jsxs)(n.Row,{gap:8,style:{justifyContent:'center',alignItems:'center'},children:[(0,m.jsx)(n.Button,{small:!0,kind:"ghost",testID:"krota-read-prev",label:"\u2039 Prev",accessibilityLabel:"Previous week",onPress:()=>k(u-1),style:{minWidth:84,minHeight:48}}),(0,m.jsxs)(i.default,{accessible:!0,accessibilityLabel:`${D}, ${b[0]} ${j(p)} to ${b[6]} ${j(w)}`,style:{alignItems:'center',minWidth:120},children:[(0,m.jsx)(n.T,{weight:"semibold",center:!0,children:D}),(0,m.jsxs)(n.Muted,{center:!0,children:[x(p)," \u2013 ",x(w)]})]}),(0,m.jsx)(n.Button,{small:!0,kind:"ghost",testID:"krota-read-next",label:"Next \u203a",accessibilityLabel:"Next week",onPress:()=>k(u+1),style:{minWidth:84,minHeight:48}})]}),I.map(t=>(0,m.jsxs)(i.default,{testID:"krota-read-row",style:{gap:4,alignItems:'center',alignSelf:'stretch'},children:[(0,m.jsx)(n.T,{size:14,weight:"semibold",center:!0,children:$(t.nickname||t.name)}),(0,m.jsx)(n.Row,{gap:2,style:{justifyContent:'center',flexWrap:'nowrap'},children:S.map((s,a)=>{const o=r.find(e=>e.staffId===t.id&&e.date===s),h=o?(0,l.leaveCovering)(d,t.id,s):void 0,u=o?h?(0,l.leaveLabel)(h):`${(0,c.fmtH)(o.start)} to ${(0,c.fmtH)(o.end)}`:'off';return(0,m.jsxs)(i.default,{testID:`krota-read-cell-${t.id}-${a}`,accessible:!0,accessibilityLabel:`${$(t.nickname||t.name)}, ${b[a]} ${j(s)}, ${u}`,style:{width:H,minHeight:52,borderRadius:8,paddingVertical:4,paddingHorizontal:0,alignItems:'center',justifyContent:'center',borderWidth:1,borderColor:o?f.colours.gold:f.colours.border,backgroundColor:o?f.colours.goldTint:f.colours.surface2},children:[(0,m.jsx)(n.T,{size:10,center:!0,colour:s===e?f.colours.gold:f.colours.muted,children:y[a]}),o&&h?(0,m.jsx)(n.T,{size:9,center:!0,colour:f.colours.blue,children:(0,l.leaveLabel)(h).toLowerCase()}):(0,m.jsx)(n.T,{size:10,center:!0,children:o?(0,c.fmtH)(o.start).slice(0,5):'off'}),o&&!h?(0,m.jsx)(n.T,{size:10,center:!0,children:(0,c.fmtH)(o.end).slice(0,5)}):null]},s)})})]},t.id)),I.length?null:(0,m.jsx)(n.Muted,{center:!0,children:"No kitchen shifts on the rota yet."}),(0,m.jsx)(n.Muted,{center:!0,children:"This shows published shifts only. To change the kitchen rota here, an owner can tick \u201cMake the kitchen rota\u201d for you on the Permissions screen."})]})}function S({init:e,onClose:s,onSaid:l}){const o=(0,a.useOwner)(t=>t.staff.find(t=>t.id===e.staffId)),d=$(o?.nickname||o?.name||''),[u,y]=(0,t.useState)(e.shift?.start??11),[b,x]=(0,t.useState)(e.shift?.end??21),[p,w]=(0,t.useState)(!1),[S,I]=(0,t.useState)(''),D=`${(0,h.niceDate)((0,h.parseYmd)(e.date))} (${j(e.date)})`;return(0,m.jsx)(n.Sheet,{visible:!0,onClose:s,title:`${d} \xb7 ${D}`,testID:"krota-sheet",children:(0,m.jsxs)(i.default,{style:{gap:10,alignItems:'center'},children:[(0,m.jsx)(n.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:k.map(([e,t,s])=>(0,m.jsx)(n.Chip,{testID:`krota-preset-${e.toLowerCase()}`,label:`${e} ${(0,c.fmtH)(t)}\u2013${(0,c.fmtH)(s)}`,selected:u===t&&b===s,onPress:()=>{y(t),x(s)}},e))}),(0,m.jsx)(n.T,{center:!0,children:"Start"}),(0,m.jsx)(n.Stepper,{testID:"krota-start",value:u,step:.5,min:c.SHIFT_MIN_START,max:b-1,onChange:y,format:c.fmtH,label:"Start time"}),(0,m.jsxs)(n.T,{center:!0,children:["End",b>=24?' (next day)':'']}),(0,m.jsx)(n.Stepper,{testID:"krota-end",value:b,step:.5,min:u+1,max:c.SHIFT_MAX_END,onChange:x,format:c.fmtH,label:"End time"}),(0,m.jsxs)(n.Muted,{center:!0,children:[(b-u).toFixed(1)," hours"]}),S?(0,m.jsx)(i.default,{accessibilityLiveRegion:"assertive",children:(0,m.jsx)(n.T,{center:!0,colour:f.colours.amber,children:S})}):null,(0,m.jsx)(n.Button,{testID:"krota-save",label:e.shift?'Save shift':'Add shift',accessibilityLabel:`${e.shift?'Save':'Add'} ${d}'s shift, ${D}, ${(0,c.fmtH)(u)} to ${(0,c.fmtH)(b)}`,onPress:()=>{const t=a.useOwner.getState();(0,r.clashes)(t.shifts,e.staffId,e.date,u,b,e.shift?.id)?I(`${d} already has a shift that overlaps on ${D}.`):(e.shift?t.setShifts(t.shifts.map(t=>t.id===e.shift.id?{...t,start:u,end:b,changed:!!t.published||t.changed}:t)):t.addShift({staffId:e.staffId,date:e.date,start:u,end:b}),l(`${e.shift?'Changed':'Added'}: ${d}, ${D}, ${(0,c.fmtH)(u)} to ${(0,c.fmtH)(b)}. Draft until you publish the kitchen rota.`),s())},style:{minHeight:56,alignSelf:'stretch'}}),e.shift&&!p?(0,m.jsx)(n.Button,{testID:"krota-remove",kind:"danger",label:"Remove shift",onPress:()=>w(!0),style:{minHeight:52,alignSelf:'stretch'}}):null,e.shift&&p?(0,m.jsxs)(i.default,{testID:"krota-remove-ask",accessibilityLiveRegion:"assertive",style:{gap:8,alignItems:'center',alignSelf:'stretch'},children:[(0,m.jsxs)(n.T,{center:!0,weight:"semibold",children:["Remove ",d,"\u2019s shift on ",D,"?"]}),(0,m.jsx)(n.Button,{testID:"krota-remove-yes",kind:"danger",label:"Yes, remove it",onPress:()=>{a.useOwner.getState().removeShift(e.shift.id),l(`Removed ${d}'s shift on ${D}.`),s()},style:{minHeight:52,alignSelf:'stretch'}}),(0,m.jsx)(n.Button,{testID:"krota-remove-no",kind:"secondary",label:"No, keep it",onPress:()=>w(!1),style:{minHeight:52,alignSelf:'stretch'}})]}):null]})})}},1165,[34,402,102,794,891,988,1094,993,987,1087,858,1166,821,25]); __d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.primeAnnouncer=function(){u()},_e.announce=function(t){const e=String(t??'').trim();if(!e)return;{const t=u();if(!t)return;const n=++o;return t.textContent='',void setTimeout(()=>{n===o&&(t.textContent=e)},80)}},Object.defineProperty(_e,"lastAnnounced",{enumerable:!0,get:function(){return c}});var t,e=r(d[0]);(t=e)&&t.__esModule;r(d[1]);let n=null,o=0;function u(){if('undefined'==typeof document||!document.body)return null;if(n&&document.body.contains(n))return n;const t=document.createElement('div');return t.id='cc-announcer',t.setAttribute('aria-live','assertive'),t.setAttribute('aria-atomic','true'),t.setAttribute('role','status'),t.setAttribute('data-testid','cc-announcer'),Object.assign(t.style,{position:'absolute',width:'1px',height:'1px',margin:'-1px',padding:'0',overflow:'hidden',clip:'rect(0 0 0 0)',whiteSpace:'nowrap',border:'0'}),document.body.appendChild(t),n=t,t}const c=()=>n?.textContent??''},1166,[281,236]); __d(function(g,r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useSuggestions=j,_e.OrdersScreen=function({focus:e}={}){const[s,t]=(0,n.useState)('sheets');return(0,x.jsxs)(l.default,{style:{gap:12},children:[(0,x.jsx)(y.Seg,{value:s,onChange:t,options:[{id:'sheets',label:'Order sheets'},{id:'suggested',label:'Suggested orders'},{id:'history',label:'Order history'}]}),'sheets'===s?(0,x.jsx)(m.OrderSheets,{focus:e}):'suggested'===s?(0,x.jsx)(w,{}):(0,x.jsx)($,{})]})};var s=r(_d[0]),t=r(_d[1]),n=r(_d[2]),i=e(r(_d[3])),l=e(r(_d[4])),d=r(_d[5]),o=r(_d[6]),u=r(_d[7]),c=r(_d[8]),h=r(_d[9]),p=r(_d[10]),y=r(_d[11]),f=r(_d[12]),m=r(_d[13]),x=r(_d[14]);const b=(e,s)=>'kg'===s?Math.ceil(2*e)/2:Math.ceil(e);function j(){const{k:e,now:s,rid:n}=(0,y.useChef)(6e4),{pct:i}=(0,y.useForecast)(),l=(0,u.supplierView)('chef',(0,o.useOwner)(e=>e.suppliers)).filter(e=>!e.archived),d=1+Math.max(0,i)/100;return l.map(i=>{const l=e.ingredients.filter(e=>e.supplierId===i.id).map(e=>({i:e,qty:(0,t.fishInStone)(n,e)?(0,t.fromStone)(Math.ceil(2*(0,t.toStone)(Math.max(0,e.par*d-e.onHand),e.unit))/2,e.unit):b(Math.max(0,e.par*d-e.onHand),e.unit)})).filter(e=>e.qty>0),o=(0,p.weekday)(s),u=i.orderDays.includes(o),[c,h]=(i.cutoff||'23:59').split(':').map(Number),y=new Date(s);y.setHours(c,h,0,0);const f=e.orders.some(e=>e.supplierId===i.id&&new Date(e.at).toDateString()===s.toDateString()),m=[1,2,3,4,5,6,7].map(e=>(o+e)%7).find(e=>i.orderDays.includes(e));return{s:i,lines:l,ordersToday:u,cutPassed:s>y,placedToday:f,nextDay:m,total:Math.round(l.reduce((e,s)=>e+s.qty*s.i.cost,0))}}).filter(e=>e.lines.length||e.ordersToday)}function w(){const{me:e,rid:o}=(0,y.useChef)(),{label:u,covers:m,enough:b,booked:w}=(0,y.useForecast)(),$=(0,f.useKitchen)(e=>e.addOrder),S=j(),[C,M]=(0,n.useState)({}),[O,k]=(0,n.useState)('');return(0,x.jsxs)(l.default,{style:{gap:10},children:[(0,x.jsxs)(d.Muted,{children:[b?`Built from par levels and today's forecast (${m} Covers, ${u} vs a typical day).`:`Built from par levels (no forecast yet: not enough history; ${w} Covers booked so far).`," Adjust, then call the supplier or use their ordering website. Nothing is sent by CoverCharge."]}),O?(0,x.jsx)(d.Banner,{kind:"success",title:"Saved to order history",children:O}):null,S.map(({s:n,lines:u,ordersToday:y,cutPassed:f,placedToday:m,nextDay:b,total:j})=>{const w=u.map(e=>({...e,q:C[`${n.id}:${e.i.id}`]??e.qty})),S=Math.round(w.reduce((e,s)=>e+s.q*s.i.cost,0)),O=s=>{$({supplierId:n.id,by:e,status:s,lines:w.filter(e=>e.q>0).map(e=>({ing:e.i.id,qty:e.q,cost:e.i.cost})),total:S}),k(`${n.name}: ${(0,c.gbp)(S)} (${s}).`)};return(0,x.jsxs)(d.Card,{highlight:!y||m||f?void 0:h.colours.gold,children:[(0,x.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsxs)(l.default,{style:{flex:1},children:[(0,x.jsx)(d.T,{weight:"semibold",children:n.name}),(0,x.jsxs)(d.Muted,{children:[n.category," \xb7 min order ",(0,c.gbp)(n.minOrder)]})]}),m?(0,x.jsx)(d.Badge,{kind:"ok",label:"ORDERED TODAY"}):y?(0,x.jsx)(d.Badge,{kind:f?'red':'amber',label:f?`CUT-OFF ${n.cutoff} PASSED`:`ORDER BY ${n.cutoff}`}):(0,x.jsx)(d.Badge,{label:`NEXT ${null!=b?p.DAY3[b].toUpperCase():'\u2014'}`})]}),w.length?w.map(e=>(0,x.jsxs)(d.Row,{wrap:!0,style:{justifyContent:'space-between'},children:[(0,x.jsxs)(l.default,{style:{flex:1},children:[(0,x.jsx)(d.T,{size:14,children:e.i.name}),(0,x.jsxs)(d.Muted,{children:["On hand ",(0,s.ingredientQty)(o,e.i,e.i.onHand)," \xb7 par ",(0,s.ingredientQty)(o,e.i,e.i.par)]})]}),(0,x.jsx)(d.Button,{small:!0,kind:"ghost",label:"Less",accessibilityLabel:`${(0,t.fishInStone)(o,e.i)?'Half a stone less':'Less'} ${e.i.name}`,onPress:()=>M(s=>({...s,[`${n.id}:${e.i.id}`]:(0,t.stepQuantity)(o,e.i,e.q,-1)}))}),(0,x.jsx)(l.default,{accessible:!0,accessibilityLabel:(0,s.ingredientSpeech)(o,e.i,e.q),children:(0,x.jsx)(d.T,{size:16,style:{minWidth:76,textAlign:'center'},children:(0,s.ingredientQty)(o,e.i,e.q)})}),(0,x.jsx)(d.Button,{small:!0,kind:"ghost",label:"More",accessibilityLabel:`${(0,t.fishInStone)(o,e.i)?'Half a stone more':'More'} ${e.i.name}`,onPress:()=>M(s=>({...s,[`${n.id}:${e.i.id}`]:(0,t.stepQuantity)(o,e.i,e.q,1)}))})]},e.i.id)):(0,x.jsx)(d.Muted,{children:"Everything is at par."}),w.length?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsxs)(d.T,{weight:"semibold",children:["Estimated ",(0,c.gbp)(S)]}),S{i.default.openURL(`tel:${n.phones[0].replace(/\s/g,'')}`).catch(()=>{}),O('placed (by phone)')}}):null,n.website?(0,x.jsx)(d.Button,{small:!0,kind:"secondary",label:"Open website",onPress:()=>{i.default.openURL(n.website).catch(()=>{}),O('placed (on website)')}}):null]})]}):null,void 0]},n.id)})]})}function $(){const{k:e,rid:t}=(0,y.useChef)(),n=(0,o.useOwner)(e=>e.suppliers);return(0,x.jsx)(l.default,{style:{gap:8},children:e.orders.map(i=>(0,x.jsxs)(d.Card,{children:[(0,x.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(d.T,{weight:"semibold",style:{flex:1},children:n.find(e=>e.id===i.supplierId)?.name}),(0,x.jsx)(d.Badge,{kind:"neutral",label:i.status.toUpperCase()})]}),(0,x.jsxs)(d.Muted,{children:[new Date(i.at).toLocaleString('en-GB',{weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})," \xb7 ",i.by,i.total?` \xb7 ${(0,c.gbp)(i.total)}`:'']}),i.lines.length?(0,x.jsx)(d.Muted,{children:i.lines.map(n=>{const i=e.ingredients.find(e=>e.id===n.ing);return`${(0,s.ingredientQty)(t,i??{name:n.ing,unit:''},n.qty)} ${i?.name??n.ing}`}).join(', ')}):null]},i.id))})}},1167,[1153,984,34,379,102,794,891,993,867,821,1084,1145,1029,1168,25]); __d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.openLink=j,_e.useSheetReminders=T,_e.OrderSheets=function({focus:e}){const{rid:t,now:l}=(0,x.useChef)(3e4),o=(0,u.useSheets)(t).filter(e=>(0,n.chefCanSee)(t,e)&&!e.placeholder),[h,c]=(0,s.useState)(e??null),p=T(),f=(0,b.wd)(l);return(0,y.jsxs)(d.default,{style:{gap:10},testID:"order-sheets",children:[(0,y.jsx)(i.Banner,{kind:"info",title:"Nothing is sent for you",children:"Text, WhatsApp and phone orders open your phone\u2019s own app with the order already written. Check it, then press Send yourself."}),p.map(e=>(0,y.jsx)(r.default,{accessibilityRole:"button",onPress:()=>c(e.supplierId),children:(0,y.jsxs)(i.Banner,{kind:'red'===e.tone?'danger':'warn',title:`\u23f0 ${e.text}`,children:["Tap to open the ",e.name," order sheet."]})},e.supplierId)),(0,y.jsxs)(i.Muted,{children:["Today is ",b.DAYS[f],". Edit suppliers in Managers \u203a Settings \u203a Supplier order sheets."]}),o.map(e=>(0,y.jsx)(C,{s:e,open:h===e.id,onToggle:()=>c(h===e.id?null:e.id)},e.id)),o.length?null:(0,y.jsx)(i.Muted,{children:"No order sheets yet. Add suppliers in Managers \u203a Settings \u203a Supplier order sheets."})]})};var t=_r(_d[0]),n=_r(_d[1]),l=_r(_d[2]),s=_r(_d[3]),o=e(_r(_d[4]));_r(_d[5]);var r=e(_r(_d[6])),d=e(_r(_d[7])),i=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),c=_r(_d[11]),p=_r(_d[12]),b=_r(_d[13]),f=_r(_d[14]),x=_r(_d[15]),y=_r(_d[16]);function j(e){if('undefined'!=typeof window){const t=window;return'function'==typeof t.__ccOpenLink?void t.__ccOpenLink(e):void(/^https?:/.test(e)?window.open(e,'_blank','noopener'):window.location.href=e)}o.default.openURL(e).catch(()=>{})}async function w(e){try{const t='undefined'!=typeof navigator?navigator:null;if(t?.clipboard?.writeText)return await t.clipboard.writeText(e),!0}catch{}return!1}const k={online:'\ud83c\udf10',phone:'\ud83d\udcde',text:'\ud83d\udcac',whatsapp:'\u2706',tbc:'\ud83d\udd8a\ufe0f'},S={borderWidth:1,borderColor:f.colours.border,borderRadius:10,paddingHorizontal:12,paddingVertical:10,color:f.colours.text,backgroundColor:f.colours.surface2,fontSize:f.font.body};function T(){const{rid:e,now:t}=(0,x.useChef)(6e4),l=(0,u.useSheets)(e).filter(t=>(0,n.chefCanSee)(e,t)&&!t.placeholder),s=(0,u.useOrderSheets)(e=>e.opened),o=(0,h.useShellfish)(e,'','chef'),r=(0,b.remindersFor)(l,t,s);for(const n of l){const l=o.items.filter(e=>(e.supplierId===n.id||!e.supplierId&&n.shellfish)&&o.isLow(e.key));!l.length||s[n.id]&&new Date(s[n.id]).toDateString()===t.toDateString()||r.push({supplierId:n.id,name:n.name,text:`${'text'===n.method||'whatsapp'===n.method?'Text':'Order from'} ${n.contact||n.name}: ${l.map(t=>`${(0,c.fmtStockCount)(e,t,o.counts[t.key]??0)} ${t.plural.toLowerCase()}`).join(' and ')} left`,tone:'amber',cutoffPassed:!1})}return r}function C({s:e,open:n,onToggle:o}){const{rid:T,r:C,me:$,now:D}=(0,x.useChef)(3e4),v=(0,u.useOrderSheets)(e=>e.patch),I=(0,u.useOrderSheets)(e=>e.markOpened),M=(0,u.useOrderSheets)(t=>t.opened[e.id]),[B,L]=(0,s.useState)({}),[P,O]=(0,s.useState)(''),[R,A]=(0,s.useState)(''),[z,_]=(0,s.useState)(!1),W=(0,h.useShellfish)(T,$,'chef'),H=(0,b.nextDelivery)(e,D),K=(0,b.orderLines)(e,B,P,T),E=(C.address??C.location??'').split(',').map(e=>e.trim()).filter(Boolean),q=E.length>=3?E[1]:E[0]??'',N=(0,b.orderMessage)(e,C.name,q,K,$.split(' ')[0],D),U=e.orderDays.includes((0,b.wd)(D)),Q=(e,t)=>L(n=>({...n,[e.id]:(0,l.stepQuantity)(T,e,n[e.id]||0,t)})),Y=t=>{I(e.id,D.toISOString()),j(t)},F='text'===e.method||'whatsapp'===e.method||'phone'===e.method,G=Math.round(100*parseFloat(R.replace(/[\xa3,]/g,''))),V=W.items.filter(t=>t.supplierId===e.id||!t.supplierId&&e.shellfish),J=V.filter(e=>W.isLow(e.key));return(0,y.jsxs)(d.default,{testID:`sheet-${e.id}`,style:{borderRadius:14,borderWidth:1.5,borderColor:U||J.length?f.colours.amber:n?f.colours.gold:f.colours.border,backgroundColor:f.colours.surface,overflow:'hidden'},children:[(0,y.jsxs)(r.default,{accessibilityRole:"button",accessibilityLabel:`${e.name} order sheet`,onPress:o,style:{padding:12,gap:4},children:[(0,y.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsxs)(i.T,{weight:"semibold",size:f.font.large,style:{flex:1},children:[k[e.method]," ",e.name]}),(0,y.jsx)(i.Badge,{kind:e.placeholder?'amber':'gold',label:e.placeholder?'To fill in':b.METHOD_LABEL[e.method]})]}),(0,y.jsx)(i.Muted,{children:e.goods}),(0,y.jsxs)(i.Row,{wrap:!0,gap:6,children:[e.deliveryDays.length?(0,y.jsx)(i.Badge,{kind:"neutral",label:`Delivers ${(0,b.dayRange)(e.deliveryDays)}`}):null,e.orderDays.length?(0,y.jsx)(i.Badge,{kind:U?'amber':'neutral',label:`Order ${(0,b.dayRange)(e.orderDays)}${e.cutoff?` by ${e.cutoff}`:''}`}):null,e.frequency?(0,y.jsx)(i.Badge,{kind:"neutral",label:e.frequency}):null,e.priceCapPerKg?(0,y.jsx)(i.Badge,{kind:"blue",label:`Cap ${(0,p.gbp)(e.priceCapPerKg)}/kg`}):null,V.length?(0,y.jsx)(i.Badge,{kind:J.length?'amber':'ok',label:V.map(e=>`${e.icon} ${(0,c.fmtStockCount)(T,e,W.counts[e.key]??0)}`).join(' \xb7 ')}):null,M&&new Date(M).toDateString()===D.toDateString()?(0,y.jsx)(i.Badge,{kind:"ok",label:"Opened today \u2713"}):null]})]}),n?(0,y.jsxs)(d.default,{style:{padding:12,paddingTop:0,gap:10},children:[H?(0,y.jsxs)(i.Muted,{children:["Next delivery if you order now: ",(0,b.niceDay)(H),"."]}):null,e.reminder?(0,y.jsxs)(i.Muted,{children:["Reminder on ",e.orderDays.map(e=>b.DAYS[e]).join(', '),": ",e.reminder]}):null,e.notes?(0,y.jsx)(i.T,{size:f.font.small,colour:f.colours.muted,children:e.notes}):null,e.placeholder?(0,y.jsx)(i.Banner,{kind:"warn",title:"Still to be set up",children:"Add the supplier, how to order and delivery days in Managers \u203a Settings \u203a Supplier order sheets."}):null,e.items.map(e=>(0,y.jsxs)(d.default,{style:{gap:6},children:[(0,y.jsxs)(i.T,{children:[e.name,e.unit?(0,y.jsxs)(i.T,{size:f.font.small,colour:f.colours.muted,children:[" (",(0,l.quantityUnit)(T,e),")"]}):null]}),(0,y.jsxs)(i.Row,{wrap:!0,gap:8,style:{justifyContent:'space-between'},children:[(0,y.jsx)(i.Button,{small:!0,kind:"secondary",label:"Less",accessibilityLabel:`${(0,l.fishInStone)(T,e)?'Half a stone less':'Less'} ${e.name}`,onPress:()=>Q(e,-1),style:{minWidth:44,minHeight:44}}),(0,y.jsx)(d.default,{accessible:!0,accessibilityLabel:(0,l.fishQtySpeech)(T,e,B[e.id]||0),children:(0,y.jsx)(i.T,{weight:"bold",size:20,style:{minWidth:76,textAlign:'center'},children:(0,l.fishInStone)(T,e)?(0,l.fishQtyText)(T,e,B[e.id]||0):B[e.id]||0})}),(0,y.jsx)(i.Button,{small:!0,kind:"secondary",label:"More",accessibilityLabel:`${(0,l.fishInStone)(T,e)?'Half a stone more':'More'} ${e.name}`,testID:`qty-${e.id}`,onPress:()=>Q(e,1),style:{minWidth:44,minHeight:44}})]})]},e.id)),(0,y.jsxs)(d.default,{style:{gap:4},children:[(0,y.jsx)(i.T,{size:f.font.small,weight:"medium",colour:f.colours.muted,children:"Anything else (one line each)"}),(0,y.jsx)(t.TextInput,{value:P,onChangeText:O,multiline:!0,placeholder:"e.g. 2 boxes lemons",placeholderTextColor:f.colours.muted,style:[S,{minHeight:60}]})]}),F?(0,y.jsxs)(d.default,{style:{gap:4},children:[(0,y.jsxs)(i.T,{size:f.font.small,weight:"medium",colour:f.colours.muted,children:['whatsapp'===e.method?'WhatsApp number':'phone'===e.method?'Phone number':'Mobile number',e.number?'':' (blank: fill in once, it is saved)']}),(0,y.jsx)(t.TextInput,{testID:`number-${e.id}`,value:e.number,onChangeText:t=>v(T,e.id,{number:t}),keyboardType:"phone-pad",placeholder:"07\u2026",placeholderTextColor:f.colours.muted,style:S})]}):null,'online'===e.method?(0,y.jsxs)(d.default,{style:{gap:4},children:[(0,y.jsxs)(i.T,{size:f.font.small,weight:"medium",colour:f.colours.muted,children:['Open Coldweb'===e.urlLabel?'Coldweb ordering link':'Website link',e.url?'':' (blank: paste it in once, it is saved)']}),(0,y.jsx)(t.TextInput,{testID:`url-${e.id}`,value:e.url,onChangeText:t=>v(T,e.id,{url:t.trim()}),autoCapitalize:"none",keyboardType:"url",placeholder:"https://\u2026",placeholderTextColor:f.colours.muted,style:S})]}):null,e.priceCapPerKg?(0,y.jsxs)(d.default,{style:{gap:6,padding:10,borderRadius:12,backgroundColor:f.colours.blueBg},children:[(0,y.jsxs)(i.T,{weight:"semibold",colour:"#E2C489",children:["Price cap ",(0,p.gbp)(e.priceCapPerKg),"/kg \xb7 buy from the cheapest UK seller under it"]}),(0,y.jsxs)(i.Muted,{children:["Seller: ",e.seller||'to be chosen']}),(0,y.jsxs)(i.Row,{gap:8,children:[(0,y.jsx)(i.T,{size:f.font.small,style:{flex:1},children:"Price you found (\xa3/kg)"}),(0,y.jsx)(t.TextInput,{testID:"price-found",value:R,onChangeText:A,keyboardType:"decimal-pad",placeholder:"e.g. 22.50",placeholderTextColor:f.colours.muted,style:[S,{width:120}]})]}),G>0?(0,y.jsx)(i.Badge,{kind:G<=e.priceCapPerKg?'ok':'red',label:G<=e.priceCapPerKg?`${(0,p.gbp)(G)}/kg is under the cap \u2713`:`${(0,p.gbp)(G)}/kg is over the ${(0,p.gbp)(e.priceCapPerKg)} cap: look for a cheaper seller`}):null]}):null,'online'!==e.method&&'tbc'!==e.method?(0,y.jsxs)(d.default,{testID:`preview-${e.id}`,style:{padding:10,borderRadius:12,borderWidth:1,borderColor:f.colours.border,backgroundColor:f.colours.surface2},children:[(0,y.jsx)(i.T,{size:12,weight:"semibold",colour:f.colours.gold,children:'phone'===e.method?'READ THIS OUT':'YOUR MESSAGE'}),(0,y.jsx)(i.T,{size:f.font.small,children:K.length?N:'Add quantities above to write the order.'})]}):null,(0,y.jsxs)(i.Row,{wrap:!0,gap:8,children:['text'===e.method?(0,y.jsx)(i.Button,{testID:`send-${e.id}`,kind:"success",label:"\ud83d\udcac Open in Messages",disabled:!K.length,onPress:()=>Y((0,b.smsLink)(e.number,N))}):null,'whatsapp'===e.method?(0,y.jsx)(i.Button,{testID:`send-${e.id}`,kind:"success",label:"Open in WhatsApp",disabled:!K.length,onPress:()=>Y((0,b.waLink)(e.number,N))}):null,'phone'===e.method?(0,y.jsx)(i.Button,{testID:`send-${e.id}`,kind:"success",label:`\ud83d\udcde Call ${e.name}`,disabled:!e.number,onPress:()=>Y((0,b.telLink)(e.number))}):null,'online'===e.method?(0,y.jsx)(i.Button,{testID:`send-${e.id}`,kind:"success",label:`\ud83c\udf10 ${e.urlLabel??'Open website'}`,disabled:!e.url,onPress:()=>Y(e.url)}):null,'online'!==e.method&&'tbc'!==e.method&&K.length?(0,y.jsx)(i.Button,{kind:"ghost",label:z?'Copied \u2713':'Copy order',onPress:async()=>{const e=await w(N);_(e),e&&setTimeout(()=>_(!1),2e3)}}):null]}),'text'===e.method&&!e.number&&K.length?(0,y.jsx)(i.Muted,{children:"No number saved: Messages opens with the order written and asks who to send it to."}):null,'whatsapp'===e.method&&!e.number&&K.length?(0,y.jsx)(i.Muted,{children:"No number saved: WhatsApp opens with the order written and asks who to send it to."}):null,'phone'!==e.method||e.number?null:(0,y.jsx)(i.Muted,{children:"Add the phone number above to call from here."}),'online'!==e.method||e.url?null:(0,y.jsx)(i.Muted,{children:"Add the link above and the button opens it."})]}):null]})}},1168,[827,835,984,34,379,236,402,102,794,1027,983,985,867,1028,821,1145,25]); @@ -1267,7 +1267,7 @@ __d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{ __d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.waNumber=o,_e.waMeLink=function(e,t){const n=o(e);return n?t?`https://wa.me/${n}?text=${encodeURIComponent(t)}`:`https://wa.me/${n}`:null},Object.defineProperty(_e,"guestWhatsAppText",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"staffWhatsAppTexts",{enumerable:!0,get:function(){return p}}),_e.openWhatsApp=async function(e){try{return await n.default.openURL(e),!0}catch{return!1}};var e,t=r(_d[0]),n=(e=t)&&e.__esModule?e:{default:e};function o(e,t="44"){if(!e)return null;let n=String(e).trim().replace(/[\s().\-]/g,'');return n.startsWith('+')?n=n.slice(1):n.startsWith('00')?n=n.slice(2):n.startsWith('0')&&(n=t+n.slice(1)),n=n.replace(/^440/,'44'),/^[1-9][0-9]{6,14}$/.test(n)?n:null}const s=e=>{const[t,n,o]=e.split('-').map(Number);return new Date(t,n-1,o).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long',year:'numeric'})},u=e=>{const[t,n,o]=e.split('-').map(Number);return new Date(t,n-1,o).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'})},c=e=>e.slice(0,5),l=e=>e.replace(' (example)','').trim().split(/\s+/)[0]||'there',m=(e,t)=>`Hi ${t}, it's ${e.name.trim()} about my booking${e.ref?` ${e.ref}`:''}: ${s(e.date)} at ${c(e.time)}, table for ${e.partySize}. `,p=(e,t,n)=>({confirm:`Hi ${l(e.name)}, it's ${t}${n?` in ${n}`:''}. Just confirming your table for ${e.partySize} on ${u(e.date)} at ${c(e.time)}${e.ref?` (ref ${e.ref})`:''}. Any questions, just reply here.`,change:`Hi ${l(e.name)}, it's ${t} about your booking on ${u(e.date)} at ${c(e.time)}. `})},1184,[379]); __d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"payFor",{enumerable:!0,get:function(){return k.payFor}}),Object.defineProperty(_e,"useVenuePay",{enumerable:!0,get:function(){return k.useVenuePay}}),_e.PayTipsSettings=function({go:e}){const{rid:s,today:o}=(0,P.useCtx)(6e4),{pay:r,source:d}=(0,k.useVenuePay)(s),[a,l]=(0,n.useState)(r),[u,c]=(0,n.useState)((0,f.ukDate)(r.tipsAnchorPayday)),[y,x]=(0,n.useState)(null),j=(0,f.parseUk)(u),w=(0,f.cleanPay)({...a,tipsAnchorPayday:j??a.tipsAnchorPayday}),C=JSON.stringify(w)!==JSON.stringify(r)||'settings'!==d,S=(0,f.nextToPay)(w,'tips',o).period,D=(0,f.nextToPay)(w,'wage',o).period,I=(0,f.tipsPeriod)(w,S.start,1),z=(0,f.wagePeriod)(w,D.start,1),H=e=>{l({...a,...e}),x(null)};return(0,v.jsxs)(i.default,{style:{gap:12},testID:"pay-settings",children:['none'===d?(0,v.jsx)(h.Banner,{kind:"warn",title:"Pay dates not set up yet",children:"Set your tips and wage dates here. Until then the app uses calendar months and weekly tips."}):null,'questionnaire'===d?(0,v.jsx)(h.Banner,{kind:"info",title:"From your sign-up answers",children:"These dates came from your questionnaire. Check them and tap Save to make them your venue's pay dates."}):null,(0,v.jsx)(T.SectionHead,{title:"Tips",sub:"How often tips are paid out, and which days each payout covers."}),(0,v.jsxs)(h.Card,{children:[(0,v.jsx)(h.T,{weight:"semibold",children:"How often"}),(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:['weekly','fortnightly','monthly'].map(e=>(0,v.jsx)(h.Chip,{label:M[e],selected:a.tipsFrequency===e,onPress:()=>H({tipsFrequency:e})},e))}),(0,v.jsx)(h.Field,{label:"Next tips payday (DD/MM/YYYY)",value:u,onChangeText:e=>{c((0,t.slashDate)(e,u)),x(null)},maxLength:10,placeholder:"02/11/2026",keyboardType:"numbers-and-punctuation"}),j?(0,v.jsxs)(h.Muted,{children:[(0,f.dayMonth)(j)," ",j.slice(0,4)]}):(0,v.jsx)(h.T,{size:13,colour:b.colours.red,children:"Enter a date like 02/11/2026"}),(0,v.jsx)(h.T,{weight:"semibold",children:"Each tips period ends"}),(0,v.jsxs)(h.Row,{children:[(0,v.jsx)(h.Stepper,{label:"days before payday",value:a.tipsEndsDaysBefore,min:0,max:13,onChange:e=>H({tipsEndsDaysBefore:e})}),(0,v.jsx)(h.Muted,{style:{flex:1},children:0===a.tipsEndsDaysBefore?'on payday':1===a.tipsEndsDaysBefore?'day before payday (a Monday payday covers up to the Sunday)':'days before payday'})]})]}),(0,v.jsx)(T.SectionHead,{title:"Wages",sub:"Monthly pay: the cut-off starts each pay period."}),(0,v.jsxs)(h.Card,{children:[(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(h.T,{weight:"semibold",style:{flex:1},children:"Pay day of the month"}),(0,v.jsx)(h.Stepper,{label:"pay day",value:a.wagePayDay,min:1,max:31,onChange:e=>H({wagePayDay:e})})]}),(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(h.T,{weight:"semibold",style:{flex:1},children:"Cut-off (first day of each period)"}),(0,v.jsx)(h.Stepper,{label:"cut-off day",value:a.wageCutoffDay,min:1,max:28,onChange:e=>H({wageCutoffDay:e})})]}),(0,v.jsxs)(h.Muted,{children:["Period runs the ",B(a.wageCutoffDay)," to the ",B(1===a.wageCutoffDay?31:a.wageCutoffDay-1),1===a.wageCutoffDay?' (end of the month)':' of the next month',". A pay day past the month end uses the last day."]}),(0,v.jsx)(h.T,{weight:"semibold",children:"A pay day on a weekend"}),(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:['none','before','after'].map(e=>(0,v.jsx)(h.Chip,{label:$[e],selected:(a.weekendRule??'none')===e,onPress:()=>H({weekendRule:e})},e))})]}),(0,v.jsx)(T.SectionHead,{title:"Preview"}),(0,v.jsxs)(h.Card,{highlight:b.colours.gold,children:[(0,v.jsx)(R,{label:"Next tips payday",day:S.payday,period:S}),(0,v.jsx)(R,{label:"Then",day:I.payday,period:I}),(0,v.jsx)(i.default,{style:{height:1,backgroundColor:b.colours.border}}),(0,v.jsx)(R,{label:"Next payday",day:D.payday,period:D}),(0,v.jsx)(R,{label:"Then",day:z.payday,period:z})]}),(0,v.jsx)(h.Button,{kind:"success",label:'settings'===d?'Save pay dates':'Save as our pay dates',disabled:!j||!C,testID:"save-pay",onPress:()=>{p.useStore.getState().updateSettings(s,{pay:w}),x('Saved. Everyone in the venue sees these dates.')}}),y?(0,v.jsx)(h.Banner,{kind:"success",title:y}):null,(0,v.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,v.jsx)(h.Button,{small:!0,kind:"secondary",label:"Payroll hours",onPress:()=>e('more','hours')}),(0,v.jsx)(h.Button,{small:!0,kind:"secondary",label:"Tips day",onPress:()=>e('more','tipsday')})]})]})},_e.hoursIn=z,Object.defineProperty(_e,"toTsv",{enumerable:!0,get:function(){return N}}),Object.defineProperty(_e,"toCsv",{enumerable:!0,get:function(){return F}}),_e.summaryTable=V,_e.detailTable=E,_e.copyText=Y,_e.periodOptions=G,_e.PayrollHours=function({go:e}){const{rid:s,today:t,now:r,r:p,me:w,meId:T,role:M}=(0,P.useCtx)(6e4),$=(0,C.canSeeHoursEdit)({role:M,isCar:S.IS_CAR}),[B,R]=(0,n.useState)(!1),{pay:I,source:A}=(0,k.useVenuePay)(s),W=(0,y.useOwner)(e=>e.staff),L=(0,y.useOwner)(e=>(0,y.liveAttendance)(e.attendance)),q=(0,P.useHourly)(),J=(0,a.default)().width<700,[K,Q]=(0,n.useState)(null),[X,Z]=(0,n.useState)(null),ee=e=>{const s=y.useOwner.getState().confirmEntries([e.id],w,T,(new Date).toISOString());we(s?'Approved. It now counts in the hours and pay.':'Nothing to approve.')},se=e=>(0,v.jsxs)(i.default,{style:{gap:8,marginBottom:8},testID:`daily-${e.person.id}`,children:[e.days.map(e=>(0,v.jsx)(u.ShiftCard,{d:e,manager:!0,onApprove:()=>ee(e.a),onEdit:()=>Q(e.a),onRemove:()=>Z(e.a)},e.a.id)),e.days.length?null:(0,v.jsx)(h.Muted,{center:!0,children:"No clocked shifts in this period."})]}),te=(0,n.useMemo)(()=>G(I,t),[I,t]),[oe,ne]=(0,n.useState)('wage'),[re,de]=(0,n.useState)(null),[ae,ie]=(0,n.useState)(!1),[le,ue]=(0,n.useState)({}),[ce,he]=(0,n.useState)(null),pe='custom'===oe&&re?re:(te.find(e=>e.id===oe)??te[0]).period,ye=(0,n.useMemo)(()=>z(pe,W,L,r,q),[pe.key,W,L,q,Math.floor(r.getTime()/6e4)]),ge=ye.some(e=>null!=e.rate),xe='tips'===pe.kind,fe=ye.reduce((e,s)=>({c:e.c+s.confirmed,p:e.p+s.pending,s:e.s+s.shifts,g:e.g+(s.gross??0)}),{c:0,p:0,s:0,g:0}),me=ye.filter(e=>e.pending>0).length,be=`${p.name}: hours ${(0,f.rangeText)(pe.start,pe.end)}`,je=`hours-${pe.start}-to-${pe.end}`,we=e=>{he(e),setTimeout(()=>he(null),6e3)};return(0,v.jsxs)(i.default,{style:{gap:10},testID:"payroll-hours",children:['none'===A?(0,v.jsxs)(h.Banner,{kind:"warn",title:"Pay dates not set up",children:[(0,v.jsx)(h.Muted,{children:"Using calendar months for now."}),(0,v.jsx)(h.Button,{small:!0,kind:"ghost",label:"Set your pay dates \u203a",onPress:()=>e('more','paysettings')})]}):null,(0,v.jsxs)(h.Row,{wrap:!0,gap:6,children:[te.map(e=>(0,v.jsx)(h.Chip,{label:e.label,sub:e.sub,selected:oe===e.id,onPress:()=>{ne(e.id),ie(!1)}},e.id)),(0,v.jsx)(h.Chip,{label:"Custom dates",sub:re&&'custom'===oe?(0,f.rangeText)(re.start,re.end):'Pick any range',selected:'custom'===oe,onPress:()=>ie(!ae)})]}),ae?(0,v.jsx)(U,{onSet:e=>{de(e),ne('custom'),ie(!1)}}):null,(0,v.jsx)(h.Card,{highlight:b.colours.gold,children:(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,v.jsxs)(i.default,{style:{flexShrink:1,minWidth:0},children:[(0,v.jsxs)(h.T,{weight:"bold",size:18,children:[(0,f.rangeText)(pe.start,pe.end)," ",pe.end.slice(0,4)]}),(0,v.jsxs)(h.Muted,{children:[(0,f.ukDate)(pe.start)," to ",(0,f.ukDate)(pe.end),pe.payday?` \xb7 ${pe.payday>=t?'pays':'paid'} ${(0,f.dayMonth)(pe.payday)}`:'',xe?' \xb7 tips period':'wage'===pe.kind?' \xb7 wage period':'']})]}),(0,v.jsxs)(i.default,{style:{alignItems:'flex-end'},children:[(0,v.jsx)(h.T,{size:22,weight:"bold",colour:b.colours.gold,children:(0,l.durText)(fe.c)}),(0,v.jsxs)(h.Muted,{children:["approved",fe.p?` \xb7 ${(0,l.durText)(fe.p)} pending`:'']})]})]})}),$?(0,v.jsx)(i.default,{style:{alignItems:'center'},children:(0,v.jsx)(h.Button,{testID:"add-past-shift",label:"Add past shift",accessibilityLabel:"Add past shift",onPress:()=>R(!0),style:{minHeight:48,minWidth:180}})}):null,me?(0,v.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:"Sign off pending hours",onPress:()=>e('more','signoff'),testID:"pending-banner",children:(0,v.jsxs)(i.default,{style:{backgroundColor:b.colours.amberBg,borderRadius:12,padding:12,borderLeftWidth:6,borderLeftColor:b.colours.amber,gap:4},children:[(0,v.jsxs)(h.T,{weight:"bold",colour:b.colours.amber,children:["\u26a0 ",(0,l.durText)(fe.p)," still waiting for approval (",me," ",1===me?'person':'people',")"]}),(0,v.jsx)(h.T,{size:14,children:"Pending hours are not in the totals or the exports' confirmed columns. Sign them off first so everyone is paid in full."}),(0,v.jsx)(h.T,{weight:"semibold",colour:b.colours.gold,children:"Sign off hours \u203a"})]})}):(0,v.jsx)(h.Banner,{kind:"success",title:"All hours in this period are signed off"}),(0,v.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,v.jsx)(h.Button,{small:!0,kind:"success",label:"Copy for spreadsheet",testID:"copy-tsv",onPress:async()=>{const e=await Y(N(V(ye,pe,ge,xe)));we(e?`Copied ${ye.length} rows. Paste into the first cell of your spreadsheet.`:'Copy is not available here. Use Download CSV.')}}),(0,v.jsx)(h.Button,{small:!0,kind:"secondary",label:"Download CSV",onPress:()=>{(0,j.downloadText)(`${je}.csv`,F(V(ye,pe,ge,xe))),we('CSV downloaded (summary).')}}),(0,v.jsx)(h.Button,{small:!0,kind:"secondary",label:"Download CSV (daily detail)",onPress:()=>{(0,j.downloadText)(`${je}-daily.csv`,F(E(ye))),we('CSV downloaded (one line per shift).')}}),(0,v.jsx)(h.Button,{small:!0,kind:"secondary",label:"Print / PDF",onPress:()=>{const e=V(ye,pe,ge,xe);(0,j.printTable)(be,`${(0,f.ukDate)(pe.start)} to ${(0,f.ukDate)(pe.end)} \xb7 confirmed hours only in the totals \xb7 printed ${(0,f.ukDate)(t)}`,e[0],e.slice(1))}})]}),ce?(0,v.jsx)(h.Banner,{kind:"success",title:ce}):null,J?(0,v.jsxs)(i.default,{testID:"hours-table",style:{gap:10},children:[ye.map(e=>{const s=!!le[e.person.id];return(0,v.jsxs)(i.default,{style:{borderRadius:16,borderWidth:1,borderColor:'rgba(212,175,106,0.45)',backgroundColor:b.colours.surface,padding:12,gap:10},children:[(0,v.jsx)(u.HoursSummaryCard,{name:O(e.person),role:H(e.person),approved:e.confirmed,pending:e.pending,rate:e.rate}),(0,v.jsx)(h.Button,{kind:"secondary",testID:`hours-open-${e.person.id}`,label:s?'Hide shifts':`Show ${e.days.length} ${1===e.days.length?'shift':'shifts'}`,accessibilityLabel:`${s?'Hide':'Show'} ${O(e.person)}'s shifts`,onPress:()=>ue({...le,[e.person.id]:!s}),style:{minHeight:48}}),s?se(e):null]},e.person.id)}),(0,v.jsxs)(h.Muted,{center:!0,children:["Total: ",(0,l.durText)(fe.c)," approved",ge?` \xb7 ${(0,x.gbp)(fe.g)} gross`:'',fe.p?` \xb7 ${(0,l.durText)(fe.p)} pending`:'']})]}):(0,v.jsx)(o.WideTable,{children:(0,v.jsxs)(i.default,{testID:"hours-table",children:[(0,v.jsx)(o.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:b.colours.border,paddingBottom:4},children:['Name','Shifts','Approved','Pending',xe?'Tips h':'Hours',ge?'Rate':'',ge?'Gross':''].map((e,s)=>(0,v.jsx)(h.T,{size:12,weight:"semibold",colour:b.colours.gold,style:{width:_[s]},children:e},s))}),ye.map(e=>{const s=!!le[e.person.id];return(0,v.jsxs)(i.default,{style:{borderBottomWidth:1,borderColor:'#222'},children:[(0,v.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:`${O(e.person)} daily hours`,onPress:()=>ue({...le,[e.person.id]:!s}),style:{paddingVertical:7},children:(0,v.jsxs)(o.TRow,{heads:['Name','Shifts','Approved','Pending',xe?'Tips h':'Hours',ge?'Rate':'',ge?'Gross':''],children:[(0,v.jsxs)(i.default,{style:{width:_[0]},children:[(0,v.jsxs)(h.T,{size:14,weight:"semibold",numberOfLines:1,children:[s?'\u25be':'\u25b8'," ",O(e.person)]}),(0,v.jsx)(h.Muted,{children:H(e.person)})]}),(0,v.jsx)(h.T,{size:14,style:{width:_[1]},children:e.shifts}),(0,v.jsx)(h.T,{size:14,weight:"semibold",style:{width:_[2]},children:(0,l.durText)(e.confirmed)}),(0,v.jsx)(h.T,{size:14,weight:e.pending?'bold':'regular',colour:e.pending?b.colours.amber:b.colours.muted,style:{width:_[3]},children:e.pending?`\u26a0 ${(0,l.durText)(e.pending)}`:'0m'}),(0,v.jsx)(h.T,{size:14,style:{width:_[4]},children:xe?(0,f.decH)(e.confirmed):(0,l.durText)(e.confirmed)}),(0,v.jsx)(h.T,{size:14,colour:b.colours.muted,style:{width:_[5]},children:ge?null!=e.rate?(0,x.gbp)(e.rate):'\u2013':''}),(0,v.jsxs)(h.T,{size:14,weight:"semibold",style:{width:_[6]},children:[ge?null!=e.gross?(0,x.gbp)(e.gross):'\u2013':'',ge&&null!=e.rate&&e.pending?(0,v.jsx)(h.T,{size:12,colour:b.colours.amber,children:`\n+ ${(0,x.gbp)(Math.round(e.pending/60*e.rate))} pending`}):null]})]})}),s?se(e):null]},e.person.id)}),(0,v.jsxs)(o.TRow,{heads:['','Shifts','Approved','Pending',xe?'Tips h':'Hours','',ge?'Gross':''],style:{paddingVertical:8,borderTopWidth:2,borderColor:b.colours.gold},children:[(0,v.jsxs)(h.T,{size:14,weight:"bold",style:{width:_[0]},children:["Total (",ye.length,")"]}),(0,v.jsx)(h.T,{size:14,weight:"bold",style:{width:_[1]},children:fe.s}),(0,v.jsx)(h.T,{size:14,weight:"bold",colour:b.colours.gold,style:{width:_[2]},children:(0,l.durText)(fe.c)}),(0,v.jsx)(h.T,{size:14,weight:"bold",colour:fe.p?b.colours.amber:b.colours.muted,style:{width:_[3]},children:(0,l.durText)(fe.p)}),(0,v.jsx)(h.T,{size:14,weight:"bold",style:{width:_[4]},children:xe?(0,f.decH)(fe.c):(0,l.durText)(fe.c)}),(0,v.jsx)(h.T,{size:14,style:{width:_[5]},children:" "}),(0,v.jsx)(h.T,{size:14,weight:"bold",style:{width:_[6]},children:ge?(0,x.gbp)(fe.g):''})]})]})}),K?(0,v.jsx)(c.OverrideSheet,{a:K,staffId:K.staffId,date:K.date,onClose:()=>Q(null)}):null,X?(0,v.jsx)(u.RemoveShiftSheet,{a:X,who:{name:w,id:T},onClose:()=>{Z(null),we('Removed from hours. It is kept in the history.')}}):null,B?(0,v.jsx)(D.AddPastShiftSheet,{onClose:()=>R(!1),onSaved:()=>{R(!1),we('Saved. It counts in the hours and pay.')}}):null,(0,v.jsxs)(h.Muted,{children:["Tap a name for each day. Hours read 37h 30m. The export also has decimal hours (37.50) and h:mm for your spreadsheet. Paid hours = clock out \u2212 clock in \u2212 break. ",ge?'Gross is before tax, from confirmed hours only.':'Rates and gross show once you sign in with your personal link.']}),xe?(0,v.jsx)(h.Button,{kind:"success",label:"Tips day: split tips for this period \u203a",onPress:()=>e('more','tipsday')}):null]})},_e.TipsDay=function({go:e}){const{rid:t,today:r,now:a}=(0,P.useCtx)(6e4),{pay:u,source:c}=(0,k.useVenuePay)(t),p=(0,y.useOwner)(e=>e.staff),T=(0,y.useOwner)(e=>(0,y.liveAttendance)(e.attendance)),C=(0,y.useOwner)(e=>e.tronc),S=(0,f.nextToPay)(u,'tips',r),[D,M]=(0,n.useState)(0),$=(0,f.tipsPeriod)(u,S.period.start,D),[B,R]=(0,n.useState)(''),[I,W]=(0,n.useState)({}),[L,V]=(0,n.useState)(null),E=(0,n.useMemo)(()=>z($,p,T,a,{}),[$.key,p,T]),G=e=>'owner'===e.role&&!C.includeOwner||'manager'===e.role&&!C.includeManagers,U=e=>I[e.id]??G(e),_=E.filter(e=>e.confirmed>0||e.pending>0),q=Math.round(100*Number(B.replace(/[\xa3,\s]/g,''))),J=Number.isFinite(q)&&q>0&&q<=1e8&&/^\s*\xa3?\s*[\d,]+(\.\d{0,2})?\s*$/.test(B),K=_.filter(e=>!U(e.person)&&e.confirmed>0),{amounts:Q}=(0,w.allocate)(J?q:0,K.map(e=>e.confirmed)),X={};K.forEach((e,s)=>{X[e.person.id]=Q[s]});const Z=K.reduce((e,s)=>e+s.confirmed,0),ee=Object.values(X).reduce((e,s)=>e+s,0),se=_.filter(e=>e.pending>0&&!U(e.person)),te=se.reduce((e,s)=>e+s.pending,0),oe=()=>[['Name','Role','Period start','Period end','Payday','Confirmed hours','Confirmed h:mm','Share %','Tips \xa3'],..._.map(e=>{const s=!U(e.person)&&e.confirmed>0;return[O(e.person),H(e.person),(0,f.ukDate)($.start),(0,f.ukDate)($.end),$.payday?(0,f.ukDate)($.payday):'',(0,f.decH)(e.confirmed),(0,f.hMm)(e.confirmed),s&&Z?(e.confirmed/Z*100).toFixed(2):'0.00',s?A(X[e.person.id]??0):U(e.person)?'excluded':'0.00']}),['TOTAL','',(0,f.ukDate)($.start),(0,f.ukDate)($.end),$.payday?(0,f.ukDate)($.payday):'',(0,f.decH)(Z),(0,f.hMm)(Z),Z?'100.00':'0.00',A(ee)]],ne=e=>{V(e),setTimeout(()=>V(null),6e3)};return(0,v.jsxs)(i.default,{style:{gap:10},testID:"tips-day",children:[(0,v.jsx)(h.Banner,{kind:"info",title:"Saving payouts and notifying staff are coming next",children:"For now this works out the split and exports it. Nothing is saved to the team, sent or paid."}),'none'===c?(0,v.jsxs)(h.Banner,{kind:"warn",title:"Tips dates not set up",children:[(0,v.jsx)(h.Muted,{children:"Using weekly tips for now."}),(0,v.jsx)(h.Button,{small:!0,kind:"ghost",label:"Set your pay dates \u203a",onPress:()=>e('more','paysettings')})]}):null,(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(h.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",disabled:D<=-6,onPress:()=>M(D-1)}),(0,v.jsxs)(i.default,{style:{alignItems:'center',flex:1},children:[(0,v.jsx)(h.T,{weight:"bold",size:18,children:(0,f.rangeText)($.start,$.end)}),(0,v.jsxs)(h.Muted,{children:[(0,f.ukDate)($.start)," to ",(0,f.ukDate)($.end)," \xb7 ",$.payday>=r?'paid':'was paid'," ",(0,f.dayMonth)($.payday)]}),0===D?(0,v.jsx)(h.Badge,{kind:"gold",label:"Paid next"}):null]}),(0,v.jsx)(h.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:D>=1,onPress:()=>M(D+1)})]}),(0,v.jsxs)(h.Card,{highlight:b.colours.gold,children:[(0,v.jsx)(h.T,{weight:"semibold",children:"Total tips to share"}),(0,v.jsxs)(h.Row,{style:{alignItems:'center'},children:[(0,v.jsx)(h.T,{size:28,weight:"bold",colour:b.colours.gold,children:"\xa3"}),(0,v.jsx)(s.TextInput,{testID:"tips-total",accessibilityLabel:"Total tips in pounds",value:B,onChangeText:R,placeholder:"0.00",placeholderTextColor:"#7D776C",keyboardType:"decimal-pad",style:[h.styles.input,{flex:1,fontSize:26,fontWeight:'700'}]})]}),B&&!J?(0,v.jsx)(h.T,{size:13,colour:b.colours.red,children:"Enter an amount like 1250.00"}):(0,v.jsx)(h.Muted,{children:"Shared by confirmed hours: share = total \xd7 (their hours \xf7 everyone's hours). Rounded to the penny; leftover pennies go to the largest shares so it adds up exactly."})]}),se.length?(0,v.jsx)(d.default,{accessibilityRole:"button",onPress:()=>e('more','signoff'),testID:"tips-pending",children:(0,v.jsxs)(i.default,{style:{backgroundColor:b.colours.redBg,borderRadius:12,padding:12,borderLeftWidth:6,borderLeftColor:b.colours.red,gap:4},children:[(0,v.jsxs)(h.T,{weight:"bold",colour:b.colours.red,children:["\u26a0 Don't pay out yet: ",(0,l.durText)(te)," not approved yet"]}),(0,v.jsxs)(h.T,{size:14,children:[se.map(e=>`${O(e.person)} (${(0,l.durText)(e.pending)})`).join(', '),". Pending hours are left out of the split, so these people would get less than they should."]}),(0,v.jsx)(h.T,{weight:"semibold",colour:b.colours.gold,children:"Sign off hours \u203a"})]})}):_.length?(0,v.jsx)(h.Banner,{kind:"success",title:"All hours in this fortnight are signed off"}):null,(0,v.jsx)(o.WideTable,{children:(0,v.jsxs)(i.default,{testID:"tips-table",children:[(0,v.jsx)(o.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:b.colours.border,paddingBottom:4},children:['Include','Name','Confirmed','Share','Tips'].map((e,s)=>(0,v.jsx)(h.T,{size:12,weight:"semibold",colour:b.colours.gold,style:{width:[64,150,100,64,84][s]},children:e},e))}),_.map(e=>{const s=U(e.person),t=X[e.person.id]??0;return(0,v.jsxs)(o.TRow,{heads:['Include','Name','Confirmed','Share','Tips'],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222',opacity:s?.5:1},children:[(0,v.jsx)(d.default,{accessibilityRole:"checkbox",accessibilityState:{checked:!s},accessibilityLabel:`Include ${O(e.person)}`,onPress:()=>W({...I,[e.person.id]:!s}),style:{width:64,minHeight:44,justifyContent:'center'},children:(0,v.jsx)(i.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:s?b.colours.muted:b.colours.ok,backgroundColor:s?'transparent':b.colours.okBg,alignItems:'center',justifyContent:'center'},children:(0,v.jsx)(h.T,{size:14,colour:b.colours.ok,children:s?'':'\u2713'})})}),(0,v.jsxs)(i.default,{style:{width:150},children:[(0,v.jsx)(h.T,{size:14,weight:"semibold",numberOfLines:1,children:O(e.person)}),(0,v.jsxs)(h.Muted,{numberOfLines:1,children:[s?'Excluded':H(e.person),e.pending?` \xb7 \u26a0 ${(0,f.decH)(e.pending)} h pending`:'']})]}),(0,v.jsxs)(h.T,{size:14,style:{width:80},children:[(0,f.decH)(e.confirmed)," h"]}),(0,v.jsx)(h.T,{size:14,colour:b.colours.muted,style:{width:64},children:!s&&Z?`${(e.confirmed/Z*100).toFixed(1)}%`:'\u2013'}),(0,v.jsx)(h.T,{size:15,weight:"bold",colour:s?b.colours.muted:b.colours.gold,style:{width:84},children:s?'\u2013':(0,x.gbp)(t)})]},e.person.id)}),(0,v.jsxs)(o.TRow,{heads:['','','Confirmed','Share','Tips'],style:{paddingVertical:8,borderTopWidth:2,borderColor:b.colours.gold},children:[(0,v.jsx)(h.T,{size:14,style:{width:64},children:" "}),(0,v.jsxs)(h.T,{size:14,weight:"bold",style:{width:150},children:["Total (",K.length," people)"]}),(0,v.jsxs)(h.T,{size:14,weight:"bold",style:{width:80},children:[(0,f.decH)(Z)," h"]}),(0,v.jsx)(h.T,{size:14,style:{width:64},children:Z?'100%':'\u2013'}),(0,v.jsx)(h.T,{size:15,weight:"bold",colour:J&&ee===q?b.colours.ok:b.colours.text,style:{width:84},children:(0,x.gbp)(ee)})]})]})}),_.length?null:(0,v.jsx)(h.Muted,{children:"No clocked hours in this fortnight yet."}),J&&Z?(0,v.jsxs)(h.Muted,{children:["Check: ",K.length," shares add up to ",(0,x.gbp)(ee)," of ",(0,x.gbp)(q)," ",ee===q?'\u2713':'',". \xa3",(q/100/(Z/60)).toFixed(4)," per confirmed hour."]}):null,(0,v.jsxs)(h.Muted,{children:["Owner ",C.includeOwner?'included':'left out'," and managers ",C.includeManagers?'included':'left out'," by default (your tipping policy in Tips). Tick or untick anyone for this split."]}),(0,v.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,v.jsx)(h.Button,{small:!0,kind:"success",label:"Copy for spreadsheet",testID:"tips-copy",disabled:!J,onPress:async()=>{const e=await Y(N(oe()));ne(e?'Copied. Paste into the first cell of your spreadsheet.':'Copy is not available here. Use Download CSV.')}}),(0,v.jsx)(h.Button,{small:!0,kind:"secondary",label:"Download CSV",disabled:!J,onPress:()=>{(0,j.downloadText)(`tips-${$.start}-to-${$.end}.csv`,F(oe())),ne('CSV downloaded.')}}),(0,v.jsx)(h.Button,{small:!0,kind:"secondary",label:"Print / PDF",disabled:!J,onPress:()=>{const e=oe();(0,j.printTable)(`Tips ${(0,f.rangeText)($.start,$.end)} (paid ${(0,f.dayMonth)($.payday)})`,`Total ${(0,x.gbp)(q)} shared by confirmed hours${se.length?` \xb7 WARNING ${(0,f.decH)(te)} h not signed off`:''}`,e[0],e.slice(1))}})]}),L?(0,v.jsx)(h.Banner,{kind:"success",title:L}):null]})},_e.PaydaysCard=function({go:e}){const{rid:s,today:t}=(0,P.useCtx)(6e4),{pay:o,source:n}=(0,k.useVenuePay)(s),d=(0,f.nextToPay)(o,'tips',t).period,a=(0,f.nextToPay)(o,'wage',t).period;return(0,v.jsxs)(i.default,{testID:"paydays-card",style:{backgroundColor:b.colours.surface,borderRadius:16,borderWidth:1,borderColor:b.colours.hairline,padding:16,gap:8},children:[(0,v.jsx)(r.CardHeading,{right:'none'===n?(0,v.jsx)(h.Badge,{kind:"amber",label:"Not set up"}):null,children:"Paydays"}),(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,v.jsxs)(h.T,{children:["Next tips payday: ",(0,v.jsx)(h.T,{weight:"semibold",colour:b.colours.goldLight,children:d.payday===t?'today':(0,f.dayMonth)(d.payday)})]}),(0,v.jsx)(h.Muted,{children:(0,f.rangeText)(d.start,d.end)})]}),(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,v.jsxs)(h.T,{children:["Next payday: ",(0,v.jsx)(h.T,{weight:"semibold",colour:b.colours.goldLight,children:a.payday===t?'today':(0,f.dayMonth)(a.payday)})]}),(0,v.jsxs)(h.Muted,{children:["period ",(0,f.rangeText)(a.start,a.end)]})]}),(0,v.jsxs)(r.ActionGrid,{testID:"paydays-actions",children:[(0,v.jsx)(r.ActionTile,{primary:!0,icon:"payroll",label:"Payroll hours",sub:"Copy or export",onPress:()=>e('more','hours'),testID:"paydays-hours"}),(0,v.jsx)(r.ActionTile,{icon:"tips",label:"Tips day",sub:"Share out tips",onPress:()=>e('more','tipsday'),testID:"paydays-tips"})]}),'settings'!==n?(0,v.jsx)(h.Button,{small:!0,kind:"ghost",label:"Pay & tips settings",onPress:()=>e('more','paysettings'),style:{alignSelf:'flex-start'}}):null]})},_e.MyPeriods=function({staffId:e}){const{rid:s,today:t,now:o,meId:n}=(0,P.useCtx)(6e4),r=e??n,{pay:d}=(0,k.useVenuePay)(s),a=(0,y.useOwner)(e=>(0,y.liveAttendance)(e.attendance)),u=(0,y.useOwner)(e=>e.staff.find(e=>e.id===r)),c=(0,f.wagePeriod)(d,t,0),p=(0,f.tipsPeriod)(d,t,0),x=e=>u?z(e,[u],a,o,{})[0]??null:null,j=(e,s,o)=>(0,v.jsxs)(i.default,{style:{flexGrow:1,flexBasis:160,backgroundColor:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.border,padding:12,gap:2},children:[(0,v.jsx)(h.T,{size:13,weight:"semibold",colour:b.colours.gold,children:e.toUpperCase()}),(0,v.jsxs)(h.Muted,{children:[(0,f.rangeText)(s.start,s.end)," \xb7 ",s.payday>=t?'paid':'was paid'," ",(0,f.dayMonth)(s.payday)]}),(0,v.jsx)(h.T,{size:24,weight:"bold",children:(0,l.durText)(o?.confirmed??0)}),(0,v.jsxs)(h.Muted,{children:["approved \xb7 ",o?.shifts??0," shifts"]}),o?.pending?(0,v.jsxs)(h.T,{size:13,colour:b.colours.amber,children:["+ ",(0,l.durText)(o.pending)," waiting for approval"]}):null]},e);return(0,v.jsx)(h.Row,{wrap:!0,gap:8,style:{alignItems:'stretch'},children:[j('This pay period',c,x(c)),j('This tips fortnight',p,x(p))]})};var s=_r(_d[0]),t=_r(_d[1]),o=_r(_d[2]),n=_r(_d[3]),r=_r(_d[4]);_r(_d[5]);var d=e(_r(_d[6])),a=e(_r(_d[7])),i=e(_r(_d[8])),l=_r(_d[9]),u=_r(_d[10]),c=_r(_d[11]),h=_r(_d[12]),p=_r(_d[13]),y=_r(_d[14]),x=_r(_d[15]),f=_r(_d[16]),b=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),T=_r(_d[20]),P=_r(_d[21]),k=_r(_d[22]),C=_r(_d[23]),S=_r(_d[24]),D=_r(_d[25]),v=_r(_d[26]);const M={weekly:'Weekly',fortnightly:'Fortnightly',monthly:'Monthly'},$={none:'Keep the date',before:'Friday before',after:'Monday after'};const B=e=>`${e}${e%10==1&&11!==e?'st':e%10==2&&12!==e?'nd':e%10==3&&13!==e?'rd':'th'}`;function R({label:e,day:s,period:t}){return(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,v.jsxs)(h.T,{children:[e,": ",(0,v.jsx)(h.T,{weight:"bold",colour:b.colours.gold,children:(0,f.dayMonth)(s)})]}),(0,v.jsx)(h.Muted,{children:(0,f.rangeText)(t.start,t.end)})]})}const I=e=>{if(!e)return'';const s=new Date(e);return`${String(s.getHours()).padStart(2,'0')}:${String(s.getMinutes()).padStart(2,'0')}`};function z(e,s,t,o,n){const r=t.filter(s=>s.in&&s.date>=e.start&&s.date<=e.end);return s.map(e=>{const s=r.filter(s=>s.staffId===e.id).sort((e,s)=>e.date.localeCompare(s.date)||(e.in??'').localeCompare(s.in??'')).map(e=>{const s=(0,P.paidMins)(e,o),t=(0,y.attStatus)(e);return{a:e,date:e.date,inT:I(e.in),outT:I(e.out),brk:s.brk,paid:s.paid,status:'open'===t?'On now':'awaiting'===t?'Pending':'Confirmed'}}),t=e=>s.filter(s=>s.status===e).reduce((e,s)=>e+s.paid,0),d=t('Confirmed'),a=n[e.id];return{person:e,confirmed:d,pending:t('Pending'),open:t('On now'),shifts:s.filter(e=>'On now'!==e.status).length,days:s,rate:a,gross:null!=a?Math.round(d/60*a):void 0}}).filter(e=>e.days.length>0||e.person.active&&'owner'!==e.person.role)}const H=e=>`${y.ROLE_LABEL[e.role]}${e.job?` \xb7 ${e.job}`:''}`,O=e=>e.name.replace(' (example)',''),A=e=>null==e?'':(e/100).toFixed(2),W=e=>e.replace(/[\t\r\n]+/g,' '),L=e=>/[",\n]/.test(e)?`"${e.replace(/"/g,'""')}"`:e,N=e=>e.map(e=>e.map(W).join('\t')).join('\n'),F=e=>e.map(e=>e.map(L).join(',')).join('\r\n');function V(e,s,t,o){const n=['Name','Role','Period start','Period end','Confirmed hours','Confirmed h:mm','Pending hours','Pending h:mm','Shifts',...o?['Tips hours']:[],...t?['Rate \xa3/h','Gross \xa3']:[]],r=e.map(e=>[O(e.person),H(e.person),(0,f.ukDate)(s.start),(0,f.ukDate)(s.end),(0,f.decH)(e.confirmed),(0,f.hMm)(e.confirmed),(0,f.decH)(e.pending),(0,f.hMm)(e.pending),String(e.shifts),...o?[(0,f.decH)(e.confirmed)]:[],...t?[A(e.rate),A(e.gross)]:[]]),d=e.reduce((e,s)=>({c:e.c+s.confirmed,p:e.p+s.pending,s:e.s+s.shifts,g:e.g+(s.gross??0)}),{c:0,p:0,s:0,g:0});return[n,...r,['TOTAL','',(0,f.ukDate)(s.start),(0,f.ukDate)(s.end),(0,f.decH)(d.c),(0,f.hMm)(d.c),(0,f.decH)(d.p),(0,f.hMm)(d.p),String(d.s),...o?[(0,f.decH)(d.c)]:[],...t?['',A(d.g)]:[]]]}function E(e){return[['Name','Role','Date','In','Out','Break mins','Paid hours','Paid h:mm','Status'],...e.flatMap(e=>e.days.map(s=>[O(e.person),H(e.person),(0,f.ukDate)(s.date),s.inT,s.outT,'On now'===s.status?'':String(s.brk),'On now'===s.status?'':(0,f.decH)(s.paid),'On now'===s.status?'':(0,f.hMm)(s.paid),s.status]))]}async function Y(e){if('undefined'==typeof document)return!1;try{if(navigator.clipboard?.writeText)return await navigator.clipboard.writeText(e),!0}catch{}try{const s=document.createElement('textarea');s.value=e,s.style.position='fixed',s.style.opacity='0',document.body.appendChild(s),s.select();const t=document.execCommand('copy');return s.remove(),t}catch{return!1}}function G(e,s){const t=(0,f.nextToPay)(e,'wage',s),o=(0,f.nextToPay)(e,'tips',s),n=(0,f.wagePeriod)(e,t.period.start,-1),r=(0,f.tipsPeriod)(e,o.period.start,-1),d=e=>e.payday>=s?e.payday===s?'Pays today':`Pays ${(0,f.dayMonth)(e.payday)}`:`Paid ${(0,f.dayMonth)(e.payday)}`;return[{id:'wage',label:`Wages ${(0,f.rangeText)(t.period.start,t.period.end)}`,sub:d(t.period),period:t.period},{id:'wagePrev',label:`Wages ${(0,f.rangeText)(n.start,n.end)}`,sub:d(n),period:n},{id:'tips',label:`Tips ${(0,f.rangeText)(o.period.start,o.period.end)}`,sub:d(o.period),period:o.period},{id:'tipsPrev',label:`Tips ${(0,f.rangeText)(r.start,r.end)}`,sub:d(r),period:r}]}function U({onSet:e}){const[s,o]=(0,n.useState)(''),[r,d]=(0,n.useState)(''),a=(0,f.parseUk)(s),l=(0,f.parseUk)(r),u=!!a&&!!l&&l>=a&&(0,f.plusDays)(a,92)>=l;return(0,v.jsxs)(h.Row,{wrap:!0,gap:6,style:{alignItems:'flex-end'},children:[(0,v.jsx)(i.default,{style:{flexBasis:130,flexGrow:1},children:(0,v.jsx)(h.Field,{label:"From (DD/MM/YYYY)",value:s,onChangeText:e=>o((0,t.slashDate)(e,s)),placeholder:"23/10/2026",keyboardType:"numbers-and-punctuation",maxLength:10})}),(0,v.jsx)(i.default,{style:{flexBasis:130,flexGrow:1},children:(0,v.jsx)(h.Field,{label:"To (DD/MM/YYYY)",value:r,onChangeText:e=>d((0,t.slashDate)(e,r)),placeholder:"22/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10})}),(0,v.jsx)(h.Button,{small:!0,kind:"success",label:"Show",disabled:!u,onPress:()=>u&&e((0,f.customPeriod)(a,l))}),s&&r&&!u?(0,v.jsx)(h.T,{size:13,colour:b.colours.red,children:"Use two dates, the second on or after the first, up to 3 months apart."}):null]})}const _=[150,54,100,90,48,62,70]},1185,[827,1059,1180,34,1186,236,402,426,102,1188,1189,1190,794,831,891,867,1060,821,930,1193,1181,1084,1061,1191,872,1192,25]); __d(function(g,_r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ActionTile=function({label:e,sub:r,icon:c,onPress:u,primary:h,tone:b="gold",count:f,testID:x,accessibilityLabel:y}){const j='blue'===b?i.colours.blue:i.colours.gold;return(0,s.jsxs)(t.default,{testID:x,accessibilityRole:"button",accessibilityLabel:y??(r?`${e}, ${r}`:e),onPress:u,style:({pressed:e})=>({flex:1,minWidth:0,minHeight:68,borderRadius:16,borderWidth:1,borderColor:h?i.colours.accentBorder:i.colours.hairline,backgroundColor:e?i.colours.tilePressed:i.colours.tile,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:12,paddingHorizontal:14,paddingVertical:12}),children:[(0,s.jsx)(o.default,{style:{width:40,height:40,borderRadius:12,alignItems:'center',justifyContent:'center',backgroundColor:h?i.colours.accentBg:'rgba(255,255,255,0.04)',borderWidth:1,borderColor:h?i.colours.accentBorder:i.colours.hairline},children:(0,s.jsx)(l.Icon,{name:c,size:21,colour:j})}),(0,s.jsxs)(o.default,{style:{flexShrink:1,minWidth:0},children:[(0,s.jsx)(n.T,{size:15,weight:"semibold",numberOfLines:1,colour:i.colours.text,children:e}),r?(0,s.jsx)(n.T,{size:12,numberOfLines:1,colour:i.colours.muted,children:r}):null]}),f?(0,s.jsx)(o.default,{style:{backgroundColor:i.colours.amber,borderRadius:10,minWidth:22,paddingHorizontal:6},children:(0,s.jsx)(n.T,{size:12,weight:"bold",colour:i.colours.onGold,center:!0,children:f})}):null]})},_e.ActionGrid=function({children:e,testID:t="action-grid"}){const l=r.default.Children.toArray(e).filter(Boolean),i=[];for(let e=0;e(0,s.jsxs)(o.default,{style:{flexDirection:'row',gap:12},children:[e,1===e.length?(0,s.jsx)(o.default,{style:{flex:1}}):null]},r))})},Object.defineProperty(_e,"CardHeading",{enumerable:!0,get:function(){return c}});var r=e(_r(d[0])),t=e(_r(d[1])),o=e(_r(d[2])),l=_r(d[3]),i=_r(d[4]),n=_r(d[5]),s=_r(d[6]);const c=({children:e,right:r})=>(0,s.jsxs)(o.default,{style:{flexDirection:'row',alignItems:'center',justifyContent:'space-between'},children:[(0,s.jsx)(n.T,{size:12,weight:"semibold",colour:i.colours.goldMuted,style:{letterSpacing:1.6,textTransform:'uppercase'},children:e}),r]})},1186,[34,402,102,1187,821,794,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Icon=function({name:l,size:x=22,colour:t}){const n={stroke:t,strokeWidth:2,fill:'none',strokeLinecap:'round',strokeLinejoin:'round'};return(0,e.jsxs)(h.default,{width:x,height:x,viewBox:"0 0 24 24",children:['home'===l?(0,e.jsx)(s.Path,{d:"M3 11l9-7 9 7v9a1 1 0 0 1-1 1h-5v-6H9v6H4a1 1 0 0 1-1-1z",...n}):null,'signoff'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"11",r:"8",...n}),(0,e.jsx)(s.Path,{d:"M11 6.5V11l3 2",...n}),(0,e.jsx)(s.Path,{d:"M15.5 19.5l2 2 4-4.2",...n})]}):null,'orders'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"5",y:"3",width:"14",height:"18",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M9 8h6M9 12h6M9 16h4",...n})]}):null,'bookings'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4",...n})]}):null,'forecast'===l?(0,e.jsx)(s.Path,{d:"M4 20V10M10 20V4M16 20v-7M22 20H2",...n}):null,'more'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"5",cy:"12",r:"1.6",fill:t}),(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"1.6",fill:t}),(0,e.jsx)(s.Circle,{cx:"19",cy:"12",r:"1.6",fill:t})]}):null,'search'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"11",r:"7",...n}),(0,e.jsx)(s.Path,{d:"M20 20l-4-4",...n})]}):null,'bell'===l?(0,e.jsx)(s.Path,{d:"M6 16V11a6 6 0 0 1 12 0v5l2 2H4zM10 20a2 2 0 0 0 4 0",...n}):null,'chat'===l?(0,e.jsx)(s.Path,{d:"M4 5h16v11H9l-5 4z",...n}):null,'clock'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M12 7v5l3 2",...n})]}):null,'user'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"8",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M4 21a8 8 0 0 1 16 0",...n})]}):null,'walkin'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"13",cy:"4.5",r:"1.8",...n}),(0,e.jsx)(s.Path,{d:"M10 21l2-6 3 3v3M9 12l2-4 4 1 2 3M11 8l-1 5",...n})]}):null,'calendarPlus'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4M12 13v5M9.5 15.5h5",...n})]}):null,'pause'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M10 9v6M14 9v6",...n})]}):null,'rain'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M7 15a4 4 0 0 1-.6-7.95A5.5 5.5 0 0 1 17 7.5a3.75 3.75 0 0 1 .5 7.5z",...n}),(0,e.jsx)(s.Path,{d:"M9 18l-1 2.5M13 18l-1 2.5M17 18l-1 2.5",...n})]}):null,'sun'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M12 2v2M12 20v2M2 12h2M20 12h2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4",...n})]}):null,'payroll'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"4",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M7 9h6M7 13h4M15 12.5a2 2 0 1 0 0 .01M7 17h10",...n})]}):null,'tips'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M14.5 9a2.5 2.5 0 0 0-5 0c0 2.5 0 4-1.5 6h7M9 12.5h4",...n})]}):null,'sparkle'===l?(0,e.jsx)(s.Path,{d:"M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8zM19 16l.7 1.8 1.8.7-1.8.7L19 21l-.7-1.8-1.8-.7 1.8-.7z",...n}):null,'platter'===l?(0,e.jsx)(e.Fragment,{children:(0,e.jsx)(s.Path,{d:"M3 15h18M5 15a7 7 0 0 1 14 0M12 6v2M2 18h20",...n})}):null,'check'===l?(0,e.jsx)(s.Path,{d:"M5 12.5l4.5 4.5L19 7.5",...n}):null,'alert'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M12 3l9.5 17h-19z",...n}),(0,e.jsx)(s.Path,{d:"M12 10v4M12 17.2v.1",...n})]}):null,'access'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"4.5",r:"1.8",...n}),(0,e.jsx)(s.Path,{d:"M11 7.5v6h5l2.5 5M11 10h5M8 11.5a5.5 5.5 0 1 0 7.5 6.5",...n})]}):null,'dog'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 10l1-5 3 3h4l3-3 1 5v4a5 5 0 0 1-5 5h-2a5 5 0 0 1-5-5z",...n}),(0,e.jsx)(s.Path,{d:"M10 13v.1M14 13v.1M11 16h2",...n})]}):null,'leaf'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 19c0-8 5-14 15-14 0 10-6 15-14 15",...n}),(0,e.jsx)(s.Path,{d:"M5 19l8-8",...n})]}):null,'table'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"4",y:"8",width:"16",height:"8",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M8 16v4M16 16v4M8 4v4M16 4v4",...n})]}):null,'bag'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 8h14l-1 12H6z",...n}),(0,e.jsx)(s.Path,{d:"M9 10V7a3 3 0 0 1 6 0v3",...n})]}):null,'phone'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"7",y:"2.5",width:"10",height:"19",rx:"2.5",...n}),(0,e.jsx)(s.Path,{d:"M11 18.5h2",...n})]}):null,'swap'===l?(0,e.jsx)(s.Path,{d:"M7 4L3 8l4 4M3 8h14M17 20l4-4-4-4M21 16H7",...n}):null,'box'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M3.5 8L12 4l8.5 4v8L12 20l-8.5-4z",...n}),(0,e.jsx)(s.Path,{d:"M3.5 8L12 12l8.5-4M12 12v8",...n})]}):null,'star'===l?(0,e.jsx)(s.Path,{d:"M12 3.5l2.6 5.4 5.9.8-4.3 4.1 1 5.8L12 16.8l-5.2 2.8 1-5.8L3.5 9.7l5.9-.8z",...n}):null,'userPlus'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"10",cy:"8",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M3 21a7 7 0 0 1 14 0M19 8v6M16 11h6",...n})]}):null,'gift'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3.5",y:"8.5",width:"17",height:"4",rx:"1",...n}),(0,e.jsx)(s.Path,{d:"M5 12.5V20h14v-7.5M12 8.5V20M12 8.5C10 8.5 7.5 7.8 7.5 5.8S10.5 4 12 8.5c1.5-4.5 4.5-4.7 4.5-2.7S14 8.5 12 8.5z",...n})]}):null,'tag'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M3.5 12.5V4h8.5l8.5 8.5-8.5 8.5z",...n}),(0,e.jsx)(s.Circle,{cx:"8",cy:"8.5",r:"1.4",...n})]}):null,'hanger'===l?(0,e.jsx)(s.Path,{d:"M12 7.5a2 2 0 1 1 2-2M12 7.5v2L3 16.5h18L12 9.5",...n}):null]})},r(d[0]);var l,s=r(d[1]),h=(l=s)&&l.__esModule?l:{default:l},e=r(d[2])},1187,[34,797,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Icon=function({name:l,size:x=22,colour:t}){const n={stroke:t,strokeWidth:2,fill:'none',strokeLinecap:'round',strokeLinejoin:'round'};return(0,e.jsxs)(h.default,{width:x,height:x,viewBox:"0 0 24 24",children:['home'===l?(0,e.jsx)(s.Path,{d:"M3 11l9-7 9 7v9a1 1 0 0 1-1 1h-5v-6H9v6H4a1 1 0 0 1-1-1z",...n}):null,'signoff'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"11",r:"8",...n}),(0,e.jsx)(s.Path,{d:"M11 6.5V11l3 2",...n}),(0,e.jsx)(s.Path,{d:"M15.5 19.5l2 2 4-4.2",...n})]}):null,'orders'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"5",y:"3",width:"14",height:"18",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M9 8h6M9 12h6M9 16h4",...n})]}):null,'rota'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4M7 14h4M13 14h4M7 18h6",...n})]}):null,'bookings'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4",...n})]}):null,'forecast'===l?(0,e.jsx)(s.Path,{d:"M4 20V10M10 20V4M16 20v-7M22 20H2",...n}):null,'more'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"5",cy:"12",r:"1.6",fill:t}),(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"1.6",fill:t}),(0,e.jsx)(s.Circle,{cx:"19",cy:"12",r:"1.6",fill:t})]}):null,'search'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"11",r:"7",...n}),(0,e.jsx)(s.Path,{d:"M20 20l-4-4",...n})]}):null,'bell'===l?(0,e.jsx)(s.Path,{d:"M6 16V11a6 6 0 0 1 12 0v5l2 2H4zM10 20a2 2 0 0 0 4 0",...n}):null,'chat'===l?(0,e.jsx)(s.Path,{d:"M4 5h16v11H9l-5 4z",...n}):null,'clock'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M12 7v5l3 2",...n})]}):null,'user'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"8",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M4 21a8 8 0 0 1 16 0",...n})]}):null,'walkin'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"13",cy:"4.5",r:"1.8",...n}),(0,e.jsx)(s.Path,{d:"M10 21l2-6 3 3v3M9 12l2-4 4 1 2 3M11 8l-1 5",...n})]}):null,'calendarPlus'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4M12 13v5M9.5 15.5h5",...n})]}):null,'pause'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M10 9v6M14 9v6",...n})]}):null,'rain'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M7 15a4 4 0 0 1-.6-7.95A5.5 5.5 0 0 1 17 7.5a3.75 3.75 0 0 1 .5 7.5z",...n}),(0,e.jsx)(s.Path,{d:"M9 18l-1 2.5M13 18l-1 2.5M17 18l-1 2.5",...n})]}):null,'sun'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M12 2v2M12 20v2M2 12h2M20 12h2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4",...n})]}):null,'payroll'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"4",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M7 9h6M7 13h4M15 12.5a2 2 0 1 0 0 .01M7 17h10",...n})]}):null,'tips'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M14.5 9a2.5 2.5 0 0 0-5 0c0 2.5 0 4-1.5 6h7M9 12.5h4",...n})]}):null,'sparkle'===l?(0,e.jsx)(s.Path,{d:"M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8zM19 16l.7 1.8 1.8.7-1.8.7L19 21l-.7-1.8-1.8-.7 1.8-.7z",...n}):null,'platter'===l?(0,e.jsx)(e.Fragment,{children:(0,e.jsx)(s.Path,{d:"M3 15h18M5 15a7 7 0 0 1 14 0M12 6v2M2 18h20",...n})}):null,'check'===l?(0,e.jsx)(s.Path,{d:"M5 12.5l4.5 4.5L19 7.5",...n}):null,'alert'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M12 3l9.5 17h-19z",...n}),(0,e.jsx)(s.Path,{d:"M12 10v4M12 17.2v.1",...n})]}):null,'access'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"4.5",r:"1.8",...n}),(0,e.jsx)(s.Path,{d:"M11 7.5v6h5l2.5 5M11 10h5M8 11.5a5.5 5.5 0 1 0 7.5 6.5",...n})]}):null,'dog'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 10l1-5 3 3h4l3-3 1 5v4a5 5 0 0 1-5 5h-2a5 5 0 0 1-5-5z",...n}),(0,e.jsx)(s.Path,{d:"M10 13v.1M14 13v.1M11 16h2",...n})]}):null,'leaf'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 19c0-8 5-14 15-14 0 10-6 15-14 15",...n}),(0,e.jsx)(s.Path,{d:"M5 19l8-8",...n})]}):null,'table'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"4",y:"8",width:"16",height:"8",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M8 16v4M16 16v4M8 4v4M16 4v4",...n})]}):null,'bag'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 8h14l-1 12H6z",...n}),(0,e.jsx)(s.Path,{d:"M9 10V7a3 3 0 0 1 6 0v3",...n})]}):null,'phone'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"7",y:"2.5",width:"10",height:"19",rx:"2.5",...n}),(0,e.jsx)(s.Path,{d:"M11 18.5h2",...n})]}):null,'swap'===l?(0,e.jsx)(s.Path,{d:"M7 4L3 8l4 4M3 8h14M17 20l4-4-4-4M21 16H7",...n}):null,'box'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M3.5 8L12 4l8.5 4v8L12 20l-8.5-4z",...n}),(0,e.jsx)(s.Path,{d:"M3.5 8L12 12l8.5-4M12 12v8",...n})]}):null,'star'===l?(0,e.jsx)(s.Path,{d:"M12 3.5l2.6 5.4 5.9.8-4.3 4.1 1 5.8L12 16.8l-5.2 2.8 1-5.8L3.5 9.7l5.9-.8z",...n}):null,'userPlus'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"10",cy:"8",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M3 21a7 7 0 0 1 14 0M19 8v6M16 11h6",...n})]}):null,'gift'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3.5",y:"8.5",width:"17",height:"4",rx:"1",...n}),(0,e.jsx)(s.Path,{d:"M5 12.5V20h14v-7.5M12 8.5V20M12 8.5C10 8.5 7.5 7.8 7.5 5.8S10.5 4 12 8.5c1.5-4.5 4.5-4.7 4.5-2.7S14 8.5 12 8.5z",...n})]}):null,'tag'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M3.5 12.5V4h8.5l8.5 8.5-8.5 8.5z",...n}),(0,e.jsx)(s.Circle,{cx:"8",cy:"8.5",r:"1.4",...n})]}):null,'hanger'===l?(0,e.jsx)(s.Path,{d:"M12 7.5a2 2 0 1 1 2-2M12 7.5v2L3 16.5h18L12 9.5",...n}):null]})},r(d[0]);var l,s=r(d[1]),h=(l=s)&&l.__esModule?l:{default:l},e=r(d[2])},1187,[34,797,25]); __d(function(_g,_r,i,_a,_m,e,d){"use strict";function t(t){const n=Math.max(0,Math.round(t||0)),o=Math.floor(n/60),r=n%60;return o?`${o}h ${String(r).padStart(2,'0')}m`:`${r}m`}function n(t){const n=Math.max(0,Math.round(t||0)),o=Math.floor(n/60),r=n%60;return[o?`${o} ${1===o?'hour':'hours'}`:'',r||!o?`${r} ${1===r?'minute':'minutes'}`:''].filter(Boolean).join(' ')}Object.defineProperty(e,'__esModule',{value:!0}),e.durText=t,e.durWords=n,e.isZeroShift=function(t){return!(!t.in||!t.out)&&Date.parse(t.out)-Date.parse(t.in)<6e4},Object.defineProperty(e,"isVoided",{enumerable:!0,get:function(){return o}}),e.shiftSentence=function(t,o){if('On now'===t.status)return`${o}, clocked in at ${t.inT}, still on shift.`;const r=t.zero?' Check: 0 minutes, clocked in and out at the same moment.':'';return`${o}, ${t.inT} to ${t.outT}, break ${n(t.brk)}, paid ${n(t.paid)}, ${'Approved'===t.status?'approved':'pending approval'}.${r}`},e.hoursSummary=function(n,o,r){const u=t=>null!=r?Math.round(t/60*r):null;return{approved:{mins:n,text:t(n),gross:u(n)},pending:{mins:o,text:t(o),gross:u(o)}}};const o=t=>!!t.voided},1188,[]); __d(function(g,r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ShiftCard=function({d:e,manager:t,onApprove:s,onEdit:d,onRemove:l}){const a='Confirmed'===e.status?'Approved':e.status,y=(0,u.isZeroShift)(e.a),x={date:e.date,dateText:b(e.date),inT:e.inT,outT:e.outT,brk:e.brk,paid:e.paid,status:a,zero:y};return(0,h.jsxs)(n.default,{testID:`shift-${e.a.id}`,style:{borderRadius:14,borderWidth:1,borderColor:y?c.colours.amber:'rgba(212,175,106,0.35)',backgroundColor:'#15130F',padding:12,gap:8,alignItems:'center'},children:[(0,h.jsxs)(n.default,{accessible:!0,accessibilityLabel:(0,u.shiftSentence)(x,p(e.date)),style:{alignItems:'center',gap:4,width:'100%'},children:[(0,h.jsx)(o.T,{size:16,weight:"bold",colour:c.colours.goldLight,center:!0,children:b(e.date)}),(0,h.jsx)(o.T,{size:17,weight:"semibold",center:!0,children:'On now'===e.status?`${e.inT} to now`:`${e.inT} to ${e.outT}`}),'On now'!==e.status?(0,h.jsxs)(o.T,{size:15,colour:c.colours.text,center:!0,children:["Break ",(0,u.durText)(e.brk)," \xb7 Paid ",(0,h.jsx)(o.T,{size:15,weight:"bold",colour:c.colours.gold,children:(0,u.durText)(e.paid)})]}):null,(0,h.jsx)(o.Badge,{kind:'Approved'===a?'ok':'Pending'===a?'amber':'neutral',label:'Pending'===a?'Pending approval':a}),y?(0,h.jsx)(n.default,{testID:`shift-zero-${e.a.id}`,style:{borderRadius:8,borderWidth:1,borderColor:c.colours.amber,paddingHorizontal:10,paddingVertical:4},children:(0,h.jsx)(o.T,{size:14,weight:"bold",colour:c.colours.amber,center:!0,children:"Check: 0 minutes"})}):null,e.a.added&&e.a.signOff?(0,h.jsxs)(o.Muted,{center:!0,testID:`shift-entered-${e.a.id}`,children:["Entered by ",e.a.signOff.by]}):null]}),t?(0,h.jsxs)(o.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:['Pending'===e.status&&!y&&s?(0,h.jsx)(o.Button,{label:"Approve",testID:`shift-approve-${e.a.id}`,accessibilityLabel:`Approve ${p(e.date)}, paid ${(0,u.durWords)(e.paid)}`,onPress:s,style:{minHeight:48,minWidth:120}}):null,(y||'Pending'===e.status)&&d?(0,h.jsx)(o.Button,{kind:"secondary",label:"Edit",testID:`shift-edit-${e.a.id}`,accessibilityLabel:`Edit the shift on ${p(e.date)}`,onPress:d,style:{minHeight:48,minWidth:96}}):null,y&&'Confirmed'!==e.status&&l?(0,h.jsx)(o.Button,{kind:"secondary",label:"Remove",testID:`shift-remove-${e.a.id}`,accessibilityLabel:`Remove the 0-minute shift on ${p(e.date)}. It is kept in the history.`,onPress:l,style:{minHeight:48,minWidth:96}}):null]}):null]})},_e.HoursSummaryCard=function({name:e,role:t,approved:s,pending:d,rate:l}){const p=(0,u.hoursSummary)(s,d,l),b=`${e}. Approved ${(0,u.durWords)(s)}${null!=p.approved.gross?`, ${(0,a.gbp)(p.approved.gross)}`:''}. Pending approval ${(0,u.durWords)(d)}${null!=p.pending.gross?`, ${(0,a.gbp)(p.pending.gross)} once approved`:''}.${null!=l?` Rate ${(0,a.gbp)(l)} an hour.`:''}`;return(0,h.jsxs)(n.default,{accessible:!0,accessibilityLabel:b,testID:"hours-summary-card",style:{alignItems:'center',gap:6,width:'100%'},children:[(0,h.jsx)(o.T,{size:18,weight:"bold",center:!0,children:e}),t?(0,h.jsx)(o.Muted,{center:!0,children:t}):null,(0,h.jsxs)(o.Row,{wrap:!0,gap:10,style:{justifyContent:'center'},children:[(0,h.jsxs)(n.default,{style:{minWidth:150,borderRadius:12,borderWidth:1,borderColor:c.colours.ok,padding:10,alignItems:'center'},children:[(0,h.jsx)(o.T,{size:13,weight:"semibold",colour:c.colours.ok,children:"APPROVED"}),(0,h.jsx)(o.T,{size:20,weight:"bold",testID:"sum-approved",children:p.approved.text}),(0,h.jsx)(o.Muted,{children:null!=p.approved.gross?`${(0,a.gbp)(p.approved.gross)} gross`:'no rate'})]}),(0,h.jsxs)(n.default,{style:{minWidth:150,borderRadius:12,borderWidth:1,borderColor:c.colours.amber,padding:10,alignItems:'center'},children:[(0,h.jsx)(o.T,{size:13,weight:"semibold",colour:c.colours.amber,children:"PENDING"}),(0,h.jsx)(o.T,{size:20,weight:"bold",testID:"sum-pending",children:p.pending.text}),(0,h.jsx)(o.Muted,{children:null!=p.pending.gross?`${(0,a.gbp)(p.pending.gross)} once approved`:'no rate'})]})]}),null!=l?(0,h.jsxs)(o.Muted,{center:!0,children:["Rate ",(0,a.gbp)(l)," an hour",(y=null,null==y?'':` \xb7 ${(0,a.gbp)(y)}`)]}):null]});var y},_e.RemoveShiftSheet=function({a:e,who:s,onClose:n}){const[a,u]=(0,t.useState)('Clocked in and out by mistake (0 minutes)'),p=a.trim().length>=3;return(0,h.jsxs)(o.Sheet,{visible:!0,onClose:n,title:`Remove the shift on ${b(e.date)}?`,maxWidth:520,testID:"remove-shift",children:[(0,h.jsx)(o.T,{size:16,center:!0,children:"It comes out of hours, pay and exports. It isn\u2019t deleted: it stays in the history with your name and the reason."}),(0,h.jsx)(d.TextInput,{accessibilityLabel:"Reason for removing the shift",value:a,onChangeText:u,style:{minHeight:48,borderRadius:10,borderWidth:1,borderColor:c.colours.gold,color:c.colours.text,paddingHorizontal:12}}),(0,h.jsxs)(o.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,h.jsx)(o.Button,{label:"Remove shift",testID:"remove-shift-yes",disabled:!p,onPress:()=>{l.useOwner.getState().voidEntry(e.id,s.name,s.id,a.trim(),(new Date).toISOString()),n()},style:{minHeight:56}}),(0,h.jsx)(o.Button,{kind:"secondary",label:"Keep it",onPress:n,style:{minHeight:56}})]})]})};var e,t=r(_d[0]),s=r(_d[1]),n=(e=s)&&e.__esModule?e:{default:e},o=r(_d[2]),d=r(_d[3]),l=r(_d[4]),a=r(_d[5]),u=r(_d[6]),c=r(_d[7]),h=r(_d[8]);const p=e=>new Date(`${e}T12:00:00Z`).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long',timeZone:'UTC'}),b=e=>new Date(`${e}T12:00:00Z`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',timeZone:'UTC'})},1189,[34,102,794,827,891,867,1188,821,25]); __d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"REASONS",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"isoAt",{enumerable:!0,get:function(){return S}}),_e.flagsFor=D,_e.notesFor=$,Object.defineProperty(_e,"statusLabel",{enumerable:!0,get:function(){return M}}),Object.defineProperty(_e,"statusKind",{enumerable:!0,get:function(){return O}}),_e.AuditTrail=B,_e.TimeEdit=R,_e.OverrideSheet=A,_e.outstandingDays=P,_e.useOutstanding=function(){const e=(0,r.useOwner)(e=>(0,r.liveAttendance)(e.attendance)),t=(0,r.useOwner)(e=>e.timeRequests),n=(0,u.ymd)(new Date);return(0,s.useMemo)(()=>({days:P(e,n),requests:t.filter(e=>'open'===e.status).length}),[e,t,n])},_e.SignOff=function(){const{now:e,today:t,me:n,meId:m}=(0,h.useCtx)(3e4),p=(0,r.useOwner)(e=>e.staff),x=(0,r.useOwner)(e=>(0,r.liveAttendance)(e.attendance)),j=(0,r.useOwner)(e=>e.shifts),k=(0,r.useOwner)(e=>e.timeRequests),w=(0,r.useOwner)(e=>e.leave),S=(0,s.useMemo)(()=>P(x,t),[x,t]),[I,T]=(0,s.useState)(t),[B,R]=(0,s.useState)(null),[q,z]=(0,s.useState)(null),H=(0,s.useMemo)(()=>{const n=x.filter(e=>e.date===I&&e.in),s=n.map(n=>{const s=(0,r.shiftOf)(j,n.staffId,I);return{key:n.id,staffId:n.staffId,a:n,sh:s,flags:D(n,s,e,t,k)}});j.filter(e=>e.date===I&&!1!==e.published&&!n.some(t=>t.staffId===e.staffId)).forEach(n=>{const o=(0,d.leaveCovering)(w,n.staffId,I);if(o)return void(s.some(e=>e.leave&&e.staffId===n.staffId)||s.push({key:`leave-${n.id}`,staffId:n.staffId,sh:n,flags:[],leave:o}));(I60*n.start+15)&&s.push({key:`miss-${n.id}`,staffId:n.staffId,sh:n,flags:[{key:'noin',label:'No clock-in'}]})});const o=e=>e.leave?4:e.a?'confirmed'===(0,r.attStatus)(e.a)?3:e.flags.length?0:2:1;return s.sort((e,t)=>o(e)-o(t)||(p.find(t=>t.id===e.staffId)?.name??'').localeCompare(p.find(e=>e.id===t.staffId)?.name??''))},[x,j,k,w,I,e.getMinutes(),p]),N=k.filter(e=>'open'===e.status&&e.date===I),F=k.filter(e=>'open'===e.status&&e.date!==I),E=H.filter(e=>e.a&&'awaiting'===(0,r.attStatus)(e.a)&&!e.flags.length),_=H.reduce((t,n)=>{if(!n.a)return t;const s=(0,h.paidMins)(n.a,e).paid;return'confirmed'===(0,r.attStatus)(n.a)?t.conf+=s:t.pend+=s,t},{conf:0,pend:0}),Y={confirmed:H.filter(e=>e.a&&'confirmed'===(0,r.attStatus)(e.a)).length,awaiting:H.filter(e=>e.a&&'awaiting'===(0,r.attStatus)(e.a)).length,open:H.filter(e=>e.a&&'open'===(0,r.attStatus)(e.a)).length,flagged:H.filter(e=>e.flags.length&&!(e.a&&'confirmed'===(0,r.attStatus)(e.a))).length,off:H.filter(e=>e.leave).length},L=[t,...S.map(e=>e.date).filter(e=>e!==t)];for(let e=1;L.length<8&&e<=7;e++){const n=v(t,-e);L.includes(n)||L.push(n)}const W=t=>{const s=r.useOwner.getState().confirmEntries(t,n,m,e.toISOString());z(s?`${s} ${1===s?'entry':'entries'} confirmed`:null)};return(0,b.jsxs)(a.default,{style:{gap:10},testID:"signoff",children:[S.filter(e=>e.date!==I).length?(0,b.jsx)(o.default,{accessibilityRole:"button",onPress:()=>T(S.filter(e=>e.date!==I)[S.filter(e=>e.date!==I).length-1].date),children:(0,b.jsx)(l.Banner,{kind:"warn",title:`${S.filter(e=>e.date!==I).length} earlier ${1===S.filter(e=>e.date!==I).length?'day':'days'} still to sign off`,children:"Hours only count for pay once they\u2019re confirmed. Tap to open the oldest."})}):null,(0,b.jsx)(l.Row,{wrap:!0,gap:6,children:L.slice(0,10).sort((e,t)=>t.localeCompare(e)).map(e=>{const n=S.find(t=>t.date===e);return(0,b.jsx)(l.Chip,{label:C(e,t),sub:n?`${n.n} to sign off`:void 0,selected:I===e,onPress:()=>{T(e),z(null)}},e)})}),(0,b.jsx)(l.Card,{children:(0,b.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,b.jsxs)(a.default,{style:{flex:1},children:[(0,b.jsxs)(l.T,{size:18,weight:"bold",children:[C(I,t),I===t||I===v(t,-1)?` \xb7 ${(0,u.niceDate)((0,u.parseYmd)(I))}`:'']}),(0,b.jsxs)(l.Muted,{children:[Y.confirmed," confirmed \xb7 ",Y.awaiting," awaiting \xb7 ",Y.open," still clocked in",Y.flagged?` \xb7 ${Y.flagged} flagged`:'',Y.off?` \xb7 ${Y.off} on time off`:'']})]}),(0,b.jsxs)(a.default,{style:{alignItems:'flex-end'},children:[(0,b.jsx)(l.T,{size:18,weight:"bold",colour:c.colours.ok,children:(0,h.hmDur)(_.conf)}),(0,b.jsx)(l.Muted,{children:"confirmed"}),_.pend?(0,b.jsxs)(l.T,{size:13,colour:c.colours.amber,children:[(0,h.hmDur)(_.pend)," pending"]}):null]})]})}),q?(0,b.jsx)(l.Banner,{kind:"success",title:q}):null,N.length||F.length?(0,b.jsx)(f.SectionHead,{title:"Correction requests",sub:"From the Staff app. Apply opens the times to check; declining keeps the times as clocked."}):null,[...N,...F].map(t=>{const s=p.find(e=>e.id===t.staffId),o=t.attendanceId&&x.find(e=>e.id===t.attendanceId)||x.find(e=>e.staffId===t.staffId&&e.date===t.date&&e.in);return(0,b.jsxs)(l.Card,{highlight:c.colours.blue,children:[(0,b.jsxs)(l.Row,{gap:8,children:[(0,b.jsx)(i.StaffAvatar,{id:t.staffId,size:30}),(0,b.jsxs)(a.default,{style:{flex:1},children:[(0,b.jsxs)(l.T,{weight:"semibold",children:[y(s?.name)," \xb7 ",(0,u.niceDate)((0,u.parseYmd)(t.date))]}),(0,b.jsxs)(l.Muted,{children:['in'===t.kind?'Forgot to clock in':'out'===t.kind?'Forgot to clock out':'Forgot to clock in and out',t.suggestedIn?` \xb7 in ${(0,u.hm)(new Date(t.suggestedIn))}`:'',t.suggestedOut?` \xb7 out ${(0,u.hm)(new Date(t.suggestedOut))}`:'',t.note?` \xb7 \u201c${t.note}\u201d`:'']})]}),(0,b.jsx)(l.Badge,{kind:"blue",label:"Request"})]}),(0,b.jsxs)(l.Row,{gap:6,children:[(0,b.jsx)(l.Button,{small:!0,kind:"success",label:"Review & apply",onPress:()=>R({staffId:t.staffId,a:o,request:t})}),(0,b.jsx)(l.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>r.useOwner.getState().resolveTimeRequest(t.id,'declined',n,e.toISOString())})]})]},t.id)}),(0,b.jsx)(f.SectionHead,{title:"Hours",sub:"Rostered vs actual. Flagged rows need a look and are confirmed one by one."}),H.map(t=>{const n=p.find(e=>e.id===t.staffId),s=t.a,o=s?(0,h.paidMins)(s,e):null,f=s?(0,r.attStatus)(s):null,m=s?.audit?.filter(e=>'confirmed'!==e.action).slice(-1)[0];return(0,b.jsx)(l.Card,{highlight:t.leave?c.colours.blue:'confirmed'===f?c.colours.ok:t.flags.length?c.colours.amber:void 0,children:(0,b.jsxs)(a.default,{testID:`so-row-${t.staffId}`,style:{gap:8},children:[(0,b.jsxs)(l.Row,{gap:10,children:[(0,b.jsx)(i.StaffAvatar,{id:t.staffId,size:36}),(0,b.jsxs)(a.default,{style:{flex:1},children:[(0,b.jsx)(l.T,{weight:"semibold",children:y(n?.name)}),(0,b.jsx)(l.Muted,{children:[n?.job,...$(s,n?.temp)].filter(Boolean).join(' \xb7 ')})]}),n?.temp||s?.temp?(0,b.jsx)(l.Badge,{kind:"gold",label:"Temp"}):null,s?(0,b.jsx)(l.Badge,{kind:O(s),label:M(s)}):t.leave?(0,b.jsx)(l.Badge,{kind:"blue",label:(0,d.leaveLabel)(t.leave)}):(0,b.jsx)(l.Badge,{kind:"red",label:"Missing"})]}),(0,b.jsx)(l.Row,{gap:0,style:{flexWrap:'wrap',rowGap:6},children:[['Rota',t.sh?`${(0,h.fmtH)(t.sh.start)}\u2013${(0,h.fmtH)(t.sh.end)}`:'\u2014'],['Actual',s?.in?`${(0,u.hm)(new Date(s.in))}\u2013${s.out?(0,u.hm)(new Date(s.out)):'on'}`:t.leave?(0,d.leaveLabel)(t.leave):'no clock-in'],['Break',s?.out?`${o.brk}m`:s?`${s.breakMins??0}m so far`:'\u2014'],['Paid',s?s.out?(0,h.hmDur)(o.paid):`${(0,h.hmDur)(o.worked)}\u2026`:'\u2014']].map(([e,t])=>(0,b.jsxs)(a.default,{style:{minWidth:92,flexGrow:1},children:[(0,b.jsx)(l.T,{size:11,colour:c.colours.muted,children:e.toUpperCase()}),(0,b.jsx)(l.T,{size:15,weight:"semibold",colour:'Paid'===e&&'confirmed'===f?c.colours.ok:c.colours.text,children:t})]},e))}),t.flags.length&&'confirmed'!==f?(0,b.jsx)(l.Row,{wrap:!0,gap:6,children:t.flags.map(e=>(0,b.jsx)(l.Badge,{kind:'noin'===e.key||'noout'===e.key?'red':'amber',label:e.label},e.key))}):null,t.leave?(0,b.jsxs)(l.Muted,{testID:`so-leave-${t.staffId}`,children:[(0,d.leaveNote)(t.leave),". Rota shift covered by leave: no hours counted."]}):null,m?(0,b.jsxs)(l.Muted,{children:["Adjusted by ",y(m.by),m.reason?`: ${m.reason}`:'']}):null,s?.signOff?(0,b.jsxs)(l.Muted,{children:["Confirmed by ",y(s.signOff.by)," \xb7 ",(0,u.niceDate)(new Date(s.signOff.at))," ",(0,u.hm)(new Date(s.signOff.at))]}):null,(0,b.jsxs)(l.Row,{gap:8,children:[(0,b.jsx)(l.Button,{small:!0,kind:"secondary",label:s?'Edit':'Add entry',accessibilityLabel:`${s?'Edit':'Add entry for'} ${y(n?.name)}`,onPress:()=>R({staffId:t.staffId,a:s})}),s&&'awaiting'===f?(0,b.jsx)(l.Button,{small:!0,kind:"success",label:"Confirm",accessibilityLabel:`Confirm ${y(n?.name)}`,onPress:()=>W([s.id])}):null,s&&'open'===f?(0,b.jsx)(l.Muted,{style:{alignSelf:'center'},children:"Needs a clock-out before it can be confirmed"}):null]})]})},t.key)}),H.length?null:(0,b.jsx)(l.Card,{children:(0,b.jsx)(l.Muted,{children:"No clock records or rostered shifts for this day."})}),H.length?(0,b.jsx)(l.Button,{testID:"confirm-unflagged",kind:"success",label:E.length?`Confirm all unflagged (${E.length})`:'Nothing unflagged to confirm',disabled:!E.length,onPress:()=>W(E.map(e=>e.a.id))}):null,(0,b.jsx)(l.Muted,{children:"Flags: no clock-out, 30 min or more off the rota, over 12 hours, no break on a shift over 6 hours, not on the rota, off-site, or a correction request. Editing a confirmed entry puts it back to Awaiting sign-off. Only confirmed hours count for pay, tips and exports."}),B?(0,b.jsx)(A,{a:B.a,staffId:B.staffId,date:B.request?.date??B.a?.date??I,request:B.request,onClose:()=>R(null)}):null]})};var t=_r(_d[0]),n=_r(_d[1]),s=_r(_d[2]),o=e(_r(_d[3])),a=e(_r(_d[4])),l=_r(_d[5]),i=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),f=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),p=_r(_d[14]),x=_r(_d[15]),b=_r(_d[16]);const j=['Forgot to clock in','Forgot to clock out','Wrong time'],k=[0,15,20,30,45,60],y=e=>(e??'').replace(' (example)',''),w=e=>{const t=new Date(e);return 60*t.getHours()+t.getMinutes()},S=(e,t)=>{const n=(0,u.parseYmd)(e);return n.setMinutes(t),n.toISOString()},I=e=>{const t=(e%1440+1440)%1440;return`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`},v=(e,t)=>{const n=(0,u.parseYmd)(e);return n.setDate(n.getDate()+t),(0,u.ymd)(n)},C=(e,t)=>e===t?'Today':e===v(t,-1)?'Yesterday':(0,u.niceDate)((0,u.parseYmd)(e));function D(e,t,s,o,a=[]){const l=[],i=(0,h.paidMins)(e,s),r=60*s.getHours()+s.getMinutes();if(!e.out&&(e.date60*t.end+60||i.worked>840)&&l.push({key:'noout',label:'No clock-out'}),t&&e.in){const n=w(e.in)-Math.round(60*t.start),s=e.out?w(e.out)+(e.out.slice(0,10)!==e.in.slice(0,10)&&w(e.out)=30&&l.push({key:'diff',label:`${a>=60?(0,h.hmDur)(a):`${a}m`} off the rota`})}return(0,n.isZeroShift)(e)&&l.push({key:'zero',label:'Check: 0 minutes'}),t||l.push({key:'unrostered',label:'Not on the rota'}),i.worked>720&&l.push({key:'long',label:`Very long shift (${(0,h.hmDur)(i.worked)})`}),e.out&&i.worked>360&&0===i.brk&&l.push({key:'nobreak',label:'No break (over 6h)'}),!1!==e.inSite&&!1!==e.outSite||l.push({key:'offsite',label:'Clocked off-site'}),a.some(t=>'open'===t.status&&t.staffId===e.staffId&&t.date===e.date)&&l.push({key:'request',label:'Correction requested'}),e.breakAddedAtClockOut&&l.push({key:'breakadded',label:`Break added at clock-out (${e.breakAddedAtClockOut}m)`}),e.offRota&&t&&l.push({key:'offrota',label:'Signed in off rota'}),l}function $(e,t){const n=[];return(t||e?.temp)&&n.push('Temp'),'display'!==e?.via&&'display'!==e?.outVia||n.push('via Display'),'rota'===e?.auto&&n.push(e.autoNote?`Auto from rota \xb7 ${e.autoNote}`:'Auto from rota'),n}const M=e=>{const t=(0,r.attStatus)(e);return'open'===t?'Open':'awaiting'===t?e.adjusted?'Adjusted \xb7 awaiting sign-off':'Awaiting sign-off':e.adjusted?'Confirmed \xb7 adjusted':'Confirmed'},O=e=>{const t=(0,r.attStatus)(e);return'confirmed'===t?'ok':'open'===t?'blue':'amber'},T={added:'Added entry',clock_in:'Clock-in',clock_out:'Clock-out',break:'Break',confirmed:'Confirmed',reopened:'Reopened',request_applied:'Correction request applied',request_declined:'Correction request declined',voided:'Removed (kept in history)'};function B({a:e,limit:t}){const n=[...e.audit??[]].reverse().slice(0,t??50);return n.length?(0,b.jsx)(a.default,{style:{gap:6},testID:"audit-trail",children:n.map((e,t)=>(0,b.jsxs)(a.default,{style:{flexDirection:'row',gap:8},children:[(0,b.jsx)(a.default,{style:{width:3,borderRadius:2,backgroundColor:'confirmed'===e.action?c.colours.ok:'reopened'===e.action?c.colours.amber:c.colours.gold}}),(0,b.jsxs)(a.default,{style:{flex:1},children:[(0,b.jsxs)(l.T,{size:13,weight:"semibold",children:[T[e.action],e.from||e.to?`: ${e.from??'\u2013'} \u2192 ${e.to??'\u2013'}`:'']}),(0,b.jsxs)(l.Muted,{children:[y(e.by)," \xb7 ",(0,u.niceDate)(new Date(e.at))," ",(0,u.hm)(new Date(e.at)),e.reason?` \xb7 \u201c${e.reason}\u201d`:'']})]})]},t))}):(0,b.jsx)(l.Muted,{children:"No changes yet. Times are as clocked."})}function R({label:e,mins:n,onChange:o,testID:i}){const[r,d]=(0,s.useState)(null),u=e=>{const t=/^(\d{1,2})[:.]?(\d{2})$/.exec(e.trim());t&&+t[1]<24&&+t[2]<60&&o(60*+t[1]+ +t[2]+(n>=1440&&60*+t[1]+ +t[2]<360?1440:0)),d(null)};return(0,b.jsxs)(a.default,{style:{gap:6},children:[(0,b.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(l.T,{size:13,colour:c.colours.muted,children:e}),n>=1440?(0,b.jsx)(l.Muted,{children:"next day"}):null]}),(0,b.jsxs)(l.Row,{gap:6,children:[(0,b.jsx)(l.Button,{small:!0,kind:"ghost",label:"\u221215",onPress:()=>o(n-15)}),(0,b.jsx)(l.Button,{small:!0,kind:"ghost",label:"\u22125",onPress:()=>o(n-5)}),(0,b.jsx)(t.TextInput,{testID:i,accessibilityLabel:e,value:r??I(n),onChangeText:d,onBlur:()=>null!=r&&u(r),onSubmitEditing:()=>null!=r&&u(r),style:[l.styles.input,{flex:1,textAlign:'center',fontSize:22,fontWeight:'700',paddingVertical:6,color:c.colours.text}]}),(0,b.jsx)(l.Button,{small:!0,kind:"ghost",label:"+5",onPress:()=>o(n+5)}),(0,b.jsx)(l.Button,{small:!0,kind:"ghost",label:"+15",onPress:()=>o(n+15)})]})]})}function A({a:e,staffId:t,date:n,request:o,onClose:i}){const{me:d,meId:I,now:v,role:C}=(0,h.useCtx)(3e4),[D,$]=(0,s.useState)(!1),T=!!e&&(0,m.canSeeHoursEdit)({role:C,isCar:p.IS_CAR}),A=(0,r.useOwner)(e=>e.staff.find(e=>e.id===t)?.name),P=(0,r.useOwner)(e=>e.shifts),q=(0,r.shiftOf)(P,t,n),z=o?.suggestedIn?w(o.suggestedIn):e?.in?Math.round((new Date(e.in).getTime()-(0,u.parseYmd)(n).getTime())/6e4):q?Math.round(60*q.start):720,H=o?.suggestedOut??e?.out,N=H?(F=H,Math.round((new Date(F).getTime()-(0,u.parseYmd)(n).getTime())/6e4)):e&&e.in&&!e.out?null:q?Math.round(60*q.end):z+480;var F;const[E,_]=(0,s.useState)(z),[Y,L]=(0,s.useState)(N),[W,V]=(0,s.useState)(e?.breakMins??(q&&q.end-q.start>6?30:0)),[G,K]=(0,s.useState)(o?'out'===o.kind?j[1]:j[0]:e?e.in&&!e.out?j[1]:null:j[0]),[U,Z]=(0,s.useState)(''),[J,Q]=(0,s.useState)(null),X=[G,U.trim()].filter(Boolean).join(': ')+(o&&o.note?` (request: ${o.note})`:''),ee=null!=Y?Y-E:0,te=e?(0,h.paidMins)(e,v):null,ne=null!=Y?Math.max(0,ee-W):null,se=e&&'confirmed'===(0,r.attStatus)(e),oe=null!=Y&&Y<=E?'Clock-out must be after clock-in.':ee>1200?'A shift can\u2019t be longer than 20 hours.':null!=Y&&W>=ee?'The break is longer than the shift.':null,ae=e?.in&&!o&&E===z?e.in:S(n,E),le=null==Y?void 0:e?.out&&!o&&Y===N?e.out:S(n,Y),ie=!e||ae!==e.in||(le??'')!==(e.out??'')||(e.breakMins??0)!==W;return(0,b.jsxs)(l.Sheet,{visible:!0,onClose:i,title:`${e?'Edit hours':'Add missing entry'} \xb7 ${y(A)} \xb7 ${(0,u.niceDate)((0,u.parseYmd)(n))}`,testID:"override-sheet",children:[(0,b.jsxs)(l.Row,{gap:8,style:{flexWrap:'wrap'},children:[e?(0,b.jsx)(l.Badge,{kind:O(e),label:M(e)}):(0,b.jsx)(l.Badge,{kind:"red",label:"No clock record"}),q?(0,b.jsx)(l.Badge,{kind:"neutral",label:`Rota ${(0,h.fmtH)(q.start)}\u2013${(0,h.fmtH)(q.end)}`}):(0,b.jsx)(l.Badge,{kind:"neutral",label:"Not on the rota"}),e?.in?(0,b.jsx)(l.Badge,{kind:"neutral",label:`Clocked ${(0,u.hm)(new Date(e.in))}\u2013${e.out?(0,u.hm)(new Date(e.out)):'still on'}`}):null]}),o?(0,b.jsxs)(l.Banner,{kind:"info",title:`${y(A)} asked for a correction`,children:['in'===o.kind?'Forgot to clock in':'out'===o.kind?'Forgot to clock out':'Forgot to clock in and out',o.suggestedIn?` \xb7 in ${(0,u.hm)(new Date(o.suggestedIn))}`:'',o.suggestedOut?` \xb7 out ${(0,u.hm)(new Date(o.suggestedOut))}`:'',o.note?` \xb7 \u201c${o.note}\u201d`:'',". The suggested times are filled in below."]}):null,(0,b.jsx)(R,{label:"Clock in",mins:E,onChange:_,testID:"ov-in"}),null!=Y?(0,b.jsx)(R,{label:"Clock out",mins:Y,onChange:L,testID:"ov-out"}):(0,b.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(l.Muted,{children:"No clock-out yet."}),(0,b.jsx)(l.Button,{small:!0,kind:"secondary",label:"Add clock-out",onPress:()=>L(q?Math.round(60*q.end):Math.min(E+480,60*v.getHours()+v.getMinutes()>E?60*v.getHours()+v.getMinutes():E+480))})]}),(0,b.jsx)(l.T,{size:13,colour:c.colours.muted,children:"Break"}),(0,b.jsxs)(l.Row,{wrap:!0,gap:6,children:[k.map(e=>(0,b.jsx)(l.Chip,{label:0===e?'None':`${e} min`,selected:W===e,onPress:()=>V(e)},e)),(0,b.jsx)(l.Stepper,{value:W,min:0,max:240,onChange:V,label:"break minutes"})]}),(0,b.jsx)(l.T,{size:13,colour:c.colours.muted,children:"Reason (required, kept in the audit trail)"}),(0,b.jsx)(l.Row,{wrap:!0,gap:6,children:j.map(e=>(0,b.jsx)(l.Chip,{label:e,selected:G===e,onPress:()=>K(G===e?null:e)},e))}),(0,b.jsx)(l.Field,{label:G?'Add detail (optional)':'Or type a reason',value:U,onChangeText:Z,placeholder:"e.g. stayed late for a function",maxLength:150}),(0,b.jsxs)(l.Card,{style:{backgroundColor:c.colours.surface2},children:[(0,b.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(l.T,{children:"Paid hours"}),(0,b.jsx)(l.T,{weight:"bold",colour:c.colours.gold,children:null!=ne?(0,h.hmDur)(ne):'still on shift'})]}),te&&e?.out?(0,b.jsxs)(l.Muted,{children:["Was ",(0,h.hmDur)(te.paid)," (",(0,u.hm)(new Date(e.in)),"\u2013",(0,u.hm)(new Date(e.out)),", ",te.brk,"m break)"]}):null,se?(0,b.jsx)(l.T,{size:13,colour:c.colours.amber,children:"This entry was confirmed. Saving puts it back to Awaiting sign-off (logged)."}):null]}),oe?(0,b.jsx)(l.T,{size:13,colour:c.colours.red,children:oe}):null,J?(0,b.jsx)(l.T,{size:13,colour:c.colours.red,children:J}):null,(0,b.jsx)(l.Button,{testID:"ov-save",kind:"success",label:e?'Save change':'Add entry',disabled:!!oe||!ie||X.trim().length<3,onPress:()=>{r.useOwner.getState().overrideEntry({id:e?.id,staffId:t,date:n,in:ae,out:le,breakMins:W,reason:X.slice(0,200),by:d,byId:I,now:v.toISOString(),request:o?.id})?(o&&r.useOwner.getState().resolveTimeRequest(o.id,'applied',d,v.toISOString()),i()):Q('Couldn\u2019t save: check the times and the reason.')}}),T?(0,b.jsx)(a.default,{style:{alignItems:'center',width:'100%'},children:(0,b.jsx)(l.Button,{testID:"ov-delete-entry",kind:"ghost",label:"Delete entry",accessibilityLabel:"Delete entry",onPress:()=>$(!0),style:{minHeight:48,minWidth:160}})}):null,e&&D?(0,b.jsx)(x.DeleteShiftSheet,{a:e,onClose:()=>$(!1),onDeleted:i}):null,e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(f.SectionHead,{title:"Audit trail",sub:"Every change: what, from, to, who, when and why"}),(0,b.jsx)(B,{a:e})]}):null]})}function P(e,t){const n=new Map;return e.forEach(e=>{e.date({date:e,n:t})).sort((e,t)=>t.date.localeCompare(e.date))}},1190,[827,1188,34,402,102,794,925,891,1094,858,821,1181,1084,1191,872,1192,25]); diff --git a/chef-app/admin.html b/chef-app/admin.html index 90029b3fe25fcab0706a47fa634a0f1d7513265b..34d90e1b5b2130aa7cceaefdf8629e1b1203c672 100644 --- a/chef-app/admin.html +++ b/chef-app/admin.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/chef-app/customer.html b/chef-app/customer.html index 90029b3fe25fcab0706a47fa634a0f1d7513265b..34d90e1b5b2130aa7cceaefdf8629e1b1203c672 100644 --- a/chef-app/customer.html +++ b/chef-app/customer.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/chef-app/customer/anchorage.html b/chef-app/customer/anchorage.html index 90029b3fe25fcab0706a47fa634a0f1d7513265b..34d90e1b5b2130aa7cceaefdf8629e1b1203c672 100644 --- a/chef-app/customer/anchorage.html +++ b/chef-app/customer/anchorage.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/chef-app/customer/anchorage/book.html b/chef-app/customer/anchorage/book.html index 90029b3fe25fcab0706a47fa634a0f1d7513265b..34d90e1b5b2130aa7cceaefdf8629e1b1203c672 100644 --- a/chef-app/customer/anchorage/book.html +++ b/chef-app/customer/anchorage/book.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/chef-app/customer/anchorage/feedback.html b/chef-app/customer/anchorage/feedback.html index 90029b3fe25fcab0706a47fa634a0f1d7513265b..34d90e1b5b2130aa7cceaefdf8629e1b1203c672 100644 --- a/chef-app/customer/anchorage/feedback.html +++ b/chef-app/customer/anchorage/feedback.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/chef-app/customer/anchorage/gift.html b/chef-app/customer/anchorage/gift.html index 90029b3fe25fcab0706a47fa634a0f1d7513265b..34d90e1b5b2130aa7cceaefdf8629e1b1203c672 100644 --- a/chef-app/customer/anchorage/gift.html +++ b/chef-app/customer/anchorage/gift.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/chef-app/customer/anchorage/lost.html b/chef-app/customer/anchorage/lost.html index 90029b3fe25fcab0706a47fa634a0f1d7513265b..34d90e1b5b2130aa7cceaefdf8629e1b1203c672 100644 --- a/chef-app/customer/anchorage/lost.html +++ b/chef-app/customer/anchorage/lost.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/chef-app/customer/anchorage/loyalty.html b/chef-app/customer/anchorage/loyalty.html index 90029b3fe25fcab0706a47fa634a0f1d7513265b..34d90e1b5b2130aa7cceaefdf8629e1b1203c672 100644 --- a/chef-app/customer/anchorage/loyalty.html +++ b/chef-app/customer/anchorage/loyalty.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/chef-app/customer/anchorage/merch.html b/chef-app/customer/anchorage/merch.html index 90029b3fe25fcab0706a47fa634a0f1d7513265b..34d90e1b5b2130aa7cceaefdf8629e1b1203c672 100644 --- a/chef-app/customer/anchorage/merch.html +++ b/chef-app/customer/anchorage/merch.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/chef-app/customer/anchorage/offers.html b/chef-app/customer/anchorage/offers.html index 90029b3fe25fcab0706a47fa634a0f1d7513265b..34d90e1b5b2130aa7cceaefdf8629e1b1203c672 100644 --- a/chef-app/customer/anchorage/offers.html +++ b/chef-app/customer/anchorage/offers.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/chef-app/customer/anchorage/refer.html b/chef-app/customer/anchorage/refer.html index 90029b3fe25fcab0706a47fa634a0f1d7513265b..34d90e1b5b2130aa7cceaefdf8629e1b1203c672 100644 --- a/chef-app/customer/anchorage/refer.html +++ b/chef-app/customer/anchorage/refer.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/chef-app/customer/anchorage/waitlist.html b/chef-app/customer/anchorage/waitlist.html index 90029b3fe25fcab0706a47fa634a0f1d7513265b..34d90e1b5b2130aa7cceaefdf8629e1b1203c672 100644 --- a/chef-app/customer/anchorage/waitlist.html +++ b/chef-app/customer/anchorage/waitlist.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/chef-app/customer/anchorage/whatson.html b/chef-app/customer/anchorage/whatson.html index 90029b3fe25fcab0706a47fa634a0f1d7513265b..34d90e1b5b2130aa7cceaefdf8629e1b1203c672 100644 --- a/chef-app/customer/anchorage/whatson.html +++ b/chef-app/customer/anchorage/whatson.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/chef-app/customer/basket.html b/chef-app/customer/basket.html index 90029b3fe25fcab0706a47fa634a0f1d7513265b..34d90e1b5b2130aa7cceaefdf8629e1b1203c672 100644 --- a/chef-app/customer/basket.html +++ b/chef-app/customer/basket.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/chef-app/customer/profile.html b/chef-app/customer/profile.html index 90029b3fe25fcab0706a47fa634a0f1d7513265b..34d90e1b5b2130aa7cceaefdf8629e1b1203c672 100644 --- a/chef-app/customer/profile.html +++ b/chef-app/customer/profile.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/chef-app/demo.html b/chef-app/demo.html index 90029b3fe25fcab0706a47fa634a0f1d7513265b..34d90e1b5b2130aa7cceaefdf8629e1b1203c672 100644 --- a/chef-app/demo.html +++ b/chef-app/demo.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/chef-app/display.html b/chef-app/display.html index 90029b3fe25fcab0706a47fa634a0f1d7513265b..34d90e1b5b2130aa7cceaefdf8629e1b1203c672 100644 --- a/chef-app/display.html +++ b/chef-app/display.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/chef-app/index.html b/chef-app/index.html index c5bb3af134ca81175c0c17395a7d178169026f2b..4bb1b82177774db66fcfe8942f2c765edf7ef583 100644 --- a/chef-app/index.html +++ b/chef-app/index.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/chef-app/kitchen.html b/chef-app/kitchen.html index 90029b3fe25fcab0706a47fa634a0f1d7513265b..34d90e1b5b2130aa7cceaefdf8629e1b1203c672 100644 --- a/chef-app/kitchen.html +++ b/chef-app/kitchen.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/chef-app/owner.html b/chef-app/owner.html index 90029b3fe25fcab0706a47fa634a0f1d7513265b..34d90e1b5b2130aa7cceaefdf8629e1b1203c672 100644 --- a/chef-app/owner.html +++ b/chef-app/owner.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/chef-app/staff.html b/chef-app/staff.html index 90029b3fe25fcab0706a47fa634a0f1d7513265b..34d90e1b5b2130aa7cceaefdf8629e1b1203c672 100644 --- a/chef-app/staff.html +++ b/chef-app/staff.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/chef-app/sw.js b/chef-app/sw.js index f6ce1d60bdb7df4ae779800f4ef1ad0f9e82c5a0..346f9386bc1bae0aca060f20a8c31a431df3aa72 100644 --- a/chef-app/sw.js +++ b/chef-app/sw.js @@ -1,7 +1,7 @@ // Anchorage Head Chef service worker: precache the app shell so it opens offline after the first visit. -const V = "cc-chef-28cd4f69a2"; +const V = "cc-chef-0dd1a6a93f"; const BASE = "/chef-app/"; -const PRECACHE = ["/chef-app/apple-touch-icon.png", "/chef-app/assets/assets/brand/3idiots-hero.e5dfd53739f05086b1956e72d585a66a.png", "/chef-app/assets/assets/brand/3idiots.df4a76d2130f0e5b0042f06a8c88693a.png", "/chef-app/assets/assets/brand/abbotsford-hero.78fcb8ee06ee22c4ca659c9254db7512.png", "/chef-app/assets/assets/brand/abbotsford.b26602bba5ce4969733c5422a45ad053.png", "/chef-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/chef-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/chef-app/assets/assets/brand/brae.8de9e89ac30966c6669de990370d8e40.png", "/chef-app/assets/assets/brand/cecchinis-hero.f77780fcc94fd668cf35d66d6dc52d81.png", "/chef-app/assets/assets/brand/cecchinis.ebf752fef363247848ae7c0d91938765.png", "/chef-app/assets/assets/brand/drunkencoo-hero.65c21c4da9e466cf4bffc969639a1427.png", "/chef-app/assets/assets/brand/drunkencoo.f6d92af3b14e4205a3deaf4434754c51.png", "/chef-app/assets/assets/brand/greenside-hero.1caec5a6cb939434cccb5f3a613b50f8.png", "/chef-app/assets/assets/brand/greenside.9d1556db97dcb903a3c57e2063ee2255.png", "/chef-app/assets/assets/brand/kirkmichael-hero.63b13cde7fd82eb622622b39ac80c394.png", "/chef-app/assets/assets/brand/kirkmichael.63b13cde7fd82eb622622b39ac80c394.png", "/chef-app/assets/assets/brand/kirkton-hero.9d0837b292c2f4f30f4521d806bb28c3.png", "/chef-app/assets/assets/brand/kirkton.bcf8d846df4861474d224a7a77f498fb.png", "/chef-app/assets/assets/brand/mrbasrais-hero.4ce74641cfcf52d099157c84005b9d2a.png", "/chef-app/assets/assets/brand/mrbasrais.7cc4086dd12ace82529795f1c9f8c900.png", "/chef-app/assets/assets/brand/pizzaioli-hero.1896657c08264cefb49b401891d5448d.png", "/chef-app/assets/assets/brand/pizzaioli.db8c000b62ee407121aa8b90ce45e170.png", "/chef-app/assets/assets/brand/rupeeroom-hero.969fa372add526aaacf3a6c009b8ac92.png", "/chef-app/assets/assets/brand/rupeeroom.689e6fb536dc0845eeb174a1ec7bd346.png", "/chef-app/assets/assets/brand/saltmarsh.85a6a65732635e5148478d743d9ca884.png", "/chef-app/assets/assets/brand/smokinggoat-hero.0588f17ef0eed7f757f22916cd4d37db.png", "/chef-app/assets/assets/brand/smokinggoat.20a3a1970596ab43c5d6468d4ed549a7.png", "/chef-app/assets/assets/brand/souters.f4c58d9349b6e1700fe5abcc9e9b665c.png", "/chef-app/assets/assets/brand/wildings-hero-logo-text.4661e4b935726f2511f9c17a1567c89a.png", "/chef-app/assets/assets/brand/wildings.076f4fcd06d19a0af0205c410f461b14.png", "/chef-app/assets/assets/brand/williewastles-hero.b9d53d27b66f903b5618a7177b2ffad4.png", "/chef-app/assets/assets/brand/williewastles.055a77893ced99bf3a6c5402ba5baac6.png", "/chef-app/assets/assets/brand/yasmins-hero.a5aef62e37dfcecbe0afc056186f4ad9.png", "/chef-app/assets/assets/brand/yasmins.8482602e9f0a965655924835625cb02b.png", "/chef-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/chef-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/chef-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/chef-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/chef-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/chef-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/chef-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/chef-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/chef-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/chef-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/chef-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/chef-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/chef-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/chef-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/chef-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/chef-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/chef-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/chef-app/brand-logo.png", "/chef-app/favicon.ico", "/chef-app/icon-192.png", "/chef-app/icon-512.png", "/chef-app/icon-maskable-192.png", "/chef-app/icon-maskable-512.png", "/chef-app/manifest.webmanifest", "/chef-app/index.html", "/chef-app/_expo/static/js/web/bundle.js?v=28cd4f69a2b1759dea2ae8e7f8eefbadb64bd480a05c6006b396e2c45caf30b7"]; +const PRECACHE = ["/chef-app/apple-touch-icon.png", "/chef-app/assets/assets/brand/3idiots-hero.e5dfd53739f05086b1956e72d585a66a.png", "/chef-app/assets/assets/brand/3idiots.df4a76d2130f0e5b0042f06a8c88693a.png", "/chef-app/assets/assets/brand/abbotsford-hero.78fcb8ee06ee22c4ca659c9254db7512.png", "/chef-app/assets/assets/brand/abbotsford.b26602bba5ce4969733c5422a45ad053.png", "/chef-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/chef-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/chef-app/assets/assets/brand/brae.8de9e89ac30966c6669de990370d8e40.png", "/chef-app/assets/assets/brand/cecchinis-hero.f77780fcc94fd668cf35d66d6dc52d81.png", "/chef-app/assets/assets/brand/cecchinis.ebf752fef363247848ae7c0d91938765.png", "/chef-app/assets/assets/brand/drunkencoo-hero.65c21c4da9e466cf4bffc969639a1427.png", "/chef-app/assets/assets/brand/drunkencoo.f6d92af3b14e4205a3deaf4434754c51.png", "/chef-app/assets/assets/brand/greenside-hero.1caec5a6cb939434cccb5f3a613b50f8.png", "/chef-app/assets/assets/brand/greenside.9d1556db97dcb903a3c57e2063ee2255.png", "/chef-app/assets/assets/brand/kirkmichael-hero.63b13cde7fd82eb622622b39ac80c394.png", "/chef-app/assets/assets/brand/kirkmichael.63b13cde7fd82eb622622b39ac80c394.png", "/chef-app/assets/assets/brand/kirkton-hero.9d0837b292c2f4f30f4521d806bb28c3.png", "/chef-app/assets/assets/brand/kirkton.bcf8d846df4861474d224a7a77f498fb.png", "/chef-app/assets/assets/brand/mrbasrais-hero.4ce74641cfcf52d099157c84005b9d2a.png", "/chef-app/assets/assets/brand/mrbasrais.7cc4086dd12ace82529795f1c9f8c900.png", "/chef-app/assets/assets/brand/pizzaioli-hero.1896657c08264cefb49b401891d5448d.png", "/chef-app/assets/assets/brand/pizzaioli.db8c000b62ee407121aa8b90ce45e170.png", "/chef-app/assets/assets/brand/rupeeroom-hero.969fa372add526aaacf3a6c009b8ac92.png", "/chef-app/assets/assets/brand/rupeeroom.689e6fb536dc0845eeb174a1ec7bd346.png", "/chef-app/assets/assets/brand/saltmarsh.85a6a65732635e5148478d743d9ca884.png", "/chef-app/assets/assets/brand/smokinggoat-hero.0588f17ef0eed7f757f22916cd4d37db.png", "/chef-app/assets/assets/brand/smokinggoat.20a3a1970596ab43c5d6468d4ed549a7.png", "/chef-app/assets/assets/brand/souters.f4c58d9349b6e1700fe5abcc9e9b665c.png", "/chef-app/assets/assets/brand/wildings-hero-logo-text.4661e4b935726f2511f9c17a1567c89a.png", "/chef-app/assets/assets/brand/wildings.076f4fcd06d19a0af0205c410f461b14.png", "/chef-app/assets/assets/brand/williewastles-hero.b9d53d27b66f903b5618a7177b2ffad4.png", "/chef-app/assets/assets/brand/williewastles.055a77893ced99bf3a6c5402ba5baac6.png", "/chef-app/assets/assets/brand/yasmins-hero.a5aef62e37dfcecbe0afc056186f4ad9.png", "/chef-app/assets/assets/brand/yasmins.8482602e9f0a965655924835625cb02b.png", "/chef-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/chef-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/chef-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/chef-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/chef-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/chef-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/chef-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/chef-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/chef-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/chef-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/chef-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/chef-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/chef-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/chef-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/chef-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/chef-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/chef-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/chef-app/brand-logo.png", "/chef-app/favicon.ico", "/chef-app/icon-192.png", "/chef-app/icon-512.png", "/chef-app/icon-maskable-192.png", "/chef-app/icon-maskable-512.png", "/chef-app/manifest.webmanifest", "/chef-app/index.html", "/chef-app/_expo/static/js/web/bundle.js?v=0dd1a6a93fcaae023bdf2382a0e95b6ecf20c5286ede269577c2adb4f4cc2bf6"]; // Hugging Face serves large files (fonts) through a redirect to its CDN. Browsers refuse to hand a *redirected* cached // response to a page, so store a plain copy instead (otherwise fonts, and so the app, fail to load offline). const plain = r => r.redirected ? r.blob().then(b => new Response(b, { status: 200, headers: { 'Content-Type': r.headers.get('Content-Type') || b.type || 'application/octet-stream' } })) : Promise.resolve(r); diff --git a/chef-app/team.html b/chef-app/team.html index 90029b3fe25fcab0706a47fa634a0f1d7513265b..34d90e1b5b2130aa7cceaefdf8629e1b1203c672 100644 --- a/chef-app/team.html +++ b/chef-app/team.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/customer-app/_expo/static/js/web/bundle.js b/customer-app/_expo/static/js/web/bundle.js index d8e75c02dd2822e52373678396462d03cfd57775..591688a192315564e68c5d2d5dd5f405395ef224 100644 --- a/customer-app/_expo/static/js/web/bundle.js +++ b/customer-app/_expo/static/js/web/bundle.js @@ -872,7 +872,7 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{v __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},789,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},790,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},791,[]); -__d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ChefApp=function({section:e}={}){const{r:s,rid:o,me:n,now:L}=(0,M.useChef)(3e4);(0,fe.useReviewAlerts)(o);const _=(0,N.useSignedIn)(),U=_?.id??M.CHEF_ID,q=_?.ownerAccess&&'owner'!==_.role?'owner privileges':_?.managerAccess&&'staff'===_.role?'manager privileges':'',be=(0,xe.useSync)(e=>e.perms),ye=be.includes('*')||be.includes('takings.view');(0,i.useSoldOutLink)(!0,(_?.name??n).replace(' (example)',''));const Se=e?Te[e]:void 0,[Ie,He]=(0,I.useState)(Se?.tab??'home'),[Re,Ae]=(0,I.useState)(Se?.k??null),[De,Be]=(0,I.useState)(Se?.stock??'levels'),[$e,Oe]=(0,I.useState)(void 0),[Ee,Fe]=(0,I.useState)(Se?.gp??'dishes'),Le=(0,I.useRef)(null),Ge=(0,k.ymd)(L),Ne=(0,k.ymd)(new Date(L.getTime()+864e5));(0,p.useTipsPosted)(o,Ge);const Me=(0,X.useTravelDay)('chef',Ge),We='home'===Ie&&!Me;(0,P.useKitchenTodoChime)(o,Ge,()=>Ue('kitchen','bookings')),(0,he.useAlertWatcher)(o,{kinds:['takeaway']}),(0,I.useEffect)(()=>{(0,N.ensureAttendance)((new Date).toISOString().slice(0,10),L)},[]);const Ke=(0,I.useRef)({t:'home',k:null});Ke.current={t:Ie,k:Re};const Ve=(0,I.useRef)([]),ze=(0,l.useScrollMemory)(Le),Ue=(0,I.useCallback)((e,t=null)=>{'takings'!==t||ye||(t=null);const s=Ke.current;s.t===e&&s.k===t||(Ve.current=[...Ve.current,{...s,y:ze.leave()}].slice(-30),ze.restore(0)),He(e),Ae(t)},[ye]),qe=(0,I.useCallback)(()=>{if((0,r.runBackLayer)())return!0;const e=Ke.current;let t=Ve.current.pop();for(;t&&t.t===e.t&&t.k===e.k;)t=Ve.current.pop();if(!t&&'home'===e.t&&!e.k)return!1;const s=t??{t:'home',k:null};return ze.leave(),He(s.t),Ae(s.k),ze.restore(s.y??0),!0},[]);(0,r.useWebBack)(qe);const Qe=(0,r.useInnerBackShown)();(0,I.useEffect)(()=>{c.PITCH&&(globalThis.__pitchGo=(e,t=null,s)=>{'stock'===e&&s&&Be(s),'gp'===e&&s&&Fe(s),Ue(e,t)})},[Ue]),(0,f.useShiftReminders)({rid:o,staffId:U,name:n,kitchen:!0}),(0,C.useScheduledNotices)({rid:o,staffId:_?.id??'',name:n,onOpen:e=>{'orderlists'===e&&Ue('kitchen','orderlists'),'chat'===e&&Ue('kitchen','live')}}),(0,T.useOffRotaPrompt)({rid:o,staffId:_?.id??''}),(0,I.useEffect)(()=>{const e=H.default.addEventListener('hardwareBackPress',qe);return()=>e.remove()},[qe]),(0,I.useEffect)(()=>{'takings'!==Re||ye||(Ae(null),He('kitchen'))},[Re,ye]);const Ye=Ce.filter(e=>'takings'!==e.id||ye),Je=Re&&('takings'!==Re||ye)?Ce.find(e=>e.id===Re):null,Xe=((0,D.default)().width,Je?Je.title:{home:'Today in the kitchen',stock:c.PITCH?'Stock':'Deliveries & stock',gp:'GP & costing',creator:le.CREATOR_TITLE,orders:'Orders',kitchen:'Kitchen'}[Ie]);return(0,ve.jsxs)($.SafeAreaView,{style:{flex:1,backgroundColor:G.colours.bg},edges:['top','bottom'],children:[(0,ve.jsxs)(B.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:G.colours.border,gap:6},children:[(0,ve.jsx)(B.default,{style:{position:'absolute',top:4,right:6,zIndex:5,flexDirection:'row',alignItems:'center'},children:(0,ve.jsx)(E.VoiceSlot,{size:44})}),(0,ve.jsx)(B.default,{testID:"header-me-wrap",style:{alignItems:'flex-start',minHeight:44,justifyContent:'center',maxWidth:'70%'},children:(0,ve.jsx)(B.default,{testID:"header-me",accessibilityLabel:`Signed in as ${n.replace(' (example)','')}, Head Chef${q?`, ${q}`:''}`,style:{borderWidth:1,borderColor:G.colours.gold,borderRadius:16,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%'},children:(0,ve.jsxs)(F.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,ve.jsx)(ie.StaffAvatar,{id:M.CHEF_ID,size:24,ring:!1}),(0,ve.jsxs)(B.default,{style:{flexShrink:1},children:[(0,ve.jsxs)(F.T,{size:13,weight:"semibold",colour:G.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[n.replace(' (example)','')," \xb7 Head Chef"]}),q?(0,ve.jsx)(F.Muted,{center:!1,size:10,numberOfLines:1,children:q}):null]})]})})}),(0,ve.jsx)(O.VenueHeaderBlock,{rid:o,name:s.name,badge:"CHEF",place:"Head Chef app"}),(0,ve.jsx)(R.default,{accessibilityRole:"button",accessibilityLabel:"Open CoverCharge for Staff",onPress:()=>{const e=(0,ae.appUrl)('staff');e&&window.location.assign(e)},style:{alignSelf:'center',borderWidth:1,borderColor:G.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:3,minHeight:44,justifyContent:'center'},children:(0,ve.jsx)(F.T,{size:13,colour:G.colours.gold,children:"Staff app \u203a"})})]}),(0,ve.jsxs)(A.default,{ref:Le,...ze.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:[(0,ve.jsx)(r.BackTitleRow,{back:!('home'===Ie&&!Re||Qe),onBack:qe,title:Xe}),'home'===Ie?(0,ve.jsx)(X.DayBar,{app:"chef",today:Ge}):null,'home'===Ie&&Me?(0,ve.jsx)(X.DayView,{rid:o,day:Me,today:Ge,app:"chef"}):null,'home'===Ie?(0,ve.jsx)(oe.WhoBar,{}):null,We&&_?(0,ve.jsx)(h.MyTasksToday,{rid:o,staffId:_.id,name:_.name,onShift:(0,f.shiftNow)(_.id,L.getTime()).on}):null,We?(0,ve.jsx)(p.TodaysTipsCard,{rid:o,today:Ge}):null,We?(0,ve.jsx)(p.TipsPotCard,{rid:o,today:Ge}):null,We?(0,ve.jsx)(b.CoversToday,{rid:o,onPress:()=>Ue('kitchen','bookings')}):null,We?(0,ve.jsx)(y.LastFoodBanner,{rid:o,now:L}):null,We?(0,ve.jsx)(x.NextTableFreeCard,{rid:o,now:L}):null,We?(0,ve.jsx)(j.KitchenSignoffs,{rid:o,today:Ge,by:n,app:"chef"}):null,We?(0,ve.jsxs)(B.default,{style:{gap:4},children:[(0,ve.jsx)(j.PlattersBooked,{rid:o,date:Ge,label:"Platters booked today"}),(0,ve.jsx)(j.PlattersBooked,{rid:o,date:Ne,label:"Platters booked tomorrow"})]}):null,We?(0,ve.jsx)(me.ChefAssistantButton,{}):null,We?(0,ve.jsx)(Pe,{go:(e,t)=>{'stock'===e&&t&&Be(t),'gp'===e&&t&&Fe(t),'orders'===e&&Oe(t),Ue(e,'kitchen'===e?t??null:null)}}):null,'stock'!==Ie||c.PITCH?null:(0,ve.jsx)(Y.KitchenCosts,{rid:o,me:(_?.name??n).replace(' (example)',''),actor:{name:(_?.name??n).replace(' (example)',''),role:'head-chef'},initial:'deliveries'===De?'deliveries':'take'===De?'count':'deliveries'},`s-${De}`),'gp'!==Ie||c.PITCH?null:(0,ve.jsx)(Y.KitchenCosts,{rid:o,me:(_?.name??n).replace(' (example)',''),actor:{name:(_?.name??n).replace(' (example)',''),role:'head-chef'},initial:"dishgp"},`g-${Ee}`),'stock'===Ie&&c.PITCH?(0,ve.jsx)(Q.StockScreen,{initial:De},De):null,'gp'===Ie&&c.PITCH?(0,ve.jsx)(W.GpScreen,{initial:Ee},Ee):null,'creator'===Ie?(0,ve.jsx)(le.DishCreator,{rid:o,canPublish:!1}):null,'orders'===Ie?(0,ve.jsx)(z.OrdersScreen,{focus:$e},$e??'all'):null,'kitchen'!==Ie||Je?null:(0,ve.jsxs)(B.default,{style:{gap:10},children:[(0,ve.jsx)(B.default,{style:{borderRadius:14,borderWidth:1,borderColor:G.colours.border,backgroundColor:G.colours.surface,overflow:'hidden'},children:Ye.map((e,t)=>(0,ve.jsx)(R.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>Ue(Ie,e.id),style:({pressed:e})=>({padding:12,borderTopWidth:t?1:0,borderColor:G.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,ve.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,ve.jsxs)(B.default,{style:{flex:1},children:[(0,ve.jsx)(F.T,{weight:"medium",children:e.title}),(0,ve.jsx)(F.Muted,{children:e.sub})]}),(0,ve.jsx)(F.T,{colour:G.colours.muted,children:"\u203a"})]})},e.id))}),(0,ve.jsx)(F.Muted,{children:"Head Chef sees kitchen, stock, food costs and GP. Payroll, wages and the restaurant's billing stay in CoverCharge for Managers."}),(0,ve.jsxs)(F.Muted,{center:!0,children:["Head Chef app \xb7 ",d.APP_VERSION," \xb7 ",'live'===xe.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),'myshift'===Re&&U?(0,ve.jsxs)(B.default,{style:{gap:10},testID:"chef-myshift",children:[(0,ve.jsx)(te.ClockInOut,{}),(0,ve.jsx)(se.MyUpcomingShifts,{staffId:U,team:!0})]}):null,'mypay'===Re?(0,ve.jsxs)(B.default,{style:{gap:10},testID:"chef-mypay",children:[(0,ve.jsx)(Z.MyPeriods,{staffId:U}),(0,ve.jsx)(J.MyHoursPay,{staffId:U}),(0,ve.jsx)(ee.MyTips,{staffId:U}),(0,ve.jsx)(F.Card,{children:(0,ve.jsx)(u.PhoneAlerts,{})})]}):null,'alerts'===Re?(0,ve.jsx)(B.default,{testID:"chef-alerts",children:(0,ve.jsx)(u.PhoneAlerts,{})}):null,'avatar'===Re?(0,ve.jsx)(t.AvatarMaker,{meId:_?.id??M.CHEF_ID,me:n}):null,'reviews'===Re?(0,ve.jsx)(ge.ReviewsSection,{rid:o,mode:"read",venueName:s.name}):null,'bookings'===Re?(0,ve.jsx)(S.TodaysBookings,{rid:o,today:Ge,by:n,app:"chef"}):null,'specials'===Re?(0,ve.jsx)(de.SpecialsEditor,{rid:o,me:n,app:"chef",now:L}):null,'forecast'===Re?(0,ve.jsx)(K.ChefForecast,{openPrep:()=>Ue('kitchen','prep')}):null,'prep'===Re?(0,ve.jsx)(V.PrepScreen,{}):null,'live'===Re?(0,ve.jsx)(V.TeamScreen,{}):null,'waste'===Re?(0,ve.jsx)(V.WasteScreen,{}):null,'recipes'===Re?(0,ve.jsx)(pe.RecipeCards,{rid:o,actor:{name:n,role:'head-chef'},mode:"edit"}):null,'allergens'===Re?(0,ve.jsx)(V.AllergenScreen,{openCards:()=>Ue('kitchen','recipes')}):null,'compliance'===Re?(0,ve.jsx)(V.ComplianceScreen,{}):null,'takings'===Re&&ye?(0,ve.jsx)(p.CashUpScreen,{rid:o,today:Ge,canEdit:!1,chartsOnly:!0,who:{id:U,name:n.replace(' (example)','')}}):null,'board'===Re?(0,ve.jsx)(ke.QuestionBoard,{rid:o,today:Ge,manager:!1,by:""}):null,'teamtasks'===Re?(0,ve.jsx)(h.KitchenTeamTasks,{rid:o,actor:_}):null,'orderlists'===Re?(0,ve.jsx)(v.OrderListsScreen,{rid:o,today:Ge,editor:!0,who:{id:U,name:n.replace(' (example)','')}}):null,'foodsafety'===Re?(0,ve.jsx)(w.FoodSafetyCard,{children:(0,ve.jsx)(R.default,{accessibilityRole:"button",onPress:()=>Ue('kitchen','haccp'),children:(0,ve.jsx)(F.T,{colour:G.colours.gold,children:"Today\u2019s temperature log \u203a"})})}):null,'haccp'===Re?(0,ve.jsx)(re.HaccpLog,{mode:"chef",me:n,meId:M.CHEF_ID,now:L}):null,'accidents'===Re?(0,ve.jsx)(ne.AccidentBook,{app:"chef",me:n,meId:M.CHEF_ID,now:L,seeAll:!1}):null]}),(0,ve.jsx)(je.BottomTabs,{tablist:!0,background:G.colours.surface,active:Ie,onPress:e=>Ue(e),tabs:we.map(e=>({id:e.id,label:e.label,short:'creator'===e.id?'Creator':void 0,icon:e.icon}))}),(0,ve.jsx)(me.ChefAssistantSheet,{go:(e,t)=>{'orders'===e?(Oe(t),Ue('orders')):'gp'===e?Ue('gp'):Ue('kitchen',e)}}),(0,ve.jsx)(ce.AlertHost,{variant:"chef",rid:o,skipTakeaway:!0}),(0,ve.jsx)(ue.KitchenFlash,{rid:o,me:n})]})};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),i=_r(_d[3]),n=_r(_d[4]),l=_r(_d[5]),r=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),f=_r(_d[12]),k=_r(_d[13]),b=_r(_d[14]),y=_r(_d[15]),x=_r(_d[16]),j=_r(_d[17]),v=_r(_d[18]),w=_r(_d[19]),C=_r(_d[20]),T=_r(_d[21]),P=_r(_d[22]),S=_r(_d[23]),I=_r(_d[24]),H=e(_r(_d[25]));_r(_d[26]);var R=e(_r(_d[27])),A=e(_r(_d[28])),D=e(_r(_d[29])),B=e(_r(_d[30])),$=_r(_d[31]),O=_r(_d[32]),E=_r(_d[33]),F=_r(_d[34]),L=_r(_d[35]),G=_r(_d[36]),N=_r(_d[37]),_=_r(_d[38]),M=_r(_d[39]),W=_r(_d[40]),K=_r(_d[41]),V=_r(_d[42]),z=_r(_d[43]),U=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),Y=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),se=_r(_d[53]),oe=_r(_d[54]),ie=_r(_d[55]),ae=_r(_d[56]),ne=_r(_d[57]),le=_r(_d[58]),re=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),pe=_r(_d[64]),ge=_r(_d[65]),fe=_r(_d[66]),ke=_r(_d[67]),be=_r(_d[68]),me=_r(_d[69]),ye=_r(_d[70]),xe=_r(_d[71]),je=_r(_d[72]),ve=_r(_d[73]);s.LIVE_HEAD_CHEF&&(0,o.requireRealData)();const we=[{id:'home',label:'Home',icon:'home'},{id:'stock',label:'Stock',icon:'box'},{id:'gp',label:'GP',icon:'forecast'},{id:'creator',label:le.CREATOR_TITLE,icon:'sparkle'},{id:'orders',label:'Orders',icon:'orders'},{id:'kitchen',label:'Kitchen',icon:'platter'}],Ce=[{id:'alerts',title:'Turn on alerts',sub:'Get your reminders on this phone, even with the app closed'},{id:'avatar',title:'My avatar',sub:'Animals, Bar & kitchen, sea, sport, colours, patterns or your own photo'},{id:'reviews',title:'Reviews',sub:'Published reviews, newest first'},{id:'myshift',title:'My shifts & clock in',sub:'Clock in and out (checks you are at the venue), breaks, and your shifts on the rota'},{id:'mypay',title:'My pay & tips',sub:'Your hours, tips share, tip goal, paydays and payslip info. Only you see this'},{id:'takings',title:'Takings & tips graphs',sub:'Daily cash ups, weekly sales, this week vs last, categories and the Tips pot (view only)'},{id:'bookings',title:'Today\u2019s bookings',sub:'Covers, allergens to sign off, platters and other reservations, dogs, access and vegan/vegetarian'},{id:'recipes',title:'Recipe cards',sub:'Plating photo, ingredients, method, allergens, section and price; you sign each card off before it goes live'},{id:'specials',title:'Specials board',sub:'Photo of the chalkboard or typed specials with allergens; shown in the customer app'},{id:'board',title:'Question board',sub:'Ask the team anything anonymously, and vote'},{id:'teamtasks',title:'Kitchen team tasks',sub:'Daily tasks for your chefs, commis and KPs'},{id:'orderlists',title:'Order lists',sub:'Alsons drinks, Cash and carry: add items, tick on the day, finish and carry over'},{id:'foodsafety',title:'Food safety (CookSafe)',sub:'Based on CookSafe (Food Standards Scotland). Full logs coming in the next update'},{id:'haccp',title:'Food safety log (HACCP)',sub:'Temperatures, cleaning and allergen checks; voice entry; limits; EHO export'},{id:'accidents',title:'Accident book',sub:'Accidents and near misses; you see your own entries'},{id:'forecast',title:'Forecast',sub:'Covers per day for the week ahead, and prep from the forecast'},{id:'prep',title:'Prep list',sub:'From the forecast and bookings, tick off as you go'},{id:'live',title:'Live tickets, sold out, team & chat',sub:'Orders, readiness alerts, sold out, who\u2019s on, rota, team chat and private messages'},{id:'waste',title:'Waste log',sub:'Item, quantity, reason and cost; weekly total and % of sales'},{id:'allergens',title:'Allergens',sub:'14-allergen matrix from the recipe cards, costing cross-check and audit log'},{id:'compliance',title:'Kitchen compliance',sub:'Fridge, freezer, cooking and cooling temps; cleaning; daily checks'}],Te={stock:{tab:'stock',stock:'levels'},'stock-take':{tab:'stock',stock:'take'},deliveries:{tab:'stock',stock:'deliveries'},gp:{tab:'gp',gp:'dishes'},'price-changes':{tab:'gp',gp:'changes'},'gp-week':{tab:'gp',gp:'week'},'menu-engineering':{tab:'gp',gp:'engineering'},orders:{tab:'orders'},forecast:{tab:'kitchen',k:'forecast'},prep:{tab:'kitchen',k:'prep'},live:{tab:'kitchen',k:'live'},waste:{tab:'kitchen',k:'waste'},recipes:{tab:'kitchen',k:'recipes'},'recipe-cards':{tab:'kitchen',k:'recipes'},allergens:{tab:'kitchen',k:'allergens'},compliance:{tab:'kitchen',k:'compliance'},haccp:{tab:'kitchen',k:'haccp'},specials:{tab:'kitchen',k:'specials'},accidents:{tab:'kitchen',k:'accidents'},'new-dish':{tab:'creator'}};function Pe({go:e}){const{k:t,c:s,menu:o,now:i,rid:l,me:r}=(0,M.useChef)(3e4),d=(0,U.useSheetReminders)(),u=(0,M.useWeek)(),{covers:h,label:p,enough:f,booked:k}=(0,M.useForecast)(),b=(0,z.useSuggestions)(),y=t.ingredients.filter(e=>e.onHand<=0||(0,M.isLow)(e.onHand,e.par)),x=b.filter(e=>e.ordersToday&&!e.placedToday),j=(0,_.priceImpacts)(o,t.recipes,t.ingredients,t.targetGp).filter(e=>e.dropped.length),v=t.deliveries.filter(e=>'expected'===e.status),w=!t.recipes.length||!t.ingredients.length,C=w?[]:s.filter(e=>e.below),T=(0,n.useLiveState)(),P=(0,be.useRecipeCards)(l).filter(e=>!e.signOff),S=(0,Y.useKitchenSummary)(l),[H,A]=(0,I.useState)(!1);return(0,ve.jsxs)(B.default,{style:{gap:12},testID:"chef-dashboard",children:[(0,ve.jsx)(re.MissedBanner,{mode:"chef",now:i,onPress:()=>e('kitchen','haccp')}),d.map(t=>(0,ve.jsx)(R.default,{accessibilityRole:"button",onPress:()=>e('orders',t.supplierId),children:(0,ve.jsxs)(F.Banner,{kind:'red'===t.tone?'danger':'warn',title:`\u23f0 ${t.text}`,children:["Tap to open the ",t.name," order sheet. Nothing is sent until you press Send."]})},t.supplierId)),P.length?(0,ve.jsx)(R.default,{testID:"cards-awaiting",accessibilityRole:"button",onPress:()=>e('kitchen','recipes'),children:(0,ve.jsxs)(F.Banner,{kind:"warn",title:`${P.length} recipe card${1===P.length?'':'s'} awaiting your sign-off`,children:[P.slice(0,4).map(e=>e.dish).join(', '),". Guests see \"awaiting allergen sign-off\" and cannot order these until you sign them off."]})}):null,(0,ve.jsx)(q.ShellfishTile,{rid:l,by:r,app:"chef",onOrder:()=>e('orders','os-kittyfisher')}),(0,ve.jsx)(F.Button,{testID:"chef-add-soldout",label:"Add sold out",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>A(!0),style:{minHeight:56}}),(0,ve.jsxs)(F.Row,{wrap:!0,gap:10,children:[c.PITCH?null:(0,ve.jsx)(M.Tile,{testID:"tile-gp",label:"Dishes under target GP",value:S.costed?`${S.below} of ${S.costed}`:'Nothing yet',sub:S.costed?`Average ${(0,M.pct1)(S.avgGp??0)} \xb7 target ${S.target}%`:'Record a delivery, then cost your recipe cards',tone:S.costed?S.below?'amber':'ok':void 0,onPress:()=>e('gp','dishes')}),c.PITCH?w?(0,ve.jsx)(M.Tile,{testID:"tile-gp",label:"GP this week vs target",value:"Nothing yet",sub:"Add ingredients and recipe costs to see GP",onPress:()=>e('gp','week')}):(0,ve.jsx)(M.Tile,{testID:"tile-gp",label:"GP this week vs target",value:(0,M.pct1)(u.theo),sub:`Target ${t.targetGp}% \xb7 actual ${(0,M.pct1)(u.actual)}`,tone:u.theoe('gp','week')}):null,c.PITCH?null:(0,ve.jsx)(M.Tile,{testID:"tile-stock",label:"Stock value",value:null!=S.stockValue?(0,L.gbp)(S.stockValue):'Nothing yet',sub:S.lastCount?`At cost, counted ${S.lastCount}`:'No stock counted yet',onPress:()=>e('stock','take')}),c.PITCH?(0,ve.jsx)(M.Tile,{testID:"tile-stock",label:"Stock value",value:t.ingredients.length?(0,L.gbp)((0,M.stockValue)(t.ingredients)):'Nothing yet',sub:t.ingredients.length?'At cost':'No stock counted yet',onPress:()=>e('stock','levels')}):null,(0,ve.jsx)(M.Tile,{label:"Items low or out",value:t.ingredients.length?`${y.length}`:'Nothing yet',sub:t.ingredients.length?y.slice(0,3).map(e=>e.name).join(', '):'No stock counted yet',tone:y.some(e=>e.onHand<=0)?'red':y.length?'amber':'ok',onPress:()=>e('stock','levels')}),(0,ve.jsx)(M.Tile,{label:"Waste this week",value:t.waste.length?(0,L.gbp)(u.wasteWeek):'Nothing yet',sub:u.sales?`${(0,M.pct1)(u.wasteWeek/u.sales*100)} of food sales`:'',onPress:()=>e('kitchen','waste')}),f?(0,ve.jsx)(M.Tile,{testID:"tile-forecast",label:"Covers forecast today",value:`${h}`,sub:p,onPress:()=>e('kitchen','forecast')}):(0,ve.jsx)(M.Tile,{testID:"tile-booked",label:"Booked so far today",value:'ready'===T?`${k}`:'connecting'===T?'Connecting\u2026':'Not connected',sub:"Not enough history for a forecast yet",onPress:()=>e('kitchen','bookings')}),(0,ve.jsx)(M.Tile,{label:"Orders due today",value:`${x.length}`,sub:x.map(e=>`${e.s.name} by ${e.s.cutoff}`).join(' \xb7 ')||'None',tone:x.some(e=>e.cutPassed)?'red':x.length?'amber':'ok',onPress:()=>e('orders')})]}),j.map(e=>(0,ve.jsxs)(F.Banner,{kind:"danger",title:`${e.ing.name} ${e.pct>0?'+':''}${e.pct.toFixed(0)}%: ${e.dropped.length} dish${1===e.dropped.length?'':'es'} drop below target`,children:[e.dropped.map(e=>e.item.name).join(', '),". Open GP \u203a Price changes."]},e.ing.id)),v.length?(0,ve.jsx)(R.default,{accessibilityRole:"button",onPress:()=>e('stock','deliveries'),children:(0,ve.jsx)(F.Banner,{kind:"info",title:`${v.length} deliver${1===v.length?'y':'ies'} to check in today`,children:"Count in against the order, flag shorts and price changes."})}):null,C.length?(0,ve.jsx)(R.default,{accessibilityRole:"button",onPress:()=>e('gp','dishes'),children:(0,ve.jsxs)(F.Banner,{kind:"warn",title:`${C.length} dishes below ${t.targetGp}% GP`,children:[C.slice(0,4).map(e=>e.item.name).join(', '),C.length>4?'\u2026':'']})}):null,(0,ve.jsx)(F.Row,{wrap:!0,gap:8,children:[['Recipe cards','recipes'],['Food safety log','haccp'],['Specials board','specials'],[le.CREATOR_TITLE,'creator'],['Forecast','forecast'],['Prep list','prep'],['Live tickets & sold out','live'],['Allergens','allergens'],['Accident book','accidents']].map(([t,s])=>(0,ve.jsx)(R.default,{accessibilityRole:"button",accessibilityLabel:t,onPress:()=>'creator'===s?e('creator'):e('kitchen',s),style:{flexGrow:1,flexBasis:140,padding:12,borderRadius:12,borderWidth:1.5,borderColor:G.colours.gold,backgroundColor:G.colours.surface},children:(0,ve.jsxs)(F.T,{weight:"semibold",children:[t," \u203a"]})},s))}),(0,ve.jsx)(F.Badge,{kind:"neutral",label:"Nothing is ordered or sent from here"}),(0,ve.jsx)(ye.SoldOutSheet,{visible:H,onClose:()=>A(!1),rid:l,by:r,hideLinks:!0,testID:"chef-soldout-sheet"})]})}},792,[793,978,884,979,986,1051,1052,1015,2,1053,1057,1058,1090,858,1095,1099,1100,1103,1104,1107,1108,1110,1111,1112,34,373,236,402,295,426,102,36,873,1137,794,867,821,1084,1139,1145,1148,1149,1152,1167,1168,1169,1171,1172,1173,1176,1179,1187,1188,1192,1193,925,1003,1194,1158,1195,1196,1197,1206,1199,1156,1208,1212,1189,874,1213,1154,987,1215,25]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ChefApp=function({section:e}={}){const{r:s,rid:i,me:n,now:L}=(0,_.useChef)(3e4);(0,be.useReviewAlerts)(i);const M=(0,G.useSignedIn)(),q=M?.id??_.CHEF_ID,Q=M?.ownerAccess&&'owner'!==M.role?'owner privileges':M?.managerAccess&&'staff'===M.role?'manager privileges':'',me=(0,je.useSync)(e=>e.perms),xe=me.includes('*')||me.includes('takings.view');(0,o.useSoldOutLink)(!0,(M?.name??n).replace(' (example)',''));const Re=e?Se[e]:void 0,[He,Ae]=(0,I.useState)(Re?.tab??'home'),[De,$e]=(0,I.useState)(Re?.k??null),[Be,Oe]=(0,I.useState)(Re?.stock??'levels'),[Ee,Fe]=(0,I.useState)(void 0),[Le,Ne]=(0,I.useState)(Re?.gp??'dishes'),Ge=(0,I.useRef)(null),Me=(0,b.ymd)(L),We=(0,b.ymd)(new Date(L.getTime()+864e5));(0,p.useTipsPosted)(i,Me);const Ke=(0,Z.useTravelDay)('chef',Me),Ve='home'===He&&!Ke;(0,P.useKitchenTodoChime)(i,Me,()=>Qe('kitchen','bookings')),(0,pe.useAlertWatcher)(i,{kinds:['takeaway']}),(0,I.useEffect)(()=>{(0,G.ensureAttendance)((new Date).toISOString().slice(0,10),L)},[]);const ze=(0,I.useRef)({t:'home',k:null});ze.current={t:He,k:De};const Ue=(0,I.useRef)([]),qe=(0,l.useScrollMemory)(Ge),Qe=(0,I.useCallback)((e,t=null)=>{'takings'!==t||xe||(t=null);const s=ze.current;s.t===e&&s.k===t||(Ue.current=[...Ue.current,{...s,y:qe.leave()}].slice(-30),qe.restore(0)),Ae(e),$e(t)},[xe]),Ye=(0,I.useCallback)(()=>{if((0,r.runBackLayer)())return!0;const e=ze.current;let t=Ue.current.pop();for(;t&&t.t===e.t&&t.k===e.k;)t=Ue.current.pop();if(!t&&'home'===e.t&&!e.k)return!1;const s=t??{t:'home',k:null};return qe.leave(),Ae(s.t),$e(s.k),qe.restore(s.y??0),!0},[]);(0,r.useWebBack)(Ye);const Je=(0,r.useInnerBackShown)();(0,I.useEffect)(()=>{c.PITCH&&(globalThis.__pitchGo=(e,t=null,s)=>{'stock'===e&&s&&Oe(s),'gp'===e&&s&&Ne(s),Qe(e,t)})},[Qe]),(0,f.useShiftReminders)({rid:i,staffId:q,name:n,kitchen:!0}),(0,C.useScheduledNotices)({rid:i,staffId:M?.id??'',name:n,onOpen:e=>{'orderlists'===e&&Qe('kitchen','orderlists'),'chat'===e&&Qe('kitchen','live')}}),(0,T.useOffRotaPrompt)({rid:i,staffId:M?.id??''}),(0,I.useEffect)(()=>{const e=R.default.addEventListener('hardwareBackPress',Ye);return()=>e.remove()},[Ye]),(0,I.useEffect)(()=>{'takings'!==De||xe||($e(null),Ae('kitchen'))},[De,xe]);const Xe=Pe.filter(e=>'takings'!==e.id||xe),Ze=De&&('takings'!==De||xe)?Pe.find(e=>e.id===De):null,et=((0,D.default)().width,Ze?Ze.title:{home:'Today in the kitchen',stock:c.PITCH?'Stock':'Deliveries & stock',gp:'GP & costing',creator:re.CREATOR_TITLE,orders:'Orders',rota:'Rota',kitchen:'Kitchen'}[He]);return(0,ve.jsxs)(B.SafeAreaView,{style:{flex:1,backgroundColor:N.colours.bg},edges:['top','bottom'],children:[(0,ve.jsxs)($.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:N.colours.border,gap:6},children:[(0,ve.jsx)($.default,{style:{position:'absolute',top:4,right:6,zIndex:5,flexDirection:'row',alignItems:'center'},children:(0,ve.jsx)(E.VoiceSlot,{size:44})}),(0,ve.jsx)($.default,{testID:"header-me-wrap",style:{alignItems:'flex-start',minHeight:44,justifyContent:'center',maxWidth:'70%'},children:(0,ve.jsx)($.default,{testID:"header-me",accessibilityLabel:`Signed in as ${n.replace(' (example)','')}, Head Chef${Q?`, ${Q}`:''}`,style:{borderWidth:1,borderColor:N.colours.gold,borderRadius:16,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%'},children:(0,ve.jsxs)(F.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,ve.jsx)(oe.StaffAvatar,{id:_.CHEF_ID,size:24,ring:!1}),(0,ve.jsxs)($.default,{style:{flexShrink:1},children:[(0,ve.jsxs)(F.T,{size:13,weight:"semibold",colour:N.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[n.replace(' (example)','')," \xb7 Head Chef"]}),Q?(0,ve.jsx)(F.Muted,{center:!1,size:10,numberOfLines:1,children:Q}):null]})]})})}),(0,ve.jsx)(O.VenueHeaderBlock,{rid:i,name:s.name,badge:"CHEF",place:"Head Chef app"}),(0,ve.jsx)(H.default,{accessibilityRole:"button",accessibilityLabel:"Open CoverCharge for Staff",onPress:()=>{const e=(0,ne.appUrl)('staff');e&&window.location.assign(e)},style:{alignSelf:'center',borderWidth:1,borderColor:N.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:3,minHeight:44,justifyContent:'center'},children:(0,ve.jsx)(F.T,{size:13,colour:N.colours.gold,children:"Staff app \u203a"})})]}),(0,ve.jsxs)(A.default,{ref:Ge,...qe.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:[(0,ve.jsx)(r.BackTitleRow,{back:!('home'===He&&!De||Je),onBack:Ye,title:et}),'home'===He?(0,ve.jsx)(Z.DayBar,{app:"chef",today:Me}):null,'home'===He&&Ke?(0,ve.jsx)(Z.DayView,{rid:i,day:Ke,today:Me,app:"chef"}):null,'home'===He?(0,ve.jsx)(ae.WhoBar,{}):null,Ve&&M?(0,ve.jsx)(h.MyTasksToday,{rid:i,staffId:M.id,name:M.name,onShift:(0,f.shiftNow)(M.id,L.getTime()).on}):null,Ve?(0,ve.jsx)(p.TodaysTipsCard,{rid:i,today:Me}):null,Ve?(0,ve.jsx)(p.TipsPotCard,{rid:i,today:Me}):null,Ve?(0,ve.jsx)(k.CoversToday,{rid:i,onPress:()=>Qe('kitchen','bookings')}):null,Ve?(0,ve.jsx)(y.LastFoodBanner,{rid:i,now:L}):null,Ve?(0,ve.jsx)(x.NextTableFreeCard,{rid:i,now:L}):null,Ve?(0,ve.jsx)(j.KitchenSignoffs,{rid:i,today:Me,by:n,app:"chef"}):null,Ve?(0,ve.jsxs)($.default,{style:{gap:4},children:[(0,ve.jsx)(j.PlattersBooked,{rid:i,date:Me,label:"Platters booked today"}),(0,ve.jsx)(j.PlattersBooked,{rid:i,date:We,label:"Platters booked tomorrow"})]}):null,Ve?(0,ve.jsx)(ye.ChefAssistantButton,{}):null,Ve?(0,ve.jsx)(Ie,{go:(e,t)=>{'stock'===e&&t&&Oe(t),'gp'===e&&t&&Ne(t),'orders'===e&&Fe(t),Qe(e,'kitchen'===e?t??null:null)}}):null,'stock'!==He||c.PITCH?null:(0,ve.jsx)(J.KitchenCosts,{rid:i,me:(M?.name??n).replace(' (example)',''),actor:{name:(M?.name??n).replace(' (example)',''),role:'head-chef'},initial:'deliveries'===Be?'deliveries':'take'===Be?'count':'deliveries'},`s-${Be}`),'gp'!==He||c.PITCH?null:(0,ve.jsx)(J.KitchenCosts,{rid:i,me:(M?.name??n).replace(' (example)',''),actor:{name:(M?.name??n).replace(' (example)',''),role:'head-chef'},initial:"dishgp"},`g-${Le}`),'stock'===He&&c.PITCH?(0,ve.jsx)(Y.StockScreen,{initial:Be},Be):null,'gp'===He&&c.PITCH?(0,ve.jsx)(W.GpScreen,{initial:Le},Le):null,'creator'===He?(0,ve.jsx)(re.DishCreator,{rid:i,canPublish:!1}):null,'orders'===He?(0,ve.jsx)(z.OrdersScreen,{focus:Ee},Ee??'all'):null,'rota'===He?(0,ve.jsx)(F.Card,{children:(0,ve.jsx)(U.KitchenRotaTab,{today:Me})}):null,'kitchen'!==He||Ze?null:(0,ve.jsxs)($.default,{style:{gap:10},children:[(0,ve.jsxs)($.default,{style:{borderRadius:14,borderWidth:1,borderColor:N.colours.border,backgroundColor:N.colours.surface,overflow:'hidden'},children:[Te.map(e=>(0,ve.jsx)(H.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:`${e.title}. ${e.sub}`,onPress:()=>Qe(e.id),style:({pressed:e})=>({padding:12,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,ve.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,ve.jsxs)($.default,{style:{flex:1},children:[(0,ve.jsx)(F.T,{weight:"medium",children:e.title}),(0,ve.jsx)(F.Muted,{children:e.sub})]}),(0,ve.jsx)(F.T,{colour:N.colours.muted,children:"\u203a"})]})},e.id)),Xe.map(e=>(0,ve.jsx)(H.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>Qe(He,e.id),style:({pressed:e})=>({padding:12,borderTopWidth:1,borderColor:N.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,ve.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,ve.jsxs)($.default,{style:{flex:1},children:[(0,ve.jsx)(F.T,{weight:"medium",children:e.title}),(0,ve.jsx)(F.Muted,{children:e.sub})]}),(0,ve.jsx)(F.T,{colour:N.colours.muted,children:"\u203a"})]})},e.id))]}),(0,ve.jsx)(F.Muted,{children:"Head Chef sees kitchen, stock, food costs and GP. Payroll, wages and the restaurant's billing stay in CoverCharge for Managers."}),(0,ve.jsxs)(F.Muted,{center:!0,children:["Head Chef app \xb7 ",d.APP_VERSION," \xb7 ",'live'===je.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),'myshift'===De&&q?(0,ve.jsxs)($.default,{style:{gap:10},testID:"chef-myshift",children:[(0,ve.jsx)(se.ClockInOut,{}),(0,ve.jsx)(ie.MyUpcomingShifts,{staffId:q,team:!0})]}):null,'mypay'===De?(0,ve.jsxs)($.default,{style:{gap:10},testID:"chef-mypay",children:[(0,ve.jsx)(ee.MyPeriods,{staffId:q}),(0,ve.jsx)(X.MyHoursPay,{staffId:q}),(0,ve.jsx)(te.MyTips,{staffId:q}),(0,ve.jsx)(F.Card,{children:(0,ve.jsx)(u.PhoneAlerts,{})})]}):null,'alerts'===De?(0,ve.jsx)($.default,{testID:"chef-alerts",children:(0,ve.jsx)(u.PhoneAlerts,{})}):null,'avatar'===De?(0,ve.jsx)(t.AvatarMaker,{meId:M?.id??_.CHEF_ID,me:n}):null,'reviews'===De?(0,ve.jsx)(fe.ReviewsSection,{rid:i,mode:"read",venueName:s.name}):null,'bookings'===De?(0,ve.jsx)(S.TodaysBookings,{rid:i,today:Me,by:n,app:"chef"}):null,'specials'===De?(0,ve.jsx)(ce.SpecialsEditor,{rid:i,me:n,app:"chef",now:L}):null,'forecast'===De?(0,ve.jsx)(K.ChefForecast,{openPrep:()=>Qe('kitchen','prep')}):null,'prep'===De?(0,ve.jsx)(V.PrepScreen,{}):null,'live'===De?(0,ve.jsx)(V.TeamScreen,{}):null,'waste'===De?(0,ve.jsx)(V.WasteScreen,{}):null,'recipes'===De?(0,ve.jsx)(ge.RecipeCards,{rid:i,actor:{name:n,role:'head-chef'},mode:"edit"}):null,'allergens'===De?(0,ve.jsx)(V.AllergenScreen,{openCards:()=>Qe('kitchen','recipes')}):null,'compliance'===De?(0,ve.jsx)(V.ComplianceScreen,{}):null,'takings'===De&&xe?(0,ve.jsx)(p.CashUpScreen,{rid:i,today:Me,canEdit:!1,chartsOnly:!0,who:{id:q,name:n.replace(' (example)','')}}):null,'board'===De?(0,ve.jsx)(ke.QuestionBoard,{rid:i,today:Me,manager:!1,by:""}):null,'teamtasks'===De?(0,ve.jsx)(h.KitchenTeamTasks,{rid:i,actor:M}):null,'orderlists'===De?(0,ve.jsx)(w.OrderListsScreen,{rid:i,today:Me,editor:!0,who:{id:q,name:n.replace(' (example)','')}}):null,'foodsafety'===De?(0,ve.jsx)(v.FoodSafetyCard,{children:(0,ve.jsx)(H.default,{accessibilityRole:"button",onPress:()=>Qe('kitchen','haccp'),children:(0,ve.jsx)(F.T,{colour:N.colours.gold,children:"Today\u2019s temperature log \u203a"})})}):null,'haccp'===De?(0,ve.jsx)(de.HaccpLog,{mode:"chef",me:n,meId:_.CHEF_ID,now:L}):null,'accidents'===De?(0,ve.jsx)(le.AccidentBook,{app:"chef",me:n,meId:_.CHEF_ID,now:L,seeAll:!1}):null]}),(0,ve.jsx)(we.BottomTabs,{tablist:!0,background:N.colours.surface,active:'orders'===He?'kitchen':He,onPress:e=>Qe(e),tabs:Ce.map(e=>({id:e.id,label:e.label,short:'creator'===e.id?'Creator':void 0,icon:e.icon,a11y:'rota'===e.id?'Rota, the kitchen rota':void 0}))}),(0,ve.jsx)(ye.ChefAssistantSheet,{go:(e,t)=>{'orders'===e?(Fe(t),Qe('orders')):'gp'===e?Qe('gp'):Qe('kitchen',e)}}),(0,ve.jsx)(ue.AlertHost,{variant:"chef",rid:i,skipTakeaway:!0}),(0,ve.jsx)(he.KitchenFlash,{rid:i,me:n})]})};var t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),o=_r(_d[3]),n=_r(_d[4]),l=_r(_d[5]),r=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),f=_r(_d[12]),b=_r(_d[13]),k=_r(_d[14]),y=_r(_d[15]),x=_r(_d[16]),j=_r(_d[17]),w=_r(_d[18]),v=_r(_d[19]),C=_r(_d[20]),T=_r(_d[21]),P=_r(_d[22]),S=_r(_d[23]),I=_r(_d[24]),R=e(_r(_d[25]));_r(_d[26]);var H=e(_r(_d[27])),A=e(_r(_d[28])),D=e(_r(_d[29])),$=e(_r(_d[30])),B=_r(_d[31]),O=_r(_d[32]),E=_r(_d[33]),F=_r(_d[34]),L=_r(_d[35]),N=_r(_d[36]),G=_r(_d[37]),M=_r(_d[38]),_=_r(_d[39]),W=_r(_d[40]),K=_r(_d[41]),V=_r(_d[42]),z=_r(_d[43]),U=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),Y=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),se=_r(_d[53]),ie=_r(_d[54]),ae=_r(_d[55]),oe=_r(_d[56]),ne=_r(_d[57]),le=_r(_d[58]),re=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),pe=_r(_d[64]),ge=_r(_d[65]),fe=_r(_d[66]),be=_r(_d[67]),ke=_r(_d[68]),me=_r(_d[69]),ye=_r(_d[70]),xe=_r(_d[71]),je=_r(_d[72]),we=_r(_d[73]),ve=_r(_d[74]);s.LIVE_HEAD_CHEF&&(0,i.requireRealData)();const Ce=[{id:'home',label:'Home',icon:'home'},{id:'stock',label:'Stock',icon:'box'},{id:'gp',label:'GP',icon:'forecast'},{id:'creator',label:re.CREATOR_TITLE,icon:'sparkle'},{id:'rota',label:'Rota',icon:'rota'},{id:'kitchen',label:'Kitchen',icon:'platter'}],Te=[{id:'orders',title:'Orders',sub:'Supplier order sheets, what is due today and cut-off times. Nothing is sent until you press Send'}],Pe=[{id:'alerts',title:'Turn on alerts',sub:'Get your reminders on this phone, even with the app closed'},{id:'avatar',title:'My avatar',sub:'Animals, Bar & kitchen, sea, sport, colours, patterns or your own photo'},{id:'reviews',title:'Reviews',sub:'Published reviews, newest first'},{id:'myshift',title:'My shifts & clock in',sub:'Clock in and out (checks you are at the venue), breaks, and your shifts on the rota'},{id:'mypay',title:'My pay & tips',sub:'Your hours, tips share, tip goal, paydays and payslip info. Only you see this'},{id:'takings',title:'Takings & tips graphs',sub:'Daily cash ups, weekly sales, this week vs last, categories and the Tips pot (view only)'},{id:'bookings',title:'Today\u2019s bookings',sub:'Covers, allergens to sign off, platters and other reservations, dogs, access and vegan/vegetarian'},{id:'recipes',title:'Recipe cards',sub:'Plating photo, ingredients, method, allergens, section and price; you sign each card off before it goes live'},{id:'specials',title:'Specials board',sub:'Photo of the chalkboard or typed specials with allergens; shown in the customer app'},{id:'board',title:'Question board',sub:'Ask the team anything anonymously, and vote'},{id:'teamtasks',title:'Kitchen team tasks',sub:'Daily tasks for your chefs, commis and KPs'},{id:'orderlists',title:'Order lists',sub:'Alsons drinks, Cash and carry: add items, tick on the day, finish and carry over'},{id:'foodsafety',title:'Food safety (CookSafe)',sub:'Based on CookSafe (Food Standards Scotland). Full logs coming in the next update'},{id:'haccp',title:'Food safety log (HACCP)',sub:'Temperatures, cleaning and allergen checks; voice entry; limits; EHO export'},{id:'accidents',title:'Accident book',sub:'Accidents and near misses; you see your own entries'},{id:'forecast',title:'Forecast',sub:'Covers per day for the week ahead, and prep from the forecast'},{id:'prep',title:'Prep list',sub:'From the forecast and bookings, tick off as you go'},{id:'live',title:'Live tickets, sold out, team & chat',sub:'Orders, readiness alerts, sold out, who\u2019s on, rota, team chat and private messages'},{id:'waste',title:'Waste log',sub:'Item, quantity, reason and cost; weekly total and % of sales'},{id:'allergens',title:'Allergens',sub:'14-allergen matrix from the recipe cards, costing cross-check and audit log'},{id:'compliance',title:'Kitchen compliance',sub:'Fridge, freezer, cooking and cooling temps; cleaning; daily checks'}],Se={stock:{tab:'stock',stock:'levels'},'stock-take':{tab:'stock',stock:'take'},deliveries:{tab:'stock',stock:'deliveries'},gp:{tab:'gp',gp:'dishes'},'price-changes':{tab:'gp',gp:'changes'},'gp-week':{tab:'gp',gp:'week'},'menu-engineering':{tab:'gp',gp:'engineering'},orders:{tab:'orders'},rota:{tab:'rota'},'kitchen-rota':{tab:'rota'},forecast:{tab:'kitchen',k:'forecast'},prep:{tab:'kitchen',k:'prep'},live:{tab:'kitchen',k:'live'},waste:{tab:'kitchen',k:'waste'},recipes:{tab:'kitchen',k:'recipes'},'recipe-cards':{tab:'kitchen',k:'recipes'},allergens:{tab:'kitchen',k:'allergens'},compliance:{tab:'kitchen',k:'compliance'},haccp:{tab:'kitchen',k:'haccp'},specials:{tab:'kitchen',k:'specials'},accidents:{tab:'kitchen',k:'accidents'},'new-dish':{tab:'creator'}};function Ie({go:e}){const{k:t,c:s,menu:i,now:o,rid:l,me:r}=(0,_.useChef)(3e4),d=(0,q.useSheetReminders)(),u=(0,_.useWeek)(),{covers:h,label:p,enough:f,booked:b}=(0,_.useForecast)(),k=(0,z.useSuggestions)(),y=t.ingredients.filter(e=>e.onHand<=0||(0,_.isLow)(e.onHand,e.par)),x=k.filter(e=>e.ordersToday&&!e.placedToday),j=(0,M.priceImpacts)(i,t.recipes,t.ingredients,t.targetGp).filter(e=>e.dropped.length),w=t.deliveries.filter(e=>'expected'===e.status),v=!t.recipes.length||!t.ingredients.length,C=v?[]:s.filter(e=>e.below),T=(0,n.useLiveState)(),P=(0,me.useRecipeCards)(l).filter(e=>!e.signOff),S=(0,J.useKitchenSummary)(l),[R,A]=(0,I.useState)(!1);return(0,ve.jsxs)($.default,{style:{gap:12},testID:"chef-dashboard",children:[(0,ve.jsx)(de.MissedBanner,{mode:"chef",now:o,onPress:()=>e('kitchen','haccp')}),d.map(t=>(0,ve.jsx)(H.default,{accessibilityRole:"button",onPress:()=>e('orders',t.supplierId),children:(0,ve.jsxs)(F.Banner,{kind:'red'===t.tone?'danger':'warn',title:`\u23f0 ${t.text}`,children:["Tap to open the ",t.name," order sheet. Nothing is sent until you press Send."]})},t.supplierId)),P.length?(0,ve.jsx)(H.default,{testID:"cards-awaiting",accessibilityRole:"button",onPress:()=>e('kitchen','recipes'),children:(0,ve.jsxs)(F.Banner,{kind:"warn",title:`${P.length} recipe card${1===P.length?'':'s'} awaiting your sign-off`,children:[P.slice(0,4).map(e=>e.dish).join(', '),". Guests see \"awaiting allergen sign-off\" and cannot order these until you sign them off."]})}):null,(0,ve.jsx)(Q.ShellfishTile,{rid:l,by:r,app:"chef",onOrder:()=>e('orders','os-kittyfisher')}),(0,ve.jsx)(F.Button,{testID:"chef-add-soldout",label:"Add sold out",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>A(!0),style:{minHeight:56}}),(0,ve.jsxs)(F.Row,{wrap:!0,gap:10,children:[c.PITCH?null:(0,ve.jsx)(_.Tile,{testID:"tile-gp",label:"Dishes under target GP",value:S.costed?`${S.below} of ${S.costed}`:'Nothing yet',sub:S.costed?`Average ${(0,_.pct1)(S.avgGp??0)} \xb7 target ${S.target}%`:'Record a delivery, then cost your recipe cards',tone:S.costed?S.below?'amber':'ok':void 0,onPress:()=>e('gp','dishes')}),c.PITCH?v?(0,ve.jsx)(_.Tile,{testID:"tile-gp",label:"GP this week vs target",value:"Nothing yet",sub:"Add ingredients and recipe costs to see GP",onPress:()=>e('gp','week')}):(0,ve.jsx)(_.Tile,{testID:"tile-gp",label:"GP this week vs target",value:(0,_.pct1)(u.theo),sub:`Target ${t.targetGp}% \xb7 actual ${(0,_.pct1)(u.actual)}`,tone:u.theoe('gp','week')}):null,c.PITCH?null:(0,ve.jsx)(_.Tile,{testID:"tile-stock",label:"Stock value",value:null!=S.stockValue?(0,L.gbp)(S.stockValue):'Nothing yet',sub:S.lastCount?`At cost, counted ${S.lastCount}`:'No stock counted yet',onPress:()=>e('stock','take')}),c.PITCH?(0,ve.jsx)(_.Tile,{testID:"tile-stock",label:"Stock value",value:t.ingredients.length?(0,L.gbp)((0,_.stockValue)(t.ingredients)):'Nothing yet',sub:t.ingredients.length?'At cost':'No stock counted yet',onPress:()=>e('stock','levels')}):null,(0,ve.jsx)(_.Tile,{label:"Items low or out",value:t.ingredients.length?`${y.length}`:'Nothing yet',sub:t.ingredients.length?y.slice(0,3).map(e=>e.name).join(', '):'No stock counted yet',tone:y.some(e=>e.onHand<=0)?'red':y.length?'amber':'ok',onPress:()=>e('stock','levels')}),(0,ve.jsx)(_.Tile,{label:"Waste this week",value:t.waste.length?(0,L.gbp)(u.wasteWeek):'Nothing yet',sub:u.sales?`${(0,_.pct1)(u.wasteWeek/u.sales*100)} of food sales`:'',onPress:()=>e('kitchen','waste')}),f?(0,ve.jsx)(_.Tile,{testID:"tile-forecast",label:"Covers forecast today",value:`${h}`,sub:p,onPress:()=>e('kitchen','forecast')}):(0,ve.jsx)(_.Tile,{testID:"tile-booked",label:"Booked so far today",value:'ready'===T?`${b}`:'connecting'===T?'Connecting\u2026':'Not connected',sub:"Not enough history for a forecast yet",onPress:()=>e('kitchen','bookings')}),(0,ve.jsx)(_.Tile,{label:"Orders due today",value:`${x.length}`,sub:x.map(e=>`${e.s.name} by ${e.s.cutoff}`).join(' \xb7 ')||'None',tone:x.some(e=>e.cutPassed)?'red':x.length?'amber':'ok',onPress:()=>e('orders')})]}),j.map(e=>(0,ve.jsxs)(F.Banner,{kind:"danger",title:`${e.ing.name} ${e.pct>0?'+':''}${e.pct.toFixed(0)}%: ${e.dropped.length} dish${1===e.dropped.length?'':'es'} drop below target`,children:[e.dropped.map(e=>e.item.name).join(', '),". Open GP \u203a Price changes."]},e.ing.id)),w.length?(0,ve.jsx)(H.default,{accessibilityRole:"button",onPress:()=>e('stock','deliveries'),children:(0,ve.jsx)(F.Banner,{kind:"info",title:`${w.length} deliver${1===w.length?'y':'ies'} to check in today`,children:"Count in against the order, flag shorts and price changes."})}):null,C.length?(0,ve.jsx)(H.default,{accessibilityRole:"button",onPress:()=>e('gp','dishes'),children:(0,ve.jsxs)(F.Banner,{kind:"warn",title:`${C.length} dishes below ${t.targetGp}% GP`,children:[C.slice(0,4).map(e=>e.item.name).join(', '),C.length>4?'\u2026':'']})}):null,(0,ve.jsx)(F.Row,{wrap:!0,gap:8,children:[['Recipe cards','recipes'],['Food safety log','haccp'],['Specials board','specials'],[re.CREATOR_TITLE,'creator'],['Forecast','forecast'],['Prep list','prep'],['Live tickets & sold out','live'],['Allergens','allergens'],['Accident book','accidents']].map(([t,s])=>(0,ve.jsx)(H.default,{accessibilityRole:"button",accessibilityLabel:t,onPress:()=>'creator'===s?e('creator'):e('kitchen',s),style:{flexGrow:1,flexBasis:140,padding:12,borderRadius:12,borderWidth:1.5,borderColor:N.colours.gold,backgroundColor:N.colours.surface},children:(0,ve.jsxs)(F.T,{weight:"semibold",children:[t," \u203a"]})},s))}),(0,ve.jsx)(F.Badge,{kind:"neutral",label:"Nothing is ordered or sent from here"}),(0,ve.jsx)(xe.SoldOutSheet,{visible:R,onClose:()=>A(!1),rid:l,by:r,hideLinks:!0,testID:"chef-soldout-sheet"})]})}},792,[793,978,884,979,986,1051,1052,1015,2,1053,1057,1058,1090,858,1095,1099,1100,1103,1104,1107,1108,1110,1111,1112,34,373,236,402,295,426,102,36,873,1137,794,867,821,1084,1139,1145,1148,1149,1152,1167,1165,1168,1169,1171,1172,1173,1176,1179,1187,1188,1192,1193,925,1003,1194,1158,1195,1196,1197,1206,1199,1156,1208,1212,1189,874,1213,1154,987,1215,25]); __d(function(_g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.styliseOnDevice=b,_e.pickPhoto=p,_e.AvatarMaker=function({meId:e,me:u}){const g=(0,i.useAvatars)(t=>t.photos[e]),[f,v]=(0,t.useState)(null),[y,x]=(0,t.useState)(null),[j,w]=(0,t.useState)(!1),[I,P]=(0,t.useState)(!1),[k,M]=(0,t.useState)('');(0,t.useEffect)(()=>()=>{f&&URL.revokeObjectURL(f)},[f]);const R='undefined'!=typeof document,S=async e=>{M('');const t=await p(e);if(t){P(!0),w(!1);try{const e=await b(t);f&&URL.revokeObjectURL(f),v(URL.createObjectURL(t)),x(e)}catch{M("That photo couldn't be opened. Try a different one (JPEG or PNG).")}finally{P(!1)}}},U=()=>{f&&URL.revokeObjectURL(f),v(null),x(null),w(!1)},B=u.replace(' (example)','');return(0,h.jsxs)(o.default,{style:{gap:12},testID:"avatar-maker",children:[(0,h.jsxs)(d.Box,{children:[(0,h.jsxs)(s.Row,{gap:14,children:[(0,h.jsx)(l.StaffAvatar,{id:e,size:88}),(0,h.jsxs)(o.default,{style:{flex:1,gap:4},children:[(0,h.jsx)(s.T,{weight:"semibold",size:17,children:B}),(0,h.jsxs)(s.Muted,{children:[g?`Your chosen avatar (saved ${new Date(g.at).toLocaleDateString('en-GB')}).`:'Your original crew avatar.'," It shows on rotas, chat, clock-in and sign-offs."]})]})]}),g?(0,h.jsx)(s.Button,{small:!0,kind:"secondary",label:"Back to my default avatar",testID:"avatar-own-reset",onPress:()=>{i.useAvatars.getState().reset(e,{id:e,role:'staff',name:B}),M('Back to your default avatar.')}}):null]}),(0,h.jsx)(d.Box,{children:(0,h.jsx)(n.AvatarOptions,{value:g?.dataUrl,onSelect:t=>{const a=i.useAvatars.getState().setOwn(e,e,t.dataUrl,B);M(a?`${t.name} is your avatar now.`:'Could not save your avatar.')}})}),(0,h.jsxs)(d.Box,{testID:"avatar-create",children:[(0,h.jsx)(s.T,{weight:"semibold",size:17,children:"Create my avatar from a photo"}),(0,h.jsx)(s.Muted,{children:"Upload a photo or take a selfie. Your phone turns it into a retro space-age avatar. The photo never leaves this device and isn't saved: only the finished avatar is kept."}),R?y?(0,h.jsxs)(o.default,{style:{gap:10},testID:"avatar-preview",children:[(0,h.jsxs)(s.Row,{gap:12,style:{justifyContent:'center'},children:[(0,h.jsxs)(o.default,{style:{alignItems:'center',gap:4},children:[f?(0,h.jsx)(a.default,{source:{uri:f},style:{width:96,height:96,borderRadius:12},accessibilityLabel:"Your photo"}):null,(0,h.jsx)(s.Muted,{children:"Your photo"})]}),(0,h.jsx)(s.T,{size:22,colour:c.colours.gold,children:"\u2192"}),(0,h.jsxs)(o.default,{style:{alignItems:'center',gap:4},children:[(0,h.jsx)(a.default,{source:{uri:y},style:{width:120,height:120,borderRadius:60,borderWidth:3,borderColor:c.colours.gold},accessibilityLabel:"Your new avatar preview",testID:"avatar-result"}),(0,h.jsx)(s.Muted,{children:"Your avatar"})]})]}),(0,h.jsxs)(r.default,{accessibilityRole:"checkbox",accessibilityState:{checked:j},accessibilityLabel:"I agree to use this avatar",testID:"avatar-consent",onPress:()=>w(!j),style:{flexDirection:'row',gap:10,alignItems:'flex-start',padding:10,borderRadius:12,borderWidth:1,borderColor:j?c.colours.gold:c.colours.border},children:[(0,h.jsx)(o.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:c.colours.gold,backgroundColor:j?c.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:j?(0,h.jsx)(s.T,{size:15,weight:"bold",colour:"#111",children:"\u2713"}):null}),(0,h.jsx)(s.T,{size:14,style:{flex:1},children:"I\u2019m happy for this avatar, made from my photo, to be shown to my team in CoverCharge. Only the finished avatar is shared; my photo isn\u2019t uploaded or kept, and a manager can reset my avatar."})]}),(0,h.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,h.jsx)(s.Button,{label:"Use as my avatar",testID:"avatar-save",disabled:!j,onPress:()=>{const t=i.useAvatars.getState().setOwn(e,e,y,B);M(t?'Saved: this is your avatar now.':"Couldn't save the avatar."),t&&U()}}),(0,h.jsx)(s.Button,{kind:"secondary",label:"Try another photo",onPress:U})]})]}):(0,h.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,h.jsx)(s.Button,{label:I?'Making your avatar\u2026':'Upload a photo',testID:"avatar-upload",disabled:I,onPress:()=>S(!1)}),(0,h.jsx)(s.Button,{kind:"secondary",label:"Take a selfie",testID:"avatar-selfie",disabled:I,onPress:()=>S(!0)})]}):(0,h.jsx)(s.Muted,{children:"Available in the web app."}),k?(0,h.jsx)(o.default,{testID:"avatar-msg",children:(0,h.jsx)(s.T,{size:14,colour:c.colours.ok,children:k})}):null]})]})};var t=_r(_d[0]),a=e(_r(_d[1]));_r(_d[2]);var r=e(_r(_d[3])),o=e(_r(_d[4])),s=_r(_d[5]),l=_r(_d[6]),n=_r(_d[7]),i=_r(_d[8]),c=_r(_d[9]),d=_r(_d[10]),h=_r(_d[11]);const u=['#1B1B1B','#4A3F35','#B89A72','#E9B949','#FFF4E0'].map(e=>[1,3,5].map(t=>parseInt(e.slice(t,t+2),16))),g=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5];function f(e){return new Promise((t,a)=>{const r=URL.createObjectURL(e),o=new window.Image;o.onload=()=>t({img:o,url:r}),o.onerror=()=>{URL.revokeObjectURL(r),a(new Error('bad image'))},o.src=r})}function v(e,t,a,r){e.beginPath(),e.moveTo(t,a-r),e.quadraticCurveTo(t+.18*r,a-.18*r,t+r,a),e.quadraticCurveTo(t+.18*r,a+.18*r,t,a+r),e.quadraticCurveTo(t-.18*r,a+.18*r,t-r,a),e.quadraticCurveTo(t-.18*r,a-.18*r,t,a-r),e.fill()}async function b(e){const{img:t,url:a}=await f(e);try{const e=112,a=256,r=document.createElement('canvas');r.width=e,r.height=e;const o=r.getContext('2d'),s=Math.min(t.width,t.height);o.drawImage(t,(t.width-s)/2,Math.max(0,(t.height-s)/2-.04*s),s,s,0,0,e,e);const l=o.getImageData(0,0,e,e),n=l.data,i=[];for(let e=0;ee-t),d=c[Math.floor(.04*c.length)],h=c[Math.floor(.96*c.length)]||255;for(let t=0;t{const a=document.createElement('input');a.type='file',a.accept='image/*',e&&a.setAttribute('capture','user'),a.onchange=()=>t(a.files?.[0]??null),a.click()})}},793,[34,336,236,402,102,794,925,929,926,821,930,25]); __d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"webLine",{enumerable:!0,get:function(){return W.webLine}}),_e.T=D,Object.defineProperty(_e,"H1",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"H2",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"Muted",{enumerable:!0,get:function(){return z}}),_e.BrandBar=A,_e.Screen=function({children:e,title:t,subtitle:r,back:o=!0,right:l,maxWidth:n=640,footer:s,scroll:c=!0}){const u=(0,B.jsxs)(x.default,{style:{width:'100%',maxWidth:n,alignSelf:'center',padding:16,gap:12,alignItems:'stretch'},children:[e,'customer'===S.APP_VARIANT?(0,B.jsx)(H,{}):null]});return(0,B.jsxs)(j.SafeAreaView,{style:{flex:1,backgroundColor:C.colours.bg},edges:['top','left','right'],children:[(0,B.jsx)(x.default,{style:{width:'100%',maxWidth:n,alignSelf:'center'},children:(0,B.jsx)(A,{title:t,subtitle:r,back:o,right:l})}),c?(0,B.jsx)(b.default,{contentContainerStyle:{paddingBottom:40},children:u}):(0,B.jsx)(x.default,{style:{flex:1},children:u}),s?(0,B.jsx)(x.default,{style:N.footer,children:(0,B.jsx)(x.default,{style:{width:'100%',maxWidth:n,alignSelf:'center'},children:s})}):null]})},_e.Button=v,_e.Card=F,_e.Badge=function({label:e,kind:t="neutral"}){const r={neutral:[C.colours.surface2,C.colours.muted,C.colours.border],gold:[C.colours.goldTint,C.colours.goldLight,C.colours.gold],red:[C.colours.redBg,'#FFD9D4',C.colours.red],amber:[C.colours.amberBg,'#FFE2A8',C.colours.amber],ok:[C.colours.okBg,C.colours.goldLight,C.colours.ok],blue:[C.colours.blueBg,C.colours.goldLight,C.colours.blue]}[t];return(0,B.jsx)(x.default,{style:[N.badge,{backgroundColor:r[0],borderColor:r[2],maxWidth:'100%',alignSelf:L?'center':'flex-start'}],children:(0,B.jsx)(D,{size:13,weight:"medium",colour:r[1],style:{flexShrink:1},children:e})})},_e.Banner=E,Object.defineProperty(_e,"ExampleAllergenNotice",{enumerable:!0,get:function(){return V}}),Object.defineProperty(_e,"DemoPaymentNotice",{enumerable:!0,get:function(){return $}}),_e.Row=O,Object.defineProperty(_e,"Divider",{enumerable:!0,get:function(){return _}}),_e.Field=function({label:e,...t}){return(0,B.jsxs)(x.default,{style:{gap:4,alignSelf:'stretch',width:'100%',minWidth:0,maxWidth:'100%'},children:[(0,B.jsx)(D,{size:C.font.small,weight:"medium",colour:C.colours.muted,center:!0,children:e}),(0,B.jsx)(o.TextInput,{accessibilityLabel:e,placeholderTextColor:"#7D776C",...t,style:[N.input,t.multiline&&{minHeight:70,textAlignVertical:'top'},t.style]})]})},_e.Chip=function({label:e,selected:t,onPress:r,disabled:o,sub:l,testID:n,accessibilityLabel:s}){return(0,B.jsxs)(h.default,{testID:n,accessibilityRole:"button",accessibilityState:{selected:!!t,disabled:!!o},accessibilityLabel:`${s??e}${!s&&l?`, ${l}`:''}${t?', selected':''}`,'aria-pressed':!!t,disabled:o,onPress:r,style:[N.chip,t&&{backgroundColor:C.colours.gold,borderColor:C.colours.gold},o&&{opacity:.35}],children:[(0,B.jsx)(D,{size:C.font.small,weight:"medium",colour:t?C.colours.onGold:C.colours.text,center:!0,children:e.trim()}),l?(0,B.jsx)(D,{size:12,colour:t?C.colours.onGold:C.colours.muted,center:!0,children:l}):null]})},_e.Toggle=function({value:e,onChange:t,label:r,testID:o,disabled:l,a11y:n}){return(0,B.jsxs)(O,{style:{justifyContent:'space-between',flexShrink:1,minWidth:0},children:[(0,B.jsx)(D,{style:{flex:1,flexShrink:1},children:r}),(0,B.jsx)(y.default,{testID:o,disabled:l,accessibilityLabel:n??r,value:e,onValueChange:t,trackColor:{true:C.colours.gold,false:'#444'},thumbColor:e?'#FFF6E0':'#BBB',activeThumbColor:'#FFF6E0',activeTrackColor:C.colours.gold})]})},_e.Stepper=function({value:e,onChange:t,min:r=1,max:o=20,label:l,step:n=1,format:s,testID:c}){const u=s?s(e):String(e),b=e=>Math.round(e/n)*n;return(0,B.jsxs)(O,{gap:10,children:[(0,B.jsx)(h.default,{testID:c?`${c}-down`:void 0,accessibilityRole:"button",accessibilityLabel:`Decrease ${l??''}`,disabled:e<=r,onPress:()=>t(Math.max(r,b(e-n))),style:[N.stepBtn,e<=r?{opacity:.4}:null],children:(0,B.jsx)(D,{size:20,colour:C.colours.gold,children:"\u2212"})}),(0,B.jsx)(x.default,{testID:c?`${c}-value`:void 0,accessibilityLabel:l?`${l}: ${u}`:u,children:(0,B.jsx)(D,{weight:"semibold",size:C.font.large,style:{minWidth:s?64:28,textAlign:'center'},children:u})}),(0,B.jsx)(h.default,{testID:c?`${c}-up`:void 0,accessibilityRole:"button",accessibilityLabel:`Increase ${l??''}`,disabled:e>=o,onPress:()=>t(Math.min(o,b(e+n))),style:[N.stepBtn,e>=o?{opacity:.4}:null],children:(0,B.jsx)(D,{size:20,colour:C.colours.gold,children:"+"})})]})},_e.Sheet=function({visible:e,onClose:o,title:l,children:n,maxWidth:c,testID:f,footer:y}){const{height:w}=(0,p.default)(),W=s.default.useContext(j.SafeAreaInsetsContext)??{top:0,bottom:0,left:0,right:0},k=(0,r.useTyping)(),S=(0,r.useVisibleArea)(),I=k&&S&&S.height({minHeight:44,minWidth:72,paddingHorizontal:14,borderRadius:22,borderWidth:1.5,borderColor:C.colours.gold,backgroundColor:e?'rgba(201,162,77,0.22)':'rgba(201,162,77,0.10)',alignItems:'center',justifyContent:'center'}),children:(0,B.jsx)(D,{size:15,weight:"semibold",colour:C.colours.goldLight,center:!0,children:"Done"})}):null,R?(0,B.jsx)(h.default,{accessibilityRole:"button",accessibilityLabel:"Close",onPress:o,hitSlop:8,testID:"sheet-close",style:{minWidth:72,minHeight:48,alignItems:'center',justifyContent:'center',marginRight:-8},children:(0,B.jsx)(D,{size:18,colour:C.colours.text,children:"Close"})}):(0,B.jsx)(t.GoldClose,{onPress:o,testID:"sheet-close",style:{marginRight:-6,minWidth:48,minHeight:48}})]}),(0,B.jsx)(b.default,{style:{flexShrink:1},contentContainerStyle:{gap:12,paddingTop:2,paddingBottom:4},children:n}),y?(0,B.jsx)(x.default,{style:{borderTopWidth:1,borderTopColor:C.colours.border,paddingTop:10,marginTop:8},testID:f?`${f}-footer`:void 0,children:y}):null]})})})},_e.SectionTitle=function({children:e}){return(0,B.jsx)(D,{weight:"semibold",size:12,colour:C.colours.goldMuted,center:!0,style:{textTransform:'uppercase',letterSpacing:1.6,marginTop:8},children:e})},Object.defineProperty(_e,"styles",{enumerable:!0,get:function(){return N}}),_r(d[0]);var t=_r(d[1]),r=_r(d[2]),o=_r(d[3]),l=_r(d[4]),n=_r(d[5]),s=e(_r(d[6])),c=e(_r(d[7])),u=e(_r(d[8]));_r(d[9]);var h=e(_r(d[10])),b=e(_r(d[11])),f=e(_r(d[12])),y=e(_r(d[13])),x=e(_r(d[14])),p=e(_r(d[15])),j=_r(d[16]),C=_r(d[17]),w=_r(d[18]),W=_r(d[19]),k=_r(d[20]),S=_r(d[21]),I=_r(d[22]),B=_r(d[23]);const R=['kirkton','abbotsford'].includes(k.VENUE_RID),L='display'!==S.APP_VARIANT;function D({children:e,style:t,size:r=C.font.body,weight:l="regular",colour:n=C.colours.text,numberOfLines:s,center:c,testID:u,accessibilityRole:h,accessibilityLabel:b}){const y='string'==typeof e&&/^(https?:\/\/|www\.)\S+$/.test(e.trim()),x=y?{minWidth:0,maxWidth:'100%',overflowWrap:'anywhere',wordBreak:'break-all',alignSelf:'stretch'}:void 0,p=f.default.flatten(t)||{},j=1===p.flex||1===p.flexGrow||'number'==typeof p.width||'left'===p.textAlign,k=c??(L&&('semibold'===l||'bold'===l)&&!j);return(0,B.jsx)(o.Text,{testID:u??(y?'cc-url':void 0),...k?{dataSet:{centre:'heading'}}:{},accessibilityRole:h,accessibilityLabel:b,numberOfLines:s,style:[{minWidth:0,fontFamily:C.fonts[l],fontSize:r,color:n,lineHeight:(0,w.lineFor)(r)},k&&{textAlign:'center',alignSelf:'center',maxWidth:'100%'},t,x,(0,W.webLine)(t,r),k&&'left'!==p.textAlign?{textAlign:'center'}:null],children:e})}const P=e=>(0,B.jsx)(D,{size:C.font.title,weight:"semibold",center:!0,...e}),T=e=>(0,B.jsx)(D,{size:C.font.large,weight:"semibold",center:!0,...e}),z=e=>(0,B.jsx)(D,{colour:C.colours.muted,size:C.font.small,...e,center:e.center??L});function A({title:e,back:t=!0,right:r,subtitle:o}){return(0,B.jsxs)(x.default,{style:N.brandBar,children:[(0,B.jsxs)(x.default,{style:N.row,children:[(0,B.jsx)(x.default,{style:N.brandSide,children:t?(0,B.jsx)(h.default,{accessibilityRole:"button",accessibilityLabel:"Back",onPress:()=>l.router.canGoBack()?l.router.back():l.router.replace(S.ENTRY[S.APP_VARIANT]),style:N.backBtn,hitSlop:10,children:(0,B.jsx)(D,{size:18,weight:"semibold",colour:C.colours.gold,children:"\u2039 Back"})}):null}),(0,B.jsx)(h.default,{onPress:()=>l.router.push(S.ENTRY[S.APP_VARIANT]),accessibilityLabel:"Home",style:N.brandCenter,children:(0,B.jsx)(I.RestaurantBrand,{size:I.HEADER_LOGO})}),(0,B.jsx)(x.default,{style:[N.brandSide,{alignItems:'flex-end'}],children:r?(0,B.jsx)(x.default,{style:{flexShrink:0},children:r}):null})]}),e?(0,B.jsx)(P,{style:{marginTop:10,alignSelf:'stretch'},children:e}):null,o?(0,B.jsx)(z,{center:!0,style:{alignSelf:'stretch'},children:o}):null]})}function H(){const e=(0,l.useLocalSearchParams)().rid??k.VENUE_RID,t=(0,n.useStore)(t=>t.restaurants.find(t=>t.id===e)?.contactEmail);return t?(0,B.jsx)(h.default,{accessibilityRole:"link",accessibilityLabel:`Email ${t}`,onPress:()=>{c.default.openURL(`mailto:${t}`)},style:{minHeight:44,justifyContent:'center',alignItems:'center',maxWidth:'100%'},children:(0,B.jsx)(D,{center:!0,size:14,colour:C.colours.gold,children:t})}):null}function v({label:e,sub:t,onPress:r,kind:o="primary",disabled:l,small:n,style:s,accessibilityLabel:c,accessibilityHint:u,testID:b}){const f={primary:C.colours.gold,secondary:C.colours.tile,danger:C.colours.redSolid,ghost:'transparent',success:C.colours.accentBg}[o],y={primary:C.colours.onGold,secondary:C.colours.text,danger:'#FFFFFF',ghost:C.colours.gold,success:C.colours.goldLight}[o],x={primary:'transparent',secondary:C.colours.hairline,danger:'transparent',ghost:'transparent',success:C.colours.accentBorder}[o];return(0,B.jsxs)(h.default,{testID:b,accessibilityRole:"button",accessibilityLabel:c??e,accessibilityHint:u,accessibilityState:{disabled:!!l},disabled:l,onPress:r,style:({pressed:e})=>[N.btn,{backgroundColor:e&&'secondary'===o?C.colours.tilePressed:f,borderColor:x,opacity:l?.4:e?.85:1},n&&{paddingVertical:8,paddingHorizontal:14,minHeight:w.control.min,minWidth:44},s],children:[(0,B.jsx)(D,{weight:"semibold",size:n?C.font.small:C.font.body,colour:y,center:!0,children:e.trim()}),t?(0,B.jsx)(D,{size:n?C.font.small-2:C.font.small,colour:y,center:!0,testID:b?`${b}-sub`:void 0,children:t}):null]})}function F({children:e,style:t,onPress:r,highlight:o}){const l=o===C.colours.gold||o===C.colours.accentBorder,n=(0,B.jsx)(x.default,{testID:"cc-card",style:[N.card,{alignItems:'stretch'},o?{borderColor:l?C.colours.accentBorder:o,borderWidth:l?1:2}:null,t],children:e});return r?(0,B.jsx)(h.default,{accessibilityRole:"button",onPress:r,style:({pressed:e})=>({opacity:e?.85:1}),children:n}):n}function E({kind:e="info",title:t,children:r}){const o={info:[C.colours.surface,C.colours.gold,C.colours.text],warn:[C.colours.amberBg,C.colours.amber,'#FFE2A8'],danger:[C.colours.redBg,C.colours.red,'#FFE3DF'],success:[C.colours.okBg,C.colours.ok,C.colours.goldLight],example:[C.colours.amberBg,C.colours.amber,'#FFE2A8'],demo:[C.colours.goldTint,C.colours.gold,C.colours.goldLight]}[e];return(0,B.jsxs)(x.default,{accessibilityRole:"summary",style:[N.banner,{backgroundColor:o[0],borderLeftColor:o[1]}],children:[t?(0,B.jsx)(D,{weight:"semibold",colour:o[2],center:!0,children:t}):null,s.default.Children.toArray(r).every(e=>'string'==typeof e||'number'==typeof e)?(0,B.jsx)(D,{size:C.font.small,colour:o[2],center:!0,children:r}):r]})}z.statusLine=!0,v.centreRow=!0;const V=()=>(0,B.jsx)(E,{kind:"example",title:"Allergens awaiting kitchen verification",children:"This allergen information has not been verified by the kitchen. Head chef sign-off is required. Always speak to staff about allergies."}),$=()=>(0,B.jsx)(E,{kind:"demo",title:"Card payments: not set up yet",children:"No card is charged and no payment provider is contacted."});function O({children:e,style:t,gap:r=8,wrap:o}){const l=s.default.Children.map(e,e=>{if(!s.default.isValidElement(e))return e;const t=e,r=f.default.flatten(t.props.style)||{};return 1!==r.flex&&1!==r.flexGrow?e:s.default.cloneElement(t,{style:[t.props.style,{minWidth:Math.max(t.type===F?240:180,'number'==typeof r.minWidth?r.minWidth:0)}]})}),n=f.default.flatten(t)||{},c=s.default.Children.toArray(l).filter(s.default.isValidElement),u=e=>e.type;if(L&&'space-between'===n.justifyContent&&1!==n.flex&&2===c.length&&c.some(e=>u(e).statusLine))return(0,B.jsx)(x.default,{dataSet:{centre:'status'},style:{alignItems:'center',alignSelf:'stretch',width:'100%',gap:r},children:c});const h=L&&c.length>=2&&c.every(e=>u(e).centreRow)&&'flex-start'!==n.justifyContent&&'space-between'!==n.justifyContent;return(0,B.jsx)(x.default,{...h?{dataSet:{centre:'buttons'}}:{},style:[N.row,{gap:r},h&&{justifyContent:'center',flexWrap:'wrap'},o&&{flexWrap:'wrap',justifyContent:'center'},t],children:l})}const _=()=>(0,B.jsx)(x.default,{style:{height:1,backgroundColor:C.colours.border,marginVertical:4}});const N=f.default.create({row:{flexDirection:'row',alignItems:'center',flexWrap:'wrap',minWidth:0,maxWidth:'100%'},brandBar:{paddingHorizontal:16,paddingTop:8,paddingBottom:8,borderBottomWidth:1,borderBottomColor:C.colours.border},brandSide:{width:96,minHeight:48,justifyContent:'center'},brandCenter:{flex:1,alignItems:'center',justifyContent:'center',minHeight:48},backBtn:{paddingRight:12,minHeight:48,minWidth:88,justifyContent:'center'},btn:{minWidth:0,maxWidth:'100%',flexShrink:1,borderRadius:w.radii.button,paddingVertical:12,paddingHorizontal:18,borderWidth:1,alignItems:'center',justifyContent:'center',minHeight:w.control.min,alignSelf:'stretch'},card:{minWidth:0,maxWidth:'100%',backgroundColor:C.colours.surface,borderRadius:C.radius.l,padding:16,borderWidth:1,borderColor:C.colours.hairline,gap:8},badge:{borderRadius:999,paddingHorizontal:9,paddingVertical:2,borderWidth:1,alignSelf:'flex-start'},banner:{borderRadius:C.radius.m,padding:12,borderLeftWidth:5,gap:2},input:{minWidth:0,boxSizing:'border-box',backgroundColor:C.colours.surface2,borderColor:C.colours.border,borderWidth:1,borderRadius:C.radius.m,paddingHorizontal:12,paddingVertical:10,color:C.colours.text,fontSize:C.font.body,fontFamily:C.fonts.regular},chip:{maxWidth:'100%',flexShrink:0,borderWidth:1,borderColor:C.colours.border,borderRadius:C.radius.m,paddingHorizontal:12,paddingVertical:8,backgroundColor:C.colours.surface2,minWidth:64,minHeight:44,justifyContent:'center'},stepBtn:{width:44,height:44,borderRadius:22,borderWidth:1.5,borderColor:C.colours.gold,alignItems:'center',justifyContent:'center'},overlay:{flex:1,backgroundColor:'rgba(0,0,0,0.7)',justifyContent:'center',alignItems:'center',padding:16},sheet:{backgroundColor:C.colours.surface,borderRadius:w.radii.xl,padding:18,width:'100%',maxWidth:520,maxHeight:'90%',borderWidth:1,borderColor:C.colours.gold},footer:{borderTopWidth:1,borderTopColor:C.colours.border,backgroundColor:C.colours.surface,padding:12}})},794,[795,796,830,827,30,831,34,379,395,236,402,295,41,410,102,426,36,821,826,871,5,872,873,25]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"RESPONSIVE_CSS",{enumerable:!0,get:function(){return t}});const t="\n*,*::before,*::after { box-sizing:border-box !important; }\nhtml,body { max-width:100%; overflow-x:hidden; }\ninput,select,textarea { box-sizing:border-box !important; min-width:0; max-width:100%; }\n[dir=\"auto\"] { overflow-wrap:break-word; }\n[data-testid^=\"area-summary-\"] [dir=\"auto\"] { overflow-wrap:normal; word-break:keep-all; text-align:center; }\n[data-testid=\"venue-header-name\"],\n[data-testid^=\"avatar-option-\"] [dir=\"auto\"] { overflow-wrap:normal !important; word-break:keep-all !important; }\n[data-testid=\"cc-card\"] { min-width:0; max-width:100%; overflow-x:hidden; }\n[data-testid=\"cc-card\"] > [dir=\"auto\"] { text-align:center; }\n[data-testid=\"cc-card\"] > * { min-width:0; max-width:100%; }\n";if('undefined'!=typeof document&&!document.getElementById('cc-responsive-sizing')){const n=document.createElement('style');n.id='cc-responsive-sizing',n.textContent=t,document.head.appendChild(n)}},795,[]); @@ -1095,7 +1095,7 @@ __d(function(g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule' __d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.setClockServer=function(t){s=t,c()},e.markClockUnsent=function(t){o.set(t,Date.now()),c()},e.markClockSent=function(t){o.delete(t)&&c()},e.clockNotSent=l,e.useClockNotSent=function(o){const[,c]=(0,t.useState)(0);return(0,t.useEffect)(()=>{const t=()=>c(t=>t+1);u.add(t);const o=n.mutationQueue.subscribe(t);return()=>{u.delete(t),o()}},[]),l(o)};var t=r(d[0]),n=r(d[1]);const o=new Map,u=new Set,c=()=>{for(const t of u)t()};let s=()=>!1;function l(t){if(!t)return!1;return n.mutationQueue.pending.some(n=>'attendance'===n.table&&n.rowKey===t)||o.has(t)&&s()}n.mutationQueue.onDone(t=>{'attendance'===t.table&&o.delete(t.rowKey)&&c()})},1012,[34,1013]); __d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"MutationQueue",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"mutationQueue",{enumerable:!0,get:function(){return o}});var t=_r(d[0]),e=_r(d[1]),s=_r(d[2]);const n='queue:v1',r='queue:failed:v1',h=t=>`${t.table}|${t.venueId}|${t.rowKey}`;class l{items=[];failedItems=[];loaded=null;flushing=null;flushingSince=0;exec=null;listeners=new Set;onFailure=new Set;onSaved=new Set;retryTimer=null;waitTimer=null;backoffMs=2e3;now=()=>Date.now();constructor(){(0,t.onConnectivity)(t=>{t&&this.flush()})}setExecutor(t){this.exec=t}load(){return this.loaded||(this.loaded=(async()=>{const t=await e.kv.get(n,[]);this.items=[...t.map(t=>({...t,nextAt:void 0})),...this.items],this.failedItems=await e.kv.get(r,[]),this.emit()})()),this.loaded}get pending(){return this.items}get waiting(){return this.items.filter(t=>t.attempts>0)}get failed(){return this.failedItems}hasPending(t,e,s){return this.items.some(n=>n.table===t&&n.venueId===e&&n.rowKey===s)}async enqueue(t){await this.load();const s={...t,id:(0,e.uuid)(),createdAt:(new Date).toISOString(),attempts:0};return this.items.push(s),await this.persist(),this.flush(),s}nextReady(){const t=new Set,e=this.now();for(const s of this.items){const n=h(s);if(!t.has(n)){if(!(s.nextAt&&s.nextAt>e))return s;t.add(n)}}}remove(t){this.items=this.items.filter(e=>e!==t)}flush(){if(this.flushing&&Date.now()-this.flushingSince<6e4)return this.flushing;this.flushingSince=Date.now();let e=null;return e=(async()=>{for(await this.load();this.exec;){if(this.flushing&&this.flushing!==e)return;const n=this.nextReady();if(!n)break;if(!(0,t.isOnline)()){this.scheduleRetry();break}try{const t=await this.exec(n);this.remove(n),this.backoffMs=2e3,'conflict'===t?this.fail(n,'conflict','Row changed on the server (version conflict) or is not visible to you'):this.onSaved.forEach(t=>t(n))}catch(e){n.attempts+=1,n.lastError=String(e?.message??e);const r=e??{};n.lastErr={code:r.code?String(r.code):void 0,status:Number(r.status)||void 0,message:n.lastError.slice(0,300)};const h=(0,s.classifyWriteError)(e);if('network'===h){n.attempts-=1,(0,t.setOnline)(!1),this.scheduleRetry(),await this.persist();break}'retry'===h?n.nextAt=this.now()+(0,s.retryDelayMs)(n.attempts):(this.remove(n),this.fail(n,'rejected',n.lastError))}await this.persist()}this.flushing===e&&(this.flushing=null),this.scheduleWaiting()})(),this.flushing=e,e}retryNow(){for(const t of this.items)t.nextAt=void 0;return this.flush()}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}onFailed(t){return this.onFailure.add(t),()=>{this.onFailure.delete(t)}}onDone(t){return this.onSaved.add(t),()=>{this.onSaved.delete(t)}}async clearFailed(){this.failedItems=[],await e.kv.set(r,[]),this.emit()}fail(t,s,n){const h={...t,lastError:n,failedAt:(new Date).toISOString(),reason:s};this.failedItems=[h,...this.failedItems].slice(0,100),e.kv.set(r,this.failedItems),this.onFailure.forEach(t=>t(h))}scheduleWaiting(){this.waitTimer&&(clearTimeout(this.waitTimer),this.waitTimer=null);const t=this.items.map(t=>t.nextAt??0).filter(t=>t>0);if(!t.length)return;const e=Math.max(500,Math.min(...t)-this.now());this.waitTimer=setTimeout(()=>{this.waitTimer=null,this.flush()},e)}scheduleRetry(){if(this.retryTimer)return;const e=this.backoffMs;this.backoffMs=Math.min(2*this.backoffMs,6e4),this.retryTimer=setTimeout(()=>{this.retryTimer=null,(0,t.setOnline)(!0),this.flush()},e)}async persist(){await e.kv.set(n,this.items),this.emit()}emit(){this.listeners.forEach(t=>t())}}const o=new l},1013,[1010,977,1014]); __d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.classifyWriteError=function(o){if((0,e.isNetworkError)(o))return'network';const{code:n,status:c,msg:l}=t(o);return s(o)?'refused':/^(08|53|57|58)/.test(n)||['40001','40P01','55P03','23505','23503'].includes(n)||/^PGRST30[0-3]$/.test(n)||/jwt|token.*expired/i.test(l)||401===c||408===c||425===c||429===c||c>=500?'retry':409!==c||n?'refused':'retry'},Object.defineProperty(_e,"retryDelayMs",{enumerable:!0,get:function(){return o}}),_e.describeWrite=function(e){const t='rpc'===e.kind?(e.fn??'change').replace(/_/g,' '):n[e.table]??e.table.replace(/_/g,' ').replace(/s$/,''),s=e.values??{},o=s.guest_name??s.name??s.display_name??s.title??s.reason,c='string'==typeof o&&o.trim()?` for ${o.trim().slice(0,60)}`:'';return'delete'===e.kind?`deleting a ${t}${c}`:`the ${t}${c}`},_e.plainReason=function(e,o){const{code:n,status:c,msg:l}=t(e);if('refused'===o)return s(e)?'more than 20 deletes in 10 minutes from one sign-in are stopped to keep your data safe':'42501'===n||403===c||/row-level security|permission/i.test(l)?'your sign-in isn\u2019t allowed to change this':'conflict'===n?'it was changed or removed on another device first':/^(22|23)/.test(n)?'the shared system says some of the details aren\u2019t valid':'P0001'===n&&l?l.slice(0,140):l?`the shared system said: ${l.slice(0,120)}`:'the shared system refused it';return'23505'===n?'the shared system already has another copy of it':'23503'===n?'a related change has to save first':/^PGRST30/.test(n)||401===c||/jwt/i.test(l)?'your sign-in is being refreshed':'the shared system is busy'};var e=r(d[0]);const t=e=>{const t=e&&'object'==typeof e?e:{};return{msg:String(t.message??e??''),code:String(t.code??''),status:Number(t.status??0)||0,hint:String(t.hint??'')}},s=e=>{const s=t(e);return/delete guard/i.test(s.hint)||/too many .* deleted in 10 minutes/i.test(s.msg)};const o=e=>Math.min(5e3*Math.pow(3,Math.max(0,e-1)),3e5),n={bookings:'booking',walk_ins:'walk-in',blocks:'blocked time',sold_out_items:'sold-out mark',sold_out_links:'dish stock link',staff:'staff details',rota_shifts:'rota shift',stock_items:'stock item',stock_events:'stock count',stock_counts:'stock count',chat_messages:'chat message',recipe_cards:'recipe card',order_lists:'order list',order_list_items:'order list item',daily_task_ticks:'task tick',daily_tasks:'daily task',attendance:'clock in or out',cash_ups:'cash-up',table_plans:'table plan',guest_profiles:'guest profile',floor_live:'table status',venues:'venue settings',time_requests:'clock correction request',staff_leave:'time off',scheduled_notifications:'reminder',suppliers:'supplier',supplier_orders:'supplier order',takeaway_orders:'takeaway order'}},1014,[1010]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"APP_VERSION",{enumerable:!0,get:function(){return t}});const t='v0.3.12.160'},1015,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"APP_VERSION",{enumerable:!0,get:function(){return t}});const t='v0.3.12.161'},1015,[]); __d(function(g,_r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"TableRepository",{enumerable:!0,get:function(){return c}}),e.executeMutation=async function(t){const s=(t,s)=>{throw Object.assign(t,{status:s})};if('rpc'===t.kind){const{error:n,status:r}=await u().rpc(t.fn,t.values??{});return n&&s(n,r),'ok'}const n=u().from(t.table);if('upsert'===t.kind||'insert'===t.kind){const{error:r,status:o}=await n.upsert(t.values??{},{onConflict:t.conflictKey??'id',ignoreDuplicates:'insert'===t.kind});return r&&s(r,o),'ok'}let r='update'===t.kind?n.update(t.values??{}):n.delete();for(const[s,n]of Object.entries(t.match??{}))r=r.eq(s,n);const{data:o,error:c,status:h}=await r.select();c&&s(c,h);return'update'!==t.kind||o&&0!==o.length?'ok':'conflict'};var t=_r(d[0]),s=_r(d[1]),n=_r(d[2]),r=_r(d[3]),o=_r(d[4]);const u=()=>(0,n.getSupabase)();class c{constructor(t,s={}){this.table=t,this.opts=s,this.keyOf=s.keyOf??(t=>String(t.id)),this.keyColumns=s.keyColumns??['id'],this.venueCol=s.venueColumn??'venue_id'}rows(t){return s.cache.rows(this.table,t)}get(t,n){return s.cache.get(this.table,t,n)}subscribe(t,n){return s.cache.subscribe(this.table,t,n)}hydrate(t){return s.cache.hydrate(this.table,t)}async refresh(n,r={}){const c=()=>{let t=u().from(this.table).select('*').eq(this.venueCol,n);return this.opts.orderBy&&(t=t.order(this.opts.orderBy.column,{ascending:this.opts.orderBy.ascending??!0})),r.filter&&(t=r.filter(t)),t},h='bookings'===this.table?await(0,t.readPages)(async(t,s)=>{const{data:n,error:r}=await c().order('id').range(t,s);if(r)throw r;return n??[]}):await(async()=>{const{data:t,error:s}=await c().limit(this.opts.limit??1e3);if(s)throw s;return t??[]})();return s.cache.replace(this.table,n,h.map(t=>[this.keyOf(t),t]),t=>o.mutationQueue.hasPending(this.table,n,t)),h}async create(t,n){const u={...1===this.keyColumns.length&&'id'===this.keyColumns[0]?{id:(0,r.uuid)()}:{},...n,[this.venueCol]:t},c=this.keyOf(u);return s.cache.put(this.table,t,c,u),await o.mutationQueue.enqueue({table:this.table,venueId:t,kind:'insert'===this.opts.writeMode?'insert':'upsert',rowKey:c,values:u,conflictKey:this.opts.conflictKey??'id'}),u}async update(t,n,r,u={}){const c=s.cache.get(this.table,t,n),h={...this.matchFor(n,c),...u,[this.venueCol]:t};s.cache.patch(this.table,t,n,{...r,updated_at:(new Date).toISOString()}),await o.mutationQueue.enqueue({table:this.table,venueId:t,kind:'update',rowKey:n,values:r,match:h})}async remove(t,n){const r=s.cache.get(this.table,t,n),u={...this.matchFor(n,r),[this.venueCol]:t};s.cache.remove(this.table,t,n),await o.mutationQueue.enqueue({table:this.table,venueId:t,kind:'delete',rowKey:n,match:u})}matchFor(t,s){if(1===this.keyColumns.length&&'id'===this.keyColumns[0])return{id:t};const n={};for(const t of this.keyColumns)n[t]=s?.[t];return n}}},1016,[1017,1018,933,977,1013]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.readPages=async function(t,n=1e3){const s=[];for(let c=0;;c+=n){const o=await t(c,c+n-1);if(s.push(...o),o.length`cache:${t}:${n}`;function f(t){let s=n.get(t);return s||(s=new Map,n.set(t,s)),s}function p(n){s.delete(n),c.get(n)?.forEach(t=>t());const u=o.get(n);u&&clearTimeout(u),o.set(n,setTimeout(()=>{o.delete(n),t.kv.set(n,Array.from(f(n).entries()))},250))}const w={async hydrate(n,s){const c=l(n,s);if(u.has(c))return;u.add(c);const o=await t.kv.get(c,[]),w=f(c);let h=0;for(const[t,n]of o)w.has(t)||(w.set(t,n),h++);h&&p(c)},rows(t,n){const c=l(t,n);let o=s.get(c);return o||(o=Array.from(f(c).values()),s.set(c,o)),o},get:(t,n,s)=>f(l(t,n)).get(s),put(t,n,s,c){f(l(t,n)).set(s,c),p(l(t,n))},patch(t,n,s,c){const o=f(l(t,n)),u=o.get(s);u&&(o.set(s,{...u,...c}),p(l(t,n)))},remove(t,n,s){f(l(t,n)).delete(s)&&p(l(t,n))},replace(t,s,c,o=()=>!1){const u=l(t,s),w=f(u),h=new Map(c);w.forEach((t,n)=>{o(n)&&h.set(n,t)}),n.set(u,h),p(u)},subscribe(t,n,s){const o=l(t,n);let u=c.get(o);return u||(u=new Set,c.set(o,u)),u.add(s),()=>{u?.delete(s)}},async clearVenue(o,f){for(const p of f){const f=l(p,o);n.delete(f),s.delete(f),u.delete(f),await t.kv.remove(f),c.get(f)?.forEach(t=>t())}}}},1018,[977]); @@ -1197,7 +1197,7 @@ __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule', __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SEATED_BG",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"SEATED_FG",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"SEATED_MUTED",{enumerable:!0,get:function(){return u}}),e.isSeatedHighlight=function(t,o){return'seated'===t&&!o?.otherDay},e.seatedHighlightStyle=function(u){return{backgroundColor:o,borderColor:t.colours.goldLight,borderWidth:1.5,borderLeftWidth:8,borderLeftColor:n,...u}};var t=r(d[0]);const o=t.colours.gold,n=t.colours.onGold,u='#3F3218'},1114,[821]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.BookingTableButton=function({rid:e,booking:l,readOnly:y,turnBase:B=90,testID:f}){const[h,j]=(0,t.useState)(!1),k=(0,s.tableButtonLabel)(l.table),x=f??`table-btn-${l.id}`;if(y)return(0,c.jsx)(n.default,{testID:x,accessible:!0,accessibilityLabel:(0,s.tableButtonA11y)(l.table,!0),style:{minHeight:44,justifyContent:'center'},children:(0,c.jsx)(b.T,{size:16,weight:"semibold",colour:o.colours.goldLight,children:k})});return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(b.Button,{kind:"secondary",label:k,testID:x,accessibilityLabel:(0,s.tableButtonA11y)(l.table),onPress:()=>j(!0),style:{minHeight:44}}),h?(0,c.jsx)(u.TablePicker,{rid:e,booking:l,name:l.walkIn?'Walk-in':(l.name??'').replace(' (example)',''),turnBase:B,onClose:()=>j(!1)}):null]})};var e,t=r(d[0]),l=r(d[1]),n=(e=l)&&e.__esModule?e:{default:e},s=r(d[2]),o=r(d[3]),u=r(d[4]),b=r(d[5]),c=r(d[6])},1115,[34,102,1116,821,1117,794,25]); __d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"tableButtonLabel",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"tableButtonA11y",{enumerable:!0,get:function(){return s}}),e.tableOptions=function(t,n,o){const s=t.tables.map(t=>t.name).sort(l),c=new Set;return(t.joins??[]).forEach(t=>{t.tables.length>1&&c.add(t.tables.slice().sort(l).join('+'))}),[...n.map(t=>t.table),o].forEach(t=>{const n=a(t);n.length>1&&c.add(n.slice().sort(l).join('+'))}),[...s,...[...c].sort(l)]},e.tableOverlaps=function(t,l,o,s=90){const c=a(l);if(!c.length)return[];const b={...t,table:l};return o.filter(l=>l.id!==t.id&&l.date===t.date&&!['cancelled','noshow','finished'].includes(l.status)&&a(l.table).some(t=>c.includes(t))&&(0,n.startOf)(b)<(0,n.endOf)(l,s)&&(0,n.startOf)(l)<(0,n.endOf)(b,s))},Object.defineProperty(e,"tablePatch",{enumerable:!0,get:function(){return c}});var t=r(d[0]),n=r(d[1]);const a=t=>t?t.split('+').map(t=>t.trim()).filter(Boolean):[],l=(t,n)=>t.localeCompare(n,'en-GB',{numeric:!0}),o=n=>(0,t.tableNumbers)(n)||'No table',s=(n,a)=>`${(0,t.tableNumbersA11y)(n)}${a?'':', change table'}`;const c=t=>({table:t||void 0,tableSetHere:!0})},1116,[860,1101]); -__d(function(_g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.saveBookingTables=v,_e.TablePicker=function({rid:e,booking:u,name:g,turnBase:k=90,onClose:$,onSaved:w,onPickOnPlan:C}){const L=(0,b.usePlan)(e),S=(0,c.useBookings)(e),[T,P]=(0,l.useState)(()=>(0,b.tablesOf)((0,h.tableKey)((0,b.tablesOf)(u.table)))),W=(0,l.useMemo)(()=>(0,h.pickGroups)(L),[L]),z=S.filter(e=>e.date===u.date),I=(0,h.seatsOf)(L,T),D=(0,h.seatLine)(I.total,u.partySize),B=(0,h.pickClashes)(u,T,z,k),O=e=>(0,h.pickClashes)(u,[e],z,k)[0]?.with,R=(0,h.tableKey)(T)!==(0,h.tableKey)((0,b.tablesOf)(u.table)),M=(0,f.useBlocks)(e=>e.blocks),N=(0,f.blockAt)(M,e,u.date,u.time),[_,A]=(0,l.useState)(null),G=e=>{A(null),P(t=>(0,h.toggleTable)(t,e))},Y=async t=>{try{await v(e,u,t),w?.((0,h.savedWords)(g,u.partySize,t,(0,h.seatsOf)(L,t).total)),$()}catch(e){w?.(`Couldn\u2019t save tables for ${g}: ${String(e?.message??e).slice(0,120)}`)}},K=(0,x.jsxs)(n.default,{style:{gap:8},children:[(0,x.jsxs)(n.default,{testID:"table-pick-total",accessible:!0,accessibilityLabel:`${(0,h.tablesWords)(T)} picked. ${D.text}.`,children:[(0,x.jsx)(p.T,{size:18,weight:"semibold",center:!0,colour:y.colours.goldLight,children:(0,h.tablesWords)(T)}),(0,x.jsx)(p.T,{size:17,center:!0,colour:y.colours.text,children:D.text})]}),N?(0,x.jsx)(n.default,{testID:"table-pick-pause",accessible:!0,accessibilityLabel:`Note. New bookings are paused ${N.from} to ${N.to}${N.reason?` (${N.reason})`:''}. You can still assign tables to this booking.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:y.colours.goldMuted},children:(0,x.jsxs)(p.T,{size:16,center:!0,colour:y.colours.goldLight,children:["New bookings paused ",N.from,"\u2013",N.to,N.reason?` \xb7 ${N.reason}`:'',". You can still save tables for this booking."]})}):null,B.length?(0,x.jsx)(n.default,{testID:"table-pick-clash",accessible:!0,accessibilityLabel:`Warning. ${(0,h.clashWords)(B)} You can still save.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:y.colours.gold},children:(0,x.jsxs)(p.T,{size:16,weight:"semibold",center:!0,colour:y.colours.goldLight,children:[(0,h.clashWords)(B)," You can still save."]})}):null,_?(0,x.jsxs)(n.default,{testID:"table-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:_,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:y.colours.amber,backgroundColor:y.colours.amberBg,alignItems:'stretch'},children:[(0,x.jsx)(p.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:_}),(0,x.jsxs)(p.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,x.jsx)(p.Button,{testID:"table-pick-overcap-yes",label:"Use it anyway",accessibilityLabel:`Use it anyway, ${(0,h.tablesWords)(T)} for ${g}, ${u.partySize} people`,onPress:()=>{Y(T)},style:[j,{flexGrow:1}]}),(0,x.jsx)(p.Button,{testID:"table-pick-overcap-no",kind:"secondary",label:"Pick another table",onPress:()=>A(null),style:j})]})]}):null,(0,x.jsxs)(p.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[_?null:(0,x.jsx)(p.Button,{testID:"table-pick-save",label:B.length?'Save anyway':'Save tables',disabled:!R||!T.length,accessibilityLabel:`${B.length?'Save anyway, ':'Save, '}${(0,h.tablesWords)(T)} for ${g}. ${D.text}.${B.length?` ${(0,h.clashWords)(B)}`:''}`,onPress:()=>{const e=(0,h.overCapacityAsk)(T,I.total,u.partySize);!e||_?Y(T):A(e)},style:[j,{flexGrow:1}]}),(0,b.tablesOf)(u.table).length?(0,x.jsx)(p.Button,{testID:"table-pick-clear",kind:"secondary",label:"Clear table",accessibilityLabel:`Clear table, take ${(0,h.tablesWords)((0,b.tablesOf)(u.table)).toLowerCase()} off ${g}`,onPress:()=>Y([]),style:j}):null,(0,x.jsx)(p.Button,{testID:"table-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",onPress:$,style:j})]})]});return(0,x.jsxs)(p.Sheet,{visible:!0,onClose:$,title:`Tables \xb7 ${u.time} ${g} \xb7 ${u.partySize} Covers`,maxWidth:760,testID:"table-picker",footer:K,children:[(0,x.jsx)(t.TableNumberWarning,{plan:L}),(0,x.jsx)(p.T,{size:16,center:!0,colour:y.colours.text,children:"Tap one table, or several to join them. Tap again to take one off. Smaller tables can still be used."}),C?(0,x.jsx)(p.Button,{kind:"secondary",testID:"table-pick-on-plan",label:"Pick on the table plan",accessibilityLabel:`Pick on the table plan instead, for ${g}`,onPress:()=>C(T),style:j}):null,W.map(e=>(0,x.jsxs)(n.default,{style:{gap:6},accessibilityLabel:e.area,children:[(0,x.jsx)(p.T,{size:15,weight:"semibold",center:!0,colour:y.colours.gold,children:e.area}),(0,x.jsx)(p.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:e.tables.map(e=>{const t=T.includes(e.name),l=O(e.name);return(0,x.jsxs)(o.default,{testID:`table-pick-${e.name}`,accessibilityRole:"checkbox",accessibilityState:{checked:t},'aria-checked':t,accessibilityLabel:(0,h.pickA11y)(e.name,e.seats,t,l),onPress:()=>G(e.name),style:({pressed:e})=>({minWidth:92,minHeight:64,paddingHorizontal:10,paddingVertical:6,borderRadius:12,alignItems:'center',justifyContent:'center',borderWidth:t?2:1,borderColor:t?y.colours.gold:l?y.colours.goldMuted:y.colours.hairline,borderStyle:l&&!t?'dashed':'solid',backgroundColor:t?y.colours.gold:e?y.colours.tilePressed:y.colours.tile}),children:[(0,x.jsx)(p.T,{size:18,weight:"semibold",colour:t?y.colours.onGold:y.colours.text,children:(0,s.tableNumbers)(e.name)}),(0,x.jsxs)(p.T,{size:14,colour:t?y.colours.onGold:y.colours.muted,children:[e.seats," seats",l?' \xb7 booked':'']})]},e.name)})})]},e.area)),W.length?null:(0,x.jsx)(p.Muted,{center:!0,children:"No tables on the plan yet. Add them in Setup \u203a Table plan."})]})};var t=r(d[0]),s=r(d[1]),l=r(d[2]),o=e(r(d[3])),n=e(r(d[4])),c=r(d[5]),b=r(d[6]),u=r(d[7]),h=r(d[8]),y=r(d[9]),g=r(d[10]),p=r(d[11]),k=r(d[12]),f=r(d[13]),x=r(d[14]);const j={minHeight:56};async function v(e,t,s){const l=(0,h.tableKey)(s),o=(0,b.tablesOf)(t.table);await c.repo.bookings.update(t.id,(0,u.tablePatch)(l||null)),'seated'===t.status&&t.date===(0,g.venueYmd)(new Date)&&(o.filter(e=>!(0,b.tablesOf)(l).includes(e)).forEach(t=>b.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!0})),l&&(0,k.resetTableLive)(e,l))}},1117,[1118,860,34,402,102,874,1025,1116,1119,821,858,794,1120,1022,25]); +__d(function(_g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.saveBookingTables=v,_e.TablePicker=function({rid:e,booking:u,name:g,turnBase:k=90,onClose:$,onSaved:w,onPickOnPlan:C}){const L=(0,b.usePlan)(e),S=(0,c.useBookings)(e),[T,P]=(0,l.useState)(()=>(0,b.tablesOf)((0,h.tableKey)((0,b.tablesOf)(u.table)))),W=(0,l.useMemo)(()=>(0,h.pickGroups)(L),[L]),z=S.filter(e=>e.date===u.date),I=(0,h.seatsOf)(L,T),D=(0,h.seatLine)(I.total,u.partySize),B=(0,h.pickClashes)(u,T,z,k),O=e=>(0,h.pickClashes)(u,[e],z,k)[0]?.with,R=(0,h.tableKey)(T)!==(0,h.tableKey)((0,b.tablesOf)(u.table)),M=(0,f.useBlocks)(e=>e.blocks),N=(0,f.blockAt)(M,e,u.date,u.time),[_,A]=(0,l.useState)(null),G=e=>{A(null),P(t=>(0,h.toggleTable)(t,e))},Y=async t=>{try{await v(e,u,t),w?.((0,h.savedWords)(g,u.partySize,t,(0,h.seatsOf)(L,t).total)),$()}catch(e){w?.(`Couldn\u2019t save tables for ${g}: ${String(e?.message??e).slice(0,120)}`)}},K=(0,x.jsxs)(n.default,{style:{gap:8},children:[(0,x.jsxs)(n.default,{testID:"table-pick-total",accessible:!0,accessibilityLabel:`${(0,h.tablesWords)(T)} picked. ${D.text}.`,children:[(0,x.jsx)(p.T,{size:18,weight:"semibold",center:!0,colour:y.colours.goldLight,children:(0,h.tablesWords)(T)}),(0,x.jsx)(p.T,{size:17,center:!0,colour:y.colours.text,children:D.text})]}),N?(0,x.jsx)(n.default,{testID:"table-pick-pause",accessible:!0,accessibilityLabel:`Note. New bookings are paused ${N.from} to ${N.to}${N.reason?` (${N.reason})`:''}. You can still assign tables to this booking.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:y.colours.goldMuted},children:(0,x.jsxs)(p.T,{size:16,center:!0,colour:y.colours.goldLight,children:["New bookings paused ",N.from,"\u2013",N.to,N.reason?` \xb7 ${N.reason}`:'',". You can still save tables for this booking."]})}):null,B.length?(0,x.jsx)(n.default,{testID:"table-pick-clash",accessible:!0,accessibilityLabel:`Warning. ${(0,h.clashWords)(B)} You can still save.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:y.colours.gold},children:(0,x.jsxs)(p.T,{size:16,weight:"semibold",center:!0,colour:y.colours.goldLight,children:[(0,h.clashWords)(B)," You can still save."]})}):null,_?(0,x.jsxs)(n.default,{testID:"table-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:_,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:y.colours.gold,backgroundColor:y.colours.amberBg,alignItems:'stretch'},children:[(0,x.jsx)(p.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:_}),(0,x.jsxs)(p.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,x.jsx)(p.Button,{testID:"table-pick-overcap-yes",label:"Use it anyway",accessibilityLabel:`Use it anyway, ${(0,h.tablesWords)(T)} for ${g}, ${u.partySize} people`,onPress:()=>{Y(T)},style:[j,{flexGrow:1}]}),(0,x.jsx)(p.Button,{testID:"table-pick-overcap-no",kind:"secondary",label:"Pick another table",onPress:()=>A(null),style:j})]})]}):null,(0,x.jsxs)(p.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[_?null:(0,x.jsx)(p.Button,{testID:"table-pick-save",label:B.length?'Save anyway':'Save tables',disabled:!R||!T.length,accessibilityLabel:`${B.length?'Save anyway, ':'Save, '}${(0,h.tablesWords)(T)} for ${g}. ${D.text}.${B.length?` ${(0,h.clashWords)(B)}`:''}`,onPress:()=>{const e=(0,h.overCapacityAsk)(T,I.total,u.partySize);!e||_?Y(T):A(e)},style:[j,{flexGrow:1}]}),(0,b.tablesOf)(u.table).length?(0,x.jsx)(p.Button,{testID:"table-pick-clear",kind:"secondary",label:"Clear table",accessibilityLabel:`Clear table, take ${(0,h.tablesWords)((0,b.tablesOf)(u.table)).toLowerCase()} off ${g}`,onPress:()=>Y([]),style:j}):null,(0,x.jsx)(p.Button,{testID:"table-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",onPress:$,style:j})]})]});return(0,x.jsxs)(p.Sheet,{visible:!0,onClose:$,title:`Tables \xb7 ${u.time} ${g} \xb7 ${u.partySize} Covers`,maxWidth:760,testID:"table-picker",footer:K,children:[(0,x.jsx)(t.TableNumberWarning,{plan:L}),(0,x.jsx)(p.T,{size:16,center:!0,colour:y.colours.text,children:"Tap one table, or several to join them. Tap again to take one off. Smaller tables can still be used."}),C?(0,x.jsx)(p.Button,{kind:"secondary",testID:"table-pick-on-plan",label:"Pick on the table plan",accessibilityLabel:`Pick on the table plan instead, for ${g}`,onPress:()=>C(T),style:j}):null,W.map(e=>(0,x.jsxs)(n.default,{style:{gap:6},accessibilityLabel:e.area,children:[(0,x.jsx)(p.T,{size:15,weight:"semibold",center:!0,colour:y.colours.gold,children:e.area}),(0,x.jsx)(p.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:e.tables.map(e=>{const t=T.includes(e.name),l=O(e.name);return(0,x.jsxs)(o.default,{testID:`table-pick-${e.name}`,accessibilityRole:"checkbox",accessibilityState:{checked:t},'aria-checked':t,accessibilityLabel:(0,h.pickA11y)(e.name,e.seats,t,l),onPress:()=>G(e.name),style:({pressed:e})=>({minWidth:92,minHeight:64,paddingHorizontal:10,paddingVertical:6,borderRadius:12,alignItems:'center',justifyContent:'center',borderWidth:t?2:1,borderColor:t?y.colours.gold:l?y.colours.goldMuted:y.colours.hairline,borderStyle:l&&!t?'dashed':'solid',backgroundColor:t?y.colours.gold:e?y.colours.tilePressed:y.colours.tile}),children:[(0,x.jsx)(p.T,{size:18,weight:"semibold",colour:t?y.colours.onGold:y.colours.text,children:(0,s.tableNumbers)(e.name)}),(0,x.jsxs)(p.T,{size:14,colour:t?y.colours.onGold:y.colours.muted,children:[e.seats," seats",l?' \xb7 booked':'']})]},e.name)})})]},e.area)),W.length?null:(0,x.jsx)(p.Muted,{center:!0,children:"No tables on the plan yet. Add them in Setup \u203a Table plan."})]})};var t=r(d[0]),s=r(d[1]),l=r(d[2]),o=e(r(d[3])),n=e(r(d[4])),c=r(d[5]),b=r(d[6]),u=r(d[7]),h=r(d[8]),y=r(d[9]),g=r(d[10]),p=r(d[11]),k=r(d[12]),f=r(d[13]),x=r(d[14]);const j={minHeight:56};async function v(e,t,s){const l=(0,h.tableKey)(s),o=(0,b.tablesOf)(t.table);await c.repo.bookings.update(t.id,(0,u.tablePatch)(l||null)),'seated'===t.status&&t.date===(0,g.venueYmd)(new Date)&&(o.filter(e=>!(0,b.tablesOf)(l).includes(e)).forEach(t=>b.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!0})),l&&(0,k.resetTableLive)(e,l))}},1117,[1118,860,34,402,102,874,1025,1116,1119,821,858,794,1120,1022,25]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.TableNumberWarning=function({plan:u}){const c=(0,n.numberClashes)(u.tables),o=[...new Set([...c.acrossAreas,...u.tables.filter(n=>c.sameArea.has(n.name)).map(n.tableNumber)])];return o.length?(0,l.jsxs)(t.T,{testID:"duplicate-table-numbers",size:16,colour:s.colours.goldLight,children:["Duplicate table numbers: ",o.join(', '),". Kept unchanged. Ask a manager to check the areas before assigning."]}):null},r(d[0]);var n=r(d[1]),s=r(d[2]),t=r(d[3]),l=r(d[4])},1118,[34,859,821,794,25]); __d(function(_g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"byNum",{enumerable:!0,get:function(){return s}}),e.tableKey=o,e.toggleTable=function(t,n){return t.includes(n)?t.filter(t=>t!==n):a(o([...t,n]))},e.seatsOf=function(t,n){const a={};for(const s of n)a[s]=t.tables.find(t=>t.name===s)?.maxSeats??0;return{per:a,total:Object.values(a).reduce((t,n)=>t+n,0)}},e.seatLine=function(t,n){const a=Math.max(0,n-t);return{text:`${t} ${1===t?'seat':'seats'} for ${l(n)}${a?`: ${a} short`:''}`,short:a,fits:0===a&&t>0}},e.pickClashes=function(t,l,u,c=90){if(!l.length)return[];const f={...t,table:o(l)},b=[];for(const s of u)if(s.id!==t.id&&s.date===t.date&&!['cancelled','noshow','finished'].includes(s.status)&&(0,n.startOf)(f)<(0,n.endOf)(s,c)&&(0,n.startOf)(s)<(0,n.endOf)(f,c))for(const t of a(s.table))l.includes(t)&&b.push({table:t,with:s});return b.sort((t,n)=>s(t.table,n.table))},e.overCapacityAsk=function(n,s,l){const u=a(o(n));if(!u.length||s>=l)return null;const c=u.map(n=>(0,t.tableNumbers)(n));return`${1===c.length?`Table ${c[0]} seats`:`Tables ${c.slice(0,-1).join(', ')} and ${c[c.length-1]} seat`} ${s} \u2013 this booking is ${l}. Use it anyway?`},e.clashWords=function(n){return n.map(n=>`${(0,t.tableNumbers)(n.table)} has ${n.with.walkIn?'a walk-in':(n.with.name||'a booking').replace(' (example)','')} at ${n.with.time}`).join('. ')+(n.length?'.':'')},e.tablesWords=u,e.pickA11y=function(n,a,s,l){return`Table ${(0,t.tableNumbers)(n)}, ${a} ${1===a?'seat':'seats'}${s?', selected':''}${l?`, has ${l.walkIn?'a walk-in':l.name} at ${l.time}`:''}`},e.pickGroups=function(t){return t.areas.map(n=>({area:n.name,tables:t.tables.filter(t=>t.areaId===n.id).map(t=>({name:t.name,seats:t.maxSeats})).sort((t,n)=>s(t.name,n.name))})).filter(t=>t.tables.length)},e.savedWords=function(t,n,a,s){return a.length?`${t}, ${l(n)}: ${u(a)} (${s} seats).`:`${t}: table taken off.`},e.tableActions=function(t,n){const s=a(t.table);if(['cancelled','noshow'].includes(t.status))return[];const o=[s.length?{id:'assign',label:'Change table',a11y:`Change table for ${n}, ${l(t.partySize)}, now ${u(s).toLowerCase()}. You can pick several tables to join.`}:{id:'assign',label:'Assign table',a11y:`Assign table for ${n}, ${l(t.partySize)}. You can pick several tables to join.`}];s.length&&o.push({id:'clear',label:'Clear table',a11y:`Clear table for ${n}, take ${u(s).toLowerCase()} off this booking`});return o},e.dragTables=function(t,n,s){if(!s||'__none'===s||s===n)return null;const l=a(t);if(l.includes(s))return null;return o('__none'!==n&&l.includes(n)?l.map(t=>t===n?s:t):[s])};var t=r(d[0]),n=r(d[1]);const a=t=>t?t.split('+').map(t=>t.trim()).filter(Boolean):[],s=(t,n)=>t.localeCompare(n,'en-GB',{numeric:!0}),l=t=>`${t} ${1===t?'person':'people'}`;function o(t){return[...new Set(t.map(t=>String(t).trim()).filter(Boolean))].sort(s).join('+')}function u(n){const s=a(o(n));return s.length?(0,t.tableListNumbers)(s):'No table'}},1119,[860,1101]); __d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"TABLES",{enumerable:!0,get:function(){return O}}),_e.useTableNames=N,_e.resetTableLive=M,_e.seatBookingNow=L,_e.finishBookingNow=async function(e,t){await f.repo.bookings.setStatus(t.id,'finished'),(0,S.tablesOf)(t.table).forEach(t=>S.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!0}))},_e.useTableUse=F,Object.defineProperty(_e,"walkInLabel",{enumerable:!0,get:function(){return R}}),_e.TablePicker=W,_e.WalkInSheet=E,_e.WalkInMatchPrompt=H,_e.AssignTableSheet=_,_e.undoNotice=Y,_e.NewBookingSheet=U,_e.useFrontDoor=function(e,t){const[s,o]=(0,r.useState)(!1),[l,a]=(0,r.useState)(!1),[i,d]=(0,r.useState)(null);return{openWalkIn:()=>o({}),openWalkInAt:e=>o({table:e}),openBooking:()=>a(!0),assignTable:e=>d({b:e}),combineTables:e=>d({b:e,combine:!0}),elements:(0,B.jsxs)(B.Fragment,{children:[s?(0,B.jsx)(E,{wide:t,initialTable:s.table,onClose:()=>o(!1),onSeated:Y}):null,l?(0,B.jsx)(U,{wide:t,date:e,onClose:()=>a(!1),onSaved:e=>(0,n.notify)({id:`booked:${Date.now()}`,testID:'booking-saved-toast',timeoutMs:5e3,icon:'\u2713',title:`Booked: ${e.name} \xb7 ${(0,x.niceDate)((0,x.parseYmd)(e.date))} at ${e.time}`})}):null,i?(0,B.jsx)(_,{booking:i.b,combine:i.combine,onClose:()=>d(null)}):null]})}};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),a=_r(_d[4]),i=_r(_d[5]),n=_r(_d[6]),r=_r(_d[7]),d=e(r),u=_r(_d[8]),c=e(_r(_d[9])),b=e(_r(_d[10])),h=_r(_d[11]),p=_r(_d[12]),f=_r(_d[13]),y=_r(_d[14]),k=_r(_d[15]),x=_r(_d[16]),j=_r(_d[17]),w=_r(_d[18]),T=_r(_d[19]),S=_r(_d[20]),v=_r(_d[21]),C=_r(_d[22]),D=_r(_d[23]),I=_r(_d[24]),$=_r(_d[25]),P=_r(_d[26]),z=_r(_d[27]),B=_r(_d[28]);const O=Array.from({length:12},(e,t)=>String(t+1));function N(e){const t=(0,S.usePlan)(e);return t.areas.flatMap(e=>t.tables.filter(t=>t.areaId===e.id).map(e=>e.name))}function M(e,t){(0,S.tablesOf)(t).forEach(t=>S.useFloor.getState().setLive(e,t,{stage:'seated',dirty:!1}))}async function L(e,t){await f.repo.bookings.setStatus(t.id,'seated'),M(e,t.table)}function F(e,t){const s=(0,f.useBookings)(e),o=(0,f.useOrders)(e),l=N(e),a=(0,S.useFloor)(t=>t.live[e])??{},i=(0,S.usePlan)(e),n=(0,v.useBlocks)(e=>e.blocks),r=(0,x.ymd)(t),d=(0,v.closedAreasAt)(n,e,r,(0,x.hm)(t)),u={};for(const e of l)u[e]=a[e]?.blocked||d.has(`tbl:${e}`)?{busy:!0,label:'Blocked'}:d.has(i.tables.find(t=>t.name===e)?.areaId??'')?{busy:!0,label:'Closed'}:a[e]?.dirty?{busy:!0,label:'Needs clearing'}:{busy:!1,label:'Free'};for(const e of s)if(e.date===r&&e.table)for(const s of(0,S.tablesOf)(e.table))if(u[s])if('seated'===e.status)u[s]={busy:!0,label:`${e.walkIn?'Walk-in':`${e.name.slice(0,1)}.`} \xb7 ${e.partySize}`};else if('confirmed'===e.status&&!u[s].busy){const o=(0,x.minsBetween)(t,new Date(`${e.date}T${e.time}:00`));o>=-15&&o<=90&&(u[s]={...u[s],soon:`Booked ${e.time}`})}for(const e of o)'table'===e.type&&e.tableNo&&u[e.tableNo]&&!['closed','cancelled','collected'].includes(e.status)&&!u[e.tableNo].busy&&(u[e.tableNo]={busy:!0,label:'Open order'});return u}const R=e=>e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;function W({use:e,value:t,onPick:s,big:o,best:a,dense:i,bestSet:n,picked:d}){const u=Object.keys(e),[h,p]=(0,r.useState)(0),f=i?6:8,y=i?64:o?92:76,k=h?Math.max(3,Math.floor((h+f)/(y+f))):0,x=k?Math.floor((h-f*(k-1))/k):y,w=new Set(n??[]),v=a?(0,S.tablesOf)(a)[0]:null;return(0,B.jsx)(b.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:f},testID:"table-picker",onLayout:e=>p(Math.floor(e.nativeEvent.layout.width)),children:u.map(o=>{const a=e[o],n=t===o||!!d?.includes(o),r=w.has(o),u=v===o&&!n,h=a.busy?['Blocked','Needs clearing','Closed'].includes(a.label)?a.label:'In use':a.soon??'Free';return(0,B.jsxs)(c.default,{accessibilityRole:"button",testID:`pick-table-${o}`,accessibilityLabel:`Table ${(0,l.tableNumbers)(o)}${d?n?', picked':', not picked':''}, ${a.busy?`in use (${a.label})`:a.soon?`free, ${a.soon}`:'free'}${r?', best table':''}${u?', suggested for this party':''}`,accessibilityState:{selected:n,disabled:'Closed'===a.label},disabled:'Closed'===a.label,onPress:()=>s(o),style:{width:x,minHeight:i?58:64,borderRadius:12,borderWidth:n||u?2.5:1.5,paddingVertical:i?3:6,paddingHorizontal:4,alignItems:'center',justifyContent:'center',gap:2,borderColor:n||u?j.colours.gold:a.busy?j.colours.red:j.colours.ok,backgroundColor:n?j.colours.goldTint:a.busy?j.colours.redBg:j.colours.surface2,opacity:'Closed'!==a.label||n?1:.55},children:[(0,B.jsxs)(b.default,{style:{flexDirection:'row',alignItems:'center',gap:4},children:[(0,B.jsx)(T.T,{weight:"bold",size:22,colour:n?j.colours.goldLight:j.colours.text,children:(0,l.tableNumbers)(o)}),r?(0,B.jsx)(b.default,{testID:"best-table",style:{backgroundColor:j.colours.gold,borderRadius:5,paddingHorizontal:4,paddingVertical:1},children:(0,B.jsx)(T.T,{size:11,weight:"bold",colour:j.colours.onGold,children:"BEST"})}):null]}),(0,B.jsx)(T.T,{size:i?13:14,colour:a.busy?'#FFD9D4':a.soon?'#FFE2A8':'#E2C489',center:!0,numberOfLines:1,children:h})]},o)})})}const A=[1,2,3,4,5,6,7,8];function E({onClose:e,onSeated:a,wide:i,initialTable:y}){const{rid:w,r:C,now:D}=(0,p.useCtx)(15e3),I=F(w,D),[$,P]=(0,r.useState)(2),[O,N]=(0,r.useState)(!1),[R,E]=(0,r.useState)(y??null),_=(0,S.usePlan)(w),Y=(0,f.useBookings)(w),U=(0,v.useBlocks)(e=>e.blocks),q=(0,v.closedAreasAt)(U,w,(0,x.ymd)(D),(0,x.hm)(D)),Q=d.default.useMemo(()=>{const e=Object.fromEntries(Object.entries(I).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,k.suggestTable)(_,Y.filter(e=>e.date===(0,x.ymd)(D)),e,$,D,(0,k.turnFor)($,C.settings.turnMins),90,void 0,{closed:q})?.table??null},[_,Y,I,$,q.size,D.getTime()]);(0,r.useEffect)(()=>{R&&(0,S.tablesOf)(R).some(e=>'Closed'===I[e]?.label)&&E(null)},[R,q.size]);const[V,G]=(0,r.useState)(!1),[K,X]=(0,r.useState)(''),J=(e,t=String(e),s=()=>{N(!1),P(e)})=>{const o='9+'===t?O:!O&&$===e;return(0,B.jsx)(c.default,{accessibilityRole:"button",accessibilityLabel:'9+'===t?'Party of 9 or more':`Party of ${e}`,accessibilityState:{selected:o},onPress:s,style:{width:i?58:60,height:i?58:56,borderRadius:14,borderWidth:2,borderColor:j.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:o?j.colours.gold:'transparent'},children:(0,B.jsx)(T.T,{weight:"bold",size:22,colour:o?j.colours.onGold:j.colours.gold,children:t})},t)},Z=(0,B.jsx)(s.PartySizeInput,{value:$,onChange:P,min:9,max:o.MAX_PARTY,label:"Walk-in party size",testID:"walkin-party-size"}),ee=(0,B.jsxs)(b.default,{style:{gap:8,width:i?256:void 0},children:[(0,B.jsx)(T.T,{weight:"semibold",children:"How many people?"}),(0,B.jsxs)(b.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},testID:"walkin-party",children:[A.map(e=>J(e)),J(9,'9+',()=>{N(!0),P(e=>e>=9?e:9)})]}),O?Z:null]}),[te,se]=(0,r.useState)(!1),[oe,le]=(0,r.useState)(null),ae=async(t=R,s=!1)=>{if(!te){if(!s){const e=(0,z.bookingsNearWalkIn)(Y,D,$);if(e.length)return void le({at:t,list:e})}se(!0);try{const s=await f.repo.bookings.seatWalkIn(w,$,t??void 0,K);M(w,t??void 0),a(s),e()}finally{se(!1)}}},ie=async(t,s)=>{if(!te){se(!0);try{const o=s??t.table??null;o&&o!==t.table&&await f.repo.bookings.assignTable(t.id,o),await L(w,{...t,table:o??void 0}),(0,n.notify)({id:`seated:${t.id}`,testID:'walkin-match-toast',timeoutMs:5e3,icon:'\u2713',title:`${t.name} seated \xb7 ${t.partySize} \xb7 ${o?(0,l.tableNumbers)(o):'table to assign'} (booking ${t.ref})`}),le(null),e()}finally{se(!1)}}},ne=(0,B.jsxs)(b.default,{style:{gap:8,flex:i?1:void 0,minWidth:0},children:[(0,B.jsxs)(T.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsxs)(T.T,{weight:"semibold",children:["Table ",(0,B.jsx)(T.T,{colour:j.colours.muted,size:14,children:"(optional)"})]}),R?(0,B.jsx)(T.Button,{small:!0,kind:"ghost",label:"Clear table",onPress:()=>E(null)}):null]}),(0,B.jsx)(W,{use:I,value:R,onPick:e=>{I[e]&&!I[e].busy?ae(e):E(R===e?null:e)},big:i,dense:i,best:Q,bestSet:(0,u.bestTables)(_)}),(0,B.jsxs)(T.Muted,{children:["Tap a free table to seat them there",Q&&!R?` (suggested for ${$}: ${(0,l.tableNumbers)(Q)})`:'',", or Seat for no table yet. BEST marks the venue\u2019s best tables."]})]});return(0,B.jsxs)(T.Sheet,{visible:!0,onClose:e,title:`Walk-in \xb7 ${(0,x.hm)(D)}`,maxWidth:i?1100:void 0,testID:"walkin-sheet",children:[(0,B.jsx)(T.Button,{label:`Seat walk-in \xb7 ${$} ${1===$?'person':'people'}${R?` \xb7 ${(0,l.tableNumbers)(R)}`:''}`,disabled:te,onPress:()=>{ae()},testID:"seat-walkin",style:{minHeight:52}}),i?(0,B.jsxs)(T.Row,{gap:16,style:{alignItems:'flex-start'},children:[ee,ne]}):(0,B.jsxs)(B.Fragment,{children:[ee,ne]}),(0,B.jsxs)(T.Row,{gap:10,wrap:!0,style:{alignItems:'center'},children:[V?(0,B.jsx)(t.TextInput,{accessibilityLabel:"Walk-in note",placeholder:"Note (optional), e.g. high chair",placeholderTextColor:"#7D776C",value:K,onChangeText:X,style:[T.styles.input,{flex:1,minWidth:220}],autoFocus:!0}):(0,B.jsx)(T.Button,{small:!0,kind:"ghost",label:"Add a note (optional)",onPress:()=>G(!0)}),(0,B.jsx)(b.default,{style:{flex:1,minWidth:220},children:(0,B.jsxs)(T.Muted,{children:["No name needed. Counts in today's covers.",'staff'!==h.APP_VARIANT?' Using website bookings too? Mark the table there as well.':'']})})]}),oe?(0,B.jsx)(H,{list:oe.list,busy:te,onYes:e=>{ie(e,oe.at)},onNo:()=>{const e=oe.at;le(null),ae(e,!0)},onClose:()=>le(null)}):null]})}function H({list:e,busy:t,onYes:s,onNo:o,onClose:a}){return(0,B.jsx)(T.Sheet,{visible:!0,onClose:a,title:"Booked party?",maxWidth:720,testID:"walkin-match",children:(0,B.jsxs)(b.default,{style:{gap:14},children:[e.map((e,o)=>(0,B.jsxs)(b.default,{testID:`walkin-match-${o}`,style:{gap:12,padding:16,borderRadius:16,borderWidth:2,borderColor:j.colours.gold,backgroundColor:'#15130F'},children:[(0,B.jsx)(b.default,{accessibilityRole:"header",accessibilityLiveRegion:"polite",children:(0,B.jsx)(T.T,{size:26,weight:"bold",colour:j.colours.goldLight,testID:"walkin-match-question",children:(0,z.walkInMatchQuestion)(e)})}),e.table?(0,B.jsxs)(T.T,{size:17,colour:j.colours.text,children:["Booked table ",(0,l.tableNumbers)(e.table)," \xb7 ",e.ref]}):(0,B.jsx)(T.T,{size:17,colour:j.colours.text,children:e.ref}),(0,B.jsx)(T.Button,{label:"Yes, seat booking",testID:"walkin-match-yes",disabled:t,accessibilityLabel:`Yes, seat ${e.name}'s booking, ${e.partySize} people`,onPress:()=>s(e),style:{minHeight:64}})]},e.id)),(0,B.jsx)(T.Button,{kind:"secondary",label:"No, new walk-in",testID:"walkin-match-no",disabled:t,onPress:o,style:{minHeight:64}})]})})}function _({booking:e,onClose:t,combine:s}){const{rid:o,r:a,now:i}=(0,p.useCtx)(15e3),n=F(o,i),c=(0,S.usePlan)(o),h=(0,f.useBookings)(o),y=(0,S.tablesOf)(e.table),w=d.default.useMemo(()=>Object.fromEntries(Object.entries(n).map(([e,t])=>[e,y.includes(e)?{busy:!1,label:'This party',soon:'This party'}:t])),[n,e.table]),v=d.default.useMemo(()=>{const t=Object.fromEntries(Object.entries(w).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,k.suggestTable)(c,h.filter(e=>e.date===(0,x.ymd)(i)),t,e.partySize,i,(0,k.turnFor)(e.partySize,a.settings.turnMins),90,e.id)?.table??null},[c,h,w,e.partySize,i.getTime()]),[C,D]=(0,r.useState)(!!s||y.length>1),[I,$]=(0,r.useState)(y),P=e=>c.tables.find(t=>t.name===e)?.maxSeats??0,z=I.reduce((e,t)=>e+P(t),0),O=I.length>0&&z{const l=(0,S.joinTables)(s);await f.repo.bookings.assignTable(e.id,l);y.filter(e=>!s.includes(e)).forEach(t=>S.useFloor.getState().setLive(o,t,{stage:void 0,dirty:'seated'===e.status})),'seated'===e.status&&M(o,l),t()},L=C?(0,B.jsxs)(b.default,{style:{gap:8},testID:"assign-table-tip",children:[(0,B.jsx)(b.default,{accessibilityLiveRegion:"polite",children:(0,B.jsx)(T.T,{size:17,weight:"semibold",colour:j.colours.text,children:I.length?`${(0,S.tablesLabel)((0,S.joinTables)(I))} \xb7 ${z} seats for ${e.partySize} Covers`:'No tables picked yet'})}),O?(0,B.jsx)(b.default,{testID:"combine-short",children:(0,B.jsxs)(T.T,{size:15,weight:"semibold",colour:"#FFD9D4",children:["Not enough seats yet: ",e.partySize-z," more needed. Add another table."]})}):null,(0,B.jsx)(T.T,{size:15,colour:j.colours.text,children:"Tap each table to add or remove it, then tap Done. All of them show as taken until the party has finished."}),(0,B.jsxs)(T.Row,{gap:8,wrap:!0,children:[(0,B.jsx)(T.Button,{label:"Done",testID:"combine-done",disabled:!I.length,accessibilityLabel:I.length?`Done, save ${(0,S.tableCardLabel)((0,S.joinTables)(I))}`:'Done',onPress:()=>N(I)}),(0,B.jsx)(T.Button,{kind:"ghost",label:"Cancel",onPress:t})]})]}):(0,B.jsx)(b.default,{style:{gap:8},testID:"assign-table-tip",children:(0,B.jsx)(T.T,{size:15,colour:j.colours.text,children:"Red tables are in use right now; you can still pick one (e.g. joining a table). BEST marks the venue\u2019s best tables. Big party? Tap Combine tables."})});return(0,B.jsxs)(T.Sheet,{visible:!0,onClose:t,title:`${C?'Combine tables':'Assign table'} \xb7 ${R(e)}`,testID:"assign-table-sheet",footer:L,children:[v&&!C?(0,B.jsx)(b.default,{testID:"assign-suggested",children:(0,B.jsxs)(T.T,{size:16,weight:"semibold",colour:j.colours.goldLight,accessibilityLabel:`Suggested for ${e.partySize}: ${(0,S.tableCardLabel)(v)}`,children:["Suggested for ",e.partySize,": ",(0,l.tableNumbers)(v)]})}):null,C?null:(0,B.jsx)(T.Button,{kind:"secondary",label:"Combine tables",testID:"combine-start",accessibilityLabel:"Combine tables: pick several tables for this party",onPress:()=>D(!0)}),(0,B.jsx)(W,{use:w,best:C?null:v,bestSet:(0,u.bestTables)(c),picked:C?I:void 0,onPick:C?e=>$(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]):async e=>{await N([e])}})]})}function Y(e){(0,n.notify)({id:`walkin:${e.id}`,testID:'walkin-toast',timeoutMs:6e3,title:`${R(e)} seated \xb7 ${e.table?`${(0,l.tableNumbers)(e.table)}`:'table to assign'} (${e.ref})`,actions:[{label:'Undo',testID:'undo-walkin',onPress:()=>f.repo.bookings.undoWalkIn(e.id)},{label:'OK',kind:'ghost'}]})}function U({date:e,onClose:t,wide:n,onSaved:d}){const{rid:u,r:c,now:h,role:z,meId:O}=(0,p.useCtx)(6e4),N=(0,x.ymd)(h),[M,L]=(0,r.useState)(ee.blocks),[W,A]=(0,r.useState)(!1),[E,H]=(0,r.useState)(''),[_,Y]=(0,r.useState)(2),[U,q]=(0,r.useState)(null),[Q,V]=(0,r.useState)(''),[G,K]=(0,r.useState)(''),[X,J]=(0,r.useState)(''),[Z,ee]=(0,r.useState)('phone'),[te,se]=(0,r.useState)((0,D.emptyNeeds)()),oe=(0,D.needsMissing)(te),[le,ae]=(0,r.useState)(null),ie=(0,S.usePlan)(u),ne=(0,P.dogSetUp)(ie),re=!0===te.dog&&ne,de=te.dog?te.dogs:0,ue=(0,x.parseYmd)(M),ce=(0,k.turnFor)(_,c.settings.turnMins),be=F.filter(e=>e.date===M),he=e=>(0,k.freeTablesAt)(ie,be,_,new Date(`${M}${(0,l.tableNumbers)(e)}:00`),ce,c.settings.turnMins,{dog:!0,closed:(0,v.closedAreasAt)(R,u,M,e)}),ge=re&&U?he(U):[];(0,r.useEffect)(()=>{ae(null)},[re,U,_]);const pe=(0,y.bookingSlots)(c,ue,e=>F.filter(t=>t.date===M&&t.time===e&&'cancelled'!==t.status&&!t.walkIn).reduce((e,t)=>e+t.partySize,0),_,M===(0,x.ymd)(h)?h:(0,x.addMins)(ue,0),e=>F.filter(t=>t.date===M&&t.time===e&&'cancelled'!==t.status&&!t.walkIn).length),me=(0,w.ukPhone)(G),[fe,ye]=(0,r.useState)(!1),ke=U?pe.find(e=>e.time===U):void 0,xe=ke&&ke.left<_?{left:Math.max(0,ke.left),time:ke.time}:null,je=ke&&null!=ke.partiesLeft&&ke.partiesLeft<1?{time:ke.time,cap:ke.partiesCap??0}:null,we=xe||je,Te=U?(0,v.blockAt)(R,u,M,U):void 0,Se='staff'!==z,ve=!!U&&!(0,D.dogTimeOk)(c,F,M,U,de),Ce=!oe.length&&E.trim().length>=2&&!!U&&(!we||fe)&&(0,o.validParty)(_)&&me.ok&&(0,w.emailOk)(X)&&(!Te||Se&&W)&&(!re||ge.length>0)&&!ve,De=te.wheelchair>0||te.stepFree;return(0,B.jsxs)(T.Sheet,{visible:!0,onClose:t,title:`New booking \xb7 ${(0,x.niceDate)(ue)}`,maxWidth:n?760:void 0,testID:"booking-sheet",children:[(0,B.jsx)(D.FirstQuestions,{rid:u,value:te,onChange:se,party:_,audience:"staff"}),te.dog&&!ne?(0,B.jsx)(T.T,{size:13,colour:j.colours.amber,children:"Dog-friendly tables aren\u2019t marked yet. Managers \u203a Booking options \u203a Tables. Booking is allowed; check where the dog can sit."}):null,(0,B.jsx)(C.BookingDatePicker,{r:c,today:h,value:M,onChange:e=>{e!==M&&(L(e),q(null),A(!1))}}),(0,B.jsxs)(T.Row,{gap:6,children:[(0,B.jsx)(T.Chip,{label:"Phone",selected:'phone'===Z,onPress:()=>ee('phone')}),(0,B.jsx)(T.Chip,{label:"In person",selected:'in-person'===Z,onPress:()=>ee('in-person')})]}),(0,B.jsx)(T.Field,{label:"Name",value:E,onChangeText:H,placeholder:"e.g. Reid",testID:"nb-name"}),(0,B.jsx)(T.Field,{label:"Mobile or phone number (needed)",value:G,onChangeText:K,keyboardType:"phone-pad",placeholder:"e.g. 07700 900123",testID:"nb-phone"}),!me.ok&&G?(0,B.jsx)(T.T,{size:13,colour:j.colours.amber,children:me.error}):null,(0,B.jsx)(T.Field,{label:"Email (optional)",value:X,onChangeText:J,keyboardType:"email-address",autoCapitalize:"none",placeholder:"For an email confirmation too",testID:"nb-email"}),(0,w.emailOk)(X)?null:(0,B.jsx)(T.T,{size:13,colour:j.colours.amber,children:"That email doesn\u2019t look quite right."}),(0,B.jsxs)(b.default,{style:{gap:6,alignItems:'center'},children:[(0,B.jsx)(T.T,{center:!0,children:"Covers"}),(0,B.jsx)(s.PartySizeInput,{value:_,onChange:e=>{Y(e),ye(!1)},label:"Covers",testID:"nb-party"})]}),(0,B.jsx)(T.Row,{wrap:!0,gap:6,children:pe.map(e=>{const t=re&&e.available&&!he(e.time).length||!(0,D.dogTimeOk)(c,F,M,e.time,de);return(0,B.jsx)(T.Chip,{testID:`nb-slot-${e.time}`,label:e.time,sub:(0,v.blockAt)(R,u,M,e.time)?'Paused':t?'Dogs full':e.drinksOnly?'Drinks only':null!=e.partiesLeft&&e.partiesLeft<1||e.left<=0?'Full':`${e.left} left`,disabled:(e.past??!e.available)||t,selected:U===e.time,onPress:()=>{q(e.time),A(!1),ye(!1)}},e.time)})}),we?(0,B.jsxs)(b.default,{testID:"nb-over-capacity",accessible:!0,accessibilityLiveRegion:"polite",style:{borderWidth:1.5,borderColor:j.colours.amber,backgroundColor:j.colours.amberBg,borderRadius:12,padding:10,gap:6},children:[xe?(0,B.jsx)(T.T,{weight:"semibold",colour:j.colours.amber,children:(0,o.overCapacityNote)(_,xe.left,xe.time)}):null,je?(0,B.jsx)(T.T,{weight:"semibold",colour:j.colours.amber,children:(0,o.overPartiesNote)(je.time,je.cap)}):null,(0,B.jsx)(T.Chip,{label:fe?'Booking over the limit: on':'Book anyway (over the limit)',selected:fe,onPress:()=>ye(e=>!e),testID:"nb-over-ok"})]}):null,re&&U?(0,B.jsxs)(b.default,{style:{gap:6},testID:"nb-dog-tables",children:[(0,B.jsxs)(T.T,{size:14,weight:"semibold",children:["Dog-friendly table ",(0,B.jsxs)(T.T,{size:13,colour:j.colours.muted,children:["(",ie.areas.filter(e=>e.dogs).map(e=>e.name).join(' or '),")"]})]}),ge.length?(0,B.jsx)(T.Row,{wrap:!0,gap:6,children:ge.slice(0,10).map((e,t)=>(0,B.jsx)(T.Chip,{label:`${(0,l.tableNumbers)(e.table)}`,sub:`${e.area} \xb7 ${e.seats}${0===t?' \xb7 best':''}${De&&(0,P.accessibleSetUp)(ie)&&!(0,P.isAccessible)(ie,e.table)?' \xb7 not step-free':''}`,selected:(le??ge[0].table)===e.table,onPress:()=>ae(e.table)},e.table))}):(0,B.jsxs)(T.T,{size:14,colour:j.colours.amber,children:["No dog-friendly table free for ",_," at ",U,". Try another time."]})]}):null,Te?(0,B.jsxs)(b.default,{testID:"nb-block-warning",style:{borderWidth:1.5,borderColor:j.colours.amber,backgroundColor:j.colours.amberBg,borderRadius:12,padding:10,gap:6},children:[(0,B.jsxs)(T.T,{weight:"semibold",colour:j.colours.amber,children:["Bookings are paused ",Te.from,"\u2013",Te.to,Te.reason?` (${Te.reason})`:'']}),Se?(0,B.jsx)(T.Chip,{label:W?'Manager override on':'Override and book anyway',selected:W,onPress:()=>A(e=>!e)}):(0,B.jsx)(T.Muted,{children:"Ask a manager to override, or pick another time."})]}):null,pe.length?null:(0,B.jsx)(b.default,{testID:"nb-closed",children:(0,B.jsxs)(T.T,{size:14,weight:"semibold",colour:j.colours.amber,children:["Closed on ",(0,x.niceDate)(ue)," (per the venue\u2019s opening hours). Pick another date."]})}),(0,B.jsx)(D.MoreQuestions,{rid:u,r:c,value:te,onChange:se,party:_,date:M,time:U,today:(0,x.ymd)(h),bookings:F,audience:"staff",showTables:!1!==c.settings.tableRequests}),De&&!(0,P.accessibleSetUp)(ie)?(0,B.jsx)(T.T,{size:13,colour:j.colours.amber,children:"Step-free tables aren\u2019t marked yet (Managers \u203a Booking options \u203a Tables). Check the table works for a wheelchair."}):null,(0,B.jsx)(T.Field,{label:"Notes (optional)",value:Q,onChangeText:V,placeholder:I.NOTES_PLACEHOLDER,multiline:!0,numberOfLines:3,testID:"nb-notes"}),(0,i.depositDue)((0,i.depositOf)(c.settings),_)?(0,B.jsxs)(T.Muted,{children:["Deposit due: ",(0,a.gbp)((0,i.depositDue)((0,i.depositOf)(c.settings),_))," (",(0,a.gbp)((0,i.depositOf)(c.settings).perPersonPence)," per person for ",(0,i.depositOf)(c.settings).fromParty,"+). Deposits are paid through website bookings or to you, never in CoverCharge: tick Deposit paid on the booking once the guest has paid."]}):null,(0,B.jsxs)(T.Muted,{children:["The guest gets a confirmation text",X.trim()?' and email':''," automatically (preview mode: shown in the Outbox, not sent)."]}),ve?(0,B.jsxs)(T.T,{size:14,colour:j.colours.amber,children:["We already have the most dogs we can look after at ",U,". Try another time: dogs are very welcome then."]}):null,(0,B.jsx)(T.Button,{label:oe.length?oe[0]:'Save booking',testID:"nb-save",disabled:!Ce,onPress:()=>{if(M<(0,x.ymd)(h))return;const e=(0,D.needsPatch)(te),s=te.tableReq.find(e=>!re||ge.some(t=>t.table===e));f.repo.bookings.create({restaurantId:u,customerId:null,name:E.trim(),partySize:_,date:M,time:U,notes:Q.trim(),security:(0,i.depositDue)((0,i.depositOf)(c.settings),_)?'deposit':'none',depositPaid:0,...(0,i.depositDue)((0,i.depositOf)(c.settings),_)?{depositDue:(0,i.depositDue)((0,i.depositOf)(c.settings),_),depositPolicy:(0,i.depositWords)((0,i.depositOf)(c.settings),_,c.name).join(' '),depositRefundable:(0,i.depositOf)(c.settings).refundable,depositCutoffHours:(0,i.depositOf)(c.settings).cutoffHours}:{},phone:me.pretty,email:X.trim()||void 0,source:Z,...e,...pe.find(e=>e.time===U)?.drinksOnly?{drinksOnly:!0}:{},allergies:e.allergies??[],...re?{table:le??s??ge[0]?.table}:{}}).then(e=>(0,$.postNewBookingToKitchen)(e,O)).catch(()=>{}),d?.({date:M,time:U,name:E.trim()}),t()}})]})}},1120,[827,1121,1122,860,867,14,1123,34,859,402,102,872,1084,874,1124,1101,858,821,864,794,1025,1022,1125,1126,1131,1103,1097,1132,25]); @@ -1245,7 +1245,7 @@ __d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule' __d(function(g,_r,i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.gamesOn=function(){const e=b.useStore.getState().restaurants.find(e=>e.id===p.VENUE_RID);return!1!==e?.settings?.games},_e.useGameClock=I,_e.usePlayable=function(e,t){return(0,y.gamePlayable)(I(e,t))},Object.defineProperty(_e,"LENNY_GAME_URL",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"validGameUrl",{enumerable:!0,get:function(){return C}}),_e.gameBase=function(){const e=b.useStore.getState().restaurants.find(e=>e.id===p.VENUE_RID);return C(e?.settings?.gameUrl)??v},_e.BreakRoomCard=function({staffId:e,name:t,now:s}){const n=(0,b.useStore)(e=>!1!==e.restaurants.find(e=>e.id===p.VENUE_RID)?.settings?.games),[o,l]=(0,r.useState)(!1),c=I(e,s),u=(0,y.gamePlayable)(c);return n?(0,w.jsxs)(d.Card,{children:[(0,w.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(d.T,{weight:"semibold",children:"\ud83e\uded6 Break room"}),(0,w.jsx)(d.T,{size:13,colour:u?x.colours.ok:x.colours.muted,children:u?'Open':'Locked'})]}),(0,w.jsx)(d.Muted,{children:"Lenny\u2019s Kitchen Chaos, with the team as characters and a shared leaderboard. Playable on a break or when you\u2019re not clocked in."}),u?null:(0,w.jsx)(d.Muted,{testID:"break-room-locked-text",children:y.GAME_LOCKED_TEXT}),(0,w.jsx)(d.Button,{testID:"break-room-open",kind:"secondary",label:"Open the Break room",onPress:()=>l(!0)}),o?(0,w.jsx)(R,{staffId:e,name:t,playable:u,clock:c,onClose:()=>l(!1)}):null]}):null},Object.defineProperty(_e,"displayName",{enumerable:!0,get:function(){return T}}),_e.BreakRoom=R;var t=_r(_d[0]),s=_r(_d[1]),r=_r(_d[2]),n=e(r),o=e(_r(_d[3]));_r(_d[4]);var l=e(_r(_d[5])),c=e(_r(_d[6])),u=_r(_d[7]),d=_r(_d[8]),f=_r(_d[9]),m=_r(_d[10]),y=_r(_d[11]),h=_r(_d[12]),b=_r(_d[13]),p=_r(_d[14]),k=_r(_d[15]),j=_r(_d[16]),x=_r(_d[17]),w=_r(_d[18]);function I(e,t){const s=(0,m.useOwner)(e=>e.attendance);return(0,y.gameClock)(s,e,t)}const v='https://lennys-kitchen-chaos-13e285.deed.page/',C=e=>{try{const t=new URL(String(e??'').trim());return'https:'!==t.protocol||t.username||t.password?null:t.toString()}catch{return null}};function S(e){if('undefined'==typeof window)return null;const t=new URL(e);for(const e of['demo','unlock','name','staffId'])t.searchParams.delete(e);return t.searchParams.set('host','covercharge'),t.searchParams.set('hostOrigin',window.location.origin),{src:t.toString(),origin:t.origin}}const T=e=>String(e??'').replace(/\s*\(.*\)$/,'').replace(/\s+/g,' ').trim().slice(0,24).trim();function R({staffId:e,name:I,playable:R,clock:P,onClose:L,car:M}){const D=(0,m.useOwner)(e=>e.staff),O=(0,f.useAvatars)(e=>e.photos),_=(0,h.useSetup)(e=>e.looks),z=(0,r.useRef)(null),[N,U]=(0,r.useState)({}),[A,B]=(0,r.useState)(!1),[G,q]=(0,r.useState)(null),H=(0,b.useStore)(e=>C(e.restaurants.find(e=>e.id===p.VENUE_RID)?.settings?.gameUrl)??v),V=(0,r.useMemo)(()=>S(H),[H]),W=V?.origin??'',$=(0,j.useSync)(e=>'staff'===e.kind?e.staffRef??null:null),K=!(!$||!e||$===e),X=K?null:$??e??null,Y=T(I),[F,J]=(0,r.useState)(''),[Q,Z]=(0,r.useState)(null),ee=(0,r.useRef)(null),te=(0,r.useRef)(0),se=(0,r.useRef)(null),re=(0,r.useRef)(R);re.current=R;const ne=(0,r.useMemo)(()=>D.filter(e=>e.active&&!e.name.includes('(example)')),[D]);(0,r.useEffect)(()=>{const e=setTimeout(()=>{const e={};for(const s of ne){const r=null!=_[s.id]&&_[s.id]>=1e3?t.AVATAR_OPTIONS.find(e=>e.look===_[s.id]):void 0;if(r){e[s.id]=r.dataUrl;continue}const n=document.getElementById(`cc-av-${s.id}`)?.querySelector('svg');n&&(e[s.id]=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(n.outerHTML.includes('xmlns')?n.outerHTML:n.outerHTML.replace('clearTimeout(e)},[ne,_]);const oe=(0,r.useMemo)(()=>ne.map(e=>{const t=O[e.id]?.dataUrl??N[e.id],s={id:e.id,name:T(e.name),role:e.job||e.level||e.role};return t&&(s.avatarUrl=t),s}),[ne,O,N]),le=(0,r.useCallback)(e=>{try{W&&z.current?.contentWindow?.postMessage(e,W)}catch{}},[W]);return(0,r.useEffect)(()=>{const e=async e=>{if(!W||e.origin!==W||e.source!==z.current?.contentWindow)return;const t=e.data;if('string'!=typeof t?.type||!t.type.startsWith('lenny:'))return;if('lenny:ready'===t.type)return q('string'==typeof t.version?String(t.version).slice(0,12):null),void B(!0);const s=String(t.levelId??'').slice(0,40);if('lenny:scores:list'===t.type&&le({type:'lenny:scores:result',reqId:t.reqId,result:await(0,k.listScores)(s,Math.min(50,Number(t.limit)||10))}),'lenny:scores:submit'===t.type){const e=t.entry??{};if(!X||'string'==typeof e.staffId&&e.staffId!==X)return void le({type:'lenny:scores:result',reqId:t.reqId,result:{rank:null,entries:await(0,k.listScores)(s,10),id:null}});const r='string'==typeof e.characterId?e.characterId.slice(0,80):void 0;le({type:'lenny:scores:result',reqId:t.reqId,result:await(0,k.submitScore)(s,{score:Number(e.score)||0,stars:Number(e.stars)||0,badges:Array.isArray(e.badges)?e.badges.map(String).slice(0,30):[],stats:'object'==typeof e.stats&&e.stats?e.stats:{},characterId:r,character:'string'==typeof e.character?e.character.slice(0,60):void 0,staffId:X,name:Y})})}'lenny:roundAbandoned'===t.type&&J('The last round was stopped because the player changed. No score was saved.'),'lenny:roundStart'===t.type&&J(''),'lenny:progress'===t.type&&X&&t.staffId===X&&(0,k.saveProgress)(X,t.progress),'lenny:gameComplete'===t.type&&X&&t.staffId===X&&J(!0===t.firstTime?'Game complete! Character select is now unlocked.':'Game complete again. Nice work!')};return window.addEventListener('message',e),()=>window.removeEventListener('message',e)},[le,X,Y,W]),(0,r.useEffect)(()=>{B(!1),ee.current=null,se.current=null},[V?.src]),(0,r.useEffect)(()=>{if(!A)return;const e=e=>{se.current!==e&&(se.current=e,le({type:'lenny:setPlayable',playable:e}))},t=K?null:`${X??''}|${Y}`;if(t&&ee.current===t)return void e(R);const s=++te.current;ee.current=null,se.current&&e(!1),t&&(0,k.loadProgress)(X).catch(()=>null).then(r=>{s===te.current&&(le({type:'lenny:setPlayer',name:Y,staffId:X,...r?{progress:r}:{}}),ee.current=t,e(re.current))})},[A,K,X,Y,R,le]),(0,r.useEffect)(()=>{A&&le({type:'lenny:setRoster',staff:oe})},[A,oe,le]),(0,r.useEffect)(()=>{A&&null!==Q&&le({type:'lenny:setMuted',muted:Q})},[A,Q,le]),(0,w.jsx)(o.default,{visible:!0,animationType:"slide",onRequestClose:L,children:(0,w.jsxs)(c.default,{testID:"break-room",style:{flex:1,backgroundColor:(0,s.soutersSurface)('#000')},children:[M?(0,w.jsx)(E,{status:K?'Switching player\u2026':R?'Parked only \xb7 enjoy!':'Game locked',muted:!!Q,onPause:()=>le({type:'lenny:pause'}),onMute:()=>Z(!Q),onClose:L}):(0,w.jsxs)(d.Row,{style:{justifyContent:'space-between',padding:10,backgroundColor:x.colours.bg},children:[(0,w.jsx)(d.T,{weight:"semibold",children:"\ud83e\uded6 Break room"}),(0,w.jsx)(c.default,{testID:R&&!K?'break-playable':'break-locked',accessibilityLabel:G?`Game version ${G}`:void 0,children:(0,w.jsx)(d.T,{size:13,colour:R?x.colours.ok:x.colours.gold,children:K?'Switching player\u2026':R?'off'===P?'Off shift: enjoy!':'On your break: enjoy!':'Game locked'})}),(0,w.jsxs)(d.Row,{gap:4,children:[(0,w.jsx)(l.default,{testID:"break-room-mute",accessibilityRole:"button",accessibilityLabel:Q?'Turn sound and voice on':'Mute sound and voice',onPress:()=>Z(!Q),style:{padding:6},children:(0,w.jsx)(d.T,{weight:"semibold",colour:x.colours.gold,children:Q?'Sound on':'Mute'})}),(0,w.jsx)(l.default,{testID:"break-room-close",accessibilityRole:"button",onPress:L,style:{padding:6},children:(0,w.jsx)(d.T,{weight:"semibold",colour:x.colours.gold,children:"Close"})})]})]}),R||K?null:(0,w.jsx)(c.default,{testID:"break-locked-text",style:{paddingHorizontal:10,paddingVertical:6,backgroundColor:x.colours.surface},children:(0,w.jsx)(d.T,{size:13,colour:x.colours.text,children:y.GAME_LOCKED_TEXT})}),F?(0,w.jsx)(c.default,{testID:"break-notice",style:{paddingHorizontal:10,paddingVertical:6,backgroundColor:x.colours.surface},children:(0,w.jsx)(d.T,{size:13,colour:x.colours.muted,children:F})}):null,V?n.default.createElement('iframe',{ref:z,src:V.src,key:V.src,title:'Lenny\u2019s Kitchen Chaos','data-testid':'break-game',allow:'autoplay; fullscreen',style:{flex:1,width:'100%',height:'100%',border:0,background:'#000'}}):(0,w.jsx)(c.default,{style:{flex:1,alignItems:'center',justifyContent:'center'},children:(0,w.jsx)(d.Muted,{children:"The Break room opens in the web app."})}),(0,w.jsx)(c.default,{style:{position:'absolute',left:-9999,top:0,width:64,height:64,opacity:0},pointerEvents:"none",children:ne.map(e=>(0,w.jsx)(c.default,{nativeID:`cc-av-${e.id}`,children:(0,w.jsx)(u.AvatarLook,{look:_[e.id],id:e.id,name:e.name,size:96})},e.id))})]})})}function E({status:e,muted:t,onPause:s,onMute:r,onClose:n}){const o={minHeight:72,minWidth:150,paddingHorizontal:22,borderRadius:18,borderWidth:1.5,borderColor:x.colours.gold,alignItems:'center',justifyContent:'center'};return(0,w.jsxs)(c.default,{testID:"car-game-bar",style:{flexDirection:'row',alignItems:'center',gap:14,paddingHorizontal:16,paddingVertical:10,backgroundColor:x.colours.bg,borderBottomWidth:1,borderColor:x.colours.border},children:[(0,w.jsx)(l.default,{testID:"break-room-close",accessibilityRole:"button",accessibilityLabel:"Close the game",onPress:n,style:o,children:(0,w.jsx)(d.T,{size:20,weight:"semibold",colour:x.colours.gold,children:"Close"})}),(0,w.jsx)(l.default,{testID:"car-game-pause",accessibilityRole:"button",accessibilityLabel:"Pause the game",onPress:s,style:o,children:(0,w.jsx)(d.T,{size:20,weight:"semibold",colour:x.colours.gold,children:"Pause"})}),(0,w.jsxs)(c.default,{style:{flex:1,alignItems:'center',minWidth:0},children:[(0,w.jsx)(d.T,{size:22,weight:"semibold",center:!0,numberOfLines:1,children:"Lenny\u2019s Kitchen Chaos"}),(0,w.jsx)(d.T,{size:15,colour:x.colours.goldLight,center:!0,numberOfLines:1,children:`${e} \xb7 touch the big buttons on the game`})]}),(0,w.jsx)(l.default,{testID:"break-room-mute",accessibilityRole:"button",accessibilityLabel:t?'Turn sound and voice on':'Mute sound and voice',onPress:r,style:o,children:(0,w.jsx)(d.T,{size:20,weight:"semibold",colour:x.colours.gold,children:t?'Sound on':'Mute'})}),(0,w.jsx)(c.default,{testID:"car-game-parked",style:{...o,minWidth:0,borderColor:x.colours.goldMuted,backgroundColor:'rgba(201,162,74,0.12)'},children:(0,w.jsx)(d.T,{size:16,weight:"semibold",colour:x.colours.goldLight,children:"PARKED ONLY"})})]})}},1162,[928,828,34,395,236,402,102,925,794,926,891,1163,927,831,5,1164,987,821,25]); __d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"GAME_LOCKED_TEXT",{enumerable:!0,get:function(){return t}}),e.gameClock=function(t,n,o){if(!n)return'off';const a=new Date(o).getTime(),c=t.filter(t=>t.staffId===n&&t.in&&!t.out&&a-new Date(t.in).getTime()<72e6).sort((t,n)=>String(n.in).localeCompare(String(t.in)))[0];return c?c.breaks?.some(t=>!t.end)?'break':'working':'off'},Object.defineProperty(e,"gamePlayable",{enumerable:!0,get:function(){return n}});const t='You\u2019re clocked in, so the game is locked. Start your break or clock out in CoverCharge to play.';const n=t=>'working'!==t},1163,[]); __d(function(g,_r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.listScores=o,_e.submitScore=async function(e,t){const f=r.useSync.getState(),l=Math.max(0,Math.round(Number(t.score)||0));if(c()&&f.staffRef&&t.staffId===f.staffRef)try{const{data:r,error:s}=await a().from('game_scores').insert({venue_id:f.venueId,game:'lenny',level_id:e,staff_ref:f.staffRef??null,name:String(t.name||'Crew').replace(/\s+/g,' ').trim().slice(0,24),character_id:t.characterId??null,score:l,stars:Math.max(0,Math.min(3,Number(t.stars)||0)),stats:{...t.stats??{},badges:t.badges??[],character:t.character??null}}).select('id').single();if(s)throw s;const{count:n}=await a().from('game_scores').select('id',{count:'exact',head:!0}).eq('venue_id',f.venueId).eq('game','lenny').eq('level_id',e).gt('score',l);return{rank:(n??0)+1,entries:await o(e,10),id:r.id}}catch{}const u=await s.kv.get(n,{}),y=[...u[e]??[],{...t,score:l,date:(new Date).toISOString()}].sort((e,t)=>t.score-e.score).slice(0,50);return await s.kv.set(n,{...u,[e]:y}),{rank:y.findIndex(e=>e.score===l)+1,entries:y.slice(0,10),id:null}},_e.loadProgress=async function(e){if(!e)return null;const t=r.useSync.getState();if(l(e))try{const{data:r,error:s}=await a().from('game_progress').select('progress').eq('venue_id',t.venueId).eq('game','lenny').eq('staff_ref',e).maybeSingle();if(s)throw s;if(r)return v(r.progress)}catch{}return v((await s.kv.get(f,{}))[e])},Object.defineProperty(_e,"LENNY_LAST_WORLD",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"LENNY_LEVELS",{enumerable:!0,get:function(){return y}}),_e.cleanProgress=v,_e.saveProgress=async function(e,t){const n=v(t);if(!e||!n||JSON.stringify(n).length>16e3)return;const c=await s.kv.get(f,{});await s.kv.set(f,{...c,[e]:n});const o=r.useSync.getState();if(l(e))try{await a().from('game_progress').upsert({venue_id:o.venueId,game:'lenny',staff_ref:e,progress:n,updated_at:(new Date).toISOString()},{onConflict:'venue_id,game,staff_ref'})}catch{}};var e=_r(d[0]),t=_r(d[1]),r=_r(d[2]),s=_r(d[3]);const a=()=>(0,e.getSupabase)(),n='lenny:scores:v1',c=()=>(0,t.isSupabaseConfigured)()&&!!r.useSync.getState().venueId&&'staff'===r.useSync.getState().kind;async function o(e,t=10){if(c())try{const{data:s,error:n}=await a().from('game_scores').select('*').eq('venue_id',r.useSync.getState().venueId).eq('game','lenny').eq('level_id',e).order('score',{ascending:!1}).limit(t);if(n)throw n;return(s??[]).map(e=>({name:e.name,staffId:e.staff_ref,characterId:e.character_id??void 0,character:e.stats?.character,score:e.score,stars:e.stars,badges:e.stats?.badges??[],stats:e.stats,date:e.created_at}))}catch{}return((await s.kv.get(n,{}))[e]??[]).sort((e,t)=>t.score-e.score).slice(0,t)}const f='lenny:progress:v1',l=e=>{const t=r.useSync.getState();return c()&&!!t.staffRef&&e===t.staffRef};const u='festival',y=['mop','dsoap','dish','dtower','dscrub','mussels','ppeel','pfifo','bin1','bin2','bin3','mothersday','bin4','creel1','creel2','dsundae','dplate','pass','rush','delivery','death','line','steak','festival'];function v(e){if(!e||'object'!=typeof e||Array.isArray(e))return null;const t=e,r=e=>('string'==typeof e||'number'==typeof e)&&String(e).length>0&&String(e).length<=60?String(e):null,s={};if(t.stars&&'object'==typeof t.stars&&!Array.isArray(t.stars))for(const[e,a]of Object.entries(t.stars).slice(0,300)){const t=r(e),n=Math.max(0,Math.min(3,Math.floor(Number(a)||0)));t&&(s[t]=n)}const a={},n=t.badges;if(Array.isArray(n))for(const e of n.slice(0,100)){const t=r(e);t&&(a[t]=!0)}else if(n&&'object'==typeof n)for(const[e,t]of Object.entries(n).slice(0,100)){const s=r(e);s&&t&&(a[s]=!0)}const c={stars:s,badges:a,charactersUnlocked:!0===t.charactersUnlocked};return'number'==typeof t.v&&Number.isInteger(t.v)&&t.v>=0&&t.v<=9999&&(c.v=t.v),Array.isArray(t.legacyWorlds)&&t.legacyWorlds.length<=50&&t.legacyWorlds.every(e=>null!==r(e)&&'string'==typeof e)&&(c.legacyWorlds=[...t.legacyWorlds]),c}},1164,[933,976,987,977]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.KitchenRotaEditor=function({today:e=(0,o.ymd)(new Date)}){const $=(0,a.useOwner)(e=>e.staff),j=(0,a.useOwner)(e=>e.shifts),p=(0,t.useMemo)(()=>(0,l.kitchenTeam)($),[$]),k=(0,t.useMemo)(()=>new Set(p.map(e=>e.id)),[p]),[S,I]=(0,t.useState)(0),[w,D]=(0,t.useState)(null),[v,T]=(0,t.useState)(''),H=(0,a.addDays)((0,a.mondayOfDate)(e),7*S),C=(0,a.addDays)(H,6),P=u.map((e,t)=>(0,a.addDays)(H,t)),L=(0,l.kitchenPending)(j,k,H,C).length,M=e=>{T(e),(0,d.announce)(e)},R=0===S?'This week':1===S?'Next week':-1===S?'Last week':`Week of ${b(H)}`;return(0,h.jsxs)(i.default,{testID:"kitchen-rota-editor",style:{gap:10,alignItems:'center'},children:[(0,h.jsx)(n.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Kitchen rota"}),(0,h.jsxs)(n.Row,{gap:8,style:{justifyContent:'center',alignItems:'center'},children:[(0,h.jsx)(n.Button,{small:!0,kind:"ghost",testID:"krota-prev",label:"\u2039 Prev",accessibilityLabel:"Previous week",onPress:()=>{I(S-1),T('')},style:{minWidth:84,minHeight:48}}),(0,h.jsxs)(i.default,{accessible:!0,accessibilityLabel:`${R}, ${f[0]} ${b(H)} to ${f[6]} ${b(C)}`,style:{alignItems:'center',minWidth:120},children:[(0,h.jsx)(n.T,{weight:"semibold",center:!0,children:R}),(0,h.jsxs)(n.Muted,{center:!0,children:[m(H)," \u2013 ",m(C)]})]}),(0,h.jsx)(n.Button,{small:!0,kind:"ghost",testID:"krota-next",label:"Next \u203a",accessibilityLabel:"Next week",onPress:()=>{I(S+1),T('')},style:{minWidth:84,minHeight:48}})]}),p.map(t=>(0,h.jsxs)(i.default,{testID:"krota-row",style:{gap:4,alignItems:'center',alignSelf:'stretch'},children:[(0,h.jsxs)(n.T,{size:14,weight:"semibold",center:!0,children:[y(t.nickname||t.name),t.job?(0,h.jsx)(n.T,{size:12,colour:c.colours.muted,children:` ${t.job}`}):null]}),(0,h.jsx)(n.Row,{gap:4,style:{justifyContent:'center',flexWrap:'nowrap'},children:P.map((i,a)=>{const l=j.find(e=>e.staffId===t.id&&e.date===i),o=!(!l||l.published&&!l.changed),d=`${y(t.nickname||t.name)}, ${f[a]} ${b(i)}, ${l?`${(0,r.fmtH)(l.start)} to ${(0,r.fmtH)(l.end)}${o?', draft, not published yet':''}. Change shift`:'off. Add a shift'}`;return(0,h.jsxs)(s.default,{testID:`krota-cell-${t.id}-${a}`,accessibilityRole:"button",accessibilityLabel:d,onPress:()=>D({staffId:t.id,date:i,shift:l}),style:({pressed:e})=>({width:44,minHeight:52,borderRadius:8,paddingVertical:4,alignItems:'center',justifyContent:'center',borderWidth:1,borderStyle:o?'dashed':'solid',borderColor:l?o?c.colours.amber:c.colours.gold:c.colours.border,backgroundColor:e||l?c.colours.goldTint:c.colours.surface2}),children:[(0,h.jsx)(n.T,{size:10,center:!0,colour:i===e?c.colours.gold:c.colours.muted,children:u[a]}),(0,h.jsx)(n.T,{size:10,center:!0,children:l?`${(0,r.fmtH)(l.start).slice(0,5)}`:'off'}),l?(0,h.jsx)(n.T,{size:10,center:!0,children:(0,r.fmtH)(l.end).slice(0,5)}):(0,h.jsx)(n.T,{size:10,center:!0,colour:c.colours.muted,children:"+"})]},i)})})]},t.id)),p.length?null:(0,h.jsx)(n.Muted,{center:!0,children:"No kitchen team on the staff list yet."}),(0,h.jsx)(n.Button,{testID:"krota-publish",kind:L?'primary':'secondary',disabled:!L,label:L?`Publish kitchen rota (${L} ${1===L?'change':'changes'})`:'Kitchen rota published',accessibilityLabel:L?`Publish the kitchen rota for ${R.toLowerCase()}, ${L} ${1===L?'change':'changes'}`:'Kitchen rota published for this week',onPress:()=>{const e=(0,l.publishKitchen)(a.useOwner.getState().shifts,k,H,C);a.useOwner.getState().setShifts(e.shifts),M(e.n?`Published ${e.n} kitchen ${1===e.n?'shift':'shifts'}. The kitchen team see them in their app now.`:'Nothing new to publish this week.')},style:{minHeight:56,alignSelf:'stretch'}}),v?(0,h.jsx)(i.default,{testID:"krota-msg",children:(0,h.jsx)(n.T,{center:!0,colour:c.colours.goldLight,children:v})}):null,(0,h.jsx)(n.Muted,{center:!0,children:"Tap a day to add or change a shift. Dashed amber = draft, only you see it until you publish. Front of house shifts are made in CoverCharge for Managers."}),w?(0,h.jsx)(x,{init:w,onClose:()=>D(null),onSaid:M}):null]})};var t=_r(_d[0]),s=e(_r(_d[1])),i=e(_r(_d[2])),n=_r(_d[3]),a=_r(_d[4]),l=_r(_d[5]),r=_r(_d[6]),o=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]);const u=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],f=['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'],m=e=>`${e.slice(8,10)}/${e.slice(5,7)}`,b=e=>`${e.slice(8,10)}/${e.slice(5,7)}/${e.slice(0,4)}`,y=e=>e.replace(/\s*\(.*\)$/,''),$=[['Lunch',11,16],['Dinner',16.5,22.5],['Double',11,21],['Close',17,23.5]];function x({init:e,onClose:s,onSaid:d}){const u=(0,a.useOwner)(t=>t.staff.find(t=>t.id===e.staffId)),f=y(u?.nickname||u?.name||''),[m,x]=(0,t.useState)(e.shift?.start??11),[j,p]=(0,t.useState)(e.shift?.end??21),[k,S]=(0,t.useState)(!1),[I,w]=(0,t.useState)(''),D=`${(0,o.niceDate)((0,o.parseYmd)(e.date))} (${b(e.date)})`;return(0,h.jsx)(n.Sheet,{visible:!0,onClose:s,title:`${f} \xb7 ${D}`,testID:"krota-sheet",children:(0,h.jsxs)(i.default,{style:{gap:10,alignItems:'center'},children:[(0,h.jsx)(n.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:$.map(([e,t,s])=>(0,h.jsx)(n.Chip,{testID:`krota-preset-${e.toLowerCase()}`,label:`${e} ${(0,r.fmtH)(t)}\u2013${(0,r.fmtH)(s)}`,selected:m===t&&j===s,onPress:()=>{x(t),p(s)}},e))}),(0,h.jsx)(n.T,{center:!0,children:"Start"}),(0,h.jsx)(n.Stepper,{testID:"krota-start",value:m,step:.5,min:r.SHIFT_MIN_START,max:j-1,onChange:x,format:r.fmtH,label:"Start time"}),(0,h.jsxs)(n.T,{center:!0,children:["End",j>=24?' (next day)':'']}),(0,h.jsx)(n.Stepper,{testID:"krota-end",value:j,step:.5,min:m+1,max:r.SHIFT_MAX_END,onChange:p,format:r.fmtH,label:"End time"}),(0,h.jsxs)(n.Muted,{center:!0,children:[(j-m).toFixed(1)," hours"]}),I?(0,h.jsx)(i.default,{accessibilityLiveRegion:"assertive",children:(0,h.jsx)(n.T,{center:!0,colour:c.colours.amber,children:I})}):null,(0,h.jsx)(n.Button,{testID:"krota-save",label:e.shift?'Save shift':'Add shift',accessibilityLabel:`${e.shift?'Save':'Add'} ${f}'s shift, ${D}, ${(0,r.fmtH)(m)} to ${(0,r.fmtH)(j)}`,onPress:()=>{const t=a.useOwner.getState();(0,l.clashes)(t.shifts,e.staffId,e.date,m,j,e.shift?.id)?w(`${f} already has a shift that overlaps on ${D}.`):(e.shift?t.setShifts(t.shifts.map(t=>t.id===e.shift.id?{...t,start:m,end:j,changed:!!t.published||t.changed}:t)):t.addShift({staffId:e.staffId,date:e.date,start:m,end:j}),d(`${e.shift?'Changed':'Added'}: ${f}, ${D}, ${(0,r.fmtH)(m)} to ${(0,r.fmtH)(j)}. Draft until you publish the kitchen rota.`),s())},style:{minHeight:56,alignSelf:'stretch'}}),e.shift&&!k?(0,h.jsx)(n.Button,{testID:"krota-remove",kind:"danger",label:"Remove shift",onPress:()=>S(!0),style:{minHeight:52,alignSelf:'stretch'}}):null,e.shift&&k?(0,h.jsxs)(i.default,{testID:"krota-remove-ask",accessibilityLiveRegion:"assertive",style:{gap:8,alignItems:'center',alignSelf:'stretch'},children:[(0,h.jsxs)(n.T,{center:!0,weight:"semibold",children:["Remove ",f,"\u2019s shift on ",D,"?"]}),(0,h.jsx)(n.Button,{testID:"krota-remove-yes",kind:"danger",label:"Yes, remove it",onPress:()=>{a.useOwner.getState().removeShift(e.shift.id),d(`Removed ${f}'s shift on ${D}.`),s()},style:{minHeight:52,alignSelf:'stretch'}}),(0,h.jsx)(n.Button,{testID:"krota-remove-no",kind:"secondary",label:"No, keep it",onPress:()=>S(!1),style:{minHeight:52,alignSelf:'stretch'}})]}):null]})})}},1165,[34,402,102,794,891,988,1087,858,1166,821,25]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.KitchenRotaEditor=p,_e.KitchenRotaTab=function({today:e=(0,h.ymd)(new Date)}){const t=(0,r.canEditKitchenRota)((0,d.useSync)(e=>e.perms));return(0,m.jsx)(i.default,{testID:"chef-rota-tab",style:{alignSelf:'stretch',alignItems:'center'},children:t?(0,m.jsx)(p,{today:e}):(0,m.jsx)(w,{today:e})})},_e.KitchenRotaRead=w;var t=_r(_d[0]),s=e(_r(_d[1])),i=e(_r(_d[2])),n=_r(_d[3]),a=_r(_d[4]),r=_r(_d[5]),l=_r(_d[6]),o=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]),u=_r(_d[11]),f=_r(_d[12]),m=_r(_d[13]);const y=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],b=['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'],x=e=>`${e.slice(8,10)}/${e.slice(5,7)}`,j=e=>`${e.slice(8,10)}/${e.slice(5,7)}/${e.slice(0,4)}`,$=e=>e.replace(/\s*\(.*\)$/,''),k=[['Lunch',11,16],['Dinner',16.5,22.5],['Double',11,21],['Close',17,23.5]];function p({today:e=(0,h.ymd)(new Date)}){const l=(0,a.useOwner)(e=>e.staff),o=(0,a.useOwner)(e=>e.shifts),d=(0,t.useMemo)(()=>(0,r.kitchenTeam)(l),[l]),k=(0,t.useMemo)(()=>new Set(d.map(e=>e.id)),[d]),[p,w]=(0,t.useState)(0),[I,D]=(0,t.useState)(null),[T,v]=(0,t.useState)(''),H=(0,a.addDays)((0,a.mondayOfDate)(e),7*p),C=(0,a.addDays)(H,6),L=y.map((e,t)=>(0,a.addDays)(H,t)),P=(0,r.kitchenPending)(o,k,H,C).length,R=e=>{v(e),(0,u.announce)(e)},M=0===p?'This week':1===p?'Next week':-1===p?'Last week':`Week of ${j(H)}`;return(0,m.jsxs)(i.default,{testID:"kitchen-rota-editor",style:{gap:10,alignItems:'center'},children:[(0,m.jsx)(n.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Kitchen rota"}),(0,m.jsxs)(n.Row,{gap:8,style:{justifyContent:'center',alignItems:'center'},children:[(0,m.jsx)(n.Button,{small:!0,kind:"ghost",testID:"krota-prev",label:"\u2039 Prev",accessibilityLabel:"Previous week",onPress:()=>{w(p-1),v('')},style:{minWidth:84,minHeight:48}}),(0,m.jsxs)(i.default,{accessible:!0,accessibilityLabel:`${M}, ${b[0]} ${j(H)} to ${b[6]} ${j(C)}`,style:{alignItems:'center',minWidth:120},children:[(0,m.jsx)(n.T,{weight:"semibold",center:!0,children:M}),(0,m.jsxs)(n.Muted,{center:!0,children:[x(H)," \u2013 ",x(C)]})]}),(0,m.jsx)(n.Button,{small:!0,kind:"ghost",testID:"krota-next",label:"Next \u203a",accessibilityLabel:"Next week",onPress:()=>{w(p+1),v('')},style:{minWidth:84,minHeight:48}})]}),d.map(t=>(0,m.jsxs)(i.default,{testID:"krota-row",style:{gap:4,alignItems:'center',alignSelf:'stretch'},children:[(0,m.jsxs)(n.T,{size:14,weight:"semibold",center:!0,children:[$(t.nickname||t.name),t.job?(0,m.jsx)(n.T,{size:12,colour:f.colours.muted,children:` ${t.job}`}):null]}),(0,m.jsx)(n.Row,{gap:4,style:{justifyContent:'center',flexWrap:'nowrap'},children:L.map((i,a)=>{const r=o.find(e=>e.staffId===t.id&&e.date===i),l=!(!r||r.published&&!r.changed),d=`${$(t.nickname||t.name)}, ${b[a]} ${j(i)}, ${r?`${(0,c.fmtH)(r.start)} to ${(0,c.fmtH)(r.end)}${l?', draft, not published yet':''}. Change shift`:'off. Add a shift'}`;return(0,m.jsxs)(s.default,{testID:`krota-cell-${t.id}-${a}`,accessibilityRole:"button",accessibilityLabel:d,onPress:()=>D({staffId:t.id,date:i,shift:r}),style:({pressed:e})=>({width:44,minHeight:52,borderRadius:8,paddingVertical:4,alignItems:'center',justifyContent:'center',borderWidth:1,borderStyle:l?'dashed':'solid',borderColor:r?l?f.colours.amber:f.colours.gold:f.colours.border,backgroundColor:e||r?f.colours.goldTint:f.colours.surface2}),children:[(0,m.jsx)(n.T,{size:10,center:!0,colour:i===e?f.colours.gold:f.colours.muted,children:y[a]}),(0,m.jsx)(n.T,{size:10,center:!0,children:r?`${(0,c.fmtH)(r.start).slice(0,5)}`:'off'}),r?(0,m.jsx)(n.T,{size:10,center:!0,children:(0,c.fmtH)(r.end).slice(0,5)}):(0,m.jsx)(n.T,{size:10,center:!0,colour:f.colours.muted,children:"+"})]},i)})})]},t.id)),d.length?null:(0,m.jsx)(n.Muted,{center:!0,children:"No kitchen team on the staff list yet."}),(0,m.jsx)(n.Button,{testID:"krota-publish",kind:P?'primary':'secondary',disabled:!P,label:P?`Publish kitchen rota (${P} ${1===P?'change':'changes'})`:'Kitchen rota published',accessibilityLabel:P?`Publish the kitchen rota for ${M.toLowerCase()}, ${P} ${1===P?'change':'changes'}`:'Kitchen rota published for this week',onPress:()=>{const e=(0,r.publishKitchen)(a.useOwner.getState().shifts,k,H,C);a.useOwner.getState().setShifts(e.shifts),R(e.n?`Published ${e.n} kitchen ${1===e.n?'shift':'shifts'}. The kitchen team see them in their app now.`:'Nothing new to publish this week.')},style:{minHeight:56,alignSelf:'stretch'}}),T?(0,m.jsx)(i.default,{testID:"krota-msg",children:(0,m.jsx)(n.T,{center:!0,colour:f.colours.goldLight,children:T})}):null,(0,m.jsx)(n.Muted,{center:!0,children:"Tap a day to add or change a shift. Dashed amber = draft, only you see it until you publish. Front of house shifts are made in CoverCharge for Managers."}),I?(0,m.jsx)(S,{init:I,onClose:()=>D(null),onSaid:R}):null]})}function w({today:e=(0,h.ymd)(new Date)}){const{staff:s,shifts:r}=(0,o.rotaView)('chef',(0,a.useOwner)(e=>e.staff),(0,a.useOwner)(e=>e.shifts)),d=(0,a.useOwner)(e=>e.leave),[u,k]=(0,t.useState)(0),p=(0,a.addDays)((0,a.mondayOfDate)(e),7*u),w=(0,a.addDays)(p,6),S=y.map((e,t)=>(0,a.addDays)(p,t)),I=s.filter(e=>/kitchen|chef|kp/i.test(`${e.job??''} ${e.name}`)),D=0===u?'This week':1===u?'Next week':-1===u?'Last week':`Week of ${j(p)}`,[T,v]=(0,t.useState)(0),H=T?Math.max(30,Math.min(44,Math.floor((T-12)/7))):40;return(0,m.jsxs)(i.default,{testID:"kitchen-rota-read",onLayout:e=>v(e.nativeEvent.layout.width),style:{gap:10,alignItems:'center',alignSelf:'stretch'},children:[(0,m.jsx)(n.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Kitchen rota"}),(0,m.jsxs)(n.Row,{gap:8,style:{justifyContent:'center',alignItems:'center'},children:[(0,m.jsx)(n.Button,{small:!0,kind:"ghost",testID:"krota-read-prev",label:"\u2039 Prev",accessibilityLabel:"Previous week",onPress:()=>k(u-1),style:{minWidth:84,minHeight:48}}),(0,m.jsxs)(i.default,{accessible:!0,accessibilityLabel:`${D}, ${b[0]} ${j(p)} to ${b[6]} ${j(w)}`,style:{alignItems:'center',minWidth:120},children:[(0,m.jsx)(n.T,{weight:"semibold",center:!0,children:D}),(0,m.jsxs)(n.Muted,{center:!0,children:[x(p)," \u2013 ",x(w)]})]}),(0,m.jsx)(n.Button,{small:!0,kind:"ghost",testID:"krota-read-next",label:"Next \u203a",accessibilityLabel:"Next week",onPress:()=>k(u+1),style:{minWidth:84,minHeight:48}})]}),I.map(t=>(0,m.jsxs)(i.default,{testID:"krota-read-row",style:{gap:4,alignItems:'center',alignSelf:'stretch'},children:[(0,m.jsx)(n.T,{size:14,weight:"semibold",center:!0,children:$(t.nickname||t.name)}),(0,m.jsx)(n.Row,{gap:2,style:{justifyContent:'center',flexWrap:'nowrap'},children:S.map((s,a)=>{const o=r.find(e=>e.staffId===t.id&&e.date===s),h=o?(0,l.leaveCovering)(d,t.id,s):void 0,u=o?h?(0,l.leaveLabel)(h):`${(0,c.fmtH)(o.start)} to ${(0,c.fmtH)(o.end)}`:'off';return(0,m.jsxs)(i.default,{testID:`krota-read-cell-${t.id}-${a}`,accessible:!0,accessibilityLabel:`${$(t.nickname||t.name)}, ${b[a]} ${j(s)}, ${u}`,style:{width:H,minHeight:52,borderRadius:8,paddingVertical:4,paddingHorizontal:0,alignItems:'center',justifyContent:'center',borderWidth:1,borderColor:o?f.colours.gold:f.colours.border,backgroundColor:o?f.colours.goldTint:f.colours.surface2},children:[(0,m.jsx)(n.T,{size:10,center:!0,colour:s===e?f.colours.gold:f.colours.muted,children:y[a]}),o&&h?(0,m.jsx)(n.T,{size:9,center:!0,colour:f.colours.blue,children:(0,l.leaveLabel)(h).toLowerCase()}):(0,m.jsx)(n.T,{size:10,center:!0,children:o?(0,c.fmtH)(o.start).slice(0,5):'off'}),o&&!h?(0,m.jsx)(n.T,{size:10,center:!0,children:(0,c.fmtH)(o.end).slice(0,5)}):null]},s)})})]},t.id)),I.length?null:(0,m.jsx)(n.Muted,{center:!0,children:"No kitchen shifts on the rota yet."}),(0,m.jsx)(n.Muted,{center:!0,children:"This shows published shifts only. To change the kitchen rota here, an owner can tick \u201cMake the kitchen rota\u201d for you on the Permissions screen."})]})}function S({init:e,onClose:s,onSaid:l}){const o=(0,a.useOwner)(t=>t.staff.find(t=>t.id===e.staffId)),d=$(o?.nickname||o?.name||''),[u,y]=(0,t.useState)(e.shift?.start??11),[b,x]=(0,t.useState)(e.shift?.end??21),[p,w]=(0,t.useState)(!1),[S,I]=(0,t.useState)(''),D=`${(0,h.niceDate)((0,h.parseYmd)(e.date))} (${j(e.date)})`;return(0,m.jsx)(n.Sheet,{visible:!0,onClose:s,title:`${d} \xb7 ${D}`,testID:"krota-sheet",children:(0,m.jsxs)(i.default,{style:{gap:10,alignItems:'center'},children:[(0,m.jsx)(n.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:k.map(([e,t,s])=>(0,m.jsx)(n.Chip,{testID:`krota-preset-${e.toLowerCase()}`,label:`${e} ${(0,c.fmtH)(t)}\u2013${(0,c.fmtH)(s)}`,selected:u===t&&b===s,onPress:()=>{y(t),x(s)}},e))}),(0,m.jsx)(n.T,{center:!0,children:"Start"}),(0,m.jsx)(n.Stepper,{testID:"krota-start",value:u,step:.5,min:c.SHIFT_MIN_START,max:b-1,onChange:y,format:c.fmtH,label:"Start time"}),(0,m.jsxs)(n.T,{center:!0,children:["End",b>=24?' (next day)':'']}),(0,m.jsx)(n.Stepper,{testID:"krota-end",value:b,step:.5,min:u+1,max:c.SHIFT_MAX_END,onChange:x,format:c.fmtH,label:"End time"}),(0,m.jsxs)(n.Muted,{center:!0,children:[(b-u).toFixed(1)," hours"]}),S?(0,m.jsx)(i.default,{accessibilityLiveRegion:"assertive",children:(0,m.jsx)(n.T,{center:!0,colour:f.colours.amber,children:S})}):null,(0,m.jsx)(n.Button,{testID:"krota-save",label:e.shift?'Save shift':'Add shift',accessibilityLabel:`${e.shift?'Save':'Add'} ${d}'s shift, ${D}, ${(0,c.fmtH)(u)} to ${(0,c.fmtH)(b)}`,onPress:()=>{const t=a.useOwner.getState();(0,r.clashes)(t.shifts,e.staffId,e.date,u,b,e.shift?.id)?I(`${d} already has a shift that overlaps on ${D}.`):(e.shift?t.setShifts(t.shifts.map(t=>t.id===e.shift.id?{...t,start:u,end:b,changed:!!t.published||t.changed}:t)):t.addShift({staffId:e.staffId,date:e.date,start:u,end:b}),l(`${e.shift?'Changed':'Added'}: ${d}, ${D}, ${(0,c.fmtH)(u)} to ${(0,c.fmtH)(b)}. Draft until you publish the kitchen rota.`),s())},style:{minHeight:56,alignSelf:'stretch'}}),e.shift&&!p?(0,m.jsx)(n.Button,{testID:"krota-remove",kind:"danger",label:"Remove shift",onPress:()=>w(!0),style:{minHeight:52,alignSelf:'stretch'}}):null,e.shift&&p?(0,m.jsxs)(i.default,{testID:"krota-remove-ask",accessibilityLiveRegion:"assertive",style:{gap:8,alignItems:'center',alignSelf:'stretch'},children:[(0,m.jsxs)(n.T,{center:!0,weight:"semibold",children:["Remove ",d,"\u2019s shift on ",D,"?"]}),(0,m.jsx)(n.Button,{testID:"krota-remove-yes",kind:"danger",label:"Yes, remove it",onPress:()=>{a.useOwner.getState().removeShift(e.shift.id),l(`Removed ${d}'s shift on ${D}.`),s()},style:{minHeight:52,alignSelf:'stretch'}}),(0,m.jsx)(n.Button,{testID:"krota-remove-no",kind:"secondary",label:"No, keep it",onPress:()=>w(!1),style:{minHeight:52,alignSelf:'stretch'}})]}):null]})})}},1165,[34,402,102,794,891,988,1094,993,987,1087,858,1166,821,25]); __d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.primeAnnouncer=function(){u()},_e.announce=function(t){const e=String(t??'').trim();if(!e)return;{const t=u();if(!t)return;const n=++o;return t.textContent='',void setTimeout(()=>{n===o&&(t.textContent=e)},80)}},Object.defineProperty(_e,"lastAnnounced",{enumerable:!0,get:function(){return c}});var t,e=r(d[0]);(t=e)&&t.__esModule;r(d[1]);let n=null,o=0;function u(){if('undefined'==typeof document||!document.body)return null;if(n&&document.body.contains(n))return n;const t=document.createElement('div');return t.id='cc-announcer',t.setAttribute('aria-live','assertive'),t.setAttribute('aria-atomic','true'),t.setAttribute('role','status'),t.setAttribute('data-testid','cc-announcer'),Object.assign(t.style,{position:'absolute',width:'1px',height:'1px',margin:'-1px',padding:'0',overflow:'hidden',clip:'rect(0 0 0 0)',whiteSpace:'nowrap',border:'0'}),document.body.appendChild(t),n=t,t}const c=()=>n?.textContent??''},1166,[281,236]); __d(function(g,r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useSuggestions=j,_e.OrdersScreen=function({focus:e}={}){const[s,t]=(0,n.useState)('sheets');return(0,x.jsxs)(l.default,{style:{gap:12},children:[(0,x.jsx)(y.Seg,{value:s,onChange:t,options:[{id:'sheets',label:'Order sheets'},{id:'suggested',label:'Suggested orders'},{id:'history',label:'Order history'}]}),'sheets'===s?(0,x.jsx)(m.OrderSheets,{focus:e}):'suggested'===s?(0,x.jsx)(w,{}):(0,x.jsx)($,{})]})};var s=r(_d[0]),t=r(_d[1]),n=r(_d[2]),i=e(r(_d[3])),l=e(r(_d[4])),d=r(_d[5]),o=r(_d[6]),u=r(_d[7]),c=r(_d[8]),h=r(_d[9]),p=r(_d[10]),y=r(_d[11]),f=r(_d[12]),m=r(_d[13]),x=r(_d[14]);const b=(e,s)=>'kg'===s?Math.ceil(2*e)/2:Math.ceil(e);function j(){const{k:e,now:s,rid:n}=(0,y.useChef)(6e4),{pct:i}=(0,y.useForecast)(),l=(0,u.supplierView)('chef',(0,o.useOwner)(e=>e.suppliers)).filter(e=>!e.archived),d=1+Math.max(0,i)/100;return l.map(i=>{const l=e.ingredients.filter(e=>e.supplierId===i.id).map(e=>({i:e,qty:(0,t.fishInStone)(n,e)?(0,t.fromStone)(Math.ceil(2*(0,t.toStone)(Math.max(0,e.par*d-e.onHand),e.unit))/2,e.unit):b(Math.max(0,e.par*d-e.onHand),e.unit)})).filter(e=>e.qty>0),o=(0,p.weekday)(s),u=i.orderDays.includes(o),[c,h]=(i.cutoff||'23:59').split(':').map(Number),y=new Date(s);y.setHours(c,h,0,0);const f=e.orders.some(e=>e.supplierId===i.id&&new Date(e.at).toDateString()===s.toDateString()),m=[1,2,3,4,5,6,7].map(e=>(o+e)%7).find(e=>i.orderDays.includes(e));return{s:i,lines:l,ordersToday:u,cutPassed:s>y,placedToday:f,nextDay:m,total:Math.round(l.reduce((e,s)=>e+s.qty*s.i.cost,0))}}).filter(e=>e.lines.length||e.ordersToday)}function w(){const{me:e,rid:o}=(0,y.useChef)(),{label:u,covers:m,enough:b,booked:w}=(0,y.useForecast)(),$=(0,f.useKitchen)(e=>e.addOrder),S=j(),[C,M]=(0,n.useState)({}),[O,k]=(0,n.useState)('');return(0,x.jsxs)(l.default,{style:{gap:10},children:[(0,x.jsxs)(d.Muted,{children:[b?`Built from par levels and today's forecast (${m} Covers, ${u} vs a typical day).`:`Built from par levels (no forecast yet: not enough history; ${w} Covers booked so far).`," Adjust, then call the supplier or use their ordering website. Nothing is sent by CoverCharge."]}),O?(0,x.jsx)(d.Banner,{kind:"success",title:"Saved to order history",children:O}):null,S.map(({s:n,lines:u,ordersToday:y,cutPassed:f,placedToday:m,nextDay:b,total:j})=>{const w=u.map(e=>({...e,q:C[`${n.id}:${e.i.id}`]??e.qty})),S=Math.round(w.reduce((e,s)=>e+s.q*s.i.cost,0)),O=s=>{$({supplierId:n.id,by:e,status:s,lines:w.filter(e=>e.q>0).map(e=>({ing:e.i.id,qty:e.q,cost:e.i.cost})),total:S}),k(`${n.name}: ${(0,c.gbp)(S)} (${s}).`)};return(0,x.jsxs)(d.Card,{highlight:!y||m||f?void 0:h.colours.gold,children:[(0,x.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsxs)(l.default,{style:{flex:1},children:[(0,x.jsx)(d.T,{weight:"semibold",children:n.name}),(0,x.jsxs)(d.Muted,{children:[n.category," \xb7 min order ",(0,c.gbp)(n.minOrder)]})]}),m?(0,x.jsx)(d.Badge,{kind:"ok",label:"ORDERED TODAY"}):y?(0,x.jsx)(d.Badge,{kind:f?'red':'amber',label:f?`CUT-OFF ${n.cutoff} PASSED`:`ORDER BY ${n.cutoff}`}):(0,x.jsx)(d.Badge,{label:`NEXT ${null!=b?p.DAY3[b].toUpperCase():'\u2014'}`})]}),w.length?w.map(e=>(0,x.jsxs)(d.Row,{wrap:!0,style:{justifyContent:'space-between'},children:[(0,x.jsxs)(l.default,{style:{flex:1},children:[(0,x.jsx)(d.T,{size:14,children:e.i.name}),(0,x.jsxs)(d.Muted,{children:["On hand ",(0,s.ingredientQty)(o,e.i,e.i.onHand)," \xb7 par ",(0,s.ingredientQty)(o,e.i,e.i.par)]})]}),(0,x.jsx)(d.Button,{small:!0,kind:"ghost",label:"Less",accessibilityLabel:`${(0,t.fishInStone)(o,e.i)?'Half a stone less':'Less'} ${e.i.name}`,onPress:()=>M(s=>({...s,[`${n.id}:${e.i.id}`]:(0,t.stepQuantity)(o,e.i,e.q,-1)}))}),(0,x.jsx)(l.default,{accessible:!0,accessibilityLabel:(0,s.ingredientSpeech)(o,e.i,e.q),children:(0,x.jsx)(d.T,{size:16,style:{minWidth:76,textAlign:'center'},children:(0,s.ingredientQty)(o,e.i,e.q)})}),(0,x.jsx)(d.Button,{small:!0,kind:"ghost",label:"More",accessibilityLabel:`${(0,t.fishInStone)(o,e.i)?'Half a stone more':'More'} ${e.i.name}`,onPress:()=>M(s=>({...s,[`${n.id}:${e.i.id}`]:(0,t.stepQuantity)(o,e.i,e.q,1)}))})]},e.i.id)):(0,x.jsx)(d.Muted,{children:"Everything is at par."}),w.length?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsxs)(d.T,{weight:"semibold",children:["Estimated ",(0,c.gbp)(S)]}),S{i.default.openURL(`tel:${n.phones[0].replace(/\s/g,'')}`).catch(()=>{}),O('placed (by phone)')}}):null,n.website?(0,x.jsx)(d.Button,{small:!0,kind:"secondary",label:"Open website",onPress:()=>{i.default.openURL(n.website).catch(()=>{}),O('placed (on website)')}}):null]})]}):null,void 0]},n.id)})]})}function $(){const{k:e,rid:t}=(0,y.useChef)(),n=(0,o.useOwner)(e=>e.suppliers);return(0,x.jsx)(l.default,{style:{gap:8},children:e.orders.map(i=>(0,x.jsxs)(d.Card,{children:[(0,x.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(d.T,{weight:"semibold",style:{flex:1},children:n.find(e=>e.id===i.supplierId)?.name}),(0,x.jsx)(d.Badge,{kind:"neutral",label:i.status.toUpperCase()})]}),(0,x.jsxs)(d.Muted,{children:[new Date(i.at).toLocaleString('en-GB',{weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})," \xb7 ",i.by,i.total?` \xb7 ${(0,c.gbp)(i.total)}`:'']}),i.lines.length?(0,x.jsx)(d.Muted,{children:i.lines.map(n=>{const i=e.ingredients.find(e=>e.id===n.ing);return`${(0,s.ingredientQty)(t,i??{name:n.ing,unit:''},n.qty)} ${i?.name??n.ing}`}).join(', ')}):null]},i.id))})}},1167,[1153,984,34,379,102,794,891,993,867,821,1084,1145,1029,1168,25]); __d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.openLink=j,_e.useSheetReminders=T,_e.OrderSheets=function({focus:e}){const{rid:t,now:l}=(0,x.useChef)(3e4),o=(0,u.useSheets)(t).filter(e=>(0,n.chefCanSee)(t,e)&&!e.placeholder),[h,c]=(0,s.useState)(e??null),p=T(),f=(0,b.wd)(l);return(0,y.jsxs)(d.default,{style:{gap:10},testID:"order-sheets",children:[(0,y.jsx)(i.Banner,{kind:"info",title:"Nothing is sent for you",children:"Text, WhatsApp and phone orders open your phone\u2019s own app with the order already written. Check it, then press Send yourself."}),p.map(e=>(0,y.jsx)(r.default,{accessibilityRole:"button",onPress:()=>c(e.supplierId),children:(0,y.jsxs)(i.Banner,{kind:'red'===e.tone?'danger':'warn',title:`\u23f0 ${e.text}`,children:["Tap to open the ",e.name," order sheet."]})},e.supplierId)),(0,y.jsxs)(i.Muted,{children:["Today is ",b.DAYS[f],". Edit suppliers in Managers \u203a Settings \u203a Supplier order sheets."]}),o.map(e=>(0,y.jsx)(C,{s:e,open:h===e.id,onToggle:()=>c(h===e.id?null:e.id)},e.id)),o.length?null:(0,y.jsx)(i.Muted,{children:"No order sheets yet. Add suppliers in Managers \u203a Settings \u203a Supplier order sheets."})]})};var t=_r(_d[0]),n=_r(_d[1]),l=_r(_d[2]),s=_r(_d[3]),o=e(_r(_d[4]));_r(_d[5]);var r=e(_r(_d[6])),d=e(_r(_d[7])),i=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),c=_r(_d[11]),p=_r(_d[12]),b=_r(_d[13]),f=_r(_d[14]),x=_r(_d[15]),y=_r(_d[16]);function j(e){if('undefined'!=typeof window){const t=window;return'function'==typeof t.__ccOpenLink?void t.__ccOpenLink(e):void(/^https?:/.test(e)?window.open(e,'_blank','noopener'):window.location.href=e)}o.default.openURL(e).catch(()=>{})}async function w(e){try{const t='undefined'!=typeof navigator?navigator:null;if(t?.clipboard?.writeText)return await t.clipboard.writeText(e),!0}catch{}return!1}const k={online:'\ud83c\udf10',phone:'\ud83d\udcde',text:'\ud83d\udcac',whatsapp:'\u2706',tbc:'\ud83d\udd8a\ufe0f'},S={borderWidth:1,borderColor:f.colours.border,borderRadius:10,paddingHorizontal:12,paddingVertical:10,color:f.colours.text,backgroundColor:f.colours.surface2,fontSize:f.font.body};function T(){const{rid:e,now:t}=(0,x.useChef)(6e4),l=(0,u.useSheets)(e).filter(t=>(0,n.chefCanSee)(e,t)&&!t.placeholder),s=(0,u.useOrderSheets)(e=>e.opened),o=(0,h.useShellfish)(e,'','chef'),r=(0,b.remindersFor)(l,t,s);for(const n of l){const l=o.items.filter(e=>(e.supplierId===n.id||!e.supplierId&&n.shellfish)&&o.isLow(e.key));!l.length||s[n.id]&&new Date(s[n.id]).toDateString()===t.toDateString()||r.push({supplierId:n.id,name:n.name,text:`${'text'===n.method||'whatsapp'===n.method?'Text':'Order from'} ${n.contact||n.name}: ${l.map(t=>`${(0,c.fmtStockCount)(e,t,o.counts[t.key]??0)} ${t.plural.toLowerCase()}`).join(' and ')} left`,tone:'amber',cutoffPassed:!1})}return r}function C({s:e,open:n,onToggle:o}){const{rid:T,r:C,me:$,now:D}=(0,x.useChef)(3e4),v=(0,u.useOrderSheets)(e=>e.patch),I=(0,u.useOrderSheets)(e=>e.markOpened),M=(0,u.useOrderSheets)(t=>t.opened[e.id]),[B,L]=(0,s.useState)({}),[P,O]=(0,s.useState)(''),[R,A]=(0,s.useState)(''),[z,_]=(0,s.useState)(!1),W=(0,h.useShellfish)(T,$,'chef'),H=(0,b.nextDelivery)(e,D),K=(0,b.orderLines)(e,B,P,T),E=(C.address??C.location??'').split(',').map(e=>e.trim()).filter(Boolean),q=E.length>=3?E[1]:E[0]??'',N=(0,b.orderMessage)(e,C.name,q,K,$.split(' ')[0],D),U=e.orderDays.includes((0,b.wd)(D)),Q=(e,t)=>L(n=>({...n,[e.id]:(0,l.stepQuantity)(T,e,n[e.id]||0,t)})),Y=t=>{I(e.id,D.toISOString()),j(t)},F='text'===e.method||'whatsapp'===e.method||'phone'===e.method,G=Math.round(100*parseFloat(R.replace(/[\xa3,]/g,''))),V=W.items.filter(t=>t.supplierId===e.id||!t.supplierId&&e.shellfish),J=V.filter(e=>W.isLow(e.key));return(0,y.jsxs)(d.default,{testID:`sheet-${e.id}`,style:{borderRadius:14,borderWidth:1.5,borderColor:U||J.length?f.colours.amber:n?f.colours.gold:f.colours.border,backgroundColor:f.colours.surface,overflow:'hidden'},children:[(0,y.jsxs)(r.default,{accessibilityRole:"button",accessibilityLabel:`${e.name} order sheet`,onPress:o,style:{padding:12,gap:4},children:[(0,y.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsxs)(i.T,{weight:"semibold",size:f.font.large,style:{flex:1},children:[k[e.method]," ",e.name]}),(0,y.jsx)(i.Badge,{kind:e.placeholder?'amber':'gold',label:e.placeholder?'To fill in':b.METHOD_LABEL[e.method]})]}),(0,y.jsx)(i.Muted,{children:e.goods}),(0,y.jsxs)(i.Row,{wrap:!0,gap:6,children:[e.deliveryDays.length?(0,y.jsx)(i.Badge,{kind:"neutral",label:`Delivers ${(0,b.dayRange)(e.deliveryDays)}`}):null,e.orderDays.length?(0,y.jsx)(i.Badge,{kind:U?'amber':'neutral',label:`Order ${(0,b.dayRange)(e.orderDays)}${e.cutoff?` by ${e.cutoff}`:''}`}):null,e.frequency?(0,y.jsx)(i.Badge,{kind:"neutral",label:e.frequency}):null,e.priceCapPerKg?(0,y.jsx)(i.Badge,{kind:"blue",label:`Cap ${(0,p.gbp)(e.priceCapPerKg)}/kg`}):null,V.length?(0,y.jsx)(i.Badge,{kind:J.length?'amber':'ok',label:V.map(e=>`${e.icon} ${(0,c.fmtStockCount)(T,e,W.counts[e.key]??0)}`).join(' \xb7 ')}):null,M&&new Date(M).toDateString()===D.toDateString()?(0,y.jsx)(i.Badge,{kind:"ok",label:"Opened today \u2713"}):null]})]}),n?(0,y.jsxs)(d.default,{style:{padding:12,paddingTop:0,gap:10},children:[H?(0,y.jsxs)(i.Muted,{children:["Next delivery if you order now: ",(0,b.niceDay)(H),"."]}):null,e.reminder?(0,y.jsxs)(i.Muted,{children:["Reminder on ",e.orderDays.map(e=>b.DAYS[e]).join(', '),": ",e.reminder]}):null,e.notes?(0,y.jsx)(i.T,{size:f.font.small,colour:f.colours.muted,children:e.notes}):null,e.placeholder?(0,y.jsx)(i.Banner,{kind:"warn",title:"Still to be set up",children:"Add the supplier, how to order and delivery days in Managers \u203a Settings \u203a Supplier order sheets."}):null,e.items.map(e=>(0,y.jsxs)(d.default,{style:{gap:6},children:[(0,y.jsxs)(i.T,{children:[e.name,e.unit?(0,y.jsxs)(i.T,{size:f.font.small,colour:f.colours.muted,children:[" (",(0,l.quantityUnit)(T,e),")"]}):null]}),(0,y.jsxs)(i.Row,{wrap:!0,gap:8,style:{justifyContent:'space-between'},children:[(0,y.jsx)(i.Button,{small:!0,kind:"secondary",label:"Less",accessibilityLabel:`${(0,l.fishInStone)(T,e)?'Half a stone less':'Less'} ${e.name}`,onPress:()=>Q(e,-1),style:{minWidth:44,minHeight:44}}),(0,y.jsx)(d.default,{accessible:!0,accessibilityLabel:(0,l.fishQtySpeech)(T,e,B[e.id]||0),children:(0,y.jsx)(i.T,{weight:"bold",size:20,style:{minWidth:76,textAlign:'center'},children:(0,l.fishInStone)(T,e)?(0,l.fishQtyText)(T,e,B[e.id]||0):B[e.id]||0})}),(0,y.jsx)(i.Button,{small:!0,kind:"secondary",label:"More",accessibilityLabel:`${(0,l.fishInStone)(T,e)?'Half a stone more':'More'} ${e.name}`,testID:`qty-${e.id}`,onPress:()=>Q(e,1),style:{minWidth:44,minHeight:44}})]})]},e.id)),(0,y.jsxs)(d.default,{style:{gap:4},children:[(0,y.jsx)(i.T,{size:f.font.small,weight:"medium",colour:f.colours.muted,children:"Anything else (one line each)"}),(0,y.jsx)(t.TextInput,{value:P,onChangeText:O,multiline:!0,placeholder:"e.g. 2 boxes lemons",placeholderTextColor:f.colours.muted,style:[S,{minHeight:60}]})]}),F?(0,y.jsxs)(d.default,{style:{gap:4},children:[(0,y.jsxs)(i.T,{size:f.font.small,weight:"medium",colour:f.colours.muted,children:['whatsapp'===e.method?'WhatsApp number':'phone'===e.method?'Phone number':'Mobile number',e.number?'':' (blank: fill in once, it is saved)']}),(0,y.jsx)(t.TextInput,{testID:`number-${e.id}`,value:e.number,onChangeText:t=>v(T,e.id,{number:t}),keyboardType:"phone-pad",placeholder:"07\u2026",placeholderTextColor:f.colours.muted,style:S})]}):null,'online'===e.method?(0,y.jsxs)(d.default,{style:{gap:4},children:[(0,y.jsxs)(i.T,{size:f.font.small,weight:"medium",colour:f.colours.muted,children:['Open Coldweb'===e.urlLabel?'Coldweb ordering link':'Website link',e.url?'':' (blank: paste it in once, it is saved)']}),(0,y.jsx)(t.TextInput,{testID:`url-${e.id}`,value:e.url,onChangeText:t=>v(T,e.id,{url:t.trim()}),autoCapitalize:"none",keyboardType:"url",placeholder:"https://\u2026",placeholderTextColor:f.colours.muted,style:S})]}):null,e.priceCapPerKg?(0,y.jsxs)(d.default,{style:{gap:6,padding:10,borderRadius:12,backgroundColor:f.colours.blueBg},children:[(0,y.jsxs)(i.T,{weight:"semibold",colour:"#E2C489",children:["Price cap ",(0,p.gbp)(e.priceCapPerKg),"/kg \xb7 buy from the cheapest UK seller under it"]}),(0,y.jsxs)(i.Muted,{children:["Seller: ",e.seller||'to be chosen']}),(0,y.jsxs)(i.Row,{gap:8,children:[(0,y.jsx)(i.T,{size:f.font.small,style:{flex:1},children:"Price you found (\xa3/kg)"}),(0,y.jsx)(t.TextInput,{testID:"price-found",value:R,onChangeText:A,keyboardType:"decimal-pad",placeholder:"e.g. 22.50",placeholderTextColor:f.colours.muted,style:[S,{width:120}]})]}),G>0?(0,y.jsx)(i.Badge,{kind:G<=e.priceCapPerKg?'ok':'red',label:G<=e.priceCapPerKg?`${(0,p.gbp)(G)}/kg is under the cap \u2713`:`${(0,p.gbp)(G)}/kg is over the ${(0,p.gbp)(e.priceCapPerKg)} cap: look for a cheaper seller`}):null]}):null,'online'!==e.method&&'tbc'!==e.method?(0,y.jsxs)(d.default,{testID:`preview-${e.id}`,style:{padding:10,borderRadius:12,borderWidth:1,borderColor:f.colours.border,backgroundColor:f.colours.surface2},children:[(0,y.jsx)(i.T,{size:12,weight:"semibold",colour:f.colours.gold,children:'phone'===e.method?'READ THIS OUT':'YOUR MESSAGE'}),(0,y.jsx)(i.T,{size:f.font.small,children:K.length?N:'Add quantities above to write the order.'})]}):null,(0,y.jsxs)(i.Row,{wrap:!0,gap:8,children:['text'===e.method?(0,y.jsx)(i.Button,{testID:`send-${e.id}`,kind:"success",label:"\ud83d\udcac Open in Messages",disabled:!K.length,onPress:()=>Y((0,b.smsLink)(e.number,N))}):null,'whatsapp'===e.method?(0,y.jsx)(i.Button,{testID:`send-${e.id}`,kind:"success",label:"Open in WhatsApp",disabled:!K.length,onPress:()=>Y((0,b.waLink)(e.number,N))}):null,'phone'===e.method?(0,y.jsx)(i.Button,{testID:`send-${e.id}`,kind:"success",label:`\ud83d\udcde Call ${e.name}`,disabled:!e.number,onPress:()=>Y((0,b.telLink)(e.number))}):null,'online'===e.method?(0,y.jsx)(i.Button,{testID:`send-${e.id}`,kind:"success",label:`\ud83c\udf10 ${e.urlLabel??'Open website'}`,disabled:!e.url,onPress:()=>Y(e.url)}):null,'online'!==e.method&&'tbc'!==e.method&&K.length?(0,y.jsx)(i.Button,{kind:"ghost",label:z?'Copied \u2713':'Copy order',onPress:async()=>{const e=await w(N);_(e),e&&setTimeout(()=>_(!1),2e3)}}):null]}),'text'===e.method&&!e.number&&K.length?(0,y.jsx)(i.Muted,{children:"No number saved: Messages opens with the order written and asks who to send it to."}):null,'whatsapp'===e.method&&!e.number&&K.length?(0,y.jsx)(i.Muted,{children:"No number saved: WhatsApp opens with the order written and asks who to send it to."}):null,'phone'!==e.method||e.number?null:(0,y.jsx)(i.Muted,{children:"Add the phone number above to call from here."}),'online'!==e.method||e.url?null:(0,y.jsx)(i.Muted,{children:"Add the link above and the button opens it."})]}):null]})}},1168,[827,835,984,34,379,236,402,102,794,1027,983,985,867,1028,821,1145,25]); @@ -1261,7 +1261,7 @@ __d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{ __d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.waNumber=o,_e.waMeLink=function(e,t){const n=o(e);return n?t?`https://wa.me/${n}?text=${encodeURIComponent(t)}`:`https://wa.me/${n}`:null},Object.defineProperty(_e,"guestWhatsAppText",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"staffWhatsAppTexts",{enumerable:!0,get:function(){return p}}),_e.openWhatsApp=async function(e){try{return await n.default.openURL(e),!0}catch{return!1}};var e,t=r(_d[0]),n=(e=t)&&e.__esModule?e:{default:e};function o(e,t="44"){if(!e)return null;let n=String(e).trim().replace(/[\s().\-]/g,'');return n.startsWith('+')?n=n.slice(1):n.startsWith('00')?n=n.slice(2):n.startsWith('0')&&(n=t+n.slice(1)),n=n.replace(/^440/,'44'),/^[1-9][0-9]{6,14}$/.test(n)?n:null}const s=e=>{const[t,n,o]=e.split('-').map(Number);return new Date(t,n-1,o).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long',year:'numeric'})},u=e=>{const[t,n,o]=e.split('-').map(Number);return new Date(t,n-1,o).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'})},c=e=>e.slice(0,5),l=e=>e.replace(' (example)','').trim().split(/\s+/)[0]||'there',m=(e,t)=>`Hi ${t}, it's ${e.name.trim()} about my booking${e.ref?` ${e.ref}`:''}: ${s(e.date)} at ${c(e.time)}, table for ${e.partySize}. `,p=(e,t,n)=>({confirm:`Hi ${l(e.name)}, it's ${t}${n?` in ${n}`:''}. Just confirming your table for ${e.partySize} on ${u(e.date)} at ${c(e.time)}${e.ref?` (ref ${e.ref})`:''}. Any questions, just reply here.`,change:`Hi ${l(e.name)}, it's ${t} about your booking on ${u(e.date)} at ${c(e.time)}. `})},1178,[379]); __d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"payFor",{enumerable:!0,get:function(){return k.payFor}}),Object.defineProperty(_e,"useVenuePay",{enumerable:!0,get:function(){return k.useVenuePay}}),_e.PayTipsSettings=function({go:e}){const{rid:s,today:o}=(0,P.useCtx)(6e4),{pay:r,source:d}=(0,k.useVenuePay)(s),[a,l]=(0,n.useState)(r),[u,c]=(0,n.useState)((0,f.ukDate)(r.tipsAnchorPayday)),[y,x]=(0,n.useState)(null),j=(0,f.parseUk)(u),w=(0,f.cleanPay)({...a,tipsAnchorPayday:j??a.tipsAnchorPayday}),C=JSON.stringify(w)!==JSON.stringify(r)||'settings'!==d,S=(0,f.nextToPay)(w,'tips',o).period,D=(0,f.nextToPay)(w,'wage',o).period,I=(0,f.tipsPeriod)(w,S.start,1),z=(0,f.wagePeriod)(w,D.start,1),H=e=>{l({...a,...e}),x(null)};return(0,v.jsxs)(i.default,{style:{gap:12},testID:"pay-settings",children:['none'===d?(0,v.jsx)(h.Banner,{kind:"warn",title:"Pay dates not set up yet",children:"Set your tips and wage dates here. Until then the app uses calendar months and weekly tips."}):null,'questionnaire'===d?(0,v.jsx)(h.Banner,{kind:"info",title:"From your sign-up answers",children:"These dates came from your questionnaire. Check them and tap Save to make them your venue's pay dates."}):null,(0,v.jsx)(T.SectionHead,{title:"Tips",sub:"How often tips are paid out, and which days each payout covers."}),(0,v.jsxs)(h.Card,{children:[(0,v.jsx)(h.T,{weight:"semibold",children:"How often"}),(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:['weekly','fortnightly','monthly'].map(e=>(0,v.jsx)(h.Chip,{label:M[e],selected:a.tipsFrequency===e,onPress:()=>H({tipsFrequency:e})},e))}),(0,v.jsx)(h.Field,{label:"Next tips payday (DD/MM/YYYY)",value:u,onChangeText:e=>{c((0,t.slashDate)(e,u)),x(null)},maxLength:10,placeholder:"02/11/2026",keyboardType:"numbers-and-punctuation"}),j?(0,v.jsxs)(h.Muted,{children:[(0,f.dayMonth)(j)," ",j.slice(0,4)]}):(0,v.jsx)(h.T,{size:13,colour:b.colours.red,children:"Enter a date like 02/11/2026"}),(0,v.jsx)(h.T,{weight:"semibold",children:"Each tips period ends"}),(0,v.jsxs)(h.Row,{children:[(0,v.jsx)(h.Stepper,{label:"days before payday",value:a.tipsEndsDaysBefore,min:0,max:13,onChange:e=>H({tipsEndsDaysBefore:e})}),(0,v.jsx)(h.Muted,{style:{flex:1},children:0===a.tipsEndsDaysBefore?'on payday':1===a.tipsEndsDaysBefore?'day before payday (a Monday payday covers up to the Sunday)':'days before payday'})]})]}),(0,v.jsx)(T.SectionHead,{title:"Wages",sub:"Monthly pay: the cut-off starts each pay period."}),(0,v.jsxs)(h.Card,{children:[(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(h.T,{weight:"semibold",style:{flex:1},children:"Pay day of the month"}),(0,v.jsx)(h.Stepper,{label:"pay day",value:a.wagePayDay,min:1,max:31,onChange:e=>H({wagePayDay:e})})]}),(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(h.T,{weight:"semibold",style:{flex:1},children:"Cut-off (first day of each period)"}),(0,v.jsx)(h.Stepper,{label:"cut-off day",value:a.wageCutoffDay,min:1,max:28,onChange:e=>H({wageCutoffDay:e})})]}),(0,v.jsxs)(h.Muted,{children:["Period runs the ",B(a.wageCutoffDay)," to the ",B(1===a.wageCutoffDay?31:a.wageCutoffDay-1),1===a.wageCutoffDay?' (end of the month)':' of the next month',". A pay day past the month end uses the last day."]}),(0,v.jsx)(h.T,{weight:"semibold",children:"A pay day on a weekend"}),(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:['none','before','after'].map(e=>(0,v.jsx)(h.Chip,{label:$[e],selected:(a.weekendRule??'none')===e,onPress:()=>H({weekendRule:e})},e))})]}),(0,v.jsx)(T.SectionHead,{title:"Preview"}),(0,v.jsxs)(h.Card,{highlight:b.colours.gold,children:[(0,v.jsx)(R,{label:"Next tips payday",day:S.payday,period:S}),(0,v.jsx)(R,{label:"Then",day:I.payday,period:I}),(0,v.jsx)(i.default,{style:{height:1,backgroundColor:b.colours.border}}),(0,v.jsx)(R,{label:"Next payday",day:D.payday,period:D}),(0,v.jsx)(R,{label:"Then",day:z.payday,period:z})]}),(0,v.jsx)(h.Button,{kind:"success",label:'settings'===d?'Save pay dates':'Save as our pay dates',disabled:!j||!C,testID:"save-pay",onPress:()=>{p.useStore.getState().updateSettings(s,{pay:w}),x('Saved. Everyone in the venue sees these dates.')}}),y?(0,v.jsx)(h.Banner,{kind:"success",title:y}):null,(0,v.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,v.jsx)(h.Button,{small:!0,kind:"secondary",label:"Payroll hours",onPress:()=>e('more','hours')}),(0,v.jsx)(h.Button,{small:!0,kind:"secondary",label:"Tips day",onPress:()=>e('more','tipsday')})]})]})},_e.hoursIn=z,Object.defineProperty(_e,"toTsv",{enumerable:!0,get:function(){return N}}),Object.defineProperty(_e,"toCsv",{enumerable:!0,get:function(){return F}}),_e.summaryTable=V,_e.detailTable=E,_e.copyText=Y,_e.periodOptions=G,_e.PayrollHours=function({go:e}){const{rid:s,today:t,now:r,r:p,me:w,meId:T,role:M}=(0,P.useCtx)(6e4),$=(0,C.canSeeHoursEdit)({role:M,isCar:S.IS_CAR}),[B,R]=(0,n.useState)(!1),{pay:I,source:A}=(0,k.useVenuePay)(s),W=(0,y.useOwner)(e=>e.staff),L=(0,y.useOwner)(e=>(0,y.liveAttendance)(e.attendance)),q=(0,P.useHourly)(),J=(0,a.default)().width<700,[K,Q]=(0,n.useState)(null),[X,Z]=(0,n.useState)(null),ee=e=>{const s=y.useOwner.getState().confirmEntries([e.id],w,T,(new Date).toISOString());we(s?'Approved. It now counts in the hours and pay.':'Nothing to approve.')},se=e=>(0,v.jsxs)(i.default,{style:{gap:8,marginBottom:8},testID:`daily-${e.person.id}`,children:[e.days.map(e=>(0,v.jsx)(u.ShiftCard,{d:e,manager:!0,onApprove:()=>ee(e.a),onEdit:()=>Q(e.a),onRemove:()=>Z(e.a)},e.a.id)),e.days.length?null:(0,v.jsx)(h.Muted,{center:!0,children:"No clocked shifts in this period."})]}),te=(0,n.useMemo)(()=>G(I,t),[I,t]),[oe,ne]=(0,n.useState)('wage'),[re,de]=(0,n.useState)(null),[ae,ie]=(0,n.useState)(!1),[le,ue]=(0,n.useState)({}),[ce,he]=(0,n.useState)(null),pe='custom'===oe&&re?re:(te.find(e=>e.id===oe)??te[0]).period,ye=(0,n.useMemo)(()=>z(pe,W,L,r,q),[pe.key,W,L,q,Math.floor(r.getTime()/6e4)]),ge=ye.some(e=>null!=e.rate),xe='tips'===pe.kind,fe=ye.reduce((e,s)=>({c:e.c+s.confirmed,p:e.p+s.pending,s:e.s+s.shifts,g:e.g+(s.gross??0)}),{c:0,p:0,s:0,g:0}),me=ye.filter(e=>e.pending>0).length,be=`${p.name}: hours ${(0,f.rangeText)(pe.start,pe.end)}`,je=`hours-${pe.start}-to-${pe.end}`,we=e=>{he(e),setTimeout(()=>he(null),6e3)};return(0,v.jsxs)(i.default,{style:{gap:10},testID:"payroll-hours",children:['none'===A?(0,v.jsxs)(h.Banner,{kind:"warn",title:"Pay dates not set up",children:[(0,v.jsx)(h.Muted,{children:"Using calendar months for now."}),(0,v.jsx)(h.Button,{small:!0,kind:"ghost",label:"Set your pay dates \u203a",onPress:()=>e('more','paysettings')})]}):null,(0,v.jsxs)(h.Row,{wrap:!0,gap:6,children:[te.map(e=>(0,v.jsx)(h.Chip,{label:e.label,sub:e.sub,selected:oe===e.id,onPress:()=>{ne(e.id),ie(!1)}},e.id)),(0,v.jsx)(h.Chip,{label:"Custom dates",sub:re&&'custom'===oe?(0,f.rangeText)(re.start,re.end):'Pick any range',selected:'custom'===oe,onPress:()=>ie(!ae)})]}),ae?(0,v.jsx)(U,{onSet:e=>{de(e),ne('custom'),ie(!1)}}):null,(0,v.jsx)(h.Card,{highlight:b.colours.gold,children:(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,v.jsxs)(i.default,{style:{flexShrink:1,minWidth:0},children:[(0,v.jsxs)(h.T,{weight:"bold",size:18,children:[(0,f.rangeText)(pe.start,pe.end)," ",pe.end.slice(0,4)]}),(0,v.jsxs)(h.Muted,{children:[(0,f.ukDate)(pe.start)," to ",(0,f.ukDate)(pe.end),pe.payday?` \xb7 ${pe.payday>=t?'pays':'paid'} ${(0,f.dayMonth)(pe.payday)}`:'',xe?' \xb7 tips period':'wage'===pe.kind?' \xb7 wage period':'']})]}),(0,v.jsxs)(i.default,{style:{alignItems:'flex-end'},children:[(0,v.jsx)(h.T,{size:22,weight:"bold",colour:b.colours.gold,children:(0,l.durText)(fe.c)}),(0,v.jsxs)(h.Muted,{children:["approved",fe.p?` \xb7 ${(0,l.durText)(fe.p)} pending`:'']})]})]})}),$?(0,v.jsx)(i.default,{style:{alignItems:'center'},children:(0,v.jsx)(h.Button,{testID:"add-past-shift",label:"Add past shift",accessibilityLabel:"Add past shift",onPress:()=>R(!0),style:{minHeight:48,minWidth:180}})}):null,me?(0,v.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:"Sign off pending hours",onPress:()=>e('more','signoff'),testID:"pending-banner",children:(0,v.jsxs)(i.default,{style:{backgroundColor:b.colours.amberBg,borderRadius:12,padding:12,borderLeftWidth:6,borderLeftColor:b.colours.amber,gap:4},children:[(0,v.jsxs)(h.T,{weight:"bold",colour:b.colours.amber,children:["\u26a0 ",(0,l.durText)(fe.p)," still waiting for approval (",me," ",1===me?'person':'people',")"]}),(0,v.jsx)(h.T,{size:14,children:"Pending hours are not in the totals or the exports' confirmed columns. Sign them off first so everyone is paid in full."}),(0,v.jsx)(h.T,{weight:"semibold",colour:b.colours.gold,children:"Sign off hours \u203a"})]})}):(0,v.jsx)(h.Banner,{kind:"success",title:"All hours in this period are signed off"}),(0,v.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,v.jsx)(h.Button,{small:!0,kind:"success",label:"Copy for spreadsheet",testID:"copy-tsv",onPress:async()=>{const e=await Y(N(V(ye,pe,ge,xe)));we(e?`Copied ${ye.length} rows. Paste into the first cell of your spreadsheet.`:'Copy is not available here. Use Download CSV.')}}),(0,v.jsx)(h.Button,{small:!0,kind:"secondary",label:"Download CSV",onPress:()=>{(0,j.downloadText)(`${je}.csv`,F(V(ye,pe,ge,xe))),we('CSV downloaded (summary).')}}),(0,v.jsx)(h.Button,{small:!0,kind:"secondary",label:"Download CSV (daily detail)",onPress:()=>{(0,j.downloadText)(`${je}-daily.csv`,F(E(ye))),we('CSV downloaded (one line per shift).')}}),(0,v.jsx)(h.Button,{small:!0,kind:"secondary",label:"Print / PDF",onPress:()=>{const e=V(ye,pe,ge,xe);(0,j.printTable)(be,`${(0,f.ukDate)(pe.start)} to ${(0,f.ukDate)(pe.end)} \xb7 confirmed hours only in the totals \xb7 printed ${(0,f.ukDate)(t)}`,e[0],e.slice(1))}})]}),ce?(0,v.jsx)(h.Banner,{kind:"success",title:ce}):null,J?(0,v.jsxs)(i.default,{testID:"hours-table",style:{gap:10},children:[ye.map(e=>{const s=!!le[e.person.id];return(0,v.jsxs)(i.default,{style:{borderRadius:16,borderWidth:1,borderColor:'rgba(212,175,106,0.45)',backgroundColor:b.colours.surface,padding:12,gap:10},children:[(0,v.jsx)(u.HoursSummaryCard,{name:O(e.person),role:H(e.person),approved:e.confirmed,pending:e.pending,rate:e.rate}),(0,v.jsx)(h.Button,{kind:"secondary",testID:`hours-open-${e.person.id}`,label:s?'Hide shifts':`Show ${e.days.length} ${1===e.days.length?'shift':'shifts'}`,accessibilityLabel:`${s?'Hide':'Show'} ${O(e.person)}'s shifts`,onPress:()=>ue({...le,[e.person.id]:!s}),style:{minHeight:48}}),s?se(e):null]},e.person.id)}),(0,v.jsxs)(h.Muted,{center:!0,children:["Total: ",(0,l.durText)(fe.c)," approved",ge?` \xb7 ${(0,x.gbp)(fe.g)} gross`:'',fe.p?` \xb7 ${(0,l.durText)(fe.p)} pending`:'']})]}):(0,v.jsx)(o.WideTable,{children:(0,v.jsxs)(i.default,{testID:"hours-table",children:[(0,v.jsx)(o.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:b.colours.border,paddingBottom:4},children:['Name','Shifts','Approved','Pending',xe?'Tips h':'Hours',ge?'Rate':'',ge?'Gross':''].map((e,s)=>(0,v.jsx)(h.T,{size:12,weight:"semibold",colour:b.colours.gold,style:{width:_[s]},children:e},s))}),ye.map(e=>{const s=!!le[e.person.id];return(0,v.jsxs)(i.default,{style:{borderBottomWidth:1,borderColor:'#222'},children:[(0,v.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:`${O(e.person)} daily hours`,onPress:()=>ue({...le,[e.person.id]:!s}),style:{paddingVertical:7},children:(0,v.jsxs)(o.TRow,{heads:['Name','Shifts','Approved','Pending',xe?'Tips h':'Hours',ge?'Rate':'',ge?'Gross':''],children:[(0,v.jsxs)(i.default,{style:{width:_[0]},children:[(0,v.jsxs)(h.T,{size:14,weight:"semibold",numberOfLines:1,children:[s?'\u25be':'\u25b8'," ",O(e.person)]}),(0,v.jsx)(h.Muted,{children:H(e.person)})]}),(0,v.jsx)(h.T,{size:14,style:{width:_[1]},children:e.shifts}),(0,v.jsx)(h.T,{size:14,weight:"semibold",style:{width:_[2]},children:(0,l.durText)(e.confirmed)}),(0,v.jsx)(h.T,{size:14,weight:e.pending?'bold':'regular',colour:e.pending?b.colours.amber:b.colours.muted,style:{width:_[3]},children:e.pending?`\u26a0 ${(0,l.durText)(e.pending)}`:'0m'}),(0,v.jsx)(h.T,{size:14,style:{width:_[4]},children:xe?(0,f.decH)(e.confirmed):(0,l.durText)(e.confirmed)}),(0,v.jsx)(h.T,{size:14,colour:b.colours.muted,style:{width:_[5]},children:ge?null!=e.rate?(0,x.gbp)(e.rate):'\u2013':''}),(0,v.jsxs)(h.T,{size:14,weight:"semibold",style:{width:_[6]},children:[ge?null!=e.gross?(0,x.gbp)(e.gross):'\u2013':'',ge&&null!=e.rate&&e.pending?(0,v.jsx)(h.T,{size:12,colour:b.colours.amber,children:`\n+ ${(0,x.gbp)(Math.round(e.pending/60*e.rate))} pending`}):null]})]})}),s?se(e):null]},e.person.id)}),(0,v.jsxs)(o.TRow,{heads:['','Shifts','Approved','Pending',xe?'Tips h':'Hours','',ge?'Gross':''],style:{paddingVertical:8,borderTopWidth:2,borderColor:b.colours.gold},children:[(0,v.jsxs)(h.T,{size:14,weight:"bold",style:{width:_[0]},children:["Total (",ye.length,")"]}),(0,v.jsx)(h.T,{size:14,weight:"bold",style:{width:_[1]},children:fe.s}),(0,v.jsx)(h.T,{size:14,weight:"bold",colour:b.colours.gold,style:{width:_[2]},children:(0,l.durText)(fe.c)}),(0,v.jsx)(h.T,{size:14,weight:"bold",colour:fe.p?b.colours.amber:b.colours.muted,style:{width:_[3]},children:(0,l.durText)(fe.p)}),(0,v.jsx)(h.T,{size:14,weight:"bold",style:{width:_[4]},children:xe?(0,f.decH)(fe.c):(0,l.durText)(fe.c)}),(0,v.jsx)(h.T,{size:14,style:{width:_[5]},children:" "}),(0,v.jsx)(h.T,{size:14,weight:"bold",style:{width:_[6]},children:ge?(0,x.gbp)(fe.g):''})]})]})}),K?(0,v.jsx)(c.OverrideSheet,{a:K,staffId:K.staffId,date:K.date,onClose:()=>Q(null)}):null,X?(0,v.jsx)(u.RemoveShiftSheet,{a:X,who:{name:w,id:T},onClose:()=>{Z(null),we('Removed from hours. It is kept in the history.')}}):null,B?(0,v.jsx)(D.AddPastShiftSheet,{onClose:()=>R(!1),onSaved:()=>{R(!1),we('Saved. It counts in the hours and pay.')}}):null,(0,v.jsxs)(h.Muted,{children:["Tap a name for each day. Hours read 37h 30m. The export also has decimal hours (37.50) and h:mm for your spreadsheet. Paid hours = clock out \u2212 clock in \u2212 break. ",ge?'Gross is before tax, from confirmed hours only.':'Rates and gross show once you sign in with your personal link.']}),xe?(0,v.jsx)(h.Button,{kind:"success",label:"Tips day: split tips for this period \u203a",onPress:()=>e('more','tipsday')}):null]})},_e.TipsDay=function({go:e}){const{rid:t,today:r,now:a}=(0,P.useCtx)(6e4),{pay:u,source:c}=(0,k.useVenuePay)(t),p=(0,y.useOwner)(e=>e.staff),T=(0,y.useOwner)(e=>(0,y.liveAttendance)(e.attendance)),C=(0,y.useOwner)(e=>e.tronc),S=(0,f.nextToPay)(u,'tips',r),[D,M]=(0,n.useState)(0),$=(0,f.tipsPeriod)(u,S.period.start,D),[B,R]=(0,n.useState)(''),[I,W]=(0,n.useState)({}),[L,V]=(0,n.useState)(null),E=(0,n.useMemo)(()=>z($,p,T,a,{}),[$.key,p,T]),G=e=>'owner'===e.role&&!C.includeOwner||'manager'===e.role&&!C.includeManagers,U=e=>I[e.id]??G(e),_=E.filter(e=>e.confirmed>0||e.pending>0),q=Math.round(100*Number(B.replace(/[\xa3,\s]/g,''))),J=Number.isFinite(q)&&q>0&&q<=1e8&&/^\s*\xa3?\s*[\d,]+(\.\d{0,2})?\s*$/.test(B),K=_.filter(e=>!U(e.person)&&e.confirmed>0),{amounts:Q}=(0,w.allocate)(J?q:0,K.map(e=>e.confirmed)),X={};K.forEach((e,s)=>{X[e.person.id]=Q[s]});const Z=K.reduce((e,s)=>e+s.confirmed,0),ee=Object.values(X).reduce((e,s)=>e+s,0),se=_.filter(e=>e.pending>0&&!U(e.person)),te=se.reduce((e,s)=>e+s.pending,0),oe=()=>[['Name','Role','Period start','Period end','Payday','Confirmed hours','Confirmed h:mm','Share %','Tips \xa3'],..._.map(e=>{const s=!U(e.person)&&e.confirmed>0;return[O(e.person),H(e.person),(0,f.ukDate)($.start),(0,f.ukDate)($.end),$.payday?(0,f.ukDate)($.payday):'',(0,f.decH)(e.confirmed),(0,f.hMm)(e.confirmed),s&&Z?(e.confirmed/Z*100).toFixed(2):'0.00',s?A(X[e.person.id]??0):U(e.person)?'excluded':'0.00']}),['TOTAL','',(0,f.ukDate)($.start),(0,f.ukDate)($.end),$.payday?(0,f.ukDate)($.payday):'',(0,f.decH)(Z),(0,f.hMm)(Z),Z?'100.00':'0.00',A(ee)]],ne=e=>{V(e),setTimeout(()=>V(null),6e3)};return(0,v.jsxs)(i.default,{style:{gap:10},testID:"tips-day",children:[(0,v.jsx)(h.Banner,{kind:"info",title:"Saving payouts and notifying staff are coming next",children:"For now this works out the split and exports it. Nothing is saved to the team, sent or paid."}),'none'===c?(0,v.jsxs)(h.Banner,{kind:"warn",title:"Tips dates not set up",children:[(0,v.jsx)(h.Muted,{children:"Using weekly tips for now."}),(0,v.jsx)(h.Button,{small:!0,kind:"ghost",label:"Set your pay dates \u203a",onPress:()=>e('more','paysettings')})]}):null,(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(h.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",disabled:D<=-6,onPress:()=>M(D-1)}),(0,v.jsxs)(i.default,{style:{alignItems:'center',flex:1},children:[(0,v.jsx)(h.T,{weight:"bold",size:18,children:(0,f.rangeText)($.start,$.end)}),(0,v.jsxs)(h.Muted,{children:[(0,f.ukDate)($.start)," to ",(0,f.ukDate)($.end)," \xb7 ",$.payday>=r?'paid':'was paid'," ",(0,f.dayMonth)($.payday)]}),0===D?(0,v.jsx)(h.Badge,{kind:"gold",label:"Paid next"}):null]}),(0,v.jsx)(h.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:D>=1,onPress:()=>M(D+1)})]}),(0,v.jsxs)(h.Card,{highlight:b.colours.gold,children:[(0,v.jsx)(h.T,{weight:"semibold",children:"Total tips to share"}),(0,v.jsxs)(h.Row,{style:{alignItems:'center'},children:[(0,v.jsx)(h.T,{size:28,weight:"bold",colour:b.colours.gold,children:"\xa3"}),(0,v.jsx)(s.TextInput,{testID:"tips-total",accessibilityLabel:"Total tips in pounds",value:B,onChangeText:R,placeholder:"0.00",placeholderTextColor:"#7D776C",keyboardType:"decimal-pad",style:[h.styles.input,{flex:1,fontSize:26,fontWeight:'700'}]})]}),B&&!J?(0,v.jsx)(h.T,{size:13,colour:b.colours.red,children:"Enter an amount like 1250.00"}):(0,v.jsx)(h.Muted,{children:"Shared by confirmed hours: share = total \xd7 (their hours \xf7 everyone's hours). Rounded to the penny; leftover pennies go to the largest shares so it adds up exactly."})]}),se.length?(0,v.jsx)(d.default,{accessibilityRole:"button",onPress:()=>e('more','signoff'),testID:"tips-pending",children:(0,v.jsxs)(i.default,{style:{backgroundColor:b.colours.redBg,borderRadius:12,padding:12,borderLeftWidth:6,borderLeftColor:b.colours.red,gap:4},children:[(0,v.jsxs)(h.T,{weight:"bold",colour:b.colours.red,children:["\u26a0 Don't pay out yet: ",(0,l.durText)(te)," not approved yet"]}),(0,v.jsxs)(h.T,{size:14,children:[se.map(e=>`${O(e.person)} (${(0,l.durText)(e.pending)})`).join(', '),". Pending hours are left out of the split, so these people would get less than they should."]}),(0,v.jsx)(h.T,{weight:"semibold",colour:b.colours.gold,children:"Sign off hours \u203a"})]})}):_.length?(0,v.jsx)(h.Banner,{kind:"success",title:"All hours in this fortnight are signed off"}):null,(0,v.jsx)(o.WideTable,{children:(0,v.jsxs)(i.default,{testID:"tips-table",children:[(0,v.jsx)(o.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:b.colours.border,paddingBottom:4},children:['Include','Name','Confirmed','Share','Tips'].map((e,s)=>(0,v.jsx)(h.T,{size:12,weight:"semibold",colour:b.colours.gold,style:{width:[64,150,100,64,84][s]},children:e},e))}),_.map(e=>{const s=U(e.person),t=X[e.person.id]??0;return(0,v.jsxs)(o.TRow,{heads:['Include','Name','Confirmed','Share','Tips'],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222',opacity:s?.5:1},children:[(0,v.jsx)(d.default,{accessibilityRole:"checkbox",accessibilityState:{checked:!s},accessibilityLabel:`Include ${O(e.person)}`,onPress:()=>W({...I,[e.person.id]:!s}),style:{width:64,minHeight:44,justifyContent:'center'},children:(0,v.jsx)(i.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:s?b.colours.muted:b.colours.ok,backgroundColor:s?'transparent':b.colours.okBg,alignItems:'center',justifyContent:'center'},children:(0,v.jsx)(h.T,{size:14,colour:b.colours.ok,children:s?'':'\u2713'})})}),(0,v.jsxs)(i.default,{style:{width:150},children:[(0,v.jsx)(h.T,{size:14,weight:"semibold",numberOfLines:1,children:O(e.person)}),(0,v.jsxs)(h.Muted,{numberOfLines:1,children:[s?'Excluded':H(e.person),e.pending?` \xb7 \u26a0 ${(0,f.decH)(e.pending)} h pending`:'']})]}),(0,v.jsxs)(h.T,{size:14,style:{width:80},children:[(0,f.decH)(e.confirmed)," h"]}),(0,v.jsx)(h.T,{size:14,colour:b.colours.muted,style:{width:64},children:!s&&Z?`${(e.confirmed/Z*100).toFixed(1)}%`:'\u2013'}),(0,v.jsx)(h.T,{size:15,weight:"bold",colour:s?b.colours.muted:b.colours.gold,style:{width:84},children:s?'\u2013':(0,x.gbp)(t)})]},e.person.id)}),(0,v.jsxs)(o.TRow,{heads:['','','Confirmed','Share','Tips'],style:{paddingVertical:8,borderTopWidth:2,borderColor:b.colours.gold},children:[(0,v.jsx)(h.T,{size:14,style:{width:64},children:" "}),(0,v.jsxs)(h.T,{size:14,weight:"bold",style:{width:150},children:["Total (",K.length," people)"]}),(0,v.jsxs)(h.T,{size:14,weight:"bold",style:{width:80},children:[(0,f.decH)(Z)," h"]}),(0,v.jsx)(h.T,{size:14,style:{width:64},children:Z?'100%':'\u2013'}),(0,v.jsx)(h.T,{size:15,weight:"bold",colour:J&&ee===q?b.colours.ok:b.colours.text,style:{width:84},children:(0,x.gbp)(ee)})]})]})}),_.length?null:(0,v.jsx)(h.Muted,{children:"No clocked hours in this fortnight yet."}),J&&Z?(0,v.jsxs)(h.Muted,{children:["Check: ",K.length," shares add up to ",(0,x.gbp)(ee)," of ",(0,x.gbp)(q)," ",ee===q?'\u2713':'',". \xa3",(q/100/(Z/60)).toFixed(4)," per confirmed hour."]}):null,(0,v.jsxs)(h.Muted,{children:["Owner ",C.includeOwner?'included':'left out'," and managers ",C.includeManagers?'included':'left out'," by default (your tipping policy in Tips). Tick or untick anyone for this split."]}),(0,v.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,v.jsx)(h.Button,{small:!0,kind:"success",label:"Copy for spreadsheet",testID:"tips-copy",disabled:!J,onPress:async()=>{const e=await Y(N(oe()));ne(e?'Copied. Paste into the first cell of your spreadsheet.':'Copy is not available here. Use Download CSV.')}}),(0,v.jsx)(h.Button,{small:!0,kind:"secondary",label:"Download CSV",disabled:!J,onPress:()=>{(0,j.downloadText)(`tips-${$.start}-to-${$.end}.csv`,F(oe())),ne('CSV downloaded.')}}),(0,v.jsx)(h.Button,{small:!0,kind:"secondary",label:"Print / PDF",disabled:!J,onPress:()=>{const e=oe();(0,j.printTable)(`Tips ${(0,f.rangeText)($.start,$.end)} (paid ${(0,f.dayMonth)($.payday)})`,`Total ${(0,x.gbp)(q)} shared by confirmed hours${se.length?` \xb7 WARNING ${(0,f.decH)(te)} h not signed off`:''}`,e[0],e.slice(1))}})]}),L?(0,v.jsx)(h.Banner,{kind:"success",title:L}):null]})},_e.PaydaysCard=function({go:e}){const{rid:s,today:t}=(0,P.useCtx)(6e4),{pay:o,source:n}=(0,k.useVenuePay)(s),d=(0,f.nextToPay)(o,'tips',t).period,a=(0,f.nextToPay)(o,'wage',t).period;return(0,v.jsxs)(i.default,{testID:"paydays-card",style:{backgroundColor:b.colours.surface,borderRadius:16,borderWidth:1,borderColor:b.colours.hairline,padding:16,gap:8},children:[(0,v.jsx)(r.CardHeading,{right:'none'===n?(0,v.jsx)(h.Badge,{kind:"amber",label:"Not set up"}):null,children:"Paydays"}),(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,v.jsxs)(h.T,{children:["Next tips payday: ",(0,v.jsx)(h.T,{weight:"semibold",colour:b.colours.goldLight,children:d.payday===t?'today':(0,f.dayMonth)(d.payday)})]}),(0,v.jsx)(h.Muted,{children:(0,f.rangeText)(d.start,d.end)})]}),(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,v.jsxs)(h.T,{children:["Next payday: ",(0,v.jsx)(h.T,{weight:"semibold",colour:b.colours.goldLight,children:a.payday===t?'today':(0,f.dayMonth)(a.payday)})]}),(0,v.jsxs)(h.Muted,{children:["period ",(0,f.rangeText)(a.start,a.end)]})]}),(0,v.jsxs)(r.ActionGrid,{testID:"paydays-actions",children:[(0,v.jsx)(r.ActionTile,{primary:!0,icon:"payroll",label:"Payroll hours",sub:"Copy or export",onPress:()=>e('more','hours'),testID:"paydays-hours"}),(0,v.jsx)(r.ActionTile,{icon:"tips",label:"Tips day",sub:"Share out tips",onPress:()=>e('more','tipsday'),testID:"paydays-tips"})]}),'settings'!==n?(0,v.jsx)(h.Button,{small:!0,kind:"ghost",label:"Pay & tips settings",onPress:()=>e('more','paysettings'),style:{alignSelf:'flex-start'}}):null]})},_e.MyPeriods=function({staffId:e}){const{rid:s,today:t,now:o,meId:n}=(0,P.useCtx)(6e4),r=e??n,{pay:d}=(0,k.useVenuePay)(s),a=(0,y.useOwner)(e=>(0,y.liveAttendance)(e.attendance)),u=(0,y.useOwner)(e=>e.staff.find(e=>e.id===r)),c=(0,f.wagePeriod)(d,t,0),p=(0,f.tipsPeriod)(d,t,0),x=e=>u?z(e,[u],a,o,{})[0]??null:null,j=(e,s,o)=>(0,v.jsxs)(i.default,{style:{flexGrow:1,flexBasis:160,backgroundColor:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.border,padding:12,gap:2},children:[(0,v.jsx)(h.T,{size:13,weight:"semibold",colour:b.colours.gold,children:e.toUpperCase()}),(0,v.jsxs)(h.Muted,{children:[(0,f.rangeText)(s.start,s.end)," \xb7 ",s.payday>=t?'paid':'was paid'," ",(0,f.dayMonth)(s.payday)]}),(0,v.jsx)(h.T,{size:24,weight:"bold",children:(0,l.durText)(o?.confirmed??0)}),(0,v.jsxs)(h.Muted,{children:["approved \xb7 ",o?.shifts??0," shifts"]}),o?.pending?(0,v.jsxs)(h.T,{size:13,colour:b.colours.amber,children:["+ ",(0,l.durText)(o.pending)," waiting for approval"]}):null]},e);return(0,v.jsx)(h.Row,{wrap:!0,gap:8,style:{alignItems:'stretch'},children:[j('This pay period',c,x(c)),j('This tips fortnight',p,x(p))]})};var s=_r(_d[0]),t=_r(_d[1]),o=_r(_d[2]),n=_r(_d[3]),r=_r(_d[4]);_r(_d[5]);var d=e(_r(_d[6])),a=e(_r(_d[7])),i=e(_r(_d[8])),l=_r(_d[9]),u=_r(_d[10]),c=_r(_d[11]),h=_r(_d[12]),p=_r(_d[13]),y=_r(_d[14]),x=_r(_d[15]),f=_r(_d[16]),b=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),T=_r(_d[20]),P=_r(_d[21]),k=_r(_d[22]),C=_r(_d[23]),S=_r(_d[24]),D=_r(_d[25]),v=_r(_d[26]);const M={weekly:'Weekly',fortnightly:'Fortnightly',monthly:'Monthly'},$={none:'Keep the date',before:'Friday before',after:'Monday after'};const B=e=>`${e}${e%10==1&&11!==e?'st':e%10==2&&12!==e?'nd':e%10==3&&13!==e?'rd':'th'}`;function R({label:e,day:s,period:t}){return(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,v.jsxs)(h.T,{children:[e,": ",(0,v.jsx)(h.T,{weight:"bold",colour:b.colours.gold,children:(0,f.dayMonth)(s)})]}),(0,v.jsx)(h.Muted,{children:(0,f.rangeText)(t.start,t.end)})]})}const I=e=>{if(!e)return'';const s=new Date(e);return`${String(s.getHours()).padStart(2,'0')}:${String(s.getMinutes()).padStart(2,'0')}`};function z(e,s,t,o,n){const r=t.filter(s=>s.in&&s.date>=e.start&&s.date<=e.end);return s.map(e=>{const s=r.filter(s=>s.staffId===e.id).sort((e,s)=>e.date.localeCompare(s.date)||(e.in??'').localeCompare(s.in??'')).map(e=>{const s=(0,P.paidMins)(e,o),t=(0,y.attStatus)(e);return{a:e,date:e.date,inT:I(e.in),outT:I(e.out),brk:s.brk,paid:s.paid,status:'open'===t?'On now':'awaiting'===t?'Pending':'Confirmed'}}),t=e=>s.filter(s=>s.status===e).reduce((e,s)=>e+s.paid,0),d=t('Confirmed'),a=n[e.id];return{person:e,confirmed:d,pending:t('Pending'),open:t('On now'),shifts:s.filter(e=>'On now'!==e.status).length,days:s,rate:a,gross:null!=a?Math.round(d/60*a):void 0}}).filter(e=>e.days.length>0||e.person.active&&'owner'!==e.person.role)}const H=e=>`${y.ROLE_LABEL[e.role]}${e.job?` \xb7 ${e.job}`:''}`,O=e=>e.name.replace(' (example)',''),A=e=>null==e?'':(e/100).toFixed(2),W=e=>e.replace(/[\t\r\n]+/g,' '),L=e=>/[",\n]/.test(e)?`"${e.replace(/"/g,'""')}"`:e,N=e=>e.map(e=>e.map(W).join('\t')).join('\n'),F=e=>e.map(e=>e.map(L).join(',')).join('\r\n');function V(e,s,t,o){const n=['Name','Role','Period start','Period end','Confirmed hours','Confirmed h:mm','Pending hours','Pending h:mm','Shifts',...o?['Tips hours']:[],...t?['Rate \xa3/h','Gross \xa3']:[]],r=e.map(e=>[O(e.person),H(e.person),(0,f.ukDate)(s.start),(0,f.ukDate)(s.end),(0,f.decH)(e.confirmed),(0,f.hMm)(e.confirmed),(0,f.decH)(e.pending),(0,f.hMm)(e.pending),String(e.shifts),...o?[(0,f.decH)(e.confirmed)]:[],...t?[A(e.rate),A(e.gross)]:[]]),d=e.reduce((e,s)=>({c:e.c+s.confirmed,p:e.p+s.pending,s:e.s+s.shifts,g:e.g+(s.gross??0)}),{c:0,p:0,s:0,g:0});return[n,...r,['TOTAL','',(0,f.ukDate)(s.start),(0,f.ukDate)(s.end),(0,f.decH)(d.c),(0,f.hMm)(d.c),(0,f.decH)(d.p),(0,f.hMm)(d.p),String(d.s),...o?[(0,f.decH)(d.c)]:[],...t?['',A(d.g)]:[]]]}function E(e){return[['Name','Role','Date','In','Out','Break mins','Paid hours','Paid h:mm','Status'],...e.flatMap(e=>e.days.map(s=>[O(e.person),H(e.person),(0,f.ukDate)(s.date),s.inT,s.outT,'On now'===s.status?'':String(s.brk),'On now'===s.status?'':(0,f.decH)(s.paid),'On now'===s.status?'':(0,f.hMm)(s.paid),s.status]))]}async function Y(e){if('undefined'==typeof document)return!1;try{if(navigator.clipboard?.writeText)return await navigator.clipboard.writeText(e),!0}catch{}try{const s=document.createElement('textarea');s.value=e,s.style.position='fixed',s.style.opacity='0',document.body.appendChild(s),s.select();const t=document.execCommand('copy');return s.remove(),t}catch{return!1}}function G(e,s){const t=(0,f.nextToPay)(e,'wage',s),o=(0,f.nextToPay)(e,'tips',s),n=(0,f.wagePeriod)(e,t.period.start,-1),r=(0,f.tipsPeriod)(e,o.period.start,-1),d=e=>e.payday>=s?e.payday===s?'Pays today':`Pays ${(0,f.dayMonth)(e.payday)}`:`Paid ${(0,f.dayMonth)(e.payday)}`;return[{id:'wage',label:`Wages ${(0,f.rangeText)(t.period.start,t.period.end)}`,sub:d(t.period),period:t.period},{id:'wagePrev',label:`Wages ${(0,f.rangeText)(n.start,n.end)}`,sub:d(n),period:n},{id:'tips',label:`Tips ${(0,f.rangeText)(o.period.start,o.period.end)}`,sub:d(o.period),period:o.period},{id:'tipsPrev',label:`Tips ${(0,f.rangeText)(r.start,r.end)}`,sub:d(r),period:r}]}function U({onSet:e}){const[s,o]=(0,n.useState)(''),[r,d]=(0,n.useState)(''),a=(0,f.parseUk)(s),l=(0,f.parseUk)(r),u=!!a&&!!l&&l>=a&&(0,f.plusDays)(a,92)>=l;return(0,v.jsxs)(h.Row,{wrap:!0,gap:6,style:{alignItems:'flex-end'},children:[(0,v.jsx)(i.default,{style:{flexBasis:130,flexGrow:1},children:(0,v.jsx)(h.Field,{label:"From (DD/MM/YYYY)",value:s,onChangeText:e=>o((0,t.slashDate)(e,s)),placeholder:"23/10/2026",keyboardType:"numbers-and-punctuation",maxLength:10})}),(0,v.jsx)(i.default,{style:{flexBasis:130,flexGrow:1},children:(0,v.jsx)(h.Field,{label:"To (DD/MM/YYYY)",value:r,onChangeText:e=>d((0,t.slashDate)(e,r)),placeholder:"22/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10})}),(0,v.jsx)(h.Button,{small:!0,kind:"success",label:"Show",disabled:!u,onPress:()=>u&&e((0,f.customPeriod)(a,l))}),s&&r&&!u?(0,v.jsx)(h.T,{size:13,colour:b.colours.red,children:"Use two dates, the second on or after the first, up to 3 months apart."}):null]})}const _=[150,54,100,90,48,62,70]},1179,[827,1059,1174,34,1180,236,402,426,102,1182,1183,1184,794,831,891,867,1060,821,930,1187,1175,1084,1061,1185,872,1186,25]); __d(function(g,_r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ActionTile=function({label:e,sub:r,icon:c,onPress:u,primary:h,tone:b="gold",count:f,testID:x,accessibilityLabel:y}){const j='blue'===b?i.colours.blue:i.colours.gold;return(0,s.jsxs)(t.default,{testID:x,accessibilityRole:"button",accessibilityLabel:y??(r?`${e}, ${r}`:e),onPress:u,style:({pressed:e})=>({flex:1,minWidth:0,minHeight:68,borderRadius:16,borderWidth:1,borderColor:h?i.colours.accentBorder:i.colours.hairline,backgroundColor:e?i.colours.tilePressed:i.colours.tile,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:12,paddingHorizontal:14,paddingVertical:12}),children:[(0,s.jsx)(o.default,{style:{width:40,height:40,borderRadius:12,alignItems:'center',justifyContent:'center',backgroundColor:h?i.colours.accentBg:'rgba(255,255,255,0.04)',borderWidth:1,borderColor:h?i.colours.accentBorder:i.colours.hairline},children:(0,s.jsx)(l.Icon,{name:c,size:21,colour:j})}),(0,s.jsxs)(o.default,{style:{flexShrink:1,minWidth:0},children:[(0,s.jsx)(n.T,{size:15,weight:"semibold",numberOfLines:1,colour:i.colours.text,children:e}),r?(0,s.jsx)(n.T,{size:12,numberOfLines:1,colour:i.colours.muted,children:r}):null]}),f?(0,s.jsx)(o.default,{style:{backgroundColor:i.colours.amber,borderRadius:10,minWidth:22,paddingHorizontal:6},children:(0,s.jsx)(n.T,{size:12,weight:"bold",colour:i.colours.onGold,center:!0,children:f})}):null]})},_e.ActionGrid=function({children:e,testID:t="action-grid"}){const l=r.default.Children.toArray(e).filter(Boolean),i=[];for(let e=0;e(0,s.jsxs)(o.default,{style:{flexDirection:'row',gap:12},children:[e,1===e.length?(0,s.jsx)(o.default,{style:{flex:1}}):null]},r))})},Object.defineProperty(_e,"CardHeading",{enumerable:!0,get:function(){return c}});var r=e(_r(d[0])),t=e(_r(d[1])),o=e(_r(d[2])),l=_r(d[3]),i=_r(d[4]),n=_r(d[5]),s=_r(d[6]);const c=({children:e,right:r})=>(0,s.jsxs)(o.default,{style:{flexDirection:'row',alignItems:'center',justifyContent:'space-between'},children:[(0,s.jsx)(n.T,{size:12,weight:"semibold",colour:i.colours.goldMuted,style:{letterSpacing:1.6,textTransform:'uppercase'},children:e}),r]})},1180,[34,402,102,1181,821,794,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Icon=function({name:l,size:x=22,colour:t}){const n={stroke:t,strokeWidth:2,fill:'none',strokeLinecap:'round',strokeLinejoin:'round'};return(0,e.jsxs)(h.default,{width:x,height:x,viewBox:"0 0 24 24",children:['home'===l?(0,e.jsx)(s.Path,{d:"M3 11l9-7 9 7v9a1 1 0 0 1-1 1h-5v-6H9v6H4a1 1 0 0 1-1-1z",...n}):null,'signoff'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"11",r:"8",...n}),(0,e.jsx)(s.Path,{d:"M11 6.5V11l3 2",...n}),(0,e.jsx)(s.Path,{d:"M15.5 19.5l2 2 4-4.2",...n})]}):null,'orders'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"5",y:"3",width:"14",height:"18",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M9 8h6M9 12h6M9 16h4",...n})]}):null,'bookings'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4",...n})]}):null,'forecast'===l?(0,e.jsx)(s.Path,{d:"M4 20V10M10 20V4M16 20v-7M22 20H2",...n}):null,'more'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"5",cy:"12",r:"1.6",fill:t}),(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"1.6",fill:t}),(0,e.jsx)(s.Circle,{cx:"19",cy:"12",r:"1.6",fill:t})]}):null,'search'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"11",r:"7",...n}),(0,e.jsx)(s.Path,{d:"M20 20l-4-4",...n})]}):null,'bell'===l?(0,e.jsx)(s.Path,{d:"M6 16V11a6 6 0 0 1 12 0v5l2 2H4zM10 20a2 2 0 0 0 4 0",...n}):null,'chat'===l?(0,e.jsx)(s.Path,{d:"M4 5h16v11H9l-5 4z",...n}):null,'clock'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M12 7v5l3 2",...n})]}):null,'user'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"8",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M4 21a8 8 0 0 1 16 0",...n})]}):null,'walkin'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"13",cy:"4.5",r:"1.8",...n}),(0,e.jsx)(s.Path,{d:"M10 21l2-6 3 3v3M9 12l2-4 4 1 2 3M11 8l-1 5",...n})]}):null,'calendarPlus'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4M12 13v5M9.5 15.5h5",...n})]}):null,'pause'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M10 9v6M14 9v6",...n})]}):null,'rain'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M7 15a4 4 0 0 1-.6-7.95A5.5 5.5 0 0 1 17 7.5a3.75 3.75 0 0 1 .5 7.5z",...n}),(0,e.jsx)(s.Path,{d:"M9 18l-1 2.5M13 18l-1 2.5M17 18l-1 2.5",...n})]}):null,'sun'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M12 2v2M12 20v2M2 12h2M20 12h2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4",...n})]}):null,'payroll'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"4",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M7 9h6M7 13h4M15 12.5a2 2 0 1 0 0 .01M7 17h10",...n})]}):null,'tips'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M14.5 9a2.5 2.5 0 0 0-5 0c0 2.5 0 4-1.5 6h7M9 12.5h4",...n})]}):null,'sparkle'===l?(0,e.jsx)(s.Path,{d:"M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8zM19 16l.7 1.8 1.8.7-1.8.7L19 21l-.7-1.8-1.8-.7 1.8-.7z",...n}):null,'platter'===l?(0,e.jsx)(e.Fragment,{children:(0,e.jsx)(s.Path,{d:"M3 15h18M5 15a7 7 0 0 1 14 0M12 6v2M2 18h20",...n})}):null,'check'===l?(0,e.jsx)(s.Path,{d:"M5 12.5l4.5 4.5L19 7.5",...n}):null,'alert'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M12 3l9.5 17h-19z",...n}),(0,e.jsx)(s.Path,{d:"M12 10v4M12 17.2v.1",...n})]}):null,'access'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"4.5",r:"1.8",...n}),(0,e.jsx)(s.Path,{d:"M11 7.5v6h5l2.5 5M11 10h5M8 11.5a5.5 5.5 0 1 0 7.5 6.5",...n})]}):null,'dog'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 10l1-5 3 3h4l3-3 1 5v4a5 5 0 0 1-5 5h-2a5 5 0 0 1-5-5z",...n}),(0,e.jsx)(s.Path,{d:"M10 13v.1M14 13v.1M11 16h2",...n})]}):null,'leaf'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 19c0-8 5-14 15-14 0 10-6 15-14 15",...n}),(0,e.jsx)(s.Path,{d:"M5 19l8-8",...n})]}):null,'table'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"4",y:"8",width:"16",height:"8",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M8 16v4M16 16v4M8 4v4M16 4v4",...n})]}):null,'bag'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 8h14l-1 12H6z",...n}),(0,e.jsx)(s.Path,{d:"M9 10V7a3 3 0 0 1 6 0v3",...n})]}):null,'phone'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"7",y:"2.5",width:"10",height:"19",rx:"2.5",...n}),(0,e.jsx)(s.Path,{d:"M11 18.5h2",...n})]}):null,'swap'===l?(0,e.jsx)(s.Path,{d:"M7 4L3 8l4 4M3 8h14M17 20l4-4-4-4M21 16H7",...n}):null,'box'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M3.5 8L12 4l8.5 4v8L12 20l-8.5-4z",...n}),(0,e.jsx)(s.Path,{d:"M3.5 8L12 12l8.5-4M12 12v8",...n})]}):null,'star'===l?(0,e.jsx)(s.Path,{d:"M12 3.5l2.6 5.4 5.9.8-4.3 4.1 1 5.8L12 16.8l-5.2 2.8 1-5.8L3.5 9.7l5.9-.8z",...n}):null,'userPlus'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"10",cy:"8",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M3 21a7 7 0 0 1 14 0M19 8v6M16 11h6",...n})]}):null,'gift'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3.5",y:"8.5",width:"17",height:"4",rx:"1",...n}),(0,e.jsx)(s.Path,{d:"M5 12.5V20h14v-7.5M12 8.5V20M12 8.5C10 8.5 7.5 7.8 7.5 5.8S10.5 4 12 8.5c1.5-4.5 4.5-4.7 4.5-2.7S14 8.5 12 8.5z",...n})]}):null,'tag'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M3.5 12.5V4h8.5l8.5 8.5-8.5 8.5z",...n}),(0,e.jsx)(s.Circle,{cx:"8",cy:"8.5",r:"1.4",...n})]}):null,'hanger'===l?(0,e.jsx)(s.Path,{d:"M12 7.5a2 2 0 1 1 2-2M12 7.5v2L3 16.5h18L12 9.5",...n}):null]})},r(d[0]);var l,s=r(d[1]),h=(l=s)&&l.__esModule?l:{default:l},e=r(d[2])},1181,[34,797,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Icon=function({name:l,size:x=22,colour:t}){const n={stroke:t,strokeWidth:2,fill:'none',strokeLinecap:'round',strokeLinejoin:'round'};return(0,e.jsxs)(h.default,{width:x,height:x,viewBox:"0 0 24 24",children:['home'===l?(0,e.jsx)(s.Path,{d:"M3 11l9-7 9 7v9a1 1 0 0 1-1 1h-5v-6H9v6H4a1 1 0 0 1-1-1z",...n}):null,'signoff'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"11",r:"8",...n}),(0,e.jsx)(s.Path,{d:"M11 6.5V11l3 2",...n}),(0,e.jsx)(s.Path,{d:"M15.5 19.5l2 2 4-4.2",...n})]}):null,'orders'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"5",y:"3",width:"14",height:"18",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M9 8h6M9 12h6M9 16h4",...n})]}):null,'rota'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4M7 14h4M13 14h4M7 18h6",...n})]}):null,'bookings'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4",...n})]}):null,'forecast'===l?(0,e.jsx)(s.Path,{d:"M4 20V10M10 20V4M16 20v-7M22 20H2",...n}):null,'more'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"5",cy:"12",r:"1.6",fill:t}),(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"1.6",fill:t}),(0,e.jsx)(s.Circle,{cx:"19",cy:"12",r:"1.6",fill:t})]}):null,'search'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"11",r:"7",...n}),(0,e.jsx)(s.Path,{d:"M20 20l-4-4",...n})]}):null,'bell'===l?(0,e.jsx)(s.Path,{d:"M6 16V11a6 6 0 0 1 12 0v5l2 2H4zM10 20a2 2 0 0 0 4 0",...n}):null,'chat'===l?(0,e.jsx)(s.Path,{d:"M4 5h16v11H9l-5 4z",...n}):null,'clock'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M12 7v5l3 2",...n})]}):null,'user'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"8",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M4 21a8 8 0 0 1 16 0",...n})]}):null,'walkin'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"13",cy:"4.5",r:"1.8",...n}),(0,e.jsx)(s.Path,{d:"M10 21l2-6 3 3v3M9 12l2-4 4 1 2 3M11 8l-1 5",...n})]}):null,'calendarPlus'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4M12 13v5M9.5 15.5h5",...n})]}):null,'pause'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M10 9v6M14 9v6",...n})]}):null,'rain'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M7 15a4 4 0 0 1-.6-7.95A5.5 5.5 0 0 1 17 7.5a3.75 3.75 0 0 1 .5 7.5z",...n}),(0,e.jsx)(s.Path,{d:"M9 18l-1 2.5M13 18l-1 2.5M17 18l-1 2.5",...n})]}):null,'sun'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M12 2v2M12 20v2M2 12h2M20 12h2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4",...n})]}):null,'payroll'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"4",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M7 9h6M7 13h4M15 12.5a2 2 0 1 0 0 .01M7 17h10",...n})]}):null,'tips'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M14.5 9a2.5 2.5 0 0 0-5 0c0 2.5 0 4-1.5 6h7M9 12.5h4",...n})]}):null,'sparkle'===l?(0,e.jsx)(s.Path,{d:"M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8zM19 16l.7 1.8 1.8.7-1.8.7L19 21l-.7-1.8-1.8-.7 1.8-.7z",...n}):null,'platter'===l?(0,e.jsx)(e.Fragment,{children:(0,e.jsx)(s.Path,{d:"M3 15h18M5 15a7 7 0 0 1 14 0M12 6v2M2 18h20",...n})}):null,'check'===l?(0,e.jsx)(s.Path,{d:"M5 12.5l4.5 4.5L19 7.5",...n}):null,'alert'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M12 3l9.5 17h-19z",...n}),(0,e.jsx)(s.Path,{d:"M12 10v4M12 17.2v.1",...n})]}):null,'access'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"4.5",r:"1.8",...n}),(0,e.jsx)(s.Path,{d:"M11 7.5v6h5l2.5 5M11 10h5M8 11.5a5.5 5.5 0 1 0 7.5 6.5",...n})]}):null,'dog'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 10l1-5 3 3h4l3-3 1 5v4a5 5 0 0 1-5 5h-2a5 5 0 0 1-5-5z",...n}),(0,e.jsx)(s.Path,{d:"M10 13v.1M14 13v.1M11 16h2",...n})]}):null,'leaf'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 19c0-8 5-14 15-14 0 10-6 15-14 15",...n}),(0,e.jsx)(s.Path,{d:"M5 19l8-8",...n})]}):null,'table'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"4",y:"8",width:"16",height:"8",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M8 16v4M16 16v4M8 4v4M16 4v4",...n})]}):null,'bag'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 8h14l-1 12H6z",...n}),(0,e.jsx)(s.Path,{d:"M9 10V7a3 3 0 0 1 6 0v3",...n})]}):null,'phone'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"7",y:"2.5",width:"10",height:"19",rx:"2.5",...n}),(0,e.jsx)(s.Path,{d:"M11 18.5h2",...n})]}):null,'swap'===l?(0,e.jsx)(s.Path,{d:"M7 4L3 8l4 4M3 8h14M17 20l4-4-4-4M21 16H7",...n}):null,'box'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M3.5 8L12 4l8.5 4v8L12 20l-8.5-4z",...n}),(0,e.jsx)(s.Path,{d:"M3.5 8L12 12l8.5-4M12 12v8",...n})]}):null,'star'===l?(0,e.jsx)(s.Path,{d:"M12 3.5l2.6 5.4 5.9.8-4.3 4.1 1 5.8L12 16.8l-5.2 2.8 1-5.8L3.5 9.7l5.9-.8z",...n}):null,'userPlus'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"10",cy:"8",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M3 21a7 7 0 0 1 14 0M19 8v6M16 11h6",...n})]}):null,'gift'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3.5",y:"8.5",width:"17",height:"4",rx:"1",...n}),(0,e.jsx)(s.Path,{d:"M5 12.5V20h14v-7.5M12 8.5V20M12 8.5C10 8.5 7.5 7.8 7.5 5.8S10.5 4 12 8.5c1.5-4.5 4.5-4.7 4.5-2.7S14 8.5 12 8.5z",...n})]}):null,'tag'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M3.5 12.5V4h8.5l8.5 8.5-8.5 8.5z",...n}),(0,e.jsx)(s.Circle,{cx:"8",cy:"8.5",r:"1.4",...n})]}):null,'hanger'===l?(0,e.jsx)(s.Path,{d:"M12 7.5a2 2 0 1 1 2-2M12 7.5v2L3 16.5h18L12 9.5",...n}):null]})},r(d[0]);var l,s=r(d[1]),h=(l=s)&&l.__esModule?l:{default:l},e=r(d[2])},1181,[34,797,25]); __d(function(_g,_r,i,_a,_m,e,d){"use strict";function t(t){const n=Math.max(0,Math.round(t||0)),o=Math.floor(n/60),r=n%60;return o?`${o}h ${String(r).padStart(2,'0')}m`:`${r}m`}function n(t){const n=Math.max(0,Math.round(t||0)),o=Math.floor(n/60),r=n%60;return[o?`${o} ${1===o?'hour':'hours'}`:'',r||!o?`${r} ${1===r?'minute':'minutes'}`:''].filter(Boolean).join(' ')}Object.defineProperty(e,'__esModule',{value:!0}),e.durText=t,e.durWords=n,e.isZeroShift=function(t){return!(!t.in||!t.out)&&Date.parse(t.out)-Date.parse(t.in)<6e4},Object.defineProperty(e,"isVoided",{enumerable:!0,get:function(){return o}}),e.shiftSentence=function(t,o){if('On now'===t.status)return`${o}, clocked in at ${t.inT}, still on shift.`;const r=t.zero?' Check: 0 minutes, clocked in and out at the same moment.':'';return`${o}, ${t.inT} to ${t.outT}, break ${n(t.brk)}, paid ${n(t.paid)}, ${'Approved'===t.status?'approved':'pending approval'}.${r}`},e.hoursSummary=function(n,o,r){const u=t=>null!=r?Math.round(t/60*r):null;return{approved:{mins:n,text:t(n),gross:u(n)},pending:{mins:o,text:t(o),gross:u(o)}}};const o=t=>!!t.voided},1182,[]); __d(function(g,r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ShiftCard=function({d:e,manager:t,onApprove:s,onEdit:d,onRemove:l}){const a='Confirmed'===e.status?'Approved':e.status,y=(0,u.isZeroShift)(e.a),x={date:e.date,dateText:b(e.date),inT:e.inT,outT:e.outT,brk:e.brk,paid:e.paid,status:a,zero:y};return(0,h.jsxs)(n.default,{testID:`shift-${e.a.id}`,style:{borderRadius:14,borderWidth:1,borderColor:y?c.colours.amber:'rgba(212,175,106,0.35)',backgroundColor:'#15130F',padding:12,gap:8,alignItems:'center'},children:[(0,h.jsxs)(n.default,{accessible:!0,accessibilityLabel:(0,u.shiftSentence)(x,p(e.date)),style:{alignItems:'center',gap:4,width:'100%'},children:[(0,h.jsx)(o.T,{size:16,weight:"bold",colour:c.colours.goldLight,center:!0,children:b(e.date)}),(0,h.jsx)(o.T,{size:17,weight:"semibold",center:!0,children:'On now'===e.status?`${e.inT} to now`:`${e.inT} to ${e.outT}`}),'On now'!==e.status?(0,h.jsxs)(o.T,{size:15,colour:c.colours.text,center:!0,children:["Break ",(0,u.durText)(e.brk)," \xb7 Paid ",(0,h.jsx)(o.T,{size:15,weight:"bold",colour:c.colours.gold,children:(0,u.durText)(e.paid)})]}):null,(0,h.jsx)(o.Badge,{kind:'Approved'===a?'ok':'Pending'===a?'amber':'neutral',label:'Pending'===a?'Pending approval':a}),y?(0,h.jsx)(n.default,{testID:`shift-zero-${e.a.id}`,style:{borderRadius:8,borderWidth:1,borderColor:c.colours.amber,paddingHorizontal:10,paddingVertical:4},children:(0,h.jsx)(o.T,{size:14,weight:"bold",colour:c.colours.amber,center:!0,children:"Check: 0 minutes"})}):null,e.a.added&&e.a.signOff?(0,h.jsxs)(o.Muted,{center:!0,testID:`shift-entered-${e.a.id}`,children:["Entered by ",e.a.signOff.by]}):null]}),t?(0,h.jsxs)(o.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:['Pending'===e.status&&!y&&s?(0,h.jsx)(o.Button,{label:"Approve",testID:`shift-approve-${e.a.id}`,accessibilityLabel:`Approve ${p(e.date)}, paid ${(0,u.durWords)(e.paid)}`,onPress:s,style:{minHeight:48,minWidth:120}}):null,(y||'Pending'===e.status)&&d?(0,h.jsx)(o.Button,{kind:"secondary",label:"Edit",testID:`shift-edit-${e.a.id}`,accessibilityLabel:`Edit the shift on ${p(e.date)}`,onPress:d,style:{minHeight:48,minWidth:96}}):null,y&&'Confirmed'!==e.status&&l?(0,h.jsx)(o.Button,{kind:"secondary",label:"Remove",testID:`shift-remove-${e.a.id}`,accessibilityLabel:`Remove the 0-minute shift on ${p(e.date)}. It is kept in the history.`,onPress:l,style:{minHeight:48,minWidth:96}}):null]}):null]})},_e.HoursSummaryCard=function({name:e,role:t,approved:s,pending:d,rate:l}){const p=(0,u.hoursSummary)(s,d,l),b=`${e}. Approved ${(0,u.durWords)(s)}${null!=p.approved.gross?`, ${(0,a.gbp)(p.approved.gross)}`:''}. Pending approval ${(0,u.durWords)(d)}${null!=p.pending.gross?`, ${(0,a.gbp)(p.pending.gross)} once approved`:''}.${null!=l?` Rate ${(0,a.gbp)(l)} an hour.`:''}`;return(0,h.jsxs)(n.default,{accessible:!0,accessibilityLabel:b,testID:"hours-summary-card",style:{alignItems:'center',gap:6,width:'100%'},children:[(0,h.jsx)(o.T,{size:18,weight:"bold",center:!0,children:e}),t?(0,h.jsx)(o.Muted,{center:!0,children:t}):null,(0,h.jsxs)(o.Row,{wrap:!0,gap:10,style:{justifyContent:'center'},children:[(0,h.jsxs)(n.default,{style:{minWidth:150,borderRadius:12,borderWidth:1,borderColor:c.colours.ok,padding:10,alignItems:'center'},children:[(0,h.jsx)(o.T,{size:13,weight:"semibold",colour:c.colours.ok,children:"APPROVED"}),(0,h.jsx)(o.T,{size:20,weight:"bold",testID:"sum-approved",children:p.approved.text}),(0,h.jsx)(o.Muted,{children:null!=p.approved.gross?`${(0,a.gbp)(p.approved.gross)} gross`:'no rate'})]}),(0,h.jsxs)(n.default,{style:{minWidth:150,borderRadius:12,borderWidth:1,borderColor:c.colours.amber,padding:10,alignItems:'center'},children:[(0,h.jsx)(o.T,{size:13,weight:"semibold",colour:c.colours.amber,children:"PENDING"}),(0,h.jsx)(o.T,{size:20,weight:"bold",testID:"sum-pending",children:p.pending.text}),(0,h.jsx)(o.Muted,{children:null!=p.pending.gross?`${(0,a.gbp)(p.pending.gross)} once approved`:'no rate'})]})]}),null!=l?(0,h.jsxs)(o.Muted,{center:!0,children:["Rate ",(0,a.gbp)(l)," an hour",(y=null,null==y?'':` \xb7 ${(0,a.gbp)(y)}`)]}):null]});var y},_e.RemoveShiftSheet=function({a:e,who:s,onClose:n}){const[a,u]=(0,t.useState)('Clocked in and out by mistake (0 minutes)'),p=a.trim().length>=3;return(0,h.jsxs)(o.Sheet,{visible:!0,onClose:n,title:`Remove the shift on ${b(e.date)}?`,maxWidth:520,testID:"remove-shift",children:[(0,h.jsx)(o.T,{size:16,center:!0,children:"It comes out of hours, pay and exports. It isn\u2019t deleted: it stays in the history with your name and the reason."}),(0,h.jsx)(d.TextInput,{accessibilityLabel:"Reason for removing the shift",value:a,onChangeText:u,style:{minHeight:48,borderRadius:10,borderWidth:1,borderColor:c.colours.gold,color:c.colours.text,paddingHorizontal:12}}),(0,h.jsxs)(o.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,h.jsx)(o.Button,{label:"Remove shift",testID:"remove-shift-yes",disabled:!p,onPress:()=>{l.useOwner.getState().voidEntry(e.id,s.name,s.id,a.trim(),(new Date).toISOString()),n()},style:{minHeight:56}}),(0,h.jsx)(o.Button,{kind:"secondary",label:"Keep it",onPress:n,style:{minHeight:56}})]})]})};var e,t=r(_d[0]),s=r(_d[1]),n=(e=s)&&e.__esModule?e:{default:e},o=r(_d[2]),d=r(_d[3]),l=r(_d[4]),a=r(_d[5]),u=r(_d[6]),c=r(_d[7]),h=r(_d[8]);const p=e=>new Date(`${e}T12:00:00Z`).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long',timeZone:'UTC'}),b=e=>new Date(`${e}T12:00:00Z`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',timeZone:'UTC'})},1183,[34,102,794,827,891,867,1182,821,25]); __d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"REASONS",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"isoAt",{enumerable:!0,get:function(){return S}}),_e.flagsFor=D,_e.notesFor=$,Object.defineProperty(_e,"statusLabel",{enumerable:!0,get:function(){return M}}),Object.defineProperty(_e,"statusKind",{enumerable:!0,get:function(){return O}}),_e.AuditTrail=B,_e.TimeEdit=R,_e.OverrideSheet=A,_e.outstandingDays=P,_e.useOutstanding=function(){const e=(0,r.useOwner)(e=>(0,r.liveAttendance)(e.attendance)),t=(0,r.useOwner)(e=>e.timeRequests),n=(0,u.ymd)(new Date);return(0,s.useMemo)(()=>({days:P(e,n),requests:t.filter(e=>'open'===e.status).length}),[e,t,n])},_e.SignOff=function(){const{now:e,today:t,me:n,meId:m}=(0,h.useCtx)(3e4),p=(0,r.useOwner)(e=>e.staff),x=(0,r.useOwner)(e=>(0,r.liveAttendance)(e.attendance)),j=(0,r.useOwner)(e=>e.shifts),k=(0,r.useOwner)(e=>e.timeRequests),w=(0,r.useOwner)(e=>e.leave),S=(0,s.useMemo)(()=>P(x,t),[x,t]),[I,T]=(0,s.useState)(t),[B,R]=(0,s.useState)(null),[q,z]=(0,s.useState)(null),H=(0,s.useMemo)(()=>{const n=x.filter(e=>e.date===I&&e.in),s=n.map(n=>{const s=(0,r.shiftOf)(j,n.staffId,I);return{key:n.id,staffId:n.staffId,a:n,sh:s,flags:D(n,s,e,t,k)}});j.filter(e=>e.date===I&&!1!==e.published&&!n.some(t=>t.staffId===e.staffId)).forEach(n=>{const o=(0,d.leaveCovering)(w,n.staffId,I);if(o)return void(s.some(e=>e.leave&&e.staffId===n.staffId)||s.push({key:`leave-${n.id}`,staffId:n.staffId,sh:n,flags:[],leave:o}));(I60*n.start+15)&&s.push({key:`miss-${n.id}`,staffId:n.staffId,sh:n,flags:[{key:'noin',label:'No clock-in'}]})});const o=e=>e.leave?4:e.a?'confirmed'===(0,r.attStatus)(e.a)?3:e.flags.length?0:2:1;return s.sort((e,t)=>o(e)-o(t)||(p.find(t=>t.id===e.staffId)?.name??'').localeCompare(p.find(e=>e.id===t.staffId)?.name??''))},[x,j,k,w,I,e.getMinutes(),p]),N=k.filter(e=>'open'===e.status&&e.date===I),F=k.filter(e=>'open'===e.status&&e.date!==I),E=H.filter(e=>e.a&&'awaiting'===(0,r.attStatus)(e.a)&&!e.flags.length),_=H.reduce((t,n)=>{if(!n.a)return t;const s=(0,h.paidMins)(n.a,e).paid;return'confirmed'===(0,r.attStatus)(n.a)?t.conf+=s:t.pend+=s,t},{conf:0,pend:0}),Y={confirmed:H.filter(e=>e.a&&'confirmed'===(0,r.attStatus)(e.a)).length,awaiting:H.filter(e=>e.a&&'awaiting'===(0,r.attStatus)(e.a)).length,open:H.filter(e=>e.a&&'open'===(0,r.attStatus)(e.a)).length,flagged:H.filter(e=>e.flags.length&&!(e.a&&'confirmed'===(0,r.attStatus)(e.a))).length,off:H.filter(e=>e.leave).length},L=[t,...S.map(e=>e.date).filter(e=>e!==t)];for(let e=1;L.length<8&&e<=7;e++){const n=v(t,-e);L.includes(n)||L.push(n)}const W=t=>{const s=r.useOwner.getState().confirmEntries(t,n,m,e.toISOString());z(s?`${s} ${1===s?'entry':'entries'} confirmed`:null)};return(0,b.jsxs)(a.default,{style:{gap:10},testID:"signoff",children:[S.filter(e=>e.date!==I).length?(0,b.jsx)(o.default,{accessibilityRole:"button",onPress:()=>T(S.filter(e=>e.date!==I)[S.filter(e=>e.date!==I).length-1].date),children:(0,b.jsx)(l.Banner,{kind:"warn",title:`${S.filter(e=>e.date!==I).length} earlier ${1===S.filter(e=>e.date!==I).length?'day':'days'} still to sign off`,children:"Hours only count for pay once they\u2019re confirmed. Tap to open the oldest."})}):null,(0,b.jsx)(l.Row,{wrap:!0,gap:6,children:L.slice(0,10).sort((e,t)=>t.localeCompare(e)).map(e=>{const n=S.find(t=>t.date===e);return(0,b.jsx)(l.Chip,{label:C(e,t),sub:n?`${n.n} to sign off`:void 0,selected:I===e,onPress:()=>{T(e),z(null)}},e)})}),(0,b.jsx)(l.Card,{children:(0,b.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,b.jsxs)(a.default,{style:{flex:1},children:[(0,b.jsxs)(l.T,{size:18,weight:"bold",children:[C(I,t),I===t||I===v(t,-1)?` \xb7 ${(0,u.niceDate)((0,u.parseYmd)(I))}`:'']}),(0,b.jsxs)(l.Muted,{children:[Y.confirmed," confirmed \xb7 ",Y.awaiting," awaiting \xb7 ",Y.open," still clocked in",Y.flagged?` \xb7 ${Y.flagged} flagged`:'',Y.off?` \xb7 ${Y.off} on time off`:'']})]}),(0,b.jsxs)(a.default,{style:{alignItems:'flex-end'},children:[(0,b.jsx)(l.T,{size:18,weight:"bold",colour:c.colours.ok,children:(0,h.hmDur)(_.conf)}),(0,b.jsx)(l.Muted,{children:"confirmed"}),_.pend?(0,b.jsxs)(l.T,{size:13,colour:c.colours.amber,children:[(0,h.hmDur)(_.pend)," pending"]}):null]})]})}),q?(0,b.jsx)(l.Banner,{kind:"success",title:q}):null,N.length||F.length?(0,b.jsx)(f.SectionHead,{title:"Correction requests",sub:"From the Staff app. Apply opens the times to check; declining keeps the times as clocked."}):null,[...N,...F].map(t=>{const s=p.find(e=>e.id===t.staffId),o=t.attendanceId&&x.find(e=>e.id===t.attendanceId)||x.find(e=>e.staffId===t.staffId&&e.date===t.date&&e.in);return(0,b.jsxs)(l.Card,{highlight:c.colours.blue,children:[(0,b.jsxs)(l.Row,{gap:8,children:[(0,b.jsx)(i.StaffAvatar,{id:t.staffId,size:30}),(0,b.jsxs)(a.default,{style:{flex:1},children:[(0,b.jsxs)(l.T,{weight:"semibold",children:[y(s?.name)," \xb7 ",(0,u.niceDate)((0,u.parseYmd)(t.date))]}),(0,b.jsxs)(l.Muted,{children:['in'===t.kind?'Forgot to clock in':'out'===t.kind?'Forgot to clock out':'Forgot to clock in and out',t.suggestedIn?` \xb7 in ${(0,u.hm)(new Date(t.suggestedIn))}`:'',t.suggestedOut?` \xb7 out ${(0,u.hm)(new Date(t.suggestedOut))}`:'',t.note?` \xb7 \u201c${t.note}\u201d`:'']})]}),(0,b.jsx)(l.Badge,{kind:"blue",label:"Request"})]}),(0,b.jsxs)(l.Row,{gap:6,children:[(0,b.jsx)(l.Button,{small:!0,kind:"success",label:"Review & apply",onPress:()=>R({staffId:t.staffId,a:o,request:t})}),(0,b.jsx)(l.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>r.useOwner.getState().resolveTimeRequest(t.id,'declined',n,e.toISOString())})]})]},t.id)}),(0,b.jsx)(f.SectionHead,{title:"Hours",sub:"Rostered vs actual. Flagged rows need a look and are confirmed one by one."}),H.map(t=>{const n=p.find(e=>e.id===t.staffId),s=t.a,o=s?(0,h.paidMins)(s,e):null,f=s?(0,r.attStatus)(s):null,m=s?.audit?.filter(e=>'confirmed'!==e.action).slice(-1)[0];return(0,b.jsx)(l.Card,{highlight:t.leave?c.colours.blue:'confirmed'===f?c.colours.ok:t.flags.length?c.colours.amber:void 0,children:(0,b.jsxs)(a.default,{testID:`so-row-${t.staffId}`,style:{gap:8},children:[(0,b.jsxs)(l.Row,{gap:10,children:[(0,b.jsx)(i.StaffAvatar,{id:t.staffId,size:36}),(0,b.jsxs)(a.default,{style:{flex:1},children:[(0,b.jsx)(l.T,{weight:"semibold",children:y(n?.name)}),(0,b.jsx)(l.Muted,{children:[n?.job,...$(s,n?.temp)].filter(Boolean).join(' \xb7 ')})]}),n?.temp||s?.temp?(0,b.jsx)(l.Badge,{kind:"gold",label:"Temp"}):null,s?(0,b.jsx)(l.Badge,{kind:O(s),label:M(s)}):t.leave?(0,b.jsx)(l.Badge,{kind:"blue",label:(0,d.leaveLabel)(t.leave)}):(0,b.jsx)(l.Badge,{kind:"red",label:"Missing"})]}),(0,b.jsx)(l.Row,{gap:0,style:{flexWrap:'wrap',rowGap:6},children:[['Rota',t.sh?`${(0,h.fmtH)(t.sh.start)}\u2013${(0,h.fmtH)(t.sh.end)}`:'\u2014'],['Actual',s?.in?`${(0,u.hm)(new Date(s.in))}\u2013${s.out?(0,u.hm)(new Date(s.out)):'on'}`:t.leave?(0,d.leaveLabel)(t.leave):'no clock-in'],['Break',s?.out?`${o.brk}m`:s?`${s.breakMins??0}m so far`:'\u2014'],['Paid',s?s.out?(0,h.hmDur)(o.paid):`${(0,h.hmDur)(o.worked)}\u2026`:'\u2014']].map(([e,t])=>(0,b.jsxs)(a.default,{style:{minWidth:92,flexGrow:1},children:[(0,b.jsx)(l.T,{size:11,colour:c.colours.muted,children:e.toUpperCase()}),(0,b.jsx)(l.T,{size:15,weight:"semibold",colour:'Paid'===e&&'confirmed'===f?c.colours.ok:c.colours.text,children:t})]},e))}),t.flags.length&&'confirmed'!==f?(0,b.jsx)(l.Row,{wrap:!0,gap:6,children:t.flags.map(e=>(0,b.jsx)(l.Badge,{kind:'noin'===e.key||'noout'===e.key?'red':'amber',label:e.label},e.key))}):null,t.leave?(0,b.jsxs)(l.Muted,{testID:`so-leave-${t.staffId}`,children:[(0,d.leaveNote)(t.leave),". Rota shift covered by leave: no hours counted."]}):null,m?(0,b.jsxs)(l.Muted,{children:["Adjusted by ",y(m.by),m.reason?`: ${m.reason}`:'']}):null,s?.signOff?(0,b.jsxs)(l.Muted,{children:["Confirmed by ",y(s.signOff.by)," \xb7 ",(0,u.niceDate)(new Date(s.signOff.at))," ",(0,u.hm)(new Date(s.signOff.at))]}):null,(0,b.jsxs)(l.Row,{gap:8,children:[(0,b.jsx)(l.Button,{small:!0,kind:"secondary",label:s?'Edit':'Add entry',accessibilityLabel:`${s?'Edit':'Add entry for'} ${y(n?.name)}`,onPress:()=>R({staffId:t.staffId,a:s})}),s&&'awaiting'===f?(0,b.jsx)(l.Button,{small:!0,kind:"success",label:"Confirm",accessibilityLabel:`Confirm ${y(n?.name)}`,onPress:()=>W([s.id])}):null,s&&'open'===f?(0,b.jsx)(l.Muted,{style:{alignSelf:'center'},children:"Needs a clock-out before it can be confirmed"}):null]})]})},t.key)}),H.length?null:(0,b.jsx)(l.Card,{children:(0,b.jsx)(l.Muted,{children:"No clock records or rostered shifts for this day."})}),H.length?(0,b.jsx)(l.Button,{testID:"confirm-unflagged",kind:"success",label:E.length?`Confirm all unflagged (${E.length})`:'Nothing unflagged to confirm',disabled:!E.length,onPress:()=>W(E.map(e=>e.a.id))}):null,(0,b.jsx)(l.Muted,{children:"Flags: no clock-out, 30 min or more off the rota, over 12 hours, no break on a shift over 6 hours, not on the rota, off-site, or a correction request. Editing a confirmed entry puts it back to Awaiting sign-off. Only confirmed hours count for pay, tips and exports."}),B?(0,b.jsx)(A,{a:B.a,staffId:B.staffId,date:B.request?.date??B.a?.date??I,request:B.request,onClose:()=>R(null)}):null]})};var t=_r(_d[0]),n=_r(_d[1]),s=_r(_d[2]),o=e(_r(_d[3])),a=e(_r(_d[4])),l=_r(_d[5]),i=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),f=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),p=_r(_d[14]),x=_r(_d[15]),b=_r(_d[16]);const j=['Forgot to clock in','Forgot to clock out','Wrong time'],k=[0,15,20,30,45,60],y=e=>(e??'').replace(' (example)',''),w=e=>{const t=new Date(e);return 60*t.getHours()+t.getMinutes()},S=(e,t)=>{const n=(0,u.parseYmd)(e);return n.setMinutes(t),n.toISOString()},I=e=>{const t=(e%1440+1440)%1440;return`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`},v=(e,t)=>{const n=(0,u.parseYmd)(e);return n.setDate(n.getDate()+t),(0,u.ymd)(n)},C=(e,t)=>e===t?'Today':e===v(t,-1)?'Yesterday':(0,u.niceDate)((0,u.parseYmd)(e));function D(e,t,s,o,a=[]){const l=[],i=(0,h.paidMins)(e,s),r=60*s.getHours()+s.getMinutes();if(!e.out&&(e.date60*t.end+60||i.worked>840)&&l.push({key:'noout',label:'No clock-out'}),t&&e.in){const n=w(e.in)-Math.round(60*t.start),s=e.out?w(e.out)+(e.out.slice(0,10)!==e.in.slice(0,10)&&w(e.out)=30&&l.push({key:'diff',label:`${a>=60?(0,h.hmDur)(a):`${a}m`} off the rota`})}return(0,n.isZeroShift)(e)&&l.push({key:'zero',label:'Check: 0 minutes'}),t||l.push({key:'unrostered',label:'Not on the rota'}),i.worked>720&&l.push({key:'long',label:`Very long shift (${(0,h.hmDur)(i.worked)})`}),e.out&&i.worked>360&&0===i.brk&&l.push({key:'nobreak',label:'No break (over 6h)'}),!1!==e.inSite&&!1!==e.outSite||l.push({key:'offsite',label:'Clocked off-site'}),a.some(t=>'open'===t.status&&t.staffId===e.staffId&&t.date===e.date)&&l.push({key:'request',label:'Correction requested'}),e.breakAddedAtClockOut&&l.push({key:'breakadded',label:`Break added at clock-out (${e.breakAddedAtClockOut}m)`}),e.offRota&&t&&l.push({key:'offrota',label:'Signed in off rota'}),l}function $(e,t){const n=[];return(t||e?.temp)&&n.push('Temp'),'display'!==e?.via&&'display'!==e?.outVia||n.push('via Display'),'rota'===e?.auto&&n.push(e.autoNote?`Auto from rota \xb7 ${e.autoNote}`:'Auto from rota'),n}const M=e=>{const t=(0,r.attStatus)(e);return'open'===t?'Open':'awaiting'===t?e.adjusted?'Adjusted \xb7 awaiting sign-off':'Awaiting sign-off':e.adjusted?'Confirmed \xb7 adjusted':'Confirmed'},O=e=>{const t=(0,r.attStatus)(e);return'confirmed'===t?'ok':'open'===t?'blue':'amber'},T={added:'Added entry',clock_in:'Clock-in',clock_out:'Clock-out',break:'Break',confirmed:'Confirmed',reopened:'Reopened',request_applied:'Correction request applied',request_declined:'Correction request declined',voided:'Removed (kept in history)'};function B({a:e,limit:t}){const n=[...e.audit??[]].reverse().slice(0,t??50);return n.length?(0,b.jsx)(a.default,{style:{gap:6},testID:"audit-trail",children:n.map((e,t)=>(0,b.jsxs)(a.default,{style:{flexDirection:'row',gap:8},children:[(0,b.jsx)(a.default,{style:{width:3,borderRadius:2,backgroundColor:'confirmed'===e.action?c.colours.ok:'reopened'===e.action?c.colours.amber:c.colours.gold}}),(0,b.jsxs)(a.default,{style:{flex:1},children:[(0,b.jsxs)(l.T,{size:13,weight:"semibold",children:[T[e.action],e.from||e.to?`: ${e.from??'\u2013'} \u2192 ${e.to??'\u2013'}`:'']}),(0,b.jsxs)(l.Muted,{children:[y(e.by)," \xb7 ",(0,u.niceDate)(new Date(e.at))," ",(0,u.hm)(new Date(e.at)),e.reason?` \xb7 \u201c${e.reason}\u201d`:'']})]})]},t))}):(0,b.jsx)(l.Muted,{children:"No changes yet. Times are as clocked."})}function R({label:e,mins:n,onChange:o,testID:i}){const[r,d]=(0,s.useState)(null),u=e=>{const t=/^(\d{1,2})[:.]?(\d{2})$/.exec(e.trim());t&&+t[1]<24&&+t[2]<60&&o(60*+t[1]+ +t[2]+(n>=1440&&60*+t[1]+ +t[2]<360?1440:0)),d(null)};return(0,b.jsxs)(a.default,{style:{gap:6},children:[(0,b.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(l.T,{size:13,colour:c.colours.muted,children:e}),n>=1440?(0,b.jsx)(l.Muted,{children:"next day"}):null]}),(0,b.jsxs)(l.Row,{gap:6,children:[(0,b.jsx)(l.Button,{small:!0,kind:"ghost",label:"\u221215",onPress:()=>o(n-15)}),(0,b.jsx)(l.Button,{small:!0,kind:"ghost",label:"\u22125",onPress:()=>o(n-5)}),(0,b.jsx)(t.TextInput,{testID:i,accessibilityLabel:e,value:r??I(n),onChangeText:d,onBlur:()=>null!=r&&u(r),onSubmitEditing:()=>null!=r&&u(r),style:[l.styles.input,{flex:1,textAlign:'center',fontSize:22,fontWeight:'700',paddingVertical:6,color:c.colours.text}]}),(0,b.jsx)(l.Button,{small:!0,kind:"ghost",label:"+5",onPress:()=>o(n+5)}),(0,b.jsx)(l.Button,{small:!0,kind:"ghost",label:"+15",onPress:()=>o(n+15)})]})]})}function A({a:e,staffId:t,date:n,request:o,onClose:i}){const{me:d,meId:I,now:v,role:C}=(0,h.useCtx)(3e4),[D,$]=(0,s.useState)(!1),T=!!e&&(0,m.canSeeHoursEdit)({role:C,isCar:p.IS_CAR}),A=(0,r.useOwner)(e=>e.staff.find(e=>e.id===t)?.name),P=(0,r.useOwner)(e=>e.shifts),q=(0,r.shiftOf)(P,t,n),z=o?.suggestedIn?w(o.suggestedIn):e?.in?Math.round((new Date(e.in).getTime()-(0,u.parseYmd)(n).getTime())/6e4):q?Math.round(60*q.start):720,H=o?.suggestedOut??e?.out,N=H?(F=H,Math.round((new Date(F).getTime()-(0,u.parseYmd)(n).getTime())/6e4)):e&&e.in&&!e.out?null:q?Math.round(60*q.end):z+480;var F;const[E,_]=(0,s.useState)(z),[Y,L]=(0,s.useState)(N),[W,V]=(0,s.useState)(e?.breakMins??(q&&q.end-q.start>6?30:0)),[G,K]=(0,s.useState)(o?'out'===o.kind?j[1]:j[0]:e?e.in&&!e.out?j[1]:null:j[0]),[U,Z]=(0,s.useState)(''),[J,Q]=(0,s.useState)(null),X=[G,U.trim()].filter(Boolean).join(': ')+(o&&o.note?` (request: ${o.note})`:''),ee=null!=Y?Y-E:0,te=e?(0,h.paidMins)(e,v):null,ne=null!=Y?Math.max(0,ee-W):null,se=e&&'confirmed'===(0,r.attStatus)(e),oe=null!=Y&&Y<=E?'Clock-out must be after clock-in.':ee>1200?'A shift can\u2019t be longer than 20 hours.':null!=Y&&W>=ee?'The break is longer than the shift.':null,ae=e?.in&&!o&&E===z?e.in:S(n,E),le=null==Y?void 0:e?.out&&!o&&Y===N?e.out:S(n,Y),ie=!e||ae!==e.in||(le??'')!==(e.out??'')||(e.breakMins??0)!==W;return(0,b.jsxs)(l.Sheet,{visible:!0,onClose:i,title:`${e?'Edit hours':'Add missing entry'} \xb7 ${y(A)} \xb7 ${(0,u.niceDate)((0,u.parseYmd)(n))}`,testID:"override-sheet",children:[(0,b.jsxs)(l.Row,{gap:8,style:{flexWrap:'wrap'},children:[e?(0,b.jsx)(l.Badge,{kind:O(e),label:M(e)}):(0,b.jsx)(l.Badge,{kind:"red",label:"No clock record"}),q?(0,b.jsx)(l.Badge,{kind:"neutral",label:`Rota ${(0,h.fmtH)(q.start)}\u2013${(0,h.fmtH)(q.end)}`}):(0,b.jsx)(l.Badge,{kind:"neutral",label:"Not on the rota"}),e?.in?(0,b.jsx)(l.Badge,{kind:"neutral",label:`Clocked ${(0,u.hm)(new Date(e.in))}\u2013${e.out?(0,u.hm)(new Date(e.out)):'still on'}`}):null]}),o?(0,b.jsxs)(l.Banner,{kind:"info",title:`${y(A)} asked for a correction`,children:['in'===o.kind?'Forgot to clock in':'out'===o.kind?'Forgot to clock out':'Forgot to clock in and out',o.suggestedIn?` \xb7 in ${(0,u.hm)(new Date(o.suggestedIn))}`:'',o.suggestedOut?` \xb7 out ${(0,u.hm)(new Date(o.suggestedOut))}`:'',o.note?` \xb7 \u201c${o.note}\u201d`:'',". The suggested times are filled in below."]}):null,(0,b.jsx)(R,{label:"Clock in",mins:E,onChange:_,testID:"ov-in"}),null!=Y?(0,b.jsx)(R,{label:"Clock out",mins:Y,onChange:L,testID:"ov-out"}):(0,b.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(l.Muted,{children:"No clock-out yet."}),(0,b.jsx)(l.Button,{small:!0,kind:"secondary",label:"Add clock-out",onPress:()=>L(q?Math.round(60*q.end):Math.min(E+480,60*v.getHours()+v.getMinutes()>E?60*v.getHours()+v.getMinutes():E+480))})]}),(0,b.jsx)(l.T,{size:13,colour:c.colours.muted,children:"Break"}),(0,b.jsxs)(l.Row,{wrap:!0,gap:6,children:[k.map(e=>(0,b.jsx)(l.Chip,{label:0===e?'None':`${e} min`,selected:W===e,onPress:()=>V(e)},e)),(0,b.jsx)(l.Stepper,{value:W,min:0,max:240,onChange:V,label:"break minutes"})]}),(0,b.jsx)(l.T,{size:13,colour:c.colours.muted,children:"Reason (required, kept in the audit trail)"}),(0,b.jsx)(l.Row,{wrap:!0,gap:6,children:j.map(e=>(0,b.jsx)(l.Chip,{label:e,selected:G===e,onPress:()=>K(G===e?null:e)},e))}),(0,b.jsx)(l.Field,{label:G?'Add detail (optional)':'Or type a reason',value:U,onChangeText:Z,placeholder:"e.g. stayed late for a function",maxLength:150}),(0,b.jsxs)(l.Card,{style:{backgroundColor:c.colours.surface2},children:[(0,b.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(l.T,{children:"Paid hours"}),(0,b.jsx)(l.T,{weight:"bold",colour:c.colours.gold,children:null!=ne?(0,h.hmDur)(ne):'still on shift'})]}),te&&e?.out?(0,b.jsxs)(l.Muted,{children:["Was ",(0,h.hmDur)(te.paid)," (",(0,u.hm)(new Date(e.in)),"\u2013",(0,u.hm)(new Date(e.out)),", ",te.brk,"m break)"]}):null,se?(0,b.jsx)(l.T,{size:13,colour:c.colours.amber,children:"This entry was confirmed. Saving puts it back to Awaiting sign-off (logged)."}):null]}),oe?(0,b.jsx)(l.T,{size:13,colour:c.colours.red,children:oe}):null,J?(0,b.jsx)(l.T,{size:13,colour:c.colours.red,children:J}):null,(0,b.jsx)(l.Button,{testID:"ov-save",kind:"success",label:e?'Save change':'Add entry',disabled:!!oe||!ie||X.trim().length<3,onPress:()=>{r.useOwner.getState().overrideEntry({id:e?.id,staffId:t,date:n,in:ae,out:le,breakMins:W,reason:X.slice(0,200),by:d,byId:I,now:v.toISOString(),request:o?.id})?(o&&r.useOwner.getState().resolveTimeRequest(o.id,'applied',d,v.toISOString()),i()):Q('Couldn\u2019t save: check the times and the reason.')}}),T?(0,b.jsx)(a.default,{style:{alignItems:'center',width:'100%'},children:(0,b.jsx)(l.Button,{testID:"ov-delete-entry",kind:"ghost",label:"Delete entry",accessibilityLabel:"Delete entry",onPress:()=>$(!0),style:{minHeight:48,minWidth:160}})}):null,e&&D?(0,b.jsx)(x.DeleteShiftSheet,{a:e,onClose:()=>$(!1),onDeleted:i}):null,e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(f.SectionHead,{title:"Audit trail",sub:"Every change: what, from, to, who, when and why"}),(0,b.jsx)(B,{a:e})]}):null]})}function P(e,t){const n=new Map;return e.forEach(e=>{e.date({date:e,n:t})).sort((e,t)=>t.date.localeCompare(e.date))}},1184,[827,1182,34,402,102,794,925,891,1094,858,821,1175,1084,1185,872,1186,25]); diff --git a/customer-app/admin.html b/customer-app/admin.html index db8bc4a3cc709d2c34123a0746c1e1e33aeb872c..46fada8660c5288428c5b65cb6d73de518a80ea4 100644 --- a/customer-app/admin.html +++ b/customer-app/admin.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/customer-app/customer.html b/customer-app/customer.html index db8bc4a3cc709d2c34123a0746c1e1e33aeb872c..46fada8660c5288428c5b65cb6d73de518a80ea4 100644 --- a/customer-app/customer.html +++ b/customer-app/customer.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/customer-app/customer/anchorage.html b/customer-app/customer/anchorage.html index db8bc4a3cc709d2c34123a0746c1e1e33aeb872c..46fada8660c5288428c5b65cb6d73de518a80ea4 100644 --- a/customer-app/customer/anchorage.html +++ b/customer-app/customer/anchorage.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/customer-app/customer/anchorage/book.html b/customer-app/customer/anchorage/book.html index db8bc4a3cc709d2c34123a0746c1e1e33aeb872c..46fada8660c5288428c5b65cb6d73de518a80ea4 100644 --- a/customer-app/customer/anchorage/book.html +++ b/customer-app/customer/anchorage/book.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/customer-app/customer/anchorage/feedback.html b/customer-app/customer/anchorage/feedback.html index db8bc4a3cc709d2c34123a0746c1e1e33aeb872c..46fada8660c5288428c5b65cb6d73de518a80ea4 100644 --- a/customer-app/customer/anchorage/feedback.html +++ b/customer-app/customer/anchorage/feedback.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/customer-app/customer/anchorage/gift.html b/customer-app/customer/anchorage/gift.html index db8bc4a3cc709d2c34123a0746c1e1e33aeb872c..46fada8660c5288428c5b65cb6d73de518a80ea4 100644 --- a/customer-app/customer/anchorage/gift.html +++ b/customer-app/customer/anchorage/gift.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/customer-app/customer/anchorage/lost.html b/customer-app/customer/anchorage/lost.html index db8bc4a3cc709d2c34123a0746c1e1e33aeb872c..46fada8660c5288428c5b65cb6d73de518a80ea4 100644 --- a/customer-app/customer/anchorage/lost.html +++ b/customer-app/customer/anchorage/lost.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/customer-app/customer/anchorage/loyalty.html b/customer-app/customer/anchorage/loyalty.html index db8bc4a3cc709d2c34123a0746c1e1e33aeb872c..46fada8660c5288428c5b65cb6d73de518a80ea4 100644 --- a/customer-app/customer/anchorage/loyalty.html +++ b/customer-app/customer/anchorage/loyalty.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/customer-app/customer/anchorage/merch.html b/customer-app/customer/anchorage/merch.html index db8bc4a3cc709d2c34123a0746c1e1e33aeb872c..46fada8660c5288428c5b65cb6d73de518a80ea4 100644 --- a/customer-app/customer/anchorage/merch.html +++ b/customer-app/customer/anchorage/merch.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/customer-app/customer/anchorage/offers.html b/customer-app/customer/anchorage/offers.html index db8bc4a3cc709d2c34123a0746c1e1e33aeb872c..46fada8660c5288428c5b65cb6d73de518a80ea4 100644 --- a/customer-app/customer/anchorage/offers.html +++ b/customer-app/customer/anchorage/offers.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/customer-app/customer/anchorage/refer.html b/customer-app/customer/anchorage/refer.html index db8bc4a3cc709d2c34123a0746c1e1e33aeb872c..46fada8660c5288428c5b65cb6d73de518a80ea4 100644 --- a/customer-app/customer/anchorage/refer.html +++ b/customer-app/customer/anchorage/refer.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/customer-app/customer/anchorage/waitlist.html b/customer-app/customer/anchorage/waitlist.html index db8bc4a3cc709d2c34123a0746c1e1e33aeb872c..46fada8660c5288428c5b65cb6d73de518a80ea4 100644 --- a/customer-app/customer/anchorage/waitlist.html +++ b/customer-app/customer/anchorage/waitlist.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/customer-app/customer/anchorage/whatson.html b/customer-app/customer/anchorage/whatson.html index db8bc4a3cc709d2c34123a0746c1e1e33aeb872c..46fada8660c5288428c5b65cb6d73de518a80ea4 100644 --- a/customer-app/customer/anchorage/whatson.html +++ b/customer-app/customer/anchorage/whatson.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/customer-app/customer/basket.html b/customer-app/customer/basket.html index db8bc4a3cc709d2c34123a0746c1e1e33aeb872c..46fada8660c5288428c5b65cb6d73de518a80ea4 100644 --- a/customer-app/customer/basket.html +++ b/customer-app/customer/basket.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/customer-app/customer/profile.html b/customer-app/customer/profile.html index db8bc4a3cc709d2c34123a0746c1e1e33aeb872c..46fada8660c5288428c5b65cb6d73de518a80ea4 100644 --- a/customer-app/customer/profile.html +++ b/customer-app/customer/profile.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/customer-app/demo.html b/customer-app/demo.html index db8bc4a3cc709d2c34123a0746c1e1e33aeb872c..46fada8660c5288428c5b65cb6d73de518a80ea4 100644 --- a/customer-app/demo.html +++ b/customer-app/demo.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/customer-app/display.html b/customer-app/display.html index db8bc4a3cc709d2c34123a0746c1e1e33aeb872c..46fada8660c5288428c5b65cb6d73de518a80ea4 100644 --- a/customer-app/display.html +++ b/customer-app/display.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/customer-app/index.html b/customer-app/index.html index c941ffee31402c2c4d3344ae5b61eb238234edf3..12212833ac527567d1f50fcb6fa907cabd383a1a 100644 --- a/customer-app/index.html +++ b/customer-app/index.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/customer-app/kitchen.html b/customer-app/kitchen.html index db8bc4a3cc709d2c34123a0746c1e1e33aeb872c..46fada8660c5288428c5b65cb6d73de518a80ea4 100644 --- a/customer-app/kitchen.html +++ b/customer-app/kitchen.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/customer-app/owner.html b/customer-app/owner.html index db8bc4a3cc709d2c34123a0746c1e1e33aeb872c..46fada8660c5288428c5b65cb6d73de518a80ea4 100644 --- a/customer-app/owner.html +++ b/customer-app/owner.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/customer-app/staff.html b/customer-app/staff.html index db8bc4a3cc709d2c34123a0746c1e1e33aeb872c..46fada8660c5288428c5b65cb6d73de518a80ea4 100644 --- a/customer-app/staff.html +++ b/customer-app/staff.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/customer-app/sw.js b/customer-app/sw.js index dceed4165d60e412bfb2fc06d36a13feee1a3c90..38f981631a426506588a59b686ceb3c1d177d3c2 100644 --- a/customer-app/sw.js +++ b/customer-app/sw.js @@ -1,7 +1,7 @@ // Anchorage service worker: precache the app shell so it opens offline after the first visit. -const V = "cc-customer-f9336a5689"; +const V = "cc-customer-a01c55df81"; const BASE = "/customer-app/"; -const PRECACHE = ["/customer-app/apple-touch-icon.png", "/customer-app/assets/assets/brand/3idiots-hero.e5dfd53739f05086b1956e72d585a66a.png", "/customer-app/assets/assets/brand/3idiots.df4a76d2130f0e5b0042f06a8c88693a.png", "/customer-app/assets/assets/brand/abbotsford-hero.78fcb8ee06ee22c4ca659c9254db7512.png", "/customer-app/assets/assets/brand/abbotsford.b26602bba5ce4969733c5422a45ad053.png", "/customer-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/customer-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/customer-app/assets/assets/brand/brae.8de9e89ac30966c6669de990370d8e40.png", "/customer-app/assets/assets/brand/cecchinis-hero.f77780fcc94fd668cf35d66d6dc52d81.png", "/customer-app/assets/assets/brand/cecchinis.ebf752fef363247848ae7c0d91938765.png", "/customer-app/assets/assets/brand/drunkencoo-hero.65c21c4da9e466cf4bffc969639a1427.png", "/customer-app/assets/assets/brand/drunkencoo.f6d92af3b14e4205a3deaf4434754c51.png", "/customer-app/assets/assets/brand/greenside-hero.1caec5a6cb939434cccb5f3a613b50f8.png", "/customer-app/assets/assets/brand/greenside.9d1556db97dcb903a3c57e2063ee2255.png", "/customer-app/assets/assets/brand/kirkmichael-hero.63b13cde7fd82eb622622b39ac80c394.png", "/customer-app/assets/assets/brand/kirkmichael.63b13cde7fd82eb622622b39ac80c394.png", "/customer-app/assets/assets/brand/kirkton-hero.9d0837b292c2f4f30f4521d806bb28c3.png", "/customer-app/assets/assets/brand/kirkton.bcf8d846df4861474d224a7a77f498fb.png", "/customer-app/assets/assets/brand/mrbasrais-hero.4ce74641cfcf52d099157c84005b9d2a.png", "/customer-app/assets/assets/brand/mrbasrais.7cc4086dd12ace82529795f1c9f8c900.png", "/customer-app/assets/assets/brand/pizzaioli-hero.1896657c08264cefb49b401891d5448d.png", "/customer-app/assets/assets/brand/pizzaioli.db8c000b62ee407121aa8b90ce45e170.png", "/customer-app/assets/assets/brand/rupeeroom-hero.969fa372add526aaacf3a6c009b8ac92.png", "/customer-app/assets/assets/brand/rupeeroom.689e6fb536dc0845eeb174a1ec7bd346.png", "/customer-app/assets/assets/brand/saltmarsh.85a6a65732635e5148478d743d9ca884.png", "/customer-app/assets/assets/brand/smokinggoat-hero.0588f17ef0eed7f757f22916cd4d37db.png", "/customer-app/assets/assets/brand/smokinggoat.20a3a1970596ab43c5d6468d4ed549a7.png", "/customer-app/assets/assets/brand/souters.f4c58d9349b6e1700fe5abcc9e9b665c.png", "/customer-app/assets/assets/brand/wildings-hero-logo-text.4661e4b935726f2511f9c17a1567c89a.png", "/customer-app/assets/assets/brand/wildings.076f4fcd06d19a0af0205c410f461b14.png", "/customer-app/assets/assets/brand/williewastles-hero.b9d53d27b66f903b5618a7177b2ffad4.png", "/customer-app/assets/assets/brand/williewastles.055a77893ced99bf3a6c5402ba5baac6.png", "/customer-app/assets/assets/brand/yasmins-hero.a5aef62e37dfcecbe0afc056186f4ad9.png", "/customer-app/assets/assets/brand/yasmins.8482602e9f0a965655924835625cb02b.png", "/customer-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/customer-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/customer-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/customer-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/customer-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/customer-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/customer-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/customer-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/customer-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/customer-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/customer-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/customer-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/customer-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/customer-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/customer-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/customer-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/customer-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/customer-app/brand-logo.png", "/customer-app/favicon.ico", "/customer-app/icon-192.png", "/customer-app/icon-512.png", "/customer-app/icon-maskable-192.png", "/customer-app/icon-maskable-512.png", "/customer-app/manifest.webmanifest", "/customer-app/index.html", "/customer-app/_expo/static/js/web/bundle.js?v=f9336a5689472b98ea43031521c36c205b82803c7f1e24bb4e2d30e335dba92c"]; +const PRECACHE = ["/customer-app/apple-touch-icon.png", "/customer-app/assets/assets/brand/3idiots-hero.e5dfd53739f05086b1956e72d585a66a.png", "/customer-app/assets/assets/brand/3idiots.df4a76d2130f0e5b0042f06a8c88693a.png", "/customer-app/assets/assets/brand/abbotsford-hero.78fcb8ee06ee22c4ca659c9254db7512.png", "/customer-app/assets/assets/brand/abbotsford.b26602bba5ce4969733c5422a45ad053.png", "/customer-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/customer-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/customer-app/assets/assets/brand/brae.8de9e89ac30966c6669de990370d8e40.png", "/customer-app/assets/assets/brand/cecchinis-hero.f77780fcc94fd668cf35d66d6dc52d81.png", "/customer-app/assets/assets/brand/cecchinis.ebf752fef363247848ae7c0d91938765.png", "/customer-app/assets/assets/brand/drunkencoo-hero.65c21c4da9e466cf4bffc969639a1427.png", "/customer-app/assets/assets/brand/drunkencoo.f6d92af3b14e4205a3deaf4434754c51.png", "/customer-app/assets/assets/brand/greenside-hero.1caec5a6cb939434cccb5f3a613b50f8.png", "/customer-app/assets/assets/brand/greenside.9d1556db97dcb903a3c57e2063ee2255.png", "/customer-app/assets/assets/brand/kirkmichael-hero.63b13cde7fd82eb622622b39ac80c394.png", "/customer-app/assets/assets/brand/kirkmichael.63b13cde7fd82eb622622b39ac80c394.png", "/customer-app/assets/assets/brand/kirkton-hero.9d0837b292c2f4f30f4521d806bb28c3.png", "/customer-app/assets/assets/brand/kirkton.bcf8d846df4861474d224a7a77f498fb.png", "/customer-app/assets/assets/brand/mrbasrais-hero.4ce74641cfcf52d099157c84005b9d2a.png", "/customer-app/assets/assets/brand/mrbasrais.7cc4086dd12ace82529795f1c9f8c900.png", "/customer-app/assets/assets/brand/pizzaioli-hero.1896657c08264cefb49b401891d5448d.png", "/customer-app/assets/assets/brand/pizzaioli.db8c000b62ee407121aa8b90ce45e170.png", "/customer-app/assets/assets/brand/rupeeroom-hero.969fa372add526aaacf3a6c009b8ac92.png", "/customer-app/assets/assets/brand/rupeeroom.689e6fb536dc0845eeb174a1ec7bd346.png", "/customer-app/assets/assets/brand/saltmarsh.85a6a65732635e5148478d743d9ca884.png", "/customer-app/assets/assets/brand/smokinggoat-hero.0588f17ef0eed7f757f22916cd4d37db.png", "/customer-app/assets/assets/brand/smokinggoat.20a3a1970596ab43c5d6468d4ed549a7.png", "/customer-app/assets/assets/brand/souters.f4c58d9349b6e1700fe5abcc9e9b665c.png", "/customer-app/assets/assets/brand/wildings-hero-logo-text.4661e4b935726f2511f9c17a1567c89a.png", "/customer-app/assets/assets/brand/wildings.076f4fcd06d19a0af0205c410f461b14.png", "/customer-app/assets/assets/brand/williewastles-hero.b9d53d27b66f903b5618a7177b2ffad4.png", "/customer-app/assets/assets/brand/williewastles.055a77893ced99bf3a6c5402ba5baac6.png", "/customer-app/assets/assets/brand/yasmins-hero.a5aef62e37dfcecbe0afc056186f4ad9.png", "/customer-app/assets/assets/brand/yasmins.8482602e9f0a965655924835625cb02b.png", "/customer-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/customer-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/customer-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/customer-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/customer-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/customer-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/customer-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/customer-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/customer-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/customer-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/customer-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/customer-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/customer-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/customer-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/customer-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/customer-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/customer-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/customer-app/brand-logo.png", "/customer-app/favicon.ico", "/customer-app/icon-192.png", "/customer-app/icon-512.png", "/customer-app/icon-maskable-192.png", "/customer-app/icon-maskable-512.png", "/customer-app/manifest.webmanifest", "/customer-app/index.html", "/customer-app/_expo/static/js/web/bundle.js?v=a01c55df81f1649539692b06c7f2a87668f9647a80a327ab35a8d58bd1a5cd79"]; // Hugging Face serves large files (fonts) through a redirect to its CDN. Browsers refuse to hand a *redirected* cached // response to a page, so store a plain copy instead (otherwise fonts, and so the app, fail to load offline). const plain = r => r.redirected ? r.blob().then(b => new Response(b, { status: 200, headers: { 'Content-Type': r.headers.get('Content-Type') || b.type || 'application/octet-stream' } })) : Promise.resolve(r); diff --git a/customer-app/team.html b/customer-app/team.html index db8bc4a3cc709d2c34123a0746c1e1e33aeb872c..46fada8660c5288428c5b65cb6d73de518a80ea4 100644 --- a/customer-app/team.html +++ b/customer-app/team.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/display-app/_expo/static/js/web/bundle.js b/display-app/_expo/static/js/web/bundle.js index 4758f24d0b898666b84efd999a92a411c0d9fe2d..7c08c88210adf371c19ad6b6551d52a9f15dd3aa 100644 --- a/display-app/_expo/static/js/web/bundle.js +++ b/display-app/_expo/static/js/web/bundle.js @@ -872,7 +872,7 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{v __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},789,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},790,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},791,[]); -__d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ChefApp=function({section:e}={}){const{r:s,rid:o,me:n,now:L}=(0,M.useChef)(3e4);(0,fe.useReviewAlerts)(o);const _=(0,N.useSignedIn)(),U=_?.id??M.CHEF_ID,q=_?.ownerAccess&&'owner'!==_.role?'owner privileges':_?.managerAccess&&'staff'===_.role?'manager privileges':'',be=(0,xe.useSync)(e=>e.perms),ye=be.includes('*')||be.includes('takings.view');(0,i.useSoldOutLink)(!0,(_?.name??n).replace(' (example)',''));const Se=e?Te[e]:void 0,[Ie,He]=(0,I.useState)(Se?.tab??'home'),[Re,Ae]=(0,I.useState)(Se?.k??null),[De,Be]=(0,I.useState)(Se?.stock??'levels'),[$e,Oe]=(0,I.useState)(void 0),[Ee,Fe]=(0,I.useState)(Se?.gp??'dishes'),Le=(0,I.useRef)(null),Ge=(0,k.ymd)(L),Ne=(0,k.ymd)(new Date(L.getTime()+864e5));(0,p.useTipsPosted)(o,Ge);const Me=(0,X.useTravelDay)('chef',Ge),We='home'===Ie&&!Me;(0,P.useKitchenTodoChime)(o,Ge,()=>Ue('kitchen','bookings')),(0,he.useAlertWatcher)(o,{kinds:['takeaway']}),(0,I.useEffect)(()=>{(0,N.ensureAttendance)((new Date).toISOString().slice(0,10),L)},[]);const Ke=(0,I.useRef)({t:'home',k:null});Ke.current={t:Ie,k:Re};const Ve=(0,I.useRef)([]),ze=(0,l.useScrollMemory)(Le),Ue=(0,I.useCallback)((e,t=null)=>{'takings'!==t||ye||(t=null);const s=Ke.current;s.t===e&&s.k===t||(Ve.current=[...Ve.current,{...s,y:ze.leave()}].slice(-30),ze.restore(0)),He(e),Ae(t)},[ye]),qe=(0,I.useCallback)(()=>{if((0,r.runBackLayer)())return!0;const e=Ke.current;let t=Ve.current.pop();for(;t&&t.t===e.t&&t.k===e.k;)t=Ve.current.pop();if(!t&&'home'===e.t&&!e.k)return!1;const s=t??{t:'home',k:null};return ze.leave(),He(s.t),Ae(s.k),ze.restore(s.y??0),!0},[]);(0,r.useWebBack)(qe);const Qe=(0,r.useInnerBackShown)();(0,I.useEffect)(()=>{c.PITCH&&(globalThis.__pitchGo=(e,t=null,s)=>{'stock'===e&&s&&Be(s),'gp'===e&&s&&Fe(s),Ue(e,t)})},[Ue]),(0,f.useShiftReminders)({rid:o,staffId:U,name:n,kitchen:!0}),(0,C.useScheduledNotices)({rid:o,staffId:_?.id??'',name:n,onOpen:e=>{'orderlists'===e&&Ue('kitchen','orderlists'),'chat'===e&&Ue('kitchen','live')}}),(0,T.useOffRotaPrompt)({rid:o,staffId:_?.id??''}),(0,I.useEffect)(()=>{const e=H.default.addEventListener('hardwareBackPress',qe);return()=>e.remove()},[qe]),(0,I.useEffect)(()=>{'takings'!==Re||ye||(Ae(null),He('kitchen'))},[Re,ye]);const Ye=Ce.filter(e=>'takings'!==e.id||ye),Je=Re&&('takings'!==Re||ye)?Ce.find(e=>e.id===Re):null,Xe=((0,D.default)().width,Je?Je.title:{home:'Today in the kitchen',stock:c.PITCH?'Stock':'Deliveries & stock',gp:'GP & costing',creator:le.CREATOR_TITLE,orders:'Orders',kitchen:'Kitchen'}[Ie]);return(0,ve.jsxs)($.SafeAreaView,{style:{flex:1,backgroundColor:G.colours.bg},edges:['top','bottom'],children:[(0,ve.jsxs)(B.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:G.colours.border,gap:6},children:[(0,ve.jsx)(B.default,{style:{position:'absolute',top:4,right:6,zIndex:5,flexDirection:'row',alignItems:'center'},children:(0,ve.jsx)(E.VoiceSlot,{size:44})}),(0,ve.jsx)(B.default,{testID:"header-me-wrap",style:{alignItems:'flex-start',minHeight:44,justifyContent:'center',maxWidth:'70%'},children:(0,ve.jsx)(B.default,{testID:"header-me",accessibilityLabel:`Signed in as ${n.replace(' (example)','')}, Head Chef${q?`, ${q}`:''}`,style:{borderWidth:1,borderColor:G.colours.gold,borderRadius:16,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%'},children:(0,ve.jsxs)(F.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,ve.jsx)(ie.StaffAvatar,{id:M.CHEF_ID,size:24,ring:!1}),(0,ve.jsxs)(B.default,{style:{flexShrink:1},children:[(0,ve.jsxs)(F.T,{size:13,weight:"semibold",colour:G.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[n.replace(' (example)','')," \xb7 Head Chef"]}),q?(0,ve.jsx)(F.Muted,{center:!1,size:10,numberOfLines:1,children:q}):null]})]})})}),(0,ve.jsx)(O.VenueHeaderBlock,{rid:o,name:s.name,badge:"CHEF",place:"Head Chef app"}),(0,ve.jsx)(R.default,{accessibilityRole:"button",accessibilityLabel:"Open CoverCharge for Staff",onPress:()=>{const e=(0,ae.appUrl)('staff');e&&window.location.assign(e)},style:{alignSelf:'center',borderWidth:1,borderColor:G.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:3,minHeight:44,justifyContent:'center'},children:(0,ve.jsx)(F.T,{size:13,colour:G.colours.gold,children:"Staff app \u203a"})})]}),(0,ve.jsxs)(A.default,{ref:Le,...ze.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:[(0,ve.jsx)(r.BackTitleRow,{back:!('home'===Ie&&!Re||Qe),onBack:qe,title:Xe}),'home'===Ie?(0,ve.jsx)(X.DayBar,{app:"chef",today:Ge}):null,'home'===Ie&&Me?(0,ve.jsx)(X.DayView,{rid:o,day:Me,today:Ge,app:"chef"}):null,'home'===Ie?(0,ve.jsx)(oe.WhoBar,{}):null,We&&_?(0,ve.jsx)(h.MyTasksToday,{rid:o,staffId:_.id,name:_.name,onShift:(0,f.shiftNow)(_.id,L.getTime()).on}):null,We?(0,ve.jsx)(p.TodaysTipsCard,{rid:o,today:Ge}):null,We?(0,ve.jsx)(p.TipsPotCard,{rid:o,today:Ge}):null,We?(0,ve.jsx)(b.CoversToday,{rid:o,onPress:()=>Ue('kitchen','bookings')}):null,We?(0,ve.jsx)(y.LastFoodBanner,{rid:o,now:L}):null,We?(0,ve.jsx)(x.NextTableFreeCard,{rid:o,now:L}):null,We?(0,ve.jsx)(j.KitchenSignoffs,{rid:o,today:Ge,by:n,app:"chef"}):null,We?(0,ve.jsxs)(B.default,{style:{gap:4},children:[(0,ve.jsx)(j.PlattersBooked,{rid:o,date:Ge,label:"Platters booked today"}),(0,ve.jsx)(j.PlattersBooked,{rid:o,date:Ne,label:"Platters booked tomorrow"})]}):null,We?(0,ve.jsx)(me.ChefAssistantButton,{}):null,We?(0,ve.jsx)(Pe,{go:(e,t)=>{'stock'===e&&t&&Be(t),'gp'===e&&t&&Fe(t),'orders'===e&&Oe(t),Ue(e,'kitchen'===e?t??null:null)}}):null,'stock'!==Ie||c.PITCH?null:(0,ve.jsx)(Y.KitchenCosts,{rid:o,me:(_?.name??n).replace(' (example)',''),actor:{name:(_?.name??n).replace(' (example)',''),role:'head-chef'},initial:'deliveries'===De?'deliveries':'take'===De?'count':'deliveries'},`s-${De}`),'gp'!==Ie||c.PITCH?null:(0,ve.jsx)(Y.KitchenCosts,{rid:o,me:(_?.name??n).replace(' (example)',''),actor:{name:(_?.name??n).replace(' (example)',''),role:'head-chef'},initial:"dishgp"},`g-${Ee}`),'stock'===Ie&&c.PITCH?(0,ve.jsx)(Q.StockScreen,{initial:De},De):null,'gp'===Ie&&c.PITCH?(0,ve.jsx)(W.GpScreen,{initial:Ee},Ee):null,'creator'===Ie?(0,ve.jsx)(le.DishCreator,{rid:o,canPublish:!1}):null,'orders'===Ie?(0,ve.jsx)(z.OrdersScreen,{focus:$e},$e??'all'):null,'kitchen'!==Ie||Je?null:(0,ve.jsxs)(B.default,{style:{gap:10},children:[(0,ve.jsx)(B.default,{style:{borderRadius:14,borderWidth:1,borderColor:G.colours.border,backgroundColor:G.colours.surface,overflow:'hidden'},children:Ye.map((e,t)=>(0,ve.jsx)(R.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>Ue(Ie,e.id),style:({pressed:e})=>({padding:12,borderTopWidth:t?1:0,borderColor:G.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,ve.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,ve.jsxs)(B.default,{style:{flex:1},children:[(0,ve.jsx)(F.T,{weight:"medium",children:e.title}),(0,ve.jsx)(F.Muted,{children:e.sub})]}),(0,ve.jsx)(F.T,{colour:G.colours.muted,children:"\u203a"})]})},e.id))}),(0,ve.jsx)(F.Muted,{children:"Head Chef sees kitchen, stock, food costs and GP. Payroll, wages and the restaurant's billing stay in CoverCharge for Managers."}),(0,ve.jsxs)(F.Muted,{center:!0,children:["Head Chef app \xb7 ",d.APP_VERSION," \xb7 ",'live'===xe.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),'myshift'===Re&&U?(0,ve.jsxs)(B.default,{style:{gap:10},testID:"chef-myshift",children:[(0,ve.jsx)(te.ClockInOut,{}),(0,ve.jsx)(se.MyUpcomingShifts,{staffId:U,team:!0})]}):null,'mypay'===Re?(0,ve.jsxs)(B.default,{style:{gap:10},testID:"chef-mypay",children:[(0,ve.jsx)(Z.MyPeriods,{staffId:U}),(0,ve.jsx)(J.MyHoursPay,{staffId:U}),(0,ve.jsx)(ee.MyTips,{staffId:U}),(0,ve.jsx)(F.Card,{children:(0,ve.jsx)(u.PhoneAlerts,{})})]}):null,'alerts'===Re?(0,ve.jsx)(B.default,{testID:"chef-alerts",children:(0,ve.jsx)(u.PhoneAlerts,{})}):null,'avatar'===Re?(0,ve.jsx)(t.AvatarMaker,{meId:_?.id??M.CHEF_ID,me:n}):null,'reviews'===Re?(0,ve.jsx)(ge.ReviewsSection,{rid:o,mode:"read",venueName:s.name}):null,'bookings'===Re?(0,ve.jsx)(S.TodaysBookings,{rid:o,today:Ge,by:n,app:"chef"}):null,'specials'===Re?(0,ve.jsx)(de.SpecialsEditor,{rid:o,me:n,app:"chef",now:L}):null,'forecast'===Re?(0,ve.jsx)(K.ChefForecast,{openPrep:()=>Ue('kitchen','prep')}):null,'prep'===Re?(0,ve.jsx)(V.PrepScreen,{}):null,'live'===Re?(0,ve.jsx)(V.TeamScreen,{}):null,'waste'===Re?(0,ve.jsx)(V.WasteScreen,{}):null,'recipes'===Re?(0,ve.jsx)(pe.RecipeCards,{rid:o,actor:{name:n,role:'head-chef'},mode:"edit"}):null,'allergens'===Re?(0,ve.jsx)(V.AllergenScreen,{openCards:()=>Ue('kitchen','recipes')}):null,'compliance'===Re?(0,ve.jsx)(V.ComplianceScreen,{}):null,'takings'===Re&&ye?(0,ve.jsx)(p.CashUpScreen,{rid:o,today:Ge,canEdit:!1,chartsOnly:!0,who:{id:U,name:n.replace(' (example)','')}}):null,'board'===Re?(0,ve.jsx)(ke.QuestionBoard,{rid:o,today:Ge,manager:!1,by:""}):null,'teamtasks'===Re?(0,ve.jsx)(h.KitchenTeamTasks,{rid:o,actor:_}):null,'orderlists'===Re?(0,ve.jsx)(v.OrderListsScreen,{rid:o,today:Ge,editor:!0,who:{id:U,name:n.replace(' (example)','')}}):null,'foodsafety'===Re?(0,ve.jsx)(w.FoodSafetyCard,{children:(0,ve.jsx)(R.default,{accessibilityRole:"button",onPress:()=>Ue('kitchen','haccp'),children:(0,ve.jsx)(F.T,{colour:G.colours.gold,children:"Today\u2019s temperature log \u203a"})})}):null,'haccp'===Re?(0,ve.jsx)(re.HaccpLog,{mode:"chef",me:n,meId:M.CHEF_ID,now:L}):null,'accidents'===Re?(0,ve.jsx)(ne.AccidentBook,{app:"chef",me:n,meId:M.CHEF_ID,now:L,seeAll:!1}):null]}),(0,ve.jsx)(je.BottomTabs,{tablist:!0,background:G.colours.surface,active:Ie,onPress:e=>Ue(e),tabs:we.map(e=>({id:e.id,label:e.label,short:'creator'===e.id?'Creator':void 0,icon:e.icon}))}),(0,ve.jsx)(me.ChefAssistantSheet,{go:(e,t)=>{'orders'===e?(Oe(t),Ue('orders')):'gp'===e?Ue('gp'):Ue('kitchen',e)}}),(0,ve.jsx)(ce.AlertHost,{variant:"chef",rid:o,skipTakeaway:!0}),(0,ve.jsx)(ue.KitchenFlash,{rid:o,me:n})]})};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),i=_r(_d[3]),n=_r(_d[4]),l=_r(_d[5]),r=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),f=_r(_d[12]),k=_r(_d[13]),b=_r(_d[14]),y=_r(_d[15]),x=_r(_d[16]),j=_r(_d[17]),v=_r(_d[18]),w=_r(_d[19]),C=_r(_d[20]),T=_r(_d[21]),P=_r(_d[22]),S=_r(_d[23]),I=_r(_d[24]),H=e(_r(_d[25]));_r(_d[26]);var R=e(_r(_d[27])),A=e(_r(_d[28])),D=e(_r(_d[29])),B=e(_r(_d[30])),$=_r(_d[31]),O=_r(_d[32]),E=_r(_d[33]),F=_r(_d[34]),L=_r(_d[35]),G=_r(_d[36]),N=_r(_d[37]),_=_r(_d[38]),M=_r(_d[39]),W=_r(_d[40]),K=_r(_d[41]),V=_r(_d[42]),z=_r(_d[43]),U=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),Y=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),se=_r(_d[53]),oe=_r(_d[54]),ie=_r(_d[55]),ae=_r(_d[56]),ne=_r(_d[57]),le=_r(_d[58]),re=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),pe=_r(_d[64]),ge=_r(_d[65]),fe=_r(_d[66]),ke=_r(_d[67]),be=_r(_d[68]),me=_r(_d[69]),ye=_r(_d[70]),xe=_r(_d[71]),je=_r(_d[72]),ve=_r(_d[73]);s.LIVE_HEAD_CHEF&&(0,o.requireRealData)();const we=[{id:'home',label:'Home',icon:'home'},{id:'stock',label:'Stock',icon:'box'},{id:'gp',label:'GP',icon:'forecast'},{id:'creator',label:le.CREATOR_TITLE,icon:'sparkle'},{id:'orders',label:'Orders',icon:'orders'},{id:'kitchen',label:'Kitchen',icon:'platter'}],Ce=[{id:'alerts',title:'Turn on alerts',sub:'Get your reminders on this phone, even with the app closed'},{id:'avatar',title:'My avatar',sub:'Animals, Bar & kitchen, sea, sport, colours, patterns or your own photo'},{id:'reviews',title:'Reviews',sub:'Published reviews, newest first'},{id:'myshift',title:'My shifts & clock in',sub:'Clock in and out (checks you are at the venue), breaks, and your shifts on the rota'},{id:'mypay',title:'My pay & tips',sub:'Your hours, tips share, tip goal, paydays and payslip info. Only you see this'},{id:'takings',title:'Takings & tips graphs',sub:'Daily cash ups, weekly sales, this week vs last, categories and the Tips pot (view only)'},{id:'bookings',title:'Today\u2019s bookings',sub:'Covers, allergens to sign off, platters and other reservations, dogs, access and vegan/vegetarian'},{id:'recipes',title:'Recipe cards',sub:'Plating photo, ingredients, method, allergens, section and price; you sign each card off before it goes live'},{id:'specials',title:'Specials board',sub:'Photo of the chalkboard or typed specials with allergens; shown in the customer app'},{id:'board',title:'Question board',sub:'Ask the team anything anonymously, and vote'},{id:'teamtasks',title:'Kitchen team tasks',sub:'Daily tasks for your chefs, commis and KPs'},{id:'orderlists',title:'Order lists',sub:'Alsons drinks, Cash and carry: add items, tick on the day, finish and carry over'},{id:'foodsafety',title:'Food safety (CookSafe)',sub:'Based on CookSafe (Food Standards Scotland). Full logs coming in the next update'},{id:'haccp',title:'Food safety log (HACCP)',sub:'Temperatures, cleaning and allergen checks; voice entry; limits; EHO export'},{id:'accidents',title:'Accident book',sub:'Accidents and near misses; you see your own entries'},{id:'forecast',title:'Forecast',sub:'Covers per day for the week ahead, and prep from the forecast'},{id:'prep',title:'Prep list',sub:'From the forecast and bookings, tick off as you go'},{id:'live',title:'Live tickets, sold out, team & chat',sub:'Orders, readiness alerts, sold out, who\u2019s on, rota, team chat and private messages'},{id:'waste',title:'Waste log',sub:'Item, quantity, reason and cost; weekly total and % of sales'},{id:'allergens',title:'Allergens',sub:'14-allergen matrix from the recipe cards, costing cross-check and audit log'},{id:'compliance',title:'Kitchen compliance',sub:'Fridge, freezer, cooking and cooling temps; cleaning; daily checks'}],Te={stock:{tab:'stock',stock:'levels'},'stock-take':{tab:'stock',stock:'take'},deliveries:{tab:'stock',stock:'deliveries'},gp:{tab:'gp',gp:'dishes'},'price-changes':{tab:'gp',gp:'changes'},'gp-week':{tab:'gp',gp:'week'},'menu-engineering':{tab:'gp',gp:'engineering'},orders:{tab:'orders'},forecast:{tab:'kitchen',k:'forecast'},prep:{tab:'kitchen',k:'prep'},live:{tab:'kitchen',k:'live'},waste:{tab:'kitchen',k:'waste'},recipes:{tab:'kitchen',k:'recipes'},'recipe-cards':{tab:'kitchen',k:'recipes'},allergens:{tab:'kitchen',k:'allergens'},compliance:{tab:'kitchen',k:'compliance'},haccp:{tab:'kitchen',k:'haccp'},specials:{tab:'kitchen',k:'specials'},accidents:{tab:'kitchen',k:'accidents'},'new-dish':{tab:'creator'}};function Pe({go:e}){const{k:t,c:s,menu:o,now:i,rid:l,me:r}=(0,M.useChef)(3e4),d=(0,U.useSheetReminders)(),u=(0,M.useWeek)(),{covers:h,label:p,enough:f,booked:k}=(0,M.useForecast)(),b=(0,z.useSuggestions)(),y=t.ingredients.filter(e=>e.onHand<=0||(0,M.isLow)(e.onHand,e.par)),x=b.filter(e=>e.ordersToday&&!e.placedToday),j=(0,_.priceImpacts)(o,t.recipes,t.ingredients,t.targetGp).filter(e=>e.dropped.length),v=t.deliveries.filter(e=>'expected'===e.status),w=!t.recipes.length||!t.ingredients.length,C=w?[]:s.filter(e=>e.below),T=(0,n.useLiveState)(),P=(0,be.useRecipeCards)(l).filter(e=>!e.signOff),S=(0,Y.useKitchenSummary)(l),[H,A]=(0,I.useState)(!1);return(0,ve.jsxs)(B.default,{style:{gap:12},testID:"chef-dashboard",children:[(0,ve.jsx)(re.MissedBanner,{mode:"chef",now:i,onPress:()=>e('kitchen','haccp')}),d.map(t=>(0,ve.jsx)(R.default,{accessibilityRole:"button",onPress:()=>e('orders',t.supplierId),children:(0,ve.jsxs)(F.Banner,{kind:'red'===t.tone?'danger':'warn',title:`\u23f0 ${t.text}`,children:["Tap to open the ",t.name," order sheet. Nothing is sent until you press Send."]})},t.supplierId)),P.length?(0,ve.jsx)(R.default,{testID:"cards-awaiting",accessibilityRole:"button",onPress:()=>e('kitchen','recipes'),children:(0,ve.jsxs)(F.Banner,{kind:"warn",title:`${P.length} recipe card${1===P.length?'':'s'} awaiting your sign-off`,children:[P.slice(0,4).map(e=>e.dish).join(', '),". Guests see \"awaiting allergen sign-off\" and cannot order these until you sign them off."]})}):null,(0,ve.jsx)(q.ShellfishTile,{rid:l,by:r,app:"chef",onOrder:()=>e('orders','os-kittyfisher')}),(0,ve.jsx)(F.Button,{testID:"chef-add-soldout",label:"Add sold out",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>A(!0),style:{minHeight:56}}),(0,ve.jsxs)(F.Row,{wrap:!0,gap:10,children:[c.PITCH?null:(0,ve.jsx)(M.Tile,{testID:"tile-gp",label:"Dishes under target GP",value:S.costed?`${S.below} of ${S.costed}`:'Nothing yet',sub:S.costed?`Average ${(0,M.pct1)(S.avgGp??0)} \xb7 target ${S.target}%`:'Record a delivery, then cost your recipe cards',tone:S.costed?S.below?'amber':'ok':void 0,onPress:()=>e('gp','dishes')}),c.PITCH?w?(0,ve.jsx)(M.Tile,{testID:"tile-gp",label:"GP this week vs target",value:"Nothing yet",sub:"Add ingredients and recipe costs to see GP",onPress:()=>e('gp','week')}):(0,ve.jsx)(M.Tile,{testID:"tile-gp",label:"GP this week vs target",value:(0,M.pct1)(u.theo),sub:`Target ${t.targetGp}% \xb7 actual ${(0,M.pct1)(u.actual)}`,tone:u.theoe('gp','week')}):null,c.PITCH?null:(0,ve.jsx)(M.Tile,{testID:"tile-stock",label:"Stock value",value:null!=S.stockValue?(0,L.gbp)(S.stockValue):'Nothing yet',sub:S.lastCount?`At cost, counted ${S.lastCount}`:'No stock counted yet',onPress:()=>e('stock','take')}),c.PITCH?(0,ve.jsx)(M.Tile,{testID:"tile-stock",label:"Stock value",value:t.ingredients.length?(0,L.gbp)((0,M.stockValue)(t.ingredients)):'Nothing yet',sub:t.ingredients.length?'At cost':'No stock counted yet',onPress:()=>e('stock','levels')}):null,(0,ve.jsx)(M.Tile,{label:"Items low or out",value:t.ingredients.length?`${y.length}`:'Nothing yet',sub:t.ingredients.length?y.slice(0,3).map(e=>e.name).join(', '):'No stock counted yet',tone:y.some(e=>e.onHand<=0)?'red':y.length?'amber':'ok',onPress:()=>e('stock','levels')}),(0,ve.jsx)(M.Tile,{label:"Waste this week",value:t.waste.length?(0,L.gbp)(u.wasteWeek):'Nothing yet',sub:u.sales?`${(0,M.pct1)(u.wasteWeek/u.sales*100)} of food sales`:'',onPress:()=>e('kitchen','waste')}),f?(0,ve.jsx)(M.Tile,{testID:"tile-forecast",label:"Covers forecast today",value:`${h}`,sub:p,onPress:()=>e('kitchen','forecast')}):(0,ve.jsx)(M.Tile,{testID:"tile-booked",label:"Booked so far today",value:'ready'===T?`${k}`:'connecting'===T?'Connecting\u2026':'Not connected',sub:"Not enough history for a forecast yet",onPress:()=>e('kitchen','bookings')}),(0,ve.jsx)(M.Tile,{label:"Orders due today",value:`${x.length}`,sub:x.map(e=>`${e.s.name} by ${e.s.cutoff}`).join(' \xb7 ')||'None',tone:x.some(e=>e.cutPassed)?'red':x.length?'amber':'ok',onPress:()=>e('orders')})]}),j.map(e=>(0,ve.jsxs)(F.Banner,{kind:"danger",title:`${e.ing.name} ${e.pct>0?'+':''}${e.pct.toFixed(0)}%: ${e.dropped.length} dish${1===e.dropped.length?'':'es'} drop below target`,children:[e.dropped.map(e=>e.item.name).join(', '),". Open GP \u203a Price changes."]},e.ing.id)),v.length?(0,ve.jsx)(R.default,{accessibilityRole:"button",onPress:()=>e('stock','deliveries'),children:(0,ve.jsx)(F.Banner,{kind:"info",title:`${v.length} deliver${1===v.length?'y':'ies'} to check in today`,children:"Count in against the order, flag shorts and price changes."})}):null,C.length?(0,ve.jsx)(R.default,{accessibilityRole:"button",onPress:()=>e('gp','dishes'),children:(0,ve.jsxs)(F.Banner,{kind:"warn",title:`${C.length} dishes below ${t.targetGp}% GP`,children:[C.slice(0,4).map(e=>e.item.name).join(', '),C.length>4?'\u2026':'']})}):null,(0,ve.jsx)(F.Row,{wrap:!0,gap:8,children:[['Recipe cards','recipes'],['Food safety log','haccp'],['Specials board','specials'],[le.CREATOR_TITLE,'creator'],['Forecast','forecast'],['Prep list','prep'],['Live tickets & sold out','live'],['Allergens','allergens'],['Accident book','accidents']].map(([t,s])=>(0,ve.jsx)(R.default,{accessibilityRole:"button",accessibilityLabel:t,onPress:()=>'creator'===s?e('creator'):e('kitchen',s),style:{flexGrow:1,flexBasis:140,padding:12,borderRadius:12,borderWidth:1.5,borderColor:G.colours.gold,backgroundColor:G.colours.surface},children:(0,ve.jsxs)(F.T,{weight:"semibold",children:[t," \u203a"]})},s))}),(0,ve.jsx)(F.Badge,{kind:"neutral",label:"Nothing is ordered or sent from here"}),(0,ve.jsx)(ye.SoldOutSheet,{visible:H,onClose:()=>A(!1),rid:l,by:r,hideLinks:!0,testID:"chef-soldout-sheet"})]})}},792,[793,978,884,979,986,1051,1052,1015,2,1053,1057,1058,1090,858,1095,1099,1100,1103,1104,1107,1108,1110,1111,1112,34,373,236,402,295,426,102,36,873,1137,794,867,821,1084,1139,1145,1148,1149,1152,1167,1168,1169,1171,1172,1173,1176,1179,1187,1188,1192,1193,925,1003,1194,1158,1195,1196,1197,1206,1199,1156,1208,1212,1189,874,1213,1154,987,1215,25]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ChefApp=function({section:e}={}){const{r:s,rid:i,me:n,now:L}=(0,_.useChef)(3e4);(0,be.useReviewAlerts)(i);const M=(0,G.useSignedIn)(),q=M?.id??_.CHEF_ID,Q=M?.ownerAccess&&'owner'!==M.role?'owner privileges':M?.managerAccess&&'staff'===M.role?'manager privileges':'',me=(0,je.useSync)(e=>e.perms),xe=me.includes('*')||me.includes('takings.view');(0,o.useSoldOutLink)(!0,(M?.name??n).replace(' (example)',''));const Re=e?Se[e]:void 0,[He,Ae]=(0,I.useState)(Re?.tab??'home'),[De,$e]=(0,I.useState)(Re?.k??null),[Be,Oe]=(0,I.useState)(Re?.stock??'levels'),[Ee,Fe]=(0,I.useState)(void 0),[Le,Ne]=(0,I.useState)(Re?.gp??'dishes'),Ge=(0,I.useRef)(null),Me=(0,b.ymd)(L),We=(0,b.ymd)(new Date(L.getTime()+864e5));(0,p.useTipsPosted)(i,Me);const Ke=(0,Z.useTravelDay)('chef',Me),Ve='home'===He&&!Ke;(0,P.useKitchenTodoChime)(i,Me,()=>Qe('kitchen','bookings')),(0,pe.useAlertWatcher)(i,{kinds:['takeaway']}),(0,I.useEffect)(()=>{(0,G.ensureAttendance)((new Date).toISOString().slice(0,10),L)},[]);const ze=(0,I.useRef)({t:'home',k:null});ze.current={t:He,k:De};const Ue=(0,I.useRef)([]),qe=(0,l.useScrollMemory)(Ge),Qe=(0,I.useCallback)((e,t=null)=>{'takings'!==t||xe||(t=null);const s=ze.current;s.t===e&&s.k===t||(Ue.current=[...Ue.current,{...s,y:qe.leave()}].slice(-30),qe.restore(0)),Ae(e),$e(t)},[xe]),Ye=(0,I.useCallback)(()=>{if((0,r.runBackLayer)())return!0;const e=ze.current;let t=Ue.current.pop();for(;t&&t.t===e.t&&t.k===e.k;)t=Ue.current.pop();if(!t&&'home'===e.t&&!e.k)return!1;const s=t??{t:'home',k:null};return qe.leave(),Ae(s.t),$e(s.k),qe.restore(s.y??0),!0},[]);(0,r.useWebBack)(Ye);const Je=(0,r.useInnerBackShown)();(0,I.useEffect)(()=>{c.PITCH&&(globalThis.__pitchGo=(e,t=null,s)=>{'stock'===e&&s&&Oe(s),'gp'===e&&s&&Ne(s),Qe(e,t)})},[Qe]),(0,f.useShiftReminders)({rid:i,staffId:q,name:n,kitchen:!0}),(0,C.useScheduledNotices)({rid:i,staffId:M?.id??'',name:n,onOpen:e=>{'orderlists'===e&&Qe('kitchen','orderlists'),'chat'===e&&Qe('kitchen','live')}}),(0,T.useOffRotaPrompt)({rid:i,staffId:M?.id??''}),(0,I.useEffect)(()=>{const e=R.default.addEventListener('hardwareBackPress',Ye);return()=>e.remove()},[Ye]),(0,I.useEffect)(()=>{'takings'!==De||xe||($e(null),Ae('kitchen'))},[De,xe]);const Xe=Pe.filter(e=>'takings'!==e.id||xe),Ze=De&&('takings'!==De||xe)?Pe.find(e=>e.id===De):null,et=((0,D.default)().width,Ze?Ze.title:{home:'Today in the kitchen',stock:c.PITCH?'Stock':'Deliveries & stock',gp:'GP & costing',creator:re.CREATOR_TITLE,orders:'Orders',rota:'Rota',kitchen:'Kitchen'}[He]);return(0,ve.jsxs)(B.SafeAreaView,{style:{flex:1,backgroundColor:N.colours.bg},edges:['top','bottom'],children:[(0,ve.jsxs)($.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:N.colours.border,gap:6},children:[(0,ve.jsx)($.default,{style:{position:'absolute',top:4,right:6,zIndex:5,flexDirection:'row',alignItems:'center'},children:(0,ve.jsx)(E.VoiceSlot,{size:44})}),(0,ve.jsx)($.default,{testID:"header-me-wrap",style:{alignItems:'flex-start',minHeight:44,justifyContent:'center',maxWidth:'70%'},children:(0,ve.jsx)($.default,{testID:"header-me",accessibilityLabel:`Signed in as ${n.replace(' (example)','')}, Head Chef${Q?`, ${Q}`:''}`,style:{borderWidth:1,borderColor:N.colours.gold,borderRadius:16,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%'},children:(0,ve.jsxs)(F.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,ve.jsx)(oe.StaffAvatar,{id:_.CHEF_ID,size:24,ring:!1}),(0,ve.jsxs)($.default,{style:{flexShrink:1},children:[(0,ve.jsxs)(F.T,{size:13,weight:"semibold",colour:N.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[n.replace(' (example)','')," \xb7 Head Chef"]}),Q?(0,ve.jsx)(F.Muted,{center:!1,size:10,numberOfLines:1,children:Q}):null]})]})})}),(0,ve.jsx)(O.VenueHeaderBlock,{rid:i,name:s.name,badge:"CHEF",place:"Head Chef app"}),(0,ve.jsx)(H.default,{accessibilityRole:"button",accessibilityLabel:"Open CoverCharge for Staff",onPress:()=>{const e=(0,ne.appUrl)('staff');e&&window.location.assign(e)},style:{alignSelf:'center',borderWidth:1,borderColor:N.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:3,minHeight:44,justifyContent:'center'},children:(0,ve.jsx)(F.T,{size:13,colour:N.colours.gold,children:"Staff app \u203a"})})]}),(0,ve.jsxs)(A.default,{ref:Ge,...qe.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:[(0,ve.jsx)(r.BackTitleRow,{back:!('home'===He&&!De||Je),onBack:Ye,title:et}),'home'===He?(0,ve.jsx)(Z.DayBar,{app:"chef",today:Me}):null,'home'===He&&Ke?(0,ve.jsx)(Z.DayView,{rid:i,day:Ke,today:Me,app:"chef"}):null,'home'===He?(0,ve.jsx)(ae.WhoBar,{}):null,Ve&&M?(0,ve.jsx)(h.MyTasksToday,{rid:i,staffId:M.id,name:M.name,onShift:(0,f.shiftNow)(M.id,L.getTime()).on}):null,Ve?(0,ve.jsx)(p.TodaysTipsCard,{rid:i,today:Me}):null,Ve?(0,ve.jsx)(p.TipsPotCard,{rid:i,today:Me}):null,Ve?(0,ve.jsx)(k.CoversToday,{rid:i,onPress:()=>Qe('kitchen','bookings')}):null,Ve?(0,ve.jsx)(y.LastFoodBanner,{rid:i,now:L}):null,Ve?(0,ve.jsx)(x.NextTableFreeCard,{rid:i,now:L}):null,Ve?(0,ve.jsx)(j.KitchenSignoffs,{rid:i,today:Me,by:n,app:"chef"}):null,Ve?(0,ve.jsxs)($.default,{style:{gap:4},children:[(0,ve.jsx)(j.PlattersBooked,{rid:i,date:Me,label:"Platters booked today"}),(0,ve.jsx)(j.PlattersBooked,{rid:i,date:We,label:"Platters booked tomorrow"})]}):null,Ve?(0,ve.jsx)(ye.ChefAssistantButton,{}):null,Ve?(0,ve.jsx)(Ie,{go:(e,t)=>{'stock'===e&&t&&Oe(t),'gp'===e&&t&&Ne(t),'orders'===e&&Fe(t),Qe(e,'kitchen'===e?t??null:null)}}):null,'stock'!==He||c.PITCH?null:(0,ve.jsx)(J.KitchenCosts,{rid:i,me:(M?.name??n).replace(' (example)',''),actor:{name:(M?.name??n).replace(' (example)',''),role:'head-chef'},initial:'deliveries'===Be?'deliveries':'take'===Be?'count':'deliveries'},`s-${Be}`),'gp'!==He||c.PITCH?null:(0,ve.jsx)(J.KitchenCosts,{rid:i,me:(M?.name??n).replace(' (example)',''),actor:{name:(M?.name??n).replace(' (example)',''),role:'head-chef'},initial:"dishgp"},`g-${Le}`),'stock'===He&&c.PITCH?(0,ve.jsx)(Y.StockScreen,{initial:Be},Be):null,'gp'===He&&c.PITCH?(0,ve.jsx)(W.GpScreen,{initial:Le},Le):null,'creator'===He?(0,ve.jsx)(re.DishCreator,{rid:i,canPublish:!1}):null,'orders'===He?(0,ve.jsx)(z.OrdersScreen,{focus:Ee},Ee??'all'):null,'rota'===He?(0,ve.jsx)(F.Card,{children:(0,ve.jsx)(U.KitchenRotaTab,{today:Me})}):null,'kitchen'!==He||Ze?null:(0,ve.jsxs)($.default,{style:{gap:10},children:[(0,ve.jsxs)($.default,{style:{borderRadius:14,borderWidth:1,borderColor:N.colours.border,backgroundColor:N.colours.surface,overflow:'hidden'},children:[Te.map(e=>(0,ve.jsx)(H.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:`${e.title}. ${e.sub}`,onPress:()=>Qe(e.id),style:({pressed:e})=>({padding:12,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,ve.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,ve.jsxs)($.default,{style:{flex:1},children:[(0,ve.jsx)(F.T,{weight:"medium",children:e.title}),(0,ve.jsx)(F.Muted,{children:e.sub})]}),(0,ve.jsx)(F.T,{colour:N.colours.muted,children:"\u203a"})]})},e.id)),Xe.map(e=>(0,ve.jsx)(H.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>Qe(He,e.id),style:({pressed:e})=>({padding:12,borderTopWidth:1,borderColor:N.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,ve.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,ve.jsxs)($.default,{style:{flex:1},children:[(0,ve.jsx)(F.T,{weight:"medium",children:e.title}),(0,ve.jsx)(F.Muted,{children:e.sub})]}),(0,ve.jsx)(F.T,{colour:N.colours.muted,children:"\u203a"})]})},e.id))]}),(0,ve.jsx)(F.Muted,{children:"Head Chef sees kitchen, stock, food costs and GP. Payroll, wages and the restaurant's billing stay in CoverCharge for Managers."}),(0,ve.jsxs)(F.Muted,{center:!0,children:["Head Chef app \xb7 ",d.APP_VERSION," \xb7 ",'live'===je.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),'myshift'===De&&q?(0,ve.jsxs)($.default,{style:{gap:10},testID:"chef-myshift",children:[(0,ve.jsx)(se.ClockInOut,{}),(0,ve.jsx)(ie.MyUpcomingShifts,{staffId:q,team:!0})]}):null,'mypay'===De?(0,ve.jsxs)($.default,{style:{gap:10},testID:"chef-mypay",children:[(0,ve.jsx)(ee.MyPeriods,{staffId:q}),(0,ve.jsx)(X.MyHoursPay,{staffId:q}),(0,ve.jsx)(te.MyTips,{staffId:q}),(0,ve.jsx)(F.Card,{children:(0,ve.jsx)(u.PhoneAlerts,{})})]}):null,'alerts'===De?(0,ve.jsx)($.default,{testID:"chef-alerts",children:(0,ve.jsx)(u.PhoneAlerts,{})}):null,'avatar'===De?(0,ve.jsx)(t.AvatarMaker,{meId:M?.id??_.CHEF_ID,me:n}):null,'reviews'===De?(0,ve.jsx)(fe.ReviewsSection,{rid:i,mode:"read",venueName:s.name}):null,'bookings'===De?(0,ve.jsx)(S.TodaysBookings,{rid:i,today:Me,by:n,app:"chef"}):null,'specials'===De?(0,ve.jsx)(ce.SpecialsEditor,{rid:i,me:n,app:"chef",now:L}):null,'forecast'===De?(0,ve.jsx)(K.ChefForecast,{openPrep:()=>Qe('kitchen','prep')}):null,'prep'===De?(0,ve.jsx)(V.PrepScreen,{}):null,'live'===De?(0,ve.jsx)(V.TeamScreen,{}):null,'waste'===De?(0,ve.jsx)(V.WasteScreen,{}):null,'recipes'===De?(0,ve.jsx)(ge.RecipeCards,{rid:i,actor:{name:n,role:'head-chef'},mode:"edit"}):null,'allergens'===De?(0,ve.jsx)(V.AllergenScreen,{openCards:()=>Qe('kitchen','recipes')}):null,'compliance'===De?(0,ve.jsx)(V.ComplianceScreen,{}):null,'takings'===De&&xe?(0,ve.jsx)(p.CashUpScreen,{rid:i,today:Me,canEdit:!1,chartsOnly:!0,who:{id:q,name:n.replace(' (example)','')}}):null,'board'===De?(0,ve.jsx)(ke.QuestionBoard,{rid:i,today:Me,manager:!1,by:""}):null,'teamtasks'===De?(0,ve.jsx)(h.KitchenTeamTasks,{rid:i,actor:M}):null,'orderlists'===De?(0,ve.jsx)(w.OrderListsScreen,{rid:i,today:Me,editor:!0,who:{id:q,name:n.replace(' (example)','')}}):null,'foodsafety'===De?(0,ve.jsx)(v.FoodSafetyCard,{children:(0,ve.jsx)(H.default,{accessibilityRole:"button",onPress:()=>Qe('kitchen','haccp'),children:(0,ve.jsx)(F.T,{colour:N.colours.gold,children:"Today\u2019s temperature log \u203a"})})}):null,'haccp'===De?(0,ve.jsx)(de.HaccpLog,{mode:"chef",me:n,meId:_.CHEF_ID,now:L}):null,'accidents'===De?(0,ve.jsx)(le.AccidentBook,{app:"chef",me:n,meId:_.CHEF_ID,now:L,seeAll:!1}):null]}),(0,ve.jsx)(we.BottomTabs,{tablist:!0,background:N.colours.surface,active:'orders'===He?'kitchen':He,onPress:e=>Qe(e),tabs:Ce.map(e=>({id:e.id,label:e.label,short:'creator'===e.id?'Creator':void 0,icon:e.icon,a11y:'rota'===e.id?'Rota, the kitchen rota':void 0}))}),(0,ve.jsx)(ye.ChefAssistantSheet,{go:(e,t)=>{'orders'===e?(Fe(t),Qe('orders')):'gp'===e?Qe('gp'):Qe('kitchen',e)}}),(0,ve.jsx)(ue.AlertHost,{variant:"chef",rid:i,skipTakeaway:!0}),(0,ve.jsx)(he.KitchenFlash,{rid:i,me:n})]})};var t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),o=_r(_d[3]),n=_r(_d[4]),l=_r(_d[5]),r=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),f=_r(_d[12]),b=_r(_d[13]),k=_r(_d[14]),y=_r(_d[15]),x=_r(_d[16]),j=_r(_d[17]),w=_r(_d[18]),v=_r(_d[19]),C=_r(_d[20]),T=_r(_d[21]),P=_r(_d[22]),S=_r(_d[23]),I=_r(_d[24]),R=e(_r(_d[25]));_r(_d[26]);var H=e(_r(_d[27])),A=e(_r(_d[28])),D=e(_r(_d[29])),$=e(_r(_d[30])),B=_r(_d[31]),O=_r(_d[32]),E=_r(_d[33]),F=_r(_d[34]),L=_r(_d[35]),N=_r(_d[36]),G=_r(_d[37]),M=_r(_d[38]),_=_r(_d[39]),W=_r(_d[40]),K=_r(_d[41]),V=_r(_d[42]),z=_r(_d[43]),U=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),Y=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),se=_r(_d[53]),ie=_r(_d[54]),ae=_r(_d[55]),oe=_r(_d[56]),ne=_r(_d[57]),le=_r(_d[58]),re=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),pe=_r(_d[64]),ge=_r(_d[65]),fe=_r(_d[66]),be=_r(_d[67]),ke=_r(_d[68]),me=_r(_d[69]),ye=_r(_d[70]),xe=_r(_d[71]),je=_r(_d[72]),we=_r(_d[73]),ve=_r(_d[74]);s.LIVE_HEAD_CHEF&&(0,i.requireRealData)();const Ce=[{id:'home',label:'Home',icon:'home'},{id:'stock',label:'Stock',icon:'box'},{id:'gp',label:'GP',icon:'forecast'},{id:'creator',label:re.CREATOR_TITLE,icon:'sparkle'},{id:'rota',label:'Rota',icon:'rota'},{id:'kitchen',label:'Kitchen',icon:'platter'}],Te=[{id:'orders',title:'Orders',sub:'Supplier order sheets, what is due today and cut-off times. Nothing is sent until you press Send'}],Pe=[{id:'alerts',title:'Turn on alerts',sub:'Get your reminders on this phone, even with the app closed'},{id:'avatar',title:'My avatar',sub:'Animals, Bar & kitchen, sea, sport, colours, patterns or your own photo'},{id:'reviews',title:'Reviews',sub:'Published reviews, newest first'},{id:'myshift',title:'My shifts & clock in',sub:'Clock in and out (checks you are at the venue), breaks, and your shifts on the rota'},{id:'mypay',title:'My pay & tips',sub:'Your hours, tips share, tip goal, paydays and payslip info. Only you see this'},{id:'takings',title:'Takings & tips graphs',sub:'Daily cash ups, weekly sales, this week vs last, categories and the Tips pot (view only)'},{id:'bookings',title:'Today\u2019s bookings',sub:'Covers, allergens to sign off, platters and other reservations, dogs, access and vegan/vegetarian'},{id:'recipes',title:'Recipe cards',sub:'Plating photo, ingredients, method, allergens, section and price; you sign each card off before it goes live'},{id:'specials',title:'Specials board',sub:'Photo of the chalkboard or typed specials with allergens; shown in the customer app'},{id:'board',title:'Question board',sub:'Ask the team anything anonymously, and vote'},{id:'teamtasks',title:'Kitchen team tasks',sub:'Daily tasks for your chefs, commis and KPs'},{id:'orderlists',title:'Order lists',sub:'Alsons drinks, Cash and carry: add items, tick on the day, finish and carry over'},{id:'foodsafety',title:'Food safety (CookSafe)',sub:'Based on CookSafe (Food Standards Scotland). Full logs coming in the next update'},{id:'haccp',title:'Food safety log (HACCP)',sub:'Temperatures, cleaning and allergen checks; voice entry; limits; EHO export'},{id:'accidents',title:'Accident book',sub:'Accidents and near misses; you see your own entries'},{id:'forecast',title:'Forecast',sub:'Covers per day for the week ahead, and prep from the forecast'},{id:'prep',title:'Prep list',sub:'From the forecast and bookings, tick off as you go'},{id:'live',title:'Live tickets, sold out, team & chat',sub:'Orders, readiness alerts, sold out, who\u2019s on, rota, team chat and private messages'},{id:'waste',title:'Waste log',sub:'Item, quantity, reason and cost; weekly total and % of sales'},{id:'allergens',title:'Allergens',sub:'14-allergen matrix from the recipe cards, costing cross-check and audit log'},{id:'compliance',title:'Kitchen compliance',sub:'Fridge, freezer, cooking and cooling temps; cleaning; daily checks'}],Se={stock:{tab:'stock',stock:'levels'},'stock-take':{tab:'stock',stock:'take'},deliveries:{tab:'stock',stock:'deliveries'},gp:{tab:'gp',gp:'dishes'},'price-changes':{tab:'gp',gp:'changes'},'gp-week':{tab:'gp',gp:'week'},'menu-engineering':{tab:'gp',gp:'engineering'},orders:{tab:'orders'},rota:{tab:'rota'},'kitchen-rota':{tab:'rota'},forecast:{tab:'kitchen',k:'forecast'},prep:{tab:'kitchen',k:'prep'},live:{tab:'kitchen',k:'live'},waste:{tab:'kitchen',k:'waste'},recipes:{tab:'kitchen',k:'recipes'},'recipe-cards':{tab:'kitchen',k:'recipes'},allergens:{tab:'kitchen',k:'allergens'},compliance:{tab:'kitchen',k:'compliance'},haccp:{tab:'kitchen',k:'haccp'},specials:{tab:'kitchen',k:'specials'},accidents:{tab:'kitchen',k:'accidents'},'new-dish':{tab:'creator'}};function Ie({go:e}){const{k:t,c:s,menu:i,now:o,rid:l,me:r}=(0,_.useChef)(3e4),d=(0,q.useSheetReminders)(),u=(0,_.useWeek)(),{covers:h,label:p,enough:f,booked:b}=(0,_.useForecast)(),k=(0,z.useSuggestions)(),y=t.ingredients.filter(e=>e.onHand<=0||(0,_.isLow)(e.onHand,e.par)),x=k.filter(e=>e.ordersToday&&!e.placedToday),j=(0,M.priceImpacts)(i,t.recipes,t.ingredients,t.targetGp).filter(e=>e.dropped.length),w=t.deliveries.filter(e=>'expected'===e.status),v=!t.recipes.length||!t.ingredients.length,C=v?[]:s.filter(e=>e.below),T=(0,n.useLiveState)(),P=(0,me.useRecipeCards)(l).filter(e=>!e.signOff),S=(0,J.useKitchenSummary)(l),[R,A]=(0,I.useState)(!1);return(0,ve.jsxs)($.default,{style:{gap:12},testID:"chef-dashboard",children:[(0,ve.jsx)(de.MissedBanner,{mode:"chef",now:o,onPress:()=>e('kitchen','haccp')}),d.map(t=>(0,ve.jsx)(H.default,{accessibilityRole:"button",onPress:()=>e('orders',t.supplierId),children:(0,ve.jsxs)(F.Banner,{kind:'red'===t.tone?'danger':'warn',title:`\u23f0 ${t.text}`,children:["Tap to open the ",t.name," order sheet. Nothing is sent until you press Send."]})},t.supplierId)),P.length?(0,ve.jsx)(H.default,{testID:"cards-awaiting",accessibilityRole:"button",onPress:()=>e('kitchen','recipes'),children:(0,ve.jsxs)(F.Banner,{kind:"warn",title:`${P.length} recipe card${1===P.length?'':'s'} awaiting your sign-off`,children:[P.slice(0,4).map(e=>e.dish).join(', '),". Guests see \"awaiting allergen sign-off\" and cannot order these until you sign them off."]})}):null,(0,ve.jsx)(Q.ShellfishTile,{rid:l,by:r,app:"chef",onOrder:()=>e('orders','os-kittyfisher')}),(0,ve.jsx)(F.Button,{testID:"chef-add-soldout",label:"Add sold out",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>A(!0),style:{minHeight:56}}),(0,ve.jsxs)(F.Row,{wrap:!0,gap:10,children:[c.PITCH?null:(0,ve.jsx)(_.Tile,{testID:"tile-gp",label:"Dishes under target GP",value:S.costed?`${S.below} of ${S.costed}`:'Nothing yet',sub:S.costed?`Average ${(0,_.pct1)(S.avgGp??0)} \xb7 target ${S.target}%`:'Record a delivery, then cost your recipe cards',tone:S.costed?S.below?'amber':'ok':void 0,onPress:()=>e('gp','dishes')}),c.PITCH?v?(0,ve.jsx)(_.Tile,{testID:"tile-gp",label:"GP this week vs target",value:"Nothing yet",sub:"Add ingredients and recipe costs to see GP",onPress:()=>e('gp','week')}):(0,ve.jsx)(_.Tile,{testID:"tile-gp",label:"GP this week vs target",value:(0,_.pct1)(u.theo),sub:`Target ${t.targetGp}% \xb7 actual ${(0,_.pct1)(u.actual)}`,tone:u.theoe('gp','week')}):null,c.PITCH?null:(0,ve.jsx)(_.Tile,{testID:"tile-stock",label:"Stock value",value:null!=S.stockValue?(0,L.gbp)(S.stockValue):'Nothing yet',sub:S.lastCount?`At cost, counted ${S.lastCount}`:'No stock counted yet',onPress:()=>e('stock','take')}),c.PITCH?(0,ve.jsx)(_.Tile,{testID:"tile-stock",label:"Stock value",value:t.ingredients.length?(0,L.gbp)((0,_.stockValue)(t.ingredients)):'Nothing yet',sub:t.ingredients.length?'At cost':'No stock counted yet',onPress:()=>e('stock','levels')}):null,(0,ve.jsx)(_.Tile,{label:"Items low or out",value:t.ingredients.length?`${y.length}`:'Nothing yet',sub:t.ingredients.length?y.slice(0,3).map(e=>e.name).join(', '):'No stock counted yet',tone:y.some(e=>e.onHand<=0)?'red':y.length?'amber':'ok',onPress:()=>e('stock','levels')}),(0,ve.jsx)(_.Tile,{label:"Waste this week",value:t.waste.length?(0,L.gbp)(u.wasteWeek):'Nothing yet',sub:u.sales?`${(0,_.pct1)(u.wasteWeek/u.sales*100)} of food sales`:'',onPress:()=>e('kitchen','waste')}),f?(0,ve.jsx)(_.Tile,{testID:"tile-forecast",label:"Covers forecast today",value:`${h}`,sub:p,onPress:()=>e('kitchen','forecast')}):(0,ve.jsx)(_.Tile,{testID:"tile-booked",label:"Booked so far today",value:'ready'===T?`${b}`:'connecting'===T?'Connecting\u2026':'Not connected',sub:"Not enough history for a forecast yet",onPress:()=>e('kitchen','bookings')}),(0,ve.jsx)(_.Tile,{label:"Orders due today",value:`${x.length}`,sub:x.map(e=>`${e.s.name} by ${e.s.cutoff}`).join(' \xb7 ')||'None',tone:x.some(e=>e.cutPassed)?'red':x.length?'amber':'ok',onPress:()=>e('orders')})]}),j.map(e=>(0,ve.jsxs)(F.Banner,{kind:"danger",title:`${e.ing.name} ${e.pct>0?'+':''}${e.pct.toFixed(0)}%: ${e.dropped.length} dish${1===e.dropped.length?'':'es'} drop below target`,children:[e.dropped.map(e=>e.item.name).join(', '),". Open GP \u203a Price changes."]},e.ing.id)),w.length?(0,ve.jsx)(H.default,{accessibilityRole:"button",onPress:()=>e('stock','deliveries'),children:(0,ve.jsx)(F.Banner,{kind:"info",title:`${w.length} deliver${1===w.length?'y':'ies'} to check in today`,children:"Count in against the order, flag shorts and price changes."})}):null,C.length?(0,ve.jsx)(H.default,{accessibilityRole:"button",onPress:()=>e('gp','dishes'),children:(0,ve.jsxs)(F.Banner,{kind:"warn",title:`${C.length} dishes below ${t.targetGp}% GP`,children:[C.slice(0,4).map(e=>e.item.name).join(', '),C.length>4?'\u2026':'']})}):null,(0,ve.jsx)(F.Row,{wrap:!0,gap:8,children:[['Recipe cards','recipes'],['Food safety log','haccp'],['Specials board','specials'],[re.CREATOR_TITLE,'creator'],['Forecast','forecast'],['Prep list','prep'],['Live tickets & sold out','live'],['Allergens','allergens'],['Accident book','accidents']].map(([t,s])=>(0,ve.jsx)(H.default,{accessibilityRole:"button",accessibilityLabel:t,onPress:()=>'creator'===s?e('creator'):e('kitchen',s),style:{flexGrow:1,flexBasis:140,padding:12,borderRadius:12,borderWidth:1.5,borderColor:N.colours.gold,backgroundColor:N.colours.surface},children:(0,ve.jsxs)(F.T,{weight:"semibold",children:[t," \u203a"]})},s))}),(0,ve.jsx)(F.Badge,{kind:"neutral",label:"Nothing is ordered or sent from here"}),(0,ve.jsx)(xe.SoldOutSheet,{visible:R,onClose:()=>A(!1),rid:l,by:r,hideLinks:!0,testID:"chef-soldout-sheet"})]})}},792,[793,978,884,979,986,1051,1052,1015,2,1053,1057,1058,1090,858,1095,1099,1100,1103,1104,1107,1108,1110,1111,1112,34,373,236,402,295,426,102,36,873,1137,794,867,821,1084,1139,1145,1148,1149,1152,1167,1165,1168,1169,1171,1172,1173,1176,1179,1187,1188,1192,1193,925,1003,1194,1158,1195,1196,1197,1206,1199,1156,1208,1212,1189,874,1213,1154,987,1215,25]); __d(function(_g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.styliseOnDevice=b,_e.pickPhoto=p,_e.AvatarMaker=function({meId:e,me:u}){const g=(0,i.useAvatars)(t=>t.photos[e]),[f,v]=(0,t.useState)(null),[y,x]=(0,t.useState)(null),[j,w]=(0,t.useState)(!1),[I,P]=(0,t.useState)(!1),[k,M]=(0,t.useState)('');(0,t.useEffect)(()=>()=>{f&&URL.revokeObjectURL(f)},[f]);const R='undefined'!=typeof document,S=async e=>{M('');const t=await p(e);if(t){P(!0),w(!1);try{const e=await b(t);f&&URL.revokeObjectURL(f),v(URL.createObjectURL(t)),x(e)}catch{M("That photo couldn't be opened. Try a different one (JPEG or PNG).")}finally{P(!1)}}},U=()=>{f&&URL.revokeObjectURL(f),v(null),x(null),w(!1)},B=u.replace(' (example)','');return(0,h.jsxs)(o.default,{style:{gap:12},testID:"avatar-maker",children:[(0,h.jsxs)(d.Box,{children:[(0,h.jsxs)(s.Row,{gap:14,children:[(0,h.jsx)(l.StaffAvatar,{id:e,size:88}),(0,h.jsxs)(o.default,{style:{flex:1,gap:4},children:[(0,h.jsx)(s.T,{weight:"semibold",size:17,children:B}),(0,h.jsxs)(s.Muted,{children:[g?`Your chosen avatar (saved ${new Date(g.at).toLocaleDateString('en-GB')}).`:'Your original crew avatar.'," It shows on rotas, chat, clock-in and sign-offs."]})]})]}),g?(0,h.jsx)(s.Button,{small:!0,kind:"secondary",label:"Back to my default avatar",testID:"avatar-own-reset",onPress:()=>{i.useAvatars.getState().reset(e,{id:e,role:'staff',name:B}),M('Back to your default avatar.')}}):null]}),(0,h.jsx)(d.Box,{children:(0,h.jsx)(n.AvatarOptions,{value:g?.dataUrl,onSelect:t=>{const a=i.useAvatars.getState().setOwn(e,e,t.dataUrl,B);M(a?`${t.name} is your avatar now.`:'Could not save your avatar.')}})}),(0,h.jsxs)(d.Box,{testID:"avatar-create",children:[(0,h.jsx)(s.T,{weight:"semibold",size:17,children:"Create my avatar from a photo"}),(0,h.jsx)(s.Muted,{children:"Upload a photo or take a selfie. Your phone turns it into a retro space-age avatar. The photo never leaves this device and isn't saved: only the finished avatar is kept."}),R?y?(0,h.jsxs)(o.default,{style:{gap:10},testID:"avatar-preview",children:[(0,h.jsxs)(s.Row,{gap:12,style:{justifyContent:'center'},children:[(0,h.jsxs)(o.default,{style:{alignItems:'center',gap:4},children:[f?(0,h.jsx)(a.default,{source:{uri:f},style:{width:96,height:96,borderRadius:12},accessibilityLabel:"Your photo"}):null,(0,h.jsx)(s.Muted,{children:"Your photo"})]}),(0,h.jsx)(s.T,{size:22,colour:c.colours.gold,children:"\u2192"}),(0,h.jsxs)(o.default,{style:{alignItems:'center',gap:4},children:[(0,h.jsx)(a.default,{source:{uri:y},style:{width:120,height:120,borderRadius:60,borderWidth:3,borderColor:c.colours.gold},accessibilityLabel:"Your new avatar preview",testID:"avatar-result"}),(0,h.jsx)(s.Muted,{children:"Your avatar"})]})]}),(0,h.jsxs)(r.default,{accessibilityRole:"checkbox",accessibilityState:{checked:j},accessibilityLabel:"I agree to use this avatar",testID:"avatar-consent",onPress:()=>w(!j),style:{flexDirection:'row',gap:10,alignItems:'flex-start',padding:10,borderRadius:12,borderWidth:1,borderColor:j?c.colours.gold:c.colours.border},children:[(0,h.jsx)(o.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:c.colours.gold,backgroundColor:j?c.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:j?(0,h.jsx)(s.T,{size:15,weight:"bold",colour:"#111",children:"\u2713"}):null}),(0,h.jsx)(s.T,{size:14,style:{flex:1},children:"I\u2019m happy for this avatar, made from my photo, to be shown to my team in CoverCharge. Only the finished avatar is shared; my photo isn\u2019t uploaded or kept, and a manager can reset my avatar."})]}),(0,h.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,h.jsx)(s.Button,{label:"Use as my avatar",testID:"avatar-save",disabled:!j,onPress:()=>{const t=i.useAvatars.getState().setOwn(e,e,y,B);M(t?'Saved: this is your avatar now.':"Couldn't save the avatar."),t&&U()}}),(0,h.jsx)(s.Button,{kind:"secondary",label:"Try another photo",onPress:U})]})]}):(0,h.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,h.jsx)(s.Button,{label:I?'Making your avatar\u2026':'Upload a photo',testID:"avatar-upload",disabled:I,onPress:()=>S(!1)}),(0,h.jsx)(s.Button,{kind:"secondary",label:"Take a selfie",testID:"avatar-selfie",disabled:I,onPress:()=>S(!0)})]}):(0,h.jsx)(s.Muted,{children:"Available in the web app."}),k?(0,h.jsx)(o.default,{testID:"avatar-msg",children:(0,h.jsx)(s.T,{size:14,colour:c.colours.ok,children:k})}):null]})]})};var t=_r(_d[0]),a=e(_r(_d[1]));_r(_d[2]);var r=e(_r(_d[3])),o=e(_r(_d[4])),s=_r(_d[5]),l=_r(_d[6]),n=_r(_d[7]),i=_r(_d[8]),c=_r(_d[9]),d=_r(_d[10]),h=_r(_d[11]);const u=['#1B1B1B','#4A3F35','#B89A72','#E9B949','#FFF4E0'].map(e=>[1,3,5].map(t=>parseInt(e.slice(t,t+2),16))),g=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5];function f(e){return new Promise((t,a)=>{const r=URL.createObjectURL(e),o=new window.Image;o.onload=()=>t({img:o,url:r}),o.onerror=()=>{URL.revokeObjectURL(r),a(new Error('bad image'))},o.src=r})}function v(e,t,a,r){e.beginPath(),e.moveTo(t,a-r),e.quadraticCurveTo(t+.18*r,a-.18*r,t+r,a),e.quadraticCurveTo(t+.18*r,a+.18*r,t,a+r),e.quadraticCurveTo(t-.18*r,a+.18*r,t-r,a),e.quadraticCurveTo(t-.18*r,a-.18*r,t,a-r),e.fill()}async function b(e){const{img:t,url:a}=await f(e);try{const e=112,a=256,r=document.createElement('canvas');r.width=e,r.height=e;const o=r.getContext('2d'),s=Math.min(t.width,t.height);o.drawImage(t,(t.width-s)/2,Math.max(0,(t.height-s)/2-.04*s),s,s,0,0,e,e);const l=o.getImageData(0,0,e,e),n=l.data,i=[];for(let e=0;ee-t),d=c[Math.floor(.04*c.length)],h=c[Math.floor(.96*c.length)]||255;for(let t=0;t{const a=document.createElement('input');a.type='file',a.accept='image/*',e&&a.setAttribute('capture','user'),a.onchange=()=>t(a.files?.[0]??null),a.click()})}},793,[34,336,236,402,102,794,925,929,926,821,930,25]); __d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"webLine",{enumerable:!0,get:function(){return W.webLine}}),_e.T=D,Object.defineProperty(_e,"H1",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"H2",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"Muted",{enumerable:!0,get:function(){return z}}),_e.BrandBar=A,_e.Screen=function({children:e,title:t,subtitle:r,back:o=!0,right:l,maxWidth:n=640,footer:s,scroll:c=!0}){const u=(0,B.jsxs)(x.default,{style:{width:'100%',maxWidth:n,alignSelf:'center',padding:16,gap:12,alignItems:'stretch'},children:[e,'customer'===S.APP_VARIANT?(0,B.jsx)(H,{}):null]});return(0,B.jsxs)(j.SafeAreaView,{style:{flex:1,backgroundColor:C.colours.bg},edges:['top','left','right'],children:[(0,B.jsx)(x.default,{style:{width:'100%',maxWidth:n,alignSelf:'center'},children:(0,B.jsx)(A,{title:t,subtitle:r,back:o,right:l})}),c?(0,B.jsx)(b.default,{contentContainerStyle:{paddingBottom:40},children:u}):(0,B.jsx)(x.default,{style:{flex:1},children:u}),s?(0,B.jsx)(x.default,{style:N.footer,children:(0,B.jsx)(x.default,{style:{width:'100%',maxWidth:n,alignSelf:'center'},children:s})}):null]})},_e.Button=v,_e.Card=F,_e.Badge=function({label:e,kind:t="neutral"}){const r={neutral:[C.colours.surface2,C.colours.muted,C.colours.border],gold:[C.colours.goldTint,C.colours.goldLight,C.colours.gold],red:[C.colours.redBg,'#FFD9D4',C.colours.red],amber:[C.colours.amberBg,'#FFE2A8',C.colours.amber],ok:[C.colours.okBg,C.colours.goldLight,C.colours.ok],blue:[C.colours.blueBg,C.colours.goldLight,C.colours.blue]}[t];return(0,B.jsx)(x.default,{style:[N.badge,{backgroundColor:r[0],borderColor:r[2],maxWidth:'100%',alignSelf:L?'center':'flex-start'}],children:(0,B.jsx)(D,{size:13,weight:"medium",colour:r[1],style:{flexShrink:1},children:e})})},_e.Banner=E,Object.defineProperty(_e,"ExampleAllergenNotice",{enumerable:!0,get:function(){return V}}),Object.defineProperty(_e,"DemoPaymentNotice",{enumerable:!0,get:function(){return $}}),_e.Row=O,Object.defineProperty(_e,"Divider",{enumerable:!0,get:function(){return _}}),_e.Field=function({label:e,...t}){return(0,B.jsxs)(x.default,{style:{gap:4,alignSelf:'stretch',width:'100%',minWidth:0,maxWidth:'100%'},children:[(0,B.jsx)(D,{size:C.font.small,weight:"medium",colour:C.colours.muted,center:!0,children:e}),(0,B.jsx)(o.TextInput,{accessibilityLabel:e,placeholderTextColor:"#7D776C",...t,style:[N.input,t.multiline&&{minHeight:70,textAlignVertical:'top'},t.style]})]})},_e.Chip=function({label:e,selected:t,onPress:r,disabled:o,sub:l,testID:n,accessibilityLabel:s}){return(0,B.jsxs)(h.default,{testID:n,accessibilityRole:"button",accessibilityState:{selected:!!t,disabled:!!o},accessibilityLabel:`${s??e}${!s&&l?`, ${l}`:''}${t?', selected':''}`,'aria-pressed':!!t,disabled:o,onPress:r,style:[N.chip,t&&{backgroundColor:C.colours.gold,borderColor:C.colours.gold},o&&{opacity:.35}],children:[(0,B.jsx)(D,{size:C.font.small,weight:"medium",colour:t?C.colours.onGold:C.colours.text,center:!0,children:e.trim()}),l?(0,B.jsx)(D,{size:12,colour:t?C.colours.onGold:C.colours.muted,center:!0,children:l}):null]})},_e.Toggle=function({value:e,onChange:t,label:r,testID:o,disabled:l,a11y:n}){return(0,B.jsxs)(O,{style:{justifyContent:'space-between',flexShrink:1,minWidth:0},children:[(0,B.jsx)(D,{style:{flex:1,flexShrink:1},children:r}),(0,B.jsx)(y.default,{testID:o,disabled:l,accessibilityLabel:n??r,value:e,onValueChange:t,trackColor:{true:C.colours.gold,false:'#444'},thumbColor:e?'#FFF6E0':'#BBB',activeThumbColor:'#FFF6E0',activeTrackColor:C.colours.gold})]})},_e.Stepper=function({value:e,onChange:t,min:r=1,max:o=20,label:l,step:n=1,format:s,testID:c}){const u=s?s(e):String(e),b=e=>Math.round(e/n)*n;return(0,B.jsxs)(O,{gap:10,children:[(0,B.jsx)(h.default,{testID:c?`${c}-down`:void 0,accessibilityRole:"button",accessibilityLabel:`Decrease ${l??''}`,disabled:e<=r,onPress:()=>t(Math.max(r,b(e-n))),style:[N.stepBtn,e<=r?{opacity:.4}:null],children:(0,B.jsx)(D,{size:20,colour:C.colours.gold,children:"\u2212"})}),(0,B.jsx)(x.default,{testID:c?`${c}-value`:void 0,accessibilityLabel:l?`${l}: ${u}`:u,children:(0,B.jsx)(D,{weight:"semibold",size:C.font.large,style:{minWidth:s?64:28,textAlign:'center'},children:u})}),(0,B.jsx)(h.default,{testID:c?`${c}-up`:void 0,accessibilityRole:"button",accessibilityLabel:`Increase ${l??''}`,disabled:e>=o,onPress:()=>t(Math.min(o,b(e+n))),style:[N.stepBtn,e>=o?{opacity:.4}:null],children:(0,B.jsx)(D,{size:20,colour:C.colours.gold,children:"+"})})]})},_e.Sheet=function({visible:e,onClose:o,title:l,children:n,maxWidth:c,testID:f,footer:y}){const{height:w}=(0,p.default)(),W=s.default.useContext(j.SafeAreaInsetsContext)??{top:0,bottom:0,left:0,right:0},k=(0,r.useTyping)(),S=(0,r.useVisibleArea)(),I=k&&S&&S.height({minHeight:44,minWidth:72,paddingHorizontal:14,borderRadius:22,borderWidth:1.5,borderColor:C.colours.gold,backgroundColor:e?'rgba(201,162,77,0.22)':'rgba(201,162,77,0.10)',alignItems:'center',justifyContent:'center'}),children:(0,B.jsx)(D,{size:15,weight:"semibold",colour:C.colours.goldLight,center:!0,children:"Done"})}):null,R?(0,B.jsx)(h.default,{accessibilityRole:"button",accessibilityLabel:"Close",onPress:o,hitSlop:8,testID:"sheet-close",style:{minWidth:72,minHeight:48,alignItems:'center',justifyContent:'center',marginRight:-8},children:(0,B.jsx)(D,{size:18,colour:C.colours.text,children:"Close"})}):(0,B.jsx)(t.GoldClose,{onPress:o,testID:"sheet-close",style:{marginRight:-6,minWidth:48,minHeight:48}})]}),(0,B.jsx)(b.default,{style:{flexShrink:1},contentContainerStyle:{gap:12,paddingTop:2,paddingBottom:4},children:n}),y?(0,B.jsx)(x.default,{style:{borderTopWidth:1,borderTopColor:C.colours.border,paddingTop:10,marginTop:8},testID:f?`${f}-footer`:void 0,children:y}):null]})})})},_e.SectionTitle=function({children:e}){return(0,B.jsx)(D,{weight:"semibold",size:12,colour:C.colours.goldMuted,center:!0,style:{textTransform:'uppercase',letterSpacing:1.6,marginTop:8},children:e})},Object.defineProperty(_e,"styles",{enumerable:!0,get:function(){return N}}),_r(d[0]);var t=_r(d[1]),r=_r(d[2]),o=_r(d[3]),l=_r(d[4]),n=_r(d[5]),s=e(_r(d[6])),c=e(_r(d[7])),u=e(_r(d[8]));_r(d[9]);var h=e(_r(d[10])),b=e(_r(d[11])),f=e(_r(d[12])),y=e(_r(d[13])),x=e(_r(d[14])),p=e(_r(d[15])),j=_r(d[16]),C=_r(d[17]),w=_r(d[18]),W=_r(d[19]),k=_r(d[20]),S=_r(d[21]),I=_r(d[22]),B=_r(d[23]);const R=['kirkton','abbotsford'].includes(k.VENUE_RID),L='display'!==S.APP_VARIANT;function D({children:e,style:t,size:r=C.font.body,weight:l="regular",colour:n=C.colours.text,numberOfLines:s,center:c,testID:u,accessibilityRole:h,accessibilityLabel:b}){const y='string'==typeof e&&/^(https?:\/\/|www\.)\S+$/.test(e.trim()),x=y?{minWidth:0,maxWidth:'100%',overflowWrap:'anywhere',wordBreak:'break-all',alignSelf:'stretch'}:void 0,p=f.default.flatten(t)||{},j=1===p.flex||1===p.flexGrow||'number'==typeof p.width||'left'===p.textAlign,k=c??(L&&('semibold'===l||'bold'===l)&&!j);return(0,B.jsx)(o.Text,{testID:u??(y?'cc-url':void 0),...k?{dataSet:{centre:'heading'}}:{},accessibilityRole:h,accessibilityLabel:b,numberOfLines:s,style:[{minWidth:0,fontFamily:C.fonts[l],fontSize:r,color:n,lineHeight:(0,w.lineFor)(r)},k&&{textAlign:'center',alignSelf:'center',maxWidth:'100%'},t,x,(0,W.webLine)(t,r),k&&'left'!==p.textAlign?{textAlign:'center'}:null],children:e})}const P=e=>(0,B.jsx)(D,{size:C.font.title,weight:"semibold",center:!0,...e}),T=e=>(0,B.jsx)(D,{size:C.font.large,weight:"semibold",center:!0,...e}),z=e=>(0,B.jsx)(D,{colour:C.colours.muted,size:C.font.small,...e,center:e.center??L});function A({title:e,back:t=!0,right:r,subtitle:o}){return(0,B.jsxs)(x.default,{style:N.brandBar,children:[(0,B.jsxs)(x.default,{style:N.row,children:[(0,B.jsx)(x.default,{style:N.brandSide,children:t?(0,B.jsx)(h.default,{accessibilityRole:"button",accessibilityLabel:"Back",onPress:()=>l.router.canGoBack()?l.router.back():l.router.replace(S.ENTRY[S.APP_VARIANT]),style:N.backBtn,hitSlop:10,children:(0,B.jsx)(D,{size:18,weight:"semibold",colour:C.colours.gold,children:"\u2039 Back"})}):null}),(0,B.jsx)(h.default,{onPress:()=>l.router.push(S.ENTRY[S.APP_VARIANT]),accessibilityLabel:"Home",style:N.brandCenter,children:(0,B.jsx)(I.RestaurantBrand,{size:I.HEADER_LOGO})}),(0,B.jsx)(x.default,{style:[N.brandSide,{alignItems:'flex-end'}],children:r?(0,B.jsx)(x.default,{style:{flexShrink:0},children:r}):null})]}),e?(0,B.jsx)(P,{style:{marginTop:10,alignSelf:'stretch'},children:e}):null,o?(0,B.jsx)(z,{center:!0,style:{alignSelf:'stretch'},children:o}):null]})}function H(){const e=(0,l.useLocalSearchParams)().rid??k.VENUE_RID,t=(0,n.useStore)(t=>t.restaurants.find(t=>t.id===e)?.contactEmail);return t?(0,B.jsx)(h.default,{accessibilityRole:"link",accessibilityLabel:`Email ${t}`,onPress:()=>{c.default.openURL(`mailto:${t}`)},style:{minHeight:44,justifyContent:'center',alignItems:'center',maxWidth:'100%'},children:(0,B.jsx)(D,{center:!0,size:14,colour:C.colours.gold,children:t})}):null}function v({label:e,sub:t,onPress:r,kind:o="primary",disabled:l,small:n,style:s,accessibilityLabel:c,accessibilityHint:u,testID:b}){const f={primary:C.colours.gold,secondary:C.colours.tile,danger:C.colours.redSolid,ghost:'transparent',success:C.colours.accentBg}[o],y={primary:C.colours.onGold,secondary:C.colours.text,danger:'#FFFFFF',ghost:C.colours.gold,success:C.colours.goldLight}[o],x={primary:'transparent',secondary:C.colours.hairline,danger:'transparent',ghost:'transparent',success:C.colours.accentBorder}[o];return(0,B.jsxs)(h.default,{testID:b,accessibilityRole:"button",accessibilityLabel:c??e,accessibilityHint:u,accessibilityState:{disabled:!!l},disabled:l,onPress:r,style:({pressed:e})=>[N.btn,{backgroundColor:e&&'secondary'===o?C.colours.tilePressed:f,borderColor:x,opacity:l?.4:e?.85:1},n&&{paddingVertical:8,paddingHorizontal:14,minHeight:w.control.min,minWidth:44},s],children:[(0,B.jsx)(D,{weight:"semibold",size:n?C.font.small:C.font.body,colour:y,center:!0,children:e.trim()}),t?(0,B.jsx)(D,{size:n?C.font.small-2:C.font.small,colour:y,center:!0,testID:b?`${b}-sub`:void 0,children:t}):null]})}function F({children:e,style:t,onPress:r,highlight:o}){const l=o===C.colours.gold||o===C.colours.accentBorder,n=(0,B.jsx)(x.default,{testID:"cc-card",style:[N.card,{alignItems:'stretch'},o?{borderColor:l?C.colours.accentBorder:o,borderWidth:l?1:2}:null,t],children:e});return r?(0,B.jsx)(h.default,{accessibilityRole:"button",onPress:r,style:({pressed:e})=>({opacity:e?.85:1}),children:n}):n}function E({kind:e="info",title:t,children:r}){const o={info:[C.colours.surface,C.colours.gold,C.colours.text],warn:[C.colours.amberBg,C.colours.amber,'#FFE2A8'],danger:[C.colours.redBg,C.colours.red,'#FFE3DF'],success:[C.colours.okBg,C.colours.ok,C.colours.goldLight],example:[C.colours.amberBg,C.colours.amber,'#FFE2A8'],demo:[C.colours.goldTint,C.colours.gold,C.colours.goldLight]}[e];return(0,B.jsxs)(x.default,{accessibilityRole:"summary",style:[N.banner,{backgroundColor:o[0],borderLeftColor:o[1]}],children:[t?(0,B.jsx)(D,{weight:"semibold",colour:o[2],center:!0,children:t}):null,s.default.Children.toArray(r).every(e=>'string'==typeof e||'number'==typeof e)?(0,B.jsx)(D,{size:C.font.small,colour:o[2],center:!0,children:r}):r]})}z.statusLine=!0,v.centreRow=!0;const V=()=>(0,B.jsx)(E,{kind:"example",title:"Allergens awaiting kitchen verification",children:"This allergen information has not been verified by the kitchen. Head chef sign-off is required. Always speak to staff about allergies."}),$=()=>(0,B.jsx)(E,{kind:"demo",title:"Card payments: not set up yet",children:"No card is charged and no payment provider is contacted."});function O({children:e,style:t,gap:r=8,wrap:o}){const l=s.default.Children.map(e,e=>{if(!s.default.isValidElement(e))return e;const t=e,r=f.default.flatten(t.props.style)||{};return 1!==r.flex&&1!==r.flexGrow?e:s.default.cloneElement(t,{style:[t.props.style,{minWidth:Math.max(t.type===F?240:180,'number'==typeof r.minWidth?r.minWidth:0)}]})}),n=f.default.flatten(t)||{},c=s.default.Children.toArray(l).filter(s.default.isValidElement),u=e=>e.type;if(L&&'space-between'===n.justifyContent&&1!==n.flex&&2===c.length&&c.some(e=>u(e).statusLine))return(0,B.jsx)(x.default,{dataSet:{centre:'status'},style:{alignItems:'center',alignSelf:'stretch',width:'100%',gap:r},children:c});const h=L&&c.length>=2&&c.every(e=>u(e).centreRow)&&'flex-start'!==n.justifyContent&&'space-between'!==n.justifyContent;return(0,B.jsx)(x.default,{...h?{dataSet:{centre:'buttons'}}:{},style:[N.row,{gap:r},h&&{justifyContent:'center',flexWrap:'wrap'},o&&{flexWrap:'wrap',justifyContent:'center'},t],children:l})}const _=()=>(0,B.jsx)(x.default,{style:{height:1,backgroundColor:C.colours.border,marginVertical:4}});const N=f.default.create({row:{flexDirection:'row',alignItems:'center',flexWrap:'wrap',minWidth:0,maxWidth:'100%'},brandBar:{paddingHorizontal:16,paddingTop:8,paddingBottom:8,borderBottomWidth:1,borderBottomColor:C.colours.border},brandSide:{width:96,minHeight:48,justifyContent:'center'},brandCenter:{flex:1,alignItems:'center',justifyContent:'center',minHeight:48},backBtn:{paddingRight:12,minHeight:48,minWidth:88,justifyContent:'center'},btn:{minWidth:0,maxWidth:'100%',flexShrink:1,borderRadius:w.radii.button,paddingVertical:12,paddingHorizontal:18,borderWidth:1,alignItems:'center',justifyContent:'center',minHeight:w.control.min,alignSelf:'stretch'},card:{minWidth:0,maxWidth:'100%',backgroundColor:C.colours.surface,borderRadius:C.radius.l,padding:16,borderWidth:1,borderColor:C.colours.hairline,gap:8},badge:{borderRadius:999,paddingHorizontal:9,paddingVertical:2,borderWidth:1,alignSelf:'flex-start'},banner:{borderRadius:C.radius.m,padding:12,borderLeftWidth:5,gap:2},input:{minWidth:0,boxSizing:'border-box',backgroundColor:C.colours.surface2,borderColor:C.colours.border,borderWidth:1,borderRadius:C.radius.m,paddingHorizontal:12,paddingVertical:10,color:C.colours.text,fontSize:C.font.body,fontFamily:C.fonts.regular},chip:{maxWidth:'100%',flexShrink:0,borderWidth:1,borderColor:C.colours.border,borderRadius:C.radius.m,paddingHorizontal:12,paddingVertical:8,backgroundColor:C.colours.surface2,minWidth:64,minHeight:44,justifyContent:'center'},stepBtn:{width:44,height:44,borderRadius:22,borderWidth:1.5,borderColor:C.colours.gold,alignItems:'center',justifyContent:'center'},overlay:{flex:1,backgroundColor:'rgba(0,0,0,0.7)',justifyContent:'center',alignItems:'center',padding:16},sheet:{backgroundColor:C.colours.surface,borderRadius:w.radii.xl,padding:18,width:'100%',maxWidth:520,maxHeight:'90%',borderWidth:1,borderColor:C.colours.gold},footer:{borderTopWidth:1,borderTopColor:C.colours.border,backgroundColor:C.colours.surface,padding:12}})},794,[795,796,830,827,30,831,34,379,395,236,402,295,41,410,102,426,36,821,826,871,5,872,873,25]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"RESPONSIVE_CSS",{enumerable:!0,get:function(){return t}});const t="\n*,*::before,*::after { box-sizing:border-box !important; }\nhtml,body { max-width:100%; overflow-x:hidden; }\ninput,select,textarea { box-sizing:border-box !important; min-width:0; max-width:100%; }\n[dir=\"auto\"] { overflow-wrap:break-word; }\n[data-testid^=\"area-summary-\"] [dir=\"auto\"] { overflow-wrap:normal; word-break:keep-all; text-align:center; }\n[data-testid=\"venue-header-name\"],\n[data-testid^=\"avatar-option-\"] [dir=\"auto\"] { overflow-wrap:normal !important; word-break:keep-all !important; }\n[data-testid=\"cc-card\"] { min-width:0; max-width:100%; overflow-x:hidden; }\n[data-testid=\"cc-card\"] > [dir=\"auto\"] { text-align:center; }\n[data-testid=\"cc-card\"] > * { min-width:0; max-width:100%; }\n";if('undefined'!=typeof document&&!document.getElementById('cc-responsive-sizing')){const n=document.createElement('style');n.id='cc-responsive-sizing',n.textContent=t,document.head.appendChild(n)}},795,[]); @@ -1095,7 +1095,7 @@ __d(function(g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule' __d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.setClockServer=function(t){s=t,c()},e.markClockUnsent=function(t){o.set(t,Date.now()),c()},e.markClockSent=function(t){o.delete(t)&&c()},e.clockNotSent=l,e.useClockNotSent=function(o){const[,c]=(0,t.useState)(0);return(0,t.useEffect)(()=>{const t=()=>c(t=>t+1);u.add(t);const o=n.mutationQueue.subscribe(t);return()=>{u.delete(t),o()}},[]),l(o)};var t=r(d[0]),n=r(d[1]);const o=new Map,u=new Set,c=()=>{for(const t of u)t()};let s=()=>!1;function l(t){if(!t)return!1;return n.mutationQueue.pending.some(n=>'attendance'===n.table&&n.rowKey===t)||o.has(t)&&s()}n.mutationQueue.onDone(t=>{'attendance'===t.table&&o.delete(t.rowKey)&&c()})},1012,[34,1013]); __d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"MutationQueue",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"mutationQueue",{enumerable:!0,get:function(){return o}});var t=_r(d[0]),e=_r(d[1]),s=_r(d[2]);const n='queue:v1',r='queue:failed:v1',h=t=>`${t.table}|${t.venueId}|${t.rowKey}`;class l{items=[];failedItems=[];loaded=null;flushing=null;flushingSince=0;exec=null;listeners=new Set;onFailure=new Set;onSaved=new Set;retryTimer=null;waitTimer=null;backoffMs=2e3;now=()=>Date.now();constructor(){(0,t.onConnectivity)(t=>{t&&this.flush()})}setExecutor(t){this.exec=t}load(){return this.loaded||(this.loaded=(async()=>{const t=await e.kv.get(n,[]);this.items=[...t.map(t=>({...t,nextAt:void 0})),...this.items],this.failedItems=await e.kv.get(r,[]),this.emit()})()),this.loaded}get pending(){return this.items}get waiting(){return this.items.filter(t=>t.attempts>0)}get failed(){return this.failedItems}hasPending(t,e,s){return this.items.some(n=>n.table===t&&n.venueId===e&&n.rowKey===s)}async enqueue(t){await this.load();const s={...t,id:(0,e.uuid)(),createdAt:(new Date).toISOString(),attempts:0};return this.items.push(s),await this.persist(),this.flush(),s}nextReady(){const t=new Set,e=this.now();for(const s of this.items){const n=h(s);if(!t.has(n)){if(!(s.nextAt&&s.nextAt>e))return s;t.add(n)}}}remove(t){this.items=this.items.filter(e=>e!==t)}flush(){if(this.flushing&&Date.now()-this.flushingSince<6e4)return this.flushing;this.flushingSince=Date.now();let e=null;return e=(async()=>{for(await this.load();this.exec;){if(this.flushing&&this.flushing!==e)return;const n=this.nextReady();if(!n)break;if(!(0,t.isOnline)()){this.scheduleRetry();break}try{const t=await this.exec(n);this.remove(n),this.backoffMs=2e3,'conflict'===t?this.fail(n,'conflict','Row changed on the server (version conflict) or is not visible to you'):this.onSaved.forEach(t=>t(n))}catch(e){n.attempts+=1,n.lastError=String(e?.message??e);const r=e??{};n.lastErr={code:r.code?String(r.code):void 0,status:Number(r.status)||void 0,message:n.lastError.slice(0,300)};const h=(0,s.classifyWriteError)(e);if('network'===h){n.attempts-=1,(0,t.setOnline)(!1),this.scheduleRetry(),await this.persist();break}'retry'===h?n.nextAt=this.now()+(0,s.retryDelayMs)(n.attempts):(this.remove(n),this.fail(n,'rejected',n.lastError))}await this.persist()}this.flushing===e&&(this.flushing=null),this.scheduleWaiting()})(),this.flushing=e,e}retryNow(){for(const t of this.items)t.nextAt=void 0;return this.flush()}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}onFailed(t){return this.onFailure.add(t),()=>{this.onFailure.delete(t)}}onDone(t){return this.onSaved.add(t),()=>{this.onSaved.delete(t)}}async clearFailed(){this.failedItems=[],await e.kv.set(r,[]),this.emit()}fail(t,s,n){const h={...t,lastError:n,failedAt:(new Date).toISOString(),reason:s};this.failedItems=[h,...this.failedItems].slice(0,100),e.kv.set(r,this.failedItems),this.onFailure.forEach(t=>t(h))}scheduleWaiting(){this.waitTimer&&(clearTimeout(this.waitTimer),this.waitTimer=null);const t=this.items.map(t=>t.nextAt??0).filter(t=>t>0);if(!t.length)return;const e=Math.max(500,Math.min(...t)-this.now());this.waitTimer=setTimeout(()=>{this.waitTimer=null,this.flush()},e)}scheduleRetry(){if(this.retryTimer)return;const e=this.backoffMs;this.backoffMs=Math.min(2*this.backoffMs,6e4),this.retryTimer=setTimeout(()=>{this.retryTimer=null,(0,t.setOnline)(!0),this.flush()},e)}async persist(){await e.kv.set(n,this.items),this.emit()}emit(){this.listeners.forEach(t=>t())}}const o=new l},1013,[1010,977,1014]); __d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.classifyWriteError=function(o){if((0,e.isNetworkError)(o))return'network';const{code:n,status:c,msg:l}=t(o);return s(o)?'refused':/^(08|53|57|58)/.test(n)||['40001','40P01','55P03','23505','23503'].includes(n)||/^PGRST30[0-3]$/.test(n)||/jwt|token.*expired/i.test(l)||401===c||408===c||425===c||429===c||c>=500?'retry':409!==c||n?'refused':'retry'},Object.defineProperty(_e,"retryDelayMs",{enumerable:!0,get:function(){return o}}),_e.describeWrite=function(e){const t='rpc'===e.kind?(e.fn??'change').replace(/_/g,' '):n[e.table]??e.table.replace(/_/g,' ').replace(/s$/,''),s=e.values??{},o=s.guest_name??s.name??s.display_name??s.title??s.reason,c='string'==typeof o&&o.trim()?` for ${o.trim().slice(0,60)}`:'';return'delete'===e.kind?`deleting a ${t}${c}`:`the ${t}${c}`},_e.plainReason=function(e,o){const{code:n,status:c,msg:l}=t(e);if('refused'===o)return s(e)?'more than 20 deletes in 10 minutes from one sign-in are stopped to keep your data safe':'42501'===n||403===c||/row-level security|permission/i.test(l)?'your sign-in isn\u2019t allowed to change this':'conflict'===n?'it was changed or removed on another device first':/^(22|23)/.test(n)?'the shared system says some of the details aren\u2019t valid':'P0001'===n&&l?l.slice(0,140):l?`the shared system said: ${l.slice(0,120)}`:'the shared system refused it';return'23505'===n?'the shared system already has another copy of it':'23503'===n?'a related change has to save first':/^PGRST30/.test(n)||401===c||/jwt/i.test(l)?'your sign-in is being refreshed':'the shared system is busy'};var e=r(d[0]);const t=e=>{const t=e&&'object'==typeof e?e:{};return{msg:String(t.message??e??''),code:String(t.code??''),status:Number(t.status??0)||0,hint:String(t.hint??'')}},s=e=>{const s=t(e);return/delete guard/i.test(s.hint)||/too many .* deleted in 10 minutes/i.test(s.msg)};const o=e=>Math.min(5e3*Math.pow(3,Math.max(0,e-1)),3e5),n={bookings:'booking',walk_ins:'walk-in',blocks:'blocked time',sold_out_items:'sold-out mark',sold_out_links:'dish stock link',staff:'staff details',rota_shifts:'rota shift',stock_items:'stock item',stock_events:'stock count',stock_counts:'stock count',chat_messages:'chat message',recipe_cards:'recipe card',order_lists:'order list',order_list_items:'order list item',daily_task_ticks:'task tick',daily_tasks:'daily task',attendance:'clock in or out',cash_ups:'cash-up',table_plans:'table plan',guest_profiles:'guest profile',floor_live:'table status',venues:'venue settings',time_requests:'clock correction request',staff_leave:'time off',scheduled_notifications:'reminder',suppliers:'supplier',supplier_orders:'supplier order',takeaway_orders:'takeaway order'}},1014,[1010]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"APP_VERSION",{enumerable:!0,get:function(){return t}});const t='v0.3.12.160'},1015,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"APP_VERSION",{enumerable:!0,get:function(){return t}});const t='v0.3.12.161'},1015,[]); __d(function(g,_r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"TableRepository",{enumerable:!0,get:function(){return c}}),e.executeMutation=async function(t){const s=(t,s)=>{throw Object.assign(t,{status:s})};if('rpc'===t.kind){const{error:n,status:r}=await u().rpc(t.fn,t.values??{});return n&&s(n,r),'ok'}const n=u().from(t.table);if('upsert'===t.kind||'insert'===t.kind){const{error:r,status:o}=await n.upsert(t.values??{},{onConflict:t.conflictKey??'id',ignoreDuplicates:'insert'===t.kind});return r&&s(r,o),'ok'}let r='update'===t.kind?n.update(t.values??{}):n.delete();for(const[s,n]of Object.entries(t.match??{}))r=r.eq(s,n);const{data:o,error:c,status:h}=await r.select();c&&s(c,h);return'update'!==t.kind||o&&0!==o.length?'ok':'conflict'};var t=_r(d[0]),s=_r(d[1]),n=_r(d[2]),r=_r(d[3]),o=_r(d[4]);const u=()=>(0,n.getSupabase)();class c{constructor(t,s={}){this.table=t,this.opts=s,this.keyOf=s.keyOf??(t=>String(t.id)),this.keyColumns=s.keyColumns??['id'],this.venueCol=s.venueColumn??'venue_id'}rows(t){return s.cache.rows(this.table,t)}get(t,n){return s.cache.get(this.table,t,n)}subscribe(t,n){return s.cache.subscribe(this.table,t,n)}hydrate(t){return s.cache.hydrate(this.table,t)}async refresh(n,r={}){const c=()=>{let t=u().from(this.table).select('*').eq(this.venueCol,n);return this.opts.orderBy&&(t=t.order(this.opts.orderBy.column,{ascending:this.opts.orderBy.ascending??!0})),r.filter&&(t=r.filter(t)),t},h='bookings'===this.table?await(0,t.readPages)(async(t,s)=>{const{data:n,error:r}=await c().order('id').range(t,s);if(r)throw r;return n??[]}):await(async()=>{const{data:t,error:s}=await c().limit(this.opts.limit??1e3);if(s)throw s;return t??[]})();return s.cache.replace(this.table,n,h.map(t=>[this.keyOf(t),t]),t=>o.mutationQueue.hasPending(this.table,n,t)),h}async create(t,n){const u={...1===this.keyColumns.length&&'id'===this.keyColumns[0]?{id:(0,r.uuid)()}:{},...n,[this.venueCol]:t},c=this.keyOf(u);return s.cache.put(this.table,t,c,u),await o.mutationQueue.enqueue({table:this.table,venueId:t,kind:'insert'===this.opts.writeMode?'insert':'upsert',rowKey:c,values:u,conflictKey:this.opts.conflictKey??'id'}),u}async update(t,n,r,u={}){const c=s.cache.get(this.table,t,n),h={...this.matchFor(n,c),...u,[this.venueCol]:t};s.cache.patch(this.table,t,n,{...r,updated_at:(new Date).toISOString()}),await o.mutationQueue.enqueue({table:this.table,venueId:t,kind:'update',rowKey:n,values:r,match:h})}async remove(t,n){const r=s.cache.get(this.table,t,n),u={...this.matchFor(n,r),[this.venueCol]:t};s.cache.remove(this.table,t,n),await o.mutationQueue.enqueue({table:this.table,venueId:t,kind:'delete',rowKey:n,match:u})}matchFor(t,s){if(1===this.keyColumns.length&&'id'===this.keyColumns[0])return{id:t};const n={};for(const t of this.keyColumns)n[t]=s?.[t];return n}}},1016,[1017,1018,933,977,1013]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.readPages=async function(t,n=1e3){const s=[];for(let c=0;;c+=n){const o=await t(c,c+n-1);if(s.push(...o),o.length`cache:${t}:${n}`;function f(t){let s=n.get(t);return s||(s=new Map,n.set(t,s)),s}function p(n){s.delete(n),c.get(n)?.forEach(t=>t());const u=o.get(n);u&&clearTimeout(u),o.set(n,setTimeout(()=>{o.delete(n),t.kv.set(n,Array.from(f(n).entries()))},250))}const w={async hydrate(n,s){const c=l(n,s);if(u.has(c))return;u.add(c);const o=await t.kv.get(c,[]),w=f(c);let h=0;for(const[t,n]of o)w.has(t)||(w.set(t,n),h++);h&&p(c)},rows(t,n){const c=l(t,n);let o=s.get(c);return o||(o=Array.from(f(c).values()),s.set(c,o)),o},get:(t,n,s)=>f(l(t,n)).get(s),put(t,n,s,c){f(l(t,n)).set(s,c),p(l(t,n))},patch(t,n,s,c){const o=f(l(t,n)),u=o.get(s);u&&(o.set(s,{...u,...c}),p(l(t,n)))},remove(t,n,s){f(l(t,n)).delete(s)&&p(l(t,n))},replace(t,s,c,o=()=>!1){const u=l(t,s),w=f(u),h=new Map(c);w.forEach((t,n)=>{o(n)&&h.set(n,t)}),n.set(u,h),p(u)},subscribe(t,n,s){const o=l(t,n);let u=c.get(o);return u||(u=new Set,c.set(o,u)),u.add(s),()=>{u?.delete(s)}},async clearVenue(o,f){for(const p of f){const f=l(p,o);n.delete(f),s.delete(f),u.delete(f),await t.kv.remove(f),c.get(f)?.forEach(t=>t())}}}},1018,[977]); @@ -1197,7 +1197,7 @@ __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule', __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SEATED_BG",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"SEATED_FG",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"SEATED_MUTED",{enumerable:!0,get:function(){return u}}),e.isSeatedHighlight=function(t,o){return'seated'===t&&!o?.otherDay},e.seatedHighlightStyle=function(u){return{backgroundColor:o,borderColor:t.colours.goldLight,borderWidth:1.5,borderLeftWidth:8,borderLeftColor:n,...u}};var t=r(d[0]);const o=t.colours.gold,n=t.colours.onGold,u='#3F3218'},1114,[821]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.BookingTableButton=function({rid:e,booking:l,readOnly:y,turnBase:B=90,testID:f}){const[h,j]=(0,t.useState)(!1),k=(0,s.tableButtonLabel)(l.table),x=f??`table-btn-${l.id}`;if(y)return(0,c.jsx)(n.default,{testID:x,accessible:!0,accessibilityLabel:(0,s.tableButtonA11y)(l.table,!0),style:{minHeight:44,justifyContent:'center'},children:(0,c.jsx)(b.T,{size:16,weight:"semibold",colour:o.colours.goldLight,children:k})});return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(b.Button,{kind:"secondary",label:k,testID:x,accessibilityLabel:(0,s.tableButtonA11y)(l.table),onPress:()=>j(!0),style:{minHeight:44}}),h?(0,c.jsx)(u.TablePicker,{rid:e,booking:l,name:l.walkIn?'Walk-in':(l.name??'').replace(' (example)',''),turnBase:B,onClose:()=>j(!1)}):null]})};var e,t=r(d[0]),l=r(d[1]),n=(e=l)&&e.__esModule?e:{default:e},s=r(d[2]),o=r(d[3]),u=r(d[4]),b=r(d[5]),c=r(d[6])},1115,[34,102,1116,821,1117,794,25]); __d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"tableButtonLabel",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"tableButtonA11y",{enumerable:!0,get:function(){return s}}),e.tableOptions=function(t,n,o){const s=t.tables.map(t=>t.name).sort(l),c=new Set;return(t.joins??[]).forEach(t=>{t.tables.length>1&&c.add(t.tables.slice().sort(l).join('+'))}),[...n.map(t=>t.table),o].forEach(t=>{const n=a(t);n.length>1&&c.add(n.slice().sort(l).join('+'))}),[...s,...[...c].sort(l)]},e.tableOverlaps=function(t,l,o,s=90){const c=a(l);if(!c.length)return[];const b={...t,table:l};return o.filter(l=>l.id!==t.id&&l.date===t.date&&!['cancelled','noshow','finished'].includes(l.status)&&a(l.table).some(t=>c.includes(t))&&(0,n.startOf)(b)<(0,n.endOf)(l,s)&&(0,n.startOf)(l)<(0,n.endOf)(b,s))},Object.defineProperty(e,"tablePatch",{enumerable:!0,get:function(){return c}});var t=r(d[0]),n=r(d[1]);const a=t=>t?t.split('+').map(t=>t.trim()).filter(Boolean):[],l=(t,n)=>t.localeCompare(n,'en-GB',{numeric:!0}),o=n=>(0,t.tableNumbers)(n)||'No table',s=(n,a)=>`${(0,t.tableNumbersA11y)(n)}${a?'':', change table'}`;const c=t=>({table:t||void 0,tableSetHere:!0})},1116,[860,1101]); -__d(function(_g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.saveBookingTables=v,_e.TablePicker=function({rid:e,booking:u,name:g,turnBase:k=90,onClose:$,onSaved:w,onPickOnPlan:C}){const L=(0,b.usePlan)(e),S=(0,c.useBookings)(e),[T,P]=(0,l.useState)(()=>(0,b.tablesOf)((0,h.tableKey)((0,b.tablesOf)(u.table)))),W=(0,l.useMemo)(()=>(0,h.pickGroups)(L),[L]),z=S.filter(e=>e.date===u.date),I=(0,h.seatsOf)(L,T),D=(0,h.seatLine)(I.total,u.partySize),B=(0,h.pickClashes)(u,T,z,k),O=e=>(0,h.pickClashes)(u,[e],z,k)[0]?.with,R=(0,h.tableKey)(T)!==(0,h.tableKey)((0,b.tablesOf)(u.table)),M=(0,f.useBlocks)(e=>e.blocks),N=(0,f.blockAt)(M,e,u.date,u.time),[_,A]=(0,l.useState)(null),G=e=>{A(null),P(t=>(0,h.toggleTable)(t,e))},Y=async t=>{try{await v(e,u,t),w?.((0,h.savedWords)(g,u.partySize,t,(0,h.seatsOf)(L,t).total)),$()}catch(e){w?.(`Couldn\u2019t save tables for ${g}: ${String(e?.message??e).slice(0,120)}`)}},K=(0,x.jsxs)(n.default,{style:{gap:8},children:[(0,x.jsxs)(n.default,{testID:"table-pick-total",accessible:!0,accessibilityLabel:`${(0,h.tablesWords)(T)} picked. ${D.text}.`,children:[(0,x.jsx)(p.T,{size:18,weight:"semibold",center:!0,colour:y.colours.goldLight,children:(0,h.tablesWords)(T)}),(0,x.jsx)(p.T,{size:17,center:!0,colour:y.colours.text,children:D.text})]}),N?(0,x.jsx)(n.default,{testID:"table-pick-pause",accessible:!0,accessibilityLabel:`Note. New bookings are paused ${N.from} to ${N.to}${N.reason?` (${N.reason})`:''}. You can still assign tables to this booking.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:y.colours.goldMuted},children:(0,x.jsxs)(p.T,{size:16,center:!0,colour:y.colours.goldLight,children:["New bookings paused ",N.from,"\u2013",N.to,N.reason?` \xb7 ${N.reason}`:'',". You can still save tables for this booking."]})}):null,B.length?(0,x.jsx)(n.default,{testID:"table-pick-clash",accessible:!0,accessibilityLabel:`Warning. ${(0,h.clashWords)(B)} You can still save.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:y.colours.gold},children:(0,x.jsxs)(p.T,{size:16,weight:"semibold",center:!0,colour:y.colours.goldLight,children:[(0,h.clashWords)(B)," You can still save."]})}):null,_?(0,x.jsxs)(n.default,{testID:"table-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:_,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:y.colours.amber,backgroundColor:y.colours.amberBg,alignItems:'stretch'},children:[(0,x.jsx)(p.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:_}),(0,x.jsxs)(p.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,x.jsx)(p.Button,{testID:"table-pick-overcap-yes",label:"Use it anyway",accessibilityLabel:`Use it anyway, ${(0,h.tablesWords)(T)} for ${g}, ${u.partySize} people`,onPress:()=>{Y(T)},style:[j,{flexGrow:1}]}),(0,x.jsx)(p.Button,{testID:"table-pick-overcap-no",kind:"secondary",label:"Pick another table",onPress:()=>A(null),style:j})]})]}):null,(0,x.jsxs)(p.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[_?null:(0,x.jsx)(p.Button,{testID:"table-pick-save",label:B.length?'Save anyway':'Save tables',disabled:!R||!T.length,accessibilityLabel:`${B.length?'Save anyway, ':'Save, '}${(0,h.tablesWords)(T)} for ${g}. ${D.text}.${B.length?` ${(0,h.clashWords)(B)}`:''}`,onPress:()=>{const e=(0,h.overCapacityAsk)(T,I.total,u.partySize);!e||_?Y(T):A(e)},style:[j,{flexGrow:1}]}),(0,b.tablesOf)(u.table).length?(0,x.jsx)(p.Button,{testID:"table-pick-clear",kind:"secondary",label:"Clear table",accessibilityLabel:`Clear table, take ${(0,h.tablesWords)((0,b.tablesOf)(u.table)).toLowerCase()} off ${g}`,onPress:()=>Y([]),style:j}):null,(0,x.jsx)(p.Button,{testID:"table-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",onPress:$,style:j})]})]});return(0,x.jsxs)(p.Sheet,{visible:!0,onClose:$,title:`Tables \xb7 ${u.time} ${g} \xb7 ${u.partySize} Covers`,maxWidth:760,testID:"table-picker",footer:K,children:[(0,x.jsx)(t.TableNumberWarning,{plan:L}),(0,x.jsx)(p.T,{size:16,center:!0,colour:y.colours.text,children:"Tap one table, or several to join them. Tap again to take one off. Smaller tables can still be used."}),C?(0,x.jsx)(p.Button,{kind:"secondary",testID:"table-pick-on-plan",label:"Pick on the table plan",accessibilityLabel:`Pick on the table plan instead, for ${g}`,onPress:()=>C(T),style:j}):null,W.map(e=>(0,x.jsxs)(n.default,{style:{gap:6},accessibilityLabel:e.area,children:[(0,x.jsx)(p.T,{size:15,weight:"semibold",center:!0,colour:y.colours.gold,children:e.area}),(0,x.jsx)(p.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:e.tables.map(e=>{const t=T.includes(e.name),l=O(e.name);return(0,x.jsxs)(o.default,{testID:`table-pick-${e.name}`,accessibilityRole:"checkbox",accessibilityState:{checked:t},'aria-checked':t,accessibilityLabel:(0,h.pickA11y)(e.name,e.seats,t,l),onPress:()=>G(e.name),style:({pressed:e})=>({minWidth:92,minHeight:64,paddingHorizontal:10,paddingVertical:6,borderRadius:12,alignItems:'center',justifyContent:'center',borderWidth:t?2:1,borderColor:t?y.colours.gold:l?y.colours.goldMuted:y.colours.hairline,borderStyle:l&&!t?'dashed':'solid',backgroundColor:t?y.colours.gold:e?y.colours.tilePressed:y.colours.tile}),children:[(0,x.jsx)(p.T,{size:18,weight:"semibold",colour:t?y.colours.onGold:y.colours.text,children:(0,s.tableNumbers)(e.name)}),(0,x.jsxs)(p.T,{size:14,colour:t?y.colours.onGold:y.colours.muted,children:[e.seats," seats",l?' \xb7 booked':'']})]},e.name)})})]},e.area)),W.length?null:(0,x.jsx)(p.Muted,{center:!0,children:"No tables on the plan yet. Add them in Setup \u203a Table plan."})]})};var t=r(d[0]),s=r(d[1]),l=r(d[2]),o=e(r(d[3])),n=e(r(d[4])),c=r(d[5]),b=r(d[6]),u=r(d[7]),h=r(d[8]),y=r(d[9]),g=r(d[10]),p=r(d[11]),k=r(d[12]),f=r(d[13]),x=r(d[14]);const j={minHeight:56};async function v(e,t,s){const l=(0,h.tableKey)(s),o=(0,b.tablesOf)(t.table);await c.repo.bookings.update(t.id,(0,u.tablePatch)(l||null)),'seated'===t.status&&t.date===(0,g.venueYmd)(new Date)&&(o.filter(e=>!(0,b.tablesOf)(l).includes(e)).forEach(t=>b.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!0})),l&&(0,k.resetTableLive)(e,l))}},1117,[1118,860,34,402,102,874,1025,1116,1119,821,858,794,1120,1022,25]); +__d(function(_g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.saveBookingTables=v,_e.TablePicker=function({rid:e,booking:u,name:g,turnBase:k=90,onClose:$,onSaved:w,onPickOnPlan:C}){const L=(0,b.usePlan)(e),S=(0,c.useBookings)(e),[T,P]=(0,l.useState)(()=>(0,b.tablesOf)((0,h.tableKey)((0,b.tablesOf)(u.table)))),W=(0,l.useMemo)(()=>(0,h.pickGroups)(L),[L]),z=S.filter(e=>e.date===u.date),I=(0,h.seatsOf)(L,T),D=(0,h.seatLine)(I.total,u.partySize),B=(0,h.pickClashes)(u,T,z,k),O=e=>(0,h.pickClashes)(u,[e],z,k)[0]?.with,R=(0,h.tableKey)(T)!==(0,h.tableKey)((0,b.tablesOf)(u.table)),M=(0,f.useBlocks)(e=>e.blocks),N=(0,f.blockAt)(M,e,u.date,u.time),[_,A]=(0,l.useState)(null),G=e=>{A(null),P(t=>(0,h.toggleTable)(t,e))},Y=async t=>{try{await v(e,u,t),w?.((0,h.savedWords)(g,u.partySize,t,(0,h.seatsOf)(L,t).total)),$()}catch(e){w?.(`Couldn\u2019t save tables for ${g}: ${String(e?.message??e).slice(0,120)}`)}},K=(0,x.jsxs)(n.default,{style:{gap:8},children:[(0,x.jsxs)(n.default,{testID:"table-pick-total",accessible:!0,accessibilityLabel:`${(0,h.tablesWords)(T)} picked. ${D.text}.`,children:[(0,x.jsx)(p.T,{size:18,weight:"semibold",center:!0,colour:y.colours.goldLight,children:(0,h.tablesWords)(T)}),(0,x.jsx)(p.T,{size:17,center:!0,colour:y.colours.text,children:D.text})]}),N?(0,x.jsx)(n.default,{testID:"table-pick-pause",accessible:!0,accessibilityLabel:`Note. New bookings are paused ${N.from} to ${N.to}${N.reason?` (${N.reason})`:''}. You can still assign tables to this booking.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:y.colours.goldMuted},children:(0,x.jsxs)(p.T,{size:16,center:!0,colour:y.colours.goldLight,children:["New bookings paused ",N.from,"\u2013",N.to,N.reason?` \xb7 ${N.reason}`:'',". You can still save tables for this booking."]})}):null,B.length?(0,x.jsx)(n.default,{testID:"table-pick-clash",accessible:!0,accessibilityLabel:`Warning. ${(0,h.clashWords)(B)} You can still save.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:y.colours.gold},children:(0,x.jsxs)(p.T,{size:16,weight:"semibold",center:!0,colour:y.colours.goldLight,children:[(0,h.clashWords)(B)," You can still save."]})}):null,_?(0,x.jsxs)(n.default,{testID:"table-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:_,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:y.colours.gold,backgroundColor:y.colours.amberBg,alignItems:'stretch'},children:[(0,x.jsx)(p.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:_}),(0,x.jsxs)(p.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,x.jsx)(p.Button,{testID:"table-pick-overcap-yes",label:"Use it anyway",accessibilityLabel:`Use it anyway, ${(0,h.tablesWords)(T)} for ${g}, ${u.partySize} people`,onPress:()=>{Y(T)},style:[j,{flexGrow:1}]}),(0,x.jsx)(p.Button,{testID:"table-pick-overcap-no",kind:"secondary",label:"Pick another table",onPress:()=>A(null),style:j})]})]}):null,(0,x.jsxs)(p.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[_?null:(0,x.jsx)(p.Button,{testID:"table-pick-save",label:B.length?'Save anyway':'Save tables',disabled:!R||!T.length,accessibilityLabel:`${B.length?'Save anyway, ':'Save, '}${(0,h.tablesWords)(T)} for ${g}. ${D.text}.${B.length?` ${(0,h.clashWords)(B)}`:''}`,onPress:()=>{const e=(0,h.overCapacityAsk)(T,I.total,u.partySize);!e||_?Y(T):A(e)},style:[j,{flexGrow:1}]}),(0,b.tablesOf)(u.table).length?(0,x.jsx)(p.Button,{testID:"table-pick-clear",kind:"secondary",label:"Clear table",accessibilityLabel:`Clear table, take ${(0,h.tablesWords)((0,b.tablesOf)(u.table)).toLowerCase()} off ${g}`,onPress:()=>Y([]),style:j}):null,(0,x.jsx)(p.Button,{testID:"table-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",onPress:$,style:j})]})]});return(0,x.jsxs)(p.Sheet,{visible:!0,onClose:$,title:`Tables \xb7 ${u.time} ${g} \xb7 ${u.partySize} Covers`,maxWidth:760,testID:"table-picker",footer:K,children:[(0,x.jsx)(t.TableNumberWarning,{plan:L}),(0,x.jsx)(p.T,{size:16,center:!0,colour:y.colours.text,children:"Tap one table, or several to join them. Tap again to take one off. Smaller tables can still be used."}),C?(0,x.jsx)(p.Button,{kind:"secondary",testID:"table-pick-on-plan",label:"Pick on the table plan",accessibilityLabel:`Pick on the table plan instead, for ${g}`,onPress:()=>C(T),style:j}):null,W.map(e=>(0,x.jsxs)(n.default,{style:{gap:6},accessibilityLabel:e.area,children:[(0,x.jsx)(p.T,{size:15,weight:"semibold",center:!0,colour:y.colours.gold,children:e.area}),(0,x.jsx)(p.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:e.tables.map(e=>{const t=T.includes(e.name),l=O(e.name);return(0,x.jsxs)(o.default,{testID:`table-pick-${e.name}`,accessibilityRole:"checkbox",accessibilityState:{checked:t},'aria-checked':t,accessibilityLabel:(0,h.pickA11y)(e.name,e.seats,t,l),onPress:()=>G(e.name),style:({pressed:e})=>({minWidth:92,minHeight:64,paddingHorizontal:10,paddingVertical:6,borderRadius:12,alignItems:'center',justifyContent:'center',borderWidth:t?2:1,borderColor:t?y.colours.gold:l?y.colours.goldMuted:y.colours.hairline,borderStyle:l&&!t?'dashed':'solid',backgroundColor:t?y.colours.gold:e?y.colours.tilePressed:y.colours.tile}),children:[(0,x.jsx)(p.T,{size:18,weight:"semibold",colour:t?y.colours.onGold:y.colours.text,children:(0,s.tableNumbers)(e.name)}),(0,x.jsxs)(p.T,{size:14,colour:t?y.colours.onGold:y.colours.muted,children:[e.seats," seats",l?' \xb7 booked':'']})]},e.name)})})]},e.area)),W.length?null:(0,x.jsx)(p.Muted,{center:!0,children:"No tables on the plan yet. Add them in Setup \u203a Table plan."})]})};var t=r(d[0]),s=r(d[1]),l=r(d[2]),o=e(r(d[3])),n=e(r(d[4])),c=r(d[5]),b=r(d[6]),u=r(d[7]),h=r(d[8]),y=r(d[9]),g=r(d[10]),p=r(d[11]),k=r(d[12]),f=r(d[13]),x=r(d[14]);const j={minHeight:56};async function v(e,t,s){const l=(0,h.tableKey)(s),o=(0,b.tablesOf)(t.table);await c.repo.bookings.update(t.id,(0,u.tablePatch)(l||null)),'seated'===t.status&&t.date===(0,g.venueYmd)(new Date)&&(o.filter(e=>!(0,b.tablesOf)(l).includes(e)).forEach(t=>b.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!0})),l&&(0,k.resetTableLive)(e,l))}},1117,[1118,860,34,402,102,874,1025,1116,1119,821,858,794,1120,1022,25]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.TableNumberWarning=function({plan:u}){const c=(0,n.numberClashes)(u.tables),o=[...new Set([...c.acrossAreas,...u.tables.filter(n=>c.sameArea.has(n.name)).map(n.tableNumber)])];return o.length?(0,l.jsxs)(t.T,{testID:"duplicate-table-numbers",size:16,colour:s.colours.goldLight,children:["Duplicate table numbers: ",o.join(', '),". Kept unchanged. Ask a manager to check the areas before assigning."]}):null},r(d[0]);var n=r(d[1]),s=r(d[2]),t=r(d[3]),l=r(d[4])},1118,[34,859,821,794,25]); __d(function(_g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"byNum",{enumerable:!0,get:function(){return s}}),e.tableKey=o,e.toggleTable=function(t,n){return t.includes(n)?t.filter(t=>t!==n):a(o([...t,n]))},e.seatsOf=function(t,n){const a={};for(const s of n)a[s]=t.tables.find(t=>t.name===s)?.maxSeats??0;return{per:a,total:Object.values(a).reduce((t,n)=>t+n,0)}},e.seatLine=function(t,n){const a=Math.max(0,n-t);return{text:`${t} ${1===t?'seat':'seats'} for ${l(n)}${a?`: ${a} short`:''}`,short:a,fits:0===a&&t>0}},e.pickClashes=function(t,l,u,c=90){if(!l.length)return[];const f={...t,table:o(l)},b=[];for(const s of u)if(s.id!==t.id&&s.date===t.date&&!['cancelled','noshow','finished'].includes(s.status)&&(0,n.startOf)(f)<(0,n.endOf)(s,c)&&(0,n.startOf)(s)<(0,n.endOf)(f,c))for(const t of a(s.table))l.includes(t)&&b.push({table:t,with:s});return b.sort((t,n)=>s(t.table,n.table))},e.overCapacityAsk=function(n,s,l){const u=a(o(n));if(!u.length||s>=l)return null;const c=u.map(n=>(0,t.tableNumbers)(n));return`${1===c.length?`Table ${c[0]} seats`:`Tables ${c.slice(0,-1).join(', ')} and ${c[c.length-1]} seat`} ${s} \u2013 this booking is ${l}. Use it anyway?`},e.clashWords=function(n){return n.map(n=>`${(0,t.tableNumbers)(n.table)} has ${n.with.walkIn?'a walk-in':(n.with.name||'a booking').replace(' (example)','')} at ${n.with.time}`).join('. ')+(n.length?'.':'')},e.tablesWords=u,e.pickA11y=function(n,a,s,l){return`Table ${(0,t.tableNumbers)(n)}, ${a} ${1===a?'seat':'seats'}${s?', selected':''}${l?`, has ${l.walkIn?'a walk-in':l.name} at ${l.time}`:''}`},e.pickGroups=function(t){return t.areas.map(n=>({area:n.name,tables:t.tables.filter(t=>t.areaId===n.id).map(t=>({name:t.name,seats:t.maxSeats})).sort((t,n)=>s(t.name,n.name))})).filter(t=>t.tables.length)},e.savedWords=function(t,n,a,s){return a.length?`${t}, ${l(n)}: ${u(a)} (${s} seats).`:`${t}: table taken off.`},e.tableActions=function(t,n){const s=a(t.table);if(['cancelled','noshow'].includes(t.status))return[];const o=[s.length?{id:'assign',label:'Change table',a11y:`Change table for ${n}, ${l(t.partySize)}, now ${u(s).toLowerCase()}. You can pick several tables to join.`}:{id:'assign',label:'Assign table',a11y:`Assign table for ${n}, ${l(t.partySize)}. You can pick several tables to join.`}];s.length&&o.push({id:'clear',label:'Clear table',a11y:`Clear table for ${n}, take ${u(s).toLowerCase()} off this booking`});return o},e.dragTables=function(t,n,s){if(!s||'__none'===s||s===n)return null;const l=a(t);if(l.includes(s))return null;return o('__none'!==n&&l.includes(n)?l.map(t=>t===n?s:t):[s])};var t=r(d[0]),n=r(d[1]);const a=t=>t?t.split('+').map(t=>t.trim()).filter(Boolean):[],s=(t,n)=>t.localeCompare(n,'en-GB',{numeric:!0}),l=t=>`${t} ${1===t?'person':'people'}`;function o(t){return[...new Set(t.map(t=>String(t).trim()).filter(Boolean))].sort(s).join('+')}function u(n){const s=a(o(n));return s.length?(0,t.tableListNumbers)(s):'No table'}},1119,[860,1101]); __d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"TABLES",{enumerable:!0,get:function(){return O}}),_e.useTableNames=N,_e.resetTableLive=M,_e.seatBookingNow=L,_e.finishBookingNow=async function(e,t){await f.repo.bookings.setStatus(t.id,'finished'),(0,S.tablesOf)(t.table).forEach(t=>S.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!0}))},_e.useTableUse=F,Object.defineProperty(_e,"walkInLabel",{enumerable:!0,get:function(){return R}}),_e.TablePicker=W,_e.WalkInSheet=E,_e.WalkInMatchPrompt=H,_e.AssignTableSheet=_,_e.undoNotice=Y,_e.NewBookingSheet=U,_e.useFrontDoor=function(e,t){const[s,o]=(0,r.useState)(!1),[l,a]=(0,r.useState)(!1),[i,d]=(0,r.useState)(null);return{openWalkIn:()=>o({}),openWalkInAt:e=>o({table:e}),openBooking:()=>a(!0),assignTable:e=>d({b:e}),combineTables:e=>d({b:e,combine:!0}),elements:(0,B.jsxs)(B.Fragment,{children:[s?(0,B.jsx)(E,{wide:t,initialTable:s.table,onClose:()=>o(!1),onSeated:Y}):null,l?(0,B.jsx)(U,{wide:t,date:e,onClose:()=>a(!1),onSaved:e=>(0,n.notify)({id:`booked:${Date.now()}`,testID:'booking-saved-toast',timeoutMs:5e3,icon:'\u2713',title:`Booked: ${e.name} \xb7 ${(0,x.niceDate)((0,x.parseYmd)(e.date))} at ${e.time}`})}):null,i?(0,B.jsx)(_,{booking:i.b,combine:i.combine,onClose:()=>d(null)}):null]})}};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),a=_r(_d[4]),i=_r(_d[5]),n=_r(_d[6]),r=_r(_d[7]),d=e(r),u=_r(_d[8]),c=e(_r(_d[9])),b=e(_r(_d[10])),h=_r(_d[11]),p=_r(_d[12]),f=_r(_d[13]),y=_r(_d[14]),k=_r(_d[15]),x=_r(_d[16]),j=_r(_d[17]),w=_r(_d[18]),T=_r(_d[19]),S=_r(_d[20]),v=_r(_d[21]),C=_r(_d[22]),D=_r(_d[23]),I=_r(_d[24]),$=_r(_d[25]),P=_r(_d[26]),z=_r(_d[27]),B=_r(_d[28]);const O=Array.from({length:12},(e,t)=>String(t+1));function N(e){const t=(0,S.usePlan)(e);return t.areas.flatMap(e=>t.tables.filter(t=>t.areaId===e.id).map(e=>e.name))}function M(e,t){(0,S.tablesOf)(t).forEach(t=>S.useFloor.getState().setLive(e,t,{stage:'seated',dirty:!1}))}async function L(e,t){await f.repo.bookings.setStatus(t.id,'seated'),M(e,t.table)}function F(e,t){const s=(0,f.useBookings)(e),o=(0,f.useOrders)(e),l=N(e),a=(0,S.useFloor)(t=>t.live[e])??{},i=(0,S.usePlan)(e),n=(0,v.useBlocks)(e=>e.blocks),r=(0,x.ymd)(t),d=(0,v.closedAreasAt)(n,e,r,(0,x.hm)(t)),u={};for(const e of l)u[e]=a[e]?.blocked||d.has(`tbl:${e}`)?{busy:!0,label:'Blocked'}:d.has(i.tables.find(t=>t.name===e)?.areaId??'')?{busy:!0,label:'Closed'}:a[e]?.dirty?{busy:!0,label:'Needs clearing'}:{busy:!1,label:'Free'};for(const e of s)if(e.date===r&&e.table)for(const s of(0,S.tablesOf)(e.table))if(u[s])if('seated'===e.status)u[s]={busy:!0,label:`${e.walkIn?'Walk-in':`${e.name.slice(0,1)}.`} \xb7 ${e.partySize}`};else if('confirmed'===e.status&&!u[s].busy){const o=(0,x.minsBetween)(t,new Date(`${e.date}T${e.time}:00`));o>=-15&&o<=90&&(u[s]={...u[s],soon:`Booked ${e.time}`})}for(const e of o)'table'===e.type&&e.tableNo&&u[e.tableNo]&&!['closed','cancelled','collected'].includes(e.status)&&!u[e.tableNo].busy&&(u[e.tableNo]={busy:!0,label:'Open order'});return u}const R=e=>e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;function W({use:e,value:t,onPick:s,big:o,best:a,dense:i,bestSet:n,picked:d}){const u=Object.keys(e),[h,p]=(0,r.useState)(0),f=i?6:8,y=i?64:o?92:76,k=h?Math.max(3,Math.floor((h+f)/(y+f))):0,x=k?Math.floor((h-f*(k-1))/k):y,w=new Set(n??[]),v=a?(0,S.tablesOf)(a)[0]:null;return(0,B.jsx)(b.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:f},testID:"table-picker",onLayout:e=>p(Math.floor(e.nativeEvent.layout.width)),children:u.map(o=>{const a=e[o],n=t===o||!!d?.includes(o),r=w.has(o),u=v===o&&!n,h=a.busy?['Blocked','Needs clearing','Closed'].includes(a.label)?a.label:'In use':a.soon??'Free';return(0,B.jsxs)(c.default,{accessibilityRole:"button",testID:`pick-table-${o}`,accessibilityLabel:`Table ${(0,l.tableNumbers)(o)}${d?n?', picked':', not picked':''}, ${a.busy?`in use (${a.label})`:a.soon?`free, ${a.soon}`:'free'}${r?', best table':''}${u?', suggested for this party':''}`,accessibilityState:{selected:n,disabled:'Closed'===a.label},disabled:'Closed'===a.label,onPress:()=>s(o),style:{width:x,minHeight:i?58:64,borderRadius:12,borderWidth:n||u?2.5:1.5,paddingVertical:i?3:6,paddingHorizontal:4,alignItems:'center',justifyContent:'center',gap:2,borderColor:n||u?j.colours.gold:a.busy?j.colours.red:j.colours.ok,backgroundColor:n?j.colours.goldTint:a.busy?j.colours.redBg:j.colours.surface2,opacity:'Closed'!==a.label||n?1:.55},children:[(0,B.jsxs)(b.default,{style:{flexDirection:'row',alignItems:'center',gap:4},children:[(0,B.jsx)(T.T,{weight:"bold",size:22,colour:n?j.colours.goldLight:j.colours.text,children:(0,l.tableNumbers)(o)}),r?(0,B.jsx)(b.default,{testID:"best-table",style:{backgroundColor:j.colours.gold,borderRadius:5,paddingHorizontal:4,paddingVertical:1},children:(0,B.jsx)(T.T,{size:11,weight:"bold",colour:j.colours.onGold,children:"BEST"})}):null]}),(0,B.jsx)(T.T,{size:i?13:14,colour:a.busy?'#FFD9D4':a.soon?'#FFE2A8':'#E2C489',center:!0,numberOfLines:1,children:h})]},o)})})}const A=[1,2,3,4,5,6,7,8];function E({onClose:e,onSeated:a,wide:i,initialTable:y}){const{rid:w,r:C,now:D}=(0,p.useCtx)(15e3),I=F(w,D),[$,P]=(0,r.useState)(2),[O,N]=(0,r.useState)(!1),[R,E]=(0,r.useState)(y??null),_=(0,S.usePlan)(w),Y=(0,f.useBookings)(w),U=(0,v.useBlocks)(e=>e.blocks),q=(0,v.closedAreasAt)(U,w,(0,x.ymd)(D),(0,x.hm)(D)),Q=d.default.useMemo(()=>{const e=Object.fromEntries(Object.entries(I).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,k.suggestTable)(_,Y.filter(e=>e.date===(0,x.ymd)(D)),e,$,D,(0,k.turnFor)($,C.settings.turnMins),90,void 0,{closed:q})?.table??null},[_,Y,I,$,q.size,D.getTime()]);(0,r.useEffect)(()=>{R&&(0,S.tablesOf)(R).some(e=>'Closed'===I[e]?.label)&&E(null)},[R,q.size]);const[V,G]=(0,r.useState)(!1),[K,X]=(0,r.useState)(''),J=(e,t=String(e),s=()=>{N(!1),P(e)})=>{const o='9+'===t?O:!O&&$===e;return(0,B.jsx)(c.default,{accessibilityRole:"button",accessibilityLabel:'9+'===t?'Party of 9 or more':`Party of ${e}`,accessibilityState:{selected:o},onPress:s,style:{width:i?58:60,height:i?58:56,borderRadius:14,borderWidth:2,borderColor:j.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:o?j.colours.gold:'transparent'},children:(0,B.jsx)(T.T,{weight:"bold",size:22,colour:o?j.colours.onGold:j.colours.gold,children:t})},t)},Z=(0,B.jsx)(s.PartySizeInput,{value:$,onChange:P,min:9,max:o.MAX_PARTY,label:"Walk-in party size",testID:"walkin-party-size"}),ee=(0,B.jsxs)(b.default,{style:{gap:8,width:i?256:void 0},children:[(0,B.jsx)(T.T,{weight:"semibold",children:"How many people?"}),(0,B.jsxs)(b.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},testID:"walkin-party",children:[A.map(e=>J(e)),J(9,'9+',()=>{N(!0),P(e=>e>=9?e:9)})]}),O?Z:null]}),[te,se]=(0,r.useState)(!1),[oe,le]=(0,r.useState)(null),ae=async(t=R,s=!1)=>{if(!te){if(!s){const e=(0,z.bookingsNearWalkIn)(Y,D,$);if(e.length)return void le({at:t,list:e})}se(!0);try{const s=await f.repo.bookings.seatWalkIn(w,$,t??void 0,K);M(w,t??void 0),a(s),e()}finally{se(!1)}}},ie=async(t,s)=>{if(!te){se(!0);try{const o=s??t.table??null;o&&o!==t.table&&await f.repo.bookings.assignTable(t.id,o),await L(w,{...t,table:o??void 0}),(0,n.notify)({id:`seated:${t.id}`,testID:'walkin-match-toast',timeoutMs:5e3,icon:'\u2713',title:`${t.name} seated \xb7 ${t.partySize} \xb7 ${o?(0,l.tableNumbers)(o):'table to assign'} (booking ${t.ref})`}),le(null),e()}finally{se(!1)}}},ne=(0,B.jsxs)(b.default,{style:{gap:8,flex:i?1:void 0,minWidth:0},children:[(0,B.jsxs)(T.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsxs)(T.T,{weight:"semibold",children:["Table ",(0,B.jsx)(T.T,{colour:j.colours.muted,size:14,children:"(optional)"})]}),R?(0,B.jsx)(T.Button,{small:!0,kind:"ghost",label:"Clear table",onPress:()=>E(null)}):null]}),(0,B.jsx)(W,{use:I,value:R,onPick:e=>{I[e]&&!I[e].busy?ae(e):E(R===e?null:e)},big:i,dense:i,best:Q,bestSet:(0,u.bestTables)(_)}),(0,B.jsxs)(T.Muted,{children:["Tap a free table to seat them there",Q&&!R?` (suggested for ${$}: ${(0,l.tableNumbers)(Q)})`:'',", or Seat for no table yet. BEST marks the venue\u2019s best tables."]})]});return(0,B.jsxs)(T.Sheet,{visible:!0,onClose:e,title:`Walk-in \xb7 ${(0,x.hm)(D)}`,maxWidth:i?1100:void 0,testID:"walkin-sheet",children:[(0,B.jsx)(T.Button,{label:`Seat walk-in \xb7 ${$} ${1===$?'person':'people'}${R?` \xb7 ${(0,l.tableNumbers)(R)}`:''}`,disabled:te,onPress:()=>{ae()},testID:"seat-walkin",style:{minHeight:52}}),i?(0,B.jsxs)(T.Row,{gap:16,style:{alignItems:'flex-start'},children:[ee,ne]}):(0,B.jsxs)(B.Fragment,{children:[ee,ne]}),(0,B.jsxs)(T.Row,{gap:10,wrap:!0,style:{alignItems:'center'},children:[V?(0,B.jsx)(t.TextInput,{accessibilityLabel:"Walk-in note",placeholder:"Note (optional), e.g. high chair",placeholderTextColor:"#7D776C",value:K,onChangeText:X,style:[T.styles.input,{flex:1,minWidth:220}],autoFocus:!0}):(0,B.jsx)(T.Button,{small:!0,kind:"ghost",label:"Add a note (optional)",onPress:()=>G(!0)}),(0,B.jsx)(b.default,{style:{flex:1,minWidth:220},children:(0,B.jsxs)(T.Muted,{children:["No name needed. Counts in today's covers.",'staff'!==h.APP_VARIANT?' Using website bookings too? Mark the table there as well.':'']})})]}),oe?(0,B.jsx)(H,{list:oe.list,busy:te,onYes:e=>{ie(e,oe.at)},onNo:()=>{const e=oe.at;le(null),ae(e,!0)},onClose:()=>le(null)}):null]})}function H({list:e,busy:t,onYes:s,onNo:o,onClose:a}){return(0,B.jsx)(T.Sheet,{visible:!0,onClose:a,title:"Booked party?",maxWidth:720,testID:"walkin-match",children:(0,B.jsxs)(b.default,{style:{gap:14},children:[e.map((e,o)=>(0,B.jsxs)(b.default,{testID:`walkin-match-${o}`,style:{gap:12,padding:16,borderRadius:16,borderWidth:2,borderColor:j.colours.gold,backgroundColor:'#15130F'},children:[(0,B.jsx)(b.default,{accessibilityRole:"header",accessibilityLiveRegion:"polite",children:(0,B.jsx)(T.T,{size:26,weight:"bold",colour:j.colours.goldLight,testID:"walkin-match-question",children:(0,z.walkInMatchQuestion)(e)})}),e.table?(0,B.jsxs)(T.T,{size:17,colour:j.colours.text,children:["Booked table ",(0,l.tableNumbers)(e.table)," \xb7 ",e.ref]}):(0,B.jsx)(T.T,{size:17,colour:j.colours.text,children:e.ref}),(0,B.jsx)(T.Button,{label:"Yes, seat booking",testID:"walkin-match-yes",disabled:t,accessibilityLabel:`Yes, seat ${e.name}'s booking, ${e.partySize} people`,onPress:()=>s(e),style:{minHeight:64}})]},e.id)),(0,B.jsx)(T.Button,{kind:"secondary",label:"No, new walk-in",testID:"walkin-match-no",disabled:t,onPress:o,style:{minHeight:64}})]})})}function _({booking:e,onClose:t,combine:s}){const{rid:o,r:a,now:i}=(0,p.useCtx)(15e3),n=F(o,i),c=(0,S.usePlan)(o),h=(0,f.useBookings)(o),y=(0,S.tablesOf)(e.table),w=d.default.useMemo(()=>Object.fromEntries(Object.entries(n).map(([e,t])=>[e,y.includes(e)?{busy:!1,label:'This party',soon:'This party'}:t])),[n,e.table]),v=d.default.useMemo(()=>{const t=Object.fromEntries(Object.entries(w).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,k.suggestTable)(c,h.filter(e=>e.date===(0,x.ymd)(i)),t,e.partySize,i,(0,k.turnFor)(e.partySize,a.settings.turnMins),90,e.id)?.table??null},[c,h,w,e.partySize,i.getTime()]),[C,D]=(0,r.useState)(!!s||y.length>1),[I,$]=(0,r.useState)(y),P=e=>c.tables.find(t=>t.name===e)?.maxSeats??0,z=I.reduce((e,t)=>e+P(t),0),O=I.length>0&&z{const l=(0,S.joinTables)(s);await f.repo.bookings.assignTable(e.id,l);y.filter(e=>!s.includes(e)).forEach(t=>S.useFloor.getState().setLive(o,t,{stage:void 0,dirty:'seated'===e.status})),'seated'===e.status&&M(o,l),t()},L=C?(0,B.jsxs)(b.default,{style:{gap:8},testID:"assign-table-tip",children:[(0,B.jsx)(b.default,{accessibilityLiveRegion:"polite",children:(0,B.jsx)(T.T,{size:17,weight:"semibold",colour:j.colours.text,children:I.length?`${(0,S.tablesLabel)((0,S.joinTables)(I))} \xb7 ${z} seats for ${e.partySize} Covers`:'No tables picked yet'})}),O?(0,B.jsx)(b.default,{testID:"combine-short",children:(0,B.jsxs)(T.T,{size:15,weight:"semibold",colour:"#FFD9D4",children:["Not enough seats yet: ",e.partySize-z," more needed. Add another table."]})}):null,(0,B.jsx)(T.T,{size:15,colour:j.colours.text,children:"Tap each table to add or remove it, then tap Done. All of them show as taken until the party has finished."}),(0,B.jsxs)(T.Row,{gap:8,wrap:!0,children:[(0,B.jsx)(T.Button,{label:"Done",testID:"combine-done",disabled:!I.length,accessibilityLabel:I.length?`Done, save ${(0,S.tableCardLabel)((0,S.joinTables)(I))}`:'Done',onPress:()=>N(I)}),(0,B.jsx)(T.Button,{kind:"ghost",label:"Cancel",onPress:t})]})]}):(0,B.jsx)(b.default,{style:{gap:8},testID:"assign-table-tip",children:(0,B.jsx)(T.T,{size:15,colour:j.colours.text,children:"Red tables are in use right now; you can still pick one (e.g. joining a table). BEST marks the venue\u2019s best tables. Big party? Tap Combine tables."})});return(0,B.jsxs)(T.Sheet,{visible:!0,onClose:t,title:`${C?'Combine tables':'Assign table'} \xb7 ${R(e)}`,testID:"assign-table-sheet",footer:L,children:[v&&!C?(0,B.jsx)(b.default,{testID:"assign-suggested",children:(0,B.jsxs)(T.T,{size:16,weight:"semibold",colour:j.colours.goldLight,accessibilityLabel:`Suggested for ${e.partySize}: ${(0,S.tableCardLabel)(v)}`,children:["Suggested for ",e.partySize,": ",(0,l.tableNumbers)(v)]})}):null,C?null:(0,B.jsx)(T.Button,{kind:"secondary",label:"Combine tables",testID:"combine-start",accessibilityLabel:"Combine tables: pick several tables for this party",onPress:()=>D(!0)}),(0,B.jsx)(W,{use:w,best:C?null:v,bestSet:(0,u.bestTables)(c),picked:C?I:void 0,onPick:C?e=>$(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]):async e=>{await N([e])}})]})}function Y(e){(0,n.notify)({id:`walkin:${e.id}`,testID:'walkin-toast',timeoutMs:6e3,title:`${R(e)} seated \xb7 ${e.table?`${(0,l.tableNumbers)(e.table)}`:'table to assign'} (${e.ref})`,actions:[{label:'Undo',testID:'undo-walkin',onPress:()=>f.repo.bookings.undoWalkIn(e.id)},{label:'OK',kind:'ghost'}]})}function U({date:e,onClose:t,wide:n,onSaved:d}){const{rid:u,r:c,now:h,role:z,meId:O}=(0,p.useCtx)(6e4),N=(0,x.ymd)(h),[M,L]=(0,r.useState)(ee.blocks),[W,A]=(0,r.useState)(!1),[E,H]=(0,r.useState)(''),[_,Y]=(0,r.useState)(2),[U,q]=(0,r.useState)(null),[Q,V]=(0,r.useState)(''),[G,K]=(0,r.useState)(''),[X,J]=(0,r.useState)(''),[Z,ee]=(0,r.useState)('phone'),[te,se]=(0,r.useState)((0,D.emptyNeeds)()),oe=(0,D.needsMissing)(te),[le,ae]=(0,r.useState)(null),ie=(0,S.usePlan)(u),ne=(0,P.dogSetUp)(ie),re=!0===te.dog&&ne,de=te.dog?te.dogs:0,ue=(0,x.parseYmd)(M),ce=(0,k.turnFor)(_,c.settings.turnMins),be=F.filter(e=>e.date===M),he=e=>(0,k.freeTablesAt)(ie,be,_,new Date(`${M}${(0,l.tableNumbers)(e)}:00`),ce,c.settings.turnMins,{dog:!0,closed:(0,v.closedAreasAt)(R,u,M,e)}),ge=re&&U?he(U):[];(0,r.useEffect)(()=>{ae(null)},[re,U,_]);const pe=(0,y.bookingSlots)(c,ue,e=>F.filter(t=>t.date===M&&t.time===e&&'cancelled'!==t.status&&!t.walkIn).reduce((e,t)=>e+t.partySize,0),_,M===(0,x.ymd)(h)?h:(0,x.addMins)(ue,0),e=>F.filter(t=>t.date===M&&t.time===e&&'cancelled'!==t.status&&!t.walkIn).length),me=(0,w.ukPhone)(G),[fe,ye]=(0,r.useState)(!1),ke=U?pe.find(e=>e.time===U):void 0,xe=ke&&ke.left<_?{left:Math.max(0,ke.left),time:ke.time}:null,je=ke&&null!=ke.partiesLeft&&ke.partiesLeft<1?{time:ke.time,cap:ke.partiesCap??0}:null,we=xe||je,Te=U?(0,v.blockAt)(R,u,M,U):void 0,Se='staff'!==z,ve=!!U&&!(0,D.dogTimeOk)(c,F,M,U,de),Ce=!oe.length&&E.trim().length>=2&&!!U&&(!we||fe)&&(0,o.validParty)(_)&&me.ok&&(0,w.emailOk)(X)&&(!Te||Se&&W)&&(!re||ge.length>0)&&!ve,De=te.wheelchair>0||te.stepFree;return(0,B.jsxs)(T.Sheet,{visible:!0,onClose:t,title:`New booking \xb7 ${(0,x.niceDate)(ue)}`,maxWidth:n?760:void 0,testID:"booking-sheet",children:[(0,B.jsx)(D.FirstQuestions,{rid:u,value:te,onChange:se,party:_,audience:"staff"}),te.dog&&!ne?(0,B.jsx)(T.T,{size:13,colour:j.colours.amber,children:"Dog-friendly tables aren\u2019t marked yet. Managers \u203a Booking options \u203a Tables. Booking is allowed; check where the dog can sit."}):null,(0,B.jsx)(C.BookingDatePicker,{r:c,today:h,value:M,onChange:e=>{e!==M&&(L(e),q(null),A(!1))}}),(0,B.jsxs)(T.Row,{gap:6,children:[(0,B.jsx)(T.Chip,{label:"Phone",selected:'phone'===Z,onPress:()=>ee('phone')}),(0,B.jsx)(T.Chip,{label:"In person",selected:'in-person'===Z,onPress:()=>ee('in-person')})]}),(0,B.jsx)(T.Field,{label:"Name",value:E,onChangeText:H,placeholder:"e.g. Reid",testID:"nb-name"}),(0,B.jsx)(T.Field,{label:"Mobile or phone number (needed)",value:G,onChangeText:K,keyboardType:"phone-pad",placeholder:"e.g. 07700 900123",testID:"nb-phone"}),!me.ok&&G?(0,B.jsx)(T.T,{size:13,colour:j.colours.amber,children:me.error}):null,(0,B.jsx)(T.Field,{label:"Email (optional)",value:X,onChangeText:J,keyboardType:"email-address",autoCapitalize:"none",placeholder:"For an email confirmation too",testID:"nb-email"}),(0,w.emailOk)(X)?null:(0,B.jsx)(T.T,{size:13,colour:j.colours.amber,children:"That email doesn\u2019t look quite right."}),(0,B.jsxs)(b.default,{style:{gap:6,alignItems:'center'},children:[(0,B.jsx)(T.T,{center:!0,children:"Covers"}),(0,B.jsx)(s.PartySizeInput,{value:_,onChange:e=>{Y(e),ye(!1)},label:"Covers",testID:"nb-party"})]}),(0,B.jsx)(T.Row,{wrap:!0,gap:6,children:pe.map(e=>{const t=re&&e.available&&!he(e.time).length||!(0,D.dogTimeOk)(c,F,M,e.time,de);return(0,B.jsx)(T.Chip,{testID:`nb-slot-${e.time}`,label:e.time,sub:(0,v.blockAt)(R,u,M,e.time)?'Paused':t?'Dogs full':e.drinksOnly?'Drinks only':null!=e.partiesLeft&&e.partiesLeft<1||e.left<=0?'Full':`${e.left} left`,disabled:(e.past??!e.available)||t,selected:U===e.time,onPress:()=>{q(e.time),A(!1),ye(!1)}},e.time)})}),we?(0,B.jsxs)(b.default,{testID:"nb-over-capacity",accessible:!0,accessibilityLiveRegion:"polite",style:{borderWidth:1.5,borderColor:j.colours.amber,backgroundColor:j.colours.amberBg,borderRadius:12,padding:10,gap:6},children:[xe?(0,B.jsx)(T.T,{weight:"semibold",colour:j.colours.amber,children:(0,o.overCapacityNote)(_,xe.left,xe.time)}):null,je?(0,B.jsx)(T.T,{weight:"semibold",colour:j.colours.amber,children:(0,o.overPartiesNote)(je.time,je.cap)}):null,(0,B.jsx)(T.Chip,{label:fe?'Booking over the limit: on':'Book anyway (over the limit)',selected:fe,onPress:()=>ye(e=>!e),testID:"nb-over-ok"})]}):null,re&&U?(0,B.jsxs)(b.default,{style:{gap:6},testID:"nb-dog-tables",children:[(0,B.jsxs)(T.T,{size:14,weight:"semibold",children:["Dog-friendly table ",(0,B.jsxs)(T.T,{size:13,colour:j.colours.muted,children:["(",ie.areas.filter(e=>e.dogs).map(e=>e.name).join(' or '),")"]})]}),ge.length?(0,B.jsx)(T.Row,{wrap:!0,gap:6,children:ge.slice(0,10).map((e,t)=>(0,B.jsx)(T.Chip,{label:`${(0,l.tableNumbers)(e.table)}`,sub:`${e.area} \xb7 ${e.seats}${0===t?' \xb7 best':''}${De&&(0,P.accessibleSetUp)(ie)&&!(0,P.isAccessible)(ie,e.table)?' \xb7 not step-free':''}`,selected:(le??ge[0].table)===e.table,onPress:()=>ae(e.table)},e.table))}):(0,B.jsxs)(T.T,{size:14,colour:j.colours.amber,children:["No dog-friendly table free for ",_," at ",U,". Try another time."]})]}):null,Te?(0,B.jsxs)(b.default,{testID:"nb-block-warning",style:{borderWidth:1.5,borderColor:j.colours.amber,backgroundColor:j.colours.amberBg,borderRadius:12,padding:10,gap:6},children:[(0,B.jsxs)(T.T,{weight:"semibold",colour:j.colours.amber,children:["Bookings are paused ",Te.from,"\u2013",Te.to,Te.reason?` (${Te.reason})`:'']}),Se?(0,B.jsx)(T.Chip,{label:W?'Manager override on':'Override and book anyway',selected:W,onPress:()=>A(e=>!e)}):(0,B.jsx)(T.Muted,{children:"Ask a manager to override, or pick another time."})]}):null,pe.length?null:(0,B.jsx)(b.default,{testID:"nb-closed",children:(0,B.jsxs)(T.T,{size:14,weight:"semibold",colour:j.colours.amber,children:["Closed on ",(0,x.niceDate)(ue)," (per the venue\u2019s opening hours). Pick another date."]})}),(0,B.jsx)(D.MoreQuestions,{rid:u,r:c,value:te,onChange:se,party:_,date:M,time:U,today:(0,x.ymd)(h),bookings:F,audience:"staff",showTables:!1!==c.settings.tableRequests}),De&&!(0,P.accessibleSetUp)(ie)?(0,B.jsx)(T.T,{size:13,colour:j.colours.amber,children:"Step-free tables aren\u2019t marked yet (Managers \u203a Booking options \u203a Tables). Check the table works for a wheelchair."}):null,(0,B.jsx)(T.Field,{label:"Notes (optional)",value:Q,onChangeText:V,placeholder:I.NOTES_PLACEHOLDER,multiline:!0,numberOfLines:3,testID:"nb-notes"}),(0,i.depositDue)((0,i.depositOf)(c.settings),_)?(0,B.jsxs)(T.Muted,{children:["Deposit due: ",(0,a.gbp)((0,i.depositDue)((0,i.depositOf)(c.settings),_))," (",(0,a.gbp)((0,i.depositOf)(c.settings).perPersonPence)," per person for ",(0,i.depositOf)(c.settings).fromParty,"+). Deposits are paid through website bookings or to you, never in CoverCharge: tick Deposit paid on the booking once the guest has paid."]}):null,(0,B.jsxs)(T.Muted,{children:["The guest gets a confirmation text",X.trim()?' and email':''," automatically (preview mode: shown in the Outbox, not sent)."]}),ve?(0,B.jsxs)(T.T,{size:14,colour:j.colours.amber,children:["We already have the most dogs we can look after at ",U,". Try another time: dogs are very welcome then."]}):null,(0,B.jsx)(T.Button,{label:oe.length?oe[0]:'Save booking',testID:"nb-save",disabled:!Ce,onPress:()=>{if(M<(0,x.ymd)(h))return;const e=(0,D.needsPatch)(te),s=te.tableReq.find(e=>!re||ge.some(t=>t.table===e));f.repo.bookings.create({restaurantId:u,customerId:null,name:E.trim(),partySize:_,date:M,time:U,notes:Q.trim(),security:(0,i.depositDue)((0,i.depositOf)(c.settings),_)?'deposit':'none',depositPaid:0,...(0,i.depositDue)((0,i.depositOf)(c.settings),_)?{depositDue:(0,i.depositDue)((0,i.depositOf)(c.settings),_),depositPolicy:(0,i.depositWords)((0,i.depositOf)(c.settings),_,c.name).join(' '),depositRefundable:(0,i.depositOf)(c.settings).refundable,depositCutoffHours:(0,i.depositOf)(c.settings).cutoffHours}:{},phone:me.pretty,email:X.trim()||void 0,source:Z,...e,...pe.find(e=>e.time===U)?.drinksOnly?{drinksOnly:!0}:{},allergies:e.allergies??[],...re?{table:le??s??ge[0]?.table}:{}}).then(e=>(0,$.postNewBookingToKitchen)(e,O)).catch(()=>{}),d?.({date:M,time:U,name:E.trim()}),t()}})]})}},1120,[827,1121,1122,860,867,14,1123,34,859,402,102,872,1084,874,1124,1101,858,821,864,794,1025,1022,1125,1126,1131,1103,1097,1132,25]); @@ -1245,7 +1245,7 @@ __d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule' __d(function(g,_r,i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.gamesOn=function(){const e=b.useStore.getState().restaurants.find(e=>e.id===p.VENUE_RID);return!1!==e?.settings?.games},_e.useGameClock=I,_e.usePlayable=function(e,t){return(0,y.gamePlayable)(I(e,t))},Object.defineProperty(_e,"LENNY_GAME_URL",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"validGameUrl",{enumerable:!0,get:function(){return C}}),_e.gameBase=function(){const e=b.useStore.getState().restaurants.find(e=>e.id===p.VENUE_RID);return C(e?.settings?.gameUrl)??v},_e.BreakRoomCard=function({staffId:e,name:t,now:s}){const n=(0,b.useStore)(e=>!1!==e.restaurants.find(e=>e.id===p.VENUE_RID)?.settings?.games),[o,l]=(0,r.useState)(!1),c=I(e,s),u=(0,y.gamePlayable)(c);return n?(0,w.jsxs)(d.Card,{children:[(0,w.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(d.T,{weight:"semibold",children:"\ud83e\uded6 Break room"}),(0,w.jsx)(d.T,{size:13,colour:u?x.colours.ok:x.colours.muted,children:u?'Open':'Locked'})]}),(0,w.jsx)(d.Muted,{children:"Lenny\u2019s Kitchen Chaos, with the team as characters and a shared leaderboard. Playable on a break or when you\u2019re not clocked in."}),u?null:(0,w.jsx)(d.Muted,{testID:"break-room-locked-text",children:y.GAME_LOCKED_TEXT}),(0,w.jsx)(d.Button,{testID:"break-room-open",kind:"secondary",label:"Open the Break room",onPress:()=>l(!0)}),o?(0,w.jsx)(R,{staffId:e,name:t,playable:u,clock:c,onClose:()=>l(!1)}):null]}):null},Object.defineProperty(_e,"displayName",{enumerable:!0,get:function(){return T}}),_e.BreakRoom=R;var t=_r(_d[0]),s=_r(_d[1]),r=_r(_d[2]),n=e(r),o=e(_r(_d[3]));_r(_d[4]);var l=e(_r(_d[5])),c=e(_r(_d[6])),u=_r(_d[7]),d=_r(_d[8]),f=_r(_d[9]),m=_r(_d[10]),y=_r(_d[11]),h=_r(_d[12]),b=_r(_d[13]),p=_r(_d[14]),k=_r(_d[15]),j=_r(_d[16]),x=_r(_d[17]),w=_r(_d[18]);function I(e,t){const s=(0,m.useOwner)(e=>e.attendance);return(0,y.gameClock)(s,e,t)}const v='https://lennys-kitchen-chaos-13e285.deed.page/',C=e=>{try{const t=new URL(String(e??'').trim());return'https:'!==t.protocol||t.username||t.password?null:t.toString()}catch{return null}};function S(e){if('undefined'==typeof window)return null;const t=new URL(e);for(const e of['demo','unlock','name','staffId'])t.searchParams.delete(e);return t.searchParams.set('host','covercharge'),t.searchParams.set('hostOrigin',window.location.origin),{src:t.toString(),origin:t.origin}}const T=e=>String(e??'').replace(/\s*\(.*\)$/,'').replace(/\s+/g,' ').trim().slice(0,24).trim();function R({staffId:e,name:I,playable:R,clock:P,onClose:L,car:M}){const D=(0,m.useOwner)(e=>e.staff),O=(0,f.useAvatars)(e=>e.photos),_=(0,h.useSetup)(e=>e.looks),z=(0,r.useRef)(null),[N,U]=(0,r.useState)({}),[A,B]=(0,r.useState)(!1),[G,q]=(0,r.useState)(null),H=(0,b.useStore)(e=>C(e.restaurants.find(e=>e.id===p.VENUE_RID)?.settings?.gameUrl)??v),V=(0,r.useMemo)(()=>S(H),[H]),W=V?.origin??'',$=(0,j.useSync)(e=>'staff'===e.kind?e.staffRef??null:null),K=!(!$||!e||$===e),X=K?null:$??e??null,Y=T(I),[F,J]=(0,r.useState)(''),[Q,Z]=(0,r.useState)(null),ee=(0,r.useRef)(null),te=(0,r.useRef)(0),se=(0,r.useRef)(null),re=(0,r.useRef)(R);re.current=R;const ne=(0,r.useMemo)(()=>D.filter(e=>e.active&&!e.name.includes('(example)')),[D]);(0,r.useEffect)(()=>{const e=setTimeout(()=>{const e={};for(const s of ne){const r=null!=_[s.id]&&_[s.id]>=1e3?t.AVATAR_OPTIONS.find(e=>e.look===_[s.id]):void 0;if(r){e[s.id]=r.dataUrl;continue}const n=document.getElementById(`cc-av-${s.id}`)?.querySelector('svg');n&&(e[s.id]=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(n.outerHTML.includes('xmlns')?n.outerHTML:n.outerHTML.replace('clearTimeout(e)},[ne,_]);const oe=(0,r.useMemo)(()=>ne.map(e=>{const t=O[e.id]?.dataUrl??N[e.id],s={id:e.id,name:T(e.name),role:e.job||e.level||e.role};return t&&(s.avatarUrl=t),s}),[ne,O,N]),le=(0,r.useCallback)(e=>{try{W&&z.current?.contentWindow?.postMessage(e,W)}catch{}},[W]);return(0,r.useEffect)(()=>{const e=async e=>{if(!W||e.origin!==W||e.source!==z.current?.contentWindow)return;const t=e.data;if('string'!=typeof t?.type||!t.type.startsWith('lenny:'))return;if('lenny:ready'===t.type)return q('string'==typeof t.version?String(t.version).slice(0,12):null),void B(!0);const s=String(t.levelId??'').slice(0,40);if('lenny:scores:list'===t.type&&le({type:'lenny:scores:result',reqId:t.reqId,result:await(0,k.listScores)(s,Math.min(50,Number(t.limit)||10))}),'lenny:scores:submit'===t.type){const e=t.entry??{};if(!X||'string'==typeof e.staffId&&e.staffId!==X)return void le({type:'lenny:scores:result',reqId:t.reqId,result:{rank:null,entries:await(0,k.listScores)(s,10),id:null}});const r='string'==typeof e.characterId?e.characterId.slice(0,80):void 0;le({type:'lenny:scores:result',reqId:t.reqId,result:await(0,k.submitScore)(s,{score:Number(e.score)||0,stars:Number(e.stars)||0,badges:Array.isArray(e.badges)?e.badges.map(String).slice(0,30):[],stats:'object'==typeof e.stats&&e.stats?e.stats:{},characterId:r,character:'string'==typeof e.character?e.character.slice(0,60):void 0,staffId:X,name:Y})})}'lenny:roundAbandoned'===t.type&&J('The last round was stopped because the player changed. No score was saved.'),'lenny:roundStart'===t.type&&J(''),'lenny:progress'===t.type&&X&&t.staffId===X&&(0,k.saveProgress)(X,t.progress),'lenny:gameComplete'===t.type&&X&&t.staffId===X&&J(!0===t.firstTime?'Game complete! Character select is now unlocked.':'Game complete again. Nice work!')};return window.addEventListener('message',e),()=>window.removeEventListener('message',e)},[le,X,Y,W]),(0,r.useEffect)(()=>{B(!1),ee.current=null,se.current=null},[V?.src]),(0,r.useEffect)(()=>{if(!A)return;const e=e=>{se.current!==e&&(se.current=e,le({type:'lenny:setPlayable',playable:e}))},t=K?null:`${X??''}|${Y}`;if(t&&ee.current===t)return void e(R);const s=++te.current;ee.current=null,se.current&&e(!1),t&&(0,k.loadProgress)(X).catch(()=>null).then(r=>{s===te.current&&(le({type:'lenny:setPlayer',name:Y,staffId:X,...r?{progress:r}:{}}),ee.current=t,e(re.current))})},[A,K,X,Y,R,le]),(0,r.useEffect)(()=>{A&&le({type:'lenny:setRoster',staff:oe})},[A,oe,le]),(0,r.useEffect)(()=>{A&&null!==Q&&le({type:'lenny:setMuted',muted:Q})},[A,Q,le]),(0,w.jsx)(o.default,{visible:!0,animationType:"slide",onRequestClose:L,children:(0,w.jsxs)(c.default,{testID:"break-room",style:{flex:1,backgroundColor:(0,s.soutersSurface)('#000')},children:[M?(0,w.jsx)(E,{status:K?'Switching player\u2026':R?'Parked only \xb7 enjoy!':'Game locked',muted:!!Q,onPause:()=>le({type:'lenny:pause'}),onMute:()=>Z(!Q),onClose:L}):(0,w.jsxs)(d.Row,{style:{justifyContent:'space-between',padding:10,backgroundColor:x.colours.bg},children:[(0,w.jsx)(d.T,{weight:"semibold",children:"\ud83e\uded6 Break room"}),(0,w.jsx)(c.default,{testID:R&&!K?'break-playable':'break-locked',accessibilityLabel:G?`Game version ${G}`:void 0,children:(0,w.jsx)(d.T,{size:13,colour:R?x.colours.ok:x.colours.gold,children:K?'Switching player\u2026':R?'off'===P?'Off shift: enjoy!':'On your break: enjoy!':'Game locked'})}),(0,w.jsxs)(d.Row,{gap:4,children:[(0,w.jsx)(l.default,{testID:"break-room-mute",accessibilityRole:"button",accessibilityLabel:Q?'Turn sound and voice on':'Mute sound and voice',onPress:()=>Z(!Q),style:{padding:6},children:(0,w.jsx)(d.T,{weight:"semibold",colour:x.colours.gold,children:Q?'Sound on':'Mute'})}),(0,w.jsx)(l.default,{testID:"break-room-close",accessibilityRole:"button",onPress:L,style:{padding:6},children:(0,w.jsx)(d.T,{weight:"semibold",colour:x.colours.gold,children:"Close"})})]})]}),R||K?null:(0,w.jsx)(c.default,{testID:"break-locked-text",style:{paddingHorizontal:10,paddingVertical:6,backgroundColor:x.colours.surface},children:(0,w.jsx)(d.T,{size:13,colour:x.colours.text,children:y.GAME_LOCKED_TEXT})}),F?(0,w.jsx)(c.default,{testID:"break-notice",style:{paddingHorizontal:10,paddingVertical:6,backgroundColor:x.colours.surface},children:(0,w.jsx)(d.T,{size:13,colour:x.colours.muted,children:F})}):null,V?n.default.createElement('iframe',{ref:z,src:V.src,key:V.src,title:'Lenny\u2019s Kitchen Chaos','data-testid':'break-game',allow:'autoplay; fullscreen',style:{flex:1,width:'100%',height:'100%',border:0,background:'#000'}}):(0,w.jsx)(c.default,{style:{flex:1,alignItems:'center',justifyContent:'center'},children:(0,w.jsx)(d.Muted,{children:"The Break room opens in the web app."})}),(0,w.jsx)(c.default,{style:{position:'absolute',left:-9999,top:0,width:64,height:64,opacity:0},pointerEvents:"none",children:ne.map(e=>(0,w.jsx)(c.default,{nativeID:`cc-av-${e.id}`,children:(0,w.jsx)(u.AvatarLook,{look:_[e.id],id:e.id,name:e.name,size:96})},e.id))})]})})}function E({status:e,muted:t,onPause:s,onMute:r,onClose:n}){const o={minHeight:72,minWidth:150,paddingHorizontal:22,borderRadius:18,borderWidth:1.5,borderColor:x.colours.gold,alignItems:'center',justifyContent:'center'};return(0,w.jsxs)(c.default,{testID:"car-game-bar",style:{flexDirection:'row',alignItems:'center',gap:14,paddingHorizontal:16,paddingVertical:10,backgroundColor:x.colours.bg,borderBottomWidth:1,borderColor:x.colours.border},children:[(0,w.jsx)(l.default,{testID:"break-room-close",accessibilityRole:"button",accessibilityLabel:"Close the game",onPress:n,style:o,children:(0,w.jsx)(d.T,{size:20,weight:"semibold",colour:x.colours.gold,children:"Close"})}),(0,w.jsx)(l.default,{testID:"car-game-pause",accessibilityRole:"button",accessibilityLabel:"Pause the game",onPress:s,style:o,children:(0,w.jsx)(d.T,{size:20,weight:"semibold",colour:x.colours.gold,children:"Pause"})}),(0,w.jsxs)(c.default,{style:{flex:1,alignItems:'center',minWidth:0},children:[(0,w.jsx)(d.T,{size:22,weight:"semibold",center:!0,numberOfLines:1,children:"Lenny\u2019s Kitchen Chaos"}),(0,w.jsx)(d.T,{size:15,colour:x.colours.goldLight,center:!0,numberOfLines:1,children:`${e} \xb7 touch the big buttons on the game`})]}),(0,w.jsx)(l.default,{testID:"break-room-mute",accessibilityRole:"button",accessibilityLabel:t?'Turn sound and voice on':'Mute sound and voice',onPress:r,style:o,children:(0,w.jsx)(d.T,{size:20,weight:"semibold",colour:x.colours.gold,children:t?'Sound on':'Mute'})}),(0,w.jsx)(c.default,{testID:"car-game-parked",style:{...o,minWidth:0,borderColor:x.colours.goldMuted,backgroundColor:'rgba(201,162,74,0.12)'},children:(0,w.jsx)(d.T,{size:16,weight:"semibold",colour:x.colours.goldLight,children:"PARKED ONLY"})})]})}},1162,[928,828,34,395,236,402,102,925,794,926,891,1163,927,831,5,1164,987,821,25]); __d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"GAME_LOCKED_TEXT",{enumerable:!0,get:function(){return t}}),e.gameClock=function(t,n,o){if(!n)return'off';const a=new Date(o).getTime(),c=t.filter(t=>t.staffId===n&&t.in&&!t.out&&a-new Date(t.in).getTime()<72e6).sort((t,n)=>String(n.in).localeCompare(String(t.in)))[0];return c?c.breaks?.some(t=>!t.end)?'break':'working':'off'},Object.defineProperty(e,"gamePlayable",{enumerable:!0,get:function(){return n}});const t='You\u2019re clocked in, so the game is locked. Start your break or clock out in CoverCharge to play.';const n=t=>'working'!==t},1163,[]); __d(function(g,_r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.listScores=o,_e.submitScore=async function(e,t){const f=r.useSync.getState(),l=Math.max(0,Math.round(Number(t.score)||0));if(c()&&f.staffRef&&t.staffId===f.staffRef)try{const{data:r,error:s}=await a().from('game_scores').insert({venue_id:f.venueId,game:'lenny',level_id:e,staff_ref:f.staffRef??null,name:String(t.name||'Crew').replace(/\s+/g,' ').trim().slice(0,24),character_id:t.characterId??null,score:l,stars:Math.max(0,Math.min(3,Number(t.stars)||0)),stats:{...t.stats??{},badges:t.badges??[],character:t.character??null}}).select('id').single();if(s)throw s;const{count:n}=await a().from('game_scores').select('id',{count:'exact',head:!0}).eq('venue_id',f.venueId).eq('game','lenny').eq('level_id',e).gt('score',l);return{rank:(n??0)+1,entries:await o(e,10),id:r.id}}catch{}const u=await s.kv.get(n,{}),y=[...u[e]??[],{...t,score:l,date:(new Date).toISOString()}].sort((e,t)=>t.score-e.score).slice(0,50);return await s.kv.set(n,{...u,[e]:y}),{rank:y.findIndex(e=>e.score===l)+1,entries:y.slice(0,10),id:null}},_e.loadProgress=async function(e){if(!e)return null;const t=r.useSync.getState();if(l(e))try{const{data:r,error:s}=await a().from('game_progress').select('progress').eq('venue_id',t.venueId).eq('game','lenny').eq('staff_ref',e).maybeSingle();if(s)throw s;if(r)return v(r.progress)}catch{}return v((await s.kv.get(f,{}))[e])},Object.defineProperty(_e,"LENNY_LAST_WORLD",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"LENNY_LEVELS",{enumerable:!0,get:function(){return y}}),_e.cleanProgress=v,_e.saveProgress=async function(e,t){const n=v(t);if(!e||!n||JSON.stringify(n).length>16e3)return;const c=await s.kv.get(f,{});await s.kv.set(f,{...c,[e]:n});const o=r.useSync.getState();if(l(e))try{await a().from('game_progress').upsert({venue_id:o.venueId,game:'lenny',staff_ref:e,progress:n,updated_at:(new Date).toISOString()},{onConflict:'venue_id,game,staff_ref'})}catch{}};var e=_r(d[0]),t=_r(d[1]),r=_r(d[2]),s=_r(d[3]);const a=()=>(0,e.getSupabase)(),n='lenny:scores:v1',c=()=>(0,t.isSupabaseConfigured)()&&!!r.useSync.getState().venueId&&'staff'===r.useSync.getState().kind;async function o(e,t=10){if(c())try{const{data:s,error:n}=await a().from('game_scores').select('*').eq('venue_id',r.useSync.getState().venueId).eq('game','lenny').eq('level_id',e).order('score',{ascending:!1}).limit(t);if(n)throw n;return(s??[]).map(e=>({name:e.name,staffId:e.staff_ref,characterId:e.character_id??void 0,character:e.stats?.character,score:e.score,stars:e.stars,badges:e.stats?.badges??[],stats:e.stats,date:e.created_at}))}catch{}return((await s.kv.get(n,{}))[e]??[]).sort((e,t)=>t.score-e.score).slice(0,t)}const f='lenny:progress:v1',l=e=>{const t=r.useSync.getState();return c()&&!!t.staffRef&&e===t.staffRef};const u='festival',y=['mop','dsoap','dish','dtower','dscrub','mussels','ppeel','pfifo','bin1','bin2','bin3','mothersday','bin4','creel1','creel2','dsundae','dplate','pass','rush','delivery','death','line','steak','festival'];function v(e){if(!e||'object'!=typeof e||Array.isArray(e))return null;const t=e,r=e=>('string'==typeof e||'number'==typeof e)&&String(e).length>0&&String(e).length<=60?String(e):null,s={};if(t.stars&&'object'==typeof t.stars&&!Array.isArray(t.stars))for(const[e,a]of Object.entries(t.stars).slice(0,300)){const t=r(e),n=Math.max(0,Math.min(3,Math.floor(Number(a)||0)));t&&(s[t]=n)}const a={},n=t.badges;if(Array.isArray(n))for(const e of n.slice(0,100)){const t=r(e);t&&(a[t]=!0)}else if(n&&'object'==typeof n)for(const[e,t]of Object.entries(n).slice(0,100)){const s=r(e);s&&t&&(a[s]=!0)}const c={stars:s,badges:a,charactersUnlocked:!0===t.charactersUnlocked};return'number'==typeof t.v&&Number.isInteger(t.v)&&t.v>=0&&t.v<=9999&&(c.v=t.v),Array.isArray(t.legacyWorlds)&&t.legacyWorlds.length<=50&&t.legacyWorlds.every(e=>null!==r(e)&&'string'==typeof e)&&(c.legacyWorlds=[...t.legacyWorlds]),c}},1164,[933,976,987,977]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.KitchenRotaEditor=function({today:e=(0,o.ymd)(new Date)}){const $=(0,a.useOwner)(e=>e.staff),j=(0,a.useOwner)(e=>e.shifts),p=(0,t.useMemo)(()=>(0,l.kitchenTeam)($),[$]),k=(0,t.useMemo)(()=>new Set(p.map(e=>e.id)),[p]),[S,I]=(0,t.useState)(0),[w,D]=(0,t.useState)(null),[v,T]=(0,t.useState)(''),H=(0,a.addDays)((0,a.mondayOfDate)(e),7*S),C=(0,a.addDays)(H,6),P=u.map((e,t)=>(0,a.addDays)(H,t)),L=(0,l.kitchenPending)(j,k,H,C).length,M=e=>{T(e),(0,d.announce)(e)},R=0===S?'This week':1===S?'Next week':-1===S?'Last week':`Week of ${b(H)}`;return(0,h.jsxs)(i.default,{testID:"kitchen-rota-editor",style:{gap:10,alignItems:'center'},children:[(0,h.jsx)(n.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Kitchen rota"}),(0,h.jsxs)(n.Row,{gap:8,style:{justifyContent:'center',alignItems:'center'},children:[(0,h.jsx)(n.Button,{small:!0,kind:"ghost",testID:"krota-prev",label:"\u2039 Prev",accessibilityLabel:"Previous week",onPress:()=>{I(S-1),T('')},style:{minWidth:84,minHeight:48}}),(0,h.jsxs)(i.default,{accessible:!0,accessibilityLabel:`${R}, ${f[0]} ${b(H)} to ${f[6]} ${b(C)}`,style:{alignItems:'center',minWidth:120},children:[(0,h.jsx)(n.T,{weight:"semibold",center:!0,children:R}),(0,h.jsxs)(n.Muted,{center:!0,children:[m(H)," \u2013 ",m(C)]})]}),(0,h.jsx)(n.Button,{small:!0,kind:"ghost",testID:"krota-next",label:"Next \u203a",accessibilityLabel:"Next week",onPress:()=>{I(S+1),T('')},style:{minWidth:84,minHeight:48}})]}),p.map(t=>(0,h.jsxs)(i.default,{testID:"krota-row",style:{gap:4,alignItems:'center',alignSelf:'stretch'},children:[(0,h.jsxs)(n.T,{size:14,weight:"semibold",center:!0,children:[y(t.nickname||t.name),t.job?(0,h.jsx)(n.T,{size:12,colour:c.colours.muted,children:` ${t.job}`}):null]}),(0,h.jsx)(n.Row,{gap:4,style:{justifyContent:'center',flexWrap:'nowrap'},children:P.map((i,a)=>{const l=j.find(e=>e.staffId===t.id&&e.date===i),o=!(!l||l.published&&!l.changed),d=`${y(t.nickname||t.name)}, ${f[a]} ${b(i)}, ${l?`${(0,r.fmtH)(l.start)} to ${(0,r.fmtH)(l.end)}${o?', draft, not published yet':''}. Change shift`:'off. Add a shift'}`;return(0,h.jsxs)(s.default,{testID:`krota-cell-${t.id}-${a}`,accessibilityRole:"button",accessibilityLabel:d,onPress:()=>D({staffId:t.id,date:i,shift:l}),style:({pressed:e})=>({width:44,minHeight:52,borderRadius:8,paddingVertical:4,alignItems:'center',justifyContent:'center',borderWidth:1,borderStyle:o?'dashed':'solid',borderColor:l?o?c.colours.amber:c.colours.gold:c.colours.border,backgroundColor:e||l?c.colours.goldTint:c.colours.surface2}),children:[(0,h.jsx)(n.T,{size:10,center:!0,colour:i===e?c.colours.gold:c.colours.muted,children:u[a]}),(0,h.jsx)(n.T,{size:10,center:!0,children:l?`${(0,r.fmtH)(l.start).slice(0,5)}`:'off'}),l?(0,h.jsx)(n.T,{size:10,center:!0,children:(0,r.fmtH)(l.end).slice(0,5)}):(0,h.jsx)(n.T,{size:10,center:!0,colour:c.colours.muted,children:"+"})]},i)})})]},t.id)),p.length?null:(0,h.jsx)(n.Muted,{center:!0,children:"No kitchen team on the staff list yet."}),(0,h.jsx)(n.Button,{testID:"krota-publish",kind:L?'primary':'secondary',disabled:!L,label:L?`Publish kitchen rota (${L} ${1===L?'change':'changes'})`:'Kitchen rota published',accessibilityLabel:L?`Publish the kitchen rota for ${R.toLowerCase()}, ${L} ${1===L?'change':'changes'}`:'Kitchen rota published for this week',onPress:()=>{const e=(0,l.publishKitchen)(a.useOwner.getState().shifts,k,H,C);a.useOwner.getState().setShifts(e.shifts),M(e.n?`Published ${e.n} kitchen ${1===e.n?'shift':'shifts'}. The kitchen team see them in their app now.`:'Nothing new to publish this week.')},style:{minHeight:56,alignSelf:'stretch'}}),v?(0,h.jsx)(i.default,{testID:"krota-msg",children:(0,h.jsx)(n.T,{center:!0,colour:c.colours.goldLight,children:v})}):null,(0,h.jsx)(n.Muted,{center:!0,children:"Tap a day to add or change a shift. Dashed amber = draft, only you see it until you publish. Front of house shifts are made in CoverCharge for Managers."}),w?(0,h.jsx)(x,{init:w,onClose:()=>D(null),onSaid:M}):null]})};var t=_r(_d[0]),s=e(_r(_d[1])),i=e(_r(_d[2])),n=_r(_d[3]),a=_r(_d[4]),l=_r(_d[5]),r=_r(_d[6]),o=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]);const u=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],f=['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'],m=e=>`${e.slice(8,10)}/${e.slice(5,7)}`,b=e=>`${e.slice(8,10)}/${e.slice(5,7)}/${e.slice(0,4)}`,y=e=>e.replace(/\s*\(.*\)$/,''),$=[['Lunch',11,16],['Dinner',16.5,22.5],['Double',11,21],['Close',17,23.5]];function x({init:e,onClose:s,onSaid:d}){const u=(0,a.useOwner)(t=>t.staff.find(t=>t.id===e.staffId)),f=y(u?.nickname||u?.name||''),[m,x]=(0,t.useState)(e.shift?.start??11),[j,p]=(0,t.useState)(e.shift?.end??21),[k,S]=(0,t.useState)(!1),[I,w]=(0,t.useState)(''),D=`${(0,o.niceDate)((0,o.parseYmd)(e.date))} (${b(e.date)})`;return(0,h.jsx)(n.Sheet,{visible:!0,onClose:s,title:`${f} \xb7 ${D}`,testID:"krota-sheet",children:(0,h.jsxs)(i.default,{style:{gap:10,alignItems:'center'},children:[(0,h.jsx)(n.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:$.map(([e,t,s])=>(0,h.jsx)(n.Chip,{testID:`krota-preset-${e.toLowerCase()}`,label:`${e} ${(0,r.fmtH)(t)}\u2013${(0,r.fmtH)(s)}`,selected:m===t&&j===s,onPress:()=>{x(t),p(s)}},e))}),(0,h.jsx)(n.T,{center:!0,children:"Start"}),(0,h.jsx)(n.Stepper,{testID:"krota-start",value:m,step:.5,min:r.SHIFT_MIN_START,max:j-1,onChange:x,format:r.fmtH,label:"Start time"}),(0,h.jsxs)(n.T,{center:!0,children:["End",j>=24?' (next day)':'']}),(0,h.jsx)(n.Stepper,{testID:"krota-end",value:j,step:.5,min:m+1,max:r.SHIFT_MAX_END,onChange:p,format:r.fmtH,label:"End time"}),(0,h.jsxs)(n.Muted,{center:!0,children:[(j-m).toFixed(1)," hours"]}),I?(0,h.jsx)(i.default,{accessibilityLiveRegion:"assertive",children:(0,h.jsx)(n.T,{center:!0,colour:c.colours.amber,children:I})}):null,(0,h.jsx)(n.Button,{testID:"krota-save",label:e.shift?'Save shift':'Add shift',accessibilityLabel:`${e.shift?'Save':'Add'} ${f}'s shift, ${D}, ${(0,r.fmtH)(m)} to ${(0,r.fmtH)(j)}`,onPress:()=>{const t=a.useOwner.getState();(0,l.clashes)(t.shifts,e.staffId,e.date,m,j,e.shift?.id)?w(`${f} already has a shift that overlaps on ${D}.`):(e.shift?t.setShifts(t.shifts.map(t=>t.id===e.shift.id?{...t,start:m,end:j,changed:!!t.published||t.changed}:t)):t.addShift({staffId:e.staffId,date:e.date,start:m,end:j}),d(`${e.shift?'Changed':'Added'}: ${f}, ${D}, ${(0,r.fmtH)(m)} to ${(0,r.fmtH)(j)}. Draft until you publish the kitchen rota.`),s())},style:{minHeight:56,alignSelf:'stretch'}}),e.shift&&!k?(0,h.jsx)(n.Button,{testID:"krota-remove",kind:"danger",label:"Remove shift",onPress:()=>S(!0),style:{minHeight:52,alignSelf:'stretch'}}):null,e.shift&&k?(0,h.jsxs)(i.default,{testID:"krota-remove-ask",accessibilityLiveRegion:"assertive",style:{gap:8,alignItems:'center',alignSelf:'stretch'},children:[(0,h.jsxs)(n.T,{center:!0,weight:"semibold",children:["Remove ",f,"\u2019s shift on ",D,"?"]}),(0,h.jsx)(n.Button,{testID:"krota-remove-yes",kind:"danger",label:"Yes, remove it",onPress:()=>{a.useOwner.getState().removeShift(e.shift.id),d(`Removed ${f}'s shift on ${D}.`),s()},style:{minHeight:52,alignSelf:'stretch'}}),(0,h.jsx)(n.Button,{testID:"krota-remove-no",kind:"secondary",label:"No, keep it",onPress:()=>S(!1),style:{minHeight:52,alignSelf:'stretch'}})]}):null]})})}},1165,[34,402,102,794,891,988,1087,858,1166,821,25]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.KitchenRotaEditor=p,_e.KitchenRotaTab=function({today:e=(0,h.ymd)(new Date)}){const t=(0,r.canEditKitchenRota)((0,d.useSync)(e=>e.perms));return(0,m.jsx)(i.default,{testID:"chef-rota-tab",style:{alignSelf:'stretch',alignItems:'center'},children:t?(0,m.jsx)(p,{today:e}):(0,m.jsx)(w,{today:e})})},_e.KitchenRotaRead=w;var t=_r(_d[0]),s=e(_r(_d[1])),i=e(_r(_d[2])),n=_r(_d[3]),a=_r(_d[4]),r=_r(_d[5]),l=_r(_d[6]),o=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]),u=_r(_d[11]),f=_r(_d[12]),m=_r(_d[13]);const y=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],b=['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'],x=e=>`${e.slice(8,10)}/${e.slice(5,7)}`,j=e=>`${e.slice(8,10)}/${e.slice(5,7)}/${e.slice(0,4)}`,$=e=>e.replace(/\s*\(.*\)$/,''),k=[['Lunch',11,16],['Dinner',16.5,22.5],['Double',11,21],['Close',17,23.5]];function p({today:e=(0,h.ymd)(new Date)}){const l=(0,a.useOwner)(e=>e.staff),o=(0,a.useOwner)(e=>e.shifts),d=(0,t.useMemo)(()=>(0,r.kitchenTeam)(l),[l]),k=(0,t.useMemo)(()=>new Set(d.map(e=>e.id)),[d]),[p,w]=(0,t.useState)(0),[I,D]=(0,t.useState)(null),[T,v]=(0,t.useState)(''),H=(0,a.addDays)((0,a.mondayOfDate)(e),7*p),C=(0,a.addDays)(H,6),L=y.map((e,t)=>(0,a.addDays)(H,t)),P=(0,r.kitchenPending)(o,k,H,C).length,R=e=>{v(e),(0,u.announce)(e)},M=0===p?'This week':1===p?'Next week':-1===p?'Last week':`Week of ${j(H)}`;return(0,m.jsxs)(i.default,{testID:"kitchen-rota-editor",style:{gap:10,alignItems:'center'},children:[(0,m.jsx)(n.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Kitchen rota"}),(0,m.jsxs)(n.Row,{gap:8,style:{justifyContent:'center',alignItems:'center'},children:[(0,m.jsx)(n.Button,{small:!0,kind:"ghost",testID:"krota-prev",label:"\u2039 Prev",accessibilityLabel:"Previous week",onPress:()=>{w(p-1),v('')},style:{minWidth:84,minHeight:48}}),(0,m.jsxs)(i.default,{accessible:!0,accessibilityLabel:`${M}, ${b[0]} ${j(H)} to ${b[6]} ${j(C)}`,style:{alignItems:'center',minWidth:120},children:[(0,m.jsx)(n.T,{weight:"semibold",center:!0,children:M}),(0,m.jsxs)(n.Muted,{center:!0,children:[x(H)," \u2013 ",x(C)]})]}),(0,m.jsx)(n.Button,{small:!0,kind:"ghost",testID:"krota-next",label:"Next \u203a",accessibilityLabel:"Next week",onPress:()=>{w(p+1),v('')},style:{minWidth:84,minHeight:48}})]}),d.map(t=>(0,m.jsxs)(i.default,{testID:"krota-row",style:{gap:4,alignItems:'center',alignSelf:'stretch'},children:[(0,m.jsxs)(n.T,{size:14,weight:"semibold",center:!0,children:[$(t.nickname||t.name),t.job?(0,m.jsx)(n.T,{size:12,colour:f.colours.muted,children:` ${t.job}`}):null]}),(0,m.jsx)(n.Row,{gap:4,style:{justifyContent:'center',flexWrap:'nowrap'},children:L.map((i,a)=>{const r=o.find(e=>e.staffId===t.id&&e.date===i),l=!(!r||r.published&&!r.changed),d=`${$(t.nickname||t.name)}, ${b[a]} ${j(i)}, ${r?`${(0,c.fmtH)(r.start)} to ${(0,c.fmtH)(r.end)}${l?', draft, not published yet':''}. Change shift`:'off. Add a shift'}`;return(0,m.jsxs)(s.default,{testID:`krota-cell-${t.id}-${a}`,accessibilityRole:"button",accessibilityLabel:d,onPress:()=>D({staffId:t.id,date:i,shift:r}),style:({pressed:e})=>({width:44,minHeight:52,borderRadius:8,paddingVertical:4,alignItems:'center',justifyContent:'center',borderWidth:1,borderStyle:l?'dashed':'solid',borderColor:r?l?f.colours.amber:f.colours.gold:f.colours.border,backgroundColor:e||r?f.colours.goldTint:f.colours.surface2}),children:[(0,m.jsx)(n.T,{size:10,center:!0,colour:i===e?f.colours.gold:f.colours.muted,children:y[a]}),(0,m.jsx)(n.T,{size:10,center:!0,children:r?`${(0,c.fmtH)(r.start).slice(0,5)}`:'off'}),r?(0,m.jsx)(n.T,{size:10,center:!0,children:(0,c.fmtH)(r.end).slice(0,5)}):(0,m.jsx)(n.T,{size:10,center:!0,colour:f.colours.muted,children:"+"})]},i)})})]},t.id)),d.length?null:(0,m.jsx)(n.Muted,{center:!0,children:"No kitchen team on the staff list yet."}),(0,m.jsx)(n.Button,{testID:"krota-publish",kind:P?'primary':'secondary',disabled:!P,label:P?`Publish kitchen rota (${P} ${1===P?'change':'changes'})`:'Kitchen rota published',accessibilityLabel:P?`Publish the kitchen rota for ${M.toLowerCase()}, ${P} ${1===P?'change':'changes'}`:'Kitchen rota published for this week',onPress:()=>{const e=(0,r.publishKitchen)(a.useOwner.getState().shifts,k,H,C);a.useOwner.getState().setShifts(e.shifts),R(e.n?`Published ${e.n} kitchen ${1===e.n?'shift':'shifts'}. The kitchen team see them in their app now.`:'Nothing new to publish this week.')},style:{minHeight:56,alignSelf:'stretch'}}),T?(0,m.jsx)(i.default,{testID:"krota-msg",children:(0,m.jsx)(n.T,{center:!0,colour:f.colours.goldLight,children:T})}):null,(0,m.jsx)(n.Muted,{center:!0,children:"Tap a day to add or change a shift. Dashed amber = draft, only you see it until you publish. Front of house shifts are made in CoverCharge for Managers."}),I?(0,m.jsx)(S,{init:I,onClose:()=>D(null),onSaid:R}):null]})}function w({today:e=(0,h.ymd)(new Date)}){const{staff:s,shifts:r}=(0,o.rotaView)('chef',(0,a.useOwner)(e=>e.staff),(0,a.useOwner)(e=>e.shifts)),d=(0,a.useOwner)(e=>e.leave),[u,k]=(0,t.useState)(0),p=(0,a.addDays)((0,a.mondayOfDate)(e),7*u),w=(0,a.addDays)(p,6),S=y.map((e,t)=>(0,a.addDays)(p,t)),I=s.filter(e=>/kitchen|chef|kp/i.test(`${e.job??''} ${e.name}`)),D=0===u?'This week':1===u?'Next week':-1===u?'Last week':`Week of ${j(p)}`,[T,v]=(0,t.useState)(0),H=T?Math.max(30,Math.min(44,Math.floor((T-12)/7))):40;return(0,m.jsxs)(i.default,{testID:"kitchen-rota-read",onLayout:e=>v(e.nativeEvent.layout.width),style:{gap:10,alignItems:'center',alignSelf:'stretch'},children:[(0,m.jsx)(n.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Kitchen rota"}),(0,m.jsxs)(n.Row,{gap:8,style:{justifyContent:'center',alignItems:'center'},children:[(0,m.jsx)(n.Button,{small:!0,kind:"ghost",testID:"krota-read-prev",label:"\u2039 Prev",accessibilityLabel:"Previous week",onPress:()=>k(u-1),style:{minWidth:84,minHeight:48}}),(0,m.jsxs)(i.default,{accessible:!0,accessibilityLabel:`${D}, ${b[0]} ${j(p)} to ${b[6]} ${j(w)}`,style:{alignItems:'center',minWidth:120},children:[(0,m.jsx)(n.T,{weight:"semibold",center:!0,children:D}),(0,m.jsxs)(n.Muted,{center:!0,children:[x(p)," \u2013 ",x(w)]})]}),(0,m.jsx)(n.Button,{small:!0,kind:"ghost",testID:"krota-read-next",label:"Next \u203a",accessibilityLabel:"Next week",onPress:()=>k(u+1),style:{minWidth:84,minHeight:48}})]}),I.map(t=>(0,m.jsxs)(i.default,{testID:"krota-read-row",style:{gap:4,alignItems:'center',alignSelf:'stretch'},children:[(0,m.jsx)(n.T,{size:14,weight:"semibold",center:!0,children:$(t.nickname||t.name)}),(0,m.jsx)(n.Row,{gap:2,style:{justifyContent:'center',flexWrap:'nowrap'},children:S.map((s,a)=>{const o=r.find(e=>e.staffId===t.id&&e.date===s),h=o?(0,l.leaveCovering)(d,t.id,s):void 0,u=o?h?(0,l.leaveLabel)(h):`${(0,c.fmtH)(o.start)} to ${(0,c.fmtH)(o.end)}`:'off';return(0,m.jsxs)(i.default,{testID:`krota-read-cell-${t.id}-${a}`,accessible:!0,accessibilityLabel:`${$(t.nickname||t.name)}, ${b[a]} ${j(s)}, ${u}`,style:{width:H,minHeight:52,borderRadius:8,paddingVertical:4,paddingHorizontal:0,alignItems:'center',justifyContent:'center',borderWidth:1,borderColor:o?f.colours.gold:f.colours.border,backgroundColor:o?f.colours.goldTint:f.colours.surface2},children:[(0,m.jsx)(n.T,{size:10,center:!0,colour:s===e?f.colours.gold:f.colours.muted,children:y[a]}),o&&h?(0,m.jsx)(n.T,{size:9,center:!0,colour:f.colours.blue,children:(0,l.leaveLabel)(h).toLowerCase()}):(0,m.jsx)(n.T,{size:10,center:!0,children:o?(0,c.fmtH)(o.start).slice(0,5):'off'}),o&&!h?(0,m.jsx)(n.T,{size:10,center:!0,children:(0,c.fmtH)(o.end).slice(0,5)}):null]},s)})})]},t.id)),I.length?null:(0,m.jsx)(n.Muted,{center:!0,children:"No kitchen shifts on the rota yet."}),(0,m.jsx)(n.Muted,{center:!0,children:"This shows published shifts only. To change the kitchen rota here, an owner can tick \u201cMake the kitchen rota\u201d for you on the Permissions screen."})]})}function S({init:e,onClose:s,onSaid:l}){const o=(0,a.useOwner)(t=>t.staff.find(t=>t.id===e.staffId)),d=$(o?.nickname||o?.name||''),[u,y]=(0,t.useState)(e.shift?.start??11),[b,x]=(0,t.useState)(e.shift?.end??21),[p,w]=(0,t.useState)(!1),[S,I]=(0,t.useState)(''),D=`${(0,h.niceDate)((0,h.parseYmd)(e.date))} (${j(e.date)})`;return(0,m.jsx)(n.Sheet,{visible:!0,onClose:s,title:`${d} \xb7 ${D}`,testID:"krota-sheet",children:(0,m.jsxs)(i.default,{style:{gap:10,alignItems:'center'},children:[(0,m.jsx)(n.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:k.map(([e,t,s])=>(0,m.jsx)(n.Chip,{testID:`krota-preset-${e.toLowerCase()}`,label:`${e} ${(0,c.fmtH)(t)}\u2013${(0,c.fmtH)(s)}`,selected:u===t&&b===s,onPress:()=>{y(t),x(s)}},e))}),(0,m.jsx)(n.T,{center:!0,children:"Start"}),(0,m.jsx)(n.Stepper,{testID:"krota-start",value:u,step:.5,min:c.SHIFT_MIN_START,max:b-1,onChange:y,format:c.fmtH,label:"Start time"}),(0,m.jsxs)(n.T,{center:!0,children:["End",b>=24?' (next day)':'']}),(0,m.jsx)(n.Stepper,{testID:"krota-end",value:b,step:.5,min:u+1,max:c.SHIFT_MAX_END,onChange:x,format:c.fmtH,label:"End time"}),(0,m.jsxs)(n.Muted,{center:!0,children:[(b-u).toFixed(1)," hours"]}),S?(0,m.jsx)(i.default,{accessibilityLiveRegion:"assertive",children:(0,m.jsx)(n.T,{center:!0,colour:f.colours.amber,children:S})}):null,(0,m.jsx)(n.Button,{testID:"krota-save",label:e.shift?'Save shift':'Add shift',accessibilityLabel:`${e.shift?'Save':'Add'} ${d}'s shift, ${D}, ${(0,c.fmtH)(u)} to ${(0,c.fmtH)(b)}`,onPress:()=>{const t=a.useOwner.getState();(0,r.clashes)(t.shifts,e.staffId,e.date,u,b,e.shift?.id)?I(`${d} already has a shift that overlaps on ${D}.`):(e.shift?t.setShifts(t.shifts.map(t=>t.id===e.shift.id?{...t,start:u,end:b,changed:!!t.published||t.changed}:t)):t.addShift({staffId:e.staffId,date:e.date,start:u,end:b}),l(`${e.shift?'Changed':'Added'}: ${d}, ${D}, ${(0,c.fmtH)(u)} to ${(0,c.fmtH)(b)}. Draft until you publish the kitchen rota.`),s())},style:{minHeight:56,alignSelf:'stretch'}}),e.shift&&!p?(0,m.jsx)(n.Button,{testID:"krota-remove",kind:"danger",label:"Remove shift",onPress:()=>w(!0),style:{minHeight:52,alignSelf:'stretch'}}):null,e.shift&&p?(0,m.jsxs)(i.default,{testID:"krota-remove-ask",accessibilityLiveRegion:"assertive",style:{gap:8,alignItems:'center',alignSelf:'stretch'},children:[(0,m.jsxs)(n.T,{center:!0,weight:"semibold",children:["Remove ",d,"\u2019s shift on ",D,"?"]}),(0,m.jsx)(n.Button,{testID:"krota-remove-yes",kind:"danger",label:"Yes, remove it",onPress:()=>{a.useOwner.getState().removeShift(e.shift.id),l(`Removed ${d}'s shift on ${D}.`),s()},style:{minHeight:52,alignSelf:'stretch'}}),(0,m.jsx)(n.Button,{testID:"krota-remove-no",kind:"secondary",label:"No, keep it",onPress:()=>w(!1),style:{minHeight:52,alignSelf:'stretch'}})]}):null]})})}},1165,[34,402,102,794,891,988,1094,993,987,1087,858,1166,821,25]); __d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.primeAnnouncer=function(){u()},_e.announce=function(t){const e=String(t??'').trim();if(!e)return;{const t=u();if(!t)return;const n=++o;return t.textContent='',void setTimeout(()=>{n===o&&(t.textContent=e)},80)}},Object.defineProperty(_e,"lastAnnounced",{enumerable:!0,get:function(){return c}});var t,e=r(d[0]);(t=e)&&t.__esModule;r(d[1]);let n=null,o=0;function u(){if('undefined'==typeof document||!document.body)return null;if(n&&document.body.contains(n))return n;const t=document.createElement('div');return t.id='cc-announcer',t.setAttribute('aria-live','assertive'),t.setAttribute('aria-atomic','true'),t.setAttribute('role','status'),t.setAttribute('data-testid','cc-announcer'),Object.assign(t.style,{position:'absolute',width:'1px',height:'1px',margin:'-1px',padding:'0',overflow:'hidden',clip:'rect(0 0 0 0)',whiteSpace:'nowrap',border:'0'}),document.body.appendChild(t),n=t,t}const c=()=>n?.textContent??''},1166,[281,236]); __d(function(g,r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useSuggestions=j,_e.OrdersScreen=function({focus:e}={}){const[s,t]=(0,n.useState)('sheets');return(0,x.jsxs)(l.default,{style:{gap:12},children:[(0,x.jsx)(y.Seg,{value:s,onChange:t,options:[{id:'sheets',label:'Order sheets'},{id:'suggested',label:'Suggested orders'},{id:'history',label:'Order history'}]}),'sheets'===s?(0,x.jsx)(m.OrderSheets,{focus:e}):'suggested'===s?(0,x.jsx)(w,{}):(0,x.jsx)($,{})]})};var s=r(_d[0]),t=r(_d[1]),n=r(_d[2]),i=e(r(_d[3])),l=e(r(_d[4])),d=r(_d[5]),o=r(_d[6]),u=r(_d[7]),c=r(_d[8]),h=r(_d[9]),p=r(_d[10]),y=r(_d[11]),f=r(_d[12]),m=r(_d[13]),x=r(_d[14]);const b=(e,s)=>'kg'===s?Math.ceil(2*e)/2:Math.ceil(e);function j(){const{k:e,now:s,rid:n}=(0,y.useChef)(6e4),{pct:i}=(0,y.useForecast)(),l=(0,u.supplierView)('chef',(0,o.useOwner)(e=>e.suppliers)).filter(e=>!e.archived),d=1+Math.max(0,i)/100;return l.map(i=>{const l=e.ingredients.filter(e=>e.supplierId===i.id).map(e=>({i:e,qty:(0,t.fishInStone)(n,e)?(0,t.fromStone)(Math.ceil(2*(0,t.toStone)(Math.max(0,e.par*d-e.onHand),e.unit))/2,e.unit):b(Math.max(0,e.par*d-e.onHand),e.unit)})).filter(e=>e.qty>0),o=(0,p.weekday)(s),u=i.orderDays.includes(o),[c,h]=(i.cutoff||'23:59').split(':').map(Number),y=new Date(s);y.setHours(c,h,0,0);const f=e.orders.some(e=>e.supplierId===i.id&&new Date(e.at).toDateString()===s.toDateString()),m=[1,2,3,4,5,6,7].map(e=>(o+e)%7).find(e=>i.orderDays.includes(e));return{s:i,lines:l,ordersToday:u,cutPassed:s>y,placedToday:f,nextDay:m,total:Math.round(l.reduce((e,s)=>e+s.qty*s.i.cost,0))}}).filter(e=>e.lines.length||e.ordersToday)}function w(){const{me:e,rid:o}=(0,y.useChef)(),{label:u,covers:m,enough:b,booked:w}=(0,y.useForecast)(),$=(0,f.useKitchen)(e=>e.addOrder),S=j(),[C,M]=(0,n.useState)({}),[O,k]=(0,n.useState)('');return(0,x.jsxs)(l.default,{style:{gap:10},children:[(0,x.jsxs)(d.Muted,{children:[b?`Built from par levels and today's forecast (${m} Covers, ${u} vs a typical day).`:`Built from par levels (no forecast yet: not enough history; ${w} Covers booked so far).`," Adjust, then call the supplier or use their ordering website. Nothing is sent by CoverCharge."]}),O?(0,x.jsx)(d.Banner,{kind:"success",title:"Saved to order history",children:O}):null,S.map(({s:n,lines:u,ordersToday:y,cutPassed:f,placedToday:m,nextDay:b,total:j})=>{const w=u.map(e=>({...e,q:C[`${n.id}:${e.i.id}`]??e.qty})),S=Math.round(w.reduce((e,s)=>e+s.q*s.i.cost,0)),O=s=>{$({supplierId:n.id,by:e,status:s,lines:w.filter(e=>e.q>0).map(e=>({ing:e.i.id,qty:e.q,cost:e.i.cost})),total:S}),k(`${n.name}: ${(0,c.gbp)(S)} (${s}).`)};return(0,x.jsxs)(d.Card,{highlight:!y||m||f?void 0:h.colours.gold,children:[(0,x.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsxs)(l.default,{style:{flex:1},children:[(0,x.jsx)(d.T,{weight:"semibold",children:n.name}),(0,x.jsxs)(d.Muted,{children:[n.category," \xb7 min order ",(0,c.gbp)(n.minOrder)]})]}),m?(0,x.jsx)(d.Badge,{kind:"ok",label:"ORDERED TODAY"}):y?(0,x.jsx)(d.Badge,{kind:f?'red':'amber',label:f?`CUT-OFF ${n.cutoff} PASSED`:`ORDER BY ${n.cutoff}`}):(0,x.jsx)(d.Badge,{label:`NEXT ${null!=b?p.DAY3[b].toUpperCase():'\u2014'}`})]}),w.length?w.map(e=>(0,x.jsxs)(d.Row,{wrap:!0,style:{justifyContent:'space-between'},children:[(0,x.jsxs)(l.default,{style:{flex:1},children:[(0,x.jsx)(d.T,{size:14,children:e.i.name}),(0,x.jsxs)(d.Muted,{children:["On hand ",(0,s.ingredientQty)(o,e.i,e.i.onHand)," \xb7 par ",(0,s.ingredientQty)(o,e.i,e.i.par)]})]}),(0,x.jsx)(d.Button,{small:!0,kind:"ghost",label:"Less",accessibilityLabel:`${(0,t.fishInStone)(o,e.i)?'Half a stone less':'Less'} ${e.i.name}`,onPress:()=>M(s=>({...s,[`${n.id}:${e.i.id}`]:(0,t.stepQuantity)(o,e.i,e.q,-1)}))}),(0,x.jsx)(l.default,{accessible:!0,accessibilityLabel:(0,s.ingredientSpeech)(o,e.i,e.q),children:(0,x.jsx)(d.T,{size:16,style:{minWidth:76,textAlign:'center'},children:(0,s.ingredientQty)(o,e.i,e.q)})}),(0,x.jsx)(d.Button,{small:!0,kind:"ghost",label:"More",accessibilityLabel:`${(0,t.fishInStone)(o,e.i)?'Half a stone more':'More'} ${e.i.name}`,onPress:()=>M(s=>({...s,[`${n.id}:${e.i.id}`]:(0,t.stepQuantity)(o,e.i,e.q,1)}))})]},e.i.id)):(0,x.jsx)(d.Muted,{children:"Everything is at par."}),w.length?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsxs)(d.T,{weight:"semibold",children:["Estimated ",(0,c.gbp)(S)]}),S{i.default.openURL(`tel:${n.phones[0].replace(/\s/g,'')}`).catch(()=>{}),O('placed (by phone)')}}):null,n.website?(0,x.jsx)(d.Button,{small:!0,kind:"secondary",label:"Open website",onPress:()=>{i.default.openURL(n.website).catch(()=>{}),O('placed (on website)')}}):null]})]}):null,void 0]},n.id)})]})}function $(){const{k:e,rid:t}=(0,y.useChef)(),n=(0,o.useOwner)(e=>e.suppliers);return(0,x.jsx)(l.default,{style:{gap:8},children:e.orders.map(i=>(0,x.jsxs)(d.Card,{children:[(0,x.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(d.T,{weight:"semibold",style:{flex:1},children:n.find(e=>e.id===i.supplierId)?.name}),(0,x.jsx)(d.Badge,{kind:"neutral",label:i.status.toUpperCase()})]}),(0,x.jsxs)(d.Muted,{children:[new Date(i.at).toLocaleString('en-GB',{weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})," \xb7 ",i.by,i.total?` \xb7 ${(0,c.gbp)(i.total)}`:'']}),i.lines.length?(0,x.jsx)(d.Muted,{children:i.lines.map(n=>{const i=e.ingredients.find(e=>e.id===n.ing);return`${(0,s.ingredientQty)(t,i??{name:n.ing,unit:''},n.qty)} ${i?.name??n.ing}`}).join(', ')}):null]},i.id))})}},1167,[1153,984,34,379,102,794,891,993,867,821,1084,1145,1029,1168,25]); __d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.openLink=j,_e.useSheetReminders=T,_e.OrderSheets=function({focus:e}){const{rid:t,now:l}=(0,x.useChef)(3e4),o=(0,u.useSheets)(t).filter(e=>(0,n.chefCanSee)(t,e)&&!e.placeholder),[h,c]=(0,s.useState)(e??null),p=T(),f=(0,b.wd)(l);return(0,y.jsxs)(d.default,{style:{gap:10},testID:"order-sheets",children:[(0,y.jsx)(i.Banner,{kind:"info",title:"Nothing is sent for you",children:"Text, WhatsApp and phone orders open your phone\u2019s own app with the order already written. Check it, then press Send yourself."}),p.map(e=>(0,y.jsx)(r.default,{accessibilityRole:"button",onPress:()=>c(e.supplierId),children:(0,y.jsxs)(i.Banner,{kind:'red'===e.tone?'danger':'warn',title:`\u23f0 ${e.text}`,children:["Tap to open the ",e.name," order sheet."]})},e.supplierId)),(0,y.jsxs)(i.Muted,{children:["Today is ",b.DAYS[f],". Edit suppliers in Managers \u203a Settings \u203a Supplier order sheets."]}),o.map(e=>(0,y.jsx)(C,{s:e,open:h===e.id,onToggle:()=>c(h===e.id?null:e.id)},e.id)),o.length?null:(0,y.jsx)(i.Muted,{children:"No order sheets yet. Add suppliers in Managers \u203a Settings \u203a Supplier order sheets."})]})};var t=_r(_d[0]),n=_r(_d[1]),l=_r(_d[2]),s=_r(_d[3]),o=e(_r(_d[4]));_r(_d[5]);var r=e(_r(_d[6])),d=e(_r(_d[7])),i=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),c=_r(_d[11]),p=_r(_d[12]),b=_r(_d[13]),f=_r(_d[14]),x=_r(_d[15]),y=_r(_d[16]);function j(e){if('undefined'!=typeof window){const t=window;return'function'==typeof t.__ccOpenLink?void t.__ccOpenLink(e):void(/^https?:/.test(e)?window.open(e,'_blank','noopener'):window.location.href=e)}o.default.openURL(e).catch(()=>{})}async function w(e){try{const t='undefined'!=typeof navigator?navigator:null;if(t?.clipboard?.writeText)return await t.clipboard.writeText(e),!0}catch{}return!1}const k={online:'\ud83c\udf10',phone:'\ud83d\udcde',text:'\ud83d\udcac',whatsapp:'\u2706',tbc:'\ud83d\udd8a\ufe0f'},S={borderWidth:1,borderColor:f.colours.border,borderRadius:10,paddingHorizontal:12,paddingVertical:10,color:f.colours.text,backgroundColor:f.colours.surface2,fontSize:f.font.body};function T(){const{rid:e,now:t}=(0,x.useChef)(6e4),l=(0,u.useSheets)(e).filter(t=>(0,n.chefCanSee)(e,t)&&!t.placeholder),s=(0,u.useOrderSheets)(e=>e.opened),o=(0,h.useShellfish)(e,'','chef'),r=(0,b.remindersFor)(l,t,s);for(const n of l){const l=o.items.filter(e=>(e.supplierId===n.id||!e.supplierId&&n.shellfish)&&o.isLow(e.key));!l.length||s[n.id]&&new Date(s[n.id]).toDateString()===t.toDateString()||r.push({supplierId:n.id,name:n.name,text:`${'text'===n.method||'whatsapp'===n.method?'Text':'Order from'} ${n.contact||n.name}: ${l.map(t=>`${(0,c.fmtStockCount)(e,t,o.counts[t.key]??0)} ${t.plural.toLowerCase()}`).join(' and ')} left`,tone:'amber',cutoffPassed:!1})}return r}function C({s:e,open:n,onToggle:o}){const{rid:T,r:C,me:$,now:D}=(0,x.useChef)(3e4),v=(0,u.useOrderSheets)(e=>e.patch),I=(0,u.useOrderSheets)(e=>e.markOpened),M=(0,u.useOrderSheets)(t=>t.opened[e.id]),[B,L]=(0,s.useState)({}),[P,O]=(0,s.useState)(''),[R,A]=(0,s.useState)(''),[z,_]=(0,s.useState)(!1),W=(0,h.useShellfish)(T,$,'chef'),H=(0,b.nextDelivery)(e,D),K=(0,b.orderLines)(e,B,P,T),E=(C.address??C.location??'').split(',').map(e=>e.trim()).filter(Boolean),q=E.length>=3?E[1]:E[0]??'',N=(0,b.orderMessage)(e,C.name,q,K,$.split(' ')[0],D),U=e.orderDays.includes((0,b.wd)(D)),Q=(e,t)=>L(n=>({...n,[e.id]:(0,l.stepQuantity)(T,e,n[e.id]||0,t)})),Y=t=>{I(e.id,D.toISOString()),j(t)},F='text'===e.method||'whatsapp'===e.method||'phone'===e.method,G=Math.round(100*parseFloat(R.replace(/[\xa3,]/g,''))),V=W.items.filter(t=>t.supplierId===e.id||!t.supplierId&&e.shellfish),J=V.filter(e=>W.isLow(e.key));return(0,y.jsxs)(d.default,{testID:`sheet-${e.id}`,style:{borderRadius:14,borderWidth:1.5,borderColor:U||J.length?f.colours.amber:n?f.colours.gold:f.colours.border,backgroundColor:f.colours.surface,overflow:'hidden'},children:[(0,y.jsxs)(r.default,{accessibilityRole:"button",accessibilityLabel:`${e.name} order sheet`,onPress:o,style:{padding:12,gap:4},children:[(0,y.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsxs)(i.T,{weight:"semibold",size:f.font.large,style:{flex:1},children:[k[e.method]," ",e.name]}),(0,y.jsx)(i.Badge,{kind:e.placeholder?'amber':'gold',label:e.placeholder?'To fill in':b.METHOD_LABEL[e.method]})]}),(0,y.jsx)(i.Muted,{children:e.goods}),(0,y.jsxs)(i.Row,{wrap:!0,gap:6,children:[e.deliveryDays.length?(0,y.jsx)(i.Badge,{kind:"neutral",label:`Delivers ${(0,b.dayRange)(e.deliveryDays)}`}):null,e.orderDays.length?(0,y.jsx)(i.Badge,{kind:U?'amber':'neutral',label:`Order ${(0,b.dayRange)(e.orderDays)}${e.cutoff?` by ${e.cutoff}`:''}`}):null,e.frequency?(0,y.jsx)(i.Badge,{kind:"neutral",label:e.frequency}):null,e.priceCapPerKg?(0,y.jsx)(i.Badge,{kind:"blue",label:`Cap ${(0,p.gbp)(e.priceCapPerKg)}/kg`}):null,V.length?(0,y.jsx)(i.Badge,{kind:J.length?'amber':'ok',label:V.map(e=>`${e.icon} ${(0,c.fmtStockCount)(T,e,W.counts[e.key]??0)}`).join(' \xb7 ')}):null,M&&new Date(M).toDateString()===D.toDateString()?(0,y.jsx)(i.Badge,{kind:"ok",label:"Opened today \u2713"}):null]})]}),n?(0,y.jsxs)(d.default,{style:{padding:12,paddingTop:0,gap:10},children:[H?(0,y.jsxs)(i.Muted,{children:["Next delivery if you order now: ",(0,b.niceDay)(H),"."]}):null,e.reminder?(0,y.jsxs)(i.Muted,{children:["Reminder on ",e.orderDays.map(e=>b.DAYS[e]).join(', '),": ",e.reminder]}):null,e.notes?(0,y.jsx)(i.T,{size:f.font.small,colour:f.colours.muted,children:e.notes}):null,e.placeholder?(0,y.jsx)(i.Banner,{kind:"warn",title:"Still to be set up",children:"Add the supplier, how to order and delivery days in Managers \u203a Settings \u203a Supplier order sheets."}):null,e.items.map(e=>(0,y.jsxs)(d.default,{style:{gap:6},children:[(0,y.jsxs)(i.T,{children:[e.name,e.unit?(0,y.jsxs)(i.T,{size:f.font.small,colour:f.colours.muted,children:[" (",(0,l.quantityUnit)(T,e),")"]}):null]}),(0,y.jsxs)(i.Row,{wrap:!0,gap:8,style:{justifyContent:'space-between'},children:[(0,y.jsx)(i.Button,{small:!0,kind:"secondary",label:"Less",accessibilityLabel:`${(0,l.fishInStone)(T,e)?'Half a stone less':'Less'} ${e.name}`,onPress:()=>Q(e,-1),style:{minWidth:44,minHeight:44}}),(0,y.jsx)(d.default,{accessible:!0,accessibilityLabel:(0,l.fishQtySpeech)(T,e,B[e.id]||0),children:(0,y.jsx)(i.T,{weight:"bold",size:20,style:{minWidth:76,textAlign:'center'},children:(0,l.fishInStone)(T,e)?(0,l.fishQtyText)(T,e,B[e.id]||0):B[e.id]||0})}),(0,y.jsx)(i.Button,{small:!0,kind:"secondary",label:"More",accessibilityLabel:`${(0,l.fishInStone)(T,e)?'Half a stone more':'More'} ${e.name}`,testID:`qty-${e.id}`,onPress:()=>Q(e,1),style:{minWidth:44,minHeight:44}})]})]},e.id)),(0,y.jsxs)(d.default,{style:{gap:4},children:[(0,y.jsx)(i.T,{size:f.font.small,weight:"medium",colour:f.colours.muted,children:"Anything else (one line each)"}),(0,y.jsx)(t.TextInput,{value:P,onChangeText:O,multiline:!0,placeholder:"e.g. 2 boxes lemons",placeholderTextColor:f.colours.muted,style:[S,{minHeight:60}]})]}),F?(0,y.jsxs)(d.default,{style:{gap:4},children:[(0,y.jsxs)(i.T,{size:f.font.small,weight:"medium",colour:f.colours.muted,children:['whatsapp'===e.method?'WhatsApp number':'phone'===e.method?'Phone number':'Mobile number',e.number?'':' (blank: fill in once, it is saved)']}),(0,y.jsx)(t.TextInput,{testID:`number-${e.id}`,value:e.number,onChangeText:t=>v(T,e.id,{number:t}),keyboardType:"phone-pad",placeholder:"07\u2026",placeholderTextColor:f.colours.muted,style:S})]}):null,'online'===e.method?(0,y.jsxs)(d.default,{style:{gap:4},children:[(0,y.jsxs)(i.T,{size:f.font.small,weight:"medium",colour:f.colours.muted,children:['Open Coldweb'===e.urlLabel?'Coldweb ordering link':'Website link',e.url?'':' (blank: paste it in once, it is saved)']}),(0,y.jsx)(t.TextInput,{testID:`url-${e.id}`,value:e.url,onChangeText:t=>v(T,e.id,{url:t.trim()}),autoCapitalize:"none",keyboardType:"url",placeholder:"https://\u2026",placeholderTextColor:f.colours.muted,style:S})]}):null,e.priceCapPerKg?(0,y.jsxs)(d.default,{style:{gap:6,padding:10,borderRadius:12,backgroundColor:f.colours.blueBg},children:[(0,y.jsxs)(i.T,{weight:"semibold",colour:"#E2C489",children:["Price cap ",(0,p.gbp)(e.priceCapPerKg),"/kg \xb7 buy from the cheapest UK seller under it"]}),(0,y.jsxs)(i.Muted,{children:["Seller: ",e.seller||'to be chosen']}),(0,y.jsxs)(i.Row,{gap:8,children:[(0,y.jsx)(i.T,{size:f.font.small,style:{flex:1},children:"Price you found (\xa3/kg)"}),(0,y.jsx)(t.TextInput,{testID:"price-found",value:R,onChangeText:A,keyboardType:"decimal-pad",placeholder:"e.g. 22.50",placeholderTextColor:f.colours.muted,style:[S,{width:120}]})]}),G>0?(0,y.jsx)(i.Badge,{kind:G<=e.priceCapPerKg?'ok':'red',label:G<=e.priceCapPerKg?`${(0,p.gbp)(G)}/kg is under the cap \u2713`:`${(0,p.gbp)(G)}/kg is over the ${(0,p.gbp)(e.priceCapPerKg)} cap: look for a cheaper seller`}):null]}):null,'online'!==e.method&&'tbc'!==e.method?(0,y.jsxs)(d.default,{testID:`preview-${e.id}`,style:{padding:10,borderRadius:12,borderWidth:1,borderColor:f.colours.border,backgroundColor:f.colours.surface2},children:[(0,y.jsx)(i.T,{size:12,weight:"semibold",colour:f.colours.gold,children:'phone'===e.method?'READ THIS OUT':'YOUR MESSAGE'}),(0,y.jsx)(i.T,{size:f.font.small,children:K.length?N:'Add quantities above to write the order.'})]}):null,(0,y.jsxs)(i.Row,{wrap:!0,gap:8,children:['text'===e.method?(0,y.jsx)(i.Button,{testID:`send-${e.id}`,kind:"success",label:"\ud83d\udcac Open in Messages",disabled:!K.length,onPress:()=>Y((0,b.smsLink)(e.number,N))}):null,'whatsapp'===e.method?(0,y.jsx)(i.Button,{testID:`send-${e.id}`,kind:"success",label:"Open in WhatsApp",disabled:!K.length,onPress:()=>Y((0,b.waLink)(e.number,N))}):null,'phone'===e.method?(0,y.jsx)(i.Button,{testID:`send-${e.id}`,kind:"success",label:`\ud83d\udcde Call ${e.name}`,disabled:!e.number,onPress:()=>Y((0,b.telLink)(e.number))}):null,'online'===e.method?(0,y.jsx)(i.Button,{testID:`send-${e.id}`,kind:"success",label:`\ud83c\udf10 ${e.urlLabel??'Open website'}`,disabled:!e.url,onPress:()=>Y(e.url)}):null,'online'!==e.method&&'tbc'!==e.method&&K.length?(0,y.jsx)(i.Button,{kind:"ghost",label:z?'Copied \u2713':'Copy order',onPress:async()=>{const e=await w(N);_(e),e&&setTimeout(()=>_(!1),2e3)}}):null]}),'text'===e.method&&!e.number&&K.length?(0,y.jsx)(i.Muted,{children:"No number saved: Messages opens with the order written and asks who to send it to."}):null,'whatsapp'===e.method&&!e.number&&K.length?(0,y.jsx)(i.Muted,{children:"No number saved: WhatsApp opens with the order written and asks who to send it to."}):null,'phone'!==e.method||e.number?null:(0,y.jsx)(i.Muted,{children:"Add the phone number above to call from here."}),'online'!==e.method||e.url?null:(0,y.jsx)(i.Muted,{children:"Add the link above and the button opens it."})]}):null]})}},1168,[827,835,984,34,379,236,402,102,794,1027,983,985,867,1028,821,1145,25]); @@ -1261,7 +1261,7 @@ __d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{ __d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.waNumber=o,_e.waMeLink=function(e,t){const n=o(e);return n?t?`https://wa.me/${n}?text=${encodeURIComponent(t)}`:`https://wa.me/${n}`:null},Object.defineProperty(_e,"guestWhatsAppText",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"staffWhatsAppTexts",{enumerable:!0,get:function(){return p}}),_e.openWhatsApp=async function(e){try{return await n.default.openURL(e),!0}catch{return!1}};var e,t=r(_d[0]),n=(e=t)&&e.__esModule?e:{default:e};function o(e,t="44"){if(!e)return null;let n=String(e).trim().replace(/[\s().\-]/g,'');return n.startsWith('+')?n=n.slice(1):n.startsWith('00')?n=n.slice(2):n.startsWith('0')&&(n=t+n.slice(1)),n=n.replace(/^440/,'44'),/^[1-9][0-9]{6,14}$/.test(n)?n:null}const s=e=>{const[t,n,o]=e.split('-').map(Number);return new Date(t,n-1,o).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long',year:'numeric'})},u=e=>{const[t,n,o]=e.split('-').map(Number);return new Date(t,n-1,o).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'})},c=e=>e.slice(0,5),l=e=>e.replace(' (example)','').trim().split(/\s+/)[0]||'there',m=(e,t)=>`Hi ${t}, it's ${e.name.trim()} about my booking${e.ref?` ${e.ref}`:''}: ${s(e.date)} at ${c(e.time)}, table for ${e.partySize}. `,p=(e,t,n)=>({confirm:`Hi ${l(e.name)}, it's ${t}${n?` in ${n}`:''}. Just confirming your table for ${e.partySize} on ${u(e.date)} at ${c(e.time)}${e.ref?` (ref ${e.ref})`:''}. Any questions, just reply here.`,change:`Hi ${l(e.name)}, it's ${t} about your booking on ${u(e.date)} at ${c(e.time)}. `})},1178,[379]); __d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"payFor",{enumerable:!0,get:function(){return k.payFor}}),Object.defineProperty(_e,"useVenuePay",{enumerable:!0,get:function(){return k.useVenuePay}}),_e.PayTipsSettings=function({go:e}){const{rid:s,today:o}=(0,P.useCtx)(6e4),{pay:r,source:d}=(0,k.useVenuePay)(s),[a,l]=(0,n.useState)(r),[u,c]=(0,n.useState)((0,f.ukDate)(r.tipsAnchorPayday)),[y,x]=(0,n.useState)(null),j=(0,f.parseUk)(u),w=(0,f.cleanPay)({...a,tipsAnchorPayday:j??a.tipsAnchorPayday}),C=JSON.stringify(w)!==JSON.stringify(r)||'settings'!==d,S=(0,f.nextToPay)(w,'tips',o).period,D=(0,f.nextToPay)(w,'wage',o).period,I=(0,f.tipsPeriod)(w,S.start,1),z=(0,f.wagePeriod)(w,D.start,1),H=e=>{l({...a,...e}),x(null)};return(0,v.jsxs)(i.default,{style:{gap:12},testID:"pay-settings",children:['none'===d?(0,v.jsx)(h.Banner,{kind:"warn",title:"Pay dates not set up yet",children:"Set your tips and wage dates here. Until then the app uses calendar months and weekly tips."}):null,'questionnaire'===d?(0,v.jsx)(h.Banner,{kind:"info",title:"From your sign-up answers",children:"These dates came from your questionnaire. Check them and tap Save to make them your venue's pay dates."}):null,(0,v.jsx)(T.SectionHead,{title:"Tips",sub:"How often tips are paid out, and which days each payout covers."}),(0,v.jsxs)(h.Card,{children:[(0,v.jsx)(h.T,{weight:"semibold",children:"How often"}),(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:['weekly','fortnightly','monthly'].map(e=>(0,v.jsx)(h.Chip,{label:M[e],selected:a.tipsFrequency===e,onPress:()=>H({tipsFrequency:e})},e))}),(0,v.jsx)(h.Field,{label:"Next tips payday (DD/MM/YYYY)",value:u,onChangeText:e=>{c((0,t.slashDate)(e,u)),x(null)},maxLength:10,placeholder:"02/11/2026",keyboardType:"numbers-and-punctuation"}),j?(0,v.jsxs)(h.Muted,{children:[(0,f.dayMonth)(j)," ",j.slice(0,4)]}):(0,v.jsx)(h.T,{size:13,colour:b.colours.red,children:"Enter a date like 02/11/2026"}),(0,v.jsx)(h.T,{weight:"semibold",children:"Each tips period ends"}),(0,v.jsxs)(h.Row,{children:[(0,v.jsx)(h.Stepper,{label:"days before payday",value:a.tipsEndsDaysBefore,min:0,max:13,onChange:e=>H({tipsEndsDaysBefore:e})}),(0,v.jsx)(h.Muted,{style:{flex:1},children:0===a.tipsEndsDaysBefore?'on payday':1===a.tipsEndsDaysBefore?'day before payday (a Monday payday covers up to the Sunday)':'days before payday'})]})]}),(0,v.jsx)(T.SectionHead,{title:"Wages",sub:"Monthly pay: the cut-off starts each pay period."}),(0,v.jsxs)(h.Card,{children:[(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(h.T,{weight:"semibold",style:{flex:1},children:"Pay day of the month"}),(0,v.jsx)(h.Stepper,{label:"pay day",value:a.wagePayDay,min:1,max:31,onChange:e=>H({wagePayDay:e})})]}),(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(h.T,{weight:"semibold",style:{flex:1},children:"Cut-off (first day of each period)"}),(0,v.jsx)(h.Stepper,{label:"cut-off day",value:a.wageCutoffDay,min:1,max:28,onChange:e=>H({wageCutoffDay:e})})]}),(0,v.jsxs)(h.Muted,{children:["Period runs the ",B(a.wageCutoffDay)," to the ",B(1===a.wageCutoffDay?31:a.wageCutoffDay-1),1===a.wageCutoffDay?' (end of the month)':' of the next month',". A pay day past the month end uses the last day."]}),(0,v.jsx)(h.T,{weight:"semibold",children:"A pay day on a weekend"}),(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:['none','before','after'].map(e=>(0,v.jsx)(h.Chip,{label:$[e],selected:(a.weekendRule??'none')===e,onPress:()=>H({weekendRule:e})},e))})]}),(0,v.jsx)(T.SectionHead,{title:"Preview"}),(0,v.jsxs)(h.Card,{highlight:b.colours.gold,children:[(0,v.jsx)(R,{label:"Next tips payday",day:S.payday,period:S}),(0,v.jsx)(R,{label:"Then",day:I.payday,period:I}),(0,v.jsx)(i.default,{style:{height:1,backgroundColor:b.colours.border}}),(0,v.jsx)(R,{label:"Next payday",day:D.payday,period:D}),(0,v.jsx)(R,{label:"Then",day:z.payday,period:z})]}),(0,v.jsx)(h.Button,{kind:"success",label:'settings'===d?'Save pay dates':'Save as our pay dates',disabled:!j||!C,testID:"save-pay",onPress:()=>{p.useStore.getState().updateSettings(s,{pay:w}),x('Saved. Everyone in the venue sees these dates.')}}),y?(0,v.jsx)(h.Banner,{kind:"success",title:y}):null,(0,v.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,v.jsx)(h.Button,{small:!0,kind:"secondary",label:"Payroll hours",onPress:()=>e('more','hours')}),(0,v.jsx)(h.Button,{small:!0,kind:"secondary",label:"Tips day",onPress:()=>e('more','tipsday')})]})]})},_e.hoursIn=z,Object.defineProperty(_e,"toTsv",{enumerable:!0,get:function(){return N}}),Object.defineProperty(_e,"toCsv",{enumerable:!0,get:function(){return F}}),_e.summaryTable=V,_e.detailTable=E,_e.copyText=Y,_e.periodOptions=G,_e.PayrollHours=function({go:e}){const{rid:s,today:t,now:r,r:p,me:w,meId:T,role:M}=(0,P.useCtx)(6e4),$=(0,C.canSeeHoursEdit)({role:M,isCar:S.IS_CAR}),[B,R]=(0,n.useState)(!1),{pay:I,source:A}=(0,k.useVenuePay)(s),W=(0,y.useOwner)(e=>e.staff),L=(0,y.useOwner)(e=>(0,y.liveAttendance)(e.attendance)),q=(0,P.useHourly)(),J=(0,a.default)().width<700,[K,Q]=(0,n.useState)(null),[X,Z]=(0,n.useState)(null),ee=e=>{const s=y.useOwner.getState().confirmEntries([e.id],w,T,(new Date).toISOString());we(s?'Approved. It now counts in the hours and pay.':'Nothing to approve.')},se=e=>(0,v.jsxs)(i.default,{style:{gap:8,marginBottom:8},testID:`daily-${e.person.id}`,children:[e.days.map(e=>(0,v.jsx)(u.ShiftCard,{d:e,manager:!0,onApprove:()=>ee(e.a),onEdit:()=>Q(e.a),onRemove:()=>Z(e.a)},e.a.id)),e.days.length?null:(0,v.jsx)(h.Muted,{center:!0,children:"No clocked shifts in this period."})]}),te=(0,n.useMemo)(()=>G(I,t),[I,t]),[oe,ne]=(0,n.useState)('wage'),[re,de]=(0,n.useState)(null),[ae,ie]=(0,n.useState)(!1),[le,ue]=(0,n.useState)({}),[ce,he]=(0,n.useState)(null),pe='custom'===oe&&re?re:(te.find(e=>e.id===oe)??te[0]).period,ye=(0,n.useMemo)(()=>z(pe,W,L,r,q),[pe.key,W,L,q,Math.floor(r.getTime()/6e4)]),ge=ye.some(e=>null!=e.rate),xe='tips'===pe.kind,fe=ye.reduce((e,s)=>({c:e.c+s.confirmed,p:e.p+s.pending,s:e.s+s.shifts,g:e.g+(s.gross??0)}),{c:0,p:0,s:0,g:0}),me=ye.filter(e=>e.pending>0).length,be=`${p.name}: hours ${(0,f.rangeText)(pe.start,pe.end)}`,je=`hours-${pe.start}-to-${pe.end}`,we=e=>{he(e),setTimeout(()=>he(null),6e3)};return(0,v.jsxs)(i.default,{style:{gap:10},testID:"payroll-hours",children:['none'===A?(0,v.jsxs)(h.Banner,{kind:"warn",title:"Pay dates not set up",children:[(0,v.jsx)(h.Muted,{children:"Using calendar months for now."}),(0,v.jsx)(h.Button,{small:!0,kind:"ghost",label:"Set your pay dates \u203a",onPress:()=>e('more','paysettings')})]}):null,(0,v.jsxs)(h.Row,{wrap:!0,gap:6,children:[te.map(e=>(0,v.jsx)(h.Chip,{label:e.label,sub:e.sub,selected:oe===e.id,onPress:()=>{ne(e.id),ie(!1)}},e.id)),(0,v.jsx)(h.Chip,{label:"Custom dates",sub:re&&'custom'===oe?(0,f.rangeText)(re.start,re.end):'Pick any range',selected:'custom'===oe,onPress:()=>ie(!ae)})]}),ae?(0,v.jsx)(U,{onSet:e=>{de(e),ne('custom'),ie(!1)}}):null,(0,v.jsx)(h.Card,{highlight:b.colours.gold,children:(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,v.jsxs)(i.default,{style:{flexShrink:1,minWidth:0},children:[(0,v.jsxs)(h.T,{weight:"bold",size:18,children:[(0,f.rangeText)(pe.start,pe.end)," ",pe.end.slice(0,4)]}),(0,v.jsxs)(h.Muted,{children:[(0,f.ukDate)(pe.start)," to ",(0,f.ukDate)(pe.end),pe.payday?` \xb7 ${pe.payday>=t?'pays':'paid'} ${(0,f.dayMonth)(pe.payday)}`:'',xe?' \xb7 tips period':'wage'===pe.kind?' \xb7 wage period':'']})]}),(0,v.jsxs)(i.default,{style:{alignItems:'flex-end'},children:[(0,v.jsx)(h.T,{size:22,weight:"bold",colour:b.colours.gold,children:(0,l.durText)(fe.c)}),(0,v.jsxs)(h.Muted,{children:["approved",fe.p?` \xb7 ${(0,l.durText)(fe.p)} pending`:'']})]})]})}),$?(0,v.jsx)(i.default,{style:{alignItems:'center'},children:(0,v.jsx)(h.Button,{testID:"add-past-shift",label:"Add past shift",accessibilityLabel:"Add past shift",onPress:()=>R(!0),style:{minHeight:48,minWidth:180}})}):null,me?(0,v.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:"Sign off pending hours",onPress:()=>e('more','signoff'),testID:"pending-banner",children:(0,v.jsxs)(i.default,{style:{backgroundColor:b.colours.amberBg,borderRadius:12,padding:12,borderLeftWidth:6,borderLeftColor:b.colours.amber,gap:4},children:[(0,v.jsxs)(h.T,{weight:"bold",colour:b.colours.amber,children:["\u26a0 ",(0,l.durText)(fe.p)," still waiting for approval (",me," ",1===me?'person':'people',")"]}),(0,v.jsx)(h.T,{size:14,children:"Pending hours are not in the totals or the exports' confirmed columns. Sign them off first so everyone is paid in full."}),(0,v.jsx)(h.T,{weight:"semibold",colour:b.colours.gold,children:"Sign off hours \u203a"})]})}):(0,v.jsx)(h.Banner,{kind:"success",title:"All hours in this period are signed off"}),(0,v.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,v.jsx)(h.Button,{small:!0,kind:"success",label:"Copy for spreadsheet",testID:"copy-tsv",onPress:async()=>{const e=await Y(N(V(ye,pe,ge,xe)));we(e?`Copied ${ye.length} rows. Paste into the first cell of your spreadsheet.`:'Copy is not available here. Use Download CSV.')}}),(0,v.jsx)(h.Button,{small:!0,kind:"secondary",label:"Download CSV",onPress:()=>{(0,j.downloadText)(`${je}.csv`,F(V(ye,pe,ge,xe))),we('CSV downloaded (summary).')}}),(0,v.jsx)(h.Button,{small:!0,kind:"secondary",label:"Download CSV (daily detail)",onPress:()=>{(0,j.downloadText)(`${je}-daily.csv`,F(E(ye))),we('CSV downloaded (one line per shift).')}}),(0,v.jsx)(h.Button,{small:!0,kind:"secondary",label:"Print / PDF",onPress:()=>{const e=V(ye,pe,ge,xe);(0,j.printTable)(be,`${(0,f.ukDate)(pe.start)} to ${(0,f.ukDate)(pe.end)} \xb7 confirmed hours only in the totals \xb7 printed ${(0,f.ukDate)(t)}`,e[0],e.slice(1))}})]}),ce?(0,v.jsx)(h.Banner,{kind:"success",title:ce}):null,J?(0,v.jsxs)(i.default,{testID:"hours-table",style:{gap:10},children:[ye.map(e=>{const s=!!le[e.person.id];return(0,v.jsxs)(i.default,{style:{borderRadius:16,borderWidth:1,borderColor:'rgba(212,175,106,0.45)',backgroundColor:b.colours.surface,padding:12,gap:10},children:[(0,v.jsx)(u.HoursSummaryCard,{name:O(e.person),role:H(e.person),approved:e.confirmed,pending:e.pending,rate:e.rate}),(0,v.jsx)(h.Button,{kind:"secondary",testID:`hours-open-${e.person.id}`,label:s?'Hide shifts':`Show ${e.days.length} ${1===e.days.length?'shift':'shifts'}`,accessibilityLabel:`${s?'Hide':'Show'} ${O(e.person)}'s shifts`,onPress:()=>ue({...le,[e.person.id]:!s}),style:{minHeight:48}}),s?se(e):null]},e.person.id)}),(0,v.jsxs)(h.Muted,{center:!0,children:["Total: ",(0,l.durText)(fe.c)," approved",ge?` \xb7 ${(0,x.gbp)(fe.g)} gross`:'',fe.p?` \xb7 ${(0,l.durText)(fe.p)} pending`:'']})]}):(0,v.jsx)(o.WideTable,{children:(0,v.jsxs)(i.default,{testID:"hours-table",children:[(0,v.jsx)(o.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:b.colours.border,paddingBottom:4},children:['Name','Shifts','Approved','Pending',xe?'Tips h':'Hours',ge?'Rate':'',ge?'Gross':''].map((e,s)=>(0,v.jsx)(h.T,{size:12,weight:"semibold",colour:b.colours.gold,style:{width:_[s]},children:e},s))}),ye.map(e=>{const s=!!le[e.person.id];return(0,v.jsxs)(i.default,{style:{borderBottomWidth:1,borderColor:'#222'},children:[(0,v.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:`${O(e.person)} daily hours`,onPress:()=>ue({...le,[e.person.id]:!s}),style:{paddingVertical:7},children:(0,v.jsxs)(o.TRow,{heads:['Name','Shifts','Approved','Pending',xe?'Tips h':'Hours',ge?'Rate':'',ge?'Gross':''],children:[(0,v.jsxs)(i.default,{style:{width:_[0]},children:[(0,v.jsxs)(h.T,{size:14,weight:"semibold",numberOfLines:1,children:[s?'\u25be':'\u25b8'," ",O(e.person)]}),(0,v.jsx)(h.Muted,{children:H(e.person)})]}),(0,v.jsx)(h.T,{size:14,style:{width:_[1]},children:e.shifts}),(0,v.jsx)(h.T,{size:14,weight:"semibold",style:{width:_[2]},children:(0,l.durText)(e.confirmed)}),(0,v.jsx)(h.T,{size:14,weight:e.pending?'bold':'regular',colour:e.pending?b.colours.amber:b.colours.muted,style:{width:_[3]},children:e.pending?`\u26a0 ${(0,l.durText)(e.pending)}`:'0m'}),(0,v.jsx)(h.T,{size:14,style:{width:_[4]},children:xe?(0,f.decH)(e.confirmed):(0,l.durText)(e.confirmed)}),(0,v.jsx)(h.T,{size:14,colour:b.colours.muted,style:{width:_[5]},children:ge?null!=e.rate?(0,x.gbp)(e.rate):'\u2013':''}),(0,v.jsxs)(h.T,{size:14,weight:"semibold",style:{width:_[6]},children:[ge?null!=e.gross?(0,x.gbp)(e.gross):'\u2013':'',ge&&null!=e.rate&&e.pending?(0,v.jsx)(h.T,{size:12,colour:b.colours.amber,children:`\n+ ${(0,x.gbp)(Math.round(e.pending/60*e.rate))} pending`}):null]})]})}),s?se(e):null]},e.person.id)}),(0,v.jsxs)(o.TRow,{heads:['','Shifts','Approved','Pending',xe?'Tips h':'Hours','',ge?'Gross':''],style:{paddingVertical:8,borderTopWidth:2,borderColor:b.colours.gold},children:[(0,v.jsxs)(h.T,{size:14,weight:"bold",style:{width:_[0]},children:["Total (",ye.length,")"]}),(0,v.jsx)(h.T,{size:14,weight:"bold",style:{width:_[1]},children:fe.s}),(0,v.jsx)(h.T,{size:14,weight:"bold",colour:b.colours.gold,style:{width:_[2]},children:(0,l.durText)(fe.c)}),(0,v.jsx)(h.T,{size:14,weight:"bold",colour:fe.p?b.colours.amber:b.colours.muted,style:{width:_[3]},children:(0,l.durText)(fe.p)}),(0,v.jsx)(h.T,{size:14,weight:"bold",style:{width:_[4]},children:xe?(0,f.decH)(fe.c):(0,l.durText)(fe.c)}),(0,v.jsx)(h.T,{size:14,style:{width:_[5]},children:" "}),(0,v.jsx)(h.T,{size:14,weight:"bold",style:{width:_[6]},children:ge?(0,x.gbp)(fe.g):''})]})]})}),K?(0,v.jsx)(c.OverrideSheet,{a:K,staffId:K.staffId,date:K.date,onClose:()=>Q(null)}):null,X?(0,v.jsx)(u.RemoveShiftSheet,{a:X,who:{name:w,id:T},onClose:()=>{Z(null),we('Removed from hours. It is kept in the history.')}}):null,B?(0,v.jsx)(D.AddPastShiftSheet,{onClose:()=>R(!1),onSaved:()=>{R(!1),we('Saved. It counts in the hours and pay.')}}):null,(0,v.jsxs)(h.Muted,{children:["Tap a name for each day. Hours read 37h 30m. The export also has decimal hours (37.50) and h:mm for your spreadsheet. Paid hours = clock out \u2212 clock in \u2212 break. ",ge?'Gross is before tax, from confirmed hours only.':'Rates and gross show once you sign in with your personal link.']}),xe?(0,v.jsx)(h.Button,{kind:"success",label:"Tips day: split tips for this period \u203a",onPress:()=>e('more','tipsday')}):null]})},_e.TipsDay=function({go:e}){const{rid:t,today:r,now:a}=(0,P.useCtx)(6e4),{pay:u,source:c}=(0,k.useVenuePay)(t),p=(0,y.useOwner)(e=>e.staff),T=(0,y.useOwner)(e=>(0,y.liveAttendance)(e.attendance)),C=(0,y.useOwner)(e=>e.tronc),S=(0,f.nextToPay)(u,'tips',r),[D,M]=(0,n.useState)(0),$=(0,f.tipsPeriod)(u,S.period.start,D),[B,R]=(0,n.useState)(''),[I,W]=(0,n.useState)({}),[L,V]=(0,n.useState)(null),E=(0,n.useMemo)(()=>z($,p,T,a,{}),[$.key,p,T]),G=e=>'owner'===e.role&&!C.includeOwner||'manager'===e.role&&!C.includeManagers,U=e=>I[e.id]??G(e),_=E.filter(e=>e.confirmed>0||e.pending>0),q=Math.round(100*Number(B.replace(/[\xa3,\s]/g,''))),J=Number.isFinite(q)&&q>0&&q<=1e8&&/^\s*\xa3?\s*[\d,]+(\.\d{0,2})?\s*$/.test(B),K=_.filter(e=>!U(e.person)&&e.confirmed>0),{amounts:Q}=(0,w.allocate)(J?q:0,K.map(e=>e.confirmed)),X={};K.forEach((e,s)=>{X[e.person.id]=Q[s]});const Z=K.reduce((e,s)=>e+s.confirmed,0),ee=Object.values(X).reduce((e,s)=>e+s,0),se=_.filter(e=>e.pending>0&&!U(e.person)),te=se.reduce((e,s)=>e+s.pending,0),oe=()=>[['Name','Role','Period start','Period end','Payday','Confirmed hours','Confirmed h:mm','Share %','Tips \xa3'],..._.map(e=>{const s=!U(e.person)&&e.confirmed>0;return[O(e.person),H(e.person),(0,f.ukDate)($.start),(0,f.ukDate)($.end),$.payday?(0,f.ukDate)($.payday):'',(0,f.decH)(e.confirmed),(0,f.hMm)(e.confirmed),s&&Z?(e.confirmed/Z*100).toFixed(2):'0.00',s?A(X[e.person.id]??0):U(e.person)?'excluded':'0.00']}),['TOTAL','',(0,f.ukDate)($.start),(0,f.ukDate)($.end),$.payday?(0,f.ukDate)($.payday):'',(0,f.decH)(Z),(0,f.hMm)(Z),Z?'100.00':'0.00',A(ee)]],ne=e=>{V(e),setTimeout(()=>V(null),6e3)};return(0,v.jsxs)(i.default,{style:{gap:10},testID:"tips-day",children:[(0,v.jsx)(h.Banner,{kind:"info",title:"Saving payouts and notifying staff are coming next",children:"For now this works out the split and exports it. Nothing is saved to the team, sent or paid."}),'none'===c?(0,v.jsxs)(h.Banner,{kind:"warn",title:"Tips dates not set up",children:[(0,v.jsx)(h.Muted,{children:"Using weekly tips for now."}),(0,v.jsx)(h.Button,{small:!0,kind:"ghost",label:"Set your pay dates \u203a",onPress:()=>e('more','paysettings')})]}):null,(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(h.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",disabled:D<=-6,onPress:()=>M(D-1)}),(0,v.jsxs)(i.default,{style:{alignItems:'center',flex:1},children:[(0,v.jsx)(h.T,{weight:"bold",size:18,children:(0,f.rangeText)($.start,$.end)}),(0,v.jsxs)(h.Muted,{children:[(0,f.ukDate)($.start)," to ",(0,f.ukDate)($.end)," \xb7 ",$.payday>=r?'paid':'was paid'," ",(0,f.dayMonth)($.payday)]}),0===D?(0,v.jsx)(h.Badge,{kind:"gold",label:"Paid next"}):null]}),(0,v.jsx)(h.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:D>=1,onPress:()=>M(D+1)})]}),(0,v.jsxs)(h.Card,{highlight:b.colours.gold,children:[(0,v.jsx)(h.T,{weight:"semibold",children:"Total tips to share"}),(0,v.jsxs)(h.Row,{style:{alignItems:'center'},children:[(0,v.jsx)(h.T,{size:28,weight:"bold",colour:b.colours.gold,children:"\xa3"}),(0,v.jsx)(s.TextInput,{testID:"tips-total",accessibilityLabel:"Total tips in pounds",value:B,onChangeText:R,placeholder:"0.00",placeholderTextColor:"#7D776C",keyboardType:"decimal-pad",style:[h.styles.input,{flex:1,fontSize:26,fontWeight:'700'}]})]}),B&&!J?(0,v.jsx)(h.T,{size:13,colour:b.colours.red,children:"Enter an amount like 1250.00"}):(0,v.jsx)(h.Muted,{children:"Shared by confirmed hours: share = total \xd7 (their hours \xf7 everyone's hours). Rounded to the penny; leftover pennies go to the largest shares so it adds up exactly."})]}),se.length?(0,v.jsx)(d.default,{accessibilityRole:"button",onPress:()=>e('more','signoff'),testID:"tips-pending",children:(0,v.jsxs)(i.default,{style:{backgroundColor:b.colours.redBg,borderRadius:12,padding:12,borderLeftWidth:6,borderLeftColor:b.colours.red,gap:4},children:[(0,v.jsxs)(h.T,{weight:"bold",colour:b.colours.red,children:["\u26a0 Don't pay out yet: ",(0,l.durText)(te)," not approved yet"]}),(0,v.jsxs)(h.T,{size:14,children:[se.map(e=>`${O(e.person)} (${(0,l.durText)(e.pending)})`).join(', '),". Pending hours are left out of the split, so these people would get less than they should."]}),(0,v.jsx)(h.T,{weight:"semibold",colour:b.colours.gold,children:"Sign off hours \u203a"})]})}):_.length?(0,v.jsx)(h.Banner,{kind:"success",title:"All hours in this fortnight are signed off"}):null,(0,v.jsx)(o.WideTable,{children:(0,v.jsxs)(i.default,{testID:"tips-table",children:[(0,v.jsx)(o.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:b.colours.border,paddingBottom:4},children:['Include','Name','Confirmed','Share','Tips'].map((e,s)=>(0,v.jsx)(h.T,{size:12,weight:"semibold",colour:b.colours.gold,style:{width:[64,150,100,64,84][s]},children:e},e))}),_.map(e=>{const s=U(e.person),t=X[e.person.id]??0;return(0,v.jsxs)(o.TRow,{heads:['Include','Name','Confirmed','Share','Tips'],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222',opacity:s?.5:1},children:[(0,v.jsx)(d.default,{accessibilityRole:"checkbox",accessibilityState:{checked:!s},accessibilityLabel:`Include ${O(e.person)}`,onPress:()=>W({...I,[e.person.id]:!s}),style:{width:64,minHeight:44,justifyContent:'center'},children:(0,v.jsx)(i.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:s?b.colours.muted:b.colours.ok,backgroundColor:s?'transparent':b.colours.okBg,alignItems:'center',justifyContent:'center'},children:(0,v.jsx)(h.T,{size:14,colour:b.colours.ok,children:s?'':'\u2713'})})}),(0,v.jsxs)(i.default,{style:{width:150},children:[(0,v.jsx)(h.T,{size:14,weight:"semibold",numberOfLines:1,children:O(e.person)}),(0,v.jsxs)(h.Muted,{numberOfLines:1,children:[s?'Excluded':H(e.person),e.pending?` \xb7 \u26a0 ${(0,f.decH)(e.pending)} h pending`:'']})]}),(0,v.jsxs)(h.T,{size:14,style:{width:80},children:[(0,f.decH)(e.confirmed)," h"]}),(0,v.jsx)(h.T,{size:14,colour:b.colours.muted,style:{width:64},children:!s&&Z?`${(e.confirmed/Z*100).toFixed(1)}%`:'\u2013'}),(0,v.jsx)(h.T,{size:15,weight:"bold",colour:s?b.colours.muted:b.colours.gold,style:{width:84},children:s?'\u2013':(0,x.gbp)(t)})]},e.person.id)}),(0,v.jsxs)(o.TRow,{heads:['','','Confirmed','Share','Tips'],style:{paddingVertical:8,borderTopWidth:2,borderColor:b.colours.gold},children:[(0,v.jsx)(h.T,{size:14,style:{width:64},children:" "}),(0,v.jsxs)(h.T,{size:14,weight:"bold",style:{width:150},children:["Total (",K.length," people)"]}),(0,v.jsxs)(h.T,{size:14,weight:"bold",style:{width:80},children:[(0,f.decH)(Z)," h"]}),(0,v.jsx)(h.T,{size:14,style:{width:64},children:Z?'100%':'\u2013'}),(0,v.jsx)(h.T,{size:15,weight:"bold",colour:J&&ee===q?b.colours.ok:b.colours.text,style:{width:84},children:(0,x.gbp)(ee)})]})]})}),_.length?null:(0,v.jsx)(h.Muted,{children:"No clocked hours in this fortnight yet."}),J&&Z?(0,v.jsxs)(h.Muted,{children:["Check: ",K.length," shares add up to ",(0,x.gbp)(ee)," of ",(0,x.gbp)(q)," ",ee===q?'\u2713':'',". \xa3",(q/100/(Z/60)).toFixed(4)," per confirmed hour."]}):null,(0,v.jsxs)(h.Muted,{children:["Owner ",C.includeOwner?'included':'left out'," and managers ",C.includeManagers?'included':'left out'," by default (your tipping policy in Tips). Tick or untick anyone for this split."]}),(0,v.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,v.jsx)(h.Button,{small:!0,kind:"success",label:"Copy for spreadsheet",testID:"tips-copy",disabled:!J,onPress:async()=>{const e=await Y(N(oe()));ne(e?'Copied. Paste into the first cell of your spreadsheet.':'Copy is not available here. Use Download CSV.')}}),(0,v.jsx)(h.Button,{small:!0,kind:"secondary",label:"Download CSV",disabled:!J,onPress:()=>{(0,j.downloadText)(`tips-${$.start}-to-${$.end}.csv`,F(oe())),ne('CSV downloaded.')}}),(0,v.jsx)(h.Button,{small:!0,kind:"secondary",label:"Print / PDF",disabled:!J,onPress:()=>{const e=oe();(0,j.printTable)(`Tips ${(0,f.rangeText)($.start,$.end)} (paid ${(0,f.dayMonth)($.payday)})`,`Total ${(0,x.gbp)(q)} shared by confirmed hours${se.length?` \xb7 WARNING ${(0,f.decH)(te)} h not signed off`:''}`,e[0],e.slice(1))}})]}),L?(0,v.jsx)(h.Banner,{kind:"success",title:L}):null]})},_e.PaydaysCard=function({go:e}){const{rid:s,today:t}=(0,P.useCtx)(6e4),{pay:o,source:n}=(0,k.useVenuePay)(s),d=(0,f.nextToPay)(o,'tips',t).period,a=(0,f.nextToPay)(o,'wage',t).period;return(0,v.jsxs)(i.default,{testID:"paydays-card",style:{backgroundColor:b.colours.surface,borderRadius:16,borderWidth:1,borderColor:b.colours.hairline,padding:16,gap:8},children:[(0,v.jsx)(r.CardHeading,{right:'none'===n?(0,v.jsx)(h.Badge,{kind:"amber",label:"Not set up"}):null,children:"Paydays"}),(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,v.jsxs)(h.T,{children:["Next tips payday: ",(0,v.jsx)(h.T,{weight:"semibold",colour:b.colours.goldLight,children:d.payday===t?'today':(0,f.dayMonth)(d.payday)})]}),(0,v.jsx)(h.Muted,{children:(0,f.rangeText)(d.start,d.end)})]}),(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,v.jsxs)(h.T,{children:["Next payday: ",(0,v.jsx)(h.T,{weight:"semibold",colour:b.colours.goldLight,children:a.payday===t?'today':(0,f.dayMonth)(a.payday)})]}),(0,v.jsxs)(h.Muted,{children:["period ",(0,f.rangeText)(a.start,a.end)]})]}),(0,v.jsxs)(r.ActionGrid,{testID:"paydays-actions",children:[(0,v.jsx)(r.ActionTile,{primary:!0,icon:"payroll",label:"Payroll hours",sub:"Copy or export",onPress:()=>e('more','hours'),testID:"paydays-hours"}),(0,v.jsx)(r.ActionTile,{icon:"tips",label:"Tips day",sub:"Share out tips",onPress:()=>e('more','tipsday'),testID:"paydays-tips"})]}),'settings'!==n?(0,v.jsx)(h.Button,{small:!0,kind:"ghost",label:"Pay & tips settings",onPress:()=>e('more','paysettings'),style:{alignSelf:'flex-start'}}):null]})},_e.MyPeriods=function({staffId:e}){const{rid:s,today:t,now:o,meId:n}=(0,P.useCtx)(6e4),r=e??n,{pay:d}=(0,k.useVenuePay)(s),a=(0,y.useOwner)(e=>(0,y.liveAttendance)(e.attendance)),u=(0,y.useOwner)(e=>e.staff.find(e=>e.id===r)),c=(0,f.wagePeriod)(d,t,0),p=(0,f.tipsPeriod)(d,t,0),x=e=>u?z(e,[u],a,o,{})[0]??null:null,j=(e,s,o)=>(0,v.jsxs)(i.default,{style:{flexGrow:1,flexBasis:160,backgroundColor:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.border,padding:12,gap:2},children:[(0,v.jsx)(h.T,{size:13,weight:"semibold",colour:b.colours.gold,children:e.toUpperCase()}),(0,v.jsxs)(h.Muted,{children:[(0,f.rangeText)(s.start,s.end)," \xb7 ",s.payday>=t?'paid':'was paid'," ",(0,f.dayMonth)(s.payday)]}),(0,v.jsx)(h.T,{size:24,weight:"bold",children:(0,l.durText)(o?.confirmed??0)}),(0,v.jsxs)(h.Muted,{children:["approved \xb7 ",o?.shifts??0," shifts"]}),o?.pending?(0,v.jsxs)(h.T,{size:13,colour:b.colours.amber,children:["+ ",(0,l.durText)(o.pending)," waiting for approval"]}):null]},e);return(0,v.jsx)(h.Row,{wrap:!0,gap:8,style:{alignItems:'stretch'},children:[j('This pay period',c,x(c)),j('This tips fortnight',p,x(p))]})};var s=_r(_d[0]),t=_r(_d[1]),o=_r(_d[2]),n=_r(_d[3]),r=_r(_d[4]);_r(_d[5]);var d=e(_r(_d[6])),a=e(_r(_d[7])),i=e(_r(_d[8])),l=_r(_d[9]),u=_r(_d[10]),c=_r(_d[11]),h=_r(_d[12]),p=_r(_d[13]),y=_r(_d[14]),x=_r(_d[15]),f=_r(_d[16]),b=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),T=_r(_d[20]),P=_r(_d[21]),k=_r(_d[22]),C=_r(_d[23]),S=_r(_d[24]),D=_r(_d[25]),v=_r(_d[26]);const M={weekly:'Weekly',fortnightly:'Fortnightly',monthly:'Monthly'},$={none:'Keep the date',before:'Friday before',after:'Monday after'};const B=e=>`${e}${e%10==1&&11!==e?'st':e%10==2&&12!==e?'nd':e%10==3&&13!==e?'rd':'th'}`;function R({label:e,day:s,period:t}){return(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,v.jsxs)(h.T,{children:[e,": ",(0,v.jsx)(h.T,{weight:"bold",colour:b.colours.gold,children:(0,f.dayMonth)(s)})]}),(0,v.jsx)(h.Muted,{children:(0,f.rangeText)(t.start,t.end)})]})}const I=e=>{if(!e)return'';const s=new Date(e);return`${String(s.getHours()).padStart(2,'0')}:${String(s.getMinutes()).padStart(2,'0')}`};function z(e,s,t,o,n){const r=t.filter(s=>s.in&&s.date>=e.start&&s.date<=e.end);return s.map(e=>{const s=r.filter(s=>s.staffId===e.id).sort((e,s)=>e.date.localeCompare(s.date)||(e.in??'').localeCompare(s.in??'')).map(e=>{const s=(0,P.paidMins)(e,o),t=(0,y.attStatus)(e);return{a:e,date:e.date,inT:I(e.in),outT:I(e.out),brk:s.brk,paid:s.paid,status:'open'===t?'On now':'awaiting'===t?'Pending':'Confirmed'}}),t=e=>s.filter(s=>s.status===e).reduce((e,s)=>e+s.paid,0),d=t('Confirmed'),a=n[e.id];return{person:e,confirmed:d,pending:t('Pending'),open:t('On now'),shifts:s.filter(e=>'On now'!==e.status).length,days:s,rate:a,gross:null!=a?Math.round(d/60*a):void 0}}).filter(e=>e.days.length>0||e.person.active&&'owner'!==e.person.role)}const H=e=>`${y.ROLE_LABEL[e.role]}${e.job?` \xb7 ${e.job}`:''}`,O=e=>e.name.replace(' (example)',''),A=e=>null==e?'':(e/100).toFixed(2),W=e=>e.replace(/[\t\r\n]+/g,' '),L=e=>/[",\n]/.test(e)?`"${e.replace(/"/g,'""')}"`:e,N=e=>e.map(e=>e.map(W).join('\t')).join('\n'),F=e=>e.map(e=>e.map(L).join(',')).join('\r\n');function V(e,s,t,o){const n=['Name','Role','Period start','Period end','Confirmed hours','Confirmed h:mm','Pending hours','Pending h:mm','Shifts',...o?['Tips hours']:[],...t?['Rate \xa3/h','Gross \xa3']:[]],r=e.map(e=>[O(e.person),H(e.person),(0,f.ukDate)(s.start),(0,f.ukDate)(s.end),(0,f.decH)(e.confirmed),(0,f.hMm)(e.confirmed),(0,f.decH)(e.pending),(0,f.hMm)(e.pending),String(e.shifts),...o?[(0,f.decH)(e.confirmed)]:[],...t?[A(e.rate),A(e.gross)]:[]]),d=e.reduce((e,s)=>({c:e.c+s.confirmed,p:e.p+s.pending,s:e.s+s.shifts,g:e.g+(s.gross??0)}),{c:0,p:0,s:0,g:0});return[n,...r,['TOTAL','',(0,f.ukDate)(s.start),(0,f.ukDate)(s.end),(0,f.decH)(d.c),(0,f.hMm)(d.c),(0,f.decH)(d.p),(0,f.hMm)(d.p),String(d.s),...o?[(0,f.decH)(d.c)]:[],...t?['',A(d.g)]:[]]]}function E(e){return[['Name','Role','Date','In','Out','Break mins','Paid hours','Paid h:mm','Status'],...e.flatMap(e=>e.days.map(s=>[O(e.person),H(e.person),(0,f.ukDate)(s.date),s.inT,s.outT,'On now'===s.status?'':String(s.brk),'On now'===s.status?'':(0,f.decH)(s.paid),'On now'===s.status?'':(0,f.hMm)(s.paid),s.status]))]}async function Y(e){if('undefined'==typeof document)return!1;try{if(navigator.clipboard?.writeText)return await navigator.clipboard.writeText(e),!0}catch{}try{const s=document.createElement('textarea');s.value=e,s.style.position='fixed',s.style.opacity='0',document.body.appendChild(s),s.select();const t=document.execCommand('copy');return s.remove(),t}catch{return!1}}function G(e,s){const t=(0,f.nextToPay)(e,'wage',s),o=(0,f.nextToPay)(e,'tips',s),n=(0,f.wagePeriod)(e,t.period.start,-1),r=(0,f.tipsPeriod)(e,o.period.start,-1),d=e=>e.payday>=s?e.payday===s?'Pays today':`Pays ${(0,f.dayMonth)(e.payday)}`:`Paid ${(0,f.dayMonth)(e.payday)}`;return[{id:'wage',label:`Wages ${(0,f.rangeText)(t.period.start,t.period.end)}`,sub:d(t.period),period:t.period},{id:'wagePrev',label:`Wages ${(0,f.rangeText)(n.start,n.end)}`,sub:d(n),period:n},{id:'tips',label:`Tips ${(0,f.rangeText)(o.period.start,o.period.end)}`,sub:d(o.period),period:o.period},{id:'tipsPrev',label:`Tips ${(0,f.rangeText)(r.start,r.end)}`,sub:d(r),period:r}]}function U({onSet:e}){const[s,o]=(0,n.useState)(''),[r,d]=(0,n.useState)(''),a=(0,f.parseUk)(s),l=(0,f.parseUk)(r),u=!!a&&!!l&&l>=a&&(0,f.plusDays)(a,92)>=l;return(0,v.jsxs)(h.Row,{wrap:!0,gap:6,style:{alignItems:'flex-end'},children:[(0,v.jsx)(i.default,{style:{flexBasis:130,flexGrow:1},children:(0,v.jsx)(h.Field,{label:"From (DD/MM/YYYY)",value:s,onChangeText:e=>o((0,t.slashDate)(e,s)),placeholder:"23/10/2026",keyboardType:"numbers-and-punctuation",maxLength:10})}),(0,v.jsx)(i.default,{style:{flexBasis:130,flexGrow:1},children:(0,v.jsx)(h.Field,{label:"To (DD/MM/YYYY)",value:r,onChangeText:e=>d((0,t.slashDate)(e,r)),placeholder:"22/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10})}),(0,v.jsx)(h.Button,{small:!0,kind:"success",label:"Show",disabled:!u,onPress:()=>u&&e((0,f.customPeriod)(a,l))}),s&&r&&!u?(0,v.jsx)(h.T,{size:13,colour:b.colours.red,children:"Use two dates, the second on or after the first, up to 3 months apart."}):null]})}const _=[150,54,100,90,48,62,70]},1179,[827,1059,1174,34,1180,236,402,426,102,1182,1183,1184,794,831,891,867,1060,821,930,1187,1175,1084,1061,1185,872,1186,25]); __d(function(g,_r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ActionTile=function({label:e,sub:r,icon:c,onPress:u,primary:h,tone:b="gold",count:f,testID:x,accessibilityLabel:y}){const j='blue'===b?i.colours.blue:i.colours.gold;return(0,s.jsxs)(t.default,{testID:x,accessibilityRole:"button",accessibilityLabel:y??(r?`${e}, ${r}`:e),onPress:u,style:({pressed:e})=>({flex:1,minWidth:0,minHeight:68,borderRadius:16,borderWidth:1,borderColor:h?i.colours.accentBorder:i.colours.hairline,backgroundColor:e?i.colours.tilePressed:i.colours.tile,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:12,paddingHorizontal:14,paddingVertical:12}),children:[(0,s.jsx)(o.default,{style:{width:40,height:40,borderRadius:12,alignItems:'center',justifyContent:'center',backgroundColor:h?i.colours.accentBg:'rgba(255,255,255,0.04)',borderWidth:1,borderColor:h?i.colours.accentBorder:i.colours.hairline},children:(0,s.jsx)(l.Icon,{name:c,size:21,colour:j})}),(0,s.jsxs)(o.default,{style:{flexShrink:1,minWidth:0},children:[(0,s.jsx)(n.T,{size:15,weight:"semibold",numberOfLines:1,colour:i.colours.text,children:e}),r?(0,s.jsx)(n.T,{size:12,numberOfLines:1,colour:i.colours.muted,children:r}):null]}),f?(0,s.jsx)(o.default,{style:{backgroundColor:i.colours.amber,borderRadius:10,minWidth:22,paddingHorizontal:6},children:(0,s.jsx)(n.T,{size:12,weight:"bold",colour:i.colours.onGold,center:!0,children:f})}):null]})},_e.ActionGrid=function({children:e,testID:t="action-grid"}){const l=r.default.Children.toArray(e).filter(Boolean),i=[];for(let e=0;e(0,s.jsxs)(o.default,{style:{flexDirection:'row',gap:12},children:[e,1===e.length?(0,s.jsx)(o.default,{style:{flex:1}}):null]},r))})},Object.defineProperty(_e,"CardHeading",{enumerable:!0,get:function(){return c}});var r=e(_r(d[0])),t=e(_r(d[1])),o=e(_r(d[2])),l=_r(d[3]),i=_r(d[4]),n=_r(d[5]),s=_r(d[6]);const c=({children:e,right:r})=>(0,s.jsxs)(o.default,{style:{flexDirection:'row',alignItems:'center',justifyContent:'space-between'},children:[(0,s.jsx)(n.T,{size:12,weight:"semibold",colour:i.colours.goldMuted,style:{letterSpacing:1.6,textTransform:'uppercase'},children:e}),r]})},1180,[34,402,102,1181,821,794,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Icon=function({name:l,size:x=22,colour:t}){const n={stroke:t,strokeWidth:2,fill:'none',strokeLinecap:'round',strokeLinejoin:'round'};return(0,e.jsxs)(h.default,{width:x,height:x,viewBox:"0 0 24 24",children:['home'===l?(0,e.jsx)(s.Path,{d:"M3 11l9-7 9 7v9a1 1 0 0 1-1 1h-5v-6H9v6H4a1 1 0 0 1-1-1z",...n}):null,'signoff'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"11",r:"8",...n}),(0,e.jsx)(s.Path,{d:"M11 6.5V11l3 2",...n}),(0,e.jsx)(s.Path,{d:"M15.5 19.5l2 2 4-4.2",...n})]}):null,'orders'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"5",y:"3",width:"14",height:"18",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M9 8h6M9 12h6M9 16h4",...n})]}):null,'bookings'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4",...n})]}):null,'forecast'===l?(0,e.jsx)(s.Path,{d:"M4 20V10M10 20V4M16 20v-7M22 20H2",...n}):null,'more'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"5",cy:"12",r:"1.6",fill:t}),(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"1.6",fill:t}),(0,e.jsx)(s.Circle,{cx:"19",cy:"12",r:"1.6",fill:t})]}):null,'search'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"11",r:"7",...n}),(0,e.jsx)(s.Path,{d:"M20 20l-4-4",...n})]}):null,'bell'===l?(0,e.jsx)(s.Path,{d:"M6 16V11a6 6 0 0 1 12 0v5l2 2H4zM10 20a2 2 0 0 0 4 0",...n}):null,'chat'===l?(0,e.jsx)(s.Path,{d:"M4 5h16v11H9l-5 4z",...n}):null,'clock'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M12 7v5l3 2",...n})]}):null,'user'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"8",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M4 21a8 8 0 0 1 16 0",...n})]}):null,'walkin'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"13",cy:"4.5",r:"1.8",...n}),(0,e.jsx)(s.Path,{d:"M10 21l2-6 3 3v3M9 12l2-4 4 1 2 3M11 8l-1 5",...n})]}):null,'calendarPlus'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4M12 13v5M9.5 15.5h5",...n})]}):null,'pause'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M10 9v6M14 9v6",...n})]}):null,'rain'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M7 15a4 4 0 0 1-.6-7.95A5.5 5.5 0 0 1 17 7.5a3.75 3.75 0 0 1 .5 7.5z",...n}),(0,e.jsx)(s.Path,{d:"M9 18l-1 2.5M13 18l-1 2.5M17 18l-1 2.5",...n})]}):null,'sun'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M12 2v2M12 20v2M2 12h2M20 12h2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4",...n})]}):null,'payroll'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"4",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M7 9h6M7 13h4M15 12.5a2 2 0 1 0 0 .01M7 17h10",...n})]}):null,'tips'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M14.5 9a2.5 2.5 0 0 0-5 0c0 2.5 0 4-1.5 6h7M9 12.5h4",...n})]}):null,'sparkle'===l?(0,e.jsx)(s.Path,{d:"M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8zM19 16l.7 1.8 1.8.7-1.8.7L19 21l-.7-1.8-1.8-.7 1.8-.7z",...n}):null,'platter'===l?(0,e.jsx)(e.Fragment,{children:(0,e.jsx)(s.Path,{d:"M3 15h18M5 15a7 7 0 0 1 14 0M12 6v2M2 18h20",...n})}):null,'check'===l?(0,e.jsx)(s.Path,{d:"M5 12.5l4.5 4.5L19 7.5",...n}):null,'alert'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M12 3l9.5 17h-19z",...n}),(0,e.jsx)(s.Path,{d:"M12 10v4M12 17.2v.1",...n})]}):null,'access'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"4.5",r:"1.8",...n}),(0,e.jsx)(s.Path,{d:"M11 7.5v6h5l2.5 5M11 10h5M8 11.5a5.5 5.5 0 1 0 7.5 6.5",...n})]}):null,'dog'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 10l1-5 3 3h4l3-3 1 5v4a5 5 0 0 1-5 5h-2a5 5 0 0 1-5-5z",...n}),(0,e.jsx)(s.Path,{d:"M10 13v.1M14 13v.1M11 16h2",...n})]}):null,'leaf'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 19c0-8 5-14 15-14 0 10-6 15-14 15",...n}),(0,e.jsx)(s.Path,{d:"M5 19l8-8",...n})]}):null,'table'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"4",y:"8",width:"16",height:"8",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M8 16v4M16 16v4M8 4v4M16 4v4",...n})]}):null,'bag'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 8h14l-1 12H6z",...n}),(0,e.jsx)(s.Path,{d:"M9 10V7a3 3 0 0 1 6 0v3",...n})]}):null,'phone'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"7",y:"2.5",width:"10",height:"19",rx:"2.5",...n}),(0,e.jsx)(s.Path,{d:"M11 18.5h2",...n})]}):null,'swap'===l?(0,e.jsx)(s.Path,{d:"M7 4L3 8l4 4M3 8h14M17 20l4-4-4-4M21 16H7",...n}):null,'box'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M3.5 8L12 4l8.5 4v8L12 20l-8.5-4z",...n}),(0,e.jsx)(s.Path,{d:"M3.5 8L12 12l8.5-4M12 12v8",...n})]}):null,'star'===l?(0,e.jsx)(s.Path,{d:"M12 3.5l2.6 5.4 5.9.8-4.3 4.1 1 5.8L12 16.8l-5.2 2.8 1-5.8L3.5 9.7l5.9-.8z",...n}):null,'userPlus'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"10",cy:"8",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M3 21a7 7 0 0 1 14 0M19 8v6M16 11h6",...n})]}):null,'gift'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3.5",y:"8.5",width:"17",height:"4",rx:"1",...n}),(0,e.jsx)(s.Path,{d:"M5 12.5V20h14v-7.5M12 8.5V20M12 8.5C10 8.5 7.5 7.8 7.5 5.8S10.5 4 12 8.5c1.5-4.5 4.5-4.7 4.5-2.7S14 8.5 12 8.5z",...n})]}):null,'tag'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M3.5 12.5V4h8.5l8.5 8.5-8.5 8.5z",...n}),(0,e.jsx)(s.Circle,{cx:"8",cy:"8.5",r:"1.4",...n})]}):null,'hanger'===l?(0,e.jsx)(s.Path,{d:"M12 7.5a2 2 0 1 1 2-2M12 7.5v2L3 16.5h18L12 9.5",...n}):null]})},r(d[0]);var l,s=r(d[1]),h=(l=s)&&l.__esModule?l:{default:l},e=r(d[2])},1181,[34,797,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Icon=function({name:l,size:x=22,colour:t}){const n={stroke:t,strokeWidth:2,fill:'none',strokeLinecap:'round',strokeLinejoin:'round'};return(0,e.jsxs)(h.default,{width:x,height:x,viewBox:"0 0 24 24",children:['home'===l?(0,e.jsx)(s.Path,{d:"M3 11l9-7 9 7v9a1 1 0 0 1-1 1h-5v-6H9v6H4a1 1 0 0 1-1-1z",...n}):null,'signoff'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"11",r:"8",...n}),(0,e.jsx)(s.Path,{d:"M11 6.5V11l3 2",...n}),(0,e.jsx)(s.Path,{d:"M15.5 19.5l2 2 4-4.2",...n})]}):null,'orders'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"5",y:"3",width:"14",height:"18",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M9 8h6M9 12h6M9 16h4",...n})]}):null,'rota'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4M7 14h4M13 14h4M7 18h6",...n})]}):null,'bookings'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4",...n})]}):null,'forecast'===l?(0,e.jsx)(s.Path,{d:"M4 20V10M10 20V4M16 20v-7M22 20H2",...n}):null,'more'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"5",cy:"12",r:"1.6",fill:t}),(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"1.6",fill:t}),(0,e.jsx)(s.Circle,{cx:"19",cy:"12",r:"1.6",fill:t})]}):null,'search'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"11",r:"7",...n}),(0,e.jsx)(s.Path,{d:"M20 20l-4-4",...n})]}):null,'bell'===l?(0,e.jsx)(s.Path,{d:"M6 16V11a6 6 0 0 1 12 0v5l2 2H4zM10 20a2 2 0 0 0 4 0",...n}):null,'chat'===l?(0,e.jsx)(s.Path,{d:"M4 5h16v11H9l-5 4z",...n}):null,'clock'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M12 7v5l3 2",...n})]}):null,'user'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"8",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M4 21a8 8 0 0 1 16 0",...n})]}):null,'walkin'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"13",cy:"4.5",r:"1.8",...n}),(0,e.jsx)(s.Path,{d:"M10 21l2-6 3 3v3M9 12l2-4 4 1 2 3M11 8l-1 5",...n})]}):null,'calendarPlus'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4M12 13v5M9.5 15.5h5",...n})]}):null,'pause'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M10 9v6M14 9v6",...n})]}):null,'rain'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M7 15a4 4 0 0 1-.6-7.95A5.5 5.5 0 0 1 17 7.5a3.75 3.75 0 0 1 .5 7.5z",...n}),(0,e.jsx)(s.Path,{d:"M9 18l-1 2.5M13 18l-1 2.5M17 18l-1 2.5",...n})]}):null,'sun'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M12 2v2M12 20v2M2 12h2M20 12h2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4",...n})]}):null,'payroll'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"4",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M7 9h6M7 13h4M15 12.5a2 2 0 1 0 0 .01M7 17h10",...n})]}):null,'tips'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M14.5 9a2.5 2.5 0 0 0-5 0c0 2.5 0 4-1.5 6h7M9 12.5h4",...n})]}):null,'sparkle'===l?(0,e.jsx)(s.Path,{d:"M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8zM19 16l.7 1.8 1.8.7-1.8.7L19 21l-.7-1.8-1.8-.7 1.8-.7z",...n}):null,'platter'===l?(0,e.jsx)(e.Fragment,{children:(0,e.jsx)(s.Path,{d:"M3 15h18M5 15a7 7 0 0 1 14 0M12 6v2M2 18h20",...n})}):null,'check'===l?(0,e.jsx)(s.Path,{d:"M5 12.5l4.5 4.5L19 7.5",...n}):null,'alert'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M12 3l9.5 17h-19z",...n}),(0,e.jsx)(s.Path,{d:"M12 10v4M12 17.2v.1",...n})]}):null,'access'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"4.5",r:"1.8",...n}),(0,e.jsx)(s.Path,{d:"M11 7.5v6h5l2.5 5M11 10h5M8 11.5a5.5 5.5 0 1 0 7.5 6.5",...n})]}):null,'dog'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 10l1-5 3 3h4l3-3 1 5v4a5 5 0 0 1-5 5h-2a5 5 0 0 1-5-5z",...n}),(0,e.jsx)(s.Path,{d:"M10 13v.1M14 13v.1M11 16h2",...n})]}):null,'leaf'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 19c0-8 5-14 15-14 0 10-6 15-14 15",...n}),(0,e.jsx)(s.Path,{d:"M5 19l8-8",...n})]}):null,'table'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"4",y:"8",width:"16",height:"8",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M8 16v4M16 16v4M8 4v4M16 4v4",...n})]}):null,'bag'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 8h14l-1 12H6z",...n}),(0,e.jsx)(s.Path,{d:"M9 10V7a3 3 0 0 1 6 0v3",...n})]}):null,'phone'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"7",y:"2.5",width:"10",height:"19",rx:"2.5",...n}),(0,e.jsx)(s.Path,{d:"M11 18.5h2",...n})]}):null,'swap'===l?(0,e.jsx)(s.Path,{d:"M7 4L3 8l4 4M3 8h14M17 20l4-4-4-4M21 16H7",...n}):null,'box'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M3.5 8L12 4l8.5 4v8L12 20l-8.5-4z",...n}),(0,e.jsx)(s.Path,{d:"M3.5 8L12 12l8.5-4M12 12v8",...n})]}):null,'star'===l?(0,e.jsx)(s.Path,{d:"M12 3.5l2.6 5.4 5.9.8-4.3 4.1 1 5.8L12 16.8l-5.2 2.8 1-5.8L3.5 9.7l5.9-.8z",...n}):null,'userPlus'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"10",cy:"8",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M3 21a7 7 0 0 1 14 0M19 8v6M16 11h6",...n})]}):null,'gift'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3.5",y:"8.5",width:"17",height:"4",rx:"1",...n}),(0,e.jsx)(s.Path,{d:"M5 12.5V20h14v-7.5M12 8.5V20M12 8.5C10 8.5 7.5 7.8 7.5 5.8S10.5 4 12 8.5c1.5-4.5 4.5-4.7 4.5-2.7S14 8.5 12 8.5z",...n})]}):null,'tag'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M3.5 12.5V4h8.5l8.5 8.5-8.5 8.5z",...n}),(0,e.jsx)(s.Circle,{cx:"8",cy:"8.5",r:"1.4",...n})]}):null,'hanger'===l?(0,e.jsx)(s.Path,{d:"M12 7.5a2 2 0 1 1 2-2M12 7.5v2L3 16.5h18L12 9.5",...n}):null]})},r(d[0]);var l,s=r(d[1]),h=(l=s)&&l.__esModule?l:{default:l},e=r(d[2])},1181,[34,797,25]); __d(function(_g,_r,i,_a,_m,e,d){"use strict";function t(t){const n=Math.max(0,Math.round(t||0)),o=Math.floor(n/60),r=n%60;return o?`${o}h ${String(r).padStart(2,'0')}m`:`${r}m`}function n(t){const n=Math.max(0,Math.round(t||0)),o=Math.floor(n/60),r=n%60;return[o?`${o} ${1===o?'hour':'hours'}`:'',r||!o?`${r} ${1===r?'minute':'minutes'}`:''].filter(Boolean).join(' ')}Object.defineProperty(e,'__esModule',{value:!0}),e.durText=t,e.durWords=n,e.isZeroShift=function(t){return!(!t.in||!t.out)&&Date.parse(t.out)-Date.parse(t.in)<6e4},Object.defineProperty(e,"isVoided",{enumerable:!0,get:function(){return o}}),e.shiftSentence=function(t,o){if('On now'===t.status)return`${o}, clocked in at ${t.inT}, still on shift.`;const r=t.zero?' Check: 0 minutes, clocked in and out at the same moment.':'';return`${o}, ${t.inT} to ${t.outT}, break ${n(t.brk)}, paid ${n(t.paid)}, ${'Approved'===t.status?'approved':'pending approval'}.${r}`},e.hoursSummary=function(n,o,r){const u=t=>null!=r?Math.round(t/60*r):null;return{approved:{mins:n,text:t(n),gross:u(n)},pending:{mins:o,text:t(o),gross:u(o)}}};const o=t=>!!t.voided},1182,[]); __d(function(g,r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ShiftCard=function({d:e,manager:t,onApprove:s,onEdit:d,onRemove:l}){const a='Confirmed'===e.status?'Approved':e.status,y=(0,u.isZeroShift)(e.a),x={date:e.date,dateText:b(e.date),inT:e.inT,outT:e.outT,brk:e.brk,paid:e.paid,status:a,zero:y};return(0,h.jsxs)(n.default,{testID:`shift-${e.a.id}`,style:{borderRadius:14,borderWidth:1,borderColor:y?c.colours.amber:'rgba(212,175,106,0.35)',backgroundColor:'#15130F',padding:12,gap:8,alignItems:'center'},children:[(0,h.jsxs)(n.default,{accessible:!0,accessibilityLabel:(0,u.shiftSentence)(x,p(e.date)),style:{alignItems:'center',gap:4,width:'100%'},children:[(0,h.jsx)(o.T,{size:16,weight:"bold",colour:c.colours.goldLight,center:!0,children:b(e.date)}),(0,h.jsx)(o.T,{size:17,weight:"semibold",center:!0,children:'On now'===e.status?`${e.inT} to now`:`${e.inT} to ${e.outT}`}),'On now'!==e.status?(0,h.jsxs)(o.T,{size:15,colour:c.colours.text,center:!0,children:["Break ",(0,u.durText)(e.brk)," \xb7 Paid ",(0,h.jsx)(o.T,{size:15,weight:"bold",colour:c.colours.gold,children:(0,u.durText)(e.paid)})]}):null,(0,h.jsx)(o.Badge,{kind:'Approved'===a?'ok':'Pending'===a?'amber':'neutral',label:'Pending'===a?'Pending approval':a}),y?(0,h.jsx)(n.default,{testID:`shift-zero-${e.a.id}`,style:{borderRadius:8,borderWidth:1,borderColor:c.colours.amber,paddingHorizontal:10,paddingVertical:4},children:(0,h.jsx)(o.T,{size:14,weight:"bold",colour:c.colours.amber,center:!0,children:"Check: 0 minutes"})}):null,e.a.added&&e.a.signOff?(0,h.jsxs)(o.Muted,{center:!0,testID:`shift-entered-${e.a.id}`,children:["Entered by ",e.a.signOff.by]}):null]}),t?(0,h.jsxs)(o.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:['Pending'===e.status&&!y&&s?(0,h.jsx)(o.Button,{label:"Approve",testID:`shift-approve-${e.a.id}`,accessibilityLabel:`Approve ${p(e.date)}, paid ${(0,u.durWords)(e.paid)}`,onPress:s,style:{minHeight:48,minWidth:120}}):null,(y||'Pending'===e.status)&&d?(0,h.jsx)(o.Button,{kind:"secondary",label:"Edit",testID:`shift-edit-${e.a.id}`,accessibilityLabel:`Edit the shift on ${p(e.date)}`,onPress:d,style:{minHeight:48,minWidth:96}}):null,y&&'Confirmed'!==e.status&&l?(0,h.jsx)(o.Button,{kind:"secondary",label:"Remove",testID:`shift-remove-${e.a.id}`,accessibilityLabel:`Remove the 0-minute shift on ${p(e.date)}. It is kept in the history.`,onPress:l,style:{minHeight:48,minWidth:96}}):null]}):null]})},_e.HoursSummaryCard=function({name:e,role:t,approved:s,pending:d,rate:l}){const p=(0,u.hoursSummary)(s,d,l),b=`${e}. Approved ${(0,u.durWords)(s)}${null!=p.approved.gross?`, ${(0,a.gbp)(p.approved.gross)}`:''}. Pending approval ${(0,u.durWords)(d)}${null!=p.pending.gross?`, ${(0,a.gbp)(p.pending.gross)} once approved`:''}.${null!=l?` Rate ${(0,a.gbp)(l)} an hour.`:''}`;return(0,h.jsxs)(n.default,{accessible:!0,accessibilityLabel:b,testID:"hours-summary-card",style:{alignItems:'center',gap:6,width:'100%'},children:[(0,h.jsx)(o.T,{size:18,weight:"bold",center:!0,children:e}),t?(0,h.jsx)(o.Muted,{center:!0,children:t}):null,(0,h.jsxs)(o.Row,{wrap:!0,gap:10,style:{justifyContent:'center'},children:[(0,h.jsxs)(n.default,{style:{minWidth:150,borderRadius:12,borderWidth:1,borderColor:c.colours.ok,padding:10,alignItems:'center'},children:[(0,h.jsx)(o.T,{size:13,weight:"semibold",colour:c.colours.ok,children:"APPROVED"}),(0,h.jsx)(o.T,{size:20,weight:"bold",testID:"sum-approved",children:p.approved.text}),(0,h.jsx)(o.Muted,{children:null!=p.approved.gross?`${(0,a.gbp)(p.approved.gross)} gross`:'no rate'})]}),(0,h.jsxs)(n.default,{style:{minWidth:150,borderRadius:12,borderWidth:1,borderColor:c.colours.amber,padding:10,alignItems:'center'},children:[(0,h.jsx)(o.T,{size:13,weight:"semibold",colour:c.colours.amber,children:"PENDING"}),(0,h.jsx)(o.T,{size:20,weight:"bold",testID:"sum-pending",children:p.pending.text}),(0,h.jsx)(o.Muted,{children:null!=p.pending.gross?`${(0,a.gbp)(p.pending.gross)} once approved`:'no rate'})]})]}),null!=l?(0,h.jsxs)(o.Muted,{center:!0,children:["Rate ",(0,a.gbp)(l)," an hour",(y=null,null==y?'':` \xb7 ${(0,a.gbp)(y)}`)]}):null]});var y},_e.RemoveShiftSheet=function({a:e,who:s,onClose:n}){const[a,u]=(0,t.useState)('Clocked in and out by mistake (0 minutes)'),p=a.trim().length>=3;return(0,h.jsxs)(o.Sheet,{visible:!0,onClose:n,title:`Remove the shift on ${b(e.date)}?`,maxWidth:520,testID:"remove-shift",children:[(0,h.jsx)(o.T,{size:16,center:!0,children:"It comes out of hours, pay and exports. It isn\u2019t deleted: it stays in the history with your name and the reason."}),(0,h.jsx)(d.TextInput,{accessibilityLabel:"Reason for removing the shift",value:a,onChangeText:u,style:{minHeight:48,borderRadius:10,borderWidth:1,borderColor:c.colours.gold,color:c.colours.text,paddingHorizontal:12}}),(0,h.jsxs)(o.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,h.jsx)(o.Button,{label:"Remove shift",testID:"remove-shift-yes",disabled:!p,onPress:()=>{l.useOwner.getState().voidEntry(e.id,s.name,s.id,a.trim(),(new Date).toISOString()),n()},style:{minHeight:56}}),(0,h.jsx)(o.Button,{kind:"secondary",label:"Keep it",onPress:n,style:{minHeight:56}})]})]})};var e,t=r(_d[0]),s=r(_d[1]),n=(e=s)&&e.__esModule?e:{default:e},o=r(_d[2]),d=r(_d[3]),l=r(_d[4]),a=r(_d[5]),u=r(_d[6]),c=r(_d[7]),h=r(_d[8]);const p=e=>new Date(`${e}T12:00:00Z`).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long',timeZone:'UTC'}),b=e=>new Date(`${e}T12:00:00Z`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',timeZone:'UTC'})},1183,[34,102,794,827,891,867,1182,821,25]); __d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"REASONS",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"isoAt",{enumerable:!0,get:function(){return S}}),_e.flagsFor=D,_e.notesFor=$,Object.defineProperty(_e,"statusLabel",{enumerable:!0,get:function(){return M}}),Object.defineProperty(_e,"statusKind",{enumerable:!0,get:function(){return O}}),_e.AuditTrail=B,_e.TimeEdit=R,_e.OverrideSheet=A,_e.outstandingDays=P,_e.useOutstanding=function(){const e=(0,r.useOwner)(e=>(0,r.liveAttendance)(e.attendance)),t=(0,r.useOwner)(e=>e.timeRequests),n=(0,u.ymd)(new Date);return(0,s.useMemo)(()=>({days:P(e,n),requests:t.filter(e=>'open'===e.status).length}),[e,t,n])},_e.SignOff=function(){const{now:e,today:t,me:n,meId:m}=(0,h.useCtx)(3e4),p=(0,r.useOwner)(e=>e.staff),x=(0,r.useOwner)(e=>(0,r.liveAttendance)(e.attendance)),j=(0,r.useOwner)(e=>e.shifts),k=(0,r.useOwner)(e=>e.timeRequests),w=(0,r.useOwner)(e=>e.leave),S=(0,s.useMemo)(()=>P(x,t),[x,t]),[I,T]=(0,s.useState)(t),[B,R]=(0,s.useState)(null),[q,z]=(0,s.useState)(null),H=(0,s.useMemo)(()=>{const n=x.filter(e=>e.date===I&&e.in),s=n.map(n=>{const s=(0,r.shiftOf)(j,n.staffId,I);return{key:n.id,staffId:n.staffId,a:n,sh:s,flags:D(n,s,e,t,k)}});j.filter(e=>e.date===I&&!1!==e.published&&!n.some(t=>t.staffId===e.staffId)).forEach(n=>{const o=(0,d.leaveCovering)(w,n.staffId,I);if(o)return void(s.some(e=>e.leave&&e.staffId===n.staffId)||s.push({key:`leave-${n.id}`,staffId:n.staffId,sh:n,flags:[],leave:o}));(I60*n.start+15)&&s.push({key:`miss-${n.id}`,staffId:n.staffId,sh:n,flags:[{key:'noin',label:'No clock-in'}]})});const o=e=>e.leave?4:e.a?'confirmed'===(0,r.attStatus)(e.a)?3:e.flags.length?0:2:1;return s.sort((e,t)=>o(e)-o(t)||(p.find(t=>t.id===e.staffId)?.name??'').localeCompare(p.find(e=>e.id===t.staffId)?.name??''))},[x,j,k,w,I,e.getMinutes(),p]),N=k.filter(e=>'open'===e.status&&e.date===I),F=k.filter(e=>'open'===e.status&&e.date!==I),E=H.filter(e=>e.a&&'awaiting'===(0,r.attStatus)(e.a)&&!e.flags.length),_=H.reduce((t,n)=>{if(!n.a)return t;const s=(0,h.paidMins)(n.a,e).paid;return'confirmed'===(0,r.attStatus)(n.a)?t.conf+=s:t.pend+=s,t},{conf:0,pend:0}),Y={confirmed:H.filter(e=>e.a&&'confirmed'===(0,r.attStatus)(e.a)).length,awaiting:H.filter(e=>e.a&&'awaiting'===(0,r.attStatus)(e.a)).length,open:H.filter(e=>e.a&&'open'===(0,r.attStatus)(e.a)).length,flagged:H.filter(e=>e.flags.length&&!(e.a&&'confirmed'===(0,r.attStatus)(e.a))).length,off:H.filter(e=>e.leave).length},L=[t,...S.map(e=>e.date).filter(e=>e!==t)];for(let e=1;L.length<8&&e<=7;e++){const n=v(t,-e);L.includes(n)||L.push(n)}const W=t=>{const s=r.useOwner.getState().confirmEntries(t,n,m,e.toISOString());z(s?`${s} ${1===s?'entry':'entries'} confirmed`:null)};return(0,b.jsxs)(a.default,{style:{gap:10},testID:"signoff",children:[S.filter(e=>e.date!==I).length?(0,b.jsx)(o.default,{accessibilityRole:"button",onPress:()=>T(S.filter(e=>e.date!==I)[S.filter(e=>e.date!==I).length-1].date),children:(0,b.jsx)(l.Banner,{kind:"warn",title:`${S.filter(e=>e.date!==I).length} earlier ${1===S.filter(e=>e.date!==I).length?'day':'days'} still to sign off`,children:"Hours only count for pay once they\u2019re confirmed. Tap to open the oldest."})}):null,(0,b.jsx)(l.Row,{wrap:!0,gap:6,children:L.slice(0,10).sort((e,t)=>t.localeCompare(e)).map(e=>{const n=S.find(t=>t.date===e);return(0,b.jsx)(l.Chip,{label:C(e,t),sub:n?`${n.n} to sign off`:void 0,selected:I===e,onPress:()=>{T(e),z(null)}},e)})}),(0,b.jsx)(l.Card,{children:(0,b.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,b.jsxs)(a.default,{style:{flex:1},children:[(0,b.jsxs)(l.T,{size:18,weight:"bold",children:[C(I,t),I===t||I===v(t,-1)?` \xb7 ${(0,u.niceDate)((0,u.parseYmd)(I))}`:'']}),(0,b.jsxs)(l.Muted,{children:[Y.confirmed," confirmed \xb7 ",Y.awaiting," awaiting \xb7 ",Y.open," still clocked in",Y.flagged?` \xb7 ${Y.flagged} flagged`:'',Y.off?` \xb7 ${Y.off} on time off`:'']})]}),(0,b.jsxs)(a.default,{style:{alignItems:'flex-end'},children:[(0,b.jsx)(l.T,{size:18,weight:"bold",colour:c.colours.ok,children:(0,h.hmDur)(_.conf)}),(0,b.jsx)(l.Muted,{children:"confirmed"}),_.pend?(0,b.jsxs)(l.T,{size:13,colour:c.colours.amber,children:[(0,h.hmDur)(_.pend)," pending"]}):null]})]})}),q?(0,b.jsx)(l.Banner,{kind:"success",title:q}):null,N.length||F.length?(0,b.jsx)(f.SectionHead,{title:"Correction requests",sub:"From the Staff app. Apply opens the times to check; declining keeps the times as clocked."}):null,[...N,...F].map(t=>{const s=p.find(e=>e.id===t.staffId),o=t.attendanceId&&x.find(e=>e.id===t.attendanceId)||x.find(e=>e.staffId===t.staffId&&e.date===t.date&&e.in);return(0,b.jsxs)(l.Card,{highlight:c.colours.blue,children:[(0,b.jsxs)(l.Row,{gap:8,children:[(0,b.jsx)(i.StaffAvatar,{id:t.staffId,size:30}),(0,b.jsxs)(a.default,{style:{flex:1},children:[(0,b.jsxs)(l.T,{weight:"semibold",children:[y(s?.name)," \xb7 ",(0,u.niceDate)((0,u.parseYmd)(t.date))]}),(0,b.jsxs)(l.Muted,{children:['in'===t.kind?'Forgot to clock in':'out'===t.kind?'Forgot to clock out':'Forgot to clock in and out',t.suggestedIn?` \xb7 in ${(0,u.hm)(new Date(t.suggestedIn))}`:'',t.suggestedOut?` \xb7 out ${(0,u.hm)(new Date(t.suggestedOut))}`:'',t.note?` \xb7 \u201c${t.note}\u201d`:'']})]}),(0,b.jsx)(l.Badge,{kind:"blue",label:"Request"})]}),(0,b.jsxs)(l.Row,{gap:6,children:[(0,b.jsx)(l.Button,{small:!0,kind:"success",label:"Review & apply",onPress:()=>R({staffId:t.staffId,a:o,request:t})}),(0,b.jsx)(l.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>r.useOwner.getState().resolveTimeRequest(t.id,'declined',n,e.toISOString())})]})]},t.id)}),(0,b.jsx)(f.SectionHead,{title:"Hours",sub:"Rostered vs actual. Flagged rows need a look and are confirmed one by one."}),H.map(t=>{const n=p.find(e=>e.id===t.staffId),s=t.a,o=s?(0,h.paidMins)(s,e):null,f=s?(0,r.attStatus)(s):null,m=s?.audit?.filter(e=>'confirmed'!==e.action).slice(-1)[0];return(0,b.jsx)(l.Card,{highlight:t.leave?c.colours.blue:'confirmed'===f?c.colours.ok:t.flags.length?c.colours.amber:void 0,children:(0,b.jsxs)(a.default,{testID:`so-row-${t.staffId}`,style:{gap:8},children:[(0,b.jsxs)(l.Row,{gap:10,children:[(0,b.jsx)(i.StaffAvatar,{id:t.staffId,size:36}),(0,b.jsxs)(a.default,{style:{flex:1},children:[(0,b.jsx)(l.T,{weight:"semibold",children:y(n?.name)}),(0,b.jsx)(l.Muted,{children:[n?.job,...$(s,n?.temp)].filter(Boolean).join(' \xb7 ')})]}),n?.temp||s?.temp?(0,b.jsx)(l.Badge,{kind:"gold",label:"Temp"}):null,s?(0,b.jsx)(l.Badge,{kind:O(s),label:M(s)}):t.leave?(0,b.jsx)(l.Badge,{kind:"blue",label:(0,d.leaveLabel)(t.leave)}):(0,b.jsx)(l.Badge,{kind:"red",label:"Missing"})]}),(0,b.jsx)(l.Row,{gap:0,style:{flexWrap:'wrap',rowGap:6},children:[['Rota',t.sh?`${(0,h.fmtH)(t.sh.start)}\u2013${(0,h.fmtH)(t.sh.end)}`:'\u2014'],['Actual',s?.in?`${(0,u.hm)(new Date(s.in))}\u2013${s.out?(0,u.hm)(new Date(s.out)):'on'}`:t.leave?(0,d.leaveLabel)(t.leave):'no clock-in'],['Break',s?.out?`${o.brk}m`:s?`${s.breakMins??0}m so far`:'\u2014'],['Paid',s?s.out?(0,h.hmDur)(o.paid):`${(0,h.hmDur)(o.worked)}\u2026`:'\u2014']].map(([e,t])=>(0,b.jsxs)(a.default,{style:{minWidth:92,flexGrow:1},children:[(0,b.jsx)(l.T,{size:11,colour:c.colours.muted,children:e.toUpperCase()}),(0,b.jsx)(l.T,{size:15,weight:"semibold",colour:'Paid'===e&&'confirmed'===f?c.colours.ok:c.colours.text,children:t})]},e))}),t.flags.length&&'confirmed'!==f?(0,b.jsx)(l.Row,{wrap:!0,gap:6,children:t.flags.map(e=>(0,b.jsx)(l.Badge,{kind:'noin'===e.key||'noout'===e.key?'red':'amber',label:e.label},e.key))}):null,t.leave?(0,b.jsxs)(l.Muted,{testID:`so-leave-${t.staffId}`,children:[(0,d.leaveNote)(t.leave),". Rota shift covered by leave: no hours counted."]}):null,m?(0,b.jsxs)(l.Muted,{children:["Adjusted by ",y(m.by),m.reason?`: ${m.reason}`:'']}):null,s?.signOff?(0,b.jsxs)(l.Muted,{children:["Confirmed by ",y(s.signOff.by)," \xb7 ",(0,u.niceDate)(new Date(s.signOff.at))," ",(0,u.hm)(new Date(s.signOff.at))]}):null,(0,b.jsxs)(l.Row,{gap:8,children:[(0,b.jsx)(l.Button,{small:!0,kind:"secondary",label:s?'Edit':'Add entry',accessibilityLabel:`${s?'Edit':'Add entry for'} ${y(n?.name)}`,onPress:()=>R({staffId:t.staffId,a:s})}),s&&'awaiting'===f?(0,b.jsx)(l.Button,{small:!0,kind:"success",label:"Confirm",accessibilityLabel:`Confirm ${y(n?.name)}`,onPress:()=>W([s.id])}):null,s&&'open'===f?(0,b.jsx)(l.Muted,{style:{alignSelf:'center'},children:"Needs a clock-out before it can be confirmed"}):null]})]})},t.key)}),H.length?null:(0,b.jsx)(l.Card,{children:(0,b.jsx)(l.Muted,{children:"No clock records or rostered shifts for this day."})}),H.length?(0,b.jsx)(l.Button,{testID:"confirm-unflagged",kind:"success",label:E.length?`Confirm all unflagged (${E.length})`:'Nothing unflagged to confirm',disabled:!E.length,onPress:()=>W(E.map(e=>e.a.id))}):null,(0,b.jsx)(l.Muted,{children:"Flags: no clock-out, 30 min or more off the rota, over 12 hours, no break on a shift over 6 hours, not on the rota, off-site, or a correction request. Editing a confirmed entry puts it back to Awaiting sign-off. Only confirmed hours count for pay, tips and exports."}),B?(0,b.jsx)(A,{a:B.a,staffId:B.staffId,date:B.request?.date??B.a?.date??I,request:B.request,onClose:()=>R(null)}):null]})};var t=_r(_d[0]),n=_r(_d[1]),s=_r(_d[2]),o=e(_r(_d[3])),a=e(_r(_d[4])),l=_r(_d[5]),i=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),f=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),p=_r(_d[14]),x=_r(_d[15]),b=_r(_d[16]);const j=['Forgot to clock in','Forgot to clock out','Wrong time'],k=[0,15,20,30,45,60],y=e=>(e??'').replace(' (example)',''),w=e=>{const t=new Date(e);return 60*t.getHours()+t.getMinutes()},S=(e,t)=>{const n=(0,u.parseYmd)(e);return n.setMinutes(t),n.toISOString()},I=e=>{const t=(e%1440+1440)%1440;return`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`},v=(e,t)=>{const n=(0,u.parseYmd)(e);return n.setDate(n.getDate()+t),(0,u.ymd)(n)},C=(e,t)=>e===t?'Today':e===v(t,-1)?'Yesterday':(0,u.niceDate)((0,u.parseYmd)(e));function D(e,t,s,o,a=[]){const l=[],i=(0,h.paidMins)(e,s),r=60*s.getHours()+s.getMinutes();if(!e.out&&(e.date60*t.end+60||i.worked>840)&&l.push({key:'noout',label:'No clock-out'}),t&&e.in){const n=w(e.in)-Math.round(60*t.start),s=e.out?w(e.out)+(e.out.slice(0,10)!==e.in.slice(0,10)&&w(e.out)=30&&l.push({key:'diff',label:`${a>=60?(0,h.hmDur)(a):`${a}m`} off the rota`})}return(0,n.isZeroShift)(e)&&l.push({key:'zero',label:'Check: 0 minutes'}),t||l.push({key:'unrostered',label:'Not on the rota'}),i.worked>720&&l.push({key:'long',label:`Very long shift (${(0,h.hmDur)(i.worked)})`}),e.out&&i.worked>360&&0===i.brk&&l.push({key:'nobreak',label:'No break (over 6h)'}),!1!==e.inSite&&!1!==e.outSite||l.push({key:'offsite',label:'Clocked off-site'}),a.some(t=>'open'===t.status&&t.staffId===e.staffId&&t.date===e.date)&&l.push({key:'request',label:'Correction requested'}),e.breakAddedAtClockOut&&l.push({key:'breakadded',label:`Break added at clock-out (${e.breakAddedAtClockOut}m)`}),e.offRota&&t&&l.push({key:'offrota',label:'Signed in off rota'}),l}function $(e,t){const n=[];return(t||e?.temp)&&n.push('Temp'),'display'!==e?.via&&'display'!==e?.outVia||n.push('via Display'),'rota'===e?.auto&&n.push(e.autoNote?`Auto from rota \xb7 ${e.autoNote}`:'Auto from rota'),n}const M=e=>{const t=(0,r.attStatus)(e);return'open'===t?'Open':'awaiting'===t?e.adjusted?'Adjusted \xb7 awaiting sign-off':'Awaiting sign-off':e.adjusted?'Confirmed \xb7 adjusted':'Confirmed'},O=e=>{const t=(0,r.attStatus)(e);return'confirmed'===t?'ok':'open'===t?'blue':'amber'},T={added:'Added entry',clock_in:'Clock-in',clock_out:'Clock-out',break:'Break',confirmed:'Confirmed',reopened:'Reopened',request_applied:'Correction request applied',request_declined:'Correction request declined',voided:'Removed (kept in history)'};function B({a:e,limit:t}){const n=[...e.audit??[]].reverse().slice(0,t??50);return n.length?(0,b.jsx)(a.default,{style:{gap:6},testID:"audit-trail",children:n.map((e,t)=>(0,b.jsxs)(a.default,{style:{flexDirection:'row',gap:8},children:[(0,b.jsx)(a.default,{style:{width:3,borderRadius:2,backgroundColor:'confirmed'===e.action?c.colours.ok:'reopened'===e.action?c.colours.amber:c.colours.gold}}),(0,b.jsxs)(a.default,{style:{flex:1},children:[(0,b.jsxs)(l.T,{size:13,weight:"semibold",children:[T[e.action],e.from||e.to?`: ${e.from??'\u2013'} \u2192 ${e.to??'\u2013'}`:'']}),(0,b.jsxs)(l.Muted,{children:[y(e.by)," \xb7 ",(0,u.niceDate)(new Date(e.at))," ",(0,u.hm)(new Date(e.at)),e.reason?` \xb7 \u201c${e.reason}\u201d`:'']})]})]},t))}):(0,b.jsx)(l.Muted,{children:"No changes yet. Times are as clocked."})}function R({label:e,mins:n,onChange:o,testID:i}){const[r,d]=(0,s.useState)(null),u=e=>{const t=/^(\d{1,2})[:.]?(\d{2})$/.exec(e.trim());t&&+t[1]<24&&+t[2]<60&&o(60*+t[1]+ +t[2]+(n>=1440&&60*+t[1]+ +t[2]<360?1440:0)),d(null)};return(0,b.jsxs)(a.default,{style:{gap:6},children:[(0,b.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(l.T,{size:13,colour:c.colours.muted,children:e}),n>=1440?(0,b.jsx)(l.Muted,{children:"next day"}):null]}),(0,b.jsxs)(l.Row,{gap:6,children:[(0,b.jsx)(l.Button,{small:!0,kind:"ghost",label:"\u221215",onPress:()=>o(n-15)}),(0,b.jsx)(l.Button,{small:!0,kind:"ghost",label:"\u22125",onPress:()=>o(n-5)}),(0,b.jsx)(t.TextInput,{testID:i,accessibilityLabel:e,value:r??I(n),onChangeText:d,onBlur:()=>null!=r&&u(r),onSubmitEditing:()=>null!=r&&u(r),style:[l.styles.input,{flex:1,textAlign:'center',fontSize:22,fontWeight:'700',paddingVertical:6,color:c.colours.text}]}),(0,b.jsx)(l.Button,{small:!0,kind:"ghost",label:"+5",onPress:()=>o(n+5)}),(0,b.jsx)(l.Button,{small:!0,kind:"ghost",label:"+15",onPress:()=>o(n+15)})]})]})}function A({a:e,staffId:t,date:n,request:o,onClose:i}){const{me:d,meId:I,now:v,role:C}=(0,h.useCtx)(3e4),[D,$]=(0,s.useState)(!1),T=!!e&&(0,m.canSeeHoursEdit)({role:C,isCar:p.IS_CAR}),A=(0,r.useOwner)(e=>e.staff.find(e=>e.id===t)?.name),P=(0,r.useOwner)(e=>e.shifts),q=(0,r.shiftOf)(P,t,n),z=o?.suggestedIn?w(o.suggestedIn):e?.in?Math.round((new Date(e.in).getTime()-(0,u.parseYmd)(n).getTime())/6e4):q?Math.round(60*q.start):720,H=o?.suggestedOut??e?.out,N=H?(F=H,Math.round((new Date(F).getTime()-(0,u.parseYmd)(n).getTime())/6e4)):e&&e.in&&!e.out?null:q?Math.round(60*q.end):z+480;var F;const[E,_]=(0,s.useState)(z),[Y,L]=(0,s.useState)(N),[W,V]=(0,s.useState)(e?.breakMins??(q&&q.end-q.start>6?30:0)),[G,K]=(0,s.useState)(o?'out'===o.kind?j[1]:j[0]:e?e.in&&!e.out?j[1]:null:j[0]),[U,Z]=(0,s.useState)(''),[J,Q]=(0,s.useState)(null),X=[G,U.trim()].filter(Boolean).join(': ')+(o&&o.note?` (request: ${o.note})`:''),ee=null!=Y?Y-E:0,te=e?(0,h.paidMins)(e,v):null,ne=null!=Y?Math.max(0,ee-W):null,se=e&&'confirmed'===(0,r.attStatus)(e),oe=null!=Y&&Y<=E?'Clock-out must be after clock-in.':ee>1200?'A shift can\u2019t be longer than 20 hours.':null!=Y&&W>=ee?'The break is longer than the shift.':null,ae=e?.in&&!o&&E===z?e.in:S(n,E),le=null==Y?void 0:e?.out&&!o&&Y===N?e.out:S(n,Y),ie=!e||ae!==e.in||(le??'')!==(e.out??'')||(e.breakMins??0)!==W;return(0,b.jsxs)(l.Sheet,{visible:!0,onClose:i,title:`${e?'Edit hours':'Add missing entry'} \xb7 ${y(A)} \xb7 ${(0,u.niceDate)((0,u.parseYmd)(n))}`,testID:"override-sheet",children:[(0,b.jsxs)(l.Row,{gap:8,style:{flexWrap:'wrap'},children:[e?(0,b.jsx)(l.Badge,{kind:O(e),label:M(e)}):(0,b.jsx)(l.Badge,{kind:"red",label:"No clock record"}),q?(0,b.jsx)(l.Badge,{kind:"neutral",label:`Rota ${(0,h.fmtH)(q.start)}\u2013${(0,h.fmtH)(q.end)}`}):(0,b.jsx)(l.Badge,{kind:"neutral",label:"Not on the rota"}),e?.in?(0,b.jsx)(l.Badge,{kind:"neutral",label:`Clocked ${(0,u.hm)(new Date(e.in))}\u2013${e.out?(0,u.hm)(new Date(e.out)):'still on'}`}):null]}),o?(0,b.jsxs)(l.Banner,{kind:"info",title:`${y(A)} asked for a correction`,children:['in'===o.kind?'Forgot to clock in':'out'===o.kind?'Forgot to clock out':'Forgot to clock in and out',o.suggestedIn?` \xb7 in ${(0,u.hm)(new Date(o.suggestedIn))}`:'',o.suggestedOut?` \xb7 out ${(0,u.hm)(new Date(o.suggestedOut))}`:'',o.note?` \xb7 \u201c${o.note}\u201d`:'',". The suggested times are filled in below."]}):null,(0,b.jsx)(R,{label:"Clock in",mins:E,onChange:_,testID:"ov-in"}),null!=Y?(0,b.jsx)(R,{label:"Clock out",mins:Y,onChange:L,testID:"ov-out"}):(0,b.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(l.Muted,{children:"No clock-out yet."}),(0,b.jsx)(l.Button,{small:!0,kind:"secondary",label:"Add clock-out",onPress:()=>L(q?Math.round(60*q.end):Math.min(E+480,60*v.getHours()+v.getMinutes()>E?60*v.getHours()+v.getMinutes():E+480))})]}),(0,b.jsx)(l.T,{size:13,colour:c.colours.muted,children:"Break"}),(0,b.jsxs)(l.Row,{wrap:!0,gap:6,children:[k.map(e=>(0,b.jsx)(l.Chip,{label:0===e?'None':`${e} min`,selected:W===e,onPress:()=>V(e)},e)),(0,b.jsx)(l.Stepper,{value:W,min:0,max:240,onChange:V,label:"break minutes"})]}),(0,b.jsx)(l.T,{size:13,colour:c.colours.muted,children:"Reason (required, kept in the audit trail)"}),(0,b.jsx)(l.Row,{wrap:!0,gap:6,children:j.map(e=>(0,b.jsx)(l.Chip,{label:e,selected:G===e,onPress:()=>K(G===e?null:e)},e))}),(0,b.jsx)(l.Field,{label:G?'Add detail (optional)':'Or type a reason',value:U,onChangeText:Z,placeholder:"e.g. stayed late for a function",maxLength:150}),(0,b.jsxs)(l.Card,{style:{backgroundColor:c.colours.surface2},children:[(0,b.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(l.T,{children:"Paid hours"}),(0,b.jsx)(l.T,{weight:"bold",colour:c.colours.gold,children:null!=ne?(0,h.hmDur)(ne):'still on shift'})]}),te&&e?.out?(0,b.jsxs)(l.Muted,{children:["Was ",(0,h.hmDur)(te.paid)," (",(0,u.hm)(new Date(e.in)),"\u2013",(0,u.hm)(new Date(e.out)),", ",te.brk,"m break)"]}):null,se?(0,b.jsx)(l.T,{size:13,colour:c.colours.amber,children:"This entry was confirmed. Saving puts it back to Awaiting sign-off (logged)."}):null]}),oe?(0,b.jsx)(l.T,{size:13,colour:c.colours.red,children:oe}):null,J?(0,b.jsx)(l.T,{size:13,colour:c.colours.red,children:J}):null,(0,b.jsx)(l.Button,{testID:"ov-save",kind:"success",label:e?'Save change':'Add entry',disabled:!!oe||!ie||X.trim().length<3,onPress:()=>{r.useOwner.getState().overrideEntry({id:e?.id,staffId:t,date:n,in:ae,out:le,breakMins:W,reason:X.slice(0,200),by:d,byId:I,now:v.toISOString(),request:o?.id})?(o&&r.useOwner.getState().resolveTimeRequest(o.id,'applied',d,v.toISOString()),i()):Q('Couldn\u2019t save: check the times and the reason.')}}),T?(0,b.jsx)(a.default,{style:{alignItems:'center',width:'100%'},children:(0,b.jsx)(l.Button,{testID:"ov-delete-entry",kind:"ghost",label:"Delete entry",accessibilityLabel:"Delete entry",onPress:()=>$(!0),style:{minHeight:48,minWidth:160}})}):null,e&&D?(0,b.jsx)(x.DeleteShiftSheet,{a:e,onClose:()=>$(!1),onDeleted:i}):null,e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(f.SectionHead,{title:"Audit trail",sub:"Every change: what, from, to, who, when and why"}),(0,b.jsx)(B,{a:e})]}):null]})}function P(e,t){const n=new Map;return e.forEach(e=>{e.date({date:e,n:t})).sort((e,t)=>t.date.localeCompare(e.date))}},1184,[827,1182,34,402,102,794,925,891,1094,858,821,1175,1084,1185,872,1186,25]); diff --git a/display-app/admin.html b/display-app/admin.html index 403116f04f01a1cad3302d227f7435a410bda77c..7ac0bfc9af627ab66518695ae92251fa1d1567e4 100644 --- a/display-app/admin.html +++ b/display-app/admin.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/display-app/customer.html b/display-app/customer.html index 403116f04f01a1cad3302d227f7435a410bda77c..7ac0bfc9af627ab66518695ae92251fa1d1567e4 100644 --- a/display-app/customer.html +++ b/display-app/customer.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/display-app/customer/anchorage.html b/display-app/customer/anchorage.html index 403116f04f01a1cad3302d227f7435a410bda77c..7ac0bfc9af627ab66518695ae92251fa1d1567e4 100644 --- a/display-app/customer/anchorage.html +++ b/display-app/customer/anchorage.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/display-app/customer/anchorage/book.html b/display-app/customer/anchorage/book.html index 403116f04f01a1cad3302d227f7435a410bda77c..7ac0bfc9af627ab66518695ae92251fa1d1567e4 100644 --- a/display-app/customer/anchorage/book.html +++ b/display-app/customer/anchorage/book.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/display-app/customer/anchorage/feedback.html b/display-app/customer/anchorage/feedback.html index 403116f04f01a1cad3302d227f7435a410bda77c..7ac0bfc9af627ab66518695ae92251fa1d1567e4 100644 --- a/display-app/customer/anchorage/feedback.html +++ b/display-app/customer/anchorage/feedback.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/display-app/customer/anchorage/gift.html b/display-app/customer/anchorage/gift.html index 403116f04f01a1cad3302d227f7435a410bda77c..7ac0bfc9af627ab66518695ae92251fa1d1567e4 100644 --- a/display-app/customer/anchorage/gift.html +++ b/display-app/customer/anchorage/gift.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/display-app/customer/anchorage/lost.html b/display-app/customer/anchorage/lost.html index 403116f04f01a1cad3302d227f7435a410bda77c..7ac0bfc9af627ab66518695ae92251fa1d1567e4 100644 --- a/display-app/customer/anchorage/lost.html +++ b/display-app/customer/anchorage/lost.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/display-app/customer/anchorage/loyalty.html b/display-app/customer/anchorage/loyalty.html index 403116f04f01a1cad3302d227f7435a410bda77c..7ac0bfc9af627ab66518695ae92251fa1d1567e4 100644 --- a/display-app/customer/anchorage/loyalty.html +++ b/display-app/customer/anchorage/loyalty.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/display-app/customer/anchorage/merch.html b/display-app/customer/anchorage/merch.html index 403116f04f01a1cad3302d227f7435a410bda77c..7ac0bfc9af627ab66518695ae92251fa1d1567e4 100644 --- a/display-app/customer/anchorage/merch.html +++ b/display-app/customer/anchorage/merch.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/display-app/customer/anchorage/offers.html b/display-app/customer/anchorage/offers.html index 403116f04f01a1cad3302d227f7435a410bda77c..7ac0bfc9af627ab66518695ae92251fa1d1567e4 100644 --- a/display-app/customer/anchorage/offers.html +++ b/display-app/customer/anchorage/offers.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/display-app/customer/anchorage/refer.html b/display-app/customer/anchorage/refer.html index 403116f04f01a1cad3302d227f7435a410bda77c..7ac0bfc9af627ab66518695ae92251fa1d1567e4 100644 --- a/display-app/customer/anchorage/refer.html +++ b/display-app/customer/anchorage/refer.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/display-app/customer/anchorage/waitlist.html b/display-app/customer/anchorage/waitlist.html index 403116f04f01a1cad3302d227f7435a410bda77c..7ac0bfc9af627ab66518695ae92251fa1d1567e4 100644 --- a/display-app/customer/anchorage/waitlist.html +++ b/display-app/customer/anchorage/waitlist.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/display-app/customer/anchorage/whatson.html b/display-app/customer/anchorage/whatson.html index 403116f04f01a1cad3302d227f7435a410bda77c..7ac0bfc9af627ab66518695ae92251fa1d1567e4 100644 --- a/display-app/customer/anchorage/whatson.html +++ b/display-app/customer/anchorage/whatson.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/display-app/customer/basket.html b/display-app/customer/basket.html index 403116f04f01a1cad3302d227f7435a410bda77c..7ac0bfc9af627ab66518695ae92251fa1d1567e4 100644 --- a/display-app/customer/basket.html +++ b/display-app/customer/basket.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/display-app/customer/profile.html b/display-app/customer/profile.html index 403116f04f01a1cad3302d227f7435a410bda77c..7ac0bfc9af627ab66518695ae92251fa1d1567e4 100644 --- a/display-app/customer/profile.html +++ b/display-app/customer/profile.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/display-app/demo.html b/display-app/demo.html index 403116f04f01a1cad3302d227f7435a410bda77c..7ac0bfc9af627ab66518695ae92251fa1d1567e4 100644 --- a/display-app/demo.html +++ b/display-app/demo.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/display-app/display.html b/display-app/display.html index 403116f04f01a1cad3302d227f7435a410bda77c..7ac0bfc9af627ab66518695ae92251fa1d1567e4 100644 --- a/display-app/display.html +++ b/display-app/display.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/display-app/index.html b/display-app/index.html index cebea1faa9903f611e71c695b0d27674843fbf09..6667c56e0f7cc125d8ddcd57ef60e9100e2c253f 100644 --- a/display-app/index.html +++ b/display-app/index.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/display-app/kitchen.html b/display-app/kitchen.html index 403116f04f01a1cad3302d227f7435a410bda77c..7ac0bfc9af627ab66518695ae92251fa1d1567e4 100644 --- a/display-app/kitchen.html +++ b/display-app/kitchen.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/display-app/owner.html b/display-app/owner.html index 403116f04f01a1cad3302d227f7435a410bda77c..7ac0bfc9af627ab66518695ae92251fa1d1567e4 100644 --- a/display-app/owner.html +++ b/display-app/owner.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/display-app/staff.html b/display-app/staff.html index 403116f04f01a1cad3302d227f7435a410bda77c..7ac0bfc9af627ab66518695ae92251fa1d1567e4 100644 --- a/display-app/staff.html +++ b/display-app/staff.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/display-app/sw.js b/display-app/sw.js index b1c1a844e072b048a89ee16585766cefbcbc719d..4552ced697782cba30816aee467ab91053f1a124 100644 --- a/display-app/sw.js +++ b/display-app/sw.js @@ -1,7 +1,7 @@ // Anchorage Display service worker: precache the app shell so it opens offline after the first visit. -const V = "cc-display-4c7291c033"; +const V = "cc-display-74e9f41a86"; const BASE = "/display-app/"; -const PRECACHE = ["/display-app/apple-touch-icon.png", "/display-app/assets/assets/brand/3idiots-hero.e5dfd53739f05086b1956e72d585a66a.png", "/display-app/assets/assets/brand/3idiots.df4a76d2130f0e5b0042f06a8c88693a.png", "/display-app/assets/assets/brand/abbotsford-hero.78fcb8ee06ee22c4ca659c9254db7512.png", "/display-app/assets/assets/brand/abbotsford.b26602bba5ce4969733c5422a45ad053.png", "/display-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/display-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/display-app/assets/assets/brand/brae.8de9e89ac30966c6669de990370d8e40.png", "/display-app/assets/assets/brand/cecchinis-hero.f77780fcc94fd668cf35d66d6dc52d81.png", "/display-app/assets/assets/brand/cecchinis.ebf752fef363247848ae7c0d91938765.png", "/display-app/assets/assets/brand/drunkencoo-hero.65c21c4da9e466cf4bffc969639a1427.png", "/display-app/assets/assets/brand/drunkencoo.f6d92af3b14e4205a3deaf4434754c51.png", "/display-app/assets/assets/brand/greenside-hero.1caec5a6cb939434cccb5f3a613b50f8.png", "/display-app/assets/assets/brand/greenside.9d1556db97dcb903a3c57e2063ee2255.png", "/display-app/assets/assets/brand/kirkmichael-hero.63b13cde7fd82eb622622b39ac80c394.png", "/display-app/assets/assets/brand/kirkmichael.63b13cde7fd82eb622622b39ac80c394.png", "/display-app/assets/assets/brand/kirkton-hero.9d0837b292c2f4f30f4521d806bb28c3.png", "/display-app/assets/assets/brand/kirkton.bcf8d846df4861474d224a7a77f498fb.png", "/display-app/assets/assets/brand/mrbasrais-hero.4ce74641cfcf52d099157c84005b9d2a.png", "/display-app/assets/assets/brand/mrbasrais.7cc4086dd12ace82529795f1c9f8c900.png", "/display-app/assets/assets/brand/pizzaioli-hero.1896657c08264cefb49b401891d5448d.png", "/display-app/assets/assets/brand/pizzaioli.db8c000b62ee407121aa8b90ce45e170.png", "/display-app/assets/assets/brand/rupeeroom-hero.969fa372add526aaacf3a6c009b8ac92.png", "/display-app/assets/assets/brand/rupeeroom.689e6fb536dc0845eeb174a1ec7bd346.png", "/display-app/assets/assets/brand/saltmarsh.85a6a65732635e5148478d743d9ca884.png", "/display-app/assets/assets/brand/smokinggoat-hero.0588f17ef0eed7f757f22916cd4d37db.png", "/display-app/assets/assets/brand/smokinggoat.20a3a1970596ab43c5d6468d4ed549a7.png", "/display-app/assets/assets/brand/souters.f4c58d9349b6e1700fe5abcc9e9b665c.png", "/display-app/assets/assets/brand/wildings-hero-logo-text.4661e4b935726f2511f9c17a1567c89a.png", "/display-app/assets/assets/brand/wildings.076f4fcd06d19a0af0205c410f461b14.png", "/display-app/assets/assets/brand/williewastles-hero.b9d53d27b66f903b5618a7177b2ffad4.png", "/display-app/assets/assets/brand/williewastles.055a77893ced99bf3a6c5402ba5baac6.png", "/display-app/assets/assets/brand/yasmins-hero.a5aef62e37dfcecbe0afc056186f4ad9.png", "/display-app/assets/assets/brand/yasmins.8482602e9f0a965655924835625cb02b.png", "/display-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/display-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/display-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/display-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/display-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/display-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/display-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/display-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/display-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/display-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/display-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/display-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/display-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/display-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/display-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/display-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/display-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/display-app/brand-logo.png", "/display-app/favicon.ico", "/display-app/icon-192.png", "/display-app/icon-512.png", "/display-app/icon-maskable-192.png", "/display-app/icon-maskable-512.png", "/display-app/manifest.webmanifest", "/display-app/index.html", "/display-app/_expo/static/js/web/bundle.js?v=4c7291c033f70e775157f1a80b31ac8249678c820fe3b22d54ec42d09db97e4d"]; +const PRECACHE = ["/display-app/apple-touch-icon.png", "/display-app/assets/assets/brand/3idiots-hero.e5dfd53739f05086b1956e72d585a66a.png", "/display-app/assets/assets/brand/3idiots.df4a76d2130f0e5b0042f06a8c88693a.png", "/display-app/assets/assets/brand/abbotsford-hero.78fcb8ee06ee22c4ca659c9254db7512.png", "/display-app/assets/assets/brand/abbotsford.b26602bba5ce4969733c5422a45ad053.png", "/display-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/display-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/display-app/assets/assets/brand/brae.8de9e89ac30966c6669de990370d8e40.png", "/display-app/assets/assets/brand/cecchinis-hero.f77780fcc94fd668cf35d66d6dc52d81.png", "/display-app/assets/assets/brand/cecchinis.ebf752fef363247848ae7c0d91938765.png", "/display-app/assets/assets/brand/drunkencoo-hero.65c21c4da9e466cf4bffc969639a1427.png", "/display-app/assets/assets/brand/drunkencoo.f6d92af3b14e4205a3deaf4434754c51.png", "/display-app/assets/assets/brand/greenside-hero.1caec5a6cb939434cccb5f3a613b50f8.png", "/display-app/assets/assets/brand/greenside.9d1556db97dcb903a3c57e2063ee2255.png", "/display-app/assets/assets/brand/kirkmichael-hero.63b13cde7fd82eb622622b39ac80c394.png", "/display-app/assets/assets/brand/kirkmichael.63b13cde7fd82eb622622b39ac80c394.png", "/display-app/assets/assets/brand/kirkton-hero.9d0837b292c2f4f30f4521d806bb28c3.png", "/display-app/assets/assets/brand/kirkton.bcf8d846df4861474d224a7a77f498fb.png", "/display-app/assets/assets/brand/mrbasrais-hero.4ce74641cfcf52d099157c84005b9d2a.png", "/display-app/assets/assets/brand/mrbasrais.7cc4086dd12ace82529795f1c9f8c900.png", "/display-app/assets/assets/brand/pizzaioli-hero.1896657c08264cefb49b401891d5448d.png", "/display-app/assets/assets/brand/pizzaioli.db8c000b62ee407121aa8b90ce45e170.png", "/display-app/assets/assets/brand/rupeeroom-hero.969fa372add526aaacf3a6c009b8ac92.png", "/display-app/assets/assets/brand/rupeeroom.689e6fb536dc0845eeb174a1ec7bd346.png", "/display-app/assets/assets/brand/saltmarsh.85a6a65732635e5148478d743d9ca884.png", "/display-app/assets/assets/brand/smokinggoat-hero.0588f17ef0eed7f757f22916cd4d37db.png", "/display-app/assets/assets/brand/smokinggoat.20a3a1970596ab43c5d6468d4ed549a7.png", "/display-app/assets/assets/brand/souters.f4c58d9349b6e1700fe5abcc9e9b665c.png", "/display-app/assets/assets/brand/wildings-hero-logo-text.4661e4b935726f2511f9c17a1567c89a.png", "/display-app/assets/assets/brand/wildings.076f4fcd06d19a0af0205c410f461b14.png", "/display-app/assets/assets/brand/williewastles-hero.b9d53d27b66f903b5618a7177b2ffad4.png", "/display-app/assets/assets/brand/williewastles.055a77893ced99bf3a6c5402ba5baac6.png", "/display-app/assets/assets/brand/yasmins-hero.a5aef62e37dfcecbe0afc056186f4ad9.png", "/display-app/assets/assets/brand/yasmins.8482602e9f0a965655924835625cb02b.png", "/display-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/display-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/display-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/display-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/display-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/display-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/display-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/display-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/display-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/display-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/display-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/display-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/display-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/display-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/display-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/display-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/display-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/display-app/brand-logo.png", "/display-app/favicon.ico", "/display-app/icon-192.png", "/display-app/icon-512.png", "/display-app/icon-maskable-192.png", "/display-app/icon-maskable-512.png", "/display-app/manifest.webmanifest", "/display-app/index.html", "/display-app/_expo/static/js/web/bundle.js?v=74e9f41a866d9a3d3ca33251fd11c0d9176f4393365deaab5459ee63c8455a1e"]; // Hugging Face serves large files (fonts) through a redirect to its CDN. Browsers refuse to hand a *redirected* cached // response to a page, so store a plain copy instead (otherwise fonts, and so the app, fail to load offline). const plain = r => r.redirected ? r.blob().then(b => new Response(b, { status: 200, headers: { 'Content-Type': r.headers.get('Content-Type') || b.type || 'application/octet-stream' } })) : Promise.resolve(r); diff --git a/display-app/team.html b/display-app/team.html index 403116f04f01a1cad3302d227f7435a410bda77c..7ac0bfc9af627ab66518695ae92251fa1d1567e4 100644 --- a/display-app/team.html +++ b/display-app/team.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/index.html b/index.html index 1649dfa902c997f9aca2cf06ff06b78a75d9ac77..48ea1dcba25881f69b030d2e61720beaf1361fa2 100644 --- a/index.html +++ b/index.html @@ -3,7 +3,7 @@ -Cover Charge: try the apps (v0.3.12.160) +Cover Charge: try the apps (v0.3.12.161) @@ -63,7 +63,7 @@ footer{margin-top:28px;color:var(--muted);font-size:.8rem;text-align:center} Cover Charge logo

covercharge

All in one restaurant booking app

-

Cover Charge: try the apps (v0.3.12.160)

+

Cover Charge: try the apps (v0.3.12.161)

The Anchorage, Harbour View, Dunure

@@ -129,7 +129,7 @@ footer{margin-top:28px;color:var(--muted);font-size:.8rem;text-align:center}
-

Cover Charge v0.3.12.160

+

Cover Charge v0.3.12.161

diff --git a/owner-app/_expo/static/js/web/bundle.js b/owner-app/_expo/static/js/web/bundle.js index 5074e55a59ea23f9899905f1263e2d40991238ab..3d5469e02ef6ecc37e45613c4b86cdd222ec6546 100644 --- a/owner-app/_expo/static/js/web/bundle.js +++ b/owner-app/_expo/static/js/web/bundle.js @@ -872,7 +872,7 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{v __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},789,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},790,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},791,[]); -__d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ChefApp=function({section:e}={}){const{r:s,rid:o,me:n,now:L}=(0,M.useChef)(3e4);(0,fe.useReviewAlerts)(o);const _=(0,N.useSignedIn)(),U=_?.id??M.CHEF_ID,q=_?.ownerAccess&&'owner'!==_.role?'owner privileges':_?.managerAccess&&'staff'===_.role?'manager privileges':'',be=(0,xe.useSync)(e=>e.perms),ye=be.includes('*')||be.includes('takings.view');(0,i.useSoldOutLink)(!0,(_?.name??n).replace(' (example)',''));const Se=e?Te[e]:void 0,[Ie,He]=(0,I.useState)(Se?.tab??'home'),[Re,Ae]=(0,I.useState)(Se?.k??null),[De,Be]=(0,I.useState)(Se?.stock??'levels'),[$e,Oe]=(0,I.useState)(void 0),[Ee,Fe]=(0,I.useState)(Se?.gp??'dishes'),Le=(0,I.useRef)(null),Ge=(0,k.ymd)(L),Ne=(0,k.ymd)(new Date(L.getTime()+864e5));(0,p.useTipsPosted)(o,Ge);const Me=(0,X.useTravelDay)('chef',Ge),We='home'===Ie&&!Me;(0,P.useKitchenTodoChime)(o,Ge,()=>Ue('kitchen','bookings')),(0,he.useAlertWatcher)(o,{kinds:['takeaway']}),(0,I.useEffect)(()=>{(0,N.ensureAttendance)((new Date).toISOString().slice(0,10),L)},[]);const Ke=(0,I.useRef)({t:'home',k:null});Ke.current={t:Ie,k:Re};const Ve=(0,I.useRef)([]),ze=(0,l.useScrollMemory)(Le),Ue=(0,I.useCallback)((e,t=null)=>{'takings'!==t||ye||(t=null);const s=Ke.current;s.t===e&&s.k===t||(Ve.current=[...Ve.current,{...s,y:ze.leave()}].slice(-30),ze.restore(0)),He(e),Ae(t)},[ye]),qe=(0,I.useCallback)(()=>{if((0,r.runBackLayer)())return!0;const e=Ke.current;let t=Ve.current.pop();for(;t&&t.t===e.t&&t.k===e.k;)t=Ve.current.pop();if(!t&&'home'===e.t&&!e.k)return!1;const s=t??{t:'home',k:null};return ze.leave(),He(s.t),Ae(s.k),ze.restore(s.y??0),!0},[]);(0,r.useWebBack)(qe);const Qe=(0,r.useInnerBackShown)();(0,I.useEffect)(()=>{c.PITCH&&(globalThis.__pitchGo=(e,t=null,s)=>{'stock'===e&&s&&Be(s),'gp'===e&&s&&Fe(s),Ue(e,t)})},[Ue]),(0,f.useShiftReminders)({rid:o,staffId:U,name:n,kitchen:!0}),(0,C.useScheduledNotices)({rid:o,staffId:_?.id??'',name:n,onOpen:e=>{'orderlists'===e&&Ue('kitchen','orderlists'),'chat'===e&&Ue('kitchen','live')}}),(0,T.useOffRotaPrompt)({rid:o,staffId:_?.id??''}),(0,I.useEffect)(()=>{const e=H.default.addEventListener('hardwareBackPress',qe);return()=>e.remove()},[qe]),(0,I.useEffect)(()=>{'takings'!==Re||ye||(Ae(null),He('kitchen'))},[Re,ye]);const Ye=Ce.filter(e=>'takings'!==e.id||ye),Je=Re&&('takings'!==Re||ye)?Ce.find(e=>e.id===Re):null,Xe=((0,D.default)().width,Je?Je.title:{home:'Today in the kitchen',stock:c.PITCH?'Stock':'Deliveries & stock',gp:'GP & costing',creator:le.CREATOR_TITLE,orders:'Orders',kitchen:'Kitchen'}[Ie]);return(0,ve.jsxs)($.SafeAreaView,{style:{flex:1,backgroundColor:G.colours.bg},edges:['top','bottom'],children:[(0,ve.jsxs)(B.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:G.colours.border,gap:6},children:[(0,ve.jsx)(B.default,{style:{position:'absolute',top:4,right:6,zIndex:5,flexDirection:'row',alignItems:'center'},children:(0,ve.jsx)(E.VoiceSlot,{size:44})}),(0,ve.jsx)(B.default,{testID:"header-me-wrap",style:{alignItems:'flex-start',minHeight:44,justifyContent:'center',maxWidth:'70%'},children:(0,ve.jsx)(B.default,{testID:"header-me",accessibilityLabel:`Signed in as ${n.replace(' (example)','')}, Head Chef${q?`, ${q}`:''}`,style:{borderWidth:1,borderColor:G.colours.gold,borderRadius:16,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%'},children:(0,ve.jsxs)(F.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,ve.jsx)(ie.StaffAvatar,{id:M.CHEF_ID,size:24,ring:!1}),(0,ve.jsxs)(B.default,{style:{flexShrink:1},children:[(0,ve.jsxs)(F.T,{size:13,weight:"semibold",colour:G.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[n.replace(' (example)','')," \xb7 Head Chef"]}),q?(0,ve.jsx)(F.Muted,{center:!1,size:10,numberOfLines:1,children:q}):null]})]})})}),(0,ve.jsx)(O.VenueHeaderBlock,{rid:o,name:s.name,badge:"CHEF",place:"Head Chef app"}),(0,ve.jsx)(R.default,{accessibilityRole:"button",accessibilityLabel:"Open CoverCharge for Staff",onPress:()=>{const e=(0,ae.appUrl)('staff');e&&window.location.assign(e)},style:{alignSelf:'center',borderWidth:1,borderColor:G.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:3,minHeight:44,justifyContent:'center'},children:(0,ve.jsx)(F.T,{size:13,colour:G.colours.gold,children:"Staff app \u203a"})})]}),(0,ve.jsxs)(A.default,{ref:Le,...ze.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:[(0,ve.jsx)(r.BackTitleRow,{back:!('home'===Ie&&!Re||Qe),onBack:qe,title:Xe}),'home'===Ie?(0,ve.jsx)(X.DayBar,{app:"chef",today:Ge}):null,'home'===Ie&&Me?(0,ve.jsx)(X.DayView,{rid:o,day:Me,today:Ge,app:"chef"}):null,'home'===Ie?(0,ve.jsx)(oe.WhoBar,{}):null,We&&_?(0,ve.jsx)(h.MyTasksToday,{rid:o,staffId:_.id,name:_.name,onShift:(0,f.shiftNow)(_.id,L.getTime()).on}):null,We?(0,ve.jsx)(p.TodaysTipsCard,{rid:o,today:Ge}):null,We?(0,ve.jsx)(p.TipsPotCard,{rid:o,today:Ge}):null,We?(0,ve.jsx)(b.CoversToday,{rid:o,onPress:()=>Ue('kitchen','bookings')}):null,We?(0,ve.jsx)(y.LastFoodBanner,{rid:o,now:L}):null,We?(0,ve.jsx)(x.NextTableFreeCard,{rid:o,now:L}):null,We?(0,ve.jsx)(j.KitchenSignoffs,{rid:o,today:Ge,by:n,app:"chef"}):null,We?(0,ve.jsxs)(B.default,{style:{gap:4},children:[(0,ve.jsx)(j.PlattersBooked,{rid:o,date:Ge,label:"Platters booked today"}),(0,ve.jsx)(j.PlattersBooked,{rid:o,date:Ne,label:"Platters booked tomorrow"})]}):null,We?(0,ve.jsx)(me.ChefAssistantButton,{}):null,We?(0,ve.jsx)(Pe,{go:(e,t)=>{'stock'===e&&t&&Be(t),'gp'===e&&t&&Fe(t),'orders'===e&&Oe(t),Ue(e,'kitchen'===e?t??null:null)}}):null,'stock'!==Ie||c.PITCH?null:(0,ve.jsx)(Y.KitchenCosts,{rid:o,me:(_?.name??n).replace(' (example)',''),actor:{name:(_?.name??n).replace(' (example)',''),role:'head-chef'},initial:'deliveries'===De?'deliveries':'take'===De?'count':'deliveries'},`s-${De}`),'gp'!==Ie||c.PITCH?null:(0,ve.jsx)(Y.KitchenCosts,{rid:o,me:(_?.name??n).replace(' (example)',''),actor:{name:(_?.name??n).replace(' (example)',''),role:'head-chef'},initial:"dishgp"},`g-${Ee}`),'stock'===Ie&&c.PITCH?(0,ve.jsx)(Q.StockScreen,{initial:De},De):null,'gp'===Ie&&c.PITCH?(0,ve.jsx)(W.GpScreen,{initial:Ee},Ee):null,'creator'===Ie?(0,ve.jsx)(le.DishCreator,{rid:o,canPublish:!1}):null,'orders'===Ie?(0,ve.jsx)(z.OrdersScreen,{focus:$e},$e??'all'):null,'kitchen'!==Ie||Je?null:(0,ve.jsxs)(B.default,{style:{gap:10},children:[(0,ve.jsx)(B.default,{style:{borderRadius:14,borderWidth:1,borderColor:G.colours.border,backgroundColor:G.colours.surface,overflow:'hidden'},children:Ye.map((e,t)=>(0,ve.jsx)(R.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>Ue(Ie,e.id),style:({pressed:e})=>({padding:12,borderTopWidth:t?1:0,borderColor:G.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,ve.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,ve.jsxs)(B.default,{style:{flex:1},children:[(0,ve.jsx)(F.T,{weight:"medium",children:e.title}),(0,ve.jsx)(F.Muted,{children:e.sub})]}),(0,ve.jsx)(F.T,{colour:G.colours.muted,children:"\u203a"})]})},e.id))}),(0,ve.jsx)(F.Muted,{children:"Head Chef sees kitchen, stock, food costs and GP. Payroll, wages and the restaurant's billing stay in CoverCharge for Managers."}),(0,ve.jsxs)(F.Muted,{center:!0,children:["Head Chef app \xb7 ",d.APP_VERSION," \xb7 ",'live'===xe.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),'myshift'===Re&&U?(0,ve.jsxs)(B.default,{style:{gap:10},testID:"chef-myshift",children:[(0,ve.jsx)(te.ClockInOut,{}),(0,ve.jsx)(se.MyUpcomingShifts,{staffId:U,team:!0})]}):null,'mypay'===Re?(0,ve.jsxs)(B.default,{style:{gap:10},testID:"chef-mypay",children:[(0,ve.jsx)(Z.MyPeriods,{staffId:U}),(0,ve.jsx)(J.MyHoursPay,{staffId:U}),(0,ve.jsx)(ee.MyTips,{staffId:U}),(0,ve.jsx)(F.Card,{children:(0,ve.jsx)(u.PhoneAlerts,{})})]}):null,'alerts'===Re?(0,ve.jsx)(B.default,{testID:"chef-alerts",children:(0,ve.jsx)(u.PhoneAlerts,{})}):null,'avatar'===Re?(0,ve.jsx)(t.AvatarMaker,{meId:_?.id??M.CHEF_ID,me:n}):null,'reviews'===Re?(0,ve.jsx)(ge.ReviewsSection,{rid:o,mode:"read",venueName:s.name}):null,'bookings'===Re?(0,ve.jsx)(S.TodaysBookings,{rid:o,today:Ge,by:n,app:"chef"}):null,'specials'===Re?(0,ve.jsx)(de.SpecialsEditor,{rid:o,me:n,app:"chef",now:L}):null,'forecast'===Re?(0,ve.jsx)(K.ChefForecast,{openPrep:()=>Ue('kitchen','prep')}):null,'prep'===Re?(0,ve.jsx)(V.PrepScreen,{}):null,'live'===Re?(0,ve.jsx)(V.TeamScreen,{}):null,'waste'===Re?(0,ve.jsx)(V.WasteScreen,{}):null,'recipes'===Re?(0,ve.jsx)(pe.RecipeCards,{rid:o,actor:{name:n,role:'head-chef'},mode:"edit"}):null,'allergens'===Re?(0,ve.jsx)(V.AllergenScreen,{openCards:()=>Ue('kitchen','recipes')}):null,'compliance'===Re?(0,ve.jsx)(V.ComplianceScreen,{}):null,'takings'===Re&&ye?(0,ve.jsx)(p.CashUpScreen,{rid:o,today:Ge,canEdit:!1,chartsOnly:!0,who:{id:U,name:n.replace(' (example)','')}}):null,'board'===Re?(0,ve.jsx)(ke.QuestionBoard,{rid:o,today:Ge,manager:!1,by:""}):null,'teamtasks'===Re?(0,ve.jsx)(h.KitchenTeamTasks,{rid:o,actor:_}):null,'orderlists'===Re?(0,ve.jsx)(v.OrderListsScreen,{rid:o,today:Ge,editor:!0,who:{id:U,name:n.replace(' (example)','')}}):null,'foodsafety'===Re?(0,ve.jsx)(w.FoodSafetyCard,{children:(0,ve.jsx)(R.default,{accessibilityRole:"button",onPress:()=>Ue('kitchen','haccp'),children:(0,ve.jsx)(F.T,{colour:G.colours.gold,children:"Today\u2019s temperature log \u203a"})})}):null,'haccp'===Re?(0,ve.jsx)(re.HaccpLog,{mode:"chef",me:n,meId:M.CHEF_ID,now:L}):null,'accidents'===Re?(0,ve.jsx)(ne.AccidentBook,{app:"chef",me:n,meId:M.CHEF_ID,now:L,seeAll:!1}):null]}),(0,ve.jsx)(je.BottomTabs,{tablist:!0,background:G.colours.surface,active:Ie,onPress:e=>Ue(e),tabs:we.map(e=>({id:e.id,label:e.label,short:'creator'===e.id?'Creator':void 0,icon:e.icon}))}),(0,ve.jsx)(me.ChefAssistantSheet,{go:(e,t)=>{'orders'===e?(Oe(t),Ue('orders')):'gp'===e?Ue('gp'):Ue('kitchen',e)}}),(0,ve.jsx)(ce.AlertHost,{variant:"chef",rid:o,skipTakeaway:!0}),(0,ve.jsx)(ue.KitchenFlash,{rid:o,me:n})]})};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),i=_r(_d[3]),n=_r(_d[4]),l=_r(_d[5]),r=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),f=_r(_d[12]),k=_r(_d[13]),b=_r(_d[14]),y=_r(_d[15]),x=_r(_d[16]),j=_r(_d[17]),v=_r(_d[18]),w=_r(_d[19]),C=_r(_d[20]),T=_r(_d[21]),P=_r(_d[22]),S=_r(_d[23]),I=_r(_d[24]),H=e(_r(_d[25]));_r(_d[26]);var R=e(_r(_d[27])),A=e(_r(_d[28])),D=e(_r(_d[29])),B=e(_r(_d[30])),$=_r(_d[31]),O=_r(_d[32]),E=_r(_d[33]),F=_r(_d[34]),L=_r(_d[35]),G=_r(_d[36]),N=_r(_d[37]),_=_r(_d[38]),M=_r(_d[39]),W=_r(_d[40]),K=_r(_d[41]),V=_r(_d[42]),z=_r(_d[43]),U=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),Y=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),se=_r(_d[53]),oe=_r(_d[54]),ie=_r(_d[55]),ae=_r(_d[56]),ne=_r(_d[57]),le=_r(_d[58]),re=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),pe=_r(_d[64]),ge=_r(_d[65]),fe=_r(_d[66]),ke=_r(_d[67]),be=_r(_d[68]),me=_r(_d[69]),ye=_r(_d[70]),xe=_r(_d[71]),je=_r(_d[72]),ve=_r(_d[73]);s.LIVE_HEAD_CHEF&&(0,o.requireRealData)();const we=[{id:'home',label:'Home',icon:'home'},{id:'stock',label:'Stock',icon:'box'},{id:'gp',label:'GP',icon:'forecast'},{id:'creator',label:le.CREATOR_TITLE,icon:'sparkle'},{id:'orders',label:'Orders',icon:'orders'},{id:'kitchen',label:'Kitchen',icon:'platter'}],Ce=[{id:'alerts',title:'Turn on alerts',sub:'Get your reminders on this phone, even with the app closed'},{id:'avatar',title:'My avatar',sub:'Animals, Bar & kitchen, sea, sport, colours, patterns or your own photo'},{id:'reviews',title:'Reviews',sub:'Published reviews, newest first'},{id:'myshift',title:'My shifts & clock in',sub:'Clock in and out (checks you are at the venue), breaks, and your shifts on the rota'},{id:'mypay',title:'My pay & tips',sub:'Your hours, tips share, tip goal, paydays and payslip info. Only you see this'},{id:'takings',title:'Takings & tips graphs',sub:'Daily cash ups, weekly sales, this week vs last, categories and the Tips pot (view only)'},{id:'bookings',title:'Today\u2019s bookings',sub:'Covers, allergens to sign off, platters and other reservations, dogs, access and vegan/vegetarian'},{id:'recipes',title:'Recipe cards',sub:'Plating photo, ingredients, method, allergens, section and price; you sign each card off before it goes live'},{id:'specials',title:'Specials board',sub:'Photo of the chalkboard or typed specials with allergens; shown in the customer app'},{id:'board',title:'Question board',sub:'Ask the team anything anonymously, and vote'},{id:'teamtasks',title:'Kitchen team tasks',sub:'Daily tasks for your chefs, commis and KPs'},{id:'orderlists',title:'Order lists',sub:'Alsons drinks, Cash and carry: add items, tick on the day, finish and carry over'},{id:'foodsafety',title:'Food safety (CookSafe)',sub:'Based on CookSafe (Food Standards Scotland). Full logs coming in the next update'},{id:'haccp',title:'Food safety log (HACCP)',sub:'Temperatures, cleaning and allergen checks; voice entry; limits; EHO export'},{id:'accidents',title:'Accident book',sub:'Accidents and near misses; you see your own entries'},{id:'forecast',title:'Forecast',sub:'Covers per day for the week ahead, and prep from the forecast'},{id:'prep',title:'Prep list',sub:'From the forecast and bookings, tick off as you go'},{id:'live',title:'Live tickets, sold out, team & chat',sub:'Orders, readiness alerts, sold out, who\u2019s on, rota, team chat and private messages'},{id:'waste',title:'Waste log',sub:'Item, quantity, reason and cost; weekly total and % of sales'},{id:'allergens',title:'Allergens',sub:'14-allergen matrix from the recipe cards, costing cross-check and audit log'},{id:'compliance',title:'Kitchen compliance',sub:'Fridge, freezer, cooking and cooling temps; cleaning; daily checks'}],Te={stock:{tab:'stock',stock:'levels'},'stock-take':{tab:'stock',stock:'take'},deliveries:{tab:'stock',stock:'deliveries'},gp:{tab:'gp',gp:'dishes'},'price-changes':{tab:'gp',gp:'changes'},'gp-week':{tab:'gp',gp:'week'},'menu-engineering':{tab:'gp',gp:'engineering'},orders:{tab:'orders'},forecast:{tab:'kitchen',k:'forecast'},prep:{tab:'kitchen',k:'prep'},live:{tab:'kitchen',k:'live'},waste:{tab:'kitchen',k:'waste'},recipes:{tab:'kitchen',k:'recipes'},'recipe-cards':{tab:'kitchen',k:'recipes'},allergens:{tab:'kitchen',k:'allergens'},compliance:{tab:'kitchen',k:'compliance'},haccp:{tab:'kitchen',k:'haccp'},specials:{tab:'kitchen',k:'specials'},accidents:{tab:'kitchen',k:'accidents'},'new-dish':{tab:'creator'}};function Pe({go:e}){const{k:t,c:s,menu:o,now:i,rid:l,me:r}=(0,M.useChef)(3e4),d=(0,U.useSheetReminders)(),u=(0,M.useWeek)(),{covers:h,label:p,enough:f,booked:k}=(0,M.useForecast)(),b=(0,z.useSuggestions)(),y=t.ingredients.filter(e=>e.onHand<=0||(0,M.isLow)(e.onHand,e.par)),x=b.filter(e=>e.ordersToday&&!e.placedToday),j=(0,_.priceImpacts)(o,t.recipes,t.ingredients,t.targetGp).filter(e=>e.dropped.length),v=t.deliveries.filter(e=>'expected'===e.status),w=!t.recipes.length||!t.ingredients.length,C=w?[]:s.filter(e=>e.below),T=(0,n.useLiveState)(),P=(0,be.useRecipeCards)(l).filter(e=>!e.signOff),S=(0,Y.useKitchenSummary)(l),[H,A]=(0,I.useState)(!1);return(0,ve.jsxs)(B.default,{style:{gap:12},testID:"chef-dashboard",children:[(0,ve.jsx)(re.MissedBanner,{mode:"chef",now:i,onPress:()=>e('kitchen','haccp')}),d.map(t=>(0,ve.jsx)(R.default,{accessibilityRole:"button",onPress:()=>e('orders',t.supplierId),children:(0,ve.jsxs)(F.Banner,{kind:'red'===t.tone?'danger':'warn',title:`\u23f0 ${t.text}`,children:["Tap to open the ",t.name," order sheet. Nothing is sent until you press Send."]})},t.supplierId)),P.length?(0,ve.jsx)(R.default,{testID:"cards-awaiting",accessibilityRole:"button",onPress:()=>e('kitchen','recipes'),children:(0,ve.jsxs)(F.Banner,{kind:"warn",title:`${P.length} recipe card${1===P.length?'':'s'} awaiting your sign-off`,children:[P.slice(0,4).map(e=>e.dish).join(', '),". Guests see \"awaiting allergen sign-off\" and cannot order these until you sign them off."]})}):null,(0,ve.jsx)(q.ShellfishTile,{rid:l,by:r,app:"chef",onOrder:()=>e('orders','os-kittyfisher')}),(0,ve.jsx)(F.Button,{testID:"chef-add-soldout",label:"Add sold out",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>A(!0),style:{minHeight:56}}),(0,ve.jsxs)(F.Row,{wrap:!0,gap:10,children:[c.PITCH?null:(0,ve.jsx)(M.Tile,{testID:"tile-gp",label:"Dishes under target GP",value:S.costed?`${S.below} of ${S.costed}`:'Nothing yet',sub:S.costed?`Average ${(0,M.pct1)(S.avgGp??0)} \xb7 target ${S.target}%`:'Record a delivery, then cost your recipe cards',tone:S.costed?S.below?'amber':'ok':void 0,onPress:()=>e('gp','dishes')}),c.PITCH?w?(0,ve.jsx)(M.Tile,{testID:"tile-gp",label:"GP this week vs target",value:"Nothing yet",sub:"Add ingredients and recipe costs to see GP",onPress:()=>e('gp','week')}):(0,ve.jsx)(M.Tile,{testID:"tile-gp",label:"GP this week vs target",value:(0,M.pct1)(u.theo),sub:`Target ${t.targetGp}% \xb7 actual ${(0,M.pct1)(u.actual)}`,tone:u.theoe('gp','week')}):null,c.PITCH?null:(0,ve.jsx)(M.Tile,{testID:"tile-stock",label:"Stock value",value:null!=S.stockValue?(0,L.gbp)(S.stockValue):'Nothing yet',sub:S.lastCount?`At cost, counted ${S.lastCount}`:'No stock counted yet',onPress:()=>e('stock','take')}),c.PITCH?(0,ve.jsx)(M.Tile,{testID:"tile-stock",label:"Stock value",value:t.ingredients.length?(0,L.gbp)((0,M.stockValue)(t.ingredients)):'Nothing yet',sub:t.ingredients.length?'At cost':'No stock counted yet',onPress:()=>e('stock','levels')}):null,(0,ve.jsx)(M.Tile,{label:"Items low or out",value:t.ingredients.length?`${y.length}`:'Nothing yet',sub:t.ingredients.length?y.slice(0,3).map(e=>e.name).join(', '):'No stock counted yet',tone:y.some(e=>e.onHand<=0)?'red':y.length?'amber':'ok',onPress:()=>e('stock','levels')}),(0,ve.jsx)(M.Tile,{label:"Waste this week",value:t.waste.length?(0,L.gbp)(u.wasteWeek):'Nothing yet',sub:u.sales?`${(0,M.pct1)(u.wasteWeek/u.sales*100)} of food sales`:'',onPress:()=>e('kitchen','waste')}),f?(0,ve.jsx)(M.Tile,{testID:"tile-forecast",label:"Covers forecast today",value:`${h}`,sub:p,onPress:()=>e('kitchen','forecast')}):(0,ve.jsx)(M.Tile,{testID:"tile-booked",label:"Booked so far today",value:'ready'===T?`${k}`:'connecting'===T?'Connecting\u2026':'Not connected',sub:"Not enough history for a forecast yet",onPress:()=>e('kitchen','bookings')}),(0,ve.jsx)(M.Tile,{label:"Orders due today",value:`${x.length}`,sub:x.map(e=>`${e.s.name} by ${e.s.cutoff}`).join(' \xb7 ')||'None',tone:x.some(e=>e.cutPassed)?'red':x.length?'amber':'ok',onPress:()=>e('orders')})]}),j.map(e=>(0,ve.jsxs)(F.Banner,{kind:"danger",title:`${e.ing.name} ${e.pct>0?'+':''}${e.pct.toFixed(0)}%: ${e.dropped.length} dish${1===e.dropped.length?'':'es'} drop below target`,children:[e.dropped.map(e=>e.item.name).join(', '),". Open GP \u203a Price changes."]},e.ing.id)),v.length?(0,ve.jsx)(R.default,{accessibilityRole:"button",onPress:()=>e('stock','deliveries'),children:(0,ve.jsx)(F.Banner,{kind:"info",title:`${v.length} deliver${1===v.length?'y':'ies'} to check in today`,children:"Count in against the order, flag shorts and price changes."})}):null,C.length?(0,ve.jsx)(R.default,{accessibilityRole:"button",onPress:()=>e('gp','dishes'),children:(0,ve.jsxs)(F.Banner,{kind:"warn",title:`${C.length} dishes below ${t.targetGp}% GP`,children:[C.slice(0,4).map(e=>e.item.name).join(', '),C.length>4?'\u2026':'']})}):null,(0,ve.jsx)(F.Row,{wrap:!0,gap:8,children:[['Recipe cards','recipes'],['Food safety log','haccp'],['Specials board','specials'],[le.CREATOR_TITLE,'creator'],['Forecast','forecast'],['Prep list','prep'],['Live tickets & sold out','live'],['Allergens','allergens'],['Accident book','accidents']].map(([t,s])=>(0,ve.jsx)(R.default,{accessibilityRole:"button",accessibilityLabel:t,onPress:()=>'creator'===s?e('creator'):e('kitchen',s),style:{flexGrow:1,flexBasis:140,padding:12,borderRadius:12,borderWidth:1.5,borderColor:G.colours.gold,backgroundColor:G.colours.surface},children:(0,ve.jsxs)(F.T,{weight:"semibold",children:[t," \u203a"]})},s))}),(0,ve.jsx)(F.Badge,{kind:"neutral",label:"Nothing is ordered or sent from here"}),(0,ve.jsx)(ye.SoldOutSheet,{visible:H,onClose:()=>A(!1),rid:l,by:r,hideLinks:!0,testID:"chef-soldout-sheet"})]})}},792,[793,978,884,979,986,1051,1052,1015,2,1053,1057,1058,1090,858,1095,1099,1100,1103,1104,1107,1108,1110,1111,1112,34,373,236,402,295,426,102,36,873,1137,794,867,821,1084,1139,1145,1148,1149,1152,1167,1168,1169,1171,1172,1179,1182,1185,1193,1194,1198,1199,925,1003,1200,1158,1201,1208,1213,1222,1215,1156,1224,1228,1195,874,1229,1154,987,1230,25]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ChefApp=function({section:e}={}){const{r:s,rid:i,me:n,now:L}=(0,_.useChef)(3e4);(0,be.useReviewAlerts)(i);const M=(0,G.useSignedIn)(),q=M?.id??_.CHEF_ID,Q=M?.ownerAccess&&'owner'!==M.role?'owner privileges':M?.managerAccess&&'staff'===M.role?'manager privileges':'',me=(0,je.useSync)(e=>e.perms),xe=me.includes('*')||me.includes('takings.view');(0,o.useSoldOutLink)(!0,(M?.name??n).replace(' (example)',''));const Re=e?Se[e]:void 0,[He,Ae]=(0,I.useState)(Re?.tab??'home'),[De,$e]=(0,I.useState)(Re?.k??null),[Be,Oe]=(0,I.useState)(Re?.stock??'levels'),[Ee,Fe]=(0,I.useState)(void 0),[Le,Ne]=(0,I.useState)(Re?.gp??'dishes'),Ge=(0,I.useRef)(null),Me=(0,b.ymd)(L),We=(0,b.ymd)(new Date(L.getTime()+864e5));(0,p.useTipsPosted)(i,Me);const Ke=(0,Z.useTravelDay)('chef',Me),Ve='home'===He&&!Ke;(0,P.useKitchenTodoChime)(i,Me,()=>Qe('kitchen','bookings')),(0,pe.useAlertWatcher)(i,{kinds:['takeaway']}),(0,I.useEffect)(()=>{(0,G.ensureAttendance)((new Date).toISOString().slice(0,10),L)},[]);const ze=(0,I.useRef)({t:'home',k:null});ze.current={t:He,k:De};const Ue=(0,I.useRef)([]),qe=(0,l.useScrollMemory)(Ge),Qe=(0,I.useCallback)((e,t=null)=>{'takings'!==t||xe||(t=null);const s=ze.current;s.t===e&&s.k===t||(Ue.current=[...Ue.current,{...s,y:qe.leave()}].slice(-30),qe.restore(0)),Ae(e),$e(t)},[xe]),Ye=(0,I.useCallback)(()=>{if((0,r.runBackLayer)())return!0;const e=ze.current;let t=Ue.current.pop();for(;t&&t.t===e.t&&t.k===e.k;)t=Ue.current.pop();if(!t&&'home'===e.t&&!e.k)return!1;const s=t??{t:'home',k:null};return qe.leave(),Ae(s.t),$e(s.k),qe.restore(s.y??0),!0},[]);(0,r.useWebBack)(Ye);const Je=(0,r.useInnerBackShown)();(0,I.useEffect)(()=>{c.PITCH&&(globalThis.__pitchGo=(e,t=null,s)=>{'stock'===e&&s&&Oe(s),'gp'===e&&s&&Ne(s),Qe(e,t)})},[Qe]),(0,f.useShiftReminders)({rid:i,staffId:q,name:n,kitchen:!0}),(0,C.useScheduledNotices)({rid:i,staffId:M?.id??'',name:n,onOpen:e=>{'orderlists'===e&&Qe('kitchen','orderlists'),'chat'===e&&Qe('kitchen','live')}}),(0,T.useOffRotaPrompt)({rid:i,staffId:M?.id??''}),(0,I.useEffect)(()=>{const e=R.default.addEventListener('hardwareBackPress',Ye);return()=>e.remove()},[Ye]),(0,I.useEffect)(()=>{'takings'!==De||xe||($e(null),Ae('kitchen'))},[De,xe]);const Xe=Pe.filter(e=>'takings'!==e.id||xe),Ze=De&&('takings'!==De||xe)?Pe.find(e=>e.id===De):null,et=((0,D.default)().width,Ze?Ze.title:{home:'Today in the kitchen',stock:c.PITCH?'Stock':'Deliveries & stock',gp:'GP & costing',creator:re.CREATOR_TITLE,orders:'Orders',rota:'Rota',kitchen:'Kitchen'}[He]);return(0,ve.jsxs)(B.SafeAreaView,{style:{flex:1,backgroundColor:N.colours.bg},edges:['top','bottom'],children:[(0,ve.jsxs)($.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:N.colours.border,gap:6},children:[(0,ve.jsx)($.default,{style:{position:'absolute',top:4,right:6,zIndex:5,flexDirection:'row',alignItems:'center'},children:(0,ve.jsx)(E.VoiceSlot,{size:44})}),(0,ve.jsx)($.default,{testID:"header-me-wrap",style:{alignItems:'flex-start',minHeight:44,justifyContent:'center',maxWidth:'70%'},children:(0,ve.jsx)($.default,{testID:"header-me",accessibilityLabel:`Signed in as ${n.replace(' (example)','')}, Head Chef${Q?`, ${Q}`:''}`,style:{borderWidth:1,borderColor:N.colours.gold,borderRadius:16,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%'},children:(0,ve.jsxs)(F.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,ve.jsx)(oe.StaffAvatar,{id:_.CHEF_ID,size:24,ring:!1}),(0,ve.jsxs)($.default,{style:{flexShrink:1},children:[(0,ve.jsxs)(F.T,{size:13,weight:"semibold",colour:N.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[n.replace(' (example)','')," \xb7 Head Chef"]}),Q?(0,ve.jsx)(F.Muted,{center:!1,size:10,numberOfLines:1,children:Q}):null]})]})})}),(0,ve.jsx)(O.VenueHeaderBlock,{rid:i,name:s.name,badge:"CHEF",place:"Head Chef app"}),(0,ve.jsx)(H.default,{accessibilityRole:"button",accessibilityLabel:"Open CoverCharge for Staff",onPress:()=>{const e=(0,ne.appUrl)('staff');e&&window.location.assign(e)},style:{alignSelf:'center',borderWidth:1,borderColor:N.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:3,minHeight:44,justifyContent:'center'},children:(0,ve.jsx)(F.T,{size:13,colour:N.colours.gold,children:"Staff app \u203a"})})]}),(0,ve.jsxs)(A.default,{ref:Ge,...qe.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:[(0,ve.jsx)(r.BackTitleRow,{back:!('home'===He&&!De||Je),onBack:Ye,title:et}),'home'===He?(0,ve.jsx)(Z.DayBar,{app:"chef",today:Me}):null,'home'===He&&Ke?(0,ve.jsx)(Z.DayView,{rid:i,day:Ke,today:Me,app:"chef"}):null,'home'===He?(0,ve.jsx)(ae.WhoBar,{}):null,Ve&&M?(0,ve.jsx)(h.MyTasksToday,{rid:i,staffId:M.id,name:M.name,onShift:(0,f.shiftNow)(M.id,L.getTime()).on}):null,Ve?(0,ve.jsx)(p.TodaysTipsCard,{rid:i,today:Me}):null,Ve?(0,ve.jsx)(p.TipsPotCard,{rid:i,today:Me}):null,Ve?(0,ve.jsx)(k.CoversToday,{rid:i,onPress:()=>Qe('kitchen','bookings')}):null,Ve?(0,ve.jsx)(y.LastFoodBanner,{rid:i,now:L}):null,Ve?(0,ve.jsx)(x.NextTableFreeCard,{rid:i,now:L}):null,Ve?(0,ve.jsx)(j.KitchenSignoffs,{rid:i,today:Me,by:n,app:"chef"}):null,Ve?(0,ve.jsxs)($.default,{style:{gap:4},children:[(0,ve.jsx)(j.PlattersBooked,{rid:i,date:Me,label:"Platters booked today"}),(0,ve.jsx)(j.PlattersBooked,{rid:i,date:We,label:"Platters booked tomorrow"})]}):null,Ve?(0,ve.jsx)(ye.ChefAssistantButton,{}):null,Ve?(0,ve.jsx)(Ie,{go:(e,t)=>{'stock'===e&&t&&Oe(t),'gp'===e&&t&&Ne(t),'orders'===e&&Fe(t),Qe(e,'kitchen'===e?t??null:null)}}):null,'stock'!==He||c.PITCH?null:(0,ve.jsx)(J.KitchenCosts,{rid:i,me:(M?.name??n).replace(' (example)',''),actor:{name:(M?.name??n).replace(' (example)',''),role:'head-chef'},initial:'deliveries'===Be?'deliveries':'take'===Be?'count':'deliveries'},`s-${Be}`),'gp'!==He||c.PITCH?null:(0,ve.jsx)(J.KitchenCosts,{rid:i,me:(M?.name??n).replace(' (example)',''),actor:{name:(M?.name??n).replace(' (example)',''),role:'head-chef'},initial:"dishgp"},`g-${Le}`),'stock'===He&&c.PITCH?(0,ve.jsx)(Y.StockScreen,{initial:Be},Be):null,'gp'===He&&c.PITCH?(0,ve.jsx)(W.GpScreen,{initial:Le},Le):null,'creator'===He?(0,ve.jsx)(re.DishCreator,{rid:i,canPublish:!1}):null,'orders'===He?(0,ve.jsx)(z.OrdersScreen,{focus:Ee},Ee??'all'):null,'rota'===He?(0,ve.jsx)(F.Card,{children:(0,ve.jsx)(U.KitchenRotaTab,{today:Me})}):null,'kitchen'!==He||Ze?null:(0,ve.jsxs)($.default,{style:{gap:10},children:[(0,ve.jsxs)($.default,{style:{borderRadius:14,borderWidth:1,borderColor:N.colours.border,backgroundColor:N.colours.surface,overflow:'hidden'},children:[Te.map(e=>(0,ve.jsx)(H.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:`${e.title}. ${e.sub}`,onPress:()=>Qe(e.id),style:({pressed:e})=>({padding:12,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,ve.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,ve.jsxs)($.default,{style:{flex:1},children:[(0,ve.jsx)(F.T,{weight:"medium",children:e.title}),(0,ve.jsx)(F.Muted,{children:e.sub})]}),(0,ve.jsx)(F.T,{colour:N.colours.muted,children:"\u203a"})]})},e.id)),Xe.map(e=>(0,ve.jsx)(H.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>Qe(He,e.id),style:({pressed:e})=>({padding:12,borderTopWidth:1,borderColor:N.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,ve.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,ve.jsxs)($.default,{style:{flex:1},children:[(0,ve.jsx)(F.T,{weight:"medium",children:e.title}),(0,ve.jsx)(F.Muted,{children:e.sub})]}),(0,ve.jsx)(F.T,{colour:N.colours.muted,children:"\u203a"})]})},e.id))]}),(0,ve.jsx)(F.Muted,{children:"Head Chef sees kitchen, stock, food costs and GP. Payroll, wages and the restaurant's billing stay in CoverCharge for Managers."}),(0,ve.jsxs)(F.Muted,{center:!0,children:["Head Chef app \xb7 ",d.APP_VERSION," \xb7 ",'live'===je.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),'myshift'===De&&q?(0,ve.jsxs)($.default,{style:{gap:10},testID:"chef-myshift",children:[(0,ve.jsx)(se.ClockInOut,{}),(0,ve.jsx)(ie.MyUpcomingShifts,{staffId:q,team:!0})]}):null,'mypay'===De?(0,ve.jsxs)($.default,{style:{gap:10},testID:"chef-mypay",children:[(0,ve.jsx)(ee.MyPeriods,{staffId:q}),(0,ve.jsx)(X.MyHoursPay,{staffId:q}),(0,ve.jsx)(te.MyTips,{staffId:q}),(0,ve.jsx)(F.Card,{children:(0,ve.jsx)(u.PhoneAlerts,{})})]}):null,'alerts'===De?(0,ve.jsx)($.default,{testID:"chef-alerts",children:(0,ve.jsx)(u.PhoneAlerts,{})}):null,'avatar'===De?(0,ve.jsx)(t.AvatarMaker,{meId:M?.id??_.CHEF_ID,me:n}):null,'reviews'===De?(0,ve.jsx)(fe.ReviewsSection,{rid:i,mode:"read",venueName:s.name}):null,'bookings'===De?(0,ve.jsx)(S.TodaysBookings,{rid:i,today:Me,by:n,app:"chef"}):null,'specials'===De?(0,ve.jsx)(ce.SpecialsEditor,{rid:i,me:n,app:"chef",now:L}):null,'forecast'===De?(0,ve.jsx)(K.ChefForecast,{openPrep:()=>Qe('kitchen','prep')}):null,'prep'===De?(0,ve.jsx)(V.PrepScreen,{}):null,'live'===De?(0,ve.jsx)(V.TeamScreen,{}):null,'waste'===De?(0,ve.jsx)(V.WasteScreen,{}):null,'recipes'===De?(0,ve.jsx)(ge.RecipeCards,{rid:i,actor:{name:n,role:'head-chef'},mode:"edit"}):null,'allergens'===De?(0,ve.jsx)(V.AllergenScreen,{openCards:()=>Qe('kitchen','recipes')}):null,'compliance'===De?(0,ve.jsx)(V.ComplianceScreen,{}):null,'takings'===De&&xe?(0,ve.jsx)(p.CashUpScreen,{rid:i,today:Me,canEdit:!1,chartsOnly:!0,who:{id:q,name:n.replace(' (example)','')}}):null,'board'===De?(0,ve.jsx)(ke.QuestionBoard,{rid:i,today:Me,manager:!1,by:""}):null,'teamtasks'===De?(0,ve.jsx)(h.KitchenTeamTasks,{rid:i,actor:M}):null,'orderlists'===De?(0,ve.jsx)(w.OrderListsScreen,{rid:i,today:Me,editor:!0,who:{id:q,name:n.replace(' (example)','')}}):null,'foodsafety'===De?(0,ve.jsx)(v.FoodSafetyCard,{children:(0,ve.jsx)(H.default,{accessibilityRole:"button",onPress:()=>Qe('kitchen','haccp'),children:(0,ve.jsx)(F.T,{colour:N.colours.gold,children:"Today\u2019s temperature log \u203a"})})}):null,'haccp'===De?(0,ve.jsx)(de.HaccpLog,{mode:"chef",me:n,meId:_.CHEF_ID,now:L}):null,'accidents'===De?(0,ve.jsx)(le.AccidentBook,{app:"chef",me:n,meId:_.CHEF_ID,now:L,seeAll:!1}):null]}),(0,ve.jsx)(we.BottomTabs,{tablist:!0,background:N.colours.surface,active:'orders'===He?'kitchen':He,onPress:e=>Qe(e),tabs:Ce.map(e=>({id:e.id,label:e.label,short:'creator'===e.id?'Creator':void 0,icon:e.icon,a11y:'rota'===e.id?'Rota, the kitchen rota':void 0}))}),(0,ve.jsx)(ye.ChefAssistantSheet,{go:(e,t)=>{'orders'===e?(Fe(t),Qe('orders')):'gp'===e?Qe('gp'):Qe('kitchen',e)}}),(0,ve.jsx)(ue.AlertHost,{variant:"chef",rid:i,skipTakeaway:!0}),(0,ve.jsx)(he.KitchenFlash,{rid:i,me:n})]})};var t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),o=_r(_d[3]),n=_r(_d[4]),l=_r(_d[5]),r=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),f=_r(_d[12]),b=_r(_d[13]),k=_r(_d[14]),y=_r(_d[15]),x=_r(_d[16]),j=_r(_d[17]),w=_r(_d[18]),v=_r(_d[19]),C=_r(_d[20]),T=_r(_d[21]),P=_r(_d[22]),S=_r(_d[23]),I=_r(_d[24]),R=e(_r(_d[25]));_r(_d[26]);var H=e(_r(_d[27])),A=e(_r(_d[28])),D=e(_r(_d[29])),$=e(_r(_d[30])),B=_r(_d[31]),O=_r(_d[32]),E=_r(_d[33]),F=_r(_d[34]),L=_r(_d[35]),N=_r(_d[36]),G=_r(_d[37]),M=_r(_d[38]),_=_r(_d[39]),W=_r(_d[40]),K=_r(_d[41]),V=_r(_d[42]),z=_r(_d[43]),U=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),Y=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),se=_r(_d[53]),ie=_r(_d[54]),ae=_r(_d[55]),oe=_r(_d[56]),ne=_r(_d[57]),le=_r(_d[58]),re=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),pe=_r(_d[64]),ge=_r(_d[65]),fe=_r(_d[66]),be=_r(_d[67]),ke=_r(_d[68]),me=_r(_d[69]),ye=_r(_d[70]),xe=_r(_d[71]),je=_r(_d[72]),we=_r(_d[73]),ve=_r(_d[74]);s.LIVE_HEAD_CHEF&&(0,i.requireRealData)();const Ce=[{id:'home',label:'Home',icon:'home'},{id:'stock',label:'Stock',icon:'box'},{id:'gp',label:'GP',icon:'forecast'},{id:'creator',label:re.CREATOR_TITLE,icon:'sparkle'},{id:'rota',label:'Rota',icon:'rota'},{id:'kitchen',label:'Kitchen',icon:'platter'}],Te=[{id:'orders',title:'Orders',sub:'Supplier order sheets, what is due today and cut-off times. Nothing is sent until you press Send'}],Pe=[{id:'alerts',title:'Turn on alerts',sub:'Get your reminders on this phone, even with the app closed'},{id:'avatar',title:'My avatar',sub:'Animals, Bar & kitchen, sea, sport, colours, patterns or your own photo'},{id:'reviews',title:'Reviews',sub:'Published reviews, newest first'},{id:'myshift',title:'My shifts & clock in',sub:'Clock in and out (checks you are at the venue), breaks, and your shifts on the rota'},{id:'mypay',title:'My pay & tips',sub:'Your hours, tips share, tip goal, paydays and payslip info. Only you see this'},{id:'takings',title:'Takings & tips graphs',sub:'Daily cash ups, weekly sales, this week vs last, categories and the Tips pot (view only)'},{id:'bookings',title:'Today\u2019s bookings',sub:'Covers, allergens to sign off, platters and other reservations, dogs, access and vegan/vegetarian'},{id:'recipes',title:'Recipe cards',sub:'Plating photo, ingredients, method, allergens, section and price; you sign each card off before it goes live'},{id:'specials',title:'Specials board',sub:'Photo of the chalkboard or typed specials with allergens; shown in the customer app'},{id:'board',title:'Question board',sub:'Ask the team anything anonymously, and vote'},{id:'teamtasks',title:'Kitchen team tasks',sub:'Daily tasks for your chefs, commis and KPs'},{id:'orderlists',title:'Order lists',sub:'Alsons drinks, Cash and carry: add items, tick on the day, finish and carry over'},{id:'foodsafety',title:'Food safety (CookSafe)',sub:'Based on CookSafe (Food Standards Scotland). Full logs coming in the next update'},{id:'haccp',title:'Food safety log (HACCP)',sub:'Temperatures, cleaning and allergen checks; voice entry; limits; EHO export'},{id:'accidents',title:'Accident book',sub:'Accidents and near misses; you see your own entries'},{id:'forecast',title:'Forecast',sub:'Covers per day for the week ahead, and prep from the forecast'},{id:'prep',title:'Prep list',sub:'From the forecast and bookings, tick off as you go'},{id:'live',title:'Live tickets, sold out, team & chat',sub:'Orders, readiness alerts, sold out, who\u2019s on, rota, team chat and private messages'},{id:'waste',title:'Waste log',sub:'Item, quantity, reason and cost; weekly total and % of sales'},{id:'allergens',title:'Allergens',sub:'14-allergen matrix from the recipe cards, costing cross-check and audit log'},{id:'compliance',title:'Kitchen compliance',sub:'Fridge, freezer, cooking and cooling temps; cleaning; daily checks'}],Se={stock:{tab:'stock',stock:'levels'},'stock-take':{tab:'stock',stock:'take'},deliveries:{tab:'stock',stock:'deliveries'},gp:{tab:'gp',gp:'dishes'},'price-changes':{tab:'gp',gp:'changes'},'gp-week':{tab:'gp',gp:'week'},'menu-engineering':{tab:'gp',gp:'engineering'},orders:{tab:'orders'},rota:{tab:'rota'},'kitchen-rota':{tab:'rota'},forecast:{tab:'kitchen',k:'forecast'},prep:{tab:'kitchen',k:'prep'},live:{tab:'kitchen',k:'live'},waste:{tab:'kitchen',k:'waste'},recipes:{tab:'kitchen',k:'recipes'},'recipe-cards':{tab:'kitchen',k:'recipes'},allergens:{tab:'kitchen',k:'allergens'},compliance:{tab:'kitchen',k:'compliance'},haccp:{tab:'kitchen',k:'haccp'},specials:{tab:'kitchen',k:'specials'},accidents:{tab:'kitchen',k:'accidents'},'new-dish':{tab:'creator'}};function Ie({go:e}){const{k:t,c:s,menu:i,now:o,rid:l,me:r}=(0,_.useChef)(3e4),d=(0,q.useSheetReminders)(),u=(0,_.useWeek)(),{covers:h,label:p,enough:f,booked:b}=(0,_.useForecast)(),k=(0,z.useSuggestions)(),y=t.ingredients.filter(e=>e.onHand<=0||(0,_.isLow)(e.onHand,e.par)),x=k.filter(e=>e.ordersToday&&!e.placedToday),j=(0,M.priceImpacts)(i,t.recipes,t.ingredients,t.targetGp).filter(e=>e.dropped.length),w=t.deliveries.filter(e=>'expected'===e.status),v=!t.recipes.length||!t.ingredients.length,C=v?[]:s.filter(e=>e.below),T=(0,n.useLiveState)(),P=(0,me.useRecipeCards)(l).filter(e=>!e.signOff),S=(0,J.useKitchenSummary)(l),[R,A]=(0,I.useState)(!1);return(0,ve.jsxs)($.default,{style:{gap:12},testID:"chef-dashboard",children:[(0,ve.jsx)(de.MissedBanner,{mode:"chef",now:o,onPress:()=>e('kitchen','haccp')}),d.map(t=>(0,ve.jsx)(H.default,{accessibilityRole:"button",onPress:()=>e('orders',t.supplierId),children:(0,ve.jsxs)(F.Banner,{kind:'red'===t.tone?'danger':'warn',title:`\u23f0 ${t.text}`,children:["Tap to open the ",t.name," order sheet. Nothing is sent until you press Send."]})},t.supplierId)),P.length?(0,ve.jsx)(H.default,{testID:"cards-awaiting",accessibilityRole:"button",onPress:()=>e('kitchen','recipes'),children:(0,ve.jsxs)(F.Banner,{kind:"warn",title:`${P.length} recipe card${1===P.length?'':'s'} awaiting your sign-off`,children:[P.slice(0,4).map(e=>e.dish).join(', '),". Guests see \"awaiting allergen sign-off\" and cannot order these until you sign them off."]})}):null,(0,ve.jsx)(Q.ShellfishTile,{rid:l,by:r,app:"chef",onOrder:()=>e('orders','os-kittyfisher')}),(0,ve.jsx)(F.Button,{testID:"chef-add-soldout",label:"Add sold out",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>A(!0),style:{minHeight:56}}),(0,ve.jsxs)(F.Row,{wrap:!0,gap:10,children:[c.PITCH?null:(0,ve.jsx)(_.Tile,{testID:"tile-gp",label:"Dishes under target GP",value:S.costed?`${S.below} of ${S.costed}`:'Nothing yet',sub:S.costed?`Average ${(0,_.pct1)(S.avgGp??0)} \xb7 target ${S.target}%`:'Record a delivery, then cost your recipe cards',tone:S.costed?S.below?'amber':'ok':void 0,onPress:()=>e('gp','dishes')}),c.PITCH?v?(0,ve.jsx)(_.Tile,{testID:"tile-gp",label:"GP this week vs target",value:"Nothing yet",sub:"Add ingredients and recipe costs to see GP",onPress:()=>e('gp','week')}):(0,ve.jsx)(_.Tile,{testID:"tile-gp",label:"GP this week vs target",value:(0,_.pct1)(u.theo),sub:`Target ${t.targetGp}% \xb7 actual ${(0,_.pct1)(u.actual)}`,tone:u.theoe('gp','week')}):null,c.PITCH?null:(0,ve.jsx)(_.Tile,{testID:"tile-stock",label:"Stock value",value:null!=S.stockValue?(0,L.gbp)(S.stockValue):'Nothing yet',sub:S.lastCount?`At cost, counted ${S.lastCount}`:'No stock counted yet',onPress:()=>e('stock','take')}),c.PITCH?(0,ve.jsx)(_.Tile,{testID:"tile-stock",label:"Stock value",value:t.ingredients.length?(0,L.gbp)((0,_.stockValue)(t.ingredients)):'Nothing yet',sub:t.ingredients.length?'At cost':'No stock counted yet',onPress:()=>e('stock','levels')}):null,(0,ve.jsx)(_.Tile,{label:"Items low or out",value:t.ingredients.length?`${y.length}`:'Nothing yet',sub:t.ingredients.length?y.slice(0,3).map(e=>e.name).join(', '):'No stock counted yet',tone:y.some(e=>e.onHand<=0)?'red':y.length?'amber':'ok',onPress:()=>e('stock','levels')}),(0,ve.jsx)(_.Tile,{label:"Waste this week",value:t.waste.length?(0,L.gbp)(u.wasteWeek):'Nothing yet',sub:u.sales?`${(0,_.pct1)(u.wasteWeek/u.sales*100)} of food sales`:'',onPress:()=>e('kitchen','waste')}),f?(0,ve.jsx)(_.Tile,{testID:"tile-forecast",label:"Covers forecast today",value:`${h}`,sub:p,onPress:()=>e('kitchen','forecast')}):(0,ve.jsx)(_.Tile,{testID:"tile-booked",label:"Booked so far today",value:'ready'===T?`${b}`:'connecting'===T?'Connecting\u2026':'Not connected',sub:"Not enough history for a forecast yet",onPress:()=>e('kitchen','bookings')}),(0,ve.jsx)(_.Tile,{label:"Orders due today",value:`${x.length}`,sub:x.map(e=>`${e.s.name} by ${e.s.cutoff}`).join(' \xb7 ')||'None',tone:x.some(e=>e.cutPassed)?'red':x.length?'amber':'ok',onPress:()=>e('orders')})]}),j.map(e=>(0,ve.jsxs)(F.Banner,{kind:"danger",title:`${e.ing.name} ${e.pct>0?'+':''}${e.pct.toFixed(0)}%: ${e.dropped.length} dish${1===e.dropped.length?'':'es'} drop below target`,children:[e.dropped.map(e=>e.item.name).join(', '),". Open GP \u203a Price changes."]},e.ing.id)),w.length?(0,ve.jsx)(H.default,{accessibilityRole:"button",onPress:()=>e('stock','deliveries'),children:(0,ve.jsx)(F.Banner,{kind:"info",title:`${w.length} deliver${1===w.length?'y':'ies'} to check in today`,children:"Count in against the order, flag shorts and price changes."})}):null,C.length?(0,ve.jsx)(H.default,{accessibilityRole:"button",onPress:()=>e('gp','dishes'),children:(0,ve.jsxs)(F.Banner,{kind:"warn",title:`${C.length} dishes below ${t.targetGp}% GP`,children:[C.slice(0,4).map(e=>e.item.name).join(', '),C.length>4?'\u2026':'']})}):null,(0,ve.jsx)(F.Row,{wrap:!0,gap:8,children:[['Recipe cards','recipes'],['Food safety log','haccp'],['Specials board','specials'],[re.CREATOR_TITLE,'creator'],['Forecast','forecast'],['Prep list','prep'],['Live tickets & sold out','live'],['Allergens','allergens'],['Accident book','accidents']].map(([t,s])=>(0,ve.jsx)(H.default,{accessibilityRole:"button",accessibilityLabel:t,onPress:()=>'creator'===s?e('creator'):e('kitchen',s),style:{flexGrow:1,flexBasis:140,padding:12,borderRadius:12,borderWidth:1.5,borderColor:N.colours.gold,backgroundColor:N.colours.surface},children:(0,ve.jsxs)(F.T,{weight:"semibold",children:[t," \u203a"]})},s))}),(0,ve.jsx)(F.Badge,{kind:"neutral",label:"Nothing is ordered or sent from here"}),(0,ve.jsx)(xe.SoldOutSheet,{visible:R,onClose:()=>A(!1),rid:l,by:r,hideLinks:!0,testID:"chef-soldout-sheet"})]})}},792,[793,978,884,979,986,1051,1052,1015,2,1053,1057,1058,1090,858,1095,1099,1100,1103,1104,1107,1108,1110,1111,1112,34,373,236,402,295,426,102,36,873,1137,794,867,821,1084,1139,1145,1148,1149,1152,1167,1165,1168,1169,1171,1172,1179,1182,1185,1193,1194,1198,1199,925,1003,1200,1158,1201,1208,1213,1222,1215,1156,1224,1228,1195,874,1229,1154,987,1230,25]); __d(function(_g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.styliseOnDevice=b,_e.pickPhoto=p,_e.AvatarMaker=function({meId:e,me:u}){const g=(0,i.useAvatars)(t=>t.photos[e]),[f,v]=(0,t.useState)(null),[y,x]=(0,t.useState)(null),[j,w]=(0,t.useState)(!1),[I,P]=(0,t.useState)(!1),[k,M]=(0,t.useState)('');(0,t.useEffect)(()=>()=>{f&&URL.revokeObjectURL(f)},[f]);const R='undefined'!=typeof document,S=async e=>{M('');const t=await p(e);if(t){P(!0),w(!1);try{const e=await b(t);f&&URL.revokeObjectURL(f),v(URL.createObjectURL(t)),x(e)}catch{M("That photo couldn't be opened. Try a different one (JPEG or PNG).")}finally{P(!1)}}},U=()=>{f&&URL.revokeObjectURL(f),v(null),x(null),w(!1)},B=u.replace(' (example)','');return(0,h.jsxs)(o.default,{style:{gap:12},testID:"avatar-maker",children:[(0,h.jsxs)(d.Box,{children:[(0,h.jsxs)(s.Row,{gap:14,children:[(0,h.jsx)(l.StaffAvatar,{id:e,size:88}),(0,h.jsxs)(o.default,{style:{flex:1,gap:4},children:[(0,h.jsx)(s.T,{weight:"semibold",size:17,children:B}),(0,h.jsxs)(s.Muted,{children:[g?`Your chosen avatar (saved ${new Date(g.at).toLocaleDateString('en-GB')}).`:'Your original crew avatar.'," It shows on rotas, chat, clock-in and sign-offs."]})]})]}),g?(0,h.jsx)(s.Button,{small:!0,kind:"secondary",label:"Back to my default avatar",testID:"avatar-own-reset",onPress:()=>{i.useAvatars.getState().reset(e,{id:e,role:'staff',name:B}),M('Back to your default avatar.')}}):null]}),(0,h.jsx)(d.Box,{children:(0,h.jsx)(n.AvatarOptions,{value:g?.dataUrl,onSelect:t=>{const a=i.useAvatars.getState().setOwn(e,e,t.dataUrl,B);M(a?`${t.name} is your avatar now.`:'Could not save your avatar.')}})}),(0,h.jsxs)(d.Box,{testID:"avatar-create",children:[(0,h.jsx)(s.T,{weight:"semibold",size:17,children:"Create my avatar from a photo"}),(0,h.jsx)(s.Muted,{children:"Upload a photo or take a selfie. Your phone turns it into a retro space-age avatar. The photo never leaves this device and isn't saved: only the finished avatar is kept."}),R?y?(0,h.jsxs)(o.default,{style:{gap:10},testID:"avatar-preview",children:[(0,h.jsxs)(s.Row,{gap:12,style:{justifyContent:'center'},children:[(0,h.jsxs)(o.default,{style:{alignItems:'center',gap:4},children:[f?(0,h.jsx)(a.default,{source:{uri:f},style:{width:96,height:96,borderRadius:12},accessibilityLabel:"Your photo"}):null,(0,h.jsx)(s.Muted,{children:"Your photo"})]}),(0,h.jsx)(s.T,{size:22,colour:c.colours.gold,children:"\u2192"}),(0,h.jsxs)(o.default,{style:{alignItems:'center',gap:4},children:[(0,h.jsx)(a.default,{source:{uri:y},style:{width:120,height:120,borderRadius:60,borderWidth:3,borderColor:c.colours.gold},accessibilityLabel:"Your new avatar preview",testID:"avatar-result"}),(0,h.jsx)(s.Muted,{children:"Your avatar"})]})]}),(0,h.jsxs)(r.default,{accessibilityRole:"checkbox",accessibilityState:{checked:j},accessibilityLabel:"I agree to use this avatar",testID:"avatar-consent",onPress:()=>w(!j),style:{flexDirection:'row',gap:10,alignItems:'flex-start',padding:10,borderRadius:12,borderWidth:1,borderColor:j?c.colours.gold:c.colours.border},children:[(0,h.jsx)(o.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:c.colours.gold,backgroundColor:j?c.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:j?(0,h.jsx)(s.T,{size:15,weight:"bold",colour:"#111",children:"\u2713"}):null}),(0,h.jsx)(s.T,{size:14,style:{flex:1},children:"I\u2019m happy for this avatar, made from my photo, to be shown to my team in CoverCharge. Only the finished avatar is shared; my photo isn\u2019t uploaded or kept, and a manager can reset my avatar."})]}),(0,h.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,h.jsx)(s.Button,{label:"Use as my avatar",testID:"avatar-save",disabled:!j,onPress:()=>{const t=i.useAvatars.getState().setOwn(e,e,y,B);M(t?'Saved: this is your avatar now.':"Couldn't save the avatar."),t&&U()}}),(0,h.jsx)(s.Button,{kind:"secondary",label:"Try another photo",onPress:U})]})]}):(0,h.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,h.jsx)(s.Button,{label:I?'Making your avatar\u2026':'Upload a photo',testID:"avatar-upload",disabled:I,onPress:()=>S(!1)}),(0,h.jsx)(s.Button,{kind:"secondary",label:"Take a selfie",testID:"avatar-selfie",disabled:I,onPress:()=>S(!0)})]}):(0,h.jsx)(s.Muted,{children:"Available in the web app."}),k?(0,h.jsx)(o.default,{testID:"avatar-msg",children:(0,h.jsx)(s.T,{size:14,colour:c.colours.ok,children:k})}):null]})]})};var t=_r(_d[0]),a=e(_r(_d[1]));_r(_d[2]);var r=e(_r(_d[3])),o=e(_r(_d[4])),s=_r(_d[5]),l=_r(_d[6]),n=_r(_d[7]),i=_r(_d[8]),c=_r(_d[9]),d=_r(_d[10]),h=_r(_d[11]);const u=['#1B1B1B','#4A3F35','#B89A72','#E9B949','#FFF4E0'].map(e=>[1,3,5].map(t=>parseInt(e.slice(t,t+2),16))),g=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5];function f(e){return new Promise((t,a)=>{const r=URL.createObjectURL(e),o=new window.Image;o.onload=()=>t({img:o,url:r}),o.onerror=()=>{URL.revokeObjectURL(r),a(new Error('bad image'))},o.src=r})}function v(e,t,a,r){e.beginPath(),e.moveTo(t,a-r),e.quadraticCurveTo(t+.18*r,a-.18*r,t+r,a),e.quadraticCurveTo(t+.18*r,a+.18*r,t,a+r),e.quadraticCurveTo(t-.18*r,a+.18*r,t-r,a),e.quadraticCurveTo(t-.18*r,a-.18*r,t,a-r),e.fill()}async function b(e){const{img:t,url:a}=await f(e);try{const e=112,a=256,r=document.createElement('canvas');r.width=e,r.height=e;const o=r.getContext('2d'),s=Math.min(t.width,t.height);o.drawImage(t,(t.width-s)/2,Math.max(0,(t.height-s)/2-.04*s),s,s,0,0,e,e);const l=o.getImageData(0,0,e,e),n=l.data,i=[];for(let e=0;ee-t),d=c[Math.floor(.04*c.length)],h=c[Math.floor(.96*c.length)]||255;for(let t=0;t{const a=document.createElement('input');a.type='file',a.accept='image/*',e&&a.setAttribute('capture','user'),a.onchange=()=>t(a.files?.[0]??null),a.click()})}},793,[34,336,236,402,102,794,925,929,926,821,930,25]); __d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"webLine",{enumerable:!0,get:function(){return W.webLine}}),_e.T=D,Object.defineProperty(_e,"H1",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"H2",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"Muted",{enumerable:!0,get:function(){return z}}),_e.BrandBar=A,_e.Screen=function({children:e,title:t,subtitle:r,back:o=!0,right:l,maxWidth:n=640,footer:s,scroll:c=!0}){const u=(0,B.jsxs)(x.default,{style:{width:'100%',maxWidth:n,alignSelf:'center',padding:16,gap:12,alignItems:'stretch'},children:[e,'customer'===S.APP_VARIANT?(0,B.jsx)(H,{}):null]});return(0,B.jsxs)(j.SafeAreaView,{style:{flex:1,backgroundColor:C.colours.bg},edges:['top','left','right'],children:[(0,B.jsx)(x.default,{style:{width:'100%',maxWidth:n,alignSelf:'center'},children:(0,B.jsx)(A,{title:t,subtitle:r,back:o,right:l})}),c?(0,B.jsx)(b.default,{contentContainerStyle:{paddingBottom:40},children:u}):(0,B.jsx)(x.default,{style:{flex:1},children:u}),s?(0,B.jsx)(x.default,{style:N.footer,children:(0,B.jsx)(x.default,{style:{width:'100%',maxWidth:n,alignSelf:'center'},children:s})}):null]})},_e.Button=v,_e.Card=F,_e.Badge=function({label:e,kind:t="neutral"}){const r={neutral:[C.colours.surface2,C.colours.muted,C.colours.border],gold:[C.colours.goldTint,C.colours.goldLight,C.colours.gold],red:[C.colours.redBg,'#FFD9D4',C.colours.red],amber:[C.colours.amberBg,'#FFE2A8',C.colours.amber],ok:[C.colours.okBg,C.colours.goldLight,C.colours.ok],blue:[C.colours.blueBg,C.colours.goldLight,C.colours.blue]}[t];return(0,B.jsx)(x.default,{style:[N.badge,{backgroundColor:r[0],borderColor:r[2],maxWidth:'100%',alignSelf:L?'center':'flex-start'}],children:(0,B.jsx)(D,{size:13,weight:"medium",colour:r[1],style:{flexShrink:1},children:e})})},_e.Banner=E,Object.defineProperty(_e,"ExampleAllergenNotice",{enumerable:!0,get:function(){return V}}),Object.defineProperty(_e,"DemoPaymentNotice",{enumerable:!0,get:function(){return $}}),_e.Row=O,Object.defineProperty(_e,"Divider",{enumerable:!0,get:function(){return _}}),_e.Field=function({label:e,...t}){return(0,B.jsxs)(x.default,{style:{gap:4,alignSelf:'stretch',width:'100%',minWidth:0,maxWidth:'100%'},children:[(0,B.jsx)(D,{size:C.font.small,weight:"medium",colour:C.colours.muted,center:!0,children:e}),(0,B.jsx)(o.TextInput,{accessibilityLabel:e,placeholderTextColor:"#7D776C",...t,style:[N.input,t.multiline&&{minHeight:70,textAlignVertical:'top'},t.style]})]})},_e.Chip=function({label:e,selected:t,onPress:r,disabled:o,sub:l,testID:n,accessibilityLabel:s}){return(0,B.jsxs)(h.default,{testID:n,accessibilityRole:"button",accessibilityState:{selected:!!t,disabled:!!o},accessibilityLabel:`${s??e}${!s&&l?`, ${l}`:''}${t?', selected':''}`,'aria-pressed':!!t,disabled:o,onPress:r,style:[N.chip,t&&{backgroundColor:C.colours.gold,borderColor:C.colours.gold},o&&{opacity:.35}],children:[(0,B.jsx)(D,{size:C.font.small,weight:"medium",colour:t?C.colours.onGold:C.colours.text,center:!0,children:e.trim()}),l?(0,B.jsx)(D,{size:12,colour:t?C.colours.onGold:C.colours.muted,center:!0,children:l}):null]})},_e.Toggle=function({value:e,onChange:t,label:r,testID:o,disabled:l,a11y:n}){return(0,B.jsxs)(O,{style:{justifyContent:'space-between',flexShrink:1,minWidth:0},children:[(0,B.jsx)(D,{style:{flex:1,flexShrink:1},children:r}),(0,B.jsx)(y.default,{testID:o,disabled:l,accessibilityLabel:n??r,value:e,onValueChange:t,trackColor:{true:C.colours.gold,false:'#444'},thumbColor:e?'#FFF6E0':'#BBB',activeThumbColor:'#FFF6E0',activeTrackColor:C.colours.gold})]})},_e.Stepper=function({value:e,onChange:t,min:r=1,max:o=20,label:l,step:n=1,format:s,testID:c}){const u=s?s(e):String(e),b=e=>Math.round(e/n)*n;return(0,B.jsxs)(O,{gap:10,children:[(0,B.jsx)(h.default,{testID:c?`${c}-down`:void 0,accessibilityRole:"button",accessibilityLabel:`Decrease ${l??''}`,disabled:e<=r,onPress:()=>t(Math.max(r,b(e-n))),style:[N.stepBtn,e<=r?{opacity:.4}:null],children:(0,B.jsx)(D,{size:20,colour:C.colours.gold,children:"\u2212"})}),(0,B.jsx)(x.default,{testID:c?`${c}-value`:void 0,accessibilityLabel:l?`${l}: ${u}`:u,children:(0,B.jsx)(D,{weight:"semibold",size:C.font.large,style:{minWidth:s?64:28,textAlign:'center'},children:u})}),(0,B.jsx)(h.default,{testID:c?`${c}-up`:void 0,accessibilityRole:"button",accessibilityLabel:`Increase ${l??''}`,disabled:e>=o,onPress:()=>t(Math.min(o,b(e+n))),style:[N.stepBtn,e>=o?{opacity:.4}:null],children:(0,B.jsx)(D,{size:20,colour:C.colours.gold,children:"+"})})]})},_e.Sheet=function({visible:e,onClose:o,title:l,children:n,maxWidth:c,testID:f,footer:y}){const{height:w}=(0,p.default)(),W=s.default.useContext(j.SafeAreaInsetsContext)??{top:0,bottom:0,left:0,right:0},k=(0,r.useTyping)(),S=(0,r.useVisibleArea)(),I=k&&S&&S.height({minHeight:44,minWidth:72,paddingHorizontal:14,borderRadius:22,borderWidth:1.5,borderColor:C.colours.gold,backgroundColor:e?'rgba(201,162,77,0.22)':'rgba(201,162,77,0.10)',alignItems:'center',justifyContent:'center'}),children:(0,B.jsx)(D,{size:15,weight:"semibold",colour:C.colours.goldLight,center:!0,children:"Done"})}):null,R?(0,B.jsx)(h.default,{accessibilityRole:"button",accessibilityLabel:"Close",onPress:o,hitSlop:8,testID:"sheet-close",style:{minWidth:72,minHeight:48,alignItems:'center',justifyContent:'center',marginRight:-8},children:(0,B.jsx)(D,{size:18,colour:C.colours.text,children:"Close"})}):(0,B.jsx)(t.GoldClose,{onPress:o,testID:"sheet-close",style:{marginRight:-6,minWidth:48,minHeight:48}})]}),(0,B.jsx)(b.default,{style:{flexShrink:1},contentContainerStyle:{gap:12,paddingTop:2,paddingBottom:4},children:n}),y?(0,B.jsx)(x.default,{style:{borderTopWidth:1,borderTopColor:C.colours.border,paddingTop:10,marginTop:8},testID:f?`${f}-footer`:void 0,children:y}):null]})})})},_e.SectionTitle=function({children:e}){return(0,B.jsx)(D,{weight:"semibold",size:12,colour:C.colours.goldMuted,center:!0,style:{textTransform:'uppercase',letterSpacing:1.6,marginTop:8},children:e})},Object.defineProperty(_e,"styles",{enumerable:!0,get:function(){return N}}),_r(d[0]);var t=_r(d[1]),r=_r(d[2]),o=_r(d[3]),l=_r(d[4]),n=_r(d[5]),s=e(_r(d[6])),c=e(_r(d[7])),u=e(_r(d[8]));_r(d[9]);var h=e(_r(d[10])),b=e(_r(d[11])),f=e(_r(d[12])),y=e(_r(d[13])),x=e(_r(d[14])),p=e(_r(d[15])),j=_r(d[16]),C=_r(d[17]),w=_r(d[18]),W=_r(d[19]),k=_r(d[20]),S=_r(d[21]),I=_r(d[22]),B=_r(d[23]);const R=['kirkton','abbotsford'].includes(k.VENUE_RID),L='display'!==S.APP_VARIANT;function D({children:e,style:t,size:r=C.font.body,weight:l="regular",colour:n=C.colours.text,numberOfLines:s,center:c,testID:u,accessibilityRole:h,accessibilityLabel:b}){const y='string'==typeof e&&/^(https?:\/\/|www\.)\S+$/.test(e.trim()),x=y?{minWidth:0,maxWidth:'100%',overflowWrap:'anywhere',wordBreak:'break-all',alignSelf:'stretch'}:void 0,p=f.default.flatten(t)||{},j=1===p.flex||1===p.flexGrow||'number'==typeof p.width||'left'===p.textAlign,k=c??(L&&('semibold'===l||'bold'===l)&&!j);return(0,B.jsx)(o.Text,{testID:u??(y?'cc-url':void 0),...k?{dataSet:{centre:'heading'}}:{},accessibilityRole:h,accessibilityLabel:b,numberOfLines:s,style:[{minWidth:0,fontFamily:C.fonts[l],fontSize:r,color:n,lineHeight:(0,w.lineFor)(r)},k&&{textAlign:'center',alignSelf:'center',maxWidth:'100%'},t,x,(0,W.webLine)(t,r),k&&'left'!==p.textAlign?{textAlign:'center'}:null],children:e})}const P=e=>(0,B.jsx)(D,{size:C.font.title,weight:"semibold",center:!0,...e}),T=e=>(0,B.jsx)(D,{size:C.font.large,weight:"semibold",center:!0,...e}),z=e=>(0,B.jsx)(D,{colour:C.colours.muted,size:C.font.small,...e,center:e.center??L});function A({title:e,back:t=!0,right:r,subtitle:o}){return(0,B.jsxs)(x.default,{style:N.brandBar,children:[(0,B.jsxs)(x.default,{style:N.row,children:[(0,B.jsx)(x.default,{style:N.brandSide,children:t?(0,B.jsx)(h.default,{accessibilityRole:"button",accessibilityLabel:"Back",onPress:()=>l.router.canGoBack()?l.router.back():l.router.replace(S.ENTRY[S.APP_VARIANT]),style:N.backBtn,hitSlop:10,children:(0,B.jsx)(D,{size:18,weight:"semibold",colour:C.colours.gold,children:"\u2039 Back"})}):null}),(0,B.jsx)(h.default,{onPress:()=>l.router.push(S.ENTRY[S.APP_VARIANT]),accessibilityLabel:"Home",style:N.brandCenter,children:(0,B.jsx)(I.RestaurantBrand,{size:I.HEADER_LOGO})}),(0,B.jsx)(x.default,{style:[N.brandSide,{alignItems:'flex-end'}],children:r?(0,B.jsx)(x.default,{style:{flexShrink:0},children:r}):null})]}),e?(0,B.jsx)(P,{style:{marginTop:10,alignSelf:'stretch'},children:e}):null,o?(0,B.jsx)(z,{center:!0,style:{alignSelf:'stretch'},children:o}):null]})}function H(){const e=(0,l.useLocalSearchParams)().rid??k.VENUE_RID,t=(0,n.useStore)(t=>t.restaurants.find(t=>t.id===e)?.contactEmail);return t?(0,B.jsx)(h.default,{accessibilityRole:"link",accessibilityLabel:`Email ${t}`,onPress:()=>{c.default.openURL(`mailto:${t}`)},style:{minHeight:44,justifyContent:'center',alignItems:'center',maxWidth:'100%'},children:(0,B.jsx)(D,{center:!0,size:14,colour:C.colours.gold,children:t})}):null}function v({label:e,sub:t,onPress:r,kind:o="primary",disabled:l,small:n,style:s,accessibilityLabel:c,accessibilityHint:u,testID:b}){const f={primary:C.colours.gold,secondary:C.colours.tile,danger:C.colours.redSolid,ghost:'transparent',success:C.colours.accentBg}[o],y={primary:C.colours.onGold,secondary:C.colours.text,danger:'#FFFFFF',ghost:C.colours.gold,success:C.colours.goldLight}[o],x={primary:'transparent',secondary:C.colours.hairline,danger:'transparent',ghost:'transparent',success:C.colours.accentBorder}[o];return(0,B.jsxs)(h.default,{testID:b,accessibilityRole:"button",accessibilityLabel:c??e,accessibilityHint:u,accessibilityState:{disabled:!!l},disabled:l,onPress:r,style:({pressed:e})=>[N.btn,{backgroundColor:e&&'secondary'===o?C.colours.tilePressed:f,borderColor:x,opacity:l?.4:e?.85:1},n&&{paddingVertical:8,paddingHorizontal:14,minHeight:w.control.min,minWidth:44},s],children:[(0,B.jsx)(D,{weight:"semibold",size:n?C.font.small:C.font.body,colour:y,center:!0,children:e.trim()}),t?(0,B.jsx)(D,{size:n?C.font.small-2:C.font.small,colour:y,center:!0,testID:b?`${b}-sub`:void 0,children:t}):null]})}function F({children:e,style:t,onPress:r,highlight:o}){const l=o===C.colours.gold||o===C.colours.accentBorder,n=(0,B.jsx)(x.default,{testID:"cc-card",style:[N.card,{alignItems:'stretch'},o?{borderColor:l?C.colours.accentBorder:o,borderWidth:l?1:2}:null,t],children:e});return r?(0,B.jsx)(h.default,{accessibilityRole:"button",onPress:r,style:({pressed:e})=>({opacity:e?.85:1}),children:n}):n}function E({kind:e="info",title:t,children:r}){const o={info:[C.colours.surface,C.colours.gold,C.colours.text],warn:[C.colours.amberBg,C.colours.amber,'#FFE2A8'],danger:[C.colours.redBg,C.colours.red,'#FFE3DF'],success:[C.colours.okBg,C.colours.ok,C.colours.goldLight],example:[C.colours.amberBg,C.colours.amber,'#FFE2A8'],demo:[C.colours.goldTint,C.colours.gold,C.colours.goldLight]}[e];return(0,B.jsxs)(x.default,{accessibilityRole:"summary",style:[N.banner,{backgroundColor:o[0],borderLeftColor:o[1]}],children:[t?(0,B.jsx)(D,{weight:"semibold",colour:o[2],center:!0,children:t}):null,s.default.Children.toArray(r).every(e=>'string'==typeof e||'number'==typeof e)?(0,B.jsx)(D,{size:C.font.small,colour:o[2],center:!0,children:r}):r]})}z.statusLine=!0,v.centreRow=!0;const V=()=>(0,B.jsx)(E,{kind:"example",title:"Allergens awaiting kitchen verification",children:"This allergen information has not been verified by the kitchen. Head chef sign-off is required. Always speak to staff about allergies."}),$=()=>(0,B.jsx)(E,{kind:"demo",title:"Card payments: not set up yet",children:"No card is charged and no payment provider is contacted."});function O({children:e,style:t,gap:r=8,wrap:o}){const l=s.default.Children.map(e,e=>{if(!s.default.isValidElement(e))return e;const t=e,r=f.default.flatten(t.props.style)||{};return 1!==r.flex&&1!==r.flexGrow?e:s.default.cloneElement(t,{style:[t.props.style,{minWidth:Math.max(t.type===F?240:180,'number'==typeof r.minWidth?r.minWidth:0)}]})}),n=f.default.flatten(t)||{},c=s.default.Children.toArray(l).filter(s.default.isValidElement),u=e=>e.type;if(L&&'space-between'===n.justifyContent&&1!==n.flex&&2===c.length&&c.some(e=>u(e).statusLine))return(0,B.jsx)(x.default,{dataSet:{centre:'status'},style:{alignItems:'center',alignSelf:'stretch',width:'100%',gap:r},children:c});const h=L&&c.length>=2&&c.every(e=>u(e).centreRow)&&'flex-start'!==n.justifyContent&&'space-between'!==n.justifyContent;return(0,B.jsx)(x.default,{...h?{dataSet:{centre:'buttons'}}:{},style:[N.row,{gap:r},h&&{justifyContent:'center',flexWrap:'wrap'},o&&{flexWrap:'wrap',justifyContent:'center'},t],children:l})}const _=()=>(0,B.jsx)(x.default,{style:{height:1,backgroundColor:C.colours.border,marginVertical:4}});const N=f.default.create({row:{flexDirection:'row',alignItems:'center',flexWrap:'wrap',minWidth:0,maxWidth:'100%'},brandBar:{paddingHorizontal:16,paddingTop:8,paddingBottom:8,borderBottomWidth:1,borderBottomColor:C.colours.border},brandSide:{width:96,minHeight:48,justifyContent:'center'},brandCenter:{flex:1,alignItems:'center',justifyContent:'center',minHeight:48},backBtn:{paddingRight:12,minHeight:48,minWidth:88,justifyContent:'center'},btn:{minWidth:0,maxWidth:'100%',flexShrink:1,borderRadius:w.radii.button,paddingVertical:12,paddingHorizontal:18,borderWidth:1,alignItems:'center',justifyContent:'center',minHeight:w.control.min,alignSelf:'stretch'},card:{minWidth:0,maxWidth:'100%',backgroundColor:C.colours.surface,borderRadius:C.radius.l,padding:16,borderWidth:1,borderColor:C.colours.hairline,gap:8},badge:{borderRadius:999,paddingHorizontal:9,paddingVertical:2,borderWidth:1,alignSelf:'flex-start'},banner:{borderRadius:C.radius.m,padding:12,borderLeftWidth:5,gap:2},input:{minWidth:0,boxSizing:'border-box',backgroundColor:C.colours.surface2,borderColor:C.colours.border,borderWidth:1,borderRadius:C.radius.m,paddingHorizontal:12,paddingVertical:10,color:C.colours.text,fontSize:C.font.body,fontFamily:C.fonts.regular},chip:{maxWidth:'100%',flexShrink:0,borderWidth:1,borderColor:C.colours.border,borderRadius:C.radius.m,paddingHorizontal:12,paddingVertical:8,backgroundColor:C.colours.surface2,minWidth:64,minHeight:44,justifyContent:'center'},stepBtn:{width:44,height:44,borderRadius:22,borderWidth:1.5,borderColor:C.colours.gold,alignItems:'center',justifyContent:'center'},overlay:{flex:1,backgroundColor:'rgba(0,0,0,0.7)',justifyContent:'center',alignItems:'center',padding:16},sheet:{backgroundColor:C.colours.surface,borderRadius:w.radii.xl,padding:18,width:'100%',maxWidth:520,maxHeight:'90%',borderWidth:1,borderColor:C.colours.gold},footer:{borderTopWidth:1,borderTopColor:C.colours.border,backgroundColor:C.colours.surface,padding:12}})},794,[795,796,830,827,30,831,34,379,395,236,402,295,41,410,102,426,36,821,826,871,5,872,873,25]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"RESPONSIVE_CSS",{enumerable:!0,get:function(){return t}});const t="\n*,*::before,*::after { box-sizing:border-box !important; }\nhtml,body { max-width:100%; overflow-x:hidden; }\ninput,select,textarea { box-sizing:border-box !important; min-width:0; max-width:100%; }\n[dir=\"auto\"] { overflow-wrap:break-word; }\n[data-testid^=\"area-summary-\"] [dir=\"auto\"] { overflow-wrap:normal; word-break:keep-all; text-align:center; }\n[data-testid=\"venue-header-name\"],\n[data-testid^=\"avatar-option-\"] [dir=\"auto\"] { overflow-wrap:normal !important; word-break:keep-all !important; }\n[data-testid=\"cc-card\"] { min-width:0; max-width:100%; overflow-x:hidden; }\n[data-testid=\"cc-card\"] > [dir=\"auto\"] { text-align:center; }\n[data-testid=\"cc-card\"] > * { min-width:0; max-width:100%; }\n";if('undefined'!=typeof document&&!document.getElementById('cc-responsive-sizing')){const n=document.createElement('style');n.id='cc-responsive-sizing',n.textContent=t,document.head.appendChild(n)}},795,[]); @@ -1095,7 +1095,7 @@ __d(function(g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule' __d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.setClockServer=function(t){s=t,c()},e.markClockUnsent=function(t){o.set(t,Date.now()),c()},e.markClockSent=function(t){o.delete(t)&&c()},e.clockNotSent=l,e.useClockNotSent=function(o){const[,c]=(0,t.useState)(0);return(0,t.useEffect)(()=>{const t=()=>c(t=>t+1);u.add(t);const o=n.mutationQueue.subscribe(t);return()=>{u.delete(t),o()}},[]),l(o)};var t=r(d[0]),n=r(d[1]);const o=new Map,u=new Set,c=()=>{for(const t of u)t()};let s=()=>!1;function l(t){if(!t)return!1;return n.mutationQueue.pending.some(n=>'attendance'===n.table&&n.rowKey===t)||o.has(t)&&s()}n.mutationQueue.onDone(t=>{'attendance'===t.table&&o.delete(t.rowKey)&&c()})},1012,[34,1013]); __d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"MutationQueue",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"mutationQueue",{enumerable:!0,get:function(){return o}});var t=_r(d[0]),e=_r(d[1]),s=_r(d[2]);const n='queue:v1',r='queue:failed:v1',h=t=>`${t.table}|${t.venueId}|${t.rowKey}`;class l{items=[];failedItems=[];loaded=null;flushing=null;flushingSince=0;exec=null;listeners=new Set;onFailure=new Set;onSaved=new Set;retryTimer=null;waitTimer=null;backoffMs=2e3;now=()=>Date.now();constructor(){(0,t.onConnectivity)(t=>{t&&this.flush()})}setExecutor(t){this.exec=t}load(){return this.loaded||(this.loaded=(async()=>{const t=await e.kv.get(n,[]);this.items=[...t.map(t=>({...t,nextAt:void 0})),...this.items],this.failedItems=await e.kv.get(r,[]),this.emit()})()),this.loaded}get pending(){return this.items}get waiting(){return this.items.filter(t=>t.attempts>0)}get failed(){return this.failedItems}hasPending(t,e,s){return this.items.some(n=>n.table===t&&n.venueId===e&&n.rowKey===s)}async enqueue(t){await this.load();const s={...t,id:(0,e.uuid)(),createdAt:(new Date).toISOString(),attempts:0};return this.items.push(s),await this.persist(),this.flush(),s}nextReady(){const t=new Set,e=this.now();for(const s of this.items){const n=h(s);if(!t.has(n)){if(!(s.nextAt&&s.nextAt>e))return s;t.add(n)}}}remove(t){this.items=this.items.filter(e=>e!==t)}flush(){if(this.flushing&&Date.now()-this.flushingSince<6e4)return this.flushing;this.flushingSince=Date.now();let e=null;return e=(async()=>{for(await this.load();this.exec;){if(this.flushing&&this.flushing!==e)return;const n=this.nextReady();if(!n)break;if(!(0,t.isOnline)()){this.scheduleRetry();break}try{const t=await this.exec(n);this.remove(n),this.backoffMs=2e3,'conflict'===t?this.fail(n,'conflict','Row changed on the server (version conflict) or is not visible to you'):this.onSaved.forEach(t=>t(n))}catch(e){n.attempts+=1,n.lastError=String(e?.message??e);const r=e??{};n.lastErr={code:r.code?String(r.code):void 0,status:Number(r.status)||void 0,message:n.lastError.slice(0,300)};const h=(0,s.classifyWriteError)(e);if('network'===h){n.attempts-=1,(0,t.setOnline)(!1),this.scheduleRetry(),await this.persist();break}'retry'===h?n.nextAt=this.now()+(0,s.retryDelayMs)(n.attempts):(this.remove(n),this.fail(n,'rejected',n.lastError))}await this.persist()}this.flushing===e&&(this.flushing=null),this.scheduleWaiting()})(),this.flushing=e,e}retryNow(){for(const t of this.items)t.nextAt=void 0;return this.flush()}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}onFailed(t){return this.onFailure.add(t),()=>{this.onFailure.delete(t)}}onDone(t){return this.onSaved.add(t),()=>{this.onSaved.delete(t)}}async clearFailed(){this.failedItems=[],await e.kv.set(r,[]),this.emit()}fail(t,s,n){const h={...t,lastError:n,failedAt:(new Date).toISOString(),reason:s};this.failedItems=[h,...this.failedItems].slice(0,100),e.kv.set(r,this.failedItems),this.onFailure.forEach(t=>t(h))}scheduleWaiting(){this.waitTimer&&(clearTimeout(this.waitTimer),this.waitTimer=null);const t=this.items.map(t=>t.nextAt??0).filter(t=>t>0);if(!t.length)return;const e=Math.max(500,Math.min(...t)-this.now());this.waitTimer=setTimeout(()=>{this.waitTimer=null,this.flush()},e)}scheduleRetry(){if(this.retryTimer)return;const e=this.backoffMs;this.backoffMs=Math.min(2*this.backoffMs,6e4),this.retryTimer=setTimeout(()=>{this.retryTimer=null,(0,t.setOnline)(!0),this.flush()},e)}async persist(){await e.kv.set(n,this.items),this.emit()}emit(){this.listeners.forEach(t=>t())}}const o=new l},1013,[1010,977,1014]); __d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.classifyWriteError=function(o){if((0,e.isNetworkError)(o))return'network';const{code:n,status:c,msg:l}=t(o);return s(o)?'refused':/^(08|53|57|58)/.test(n)||['40001','40P01','55P03','23505','23503'].includes(n)||/^PGRST30[0-3]$/.test(n)||/jwt|token.*expired/i.test(l)||401===c||408===c||425===c||429===c||c>=500?'retry':409!==c||n?'refused':'retry'},Object.defineProperty(_e,"retryDelayMs",{enumerable:!0,get:function(){return o}}),_e.describeWrite=function(e){const t='rpc'===e.kind?(e.fn??'change').replace(/_/g,' '):n[e.table]??e.table.replace(/_/g,' ').replace(/s$/,''),s=e.values??{},o=s.guest_name??s.name??s.display_name??s.title??s.reason,c='string'==typeof o&&o.trim()?` for ${o.trim().slice(0,60)}`:'';return'delete'===e.kind?`deleting a ${t}${c}`:`the ${t}${c}`},_e.plainReason=function(e,o){const{code:n,status:c,msg:l}=t(e);if('refused'===o)return s(e)?'more than 20 deletes in 10 minutes from one sign-in are stopped to keep your data safe':'42501'===n||403===c||/row-level security|permission/i.test(l)?'your sign-in isn\u2019t allowed to change this':'conflict'===n?'it was changed or removed on another device first':/^(22|23)/.test(n)?'the shared system says some of the details aren\u2019t valid':'P0001'===n&&l?l.slice(0,140):l?`the shared system said: ${l.slice(0,120)}`:'the shared system refused it';return'23505'===n?'the shared system already has another copy of it':'23503'===n?'a related change has to save first':/^PGRST30/.test(n)||401===c||/jwt/i.test(l)?'your sign-in is being refreshed':'the shared system is busy'};var e=r(d[0]);const t=e=>{const t=e&&'object'==typeof e?e:{};return{msg:String(t.message??e??''),code:String(t.code??''),status:Number(t.status??0)||0,hint:String(t.hint??'')}},s=e=>{const s=t(e);return/delete guard/i.test(s.hint)||/too many .* deleted in 10 minutes/i.test(s.msg)};const o=e=>Math.min(5e3*Math.pow(3,Math.max(0,e-1)),3e5),n={bookings:'booking',walk_ins:'walk-in',blocks:'blocked time',sold_out_items:'sold-out mark',sold_out_links:'dish stock link',staff:'staff details',rota_shifts:'rota shift',stock_items:'stock item',stock_events:'stock count',stock_counts:'stock count',chat_messages:'chat message',recipe_cards:'recipe card',order_lists:'order list',order_list_items:'order list item',daily_task_ticks:'task tick',daily_tasks:'daily task',attendance:'clock in or out',cash_ups:'cash-up',table_plans:'table plan',guest_profiles:'guest profile',floor_live:'table status',venues:'venue settings',time_requests:'clock correction request',staff_leave:'time off',scheduled_notifications:'reminder',suppliers:'supplier',supplier_orders:'supplier order',takeaway_orders:'takeaway order'}},1014,[1010]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"APP_VERSION",{enumerable:!0,get:function(){return t}});const t='v0.3.12.160'},1015,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"APP_VERSION",{enumerable:!0,get:function(){return t}});const t='v0.3.12.161'},1015,[]); __d(function(g,_r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"TableRepository",{enumerable:!0,get:function(){return c}}),e.executeMutation=async function(t){const s=(t,s)=>{throw Object.assign(t,{status:s})};if('rpc'===t.kind){const{error:n,status:r}=await u().rpc(t.fn,t.values??{});return n&&s(n,r),'ok'}const n=u().from(t.table);if('upsert'===t.kind||'insert'===t.kind){const{error:r,status:o}=await n.upsert(t.values??{},{onConflict:t.conflictKey??'id',ignoreDuplicates:'insert'===t.kind});return r&&s(r,o),'ok'}let r='update'===t.kind?n.update(t.values??{}):n.delete();for(const[s,n]of Object.entries(t.match??{}))r=r.eq(s,n);const{data:o,error:c,status:h}=await r.select();c&&s(c,h);return'update'!==t.kind||o&&0!==o.length?'ok':'conflict'};var t=_r(d[0]),s=_r(d[1]),n=_r(d[2]),r=_r(d[3]),o=_r(d[4]);const u=()=>(0,n.getSupabase)();class c{constructor(t,s={}){this.table=t,this.opts=s,this.keyOf=s.keyOf??(t=>String(t.id)),this.keyColumns=s.keyColumns??['id'],this.venueCol=s.venueColumn??'venue_id'}rows(t){return s.cache.rows(this.table,t)}get(t,n){return s.cache.get(this.table,t,n)}subscribe(t,n){return s.cache.subscribe(this.table,t,n)}hydrate(t){return s.cache.hydrate(this.table,t)}async refresh(n,r={}){const c=()=>{let t=u().from(this.table).select('*').eq(this.venueCol,n);return this.opts.orderBy&&(t=t.order(this.opts.orderBy.column,{ascending:this.opts.orderBy.ascending??!0})),r.filter&&(t=r.filter(t)),t},h='bookings'===this.table?await(0,t.readPages)(async(t,s)=>{const{data:n,error:r}=await c().order('id').range(t,s);if(r)throw r;return n??[]}):await(async()=>{const{data:t,error:s}=await c().limit(this.opts.limit??1e3);if(s)throw s;return t??[]})();return s.cache.replace(this.table,n,h.map(t=>[this.keyOf(t),t]),t=>o.mutationQueue.hasPending(this.table,n,t)),h}async create(t,n){const u={...1===this.keyColumns.length&&'id'===this.keyColumns[0]?{id:(0,r.uuid)()}:{},...n,[this.venueCol]:t},c=this.keyOf(u);return s.cache.put(this.table,t,c,u),await o.mutationQueue.enqueue({table:this.table,venueId:t,kind:'insert'===this.opts.writeMode?'insert':'upsert',rowKey:c,values:u,conflictKey:this.opts.conflictKey??'id'}),u}async update(t,n,r,u={}){const c=s.cache.get(this.table,t,n),h={...this.matchFor(n,c),...u,[this.venueCol]:t};s.cache.patch(this.table,t,n,{...r,updated_at:(new Date).toISOString()}),await o.mutationQueue.enqueue({table:this.table,venueId:t,kind:'update',rowKey:n,values:r,match:h})}async remove(t,n){const r=s.cache.get(this.table,t,n),u={...this.matchFor(n,r),[this.venueCol]:t};s.cache.remove(this.table,t,n),await o.mutationQueue.enqueue({table:this.table,venueId:t,kind:'delete',rowKey:n,match:u})}matchFor(t,s){if(1===this.keyColumns.length&&'id'===this.keyColumns[0])return{id:t};const n={};for(const t of this.keyColumns)n[t]=s?.[t];return n}}},1016,[1017,1018,933,977,1013]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.readPages=async function(t,n=1e3){const s=[];for(let c=0;;c+=n){const o=await t(c,c+n-1);if(s.push(...o),o.length`cache:${t}:${n}`;function f(t){let s=n.get(t);return s||(s=new Map,n.set(t,s)),s}function p(n){s.delete(n),c.get(n)?.forEach(t=>t());const u=o.get(n);u&&clearTimeout(u),o.set(n,setTimeout(()=>{o.delete(n),t.kv.set(n,Array.from(f(n).entries()))},250))}const w={async hydrate(n,s){const c=l(n,s);if(u.has(c))return;u.add(c);const o=await t.kv.get(c,[]),w=f(c);let h=0;for(const[t,n]of o)w.has(t)||(w.set(t,n),h++);h&&p(c)},rows(t,n){const c=l(t,n);let o=s.get(c);return o||(o=Array.from(f(c).values()),s.set(c,o)),o},get:(t,n,s)=>f(l(t,n)).get(s),put(t,n,s,c){f(l(t,n)).set(s,c),p(l(t,n))},patch(t,n,s,c){const o=f(l(t,n)),u=o.get(s);u&&(o.set(s,{...u,...c}),p(l(t,n)))},remove(t,n,s){f(l(t,n)).delete(s)&&p(l(t,n))},replace(t,s,c,o=()=>!1){const u=l(t,s),w=f(u),h=new Map(c);w.forEach((t,n)=>{o(n)&&h.set(n,t)}),n.set(u,h),p(u)},subscribe(t,n,s){const o=l(t,n);let u=c.get(o);return u||(u=new Set,c.set(o,u)),u.add(s),()=>{u?.delete(s)}},async clearVenue(o,f){for(const p of f){const f=l(p,o);n.delete(f),s.delete(f),u.delete(f),await t.kv.remove(f),c.get(f)?.forEach(t=>t())}}}},1018,[977]); @@ -1197,7 +1197,7 @@ __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule', __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SEATED_BG",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"SEATED_FG",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"SEATED_MUTED",{enumerable:!0,get:function(){return u}}),e.isSeatedHighlight=function(t,o){return'seated'===t&&!o?.otherDay},e.seatedHighlightStyle=function(u){return{backgroundColor:o,borderColor:t.colours.goldLight,borderWidth:1.5,borderLeftWidth:8,borderLeftColor:n,...u}};var t=r(d[0]);const o=t.colours.gold,n=t.colours.onGold,u='#3F3218'},1114,[821]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.BookingTableButton=function({rid:e,booking:l,readOnly:y,turnBase:B=90,testID:f}){const[h,j]=(0,t.useState)(!1),k=(0,s.tableButtonLabel)(l.table),x=f??`table-btn-${l.id}`;if(y)return(0,c.jsx)(n.default,{testID:x,accessible:!0,accessibilityLabel:(0,s.tableButtonA11y)(l.table,!0),style:{minHeight:44,justifyContent:'center'},children:(0,c.jsx)(b.T,{size:16,weight:"semibold",colour:o.colours.goldLight,children:k})});return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(b.Button,{kind:"secondary",label:k,testID:x,accessibilityLabel:(0,s.tableButtonA11y)(l.table),onPress:()=>j(!0),style:{minHeight:44}}),h?(0,c.jsx)(u.TablePicker,{rid:e,booking:l,name:l.walkIn?'Walk-in':(l.name??'').replace(' (example)',''),turnBase:B,onClose:()=>j(!1)}):null]})};var e,t=r(d[0]),l=r(d[1]),n=(e=l)&&e.__esModule?e:{default:e},s=r(d[2]),o=r(d[3]),u=r(d[4]),b=r(d[5]),c=r(d[6])},1115,[34,102,1116,821,1117,794,25]); __d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"tableButtonLabel",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"tableButtonA11y",{enumerable:!0,get:function(){return s}}),e.tableOptions=function(t,n,o){const s=t.tables.map(t=>t.name).sort(l),c=new Set;return(t.joins??[]).forEach(t=>{t.tables.length>1&&c.add(t.tables.slice().sort(l).join('+'))}),[...n.map(t=>t.table),o].forEach(t=>{const n=a(t);n.length>1&&c.add(n.slice().sort(l).join('+'))}),[...s,...[...c].sort(l)]},e.tableOverlaps=function(t,l,o,s=90){const c=a(l);if(!c.length)return[];const b={...t,table:l};return o.filter(l=>l.id!==t.id&&l.date===t.date&&!['cancelled','noshow','finished'].includes(l.status)&&a(l.table).some(t=>c.includes(t))&&(0,n.startOf)(b)<(0,n.endOf)(l,s)&&(0,n.startOf)(l)<(0,n.endOf)(b,s))},Object.defineProperty(e,"tablePatch",{enumerable:!0,get:function(){return c}});var t=r(d[0]),n=r(d[1]);const a=t=>t?t.split('+').map(t=>t.trim()).filter(Boolean):[],l=(t,n)=>t.localeCompare(n,'en-GB',{numeric:!0}),o=n=>(0,t.tableNumbers)(n)||'No table',s=(n,a)=>`${(0,t.tableNumbersA11y)(n)}${a?'':', change table'}`;const c=t=>({table:t||void 0,tableSetHere:!0})},1116,[860,1101]); -__d(function(_g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.saveBookingTables=v,_e.TablePicker=function({rid:e,booking:u,name:g,turnBase:k=90,onClose:$,onSaved:w,onPickOnPlan:C}){const L=(0,b.usePlan)(e),S=(0,c.useBookings)(e),[T,P]=(0,l.useState)(()=>(0,b.tablesOf)((0,h.tableKey)((0,b.tablesOf)(u.table)))),W=(0,l.useMemo)(()=>(0,h.pickGroups)(L),[L]),z=S.filter(e=>e.date===u.date),I=(0,h.seatsOf)(L,T),D=(0,h.seatLine)(I.total,u.partySize),B=(0,h.pickClashes)(u,T,z,k),O=e=>(0,h.pickClashes)(u,[e],z,k)[0]?.with,R=(0,h.tableKey)(T)!==(0,h.tableKey)((0,b.tablesOf)(u.table)),M=(0,f.useBlocks)(e=>e.blocks),N=(0,f.blockAt)(M,e,u.date,u.time),[_,A]=(0,l.useState)(null),G=e=>{A(null),P(t=>(0,h.toggleTable)(t,e))},Y=async t=>{try{await v(e,u,t),w?.((0,h.savedWords)(g,u.partySize,t,(0,h.seatsOf)(L,t).total)),$()}catch(e){w?.(`Couldn\u2019t save tables for ${g}: ${String(e?.message??e).slice(0,120)}`)}},K=(0,x.jsxs)(n.default,{style:{gap:8},children:[(0,x.jsxs)(n.default,{testID:"table-pick-total",accessible:!0,accessibilityLabel:`${(0,h.tablesWords)(T)} picked. ${D.text}.`,children:[(0,x.jsx)(p.T,{size:18,weight:"semibold",center:!0,colour:y.colours.goldLight,children:(0,h.tablesWords)(T)}),(0,x.jsx)(p.T,{size:17,center:!0,colour:y.colours.text,children:D.text})]}),N?(0,x.jsx)(n.default,{testID:"table-pick-pause",accessible:!0,accessibilityLabel:`Note. New bookings are paused ${N.from} to ${N.to}${N.reason?` (${N.reason})`:''}. You can still assign tables to this booking.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:y.colours.goldMuted},children:(0,x.jsxs)(p.T,{size:16,center:!0,colour:y.colours.goldLight,children:["New bookings paused ",N.from,"\u2013",N.to,N.reason?` \xb7 ${N.reason}`:'',". You can still save tables for this booking."]})}):null,B.length?(0,x.jsx)(n.default,{testID:"table-pick-clash",accessible:!0,accessibilityLabel:`Warning. ${(0,h.clashWords)(B)} You can still save.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:y.colours.gold},children:(0,x.jsxs)(p.T,{size:16,weight:"semibold",center:!0,colour:y.colours.goldLight,children:[(0,h.clashWords)(B)," You can still save."]})}):null,_?(0,x.jsxs)(n.default,{testID:"table-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:_,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:y.colours.amber,backgroundColor:y.colours.amberBg,alignItems:'stretch'},children:[(0,x.jsx)(p.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:_}),(0,x.jsxs)(p.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,x.jsx)(p.Button,{testID:"table-pick-overcap-yes",label:"Use it anyway",accessibilityLabel:`Use it anyway, ${(0,h.tablesWords)(T)} for ${g}, ${u.partySize} people`,onPress:()=>{Y(T)},style:[j,{flexGrow:1}]}),(0,x.jsx)(p.Button,{testID:"table-pick-overcap-no",kind:"secondary",label:"Pick another table",onPress:()=>A(null),style:j})]})]}):null,(0,x.jsxs)(p.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[_?null:(0,x.jsx)(p.Button,{testID:"table-pick-save",label:B.length?'Save anyway':'Save tables',disabled:!R||!T.length,accessibilityLabel:`${B.length?'Save anyway, ':'Save, '}${(0,h.tablesWords)(T)} for ${g}. ${D.text}.${B.length?` ${(0,h.clashWords)(B)}`:''}`,onPress:()=>{const e=(0,h.overCapacityAsk)(T,I.total,u.partySize);!e||_?Y(T):A(e)},style:[j,{flexGrow:1}]}),(0,b.tablesOf)(u.table).length?(0,x.jsx)(p.Button,{testID:"table-pick-clear",kind:"secondary",label:"Clear table",accessibilityLabel:`Clear table, take ${(0,h.tablesWords)((0,b.tablesOf)(u.table)).toLowerCase()} off ${g}`,onPress:()=>Y([]),style:j}):null,(0,x.jsx)(p.Button,{testID:"table-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",onPress:$,style:j})]})]});return(0,x.jsxs)(p.Sheet,{visible:!0,onClose:$,title:`Tables \xb7 ${u.time} ${g} \xb7 ${u.partySize} Covers`,maxWidth:760,testID:"table-picker",footer:K,children:[(0,x.jsx)(t.TableNumberWarning,{plan:L}),(0,x.jsx)(p.T,{size:16,center:!0,colour:y.colours.text,children:"Tap one table, or several to join them. Tap again to take one off. Smaller tables can still be used."}),C?(0,x.jsx)(p.Button,{kind:"secondary",testID:"table-pick-on-plan",label:"Pick on the table plan",accessibilityLabel:`Pick on the table plan instead, for ${g}`,onPress:()=>C(T),style:j}):null,W.map(e=>(0,x.jsxs)(n.default,{style:{gap:6},accessibilityLabel:e.area,children:[(0,x.jsx)(p.T,{size:15,weight:"semibold",center:!0,colour:y.colours.gold,children:e.area}),(0,x.jsx)(p.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:e.tables.map(e=>{const t=T.includes(e.name),l=O(e.name);return(0,x.jsxs)(o.default,{testID:`table-pick-${e.name}`,accessibilityRole:"checkbox",accessibilityState:{checked:t},'aria-checked':t,accessibilityLabel:(0,h.pickA11y)(e.name,e.seats,t,l),onPress:()=>G(e.name),style:({pressed:e})=>({minWidth:92,minHeight:64,paddingHorizontal:10,paddingVertical:6,borderRadius:12,alignItems:'center',justifyContent:'center',borderWidth:t?2:1,borderColor:t?y.colours.gold:l?y.colours.goldMuted:y.colours.hairline,borderStyle:l&&!t?'dashed':'solid',backgroundColor:t?y.colours.gold:e?y.colours.tilePressed:y.colours.tile}),children:[(0,x.jsx)(p.T,{size:18,weight:"semibold",colour:t?y.colours.onGold:y.colours.text,children:(0,s.tableNumbers)(e.name)}),(0,x.jsxs)(p.T,{size:14,colour:t?y.colours.onGold:y.colours.muted,children:[e.seats," seats",l?' \xb7 booked':'']})]},e.name)})})]},e.area)),W.length?null:(0,x.jsx)(p.Muted,{center:!0,children:"No tables on the plan yet. Add them in Setup \u203a Table plan."})]})};var t=r(d[0]),s=r(d[1]),l=r(d[2]),o=e(r(d[3])),n=e(r(d[4])),c=r(d[5]),b=r(d[6]),u=r(d[7]),h=r(d[8]),y=r(d[9]),g=r(d[10]),p=r(d[11]),k=r(d[12]),f=r(d[13]),x=r(d[14]);const j={minHeight:56};async function v(e,t,s){const l=(0,h.tableKey)(s),o=(0,b.tablesOf)(t.table);await c.repo.bookings.update(t.id,(0,u.tablePatch)(l||null)),'seated'===t.status&&t.date===(0,g.venueYmd)(new Date)&&(o.filter(e=>!(0,b.tablesOf)(l).includes(e)).forEach(t=>b.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!0})),l&&(0,k.resetTableLive)(e,l))}},1117,[1118,860,34,402,102,874,1025,1116,1119,821,858,794,1120,1022,25]); +__d(function(_g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.saveBookingTables=v,_e.TablePicker=function({rid:e,booking:u,name:g,turnBase:k=90,onClose:$,onSaved:w,onPickOnPlan:C}){const L=(0,b.usePlan)(e),S=(0,c.useBookings)(e),[T,P]=(0,l.useState)(()=>(0,b.tablesOf)((0,h.tableKey)((0,b.tablesOf)(u.table)))),W=(0,l.useMemo)(()=>(0,h.pickGroups)(L),[L]),z=S.filter(e=>e.date===u.date),I=(0,h.seatsOf)(L,T),D=(0,h.seatLine)(I.total,u.partySize),B=(0,h.pickClashes)(u,T,z,k),O=e=>(0,h.pickClashes)(u,[e],z,k)[0]?.with,R=(0,h.tableKey)(T)!==(0,h.tableKey)((0,b.tablesOf)(u.table)),M=(0,f.useBlocks)(e=>e.blocks),N=(0,f.blockAt)(M,e,u.date,u.time),[_,A]=(0,l.useState)(null),G=e=>{A(null),P(t=>(0,h.toggleTable)(t,e))},Y=async t=>{try{await v(e,u,t),w?.((0,h.savedWords)(g,u.partySize,t,(0,h.seatsOf)(L,t).total)),$()}catch(e){w?.(`Couldn\u2019t save tables for ${g}: ${String(e?.message??e).slice(0,120)}`)}},K=(0,x.jsxs)(n.default,{style:{gap:8},children:[(0,x.jsxs)(n.default,{testID:"table-pick-total",accessible:!0,accessibilityLabel:`${(0,h.tablesWords)(T)} picked. ${D.text}.`,children:[(0,x.jsx)(p.T,{size:18,weight:"semibold",center:!0,colour:y.colours.goldLight,children:(0,h.tablesWords)(T)}),(0,x.jsx)(p.T,{size:17,center:!0,colour:y.colours.text,children:D.text})]}),N?(0,x.jsx)(n.default,{testID:"table-pick-pause",accessible:!0,accessibilityLabel:`Note. New bookings are paused ${N.from} to ${N.to}${N.reason?` (${N.reason})`:''}. You can still assign tables to this booking.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:y.colours.goldMuted},children:(0,x.jsxs)(p.T,{size:16,center:!0,colour:y.colours.goldLight,children:["New bookings paused ",N.from,"\u2013",N.to,N.reason?` \xb7 ${N.reason}`:'',". You can still save tables for this booking."]})}):null,B.length?(0,x.jsx)(n.default,{testID:"table-pick-clash",accessible:!0,accessibilityLabel:`Warning. ${(0,h.clashWords)(B)} You can still save.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:y.colours.gold},children:(0,x.jsxs)(p.T,{size:16,weight:"semibold",center:!0,colour:y.colours.goldLight,children:[(0,h.clashWords)(B)," You can still save."]})}):null,_?(0,x.jsxs)(n.default,{testID:"table-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:_,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:y.colours.gold,backgroundColor:y.colours.amberBg,alignItems:'stretch'},children:[(0,x.jsx)(p.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:_}),(0,x.jsxs)(p.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,x.jsx)(p.Button,{testID:"table-pick-overcap-yes",label:"Use it anyway",accessibilityLabel:`Use it anyway, ${(0,h.tablesWords)(T)} for ${g}, ${u.partySize} people`,onPress:()=>{Y(T)},style:[j,{flexGrow:1}]}),(0,x.jsx)(p.Button,{testID:"table-pick-overcap-no",kind:"secondary",label:"Pick another table",onPress:()=>A(null),style:j})]})]}):null,(0,x.jsxs)(p.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[_?null:(0,x.jsx)(p.Button,{testID:"table-pick-save",label:B.length?'Save anyway':'Save tables',disabled:!R||!T.length,accessibilityLabel:`${B.length?'Save anyway, ':'Save, '}${(0,h.tablesWords)(T)} for ${g}. ${D.text}.${B.length?` ${(0,h.clashWords)(B)}`:''}`,onPress:()=>{const e=(0,h.overCapacityAsk)(T,I.total,u.partySize);!e||_?Y(T):A(e)},style:[j,{flexGrow:1}]}),(0,b.tablesOf)(u.table).length?(0,x.jsx)(p.Button,{testID:"table-pick-clear",kind:"secondary",label:"Clear table",accessibilityLabel:`Clear table, take ${(0,h.tablesWords)((0,b.tablesOf)(u.table)).toLowerCase()} off ${g}`,onPress:()=>Y([]),style:j}):null,(0,x.jsx)(p.Button,{testID:"table-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",onPress:$,style:j})]})]});return(0,x.jsxs)(p.Sheet,{visible:!0,onClose:$,title:`Tables \xb7 ${u.time} ${g} \xb7 ${u.partySize} Covers`,maxWidth:760,testID:"table-picker",footer:K,children:[(0,x.jsx)(t.TableNumberWarning,{plan:L}),(0,x.jsx)(p.T,{size:16,center:!0,colour:y.colours.text,children:"Tap one table, or several to join them. Tap again to take one off. Smaller tables can still be used."}),C?(0,x.jsx)(p.Button,{kind:"secondary",testID:"table-pick-on-plan",label:"Pick on the table plan",accessibilityLabel:`Pick on the table plan instead, for ${g}`,onPress:()=>C(T),style:j}):null,W.map(e=>(0,x.jsxs)(n.default,{style:{gap:6},accessibilityLabel:e.area,children:[(0,x.jsx)(p.T,{size:15,weight:"semibold",center:!0,colour:y.colours.gold,children:e.area}),(0,x.jsx)(p.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:e.tables.map(e=>{const t=T.includes(e.name),l=O(e.name);return(0,x.jsxs)(o.default,{testID:`table-pick-${e.name}`,accessibilityRole:"checkbox",accessibilityState:{checked:t},'aria-checked':t,accessibilityLabel:(0,h.pickA11y)(e.name,e.seats,t,l),onPress:()=>G(e.name),style:({pressed:e})=>({minWidth:92,minHeight:64,paddingHorizontal:10,paddingVertical:6,borderRadius:12,alignItems:'center',justifyContent:'center',borderWidth:t?2:1,borderColor:t?y.colours.gold:l?y.colours.goldMuted:y.colours.hairline,borderStyle:l&&!t?'dashed':'solid',backgroundColor:t?y.colours.gold:e?y.colours.tilePressed:y.colours.tile}),children:[(0,x.jsx)(p.T,{size:18,weight:"semibold",colour:t?y.colours.onGold:y.colours.text,children:(0,s.tableNumbers)(e.name)}),(0,x.jsxs)(p.T,{size:14,colour:t?y.colours.onGold:y.colours.muted,children:[e.seats," seats",l?' \xb7 booked':'']})]},e.name)})})]},e.area)),W.length?null:(0,x.jsx)(p.Muted,{center:!0,children:"No tables on the plan yet. Add them in Setup \u203a Table plan."})]})};var t=r(d[0]),s=r(d[1]),l=r(d[2]),o=e(r(d[3])),n=e(r(d[4])),c=r(d[5]),b=r(d[6]),u=r(d[7]),h=r(d[8]),y=r(d[9]),g=r(d[10]),p=r(d[11]),k=r(d[12]),f=r(d[13]),x=r(d[14]);const j={minHeight:56};async function v(e,t,s){const l=(0,h.tableKey)(s),o=(0,b.tablesOf)(t.table);await c.repo.bookings.update(t.id,(0,u.tablePatch)(l||null)),'seated'===t.status&&t.date===(0,g.venueYmd)(new Date)&&(o.filter(e=>!(0,b.tablesOf)(l).includes(e)).forEach(t=>b.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!0})),l&&(0,k.resetTableLive)(e,l))}},1117,[1118,860,34,402,102,874,1025,1116,1119,821,858,794,1120,1022,25]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.TableNumberWarning=function({plan:u}){const c=(0,n.numberClashes)(u.tables),o=[...new Set([...c.acrossAreas,...u.tables.filter(n=>c.sameArea.has(n.name)).map(n.tableNumber)])];return o.length?(0,l.jsxs)(t.T,{testID:"duplicate-table-numbers",size:16,colour:s.colours.goldLight,children:["Duplicate table numbers: ",o.join(', '),". Kept unchanged. Ask a manager to check the areas before assigning."]}):null},r(d[0]);var n=r(d[1]),s=r(d[2]),t=r(d[3]),l=r(d[4])},1118,[34,859,821,794,25]); __d(function(_g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"byNum",{enumerable:!0,get:function(){return s}}),e.tableKey=o,e.toggleTable=function(t,n){return t.includes(n)?t.filter(t=>t!==n):a(o([...t,n]))},e.seatsOf=function(t,n){const a={};for(const s of n)a[s]=t.tables.find(t=>t.name===s)?.maxSeats??0;return{per:a,total:Object.values(a).reduce((t,n)=>t+n,0)}},e.seatLine=function(t,n){const a=Math.max(0,n-t);return{text:`${t} ${1===t?'seat':'seats'} for ${l(n)}${a?`: ${a} short`:''}`,short:a,fits:0===a&&t>0}},e.pickClashes=function(t,l,u,c=90){if(!l.length)return[];const f={...t,table:o(l)},b=[];for(const s of u)if(s.id!==t.id&&s.date===t.date&&!['cancelled','noshow','finished'].includes(s.status)&&(0,n.startOf)(f)<(0,n.endOf)(s,c)&&(0,n.startOf)(s)<(0,n.endOf)(f,c))for(const t of a(s.table))l.includes(t)&&b.push({table:t,with:s});return b.sort((t,n)=>s(t.table,n.table))},e.overCapacityAsk=function(n,s,l){const u=a(o(n));if(!u.length||s>=l)return null;const c=u.map(n=>(0,t.tableNumbers)(n));return`${1===c.length?`Table ${c[0]} seats`:`Tables ${c.slice(0,-1).join(', ')} and ${c[c.length-1]} seat`} ${s} \u2013 this booking is ${l}. Use it anyway?`},e.clashWords=function(n){return n.map(n=>`${(0,t.tableNumbers)(n.table)} has ${n.with.walkIn?'a walk-in':(n.with.name||'a booking').replace(' (example)','')} at ${n.with.time}`).join('. ')+(n.length?'.':'')},e.tablesWords=u,e.pickA11y=function(n,a,s,l){return`Table ${(0,t.tableNumbers)(n)}, ${a} ${1===a?'seat':'seats'}${s?', selected':''}${l?`, has ${l.walkIn?'a walk-in':l.name} at ${l.time}`:''}`},e.pickGroups=function(t){return t.areas.map(n=>({area:n.name,tables:t.tables.filter(t=>t.areaId===n.id).map(t=>({name:t.name,seats:t.maxSeats})).sort((t,n)=>s(t.name,n.name))})).filter(t=>t.tables.length)},e.savedWords=function(t,n,a,s){return a.length?`${t}, ${l(n)}: ${u(a)} (${s} seats).`:`${t}: table taken off.`},e.tableActions=function(t,n){const s=a(t.table);if(['cancelled','noshow'].includes(t.status))return[];const o=[s.length?{id:'assign',label:'Change table',a11y:`Change table for ${n}, ${l(t.partySize)}, now ${u(s).toLowerCase()}. You can pick several tables to join.`}:{id:'assign',label:'Assign table',a11y:`Assign table for ${n}, ${l(t.partySize)}. You can pick several tables to join.`}];s.length&&o.push({id:'clear',label:'Clear table',a11y:`Clear table for ${n}, take ${u(s).toLowerCase()} off this booking`});return o},e.dragTables=function(t,n,s){if(!s||'__none'===s||s===n)return null;const l=a(t);if(l.includes(s))return null;return o('__none'!==n&&l.includes(n)?l.map(t=>t===n?s:t):[s])};var t=r(d[0]),n=r(d[1]);const a=t=>t?t.split('+').map(t=>t.trim()).filter(Boolean):[],s=(t,n)=>t.localeCompare(n,'en-GB',{numeric:!0}),l=t=>`${t} ${1===t?'person':'people'}`;function o(t){return[...new Set(t.map(t=>String(t).trim()).filter(Boolean))].sort(s).join('+')}function u(n){const s=a(o(n));return s.length?(0,t.tableListNumbers)(s):'No table'}},1119,[860,1101]); __d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"TABLES",{enumerable:!0,get:function(){return O}}),_e.useTableNames=N,_e.resetTableLive=M,_e.seatBookingNow=L,_e.finishBookingNow=async function(e,t){await f.repo.bookings.setStatus(t.id,'finished'),(0,S.tablesOf)(t.table).forEach(t=>S.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!0}))},_e.useTableUse=F,Object.defineProperty(_e,"walkInLabel",{enumerable:!0,get:function(){return R}}),_e.TablePicker=W,_e.WalkInSheet=E,_e.WalkInMatchPrompt=H,_e.AssignTableSheet=_,_e.undoNotice=Y,_e.NewBookingSheet=U,_e.useFrontDoor=function(e,t){const[s,o]=(0,r.useState)(!1),[l,a]=(0,r.useState)(!1),[i,d]=(0,r.useState)(null);return{openWalkIn:()=>o({}),openWalkInAt:e=>o({table:e}),openBooking:()=>a(!0),assignTable:e=>d({b:e}),combineTables:e=>d({b:e,combine:!0}),elements:(0,B.jsxs)(B.Fragment,{children:[s?(0,B.jsx)(E,{wide:t,initialTable:s.table,onClose:()=>o(!1),onSeated:Y}):null,l?(0,B.jsx)(U,{wide:t,date:e,onClose:()=>a(!1),onSaved:e=>(0,n.notify)({id:`booked:${Date.now()}`,testID:'booking-saved-toast',timeoutMs:5e3,icon:'\u2713',title:`Booked: ${e.name} \xb7 ${(0,x.niceDate)((0,x.parseYmd)(e.date))} at ${e.time}`})}):null,i?(0,B.jsx)(_,{booking:i.b,combine:i.combine,onClose:()=>d(null)}):null]})}};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),a=_r(_d[4]),i=_r(_d[5]),n=_r(_d[6]),r=_r(_d[7]),d=e(r),u=_r(_d[8]),c=e(_r(_d[9])),b=e(_r(_d[10])),h=_r(_d[11]),p=_r(_d[12]),f=_r(_d[13]),y=_r(_d[14]),k=_r(_d[15]),x=_r(_d[16]),j=_r(_d[17]),w=_r(_d[18]),T=_r(_d[19]),S=_r(_d[20]),v=_r(_d[21]),C=_r(_d[22]),D=_r(_d[23]),I=_r(_d[24]),$=_r(_d[25]),P=_r(_d[26]),z=_r(_d[27]),B=_r(_d[28]);const O=Array.from({length:12},(e,t)=>String(t+1));function N(e){const t=(0,S.usePlan)(e);return t.areas.flatMap(e=>t.tables.filter(t=>t.areaId===e.id).map(e=>e.name))}function M(e,t){(0,S.tablesOf)(t).forEach(t=>S.useFloor.getState().setLive(e,t,{stage:'seated',dirty:!1}))}async function L(e,t){await f.repo.bookings.setStatus(t.id,'seated'),M(e,t.table)}function F(e,t){const s=(0,f.useBookings)(e),o=(0,f.useOrders)(e),l=N(e),a=(0,S.useFloor)(t=>t.live[e])??{},i=(0,S.usePlan)(e),n=(0,v.useBlocks)(e=>e.blocks),r=(0,x.ymd)(t),d=(0,v.closedAreasAt)(n,e,r,(0,x.hm)(t)),u={};for(const e of l)u[e]=a[e]?.blocked||d.has(`tbl:${e}`)?{busy:!0,label:'Blocked'}:d.has(i.tables.find(t=>t.name===e)?.areaId??'')?{busy:!0,label:'Closed'}:a[e]?.dirty?{busy:!0,label:'Needs clearing'}:{busy:!1,label:'Free'};for(const e of s)if(e.date===r&&e.table)for(const s of(0,S.tablesOf)(e.table))if(u[s])if('seated'===e.status)u[s]={busy:!0,label:`${e.walkIn?'Walk-in':`${e.name.slice(0,1)}.`} \xb7 ${e.partySize}`};else if('confirmed'===e.status&&!u[s].busy){const o=(0,x.minsBetween)(t,new Date(`${e.date}T${e.time}:00`));o>=-15&&o<=90&&(u[s]={...u[s],soon:`Booked ${e.time}`})}for(const e of o)'table'===e.type&&e.tableNo&&u[e.tableNo]&&!['closed','cancelled','collected'].includes(e.status)&&!u[e.tableNo].busy&&(u[e.tableNo]={busy:!0,label:'Open order'});return u}const R=e=>e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;function W({use:e,value:t,onPick:s,big:o,best:a,dense:i,bestSet:n,picked:d}){const u=Object.keys(e),[h,p]=(0,r.useState)(0),f=i?6:8,y=i?64:o?92:76,k=h?Math.max(3,Math.floor((h+f)/(y+f))):0,x=k?Math.floor((h-f*(k-1))/k):y,w=new Set(n??[]),v=a?(0,S.tablesOf)(a)[0]:null;return(0,B.jsx)(b.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:f},testID:"table-picker",onLayout:e=>p(Math.floor(e.nativeEvent.layout.width)),children:u.map(o=>{const a=e[o],n=t===o||!!d?.includes(o),r=w.has(o),u=v===o&&!n,h=a.busy?['Blocked','Needs clearing','Closed'].includes(a.label)?a.label:'In use':a.soon??'Free';return(0,B.jsxs)(c.default,{accessibilityRole:"button",testID:`pick-table-${o}`,accessibilityLabel:`Table ${(0,l.tableNumbers)(o)}${d?n?', picked':', not picked':''}, ${a.busy?`in use (${a.label})`:a.soon?`free, ${a.soon}`:'free'}${r?', best table':''}${u?', suggested for this party':''}`,accessibilityState:{selected:n,disabled:'Closed'===a.label},disabled:'Closed'===a.label,onPress:()=>s(o),style:{width:x,minHeight:i?58:64,borderRadius:12,borderWidth:n||u?2.5:1.5,paddingVertical:i?3:6,paddingHorizontal:4,alignItems:'center',justifyContent:'center',gap:2,borderColor:n||u?j.colours.gold:a.busy?j.colours.red:j.colours.ok,backgroundColor:n?j.colours.goldTint:a.busy?j.colours.redBg:j.colours.surface2,opacity:'Closed'!==a.label||n?1:.55},children:[(0,B.jsxs)(b.default,{style:{flexDirection:'row',alignItems:'center',gap:4},children:[(0,B.jsx)(T.T,{weight:"bold",size:22,colour:n?j.colours.goldLight:j.colours.text,children:(0,l.tableNumbers)(o)}),r?(0,B.jsx)(b.default,{testID:"best-table",style:{backgroundColor:j.colours.gold,borderRadius:5,paddingHorizontal:4,paddingVertical:1},children:(0,B.jsx)(T.T,{size:11,weight:"bold",colour:j.colours.onGold,children:"BEST"})}):null]}),(0,B.jsx)(T.T,{size:i?13:14,colour:a.busy?'#FFD9D4':a.soon?'#FFE2A8':'#E2C489',center:!0,numberOfLines:1,children:h})]},o)})})}const A=[1,2,3,4,5,6,7,8];function E({onClose:e,onSeated:a,wide:i,initialTable:y}){const{rid:w,r:C,now:D}=(0,p.useCtx)(15e3),I=F(w,D),[$,P]=(0,r.useState)(2),[O,N]=(0,r.useState)(!1),[R,E]=(0,r.useState)(y??null),_=(0,S.usePlan)(w),Y=(0,f.useBookings)(w),U=(0,v.useBlocks)(e=>e.blocks),q=(0,v.closedAreasAt)(U,w,(0,x.ymd)(D),(0,x.hm)(D)),Q=d.default.useMemo(()=>{const e=Object.fromEntries(Object.entries(I).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,k.suggestTable)(_,Y.filter(e=>e.date===(0,x.ymd)(D)),e,$,D,(0,k.turnFor)($,C.settings.turnMins),90,void 0,{closed:q})?.table??null},[_,Y,I,$,q.size,D.getTime()]);(0,r.useEffect)(()=>{R&&(0,S.tablesOf)(R).some(e=>'Closed'===I[e]?.label)&&E(null)},[R,q.size]);const[V,G]=(0,r.useState)(!1),[K,X]=(0,r.useState)(''),J=(e,t=String(e),s=()=>{N(!1),P(e)})=>{const o='9+'===t?O:!O&&$===e;return(0,B.jsx)(c.default,{accessibilityRole:"button",accessibilityLabel:'9+'===t?'Party of 9 or more':`Party of ${e}`,accessibilityState:{selected:o},onPress:s,style:{width:i?58:60,height:i?58:56,borderRadius:14,borderWidth:2,borderColor:j.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:o?j.colours.gold:'transparent'},children:(0,B.jsx)(T.T,{weight:"bold",size:22,colour:o?j.colours.onGold:j.colours.gold,children:t})},t)},Z=(0,B.jsx)(s.PartySizeInput,{value:$,onChange:P,min:9,max:o.MAX_PARTY,label:"Walk-in party size",testID:"walkin-party-size"}),ee=(0,B.jsxs)(b.default,{style:{gap:8,width:i?256:void 0},children:[(0,B.jsx)(T.T,{weight:"semibold",children:"How many people?"}),(0,B.jsxs)(b.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},testID:"walkin-party",children:[A.map(e=>J(e)),J(9,'9+',()=>{N(!0),P(e=>e>=9?e:9)})]}),O?Z:null]}),[te,se]=(0,r.useState)(!1),[oe,le]=(0,r.useState)(null),ae=async(t=R,s=!1)=>{if(!te){if(!s){const e=(0,z.bookingsNearWalkIn)(Y,D,$);if(e.length)return void le({at:t,list:e})}se(!0);try{const s=await f.repo.bookings.seatWalkIn(w,$,t??void 0,K);M(w,t??void 0),a(s),e()}finally{se(!1)}}},ie=async(t,s)=>{if(!te){se(!0);try{const o=s??t.table??null;o&&o!==t.table&&await f.repo.bookings.assignTable(t.id,o),await L(w,{...t,table:o??void 0}),(0,n.notify)({id:`seated:${t.id}`,testID:'walkin-match-toast',timeoutMs:5e3,icon:'\u2713',title:`${t.name} seated \xb7 ${t.partySize} \xb7 ${o?(0,l.tableNumbers)(o):'table to assign'} (booking ${t.ref})`}),le(null),e()}finally{se(!1)}}},ne=(0,B.jsxs)(b.default,{style:{gap:8,flex:i?1:void 0,minWidth:0},children:[(0,B.jsxs)(T.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsxs)(T.T,{weight:"semibold",children:["Table ",(0,B.jsx)(T.T,{colour:j.colours.muted,size:14,children:"(optional)"})]}),R?(0,B.jsx)(T.Button,{small:!0,kind:"ghost",label:"Clear table",onPress:()=>E(null)}):null]}),(0,B.jsx)(W,{use:I,value:R,onPick:e=>{I[e]&&!I[e].busy?ae(e):E(R===e?null:e)},big:i,dense:i,best:Q,bestSet:(0,u.bestTables)(_)}),(0,B.jsxs)(T.Muted,{children:["Tap a free table to seat them there",Q&&!R?` (suggested for ${$}: ${(0,l.tableNumbers)(Q)})`:'',", or Seat for no table yet. BEST marks the venue\u2019s best tables."]})]});return(0,B.jsxs)(T.Sheet,{visible:!0,onClose:e,title:`Walk-in \xb7 ${(0,x.hm)(D)}`,maxWidth:i?1100:void 0,testID:"walkin-sheet",children:[(0,B.jsx)(T.Button,{label:`Seat walk-in \xb7 ${$} ${1===$?'person':'people'}${R?` \xb7 ${(0,l.tableNumbers)(R)}`:''}`,disabled:te,onPress:()=>{ae()},testID:"seat-walkin",style:{minHeight:52}}),i?(0,B.jsxs)(T.Row,{gap:16,style:{alignItems:'flex-start'},children:[ee,ne]}):(0,B.jsxs)(B.Fragment,{children:[ee,ne]}),(0,B.jsxs)(T.Row,{gap:10,wrap:!0,style:{alignItems:'center'},children:[V?(0,B.jsx)(t.TextInput,{accessibilityLabel:"Walk-in note",placeholder:"Note (optional), e.g. high chair",placeholderTextColor:"#7D776C",value:K,onChangeText:X,style:[T.styles.input,{flex:1,minWidth:220}],autoFocus:!0}):(0,B.jsx)(T.Button,{small:!0,kind:"ghost",label:"Add a note (optional)",onPress:()=>G(!0)}),(0,B.jsx)(b.default,{style:{flex:1,minWidth:220},children:(0,B.jsxs)(T.Muted,{children:["No name needed. Counts in today's covers.",'staff'!==h.APP_VARIANT?' Using website bookings too? Mark the table there as well.':'']})})]}),oe?(0,B.jsx)(H,{list:oe.list,busy:te,onYes:e=>{ie(e,oe.at)},onNo:()=>{const e=oe.at;le(null),ae(e,!0)},onClose:()=>le(null)}):null]})}function H({list:e,busy:t,onYes:s,onNo:o,onClose:a}){return(0,B.jsx)(T.Sheet,{visible:!0,onClose:a,title:"Booked party?",maxWidth:720,testID:"walkin-match",children:(0,B.jsxs)(b.default,{style:{gap:14},children:[e.map((e,o)=>(0,B.jsxs)(b.default,{testID:`walkin-match-${o}`,style:{gap:12,padding:16,borderRadius:16,borderWidth:2,borderColor:j.colours.gold,backgroundColor:'#15130F'},children:[(0,B.jsx)(b.default,{accessibilityRole:"header",accessibilityLiveRegion:"polite",children:(0,B.jsx)(T.T,{size:26,weight:"bold",colour:j.colours.goldLight,testID:"walkin-match-question",children:(0,z.walkInMatchQuestion)(e)})}),e.table?(0,B.jsxs)(T.T,{size:17,colour:j.colours.text,children:["Booked table ",(0,l.tableNumbers)(e.table)," \xb7 ",e.ref]}):(0,B.jsx)(T.T,{size:17,colour:j.colours.text,children:e.ref}),(0,B.jsx)(T.Button,{label:"Yes, seat booking",testID:"walkin-match-yes",disabled:t,accessibilityLabel:`Yes, seat ${e.name}'s booking, ${e.partySize} people`,onPress:()=>s(e),style:{minHeight:64}})]},e.id)),(0,B.jsx)(T.Button,{kind:"secondary",label:"No, new walk-in",testID:"walkin-match-no",disabled:t,onPress:o,style:{minHeight:64}})]})})}function _({booking:e,onClose:t,combine:s}){const{rid:o,r:a,now:i}=(0,p.useCtx)(15e3),n=F(o,i),c=(0,S.usePlan)(o),h=(0,f.useBookings)(o),y=(0,S.tablesOf)(e.table),w=d.default.useMemo(()=>Object.fromEntries(Object.entries(n).map(([e,t])=>[e,y.includes(e)?{busy:!1,label:'This party',soon:'This party'}:t])),[n,e.table]),v=d.default.useMemo(()=>{const t=Object.fromEntries(Object.entries(w).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,k.suggestTable)(c,h.filter(e=>e.date===(0,x.ymd)(i)),t,e.partySize,i,(0,k.turnFor)(e.partySize,a.settings.turnMins),90,e.id)?.table??null},[c,h,w,e.partySize,i.getTime()]),[C,D]=(0,r.useState)(!!s||y.length>1),[I,$]=(0,r.useState)(y),P=e=>c.tables.find(t=>t.name===e)?.maxSeats??0,z=I.reduce((e,t)=>e+P(t),0),O=I.length>0&&z{const l=(0,S.joinTables)(s);await f.repo.bookings.assignTable(e.id,l);y.filter(e=>!s.includes(e)).forEach(t=>S.useFloor.getState().setLive(o,t,{stage:void 0,dirty:'seated'===e.status})),'seated'===e.status&&M(o,l),t()},L=C?(0,B.jsxs)(b.default,{style:{gap:8},testID:"assign-table-tip",children:[(0,B.jsx)(b.default,{accessibilityLiveRegion:"polite",children:(0,B.jsx)(T.T,{size:17,weight:"semibold",colour:j.colours.text,children:I.length?`${(0,S.tablesLabel)((0,S.joinTables)(I))} \xb7 ${z} seats for ${e.partySize} Covers`:'No tables picked yet'})}),O?(0,B.jsx)(b.default,{testID:"combine-short",children:(0,B.jsxs)(T.T,{size:15,weight:"semibold",colour:"#FFD9D4",children:["Not enough seats yet: ",e.partySize-z," more needed. Add another table."]})}):null,(0,B.jsx)(T.T,{size:15,colour:j.colours.text,children:"Tap each table to add or remove it, then tap Done. All of them show as taken until the party has finished."}),(0,B.jsxs)(T.Row,{gap:8,wrap:!0,children:[(0,B.jsx)(T.Button,{label:"Done",testID:"combine-done",disabled:!I.length,accessibilityLabel:I.length?`Done, save ${(0,S.tableCardLabel)((0,S.joinTables)(I))}`:'Done',onPress:()=>N(I)}),(0,B.jsx)(T.Button,{kind:"ghost",label:"Cancel",onPress:t})]})]}):(0,B.jsx)(b.default,{style:{gap:8},testID:"assign-table-tip",children:(0,B.jsx)(T.T,{size:15,colour:j.colours.text,children:"Red tables are in use right now; you can still pick one (e.g. joining a table). BEST marks the venue\u2019s best tables. Big party? Tap Combine tables."})});return(0,B.jsxs)(T.Sheet,{visible:!0,onClose:t,title:`${C?'Combine tables':'Assign table'} \xb7 ${R(e)}`,testID:"assign-table-sheet",footer:L,children:[v&&!C?(0,B.jsx)(b.default,{testID:"assign-suggested",children:(0,B.jsxs)(T.T,{size:16,weight:"semibold",colour:j.colours.goldLight,accessibilityLabel:`Suggested for ${e.partySize}: ${(0,S.tableCardLabel)(v)}`,children:["Suggested for ",e.partySize,": ",(0,l.tableNumbers)(v)]})}):null,C?null:(0,B.jsx)(T.Button,{kind:"secondary",label:"Combine tables",testID:"combine-start",accessibilityLabel:"Combine tables: pick several tables for this party",onPress:()=>D(!0)}),(0,B.jsx)(W,{use:w,best:C?null:v,bestSet:(0,u.bestTables)(c),picked:C?I:void 0,onPick:C?e=>$(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]):async e=>{await N([e])}})]})}function Y(e){(0,n.notify)({id:`walkin:${e.id}`,testID:'walkin-toast',timeoutMs:6e3,title:`${R(e)} seated \xb7 ${e.table?`${(0,l.tableNumbers)(e.table)}`:'table to assign'} (${e.ref})`,actions:[{label:'Undo',testID:'undo-walkin',onPress:()=>f.repo.bookings.undoWalkIn(e.id)},{label:'OK',kind:'ghost'}]})}function U({date:e,onClose:t,wide:n,onSaved:d}){const{rid:u,r:c,now:h,role:z,meId:O}=(0,p.useCtx)(6e4),N=(0,x.ymd)(h),[M,L]=(0,r.useState)(ee.blocks),[W,A]=(0,r.useState)(!1),[E,H]=(0,r.useState)(''),[_,Y]=(0,r.useState)(2),[U,q]=(0,r.useState)(null),[Q,V]=(0,r.useState)(''),[G,K]=(0,r.useState)(''),[X,J]=(0,r.useState)(''),[Z,ee]=(0,r.useState)('phone'),[te,se]=(0,r.useState)((0,D.emptyNeeds)()),oe=(0,D.needsMissing)(te),[le,ae]=(0,r.useState)(null),ie=(0,S.usePlan)(u),ne=(0,P.dogSetUp)(ie),re=!0===te.dog&&ne,de=te.dog?te.dogs:0,ue=(0,x.parseYmd)(M),ce=(0,k.turnFor)(_,c.settings.turnMins),be=F.filter(e=>e.date===M),he=e=>(0,k.freeTablesAt)(ie,be,_,new Date(`${M}${(0,l.tableNumbers)(e)}:00`),ce,c.settings.turnMins,{dog:!0,closed:(0,v.closedAreasAt)(R,u,M,e)}),ge=re&&U?he(U):[];(0,r.useEffect)(()=>{ae(null)},[re,U,_]);const pe=(0,y.bookingSlots)(c,ue,e=>F.filter(t=>t.date===M&&t.time===e&&'cancelled'!==t.status&&!t.walkIn).reduce((e,t)=>e+t.partySize,0),_,M===(0,x.ymd)(h)?h:(0,x.addMins)(ue,0),e=>F.filter(t=>t.date===M&&t.time===e&&'cancelled'!==t.status&&!t.walkIn).length),me=(0,w.ukPhone)(G),[fe,ye]=(0,r.useState)(!1),ke=U?pe.find(e=>e.time===U):void 0,xe=ke&&ke.left<_?{left:Math.max(0,ke.left),time:ke.time}:null,je=ke&&null!=ke.partiesLeft&&ke.partiesLeft<1?{time:ke.time,cap:ke.partiesCap??0}:null,we=xe||je,Te=U?(0,v.blockAt)(R,u,M,U):void 0,Se='staff'!==z,ve=!!U&&!(0,D.dogTimeOk)(c,F,M,U,de),Ce=!oe.length&&E.trim().length>=2&&!!U&&(!we||fe)&&(0,o.validParty)(_)&&me.ok&&(0,w.emailOk)(X)&&(!Te||Se&&W)&&(!re||ge.length>0)&&!ve,De=te.wheelchair>0||te.stepFree;return(0,B.jsxs)(T.Sheet,{visible:!0,onClose:t,title:`New booking \xb7 ${(0,x.niceDate)(ue)}`,maxWidth:n?760:void 0,testID:"booking-sheet",children:[(0,B.jsx)(D.FirstQuestions,{rid:u,value:te,onChange:se,party:_,audience:"staff"}),te.dog&&!ne?(0,B.jsx)(T.T,{size:13,colour:j.colours.amber,children:"Dog-friendly tables aren\u2019t marked yet. Managers \u203a Booking options \u203a Tables. Booking is allowed; check where the dog can sit."}):null,(0,B.jsx)(C.BookingDatePicker,{r:c,today:h,value:M,onChange:e=>{e!==M&&(L(e),q(null),A(!1))}}),(0,B.jsxs)(T.Row,{gap:6,children:[(0,B.jsx)(T.Chip,{label:"Phone",selected:'phone'===Z,onPress:()=>ee('phone')}),(0,B.jsx)(T.Chip,{label:"In person",selected:'in-person'===Z,onPress:()=>ee('in-person')})]}),(0,B.jsx)(T.Field,{label:"Name",value:E,onChangeText:H,placeholder:"e.g. Reid",testID:"nb-name"}),(0,B.jsx)(T.Field,{label:"Mobile or phone number (needed)",value:G,onChangeText:K,keyboardType:"phone-pad",placeholder:"e.g. 07700 900123",testID:"nb-phone"}),!me.ok&&G?(0,B.jsx)(T.T,{size:13,colour:j.colours.amber,children:me.error}):null,(0,B.jsx)(T.Field,{label:"Email (optional)",value:X,onChangeText:J,keyboardType:"email-address",autoCapitalize:"none",placeholder:"For an email confirmation too",testID:"nb-email"}),(0,w.emailOk)(X)?null:(0,B.jsx)(T.T,{size:13,colour:j.colours.amber,children:"That email doesn\u2019t look quite right."}),(0,B.jsxs)(b.default,{style:{gap:6,alignItems:'center'},children:[(0,B.jsx)(T.T,{center:!0,children:"Covers"}),(0,B.jsx)(s.PartySizeInput,{value:_,onChange:e=>{Y(e),ye(!1)},label:"Covers",testID:"nb-party"})]}),(0,B.jsx)(T.Row,{wrap:!0,gap:6,children:pe.map(e=>{const t=re&&e.available&&!he(e.time).length||!(0,D.dogTimeOk)(c,F,M,e.time,de);return(0,B.jsx)(T.Chip,{testID:`nb-slot-${e.time}`,label:e.time,sub:(0,v.blockAt)(R,u,M,e.time)?'Paused':t?'Dogs full':e.drinksOnly?'Drinks only':null!=e.partiesLeft&&e.partiesLeft<1||e.left<=0?'Full':`${e.left} left`,disabled:(e.past??!e.available)||t,selected:U===e.time,onPress:()=>{q(e.time),A(!1),ye(!1)}},e.time)})}),we?(0,B.jsxs)(b.default,{testID:"nb-over-capacity",accessible:!0,accessibilityLiveRegion:"polite",style:{borderWidth:1.5,borderColor:j.colours.amber,backgroundColor:j.colours.amberBg,borderRadius:12,padding:10,gap:6},children:[xe?(0,B.jsx)(T.T,{weight:"semibold",colour:j.colours.amber,children:(0,o.overCapacityNote)(_,xe.left,xe.time)}):null,je?(0,B.jsx)(T.T,{weight:"semibold",colour:j.colours.amber,children:(0,o.overPartiesNote)(je.time,je.cap)}):null,(0,B.jsx)(T.Chip,{label:fe?'Booking over the limit: on':'Book anyway (over the limit)',selected:fe,onPress:()=>ye(e=>!e),testID:"nb-over-ok"})]}):null,re&&U?(0,B.jsxs)(b.default,{style:{gap:6},testID:"nb-dog-tables",children:[(0,B.jsxs)(T.T,{size:14,weight:"semibold",children:["Dog-friendly table ",(0,B.jsxs)(T.T,{size:13,colour:j.colours.muted,children:["(",ie.areas.filter(e=>e.dogs).map(e=>e.name).join(' or '),")"]})]}),ge.length?(0,B.jsx)(T.Row,{wrap:!0,gap:6,children:ge.slice(0,10).map((e,t)=>(0,B.jsx)(T.Chip,{label:`${(0,l.tableNumbers)(e.table)}`,sub:`${e.area} \xb7 ${e.seats}${0===t?' \xb7 best':''}${De&&(0,P.accessibleSetUp)(ie)&&!(0,P.isAccessible)(ie,e.table)?' \xb7 not step-free':''}`,selected:(le??ge[0].table)===e.table,onPress:()=>ae(e.table)},e.table))}):(0,B.jsxs)(T.T,{size:14,colour:j.colours.amber,children:["No dog-friendly table free for ",_," at ",U,". Try another time."]})]}):null,Te?(0,B.jsxs)(b.default,{testID:"nb-block-warning",style:{borderWidth:1.5,borderColor:j.colours.amber,backgroundColor:j.colours.amberBg,borderRadius:12,padding:10,gap:6},children:[(0,B.jsxs)(T.T,{weight:"semibold",colour:j.colours.amber,children:["Bookings are paused ",Te.from,"\u2013",Te.to,Te.reason?` (${Te.reason})`:'']}),Se?(0,B.jsx)(T.Chip,{label:W?'Manager override on':'Override and book anyway',selected:W,onPress:()=>A(e=>!e)}):(0,B.jsx)(T.Muted,{children:"Ask a manager to override, or pick another time."})]}):null,pe.length?null:(0,B.jsx)(b.default,{testID:"nb-closed",children:(0,B.jsxs)(T.T,{size:14,weight:"semibold",colour:j.colours.amber,children:["Closed on ",(0,x.niceDate)(ue)," (per the venue\u2019s opening hours). Pick another date."]})}),(0,B.jsx)(D.MoreQuestions,{rid:u,r:c,value:te,onChange:se,party:_,date:M,time:U,today:(0,x.ymd)(h),bookings:F,audience:"staff",showTables:!1!==c.settings.tableRequests}),De&&!(0,P.accessibleSetUp)(ie)?(0,B.jsx)(T.T,{size:13,colour:j.colours.amber,children:"Step-free tables aren\u2019t marked yet (Managers \u203a Booking options \u203a Tables). Check the table works for a wheelchair."}):null,(0,B.jsx)(T.Field,{label:"Notes (optional)",value:Q,onChangeText:V,placeholder:I.NOTES_PLACEHOLDER,multiline:!0,numberOfLines:3,testID:"nb-notes"}),(0,i.depositDue)((0,i.depositOf)(c.settings),_)?(0,B.jsxs)(T.Muted,{children:["Deposit due: ",(0,a.gbp)((0,i.depositDue)((0,i.depositOf)(c.settings),_))," (",(0,a.gbp)((0,i.depositOf)(c.settings).perPersonPence)," per person for ",(0,i.depositOf)(c.settings).fromParty,"+). Deposits are paid through website bookings or to you, never in CoverCharge: tick Deposit paid on the booking once the guest has paid."]}):null,(0,B.jsxs)(T.Muted,{children:["The guest gets a confirmation text",X.trim()?' and email':''," automatically (preview mode: shown in the Outbox, not sent)."]}),ve?(0,B.jsxs)(T.T,{size:14,colour:j.colours.amber,children:["We already have the most dogs we can look after at ",U,". Try another time: dogs are very welcome then."]}):null,(0,B.jsx)(T.Button,{label:oe.length?oe[0]:'Save booking',testID:"nb-save",disabled:!Ce,onPress:()=>{if(M<(0,x.ymd)(h))return;const e=(0,D.needsPatch)(te),s=te.tableReq.find(e=>!re||ge.some(t=>t.table===e));f.repo.bookings.create({restaurantId:u,customerId:null,name:E.trim(),partySize:_,date:M,time:U,notes:Q.trim(),security:(0,i.depositDue)((0,i.depositOf)(c.settings),_)?'deposit':'none',depositPaid:0,...(0,i.depositDue)((0,i.depositOf)(c.settings),_)?{depositDue:(0,i.depositDue)((0,i.depositOf)(c.settings),_),depositPolicy:(0,i.depositWords)((0,i.depositOf)(c.settings),_,c.name).join(' '),depositRefundable:(0,i.depositOf)(c.settings).refundable,depositCutoffHours:(0,i.depositOf)(c.settings).cutoffHours}:{},phone:me.pretty,email:X.trim()||void 0,source:Z,...e,...pe.find(e=>e.time===U)?.drinksOnly?{drinksOnly:!0}:{},allergies:e.allergies??[],...re?{table:le??s??ge[0]?.table}:{}}).then(e=>(0,$.postNewBookingToKitchen)(e,O)).catch(()=>{}),d?.({date:M,time:U,name:E.trim()}),t()}})]})}},1120,[827,1121,1122,860,867,14,1123,34,859,402,102,872,1084,874,1124,1101,858,821,864,794,1025,1022,1125,1126,1131,1103,1097,1132,25]); @@ -1245,7 +1245,7 @@ __d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule' __d(function(g,_r,i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.gamesOn=function(){const e=b.useStore.getState().restaurants.find(e=>e.id===p.VENUE_RID);return!1!==e?.settings?.games},_e.useGameClock=I,_e.usePlayable=function(e,t){return(0,y.gamePlayable)(I(e,t))},Object.defineProperty(_e,"LENNY_GAME_URL",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"validGameUrl",{enumerable:!0,get:function(){return C}}),_e.gameBase=function(){const e=b.useStore.getState().restaurants.find(e=>e.id===p.VENUE_RID);return C(e?.settings?.gameUrl)??v},_e.BreakRoomCard=function({staffId:e,name:t,now:s}){const n=(0,b.useStore)(e=>!1!==e.restaurants.find(e=>e.id===p.VENUE_RID)?.settings?.games),[o,l]=(0,r.useState)(!1),c=I(e,s),u=(0,y.gamePlayable)(c);return n?(0,w.jsxs)(d.Card,{children:[(0,w.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(d.T,{weight:"semibold",children:"\ud83e\uded6 Break room"}),(0,w.jsx)(d.T,{size:13,colour:u?x.colours.ok:x.colours.muted,children:u?'Open':'Locked'})]}),(0,w.jsx)(d.Muted,{children:"Lenny\u2019s Kitchen Chaos, with the team as characters and a shared leaderboard. Playable on a break or when you\u2019re not clocked in."}),u?null:(0,w.jsx)(d.Muted,{testID:"break-room-locked-text",children:y.GAME_LOCKED_TEXT}),(0,w.jsx)(d.Button,{testID:"break-room-open",kind:"secondary",label:"Open the Break room",onPress:()=>l(!0)}),o?(0,w.jsx)(R,{staffId:e,name:t,playable:u,clock:c,onClose:()=>l(!1)}):null]}):null},Object.defineProperty(_e,"displayName",{enumerable:!0,get:function(){return T}}),_e.BreakRoom=R;var t=_r(_d[0]),s=_r(_d[1]),r=_r(_d[2]),n=e(r),o=e(_r(_d[3]));_r(_d[4]);var l=e(_r(_d[5])),c=e(_r(_d[6])),u=_r(_d[7]),d=_r(_d[8]),f=_r(_d[9]),m=_r(_d[10]),y=_r(_d[11]),h=_r(_d[12]),b=_r(_d[13]),p=_r(_d[14]),k=_r(_d[15]),j=_r(_d[16]),x=_r(_d[17]),w=_r(_d[18]);function I(e,t){const s=(0,m.useOwner)(e=>e.attendance);return(0,y.gameClock)(s,e,t)}const v='https://lennys-kitchen-chaos-13e285.deed.page/',C=e=>{try{const t=new URL(String(e??'').trim());return'https:'!==t.protocol||t.username||t.password?null:t.toString()}catch{return null}};function S(e){if('undefined'==typeof window)return null;const t=new URL(e);for(const e of['demo','unlock','name','staffId'])t.searchParams.delete(e);return t.searchParams.set('host','covercharge'),t.searchParams.set('hostOrigin',window.location.origin),{src:t.toString(),origin:t.origin}}const T=e=>String(e??'').replace(/\s*\(.*\)$/,'').replace(/\s+/g,' ').trim().slice(0,24).trim();function R({staffId:e,name:I,playable:R,clock:P,onClose:L,car:M}){const D=(0,m.useOwner)(e=>e.staff),O=(0,f.useAvatars)(e=>e.photos),_=(0,h.useSetup)(e=>e.looks),z=(0,r.useRef)(null),[N,U]=(0,r.useState)({}),[A,B]=(0,r.useState)(!1),[G,q]=(0,r.useState)(null),H=(0,b.useStore)(e=>C(e.restaurants.find(e=>e.id===p.VENUE_RID)?.settings?.gameUrl)??v),V=(0,r.useMemo)(()=>S(H),[H]),W=V?.origin??'',$=(0,j.useSync)(e=>'staff'===e.kind?e.staffRef??null:null),K=!(!$||!e||$===e),X=K?null:$??e??null,Y=T(I),[F,J]=(0,r.useState)(''),[Q,Z]=(0,r.useState)(null),ee=(0,r.useRef)(null),te=(0,r.useRef)(0),se=(0,r.useRef)(null),re=(0,r.useRef)(R);re.current=R;const ne=(0,r.useMemo)(()=>D.filter(e=>e.active&&!e.name.includes('(example)')),[D]);(0,r.useEffect)(()=>{const e=setTimeout(()=>{const e={};for(const s of ne){const r=null!=_[s.id]&&_[s.id]>=1e3?t.AVATAR_OPTIONS.find(e=>e.look===_[s.id]):void 0;if(r){e[s.id]=r.dataUrl;continue}const n=document.getElementById(`cc-av-${s.id}`)?.querySelector('svg');n&&(e[s.id]=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(n.outerHTML.includes('xmlns')?n.outerHTML:n.outerHTML.replace('clearTimeout(e)},[ne,_]);const oe=(0,r.useMemo)(()=>ne.map(e=>{const t=O[e.id]?.dataUrl??N[e.id],s={id:e.id,name:T(e.name),role:e.job||e.level||e.role};return t&&(s.avatarUrl=t),s}),[ne,O,N]),le=(0,r.useCallback)(e=>{try{W&&z.current?.contentWindow?.postMessage(e,W)}catch{}},[W]);return(0,r.useEffect)(()=>{const e=async e=>{if(!W||e.origin!==W||e.source!==z.current?.contentWindow)return;const t=e.data;if('string'!=typeof t?.type||!t.type.startsWith('lenny:'))return;if('lenny:ready'===t.type)return q('string'==typeof t.version?String(t.version).slice(0,12):null),void B(!0);const s=String(t.levelId??'').slice(0,40);if('lenny:scores:list'===t.type&&le({type:'lenny:scores:result',reqId:t.reqId,result:await(0,k.listScores)(s,Math.min(50,Number(t.limit)||10))}),'lenny:scores:submit'===t.type){const e=t.entry??{};if(!X||'string'==typeof e.staffId&&e.staffId!==X)return void le({type:'lenny:scores:result',reqId:t.reqId,result:{rank:null,entries:await(0,k.listScores)(s,10),id:null}});const r='string'==typeof e.characterId?e.characterId.slice(0,80):void 0;le({type:'lenny:scores:result',reqId:t.reqId,result:await(0,k.submitScore)(s,{score:Number(e.score)||0,stars:Number(e.stars)||0,badges:Array.isArray(e.badges)?e.badges.map(String).slice(0,30):[],stats:'object'==typeof e.stats&&e.stats?e.stats:{},characterId:r,character:'string'==typeof e.character?e.character.slice(0,60):void 0,staffId:X,name:Y})})}'lenny:roundAbandoned'===t.type&&J('The last round was stopped because the player changed. No score was saved.'),'lenny:roundStart'===t.type&&J(''),'lenny:progress'===t.type&&X&&t.staffId===X&&(0,k.saveProgress)(X,t.progress),'lenny:gameComplete'===t.type&&X&&t.staffId===X&&J(!0===t.firstTime?'Game complete! Character select is now unlocked.':'Game complete again. Nice work!')};return window.addEventListener('message',e),()=>window.removeEventListener('message',e)},[le,X,Y,W]),(0,r.useEffect)(()=>{B(!1),ee.current=null,se.current=null},[V?.src]),(0,r.useEffect)(()=>{if(!A)return;const e=e=>{se.current!==e&&(se.current=e,le({type:'lenny:setPlayable',playable:e}))},t=K?null:`${X??''}|${Y}`;if(t&&ee.current===t)return void e(R);const s=++te.current;ee.current=null,se.current&&e(!1),t&&(0,k.loadProgress)(X).catch(()=>null).then(r=>{s===te.current&&(le({type:'lenny:setPlayer',name:Y,staffId:X,...r?{progress:r}:{}}),ee.current=t,e(re.current))})},[A,K,X,Y,R,le]),(0,r.useEffect)(()=>{A&&le({type:'lenny:setRoster',staff:oe})},[A,oe,le]),(0,r.useEffect)(()=>{A&&null!==Q&&le({type:'lenny:setMuted',muted:Q})},[A,Q,le]),(0,w.jsx)(o.default,{visible:!0,animationType:"slide",onRequestClose:L,children:(0,w.jsxs)(c.default,{testID:"break-room",style:{flex:1,backgroundColor:(0,s.soutersSurface)('#000')},children:[M?(0,w.jsx)(E,{status:K?'Switching player\u2026':R?'Parked only \xb7 enjoy!':'Game locked',muted:!!Q,onPause:()=>le({type:'lenny:pause'}),onMute:()=>Z(!Q),onClose:L}):(0,w.jsxs)(d.Row,{style:{justifyContent:'space-between',padding:10,backgroundColor:x.colours.bg},children:[(0,w.jsx)(d.T,{weight:"semibold",children:"\ud83e\uded6 Break room"}),(0,w.jsx)(c.default,{testID:R&&!K?'break-playable':'break-locked',accessibilityLabel:G?`Game version ${G}`:void 0,children:(0,w.jsx)(d.T,{size:13,colour:R?x.colours.ok:x.colours.gold,children:K?'Switching player\u2026':R?'off'===P?'Off shift: enjoy!':'On your break: enjoy!':'Game locked'})}),(0,w.jsxs)(d.Row,{gap:4,children:[(0,w.jsx)(l.default,{testID:"break-room-mute",accessibilityRole:"button",accessibilityLabel:Q?'Turn sound and voice on':'Mute sound and voice',onPress:()=>Z(!Q),style:{padding:6},children:(0,w.jsx)(d.T,{weight:"semibold",colour:x.colours.gold,children:Q?'Sound on':'Mute'})}),(0,w.jsx)(l.default,{testID:"break-room-close",accessibilityRole:"button",onPress:L,style:{padding:6},children:(0,w.jsx)(d.T,{weight:"semibold",colour:x.colours.gold,children:"Close"})})]})]}),R||K?null:(0,w.jsx)(c.default,{testID:"break-locked-text",style:{paddingHorizontal:10,paddingVertical:6,backgroundColor:x.colours.surface},children:(0,w.jsx)(d.T,{size:13,colour:x.colours.text,children:y.GAME_LOCKED_TEXT})}),F?(0,w.jsx)(c.default,{testID:"break-notice",style:{paddingHorizontal:10,paddingVertical:6,backgroundColor:x.colours.surface},children:(0,w.jsx)(d.T,{size:13,colour:x.colours.muted,children:F})}):null,V?n.default.createElement('iframe',{ref:z,src:V.src,key:V.src,title:'Lenny\u2019s Kitchen Chaos','data-testid':'break-game',allow:'autoplay; fullscreen',style:{flex:1,width:'100%',height:'100%',border:0,background:'#000'}}):(0,w.jsx)(c.default,{style:{flex:1,alignItems:'center',justifyContent:'center'},children:(0,w.jsx)(d.Muted,{children:"The Break room opens in the web app."})}),(0,w.jsx)(c.default,{style:{position:'absolute',left:-9999,top:0,width:64,height:64,opacity:0},pointerEvents:"none",children:ne.map(e=>(0,w.jsx)(c.default,{nativeID:`cc-av-${e.id}`,children:(0,w.jsx)(u.AvatarLook,{look:_[e.id],id:e.id,name:e.name,size:96})},e.id))})]})})}function E({status:e,muted:t,onPause:s,onMute:r,onClose:n}){const o={minHeight:72,minWidth:150,paddingHorizontal:22,borderRadius:18,borderWidth:1.5,borderColor:x.colours.gold,alignItems:'center',justifyContent:'center'};return(0,w.jsxs)(c.default,{testID:"car-game-bar",style:{flexDirection:'row',alignItems:'center',gap:14,paddingHorizontal:16,paddingVertical:10,backgroundColor:x.colours.bg,borderBottomWidth:1,borderColor:x.colours.border},children:[(0,w.jsx)(l.default,{testID:"break-room-close",accessibilityRole:"button",accessibilityLabel:"Close the game",onPress:n,style:o,children:(0,w.jsx)(d.T,{size:20,weight:"semibold",colour:x.colours.gold,children:"Close"})}),(0,w.jsx)(l.default,{testID:"car-game-pause",accessibilityRole:"button",accessibilityLabel:"Pause the game",onPress:s,style:o,children:(0,w.jsx)(d.T,{size:20,weight:"semibold",colour:x.colours.gold,children:"Pause"})}),(0,w.jsxs)(c.default,{style:{flex:1,alignItems:'center',minWidth:0},children:[(0,w.jsx)(d.T,{size:22,weight:"semibold",center:!0,numberOfLines:1,children:"Lenny\u2019s Kitchen Chaos"}),(0,w.jsx)(d.T,{size:15,colour:x.colours.goldLight,center:!0,numberOfLines:1,children:`${e} \xb7 touch the big buttons on the game`})]}),(0,w.jsx)(l.default,{testID:"break-room-mute",accessibilityRole:"button",accessibilityLabel:t?'Turn sound and voice on':'Mute sound and voice',onPress:r,style:o,children:(0,w.jsx)(d.T,{size:20,weight:"semibold",colour:x.colours.gold,children:t?'Sound on':'Mute'})}),(0,w.jsx)(c.default,{testID:"car-game-parked",style:{...o,minWidth:0,borderColor:x.colours.goldMuted,backgroundColor:'rgba(201,162,74,0.12)'},children:(0,w.jsx)(d.T,{size:16,weight:"semibold",colour:x.colours.goldLight,children:"PARKED ONLY"})})]})}},1162,[928,828,34,395,236,402,102,925,794,926,891,1163,927,831,5,1164,987,821,25]); __d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"GAME_LOCKED_TEXT",{enumerable:!0,get:function(){return t}}),e.gameClock=function(t,n,o){if(!n)return'off';const a=new Date(o).getTime(),c=t.filter(t=>t.staffId===n&&t.in&&!t.out&&a-new Date(t.in).getTime()<72e6).sort((t,n)=>String(n.in).localeCompare(String(t.in)))[0];return c?c.breaks?.some(t=>!t.end)?'break':'working':'off'},Object.defineProperty(e,"gamePlayable",{enumerable:!0,get:function(){return n}});const t='You\u2019re clocked in, so the game is locked. Start your break or clock out in CoverCharge to play.';const n=t=>'working'!==t},1163,[]); __d(function(g,_r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.listScores=o,_e.submitScore=async function(e,t){const f=r.useSync.getState(),l=Math.max(0,Math.round(Number(t.score)||0));if(c()&&f.staffRef&&t.staffId===f.staffRef)try{const{data:r,error:s}=await a().from('game_scores').insert({venue_id:f.venueId,game:'lenny',level_id:e,staff_ref:f.staffRef??null,name:String(t.name||'Crew').replace(/\s+/g,' ').trim().slice(0,24),character_id:t.characterId??null,score:l,stars:Math.max(0,Math.min(3,Number(t.stars)||0)),stats:{...t.stats??{},badges:t.badges??[],character:t.character??null}}).select('id').single();if(s)throw s;const{count:n}=await a().from('game_scores').select('id',{count:'exact',head:!0}).eq('venue_id',f.venueId).eq('game','lenny').eq('level_id',e).gt('score',l);return{rank:(n??0)+1,entries:await o(e,10),id:r.id}}catch{}const u=await s.kv.get(n,{}),y=[...u[e]??[],{...t,score:l,date:(new Date).toISOString()}].sort((e,t)=>t.score-e.score).slice(0,50);return await s.kv.set(n,{...u,[e]:y}),{rank:y.findIndex(e=>e.score===l)+1,entries:y.slice(0,10),id:null}},_e.loadProgress=async function(e){if(!e)return null;const t=r.useSync.getState();if(l(e))try{const{data:r,error:s}=await a().from('game_progress').select('progress').eq('venue_id',t.venueId).eq('game','lenny').eq('staff_ref',e).maybeSingle();if(s)throw s;if(r)return v(r.progress)}catch{}return v((await s.kv.get(f,{}))[e])},Object.defineProperty(_e,"LENNY_LAST_WORLD",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"LENNY_LEVELS",{enumerable:!0,get:function(){return y}}),_e.cleanProgress=v,_e.saveProgress=async function(e,t){const n=v(t);if(!e||!n||JSON.stringify(n).length>16e3)return;const c=await s.kv.get(f,{});await s.kv.set(f,{...c,[e]:n});const o=r.useSync.getState();if(l(e))try{await a().from('game_progress').upsert({venue_id:o.venueId,game:'lenny',staff_ref:e,progress:n,updated_at:(new Date).toISOString()},{onConflict:'venue_id,game,staff_ref'})}catch{}};var e=_r(d[0]),t=_r(d[1]),r=_r(d[2]),s=_r(d[3]);const a=()=>(0,e.getSupabase)(),n='lenny:scores:v1',c=()=>(0,t.isSupabaseConfigured)()&&!!r.useSync.getState().venueId&&'staff'===r.useSync.getState().kind;async function o(e,t=10){if(c())try{const{data:s,error:n}=await a().from('game_scores').select('*').eq('venue_id',r.useSync.getState().venueId).eq('game','lenny').eq('level_id',e).order('score',{ascending:!1}).limit(t);if(n)throw n;return(s??[]).map(e=>({name:e.name,staffId:e.staff_ref,characterId:e.character_id??void 0,character:e.stats?.character,score:e.score,stars:e.stars,badges:e.stats?.badges??[],stats:e.stats,date:e.created_at}))}catch{}return((await s.kv.get(n,{}))[e]??[]).sort((e,t)=>t.score-e.score).slice(0,t)}const f='lenny:progress:v1',l=e=>{const t=r.useSync.getState();return c()&&!!t.staffRef&&e===t.staffRef};const u='festival',y=['mop','dsoap','dish','dtower','dscrub','mussels','ppeel','pfifo','bin1','bin2','bin3','mothersday','bin4','creel1','creel2','dsundae','dplate','pass','rush','delivery','death','line','steak','festival'];function v(e){if(!e||'object'!=typeof e||Array.isArray(e))return null;const t=e,r=e=>('string'==typeof e||'number'==typeof e)&&String(e).length>0&&String(e).length<=60?String(e):null,s={};if(t.stars&&'object'==typeof t.stars&&!Array.isArray(t.stars))for(const[e,a]of Object.entries(t.stars).slice(0,300)){const t=r(e),n=Math.max(0,Math.min(3,Math.floor(Number(a)||0)));t&&(s[t]=n)}const a={},n=t.badges;if(Array.isArray(n))for(const e of n.slice(0,100)){const t=r(e);t&&(a[t]=!0)}else if(n&&'object'==typeof n)for(const[e,t]of Object.entries(n).slice(0,100)){const s=r(e);s&&t&&(a[s]=!0)}const c={stars:s,badges:a,charactersUnlocked:!0===t.charactersUnlocked};return'number'==typeof t.v&&Number.isInteger(t.v)&&t.v>=0&&t.v<=9999&&(c.v=t.v),Array.isArray(t.legacyWorlds)&&t.legacyWorlds.length<=50&&t.legacyWorlds.every(e=>null!==r(e)&&'string'==typeof e)&&(c.legacyWorlds=[...t.legacyWorlds]),c}},1164,[933,976,987,977]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.KitchenRotaEditor=function({today:e=(0,o.ymd)(new Date)}){const $=(0,a.useOwner)(e=>e.staff),j=(0,a.useOwner)(e=>e.shifts),p=(0,t.useMemo)(()=>(0,l.kitchenTeam)($),[$]),k=(0,t.useMemo)(()=>new Set(p.map(e=>e.id)),[p]),[S,I]=(0,t.useState)(0),[w,D]=(0,t.useState)(null),[v,T]=(0,t.useState)(''),H=(0,a.addDays)((0,a.mondayOfDate)(e),7*S),C=(0,a.addDays)(H,6),P=u.map((e,t)=>(0,a.addDays)(H,t)),L=(0,l.kitchenPending)(j,k,H,C).length,M=e=>{T(e),(0,d.announce)(e)},R=0===S?'This week':1===S?'Next week':-1===S?'Last week':`Week of ${b(H)}`;return(0,h.jsxs)(i.default,{testID:"kitchen-rota-editor",style:{gap:10,alignItems:'center'},children:[(0,h.jsx)(n.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Kitchen rota"}),(0,h.jsxs)(n.Row,{gap:8,style:{justifyContent:'center',alignItems:'center'},children:[(0,h.jsx)(n.Button,{small:!0,kind:"ghost",testID:"krota-prev",label:"\u2039 Prev",accessibilityLabel:"Previous week",onPress:()=>{I(S-1),T('')},style:{minWidth:84,minHeight:48}}),(0,h.jsxs)(i.default,{accessible:!0,accessibilityLabel:`${R}, ${f[0]} ${b(H)} to ${f[6]} ${b(C)}`,style:{alignItems:'center',minWidth:120},children:[(0,h.jsx)(n.T,{weight:"semibold",center:!0,children:R}),(0,h.jsxs)(n.Muted,{center:!0,children:[m(H)," \u2013 ",m(C)]})]}),(0,h.jsx)(n.Button,{small:!0,kind:"ghost",testID:"krota-next",label:"Next \u203a",accessibilityLabel:"Next week",onPress:()=>{I(S+1),T('')},style:{minWidth:84,minHeight:48}})]}),p.map(t=>(0,h.jsxs)(i.default,{testID:"krota-row",style:{gap:4,alignItems:'center',alignSelf:'stretch'},children:[(0,h.jsxs)(n.T,{size:14,weight:"semibold",center:!0,children:[y(t.nickname||t.name),t.job?(0,h.jsx)(n.T,{size:12,colour:c.colours.muted,children:` ${t.job}`}):null]}),(0,h.jsx)(n.Row,{gap:4,style:{justifyContent:'center',flexWrap:'nowrap'},children:P.map((i,a)=>{const l=j.find(e=>e.staffId===t.id&&e.date===i),o=!(!l||l.published&&!l.changed),d=`${y(t.nickname||t.name)}, ${f[a]} ${b(i)}, ${l?`${(0,r.fmtH)(l.start)} to ${(0,r.fmtH)(l.end)}${o?', draft, not published yet':''}. Change shift`:'off. Add a shift'}`;return(0,h.jsxs)(s.default,{testID:`krota-cell-${t.id}-${a}`,accessibilityRole:"button",accessibilityLabel:d,onPress:()=>D({staffId:t.id,date:i,shift:l}),style:({pressed:e})=>({width:44,minHeight:52,borderRadius:8,paddingVertical:4,alignItems:'center',justifyContent:'center',borderWidth:1,borderStyle:o?'dashed':'solid',borderColor:l?o?c.colours.amber:c.colours.gold:c.colours.border,backgroundColor:e||l?c.colours.goldTint:c.colours.surface2}),children:[(0,h.jsx)(n.T,{size:10,center:!0,colour:i===e?c.colours.gold:c.colours.muted,children:u[a]}),(0,h.jsx)(n.T,{size:10,center:!0,children:l?`${(0,r.fmtH)(l.start).slice(0,5)}`:'off'}),l?(0,h.jsx)(n.T,{size:10,center:!0,children:(0,r.fmtH)(l.end).slice(0,5)}):(0,h.jsx)(n.T,{size:10,center:!0,colour:c.colours.muted,children:"+"})]},i)})})]},t.id)),p.length?null:(0,h.jsx)(n.Muted,{center:!0,children:"No kitchen team on the staff list yet."}),(0,h.jsx)(n.Button,{testID:"krota-publish",kind:L?'primary':'secondary',disabled:!L,label:L?`Publish kitchen rota (${L} ${1===L?'change':'changes'})`:'Kitchen rota published',accessibilityLabel:L?`Publish the kitchen rota for ${R.toLowerCase()}, ${L} ${1===L?'change':'changes'}`:'Kitchen rota published for this week',onPress:()=>{const e=(0,l.publishKitchen)(a.useOwner.getState().shifts,k,H,C);a.useOwner.getState().setShifts(e.shifts),M(e.n?`Published ${e.n} kitchen ${1===e.n?'shift':'shifts'}. The kitchen team see them in their app now.`:'Nothing new to publish this week.')},style:{minHeight:56,alignSelf:'stretch'}}),v?(0,h.jsx)(i.default,{testID:"krota-msg",children:(0,h.jsx)(n.T,{center:!0,colour:c.colours.goldLight,children:v})}):null,(0,h.jsx)(n.Muted,{center:!0,children:"Tap a day to add or change a shift. Dashed amber = draft, only you see it until you publish. Front of house shifts are made in CoverCharge for Managers."}),w?(0,h.jsx)(x,{init:w,onClose:()=>D(null),onSaid:M}):null]})};var t=_r(_d[0]),s=e(_r(_d[1])),i=e(_r(_d[2])),n=_r(_d[3]),a=_r(_d[4]),l=_r(_d[5]),r=_r(_d[6]),o=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]);const u=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],f=['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'],m=e=>`${e.slice(8,10)}/${e.slice(5,7)}`,b=e=>`${e.slice(8,10)}/${e.slice(5,7)}/${e.slice(0,4)}`,y=e=>e.replace(/\s*\(.*\)$/,''),$=[['Lunch',11,16],['Dinner',16.5,22.5],['Double',11,21],['Close',17,23.5]];function x({init:e,onClose:s,onSaid:d}){const u=(0,a.useOwner)(t=>t.staff.find(t=>t.id===e.staffId)),f=y(u?.nickname||u?.name||''),[m,x]=(0,t.useState)(e.shift?.start??11),[j,p]=(0,t.useState)(e.shift?.end??21),[k,S]=(0,t.useState)(!1),[I,w]=(0,t.useState)(''),D=`${(0,o.niceDate)((0,o.parseYmd)(e.date))} (${b(e.date)})`;return(0,h.jsx)(n.Sheet,{visible:!0,onClose:s,title:`${f} \xb7 ${D}`,testID:"krota-sheet",children:(0,h.jsxs)(i.default,{style:{gap:10,alignItems:'center'},children:[(0,h.jsx)(n.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:$.map(([e,t,s])=>(0,h.jsx)(n.Chip,{testID:`krota-preset-${e.toLowerCase()}`,label:`${e} ${(0,r.fmtH)(t)}\u2013${(0,r.fmtH)(s)}`,selected:m===t&&j===s,onPress:()=>{x(t),p(s)}},e))}),(0,h.jsx)(n.T,{center:!0,children:"Start"}),(0,h.jsx)(n.Stepper,{testID:"krota-start",value:m,step:.5,min:r.SHIFT_MIN_START,max:j-1,onChange:x,format:r.fmtH,label:"Start time"}),(0,h.jsxs)(n.T,{center:!0,children:["End",j>=24?' (next day)':'']}),(0,h.jsx)(n.Stepper,{testID:"krota-end",value:j,step:.5,min:m+1,max:r.SHIFT_MAX_END,onChange:p,format:r.fmtH,label:"End time"}),(0,h.jsxs)(n.Muted,{center:!0,children:[(j-m).toFixed(1)," hours"]}),I?(0,h.jsx)(i.default,{accessibilityLiveRegion:"assertive",children:(0,h.jsx)(n.T,{center:!0,colour:c.colours.amber,children:I})}):null,(0,h.jsx)(n.Button,{testID:"krota-save",label:e.shift?'Save shift':'Add shift',accessibilityLabel:`${e.shift?'Save':'Add'} ${f}'s shift, ${D}, ${(0,r.fmtH)(m)} to ${(0,r.fmtH)(j)}`,onPress:()=>{const t=a.useOwner.getState();(0,l.clashes)(t.shifts,e.staffId,e.date,m,j,e.shift?.id)?w(`${f} already has a shift that overlaps on ${D}.`):(e.shift?t.setShifts(t.shifts.map(t=>t.id===e.shift.id?{...t,start:m,end:j,changed:!!t.published||t.changed}:t)):t.addShift({staffId:e.staffId,date:e.date,start:m,end:j}),d(`${e.shift?'Changed':'Added'}: ${f}, ${D}, ${(0,r.fmtH)(m)} to ${(0,r.fmtH)(j)}. Draft until you publish the kitchen rota.`),s())},style:{minHeight:56,alignSelf:'stretch'}}),e.shift&&!k?(0,h.jsx)(n.Button,{testID:"krota-remove",kind:"danger",label:"Remove shift",onPress:()=>S(!0),style:{minHeight:52,alignSelf:'stretch'}}):null,e.shift&&k?(0,h.jsxs)(i.default,{testID:"krota-remove-ask",accessibilityLiveRegion:"assertive",style:{gap:8,alignItems:'center',alignSelf:'stretch'},children:[(0,h.jsxs)(n.T,{center:!0,weight:"semibold",children:["Remove ",f,"\u2019s shift on ",D,"?"]}),(0,h.jsx)(n.Button,{testID:"krota-remove-yes",kind:"danger",label:"Yes, remove it",onPress:()=>{a.useOwner.getState().removeShift(e.shift.id),d(`Removed ${f}'s shift on ${D}.`),s()},style:{minHeight:52,alignSelf:'stretch'}}),(0,h.jsx)(n.Button,{testID:"krota-remove-no",kind:"secondary",label:"No, keep it",onPress:()=>S(!1),style:{minHeight:52,alignSelf:'stretch'}})]}):null]})})}},1165,[34,402,102,794,891,988,1087,858,1166,821,25]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.KitchenRotaEditor=p,_e.KitchenRotaTab=function({today:e=(0,h.ymd)(new Date)}){const t=(0,r.canEditKitchenRota)((0,d.useSync)(e=>e.perms));return(0,m.jsx)(i.default,{testID:"chef-rota-tab",style:{alignSelf:'stretch',alignItems:'center'},children:t?(0,m.jsx)(p,{today:e}):(0,m.jsx)(w,{today:e})})},_e.KitchenRotaRead=w;var t=_r(_d[0]),s=e(_r(_d[1])),i=e(_r(_d[2])),n=_r(_d[3]),a=_r(_d[4]),r=_r(_d[5]),l=_r(_d[6]),o=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]),u=_r(_d[11]),f=_r(_d[12]),m=_r(_d[13]);const y=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],b=['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'],x=e=>`${e.slice(8,10)}/${e.slice(5,7)}`,j=e=>`${e.slice(8,10)}/${e.slice(5,7)}/${e.slice(0,4)}`,$=e=>e.replace(/\s*\(.*\)$/,''),k=[['Lunch',11,16],['Dinner',16.5,22.5],['Double',11,21],['Close',17,23.5]];function p({today:e=(0,h.ymd)(new Date)}){const l=(0,a.useOwner)(e=>e.staff),o=(0,a.useOwner)(e=>e.shifts),d=(0,t.useMemo)(()=>(0,r.kitchenTeam)(l),[l]),k=(0,t.useMemo)(()=>new Set(d.map(e=>e.id)),[d]),[p,w]=(0,t.useState)(0),[I,D]=(0,t.useState)(null),[T,v]=(0,t.useState)(''),H=(0,a.addDays)((0,a.mondayOfDate)(e),7*p),C=(0,a.addDays)(H,6),L=y.map((e,t)=>(0,a.addDays)(H,t)),P=(0,r.kitchenPending)(o,k,H,C).length,R=e=>{v(e),(0,u.announce)(e)},M=0===p?'This week':1===p?'Next week':-1===p?'Last week':`Week of ${j(H)}`;return(0,m.jsxs)(i.default,{testID:"kitchen-rota-editor",style:{gap:10,alignItems:'center'},children:[(0,m.jsx)(n.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Kitchen rota"}),(0,m.jsxs)(n.Row,{gap:8,style:{justifyContent:'center',alignItems:'center'},children:[(0,m.jsx)(n.Button,{small:!0,kind:"ghost",testID:"krota-prev",label:"\u2039 Prev",accessibilityLabel:"Previous week",onPress:()=>{w(p-1),v('')},style:{minWidth:84,minHeight:48}}),(0,m.jsxs)(i.default,{accessible:!0,accessibilityLabel:`${M}, ${b[0]} ${j(H)} to ${b[6]} ${j(C)}`,style:{alignItems:'center',minWidth:120},children:[(0,m.jsx)(n.T,{weight:"semibold",center:!0,children:M}),(0,m.jsxs)(n.Muted,{center:!0,children:[x(H)," \u2013 ",x(C)]})]}),(0,m.jsx)(n.Button,{small:!0,kind:"ghost",testID:"krota-next",label:"Next \u203a",accessibilityLabel:"Next week",onPress:()=>{w(p+1),v('')},style:{minWidth:84,minHeight:48}})]}),d.map(t=>(0,m.jsxs)(i.default,{testID:"krota-row",style:{gap:4,alignItems:'center',alignSelf:'stretch'},children:[(0,m.jsxs)(n.T,{size:14,weight:"semibold",center:!0,children:[$(t.nickname||t.name),t.job?(0,m.jsx)(n.T,{size:12,colour:f.colours.muted,children:` ${t.job}`}):null]}),(0,m.jsx)(n.Row,{gap:4,style:{justifyContent:'center',flexWrap:'nowrap'},children:L.map((i,a)=>{const r=o.find(e=>e.staffId===t.id&&e.date===i),l=!(!r||r.published&&!r.changed),d=`${$(t.nickname||t.name)}, ${b[a]} ${j(i)}, ${r?`${(0,c.fmtH)(r.start)} to ${(0,c.fmtH)(r.end)}${l?', draft, not published yet':''}. Change shift`:'off. Add a shift'}`;return(0,m.jsxs)(s.default,{testID:`krota-cell-${t.id}-${a}`,accessibilityRole:"button",accessibilityLabel:d,onPress:()=>D({staffId:t.id,date:i,shift:r}),style:({pressed:e})=>({width:44,minHeight:52,borderRadius:8,paddingVertical:4,alignItems:'center',justifyContent:'center',borderWidth:1,borderStyle:l?'dashed':'solid',borderColor:r?l?f.colours.amber:f.colours.gold:f.colours.border,backgroundColor:e||r?f.colours.goldTint:f.colours.surface2}),children:[(0,m.jsx)(n.T,{size:10,center:!0,colour:i===e?f.colours.gold:f.colours.muted,children:y[a]}),(0,m.jsx)(n.T,{size:10,center:!0,children:r?`${(0,c.fmtH)(r.start).slice(0,5)}`:'off'}),r?(0,m.jsx)(n.T,{size:10,center:!0,children:(0,c.fmtH)(r.end).slice(0,5)}):(0,m.jsx)(n.T,{size:10,center:!0,colour:f.colours.muted,children:"+"})]},i)})})]},t.id)),d.length?null:(0,m.jsx)(n.Muted,{center:!0,children:"No kitchen team on the staff list yet."}),(0,m.jsx)(n.Button,{testID:"krota-publish",kind:P?'primary':'secondary',disabled:!P,label:P?`Publish kitchen rota (${P} ${1===P?'change':'changes'})`:'Kitchen rota published',accessibilityLabel:P?`Publish the kitchen rota for ${M.toLowerCase()}, ${P} ${1===P?'change':'changes'}`:'Kitchen rota published for this week',onPress:()=>{const e=(0,r.publishKitchen)(a.useOwner.getState().shifts,k,H,C);a.useOwner.getState().setShifts(e.shifts),R(e.n?`Published ${e.n} kitchen ${1===e.n?'shift':'shifts'}. The kitchen team see them in their app now.`:'Nothing new to publish this week.')},style:{minHeight:56,alignSelf:'stretch'}}),T?(0,m.jsx)(i.default,{testID:"krota-msg",children:(0,m.jsx)(n.T,{center:!0,colour:f.colours.goldLight,children:T})}):null,(0,m.jsx)(n.Muted,{center:!0,children:"Tap a day to add or change a shift. Dashed amber = draft, only you see it until you publish. Front of house shifts are made in CoverCharge for Managers."}),I?(0,m.jsx)(S,{init:I,onClose:()=>D(null),onSaid:R}):null]})}function w({today:e=(0,h.ymd)(new Date)}){const{staff:s,shifts:r}=(0,o.rotaView)('chef',(0,a.useOwner)(e=>e.staff),(0,a.useOwner)(e=>e.shifts)),d=(0,a.useOwner)(e=>e.leave),[u,k]=(0,t.useState)(0),p=(0,a.addDays)((0,a.mondayOfDate)(e),7*u),w=(0,a.addDays)(p,6),S=y.map((e,t)=>(0,a.addDays)(p,t)),I=s.filter(e=>/kitchen|chef|kp/i.test(`${e.job??''} ${e.name}`)),D=0===u?'This week':1===u?'Next week':-1===u?'Last week':`Week of ${j(p)}`,[T,v]=(0,t.useState)(0),H=T?Math.max(30,Math.min(44,Math.floor((T-12)/7))):40;return(0,m.jsxs)(i.default,{testID:"kitchen-rota-read",onLayout:e=>v(e.nativeEvent.layout.width),style:{gap:10,alignItems:'center',alignSelf:'stretch'},children:[(0,m.jsx)(n.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Kitchen rota"}),(0,m.jsxs)(n.Row,{gap:8,style:{justifyContent:'center',alignItems:'center'},children:[(0,m.jsx)(n.Button,{small:!0,kind:"ghost",testID:"krota-read-prev",label:"\u2039 Prev",accessibilityLabel:"Previous week",onPress:()=>k(u-1),style:{minWidth:84,minHeight:48}}),(0,m.jsxs)(i.default,{accessible:!0,accessibilityLabel:`${D}, ${b[0]} ${j(p)} to ${b[6]} ${j(w)}`,style:{alignItems:'center',minWidth:120},children:[(0,m.jsx)(n.T,{weight:"semibold",center:!0,children:D}),(0,m.jsxs)(n.Muted,{center:!0,children:[x(p)," \u2013 ",x(w)]})]}),(0,m.jsx)(n.Button,{small:!0,kind:"ghost",testID:"krota-read-next",label:"Next \u203a",accessibilityLabel:"Next week",onPress:()=>k(u+1),style:{minWidth:84,minHeight:48}})]}),I.map(t=>(0,m.jsxs)(i.default,{testID:"krota-read-row",style:{gap:4,alignItems:'center',alignSelf:'stretch'},children:[(0,m.jsx)(n.T,{size:14,weight:"semibold",center:!0,children:$(t.nickname||t.name)}),(0,m.jsx)(n.Row,{gap:2,style:{justifyContent:'center',flexWrap:'nowrap'},children:S.map((s,a)=>{const o=r.find(e=>e.staffId===t.id&&e.date===s),h=o?(0,l.leaveCovering)(d,t.id,s):void 0,u=o?h?(0,l.leaveLabel)(h):`${(0,c.fmtH)(o.start)} to ${(0,c.fmtH)(o.end)}`:'off';return(0,m.jsxs)(i.default,{testID:`krota-read-cell-${t.id}-${a}`,accessible:!0,accessibilityLabel:`${$(t.nickname||t.name)}, ${b[a]} ${j(s)}, ${u}`,style:{width:H,minHeight:52,borderRadius:8,paddingVertical:4,paddingHorizontal:0,alignItems:'center',justifyContent:'center',borderWidth:1,borderColor:o?f.colours.gold:f.colours.border,backgroundColor:o?f.colours.goldTint:f.colours.surface2},children:[(0,m.jsx)(n.T,{size:10,center:!0,colour:s===e?f.colours.gold:f.colours.muted,children:y[a]}),o&&h?(0,m.jsx)(n.T,{size:9,center:!0,colour:f.colours.blue,children:(0,l.leaveLabel)(h).toLowerCase()}):(0,m.jsx)(n.T,{size:10,center:!0,children:o?(0,c.fmtH)(o.start).slice(0,5):'off'}),o&&!h?(0,m.jsx)(n.T,{size:10,center:!0,children:(0,c.fmtH)(o.end).slice(0,5)}):null]},s)})})]},t.id)),I.length?null:(0,m.jsx)(n.Muted,{center:!0,children:"No kitchen shifts on the rota yet."}),(0,m.jsx)(n.Muted,{center:!0,children:"This shows published shifts only. To change the kitchen rota here, an owner can tick \u201cMake the kitchen rota\u201d for you on the Permissions screen."})]})}function S({init:e,onClose:s,onSaid:l}){const o=(0,a.useOwner)(t=>t.staff.find(t=>t.id===e.staffId)),d=$(o?.nickname||o?.name||''),[u,y]=(0,t.useState)(e.shift?.start??11),[b,x]=(0,t.useState)(e.shift?.end??21),[p,w]=(0,t.useState)(!1),[S,I]=(0,t.useState)(''),D=`${(0,h.niceDate)((0,h.parseYmd)(e.date))} (${j(e.date)})`;return(0,m.jsx)(n.Sheet,{visible:!0,onClose:s,title:`${d} \xb7 ${D}`,testID:"krota-sheet",children:(0,m.jsxs)(i.default,{style:{gap:10,alignItems:'center'},children:[(0,m.jsx)(n.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:k.map(([e,t,s])=>(0,m.jsx)(n.Chip,{testID:`krota-preset-${e.toLowerCase()}`,label:`${e} ${(0,c.fmtH)(t)}\u2013${(0,c.fmtH)(s)}`,selected:u===t&&b===s,onPress:()=>{y(t),x(s)}},e))}),(0,m.jsx)(n.T,{center:!0,children:"Start"}),(0,m.jsx)(n.Stepper,{testID:"krota-start",value:u,step:.5,min:c.SHIFT_MIN_START,max:b-1,onChange:y,format:c.fmtH,label:"Start time"}),(0,m.jsxs)(n.T,{center:!0,children:["End",b>=24?' (next day)':'']}),(0,m.jsx)(n.Stepper,{testID:"krota-end",value:b,step:.5,min:u+1,max:c.SHIFT_MAX_END,onChange:x,format:c.fmtH,label:"End time"}),(0,m.jsxs)(n.Muted,{center:!0,children:[(b-u).toFixed(1)," hours"]}),S?(0,m.jsx)(i.default,{accessibilityLiveRegion:"assertive",children:(0,m.jsx)(n.T,{center:!0,colour:f.colours.amber,children:S})}):null,(0,m.jsx)(n.Button,{testID:"krota-save",label:e.shift?'Save shift':'Add shift',accessibilityLabel:`${e.shift?'Save':'Add'} ${d}'s shift, ${D}, ${(0,c.fmtH)(u)} to ${(0,c.fmtH)(b)}`,onPress:()=>{const t=a.useOwner.getState();(0,r.clashes)(t.shifts,e.staffId,e.date,u,b,e.shift?.id)?I(`${d} already has a shift that overlaps on ${D}.`):(e.shift?t.setShifts(t.shifts.map(t=>t.id===e.shift.id?{...t,start:u,end:b,changed:!!t.published||t.changed}:t)):t.addShift({staffId:e.staffId,date:e.date,start:u,end:b}),l(`${e.shift?'Changed':'Added'}: ${d}, ${D}, ${(0,c.fmtH)(u)} to ${(0,c.fmtH)(b)}. Draft until you publish the kitchen rota.`),s())},style:{minHeight:56,alignSelf:'stretch'}}),e.shift&&!p?(0,m.jsx)(n.Button,{testID:"krota-remove",kind:"danger",label:"Remove shift",onPress:()=>w(!0),style:{minHeight:52,alignSelf:'stretch'}}):null,e.shift&&p?(0,m.jsxs)(i.default,{testID:"krota-remove-ask",accessibilityLiveRegion:"assertive",style:{gap:8,alignItems:'center',alignSelf:'stretch'},children:[(0,m.jsxs)(n.T,{center:!0,weight:"semibold",children:["Remove ",d,"\u2019s shift on ",D,"?"]}),(0,m.jsx)(n.Button,{testID:"krota-remove-yes",kind:"danger",label:"Yes, remove it",onPress:()=>{a.useOwner.getState().removeShift(e.shift.id),l(`Removed ${d}'s shift on ${D}.`),s()},style:{minHeight:52,alignSelf:'stretch'}}),(0,m.jsx)(n.Button,{testID:"krota-remove-no",kind:"secondary",label:"No, keep it",onPress:()=>w(!1),style:{minHeight:52,alignSelf:'stretch'}})]}):null]})})}},1165,[34,402,102,794,891,988,1094,993,987,1087,858,1166,821,25]); __d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.primeAnnouncer=function(){u()},_e.announce=function(t){const e=String(t??'').trim();if(!e)return;{const t=u();if(!t)return;const n=++o;return t.textContent='',void setTimeout(()=>{n===o&&(t.textContent=e)},80)}},Object.defineProperty(_e,"lastAnnounced",{enumerable:!0,get:function(){return c}});var t,e=r(d[0]);(t=e)&&t.__esModule;r(d[1]);let n=null,o=0;function u(){if('undefined'==typeof document||!document.body)return null;if(n&&document.body.contains(n))return n;const t=document.createElement('div');return t.id='cc-announcer',t.setAttribute('aria-live','assertive'),t.setAttribute('aria-atomic','true'),t.setAttribute('role','status'),t.setAttribute('data-testid','cc-announcer'),Object.assign(t.style,{position:'absolute',width:'1px',height:'1px',margin:'-1px',padding:'0',overflow:'hidden',clip:'rect(0 0 0 0)',whiteSpace:'nowrap',border:'0'}),document.body.appendChild(t),n=t,t}const c=()=>n?.textContent??''},1166,[281,236]); __d(function(g,r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useSuggestions=j,_e.OrdersScreen=function({focus:e}={}){const[s,t]=(0,n.useState)('sheets');return(0,x.jsxs)(l.default,{style:{gap:12},children:[(0,x.jsx)(y.Seg,{value:s,onChange:t,options:[{id:'sheets',label:'Order sheets'},{id:'suggested',label:'Suggested orders'},{id:'history',label:'Order history'}]}),'sheets'===s?(0,x.jsx)(m.OrderSheets,{focus:e}):'suggested'===s?(0,x.jsx)(w,{}):(0,x.jsx)($,{})]})};var s=r(_d[0]),t=r(_d[1]),n=r(_d[2]),i=e(r(_d[3])),l=e(r(_d[4])),d=r(_d[5]),o=r(_d[6]),u=r(_d[7]),c=r(_d[8]),h=r(_d[9]),p=r(_d[10]),y=r(_d[11]),f=r(_d[12]),m=r(_d[13]),x=r(_d[14]);const b=(e,s)=>'kg'===s?Math.ceil(2*e)/2:Math.ceil(e);function j(){const{k:e,now:s,rid:n}=(0,y.useChef)(6e4),{pct:i}=(0,y.useForecast)(),l=(0,u.supplierView)('chef',(0,o.useOwner)(e=>e.suppliers)).filter(e=>!e.archived),d=1+Math.max(0,i)/100;return l.map(i=>{const l=e.ingredients.filter(e=>e.supplierId===i.id).map(e=>({i:e,qty:(0,t.fishInStone)(n,e)?(0,t.fromStone)(Math.ceil(2*(0,t.toStone)(Math.max(0,e.par*d-e.onHand),e.unit))/2,e.unit):b(Math.max(0,e.par*d-e.onHand),e.unit)})).filter(e=>e.qty>0),o=(0,p.weekday)(s),u=i.orderDays.includes(o),[c,h]=(i.cutoff||'23:59').split(':').map(Number),y=new Date(s);y.setHours(c,h,0,0);const f=e.orders.some(e=>e.supplierId===i.id&&new Date(e.at).toDateString()===s.toDateString()),m=[1,2,3,4,5,6,7].map(e=>(o+e)%7).find(e=>i.orderDays.includes(e));return{s:i,lines:l,ordersToday:u,cutPassed:s>y,placedToday:f,nextDay:m,total:Math.round(l.reduce((e,s)=>e+s.qty*s.i.cost,0))}}).filter(e=>e.lines.length||e.ordersToday)}function w(){const{me:e,rid:o}=(0,y.useChef)(),{label:u,covers:m,enough:b,booked:w}=(0,y.useForecast)(),$=(0,f.useKitchen)(e=>e.addOrder),S=j(),[C,M]=(0,n.useState)({}),[O,k]=(0,n.useState)('');return(0,x.jsxs)(l.default,{style:{gap:10},children:[(0,x.jsxs)(d.Muted,{children:[b?`Built from par levels and today's forecast (${m} Covers, ${u} vs a typical day).`:`Built from par levels (no forecast yet: not enough history; ${w} Covers booked so far).`," Adjust, then call the supplier or use their ordering website. Nothing is sent by CoverCharge."]}),O?(0,x.jsx)(d.Banner,{kind:"success",title:"Saved to order history",children:O}):null,S.map(({s:n,lines:u,ordersToday:y,cutPassed:f,placedToday:m,nextDay:b,total:j})=>{const w=u.map(e=>({...e,q:C[`${n.id}:${e.i.id}`]??e.qty})),S=Math.round(w.reduce((e,s)=>e+s.q*s.i.cost,0)),O=s=>{$({supplierId:n.id,by:e,status:s,lines:w.filter(e=>e.q>0).map(e=>({ing:e.i.id,qty:e.q,cost:e.i.cost})),total:S}),k(`${n.name}: ${(0,c.gbp)(S)} (${s}).`)};return(0,x.jsxs)(d.Card,{highlight:!y||m||f?void 0:h.colours.gold,children:[(0,x.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsxs)(l.default,{style:{flex:1},children:[(0,x.jsx)(d.T,{weight:"semibold",children:n.name}),(0,x.jsxs)(d.Muted,{children:[n.category," \xb7 min order ",(0,c.gbp)(n.minOrder)]})]}),m?(0,x.jsx)(d.Badge,{kind:"ok",label:"ORDERED TODAY"}):y?(0,x.jsx)(d.Badge,{kind:f?'red':'amber',label:f?`CUT-OFF ${n.cutoff} PASSED`:`ORDER BY ${n.cutoff}`}):(0,x.jsx)(d.Badge,{label:`NEXT ${null!=b?p.DAY3[b].toUpperCase():'\u2014'}`})]}),w.length?w.map(e=>(0,x.jsxs)(d.Row,{wrap:!0,style:{justifyContent:'space-between'},children:[(0,x.jsxs)(l.default,{style:{flex:1},children:[(0,x.jsx)(d.T,{size:14,children:e.i.name}),(0,x.jsxs)(d.Muted,{children:["On hand ",(0,s.ingredientQty)(o,e.i,e.i.onHand)," \xb7 par ",(0,s.ingredientQty)(o,e.i,e.i.par)]})]}),(0,x.jsx)(d.Button,{small:!0,kind:"ghost",label:"Less",accessibilityLabel:`${(0,t.fishInStone)(o,e.i)?'Half a stone less':'Less'} ${e.i.name}`,onPress:()=>M(s=>({...s,[`${n.id}:${e.i.id}`]:(0,t.stepQuantity)(o,e.i,e.q,-1)}))}),(0,x.jsx)(l.default,{accessible:!0,accessibilityLabel:(0,s.ingredientSpeech)(o,e.i,e.q),children:(0,x.jsx)(d.T,{size:16,style:{minWidth:76,textAlign:'center'},children:(0,s.ingredientQty)(o,e.i,e.q)})}),(0,x.jsx)(d.Button,{small:!0,kind:"ghost",label:"More",accessibilityLabel:`${(0,t.fishInStone)(o,e.i)?'Half a stone more':'More'} ${e.i.name}`,onPress:()=>M(s=>({...s,[`${n.id}:${e.i.id}`]:(0,t.stepQuantity)(o,e.i,e.q,1)}))})]},e.i.id)):(0,x.jsx)(d.Muted,{children:"Everything is at par."}),w.length?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsxs)(d.T,{weight:"semibold",children:["Estimated ",(0,c.gbp)(S)]}),S{i.default.openURL(`tel:${n.phones[0].replace(/\s/g,'')}`).catch(()=>{}),O('placed (by phone)')}}):null,n.website?(0,x.jsx)(d.Button,{small:!0,kind:"secondary",label:"Open website",onPress:()=>{i.default.openURL(n.website).catch(()=>{}),O('placed (on website)')}}):null]})]}):null,void 0]},n.id)})]})}function $(){const{k:e,rid:t}=(0,y.useChef)(),n=(0,o.useOwner)(e=>e.suppliers);return(0,x.jsx)(l.default,{style:{gap:8},children:e.orders.map(i=>(0,x.jsxs)(d.Card,{children:[(0,x.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(d.T,{weight:"semibold",style:{flex:1},children:n.find(e=>e.id===i.supplierId)?.name}),(0,x.jsx)(d.Badge,{kind:"neutral",label:i.status.toUpperCase()})]}),(0,x.jsxs)(d.Muted,{children:[new Date(i.at).toLocaleString('en-GB',{weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})," \xb7 ",i.by,i.total?` \xb7 ${(0,c.gbp)(i.total)}`:'']}),i.lines.length?(0,x.jsx)(d.Muted,{children:i.lines.map(n=>{const i=e.ingredients.find(e=>e.id===n.ing);return`${(0,s.ingredientQty)(t,i??{name:n.ing,unit:''},n.qty)} ${i?.name??n.ing}`}).join(', ')}):null]},i.id))})}},1167,[1153,984,34,379,102,794,891,993,867,821,1084,1145,1029,1168,25]); __d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.openLink=j,_e.useSheetReminders=T,_e.OrderSheets=function({focus:e}){const{rid:t,now:l}=(0,x.useChef)(3e4),o=(0,u.useSheets)(t).filter(e=>(0,n.chefCanSee)(t,e)&&!e.placeholder),[h,c]=(0,s.useState)(e??null),p=T(),f=(0,b.wd)(l);return(0,y.jsxs)(d.default,{style:{gap:10},testID:"order-sheets",children:[(0,y.jsx)(i.Banner,{kind:"info",title:"Nothing is sent for you",children:"Text, WhatsApp and phone orders open your phone\u2019s own app with the order already written. Check it, then press Send yourself."}),p.map(e=>(0,y.jsx)(r.default,{accessibilityRole:"button",onPress:()=>c(e.supplierId),children:(0,y.jsxs)(i.Banner,{kind:'red'===e.tone?'danger':'warn',title:`\u23f0 ${e.text}`,children:["Tap to open the ",e.name," order sheet."]})},e.supplierId)),(0,y.jsxs)(i.Muted,{children:["Today is ",b.DAYS[f],". Edit suppliers in Managers \u203a Settings \u203a Supplier order sheets."]}),o.map(e=>(0,y.jsx)(C,{s:e,open:h===e.id,onToggle:()=>c(h===e.id?null:e.id)},e.id)),o.length?null:(0,y.jsx)(i.Muted,{children:"No order sheets yet. Add suppliers in Managers \u203a Settings \u203a Supplier order sheets."})]})};var t=_r(_d[0]),n=_r(_d[1]),l=_r(_d[2]),s=_r(_d[3]),o=e(_r(_d[4]));_r(_d[5]);var r=e(_r(_d[6])),d=e(_r(_d[7])),i=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),c=_r(_d[11]),p=_r(_d[12]),b=_r(_d[13]),f=_r(_d[14]),x=_r(_d[15]),y=_r(_d[16]);function j(e){if('undefined'!=typeof window){const t=window;return'function'==typeof t.__ccOpenLink?void t.__ccOpenLink(e):void(/^https?:/.test(e)?window.open(e,'_blank','noopener'):window.location.href=e)}o.default.openURL(e).catch(()=>{})}async function w(e){try{const t='undefined'!=typeof navigator?navigator:null;if(t?.clipboard?.writeText)return await t.clipboard.writeText(e),!0}catch{}return!1}const k={online:'\ud83c\udf10',phone:'\ud83d\udcde',text:'\ud83d\udcac',whatsapp:'\u2706',tbc:'\ud83d\udd8a\ufe0f'},S={borderWidth:1,borderColor:f.colours.border,borderRadius:10,paddingHorizontal:12,paddingVertical:10,color:f.colours.text,backgroundColor:f.colours.surface2,fontSize:f.font.body};function T(){const{rid:e,now:t}=(0,x.useChef)(6e4),l=(0,u.useSheets)(e).filter(t=>(0,n.chefCanSee)(e,t)&&!t.placeholder),s=(0,u.useOrderSheets)(e=>e.opened),o=(0,h.useShellfish)(e,'','chef'),r=(0,b.remindersFor)(l,t,s);for(const n of l){const l=o.items.filter(e=>(e.supplierId===n.id||!e.supplierId&&n.shellfish)&&o.isLow(e.key));!l.length||s[n.id]&&new Date(s[n.id]).toDateString()===t.toDateString()||r.push({supplierId:n.id,name:n.name,text:`${'text'===n.method||'whatsapp'===n.method?'Text':'Order from'} ${n.contact||n.name}: ${l.map(t=>`${(0,c.fmtStockCount)(e,t,o.counts[t.key]??0)} ${t.plural.toLowerCase()}`).join(' and ')} left`,tone:'amber',cutoffPassed:!1})}return r}function C({s:e,open:n,onToggle:o}){const{rid:T,r:C,me:$,now:D}=(0,x.useChef)(3e4),v=(0,u.useOrderSheets)(e=>e.patch),I=(0,u.useOrderSheets)(e=>e.markOpened),M=(0,u.useOrderSheets)(t=>t.opened[e.id]),[B,L]=(0,s.useState)({}),[P,O]=(0,s.useState)(''),[R,A]=(0,s.useState)(''),[z,_]=(0,s.useState)(!1),W=(0,h.useShellfish)(T,$,'chef'),H=(0,b.nextDelivery)(e,D),K=(0,b.orderLines)(e,B,P,T),E=(C.address??C.location??'').split(',').map(e=>e.trim()).filter(Boolean),q=E.length>=3?E[1]:E[0]??'',N=(0,b.orderMessage)(e,C.name,q,K,$.split(' ')[0],D),U=e.orderDays.includes((0,b.wd)(D)),Q=(e,t)=>L(n=>({...n,[e.id]:(0,l.stepQuantity)(T,e,n[e.id]||0,t)})),Y=t=>{I(e.id,D.toISOString()),j(t)},F='text'===e.method||'whatsapp'===e.method||'phone'===e.method,G=Math.round(100*parseFloat(R.replace(/[\xa3,]/g,''))),V=W.items.filter(t=>t.supplierId===e.id||!t.supplierId&&e.shellfish),J=V.filter(e=>W.isLow(e.key));return(0,y.jsxs)(d.default,{testID:`sheet-${e.id}`,style:{borderRadius:14,borderWidth:1.5,borderColor:U||J.length?f.colours.amber:n?f.colours.gold:f.colours.border,backgroundColor:f.colours.surface,overflow:'hidden'},children:[(0,y.jsxs)(r.default,{accessibilityRole:"button",accessibilityLabel:`${e.name} order sheet`,onPress:o,style:{padding:12,gap:4},children:[(0,y.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsxs)(i.T,{weight:"semibold",size:f.font.large,style:{flex:1},children:[k[e.method]," ",e.name]}),(0,y.jsx)(i.Badge,{kind:e.placeholder?'amber':'gold',label:e.placeholder?'To fill in':b.METHOD_LABEL[e.method]})]}),(0,y.jsx)(i.Muted,{children:e.goods}),(0,y.jsxs)(i.Row,{wrap:!0,gap:6,children:[e.deliveryDays.length?(0,y.jsx)(i.Badge,{kind:"neutral",label:`Delivers ${(0,b.dayRange)(e.deliveryDays)}`}):null,e.orderDays.length?(0,y.jsx)(i.Badge,{kind:U?'amber':'neutral',label:`Order ${(0,b.dayRange)(e.orderDays)}${e.cutoff?` by ${e.cutoff}`:''}`}):null,e.frequency?(0,y.jsx)(i.Badge,{kind:"neutral",label:e.frequency}):null,e.priceCapPerKg?(0,y.jsx)(i.Badge,{kind:"blue",label:`Cap ${(0,p.gbp)(e.priceCapPerKg)}/kg`}):null,V.length?(0,y.jsx)(i.Badge,{kind:J.length?'amber':'ok',label:V.map(e=>`${e.icon} ${(0,c.fmtStockCount)(T,e,W.counts[e.key]??0)}`).join(' \xb7 ')}):null,M&&new Date(M).toDateString()===D.toDateString()?(0,y.jsx)(i.Badge,{kind:"ok",label:"Opened today \u2713"}):null]})]}),n?(0,y.jsxs)(d.default,{style:{padding:12,paddingTop:0,gap:10},children:[H?(0,y.jsxs)(i.Muted,{children:["Next delivery if you order now: ",(0,b.niceDay)(H),"."]}):null,e.reminder?(0,y.jsxs)(i.Muted,{children:["Reminder on ",e.orderDays.map(e=>b.DAYS[e]).join(', '),": ",e.reminder]}):null,e.notes?(0,y.jsx)(i.T,{size:f.font.small,colour:f.colours.muted,children:e.notes}):null,e.placeholder?(0,y.jsx)(i.Banner,{kind:"warn",title:"Still to be set up",children:"Add the supplier, how to order and delivery days in Managers \u203a Settings \u203a Supplier order sheets."}):null,e.items.map(e=>(0,y.jsxs)(d.default,{style:{gap:6},children:[(0,y.jsxs)(i.T,{children:[e.name,e.unit?(0,y.jsxs)(i.T,{size:f.font.small,colour:f.colours.muted,children:[" (",(0,l.quantityUnit)(T,e),")"]}):null]}),(0,y.jsxs)(i.Row,{wrap:!0,gap:8,style:{justifyContent:'space-between'},children:[(0,y.jsx)(i.Button,{small:!0,kind:"secondary",label:"Less",accessibilityLabel:`${(0,l.fishInStone)(T,e)?'Half a stone less':'Less'} ${e.name}`,onPress:()=>Q(e,-1),style:{minWidth:44,minHeight:44}}),(0,y.jsx)(d.default,{accessible:!0,accessibilityLabel:(0,l.fishQtySpeech)(T,e,B[e.id]||0),children:(0,y.jsx)(i.T,{weight:"bold",size:20,style:{minWidth:76,textAlign:'center'},children:(0,l.fishInStone)(T,e)?(0,l.fishQtyText)(T,e,B[e.id]||0):B[e.id]||0})}),(0,y.jsx)(i.Button,{small:!0,kind:"secondary",label:"More",accessibilityLabel:`${(0,l.fishInStone)(T,e)?'Half a stone more':'More'} ${e.name}`,testID:`qty-${e.id}`,onPress:()=>Q(e,1),style:{minWidth:44,minHeight:44}})]})]},e.id)),(0,y.jsxs)(d.default,{style:{gap:4},children:[(0,y.jsx)(i.T,{size:f.font.small,weight:"medium",colour:f.colours.muted,children:"Anything else (one line each)"}),(0,y.jsx)(t.TextInput,{value:P,onChangeText:O,multiline:!0,placeholder:"e.g. 2 boxes lemons",placeholderTextColor:f.colours.muted,style:[S,{minHeight:60}]})]}),F?(0,y.jsxs)(d.default,{style:{gap:4},children:[(0,y.jsxs)(i.T,{size:f.font.small,weight:"medium",colour:f.colours.muted,children:['whatsapp'===e.method?'WhatsApp number':'phone'===e.method?'Phone number':'Mobile number',e.number?'':' (blank: fill in once, it is saved)']}),(0,y.jsx)(t.TextInput,{testID:`number-${e.id}`,value:e.number,onChangeText:t=>v(T,e.id,{number:t}),keyboardType:"phone-pad",placeholder:"07\u2026",placeholderTextColor:f.colours.muted,style:S})]}):null,'online'===e.method?(0,y.jsxs)(d.default,{style:{gap:4},children:[(0,y.jsxs)(i.T,{size:f.font.small,weight:"medium",colour:f.colours.muted,children:['Open Coldweb'===e.urlLabel?'Coldweb ordering link':'Website link',e.url?'':' (blank: paste it in once, it is saved)']}),(0,y.jsx)(t.TextInput,{testID:`url-${e.id}`,value:e.url,onChangeText:t=>v(T,e.id,{url:t.trim()}),autoCapitalize:"none",keyboardType:"url",placeholder:"https://\u2026",placeholderTextColor:f.colours.muted,style:S})]}):null,e.priceCapPerKg?(0,y.jsxs)(d.default,{style:{gap:6,padding:10,borderRadius:12,backgroundColor:f.colours.blueBg},children:[(0,y.jsxs)(i.T,{weight:"semibold",colour:"#E2C489",children:["Price cap ",(0,p.gbp)(e.priceCapPerKg),"/kg \xb7 buy from the cheapest UK seller under it"]}),(0,y.jsxs)(i.Muted,{children:["Seller: ",e.seller||'to be chosen']}),(0,y.jsxs)(i.Row,{gap:8,children:[(0,y.jsx)(i.T,{size:f.font.small,style:{flex:1},children:"Price you found (\xa3/kg)"}),(0,y.jsx)(t.TextInput,{testID:"price-found",value:R,onChangeText:A,keyboardType:"decimal-pad",placeholder:"e.g. 22.50",placeholderTextColor:f.colours.muted,style:[S,{width:120}]})]}),G>0?(0,y.jsx)(i.Badge,{kind:G<=e.priceCapPerKg?'ok':'red',label:G<=e.priceCapPerKg?`${(0,p.gbp)(G)}/kg is under the cap \u2713`:`${(0,p.gbp)(G)}/kg is over the ${(0,p.gbp)(e.priceCapPerKg)} cap: look for a cheaper seller`}):null]}):null,'online'!==e.method&&'tbc'!==e.method?(0,y.jsxs)(d.default,{testID:`preview-${e.id}`,style:{padding:10,borderRadius:12,borderWidth:1,borderColor:f.colours.border,backgroundColor:f.colours.surface2},children:[(0,y.jsx)(i.T,{size:12,weight:"semibold",colour:f.colours.gold,children:'phone'===e.method?'READ THIS OUT':'YOUR MESSAGE'}),(0,y.jsx)(i.T,{size:f.font.small,children:K.length?N:'Add quantities above to write the order.'})]}):null,(0,y.jsxs)(i.Row,{wrap:!0,gap:8,children:['text'===e.method?(0,y.jsx)(i.Button,{testID:`send-${e.id}`,kind:"success",label:"\ud83d\udcac Open in Messages",disabled:!K.length,onPress:()=>Y((0,b.smsLink)(e.number,N))}):null,'whatsapp'===e.method?(0,y.jsx)(i.Button,{testID:`send-${e.id}`,kind:"success",label:"Open in WhatsApp",disabled:!K.length,onPress:()=>Y((0,b.waLink)(e.number,N))}):null,'phone'===e.method?(0,y.jsx)(i.Button,{testID:`send-${e.id}`,kind:"success",label:`\ud83d\udcde Call ${e.name}`,disabled:!e.number,onPress:()=>Y((0,b.telLink)(e.number))}):null,'online'===e.method?(0,y.jsx)(i.Button,{testID:`send-${e.id}`,kind:"success",label:`\ud83c\udf10 ${e.urlLabel??'Open website'}`,disabled:!e.url,onPress:()=>Y(e.url)}):null,'online'!==e.method&&'tbc'!==e.method&&K.length?(0,y.jsx)(i.Button,{kind:"ghost",label:z?'Copied \u2713':'Copy order',onPress:async()=>{const e=await w(N);_(e),e&&setTimeout(()=>_(!1),2e3)}}):null]}),'text'===e.method&&!e.number&&K.length?(0,y.jsx)(i.Muted,{children:"No number saved: Messages opens with the order written and asks who to send it to."}):null,'whatsapp'===e.method&&!e.number&&K.length?(0,y.jsx)(i.Muted,{children:"No number saved: WhatsApp opens with the order written and asks who to send it to."}):null,'phone'!==e.method||e.number?null:(0,y.jsx)(i.Muted,{children:"Add the phone number above to call from here."}),'online'!==e.method||e.url?null:(0,y.jsx)(i.Muted,{children:"Add the link above and the button opens it."})]}):null]})}},1168,[827,835,984,34,379,236,402,102,794,1027,983,985,867,1028,821,1145,25]); @@ -1267,7 +1267,7 @@ __d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{ __d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.waNumber=o,_e.waMeLink=function(e,t){const n=o(e);return n?t?`https://wa.me/${n}?text=${encodeURIComponent(t)}`:`https://wa.me/${n}`:null},Object.defineProperty(_e,"guestWhatsAppText",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"staffWhatsAppTexts",{enumerable:!0,get:function(){return p}}),_e.openWhatsApp=async function(e){try{return await n.default.openURL(e),!0}catch{return!1}};var e,t=r(_d[0]),n=(e=t)&&e.__esModule?e:{default:e};function o(e,t="44"){if(!e)return null;let n=String(e).trim().replace(/[\s().\-]/g,'');return n.startsWith('+')?n=n.slice(1):n.startsWith('00')?n=n.slice(2):n.startsWith('0')&&(n=t+n.slice(1)),n=n.replace(/^440/,'44'),/^[1-9][0-9]{6,14}$/.test(n)?n:null}const s=e=>{const[t,n,o]=e.split('-').map(Number);return new Date(t,n-1,o).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long',year:'numeric'})},u=e=>{const[t,n,o]=e.split('-').map(Number);return new Date(t,n-1,o).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'})},c=e=>e.slice(0,5),l=e=>e.replace(' (example)','').trim().split(/\s+/)[0]||'there',m=(e,t)=>`Hi ${t}, it's ${e.name.trim()} about my booking${e.ref?` ${e.ref}`:''}: ${s(e.date)} at ${c(e.time)}, table for ${e.partySize}. `,p=(e,t,n)=>({confirm:`Hi ${l(e.name)}, it's ${t}${n?` in ${n}`:''}. Just confirming your table for ${e.partySize} on ${u(e.date)} at ${c(e.time)}${e.ref?` (ref ${e.ref})`:''}. Any questions, just reply here.`,change:`Hi ${l(e.name)}, it's ${t} about your booking on ${u(e.date)} at ${c(e.time)}. `})},1184,[379]); __d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"payFor",{enumerable:!0,get:function(){return k.payFor}}),Object.defineProperty(_e,"useVenuePay",{enumerable:!0,get:function(){return k.useVenuePay}}),_e.PayTipsSettings=function({go:e}){const{rid:s,today:o}=(0,P.useCtx)(6e4),{pay:r,source:d}=(0,k.useVenuePay)(s),[a,l]=(0,n.useState)(r),[u,c]=(0,n.useState)((0,f.ukDate)(r.tipsAnchorPayday)),[y,x]=(0,n.useState)(null),j=(0,f.parseUk)(u),w=(0,f.cleanPay)({...a,tipsAnchorPayday:j??a.tipsAnchorPayday}),C=JSON.stringify(w)!==JSON.stringify(r)||'settings'!==d,S=(0,f.nextToPay)(w,'tips',o).period,D=(0,f.nextToPay)(w,'wage',o).period,I=(0,f.tipsPeriod)(w,S.start,1),z=(0,f.wagePeriod)(w,D.start,1),H=e=>{l({...a,...e}),x(null)};return(0,v.jsxs)(i.default,{style:{gap:12},testID:"pay-settings",children:['none'===d?(0,v.jsx)(h.Banner,{kind:"warn",title:"Pay dates not set up yet",children:"Set your tips and wage dates here. Until then the app uses calendar months and weekly tips."}):null,'questionnaire'===d?(0,v.jsx)(h.Banner,{kind:"info",title:"From your sign-up answers",children:"These dates came from your questionnaire. Check them and tap Save to make them your venue's pay dates."}):null,(0,v.jsx)(T.SectionHead,{title:"Tips",sub:"How often tips are paid out, and which days each payout covers."}),(0,v.jsxs)(h.Card,{children:[(0,v.jsx)(h.T,{weight:"semibold",children:"How often"}),(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:['weekly','fortnightly','monthly'].map(e=>(0,v.jsx)(h.Chip,{label:M[e],selected:a.tipsFrequency===e,onPress:()=>H({tipsFrequency:e})},e))}),(0,v.jsx)(h.Field,{label:"Next tips payday (DD/MM/YYYY)",value:u,onChangeText:e=>{c((0,t.slashDate)(e,u)),x(null)},maxLength:10,placeholder:"02/11/2026",keyboardType:"numbers-and-punctuation"}),j?(0,v.jsxs)(h.Muted,{children:[(0,f.dayMonth)(j)," ",j.slice(0,4)]}):(0,v.jsx)(h.T,{size:13,colour:b.colours.red,children:"Enter a date like 02/11/2026"}),(0,v.jsx)(h.T,{weight:"semibold",children:"Each tips period ends"}),(0,v.jsxs)(h.Row,{children:[(0,v.jsx)(h.Stepper,{label:"days before payday",value:a.tipsEndsDaysBefore,min:0,max:13,onChange:e=>H({tipsEndsDaysBefore:e})}),(0,v.jsx)(h.Muted,{style:{flex:1},children:0===a.tipsEndsDaysBefore?'on payday':1===a.tipsEndsDaysBefore?'day before payday (a Monday payday covers up to the Sunday)':'days before payday'})]})]}),(0,v.jsx)(T.SectionHead,{title:"Wages",sub:"Monthly pay: the cut-off starts each pay period."}),(0,v.jsxs)(h.Card,{children:[(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(h.T,{weight:"semibold",style:{flex:1},children:"Pay day of the month"}),(0,v.jsx)(h.Stepper,{label:"pay day",value:a.wagePayDay,min:1,max:31,onChange:e=>H({wagePayDay:e})})]}),(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(h.T,{weight:"semibold",style:{flex:1},children:"Cut-off (first day of each period)"}),(0,v.jsx)(h.Stepper,{label:"cut-off day",value:a.wageCutoffDay,min:1,max:28,onChange:e=>H({wageCutoffDay:e})})]}),(0,v.jsxs)(h.Muted,{children:["Period runs the ",B(a.wageCutoffDay)," to the ",B(1===a.wageCutoffDay?31:a.wageCutoffDay-1),1===a.wageCutoffDay?' (end of the month)':' of the next month',". A pay day past the month end uses the last day."]}),(0,v.jsx)(h.T,{weight:"semibold",children:"A pay day on a weekend"}),(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:['none','before','after'].map(e=>(0,v.jsx)(h.Chip,{label:$[e],selected:(a.weekendRule??'none')===e,onPress:()=>H({weekendRule:e})},e))})]}),(0,v.jsx)(T.SectionHead,{title:"Preview"}),(0,v.jsxs)(h.Card,{highlight:b.colours.gold,children:[(0,v.jsx)(R,{label:"Next tips payday",day:S.payday,period:S}),(0,v.jsx)(R,{label:"Then",day:I.payday,period:I}),(0,v.jsx)(i.default,{style:{height:1,backgroundColor:b.colours.border}}),(0,v.jsx)(R,{label:"Next payday",day:D.payday,period:D}),(0,v.jsx)(R,{label:"Then",day:z.payday,period:z})]}),(0,v.jsx)(h.Button,{kind:"success",label:'settings'===d?'Save pay dates':'Save as our pay dates',disabled:!j||!C,testID:"save-pay",onPress:()=>{p.useStore.getState().updateSettings(s,{pay:w}),x('Saved. Everyone in the venue sees these dates.')}}),y?(0,v.jsx)(h.Banner,{kind:"success",title:y}):null,(0,v.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,v.jsx)(h.Button,{small:!0,kind:"secondary",label:"Payroll hours",onPress:()=>e('more','hours')}),(0,v.jsx)(h.Button,{small:!0,kind:"secondary",label:"Tips day",onPress:()=>e('more','tipsday')})]})]})},_e.hoursIn=z,Object.defineProperty(_e,"toTsv",{enumerable:!0,get:function(){return N}}),Object.defineProperty(_e,"toCsv",{enumerable:!0,get:function(){return F}}),_e.summaryTable=V,_e.detailTable=E,_e.copyText=Y,_e.periodOptions=G,_e.PayrollHours=function({go:e}){const{rid:s,today:t,now:r,r:p,me:w,meId:T,role:M}=(0,P.useCtx)(6e4),$=(0,C.canSeeHoursEdit)({role:M,isCar:S.IS_CAR}),[B,R]=(0,n.useState)(!1),{pay:I,source:A}=(0,k.useVenuePay)(s),W=(0,y.useOwner)(e=>e.staff),L=(0,y.useOwner)(e=>(0,y.liveAttendance)(e.attendance)),q=(0,P.useHourly)(),J=(0,a.default)().width<700,[K,Q]=(0,n.useState)(null),[X,Z]=(0,n.useState)(null),ee=e=>{const s=y.useOwner.getState().confirmEntries([e.id],w,T,(new Date).toISOString());we(s?'Approved. It now counts in the hours and pay.':'Nothing to approve.')},se=e=>(0,v.jsxs)(i.default,{style:{gap:8,marginBottom:8},testID:`daily-${e.person.id}`,children:[e.days.map(e=>(0,v.jsx)(u.ShiftCard,{d:e,manager:!0,onApprove:()=>ee(e.a),onEdit:()=>Q(e.a),onRemove:()=>Z(e.a)},e.a.id)),e.days.length?null:(0,v.jsx)(h.Muted,{center:!0,children:"No clocked shifts in this period."})]}),te=(0,n.useMemo)(()=>G(I,t),[I,t]),[oe,ne]=(0,n.useState)('wage'),[re,de]=(0,n.useState)(null),[ae,ie]=(0,n.useState)(!1),[le,ue]=(0,n.useState)({}),[ce,he]=(0,n.useState)(null),pe='custom'===oe&&re?re:(te.find(e=>e.id===oe)??te[0]).period,ye=(0,n.useMemo)(()=>z(pe,W,L,r,q),[pe.key,W,L,q,Math.floor(r.getTime()/6e4)]),ge=ye.some(e=>null!=e.rate),xe='tips'===pe.kind,fe=ye.reduce((e,s)=>({c:e.c+s.confirmed,p:e.p+s.pending,s:e.s+s.shifts,g:e.g+(s.gross??0)}),{c:0,p:0,s:0,g:0}),me=ye.filter(e=>e.pending>0).length,be=`${p.name}: hours ${(0,f.rangeText)(pe.start,pe.end)}`,je=`hours-${pe.start}-to-${pe.end}`,we=e=>{he(e),setTimeout(()=>he(null),6e3)};return(0,v.jsxs)(i.default,{style:{gap:10},testID:"payroll-hours",children:['none'===A?(0,v.jsxs)(h.Banner,{kind:"warn",title:"Pay dates not set up",children:[(0,v.jsx)(h.Muted,{children:"Using calendar months for now."}),(0,v.jsx)(h.Button,{small:!0,kind:"ghost",label:"Set your pay dates \u203a",onPress:()=>e('more','paysettings')})]}):null,(0,v.jsxs)(h.Row,{wrap:!0,gap:6,children:[te.map(e=>(0,v.jsx)(h.Chip,{label:e.label,sub:e.sub,selected:oe===e.id,onPress:()=>{ne(e.id),ie(!1)}},e.id)),(0,v.jsx)(h.Chip,{label:"Custom dates",sub:re&&'custom'===oe?(0,f.rangeText)(re.start,re.end):'Pick any range',selected:'custom'===oe,onPress:()=>ie(!ae)})]}),ae?(0,v.jsx)(U,{onSet:e=>{de(e),ne('custom'),ie(!1)}}):null,(0,v.jsx)(h.Card,{highlight:b.colours.gold,children:(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,v.jsxs)(i.default,{style:{flexShrink:1,minWidth:0},children:[(0,v.jsxs)(h.T,{weight:"bold",size:18,children:[(0,f.rangeText)(pe.start,pe.end)," ",pe.end.slice(0,4)]}),(0,v.jsxs)(h.Muted,{children:[(0,f.ukDate)(pe.start)," to ",(0,f.ukDate)(pe.end),pe.payday?` \xb7 ${pe.payday>=t?'pays':'paid'} ${(0,f.dayMonth)(pe.payday)}`:'',xe?' \xb7 tips period':'wage'===pe.kind?' \xb7 wage period':'']})]}),(0,v.jsxs)(i.default,{style:{alignItems:'flex-end'},children:[(0,v.jsx)(h.T,{size:22,weight:"bold",colour:b.colours.gold,children:(0,l.durText)(fe.c)}),(0,v.jsxs)(h.Muted,{children:["approved",fe.p?` \xb7 ${(0,l.durText)(fe.p)} pending`:'']})]})]})}),$?(0,v.jsx)(i.default,{style:{alignItems:'center'},children:(0,v.jsx)(h.Button,{testID:"add-past-shift",label:"Add past shift",accessibilityLabel:"Add past shift",onPress:()=>R(!0),style:{minHeight:48,minWidth:180}})}):null,me?(0,v.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:"Sign off pending hours",onPress:()=>e('more','signoff'),testID:"pending-banner",children:(0,v.jsxs)(i.default,{style:{backgroundColor:b.colours.amberBg,borderRadius:12,padding:12,borderLeftWidth:6,borderLeftColor:b.colours.amber,gap:4},children:[(0,v.jsxs)(h.T,{weight:"bold",colour:b.colours.amber,children:["\u26a0 ",(0,l.durText)(fe.p)," still waiting for approval (",me," ",1===me?'person':'people',")"]}),(0,v.jsx)(h.T,{size:14,children:"Pending hours are not in the totals or the exports' confirmed columns. Sign them off first so everyone is paid in full."}),(0,v.jsx)(h.T,{weight:"semibold",colour:b.colours.gold,children:"Sign off hours \u203a"})]})}):(0,v.jsx)(h.Banner,{kind:"success",title:"All hours in this period are signed off"}),(0,v.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,v.jsx)(h.Button,{small:!0,kind:"success",label:"Copy for spreadsheet",testID:"copy-tsv",onPress:async()=>{const e=await Y(N(V(ye,pe,ge,xe)));we(e?`Copied ${ye.length} rows. Paste into the first cell of your spreadsheet.`:'Copy is not available here. Use Download CSV.')}}),(0,v.jsx)(h.Button,{small:!0,kind:"secondary",label:"Download CSV",onPress:()=>{(0,j.downloadText)(`${je}.csv`,F(V(ye,pe,ge,xe))),we('CSV downloaded (summary).')}}),(0,v.jsx)(h.Button,{small:!0,kind:"secondary",label:"Download CSV (daily detail)",onPress:()=>{(0,j.downloadText)(`${je}-daily.csv`,F(E(ye))),we('CSV downloaded (one line per shift).')}}),(0,v.jsx)(h.Button,{small:!0,kind:"secondary",label:"Print / PDF",onPress:()=>{const e=V(ye,pe,ge,xe);(0,j.printTable)(be,`${(0,f.ukDate)(pe.start)} to ${(0,f.ukDate)(pe.end)} \xb7 confirmed hours only in the totals \xb7 printed ${(0,f.ukDate)(t)}`,e[0],e.slice(1))}})]}),ce?(0,v.jsx)(h.Banner,{kind:"success",title:ce}):null,J?(0,v.jsxs)(i.default,{testID:"hours-table",style:{gap:10},children:[ye.map(e=>{const s=!!le[e.person.id];return(0,v.jsxs)(i.default,{style:{borderRadius:16,borderWidth:1,borderColor:'rgba(212,175,106,0.45)',backgroundColor:b.colours.surface,padding:12,gap:10},children:[(0,v.jsx)(u.HoursSummaryCard,{name:O(e.person),role:H(e.person),approved:e.confirmed,pending:e.pending,rate:e.rate}),(0,v.jsx)(h.Button,{kind:"secondary",testID:`hours-open-${e.person.id}`,label:s?'Hide shifts':`Show ${e.days.length} ${1===e.days.length?'shift':'shifts'}`,accessibilityLabel:`${s?'Hide':'Show'} ${O(e.person)}'s shifts`,onPress:()=>ue({...le,[e.person.id]:!s}),style:{minHeight:48}}),s?se(e):null]},e.person.id)}),(0,v.jsxs)(h.Muted,{center:!0,children:["Total: ",(0,l.durText)(fe.c)," approved",ge?` \xb7 ${(0,x.gbp)(fe.g)} gross`:'',fe.p?` \xb7 ${(0,l.durText)(fe.p)} pending`:'']})]}):(0,v.jsx)(o.WideTable,{children:(0,v.jsxs)(i.default,{testID:"hours-table",children:[(0,v.jsx)(o.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:b.colours.border,paddingBottom:4},children:['Name','Shifts','Approved','Pending',xe?'Tips h':'Hours',ge?'Rate':'',ge?'Gross':''].map((e,s)=>(0,v.jsx)(h.T,{size:12,weight:"semibold",colour:b.colours.gold,style:{width:_[s]},children:e},s))}),ye.map(e=>{const s=!!le[e.person.id];return(0,v.jsxs)(i.default,{style:{borderBottomWidth:1,borderColor:'#222'},children:[(0,v.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:`${O(e.person)} daily hours`,onPress:()=>ue({...le,[e.person.id]:!s}),style:{paddingVertical:7},children:(0,v.jsxs)(o.TRow,{heads:['Name','Shifts','Approved','Pending',xe?'Tips h':'Hours',ge?'Rate':'',ge?'Gross':''],children:[(0,v.jsxs)(i.default,{style:{width:_[0]},children:[(0,v.jsxs)(h.T,{size:14,weight:"semibold",numberOfLines:1,children:[s?'\u25be':'\u25b8'," ",O(e.person)]}),(0,v.jsx)(h.Muted,{children:H(e.person)})]}),(0,v.jsx)(h.T,{size:14,style:{width:_[1]},children:e.shifts}),(0,v.jsx)(h.T,{size:14,weight:"semibold",style:{width:_[2]},children:(0,l.durText)(e.confirmed)}),(0,v.jsx)(h.T,{size:14,weight:e.pending?'bold':'regular',colour:e.pending?b.colours.amber:b.colours.muted,style:{width:_[3]},children:e.pending?`\u26a0 ${(0,l.durText)(e.pending)}`:'0m'}),(0,v.jsx)(h.T,{size:14,style:{width:_[4]},children:xe?(0,f.decH)(e.confirmed):(0,l.durText)(e.confirmed)}),(0,v.jsx)(h.T,{size:14,colour:b.colours.muted,style:{width:_[5]},children:ge?null!=e.rate?(0,x.gbp)(e.rate):'\u2013':''}),(0,v.jsxs)(h.T,{size:14,weight:"semibold",style:{width:_[6]},children:[ge?null!=e.gross?(0,x.gbp)(e.gross):'\u2013':'',ge&&null!=e.rate&&e.pending?(0,v.jsx)(h.T,{size:12,colour:b.colours.amber,children:`\n+ ${(0,x.gbp)(Math.round(e.pending/60*e.rate))} pending`}):null]})]})}),s?se(e):null]},e.person.id)}),(0,v.jsxs)(o.TRow,{heads:['','Shifts','Approved','Pending',xe?'Tips h':'Hours','',ge?'Gross':''],style:{paddingVertical:8,borderTopWidth:2,borderColor:b.colours.gold},children:[(0,v.jsxs)(h.T,{size:14,weight:"bold",style:{width:_[0]},children:["Total (",ye.length,")"]}),(0,v.jsx)(h.T,{size:14,weight:"bold",style:{width:_[1]},children:fe.s}),(0,v.jsx)(h.T,{size:14,weight:"bold",colour:b.colours.gold,style:{width:_[2]},children:(0,l.durText)(fe.c)}),(0,v.jsx)(h.T,{size:14,weight:"bold",colour:fe.p?b.colours.amber:b.colours.muted,style:{width:_[3]},children:(0,l.durText)(fe.p)}),(0,v.jsx)(h.T,{size:14,weight:"bold",style:{width:_[4]},children:xe?(0,f.decH)(fe.c):(0,l.durText)(fe.c)}),(0,v.jsx)(h.T,{size:14,style:{width:_[5]},children:" "}),(0,v.jsx)(h.T,{size:14,weight:"bold",style:{width:_[6]},children:ge?(0,x.gbp)(fe.g):''})]})]})}),K?(0,v.jsx)(c.OverrideSheet,{a:K,staffId:K.staffId,date:K.date,onClose:()=>Q(null)}):null,X?(0,v.jsx)(u.RemoveShiftSheet,{a:X,who:{name:w,id:T},onClose:()=>{Z(null),we('Removed from hours. It is kept in the history.')}}):null,B?(0,v.jsx)(D.AddPastShiftSheet,{onClose:()=>R(!1),onSaved:()=>{R(!1),we('Saved. It counts in the hours and pay.')}}):null,(0,v.jsxs)(h.Muted,{children:["Tap a name for each day. Hours read 37h 30m. The export also has decimal hours (37.50) and h:mm for your spreadsheet. Paid hours = clock out \u2212 clock in \u2212 break. ",ge?'Gross is before tax, from confirmed hours only.':'Rates and gross show once you sign in with your personal link.']}),xe?(0,v.jsx)(h.Button,{kind:"success",label:"Tips day: split tips for this period \u203a",onPress:()=>e('more','tipsday')}):null]})},_e.TipsDay=function({go:e}){const{rid:t,today:r,now:a}=(0,P.useCtx)(6e4),{pay:u,source:c}=(0,k.useVenuePay)(t),p=(0,y.useOwner)(e=>e.staff),T=(0,y.useOwner)(e=>(0,y.liveAttendance)(e.attendance)),C=(0,y.useOwner)(e=>e.tronc),S=(0,f.nextToPay)(u,'tips',r),[D,M]=(0,n.useState)(0),$=(0,f.tipsPeriod)(u,S.period.start,D),[B,R]=(0,n.useState)(''),[I,W]=(0,n.useState)({}),[L,V]=(0,n.useState)(null),E=(0,n.useMemo)(()=>z($,p,T,a,{}),[$.key,p,T]),G=e=>'owner'===e.role&&!C.includeOwner||'manager'===e.role&&!C.includeManagers,U=e=>I[e.id]??G(e),_=E.filter(e=>e.confirmed>0||e.pending>0),q=Math.round(100*Number(B.replace(/[\xa3,\s]/g,''))),J=Number.isFinite(q)&&q>0&&q<=1e8&&/^\s*\xa3?\s*[\d,]+(\.\d{0,2})?\s*$/.test(B),K=_.filter(e=>!U(e.person)&&e.confirmed>0),{amounts:Q}=(0,w.allocate)(J?q:0,K.map(e=>e.confirmed)),X={};K.forEach((e,s)=>{X[e.person.id]=Q[s]});const Z=K.reduce((e,s)=>e+s.confirmed,0),ee=Object.values(X).reduce((e,s)=>e+s,0),se=_.filter(e=>e.pending>0&&!U(e.person)),te=se.reduce((e,s)=>e+s.pending,0),oe=()=>[['Name','Role','Period start','Period end','Payday','Confirmed hours','Confirmed h:mm','Share %','Tips \xa3'],..._.map(e=>{const s=!U(e.person)&&e.confirmed>0;return[O(e.person),H(e.person),(0,f.ukDate)($.start),(0,f.ukDate)($.end),$.payday?(0,f.ukDate)($.payday):'',(0,f.decH)(e.confirmed),(0,f.hMm)(e.confirmed),s&&Z?(e.confirmed/Z*100).toFixed(2):'0.00',s?A(X[e.person.id]??0):U(e.person)?'excluded':'0.00']}),['TOTAL','',(0,f.ukDate)($.start),(0,f.ukDate)($.end),$.payday?(0,f.ukDate)($.payday):'',(0,f.decH)(Z),(0,f.hMm)(Z),Z?'100.00':'0.00',A(ee)]],ne=e=>{V(e),setTimeout(()=>V(null),6e3)};return(0,v.jsxs)(i.default,{style:{gap:10},testID:"tips-day",children:[(0,v.jsx)(h.Banner,{kind:"info",title:"Saving payouts and notifying staff are coming next",children:"For now this works out the split and exports it. Nothing is saved to the team, sent or paid."}),'none'===c?(0,v.jsxs)(h.Banner,{kind:"warn",title:"Tips dates not set up",children:[(0,v.jsx)(h.Muted,{children:"Using weekly tips for now."}),(0,v.jsx)(h.Button,{small:!0,kind:"ghost",label:"Set your pay dates \u203a",onPress:()=>e('more','paysettings')})]}):null,(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(h.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",disabled:D<=-6,onPress:()=>M(D-1)}),(0,v.jsxs)(i.default,{style:{alignItems:'center',flex:1},children:[(0,v.jsx)(h.T,{weight:"bold",size:18,children:(0,f.rangeText)($.start,$.end)}),(0,v.jsxs)(h.Muted,{children:[(0,f.ukDate)($.start)," to ",(0,f.ukDate)($.end)," \xb7 ",$.payday>=r?'paid':'was paid'," ",(0,f.dayMonth)($.payday)]}),0===D?(0,v.jsx)(h.Badge,{kind:"gold",label:"Paid next"}):null]}),(0,v.jsx)(h.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:D>=1,onPress:()=>M(D+1)})]}),(0,v.jsxs)(h.Card,{highlight:b.colours.gold,children:[(0,v.jsx)(h.T,{weight:"semibold",children:"Total tips to share"}),(0,v.jsxs)(h.Row,{style:{alignItems:'center'},children:[(0,v.jsx)(h.T,{size:28,weight:"bold",colour:b.colours.gold,children:"\xa3"}),(0,v.jsx)(s.TextInput,{testID:"tips-total",accessibilityLabel:"Total tips in pounds",value:B,onChangeText:R,placeholder:"0.00",placeholderTextColor:"#7D776C",keyboardType:"decimal-pad",style:[h.styles.input,{flex:1,fontSize:26,fontWeight:'700'}]})]}),B&&!J?(0,v.jsx)(h.T,{size:13,colour:b.colours.red,children:"Enter an amount like 1250.00"}):(0,v.jsx)(h.Muted,{children:"Shared by confirmed hours: share = total \xd7 (their hours \xf7 everyone's hours). Rounded to the penny; leftover pennies go to the largest shares so it adds up exactly."})]}),se.length?(0,v.jsx)(d.default,{accessibilityRole:"button",onPress:()=>e('more','signoff'),testID:"tips-pending",children:(0,v.jsxs)(i.default,{style:{backgroundColor:b.colours.redBg,borderRadius:12,padding:12,borderLeftWidth:6,borderLeftColor:b.colours.red,gap:4},children:[(0,v.jsxs)(h.T,{weight:"bold",colour:b.colours.red,children:["\u26a0 Don't pay out yet: ",(0,l.durText)(te)," not approved yet"]}),(0,v.jsxs)(h.T,{size:14,children:[se.map(e=>`${O(e.person)} (${(0,l.durText)(e.pending)})`).join(', '),". Pending hours are left out of the split, so these people would get less than they should."]}),(0,v.jsx)(h.T,{weight:"semibold",colour:b.colours.gold,children:"Sign off hours \u203a"})]})}):_.length?(0,v.jsx)(h.Banner,{kind:"success",title:"All hours in this fortnight are signed off"}):null,(0,v.jsx)(o.WideTable,{children:(0,v.jsxs)(i.default,{testID:"tips-table",children:[(0,v.jsx)(o.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:b.colours.border,paddingBottom:4},children:['Include','Name','Confirmed','Share','Tips'].map((e,s)=>(0,v.jsx)(h.T,{size:12,weight:"semibold",colour:b.colours.gold,style:{width:[64,150,100,64,84][s]},children:e},e))}),_.map(e=>{const s=U(e.person),t=X[e.person.id]??0;return(0,v.jsxs)(o.TRow,{heads:['Include','Name','Confirmed','Share','Tips'],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222',opacity:s?.5:1},children:[(0,v.jsx)(d.default,{accessibilityRole:"checkbox",accessibilityState:{checked:!s},accessibilityLabel:`Include ${O(e.person)}`,onPress:()=>W({...I,[e.person.id]:!s}),style:{width:64,minHeight:44,justifyContent:'center'},children:(0,v.jsx)(i.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:s?b.colours.muted:b.colours.ok,backgroundColor:s?'transparent':b.colours.okBg,alignItems:'center',justifyContent:'center'},children:(0,v.jsx)(h.T,{size:14,colour:b.colours.ok,children:s?'':'\u2713'})})}),(0,v.jsxs)(i.default,{style:{width:150},children:[(0,v.jsx)(h.T,{size:14,weight:"semibold",numberOfLines:1,children:O(e.person)}),(0,v.jsxs)(h.Muted,{numberOfLines:1,children:[s?'Excluded':H(e.person),e.pending?` \xb7 \u26a0 ${(0,f.decH)(e.pending)} h pending`:'']})]}),(0,v.jsxs)(h.T,{size:14,style:{width:80},children:[(0,f.decH)(e.confirmed)," h"]}),(0,v.jsx)(h.T,{size:14,colour:b.colours.muted,style:{width:64},children:!s&&Z?`${(e.confirmed/Z*100).toFixed(1)}%`:'\u2013'}),(0,v.jsx)(h.T,{size:15,weight:"bold",colour:s?b.colours.muted:b.colours.gold,style:{width:84},children:s?'\u2013':(0,x.gbp)(t)})]},e.person.id)}),(0,v.jsxs)(o.TRow,{heads:['','','Confirmed','Share','Tips'],style:{paddingVertical:8,borderTopWidth:2,borderColor:b.colours.gold},children:[(0,v.jsx)(h.T,{size:14,style:{width:64},children:" "}),(0,v.jsxs)(h.T,{size:14,weight:"bold",style:{width:150},children:["Total (",K.length," people)"]}),(0,v.jsxs)(h.T,{size:14,weight:"bold",style:{width:80},children:[(0,f.decH)(Z)," h"]}),(0,v.jsx)(h.T,{size:14,style:{width:64},children:Z?'100%':'\u2013'}),(0,v.jsx)(h.T,{size:15,weight:"bold",colour:J&&ee===q?b.colours.ok:b.colours.text,style:{width:84},children:(0,x.gbp)(ee)})]})]})}),_.length?null:(0,v.jsx)(h.Muted,{children:"No clocked hours in this fortnight yet."}),J&&Z?(0,v.jsxs)(h.Muted,{children:["Check: ",K.length," shares add up to ",(0,x.gbp)(ee)," of ",(0,x.gbp)(q)," ",ee===q?'\u2713':'',". \xa3",(q/100/(Z/60)).toFixed(4)," per confirmed hour."]}):null,(0,v.jsxs)(h.Muted,{children:["Owner ",C.includeOwner?'included':'left out'," and managers ",C.includeManagers?'included':'left out'," by default (your tipping policy in Tips). Tick or untick anyone for this split."]}),(0,v.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,v.jsx)(h.Button,{small:!0,kind:"success",label:"Copy for spreadsheet",testID:"tips-copy",disabled:!J,onPress:async()=>{const e=await Y(N(oe()));ne(e?'Copied. Paste into the first cell of your spreadsheet.':'Copy is not available here. Use Download CSV.')}}),(0,v.jsx)(h.Button,{small:!0,kind:"secondary",label:"Download CSV",disabled:!J,onPress:()=>{(0,j.downloadText)(`tips-${$.start}-to-${$.end}.csv`,F(oe())),ne('CSV downloaded.')}}),(0,v.jsx)(h.Button,{small:!0,kind:"secondary",label:"Print / PDF",disabled:!J,onPress:()=>{const e=oe();(0,j.printTable)(`Tips ${(0,f.rangeText)($.start,$.end)} (paid ${(0,f.dayMonth)($.payday)})`,`Total ${(0,x.gbp)(q)} shared by confirmed hours${se.length?` \xb7 WARNING ${(0,f.decH)(te)} h not signed off`:''}`,e[0],e.slice(1))}})]}),L?(0,v.jsx)(h.Banner,{kind:"success",title:L}):null]})},_e.PaydaysCard=function({go:e}){const{rid:s,today:t}=(0,P.useCtx)(6e4),{pay:o,source:n}=(0,k.useVenuePay)(s),d=(0,f.nextToPay)(o,'tips',t).period,a=(0,f.nextToPay)(o,'wage',t).period;return(0,v.jsxs)(i.default,{testID:"paydays-card",style:{backgroundColor:b.colours.surface,borderRadius:16,borderWidth:1,borderColor:b.colours.hairline,padding:16,gap:8},children:[(0,v.jsx)(r.CardHeading,{right:'none'===n?(0,v.jsx)(h.Badge,{kind:"amber",label:"Not set up"}):null,children:"Paydays"}),(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,v.jsxs)(h.T,{children:["Next tips payday: ",(0,v.jsx)(h.T,{weight:"semibold",colour:b.colours.goldLight,children:d.payday===t?'today':(0,f.dayMonth)(d.payday)})]}),(0,v.jsx)(h.Muted,{children:(0,f.rangeText)(d.start,d.end)})]}),(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,v.jsxs)(h.T,{children:["Next payday: ",(0,v.jsx)(h.T,{weight:"semibold",colour:b.colours.goldLight,children:a.payday===t?'today':(0,f.dayMonth)(a.payday)})]}),(0,v.jsxs)(h.Muted,{children:["period ",(0,f.rangeText)(a.start,a.end)]})]}),(0,v.jsxs)(r.ActionGrid,{testID:"paydays-actions",children:[(0,v.jsx)(r.ActionTile,{primary:!0,icon:"payroll",label:"Payroll hours",sub:"Copy or export",onPress:()=>e('more','hours'),testID:"paydays-hours"}),(0,v.jsx)(r.ActionTile,{icon:"tips",label:"Tips day",sub:"Share out tips",onPress:()=>e('more','tipsday'),testID:"paydays-tips"})]}),'settings'!==n?(0,v.jsx)(h.Button,{small:!0,kind:"ghost",label:"Pay & tips settings",onPress:()=>e('more','paysettings'),style:{alignSelf:'flex-start'}}):null]})},_e.MyPeriods=function({staffId:e}){const{rid:s,today:t,now:o,meId:n}=(0,P.useCtx)(6e4),r=e??n,{pay:d}=(0,k.useVenuePay)(s),a=(0,y.useOwner)(e=>(0,y.liveAttendance)(e.attendance)),u=(0,y.useOwner)(e=>e.staff.find(e=>e.id===r)),c=(0,f.wagePeriod)(d,t,0),p=(0,f.tipsPeriod)(d,t,0),x=e=>u?z(e,[u],a,o,{})[0]??null:null,j=(e,s,o)=>(0,v.jsxs)(i.default,{style:{flexGrow:1,flexBasis:160,backgroundColor:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.border,padding:12,gap:2},children:[(0,v.jsx)(h.T,{size:13,weight:"semibold",colour:b.colours.gold,children:e.toUpperCase()}),(0,v.jsxs)(h.Muted,{children:[(0,f.rangeText)(s.start,s.end)," \xb7 ",s.payday>=t?'paid':'was paid'," ",(0,f.dayMonth)(s.payday)]}),(0,v.jsx)(h.T,{size:24,weight:"bold",children:(0,l.durText)(o?.confirmed??0)}),(0,v.jsxs)(h.Muted,{children:["approved \xb7 ",o?.shifts??0," shifts"]}),o?.pending?(0,v.jsxs)(h.T,{size:13,colour:b.colours.amber,children:["+ ",(0,l.durText)(o.pending)," waiting for approval"]}):null]},e);return(0,v.jsx)(h.Row,{wrap:!0,gap:8,style:{alignItems:'stretch'},children:[j('This pay period',c,x(c)),j('This tips fortnight',p,x(p))]})};var s=_r(_d[0]),t=_r(_d[1]),o=_r(_d[2]),n=_r(_d[3]),r=_r(_d[4]);_r(_d[5]);var d=e(_r(_d[6])),a=e(_r(_d[7])),i=e(_r(_d[8])),l=_r(_d[9]),u=_r(_d[10]),c=_r(_d[11]),h=_r(_d[12]),p=_r(_d[13]),y=_r(_d[14]),x=_r(_d[15]),f=_r(_d[16]),b=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),T=_r(_d[20]),P=_r(_d[21]),k=_r(_d[22]),C=_r(_d[23]),S=_r(_d[24]),D=_r(_d[25]),v=_r(_d[26]);const M={weekly:'Weekly',fortnightly:'Fortnightly',monthly:'Monthly'},$={none:'Keep the date',before:'Friday before',after:'Monday after'};const B=e=>`${e}${e%10==1&&11!==e?'st':e%10==2&&12!==e?'nd':e%10==3&&13!==e?'rd':'th'}`;function R({label:e,day:s,period:t}){return(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,v.jsxs)(h.T,{children:[e,": ",(0,v.jsx)(h.T,{weight:"bold",colour:b.colours.gold,children:(0,f.dayMonth)(s)})]}),(0,v.jsx)(h.Muted,{children:(0,f.rangeText)(t.start,t.end)})]})}const I=e=>{if(!e)return'';const s=new Date(e);return`${String(s.getHours()).padStart(2,'0')}:${String(s.getMinutes()).padStart(2,'0')}`};function z(e,s,t,o,n){const r=t.filter(s=>s.in&&s.date>=e.start&&s.date<=e.end);return s.map(e=>{const s=r.filter(s=>s.staffId===e.id).sort((e,s)=>e.date.localeCompare(s.date)||(e.in??'').localeCompare(s.in??'')).map(e=>{const s=(0,P.paidMins)(e,o),t=(0,y.attStatus)(e);return{a:e,date:e.date,inT:I(e.in),outT:I(e.out),brk:s.brk,paid:s.paid,status:'open'===t?'On now':'awaiting'===t?'Pending':'Confirmed'}}),t=e=>s.filter(s=>s.status===e).reduce((e,s)=>e+s.paid,0),d=t('Confirmed'),a=n[e.id];return{person:e,confirmed:d,pending:t('Pending'),open:t('On now'),shifts:s.filter(e=>'On now'!==e.status).length,days:s,rate:a,gross:null!=a?Math.round(d/60*a):void 0}}).filter(e=>e.days.length>0||e.person.active&&'owner'!==e.person.role)}const H=e=>`${y.ROLE_LABEL[e.role]}${e.job?` \xb7 ${e.job}`:''}`,O=e=>e.name.replace(' (example)',''),A=e=>null==e?'':(e/100).toFixed(2),W=e=>e.replace(/[\t\r\n]+/g,' '),L=e=>/[",\n]/.test(e)?`"${e.replace(/"/g,'""')}"`:e,N=e=>e.map(e=>e.map(W).join('\t')).join('\n'),F=e=>e.map(e=>e.map(L).join(',')).join('\r\n');function V(e,s,t,o){const n=['Name','Role','Period start','Period end','Confirmed hours','Confirmed h:mm','Pending hours','Pending h:mm','Shifts',...o?['Tips hours']:[],...t?['Rate \xa3/h','Gross \xa3']:[]],r=e.map(e=>[O(e.person),H(e.person),(0,f.ukDate)(s.start),(0,f.ukDate)(s.end),(0,f.decH)(e.confirmed),(0,f.hMm)(e.confirmed),(0,f.decH)(e.pending),(0,f.hMm)(e.pending),String(e.shifts),...o?[(0,f.decH)(e.confirmed)]:[],...t?[A(e.rate),A(e.gross)]:[]]),d=e.reduce((e,s)=>({c:e.c+s.confirmed,p:e.p+s.pending,s:e.s+s.shifts,g:e.g+(s.gross??0)}),{c:0,p:0,s:0,g:0});return[n,...r,['TOTAL','',(0,f.ukDate)(s.start),(0,f.ukDate)(s.end),(0,f.decH)(d.c),(0,f.hMm)(d.c),(0,f.decH)(d.p),(0,f.hMm)(d.p),String(d.s),...o?[(0,f.decH)(d.c)]:[],...t?['',A(d.g)]:[]]]}function E(e){return[['Name','Role','Date','In','Out','Break mins','Paid hours','Paid h:mm','Status'],...e.flatMap(e=>e.days.map(s=>[O(e.person),H(e.person),(0,f.ukDate)(s.date),s.inT,s.outT,'On now'===s.status?'':String(s.brk),'On now'===s.status?'':(0,f.decH)(s.paid),'On now'===s.status?'':(0,f.hMm)(s.paid),s.status]))]}async function Y(e){if('undefined'==typeof document)return!1;try{if(navigator.clipboard?.writeText)return await navigator.clipboard.writeText(e),!0}catch{}try{const s=document.createElement('textarea');s.value=e,s.style.position='fixed',s.style.opacity='0',document.body.appendChild(s),s.select();const t=document.execCommand('copy');return s.remove(),t}catch{return!1}}function G(e,s){const t=(0,f.nextToPay)(e,'wage',s),o=(0,f.nextToPay)(e,'tips',s),n=(0,f.wagePeriod)(e,t.period.start,-1),r=(0,f.tipsPeriod)(e,o.period.start,-1),d=e=>e.payday>=s?e.payday===s?'Pays today':`Pays ${(0,f.dayMonth)(e.payday)}`:`Paid ${(0,f.dayMonth)(e.payday)}`;return[{id:'wage',label:`Wages ${(0,f.rangeText)(t.period.start,t.period.end)}`,sub:d(t.period),period:t.period},{id:'wagePrev',label:`Wages ${(0,f.rangeText)(n.start,n.end)}`,sub:d(n),period:n},{id:'tips',label:`Tips ${(0,f.rangeText)(o.period.start,o.period.end)}`,sub:d(o.period),period:o.period},{id:'tipsPrev',label:`Tips ${(0,f.rangeText)(r.start,r.end)}`,sub:d(r),period:r}]}function U({onSet:e}){const[s,o]=(0,n.useState)(''),[r,d]=(0,n.useState)(''),a=(0,f.parseUk)(s),l=(0,f.parseUk)(r),u=!!a&&!!l&&l>=a&&(0,f.plusDays)(a,92)>=l;return(0,v.jsxs)(h.Row,{wrap:!0,gap:6,style:{alignItems:'flex-end'},children:[(0,v.jsx)(i.default,{style:{flexBasis:130,flexGrow:1},children:(0,v.jsx)(h.Field,{label:"From (DD/MM/YYYY)",value:s,onChangeText:e=>o((0,t.slashDate)(e,s)),placeholder:"23/10/2026",keyboardType:"numbers-and-punctuation",maxLength:10})}),(0,v.jsx)(i.default,{style:{flexBasis:130,flexGrow:1},children:(0,v.jsx)(h.Field,{label:"To (DD/MM/YYYY)",value:r,onChangeText:e=>d((0,t.slashDate)(e,r)),placeholder:"22/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10})}),(0,v.jsx)(h.Button,{small:!0,kind:"success",label:"Show",disabled:!u,onPress:()=>u&&e((0,f.customPeriod)(a,l))}),s&&r&&!u?(0,v.jsx)(h.T,{size:13,colour:b.colours.red,children:"Use two dates, the second on or after the first, up to 3 months apart."}):null]})}const _=[150,54,100,90,48,62,70]},1185,[827,1059,1180,34,1186,236,402,426,102,1188,1189,1190,794,831,891,867,1060,821,930,1193,1181,1084,1061,1191,872,1192,25]); __d(function(g,_r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ActionTile=function({label:e,sub:r,icon:c,onPress:u,primary:h,tone:b="gold",count:f,testID:x,accessibilityLabel:y}){const j='blue'===b?i.colours.blue:i.colours.gold;return(0,s.jsxs)(t.default,{testID:x,accessibilityRole:"button",accessibilityLabel:y??(r?`${e}, ${r}`:e),onPress:u,style:({pressed:e})=>({flex:1,minWidth:0,minHeight:68,borderRadius:16,borderWidth:1,borderColor:h?i.colours.accentBorder:i.colours.hairline,backgroundColor:e?i.colours.tilePressed:i.colours.tile,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:12,paddingHorizontal:14,paddingVertical:12}),children:[(0,s.jsx)(o.default,{style:{width:40,height:40,borderRadius:12,alignItems:'center',justifyContent:'center',backgroundColor:h?i.colours.accentBg:'rgba(255,255,255,0.04)',borderWidth:1,borderColor:h?i.colours.accentBorder:i.colours.hairline},children:(0,s.jsx)(l.Icon,{name:c,size:21,colour:j})}),(0,s.jsxs)(o.default,{style:{flexShrink:1,minWidth:0},children:[(0,s.jsx)(n.T,{size:15,weight:"semibold",numberOfLines:1,colour:i.colours.text,children:e}),r?(0,s.jsx)(n.T,{size:12,numberOfLines:1,colour:i.colours.muted,children:r}):null]}),f?(0,s.jsx)(o.default,{style:{backgroundColor:i.colours.amber,borderRadius:10,minWidth:22,paddingHorizontal:6},children:(0,s.jsx)(n.T,{size:12,weight:"bold",colour:i.colours.onGold,center:!0,children:f})}):null]})},_e.ActionGrid=function({children:e,testID:t="action-grid"}){const l=r.default.Children.toArray(e).filter(Boolean),i=[];for(let e=0;e(0,s.jsxs)(o.default,{style:{flexDirection:'row',gap:12},children:[e,1===e.length?(0,s.jsx)(o.default,{style:{flex:1}}):null]},r))})},Object.defineProperty(_e,"CardHeading",{enumerable:!0,get:function(){return c}});var r=e(_r(d[0])),t=e(_r(d[1])),o=e(_r(d[2])),l=_r(d[3]),i=_r(d[4]),n=_r(d[5]),s=_r(d[6]);const c=({children:e,right:r})=>(0,s.jsxs)(o.default,{style:{flexDirection:'row',alignItems:'center',justifyContent:'space-between'},children:[(0,s.jsx)(n.T,{size:12,weight:"semibold",colour:i.colours.goldMuted,style:{letterSpacing:1.6,textTransform:'uppercase'},children:e}),r]})},1186,[34,402,102,1187,821,794,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Icon=function({name:l,size:x=22,colour:t}){const n={stroke:t,strokeWidth:2,fill:'none',strokeLinecap:'round',strokeLinejoin:'round'};return(0,e.jsxs)(h.default,{width:x,height:x,viewBox:"0 0 24 24",children:['home'===l?(0,e.jsx)(s.Path,{d:"M3 11l9-7 9 7v9a1 1 0 0 1-1 1h-5v-6H9v6H4a1 1 0 0 1-1-1z",...n}):null,'signoff'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"11",r:"8",...n}),(0,e.jsx)(s.Path,{d:"M11 6.5V11l3 2",...n}),(0,e.jsx)(s.Path,{d:"M15.5 19.5l2 2 4-4.2",...n})]}):null,'orders'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"5",y:"3",width:"14",height:"18",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M9 8h6M9 12h6M9 16h4",...n})]}):null,'bookings'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4",...n})]}):null,'forecast'===l?(0,e.jsx)(s.Path,{d:"M4 20V10M10 20V4M16 20v-7M22 20H2",...n}):null,'more'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"5",cy:"12",r:"1.6",fill:t}),(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"1.6",fill:t}),(0,e.jsx)(s.Circle,{cx:"19",cy:"12",r:"1.6",fill:t})]}):null,'search'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"11",r:"7",...n}),(0,e.jsx)(s.Path,{d:"M20 20l-4-4",...n})]}):null,'bell'===l?(0,e.jsx)(s.Path,{d:"M6 16V11a6 6 0 0 1 12 0v5l2 2H4zM10 20a2 2 0 0 0 4 0",...n}):null,'chat'===l?(0,e.jsx)(s.Path,{d:"M4 5h16v11H9l-5 4z",...n}):null,'clock'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M12 7v5l3 2",...n})]}):null,'user'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"8",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M4 21a8 8 0 0 1 16 0",...n})]}):null,'walkin'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"13",cy:"4.5",r:"1.8",...n}),(0,e.jsx)(s.Path,{d:"M10 21l2-6 3 3v3M9 12l2-4 4 1 2 3M11 8l-1 5",...n})]}):null,'calendarPlus'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4M12 13v5M9.5 15.5h5",...n})]}):null,'pause'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M10 9v6M14 9v6",...n})]}):null,'rain'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M7 15a4 4 0 0 1-.6-7.95A5.5 5.5 0 0 1 17 7.5a3.75 3.75 0 0 1 .5 7.5z",...n}),(0,e.jsx)(s.Path,{d:"M9 18l-1 2.5M13 18l-1 2.5M17 18l-1 2.5",...n})]}):null,'sun'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M12 2v2M12 20v2M2 12h2M20 12h2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4",...n})]}):null,'payroll'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"4",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M7 9h6M7 13h4M15 12.5a2 2 0 1 0 0 .01M7 17h10",...n})]}):null,'tips'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M14.5 9a2.5 2.5 0 0 0-5 0c0 2.5 0 4-1.5 6h7M9 12.5h4",...n})]}):null,'sparkle'===l?(0,e.jsx)(s.Path,{d:"M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8zM19 16l.7 1.8 1.8.7-1.8.7L19 21l-.7-1.8-1.8-.7 1.8-.7z",...n}):null,'platter'===l?(0,e.jsx)(e.Fragment,{children:(0,e.jsx)(s.Path,{d:"M3 15h18M5 15a7 7 0 0 1 14 0M12 6v2M2 18h20",...n})}):null,'check'===l?(0,e.jsx)(s.Path,{d:"M5 12.5l4.5 4.5L19 7.5",...n}):null,'alert'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M12 3l9.5 17h-19z",...n}),(0,e.jsx)(s.Path,{d:"M12 10v4M12 17.2v.1",...n})]}):null,'access'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"4.5",r:"1.8",...n}),(0,e.jsx)(s.Path,{d:"M11 7.5v6h5l2.5 5M11 10h5M8 11.5a5.5 5.5 0 1 0 7.5 6.5",...n})]}):null,'dog'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 10l1-5 3 3h4l3-3 1 5v4a5 5 0 0 1-5 5h-2a5 5 0 0 1-5-5z",...n}),(0,e.jsx)(s.Path,{d:"M10 13v.1M14 13v.1M11 16h2",...n})]}):null,'leaf'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 19c0-8 5-14 15-14 0 10-6 15-14 15",...n}),(0,e.jsx)(s.Path,{d:"M5 19l8-8",...n})]}):null,'table'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"4",y:"8",width:"16",height:"8",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M8 16v4M16 16v4M8 4v4M16 4v4",...n})]}):null,'bag'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 8h14l-1 12H6z",...n}),(0,e.jsx)(s.Path,{d:"M9 10V7a3 3 0 0 1 6 0v3",...n})]}):null,'phone'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"7",y:"2.5",width:"10",height:"19",rx:"2.5",...n}),(0,e.jsx)(s.Path,{d:"M11 18.5h2",...n})]}):null,'swap'===l?(0,e.jsx)(s.Path,{d:"M7 4L3 8l4 4M3 8h14M17 20l4-4-4-4M21 16H7",...n}):null,'box'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M3.5 8L12 4l8.5 4v8L12 20l-8.5-4z",...n}),(0,e.jsx)(s.Path,{d:"M3.5 8L12 12l8.5-4M12 12v8",...n})]}):null,'star'===l?(0,e.jsx)(s.Path,{d:"M12 3.5l2.6 5.4 5.9.8-4.3 4.1 1 5.8L12 16.8l-5.2 2.8 1-5.8L3.5 9.7l5.9-.8z",...n}):null,'userPlus'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"10",cy:"8",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M3 21a7 7 0 0 1 14 0M19 8v6M16 11h6",...n})]}):null,'gift'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3.5",y:"8.5",width:"17",height:"4",rx:"1",...n}),(0,e.jsx)(s.Path,{d:"M5 12.5V20h14v-7.5M12 8.5V20M12 8.5C10 8.5 7.5 7.8 7.5 5.8S10.5 4 12 8.5c1.5-4.5 4.5-4.7 4.5-2.7S14 8.5 12 8.5z",...n})]}):null,'tag'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M3.5 12.5V4h8.5l8.5 8.5-8.5 8.5z",...n}),(0,e.jsx)(s.Circle,{cx:"8",cy:"8.5",r:"1.4",...n})]}):null,'hanger'===l?(0,e.jsx)(s.Path,{d:"M12 7.5a2 2 0 1 1 2-2M12 7.5v2L3 16.5h18L12 9.5",...n}):null]})},r(d[0]);var l,s=r(d[1]),h=(l=s)&&l.__esModule?l:{default:l},e=r(d[2])},1187,[34,797,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Icon=function({name:l,size:x=22,colour:t}){const n={stroke:t,strokeWidth:2,fill:'none',strokeLinecap:'round',strokeLinejoin:'round'};return(0,e.jsxs)(h.default,{width:x,height:x,viewBox:"0 0 24 24",children:['home'===l?(0,e.jsx)(s.Path,{d:"M3 11l9-7 9 7v9a1 1 0 0 1-1 1h-5v-6H9v6H4a1 1 0 0 1-1-1z",...n}):null,'signoff'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"11",r:"8",...n}),(0,e.jsx)(s.Path,{d:"M11 6.5V11l3 2",...n}),(0,e.jsx)(s.Path,{d:"M15.5 19.5l2 2 4-4.2",...n})]}):null,'orders'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"5",y:"3",width:"14",height:"18",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M9 8h6M9 12h6M9 16h4",...n})]}):null,'rota'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4M7 14h4M13 14h4M7 18h6",...n})]}):null,'bookings'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4",...n})]}):null,'forecast'===l?(0,e.jsx)(s.Path,{d:"M4 20V10M10 20V4M16 20v-7M22 20H2",...n}):null,'more'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"5",cy:"12",r:"1.6",fill:t}),(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"1.6",fill:t}),(0,e.jsx)(s.Circle,{cx:"19",cy:"12",r:"1.6",fill:t})]}):null,'search'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"11",r:"7",...n}),(0,e.jsx)(s.Path,{d:"M20 20l-4-4",...n})]}):null,'bell'===l?(0,e.jsx)(s.Path,{d:"M6 16V11a6 6 0 0 1 12 0v5l2 2H4zM10 20a2 2 0 0 0 4 0",...n}):null,'chat'===l?(0,e.jsx)(s.Path,{d:"M4 5h16v11H9l-5 4z",...n}):null,'clock'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M12 7v5l3 2",...n})]}):null,'user'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"8",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M4 21a8 8 0 0 1 16 0",...n})]}):null,'walkin'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"13",cy:"4.5",r:"1.8",...n}),(0,e.jsx)(s.Path,{d:"M10 21l2-6 3 3v3M9 12l2-4 4 1 2 3M11 8l-1 5",...n})]}):null,'calendarPlus'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4M12 13v5M9.5 15.5h5",...n})]}):null,'pause'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M10 9v6M14 9v6",...n})]}):null,'rain'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M7 15a4 4 0 0 1-.6-7.95A5.5 5.5 0 0 1 17 7.5a3.75 3.75 0 0 1 .5 7.5z",...n}),(0,e.jsx)(s.Path,{d:"M9 18l-1 2.5M13 18l-1 2.5M17 18l-1 2.5",...n})]}):null,'sun'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M12 2v2M12 20v2M2 12h2M20 12h2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4",...n})]}):null,'payroll'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"4",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M7 9h6M7 13h4M15 12.5a2 2 0 1 0 0 .01M7 17h10",...n})]}):null,'tips'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M14.5 9a2.5 2.5 0 0 0-5 0c0 2.5 0 4-1.5 6h7M9 12.5h4",...n})]}):null,'sparkle'===l?(0,e.jsx)(s.Path,{d:"M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8zM19 16l.7 1.8 1.8.7-1.8.7L19 21l-.7-1.8-1.8-.7 1.8-.7z",...n}):null,'platter'===l?(0,e.jsx)(e.Fragment,{children:(0,e.jsx)(s.Path,{d:"M3 15h18M5 15a7 7 0 0 1 14 0M12 6v2M2 18h20",...n})}):null,'check'===l?(0,e.jsx)(s.Path,{d:"M5 12.5l4.5 4.5L19 7.5",...n}):null,'alert'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M12 3l9.5 17h-19z",...n}),(0,e.jsx)(s.Path,{d:"M12 10v4M12 17.2v.1",...n})]}):null,'access'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"4.5",r:"1.8",...n}),(0,e.jsx)(s.Path,{d:"M11 7.5v6h5l2.5 5M11 10h5M8 11.5a5.5 5.5 0 1 0 7.5 6.5",...n})]}):null,'dog'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 10l1-5 3 3h4l3-3 1 5v4a5 5 0 0 1-5 5h-2a5 5 0 0 1-5-5z",...n}),(0,e.jsx)(s.Path,{d:"M10 13v.1M14 13v.1M11 16h2",...n})]}):null,'leaf'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 19c0-8 5-14 15-14 0 10-6 15-14 15",...n}),(0,e.jsx)(s.Path,{d:"M5 19l8-8",...n})]}):null,'table'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"4",y:"8",width:"16",height:"8",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M8 16v4M16 16v4M8 4v4M16 4v4",...n})]}):null,'bag'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 8h14l-1 12H6z",...n}),(0,e.jsx)(s.Path,{d:"M9 10V7a3 3 0 0 1 6 0v3",...n})]}):null,'phone'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"7",y:"2.5",width:"10",height:"19",rx:"2.5",...n}),(0,e.jsx)(s.Path,{d:"M11 18.5h2",...n})]}):null,'swap'===l?(0,e.jsx)(s.Path,{d:"M7 4L3 8l4 4M3 8h14M17 20l4-4-4-4M21 16H7",...n}):null,'box'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M3.5 8L12 4l8.5 4v8L12 20l-8.5-4z",...n}),(0,e.jsx)(s.Path,{d:"M3.5 8L12 12l8.5-4M12 12v8",...n})]}):null,'star'===l?(0,e.jsx)(s.Path,{d:"M12 3.5l2.6 5.4 5.9.8-4.3 4.1 1 5.8L12 16.8l-5.2 2.8 1-5.8L3.5 9.7l5.9-.8z",...n}):null,'userPlus'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"10",cy:"8",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M3 21a7 7 0 0 1 14 0M19 8v6M16 11h6",...n})]}):null,'gift'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3.5",y:"8.5",width:"17",height:"4",rx:"1",...n}),(0,e.jsx)(s.Path,{d:"M5 12.5V20h14v-7.5M12 8.5V20M12 8.5C10 8.5 7.5 7.8 7.5 5.8S10.5 4 12 8.5c1.5-4.5 4.5-4.7 4.5-2.7S14 8.5 12 8.5z",...n})]}):null,'tag'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M3.5 12.5V4h8.5l8.5 8.5-8.5 8.5z",...n}),(0,e.jsx)(s.Circle,{cx:"8",cy:"8.5",r:"1.4",...n})]}):null,'hanger'===l?(0,e.jsx)(s.Path,{d:"M12 7.5a2 2 0 1 1 2-2M12 7.5v2L3 16.5h18L12 9.5",...n}):null]})},r(d[0]);var l,s=r(d[1]),h=(l=s)&&l.__esModule?l:{default:l},e=r(d[2])},1187,[34,797,25]); __d(function(_g,_r,i,_a,_m,e,d){"use strict";function t(t){const n=Math.max(0,Math.round(t||0)),o=Math.floor(n/60),r=n%60;return o?`${o}h ${String(r).padStart(2,'0')}m`:`${r}m`}function n(t){const n=Math.max(0,Math.round(t||0)),o=Math.floor(n/60),r=n%60;return[o?`${o} ${1===o?'hour':'hours'}`:'',r||!o?`${r} ${1===r?'minute':'minutes'}`:''].filter(Boolean).join(' ')}Object.defineProperty(e,'__esModule',{value:!0}),e.durText=t,e.durWords=n,e.isZeroShift=function(t){return!(!t.in||!t.out)&&Date.parse(t.out)-Date.parse(t.in)<6e4},Object.defineProperty(e,"isVoided",{enumerable:!0,get:function(){return o}}),e.shiftSentence=function(t,o){if('On now'===t.status)return`${o}, clocked in at ${t.inT}, still on shift.`;const r=t.zero?' Check: 0 minutes, clocked in and out at the same moment.':'';return`${o}, ${t.inT} to ${t.outT}, break ${n(t.brk)}, paid ${n(t.paid)}, ${'Approved'===t.status?'approved':'pending approval'}.${r}`},e.hoursSummary=function(n,o,r){const u=t=>null!=r?Math.round(t/60*r):null;return{approved:{mins:n,text:t(n),gross:u(n)},pending:{mins:o,text:t(o),gross:u(o)}}};const o=t=>!!t.voided},1188,[]); __d(function(g,r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ShiftCard=function({d:e,manager:t,onApprove:s,onEdit:d,onRemove:l}){const a='Confirmed'===e.status?'Approved':e.status,y=(0,u.isZeroShift)(e.a),x={date:e.date,dateText:b(e.date),inT:e.inT,outT:e.outT,brk:e.brk,paid:e.paid,status:a,zero:y};return(0,h.jsxs)(n.default,{testID:`shift-${e.a.id}`,style:{borderRadius:14,borderWidth:1,borderColor:y?c.colours.amber:'rgba(212,175,106,0.35)',backgroundColor:'#15130F',padding:12,gap:8,alignItems:'center'},children:[(0,h.jsxs)(n.default,{accessible:!0,accessibilityLabel:(0,u.shiftSentence)(x,p(e.date)),style:{alignItems:'center',gap:4,width:'100%'},children:[(0,h.jsx)(o.T,{size:16,weight:"bold",colour:c.colours.goldLight,center:!0,children:b(e.date)}),(0,h.jsx)(o.T,{size:17,weight:"semibold",center:!0,children:'On now'===e.status?`${e.inT} to now`:`${e.inT} to ${e.outT}`}),'On now'!==e.status?(0,h.jsxs)(o.T,{size:15,colour:c.colours.text,center:!0,children:["Break ",(0,u.durText)(e.brk)," \xb7 Paid ",(0,h.jsx)(o.T,{size:15,weight:"bold",colour:c.colours.gold,children:(0,u.durText)(e.paid)})]}):null,(0,h.jsx)(o.Badge,{kind:'Approved'===a?'ok':'Pending'===a?'amber':'neutral',label:'Pending'===a?'Pending approval':a}),y?(0,h.jsx)(n.default,{testID:`shift-zero-${e.a.id}`,style:{borderRadius:8,borderWidth:1,borderColor:c.colours.amber,paddingHorizontal:10,paddingVertical:4},children:(0,h.jsx)(o.T,{size:14,weight:"bold",colour:c.colours.amber,center:!0,children:"Check: 0 minutes"})}):null,e.a.added&&e.a.signOff?(0,h.jsxs)(o.Muted,{center:!0,testID:`shift-entered-${e.a.id}`,children:["Entered by ",e.a.signOff.by]}):null]}),t?(0,h.jsxs)(o.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:['Pending'===e.status&&!y&&s?(0,h.jsx)(o.Button,{label:"Approve",testID:`shift-approve-${e.a.id}`,accessibilityLabel:`Approve ${p(e.date)}, paid ${(0,u.durWords)(e.paid)}`,onPress:s,style:{minHeight:48,minWidth:120}}):null,(y||'Pending'===e.status)&&d?(0,h.jsx)(o.Button,{kind:"secondary",label:"Edit",testID:`shift-edit-${e.a.id}`,accessibilityLabel:`Edit the shift on ${p(e.date)}`,onPress:d,style:{minHeight:48,minWidth:96}}):null,y&&'Confirmed'!==e.status&&l?(0,h.jsx)(o.Button,{kind:"secondary",label:"Remove",testID:`shift-remove-${e.a.id}`,accessibilityLabel:`Remove the 0-minute shift on ${p(e.date)}. It is kept in the history.`,onPress:l,style:{minHeight:48,minWidth:96}}):null]}):null]})},_e.HoursSummaryCard=function({name:e,role:t,approved:s,pending:d,rate:l}){const p=(0,u.hoursSummary)(s,d,l),b=`${e}. Approved ${(0,u.durWords)(s)}${null!=p.approved.gross?`, ${(0,a.gbp)(p.approved.gross)}`:''}. Pending approval ${(0,u.durWords)(d)}${null!=p.pending.gross?`, ${(0,a.gbp)(p.pending.gross)} once approved`:''}.${null!=l?` Rate ${(0,a.gbp)(l)} an hour.`:''}`;return(0,h.jsxs)(n.default,{accessible:!0,accessibilityLabel:b,testID:"hours-summary-card",style:{alignItems:'center',gap:6,width:'100%'},children:[(0,h.jsx)(o.T,{size:18,weight:"bold",center:!0,children:e}),t?(0,h.jsx)(o.Muted,{center:!0,children:t}):null,(0,h.jsxs)(o.Row,{wrap:!0,gap:10,style:{justifyContent:'center'},children:[(0,h.jsxs)(n.default,{style:{minWidth:150,borderRadius:12,borderWidth:1,borderColor:c.colours.ok,padding:10,alignItems:'center'},children:[(0,h.jsx)(o.T,{size:13,weight:"semibold",colour:c.colours.ok,children:"APPROVED"}),(0,h.jsx)(o.T,{size:20,weight:"bold",testID:"sum-approved",children:p.approved.text}),(0,h.jsx)(o.Muted,{children:null!=p.approved.gross?`${(0,a.gbp)(p.approved.gross)} gross`:'no rate'})]}),(0,h.jsxs)(n.default,{style:{minWidth:150,borderRadius:12,borderWidth:1,borderColor:c.colours.amber,padding:10,alignItems:'center'},children:[(0,h.jsx)(o.T,{size:13,weight:"semibold",colour:c.colours.amber,children:"PENDING"}),(0,h.jsx)(o.T,{size:20,weight:"bold",testID:"sum-pending",children:p.pending.text}),(0,h.jsx)(o.Muted,{children:null!=p.pending.gross?`${(0,a.gbp)(p.pending.gross)} once approved`:'no rate'})]})]}),null!=l?(0,h.jsxs)(o.Muted,{center:!0,children:["Rate ",(0,a.gbp)(l)," an hour",(y=null,null==y?'':` \xb7 ${(0,a.gbp)(y)}`)]}):null]});var y},_e.RemoveShiftSheet=function({a:e,who:s,onClose:n}){const[a,u]=(0,t.useState)('Clocked in and out by mistake (0 minutes)'),p=a.trim().length>=3;return(0,h.jsxs)(o.Sheet,{visible:!0,onClose:n,title:`Remove the shift on ${b(e.date)}?`,maxWidth:520,testID:"remove-shift",children:[(0,h.jsx)(o.T,{size:16,center:!0,children:"It comes out of hours, pay and exports. It isn\u2019t deleted: it stays in the history with your name and the reason."}),(0,h.jsx)(d.TextInput,{accessibilityLabel:"Reason for removing the shift",value:a,onChangeText:u,style:{minHeight:48,borderRadius:10,borderWidth:1,borderColor:c.colours.gold,color:c.colours.text,paddingHorizontal:12}}),(0,h.jsxs)(o.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,h.jsx)(o.Button,{label:"Remove shift",testID:"remove-shift-yes",disabled:!p,onPress:()=>{l.useOwner.getState().voidEntry(e.id,s.name,s.id,a.trim(),(new Date).toISOString()),n()},style:{minHeight:56}}),(0,h.jsx)(o.Button,{kind:"secondary",label:"Keep it",onPress:n,style:{minHeight:56}})]})]})};var e,t=r(_d[0]),s=r(_d[1]),n=(e=s)&&e.__esModule?e:{default:e},o=r(_d[2]),d=r(_d[3]),l=r(_d[4]),a=r(_d[5]),u=r(_d[6]),c=r(_d[7]),h=r(_d[8]);const p=e=>new Date(`${e}T12:00:00Z`).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long',timeZone:'UTC'}),b=e=>new Date(`${e}T12:00:00Z`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',timeZone:'UTC'})},1189,[34,102,794,827,891,867,1188,821,25]); __d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"REASONS",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"isoAt",{enumerable:!0,get:function(){return S}}),_e.flagsFor=D,_e.notesFor=$,Object.defineProperty(_e,"statusLabel",{enumerable:!0,get:function(){return M}}),Object.defineProperty(_e,"statusKind",{enumerable:!0,get:function(){return O}}),_e.AuditTrail=B,_e.TimeEdit=R,_e.OverrideSheet=A,_e.outstandingDays=P,_e.useOutstanding=function(){const e=(0,r.useOwner)(e=>(0,r.liveAttendance)(e.attendance)),t=(0,r.useOwner)(e=>e.timeRequests),n=(0,u.ymd)(new Date);return(0,s.useMemo)(()=>({days:P(e,n),requests:t.filter(e=>'open'===e.status).length}),[e,t,n])},_e.SignOff=function(){const{now:e,today:t,me:n,meId:m}=(0,h.useCtx)(3e4),p=(0,r.useOwner)(e=>e.staff),x=(0,r.useOwner)(e=>(0,r.liveAttendance)(e.attendance)),j=(0,r.useOwner)(e=>e.shifts),k=(0,r.useOwner)(e=>e.timeRequests),w=(0,r.useOwner)(e=>e.leave),S=(0,s.useMemo)(()=>P(x,t),[x,t]),[I,T]=(0,s.useState)(t),[B,R]=(0,s.useState)(null),[q,z]=(0,s.useState)(null),H=(0,s.useMemo)(()=>{const n=x.filter(e=>e.date===I&&e.in),s=n.map(n=>{const s=(0,r.shiftOf)(j,n.staffId,I);return{key:n.id,staffId:n.staffId,a:n,sh:s,flags:D(n,s,e,t,k)}});j.filter(e=>e.date===I&&!1!==e.published&&!n.some(t=>t.staffId===e.staffId)).forEach(n=>{const o=(0,d.leaveCovering)(w,n.staffId,I);if(o)return void(s.some(e=>e.leave&&e.staffId===n.staffId)||s.push({key:`leave-${n.id}`,staffId:n.staffId,sh:n,flags:[],leave:o}));(I60*n.start+15)&&s.push({key:`miss-${n.id}`,staffId:n.staffId,sh:n,flags:[{key:'noin',label:'No clock-in'}]})});const o=e=>e.leave?4:e.a?'confirmed'===(0,r.attStatus)(e.a)?3:e.flags.length?0:2:1;return s.sort((e,t)=>o(e)-o(t)||(p.find(t=>t.id===e.staffId)?.name??'').localeCompare(p.find(e=>e.id===t.staffId)?.name??''))},[x,j,k,w,I,e.getMinutes(),p]),N=k.filter(e=>'open'===e.status&&e.date===I),F=k.filter(e=>'open'===e.status&&e.date!==I),E=H.filter(e=>e.a&&'awaiting'===(0,r.attStatus)(e.a)&&!e.flags.length),_=H.reduce((t,n)=>{if(!n.a)return t;const s=(0,h.paidMins)(n.a,e).paid;return'confirmed'===(0,r.attStatus)(n.a)?t.conf+=s:t.pend+=s,t},{conf:0,pend:0}),Y={confirmed:H.filter(e=>e.a&&'confirmed'===(0,r.attStatus)(e.a)).length,awaiting:H.filter(e=>e.a&&'awaiting'===(0,r.attStatus)(e.a)).length,open:H.filter(e=>e.a&&'open'===(0,r.attStatus)(e.a)).length,flagged:H.filter(e=>e.flags.length&&!(e.a&&'confirmed'===(0,r.attStatus)(e.a))).length,off:H.filter(e=>e.leave).length},L=[t,...S.map(e=>e.date).filter(e=>e!==t)];for(let e=1;L.length<8&&e<=7;e++){const n=v(t,-e);L.includes(n)||L.push(n)}const W=t=>{const s=r.useOwner.getState().confirmEntries(t,n,m,e.toISOString());z(s?`${s} ${1===s?'entry':'entries'} confirmed`:null)};return(0,b.jsxs)(a.default,{style:{gap:10},testID:"signoff",children:[S.filter(e=>e.date!==I).length?(0,b.jsx)(o.default,{accessibilityRole:"button",onPress:()=>T(S.filter(e=>e.date!==I)[S.filter(e=>e.date!==I).length-1].date),children:(0,b.jsx)(l.Banner,{kind:"warn",title:`${S.filter(e=>e.date!==I).length} earlier ${1===S.filter(e=>e.date!==I).length?'day':'days'} still to sign off`,children:"Hours only count for pay once they\u2019re confirmed. Tap to open the oldest."})}):null,(0,b.jsx)(l.Row,{wrap:!0,gap:6,children:L.slice(0,10).sort((e,t)=>t.localeCompare(e)).map(e=>{const n=S.find(t=>t.date===e);return(0,b.jsx)(l.Chip,{label:C(e,t),sub:n?`${n.n} to sign off`:void 0,selected:I===e,onPress:()=>{T(e),z(null)}},e)})}),(0,b.jsx)(l.Card,{children:(0,b.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,b.jsxs)(a.default,{style:{flex:1},children:[(0,b.jsxs)(l.T,{size:18,weight:"bold",children:[C(I,t),I===t||I===v(t,-1)?` \xb7 ${(0,u.niceDate)((0,u.parseYmd)(I))}`:'']}),(0,b.jsxs)(l.Muted,{children:[Y.confirmed," confirmed \xb7 ",Y.awaiting," awaiting \xb7 ",Y.open," still clocked in",Y.flagged?` \xb7 ${Y.flagged} flagged`:'',Y.off?` \xb7 ${Y.off} on time off`:'']})]}),(0,b.jsxs)(a.default,{style:{alignItems:'flex-end'},children:[(0,b.jsx)(l.T,{size:18,weight:"bold",colour:c.colours.ok,children:(0,h.hmDur)(_.conf)}),(0,b.jsx)(l.Muted,{children:"confirmed"}),_.pend?(0,b.jsxs)(l.T,{size:13,colour:c.colours.amber,children:[(0,h.hmDur)(_.pend)," pending"]}):null]})]})}),q?(0,b.jsx)(l.Banner,{kind:"success",title:q}):null,N.length||F.length?(0,b.jsx)(f.SectionHead,{title:"Correction requests",sub:"From the Staff app. Apply opens the times to check; declining keeps the times as clocked."}):null,[...N,...F].map(t=>{const s=p.find(e=>e.id===t.staffId),o=t.attendanceId&&x.find(e=>e.id===t.attendanceId)||x.find(e=>e.staffId===t.staffId&&e.date===t.date&&e.in);return(0,b.jsxs)(l.Card,{highlight:c.colours.blue,children:[(0,b.jsxs)(l.Row,{gap:8,children:[(0,b.jsx)(i.StaffAvatar,{id:t.staffId,size:30}),(0,b.jsxs)(a.default,{style:{flex:1},children:[(0,b.jsxs)(l.T,{weight:"semibold",children:[y(s?.name)," \xb7 ",(0,u.niceDate)((0,u.parseYmd)(t.date))]}),(0,b.jsxs)(l.Muted,{children:['in'===t.kind?'Forgot to clock in':'out'===t.kind?'Forgot to clock out':'Forgot to clock in and out',t.suggestedIn?` \xb7 in ${(0,u.hm)(new Date(t.suggestedIn))}`:'',t.suggestedOut?` \xb7 out ${(0,u.hm)(new Date(t.suggestedOut))}`:'',t.note?` \xb7 \u201c${t.note}\u201d`:'']})]}),(0,b.jsx)(l.Badge,{kind:"blue",label:"Request"})]}),(0,b.jsxs)(l.Row,{gap:6,children:[(0,b.jsx)(l.Button,{small:!0,kind:"success",label:"Review & apply",onPress:()=>R({staffId:t.staffId,a:o,request:t})}),(0,b.jsx)(l.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>r.useOwner.getState().resolveTimeRequest(t.id,'declined',n,e.toISOString())})]})]},t.id)}),(0,b.jsx)(f.SectionHead,{title:"Hours",sub:"Rostered vs actual. Flagged rows need a look and are confirmed one by one."}),H.map(t=>{const n=p.find(e=>e.id===t.staffId),s=t.a,o=s?(0,h.paidMins)(s,e):null,f=s?(0,r.attStatus)(s):null,m=s?.audit?.filter(e=>'confirmed'!==e.action).slice(-1)[0];return(0,b.jsx)(l.Card,{highlight:t.leave?c.colours.blue:'confirmed'===f?c.colours.ok:t.flags.length?c.colours.amber:void 0,children:(0,b.jsxs)(a.default,{testID:`so-row-${t.staffId}`,style:{gap:8},children:[(0,b.jsxs)(l.Row,{gap:10,children:[(0,b.jsx)(i.StaffAvatar,{id:t.staffId,size:36}),(0,b.jsxs)(a.default,{style:{flex:1},children:[(0,b.jsx)(l.T,{weight:"semibold",children:y(n?.name)}),(0,b.jsx)(l.Muted,{children:[n?.job,...$(s,n?.temp)].filter(Boolean).join(' \xb7 ')})]}),n?.temp||s?.temp?(0,b.jsx)(l.Badge,{kind:"gold",label:"Temp"}):null,s?(0,b.jsx)(l.Badge,{kind:O(s),label:M(s)}):t.leave?(0,b.jsx)(l.Badge,{kind:"blue",label:(0,d.leaveLabel)(t.leave)}):(0,b.jsx)(l.Badge,{kind:"red",label:"Missing"})]}),(0,b.jsx)(l.Row,{gap:0,style:{flexWrap:'wrap',rowGap:6},children:[['Rota',t.sh?`${(0,h.fmtH)(t.sh.start)}\u2013${(0,h.fmtH)(t.sh.end)}`:'\u2014'],['Actual',s?.in?`${(0,u.hm)(new Date(s.in))}\u2013${s.out?(0,u.hm)(new Date(s.out)):'on'}`:t.leave?(0,d.leaveLabel)(t.leave):'no clock-in'],['Break',s?.out?`${o.brk}m`:s?`${s.breakMins??0}m so far`:'\u2014'],['Paid',s?s.out?(0,h.hmDur)(o.paid):`${(0,h.hmDur)(o.worked)}\u2026`:'\u2014']].map(([e,t])=>(0,b.jsxs)(a.default,{style:{minWidth:92,flexGrow:1},children:[(0,b.jsx)(l.T,{size:11,colour:c.colours.muted,children:e.toUpperCase()}),(0,b.jsx)(l.T,{size:15,weight:"semibold",colour:'Paid'===e&&'confirmed'===f?c.colours.ok:c.colours.text,children:t})]},e))}),t.flags.length&&'confirmed'!==f?(0,b.jsx)(l.Row,{wrap:!0,gap:6,children:t.flags.map(e=>(0,b.jsx)(l.Badge,{kind:'noin'===e.key||'noout'===e.key?'red':'amber',label:e.label},e.key))}):null,t.leave?(0,b.jsxs)(l.Muted,{testID:`so-leave-${t.staffId}`,children:[(0,d.leaveNote)(t.leave),". Rota shift covered by leave: no hours counted."]}):null,m?(0,b.jsxs)(l.Muted,{children:["Adjusted by ",y(m.by),m.reason?`: ${m.reason}`:'']}):null,s?.signOff?(0,b.jsxs)(l.Muted,{children:["Confirmed by ",y(s.signOff.by)," \xb7 ",(0,u.niceDate)(new Date(s.signOff.at))," ",(0,u.hm)(new Date(s.signOff.at))]}):null,(0,b.jsxs)(l.Row,{gap:8,children:[(0,b.jsx)(l.Button,{small:!0,kind:"secondary",label:s?'Edit':'Add entry',accessibilityLabel:`${s?'Edit':'Add entry for'} ${y(n?.name)}`,onPress:()=>R({staffId:t.staffId,a:s})}),s&&'awaiting'===f?(0,b.jsx)(l.Button,{small:!0,kind:"success",label:"Confirm",accessibilityLabel:`Confirm ${y(n?.name)}`,onPress:()=>W([s.id])}):null,s&&'open'===f?(0,b.jsx)(l.Muted,{style:{alignSelf:'center'},children:"Needs a clock-out before it can be confirmed"}):null]})]})},t.key)}),H.length?null:(0,b.jsx)(l.Card,{children:(0,b.jsx)(l.Muted,{children:"No clock records or rostered shifts for this day."})}),H.length?(0,b.jsx)(l.Button,{testID:"confirm-unflagged",kind:"success",label:E.length?`Confirm all unflagged (${E.length})`:'Nothing unflagged to confirm',disabled:!E.length,onPress:()=>W(E.map(e=>e.a.id))}):null,(0,b.jsx)(l.Muted,{children:"Flags: no clock-out, 30 min or more off the rota, over 12 hours, no break on a shift over 6 hours, not on the rota, off-site, or a correction request. Editing a confirmed entry puts it back to Awaiting sign-off. Only confirmed hours count for pay, tips and exports."}),B?(0,b.jsx)(A,{a:B.a,staffId:B.staffId,date:B.request?.date??B.a?.date??I,request:B.request,onClose:()=>R(null)}):null]})};var t=_r(_d[0]),n=_r(_d[1]),s=_r(_d[2]),o=e(_r(_d[3])),a=e(_r(_d[4])),l=_r(_d[5]),i=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),f=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),p=_r(_d[14]),x=_r(_d[15]),b=_r(_d[16]);const j=['Forgot to clock in','Forgot to clock out','Wrong time'],k=[0,15,20,30,45,60],y=e=>(e??'').replace(' (example)',''),w=e=>{const t=new Date(e);return 60*t.getHours()+t.getMinutes()},S=(e,t)=>{const n=(0,u.parseYmd)(e);return n.setMinutes(t),n.toISOString()},I=e=>{const t=(e%1440+1440)%1440;return`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`},v=(e,t)=>{const n=(0,u.parseYmd)(e);return n.setDate(n.getDate()+t),(0,u.ymd)(n)},C=(e,t)=>e===t?'Today':e===v(t,-1)?'Yesterday':(0,u.niceDate)((0,u.parseYmd)(e));function D(e,t,s,o,a=[]){const l=[],i=(0,h.paidMins)(e,s),r=60*s.getHours()+s.getMinutes();if(!e.out&&(e.date60*t.end+60||i.worked>840)&&l.push({key:'noout',label:'No clock-out'}),t&&e.in){const n=w(e.in)-Math.round(60*t.start),s=e.out?w(e.out)+(e.out.slice(0,10)!==e.in.slice(0,10)&&w(e.out)=30&&l.push({key:'diff',label:`${a>=60?(0,h.hmDur)(a):`${a}m`} off the rota`})}return(0,n.isZeroShift)(e)&&l.push({key:'zero',label:'Check: 0 minutes'}),t||l.push({key:'unrostered',label:'Not on the rota'}),i.worked>720&&l.push({key:'long',label:`Very long shift (${(0,h.hmDur)(i.worked)})`}),e.out&&i.worked>360&&0===i.brk&&l.push({key:'nobreak',label:'No break (over 6h)'}),!1!==e.inSite&&!1!==e.outSite||l.push({key:'offsite',label:'Clocked off-site'}),a.some(t=>'open'===t.status&&t.staffId===e.staffId&&t.date===e.date)&&l.push({key:'request',label:'Correction requested'}),e.breakAddedAtClockOut&&l.push({key:'breakadded',label:`Break added at clock-out (${e.breakAddedAtClockOut}m)`}),e.offRota&&t&&l.push({key:'offrota',label:'Signed in off rota'}),l}function $(e,t){const n=[];return(t||e?.temp)&&n.push('Temp'),'display'!==e?.via&&'display'!==e?.outVia||n.push('via Display'),'rota'===e?.auto&&n.push(e.autoNote?`Auto from rota \xb7 ${e.autoNote}`:'Auto from rota'),n}const M=e=>{const t=(0,r.attStatus)(e);return'open'===t?'Open':'awaiting'===t?e.adjusted?'Adjusted \xb7 awaiting sign-off':'Awaiting sign-off':e.adjusted?'Confirmed \xb7 adjusted':'Confirmed'},O=e=>{const t=(0,r.attStatus)(e);return'confirmed'===t?'ok':'open'===t?'blue':'amber'},T={added:'Added entry',clock_in:'Clock-in',clock_out:'Clock-out',break:'Break',confirmed:'Confirmed',reopened:'Reopened',request_applied:'Correction request applied',request_declined:'Correction request declined',voided:'Removed (kept in history)'};function B({a:e,limit:t}){const n=[...e.audit??[]].reverse().slice(0,t??50);return n.length?(0,b.jsx)(a.default,{style:{gap:6},testID:"audit-trail",children:n.map((e,t)=>(0,b.jsxs)(a.default,{style:{flexDirection:'row',gap:8},children:[(0,b.jsx)(a.default,{style:{width:3,borderRadius:2,backgroundColor:'confirmed'===e.action?c.colours.ok:'reopened'===e.action?c.colours.amber:c.colours.gold}}),(0,b.jsxs)(a.default,{style:{flex:1},children:[(0,b.jsxs)(l.T,{size:13,weight:"semibold",children:[T[e.action],e.from||e.to?`: ${e.from??'\u2013'} \u2192 ${e.to??'\u2013'}`:'']}),(0,b.jsxs)(l.Muted,{children:[y(e.by)," \xb7 ",(0,u.niceDate)(new Date(e.at))," ",(0,u.hm)(new Date(e.at)),e.reason?` \xb7 \u201c${e.reason}\u201d`:'']})]})]},t))}):(0,b.jsx)(l.Muted,{children:"No changes yet. Times are as clocked."})}function R({label:e,mins:n,onChange:o,testID:i}){const[r,d]=(0,s.useState)(null),u=e=>{const t=/^(\d{1,2})[:.]?(\d{2})$/.exec(e.trim());t&&+t[1]<24&&+t[2]<60&&o(60*+t[1]+ +t[2]+(n>=1440&&60*+t[1]+ +t[2]<360?1440:0)),d(null)};return(0,b.jsxs)(a.default,{style:{gap:6},children:[(0,b.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(l.T,{size:13,colour:c.colours.muted,children:e}),n>=1440?(0,b.jsx)(l.Muted,{children:"next day"}):null]}),(0,b.jsxs)(l.Row,{gap:6,children:[(0,b.jsx)(l.Button,{small:!0,kind:"ghost",label:"\u221215",onPress:()=>o(n-15)}),(0,b.jsx)(l.Button,{small:!0,kind:"ghost",label:"\u22125",onPress:()=>o(n-5)}),(0,b.jsx)(t.TextInput,{testID:i,accessibilityLabel:e,value:r??I(n),onChangeText:d,onBlur:()=>null!=r&&u(r),onSubmitEditing:()=>null!=r&&u(r),style:[l.styles.input,{flex:1,textAlign:'center',fontSize:22,fontWeight:'700',paddingVertical:6,color:c.colours.text}]}),(0,b.jsx)(l.Button,{small:!0,kind:"ghost",label:"+5",onPress:()=>o(n+5)}),(0,b.jsx)(l.Button,{small:!0,kind:"ghost",label:"+15",onPress:()=>o(n+15)})]})]})}function A({a:e,staffId:t,date:n,request:o,onClose:i}){const{me:d,meId:I,now:v,role:C}=(0,h.useCtx)(3e4),[D,$]=(0,s.useState)(!1),T=!!e&&(0,m.canSeeHoursEdit)({role:C,isCar:p.IS_CAR}),A=(0,r.useOwner)(e=>e.staff.find(e=>e.id===t)?.name),P=(0,r.useOwner)(e=>e.shifts),q=(0,r.shiftOf)(P,t,n),z=o?.suggestedIn?w(o.suggestedIn):e?.in?Math.round((new Date(e.in).getTime()-(0,u.parseYmd)(n).getTime())/6e4):q?Math.round(60*q.start):720,H=o?.suggestedOut??e?.out,N=H?(F=H,Math.round((new Date(F).getTime()-(0,u.parseYmd)(n).getTime())/6e4)):e&&e.in&&!e.out?null:q?Math.round(60*q.end):z+480;var F;const[E,_]=(0,s.useState)(z),[Y,L]=(0,s.useState)(N),[W,V]=(0,s.useState)(e?.breakMins??(q&&q.end-q.start>6?30:0)),[G,K]=(0,s.useState)(o?'out'===o.kind?j[1]:j[0]:e?e.in&&!e.out?j[1]:null:j[0]),[U,Z]=(0,s.useState)(''),[J,Q]=(0,s.useState)(null),X=[G,U.trim()].filter(Boolean).join(': ')+(o&&o.note?` (request: ${o.note})`:''),ee=null!=Y?Y-E:0,te=e?(0,h.paidMins)(e,v):null,ne=null!=Y?Math.max(0,ee-W):null,se=e&&'confirmed'===(0,r.attStatus)(e),oe=null!=Y&&Y<=E?'Clock-out must be after clock-in.':ee>1200?'A shift can\u2019t be longer than 20 hours.':null!=Y&&W>=ee?'The break is longer than the shift.':null,ae=e?.in&&!o&&E===z?e.in:S(n,E),le=null==Y?void 0:e?.out&&!o&&Y===N?e.out:S(n,Y),ie=!e||ae!==e.in||(le??'')!==(e.out??'')||(e.breakMins??0)!==W;return(0,b.jsxs)(l.Sheet,{visible:!0,onClose:i,title:`${e?'Edit hours':'Add missing entry'} \xb7 ${y(A)} \xb7 ${(0,u.niceDate)((0,u.parseYmd)(n))}`,testID:"override-sheet",children:[(0,b.jsxs)(l.Row,{gap:8,style:{flexWrap:'wrap'},children:[e?(0,b.jsx)(l.Badge,{kind:O(e),label:M(e)}):(0,b.jsx)(l.Badge,{kind:"red",label:"No clock record"}),q?(0,b.jsx)(l.Badge,{kind:"neutral",label:`Rota ${(0,h.fmtH)(q.start)}\u2013${(0,h.fmtH)(q.end)}`}):(0,b.jsx)(l.Badge,{kind:"neutral",label:"Not on the rota"}),e?.in?(0,b.jsx)(l.Badge,{kind:"neutral",label:`Clocked ${(0,u.hm)(new Date(e.in))}\u2013${e.out?(0,u.hm)(new Date(e.out)):'still on'}`}):null]}),o?(0,b.jsxs)(l.Banner,{kind:"info",title:`${y(A)} asked for a correction`,children:['in'===o.kind?'Forgot to clock in':'out'===o.kind?'Forgot to clock out':'Forgot to clock in and out',o.suggestedIn?` \xb7 in ${(0,u.hm)(new Date(o.suggestedIn))}`:'',o.suggestedOut?` \xb7 out ${(0,u.hm)(new Date(o.suggestedOut))}`:'',o.note?` \xb7 \u201c${o.note}\u201d`:'',". The suggested times are filled in below."]}):null,(0,b.jsx)(R,{label:"Clock in",mins:E,onChange:_,testID:"ov-in"}),null!=Y?(0,b.jsx)(R,{label:"Clock out",mins:Y,onChange:L,testID:"ov-out"}):(0,b.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(l.Muted,{children:"No clock-out yet."}),(0,b.jsx)(l.Button,{small:!0,kind:"secondary",label:"Add clock-out",onPress:()=>L(q?Math.round(60*q.end):Math.min(E+480,60*v.getHours()+v.getMinutes()>E?60*v.getHours()+v.getMinutes():E+480))})]}),(0,b.jsx)(l.T,{size:13,colour:c.colours.muted,children:"Break"}),(0,b.jsxs)(l.Row,{wrap:!0,gap:6,children:[k.map(e=>(0,b.jsx)(l.Chip,{label:0===e?'None':`${e} min`,selected:W===e,onPress:()=>V(e)},e)),(0,b.jsx)(l.Stepper,{value:W,min:0,max:240,onChange:V,label:"break minutes"})]}),(0,b.jsx)(l.T,{size:13,colour:c.colours.muted,children:"Reason (required, kept in the audit trail)"}),(0,b.jsx)(l.Row,{wrap:!0,gap:6,children:j.map(e=>(0,b.jsx)(l.Chip,{label:e,selected:G===e,onPress:()=>K(G===e?null:e)},e))}),(0,b.jsx)(l.Field,{label:G?'Add detail (optional)':'Or type a reason',value:U,onChangeText:Z,placeholder:"e.g. stayed late for a function",maxLength:150}),(0,b.jsxs)(l.Card,{style:{backgroundColor:c.colours.surface2},children:[(0,b.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(l.T,{children:"Paid hours"}),(0,b.jsx)(l.T,{weight:"bold",colour:c.colours.gold,children:null!=ne?(0,h.hmDur)(ne):'still on shift'})]}),te&&e?.out?(0,b.jsxs)(l.Muted,{children:["Was ",(0,h.hmDur)(te.paid)," (",(0,u.hm)(new Date(e.in)),"\u2013",(0,u.hm)(new Date(e.out)),", ",te.brk,"m break)"]}):null,se?(0,b.jsx)(l.T,{size:13,colour:c.colours.amber,children:"This entry was confirmed. Saving puts it back to Awaiting sign-off (logged)."}):null]}),oe?(0,b.jsx)(l.T,{size:13,colour:c.colours.red,children:oe}):null,J?(0,b.jsx)(l.T,{size:13,colour:c.colours.red,children:J}):null,(0,b.jsx)(l.Button,{testID:"ov-save",kind:"success",label:e?'Save change':'Add entry',disabled:!!oe||!ie||X.trim().length<3,onPress:()=>{r.useOwner.getState().overrideEntry({id:e?.id,staffId:t,date:n,in:ae,out:le,breakMins:W,reason:X.slice(0,200),by:d,byId:I,now:v.toISOString(),request:o?.id})?(o&&r.useOwner.getState().resolveTimeRequest(o.id,'applied',d,v.toISOString()),i()):Q('Couldn\u2019t save: check the times and the reason.')}}),T?(0,b.jsx)(a.default,{style:{alignItems:'center',width:'100%'},children:(0,b.jsx)(l.Button,{testID:"ov-delete-entry",kind:"ghost",label:"Delete entry",accessibilityLabel:"Delete entry",onPress:()=>$(!0),style:{minHeight:48,minWidth:160}})}):null,e&&D?(0,b.jsx)(x.DeleteShiftSheet,{a:e,onClose:()=>$(!1),onDeleted:i}):null,e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(f.SectionHead,{title:"Audit trail",sub:"Every change: what, from, to, who, when and why"}),(0,b.jsx)(B,{a:e})]}):null]})}function P(e,t){const n=new Map;return e.forEach(e=>{e.date({date:e,n:t})).sort((e,t)=>t.date.localeCompare(e.date))}},1190,[827,1188,34,402,102,794,925,891,1094,858,821,1181,1084,1191,872,1192,25]); diff --git a/owner-app/admin.html b/owner-app/admin.html index 13223918be3e6abc3895834d458f1956243bde41..8ac0d1e931e074ecb15d45c7c2108b1ebafa2597 100644 --- a/owner-app/admin.html +++ b/owner-app/admin.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/owner-app/customer.html b/owner-app/customer.html index 13223918be3e6abc3895834d458f1956243bde41..8ac0d1e931e074ecb15d45c7c2108b1ebafa2597 100644 --- a/owner-app/customer.html +++ b/owner-app/customer.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/owner-app/customer/anchorage.html b/owner-app/customer/anchorage.html index 13223918be3e6abc3895834d458f1956243bde41..8ac0d1e931e074ecb15d45c7c2108b1ebafa2597 100644 --- a/owner-app/customer/anchorage.html +++ b/owner-app/customer/anchorage.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/owner-app/customer/anchorage/book.html b/owner-app/customer/anchorage/book.html index 13223918be3e6abc3895834d458f1956243bde41..8ac0d1e931e074ecb15d45c7c2108b1ebafa2597 100644 --- a/owner-app/customer/anchorage/book.html +++ b/owner-app/customer/anchorage/book.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/owner-app/customer/anchorage/feedback.html b/owner-app/customer/anchorage/feedback.html index 13223918be3e6abc3895834d458f1956243bde41..8ac0d1e931e074ecb15d45c7c2108b1ebafa2597 100644 --- a/owner-app/customer/anchorage/feedback.html +++ b/owner-app/customer/anchorage/feedback.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/owner-app/customer/anchorage/gift.html b/owner-app/customer/anchorage/gift.html index 13223918be3e6abc3895834d458f1956243bde41..8ac0d1e931e074ecb15d45c7c2108b1ebafa2597 100644 --- a/owner-app/customer/anchorage/gift.html +++ b/owner-app/customer/anchorage/gift.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/owner-app/customer/anchorage/lost.html b/owner-app/customer/anchorage/lost.html index 13223918be3e6abc3895834d458f1956243bde41..8ac0d1e931e074ecb15d45c7c2108b1ebafa2597 100644 --- a/owner-app/customer/anchorage/lost.html +++ b/owner-app/customer/anchorage/lost.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/owner-app/customer/anchorage/loyalty.html b/owner-app/customer/anchorage/loyalty.html index 13223918be3e6abc3895834d458f1956243bde41..8ac0d1e931e074ecb15d45c7c2108b1ebafa2597 100644 --- a/owner-app/customer/anchorage/loyalty.html +++ b/owner-app/customer/anchorage/loyalty.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/owner-app/customer/anchorage/merch.html b/owner-app/customer/anchorage/merch.html index 13223918be3e6abc3895834d458f1956243bde41..8ac0d1e931e074ecb15d45c7c2108b1ebafa2597 100644 --- a/owner-app/customer/anchorage/merch.html +++ b/owner-app/customer/anchorage/merch.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/owner-app/customer/anchorage/offers.html b/owner-app/customer/anchorage/offers.html index 13223918be3e6abc3895834d458f1956243bde41..8ac0d1e931e074ecb15d45c7c2108b1ebafa2597 100644 --- a/owner-app/customer/anchorage/offers.html +++ b/owner-app/customer/anchorage/offers.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/owner-app/customer/anchorage/refer.html b/owner-app/customer/anchorage/refer.html index 13223918be3e6abc3895834d458f1956243bde41..8ac0d1e931e074ecb15d45c7c2108b1ebafa2597 100644 --- a/owner-app/customer/anchorage/refer.html +++ b/owner-app/customer/anchorage/refer.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/owner-app/customer/anchorage/waitlist.html b/owner-app/customer/anchorage/waitlist.html index 13223918be3e6abc3895834d458f1956243bde41..8ac0d1e931e074ecb15d45c7c2108b1ebafa2597 100644 --- a/owner-app/customer/anchorage/waitlist.html +++ b/owner-app/customer/anchorage/waitlist.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/owner-app/customer/anchorage/whatson.html b/owner-app/customer/anchorage/whatson.html index 13223918be3e6abc3895834d458f1956243bde41..8ac0d1e931e074ecb15d45c7c2108b1ebafa2597 100644 --- a/owner-app/customer/anchorage/whatson.html +++ b/owner-app/customer/anchorage/whatson.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/owner-app/customer/basket.html b/owner-app/customer/basket.html index 13223918be3e6abc3895834d458f1956243bde41..8ac0d1e931e074ecb15d45c7c2108b1ebafa2597 100644 --- a/owner-app/customer/basket.html +++ b/owner-app/customer/basket.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/owner-app/customer/profile.html b/owner-app/customer/profile.html index 13223918be3e6abc3895834d458f1956243bde41..8ac0d1e931e074ecb15d45c7c2108b1ebafa2597 100644 --- a/owner-app/customer/profile.html +++ b/owner-app/customer/profile.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/owner-app/demo.html b/owner-app/demo.html index 13223918be3e6abc3895834d458f1956243bde41..8ac0d1e931e074ecb15d45c7c2108b1ebafa2597 100644 --- a/owner-app/demo.html +++ b/owner-app/demo.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/owner-app/display.html b/owner-app/display.html index 13223918be3e6abc3895834d458f1956243bde41..8ac0d1e931e074ecb15d45c7c2108b1ebafa2597 100644 --- a/owner-app/display.html +++ b/owner-app/display.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/owner-app/index.html b/owner-app/index.html index 2929a26b003a11638212a802004237d236f170c4..1dad3262e9dbe4b34c39ef4385f0a7e601c157d9 100644 --- a/owner-app/index.html +++ b/owner-app/index.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/owner-app/kitchen.html b/owner-app/kitchen.html index 13223918be3e6abc3895834d458f1956243bde41..8ac0d1e931e074ecb15d45c7c2108b1ebafa2597 100644 --- a/owner-app/kitchen.html +++ b/owner-app/kitchen.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/owner-app/owner.html b/owner-app/owner.html index 13223918be3e6abc3895834d458f1956243bde41..8ac0d1e931e074ecb15d45c7c2108b1ebafa2597 100644 --- a/owner-app/owner.html +++ b/owner-app/owner.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/owner-app/staff.html b/owner-app/staff.html index 13223918be3e6abc3895834d458f1956243bde41..8ac0d1e931e074ecb15d45c7c2108b1ebafa2597 100644 --- a/owner-app/staff.html +++ b/owner-app/staff.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/owner-app/sw.js b/owner-app/sw.js index 73432075b2a1cfe11fb63358dcb03b460de25997..184c26170f972a09d51dbb2798593010094bb044 100644 --- a/owner-app/sw.js +++ b/owner-app/sw.js @@ -1,7 +1,7 @@ // Anchorage Manager service worker: precache the app shell so it opens offline after the first visit. -const V = "cc-owner-32d36b5b06"; +const V = "cc-owner-a892c44e86"; const BASE = "/owner-app/"; -const PRECACHE = ["/owner-app/apple-touch-icon.png", "/owner-app/assets/assets/brand/3idiots-hero.e5dfd53739f05086b1956e72d585a66a.png", "/owner-app/assets/assets/brand/3idiots.df4a76d2130f0e5b0042f06a8c88693a.png", "/owner-app/assets/assets/brand/abbotsford-hero.78fcb8ee06ee22c4ca659c9254db7512.png", "/owner-app/assets/assets/brand/abbotsford.b26602bba5ce4969733c5422a45ad053.png", "/owner-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/owner-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/owner-app/assets/assets/brand/brae.8de9e89ac30966c6669de990370d8e40.png", "/owner-app/assets/assets/brand/cecchinis-hero.f77780fcc94fd668cf35d66d6dc52d81.png", "/owner-app/assets/assets/brand/cecchinis.ebf752fef363247848ae7c0d91938765.png", "/owner-app/assets/assets/brand/drunkencoo-hero.65c21c4da9e466cf4bffc969639a1427.png", "/owner-app/assets/assets/brand/drunkencoo.f6d92af3b14e4205a3deaf4434754c51.png", "/owner-app/assets/assets/brand/greenside-hero.1caec5a6cb939434cccb5f3a613b50f8.png", "/owner-app/assets/assets/brand/greenside.9d1556db97dcb903a3c57e2063ee2255.png", "/owner-app/assets/assets/brand/kirkmichael-hero.63b13cde7fd82eb622622b39ac80c394.png", "/owner-app/assets/assets/brand/kirkmichael.63b13cde7fd82eb622622b39ac80c394.png", "/owner-app/assets/assets/brand/kirkton-hero.9d0837b292c2f4f30f4521d806bb28c3.png", "/owner-app/assets/assets/brand/kirkton.bcf8d846df4861474d224a7a77f498fb.png", "/owner-app/assets/assets/brand/mrbasrais-hero.4ce74641cfcf52d099157c84005b9d2a.png", "/owner-app/assets/assets/brand/mrbasrais.7cc4086dd12ace82529795f1c9f8c900.png", "/owner-app/assets/assets/brand/pizzaioli-hero.1896657c08264cefb49b401891d5448d.png", "/owner-app/assets/assets/brand/pizzaioli.db8c000b62ee407121aa8b90ce45e170.png", "/owner-app/assets/assets/brand/rupeeroom-hero.969fa372add526aaacf3a6c009b8ac92.png", "/owner-app/assets/assets/brand/rupeeroom.689e6fb536dc0845eeb174a1ec7bd346.png", "/owner-app/assets/assets/brand/saltmarsh.85a6a65732635e5148478d743d9ca884.png", "/owner-app/assets/assets/brand/smokinggoat-hero.0588f17ef0eed7f757f22916cd4d37db.png", "/owner-app/assets/assets/brand/smokinggoat.20a3a1970596ab43c5d6468d4ed549a7.png", "/owner-app/assets/assets/brand/souters.f4c58d9349b6e1700fe5abcc9e9b665c.png", "/owner-app/assets/assets/brand/wildings-hero-logo-text.4661e4b935726f2511f9c17a1567c89a.png", "/owner-app/assets/assets/brand/wildings.076f4fcd06d19a0af0205c410f461b14.png", "/owner-app/assets/assets/brand/williewastles-hero.b9d53d27b66f903b5618a7177b2ffad4.png", "/owner-app/assets/assets/brand/williewastles.055a77893ced99bf3a6c5402ba5baac6.png", "/owner-app/assets/assets/brand/yasmins-hero.a5aef62e37dfcecbe0afc056186f4ad9.png", "/owner-app/assets/assets/brand/yasmins.8482602e9f0a965655924835625cb02b.png", "/owner-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/owner-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/owner-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/owner-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/owner-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/owner-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/owner-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/owner-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/owner-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/owner-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/owner-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/owner-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/owner-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/owner-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/owner-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/owner-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/owner-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/owner-app/brand-logo.png", "/owner-app/favicon.ico", "/owner-app/icon-192.png", "/owner-app/icon-512.png", "/owner-app/icon-maskable-192.png", "/owner-app/icon-maskable-512.png", "/owner-app/manifest.webmanifest", "/owner-app/index.html", "/owner-app/_expo/static/js/web/bundle.js?v=32d36b5b0637ca22d93399e5edc2dd0ab5e534fcb43b64e4e340d9a313c47d8e"]; +const PRECACHE = ["/owner-app/apple-touch-icon.png", "/owner-app/assets/assets/brand/3idiots-hero.e5dfd53739f05086b1956e72d585a66a.png", "/owner-app/assets/assets/brand/3idiots.df4a76d2130f0e5b0042f06a8c88693a.png", "/owner-app/assets/assets/brand/abbotsford-hero.78fcb8ee06ee22c4ca659c9254db7512.png", "/owner-app/assets/assets/brand/abbotsford.b26602bba5ce4969733c5422a45ad053.png", "/owner-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/owner-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/owner-app/assets/assets/brand/brae.8de9e89ac30966c6669de990370d8e40.png", "/owner-app/assets/assets/brand/cecchinis-hero.f77780fcc94fd668cf35d66d6dc52d81.png", "/owner-app/assets/assets/brand/cecchinis.ebf752fef363247848ae7c0d91938765.png", "/owner-app/assets/assets/brand/drunkencoo-hero.65c21c4da9e466cf4bffc969639a1427.png", "/owner-app/assets/assets/brand/drunkencoo.f6d92af3b14e4205a3deaf4434754c51.png", "/owner-app/assets/assets/brand/greenside-hero.1caec5a6cb939434cccb5f3a613b50f8.png", "/owner-app/assets/assets/brand/greenside.9d1556db97dcb903a3c57e2063ee2255.png", "/owner-app/assets/assets/brand/kirkmichael-hero.63b13cde7fd82eb622622b39ac80c394.png", "/owner-app/assets/assets/brand/kirkmichael.63b13cde7fd82eb622622b39ac80c394.png", "/owner-app/assets/assets/brand/kirkton-hero.9d0837b292c2f4f30f4521d806bb28c3.png", "/owner-app/assets/assets/brand/kirkton.bcf8d846df4861474d224a7a77f498fb.png", "/owner-app/assets/assets/brand/mrbasrais-hero.4ce74641cfcf52d099157c84005b9d2a.png", "/owner-app/assets/assets/brand/mrbasrais.7cc4086dd12ace82529795f1c9f8c900.png", "/owner-app/assets/assets/brand/pizzaioli-hero.1896657c08264cefb49b401891d5448d.png", "/owner-app/assets/assets/brand/pizzaioli.db8c000b62ee407121aa8b90ce45e170.png", "/owner-app/assets/assets/brand/rupeeroom-hero.969fa372add526aaacf3a6c009b8ac92.png", "/owner-app/assets/assets/brand/rupeeroom.689e6fb536dc0845eeb174a1ec7bd346.png", "/owner-app/assets/assets/brand/saltmarsh.85a6a65732635e5148478d743d9ca884.png", "/owner-app/assets/assets/brand/smokinggoat-hero.0588f17ef0eed7f757f22916cd4d37db.png", "/owner-app/assets/assets/brand/smokinggoat.20a3a1970596ab43c5d6468d4ed549a7.png", "/owner-app/assets/assets/brand/souters.f4c58d9349b6e1700fe5abcc9e9b665c.png", "/owner-app/assets/assets/brand/wildings-hero-logo-text.4661e4b935726f2511f9c17a1567c89a.png", "/owner-app/assets/assets/brand/wildings.076f4fcd06d19a0af0205c410f461b14.png", "/owner-app/assets/assets/brand/williewastles-hero.b9d53d27b66f903b5618a7177b2ffad4.png", "/owner-app/assets/assets/brand/williewastles.055a77893ced99bf3a6c5402ba5baac6.png", "/owner-app/assets/assets/brand/yasmins-hero.a5aef62e37dfcecbe0afc056186f4ad9.png", "/owner-app/assets/assets/brand/yasmins.8482602e9f0a965655924835625cb02b.png", "/owner-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/owner-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/owner-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/owner-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/owner-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/owner-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/owner-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/owner-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/owner-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/owner-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/owner-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/owner-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/owner-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/owner-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/owner-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/owner-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/owner-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/owner-app/brand-logo.png", "/owner-app/favicon.ico", "/owner-app/icon-192.png", "/owner-app/icon-512.png", "/owner-app/icon-maskable-192.png", "/owner-app/icon-maskable-512.png", "/owner-app/manifest.webmanifest", "/owner-app/index.html", "/owner-app/_expo/static/js/web/bundle.js?v=a892c44e86b9bd53c2002bf19056236655a4f08bf62a30226a00596553657e77"]; // Hugging Face serves large files (fonts) through a redirect to its CDN. Browsers refuse to hand a *redirected* cached // response to a page, so store a plain copy instead (otherwise fonts, and so the app, fail to load offline). const plain = r => r.redirected ? r.blob().then(b => new Response(b, { status: 200, headers: { 'Content-Type': r.headers.get('Content-Type') || b.type || 'application/octet-stream' } })) : Promise.resolve(r); diff --git a/owner-app/team.html b/owner-app/team.html index 13223918be3e6abc3895834d458f1956243bde41..8ac0d1e931e074ecb15d45c7c2108b1ebafa2597 100644 --- a/owner-app/team.html +++ b/owner-app/team.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/staff-app/_expo/static/js/web/bundle.js b/staff-app/_expo/static/js/web/bundle.js index abb844808deeb62e58fa9e81f398317914096a3e..452ef1f1ff1670ec0abb16948f056eeab5872cf3 100644 --- a/staff-app/_expo/static/js/web/bundle.js +++ b/staff-app/_expo/static/js/web/bundle.js @@ -872,7 +872,7 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{v __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},789,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},790,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},791,[]); -__d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ChefApp=function({section:e}={}){const{r:s,rid:o,me:n,now:L}=(0,M.useChef)(3e4);(0,fe.useReviewAlerts)(o);const _=(0,N.useSignedIn)(),U=_?.id??M.CHEF_ID,q=_?.ownerAccess&&'owner'!==_.role?'owner privileges':_?.managerAccess&&'staff'===_.role?'manager privileges':'',be=(0,xe.useSync)(e=>e.perms),ye=be.includes('*')||be.includes('takings.view');(0,i.useSoldOutLink)(!0,(_?.name??n).replace(' (example)',''));const Se=e?Te[e]:void 0,[Ie,He]=(0,I.useState)(Se?.tab??'home'),[Re,Ae]=(0,I.useState)(Se?.k??null),[De,Be]=(0,I.useState)(Se?.stock??'levels'),[$e,Oe]=(0,I.useState)(void 0),[Ee,Fe]=(0,I.useState)(Se?.gp??'dishes'),Le=(0,I.useRef)(null),Ge=(0,k.ymd)(L),Ne=(0,k.ymd)(new Date(L.getTime()+864e5));(0,p.useTipsPosted)(o,Ge);const Me=(0,X.useTravelDay)('chef',Ge),We='home'===Ie&&!Me;(0,P.useKitchenTodoChime)(o,Ge,()=>Ue('kitchen','bookings')),(0,he.useAlertWatcher)(o,{kinds:['takeaway']}),(0,I.useEffect)(()=>{(0,N.ensureAttendance)((new Date).toISOString().slice(0,10),L)},[]);const Ke=(0,I.useRef)({t:'home',k:null});Ke.current={t:Ie,k:Re};const Ve=(0,I.useRef)([]),ze=(0,l.useScrollMemory)(Le),Ue=(0,I.useCallback)((e,t=null)=>{'takings'!==t||ye||(t=null);const s=Ke.current;s.t===e&&s.k===t||(Ve.current=[...Ve.current,{...s,y:ze.leave()}].slice(-30),ze.restore(0)),He(e),Ae(t)},[ye]),qe=(0,I.useCallback)(()=>{if((0,r.runBackLayer)())return!0;const e=Ke.current;let t=Ve.current.pop();for(;t&&t.t===e.t&&t.k===e.k;)t=Ve.current.pop();if(!t&&'home'===e.t&&!e.k)return!1;const s=t??{t:'home',k:null};return ze.leave(),He(s.t),Ae(s.k),ze.restore(s.y??0),!0},[]);(0,r.useWebBack)(qe);const Qe=(0,r.useInnerBackShown)();(0,I.useEffect)(()=>{c.PITCH&&(globalThis.__pitchGo=(e,t=null,s)=>{'stock'===e&&s&&Be(s),'gp'===e&&s&&Fe(s),Ue(e,t)})},[Ue]),(0,f.useShiftReminders)({rid:o,staffId:U,name:n,kitchen:!0}),(0,C.useScheduledNotices)({rid:o,staffId:_?.id??'',name:n,onOpen:e=>{'orderlists'===e&&Ue('kitchen','orderlists'),'chat'===e&&Ue('kitchen','live')}}),(0,T.useOffRotaPrompt)({rid:o,staffId:_?.id??''}),(0,I.useEffect)(()=>{const e=H.default.addEventListener('hardwareBackPress',qe);return()=>e.remove()},[qe]),(0,I.useEffect)(()=>{'takings'!==Re||ye||(Ae(null),He('kitchen'))},[Re,ye]);const Ye=Ce.filter(e=>'takings'!==e.id||ye),Je=Re&&('takings'!==Re||ye)?Ce.find(e=>e.id===Re):null,Xe=((0,D.default)().width,Je?Je.title:{home:'Today in the kitchen',stock:c.PITCH?'Stock':'Deliveries & stock',gp:'GP & costing',creator:le.CREATOR_TITLE,orders:'Orders',kitchen:'Kitchen'}[Ie]);return(0,ve.jsxs)($.SafeAreaView,{style:{flex:1,backgroundColor:G.colours.bg},edges:['top','bottom'],children:[(0,ve.jsxs)(B.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:G.colours.border,gap:6},children:[(0,ve.jsx)(B.default,{style:{position:'absolute',top:4,right:6,zIndex:5,flexDirection:'row',alignItems:'center'},children:(0,ve.jsx)(E.VoiceSlot,{size:44})}),(0,ve.jsx)(B.default,{testID:"header-me-wrap",style:{alignItems:'flex-start',minHeight:44,justifyContent:'center',maxWidth:'70%'},children:(0,ve.jsx)(B.default,{testID:"header-me",accessibilityLabel:`Signed in as ${n.replace(' (example)','')}, Head Chef${q?`, ${q}`:''}`,style:{borderWidth:1,borderColor:G.colours.gold,borderRadius:16,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%'},children:(0,ve.jsxs)(F.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,ve.jsx)(ie.StaffAvatar,{id:M.CHEF_ID,size:24,ring:!1}),(0,ve.jsxs)(B.default,{style:{flexShrink:1},children:[(0,ve.jsxs)(F.T,{size:13,weight:"semibold",colour:G.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[n.replace(' (example)','')," \xb7 Head Chef"]}),q?(0,ve.jsx)(F.Muted,{center:!1,size:10,numberOfLines:1,children:q}):null]})]})})}),(0,ve.jsx)(O.VenueHeaderBlock,{rid:o,name:s.name,badge:"CHEF",place:"Head Chef app"}),(0,ve.jsx)(R.default,{accessibilityRole:"button",accessibilityLabel:"Open CoverCharge for Staff",onPress:()=>{const e=(0,ae.appUrl)('staff');e&&window.location.assign(e)},style:{alignSelf:'center',borderWidth:1,borderColor:G.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:3,minHeight:44,justifyContent:'center'},children:(0,ve.jsx)(F.T,{size:13,colour:G.colours.gold,children:"Staff app \u203a"})})]}),(0,ve.jsxs)(A.default,{ref:Le,...ze.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:[(0,ve.jsx)(r.BackTitleRow,{back:!('home'===Ie&&!Re||Qe),onBack:qe,title:Xe}),'home'===Ie?(0,ve.jsx)(X.DayBar,{app:"chef",today:Ge}):null,'home'===Ie&&Me?(0,ve.jsx)(X.DayView,{rid:o,day:Me,today:Ge,app:"chef"}):null,'home'===Ie?(0,ve.jsx)(oe.WhoBar,{}):null,We&&_?(0,ve.jsx)(h.MyTasksToday,{rid:o,staffId:_.id,name:_.name,onShift:(0,f.shiftNow)(_.id,L.getTime()).on}):null,We?(0,ve.jsx)(p.TodaysTipsCard,{rid:o,today:Ge}):null,We?(0,ve.jsx)(p.TipsPotCard,{rid:o,today:Ge}):null,We?(0,ve.jsx)(b.CoversToday,{rid:o,onPress:()=>Ue('kitchen','bookings')}):null,We?(0,ve.jsx)(y.LastFoodBanner,{rid:o,now:L}):null,We?(0,ve.jsx)(x.NextTableFreeCard,{rid:o,now:L}):null,We?(0,ve.jsx)(j.KitchenSignoffs,{rid:o,today:Ge,by:n,app:"chef"}):null,We?(0,ve.jsxs)(B.default,{style:{gap:4},children:[(0,ve.jsx)(j.PlattersBooked,{rid:o,date:Ge,label:"Platters booked today"}),(0,ve.jsx)(j.PlattersBooked,{rid:o,date:Ne,label:"Platters booked tomorrow"})]}):null,We?(0,ve.jsx)(me.ChefAssistantButton,{}):null,We?(0,ve.jsx)(Pe,{go:(e,t)=>{'stock'===e&&t&&Be(t),'gp'===e&&t&&Fe(t),'orders'===e&&Oe(t),Ue(e,'kitchen'===e?t??null:null)}}):null,'stock'!==Ie||c.PITCH?null:(0,ve.jsx)(Y.KitchenCosts,{rid:o,me:(_?.name??n).replace(' (example)',''),actor:{name:(_?.name??n).replace(' (example)',''),role:'head-chef'},initial:'deliveries'===De?'deliveries':'take'===De?'count':'deliveries'},`s-${De}`),'gp'!==Ie||c.PITCH?null:(0,ve.jsx)(Y.KitchenCosts,{rid:o,me:(_?.name??n).replace(' (example)',''),actor:{name:(_?.name??n).replace(' (example)',''),role:'head-chef'},initial:"dishgp"},`g-${Ee}`),'stock'===Ie&&c.PITCH?(0,ve.jsx)(Q.StockScreen,{initial:De},De):null,'gp'===Ie&&c.PITCH?(0,ve.jsx)(W.GpScreen,{initial:Ee},Ee):null,'creator'===Ie?(0,ve.jsx)(le.DishCreator,{rid:o,canPublish:!1}):null,'orders'===Ie?(0,ve.jsx)(z.OrdersScreen,{focus:$e},$e??'all'):null,'kitchen'!==Ie||Je?null:(0,ve.jsxs)(B.default,{style:{gap:10},children:[(0,ve.jsx)(B.default,{style:{borderRadius:14,borderWidth:1,borderColor:G.colours.border,backgroundColor:G.colours.surface,overflow:'hidden'},children:Ye.map((e,t)=>(0,ve.jsx)(R.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>Ue(Ie,e.id),style:({pressed:e})=>({padding:12,borderTopWidth:t?1:0,borderColor:G.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,ve.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,ve.jsxs)(B.default,{style:{flex:1},children:[(0,ve.jsx)(F.T,{weight:"medium",children:e.title}),(0,ve.jsx)(F.Muted,{children:e.sub})]}),(0,ve.jsx)(F.T,{colour:G.colours.muted,children:"\u203a"})]})},e.id))}),(0,ve.jsx)(F.Muted,{children:"Head Chef sees kitchen, stock, food costs and GP. Payroll, wages and the restaurant's billing stay in CoverCharge for Managers."}),(0,ve.jsxs)(F.Muted,{center:!0,children:["Head Chef app \xb7 ",d.APP_VERSION," \xb7 ",'live'===xe.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),'myshift'===Re&&U?(0,ve.jsxs)(B.default,{style:{gap:10},testID:"chef-myshift",children:[(0,ve.jsx)(te.ClockInOut,{}),(0,ve.jsx)(se.MyUpcomingShifts,{staffId:U,team:!0})]}):null,'mypay'===Re?(0,ve.jsxs)(B.default,{style:{gap:10},testID:"chef-mypay",children:[(0,ve.jsx)(Z.MyPeriods,{staffId:U}),(0,ve.jsx)(J.MyHoursPay,{staffId:U}),(0,ve.jsx)(ee.MyTips,{staffId:U}),(0,ve.jsx)(F.Card,{children:(0,ve.jsx)(u.PhoneAlerts,{})})]}):null,'alerts'===Re?(0,ve.jsx)(B.default,{testID:"chef-alerts",children:(0,ve.jsx)(u.PhoneAlerts,{})}):null,'avatar'===Re?(0,ve.jsx)(t.AvatarMaker,{meId:_?.id??M.CHEF_ID,me:n}):null,'reviews'===Re?(0,ve.jsx)(ge.ReviewsSection,{rid:o,mode:"read",venueName:s.name}):null,'bookings'===Re?(0,ve.jsx)(S.TodaysBookings,{rid:o,today:Ge,by:n,app:"chef"}):null,'specials'===Re?(0,ve.jsx)(de.SpecialsEditor,{rid:o,me:n,app:"chef",now:L}):null,'forecast'===Re?(0,ve.jsx)(K.ChefForecast,{openPrep:()=>Ue('kitchen','prep')}):null,'prep'===Re?(0,ve.jsx)(V.PrepScreen,{}):null,'live'===Re?(0,ve.jsx)(V.TeamScreen,{}):null,'waste'===Re?(0,ve.jsx)(V.WasteScreen,{}):null,'recipes'===Re?(0,ve.jsx)(pe.RecipeCards,{rid:o,actor:{name:n,role:'head-chef'},mode:"edit"}):null,'allergens'===Re?(0,ve.jsx)(V.AllergenScreen,{openCards:()=>Ue('kitchen','recipes')}):null,'compliance'===Re?(0,ve.jsx)(V.ComplianceScreen,{}):null,'takings'===Re&&ye?(0,ve.jsx)(p.CashUpScreen,{rid:o,today:Ge,canEdit:!1,chartsOnly:!0,who:{id:U,name:n.replace(' (example)','')}}):null,'board'===Re?(0,ve.jsx)(ke.QuestionBoard,{rid:o,today:Ge,manager:!1,by:""}):null,'teamtasks'===Re?(0,ve.jsx)(h.KitchenTeamTasks,{rid:o,actor:_}):null,'orderlists'===Re?(0,ve.jsx)(v.OrderListsScreen,{rid:o,today:Ge,editor:!0,who:{id:U,name:n.replace(' (example)','')}}):null,'foodsafety'===Re?(0,ve.jsx)(w.FoodSafetyCard,{children:(0,ve.jsx)(R.default,{accessibilityRole:"button",onPress:()=>Ue('kitchen','haccp'),children:(0,ve.jsx)(F.T,{colour:G.colours.gold,children:"Today\u2019s temperature log \u203a"})})}):null,'haccp'===Re?(0,ve.jsx)(re.HaccpLog,{mode:"chef",me:n,meId:M.CHEF_ID,now:L}):null,'accidents'===Re?(0,ve.jsx)(ne.AccidentBook,{app:"chef",me:n,meId:M.CHEF_ID,now:L,seeAll:!1}):null]}),(0,ve.jsx)(je.BottomTabs,{tablist:!0,background:G.colours.surface,active:Ie,onPress:e=>Ue(e),tabs:we.map(e=>({id:e.id,label:e.label,short:'creator'===e.id?'Creator':void 0,icon:e.icon}))}),(0,ve.jsx)(me.ChefAssistantSheet,{go:(e,t)=>{'orders'===e?(Oe(t),Ue('orders')):'gp'===e?Ue('gp'):Ue('kitchen',e)}}),(0,ve.jsx)(ce.AlertHost,{variant:"chef",rid:o,skipTakeaway:!0}),(0,ve.jsx)(ue.KitchenFlash,{rid:o,me:n})]})};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),i=_r(_d[3]),n=_r(_d[4]),l=_r(_d[5]),r=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),f=_r(_d[12]),k=_r(_d[13]),b=_r(_d[14]),y=_r(_d[15]),x=_r(_d[16]),j=_r(_d[17]),v=_r(_d[18]),w=_r(_d[19]),C=_r(_d[20]),T=_r(_d[21]),P=_r(_d[22]),S=_r(_d[23]),I=_r(_d[24]),H=e(_r(_d[25]));_r(_d[26]);var R=e(_r(_d[27])),A=e(_r(_d[28])),D=e(_r(_d[29])),B=e(_r(_d[30])),$=_r(_d[31]),O=_r(_d[32]),E=_r(_d[33]),F=_r(_d[34]),L=_r(_d[35]),G=_r(_d[36]),N=_r(_d[37]),_=_r(_d[38]),M=_r(_d[39]),W=_r(_d[40]),K=_r(_d[41]),V=_r(_d[42]),z=_r(_d[43]),U=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),Y=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),se=_r(_d[53]),oe=_r(_d[54]),ie=_r(_d[55]),ae=_r(_d[56]),ne=_r(_d[57]),le=_r(_d[58]),re=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),pe=_r(_d[64]),ge=_r(_d[65]),fe=_r(_d[66]),ke=_r(_d[67]),be=_r(_d[68]),me=_r(_d[69]),ye=_r(_d[70]),xe=_r(_d[71]),je=_r(_d[72]),ve=_r(_d[73]);s.LIVE_HEAD_CHEF&&(0,o.requireRealData)();const we=[{id:'home',label:'Home',icon:'home'},{id:'stock',label:'Stock',icon:'box'},{id:'gp',label:'GP',icon:'forecast'},{id:'creator',label:le.CREATOR_TITLE,icon:'sparkle'},{id:'orders',label:'Orders',icon:'orders'},{id:'kitchen',label:'Kitchen',icon:'platter'}],Ce=[{id:'alerts',title:'Turn on alerts',sub:'Get your reminders on this phone, even with the app closed'},{id:'avatar',title:'My avatar',sub:'Animals, Bar & kitchen, sea, sport, colours, patterns or your own photo'},{id:'reviews',title:'Reviews',sub:'Published reviews, newest first'},{id:'myshift',title:'My shifts & clock in',sub:'Clock in and out (checks you are at the venue), breaks, and your shifts on the rota'},{id:'mypay',title:'My pay & tips',sub:'Your hours, tips share, tip goal, paydays and payslip info. Only you see this'},{id:'takings',title:'Takings & tips graphs',sub:'Daily cash ups, weekly sales, this week vs last, categories and the Tips pot (view only)'},{id:'bookings',title:'Today\u2019s bookings',sub:'Covers, allergens to sign off, platters and other reservations, dogs, access and vegan/vegetarian'},{id:'recipes',title:'Recipe cards',sub:'Plating photo, ingredients, method, allergens, section and price; you sign each card off before it goes live'},{id:'specials',title:'Specials board',sub:'Photo of the chalkboard or typed specials with allergens; shown in the customer app'},{id:'board',title:'Question board',sub:'Ask the team anything anonymously, and vote'},{id:'teamtasks',title:'Kitchen team tasks',sub:'Daily tasks for your chefs, commis and KPs'},{id:'orderlists',title:'Order lists',sub:'Alsons drinks, Cash and carry: add items, tick on the day, finish and carry over'},{id:'foodsafety',title:'Food safety (CookSafe)',sub:'Based on CookSafe (Food Standards Scotland). Full logs coming in the next update'},{id:'haccp',title:'Food safety log (HACCP)',sub:'Temperatures, cleaning and allergen checks; voice entry; limits; EHO export'},{id:'accidents',title:'Accident book',sub:'Accidents and near misses; you see your own entries'},{id:'forecast',title:'Forecast',sub:'Covers per day for the week ahead, and prep from the forecast'},{id:'prep',title:'Prep list',sub:'From the forecast and bookings, tick off as you go'},{id:'live',title:'Live tickets, sold out, team & chat',sub:'Orders, readiness alerts, sold out, who\u2019s on, rota, team chat and private messages'},{id:'waste',title:'Waste log',sub:'Item, quantity, reason and cost; weekly total and % of sales'},{id:'allergens',title:'Allergens',sub:'14-allergen matrix from the recipe cards, costing cross-check and audit log'},{id:'compliance',title:'Kitchen compliance',sub:'Fridge, freezer, cooking and cooling temps; cleaning; daily checks'}],Te={stock:{tab:'stock',stock:'levels'},'stock-take':{tab:'stock',stock:'take'},deliveries:{tab:'stock',stock:'deliveries'},gp:{tab:'gp',gp:'dishes'},'price-changes':{tab:'gp',gp:'changes'},'gp-week':{tab:'gp',gp:'week'},'menu-engineering':{tab:'gp',gp:'engineering'},orders:{tab:'orders'},forecast:{tab:'kitchen',k:'forecast'},prep:{tab:'kitchen',k:'prep'},live:{tab:'kitchen',k:'live'},waste:{tab:'kitchen',k:'waste'},recipes:{tab:'kitchen',k:'recipes'},'recipe-cards':{tab:'kitchen',k:'recipes'},allergens:{tab:'kitchen',k:'allergens'},compliance:{tab:'kitchen',k:'compliance'},haccp:{tab:'kitchen',k:'haccp'},specials:{tab:'kitchen',k:'specials'},accidents:{tab:'kitchen',k:'accidents'},'new-dish':{tab:'creator'}};function Pe({go:e}){const{k:t,c:s,menu:o,now:i,rid:l,me:r}=(0,M.useChef)(3e4),d=(0,U.useSheetReminders)(),u=(0,M.useWeek)(),{covers:h,label:p,enough:f,booked:k}=(0,M.useForecast)(),b=(0,z.useSuggestions)(),y=t.ingredients.filter(e=>e.onHand<=0||(0,M.isLow)(e.onHand,e.par)),x=b.filter(e=>e.ordersToday&&!e.placedToday),j=(0,_.priceImpacts)(o,t.recipes,t.ingredients,t.targetGp).filter(e=>e.dropped.length),v=t.deliveries.filter(e=>'expected'===e.status),w=!t.recipes.length||!t.ingredients.length,C=w?[]:s.filter(e=>e.below),T=(0,n.useLiveState)(),P=(0,be.useRecipeCards)(l).filter(e=>!e.signOff),S=(0,Y.useKitchenSummary)(l),[H,A]=(0,I.useState)(!1);return(0,ve.jsxs)(B.default,{style:{gap:12},testID:"chef-dashboard",children:[(0,ve.jsx)(re.MissedBanner,{mode:"chef",now:i,onPress:()=>e('kitchen','haccp')}),d.map(t=>(0,ve.jsx)(R.default,{accessibilityRole:"button",onPress:()=>e('orders',t.supplierId),children:(0,ve.jsxs)(F.Banner,{kind:'red'===t.tone?'danger':'warn',title:`\u23f0 ${t.text}`,children:["Tap to open the ",t.name," order sheet. Nothing is sent until you press Send."]})},t.supplierId)),P.length?(0,ve.jsx)(R.default,{testID:"cards-awaiting",accessibilityRole:"button",onPress:()=>e('kitchen','recipes'),children:(0,ve.jsxs)(F.Banner,{kind:"warn",title:`${P.length} recipe card${1===P.length?'':'s'} awaiting your sign-off`,children:[P.slice(0,4).map(e=>e.dish).join(', '),". Guests see \"awaiting allergen sign-off\" and cannot order these until you sign them off."]})}):null,(0,ve.jsx)(q.ShellfishTile,{rid:l,by:r,app:"chef",onOrder:()=>e('orders','os-kittyfisher')}),(0,ve.jsx)(F.Button,{testID:"chef-add-soldout",label:"Add sold out",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>A(!0),style:{minHeight:56}}),(0,ve.jsxs)(F.Row,{wrap:!0,gap:10,children:[c.PITCH?null:(0,ve.jsx)(M.Tile,{testID:"tile-gp",label:"Dishes under target GP",value:S.costed?`${S.below} of ${S.costed}`:'Nothing yet',sub:S.costed?`Average ${(0,M.pct1)(S.avgGp??0)} \xb7 target ${S.target}%`:'Record a delivery, then cost your recipe cards',tone:S.costed?S.below?'amber':'ok':void 0,onPress:()=>e('gp','dishes')}),c.PITCH?w?(0,ve.jsx)(M.Tile,{testID:"tile-gp",label:"GP this week vs target",value:"Nothing yet",sub:"Add ingredients and recipe costs to see GP",onPress:()=>e('gp','week')}):(0,ve.jsx)(M.Tile,{testID:"tile-gp",label:"GP this week vs target",value:(0,M.pct1)(u.theo),sub:`Target ${t.targetGp}% \xb7 actual ${(0,M.pct1)(u.actual)}`,tone:u.theoe('gp','week')}):null,c.PITCH?null:(0,ve.jsx)(M.Tile,{testID:"tile-stock",label:"Stock value",value:null!=S.stockValue?(0,L.gbp)(S.stockValue):'Nothing yet',sub:S.lastCount?`At cost, counted ${S.lastCount}`:'No stock counted yet',onPress:()=>e('stock','take')}),c.PITCH?(0,ve.jsx)(M.Tile,{testID:"tile-stock",label:"Stock value",value:t.ingredients.length?(0,L.gbp)((0,M.stockValue)(t.ingredients)):'Nothing yet',sub:t.ingredients.length?'At cost':'No stock counted yet',onPress:()=>e('stock','levels')}):null,(0,ve.jsx)(M.Tile,{label:"Items low or out",value:t.ingredients.length?`${y.length}`:'Nothing yet',sub:t.ingredients.length?y.slice(0,3).map(e=>e.name).join(', '):'No stock counted yet',tone:y.some(e=>e.onHand<=0)?'red':y.length?'amber':'ok',onPress:()=>e('stock','levels')}),(0,ve.jsx)(M.Tile,{label:"Waste this week",value:t.waste.length?(0,L.gbp)(u.wasteWeek):'Nothing yet',sub:u.sales?`${(0,M.pct1)(u.wasteWeek/u.sales*100)} of food sales`:'',onPress:()=>e('kitchen','waste')}),f?(0,ve.jsx)(M.Tile,{testID:"tile-forecast",label:"Covers forecast today",value:`${h}`,sub:p,onPress:()=>e('kitchen','forecast')}):(0,ve.jsx)(M.Tile,{testID:"tile-booked",label:"Booked so far today",value:'ready'===T?`${k}`:'connecting'===T?'Connecting\u2026':'Not connected',sub:"Not enough history for a forecast yet",onPress:()=>e('kitchen','bookings')}),(0,ve.jsx)(M.Tile,{label:"Orders due today",value:`${x.length}`,sub:x.map(e=>`${e.s.name} by ${e.s.cutoff}`).join(' \xb7 ')||'None',tone:x.some(e=>e.cutPassed)?'red':x.length?'amber':'ok',onPress:()=>e('orders')})]}),j.map(e=>(0,ve.jsxs)(F.Banner,{kind:"danger",title:`${e.ing.name} ${e.pct>0?'+':''}${e.pct.toFixed(0)}%: ${e.dropped.length} dish${1===e.dropped.length?'':'es'} drop below target`,children:[e.dropped.map(e=>e.item.name).join(', '),". Open GP \u203a Price changes."]},e.ing.id)),v.length?(0,ve.jsx)(R.default,{accessibilityRole:"button",onPress:()=>e('stock','deliveries'),children:(0,ve.jsx)(F.Banner,{kind:"info",title:`${v.length} deliver${1===v.length?'y':'ies'} to check in today`,children:"Count in against the order, flag shorts and price changes."})}):null,C.length?(0,ve.jsx)(R.default,{accessibilityRole:"button",onPress:()=>e('gp','dishes'),children:(0,ve.jsxs)(F.Banner,{kind:"warn",title:`${C.length} dishes below ${t.targetGp}% GP`,children:[C.slice(0,4).map(e=>e.item.name).join(', '),C.length>4?'\u2026':'']})}):null,(0,ve.jsx)(F.Row,{wrap:!0,gap:8,children:[['Recipe cards','recipes'],['Food safety log','haccp'],['Specials board','specials'],[le.CREATOR_TITLE,'creator'],['Forecast','forecast'],['Prep list','prep'],['Live tickets & sold out','live'],['Allergens','allergens'],['Accident book','accidents']].map(([t,s])=>(0,ve.jsx)(R.default,{accessibilityRole:"button",accessibilityLabel:t,onPress:()=>'creator'===s?e('creator'):e('kitchen',s),style:{flexGrow:1,flexBasis:140,padding:12,borderRadius:12,borderWidth:1.5,borderColor:G.colours.gold,backgroundColor:G.colours.surface},children:(0,ve.jsxs)(F.T,{weight:"semibold",children:[t," \u203a"]})},s))}),(0,ve.jsx)(F.Badge,{kind:"neutral",label:"Nothing is ordered or sent from here"}),(0,ve.jsx)(ye.SoldOutSheet,{visible:H,onClose:()=>A(!1),rid:l,by:r,hideLinks:!0,testID:"chef-soldout-sheet"})]})}},792,[793,978,884,979,986,1051,1052,1015,2,1053,1057,1058,1090,858,1095,1099,1100,1103,1104,1107,1108,1110,1111,1112,34,373,236,402,295,426,102,36,873,1137,794,867,821,1084,1139,1145,1148,1149,1152,1167,1168,1169,1171,1172,1173,1176,1179,1187,1188,1192,1193,925,1003,1194,1158,1195,1202,1203,1212,1205,1156,1214,1218,1189,874,1219,1154,987,1220,25]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ChefApp=function({section:e}={}){const{r:s,rid:i,me:n,now:L}=(0,_.useChef)(3e4);(0,be.useReviewAlerts)(i);const M=(0,G.useSignedIn)(),q=M?.id??_.CHEF_ID,Q=M?.ownerAccess&&'owner'!==M.role?'owner privileges':M?.managerAccess&&'staff'===M.role?'manager privileges':'',me=(0,je.useSync)(e=>e.perms),xe=me.includes('*')||me.includes('takings.view');(0,o.useSoldOutLink)(!0,(M?.name??n).replace(' (example)',''));const Re=e?Se[e]:void 0,[He,Ae]=(0,I.useState)(Re?.tab??'home'),[De,$e]=(0,I.useState)(Re?.k??null),[Be,Oe]=(0,I.useState)(Re?.stock??'levels'),[Ee,Fe]=(0,I.useState)(void 0),[Le,Ne]=(0,I.useState)(Re?.gp??'dishes'),Ge=(0,I.useRef)(null),Me=(0,b.ymd)(L),We=(0,b.ymd)(new Date(L.getTime()+864e5));(0,p.useTipsPosted)(i,Me);const Ke=(0,Z.useTravelDay)('chef',Me),Ve='home'===He&&!Ke;(0,P.useKitchenTodoChime)(i,Me,()=>Qe('kitchen','bookings')),(0,pe.useAlertWatcher)(i,{kinds:['takeaway']}),(0,I.useEffect)(()=>{(0,G.ensureAttendance)((new Date).toISOString().slice(0,10),L)},[]);const ze=(0,I.useRef)({t:'home',k:null});ze.current={t:He,k:De};const Ue=(0,I.useRef)([]),qe=(0,l.useScrollMemory)(Ge),Qe=(0,I.useCallback)((e,t=null)=>{'takings'!==t||xe||(t=null);const s=ze.current;s.t===e&&s.k===t||(Ue.current=[...Ue.current,{...s,y:qe.leave()}].slice(-30),qe.restore(0)),Ae(e),$e(t)},[xe]),Ye=(0,I.useCallback)(()=>{if((0,r.runBackLayer)())return!0;const e=ze.current;let t=Ue.current.pop();for(;t&&t.t===e.t&&t.k===e.k;)t=Ue.current.pop();if(!t&&'home'===e.t&&!e.k)return!1;const s=t??{t:'home',k:null};return qe.leave(),Ae(s.t),$e(s.k),qe.restore(s.y??0),!0},[]);(0,r.useWebBack)(Ye);const Je=(0,r.useInnerBackShown)();(0,I.useEffect)(()=>{c.PITCH&&(globalThis.__pitchGo=(e,t=null,s)=>{'stock'===e&&s&&Oe(s),'gp'===e&&s&&Ne(s),Qe(e,t)})},[Qe]),(0,f.useShiftReminders)({rid:i,staffId:q,name:n,kitchen:!0}),(0,C.useScheduledNotices)({rid:i,staffId:M?.id??'',name:n,onOpen:e=>{'orderlists'===e&&Qe('kitchen','orderlists'),'chat'===e&&Qe('kitchen','live')}}),(0,T.useOffRotaPrompt)({rid:i,staffId:M?.id??''}),(0,I.useEffect)(()=>{const e=R.default.addEventListener('hardwareBackPress',Ye);return()=>e.remove()},[Ye]),(0,I.useEffect)(()=>{'takings'!==De||xe||($e(null),Ae('kitchen'))},[De,xe]);const Xe=Pe.filter(e=>'takings'!==e.id||xe),Ze=De&&('takings'!==De||xe)?Pe.find(e=>e.id===De):null,et=((0,D.default)().width,Ze?Ze.title:{home:'Today in the kitchen',stock:c.PITCH?'Stock':'Deliveries & stock',gp:'GP & costing',creator:re.CREATOR_TITLE,orders:'Orders',rota:'Rota',kitchen:'Kitchen'}[He]);return(0,ve.jsxs)(B.SafeAreaView,{style:{flex:1,backgroundColor:N.colours.bg},edges:['top','bottom'],children:[(0,ve.jsxs)($.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:N.colours.border,gap:6},children:[(0,ve.jsx)($.default,{style:{position:'absolute',top:4,right:6,zIndex:5,flexDirection:'row',alignItems:'center'},children:(0,ve.jsx)(E.VoiceSlot,{size:44})}),(0,ve.jsx)($.default,{testID:"header-me-wrap",style:{alignItems:'flex-start',minHeight:44,justifyContent:'center',maxWidth:'70%'},children:(0,ve.jsx)($.default,{testID:"header-me",accessibilityLabel:`Signed in as ${n.replace(' (example)','')}, Head Chef${Q?`, ${Q}`:''}`,style:{borderWidth:1,borderColor:N.colours.gold,borderRadius:16,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%'},children:(0,ve.jsxs)(F.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,ve.jsx)(oe.StaffAvatar,{id:_.CHEF_ID,size:24,ring:!1}),(0,ve.jsxs)($.default,{style:{flexShrink:1},children:[(0,ve.jsxs)(F.T,{size:13,weight:"semibold",colour:N.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[n.replace(' (example)','')," \xb7 Head Chef"]}),Q?(0,ve.jsx)(F.Muted,{center:!1,size:10,numberOfLines:1,children:Q}):null]})]})})}),(0,ve.jsx)(O.VenueHeaderBlock,{rid:i,name:s.name,badge:"CHEF",place:"Head Chef app"}),(0,ve.jsx)(H.default,{accessibilityRole:"button",accessibilityLabel:"Open CoverCharge for Staff",onPress:()=>{const e=(0,ne.appUrl)('staff');e&&window.location.assign(e)},style:{alignSelf:'center',borderWidth:1,borderColor:N.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:3,minHeight:44,justifyContent:'center'},children:(0,ve.jsx)(F.T,{size:13,colour:N.colours.gold,children:"Staff app \u203a"})})]}),(0,ve.jsxs)(A.default,{ref:Ge,...qe.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:[(0,ve.jsx)(r.BackTitleRow,{back:!('home'===He&&!De||Je),onBack:Ye,title:et}),'home'===He?(0,ve.jsx)(Z.DayBar,{app:"chef",today:Me}):null,'home'===He&&Ke?(0,ve.jsx)(Z.DayView,{rid:i,day:Ke,today:Me,app:"chef"}):null,'home'===He?(0,ve.jsx)(ae.WhoBar,{}):null,Ve&&M?(0,ve.jsx)(h.MyTasksToday,{rid:i,staffId:M.id,name:M.name,onShift:(0,f.shiftNow)(M.id,L.getTime()).on}):null,Ve?(0,ve.jsx)(p.TodaysTipsCard,{rid:i,today:Me}):null,Ve?(0,ve.jsx)(p.TipsPotCard,{rid:i,today:Me}):null,Ve?(0,ve.jsx)(k.CoversToday,{rid:i,onPress:()=>Qe('kitchen','bookings')}):null,Ve?(0,ve.jsx)(y.LastFoodBanner,{rid:i,now:L}):null,Ve?(0,ve.jsx)(x.NextTableFreeCard,{rid:i,now:L}):null,Ve?(0,ve.jsx)(j.KitchenSignoffs,{rid:i,today:Me,by:n,app:"chef"}):null,Ve?(0,ve.jsxs)($.default,{style:{gap:4},children:[(0,ve.jsx)(j.PlattersBooked,{rid:i,date:Me,label:"Platters booked today"}),(0,ve.jsx)(j.PlattersBooked,{rid:i,date:We,label:"Platters booked tomorrow"})]}):null,Ve?(0,ve.jsx)(ye.ChefAssistantButton,{}):null,Ve?(0,ve.jsx)(Ie,{go:(e,t)=>{'stock'===e&&t&&Oe(t),'gp'===e&&t&&Ne(t),'orders'===e&&Fe(t),Qe(e,'kitchen'===e?t??null:null)}}):null,'stock'!==He||c.PITCH?null:(0,ve.jsx)(J.KitchenCosts,{rid:i,me:(M?.name??n).replace(' (example)',''),actor:{name:(M?.name??n).replace(' (example)',''),role:'head-chef'},initial:'deliveries'===Be?'deliveries':'take'===Be?'count':'deliveries'},`s-${Be}`),'gp'!==He||c.PITCH?null:(0,ve.jsx)(J.KitchenCosts,{rid:i,me:(M?.name??n).replace(' (example)',''),actor:{name:(M?.name??n).replace(' (example)',''),role:'head-chef'},initial:"dishgp"},`g-${Le}`),'stock'===He&&c.PITCH?(0,ve.jsx)(Y.StockScreen,{initial:Be},Be):null,'gp'===He&&c.PITCH?(0,ve.jsx)(W.GpScreen,{initial:Le},Le):null,'creator'===He?(0,ve.jsx)(re.DishCreator,{rid:i,canPublish:!1}):null,'orders'===He?(0,ve.jsx)(z.OrdersScreen,{focus:Ee},Ee??'all'):null,'rota'===He?(0,ve.jsx)(F.Card,{children:(0,ve.jsx)(U.KitchenRotaTab,{today:Me})}):null,'kitchen'!==He||Ze?null:(0,ve.jsxs)($.default,{style:{gap:10},children:[(0,ve.jsxs)($.default,{style:{borderRadius:14,borderWidth:1,borderColor:N.colours.border,backgroundColor:N.colours.surface,overflow:'hidden'},children:[Te.map(e=>(0,ve.jsx)(H.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:`${e.title}. ${e.sub}`,onPress:()=>Qe(e.id),style:({pressed:e})=>({padding:12,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,ve.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,ve.jsxs)($.default,{style:{flex:1},children:[(0,ve.jsx)(F.T,{weight:"medium",children:e.title}),(0,ve.jsx)(F.Muted,{children:e.sub})]}),(0,ve.jsx)(F.T,{colour:N.colours.muted,children:"\u203a"})]})},e.id)),Xe.map(e=>(0,ve.jsx)(H.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>Qe(He,e.id),style:({pressed:e})=>({padding:12,borderTopWidth:1,borderColor:N.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,ve.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,ve.jsxs)($.default,{style:{flex:1},children:[(0,ve.jsx)(F.T,{weight:"medium",children:e.title}),(0,ve.jsx)(F.Muted,{children:e.sub})]}),(0,ve.jsx)(F.T,{colour:N.colours.muted,children:"\u203a"})]})},e.id))]}),(0,ve.jsx)(F.Muted,{children:"Head Chef sees kitchen, stock, food costs and GP. Payroll, wages and the restaurant's billing stay in CoverCharge for Managers."}),(0,ve.jsxs)(F.Muted,{center:!0,children:["Head Chef app \xb7 ",d.APP_VERSION," \xb7 ",'live'===je.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),'myshift'===De&&q?(0,ve.jsxs)($.default,{style:{gap:10},testID:"chef-myshift",children:[(0,ve.jsx)(se.ClockInOut,{}),(0,ve.jsx)(ie.MyUpcomingShifts,{staffId:q,team:!0})]}):null,'mypay'===De?(0,ve.jsxs)($.default,{style:{gap:10},testID:"chef-mypay",children:[(0,ve.jsx)(ee.MyPeriods,{staffId:q}),(0,ve.jsx)(X.MyHoursPay,{staffId:q}),(0,ve.jsx)(te.MyTips,{staffId:q}),(0,ve.jsx)(F.Card,{children:(0,ve.jsx)(u.PhoneAlerts,{})})]}):null,'alerts'===De?(0,ve.jsx)($.default,{testID:"chef-alerts",children:(0,ve.jsx)(u.PhoneAlerts,{})}):null,'avatar'===De?(0,ve.jsx)(t.AvatarMaker,{meId:M?.id??_.CHEF_ID,me:n}):null,'reviews'===De?(0,ve.jsx)(fe.ReviewsSection,{rid:i,mode:"read",venueName:s.name}):null,'bookings'===De?(0,ve.jsx)(S.TodaysBookings,{rid:i,today:Me,by:n,app:"chef"}):null,'specials'===De?(0,ve.jsx)(ce.SpecialsEditor,{rid:i,me:n,app:"chef",now:L}):null,'forecast'===De?(0,ve.jsx)(K.ChefForecast,{openPrep:()=>Qe('kitchen','prep')}):null,'prep'===De?(0,ve.jsx)(V.PrepScreen,{}):null,'live'===De?(0,ve.jsx)(V.TeamScreen,{}):null,'waste'===De?(0,ve.jsx)(V.WasteScreen,{}):null,'recipes'===De?(0,ve.jsx)(ge.RecipeCards,{rid:i,actor:{name:n,role:'head-chef'},mode:"edit"}):null,'allergens'===De?(0,ve.jsx)(V.AllergenScreen,{openCards:()=>Qe('kitchen','recipes')}):null,'compliance'===De?(0,ve.jsx)(V.ComplianceScreen,{}):null,'takings'===De&&xe?(0,ve.jsx)(p.CashUpScreen,{rid:i,today:Me,canEdit:!1,chartsOnly:!0,who:{id:q,name:n.replace(' (example)','')}}):null,'board'===De?(0,ve.jsx)(ke.QuestionBoard,{rid:i,today:Me,manager:!1,by:""}):null,'teamtasks'===De?(0,ve.jsx)(h.KitchenTeamTasks,{rid:i,actor:M}):null,'orderlists'===De?(0,ve.jsx)(w.OrderListsScreen,{rid:i,today:Me,editor:!0,who:{id:q,name:n.replace(' (example)','')}}):null,'foodsafety'===De?(0,ve.jsx)(v.FoodSafetyCard,{children:(0,ve.jsx)(H.default,{accessibilityRole:"button",onPress:()=>Qe('kitchen','haccp'),children:(0,ve.jsx)(F.T,{colour:N.colours.gold,children:"Today\u2019s temperature log \u203a"})})}):null,'haccp'===De?(0,ve.jsx)(de.HaccpLog,{mode:"chef",me:n,meId:_.CHEF_ID,now:L}):null,'accidents'===De?(0,ve.jsx)(le.AccidentBook,{app:"chef",me:n,meId:_.CHEF_ID,now:L,seeAll:!1}):null]}),(0,ve.jsx)(we.BottomTabs,{tablist:!0,background:N.colours.surface,active:'orders'===He?'kitchen':He,onPress:e=>Qe(e),tabs:Ce.map(e=>({id:e.id,label:e.label,short:'creator'===e.id?'Creator':void 0,icon:e.icon,a11y:'rota'===e.id?'Rota, the kitchen rota':void 0}))}),(0,ve.jsx)(ye.ChefAssistantSheet,{go:(e,t)=>{'orders'===e?(Fe(t),Qe('orders')):'gp'===e?Qe('gp'):Qe('kitchen',e)}}),(0,ve.jsx)(ue.AlertHost,{variant:"chef",rid:i,skipTakeaway:!0}),(0,ve.jsx)(he.KitchenFlash,{rid:i,me:n})]})};var t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),o=_r(_d[3]),n=_r(_d[4]),l=_r(_d[5]),r=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),f=_r(_d[12]),b=_r(_d[13]),k=_r(_d[14]),y=_r(_d[15]),x=_r(_d[16]),j=_r(_d[17]),w=_r(_d[18]),v=_r(_d[19]),C=_r(_d[20]),T=_r(_d[21]),P=_r(_d[22]),S=_r(_d[23]),I=_r(_d[24]),R=e(_r(_d[25]));_r(_d[26]);var H=e(_r(_d[27])),A=e(_r(_d[28])),D=e(_r(_d[29])),$=e(_r(_d[30])),B=_r(_d[31]),O=_r(_d[32]),E=_r(_d[33]),F=_r(_d[34]),L=_r(_d[35]),N=_r(_d[36]),G=_r(_d[37]),M=_r(_d[38]),_=_r(_d[39]),W=_r(_d[40]),K=_r(_d[41]),V=_r(_d[42]),z=_r(_d[43]),U=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),Y=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),se=_r(_d[53]),ie=_r(_d[54]),ae=_r(_d[55]),oe=_r(_d[56]),ne=_r(_d[57]),le=_r(_d[58]),re=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),pe=_r(_d[64]),ge=_r(_d[65]),fe=_r(_d[66]),be=_r(_d[67]),ke=_r(_d[68]),me=_r(_d[69]),ye=_r(_d[70]),xe=_r(_d[71]),je=_r(_d[72]),we=_r(_d[73]),ve=_r(_d[74]);s.LIVE_HEAD_CHEF&&(0,i.requireRealData)();const Ce=[{id:'home',label:'Home',icon:'home'},{id:'stock',label:'Stock',icon:'box'},{id:'gp',label:'GP',icon:'forecast'},{id:'creator',label:re.CREATOR_TITLE,icon:'sparkle'},{id:'rota',label:'Rota',icon:'rota'},{id:'kitchen',label:'Kitchen',icon:'platter'}],Te=[{id:'orders',title:'Orders',sub:'Supplier order sheets, what is due today and cut-off times. Nothing is sent until you press Send'}],Pe=[{id:'alerts',title:'Turn on alerts',sub:'Get your reminders on this phone, even with the app closed'},{id:'avatar',title:'My avatar',sub:'Animals, Bar & kitchen, sea, sport, colours, patterns or your own photo'},{id:'reviews',title:'Reviews',sub:'Published reviews, newest first'},{id:'myshift',title:'My shifts & clock in',sub:'Clock in and out (checks you are at the venue), breaks, and your shifts on the rota'},{id:'mypay',title:'My pay & tips',sub:'Your hours, tips share, tip goal, paydays and payslip info. Only you see this'},{id:'takings',title:'Takings & tips graphs',sub:'Daily cash ups, weekly sales, this week vs last, categories and the Tips pot (view only)'},{id:'bookings',title:'Today\u2019s bookings',sub:'Covers, allergens to sign off, platters and other reservations, dogs, access and vegan/vegetarian'},{id:'recipes',title:'Recipe cards',sub:'Plating photo, ingredients, method, allergens, section and price; you sign each card off before it goes live'},{id:'specials',title:'Specials board',sub:'Photo of the chalkboard or typed specials with allergens; shown in the customer app'},{id:'board',title:'Question board',sub:'Ask the team anything anonymously, and vote'},{id:'teamtasks',title:'Kitchen team tasks',sub:'Daily tasks for your chefs, commis and KPs'},{id:'orderlists',title:'Order lists',sub:'Alsons drinks, Cash and carry: add items, tick on the day, finish and carry over'},{id:'foodsafety',title:'Food safety (CookSafe)',sub:'Based on CookSafe (Food Standards Scotland). Full logs coming in the next update'},{id:'haccp',title:'Food safety log (HACCP)',sub:'Temperatures, cleaning and allergen checks; voice entry; limits; EHO export'},{id:'accidents',title:'Accident book',sub:'Accidents and near misses; you see your own entries'},{id:'forecast',title:'Forecast',sub:'Covers per day for the week ahead, and prep from the forecast'},{id:'prep',title:'Prep list',sub:'From the forecast and bookings, tick off as you go'},{id:'live',title:'Live tickets, sold out, team & chat',sub:'Orders, readiness alerts, sold out, who\u2019s on, rota, team chat and private messages'},{id:'waste',title:'Waste log',sub:'Item, quantity, reason and cost; weekly total and % of sales'},{id:'allergens',title:'Allergens',sub:'14-allergen matrix from the recipe cards, costing cross-check and audit log'},{id:'compliance',title:'Kitchen compliance',sub:'Fridge, freezer, cooking and cooling temps; cleaning; daily checks'}],Se={stock:{tab:'stock',stock:'levels'},'stock-take':{tab:'stock',stock:'take'},deliveries:{tab:'stock',stock:'deliveries'},gp:{tab:'gp',gp:'dishes'},'price-changes':{tab:'gp',gp:'changes'},'gp-week':{tab:'gp',gp:'week'},'menu-engineering':{tab:'gp',gp:'engineering'},orders:{tab:'orders'},rota:{tab:'rota'},'kitchen-rota':{tab:'rota'},forecast:{tab:'kitchen',k:'forecast'},prep:{tab:'kitchen',k:'prep'},live:{tab:'kitchen',k:'live'},waste:{tab:'kitchen',k:'waste'},recipes:{tab:'kitchen',k:'recipes'},'recipe-cards':{tab:'kitchen',k:'recipes'},allergens:{tab:'kitchen',k:'allergens'},compliance:{tab:'kitchen',k:'compliance'},haccp:{tab:'kitchen',k:'haccp'},specials:{tab:'kitchen',k:'specials'},accidents:{tab:'kitchen',k:'accidents'},'new-dish':{tab:'creator'}};function Ie({go:e}){const{k:t,c:s,menu:i,now:o,rid:l,me:r}=(0,_.useChef)(3e4),d=(0,q.useSheetReminders)(),u=(0,_.useWeek)(),{covers:h,label:p,enough:f,booked:b}=(0,_.useForecast)(),k=(0,z.useSuggestions)(),y=t.ingredients.filter(e=>e.onHand<=0||(0,_.isLow)(e.onHand,e.par)),x=k.filter(e=>e.ordersToday&&!e.placedToday),j=(0,M.priceImpacts)(i,t.recipes,t.ingredients,t.targetGp).filter(e=>e.dropped.length),w=t.deliveries.filter(e=>'expected'===e.status),v=!t.recipes.length||!t.ingredients.length,C=v?[]:s.filter(e=>e.below),T=(0,n.useLiveState)(),P=(0,me.useRecipeCards)(l).filter(e=>!e.signOff),S=(0,J.useKitchenSummary)(l),[R,A]=(0,I.useState)(!1);return(0,ve.jsxs)($.default,{style:{gap:12},testID:"chef-dashboard",children:[(0,ve.jsx)(de.MissedBanner,{mode:"chef",now:o,onPress:()=>e('kitchen','haccp')}),d.map(t=>(0,ve.jsx)(H.default,{accessibilityRole:"button",onPress:()=>e('orders',t.supplierId),children:(0,ve.jsxs)(F.Banner,{kind:'red'===t.tone?'danger':'warn',title:`\u23f0 ${t.text}`,children:["Tap to open the ",t.name," order sheet. Nothing is sent until you press Send."]})},t.supplierId)),P.length?(0,ve.jsx)(H.default,{testID:"cards-awaiting",accessibilityRole:"button",onPress:()=>e('kitchen','recipes'),children:(0,ve.jsxs)(F.Banner,{kind:"warn",title:`${P.length} recipe card${1===P.length?'':'s'} awaiting your sign-off`,children:[P.slice(0,4).map(e=>e.dish).join(', '),". Guests see \"awaiting allergen sign-off\" and cannot order these until you sign them off."]})}):null,(0,ve.jsx)(Q.ShellfishTile,{rid:l,by:r,app:"chef",onOrder:()=>e('orders','os-kittyfisher')}),(0,ve.jsx)(F.Button,{testID:"chef-add-soldout",label:"Add sold out",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>A(!0),style:{minHeight:56}}),(0,ve.jsxs)(F.Row,{wrap:!0,gap:10,children:[c.PITCH?null:(0,ve.jsx)(_.Tile,{testID:"tile-gp",label:"Dishes under target GP",value:S.costed?`${S.below} of ${S.costed}`:'Nothing yet',sub:S.costed?`Average ${(0,_.pct1)(S.avgGp??0)} \xb7 target ${S.target}%`:'Record a delivery, then cost your recipe cards',tone:S.costed?S.below?'amber':'ok':void 0,onPress:()=>e('gp','dishes')}),c.PITCH?v?(0,ve.jsx)(_.Tile,{testID:"tile-gp",label:"GP this week vs target",value:"Nothing yet",sub:"Add ingredients and recipe costs to see GP",onPress:()=>e('gp','week')}):(0,ve.jsx)(_.Tile,{testID:"tile-gp",label:"GP this week vs target",value:(0,_.pct1)(u.theo),sub:`Target ${t.targetGp}% \xb7 actual ${(0,_.pct1)(u.actual)}`,tone:u.theoe('gp','week')}):null,c.PITCH?null:(0,ve.jsx)(_.Tile,{testID:"tile-stock",label:"Stock value",value:null!=S.stockValue?(0,L.gbp)(S.stockValue):'Nothing yet',sub:S.lastCount?`At cost, counted ${S.lastCount}`:'No stock counted yet',onPress:()=>e('stock','take')}),c.PITCH?(0,ve.jsx)(_.Tile,{testID:"tile-stock",label:"Stock value",value:t.ingredients.length?(0,L.gbp)((0,_.stockValue)(t.ingredients)):'Nothing yet',sub:t.ingredients.length?'At cost':'No stock counted yet',onPress:()=>e('stock','levels')}):null,(0,ve.jsx)(_.Tile,{label:"Items low or out",value:t.ingredients.length?`${y.length}`:'Nothing yet',sub:t.ingredients.length?y.slice(0,3).map(e=>e.name).join(', '):'No stock counted yet',tone:y.some(e=>e.onHand<=0)?'red':y.length?'amber':'ok',onPress:()=>e('stock','levels')}),(0,ve.jsx)(_.Tile,{label:"Waste this week",value:t.waste.length?(0,L.gbp)(u.wasteWeek):'Nothing yet',sub:u.sales?`${(0,_.pct1)(u.wasteWeek/u.sales*100)} of food sales`:'',onPress:()=>e('kitchen','waste')}),f?(0,ve.jsx)(_.Tile,{testID:"tile-forecast",label:"Covers forecast today",value:`${h}`,sub:p,onPress:()=>e('kitchen','forecast')}):(0,ve.jsx)(_.Tile,{testID:"tile-booked",label:"Booked so far today",value:'ready'===T?`${b}`:'connecting'===T?'Connecting\u2026':'Not connected',sub:"Not enough history for a forecast yet",onPress:()=>e('kitchen','bookings')}),(0,ve.jsx)(_.Tile,{label:"Orders due today",value:`${x.length}`,sub:x.map(e=>`${e.s.name} by ${e.s.cutoff}`).join(' \xb7 ')||'None',tone:x.some(e=>e.cutPassed)?'red':x.length?'amber':'ok',onPress:()=>e('orders')})]}),j.map(e=>(0,ve.jsxs)(F.Banner,{kind:"danger",title:`${e.ing.name} ${e.pct>0?'+':''}${e.pct.toFixed(0)}%: ${e.dropped.length} dish${1===e.dropped.length?'':'es'} drop below target`,children:[e.dropped.map(e=>e.item.name).join(', '),". Open GP \u203a Price changes."]},e.ing.id)),w.length?(0,ve.jsx)(H.default,{accessibilityRole:"button",onPress:()=>e('stock','deliveries'),children:(0,ve.jsx)(F.Banner,{kind:"info",title:`${w.length} deliver${1===w.length?'y':'ies'} to check in today`,children:"Count in against the order, flag shorts and price changes."})}):null,C.length?(0,ve.jsx)(H.default,{accessibilityRole:"button",onPress:()=>e('gp','dishes'),children:(0,ve.jsxs)(F.Banner,{kind:"warn",title:`${C.length} dishes below ${t.targetGp}% GP`,children:[C.slice(0,4).map(e=>e.item.name).join(', '),C.length>4?'\u2026':'']})}):null,(0,ve.jsx)(F.Row,{wrap:!0,gap:8,children:[['Recipe cards','recipes'],['Food safety log','haccp'],['Specials board','specials'],[re.CREATOR_TITLE,'creator'],['Forecast','forecast'],['Prep list','prep'],['Live tickets & sold out','live'],['Allergens','allergens'],['Accident book','accidents']].map(([t,s])=>(0,ve.jsx)(H.default,{accessibilityRole:"button",accessibilityLabel:t,onPress:()=>'creator'===s?e('creator'):e('kitchen',s),style:{flexGrow:1,flexBasis:140,padding:12,borderRadius:12,borderWidth:1.5,borderColor:N.colours.gold,backgroundColor:N.colours.surface},children:(0,ve.jsxs)(F.T,{weight:"semibold",children:[t," \u203a"]})},s))}),(0,ve.jsx)(F.Badge,{kind:"neutral",label:"Nothing is ordered or sent from here"}),(0,ve.jsx)(xe.SoldOutSheet,{visible:R,onClose:()=>A(!1),rid:l,by:r,hideLinks:!0,testID:"chef-soldout-sheet"})]})}},792,[793,978,884,979,986,1051,1052,1015,2,1053,1057,1058,1090,858,1095,1099,1100,1103,1104,1107,1108,1110,1111,1112,34,373,236,402,295,426,102,36,873,1137,794,867,821,1084,1139,1145,1148,1149,1152,1167,1165,1168,1169,1171,1172,1173,1176,1179,1187,1188,1192,1193,925,1003,1194,1158,1195,1202,1203,1212,1205,1156,1214,1218,1189,874,1219,1154,987,1220,25]); __d(function(_g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.styliseOnDevice=b,_e.pickPhoto=p,_e.AvatarMaker=function({meId:e,me:u}){const g=(0,i.useAvatars)(t=>t.photos[e]),[f,v]=(0,t.useState)(null),[y,x]=(0,t.useState)(null),[j,w]=(0,t.useState)(!1),[I,P]=(0,t.useState)(!1),[k,M]=(0,t.useState)('');(0,t.useEffect)(()=>()=>{f&&URL.revokeObjectURL(f)},[f]);const R='undefined'!=typeof document,S=async e=>{M('');const t=await p(e);if(t){P(!0),w(!1);try{const e=await b(t);f&&URL.revokeObjectURL(f),v(URL.createObjectURL(t)),x(e)}catch{M("That photo couldn't be opened. Try a different one (JPEG or PNG).")}finally{P(!1)}}},U=()=>{f&&URL.revokeObjectURL(f),v(null),x(null),w(!1)},B=u.replace(' (example)','');return(0,h.jsxs)(o.default,{style:{gap:12},testID:"avatar-maker",children:[(0,h.jsxs)(d.Box,{children:[(0,h.jsxs)(s.Row,{gap:14,children:[(0,h.jsx)(l.StaffAvatar,{id:e,size:88}),(0,h.jsxs)(o.default,{style:{flex:1,gap:4},children:[(0,h.jsx)(s.T,{weight:"semibold",size:17,children:B}),(0,h.jsxs)(s.Muted,{children:[g?`Your chosen avatar (saved ${new Date(g.at).toLocaleDateString('en-GB')}).`:'Your original crew avatar.'," It shows on rotas, chat, clock-in and sign-offs."]})]})]}),g?(0,h.jsx)(s.Button,{small:!0,kind:"secondary",label:"Back to my default avatar",testID:"avatar-own-reset",onPress:()=>{i.useAvatars.getState().reset(e,{id:e,role:'staff',name:B}),M('Back to your default avatar.')}}):null]}),(0,h.jsx)(d.Box,{children:(0,h.jsx)(n.AvatarOptions,{value:g?.dataUrl,onSelect:t=>{const a=i.useAvatars.getState().setOwn(e,e,t.dataUrl,B);M(a?`${t.name} is your avatar now.`:'Could not save your avatar.')}})}),(0,h.jsxs)(d.Box,{testID:"avatar-create",children:[(0,h.jsx)(s.T,{weight:"semibold",size:17,children:"Create my avatar from a photo"}),(0,h.jsx)(s.Muted,{children:"Upload a photo or take a selfie. Your phone turns it into a retro space-age avatar. The photo never leaves this device and isn't saved: only the finished avatar is kept."}),R?y?(0,h.jsxs)(o.default,{style:{gap:10},testID:"avatar-preview",children:[(0,h.jsxs)(s.Row,{gap:12,style:{justifyContent:'center'},children:[(0,h.jsxs)(o.default,{style:{alignItems:'center',gap:4},children:[f?(0,h.jsx)(a.default,{source:{uri:f},style:{width:96,height:96,borderRadius:12},accessibilityLabel:"Your photo"}):null,(0,h.jsx)(s.Muted,{children:"Your photo"})]}),(0,h.jsx)(s.T,{size:22,colour:c.colours.gold,children:"\u2192"}),(0,h.jsxs)(o.default,{style:{alignItems:'center',gap:4},children:[(0,h.jsx)(a.default,{source:{uri:y},style:{width:120,height:120,borderRadius:60,borderWidth:3,borderColor:c.colours.gold},accessibilityLabel:"Your new avatar preview",testID:"avatar-result"}),(0,h.jsx)(s.Muted,{children:"Your avatar"})]})]}),(0,h.jsxs)(r.default,{accessibilityRole:"checkbox",accessibilityState:{checked:j},accessibilityLabel:"I agree to use this avatar",testID:"avatar-consent",onPress:()=>w(!j),style:{flexDirection:'row',gap:10,alignItems:'flex-start',padding:10,borderRadius:12,borderWidth:1,borderColor:j?c.colours.gold:c.colours.border},children:[(0,h.jsx)(o.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:c.colours.gold,backgroundColor:j?c.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:j?(0,h.jsx)(s.T,{size:15,weight:"bold",colour:"#111",children:"\u2713"}):null}),(0,h.jsx)(s.T,{size:14,style:{flex:1},children:"I\u2019m happy for this avatar, made from my photo, to be shown to my team in CoverCharge. Only the finished avatar is shared; my photo isn\u2019t uploaded or kept, and a manager can reset my avatar."})]}),(0,h.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,h.jsx)(s.Button,{label:"Use as my avatar",testID:"avatar-save",disabled:!j,onPress:()=>{const t=i.useAvatars.getState().setOwn(e,e,y,B);M(t?'Saved: this is your avatar now.':"Couldn't save the avatar."),t&&U()}}),(0,h.jsx)(s.Button,{kind:"secondary",label:"Try another photo",onPress:U})]})]}):(0,h.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,h.jsx)(s.Button,{label:I?'Making your avatar\u2026':'Upload a photo',testID:"avatar-upload",disabled:I,onPress:()=>S(!1)}),(0,h.jsx)(s.Button,{kind:"secondary",label:"Take a selfie",testID:"avatar-selfie",disabled:I,onPress:()=>S(!0)})]}):(0,h.jsx)(s.Muted,{children:"Available in the web app."}),k?(0,h.jsx)(o.default,{testID:"avatar-msg",children:(0,h.jsx)(s.T,{size:14,colour:c.colours.ok,children:k})}):null]})]})};var t=_r(_d[0]),a=e(_r(_d[1]));_r(_d[2]);var r=e(_r(_d[3])),o=e(_r(_d[4])),s=_r(_d[5]),l=_r(_d[6]),n=_r(_d[7]),i=_r(_d[8]),c=_r(_d[9]),d=_r(_d[10]),h=_r(_d[11]);const u=['#1B1B1B','#4A3F35','#B89A72','#E9B949','#FFF4E0'].map(e=>[1,3,5].map(t=>parseInt(e.slice(t,t+2),16))),g=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5];function f(e){return new Promise((t,a)=>{const r=URL.createObjectURL(e),o=new window.Image;o.onload=()=>t({img:o,url:r}),o.onerror=()=>{URL.revokeObjectURL(r),a(new Error('bad image'))},o.src=r})}function v(e,t,a,r){e.beginPath(),e.moveTo(t,a-r),e.quadraticCurveTo(t+.18*r,a-.18*r,t+r,a),e.quadraticCurveTo(t+.18*r,a+.18*r,t,a+r),e.quadraticCurveTo(t-.18*r,a+.18*r,t-r,a),e.quadraticCurveTo(t-.18*r,a-.18*r,t,a-r),e.fill()}async function b(e){const{img:t,url:a}=await f(e);try{const e=112,a=256,r=document.createElement('canvas');r.width=e,r.height=e;const o=r.getContext('2d'),s=Math.min(t.width,t.height);o.drawImage(t,(t.width-s)/2,Math.max(0,(t.height-s)/2-.04*s),s,s,0,0,e,e);const l=o.getImageData(0,0,e,e),n=l.data,i=[];for(let e=0;ee-t),d=c[Math.floor(.04*c.length)],h=c[Math.floor(.96*c.length)]||255;for(let t=0;t{const a=document.createElement('input');a.type='file',a.accept='image/*',e&&a.setAttribute('capture','user'),a.onchange=()=>t(a.files?.[0]??null),a.click()})}},793,[34,336,236,402,102,794,925,929,926,821,930,25]); __d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"webLine",{enumerable:!0,get:function(){return W.webLine}}),_e.T=D,Object.defineProperty(_e,"H1",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"H2",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"Muted",{enumerable:!0,get:function(){return z}}),_e.BrandBar=A,_e.Screen=function({children:e,title:t,subtitle:r,back:o=!0,right:l,maxWidth:n=640,footer:s,scroll:c=!0}){const u=(0,B.jsxs)(x.default,{style:{width:'100%',maxWidth:n,alignSelf:'center',padding:16,gap:12,alignItems:'stretch'},children:[e,'customer'===S.APP_VARIANT?(0,B.jsx)(H,{}):null]});return(0,B.jsxs)(j.SafeAreaView,{style:{flex:1,backgroundColor:C.colours.bg},edges:['top','left','right'],children:[(0,B.jsx)(x.default,{style:{width:'100%',maxWidth:n,alignSelf:'center'},children:(0,B.jsx)(A,{title:t,subtitle:r,back:o,right:l})}),c?(0,B.jsx)(b.default,{contentContainerStyle:{paddingBottom:40},children:u}):(0,B.jsx)(x.default,{style:{flex:1},children:u}),s?(0,B.jsx)(x.default,{style:N.footer,children:(0,B.jsx)(x.default,{style:{width:'100%',maxWidth:n,alignSelf:'center'},children:s})}):null]})},_e.Button=v,_e.Card=F,_e.Badge=function({label:e,kind:t="neutral"}){const r={neutral:[C.colours.surface2,C.colours.muted,C.colours.border],gold:[C.colours.goldTint,C.colours.goldLight,C.colours.gold],red:[C.colours.redBg,'#FFD9D4',C.colours.red],amber:[C.colours.amberBg,'#FFE2A8',C.colours.amber],ok:[C.colours.okBg,C.colours.goldLight,C.colours.ok],blue:[C.colours.blueBg,C.colours.goldLight,C.colours.blue]}[t];return(0,B.jsx)(x.default,{style:[N.badge,{backgroundColor:r[0],borderColor:r[2],maxWidth:'100%',alignSelf:L?'center':'flex-start'}],children:(0,B.jsx)(D,{size:13,weight:"medium",colour:r[1],style:{flexShrink:1},children:e})})},_e.Banner=E,Object.defineProperty(_e,"ExampleAllergenNotice",{enumerable:!0,get:function(){return V}}),Object.defineProperty(_e,"DemoPaymentNotice",{enumerable:!0,get:function(){return $}}),_e.Row=O,Object.defineProperty(_e,"Divider",{enumerable:!0,get:function(){return _}}),_e.Field=function({label:e,...t}){return(0,B.jsxs)(x.default,{style:{gap:4,alignSelf:'stretch',width:'100%',minWidth:0,maxWidth:'100%'},children:[(0,B.jsx)(D,{size:C.font.small,weight:"medium",colour:C.colours.muted,center:!0,children:e}),(0,B.jsx)(o.TextInput,{accessibilityLabel:e,placeholderTextColor:"#7D776C",...t,style:[N.input,t.multiline&&{minHeight:70,textAlignVertical:'top'},t.style]})]})},_e.Chip=function({label:e,selected:t,onPress:r,disabled:o,sub:l,testID:n,accessibilityLabel:s}){return(0,B.jsxs)(h.default,{testID:n,accessibilityRole:"button",accessibilityState:{selected:!!t,disabled:!!o},accessibilityLabel:`${s??e}${!s&&l?`, ${l}`:''}${t?', selected':''}`,'aria-pressed':!!t,disabled:o,onPress:r,style:[N.chip,t&&{backgroundColor:C.colours.gold,borderColor:C.colours.gold},o&&{opacity:.35}],children:[(0,B.jsx)(D,{size:C.font.small,weight:"medium",colour:t?C.colours.onGold:C.colours.text,center:!0,children:e.trim()}),l?(0,B.jsx)(D,{size:12,colour:t?C.colours.onGold:C.colours.muted,center:!0,children:l}):null]})},_e.Toggle=function({value:e,onChange:t,label:r,testID:o,disabled:l,a11y:n}){return(0,B.jsxs)(O,{style:{justifyContent:'space-between',flexShrink:1,minWidth:0},children:[(0,B.jsx)(D,{style:{flex:1,flexShrink:1},children:r}),(0,B.jsx)(y.default,{testID:o,disabled:l,accessibilityLabel:n??r,value:e,onValueChange:t,trackColor:{true:C.colours.gold,false:'#444'},thumbColor:e?'#FFF6E0':'#BBB',activeThumbColor:'#FFF6E0',activeTrackColor:C.colours.gold})]})},_e.Stepper=function({value:e,onChange:t,min:r=1,max:o=20,label:l,step:n=1,format:s,testID:c}){const u=s?s(e):String(e),b=e=>Math.round(e/n)*n;return(0,B.jsxs)(O,{gap:10,children:[(0,B.jsx)(h.default,{testID:c?`${c}-down`:void 0,accessibilityRole:"button",accessibilityLabel:`Decrease ${l??''}`,disabled:e<=r,onPress:()=>t(Math.max(r,b(e-n))),style:[N.stepBtn,e<=r?{opacity:.4}:null],children:(0,B.jsx)(D,{size:20,colour:C.colours.gold,children:"\u2212"})}),(0,B.jsx)(x.default,{testID:c?`${c}-value`:void 0,accessibilityLabel:l?`${l}: ${u}`:u,children:(0,B.jsx)(D,{weight:"semibold",size:C.font.large,style:{minWidth:s?64:28,textAlign:'center'},children:u})}),(0,B.jsx)(h.default,{testID:c?`${c}-up`:void 0,accessibilityRole:"button",accessibilityLabel:`Increase ${l??''}`,disabled:e>=o,onPress:()=>t(Math.min(o,b(e+n))),style:[N.stepBtn,e>=o?{opacity:.4}:null],children:(0,B.jsx)(D,{size:20,colour:C.colours.gold,children:"+"})})]})},_e.Sheet=function({visible:e,onClose:o,title:l,children:n,maxWidth:c,testID:f,footer:y}){const{height:w}=(0,p.default)(),W=s.default.useContext(j.SafeAreaInsetsContext)??{top:0,bottom:0,left:0,right:0},k=(0,r.useTyping)(),S=(0,r.useVisibleArea)(),I=k&&S&&S.height({minHeight:44,minWidth:72,paddingHorizontal:14,borderRadius:22,borderWidth:1.5,borderColor:C.colours.gold,backgroundColor:e?'rgba(201,162,77,0.22)':'rgba(201,162,77,0.10)',alignItems:'center',justifyContent:'center'}),children:(0,B.jsx)(D,{size:15,weight:"semibold",colour:C.colours.goldLight,center:!0,children:"Done"})}):null,R?(0,B.jsx)(h.default,{accessibilityRole:"button",accessibilityLabel:"Close",onPress:o,hitSlop:8,testID:"sheet-close",style:{minWidth:72,minHeight:48,alignItems:'center',justifyContent:'center',marginRight:-8},children:(0,B.jsx)(D,{size:18,colour:C.colours.text,children:"Close"})}):(0,B.jsx)(t.GoldClose,{onPress:o,testID:"sheet-close",style:{marginRight:-6,minWidth:48,minHeight:48}})]}),(0,B.jsx)(b.default,{style:{flexShrink:1},contentContainerStyle:{gap:12,paddingTop:2,paddingBottom:4},children:n}),y?(0,B.jsx)(x.default,{style:{borderTopWidth:1,borderTopColor:C.colours.border,paddingTop:10,marginTop:8},testID:f?`${f}-footer`:void 0,children:y}):null]})})})},_e.SectionTitle=function({children:e}){return(0,B.jsx)(D,{weight:"semibold",size:12,colour:C.colours.goldMuted,center:!0,style:{textTransform:'uppercase',letterSpacing:1.6,marginTop:8},children:e})},Object.defineProperty(_e,"styles",{enumerable:!0,get:function(){return N}}),_r(d[0]);var t=_r(d[1]),r=_r(d[2]),o=_r(d[3]),l=_r(d[4]),n=_r(d[5]),s=e(_r(d[6])),c=e(_r(d[7])),u=e(_r(d[8]));_r(d[9]);var h=e(_r(d[10])),b=e(_r(d[11])),f=e(_r(d[12])),y=e(_r(d[13])),x=e(_r(d[14])),p=e(_r(d[15])),j=_r(d[16]),C=_r(d[17]),w=_r(d[18]),W=_r(d[19]),k=_r(d[20]),S=_r(d[21]),I=_r(d[22]),B=_r(d[23]);const R=['kirkton','abbotsford'].includes(k.VENUE_RID),L='display'!==S.APP_VARIANT;function D({children:e,style:t,size:r=C.font.body,weight:l="regular",colour:n=C.colours.text,numberOfLines:s,center:c,testID:u,accessibilityRole:h,accessibilityLabel:b}){const y='string'==typeof e&&/^(https?:\/\/|www\.)\S+$/.test(e.trim()),x=y?{minWidth:0,maxWidth:'100%',overflowWrap:'anywhere',wordBreak:'break-all',alignSelf:'stretch'}:void 0,p=f.default.flatten(t)||{},j=1===p.flex||1===p.flexGrow||'number'==typeof p.width||'left'===p.textAlign,k=c??(L&&('semibold'===l||'bold'===l)&&!j);return(0,B.jsx)(o.Text,{testID:u??(y?'cc-url':void 0),...k?{dataSet:{centre:'heading'}}:{},accessibilityRole:h,accessibilityLabel:b,numberOfLines:s,style:[{minWidth:0,fontFamily:C.fonts[l],fontSize:r,color:n,lineHeight:(0,w.lineFor)(r)},k&&{textAlign:'center',alignSelf:'center',maxWidth:'100%'},t,x,(0,W.webLine)(t,r),k&&'left'!==p.textAlign?{textAlign:'center'}:null],children:e})}const P=e=>(0,B.jsx)(D,{size:C.font.title,weight:"semibold",center:!0,...e}),T=e=>(0,B.jsx)(D,{size:C.font.large,weight:"semibold",center:!0,...e}),z=e=>(0,B.jsx)(D,{colour:C.colours.muted,size:C.font.small,...e,center:e.center??L});function A({title:e,back:t=!0,right:r,subtitle:o}){return(0,B.jsxs)(x.default,{style:N.brandBar,children:[(0,B.jsxs)(x.default,{style:N.row,children:[(0,B.jsx)(x.default,{style:N.brandSide,children:t?(0,B.jsx)(h.default,{accessibilityRole:"button",accessibilityLabel:"Back",onPress:()=>l.router.canGoBack()?l.router.back():l.router.replace(S.ENTRY[S.APP_VARIANT]),style:N.backBtn,hitSlop:10,children:(0,B.jsx)(D,{size:18,weight:"semibold",colour:C.colours.gold,children:"\u2039 Back"})}):null}),(0,B.jsx)(h.default,{onPress:()=>l.router.push(S.ENTRY[S.APP_VARIANT]),accessibilityLabel:"Home",style:N.brandCenter,children:(0,B.jsx)(I.RestaurantBrand,{size:I.HEADER_LOGO})}),(0,B.jsx)(x.default,{style:[N.brandSide,{alignItems:'flex-end'}],children:r?(0,B.jsx)(x.default,{style:{flexShrink:0},children:r}):null})]}),e?(0,B.jsx)(P,{style:{marginTop:10,alignSelf:'stretch'},children:e}):null,o?(0,B.jsx)(z,{center:!0,style:{alignSelf:'stretch'},children:o}):null]})}function H(){const e=(0,l.useLocalSearchParams)().rid??k.VENUE_RID,t=(0,n.useStore)(t=>t.restaurants.find(t=>t.id===e)?.contactEmail);return t?(0,B.jsx)(h.default,{accessibilityRole:"link",accessibilityLabel:`Email ${t}`,onPress:()=>{c.default.openURL(`mailto:${t}`)},style:{minHeight:44,justifyContent:'center',alignItems:'center',maxWidth:'100%'},children:(0,B.jsx)(D,{center:!0,size:14,colour:C.colours.gold,children:t})}):null}function v({label:e,sub:t,onPress:r,kind:o="primary",disabled:l,small:n,style:s,accessibilityLabel:c,accessibilityHint:u,testID:b}){const f={primary:C.colours.gold,secondary:C.colours.tile,danger:C.colours.redSolid,ghost:'transparent',success:C.colours.accentBg}[o],y={primary:C.colours.onGold,secondary:C.colours.text,danger:'#FFFFFF',ghost:C.colours.gold,success:C.colours.goldLight}[o],x={primary:'transparent',secondary:C.colours.hairline,danger:'transparent',ghost:'transparent',success:C.colours.accentBorder}[o];return(0,B.jsxs)(h.default,{testID:b,accessibilityRole:"button",accessibilityLabel:c??e,accessibilityHint:u,accessibilityState:{disabled:!!l},disabled:l,onPress:r,style:({pressed:e})=>[N.btn,{backgroundColor:e&&'secondary'===o?C.colours.tilePressed:f,borderColor:x,opacity:l?.4:e?.85:1},n&&{paddingVertical:8,paddingHorizontal:14,minHeight:w.control.min,minWidth:44},s],children:[(0,B.jsx)(D,{weight:"semibold",size:n?C.font.small:C.font.body,colour:y,center:!0,children:e.trim()}),t?(0,B.jsx)(D,{size:n?C.font.small-2:C.font.small,colour:y,center:!0,testID:b?`${b}-sub`:void 0,children:t}):null]})}function F({children:e,style:t,onPress:r,highlight:o}){const l=o===C.colours.gold||o===C.colours.accentBorder,n=(0,B.jsx)(x.default,{testID:"cc-card",style:[N.card,{alignItems:'stretch'},o?{borderColor:l?C.colours.accentBorder:o,borderWidth:l?1:2}:null,t],children:e});return r?(0,B.jsx)(h.default,{accessibilityRole:"button",onPress:r,style:({pressed:e})=>({opacity:e?.85:1}),children:n}):n}function E({kind:e="info",title:t,children:r}){const o={info:[C.colours.surface,C.colours.gold,C.colours.text],warn:[C.colours.amberBg,C.colours.amber,'#FFE2A8'],danger:[C.colours.redBg,C.colours.red,'#FFE3DF'],success:[C.colours.okBg,C.colours.ok,C.colours.goldLight],example:[C.colours.amberBg,C.colours.amber,'#FFE2A8'],demo:[C.colours.goldTint,C.colours.gold,C.colours.goldLight]}[e];return(0,B.jsxs)(x.default,{accessibilityRole:"summary",style:[N.banner,{backgroundColor:o[0],borderLeftColor:o[1]}],children:[t?(0,B.jsx)(D,{weight:"semibold",colour:o[2],center:!0,children:t}):null,s.default.Children.toArray(r).every(e=>'string'==typeof e||'number'==typeof e)?(0,B.jsx)(D,{size:C.font.small,colour:o[2],center:!0,children:r}):r]})}z.statusLine=!0,v.centreRow=!0;const V=()=>(0,B.jsx)(E,{kind:"example",title:"Allergens awaiting kitchen verification",children:"This allergen information has not been verified by the kitchen. Head chef sign-off is required. Always speak to staff about allergies."}),$=()=>(0,B.jsx)(E,{kind:"demo",title:"Card payments: not set up yet",children:"No card is charged and no payment provider is contacted."});function O({children:e,style:t,gap:r=8,wrap:o}){const l=s.default.Children.map(e,e=>{if(!s.default.isValidElement(e))return e;const t=e,r=f.default.flatten(t.props.style)||{};return 1!==r.flex&&1!==r.flexGrow?e:s.default.cloneElement(t,{style:[t.props.style,{minWidth:Math.max(t.type===F?240:180,'number'==typeof r.minWidth?r.minWidth:0)}]})}),n=f.default.flatten(t)||{},c=s.default.Children.toArray(l).filter(s.default.isValidElement),u=e=>e.type;if(L&&'space-between'===n.justifyContent&&1!==n.flex&&2===c.length&&c.some(e=>u(e).statusLine))return(0,B.jsx)(x.default,{dataSet:{centre:'status'},style:{alignItems:'center',alignSelf:'stretch',width:'100%',gap:r},children:c});const h=L&&c.length>=2&&c.every(e=>u(e).centreRow)&&'flex-start'!==n.justifyContent&&'space-between'!==n.justifyContent;return(0,B.jsx)(x.default,{...h?{dataSet:{centre:'buttons'}}:{},style:[N.row,{gap:r},h&&{justifyContent:'center',flexWrap:'wrap'},o&&{flexWrap:'wrap',justifyContent:'center'},t],children:l})}const _=()=>(0,B.jsx)(x.default,{style:{height:1,backgroundColor:C.colours.border,marginVertical:4}});const N=f.default.create({row:{flexDirection:'row',alignItems:'center',flexWrap:'wrap',minWidth:0,maxWidth:'100%'},brandBar:{paddingHorizontal:16,paddingTop:8,paddingBottom:8,borderBottomWidth:1,borderBottomColor:C.colours.border},brandSide:{width:96,minHeight:48,justifyContent:'center'},brandCenter:{flex:1,alignItems:'center',justifyContent:'center',minHeight:48},backBtn:{paddingRight:12,minHeight:48,minWidth:88,justifyContent:'center'},btn:{minWidth:0,maxWidth:'100%',flexShrink:1,borderRadius:w.radii.button,paddingVertical:12,paddingHorizontal:18,borderWidth:1,alignItems:'center',justifyContent:'center',minHeight:w.control.min,alignSelf:'stretch'},card:{minWidth:0,maxWidth:'100%',backgroundColor:C.colours.surface,borderRadius:C.radius.l,padding:16,borderWidth:1,borderColor:C.colours.hairline,gap:8},badge:{borderRadius:999,paddingHorizontal:9,paddingVertical:2,borderWidth:1,alignSelf:'flex-start'},banner:{borderRadius:C.radius.m,padding:12,borderLeftWidth:5,gap:2},input:{minWidth:0,boxSizing:'border-box',backgroundColor:C.colours.surface2,borderColor:C.colours.border,borderWidth:1,borderRadius:C.radius.m,paddingHorizontal:12,paddingVertical:10,color:C.colours.text,fontSize:C.font.body,fontFamily:C.fonts.regular},chip:{maxWidth:'100%',flexShrink:0,borderWidth:1,borderColor:C.colours.border,borderRadius:C.radius.m,paddingHorizontal:12,paddingVertical:8,backgroundColor:C.colours.surface2,minWidth:64,minHeight:44,justifyContent:'center'},stepBtn:{width:44,height:44,borderRadius:22,borderWidth:1.5,borderColor:C.colours.gold,alignItems:'center',justifyContent:'center'},overlay:{flex:1,backgroundColor:'rgba(0,0,0,0.7)',justifyContent:'center',alignItems:'center',padding:16},sheet:{backgroundColor:C.colours.surface,borderRadius:w.radii.xl,padding:18,width:'100%',maxWidth:520,maxHeight:'90%',borderWidth:1,borderColor:C.colours.gold},footer:{borderTopWidth:1,borderTopColor:C.colours.border,backgroundColor:C.colours.surface,padding:12}})},794,[795,796,830,827,30,831,34,379,395,236,402,295,41,410,102,426,36,821,826,871,5,872,873,25]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"RESPONSIVE_CSS",{enumerable:!0,get:function(){return t}});const t="\n*,*::before,*::after { box-sizing:border-box !important; }\nhtml,body { max-width:100%; overflow-x:hidden; }\ninput,select,textarea { box-sizing:border-box !important; min-width:0; max-width:100%; }\n[dir=\"auto\"] { overflow-wrap:break-word; }\n[data-testid^=\"area-summary-\"] [dir=\"auto\"] { overflow-wrap:normal; word-break:keep-all; text-align:center; }\n[data-testid=\"venue-header-name\"],\n[data-testid^=\"avatar-option-\"] [dir=\"auto\"] { overflow-wrap:normal !important; word-break:keep-all !important; }\n[data-testid=\"cc-card\"] { min-width:0; max-width:100%; overflow-x:hidden; }\n[data-testid=\"cc-card\"] > [dir=\"auto\"] { text-align:center; }\n[data-testid=\"cc-card\"] > * { min-width:0; max-width:100%; }\n";if('undefined'!=typeof document&&!document.getElementById('cc-responsive-sizing')){const n=document.createElement('style');n.id='cc-responsive-sizing',n.textContent=t,document.head.appendChild(n)}},795,[]); @@ -1095,7 +1095,7 @@ __d(function(g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule' __d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.setClockServer=function(t){s=t,c()},e.markClockUnsent=function(t){o.set(t,Date.now()),c()},e.markClockSent=function(t){o.delete(t)&&c()},e.clockNotSent=l,e.useClockNotSent=function(o){const[,c]=(0,t.useState)(0);return(0,t.useEffect)(()=>{const t=()=>c(t=>t+1);u.add(t);const o=n.mutationQueue.subscribe(t);return()=>{u.delete(t),o()}},[]),l(o)};var t=r(d[0]),n=r(d[1]);const o=new Map,u=new Set,c=()=>{for(const t of u)t()};let s=()=>!1;function l(t){if(!t)return!1;return n.mutationQueue.pending.some(n=>'attendance'===n.table&&n.rowKey===t)||o.has(t)&&s()}n.mutationQueue.onDone(t=>{'attendance'===t.table&&o.delete(t.rowKey)&&c()})},1012,[34,1013]); __d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"MutationQueue",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"mutationQueue",{enumerable:!0,get:function(){return o}});var t=_r(d[0]),e=_r(d[1]),s=_r(d[2]);const n='queue:v1',r='queue:failed:v1',h=t=>`${t.table}|${t.venueId}|${t.rowKey}`;class l{items=[];failedItems=[];loaded=null;flushing=null;flushingSince=0;exec=null;listeners=new Set;onFailure=new Set;onSaved=new Set;retryTimer=null;waitTimer=null;backoffMs=2e3;now=()=>Date.now();constructor(){(0,t.onConnectivity)(t=>{t&&this.flush()})}setExecutor(t){this.exec=t}load(){return this.loaded||(this.loaded=(async()=>{const t=await e.kv.get(n,[]);this.items=[...t.map(t=>({...t,nextAt:void 0})),...this.items],this.failedItems=await e.kv.get(r,[]),this.emit()})()),this.loaded}get pending(){return this.items}get waiting(){return this.items.filter(t=>t.attempts>0)}get failed(){return this.failedItems}hasPending(t,e,s){return this.items.some(n=>n.table===t&&n.venueId===e&&n.rowKey===s)}async enqueue(t){await this.load();const s={...t,id:(0,e.uuid)(),createdAt:(new Date).toISOString(),attempts:0};return this.items.push(s),await this.persist(),this.flush(),s}nextReady(){const t=new Set,e=this.now();for(const s of this.items){const n=h(s);if(!t.has(n)){if(!(s.nextAt&&s.nextAt>e))return s;t.add(n)}}}remove(t){this.items=this.items.filter(e=>e!==t)}flush(){if(this.flushing&&Date.now()-this.flushingSince<6e4)return this.flushing;this.flushingSince=Date.now();let e=null;return e=(async()=>{for(await this.load();this.exec;){if(this.flushing&&this.flushing!==e)return;const n=this.nextReady();if(!n)break;if(!(0,t.isOnline)()){this.scheduleRetry();break}try{const t=await this.exec(n);this.remove(n),this.backoffMs=2e3,'conflict'===t?this.fail(n,'conflict','Row changed on the server (version conflict) or is not visible to you'):this.onSaved.forEach(t=>t(n))}catch(e){n.attempts+=1,n.lastError=String(e?.message??e);const r=e??{};n.lastErr={code:r.code?String(r.code):void 0,status:Number(r.status)||void 0,message:n.lastError.slice(0,300)};const h=(0,s.classifyWriteError)(e);if('network'===h){n.attempts-=1,(0,t.setOnline)(!1),this.scheduleRetry(),await this.persist();break}'retry'===h?n.nextAt=this.now()+(0,s.retryDelayMs)(n.attempts):(this.remove(n),this.fail(n,'rejected',n.lastError))}await this.persist()}this.flushing===e&&(this.flushing=null),this.scheduleWaiting()})(),this.flushing=e,e}retryNow(){for(const t of this.items)t.nextAt=void 0;return this.flush()}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}onFailed(t){return this.onFailure.add(t),()=>{this.onFailure.delete(t)}}onDone(t){return this.onSaved.add(t),()=>{this.onSaved.delete(t)}}async clearFailed(){this.failedItems=[],await e.kv.set(r,[]),this.emit()}fail(t,s,n){const h={...t,lastError:n,failedAt:(new Date).toISOString(),reason:s};this.failedItems=[h,...this.failedItems].slice(0,100),e.kv.set(r,this.failedItems),this.onFailure.forEach(t=>t(h))}scheduleWaiting(){this.waitTimer&&(clearTimeout(this.waitTimer),this.waitTimer=null);const t=this.items.map(t=>t.nextAt??0).filter(t=>t>0);if(!t.length)return;const e=Math.max(500,Math.min(...t)-this.now());this.waitTimer=setTimeout(()=>{this.waitTimer=null,this.flush()},e)}scheduleRetry(){if(this.retryTimer)return;const e=this.backoffMs;this.backoffMs=Math.min(2*this.backoffMs,6e4),this.retryTimer=setTimeout(()=>{this.retryTimer=null,(0,t.setOnline)(!0),this.flush()},e)}async persist(){await e.kv.set(n,this.items),this.emit()}emit(){this.listeners.forEach(t=>t())}}const o=new l},1013,[1010,977,1014]); __d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.classifyWriteError=function(o){if((0,e.isNetworkError)(o))return'network';const{code:n,status:c,msg:l}=t(o);return s(o)?'refused':/^(08|53|57|58)/.test(n)||['40001','40P01','55P03','23505','23503'].includes(n)||/^PGRST30[0-3]$/.test(n)||/jwt|token.*expired/i.test(l)||401===c||408===c||425===c||429===c||c>=500?'retry':409!==c||n?'refused':'retry'},Object.defineProperty(_e,"retryDelayMs",{enumerable:!0,get:function(){return o}}),_e.describeWrite=function(e){const t='rpc'===e.kind?(e.fn??'change').replace(/_/g,' '):n[e.table]??e.table.replace(/_/g,' ').replace(/s$/,''),s=e.values??{},o=s.guest_name??s.name??s.display_name??s.title??s.reason,c='string'==typeof o&&o.trim()?` for ${o.trim().slice(0,60)}`:'';return'delete'===e.kind?`deleting a ${t}${c}`:`the ${t}${c}`},_e.plainReason=function(e,o){const{code:n,status:c,msg:l}=t(e);if('refused'===o)return s(e)?'more than 20 deletes in 10 minutes from one sign-in are stopped to keep your data safe':'42501'===n||403===c||/row-level security|permission/i.test(l)?'your sign-in isn\u2019t allowed to change this':'conflict'===n?'it was changed or removed on another device first':/^(22|23)/.test(n)?'the shared system says some of the details aren\u2019t valid':'P0001'===n&&l?l.slice(0,140):l?`the shared system said: ${l.slice(0,120)}`:'the shared system refused it';return'23505'===n?'the shared system already has another copy of it':'23503'===n?'a related change has to save first':/^PGRST30/.test(n)||401===c||/jwt/i.test(l)?'your sign-in is being refreshed':'the shared system is busy'};var e=r(d[0]);const t=e=>{const t=e&&'object'==typeof e?e:{};return{msg:String(t.message??e??''),code:String(t.code??''),status:Number(t.status??0)||0,hint:String(t.hint??'')}},s=e=>{const s=t(e);return/delete guard/i.test(s.hint)||/too many .* deleted in 10 minutes/i.test(s.msg)};const o=e=>Math.min(5e3*Math.pow(3,Math.max(0,e-1)),3e5),n={bookings:'booking',walk_ins:'walk-in',blocks:'blocked time',sold_out_items:'sold-out mark',sold_out_links:'dish stock link',staff:'staff details',rota_shifts:'rota shift',stock_items:'stock item',stock_events:'stock count',stock_counts:'stock count',chat_messages:'chat message',recipe_cards:'recipe card',order_lists:'order list',order_list_items:'order list item',daily_task_ticks:'task tick',daily_tasks:'daily task',attendance:'clock in or out',cash_ups:'cash-up',table_plans:'table plan',guest_profiles:'guest profile',floor_live:'table status',venues:'venue settings',time_requests:'clock correction request',staff_leave:'time off',scheduled_notifications:'reminder',suppliers:'supplier',supplier_orders:'supplier order',takeaway_orders:'takeaway order'}},1014,[1010]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"APP_VERSION",{enumerable:!0,get:function(){return t}});const t='v0.3.12.160'},1015,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"APP_VERSION",{enumerable:!0,get:function(){return t}});const t='v0.3.12.161'},1015,[]); __d(function(g,_r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"TableRepository",{enumerable:!0,get:function(){return c}}),e.executeMutation=async function(t){const s=(t,s)=>{throw Object.assign(t,{status:s})};if('rpc'===t.kind){const{error:n,status:r}=await u().rpc(t.fn,t.values??{});return n&&s(n,r),'ok'}const n=u().from(t.table);if('upsert'===t.kind||'insert'===t.kind){const{error:r,status:o}=await n.upsert(t.values??{},{onConflict:t.conflictKey??'id',ignoreDuplicates:'insert'===t.kind});return r&&s(r,o),'ok'}let r='update'===t.kind?n.update(t.values??{}):n.delete();for(const[s,n]of Object.entries(t.match??{}))r=r.eq(s,n);const{data:o,error:c,status:h}=await r.select();c&&s(c,h);return'update'!==t.kind||o&&0!==o.length?'ok':'conflict'};var t=_r(d[0]),s=_r(d[1]),n=_r(d[2]),r=_r(d[3]),o=_r(d[4]);const u=()=>(0,n.getSupabase)();class c{constructor(t,s={}){this.table=t,this.opts=s,this.keyOf=s.keyOf??(t=>String(t.id)),this.keyColumns=s.keyColumns??['id'],this.venueCol=s.venueColumn??'venue_id'}rows(t){return s.cache.rows(this.table,t)}get(t,n){return s.cache.get(this.table,t,n)}subscribe(t,n){return s.cache.subscribe(this.table,t,n)}hydrate(t){return s.cache.hydrate(this.table,t)}async refresh(n,r={}){const c=()=>{let t=u().from(this.table).select('*').eq(this.venueCol,n);return this.opts.orderBy&&(t=t.order(this.opts.orderBy.column,{ascending:this.opts.orderBy.ascending??!0})),r.filter&&(t=r.filter(t)),t},h='bookings'===this.table?await(0,t.readPages)(async(t,s)=>{const{data:n,error:r}=await c().order('id').range(t,s);if(r)throw r;return n??[]}):await(async()=>{const{data:t,error:s}=await c().limit(this.opts.limit??1e3);if(s)throw s;return t??[]})();return s.cache.replace(this.table,n,h.map(t=>[this.keyOf(t),t]),t=>o.mutationQueue.hasPending(this.table,n,t)),h}async create(t,n){const u={...1===this.keyColumns.length&&'id'===this.keyColumns[0]?{id:(0,r.uuid)()}:{},...n,[this.venueCol]:t},c=this.keyOf(u);return s.cache.put(this.table,t,c,u),await o.mutationQueue.enqueue({table:this.table,venueId:t,kind:'insert'===this.opts.writeMode?'insert':'upsert',rowKey:c,values:u,conflictKey:this.opts.conflictKey??'id'}),u}async update(t,n,r,u={}){const c=s.cache.get(this.table,t,n),h={...this.matchFor(n,c),...u,[this.venueCol]:t};s.cache.patch(this.table,t,n,{...r,updated_at:(new Date).toISOString()}),await o.mutationQueue.enqueue({table:this.table,venueId:t,kind:'update',rowKey:n,values:r,match:h})}async remove(t,n){const r=s.cache.get(this.table,t,n),u={...this.matchFor(n,r),[this.venueCol]:t};s.cache.remove(this.table,t,n),await o.mutationQueue.enqueue({table:this.table,venueId:t,kind:'delete',rowKey:n,match:u})}matchFor(t,s){if(1===this.keyColumns.length&&'id'===this.keyColumns[0])return{id:t};const n={};for(const t of this.keyColumns)n[t]=s?.[t];return n}}},1016,[1017,1018,933,977,1013]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.readPages=async function(t,n=1e3){const s=[];for(let c=0;;c+=n){const o=await t(c,c+n-1);if(s.push(...o),o.length`cache:${t}:${n}`;function f(t){let s=n.get(t);return s||(s=new Map,n.set(t,s)),s}function p(n){s.delete(n),c.get(n)?.forEach(t=>t());const u=o.get(n);u&&clearTimeout(u),o.set(n,setTimeout(()=>{o.delete(n),t.kv.set(n,Array.from(f(n).entries()))},250))}const w={async hydrate(n,s){const c=l(n,s);if(u.has(c))return;u.add(c);const o=await t.kv.get(c,[]),w=f(c);let h=0;for(const[t,n]of o)w.has(t)||(w.set(t,n),h++);h&&p(c)},rows(t,n){const c=l(t,n);let o=s.get(c);return o||(o=Array.from(f(c).values()),s.set(c,o)),o},get:(t,n,s)=>f(l(t,n)).get(s),put(t,n,s,c){f(l(t,n)).set(s,c),p(l(t,n))},patch(t,n,s,c){const o=f(l(t,n)),u=o.get(s);u&&(o.set(s,{...u,...c}),p(l(t,n)))},remove(t,n,s){f(l(t,n)).delete(s)&&p(l(t,n))},replace(t,s,c,o=()=>!1){const u=l(t,s),w=f(u),h=new Map(c);w.forEach((t,n)=>{o(n)&&h.set(n,t)}),n.set(u,h),p(u)},subscribe(t,n,s){const o=l(t,n);let u=c.get(o);return u||(u=new Set,c.set(o,u)),u.add(s),()=>{u?.delete(s)}},async clearVenue(o,f){for(const p of f){const f=l(p,o);n.delete(f),s.delete(f),u.delete(f),await t.kv.remove(f),c.get(f)?.forEach(t=>t())}}}},1018,[977]); @@ -1197,7 +1197,7 @@ __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule', __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SEATED_BG",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"SEATED_FG",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"SEATED_MUTED",{enumerable:!0,get:function(){return u}}),e.isSeatedHighlight=function(t,o){return'seated'===t&&!o?.otherDay},e.seatedHighlightStyle=function(u){return{backgroundColor:o,borderColor:t.colours.goldLight,borderWidth:1.5,borderLeftWidth:8,borderLeftColor:n,...u}};var t=r(d[0]);const o=t.colours.gold,n=t.colours.onGold,u='#3F3218'},1114,[821]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.BookingTableButton=function({rid:e,booking:l,readOnly:y,turnBase:B=90,testID:f}){const[h,j]=(0,t.useState)(!1),k=(0,s.tableButtonLabel)(l.table),x=f??`table-btn-${l.id}`;if(y)return(0,c.jsx)(n.default,{testID:x,accessible:!0,accessibilityLabel:(0,s.tableButtonA11y)(l.table,!0),style:{minHeight:44,justifyContent:'center'},children:(0,c.jsx)(b.T,{size:16,weight:"semibold",colour:o.colours.goldLight,children:k})});return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(b.Button,{kind:"secondary",label:k,testID:x,accessibilityLabel:(0,s.tableButtonA11y)(l.table),onPress:()=>j(!0),style:{minHeight:44}}),h?(0,c.jsx)(u.TablePicker,{rid:e,booking:l,name:l.walkIn?'Walk-in':(l.name??'').replace(' (example)',''),turnBase:B,onClose:()=>j(!1)}):null]})};var e,t=r(d[0]),l=r(d[1]),n=(e=l)&&e.__esModule?e:{default:e},s=r(d[2]),o=r(d[3]),u=r(d[4]),b=r(d[5]),c=r(d[6])},1115,[34,102,1116,821,1117,794,25]); __d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"tableButtonLabel",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"tableButtonA11y",{enumerable:!0,get:function(){return s}}),e.tableOptions=function(t,n,o){const s=t.tables.map(t=>t.name).sort(l),c=new Set;return(t.joins??[]).forEach(t=>{t.tables.length>1&&c.add(t.tables.slice().sort(l).join('+'))}),[...n.map(t=>t.table),o].forEach(t=>{const n=a(t);n.length>1&&c.add(n.slice().sort(l).join('+'))}),[...s,...[...c].sort(l)]},e.tableOverlaps=function(t,l,o,s=90){const c=a(l);if(!c.length)return[];const b={...t,table:l};return o.filter(l=>l.id!==t.id&&l.date===t.date&&!['cancelled','noshow','finished'].includes(l.status)&&a(l.table).some(t=>c.includes(t))&&(0,n.startOf)(b)<(0,n.endOf)(l,s)&&(0,n.startOf)(l)<(0,n.endOf)(b,s))},Object.defineProperty(e,"tablePatch",{enumerable:!0,get:function(){return c}});var t=r(d[0]),n=r(d[1]);const a=t=>t?t.split('+').map(t=>t.trim()).filter(Boolean):[],l=(t,n)=>t.localeCompare(n,'en-GB',{numeric:!0}),o=n=>(0,t.tableNumbers)(n)||'No table',s=(n,a)=>`${(0,t.tableNumbersA11y)(n)}${a?'':', change table'}`;const c=t=>({table:t||void 0,tableSetHere:!0})},1116,[860,1101]); -__d(function(_g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.saveBookingTables=v,_e.TablePicker=function({rid:e,booking:u,name:g,turnBase:k=90,onClose:$,onSaved:w,onPickOnPlan:C}){const L=(0,b.usePlan)(e),S=(0,c.useBookings)(e),[T,P]=(0,l.useState)(()=>(0,b.tablesOf)((0,h.tableKey)((0,b.tablesOf)(u.table)))),W=(0,l.useMemo)(()=>(0,h.pickGroups)(L),[L]),z=S.filter(e=>e.date===u.date),I=(0,h.seatsOf)(L,T),D=(0,h.seatLine)(I.total,u.partySize),B=(0,h.pickClashes)(u,T,z,k),O=e=>(0,h.pickClashes)(u,[e],z,k)[0]?.with,R=(0,h.tableKey)(T)!==(0,h.tableKey)((0,b.tablesOf)(u.table)),M=(0,f.useBlocks)(e=>e.blocks),N=(0,f.blockAt)(M,e,u.date,u.time),[_,A]=(0,l.useState)(null),G=e=>{A(null),P(t=>(0,h.toggleTable)(t,e))},Y=async t=>{try{await v(e,u,t),w?.((0,h.savedWords)(g,u.partySize,t,(0,h.seatsOf)(L,t).total)),$()}catch(e){w?.(`Couldn\u2019t save tables for ${g}: ${String(e?.message??e).slice(0,120)}`)}},K=(0,x.jsxs)(n.default,{style:{gap:8},children:[(0,x.jsxs)(n.default,{testID:"table-pick-total",accessible:!0,accessibilityLabel:`${(0,h.tablesWords)(T)} picked. ${D.text}.`,children:[(0,x.jsx)(p.T,{size:18,weight:"semibold",center:!0,colour:y.colours.goldLight,children:(0,h.tablesWords)(T)}),(0,x.jsx)(p.T,{size:17,center:!0,colour:y.colours.text,children:D.text})]}),N?(0,x.jsx)(n.default,{testID:"table-pick-pause",accessible:!0,accessibilityLabel:`Note. New bookings are paused ${N.from} to ${N.to}${N.reason?` (${N.reason})`:''}. You can still assign tables to this booking.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:y.colours.goldMuted},children:(0,x.jsxs)(p.T,{size:16,center:!0,colour:y.colours.goldLight,children:["New bookings paused ",N.from,"\u2013",N.to,N.reason?` \xb7 ${N.reason}`:'',". You can still save tables for this booking."]})}):null,B.length?(0,x.jsx)(n.default,{testID:"table-pick-clash",accessible:!0,accessibilityLabel:`Warning. ${(0,h.clashWords)(B)} You can still save.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:y.colours.gold},children:(0,x.jsxs)(p.T,{size:16,weight:"semibold",center:!0,colour:y.colours.goldLight,children:[(0,h.clashWords)(B)," You can still save."]})}):null,_?(0,x.jsxs)(n.default,{testID:"table-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:_,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:y.colours.amber,backgroundColor:y.colours.amberBg,alignItems:'stretch'},children:[(0,x.jsx)(p.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:_}),(0,x.jsxs)(p.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,x.jsx)(p.Button,{testID:"table-pick-overcap-yes",label:"Use it anyway",accessibilityLabel:`Use it anyway, ${(0,h.tablesWords)(T)} for ${g}, ${u.partySize} people`,onPress:()=>{Y(T)},style:[j,{flexGrow:1}]}),(0,x.jsx)(p.Button,{testID:"table-pick-overcap-no",kind:"secondary",label:"Pick another table",onPress:()=>A(null),style:j})]})]}):null,(0,x.jsxs)(p.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[_?null:(0,x.jsx)(p.Button,{testID:"table-pick-save",label:B.length?'Save anyway':'Save tables',disabled:!R||!T.length,accessibilityLabel:`${B.length?'Save anyway, ':'Save, '}${(0,h.tablesWords)(T)} for ${g}. ${D.text}.${B.length?` ${(0,h.clashWords)(B)}`:''}`,onPress:()=>{const e=(0,h.overCapacityAsk)(T,I.total,u.partySize);!e||_?Y(T):A(e)},style:[j,{flexGrow:1}]}),(0,b.tablesOf)(u.table).length?(0,x.jsx)(p.Button,{testID:"table-pick-clear",kind:"secondary",label:"Clear table",accessibilityLabel:`Clear table, take ${(0,h.tablesWords)((0,b.tablesOf)(u.table)).toLowerCase()} off ${g}`,onPress:()=>Y([]),style:j}):null,(0,x.jsx)(p.Button,{testID:"table-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",onPress:$,style:j})]})]});return(0,x.jsxs)(p.Sheet,{visible:!0,onClose:$,title:`Tables \xb7 ${u.time} ${g} \xb7 ${u.partySize} Covers`,maxWidth:760,testID:"table-picker",footer:K,children:[(0,x.jsx)(t.TableNumberWarning,{plan:L}),(0,x.jsx)(p.T,{size:16,center:!0,colour:y.colours.text,children:"Tap one table, or several to join them. Tap again to take one off. Smaller tables can still be used."}),C?(0,x.jsx)(p.Button,{kind:"secondary",testID:"table-pick-on-plan",label:"Pick on the table plan",accessibilityLabel:`Pick on the table plan instead, for ${g}`,onPress:()=>C(T),style:j}):null,W.map(e=>(0,x.jsxs)(n.default,{style:{gap:6},accessibilityLabel:e.area,children:[(0,x.jsx)(p.T,{size:15,weight:"semibold",center:!0,colour:y.colours.gold,children:e.area}),(0,x.jsx)(p.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:e.tables.map(e=>{const t=T.includes(e.name),l=O(e.name);return(0,x.jsxs)(o.default,{testID:`table-pick-${e.name}`,accessibilityRole:"checkbox",accessibilityState:{checked:t},'aria-checked':t,accessibilityLabel:(0,h.pickA11y)(e.name,e.seats,t,l),onPress:()=>G(e.name),style:({pressed:e})=>({minWidth:92,minHeight:64,paddingHorizontal:10,paddingVertical:6,borderRadius:12,alignItems:'center',justifyContent:'center',borderWidth:t?2:1,borderColor:t?y.colours.gold:l?y.colours.goldMuted:y.colours.hairline,borderStyle:l&&!t?'dashed':'solid',backgroundColor:t?y.colours.gold:e?y.colours.tilePressed:y.colours.tile}),children:[(0,x.jsx)(p.T,{size:18,weight:"semibold",colour:t?y.colours.onGold:y.colours.text,children:(0,s.tableNumbers)(e.name)}),(0,x.jsxs)(p.T,{size:14,colour:t?y.colours.onGold:y.colours.muted,children:[e.seats," seats",l?' \xb7 booked':'']})]},e.name)})})]},e.area)),W.length?null:(0,x.jsx)(p.Muted,{center:!0,children:"No tables on the plan yet. Add them in Setup \u203a Table plan."})]})};var t=r(d[0]),s=r(d[1]),l=r(d[2]),o=e(r(d[3])),n=e(r(d[4])),c=r(d[5]),b=r(d[6]),u=r(d[7]),h=r(d[8]),y=r(d[9]),g=r(d[10]),p=r(d[11]),k=r(d[12]),f=r(d[13]),x=r(d[14]);const j={minHeight:56};async function v(e,t,s){const l=(0,h.tableKey)(s),o=(0,b.tablesOf)(t.table);await c.repo.bookings.update(t.id,(0,u.tablePatch)(l||null)),'seated'===t.status&&t.date===(0,g.venueYmd)(new Date)&&(o.filter(e=>!(0,b.tablesOf)(l).includes(e)).forEach(t=>b.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!0})),l&&(0,k.resetTableLive)(e,l))}},1117,[1118,860,34,402,102,874,1025,1116,1119,821,858,794,1120,1022,25]); +__d(function(_g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.saveBookingTables=v,_e.TablePicker=function({rid:e,booking:u,name:g,turnBase:k=90,onClose:$,onSaved:w,onPickOnPlan:C}){const L=(0,b.usePlan)(e),S=(0,c.useBookings)(e),[T,P]=(0,l.useState)(()=>(0,b.tablesOf)((0,h.tableKey)((0,b.tablesOf)(u.table)))),W=(0,l.useMemo)(()=>(0,h.pickGroups)(L),[L]),z=S.filter(e=>e.date===u.date),I=(0,h.seatsOf)(L,T),D=(0,h.seatLine)(I.total,u.partySize),B=(0,h.pickClashes)(u,T,z,k),O=e=>(0,h.pickClashes)(u,[e],z,k)[0]?.with,R=(0,h.tableKey)(T)!==(0,h.tableKey)((0,b.tablesOf)(u.table)),M=(0,f.useBlocks)(e=>e.blocks),N=(0,f.blockAt)(M,e,u.date,u.time),[_,A]=(0,l.useState)(null),G=e=>{A(null),P(t=>(0,h.toggleTable)(t,e))},Y=async t=>{try{await v(e,u,t),w?.((0,h.savedWords)(g,u.partySize,t,(0,h.seatsOf)(L,t).total)),$()}catch(e){w?.(`Couldn\u2019t save tables for ${g}: ${String(e?.message??e).slice(0,120)}`)}},K=(0,x.jsxs)(n.default,{style:{gap:8},children:[(0,x.jsxs)(n.default,{testID:"table-pick-total",accessible:!0,accessibilityLabel:`${(0,h.tablesWords)(T)} picked. ${D.text}.`,children:[(0,x.jsx)(p.T,{size:18,weight:"semibold",center:!0,colour:y.colours.goldLight,children:(0,h.tablesWords)(T)}),(0,x.jsx)(p.T,{size:17,center:!0,colour:y.colours.text,children:D.text})]}),N?(0,x.jsx)(n.default,{testID:"table-pick-pause",accessible:!0,accessibilityLabel:`Note. New bookings are paused ${N.from} to ${N.to}${N.reason?` (${N.reason})`:''}. You can still assign tables to this booking.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:y.colours.goldMuted},children:(0,x.jsxs)(p.T,{size:16,center:!0,colour:y.colours.goldLight,children:["New bookings paused ",N.from,"\u2013",N.to,N.reason?` \xb7 ${N.reason}`:'',". You can still save tables for this booking."]})}):null,B.length?(0,x.jsx)(n.default,{testID:"table-pick-clash",accessible:!0,accessibilityLabel:`Warning. ${(0,h.clashWords)(B)} You can still save.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:y.colours.gold},children:(0,x.jsxs)(p.T,{size:16,weight:"semibold",center:!0,colour:y.colours.goldLight,children:[(0,h.clashWords)(B)," You can still save."]})}):null,_?(0,x.jsxs)(n.default,{testID:"table-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:_,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:y.colours.gold,backgroundColor:y.colours.amberBg,alignItems:'stretch'},children:[(0,x.jsx)(p.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:_}),(0,x.jsxs)(p.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,x.jsx)(p.Button,{testID:"table-pick-overcap-yes",label:"Use it anyway",accessibilityLabel:`Use it anyway, ${(0,h.tablesWords)(T)} for ${g}, ${u.partySize} people`,onPress:()=>{Y(T)},style:[j,{flexGrow:1}]}),(0,x.jsx)(p.Button,{testID:"table-pick-overcap-no",kind:"secondary",label:"Pick another table",onPress:()=>A(null),style:j})]})]}):null,(0,x.jsxs)(p.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[_?null:(0,x.jsx)(p.Button,{testID:"table-pick-save",label:B.length?'Save anyway':'Save tables',disabled:!R||!T.length,accessibilityLabel:`${B.length?'Save anyway, ':'Save, '}${(0,h.tablesWords)(T)} for ${g}. ${D.text}.${B.length?` ${(0,h.clashWords)(B)}`:''}`,onPress:()=>{const e=(0,h.overCapacityAsk)(T,I.total,u.partySize);!e||_?Y(T):A(e)},style:[j,{flexGrow:1}]}),(0,b.tablesOf)(u.table).length?(0,x.jsx)(p.Button,{testID:"table-pick-clear",kind:"secondary",label:"Clear table",accessibilityLabel:`Clear table, take ${(0,h.tablesWords)((0,b.tablesOf)(u.table)).toLowerCase()} off ${g}`,onPress:()=>Y([]),style:j}):null,(0,x.jsx)(p.Button,{testID:"table-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",onPress:$,style:j})]})]});return(0,x.jsxs)(p.Sheet,{visible:!0,onClose:$,title:`Tables \xb7 ${u.time} ${g} \xb7 ${u.partySize} Covers`,maxWidth:760,testID:"table-picker",footer:K,children:[(0,x.jsx)(t.TableNumberWarning,{plan:L}),(0,x.jsx)(p.T,{size:16,center:!0,colour:y.colours.text,children:"Tap one table, or several to join them. Tap again to take one off. Smaller tables can still be used."}),C?(0,x.jsx)(p.Button,{kind:"secondary",testID:"table-pick-on-plan",label:"Pick on the table plan",accessibilityLabel:`Pick on the table plan instead, for ${g}`,onPress:()=>C(T),style:j}):null,W.map(e=>(0,x.jsxs)(n.default,{style:{gap:6},accessibilityLabel:e.area,children:[(0,x.jsx)(p.T,{size:15,weight:"semibold",center:!0,colour:y.colours.gold,children:e.area}),(0,x.jsx)(p.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:e.tables.map(e=>{const t=T.includes(e.name),l=O(e.name);return(0,x.jsxs)(o.default,{testID:`table-pick-${e.name}`,accessibilityRole:"checkbox",accessibilityState:{checked:t},'aria-checked':t,accessibilityLabel:(0,h.pickA11y)(e.name,e.seats,t,l),onPress:()=>G(e.name),style:({pressed:e})=>({minWidth:92,minHeight:64,paddingHorizontal:10,paddingVertical:6,borderRadius:12,alignItems:'center',justifyContent:'center',borderWidth:t?2:1,borderColor:t?y.colours.gold:l?y.colours.goldMuted:y.colours.hairline,borderStyle:l&&!t?'dashed':'solid',backgroundColor:t?y.colours.gold:e?y.colours.tilePressed:y.colours.tile}),children:[(0,x.jsx)(p.T,{size:18,weight:"semibold",colour:t?y.colours.onGold:y.colours.text,children:(0,s.tableNumbers)(e.name)}),(0,x.jsxs)(p.T,{size:14,colour:t?y.colours.onGold:y.colours.muted,children:[e.seats," seats",l?' \xb7 booked':'']})]},e.name)})})]},e.area)),W.length?null:(0,x.jsx)(p.Muted,{center:!0,children:"No tables on the plan yet. Add them in Setup \u203a Table plan."})]})};var t=r(d[0]),s=r(d[1]),l=r(d[2]),o=e(r(d[3])),n=e(r(d[4])),c=r(d[5]),b=r(d[6]),u=r(d[7]),h=r(d[8]),y=r(d[9]),g=r(d[10]),p=r(d[11]),k=r(d[12]),f=r(d[13]),x=r(d[14]);const j={minHeight:56};async function v(e,t,s){const l=(0,h.tableKey)(s),o=(0,b.tablesOf)(t.table);await c.repo.bookings.update(t.id,(0,u.tablePatch)(l||null)),'seated'===t.status&&t.date===(0,g.venueYmd)(new Date)&&(o.filter(e=>!(0,b.tablesOf)(l).includes(e)).forEach(t=>b.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!0})),l&&(0,k.resetTableLive)(e,l))}},1117,[1118,860,34,402,102,874,1025,1116,1119,821,858,794,1120,1022,25]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.TableNumberWarning=function({plan:u}){const c=(0,n.numberClashes)(u.tables),o=[...new Set([...c.acrossAreas,...u.tables.filter(n=>c.sameArea.has(n.name)).map(n.tableNumber)])];return o.length?(0,l.jsxs)(t.T,{testID:"duplicate-table-numbers",size:16,colour:s.colours.goldLight,children:["Duplicate table numbers: ",o.join(', '),". Kept unchanged. Ask a manager to check the areas before assigning."]}):null},r(d[0]);var n=r(d[1]),s=r(d[2]),t=r(d[3]),l=r(d[4])},1118,[34,859,821,794,25]); __d(function(_g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"byNum",{enumerable:!0,get:function(){return s}}),e.tableKey=o,e.toggleTable=function(t,n){return t.includes(n)?t.filter(t=>t!==n):a(o([...t,n]))},e.seatsOf=function(t,n){const a={};for(const s of n)a[s]=t.tables.find(t=>t.name===s)?.maxSeats??0;return{per:a,total:Object.values(a).reduce((t,n)=>t+n,0)}},e.seatLine=function(t,n){const a=Math.max(0,n-t);return{text:`${t} ${1===t?'seat':'seats'} for ${l(n)}${a?`: ${a} short`:''}`,short:a,fits:0===a&&t>0}},e.pickClashes=function(t,l,u,c=90){if(!l.length)return[];const f={...t,table:o(l)},b=[];for(const s of u)if(s.id!==t.id&&s.date===t.date&&!['cancelled','noshow','finished'].includes(s.status)&&(0,n.startOf)(f)<(0,n.endOf)(s,c)&&(0,n.startOf)(s)<(0,n.endOf)(f,c))for(const t of a(s.table))l.includes(t)&&b.push({table:t,with:s});return b.sort((t,n)=>s(t.table,n.table))},e.overCapacityAsk=function(n,s,l){const u=a(o(n));if(!u.length||s>=l)return null;const c=u.map(n=>(0,t.tableNumbers)(n));return`${1===c.length?`Table ${c[0]} seats`:`Tables ${c.slice(0,-1).join(', ')} and ${c[c.length-1]} seat`} ${s} \u2013 this booking is ${l}. Use it anyway?`},e.clashWords=function(n){return n.map(n=>`${(0,t.tableNumbers)(n.table)} has ${n.with.walkIn?'a walk-in':(n.with.name||'a booking').replace(' (example)','')} at ${n.with.time}`).join('. ')+(n.length?'.':'')},e.tablesWords=u,e.pickA11y=function(n,a,s,l){return`Table ${(0,t.tableNumbers)(n)}, ${a} ${1===a?'seat':'seats'}${s?', selected':''}${l?`, has ${l.walkIn?'a walk-in':l.name} at ${l.time}`:''}`},e.pickGroups=function(t){return t.areas.map(n=>({area:n.name,tables:t.tables.filter(t=>t.areaId===n.id).map(t=>({name:t.name,seats:t.maxSeats})).sort((t,n)=>s(t.name,n.name))})).filter(t=>t.tables.length)},e.savedWords=function(t,n,a,s){return a.length?`${t}, ${l(n)}: ${u(a)} (${s} seats).`:`${t}: table taken off.`},e.tableActions=function(t,n){const s=a(t.table);if(['cancelled','noshow'].includes(t.status))return[];const o=[s.length?{id:'assign',label:'Change table',a11y:`Change table for ${n}, ${l(t.partySize)}, now ${u(s).toLowerCase()}. You can pick several tables to join.`}:{id:'assign',label:'Assign table',a11y:`Assign table for ${n}, ${l(t.partySize)}. You can pick several tables to join.`}];s.length&&o.push({id:'clear',label:'Clear table',a11y:`Clear table for ${n}, take ${u(s).toLowerCase()} off this booking`});return o},e.dragTables=function(t,n,s){if(!s||'__none'===s||s===n)return null;const l=a(t);if(l.includes(s))return null;return o('__none'!==n&&l.includes(n)?l.map(t=>t===n?s:t):[s])};var t=r(d[0]),n=r(d[1]);const a=t=>t?t.split('+').map(t=>t.trim()).filter(Boolean):[],s=(t,n)=>t.localeCompare(n,'en-GB',{numeric:!0}),l=t=>`${t} ${1===t?'person':'people'}`;function o(t){return[...new Set(t.map(t=>String(t).trim()).filter(Boolean))].sort(s).join('+')}function u(n){const s=a(o(n));return s.length?(0,t.tableListNumbers)(s):'No table'}},1119,[860,1101]); __d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"TABLES",{enumerable:!0,get:function(){return O}}),_e.useTableNames=N,_e.resetTableLive=M,_e.seatBookingNow=L,_e.finishBookingNow=async function(e,t){await f.repo.bookings.setStatus(t.id,'finished'),(0,S.tablesOf)(t.table).forEach(t=>S.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!0}))},_e.useTableUse=F,Object.defineProperty(_e,"walkInLabel",{enumerable:!0,get:function(){return R}}),_e.TablePicker=W,_e.WalkInSheet=E,_e.WalkInMatchPrompt=H,_e.AssignTableSheet=_,_e.undoNotice=Y,_e.NewBookingSheet=U,_e.useFrontDoor=function(e,t){const[s,o]=(0,r.useState)(!1),[l,a]=(0,r.useState)(!1),[i,d]=(0,r.useState)(null);return{openWalkIn:()=>o({}),openWalkInAt:e=>o({table:e}),openBooking:()=>a(!0),assignTable:e=>d({b:e}),combineTables:e=>d({b:e,combine:!0}),elements:(0,B.jsxs)(B.Fragment,{children:[s?(0,B.jsx)(E,{wide:t,initialTable:s.table,onClose:()=>o(!1),onSeated:Y}):null,l?(0,B.jsx)(U,{wide:t,date:e,onClose:()=>a(!1),onSaved:e=>(0,n.notify)({id:`booked:${Date.now()}`,testID:'booking-saved-toast',timeoutMs:5e3,icon:'\u2713',title:`Booked: ${e.name} \xb7 ${(0,x.niceDate)((0,x.parseYmd)(e.date))} at ${e.time}`})}):null,i?(0,B.jsx)(_,{booking:i.b,combine:i.combine,onClose:()=>d(null)}):null]})}};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),a=_r(_d[4]),i=_r(_d[5]),n=_r(_d[6]),r=_r(_d[7]),d=e(r),u=_r(_d[8]),c=e(_r(_d[9])),b=e(_r(_d[10])),h=_r(_d[11]),p=_r(_d[12]),f=_r(_d[13]),y=_r(_d[14]),k=_r(_d[15]),x=_r(_d[16]),j=_r(_d[17]),w=_r(_d[18]),T=_r(_d[19]),S=_r(_d[20]),v=_r(_d[21]),C=_r(_d[22]),D=_r(_d[23]),I=_r(_d[24]),$=_r(_d[25]),P=_r(_d[26]),z=_r(_d[27]),B=_r(_d[28]);const O=Array.from({length:12},(e,t)=>String(t+1));function N(e){const t=(0,S.usePlan)(e);return t.areas.flatMap(e=>t.tables.filter(t=>t.areaId===e.id).map(e=>e.name))}function M(e,t){(0,S.tablesOf)(t).forEach(t=>S.useFloor.getState().setLive(e,t,{stage:'seated',dirty:!1}))}async function L(e,t){await f.repo.bookings.setStatus(t.id,'seated'),M(e,t.table)}function F(e,t){const s=(0,f.useBookings)(e),o=(0,f.useOrders)(e),l=N(e),a=(0,S.useFloor)(t=>t.live[e])??{},i=(0,S.usePlan)(e),n=(0,v.useBlocks)(e=>e.blocks),r=(0,x.ymd)(t),d=(0,v.closedAreasAt)(n,e,r,(0,x.hm)(t)),u={};for(const e of l)u[e]=a[e]?.blocked||d.has(`tbl:${e}`)?{busy:!0,label:'Blocked'}:d.has(i.tables.find(t=>t.name===e)?.areaId??'')?{busy:!0,label:'Closed'}:a[e]?.dirty?{busy:!0,label:'Needs clearing'}:{busy:!1,label:'Free'};for(const e of s)if(e.date===r&&e.table)for(const s of(0,S.tablesOf)(e.table))if(u[s])if('seated'===e.status)u[s]={busy:!0,label:`${e.walkIn?'Walk-in':`${e.name.slice(0,1)}.`} \xb7 ${e.partySize}`};else if('confirmed'===e.status&&!u[s].busy){const o=(0,x.minsBetween)(t,new Date(`${e.date}T${e.time}:00`));o>=-15&&o<=90&&(u[s]={...u[s],soon:`Booked ${e.time}`})}for(const e of o)'table'===e.type&&e.tableNo&&u[e.tableNo]&&!['closed','cancelled','collected'].includes(e.status)&&!u[e.tableNo].busy&&(u[e.tableNo]={busy:!0,label:'Open order'});return u}const R=e=>e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;function W({use:e,value:t,onPick:s,big:o,best:a,dense:i,bestSet:n,picked:d}){const u=Object.keys(e),[h,p]=(0,r.useState)(0),f=i?6:8,y=i?64:o?92:76,k=h?Math.max(3,Math.floor((h+f)/(y+f))):0,x=k?Math.floor((h-f*(k-1))/k):y,w=new Set(n??[]),v=a?(0,S.tablesOf)(a)[0]:null;return(0,B.jsx)(b.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:f},testID:"table-picker",onLayout:e=>p(Math.floor(e.nativeEvent.layout.width)),children:u.map(o=>{const a=e[o],n=t===o||!!d?.includes(o),r=w.has(o),u=v===o&&!n,h=a.busy?['Blocked','Needs clearing','Closed'].includes(a.label)?a.label:'In use':a.soon??'Free';return(0,B.jsxs)(c.default,{accessibilityRole:"button",testID:`pick-table-${o}`,accessibilityLabel:`Table ${(0,l.tableNumbers)(o)}${d?n?', picked':', not picked':''}, ${a.busy?`in use (${a.label})`:a.soon?`free, ${a.soon}`:'free'}${r?', best table':''}${u?', suggested for this party':''}`,accessibilityState:{selected:n,disabled:'Closed'===a.label},disabled:'Closed'===a.label,onPress:()=>s(o),style:{width:x,minHeight:i?58:64,borderRadius:12,borderWidth:n||u?2.5:1.5,paddingVertical:i?3:6,paddingHorizontal:4,alignItems:'center',justifyContent:'center',gap:2,borderColor:n||u?j.colours.gold:a.busy?j.colours.red:j.colours.ok,backgroundColor:n?j.colours.goldTint:a.busy?j.colours.redBg:j.colours.surface2,opacity:'Closed'!==a.label||n?1:.55},children:[(0,B.jsxs)(b.default,{style:{flexDirection:'row',alignItems:'center',gap:4},children:[(0,B.jsx)(T.T,{weight:"bold",size:22,colour:n?j.colours.goldLight:j.colours.text,children:(0,l.tableNumbers)(o)}),r?(0,B.jsx)(b.default,{testID:"best-table",style:{backgroundColor:j.colours.gold,borderRadius:5,paddingHorizontal:4,paddingVertical:1},children:(0,B.jsx)(T.T,{size:11,weight:"bold",colour:j.colours.onGold,children:"BEST"})}):null]}),(0,B.jsx)(T.T,{size:i?13:14,colour:a.busy?'#FFD9D4':a.soon?'#FFE2A8':'#E2C489',center:!0,numberOfLines:1,children:h})]},o)})})}const A=[1,2,3,4,5,6,7,8];function E({onClose:e,onSeated:a,wide:i,initialTable:y}){const{rid:w,r:C,now:D}=(0,p.useCtx)(15e3),I=F(w,D),[$,P]=(0,r.useState)(2),[O,N]=(0,r.useState)(!1),[R,E]=(0,r.useState)(y??null),_=(0,S.usePlan)(w),Y=(0,f.useBookings)(w),U=(0,v.useBlocks)(e=>e.blocks),q=(0,v.closedAreasAt)(U,w,(0,x.ymd)(D),(0,x.hm)(D)),Q=d.default.useMemo(()=>{const e=Object.fromEntries(Object.entries(I).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,k.suggestTable)(_,Y.filter(e=>e.date===(0,x.ymd)(D)),e,$,D,(0,k.turnFor)($,C.settings.turnMins),90,void 0,{closed:q})?.table??null},[_,Y,I,$,q.size,D.getTime()]);(0,r.useEffect)(()=>{R&&(0,S.tablesOf)(R).some(e=>'Closed'===I[e]?.label)&&E(null)},[R,q.size]);const[V,G]=(0,r.useState)(!1),[K,X]=(0,r.useState)(''),J=(e,t=String(e),s=()=>{N(!1),P(e)})=>{const o='9+'===t?O:!O&&$===e;return(0,B.jsx)(c.default,{accessibilityRole:"button",accessibilityLabel:'9+'===t?'Party of 9 or more':`Party of ${e}`,accessibilityState:{selected:o},onPress:s,style:{width:i?58:60,height:i?58:56,borderRadius:14,borderWidth:2,borderColor:j.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:o?j.colours.gold:'transparent'},children:(0,B.jsx)(T.T,{weight:"bold",size:22,colour:o?j.colours.onGold:j.colours.gold,children:t})},t)},Z=(0,B.jsx)(s.PartySizeInput,{value:$,onChange:P,min:9,max:o.MAX_PARTY,label:"Walk-in party size",testID:"walkin-party-size"}),ee=(0,B.jsxs)(b.default,{style:{gap:8,width:i?256:void 0},children:[(0,B.jsx)(T.T,{weight:"semibold",children:"How many people?"}),(0,B.jsxs)(b.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},testID:"walkin-party",children:[A.map(e=>J(e)),J(9,'9+',()=>{N(!0),P(e=>e>=9?e:9)})]}),O?Z:null]}),[te,se]=(0,r.useState)(!1),[oe,le]=(0,r.useState)(null),ae=async(t=R,s=!1)=>{if(!te){if(!s){const e=(0,z.bookingsNearWalkIn)(Y,D,$);if(e.length)return void le({at:t,list:e})}se(!0);try{const s=await f.repo.bookings.seatWalkIn(w,$,t??void 0,K);M(w,t??void 0),a(s),e()}finally{se(!1)}}},ie=async(t,s)=>{if(!te){se(!0);try{const o=s??t.table??null;o&&o!==t.table&&await f.repo.bookings.assignTable(t.id,o),await L(w,{...t,table:o??void 0}),(0,n.notify)({id:`seated:${t.id}`,testID:'walkin-match-toast',timeoutMs:5e3,icon:'\u2713',title:`${t.name} seated \xb7 ${t.partySize} \xb7 ${o?(0,l.tableNumbers)(o):'table to assign'} (booking ${t.ref})`}),le(null),e()}finally{se(!1)}}},ne=(0,B.jsxs)(b.default,{style:{gap:8,flex:i?1:void 0,minWidth:0},children:[(0,B.jsxs)(T.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsxs)(T.T,{weight:"semibold",children:["Table ",(0,B.jsx)(T.T,{colour:j.colours.muted,size:14,children:"(optional)"})]}),R?(0,B.jsx)(T.Button,{small:!0,kind:"ghost",label:"Clear table",onPress:()=>E(null)}):null]}),(0,B.jsx)(W,{use:I,value:R,onPick:e=>{I[e]&&!I[e].busy?ae(e):E(R===e?null:e)},big:i,dense:i,best:Q,bestSet:(0,u.bestTables)(_)}),(0,B.jsxs)(T.Muted,{children:["Tap a free table to seat them there",Q&&!R?` (suggested for ${$}: ${(0,l.tableNumbers)(Q)})`:'',", or Seat for no table yet. BEST marks the venue\u2019s best tables."]})]});return(0,B.jsxs)(T.Sheet,{visible:!0,onClose:e,title:`Walk-in \xb7 ${(0,x.hm)(D)}`,maxWidth:i?1100:void 0,testID:"walkin-sheet",children:[(0,B.jsx)(T.Button,{label:`Seat walk-in \xb7 ${$} ${1===$?'person':'people'}${R?` \xb7 ${(0,l.tableNumbers)(R)}`:''}`,disabled:te,onPress:()=>{ae()},testID:"seat-walkin",style:{minHeight:52}}),i?(0,B.jsxs)(T.Row,{gap:16,style:{alignItems:'flex-start'},children:[ee,ne]}):(0,B.jsxs)(B.Fragment,{children:[ee,ne]}),(0,B.jsxs)(T.Row,{gap:10,wrap:!0,style:{alignItems:'center'},children:[V?(0,B.jsx)(t.TextInput,{accessibilityLabel:"Walk-in note",placeholder:"Note (optional), e.g. high chair",placeholderTextColor:"#7D776C",value:K,onChangeText:X,style:[T.styles.input,{flex:1,minWidth:220}],autoFocus:!0}):(0,B.jsx)(T.Button,{small:!0,kind:"ghost",label:"Add a note (optional)",onPress:()=>G(!0)}),(0,B.jsx)(b.default,{style:{flex:1,minWidth:220},children:(0,B.jsxs)(T.Muted,{children:["No name needed. Counts in today's covers.",'staff'!==h.APP_VARIANT?' Using website bookings too? Mark the table there as well.':'']})})]}),oe?(0,B.jsx)(H,{list:oe.list,busy:te,onYes:e=>{ie(e,oe.at)},onNo:()=>{const e=oe.at;le(null),ae(e,!0)},onClose:()=>le(null)}):null]})}function H({list:e,busy:t,onYes:s,onNo:o,onClose:a}){return(0,B.jsx)(T.Sheet,{visible:!0,onClose:a,title:"Booked party?",maxWidth:720,testID:"walkin-match",children:(0,B.jsxs)(b.default,{style:{gap:14},children:[e.map((e,o)=>(0,B.jsxs)(b.default,{testID:`walkin-match-${o}`,style:{gap:12,padding:16,borderRadius:16,borderWidth:2,borderColor:j.colours.gold,backgroundColor:'#15130F'},children:[(0,B.jsx)(b.default,{accessibilityRole:"header",accessibilityLiveRegion:"polite",children:(0,B.jsx)(T.T,{size:26,weight:"bold",colour:j.colours.goldLight,testID:"walkin-match-question",children:(0,z.walkInMatchQuestion)(e)})}),e.table?(0,B.jsxs)(T.T,{size:17,colour:j.colours.text,children:["Booked table ",(0,l.tableNumbers)(e.table)," \xb7 ",e.ref]}):(0,B.jsx)(T.T,{size:17,colour:j.colours.text,children:e.ref}),(0,B.jsx)(T.Button,{label:"Yes, seat booking",testID:"walkin-match-yes",disabled:t,accessibilityLabel:`Yes, seat ${e.name}'s booking, ${e.partySize} people`,onPress:()=>s(e),style:{minHeight:64}})]},e.id)),(0,B.jsx)(T.Button,{kind:"secondary",label:"No, new walk-in",testID:"walkin-match-no",disabled:t,onPress:o,style:{minHeight:64}})]})})}function _({booking:e,onClose:t,combine:s}){const{rid:o,r:a,now:i}=(0,p.useCtx)(15e3),n=F(o,i),c=(0,S.usePlan)(o),h=(0,f.useBookings)(o),y=(0,S.tablesOf)(e.table),w=d.default.useMemo(()=>Object.fromEntries(Object.entries(n).map(([e,t])=>[e,y.includes(e)?{busy:!1,label:'This party',soon:'This party'}:t])),[n,e.table]),v=d.default.useMemo(()=>{const t=Object.fromEntries(Object.entries(w).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,k.suggestTable)(c,h.filter(e=>e.date===(0,x.ymd)(i)),t,e.partySize,i,(0,k.turnFor)(e.partySize,a.settings.turnMins),90,e.id)?.table??null},[c,h,w,e.partySize,i.getTime()]),[C,D]=(0,r.useState)(!!s||y.length>1),[I,$]=(0,r.useState)(y),P=e=>c.tables.find(t=>t.name===e)?.maxSeats??0,z=I.reduce((e,t)=>e+P(t),0),O=I.length>0&&z{const l=(0,S.joinTables)(s);await f.repo.bookings.assignTable(e.id,l);y.filter(e=>!s.includes(e)).forEach(t=>S.useFloor.getState().setLive(o,t,{stage:void 0,dirty:'seated'===e.status})),'seated'===e.status&&M(o,l),t()},L=C?(0,B.jsxs)(b.default,{style:{gap:8},testID:"assign-table-tip",children:[(0,B.jsx)(b.default,{accessibilityLiveRegion:"polite",children:(0,B.jsx)(T.T,{size:17,weight:"semibold",colour:j.colours.text,children:I.length?`${(0,S.tablesLabel)((0,S.joinTables)(I))} \xb7 ${z} seats for ${e.partySize} Covers`:'No tables picked yet'})}),O?(0,B.jsx)(b.default,{testID:"combine-short",children:(0,B.jsxs)(T.T,{size:15,weight:"semibold",colour:"#FFD9D4",children:["Not enough seats yet: ",e.partySize-z," more needed. Add another table."]})}):null,(0,B.jsx)(T.T,{size:15,colour:j.colours.text,children:"Tap each table to add or remove it, then tap Done. All of them show as taken until the party has finished."}),(0,B.jsxs)(T.Row,{gap:8,wrap:!0,children:[(0,B.jsx)(T.Button,{label:"Done",testID:"combine-done",disabled:!I.length,accessibilityLabel:I.length?`Done, save ${(0,S.tableCardLabel)((0,S.joinTables)(I))}`:'Done',onPress:()=>N(I)}),(0,B.jsx)(T.Button,{kind:"ghost",label:"Cancel",onPress:t})]})]}):(0,B.jsx)(b.default,{style:{gap:8},testID:"assign-table-tip",children:(0,B.jsx)(T.T,{size:15,colour:j.colours.text,children:"Red tables are in use right now; you can still pick one (e.g. joining a table). BEST marks the venue\u2019s best tables. Big party? Tap Combine tables."})});return(0,B.jsxs)(T.Sheet,{visible:!0,onClose:t,title:`${C?'Combine tables':'Assign table'} \xb7 ${R(e)}`,testID:"assign-table-sheet",footer:L,children:[v&&!C?(0,B.jsx)(b.default,{testID:"assign-suggested",children:(0,B.jsxs)(T.T,{size:16,weight:"semibold",colour:j.colours.goldLight,accessibilityLabel:`Suggested for ${e.partySize}: ${(0,S.tableCardLabel)(v)}`,children:["Suggested for ",e.partySize,": ",(0,l.tableNumbers)(v)]})}):null,C?null:(0,B.jsx)(T.Button,{kind:"secondary",label:"Combine tables",testID:"combine-start",accessibilityLabel:"Combine tables: pick several tables for this party",onPress:()=>D(!0)}),(0,B.jsx)(W,{use:w,best:C?null:v,bestSet:(0,u.bestTables)(c),picked:C?I:void 0,onPick:C?e=>$(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]):async e=>{await N([e])}})]})}function Y(e){(0,n.notify)({id:`walkin:${e.id}`,testID:'walkin-toast',timeoutMs:6e3,title:`${R(e)} seated \xb7 ${e.table?`${(0,l.tableNumbers)(e.table)}`:'table to assign'} (${e.ref})`,actions:[{label:'Undo',testID:'undo-walkin',onPress:()=>f.repo.bookings.undoWalkIn(e.id)},{label:'OK',kind:'ghost'}]})}function U({date:e,onClose:t,wide:n,onSaved:d}){const{rid:u,r:c,now:h,role:z,meId:O}=(0,p.useCtx)(6e4),N=(0,x.ymd)(h),[M,L]=(0,r.useState)(ee.blocks),[W,A]=(0,r.useState)(!1),[E,H]=(0,r.useState)(''),[_,Y]=(0,r.useState)(2),[U,q]=(0,r.useState)(null),[Q,V]=(0,r.useState)(''),[G,K]=(0,r.useState)(''),[X,J]=(0,r.useState)(''),[Z,ee]=(0,r.useState)('phone'),[te,se]=(0,r.useState)((0,D.emptyNeeds)()),oe=(0,D.needsMissing)(te),[le,ae]=(0,r.useState)(null),ie=(0,S.usePlan)(u),ne=(0,P.dogSetUp)(ie),re=!0===te.dog&&ne,de=te.dog?te.dogs:0,ue=(0,x.parseYmd)(M),ce=(0,k.turnFor)(_,c.settings.turnMins),be=F.filter(e=>e.date===M),he=e=>(0,k.freeTablesAt)(ie,be,_,new Date(`${M}${(0,l.tableNumbers)(e)}:00`),ce,c.settings.turnMins,{dog:!0,closed:(0,v.closedAreasAt)(R,u,M,e)}),ge=re&&U?he(U):[];(0,r.useEffect)(()=>{ae(null)},[re,U,_]);const pe=(0,y.bookingSlots)(c,ue,e=>F.filter(t=>t.date===M&&t.time===e&&'cancelled'!==t.status&&!t.walkIn).reduce((e,t)=>e+t.partySize,0),_,M===(0,x.ymd)(h)?h:(0,x.addMins)(ue,0),e=>F.filter(t=>t.date===M&&t.time===e&&'cancelled'!==t.status&&!t.walkIn).length),me=(0,w.ukPhone)(G),[fe,ye]=(0,r.useState)(!1),ke=U?pe.find(e=>e.time===U):void 0,xe=ke&&ke.left<_?{left:Math.max(0,ke.left),time:ke.time}:null,je=ke&&null!=ke.partiesLeft&&ke.partiesLeft<1?{time:ke.time,cap:ke.partiesCap??0}:null,we=xe||je,Te=U?(0,v.blockAt)(R,u,M,U):void 0,Se='staff'!==z,ve=!!U&&!(0,D.dogTimeOk)(c,F,M,U,de),Ce=!oe.length&&E.trim().length>=2&&!!U&&(!we||fe)&&(0,o.validParty)(_)&&me.ok&&(0,w.emailOk)(X)&&(!Te||Se&&W)&&(!re||ge.length>0)&&!ve,De=te.wheelchair>0||te.stepFree;return(0,B.jsxs)(T.Sheet,{visible:!0,onClose:t,title:`New booking \xb7 ${(0,x.niceDate)(ue)}`,maxWidth:n?760:void 0,testID:"booking-sheet",children:[(0,B.jsx)(D.FirstQuestions,{rid:u,value:te,onChange:se,party:_,audience:"staff"}),te.dog&&!ne?(0,B.jsx)(T.T,{size:13,colour:j.colours.amber,children:"Dog-friendly tables aren\u2019t marked yet. Managers \u203a Booking options \u203a Tables. Booking is allowed; check where the dog can sit."}):null,(0,B.jsx)(C.BookingDatePicker,{r:c,today:h,value:M,onChange:e=>{e!==M&&(L(e),q(null),A(!1))}}),(0,B.jsxs)(T.Row,{gap:6,children:[(0,B.jsx)(T.Chip,{label:"Phone",selected:'phone'===Z,onPress:()=>ee('phone')}),(0,B.jsx)(T.Chip,{label:"In person",selected:'in-person'===Z,onPress:()=>ee('in-person')})]}),(0,B.jsx)(T.Field,{label:"Name",value:E,onChangeText:H,placeholder:"e.g. Reid",testID:"nb-name"}),(0,B.jsx)(T.Field,{label:"Mobile or phone number (needed)",value:G,onChangeText:K,keyboardType:"phone-pad",placeholder:"e.g. 07700 900123",testID:"nb-phone"}),!me.ok&&G?(0,B.jsx)(T.T,{size:13,colour:j.colours.amber,children:me.error}):null,(0,B.jsx)(T.Field,{label:"Email (optional)",value:X,onChangeText:J,keyboardType:"email-address",autoCapitalize:"none",placeholder:"For an email confirmation too",testID:"nb-email"}),(0,w.emailOk)(X)?null:(0,B.jsx)(T.T,{size:13,colour:j.colours.amber,children:"That email doesn\u2019t look quite right."}),(0,B.jsxs)(b.default,{style:{gap:6,alignItems:'center'},children:[(0,B.jsx)(T.T,{center:!0,children:"Covers"}),(0,B.jsx)(s.PartySizeInput,{value:_,onChange:e=>{Y(e),ye(!1)},label:"Covers",testID:"nb-party"})]}),(0,B.jsx)(T.Row,{wrap:!0,gap:6,children:pe.map(e=>{const t=re&&e.available&&!he(e.time).length||!(0,D.dogTimeOk)(c,F,M,e.time,de);return(0,B.jsx)(T.Chip,{testID:`nb-slot-${e.time}`,label:e.time,sub:(0,v.blockAt)(R,u,M,e.time)?'Paused':t?'Dogs full':e.drinksOnly?'Drinks only':null!=e.partiesLeft&&e.partiesLeft<1||e.left<=0?'Full':`${e.left} left`,disabled:(e.past??!e.available)||t,selected:U===e.time,onPress:()=>{q(e.time),A(!1),ye(!1)}},e.time)})}),we?(0,B.jsxs)(b.default,{testID:"nb-over-capacity",accessible:!0,accessibilityLiveRegion:"polite",style:{borderWidth:1.5,borderColor:j.colours.amber,backgroundColor:j.colours.amberBg,borderRadius:12,padding:10,gap:6},children:[xe?(0,B.jsx)(T.T,{weight:"semibold",colour:j.colours.amber,children:(0,o.overCapacityNote)(_,xe.left,xe.time)}):null,je?(0,B.jsx)(T.T,{weight:"semibold",colour:j.colours.amber,children:(0,o.overPartiesNote)(je.time,je.cap)}):null,(0,B.jsx)(T.Chip,{label:fe?'Booking over the limit: on':'Book anyway (over the limit)',selected:fe,onPress:()=>ye(e=>!e),testID:"nb-over-ok"})]}):null,re&&U?(0,B.jsxs)(b.default,{style:{gap:6},testID:"nb-dog-tables",children:[(0,B.jsxs)(T.T,{size:14,weight:"semibold",children:["Dog-friendly table ",(0,B.jsxs)(T.T,{size:13,colour:j.colours.muted,children:["(",ie.areas.filter(e=>e.dogs).map(e=>e.name).join(' or '),")"]})]}),ge.length?(0,B.jsx)(T.Row,{wrap:!0,gap:6,children:ge.slice(0,10).map((e,t)=>(0,B.jsx)(T.Chip,{label:`${(0,l.tableNumbers)(e.table)}`,sub:`${e.area} \xb7 ${e.seats}${0===t?' \xb7 best':''}${De&&(0,P.accessibleSetUp)(ie)&&!(0,P.isAccessible)(ie,e.table)?' \xb7 not step-free':''}`,selected:(le??ge[0].table)===e.table,onPress:()=>ae(e.table)},e.table))}):(0,B.jsxs)(T.T,{size:14,colour:j.colours.amber,children:["No dog-friendly table free for ",_," at ",U,". Try another time."]})]}):null,Te?(0,B.jsxs)(b.default,{testID:"nb-block-warning",style:{borderWidth:1.5,borderColor:j.colours.amber,backgroundColor:j.colours.amberBg,borderRadius:12,padding:10,gap:6},children:[(0,B.jsxs)(T.T,{weight:"semibold",colour:j.colours.amber,children:["Bookings are paused ",Te.from,"\u2013",Te.to,Te.reason?` (${Te.reason})`:'']}),Se?(0,B.jsx)(T.Chip,{label:W?'Manager override on':'Override and book anyway',selected:W,onPress:()=>A(e=>!e)}):(0,B.jsx)(T.Muted,{children:"Ask a manager to override, or pick another time."})]}):null,pe.length?null:(0,B.jsx)(b.default,{testID:"nb-closed",children:(0,B.jsxs)(T.T,{size:14,weight:"semibold",colour:j.colours.amber,children:["Closed on ",(0,x.niceDate)(ue)," (per the venue\u2019s opening hours). Pick another date."]})}),(0,B.jsx)(D.MoreQuestions,{rid:u,r:c,value:te,onChange:se,party:_,date:M,time:U,today:(0,x.ymd)(h),bookings:F,audience:"staff",showTables:!1!==c.settings.tableRequests}),De&&!(0,P.accessibleSetUp)(ie)?(0,B.jsx)(T.T,{size:13,colour:j.colours.amber,children:"Step-free tables aren\u2019t marked yet (Managers \u203a Booking options \u203a Tables). Check the table works for a wheelchair."}):null,(0,B.jsx)(T.Field,{label:"Notes (optional)",value:Q,onChangeText:V,placeholder:I.NOTES_PLACEHOLDER,multiline:!0,numberOfLines:3,testID:"nb-notes"}),(0,i.depositDue)((0,i.depositOf)(c.settings),_)?(0,B.jsxs)(T.Muted,{children:["Deposit due: ",(0,a.gbp)((0,i.depositDue)((0,i.depositOf)(c.settings),_))," (",(0,a.gbp)((0,i.depositOf)(c.settings).perPersonPence)," per person for ",(0,i.depositOf)(c.settings).fromParty,"+). Deposits are paid through website bookings or to you, never in CoverCharge: tick Deposit paid on the booking once the guest has paid."]}):null,(0,B.jsxs)(T.Muted,{children:["The guest gets a confirmation text",X.trim()?' and email':''," automatically (preview mode: shown in the Outbox, not sent)."]}),ve?(0,B.jsxs)(T.T,{size:14,colour:j.colours.amber,children:["We already have the most dogs we can look after at ",U,". Try another time: dogs are very welcome then."]}):null,(0,B.jsx)(T.Button,{label:oe.length?oe[0]:'Save booking',testID:"nb-save",disabled:!Ce,onPress:()=>{if(M<(0,x.ymd)(h))return;const e=(0,D.needsPatch)(te),s=te.tableReq.find(e=>!re||ge.some(t=>t.table===e));f.repo.bookings.create({restaurantId:u,customerId:null,name:E.trim(),partySize:_,date:M,time:U,notes:Q.trim(),security:(0,i.depositDue)((0,i.depositOf)(c.settings),_)?'deposit':'none',depositPaid:0,...(0,i.depositDue)((0,i.depositOf)(c.settings),_)?{depositDue:(0,i.depositDue)((0,i.depositOf)(c.settings),_),depositPolicy:(0,i.depositWords)((0,i.depositOf)(c.settings),_,c.name).join(' '),depositRefundable:(0,i.depositOf)(c.settings).refundable,depositCutoffHours:(0,i.depositOf)(c.settings).cutoffHours}:{},phone:me.pretty,email:X.trim()||void 0,source:Z,...e,...pe.find(e=>e.time===U)?.drinksOnly?{drinksOnly:!0}:{},allergies:e.allergies??[],...re?{table:le??s??ge[0]?.table}:{}}).then(e=>(0,$.postNewBookingToKitchen)(e,O)).catch(()=>{}),d?.({date:M,time:U,name:E.trim()}),t()}})]})}},1120,[827,1121,1122,860,867,14,1123,34,859,402,102,872,1084,874,1124,1101,858,821,864,794,1025,1022,1125,1126,1131,1103,1097,1132,25]); @@ -1245,7 +1245,7 @@ __d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule' __d(function(g,_r,i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.gamesOn=function(){const e=b.useStore.getState().restaurants.find(e=>e.id===p.VENUE_RID);return!1!==e?.settings?.games},_e.useGameClock=I,_e.usePlayable=function(e,t){return(0,y.gamePlayable)(I(e,t))},Object.defineProperty(_e,"LENNY_GAME_URL",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"validGameUrl",{enumerable:!0,get:function(){return C}}),_e.gameBase=function(){const e=b.useStore.getState().restaurants.find(e=>e.id===p.VENUE_RID);return C(e?.settings?.gameUrl)??v},_e.BreakRoomCard=function({staffId:e,name:t,now:s}){const n=(0,b.useStore)(e=>!1!==e.restaurants.find(e=>e.id===p.VENUE_RID)?.settings?.games),[o,l]=(0,r.useState)(!1),c=I(e,s),u=(0,y.gamePlayable)(c);return n?(0,w.jsxs)(d.Card,{children:[(0,w.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(d.T,{weight:"semibold",children:"\ud83e\uded6 Break room"}),(0,w.jsx)(d.T,{size:13,colour:u?x.colours.ok:x.colours.muted,children:u?'Open':'Locked'})]}),(0,w.jsx)(d.Muted,{children:"Lenny\u2019s Kitchen Chaos, with the team as characters and a shared leaderboard. Playable on a break or when you\u2019re not clocked in."}),u?null:(0,w.jsx)(d.Muted,{testID:"break-room-locked-text",children:y.GAME_LOCKED_TEXT}),(0,w.jsx)(d.Button,{testID:"break-room-open",kind:"secondary",label:"Open the Break room",onPress:()=>l(!0)}),o?(0,w.jsx)(R,{staffId:e,name:t,playable:u,clock:c,onClose:()=>l(!1)}):null]}):null},Object.defineProperty(_e,"displayName",{enumerable:!0,get:function(){return T}}),_e.BreakRoom=R;var t=_r(_d[0]),s=_r(_d[1]),r=_r(_d[2]),n=e(r),o=e(_r(_d[3]));_r(_d[4]);var l=e(_r(_d[5])),c=e(_r(_d[6])),u=_r(_d[7]),d=_r(_d[8]),f=_r(_d[9]),m=_r(_d[10]),y=_r(_d[11]),h=_r(_d[12]),b=_r(_d[13]),p=_r(_d[14]),k=_r(_d[15]),j=_r(_d[16]),x=_r(_d[17]),w=_r(_d[18]);function I(e,t){const s=(0,m.useOwner)(e=>e.attendance);return(0,y.gameClock)(s,e,t)}const v='https://lennys-kitchen-chaos-13e285.deed.page/',C=e=>{try{const t=new URL(String(e??'').trim());return'https:'!==t.protocol||t.username||t.password?null:t.toString()}catch{return null}};function S(e){if('undefined'==typeof window)return null;const t=new URL(e);for(const e of['demo','unlock','name','staffId'])t.searchParams.delete(e);return t.searchParams.set('host','covercharge'),t.searchParams.set('hostOrigin',window.location.origin),{src:t.toString(),origin:t.origin}}const T=e=>String(e??'').replace(/\s*\(.*\)$/,'').replace(/\s+/g,' ').trim().slice(0,24).trim();function R({staffId:e,name:I,playable:R,clock:P,onClose:L,car:M}){const D=(0,m.useOwner)(e=>e.staff),O=(0,f.useAvatars)(e=>e.photos),_=(0,h.useSetup)(e=>e.looks),z=(0,r.useRef)(null),[N,U]=(0,r.useState)({}),[A,B]=(0,r.useState)(!1),[G,q]=(0,r.useState)(null),H=(0,b.useStore)(e=>C(e.restaurants.find(e=>e.id===p.VENUE_RID)?.settings?.gameUrl)??v),V=(0,r.useMemo)(()=>S(H),[H]),W=V?.origin??'',$=(0,j.useSync)(e=>'staff'===e.kind?e.staffRef??null:null),K=!(!$||!e||$===e),X=K?null:$??e??null,Y=T(I),[F,J]=(0,r.useState)(''),[Q,Z]=(0,r.useState)(null),ee=(0,r.useRef)(null),te=(0,r.useRef)(0),se=(0,r.useRef)(null),re=(0,r.useRef)(R);re.current=R;const ne=(0,r.useMemo)(()=>D.filter(e=>e.active&&!e.name.includes('(example)')),[D]);(0,r.useEffect)(()=>{const e=setTimeout(()=>{const e={};for(const s of ne){const r=null!=_[s.id]&&_[s.id]>=1e3?t.AVATAR_OPTIONS.find(e=>e.look===_[s.id]):void 0;if(r){e[s.id]=r.dataUrl;continue}const n=document.getElementById(`cc-av-${s.id}`)?.querySelector('svg');n&&(e[s.id]=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(n.outerHTML.includes('xmlns')?n.outerHTML:n.outerHTML.replace('clearTimeout(e)},[ne,_]);const oe=(0,r.useMemo)(()=>ne.map(e=>{const t=O[e.id]?.dataUrl??N[e.id],s={id:e.id,name:T(e.name),role:e.job||e.level||e.role};return t&&(s.avatarUrl=t),s}),[ne,O,N]),le=(0,r.useCallback)(e=>{try{W&&z.current?.contentWindow?.postMessage(e,W)}catch{}},[W]);return(0,r.useEffect)(()=>{const e=async e=>{if(!W||e.origin!==W||e.source!==z.current?.contentWindow)return;const t=e.data;if('string'!=typeof t?.type||!t.type.startsWith('lenny:'))return;if('lenny:ready'===t.type)return q('string'==typeof t.version?String(t.version).slice(0,12):null),void B(!0);const s=String(t.levelId??'').slice(0,40);if('lenny:scores:list'===t.type&&le({type:'lenny:scores:result',reqId:t.reqId,result:await(0,k.listScores)(s,Math.min(50,Number(t.limit)||10))}),'lenny:scores:submit'===t.type){const e=t.entry??{};if(!X||'string'==typeof e.staffId&&e.staffId!==X)return void le({type:'lenny:scores:result',reqId:t.reqId,result:{rank:null,entries:await(0,k.listScores)(s,10),id:null}});const r='string'==typeof e.characterId?e.characterId.slice(0,80):void 0;le({type:'lenny:scores:result',reqId:t.reqId,result:await(0,k.submitScore)(s,{score:Number(e.score)||0,stars:Number(e.stars)||0,badges:Array.isArray(e.badges)?e.badges.map(String).slice(0,30):[],stats:'object'==typeof e.stats&&e.stats?e.stats:{},characterId:r,character:'string'==typeof e.character?e.character.slice(0,60):void 0,staffId:X,name:Y})})}'lenny:roundAbandoned'===t.type&&J('The last round was stopped because the player changed. No score was saved.'),'lenny:roundStart'===t.type&&J(''),'lenny:progress'===t.type&&X&&t.staffId===X&&(0,k.saveProgress)(X,t.progress),'lenny:gameComplete'===t.type&&X&&t.staffId===X&&J(!0===t.firstTime?'Game complete! Character select is now unlocked.':'Game complete again. Nice work!')};return window.addEventListener('message',e),()=>window.removeEventListener('message',e)},[le,X,Y,W]),(0,r.useEffect)(()=>{B(!1),ee.current=null,se.current=null},[V?.src]),(0,r.useEffect)(()=>{if(!A)return;const e=e=>{se.current!==e&&(se.current=e,le({type:'lenny:setPlayable',playable:e}))},t=K?null:`${X??''}|${Y}`;if(t&&ee.current===t)return void e(R);const s=++te.current;ee.current=null,se.current&&e(!1),t&&(0,k.loadProgress)(X).catch(()=>null).then(r=>{s===te.current&&(le({type:'lenny:setPlayer',name:Y,staffId:X,...r?{progress:r}:{}}),ee.current=t,e(re.current))})},[A,K,X,Y,R,le]),(0,r.useEffect)(()=>{A&&le({type:'lenny:setRoster',staff:oe})},[A,oe,le]),(0,r.useEffect)(()=>{A&&null!==Q&&le({type:'lenny:setMuted',muted:Q})},[A,Q,le]),(0,w.jsx)(o.default,{visible:!0,animationType:"slide",onRequestClose:L,children:(0,w.jsxs)(c.default,{testID:"break-room",style:{flex:1,backgroundColor:(0,s.soutersSurface)('#000')},children:[M?(0,w.jsx)(E,{status:K?'Switching player\u2026':R?'Parked only \xb7 enjoy!':'Game locked',muted:!!Q,onPause:()=>le({type:'lenny:pause'}),onMute:()=>Z(!Q),onClose:L}):(0,w.jsxs)(d.Row,{style:{justifyContent:'space-between',padding:10,backgroundColor:x.colours.bg},children:[(0,w.jsx)(d.T,{weight:"semibold",children:"\ud83e\uded6 Break room"}),(0,w.jsx)(c.default,{testID:R&&!K?'break-playable':'break-locked',accessibilityLabel:G?`Game version ${G}`:void 0,children:(0,w.jsx)(d.T,{size:13,colour:R?x.colours.ok:x.colours.gold,children:K?'Switching player\u2026':R?'off'===P?'Off shift: enjoy!':'On your break: enjoy!':'Game locked'})}),(0,w.jsxs)(d.Row,{gap:4,children:[(0,w.jsx)(l.default,{testID:"break-room-mute",accessibilityRole:"button",accessibilityLabel:Q?'Turn sound and voice on':'Mute sound and voice',onPress:()=>Z(!Q),style:{padding:6},children:(0,w.jsx)(d.T,{weight:"semibold",colour:x.colours.gold,children:Q?'Sound on':'Mute'})}),(0,w.jsx)(l.default,{testID:"break-room-close",accessibilityRole:"button",onPress:L,style:{padding:6},children:(0,w.jsx)(d.T,{weight:"semibold",colour:x.colours.gold,children:"Close"})})]})]}),R||K?null:(0,w.jsx)(c.default,{testID:"break-locked-text",style:{paddingHorizontal:10,paddingVertical:6,backgroundColor:x.colours.surface},children:(0,w.jsx)(d.T,{size:13,colour:x.colours.text,children:y.GAME_LOCKED_TEXT})}),F?(0,w.jsx)(c.default,{testID:"break-notice",style:{paddingHorizontal:10,paddingVertical:6,backgroundColor:x.colours.surface},children:(0,w.jsx)(d.T,{size:13,colour:x.colours.muted,children:F})}):null,V?n.default.createElement('iframe',{ref:z,src:V.src,key:V.src,title:'Lenny\u2019s Kitchen Chaos','data-testid':'break-game',allow:'autoplay; fullscreen',style:{flex:1,width:'100%',height:'100%',border:0,background:'#000'}}):(0,w.jsx)(c.default,{style:{flex:1,alignItems:'center',justifyContent:'center'},children:(0,w.jsx)(d.Muted,{children:"The Break room opens in the web app."})}),(0,w.jsx)(c.default,{style:{position:'absolute',left:-9999,top:0,width:64,height:64,opacity:0},pointerEvents:"none",children:ne.map(e=>(0,w.jsx)(c.default,{nativeID:`cc-av-${e.id}`,children:(0,w.jsx)(u.AvatarLook,{look:_[e.id],id:e.id,name:e.name,size:96})},e.id))})]})})}function E({status:e,muted:t,onPause:s,onMute:r,onClose:n}){const o={minHeight:72,minWidth:150,paddingHorizontal:22,borderRadius:18,borderWidth:1.5,borderColor:x.colours.gold,alignItems:'center',justifyContent:'center'};return(0,w.jsxs)(c.default,{testID:"car-game-bar",style:{flexDirection:'row',alignItems:'center',gap:14,paddingHorizontal:16,paddingVertical:10,backgroundColor:x.colours.bg,borderBottomWidth:1,borderColor:x.colours.border},children:[(0,w.jsx)(l.default,{testID:"break-room-close",accessibilityRole:"button",accessibilityLabel:"Close the game",onPress:n,style:o,children:(0,w.jsx)(d.T,{size:20,weight:"semibold",colour:x.colours.gold,children:"Close"})}),(0,w.jsx)(l.default,{testID:"car-game-pause",accessibilityRole:"button",accessibilityLabel:"Pause the game",onPress:s,style:o,children:(0,w.jsx)(d.T,{size:20,weight:"semibold",colour:x.colours.gold,children:"Pause"})}),(0,w.jsxs)(c.default,{style:{flex:1,alignItems:'center',minWidth:0},children:[(0,w.jsx)(d.T,{size:22,weight:"semibold",center:!0,numberOfLines:1,children:"Lenny\u2019s Kitchen Chaos"}),(0,w.jsx)(d.T,{size:15,colour:x.colours.goldLight,center:!0,numberOfLines:1,children:`${e} \xb7 touch the big buttons on the game`})]}),(0,w.jsx)(l.default,{testID:"break-room-mute",accessibilityRole:"button",accessibilityLabel:t?'Turn sound and voice on':'Mute sound and voice',onPress:r,style:o,children:(0,w.jsx)(d.T,{size:20,weight:"semibold",colour:x.colours.gold,children:t?'Sound on':'Mute'})}),(0,w.jsx)(c.default,{testID:"car-game-parked",style:{...o,minWidth:0,borderColor:x.colours.goldMuted,backgroundColor:'rgba(201,162,74,0.12)'},children:(0,w.jsx)(d.T,{size:16,weight:"semibold",colour:x.colours.goldLight,children:"PARKED ONLY"})})]})}},1162,[928,828,34,395,236,402,102,925,794,926,891,1163,927,831,5,1164,987,821,25]); __d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"GAME_LOCKED_TEXT",{enumerable:!0,get:function(){return t}}),e.gameClock=function(t,n,o){if(!n)return'off';const a=new Date(o).getTime(),c=t.filter(t=>t.staffId===n&&t.in&&!t.out&&a-new Date(t.in).getTime()<72e6).sort((t,n)=>String(n.in).localeCompare(String(t.in)))[0];return c?c.breaks?.some(t=>!t.end)?'break':'working':'off'},Object.defineProperty(e,"gamePlayable",{enumerable:!0,get:function(){return n}});const t='You\u2019re clocked in, so the game is locked. Start your break or clock out in CoverCharge to play.';const n=t=>'working'!==t},1163,[]); __d(function(g,_r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.listScores=o,_e.submitScore=async function(e,t){const f=r.useSync.getState(),l=Math.max(0,Math.round(Number(t.score)||0));if(c()&&f.staffRef&&t.staffId===f.staffRef)try{const{data:r,error:s}=await a().from('game_scores').insert({venue_id:f.venueId,game:'lenny',level_id:e,staff_ref:f.staffRef??null,name:String(t.name||'Crew').replace(/\s+/g,' ').trim().slice(0,24),character_id:t.characterId??null,score:l,stars:Math.max(0,Math.min(3,Number(t.stars)||0)),stats:{...t.stats??{},badges:t.badges??[],character:t.character??null}}).select('id').single();if(s)throw s;const{count:n}=await a().from('game_scores').select('id',{count:'exact',head:!0}).eq('venue_id',f.venueId).eq('game','lenny').eq('level_id',e).gt('score',l);return{rank:(n??0)+1,entries:await o(e,10),id:r.id}}catch{}const u=await s.kv.get(n,{}),y=[...u[e]??[],{...t,score:l,date:(new Date).toISOString()}].sort((e,t)=>t.score-e.score).slice(0,50);return await s.kv.set(n,{...u,[e]:y}),{rank:y.findIndex(e=>e.score===l)+1,entries:y.slice(0,10),id:null}},_e.loadProgress=async function(e){if(!e)return null;const t=r.useSync.getState();if(l(e))try{const{data:r,error:s}=await a().from('game_progress').select('progress').eq('venue_id',t.venueId).eq('game','lenny').eq('staff_ref',e).maybeSingle();if(s)throw s;if(r)return v(r.progress)}catch{}return v((await s.kv.get(f,{}))[e])},Object.defineProperty(_e,"LENNY_LAST_WORLD",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"LENNY_LEVELS",{enumerable:!0,get:function(){return y}}),_e.cleanProgress=v,_e.saveProgress=async function(e,t){const n=v(t);if(!e||!n||JSON.stringify(n).length>16e3)return;const c=await s.kv.get(f,{});await s.kv.set(f,{...c,[e]:n});const o=r.useSync.getState();if(l(e))try{await a().from('game_progress').upsert({venue_id:o.venueId,game:'lenny',staff_ref:e,progress:n,updated_at:(new Date).toISOString()},{onConflict:'venue_id,game,staff_ref'})}catch{}};var e=_r(d[0]),t=_r(d[1]),r=_r(d[2]),s=_r(d[3]);const a=()=>(0,e.getSupabase)(),n='lenny:scores:v1',c=()=>(0,t.isSupabaseConfigured)()&&!!r.useSync.getState().venueId&&'staff'===r.useSync.getState().kind;async function o(e,t=10){if(c())try{const{data:s,error:n}=await a().from('game_scores').select('*').eq('venue_id',r.useSync.getState().venueId).eq('game','lenny').eq('level_id',e).order('score',{ascending:!1}).limit(t);if(n)throw n;return(s??[]).map(e=>({name:e.name,staffId:e.staff_ref,characterId:e.character_id??void 0,character:e.stats?.character,score:e.score,stars:e.stars,badges:e.stats?.badges??[],stats:e.stats,date:e.created_at}))}catch{}return((await s.kv.get(n,{}))[e]??[]).sort((e,t)=>t.score-e.score).slice(0,t)}const f='lenny:progress:v1',l=e=>{const t=r.useSync.getState();return c()&&!!t.staffRef&&e===t.staffRef};const u='festival',y=['mop','dsoap','dish','dtower','dscrub','mussels','ppeel','pfifo','bin1','bin2','bin3','mothersday','bin4','creel1','creel2','dsundae','dplate','pass','rush','delivery','death','line','steak','festival'];function v(e){if(!e||'object'!=typeof e||Array.isArray(e))return null;const t=e,r=e=>('string'==typeof e||'number'==typeof e)&&String(e).length>0&&String(e).length<=60?String(e):null,s={};if(t.stars&&'object'==typeof t.stars&&!Array.isArray(t.stars))for(const[e,a]of Object.entries(t.stars).slice(0,300)){const t=r(e),n=Math.max(0,Math.min(3,Math.floor(Number(a)||0)));t&&(s[t]=n)}const a={},n=t.badges;if(Array.isArray(n))for(const e of n.slice(0,100)){const t=r(e);t&&(a[t]=!0)}else if(n&&'object'==typeof n)for(const[e,t]of Object.entries(n).slice(0,100)){const s=r(e);s&&t&&(a[s]=!0)}const c={stars:s,badges:a,charactersUnlocked:!0===t.charactersUnlocked};return'number'==typeof t.v&&Number.isInteger(t.v)&&t.v>=0&&t.v<=9999&&(c.v=t.v),Array.isArray(t.legacyWorlds)&&t.legacyWorlds.length<=50&&t.legacyWorlds.every(e=>null!==r(e)&&'string'==typeof e)&&(c.legacyWorlds=[...t.legacyWorlds]),c}},1164,[933,976,987,977]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.KitchenRotaEditor=function({today:e=(0,o.ymd)(new Date)}){const $=(0,a.useOwner)(e=>e.staff),j=(0,a.useOwner)(e=>e.shifts),p=(0,t.useMemo)(()=>(0,l.kitchenTeam)($),[$]),k=(0,t.useMemo)(()=>new Set(p.map(e=>e.id)),[p]),[S,I]=(0,t.useState)(0),[w,D]=(0,t.useState)(null),[v,T]=(0,t.useState)(''),H=(0,a.addDays)((0,a.mondayOfDate)(e),7*S),C=(0,a.addDays)(H,6),P=u.map((e,t)=>(0,a.addDays)(H,t)),L=(0,l.kitchenPending)(j,k,H,C).length,M=e=>{T(e),(0,d.announce)(e)},R=0===S?'This week':1===S?'Next week':-1===S?'Last week':`Week of ${b(H)}`;return(0,h.jsxs)(i.default,{testID:"kitchen-rota-editor",style:{gap:10,alignItems:'center'},children:[(0,h.jsx)(n.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Kitchen rota"}),(0,h.jsxs)(n.Row,{gap:8,style:{justifyContent:'center',alignItems:'center'},children:[(0,h.jsx)(n.Button,{small:!0,kind:"ghost",testID:"krota-prev",label:"\u2039 Prev",accessibilityLabel:"Previous week",onPress:()=>{I(S-1),T('')},style:{minWidth:84,minHeight:48}}),(0,h.jsxs)(i.default,{accessible:!0,accessibilityLabel:`${R}, ${f[0]} ${b(H)} to ${f[6]} ${b(C)}`,style:{alignItems:'center',minWidth:120},children:[(0,h.jsx)(n.T,{weight:"semibold",center:!0,children:R}),(0,h.jsxs)(n.Muted,{center:!0,children:[m(H)," \u2013 ",m(C)]})]}),(0,h.jsx)(n.Button,{small:!0,kind:"ghost",testID:"krota-next",label:"Next \u203a",accessibilityLabel:"Next week",onPress:()=>{I(S+1),T('')},style:{minWidth:84,minHeight:48}})]}),p.map(t=>(0,h.jsxs)(i.default,{testID:"krota-row",style:{gap:4,alignItems:'center',alignSelf:'stretch'},children:[(0,h.jsxs)(n.T,{size:14,weight:"semibold",center:!0,children:[y(t.nickname||t.name),t.job?(0,h.jsx)(n.T,{size:12,colour:c.colours.muted,children:` ${t.job}`}):null]}),(0,h.jsx)(n.Row,{gap:4,style:{justifyContent:'center',flexWrap:'nowrap'},children:P.map((i,a)=>{const l=j.find(e=>e.staffId===t.id&&e.date===i),o=!(!l||l.published&&!l.changed),d=`${y(t.nickname||t.name)}, ${f[a]} ${b(i)}, ${l?`${(0,r.fmtH)(l.start)} to ${(0,r.fmtH)(l.end)}${o?', draft, not published yet':''}. Change shift`:'off. Add a shift'}`;return(0,h.jsxs)(s.default,{testID:`krota-cell-${t.id}-${a}`,accessibilityRole:"button",accessibilityLabel:d,onPress:()=>D({staffId:t.id,date:i,shift:l}),style:({pressed:e})=>({width:44,minHeight:52,borderRadius:8,paddingVertical:4,alignItems:'center',justifyContent:'center',borderWidth:1,borderStyle:o?'dashed':'solid',borderColor:l?o?c.colours.amber:c.colours.gold:c.colours.border,backgroundColor:e||l?c.colours.goldTint:c.colours.surface2}),children:[(0,h.jsx)(n.T,{size:10,center:!0,colour:i===e?c.colours.gold:c.colours.muted,children:u[a]}),(0,h.jsx)(n.T,{size:10,center:!0,children:l?`${(0,r.fmtH)(l.start).slice(0,5)}`:'off'}),l?(0,h.jsx)(n.T,{size:10,center:!0,children:(0,r.fmtH)(l.end).slice(0,5)}):(0,h.jsx)(n.T,{size:10,center:!0,colour:c.colours.muted,children:"+"})]},i)})})]},t.id)),p.length?null:(0,h.jsx)(n.Muted,{center:!0,children:"No kitchen team on the staff list yet."}),(0,h.jsx)(n.Button,{testID:"krota-publish",kind:L?'primary':'secondary',disabled:!L,label:L?`Publish kitchen rota (${L} ${1===L?'change':'changes'})`:'Kitchen rota published',accessibilityLabel:L?`Publish the kitchen rota for ${R.toLowerCase()}, ${L} ${1===L?'change':'changes'}`:'Kitchen rota published for this week',onPress:()=>{const e=(0,l.publishKitchen)(a.useOwner.getState().shifts,k,H,C);a.useOwner.getState().setShifts(e.shifts),M(e.n?`Published ${e.n} kitchen ${1===e.n?'shift':'shifts'}. The kitchen team see them in their app now.`:'Nothing new to publish this week.')},style:{minHeight:56,alignSelf:'stretch'}}),v?(0,h.jsx)(i.default,{testID:"krota-msg",children:(0,h.jsx)(n.T,{center:!0,colour:c.colours.goldLight,children:v})}):null,(0,h.jsx)(n.Muted,{center:!0,children:"Tap a day to add or change a shift. Dashed amber = draft, only you see it until you publish. Front of house shifts are made in CoverCharge for Managers."}),w?(0,h.jsx)(x,{init:w,onClose:()=>D(null),onSaid:M}):null]})};var t=_r(_d[0]),s=e(_r(_d[1])),i=e(_r(_d[2])),n=_r(_d[3]),a=_r(_d[4]),l=_r(_d[5]),r=_r(_d[6]),o=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]);const u=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],f=['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'],m=e=>`${e.slice(8,10)}/${e.slice(5,7)}`,b=e=>`${e.slice(8,10)}/${e.slice(5,7)}/${e.slice(0,4)}`,y=e=>e.replace(/\s*\(.*\)$/,''),$=[['Lunch',11,16],['Dinner',16.5,22.5],['Double',11,21],['Close',17,23.5]];function x({init:e,onClose:s,onSaid:d}){const u=(0,a.useOwner)(t=>t.staff.find(t=>t.id===e.staffId)),f=y(u?.nickname||u?.name||''),[m,x]=(0,t.useState)(e.shift?.start??11),[j,p]=(0,t.useState)(e.shift?.end??21),[k,S]=(0,t.useState)(!1),[I,w]=(0,t.useState)(''),D=`${(0,o.niceDate)((0,o.parseYmd)(e.date))} (${b(e.date)})`;return(0,h.jsx)(n.Sheet,{visible:!0,onClose:s,title:`${f} \xb7 ${D}`,testID:"krota-sheet",children:(0,h.jsxs)(i.default,{style:{gap:10,alignItems:'center'},children:[(0,h.jsx)(n.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:$.map(([e,t,s])=>(0,h.jsx)(n.Chip,{testID:`krota-preset-${e.toLowerCase()}`,label:`${e} ${(0,r.fmtH)(t)}\u2013${(0,r.fmtH)(s)}`,selected:m===t&&j===s,onPress:()=>{x(t),p(s)}},e))}),(0,h.jsx)(n.T,{center:!0,children:"Start"}),(0,h.jsx)(n.Stepper,{testID:"krota-start",value:m,step:.5,min:r.SHIFT_MIN_START,max:j-1,onChange:x,format:r.fmtH,label:"Start time"}),(0,h.jsxs)(n.T,{center:!0,children:["End",j>=24?' (next day)':'']}),(0,h.jsx)(n.Stepper,{testID:"krota-end",value:j,step:.5,min:m+1,max:r.SHIFT_MAX_END,onChange:p,format:r.fmtH,label:"End time"}),(0,h.jsxs)(n.Muted,{center:!0,children:[(j-m).toFixed(1)," hours"]}),I?(0,h.jsx)(i.default,{accessibilityLiveRegion:"assertive",children:(0,h.jsx)(n.T,{center:!0,colour:c.colours.amber,children:I})}):null,(0,h.jsx)(n.Button,{testID:"krota-save",label:e.shift?'Save shift':'Add shift',accessibilityLabel:`${e.shift?'Save':'Add'} ${f}'s shift, ${D}, ${(0,r.fmtH)(m)} to ${(0,r.fmtH)(j)}`,onPress:()=>{const t=a.useOwner.getState();(0,l.clashes)(t.shifts,e.staffId,e.date,m,j,e.shift?.id)?w(`${f} already has a shift that overlaps on ${D}.`):(e.shift?t.setShifts(t.shifts.map(t=>t.id===e.shift.id?{...t,start:m,end:j,changed:!!t.published||t.changed}:t)):t.addShift({staffId:e.staffId,date:e.date,start:m,end:j}),d(`${e.shift?'Changed':'Added'}: ${f}, ${D}, ${(0,r.fmtH)(m)} to ${(0,r.fmtH)(j)}. Draft until you publish the kitchen rota.`),s())},style:{minHeight:56,alignSelf:'stretch'}}),e.shift&&!k?(0,h.jsx)(n.Button,{testID:"krota-remove",kind:"danger",label:"Remove shift",onPress:()=>S(!0),style:{minHeight:52,alignSelf:'stretch'}}):null,e.shift&&k?(0,h.jsxs)(i.default,{testID:"krota-remove-ask",accessibilityLiveRegion:"assertive",style:{gap:8,alignItems:'center',alignSelf:'stretch'},children:[(0,h.jsxs)(n.T,{center:!0,weight:"semibold",children:["Remove ",f,"\u2019s shift on ",D,"?"]}),(0,h.jsx)(n.Button,{testID:"krota-remove-yes",kind:"danger",label:"Yes, remove it",onPress:()=>{a.useOwner.getState().removeShift(e.shift.id),d(`Removed ${f}'s shift on ${D}.`),s()},style:{minHeight:52,alignSelf:'stretch'}}),(0,h.jsx)(n.Button,{testID:"krota-remove-no",kind:"secondary",label:"No, keep it",onPress:()=>S(!1),style:{minHeight:52,alignSelf:'stretch'}})]}):null]})})}},1165,[34,402,102,794,891,988,1087,858,1166,821,25]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.KitchenRotaEditor=p,_e.KitchenRotaTab=function({today:e=(0,h.ymd)(new Date)}){const t=(0,r.canEditKitchenRota)((0,d.useSync)(e=>e.perms));return(0,m.jsx)(i.default,{testID:"chef-rota-tab",style:{alignSelf:'stretch',alignItems:'center'},children:t?(0,m.jsx)(p,{today:e}):(0,m.jsx)(w,{today:e})})},_e.KitchenRotaRead=w;var t=_r(_d[0]),s=e(_r(_d[1])),i=e(_r(_d[2])),n=_r(_d[3]),a=_r(_d[4]),r=_r(_d[5]),l=_r(_d[6]),o=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]),u=_r(_d[11]),f=_r(_d[12]),m=_r(_d[13]);const y=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],b=['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'],x=e=>`${e.slice(8,10)}/${e.slice(5,7)}`,j=e=>`${e.slice(8,10)}/${e.slice(5,7)}/${e.slice(0,4)}`,$=e=>e.replace(/\s*\(.*\)$/,''),k=[['Lunch',11,16],['Dinner',16.5,22.5],['Double',11,21],['Close',17,23.5]];function p({today:e=(0,h.ymd)(new Date)}){const l=(0,a.useOwner)(e=>e.staff),o=(0,a.useOwner)(e=>e.shifts),d=(0,t.useMemo)(()=>(0,r.kitchenTeam)(l),[l]),k=(0,t.useMemo)(()=>new Set(d.map(e=>e.id)),[d]),[p,w]=(0,t.useState)(0),[I,D]=(0,t.useState)(null),[T,v]=(0,t.useState)(''),H=(0,a.addDays)((0,a.mondayOfDate)(e),7*p),C=(0,a.addDays)(H,6),L=y.map((e,t)=>(0,a.addDays)(H,t)),P=(0,r.kitchenPending)(o,k,H,C).length,R=e=>{v(e),(0,u.announce)(e)},M=0===p?'This week':1===p?'Next week':-1===p?'Last week':`Week of ${j(H)}`;return(0,m.jsxs)(i.default,{testID:"kitchen-rota-editor",style:{gap:10,alignItems:'center'},children:[(0,m.jsx)(n.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Kitchen rota"}),(0,m.jsxs)(n.Row,{gap:8,style:{justifyContent:'center',alignItems:'center'},children:[(0,m.jsx)(n.Button,{small:!0,kind:"ghost",testID:"krota-prev",label:"\u2039 Prev",accessibilityLabel:"Previous week",onPress:()=>{w(p-1),v('')},style:{minWidth:84,minHeight:48}}),(0,m.jsxs)(i.default,{accessible:!0,accessibilityLabel:`${M}, ${b[0]} ${j(H)} to ${b[6]} ${j(C)}`,style:{alignItems:'center',minWidth:120},children:[(0,m.jsx)(n.T,{weight:"semibold",center:!0,children:M}),(0,m.jsxs)(n.Muted,{center:!0,children:[x(H)," \u2013 ",x(C)]})]}),(0,m.jsx)(n.Button,{small:!0,kind:"ghost",testID:"krota-next",label:"Next \u203a",accessibilityLabel:"Next week",onPress:()=>{w(p+1),v('')},style:{minWidth:84,minHeight:48}})]}),d.map(t=>(0,m.jsxs)(i.default,{testID:"krota-row",style:{gap:4,alignItems:'center',alignSelf:'stretch'},children:[(0,m.jsxs)(n.T,{size:14,weight:"semibold",center:!0,children:[$(t.nickname||t.name),t.job?(0,m.jsx)(n.T,{size:12,colour:f.colours.muted,children:` ${t.job}`}):null]}),(0,m.jsx)(n.Row,{gap:4,style:{justifyContent:'center',flexWrap:'nowrap'},children:L.map((i,a)=>{const r=o.find(e=>e.staffId===t.id&&e.date===i),l=!(!r||r.published&&!r.changed),d=`${$(t.nickname||t.name)}, ${b[a]} ${j(i)}, ${r?`${(0,c.fmtH)(r.start)} to ${(0,c.fmtH)(r.end)}${l?', draft, not published yet':''}. Change shift`:'off. Add a shift'}`;return(0,m.jsxs)(s.default,{testID:`krota-cell-${t.id}-${a}`,accessibilityRole:"button",accessibilityLabel:d,onPress:()=>D({staffId:t.id,date:i,shift:r}),style:({pressed:e})=>({width:44,minHeight:52,borderRadius:8,paddingVertical:4,alignItems:'center',justifyContent:'center',borderWidth:1,borderStyle:l?'dashed':'solid',borderColor:r?l?f.colours.amber:f.colours.gold:f.colours.border,backgroundColor:e||r?f.colours.goldTint:f.colours.surface2}),children:[(0,m.jsx)(n.T,{size:10,center:!0,colour:i===e?f.colours.gold:f.colours.muted,children:y[a]}),(0,m.jsx)(n.T,{size:10,center:!0,children:r?`${(0,c.fmtH)(r.start).slice(0,5)}`:'off'}),r?(0,m.jsx)(n.T,{size:10,center:!0,children:(0,c.fmtH)(r.end).slice(0,5)}):(0,m.jsx)(n.T,{size:10,center:!0,colour:f.colours.muted,children:"+"})]},i)})})]},t.id)),d.length?null:(0,m.jsx)(n.Muted,{center:!0,children:"No kitchen team on the staff list yet."}),(0,m.jsx)(n.Button,{testID:"krota-publish",kind:P?'primary':'secondary',disabled:!P,label:P?`Publish kitchen rota (${P} ${1===P?'change':'changes'})`:'Kitchen rota published',accessibilityLabel:P?`Publish the kitchen rota for ${M.toLowerCase()}, ${P} ${1===P?'change':'changes'}`:'Kitchen rota published for this week',onPress:()=>{const e=(0,r.publishKitchen)(a.useOwner.getState().shifts,k,H,C);a.useOwner.getState().setShifts(e.shifts),R(e.n?`Published ${e.n} kitchen ${1===e.n?'shift':'shifts'}. The kitchen team see them in their app now.`:'Nothing new to publish this week.')},style:{minHeight:56,alignSelf:'stretch'}}),T?(0,m.jsx)(i.default,{testID:"krota-msg",children:(0,m.jsx)(n.T,{center:!0,colour:f.colours.goldLight,children:T})}):null,(0,m.jsx)(n.Muted,{center:!0,children:"Tap a day to add or change a shift. Dashed amber = draft, only you see it until you publish. Front of house shifts are made in CoverCharge for Managers."}),I?(0,m.jsx)(S,{init:I,onClose:()=>D(null),onSaid:R}):null]})}function w({today:e=(0,h.ymd)(new Date)}){const{staff:s,shifts:r}=(0,o.rotaView)('chef',(0,a.useOwner)(e=>e.staff),(0,a.useOwner)(e=>e.shifts)),d=(0,a.useOwner)(e=>e.leave),[u,k]=(0,t.useState)(0),p=(0,a.addDays)((0,a.mondayOfDate)(e),7*u),w=(0,a.addDays)(p,6),S=y.map((e,t)=>(0,a.addDays)(p,t)),I=s.filter(e=>/kitchen|chef|kp/i.test(`${e.job??''} ${e.name}`)),D=0===u?'This week':1===u?'Next week':-1===u?'Last week':`Week of ${j(p)}`,[T,v]=(0,t.useState)(0),H=T?Math.max(30,Math.min(44,Math.floor((T-12)/7))):40;return(0,m.jsxs)(i.default,{testID:"kitchen-rota-read",onLayout:e=>v(e.nativeEvent.layout.width),style:{gap:10,alignItems:'center',alignSelf:'stretch'},children:[(0,m.jsx)(n.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Kitchen rota"}),(0,m.jsxs)(n.Row,{gap:8,style:{justifyContent:'center',alignItems:'center'},children:[(0,m.jsx)(n.Button,{small:!0,kind:"ghost",testID:"krota-read-prev",label:"\u2039 Prev",accessibilityLabel:"Previous week",onPress:()=>k(u-1),style:{minWidth:84,minHeight:48}}),(0,m.jsxs)(i.default,{accessible:!0,accessibilityLabel:`${D}, ${b[0]} ${j(p)} to ${b[6]} ${j(w)}`,style:{alignItems:'center',minWidth:120},children:[(0,m.jsx)(n.T,{weight:"semibold",center:!0,children:D}),(0,m.jsxs)(n.Muted,{center:!0,children:[x(p)," \u2013 ",x(w)]})]}),(0,m.jsx)(n.Button,{small:!0,kind:"ghost",testID:"krota-read-next",label:"Next \u203a",accessibilityLabel:"Next week",onPress:()=>k(u+1),style:{minWidth:84,minHeight:48}})]}),I.map(t=>(0,m.jsxs)(i.default,{testID:"krota-read-row",style:{gap:4,alignItems:'center',alignSelf:'stretch'},children:[(0,m.jsx)(n.T,{size:14,weight:"semibold",center:!0,children:$(t.nickname||t.name)}),(0,m.jsx)(n.Row,{gap:2,style:{justifyContent:'center',flexWrap:'nowrap'},children:S.map((s,a)=>{const o=r.find(e=>e.staffId===t.id&&e.date===s),h=o?(0,l.leaveCovering)(d,t.id,s):void 0,u=o?h?(0,l.leaveLabel)(h):`${(0,c.fmtH)(o.start)} to ${(0,c.fmtH)(o.end)}`:'off';return(0,m.jsxs)(i.default,{testID:`krota-read-cell-${t.id}-${a}`,accessible:!0,accessibilityLabel:`${$(t.nickname||t.name)}, ${b[a]} ${j(s)}, ${u}`,style:{width:H,minHeight:52,borderRadius:8,paddingVertical:4,paddingHorizontal:0,alignItems:'center',justifyContent:'center',borderWidth:1,borderColor:o?f.colours.gold:f.colours.border,backgroundColor:o?f.colours.goldTint:f.colours.surface2},children:[(0,m.jsx)(n.T,{size:10,center:!0,colour:s===e?f.colours.gold:f.colours.muted,children:y[a]}),o&&h?(0,m.jsx)(n.T,{size:9,center:!0,colour:f.colours.blue,children:(0,l.leaveLabel)(h).toLowerCase()}):(0,m.jsx)(n.T,{size:10,center:!0,children:o?(0,c.fmtH)(o.start).slice(0,5):'off'}),o&&!h?(0,m.jsx)(n.T,{size:10,center:!0,children:(0,c.fmtH)(o.end).slice(0,5)}):null]},s)})})]},t.id)),I.length?null:(0,m.jsx)(n.Muted,{center:!0,children:"No kitchen shifts on the rota yet."}),(0,m.jsx)(n.Muted,{center:!0,children:"This shows published shifts only. To change the kitchen rota here, an owner can tick \u201cMake the kitchen rota\u201d for you on the Permissions screen."})]})}function S({init:e,onClose:s,onSaid:l}){const o=(0,a.useOwner)(t=>t.staff.find(t=>t.id===e.staffId)),d=$(o?.nickname||o?.name||''),[u,y]=(0,t.useState)(e.shift?.start??11),[b,x]=(0,t.useState)(e.shift?.end??21),[p,w]=(0,t.useState)(!1),[S,I]=(0,t.useState)(''),D=`${(0,h.niceDate)((0,h.parseYmd)(e.date))} (${j(e.date)})`;return(0,m.jsx)(n.Sheet,{visible:!0,onClose:s,title:`${d} \xb7 ${D}`,testID:"krota-sheet",children:(0,m.jsxs)(i.default,{style:{gap:10,alignItems:'center'},children:[(0,m.jsx)(n.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:k.map(([e,t,s])=>(0,m.jsx)(n.Chip,{testID:`krota-preset-${e.toLowerCase()}`,label:`${e} ${(0,c.fmtH)(t)}\u2013${(0,c.fmtH)(s)}`,selected:u===t&&b===s,onPress:()=>{y(t),x(s)}},e))}),(0,m.jsx)(n.T,{center:!0,children:"Start"}),(0,m.jsx)(n.Stepper,{testID:"krota-start",value:u,step:.5,min:c.SHIFT_MIN_START,max:b-1,onChange:y,format:c.fmtH,label:"Start time"}),(0,m.jsxs)(n.T,{center:!0,children:["End",b>=24?' (next day)':'']}),(0,m.jsx)(n.Stepper,{testID:"krota-end",value:b,step:.5,min:u+1,max:c.SHIFT_MAX_END,onChange:x,format:c.fmtH,label:"End time"}),(0,m.jsxs)(n.Muted,{center:!0,children:[(b-u).toFixed(1)," hours"]}),S?(0,m.jsx)(i.default,{accessibilityLiveRegion:"assertive",children:(0,m.jsx)(n.T,{center:!0,colour:f.colours.amber,children:S})}):null,(0,m.jsx)(n.Button,{testID:"krota-save",label:e.shift?'Save shift':'Add shift',accessibilityLabel:`${e.shift?'Save':'Add'} ${d}'s shift, ${D}, ${(0,c.fmtH)(u)} to ${(0,c.fmtH)(b)}`,onPress:()=>{const t=a.useOwner.getState();(0,r.clashes)(t.shifts,e.staffId,e.date,u,b,e.shift?.id)?I(`${d} already has a shift that overlaps on ${D}.`):(e.shift?t.setShifts(t.shifts.map(t=>t.id===e.shift.id?{...t,start:u,end:b,changed:!!t.published||t.changed}:t)):t.addShift({staffId:e.staffId,date:e.date,start:u,end:b}),l(`${e.shift?'Changed':'Added'}: ${d}, ${D}, ${(0,c.fmtH)(u)} to ${(0,c.fmtH)(b)}. Draft until you publish the kitchen rota.`),s())},style:{minHeight:56,alignSelf:'stretch'}}),e.shift&&!p?(0,m.jsx)(n.Button,{testID:"krota-remove",kind:"danger",label:"Remove shift",onPress:()=>w(!0),style:{minHeight:52,alignSelf:'stretch'}}):null,e.shift&&p?(0,m.jsxs)(i.default,{testID:"krota-remove-ask",accessibilityLiveRegion:"assertive",style:{gap:8,alignItems:'center',alignSelf:'stretch'},children:[(0,m.jsxs)(n.T,{center:!0,weight:"semibold",children:["Remove ",d,"\u2019s shift on ",D,"?"]}),(0,m.jsx)(n.Button,{testID:"krota-remove-yes",kind:"danger",label:"Yes, remove it",onPress:()=>{a.useOwner.getState().removeShift(e.shift.id),l(`Removed ${d}'s shift on ${D}.`),s()},style:{minHeight:52,alignSelf:'stretch'}}),(0,m.jsx)(n.Button,{testID:"krota-remove-no",kind:"secondary",label:"No, keep it",onPress:()=>w(!1),style:{minHeight:52,alignSelf:'stretch'}})]}):null]})})}},1165,[34,402,102,794,891,988,1094,993,987,1087,858,1166,821,25]); __d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.primeAnnouncer=function(){u()},_e.announce=function(t){const e=String(t??'').trim();if(!e)return;{const t=u();if(!t)return;const n=++o;return t.textContent='',void setTimeout(()=>{n===o&&(t.textContent=e)},80)}},Object.defineProperty(_e,"lastAnnounced",{enumerable:!0,get:function(){return c}});var t,e=r(d[0]);(t=e)&&t.__esModule;r(d[1]);let n=null,o=0;function u(){if('undefined'==typeof document||!document.body)return null;if(n&&document.body.contains(n))return n;const t=document.createElement('div');return t.id='cc-announcer',t.setAttribute('aria-live','assertive'),t.setAttribute('aria-atomic','true'),t.setAttribute('role','status'),t.setAttribute('data-testid','cc-announcer'),Object.assign(t.style,{position:'absolute',width:'1px',height:'1px',margin:'-1px',padding:'0',overflow:'hidden',clip:'rect(0 0 0 0)',whiteSpace:'nowrap',border:'0'}),document.body.appendChild(t),n=t,t}const c=()=>n?.textContent??''},1166,[281,236]); __d(function(g,r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useSuggestions=j,_e.OrdersScreen=function({focus:e}={}){const[s,t]=(0,n.useState)('sheets');return(0,x.jsxs)(l.default,{style:{gap:12},children:[(0,x.jsx)(y.Seg,{value:s,onChange:t,options:[{id:'sheets',label:'Order sheets'},{id:'suggested',label:'Suggested orders'},{id:'history',label:'Order history'}]}),'sheets'===s?(0,x.jsx)(m.OrderSheets,{focus:e}):'suggested'===s?(0,x.jsx)(w,{}):(0,x.jsx)($,{})]})};var s=r(_d[0]),t=r(_d[1]),n=r(_d[2]),i=e(r(_d[3])),l=e(r(_d[4])),d=r(_d[5]),o=r(_d[6]),u=r(_d[7]),c=r(_d[8]),h=r(_d[9]),p=r(_d[10]),y=r(_d[11]),f=r(_d[12]),m=r(_d[13]),x=r(_d[14]);const b=(e,s)=>'kg'===s?Math.ceil(2*e)/2:Math.ceil(e);function j(){const{k:e,now:s,rid:n}=(0,y.useChef)(6e4),{pct:i}=(0,y.useForecast)(),l=(0,u.supplierView)('chef',(0,o.useOwner)(e=>e.suppliers)).filter(e=>!e.archived),d=1+Math.max(0,i)/100;return l.map(i=>{const l=e.ingredients.filter(e=>e.supplierId===i.id).map(e=>({i:e,qty:(0,t.fishInStone)(n,e)?(0,t.fromStone)(Math.ceil(2*(0,t.toStone)(Math.max(0,e.par*d-e.onHand),e.unit))/2,e.unit):b(Math.max(0,e.par*d-e.onHand),e.unit)})).filter(e=>e.qty>0),o=(0,p.weekday)(s),u=i.orderDays.includes(o),[c,h]=(i.cutoff||'23:59').split(':').map(Number),y=new Date(s);y.setHours(c,h,0,0);const f=e.orders.some(e=>e.supplierId===i.id&&new Date(e.at).toDateString()===s.toDateString()),m=[1,2,3,4,5,6,7].map(e=>(o+e)%7).find(e=>i.orderDays.includes(e));return{s:i,lines:l,ordersToday:u,cutPassed:s>y,placedToday:f,nextDay:m,total:Math.round(l.reduce((e,s)=>e+s.qty*s.i.cost,0))}}).filter(e=>e.lines.length||e.ordersToday)}function w(){const{me:e,rid:o}=(0,y.useChef)(),{label:u,covers:m,enough:b,booked:w}=(0,y.useForecast)(),$=(0,f.useKitchen)(e=>e.addOrder),S=j(),[C,M]=(0,n.useState)({}),[O,k]=(0,n.useState)('');return(0,x.jsxs)(l.default,{style:{gap:10},children:[(0,x.jsxs)(d.Muted,{children:[b?`Built from par levels and today's forecast (${m} Covers, ${u} vs a typical day).`:`Built from par levels (no forecast yet: not enough history; ${w} Covers booked so far).`," Adjust, then call the supplier or use their ordering website. Nothing is sent by CoverCharge."]}),O?(0,x.jsx)(d.Banner,{kind:"success",title:"Saved to order history",children:O}):null,S.map(({s:n,lines:u,ordersToday:y,cutPassed:f,placedToday:m,nextDay:b,total:j})=>{const w=u.map(e=>({...e,q:C[`${n.id}:${e.i.id}`]??e.qty})),S=Math.round(w.reduce((e,s)=>e+s.q*s.i.cost,0)),O=s=>{$({supplierId:n.id,by:e,status:s,lines:w.filter(e=>e.q>0).map(e=>({ing:e.i.id,qty:e.q,cost:e.i.cost})),total:S}),k(`${n.name}: ${(0,c.gbp)(S)} (${s}).`)};return(0,x.jsxs)(d.Card,{highlight:!y||m||f?void 0:h.colours.gold,children:[(0,x.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsxs)(l.default,{style:{flex:1},children:[(0,x.jsx)(d.T,{weight:"semibold",children:n.name}),(0,x.jsxs)(d.Muted,{children:[n.category," \xb7 min order ",(0,c.gbp)(n.minOrder)]})]}),m?(0,x.jsx)(d.Badge,{kind:"ok",label:"ORDERED TODAY"}):y?(0,x.jsx)(d.Badge,{kind:f?'red':'amber',label:f?`CUT-OFF ${n.cutoff} PASSED`:`ORDER BY ${n.cutoff}`}):(0,x.jsx)(d.Badge,{label:`NEXT ${null!=b?p.DAY3[b].toUpperCase():'\u2014'}`})]}),w.length?w.map(e=>(0,x.jsxs)(d.Row,{wrap:!0,style:{justifyContent:'space-between'},children:[(0,x.jsxs)(l.default,{style:{flex:1},children:[(0,x.jsx)(d.T,{size:14,children:e.i.name}),(0,x.jsxs)(d.Muted,{children:["On hand ",(0,s.ingredientQty)(o,e.i,e.i.onHand)," \xb7 par ",(0,s.ingredientQty)(o,e.i,e.i.par)]})]}),(0,x.jsx)(d.Button,{small:!0,kind:"ghost",label:"Less",accessibilityLabel:`${(0,t.fishInStone)(o,e.i)?'Half a stone less':'Less'} ${e.i.name}`,onPress:()=>M(s=>({...s,[`${n.id}:${e.i.id}`]:(0,t.stepQuantity)(o,e.i,e.q,-1)}))}),(0,x.jsx)(l.default,{accessible:!0,accessibilityLabel:(0,s.ingredientSpeech)(o,e.i,e.q),children:(0,x.jsx)(d.T,{size:16,style:{minWidth:76,textAlign:'center'},children:(0,s.ingredientQty)(o,e.i,e.q)})}),(0,x.jsx)(d.Button,{small:!0,kind:"ghost",label:"More",accessibilityLabel:`${(0,t.fishInStone)(o,e.i)?'Half a stone more':'More'} ${e.i.name}`,onPress:()=>M(s=>({...s,[`${n.id}:${e.i.id}`]:(0,t.stepQuantity)(o,e.i,e.q,1)}))})]},e.i.id)):(0,x.jsx)(d.Muted,{children:"Everything is at par."}),w.length?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsxs)(d.T,{weight:"semibold",children:["Estimated ",(0,c.gbp)(S)]}),S{i.default.openURL(`tel:${n.phones[0].replace(/\s/g,'')}`).catch(()=>{}),O('placed (by phone)')}}):null,n.website?(0,x.jsx)(d.Button,{small:!0,kind:"secondary",label:"Open website",onPress:()=>{i.default.openURL(n.website).catch(()=>{}),O('placed (on website)')}}):null]})]}):null,void 0]},n.id)})]})}function $(){const{k:e,rid:t}=(0,y.useChef)(),n=(0,o.useOwner)(e=>e.suppliers);return(0,x.jsx)(l.default,{style:{gap:8},children:e.orders.map(i=>(0,x.jsxs)(d.Card,{children:[(0,x.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(d.T,{weight:"semibold",style:{flex:1},children:n.find(e=>e.id===i.supplierId)?.name}),(0,x.jsx)(d.Badge,{kind:"neutral",label:i.status.toUpperCase()})]}),(0,x.jsxs)(d.Muted,{children:[new Date(i.at).toLocaleString('en-GB',{weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})," \xb7 ",i.by,i.total?` \xb7 ${(0,c.gbp)(i.total)}`:'']}),i.lines.length?(0,x.jsx)(d.Muted,{children:i.lines.map(n=>{const i=e.ingredients.find(e=>e.id===n.ing);return`${(0,s.ingredientQty)(t,i??{name:n.ing,unit:''},n.qty)} ${i?.name??n.ing}`}).join(', ')}):null]},i.id))})}},1167,[1153,984,34,379,102,794,891,993,867,821,1084,1145,1029,1168,25]); __d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.openLink=j,_e.useSheetReminders=T,_e.OrderSheets=function({focus:e}){const{rid:t,now:l}=(0,x.useChef)(3e4),o=(0,u.useSheets)(t).filter(e=>(0,n.chefCanSee)(t,e)&&!e.placeholder),[h,c]=(0,s.useState)(e??null),p=T(),f=(0,b.wd)(l);return(0,y.jsxs)(d.default,{style:{gap:10},testID:"order-sheets",children:[(0,y.jsx)(i.Banner,{kind:"info",title:"Nothing is sent for you",children:"Text, WhatsApp and phone orders open your phone\u2019s own app with the order already written. Check it, then press Send yourself."}),p.map(e=>(0,y.jsx)(r.default,{accessibilityRole:"button",onPress:()=>c(e.supplierId),children:(0,y.jsxs)(i.Banner,{kind:'red'===e.tone?'danger':'warn',title:`\u23f0 ${e.text}`,children:["Tap to open the ",e.name," order sheet."]})},e.supplierId)),(0,y.jsxs)(i.Muted,{children:["Today is ",b.DAYS[f],". Edit suppliers in Managers \u203a Settings \u203a Supplier order sheets."]}),o.map(e=>(0,y.jsx)(C,{s:e,open:h===e.id,onToggle:()=>c(h===e.id?null:e.id)},e.id)),o.length?null:(0,y.jsx)(i.Muted,{children:"No order sheets yet. Add suppliers in Managers \u203a Settings \u203a Supplier order sheets."})]})};var t=_r(_d[0]),n=_r(_d[1]),l=_r(_d[2]),s=_r(_d[3]),o=e(_r(_d[4]));_r(_d[5]);var r=e(_r(_d[6])),d=e(_r(_d[7])),i=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),c=_r(_d[11]),p=_r(_d[12]),b=_r(_d[13]),f=_r(_d[14]),x=_r(_d[15]),y=_r(_d[16]);function j(e){if('undefined'!=typeof window){const t=window;return'function'==typeof t.__ccOpenLink?void t.__ccOpenLink(e):void(/^https?:/.test(e)?window.open(e,'_blank','noopener'):window.location.href=e)}o.default.openURL(e).catch(()=>{})}async function w(e){try{const t='undefined'!=typeof navigator?navigator:null;if(t?.clipboard?.writeText)return await t.clipboard.writeText(e),!0}catch{}return!1}const k={online:'\ud83c\udf10',phone:'\ud83d\udcde',text:'\ud83d\udcac',whatsapp:'\u2706',tbc:'\ud83d\udd8a\ufe0f'},S={borderWidth:1,borderColor:f.colours.border,borderRadius:10,paddingHorizontal:12,paddingVertical:10,color:f.colours.text,backgroundColor:f.colours.surface2,fontSize:f.font.body};function T(){const{rid:e,now:t}=(0,x.useChef)(6e4),l=(0,u.useSheets)(e).filter(t=>(0,n.chefCanSee)(e,t)&&!t.placeholder),s=(0,u.useOrderSheets)(e=>e.opened),o=(0,h.useShellfish)(e,'','chef'),r=(0,b.remindersFor)(l,t,s);for(const n of l){const l=o.items.filter(e=>(e.supplierId===n.id||!e.supplierId&&n.shellfish)&&o.isLow(e.key));!l.length||s[n.id]&&new Date(s[n.id]).toDateString()===t.toDateString()||r.push({supplierId:n.id,name:n.name,text:`${'text'===n.method||'whatsapp'===n.method?'Text':'Order from'} ${n.contact||n.name}: ${l.map(t=>`${(0,c.fmtStockCount)(e,t,o.counts[t.key]??0)} ${t.plural.toLowerCase()}`).join(' and ')} left`,tone:'amber',cutoffPassed:!1})}return r}function C({s:e,open:n,onToggle:o}){const{rid:T,r:C,me:$,now:D}=(0,x.useChef)(3e4),v=(0,u.useOrderSheets)(e=>e.patch),I=(0,u.useOrderSheets)(e=>e.markOpened),M=(0,u.useOrderSheets)(t=>t.opened[e.id]),[B,L]=(0,s.useState)({}),[P,O]=(0,s.useState)(''),[R,A]=(0,s.useState)(''),[z,_]=(0,s.useState)(!1),W=(0,h.useShellfish)(T,$,'chef'),H=(0,b.nextDelivery)(e,D),K=(0,b.orderLines)(e,B,P,T),E=(C.address??C.location??'').split(',').map(e=>e.trim()).filter(Boolean),q=E.length>=3?E[1]:E[0]??'',N=(0,b.orderMessage)(e,C.name,q,K,$.split(' ')[0],D),U=e.orderDays.includes((0,b.wd)(D)),Q=(e,t)=>L(n=>({...n,[e.id]:(0,l.stepQuantity)(T,e,n[e.id]||0,t)})),Y=t=>{I(e.id,D.toISOString()),j(t)},F='text'===e.method||'whatsapp'===e.method||'phone'===e.method,G=Math.round(100*parseFloat(R.replace(/[\xa3,]/g,''))),V=W.items.filter(t=>t.supplierId===e.id||!t.supplierId&&e.shellfish),J=V.filter(e=>W.isLow(e.key));return(0,y.jsxs)(d.default,{testID:`sheet-${e.id}`,style:{borderRadius:14,borderWidth:1.5,borderColor:U||J.length?f.colours.amber:n?f.colours.gold:f.colours.border,backgroundColor:f.colours.surface,overflow:'hidden'},children:[(0,y.jsxs)(r.default,{accessibilityRole:"button",accessibilityLabel:`${e.name} order sheet`,onPress:o,style:{padding:12,gap:4},children:[(0,y.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsxs)(i.T,{weight:"semibold",size:f.font.large,style:{flex:1},children:[k[e.method]," ",e.name]}),(0,y.jsx)(i.Badge,{kind:e.placeholder?'amber':'gold',label:e.placeholder?'To fill in':b.METHOD_LABEL[e.method]})]}),(0,y.jsx)(i.Muted,{children:e.goods}),(0,y.jsxs)(i.Row,{wrap:!0,gap:6,children:[e.deliveryDays.length?(0,y.jsx)(i.Badge,{kind:"neutral",label:`Delivers ${(0,b.dayRange)(e.deliveryDays)}`}):null,e.orderDays.length?(0,y.jsx)(i.Badge,{kind:U?'amber':'neutral',label:`Order ${(0,b.dayRange)(e.orderDays)}${e.cutoff?` by ${e.cutoff}`:''}`}):null,e.frequency?(0,y.jsx)(i.Badge,{kind:"neutral",label:e.frequency}):null,e.priceCapPerKg?(0,y.jsx)(i.Badge,{kind:"blue",label:`Cap ${(0,p.gbp)(e.priceCapPerKg)}/kg`}):null,V.length?(0,y.jsx)(i.Badge,{kind:J.length?'amber':'ok',label:V.map(e=>`${e.icon} ${(0,c.fmtStockCount)(T,e,W.counts[e.key]??0)}`).join(' \xb7 ')}):null,M&&new Date(M).toDateString()===D.toDateString()?(0,y.jsx)(i.Badge,{kind:"ok",label:"Opened today \u2713"}):null]})]}),n?(0,y.jsxs)(d.default,{style:{padding:12,paddingTop:0,gap:10},children:[H?(0,y.jsxs)(i.Muted,{children:["Next delivery if you order now: ",(0,b.niceDay)(H),"."]}):null,e.reminder?(0,y.jsxs)(i.Muted,{children:["Reminder on ",e.orderDays.map(e=>b.DAYS[e]).join(', '),": ",e.reminder]}):null,e.notes?(0,y.jsx)(i.T,{size:f.font.small,colour:f.colours.muted,children:e.notes}):null,e.placeholder?(0,y.jsx)(i.Banner,{kind:"warn",title:"Still to be set up",children:"Add the supplier, how to order and delivery days in Managers \u203a Settings \u203a Supplier order sheets."}):null,e.items.map(e=>(0,y.jsxs)(d.default,{style:{gap:6},children:[(0,y.jsxs)(i.T,{children:[e.name,e.unit?(0,y.jsxs)(i.T,{size:f.font.small,colour:f.colours.muted,children:[" (",(0,l.quantityUnit)(T,e),")"]}):null]}),(0,y.jsxs)(i.Row,{wrap:!0,gap:8,style:{justifyContent:'space-between'},children:[(0,y.jsx)(i.Button,{small:!0,kind:"secondary",label:"Less",accessibilityLabel:`${(0,l.fishInStone)(T,e)?'Half a stone less':'Less'} ${e.name}`,onPress:()=>Q(e,-1),style:{minWidth:44,minHeight:44}}),(0,y.jsx)(d.default,{accessible:!0,accessibilityLabel:(0,l.fishQtySpeech)(T,e,B[e.id]||0),children:(0,y.jsx)(i.T,{weight:"bold",size:20,style:{minWidth:76,textAlign:'center'},children:(0,l.fishInStone)(T,e)?(0,l.fishQtyText)(T,e,B[e.id]||0):B[e.id]||0})}),(0,y.jsx)(i.Button,{small:!0,kind:"secondary",label:"More",accessibilityLabel:`${(0,l.fishInStone)(T,e)?'Half a stone more':'More'} ${e.name}`,testID:`qty-${e.id}`,onPress:()=>Q(e,1),style:{minWidth:44,minHeight:44}})]})]},e.id)),(0,y.jsxs)(d.default,{style:{gap:4},children:[(0,y.jsx)(i.T,{size:f.font.small,weight:"medium",colour:f.colours.muted,children:"Anything else (one line each)"}),(0,y.jsx)(t.TextInput,{value:P,onChangeText:O,multiline:!0,placeholder:"e.g. 2 boxes lemons",placeholderTextColor:f.colours.muted,style:[S,{minHeight:60}]})]}),F?(0,y.jsxs)(d.default,{style:{gap:4},children:[(0,y.jsxs)(i.T,{size:f.font.small,weight:"medium",colour:f.colours.muted,children:['whatsapp'===e.method?'WhatsApp number':'phone'===e.method?'Phone number':'Mobile number',e.number?'':' (blank: fill in once, it is saved)']}),(0,y.jsx)(t.TextInput,{testID:`number-${e.id}`,value:e.number,onChangeText:t=>v(T,e.id,{number:t}),keyboardType:"phone-pad",placeholder:"07\u2026",placeholderTextColor:f.colours.muted,style:S})]}):null,'online'===e.method?(0,y.jsxs)(d.default,{style:{gap:4},children:[(0,y.jsxs)(i.T,{size:f.font.small,weight:"medium",colour:f.colours.muted,children:['Open Coldweb'===e.urlLabel?'Coldweb ordering link':'Website link',e.url?'':' (blank: paste it in once, it is saved)']}),(0,y.jsx)(t.TextInput,{testID:`url-${e.id}`,value:e.url,onChangeText:t=>v(T,e.id,{url:t.trim()}),autoCapitalize:"none",keyboardType:"url",placeholder:"https://\u2026",placeholderTextColor:f.colours.muted,style:S})]}):null,e.priceCapPerKg?(0,y.jsxs)(d.default,{style:{gap:6,padding:10,borderRadius:12,backgroundColor:f.colours.blueBg},children:[(0,y.jsxs)(i.T,{weight:"semibold",colour:"#E2C489",children:["Price cap ",(0,p.gbp)(e.priceCapPerKg),"/kg \xb7 buy from the cheapest UK seller under it"]}),(0,y.jsxs)(i.Muted,{children:["Seller: ",e.seller||'to be chosen']}),(0,y.jsxs)(i.Row,{gap:8,children:[(0,y.jsx)(i.T,{size:f.font.small,style:{flex:1},children:"Price you found (\xa3/kg)"}),(0,y.jsx)(t.TextInput,{testID:"price-found",value:R,onChangeText:A,keyboardType:"decimal-pad",placeholder:"e.g. 22.50",placeholderTextColor:f.colours.muted,style:[S,{width:120}]})]}),G>0?(0,y.jsx)(i.Badge,{kind:G<=e.priceCapPerKg?'ok':'red',label:G<=e.priceCapPerKg?`${(0,p.gbp)(G)}/kg is under the cap \u2713`:`${(0,p.gbp)(G)}/kg is over the ${(0,p.gbp)(e.priceCapPerKg)} cap: look for a cheaper seller`}):null]}):null,'online'!==e.method&&'tbc'!==e.method?(0,y.jsxs)(d.default,{testID:`preview-${e.id}`,style:{padding:10,borderRadius:12,borderWidth:1,borderColor:f.colours.border,backgroundColor:f.colours.surface2},children:[(0,y.jsx)(i.T,{size:12,weight:"semibold",colour:f.colours.gold,children:'phone'===e.method?'READ THIS OUT':'YOUR MESSAGE'}),(0,y.jsx)(i.T,{size:f.font.small,children:K.length?N:'Add quantities above to write the order.'})]}):null,(0,y.jsxs)(i.Row,{wrap:!0,gap:8,children:['text'===e.method?(0,y.jsx)(i.Button,{testID:`send-${e.id}`,kind:"success",label:"\ud83d\udcac Open in Messages",disabled:!K.length,onPress:()=>Y((0,b.smsLink)(e.number,N))}):null,'whatsapp'===e.method?(0,y.jsx)(i.Button,{testID:`send-${e.id}`,kind:"success",label:"Open in WhatsApp",disabled:!K.length,onPress:()=>Y((0,b.waLink)(e.number,N))}):null,'phone'===e.method?(0,y.jsx)(i.Button,{testID:`send-${e.id}`,kind:"success",label:`\ud83d\udcde Call ${e.name}`,disabled:!e.number,onPress:()=>Y((0,b.telLink)(e.number))}):null,'online'===e.method?(0,y.jsx)(i.Button,{testID:`send-${e.id}`,kind:"success",label:`\ud83c\udf10 ${e.urlLabel??'Open website'}`,disabled:!e.url,onPress:()=>Y(e.url)}):null,'online'!==e.method&&'tbc'!==e.method&&K.length?(0,y.jsx)(i.Button,{kind:"ghost",label:z?'Copied \u2713':'Copy order',onPress:async()=>{const e=await w(N);_(e),e&&setTimeout(()=>_(!1),2e3)}}):null]}),'text'===e.method&&!e.number&&K.length?(0,y.jsx)(i.Muted,{children:"No number saved: Messages opens with the order written and asks who to send it to."}):null,'whatsapp'===e.method&&!e.number&&K.length?(0,y.jsx)(i.Muted,{children:"No number saved: WhatsApp opens with the order written and asks who to send it to."}):null,'phone'!==e.method||e.number?null:(0,y.jsx)(i.Muted,{children:"Add the phone number above to call from here."}),'online'!==e.method||e.url?null:(0,y.jsx)(i.Muted,{children:"Add the link above and the button opens it."})]}):null]})}},1168,[827,835,984,34,379,236,402,102,794,1027,983,985,867,1028,821,1145,25]); @@ -1261,7 +1261,7 @@ __d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{ __d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.waNumber=o,_e.waMeLink=function(e,t){const n=o(e);return n?t?`https://wa.me/${n}?text=${encodeURIComponent(t)}`:`https://wa.me/${n}`:null},Object.defineProperty(_e,"guestWhatsAppText",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"staffWhatsAppTexts",{enumerable:!0,get:function(){return p}}),_e.openWhatsApp=async function(e){try{return await n.default.openURL(e),!0}catch{return!1}};var e,t=r(_d[0]),n=(e=t)&&e.__esModule?e:{default:e};function o(e,t="44"){if(!e)return null;let n=String(e).trim().replace(/[\s().\-]/g,'');return n.startsWith('+')?n=n.slice(1):n.startsWith('00')?n=n.slice(2):n.startsWith('0')&&(n=t+n.slice(1)),n=n.replace(/^440/,'44'),/^[1-9][0-9]{6,14}$/.test(n)?n:null}const s=e=>{const[t,n,o]=e.split('-').map(Number);return new Date(t,n-1,o).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long',year:'numeric'})},u=e=>{const[t,n,o]=e.split('-').map(Number);return new Date(t,n-1,o).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'})},c=e=>e.slice(0,5),l=e=>e.replace(' (example)','').trim().split(/\s+/)[0]||'there',m=(e,t)=>`Hi ${t}, it's ${e.name.trim()} about my booking${e.ref?` ${e.ref}`:''}: ${s(e.date)} at ${c(e.time)}, table for ${e.partySize}. `,p=(e,t,n)=>({confirm:`Hi ${l(e.name)}, it's ${t}${n?` in ${n}`:''}. Just confirming your table for ${e.partySize} on ${u(e.date)} at ${c(e.time)}${e.ref?` (ref ${e.ref})`:''}. Any questions, just reply here.`,change:`Hi ${l(e.name)}, it's ${t} about your booking on ${u(e.date)} at ${c(e.time)}. `})},1178,[379]); __d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"payFor",{enumerable:!0,get:function(){return k.payFor}}),Object.defineProperty(_e,"useVenuePay",{enumerable:!0,get:function(){return k.useVenuePay}}),_e.PayTipsSettings=function({go:e}){const{rid:s,today:o}=(0,P.useCtx)(6e4),{pay:r,source:d}=(0,k.useVenuePay)(s),[a,l]=(0,n.useState)(r),[u,c]=(0,n.useState)((0,f.ukDate)(r.tipsAnchorPayday)),[y,x]=(0,n.useState)(null),j=(0,f.parseUk)(u),w=(0,f.cleanPay)({...a,tipsAnchorPayday:j??a.tipsAnchorPayday}),C=JSON.stringify(w)!==JSON.stringify(r)||'settings'!==d,S=(0,f.nextToPay)(w,'tips',o).period,D=(0,f.nextToPay)(w,'wage',o).period,I=(0,f.tipsPeriod)(w,S.start,1),z=(0,f.wagePeriod)(w,D.start,1),H=e=>{l({...a,...e}),x(null)};return(0,v.jsxs)(i.default,{style:{gap:12},testID:"pay-settings",children:['none'===d?(0,v.jsx)(h.Banner,{kind:"warn",title:"Pay dates not set up yet",children:"Set your tips and wage dates here. Until then the app uses calendar months and weekly tips."}):null,'questionnaire'===d?(0,v.jsx)(h.Banner,{kind:"info",title:"From your sign-up answers",children:"These dates came from your questionnaire. Check them and tap Save to make them your venue's pay dates."}):null,(0,v.jsx)(T.SectionHead,{title:"Tips",sub:"How often tips are paid out, and which days each payout covers."}),(0,v.jsxs)(h.Card,{children:[(0,v.jsx)(h.T,{weight:"semibold",children:"How often"}),(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:['weekly','fortnightly','monthly'].map(e=>(0,v.jsx)(h.Chip,{label:M[e],selected:a.tipsFrequency===e,onPress:()=>H({tipsFrequency:e})},e))}),(0,v.jsx)(h.Field,{label:"Next tips payday (DD/MM/YYYY)",value:u,onChangeText:e=>{c((0,t.slashDate)(e,u)),x(null)},maxLength:10,placeholder:"02/11/2026",keyboardType:"numbers-and-punctuation"}),j?(0,v.jsxs)(h.Muted,{children:[(0,f.dayMonth)(j)," ",j.slice(0,4)]}):(0,v.jsx)(h.T,{size:13,colour:b.colours.red,children:"Enter a date like 02/11/2026"}),(0,v.jsx)(h.T,{weight:"semibold",children:"Each tips period ends"}),(0,v.jsxs)(h.Row,{children:[(0,v.jsx)(h.Stepper,{label:"days before payday",value:a.tipsEndsDaysBefore,min:0,max:13,onChange:e=>H({tipsEndsDaysBefore:e})}),(0,v.jsx)(h.Muted,{style:{flex:1},children:0===a.tipsEndsDaysBefore?'on payday':1===a.tipsEndsDaysBefore?'day before payday (a Monday payday covers up to the Sunday)':'days before payday'})]})]}),(0,v.jsx)(T.SectionHead,{title:"Wages",sub:"Monthly pay: the cut-off starts each pay period."}),(0,v.jsxs)(h.Card,{children:[(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(h.T,{weight:"semibold",style:{flex:1},children:"Pay day of the month"}),(0,v.jsx)(h.Stepper,{label:"pay day",value:a.wagePayDay,min:1,max:31,onChange:e=>H({wagePayDay:e})})]}),(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(h.T,{weight:"semibold",style:{flex:1},children:"Cut-off (first day of each period)"}),(0,v.jsx)(h.Stepper,{label:"cut-off day",value:a.wageCutoffDay,min:1,max:28,onChange:e=>H({wageCutoffDay:e})})]}),(0,v.jsxs)(h.Muted,{children:["Period runs the ",B(a.wageCutoffDay)," to the ",B(1===a.wageCutoffDay?31:a.wageCutoffDay-1),1===a.wageCutoffDay?' (end of the month)':' of the next month',". A pay day past the month end uses the last day."]}),(0,v.jsx)(h.T,{weight:"semibold",children:"A pay day on a weekend"}),(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:['none','before','after'].map(e=>(0,v.jsx)(h.Chip,{label:$[e],selected:(a.weekendRule??'none')===e,onPress:()=>H({weekendRule:e})},e))})]}),(0,v.jsx)(T.SectionHead,{title:"Preview"}),(0,v.jsxs)(h.Card,{highlight:b.colours.gold,children:[(0,v.jsx)(R,{label:"Next tips payday",day:S.payday,period:S}),(0,v.jsx)(R,{label:"Then",day:I.payday,period:I}),(0,v.jsx)(i.default,{style:{height:1,backgroundColor:b.colours.border}}),(0,v.jsx)(R,{label:"Next payday",day:D.payday,period:D}),(0,v.jsx)(R,{label:"Then",day:z.payday,period:z})]}),(0,v.jsx)(h.Button,{kind:"success",label:'settings'===d?'Save pay dates':'Save as our pay dates',disabled:!j||!C,testID:"save-pay",onPress:()=>{p.useStore.getState().updateSettings(s,{pay:w}),x('Saved. Everyone in the venue sees these dates.')}}),y?(0,v.jsx)(h.Banner,{kind:"success",title:y}):null,(0,v.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,v.jsx)(h.Button,{small:!0,kind:"secondary",label:"Payroll hours",onPress:()=>e('more','hours')}),(0,v.jsx)(h.Button,{small:!0,kind:"secondary",label:"Tips day",onPress:()=>e('more','tipsday')})]})]})},_e.hoursIn=z,Object.defineProperty(_e,"toTsv",{enumerable:!0,get:function(){return N}}),Object.defineProperty(_e,"toCsv",{enumerable:!0,get:function(){return F}}),_e.summaryTable=V,_e.detailTable=E,_e.copyText=Y,_e.periodOptions=G,_e.PayrollHours=function({go:e}){const{rid:s,today:t,now:r,r:p,me:w,meId:T,role:M}=(0,P.useCtx)(6e4),$=(0,C.canSeeHoursEdit)({role:M,isCar:S.IS_CAR}),[B,R]=(0,n.useState)(!1),{pay:I,source:A}=(0,k.useVenuePay)(s),W=(0,y.useOwner)(e=>e.staff),L=(0,y.useOwner)(e=>(0,y.liveAttendance)(e.attendance)),q=(0,P.useHourly)(),J=(0,a.default)().width<700,[K,Q]=(0,n.useState)(null),[X,Z]=(0,n.useState)(null),ee=e=>{const s=y.useOwner.getState().confirmEntries([e.id],w,T,(new Date).toISOString());we(s?'Approved. It now counts in the hours and pay.':'Nothing to approve.')},se=e=>(0,v.jsxs)(i.default,{style:{gap:8,marginBottom:8},testID:`daily-${e.person.id}`,children:[e.days.map(e=>(0,v.jsx)(u.ShiftCard,{d:e,manager:!0,onApprove:()=>ee(e.a),onEdit:()=>Q(e.a),onRemove:()=>Z(e.a)},e.a.id)),e.days.length?null:(0,v.jsx)(h.Muted,{center:!0,children:"No clocked shifts in this period."})]}),te=(0,n.useMemo)(()=>G(I,t),[I,t]),[oe,ne]=(0,n.useState)('wage'),[re,de]=(0,n.useState)(null),[ae,ie]=(0,n.useState)(!1),[le,ue]=(0,n.useState)({}),[ce,he]=(0,n.useState)(null),pe='custom'===oe&&re?re:(te.find(e=>e.id===oe)??te[0]).period,ye=(0,n.useMemo)(()=>z(pe,W,L,r,q),[pe.key,W,L,q,Math.floor(r.getTime()/6e4)]),ge=ye.some(e=>null!=e.rate),xe='tips'===pe.kind,fe=ye.reduce((e,s)=>({c:e.c+s.confirmed,p:e.p+s.pending,s:e.s+s.shifts,g:e.g+(s.gross??0)}),{c:0,p:0,s:0,g:0}),me=ye.filter(e=>e.pending>0).length,be=`${p.name}: hours ${(0,f.rangeText)(pe.start,pe.end)}`,je=`hours-${pe.start}-to-${pe.end}`,we=e=>{he(e),setTimeout(()=>he(null),6e3)};return(0,v.jsxs)(i.default,{style:{gap:10},testID:"payroll-hours",children:['none'===A?(0,v.jsxs)(h.Banner,{kind:"warn",title:"Pay dates not set up",children:[(0,v.jsx)(h.Muted,{children:"Using calendar months for now."}),(0,v.jsx)(h.Button,{small:!0,kind:"ghost",label:"Set your pay dates \u203a",onPress:()=>e('more','paysettings')})]}):null,(0,v.jsxs)(h.Row,{wrap:!0,gap:6,children:[te.map(e=>(0,v.jsx)(h.Chip,{label:e.label,sub:e.sub,selected:oe===e.id,onPress:()=>{ne(e.id),ie(!1)}},e.id)),(0,v.jsx)(h.Chip,{label:"Custom dates",sub:re&&'custom'===oe?(0,f.rangeText)(re.start,re.end):'Pick any range',selected:'custom'===oe,onPress:()=>ie(!ae)})]}),ae?(0,v.jsx)(U,{onSet:e=>{de(e),ne('custom'),ie(!1)}}):null,(0,v.jsx)(h.Card,{highlight:b.colours.gold,children:(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,v.jsxs)(i.default,{style:{flexShrink:1,minWidth:0},children:[(0,v.jsxs)(h.T,{weight:"bold",size:18,children:[(0,f.rangeText)(pe.start,pe.end)," ",pe.end.slice(0,4)]}),(0,v.jsxs)(h.Muted,{children:[(0,f.ukDate)(pe.start)," to ",(0,f.ukDate)(pe.end),pe.payday?` \xb7 ${pe.payday>=t?'pays':'paid'} ${(0,f.dayMonth)(pe.payday)}`:'',xe?' \xb7 tips period':'wage'===pe.kind?' \xb7 wage period':'']})]}),(0,v.jsxs)(i.default,{style:{alignItems:'flex-end'},children:[(0,v.jsx)(h.T,{size:22,weight:"bold",colour:b.colours.gold,children:(0,l.durText)(fe.c)}),(0,v.jsxs)(h.Muted,{children:["approved",fe.p?` \xb7 ${(0,l.durText)(fe.p)} pending`:'']})]})]})}),$?(0,v.jsx)(i.default,{style:{alignItems:'center'},children:(0,v.jsx)(h.Button,{testID:"add-past-shift",label:"Add past shift",accessibilityLabel:"Add past shift",onPress:()=>R(!0),style:{minHeight:48,minWidth:180}})}):null,me?(0,v.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:"Sign off pending hours",onPress:()=>e('more','signoff'),testID:"pending-banner",children:(0,v.jsxs)(i.default,{style:{backgroundColor:b.colours.amberBg,borderRadius:12,padding:12,borderLeftWidth:6,borderLeftColor:b.colours.amber,gap:4},children:[(0,v.jsxs)(h.T,{weight:"bold",colour:b.colours.amber,children:["\u26a0 ",(0,l.durText)(fe.p)," still waiting for approval (",me," ",1===me?'person':'people',")"]}),(0,v.jsx)(h.T,{size:14,children:"Pending hours are not in the totals or the exports' confirmed columns. Sign them off first so everyone is paid in full."}),(0,v.jsx)(h.T,{weight:"semibold",colour:b.colours.gold,children:"Sign off hours \u203a"})]})}):(0,v.jsx)(h.Banner,{kind:"success",title:"All hours in this period are signed off"}),(0,v.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,v.jsx)(h.Button,{small:!0,kind:"success",label:"Copy for spreadsheet",testID:"copy-tsv",onPress:async()=>{const e=await Y(N(V(ye,pe,ge,xe)));we(e?`Copied ${ye.length} rows. Paste into the first cell of your spreadsheet.`:'Copy is not available here. Use Download CSV.')}}),(0,v.jsx)(h.Button,{small:!0,kind:"secondary",label:"Download CSV",onPress:()=>{(0,j.downloadText)(`${je}.csv`,F(V(ye,pe,ge,xe))),we('CSV downloaded (summary).')}}),(0,v.jsx)(h.Button,{small:!0,kind:"secondary",label:"Download CSV (daily detail)",onPress:()=>{(0,j.downloadText)(`${je}-daily.csv`,F(E(ye))),we('CSV downloaded (one line per shift).')}}),(0,v.jsx)(h.Button,{small:!0,kind:"secondary",label:"Print / PDF",onPress:()=>{const e=V(ye,pe,ge,xe);(0,j.printTable)(be,`${(0,f.ukDate)(pe.start)} to ${(0,f.ukDate)(pe.end)} \xb7 confirmed hours only in the totals \xb7 printed ${(0,f.ukDate)(t)}`,e[0],e.slice(1))}})]}),ce?(0,v.jsx)(h.Banner,{kind:"success",title:ce}):null,J?(0,v.jsxs)(i.default,{testID:"hours-table",style:{gap:10},children:[ye.map(e=>{const s=!!le[e.person.id];return(0,v.jsxs)(i.default,{style:{borderRadius:16,borderWidth:1,borderColor:'rgba(212,175,106,0.45)',backgroundColor:b.colours.surface,padding:12,gap:10},children:[(0,v.jsx)(u.HoursSummaryCard,{name:O(e.person),role:H(e.person),approved:e.confirmed,pending:e.pending,rate:e.rate}),(0,v.jsx)(h.Button,{kind:"secondary",testID:`hours-open-${e.person.id}`,label:s?'Hide shifts':`Show ${e.days.length} ${1===e.days.length?'shift':'shifts'}`,accessibilityLabel:`${s?'Hide':'Show'} ${O(e.person)}'s shifts`,onPress:()=>ue({...le,[e.person.id]:!s}),style:{minHeight:48}}),s?se(e):null]},e.person.id)}),(0,v.jsxs)(h.Muted,{center:!0,children:["Total: ",(0,l.durText)(fe.c)," approved",ge?` \xb7 ${(0,x.gbp)(fe.g)} gross`:'',fe.p?` \xb7 ${(0,l.durText)(fe.p)} pending`:'']})]}):(0,v.jsx)(o.WideTable,{children:(0,v.jsxs)(i.default,{testID:"hours-table",children:[(0,v.jsx)(o.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:b.colours.border,paddingBottom:4},children:['Name','Shifts','Approved','Pending',xe?'Tips h':'Hours',ge?'Rate':'',ge?'Gross':''].map((e,s)=>(0,v.jsx)(h.T,{size:12,weight:"semibold",colour:b.colours.gold,style:{width:_[s]},children:e},s))}),ye.map(e=>{const s=!!le[e.person.id];return(0,v.jsxs)(i.default,{style:{borderBottomWidth:1,borderColor:'#222'},children:[(0,v.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:`${O(e.person)} daily hours`,onPress:()=>ue({...le,[e.person.id]:!s}),style:{paddingVertical:7},children:(0,v.jsxs)(o.TRow,{heads:['Name','Shifts','Approved','Pending',xe?'Tips h':'Hours',ge?'Rate':'',ge?'Gross':''],children:[(0,v.jsxs)(i.default,{style:{width:_[0]},children:[(0,v.jsxs)(h.T,{size:14,weight:"semibold",numberOfLines:1,children:[s?'\u25be':'\u25b8'," ",O(e.person)]}),(0,v.jsx)(h.Muted,{children:H(e.person)})]}),(0,v.jsx)(h.T,{size:14,style:{width:_[1]},children:e.shifts}),(0,v.jsx)(h.T,{size:14,weight:"semibold",style:{width:_[2]},children:(0,l.durText)(e.confirmed)}),(0,v.jsx)(h.T,{size:14,weight:e.pending?'bold':'regular',colour:e.pending?b.colours.amber:b.colours.muted,style:{width:_[3]},children:e.pending?`\u26a0 ${(0,l.durText)(e.pending)}`:'0m'}),(0,v.jsx)(h.T,{size:14,style:{width:_[4]},children:xe?(0,f.decH)(e.confirmed):(0,l.durText)(e.confirmed)}),(0,v.jsx)(h.T,{size:14,colour:b.colours.muted,style:{width:_[5]},children:ge?null!=e.rate?(0,x.gbp)(e.rate):'\u2013':''}),(0,v.jsxs)(h.T,{size:14,weight:"semibold",style:{width:_[6]},children:[ge?null!=e.gross?(0,x.gbp)(e.gross):'\u2013':'',ge&&null!=e.rate&&e.pending?(0,v.jsx)(h.T,{size:12,colour:b.colours.amber,children:`\n+ ${(0,x.gbp)(Math.round(e.pending/60*e.rate))} pending`}):null]})]})}),s?se(e):null]},e.person.id)}),(0,v.jsxs)(o.TRow,{heads:['','Shifts','Approved','Pending',xe?'Tips h':'Hours','',ge?'Gross':''],style:{paddingVertical:8,borderTopWidth:2,borderColor:b.colours.gold},children:[(0,v.jsxs)(h.T,{size:14,weight:"bold",style:{width:_[0]},children:["Total (",ye.length,")"]}),(0,v.jsx)(h.T,{size:14,weight:"bold",style:{width:_[1]},children:fe.s}),(0,v.jsx)(h.T,{size:14,weight:"bold",colour:b.colours.gold,style:{width:_[2]},children:(0,l.durText)(fe.c)}),(0,v.jsx)(h.T,{size:14,weight:"bold",colour:fe.p?b.colours.amber:b.colours.muted,style:{width:_[3]},children:(0,l.durText)(fe.p)}),(0,v.jsx)(h.T,{size:14,weight:"bold",style:{width:_[4]},children:xe?(0,f.decH)(fe.c):(0,l.durText)(fe.c)}),(0,v.jsx)(h.T,{size:14,style:{width:_[5]},children:" "}),(0,v.jsx)(h.T,{size:14,weight:"bold",style:{width:_[6]},children:ge?(0,x.gbp)(fe.g):''})]})]})}),K?(0,v.jsx)(c.OverrideSheet,{a:K,staffId:K.staffId,date:K.date,onClose:()=>Q(null)}):null,X?(0,v.jsx)(u.RemoveShiftSheet,{a:X,who:{name:w,id:T},onClose:()=>{Z(null),we('Removed from hours. It is kept in the history.')}}):null,B?(0,v.jsx)(D.AddPastShiftSheet,{onClose:()=>R(!1),onSaved:()=>{R(!1),we('Saved. It counts in the hours and pay.')}}):null,(0,v.jsxs)(h.Muted,{children:["Tap a name for each day. Hours read 37h 30m. The export also has decimal hours (37.50) and h:mm for your spreadsheet. Paid hours = clock out \u2212 clock in \u2212 break. ",ge?'Gross is before tax, from confirmed hours only.':'Rates and gross show once you sign in with your personal link.']}),xe?(0,v.jsx)(h.Button,{kind:"success",label:"Tips day: split tips for this period \u203a",onPress:()=>e('more','tipsday')}):null]})},_e.TipsDay=function({go:e}){const{rid:t,today:r,now:a}=(0,P.useCtx)(6e4),{pay:u,source:c}=(0,k.useVenuePay)(t),p=(0,y.useOwner)(e=>e.staff),T=(0,y.useOwner)(e=>(0,y.liveAttendance)(e.attendance)),C=(0,y.useOwner)(e=>e.tronc),S=(0,f.nextToPay)(u,'tips',r),[D,M]=(0,n.useState)(0),$=(0,f.tipsPeriod)(u,S.period.start,D),[B,R]=(0,n.useState)(''),[I,W]=(0,n.useState)({}),[L,V]=(0,n.useState)(null),E=(0,n.useMemo)(()=>z($,p,T,a,{}),[$.key,p,T]),G=e=>'owner'===e.role&&!C.includeOwner||'manager'===e.role&&!C.includeManagers,U=e=>I[e.id]??G(e),_=E.filter(e=>e.confirmed>0||e.pending>0),q=Math.round(100*Number(B.replace(/[\xa3,\s]/g,''))),J=Number.isFinite(q)&&q>0&&q<=1e8&&/^\s*\xa3?\s*[\d,]+(\.\d{0,2})?\s*$/.test(B),K=_.filter(e=>!U(e.person)&&e.confirmed>0),{amounts:Q}=(0,w.allocate)(J?q:0,K.map(e=>e.confirmed)),X={};K.forEach((e,s)=>{X[e.person.id]=Q[s]});const Z=K.reduce((e,s)=>e+s.confirmed,0),ee=Object.values(X).reduce((e,s)=>e+s,0),se=_.filter(e=>e.pending>0&&!U(e.person)),te=se.reduce((e,s)=>e+s.pending,0),oe=()=>[['Name','Role','Period start','Period end','Payday','Confirmed hours','Confirmed h:mm','Share %','Tips \xa3'],..._.map(e=>{const s=!U(e.person)&&e.confirmed>0;return[O(e.person),H(e.person),(0,f.ukDate)($.start),(0,f.ukDate)($.end),$.payday?(0,f.ukDate)($.payday):'',(0,f.decH)(e.confirmed),(0,f.hMm)(e.confirmed),s&&Z?(e.confirmed/Z*100).toFixed(2):'0.00',s?A(X[e.person.id]??0):U(e.person)?'excluded':'0.00']}),['TOTAL','',(0,f.ukDate)($.start),(0,f.ukDate)($.end),$.payday?(0,f.ukDate)($.payday):'',(0,f.decH)(Z),(0,f.hMm)(Z),Z?'100.00':'0.00',A(ee)]],ne=e=>{V(e),setTimeout(()=>V(null),6e3)};return(0,v.jsxs)(i.default,{style:{gap:10},testID:"tips-day",children:[(0,v.jsx)(h.Banner,{kind:"info",title:"Saving payouts and notifying staff are coming next",children:"For now this works out the split and exports it. Nothing is saved to the team, sent or paid."}),'none'===c?(0,v.jsxs)(h.Banner,{kind:"warn",title:"Tips dates not set up",children:[(0,v.jsx)(h.Muted,{children:"Using weekly tips for now."}),(0,v.jsx)(h.Button,{small:!0,kind:"ghost",label:"Set your pay dates \u203a",onPress:()=>e('more','paysettings')})]}):null,(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(h.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",disabled:D<=-6,onPress:()=>M(D-1)}),(0,v.jsxs)(i.default,{style:{alignItems:'center',flex:1},children:[(0,v.jsx)(h.T,{weight:"bold",size:18,children:(0,f.rangeText)($.start,$.end)}),(0,v.jsxs)(h.Muted,{children:[(0,f.ukDate)($.start)," to ",(0,f.ukDate)($.end)," \xb7 ",$.payday>=r?'paid':'was paid'," ",(0,f.dayMonth)($.payday)]}),0===D?(0,v.jsx)(h.Badge,{kind:"gold",label:"Paid next"}):null]}),(0,v.jsx)(h.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:D>=1,onPress:()=>M(D+1)})]}),(0,v.jsxs)(h.Card,{highlight:b.colours.gold,children:[(0,v.jsx)(h.T,{weight:"semibold",children:"Total tips to share"}),(0,v.jsxs)(h.Row,{style:{alignItems:'center'},children:[(0,v.jsx)(h.T,{size:28,weight:"bold",colour:b.colours.gold,children:"\xa3"}),(0,v.jsx)(s.TextInput,{testID:"tips-total",accessibilityLabel:"Total tips in pounds",value:B,onChangeText:R,placeholder:"0.00",placeholderTextColor:"#7D776C",keyboardType:"decimal-pad",style:[h.styles.input,{flex:1,fontSize:26,fontWeight:'700'}]})]}),B&&!J?(0,v.jsx)(h.T,{size:13,colour:b.colours.red,children:"Enter an amount like 1250.00"}):(0,v.jsx)(h.Muted,{children:"Shared by confirmed hours: share = total \xd7 (their hours \xf7 everyone's hours). Rounded to the penny; leftover pennies go to the largest shares so it adds up exactly."})]}),se.length?(0,v.jsx)(d.default,{accessibilityRole:"button",onPress:()=>e('more','signoff'),testID:"tips-pending",children:(0,v.jsxs)(i.default,{style:{backgroundColor:b.colours.redBg,borderRadius:12,padding:12,borderLeftWidth:6,borderLeftColor:b.colours.red,gap:4},children:[(0,v.jsxs)(h.T,{weight:"bold",colour:b.colours.red,children:["\u26a0 Don't pay out yet: ",(0,l.durText)(te)," not approved yet"]}),(0,v.jsxs)(h.T,{size:14,children:[se.map(e=>`${O(e.person)} (${(0,l.durText)(e.pending)})`).join(', '),". Pending hours are left out of the split, so these people would get less than they should."]}),(0,v.jsx)(h.T,{weight:"semibold",colour:b.colours.gold,children:"Sign off hours \u203a"})]})}):_.length?(0,v.jsx)(h.Banner,{kind:"success",title:"All hours in this fortnight are signed off"}):null,(0,v.jsx)(o.WideTable,{children:(0,v.jsxs)(i.default,{testID:"tips-table",children:[(0,v.jsx)(o.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:b.colours.border,paddingBottom:4},children:['Include','Name','Confirmed','Share','Tips'].map((e,s)=>(0,v.jsx)(h.T,{size:12,weight:"semibold",colour:b.colours.gold,style:{width:[64,150,100,64,84][s]},children:e},e))}),_.map(e=>{const s=U(e.person),t=X[e.person.id]??0;return(0,v.jsxs)(o.TRow,{heads:['Include','Name','Confirmed','Share','Tips'],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222',opacity:s?.5:1},children:[(0,v.jsx)(d.default,{accessibilityRole:"checkbox",accessibilityState:{checked:!s},accessibilityLabel:`Include ${O(e.person)}`,onPress:()=>W({...I,[e.person.id]:!s}),style:{width:64,minHeight:44,justifyContent:'center'},children:(0,v.jsx)(i.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:s?b.colours.muted:b.colours.ok,backgroundColor:s?'transparent':b.colours.okBg,alignItems:'center',justifyContent:'center'},children:(0,v.jsx)(h.T,{size:14,colour:b.colours.ok,children:s?'':'\u2713'})})}),(0,v.jsxs)(i.default,{style:{width:150},children:[(0,v.jsx)(h.T,{size:14,weight:"semibold",numberOfLines:1,children:O(e.person)}),(0,v.jsxs)(h.Muted,{numberOfLines:1,children:[s?'Excluded':H(e.person),e.pending?` \xb7 \u26a0 ${(0,f.decH)(e.pending)} h pending`:'']})]}),(0,v.jsxs)(h.T,{size:14,style:{width:80},children:[(0,f.decH)(e.confirmed)," h"]}),(0,v.jsx)(h.T,{size:14,colour:b.colours.muted,style:{width:64},children:!s&&Z?`${(e.confirmed/Z*100).toFixed(1)}%`:'\u2013'}),(0,v.jsx)(h.T,{size:15,weight:"bold",colour:s?b.colours.muted:b.colours.gold,style:{width:84},children:s?'\u2013':(0,x.gbp)(t)})]},e.person.id)}),(0,v.jsxs)(o.TRow,{heads:['','','Confirmed','Share','Tips'],style:{paddingVertical:8,borderTopWidth:2,borderColor:b.colours.gold},children:[(0,v.jsx)(h.T,{size:14,style:{width:64},children:" "}),(0,v.jsxs)(h.T,{size:14,weight:"bold",style:{width:150},children:["Total (",K.length," people)"]}),(0,v.jsxs)(h.T,{size:14,weight:"bold",style:{width:80},children:[(0,f.decH)(Z)," h"]}),(0,v.jsx)(h.T,{size:14,style:{width:64},children:Z?'100%':'\u2013'}),(0,v.jsx)(h.T,{size:15,weight:"bold",colour:J&&ee===q?b.colours.ok:b.colours.text,style:{width:84},children:(0,x.gbp)(ee)})]})]})}),_.length?null:(0,v.jsx)(h.Muted,{children:"No clocked hours in this fortnight yet."}),J&&Z?(0,v.jsxs)(h.Muted,{children:["Check: ",K.length," shares add up to ",(0,x.gbp)(ee)," of ",(0,x.gbp)(q)," ",ee===q?'\u2713':'',". \xa3",(q/100/(Z/60)).toFixed(4)," per confirmed hour."]}):null,(0,v.jsxs)(h.Muted,{children:["Owner ",C.includeOwner?'included':'left out'," and managers ",C.includeManagers?'included':'left out'," by default (your tipping policy in Tips). Tick or untick anyone for this split."]}),(0,v.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,v.jsx)(h.Button,{small:!0,kind:"success",label:"Copy for spreadsheet",testID:"tips-copy",disabled:!J,onPress:async()=>{const e=await Y(N(oe()));ne(e?'Copied. Paste into the first cell of your spreadsheet.':'Copy is not available here. Use Download CSV.')}}),(0,v.jsx)(h.Button,{small:!0,kind:"secondary",label:"Download CSV",disabled:!J,onPress:()=>{(0,j.downloadText)(`tips-${$.start}-to-${$.end}.csv`,F(oe())),ne('CSV downloaded.')}}),(0,v.jsx)(h.Button,{small:!0,kind:"secondary",label:"Print / PDF",disabled:!J,onPress:()=>{const e=oe();(0,j.printTable)(`Tips ${(0,f.rangeText)($.start,$.end)} (paid ${(0,f.dayMonth)($.payday)})`,`Total ${(0,x.gbp)(q)} shared by confirmed hours${se.length?` \xb7 WARNING ${(0,f.decH)(te)} h not signed off`:''}`,e[0],e.slice(1))}})]}),L?(0,v.jsx)(h.Banner,{kind:"success",title:L}):null]})},_e.PaydaysCard=function({go:e}){const{rid:s,today:t}=(0,P.useCtx)(6e4),{pay:o,source:n}=(0,k.useVenuePay)(s),d=(0,f.nextToPay)(o,'tips',t).period,a=(0,f.nextToPay)(o,'wage',t).period;return(0,v.jsxs)(i.default,{testID:"paydays-card",style:{backgroundColor:b.colours.surface,borderRadius:16,borderWidth:1,borderColor:b.colours.hairline,padding:16,gap:8},children:[(0,v.jsx)(r.CardHeading,{right:'none'===n?(0,v.jsx)(h.Badge,{kind:"amber",label:"Not set up"}):null,children:"Paydays"}),(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,v.jsxs)(h.T,{children:["Next tips payday: ",(0,v.jsx)(h.T,{weight:"semibold",colour:b.colours.goldLight,children:d.payday===t?'today':(0,f.dayMonth)(d.payday)})]}),(0,v.jsx)(h.Muted,{children:(0,f.rangeText)(d.start,d.end)})]}),(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,v.jsxs)(h.T,{children:["Next payday: ",(0,v.jsx)(h.T,{weight:"semibold",colour:b.colours.goldLight,children:a.payday===t?'today':(0,f.dayMonth)(a.payday)})]}),(0,v.jsxs)(h.Muted,{children:["period ",(0,f.rangeText)(a.start,a.end)]})]}),(0,v.jsxs)(r.ActionGrid,{testID:"paydays-actions",children:[(0,v.jsx)(r.ActionTile,{primary:!0,icon:"payroll",label:"Payroll hours",sub:"Copy or export",onPress:()=>e('more','hours'),testID:"paydays-hours"}),(0,v.jsx)(r.ActionTile,{icon:"tips",label:"Tips day",sub:"Share out tips",onPress:()=>e('more','tipsday'),testID:"paydays-tips"})]}),'settings'!==n?(0,v.jsx)(h.Button,{small:!0,kind:"ghost",label:"Pay & tips settings",onPress:()=>e('more','paysettings'),style:{alignSelf:'flex-start'}}):null]})},_e.MyPeriods=function({staffId:e}){const{rid:s,today:t,now:o,meId:n}=(0,P.useCtx)(6e4),r=e??n,{pay:d}=(0,k.useVenuePay)(s),a=(0,y.useOwner)(e=>(0,y.liveAttendance)(e.attendance)),u=(0,y.useOwner)(e=>e.staff.find(e=>e.id===r)),c=(0,f.wagePeriod)(d,t,0),p=(0,f.tipsPeriod)(d,t,0),x=e=>u?z(e,[u],a,o,{})[0]??null:null,j=(e,s,o)=>(0,v.jsxs)(i.default,{style:{flexGrow:1,flexBasis:160,backgroundColor:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.border,padding:12,gap:2},children:[(0,v.jsx)(h.T,{size:13,weight:"semibold",colour:b.colours.gold,children:e.toUpperCase()}),(0,v.jsxs)(h.Muted,{children:[(0,f.rangeText)(s.start,s.end)," \xb7 ",s.payday>=t?'paid':'was paid'," ",(0,f.dayMonth)(s.payday)]}),(0,v.jsx)(h.T,{size:24,weight:"bold",children:(0,l.durText)(o?.confirmed??0)}),(0,v.jsxs)(h.Muted,{children:["approved \xb7 ",o?.shifts??0," shifts"]}),o?.pending?(0,v.jsxs)(h.T,{size:13,colour:b.colours.amber,children:["+ ",(0,l.durText)(o.pending)," waiting for approval"]}):null]},e);return(0,v.jsx)(h.Row,{wrap:!0,gap:8,style:{alignItems:'stretch'},children:[j('This pay period',c,x(c)),j('This tips fortnight',p,x(p))]})};var s=_r(_d[0]),t=_r(_d[1]),o=_r(_d[2]),n=_r(_d[3]),r=_r(_d[4]);_r(_d[5]);var d=e(_r(_d[6])),a=e(_r(_d[7])),i=e(_r(_d[8])),l=_r(_d[9]),u=_r(_d[10]),c=_r(_d[11]),h=_r(_d[12]),p=_r(_d[13]),y=_r(_d[14]),x=_r(_d[15]),f=_r(_d[16]),b=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),T=_r(_d[20]),P=_r(_d[21]),k=_r(_d[22]),C=_r(_d[23]),S=_r(_d[24]),D=_r(_d[25]),v=_r(_d[26]);const M={weekly:'Weekly',fortnightly:'Fortnightly',monthly:'Monthly'},$={none:'Keep the date',before:'Friday before',after:'Monday after'};const B=e=>`${e}${e%10==1&&11!==e?'st':e%10==2&&12!==e?'nd':e%10==3&&13!==e?'rd':'th'}`;function R({label:e,day:s,period:t}){return(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,v.jsxs)(h.T,{children:[e,": ",(0,v.jsx)(h.T,{weight:"bold",colour:b.colours.gold,children:(0,f.dayMonth)(s)})]}),(0,v.jsx)(h.Muted,{children:(0,f.rangeText)(t.start,t.end)})]})}const I=e=>{if(!e)return'';const s=new Date(e);return`${String(s.getHours()).padStart(2,'0')}:${String(s.getMinutes()).padStart(2,'0')}`};function z(e,s,t,o,n){const r=t.filter(s=>s.in&&s.date>=e.start&&s.date<=e.end);return s.map(e=>{const s=r.filter(s=>s.staffId===e.id).sort((e,s)=>e.date.localeCompare(s.date)||(e.in??'').localeCompare(s.in??'')).map(e=>{const s=(0,P.paidMins)(e,o),t=(0,y.attStatus)(e);return{a:e,date:e.date,inT:I(e.in),outT:I(e.out),brk:s.brk,paid:s.paid,status:'open'===t?'On now':'awaiting'===t?'Pending':'Confirmed'}}),t=e=>s.filter(s=>s.status===e).reduce((e,s)=>e+s.paid,0),d=t('Confirmed'),a=n[e.id];return{person:e,confirmed:d,pending:t('Pending'),open:t('On now'),shifts:s.filter(e=>'On now'!==e.status).length,days:s,rate:a,gross:null!=a?Math.round(d/60*a):void 0}}).filter(e=>e.days.length>0||e.person.active&&'owner'!==e.person.role)}const H=e=>`${y.ROLE_LABEL[e.role]}${e.job?` \xb7 ${e.job}`:''}`,O=e=>e.name.replace(' (example)',''),A=e=>null==e?'':(e/100).toFixed(2),W=e=>e.replace(/[\t\r\n]+/g,' '),L=e=>/[",\n]/.test(e)?`"${e.replace(/"/g,'""')}"`:e,N=e=>e.map(e=>e.map(W).join('\t')).join('\n'),F=e=>e.map(e=>e.map(L).join(',')).join('\r\n');function V(e,s,t,o){const n=['Name','Role','Period start','Period end','Confirmed hours','Confirmed h:mm','Pending hours','Pending h:mm','Shifts',...o?['Tips hours']:[],...t?['Rate \xa3/h','Gross \xa3']:[]],r=e.map(e=>[O(e.person),H(e.person),(0,f.ukDate)(s.start),(0,f.ukDate)(s.end),(0,f.decH)(e.confirmed),(0,f.hMm)(e.confirmed),(0,f.decH)(e.pending),(0,f.hMm)(e.pending),String(e.shifts),...o?[(0,f.decH)(e.confirmed)]:[],...t?[A(e.rate),A(e.gross)]:[]]),d=e.reduce((e,s)=>({c:e.c+s.confirmed,p:e.p+s.pending,s:e.s+s.shifts,g:e.g+(s.gross??0)}),{c:0,p:0,s:0,g:0});return[n,...r,['TOTAL','',(0,f.ukDate)(s.start),(0,f.ukDate)(s.end),(0,f.decH)(d.c),(0,f.hMm)(d.c),(0,f.decH)(d.p),(0,f.hMm)(d.p),String(d.s),...o?[(0,f.decH)(d.c)]:[],...t?['',A(d.g)]:[]]]}function E(e){return[['Name','Role','Date','In','Out','Break mins','Paid hours','Paid h:mm','Status'],...e.flatMap(e=>e.days.map(s=>[O(e.person),H(e.person),(0,f.ukDate)(s.date),s.inT,s.outT,'On now'===s.status?'':String(s.brk),'On now'===s.status?'':(0,f.decH)(s.paid),'On now'===s.status?'':(0,f.hMm)(s.paid),s.status]))]}async function Y(e){if('undefined'==typeof document)return!1;try{if(navigator.clipboard?.writeText)return await navigator.clipboard.writeText(e),!0}catch{}try{const s=document.createElement('textarea');s.value=e,s.style.position='fixed',s.style.opacity='0',document.body.appendChild(s),s.select();const t=document.execCommand('copy');return s.remove(),t}catch{return!1}}function G(e,s){const t=(0,f.nextToPay)(e,'wage',s),o=(0,f.nextToPay)(e,'tips',s),n=(0,f.wagePeriod)(e,t.period.start,-1),r=(0,f.tipsPeriod)(e,o.period.start,-1),d=e=>e.payday>=s?e.payday===s?'Pays today':`Pays ${(0,f.dayMonth)(e.payday)}`:`Paid ${(0,f.dayMonth)(e.payday)}`;return[{id:'wage',label:`Wages ${(0,f.rangeText)(t.period.start,t.period.end)}`,sub:d(t.period),period:t.period},{id:'wagePrev',label:`Wages ${(0,f.rangeText)(n.start,n.end)}`,sub:d(n),period:n},{id:'tips',label:`Tips ${(0,f.rangeText)(o.period.start,o.period.end)}`,sub:d(o.period),period:o.period},{id:'tipsPrev',label:`Tips ${(0,f.rangeText)(r.start,r.end)}`,sub:d(r),period:r}]}function U({onSet:e}){const[s,o]=(0,n.useState)(''),[r,d]=(0,n.useState)(''),a=(0,f.parseUk)(s),l=(0,f.parseUk)(r),u=!!a&&!!l&&l>=a&&(0,f.plusDays)(a,92)>=l;return(0,v.jsxs)(h.Row,{wrap:!0,gap:6,style:{alignItems:'flex-end'},children:[(0,v.jsx)(i.default,{style:{flexBasis:130,flexGrow:1},children:(0,v.jsx)(h.Field,{label:"From (DD/MM/YYYY)",value:s,onChangeText:e=>o((0,t.slashDate)(e,s)),placeholder:"23/10/2026",keyboardType:"numbers-and-punctuation",maxLength:10})}),(0,v.jsx)(i.default,{style:{flexBasis:130,flexGrow:1},children:(0,v.jsx)(h.Field,{label:"To (DD/MM/YYYY)",value:r,onChangeText:e=>d((0,t.slashDate)(e,r)),placeholder:"22/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10})}),(0,v.jsx)(h.Button,{small:!0,kind:"success",label:"Show",disabled:!u,onPress:()=>u&&e((0,f.customPeriod)(a,l))}),s&&r&&!u?(0,v.jsx)(h.T,{size:13,colour:b.colours.red,children:"Use two dates, the second on or after the first, up to 3 months apart."}):null]})}const _=[150,54,100,90,48,62,70]},1179,[827,1059,1174,34,1180,236,402,426,102,1182,1183,1184,794,831,891,867,1060,821,930,1187,1175,1084,1061,1185,872,1186,25]); __d(function(g,_r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ActionTile=function({label:e,sub:r,icon:c,onPress:u,primary:h,tone:b="gold",count:f,testID:x,accessibilityLabel:y}){const j='blue'===b?i.colours.blue:i.colours.gold;return(0,s.jsxs)(t.default,{testID:x,accessibilityRole:"button",accessibilityLabel:y??(r?`${e}, ${r}`:e),onPress:u,style:({pressed:e})=>({flex:1,minWidth:0,minHeight:68,borderRadius:16,borderWidth:1,borderColor:h?i.colours.accentBorder:i.colours.hairline,backgroundColor:e?i.colours.tilePressed:i.colours.tile,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:12,paddingHorizontal:14,paddingVertical:12}),children:[(0,s.jsx)(o.default,{style:{width:40,height:40,borderRadius:12,alignItems:'center',justifyContent:'center',backgroundColor:h?i.colours.accentBg:'rgba(255,255,255,0.04)',borderWidth:1,borderColor:h?i.colours.accentBorder:i.colours.hairline},children:(0,s.jsx)(l.Icon,{name:c,size:21,colour:j})}),(0,s.jsxs)(o.default,{style:{flexShrink:1,minWidth:0},children:[(0,s.jsx)(n.T,{size:15,weight:"semibold",numberOfLines:1,colour:i.colours.text,children:e}),r?(0,s.jsx)(n.T,{size:12,numberOfLines:1,colour:i.colours.muted,children:r}):null]}),f?(0,s.jsx)(o.default,{style:{backgroundColor:i.colours.amber,borderRadius:10,minWidth:22,paddingHorizontal:6},children:(0,s.jsx)(n.T,{size:12,weight:"bold",colour:i.colours.onGold,center:!0,children:f})}):null]})},_e.ActionGrid=function({children:e,testID:t="action-grid"}){const l=r.default.Children.toArray(e).filter(Boolean),i=[];for(let e=0;e(0,s.jsxs)(o.default,{style:{flexDirection:'row',gap:12},children:[e,1===e.length?(0,s.jsx)(o.default,{style:{flex:1}}):null]},r))})},Object.defineProperty(_e,"CardHeading",{enumerable:!0,get:function(){return c}});var r=e(_r(d[0])),t=e(_r(d[1])),o=e(_r(d[2])),l=_r(d[3]),i=_r(d[4]),n=_r(d[5]),s=_r(d[6]);const c=({children:e,right:r})=>(0,s.jsxs)(o.default,{style:{flexDirection:'row',alignItems:'center',justifyContent:'space-between'},children:[(0,s.jsx)(n.T,{size:12,weight:"semibold",colour:i.colours.goldMuted,style:{letterSpacing:1.6,textTransform:'uppercase'},children:e}),r]})},1180,[34,402,102,1181,821,794,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Icon=function({name:l,size:x=22,colour:t}){const n={stroke:t,strokeWidth:2,fill:'none',strokeLinecap:'round',strokeLinejoin:'round'};return(0,e.jsxs)(h.default,{width:x,height:x,viewBox:"0 0 24 24",children:['home'===l?(0,e.jsx)(s.Path,{d:"M3 11l9-7 9 7v9a1 1 0 0 1-1 1h-5v-6H9v6H4a1 1 0 0 1-1-1z",...n}):null,'signoff'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"11",r:"8",...n}),(0,e.jsx)(s.Path,{d:"M11 6.5V11l3 2",...n}),(0,e.jsx)(s.Path,{d:"M15.5 19.5l2 2 4-4.2",...n})]}):null,'orders'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"5",y:"3",width:"14",height:"18",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M9 8h6M9 12h6M9 16h4",...n})]}):null,'bookings'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4",...n})]}):null,'forecast'===l?(0,e.jsx)(s.Path,{d:"M4 20V10M10 20V4M16 20v-7M22 20H2",...n}):null,'more'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"5",cy:"12",r:"1.6",fill:t}),(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"1.6",fill:t}),(0,e.jsx)(s.Circle,{cx:"19",cy:"12",r:"1.6",fill:t})]}):null,'search'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"11",r:"7",...n}),(0,e.jsx)(s.Path,{d:"M20 20l-4-4",...n})]}):null,'bell'===l?(0,e.jsx)(s.Path,{d:"M6 16V11a6 6 0 0 1 12 0v5l2 2H4zM10 20a2 2 0 0 0 4 0",...n}):null,'chat'===l?(0,e.jsx)(s.Path,{d:"M4 5h16v11H9l-5 4z",...n}):null,'clock'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M12 7v5l3 2",...n})]}):null,'user'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"8",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M4 21a8 8 0 0 1 16 0",...n})]}):null,'walkin'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"13",cy:"4.5",r:"1.8",...n}),(0,e.jsx)(s.Path,{d:"M10 21l2-6 3 3v3M9 12l2-4 4 1 2 3M11 8l-1 5",...n})]}):null,'calendarPlus'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4M12 13v5M9.5 15.5h5",...n})]}):null,'pause'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M10 9v6M14 9v6",...n})]}):null,'rain'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M7 15a4 4 0 0 1-.6-7.95A5.5 5.5 0 0 1 17 7.5a3.75 3.75 0 0 1 .5 7.5z",...n}),(0,e.jsx)(s.Path,{d:"M9 18l-1 2.5M13 18l-1 2.5M17 18l-1 2.5",...n})]}):null,'sun'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M12 2v2M12 20v2M2 12h2M20 12h2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4",...n})]}):null,'payroll'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"4",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M7 9h6M7 13h4M15 12.5a2 2 0 1 0 0 .01M7 17h10",...n})]}):null,'tips'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M14.5 9a2.5 2.5 0 0 0-5 0c0 2.5 0 4-1.5 6h7M9 12.5h4",...n})]}):null,'sparkle'===l?(0,e.jsx)(s.Path,{d:"M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8zM19 16l.7 1.8 1.8.7-1.8.7L19 21l-.7-1.8-1.8-.7 1.8-.7z",...n}):null,'platter'===l?(0,e.jsx)(e.Fragment,{children:(0,e.jsx)(s.Path,{d:"M3 15h18M5 15a7 7 0 0 1 14 0M12 6v2M2 18h20",...n})}):null,'check'===l?(0,e.jsx)(s.Path,{d:"M5 12.5l4.5 4.5L19 7.5",...n}):null,'alert'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M12 3l9.5 17h-19z",...n}),(0,e.jsx)(s.Path,{d:"M12 10v4M12 17.2v.1",...n})]}):null,'access'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"4.5",r:"1.8",...n}),(0,e.jsx)(s.Path,{d:"M11 7.5v6h5l2.5 5M11 10h5M8 11.5a5.5 5.5 0 1 0 7.5 6.5",...n})]}):null,'dog'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 10l1-5 3 3h4l3-3 1 5v4a5 5 0 0 1-5 5h-2a5 5 0 0 1-5-5z",...n}),(0,e.jsx)(s.Path,{d:"M10 13v.1M14 13v.1M11 16h2",...n})]}):null,'leaf'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 19c0-8 5-14 15-14 0 10-6 15-14 15",...n}),(0,e.jsx)(s.Path,{d:"M5 19l8-8",...n})]}):null,'table'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"4",y:"8",width:"16",height:"8",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M8 16v4M16 16v4M8 4v4M16 4v4",...n})]}):null,'bag'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 8h14l-1 12H6z",...n}),(0,e.jsx)(s.Path,{d:"M9 10V7a3 3 0 0 1 6 0v3",...n})]}):null,'phone'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"7",y:"2.5",width:"10",height:"19",rx:"2.5",...n}),(0,e.jsx)(s.Path,{d:"M11 18.5h2",...n})]}):null,'swap'===l?(0,e.jsx)(s.Path,{d:"M7 4L3 8l4 4M3 8h14M17 20l4-4-4-4M21 16H7",...n}):null,'box'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M3.5 8L12 4l8.5 4v8L12 20l-8.5-4z",...n}),(0,e.jsx)(s.Path,{d:"M3.5 8L12 12l8.5-4M12 12v8",...n})]}):null,'star'===l?(0,e.jsx)(s.Path,{d:"M12 3.5l2.6 5.4 5.9.8-4.3 4.1 1 5.8L12 16.8l-5.2 2.8 1-5.8L3.5 9.7l5.9-.8z",...n}):null,'userPlus'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"10",cy:"8",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M3 21a7 7 0 0 1 14 0M19 8v6M16 11h6",...n})]}):null,'gift'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3.5",y:"8.5",width:"17",height:"4",rx:"1",...n}),(0,e.jsx)(s.Path,{d:"M5 12.5V20h14v-7.5M12 8.5V20M12 8.5C10 8.5 7.5 7.8 7.5 5.8S10.5 4 12 8.5c1.5-4.5 4.5-4.7 4.5-2.7S14 8.5 12 8.5z",...n})]}):null,'tag'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M3.5 12.5V4h8.5l8.5 8.5-8.5 8.5z",...n}),(0,e.jsx)(s.Circle,{cx:"8",cy:"8.5",r:"1.4",...n})]}):null,'hanger'===l?(0,e.jsx)(s.Path,{d:"M12 7.5a2 2 0 1 1 2-2M12 7.5v2L3 16.5h18L12 9.5",...n}):null]})},r(d[0]);var l,s=r(d[1]),h=(l=s)&&l.__esModule?l:{default:l},e=r(d[2])},1181,[34,797,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Icon=function({name:l,size:x=22,colour:t}){const n={stroke:t,strokeWidth:2,fill:'none',strokeLinecap:'round',strokeLinejoin:'round'};return(0,e.jsxs)(h.default,{width:x,height:x,viewBox:"0 0 24 24",children:['home'===l?(0,e.jsx)(s.Path,{d:"M3 11l9-7 9 7v9a1 1 0 0 1-1 1h-5v-6H9v6H4a1 1 0 0 1-1-1z",...n}):null,'signoff'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"11",r:"8",...n}),(0,e.jsx)(s.Path,{d:"M11 6.5V11l3 2",...n}),(0,e.jsx)(s.Path,{d:"M15.5 19.5l2 2 4-4.2",...n})]}):null,'orders'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"5",y:"3",width:"14",height:"18",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M9 8h6M9 12h6M9 16h4",...n})]}):null,'rota'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4M7 14h4M13 14h4M7 18h6",...n})]}):null,'bookings'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4",...n})]}):null,'forecast'===l?(0,e.jsx)(s.Path,{d:"M4 20V10M10 20V4M16 20v-7M22 20H2",...n}):null,'more'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"5",cy:"12",r:"1.6",fill:t}),(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"1.6",fill:t}),(0,e.jsx)(s.Circle,{cx:"19",cy:"12",r:"1.6",fill:t})]}):null,'search'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"11",r:"7",...n}),(0,e.jsx)(s.Path,{d:"M20 20l-4-4",...n})]}):null,'bell'===l?(0,e.jsx)(s.Path,{d:"M6 16V11a6 6 0 0 1 12 0v5l2 2H4zM10 20a2 2 0 0 0 4 0",...n}):null,'chat'===l?(0,e.jsx)(s.Path,{d:"M4 5h16v11H9l-5 4z",...n}):null,'clock'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M12 7v5l3 2",...n})]}):null,'user'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"8",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M4 21a8 8 0 0 1 16 0",...n})]}):null,'walkin'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"13",cy:"4.5",r:"1.8",...n}),(0,e.jsx)(s.Path,{d:"M10 21l2-6 3 3v3M9 12l2-4 4 1 2 3M11 8l-1 5",...n})]}):null,'calendarPlus'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4M12 13v5M9.5 15.5h5",...n})]}):null,'pause'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M10 9v6M14 9v6",...n})]}):null,'rain'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M7 15a4 4 0 0 1-.6-7.95A5.5 5.5 0 0 1 17 7.5a3.75 3.75 0 0 1 .5 7.5z",...n}),(0,e.jsx)(s.Path,{d:"M9 18l-1 2.5M13 18l-1 2.5M17 18l-1 2.5",...n})]}):null,'sun'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M12 2v2M12 20v2M2 12h2M20 12h2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4",...n})]}):null,'payroll'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"4",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M7 9h6M7 13h4M15 12.5a2 2 0 1 0 0 .01M7 17h10",...n})]}):null,'tips'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M14.5 9a2.5 2.5 0 0 0-5 0c0 2.5 0 4-1.5 6h7M9 12.5h4",...n})]}):null,'sparkle'===l?(0,e.jsx)(s.Path,{d:"M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8zM19 16l.7 1.8 1.8.7-1.8.7L19 21l-.7-1.8-1.8-.7 1.8-.7z",...n}):null,'platter'===l?(0,e.jsx)(e.Fragment,{children:(0,e.jsx)(s.Path,{d:"M3 15h18M5 15a7 7 0 0 1 14 0M12 6v2M2 18h20",...n})}):null,'check'===l?(0,e.jsx)(s.Path,{d:"M5 12.5l4.5 4.5L19 7.5",...n}):null,'alert'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M12 3l9.5 17h-19z",...n}),(0,e.jsx)(s.Path,{d:"M12 10v4M12 17.2v.1",...n})]}):null,'access'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"4.5",r:"1.8",...n}),(0,e.jsx)(s.Path,{d:"M11 7.5v6h5l2.5 5M11 10h5M8 11.5a5.5 5.5 0 1 0 7.5 6.5",...n})]}):null,'dog'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 10l1-5 3 3h4l3-3 1 5v4a5 5 0 0 1-5 5h-2a5 5 0 0 1-5-5z",...n}),(0,e.jsx)(s.Path,{d:"M10 13v.1M14 13v.1M11 16h2",...n})]}):null,'leaf'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 19c0-8 5-14 15-14 0 10-6 15-14 15",...n}),(0,e.jsx)(s.Path,{d:"M5 19l8-8",...n})]}):null,'table'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"4",y:"8",width:"16",height:"8",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M8 16v4M16 16v4M8 4v4M16 4v4",...n})]}):null,'bag'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 8h14l-1 12H6z",...n}),(0,e.jsx)(s.Path,{d:"M9 10V7a3 3 0 0 1 6 0v3",...n})]}):null,'phone'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"7",y:"2.5",width:"10",height:"19",rx:"2.5",...n}),(0,e.jsx)(s.Path,{d:"M11 18.5h2",...n})]}):null,'swap'===l?(0,e.jsx)(s.Path,{d:"M7 4L3 8l4 4M3 8h14M17 20l4-4-4-4M21 16H7",...n}):null,'box'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M3.5 8L12 4l8.5 4v8L12 20l-8.5-4z",...n}),(0,e.jsx)(s.Path,{d:"M3.5 8L12 12l8.5-4M12 12v8",...n})]}):null,'star'===l?(0,e.jsx)(s.Path,{d:"M12 3.5l2.6 5.4 5.9.8-4.3 4.1 1 5.8L12 16.8l-5.2 2.8 1-5.8L3.5 9.7l5.9-.8z",...n}):null,'userPlus'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"10",cy:"8",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M3 21a7 7 0 0 1 14 0M19 8v6M16 11h6",...n})]}):null,'gift'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3.5",y:"8.5",width:"17",height:"4",rx:"1",...n}),(0,e.jsx)(s.Path,{d:"M5 12.5V20h14v-7.5M12 8.5V20M12 8.5C10 8.5 7.5 7.8 7.5 5.8S10.5 4 12 8.5c1.5-4.5 4.5-4.7 4.5-2.7S14 8.5 12 8.5z",...n})]}):null,'tag'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M3.5 12.5V4h8.5l8.5 8.5-8.5 8.5z",...n}),(0,e.jsx)(s.Circle,{cx:"8",cy:"8.5",r:"1.4",...n})]}):null,'hanger'===l?(0,e.jsx)(s.Path,{d:"M12 7.5a2 2 0 1 1 2-2M12 7.5v2L3 16.5h18L12 9.5",...n}):null]})},r(d[0]);var l,s=r(d[1]),h=(l=s)&&l.__esModule?l:{default:l},e=r(d[2])},1181,[34,797,25]); __d(function(_g,_r,i,_a,_m,e,d){"use strict";function t(t){const n=Math.max(0,Math.round(t||0)),o=Math.floor(n/60),r=n%60;return o?`${o}h ${String(r).padStart(2,'0')}m`:`${r}m`}function n(t){const n=Math.max(0,Math.round(t||0)),o=Math.floor(n/60),r=n%60;return[o?`${o} ${1===o?'hour':'hours'}`:'',r||!o?`${r} ${1===r?'minute':'minutes'}`:''].filter(Boolean).join(' ')}Object.defineProperty(e,'__esModule',{value:!0}),e.durText=t,e.durWords=n,e.isZeroShift=function(t){return!(!t.in||!t.out)&&Date.parse(t.out)-Date.parse(t.in)<6e4},Object.defineProperty(e,"isVoided",{enumerable:!0,get:function(){return o}}),e.shiftSentence=function(t,o){if('On now'===t.status)return`${o}, clocked in at ${t.inT}, still on shift.`;const r=t.zero?' Check: 0 minutes, clocked in and out at the same moment.':'';return`${o}, ${t.inT} to ${t.outT}, break ${n(t.brk)}, paid ${n(t.paid)}, ${'Approved'===t.status?'approved':'pending approval'}.${r}`},e.hoursSummary=function(n,o,r){const u=t=>null!=r?Math.round(t/60*r):null;return{approved:{mins:n,text:t(n),gross:u(n)},pending:{mins:o,text:t(o),gross:u(o)}}};const o=t=>!!t.voided},1182,[]); __d(function(g,r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ShiftCard=function({d:e,manager:t,onApprove:s,onEdit:d,onRemove:l}){const a='Confirmed'===e.status?'Approved':e.status,y=(0,u.isZeroShift)(e.a),x={date:e.date,dateText:b(e.date),inT:e.inT,outT:e.outT,brk:e.brk,paid:e.paid,status:a,zero:y};return(0,h.jsxs)(n.default,{testID:`shift-${e.a.id}`,style:{borderRadius:14,borderWidth:1,borderColor:y?c.colours.amber:'rgba(212,175,106,0.35)',backgroundColor:'#15130F',padding:12,gap:8,alignItems:'center'},children:[(0,h.jsxs)(n.default,{accessible:!0,accessibilityLabel:(0,u.shiftSentence)(x,p(e.date)),style:{alignItems:'center',gap:4,width:'100%'},children:[(0,h.jsx)(o.T,{size:16,weight:"bold",colour:c.colours.goldLight,center:!0,children:b(e.date)}),(0,h.jsx)(o.T,{size:17,weight:"semibold",center:!0,children:'On now'===e.status?`${e.inT} to now`:`${e.inT} to ${e.outT}`}),'On now'!==e.status?(0,h.jsxs)(o.T,{size:15,colour:c.colours.text,center:!0,children:["Break ",(0,u.durText)(e.brk)," \xb7 Paid ",(0,h.jsx)(o.T,{size:15,weight:"bold",colour:c.colours.gold,children:(0,u.durText)(e.paid)})]}):null,(0,h.jsx)(o.Badge,{kind:'Approved'===a?'ok':'Pending'===a?'amber':'neutral',label:'Pending'===a?'Pending approval':a}),y?(0,h.jsx)(n.default,{testID:`shift-zero-${e.a.id}`,style:{borderRadius:8,borderWidth:1,borderColor:c.colours.amber,paddingHorizontal:10,paddingVertical:4},children:(0,h.jsx)(o.T,{size:14,weight:"bold",colour:c.colours.amber,center:!0,children:"Check: 0 minutes"})}):null,e.a.added&&e.a.signOff?(0,h.jsxs)(o.Muted,{center:!0,testID:`shift-entered-${e.a.id}`,children:["Entered by ",e.a.signOff.by]}):null]}),t?(0,h.jsxs)(o.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:['Pending'===e.status&&!y&&s?(0,h.jsx)(o.Button,{label:"Approve",testID:`shift-approve-${e.a.id}`,accessibilityLabel:`Approve ${p(e.date)}, paid ${(0,u.durWords)(e.paid)}`,onPress:s,style:{minHeight:48,minWidth:120}}):null,(y||'Pending'===e.status)&&d?(0,h.jsx)(o.Button,{kind:"secondary",label:"Edit",testID:`shift-edit-${e.a.id}`,accessibilityLabel:`Edit the shift on ${p(e.date)}`,onPress:d,style:{minHeight:48,minWidth:96}}):null,y&&'Confirmed'!==e.status&&l?(0,h.jsx)(o.Button,{kind:"secondary",label:"Remove",testID:`shift-remove-${e.a.id}`,accessibilityLabel:`Remove the 0-minute shift on ${p(e.date)}. It is kept in the history.`,onPress:l,style:{minHeight:48,minWidth:96}}):null]}):null]})},_e.HoursSummaryCard=function({name:e,role:t,approved:s,pending:d,rate:l}){const p=(0,u.hoursSummary)(s,d,l),b=`${e}. Approved ${(0,u.durWords)(s)}${null!=p.approved.gross?`, ${(0,a.gbp)(p.approved.gross)}`:''}. Pending approval ${(0,u.durWords)(d)}${null!=p.pending.gross?`, ${(0,a.gbp)(p.pending.gross)} once approved`:''}.${null!=l?` Rate ${(0,a.gbp)(l)} an hour.`:''}`;return(0,h.jsxs)(n.default,{accessible:!0,accessibilityLabel:b,testID:"hours-summary-card",style:{alignItems:'center',gap:6,width:'100%'},children:[(0,h.jsx)(o.T,{size:18,weight:"bold",center:!0,children:e}),t?(0,h.jsx)(o.Muted,{center:!0,children:t}):null,(0,h.jsxs)(o.Row,{wrap:!0,gap:10,style:{justifyContent:'center'},children:[(0,h.jsxs)(n.default,{style:{minWidth:150,borderRadius:12,borderWidth:1,borderColor:c.colours.ok,padding:10,alignItems:'center'},children:[(0,h.jsx)(o.T,{size:13,weight:"semibold",colour:c.colours.ok,children:"APPROVED"}),(0,h.jsx)(o.T,{size:20,weight:"bold",testID:"sum-approved",children:p.approved.text}),(0,h.jsx)(o.Muted,{children:null!=p.approved.gross?`${(0,a.gbp)(p.approved.gross)} gross`:'no rate'})]}),(0,h.jsxs)(n.default,{style:{minWidth:150,borderRadius:12,borderWidth:1,borderColor:c.colours.amber,padding:10,alignItems:'center'},children:[(0,h.jsx)(o.T,{size:13,weight:"semibold",colour:c.colours.amber,children:"PENDING"}),(0,h.jsx)(o.T,{size:20,weight:"bold",testID:"sum-pending",children:p.pending.text}),(0,h.jsx)(o.Muted,{children:null!=p.pending.gross?`${(0,a.gbp)(p.pending.gross)} once approved`:'no rate'})]})]}),null!=l?(0,h.jsxs)(o.Muted,{center:!0,children:["Rate ",(0,a.gbp)(l)," an hour",(y=null,null==y?'':` \xb7 ${(0,a.gbp)(y)}`)]}):null]});var y},_e.RemoveShiftSheet=function({a:e,who:s,onClose:n}){const[a,u]=(0,t.useState)('Clocked in and out by mistake (0 minutes)'),p=a.trim().length>=3;return(0,h.jsxs)(o.Sheet,{visible:!0,onClose:n,title:`Remove the shift on ${b(e.date)}?`,maxWidth:520,testID:"remove-shift",children:[(0,h.jsx)(o.T,{size:16,center:!0,children:"It comes out of hours, pay and exports. It isn\u2019t deleted: it stays in the history with your name and the reason."}),(0,h.jsx)(d.TextInput,{accessibilityLabel:"Reason for removing the shift",value:a,onChangeText:u,style:{minHeight:48,borderRadius:10,borderWidth:1,borderColor:c.colours.gold,color:c.colours.text,paddingHorizontal:12}}),(0,h.jsxs)(o.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,h.jsx)(o.Button,{label:"Remove shift",testID:"remove-shift-yes",disabled:!p,onPress:()=>{l.useOwner.getState().voidEntry(e.id,s.name,s.id,a.trim(),(new Date).toISOString()),n()},style:{minHeight:56}}),(0,h.jsx)(o.Button,{kind:"secondary",label:"Keep it",onPress:n,style:{minHeight:56}})]})]})};var e,t=r(_d[0]),s=r(_d[1]),n=(e=s)&&e.__esModule?e:{default:e},o=r(_d[2]),d=r(_d[3]),l=r(_d[4]),a=r(_d[5]),u=r(_d[6]),c=r(_d[7]),h=r(_d[8]);const p=e=>new Date(`${e}T12:00:00Z`).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long',timeZone:'UTC'}),b=e=>new Date(`${e}T12:00:00Z`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',timeZone:'UTC'})},1183,[34,102,794,827,891,867,1182,821,25]); __d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"REASONS",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"isoAt",{enumerable:!0,get:function(){return S}}),_e.flagsFor=D,_e.notesFor=$,Object.defineProperty(_e,"statusLabel",{enumerable:!0,get:function(){return M}}),Object.defineProperty(_e,"statusKind",{enumerable:!0,get:function(){return O}}),_e.AuditTrail=B,_e.TimeEdit=R,_e.OverrideSheet=A,_e.outstandingDays=P,_e.useOutstanding=function(){const e=(0,r.useOwner)(e=>(0,r.liveAttendance)(e.attendance)),t=(0,r.useOwner)(e=>e.timeRequests),n=(0,u.ymd)(new Date);return(0,s.useMemo)(()=>({days:P(e,n),requests:t.filter(e=>'open'===e.status).length}),[e,t,n])},_e.SignOff=function(){const{now:e,today:t,me:n,meId:m}=(0,h.useCtx)(3e4),p=(0,r.useOwner)(e=>e.staff),x=(0,r.useOwner)(e=>(0,r.liveAttendance)(e.attendance)),j=(0,r.useOwner)(e=>e.shifts),k=(0,r.useOwner)(e=>e.timeRequests),w=(0,r.useOwner)(e=>e.leave),S=(0,s.useMemo)(()=>P(x,t),[x,t]),[I,T]=(0,s.useState)(t),[B,R]=(0,s.useState)(null),[q,z]=(0,s.useState)(null),H=(0,s.useMemo)(()=>{const n=x.filter(e=>e.date===I&&e.in),s=n.map(n=>{const s=(0,r.shiftOf)(j,n.staffId,I);return{key:n.id,staffId:n.staffId,a:n,sh:s,flags:D(n,s,e,t,k)}});j.filter(e=>e.date===I&&!1!==e.published&&!n.some(t=>t.staffId===e.staffId)).forEach(n=>{const o=(0,d.leaveCovering)(w,n.staffId,I);if(o)return void(s.some(e=>e.leave&&e.staffId===n.staffId)||s.push({key:`leave-${n.id}`,staffId:n.staffId,sh:n,flags:[],leave:o}));(I60*n.start+15)&&s.push({key:`miss-${n.id}`,staffId:n.staffId,sh:n,flags:[{key:'noin',label:'No clock-in'}]})});const o=e=>e.leave?4:e.a?'confirmed'===(0,r.attStatus)(e.a)?3:e.flags.length?0:2:1;return s.sort((e,t)=>o(e)-o(t)||(p.find(t=>t.id===e.staffId)?.name??'').localeCompare(p.find(e=>e.id===t.staffId)?.name??''))},[x,j,k,w,I,e.getMinutes(),p]),N=k.filter(e=>'open'===e.status&&e.date===I),F=k.filter(e=>'open'===e.status&&e.date!==I),E=H.filter(e=>e.a&&'awaiting'===(0,r.attStatus)(e.a)&&!e.flags.length),_=H.reduce((t,n)=>{if(!n.a)return t;const s=(0,h.paidMins)(n.a,e).paid;return'confirmed'===(0,r.attStatus)(n.a)?t.conf+=s:t.pend+=s,t},{conf:0,pend:0}),Y={confirmed:H.filter(e=>e.a&&'confirmed'===(0,r.attStatus)(e.a)).length,awaiting:H.filter(e=>e.a&&'awaiting'===(0,r.attStatus)(e.a)).length,open:H.filter(e=>e.a&&'open'===(0,r.attStatus)(e.a)).length,flagged:H.filter(e=>e.flags.length&&!(e.a&&'confirmed'===(0,r.attStatus)(e.a))).length,off:H.filter(e=>e.leave).length},L=[t,...S.map(e=>e.date).filter(e=>e!==t)];for(let e=1;L.length<8&&e<=7;e++){const n=v(t,-e);L.includes(n)||L.push(n)}const W=t=>{const s=r.useOwner.getState().confirmEntries(t,n,m,e.toISOString());z(s?`${s} ${1===s?'entry':'entries'} confirmed`:null)};return(0,b.jsxs)(a.default,{style:{gap:10},testID:"signoff",children:[S.filter(e=>e.date!==I).length?(0,b.jsx)(o.default,{accessibilityRole:"button",onPress:()=>T(S.filter(e=>e.date!==I)[S.filter(e=>e.date!==I).length-1].date),children:(0,b.jsx)(l.Banner,{kind:"warn",title:`${S.filter(e=>e.date!==I).length} earlier ${1===S.filter(e=>e.date!==I).length?'day':'days'} still to sign off`,children:"Hours only count for pay once they\u2019re confirmed. Tap to open the oldest."})}):null,(0,b.jsx)(l.Row,{wrap:!0,gap:6,children:L.slice(0,10).sort((e,t)=>t.localeCompare(e)).map(e=>{const n=S.find(t=>t.date===e);return(0,b.jsx)(l.Chip,{label:C(e,t),sub:n?`${n.n} to sign off`:void 0,selected:I===e,onPress:()=>{T(e),z(null)}},e)})}),(0,b.jsx)(l.Card,{children:(0,b.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,b.jsxs)(a.default,{style:{flex:1},children:[(0,b.jsxs)(l.T,{size:18,weight:"bold",children:[C(I,t),I===t||I===v(t,-1)?` \xb7 ${(0,u.niceDate)((0,u.parseYmd)(I))}`:'']}),(0,b.jsxs)(l.Muted,{children:[Y.confirmed," confirmed \xb7 ",Y.awaiting," awaiting \xb7 ",Y.open," still clocked in",Y.flagged?` \xb7 ${Y.flagged} flagged`:'',Y.off?` \xb7 ${Y.off} on time off`:'']})]}),(0,b.jsxs)(a.default,{style:{alignItems:'flex-end'},children:[(0,b.jsx)(l.T,{size:18,weight:"bold",colour:c.colours.ok,children:(0,h.hmDur)(_.conf)}),(0,b.jsx)(l.Muted,{children:"confirmed"}),_.pend?(0,b.jsxs)(l.T,{size:13,colour:c.colours.amber,children:[(0,h.hmDur)(_.pend)," pending"]}):null]})]})}),q?(0,b.jsx)(l.Banner,{kind:"success",title:q}):null,N.length||F.length?(0,b.jsx)(f.SectionHead,{title:"Correction requests",sub:"From the Staff app. Apply opens the times to check; declining keeps the times as clocked."}):null,[...N,...F].map(t=>{const s=p.find(e=>e.id===t.staffId),o=t.attendanceId&&x.find(e=>e.id===t.attendanceId)||x.find(e=>e.staffId===t.staffId&&e.date===t.date&&e.in);return(0,b.jsxs)(l.Card,{highlight:c.colours.blue,children:[(0,b.jsxs)(l.Row,{gap:8,children:[(0,b.jsx)(i.StaffAvatar,{id:t.staffId,size:30}),(0,b.jsxs)(a.default,{style:{flex:1},children:[(0,b.jsxs)(l.T,{weight:"semibold",children:[y(s?.name)," \xb7 ",(0,u.niceDate)((0,u.parseYmd)(t.date))]}),(0,b.jsxs)(l.Muted,{children:['in'===t.kind?'Forgot to clock in':'out'===t.kind?'Forgot to clock out':'Forgot to clock in and out',t.suggestedIn?` \xb7 in ${(0,u.hm)(new Date(t.suggestedIn))}`:'',t.suggestedOut?` \xb7 out ${(0,u.hm)(new Date(t.suggestedOut))}`:'',t.note?` \xb7 \u201c${t.note}\u201d`:'']})]}),(0,b.jsx)(l.Badge,{kind:"blue",label:"Request"})]}),(0,b.jsxs)(l.Row,{gap:6,children:[(0,b.jsx)(l.Button,{small:!0,kind:"success",label:"Review & apply",onPress:()=>R({staffId:t.staffId,a:o,request:t})}),(0,b.jsx)(l.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>r.useOwner.getState().resolveTimeRequest(t.id,'declined',n,e.toISOString())})]})]},t.id)}),(0,b.jsx)(f.SectionHead,{title:"Hours",sub:"Rostered vs actual. Flagged rows need a look and are confirmed one by one."}),H.map(t=>{const n=p.find(e=>e.id===t.staffId),s=t.a,o=s?(0,h.paidMins)(s,e):null,f=s?(0,r.attStatus)(s):null,m=s?.audit?.filter(e=>'confirmed'!==e.action).slice(-1)[0];return(0,b.jsx)(l.Card,{highlight:t.leave?c.colours.blue:'confirmed'===f?c.colours.ok:t.flags.length?c.colours.amber:void 0,children:(0,b.jsxs)(a.default,{testID:`so-row-${t.staffId}`,style:{gap:8},children:[(0,b.jsxs)(l.Row,{gap:10,children:[(0,b.jsx)(i.StaffAvatar,{id:t.staffId,size:36}),(0,b.jsxs)(a.default,{style:{flex:1},children:[(0,b.jsx)(l.T,{weight:"semibold",children:y(n?.name)}),(0,b.jsx)(l.Muted,{children:[n?.job,...$(s,n?.temp)].filter(Boolean).join(' \xb7 ')})]}),n?.temp||s?.temp?(0,b.jsx)(l.Badge,{kind:"gold",label:"Temp"}):null,s?(0,b.jsx)(l.Badge,{kind:O(s),label:M(s)}):t.leave?(0,b.jsx)(l.Badge,{kind:"blue",label:(0,d.leaveLabel)(t.leave)}):(0,b.jsx)(l.Badge,{kind:"red",label:"Missing"})]}),(0,b.jsx)(l.Row,{gap:0,style:{flexWrap:'wrap',rowGap:6},children:[['Rota',t.sh?`${(0,h.fmtH)(t.sh.start)}\u2013${(0,h.fmtH)(t.sh.end)}`:'\u2014'],['Actual',s?.in?`${(0,u.hm)(new Date(s.in))}\u2013${s.out?(0,u.hm)(new Date(s.out)):'on'}`:t.leave?(0,d.leaveLabel)(t.leave):'no clock-in'],['Break',s?.out?`${o.brk}m`:s?`${s.breakMins??0}m so far`:'\u2014'],['Paid',s?s.out?(0,h.hmDur)(o.paid):`${(0,h.hmDur)(o.worked)}\u2026`:'\u2014']].map(([e,t])=>(0,b.jsxs)(a.default,{style:{minWidth:92,flexGrow:1},children:[(0,b.jsx)(l.T,{size:11,colour:c.colours.muted,children:e.toUpperCase()}),(0,b.jsx)(l.T,{size:15,weight:"semibold",colour:'Paid'===e&&'confirmed'===f?c.colours.ok:c.colours.text,children:t})]},e))}),t.flags.length&&'confirmed'!==f?(0,b.jsx)(l.Row,{wrap:!0,gap:6,children:t.flags.map(e=>(0,b.jsx)(l.Badge,{kind:'noin'===e.key||'noout'===e.key?'red':'amber',label:e.label},e.key))}):null,t.leave?(0,b.jsxs)(l.Muted,{testID:`so-leave-${t.staffId}`,children:[(0,d.leaveNote)(t.leave),". Rota shift covered by leave: no hours counted."]}):null,m?(0,b.jsxs)(l.Muted,{children:["Adjusted by ",y(m.by),m.reason?`: ${m.reason}`:'']}):null,s?.signOff?(0,b.jsxs)(l.Muted,{children:["Confirmed by ",y(s.signOff.by)," \xb7 ",(0,u.niceDate)(new Date(s.signOff.at))," ",(0,u.hm)(new Date(s.signOff.at))]}):null,(0,b.jsxs)(l.Row,{gap:8,children:[(0,b.jsx)(l.Button,{small:!0,kind:"secondary",label:s?'Edit':'Add entry',accessibilityLabel:`${s?'Edit':'Add entry for'} ${y(n?.name)}`,onPress:()=>R({staffId:t.staffId,a:s})}),s&&'awaiting'===f?(0,b.jsx)(l.Button,{small:!0,kind:"success",label:"Confirm",accessibilityLabel:`Confirm ${y(n?.name)}`,onPress:()=>W([s.id])}):null,s&&'open'===f?(0,b.jsx)(l.Muted,{style:{alignSelf:'center'},children:"Needs a clock-out before it can be confirmed"}):null]})]})},t.key)}),H.length?null:(0,b.jsx)(l.Card,{children:(0,b.jsx)(l.Muted,{children:"No clock records or rostered shifts for this day."})}),H.length?(0,b.jsx)(l.Button,{testID:"confirm-unflagged",kind:"success",label:E.length?`Confirm all unflagged (${E.length})`:'Nothing unflagged to confirm',disabled:!E.length,onPress:()=>W(E.map(e=>e.a.id))}):null,(0,b.jsx)(l.Muted,{children:"Flags: no clock-out, 30 min or more off the rota, over 12 hours, no break on a shift over 6 hours, not on the rota, off-site, or a correction request. Editing a confirmed entry puts it back to Awaiting sign-off. Only confirmed hours count for pay, tips and exports."}),B?(0,b.jsx)(A,{a:B.a,staffId:B.staffId,date:B.request?.date??B.a?.date??I,request:B.request,onClose:()=>R(null)}):null]})};var t=_r(_d[0]),n=_r(_d[1]),s=_r(_d[2]),o=e(_r(_d[3])),a=e(_r(_d[4])),l=_r(_d[5]),i=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),f=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),p=_r(_d[14]),x=_r(_d[15]),b=_r(_d[16]);const j=['Forgot to clock in','Forgot to clock out','Wrong time'],k=[0,15,20,30,45,60],y=e=>(e??'').replace(' (example)',''),w=e=>{const t=new Date(e);return 60*t.getHours()+t.getMinutes()},S=(e,t)=>{const n=(0,u.parseYmd)(e);return n.setMinutes(t),n.toISOString()},I=e=>{const t=(e%1440+1440)%1440;return`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`},v=(e,t)=>{const n=(0,u.parseYmd)(e);return n.setDate(n.getDate()+t),(0,u.ymd)(n)},C=(e,t)=>e===t?'Today':e===v(t,-1)?'Yesterday':(0,u.niceDate)((0,u.parseYmd)(e));function D(e,t,s,o,a=[]){const l=[],i=(0,h.paidMins)(e,s),r=60*s.getHours()+s.getMinutes();if(!e.out&&(e.date60*t.end+60||i.worked>840)&&l.push({key:'noout',label:'No clock-out'}),t&&e.in){const n=w(e.in)-Math.round(60*t.start),s=e.out?w(e.out)+(e.out.slice(0,10)!==e.in.slice(0,10)&&w(e.out)=30&&l.push({key:'diff',label:`${a>=60?(0,h.hmDur)(a):`${a}m`} off the rota`})}return(0,n.isZeroShift)(e)&&l.push({key:'zero',label:'Check: 0 minutes'}),t||l.push({key:'unrostered',label:'Not on the rota'}),i.worked>720&&l.push({key:'long',label:`Very long shift (${(0,h.hmDur)(i.worked)})`}),e.out&&i.worked>360&&0===i.brk&&l.push({key:'nobreak',label:'No break (over 6h)'}),!1!==e.inSite&&!1!==e.outSite||l.push({key:'offsite',label:'Clocked off-site'}),a.some(t=>'open'===t.status&&t.staffId===e.staffId&&t.date===e.date)&&l.push({key:'request',label:'Correction requested'}),e.breakAddedAtClockOut&&l.push({key:'breakadded',label:`Break added at clock-out (${e.breakAddedAtClockOut}m)`}),e.offRota&&t&&l.push({key:'offrota',label:'Signed in off rota'}),l}function $(e,t){const n=[];return(t||e?.temp)&&n.push('Temp'),'display'!==e?.via&&'display'!==e?.outVia||n.push('via Display'),'rota'===e?.auto&&n.push(e.autoNote?`Auto from rota \xb7 ${e.autoNote}`:'Auto from rota'),n}const M=e=>{const t=(0,r.attStatus)(e);return'open'===t?'Open':'awaiting'===t?e.adjusted?'Adjusted \xb7 awaiting sign-off':'Awaiting sign-off':e.adjusted?'Confirmed \xb7 adjusted':'Confirmed'},O=e=>{const t=(0,r.attStatus)(e);return'confirmed'===t?'ok':'open'===t?'blue':'amber'},T={added:'Added entry',clock_in:'Clock-in',clock_out:'Clock-out',break:'Break',confirmed:'Confirmed',reopened:'Reopened',request_applied:'Correction request applied',request_declined:'Correction request declined',voided:'Removed (kept in history)'};function B({a:e,limit:t}){const n=[...e.audit??[]].reverse().slice(0,t??50);return n.length?(0,b.jsx)(a.default,{style:{gap:6},testID:"audit-trail",children:n.map((e,t)=>(0,b.jsxs)(a.default,{style:{flexDirection:'row',gap:8},children:[(0,b.jsx)(a.default,{style:{width:3,borderRadius:2,backgroundColor:'confirmed'===e.action?c.colours.ok:'reopened'===e.action?c.colours.amber:c.colours.gold}}),(0,b.jsxs)(a.default,{style:{flex:1},children:[(0,b.jsxs)(l.T,{size:13,weight:"semibold",children:[T[e.action],e.from||e.to?`: ${e.from??'\u2013'} \u2192 ${e.to??'\u2013'}`:'']}),(0,b.jsxs)(l.Muted,{children:[y(e.by)," \xb7 ",(0,u.niceDate)(new Date(e.at))," ",(0,u.hm)(new Date(e.at)),e.reason?` \xb7 \u201c${e.reason}\u201d`:'']})]})]},t))}):(0,b.jsx)(l.Muted,{children:"No changes yet. Times are as clocked."})}function R({label:e,mins:n,onChange:o,testID:i}){const[r,d]=(0,s.useState)(null),u=e=>{const t=/^(\d{1,2})[:.]?(\d{2})$/.exec(e.trim());t&&+t[1]<24&&+t[2]<60&&o(60*+t[1]+ +t[2]+(n>=1440&&60*+t[1]+ +t[2]<360?1440:0)),d(null)};return(0,b.jsxs)(a.default,{style:{gap:6},children:[(0,b.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(l.T,{size:13,colour:c.colours.muted,children:e}),n>=1440?(0,b.jsx)(l.Muted,{children:"next day"}):null]}),(0,b.jsxs)(l.Row,{gap:6,children:[(0,b.jsx)(l.Button,{small:!0,kind:"ghost",label:"\u221215",onPress:()=>o(n-15)}),(0,b.jsx)(l.Button,{small:!0,kind:"ghost",label:"\u22125",onPress:()=>o(n-5)}),(0,b.jsx)(t.TextInput,{testID:i,accessibilityLabel:e,value:r??I(n),onChangeText:d,onBlur:()=>null!=r&&u(r),onSubmitEditing:()=>null!=r&&u(r),style:[l.styles.input,{flex:1,textAlign:'center',fontSize:22,fontWeight:'700',paddingVertical:6,color:c.colours.text}]}),(0,b.jsx)(l.Button,{small:!0,kind:"ghost",label:"+5",onPress:()=>o(n+5)}),(0,b.jsx)(l.Button,{small:!0,kind:"ghost",label:"+15",onPress:()=>o(n+15)})]})]})}function A({a:e,staffId:t,date:n,request:o,onClose:i}){const{me:d,meId:I,now:v,role:C}=(0,h.useCtx)(3e4),[D,$]=(0,s.useState)(!1),T=!!e&&(0,m.canSeeHoursEdit)({role:C,isCar:p.IS_CAR}),A=(0,r.useOwner)(e=>e.staff.find(e=>e.id===t)?.name),P=(0,r.useOwner)(e=>e.shifts),q=(0,r.shiftOf)(P,t,n),z=o?.suggestedIn?w(o.suggestedIn):e?.in?Math.round((new Date(e.in).getTime()-(0,u.parseYmd)(n).getTime())/6e4):q?Math.round(60*q.start):720,H=o?.suggestedOut??e?.out,N=H?(F=H,Math.round((new Date(F).getTime()-(0,u.parseYmd)(n).getTime())/6e4)):e&&e.in&&!e.out?null:q?Math.round(60*q.end):z+480;var F;const[E,_]=(0,s.useState)(z),[Y,L]=(0,s.useState)(N),[W,V]=(0,s.useState)(e?.breakMins??(q&&q.end-q.start>6?30:0)),[G,K]=(0,s.useState)(o?'out'===o.kind?j[1]:j[0]:e?e.in&&!e.out?j[1]:null:j[0]),[U,Z]=(0,s.useState)(''),[J,Q]=(0,s.useState)(null),X=[G,U.trim()].filter(Boolean).join(': ')+(o&&o.note?` (request: ${o.note})`:''),ee=null!=Y?Y-E:0,te=e?(0,h.paidMins)(e,v):null,ne=null!=Y?Math.max(0,ee-W):null,se=e&&'confirmed'===(0,r.attStatus)(e),oe=null!=Y&&Y<=E?'Clock-out must be after clock-in.':ee>1200?'A shift can\u2019t be longer than 20 hours.':null!=Y&&W>=ee?'The break is longer than the shift.':null,ae=e?.in&&!o&&E===z?e.in:S(n,E),le=null==Y?void 0:e?.out&&!o&&Y===N?e.out:S(n,Y),ie=!e||ae!==e.in||(le??'')!==(e.out??'')||(e.breakMins??0)!==W;return(0,b.jsxs)(l.Sheet,{visible:!0,onClose:i,title:`${e?'Edit hours':'Add missing entry'} \xb7 ${y(A)} \xb7 ${(0,u.niceDate)((0,u.parseYmd)(n))}`,testID:"override-sheet",children:[(0,b.jsxs)(l.Row,{gap:8,style:{flexWrap:'wrap'},children:[e?(0,b.jsx)(l.Badge,{kind:O(e),label:M(e)}):(0,b.jsx)(l.Badge,{kind:"red",label:"No clock record"}),q?(0,b.jsx)(l.Badge,{kind:"neutral",label:`Rota ${(0,h.fmtH)(q.start)}\u2013${(0,h.fmtH)(q.end)}`}):(0,b.jsx)(l.Badge,{kind:"neutral",label:"Not on the rota"}),e?.in?(0,b.jsx)(l.Badge,{kind:"neutral",label:`Clocked ${(0,u.hm)(new Date(e.in))}\u2013${e.out?(0,u.hm)(new Date(e.out)):'still on'}`}):null]}),o?(0,b.jsxs)(l.Banner,{kind:"info",title:`${y(A)} asked for a correction`,children:['in'===o.kind?'Forgot to clock in':'out'===o.kind?'Forgot to clock out':'Forgot to clock in and out',o.suggestedIn?` \xb7 in ${(0,u.hm)(new Date(o.suggestedIn))}`:'',o.suggestedOut?` \xb7 out ${(0,u.hm)(new Date(o.suggestedOut))}`:'',o.note?` \xb7 \u201c${o.note}\u201d`:'',". The suggested times are filled in below."]}):null,(0,b.jsx)(R,{label:"Clock in",mins:E,onChange:_,testID:"ov-in"}),null!=Y?(0,b.jsx)(R,{label:"Clock out",mins:Y,onChange:L,testID:"ov-out"}):(0,b.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(l.Muted,{children:"No clock-out yet."}),(0,b.jsx)(l.Button,{small:!0,kind:"secondary",label:"Add clock-out",onPress:()=>L(q?Math.round(60*q.end):Math.min(E+480,60*v.getHours()+v.getMinutes()>E?60*v.getHours()+v.getMinutes():E+480))})]}),(0,b.jsx)(l.T,{size:13,colour:c.colours.muted,children:"Break"}),(0,b.jsxs)(l.Row,{wrap:!0,gap:6,children:[k.map(e=>(0,b.jsx)(l.Chip,{label:0===e?'None':`${e} min`,selected:W===e,onPress:()=>V(e)},e)),(0,b.jsx)(l.Stepper,{value:W,min:0,max:240,onChange:V,label:"break minutes"})]}),(0,b.jsx)(l.T,{size:13,colour:c.colours.muted,children:"Reason (required, kept in the audit trail)"}),(0,b.jsx)(l.Row,{wrap:!0,gap:6,children:j.map(e=>(0,b.jsx)(l.Chip,{label:e,selected:G===e,onPress:()=>K(G===e?null:e)},e))}),(0,b.jsx)(l.Field,{label:G?'Add detail (optional)':'Or type a reason',value:U,onChangeText:Z,placeholder:"e.g. stayed late for a function",maxLength:150}),(0,b.jsxs)(l.Card,{style:{backgroundColor:c.colours.surface2},children:[(0,b.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(l.T,{children:"Paid hours"}),(0,b.jsx)(l.T,{weight:"bold",colour:c.colours.gold,children:null!=ne?(0,h.hmDur)(ne):'still on shift'})]}),te&&e?.out?(0,b.jsxs)(l.Muted,{children:["Was ",(0,h.hmDur)(te.paid)," (",(0,u.hm)(new Date(e.in)),"\u2013",(0,u.hm)(new Date(e.out)),", ",te.brk,"m break)"]}):null,se?(0,b.jsx)(l.T,{size:13,colour:c.colours.amber,children:"This entry was confirmed. Saving puts it back to Awaiting sign-off (logged)."}):null]}),oe?(0,b.jsx)(l.T,{size:13,colour:c.colours.red,children:oe}):null,J?(0,b.jsx)(l.T,{size:13,colour:c.colours.red,children:J}):null,(0,b.jsx)(l.Button,{testID:"ov-save",kind:"success",label:e?'Save change':'Add entry',disabled:!!oe||!ie||X.trim().length<3,onPress:()=>{r.useOwner.getState().overrideEntry({id:e?.id,staffId:t,date:n,in:ae,out:le,breakMins:W,reason:X.slice(0,200),by:d,byId:I,now:v.toISOString(),request:o?.id})?(o&&r.useOwner.getState().resolveTimeRequest(o.id,'applied',d,v.toISOString()),i()):Q('Couldn\u2019t save: check the times and the reason.')}}),T?(0,b.jsx)(a.default,{style:{alignItems:'center',width:'100%'},children:(0,b.jsx)(l.Button,{testID:"ov-delete-entry",kind:"ghost",label:"Delete entry",accessibilityLabel:"Delete entry",onPress:()=>$(!0),style:{minHeight:48,minWidth:160}})}):null,e&&D?(0,b.jsx)(x.DeleteShiftSheet,{a:e,onClose:()=>$(!1),onDeleted:i}):null,e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(f.SectionHead,{title:"Audit trail",sub:"Every change: what, from, to, who, when and why"}),(0,b.jsx)(B,{a:e})]}):null]})}function P(e,t){const n=new Map;return e.forEach(e=>{e.date({date:e,n:t})).sort((e,t)=>t.date.localeCompare(e.date))}},1184,[827,1182,34,402,102,794,925,891,1094,858,821,1175,1084,1185,872,1186,25]); diff --git a/staff-app/admin.html b/staff-app/admin.html index 490e7b9b0ff688c7447bcab1cf8197180679b9f8..03a8efea54e3345551fd5f70f3ef8a67eb87a541 100644 --- a/staff-app/admin.html +++ b/staff-app/admin.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/staff-app/customer.html b/staff-app/customer.html index 490e7b9b0ff688c7447bcab1cf8197180679b9f8..03a8efea54e3345551fd5f70f3ef8a67eb87a541 100644 --- a/staff-app/customer.html +++ b/staff-app/customer.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/staff-app/customer/anchorage.html b/staff-app/customer/anchorage.html index 490e7b9b0ff688c7447bcab1cf8197180679b9f8..03a8efea54e3345551fd5f70f3ef8a67eb87a541 100644 --- a/staff-app/customer/anchorage.html +++ b/staff-app/customer/anchorage.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/staff-app/customer/anchorage/book.html b/staff-app/customer/anchorage/book.html index 490e7b9b0ff688c7447bcab1cf8197180679b9f8..03a8efea54e3345551fd5f70f3ef8a67eb87a541 100644 --- a/staff-app/customer/anchorage/book.html +++ b/staff-app/customer/anchorage/book.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/staff-app/customer/anchorage/feedback.html b/staff-app/customer/anchorage/feedback.html index 490e7b9b0ff688c7447bcab1cf8197180679b9f8..03a8efea54e3345551fd5f70f3ef8a67eb87a541 100644 --- a/staff-app/customer/anchorage/feedback.html +++ b/staff-app/customer/anchorage/feedback.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/staff-app/customer/anchorage/gift.html b/staff-app/customer/anchorage/gift.html index 490e7b9b0ff688c7447bcab1cf8197180679b9f8..03a8efea54e3345551fd5f70f3ef8a67eb87a541 100644 --- a/staff-app/customer/anchorage/gift.html +++ b/staff-app/customer/anchorage/gift.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/staff-app/customer/anchorage/lost.html b/staff-app/customer/anchorage/lost.html index 490e7b9b0ff688c7447bcab1cf8197180679b9f8..03a8efea54e3345551fd5f70f3ef8a67eb87a541 100644 --- a/staff-app/customer/anchorage/lost.html +++ b/staff-app/customer/anchorage/lost.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/staff-app/customer/anchorage/loyalty.html b/staff-app/customer/anchorage/loyalty.html index 490e7b9b0ff688c7447bcab1cf8197180679b9f8..03a8efea54e3345551fd5f70f3ef8a67eb87a541 100644 --- a/staff-app/customer/anchorage/loyalty.html +++ b/staff-app/customer/anchorage/loyalty.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/staff-app/customer/anchorage/merch.html b/staff-app/customer/anchorage/merch.html index 490e7b9b0ff688c7447bcab1cf8197180679b9f8..03a8efea54e3345551fd5f70f3ef8a67eb87a541 100644 --- a/staff-app/customer/anchorage/merch.html +++ b/staff-app/customer/anchorage/merch.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/staff-app/customer/anchorage/offers.html b/staff-app/customer/anchorage/offers.html index 490e7b9b0ff688c7447bcab1cf8197180679b9f8..03a8efea54e3345551fd5f70f3ef8a67eb87a541 100644 --- a/staff-app/customer/anchorage/offers.html +++ b/staff-app/customer/anchorage/offers.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/staff-app/customer/anchorage/refer.html b/staff-app/customer/anchorage/refer.html index 490e7b9b0ff688c7447bcab1cf8197180679b9f8..03a8efea54e3345551fd5f70f3ef8a67eb87a541 100644 --- a/staff-app/customer/anchorage/refer.html +++ b/staff-app/customer/anchorage/refer.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/staff-app/customer/anchorage/waitlist.html b/staff-app/customer/anchorage/waitlist.html index 490e7b9b0ff688c7447bcab1cf8197180679b9f8..03a8efea54e3345551fd5f70f3ef8a67eb87a541 100644 --- a/staff-app/customer/anchorage/waitlist.html +++ b/staff-app/customer/anchorage/waitlist.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/staff-app/customer/anchorage/whatson.html b/staff-app/customer/anchorage/whatson.html index 490e7b9b0ff688c7447bcab1cf8197180679b9f8..03a8efea54e3345551fd5f70f3ef8a67eb87a541 100644 --- a/staff-app/customer/anchorage/whatson.html +++ b/staff-app/customer/anchorage/whatson.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/staff-app/customer/basket.html b/staff-app/customer/basket.html index 490e7b9b0ff688c7447bcab1cf8197180679b9f8..03a8efea54e3345551fd5f70f3ef8a67eb87a541 100644 --- a/staff-app/customer/basket.html +++ b/staff-app/customer/basket.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/staff-app/customer/profile.html b/staff-app/customer/profile.html index 490e7b9b0ff688c7447bcab1cf8197180679b9f8..03a8efea54e3345551fd5f70f3ef8a67eb87a541 100644 --- a/staff-app/customer/profile.html +++ b/staff-app/customer/profile.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/staff-app/demo.html b/staff-app/demo.html index 490e7b9b0ff688c7447bcab1cf8197180679b9f8..03a8efea54e3345551fd5f70f3ef8a67eb87a541 100644 --- a/staff-app/demo.html +++ b/staff-app/demo.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/staff-app/display.html b/staff-app/display.html index 490e7b9b0ff688c7447bcab1cf8197180679b9f8..03a8efea54e3345551fd5f70f3ef8a67eb87a541 100644 --- a/staff-app/display.html +++ b/staff-app/display.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/staff-app/index.html b/staff-app/index.html index 6bc9db6a135feb003b2de8e0657de0cf1e207b6a..a2ca94783cabf0e5456929a96719ecb8723d3b1d 100644 --- a/staff-app/index.html +++ b/staff-app/index.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/staff-app/kitchen.html b/staff-app/kitchen.html index 490e7b9b0ff688c7447bcab1cf8197180679b9f8..03a8efea54e3345551fd5f70f3ef8a67eb87a541 100644 --- a/staff-app/kitchen.html +++ b/staff-app/kitchen.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/staff-app/owner.html b/staff-app/owner.html index 490e7b9b0ff688c7447bcab1cf8197180679b9f8..03a8efea54e3345551fd5f70f3ef8a67eb87a541 100644 --- a/staff-app/owner.html +++ b/staff-app/owner.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/staff-app/staff.html b/staff-app/staff.html index 490e7b9b0ff688c7447bcab1cf8197180679b9f8..03a8efea54e3345551fd5f70f3ef8a67eb87a541 100644 --- a/staff-app/staff.html +++ b/staff-app/staff.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/staff-app/sw.js b/staff-app/sw.js index 50db5a0217adb16fc973825863ff73b175ba2662..0a9ce54033ebf729405f9fbc01d4b3d7646a0545 100644 --- a/staff-app/sw.js +++ b/staff-app/sw.js @@ -1,7 +1,7 @@ // Anchorage Staff service worker: precache the app shell so it opens offline after the first visit. -const V = "cc-staff-f924fafe7a"; +const V = "cc-staff-825c52d069"; const BASE = "/staff-app/"; -const PRECACHE = ["/staff-app/apple-touch-icon.png", "/staff-app/assets/assets/brand/3idiots-hero.e5dfd53739f05086b1956e72d585a66a.png", "/staff-app/assets/assets/brand/3idiots.df4a76d2130f0e5b0042f06a8c88693a.png", "/staff-app/assets/assets/brand/abbotsford-hero.78fcb8ee06ee22c4ca659c9254db7512.png", "/staff-app/assets/assets/brand/abbotsford.b26602bba5ce4969733c5422a45ad053.png", "/staff-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/staff-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/staff-app/assets/assets/brand/brae.8de9e89ac30966c6669de990370d8e40.png", "/staff-app/assets/assets/brand/cecchinis-hero.f77780fcc94fd668cf35d66d6dc52d81.png", "/staff-app/assets/assets/brand/cecchinis.ebf752fef363247848ae7c0d91938765.png", "/staff-app/assets/assets/brand/drunkencoo-hero.65c21c4da9e466cf4bffc969639a1427.png", "/staff-app/assets/assets/brand/drunkencoo.f6d92af3b14e4205a3deaf4434754c51.png", "/staff-app/assets/assets/brand/greenside-hero.1caec5a6cb939434cccb5f3a613b50f8.png", "/staff-app/assets/assets/brand/greenside.9d1556db97dcb903a3c57e2063ee2255.png", "/staff-app/assets/assets/brand/kirkmichael-hero.63b13cde7fd82eb622622b39ac80c394.png", "/staff-app/assets/assets/brand/kirkmichael.63b13cde7fd82eb622622b39ac80c394.png", "/staff-app/assets/assets/brand/kirkton-hero.9d0837b292c2f4f30f4521d806bb28c3.png", "/staff-app/assets/assets/brand/kirkton.bcf8d846df4861474d224a7a77f498fb.png", "/staff-app/assets/assets/brand/mrbasrais-hero.4ce74641cfcf52d099157c84005b9d2a.png", "/staff-app/assets/assets/brand/mrbasrais.7cc4086dd12ace82529795f1c9f8c900.png", "/staff-app/assets/assets/brand/pizzaioli-hero.1896657c08264cefb49b401891d5448d.png", "/staff-app/assets/assets/brand/pizzaioli.db8c000b62ee407121aa8b90ce45e170.png", "/staff-app/assets/assets/brand/rupeeroom-hero.969fa372add526aaacf3a6c009b8ac92.png", "/staff-app/assets/assets/brand/rupeeroom.689e6fb536dc0845eeb174a1ec7bd346.png", "/staff-app/assets/assets/brand/saltmarsh.85a6a65732635e5148478d743d9ca884.png", "/staff-app/assets/assets/brand/smokinggoat-hero.0588f17ef0eed7f757f22916cd4d37db.png", "/staff-app/assets/assets/brand/smokinggoat.20a3a1970596ab43c5d6468d4ed549a7.png", "/staff-app/assets/assets/brand/souters.f4c58d9349b6e1700fe5abcc9e9b665c.png", "/staff-app/assets/assets/brand/wildings-hero-logo-text.4661e4b935726f2511f9c17a1567c89a.png", "/staff-app/assets/assets/brand/wildings.076f4fcd06d19a0af0205c410f461b14.png", "/staff-app/assets/assets/brand/williewastles-hero.b9d53d27b66f903b5618a7177b2ffad4.png", "/staff-app/assets/assets/brand/williewastles.055a77893ced99bf3a6c5402ba5baac6.png", "/staff-app/assets/assets/brand/yasmins-hero.a5aef62e37dfcecbe0afc056186f4ad9.png", "/staff-app/assets/assets/brand/yasmins.8482602e9f0a965655924835625cb02b.png", "/staff-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/staff-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/staff-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/staff-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/staff-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/staff-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/staff-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/staff-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/staff-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/staff-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/staff-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/staff-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/staff-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/staff-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/staff-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/staff-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/staff-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/staff-app/brand-logo.png", "/staff-app/favicon.ico", "/staff-app/icon-192.png", "/staff-app/icon-512.png", "/staff-app/icon-maskable-192.png", "/staff-app/icon-maskable-512.png", "/staff-app/manifest.webmanifest", "/staff-app/index.html", "/staff-app/_expo/static/js/web/bundle.js?v=f924fafe7a080a06881b01fdd76d580febf7842248e143f7d52446b103a2c225"]; +const PRECACHE = ["/staff-app/apple-touch-icon.png", "/staff-app/assets/assets/brand/3idiots-hero.e5dfd53739f05086b1956e72d585a66a.png", "/staff-app/assets/assets/brand/3idiots.df4a76d2130f0e5b0042f06a8c88693a.png", "/staff-app/assets/assets/brand/abbotsford-hero.78fcb8ee06ee22c4ca659c9254db7512.png", "/staff-app/assets/assets/brand/abbotsford.b26602bba5ce4969733c5422a45ad053.png", "/staff-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/staff-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/staff-app/assets/assets/brand/brae.8de9e89ac30966c6669de990370d8e40.png", "/staff-app/assets/assets/brand/cecchinis-hero.f77780fcc94fd668cf35d66d6dc52d81.png", "/staff-app/assets/assets/brand/cecchinis.ebf752fef363247848ae7c0d91938765.png", "/staff-app/assets/assets/brand/drunkencoo-hero.65c21c4da9e466cf4bffc969639a1427.png", "/staff-app/assets/assets/brand/drunkencoo.f6d92af3b14e4205a3deaf4434754c51.png", "/staff-app/assets/assets/brand/greenside-hero.1caec5a6cb939434cccb5f3a613b50f8.png", "/staff-app/assets/assets/brand/greenside.9d1556db97dcb903a3c57e2063ee2255.png", "/staff-app/assets/assets/brand/kirkmichael-hero.63b13cde7fd82eb622622b39ac80c394.png", "/staff-app/assets/assets/brand/kirkmichael.63b13cde7fd82eb622622b39ac80c394.png", "/staff-app/assets/assets/brand/kirkton-hero.9d0837b292c2f4f30f4521d806bb28c3.png", "/staff-app/assets/assets/brand/kirkton.bcf8d846df4861474d224a7a77f498fb.png", "/staff-app/assets/assets/brand/mrbasrais-hero.4ce74641cfcf52d099157c84005b9d2a.png", "/staff-app/assets/assets/brand/mrbasrais.7cc4086dd12ace82529795f1c9f8c900.png", "/staff-app/assets/assets/brand/pizzaioli-hero.1896657c08264cefb49b401891d5448d.png", "/staff-app/assets/assets/brand/pizzaioli.db8c000b62ee407121aa8b90ce45e170.png", "/staff-app/assets/assets/brand/rupeeroom-hero.969fa372add526aaacf3a6c009b8ac92.png", "/staff-app/assets/assets/brand/rupeeroom.689e6fb536dc0845eeb174a1ec7bd346.png", "/staff-app/assets/assets/brand/saltmarsh.85a6a65732635e5148478d743d9ca884.png", "/staff-app/assets/assets/brand/smokinggoat-hero.0588f17ef0eed7f757f22916cd4d37db.png", "/staff-app/assets/assets/brand/smokinggoat.20a3a1970596ab43c5d6468d4ed549a7.png", "/staff-app/assets/assets/brand/souters.f4c58d9349b6e1700fe5abcc9e9b665c.png", "/staff-app/assets/assets/brand/wildings-hero-logo-text.4661e4b935726f2511f9c17a1567c89a.png", "/staff-app/assets/assets/brand/wildings.076f4fcd06d19a0af0205c410f461b14.png", "/staff-app/assets/assets/brand/williewastles-hero.b9d53d27b66f903b5618a7177b2ffad4.png", "/staff-app/assets/assets/brand/williewastles.055a77893ced99bf3a6c5402ba5baac6.png", "/staff-app/assets/assets/brand/yasmins-hero.a5aef62e37dfcecbe0afc056186f4ad9.png", "/staff-app/assets/assets/brand/yasmins.8482602e9f0a965655924835625cb02b.png", "/staff-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/staff-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/staff-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/staff-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/staff-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/staff-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/staff-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/staff-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/staff-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/staff-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/staff-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/staff-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/staff-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/staff-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/staff-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/staff-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/staff-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/staff-app/brand-logo.png", "/staff-app/favicon.ico", "/staff-app/icon-192.png", "/staff-app/icon-512.png", "/staff-app/icon-maskable-192.png", "/staff-app/icon-maskable-512.png", "/staff-app/manifest.webmanifest", "/staff-app/index.html", "/staff-app/_expo/static/js/web/bundle.js?v=825c52d069a38109a0e87d14eb2c8e4033cecfb5ee1dd917ae094d1b81679d9c"]; // Hugging Face serves large files (fonts) through a redirect to its CDN. Browsers refuse to hand a *redirected* cached // response to a page, so store a plain copy instead (otherwise fonts, and so the app, fail to load offline). const plain = r => r.redirected ? r.blob().then(b => new Response(b, { status: 200, headers: { 'Content-Type': r.headers.get('Content-Type') || b.type || 'application/octet-stream' } })) : Promise.resolve(r); diff --git a/staff-app/team.html b/staff-app/team.html index 490e7b9b0ff688c7447bcab1cf8197180679b9f8..03a8efea54e3345551fd5f70f3ef8a67eb87a541 100644 --- a/staff-app/team.html +++ b/staff-app/team.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - +