Add Partner V2 navigation to operations dashboard

This commit is contained in:
A R R R Associates
2026-07-10 17:54:51 +05:30
parent fa7e39a07d
commit bd92cd773c
@@ -1,5 +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" %}
<div class="space-y-6"> <div class="space-y-6">
<section class="rounded-3xl border border-slate-200 bg-white p-6 shadow-soft"> <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">
@@ -13,11 +15,6 @@
Scope: {{ overview.tenant.name if overview.tenant else 'Tenant' }}{% if overview.branch %} · {{ overview.branch.name }}{% else %} · All permitted branches{% endif %}{% if overview.financial_year %} · FY {{ overview.financial_year }}{% endif %} Scope: {{ overview.tenant.name if overview.tenant else 'Tenant' }}{% if overview.branch %} · {{ overview.branch.name }}{% else %} · All permitted branches{% endif %}{% if overview.financial_year %} · FY {{ overview.financial_year }}{% endif %}
</p> </p>
</div> </div>
<div class="flex flex-wrap gap-2">
<a href="/partner/reviews" class="rounded-2xl bg-brand-600 px-4 py-2 text-sm font-semibold text-white shadow-soft hover:bg-brand-700">Review Board</a>
<a href="/clients" class="rounded-2xl border border-slate-200 px-4 py-2 text-sm font-semibold text-slate-700 hover:bg-slate-50">Clients</a>
<a href="/billing" class="rounded-2xl border border-slate-200 px-4 py-2 text-sm font-semibold text-slate-700 hover:bg-slate-50">Billing</a>
</div>
</div> </div>
</section> </section>
@@ -32,7 +29,16 @@
('wizards','Wizards') ('wizards','Wizards')
] %} ] %}
<section class="rounded-3xl border border-slate-200 bg-white p-2 shadow-soft"> <section class="rounded-3xl border border-slate-200 bg-white p-2 shadow-soft">
<div class="flex gap-2 overflow-x-auto" id="partner-dashboard-tabs"> <div class="sm:hidden">
<label for="partner-dashboard-tab-select" class="sr-only">Dashboard section</label>
<select id="partner-dashboard-tab-select" class="w-full rounded-2xl border border-slate-200 bg-white px-4 py-3 text-sm font-semibold text-slate-700 focus:border-brand-500 focus:outline-none focus:ring-4 focus:ring-brand-100">
{% for code, label in tabs %}
<option value="{{ code }}" {% if active_tab == code %}selected{% endif %}>{{ label }}</option>
{% endfor %}
</select>
</div>
<div class="hidden gap-2 overflow-x-auto sm:flex" id="partner-dashboard-tabs">
{% for code, label in tabs %} {% 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 %}">{{ label }}</button> <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 %}">{{ label }}</button>
{% endfor %} {% endfor %}
@@ -48,7 +54,9 @@
(function(){ (function(){
const panel = document.getElementById('partner-dashboard-panel'); const panel = document.getElementById('partner-dashboard-panel');
const buttons = Array.from(document.querySelectorAll('.partner-dashboard-tab')); const buttons = Array.from(document.querySelectorAll('.partner-dashboard-tab'));
async function loadTab(tab) { const select = document.getElementById('partner-dashboard-tab-select');
function setActiveTab(tab) {
buttons.forEach(btn => { buttons.forEach(btn => {
const active = btn.dataset.tab === tab; const active = btn.dataset.tab === tab;
btn.classList.toggle('bg-brand-600', active); btn.classList.toggle('bg-brand-600', active);
@@ -56,6 +64,13 @@
btn.classList.toggle('text-slate-600', !active); btn.classList.toggle('text-slate-600', !active);
btn.classList.toggle('hover:bg-slate-100', !active); btn.classList.toggle('hover:bg-slate-100', !active);
}); });
if (select && select.value !== tab) {
select.value = tab;
}
}
async function loadTab(tab) {
setActiveTab(tab);
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 res = await fetch('/partner/dashboard/tab/' + encodeURIComponent(tab), {headers: {'X-Requested-With':'fetch'}}); const res = await fetch('/partner/dashboard/tab/' + encodeURIComponent(tab), {headers: {'X-Requested-With':'fetch'}});
@@ -66,7 +81,11 @@
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 font-semibold text-red-700">Unable to load tab. Please refresh the page.</div>';
} }
} }
buttons.forEach(btn => btn.addEventListener('click', () => loadTab(btn.dataset.tab))); buttons.forEach(btn => btn.addEventListener('click', () => loadTab(btn.dataset.tab)));
if (select) {
select.addEventListener('change', () => loadTab(select.value));
}
})(); })();
</script> </script>
{% endblock %} {% endblock %}