Unify Partner navigation and align full-width header
This commit is contained in:
@@ -1,9 +1,7 @@
|
|||||||
{% extends "ui/templates/base/layout.html" %}
|
{% extends "ui/templates/base/layout.html" %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{% include "ui/templates/components/partner_navigation_v2.html" %}
|
<section class="space-y-6">
|
||||||
|
<div class="rounded-3xl border border-slate-200 bg-white p-6 shadow-soft">
|
||||||
<div class="space-y-6">
|
|
||||||
<section class="rounded-3xl border border-slate-200 bg-white p-6 shadow-soft">
|
|
||||||
<div class="flex flex-col gap-4 lg:flex-row lg:items-center lg:justify-between">
|
<div class="flex flex-col gap-4 lg:flex-row lg:items-center lg:justify-between">
|
||||||
<div>
|
<div>
|
||||||
<p class="text-xs font-semibold uppercase tracking-[0.24em] text-brand-600">Branch Operations Control Centre</p>
|
<p class="text-xs font-semibold uppercase tracking-[0.24em] text-brand-600">Branch Operations Control Centre</p>
|
||||||
@@ -16,132 +14,90 @@
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
|
||||||
|
|
||||||
{% set tabs = [
|
|
||||||
('overview','Overview'),
|
|
||||||
('branch-work','Branch Work'),
|
|
||||||
('clients','Clients'),
|
|
||||||
('staff','Staff'),
|
|
||||||
('review','Review'),
|
|
||||||
('billing','Billing'),
|
|
||||||
('reports','Reports'),
|
|
||||||
('wizards','Wizards')
|
|
||||||
] %}
|
|
||||||
|
|
||||||
<section class="rounded-3xl border border-slate-200 bg-white p-2 shadow-soft">
|
|
||||||
<details id="partner-dashboard-mobile-menu" class="group sm:hidden">
|
|
||||||
<summary class="flex cursor-pointer list-none items-center justify-between rounded-2xl px-4 py-3 text-sm font-semibold text-slate-800 transition hover:bg-slate-50 focus:outline-none focus-visible:ring-4 focus-visible:ring-brand-100">
|
|
||||||
<span class="flex items-center gap-3">
|
|
||||||
<svg class="h-5 w-5 text-slate-600" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true">
|
|
||||||
<path stroke-linecap="round" stroke-linejoin="round" d="M4 6h16M4 12h16M4 18h16" />
|
|
||||||
</svg>
|
|
||||||
<span>Dashboard Menu</span>
|
|
||||||
</span>
|
|
||||||
<span class="flex items-center gap-2 text-xs font-medium text-slate-500">
|
|
||||||
<span>Partner dashboard sections</span>
|
|
||||||
<svg class="h-4 w-4 transition-transform group-open:rotate-180" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true">
|
|
||||||
<path stroke-linecap="round" stroke-linejoin="round" d="m6 9 6 6 6-6" />
|
|
||||||
</svg>
|
|
||||||
</span>
|
|
||||||
</summary>
|
|
||||||
|
|
||||||
<div class="mt-2 space-y-1 border-t border-slate-100 px-2 pb-2 pt-3" role="navigation" aria-label="Partner dashboard sections">
|
|
||||||
{% for code, label in tabs %}
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
data-tab="{{ code }}"
|
|
||||||
class="partner-dashboard-mobile-tab flex w-full items-center justify-between rounded-xl px-3 py-3 text-left text-sm font-semibold transition {% if active_tab == code %}bg-brand-600 text-white{% else %}text-slate-700 hover:bg-slate-100{% endif %}"
|
|
||||||
{% if active_tab == code %}aria-current="page"{% endif %}
|
|
||||||
>
|
|
||||||
<span>{{ label }}</span>
|
|
||||||
{% if active_tab == code %}
|
|
||||||
<span class="rounded-full bg-white/20 px-2 py-0.5 text-[10px] font-bold uppercase tracking-wide">Current</span>
|
|
||||||
{% endif %}
|
|
||||||
</button>
|
|
||||||
{% endfor %}
|
|
||||||
</div>
|
</div>
|
||||||
</details>
|
|
||||||
|
|
||||||
<div class="hidden gap-2 overflow-x-auto sm:flex" id="partner-dashboard-tabs" role="navigation" aria-label="Partner dashboard sections">
|
{# Dashboard sections are now part of the unified Partner Dashboard submenu. #}
|
||||||
{% for code, label in tabs %}
|
|
||||||
<button type="button" data-tab="{{ code }}" class="partner-dashboard-tab whitespace-nowrap rounded-2xl px-4 py-2 text-sm font-semibold transition {% if active_tab == code %}bg-brand-600 text-white{% else %}text-slate-600 hover:bg-slate-100{% endif %}" {% if active_tab == code %}aria-current="page"{% endif %}>{{ label }}</button>
|
<div id="partner-dashboard-panel"
|
||||||
{% endfor %}
|
data-initial-tab="{{ active_tab }}"
|
||||||
|
class="min-h-[360px]">
|
||||||
|
<div class="rounded-3xl border border-slate-200 bg-white p-8 text-center text-sm text-slate-500 shadow-soft">Loading dashboard...</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section id="partner-dashboard-panel">
|
|
||||||
{% include 'modules/partner_dashboard/templates/partner_dashboard/partials/' ~ (active_tab|replace('-', '_')) ~ '.html' ignore missing %}
|
|
||||||
</section>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
(function () {
|
(function () {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
const panel = document.getElementById('partner-dashboard-panel');
|
const panel = document.getElementById('partner-dashboard-panel');
|
||||||
const desktopButtons = Array.from(document.querySelectorAll('.partner-dashboard-tab'));
|
if (!panel) return;
|
||||||
const mobileButtons = Array.from(document.querySelectorAll('.partner-dashboard-mobile-tab'));
|
|
||||||
const mobileMenu = document.getElementById('partner-dashboard-mobile-menu');
|
|
||||||
const allButtons = desktopButtons.concat(mobileButtons);
|
|
||||||
|
|
||||||
function applyActiveClasses(button, active) {
|
const dashboardLinks = Array.from(document.querySelectorAll(
|
||||||
button.classList.toggle('bg-brand-600', active);
|
'[data-uiux-v2-pilot="partner"] a[href^="/partner/dashboard?tab="]'
|
||||||
button.classList.toggle('text-white', active);
|
));
|
||||||
button.classList.toggle('text-slate-600', !active && button.classList.contains('partner-dashboard-tab'));
|
|
||||||
button.classList.toggle('text-slate-700', !active && button.classList.contains('partner-dashboard-mobile-tab'));
|
|
||||||
button.classList.toggle('hover:bg-slate-100', !active);
|
|
||||||
|
|
||||||
|
function tabFromLink(link) {
|
||||||
|
try {
|
||||||
|
return new URL(link.href, window.location.origin).searchParams.get('tab') || 'overview';
|
||||||
|
} catch (error) {
|
||||||
|
return 'overview';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function setActive(tabName) {
|
||||||
|
dashboardLinks.forEach((link) => {
|
||||||
|
const active = tabFromLink(link) === tabName;
|
||||||
|
link.classList.toggle('bg-brand-50', active);
|
||||||
|
link.classList.toggle('text-brand-700', active);
|
||||||
|
link.classList.toggle('text-slate-700', !active);
|
||||||
if (active) {
|
if (active) {
|
||||||
button.setAttribute('aria-current', 'page');
|
link.setAttribute('aria-current', 'page');
|
||||||
} else {
|
} else {
|
||||||
button.removeAttribute('aria-current');
|
link.removeAttribute('aria-current');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (button.classList.contains('partner-dashboard-mobile-tab')) {
|
|
||||||
let badge = button.querySelector('[data-current-badge]');
|
|
||||||
if (active && !badge) {
|
|
||||||
badge = document.createElement('span');
|
|
||||||
badge.dataset.currentBadge = 'true';
|
|
||||||
badge.className = 'rounded-full bg-white/20 px-2 py-0.5 text-[10px] font-bold uppercase tracking-wide';
|
|
||||||
badge.textContent = 'Current';
|
|
||||||
button.appendChild(badge);
|
|
||||||
} else if (!active && badge) {
|
|
||||||
badge.remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function setActiveTab(tab) {
|
|
||||||
allButtons.forEach(button => {
|
|
||||||
applyActiveClasses(button, button.dataset.tab === tab);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function loadTab(tab) {
|
async function loadTab(tabName, pushState) {
|
||||||
setActiveTab(tab);
|
setActive(tabName);
|
||||||
if (mobileMenu) {
|
|
||||||
mobileMenu.open = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
panel.innerHTML = '<div class="rounded-3xl border border-slate-200 bg-white p-8 text-center text-sm text-slate-500 shadow-soft">Loading...</div>';
|
panel.innerHTML = '<div class="rounded-3xl border border-slate-200 bg-white p-8 text-center text-sm text-slate-500 shadow-soft">Loading...</div>';
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await fetch('/partner/dashboard/tab/' + encodeURIComponent(tab), {
|
const response = await fetch('/partner/dashboard/tab/' + encodeURIComponent(tabName), {
|
||||||
headers: { 'X-Requested-With': 'fetch' }
|
headers: { 'X-Requested-With': 'fetch' }
|
||||||
});
|
});
|
||||||
if (!response.ok) {
|
if (!response.ok) throw new Error('Tab load failed');
|
||||||
throw new Error('HTTP ' + response.status);
|
|
||||||
}
|
|
||||||
|
|
||||||
panel.innerHTML = await response.text();
|
panel.innerHTML = await response.text();
|
||||||
history.replaceState(null, '', '/partner/dashboard?tab=' + encodeURIComponent(tab));
|
|
||||||
|
if (pushState) {
|
||||||
|
const url = new URL(window.location.href);
|
||||||
|
url.searchParams.set('tab', tabName);
|
||||||
|
history.pushState({ tab: tabName }, '', url.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
document.querySelectorAll('[data-uiux-v2-pilot="partner"] details[open]').forEach((details) => {
|
||||||
|
details.open = false;
|
||||||
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
panel.innerHTML = '<div class="rounded-3xl border border-red-200 bg-red-50 p-6 text-sm font-semibold text-red-700">Unable to load tab. Please refresh the page.</div>';
|
panel.innerHTML = '<div class="rounded-3xl border border-red-200 bg-red-50 p-6 text-sm text-red-700 shadow-soft">Unable to load this dashboard section. Please refresh the page.</div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
allButtons.forEach(button => {
|
dashboardLinks.forEach((link) => {
|
||||||
button.addEventListener('click', () => loadTab(button.dataset.tab));
|
link.addEventListener('click', function (event) {
|
||||||
|
if (window.location.pathname !== '/partner/dashboard') return;
|
||||||
|
event.preventDefault();
|
||||||
|
loadTab(tabFromLink(link), true);
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
window.addEventListener('popstate', function () {
|
||||||
|
const url = new URL(window.location.href);
|
||||||
|
loadTab(url.searchParams.get('tab') || 'overview', false);
|
||||||
|
});
|
||||||
|
|
||||||
|
loadTab(panel.dataset.initialTab || 'overview', false);
|
||||||
})();
|
})();
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
@@ -1,19 +1,26 @@
|
|||||||
{% if navigation_render_location_v2|default('page') == 'global-host' or not global_role_navigation_host_v2|default(false) %}
|
{% if navigation_render_location_v2|default('page') == 'global-host' or not global_role_navigation_host_v2|default(false) %}
|
||||||
{#
|
{#
|
||||||
UI/UX V2 Phase 1D — Partner pilot navigation
|
UI/UX V2 Phase 1D.5 — Unified Partner navigation.
|
||||||
|
Presentation only. Existing routes and route-level permissions remain authoritative.
|
||||||
Presentation-only replacement for the existing partner tab strip.
|
|
||||||
Existing URLs, route protection, dashboard content, forms and page actions
|
|
||||||
are unchanged.
|
|
||||||
#}
|
#}
|
||||||
{% set _partner_path = request.url.path %}
|
{% set _partner_path = request.url.path %}
|
||||||
|
{% set _partner_tab = request.query_params.get('tab', 'overview') %}
|
||||||
{% set navigation_aria_label_v2 = 'Partner workspace navigation' %}
|
{% set navigation_aria_label_v2 = 'Partner workspace navigation' %}
|
||||||
{% set navigation_items_v2 = [
|
{% set navigation_items_v2 = [
|
||||||
{
|
{
|
||||||
'label': 'Dashboard',
|
'label': 'Dashboard',
|
||||||
'url': '/partner/dashboard',
|
|
||||||
'visible': true,
|
'visible': true,
|
||||||
'active': _partner_path == '/partner/dashboard'
|
'active': _partner_path.startswith('/partner/dashboard'),
|
||||||
|
'children': [
|
||||||
|
{'label': 'Overview', 'url': '/partner/dashboard?tab=overview', 'active': _partner_path.startswith('/partner/dashboard') and _partner_tab == 'overview'},
|
||||||
|
{'label': 'Branch Work', 'url': '/partner/dashboard?tab=branch-work', 'active': _partner_path.startswith('/partner/dashboard') and _partner_tab == 'branch-work'},
|
||||||
|
{'label': 'Clients', 'url': '/partner/dashboard?tab=clients', 'active': _partner_path.startswith('/partner/dashboard') and _partner_tab == 'clients'},
|
||||||
|
{'label': 'Staff', 'url': '/partner/dashboard?tab=staff', 'active': _partner_path.startswith('/partner/dashboard') and _partner_tab == 'staff'},
|
||||||
|
{'label': 'Review', 'url': '/partner/dashboard?tab=review', 'active': _partner_path.startswith('/partner/dashboard') and _partner_tab == 'review'},
|
||||||
|
{'label': 'Billing', 'url': '/partner/dashboard?tab=billing', 'active': _partner_path.startswith('/partner/dashboard') and _partner_tab == 'billing'},
|
||||||
|
{'label': 'Reports', 'url': '/partner/dashboard?tab=reports', 'active': _partner_path.startswith('/partner/dashboard') and _partner_tab == 'reports'},
|
||||||
|
{'label': 'Wizards', 'url': '/partner/dashboard?tab=wizards', 'active': _partner_path.startswith('/partner/dashboard') and _partner_tab == 'wizards'}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'label': 'Review Board',
|
'label': 'Review Board',
|
||||||
@@ -54,8 +61,57 @@
|
|||||||
}
|
}
|
||||||
] %}
|
] %}
|
||||||
|
|
||||||
<div class="mb-6 overflow-hidden rounded-2xl border border-slate-200 bg-white shadow-soft" data-uiux-v2-pilot="partner">
|
<div class="border-b border-slate-200 bg-white shadow-sm" data-uiux-v2-pilot="partner">
|
||||||
{% include "ui/templates/components/navigation_v2.html" %}
|
{% include "ui/templates/components/navigation_v2.html" %}
|
||||||
{% include "ui/templates/components/mobile_navigation_v2.html" %}
|
{% include "ui/templates/components/mobile_navigation_v2.html" %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
(function () {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
function initialisePartnerDropdowns() {
|
||||||
|
var root = document.querySelector('[data-uiux-v2-pilot="partner"]');
|
||||||
|
if (!root || root.dataset.dropdownAutoCloseInitialised === 'true') return;
|
||||||
|
|
||||||
|
var desktopNav = root.querySelector('nav[data-uiux-v2="desktop-navigation"]');
|
||||||
|
if (!desktopNav) return;
|
||||||
|
|
||||||
|
root.dataset.dropdownAutoCloseInitialised = 'true';
|
||||||
|
var dropdowns = Array.from(desktopNav.querySelectorAll('details'));
|
||||||
|
|
||||||
|
function closeAllExcept(exception) {
|
||||||
|
dropdowns.forEach(function (details) {
|
||||||
|
if (details !== exception) details.removeAttribute('open');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
dropdowns.forEach(function (details) {
|
||||||
|
details.addEventListener('toggle', function () {
|
||||||
|
if (details.open) closeAllExcept(details);
|
||||||
|
});
|
||||||
|
|
||||||
|
details.querySelectorAll('a[href]').forEach(function (link) {
|
||||||
|
link.addEventListener('click', function () {
|
||||||
|
details.removeAttribute('open');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
document.addEventListener('click', function (event) {
|
||||||
|
if (!root.contains(event.target)) closeAllExcept(null);
|
||||||
|
});
|
||||||
|
|
||||||
|
document.addEventListener('keydown', function (event) {
|
||||||
|
if (event.key === 'Escape') closeAllExcept(null);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (document.readyState === 'loading') {
|
||||||
|
document.addEventListener('DOMContentLoaded', initialisePartnerDropdowns, { once: true });
|
||||||
|
} else {
|
||||||
|
initialisePartnerDropdowns();
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
{% set _uiux_full_width_header = ('System Admin' in (ui_roles|default([], true))) or ('Firm Admin' in (ui_roles|default([], true))) %}
|
{% set _uiux_full_width_header = ('System Admin' in (ui_roles|default([], true))) or ('Firm Admin' in (ui_roles|default([], true))) or ('Partner' in (ui_roles|default([], true))) %}
|
||||||
<header class="sticky top-0 z-40 border-b border-slate-200/70 {{ 'bg-white/95' if _uiux_full_width_header else 'bg-slate-100/85' }} backdrop-blur-xl">
|
<header class="sticky top-0 z-40 border-b border-slate-200/70 {{ 'bg-white/95' if _uiux_full_width_header else 'bg-slate-100/85' }} backdrop-blur-xl">
|
||||||
<div class="{{ 'w-full px-4 py-3 sm:px-6 lg:px-8' if _uiux_full_width_header else 'mx-auto max-w-[1500px] px-3 py-3 sm:px-6 lg:px-8' }}">
|
<div class="{{ 'w-full px-4 py-3 sm:px-6 lg:px-8' if _uiux_full_width_header else 'mx-auto max-w-[1500px] px-3 py-3 sm:px-6 lg:px-8' }}">
|
||||||
<div class="{{ 'border-0 bg-transparent px-0 py-0 shadow-none' if _uiux_full_width_header else 'rounded-3xl border border-slate-200 bg-white/95 px-3 py-3 shadow-soft sm:px-4' }}">
|
<div class="{{ 'border-0 bg-transparent px-0 py-0 shadow-none' if _uiux_full_width_header else 'rounded-3xl border border-slate-200 bg-white/95 px-3 py-3 shadow-soft sm:px-4' }}">
|
||||||
|
|||||||
Reference in New Issue
Block a user