731 lines
15 KiB
HTML
731 lines
15 KiB
HTML
{% extends "base.html" %}
|
|
{% block title %}Projects - QR Code Management{% endblock %}
|
|
|
|
{% block extra_css %}
|
|
<link rel="stylesheet" href="{{ url_for('static', filename='css/projects.css') }}">
|
|
{% endblock %}
|
|
|
|
{% block content %}
|
|
<div class="projects-page">
|
|
<!-- Page Header -->
|
|
<div class="projects-header">
|
|
<div class="header-content">
|
|
<div class="header-navigation">
|
|
<a href="{{ url_for('dashboard') }}" class="back-button">
|
|
<i class="fas fa-arrow-left"></i>
|
|
<span>Back to Dashboard</span>
|
|
</a>
|
|
</div>
|
|
<h1><i class="fas fa-folder"></i> Projects</h1>
|
|
<p>Organize and manage your QR code projects</p>
|
|
</div>
|
|
<div class="header-actions">
|
|
<a href="{{ url_for('create_project') }}" class="btn btn-primary">
|
|
<i class="fas fa-plus"></i>
|
|
Create Project
|
|
</a>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Project Statistics -->
|
|
<div class="project-stats">
|
|
<div class="stat-card">
|
|
<div class="stat-icon">
|
|
<i class="fas fa-folder"></i>
|
|
</div>
|
|
<div class="stat-info">
|
|
<h3>{{ projects|length }}</h3>
|
|
<p>Total Projects</p>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="stat-card active">
|
|
<div class="stat-icon active">
|
|
<i class="fas fa-folder-open"></i>
|
|
</div>
|
|
<div class="stat-info">
|
|
<h3>{{ projects|selectattr('active_status', 'equalto', True)|list|length }}</h3>
|
|
<p>Active Projects</p>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="stat-card">
|
|
<div class="stat-icon">
|
|
<i class="fas fa-qrcode"></i>
|
|
</div>
|
|
<div class="stat-info">
|
|
<h3>{{ projects|sum(attribute='total_qr_count') }}</h3>
|
|
<p>Total QR Codes</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Projects List -->
|
|
<div class="content-section">
|
|
<div class="section-header">
|
|
<h2><i class="fas fa-list"></i> All Projects</h2>
|
|
</div>
|
|
|
|
{% if projects %}
|
|
<div class="projects-grid">
|
|
{% for project in projects %}
|
|
<div class="project-card {% if not project.active_status %}inactive{% endif %}">
|
|
<div class="project-header">
|
|
<div class="project-info">
|
|
<h3>{{ project.name }}</h3>
|
|
<p class="project-description">
|
|
{% if project.description %}
|
|
{{ project.description[:100] }}{% if project.description|length > 100 %}...{% endif %}
|
|
{% else %}
|
|
No description provided
|
|
{% endif %}
|
|
</p>
|
|
</div>
|
|
<div class="project-status">
|
|
{% if project.active_status %}
|
|
<span class="status-badge active">Active</span>
|
|
{% else %}
|
|
<span class="status-badge inactive">Inactive</span>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
|
|
<div class="project-stats-section">
|
|
<div class="stat-item">
|
|
<i class="fas fa-qrcode"></i>
|
|
<span>{{ project.qr_count }} QR Codes</span>
|
|
</div>
|
|
<div class="stat-item">
|
|
<i class="fas fa-calendar"></i>
|
|
<span>{{ project.created_date.strftime('%b %d, %Y') }}</span>
|
|
</div>
|
|
<div class="stat-item">
|
|
<i class="fas fa-user"></i>
|
|
<span>{{ project.creator.full_name if project.creator else 'Unknown' }}</span>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="project-actions">
|
|
<a href="{{ url_for('edit_project', project_id=project.id) }}"
|
|
class="btn btn-secondary">
|
|
<i class="fas fa-edit"></i>
|
|
Edit
|
|
</a>
|
|
<!-- Activate/Deactivate button (for future use)
|
|
<form method="POST" action="{{ url_for('toggle_project', project_id=project.id) }}"
|
|
style="display: inline;">
|
|
<button type="submit"
|
|
class="btn {% if project.active_status %}btn-warning{% else %}btn-success{% endif %}">
|
|
<i class="fas {% if project.active_status %}fa-pause{% else %}fa-play{% endif %}"></i>
|
|
{% if project.active_status %}Deactivate{% else %}Activate{% endif %}
|
|
</button>
|
|
</form>
|
|
-->
|
|
</div>
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
{% else %}
|
|
<div class="empty-state">
|
|
<div class="empty-icon">
|
|
<i class="fas fa-folder-open"></i>
|
|
</div>
|
|
<h3>No Projects Yet</h3>
|
|
<p>Create your first project to organize your QR codes</p>
|
|
<a href="{{ url_for('create_project') }}" class="btn btn-primary">
|
|
<i class="fas fa-plus"></i>
|
|
Create First Project
|
|
</a>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
{% endblock %}
|
|
|
|
{% block extra_scripts %}
|
|
<script>
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
// Add smooth animations to project cards
|
|
const projectCards = document.querySelectorAll('.project-card');
|
|
|
|
projectCards.forEach((card, index) => {
|
|
card.style.opacity = '0';
|
|
card.style.transform = 'translateY(20px)';
|
|
|
|
setTimeout(() => {
|
|
card.style.transition = 'all 0.5s ease-out';
|
|
card.style.opacity = '1';
|
|
card.style.transform = 'translateY(0)';
|
|
}, index * 100);
|
|
});
|
|
|
|
// Confirm project deactivation/activation
|
|
const toggleForms = document.querySelectorAll('form[action*="toggle_project"]');
|
|
toggleForms.forEach(form => {
|
|
form.addEventListener('submit', function(e) {
|
|
const button = form.querySelector('button');
|
|
const action = button.textContent.trim();
|
|
const projectName = form.closest('.project-card').querySelector('h3').textContent.trim();
|
|
|
|
if (!confirm(`Are you sure you want to ${action.toLowerCase()} the project "${projectName}"?`)) {
|
|
e.preventDefault();
|
|
}
|
|
});
|
|
});
|
|
|
|
// Add loading state to buttons
|
|
const actionButtons = document.querySelectorAll('.project-actions .btn');
|
|
actionButtons.forEach(button => {
|
|
button.addEventListener('click', function() {
|
|
if (this.tagName === 'BUTTON') {
|
|
const originalText = this.innerHTML;
|
|
this.innerHTML = '<i class="fas fa-spinner fa-spin"></i> Processing...';
|
|
this.disabled = true;
|
|
|
|
// Re-enable after form submission (in case of validation errors)
|
|
setTimeout(() => {
|
|
this.innerHTML = originalText;
|
|
this.disabled = false;
|
|
}, 3000);
|
|
}
|
|
});
|
|
});
|
|
});
|
|
</script>
|
|
<style>
|
|
/**
|
|
* Projects Page Dedicated CSS
|
|
* static/css/projects.css
|
|
*
|
|
* This file contains all necessary styles for the projects management page
|
|
* ensuring it works independently with proper layout and responsive design.
|
|
*/
|
|
|
|
/* Projects Page Container */
|
|
.projects-page {
|
|
max-width: 1600px;
|
|
margin: 0 auto;
|
|
padding: 2rem;
|
|
min-height: 100vh;
|
|
background: #f8fafc;
|
|
}
|
|
|
|
/* Page Header */
|
|
.projects-header {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: flex-start;
|
|
margin-bottom: 2rem;
|
|
padding: 1.5rem;
|
|
background: #ffffff;
|
|
border-radius: 0.75rem;
|
|
box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
|
|
position: relative;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.projects-header::before {
|
|
content: "";
|
|
position: absolute;
|
|
top: 0;
|
|
left: 0;
|
|
right: 0;
|
|
height: 4px;
|
|
background: linear-gradient(90deg, #2563eb, #1d4ed8);
|
|
}
|
|
|
|
.header-navigation {
|
|
margin-bottom: 1rem;
|
|
}
|
|
|
|
.back-button {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 0.5rem;
|
|
padding: 0.5rem 1rem;
|
|
background: #f1f5f9;
|
|
color: #475569;
|
|
text-decoration: none;
|
|
border-radius: 0.5rem;
|
|
font-size: 0.875rem;
|
|
font-weight: 500;
|
|
border: 1px solid #cbd5e1;
|
|
transition: all 0.2s ease-in-out;
|
|
}
|
|
|
|
.back-button:hover {
|
|
background: #e2e8f0;
|
|
color: #334155;
|
|
transform: translateX(-2px);
|
|
text-decoration: none;
|
|
}
|
|
|
|
.back-button i {
|
|
font-size: 0.875rem;
|
|
}
|
|
|
|
.header-content h1 {
|
|
font-size: 1.875rem;
|
|
font-weight: 700;
|
|
color: #0f172a;
|
|
margin-bottom: 0.5rem;
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 0.75rem;
|
|
}
|
|
|
|
.header-content h1 i {
|
|
color: #2563eb;
|
|
}
|
|
|
|
.header-content p {
|
|
color: #64748b;
|
|
font-size: 1.125rem;
|
|
margin: 0;
|
|
}
|
|
|
|
.header-actions {
|
|
display: flex;
|
|
gap: 0.75rem;
|
|
}
|
|
|
|
/* Project Statistics Grid */
|
|
.project-stats {
|
|
display: grid;
|
|
grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
|
|
gap: 1.5rem;
|
|
margin-bottom: 2rem;
|
|
}
|
|
|
|
.stat-card {
|
|
background: #ffffff;
|
|
padding: 1.5rem;
|
|
border-radius: 0.75rem;
|
|
box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 1rem;
|
|
transition: all 0.2s ease-in-out;
|
|
border: 1px solid #e2e8f0;
|
|
position: relative;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.stat-card::before {
|
|
content: "";
|
|
position: absolute;
|
|
top: 0;
|
|
left: 0;
|
|
right: 0;
|
|
height: 3px;
|
|
background: linear-gradient(90deg, #2563eb, #1d4ed8);
|
|
}
|
|
|
|
.stat-card:hover {
|
|
transform: translateY(-2px);
|
|
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
|
|
}
|
|
|
|
.stat-card.active::before {
|
|
background: linear-gradient(90deg, #10b981, #047857);
|
|
}
|
|
|
|
.stat-icon {
|
|
width: 50px;
|
|
height: 50px;
|
|
border-radius: 0.5rem;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
font-size: 1.25rem;
|
|
color: #ffffff;
|
|
background: linear-gradient(135deg, #2563eb, #1d4ed8);
|
|
}
|
|
|
|
.stat-icon.active {
|
|
background: linear-gradient(135deg, #10b981, #047857);
|
|
}
|
|
|
|
.stat-info h3 {
|
|
font-size: 1.75rem;
|
|
font-weight: 700;
|
|
color: #0f172a;
|
|
margin-bottom: 0.25rem;
|
|
}
|
|
|
|
.stat-info p {
|
|
color: #64748b;
|
|
font-size: 0.875rem;
|
|
margin: 0;
|
|
}
|
|
|
|
/* Content Section */
|
|
.content-section {
|
|
background: #ffffff;
|
|
border-radius: 0.75rem;
|
|
box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
|
|
overflow: hidden;
|
|
}
|
|
|
|
.section-header {
|
|
padding: 1.5rem;
|
|
border-bottom: 1px solid #e2e8f0;
|
|
background: #f8fafc;
|
|
}
|
|
|
|
.section-header h2 {
|
|
font-size: 1.5rem;
|
|
font-weight: 600;
|
|
color: #0f172a;
|
|
margin: 0;
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 0.5rem;
|
|
}
|
|
|
|
/* Projects Grid */
|
|
.projects-grid {
|
|
display: grid;
|
|
grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
|
|
gap: 1.5rem;
|
|
padding: 1.5rem;
|
|
}
|
|
|
|
.project-card {
|
|
background: #ffffff;
|
|
border: 1px solid #e2e8f0;
|
|
border-radius: 0.75rem;
|
|
padding: 1.5rem;
|
|
transition: all 0.2s ease-in-out;
|
|
position: relative;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.project-card::before {
|
|
content: "";
|
|
position: absolute;
|
|
top: 0;
|
|
left: 0;
|
|
right: 0;
|
|
height: 3px;
|
|
background: linear-gradient(90deg, #2563eb, #1d4ed8);
|
|
}
|
|
|
|
.project-card:hover {
|
|
transform: translateY(-2px);
|
|
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
|
|
border-color: #2563eb;
|
|
}
|
|
|
|
.project-card.inactive {
|
|
opacity: 0.7;
|
|
background: #f8fafc;
|
|
}
|
|
|
|
.project-card.inactive::before {
|
|
background: linear-gradient(90deg, #6b7280, #4b5563);
|
|
}
|
|
|
|
.project-header {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: flex-start;
|
|
margin-bottom: 1rem;
|
|
}
|
|
|
|
.project-info h3 {
|
|
font-size: 1.25rem;
|
|
font-weight: 600;
|
|
color: #0f172a;
|
|
margin-bottom: 0.5rem;
|
|
line-height: 1.4;
|
|
}
|
|
|
|
.project-description {
|
|
color: #64748b;
|
|
font-size: 0.875rem;
|
|
line-height: 1.5;
|
|
margin: 0;
|
|
}
|
|
|
|
.project-status {
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
/* Status Badges */
|
|
.status-badge {
|
|
padding: 0.25rem 0.75rem;
|
|
border-radius: 9999px;
|
|
font-size: 0.75rem;
|
|
font-weight: 500;
|
|
text-transform: uppercase;
|
|
letter-spacing: 0.05em;
|
|
}
|
|
|
|
.status-badge.active {
|
|
background: rgba(16, 185, 129, 0.1);
|
|
color: #047857;
|
|
border: 1px solid rgba(16, 185, 129, 0.2);
|
|
}
|
|
|
|
.status-badge.inactive {
|
|
background: rgba(107, 114, 128, 0.1);
|
|
color: #4b5563;
|
|
border: 1px solid rgba(107, 114, 128, 0.2);
|
|
}
|
|
|
|
/* Project Stats */
|
|
.project-stats-section {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 0.5rem;
|
|
margin-bottom: 1.5rem;
|
|
padding: 1rem;
|
|
background: #f8fafc;
|
|
border-radius: 0.5rem;
|
|
border: 1px solid #e2e8f0;
|
|
}
|
|
|
|
.stat-item {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 0.5rem;
|
|
font-size: 0.875rem;
|
|
color: #64748b;
|
|
}
|
|
|
|
.stat-item i {
|
|
width: 16px;
|
|
color: #2563eb;
|
|
text-align: center;
|
|
}
|
|
|
|
.stat-item span {
|
|
font-weight: 500;
|
|
color: #374151;
|
|
}
|
|
|
|
/* Project Actions */
|
|
.project-actions {
|
|
display: flex;
|
|
gap: 0.5rem;
|
|
justify-content: flex-end;
|
|
flex-wrap: wrap;
|
|
}
|
|
|
|
.project-actions .btn {
|
|
font-size: 0.875rem;
|
|
padding: 0.5rem 1rem;
|
|
border-radius: 0.375rem;
|
|
text-decoration: none;
|
|
border: none;
|
|
cursor: pointer;
|
|
transition: all 0.2s ease-in-out;
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 0.375rem;
|
|
}
|
|
|
|
.project-actions .btn-secondary {
|
|
background: #f1f5f9;
|
|
color: #475569;
|
|
border: 1px solid #cbd5e1;
|
|
}
|
|
|
|
.project-actions .btn-secondary:hover {
|
|
background: #e2e8f0;
|
|
color: #334155;
|
|
}
|
|
|
|
.project-actions .btn-warning {
|
|
background: #fbbf24;
|
|
color: #92400e;
|
|
border: 1px solid #f59e0b;
|
|
}
|
|
|
|
.project-actions .btn-warning:hover {
|
|
background: #f59e0b;
|
|
color: #78350f;
|
|
}
|
|
|
|
.project-actions .btn-success {
|
|
background: #10b981;
|
|
color: #ffffff;
|
|
border: 1px solid #059669;
|
|
}
|
|
|
|
.project-actions .btn-success:hover {
|
|
background: #059669;
|
|
}
|
|
|
|
/* Empty State */
|
|
.empty-state {
|
|
text-align: center;
|
|
padding: 3rem 1.5rem;
|
|
color: #64748b;
|
|
}
|
|
|
|
.empty-icon {
|
|
width: 80px;
|
|
height: 80px;
|
|
margin: 0 auto 1.5rem;
|
|
background: #f1f5f9;
|
|
border-radius: 50%;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
font-size: 2rem;
|
|
color: #94a3b8;
|
|
}
|
|
|
|
.empty-state h3 {
|
|
font-size: 1.5rem;
|
|
font-weight: 600;
|
|
color: #374151;
|
|
margin-bottom: 0.75rem;
|
|
}
|
|
|
|
.empty-state p {
|
|
font-size: 1rem;
|
|
margin-bottom: 1.5rem;
|
|
max-width: 400px;
|
|
margin-left: auto;
|
|
margin-right: auto;
|
|
}
|
|
|
|
.empty-state .btn {
|
|
background: #2563eb;
|
|
color: #ffffff;
|
|
padding: 0.75rem 1.5rem;
|
|
border-radius: 0.5rem;
|
|
text-decoration: none;
|
|
font-weight: 500;
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 0.5rem;
|
|
transition: all 0.2s ease-in-out;
|
|
border: none;
|
|
}
|
|
|
|
.empty-state .btn:hover {
|
|
background: #1d4ed8;
|
|
transform: translateY(-1px);
|
|
}
|
|
|
|
/* Responsive Design */
|
|
@media (max-width: 1024px) {
|
|
.projects-grid {
|
|
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
|
|
gap: 1rem;
|
|
}
|
|
|
|
.project-stats {
|
|
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
|
}
|
|
}
|
|
|
|
@media (max-width: 768px) {
|
|
.projects-page {
|
|
padding: 1rem;
|
|
}
|
|
|
|
.projects-header {
|
|
flex-direction: column;
|
|
align-items: stretch;
|
|
gap: 1rem;
|
|
text-align: center;
|
|
}
|
|
|
|
.header-navigation {
|
|
text-align: left;
|
|
margin-bottom: 0.5rem;
|
|
}
|
|
|
|
.back-button {
|
|
display: inline-flex;
|
|
justify-content: flex-start;
|
|
}
|
|
|
|
.header-actions {
|
|
justify-content: center;
|
|
}
|
|
|
|
.projects-grid {
|
|
grid-template-columns: 1fr;
|
|
padding: 1rem;
|
|
}
|
|
|
|
.project-stats {
|
|
grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
|
|
gap: 1rem;
|
|
}
|
|
|
|
.project-header {
|
|
flex-direction: column;
|
|
align-items: stretch;
|
|
gap: 0.75rem;
|
|
}
|
|
|
|
.project-status {
|
|
align-self: flex-start;
|
|
}
|
|
|
|
.project-actions {
|
|
justify-content: stretch;
|
|
}
|
|
|
|
.project-actions .btn {
|
|
flex: 1;
|
|
justify-content: center;
|
|
}
|
|
|
|
.stat-card {
|
|
padding: 1rem;
|
|
}
|
|
|
|
.stat-icon {
|
|
width: 40px;
|
|
height: 40px;
|
|
font-size: 1rem;
|
|
}
|
|
|
|
.stat-info h3 {
|
|
font-size: 1.5rem;
|
|
}
|
|
}
|
|
|
|
@media (max-width: 480px) {
|
|
.projects-page {
|
|
padding: 0.75rem;
|
|
}
|
|
|
|
.projects-header {
|
|
padding: 1rem;
|
|
}
|
|
|
|
.header-content h1 {
|
|
font-size: 1.5rem;
|
|
}
|
|
|
|
.header-content p {
|
|
font-size: 1rem;
|
|
}
|
|
|
|
.project-stats {
|
|
grid-template-columns: 1fr;
|
|
}
|
|
|
|
.project-card {
|
|
padding: 1rem;
|
|
}
|
|
|
|
.project-stats-section {
|
|
padding: 0.75rem;
|
|
}
|
|
|
|
.stat-item {
|
|
font-size: 0.8125rem;
|
|
}
|
|
}
|
|
</style>
|
|
{% endblock %} |