A web application designed to calculate the remaining buyout balance for rented musical instruments. Users input the initial purchase price, monthly payment amount, total months rented, deposit, and tax rate (based on the Canadian province). The app calculates the total credit applied and balance due, providing users with an estimate for purchasing the instrument.
- Province-specific Tax Calculation: Applies the correct tax rate based on the user's selected Canadian province.
- Detailed Buyout Calculation: Computes the balance owed before and after tax, taking rental payments and deposits into account.
- Responsive Design: The app is designed to be mobile-friendly and accessible.
- Clear Display of Results: Results are displayed in a structured table format for ease of review.
-
Clone the repository:
git clone https://github.com/DrCBeatz/aynm-rental-buyout-calculator.git cd aynm-rental-buyout-calculator
-
Install dependencies: Make sure you have Node.js installed. Then run:
npm install
-
Run the app locally (Optional): Use a simple HTTP server to serve index.html for testing. For example:
npx http-server src
This will serve the app on
http://localhost:8080
by default.
- Enter Purchase Information: Input the full purchase price (including the rental instrument and any added accessories), monthly payment amount (pre-tax), and number of months the item has been rented.
- Select Province: Choose the province to apply the correct tax rate.
- Submit: Click "Calculate" to view the buyout balance details.
The calculator will display:
- Rental Payment Credit: A portion of the rental payments that apply toward purchase.
- Deposit Credit: Deposit amount adjusted for tax.
- Total Credit Amount: Total pplied credit from rental payment and deposit.
- Balance Owing: Amount due before and after tax.
The project's organizion is as follows:
.
├── README.md
├── main.tf # Terraform configuration for cloud resources
├── package.json # Project and dependency metadata
├── src/
│ ├── images/
│ │ └── select-arrow.svg # Custom select dropdown arrow
│ ├── index.html # HTML structure for the app
│ ├── script.js # JavaScript for handling calculations
│ └── styles.css # Styling for the app
├── tests/
│ └── script.test.js # Unit tests for JavaScript functions
└── vitest.config.js # Configuration for Vitest testing framework
The app includes tests to validate the calculation logic. We use Vitest for unit testing.
To run tests:
npm test
This project cn be deployed on AWS with S3, CloudFront, and Route 53 using Terraform for automated setup.
- Configure AWS credentials in your environment
- Run Terrform to provision the S3 bucket and CloudFront distribution:
terraform init terraform apply
- Upload the contents of the src folder to the S3 bucket to make the site live.
Contributions are welcome! Here's how you can help:
- Fork this repository.
- Create a new branch (
git checkout -b feature-branch
). - Make your chnges and run tests.
- Submit a pull request.
This project is licensed under the MIT License.