Files
admin-edu-space/frontend/views/benefits/catalog.html
T

207 lines
12 KiB
HTML

{% extends "base.html" %}
{% block title %}Club de Beneficios & Convenios — UniCABA{% endblock %}
{% block content %}
<div class="container-fluid py-3 px-lg-4">
<!-- Hero / Banner Institucional -->
<div class="card border-0 rounded-4 p-4 p-lg-5 mb-4 shadow-sm text-white position-relative overflow-hidden"
style="background: linear-gradient(135deg, #7E22CE 0%, #B43E8E 50%, #EC4899 100%);">
<div class="position-relative z-1" style="max-width: 680px;">
<span class="badge bg-white text-dark rounded-pill px-3 py-1 fw-bold small text-uppercase mb-2 shadow-sm">
<i class="bi bi-stars text-warning me-1"></i> Comunidad UniCABA
</span>
<h1 class="display-6 fw-bold mb-2">Club de Beneficios &amp; Convenios</h1>
<p class="lead fs-6 mb-3 opacity-90">Aprovecha descuentos exclusivos en cafeterías, librerías, tecnología y comercios presentando tu credencial universitaria digital.</p>
<div class="d-flex flex-wrap gap-2">
<a href="/credential/my-card" class="btn btn-light btn-sm rounded-pill px-4 fw-semibold text-primary shadow-sm">
<i class="bi bi-qr-code me-1"></i> Abrir Mi Credencial QR
</a>
{% if canManage %}
<a href="/benefits/manage" class="btn btn-outline-light btn-sm rounded-pill px-3">
<i class="bi bi-gear me-1"></i> Gestionar Convenios (Bedelía)
</a>
{% endif %}
</div>
</div>
<div class="position-absolute end-0 bottom-0 opacity-25 d-none d-md-block pe-4 pb-2">
<i class="bi bi-bag-heart-fill" style="font-size: 14rem;"></i>
</div>
</div>
<!-- Barra de Búsqueda y Filtros de Categoría -->
<div class="card border-0 shadow-sm rounded-4 p-3 mb-4">
<form method="GET" action="/benefits" class="row g-2 align-items-center">
<div class="col-md-5 col-12">
<div class="input-group">
<span class="input-group-text bg-transparent border-end-0 text-muted"><i class="bi bi-search"></i></span>
<input type="text" name="search" class="form-control border-start-0 ps-0" placeholder="Buscar por cafetería, librería o descuento..." value="{{ searchQuery }}">
</div>
</div>
<div class="col-md-7 col-12">
<div class="d-flex flex-wrap gap-1 align-items-center justify-content-md-end">
<a href="/benefits{% if searchQuery %}?search={{ searchQuery }}{% endif %}" class="btn btn-sm rounded-pill px-3 {% if not currentCategory %}btn-primary{% else %}btn-outline-secondary{% endif %}">
Todos
</a>
{% for cat in categories %}
<a href="/benefits?category={{ cat }}{% if searchQuery %}&search={{ searchQuery }}{% endif %}" class="btn btn-sm rounded-pill px-3 {% if currentCategory == cat %}btn-primary{% else %}btn-outline-secondary{% endif %}">
{% if cat == 'GASTRONOMIA' %}☕ Cafetería
{% elif cat == 'LIBRERIA' %}📚 Librería
{% elif cat == 'TECNOLOGIA' %}💻 Tecnología
{% elif cat == 'SALUD_DEPORTE' %}🏋️ Salud &amp; Deportes
{% elif cat == 'IDIOMAS' %}🌍 Idiomas
{% elif cat == 'CULTURA' %}🎭 Cultura
{% else %}🏷️ {{ cat }}
{% endif %}
</a>
{% endfor %}
</div>
</div>
</form>
</div>
<!-- Grilla de Tarjetas de Beneficios -->
<div class="row g-4" id="benefitsGrid">
{% if benefits and benefits | length > 0 %}
{% for b in benefits %}
<div class="col-12 col-md-6 col-xl-4">
<div class="card border-0 shadow-sm rounded-4 h-100 overflow-hidden benefit-card transition-all" style="transition: transform 0.2s ease, box-shadow 0.2s ease;">
<div class="card-body p-4 d-flex flex-column justify-content-between">
<div>
<!-- Header de Tarjeta -->
<div class="d-flex align-items-start justify-content-between gap-2 mb-3">
<div class="d-flex align-items-center gap-3">
<div class="rounded-4 p-2 bg-primary-subtle text-primary d-flex align-items-center justify-content-center shadow-sm" style="width: 48px; height: 48px;">
{% if b.category == 'GASTRONOMIA' %}
<i class="bi bi-cup-hot fs-4"></i>
{% elif b.category == 'LIBRERIA' %}
<i class="bi bi-book fs-4"></i>
{% elif b.category == 'TECNOLOGIA' %}
<i class="bi bi-laptop fs-4"></i>
{% elif b.category == 'SALUD_DEPORTE' %}
<i class="bi bi-heart-pulse fs-4"></i>
{% else %}
<i class="bi bi-tag fs-4"></i>
{% endif %}
</div>
<div>
<span class="badge bg-secondary-subtle text-secondary-emphasis rounded-pill px-2 py-0 small mb-1">
{{ b.category }}
</span>
<h5 class="fw-bold mb-0 text-dark">{{ b.partner_name }}</h5>
</div>
</div>
<span class="badge bg-danger text-white rounded-pill px-3 py-2 fw-bold fs-6 shadow-sm">
{{ b.discount_label }}
</span>
</div>
<h6 class="fw-semibold text-primary mb-2">{{ b.title }}</h6>
<p class="text-muted small mb-3" style="min-height: 40px;">
{{ b.description or 'Presenta tu credencial universitaria en caja para aplicar el beneficio acordado.' }}
</p>
</div>
<!-- Footer de Tarjeta -->
<div class="pt-3 border-top border-light-subtle d-flex align-items-center justify-content-between">
<span class="text-muted small">
<i class="bi bi-geo-alt-fill text-danger me-1"></i>{{ b.building_name or 'Todas las Sedes' }}
</span>
<button type="button" class="btn btn-primary btn-sm rounded-pill px-3 shadow-sm"
onclick='openRedeemModal({{ b | tojson | safe }})'>
<i class="bi bi-ticket-perforated me-1"></i> Ver Beneficio
</button>
</div>
</div>
</div>
</div>
{% endfor %}
{% else %}
<div class="col-12 py-5 text-center text-muted">
<i class="bi bi-tags display-3 text-secondary opacity-50 mb-3 d-block"></i>
<h5>No se encontraron promociones en esta categoría</h5>
<p class="small text-muted mb-3">Intenta cambiar los filtros de búsqueda o consulta a UdeCi para conocer próximos convenios.</p>
<a href="/benefits" class="btn btn-outline-primary btn-sm rounded-pill px-4">Ver Todos los Beneficios</a>
</div>
{% endif %}
</div>
</div>
<!-- Modal de Detalle y Canje -->
<div class="modal fade" id="redeemModal" tabindex="-1" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content border-0 shadow-lg rounded-4 overflow-hidden">
<div class="modal-header bg-primary text-white py-3 px-4">
<h5 class="modal-title fw-bold" id="redeemTitle">Detalle del Beneficio</h5>
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body p-4 text-center">
<div class="rounded-circle bg-danger-subtle text-danger mx-auto d-flex align-items-center justify-content-center mb-3" style="width: 72px; height: 72px;">
<i class="bi bi-gift-fill fs-2"></i>
</div>
<h4 class="fw-bold mb-1" id="redeemPartner">Comercio</h4>
<div class="badge bg-danger fs-5 px-3 py-1 rounded-pill mb-3" id="redeemDiscount">20% OFF</div>
<p class="text-muted small px-3 mb-3" id="redeemDesc"></p>
<div class="p-3 bg-light rounded-4 border mb-3 text-start" id="couponBox">
<div class="small text-muted text-uppercase fw-bold mb-1">Cupón de Descuento</div>
<div class="d-flex align-items-center justify-content-between">
<code class="fs-5 fw-bold text-primary" id="redeemCoupon">UNICABA-20</code>
<button type="button" class="btn btn-sm btn-outline-primary rounded-pill px-3" onclick="copyCoupon()">
<i class="bi bi-copy me-1"></i> Copiar
</button>
</div>
</div>
<div class="alert alert-info rounded-4 small text-start mb-3">
<i class="bi bi-info-circle-fill me-1"></i> <strong>¿Cómo usar este beneficio?</strong>
<div class="mt-1" id="redeemTerms">Presenta tu Credencial Universitaria Digital UniCABA al momento de solicitar la cuenta o pagar en caja.</div>
</div>
<a href="/credential/my-card" class="btn btn-outline-primary rounded-pill w-100 py-2 fw-semibold">
<i class="bi bi-qr-code me-1"></i> Mostrar Mi Credencial QR al Comercio
</a>
</div>
</div>
</div>
</div>
<script>
function openRedeemModal(b) {
document.getElementById('redeemTitle').innerText = b.title;
document.getElementById('redeemPartner').innerText = b.partner_name;
document.getElementById('redeemDiscount').innerText = b.discount_label;
document.getElementById('redeemDesc').innerText = b.description || 'Promoción exclusiva para la comunidad universitaria de UniCABA.';
document.getElementById('redeemTerms').innerText = b.terms_conditions || 'Válido presentando tu credencial digital con código QR.';
const couponBox = document.getElementById('couponBox');
if (b.coupon_code) {
couponBox.style.display = 'block';
document.getElementById('redeemCoupon').innerText = b.coupon_code;
} else {
couponBox.style.display = 'none';
}
const modal = new bootstrap.Modal(document.getElementById('redeemModal'));
modal.show();
}
function copyCoupon() {
const code = document.getElementById('redeemCoupon').innerText;
if (navigator.clipboard) {
navigator.clipboard.writeText(code).then(() => {
alert('¡Código de cupón copiado al portapapeles!');
});
}
}
</script>
<style>
.benefit-card:hover {
transform: translateY(-4px);
box-shadow: 0 12px 28px rgba(0,0,0,0.08) !important;
}
</style>
{% endblock %}