Update html code

This commit is contained in:
Dita Aji Pratama 2024-08-22 15:21:58 +07:00
parent 8a4fe1dfbb
commit f9634f92aa
3 changed files with 36 additions and 32 deletions

View File

@ -3,7 +3,7 @@
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Prime</title> <title>${title}</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet"> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="style.css"> <link rel="stylesheet" href="style.css">
</head> </head>

View File

@ -1,31 +1,41 @@
<!-- Navbar --> <!-- Navbar -->
<nav class="navbar navbar-expand-lg navbar-dark bg-dark"> <nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<div class="container-fluid"> <div class="container-fluid">
<a class="navbar-brand" href="#">Prime Dashboard</a> <a class="navbar-brand" href="#">${title}</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation"> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span> <span class="navbar-toggler-icon"></span>
</button> </button>
<div class="collapse navbar-collapse" id="navbarNav"> <div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav ms-auto"> <ul class="navbar-nav ms-auto">
% for item in menu:
% if any(role in item['roles'] for role in user_roles):
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="#">Home</a> <a class="nav-link ${'active' if item['name'] == active_page else ''}" href="${item['href']}" target="${item['target']}">
</li> % if item['notification'] > 0:
<li class="nav-item"> ${item['name']} <sup class="badge bg-danger">${item['notification']}</sup>
<a class="nav-link" href="#">Customize</a> % else:
</li> ${item['name']}
<li class="nav-item"> % endif
<a class="nav-link" href="#">Notification <sup class="badge bg-danger">1</sup> </a> </a>
</li> </li>
% endif
% endfor
<li class="nav-item dropdown"> <li class="nav-item dropdown">
<a class="nav-link dropdown-toggle d-flex align-items-center" href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false"> <a class="nav-link dropdown-toggle d-flex align-items-center" href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
<img src="no-profile-donut.png" alt="Profile" class="profile-image me-2"> <img src="${profile['picture']}" alt="Profile" class="profile-image me-2">
Dita Aji Pratama ${profile['name']}
</a> </a>
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdown"> <ul class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdown">
<li><a class="dropdown-item" href="#">Profile</a></li> % for item in profile['menu']:
<li><a class="dropdown-item" href="#">Settings</a></li> % if any(role in item['roles'] for role in user_roles):
<li><hr class="dropdown-divider"></li> <li>
<li><a class="dropdown-item" href="#">Logout</a></li> <a class="dropdown-item ${'active' if item['name'] == active_page else ''}" href="${item['href']}" target="${item['target']}">
${item['name']}
</a>
</li>
% endif
% endfor
<!-- <li><hr class="dropdown-divider"></li> -->
</ul> </ul>
</li> </li>
</ul> </ul>

View File

@ -2,21 +2,15 @@
<div class="sidebar p-3" id="sidebar"> <div class="sidebar p-3" id="sidebar">
<!-- <h5>Sidebar</h5> --> <!-- <h5>Sidebar</h5> -->
<ul class="nav flex-column pb-5"> <ul class="nav flex-column pb-5">
% for item in menu:
% if any(role in item['roles'] for role in user_roles):
<li class="nav-item"> <li class="nav-item">
<a class="nav-link text-white" href="#">Dashboard</a> <a class="nav-link text-white ${'active' if item['name'] == active_page else ''}" href="${item['href']}" target="${item['target']}">
</li> ${item['name']}
<li class="nav-item"> </a>
<a class="nav-link text-white" href="#">Users</a>
</li>
<li class="nav-item">
<a class="nav-link text-white" href="#">Items</a>
</li>
<li class="nav-item">
<a class="nav-link text-white" href="#">Analytics</a>
</li>
<li class="nav-item">
<a class="nav-link text-white" href="#">Reports</a>
</li> </li>
% endif
% endfor
<!-- Add more items to test scrolling --> <!-- Add more items to test scrolling -->
</ul> </ul>
</div> </div>