Commit Graph

958 Commits

Author SHA1 Message Date
Knee Cola
e55468116e Adjust margin of monthly statement fieldset in LocationCard component 2025-11-22 23:16:41 +01:00
Knee Cola
256ecf7c55 Move currency selector to separate General Settings section
Changes:
- Reorganized UserSettingsForm layout
- Moved currency select field from tenant 2D code fieldset
  to new "General Settings" fieldset at the top of the form
- Added translations for "general-settings-legend":
  - English: "General Settings"
  - Croatian: "Opće postavke"

Currency is now in a more logical location as a general setting
rather than being grouped with tenant-specific 2D code settings.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-22 23:12:17 +01:00
Knee Cola
a2cea49e9f Update formatCurrency to handle optional currencyCode and default to EUR 2025-11-22 23:06:04 +01:00
Knee Cola
c025c6f2ce Update formatCurrency to use currency code from UserSettings
Changes:
- Updated formatCurrency function:
  - Added currencyCode parameter with EUR default
  - Implemented Intl.NumberFormat for proper currency formatting
  - Added fallback for invalid currency codes
- Updated component hierarchy to pass currency:
  - HomePage: Fetch userSettings and pass to MonthLocationList
  - MonthLocationList: Accept and pass currency to child components
  - LocationCard: Accept currency prop and use in formatCurrency
  - MonthCard: Accept currency prop and use in formatCurrency
  - ViewLocationCard: Pass currency from userSettings to formatCurrency
- Removed hardcoded $ symbols, now using proper currency formatting

All currency amounts now display with the user's selected currency code
from their settings, using locale-appropriate formatting (hr-HR).

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-22 23:04:42 +01:00
Knee Cola
4655b342f2 Conditionally render payment info based on user and location settings
Changes:
- Destructure generateTenantCode from location props
- Wrap payment information and PDF417 barcode in conditional rendering
- Only show payment details when BOTH conditions are met:
  - userSettings.show2dCodeInMonthlyStatement === true
  - location.generateTenantCode === true

This ensures payment information and barcode are only displayed when
both the user has enabled the feature globally AND the specific location
has it enabled.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-22 22:59:00 +01:00
Knee Cola
1e89e59d42 Rearrange payment information display in ViewLocationCard 2025-11-22 22:54:24 +01:00
Knee Cola
54ab3fa375 Improve payment description formatting in ViewLocationCard
Changes:
- Renamed destructured 'name' to 'locationName' for clarity
- Added locationNameTrimmed_max20 to limit location name to 19 chars
- Updated PozivNaBroj to use formatYearMonth() helper
- Updated OpisPlacanja with trimmed location name and formatYearMonth()
- Added comment documenting 35 character max length constraint
- Updated card title to use renamed locationName variable

This ensures payment descriptions fit within HUB-3A barcode constraints.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-22 22:49:21 +01:00
Knee Cola
4db56f8383 Rename 'iban' to 'ownerIBAN' in UserSettings
Changes:
- Updated UserSettings interface: iban -> ownerIBAN
- Updated userSettingsActions.ts:
  - Changed State type to use ownerIBAN
  - Updated FormSchema validation to reference ownerIBAN
  - Updated validation refinements to check ownerIBAN
  - Updated form data parsing to read ownerIBAN
  - Renamed normalizedIban to normalizedOwnerIBAN
  - Updated database write operations to use ownerIBAN
- Updated UserSettingsForm.tsx:
  - Changed state tracking to use ownerIBAN
  - Updated validation check to reference ownerIBAN (cleanedOwnerIBAN)
  - Updated input field: id, name, and event handlers
- Updated ViewLocationCard.tsx to use ownerIBAN instead of iban
- Updated English translations:
  - iban-label -> owner-iban-label
  - iban-placeholder -> owner-iban-placeholder
  - iban-required -> owner-iban-required
  - iban-invalid -> owner-iban-invalid
