1import"../chunks/CWj6FrbW.js";import{p as Te,c as a,t as f,a as we,$ as Se,s,r as t,n as G,f as ut,g,i as Me,h as Ut,b as Ae}from"../chunks/__8XqHd2.js";import{d as Oe,h as Pe,s as n}from"../chunks/CXI9Z9cj.js";import{f as v,a as l,t as Dt}from"../chunks/B0g3Bnmm.js";import{i as u}from"../chunks/BcXKMwEx.js";import{e as W}from"../chunks/BN5o1A6Z.js";import{a as pt}from"../chunks/CPHngfNB.js";import{s as Gt,r as j,b as k}from"../chunks/BRLojIyr.js";import{s as Ne}from"../chunks/Behh1qYl.js";import{i as Ee,s as Ie}from"../chunks/Dv4Hv5zR.js";import{e as ft}from"../chunks/DjI0-DLU.js";import{g as Le,i as Yt}from"../chunks/Cs2RwMgl.js";import{a as C}from"../chunks/DbVPUxLq.js";import{s as R}from"../chunks/D5GUxKdx.js";import{T as Be,a as Re,b as Fe,c as Ue,d as De,e as Ge}from"../chunks/DuGELm0r.js";const Ye=3e4,ze=6e5,He=2026;function We(O){return O>=He?{regime:"annual",annualCents:ze,note:"Income-tax-free up to â¬6,000 per calendar year, replacing the earlier â¬300 monthly cap."}:{regime:"monthly",monthlyCents:Ye,note:"Income-tax-free up to â¬300 per month (L.5162/2024)."}}function je(O,r){const A=We(O);return A.regime!=="annual"||!A.annualCents?null:r/A.annualCents}var ke=O=>Le(`/tips/month?month=${O.target.value}`),Ve=v("<option> </option>"),Ze=v('<p class="mb-3 rounded-lg bg-red-100 px-4 py-2 text-sm text-red-800"> </p>'),qe=v('<form method="POST" action="?/closeMonth" class="mt-2"><input type="hidden" name="yearMonth"/> <input type="hidden" name="force" value="1"/> <button type="submit" class="min-h-[40px] rounded-lg bg-amber-600 px-4 py-1.5 text-sm font-semibold text-white hover:bg-amber-700">Recompute</button></form>'),Je=v('<div class="mb-3 rounded-lg bg-amber-100 px-4 py-3 text-sm text-amber-900">â ï¸ <strong>This month has changed since it was closed.</strong> <!></div>'),Ke=v('<p class="mb-3 rounded-lg bg-emerald-100 px-4 py-2 text-sm text-emerald-900"> <!></p>'),Qe=v(' <a class="underline"> </a>',1),Xe=v('<p class="mb-3 rounded-lg bg-orange-100 px-4 py-2 text-sm text-orange-900"> <strong>not included below</strong>: <!></p>'),$e=v(`<p class="mb-3 rounded-lg bg-red-600 px-4 py-3 text-sm font-semibold text-white">The per-person figures do not add up to the shift totals. Do not use this report â report 2 the problem before filing anything.</p>`),ta=v('<p class="rounded-lg border border-dashed border-gray-300 bg-white p-8 text-center text-sm text-gray-500"> </p>'),ea=v('<th class="px-3 py-2 text-right">Year to date</th>'),aa=v("<td> </td>"),ra=v('<tr class="border-t border-gray-100"><td class="px-3 py-2 font-medium text-gray-900"> </td><td class="px-3 py-2 text-right text-gray-600"> </td><td class="px-3 py-2 text-right"> </td><td class="px-3 py-2 text-right"> </td><td class="px-3 py-2 text-right font-semibold text-emerald-700"> </td><!></tr>'),oa=v("<td></td>"),sa=v('<tr class="bg-gray-50"><td class="px-3 py-1.5 text-xs font-semibold tracking-wide text-gray-500 uppercase"> </td></tr> <!> <tr class="border-t border-gray-200 text-xs text-gray-600"><td class="px-3 py-1.5"> </td><td></td><td class="px-3 py-1.5 text-right"> </td><td class="px-3 py-1.5 text-right"> </td><td class="px-3 py-1.5 text-right font-semibold"> </td><!></tr>',1),da=v("<td></td>"),na=v('<div class="overflow-x-auto rounded-xl border border-gray-200 bg-white"><table class="w-full min-w-[640px] text-sm"><thead class="bg-gray-50 text-xs text-gray-600 uppercase"><tr><th class="px-3 py-2 text-left">Name</th><th class="px-3 py-2 text-right">Shifts</th><th class="px-3 py-2 text-right">Card</th><th class="px-3 py-2 text-right">Cash</th><th class="px-3 py-2 text-right">Month total</th><!></tr></thead><tbody><!><tr class="border-t-2 border-gray-300 bg-gray-50 font-bold"><td class="px-3 py-2">Total</td><td class="px-3 py-2 text-right"> </td><td class="px-3 py-2 text-right"> </td><td class="px-3 py-2 text-right"> </td><td class="px-3 py-2 text-right text-emerald-800"> </td><!></tr></tbody></table></div>'),ia=v('<input type="hidden" name="force" value="1"/>'),la=v('<form method="POST" action="?/closeMonth"><input type="hidden" name="yearMonth"/> <!> <button type="submit" class="min-h-[44px] rounded-lg bg-emerald-600 px-5 py-2 text-sm font-semibold text-white hover:bg-emerald-700"> </button></form>'),va=v('<form method="POST" action="?/exportCsv"><input type="hidden" name="yearMonth"/> <button type="submit" class="min-h-[44px] rounded-lg border border-gray-300 bg-white px-4 py-2 text-sm hover:bg-gray-50">Export CSV</button></form> <!>',1),xa=v('<form method="POST" action="?/reopenMonth"><input type="hidden" name="yearMonth"/> <button type="submit" class="min-h-[44px] rounded-lg border border-amber-500 px-4 py-2 text-sm text-amber-700 hover:bg-amber-50">Reopen month</button></form>'),ca=v('<div class="mt-4 flex flex-wrap gap-2"><!> <!></div>'),ma=v('<div class="min-h-screen bg-gradient-to-br from-emerald-50 to-slate-50 p-4"><div class="mx-auto max-w-5xl"><header class="mb-4 flex flex-wrap items-center justify-between gap-3"><div><h1 class="text-2xl font-bold text-gray-900">Tips â monthly report</h1> <p class="text-sm text-gray-600"> </p></div> <div class="flex items-center gap-2"><select class="min-h-[44px] rounded-lg border border-gray-300 px-3 py-2 text-sm"></select> <a href="/tips" class="min-h-[44px] rounded-lg border border-gray-300 bg-white px-4 py-2 text-sm hover:bg-gray-50">Daily entry</a></div></header> <!> <!> <!> <!> <div class="mb-4 grid grid-cols-1 gap-3 sm:grid-cols-3"><div class="rounded-xl border border-gray-200 bg-white p-4"><div class="text-xs text-gray-500">Card (POS)</div> <div class="text-2xl font-bold text-gray-900"> </div> <div class="mt-1 text-[11px] text-gray-500"> </div></div> <div class="rounded-xl border border-gray-200 bg-white p-4"><div class="text-xs text-gray-500">Cash</div> <div class="text-2xl font-bold text-gray-900"> </div> <div class="mt-1 text-[11px] text-gray-500"> </div></div> <div class="rounded-xl border border-emerald-300 bg-emerald-50 p-4"><div class="text-xs text-emerald-800">Total to pay</div> <div class="text-2xl font-bold text-emerald-800"> </div> <div class="mt-1 text-[11px] text-emerald-700"> </div></div></div> <!> <p class="mt-3 rounded-lg bg-white/70 p-3 text-xs text-gray-500"> <!></p> <!></div></div>');function Pa(O,r){Te(r,!0);let A=Ae(!1);function gt(e,o){return async({result:d})=>{var x;if(d.type==="success")R.success(e);else if(d.type==="failure"){const i=d.data;i!=null&&i.needsForce?(Ut(A,!0),R.warning(i.error??"Some shifts are still open")):R.error((i==null?void 0:i.error)??o)}else if(d.type==="error"){const i=(x=d.error)==null?void 0:x.message;R.error(i?`${o}: ${i}`:o)}await Yt()}}const zt=Me(()=>De.map(e=>({group:e,label:Ge[e],lines:r.data.report.lines.filter(o=>o.staffGroup===e)})).filter(e=>e.lines.length>0));function V(e,o){return e.reduce((d,x)=>d+x[o],0)}function Ht(e){const o=je(r.data.report.year,e);return o===null?"text-gray-500":o>=1?"font-semibold text-red-700":o>=.8?"font-semibold text-amber-700":"text-gray-500"}
2function yt(e){return new Date(e).toLocaleString("en-GB",{dateStyle:"medium",timeStyle:"short",timeZone:"Europe/Athens"})}var Z=ma();Pe(e=>{Se.title="Tips â monthly report"});var bt=a(Z),q=a(bt),J=a(q),Ct=s(a(J),2),Wt=a(Ct);t(Ct),t(J);var Tt=s(J,2),P=a(Tt);Ee(P,()=>r.data.report.yearMonth);var wt;P.__change=[ke],W(P,20,()=>r.data.months,e=>e,(e,o)=>{var d=Ve(),x={},i=a(d,!0);t(d),f(()=>{x!==(x=o)&&(d.value=(d.__value=o)??""),n(i,o)}),l(e,d)}),t(P),G(2),t(Tt),t(q);var St=s(q,2);{var jt=e=>{var o=Ze(),d=a(o,!0);t(o),f(()=>n(d,r.form.error)),l(e,o)};u(St,e=>{var o;(o=r.form)!=null&&o.error&&e(jt)})}var Mt=s(St,2);{var kt=e=>{var o=Je(),d=s(a(o),2),x=s(d);{var i=y=>{var _=qe(),m=a(_);j(m),s(m,2),G(2),t(_),pt(_,(c,h)=>{var T;return(T=ft)==null?void 0:T(c,h)},()=>()=>gt("Month recomputed","Could not recompute")),f(()=>k(m,r.data.report.yearMonth)),l(y,_)};u(x,y=>{r.data.permissions.canCloseMonth&&y(i)})}t(o),f(y=>n(d,` A shift underneath it was 3 edited, reopened or deleted, so the figures below no longer match what was reported on 4 ${y??""}. `),[()=>yt(r.data.closure.closedAtMs)]),l(e,o)},Vt=(e,o)=>{{var d=x=>{var i=Ke(),y=a(i),_=s(y);{var m=c=>{var h=Dt();f(()=>n(h,`${r.data.closure.openShiftCount??""} shift(s) were still open at the time and are not included.`)),l(c,h)};u(_,c=>{r.data.closure.openShiftCount>0&&c(m)})}t(i),f(c=>n(y,`â Closed on ${c??""}. `),[()=>yt(r.data.closure.closedAtMs)]),l(x,i)};u(e,x=>{r.data.closure&&x(d)},o)}};u(Mt,e=>{var o;(o=r.data.closure)!=null&&o.drifted?e(kt):e(Vt,!1)})}var At=s(Mt,2);{var Zt=e=>{var o=Xe(),d=a(o),x=s(d,3);W(x,18,()=>r.data.report.openShiftDates,i=>i,(i,y,_)=>{G();var m=Qe(),c=ut(m,!0),h=s(c),T=a(h,!0);t(h),f(()=>{n(c,g(_)>0?", ":""),Gt(h,"href",`/tips?date=${y??""}`),n(T,y)}),l(i,m)}),t(o),f(()=>n(d,`â ï¸ ${r.data.report.openShiftCount??""} 5 ${r.data.report.openShiftCount===1?"shift is":"shifts are"} still open and `)),l(e,o)};u(At,e=>{r.data.report.openShiftCount>0&&e(Zt)})}var Ot=s(At,2);{var qt=e=>{var o=$e();l(e,o)};
5u(Ot,e=>{r.data.report.invariantBroken&&e(qt)})}var K=s(Ot,2),Q=a(K),X=s(a(Q),2),Jt=a(X,!0);t(X);var Pt=s(X,2),Kt=a(Pt,!0);t(Pt),t(Q);var $=s(Q,2),tt=s(a($),2),Qt=a(tt,!0);t(tt);var Nt=s(tt,2),Xt=a(Nt,!0);t(Nt),t($);var Et=s($,2),et=s(a(Et),2),$t=a(et,!0);t(et);var It=s(et,2),te=a(It,!0);t(It),t(Et),t(K);var Lt=s(K,2);{var ee=e=>{var o=ta(),d=a(o);t(o),f(()=>n(d,`No closed shifts in ${r.data.report.yearMonth??""} yet.`)),l(e,o)},ae=e=>{var o=na(),d=a(o),x=a(d),i=a(x),y=s(a(i),5);{var _=p=>{var b=ea();l(p,b)};u(y,p=>{r.data.permissions.canSeeTaxBadges&&p(_)})}t(i),t(x);var m=s(x),c=a(m);W(c,17,()=>g(zt),p=>p.group,(p,b)=>{var H=sa(),ot=ut(H),st=a(ot),ne=a(st,!0);t(st),t(ot);var Rt=s(ot,2);W(Rt,17,()=>g(b).lines,M=>M.vendorId,(M,w)=>{var U=ra(),vt=a(U),_e=a(vt,!0);t(vt);var xt=s(vt),he=a(xt,!0);t(xt);var ct=s(xt),ue=a(ct,!0);t(ct);var mt=s(ct),pe=a(mt,!0);t(mt);var _t=s(mt),fe=a(_t,!0);t(_t);var ge=s(_t);{var ye=D=>{var B=aa(),ht=a(B,!0);t(B),f((be,Ce)=>{Ne(B,1,`px-3 py-2 text-right ${be??""}`),n(ht,Ce)},[()=>Ht(g(w).ytdTotalCents),()=>C(g(w).ytdTotalCents)]),l(D,B)};u(ge,D=>{r.data.permissions.canSeeTaxBadges&&D(ye)})}t(U),f((D,B,ht)=>{n(_e,g(w).name),n(he,g(w).shiftCount),n(ue,D),n(pe,B),n(fe,ht)},[()=>C(g(w).posCents),()=>C(g(w).cashCents),()=>C(g(w).totalCents)]),l(M,U)});var Ft=s(Rt,2),dt=a(Ft),ie=a(dt);t(dt);var nt=s(dt,2),le=a(nt,!0);t(nt);var it=s(nt),ve=a(it,!0);t(it);var lt=s(it),xe=a(lt,!0);t(lt);var ce=s(lt);{var me=M=>{var w=oa();l(M,w)};u(ce,M=>{r.data.permissions.canSeeTaxBadges&&M(me)})}t(Ft),f((M,w,U)=>{Gt(st,"colspan",r.data.permissions.canSeeTaxBadges?6:5),n(ne,g(b).label),n(ie,`${g(b).label??""} subtotal`),n(le,M),n(ve,w),n(xe,U)},[()=>C(V(g(b).lines,"posCents")),()=>C(V(g(b).lines,"cashCents")),()=>C(V(g(b).lines,"totalCents"))]),l(p,H)});var h=s(c),T=s(a(h)),I=a(T,!0);t(T);var N=s(T),L=a(N,!0);t(N);var E=s(N),Y=a(E,!0);t(E);var F=s(E),z=a(F,!0);t(F);var rt=s(F);{var S=p=>{var b=da();l(p,b)};u(rt,p=>{r.data.permissions.canSeeTaxBadges&&p(S)})}t(h),t(m),t(d),t(o),f((p,b,H)=>{n(I,r.data.report.closedShiftCount),n(L,p),n(Y,b),n(z,H)},[()=>C(r.data.report.totalPosCents),()=>C(r.data.report.totalCashCents),()=>C(r.data.report.totalCents)]),l(e,o)};u(Lt,e=>{r.data.report.lines.length===0?e(ee):e(ae,!1)})}var at=s(Lt,2),Bt=a(at),re=s(Bt);{var oe=e=>{var o=Dt("The year-to-date column is highlighted from 80% of the allowance.");l(e,o)};u(re,e=>{r.data.permissions.canSeeTaxBadges&&e(oe)})}t(at);var se=s(at,2);{var de=e=>{var o=ca(),d=a(o);{var x=_=>{var m=va(),c=ut(m),h=a(c);j(h),G(2),t(c);var T=s(c,2);{var I=N=>{var L=la(),E=a(L);j(E);var Y=s(E,2);{var F=S=>{var p=ia();l(S,p)};u(Y,S=>{g(A)&&S(F)})}var z=s(Y,2),rt=a(z,!0);t(z),t(L),pt(L,(S,p)=>{var b;return(b=ft)==null?void 0:b(S,p)},()=>()=>async({result:S})=>{S.type==="success"&&Ut(A,!1),await gt("Month closed","Could not close the month")({result:S})}),f(()=>{k(E,r.data.report.yearMonth),n(rt,g(A)?"Close anyway, without the open shifts":"Close month")}),l(N,L)};u(T,N=>{(!r.data.closure||r.data.closure.drifted)&&N(I)})}f(()=>k(h,r.data.report.yearMonth)),l(_,m)};u(d,_=>{r.data.permissions.canCloseMonth&&_(x)})}var i=s(d,2);{var y=_=>{var m=xa(),c=a(m);j(c),G(2),t(m),pt(m,(h,T)=>{var I;return(I=ft)==null?void 0:I(h,T)},()=>()=>async({result:h})=>{h.type==="success"?R.success("Month reopened"):R.error("Could not reopen"),await Yt()}),f(()=>k(c,r.data.report.yearMonth)),l(_,m)};u(i,_=>{r.data.closure&&r.data.permissions.canUnfreeze&&_(y)})}t(o),l(e,o)};u(se,e=>{(r.data.permissions.canCloseMonth||r.data.permissions.canUnfreeze)&&e(de)})}t(bt),t(Z),f((e,o,d)=>{n(Wt,`${r.data.report.closedShiftCount??""} closed shifts across ${r.data.report.serviceDayCount??""} service days`),wt!==(wt=r.data.report.yearMonth)&&(P.value=(P.__value=r.data.report.yearMonth)??"",Ie(P,r.data.report.yearMonth)),n(Jt,e),n(Kt,Re),n(Qt,o),n(Xt,Fe),n($t,d),n(te,Ue),n(Bt,`${Be} 6 ${r.data.allowance.note??""} `)},[()=>C(r.data.report.totalPosCents),()=>C(r.data.report.totalCashCents),()=>C(r.data.report.totalCents)]),l(O,Z),we()}Oe(["change"]);export{Pa as component};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.