<md-toolbar layout="row" class="md-toolbar-tools md-whiteframe-4dp small-toolbar" >
	<span flex></span>
   	<h5><span ng-if="ctrl.largeScreen()">Disposizioni di incasso </span>{{ctrl.tipologia}} <small>({{ctrl.maxItems}} elementi)</small></h5>
    <span flex></span>
    	<div layout="row" ng-if="ctrl.largeScreen()" layout-align="space-between center">
<!--     	
   	          <md-button aria-label="Firma distinta" style="width:140px" class="md-icon-button toolbar-long-button" ng-click="ctrl.firmaDistinta()" layout="row" ng-if="ctrl.abilitaFirma">
	            <md-icon md-font-icon="fa-pencil-square-o" class="fa" aria-label="Firma distinta" title="Firma distinta"></md-icon>
	            <span>Firma distinta</span>
	          </md-button>
 -->	          
    		<md-button aria-label="Ricerca disposizioni" class="md-icon-button toolbar-long-button">
            	<md-checkbox ng-model="ctrl.filter.inErrore" ng-change="ctrl.cercaErrori()"> Disposizioni in errore</md-checkbox>
    		</md-button>
	          <md-button aria-label="Ricerca disposizioni" class="md-icon-button toolbar-long-button" ng-click="ctrl.ricercaDisposizioni($event)" layout="row">
	            <md-icon md-font-icon="fa-search" class="fa" aria-label="Ricerca disposizioni" title="Ricerca disposizioni"></md-icon>
	            <span>Ricerca disposizioni</span>
	          </md-button>
	          <md-button aria-label="Stampa disposizioni" class="md-icon-button toolbar-long-button" ng-click="ctrl.stampaDisposizioni()" layout="row">
	            <md-icon md-font-icon="fa-print" class="fa" aria-label="Stampa disposizioni" title="Stampa disposizioni"></md-icon>
	            <span>Stampa</span>
	          </md-button>
	          <md-button aria-label="Esporta disposizioni" class="md-icon-button toolbar-long-button" ng-click="ctrl.esportaDisposizioni()" layout="row">
	            <md-icon md-font-icon="fa-file-excel-o" class="fa" aria-label="Esporta disposizioni" title="Esporta disposizioni"></md-icon>
	            <span>Esporta</span>
	          </md-button>
			<md-button aria-label="Cancellazione disposizioni" class="md-icon-button toolbar-long-button" ng-click="ctrl.cancellaDisposizioni()" layout="row" ng-if="ctrl.getSelectedIds().length>0">
	            <md-icon md-font-icon="fa-trash" class="fa" aria-label="Cancella disposizioni" title="Cancella disposizioni"></md-icon>
	            <span>Cancella selezionate</span>
	          </md-button>	          
        </div>
       	<md-menu md-offset="0 50" ng-if="!largeScreen()" style="margin-top: -8px;">
			<md-button aria-label="Opzioni" class="md-icon-button" ng-click="$mdMenu.open($event)">
            	<md-icon  md-font-icon="fa-ellipsis-v" class="fa"></md-icon>
          	</md-button>
			<md-menu-content width="4">
 <!--  			
				 <md-button aria-label="Firma distinta" style="width:140px" class="md-icon-button toolbar-long-button" ng-click="ctrl.firmaDistinta()" layout="row" ng-if="ctrl.abilitaFirma">
		            <md-icon md-font-icon="fa-pencil-square-o" class="fa" aria-label="Firma distinta" title="Firma distinta"></md-icon>
		            <span>Firma distinta</span>
		          </md-button>
