<?php $__env->startSection('content'); ?>

    <main>
        <!-- Start section -->
        <?php echo $__env->make('web.layouts.header', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>

            <section class="cart_pg section">
            <div class="container">
                <form method="post" action="<?php echo e(route('checkouting.location')); ?>" onsubmit="formAction(this)">
                    <?php echo csrf_field(); ?>
                    <h2 class="sec_title text-uppercase color-primary fw-bold mb-5">
                        Location Details
                        <img src="<?php echo e(url('')); ?>/assets/web/images/title_line.svg" class="d-block " alt="">
                    </h2>
                    <div class="row">
                        <div class="col-lg-9">
                            <div class="inner">
                                <div class="location-options">
                                    <div class="row">
                                        <div class="col-lg-3">
                                            <div class="form-check mb-4">
                                                <input class="form-check-input"  type="radio" name="status" value="previous"  id="locationType1">
                                                <label class="form-check-label" for="locationType1"> Previous location    </label>
                                            </div>
                                        </div>
                                        <div class="col-lg-3">
                                            <div class="form-check mb-4">
                                                <input class="form-check-input" type="radio" name="status" value="new"  id="locationType2" checked>
                                                <label class="form-check-label" for="locationType2"> New location    </label>
                                            </div>
                                        </div>
                                    </div>

                                    <div class="oldLocation-form mt-4" id="oldLocation-form">
                                        <div class="form-group">
                                            <select name="location_id" class="form-control form-select">
                                                <option value=""> <?php echo e(__('web.select')); ?> </option>
                                                <?php $__currentLoopData = $locations; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $row): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                    <option value="<?php echo e($row->id); ?>"> <?php echo e($row->address); ?> </option>
                                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                            </select>
                                        </div>
                                    </div>

                                    <div class="location-form newLocation-form mt-4" id="newLocation-form">
                                        <div class="row">
                                            <?php if($status == 'visitor'): ?>
                                                <div class="col-md-12">
                                                    <div class="form-group mb-4">
                                                        <input type="text" name="name" value="<?php echo e($user->name); ?>" class="form-control" placeholder="Full Name">
                                                    </div>
                                                </div>
                                                <div class="col-md-6">
                                                    <div class="form-group mb-4">
                                                        <input type="email" name="email" value="<?php echo e($user->email); ?>" class="form-control" placeholder="Email">
                                                    </div>
                                                </div>
                                                <div class="col-md-6">
                                                    <div class="form-group mb-4">
                                                        <input type="number" name="phone" value="<?php echo e($user->phone); ?>" class="form-control" placeholder="Phone number">
                                                    </div>
                                                </div>
                                            <?php endif; ?>
                                            <div class="col-md-6">
                                                <div class="form-group mb-4">
                                                    <select name="country_id" onchange="fetchCities(this)" target-id="city_id" class="form-control form-select">
                                                        <option selected value="" disabled>Country</option>
                                                        <?php $__currentLoopData = $countries; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $row): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                            <option value="<?php echo e($row->id); ?>"><?php echo e($row->name); ?></option>
                                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                                    </select>
                                                </div>
                                            </div>
                                            <div class="col-md-6">
                                                <div class="form-group mb-4">
                                                    <select name="city_id" id="city_id" class="form-control form-select">
                                                        <option selected disabled>City</option>
                                                    </select>
                                                </div>
                                            </div>
                                            <div class="col-md-12">
                                                <div class="form-group mb-4">
                                                    <textarea rows="6" name="address" class="form-control" placeholder="Location details" ></textarea>
                                                </div>
                                            </div>
                                        </div>
                                    </div>

                                </div>
                            </div>
                            <div class="in-flex mt-5 flex-wrap" >
                                <a href="<?php echo e(route('product.carts')); ?>" class="butn white_butn fw-bold">
                                    <i class="fas fa-angle-left me-3"></i>  Back
                                </a>

                                <button type="submit" class="butn primary_butn fw-bold">
                                    Continue <i class="fas fa-angle-right ms-3"></i>
                                </button>
                            </div>
                        </div>
                        <div class="col-lg-3 order_sm_1">
                        </div>
                    </div>
                </form>
            </div>
        </section>

        <!-- Start section -->
        <?php echo $__env->make('web.layouts.newsletter', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
    </main>

<?php $__env->startSection('inject_js'); ?>
    <script>
        $("#oldLocation-form").hide();
        // $("#newLocation-form").hide();

        $('input[type="radio"]').click(function() {
            if ($(this).attr("value") == "new") {
                $("#newLocation-form").show();
                $("#oldLocation-form").hide();
            }  else if ($(this).attr("value") == "previous") {
                $("#oldLocation-form").show();
                $("#newLocation-form").hide();
            }
        });
    </script>
<?php $__env->stopSection(); ?>

<?php $__env->stopSection(); ?>

<?php echo $__env->make('web.layouts.layout', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /Applications/MAMP/htdocs/city/resources/views/web/pages/orders/checkout_locations.blade.php ENDPATH**/ ?>