-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Juanma López Domaica - Sprint 3 #18
Open
mitild
wants to merge
18
commits into
IT-Academy-BCN:main
Choose a base branch
from
mitild:dev
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains 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
- Moved "products" array to its own file (data.js) - Completed "buy(id)" function Note: In order to access the array from data.js I had to add the type="module" attribute to the index.html file. I believe, because of that I had to convert functions into modular functions by adding the line of code: "window.function = function"
- Implemented the "cleanCart()" function
- Implemented the "calculateTotal()" function
- Implemented the "generateCart()" function - Added a button in the "index.html" file to trigger the function
- Implemented the "applyPromotionsCart()" - Call the function from "generateCart()" function to add the newly generated properties to the products inside the "cart" array - Lastly, called the function "generateCart()" from inside the "buy(id)" function to handle the origina cartList
- Implemented the "printCart()" function. - Updated the "cleanCart()" accordingly - Added a line of code (line 81) for manipulating the cart button qty text - Cleaned up the "index.html" file to be manipulated from JS
- Created the "validate()" function to take control over the form validation. - Added conditions through if statements and the use of regEx's. - Added the "novalidate" attribute to the form in the html tag
- Combined the "buy(id)" function and the "generateCart()" into one function "addToCart(id)" - Updated the onClick trigger at the "index.html" buttons instances
- Commented out the "calculateTotal()" function since it wasn't being used anymore
- Refactored the "applyPromotionsCart()" by getting rid of useless lines of code and Fixed a bug founded in the "Total with discount" HTML field for discounted products => toFixed() did not function as expected.
- When refactored the "applyPromotionsCart()" function I got rid if the product property "subTotalWithDiscount" so I had to refactor the "printCart()" function accordingly too
- Refactored the "addToCart(id)" function by removing some lines that has no useful effect on the app => cartList = []. - Replaced the map() method for the forEach().
- Created the "removeFromCart(id)" function. - Refactored the "printCart()" function by changing the map() method to forEach() method, added the buttons for adding and removing items accordingly and adding to the "destructered" product object the "id" property
- Added some real images to the product cards - Added a hero image -Hooked the "go to cart" button to the "open_modal()" function
- I have added the variable "subtotalWithDiscount" which holds the total price of the cart with the discounts applied.
- Added the property "subtotalWithDiscount" to products with offers
- Fixed bug for decrementing the "subtotalWithDiscount" property - Deleted the "subtotalWithDiscount" property when no discount is applied
- As commented by Pablo, I refactored the code to make the products objects look exactly as required.
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.
Presentación del Sprint 3 del curso de React Frontend Developer de IT Academy, por parte del alumno Juan Manuel López Domaica