{% load i18n l10n swstags %}

{% get_current_language as LANGUAGE_CODE %}

<style>



.tag_filters_text{
	/*border:1px solid yellow;*/
	/*height: 22px;*/
	/*max-height: 10px;*/
	margin:1px;
	padding: 1px 0px 1px 0px;
	display:inline-block;
	float:left;
}


.filter_text{
	/*border:1px solid blue;*/
	/*margin:1px;*/
	display: inline-block;
	float: left;

}

.label_filter_text{
	display:inline-block;
	float:left;
	min-width: 30px;
	text-align: right;
	margin:2px 2px 0px 0px;
}

.input_filters_text
{
	display: inline-block;
	float:left;
	height: 13px;
	width:60px;
	border-top-left-radius:5px;
	border-top-right-radius:0px;
	border-bottom-right-radius:0px;
	border-bottom-left-radius:5px; 
}

.text_radio{
	display: inline-block;
	float:left;

	border:1px solid white;
	border-radius: 5px;
	/*width: 131px;*/
}

.filters_radio{
	display: inline-block;
	float: right;
	margin: 1px 0px 0px 0px;
	/*border: 1px solid white;*/
	/*border-radius: 5px;*/
	background-color: black;
	color:white;
	border:0px;
	border-top-left-radius:0px;
	border-top-right-radius:5px;
	border-bottom-right-radius:5px;
	border-bottom-left-radius:0px; 
	height: 15px;

}

</style>

<div id='{{view_name}}{{name}}_filters_text' class='tag_filters_text'>
	<form id="{{view_name}}{{name}}_filters_text_form"  onSubmit="return false;"> 
		{% for f_text in filters_text%}
			<div id = '{{view_name}}{{name}}{{f_text.0}}_text' class= 'filter_text'>
				<label class="label_filter_text" >{{f_text.1}} </label> 

				<div id='{{view_name}}{{name}}text_radio' class='text_radio'>
					<input type='text' id='{{view_name}}_{{f_text.0}}' name= '{{name}}_text_{{f_text.0}}' class="input_filters_text"/> 
					<select name="{{name}}_radio_{{f_text.0}}" class='filters_radio'>
						<option value="__startswith">Begins</option>
						<option value="__contains">Contains</option>
						<option value="NULL">Exact</option>
					</select>
				</div>
			</div>
		{% endfor%}		
	</form>	
	 <p style= 'clear: both !important;'></p>
</div>

<script type="text/javascript" lang="text/javascript">


$('.filters_radio').change(function(){
	if (STP[STP['VIEWS']['{{view_name}}']]['switch_auto'].actualValue == 'ON'){
		{{view_name}}_callback('filtersText');
	}
	else{
		{{view_name}}_callback('waiting');
		STP[STP['VIEWS']['{{view_name}}']]['buttons_clup'].highlight('update')
	}
});

$('.input_filters_text').keyup(function(e){
	if (e.keyCode == 13){
		if (STP[STP['VIEWS']['{{view_name}}']]['switch_auto'].actualValue == 'ON'){
			{{view_name}}_callback('filtersText');
		}
		else{
			{{view_name}}_callback('waiting');
			STP[STP['VIEWS']['{{view_name}}']]['buttons_clup'].highlight('update')
		}
	}
});

</script>