<?
	$this->title = 'Communities';
	$this->titleicon = 'group';
	$communities = $this->communities;
?>
<!-- content -->
<div class="container-fluid padded">
	<div class="row-fluid">
		<div class="box">
			<div class="box-header">
				<span class="title">Select a community</span>
			</div>
			<div class="box-content padded">
				<select id="community" name="community" class="chosen-select" style="width:480px;">
					<option value="" selected>Choose...</option>
					<?php  
					foreach ( $communities as $community ) {
						?><option value="<?php echo $community->id_community; ?>"><?php echo $community->name; ?></option><?php 
					}
					?>
				</select>
				<br/><br/><br/>
				<a class="btn btn-default" href="/community/report/">
				<i class="icon-cloud-download"></i> Report (orders for the past 14 days by community)</a>
				&nbsp;&nbsp;
				<a class="btn btn-default" href="/charts/community/orders-per-day">
					<i class="icon-bar-chart"></i> Chart: Orders per Day By Community - Last 14 Days
				</a>

			</div>
		</div>
	</div>
</div>
<script type="text/javascript">
	$( document ).ready( function(){
	
	$('.chosen-select').select2();

	$( '#community' ).on( 'change', function(){
		document.location = '/community/' + $( this ).val();
	} );

} );
</script>