Show sidebar only for system admin and hide reports centre

This commit is contained in:
A R R R Associates
2026-07-06 13:27:30 +05:30
parent 9efdb968d3
commit 0bcb87e818
4 changed files with 23 additions and 42 deletions
@@ -105,15 +105,6 @@ def build_workspace_cards(roles: Iterable[str] | None, permissions: Iterable[str
priority=70,
))
# Reports centre is available as a role-aware workspace for every authenticated user.
cards.append(WorkspaceCard(
code="reports",
title="Reports Centre",
description="Role-aware reports grouped by work, clients, billing, HR, system and audit areas.",
url="/reports",
badge="Reports",
priority=90,
))
return sorted(cards, key=lambda card: card.priority)
@@ -134,6 +125,4 @@ def current_workspace_code(current_path: str | None) -> str:
return "client"
if path.startswith("/consultant"):
return "consultant"
if path.startswith("/reports"):
return "reports"
return ""
@@ -7,9 +7,9 @@
<div class="mt-2 flex flex-col gap-3 lg:flex-row lg:items-end lg:justify-between">
<div>
<h1 class="text-2xl font-bold text-slate-900">My Workspaces</h1>
<p class="mt-1 max-w-3xl text-sm text-slate-500">Open the workspace allowed for your role. This page does not replace any existing module; it only gives a clean entry point to dashboards and reports.</p>
<p class="mt-1 max-w-3xl text-sm text-slate-500">Open the workspace allowed for your role. This page does not replace any existing module; it only gives a clean entry point to dashboards and portals.</p>
</div>
<a href="/reports" class="inline-flex items-center justify-center rounded-2xl bg-slate-900 px-4 py-2 text-sm font-semibold text-white shadow-sm hover:bg-slate-800">Open Reports Centre</a>
<span class="inline-flex items-center justify-center rounded-2xl border border-slate-200 bg-slate-50 px-4 py-2 text-sm font-semibold text-slate-600">Reports Centre will return in final phase</span>
</div>
</div>
+17 -25
View File
@@ -100,26 +100,11 @@
{% set current_branch_name = firm_branding.branch_name if firm_branding else "" %}
{% set domain_context = get_domain_context(request) %}
{% set is_system_admin_user = full_auth and ("System Admin" in ui_roles) %}
{% set show_legacy_sidebar = full_auth and is_system_admin_user %}
{% set can_manage_local_storage_agent = full_auth and can_view_documents(current_user, ui_perms, ui_roles) and can_upload_documents(current_user, ui_perms, ui_roles) and (ui_roles|select("in", ["Firm Admin", "Partner", "Branch Manager"])|list|length > 0) %}
{% set clean_workspace_paths = [
'/system-admin/dashboard',
'/firm-admin/dashboard',
'/partner/dashboard',
'/manager/dashboard',
'/employee/dashboard',
'/client/dashboard',
'/consultant/dashboard',
'/workspaces'
] %}
{% set clean_nav_state = namespace(enabled=False) %}
{% for clean_path in clean_workspace_paths %}
{% if current_path.startswith(clean_path) %}{% set clean_nav_state.enabled = True %}{% endif %}
{% endfor %}
{% set use_clean_top_nav = full_auth and clean_nav_state.enabled %}
<div class="min-h-screen {% if not use_clean_top_nav %}lg:grid lg:grid-cols-[260px_minmax(0,1fr)]{% endif %}">
{% if not use_clean_top_nav %}
<div class="min-h-screen {% if show_legacy_sidebar %}lg:grid lg:grid-cols-[260px_minmax(0,1fr)]{% endif %}">
{% if show_legacy_sidebar %}
<aside class="border-b border-slate-200 bg-slate-900 text-slate-100 lg:min-h-screen lg:border-b-0 lg:border-r lg:border-slate-800">
<div class="flex items-center gap-3 px-5 py-5">
{% if firm_branding.logo_url %}<img src="{{ firm_branding.logo_url }}" alt="{{ current_firm_name }} logo" class="h-11 w-11 rounded-2xl bg-white object-contain p-1 shadow-soft" />{% else %}<div class="flex h-11 w-11 items-center justify-center rounded-2xl bg-brand-500 font-bold text-white shadow-soft">{{ (current_firm_name[:2] if current_firm_name else 'AF')|upper }}</div>{% endif %}
@@ -402,18 +387,26 @@
</nav>
{% endif %}
</aside>
{% endif %}
<div class="min-h-screen">
{% if use_clean_top_nav %}
{% include "ui/templates/components/top_workspace_bar.html" %}
{% else %}
<header class="border-b border-slate-200 bg-white/90 backdrop-blur">
<div class="mx-auto max-w-7xl px-4 py-4 sm:px-6 lg:px-8">
<div class="flex items-start justify-between gap-4">
<div>
<h1 class="text-lg font-semibold text-slate-900">{{ title or "Module Workspace" }}</h1>
<div class="flex min-w-0 items-center gap-3">
{% if not show_legacy_sidebar and full_auth %}
{% if firm_branding.logo_url %}
<img src="{{ firm_branding.logo_url }}" alt="{{ current_firm_name }} logo" class="h-11 w-11 shrink-0 rounded-2xl border border-slate-200 bg-white object-contain p-1 shadow-soft" />
{% else %}
<div class="flex h-11 w-11 shrink-0 items-center justify-center rounded-2xl bg-brand-600 text-sm font-bold text-white shadow-soft">{{ (current_firm_name[:2] if current_firm_name else 'AF')|upper }}</div>
{% endif %}
{% endif %}
<div class="min-w-0">
<h1 class="truncate text-lg font-semibold text-slate-900">{{ title or "Module Workspace" }}</h1>
{% if not show_legacy_sidebar and full_auth %}
<div class="truncate text-xs text-slate-500">{{ current_firm_name }}{% if current_branch_name and current_branch_name != "-" %} • {{ current_branch_name }}{% endif %}{% if active_financial_year %} • FY {{ active_financial_year }}{% endif %}</div>
{% endif %}
</div>
</div>
<div class="text-right text-sm">
{% if full_auth %}
@@ -504,7 +497,6 @@
{% endif %}
</div>
</header>
{% endif %}
<main class="mx-auto max-w-7xl px-4 py-6 sm:px-6 lg:px-8">
{% if flash %}
@@ -3,11 +3,11 @@
{% set perms = ui_perms if ui_perms is defined else [] %}
{% set current = current_path if current_path is defined else request.url.path %}
{% set can_employee = ('Staff' in roles) or ('Employee' in roles) or ('employees.ess.view' in perms) or ('employees.work.view_self' in perms) or ('employees.attendance.view_self' in perms) or ('employees.leave.view_self' in perms) or ('employees.documents.view_self' in perms) or ('employees.payroll.view_self' in perms) %}
<div class="flex flex-wrap items-center justify-end gap-2">
<div class="mt-2 flex flex-wrap justify-end gap-2">
<label class="sr-only" for="workspace_switcher">Workspace</label>
<select id="workspace_switcher" onchange="if(this.value){window.location.href=this.value;}" class="min-w-[210px] max-w-xs rounded-2xl border border-brand-200 bg-brand-50 px-3 py-2 text-xs font-semibold text-brand-900 shadow-sm outline-none transition hover:bg-brand-100 focus:border-brand-400 focus:ring-2 focus:ring-brand-200">
<select id="workspace_switcher" onchange="if(this.value){window.location.href=this.value;}" class="min-w-[230px] max-w-xs rounded-xl border border-brand-200 bg-brand-50 px-3 py-1.5 text-xs font-semibold text-brand-900 shadow-sm outline-none transition hover:bg-brand-100 focus:border-brand-400 focus:ring-2 focus:ring-brand-200">
<option value="/workspaces" {% if current.startswith('/workspaces') %}selected{% endif %}>Workspace Centre</option>
{% if 'System Admin' in roles %}<option value="/system-admin/dashboard" {% if current.startswith('/system-admin') %}selected{% endif %}>System Admin</option>{% endif %}
{% if 'System Admin' in roles %}<option value="/system-admin/dashboard" {% if current.startswith('/system-admin') %}selected{% endif %}>System Admin - Platform Control</option>{% endif %}
{% if 'Partner' in roles %}<option value="/partner/dashboard" {% if current.startswith('/partner') %}selected{% endif %}>Partner Operations</option>{% endif %}
{% if 'Firm Admin' in roles %}<option value="/firm-admin/dashboard" {% if current.startswith('/firm-admin') %}selected{% endif %}>Firm Administration</option>{% endif %}
{% if 'Manager' in roles or 'Branch Manager' in roles %}<option value="/manager/dashboard" {% if current.startswith('/manager') %}selected{% endif %}>Manager Workspace</option>{% endif %}
@@ -15,6 +15,6 @@
{% if 'Client' in roles %}<option value="/client/dashboard" {% if current.startswith('/client') %}selected{% endif %}>Client Portal</option>{% endif %}
{% if 'Consultant' in roles %}<option value="/consultant/dashboard" {% if current.startswith('/consultant') %}selected{% endif %}>Consultant Workspace</option>{% endif %}
</select>
<a href="/workspaces" class="inline-flex items-center rounded-2xl border border-slate-200 bg-white px-3 py-2 text-xs font-semibold text-slate-600 shadow-sm hover:border-brand-200 hover:text-brand-700">All workspaces</a>
<a href="/workspaces" class="inline-flex items-center rounded-xl border border-slate-200 bg-white px-3 py-1.5 text-xs font-semibold text-slate-600 shadow-sm hover:border-brand-200 hover:text-brand-700">All workspaces</a>
</div>
{% endif %}