{% extends "base.html" %} {% from 'macros.html' import page_header %} {% block content %}
{{ page_header( title='Dashboard', subtitle='Welcome back, ' ~ current_user.email, breadcrumbs=[{'label': 'Dashboard', 'url': None}], actions=[ {'label': '', 'icon': 'fas fa-sync', 'class': 'btn-outline-secondary', 'attrs': 'onclick="location.reload()"', 'tooltip': 'Refresh Data', 'type': 'button'} ] ) }} {% set alert_count = ((alerts.crm.tickets | length) if alerts.crm and alerts.crm.tickets is defined else 0) + ((alerts.crm.stale_tickets | length) if alerts.crm and alerts.crm.stale_tickets is defined else 0) + ((alerts.crm.leads | length) if alerts.crm and alerts.crm.leads is defined else 0) + ((alerts.erp.invoices | length) if alerts.erp and alerts.erp.invoices is defined else 0) + ((alerts.erp.tasks | length) if alerts.erp and alerts.erp.tasks is defined else 0) + ((alerts.erp.projects | length) if alerts.erp and alerts.erp.projects is defined else 0) + ((alerts.erp.past_due_projects | length) if alerts.erp and alerts.erp.past_due_projects is defined else 0) + ((alerts.hris.unfinalized_payroll | length) if alerts.hris and alerts.hris.unfinalized_payroll is defined else 0) + ((alerts.hris.unpaid_payslips | length) if alerts.hris and alerts.hris.unpaid_payslips is defined else 0) + ((alerts.collab.unread_messages | length) if alerts.collab and alerts.collab.unread_messages is defined else 0) %} {% if alert_count > 0 %}
Critical Tasks
{% if alerts.erp and alerts.erp.invoices %} {% for inv in alerts.erp.invoices %}
Overdue Invoice{{ inv.number }}
{% endfor %} {% endif %} {% if alerts.crm and alerts.crm.tickets %} {% for t in alerts.crm.tickets %}
Support Ticket{{ t.title[:20] }}...
{% endfor %} {% endif %} {% if alerts.erp and alerts.erp.tasks %} {% for task in alerts.erp.tasks %}
Task deadline ({{ task.days_left }}d){{ task.title[:20] }}...
{% endfor %} {% endif %} {% if alerts.crm and alerts.crm.leads %} {% for lead in alerts.crm.leads %} {% endfor %} {% endif %} {% if alerts.erp and alerts.erp.projects %} {% for p in alerts.erp.projects %}
Project deadline ({{ p.days_left }}d){{ p.title[:20] }}...
{% endfor %} {% endif %} {% if alerts.crm and alerts.crm.stale_tickets %} {% for t in alerts.crm.stale_tickets %}
Stale Ticket ({{ t.days_stale }}d) {{ t.title[:20] }}...
{% endfor %} {% endif %} {% if alerts.erp and alerts.erp.past_due_projects %} {% for p in alerts.erp.past_due_projects %}
Project Past Due {{ p.title[:20] }}...
{% endfor %} {% endif %} {% if alerts.hris and alerts.hris.unfinalized_payroll %} {% for pr in alerts.hris.unfinalized_payroll %}
Unfinalized Payroll {{ pr.period[:20] }}...
{% endfor %} {% endif %} {% if alerts.hris and alerts.hris.unpaid_payslips %} {% for ps in alerts.hris.unpaid_payslips %} {% endfor %} {% endif %} {% if alerts.collab and alerts.collab.unread_messages %} {% for m in alerts.collab.unread_messages %}
Unread Message {{ m.subject[:20] }}...
{% endfor %} {% endif %}
{% endif %} {% if modules.crm or modules.collab %}
Today's Schedule
{{ config['TIMEZONE'] | default('Local Time') }}
{% set timeline_width = [900, ((widgets.total_minutes / 60) * 140)|round(0, 'ceil')|int]|max %} {% set raw_now_pct = ((widgets.current_time_min - widgets.timeline_start_min) / widgets.total_minutes) * 100 %} {% set now_pct = 0 if raw_now_pct < 0 else (100 if raw_now_pct > 100 else raw_now_pct) %} {% set work_left_pct = ((widgets.work_start_min - widgets.timeline_start_min) / widgets.total_minutes) * 100 %} {% set work_width_pct = ((widgets.work_end_min - widgets.work_start_min) / widgets.total_minutes) * 100 %}
{% for tick in widgets.ticks %} {% set tick_left = ((tick.minute - widgets.timeline_start_min) / widgets.total_minutes) * 100 %}
{{ tick.label }}
{% endfor %}
Now {{ widgets.current_time }}
{% for idx in range(widgets.lane_count + 1) %}
{% endfor %} {% for item in widgets.timeline %}
{% if item.type == 'crm' %} {% else %} {% endif %}
{{ item.title }}
{{ item.time }}-{{ item.end_time }} {% if item.is_unassigned %} Unassigned {% elif item.pic %} {{ item.pic }} {% endif %} {% if item.entity %} {{ item.module }}: {{ item.entity|truncate(14) }} {% endif %}
{% endfor %} {% if not widgets.timeline %}
No scheduled activities for today. Timeline still follows working hours.
{% endif %}
Past Active Now Upcoming Team / Unassigned Working Hours Area
{% endif %} {% if alerts.hris and (alerts.hris.attendance_admin or alerts.hris.attendance_user) %}
{% if alerts.hris.attendance_user %}
My Status Today
{% if alerts.hris.attendance_user.check_in %} Checked In: {{ alerts.hris.attendance_user.check_in }} {% else %} No Check-In {% endif %}
Keep your attendance updated for payroll accuracy. {% if alerts.erp.tasks and alerts.erp.tasks|length > 0 %} {{ alerts.erp.tasks|length }} Pending Task{{ 's' if alerts.erp.tasks|length > 1 else '' }} {% endif %}
{% endif %} {% if alerts.hris.attendance_admin %}
Staff Attendance Today
Open detailed attendance
{{ alerts.hris.attendance_admin.present }}
Present
{{ alerts.hris.attendance_admin.late }}
Late
{{ alerts.hris.attendance_admin.leave }}
On Leave
{{ alerts.hris.attendance_admin.total }}
Total Active
{% endif %}
{% endif %}
Active Projects & Deals
{% if modules.erp and current_user.has_permission('erp.manage') %} New Project {% endif %}
{% if widgets.projects %} {% for p in widgets.projects %}
{{ p.title }}
{% set bcol = 'danger' if p.priority == 'Hot' else 'warning' %} {{ p.priority }}

