feat(waiter): what a waiter may do comes from permission keys (platform-v2 step 4.3)
- Payments: ordering.orders.close checked on pay/close and the counter POS
(waiters have it by default, owner decision); pay-offline always recorded.
- The venue switches waiter_cancellations / price_adjust / revert are gone:
ordering.orders.cancel, ordering.prices.modify and the new
ordering.payments.revert (overridable) decide; moves/split/transfer/merge
need ordering.orders.open; discounts pricing.discounts.apply; chat chat.use.
- Venue role defaults: role_permissions (Alembic 0024), role_template(role, db),
GET/PUT /api/waiters/roles/{role}/permissions applying the change to everyone
with the role; manager Settings -> Operation -> "What each role may do".
0024 also grants the new key to existing owners and store managers.
- Bootstrap `approvable`; @xenia/access useAllowed(key) -> yes/approve/no.
The waiter shows each action by key, "with a manager's approval (PIN)" where
allowed; GET /api/orders/cancel-permissions removed.
- Tests: test_waiter_keys.py (11), access allowed(), waiter.mjs +5, manager.mjs +3.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { useEffect, useState } from 'react'
|
||||
import { BrowserRouter, Routes, Route, Navigate, Outlet, useNavigate } from 'react-router-dom'
|
||||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
|
||||
import { AccessProvider, useAccess, useCan } from '@xenia/access'
|
||||
import { AccessProvider, useAccess, useCan, useModule } from '@xenia/access'
|
||||
import { i18n } from './i18n'
|
||||
import useAuthStore from './store/authStore'
|
||||
import useShiftStore from './store/shiftStore'
|
||||
@@ -408,6 +408,10 @@ function LoginGuard({ children }) {
|
||||
// ─── ChatListPage wrapper — owns showNewChat state so pencil can live in AppShell ──
|
||||
|
||||
function ChatListRoute() {
|
||||
// plan 4.3: staff chat needs the module and chat.use
|
||||
const chatModule = useModule('chat')
|
||||
const chatKey = useCan('chat.use')
|
||||
if (!chatModule || !chatKey) return <Navigate to="/tables" replace />
|
||||
return (
|
||||
<AppShell>
|
||||
<ChatListPage />
|
||||
|
||||
Reference in New Issue
Block a user