Licitator 1.0
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
1.8 KiB

5 years ago
  1. {% if tarea[0].alias=='exercise17'%} function addRow(table, dependant){
  2. var rowCount = table.find("tbody").find("tr").length;
  3. console.log(rowCount);
  4. {% set dependant='' %}
  5. {% for pregunta in tarea[0].SeccionesTareaId[0].PreguntasId %}
  6. {% if pregunta.alias=='ex17preg20' %}
  7. {% set dependant=pregunta.TipoPreguntaOptions|raw %}
  8. {% endif %}
  9. {% endfor %}
  10. var input='<tr>';
  11. {% for pregunta in tarea[0].SeccionesTareaId[0].PreguntasId %}
  12. {% if pregunta.alias=='ex17preg10' %}
  13. input+=`<td><input type="text" class="form-control" id="{{pregunta.alias}}-`+rowCount+`" name="{{pregunta.alias}}[]" placeholder="{{ pregunta.placeholder|trans({}) }} {% if not pregunta.editable and 'caso_estudio' not in app.user.username %} readonly {% endif %}"></td>`;
  14. {% elseif pregunta.alias=='ex17preg20' %}
  15. input+=`<td><input type="text" id="{{pregunta.alias}}-`+rowCount+`" data-sonata-select2 = "false" style="width:80%;top: 28px; z-index: 100;" name="{{pregunta.alias}}[]" ></input></td><td>`;
  16. {% elseif pregunta.alias=='ex17preg21' %}
  17. input+=`<input type="text" class="form-control" id="{{pregunta.alias}}-`+rowCount+`" name="{{pregunta.alias}}[]" placeholder="{{ pregunta.placeholder|trans({}) }} {% if not pregunta.editable and 'caso_estudio' not in app.user.username %} readonly {% endif %}"></td><td><button type="button" class="btn btn-warning delete-row" onclick="$(this).parents('tr').remove();">Delete Row</button></td>`;
  18. {% endif %}
  19. {% endfor %}
  20. input+=`</tr>`;
  21. table.append(input);
  22. var dependant = {{ dependant|raw }};
  23. $("#ex17preg20-"+rowCount).select3({ data: dependant});
  24. setTimeout(function(){ $("#ex17preg20-0").next().next().remove();}, 2000);
  25. }
  26. {% endif %}