feat: add separate unpaid and paid bill totals to location cards

- Display both unpaid and paid bill amounts in LocationCard and MonthCard
- Rename variables for clarity: totalUnpaid, totalPayed, unpaidTotal, payedTotal
- ViewLocationCard uses totalAmount for tenant bills (regardless of payment status)
- Update Croatian translations: "Ukupno neplaćeno" (unpaid), "Ukupno plaćeno" (paid)
- Add ShoppingCartIcon for unpaid amounts, BanknotesIcon for paid amounts
- Update HomePage to calculate and pass both totals to month cards

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-18 14:59:11 +01:00
parent c817c9be05
commit e9ade045d8
7 changed files with 52 additions and 27 deletions

View File

@@ -9,13 +9,14 @@ import { useTranslations } from "next-intl";
export interface MonthCardProps {
yearMonth: YearMonth,
children?: React.ReactNode,
monthlyExpense:number,
unpaidTotal: number,
payedTotal: number,
currency?: string | null,
expanded?:boolean,
onToggle: (yearMonth:YearMonth) => void
}
export const MonthCard:FC<MonthCardProps> = ({ yearMonth, children, monthlyExpense, currency, expanded, onToggle }) => {
export const MonthCard:FC<MonthCardProps> = ({ yearMonth, children, unpaidTotal, payedTotal, currency, expanded, onToggle }) => {
const elRef = useRef<HTMLDivElement>(null);
const t = useTranslations("home-page.month-card");
@@ -37,9 +38,15 @@ export const MonthCard:FC<MonthCardProps> = ({ yearMonth, children, monthlyExpen
<div className={`collapse-title text-xl font-medium ${expanded ? "text-white" : ""}`}>
{`${formatYearMonth(yearMonth)}`}
{
monthlyExpense>0 ?
unpaidTotal>0 ?
<p className="text-xs font-medium">
{t("payed-total-label")} <strong>{ formatCurrency(monthlyExpense, currency ?? "EUR") }</strong>
{t("total-due-label")} <strong>{ formatCurrency(unpaidTotal, currency ?? "EUR") }</strong>
</p> : null
}
{
payedTotal>0 ?
<p className="text-xs font-medium">
{t("total-payed-label")} <strong>{ formatCurrency(payedTotal, currency ?? "EUR") }</strong>
</p> : null
}
</div>