<%- include('../partials/header.ejs') -%>


    <br>
    <br>
    <div class="container">
        <h1>Checkout</h1>
        <hr>
        <div class="row justify-content-center">
            <div class="col-6">
                <div class="card">
                    <div class="card-header">
                        Billing address
                    </div>
                    <div class="card-body">
                        <form>
                            <div class="row">
                                <div class="row">
                                    <div class="col">
                                        <label for="inputAddress">First name</label>
                                        <input type="text" class="form-control" value="<%=user.first_name %>" disabled>
                                    </div>
                                    <div class="col">
                                        <label for="inputAddress">Last name</label>
                                        <input type="text" class="form-control" value="<%=user.last_name %>" disabled>
                                    </div>
                                </div>

                                <div class="form-group" style="width: 100%;">
                                    <label for="inputAddress">Address</label>
                                    <input type="text" class="form-control" id="inputAddress" value="<%=user.address %>" disabled>
                                </div>



                                <div class="row">

                                    <div class="col-sm-12">
                                        <label for="inputAddress">Email address</label>
                                        <input type="text" class="form-control" value="<%=user.email %>" disabled>
                                    </div>

                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
            <div class="col-6">
                <div class="card">
                    <div class="card-header">
                        Additional information
                    </div>
                    <div class="card-body">
                        <b>Order notes</b>
                        <div class="form-floating">
                            <textarea class="form-control " style="height: 200px;" id='notes' name="notes" placeholder=" Leave a comment here " id="floatingTextarea "></textarea>
                            <label for="floatingTextarea ">Notes about your orders</label>
                        </div>
                    </div>
                </div>

            </div>
        </div><br>
        <div class="card ">
            <div class="card-header ">
                <h5>Your order</h5>
            </div>
            <div class="card-body ">
                <table class="table table-bordered table-hover ">
                    <thead>
                        <tr>
                            <th scope="col "><b>Product</b></th>
                            <th scope="col "><b>Total</b></th>

                        </tr>
                    </thead>
                    <tbody>
                        <% data.forEach((e)=>{ %>
                            <tr style="color: red; ">
                                <td>
                                    <%=e.name %>
                                        <%=e.total_price_per_product %> *
                                            <%=e.quantity %>
                                </td>
                                <td>
                                    <%=e.total_price_per_product * e.quantity %>
                                </td>

                            </tr>
                            <% }) %>
                                <tr>
                                    <td><b>Total</b></td>
                                    <td>
                                        <%=total %> $</td>
                                </tr>
                    </tbody>
                </table>
                <br/>
                <div>
                    <h5>Method of payment</h5>
                    <div style="background-color:silver; padding: 10px; ">
                        <input type="radio">
                        <label>Cash</label>
                    </div>
                    <br>

                    <br>
                    <button class="btn btn-success pull-right " type="submit" data-toggle="modal" data-target="#modal">Place Order</button>
                    <div>
                        <div class="modal fade" id="modal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
                            <div class="modal-dialog" role="document">
                                <div class="modal-content">
                                    <div class="modal-header">
                                        <h5 class="modal-title" id="exampleModalLabel">confirmation</h5>
                                        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                    <span aria-hidden="true">&times;</span>
                                  </button>
                                    </div>
                                    <div class="modal-body">
                                        Thank you for your order confirmation mail will send to you <br/>Do you want to continue Shopping ?
                                    </div>
                                    <div class="modal-footer">
                                        <button type="button" onclick="close()" class="btn btn-secondary" data-dismiss="modal">Close</button>
                                        <button type="button" onclick="toShop()" class="btn btn-success">Yes</button>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <br>
            <br>

            <script src="script/checkout.js"></script>
            <%- include( '../partials/footer.ejs') -%>;