{{ p.desc }}

Progress {{ p.progress }}%
{% for member in p.members %} {% set colors = ['#0d6efd', '#6f42c1', '#d63384', '#fd7e14', '#20c997', '#0dcaf0'] %} {% set col = colors[loop.index0 % colors|length] %}
{{ member }}
{% endfor %}
{% if p.module == 'erp' and p._comments_count is defined %} {{ p._comments_count }}   {% endif %}
{% endfor %} {% else %}
No active projects or hot leads to display.
{% endif %}
Upcoming Tasks
{% if widgets.upcoming %}
{% for u in widgets.upcoming %}
{{ u.title }}

{{ u.date }}

{% if u.is_unassigned %} Unassigned {% else %} {% for member in u.members %}
{{ member }}
{% endfor %} {% endif %}
{{ u.status }}
{% endfor %}
{% else %}
No upcoming tasks scheduled.
{% endif %}
{% if current_user.is_authenticated and (current_user.has_permission('crm.manage') or current_user.has_permission('erp.manage')) %}
Milestone Tracker
{% if modules.crm and current_user.has_permission('crm.manage') %}
Lead Velocity
{% endif %} {% if modules.erp and current_user.has_permission('erp.manage') %}
Projects
{% endif %}
{% endif %} {% if current_user.is_authenticated and current_user.is_admin() %}
Recent Activity
View All
{% if widgets.activity %} {% for act in widgets.activity %}

{{ act.html|safe }}

{{ act.time }}
{% endfor %} {% else %}
No recent activity found.
{% endif %}
{% endif %}
Module Access
{% if modules.crm %} {% endif %} {% if modules.erp %} {% endif %} {% if modules.hris %} {% endif %} {% if modules.collab %} {% endif %} {% if ALLOW_DUMMY_DATA %} {% endif %}
{% endblock %} {% block scripts %} {% endblock %}