<?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.branches.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-branches'])): ?>
                               <a href="<?php echo e(url('sucursal/create')); ?>" class="pull-right"><button class="btn btn-primary" type="button"><i class="fa fa-plus-circle"></i> <?php echo e(trans("ui.branches.button_add")); ?></button></a>
                           <?php endif; ?>
                           <table class="display table table-bordered table-striped" id="dynamic-table">
                               <thead>
                                    <tr>
                                        <th><?php echo e(trans('ui.branches.name')); ?></th>
                                        <?php if(Auth::user()->can(['update-branches', 'delete-branches'])): ?>
                                            <th><?php echo e(trans('ui.branches.operation_label')); ?></th>
                                        <?php endif; ?>
                                    </tr>
                               </thead>
                               <tbody>
                               <?php foreach($sucursales as $sucursal): ?>
                                   <tr>
                                       <td><?php echo e($sucursal->nombre); ?></td>
                                       <?php if(Auth::user()->can(['update-branches', 'delete-branches'])): ?>
                                           <td>
                                                   <?php if(Auth::user()->can('update-branches')): ?>
                                                       <a href="<?php echo e(url('sucursal/' . $sucursal->id . '/edit')); ?>">
                                                           <i class="fa fa-refresh"></i>
                                                       </a>
                                                   <?php endif; ?>

                                                   <?php if(Auth::user()->can('delete-branches')): ?>
                                                       <?php echo Form::open(['url' => 'sucursal/'. $sucursal->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; ?>
                                           </td>
                                       <?php endif; ?>
                                   </tr>
                               <?php endforeach; ?>
                               </tbody>
                           </table>
                       </div>
                   </section>
               </div>
           </div>
    </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(); ?>