diff --git a/controllers/workout_controller.js b/controllers/workout_controller.js index 4072cfa..42e1613 100644 --- a/controllers/workout_controller.js +++ b/controllers/workout_controller.js @@ -210,15 +210,10 @@ router.put("/workouts/:workoutid/exercise/:exerciseid", (req, res) => { }) router.put("/workouts/:id", (req, res) => { - if (!req.body.name || !req.body.workout_date) { - res.redirect(`/workouts/${req.params.id}/edit`) - return - } else { - const sql = "UPDATE workouts SET name = $1, workout_date = $2 WHERE workout_id = $3;" - db.query(sql, [req.body.name, req.body.date, req.params.id], (err, dbRes) => { - res.redirect(`/workouts/${req.params.id}`) - }) - } + const sql = "UPDATE workouts SET name = $1, workout_date = $2 WHERE workout_id = $3;" + db.query(sql, [req.body.name, req.body.date, req.params.id], (err, dbRes) => { + res.redirect(`/workouts/${req.params.id}`) + }) }) router.delete("/workouts/:workoutid/exercise/:exerciseid/log/:logid", (req, res) => { diff --git a/public/css/style.css b/public/css/style.css index b21582d..1698105 100644 --- a/public/css/style.css +++ b/public/css/style.css @@ -141,14 +141,14 @@ main { main h2 { margin: 0px; - padding: 15px 0; + padding: 30px 0 20px 0; color: #4B0082; - font-size: 1.5em; + font-size: 3em; } footer { border-top: 1px solid #4B0082; background-color: #ffffff; - padding: 15px 0; + padding: 15px 10px; font-size: 1em; } \ No newline at end of file diff --git a/public/css/workout_details.css b/public/css/workout_details.css index d5cb5fc..eddb07d 100644 --- a/public/css/workout_details.css +++ b/public/css/workout_details.css @@ -1,11 +1,126 @@ +.workout_details h3 { + font-family: 'Bebas Neue', cursive; + color: #522d80; + font-size: 3em; +} + +.btn-workout { + width: 30%; + display: grid; + margin: 10px auto 20px auto; + grid-template-columns: 50% 50%; +} + +.btn-workout button { + background: #32174d; + border-radius: 3px; + color: #fff; +} + +.btn-workout button:hover { + background-color: #621da8; + color: #fff; +} + .exercises { border: 1px solid black; + width: 80%; + margin: 20px auto; + + background: #FAFAFA; + padding: 20px; + box-shadow: 1px 1px 25px rgba(0, 0, 0, 0.35); + border-radius: 10px; + border: 6px solid #4B0082; +} + +.exercises h4 { + color: #522d80; + font-size: 2em; } .exercise_log { - border: 2px solid pink; + margin: 20px auto; + width: 80%; + border:1px solid #DDDDDD; + border-radius: 3px; + display: grid; + grid-template-columns: 40% 60%; +} + +.btn-exercises { + width: 80%; + display: grid; + margin: 0 auto; + grid-template-columns: 50% 50%; +} + +.btn-exercises button { + /* background: #32174d; */ + background-color: #621da8; + border-radius: 3px; + color: #fff; +} + +.btn-exercises button:hover { + /* background-color: #621da8; */ + background: #32174d; + color: #fff; +} + +.exercise_name { + padding: 20px 0; + color: #522d80; + font-size: 2em; } .sets_list { - border: 2px solid skyblue; + padding: 0; + display: grid; + margin: 0 auto; + grid-template-columns: 50% 50%; + +} + +.sets_list { + list-style: none; +} + +.sets_detail { + padding: 10px; + +} + +.btn-sets form { + margin: 6px; +} + + +.btn_add_set { + /* background: #32174d; */ + background-color: #621da8; + border-radius: 3px; + color: #fff; + margin:10px; +} + +.btn_add_set:hover { + /* background-color: #621da8; */ + background: #32174d; + color: #fff; +} + + +.btn_add_exercise { + /* background: #32174d; */ + background-color: #621da8; + border-radius: 3px; + color: #fff; + margin:10px; +} + +btn_add_exercise:hover { + /* background-color: #621da8; */ + background: #32174d; + color: #fff; } \ No newline at end of file diff --git a/views/edit_log.ejs b/views/edit_log.ejs index 57dcfd1..7f5620a 100644 --- a/views/edit_log.ejs +++ b/views/edit_log.ejs @@ -28,6 +28,7 @@ + diff --git a/views/edit_workout.ejs b/views/edit_workout.ejs index a73db48..62e06ac 100644 --- a/views/edit_workout.ejs +++ b/views/edit_workout.ejs @@ -4,18 +4,18 @@

Edit workout

-
+
+ Back to workout details
\ No newline at end of file diff --git a/views/workout_details.ejs b/views/workout_details.ejs index 0f9636a..d15ecb9 100644 --- a/views/workout_details.ejs +++ b/views/workout_details.ejs @@ -8,8 +8,10 @@

<%= workout.to_char %>

<% if (Number(userIdLoggedIn) === workout.user_id) { %> -
- +
+
+ +
@@ -23,53 +25,66 @@

Exercises

<% for (const exercise of exercises){%>
-

<%=exercise.name%>

- - <% if (Number(userIdLoggedIn) === workout.user_id) { %> -
- - - - - -
- <% } %> +
+

<%=exercise.name%>

+ <% if (Number(userIdLoggedIn) === workout.user_id) { %> +
+
+ +
+
+ +
+
+ <% } %> +
+
<% for (const logdata of logdatas){ %> + <% if (logdata.junction_id === exercise.junction_id) {%>
    -
  • sets: <%= logdata.sets%>
  • -
  • reps:<%= logdata.reps%>
  • -
  • weight: <%= logdata.weight%>
  • - - <% if (Number(userIdLoggedIn) === workout.user_id) { %> -
    - -
  • -
  • - - -
  • -
    - <% } %> - +
    +
  • sets: <%= logdata.sets%>
  • +
  • reps: <%= logdata.reps%>
  • +
  • weight: <%= logdata.weight%> kg
  • +
    +
    + <% if (Number(userIdLoggedIn) === workout.user_id) { %> +
  • +
    + +
    + +
    + + +
    +
  • + <% } %> +
<% } %> <% } %> - <% if (Number(userIdLoggedIn) === workout.user_id) { %> -
- -
- <% } %> -
+ <% if (Number(userIdLoggedIn) === workout.user_id) { %> +
+ +
+ <% } %> +
+ +
+ + <% } %> + + <% if (Number(userIdLoggedIn) === workout.user_id) { %> +
+ +
<% } %>
- <% if (Number(userIdLoggedIn) === workout.user_id) { %> -
- -
- <% } %> -