{% extends 'base.html.twig' %}
{% block title %}Módulo {{ modulo.codigo }}{% endblock %}
{% block stylesheets %}
<style>
body {
background-color: transparent !important;
}
</style>
{% endblock %}
{% block body %}
<div class="modal fade" id="nichoDetailModal" tabindex="-1" aria-labelledby="nichoDetailModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="nichoDetailModalLabel"></h5>
{% if app.user %}
<a href="#" class="btn btn-primary" id="aNicho">Editar</a>
{% endif %}
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<p id="nombreNicho"></p>
<p id="codigoNicho"></p>
<p id="estadoNicho"></p>
<p id="descripcionNicho"></p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cerrar</button>
</div>
</div>
</div>
</div>
<div class="container-fluid">
<div class="row">
<div class="col-sm-12 d-flex justify-content-center">
{# <h1 class="text-center">Módulo {{ modulo.codigo }}</h1> #}
<img src="{{ asset(modulo.fullImagePath) }}" usemap="#image-map" alt="cuadros" id="moduloImage" name="moduloImage" class="img-fluid" style="max-height: 600px;">
</div>
</div>
<map name="image-map" id="map">
{% for nicho in nichos %}
<area target="" {% if nicho.estado == "VENDIDO" %}data-maphilight='{"fillColor":"7b7d7d", "fill": true, "fillOpacity":0.7, "alwaysOn": true}' {% endif %} alt="{{ nicho.codigo }}" title="{{ nicho.codigo }}" id="{{ nicho.id }}" href="#" coords="{{ nicho.coordenadas }}" nombre="{{ nicho.nombre}}" estado="{{ nicho.estado }}" descripcion="{{ nicho.descripcion }}" id="{{ nicho.id }}" shape="rect">
{% endfor %}
</map>
<script src="https://code.jquery.com/jquery-3.7.1.min.js" integrity="sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo=" crossorigin="anonymous"></script>
<script>
document.addEventListener('DOMContentLoaded', function() {
const areas = document.querySelectorAll('area');
areas.forEach(area => {
area.addEventListener('click', function(event) {
event.preventDefault();
const nichoCode = this.getAttribute('alt');
const nichoNombre = this.getAttribute('nombre');
const nichoEstado = this.getAttribute('estado');
const nichoDescripcion = this.getAttribute('descripcion');
const nombreNichoContent = document.getElementById('nombreNicho');
nombreNichoContent.innerHTML = `<strong>Nombre:</strong> ${nichoNombre}`;
const codigoNichoContent = document.getElementById('codigoNicho');
codigoNichoContent.innerHTML = `<strong>Código:</strong> ${nichoCode}`;
const estadoNichoContent = document.getElementById('estadoNicho');
estadoNichoContent.innerHTML = `<strong>Estado:</strong> ${nichoEstado}`;
const descripcionNichoContent = document.getElementById('descripcionNicho');
descripcionNichoContent.innerHTML = `<strong>Descripción:</strong> ${nichoDescripcion}`;
{% if app.user %}
const aNichoTag = document.getElementById('aNicho');
aNichoTag.href = `/nicho/${this.id}/edit`;
{% endif %}
const nichoDetailModalLabel = document.getElementById('nichoDetailModalLabel');
nichoDetailModalLabel.textContent = `Nicho ${nichoCode}`;
const modal = new bootstrap.Modal(document.getElementById('nichoDetailModal'));
modal.show();
});
});
});
</script>
<script src="{{ asset('js/image_resizer.js') }}"></script>
<script src="{{ asset('js/jquery.maphilight.min.js') }}"></script>
<script>
imageMapResize();
</script>
<script>$('#moduloImage').maphilight({fill: true, stroke: true, alwaysOn: true});</script>
</div>
{% endblock %}