Estou dando manutenção num codigo de outro programador e estou enfrentando dificuldades em dois select. Preciso
Preciso pegar a hora de cada campo e somar esse intervalo, até ai tudo bem ja fiz uns testes usando a lib Moment.js e ela me atende perfeitamente. O que estou tendo dor de cabeça é em pegar os valores dos select. No
No codigo existe mistura de HTML puro com de um framework de render de pagina, TWIG. Ja tentei varias formas de ler o name, e sempre me retorna Undefined.
Segue o fragmento do codigo.
<fieldset class="datas">
<legend class="text-center bg-default border-control">Datas</legend>
<div id="container-data" class="col-xs-10 col-sm-10 col-xs-offset-1 col-sm-offset-1">
<div class="form-group linha-data-template hidden">
<div class="col-sm-1">
<label class="control-label" for="inputDataTemplate">Data</label>
</div>
<div class="col-sm-3">
<div class="input-group">
<input name="inputDataTemplate" id="inputDataTemplate" type="text" class="inputDataTemplate form-control input-sm" placeholder="99/99/9999" maxlength="10" pattern="[0-3][0-9]/[0-1][0-9]/[2][0][1][1-9]" />
<span class="input-group-addon input-sm btn-calendar" style="cursor:pointer;">
<span class="glyphicon glyphicon-calendar"></span>
</span>
</div>
</div>
<div class="col-sm-1 ">
<label class="control-label" for="cbHorarioIni">Horário</label>
</div>
<div class="col-sm-2">
{{ form_dropdown('cbHorarioIniTemplate', horarios, agendai.A106_Codigo, 'id="cbHorarioIniTemplate" class="input-sm form-control"') }}
</div>
<div class="col-sm-1 text-center">
<label class="control-label" for="cbHorarioFim">às</label>
</div>
<div class="col-sm-2">
{{ form_dropdown('cbHorarioFimTemplate', horarios, agendai.A106_Codigo, 'id="cbHorarioFimTemplate" class="input-sm form-control cbHorarioFimTemplate"') }}
</div>
<div class="col-sm-2">
<a id="removeData" style="cursor: pointer;"><h5><span class="glyphicon glyphicon-remove red"></span></h5></a>
</div>
</div>
{% for nro in 1..agendai.nro_datas %}
<div class="form-group linha-data">
<div class="col-sm-1">
<label class="control-label" for="inputData">Data</label>
</div>
<div class="col-sm-3">
<div class="input-group">
<input name="inputData[]" type="text" class="form-control data input-sm data-esconder" placeholder="99/99/9999" required maxlength="10" pattern="[0-3][0-9]/[0-1][0-9]/[2][0][1][1-9]" value="{{set_value('inputData',agendai.datas[loop.index0].inputData)}}" />
<span class="input-group-addon input-sm btn-calendar" style="cursor:pointer;">
<span class="glyphicon glyphicon-calendar"></span>
</span>
</div>
</div>
<div class="col-sm-1">
<label class="control-label" for="cbHorarioIni">Horário</label>
</div>
<div class="col-sm-2">
{{ form_dropdown('cbHorarioIni[]', horarios, set_value('cbHorarioIni', agendai.datas[loop.index0].cbHorarioIni), 'class="input-sm form-control selectpicker"') }}
</div>
<div class="col-sm-1 text-center">
<label class="control-label" for="cbHorarioFim">às</label>
</div>
<div class="col-sm-2">
{{ form_dropdown('cbHorarioFim[]', horarios, set_value('cbHorarioFim', agendai.datas[loop.index0].cbHorarioFim), 'class="input-sm form-control selectpicker"') }}
</div>
<div class="col-sm-2 green">
{% if loop.index == 1%}
<a id="addData" style="cursor: pointer;"><h5 class="btn btn-primary btn-xs"><span class="glyphicon glyphicon-plus green "></span> Adicionar Data</h5></a>
{% else %}
<a id="removeData" style="cursor: pointer;"><h5 ><span class="glyphicon glyphicon-remove red "></span></h5></a>
{% endif %}
</div>
</div>
{% endfor %}
</div>
</fieldset>