feat: sales points, offerings and prices per sales point (platform-v2 phase 3S, step S.1)
- core/sales_points.py: in_store, in_store_takeaway, qr_table, online_takeaway, online_delivery, online_preorder (+ old channel names mapped). - Alembic 0017: orders.sales_point (backfilled), products.sold_at (from digital_visible), digital_price/digital_discount -> item price modifiers for the QR menu and online, order_channel conditions -> sales points; drops the three digital columns. - Every order records its sales point; the pricing engine's channel is it; items not sold there are refused (order.not_sold_here, pos.line_invalid not_sold_here). - POS menu: only what the counter sells, prices per counter sales point; the screen shows the order type's products and prices. Waiter app asks for in-person products. - Cloud snapshot: products sold by the customer apps, priced by the engine. - Manager: product "Where it's sold" tab; pricing condition shows sales points. - Products API, catalogue export/import carry sold_at. - Tests: test_sales_points.py (8, incl. the migration), access +1, terminal +1. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -6,6 +6,8 @@ import {
|
||||
} from 'lucide-react'
|
||||
import toast from 'react-hot-toast'
|
||||
import client from '../../../api/client'
|
||||
import { useTranslation } from '@xenia/i18n'
|
||||
import { SALES_POINTS, normalizeSalesPoints } from '@xenia/access'
|
||||
import Button from '../../../ui/Button'
|
||||
import Modal from '../../../ui/Modal'
|
||||
import { ConfirmModal } from '../../../ui/Modal'
|
||||
@@ -40,14 +42,14 @@ const CONDITION_TYPES = [
|
||||
{ value: 'min_item_quantity', label: 'Ελάχιστη ποσότητα προϊόντος' },
|
||||
{ value: 'min_category_qty', label: 'Ελάχιστη ποσότητα κατηγορίας' },
|
||||
{ value: 'min_order_value', label: 'Ελάχιστη αξία παραγγελίας' },
|
||||
{ value: 'order_channel', label: 'Κανάλι παραγγελίας' },
|
||||
{ value: 'order_channel', label: 'Σημείο πώλησης' },
|
||||
{ value: 'price_group_active', label: 'Ομάδα τιμής ενεργή' },
|
||||
{ value: 'user_tier', label: 'Επίπεδο πελάτη (placeholder)' },
|
||||
{ value: 'low_stock', label: 'Χαμηλό απόθεμα (placeholder)' },
|
||||
]
|
||||
|
||||
const DAYS = ['Δευτέρα','Τρίτη','Τετάρτη','Πέμπτη','Παρασκευή','Σάββατο','Κυριακή']
|
||||
const CHANNELS = ['pos','online','qr','takeaway']
|
||||
const CHANNELS = SALES_POINTS // phase 3S: the order_channel condition holds sales points
|
||||
|
||||
const ROUND_OPTIONS = [
|
||||
{ value: '', label: 'Χωρίς στρογγυλοποίηση' },
|
||||
@@ -62,6 +64,7 @@ const ROUND_OPTIONS = [
|
||||
// ─── Condition editor ─────────────────────────────────────────────────────────
|
||||
|
||||
function ConditionEditor({ cond, onChange, onRemove, groups, categories, prepZones }) {
|
||||
const { t } = useTranslation('common')
|
||||
const set = (k, v) => onChange({ ...cond, params: { ...cond.params, [k]: v } })
|
||||
const setType = t => onChange({ condition_type: t, params: {} })
|
||||
|
||||
@@ -175,12 +178,12 @@ function ConditionEditor({ cond, onChange, onRemove, groups, categories, prepZon
|
||||
{CHANNELS.map(ch => (
|
||||
<button type="button" key={ch}
|
||||
onClick={() => {
|
||||
const channels = cond.params.channels ?? []
|
||||
const channels = normalizeSalesPoints(cond.params.channels)
|
||||
set('channels', channels.includes(ch) ? channels.filter(x => x !== ch) : [...channels, ch])
|
||||
}}
|
||||
className={`px-2.5 py-1 rounded text-[11px] font-medium transition-colors ${
|
||||
(cond.params.channels ?? []).includes(ch) ? 'bg-sky-100 text-sky-700' : 'bg-white border border-slate-200 text-slate-500 hover:bg-slate-50'
|
||||
}`}>{ch}</button>
|
||||
normalizeSalesPoints(cond.params.channels).includes(ch) ? 'bg-sky-100 text-sky-700' : 'bg-white border border-slate-200 text-slate-500 hover:bg-slate-50'
|
||||
}`}>{t(`salesPoints.${ch}.name`)}</button>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user