This repository has been archived on 2025-05-05. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
vwa_project/web/templates/administrator.html

189 lines
6.2 KiB
HTML

<!DOCTYPE html>
<html lang="cs">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Administrativní pracovníci</title>
<link rel="icon" href="{{url_for('static', filename='img/logo.webp')}}" type="image/x-icon">
<link rel="stylesheet" href="{{url_for('static', filename='css/style.css')}}">
<script src="{{url_for('static', filename='scripts/user_table.js')}}"></script>
</head>
<body>
<header>
<div class="header">
<div class="contact-info">
<span>Kontakt: 123 123 123 | Otevírací doba: 9-18 hod | auto@servis.cz </span>
</div>
<h1 class="nazev">
<a href="{{ url_for('home') }}" style="text-decoration: none;">
<img src="{{url_for('static', filename='img/logo.webp')}}" alt="Logo" class="logo">
</a>
Administrativní pracovníci
</h1>
<div class="buttons">
<a href="{{ url_for('home') }}" class="button">Zpět na Domovskou Stránku</a>
<a href="{{ url_for('create_user') }}" class="button">Vytvořit Nového Uživatele</a>
<a href="{{ url_for('create_product') }}" class="button">Přidat Nový Produkt</a> <!-- Fixed route -->
<a href="{{ url_for('logout') }}" class="button">Odhlásit se</a>
</div>
</div>
</header>
<div class="container">
<div class="content">
{% if not session.get('logged_in') %}
<p>Musíte se přihlásit, abyste mohli zobrazit tuto stránku.</p>
{% elif session.get('role_id') != 1 %}
<p>Nemáte oprávnění zobrazit tuto stránku.</p>
{% else %}
<div class="user-table">
<nav class="table-header">
<h2 id="users-table">Správa Uživatelů</h2>
</nav>
{% if users %}
<table>
<thead>
<tr>
<th>ID</th>
<th>Jméno</th>
<th>Prijmeni</th>
<th>Email</th>
<th>Role</th>
<th>Username</th>
<th>Akce</th>
</tr>
</thead>
<tbody>
{% for user in users %}
<tr>
<td>{{ user['ID_Uzivatele'] }}</td>
<td>{{ user['Jmeno'] }}</td>
<td>{{ user['Prijmeni'] }}</td>
<td>{{ user['Email'] }}</td>
<td>
{% for role in roles %}
{% if role['Role_ID'] == user['Role_ID'] %}
{{ role['Nazev'] }}
{% endif %}
{% endfor %}
</td>
<td>{{ user['Username'] }}</td>
<td>
<a href="{{ url_for('edit_user', user_id=user['ID_Uzivatele']) }}">Edit</a>
{% if user['Role_ID'] > session.get('role_id') %}
/ <form action="{{ url_for('delete_user', user_id=user['ID_Uzivatele']) }}" method="post" style="display:inline;" onsubmit="return confirm('Opravdu chcete smazat tohoto uživatele?');">
<button type="submit" class="button-link">Delete</button>
</form>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p>No users found.</p>
{% endif %}
</div>
<div class="order-management">
<nav class="table-header">
<h2 id="orders-table">Správa objednávek</h2>
</nav>
{% if orders %}
<table>
<thead>
<tr>
<th>ID</th>
<th>Datum začátku</th>
<th>Datum konce</th>
<th>Stav</th>
<th>Přiřazený zaměstnanec</th>
<th>Popis</th>
<th>Akce</th>
</tr>
</thead>
<tbody>
{% for order in orders %}
<tr style="text-align: center;">
<td>{{ order['ID_Objednavky'] }}</td>
<td>{{ order['Datum_Zacatku'] }}</td>
<td>{{ order['Datum_Konce'] }}</td>
<td>{{ order['Stav'] }}</td>
<td>
{% for user in users %}
{% if user['ID_Uzivatele'] == order['ID_Zamestnance'] %}
{{ user['Jmeno'] }} {{ user['Prijmeni'] }}
{% endif %}
{% endfor %}
</td>
<td>{{ order['Popis'] }}</td>
<td>
<a href="{{ url_for('edit_order', order_id=order['ID_Objednavky']) }}">Edit</a> /
<form action="{{ url_for('delete_order', order_id=order['ID_Objednavky']) }}" method="post" style="display:inline;" onsubmit="return confirm('Opravdu chcete smazat tuto objednávku?');">
<button type="submit" class="button-link">Delete</button>
</form>
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<table>
<tr style="text-align: center;">
<td colspan="7">Nenalezeny žádné objednávky k zobrazení.</td>
</tr>
</table>
{% endif %}
</div>
<div class="stock-management">
<nav class="table-header">
<h2 id="stock-table">Správa produktových zásob</h2>
</nav>
{% if products %}
<table>
<thead>
<tr>
<th>ID</th>
<th>Název</th>
<th>Popis</th>
<th>Momentální Zásoba</th>
<th>Minimální Zásoba</th>
<th>Akce</th>
</tr>
</thead>
<tbody>
{% for product in products %}
<tr style="text-align: center;">
<td>{{ product['ID_Produktu'] }}</td>
<td>{{ product['Nazev'] }}</td>
<td>{{ product['Popis'] }}</td>
<td>{{ product['Momentalni_Zasoba'] }}</td>
<td>{{ product['Minimalni_Zasoba'] }}</td>
<td>
<a href="{{ url_for('edit_product', product_id=product['ID_Produktu']) }}">Edit</a> /
<a href="{{ url_for('add_product_stock', product_id=product['ID_Produktu']) }}">Add</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<table>
<tr style="text-align: center;">
<td colspan="6">Nenalezeny žádné produkty k zobrazení.</td>
</tr>
</table>
{% endif %}
</div>
{% endif %}
</div>
</div>
<footer class="footer">
<div>Made by Hrachovina</div>
</footer>
</body>
</html>