<md-toolbar layout="row" class="md-toolbar-tools md-whiteframe-4dp small-toolbar" >
	<span flex></span>
   	<h5>Gestione utenti e autorizzazioni</h5>
   		<span flex></span>
   			 <md-input-container md-theme="toolbar" md-no-float class="md-hue-1" layout="row" layout-align="end center" style="width:200px;min-width:200px">
				<input type="text" ng-model="ctrl.filter.filterText" aria-label="filtro ricerca" class="toolbar-search" style="width:200px;min-width:200px" ng-change="ctrl.getUtenti()" ng-model-options="{debounce: 400}">
				<i class="fa fa-search"></i>
			</md-input-container>	   
	     	<md-button ng-click="ctrl.nuovoUtente()" aria-label="Inserisi un nuovo utente" class="hilight" style="margin-left:8px" layout="row">
	       		<md-icon  md-font-icon="fa-plus" class="fa"></md-icon>
	       		<span>Nuovo</span>
	       		<md-tooltip>Crea un nuovo utente</md-tooltip>
	     	</md-button>
	     </div>
 </md-toolbar>
 
 <div layout="row" flex="100" style="width:100%;overflow:scroll">
 	<md-list id="list" flex>
 		<md-subheader layout="row">
 			<div layout="row" id="header" style="margin-left:44px">
	 		 	<div style="margin-left:44px;text-align:center;white-space:normal" ng-style="ctrl.getColumnWidth(0)" layout="row">
	 				User ID
	 				<i class="fa fa-sort"  ng-click="ctrl.setOrderField('userId')" style="margin-left:4px"></i>
 				</div>
	 			<div style="text-align:center;white-space:normal" style="width:48px" layout="row">
	 				Stato
	 			</div>
		 		<div style="text-align:center;white-space:normal" ng-style="ctrl.getColumnWidth(1)" layout="row">
		 			Denominazione
		 			<i class="fa fa-sort" ng-click="ctrl.setOrderField('denominazione')" style="margin-left:4px"></i>
	 			</div>
		 		<div style="text-align:center;white-space:normal" ng-style="ctrl.getColumnWidth(2)" layout="row">
		 			Codice fiscale
		 			<i class="fa fa-sort button-icon" ng-click="ctrl.setOrderField('codiceFiscale')" style="margin-left:4px"></i>
		 		</div>
		 		<div style="text-align:center;white-space:normal" ng-style="ctrl.getColumnWidth(3)" layout="row">
		 			Profilo locale
		 			<i class="fa fa-sort button-icon" ng-click="ctrl.setOrderField('profiloLocale')" style="margin-left:4px"></i>
	 			</div>
				<div style="text-align:center;white-space:normal" ng-style="ctrl.getColumnWidth(4)" layout="row">
		 			Funzione ordinante
		 			<i class="fa fa-sort button-icon" ng-click="ctrl.setOrderField('funzioneOrdinante')" style="margin-left:4px"></i>
	 			</div>
				<div style="text-align:center;white-space:normal" ng-style="ctrl.getColumnWidth(5)" layout="row">
		 			Denominazione funzione
		 			<i class="fa fa-sort button-icon" ng-click="ctrl.setOrderField('denominazioneFunzione')" ></i>
	 			</div>
				<div style="text-align:center;white-space:normal" ng-style="ctrl.getColumnWidth(6)" layout="row">
		 			SDD
		 			<i class="fa fa-sort button-icon" ng-click="ctrl.setOrderField('abilitazioneRid')" style="margin-left:4px"></i>
	 			</div>
				<div style="text-align:center;white-space:normal" ng-style="ctrl.getColumnWidth(7)" layout="row">
		 			SEDA
		 			<i class="fa fa-sort button-icon" ng-click="ctrl.setOrderField('abilitazioneAea')" ></i>
	 			</div>
				<div style="text-align:center;white-space:normal" ng-style="ctrl.getColumnWidth(8)" layout="row">
		 			Bonifici SCT
		 			<i class="fa fa-sort button-icon" ng-click="ctrl.setOrderField('abilitazioneBonifici')" style="margin-left:4px"></i>
	 			</div>
				<div style="text-align:center;white-space:normal" ng-style="ctrl.getColumnWidth(9)" layout="row">
		 			Codice funzione
		 			<i class="fa fa-sort button-icon" ng-click="ctrl.setOrderField('codiceFunzione')" style="margin-left:4px"></i>
	 			</div>
				<div style="text-align:center;white-space:normal" ng-style="ctrl.getColumnWidth(10)" layout="row">
		 			User ID resp. 1
		 			<i class="fa fa-sort button-icon"  ng-click="ctrl.setOrderField('userIdresponsabile1')" style="margin-left:4px"></i>
		 		</div>
				<div style="text-align:center;white-space:normal" ng-style="ctrl.getColumnWidth(11)" layout="row">
		 			User ID resp. 2
		 			<i class="fa fa-sort button-icon" ng-click="ctrl.setOrderField('userIdresponsabile2')" ></i>
		 		</div>
		 		<div style="text-align:center;white-space:normal" ng-style="ctrl.getColumnWidth(12)" layout="row">
		 			Ruolo aziendale delegato
		 			<i class="fa fa-sort button-icon" ng-click="ctrl.setOrderField('emailResponsabile')" ></i>
	 			</div>
		 		<div  style="text-align:center;white-space:normal" ng-style="ctrl.getColumnWidth(13)" layout="row">
		 			Importo limite per doppia firma distinta
		 			<i class="fa fa-sort button-icon" ng-click="ctrl.setOrderField('ImportoLimiteFirma')" style="margin-left:4px"></i>
	 			</div>
		 		<div style="text-align:center;white-space:normal" ng-style="ctrl.getColumnWidth(14)" layout="row">
		 			Estrattore AEA IBAN
		 			<i class="fa fa-sort button-icon" ng-click="ctrl.setOrderField('abilitazioneAeaIban')" style="margin-left:4px"></i>
	 			</div>
		 		<div style="text-align:center;white-space:normal" ng-style="ctrl.getColumnWidth(15)" layout="row">
		 			Inserimento manale esito
		 			<i class="fa fa-sort button-icon" ng-click="ctrl.setOrderField('abilitazioneEsitoManuale')" style="margin-left:4px"></i>
	 			</div>
		 		<div style="text-align:center;white-space:normal" ng-style="ctrl.getColumnWidth(16)" layout="row">
		 			Abilita visualizzazione tutte le disposizioni
		 			<i class="fa fa-sort button-icon" ng-click="ctrl.setOrderField('visualizzazioneGlobaleDisposizioni')" style="margin-left:4px"></i>
	 			</div>
		 		<div style="text-align:center;white-space:normal" ng-style="ctrl.getColumnWidth(17)" layout="row">
		 			Accesso anagrafica
		 			<i class="fa fa-sort button-icon" ng-click="ctrl.setOrderField('abilitaAccessoAnagrafica')" style="margin-left:4px"></i>
	 			</div>
		 		<div style="text-align:center;white-space:normal" ng-style="ctrl.getColumnWidth(18)" layout="row">
		 			Approvazione e conferma massiva
		 			<i class="fa fa-sort button-icon" ng-click="ctrl.setOrderField('abilitaApprovazioneMassiva')" style="margin-left:4px"></i>
	 			</div>
		 		<div style="text-align:center;white-space:normal" ng-style="ctrl.getColumnWidth(19)" layout="row">
		 			Blocco modifica disposizioni
		 			<i class="fa fa-sort button-icon" ng-click="ctrl.setOrderField('bloccoModificaDisposizioni')" style="margin-left:4px"></i>
	 			</div>
		 		<div style="text-align:center;white-space:normal" ng-style="ctrl.getColumnWidth(20)" layout="row">
		 			Forzatura sospeso in banca
		 			<i class="fa fa-sort button-icon" ng-click="ctrl.setOrderField('abilitaForzaturaSospeso')" style="margin-left:4px"></i>
	 			</div>
	 			
 			</div>
		</md-subheader>
 		
		<div class="virtualRepeatVerticalUsage" id="container" ng-style="ctrl.getListHeight()" ng-style="ctrl.getMaxListWidth()">
			<md-virtual-repeat-container id="vertical-container" ng-style="ctrl.getMaxListWidth()">
			     <div class="md-1-line hilight"  md-on-demand md-virtual-repeat="data in ctrl.infiniteItems"  md-item-size="40" style="margin-left:30px;height:40px" ng-style="ctrl.getMaxListWidth()">
				     <div class="md-1-line hilight" style="min-height:40px" layout="row"   
				     		ng-class="{'status-ok':!data.BloccoUtente,'status-error':data.bloccoUtente, 'odd-row':$index%2==1,'even-row':$index%2==0, 'selectedRow': ctrl.selectedIndex===$index}"
			     		 	layout-align="start center">

						<div style="width:0;height:6px"></div>
						
						<i class="fa fa-trash button-icon" ng-click="ctrl.eliminaUtente(data)" style="width:48px;text-align:center">
							<md-tooltip>Elimina l'utente</md-tooltip>
						</i>
