Commit Graph

168 Commits

Author SHA1 Message Date
Knee Cola
1cf1806955 feat: add share link generation and validation functions
- Add generateShareLink() for owners to create share URLs with checksums
- Add validateShareAccess() to validate checksum and TTL on tenant visits
- Implement automatic TTL reset (10 days → 1 hour after first visit)
- Include automatic cleanup of expired shares

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-08 00:15:30 +01:00
Knee Cola
a6ab35a959 feat: add core security utilities for checksum-based share links
- Add HMAC-SHA256 checksum generation and validation (shareChecksum.ts)
- Add PDF magic bytes validation to prevent file spoofing (pdfValidator.ts)
- Add IP-based rate limiting for upload abuse prevention (uploadRateLimiter.ts)
- Update BillingLocation interface with shareTTL and shareFirstVisitedAt fields
- Add environment variables for share link security and TTL configuration

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-08 00:14:20 +01:00
Knee Cola
0f8b5678f4 Fix client-side cache staleness after proof of payment upload
Added cache revalidation to ensure ViewLocationCard reflects uploaded
proof of payment when navigating back from ViewBillCard:

- Server-side: Added revalidatePath() to upload actions in billActions
  and locationActions to invalidate Next.js server cache
- Client-side: Added router.refresh() calls in ViewBillCard and
  ViewLocationCard to refresh client router cache after successful upload

This maintains the current UX (no redirect on upload) while ensuring
fresh data is displayed on navigation.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-07 16:57:00 +01:00
Knee Cola
b3e4e3591c (refactor) locationAction: optimizing query not to return binary data 2025-12-07 16:05:42 +01:00
Knee Cola
47bea328e7 (bugfix) billAction: file type validation was failing if not file was attached 2025-12-07 16:05:10 +01:00
Knee Cola
534955a9fa Fix MongoDB projection error in uploadProofOfPayment
Fixed mixed inclusion/exclusion projection that caused error:
"Cannot do inclusion on field bills.proofOfPayment.uploadedAt in exclusion projection"

Changed projection to use exclusion-only:
- Exclude bills.attachment (not needed in upload context)
- Exclude bills.proofOfPayment.fileContentsBase64 (large file data)
- Include all other fields implicitly (including uploadedAt for existence check)

This reduces data transfer while maintaining MongoDB projection compatibility.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-07 13:38:48 +01:00
Knee Cola
6a86ebd747 Fix per-bill proof of payment field name and add environment config
- Updated uploadProofOfPayment to expect 'proofOfPayment' field name
  instead of 'utilBillsProofOfPayment' for semantic clarity
- Removed old not-found.tsx from deprecated route structure
- Added required environment variables for file upload validation:
  - MAX_BILL_ATTACHMENT_UPLOAD_SIZE_KB=1024
  - MAX_PROOF_OF_PAYMENT_UPLOAD_SIZE_KB=1024
- Updated package-lock.json with peer dependency metadata

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-07 13:16:37 +01:00
Knee Cola
aa573c68a3 Implement per-bill proof of payment and update field names
Frontend changes:
- Added ViewBillCard proof of payment upload for per-bill mode
  - Conditional rendering based on proofOfPaymentType
  - File upload with PDF validation and loading states
  - Download link to /share/proof-of-payment/per-bill/
- Updated LocationCard to use new utilBillsProofOfPayment field structure

Backend changes:
- Updated locationActions with improved file validation
  - File size validation using MAX_PROOF_OF_PAYMENT_UPLOAD_SIZE_KB
  - PDF type validation before database operations
  - Enhanced serializeAttachment with FileAttachment type
  - Updated database projections for optimized queries
- Updated monthActions to use consolidated field name
- Updated proof-of-payment download route with new field names

Data structure migration:
- Replaced utilBillsProofOfPaymentAttachment + utilBillsProofOfPaymentUploadedAt
  with single utilBillsProofOfPayment object containing uploadedAt
- Consistent use of FileAttachment type across all upload functions

Translations:
- Added upload-proof-of-payment-legend and upload-proof-of-payment-label
  to bill-edit-form section in both English and Croatian

