From 650df9d0f68bbacfe38c3a17a599fd66c4c990a7 Mon Sep 17 00:00:00 2001 From: coolneng Date: Sun, 14 Jun 2020 04:25:11 +0200 Subject: [PATCH] Prettify forms with CSS --- database/db.sql | 4 +- {templates => html}/header-footer.html | 0 html/static/style.css | 81 ++++++++++++++++++++++++++ src/database.php | 2 +- static/style.css | 4 -- 5 files changed, 84 insertions(+), 7 deletions(-) rename {templates => html}/header-footer.html (100%) create mode 100644 html/static/style.css delete mode 100644 static/style.css diff --git a/database/db.sql b/database/db.sql index fe321e9..a2aa6cd 100644 --- a/database/db.sql +++ b/database/db.sql @@ -33,8 +33,8 @@ CREATE TABLE IF NOT EXISTS usuario( rol INT NOT NULL, especialidad VARCHAR(50), correo VARCHAR(100) NOT NULL, - fecha_alta DATE NOT NULL, - fecha_baja DATE, + fecha_alta TIMESTAMP DEFAULT CURRENT_TIMESTAMP, + fecha_baja TIMESTAMP, FOREIGN KEY (rol) REFERENCES rol(codigo) ); diff --git a/templates/header-footer.html b/html/header-footer.html similarity index 100% rename from templates/header-footer.html rename to html/header-footer.html diff --git a/html/static/style.css b/html/static/style.css new file mode 100644 index 0000000..7ad40f2 --- /dev/null +++ b/html/static/style.css @@ -0,0 +1,81 @@ +* { + font-family: Roboto, Mono; + font-size: 14px; +} + +table{ + width: 50%; + margin: 30px auto; + border-collapse: collapse; + text-align: left; +} +tr { + border-bottom: 1px solid #cbcbcb; +} +th, td{ + border: none; + height: 30px; + padding: 2px; +} +tr:hover { + background: #F5F5F5; +} + +form { + width: 45%; + margin: 50px auto; + text-align: left; + padding: 20px; + border: 1px solid #bbbbbb; + border-radius: 5px; +} + +.input-group { + margin: 10px 0px 10px 0px; +} +.input-group label { + display: block; + text-align: left; + margin: 3px; +} +.input-group input { + height: 30px; + width: 93%; + padding: 5px 10px; + font-size: 16px; + border-radius: 5px; + border: 1px solid gray; +} +.btn { + padding: 10px; + font-size: 15px; + color: white; + background: #5F9EA0; + border: none; + border-radius: 5px; +} +.edit_btn { + text-decoration: none; + padding: 2px 5px; + background: #2E8B57; + color: white; + border-radius: 3px; +} + +.del_btn { + text-decoration: none; + padding: 2px 5px; + color: white; + border-radius: 3px; + background: #800000; +} +.msg { + margin: 30px auto; + padding: 10px; + border-radius: 5px; + color: #3c763d; + background: #dff0d8; + border: 1px solid #3c763d; + width: 50%; + text-align: center; +} diff --git a/src/database.php b/src/database.php index 6aa6240..0c9aa04 100644 --- a/src/database.php +++ b/src/database.php @@ -73,7 +73,7 @@ function deleteHoliday($pdo, str $id) { function createUser($pdo, $data) { $query = "INSERT INTO usuario (nombre, usuario, contraseña, rol, correo) VALUES (? ? ? ? ?)"; - $pdo->prepare($query)->execute([$data["nombre"], $data["usuario"], $data["contraseña"], $data["rol"], $data[$correo]]); + $pdo->prepare($query)->execute([$data["nombre"], $data["usuario"], $data["contraseña"], $data["rol"], $data["correo"]]); return "Usuario creado con éxito"; } diff --git a/static/style.css b/static/style.css deleted file mode 100644 index ee14fe1..0000000 --- a/static/style.css +++ /dev/null @@ -1,4 +0,0 @@ -* { - font-family: Roboto, Mono; - font-size: 14px; -}