<md-dialog aria-label="Ricerca coordinate bancarie" style="height:800px;width:900px" layout="column">
		<md-toolbar class="small-toolbar">
		   <div class="md-toolbar-tools">
		     <h3>Ricerca coordinate bancarie</h3>
		     <span flex></span>
		     <md-icon  ng-if="permettiCreazione" class="fa button-icon" md-font-icon="fa-plus" ng-click="nuovaBanca()">
     	           	<md-tooltip>Aggiungi  banca</md-tooltip>
   	          </md-icon>
		     <md-icon ng-click="cancelDialog()" md-font-icon="fa-times" class="fa button-icon" style="color:white;margin-left:24px">
					<md-tooltip>Chiudi</md-tooltip>
			 </md-icon>
		   </div>
		 </md-toolbar>

	<md-content layout="column" style="padding-left:14px;padding-right:14px" flex>
		<form name="form" ng-submit="eseguiRicerca()" layout="column" flex>
			<div layout="row" style="width:100%" layout-align="start center">
            	<md-autocomplete flex
			          md-no-cache="true"
			          md-selected-item="istitutoSelezionato"
			          md-clear-button="true"
			          md-search-text="searchText"
			          md-selected-item-change="selectIstituto()"
			          md-items="item in cercaIstituto(searchText)"
			          md-item-text="item.descri"
			          md-min-length="1"
			          md-escape-options="none"
			          md-require-match="false"
			          md-delay="400"
			          md-clear-button="true"
			          md-autofocus="true"
			          placeholder="Istituto">
					
						<md-item-template>
							{{item.descri}}
						</md-item-template>
     	           </md-autocomplete>
     	           <i ng-if="permettiCreazione && istitutoSelezionato!=null" class="fa fa-pencil button-icon" ng-click="editBanca(istitutoSelezionato)">
     	           	<md-tooltip>Modifica dati banca</md-tooltip>
     	           </i>
		        </div>
	        <hr>
	        <div flex layout-gt-sm="row" layout="column" style="max-height:78px">
				<md-input-container flex-gt-sm="33" flex="100">
	            	<label>Abi</label>
				    <input ng-model="filter.abi" type="text" ng-blur="trovaBancaDaAbi()">
		        </md-input-container>
				<md-input-container flex-gt-sm="33" flex="100">
	            	<label>Cab</label>
				    <input ng-model="filter.cab" type="text">
		        </md-input-container>
				<md-input-container flex-gt-sm="33" flex="100">
	            	<label>Bic</label>
				    <input ng-model="filter.bic" type="text">
		        </md-input-container>
	        </div>
	        <div flex layout="row" style="max-height:78px">
				<md-input-container flex>
	            	<label>Agenzia</label>
				    <input ng-model="filter.agenzia" type="text">
		        </md-input-container> 
	        </div>
	        <div flex layout="row" style="max-height:78px">
				<md-input-container flex>
	            	<label>Indirizzo</label>
				    <input ng-model="filter.indirizzo" type="text">
		        </md-input-container>
				<md-input-container flex>
	            	<label>Località</label>
			    	<input ng-model="filter.localita" type="text">
	        	</md-input-container>
        	</div>
	        <div flex layout-gt-sm="row" layout="column" style="max-height:78px">  
				<md-input-container flex="40">
	            	<label>Comune</label>
			    	<input ng-model="filter.comune" type="text">
	        	</md-input-container> 
	        	<md-input-container flex="20">
	        		<md-select ng-model="filter.tipoRicerca" placeholder="Tipo ricerca">
	        			<md-option ng-value="0">Esatta</md-option>
	        			<md-option ng-value="1">Ricerca libera</md-option>
	        			<md-option ng-value="2">Ricerca con inizio per</md-option>
	        		</md-select>
	        	</md-input-container>
				<md-input-container flex="20">
	            	<label>Provincia</label>
			    	<input ng-model="filter.provincia" type="text">
	        	</md-input-container> 
				<md-input-container flex="20">
	            	<label>Cap</label>
			    	<input ng-model="filter.cap" type="text">
	        	</md-input-container> 
        	</div>
        	
        	<div flex layout-gt-sm="row" layout="column"  style="max-height:48px" layout-align="center center">  
        		<md-button type="submit" aria-label="Ricerca" class="md-raised md-primary" title="Esegui la ricerca" >
	            	<md-icon md-font-icon="fa-search" class="fa" aria-label="Ricerca"></md-icon>
	            	Esegui ricerca
	          	</md-button>   
	          	
        		<md-button type="submit" aria-label="Nuovo sportello" class="md-raised md-hue1" title="Nuovo sportello" ng-if="permettiCreazione && istitutoSelezionato!=null" ng-click="nuovoSportello($event)">
	            	<md-icon md-font-icon="fa-plus" class="fa" aria-label="Nuovo sportello"></md-icon>
	            	Nuovo sportello
	          	</md-button>   
	          	     		
        	</div>
        	
        	<md-content flex style="overflow:hidden">
	        	<md-list flex style="margin-top:10px">
					<md-subheader class="md-no-sticky">Selezionare una filiale</md-subheader>
				
					<div flex class="virtualRepeatVerticalUsage" id="container" style="height:190px">
						<md-virtual-repeat-container id="vertical-container">
						  	<md-list-item  md-virtual-repeat="item in filiali" ng-class="{'odd-row':$index%2==1,'even-row':$index%2==0}" style="cursor:pointer;font-size:smaller;text-overflow:ellipsis" layout="row">
						  		<div layout="row">
							  		<i ng-if="permettiCreazione " class="fa fa-pencil button-icon" style="margin-right:12px" ng-click="editSportello($index, $event)">
							  			<md-tooltip>Modifica dati filiale</md-tooltip>
							  		</i>
							  		<div ng-click="selectFiliale($index,$event)" layout="row" class="hilight"> 
					        			<div style="width:160px">{{item.agenzia}}</div>
					        			<div style="width:100px">{{item.cab}}</div>
			        					<div style="width:200px">{{item.indir}}</div>
			        					<div style="width:150px">{{item.localita}}</div>
			        					<div style="width:150px">{{item.comune}}</div>
			        					<div style="width:50px">{{item.prov}}</div>
		        					</div>
		        					<i ng-if="permettiCreazione " class="fa fa-trash button-icon" ng-click="deleteFiliale($index,$event)" style="margin-right:12px">
							  			<md-tooltip>Elimina filiale</md-tooltip>
							  		</i>
						  		</div>
						  </md-list-item>
					  	</md-virtual-repeat-container>
					
        		</md-list>	
       		</md-content>
		</form>
	</md-content>
</md-dialog>
