1034 lines
26 KiB
HTML
1034 lines
26 KiB
HTML
{% extends "base_authenticated.html" %}
|
|
|
|
{% block title %}{{ project.name }} - QR Codes{% endblock %}
|
|
|
|
{% block extra_head %}
|
|
<link rel="stylesheet" href="{{ url_for('static', filename='css/dashboard.css') }}">
|
|
<style>
|
|
.project-qr-page {
|
|
max-width: 1400px;
|
|
margin: 0 auto;
|
|
padding: var(--spacing-6);
|
|
}
|
|
|
|
.project-qr-header {
|
|
background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
|
|
border: 1px solid var(--gray-200);
|
|
border-radius: var(--radius-xl);
|
|
padding: var(--spacing-6);
|
|
margin-bottom: var(--spacing-6);
|
|
}
|
|
|
|
.project-qr-header-content {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: var(--spacing-4);
|
|
margin-bottom: var(--spacing-4);
|
|
}
|
|
|
|
.project-qr-icon {
|
|
width: 64px;
|
|
height: 64px;
|
|
background: linear-gradient(135deg, var(--primary-color), #1d4ed8);
|
|
border-radius: var(--radius-lg);
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
color: var(--white);
|
|
font-size: 1.75rem;
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
.project-qr-info {
|
|
flex: 1;
|
|
}
|
|
|
|
.project-qr-title {
|
|
font-size: var(--font-size-2xl);
|
|
font-weight: 700;
|
|
color: var(--gray-900);
|
|
margin: 0 0 var(--spacing-2) 0;
|
|
}
|
|
|
|
.project-qr-description {
|
|
color: var(--gray-600);
|
|
font-size: var(--font-size-base);
|
|
margin: 0;
|
|
}
|
|
|
|
.project-qr-stats {
|
|
display: flex;
|
|
gap: var(--spacing-6);
|
|
padding-top: var(--spacing-4);
|
|
border-top: 1px solid var(--gray-200);
|
|
}
|
|
|
|
.project-qr-stat {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: var(--spacing-2);
|
|
color: var(--gray-600);
|
|
font-size: var(--font-size-sm);
|
|
}
|
|
|
|
.project-qr-stat i {
|
|
color: var(--primary-color);
|
|
}
|
|
|
|
.project-qr-stat strong {
|
|
color: var(--gray-900);
|
|
font-weight: 600;
|
|
}
|
|
|
|
.back-button {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: var(--spacing-2);
|
|
padding: 0.625rem 1.25rem;
|
|
background: var(--white);
|
|
border: 1px solid var(--gray-300);
|
|
border-radius: var(--radius-lg);
|
|
color: var(--gray-700);
|
|
text-decoration: none;
|
|
font-weight: 500;
|
|
transition: var(--transition);
|
|
}
|
|
|
|
.back-button:hover {
|
|
background: var(--gray-50);
|
|
border-color: var(--primary-color);
|
|
color: var(--primary-color);
|
|
}
|
|
|
|
.pagination-container {
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
gap: var(--spacing-4);
|
|
margin-top: var(--spacing-6);
|
|
padding: var(--spacing-4);
|
|
background: var(--white);
|
|
border: 1px solid var(--gray-200);
|
|
border-radius: var(--radius-lg);
|
|
}
|
|
|
|
.pagination {
|
|
display: flex;
|
|
gap: var(--spacing-2);
|
|
list-style: none;
|
|
padding: 0;
|
|
margin: 0;
|
|
}
|
|
|
|
.pagination li a,
|
|
.pagination li span {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
min-width: 40px;
|
|
height: 40px;
|
|
padding: 0 var(--spacing-3);
|
|
border: 1px solid var(--gray-300);
|
|
border-radius: var(--radius-md);
|
|
color: var(--gray-700);
|
|
text-decoration: none;
|
|
font-weight: 500;
|
|
transition: var(--transition);
|
|
}
|
|
|
|
.pagination li a:hover {
|
|
background: var(--primary-color);
|
|
border-color: var(--primary-color);
|
|
color: var(--white);
|
|
}
|
|
|
|
.pagination li.active span {
|
|
background: var(--primary-color);
|
|
border-color: var(--primary-color);
|
|
color: var(--white);
|
|
}
|
|
|
|
.pagination li.disabled span {
|
|
opacity: 0.5;
|
|
cursor: not-allowed;
|
|
}
|
|
|
|
.pagination-info {
|
|
color: var(--gray-600);
|
|
font-size: var(--font-size-sm);
|
|
}
|
|
|
|
.project-qr-grid {
|
|
display: grid;
|
|
grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
|
|
gap: var(--spacing-4);
|
|
margin-bottom: var(--spacing-6);
|
|
}
|
|
|
|
.qr-card {
|
|
background: var(--white);
|
|
border: 1px solid var(--gray-200);
|
|
border-radius: var(--radius-lg);
|
|
padding: var(--spacing-4);
|
|
transition: var(--transition);
|
|
cursor: pointer;
|
|
position: relative;
|
|
}
|
|
|
|
.qr-card:hover {
|
|
border-color: var(--primary-color);
|
|
box-shadow: 0 4px 12px rgba(37, 99, 235, 0.1);
|
|
transform: translateY(-2px);
|
|
}
|
|
|
|
.qr-card.inactive {
|
|
opacity: 0.7;
|
|
background: linear-gradient(135deg, var(--white), #f8fafc);
|
|
}
|
|
|
|
.qr-card-layout {
|
|
display: flex;
|
|
gap: var(--spacing-3);
|
|
margin-bottom: var(--spacing-3);
|
|
align-items: flex-start;
|
|
}
|
|
|
|
.qr-preview-large {
|
|
width: 80px;
|
|
height: 80px;
|
|
flex-shrink: 0;
|
|
border-radius: var(--radius-md);
|
|
overflow: hidden;
|
|
border: 2px solid var(--gray-200);
|
|
transition: var(--transition);
|
|
}
|
|
|
|
.qr-preview-large img {
|
|
width: 100%;
|
|
height: 100%;
|
|
object-fit: cover;
|
|
}
|
|
|
|
.qr-card:hover .qr-preview-large {
|
|
border-color: var(--primary-color);
|
|
}
|
|
|
|
.qr-details {
|
|
flex: 1;
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: var(--spacing-1);
|
|
min-width: 0;
|
|
}
|
|
|
|
.qr-name {
|
|
font-size: var(--font-size-sm);
|
|
font-weight: 600;
|
|
color: var(--gray-900);
|
|
margin: 0 0 var(--spacing-1) 0;
|
|
line-height: 1.3;
|
|
}
|
|
|
|
.qr-detail-item {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 0.4rem;
|
|
font-size: var(--font-size-xs);
|
|
color: var(--gray-600);
|
|
min-width: 0;
|
|
}
|
|
|
|
.qr-detail-item i {
|
|
font-size: 0.65rem;
|
|
width: auto;
|
|
flex-shrink: 0;
|
|
color: var(--gray-400);
|
|
}
|
|
|
|
.qr-detail-item span {
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
white-space: nowrap;
|
|
min-width: 0;
|
|
}
|
|
|
|
/* QR Card Actions - ADDED FROM DASHBOARD */
|
|
.qr-card-actions {
|
|
display: flex;
|
|
gap: var(--spacing-1);
|
|
justify-content: flex-start;
|
|
padding-top: var(--spacing-2);
|
|
border-top: 1px solid var(--gray-200);
|
|
margin-top: var(--spacing-2);
|
|
}
|
|
|
|
.qr-action-btn {
|
|
width: 28px;
|
|
height: 28px;
|
|
border-radius: var(--radius-md);
|
|
border: none;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
cursor: pointer;
|
|
transition: var(--transition);
|
|
font-size: 0.75rem;
|
|
text-decoration: none;
|
|
}
|
|
|
|
.qr-action-btn.copy {
|
|
background: rgba(16, 185, 129, 0.1);
|
|
color: #059669;
|
|
}
|
|
|
|
.qr-action-btn.copy:hover {
|
|
background: #059669;
|
|
color: var(--white);
|
|
}
|
|
|
|
.qr-action-btn.link {
|
|
background: rgba(59, 130, 246, 0.1);
|
|
color: #2563eb;
|
|
}
|
|
|
|
.qr-action-btn.link:hover {
|
|
background: #2563eb;
|
|
color: var(--white);
|
|
}
|
|
|
|
.qr-action-btn.download {
|
|
background: rgba(16, 185, 129, 0.1);
|
|
color: #059669;
|
|
}
|
|
|
|
.qr-action-btn.download:hover {
|
|
background: #059669;
|
|
color: var(--white);
|
|
}
|
|
|
|
.qr-action-btn.edit {
|
|
background: rgba(37, 99, 235, 0.1);
|
|
color: var(--primary-color);
|
|
}
|
|
|
|
.qr-action-btn.edit:hover {
|
|
background: var(--primary-color);
|
|
color: var(--white);
|
|
}
|
|
|
|
.qr-action-btn.toggle {
|
|
background: rgba(245, 158, 11, 0.1);
|
|
color: #d97706;
|
|
}
|
|
|
|
.qr-action-btn.toggle:hover {
|
|
background: #d97706;
|
|
color: var(--white);
|
|
}
|
|
|
|
.qr-status-badge {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: var(--spacing-1);
|
|
padding: 0.2rem 0.4rem;
|
|
border-radius: var(--radius-full);
|
|
font-size: 0.65rem;
|
|
font-weight: 500;
|
|
margin-top: var(--spacing-1);
|
|
}
|
|
|
|
.qr-status-badge.active {
|
|
background: rgba(16, 185, 129, 0.1);
|
|
color: #047857;
|
|
}
|
|
|
|
.qr-status-badge.inactive {
|
|
background: rgba(239, 68, 68, 0.1);
|
|
color: #dc2626;
|
|
}
|
|
|
|
.empty-state {
|
|
text-align: center;
|
|
padding: var(--spacing-12) var(--spacing-6);
|
|
background: var(--white);
|
|
border: 2px dashed var(--gray-300);
|
|
border-radius: var(--radius-xl);
|
|
color: var(--gray-500);
|
|
}
|
|
|
|
.empty-state i {
|
|
font-size: 4rem;
|
|
color: var(--gray-400);
|
|
margin-bottom: var(--spacing-4);
|
|
}
|
|
|
|
.empty-state h3 {
|
|
font-size: var(--font-size-xl);
|
|
color: var(--gray-700);
|
|
margin-bottom: var(--spacing-2);
|
|
}
|
|
|
|
/* Modal Styles - CRITICAL FOR CENTERING */
|
|
.modal {
|
|
display: none;
|
|
position: fixed;
|
|
z-index: 2000;
|
|
left: 0;
|
|
top: 0;
|
|
width: 100%;
|
|
height: 100%;
|
|
background-color: rgba(0, 0, 0, 0.5);
|
|
align-items: center;
|
|
justify-content: center;
|
|
animation: fadeIn 0.3s ease;
|
|
}
|
|
|
|
.modal-content {
|
|
background: var(--white);
|
|
border-radius: var(--radius-xl);
|
|
box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
|
|
max-width: 90vw;
|
|
max-height: 90vh;
|
|
overflow: auto;
|
|
animation: slideIn 0.3s ease;
|
|
}
|
|
|
|
.qr-modal-content {
|
|
max-width: 900px;
|
|
width: 90vw;
|
|
max-height: 80vh;
|
|
}
|
|
|
|
.modal-header {
|
|
padding: var(--spacing-6);
|
|
border-bottom: 1px solid var(--gray-200);
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
}
|
|
|
|
.modal-header h3 {
|
|
margin: 0;
|
|
font-size: var(--font-size-xl);
|
|
font-weight: 600;
|
|
color: var(--gray-900);
|
|
}
|
|
|
|
.modal-close {
|
|
background: none;
|
|
border: none;
|
|
font-size: var(--font-size-xl);
|
|
color: var(--gray-500);
|
|
cursor: pointer;
|
|
padding: var(--spacing-2);
|
|
border-radius: var(--radius-md);
|
|
transition: var(--transition);
|
|
}
|
|
|
|
.modal-close:hover {
|
|
background: var(--gray-100);
|
|
color: var(--gray-700);
|
|
}
|
|
|
|
.qr-modal-body {
|
|
padding: var(--spacing-6);
|
|
}
|
|
|
|
.qr-modal-layout {
|
|
display: grid;
|
|
grid-template-columns: 300px 1fr;
|
|
gap: var(--spacing-8);
|
|
align-items: start;
|
|
}
|
|
|
|
.qr-modal-image {
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
gap: var(--spacing-4);
|
|
}
|
|
|
|
.qr-modal-image img {
|
|
width: 280px;
|
|
height: 280px;
|
|
border: 3px solid var(--gray-200);
|
|
border-radius: var(--radius-lg);
|
|
background: var(--white);
|
|
padding: var(--spacing-2);
|
|
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
|
|
}
|
|
|
|
.qr-modal-info {
|
|
flex: 1;
|
|
min-width: 0;
|
|
}
|
|
|
|
.qr-detail-section {
|
|
background: #f8fafc;
|
|
border: 1px solid var(--gray-200);
|
|
border-radius: var(--radius-lg);
|
|
padding: var(--spacing-6);
|
|
}
|
|
|
|
.qr-detail-section h4 {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: var(--spacing-2);
|
|
margin: 0 0 var(--spacing-6) 0;
|
|
font-size: var(--font-size-lg);
|
|
font-weight: 600;
|
|
color: var(--primary-color);
|
|
border-bottom: 2px solid var(--primary-color);
|
|
padding-bottom: var(--spacing-2);
|
|
}
|
|
|
|
.qr-detail-section .qr-detail-item {
|
|
display: grid;
|
|
grid-template-columns: 100px 1fr;
|
|
gap: var(--spacing-3);
|
|
margin-bottom: var(--spacing-4);
|
|
align-items: start;
|
|
}
|
|
|
|
.qr-detail-section .qr-detail-item:last-child {
|
|
margin-bottom: 0;
|
|
}
|
|
|
|
.qr-detail-section .qr-detail-item label {
|
|
font-weight: 600;
|
|
color: var(--gray-700);
|
|
font-size: var(--font-size-sm);
|
|
padding-top: 2px;
|
|
}
|
|
|
|
.qr-detail-section .qr-detail-item span {
|
|
color: var(--gray-900);
|
|
font-size: var(--font-size-base);
|
|
line-height: 1.5;
|
|
word-break: break-word;
|
|
}
|
|
|
|
.qr-destination-link a {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: var(--spacing-2);
|
|
color: var(--primary-color);
|
|
text-decoration: none;
|
|
font-weight: 500;
|
|
padding: var(--spacing-2) var(--spacing-3);
|
|
border: 1px solid var(--primary-color);
|
|
border-radius: var(--radius-md);
|
|
transition: var(--transition);
|
|
font-size: var(--font-size-sm);
|
|
}
|
|
|
|
.qr-destination-link a:hover {
|
|
background: var(--primary-color);
|
|
color: var(--white);
|
|
}
|
|
|
|
.qr-modal-footer {
|
|
padding: var(--spacing-6);
|
|
border-top: 1px solid var(--gray-200);
|
|
display: flex;
|
|
gap: var(--spacing-3);
|
|
justify-content: flex-end;
|
|
flex-wrap: wrap;
|
|
background: #f8fafc;
|
|
}
|
|
|
|
.qr-modal-footer .btn {
|
|
min-width: 140px;
|
|
}
|
|
|
|
/* Image Lightbox Styles */
|
|
.image-lightbox {
|
|
display: none;
|
|
position: fixed;
|
|
z-index: 2000;
|
|
left: 0;
|
|
top: 0;
|
|
width: 100%;
|
|
height: 100%;
|
|
background-color: rgba(0, 0, 0, 0.9);
|
|
align-items: center;
|
|
justify-content: center;
|
|
animation: fadeIn 0.3s ease;
|
|
cursor: pointer;
|
|
}
|
|
|
|
.lightbox-content {
|
|
position: relative;
|
|
max-width: 90vw;
|
|
max-height: 90vh;
|
|
text-align: center;
|
|
}
|
|
|
|
.lightbox-image {
|
|
max-width: 100%;
|
|
max-height: 90vh;
|
|
border-radius: var(--radius-lg);
|
|
}
|
|
|
|
.lightbox-close {
|
|
position: absolute;
|
|
top: 20px;
|
|
right: 20px;
|
|
background: var(--white);
|
|
border: none;
|
|
width: 40px;
|
|
height: 40px;
|
|
border-radius: var(--radius-full);
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
cursor: pointer;
|
|
font-size: 1.25rem;
|
|
color: var(--gray-700);
|
|
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
|
|
transition: var(--transition);
|
|
}
|
|
|
|
.lightbox-close:hover {
|
|
background: var(--danger-color);
|
|
color: var(--white);
|
|
}
|
|
|
|
.lightbox-info {
|
|
color: var(--white);
|
|
margin-top: var(--spacing-4);
|
|
font-size: var(--font-size-lg);
|
|
font-weight: 500;
|
|
}
|
|
|
|
.lightbox-hint {
|
|
color: rgba(255, 255, 255, 0.7);
|
|
font-size: var(--font-size-sm);
|
|
margin-top: var(--spacing-2);
|
|
}
|
|
|
|
/* Animation keyframes */
|
|
@keyframes fadeIn {
|
|
from { opacity: 0; }
|
|
to { opacity: 1; }
|
|
}
|
|
|
|
@keyframes slideIn {
|
|
from {
|
|
opacity: 0;
|
|
transform: translateY(-50px);
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
transform: translateY(0);
|
|
}
|
|
}
|
|
|
|
/* Responsive modal styles */
|
|
@media (max-width: 768px) {
|
|
.project-qr-page {
|
|
padding: var(--spacing-4);
|
|
}
|
|
|
|
.project-qr-grid {
|
|
grid-template-columns: 1fr;
|
|
}
|
|
|
|
.pagination-container {
|
|
flex-direction: column;
|
|
gap: var(--spacing-3);
|
|
}
|
|
|
|
.project-qr-stats {
|
|
flex-direction: column;
|
|
gap: var(--spacing-3);
|
|
}
|
|
|
|
.qr-modal-layout {
|
|
grid-template-columns: 1fr;
|
|
gap: var(--spacing-6);
|
|
}
|
|
|
|
.qr-modal-image {
|
|
order: 1;
|
|
}
|
|
|
|
.qr-modal-info {
|
|
order: 2;
|
|
}
|
|
|
|
.qr-modal-image img {
|
|
width: 240px;
|
|
height: 240px;
|
|
}
|
|
|
|
.qr-modal-footer {
|
|
flex-direction: column;
|
|
}
|
|
|
|
.qr-modal-footer .btn {
|
|
width: 100%;
|
|
min-width: unset;
|
|
}
|
|
}
|
|
</style>
|
|
{% endblock %}
|
|
|
|
{% block content %}
|
|
<div class="project-qr-page">
|
|
<!-- Project Header -->
|
|
<div class="project-qr-header">
|
|
<div class="project-qr-header-content">
|
|
<div class="project-qr-icon">
|
|
<i class="fas fa-folder-open"></i>
|
|
</div>
|
|
<div class="project-qr-info">
|
|
<h1 class="project-qr-title">{{ project.name }}</h1>
|
|
{% if project.description %}
|
|
<p class="project-qr-description">{{ project.description }}</p>
|
|
{% endif %}
|
|
</div>
|
|
<a href="{{ url_for('dashboard') }}" class="back-button">
|
|
<i class="fas fa-arrow-left"></i>
|
|
Back to Dashboard
|
|
</a>
|
|
</div>
|
|
|
|
<div class="project-qr-stats">
|
|
<div class="project-qr-stat">
|
|
<i class="fas fa-qrcode"></i>
|
|
<span><strong>{{ pagination.total }}</strong> Total QR Codes</span>
|
|
</div>
|
|
<div class="project-qr-stat">
|
|
<i class="fas fa-check-circle"></i>
|
|
<span><strong>{{ qr_codes|selectattr('active_status', 'equalto', True)|list|length }}</strong> Active</span>
|
|
</div>
|
|
<div class="project-qr-stat">
|
|
<i class="fas fa-pause-circle"></i>
|
|
<span><strong>{{ qr_codes|selectattr('active_status', 'equalto', False)|list|length }}</strong> Inactive</span>
|
|
</div>
|
|
<div class="project-qr-stat">
|
|
<i class="fas fa-file-alt"></i>
|
|
<span>Page <strong>{{ pagination.page }}</strong> of <strong>{{ pagination.pages }}</strong></span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- QR Codes Grid -->
|
|
{% if qr_codes %}
|
|
<div class="project-qr-grid">
|
|
{% for qr in qr_codes %}
|
|
<div class="qr-card {{ 'inactive' if not qr.active_status }}"
|
|
data-qr-id="{{ qr.id }}"
|
|
data-qr-name="{{ qr.name }}"
|
|
data-qr-location="{{ qr.location }}"
|
|
data-qr-address="{{ qr.location_address }}"
|
|
data-qr-event="{{ qr.location_event }}"
|
|
data-qr-url="{{ qr.qr_url if qr.qr_url else '' }}"
|
|
onclick="openQRModalFromData(this)">
|
|
<div class="qr-card-layout">
|
|
<div class="qr-preview-large" onclick="event.stopPropagation(); openImageLightbox(this, '{{ qr.name }}')">
|
|
<img src="data:image/png;base64,{{ qr.qr_code_image }}"
|
|
alt="QR Code for {{ qr.name }}"
|
|
loading="lazy">
|
|
</div>
|
|
|
|
<div class="qr-details">
|
|
<h4 class="qr-name">{{ qr.name }}</h4>
|
|
<div class="qr-detail-item">
|
|
<i class="fas fa-map-marker-alt"></i>
|
|
<span>{{ qr.location }}</span>
|
|
</div>
|
|
|
|
{% if qr.location_address %}
|
|
<div class="qr-detail-item">
|
|
<i class="fas fa-home"></i>
|
|
<span>{{ qr.location_address }}</span>
|
|
</div>
|
|
{% endif %}
|
|
|
|
<div class="qr-detail-item qr-checkins-count">
|
|
<i class="fas fa-users"></i>
|
|
<span>{{ get_qr_code_checkin_count(qr.id) }} check-ins</span>
|
|
</div>
|
|
|
|
{% if qr.qr_url %}
|
|
<div class="qr-detail-item">
|
|
<i class="fas fa-link"></i>
|
|
<span>{{ qr.qr_url[:50] }}{% if qr.qr_url|length > 50 %}...{% endif %}</span>
|
|
</div>
|
|
{% endif %}
|
|
|
|
<span class="qr-status-badge {{ 'active' if qr.active_status else 'inactive' }}">
|
|
<i class="fas {{ 'fa-check-circle' if qr.active_status else 'fa-pause-circle' }}"></i>
|
|
{{ 'Active' if qr.active_status else 'Inactive' }}
|
|
</span>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- QR Card Actions - ADDED ALL BUTTONS -->
|
|
<div class="qr-card-actions">
|
|
<button class="qr-action-btn copy"
|
|
onclick="event.stopPropagation(); copyQRUrl({{ qr.id }})"
|
|
title="Copy QR Code URL">
|
|
<i class="fas fa-copy"></i>
|
|
</button>
|
|
|
|
<button class="qr-action-btn link"
|
|
onclick="event.stopPropagation(); openQRLink({{ qr.id }})"
|
|
title="Open QR Code Link">
|
|
<i class="fas fa-external-link-alt"></i>
|
|
</button>
|
|
|
|
<button class="qr-action-btn download"
|
|
onclick="event.stopPropagation(); downloadQRFromCard(this)"
|
|
title="Download QR Code">
|
|
<i class="fas fa-download"></i>
|
|
</button>
|
|
|
|
<a href="{{ url_for('edit_qr_code', qr_id=qr.id) }}"
|
|
class="qr-action-btn edit"
|
|
onclick="event.stopPropagation()"
|
|
title="Edit QR Code">
|
|
<i class="fas fa-edit"></i>
|
|
</a>
|
|
|
|
{% if session.role == 'admin' %}
|
|
<button class="qr-action-btn toggle"
|
|
onclick="event.stopPropagation(); toggleQRCodeStatus({{ qr.id }})"
|
|
title="{{ 'Deactivate' if qr.active_status else 'Activate' }} QR Code">
|
|
<i class="fas {{ 'fa-pause' if qr.active_status else 'fa-play' }}"></i>
|
|
</button>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
|
|
<!-- Pagination -->
|
|
{% if pagination.pages > 1 %}
|
|
<div class="pagination-container">
|
|
<div class="pagination-info">
|
|
Showing {{ (pagination.page - 1) * pagination.per_page + 1 }} to {{ [pagination.page * pagination.per_page, pagination.total]|min }} of {{ pagination.total }} QR codes
|
|
</div>
|
|
|
|
<ul class="pagination">
|
|
<!-- First Page -->
|
|
<li class="{{ 'disabled' if pagination.page == 1 }}">
|
|
{% if pagination.page == 1 %}
|
|
<span><i class="fas fa-angle-double-left"></i></span>
|
|
{% else %}
|
|
<a href="{{ url_for('project_qr_codes', project_id=project.id, page=1) }}">
|
|
<i class="fas fa-angle-double-left"></i>
|
|
</a>
|
|
{% endif %}
|
|
</li>
|
|
|
|
<!-- Previous Page -->
|
|
<li class="{{ 'disabled' if not pagination.has_prev }}">
|
|
{% if pagination.has_prev %}
|
|
<a href="{{ url_for('project_qr_codes', project_id=project.id, page=pagination.prev_num) }}">
|
|
<i class="fas fa-angle-left"></i>
|
|
</a>
|
|
{% else %}
|
|
<span><i class="fas fa-angle-left"></i></span>
|
|
{% endif %}
|
|
</li>
|
|
|
|
<!-- Page Numbers -->
|
|
{% for page_num in pagination.iter_pages(left_edge=1, right_edge=1, left_current=2, right_current=2) %}
|
|
{% if page_num %}
|
|
{% if page_num == pagination.page %}
|
|
<li class="active">
|
|
<span>{{ page_num }}</span>
|
|
</li>
|
|
{% else %}
|
|
<li>
|
|
<a href="{{ url_for('project_qr_codes', project_id=project.id, page=page_num) }}">
|
|
{{ page_num }}
|
|
</a>
|
|
</li>
|
|
{% endif %}
|
|
{% else %}
|
|
<li class="disabled">
|
|
<span>...</span>
|
|
</li>
|
|
{% endif %}
|
|
{% endfor %}
|
|
|
|
<!-- Next Page -->
|
|
<li class="{{ 'disabled' if not pagination.has_next }}">
|
|
{% if pagination.has_next %}
|
|
<a href="{{ url_for('project_qr_codes', project_id=project.id, page=pagination.next_num) }}">
|
|
<i class="fas fa-angle-right"></i>
|
|
</a>
|
|
{% else %}
|
|
<span><i class="fas fa-angle-right"></i></span>
|
|
{% endif %}
|
|
</li>
|
|
|
|
<!-- Last Page -->
|
|
<li class="{{ 'disabled' if pagination.page == pagination.pages }}">
|
|
{% if pagination.page == pagination.pages %}
|
|
<span><i class="fas fa-angle-double-right"></i></span>
|
|
{% else %}
|
|
<a href="{{ url_for('project_qr_codes', project_id=project.id, page=pagination.pages) }}">
|
|
<i class="fas fa-angle-double-right"></i>
|
|
</a>
|
|
{% endif %}
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% else %}
|
|
<!-- Empty State -->
|
|
<div class="empty-state">
|
|
<i class="fas fa-qrcode"></i>
|
|
<h3>No QR Codes Found</h3>
|
|
<p>This project doesn't have any QR codes yet.</p>
|
|
{% if session.role == 'admin' %}
|
|
<a href="{{ url_for('create_qr_code') }}" class="btn btn-primary" style="margin-top: var(--spacing-4)">
|
|
<i class="fas fa-plus"></i> Create QR Code
|
|
</a>
|
|
{% endif %}
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
|
|
<!-- Image Lightbox (COPIED FROM DASHBOARD) -->
|
|
<div id="imageLightbox" class="image-lightbox" onclick="closeImageLightbox()">
|
|
<div class="lightbox-content" onclick="event.stopPropagation()">
|
|
<button class="lightbox-close" onclick="closeImageLightbox()">
|
|
<i class="fas fa-times"></i>
|
|
</button>
|
|
<img id="lightboxImage" src="" alt="" class="lightbox-image" />
|
|
<div class="lightbox-info" id="lightboxInfo"></div>
|
|
<div class="lightbox-hint">Click anywhere outside the image to close</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Enhanced QR Code Modal (COPIED FROM DASHBOARD) -->
|
|
<div id="qrModal" class="modal" onclick="closeQRModal()">
|
|
<div class="modal-content qr-modal-content" onclick="event.stopPropagation()">
|
|
<div class="modal-header">
|
|
<h3 id="modalTitle">QR Code Details</h3>
|
|
<button class="modal-close" onclick="closeQRModal()">
|
|
<i class="fas fa-times"></i>
|
|
</button>
|
|
</div>
|
|
<div class="modal-body qr-modal-body">
|
|
<div class="qr-modal-layout">
|
|
<div class="qr-modal-image">
|
|
<img id="modalQRImage" src="" alt="QR Code" />
|
|
</div>
|
|
|
|
<div class="qr-modal-info">
|
|
<div class="qr-detail-section">
|
|
<h4><i class="fas fa-qrcode"></i> QR Code Information</h4>
|
|
|
|
<div class="qr-detail-item">
|
|
<label>Name:</label>
|
|
<span id="modalQRName">-</span>
|
|
</div>
|
|
|
|
<div class="qr-detail-item">
|
|
<label>Location:</label>
|
|
<span id="modalQRLocation">-</span>
|
|
</div>
|
|
|
|
<div class="qr-detail-item">
|
|
<label>Address:</label>
|
|
<span id="modalQRAddress">-</span>
|
|
</div>
|
|
|
|
<div class="qr-detail-item">
|
|
<label>Event:</label>
|
|
<span id="modalQREvent">-</span>
|
|
</div>
|
|
|
|
<div class="qr-detail-item">
|
|
<label>QR Destination:</label>
|
|
<span id="modalQRDestination" class="qr-destination-link">
|
|
<a href="#" target="_blank" rel="noopener noreferrer">
|
|
<i class="fas fa-external-link-alt"></i>
|
|
View QR Destination
|
|
</a>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="modal-footer qr-modal-footer">
|
|
<button class="btn btn-primary" onclick="downloadModalQR()">
|
|
<i class="fas fa-download"></i>
|
|
Download QR Code
|
|
</button>
|
|
<button class="btn btn-outline" onclick="copyModalQRData()">
|
|
<i class="fas fa-copy"></i>
|
|
Copy Information
|
|
</button>
|
|
<button class="btn btn-secondary" onclick="copyQRDestination()">
|
|
<i class="fas fa-link"></i>
|
|
Copy QR Link
|
|
</button>
|
|
<button class="btn btn-outline" onclick="closeQRModal()">
|
|
<i class="fas fa-times"></i>
|
|
Close
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
{% endblock %}
|
|
|
|
{% block extra_scripts %}
|
|
<script src="{{ url_for('static', filename='js/dashboard.js') }}"></script>
|
|
|
|
<script>
|
|
// Delete QR Code function for project QR codes page
|
|
function deleteQRCode(qrId, qrName) {
|
|
if (confirm(`Are you sure you want to permanently delete "${qrName}"?\n\nThis action cannot be undone and will remove all associated data.`)) {
|
|
const form = document.createElement('form');
|
|
form.method = 'POST';
|
|
form.action = `/qr-codes/${qrId}/delete`;
|
|
|
|
const csrfToken = document.querySelector('meta[name="csrf-token"]');
|
|
if (csrfToken) {
|
|
const csrfInput = document.createElement('input');
|
|
csrfInput.type = 'hidden';
|
|
csrfInput.name = 'csrf_token';
|
|
csrfInput.value = csrfToken.content;
|
|
form.appendChild(csrfInput);
|
|
}
|
|
|
|
document.body.appendChild(form);
|
|
form.submit();
|
|
}
|
|
}
|
|
|
|
// Ensure all dashboard functions are available
|
|
if (typeof openQRModalFromData === 'undefined') {
|
|
console.warn('openQRModalFromData function not found');
|
|
}
|
|
|
|
if (typeof openImageLightbox === 'undefined') {
|
|
console.warn('openImageLightbox function not found');
|
|
}
|
|
|
|
if (typeof copyQRUrl === 'undefined') {
|
|
console.warn('copyQRUrl function not found');
|
|
}
|
|
|
|
if (typeof openQRLink === 'undefined') {
|
|
console.warn('openQRLink function not found');
|
|
}
|
|
|
|
// Log successful page load
|
|
console.log('✅ Project QR Codes page loaded successfully');
|
|
console.log('📊 Total QR codes on page:', document.querySelectorAll('.qr-card').length);
|
|
console.log('🔘 Action buttons per card: 5 (Copy, Link, Download, Edit, Toggle)');
|
|
</script>
|
|
{% endblock %} |