
<?php $__env->startSection('content'); ?>
    <div class="row">
        <div class="col-md">
            <div class="card card-user">
                <div class="card-header pt-4" style="align-self: center;justify-content: center;width: 75%;border-bottom: none;">
                    <h3><?php echo e(isset($allVendors) ? 'Vendor List' : (isset($vendorDetails) ? 'Vendor Meal Menu' : '')); ?></h3>
                </div>
                <div class="card-body">
                    <?php if(isset($allVendors)): ?>
                        <div class="table-responsive px-2" style="overflow-x: scroll; overflow-y: hidden;">
                            <table class="table table-hover">
                                <thead class="text-dark">
                                    <tr>
                                        <th class="text-center" scope="col">S.No.</th>
                                        <th class="text-center" scope="col">Name</th>
                                        <th class="text-center" scope="col">Email</th>
                                        <th class="text-center" scope="col">Phone No.</th>
                                        <th class="text-center" scope="col">Address</th>
                                        <th class="text-center" scope="col">Status</th>
                                        <th scope="col" class="d-flex justify-content-center">Action</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <?php $__empty_1 = true; $__currentLoopData = $allVendors; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $vendor): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                                        <tr>
                                            <th class="text-center" scope="row"><?php echo e($loop->iteration); ?></th>
                                            <td class="text-center"><?php echo e($vendor->name); ?></td>
                                            <td class="text-center"><?php echo e($vendor->email); ?></td>
                                            <td class="text-center"><?php echo e($vendor->contactNumber); ?></td>
                                            <td class="text-center"><?php echo e($vendor->address); ?></td>
                                            <td class="text-center"><span class="badge badge-info"><?php echo e($vendor->meal_status); ?></span></td>
                                            <td class="d-flex justify-content-around">
                                                <a href="<?php echo e(url('client/view/vendorMenus/'.$vendor->vendorId)); ?>" title="View" class="peterriver w-100 px-2" style="padding: .3rem .2rem;"><i class="fa fa-eye"></i></a>
                                            </td>
                                        </tr>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                                        <tr>
                                            <td colspan="7" align="center">Not Found any</td>
                                        </tr>
                                    <?php endif; ?>
                                </tbody>
                            </table>
                        </div>
                    <?php elseif(isset($vendorDetails)): ?>
                        <div>
                            <?php if(isset($menu)): ?>
                                <input type="hidden" name="requestId" value="<?php echo e($menu->id); ?>" />
                            <?php endif; ?>
                            <!-- Client Info -->
                            <div class="row">
                                <?php
                                    $dt_min = new DateTime('-10 minutes');
                                    $dt_min = $dt_min->format('Y-m-d\TH:i');
                                    if(isset($menu)){
                                        $datetime_from = new DateTime($menu->from_time);
                                        $datetime_from = $datetime_from->format('Y-m-d\TH:i');
                                        $datetime_to = new DateTime($menu->to_time);
                                        $datetime_to = $datetime_to->format('Y-m-d\TH:i');
                                    }
                                ?>
                                <div class="form-group col">
                                    <label for="clientId">Vendor Name</label>
                                    <input class="form-control" type="text" value="<?php echo e($vendorDetails->name.' - '.$vendorDetails->username); ?>" id="clientId" readonly />
                                    <input type="hidden" name="clientId" value="<?php echo e($vendorDetails->id); ?>" />
                                    <input type="hidden" name="vendorId" value="<?php echo e(Auth::user()->id); ?>" />
                                </div>
                                <div class="form-group col">
                                    <label for="fromtime">Validated From</label>
                                    <input class="form-control" name="from_time" min="<?php echo e($dt_min); ?>" value="<?php echo e(isset($menu) ? $datetime_from : ''); ?>" type="datetime-local" placeholder="Meal from.." id="fromtime" readonly />
                                </div>
                                <div class="form-group col">
                                    <label for="totime">Validated To</label>
                                    <input class="form-control" name="to_time" value="<?php echo e(isset($menu) ? $datetime_to : ''); ?>" type="datetime-local" placeholder="Meal to.." id="totime" readonly />
                                </div>
                            </div>
                            <!-- Morning -->
                            <div class="row">
                                <div class="form-group col mb-0">
                                    <label for="morning_meal">Morning Meal: </label>
                                    <?php if(isset($menu) && isset($menu->morning_meal)): ?>
                                        <a href="<?php echo e($menu->morning_meal); ?>" target="_blank" class="btn btn-primary">Menu</a>
                                    <?php else: ?>
                                        <span class="badge text-warning">No Menu Still!!</span>
                                    <?php endif; ?>
                                </div>
                                <!-- <div class="form-group col">
                                    <label for="morning_description">Morning Description</label>
                                    <textarea type="text" name="morning_description" class="form-control" id="morning_description" readonly><?php echo e(isset($menu) ? $menu->morning_description : old('morning_description')); ?></textarea>
                                </div> -->
                            </div>

                            <?php
                                // dd($vendorId);
                            ?>
                            <!-- Submit -->
                            <?php if(isset($menu->client_meal_status)): ?>
                                <div class="row my-4 d-flex justify-content-center" id="meal_approve_actions">
                                    <button class="turquoise mx-4" onclick="approve_meal_status(<?php echo e($vendorId); ?>, 'approve');">Approve</button>
                                    <button class="wetasphalt mx-4" onclick="open_meal_disapprove_reason();">Disapprove</button>
                                </div>
                                <div class="row d-none justify-content-center mt-4" id="client_meal_status">
                                    <div class="col-4">
                                        <div class="form-group">
                                            <textarea name="client_meal_status" id="vendor_meal_doc" class="form-control" onkeyup="javascript: if(event.keyCode == 13) disapprove_status(<?php echo e($vendorId); ?>, 'disapprove');" placeholder="Type your reason and press Enter for submit"></textarea>
                                        </div>
                                    </div>
                                </div>
                                <script>
                                    function open_meal_disapprove_reason(){
                                        if(document.getElementById("client_meal_status").classList.contains("d-flex")){
                                            document.getElementById("client_meal_status").className = 'row d-none justify-content-center mt-4';
                                            document.getElementById("meal_approve_actions").className = 'row my-4 d-flex justify-content-center';
                                        }else if(document.getElementById("client_meal_status").classList.contains("d-none")){
                                            document.getElementById("client_meal_status").className = 'row d-flex justify-content-center mt-4';
                                            document.getElementById("meal_approve_actions").className = 'row my-4 d-none justify-content-center';
                                        }
                                    }
                                </script>
                            <?php endif; ?>
                        </div>
                    <?php endif; ?>
                </div>
            </div>
        </div>
    </div>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.masterDashboard', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/nexaipaybr/public_html/foodycraft/app/Modules/Client/Views/vendorMenu.blade.php ENDPATH**/ ?>