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.
 
 
 
 
 

147 lines
7.0 KiB

<input type="hidden" id="segmentos" name="segmentos" value="{{segmentos|json_encode}}">
<table id='table'class="table">
<thead class="thead-dark">
<tr>
<th scope="col">{{'Value Proposition'|trans({})}}</th>
<th scope="col">{{'Customer Segment'|trans({})}}</th>
<th scope="col">{{'Actions'|trans({})}}</th>
</tr>
</thead>
<tbody>
{% if app.user.getType == 'trainer' and ge is defined and ge is not null %}
{% set respuestasarray=respuesta[pregunta.alias]|json_decode%}
{% for indexArray in 0..respuestasarray|length-1 %}
<tr>
<td class="col-md-8">
<pre>{{ respuestasarray[indexArray] }}</pre></td>
<td class="col-md-4">
{% set preguntaold=pregunta %}
{% for preguntaselect in preguntas%}
{% if preguntaselect.alias=='ex9bpreg200'%}
{% set pregunta= preguntaselect %}
{% endif %}
{% endfor %}
{% set respuestasarray2=respuesta[pregunta.alias]|json_decode%}
<pre> {{respuestasarray2[indexArray]}}</pre>
</td> {% set pregunta=preguntaold %}</td></tr>
{% endfor %}
{% else %}
{% if respuesta[pregunta.alias] is defined%}
{% set respuestasarray=respuesta[pregunta.alias]|json_decode%}
{% for indexArray in 0..respuestasarray|length-1 %}
<tr>
<td width="60%">
{% if respuestas is empty %}
<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>
{% else %}
{% set encontrada = false %}
{% if respuesta[pregunta.alias] is defined and respuestasarray[indexArray] is defined%}
{% set encontrada=true %}
{% endif %}
{% if encontrada %}
<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>
{% else %}
<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>
{% endif %}
{% endif %}
</td>
{% set preguntaold=pregunta %}
{% for preguntaselect in preguntas%}
{% if preguntaselect.alias=='ex9bpreg200'%}
{% set pregunta= preguntaselect %}
{% endif %}
{% endfor %}
{% if respuesta[pregunta.alias] is defined%}
{% set respuestasrange1=respuesta[pregunta.alias]|json_decode%}
{% else %}
{% set encontrada=false%}
{% endif %}
{#aqui va un componente select multiple list #}
<td width="40%">
{% if respuestas is empty %}
<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%;">
{% for segment in segmentos %}
<option value="{{segment}}">{{segment}}</option>
{% endfor %}
</select>
{% else %}
{% set encontrada = false %}
{% set respuestasarray2=respuesta[pregunta.alias]|json_decode%}
{% if respuesta[pregunta.alias] is defined and respuestasarray2[indexArray] is defined%}
{% set encontrada=true %}
{% endif %}
{% if encontrada %}
<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%;">
{% for segment in segmentos %}
{% set encon=false %}
{# if segment==respuestasrange1[indexArray] %}
{% set respuestasrange1[indexArray]=[respuestasrange1[indexArray]] %}
{% set encon=true %}
{% endif #}
{% for segmentselected in respuestasarray2[indexArray]%}
{% if segment==segmentselected %}{% set encon=true %}{% endif %}
{% endfor %}
<option value="{{segment}}" {% if encon %} selected {% endif %}>{{segment}}</option>
{% endfor %}
</select>
{% else %}
<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%;">
{% for segment in segmentos %}
<option value="{{segment}}">{{segment}}</option>
{% endfor %}
</select>
{% endif %}
{% endif %}
<script>
{# var dependant = {{ pregunta.TipoPreguntaOptions|raw }};#}
$("#{{ pregunta.alias }}-{{ indexArray }}").select3();
setTimeout(function(){ $("#{{ pregunta.alias }}-{{ indexArray }}").next().next().remove();}, 2000);
</script>
{% set pregunta=preguntaold %}
</td>
<td><button type="button" class="btn btn-warning delete-row" onclick="$(this).parents('tr').remove();">Delete Row</button></td>
</tr>
{% endfor %}
{% else %}
<tr>
<td width="60%">
<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>
</td>
{% set preguntaold=pregunta %}
{% for preguntaselect in preguntas%}
{% if preguntaselect.alias=='ex9bpreg200'%}
{% set pregunta= preguntaselect %}
{% endif %}
{% endfor %}
<td width="40%">
<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%;">
{% for segment in segmentos %}
<option value="{{segment}}">{{segment}}</option>
{% endfor %}
</select>
<script>
{# var dependant = {{ pregunta.TipoPreguntaOptions|raw }};#}
$("#{{ pregunta.alias }}-0").select3();
setTimeout(function(){ $("#{{ pregunta.alias }}-0").next().next().remove();}, 2000);
</script>
{% set pregunta=preguntaold %}
</td>
<td><button type="button" class="btn btn-warning delete-row" onclick="$(this).parents('tr').remove();onChange()">Delete Row</button></td>
</tr>
{% endif %}
{% endif %}
</tbody>
</table>
{% if app.user.type=='green_entrepreneur'%}
<button type="button" class="btn btn-info add-row" onclick="addRow($(this).prev()).onChange">Add Row</button>
{% endif %}
{% set preguntasIndex= preguntasIndex+1%}