From 88590f274a65d44f328baec2b06cbf91bcb9f199 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?No=C3=A9=20Le=20Cam?= <noe.le.cam.nlc@gmail.com>
Date: Tue, 29 Mar 2022 16:02:59 +0200
Subject: [PATCH] Admin page front-end

---
 admin.php              | 36 +++++++++++++++++++++++
 assets/css/cookies.css | 67 +++++++++++++++++++++++++++++++-----------
 assets/css/form.css    |  3 +-
 assets/css/main.css    | 20 +++++++++----
 assets/css/result.css  |  2 ++
 assets/css/search.css  | 41 +++++++++++++++++++-------
 assets/locale/fr.php   |  8 +++--
 assets/php/nav.php     |  2 +-
 index.php              |  4 +--
 search.php             |  7 +++--
 10 files changed, 149 insertions(+), 41 deletions(-)
 create mode 100644 admin.php

diff --git a/admin.php b/admin.php
new file mode 100644
index 0000000..d4991e2
--- /dev/null
+++ b/admin.php
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<html lang="fr">
+
+<head>
+  <title>UFHOUR - Admin</title>
+
+  <!-- Head -->
+  <?php require("assets/php/head.php"); ?>
+</head>
+
+<body>
+  <main>
+    <header>
+      <h1>UFHOUR</h1>
+      <p><?= $locale["subtitle"]; ?></p>
+    </header>
+    <h2><?=$locale["admin_login"]; ?></h2>
+    <hr>
+
+    <form>
+      <label><?= $locale["username"]; ?>
+        <input type="text" name="username" required>
+      </label>
+      <label><?= $locale["password"]; ?>
+        <input type="password" name="password" required>
+      </label>
+
+      <button type="submit"><?= $locale["login_action"]; ?></button>
+    </form>
+  </main>
+
+  <?php include "assets/php/cookies.php"; ?>
+  <?php include "assets/php/nav.php"; ?>
+</body>
+
+</html>
\ No newline at end of file
diff --git a/assets/css/cookies.css b/assets/css/cookies.css
index 0d26405..cd29634 100644
--- a/assets/css/cookies.css
+++ b/assets/css/cookies.css
@@ -1,22 +1,25 @@
 #cookies {
   position: fixed;
-  bottom: 1.5rem;
-  left: 1.8rem;
+  bottom: 1rem;
+  left: 1rem;
   display: flex;
   gap: 1rem;
 }
 
-#cookies > div {
-  background: rgb(255, 255, 255);
-  display: flex;
-  align-items: center;
-  text-align: right;
-  gap: 1rem;
-  width: 23rem;
+#cookies::after {
+  content: "";
+  display: block;
+  position: absolute;
+  right: -10%;
+  bottom: 0;
+  border-radius: 50px;
+  width: 30px;
+  height: 30px;
+  background-color: var(--marblue);
+}
 
-  margin-top: 1.1rem;
-  border-radius: 20px 300px 300px 500px;
-  padding: 0.8rem 1rem;
+#cookies > div {
+  display: none;
 }
 
 #cookies > div > p {
@@ -27,7 +30,7 @@
 }
 
 #cookies > img {
-  height: 5rem;
+  height: 4rem;
 }
 
 #cookies button {
@@ -40,7 +43,37 @@
 
 #wip {
   position: fixed;