- Updated Croatian translations with corresponding ownerIBAN keys

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-22 22:43:30 +01:00
Knee Cola
e6adb10689 Rename 'town' to 'ownerTown' in UserSettings with 27 character max length
Changes:
- Updated UserSettings interface: town -> ownerTown
- Updated userSettingsActions.ts:
  - Changed State type to use ownerTown
  - Added max length validation (27 characters) to FormSchema
  - Updated validation refinement to check ownerTown
  - Updated form data parsing to read ownerTown
  - Updated database write operations to use ownerTown
- Updated UserSettingsForm.tsx:
  - Changed state tracking to use ownerTown
  - Updated validation check to reference ownerTown
  - Updated input field: id, name, maxLength={27}
- Updated ViewLocationCard.tsx to use ownerTown instead of town
- Updated English translations:
  - town-label -> owner-town-label: "Your Postal Code and Town"
  - town-placeholder -> owner-town-placeholder
  - town-required -> owner-town-required
- Updated Croatian translations with corresponding ownerTown keys

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-22 22:40:12 +01:00
Knee Cola
387b7e0256 Rename 'street' to 'ownerStreet' in UserSettings with 25 character max length
Changes:
- Updated UserSettings interface: street -> ownerStreet
- Updated userSettingsActions.ts:
  - Changed State type to use ownerStreet
  - Added max length validation (25 characters) to FormSchema
  - Updated validation refinement to check ownerStreet
  - Updated form data parsing to read ownerStreet
  - Updated database write operations to use ownerStreet
- Updated UserSettingsForm.tsx:
  - Changed state tracking to use ownerStreet
  - Updated validation check to reference ownerStreet
  - Updated input field: id, name, maxLength={25}
- Updated ViewLocationCard.tsx to use ownerStreet instead of street
- Updated English translations:
  - street-label -> owner-street-label: "Your Street and House Number"
  - street-placeholder -> owner-street-placeholder
  - street-required -> owner-street-required
- Updated Croatian translations with corresponding ownerStreet keys

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-22 22:37:04 +01:00
Knee Cola
db1df76ed6 Rename firstName to ownerName with updated validation
- Renamed firstName to ownerName in UserSettings interface
- Updated UserSettingsForm field to accept full name (first and last)
- Set maximum length to 25 characters for owner name field
- Updated all database operations to use ownerName
- Changed English label from "First Name" to "Your First and Last Name"
- Updated Croatian translations to match (Vaše ime i prezime)
- Updated form validation schema and error messages
- Removed old lastName-related translations
- Updated ViewLocationCard to use ownerName for recipient

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-22 22:31:07 +01:00
Knee Cola
c1762f7157 Remove lastName field from UserSettings and database
- Removed lastName from UserSettings interface
- Updated UserSettingsForm to remove lastName input field
- Removed lastName from all database operations
- Updated form validation schema to remove lastName validation
- Updated ViewLocationCard to use only firstName for recipient name
- Removed lastName from user settings form state tracking
- Updated Croatian translations to reflect changes

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-22 22:26:41 +01:00
Knee Cola
86913f60ec Update tenant town label to include postal code in localization 2025-11-22 22:23:45 +01:00
Knee Cola
130bec3050 Update placeholder text to lowercase in bill and location edit forms 2025-11-22 22:20:10 +01:00
Knee Cola
b4e459b2d5 Rename tenantFirstName to tenantName with updated validation
- Renamed tenantFirstName to tenantName in BillingLocation interface
- Updated LocationEditForm field to accept full name (first and last)
- Set maximum length to 30 characters for tenant name field
- Updated all database operations to use tenantName
- Changed English label from "Tenant First Name" to "Tenant First and Last Name"
- Updated Croatian translations to match (Ime i prezime podstanara)
- Updated form validation schema and error messages
- Removed old tenantLastName-related translations

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-22 22:17:10 +01:00
Knee Cola
a1c683528c Remove tenantLastName field from LocationEditForm and database
- Removed tenantLastName from BillingLocation interface
- Updated LocationEditForm to remove tenantLastName input field
- Removed tenantLastName from all database operations (insert and update)
- Updated form validation schema to remove tenantLastName validation
- Updated ViewLocationCard to use only tenantFirstName for payer name
- Removed tenantLastName from tenant field state tracking

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-22 22:09:13 +01:00
Knee Cola
280e2ec029 Populate paymentParams with actual data from database
- Updated ViewLocationCard to accept userSettings prop
- Replaced all hardcoded payment values with dynamic data:
  * Amount calculated from monthly expenses
  * Payer info from tenant fields (name, street, town)
  * Recipient info from userSettings (name, street, town, IBAN)
  * Reference number and description generated from location data
