extends ../layout
block content
  h1= workout.title

  div!= workout.body

  hr

  p
    span Workout ID:
    &nbsp;
    a(href="/workouts/" + encodeURIComponent(workout._id))= workout._id
    div= workout
    ul
      li Time: #{workouttime}
      each element in workout.elements
        li= element.exerciseID
        ul
          each split in element.splits
            li Reps: #{split.reps} Weight: #{split.weight}

  - if (session.user)
    - if (session.user.is_admin === true)
      form(action="/workouts/" + encodeURIComponent(workout._id), method="POST")
        input(name="_method", type="hidden", value="DELETE")
        input(type="submit", value="Delete")
      p
        a(href="/workouts") List workouts
    - else
      - if (session.user._id == workout.userID)
        form(action="/workouts/" + encodeURIComponent(workout._id), method="POST")
          input(name="_method", type="hidden", value="DELETE")
          input(type="submit", value="Delete")
