feat: major dashboard & waiter PWA overhaul
- Manager dashboard: replaced monolithic DashboardTab/OperationsPage with new DashboardPage; added OrderDetailModal, ShiftDetailModal, DeleteConfirmModal, PaymentMethodModal; updated Sidebar routing and App navigation - Reports: reworked WorkDaySummary, OrderHistory, ShiftsOverview with detail modals - Backend routers: extended orders, reports, shifts, products, business_day endpoints; updated cloud_sync service - Waiter PWA: refreshed app icons, improved ConnectionLostModal UX, updated TableCard, SSEContext, connectionStore; added useProductCache hook; vite config tweaks Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -11,6 +11,7 @@ const LABELS = {
|
||||
partially_paid: 'Μερική πληρωμή',
|
||||
paid: 'Πληρώθηκε',
|
||||
closed: 'Κλειστό',
|
||||
closed_item: 'Κλειστό (απλήρωτο)',
|
||||
'force-closed': 'Αναγκαστικό κλείσιμο',
|
||||
cancelled: 'Ακυρώθηκε',
|
||||
completed: 'Ολοκληρώθηκε',
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
import { useState } from 'react'
|
||||
import { AlertTriangle } from 'lucide-react'
|
||||
|
||||
/**
|
||||
* Two-step delete confirmation:
|
||||
* Step 1 — "Are you sure?" with a description of what will be deleted.
|
||||
* Step 2 — Type "DELETE" to confirm.
|
||||
*
|
||||
* Props:
|
||||
* title — e.g. "Διαγραφή Βάρδιας #12"
|
||||
* description — e.g. "Η βάρδια του Νίκου θα διαγραφεί μόνιμα."
|
||||
* onConfirm — called when the user completes both steps
|
||||
* onCancel — called when the user dismisses
|
||||
*/
|
||||
export default function DeleteConfirmModal({ title, description, onConfirm, onCancel }) {
|
||||
const [step, setStep] = useState(1)
|
||||
const [typed, setTyped] = useState('')
|
||||
|
||||
const canDelete = typed.trim().toUpperCase() === 'DELETE'
|
||||
|
||||
return (
|
||||
<div
|
||||
className="fixed inset-0 z-[10000] flex items-center justify-center bg-black/60 p-4"
|
||||
onClick={onCancel}
|
||||
>
|
||||
<div
|
||||
className="w-full max-w-md rounded-2xl bg-white shadow-2xl"
|
||||
onClick={e => e.stopPropagation()}
|
||||
>
|
||||
{/* Header */}
|
||||
<div className="flex items-start gap-3 px-6 pt-6 pb-4">
|
||||
<div className="flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-red-100">
|
||||
<AlertTriangle size={18} className="text-red-600" />
|
||||
</div>
|
||||
<div>
|
||||
<div className="text-base font-bold text-gray-900">{title}</div>
|
||||
<div className="mt-1 text-sm text-gray-500">{description}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="px-6 pb-6 space-y-4">
|
||||
{step === 1 && (
|
||||
<>
|
||||
<p className="text-sm text-red-700 font-medium bg-red-50 rounded-lg px-3 py-2">
|
||||
Αυτή η ενέργεια είναι μη αναστρέψιμη.
|
||||
</p>
|
||||
<div className="flex gap-3">
|
||||
<button
|
||||
onClick={onCancel}
|
||||
className="flex-1 rounded-lg border border-gray-200 py-2 text-sm font-medium text-gray-600 hover:bg-gray-50"
|
||||
>
|
||||
Ακύρωση
|
||||
</button>
|
||||
<button
|
||||
onClick={() => setStep(2)}
|
||||
className="flex-1 rounded-lg bg-red-600 py-2 text-sm font-bold text-white hover:bg-red-700"
|
||||
>
|
||||
Ναι, συνέχεια →
|
||||
</button>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
|
||||
{step === 2 && (
|
||||
<>
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-gray-700 mb-1">
|
||||
Για επιβεβαίωση πληκτρολογήστε <span className="font-mono font-bold text-red-600">DELETE</span>
|
||||
</label>
|
||||
<input
|
||||
autoFocus
|
||||
type="text"
|
||||
value={typed}
|
||||
onChange={e => setTyped(e.target.value)}
|
||||
onKeyDown={e => e.key === 'Enter' && canDelete && onConfirm()}
|
||||
placeholder="DELETE"
|
||||
className="w-full rounded-lg border border-gray-300 px-3 py-2 text-sm font-mono focus:outline-none focus:ring-2 focus:ring-red-400"
|
||||
/>
|
||||
</div>
|
||||
<div className="flex gap-3">
|
||||
<button
|
||||
onClick={onCancel}
|
||||
className="flex-1 rounded-lg border border-gray-200 py-2 text-sm font-medium text-gray-600 hover:bg-gray-50"
|
||||
>
|
||||
Ακύρωση
|
||||
</button>
|
||||
<button
|
||||
onClick={onConfirm}
|
||||
disabled={!canDelete}
|
||||
className="flex-1 rounded-lg bg-red-600 py-2 text-sm font-bold text-white hover:bg-red-700 disabled:opacity-40 disabled:cursor-not-allowed"
|
||||
>
|
||||
Διαγραφή
|
||||
</button>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
import { X } from 'lucide-react'
|
||||
|
||||
const METHODS = [
|
||||
{ key: 'cash', label: 'ΜΕΤΡΗΤΑ', icon: '💵', color: '#15803d', bg: '#f0fdf4', border: '#86efac' },
|
||||
{ key: 'card', label: 'ΚΑΡΤΑ', icon: '💳', color: '#1d4ed8', bg: '#eff6ff', border: '#93c5fd' },
|
||||
{ key: 'transfer', label: 'ΤΡΑΠΕΖΙΚΗ ΜΕΤΑΦΟΡΑ', icon: '🏦', color: '#6d28d9', bg: '#f5f3ff', border: '#c4b5fd' },
|
||||
{ key: 'treat', label: 'ΚΕΡΑΣΤΗΚΕ', icon: '🎁', color: '#b45309', bg: '#fffbeb', border: '#fcd34d' },
|
||||
]
|
||||
|
||||
export default function PaymentMethodModal({ onSelect, onCancel, title = 'Τρόπος Πληρωμής;' }) {
|
||||
return (
|
||||
<div
|
||||
className="fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4"
|
||||
onClick={onCancel}
|
||||
>
|
||||
<div
|
||||
className="w-full max-w-sm rounded-2xl bg-white shadow-2xl"
|
||||
onClick={e => e.stopPropagation()}
|
||||
>
|
||||
{/* Header */}
|
||||
<div className="flex items-center justify-between px-5 py-4 border-b border-gray-100">
|
||||
<span className="text-base font-bold text-gray-800">{title}</span>
|
||||
<button onClick={onCancel} className="text-gray-400 hover:text-gray-600 p-1">
|
||||
<X size={16} />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{/* Method buttons */}
|
||||
<div className="p-4 grid grid-cols-2 gap-3">
|
||||
{METHODS.map(m => (
|
||||
<button
|
||||
key={m.key}
|
||||
onClick={() => onSelect(m.key)}
|
||||
style={{ background: m.bg, borderColor: m.border, color: m.color }}
|
||||
className="flex flex-col items-center justify-center gap-2 rounded-xl border-2 py-5 font-bold text-sm transition-transform active:scale-95 hover:opacity-90"
|
||||
>
|
||||
<span className="text-2xl">{m.icon}</span>
|
||||
{m.label}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
|
||||
<div className="px-4 pb-4">
|
||||
<button
|
||||
onClick={onCancel}
|
||||
className="w-full rounded-lg border border-gray-200 py-2 text-sm text-gray-500 hover:bg-gray-50"
|
||||
>
|
||||
Ακύρωση
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -60,6 +60,7 @@ export const STATUS_STYLES = {
|
||||
open: { bg: 'bg-sky-50', text: 'text-sky-700', ring: 'ring-sky-200', dot: 'bg-sky-500' },
|
||||
partially_paid: { bg: 'bg-amber-50', text: 'text-amber-800', ring: 'ring-amber-200', dot: 'bg-amber-500' },
|
||||
cancelled: { bg: 'bg-rose-50', text: 'text-rose-700', ring: 'ring-rose-200', dot: 'bg-rose-500' },
|
||||
closed_item: { bg: 'bg-amber-50', text: 'text-amber-800', ring: 'ring-amber-200', dot: 'bg-amber-500' },
|
||||
failed: { bg: 'bg-rose-50', text: 'text-rose-700', ring: 'ring-rose-200', dot: 'bg-rose-500' },
|
||||
success: { bg: 'bg-emerald-50', text: 'text-emerald-700', ring: 'ring-emerald-200', dot: 'bg-emerald-500' },
|
||||
free: { bg: 'bg-slate-100', text: 'text-slate-600', ring: 'ring-slate-200', dot: 'bg-slate-400' },
|
||||
|
||||
Reference in New Issue
Block a user