 @using TFC.Models @model TFC.Models.Training

@{
    ViewBag.Title = "Editar entrenamiento";
}

<h2>Editar entrenamiento</h2>

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>


<div class="five columns"></div>
	<div class="row">
        <div class="twelve columns">
    </div>
            


<div class="twelve columns">
    
    <br />
    @if (Roles.IsUserInRole("Trainer"))
    {
        @Html.ActionLink("Volver a la lista  ", "Index")  
        @Html.ActionLink("Agregar workout", "Create", "Workout", new {trainingId = Model.TrainingID}, new {@class = "small button"})
    }
                                                       <br /><br /><br />
</div>
</div>
	<div class="row">
        
 @foreach (DateTime d in ViewBag.Dates){

        <div class="twelve columns">

            <h3>Sesión @(ViewBag.It = ViewBag.It + 1) -- (@d.Date.Day/@d.Date.Month/@d.Date.Year)</h3>
        <table style="margin-left:auto;margin-right:auto;">
        <tr>
        <th>Realizado</th>
        <th>
            Ejercicio
        </th>
        <th>Grupo muscular</th>
        <th>Peso</th>
        <th>Repeticiones</th>
        <th>Descanso</th>
        <th></th>
     </tr>
        @foreach (Workout w in Model.workouts) { 
            if(w.Date.Equals(d.Date)){
      <tr>
           <td>@w.IsRealized</td>
          <td>@w.Exercice.Name</td>
          <td>@w.Exercice.MuscleGroup</td>
          <td>@w.Load</td>
          <td>@w.Repetitions</td>
          <td>@w.Pause</td>

          <td>@Html.ActionLink("Detalle", "Details", "Workout", new {id = w.WorkoutID, trainingId = w.TrainingID }, new { @class = "small button" }) | @Html.ActionLink("Editar", "Edit", "Workout", new {id = w.WorkoutID, trainingId = w.TrainingID }, new { @class = "small button" }) | @Html.ActionLink("Eliminar", "Delete", "Workout", new {id = w.WorkoutID, trainingId = w.TrainingID }, new { @class = "small button" })</td>
      </tr>           }
        }
     
       </table>
            <br /><br />
            </div>
    }
        </div>

<div class="five columns">
@*@using (Html.BeginForm()) {
    @Html.ValidationSummary(true)
    <fieldset>
        <legend> </legend>

        @Html.HiddenFor(model => model.TrainingID)

        <div class="editor-label">
            @Html.LabelFor(model => model.TrainingName)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.TrainingName)
            @Html.ValidationMessageFor(model => model.TrainingName)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.UserId, "Cliente")
        </div>
        <div class="editor-field">
            @Html.DropDownList("UserId", String.Empty)
            @Html.ValidationMessageFor(model => model.UserId)
        </div>
        <br />
        <p>
            <input type="submit" value="Guardar" class="button" />
        </p>
    </fieldset>
    
}*@
    </div>