<?php $__env->startSection('content'); ?>
<div class="content-wrapper">
	<section class="content-header">
		<h1>
		Bloqueos
		</h1>
	</section>

	<section class="content">
		<div class="row">
			<div class="col-md-12">
				<?php echo $__env->make('alert.success', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
				<?php if(Auth::user()->role->role_permission('create_events')): ?>
				<a href="<?php echo e(asset('/blocks/'.$boat_id.'/create')); ?>" type="button" class="btn btn-success btn-flat margin">	<?php echo e(trans('general.nuevo')); ?>  Bloqueo </a>
				<?php endif; ?>
				<div class="box box-success">
					<div class="box-header">
						<h3 class="box-title">Lista de Bloqueos</h3>
					</div>
					<div class="box-body table-responsive no-padding">
						<table class="table table-hover">
							<tr>
								<th>Fecha </th>
								<th>Razón</th>
								<th>Embarcación</th>
								<th>Schedule</th>
								<?php if(Auth::user()->role->role_permission('edit_events') || Auth::user()->role->role_permission('delete_events')): ?>
								<th><?php echo e(trans('general.accion')); ?></th>
								<?php endif; ?>
							</tr>
							<?php foreach($blocks as $block): ?>
								<tr>
									<td><?php echo e(Carbon\Carbon::parse($block->day)->format('d/m/Y')); ?></td>
									<?php if( $block->reason == 'L'): ?>
									<td>Limpieza</td>
									<?php elseif($block->reason == 'M'): ?>
									<td>Mantenimiento</td>
									<?php elseif($block->reason == 'F'): ?>
									<td>Formación</td>
									<?php endif; ?>

									<?php if(!empty($block->boat)): ?>
										<td><?php echo e($block->boat->name); ?></td>
									<?php else: ?>
										<td><?php echo e($block->boat_id); ?></td>
									<?php endif; ?>

									<?php if(!empty($block->schedule)): ?>
										<td><?php echo e($block->schedule->name); ?></td>
									<?php else: ?>
										<td> </td>
									<?php endif; ?>
									<?php if(Auth::user()->role->role_permission('edit_events') || Auth::user()->role->role_permission('delete_events')): ?>
									<td>
										<div class="btn-group">
											<?php if(Auth::user()->role->role_permission('delete_events')): ?>
											<a type="button" class="btn btn-default btn-flat btn-sm" title="Delete" data-toggle="modal" data-target="#deleteModal<?php echo e($block->id); ?>"><i class="fa fa-trash"></i></a>
											<div id="deleteModal<?php echo e($block->id); ?>" class="modal fade" role="dialog">
												<div class="modal-dialog">
												<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"><?php echo e(trans('general.deleteconfirm')); ?></h4>
												</div>
												<div class="modal-body">
												<p><?php echo e(trans('general.delete')); ?></p>
												</div>
												<div class="modal-footer">
												<button type="button" class="btn btn-default btn-flat pull-left" data-dismiss="modal"><?php echo e(trans('general.cancel')); ?></button>
												<?php echo Form::open(['url' => ['blocks/'.$block->id], 'method' => 'delete']); ?>

												<?php echo Form::submit(trans('general.si'), ['class' => 'btn btn-success btn-flat']); ?>

												<?php echo Form::close(); ?>

												</div>
												</div>
												</div>
											</div>
											<?php endif; ?>
										</div>
									</td>
									<?php endif; ?>
								</tr>
							<?php endforeach; ?>
						</table>
					</div>
					<div class="box-footer clearfix">
						<div class="row">
							<div class="col-xs-12">
								<?php echo e(trans('general.mostrando')); ?> <?php echo e($blocks->firstItem()); ?> <?php echo e(trans('general.de')); ?> <?php echo e($blocks->lastItem()); ?> <?php echo e(trans('general.de')); ?> <?php echo e($blocks->total()); ?> <?php echo e(trans('general.registros')); ?>

								<div class="pull-right">
								<?php echo $blocks->links(); ?>

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

<?php echo $__env->make(Auth::check() && Auth::user()->role->layout == 1 ? 'layouts.admin' : 'layouts.employee', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>