- Refactor AccountForm to use toggle for showing/hiding profile fields
- Add show2dCodeInMonthlyStatement field to UserProfile database schema
- Implement conditional validation: all fields mandatory when 2D code is enabled
- Update FormSchema with .refine() methods for firstName, lastName, address, and IBAN
- IBAN validation includes both presence check and format validation when required
- Add validation error messages to English and Croatian localization files
- Initialize toggle state from persisted database value
- Form fields conditionally displayed based on toggle state
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Add rentDueNotification toggle to enable automatic rent notifications
- Add rentDueDay selector (1-28) for specifying when rent is due
- Extract tenant email to independent section shown when either autoBillFwd or rentDueNotification is enabled
- Update email validation to be mandatory when any automatic notification is active
- Update database schema to persist rentDueNotification and rentDueDay fields
- Add all database operations to handle new fields with proper defaults
- Add localization strings for English and Croatian
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Extract InfoBox component for reusable alert boxes
- Update AccountForm to use InfoBox component
- Add InfoBox with explanatory text to tenant sections in LocationEditForm
- Convert billFwdStrategy from radio buttons to select element
- Convert updateScope from radio buttons to select element
- Update localization strings for improved clarity
- Fix updateScope defaultValue to use "current" instead of billFwdStrategy
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Added billFwdStrategy field to store user's choice for when to forward
utility bills to tenants, with database persistence and UI updates.
Changes:
- Added billFwdStrategy field to BillingLocation interface ("when-payed" | "when-attached")
- Updated FormSchema to validate billFwdStrategy enum values
- Modified updateOrAddLocation to persist billFwdStrategy in all database operations
- Defaults to "when-payed" (first option) when no value exists in database
- Updated LocationEditForm radio buttons to use persisted database values
- Radio button selection is preserved across edits and restored from database
- Renamed autoTenantNotification to autoBillFwd throughout codebase
- Updated localization strings for bill forwarding features
Form behavior:
- New locations: "when-payed" radio selected by default
- Existing locations: Radio selection matches stored database value
- Value persisted in current, subsequent, and all month update operations
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Added toggle to control automatic tenant notifications with conditional
email field visibility based on the toggle state.
Changes:
- Added autoTenantNotification field to BillingLocation interface
- Updated LocationEditForm with "Notify tenant automatically" toggle
- Email field now only visible when autoTenantNotification is enabled
- Toggle appears after tenant name fields (when generateTenantCode is active)
- Updated updateOrAddLocation action to persist autoTenantNotification flag
- Added localization strings for toggle (Croatian/English)
Field visibility hierarchy:
1. Generate 2D code toggle (always visible)
2. Tenant name fields (visible when #1 is ON)
3. Auto notification toggle (visible when #1 is ON)
4. Email field (visible when #1 AND #3 are ON)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Added optional tenant fields (first name, last name, email) to billing locations
with a toggle to enable/disable 2D barcode generation for tenants.
Changes:
- Added generateTenantCode, tenantFirstName, tenantLastName, and tenantEmail
fields to BillingLocation interface
- Updated LocationEditForm with toggle control and conditional tenant fields
- Implemented conditional validation: tenant names required when generateTenantCode is true
- Updated updateOrAddLocation action to persist tenant data across all update operations
- Added localization strings for tenant fields and validation messages (Croatian/English)
The generateTenantCode flag is persisted in the database and controls visibility
of tenant name fields. When enabled, both first and last names become mandatory.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Replaced hardcoded "Validation failed" message with translated
version from language files:
- Updated userProfileActions.ts to use t("validation-failed")
- Added translations in English and Croatian
- Reordered general-error div in AccountForm for better layout
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
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>
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>
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>
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>
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>
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>
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>
- 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>
- 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>
- 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>
- 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>
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>
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>
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>
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>
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>
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>
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>
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>
- Add comprehensive CSS print media queries for A4 paper optimization
- Implement 69.6mm barcode width specification (20% larger than original 58mm)
- Apply B&W print color optimization forcing all elements to black/white
- Add page break handling to prevent table rows from splitting across pages
- Fix table cropping issue by removing excessive width and reducing container padding
- Optimize print layout with zero padding for maximum table space utilization
- Ensure header/button elements hidden from print output with proper CSS
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Add comprehensive i18n support for all print preview content
- Fix next-intl context error by moving translations to server component
- Implement professional 3-column table layout with proper styling
- Add multilingual table headers (EN: #, Bill Information, 2D Barcode | HR: #, Informacije o Računu, 2D Barkod)
- Center-align index column header and optimize barcode sizing
- Hide print button and header from actual print output
- Fix hydration errors with proper date handling
- Enhanced barcode display with proper padding and sizing
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Add Next.js print route at /[locale]/print/[year]/[month]
- Implement fetchBarcodeDataForPrint function with user authentication
- Create PrintPreview component with basic table layout
- Add proper 404 handling with not-found.tsx
- Fix barcode image display with flexible data URL handling
- Filter and sort bills with barcode data for consistent display
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Add PrintButton component with card styling matching AddLocationButton
- Integrate print button next to "Add a new realestate" with centered layout
- Add English/Croatian translations for print tooltips and labels
- Implement click handler to open print preview in new tab
- Create Sprint Playbook for barcode print functionality
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Add /share/attachment/.* to public pages in middleware.ts
- Create new /share/attachment/[id] route handler for downloading attachments without authentication
- Add custom 404 page for missing shared attachments
- Update ViewBillCard component to use shared attachment route instead of authenticated route
This enables attachment downloads from shared bill pages without requiring user login.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Implement ability to delete bills from all subsequent months
with toggle option and warning message similar to location deletion.
Includes centered warning box and efficient bulk operations.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Implement ability to add newly created bills to all subsequent months
with toggle option (disabled by default). Includes duplicate checking
and efficient bulk operations.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Added radio button group to LocationEditForm with three update modes:
1. Current month only (default) - updates specific location
2. Current and all future months - updates current and subsequent months
3. All months - updates all locations with same name across all time periods
- Enhanced updateOrAddLocation action with smart update logic based on scope
- Uses name-based matching to find related locations across months
- Added compact radio button styling with reduced spacing and indentation
- Added translations for update scope options in Croatian and English
- Maintains backward compatibility with existing single-location updates
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Added React state to track toggle status and show warning only when enabled
- Implemented modern custom border warning style with left red border and subtle background
- Added responsive width constraints (max-w-[24rem]) and word wrapping for proper layout
- Warning includes ⚠️ emoji and clear messaging about irreversible operation
- Fixed JSON syntax errors in translation files (replaced HTML entities with escaped quotes)
- Enhanced translations: "Also delete" phrasing and detailed warning messages
- Warning appears dynamically when bulk deletion option is activated
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Center the delete toggle horizontally within the form using justify-center
- Add consistent spacing between label and toggle input with gap-4
- Improves visual balance and readability of the delete confirmation form
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Added toggle in LocationDeleteForm for deleting locations from future months (disabled by default)
- Modified deleteLocationById action to support batch deletion across subsequent months
- When enabled, deletes all locations with same name in current and future months/years
- Only deletes user's own locations with proper data isolation
- Added translations for toggle text in Croatian and English
- Removed unused imports and variables to fix TypeScript warnings
- Uses efficient MongoDB deleteMany operation for bulk deletions
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Added toggle in LocationEditForm for adding locations to future months (disabled by default)
- Modified updateOrAddLocation action to support batch creation across subsequent months
- Only creates locations in months where no location with same name exists
- Added translations for toggle text in Croatian and English
- Fixed unused variable warning in deleteLocationById
- Improved auth.ts development comments for clarity
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>