<!-- 				     	<div style="text-align:center;white-space:normal;text-align:center" style="width:48px" layout="row"> -->
<!--  							<i ng-if="data.bloccoUtente" class="fa fa-times button-icon" ng-click="ctrl.sbloccaUtente(data)"> -->
<!--  								<md-tooltip>Utente bloccato, clicca per sbloccare</md-tooltip> -->
<!--  							</i> -->
<!--  							<i ng-if="!data.bloccoUtente" class="fa fa-check button-icon" ng-click="ctrl.bloccaUtente(data)"> -->
<!--  								<md-tooltip>Utente non bloccato, clicca per bloccare</md-tooltip> -->
<!--  							</i> -->
<!--  						</div> -->
				     	<div layout="row" layout-align="start center" style="cursor:pointer;text-align:center;height:40px" ng-click="ctrl.editUtente($index,$event)" layout-align="start center">
					     	<div ng-style="ctrl.getColumnWidth(0)"><span >{{data.userId}}</span></div>
					     	
					     	<div ng-style="ctrl.getColumnWidth(1)"><span >{{data.denominazione}}</span></div>
					     	<div ng-style="ctrl.getColumnWidth(2)"><span >{{data.codiceFiscale}}</span></div>
					     	<div ng-style="ctrl.getColumnWidth(3)"><span >{{data.profiloLocale}}</span></div>
					     	<div ng-style="ctrl.getColumnWidth(4)"><span >{{data.funzioneOrdinante}}</span></div>
					     	<div ng-style="ctrl.getColumnWidth(5)"><span >{{data.denominazioneFunzione}}</span></div>
					     	<div ng-style="ctrl.getColumnWidth(6)" style="text-align:center"><span><i class="fa fa-check" ng-if="data.abilitazioneRid"></i></span></div>
					     	<div ng-style="ctrl.getColumnWidth(7)" style="text-align:center"><span><i class="fa fa-check" ng-if="data.abilitazioneAea" disabled="disabled"></i></span></div>
					     	<div ng-style="ctrl.getColumnWidth(8)" style="text-align:center"><span><i class="fa fa-check" ng-if="data.abilitazioneBonifici" disabled="disabled"></i></span></div>
					     	<div ng-style="ctrl.getColumnWidth(9)"><span >{{data.codiceFunzione}}</span></div>
					     	<div ng-style="ctrl.getColumnWidth(10)"><span >{{data.userIdresponsabile1}}</span></div>
							<div ng-style="ctrl.getColumnWidth(11)"><span >{{data.userIdresponsabile2}}</span></div>
					     	<div ng-style="ctrl.getColumnWidth(12)"><span >{{data.emailResponsabile}}</span></div>
					     	<div ng-style="ctrl.getColumnWidth(13)" style="text-align:right"><span >{{data.importoLimiteFirma.formatAsCurrency()}}</span></div>
					     	<div ng-style="ctrl.getColumnWidth(14)" style="text-align:center"><span><i class="fa fa-check" ng-if="data.abilitazioneAeaIban"></i></span></div>
					     	<div ng-style="ctrl.getColumnWidth(15)" style="text-align:center"><span><i class="fa fa-check" ng-if="data.abilitazioneEsitoManuale"></i></span></div>
					     	<div ng-style="ctrl.getColumnWidth(16)" style="text-align:center"><span><i class="fa fa-check" ng-if="data.visualizzazioneGlobaleDisposizioni"></i></span></div>
					     	<div ng-style="ctrl.getColumnWidth(17)" style="text-align:center"><span><i class="fa fa-check" ng-if="data.abilitaAccessoAnagrafica"></i></span></div>
					     	<div ng-style="ctrl.getColumnWidth(18)" style="text-align:center"><span><i class="fa fa-check" ng-if="data.abilitaApprovazioneMassiva"></i></span></div>
					     	<div ng-style="ctrl.getColumnWidth(19)" style="text-align:center"><span><i class="fa fa-check" ng-if="data.bloccoModificaDisposizioni"></i></span></div>
					     	<div ng-style="ctrl.getColumnWidth(20)" style="text-align:center"><span><i class="fa fa-check" ng-if="data.abilitaForzaturaSospeso"></i></span></div>
					     </div>
				     </div>
			     </div>
		     </md-virtual-repeat-container>
	     </div>
			 	
 	</md-list>
</div>
