<md-button class="md-primary md-fab novo" ng-click="imprimirEventos()" ng-if="listEvento.length > 0"
	ng-show="!eventoPersonalizado">
	<md-icon md-font-icon="flaticon-printer-tool"></md-icon>
</md-button>
<div class="content eventos">
	<h1>Eventos</h1>
	<md-card>
		<md-card-title>
			<md-card-title-text>
				<span class="md-headline">Filtros</span>
			</md-card-title-text>
		</md-card-title>
		<md-card-content>
			<form name="formEvento" ng-submit="listarEventos()">
				<div layout-gt-sm='row' layout-align="start start">
					<md-input-container class="md-block">
						<label>Inicio</label>
						<md-datepicker ng-model="evento.dtInicio" name="dtInicio" md-min-date="dtMinMoni"
							md-max-date="dtFim" required></md-datepicker>
						<div ng-messages="formEvento.dtInicio.$error">
							<div ng-message="required">Campo obrigatório.</div>
						</div>
					</md-input-container>
					<md-input-container ng-show="cliente.tipoConexao != 1" class="md-block">
						<label>Final</label>
						<md-datepicker ng-model="evento.dtFim" name="dtFim" md-min-date="dtInicio" required>
						</md-datepicker>
						<div ng-messages="formEvento.dtFim.$error">
							<div ng-message="required">Campo obrigatório.</div>
						</div>
					</md-input-container>
					<div flex="5" hide-xs>
						<!-- Spacer -->
					</div>
					<md-input-container class="md-block" ng-show="!eventoPersonalizado && cliente.tipoConexao == 0">
						<label>Filtrar Por</label>
						<md-select name="selectFiltro" ng-model="evento.filtro" required>
							<md-option value="rbTodos">Todos</md-option>
							<md-option value="rbAlarme">Alarme</md-option>
							<md-option value="rbTstAuto">Teste Automático</md-option>
							<md-option value="rbArmado">Armado</md-option>
							<md-option value="rbDesarmado">Desarmado</md-option>
							<md-option value="rbSControle">Sem Controle</md-option>
							<md-option value="rbRonda">Desarmado</md-option>
						</md-select>
					</md-input-container>
					<div class="submit-button-events">
						<md-button ng-disabled="loading" type="submit" class="md-primary md-raised width-button">
							Atualizar</md-button>
						<div id="page-loading" ng-if="loading">
							<img style="margin:0 auto; width: 5%;" alt="Carregando Informações..."
								src="img/loading.gif" />
						</div>
					</div>

				</div>
		</md-card-content>
		</form>
		<div layout-gt-sm='row' layout-align="start start">

			<md-input-container class="md-block" ng-show="!eventoPersonalizado && cliente.tipoConexao == 0">
				<label>Empresa Sigma</label>
				<md-select ng-model="evento.sigma">
					<md-option ng-value="e" ng-repeat="e in listEmpresas">{{e}}</md-option>
				</md-select>
				<!--<input name="empresaSigma" type="number" md-no-asterisk ng-model="evento.sigma" >-->
			</md-input-container>

			<md-input-container class="md-block" ng-show="cliente.tipoConexao == 3">
				<label>Central Remoty</label>
				<md-select ng-model="centralEvento">
					<md-option ng-value="central" ng-repeat="central in cliente.centraisMonitoramento">
						{{central.idEquipment}} - {{central.nmEquipment}} </md-option>
				</md-select>
			</md-input-container>

		</div>
	</md-card>
	<md-toolbar class="min"></md-toolbar>

	<md-content>
		<md-list>
			<md-list-item class="md-2-line"
				ng-repeat="ev in paginate.result.data | filter : procuraGeral | filter: {empresaSigma: evento.sigma}"
				ng-click="null">
				<div class="md-list-item-text" layout-gt-sm="column">
					<div layout-gt-sm="row">
						<h3 flex>
							<span>Evento: </span>{{ ev.evento }}
						</h3>
						<h3 flex ng-show="!eventoPersonalizado && cliente.tipoConexao == 0">
							<span>Empresa: </span>{{ ev.empresaSigma }}
						</h3>
						<h3 flex ng-show="!eventoPersonalizado && cliente.tipoConexao != 1">
							<span>AUX: </span>{{ ev.aux }}
						</h3>
						<h3 flex ng-show="eventoPersonalizado  && cliente.tipoConexao != 1">
							<span>Zona: </span>{{ ev.aux }}
						</h3>
						<h3 flex>
							<span>Data/Hora: </span>{{ ev.dataEvento | date : 'dd/MM/yyyy HH:mm:ss' }}
						</h3>
					</div>
					<div layout-gt-sm="column">
						<h3>
							<span>Descrição: </span>
							{{ev.descricao}}
						</h3>
						<h3 flex ng-show="cliente.tipoConexao == 3">
							<span>Usuário: </span>{{ ev.usuario }}
						</h3>
					</div>
				</div>
				<md-divider ng-if="!$last"></md-divider>
			</md-list-item>
		</md-list>
	</md-content>
	<section layout="row" layout-align="space-between center" layout-sm="column" ng-if="paginate.result.data">
		<md-button class="md-primary" ng-click="paginate.prev()">
			<< Anterior </md-button>
				<md-button class="md-primary" ng-click="paginate.next()"> Proximo >> </md-button>
	</section>
	<p ng-if="paginate.result.data">Exibindo registros de {{paginate.result.to === 0 ? '0' : paginate.result.from}} até
		{{paginate.result.to}} de um total de {{paginate.total}}</p>
</div>