64 Commits

Author SHA1 Message Date
Chris
0868fe328f
Hotfix/dashboard active card calc update (#85)
* Hotfixes for v1.0.10

* apply service worker auto cache bust hot fix

* reverting preload
2025-06-12 17:56:31 -07:00
abite
08b8d771a2
Add quantity field (#74)
* Added Quantity Field

 Completed Changes
1. HTML Forms
Added quantity input fields to both asset and sub-asset forms
Fields default to value="1" with min="1" validation
Positioned after price fields for logical flow
2. Modal Manager (Frontend)
Updated form data collection to capture quantity values
Added quantity to form population for editing existing assets
Ensures quantity defaults to 1 if not provided
3. Asset Details Display
Added quantity field to asset info display in assetRenderer.js
Shows "Quantity: X" in the asset details section
Includes fallback to 1 for backwards compatibility
4. Server-side Backwards Compatibility
Asset Creation: Ensures quantity defaults to 1 if not provided
Asset Updates: Preserves existing quantity or defaults to 1
Sub-asset Creation: Ensures quantity defaults to 1 if not provided
Sub-asset Updates: Preserves existing quantity or defaults to 1
Data Loading: All assets and sub-assets get quantity field when loaded from API
5. Import Functionality
Added quantity column mapping option in import modal
Updated server-side import logic to handle quantity with default of 1
Updated template CSV download to include quantity example
Added auto-mapping for "quantity" and "qty" column headers
🔒 Backwards Compatibility
The implementation ensures that:
Existing assets without quantity will automatically show quantity: 1
All API endpoints handle missing quantity gracefully
Import functionality works with or without quantity columns
No data migration is required - compatibility is handled at runtime

* Add "Total Value" to asset details

 Total Value Field Features
Conditional Display
Only shows when quantity > 1
Only shows when there's a valid price (either price or purchasePrice)
Calculation
Calculates: price × quantity = total value
Uses the same currency formatting as other price fields
Handles both asset.price and asset.purchasePrice (for backwards compatibility)

* Updated Dashboard Value Calculation logic

Updated Calculation Logic to account for quantity
Assets:
price × quantity for each asset
Defaults to quantity = 1 for backwards compatibility
Sub-Assets:
purchasePrice × quantity for each sub-asset
Defaults to quantity = 1 for backwards compatibility
2025-06-12 04:51:52 -05:00
abite
52f3be257f
feat: add multi-currency support via environment variables (#66)
- Add CURRENCY_CODE and CURRENCY_LOCALE environment variables in server.js
- Inject currency configuration into frontend via dynamic config.js endpoint
- Update formatCurrency() function to use global app config for dynamic currency formatting
- Support any ISO 4217 currency code with proper locale-specific formatting
- Add comprehensive currency configuration documentation (CURRENCY_CONFIG.md)
- Update README.md with currency environment variables and collapsible configuration guide
- Include Docker/Docker Compose configuration examples for currency settings
- Maintain backward compatibility with USD/en-US defaults

Supported currencies include USD, EUR, GBP, CAD, AUD, JPY, and any valid ISO 4217 code.
Currency formatting respects locale-specific conventions (e.g., €1.234,56 for de-DE).

add docs folder

Stringify currency object and update docs

Adding responsive card values to wrap large values
2025-06-09 00:53:40 -04:00
abite
50038eed6f
Added Multi-file uploads (#65)
* Added Multi-file uploads

Allows users to upload multiple files for each file type.

Reworked cascading deletion logic to ensure Deleting an asset deletes all attachments as well as sub and sub sub assets and applicable attachments.

* Added file names as file-label

change file label to be file name, limited to 15 characters then cuts off.

* Fix removed features

Fixed Issues:
1. Asset Update Endpoint (PUT /api/assets/:id)
 Added name validation: Now validates that updatedAssetData.name exists before proceeding
 Added edit notification logic: Checks notificationSettings.notifyEdit and sends notifications when assets are edited
 Added debug logging: Logs asset update events when DEBUG mode is enabled
2. Sub-asset Update Endpoint (PUT /api/subassets/:id)
 Added name validation: Now validates that updatedSubAssetData.name exists before proceeding
 Added edit notification logic: Checks notificationSettings.notifyEdit and sends notifications when sub-assets are edited
 Added debug logging: Logs sub-asset update events when DEBUG mode is enabled
3. Asset Delete Endpoint (DELETE /api/asset/:id)
 Added delete notification logic: Checks notificationSettings.notifyDelete and sends notifications when assets are deleted
 Added debug logging: Logs notification attempts when DEBUG mode is enabled
4. Sub-asset Delete Endpoint (DELETE /api/subasset/:id)
 Added delete notification logic: Checks notificationSettings.notifyDelete and sends notifications when sub-assets are deleted
 Added debug logging: Logs notification attempts when DEBUG mode is enabled

Key Features Restored:
Data Integrity: Name field validation prevents saving assets/sub-assets without names
Notification System: Complete notification support for edit and delete operations
Consistent API: All endpoints now follow the same pattern as the create endpoints
Error Handling: Proper error handling for notification failures (won't break the main operation)
Debug Support: Comprehensive logging for troubleshooting when DEBUG=TRUE

* Reworked file label and preview grid formatting

* Fix file duplication on drag and drop

There are two separate drag and drop implementations that both trigger when files are dropped:
First implementation: In setupFileInputPreview() (lines ~105-140) - this sets up drag and drop for each individual upload box
Second implementation: In setupDragAndDrop() (lines ~300-389) - this also sets up drag and drop for all upload boxes
Both functions are being called, and they're both adding event listeners to the same elements, causing files to be processed twice. The fix is to remove the duplicate drag and drop code from setupFileInputPreview() since setupDragAndDrop() handles it more comprehensively.

* Fix file duplication on second drag & drop

The Solution:
Added file tracking: Each setupFileInputPreview() function now maintains a processedFiles Set that tracks which files have already been processed using a unique identifier.
Unique file identification: Each file is identified by ${file.name}-${file.size}-${file.lastModified}, which creates a unique fingerprint for each file.
Skip already processed files: Before creating a preview, the handler checks if the file has already been processed and skips it if so.
Clean up on deletion: When a file is deleted, its ID is removed from the processedFiles Set so it can be re-added later if needed.

* feat: completely rework file upload system to prevent duplicates and fix state issues

- Add comprehensive file state tracking with allFiles, newFilesSet, and filePreviewMap
- Implement additive file selection behavior for both drag-and-drop and file input
- Add deduplication logic to prevent duplicate files across multiple selections
- Create distinction between new files (for upload) vs existing files (preview only)
- Add reset() functionality to prevent state contamination between modal operations
- Fix existing file preview display by using server paths instead of mock File objects
- Fix individual file deletion by integrating with filesToDelete system using deletion markers
- Update handleFileUploads to only upload truly new files, preventing re-upload of existing files
- Add setupExistingFilePreview() for proper existing file integration with new helpers
- Update modal manager to use new helper functions and proper state clearing
- Add robust error handling and backward compatibility fallbacks

Fixes:
- File duplication when editing existing assets
- Missing image previews for existing files in edit modal
- Broken individual file deletions
- State persistence contamination between different asset operations
- Inconsistent behavior between drag-and-drop and file input selection

The file upload system now properly handles all edge cases while maintaining
a clean, predictable state across different operations.

* Add logic for import file drag and drop and restricting to single file

remove single attribute

adding self reference to eventlisteners for drag and drop

simplifying resetfileupload per file input

---------

Co-authored-by: gitmotion <43588713+gitmotion@users.noreply.github.com>
2025-06-08 15:20:55 -07:00
gitmotion
e6009d52c2 Add fix to file deletion on edit of assets and subassets
remove double confirmation on delete of manual from file uploader
2025-06-03 17:21:03 -07:00
gitmotion
5f4551c7e1 Add filename sanitization on upload on front and backend 2025-05-30 18:37:10 -07:00
gitmotion
0a45fdd855 Demo Mode: add demo_mode middleware, global error logger with auto toast, demo banner
Add demo mode banner

fix spacing

Added Demo_mode env vars and update refreshAllData responses error handling

update usage of await response.text()

Update demo mode error message
2025-05-30 14:39:18 -07:00
gitmotion
b56a9d8156 Fix clearfilterbtn overload, optimize settings to cache fetched settings to localStorage, ignore data folder in development 2025-05-29 17:28:57 -07:00
gitmotion
ba4066fd9a Fix: Add logic to delete asset files and all associated files server side
Fix save subasset child modal and delete approriate files for those subassets and subassetchildren

Refactor and simply delete and update logic for assets and subassets

update import for url example

add resetImportForm to window from importmanager instead of script.js

update subasset file attachment expand/collapse to before showing the modal

match accepted file types from frontend to backend  for manuals

update deleteAssetFileAsync with early return and to work with starting "/" or without
2025-05-29 00:34:22 -07:00
gitmotion
944cc00ff4 Refactor settings for stability and consistency
initialize settings with default and copy over settings to always make sure all properties are included

remove unused async from createWarrantyDashboard function
2025-05-28 13:35:42 -07:00
gitmotion
e2a1769252 Fix dashboard order sync 2025-05-27 23:44:08 -07:00
abite
6a7e8c993c
merge commit into dev from fix-file-deletion-on-asset-deletion
Removes all associated files when asset or sub asset is deleted.
2025-05-27 21:38:00 -05:00
abite
c6c2f4198c
Revert "Delete all associated files with asset deletion" 2025-05-27 21:27:35 -05:00
abite
c5a6d836bc
Merge pull request #15 from DumbWareio/fix-file-deletion-on-asset-deletion
Delete all associated files with asset deletion
2025-05-27 22:20:55 -04:00
abite
713cad3aa5 Delete all associated files with asset deletion
New Helper Function: deleteAssetFiles(asset)
Handles all file formats:
Legacy single files: photoPath, receiptPath, manualPath
Multiple file arrays: photoPaths[], receiptPaths[], manualPaths[]
File info arrays: photoInfo[], receiptInfo[], manualInfo[]
Robust error handling: Continues deletion even if individual files fail
Comprehensive logging: Debug information tracks all file operations
Path normalization: Handles different path formats safely
2025-05-27 21:17:16 -05:00
abite
8b5788f3b0 add lifetime column to import mapping
Summary of Changes
I've successfully added a "Lifetime" column to the import modal that maps to the isLifetime property in the asset warranty object. Here's what was implemented:
1. Frontend Changes (HTML)
Added a new "Lifetime" column mapping row in the import modal (public/index.html)
Positioned it logically after "Warranty Expiration" and before "2nd Warranty Scope"
2. Frontend Changes (JavaScript)
public/managers/import.js:
Added lifetimeColumn to the column selection dropdowns
Added lifetime to the mappings object for form data collection
Added auto-mapping rules for common lifetime column names: ["lifetime", "lifetime warranty", "is lifetime", "islifetime", "permanent"]
Updated the CSV template to include the "Lifetime" column
Added sample data generation for the lifetime column (defaults to false)
Added lifetimeColumn to the reset form function
3. Backend Changes (Server)
server.js:
Added parsing logic for the lifetime column that accepts multiple formats:
true, 1, yes (case-insensitive) → true
Everything else → false
When isLifetime is true, the warranty expiration date is automatically set to null
The isLifetime property is properly set in the warranty object

Key Features
Flexible Input: Accepts true/false, 1/0, yes/no (case-insensitive)
Auto-mapping: Automatically detects common column names for lifetime warranties
Template Generation: Downloads include the Lifetime column with sample data
Data Validation: Properly handles the boolean conversion and warranty logic
2025-05-27 21:05:16 -05:00
abite
2d8cd60d95 Add notifications for sub and sub sub assets
edit/add/delete notifications were not available for sub assets.
2025-05-25 22:08:41 -05:00
abite
367954a9fc Fix auth flow when accessing link with query param 2025-05-25 21:58:19 -05:00
abite
27e85ce829 Add Query Params for links in notifications
Introduce query params so notifications include URLs with direct links to assets
2025-05-25 21:53:36 -05:00
abiteman
30b94ba1dd implemented a notification queue system
implemented a notification queue system that adds a 5-second delay between notifications when multiple notifications are sent at the same time.
2025-05-24 23:00:33 -04:00
abiteman
2ed5ba995b maintenance rework 2025-05-24 22:30:45 -04:00
gitmotion
f4d7f848f0 Revert "Add DEMO_MODE: saves all data to local storage with endpoint protection on post,put,delete when in demomode"
This reverts commit c7efe5ead93f9784e465b4722ab55ef87276f380.
2025-05-24 19:13:52 -07:00
gitmotion
c7efe5ead9 Add DEMO_MODE: saves all data to local storage with endpoint protection on post,put,delete when in demomode 2025-05-23 18:14:34 -07:00
gitmotion
cba02be4f2 Map maintenance notifictions in apprise notifier and update test notifications to include notification type in title
- add docker-compose.yml
2025-05-22 16:33:36 -07:00
gitmotion
f8f61f64da Added Maintenance schedule notifications to settings, asset forms, and warranyCron and updated styles 2025-05-22 15:33:54 -07:00
gitmotion
ae03fd32d6 add card toggles to settings 2025-05-22 09:12:03 -07:00
gitmotion
786622ffba Import Form updates: add createdAt & updatedAt fields when import assets, add data validation to required and date fields on import, force remove file from upload on reset form, render the dashboard after a successful import 2025-05-22 03:46:20 -07:00
gitmotion
e1c8036db9 Update Import - updated styles changed to 2 column grid, added secondary warranty and tags columns, added download template, hide/clear column mappings on open/close 2025-05-22 03:22:29 -07:00
gitmotion
c1689cc8d1 Add dashboard view settings 2025-05-22 01:46:52 -07:00
gitmotion
e706d4dc63 add dashboard reordering logic and section to settings with drag and drop
update drag and drop styling and fix logic - (still need to fix duplicate placeholders

rename notificationBtn to settingsBtn
2025-05-21 22:55:10 -07:00
abite
812e5c2f03 reduce test notification delay to 2 seconds 2025-05-21 22:03:06 -05:00
abite
18febc2351 Implement active notifications tests 2025-05-21 21:51:18 -05:00
gitmotion
5266503d85 refactor notifications settings to generic settings, added interface pane, show/hide test button based on notification pane 2025-05-21 10:37:03 -07:00
gitmotion
76b0bd0b0f asset rendering navigation (may need to revisit) 2025-05-20 15:34:42 -07:00
gitmotion
5bbbc38e83 Add filename and filesize properties to file attachments/uploads 2025-05-20 12:11:15 -07:00
gitmotion
08ac690d63 Adding charts with chart.js (first iteration) 2025-05-20 10:04:10 -07:00
abite
69ea533518 Added "Manufacturer" to asset info and modals 2025-05-19 21:43:42 -05:00
abite
8b9a3cfaec Enhance Asset Deletion Message
Updated the formatNotification function in appriseNotifier.js to:
Include detailed asset information specifically for deletion events
Format each field with a clear label
Handle warranty information with both scope and expiration date
Keep the original format for other notification types
Updated the server code to pass all the required asset information when sending the deletion notification:
Asset Name
Model Number
Serial Number
Purchase Date
Price
Warranty information (scope and expiration date)
2025-05-18 22:01:52 -05:00
gitmotion
35015e8e06 update service worker cache version to pull from package.json version 2025-05-18 16:31:18 -07:00
gitmotion
b50483ff27 authMiddleware fix to verify pin or session per request 2025-05-13 17:06:10 -07:00
abite
4e48124581 Fix Filepaths
Server-Side Static File Serving: Added Express routes to serve uploaded files from the data directories:
Client-Side File Path Handling: Added a helper function to format file paths:
Updated Asset Rendering: Modified the asset rendering logic to use the new formatFilePath function for all image and file paths.
2025-05-12 21:26:12 -05:00
gitmotion
49f93f29d8 Add PWA, cache busting, cors
updated security and relying on cors for now

clean up header actions buttons

Updated helmet config, responsive styling, icons fixes, and reordering

update header title to left side and actions on right

Unify modal styling

fix login styling

adding paths for saving/editing to public paths for now to restore functionality. we should refactor this to pass pin/session for any request

Bump cache version

remove post install script

Update PIN logic for firefox compatibility and securely handle redirects

Unify add component section/modal

Unifying file uploaders, modal title styles, add collapsible sections for file uploaders
2025-05-11 11:41:18 -07:00
abiteman
d94bc7f95a Modularization and more. 2025-05-05 22:32:59 -04:00
abiteman
ae47572204 updated UI, fixed hover states, added Manual Imports 2025-05-02 21:42:52 -05:00
abiteman
719647c608 Fix Date Parsing on Import 2025-05-01 22:40:03 -05:00
abiteman
2345efe7ab SITE_TITLE 2025-04-29 14:05:01 -05:00
abiteman
3820b68140 update ReadMe 2025-04-29 13:38:35 -05:00
abiteman
92ce1af85d Add debug logging 2025-04-29 12:53:33 -05:00
abiteman
ed1d6b0be5 fix notifications 2025-04-29 12:46:52 -05:00
abiteman
65b8d93982 Include Apprise and modify notifications 2025-04-29 12:31:34 -05:00