This completes the proof of payment feature implementation for both
combined (location-level) and per-bill modes.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-07 13:11:17 +01:00
Knee Cola
0facc9c257 Add uploadProofOfPayment and improve file validation
- Implemented uploadProofOfPayment function for per-bill proof of payment
  - Validates file size using MAX_PROOF_OF_PAYMENT_UPLOAD_SIZE_KB env variable
  - Validates PDF file type
  - Prevents duplicate uploads with existence check
  - Uses optimized database projection to minimize data transfer
  - Updates specific bill using MongoDB array filters

- Refactored file validation in updateOrAddBill
  - Moved validation before serialization for fail-fast behavior
  - Added configurable file size limit from environment variable
  - Added PDF type validation
  - Improved error messages with specific validation failures

- Updated serializeAttachment function
  - Changed return type from BillAttachment to FileAttachment
  - Added uploadedAt timestamp to attachment object
  - Removed unsafe type cast

- Code formatting improvements throughout
  - Consistent spacing and indentation
  - Better TypeScript typing

This completes the per-bill proof of payment feature implementation.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-07 12:24:52 +01:00
Knee Cola
1c7edabcbe Refactor types to support per-bill proof of payment
- Renamed BillAttachment to FileAttachment for better generalization
- Added uploadedAt field to FileAttachment (consolidates timestamp)
- Renamed utilBillsProofOfPaymentAttachment to utilBillsProofOfPayment
- Removed separate utilBillsProofOfPaymentUploadedAt field (now in FileAttachment)
- Added rentProofOfPayment field to BillingLocation for rent-specific proof
- Added proofOfPayment field to Bill interface for per-bill attachments
- Removed unused imports (ObjectId, inter)

This refactoring enables both "combined" (location-level) and "per-bill"
proof of payment attachment strategies.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-07 11:30:23 +01:00
Knee Cola
dd4c92be77 Add "none" option for proof of payment type
Enhanced the proof of payment attachment feature with the following improvements:

- Renamed field from `proofOfPaymentAttachmentType` to `proofOfPaymentType` for consistency
- Added "none" option allowing users to disable proof of payment attachments
- Changed default value from "combined" to "none" for better UX
- Repositioned section in form after payment instructions (more logical flow)
- Added conditional warning when "combined" is selected without payment method
- Updated translations with emojis and improved tooltips for all options
- Backend validation and database operations updated to support new field structure

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-07 11:19:51 +01:00
Knee Cola
2483b7bca5 locationEditForm: added proofOfPaymentAttachmentType 2025-12-07 01:29:48 +01:00
Knee Cola
eed92b5ac3 Replace seenByTenant boolean with seenByTenantAt timestamp field
Update location tracking to record when tenant views a location rather than just whether they've seen it. This provides better audit trail and enables future features like viewing history.

