Conditionally render payment info based on user and location settings
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 <noreply@anthropic.com>
This commit is contained in:
@@ -16,7 +16,7 @@ export interface ViewLocationCardProps {
|
|||||||
|
|
||||||
export const ViewLocationCard:FC<ViewLocationCardProps> = ({location, userSettings}) => {
|
export const ViewLocationCard:FC<ViewLocationCardProps> = ({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");
|
const t = useTranslations("home-page.location-card");
|
||||||
|
|
||||||
@@ -56,6 +56,9 @@ export const ViewLocationCard:FC<ViewLocationCardProps> = ({location, userSettin
|
|||||||
</p>
|
</p>
|
||||||
: null
|
: null
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
userSettings?.show2dCodeInMonthlyStatement && generateTenantCode ?
|
||||||
|
<>
|
||||||
<p className="max-w-[25em] ml-1 mt-1 mb-1">{t("payment-info-header")}</p>
|
<p className="max-w-[25em] ml-1 mt-1 mb-1">{t("payment-info-header")}</p>
|
||||||
<ul className="ml-4 mb-3">
|
<ul className="ml-4 mb-3">
|
||||||
<li><strong>{t("payment-iban-label")}</strong><pre className="inline pl-1">{paymentParams.IBAN}</pre></li>
|
<li><strong>{t("payment-iban-label")}</strong><pre className="inline pl-1">{paymentParams.IBAN}</pre></li>
|
||||||
@@ -69,6 +72,9 @@ export const ViewLocationCard:FC<ViewLocationCardProps> = ({location, userSettin
|
|||||||
<li><strong>{t("payment-purpose-code-label")}</strong><pre className="inline pl-1">{paymentParams.SifraNamjene}</pre></li>
|
<li><strong>{t("payment-purpose-code-label")}</strong><pre className="inline pl-1">{paymentParams.SifraNamjene}</pre></li>
|
||||||
</ul>
|
</ul>
|
||||||
<Pdf417Barcode paymentParams={paymentParams} />
|
<Pdf417Barcode paymentParams={paymentParams} />
|
||||||
|
</>
|
||||||
|
: null
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>);
|
</div>);
|
||||||
};
|
};
|
||||||
Reference in New Issue
Block a user