satdetect-dev / templates /partials /navbar_dda.html
coderuday21's picture
Cursor
Deploy latest uday app code to Hugging Face (skip research binaries).
c682b53
Raw History Blame Contribute Delete
7.79 kB
<aside class="dda-sidebar-nav">
<div class="dda-sidebar-brand">
<svg width="26" height="26" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="12" cy="12" r="10"/><path d="M2 12h20"/><path d="M12 2a15.3 15.3 0 014 10 15.3 15.3 0 01-4 10 15.3 15.3 0 01-4-10 15.3 15.3 0 014-10z"/></svg>
<div class="dda-sidebar-brand-text">
<span class="dda-sidebar-brand-name">Vedangsoft</span>
<span class="dda-sidebar-brand-sub">Change Detection</span>
</div>
<button type="button" id="dda-sidebar-toggle" class="dda-sidebar-toggle" title="Collapse sidebar" aria-label="Collapse sidebar" aria-expanded="true">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M4 6h16M4 12h16M4 18h16"/></svg>
</button>
</div>
{# Rendered from the DB-backed menu (app/dda/rbac) — resolve_user_menu()
already filtered this down to items the current user's role can view,
so e.g. the admin entries simply aren't in the list for a non-admin.
item_key is the URL with slashes turned into dashes, so each page —
including each of the 3 admin pages — gets its own distinct active
state and icon instead of being lumped into one generic "admin" key. #}
{% set icons = {
'home': '<path d="M3 11.5 12 4l9 7.5"/><path d="M5 10v9a1 1 0 0 0 1 1h4v-6h4v6h4a1 1 0 0 0 1-1v-9"/>',
'library': '<path d="M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7z"/>',
'masters': '<path d="M4 19.5A2.5 2.5 0 0 1 6.5 17H20"/><path d="M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z"/><path d="M8 7h8M8 11h6"/>',
'masters-zones': '<path d="M12 2 3 7v10l9 5 9-5V7z"/><path d="M12 22V12"/><path d="M3 7l9 5 9-5"/>',
'masters-villages': '<path d="M3 21h18"/><path d="M5 21V10l7-5 7 5v11"/><path d="M10 21v-6h4v6"/>',
'logs': '<path d="M8 6h13M8 12h13M8 18h13"/><path d="M3 6h.01M3 12h.01M3 18h.01"/>',
'detect': '<rect x="3" y="3" width="11" height="11" rx="2"/><path d="M9 14v3a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2v-8a2 2 0 0 0-2-2h-3"/>',
'reports': '<path d="M7 3h7l5 5v13a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1z"/><path d="M14 3v5h5"/><path d="M9 13h6M9 17h6M9 9h2"/>',
'configuration': '<circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15 1.65 1.65 0 0 0 3.17 14H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06A1.65 1.65 0 0 0 9 4.6a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"/>',
'admin-roles-users': '<circle cx="12" cy="8" r="4"/><path d="M4 21v-1a8 8 0 0 1 16 0v1"/>',
'admin-modules': '<rect x="3" y="3" width="7" height="7" rx="1.5"/><rect x="14" y="3" width="7" height="7" rx="1.5"/><rect x="3" y="14" width="7" height="7" rx="1.5"/><rect x="14" y="14" width="7" height="7" rx="1.5"/>',
'admin-menu': '<path d="M4 6h16M4 12h16M4 18h10"/>',
'audit-log': '<path d="M9 11l3 3L22 4"/><path d="M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"/>',
'exception-log': '<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><path d="M14 2v6h6"/><path d="M12 18v-6"/><path d="M9 15h6"/>',
} %}
<nav class="dda-tabs" role="navigation" aria-label="Main">
{% for item in menu_items %}
{% set item_key = 'configuration' if item.label == 'Configuration' else ('masters' if item.label == 'Masters' else ('home' if item.url == '/' else item.url.strip('/').replace('/', '-'))) %}
{% if item.visible_children %}
{% set child_keys = [] %}
{% for child in item.visible_children %}
{% set _ = child_keys.append(child.url.strip('/').replace('/', '-')) %}
{% endfor %}
{% set group_active = active_page in child_keys %}
<details class="dda-sidebar-group"{{ ' open' if group_active else '' }}>
<summary class="dda-tab dda-tab-group{{ ' active' if group_active else '' }}">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">{{ (icons.get(item_key) or '<circle cx="12" cy="12" r="9"/>')|safe }}</svg>
<span>{{ item.label }}</span>
<svg class="dda-sidebar-chevron" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M9 6l6 6-6 6"/></svg>
</summary>
<div class="dda-sidebar-submenu">
{% for child in item.visible_children %}
{% set child_key = child.url.strip('/').replace('/', '-') %}
<a href="{{ child.url }}" class="dda-tab dda-subtab{{ ' active' if child_key == active_page else '' }}">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">{{ (icons.get(child_key) or '<circle cx="12" cy="12" r="9"/>')|safe }}</svg>
<span>{{ child.label }}</span>
</a>
{% endfor %}
</div>
</details>
{% else %}
<a href="{{ item.url }}" class="dda-tab{{ ' active' if item_key == active_page else '' }}">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">{{ (icons.get(item_key) or '<circle cx="12" cy="12" r="9"/>')|safe }}</svg>
<span>{{ item.label }}</span>
</a>
{% endif %}
{% endfor %}
</nav>
<div class="dda-sidebar-footer">
<div class="dda-notify-wrap">
<button type="button" id="dda-notify-btn" class="dda-notify-btn" title="Job notifications" aria-label="Notifications">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8"><path d="M18 8A6 6 0 006 8c0 7-3 9-3 9h18s-3-2-3-9"/><path d="M13.73 21a2 2 0 01-3.46 0"/></svg>
<span>Notifications</span>
<span id="dda-notify-badge" class="dda-notify-badge hidden">0</span>
</button>
<div id="dda-notify-panel" class="dda-notify-panel hidden" role="menu"></div>
</div>
<div id="dda-notify-backdrop" class="dda-notify-backdrop hidden"></div>
<details class="dda-user-menu">
<summary class="dda-user-wrap">
<span id="dda-user-avatar" class="dda-user-avatar" aria-hidden="true"></span>
<span id="dda-user-email" class="dim"></span>
</summary>
<div class="dda-user-menu-panel">
<a href="/profile" class="dda-user-menu-link{{ ' active' if active_page == 'profile' else '' }}">
<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="8" r="4"/><path d="M4 21v-1a8 8 0 0 1 16 0v1"/></svg>
My Profile
</a>
<button type="button" id="dda-logout-btn" class="dda-user-menu-link dda-user-menu-danger">
<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"/><path d="M16 17l5-5-5-5"/><path d="M21 12H9"/></svg>
Sign out
</button>
</div>
</details>
</div>
</aside>