- Created getUserSettingsByUserId function for fetching owner settings on public pages
- Updated LocationViewPage to fetch and pass userSettings to ViewLocationCard

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-22 15:47:07 +01:00
Knee Cola
ec39eda51f Add tenantStreet and tenantTown fields to LocationEditForm
- Added tenantStreet and tenantTown optional fields to BillingLocation interface
- Updated LocationEditForm to include new input fields with 27 character max length
- Both fields are mandatory when 2D code generation is enabled
- Updated all database operations (insert and update) to persist new fields
- Added Croatian and English translations for labels and validation messages
- Updated form state tracking to include new tenant address fields

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-22 15:33:00 +01:00
Knee Cola
3cf880a661 Add town and currency fields to user settings
Adds two new fields to user settings form:
- Town field: Text input for city/town (required when 2D code enabled)
- Currency field: Select dropdown with ISO 4217 currency codes (EUR default)

Updates:
- Database schema: Added town and currency fields to UserSettings
- Validation: Both fields required when 2D code is enabled
- Form UI: Added input fields with proper validation and error handling
- Translations: Added Croatian and English labels and error messages
- Currency options: 36 ISO 4217 codes with EUR at top as default

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-22 15:14:19 +01:00
Knee Cola
795d9c690b Rename address field to street and change to text input
Changes the user settings address field to street with the following updates:
- Renames database field from 'address' to 'street' in UserSettings type
- Changes form input from textarea to single-line text input
- Updates validation logic and error messages
- Updates translations in both Croatian and English
- Removes deprecated AppSettingsForm component

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-22 15:00:12 +01:00
Knee Cola
701b9b5d58 Refactor Pdf417Barcode to accept payment params as props
Changes Pdf417Barcode component from using hardcoded payment data to
accepting paymentParams as a prop, making it reusable. Updates useEffect
dependency array to regenerate barcode when payment params change.

Also updates hub-3a-payment-encoder to v1.1.0 for PaymentParams type support.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-22 14:47:25 +01:00
Knee Cola
38a1e9d1b8 Add localized payment information labels
Replaces hardcoded Croatian text in ViewLocationCard with i18n translations.
Adds payment information labels (amount, recipient, IBAN, etc.) to both
Croatian and English language files for proper internationalization support.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-22 14:46:35 +01:00
Knee Cola
371333802a Add PDF417 barcode rendering component
Implements client-side PDF417 barcode rendering with React component.
Uses useEffect to prevent hydration mismatch by generating barcodes
only after component mount. Integrates barcode display in location cards.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-22 14:22:57 +01:00
Knee Cola
fe980723c0 Add custom PDF417 barcode generation library
Implements PDF417 2D barcode encoder with bcmath utilities and lookup tables.
Ported from TCPDF library to TypeScript for client-side barcode generation.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-22 14:22:02 +01:00
Knee Cola
d1436a9783 Remove pdf417 npm dependency
Removing the external pdf417 package in favor of custom implementation.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-22 14:18:35 +01:00
Knee Cola
547692f0a2 Add pdf417 dependency to package.json and package-lock.json 2025-11-22 07:23:09 +01:00
Knee Cola
969baf35ae Add project name to package-lock.json 2025-11-22 07:20:29 +01:00
Knee Cola
c72fd78750 Add hub-3a-payment-encoder dependency to package.json and package-lock.json 2025-11-22 07:17:05 +01:00
Knee Cola
8fe6c2e065 Merge branch 'release/1.65.0' 2025-11-20 18:55:02 +01:00
Knee Cola
689f81c65e Merge branch 'release/1.65.0' into develop 2025-11-20 18:55:02 +01:00
Knee Cola
221f588b71 1.65.0 2025-11-20 18:54:51 +01:00
Knee Cola
53b160fa38 Set production environment variables for NODE_ENV and USE_MOCK_AUTH 2025-11-20 18:54:17 +01:00
Knee Cola
a77ef47176 Merge branch 'feature/tenant-info-form' into develop 2025-11-20 18:52:24 +01:00
Knee Cola
cbd13cbae3 Add seenByTenant tracking feature
- Add seenByTenant field to BillingLocation interface
- Implement setSeenByTenant function to mark locations as viewed by tenant
  - Checks if flag is already set to avoid unnecessary DB updates
  - Includes TypeDoc documentation
