reupload of project

This commit is contained in:
2024-12-06 09:28:08 +01:00
parent f025364a05
commit ebb3f69a4e
28 changed files with 2031 additions and 735 deletions

View File

@@ -1,18 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>About Us</title>
</head>
<body>
<h1>About Our Flask Application</h1>
<p>This is a simple Flask application created to demonstrate how to render templates and create routes.</p>
<p>Flask is a micro web framework for Python. It is easy to use, lightweight, and flexible for creating web applications.</p>
<h2>Our Mission</h2>
<p>To provide an easy-to-understand tutorial for web development using Flask and Python!</p>
<p><a href="{{ url_for('home') }}">Back to Home</a></p>
</body>
</html>

View File

@@ -0,0 +1,90 @@
<!DOCTYPE html>
<html lang="cs">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Uživatelská Tabulka</title>
<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>
Uživatelská Tabulka
</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('logout') }}" class="button">Odhlásit se</a> <!-- New Log Out button -->
</div>
</div>
</header>
<nav class="navbar">
<h2 id="users-table">Tabulka Uživatelů</h2>
</nav>
<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">
{% 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> <!-- New column for actions -->
</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>{{ user['Role_ID'] }}</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> <!-- Edit and Delete buttons -->
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p>No users found.</p>
{% endif %}
</div>
{% endif %}
</div>
</div>
<footer class="footer" id="kontakt">
<div>Made by Hrachovina</div>
</footer>
</body>
</html>

View File

@@ -0,0 +1,64 @@
<!DOCTYPE html>
<html lang="cs">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Vytvořit Nového Uživatele</title>
<link rel="stylesheet" href="{{url_for('static', filename='css/style.css')}}">
<script src="{{url_for('static', filename='scripts/create_user.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>
Vytvořit Nového Uživatele
</h1>
<div class="buttons">
<a href="{{ url_for('administrator') }}" class="button">Zpět na Uživatelskou Tabulku</a>
</div>
</div>
</header>
<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>
<label for="prijmeni">Příjmení:</label>
<input type="text" id="prijmeni" name="prijmeni" required>
<label for="email">Email:</label>
<input type="email" id="email" name="email" required>
<label for="role">Role:</label>
<input type="text" id="role" name="role" required>
<label for="username">Username:</label>
<input type="text" id="username" name="username" required>
<label for="heslo">Heslo:</label>
<input type="password" id="heslo" name="heslo" required>
<button type="submit" class="button">Vytvořit</button>
</form>
{% endif %}
</div>
</div>
<footer class="footer" id="kontakt">
<div>Made by Hrachovina and Kirsch</div>
</footer>
</body>
</html>

View File

@@ -0,0 +1,60 @@
<!DOCTYPE html>
<html lang="cs">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Editovat Uživatele</title>
<link rel="stylesheet" href="{{url_for('static', filename='css/style.css')}}">
</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>
Editovat Uživatele
</h1>
<div class="buttons">
<a href="{{ url_for('administrator') }}" class="button">Zpět na Uživatelskou Tabulku</a>
</div>
</div>
</header>
<div class="container">
<div class="content">
<h2>Editovat Uživatele</h2>
<form action="{{ url_for('edit_user', user_id=user['ID_Uzivatele']) }}" method="post" class="form-container">
<label for="jmeno">Jméno:</label>
<input type="text" id="jmeno" name="jmeno" value="{{ user['Jmeno'] }}" required>
<label for="prijmeni">Příjmení:</label>
<input type="text" id="prijmeni" name="prijmeni" value="{{ user['Prijmeni'] }}" required>
<label for="email">Email:</label>
<input type="email" id="email" name="email" value="{{ user['Email'] }}" required>
<label for="role">Role:</label>
<input type="text" id="role" name="role" value="{{ user['Role_ID'] }}" required>
<label for="username">Username:</label>
<input type="text" id="username" name="username" value="{{ user['Username'] }}" required>
<label for="heslo">Heslo (ponechte prázdné, pokud nechcete měnit):</label>
<input type="password" id="heslo" name="heslo">
<button type="submit" class="button">Aktualizovat</button>
</form>
</div>
</div>
<footer class="footer" id="kontakt">
<div>Made by Hrachovina and Kirsch</div>
</footer>
</body>
</html>

View File

@@ -4,88 +4,143 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Autoservis</title>
<link rel="stylesheet" href="{{url_for('static', filename='style.css')}}">
<link rel="stylesheet" href="{{url_for('static', filename='css/style.css')}}">
<script src="{{url_for('static', filename='scripts/reservation.js')}}"></script>
</head>
<body>
<header>
<div class="container">
<h1>Autoservis</h1>
<div class="header">
<div class="contact-info">
<span>Kontakt: 123 123 123</span>
<span>Otevírací doba: 9-18 hod</span>
<span>auto@servis.cz</span>
<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>
Autoservis
</h1>
<div class="buttons">
<button>Přihlásit se</button>
<button>Objednat se</button>
{% if session.get('logged_in') %}
<a href="{{ url_for('administrator') }}" class="button">Administrace</a>
<a href="{{ url_for('logout') }}" class="button">Odhlásit se</a>
{% else %}
<a href="{{ url_for('login') }}" class="button">Administrace</a>
{% endif %}
<button class="button" onclick="openReservationForm()">Objednat se</button>
</div>
</div>
</header>
{% if session.get('logged_in') %}
<div class="user-info">
<span>Logged in: {{ session.get('username') }}</span>
</div>
{% endif %}
<nav class="navbar">
<a href="#o-nas">O nás</a>
<a href="#nabidka-sluzeb">Nabídka služeb</a>
<a href="#recenze">Recenze</a>
<a href="#kontakt">Kontakt</a>
<button class="button" onclick="location.href='#about-header'">O nás</button>
<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>
</nav>
<div class="container">
<div class="content">
<div class="about">
<h2 id="o-nas">O nás</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla consequat.</p>
</div>
<div class="photos">
<h2>Fotografie autoservisu</h2>
</div>
<div class="map">
<h2>
<iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d2607.057050033818!2d16.625835399999996!3d49.19947729999999!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x471294f40ffa3c2b%3A0x6ceee968235c0272!2sCejl%2036%2F64%2C%20602%2000%20Brno-st%C5%99ed!5e0!3m2!1scs!2scz!4v1731501763892!5m2!1scs!2scz" width="600" height="450" style="border:0;" allowfullscreen="" loading="lazy" referrerpolicy="no-referrer-when-downgrade"></iframe>
</h2>
</div>
<div class="directions">
<h2>Jak se k nám dostanete?</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
<div class="about-content">
<div class="about-text">
<h2 id="about-header">O nás</h2>
<p>Již po mnoho let se staráme o vaše automobily s maximální pečlivostí a odborností. Naše dlouhá historie sahá až do doby, kdy se auta stala nedílnou součástí každodenního života. Od té doby jsme ušli dlouhou cestu a vybudovali jsme si pevnou pověst spolehlivého partnera pro všechny motoristy.
Proč si vybrat právě nás?
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed auctor, velit nec ultricies ultricies, nunc libero ultricies nunc, nec ultricies nunc libero nec libero. Sed auctor, velit nec ultricies ultricies, nunc libero ultricies nunc, nec ultricies nunc libero nec libero. Sed auctor, velit nec ultricies ultricies, nunc libero ultricies nunc, nec ultricies nunc libero nec libero.
</p>
</div>
<div class="about-image">
<img src="{{url_for('static', filename='img/autoservis.jpg')}}" alt="Car repair">
</div>
</div>
</div>
</div>
<div id="directions" class="directions">
<div class="directions-content">
<iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d2607.057050033818!2d16.625835399999996!3d49.19947729999999!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x471294f40ffa3c2b%3A0x6ceee968235c0272!2sCejl%2036%2F64%2C%20602%2000%20Brno-st%C5%99ed!5e0!3m2!1scs!2scz!4v1731501763892!5m2!1scs!2scz" width="50%" height="450" style="border:0; border-radius: 0.5em;" allowfullscreen="" loading="lazy" referrerpolicy="no-referrer-when-downgrade"></iframe>
<div class="directions-text">
<h2 class="directions-header">Jak se k nám dostanete?</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
<p>Začněte na hlavním nádraží a pokračujte po ulici Masarykova. Na konci ulice odbočte doprava na ulici Benešova. Pokračujte rovně, dokud nedosáhnete křižovatky s ulicí Cejl. Zde odbočte doleva a pokračujte po ulici Cejl, dokud nedosáhnete našeho autoservisu, který se nachází na pravé straně ulice.</p>
</div>
</div>
</div>
<div class="services">
<h2 id="nabidka-sluzeb">Nabídka služeb</h2>
<h2 id="nabidka-sluzeb" class="nabidka-sluzeb">Nabídka služeb</h2>
<div class="service-list">
<div class="service-item">
<img src="car-icon.png" alt="Car">
<img src="{{url_for('static', filename='img/car-icon.png')}}" alt="Car">
<p>Oprava osobních vozidel</p>
</div>
<div class="service-item">
<img src="atv-icon.png" alt="ATV">
<img src="{{url_for('static', filename='img/atv-icon.png')}}" alt="ATV">
<p>Oprava čtyřkolek</p>
</div>
<div class="service-item">
<img src="scooter-icon.png" alt="Scooter">
<img src="{{url_for('static', filename='img/scooter-icon.png')}}" alt="Scooter">
<p>Oprava skútrů</p>
</div>
<div class="service-item">
<img src="motorcycle-icon.png" alt="Motorcycle">
<img src="{{url_for('static', filename='img/motorcycle-icon.png')}}" alt="Motorcycle">
<p>Oprava motorek</p>
</div>
</div>
</div>
<div class="reviews" id="recenze">
<div class="review-box">Recenze 1</div>
<div class="review-box">Recenze 2</div>
<div class="review-box">Recenze 3</div>
<div class="review-box">Recenze 4</div>
<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>
<footer class="footer" id="kontakt">
<div>Made by Hrachovina and Kirsch</div>
</footer>
<!-- Reservation Form Popup -->
<div id="reservationForm" class="popup-form">
<div class="form-container">
<span class="close-button" onclick="closeReservationForm()">&times;</span>
<h2>Rezervace</h2>
<form>
<label for="fullName">Celé jméno: <span class="required">*</span></label>
<input type="text" id="fullName" name="fullName" required>
<label for="email">Email: <span class="required">*</span></label>
<input type="email" id="email" name="email" required>
<label for="date">Datum: <span class="required">*</span></label>
<input type="date" id="date" name="date" required>
<label for="description">Popis: <span class="required">*</span></label>
<textarea id="description" name="description" rows="4" required></textarea>
<button type="submit" class="button">Odeslat</button>
</form>
</div>
</div>
<footer class="footer" id="kontakt">
<div>Adresa: Cejl 36, Brno-střed</div>
<div>Kontakt: 123 123 123</div>
<div>Pobočky: Praha, Brno, Ostrava</div>
<div>Služby: Oprava klimatizace, Geometrie kol, Diagnostika</div>
</footer>
</body>
</html>

31
web/templates/login.html Normal file
View File

@@ -0,0 +1,31 @@
<!DOCTYPE html>
<html lang="cs">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Přihlášení</title>
<link rel="stylesheet" href="{{url_for('static', filename='css/style.css')}}">
</head>
<body>
<div class="form-container">
<h2> Přihlášení </h2>
{% with messages = get_flashed_messages(with_categories=true) %}
{% if messages %}
<ul class="flashes">
<li class="{{ messages[-1][0] }}">{{ messages[-1][1] }}</li> <!-- Show only the last message -->
</ul>
{% endif %}
{% endwith %}
<form method="POST" action="{{ url_for('login') }}">
<label for="username">Uživatelské jméno: <span class="required">*</span></label>
<input type="text" id="username" name="username" required>
<label for="password">Heslo: <span class="required">*</span></label>
<input type="password" id="password" name="password" required>
<button type="submit" class="button">Přihlásit se</button>
</form>
</div>
<div style="text-align: center;">
<a href="{{ url_for('home') }}" class="button">Domů</a>
</div>
</body>
</html>