Add complete settlement system with visual distinction

- Add settlement category with handshake emoji (🤝)
- Create settlement page for recording debt payments with user → user flow
- Implement settlement detection and visual styling across all views
- Add conditional "Settle Debts" button (hidden when balance is 0)
- Style settlement payments distinctly in recent activity with large profile pictures
- Add settlement flow styling in payments overview with green theme
- Update backend validation and Mongoose schema for settlement category
- Fix settlement receiver detection with proper user flow logic

🤝 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-09-09 19:25:05 +02:00
parent fd4a25376b
commit 098ccb8568
10 changed files with 1014 additions and 63 deletions

View File

@@ -61,6 +61,21 @@ export const GET: RequestHandler = async ({ locals, url }) => {
.limit(10)
.lean();
// For settlements, fetch the other user's split info
for (const split of recentSplits) {
if (split.paymentId && split.paymentId.category === 'settlement') {
// This is a settlement, find the other user
const otherSplit = await PaymentSplit.findOne({
paymentId: split.paymentId._id,
username: { $ne: username }
}).lean();
if (otherSplit) {
split.otherUser = otherSplit.username;
}
}
}
return json({
netBalance,
recentSplits

View File

@@ -52,7 +52,7 @@ export const POST: RequestHandler = async ({ request, locals }) => {
throw error(400, 'Invalid split method');
}
if (category && !['groceries', 'shopping', 'travel', 'restaurant', 'utilities', 'fun'].includes(category)) {
if (category && !['groceries', 'shopping', 'travel', 'restaurant', 'utilities', 'fun', 'settlement'].includes(category)) {
throw error(400, 'Invalid category');
}