Commit Graph

999 Commits

Author SHA1 Message Date
Knee Cola
666443f76e Style placeholder text color in account form inputs
Added placeholder:text-gray-600 styling to all form inputs
(firstName, lastName, address, IBAN) to visually distinguish
placeholder text from entered values.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-17 20:44:41 +01:00
Knee Cola
ba77169554 Add IBAN formatting for improved display readability
Implemented IBAN formatting to display with proper spacing:
- Added formatIban() utility function in formatStrings.ts
- Format: Groups of 4 characters separated by spaces (e.g., HR12 3456 7890 1234 5678 9)
- Applied formatting to IBAN field display in AccountForm
- Updated validation to check cleaned IBAN (without spaces)
- Maintains backward compatibility with server-side validation

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-17 20:40:10 +01:00
Knee Cola
6d6c65d4e3 Add real-time warning for missing profile data in account form
Added conditional warning alert that displays when required fields are
empty, updating in real-time as the user types:
- Tracks form values with useState and onChange handlers
- Displays warning when firstName, lastName, address, or IBAN is missing
- Warning appears/disappears instantly as user fills or clears fields
- Explains that 2D barcode won't be shown to tenants until all data is complete
- Added translations in English and Croatian

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-17 20:33:40 +01:00
Knee Cola
216b08c12b Add IBAN validation using iban.js library
Implemented optional IBAN validation for the account form profile:
- Installed iban.js package for robust IBAN validation
- Added Zod validation with IBAN.isValid() for format checking
- Normalizes IBAN (removes spaces, uppercase) before storage
- Validates country-specific formats and checksums
- Added validation error messages in English and Croatian

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-17 20:23:11 +01:00
Knee Cola
86fa6a67fe Add info box to account form explaining barcode usage
Added informational alert at the top of the account form to explain
that profile data (name, address, IBAN) will be used to generate 2D
barcodes for tenant bill payments. The alert uses a horizontal layout
on all screen sizes for consistent UX.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-17 20:06:13 +01:00
Knee Cola
3801638d0f Adjust margin for add bill button tooltip for better alignment 2025-11-17 19:44:42 +01:00
Knee Cola
f5f15ea47e Center button labels vertically using self-center
Replace fixed top margin with self-center for vertical alignment
in PrintButton, AddLocationButton, and AddMonthButton text labels.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-17 19:42:02 +01:00
Knee Cola
e82f9a2cd6 Fix button alignment by removing negative margin
Remove mr-[-3em] from AddLocationButton, AddMonthButton, and PrintButton
to improve visual alignment and spacing consistency.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-17 19:33:46 +01:00
Knee Cola
aee6dc0932 Remove billedTo filtering to show all bills to landlord
The billedTo field indicates payment responsibility (tenant vs landlord),
not viewing permissions. Landlords should see and manage ALL bills.

Changes:
- LocationCard: Display all bills regardless of billedTo value
- LocationCard: Calculate monthlyExpense from all paid bills
- HomePage: Include all paid bills in monthlyExpense aggregation
- printActions: Print all bills with barcodes regardless of billedTo
- locationActions: Add billedTo property to fetchAllLocations result

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-17 19:32:54 +01:00
Knee Cola
fa1d04480f Extend toast notifications to all forms (bills and locations)
- Update billActions to redirect with toast messages
  - billSaved: when bill is created or updated
  - billDeleted: when bill is deleted
- Update locationActions to redirect with toast messages
  - locationSaved: when location is created or updated
  - locationDeleted: when location is deleted
- Enhance MonthLocationList to check for all toast parameters
  - Consolidated success message handling for all operations
  - Clean up all URL parameters after showing toast
- Add translations for all success messages (EN and HR)
  - Bill saved/deleted messages
  - Location saved/deleted messages

