<div class="workout-sets-widget">
  <div class="workout-sets-list">
    {% for row in widget.rows %}
    <div class="workout-set-row row mb-2">
      <div class="col-md-4">
        <select name="{{widget.name}}_exercise_id" class="form-control">
          <option value="">Select exercise...</option>
          {% for exercise in widget.exercises %}
          <option value="{{exercise.id}}" {% if row.exercise_id == exercise.id %}selected{% endif %}>{{exercise.name}}</option>
          {% endfor %}
        </select>
      </div>
      <div class="col-md-1">
        <input type="number" name="{{widget.name}}_sets" class="form-control" value="{{row.sets|default:''}}" min="1" placeholder="Sets">
      </div>
      <div class="col-md-1">
        <input type="number" name="{{widget.name}}_reps" class="form-control" value="{{row.reps|default:''}}" min="1" placeholder="Reps">
      </div>
      <div class="col-md-2">
        <input type="number" step="0.5" name="{{widget.name}}_weight" class="form-control" value="{{row.weight|default:''}}" min="0" placeholder="{{widget.weight_label}}">
      </div>
      <div class="col-md-3">
        <input type="text" name="{{widget.name}}_notes" class="form-control" value="{{row.notes|default:''}}" placeholder="Notes">
      </div>
      <div class="col-md-1">
        <button type="button" class="btn btn-sm btn-outline-danger remove-workout-set">&times;</button>
      </div>
    </div>
    {% empty %}
    <div class="workout-set-row row mb-2">
      <div class="col-md-4">
        <select name="{{widget.name}}_exercise_id" class="form-control">
          <option value="">Select exercise...</option>
          {% for exercise in widget.exercises %}
          <option value="{{exercise.id}}">{{exercise.name}}</option>
          {% endfor %}
        </select>
      </div>
      <div class="col-md-1">
        <input type="number" name="{{widget.name}}_sets" class="form-control" value="" min="1" placeholder="Sets">
      </div>
      <div class="col-md-1">
        <input type="number" name="{{widget.name}}_reps" class="form-control" value="" min="1" placeholder="Reps">
      </div>
      <div class="col-md-2">
        <input type="number" step="0.5" name="{{widget.name}}_weight" class="form-control" value="" min="0" placeholder="{{widget.weight_label}}">
      </div>
      <div class="col-md-3">
        <input type="text" name="{{widget.name}}_notes" class="form-control" value="" placeholder="Notes">
      </div>
      <div class="col-md-1">
        <button type="button" class="btn btn-sm btn-outline-danger remove-workout-set">&times;</button>
      </div>
    </div>
    {% endfor %}
  </div>
  <button type="button" class="btn btn-sm btn-outline-primary add-workout-set-row mt-2">Add set</button>
</div>
