<?php $__env->startSection('style'); ?>
    <link href="<?php echo e(asset('js/advanced-datatable/css/demo_page.css')); ?>" rel="stylesheet" />
    <link href="<?php echo e(asset('js/advanced-datatable/css/demo_table.css')); ?>" rel="stylesheet" />
    <link rel="stylesheet" href="<?php echo e(asset('js/data-tables/DT_bootstrap.css')); ?>" />
    <?php $__env->stopSection(); ?>


<?php $__env->startSection('content'); ?>
        <!--body wrapper start-->
    <div class="wrapper">
           <?php echo $__env->make('partials.message', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>

        <div class="row">
            <div class="col-sm-12">
                <section class="panel">
                    <header class="panel-heading">
                        <?php echo e(trans('ui.windows.names')); ?>

                        <span class="tools pull-right">
                          <a href="javascript:;" class="fa fa-chevron-down"></a>
                         </span>
                    </header>
                    <div class="panel-body">
                        <?php if(Auth::user() -> can(['create-windows'])): ?>
                            <a href="<?php echo e(url('ventanilla/create')); ?>" class="pull-right"><button class="btn btn-primary" style="margin-bottom: 1em;" type="button"><i class="fa fa-plus-circle"></i> <?php echo e(trans("ui.windows.button_add")); ?></button></a>
                        <?php endif; ?>

                        <?php foreach($sucursales as $key => $sucursal): ?>
                            <div class="row">
                                <div class="col-sm-12">
                                    <section class="panel">
                                        <header class="panel-heading">
                                            Sucursal <?php echo e($sucursal -> nombre); ?>

                                        </header>
                                        <div class="panel-body">

                                            <table class="display table table-bordered table-striped" >
                                                <thead>
                                                <tr>
                                                    <th><?php echo e(trans('ui.windows.name')); ?></th>
                                                    <?php if(Auth::user()->can(['update-windows', 'delete-windows'])): ?>
                                                        <th><?php echo e(trans('ui.windows.operation_label')); ?></th>
                                                    <?php endif; ?>
                                                </tr>
                                                </thead>
                                                <tbody>
                                                <?php foreach($sucursal -> ventanillas() -> orderBy('nombre','asc') -> get() as $ventanilla): ?>
                                                    <tr>
                                                        <?php if(strlen($ventanilla->nombre) > 10): ?>
                                                            <td style="width: 50%;" title="<?php echo e($ventanilla->nombre); ?>"><?php echo e(str_limit($ventanilla->nombre,10)); ?></td>
                                                        <?php else: ?>
                                                            <td style="width: 50%;"><?php echo e($ventanilla->nombre); ?></td>
                                                        <?php endif; ?>
                                                        <?php if(Auth::user()->can(['update-branches', 'delete-branches'])): ?>
                                                            <td>
                                                                <div class="pull-right windows-wrapper" >
                                                                    <p style="display: inline-block;">
                                                                        <?php if(Auth::user()->can('update-branches')): ?>
                                                                            <a href="<?php echo e(url('ventanilla/' . $ventanilla->id . '/edit')); ?>">
                                                                                <i class="fa fa-refresh"></i>
                                                                            </a>
                                                                        <?php endif; ?>

                                                                        <?php if(Auth::user()->can('delete-branches')): ?>
                                                                                <?php echo Form::open(['url' => 'ventanilla/'. $ventanilla->id, 'method' => 'delete','style'=>'display:inline-block;']); ?>

                                                                                <button class="delete-button" type="submit"><i class="fa fa-times-circle"></i></button>
                                                                                <?php echo Form::close(); ?>

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

                                                            </td>
                                                        <?php endif; ?>
                                                    </tr>
                                                <?php endforeach; ?>
                                                </tbody>
                                            </table>
                                        </div>
                                    </section>
                                </div>
                            </div>

                        <?php endforeach; ?>









                    </div>
                </section>
            </div>
        </div>
        <?php /*AQUI EMPIEZA*/ ?>



        <?php /*AQUI TERMINA*/ ?>
    </div>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('script'); ?>
        <!--dynamic table-->
    <script type="text/javascript" language="javascript" src="<?php echo e(asset('js/advanced-datatable/js/jquery.dataTables.js')); ?>"></script>
    <script type="text/javascript" src="<?php echo e(asset('js/data-tables/DT_bootstrap.js')); ?>"></script>
    <!--dynamic table initialization -->
    <script src="<?php echo e(asset('js/dynamic_table_init.js')); ?>"></script>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.master', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>