<form name="formHorarioColeta" ng-submit="vm.salvarSetorRotaHorario()" novalidate form-validation-directive>

    <div class="content-modal-horario-coleta-automatico" ng-if="vm.AgendaSetor && !vm.AgendaSetor.Agenda">
        <div class="txt-default">
            <span class="error-setor-sem-agenda">Setor não possui agenda</span>
        </div>
    </div>

    <div class="content-modal-horario-coleta-automatico" ng-if="vm.AgendaSetor.Agenda">
        <div id="modalNotificationOuter" class="notification-modal"></div>
        <div class="txt-default">
            Configure o horário inicial e velocidade média para estimativa de cada trecho da coleta.
        </div>

        <div class="txt-default" ng-if="!formHorarioColeta.$valid && formHorarioColeta.$submitted">
            <span class="error-message">{{formHorarioColeta.errorMessage}}</span>
        </div>

        <div class="dias-content" >
            <div class="legenda-lateral-content">
                <label>Horário Inicial</label>
                <label>Vel.Media (km/h)</label>
            </div>
            <div class="dias-da-semana">
                <div ng-repeat="item in vm.AgendaSetor.Agenda.DadosColetasDiasSemana">
                    <div class="dia">
                        <label class="label-default">{{vm.enumSemana[item.DiaSemana]}}</label>
                        <fieldset class="fieldset-dia" ng-class="{'invalid': !formHorarioColeta['horarioColeta-{{item.DiaSemana}}'].customValidation}">
                            <input empty-input class="input-default" name="horarioColeta-{{item.DiaSemana}}" ng-disabled="!item.Habilitado" clock-picker ui-time-mask="short" readonly type="text"
                                   ng-model="item.Hora" ng-required="item.Habilitado">
                        </fieldset>
                        <fieldset class="fieldset-dia" ng-class="{'invalid': !formHorarioColeta['velMedia-{{item.DiaSemana}}'].customValidation}">
                            <input empty-input class="input-default" name="velMedia-{{item.DiaSemana}}" ng-disabled="!item.Habilitado" type="number" min="1" max="99"
                                   ng-model="item.VelMedia" ng-required="item.Habilitado">
                        </fieldset>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <footer class="modal-footer">
        <a href="#" class="link-cancel" ng-click="vm.fecharModalHorarioColetaAutomatico()">
            <i class="icon-cross"></i> Cancelar
        </a>

        <button class="btn-base btn-size-s btn-color-default btn-action"
                ng-disabled="formHorarioColeta.custom_status != null || !vm.AgendaSetor.Agenda">
            {{
                formHorarioColeta.custom_status == 'SENDING' ? 'Aplicando...' : (formHorarioColeta.custom_status ==
                'SEND_SUCCESS' ? 'Aplicado' : 'Aplicar')
            }}
        </button>
    </footer>
</form>
