@ticketboothapp/booking 1.2.137 → 1.2.138
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/package.json
CHANGED
|
@@ -163,6 +163,22 @@ export function AdminChangeReceiptComparison({
|
|
|
163
163
|
);
|
|
164
164
|
const changeSubtotal = roundMoney(amountDue - changeTax);
|
|
165
165
|
const originalCurrency = originalReceipt.currency ?? currency;
|
|
166
|
+
const originalReceiptLinesWithUnitAmounts = useMemo(
|
|
167
|
+
() =>
|
|
168
|
+
originalReceiptLines.map((line) =>
|
|
169
|
+
line.kind === 'ticket' && line.qty > 0
|
|
170
|
+
? {
|
|
171
|
+
...line,
|
|
172
|
+
unitAmountLabel: `${formatCurrencyAmount(
|
|
173
|
+
roundMoney(line.itemTotal / line.qty),
|
|
174
|
+
originalCurrency,
|
|
175
|
+
displayLocale,
|
|
176
|
+
)} each`,
|
|
177
|
+
}
|
|
178
|
+
: line,
|
|
179
|
+
),
|
|
180
|
+
[displayLocale, originalCurrency, originalReceiptLines],
|
|
181
|
+
);
|
|
166
182
|
const amountDueClass =
|
|
167
183
|
amountDue < -0.005
|
|
168
184
|
? 'text-emerald-700'
|
|
@@ -181,7 +197,7 @@ export function AdminChangeReceiptComparison({
|
|
|
181
197
|
</span>
|
|
182
198
|
</div>
|
|
183
199
|
<PriceSummary
|
|
184
|
-
lines={
|
|
200
|
+
lines={originalReceiptLinesWithUnitAmounts}
|
|
185
201
|
total={originalReceipt.total}
|
|
186
202
|
currency={originalCurrency}
|
|
187
203
|
locale={displayLocale}
|
|
@@ -12,6 +12,7 @@ export interface PriceBreakdownProps {
|
|
|
12
12
|
category: string;
|
|
13
13
|
qty: number;
|
|
14
14
|
itemTotal: number;
|
|
15
|
+
unitAmountLabel?: string;
|
|
15
16
|
breakdown: PriceBreakdownType | null;
|
|
16
17
|
currency: Currency;
|
|
17
18
|
locale: Locale;
|
|
@@ -59,6 +60,7 @@ export function PriceBreakdown({
|
|
|
59
60
|
category,
|
|
60
61
|
qty,
|
|
61
62
|
itemTotal,
|
|
63
|
+
unitAmountLabel,
|
|
62
64
|
breakdown,
|
|
63
65
|
currency,
|
|
64
66
|
locale,
|
|
@@ -96,6 +98,7 @@ export function PriceBreakdown({
|
|
|
96
98
|
) : (
|
|
97
99
|
<span className="text-sm text-stone-600">
|
|
98
100
|
{category} {qty > 1 ? `× ${qty}` : ''}
|
|
101
|
+
{unitAmountLabel ? <span className="ml-1 text-xs text-stone-400">· {unitAmountLabel}</span> : null}
|
|
99
102
|
</span>
|
|
100
103
|
)}
|
|
101
104
|
{editable && onEditableChange ? (
|
|
@@ -157,6 +160,7 @@ export function PriceBreakdown({
|
|
|
157
160
|
}
|
|
158
161
|
>
|
|
159
162
|
{category} {qty > 1 ? `× ${qty}` : ''}
|
|
163
|
+
{unitAmountLabel ? <span className="ml-1 text-xs text-stone-400">· {unitAmountLabel}</span> : null}
|
|
160
164
|
</span>
|
|
161
165
|
)}
|
|
162
166
|
<div className="relative flex-shrink-0 whitespace-nowrap">
|
|
@@ -18,6 +18,7 @@ export type PriceSummaryLine =
|
|
|
18
18
|
category: string;
|
|
19
19
|
qty: number;
|
|
20
20
|
itemTotal: number;
|
|
21
|
+
unitAmountLabel?: string;
|
|
21
22
|
breakdown?: PriceBreakdownType | null;
|
|
22
23
|
}
|
|
23
24
|
| {
|
|
@@ -210,6 +211,7 @@ export function PriceSummary({
|
|
|
210
211
|
category={row.category}
|
|
211
212
|
qty={row.qty}
|
|
212
213
|
itemTotal={row.itemTotal}
|
|
214
|
+
unitAmountLabel={row.unitAmountLabel}
|
|
213
215
|
breakdown={row.breakdown ?? null}
|
|
214
216
|
currency={currency}
|
|
215
217
|
locale={locale}
|