Files
TimeTrack/templates/admin_teams.html
Jens Luedicke 9a79778ad6 Squashed commit of the following:
commit 1eeea9f83ad9230a5c1f7a75662770eaab0df837
Author: Jens Luedicke <jens@luedicke.me>
Date:   Mon Jul 7 21:15:41 2025 +0200

    Disable resuming of old time entries.

commit 3e3ec2f01cb7943622b819a19179388078ae1315
Author: Jens Luedicke <jens@luedicke.me>
Date:   Mon Jul 7 20:59:19 2025 +0200

    Refactor db migrations.

commit 15a51a569da36c6b7c9e01ab17b6fdbdee6ad994
Author: Jens Luedicke <jens@luedicke.me>
Date:   Mon Jul 7 19:58:04 2025 +0200

    Apply new style for Time Tracking view.

commit 77e5278b303e060d2b03853b06277f8aa567ae68
Author: Jens Luedicke <jens@luedicke.me>
Date:   Mon Jul 7 18:06:04 2025 +0200

    Allow direct registrations as a Company.

commit 188a8772757cbef374243d3a5f29e4440ddecabe
Author: Jens Luedicke <jens@luedicke.me>
Date:   Mon Jul 7 18:04:45 2025 +0200

    Add email invitation feature.

commit d9ebaa02aa01b518960a20dccdd5a327d82f30c6
Author: Jens Luedicke <jens@luedicke.me>
Date:   Mon Jul 7 17:12:32 2025 +0200

    Apply common style for Company, User, Team management pages.

commit 81149caf4d8fc6317e2ab1b4f022b32fc5aa6d22
Author: Jens Luedicke <jens@luedicke.me>
Date:   Mon Jul 7 16:44:32 2025 +0200

    Move export functions to own module.

commit 1a26e19338e73f8849c671471dd15cc3c1b1fe82
Author: Jens Luedicke <jens@luedicke.me>
Date:   Mon Jul 7 15:51:15 2025 +0200

    Split up models.py.

commit 61f1ccd10f721b0ff4dc1eccf30c7a1ee13f204d
Author: Jens Luedicke <jens@luedicke.me>
Date:   Mon Jul 7 12:05:28 2025 +0200

    Move utility function into own modules.

commit 84b341ed35e2c5387819a8b9f9d41eca900ae79f
Author: Jens Luedicke <jens@luedicke.me>
Date:   Mon Jul 7 11:44:24 2025 +0200

    Refactor auth functions use.

commit 923e311e3da5b26d85845c2832b73b7b17c48adb
Author: Jens Luedicke <jens@luedicke.me>
Date:   Mon Jul 7 11:35:52 2025 +0200

    Refactor route nameing and fix bugs along the way.

commit f0a5c4419c340e62a2615c60b2a9de28204d2995
Author: Jens Luedicke <jens@luedicke.me>
Date:   Mon Jul 7 10:34:33 2025 +0200

    Fix URL endpoints in announcement template.

commit b74d74542a1c8dc350749e4788a9464d067a88b5
Author: Jens Luedicke <jens@luedicke.me>
Date:   Mon Jul 7 09:25:53 2025 +0200

    Move announcements to own module.

commit 9563a28021ac46c82c04fe4649b394dbf96f92c7
Author: Jens Luedicke <jens@luedicke.me>
Date:   Mon Jul 7 09:16:30 2025 +0200

    Combine Company view and edit templates.

commit 6687c373e681d54e4deab6b2582fed5cea9aadf6
Author: Jens Luedicke <jens@luedicke.me>
Date:   Mon Jul 7 08:17:42 2025 +0200

    Move Users, Company and System Administration to own modules.

commit 8b7894a2e3eb84bb059f546648b6b9536fea724e
Author: Jens Luedicke <jens@luedicke.me>
Date:   Mon Jul 7 07:40:57 2025 +0200

    Move Teams and Projects to own modules.

commit d11bf059d99839ecf1f5d7020b8c8c8a2454c00b
Author: Jens Luedicke <jens@luedicke.me>
Date:   Mon Jul 7 07:09:33 2025 +0200

    Move Tasks and Sprints to own modules.
