{% extends 'base.html' %} {% load static %} {% block title %}Work History | FoxFitt{% endblock %} {% block content %}
{# === PAGE HEADER with view toggle and export === #}

Work History

{# View toggle — List vs Calendar #} Export CSV Back
{# === FILTER BAR === #}
{% if view_mode == 'calendar' %} {% endif %}
{% if has_active_filters %} Clear {% endif %}
{# Active filter feedback #} {% if has_active_filters %}
Showing {{ filtered_log_count }} of {{ total_log_count }} work log{{ total_log_count|pluralize }} {% if selected_worker %} {% for w in filter_workers %}{% if w.id|stringformat:"d" == selected_worker %}{{ w.name }}{% endif %}{% endfor %} {% endif %} {% if selected_project %} {% for p in filter_projects %}{% if p.id|stringformat:"d" == selected_project %}{{ p.name }}{% endif %}{% endfor %} {% endif %} {% if selected_status %} {{ selected_status|capfirst }} {% endif %}
{% endif %}
{% if view_mode == 'calendar' %} {# =============================================================== #} {# === CALENDAR VIEW === #} {# =============================================================== #} {# Month navigation #}
{{ month_name }}
{# Calendar grid #}
{# Day-of-week header #}
Mon
Tue
Wed
Thu
Fri
Sat
Sun
{% for week in calendar_weeks %}
{% for day in week %}
0 %}data-date="{{ day.date|date:'Y-m-d' }}"{% endif %}>
{{ day.day }} {% if day.count > 0 %} {{ day.count }} {% endif %}
{% for log in day.records|slice:":3" %}
{% if log.payroll_records.exists %} {% else %} {% endif %} {{ log.project.name }}
{% endfor %} {% if day.count > 3 %}
+{{ day.count|add:"-3" }} more
{% endif %}
{% endfor %}
{% endfor %}
{# === Day Detail Panel === #}
Details
Click more days to add them to the selection
{% if is_admin %} {% endif %}
{{ calendar_detail|json_script:"calDetailJson" }} {% else %} {# =============================================================== #} {# === LIST VIEW (TABLE) === #} {# =============================================================== #}
{% if is_admin %}{% endif %} {% for log in logs %} {% if is_admin %} {% endif %} {% empty %} {% endfor %}
Date Project Workers Overtime StatusAmountSupervisor
{{ log.date }} {{ log.project.name }} {% if filtered_worker_obj %} {{ filtered_worker_obj.name }} {% else %} {% for w in log.workers.all %} {{ w.name }} {% endfor %} {{ log.workers.count }} {% endif %} {% if log.overtime_amount > 0 %} {{ log.get_overtime_amount_display }} {% else %} - {% endif %} {% if log.payroll_records.exists %} Paid {% else %} Unpaid {% endif %} {% if filtered_worker_obj %} R {{ filtered_worker_obj.daily_rate }} {% else %} R {{ log.display_amount }} {% endif %} {% if log.supervisor %} {{ log.supervisor.get_full_name|default:log.supervisor.username }} {% else %} - {% endif %}
No work history found. {% if selected_worker or selected_project or selected_status %}
Try adjusting your filters. {% endif %}
{% endif %}
{% endblock %}