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.

99 lines
11 KiB

5 years ago
  1. {% if pregunta.alias starts with 'ex17preg20' or pregunta.alias starts with 'ex17preg21' %}
  2. {%else%}
  3. <table id='table{{loop.index}}'class="table" >
  4. <thead class="thead-dark">
  5. <tr>
  6. <th scope="col">{{'Products and Services you are offering!'|trans({})}}</th>
  7. <th scope="col">{{'Select an adequate revenue model for each'|trans({})}}</th>
  8. <th scope="col">{{'Price them'|trans({})}}</th>
  9. <th scope="col">{{'Actions'|trans({})}}</th>
  10. </tr>
  11. </thead>
  12. <tbody>
  13. {% if respuesta[pregunta.alias] is defined%}
  14. {% set respuestasarray=respuesta[pregunta.alias]|json_decode%}
  15. {% for indexArray in 0..respuestasarray|length-1 %}
  16. <tr>
  17. <td>
  18. {% if respuestas is empty %}
  19. <input type="text" class="form-control" id="{{ pregunta.alias }}-{{ indexArray }}" name="{{ pregunta.alias }}[]" placeholder="{{ pregunta.placeholder|trans({}) }} {% if not pregunta.editable and 'caso_estudio' not in app.user.username %} readonly {% endif %}">
  20. {% else %}
  21. {% set encontrada = false %}
  22. {% if respuesta[pregunta.alias] is defined and respuestasarray[indexArray] is defined%}
  23. {% set encontrada=true %}
  24. {% endif %}
  25. {% if encontrada %}
  26. <input type="text" class="form-control" id="{{ pregunta.alias }}-{{ indexArray }}" name="{{ pregunta.alias }}[]" placeholder="{{ pregunta.placeholder|trans({}) }}" value="{{ respuestasarray[indexArray] }}" {% if not pregunta.editable and 'caso_estudio' not in app.user.username %} readonly {% endif %}>
  27. {% else %}
  28. <input type="text" class="form-control" id="{{ pregunta.alias }}-{{ indexArray }}" name="{{ pregunta.alias }}[]" placeholder="{{ pregunta.placeholder|trans({}) }} {% if not pregunta.editable and 'caso_estudio' not in app.user.username %} readonly {% endif %}">
  29. {% endif %}
  30. {% endif %}
  31. </td>
  32. {% set preguntasIndex= preguntasIndex+1%}
  33. {% set pregunta= preguntas[preguntasIndex-1] %}
  34. {% if respuesta[pregunta.alias] is defined%}
  35. {% set respuestasrange1=respuesta[pregunta.alias]|json_decode%}
  36. {% endif %}
  37. <td>
  38. {% if respuestas is empty %}
  39. <input type="text" id="{{ pregunta.alias }}-{{ indexArray }}" data-sonata-select2 = "false" style="width:80%;top: 28px; z-index: 100;" name="{{ pregunta.alias }}[]" ></input>
  40. {% else %}
  41. {% if respuesta[pregunta.alias] is defined and respuestasrange1[indexArray] is defined%}
  42. {% set encontrada=true %}
  43. {% endif %}
  44. {% if encontrada %}
  45. <input type="text" id="{{ pregunta.alias }}-{{ indexArray }}" style="width:80%;top: 28px; z-index: 100;" name="{{ pregunta.alias }}[]" value="{{ respuestasrange1[indexArray] }}"></input>
  46. {% else %}
  47. <input type="text" id="{{ pregunta.alias }}-{{ indexArray }}" style="width:80%;top: 28px; z-index: 100;" name="{{ pregunta.alias }}[]" ></input>
  48. {% endif %}
  49. {% endif %}
  50. <script>
  51. var dependant = {{ pregunta.TipoPreguntaOptions|raw }};
  52. $("#{{ pregunta.alias }}-{{ indexArray }}").select3({ data: dependant});
  53. setTimeout(function(){ $("#{{ pregunta.alias }}-{{ indexArray }}").next().next().remove();}, 2000);
  54. </script></td>
  55. {% set preguntasIndex= preguntasIndex+1%}
  56. {% set pregunta= preguntas[preguntasIndex-1] %}
  57. {% if respuesta[pregunta.alias] is defined %}
  58. {% set respuestasrange2=respuesta[pregunta.alias]|json_decode%}
  59. {% endif %}
  60. <td> {% if respuestas is empty %}
  61. <input type="text" class="form-control" id="{{ pregunta.alias }}-{{ indexArray }}" name="{{ pregunta.alias }}[]" placeholder="{{ pregunta.placeholder|trans({}) }} {% if not pregunta.editable and 'caso_estudio' not in app.user.username %} readonly {% endif %}">
  62. {% else %}
  63. {% set encontrada = false %}
  64. {% if respuesta[pregunta.alias] is defined and respuestasarray[indexArray] is defined%}
  65. {% set encontrada=true %}
  66. {%endif%}
  67. {% if encontrada %}
  68. <input type="text" class="form-control" id="{{ pregunta.alias }}-{{ indexArray }}" name="{{ pregunta.alias }}[]" placeholder="{{ pregunta.placeholder|trans({}) }}" value="{{ respuestasrange2[indexArray] }}" {% if not pregunta.editable and 'caso_estudio' not in app.user.username %} readonly {% endif %}>
  69. {% else %}
  70. <input type="text" class="form-control" id="{{ pregunta.alias }}-{{ indexArray }}" name="{{ pregunta.alias }}[]" placeholder="{{ pregunta.placeholder|trans({}) }} {% if not pregunta.editable and 'caso_estudio' not in app.user.username %} readonly {% endif %}">
  71. {% endif %}
  72. {% endif %}</td>
  73. <td><button type="button" class="btn btn-warning delete-row" onclick="$(this).parents('tr').remove();">Delete Row</button></td>
  74. </tr>
  75. {% set preguntasIndex= preguntasIndex-2 %}
  76. {% set pregunta= preguntas[preguntasIndex-1] %}
  77. {% endfor %}
  78. {% else %}
  79. <tr>
  80. <td><input type="text" class="form-control" id="{{ pregunta.alias }}-0" name="{{ pregunta.alias }}[]" placeholder="{{ pregunta.placeholder|trans({}) }} {% if not pregunta.editable and 'caso_estudio' not in app.user.username %} readonly {% endif %}"></td>
  81. {% set preguntasIndex= preguntasIndex+1%}
  82. {% set pregunta= preguntas[preguntasIndex-1] %}
  83. <td><input type="text" id="{{ pregunta.alias }}-0" data-sonata-select2 = "false" style="width:80%;top: 28px; z-index: 100;" name="{{ pregunta.alias }}[]" ></input>
  84. <script>
  85. var dependant = {{ pregunta.TipoPreguntaOptions|raw }};
  86. $("#{{ pregunta.alias }}-0").select3({ data: dependant});
  87. setTimeout(function(){ $("#{{ pregunta.alias }}-0").next().next().remove();}, 2000);
  88. </script></td>
  89. {% set preguntasIndex= preguntasIndex+1%}
  90. {% set pregunta= preguntas[preguntasIndex-1] %}
  91. <td> <input type="text" class="form-control" id="{{ pregunta.alias }}-0" name="{{ pregunta.alias }}[]" placeholder="{{ pregunta.placeholder|trans({}) }} {% if not pregunta.editable and 'caso_estudio' not in app.user.username %} readonly {% endif %}"></td>
  92. <td><button type="button" class="btn btn-warning delete-row" onclick="$(this).parents('tr').remove();">Delete Row</button></td>
  93. </tr>
  94. {% endif %}
  95. </tbody>
  96. </table>
  97. <button type="button" class="btn btn-info add-row" onclick="addRow($(this).prev(), dependant)">Add Row</button>
  98. {% set preguntasIndex= preguntasIndex+2 %}
  99. {% endif %}