{% extends "layout.html" %}
{% block title %}Mantenimiento de empresa
{% endblock %}

{% set nav_active = 'configuracion' %}
{% block content %}

	{% if message_success %}
		<div class="alert alert-success alert-dismissible" role="alert">
			{{message_success}}
			<button type="button" class="close" data-dismiss="alert" aria-label="Close">
				<span aria-hidden="true">&times;</span>
			</button>
		</div>
	{% endif %}
	{% if message_error %}
		<div class="alert alert-danger alert-dismissible" role="alert">
			{{message_error}}
			<button type="button" class="close" data-dismiss="alert" aria-label="Close">
				<span aria-hidden="true">&times;</span>
			</button>
		</div>
	{% endif %}

	<div class="box">
		<div class="box-header with-border">
			<h3 class="box-title">Logo de empresa</h3>
			<div class="box-tools pull-right">
				<button class="btn btn-box-tool" data-widget="collapse">
					<i class="fa fa-minus"></i>
				</button>

				<button class="btn btn-box-tool" data-widget="remove">
					<i class="fa fa-times"></i>
				</button>
			</div>
		</div>
		<div class="box-body">
			<div class="row">
				<div class="col-md-12">

					<form action="accion_carrusel.php" method="post" enctype="multipart/form-data">
						<input type="file" name="carrusel">
						<input type="hidden" name="nuevo" value="true">
						<button class="btn btn-verdedark" type="submit" style="margin-top:10px">Agregar</button>
					</form>


					<table class="table" style="margin-top:20px">
						<thead>
							<tr>
								<th>Carousel</th>
								<th>Actualizar</th>
								<th>Eliminar</th>
							</tr>
						</thead>
						<tbody>
							{% for carrusel in carruseles %}
								<tr>
									<td>
										<img src="public/galeria/{{carrusel.url}}" class="figure-img img-fluid" width="300px" alt="Logo de la empresa">
									</td>
									<td>
										<form action="accion_carrusel.php" method="post" enctype="multipart/form-data">
											<input name="carrusel" type="file">
											<input name="id_carrusel" type="hidden" value="{{carrusel.id}}">
											<input name="editar" type="hidden" value="true">
											<button class="btn btn-sm btn-verdedark" type="submit" style="margin-top:10px;">Cambiar</button>
										</form>
									</td>
									<td>
										<button type="button" class="btn btn-sm btn-warning" data-toggle="modal"
    										data-target="#myModal{{carrusel.id}}">
    										Eliminar
    									</button>
    
    									<!-- Modal -->
    									<div class="modal fade" id="myModal{{carrusel.id}}" tabindex="-1" role="dialog"
    										aria-labelledby="myModalLabel{{carrusel.id}}">
    										<div class="modal-dialog" role="document" style="max-width: 350px;">
    											<div class="modal-content">
    												<div class="modal-header" style="padding: 5px 15px">
    													<button type="button" class="close" data-dismiss="modal"
    														aria-label="Close"><span
    															aria-hidden="true">&times;</span></button>
    													<h4 class="modal-title" id="myModalLabel{{carrusel.id}}">Confirmaci&oacute;n</h4>
    												</div>
    												<div class="modal-body" style="font-size: 1.5rem;">
    													¿Estas seguro que deseas eliminar?
    												</div>
    												<div class="modal-footer" style="padding: 5px 15px">
    													<button type="button" class="btn btn-default"
    														data-dismiss="modal">No</button>
    													<a href="accion_carrusel.php?delete={{carrusel.id}}&id_carrusel={{carrusel.id}}" class="btn btn-sm btn-warning">Eliminar</a>
    												</div>
    											</div>
    										</div>
    									</div>
    									<!--/. Modal -->
    									
									</td>
								</tr>
							{% endfor %}
						</tbody>
					</table>

				</div>
			</div>
		</div>
	</div>
{% endblock %}
