HeartAttackCat / TomcatDonutStore

Web development course server page.
0 stars 0 forks source link

Order placing #12

Open Korbrent opened 3 hours ago

Korbrent commented 3 hours ago

Client-side:

Functionality needs to be implemented which takes user input and keeps a running tab on the current cart of the user. After the user checks out, the client-side needs to POST to the servlet with the order and await a response. The Servlet will respond with the OrderID, TotalPrice and TotalQuantity, and the client-side should then display this information.

Server-side:

Once the servlet receives an order from the client, it should create an order entry in the database. This should be split into two Java classes, one which handles communicating with the client and another which handles communicating with MySQL, similar to our previous implementation.

Korbrent commented 3 hours ago

The current JavaScript assumes there exists a div on the current HTML document called cart-window and updates the internal HTML of said div.

The internals of the div are structured as follows:

<div id='cart-window'>
    <div class=['cart-item', 'total-item']>
        <h3>Total <\h3>
        <h4>Quantity: {quantity} <\h4>
        <h4>Total Price: {$.2f} <\h4>
    <\div>
    <div class='cart-item'>
        <h3>{donut.name}<\h3>
        <h4>Quantity: {donut.quantity}<\h4>
        <h4>Price: {donut.price}<\h4>
    <\div>
    <!-- Repeat for as many donuts in cart-->
    <button class='checkout-button' onclick='checkout_command()'>Checkout<\button>
<\div>

Typing this out, I realize I should probably have two different price entries per donut, one that displays the price per single donut, and another displaying the price given the quantity. Oh well, simple fix.