2025-07-07 21:16:36 +02:00

602 lines
15 KiB
HTML

{% extends 'layout.html' %}
{% block content %}
<div class="teams-admin-container">
<!-- Header Section -->
<div class="page-header">
<div class="header-content">
<div class="header-left">
<h1 class="page-title">
<span class="page-icon">👥</span>
Team Management
</h1>
<p class="page-subtitle">Manage teams and their members across your organization</p>
</div>
<div class="header-actions">
<a href="{{ url_for('teams.create_team') }}" class="btn btn-primary">
<span class="icon">+</span>
Create New Team
</a>
</div>
</div>
</div>
<!-- Team Statistics -->
{% if teams %}
<div class="stats-section">
<div class="stat-card">
<div class="stat-value">{{ teams|length if teams else 0 }}</div>
<div class="stat-label">Total Teams</div>
</div>
<div class="stat-card">
<div class="stat-value">{{ teams|map(attribute='users')|map('length')|sum if teams else 0 }}</div>
<div class="stat-label">Total Members</div>
</div>
<div class="stat-card">
<div class="stat-value">{{ (teams|map(attribute='users')|map('length')|sum / teams|length)|round(1) if teams else 0 }}</div>
<div class="stat-label">Avg Team Size</div>
</div>
</div>
{% endif %}
<!-- Main Content -->
<div class="teams-content">
{% if teams %}
<!-- Search Bar -->
<div class="search-section">
<div class="search-container">
<span class="search-icon">🔍</span>
<input type="text"
class="search-input"
id="teamSearch"
placeholder="Search teams by name or description...">
</div>
</div>
<!-- Teams Grid -->
<div class="teams-grid" id="teamsGrid">
{% for team in teams %}
<div class="team-card" data-team-name="{{ team.name.lower() }}" data-team-desc="{{ team.description.lower() if team.description else '' }}">
<div class="team-header">
<div class="team-icon-wrapper">
<span class="team-icon">👥</span>
</div>
<div class="team-meta">
<span class="member-count">{{ team.users|length }} members</span>
</div>
</div>
<div class="team-body">
<h3 class="team-name">{{ team.name }}</h3>
<p class="team-description">
{{ team.description if team.description else 'No description provided' }}
</p>
<div class="team-info">
<div class="info-item">
<span class="info-icon">📅</span>
<span class="info-text">Created {{ team.created_at.strftime('%b %d, %Y') }}</span>
</div>
{% if team.users %}
<div class="info-item">
<span class="info-icon">👤</span>
<span class="info-text">Led by {{ team.users[0].username }}</span>
</div>
{% endif %}
</div>
<!-- Member Avatars -->
{% if team.users %}
<div class="member-avatars">
{% for member in team.users[:5] %}
<div class="member-avatar" title="{{ member.username }}">
{{ member.username[:2].upper() }}
</div>
{% endfor %}
{% if team.users|length > 5 %}
<div class="member-avatar more" title="{{ team.users|length - 5 }} more members">
+{{ team.users|length - 5 }}
</div>
{% endif %}
</div>
{% endif %}
</div>
<div class="team-actions">
<a href="{{ url_for('teams.manage_team', team_id=team.id) }}" class="btn btn-manage">
<span class="icon">⚙️</span>
Manage Team
</a>
<form method="POST"
action="{{ url_for('teams.delete_team', team_id=team.id) }}"
class="delete-form"
onsubmit="return confirm('Are you sure you want to delete the team \"{{ team.name }}\"? This action cannot be undone.');">
<button type="submit" class="btn btn-delete" title="Delete Team">
<span class="icon">🗑️</span>
</button>
</form>
</div>
</div>
{% endfor %}
</div>
<!-- No Results Message -->
<div class="no-results" id="noResults" style="display: none;">
<div class="empty-icon">🔍</div>
<p class="empty-message">No teams found matching your search</p>
<p class="empty-hint">Try searching with different keywords</p>
</div>
{% else %}
<!-- Empty State -->
<div class="empty-state">
<div class="empty-icon">👥</div>
<h2 class="empty-title">No Teams Yet</h2>
<p class="empty-message">Create your first team to start organizing your workforce</p>
<a href="{{ url_for('teams.create_team') }}" class="btn btn-primary btn-lg">
<span class="icon">+</span>
Create First Team
</a>
</div>
{% endif %}
</div>
</div>
<style>
/* Container */
.teams-admin-container {
max-width: 1400px;
margin: 0 auto;
padding: 2rem;
}
/* Page Header */
.page-header {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
border-radius: 16px;
padding: 2rem;
margin-bottom: 2rem;
color: white;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}
.header-content {
display: flex;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
gap: 2rem;
}
.page-title {
font-size: 2rem;
font-weight: 700;
margin: 0;
display: flex;
align-items: center;
gap: 0.75rem;
}
.page-icon {
font-size: 2.5rem;
display: inline-block;
animation: float 3s ease-in-out infinite;
}
@keyframes float {
0%, 100% { transform: translateY(0); }
50% { transform: translateY(-10px); }
}
.page-subtitle {
font-size: 1.1rem;
opacity: 0.9;
margin: 0.5rem 0 0 0;
}
/* Stats Section */
.stats-section {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 1.5rem;
margin-bottom: 2rem;
}
.stat-card {
background: white;
padding: 1.5rem;
border-radius: 12px;
text-align: center;
border: 1px solid #e5e7eb;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
transition: all 0.3s ease;
}
.stat-card:hover {
transform: translateY(-2px);
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}
.stat-value {
font-size: 2.5rem;
font-weight: 700;
margin-bottom: 0.5rem;
color: #667eea;
}
.stat-label {
font-size: 0.9rem;
color: #6b7280;
text-transform: uppercase;
letter-spacing: 0.5px;
font-weight: 600;
}
/* Search Section */
.search-section {
margin-bottom: 2rem;
}
.search-container {
position: relative;
max-width: 500px;
}
.search-icon {
position: absolute;
left: 1rem;
top: 50%;
transform: translateY(-50%);
font-size: 1.25rem;
opacity: 0.6;
}
.search-input {
width: 100%;
padding: 1rem 1rem 1rem 3rem;
border: 2px solid #e5e7eb;
border-radius: 12px;
font-size: 1rem;
transition: all 0.3s ease;
background: white;
}
.search-input:focus {
outline: none;
border-color: #667eea;
box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}
/* Teams Grid */
.teams-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
gap: 1.5rem;
margin-bottom: 2rem;
}
/* Team Card */
.team-card {
background: white;
border-radius: 12px;
border: 1px solid #e5e7eb;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
transition: all 0.3s ease;
overflow: hidden;
display: flex;
flex-direction: column;
}
.team-card:hover {
transform: translateY(-4px);
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}
.team-header {
background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
padding: 1.5rem;
display: flex;
justify-content: space-between;
align-items: center;
}
.team-icon-wrapper {
width: 60px;
height: 60px;
background: white;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
.team-icon {
font-size: 2rem;
}
.member-count {
background: white;
color: #6b7280;
padding: 0.5rem 1rem;
border-radius: 20px;
font-size: 0.875rem;
font-weight: 600;
}
.team-body {
padding: 1.5rem;
flex: 1;
display: flex;
flex-direction: column;
}
.team-name {
font-size: 1.5rem;
font-weight: 700;
color: #1f2937;
margin: 0 0 0.5rem 0;
}
.team-description {
color: #6b7280;
line-height: 1.6;
margin-bottom: 1.5rem;
flex: 1;
}
.team-info {
display: flex;
flex-direction: column;
gap: 0.5rem;
margin-bottom: 1.5rem;
}
.info-item {
display: flex;
align-items: center;
gap: 0.5rem;
color: #6b7280;
font-size: 0.875rem;
}
.info-icon {
font-size: 1rem;
}
/* Member Avatars */
.member-avatars {
display: flex;
margin-bottom: 1rem;
}
.member-avatar {
width: 36px;
height: 36px;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-size: 0.875rem;
font-weight: 600;
margin-right: -8px;
border: 2px solid white;
position: relative;
z-index: 1;
transition: all 0.2s ease;
}
.member-avatar:hover {
transform: scale(1.1);
z-index: 10;
}
.member-avatar.more {
background: #6b7280;
font-size: 0.75rem;
}
/* Team Actions */
.team-actions {
padding: 1.5rem;
background: #f8f9fa;
border-top: 1px solid #e5e7eb;
display: flex;
gap: 0.75rem;
align-items: center;
}
.delete-form {
margin: 0;
}
/* Buttons */
.btn {
padding: 0.75rem 1.5rem;
border: none;
border-radius: 8px;
font-weight: 600;
font-size: 1rem;
cursor: pointer;
transition: all 0.2s ease;
display: inline-flex;
align-items: center;
gap: 0.5rem;
text-decoration: none;
}
.btn-primary {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
}
.btn-primary:hover {
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}
.btn-manage {
background: white;
color: #667eea;
border: 2px solid #e5e7eb;
flex: 1;
justify-content: center;
}
.btn-manage:hover {
background: #f3f4f6;
border-color: #667eea;
}
.btn-delete {
background: #fee2e2;
color: #dc2626;
padding: 0.75rem;
min-width: auto;
}
.btn-delete:hover {
background: #dc2626;
color: white;
}
.btn-lg {
padding: 1rem 2rem;
font-size: 1.1rem;
}
/* Empty State */
.empty-state {
text-align: center;
padding: 4rem 2rem;
background: white;
border-radius: 12px;
border: 2px dashed #e5e7eb;
}
.empty-icon {
font-size: 4rem;
margin-bottom: 1.5rem;
opacity: 0.3;
}
.empty-title {
font-size: 1.75rem;
font-weight: 700;
color: #1f2937;
margin-bottom: 0.5rem;
}
.empty-message {
font-size: 1.1rem;
color: #6b7280;
margin-bottom: 2rem;
}
.empty-hint {
color: #9ca3af;
font-size: 0.875rem;
}
/* No Results */
.no-results {
text-align: center;
padding: 3rem;
}
/* Responsive Design */
@media (max-width: 768px) {
.teams-admin-container {
padding: 1rem;
}
.page-header {
padding: 1.5rem;
}
.page-title {
font-size: 2rem;
}
.header-content {
flex-direction: column;
text-align: center;
}
.header-stats {
grid-template-columns: 1fr;
}
.teams-grid {
grid-template-columns: 1fr;
}
.team-actions {
flex-direction: column;
}
.btn-manage {
width: 100%;
}
}
/* Animations */
@keyframes slideIn {
from {
opacity: 0;
transform: translateY(20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.team-card {
animation: slideIn 0.4s ease-out;
animation-fill-mode: both;
}
.team-card:nth-child(1) { animation-delay: 0.05s; }
.team-card:nth-child(2) { animation-delay: 0.1s; }
.team-card:nth-child(3) { animation-delay: 0.15s; }
.team-card:nth-child(4) { animation-delay: 0.2s; }
.team-card:nth-child(5) { animation-delay: 0.25s; }
.team-card:nth-child(6) { animation-delay: 0.3s; }
</style>
<script>
document.addEventListener('DOMContentLoaded', function() {
const searchInput = document.getElementById('teamSearch');
const teamsGrid = document.getElementById('teamsGrid');
const noResults = document.getElementById('noResults');
if (searchInput && teamsGrid) {
searchInput.addEventListener('input', function() {
const searchTerm = this.value.toLowerCase().trim();
const teamCards = teamsGrid.querySelectorAll('.team-card');
let visibleCount = 0;
teamCards.forEach(card => {
const teamName = card.getAttribute('data-team-name');
const teamDesc = card.getAttribute('data-team-desc');
if (teamName.includes(searchTerm) || teamDesc.includes(searchTerm)) {
card.style.display = '';
visibleCount++;
} else {
card.style.display = 'none';
}
});
// Show/hide no results message
if (noResults) {
noResults.style.display = visibleCount === 0 ? 'block' : 'none';
}
});
}
});
</script>
{% endblock %}