<md-dialog id="dialogSeda" aria-label="Archivio deleghe SEDA" layout-fill flex="95" layout="column">
	<md-toolbar class="small-toolbar">
	   <div class="md-toolbar-tools">
	     <h3>Archivio deleghe SEDA <span ng-if="filteredView"> (fitro attivo)</span></h3>
	     <span flex></span>
	      
          <md-button style="display:none" aria-label="Denominazione banca" class="" ng-click="denominazioneBanca($event)" layout="row">
            <md-icon md-font-icon="fa-bank" class="fa" aria-label="Denominazione banca" title="Denominazione banca"></md-icon>
            <span>Denominazione banca</span>
          </md-button>	     
          <md-button aria-label="Report totali per ABI" class="" ng-click="reportTotali($event)" layout="row" ng-if="filter.aggregazioneABI && filteredView">
            <md-icon md-font-icon="fa-print" class="fa" aria-label="Report totali per ABI" title="Report totali per ABI"></md-icon>
            <span>Report totali</span>
            <md-tooltip>Report Totali Deleghe Aggregate per ABI</md-tooltip>
          </md-button>
          <md-button aria-label="Esporta report totali per ABI su file Excel" style="width:160px" class="md-icon-button" ng-click="exportXLS($event)" layout="row" ng-if="filter.aggregazioneABI && filteredView">
            <md-icon md-font-icon="fa-file-excel-o" class="fa" aria-label="Esporta report totali per ABI su file Excel" title="Esporta report totali per ABI su file Excel"></md-icon>
            <span>Esporta totali</span>
            <md-tooltip>Esporta Report Totali Deleghe per ABI su File Excel</md-tooltip>
          </md-button>

	   </div>
	 </md-toolbar>	

	<div layout="row" layout-padding style="font-size:smaller;max-height:120px" disable-all="disabilitaFiltri()">
		<md-radio-group ng-model="filter.tipo" flex="10">
			<md-radio-button value="0">In carico</md-radio-button>
			<md-radio-button value="1">Non attive </md-radio-button>
			<md-radio-button value="2">Tutte</md-radio-button>
	    </md-radio-group>
	    <div layout="row" flex style="margin-right:10px">
	    	<div layout="column" >
	    		<div layout="row">
	    			<md-checkbox ng-model="filter.cbDaDataApertura" aria-label="Abilita da data apertura"></md-checkbox>
					<md-datepicker ng-model="filter.daDataApertura" md-placeholder="Da data apertura" ng-disabled="!filter.cbDaDataApertura"></md-datepicker>
				</div>
				<div layout="row">
					<md-checkbox ng-model="filter.cbADataApertura" aria-label="Abilita a data apertura"></md-checkbox>
					<md-datepicker ng-model="filter.aDataApertura" md-placeholder="A data apertura" ng-disabled="!filter.cbADataApertura"></md-datepicker>
				</div>
	    	</div>
    	</div>
	    <div layout="row" flex style="margin-right:10px">
	    	<div layout="column" >
	    		<div layout="row">
	    			<md-checkbox ng-model="filter.cbDaDataChiusura" aria-label="Abilita da data chiusura""></md-checkbox>
					<md-datepicker ng-model="filter.daDataChiusura" md-placeholder="Da data chiusura" ng-disabled="!filter.cbDaDataApertura"></md-datepicker>
				</div>
				<div layout="row">
					<md-checkbox ng-model="filter.cbADataChiusura" aria-label="Abilita a data chiusura"></md-checkbox>
					<md-datepicker ng-model="filter.aDataChiusura" md-placeholder="A data chiusura" ng-disabled="!filter.cbADataChiusura"></md-datepicker>
				</div>
	    	</div>
    	</div>
	    <div layout="column" flex="15">
	    	<md-input-container>
  				<label>Stato delega</label>
				<md-select ng-model="filter.statoDelega" placeholder="Stato delega" style="margin-top:0!important" aria-label="Stato delega">
					<md-option value="-1">Tutte</md-option>
					<md-option value="1">Attive</md-option>
					<md-option value="2">Non attive</md-option>
					<md-option value="6">Attivate SDD</md-option>
					<md-option value="0">In attesa di esito</md-option>
				</md-select>
			</md-input-container>
			<md-input-container >
				<label>Codice delega</label>
				<input ng-model="filter.codiceDelega" maxlength="22"/>
			</md-input-container>	
	    </div>
	    <div layout="column" flex="15">
	    	<div layout="row">
		    	<md-checkbox ng-model="filter.aggregazioneABI" aria-label="Aggregazione per codice ABI" flex>
	            	Aggregazione per codice ABI
	          	</md-checkbox>
          	</div>
          	<md-input-container flex-gt-sm="30" flex="100">
				<label>Codice ABI</label>
				<input ng-model="filter.codiceAbi" maxlength="22"/>
			</md-input-container>	
		</div>
		 <div layout="column" >
		 	<md-switch ng-model="filteredView"  ng-change="eseguiRicerca()"  ng-disabled="ricercaInCorso || disabilitaFiltri()" aria-label="Attiva filtri" ><span ng-if="filteredView">Disattiva filtro</span><span ng-if="!filteredView">Attiva filtro</span></md-switch>
