Commit Graph

270 Commits

Author SHA1 Message Date
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
29e0fe5334 refactor: remove unnecessary print container padding for improved layout 2025-09-14 21:56:56 +02:00
9a02124e18 feat: implement US-4 - complete print optimization with CSS media queries
- 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>
2025-09-14 21:44:04 +02:00
b205a61cf9 feat: implement US-3 - enhance print layout with professional table design
- 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>
2025-09-14 21:16:33 +02:00
493c2f62fa feat: implement US-2 - create print route with barcode data fetching
- 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>
2025-09-14 19:57:13 +02:00
ecea10e805 feat: implement US-1 - add print button to MonthCard with i18n support
- 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>
2025-09-14 09:08:40 +02:00
e84188baf2 feat: add unauthenticated /share/attachment/[id] route for shared bill attachments
- 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>
2025-09-08 13:57:53 +02:00
6c7a315966 fix: prevent empty file from overwriting existing bill attachments
Improve file attachment handling by:
- Adding fileSize === 0 check to prevent empty files from being processed
- Simplifying attachment logic by moving size validation to serializeAttachment function
- Ensuring null is returned for empty/invalid files to preserve existing attachments

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-29 22:32:07 +02:00
8b845261d2 fix: prevent empty file from overwriting existing bill attachments
Fix updateOrAddBill to check file size before processing attachment,
preventing empty blob files from overwriting existing attachments
when updating bill properties.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-29 22:12:23 +02:00
daa9b2a134 locationAction: query optimization 2025-08-11 13:58:57 +02:00
fade52a49f billActions: projection optimization 2025-08-11 13:57:36 +02:00
aab0afd045 locationAction: fixed optional form fields 2025-08-11 13:57:07 +02:00
21da2f0d49 optimization: projecting only what's needed 2025-08-11 13:38:59 +02:00
d42a7da75b fixed typescript error 2025-08-11 12:49:10 +02:00
44cdcf8cec optimized queries 2025-08-11 12:19:29 +02:00
3ce158825e add bulk bill deletion across subsequent months
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>
2025-08-11 12:11:10 +02:00
71895229ec add bulk bill creation across subsequent months
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>
2025-08-11 12:01:18 +02:00
6d6a8782ab optimize database queries by excluding bills field
- Added projections to exclude bills field from location lookup queries
- Optimized updateOrAddLocation currentLocation query (line 79)
- Optimized duplicate check query for subsequent months (line 201)
- Optimized deleteLocationById location lookup query (line 372)
- Reduces network traffic and memory usage by avoiding unnecessary bills data
- Improves query performance especially for locations with many bills or large attachments

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-11 11:50:47 +02:00
a6d0cc77ac add update scope options for location editing
- 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>
2025-08-11 11:42:48 +02:00
80e30deace add conditional warning for destructive delete operation
- 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>
2025-08-11 11:24:09 +02:00
131dfe793b improve LocationDeleteForm toggle layout
- 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>
2025-08-11 11:05:37 +02:00
1eac116a55 add option to delete location in all subsequent months
- 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>
2025-08-11 11:01:16 +02:00
2cf338c50a improve development authentication setup
- Replaced manual code commenting with environment variable controlled mock auth
- Added development env vars to VS Code launch.json for automatic mock authentication
- Removed unused LinkedIn provider import
- Authentication now automatically uses mock session when launched via VS Code debug
- Zero security impact on production (env vars only exist during debug sessions)

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-11 10:47:55 +02:00
78a6c18ba5 add option to create location in all subsequent months
- 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>
2025-08-11 10:27:31 +02:00
eef93528e3 set current year as default active year
Changes default year from first available year in database to current year (Date.now) when no year parameter is provided in URL.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-11 10:10:45 +02:00
491b11e86d fixing types 2025-07-23 13:40:14 +02:00
36f2f74e64 implemented scanning PDF docs for multiple 2D codes 2025-07-23 13:12:13 +02:00
87d6928a97 BugFix: fixing types 2025-01-13 16:32:38 +01:00
103e371d5f mongo projekcija proširena property-em "hasAttachment" 2025-01-13 16:05:15 +01:00
492750df92 komentiranje debug koda 2024-12-14 09:59:47 +01:00
86b6c777c4 opzimizacija: stranica za prikaz godine je dohvaćala i QR kodove = slow 2024-12-14 09:56:50 +01:00
4a7f899103 za potrebe testiranja podešen konkretan userID 2024-12-14 09:56:14 +01:00
9c9ddc28c1 povećavanje UI elemenata na view ekranu 2024-12-14 09:12:03 +01:00
40e421a32a podešen styling ikone 2024-12-14 09:04:15 +01:00
74a9229ffa link ikona zamijenjena sa share ikonom 2024-12-14 09:01:09 +01:00
4ab61f9917 implementiran share by link 2024-12-13 17:50:12 +01:00
439de9d305 implementirano kopiranje linka 2024-12-13 15:38:48 +01:00
3799baa712 BugFix: attachment route moved under [locale] 2024-03-12 09:05:43 +01:00
dc5e25639c changed default language to croatian 2024-03-07 13:20:49 +01:00
a4b687d1f7 implemented webview detection & warning 2024-03-07 13:19:19 +01:00
78f8d1e1c3 BugFix: barcodes were not reset while copying to another month 2024-02-29 08:55:38 +01:00
c4a621e503 disabled linkedin provider 2024-02-19 12:49:51 +01:00
160c4f00f5 BugFix: delete button did not use locale path prefix 2024-02-19 10:21:25 +01:00
dead2e1200 adding location set to available in every month 2024-02-19 10:19:11 +01:00
7197d1de5f fix: LinkedinProvider config was incorrect 2024-02-19 09:42:44 +01:00
b66d911e11 fixed SingInButton spacing 2024-02-19 09:32:38 +01:00
3ec395dfd3 updated version in compose file 2024-02-19 09:14:29 +01:00
89eb50b61a supported login via linkedin 2024-02-19 09:11:59 +01:00