A pallet sizing calculator with optimization algorithms for efficient freight packing.
You can try out the live demo here: Freight Pallet Calculator
These instructions will help you set up and run the project on your local machine.
To run this project locally, you will need a web browser. No additional software is required.
-
Clone the repository to your local machine:
git clone https://github.com/dhextras/freight-pallet-calc.git
-
Open the
index.html
file in your web browser.
This tool efficiently calculates the optimal size for freight pallets. It allows you to enter product dimensions and weights, and then it distributes these products across pallets, ensuring that weight and height constraints are met. The tool uses intelligent algorithms to optimize the arrangement of products to minimize wasted space on pallets.
For a detailed explanation of how the calculator works and how the code achieves this, please refer to the
allocateProducts
&addProductToPallet
Functions in the calculationLogic.js file. You will find explanations and references to specific parts of the code, making it easier to understand the logic.
Link to the Visualizer used above if you're intrested: File-Viz
- Manages button functionalities:
addProduct()
: Adds products to the listimportProducts()
: Imports data from Excel(as a placeholder)calculatePalletSize()
: Calculates pallet size based on Product data
- Contains pallet calculation logic:
allocateProducts()
: Loop through Products & Pallets to Allocate ProductaddProductToPallet()
: Add products to Pallet with minimizing waste space
- Sort Product Data:
sortProductData()
: Sorts product data to be used in the calculation
- Manages pallet operations:
initializePallet()
: Initializes pallet structureremoveProductsByIds()
: Removes products by IDs in the sortedProducts while calculation
- Deals with data generation and transformation:
generateWeightAndProducts()
: Generates weight and product data from the listgeneratePalletsDisplay()
: Creates nice looking display for pallets
- Manages UI-related updates:
updateListItemNumbers()
: Updates item numbers in the listupdateMinPalletMaxWeight()
: Updates minimum pallet weight limitupdateListItemDisplay()
: Updates list item display to make sure theres atleast one producttogglePalletMaxWeight()
: Toggles pallet maximum weight displayhandleInputErrors()
: Handles input validation errors
- Manages DOM interactions:
getById()
: Retrieves an element by its IDattachEventListeners()
: Attaches event listeners to various elements
If you'd like to contribute to this project, please follow these steps:
-
Open an Issue: If you've identified a bug or have a feature request, please open an issue first. Clearly describe the bug or the new feature you'd like to see. Use the provided templates for issues.
-
Create a New Branch: If you're addressing an issue, create a new branch named after the issue number:
git checkout -b issue-123
. -
Make Your Changes: Implement your bug fix or add the new feature.
-
Commit Your Changes: After making your changes, commit them with a clear and concise message:
git commit -m 'Fix issue-123'
. -
Push to the Branch: Push your changes to the branch you created:
git push origin issue-123
. -
Create a Pull Request: After pushing changes, create a pull request against the
main
branch. Reference the issue in your pull request description.
When working on an issue, use the issue number as the branch name. For example, if working on issue 123, the branch should be named
issue-123
.
Make sure to fill out the provided template when creating a pull request. It helps reviewers understand the changes and ensures that essential information is provided.
Thank you for contributing!
Thanks for using Freight Pallet Calculator!
- Moderator
- Contributors
Feel free to contact us if you have any questions or feedback.