-  top: 2rem;
-  left: 2rem;
-  height: 150px;
-}
\ No newline at end of file
+  top: -15px;
+  left: 5rem;
+  height: 100px;
+}
+
+@media screen and (min-width: 768px) {
+  #cookies {
+    position: fixed;
+    bottom: 1.5rem;
+    left: 1.8rem;
+    display: flex;
+    gap: 1rem;
+  }
+  #cookies::after {
+    display: none;
+  }
+
+  #cookies > div {
+    background: rgb(255, 255, 255);
+    display: flex;
+    align-items: center;
+    text-align: right;
+    gap: 1rem;
+    width: 23rem;
+
+    margin-top: 1.1rem;
+    border-radius: 20px 300px 300px 500px;
+    padding: 0.8rem 1rem;
+  }
+
+  #cookies > img {
+    height: 5rem;
+  }
+}
diff --git a/assets/css/form.css b/assets/css/form.css
index a1ce897..0306b4d 100644
--- a/assets/css/form.css
+++ b/assets/css/form.css
@@ -8,7 +8,8 @@ main > form {
   padding: 1.5rem;
   border-radius: 10px;
   max-width: 100vw;
-  margin: 10px 10px;
+  margin-left: 10px;
+  margin-right: 10px;
 }
 
 @media screen and (min-width: 768px) {
diff --git a/assets/css/main.css b/assets/css/main.css
index c0ae3f3..9ee107b 100644
--- a/assets/css/main.css
+++ b/assets/css/main.css
@@ -25,7 +25,7 @@ main {
   background: rgba(0, 0, 0, 0.9);
 
   position: fixed;
-  padding-bottom: 5rem;
+  padding-bottom: 7rem;
 
   display: flex;
   flex-direction: column;
@@ -34,13 +34,25 @@ main {
   gap: 1rem;
 }
 
+h2 {
+  margin-top: 0rem;
+}
+
+hr {
+  width: 10rem;
+  display: none;
+}
+
 @media screen and (min-width: 576px) {
   main {
+    padding-top: 2rem;
     justify-content: center;
   }
-}
-
 
+  hr {
+    display: block;
+  }
+}
 
 header * {
   font-family: "Roboto Mono", sans-serif;
@@ -70,8 +82,6 @@ header > h1 {
   }
 }
 
-
-
 header > p {
   text-align: center;
   font-weight: 300;
diff --git a/assets/css/result.css b/assets/css/result.css
index c507263..ebf29ed 100644
--- a/assets/css/result.css
+++ b/assets/css/result.css
@@ -1,5 +1,7 @@
 .result {
   display: flex;
+  flex-wrap: wrap;
+
   justify-content: space-between;
   gap: 2rem;
   background: var(--smoke);
diff --git a/assets/css/search.css b/assets/css/search.css
index 156a348..a8b1c04 100644
--- a/assets/css/search.css
+++ b/assets/css/search.css
@@ -1,17 +1,38 @@
 section {
-    display: flex;
-    flex-direction: column;
-    gap: 0.5rem;
-    overflow:hidden; overflow-y:scroll;
-    height: 55vh;
-    width: 40rem;
-    border-radius: 10px;
+  display: flex;
+  flex-direction: column;
+  gap: 0.5rem;
+  overflow: hidden;
+  overflow-y: scroll;
+  height: 100%;
+  max-width: 100vw;
+  box-sizing: border-box;
+  border-radius: 10px;
+  margin-left: 10px;
+  margin-right: 10px;
+}
+
+section > .result {
+  justify-content: center;
 }
 
 h2 {
-    margin-top: 2rem;
+  margin-top: 0rem;
 }
 
 hr {
-    width: 10rem;
-}
\ No newline at end of file
+  width: 10rem;
+  display: none;
+}
+
+@media screen and (min-width: 768px) {
+  section {
+    max-width: none;
+    width: 700px;
+    margin: none;
+  }
+
+  section > .result {
+    justify-content: space-between;
+  }
+}
diff --git a/assets/locale/fr.php b/assets/locale/fr.php
index 73ab573..3e4dfc3 100644
--- a/assets/locale/fr.php
+++ b/assets/locale/fr.php
@@ -18,6 +18,10 @@ $locale = [
 	"cookies_info" => "Ce site utilises des cookies afin d'assurer son bon fonctionnement.",
 	"cookies_details" => "Détails",
 	"from_to" => "à",
-	"floor_ground" => "Rez de chaussée",
-	"floor" => "étage"
+	"floor_ground" => "RDC",
+	"floor" => "étage",
+	"username" => "Nom d'utilisateur",
+	"password" => "Mot de passe",
+	"admin_login" => "Connexion au tableau d'admin",
+	"login_action" => "S'authentifier"
 ];
\ No newline at end of file
diff --git a/assets/php/nav.php b/assets/php/nav.php
index 8468dd5..b6bed2b 100644
--- a/assets/php/nav.php
+++ b/assets/php/nav.php
@@ -14,7 +14,7 @@
 			<li><a href="/index.php"><?= $locale["nav_home"]; ?></a></li>
 			<li><a><?= $locale["nav_feedback"]; ?></a></li>
 			<li><a><?= $locale["nav_about"]; ?></a></li>
-			<li><a><?= $locale["nav_admin"]; ?></a></li>
+			<li><a href="/admin.php"><?= $locale["nav_admin"]; ?></a></li>
 		</ul>
 		<button>
 			<i class="material-icons">menu</i>
diff --git a/index.php b/index.php
index 5209e24..59ca9b7 100644
--- a/index.php
+++ b/index.php
@@ -1,5 +1,5 @@
 <!DOCTYPE html>
-<html lang="en">
+<html lang="fr">
 
 <head>
   <title>UFHOUR</title>
@@ -34,7 +34,7 @@
         <select name="room_type">
           <option value="tp"><?= $locale["room_tp"]; ?></option>
           <option value="td"><?= $locale["room_td"]; ?></option>
-          <option value="amphi"><?= $locale["room_amphi"]; ?></option>
+          <!-- <option value="amphi"><?= $locale["room_amphi"]; ?></option> -->
         </select>
       </label>
 
diff --git a/search.php b/search.php
index 7628167..ee29401 100644
--- a/search.php
+++ b/search.php
@@ -17,7 +17,8 @@ try {
   $query = $pdo->prepare("SELECT id, type, start_time, end_time, location
     FROM schedule NATURAL JOIN rooms
     WHERE type LIKE :type AND date(date) = date(:date)
-    AND time(end_time) > time(:start_time) AND time(start_time) < time(:end_time)");
+    AND time(end_time) > time(:start_time) AND time(start_time) < time(:end_time)
+    ORDER BY start_time");
 
   /**
    * QUERY DESCRIPTION : 
@@ -59,10 +60,10 @@ try {
 
 ?>
 <!DOCTYPE html>
-<html lang="en">
+<html lang="fr">
 
 <head>
-  <title>UFHOUR</title>
+  <title>UFHOUR - Search</title>
 
   <!-- Head -->
   <?php require("assets/php/head.php"); ?>
-- 
GitLab