<div class="content">
	<h1>Aceite Digital</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="formAceite" ng-submit="listarAceites()">
				<div layout-gt-sm='row' layout-align="start start">
					<md-input-container class="sm-block" style="margin-right: 12px;">
						<label>Inicial</label>
						<md-datepicker ng-model="aceite.dtInicio" name="dtInicio"
							md-max-date="dtFim" required></md-datepicker>
						<div ng-messages="formAceite.dtInicio.$error">
							<div ng-message="required">Campo obrigatório.</div>
						</div>
					</md-input-container>
					<md-input-container class="sm-block" style="margin-right: 32px;">
						<label>Final</label>
						<md-datepicker ng-model="aceite.dtFim" name="dtFim" md-min-date="dtInicio" required>
						</md-datepicker>
						<div ng-messages="formAceite.dtFim.$error">
							<div ng-message="required">Campo obrigatório.</div>
						</div>
					</md-input-container>
					<md-input-container class="md-block">
						<label>Status</label>
						<md-select name="selectStatus" ng-model="aceite.status" required>
							<md-option value="rbPendentes">Pendentes</md-option>
							<md-option value="rbAutorizados">Autorizados</md-option>
							<md-option value="rbAmbos">Ambos</md-option>
						</md-select>
						<div ng-messages="formAceite.selectStatus.$error">
							<div ng-message="required">Campo obrigatório.</div>
						</div>
					</md-input-container>
					<md-input-container class="sm-block">
							<input type="text" placeholder="Consulta por hash" ng-model="searchHash">
					</md-input-container>
					<div class="submit-button-events">
						<md-button ng-disabled="loading" type="submit" class="md-primary md-raised width-button">Listar</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>
	</md-card>
	<md-toolbar class="min"></md-toolbar>

	<md-content>
		<md-list>
			<md-list-item class="md-2-line"
				ng-repeat="act in listAceites | filter:searchHash"
				ng-click="null">
				<div class="md-list-item-text" layout-gt-sm="column">
					<div style="display: flex; flex-wrap: wrap">
						<h3 flex>
							<span>Tipo: </span>{{act.tipoAceite}}
						</h3>
						<h3 flex>
							<span>Envio: </span>{{act.dataEnvio | date: 'dd/MM/yyyy HH:mm'}}h
						</h3>						
						<h3 flex hide-gt-sm>
							<span>Para: </span>{{ act.emailEnvio }}
						</h3>
						<h3 flex>
							<span>Status: </span>{{act.statusAceite}}
						</h3>
						<h3 flex="33" ng-show="act.aceiteHashProcesso !== ''">
							<span>Hash: </span>{{act.aceiteHashProcesso}}
						</h3>
				</div>
				<div layout-gt-sm="row" hide-xs hide-sm style="margin-top: 8px;">
					<h3 flex>
						<span>Para: </span>{{ act.emailEnvio }}
					</h3>
				</div>
				<div ng-show="act.statusAceite == 'Autorizado'">
					<md-button
						class="md-secondary md-raised"
						ng-click="abrirDocumentoAceite(act)"
						style="width: 170px;"
						ng-show="act.statusAceite == 'Autorizado'"
					>
						<md-icon md-font-icon="flaticon-downloading-action" ng-show="act.statusAceite == 'Autorizado'"></md-icon>
						<span ng-show="act.statusAceite == 'Autorizado'">Documento</span>
					</md-button>
				</div>
				<div>
					<md-button
						class="md-secondary md-raised"
						ng-click="abrirUrlDocumento(act)"
						style="width: 170px;"
					>
						<md-icon md-font-icon="flaticon-printer-tool" ng-show="act.statusAceite == 'Autorizado'"></md-icon>
						<md-icon md-font-icon="flaticon-copy-file" ng-show="act.statusAceite == 'Pendente'"></md-icon>
						<span ng-show="act.statusAceite == 'Autorizado'">Certificado</span>
						<span ng-show="act.statusAceite == 'Pendente'">Aceitar/Recusar</span>
					</md-button>
				</div>
				<md-divider ng-if="!$last"></md-divider>
			</md-list-item>
		</md-list>
	</md-content>
</div>