From a254ca54301aa3514590adeb7edf2f2773a2079d Mon Sep 17 00:00:00 2001 From: Knee Cola Date: Sun, 23 Nov 2025 00:10:58 +0100 Subject: [PATCH] Improve LocationCard monthly statement section with proof of payment link MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changes: - Added utilBillsProofOfPaymentAttachment to LocationCard component - Updated monthly statement fieldset to show when proof of payment exists - Added visual indicators with icons: - CheckCircleIcon next to payed total amount - EyeIcon for "seen by tenant" status (changed from CheckCircleIcon) - LinkIcon for proof of payment download link - Added download link for proof of payment with success indicator - Code formatting improvements and removed console.log - Updated translations to lowercase: - English: "Seen by tenant" -> "seen by tenant" - Croatian: "Viđeno od strane podstanara" -> "viđeno od strane podstanara" - Added Croatian translation: - "download-proof-of-payment-label": "potvrda-o-uplati.pdf" The monthly statement section now displays proof of payment status with a download link when available. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- app/ui/LocationCard.tsx | 45 +++++++++++++++++++++++++---------------- messages/en.json | 2 +- messages/hr.json | 3 ++- 3 files changed, 31 insertions(+), 19 deletions(-) diff --git a/app/ui/LocationCard.tsx b/app/ui/LocationCard.tsx index 98f36a3..047767f 100644 --- a/app/ui/LocationCard.tsx +++ b/app/ui/LocationCard.tsx @@ -1,6 +1,6 @@ 'use client'; -import { CheckCircleIcon, Cog8ToothIcon, PlusCircleIcon, ShareIcon, BanknotesIcon } from "@heroicons/react/24/outline"; +import { CheckCircleIcon, Cog8ToothIcon, PlusCircleIcon, ShareIcon, BanknotesIcon, DocumentIcon, EnvelopeIcon, LinkIcon, EyeIcon } from "@heroicons/react/24/outline"; import { FC } from "react"; import { BillBadge } from "./BillBadge"; import { BillingLocation } from "../lib/db-types"; @@ -15,10 +15,8 @@ export interface LocationCardProps { currency?: string | null; } -export const LocationCard:FC = ({location, currency}) => { - const { _id, name, yearMonth, bills, seenByTenant } = location; - - console.log("seenByTenant:", seenByTenant); +export const LocationCard: FC = ({ location, currency }) => { + const { _id, name, yearMonth, bills, seenByTenant, utilBillsProofOfPaymentAttachment } = location; const t = useTranslations("home-page.location-card"); const currentLocale = useLocale(); @@ -32,11 +30,11 @@ export const LocationCard:FC = ({location, currency}) => { navigator.clipboard.writeText(url); // use NextJS toast to notiy user that the link was copied - toast.success(t("link-copy-message"), {theme: "dark"}); + toast.success(t("link-copy-message"), { theme: "dark" }); } - - return( -
+ + return ( +
@@ -52,24 +50,37 @@ export const LocationCard:FC = ({location, currency}) => {
- { monthlyExpense > 0 || seenByTenant ? + {monthlyExpense > 0 || seenByTenant || utilBillsProofOfPaymentAttachment ?
{t("monthly-statement-legend")} { monthlyExpense > 0 ? -
- - { t("payed-total-label") } {formatCurrency(monthlyExpense, currency ?? "EUR")} -
- : null +
+ + {t("payed-total-label")} {formatCurrency(monthlyExpense, currency ?? "EUR")} + +
+ : null } {seenByTenant && ( -
- +
+ {t("seen-by-tenant-label")} +
)} + {( + + + {t("download-proof-of-payment-label")} + + + )}
: null } diff --git a/messages/en.json b/messages/en.json index 7b4cb2c..f7ff0f1 100644 --- a/messages/en.json +++ b/messages/en.json @@ -57,7 +57,7 @@ "payed-total-label": "Payed total:", "link-copy-message": "Link copied to clipboard", "monthly-statement-legend": "Monthly statement", - "seen-by-tenant-label": "Seen by tenant", + "seen-by-tenant-label": "seen by tenant", "payment-info-header": "You can pay the utility bills for this month using the following information:", "payment-amount-label": "Amount:", "payment-recipient-label": "Recipient:", diff --git a/messages/hr.json b/messages/hr.json index 0591a95..6e4bb19 100644 --- a/messages/hr.json +++ b/messages/hr.json @@ -57,7 +57,8 @@ "payed-total-label": "Ukupno plaćeno:", "link-copy-message": "Link kopiran na clipboard", "monthly-statement-legend": "Obračun", - "seen-by-tenant-label": "Viđeno od strane podstanara", + "seen-by-tenant-label": "viđeno od strane podstanara", + "download-proof-of-payment-label": "potvrda-o-uplati.pdf", "payment-info-header": "Režije za ovaj mjesec možete uplatiti koristeći slijedeće podatke:", "payment-amount-label": "Iznos:", "payment-recipient-label": "Primatelj:",