feat(bot): redesign household status output

This commit is contained in:
2026-03-11 15:24:00 +04:00
parent 086e521ce7
commit c8c6bd2e39
5 changed files with 76 additions and 34 deletions

View File

@@ -111,27 +111,45 @@ export function createFinanceCommandsService(options: {
dashboard.currency
)
const memberLines = [...dashboard.members]
.sort((left, right) => right.remaining.compare(left.remaining))
.map((member) =>
member.paid.isZero()
? t.householdStatusMemberCompact(
member.displayName,
member.remaining.toMajorString(),
dashboard.currency
)
: t.householdStatusMemberDetailed(
member.displayName,
member.remaining.toMajorString(),
member.netDue.toMajorString(),
member.paid.toMajorString(),
dashboard.currency
)
)
return [
t.householdStatusTitle(formatBillingPeriodLabel(locale, dashboard.period)),
t.householdStatusDueDate(formatCycleDueDate(locale, dashboard.period, dueDay)),
'',
t.householdStatusChargesHeading,
rentLine,
t.householdStatusUtilities(utilityTotal.toMajorString(), dashboard.currency),
t.householdStatusPurchases(purchaseTotal.toMajorString(), dashboard.currency),
...dashboard.members.map((member) =>
t.householdStatusMember(
member.displayName,
member.netDue.toMajorString(),
member.paid.toMajorString(),
member.remaining.toMajorString(),
dashboard.currency
)
),
t.householdStatusTotals(
dashboard.totalDue.toMajorString(),
dashboard.totalPaid.toMajorString(),
'',
t.householdStatusSettlementHeading,
t.householdStatusSettlementBalance(dashboard.totalDue.toMajorString(), dashboard.currency),
...(!dashboard.totalPaid.isZero()
? [t.householdStatusSettlementPaid(dashboard.totalPaid.toMajorString(), dashboard.currency)]
: []),
t.householdStatusSettlementRemaining(
dashboard.totalRemaining.toMajorString(),
dashboard.currency
)
),
'',
t.householdStatusMembersHeading,
...memberLines
].join('\n')
}