// The counter POS screen (plan steps 3.3a–c). Two modes, switched at the top left:
// - Sale: categories on the left, the product grid with a search, the quick-sale cart on the
// right (SaleCart: Charge → payment, 3.3b).
// - Tables: the zones on the left and the table list (TablesView); a table opens with the
// product grid again and the table's order on the right (TablePanel).
// A tap adds a product (or opens its choices when it has preferences to pick); the (i) button
// checks its price without adding it. Every price is the backend's.
import { useMemo, useState } from 'react'
import { Info, LayoutGrid, Search, ShoppingBag, X } from 'lucide-react'
import { useFormat, useLanguage, useTranslation } from '@xenia/i18n'
import { useCan } from '@xenia/access'
import { EmptyState, IconButton, Input, Spinner } from '@xenia/ui'
import { addLine, categoriesWithProducts, defaultSelection, needsChoices, productsIn, searchProducts, toLine, unitOf } from './logic/cart'
import { zoneCounts } from './logic/tables'
import ProductDialog from './ProductDialog'
import SaleCart from './SaleCart'
import TablePanel from './TablePanel'
import TablesView from './TablesView'
import { useMenu, useTables } from './usePos'
export default function PosScreen() {
const { t } = useTranslation('terminal')
const { menu } = useMenu()
if (!menu) return