-->		          
				<md-button aria-label="Ricerca disposizioni" class="md-icon-button toolbar-long-button">
					<md-checkbox ng-model="ctrl.filter.inErrore" ng-change="ctrl.cercaErrori()"> Disposizioni in errore</md-checkbox>
				</md-button>
				<md-button aria-label="Ricerca disposizioni" class="md-icon-button toolbar-long-button" ng-click="ctrl.ricercaDisposizioni($event)" layout="row">
	            	<md-icon md-font-icon="fa-search" class="fa" aria-label="Ricerca disposizioni" title="Ricerca disposizioni"></md-icon>
	            	<span>Ricerca </span>
	          	</md-button>
	          	<md-button aria-label="Stampa disposizioni" class="md-icon-button toolbar-long-button" ng-click="ctrl.stampaDisposizioni()" layout="row">
		            <md-icon md-font-icon="fa-print" class="fa" aria-label="Stampa disposizioni" title="Stampa disposizioni"></md-icon>
	            	<span>Stampa </span>
	          	</md-button>
	          <md-button aria-label="Esporta disposizioni" class="md-icon-button toolbar-long-button" ng-click="ctrl.esportaDisposizioni()" layout="row">
	            <md-icon md-font-icon="fa-file-excel-o" class="fa" aria-label="Esporta disposizioni" title="Esporta disposizioni"></md-icon>
	            <span>Esporta</span>
	          </md-button>
	          	<md-button aria-label="Stampa disposizioni" class="md-icon-button toolbar-long-button" ng-click="ctrl.eliminaDisposizioni()" layout="row">
		            <md-icon md-font-icon="fa-print" class="fa" aria-label="Elimina disposizioni selezionate" title="Elimina disposizioni selezionate"></md-icon>
	            	<span>Elimina </span>
	          	</md-button>
	          
          </md-menu-content>
        </md-menu>
	    		          
	    		
 </md-toolbar>
 
 <div layout="row" flex="100" style="width:100%;overflow:scroll">
 	<md-list id="list" flex>
 		<md-subheader layout="row" style="width:400%">
 			<div flex layout="row" id="header" ng-if="ctrl.largeScreen()">
 				<div style="width:24px;margin-top:8px;font-size:smaller" style="text-align:center">
 					<md-checkbox ng-checked="ctrl.allSelected" aria-label="Seleziona tutto" ng-click="ctrl.toggleSelectAll()"></md-checkbox>
				</div>
 			
	 		 	<md-button ng-click="ctrl.setOrderField('iddisposizione')" ng-style="ctrl.getColumnWidth(0)">
	 				ID
	 				<md-icon md-font-icon="fa fa-sort" class="fa"></md-icon>
 				</md-button>
		 		<md-button ng-style="ctrl.getColumnWidth(1)"  ng-click="ctrl.setOrderField('firmaDelegato1')" ng-if="ctrl.abilitaFirma"  class="small-screen-col-title">
		 			<span ng-style="ctrl.getColumnWidth(1);display:inline">Firma</span>
		 			<i class="fa fa-sort"></i>
	 			</md-button>
		 		<md-button ng-click="ctrl.setOrderField('regolarizzazioneSepa')" ng-style="ctrl.getColumnWidth(1)">
		 			Circuito
		 			<i class="fa fa-sort"></i>
	 			</md-button>
		 		
		 		<md-button ng-click="ctrl.setOrderField('codiceClienteDebitore')" ng-style="ctrl.getColumnWidth(2)">
		 			Codice destinatario
		 			<i class="fa fa-sort"></i>
		 		</md-button>
		 		<md-button ng-click="ctrl.setOrderField('funzioneOrdinante')" ng-style="ctrl.getColumnWidth(3)">
		 			Funzione
		 			<i class="fa fa-sort"></i>
	 			</md-button>
				<md-button ng-click="ctrl.setOrderField('iddistintaBanca')" ng-style="ctrl.getColumnWidth(4)">
		 			Distinta
		 			<i class="fa fa-sort"></i>
	 			</md-button>
				<md-button ng-click="ctrl.setOrderField('statoDisposizione')" ng-style="ctrl.getColumnWidth(5)">
		 			Stato
		 			<i class="fa fa-sort"></i>
	 			</md-button>
				<md-button ng-click="ctrl.setOrderField('provenienzaDisposizione')" ng-style="ctrl.getColumnWidth(6)">
		 			Provenienza
		 			<i class="fa fa-sort"></i>
	 			</md-button>
				<md-button ng-click="ctrl.setOrderField('dataInserimentoDisposizione')" ng-style="ctrl.getColumnWidth(7)" style="text-align:center">
		 			Inserimento
		 			<i class="fa fa-sort"></i>
	 			</md-button>
				<md-button ng-click="ctrl.setOrderField('esito')" ng-style="ctrl.getColumnWidth(8)">
		 			Esito
		 			<i class="fa fa-sort"></i>
	 			</md-button>
				<md-button ng-click="ctrl.setOrderField('denominazioneDestinatario')" ng-style="ctrl.getColumnWidth(9)">
		 			Destinatario
		 			<i class="fa fa-sort"></i>
	 			</md-button>
				<md-button ng-click="ctrl.setOrderField('data_Valuta_Destinatario')" ng-style="ctrl.getColumnWidth(10)" style="text-align:center">
		 			Scadenza
		 			<i class="fa fa-sort"></i>
		 		</md-button>
		 		<md-button ng-click="ctrl.setOrderField('importoDbGrid')" style="text-align:right" ng-style="ctrl.getColumnWidth(11)">
		 			Importo
		 			<i class="fa fa-sort"></i>
	 			</md-button>
		 		<md-button ng-click="ctrl.setOrderField('codice_Abi_Destinatario')" style="text-align:center" ng-style="ctrl.getColumnWidth(12)">
		 			ABI
		 			<i class="fa fa-sort"></i>
	 			</md-button>
		 		<md-button ng-click="ctrl.setOrderField('cab_Destinatario')" style="text-align:center" ng-style="ctrl.getColumnWidth(13)">
		 			CAB
		 			<i class="fa fa-sort"></i>
	 			</md-button>
		 		<md-button ng-click="ctrl.setOrderField('conto_Destinatario')" style="text-align:center" ng-style="ctrl.getColumnWidth(14)">
		 			Conto corrente
		 			<i class="fa fa-sort"></i>
	 			</md-button>
		 		<md-button ng-click="ctrl.setOrderField('banca_Sportello_Domic')"  ng-style="ctrl.getColumnWidth(15)">
		 			Descrizione conto
		 			<i class="fa fa-sort"></i>
	 			</md-button>
		 		<md-button ng-click="ctrl.setOrderField('iddisposizioneFunzioneOrdinante')"  ng-style="ctrl.getColumnWidth(16)">
		 			ID Funzione Ordinante
		 			<i class="fa fa-sort"></i>
	 			</md-button>
 			</div>
 			
 			<!--  small screen header -->
 			
 			<div flex="100" layout="column" id="header"  ng-if="!ctrl.largeScreen()">
 				<div flex="100" layout="row">
		 		 	<a href='' ng-click="ctrl.setOrderField('iddisposizione')" ng-style="ctrl.getColumnWidth(0)" class="small-screen-col-title">
		 				<div ng-style="ctrl.getColumnWidth(0);" style="display:inline">ID</div>
		 				<md-icon md-font-icon="fa fa-sort" class="fa"></md-icon>
	 				</a>
			 		<a href=''  ng-click="ctrl.setOrderField('regolarizzazioneSepa')" ng-style="ctrl.getColumnWidth(1)" class="small-screen-col-title">
			 			<div ng-style="ctrl.getColumnWidth(0)" style="display:inline">Circuito</div>
			 			<i class="fa fa-sort"></i>
		 			</a>
			 		
			 		<a href=''  ng-click="ctrl.setOrderField('codiceClienteDebitore')" ng-style="ctrl.getColumnWidth(2)" class="small-screen-col-title">
			 			<div ng-style="ctrl.getColumnWidth(0)" style="display:inline">Codice destinatario</div>
			 			<i class="fa fa-sort"></i>
			 		</a>
			 		<a href=''  ng-click="ctrl.setOrderField('funzioneOrdinante')" ng-style="ctrl.getColumnWidth(3)" class="small-screen-col-title">
			 			<div ng-style="ctrl.getColumnWidth(0)" style="display:inline">Funzione</div>
			 			<i class="fa fa-sort"></i>
		 			</a>
					<a href=''  ng-click="ctrl.setOrderField('iddistintaBanca')" ng-style="ctrl.getColumnWidth(4)" class="small-screen-col-title">
			 			<div ng-style="ctrl.getColumnWidth(0)" style="display:inline">Distinta</div>
			 			<i class="fa fa-sort"></i>
		 			</a>
					<a href=''  ng-click="ctrl.setOrderField('provenienzaDisposizione')" ng-style="ctrl.getColumnWidth(6)" class="small-screen-col-title">
			 			<div ng-style="ctrl.getColumnWidth(0)" style="display:inline">Provenienza</div>
			 			<i class="fa fa-sort"></i>
		 			</a>
					<a href=''  ng-click="ctrl.setOrderField('dataInserimentoDisposizione')" ng-style="ctrl.getColumnWidth(7)" style="text-align:center" class="small-screen-col-title">
			 			<div ng-style="ctrl.getColumnWidth(0)" style="display:inline">Inserimento</div>
			 			<i class="fa fa-sort"></i>
		 			</a>
					<a href=''  ng-click="ctrl.setOrderField('esito')" ng-style="ctrl.getColumnWidth(8)" class="small-screen-col-title">
			 			<div ng-style="ctrl.getColumnWidth(0)" style="display:inline">Esito</div>
			 			<i class="fa fa-sort"></i>
		 			</a>
					<a href=''  ng-click="ctrl.setOrderField('data_Valuta_Destinatario')" ng-style="ctrl.getColumnWidth(10)" style="text-align:center" class="small-screen-col-title">
			 			<div ng-style="ctrl.getColumnWidth(0)" style="display:inline">Scadenza</div>
			 			<i class="fa fa-sort"></i>
			 		</a>
			 		<a href=''  ng-click="ctrl.setOrderField('codice_Abi_Destinatario')" style="text-align:center" ng-style="ctrl.getColumnWidth(12)" class="small-screen-col-title">
			 			<div ng-style="ctrl.getColumnWidth(0)" style="display:inline">ABI</div>
			 			<i class="fa fa-sort"></i>
		 			</a>
			 		<a href=''  ng-click="ctrl.setOrderField('cab_Destinatario')" style="text-align:center" ng-style="ctrl.getColumnWidth(13)" class="small-screen-col-title">
			 			<div ng-style="ctrl.getColumnWidth(0)" style="display:inline">CAB</div>
			 			<i class="fa fa-sort"></i>
		 			</a>
			 		<a href=''  ng-click="ctrl.setOrderField('conto_Destinatario')" style="text-align:center" ng-style="ctrl.getColumnWidth(14)" class="small-screen-col-title">
			 			<div ng-style="ctrl.getColumnWidth(0)" style="display:inline">Conto corrente</div>
			 			<i class="fa fa-sort"></i>
		 			</a>
			 		<a href=''  ng-click="ctrl.setOrderField('banca_Sportello_Domic')"  ng-style="ctrl.getColumnWidth(15)" class="small-screen-col-title">
			 			<div ng-style="ctrl.getColumnWidth(0)" style="display:inline">Descrizione conto</div>
			 			<i class="fa fa-sort"></i>
		 			</a>
			 		<a href=''  ng-click="ctrl.setOrderField('iddisposizioneFunzioneOrdinante')"  ng-style="ctrl.getColumnWidth(16)" class="small-screen-col-title">
			 			<div ng-style="ctrl.getColumnWidth(0)" style="display:inline">ID Funzione Ordinante</div>
			 			<i class="fa fa-sort"></i>
		 			</a>
	 			</div> 	
		 		<div flex="100" layout="row">
					<a href=''  ng-click="ctrl.setOrderField('statoDisposizione')" ng-style="ctrl.getColumnWidth(5)" class="small-screen-col-title">
			 			<div ng-style="ctrl.getColumnWidth(0)" style="display:inline">Stato</div>
			 			<i class="fa fa-sort"></i>
		 			</a>
			 		<a href=''  ng-click="ctrl.setOrdierField('importoDbGrid')" style="text-align:left" ng-style="ctrl.getColumnWidth(11)" class="small-screen-col-title">
			 			<div ng-style="ctrl.getColumnWidth(0)" style="display:inline">Importo</div>
			 			<i class="fa fa-sort"></i>
		 			</a>
					<a href=''  ng-click="ctrl.setOrderField('denominazioneDestinatario')" ng-style="ctrl.getColumnWidth(9)" class="small-screen-col-title">
			 			<div ng-style="ctrl.getColumnWidth(0)" style="display:inline">Destinatario</div>
			 			<i class="fa fa-sort"></i>
		 			</a>
	 			</div>
 			</div>		
		</md-subheader>
 		
		<div class="virtualRepeatVerticalUsage" id="container" ng-style="ctrl.getListHeight()" a-ng-style="ctrl.getMaxListWidth()"  ng-keydown="ctrl.key($event)" >
			<md-virtual-repeat-container id="vertical-container" a-ng-style="ctrl.getMaxListWidth()">
			     <div class="md-1-line hilight" md-on-demand md-virtual-repeat="data in ctrl.infiniteItems" md-item-size="25" a-ng-style="ctrl.getMaxListWidth()" md-top-index="ctrl.topIndex">

				     
				     <div ng-if="largeScreen()" class="md-1-line hilight"  ng-style="ctrl.getGridItemHeight()"  a-ng-style="ctrl.getMaxListWidth()"  layout="row" 
				     		ng-class="{'status-ok':data.statoConvalida==-1,'status-warning':data.statoConvalida==2,'status-error':data.statoConvalida==0,'odd-row':$index%2==1,'even-row':$index%2==0, 'selectedRow': ctrl.selectedIndex===$index}"
				     		 layout-align="start center">
				     	<div style="width:24px;margin-top:8px;font-size:smaller" style="text-align:center"><span ><md-checkbox ng-model="data.selected" aria-label="Checkbox 1"></md-checkbox></span></div>
					<div ng-click="ctrl.mostraDisposizione($index, $event)" layout="row" >
				     	<div style="width:0" ng-style="ctrl.getGridItemHeight()"></div>
				     	<div ng-style="ctrl.getColumnWidth(0)" style="text-align:right"><span >{{data.iddisposizione}}</span></div>

				     	<div ng-style="ctrl.getColumnWidth(1)"><span >{{ctrl.decodeCircuitoSDD(data.regolarizzazioneSepa)}}</span></div>
				     	<div ng-style="ctrl.getColumnWidth(2)"><span >{{data.codiceClienteDebitore}}</span></div>
				     	<div ng-style="ctrl.getColumnWidth(3)"><span >{{data.funzioneOrdinante}}</span></div>
				     	<div ng-style="ctrl.getColumnWidth(4)" style="text-align:right"><span >{{data.iddistintaBanca}}</span></div>
				     	<div ng-style="ctrl.getColumnWidth(5)"><span >{{data.statoDisposizione}}</span></div>
				     	<div ng-style="ctrl.getColumnWidth(6)"><span >{{data.provenienzaDisposizione}}</span></div>
				     	<div ng-style="ctrl.getColumnWidth(7)" style="text-align:center"><span >{{data.dataInserimentoDisposizione.formatAsDate()}}</span></div>
				     	<div ng-style="ctrl.getColumnWidth(8)" style="text-align:center"><span >
							<i class="fa" ng-class="{'fa-check':data.esito==1, 'fa-circle': data.esito==2}" ng-style="ctrl.getEsitoColor(data.esito)"></i>
		     			</span></div>
				     	<div ng-style="ctrl.getColumnWidth(9)"><span >{{data.denominazioneDestinatario}}</span></div>
				     	<div ng-style="ctrl.getColumnWidth(10)" style="text-align:center"><span >{{data.dataValutaDestinatario.formatAsDate()}}</span></div>
				     	<div ng-style="ctrl.getColumnWidth(11)" style="text-align:right"><span>{{data.importo}}</span></div>
				     	<div ng-style="ctrl.getColumnWidth(12)" style="text-align:center"><span >{{data.codiceAbiDestinatario}}</span></div>
				     	<div ng-style="ctrl.getColumnWidth(13)" style="text-align:center"><span >{{data.cabDestinatario}}</span></div>
				     	<div ng-style="ctrl.getColumnWidth(14)" style="text-align:center"><span >{{data.contoDestinatario}}</span></div>
				     	<div ng-style="ctrl.getColumnWidth(15)"><span >{{data.bancaSportelloDomic}}</span></div>
				     	<div ng-style="ctrl.getColumnWidth(16)" style="text-align:left"><span>{{data.iddisposizioneFunzioneOrdinante}}</span></div>
				     </div>
				     
				     </div>
				     <div ng-if="!largeScreen()" class="hilight"  ng-style="ctrl.getGridItemHeight()"  ang-style="ctrl.getMaxListWidth()"  layout="column" ng-click="ctrl.mostraDisposizione($index, $event)"  
				     		ng-class="{'status-ok':data.statoConvalida==-1,'status-warning':data.statoConvalida==2,'status-error':data.statoConvalida==0,'odd-row':$index%2==1,'even-row':$index%2==0, 'selectedRow': ctrl.selectedIndex===$index}"
				     		>
						<div layout="row" style="height:24px">
					     	<div ng-style="ctrl.getColumnWidth(0)" style="text-align:right"><span >{{data.iddisposizione}}</span></div>
					     	<div ng-style="ctrl.getColumnWidth(1)" style="text-align:center" ng-show="ctrl.abilitaFirma && (ctrl.filter.userIdFirmatario1==''||ctrl.filter.userIdFirmatario1==null)"><md-checkbox ng-model="data.firmaDelegato1" disabled="disabled"></md-checkbox></div>
					     	<div ng-style="ctrl.getColumnWidth(1)" style="text-align:center" ng-show="ctrl.abilitaFirma && (ctrl.filter.userIdFirmatario1!='' && ctrl.filter.userIdFirmatario1!=null)"><md-checkbox ng-model="data.firmaDelegato2" disabled="disabled"></md-checkbox></div>
					     	<div ng-style="ctrl.getColumnWidth(1)" style="text-align:right"><span>{{ctrl.decodeCircuitoSDD(data.regolarizzazioneSepa)}}</span></div>
					     	<div ng-style="ctrl.getColumnWidth(2)"><span >{{data.codiceClienteDebitore}}</span></div>
					     	<div ng-style="ctrl.getColumnWidth(3)"><span >{{data.funzioneOrdinante}}</span></div>
					     	<div ng-style="ctrl.getColumnWidth(4)" style="text-align:right"><span >{{data.iddistintaBanca}}</span></div>
					     	<div ng-style="ctrl.getColumnWidth(6)"><span >{{data.provenienzaDisposizione}}</span></div>
					     	<div ng-style="ctrl.getColumnWidth(7)" style="text-align:center"><span >{{data.dataInserimentoDisposizione.formatAsDate()}}</span></div>
					     	<div ng-style="ctrl.getColumnWidth(8)" style="text-align:center"><span >
								<i class="fa" ng-class="{'fa-check':data.esito==1, 'fa-circle': data.esito==2}" ng-style="ctrl.getEsitoColor(data.esito)"></i>
			     			</span></div>
					     	<div ng-style="ctrl.getColumnWidth(10)" style="text-align:center"><span >{{data.dataValutaDestinatario.formatAsDate()}}</span></div>
					     	<div ng-style="ctrl.getColumnWidth(12)" style="text-align:center"><span >{{data.codiceAbiDestinatario}}</span></div>
					     	<div ng-style="ctrl.getColumnWidth(13)" style="text-align:center"><span >{{data.cabDestinatario}}</span></div>
					     	<div ng-style="ctrl.getColumnWidth(14)" style="text-align:center"><span >{{data.contoDestinatario}}</span></div>
					     	<div ng-style="ctrl.getColumnWidth(15)"><span >{{data.bancaSportelloDomic}}</span></div>
					     	<div ng-style="ctrl.getColumnWidth(16)" style="text-align:left"><span>{{data.iddisposizioneFunzioneOrdinante}}</span></div>
						</div>
						<div layout="row" style="height:24px">
					     	<div ng-style="ctrl.getColumnWidth(5)" style="text-align:right"><span >{{data.statoDisposizione}}</span></div>
					     	<div ng-style="ctrl.getColumnWidth(11)" style="text-align:right"><span>{{data.importo}}</span></div>
					     	<div ng-style="ctrl.getColumnWidth(9)" style="white-space: nowrap;overflow:hidden;text-overflow:ellipsis;"><span >{{data.denominazioneDestinatario}}</span></div>
						</div>
				     </div>				     
			     </div>
			     

			     </div>
			     
		     </md-virtual-repeat-container>
	     </div>
			 	
 	</md-list>
 
 </div>