Unify Consultant navigation and align full-width header
This commit is contained in:
@@ -18,21 +18,7 @@
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="rounded-3xl border border-slate-200 bg-white p-3 shadow-soft">
|
||||
{% set tabs = [
|
||||
('overview','Overview'),
|
||||
('work-centre','Work Centre'),
|
||||
('clients-requests','Clients & Requests'),
|
||||
('documents-clarifications','Documents & Clarifications'),
|
||||
('reports','Reports')
|
||||
] %}
|
||||
<div class="flex gap-2 overflow-x-auto" id="consultant-portal-tabs">
|
||||
{% for code, label in tabs %}
|
||||
<button type="button" data-tab="{{ code }}" class="consultant-portal-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 %}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{# Dashboard sections are now available from the global Consultant Dashboard menu. #}
|
||||
<section id="consultant-portal-panel">
|
||||
{% if active_tab == 'work-centre' %}
|
||||
{% include "modules/consultants/templates/consultants/portal_partials/work_centre.html" %}
|
||||
@@ -50,24 +36,10 @@
|
||||
|
||||
<script>
|
||||
(function(){
|
||||
const buttons = Array.from(document.querySelectorAll('.consultant-portal-tab'));
|
||||
const panel = document.getElementById('consultant-portal-panel');
|
||||
if (!buttons.length || !panel) return;
|
||||
|
||||
function activate(tab) {
|
||||
buttons.forEach(btn => {
|
||||
if (btn.dataset.tab === tab) {
|
||||
btn.classList.add('bg-brand-600','text-white');
|
||||
btn.classList.remove('text-slate-600','hover:bg-slate-100');
|
||||
} else {
|
||||
btn.classList.remove('bg-brand-600','text-white');
|
||||
btn.classList.add('text-slate-600','hover:bg-slate-100');
|
||||
}
|
||||
});
|
||||
}
|
||||
if (!panel) return;
|
||||
|
||||
async function loadTab(tab) {
|
||||
activate(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>';
|
||||
try {
|
||||
const res = await fetch('/consultant/dashboard/tab/' + encodeURIComponent(tab), {headers: {'X-Requested-With':'fetch'}});
|
||||
@@ -79,7 +51,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
buttons.forEach(btn => btn.addEventListener('click', () => loadTab(btn.dataset.tab)));
|
||||
window.loadConsultantDashboardTab = loadTab;
|
||||
})();
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user