refactor: update order print discount display to use pre-formatted string value

This commit is contained in:
Yoga Pangestu 2026-04-29 21:03:58 +07:00
parent 1296e10be7
commit 2793abd8ed

View File

@ -1,6 +1,5 @@
import { usePrinter } from '@/hooks/use-printer';
import { EscPosEncoder } from '@/lib/esc-pos-encoder';
import { formatCurrency } from '@/lib/formatters';
import type { Order } from '@/types/order';
import { format } from 'date-fns';
import { id } from 'date-fns/locale';
@ -68,7 +67,7 @@ export function useOrderPrint() {
if (discountAmount > 0) {
const discountLabel = 'Diskon:';
const discountVal = `- ${formatCurrency(discountAmount)}`;
const discountVal = '-' + order.discount_formatted;
const dSpaces = width - discountLabel.length - discountVal.length;
result.line(discountLabel + ' '.repeat(Math.max(0, dSpaces)) + discountVal);
}