User experience: All forms now redirect to home with toast
notifications, providing consistent feedback across the app.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-17 19:06:10 +01:00
Knee Cola
5bbf80c2ae Implement redirect with toast notification on profile save
- Add gotoHomeWithMessage function to navigationActions
- Redirect to home page after successful profile save
- Display success message in toast notification instead of in-form
- Check for profileSaved URL parameter on home page mount
- Clean up URL parameter after showing toast
- Move success message translation to home-page section
- Remove unused success state and message from AccountForm
- Remove useEffect import from AccountForm

User experience: After saving profile, users are redirected to the
familiar home screen and see a toast notification confirming the save.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-17 18:58:43 +01:00
Knee Cola
513e78e8f1 Refactor account page to use icon in form title
- Remove redundant page heading from account page
- Add AccountCircle icon to AccountForm title
- Clean up unused account-page translations
- Simplify account page component by moving title to form

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-17 18:44:24 +01:00
Knee Cola
80f4c92755 Add user account settings page with profile management
- Add /account route with profile form (firstName, lastName, address, IBAN)
- Create UserProfile type and MongoDB users collection
- Implement server actions for getting and updating user profile
- Add Account Circle icon to PageHeader linking to /account
- Install Material UI icons for account icon
- Add form input disabling during save with loading spinner
- Add cancel button to discard changes and return home
- Add English and Croatian translations for account page
- Update locale names with flag emojis in language selector

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-17 18:37:59 +01:00
Knee Cola
e5ceb59934 Add USE_MOCK_AUTH flag to environment configuration
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-17 14:42:30 +01:00
Knee Cola
8ea673ecfb Merge branch 'hotfix/1.63.2' 2025-11-17 14:33:30 +01:00
Knee Cola
b9dac78bea Merge branch 'hotfix/1.63.2' into develop 2025-11-17 14:33:30 +01:00
Knee Cola
cf7b914aed (fix) Dockerfile: CMD was not compatible with distroless image 2025-11-17 14:33:10 +01:00
Knee Cola
e2cfacda87 Merge branch 'release/1.63.0' 2025-11-17 14:11:05 +01:00
Knee Cola
38974c47fb Merge branch 'feature/going-distroless' into develop 2025-11-17 14:06:54 +01:00
Knee Cola
dedc030384 Replace Alpine with distroless image for production stage
Switch from node:24-alpine to gcr.io/distroless/nodejs20-debian12:nonroot
for enhanced security and reduced attack surface. Distroless images contain
only runtime dependencies without shell, package managers, or other utilities.

Changes:
- Use distroless nodejs20-debian12:nonroot base image
- Remove manual user creation (use built-in nonroot user)
- Remove RUN commands for directory creation (incompatible with distroless)
- Update file ownership to nonroot:nonroot

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-17 14:06:31 +01:00
Knee Cola
4fed3967cc Merge branch 'release/1.62.0' 2025-11-17 13:52:54 +01:00
Knee Cola
c005f4ca78 Merge branch 'feature/payed-by-tenant' into develop 2025-11-17 13:51:35 +01:00
Knee Cola
2b55ba78d7 Improve billedTo radio buttons layout to single row
Changed the layout to display the label and radio buttons in a single
horizontal row for better visual alignment and more compact design.

Before: Label on separate line above radio buttons
After: Label and radio buttons aligned horizontally

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-17 13:50:58 +01:00
Knee Cola
1605eec5fb Replace billedToTenant boolean with billedTo enum
Migrated from boolean checkbox to enum-based radio buttons for better
flexibility and clarity in tracking bill payment responsibility.

Changes:
- Added BilledTo enum with values 'tenant' and 'landlord'
- Replaced Bill.billedToTenant (boolean) with Bill.billedTo (enum)
- Updated BillEditForm to use radio buttons instead of checkbox
- Updated billActions to handle billedTo enum values
- Updated all display filtering to use enum comparison
- Updated printActions barcode filtering
- Updated translations for radio button labels (en/hr)

