<?php $__env->startSection('css'); ?>
<?php echo HTML::style('//cdn.datatables.net/1.10.11/css/jquery.dataTables.min.css'); ?>

<?php echo HTML::style('css/back/panel.css'); ?>

<?php echo HTML::style('css/back/dataTable.css'); ?>

<?php $__env->stopSection(); ?>

<?php $__env->startSection('body'); ?>
<?php echo HTML::script('js/back/custom.js'); ?>

<?php $__env->stopSection(); ?>

<?php $__env->startSection('content'); ?>
<h3>Listado de financiadores.</h3>
<hr>

<table class="table hover order-column compact" id="panelTable">
   <thead>
      <tr>
         <td>
            Nombre
         </td>
         <td>
            Dirección web
         </td>
         <td>
            Imagen
         </td>
         <td>
            Acciones
         </td>
      </tr>
   </thead>
   <tbody>
      <?php foreach($funderList as $funder): ?>
      <tr>
         <td>
            <?php echo e($funder->getName()); ?>

         </td>
         <td>
            <?php if( $funder->getUrl() ): ?>
            <a data-toggle="tooltip" data-placement="top" title="Click para abrir ir al enlace" href="<?php echo e($funder->getUrl()); ?>" target="_blank">
               <?php echo e($funder->getUrl()); ?>

            </a>
            <?php else: ?>
            Sin url
            <?php endif; ?>
         </td>
         <td>
            <?php if( $funder->getImage() ): ?>
            <img class="image-for-viewer" title="Click para ver imagen a tamaño original" data-toggle="tooltip" data-placement="top" style="max-height: 25px;" class="img-responsive" src="<?php echo e(asset($funder->getImage())); ?>">
            <?php else: ?>
            Sin foto
            <?php endif; ?>
         </td>
         <td style="text-align: center">
            <a class="action" href="<?php echo e(route('panel/social/funders/edit',[ 'id' =>  $funder->getId()])); ?>" data-toggle="tooltip" data-placement="top" title="Editar este elemento">
               <button type="button" class="btn btn-xs btn-default btn-flat">
                  <i class="fa fa-pencil"></i>
               </button>
            </a>
            <button type="button" data-toggle="modal" data-product_id="<?php echo e($funder->getId()); ?>" data-product_name="<?php echo e($funder->getName()); ?>" class="btn btn-xs btn-default btn-flat" data-target="#confirmDelete">
               <span data-toggle="tooltip" data-placement="top" title="Borrar este elemento">
                  <i class="fa fa-trash"></i>
               </span>
            </button>
         </td>
      </tr>
      <?php endforeach; ?>
   </tbody>
</table>
<!-- Button trigger modal -->
<!-- Modal -->
<div class="modal fade" id="confirmDelete" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
   <div class="modal-dialog" role="document">
      <div class="modal-content">
         <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
            <h4 class="modal-title" id="myModalLabel">Borrar Financiador</h4>
         </div>
         <div class="modal-body">
            ¿ Seguro que desea borrar el financiador: <span id="mName"></span> ?
         </div>
         <div class="modal-footer">
            <?php echo Form::open(array('route'=>'panel/social/funders/remove', 'method'=>'POST')); ?>

            <input type="hidden" name="removeId" id="removeId">
            <button type="submit" class="btn btn-primary" data-toggle="tooltip" data-placement="top" title="Sí, borrar este elemento">Borrar</button>
            <span>
               <button type="button" data-toggle="tooltip" data-placement="top" title="Cerrar y no borrar nada" class="btn btn-default" data-dismiss="modal">Cerrar</button>
            </span>
            </form>

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

<?php $__env->startSection('scripts'); ?>
<?php echo HTML::script('//cdn.datatables.net/1.10.11/js/jquery.dataTables.min.js'); ?>

<script>
   $(document).ready(function () {
      $('#panelTable').dataTable({
         "lengthMenu": [[15, 25, 50, -1], [15, 25, 50, "Todo"]],
         "language": {
            "url": "//cdn.datatables.net/plug-ins/1.10.9/i18n/Spanish.json"
         },
         "columns": [
            null,
            {"width": "13%"},
            {"width": "7%"},
            {"width": "5%"}
         ]
      });
      //triggered when modal is about to be shown
      $('#confirmDelete').on('show.bs.modal', function (e) {
         //get data-id attribute of the clicked element
         var productId = $(e.relatedTarget).data('product_id');
         var productName = $(e.relatedTarget).data('product_name');
         $("#confirmDelete #mName").html(productName);
         $("#confirmDelete #removeId").val(productId);//e.g. 'domainname/products/' + productId
      });
   });
</script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.backBase', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>