- Update LocationViewPage to call setSeenByTenant when non-owner visits
- Add seenByTenant to fetchAllLocations projection
- Update LocationCard to show "seen by tenant" status indicator
  - Displays in "Monthly statement" fieldset with checkmark icon
  - Shows alongside monthly expense total
- Add localization strings for monthly statement and seen status

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-18 23:51:23 +01:00
Knee Cola
3540ef596b Enforce integer-only values for rent amount field
- Add .int() validation to rentAmount in FormSchema
- Remove decimal formatting (was dividing by 100)
- Change min value from 0 to 1
- Add right text alignment for better numeric display
- Add localization for integer validation error message

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-18 23:06:42 +01:00
Knee Cola
1c25917093 (fix) redirect home was not correct 2025-11-18 22:59:43 +01:00
Knee Cola
bfa9afdb45 Add rent amount field to location form
- Add rentAmount field to BillingLocation interface (stored in cents)
- Implement Zod validation with conditional requirement when rent notification is enabled
- Add rent amount input field to LocationEditForm with decimal display
- Update all database operations to persist rentAmount
- Add localization strings for both English and Croatian
- Fix missing notes field in insertOne/insertMany operations

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-18 13:06:29 +01:00
Knee Cola
be5d5074fe Refactor: renamed AccountForm to UserSettingsForm and update related actions and translations 2025-11-18 12:52:43 +01:00
Knee Cola
b03f0574cd Refactor: rename account-form to settings-form and update translations 2025-11-18 12:33:24 +01:00
Knee Cola
6b5fb6c44d Add additional notes to AccountForm for 2D code functionality 2025-11-18 12:28:06 +01:00
Knee Cola
9e3d49c74f Refactor AccountForm with 2D code toggle and conditional validation
- 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>
2025-11-18 12:24:11 +01:00
Knee Cola
5d1b7fd6b4 refactor(LocationEditForm): replace divs with fieldsets for better semantic structure 2025-11-18 12:01:04 +01:00
Knee Cola
92b2b74b66 (refactor): locationNotes removed 2025-11-18 11:55:42 +01:00
Knee Cola
6a4c869fa3 (refactor) LocationEditForm: update scope wrapped in fieldset 2025-11-18 11:50:44 +01:00
Knee Cola
63096be133 Add automatic rent notification feature to LocationEditForm
- 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>
2025-11-18 11:29:57 +01:00
Knee Cola
e9ae2b1189 Refactor UI components and convert controls to select elements
- 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>
2025-11-18 11:16:16 +01:00
Knee Cola
f4e82b7314 Implement bill forwarding strategy with radio button persistence
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>
2025-11-18 10:10:18 +01:00
Knee Cola
c5fe184f9c Rename autoTenantNotification to autoBillFwd and update related references in forms and translations 2025-11-18 09:38:04 +01:00
Knee Cola
3411ee3cb5 Update tenant code generation and notification labels in location edit form 2025-11-18 09:34:35 +01:00
Knee Cola
67706c575d Add email validation to tenant email field
Added conditional required validation and format validation for tenant email.

Changes:
- Tenant email is now required when autoTenantNotification is enabled
- Added email format validation using Zod's built-in email validator
- Email field validates format even when autoTenantNotification is off (if not empty)
- Added localization strings for validation errors (Croatian/English)

Validation logic:
- Format validation: Always checks if email is valid format (when not empty)
- Required validation: Email required when autoTenantNotification is true
- Error messages: "email address is invalid" for format, "tenant email is missing" for required

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-18 09:31:24 +01:00