feat: unified station mode with POS + repairs desk view

Phase 1: Station shell
- /station route replaces /pos (with redirect)
- Shared lock screen, activity tracking, auto-lock timer
- Permission-gated tab bar (POS | Repairs | Lessons)
- POSRegister embedded mode (skip lock/timer/topbar)
- Sidebar navigates to /station

Phase 2: Repairs station — front desk
- Status bar with count badges per status group, clickable filters
- Ticket queue panel with search and status filtering
- Ticket detail panel with status progress, notes, photos, line items
- Full stepped intake form: customer → item → problem/estimate → review
- Service template quick-add for line items

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
ryan
2026-04-06 01:33:06 +00:00
parent abe75fb1fd
commit 082e388799
15 changed files with 1291 additions and 24 deletions

View File

@@ -40,20 +40,25 @@ function configOptions(key: string) {
})
}
export function POSRegister() {
interface POSRegisterProps {
embedded?: boolean
}
export function POSRegister({ embedded }: POSRegisterProps = {}) {
const { locationId, setLocation, currentTransactionId, setDrawerSession, locked, lock, touchActivity, token } = usePOSStore()
// Fetch lock timeout from config
// Fetch lock timeout from config (standalone only)
const { data: lockTimeoutStr } = useQuery({
...configOptions('pos_lock_timeout'),
enabled: !!token,
enabled: !!token && !embedded,
})
const lockTimeoutMinutes = parseInt(lockTimeoutStr ?? '15') || 15
// Auto-lock timer
// Auto-lock timer (standalone only — station shell handles this when embedded)
const timerRef = useRef<ReturnType<typeof setInterval> | null>(null)
useEffect(() => {
if (embedded) return
if (locked || lockTimeoutMinutes === 0) {
if (timerRef.current) clearInterval(timerRef.current)
return
@@ -69,26 +74,27 @@ export function POSRegister() {
return () => {
if (timerRef.current) clearInterval(timerRef.current)
}
}, [locked, lockTimeoutMinutes, lock])
}, [embedded, locked, lockTimeoutMinutes, lock])
// Track activity on any interaction
// Track activity (standalone only)
const handleActivity = useCallback(() => {
if (!locked) touchActivity()
}, [locked, touchActivity])
if (!embedded && !locked) touchActivity()
}, [embedded, locked, touchActivity])
// Fetch locations
// Fetch locations (standalone only — station shell handles this when embedded)
const { data: locationsData } = useQuery({
...locationsOptions(),
enabled: !!token,
enabled: !!token && !embedded,
})
const locations = locationsData?.data ?? []
// Auto-select first location
// Auto-select first location (standalone only)
useEffect(() => {
if (embedded) return
if (!locationId && locations.length > 0) {
setLocation(locations[0].id)
}
}, [locationId, locations, setLocation])
}, [embedded, locationId, locations, setLocation])
// Fetch current drawer for selected location
const { data: drawer } = useQuery({
@@ -112,6 +118,20 @@ export function POSRegister() {
enabled: !!currentTransactionId && !!token,
})
// Embedded mode: just the content panels, no wrapper/lock/topbar
if (embedded) {
return (
<div className="flex flex-1 h-full min-h-0">
<div className="w-[60%] border-r border-border overflow-hidden">
<POSItemPanel transaction={transaction ?? null} />
</div>
<div className="w-[40%] overflow-hidden">
<POSCartPanel transaction={transaction ?? null} />
</div>
</div>
)
}
return (
<div
className="relative flex flex-col h-full"