<?php
    use Carbon\Carbon;
?>


<?php $__env->startSection('title', 'Branch'); ?>

<?php $__env->startPush('css'); ?>
    <!-- data tables -->
    <link href="<?php echo e(asset('admin/assets/plugins/datatables/plugins/bootstrap/dataTables.bootstrap4.min.css')); ?> " rel="stylesheet" type="text/css"/>
<?php $__env->stopPush(); ?>

<?php $__env->startSection('content'); ?>
    <div class="page-bar">
        <div class="page-title-breadcrumb">
            
        </div>
    </div>
    <div class="row">
        <div class="col-md-12">
            <div class="card-body ">
                <div class="row">
                    <?php $__currentLoopData = $branches; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $branch): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <div class="col-md-4">
                            <div class="card card-box">
                                <div class="card-body no-padding ">
                                    <div class="doctor-profile" style="padding: 35px 0px;">
                                            <img src="<?php echo e(asset('admin/assets/img/dp.jpg')); ?>" class="doctor-pic" alt=""> 
                                        <div class="profile-usertitle">
                                            <div class="doctor-name"><?php echo e($branch->name); ?></div>
                                        </div>
                                            <p>
                                                <?php $__currentLoopData = $branch->users; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $user): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                    <?php $__currentLoopData = $user->roles; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $userRoles): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                        <?php if($userRoles->name == 'manager' ): ?>
                                                        Manager : <a href="<?php echo e(route('admin.user.show', $user->id)); ?>"><?php echo e($user->name); ?></a>
                                                        <?php endif; ?>
                                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                            </p> 
                                            <p>
                                                Employee : <?php echo e($branch->users()->count()); ?>

                                            </p> 
                                            <p>
                                                Farmer : <?php echo e($branch->farmers()->count()); ?>

                                            </p> 
                                            <div>
                                                <p><i class="fa fa-phone"></i>
                                                    <?php $__currentLoopData = $branch->users; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $user): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                        <?php $__currentLoopData = $user->roles; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $userRoles): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                            <?php if($userRoles->name == 'manager' ): ?>
                                                            <a href="<?php echo e(route('admin.user.show', $user->id)); ?>"><?php echo e($user->phone1); ?></a>
                                                            <?php endif; ?>
                                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                                </p> 
                                            </div>
                                        <div class="profile-userbuttons">
                                        <a href="<?php echo e(url('particular-branch/'.$branch->id.'/farmers')); ?>" style="padding: 10px 90px;" class="btn btn-circle deepPink-bgcolor btn-lg">View</a>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </div>
            </div>
        </div>
    </div>
<?php $__env->stopSection(); ?>

<?php $__env->startPush('js'); ?>
    <!-- data tables -->
    <script src="<?php echo e(asset('admin/assets/plugins/datatables/jquery.dataTables.min.js')); ?>"></script>
    <script src="<?php echo e(asset('admin/assets/plugins/datatables/plugins/bootstrap/dataTables.bootstrap4.min.js')); ?>" ></script>
    <script src="<?php echo e(asset('admin/assets/js/pages/table/table_data.js')); ?>" ></script>

    <!-- sweet aleart -->
    <script src="https://cdn.jsdelivr.net/npm/sweetalert2@8"></script>

    <script type="text/javascript">
    
    function deleteBranch(id) {

        const swalWithBootstrapButtons = Swal.mixin({
            customClass: {
                confirmButton: 'btn btn-success',
                cancelButton: 'btn btn-danger'
            },
            buttonsStyling: false,
            })

            swalWithBootstrapButtons.fire({
            title: 'Are you sure?',
            text: "You won't be able to revert this!",
            type: 'warning',
            showCancelButton: true,
            confirmButtonText: 'Yes, delete it!',
            cancelButtonText: 'No, cancel!',
            reverseButtons: true
            }).then((result) => {
            if (result.value) {
                event.preventDefault();
                document.getElementById("delete-form-"+id).submit();
            } else if (
                // Read more about handling dismissals
                result.dismiss === Swal.DismissReason.cancel
            ) {
                swalWithBootstrapButtons.fire(
                'Cancelled',
                'Your Branch name is safe :)',
                'error'
                )
            }
        })

    }
    
    </script>
<?php $__env->stopPush(); ?>



<?php echo $__env->make('template.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH E:\farm\resources\views/admin/branchinfo/index.blade.php ENDPATH**/ ?>