<?php $__env->startSection('sitecontent'); ?>
<?php
$disabledWeekDays = array();
$highlightedDates = array();
foreach ($holdaysDate as $rows) {
    $temp = array(
        'start' => date("Y-m-d",strtotime($rows->start_date)),
        'end' => date("Y-m-d",strtotime($rows->end_date))
    );
    array_push($disabledWeekDays, $temp);

    $i = 0;
    $startDate = $rows->start_date;
    do{
        $currentDate = date("Y-m-d",strtotime($startDate.' + '.$i.' day'));
        $tempAr = array(
            'date' => $currentDate,
            'highlight' => 'red',
            'markCssClass' => 'square-mark'
        );
        array_push($highlightedDates, $tempAr);
        $i++;
    }while(strtotime($currentDate)<strtotime($rows->end_date));
}


?>
<script>
    var  mobiscrollObj = [];
    var weekDays = '<?php echo json_encode($disabledWeekDays); ?>';
    weekDays = JSON.parse(weekDays);
    var highlightedDates = '<?php echo json_encode($highlightedDates); ?>';
    highlightedDates = JSON.parse(highlightedDates);
    var invalidObj = weekDays;
</script>
<section class="headerbg headerbg-inner">
    <div class="header header-padding">
        <?php echo $__env->make('partials.site.header-menu', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
    </div>
    <div class="inner-heading"><?php echo e(__('lang.cart_title')); ?></div>
</section>
<section class="order-details-bg">
    <div class="container">
        <div class="row justify-content-center">
            <?php if(count($data)>0): ?>
                <?php if(Session::has('message')): ?>
                    <div class="col-lg-11">
                        <div class="alert alert-success" role="alert">
                          <?php echo e(Session::get('message')); ?>

                        </div>
                    </div>
                <?php endif; ?>
                <?php if(Session::has('error')): ?>
                <div class="col-lg-11">
                    <div class="alert alert-danger" role="alert">
                      <?php echo e(Session::get('error')); ?>

                    </div>
                </div>
                <?php endif; ?>
            <?php endif; ?>

            <div class="col-lg-11">
                <?php if(count($data)>0): ?>
                    <?php echo Form::model(null, ['method' => 'POST', 'url' => ['cart-checkout']]); ?>

                        <?php echo csrf_field(); ?>
                        <?php $__currentLoopData = $data; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $row): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <?php if($row->product): ?>
                                <div class="inforow">
                                    <input type="hidden" name="cart_id[]" value="<?php echo e($row->id); ?>">
                                    <input type="hidden" id="product_min_qty_<?php echo e($row->id); ?>" value="<?php echo e(($row->product->minimum_order_quantity>0)?$row->product->minimum_order_quantity:1); ?>">
                                    <span class="productimg"><img src="<?php echo e(asset('app-assets/images/products')); ?>/<?php echo e($row->product->image); ?>" alt="<?php echo e($row->name); ?>" /></span>
                                    <span class="productname"><?php echo e($row->product->name); ?></span>
                                    <span class="productname"><?php echo e(\Helpers::currency($row->total_delivery_amount)); ?></span>
                                    <span class="productnumber">
                                        <button data-action="decrement" class="decrbtn" type="button">
                                            <span class="m-auto text-2xl font-thin">−</span>
                                        </button>
                                        <input type="number" name="quantity[]" value="<?php echo e($row->quantity); ?>" id="<?php echo e($row->id); ?>" readonly />
                                        <button data-action="increment" class="decrbtn" type="button">
                                            <span class="m-auto text-2xl font-thin">+</span>
                                        </button>
                                    </span>
                                    <div class="editdeletebtns">
                                        <a href="<?php echo e(url('delete-cart-item')); ?>/<?php echo e($row->id); ?>" title="<?php echo e(__('lang.delete_cart_item')); ?>" style="background: #af7ab3;"><img src="<?php echo e(asset('site-assets/images/icondele1.svg')); ?>"  /></a>
                                        <a href="javascript:;" onclick="enableCalculation();" data-toggle="collapse" data-target="#tab_<?php echo e($row->id); ?>" title="<?php echo e(__('lang.edit_cart')); ?>"><img src="<?php echo e(asset('site-assets/images/edit01.svg')); ?>"  /></a>
                                    </div>
                                </div>
                                <div class="calenderbg-outer collapse" id="tab_<?php echo e($row->id); ?>">
                                    <div class="calenderbg addressform calenderradio">
                                        <div class="calenderradio02 radio">
                                            <input type="radio" id="once_<?php echo e($row->id); ?>" onclick="selectFrequency('once','<?php echo e($row->id); ?>');" name="order_frequency_<?php echo e($row->id); ?>" value="Once" <?php if($row->order_frequency=='once'): ?> checked <?php endif; ?>/>
                                            <input type="radio" id="daily_<?php echo e($row->id); ?>" onclick="selectFrequency('daily','<?php echo e($row->id); ?>');" name="order_frequency_<?php echo e($row->id); ?>" value="Daily"  <?php if($row->order_frequency=='daily'): ?> checked <?php endif; ?>/>
                                            <input type="radio" id="weekly_<?php echo e($row->id); ?>" onclick="selectFrequency('weekly','<?php echo e($row->id); ?>');" name="order_frequency_<?php echo e($row->id); ?>" value="Weekly"  <?php if($row->order_frequency=='weekly'): ?> checked <?php endif; ?>/>
                                            <input type="radio" id="monthly_<?php echo e($row->id); ?>" onclick="selectFrequency('monthly','<?php echo e($row->id); ?>');" name="order_frequency_<?php echo e($row->id); ?>" value="Monthly"  <?php if($row->order_frequency=='monthly'): ?> checked <?php endif; ?>/>
                                            <input type="radio" id="alternative_<?php echo e($row->id); ?>" onclick="selectFrequency('alternative','<?php echo e($row->id); ?>');" name="order_frequency_<?php echo e($row->id); ?>" value="Alternative"  <?php if($row->order_frequency=='alternative'): ?> checked <?php endif; ?>/>
                                        </div>
                                        <div class="weeklydays <?php if($row->order_frequency!='weekly'): ?> hide <?php endif; ?> days_option_<?php echo e($row->id); ?>">
                                            <h3><?php echo e(__('lang.select_days_for_delivery')); ?></h3>
                                            <div class="radio">
                                                <?php
                                                $days = explode(",",$row->days);
                                                ?>
                                                <input type="checkbox" id="days_sun_<?php echo e($row->id); ?>" name="days_<?php echo e($row->id); ?>[sun]" value="S"  <?php if(in_array(0,$days)): ?> checked <?php endif; ?>/>

                                                <input type="checkbox" id="days_mon_<?php echo e($row->id); ?>" name="days_<?php echo e($row->id); ?>[mon]" value="M"  <?php if(in_array(1,$days)): ?> checked <?php endif; ?>/>
                                                <input type="checkbox" id="days_tue_<?php echo e($row->id); ?>" name="days_<?php echo e($row->id); ?>[tue]" value="T"  <?php if(in_array(2,$days)): ?> checked <?php endif; ?>/>
                                                <input type="checkbox" id="days_wed_<?php echo e($row->id); ?>" name="days_<?php echo e($row->id); ?>[wed]" value="W"  <?php if(in_array(3,$days)): ?> checked <?php endif; ?>/>
                                                <input type="checkbox" id="days_thu_<?php echo e($row->id); ?>" name="days_<?php echo e($row->id); ?>[thu]" value="T"  <?php if(in_array(4,$days)): ?> checked <?php endif; ?>/>
                                                <input type="checkbox" id="days_fri_<?php echo e($row->id); ?>" name="days_<?php echo e($row->id); ?>[fri]" value="F"  <?php if(in_array(5,$days)): ?> checked <?php endif; ?>/>
                                                <input type="checkbox" id="days_sat_<?php echo e($row->id); ?>" name="days_<?php echo e($row->id); ?>[sat]" value="S"  <?php if(in_array(6,$days)): ?> checked <?php endif; ?>/>
                                            </div>
                                        </div>
                                        <div class="quickselection <?php if($row->order_frequency!='weekly'): ?> hide <?php endif; ?> days_option_<?php echo e($row->id); ?>">
                                            <div class="radio">
                                                <span><?php echo e(__('lang.quick_selection')); ?></span>
                                                <input type="radio" id="weekday_<?php echo e($row->id); ?>" name="quick[]" onclick="selectQuickSelection('WEEKDAYS','<?php echo e($row->id); ?>');" value="<?php echo e(__('lang.weekdays')); ?>" />
                                                <input type="radio" id="weekends_<?php echo e($row->id); ?>" name="quick[]" onclick="selectQuickSelection('WEEKENDS','<?php echo e($row->id); ?>');" value="<?php echo e(__('lang.weekend')); ?>" />
                                            </div>
                                        </div>
                                        <div class="calenderbox">
                                            <h3><?php echo e(__('lang.select_deliver_date')); ?></h3>
                                            <?php
                                            $date = $row->start_date. ' - '.$row->end_date;
                                            if($row->order_frequency=='once'){
                                                $date = $row->start_date;
                                            }
                                            if($row->order_frequency=='monthly'){
                                                $date = $row->delivery_dates;
                                            }
                                            ?>
                                            <input type="hidden" class="demo-multi-day" id="delivery_dates_<?php echo e($row->id); ?>" name="delivery_dates[]" value="<?php echo e($date); ?>" required>
                                        </div>
                                    </div>
                                    <?php if($row->order_frequency=='once'){ ?>
                                        <script type="text/javascript">
                                            var currentDate = new Date();
                                            currentDate.setDate(currentDate.getDate() + 1);
                                            mobiscrollObj[<?php echo $row->id; ?>] = mobiscroll.setOptions({
                                                locale: mobiscroll.localeEn, // Specify language like: locale: mobiscroll.localePl or omit setting to use default
                                                theme: "ios", // Specify theme like: theme: 'ios' or omit setting to use default
                                                themeVariant: "light", // More info about themeVariant: https://docs.mobiscroll.com/5-7-1/calendar#opt-themeVariant
                                            });
                                            $("#delivery_dates_<?php echo $row->id; ?>")
                                            .mobiscroll()
                                            .datepicker({
                                                controls: ["calendar"],                                                
                                                invalid: invalidObj,
                                                colors : highlightedDates,
                                                display: "inline",
                                                min: currentDate
                                            });
                                        </script>
                                    <?php }else if($row->order_frequency=='monthly'){ ?>
                                        <script type="text/javascript">
                                            var currentDate = new Date();
                                            currentDate.setDate(currentDate.getDate() + 1);
                                            mobiscrollObj[<?php echo $row->id; ?>] = mobiscroll.setOptions({
                                                locale: mobiscroll.localeEn, // Specify language like: locale: mobiscroll.localePl or omit setting to use default
                                                theme: "ios", // Specify theme like: theme: 'ios' or omit setting to use default
                                                themeVariant: "light", // More info about themeVariant: https://docs.mobiscroll.com/5-7-1/calendar#opt-themeVariant
                                            });
                                            $("#delivery_dates_<?php echo $row->id; ?>")
                                            .mobiscroll()
                                            .datepicker({
                                                controls: ["calendar"],                                                
                                                invalid: invalidObj,
                                                marked : highlightedDates,
                                                display: "inline",
                                                selectMultiple: true,
                                                min: currentDate
                                            });
                                        </script>
                                    <?php }else{ ?>
                                        <script type="text/javascript">
                                            var currentDate = new Date();
                                            currentDate.setDate(currentDate.getDate() + 1);
                                            mobiscrollObj[<?php echo $row->id; ?>] = mobiscroll.setOptions({
                                                locale: mobiscroll.localeEn, // Specify language like: locale: mobiscroll.localePl or omit setting to use default
                                                theme: "ios", // Specify theme like: theme: 'ios' or omit setting to use default
                                                themeVariant: "light", // More info about themeVariant: https://docs.mobiscroll.com/5-7-1/calendar#opt-themeVariant
                                            });
                                            $("#delivery_dates_<?php echo $row->id; ?>")
                                            .mobiscroll()
                                            .datepicker({
                                                controls: ["calendar"],
                                                display: "inline",
                                                select:'range',
                                                marked : highlightedDates,
                                                showRangeLabels: false,
                                                selectMultiple: true,
                                                min: currentDate
                                            });
                                        </script>
                                    <?php } ?>
                                </div>
                            <?php endif; ?>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        <div class="cart-total-box calculation">
                            <p><label><?php echo e(__('lang.order_sub_total')); ?></label> <?php echo e(\Helpers::currency($total['subtotal'])); ?></p>
                            <p><label><?php echo e(__('lang.order_vat')); ?> <?php echo e(setting('default_tax')); ?>%</label> <?php echo e(\Helpers::currency($total['tax'])); ?></p>
                            <p><label><?php echo e(__('lang.order_delivery')); ?></label> <?php echo e(($total['delivery_fee']>0)?\Helpers::currency($total['delivery_fee']):__('lang.order_delivery_free')); ?></p>
                            <p class="coupondis"><label><?php echo e(__('lang.order_coupon_discount')); ?></label> <?php if($total['is_coupon_applied']): ?> -<?php echo e(\Helpers::currency($total['promotional_disount'])); ?> <br><a href="#" data-toggle="modal" data-target="#coupon"><?php echo e(__('lang.change_coupon_btn')); ?></a> <?php else: ?> <a href="#" data-toggle="modal" data-target="#coupon"><?php echo e(__('lang.apply_coupon_btn')); ?></a>  <?php endif; ?> </p>
                            <p class="totalrow"><label><?php echo e(__('lang.order_total')); ?></label>  <?php echo e(\Helpers::currency($total['final_amount'])); ?></p>
                            <p><button class="submit-btn mt-3 full-width-btn" type="submit" name="submit_button" value="next"><?php echo e(__('lang.next_btn')); ?> <img src="<?php echo e(asset('site-assets/images/arrowright.png')); ?>"/></button></p>
                        </div>
                        <div class="cart-total-box hide calculate">
                            <p><button class="submit-btn mt-3 full-width-btn" type="submit" name="submit_button" value="recalculate"><?php echo e(__('lang.re_calculate_btn')); ?> <img src="<?php echo e(asset('site-assets/images/arrowright.png')); ?>"/></button></p>
                        </div>
                    <?php echo Form::close(); ?>

                <?php else: ?>
                    <div class="alert alert-danger" role="alert">
                      <?php echo e(__('lang.not_any_item_in_cart')); ?>

                    </div>
                    <p style="text-align: center;">
                        <?php
                        $url = url('/#populargoods');
                        ?>
                        <button class="col-lg-3 submit-btn mt-3 full-width-btn" type="button" onclick="window.location.href='<?php echo e($url); ?>'"><?php echo e(__('lang.navigation_home')); ?></button>
                    </p>
                <?php endif; ?>
            </div>
        </div>
    </div>
</section>
<?php echo $__env->make('partials.site.coupon', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
<footer class="footer">
    <?php echo $__env->make('partials.site.footer', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
</footer>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.site-app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/waterfl/public_html/resources/views/cart.blade.php ENDPATH**/ ?>