feat(waiter): English-first texts, part b: table detail, ordering, options, payment (platform-v2 step 4.5b)

- Table detail (actions, item actions, split, price, discount, pay / revert / close,
  move / merge / transfer, guests, flags, assign, print), the order drawer (tabs,
  options, quick notes, price change, summary), add items (cart, totals, deals,
  search), the order summary and the summary before sending, the product picker.
- Money everywhere here in the language's format (`money()` in waiter i18n.js for
  helpers shared by several components, useFormat() elsewhere).
- The default quick notes are keys (the venue's own quick notes still win).
- Variables named `t` (tables, tabs, timers) renamed so they don't shadow t().

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-17 03:59:12 +02:00
co-authored by Claude Opus 5.5
parent 37155c0457
commit 2c4f78af47
10 changed files with 939 additions and 337 deletions
+22 -17
View File
@@ -3,6 +3,8 @@ import { useNavigate } from 'react-router-dom'
import OrderDrawer from './OrderDrawer'
import useWaiterFavoritesStore from '../store/waiterFavoritesStore'
import { assetUrl } from '../config/server'
import { money } from '../i18n'
import { useTranslation } from '@xenia/i18n'
const FAV_CAT_ID = '__favorites__'
const SVC_CAT_ID = '__service__'
@@ -132,7 +134,7 @@ function ProductDetailModal({ product, onClose }) {
{product.name}
</div>
<div style={{ fontSize: 18, fontWeight: 700, color: 'var(--accent, #f59e0b)', marginBottom: product.description ? 14 : 0 }}>
{Number(product.base_price).toFixed(2)} €
{money(product.base_price)}
</div>
{product.description && (
<div style={{
@@ -215,7 +217,7 @@ function ProductCard({ product, onOpen, onQuickAdd, onShowDetail }) {
))}
</div>
)}
<span className="product-btn__price">{Number(product.base_price).toFixed(2)} €</span>
<span className="product-btn__price">{money(product.base_price)}</span>
</div>
{canQuickAdd && (
@@ -249,6 +251,7 @@ function ProductCard({ product, onOpen, onQuickAdd, onShowDetail }) {
// ── Service Item Card ─────────────────────────────────────────────────────────
function ServiceItemCard({ product, customerCount, onAdd }) {
const { t } = useTranslation('waiter')
const [qty, setQty] = useState(0)
function dec() { setQty(q => Math.max(0, q - 1)) }
@@ -279,7 +282,7 @@ function ServiceItemCard({ product, customerCount, onAdd }) {
{product.name}
</span>
<span style={{ fontSize: 13, fontWeight: 600, color: hasPrice ? '#f59e0b' : 'var(--muted)', flexShrink: 0 }}>
{hasPrice ? `${Number(product.base_price).toFixed(2)} €` : 'no charge'}
{hasPrice ? money(product.base_price) : t('picker.noCharge')}
</span>
</div>
@@ -300,7 +303,7 @@ function ServiceItemCard({ product, customerCount, onAdd }) {
<button
onPointerDown={e => e.stopPropagation()}
onClick={setToCustomerCount}
title={`Ορισμός σε ${customerCount ?? 1} άτομα`}
title={t('picker.setToGuests', { count: customerCount ?? 1 })}
style={{
...btnBase,
background: 'rgba(245,158,11,0.12)',
@@ -369,11 +372,12 @@ function ServiceItemCard({ product, customerCount, onAdd }) {
}
function ServiceItemView({ products, customerCount, onAdd }) {
const { t } = useTranslation('waiter')
return (
<div style={{ display: 'flex', flexDirection: 'column', gap: 8, padding: '12px 14px' }}>
{products.length === 0 ? (
<p style={{ color: 'var(--muted)', textAlign: 'center', padding: 32 }}>
Δεν υπάρχουν service αντικείμενα
{t('picker.noService')}
</p>
) : products.map(p => (
<ServiceItemCard
@@ -422,6 +426,7 @@ function buildSections(parent, subcategories, directProducts) {
}
export default function ProductPicker({ categories, products, onAdd, onQuickAdd: onQuickAddProp, viewAllOpen, setViewAllOpen, customerCount, courses = [], globalCourseId = null, quickNotes }) {
const { t } = useTranslation('waiter')
const navigate = useNavigate()
const favorites = useWaiterFavoritesStore(s => s.favorites)
@@ -541,7 +546,7 @@ export default function ProductPicker({ categories, products, onAdd, onQuickAdd:
<svg width="13" height="13" viewBox="0 0 24 24" fill="currentColor" stroke="currentColor" strokeWidth="1" strokeLinecap="round" strokeLinejoin="round">
<path d="M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"/>
</svg>
Αγαπημένα
{t('settings.tabs.favorites')}
</button>
)}
{topLevel.map(cat => {
@@ -591,7 +596,7 @@ export default function ProductPicker({ categories, products, onAdd, onQuickAdd:
<path d="M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"/>
</svg>
<p style={{ color: 'var(--muted)', fontSize: 14, textAlign: 'center', lineHeight: 1.6 }}>
Δεν έχεις αγαπημένα ακόμα.
{t('picker.noFavorites')}
</p>
<button
onClick={() => navigate('/settings/favorites')}
@@ -601,7 +606,7 @@ export default function ProductPicker({ categories, products, onAdd, onQuickAdd:
border: 'none', fontSize: 14, fontWeight: 700, cursor: 'pointer',
}}
>
Ρύθμιση Αγαπημένων
{t('settings.fav.setup')}
</button>
</div>
)
@@ -616,7 +621,7 @@ export default function ProductPicker({ categories, products, onAdd, onQuickAdd:
/>
{flatProducts.length === 0 && (
<p style={{ color: '#64748b', textAlign: 'center', padding: 32 }}>
Δεν υπάρχουν προϊόντα
{t('picker.noProducts')}
</p>
)}
</>
@@ -682,7 +687,7 @@ export default function ProductPicker({ categories, products, onAdd, onQuickAdd:
)}
</div>
{/* View All modal — Κατηγορίες + Tags tabs */}
{/* View All modal — categories + tags tabs */}
{viewAllOpen && (
<div className="modal-overlay" onClick={() => setViewAllOpen(false)}>
<div
@@ -691,7 +696,7 @@ export default function ProductPicker({ categories, products, onAdd, onQuickAdd:
style={{ display: 'flex', flexDirection: 'column' }}
>
<div className="cat-all-modal__header">
<span className="cat-all-modal__title">{modalTab === 'categories' ? 'Κατηγορίες' : 'Tags'}</span>
<span className="cat-all-modal__title">{modalTab === 'categories' ? t('picker.categories') : t('picker.tags')}</span>
<button className="icon-btn" onClick={() => setViewAllOpen(false)}>✕</button>
</div>
@@ -711,7 +716,7 @@ export default function ProductPicker({ categories, products, onAdd, onQuickAdd:
transition: 'color 0.12s',
}}
>
{tab === 'categories' ? 'Κατηγορίες' : 'Tags'}
{tab === 'categories' ? t('picker.categories') : t('picker.tags')}
</button>
))}
</div>
@@ -729,7 +734,7 @@ export default function ProductPicker({ categories, products, onAdd, onQuickAdd:
<svg width="13" height="13" viewBox="0 0 24 24" fill="white" stroke="white" strokeWidth="1" style={{ flexShrink: 0 }}>
<path d="M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"/>
</svg>
Αγαπημένα
{t('settings.tabs.favorites')}
</span>
</button>
)}
@@ -757,7 +762,7 @@ export default function ProductPicker({ categories, products, onAdd, onQuickAdd:
const taggedProducts = activeTag ? products.filter(p => (p.tags || []).includes(activeTag)) : []
const byCategory = taggedProducts.reduce((acc, p) => {
const cat = categories.find(c => c.id === p.category_id)
const key = cat?.name || 'Χωρίς Κατηγορία'
const key = cat?.name || t('picker.noCategory')
if (!acc[key]) acc[key] = []
acc[key].push(p)
return acc
@@ -767,7 +772,7 @@ export default function ProductPicker({ categories, products, onAdd, onQuickAdd:
<div style={{ flex: 1, overflowY: 'auto', display: 'flex', flexDirection: 'column' }}>
{allTags.length === 0 && (
<div style={{ padding: '32px 16px', textAlign: 'center', color: 'var(--muted)', fontSize: 14 }}>
Δεν υπάρχουν tags ακόμα.
{t('picker.noTags')}
</div>
)}
{allTags.length > 0 && (
@@ -791,7 +796,7 @@ export default function ProductPicker({ categories, products, onAdd, onQuickAdd:
)}
{activeTag && taggedProducts.length === 0 && (
<div style={{ padding: '24px 16px', textAlign: 'center', color: 'var(--muted)', fontSize: 14 }}>
Κανένα προϊόν με αυτό το tag.
{t('picker.noTagged')}
</div>
)}
{activeTag && Object.entries(byCategory).map(([catName, prods]) => (
@@ -811,7 +816,7 @@ export default function ProductPicker({ categories, products, onAdd, onQuickAdd:
}}
>
<span style={{ fontSize: 14, fontWeight: 600, color: 'var(--text)' }}>{p.name}</span>
<span style={{ fontSize: 13, color: 'var(--muted)' }}>€{Number(p.base_price).toFixed(2)}</span>
<span style={{ fontSize: 13, color: 'var(--muted)' }}>{money(p.base_price)}</span>
</button>
))}
</div>