Skip to content

Commit

Permalink
Merge pull request #250 from gii-is-DP2/hotfix/3.0.2
Browse files Browse the repository at this point in the history
hotfix/3.0.2
  • Loading branch information
enrreigut authored Jun 2, 2020
2 parents 0ead0e8 + ce7d8e5 commit ae04871
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,13 @@ public String getTrainingDetails(@PathVariable("clientUsername") String clientUs
Training training = this.trainingService.findTrainingById(trainingId);
Client client = this.clientService.findClientByUsername(clientUsername);

Calendar now = Calendar.getInstance();
Date date = now.getTime();
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss.SSS");
String actualDate = dateFormat.format(date);

model.addAttribute("actualDate", actualDate);

model.addAttribute(TRAINING,training);
model.addAttribute(CLIENT,client);

Expand Down
56 changes: 45 additions & 11 deletions src/main/webapp/WEB-INF/jsp/client/trainings/trainingsDetails.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -65,25 +65,59 @@
<button class="btn btn-default">Check playlist for this training</button>
</form>
<br>


<spring:url value="/client/${client.user.username}/trainings/${training.id}/routine/create" var="addRoutineUrl"/>
<a href="${fn:escapeXml(addRoutineUrl)}">Add Routine</a>

<c:choose>
<c:when test="${training.editingPermission!='TRAINER'}">
<spring:url value="/client/${client.user.username}/trainings/${training.id}/routine/create" var="addRoutineUrl"/>
<a href="${fn:escapeXml(addRoutineUrl)}">Add Routine</a>
</c:when>
<c:otherwise>
<p><a style="color:grey">Add Routine</a></p>
</c:otherwise>
</c:choose>

<br>
<br>

<c:forEach var="routine" items="${training.routines}">

<h3>Routine: <c:out value="${routine.name}"/></h3>
<h3>Repetitions per Week: <c:out value="${routine.repsPerWeek}"/></h3>
<spring:url value="/client/${client.user.username}/trainings/${training.id}/routine/${routine.id}/update" var="updateRoutineUrl"/>
<a href="${fn:escapeXml(updateRoutineUrl)}">Edit Routine</a>

<c:choose>
<c:when test="${training.editingPermission!='TRAINER'}">
<spring:url value="/client/${client.user.username}/trainings/${training.id}/routine/${routine.id}/update" var="updateRoutineUrl"/>
<a href="${fn:escapeXml(updateRoutineUrl)}">Edit Routine</a>
</c:when>
<c:otherwise>
<a style="color:grey">Edit Routine</a>
</c:otherwise>
</c:choose>

<br>
<spring:url value="/client/${client.user.username}/trainings/${training.id}/routine/${routine.id}/delete" var="deleteRoutineUrl"/>
<a href="${fn:escapeXml(deleteRoutineUrl)}">Delete Routine</a>

<c:choose>
<c:when test="${training.editingPermission!='TRAINER'}">
<spring:url value="/client/${client.user.username}/trainings/${training.id}/routine/${routine.id}/delete" var="deleteRoutineUrl"/>
<a href="${fn:escapeXml(deleteRoutineUrl)}">Delete Routine</a>
</c:when>
<c:otherwise>
<a style="color:grey">Delete Routine</a>
</c:otherwise>
</c:choose>

<br>
<spring:url value="/client/${client.user.username}/trainings/${training.id}/routines/${routine.id}/routineLine/create" var="addRoutineLineUrl"/>
<a href="${fn:escapeXml(addRoutineLineUrl)}">Add Routine Line</a>

<c:choose>
<c:when test="${training.editingPermission!='TRAINER'}">
<spring:url value="/client/${client.user.username}/trainings/${training.id}/routines/${routine.id}/routineLine/create" var="addRoutineLineUrl"/>
<a href="${fn:escapeXml(addRoutineLineUrl)}">Add Routine Line</a>
</c:when>
<c:otherwise>
<a style="color:grey">Add Routine Line</a>
</c:otherwise>
</c:choose>

<table class="table table-striped">
<thead>
<tr>
Expand Down Expand Up @@ -134,7 +168,7 @@
<td><c:out value="${lineRoutine.exercise.kcal}"/></td>

<c:choose>
<c:when test="${training.endDate < actualDate}">
<c:when test="${training.endDate < actualDate || training.editingPermission=='TRAINER'}">

<td><a style="color:grey">Edit</a></td>

Expand Down

0 comments on commit ae04871

Please sign in to comment.