/** * Printable loyalty QR codes — the payloads the counter scanner actually reads. */ import { useMemo, useState } from 'react' import { Printer } from 'lucide-react' import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card' import { Button } from '@/components/ui/button' import { Badge } from '@/components/ui/badge' import { Input } from '@/components/ui/input' import { PersonAvatar } from '@/components/ui/avatar' import { customers } from '@/mocks/data' import { customerQrPayload } from '@/pages/pos/posEngine' import { QrImage } from '@/pages/pos/QrImage' import { useAuthStore } from '@/zustand/authStore' import { branches } from '@/mocks/data' export function CustomerCodesPanel() { const user = useAuthStore((s) => s.user) const [q, setQ] = useState('') const scopedZone = user?.branchId ? branches.find((b) => b.id === user.branchId)?.zone : undefined const list = useMemo(() => { let rows = scopedZone ? customers.filter((c) => c.branch === scopedZone) : customers if (q) { const needle = q.toLowerCase() rows = rows.filter( (c) => c.name.toLowerCase().includes(needle) || c.phone.includes(needle) || c.id.toLowerCase().includes(needle), ) } return rows }, [scopedZone, q]) return (

Each code encodes GISHEN-CUST:<id>. Scan it on Quick purchase, or type the code when the camera is unavailable.

setQ(e.target.value)} />
{list.map((customer) => { const payload = customerQrPayload(customer.id) return (
{customer.name}

{customer.phone}

{customer.tier}
{payload}
) })}
) }