feat: Add Modules tab with Bill of Materials#6
Merged
RemcoHalman merged 6 commits intomainfrom Dec 24, 2025
Merged
Conversation
- Created modules.js variable file with product number mappings for all EBP files - Added new "Modules" tab button to index.html - Implemented displayModules function in ui.js to show: - Unique modules list with product numbers, variant numbers, and unit type IDs - Bill of Materials with quantities for each module - Updated tab switching logic to handle modules tab - Modules tab displays metadata and provides two separate views for module management This enables users to view all available modules and generate a complete Bill of Materials from the loaded EBP file.
- Import MODULES array from modules.js in index.html - Pass MODULES to displayModules function for reference data - Update displayModules to show two sections: 1. "Available Modules" - all modules from modules.js database 2. "Bill of Materials" - actual items from loaded file with proper counting - Fix BOM aggregation to count by product number only (not variant/unitTypeId) - Now BOM properly aggregates quantities instead of showing separate entries This ensures the BOM displays accurate counts for each product and provides a complete reference list of all available modules.
- Updated module lookup to use standardUnitVariantNumber as the key - Enriches units with product numbers from modules.js based on variant number matching - BOM now aggregates by variant number (proper grouping) - Added "Unit Name" column to BOM for clarity - Product number now comes from modules.js lookup when variant matches How it works now: 1. Scan modules.js and create lookup map by variant number 2. For each unit in EBP file, lookup product number using variant number 3. BOM groups by variant number and shows matched product number 4. Displays: Quantity, Product Number (from modules.js), Variant Number, Unit Name, Unit Type ID
Changes: - Simplified Modules tab to only show Quantity and Product Number in BOM - Removed "Available Modules" section (was redundant) - Updated Units page to show "Product Number" instead of "Variant Number" - Enrich all units with product numbers from modules.js on file load - Product numbers are looked up by matching variant numbers in modules.js How it works: 1. When EBP file is loaded, units are enriched with product numbers 2. Units tab displays product numbers (from modules.js lookup) 3. Modules tab shows clean BOM with just Quantity and Product Number 4. All lookups are done by matching standardUnitVariantNumber
Critical fixes: 1. Units page now shows "Unknown" instead of unit name when no product match 2. Fixed Modules tab crash caused by undefined moduleInfo access 3. Added null checks throughout to prevent JavaScript errors The Modules tab was failing because line 471 tried to access moduleInfo.productNumber without checking if moduleInfo exists first. This caused a runtime error and prevented the tab from displaying. All fallback values now consistently use "Unknown" instead of unit.name.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This enables users to view all available modules and generate a complete
Bill of Materials from the loaded EBP file.