Changes:
- Convert seenByTenant (boolean) to seenByTenantAt (Date) in database schema
- Update setSeenByTenantAt action to store timestamp instead of boolean flag
- Modify LocationCard UI to display when location was seen by tenant
- Update all references across locationActions, monthActions, and view components
- Remove unused imports from ViewLocationCard

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-26 20:10:18 +01:00
Knee Cola
b9f73e9a90 Restructure application to use /home for authenticated pages
- Move authenticated home page from /[locale] to /[locale]/home
- Move login page from /[locale]/login to /[locale] (new landing page)
- Move all restricted pages (bill, location, year-month, print, account) under /[locale]/home
- Simplify middleware to protect all routes under /home instead of using publicPages array
- Update auth config: change signIn page from /login to /
- Update SignInButton callback URL to redirect to /home after login
- Update all internal links throughout the application to reflect new structure
- Update server action redirects in navigationActions.ts
- Public share routes (/share/*) remain unchanged

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-25 21:49:01 +01:00
Knee Cola
62d0cb81a7 Refactor account page structure and update UI
- Move user settings form to dedicated /account/settings route
- Update PageHeader icon from Settings to AccountCircle for clarity
- Update debug log labels in auth config for better readability

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-25 20:49:33 +01:00
Knee Cola
3bac2306f8 BugFix: after an dependency update the authentication no longer used proper ID for the user 2025-11-25 20:05:44 +01:00
Knee Cola
fc3ad168fa Add debug logging for JWT and session handling in authConfig 2025-11-25 19:50:55 +01:00
Knee Cola
718e8396e4 (fix) after bill edit redirect back to same year month 2025-11-24 22:51:59 +01:00
4e9e5ca8d2 feat: add validation for Revolut profile name format
- Add ownerRevolutProfileName field validation when enableRevolutPayment is true
- Validate profile name must start with '@' and contain only letters and numbers
- Add required field validation for Revolut profile name
- Add English and Croatian error messages for validation failures
- Update State type to include ownerRevolutProfileName errors

Validation regex: /^@[a-zA-Z0-9]+$/
Valid examples: @john123, @ivan, @user2024

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-24 15:39:37 +01:00
3e581d8878 refactor: replace generateTenantCode boolean with tenantPaymentMethod enum
- Replace generateTenantCode boolean field with tenantPaymentMethod enum ("none" | "iban" | "revolut")
- Update LocationEditForm to use dropdown select instead of toggle for payment method selection
- Consolidate multiple useState hooks into single formValues state object
- Change from defaultValue to controlled components with value/onChange pattern
- Add hidden inputs to preserve tenant data when payment method is not selected
- Update validation logic to check tenantPaymentMethod === "iban"
- Update ViewLocationCard to use new tenantPaymentMethod field
- Add Croatian translations for new dropdown options

This provides better scalability for adding future payment methods and improves form state management.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-24 15:34:59 +01:00
632f8888b5 refactor: replace payment dropdown with independent toggles
- Replace showPaymentInstructionsInMonthlyStatement dropdown with enableIbanPayment and enableRevolutPayment boolean toggles
- Update UserSettingsForm to use separate fieldsets for IBAN and Revolut with independent toggle switches
- Add hidden inputs to preserve values when toggles are disabled
- Update validation logic to check enableIbanPayment instead of show2dCodeInMonthlyStatement
- Reorganize translation keys to match new structure (iban-* and revolut-* prefixes)
- Update ViewLocationCard to use enableIbanPayment field

This provides better UX by allowing users to enable both payment methods simultaneously if needed.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-24 14:45:59 +01:00
686bec6c10 feat: add Revolut payment link support alongside IBAN
- Add NoteBox component for displaying warning messages with icon
- Add Revolut profile name field to user settings schema
- Update UserSettingsForm to support payment instruction selection (disabled/IBAN/Revolut)
- Add Croatian and English translations for new payment options
- Reserve fields for future per-instruction enable/disable functionality

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-24 13:37:54 +01:00
Knee Cola
fcecaaa901 (refactor) dbTypes: added utilBillsProofOfPaymentUploadedAt to BillingLocation 2025-11-23 22:13:09 +01:00
Knee Cola
7a01dad5e7 (refactor) locationActions: add timestamp for utility bills proof of payment upload 2025-11-23 21:58:04 +01:00
Knee Cola
3389bce755 (refactor) locationActions: preventing multiple proof of payment uploads 2025-11-23 21:56:18 +01:00
Knee Cola
fb3393c985 (bugfix) decoding hub3a from image did not work 2025-11-23 12:53:35 +01:00
Knee Cola
1995ad9de9 optimizing DB projections 2025-11-23 11:59:06 +01:00
Knee Cola
9d53fb1753 chore: Upgrade pdfjs-dist from 4.0.379 to 4.10.38
Updated PDF.js library to version 4.10.38 for improved PDF rendering
and barcode scanning capabilities.

Changes:
- package.json: Updated pdfjs-dist dependency to ^4.10.38
- package-lock.json: Updated dependency tree
- public/pdf.worker.min.mjs: Updated PDF.js worker file
- app/lib/pdf/barcodeDecoder.ts: Removed unused import

This is a minor version update within v4, maintaining API compatibility
while receiving bug fixes and improvements.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-23 10:48:51 +01:00
Knee Cola
7a5c503ce9 Refactor: Complete barcodeImage removal and hub3aText migration
This commit completes the migration from storing bitmap barcodes to using
decoded HUB-3A text strings, removing all legacy code while maintaining
backward compatibility during the transition period.

Database & Server Actions:
- billActions: Removed commented legacy barcodeImage code
- locationActions: Updated field references in projections
- monthActions: Use hub3aText when copying bills to new months
- printActions: Support both hub3aText and barcodeImage during migration
  - Added @deprecated annotation to barcodeImage field
  - Filter includes bills with either field
  - Pass both fields to support gradual migration

Barcode Decoder:
- Removed barcodeImage field from DecodeResult type
- Deleted copyBarcodeImage() function (58 lines)
  - No longer generating bitmaps during decode
  - Barcodes now generated on-demand from hub3aText
- Cleaner separation: decoder extracts text, component renders barcode

UI Components:
- Pdf417Barcode: Added optional className prop for styling flexibility
  - Removed unnecessary wrapper div
  - Conditional styling (use className or default dimensions)
- PrintPreview: Use Pdf417Barcode component with fallback to legacy barcodeImage
- ViewBillCard: Major cleanup and migration support
  - Removed unused imports (React, updateOrAddBill, useLocale)
  - Removed unused middleware function
  - Removed unused variables and hidden input
  - Prefer hub3aText with Pdf417Barcode, fallback to barcodeImage
  - Clear legacy support comments

Migration Strategy:
All rendering code now follows the pattern:
1. Prefer hub3aText (new field) when available
2. Fallback to barcodeImage (legacy field) if needed
3. Clear comments marking legacy support code
4. Allows gradual migration without breaking existing bills

Benefits:
- More efficient storage (text vs base64 bitmap)
- Barcodes generated on-demand (not stored)
- Cleaner, more maintainable code
- Consistent use of Pdf417Barcode component
- Removed ~60 lines of unused code

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-23 09:03:53 +01:00
Knee Cola
89c06e2799 Refactor: Complete barcodeImage to hub3aText migration across codebase
Database & Types:
- Added hub3aText field to Bill interface in db-types.ts
- Marked barcodeImage as @deprecated legacy field

Server Actions:
- Updated billActions to read/write hub3aText instead of barcodeImage
- Commented out legacy barcodeImage code with migration notes

Barcode Decoder:
- Renamed image2canvas to file2canvas for clarity
- Added new image2canvas function for base64 encoded images (migration support)
- Added hub3aText to DecodeResult type
- Exported decodeFromImage function for legacy data migration
- Updated decoding logic to extract and return hub3aText

UI Components:
- Refactored Pdf417Barcode to accept hub3aText string instead of PaymentParams
- Removed EncodePayment call from Pdf417Barcode (now expects pre-encoded text)
- Updated ViewLocationCard to encode payment params before passing to Pdf417Barcode

This completes the refactoring from storing bitmap images to storing decoded
HUB-3A payment strings, providing more efficient storage and easier data manipulation.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-23 08:25:06 +01:00
Knee Cola
6df9557921 Add utility bills proof of payment file upload functionality
Changes:
- Updated BillingLocation interface:
  - Added utilBillsProofOfPaymentAttachment field (BillAttachment type)
- Added server action uploadUtilBillsProofOfPayment:
  - Validates PDF file type
  - Serializes file attachment to base64
  - Stores attachment in BillingLocation document
  - Returns success/error status
- Updated ViewLocationCard component:
  - Added file upload input with PDF-only accept
  - Implemented handleFileChange with immediate upload
  - Added upload state management (isUploading, uploadError, attachment)
  - Shows spinner while uploading
  - Input disabled during upload
  - Conditionally renders file input or download link
  - Link displayed after successful upload
- Created route handler for serving proof of payment PDFs:
  - GET /share/proof-of-payment/[id]/route.tsx
  - Fetches attachment from database
  - Converts base64 to binary
  - Returns PDF with proper headers
- Added not-found page for proof of payment route
- Updated middleware to include proof-of-payment in public pages
- Added translations:
  - en: "Upload proof of payment (PDF only)"
  - hr: "Priložite potvrdu o uplati:"

File uploads immediately on selection without page reload.
Only PDF files accepted with client and server-side validation.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-22 23:47:08 +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
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
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
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
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