final version, submitted to teacher

This commit is contained in:
2024-12-24 17:34:52 +01:00
parent c0528a2488
commit 46a42c99c2
16 changed files with 394 additions and 105 deletions

View File

@@ -30,15 +30,8 @@
</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>
@@ -148,19 +141,19 @@
<th>ID</th>
<th>Název</th>
<th>Popis</th>
<th>Momentální Zásoba</th>
<th>Minimální Zásoba</th>
<th>Momentální Zásoba</th>
<th>Akce</th>
</tr>
</thead>
<tbody>
{% for product in products %}
<tr style="text-align: center;">
<tr>
<td>{{ product['ID_Produktu'] }}</td>
<td>{{ product['Nazev'] }}</td>
<td>{{ product['Popis'] }}</td>
<td>{{ product['Momentalni_Zasoba'] }}</td>
<td>{{ product['Minimalni_Zasoba'] }}</td>
<td>{{ product['Momentalni_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>
@@ -171,14 +164,13 @@
</table>
{% else %}
<table>
<tr style="text-align: center;">
<tr>
<td colspan="6">Nenalezeny žádné produkty k zobrazení.</td>
</tr>
</table>
{% endif %}
</div>
{% endif %}
</div>
</div>
</div>
<footer class="footer">
<div>Made by Hrachovina</div>

View File

@@ -30,6 +30,23 @@
<label for="popis">Popis:</label>
<textarea id="popis" name="popis" required></textarea>
<h3>Použité Produkty</h3>
<div id="product-container">
<div class="product-item" id="product-item-0">
<label for="product_0">Produkt:</label>
<select id="product_0" name="products[0][id]" required>
<option value="" disabled selected>Vyberte produkt</option>
{% for product in products %}
<option value="{{ product['ID_Produktu'] }}">{{ product['Nazev'] }}</option>
{% endfor %}
</select>
<label for="quantity_0">Množství:</label>
<input type="number" id="quantity_0" name="products[0][quantity]" value="0" min="0" required>
<button type="button" onclick="removeProduct(0)">Odstranit</button>
</div>
</div>
<button type="button" onclick="addProduct()">Přidat Produkt</button>
<button type="submit" class="button">Vytvořit</button>
</form>
</div>
@@ -38,5 +55,7 @@
<div>Made by Hrachovina</div>
</footer>
<script src="{{ url_for('static', filename='scripts/products.js') }}"></script>
</body>
</html>

View File

@@ -29,9 +29,6 @@
<div class="container">
<div class="content">
{% if not session.get('logged_in') or session.get('role_id') != 1 %}
<p>Nemáte oprávnění k přístupu na tuto stránku.</p>
{% else %}
<form action="{{ url_for('create_user') }}" method="post" class="form-container" onsubmit="handleCreateUser(event)">
<label for="jmeno">Jméno:</label>
<input type="text" id="jmeno" name="jmeno" required>
@@ -57,7 +54,6 @@
<button type="submit" class="button">Vytvořit</button>
</form>
{% endif %}
</div>
</div>

View File

@@ -42,14 +42,35 @@
<label for="popis">Popis:</label>
<textarea id="popis" name="popis" required>{{ repair['Popis'] }}</textarea>
<h3>Použité Produkty</h3>
<div id="product-container">
{% for product in repair['products'] %}
<div class="product-item" id="product-item-{{ loop.index0 }}">
<label for="product_{{ loop.index0 }}">Produkt:</label>
<select id="product_{{ loop.index0 }}" name="products[{{ loop.index0 }}][id]" required>
<option value="" disabled>Vyberte produkt</option>
{% for p in products %}
<option value="{{ p['ID_Produktu'] }}" {% if p['ID_Produktu'] == product['ID_Produktu'] %}selected{% endif %}>{{ p['Nazev'] }}</option>
{% endfor %}
</select>
<label for="quantity_{{ loop.index0 }}">Množství:</label>
<input type="number" id="quantity_{{ loop.index0 }}" name="products[{{ loop.index0 }}][quantity]" value="{{ product['Pocet_Produktu'] }}" min="0" required>
<button type="button" style="margin-top: -5px;" onclick="removeProduct({{ loop.index0 }})">Odstranit</button>
</div>
{% endfor %}
</div>
<button type="button" onclick="addProduct()">Přidat Produkt</button>
<button type="submit" class="button">Aktualizovat</button>
</form>
</div>
</div>
<footer class="footer" id="kontakt">
<div>Made by Hrachovina</div>
<div>Made by Hrachovina and Kirsch </div>
</footer>
<script src="{{ url_for('static', filename='scripts/products.js') }}"></script>
</body>
</html>

View File

@@ -51,6 +51,7 @@
<button class="button" onclick="location.href='#directions'">K nám</button>
<button class="button" onclick="location.href='#nabidka-sluzeb'">Služby</button>
<button class="button" onclick="location.href='#recenze'">Recenze</button>
<button class="button" onclick="location.href='#partners'">Partneři</button>
</nav>
<div class="container">
@@ -105,27 +106,49 @@
</div>
<div class="reviews" id="recenze">
<div class="review-box">
<p>Skvělý servis! Rychlá a profesionální oprava.</p>
<p>⭐⭐⭐⭐</p>
<p>- Jan Novák</p>
</div>
<div class="review-box">
<p>Velmi přátelský personál a kvalitní služby.</p>
<p>⭐⭐⭐⭐⭐</p>
<p>- Petra Svobodová</p>
</div>
<div class="review-box">
<p>Oprava byla hotová dříve, než jsem očekával.</p>
<p>⭐⭐⭐</p>
<p>- Martin Dvořák</p>
</div>
<div class="review-box">
<p>Výborná komunikace a skvělé ceny. Určitě se vrátím.</p>
<p>⭐⭐⭐⭐⭐</p>
<p>- Eva Černá</p>
<h2 class="reviews-header">Recenze</h2>
<div class="review-list">
<div class="review-box">
<p>Skvělý servis! Rychlá a profesionální oprava.</p>
<p>⭐⭐⭐⭐</p>
<p>- Jan Novák</p>
</div>
<div class="review-box">
<p>Velmi přátelský personál a kvalitní služby.</p>
<p>⭐⭐⭐⭐⭐</p>
<p>- Petra Svobodová</p>
</div>
<div class="review-box">
<p>Oprava byla hotová dříve, než jsem očekával.</p>
<p>⭐⭐⭐</p>
<p>- Martin Dvořák</p>
</div>
<div class="review-box">
<p>Výborná komunikace a skvělé ceny. Určitě se vrátím.</p>
<p>⭐⭐⭐⭐⭐</p>
<p>- Eva Černá</p>
</div>
</div>
</div>
<div class="partners" id="partners">
<h2>Naši partneři</h2>
<div class="partner-list">
<div class="partner-item">
<img src="{{url_for('static', filename='img/partner1.png')}}" alt="Partner 1">
</div>
<div class="partner-item">
<img src="{{url_for('static', filename='img/partner2.png')}}" alt="Partner 2">
</div>
<div class="partner-item">
<img src="{{url_for('static', filename='img/partner3.png')}}" alt="Partner 3">
</div>
<div class="partner-item">
<img src="{{url_for('static', filename='img/partner4.png')}}" alt="Partner 4">
</div>
</div>
</div>
</div>
<footer class="footer">
<div>Made by Hrachovina and Kirsch</div>
@@ -150,6 +173,24 @@
</div>
</div>
<script src="{{url_for('static', filename='scripts/home.js')}}"></script>
<script>
function openReservationForm() {
const now = new Date();
const minDate = new Date();
minDate.setDate(now.getDate() + 3); // Exclude today and the next 2 days
const formattedMinDate = minDate.toISOString().split('T')[0];
document.getElementById('datum_konce').setAttribute('min', formattedMinDate);
document.getElementById('reservationForm').style.display = 'block';
}
function closeReservationForm() {
document.getElementById('reservationForm').style.display = 'none';
}
function showReservationSuccess() {
alert('Rezervace byla úspěšně vytvořena.');
}
</script>
</body>
</html>

View File

@@ -6,7 +6,7 @@
<title>Správa Manažerů</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>
<!-- <script src="{{url_for('static', filename='scripts/user_table.js')}}"></script> -->
</head>
<body>
@@ -31,11 +31,6 @@
<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') not in [1, 2] %}
<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>
@@ -69,11 +64,13 @@
</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>
{% if user['Role_ID'] > session.get('role_id') or user['ID_Uzivatele'] == session.get('user_id') %}
<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 %}
{% endif %}
</td>
</tr>
@@ -134,7 +131,6 @@
</table>
{% endif %}
</div>
{% endif %}
</div>
</div>

View File

@@ -29,9 +29,6 @@
<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>
{% else %}
<div class="user-table">
<nav class="table-header">
<h2 id="users-table">Správa Oprav</h2>
@@ -61,7 +58,7 @@
{% endfor %}
</td>
<td>
<a href="{{ url_for('edit_repair', repair_id=repair['ID_Opravy']) }}" class="button-link">Edit</a>
<a href="{{ url_for('edit_repair', repair_id=repair['ID_Opravy']) }}" class="button-link">Edit</a> /
<form action="{{ url_for('delete_repair', repair_id=repair['ID_Opravy']) }}" method="post" style="display:inline;" onsubmit="return confirm('Opravdu chcete smazat tuto opravu?');">
<button type="submit" class="button-link">Delete</button>
</form>
@@ -94,7 +91,7 @@
</thead>
<tbody>
{% for order in orders %}
<tr style="text-align: center;">
<tr>
<td>{{ order['ID_Objednavky'] }}</td>
<td>{{ order['Datum_Zacatku'] }}</td>
<td>{{ order['Datum_Konce'] }}</td>
@@ -119,13 +116,12 @@
</table>
{% else %}
<table>
<tr style="text-align: center;">
<tr>
<td colspan="7">Nenalezeny žádné objednávky k zobrazení.</td>
</tr>
</table>
{% endif %}
</div>
{% endif %}
</div>
</div>