<?php 
include('includes/connectdb.php');

if(!isset($_SESSION['user_id'])){
	header('location:login');
}else{
	$user_id = $_SESSION['user_id'];
	$sql = mysqli_query($con, "SELECT * FROM account WHERE account_id = $user_id ");
	$row = mysqli_fetch_array($sql);
	$s_address = $row['s_address'];
}

include('includes/head.php');
?>
<body>
    <div class="page-wrapper">
        <?php include('includes/header.php'); ?>
        <main class="main">
            <nav aria-label="breadcrumb" class="breadcrumb-nav">
                <div class="container">
                    <ol class="breadcrumb">
                        <li class="breadcrumb-item"><a href="index"><i class="icon-home"></i></a></li>
                        <li class="breadcrumb-item active" aria-current="page">Checkout</li>
                    </ol>
                </div><!-- End .container -->
            </nav>

            <div class="container">
                <ul class="checkout-progress-bar">
                    <li class="active">
                        <span>Shipping</span>
                    </li>
                    <li>
                        <span>Review &amp; Payments</span>
                    </li>
                </ul>
                <div class="row">
                    <div class="col-lg-8">
                        <ul class="checkout-steps">
                            <li>
                                <h2 class="step-title">Shipping Address</h2>

                                <div class="shipping-step-addresses">
                                    <div class="shipping-address-box">
                                        <address>
                                            <?php echo $s_address; ?>
                                        </address>

                                        <div class="address-box-action clearfix">
                                            <a href="update-s_address" class="btn btn-sm btn-outline-secondary float-right">
                                                Edit
                                            </a>
                                        </div><!-- End .address-box-action -->
                                    </div><!-- End .shipping-address-box -->
                                </div><!-- End .shipping-step-addresses -->
                            </li>


                        </ul>
                    </div><!-- End .col-lg-8 -->

                    <div class="col-lg-4">
                        <div class="order-summary">
                            <h3>Summary</h3>

                            <h4>
                                <a data-toggle="collapse" href="#order-cart-section" class="collapsed" role="button" aria-expanded="false" aria-controls="order-cart-section"><?php echo count($_SESSION['cart_item']) ?> products in Cart</a>
                            </h4>

                            <div class="collapse" id="order-cart-section">
                                <table class="table table-mini-cart">
                                    <tbody>
									    <?php foreach($_SESSION['cart_item'] as $key => $val):  
										  $resPrice = $_SESSION['cart_item'][$key]['price'] * $_SESSION['cart_item'][$key]['qty'];
										  $total_price += $resPrice;
										?>
                                        <tr>
                                            <td class="product-col">
                                                <figure class="product-image-container">
                                                    <a href="product?pid=<?php echo $_SESSION['cart_item'][$key]['pid']; ?>" class="product-image">
                                                        <img src="<?php echo $_SESSION['cart_item'][$key]['image']; ?>" alt="product">
                                                    </a>
                                                </figure>
                                                <div>
                                                    <h2 class="product-title">
                                                        <a href="product?pid=<?php echo $_SESSION['cart_item'][$key]['pid']; ?>"><?php echo $_SESSION['cart_item'][$key]['name'];  ?></a>
                                                    </h2>
                                                    <span class="product-qty">Qty: <?php echo $_SESSION['cart_item'][$key]['qty'] ?></span>
                                                </div>
                                            </td>
                                            <td class="price-col">$<?php echo number_format($_SESSION['cart_item'][$key]['price'] * $_SESSION['cart_item'][$key]['qty']) ?></td>
                                        </tr>

                                        <?php endforeach  ?>
                                    </tbody>    
                                </table>
                            </div><!-- End #order-cart-section -->
                        </div><!-- End .order-summary -->
                    </div><!-- End .col-lg-4 -->
                </div><!-- End .row -->

                <div class="row">
                    <div class="col-lg-8">
                        <div class="checkout-steps-action">
                            <a href="checkout-review" class="btn btn-primary float-right">NEXT</a>
                        </div><!-- End .checkout-steps-action -->
                    </div><!-- End .col-lg-8 -->
                </div><!-- End .row -->
            </div><!-- End .container -->

            <div class="mb-6"></div><!-- margin -->
        </main><!-- End .main -->

        <?php include('includes/footer.php') ?>
    </div><!-- End .page-wrapper -->

    <div class="mobile-menu-overlay"></div><!-- End .mobil-menu-overlay -->

    <?php include('includes/mobile-menu.php') ?>

    <!-- Modal -->
    <div class="modal fade" id="addressModal" tabindex="-1" role="dialog" aria-labelledby="addressModalLabel" aria-hidden="true">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <form action="#">
                    <div class="modal-header">
                        <h3 class="modal-title" id="addressModalLabel">Shipping Address</h3>
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true">&times;</span>
                        </button>
                    </div><!-- End .modal-header -->

                    <div class="modal-body">
                            <div class="form-group required-field">
                                <label>First Name </label>
                                <input type="text" class="form-control form-control-sm" required>
                            </div><!-- End .form-group -->

                            <div class="form-group required-field">
                                <label>Last Name </label>
                                <input type="text" class="form-control form-control-sm" required>
                            </div><!-- End .form-group -->

                            <div class="form-group">
                                <label>Company </label>
                                <input type="text" class="form-control form-control-sm">
                            </div><!-- End .form-group -->

                            <div class="form-group required-field">
                                <label>Street Address </label>
                                <input type="text" class="form-control form-control-sm" required>
                                <input type="text" class="form-control form-control-sm" required>
                            </div><!-- End .form-group -->

                            <div class="form-group required-field">
                                <label>City  </label>
                                <input type="text" class="form-control form-control-sm" required>
                            </div><!-- End .form-group -->

                            <div class="form-group">
                                <label>State/Province</label>
                                <div class="select-custom">
                                    <select class="form-control form-control-sm">
                                        <option value="CA">California</option>
                                        <option value="TX">Texas</option>
                                    </select>
                                </div><!-- End .select-custom -->
                            </div><!-- End .form-group -->

                            <div class="form-group required-field">
                                <label>Zip/Postal Code </label>
                                <input type="text" class="form-control form-control-sm" required>
                            </div><!-- End .form-group -->

                            <div class="form-group">
                                <label>Country</label>
                                <div class="select-custom">
                                    <select class="form-control form-control-sm">
                                        <option value="USA">United States</option>
                                        <option value="Turkey">Turkey</option>
                                        <option value="China">China</option>
                                        <option value="Germany">Germany</option>
                                    </select>
                                </div><!-- End .select-custom -->
                            </div><!-- End .form-group -->

                            <div class="form-group required-field">
                                <label>Phone Number </label>
                                <div class="form-control-tooltip">
                                    <input type="tel" class="form-control form-control-sm" required>
                                    <span class="input-tooltip" data-toggle="tooltip" title="For delivery questions." data-placement="right"><i class="icon-question-circle"></i></span>
                                </div><!-- End .form-control-tooltip -->
                            </div><!-- End .form-group -->
                            
                            <div class="form-group-custom-control">
                                <div class="custom-control custom-checkbox">
                                    <input type="checkbox" class="custom-control-input" id="address-save">
                                    <label class="custom-control-label" for="address-save">Save in Address book</label>
                                </div><!-- End .custom-checkbox -->
                            </div><!-- End .form-group -->
                    </div><!-- End .modal-body -->

                    <div class="modal-footer">
                        <button type="button" class="btn btn-link btn-sm" data-dismiss="modal">Cancel</button>
                        <button type="submit" class="btn btn-primary btn-sm">Save changes</button>
                    </div><!-- End .modal-footer -->
                </form>
            </div><!-- End .modal-content -->
        </div><!-- End .modal-dialog -->
    </div><!-- End .modal -->

    <a id="scroll-top" href="#top" title="Top" role="button"><i class="icon-angle-up"></i></a>

    <!-- Plugins JS File -->
    <script src="assets/js/jquery.min.js"></script>
    <script src="assets/js/bootstrap.bundle.min.js"></script>
    <script src="assets/js/plugins.min.js"></script>

    <!-- Main JS File -->
    <script src="assets/js/main.min.js"></script>
</body>

<!-- Mirrored from portotheme.com/html/porto_ecommerce/demo_4/checkout-shipping-2.html by HTTrack Website Copier/3.x [XR&CO'2014], Tue, 15 Oct 2019 15:28:16 GMT -->
</html>