The billedTo property is optional for backward compatibility -
undefined values default to BilledTo.Tenant, maintaining current
behavior where only tenant bills are displayed and calculated.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-17 13:48:28 +01:00
Knee Cola
f0ccac3f68 Filter bills display to show only billedToTenant bills
Updated all components to respect the billedToTenant flag:

- LocationCard: Filter bills display and monthlyExpense calculation
- ViewLocationCard: Filter bills display and monthlyExpense calculation
- HomePage: Update monthlyExpense calculations for month grouping
- printActions: Filter barcode print data to only include tenant bills

All filtering uses (bill.billedToTenant ?? true) for backward
compatibility with existing bills that don't have this property set.

This ensures users only see and calculate expenses for bills that
are the tenant's responsibility.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-17 13:36:42 +01:00
Knee Cola
13812c78ae chore: update Claude Code and MCP auto-approve settings
Added auto-approval for common safe operations:
- Git add and commit commands
- Serena MCP replace_regex tool

This improves workflow efficiency during development.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-17 13:31:56 +01:00
Knee Cola
c3b555189b Complete billedToTenant server action implementation
Implemented full server-side persistence for the billedToTenant property:

- Extract billedToTenant from formData in updateOrAddBill action
- Add to MongoDB $set operations for updating existing bills
- Include in new bill creation with value from form
- Set default value (true) for bills added to subsequent months
- Handle undefined values from existing database records using destructuring defaults

This completes the feature - bills can now track whether they should be
paid by the tenant, with backward compatibility for existing data.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-17 13:30:47 +01:00
Knee Cola
0ae5140487 Add billedToTenant property to Bill interface with UI support
Added new boolean property to track whether a bill should be paid by the tenant.

Changes:
- Added billedToTenant property to Bill interface in db-types.ts
- Added checkbox UI control in BillEditForm for billedToTenant
- Added state management and change handler for the checkbox
- Added i18n translations (EN: "Billed to tenant", HR: "Plaća podstanar")
- Set default value to true for new bills

Note: Server action implementation pending - property not yet persisted to database.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-17 13:18:15 +01:00
Knee Cola
c3ca55eedf mcp Serena: auto approving commands 2025-11-17 13:12:52 +01:00
Knee Cola
2ac9ca92a4 mcp: migrated serena to run inside a docker 2025-11-17 11:50:54 +01:00
Knee Cola
ed304e7ba9 Merge branch 'feature/npm-audit' into develop 2025-11-16 13:21:19 +01:00
Knee Cola
349117ec48 chore: add Claude Code local MCP server settings
Configure enabled MCP servers: serena, context7, git

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-16 13:21:11 +01:00
Knee Cola
cc147e8726 fix: resolve 14 npm security vulnerabilities via npm audit fix
Updated dependencies to patch the following security issues:
- @babel/helpers & @babel/runtime: RegExp complexity vulnerability
- brace-expansion: ReDoS vulnerabilities
- braces: Uncontrolled resource consumption
- cookie: Out of bounds character handling
- cross-spawn: ReDoS vulnerability
- js-yaml: Prototype pollution in merge
- micromatch: ReDoS vulnerability
- nanoid: Predictable results with non-integer values
- next: Multiple critical vulnerabilities (SSRF, cache poisoning, DoS, auth bypass)
- pdfjs-dist: Arbitrary JavaScript execution vulnerability
- tar: DoS vulnerability due to lack of folder count validation

