DWA: Návrh webových aplikácií pomocou JavaScriptu

You're task is implementing some web shop basket functionality. You have an array of products each product has name price and inventory. What you need to do is implement "addProduct", "removeProduct", "updateProductQuantity" and "getTotalPrice" of basket object. "ProductsID" is just index of product in the array in our case it can be "0" or "1" For that matter you also need to implement additional class "productLineItem" to store quantity and also we need to store some state of basket(probably an array of added products). "addProduct" adds product to basket (1 item), and subtracts 1 from inventory. It can be called more than one per each product. Throw an error if product gets out of stock or productID is not valid "removeProduct" function removes all of items of defined products in case there's one and throws an error otherwise. "updateProductQuantity" set defined quantity to item of defined product, throws an error if any input parameter is invalid "getTotalPrice" return total cost of all products added to cart (productPrice[1] * quiantity[1] + productPrice[2] * quiantity[2] +... + productPrice[n] * quiantity[n])

You see a page with a list. Your task is writing some JS (you can use jQuery) which makes the page behave next way 1. When you click on item which contains sub items, sub items should be shown if they were hidden and hidden if the were shown 2. if you click "+" symbol an input field should be shown instead of + 3. when you press "Enter" on input field new item should be put under current item, input field should be replace with "+"

HW requirements: Your task is to implements ProductLineItem, ProductlineItemContainer, Basket and Order classes;

ProductLineItem works the same way as in 1-st home work

In Basket should be implemented two additional methods:

static getBasket creates instance of basket if it is called first time, returns created basket if its called again placeOrder: create an order form basket, removes basket

ProductlineItemContainer class which is extended by Basket And Order, implements shared functionality (for example getTotalPrice)

Order: Contains product line items, it has status. It does not have basket methods as removeProduct, addProduct, updateProductQuantity. it has getTotalPrice. It has setStatus method which changes order status

After installing NodeJS and npm just run "npm install" in console in HW5 folder. Your task is to define behavior of real time shop. You have two roles customer(/) and merchant (/merchant)

Customer can: Add product to basket, update product in basket, remove product from basket and place order.

Merchant can: add/update/remove products, see created orders

Products are shared, that means if merchant add something, customer should see it in real time.