Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hotfix/3.0.2 #250

Merged
merged 1 commit into from
Jun 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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