From 54ab3fa3755bc7d806d491fd15a74d212cf9be7b Mon Sep 17 00:00:00 2001 From: Knee Cola Date: Sat, 22 Nov 2025 22:49:21 +0100 Subject: [PATCH] Improve payment description formatting in ViewLocationCard MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changes: - Renamed destructured 'name' to 'locationName' for clarity - Added locationNameTrimmed_max20 to limit location name to 19 chars - Updated PozivNaBroj to use formatYearMonth() helper - Updated OpisPlacanja with trimmed location name and formatYearMonth() - Added comment documenting 35 character max length constraint - Updated card title to use renamed locationName variable This ensures payment descriptions fit within HUB-3A barcode constraints. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- app/ui/ViewLocationCard.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/ui/ViewLocationCard.tsx b/app/ui/ViewLocationCard.tsx index 72e1a0d..e6c1a02 100644 --- a/app/ui/ViewLocationCard.tsx +++ b/app/ui/ViewLocationCard.tsx @@ -16,13 +16,15 @@ export interface ViewLocationCardProps { export const ViewLocationCard:FC = ({location, userSettings}) => { - const { _id, name, yearMonth, bills, tenantName, tenantStreet, tenantTown } = location; + const { _id, name: locationName, yearMonth, bills, tenantName, tenantStreet, tenantTown } = location; const t = useTranslations("home-page.location-card"); // sum all the billAmounts (only for bills billed to tenant) const monthlyExpense = bills.reduce((acc, bill) => (bill.paid && (bill.billedTo ?? BilledTo.Tenant) === BilledTo.Tenant) ? acc + (bill.payedAmount ?? 0) : acc, 0); + const locationNameTrimmed_max20 = locationName.trimEnd().trimEnd().substring(0,19); + const paymentParams:PaymentParams = { Iznos: (monthlyExpense/100).toFixed(2).replace(".",","), ImePlatitelja: tenantName ?? "", @@ -33,15 +35,15 @@ export const ViewLocationCard:FC = ({location, userSettin SjedistePrimatelja: userSettings?.ownerTown ?? "", IBAN: userSettings?.ownerIBAN ?? "", ModelPlacanja: "HR00", - PozivNaBroj: `${yearMonth.year}-${yearMonth.month.toString().padStart(2,"0")}`, + PozivNaBroj: formatYearMonth(yearMonth), SifraNamjene: "", - OpisPlacanja: `Režije-${name}-${yearMonth.month.toString().padStart(2,"0")}`, + OpisPlacanja: `Režije-${locationNameTrimmed_max20}-${formatYearMonth(yearMonth)}`, // max length 35 = "Režije-" (7) + locationName (20) + "-" (1) + "YYYY-MM" (7) }; return(
-

{formatYearMonth(yearMonth)} {name}

+

{formatYearMonth(yearMonth)} {locationName}

{ bills.filter(bill => (bill.billedTo ?? BilledTo.Tenant) === BilledTo.Tenant).map(bill => )