<?php   





    include('functions/userfunctions.php');

    include('includes/header.php');

    include('authenticate.php');?>

 





    <div class="py-3 bg-primary">

      <div class="container">

        <h6 clasS="text-white">

            <a href="index.php">

                 Home / 

            </a>

            <a href="checkout.php">

                 Checkout

            </a>

        </h6>

      </div>

    </div>



    <div class="container py-5">

        <div class="card">

            <div class="card-body shadow">

                <form action="payment.php" method="POST">

                    <div class="row">

                        <div class="col-md-7">

                            <h5>Details</h5>

                            <hr>

                            <div class="row">

                                <div class="col-md-6 mb-3">

                                    <label class="fw-bold">Name</label>

                                    <input type="text" name="name" required placeholder="Enter your full name" class="form-control">

                                </div>

                                <div class="col-md-6 mb-3">

                                    <label class="fw-bold">E-mail</label>

                                    <input type="email" name="email" required placeholder="Enter your email" class="form-control">

                                </div>

                                <div class="col-md-6 mb-3">

                                    <label class="fw-bold">Phone</label>

                                    <input type="text" name="phone" required placeholder="Enter your phone number" class="form-control">

                                </div>

                                <div class="col-md-6 mb-3">

                                    <label class="fw-bold">Pin Code</label>

                                    <input type="text" name="pincode" required placeholder="Enter your pin code" class="form-control">

                                </div>

                                <div class="col-md-12 mb-3">

                                    <label class="fw-bold">Address</label>

                                    <textarea name="address" required class="form-control"rows="5"></textarea>

                                </div>

                            </div>
                            

                        </div>



                        <div class="col-md-5">

                            <div class="row align-items-center d-none d-md-flex">

                                <div class="col-md-7">

                                    <h6>Order Details</h6>

                                </div>

                                <div class="col-md-2">

                                    <h6>Quantity</h6>

                                </div>

                                <div class="col-md-3">

                                    <h6>Unit Price</h6>

                                </div>

                            </div>

                                <?php $items = getCartItems();

                                $totalPrice = 0;

                                foreach($items as $citem)

                                {

                                    ?>

                                    <div class="card product_data shadow-sm mb-3">

                                        <div class="row align-items-center">

                                        <!--görsel ve isim

                                            <div class="col-md-2">

                                                <img src="uploads/<?=$citem['image']?>" alt="Menu Item" width="80px" class="p-2">

                                            </div>

                                            <div class="col-md-5">

                                                <h5 class="p-2"><?=$citem['name']?></h5>

                                            </div>

                                        -->

                                            <div class="col-12 col-md-7">

                                                <h5 class="p-2"><?=$citem['name']?></h5>

                                            </div>

                                            <div class="col-6 col-md-2">

                                                <h5 class="p-2">x <?=$citem['prod_qty']?></h5>

                                            </div>

                                            <div class="col-6 col-md-3">

                                                <h5 class="p-2"><?=$citem['selling_price']?> ₺</h5>

                                            </div>

                                            

                                            

                                        </div>

                                    </div>

                                    <?php

                                    $totalPrice += $citem['selling_price'] * $citem['prod_qty'];

                                }

                                ?>

                                <hr>

                                

                                <h5 class="mt-3">Total Price : <span class="float-end fw-bold"><?= $totalPrice ?> ₺</span></h5>

                                <div class="">

                                    <input type="hidden" name="payment_mode" value="COD">
                                    <input type="hidden" name="totalprice" value="<?= $totalPrice ?>">

                                    <button type="submit"  name="placeOrderBtn" class="btn btn-primary float-end mt-5 w-100">Confirm and place order | COD </button>

                                </div>

                        </div>

                    </div>

                </form>

            </div>

        </div>

    </div>

    

    





 <?php //include('sanalpost_php/threed-payment.php');?> 

    <?php include('includes/footer.php');?>