<!-- 			<md-button aria-label="Applica filtri" class="" ng-click="eseguiRicerca()" layout="row"> -->
<!-- 	            <md-icon md-font-icon="fa-play" class="fa" aria-label="Esegui ricerca" title="Esegui ricerca"></md-icon> -->
<!-- 	            <span>Applica filtri</span> -->
<!-- 	          </md-button>		  -->
		 </div>
	</div>
	
<!-- 	<div ng-if="vistaAggregatoAbi && filteredView" style="width:100%"> -->
<!-- 		 <div id="grid1" ui-grid="gridOptions" ui-grid-grouping class="grid"  style="width:100%"></div> -->
<!-- 	</div> -->
	
	
	<div class="sticky-container" layout="column" style="padding:14px" flex>
		<ng-form name="form" ng-submit="confirmDialog()" layout="column" flex>
			<md-content flex layout-margin layout="column">
				<md-list flex>
						<md-subheader>
							<div layout="row" flex ng-if="!vistaAggregatoAbi || !filteredView">
<!-- 								<div flex="20" ng-if="filterChiamante.tipoChiamata == 'Destinatari'" ></div> -->
								<div flex="15">Codice delega</div>
								<div flex="10">Tipo codice</div>
								<div flex="10">Codice SIA</div>
								<div flex="5"> ABI</div>
								<div flex="10">Data apertura</div>
								<div flex="10">Data chiusura</div>
								<div flex="10">Stato delega</div>
								<div flex="10">Data acquisizione delega</div>
							</div>
							<div layout="row" flex ng-if="vistaAggregatoAbi">
								<div flex="15">Abi</div>
								<div flex="35">Banca</div>
								<div flex="10">N. mandati</div>
								<div flex="40">Stato delega</div>
							</div>
						</md-subheader>
						<md-divider></md-divider>
					
		<div class="virtualRepeatVerticalUsage" id="container" ng-style="getListHeight()">
			<md-virtual-repeat-container id="vertical-container"  md-top-index="topPosition">
			     <div class="md-1-line hilight" md-on-demand md-virtual-repeat="item in infiniteItems" style="height:25px;width:100%" layout-align="start center">
					
<!-- 					<md-list-item ng-repeat="item in delegheSepa" layout="row" flex> -->
						<div class="md-list-item-text hilight" layout="row" flex layout-align="start center" ng-style="getGridItemHeight()" ng-if="!vistaAggregatoAbi || !filteredView"
							ng-click="showCommands($index,$event)" ng-class="{'odd-row':$index%2==1,'even-row':$index%2==0, 'selectedRow': selectedIndex===$index}"
						>
							
							<div flex="15">{{item.codiceDestinatario}}</div>
							<div flex="10">{{decodeTipoDestinatario(item.tipoCodiceDestinatario)}}</div>
							<div flex="10">{{item.codiceSIA}}</div>
							<div flex="5">{{item.abi}}</div>
							<div flex="10">{{item.dataAperturaMandato.formatAsDate()}}</div>
							<div flex="10">{{item.dataChiusuraMandato.formatAsDate()}}</div>
							<div flex="10" ng-class="{'status-ok':item.statoAllineamento=='1','status-warning':item.statoAllineamento=='6','status-error':item.statoAllineamento=='2','status-unknown':item.statoAllineamento=='0'}">{{decodeStato(item.statoAllineamento)}}</div>
							<div flex="10">{{item.dataCreazioneMandato.formatAsDate()}}</div>
						</div>
<!-- 						<hr style="border-top:2px solid black" ng-if="vistaAggregatoAbi &&  filteredView && isEndAbiBlock(item.abi)"> -->
						<div class="md-list-item-text" layout="row" flex layout-align="start center" ng-style="getGridItemHeight()" ng-if="vistaAggregatoAbi &&  filteredView">
							<div flex="15">{{item.abi}}</div>
							<div flex="35">{{item.banca}}</div>					
							<div flex="10" style="text-align:right;margin-right:20px">{{item.numeroMandati}}</div>
							<div flex="40" ng-class="{'status-ok':item.statoAllineamento=='1','status-warning':item.statoAllineamento=='6','status-error':item.statoAllineamento=='2','status-unknown':item.statoAllineamento=='0'}">{{decodeStato(item.statoAllineamento)}}</div>
						</div>
<!-- 					</md-list-item> -->
				</div>
			</md-virtual-repeat-container>
		</div>
	
				</md-list>		
			</md-content>
			<hr>
			<div layout="row">
				<span flex></span>
	        		<md-button aria-label="Annulla" class="md-raised md-warn" ng-click="cancelDialog()" title="Chiudi">
			            <md-icon md-font-icon="fa-times" class="fa" aria-label="Chiudi" ></md-icon>
			            Chiudi
		          	</md-button>
			</div>			
		</ng-form>
	</div>
</md-dialog>
