<div class="row">
	<div class="col-sm-12">
		<h4 class="page-title">{% lang 'ViewBanners' %}</h4>
		<p>{% lang 'BannerIntro' %}</p>
		{{ Message|safe }}
	</div>
</div>

<div class="row">
	<div class="col-sm-12">
		<input type="button" name="IndexAddButton" value="{% lang 'CreateBanner' %}..." id="IndexCreateButton" class="btn btn-primary" onclick="document.location.href='index.php?ToDo=createBanner'" /> 
		<input type="button" name="IndexDeleteButton" value="{% lang 'DeleteSelected' %}" id="IndexDeleteButton" class="btn btn-danger" onclick="ConfirmDeleteSelected()" {{ DisableDelete|safe }} />
	</div>
</div>
<br />

<div class="panel panel-default" style="display: {{ DisplayGrid|safe }}">
	<div class="panel-heading"> 
		<h3 class="panel-title">Banners da Loja</h3> 
	</div>
	<div class="panel-body pn">
		<div class="table-responsive">
			<form name="frmBanners" id="frmBanners" method="post" action="index.php?ToDo=deleteBanners">
				<div class="GridContainer">
					{{ BannersGrid|safe }}
				</div>
			</form>
		</div>
	</div>
</div>

<script type="text/javascript">
	function CheckSearchForm()
		{
			var filter = document.getElementById("filterCategory");
			var query = document.getElementById("searchQuery");

			if(filter.value == "" && query.value == "")
			{
				alert("{% lang 'ChooseFilterOrEnterSearchTerm' %}");
				return false;
			}

			return true;
		}

		function ConfirmDeleteSelected()
		{
			var fp = document.getElementById("frmBanners").elements;
			var c = 0;

			for(i = 0; i < fp.length; i++) {
				if(fp[i].type == "checkbox" && fp[i].checked)
					c++;
			}

			if(c > 0) {
				if(confirm("{% lang 'ConfirmDeleteBanners' %}"))
					document.getElementById("frmBanners").submit();
			}
			else {
				alert("{% lang 'ChooseBanners' %}");
			}
		}

		function ToggleDeleteBoxes(Status)
		{
			var fp = document.getElementById("frmBanners").elements;

			for(i = 0; i < fp.length; i++)
				fp[i].checked = Status;
		}

	</script>
