{% extends 'base.html' %} {% load static %} {% block title %}{{ team.name }} | Teams | Fox Fitt{% endblock %} {% block content %} {# === TEAM DETAIL PAGE === Admin-only, read-only view with 4 tabs: Profile · Pay Schedule · Workers · History. #}
{# === PAGE HEADER === #}

{{ team.name }}

{% if team.active %} Active {% else %} Inactive {% endif %} {% if team.supervisor %} Supervisor: {{ team.supervisor.username }} {% endif %}
{# === TABS === #}
{# === PROFILE TAB === #}
Name
{{ team.name }}
Supervisor
{% if team.supervisor %} {{ team.supervisor.username }} {% if team.supervisor.email %} ({{ team.supervisor.email }}) {% endif %} {% else %} Not assigned {% endif %}
Status
{% if team.active %} Active {% else %} Inactive {% endif %}
Pay Frequency
{% if team.pay_frequency %} {{ team.get_pay_frequency_display }} {% else %} Not set {% endif %}
Pay Start Date
{% if team.pay_start_date %} {{ team.pay_start_date|date:"d M Y" }} (anchor for pay period calculation) {% else %} Not set {% endif %}
Worker Count
{{ workers.count }}
{# === PAY SCHEDULE TAB === #}
{% if current_period %}
Current Pay Period

{{ current_period.0|date:"d M Y" }} — {{ current_period.1|date:"d M Y" }}

{% if upcoming_periods %}
Upcoming Pay Periods
    {% for start, end in upcoming_periods %}
  • {{ start|date:"d M Y" }} — {{ end|date:"d M Y" }}
  • {% endfor %}
{% endif %}

Pay periods are calculated from the anchor date ({{ team.pay_start_date|date:"d M Y" }}) stepping forward by {{ team.get_pay_frequency_display|lower }} intervals.

{% else %}

This team has no pay schedule configured.

To enable pay period calculations, edit the team and set both Pay Frequency (weekly/fortnightly/monthly) and Pay Start Date.

Set up pay schedule {% endif %}
{# === WORKERS TAB === #}
{% for w in workers %} {% empty %} {% endfor %}
Name ID Number Monthly Salary Daily Rate Status
{{ w.name }} {{ w.id_number }} R {{ w.monthly_salary|floatformat:2 }} R {{ w.daily_rate|floatformat:2 }} {% if w.active %} Active {% else %} Inactive {% endif %}
No workers assigned to this team yet.
{# === HISTORY TAB === #}
Total Work Days
{{ total_days }}
Projects Worked
{{ projects_touched|length }}
Lifetime Labour Cost
R {{ labour_cost|floatformat:2 }}
{% if projects_touched %}
Projects this team has worked on
{% for name in projects_touched %} {{ name }} {% endfor %}
{% endif %}
Recent Work Logs
{% for log in recent_logs %} {% empty %} {% endfor %}
Date Project Workers Supervisor
{{ log.date|date:"d M Y" }} {{ log.project.name }} {{ log.workers.count }} {% if log.supervisor %} {{ log.supervisor.username }} {% else %} {% endif %}
No work logs yet.
{% endblock %}