@tallyui/components 3.20.1 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1114 -90
- package/dist/index.js +8077 -3352
- package/package.json +10 -11
- package/src/cart/cart-charge-line.tsx +58 -0
- package/src/cart/cart-columns-form.tsx +98 -0
- package/src/cart/cart-columns.tsx +49 -18
- package/src/cart/cart-foot.tsx +7 -2
- package/src/cart/cart-line-strip.tsx +59 -0
- package/src/cart/cart-line.tsx +20 -8
- package/src/cart/cart-note-row.tsx +30 -0
- package/src/cart/cart-panel.tsx +9 -1
- package/src/cart/cart-row-motion.tsx +125 -0
- package/src/cart/cart-total.tsx +44 -15
- package/src/cart/index.ts +2 -1
- package/src/checkout/cash-tendered.tsx +8 -7
- package/src/checkout/change-display.tsx +2 -1
- package/src/checkout/index.ts +1 -1
- package/src/checkout/payment-selector.tsx +6 -2
- package/src/checkout/payment-types.test-d.ts +28 -0
- package/src/customer/address-editor.tsx +87 -0
- package/src/customer/address-fields.tsx +120 -0
- package/src/customer/customer-dropdown.tsx +200 -0
- package/src/customer/customer-editor.tsx +99 -0
- package/src/customer/customer-form.tsx +39 -5
- package/src/customer/customer-picker.tsx +38 -14
- package/src/customer/customers-list.tsx +83 -0
- package/src/customer/index.ts +5 -0
- package/src/filter/filter-pills.tsx +63 -0
- package/src/i18n/locales/en/components.json +85 -0
- package/src/index.ts +40 -2
- package/src/input/decimal-entry.ts +21 -0
- package/src/layout/checkout-layout.tsx +1 -1
- package/src/layout/live-tab-screen.tsx +1 -1
- package/src/layout/pos-layout.tsx +80 -4
- package/src/layout/settings-layout.tsx +1 -1
- package/src/layout/store-settings-choice-screen.tsx +1 -1
- package/src/lib/current-row.ts +13 -0
- package/src/lib/money-input.ts +16 -0
- package/src/lib/motion.ts +22 -0
- package/src/lib/use-reduced-motion.ts +20 -0
- package/src/order/index.ts +1 -1
- package/src/order/order-detail.tsx +123 -5
- package/src/order/order-filter-bar.tsx +7 -57
- package/src/order/order-status-badge.tsx +42 -19
- package/src/order/refund-form.tsx +7 -5
- package/src/product/camera-scan-button.tsx +2 -0
- package/src/product/category-nav.tsx +8 -0
- package/src/product/category-tile.tsx +65 -15
- package/src/product/in-cart-badge.tsx +55 -6
- package/src/product/index.ts +1 -0
- package/src/product/press-veil.tsx +7 -0
- package/src/product/product-card.tsx +5 -1
- package/src/product/product-grid.tsx +5 -0
- package/src/product/product-price.tsx +6 -3
- package/src/product/product-stock-badge.tsx +3 -2
- package/src/product/product-table.tsx +96 -8
- package/src/product/products-screen-columns.tsx +74 -0
- package/src/product/variant-tile.tsx +68 -0
- package/src/product/variation-picker.tsx +3 -3
- package/src/product/view-toggle.tsx +33 -4
- package/src/register/cashier-sheet.tsx +195 -0
- package/src/register/closure-sheet.tsx +54 -3
- package/src/register/handover-slip.tsx +2 -1
- package/src/register/index.ts +2 -1
- package/src/register/movement-sheet.tsx +66 -7
- package/src/register/open-register-card.tsx +11 -11
- package/src/register/register-bar.helpers.ts +17 -4
- package/src/register/register-bar.tsx +26 -5
- package/src/register/register-count.tsx +158 -24
- package/src/register/register-panel.tsx +16 -5
- package/src/register/register-side-sheet.tsx +32 -8
- package/src/register/switch-confirm.tsx +2 -2
- package/src/reports/card-panel.tsx +131 -0
- package/src/reports/cards.tsx +53 -36
- package/src/reports/hero.tsx +2 -1
- package/src/reports/index.ts +1 -0
- package/src/reports/sales-room.tsx +4 -2
- package/src/sale/breadcrumb.tsx +48 -0
- package/src/sale/cart-bar.tsx +2 -1
- package/src/sale/cart.tsx +127 -38
- package/src/sale/catalogue-settings-form.tsx +92 -0
- package/src/sale/catalogue.tsx +304 -42
- package/src/sale/category-browse.tsx +27 -0
- package/src/sale/charge-form.tsx +85 -21
- package/src/sale/customer-display-screen.tsx +22 -6
- package/src/sale/discount-form.tsx +132 -28
- package/src/sale/index.ts +6 -3
- package/src/sale/line-popover.tsx +72 -36
- package/src/sale/offered-methods.ts +16 -0
- package/src/sale/open-sale-tabs.tsx +58 -10
- package/src/sale/order-note-sheet.tsx +37 -0
- package/src/sale/order-reference.ts +3 -0
- package/src/sale/orders-list.tsx +76 -37
- package/src/sale/parked-sales.tsx +2 -1
- package/src/sale/price-form.tsx +7 -5
- package/src/sale/product-filter-bar.tsx +38 -5
- package/src/sale/receipt-sheet.tsx +243 -0
- package/src/sale/receipt.tsx +19 -9
- package/src/sale/sync-status.tsx +10 -0
- package/src/sale/tender-ledger.tsx +92 -0
- package/src/sale/tender-pane.tsx +159 -73
- package/src/sale/tender.tsx +10 -7
- package/src/sale/use-tender.ts +63 -0
- package/src/scale/min-target.tsx +36 -0
- package/src/settings/barcode-scanning-settings.tsx +164 -0
- package/src/settings/connector-status.tsx +1 -1
- package/src/settings/customer-display-settings.tsx +12 -25
- package/src/settings/index.ts +5 -0
- package/src/settings/printer-form.tsx +161 -0
- package/src/settings/printing-settings.tsx +268 -0
- package/src/settings/settings-group.tsx +2 -1
- package/src/settings/tax-calculation-settings.tsx +1 -1
- package/src/shell/added-to-cart-toast.tsx +61 -0
- package/src/shell/app-shell.tsx +5 -1
- package/src/shell/connectivity-toast.tsx +70 -0
- package/src/shell/index.ts +2 -0
- package/src/shell/nav-drawer.tsx +5 -2
- package/src/shell/nav-item.tsx +7 -4
- package/src/shell/nav-rail.tsx +9 -2
- package/src/ui/accordion/index.tsx +86 -8
- package/src/ui/alert-dialog/index.tsx +19 -5
- package/src/ui/combobox/index.tsx +21 -2
- package/src/ui/confirm-dialog/index.tsx +53 -0
- package/src/ui/dialog/index.tsx +68 -14
- package/src/ui/dialog/motion.ts +54 -0
- package/src/ui/icon/activity-heartbeat-icon.tsx +7 -0
- package/src/ui/icon/alert-circle-icon.tsx +5 -0
- package/src/ui/icon/alert-triangle-icon.tsx +7 -0
- package/src/ui/icon/banknote-icon.tsx +11 -0
- package/src/ui/icon/cash-register-icon.tsx +10 -0
- package/src/ui/icon/category-icon.tsx +7 -0
- package/src/ui/icon/chart-line-icon.tsx +5 -0
- package/src/ui/icon/check-icon.tsx +5 -0
- package/src/ui/icon/chevron-left-icon.tsx +4 -0
- package/src/ui/icon/chevron-right-icon.tsx +4 -0
- package/src/ui/icon/credit-card-icon.tsx +10 -0
- package/src/ui/icon/discount-icon.tsx +11 -0
- package/src/ui/icon/gift-icon.tsx +10 -0
- package/src/ui/icon/info-circle-icon.tsx +10 -0
- package/src/ui/icon/map-pin-icon.tsx +10 -0
- package/src/ui/icon/message-question-icon.tsx +7 -0
- package/src/ui/icon/pencil-icon.tsx +10 -0
- package/src/ui/icon/plus-icon.tsx +9 -0
- package/src/ui/icon/printer-icon.tsx +10 -0
- package/src/ui/icon/receipt-icon.tsx +7 -0
- package/src/ui/icon/settings-icon.tsx +10 -0
- package/src/ui/icon/sticky-note-icon.tsx +10 -0
- package/src/ui/icon/user-icon.tsx +4 -0
- package/src/ui/icon/users-icon.tsx +7 -0
- package/src/ui/icon/view-grid-icon.tsx +7 -0
- package/src/ui/icon/view-list-icon.tsx +7 -0
- package/src/ui/index.ts +24 -1
- package/src/ui/list-row/index.tsx +93 -0
- package/src/ui/notice/index.tsx +65 -0
- package/src/ui/select/index.tsx +2 -0
- package/src/ui/skeleton/index.tsx +37 -0
- package/src/ui/status-badge/index.tsx +43 -0
- package/src/ui/switch/index.tsx +1 -1
- package/src/ui/tabs/index.tsx +11 -2
- package/src/ui/toggle-group/index.tsx +3 -1
- package/src/ui/tone-disc/index.tsx +41 -0
package/src/sale/charge-form.tsx
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
2
|
import { Pressable, Text, TextInput, View } from 'react-native';
|
|
3
|
+
import { normalizeMoneyText, useCurrencySymbol, useMoneyFormat } from '@tallyui/core';
|
|
4
|
+
import { useT } from '../i18n';
|
|
5
|
+
import { moneyInputText } from '../lib/money-input';
|
|
6
|
+
import { Label } from '../ui/label';
|
|
3
7
|
import { parsePrice } from './price-form';
|
|
4
8
|
|
|
5
9
|
export interface ChargeFormProps {
|
|
@@ -7,34 +11,76 @@ export interface ChargeFormProps {
|
|
|
7
11
|
lineTax?: { none: boolean; classes: boolean };
|
|
8
12
|
taxClasses?: ReadonlyArray<{ id: string; label: string }>;
|
|
9
13
|
shippingTaxFromStore?: boolean;
|
|
14
|
+
/** With `shippingTaxFromStore`, the shipping kind also shows the No tax switch, as v2's Add Shipping Tax control (#1115);
|
|
15
|
+
* the class stays the store's shipping tax class. */
|
|
16
|
+
shippingNoTax?: boolean;
|
|
10
17
|
/** Given, the form is that kind only and the kind row is not shown (v2's separate Add Fee / Add Shipping /
|
|
11
18
|
* Add Miscellaneous Product entries); absent, the form opens on Fee with the row. */
|
|
12
19
|
kind?: 'fee' | 'shipping' | 'custom';
|
|
20
|
+
/** Given, the form edits that charge: prefilled, titled `Edit <name>` as v2's record dialog. */
|
|
21
|
+
initial?: { name: string; amountMinor: number; taxStatus?: 'taxable' | 'none'; taxClass?: string; percent?: number; amountIncludesTax?: boolean };
|
|
22
|
+
/** Shows the amount-unit toggle (currency symbol or %) on the fee kind, as v2's AmountUnitToggle. */
|
|
23
|
+
allowPercent?: boolean;
|
|
24
|
+
/** The store's tax mode. Given, the fee and shipping kinds show the "Amount Includes Tax" switch (not on a percent fee), which starts at this
|
|
25
|
+
* value (Desk Q4: default = store tax mode, ADR-075). */
|
|
26
|
+
pricesIncludeTax?: boolean;
|
|
13
27
|
onApply: (charge: { kind: 'fee' | 'shipping' | 'custom'; name: string; amountMinor: number;
|
|
14
|
-
taxStatus?: 'none'; taxClass?: string }) => string | null;
|
|
28
|
+
taxStatus?: 'none'; taxClass?: string; percent?: number; amountIncludesTax?: boolean }) => string | null;
|
|
15
29
|
onClose: () => void;
|
|
16
30
|
}
|
|
17
31
|
|
|
32
|
+
const NAME_LABEL_ID = 'charge-form-name-label';
|
|
33
|
+
const AMOUNT_LABEL_ID = 'charge-form-amount-label';
|
|
34
|
+
|
|
18
35
|
const button = 'rounded-md border border-border px-3 py-2 min-h-11 items-center justify-center';
|
|
36
|
+
/** A blank name takes v2's default for the kind: add-fee.tsx:71 (`pos_cart.fee`), add-shipping.tsx:73
|
|
37
|
+
* (`common.shipping`) and add-misc-product.tsx:91 (`common.product`), WCPOS monorepo packages/core/src/screens/main/pos/cart. */
|
|
38
|
+
const DEFAULT_NAME: Record<'fee' | 'shipping' | 'custom', string> = { fee: 'Fee', shipping: 'Shipping', custom: 'Product' };
|
|
19
39
|
|
|
20
40
|
/** `onApply` returns a refusal to show inline, or null once applied. */
|
|
21
|
-
export function ChargeForm({ currency, lineTax, taxClasses, shippingTaxFromStore, kind: fixedKind,
|
|
41
|
+
export function ChargeForm({ currency, lineTax, taxClasses, shippingTaxFromStore, shippingNoTax, kind: fixedKind, initial, allowPercent,
|
|
42
|
+
pricesIncludeTax, onApply, onClose }: ChargeFormProps) {
|
|
43
|
+
const currencySymbol = useCurrencySymbol();
|
|
44
|
+
const format = useMoneyFormat();
|
|
45
|
+
const t = useT();
|
|
22
46
|
const [stateKind, setKind] = useState<'fee' | 'shipping' | 'custom'>('fee');
|
|
23
47
|
const kind = fixedKind ?? stateKind;
|
|
24
|
-
const title = fixedKind === undefined ? 'Add charge'
|
|
48
|
+
const title = initial ? `Edit ${initial.name}` : fixedKind === undefined ? 'Add charge'
|
|
25
49
|
: fixedKind === 'fee' ? 'Add fee' : fixedKind === 'shipping' ? 'Add shipping' : 'Add custom item';
|
|
26
|
-
const [name, setName] = useState('');
|
|
27
|
-
const [
|
|
28
|
-
const [
|
|
29
|
-
|
|
50
|
+
const [name, setName] = useState(initial?.name ?? '');
|
|
51
|
+
const [unitPercent, setUnitPercent] = useState(Boolean(allowPercent) && initial?.percent !== undefined);
|
|
52
|
+
const [text, setText] = useState(allowPercent && initial?.percent !== undefined ? String(initial.percent)
|
|
53
|
+
: initial ? moneyInputText(initial.amountMinor, currency, format) : '');
|
|
54
|
+
const [noTax, setNoTax] = useState(initial?.taxStatus === 'none');
|
|
55
|
+
const [includesTax, setIncludesTax] = useState(initial?.amountIncludesTax ?? pricesIncludeTax ?? false);
|
|
56
|
+
const [taxClass, setTaxClass] = useState(initial?.taxClass ?? '');
|
|
30
57
|
const [error, setError] = useState<string | null>(null);
|
|
31
58
|
const storeShipping = kind === 'shipping' && shippingTaxFromStore;
|
|
59
|
+
const showNoTax = storeShipping ? shippingNoTax : lineTax?.none;
|
|
60
|
+
const showUnit = Boolean(allowPercent) && kind === 'fee';
|
|
61
|
+
const percentMode = showUnit && unitPercent;
|
|
62
|
+
// Desk ruling (#1060): a percent fee is of the cart in the store's mode, so it has no switch and no amountIncludesTax.
|
|
63
|
+
const showIncludesTax = pricesIncludeTax !== undefined && kind !== 'custom' && !percentMode;
|
|
32
64
|
function apply() {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
65
|
+
// v2's fee rules (add-fee.tsx:48-55): `pos_cart.fee_amount_negative`, and zero refused with
|
|
66
|
+
// `pos_cart.discount_amount_invalid` (climb F28). Shipping and custom items accept zero.
|
|
67
|
+
// The negative check comes first, so a fee never shows parsePrice's "0 or more".
|
|
68
|
+
// A percent's range and decimal places are the builder's to refuse, shown inline as its other refusals.
|
|
69
|
+
const number = Number(text.trim().replace(',', '.'));
|
|
70
|
+
// The money amount is read in the store format first, so a COMMA '-1.234,50' is a negative fee too.
|
|
71
|
+
const negative = (percentMode ? number : Number(normalizeMoneyText(text, format).trim().replace(',', '.'))) < 0;
|
|
72
|
+
const price = percentMode ? (Number.isNaN(number) ? 0 : number) : parsePrice(text, currency, format);
|
|
73
|
+
const parsed = kind === 'fee' && negative ? 'A fee cannot be negative. Use Add Discount instead.'
|
|
74
|
+
: kind === 'fee' && price === 0 ? 'Enter an amount greater than zero' : price;
|
|
75
|
+
// A control that is not shown keeps the edited charge's own value. The new keys go only when they carry a value,
|
|
76
|
+
// so a form without allowPercent or pricesIncludeTax sends the same object as before.
|
|
77
|
+
const refused = typeof parsed === 'string' ? parsed : onApply({
|
|
78
|
+
kind, name: name.trim() || DEFAULT_NAME[kind], amountMinor: percentMode ? 0 : parsed,
|
|
79
|
+
taxStatus: showNoTax ? (noTax ? 'none' : undefined) : initial?.taxStatus === 'none' ? 'none' : undefined,
|
|
80
|
+
taxClass: !storeShipping && lineTax?.classes && taxClasses?.length ? taxClass || undefined : initial?.taxClass,
|
|
81
|
+
...(percentMode ? { percent: parsed } : !showUnit && initial?.percent !== undefined ? { percent: initial.percent } : {}),
|
|
82
|
+
...(percentMode ? {} : showIncludesTax ? includesTax !== pricesIncludeTax ? { amountIncludesTax: includesTax } : {}
|
|
83
|
+
: initial?.amountIncludesTax !== undefined ? { amountIncludesTax: initial.amountIncludesTax } : {}),
|
|
38
84
|
});
|
|
39
85
|
setError(refused);
|
|
40
86
|
if (refused === null) onClose();
|
|
@@ -49,15 +95,33 @@ export function ChargeForm({ currency, lineTax, taxClasses, shippingTaxFromStore
|
|
|
49
95
|
{option === 'fee' ? 'Fee' : option === 'shipping' ? 'Shipping' : 'Custom item'}</Text>
|
|
50
96
|
</Pressable>)}
|
|
51
97
|
</View> : null}
|
|
52
|
-
<
|
|
53
|
-
|
|
54
|
-
<TextInput accessibilityLabel="Amount" value={text} onChangeText={setText} onSubmitEditing={apply}
|
|
55
|
-
inputMode="decimal" placeholder={currency}
|
|
98
|
+
<Label nativeID={NAME_LABEL_ID}>{t('common.name')}</Label>
|
|
99
|
+
<TextInput accessibilityLabelledBy={NAME_LABEL_ID} accessibilityLabel={t('common.name')} value={name} onChangeText={setName}
|
|
56
100
|
className="min-w-0 rounded-md border border-border bg-background px-3 py-2 text-foreground" />
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
101
|
+
<Label nativeID={AMOUNT_LABEL_ID}>{t('common.amount')}</Label>
|
|
102
|
+
<View className="flex-row items-center rounded-md border border-border bg-background">
|
|
103
|
+
<Text testID="charge-form-currency" className="pl-3 text-muted-foreground">{percentMode ? '%' : currencySymbol(currency)}</Text>
|
|
104
|
+
<TextInput accessibilityLabelledBy={AMOUNT_LABEL_ID} accessibilityLabel={t('common.amount')} value={text} onChangeText={setText} onSubmitEditing={apply}
|
|
105
|
+
inputMode="decimal" className="min-w-0 flex-1 px-3 py-2 text-foreground" />
|
|
106
|
+
</View>
|
|
107
|
+
{/* v2's AmountUnitToggle (amount-unit-toggle.tsx): the currency symbol or %, on Add Fee only. */}
|
|
108
|
+
{showUnit ? <View role="group" accessibilityLabel="Amount unit" className="flex-row gap-2">
|
|
109
|
+
{([false, true] as const).map((option) => <Pressable key={String(option)} testID={option ? 'charge-form-unit-percent' : 'charge-form-unit-amount'}
|
|
110
|
+
accessibilityRole="button" accessibilityState={{ selected: unitPercent === option }} aria-selected={unitPercent === option}
|
|
111
|
+
onPress={() => setUnitPercent(option)} className={`${button} ${unitPercent === option ? 'bg-primary' : 'bg-card'}`}>
|
|
112
|
+
<Text className={unitPercent === option ? 'text-primary-foreground' : 'text-foreground'}>{option ? '%' : currencySymbol(currency)}</Text>
|
|
113
|
+
</Pressable>)}
|
|
114
|
+
</View> : null}
|
|
115
|
+
{/* v2's "Amount Includes Tax" switch on Add Fee and Add Shipping (add-fee.tsx, add-shipping.tsx). */}
|
|
116
|
+
{showIncludesTax ? <Pressable accessibilityRole="switch" accessibilityLabel={t('pos_cart.amount_includes_tax')}
|
|
117
|
+
accessibilityState={{ checked: includesTax }} aria-checked={includesTax} onPress={() => setIncludesTax(!includesTax)}
|
|
118
|
+
className={`${button} ${includesTax ? 'bg-primary' : 'bg-card'}`}>
|
|
119
|
+
<Text className={includesTax ? 'text-primary-foreground' : 'text-foreground'}>{t('pos_cart.amount_includes_tax')}</Text></Pressable> : null}
|
|
120
|
+
{showNoTax ? <Pressable accessibilityRole="switch" accessibilityLabel="No tax"
|
|
121
|
+
accessibilityState={{ checked: noTax }} aria-checked={noTax} onPress={() => setNoTax(!noTax)} className={`${button} ${noTax ? 'bg-primary' : 'bg-card'}`}>
|
|
122
|
+
<Text className={noTax ? 'text-primary-foreground' : 'text-foreground'}>No tax</Text></Pressable> : null}
|
|
123
|
+
{storeShipping ? shippingNoTax && noTax ? null
|
|
124
|
+
: <Text className="text-muted-foreground">Shipping is taxed at the store's shipping tax class.</Text> : <>
|
|
61
125
|
{lineTax?.classes && taxClasses?.length ? <View role="group" accessibilityLabel="Tax class" className="flex-row flex-wrap gap-2">
|
|
62
126
|
{[{ id: '', label: 'No class' }, ...taxClasses].map((option) => <Pressable key={option.id} accessibilityRole="button"
|
|
63
127
|
accessibilityState={{ selected: taxClass === option.id }} aria-selected={taxClass === option.id} onPress={() => setTaxClass(option.id)}
|
|
@@ -69,7 +133,7 @@ export function ChargeForm({ currency, lineTax, taxClasses, shippingTaxFromStore
|
|
|
69
133
|
{error ? <Text accessibilityRole="alert" className="text-destructive">{error}</Text> : null}
|
|
70
134
|
<View className="flex-row gap-2">
|
|
71
135
|
<Pressable accessibilityRole="button" onPress={apply} className={`${button} bg-primary`}>
|
|
72
|
-
<Text className="font-semibold text-primary-foreground">
|
|
136
|
+
<Text className="font-semibold text-primary-foreground">{t(initial ? 'common.save' : 'common.add_to_cart')}</Text></Pressable>
|
|
73
137
|
<Pressable accessibilityRole="button" onPress={onClose} className={`${button} bg-card`}>
|
|
74
138
|
<Text className="text-foreground">Cancel</Text></Pressable>
|
|
75
139
|
</View>
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import { Image, ScrollView, Text, View } from 'react-native';
|
|
3
|
-
import {
|
|
3
|
+
import { useFormatMoney } from '@tallyui/core';
|
|
4
4
|
import type { DisplayPayment, DisplayState, ReceiptData } from '@tallyui/pos';
|
|
5
|
+
import { useT } from '../i18n';
|
|
5
6
|
|
|
6
7
|
// English copy from WCPOS v2's display (Pro packages/display/src/sample-snapshot.json); config.i18n overrides it.
|
|
7
8
|
const COPY = {
|
|
@@ -9,7 +10,7 @@ const COPY = {
|
|
|
9
10
|
discount: 'Discount', total_tax: 'Tax', included_tax: 'Tax included', total: 'Total', paid_so_far: 'Paid so far',
|
|
10
11
|
present_card: 'Please present your card', approved: 'Approved', declined: 'Declined',
|
|
11
12
|
try_another_card: 'Please try another card or ask staff', paid_in_full: 'Paid in full', change: 'Change',
|
|
12
|
-
thank_you: 'Thank you',
|
|
13
|
+
thank_you: 'Thank you', tendered: 'Tendered',
|
|
13
14
|
};
|
|
14
15
|
|
|
15
16
|
const CARD = { started: 'bg-primary', approved: 'bg-success', complete: 'bg-success', declined: 'bg-destructive' };
|
|
@@ -22,8 +23,12 @@ const CARD_TEXT = { started: 'text-primary-foreground', approved: 'text-success-
|
|
|
22
23
|
* right with the totals, or the payment card.
|
|
23
24
|
*/
|
|
24
25
|
export function CustomerDisplayScreen({ state }: { state: DisplayState }) {
|
|
26
|
+
const formatMoney = useFormatMoney();
|
|
27
|
+
const tr = useT();
|
|
25
28
|
const { config, view } = state;
|
|
26
29
|
const t = (key: keyof typeof COPY) => config?.i18n[key] ?? COPY[key];
|
|
30
|
+
// What the store owes back on a reopened sale (ADR-090): its own label, never shown as change.
|
|
31
|
+
const refundDueLabel = config?.i18n.refund_due ?? tr('customer_display.refund_due');
|
|
27
32
|
if (view.screen === 'idle') {
|
|
28
33
|
const logo = config?.store.logo;
|
|
29
34
|
return <View testID="customer-display-idle" className="flex-1 items-center justify-center gap-6 bg-primary p-8">
|
|
@@ -41,6 +46,8 @@ export function CustomerDisplayScreen({ state }: { state: DisplayState }) {
|
|
|
41
46
|
<Text className="text-base font-semibold uppercase text-foreground">{t('total')}</Text>
|
|
42
47
|
<Text className="text-4xl font-bold text-foreground">{money(receipt.totals.totalMinor)}</Text>
|
|
43
48
|
</View>;
|
|
49
|
+
const refundDue = receipt.refundDueMinor && receipt.refundDueMinor > 0
|
|
50
|
+
? <View testID="customer-display-refund-due">{row(refundDueLabel, money(receipt.refundDueMinor))}</View> : null;
|
|
44
51
|
return <View testID={`customer-display-${view.screen}`} className="flex-1 flex-col bg-card sm:flex-row">
|
|
45
52
|
<ScrollView className="flex-1" contentContainerClassName="p-8 sm:p-12">
|
|
46
53
|
<Text className="mb-5 text-sm font-semibold uppercase text-muted-foreground">{t('your_items')}</Text>
|
|
@@ -63,16 +70,19 @@ export function CustomerDisplayScreen({ state }: { state: DisplayState }) {
|
|
|
63
70
|
{receipt.totals.discountMinor > 0 ? row(t('discount'), `-${money(receipt.totals.discountMinor)}`) : null}
|
|
64
71
|
{receipt.totals.taxMinor > 0 ? row(t(receipt.totals.taxInclusive ? 'included_tax' : 'total_tax'), money(receipt.totals.taxMinor)) : null}
|
|
65
72
|
{total}
|
|
66
|
-
|
|
73
|
+
{refundDue}
|
|
74
|
+
</View> : <PaymentCard receipt={receipt} payment={view.payment} money={money} t={t} refundDueLabel={refundDueLabel}>
|
|
75
|
+
{total}{refundDue}
|
|
76
|
+
</PaymentCard>}
|
|
67
77
|
</View>
|
|
68
78
|
</View>;
|
|
69
79
|
}
|
|
70
80
|
|
|
71
|
-
function PaymentCard({ receipt, payment, money, t, children }: {
|
|
81
|
+
function PaymentCard({ receipt, payment, money, t, refundDueLabel, children }: {
|
|
72
82
|
receipt: ReceiptData; payment: DisplayPayment; money: (amount: number) => string; t: (key: keyof typeof COPY) => string;
|
|
73
|
-
children: ReactNode;
|
|
83
|
+
refundDueLabel: string; children: ReactNode;
|
|
74
84
|
}) {
|
|
75
|
-
const paid = receipt.payments.reduce((sum, { amountMinor }) => sum + amountMinor, 0);
|
|
85
|
+
const paid = receipt.payments.reduce((sum, { amountMinor, changeMinor }) => sum + amountMinor - (changeMinor ?? 0), 0);
|
|
76
86
|
const due = Math.max(0, receipt.totals.totalMinor - paid);
|
|
77
87
|
const complete = payment.state === 'complete';
|
|
78
88
|
const title = { started: t('present_card'), approved: t('approved'), declined: t('declined'), complete: t('paid_in_full') }[payment.state];
|
|
@@ -85,7 +95,13 @@ function PaymentCard({ receipt, payment, money, t, children }: {
|
|
|
85
95
|
<View className={`gap-2 rounded-xl p-6 ${CARD[payment.state]}`}>
|
|
86
96
|
<Text className={`text-sm font-semibold uppercase ${text}`}>{title}</Text>
|
|
87
97
|
<Text className={`text-4xl font-bold ${text}`}>{money(complete ? receipt.totals.totalMinor : payment.leg?.amountMinor ?? due)}</Text>
|
|
98
|
+
{!complete && payment.leg?.tenderedMinor !== undefined ? <>
|
|
99
|
+
<Text className={`text-lg ${text}`}>{`${t('tendered')} ${money(payment.leg.tenderedMinor)}`}</Text>
|
|
100
|
+
<Text className={`text-lg ${text}`}>{`${t('change')} ${money(payment.leg.changeMinor ?? 0)}`}</Text>
|
|
101
|
+
</> : null}
|
|
88
102
|
{complete && receipt.changeDueMinor > 0 ? <Text className={`text-lg ${text}`}>{`${t('change')} ${money(receipt.changeDueMinor)}`}</Text> : null}
|
|
103
|
+
{complete && receipt.refundDueMinor && receipt.refundDueMinor > 0
|
|
104
|
+
? <Text className={`text-lg ${text}`}>{`${refundDueLabel} ${money(receipt.refundDueMinor)}`}</Text> : null}
|
|
89
105
|
{message ? <Text className={`text-lg ${text}`}>{message}</Text> : null}
|
|
90
106
|
</View>
|
|
91
107
|
</View>;
|
|
@@ -1,14 +1,20 @@
|
|
|
1
|
-
import { useState } from 'react';
|
|
1
|
+
import { useId, useState } from 'react';
|
|
2
2
|
import { Pressable, Text, TextInput, View } from 'react-native';
|
|
3
|
-
import { formatMoney, minorUnitDigits, moneyFromDecimalString } from '@tallyui/core';
|
|
3
|
+
import { formatMoney, useFormatMoney, useMoneyFormat, minorUnitDigits, moneyFromDecimalString, normalizeMoneyText, type Money, type MoneyFormat } from '@tallyui/core';
|
|
4
4
|
import type { AppliedDiscount, Discount } from '@tallyui/pos';
|
|
5
5
|
import { DiscountBadge } from '../cart';
|
|
6
|
+
import { DialogFooter } from '../ui/dialog';
|
|
7
|
+
import { IconButton } from '../ui/icon-button';
|
|
8
|
+
import { PlusIcon } from '../ui/icon/plus-icon';
|
|
9
|
+
import { Tooltip, TooltipContent, TooltipTrigger } from '../ui/tooltip';
|
|
10
|
+
import { Combobox, ComboboxContent, ComboboxInput, ComboboxItem, ComboboxList, ComboboxTrigger } from '../ui/combobox';
|
|
11
|
+
import { ToggleGroup, ToggleGroupItem } from '../ui/toggle-group';
|
|
6
12
|
|
|
7
13
|
/** The cashier's entry as a TallyUI Discount (a percent, or integer minor units), or the inline error to show. */
|
|
8
|
-
export function parseDiscount(type: Discount['type'], text: string, currency: string): Discount | string {
|
|
14
|
+
export function parseDiscount(type: Discount['type'], text: string, currency: string, format?: MoneyFormat): Discount | string {
|
|
9
15
|
// A comma-locale keypad (inputMode="decimal") types "1,50": a single comma is the decimal separator.
|
|
10
|
-
const raw = text.trim();
|
|
11
|
-
const trimmed = raw.split(',').length === 2 ? raw.replace(',', '.') : raw;
|
|
16
|
+
const raw = normalizeMoneyText(text, format).trim();
|
|
17
|
+
const trimmed = !format?.decimalSeparator && !format?.thousandSeparator && raw.split(',').length === 2 ? raw.replace(',', '.') : raw;
|
|
12
18
|
if (!trimmed) return 'Enter a discount.';
|
|
13
19
|
if (!/^-?\d+(\.\d+)?$/.test(trimmed)) return 'Enter a number.';
|
|
14
20
|
const value = Number(trimmed);
|
|
@@ -23,43 +29,140 @@ export function parseDiscount(type: Discount['type'], text: string, currency: st
|
|
|
23
29
|
}
|
|
24
30
|
|
|
25
31
|
/** "10%", or a fixed discount's amount as it actually comes off (amountMinor), never the amount requested. */
|
|
26
|
-
export const discountLabel = (discount: AppliedDiscount, currency: string) => discount.type === 'percentage'
|
|
27
|
-
? `${discount.value}%` :
|
|
32
|
+
export const discountLabel = (discount: AppliedDiscount, currency: string, format: (money: Money) => string | undefined = formatMoney) => discount.type === 'percentage'
|
|
33
|
+
? `${discount.value}%` : format({ amount: discount.amountMinor, currency }) ?? String(discount.amountMinor);
|
|
28
34
|
|
|
29
35
|
const button = 'rounded-md border border-border px-3 py-2 min-h-11 items-center justify-center';
|
|
30
36
|
|
|
31
|
-
/**
|
|
32
|
-
export
|
|
33
|
-
|
|
37
|
+
/** One of the store's coupons, already formatted by the app (v2 add-coupon.tsx:233-286). */
|
|
38
|
+
export type DiscountCoupon = { code: string; detail?: string; amountLabel?: string };
|
|
39
|
+
|
|
40
|
+
const FAILED_COUPON = 'Failed to apply coupon.'; // v2 core.json:1119, also v2's fallback for an empty refusal.
|
|
41
|
+
|
|
42
|
+
/** v2 add-coupon.tsx: pick one of the app's coupons, Apply through the app; a refusal stays inline and the dialog open. */
|
|
43
|
+
function CouponTab({ coupons, onApplyCoupon, onClose, onNewCoupon, newCouponDisabledReason }: {
|
|
44
|
+
coupons: readonly DiscountCoupon[]; onApplyCoupon: (code: string) => Promise<string | null>; onClose: () => void;
|
|
45
|
+
onNewCoupon?: () => void; newCouponDisabledReason?: string;
|
|
46
|
+
}) {
|
|
47
|
+
const hintId = useId();
|
|
48
|
+
const [search, setSearch] = useState('');
|
|
49
|
+
const [picked, setPicked] = useState<string | null>(null);
|
|
50
|
+
const [error, setError] = useState<string | null>(null);
|
|
51
|
+
const [applying, setApplying] = useState(false);
|
|
52
|
+
const needle = search.trim().toLowerCase();
|
|
53
|
+
const shown = needle ? coupons.filter((c) => [c.code, c.detail ?? ''].some((s) => s.toLowerCase().includes(needle))) : coupons;
|
|
54
|
+
async function apply() {
|
|
55
|
+
if (picked === null || applying) return;
|
|
56
|
+
setApplying(true); setError(null);
|
|
57
|
+
let refused: string | null;
|
|
58
|
+
try { refused = await onApplyCoupon(picked); } catch { refused = FAILED_COUPON; }
|
|
59
|
+
setApplying(false);
|
|
60
|
+
if (refused === null) onClose(); else setError(refused || FAILED_COUPON);
|
|
61
|
+
}
|
|
62
|
+
return <>
|
|
63
|
+
{error ? <Text accessibilityRole="alert" className="text-destructive">{error}</Text> : null}
|
|
64
|
+
<View className="flex-row items-center gap-2"><Text className="text-foreground">Coupon</Text>
|
|
65
|
+
<View className="flex-1">
|
|
66
|
+
<Combobox value={picked === null ? undefined : { value: picked, label: picked }} searchValue={search}
|
|
67
|
+
onValueChange={(next) => { setPicked(next?.value ?? null); setError(null); }}
|
|
68
|
+
onSearchValueChange={(text) => { setSearch(text); setError(null); }}>
|
|
69
|
+
<ComboboxTrigger testID="add-coupon-combobox"><Text className={picked === null ? 'text-muted-foreground' : 'text-foreground'}>
|
|
70
|
+
{picked ?? 'Select coupon...'}</Text></ComboboxTrigger>
|
|
71
|
+
<ComboboxContent>
|
|
72
|
+
<View className="border-b border-border px-2 py-1.5"><ComboboxInput testID="add-coupon-search-input" placeholder="Search coupons..." /></View>
|
|
73
|
+
<ComboboxList>
|
|
74
|
+
{shown.map((coupon) => <ComboboxItem key={coupon.code} testID={`add-coupon-option-${coupon.code}`} value={coupon.code} label={coupon.code}>
|
|
75
|
+
<View className="flex-1 flex-row items-center justify-between gap-2">
|
|
76
|
+
<View className="flex-1 gap-0.5">
|
|
77
|
+
<Text className="text-sm font-medium text-popover-foreground">{coupon.code}</Text>
|
|
78
|
+
{coupon.detail ? <Text numberOfLines={1} className="text-xs text-muted-foreground">{coupon.detail}</Text> : null}
|
|
79
|
+
</View>
|
|
80
|
+
{coupon.amountLabel ? <Text className="text-sm font-semibold text-primary">{coupon.amountLabel}</Text> : null}
|
|
81
|
+
</View>
|
|
82
|
+
</ComboboxItem>)}
|
|
83
|
+
{/* ui/combobox's ComboboxEmpty has fixed copy, so v2's "No coupons found" (core.json:1126) is drawn here. */}
|
|
84
|
+
{shown.length ? null : <View className="py-6"><Text className="text-center text-sm text-muted-foreground">No coupons found</Text></View>}
|
|
85
|
+
</ComboboxList>
|
|
86
|
+
</ComboboxContent>
|
|
87
|
+
</Combobox>
|
|
88
|
+
</View>
|
|
89
|
+
{/* v2 add-coupon.tsx:110-143: "+" beside the picker; a disabled one gives its reason as tooltip and accessibilityHint. */}
|
|
90
|
+
{onNewCoupon ? <Tooltip><TooltipTrigger asChild>
|
|
91
|
+
<IconButton variant="ghost" testID="add-coupon-new" accessibilityLabel="New coupon" disabled={!!newCouponDisabledReason}
|
|
92
|
+
accessibilityHint={newCouponDisabledReason || undefined} onPress={onNewCoupon}
|
|
93
|
+
aria-describedby={newCouponDisabledReason ? hintId : undefined}>
|
|
94
|
+
<View className="text-foreground"><PlusIcon size={20} /></View>
|
|
95
|
+
</IconButton>
|
|
96
|
+
</TooltipTrigger><TooltipContent><Text>{newCouponDisabledReason || 'New coupon'}</Text></TooltipContent></Tooltip> : null}
|
|
97
|
+
{/* RN-web drops accessibilityHint; aria-describedby carries it on web. */}
|
|
98
|
+
{onNewCoupon && newCouponDisabledReason ? <Text id={hintId} className="hidden">{newCouponDisabledReason}</Text> : null}
|
|
99
|
+
</View>
|
|
100
|
+
<DialogFooter>
|
|
101
|
+
<Pressable accessibilityRole="button" onPress={onClose} className={`${button} bg-card`}><Text className="text-foreground">Cancel</Text></Pressable>
|
|
102
|
+
<Pressable testID="add-coupon-submit" accessibilityRole="button" disabled={picked === null || applying}
|
|
103
|
+
onPress={() => void apply()} className={`${button} bg-primary ${picked === null || applying ? 'opacity-50' : ''}`}>
|
|
104
|
+
<Text className="font-semibold text-primary-foreground">Apply</Text></Pressable>
|
|
105
|
+
</DialogFooter>
|
|
106
|
+
</>;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/** `onApply` returns a refusal to show inline (the capability gate), or null once applied. `layout="dialog"`: v2's Add Discount body. */
|
|
110
|
+
export function DiscountForm({ title, currency, onApply, onClose, layout = 'inline', onApplyCoupon, coupons = [], onNewCoupon, newCouponDisabledReason }: {
|
|
111
|
+
title?: string; currency: string; onApply: (discount: Discount) => string | null; onClose: () => void; layout?: 'inline' | 'dialog';
|
|
112
|
+
/** layout="dialog" only: with this, the dialog shows v2's Quick discount / Coupon tabs. Resolve a refusal to show, or null once applied (e.g. sale.applyCoupon). */
|
|
113
|
+
onApplyCoupon?: (code: string) => Promise<string | null>;
|
|
114
|
+
/** The coupons the Coupon tab lists (the app's data). Default []. */
|
|
115
|
+
coupons?: readonly DiscountCoupon[];
|
|
116
|
+
/** With this, the Coupon tab shows v2's "New coupon" (+) button; creating the coupon is the app's job. */
|
|
117
|
+
onNewCoupon?: () => void;
|
|
118
|
+
/** Already-translated reason the New coupon button is disabled (e.g. offline); shown as its tooltip and accessibility hint. */
|
|
119
|
+
newCouponDisabledReason?: string;
|
|
34
120
|
}) {
|
|
35
|
-
const
|
|
121
|
+
const dialog = layout === 'dialog';
|
|
122
|
+
const [kind, setKind] = useState<'quick' | 'coupon'>('quick'); // v2 add-discount-sheet.tsx:14 opens on Quick discount.
|
|
123
|
+
const [type, setType] = useState<Discount['type']>(dialog ? 'fixed' : 'percentage'); // v2 add-discount.tsx:44 opens at Amount.
|
|
36
124
|
const [text, setText] = useState('');
|
|
37
125
|
const [error, setError] = useState<string | null>(null);
|
|
126
|
+
const format = useMoneyFormat();
|
|
38
127
|
function apply() {
|
|
39
|
-
const parsed = parseDiscount(type, text, currency);
|
|
128
|
+
const parsed = parseDiscount(type, text, currency, format);
|
|
40
129
|
const refused = typeof parsed === 'string' ? parsed : onApply(parsed);
|
|
41
130
|
setError(refused);
|
|
42
131
|
if (refused === null) onClose();
|
|
43
132
|
}
|
|
44
|
-
|
|
45
|
-
|
|
133
|
+
const toggle = (['percentage', 'fixed'] as const).map((option) => <Pressable key={option} accessibilityRole="button"
|
|
134
|
+
accessibilityState={{ selected: type === option }} aria-selected={dialog ? type === option : undefined} onPress={() => setType(option)}
|
|
135
|
+
className={`${button} ${type === option ? 'bg-primary' : 'bg-card'}`}>
|
|
136
|
+
<Text className={type === option ? 'text-primary-foreground' : 'text-foreground'}>{option === 'percentage' ? 'Percent' : 'Amount'}</Text>
|
|
137
|
+
</Pressable>);
|
|
138
|
+
const field = <TextInput accessibilityLabel="Discount value" value={text} onChangeText={setText} onSubmitEditing={apply}
|
|
139
|
+
inputMode="decimal" placeholder={type === 'percentage' ? '%' : currency} testID={dialog ? 'discount-amount-input' : undefined}
|
|
140
|
+
className="min-w-0 flex-1 rounded-md border border-border bg-background px-3 py-2 text-foreground" />;
|
|
141
|
+
const cancel = <Pressable accessibilityRole="button" onPress={onClose} className={`${button} bg-card`}>
|
|
142
|
+
<Text className="text-foreground">Cancel</Text></Pressable>;
|
|
143
|
+
// v2 add-discount-sheet.tsx:22-34: the Quick discount / Coupon segments, only when the app can apply a coupon.
|
|
144
|
+
const tabs = dialog && onApplyCoupon ? <ToggleGroup type="single" variant="outline" value={kind} aria-label="Discount kind"
|
|
145
|
+
onValueChange={(value) => { if (value) setKind(value as 'quick' | 'coupon'); }} className="justify-start">
|
|
146
|
+
{(['quick', 'coupon'] as const).map((id) => <ToggleGroupItem key={id} value={id} testID={`add-discount-kind-${id}`}>
|
|
147
|
+
<Text className="text-sm text-foreground">{id === 'quick' ? 'Quick discount' : 'Coupon'}</Text></ToggleGroupItem>)}
|
|
148
|
+
</ToggleGroup> : null;
|
|
149
|
+
if (tabs && onApplyCoupon && kind === 'coupon') return <View role="group" accessibilityLabel={title ?? 'Discount'} className="gap-2 px-3 py-2">
|
|
150
|
+
{tabs}<CouponTab coupons={coupons} onApplyCoupon={onApplyCoupon} onClose={onClose}
|
|
151
|
+
onNewCoupon={onNewCoupon} newCouponDisabledReason={newCouponDisabledReason} /></View>;
|
|
152
|
+
return <View role="group" accessibilityLabel={title ?? 'Discount'} className="gap-2 px-3 py-2">
|
|
153
|
+
{tabs}
|
|
154
|
+
{title === undefined || dialog ? null : <Text className="font-semibold text-foreground">{title}</Text>}
|
|
46
155
|
<View className="flex-row gap-2">
|
|
47
|
-
{
|
|
48
|
-
accessibilityState={{ selected: type === option }} onPress={() => setType(option)}
|
|
49
|
-
className={`${button} ${type === option ? 'bg-primary' : 'bg-card'}`}>
|
|
50
|
-
<Text className={type === option ? 'text-primary-foreground' : 'text-foreground'}>{option === 'percentage' ? 'Percent' : 'Amount'}</Text>
|
|
51
|
-
</Pressable>)}
|
|
52
|
-
<TextInput accessibilityLabel="Discount value" value={text} onChangeText={setText} onSubmitEditing={apply}
|
|
53
|
-
inputMode="decimal" placeholder={type === 'percentage' ? '%' : currency}
|
|
54
|
-
className="min-w-0 flex-1 rounded-md border border-border bg-background px-3 py-2 text-foreground" />
|
|
156
|
+
{dialog ? <>{field}<View testID="discount-percent-switch" className="flex-row gap-2">{toggle}</View></> : <>{toggle}{field}</>}
|
|
55
157
|
</View>
|
|
56
158
|
{error ? <Text accessibilityRole="alert" className="text-destructive">{error}</Text> : null}
|
|
57
|
-
<
|
|
159
|
+
{dialog ? <DialogFooter>{cancel}<Pressable testID="add-discount-submit" accessibilityRole="button" onPress={apply}
|
|
160
|
+
className={`${button} bg-primary`}><Text className="font-semibold text-primary-foreground">Add discount</Text></Pressable></DialogFooter>
|
|
161
|
+
: <View className="flex-row gap-2">
|
|
58
162
|
<Pressable accessibilityRole="button" onPress={apply} className={`${button} bg-primary`}>
|
|
59
163
|
<Text className="font-semibold text-primary-foreground">Apply</Text></Pressable>
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
</View>
|
|
164
|
+
{cancel}
|
|
165
|
+
</View>}
|
|
63
166
|
</View>;
|
|
64
167
|
}
|
|
65
168
|
|
|
@@ -70,13 +173,14 @@ export function DiscountChips({ discounts, currency, onRemove, prefix, amounts =
|
|
|
70
173
|
discounts: AppliedDiscount[]; currency: string; onRemove: (id: string) => void; prefix?: string;
|
|
71
174
|
amounts?: { discountId: string; amountMinor: number }[];
|
|
72
175
|
}) {
|
|
176
|
+
const formatStoreMoney = useFormatMoney();
|
|
73
177
|
if (!discounts.length) return null;
|
|
74
178
|
return <View className="flex-row flex-wrap gap-2 px-3">
|
|
75
179
|
{discounts.map((discount) => {
|
|
76
180
|
const amount = amounts.find((row) => row.discountId === discount.id)?.amountMinor;
|
|
77
|
-
const own = discountLabel(discount, currency);
|
|
181
|
+
const own = discountLabel(discount, currency, formatStoreMoney);
|
|
78
182
|
const label = [prefix, amount === undefined ? (prefix ? `−${own}` : own) : discount.type === 'percentage' ? own : null,
|
|
79
|
-
amount === undefined ? null : `−${
|
|
183
|
+
amount === undefined ? null : `−${formatStoreMoney({ amount, currency })}`].filter(Boolean).join(' ');
|
|
80
184
|
return <Pressable key={discount.id} accessibilityRole="button" accessibilityLabel={`Remove discount ${label}`}
|
|
81
185
|
onPress={() => onRemove(discount.id)} className="min-h-11 flex-row items-center gap-1">
|
|
82
186
|
<DiscountBadge label={label} className="self-center" /><Text className="text-muted-foreground">✕</Text>
|
package/src/sale/index.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { Cart } from './cart';
|
|
2
|
+
export { OrderNoteSheet, type OrderNoteSheetProps } from './order-note-sheet';
|
|
2
3
|
export { CartBar } from './cart-bar';
|
|
3
4
|
export { Tender, SplitTender } from './tender';
|
|
4
5
|
export { TenderPane, type TenderPaneProps } from './tender-pane';
|
|
@@ -7,13 +8,15 @@ export { PriceForm, parsePrice } from './price-form';
|
|
|
7
8
|
export { LinePopover, type LinePopoverProps } from './line-popover';
|
|
8
9
|
export { ChargeForm, type ChargeFormProps } from './charge-form';
|
|
9
10
|
export { Catalogue, formatStockSyncTime } from './catalogue';
|
|
11
|
+
export { CatalogueSettingsForm, type CatalogueSettingsFormProps } from './catalogue-settings-form';
|
|
10
12
|
export { Receipt } from './receipt';
|
|
13
|
+
export { ReceiptSheet, type ReceiptSheetEmail, type ReceiptSheetProps, type ReceiptSheetTemplate } from './receipt-sheet';
|
|
11
14
|
export { orderReference } from './order-reference';
|
|
12
15
|
export { injectPrintStyle } from './print-style';
|
|
13
|
-
export { SyncStatus } from './sync-status';
|
|
14
|
-
export { OrdersList, type OrderHistoryRow } from './orders-list';
|
|
16
|
+
export { SyncStatus, syncStatusQuiet } from './sync-status';
|
|
17
|
+
export { OrdersList, OrderSyncNotices, type OrderHistoryRow, type OrderSyncNoticesProps } from './orders-list';
|
|
15
18
|
export { ParkedSales, type ParkedSalesProps } from './parked-sales';
|
|
16
19
|
export { OpenSaleTabs, type OpenSaleTabsProps } from './open-sale-tabs';
|
|
17
|
-
export { ProductFilterBar, DEFAULT_PRODUCT_FILTERS, PRODUCT_FILTER_CHIPS, type ProductFilterBarProps, type ProductFilterChip, type ProductFilters } from './product-filter-bar';
|
|
20
|
+
export { ProductFilterBar, DEFAULT_PRODUCT_FILTERS, PRODUCT_FILTER_CHIPS, type ProductFilterBarProps, type ProductFilterChip, type ProductFilters, type ProductTermFilter, type FilterOption } from './product-filter-bar';
|
|
18
21
|
export { CustomerDisplayScreen } from './customer-display-screen';
|
|
19
22
|
export { CustomerDisplayPairing, type CustomerDisplayPairingProps } from './customer-display-pairing';
|