Severity: 1 critical, 3 high, 7 moderate, 3 low

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-16 13:19:52 +01:00
fec08f0201 Merge branch 'release/1.61.1' 2025-10-15 16:59:02 +02:00
26eff4bd48 Merge branch 'feature/making-print-easier-to-scan' into develop 2025-10-15 16:58:43 +02:00
9f09d3257b fixed print media selector 2025-10-15 16:58:24 +02:00
f6edea79e7 manually fixed print layout to 4 qr codes per A4 2025-10-15 16:58:03 +02:00
0a07ce01bf Merge branch 'release/1.61.0' 2025-10-15 13:47:46 +02:00
0071293ea6 Merge branch 'feature/fixing-print' into develop 2025-10-15 13:46:19 +02:00
cd3b2ef16d fix: expand cell padding in print layout to fit 6 bills per A4 page
Increase padding and spacing to fit exactly 6 bills per page (down from 8).
- Increase table cell padding (th: 8px 12px, td: 16px 12px)
- Set barcode image max-height to 85px
- Increase text spacing to 0.5rem in print mode

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-15 13:45:55 +02:00
05b8d38a17 chore: remove obsolete .mcp copy.json configuration file 2025-10-15 13:36:50 +02:00
b5028ada52 fix: update QR code print layout to show payedAmount instead of yearMonth
Remove billYear and billMonth from second column, add payedAmount as last value.
- Update PrintBarcodeData interface to replace yearMonth with payedAmount
- Modify fetchBarcodeDataForPrint to include bill.payedAmount
- Update PrintPreview display to show payedAmount (formatted from cents)

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-15 13:36:41 +02:00
a5d6d7c9e6 Merge branch 'hotfix/1.60.1' 2025-09-14 22:59:46 +02:00
3e6c7a6c21 Merge branch 'hotfix/1.60.1' into develop 2025-09-14 22:59:46 +02:00
94a1bcaf36 fix: adjust padding for print content in PrintPreview component 2025-09-14 22:59:39 +02:00
a5da2cf74e Merge branch 'release/1.60.0' 2025-09-14 22:48:59 +02:00
3c424db3a2 Merge branch 'feature/sprint-01-barcode-print' into develop 2025-09-14 22:46:21 +02:00
fdfa23e67d fix: resolve MongoDB ObjectId serialization error in client components
Fix React serialization warning when passing ObjectIds to client components:

**Problem:**
- MongoDB ObjectIds have toJSON() methods which React rejects in client components
- Error: "Only plain objects can be passed to Client Components from Server Components. Objects with toJSON methods are not supported"
- Occurred when rendering main page with year parameter (?year=2023)

**Solution:**
- Add $addFields stage in fetchAllLocations aggregation pipeline
- Convert location _id and bill _id fields to strings using $toString
- Simplify $project stage to use single "bills": 1 instead of individual field projections
- Ensures only plain objects (strings) are passed to client components

**Technical Details:**
- Modified app/lib/actions/locationActions.ts:268-287
- Added $addFields stage before existing $project stage
- Converted ObjectIds to strings while preserving all other data structures
- Build passes without serialization warnings

ObjectId serialization now handled properly across all client component boundaries.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-14 22:45:14 +02:00
694ec8508b feat: add multilingual support for print preview empty state
Add i18n support for empty state when no barcode data is found:

**English translations:**
- "No Barcode Data Found" 
- "No bills with 2D barcodes found for {yearMonth}"

**Croatian translations:**
- "Nema Podataka o Barkodovima"
- "Nema računa s 2D barkodovima za {yearMonth}"

**Implementation:**
- Add translation keys to messages/en.json and messages/hr.json
- Update server component to fetch empty state translations
- Use proper next-intl parameter passing for yearMonth variable
- Replace hardcoded English text with localized translations

Empty state now displays correct language based on URL locale:
- /en/print/2025/01 → English empty state message
- /hr/print/2025/01 → Croatian empty state message

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-14 22:31:03 +02:00
834444d5c7 fix: resolve next-intl translation parameter error in print footer
Fix IntlError: FORMATTING_ERROR for print footer translation:

- Pass date parameter correctly to t("print-footer") in server component
- Remove manual string replacement in client component 
- Use proper next-intl parameter syntax: t("key", { param: value })

Error was caused by next-intl expecting translation parameters 
to be passed at the translation function call level, not through 
manual string replacement afterward.

Print preview now loads without FORMATTING_ERROR and displays 
localized footer text correctly in both English and Croatian.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-14 22:16:00 +02:00