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.

146 lines
7.0 KiB

5 years ago
  1. <input type="hidden" id="segmentos" name="segmentos" value="{{segmentos|json_encode}}">
  2. <table id='table'class="table">
  3. <thead class="thead-dark">
  4. <tr>
  5. <th scope="col">{{'Value Proposition'|trans({})}}</th>
  6. <th scope="col">{{'Customer Segment'|trans({})}}</th>
  7. <th scope="col">{{'Actions'|trans({})}}</th>
  8. </tr>
  9. </thead>
  10. <tbody>
  11. {% if app.user.getType == 'trainer' and ge is defined and ge is not null %}
  12. {% set respuestasarray=respuesta[pregunta.alias]|json_decode%}
  13. {% for indexArray in 0..respuestasarray|length-1 %}
  14. <tr>
  15. <td class="col-md-8">
  16. <pre>{{ respuestasarray[indexArray] }}</pre></td>
  17. <td class="col-md-4">
  18. {% set preguntaold=pregunta %}
  19. {% for preguntaselect in preguntas%}
  20. {% if preguntaselect.alias=='ex9bpreg200'%}
  21. {% set pregunta= preguntaselect %}
  22. {% endif %}
  23. {% endfor %}
  24. {% set respuestasarray2=respuesta[pregunta.alias]|json_decode%}
  25. <pre> {{respuestasarray2[indexArray]}}</pre>
  26. </td> {% set pregunta=preguntaold %}</td></tr>
  27. {% endfor %}
  28. {% else %}
  29. {% if respuesta[pregunta.alias] is defined%}
  30. {% set respuestasarray=respuesta[pregunta.alias]|json_decode%}
  31. {% for indexArray in 0..respuestasarray|length-1 %}
  32. <tr>
  33. <td width="60%">
  34. {% if respuestas is empty %}
  35. <textarea 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 %} rows="10"></textarea>
  36. {% else %}
  37. {% set encontrada = false %}
  38. {% if respuesta[pregunta.alias] is defined and respuestasarray[indexArray] is defined%}
  39. {% set encontrada=true %}
  40. {% endif %}
  41. {% if encontrada %}
  42. <textarea 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 %} rows="10">{{ respuestasarray[indexArray] }}</textarea>
  43. {% else %}
  44. <textarea 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 %} rows="10"></textarea>
  45. {% endif %}
  46. {% endif %}
  47. </td>
  48. {% set preguntaold=pregunta %}
  49. {% for preguntaselect in preguntas%}
  50. {% if preguntaselect.alias=='ex9bpreg200'%}
  51. {% set pregunta= preguntaselect %}
  52. {% endif %}
  53. {% endfor %}
  54. {% if respuesta[pregunta.alias] is defined%}
  55. {% set respuestasrange1=respuesta[pregunta.alias]|json_decode%}
  56. {% else %}
  57. {% set encontrada=false%}
  58. {% endif %}
  59. {#aqui va un componente select multiple list #}
  60. <td width="40%">
  61. {% if respuestas is empty %}
  62. <select data-sonata-select2="false" class="js-example-basic-multiple" id="{{ pregunta.alias }}-{{ indexArray }}" name="{{ pregunta.alias }}[{{ indexArray }}][]" {% if not pregunta.editable and 'caso_estudio' not in app.user.username %} readonly {% endif %} multiple="true" style="width: 80%;">
  63. {% for segment in segmentos %}
  64. <option value="{{segment}}">{{segment}}</option>
  65. {% endfor %}
  66. </select>
  67. {% else %}
  68. {% set encontrada = false %}
  69. {% set respuestasarray2=respuesta[pregunta.alias]|json_decode%}
  70. {% if respuesta[pregunta.alias] is defined and respuestasarray2[indexArray] is defined%}
  71. {% set encontrada=true %}
  72. {% endif %}
  73. {% if encontrada %}
  74. <select data-sonata-select2="false" class="js-example-basic-multiple" id="{{ pregunta.alias }}-{{ indexArray }}" name="{{ pregunta.alias }}[{{ indexArray }}][]" {% if not pregunta.editable and 'caso_estudio' not in app.user.username %} readonly {% endif %} multiple="true" style="width: 80%;">
  75. {% for segment in segmentos %}
  76. {% set encon=false %}
  77. {# if segment==respuestasrange1[indexArray] %}
  78. {% set respuestasrange1[indexArray]=[respuestasrange1[indexArray]] %}
  79. {% set encon=true %}
  80. {% endif #}
  81. {% for segmentselected in respuestasarray2[indexArray]%}
  82. {% if segment==segmentselected %}{% set encon=true %}{% endif %}
  83. {% endfor %}
  84. <option value="{{segment}}" {% if encon %} selected {% endif %}>{{segment}}</option>
  85. {% endfor %}
  86. </select>
  87. {% else %}
  88. <select data-sonata-select2="false" class="js-example-basic-multiple" id="{{ pregunta.alias }}-{{ indexArray }}" name="{{ pregunta.alias }}[{{ indexArray }}][]" {% if not pregunta.editable and 'caso_estudio' not in app.user.username %} readonly {% endif %} multiple="true" style="width: 80%;">
  89. {% for segment in segmentos %}
  90. <option value="{{segment}}">{{segment}}</option>
  91. {% endfor %}
  92. </select>
  93. {% endif %}
  94. {% endif %}
  95. <script>
  96. {# var dependant = {{ pregunta.TipoPreguntaOptions|raw }};#}
  97. $("#{{ pregunta.alias }}-{{ indexArray }}").select3();
  98. setTimeout(function(){ $("#{{ pregunta.alias }}-{{ indexArray }}").next().next().remove();}, 2000);
  99. </script>
  100. {% set pregunta=preguntaold %}
  101. </td>
  102. <td><button type="button" class="btn btn-warning delete-row" onclick="$(this).parents('tr').remove();">Delete Row</button></td>
  103. </tr>
  104. {% endfor %}
  105. {% else %}
  106. <tr>
  107. <td width="60%">
  108. <textarea 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 %} rows="10"></textarea>
  109. </td>
  110. {% set preguntaold=pregunta %}
  111. {% for preguntaselect in preguntas%}
  112. {% if preguntaselect.alias=='ex9bpreg200'%}
  113. {% set pregunta= preguntaselect %}
  114. {% endif %}
  115. {% endfor %}
  116. <td width="40%">
  117. <select data-sonata-select2="false" class="js-example-basic-multiple" id="{{ pregunta.alias }}-0" name="{{ pregunta.alias }}[0][]" {% if not pregunta.editable and 'caso_estudio' not in app.user.username %} readonly {% endif %} multiple=true style="width: 80%;">
  118. {% for segment in segmentos %}
  119. <option value="{{segment}}">{{segment}}</option>
  120. {% endfor %}
  121. </select>
  122. <script>
  123. {# var dependant = {{ pregunta.TipoPreguntaOptions|raw }};#}
  124. $("#{{ pregunta.alias }}-0").select3();
  125. setTimeout(function(){ $("#{{ pregunta.alias }}-0").next().next().remove();}, 2000);
  126. </script>
  127. {% set pregunta=preguntaold %}
  128. </td>
  129. <td><button type="button" class="btn btn-warning delete-row" onclick="$(this).parents('tr').remove();onChange()">Delete Row</button></td>
  130. </tr>
  131. {% endif %}
  132. {% endif %}
  133. </tbody>
  134. </table>
  135. {% if app.user.type=='green_entrepreneur'%}
  136. <button type="button" class="btn btn-info add-row" onclick="addRow($(this).prev()).onChange">Add Row</button>
  137. {% endif %}
  138. {% set preguntasIndex= preguntasIndex+1%}