Extends the app with friendly form-based management for Teams and Projects — an alternative to using Django admin for routine maintenance. New URLs (admin-only, all return 403 for non-admins): - /teams/ · /teams/new/ · /teams/<id>/ · /teams/<id>/edit/ - /teams/report/ · /teams/report/csv/ - /projects/ + same 5 variants Forms (core/forms.py): - TeamForm — ModelForm with pay-schedule validation (both or neither field) - ProjectForm — ModelForm with end_date >= start_date validation - _supervisor_user_queryset() — admins + Work Logger group members Views (core/views.py): - 10 new views (5 per model: list, detail, edit, batch_report, batch_csv) - _build_team_report_context() / _build_project_report_context() shared helpers - All views gate on is_admin(user) - Reuses existing get_pay_period() for Team detail Pay Schedule tab Templates (core/templates/core/teams/ and projects/): - list.html — filterable table with search - detail.html — tabbed profile / workers / history / schedule - edit.html — serves both /new/ and /edit/ - batch_report.html — lifetime aggregates per row, CSV download UI integration: - Resources dropdown added to top nav (admin-only, Teams + Projects) - Manage All buttons added to Dashboard Manage Resources tabs (Teams, Projects) No model changes, no migrations — purely additive. CLAUDE.md updated with new routes and section describing the pattern. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
148 lines
8.1 KiB
HTML
148 lines
8.1 KiB
HTML
{% load static %}
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>{% block title %}FoxFitt{% endblock %}</title>
|
|
<!-- Bootstrap 5.3 CSS -->
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
|
|
<!-- Google Fonts -->
|
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Poppins:wght@500;600;700&display=swap" rel="stylesheet">
|
|
<!-- Font Awesome 6 -->
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
|
|
<!-- Custom CSS -->
|
|
<link rel="stylesheet" href="{% static 'css/custom.css' %}?v={{ request.timestamp|default:'1.0' }}">
|
|
<style>
|
|
/* Layout helpers — keep body full-height so footer sticks to bottom */
|
|
body { display: flex; flex-direction: column; min-height: 100vh; }
|
|
main { flex-grow: 1; }
|
|
/* Branding — Fox in green, Fitt in white */
|
|
.navbar-brand-fox { color: #10b981; font-weight: 700; }
|
|
.navbar-brand-fitt { color: #ffffff; font-weight: 700; }
|
|
.nav-link { font-weight: 500; }
|
|
.dropdown-menu { border-radius: 8px; box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1); }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<nav class="navbar navbar-expand-lg navbar-dark sticky-top shadow-sm">
|
|
<div class="container">
|
|
<a class="navbar-brand d-flex align-items-center" href="{% url 'home' %}">
|
|
<span class="navbar-brand-fox">Fox</span>
|
|
<span class="navbar-brand-fitt">Fitt</span>
|
|
</a>
|
|
|
|
{% if user.is_authenticated %}
|
|
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
|
|
<span class="navbar-toggler-icon"></span>
|
|
</button>
|
|
<div class="collapse navbar-collapse" id="navbarNav">
|
|
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
|
|
<li class="nav-item">
|
|
<a class="nav-link {% if request.resolver_match.url_name == 'home' %}active{% endif %}" href="{% url 'home' %}">
|
|
<i class="fas fa-home me-1"></i> Dashboard
|
|
</a>
|
|
</li>
|
|
<li class="nav-item">
|
|
<a class="nav-link {% if request.resolver_match.url_name == 'attendance_log' %}active{% endif %}" href="{% url 'attendance_log' %}">
|
|
<i class="fas fa-clipboard-list me-1"></i> Log Work
|
|
</a>
|
|
</li>
|
|
<li class="nav-item">
|
|
<a class="nav-link {% if request.resolver_match.url_name == 'work_history' %}active{% endif %}" href="{% url 'work_history' %}">
|
|
<i class="fas fa-clock me-1"></i> Work History
|
|
</a>
|
|
</li>
|
|
{% if user.is_staff %}
|
|
<li class="nav-item">
|
|
<a class="nav-link {% if request.resolver_match.url_name == 'payroll_dashboard' %}active{% endif %}" href="{% url 'payroll_dashboard' %}">
|
|
<i class="fas fa-wallet me-1"></i> Payroll
|
|
</a>
|
|
</li>
|
|
{% endif %}
|
|
<li class="nav-item">
|
|
<a class="nav-link {% if request.resolver_match.url_name == 'create_receipt' %}active{% endif %}" href="{% url 'create_receipt' %}">
|
|
<i class="fas fa-receipt me-1"></i> Receipts
|
|
</a>
|
|
</li>
|
|
{# === RESOURCES DROPDOWN (admin only) ===
|
|
Friendly management pages for Teams and Projects — an
|
|
alternative to Django admin. Workers will be added here
|
|
when the Workers management UI ships in a later release. #}
|
|
{% if user.is_staff %}
|
|
<li class="nav-item dropdown">
|
|
{% with url_name=request.resolver_match.url_name %}
|
|
<a class="nav-link dropdown-toggle {% if url_name == 'team_list' or url_name == 'team_detail' or url_name == 'team_edit' or url_name == 'team_new' or url_name == 'team_batch_report' or url_name == 'project_list' or url_name == 'project_detail' or url_name == 'project_edit' or url_name == 'project_new' or url_name == 'project_batch_report' %}active{% endif %}"
|
|
href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
|
|
<i class="fas fa-folder-tree me-1"></i> Resources
|
|
</a>
|
|
<ul class="dropdown-menu">
|
|
<li>
|
|
<a class="dropdown-item {% if url_name == 'team_list' or url_name == 'team_detail' or url_name == 'team_edit' or url_name == 'team_new' or url_name == 'team_batch_report' %}active{% endif %}" href="{% url 'team_list' %}">
|
|
<i class="fas fa-users me-1"></i> Teams
|
|
</a>
|
|
</li>
|
|
<li>
|
|
<a class="dropdown-item {% if url_name == 'project_list' or url_name == 'project_detail' or url_name == 'project_edit' or url_name == 'project_new' or url_name == 'project_batch_report' %}active{% endif %}" href="{% url 'project_list' %}">
|
|
<i class="fas fa-folder-open me-1"></i> Projects
|
|
</a>
|
|
</li>
|
|
</ul>
|
|
{% endwith %}
|
|
</li>
|
|
<li class="nav-item">
|
|
<a class="nav-link" href="{% url 'admin:index' %}">
|
|
<i class="fas fa-cog me-1"></i> Admin
|
|
</a>
|
|
</li>
|
|
{% endif %}
|
|
</ul>
|
|
<ul class="navbar-nav">
|
|
<li class="nav-item d-flex align-items-center">
|
|
<span class="nav-link text-light pe-2">
|
|
<i class="fas fa-user-circle me-1"></i> {{ user.username }}
|
|
</span>
|
|
<form method="post" action="{% url 'logout' %}">
|
|
{% csrf_token %}
|
|
<button type="submit" class="btn btn-outline-danger btn-sm">
|
|
<i class="fas fa-sign-out-alt me-1"></i> Logout
|
|
</button>
|
|
</form>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
</nav>
|
|
|
|
<div class="container mt-4">
|
|
<!-- Messages Block -->
|
|
{% if messages %}
|
|
{% for message in messages %}
|
|
<div class="alert alert-{{ message.tags }} alert-dismissible fade show shadow-sm" role="alert">
|
|
{{ message }}
|
|
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
|
</div>
|
|
{% endfor %}
|
|
{% endif %}
|
|
</div>
|
|
|
|
<!-- Main Content -->
|
|
<main>
|
|
{% block content %}
|
|
{% endblock %}
|
|
</main>
|
|
|
|
<!-- Footer -->
|
|
<footer class="py-4 mt-auto border-top border-secondary">
|
|
<div class="container text-center">
|
|
<p class="mb-0 small">© {% now "Y" %} FoxFitt Construction. All rights reserved.</p>
|
|
</div>
|
|
</footer>
|
|
|
|
<!-- Bootstrap 5.3 JS Bundle -->
|
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>
|
|
</body>
|
|
</html> |