From 4655b342f243f4ee6e98ce23bf956fda9bb3ae72 Mon Sep 17 00:00:00 2001
From: Knee Cola
Date: Sat, 22 Nov 2025 22:59:00 +0100
Subject: [PATCH] Conditionally render payment info based on user and location
settings
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Changes:
- Destructure generateTenantCode from location props
- Wrap payment information and PDF417 barcode in conditional rendering
- Only show payment details when BOTH conditions are met:
- userSettings.show2dCodeInMonthlyStatement === true
- location.generateTenantCode === true
This ensures payment information and barcode are only displayed when
both the user has enabled the feature globally AND the specific location
has it enabled.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude
---
app/ui/ViewLocationCard.tsx | 34 ++++++++++++++++++++--------------
1 file changed, 20 insertions(+), 14 deletions(-)
diff --git a/app/ui/ViewLocationCard.tsx b/app/ui/ViewLocationCard.tsx
index b006b32..0280ccb 100644
--- a/app/ui/ViewLocationCard.tsx
+++ b/app/ui/ViewLocationCard.tsx
@@ -16,7 +16,7 @@ export interface ViewLocationCardProps {
export const ViewLocationCard:FC = ({location, userSettings}) => {
- const { _id, name: locationName, yearMonth, bills, tenantName, tenantStreet, tenantTown } = location;
+ const { _id, name: locationName, yearMonth, bills, tenantName, tenantStreet, tenantTown, generateTenantCode } = location;
const t = useTranslations("home-page.location-card");
@@ -56,19 +56,25 @@ export const ViewLocationCard:FC = ({location, userSettin
: null
}
- {t("payment-info-header")}
-
- - {t("payment-iban-label")}
{paymentParams.IBAN}
- - {t("payment-recipient-label")}
{paymentParams.Primatelj}
- - {t("payment-recipient-address-label")}
{paymentParams.AdresaPrimatelja}
- - {t("payment-recipient-city-label")}
{paymentParams.SjedistePrimatelja}
- - {t("payment-amount-label")}
{paymentParams.Iznos}
- - {t("payment-description-label")}
{paymentParams.OpisPlacanja}
- - {t("payment-model-label")}
{paymentParams.ModelPlacanja}
- - {t("payment-reference-label")}
{paymentParams.PozivNaBroj}
- - {t("payment-purpose-code-label")}
{paymentParams.SifraNamjene}
-
-
+ {
+ userSettings?.show2dCodeInMonthlyStatement && generateTenantCode ?
+ <>
+ {t("payment-info-header")}
+
+ - {t("payment-iban-label")}
{paymentParams.IBAN}
+ - {t("payment-recipient-label")}
{paymentParams.Primatelj}
+ - {t("payment-recipient-address-label")}
{paymentParams.AdresaPrimatelja}
+ - {t("payment-recipient-city-label")}
{paymentParams.SjedistePrimatelja}
+ - {t("payment-amount-label")}
{paymentParams.Iznos}
+ - {t("payment-description-label")}
{paymentParams.OpisPlacanja}
+ - {t("payment-model-label")}
{paymentParams.ModelPlacanja}
+ - {t("payment-reference-label")}
{paymentParams.PozivNaBroj}
+ - {t("payment-purpose-code-label")}
{paymentParams.SifraNamjene}
+
+
+ >
+ : null
+ }
);
};
\ No newline at end of file