<div class="top-pad"></div>

<div class="content-padding">
	<? /*
	<div class="box-filter" ng-show="regularList">
		<button class="button orange" ng-class="{ 'inactive' : query.view=='list' }" ng-click="query.view = 'map'">Map</button>
		<button class="button orange" ng-class="{ 'inactive' : query.view=='map' }" ng-click="query.view = 'list'">List</button>
	</div>
	<div class="divider"></div>
	*/ ?>

	<div class="box-content2 box-content-table box-search-bar table-sticky-dependant">
		<table>
			<tr>
				<td colspan="7">
					<div title="More options" class="search-bar-options" ng-class="{'orange':show_more_options}" ng-click="moreOptions()">
						<i class="fa" ng-class="{'fa-search':show_more_options, 'fa-search-plus':!show_more_options}"></i>
					</div>&nbsp;&nbsp;<input type="text" ng-model="query.search" id="search" tabindex="1" placeholder="Search orders">
				</td>
			</tr>
			<tr ng-if="show_more_options">
				<th>Start (PST)</th>
				<td>
					<input type="date" ng-model="query.datestart" tabindex="2">
				</td>
				<th>End (PST)</th>
				<td>
					<input type="date" ng-model="query.dateend" tabindex="3">
				</td>
				<th>Type</th>
				<td>
					<select ng-model="query.type" ng-options="type.value as type.label for type in types"></select>
				</td>
				<td></td>
			</tr>
			<tr ng-if="show_more_options && showSearchByPlaces">
				<th>Restaurant</th>
				<td>
					<ui-select ng-model="query.restaurant" theme="select2" close-on-select="true" style="width: 200px;" title="Select a restaurant">
						<ui-select-match placeholder="Select a restaurant">{{$select.selected.name}}</ui-select-match>
						<ui-select-choices repeat="restaurant.id_restaurant as restaurant in restaurants | propsFilter: {name: $select.search}">
							{{restaurant.name}}
						</ui-select-choices>
					</ui-select>
					<a ng-show="query.restaurant" ng-click="query.restaurant=null" href=""><button class="button button-small button-empty button-green"><i class="fa fa-trash-o"></i></button></a>
				</td>
				<th>Community</th>
				<td>
					<ui-select ng-model="query.community" theme="select2" close-on-select="true" style="width: 200px;" title="Select a community">
						<ui-select-match placeholder="Select a community">{{$select.selected.name}}</ui-select-match>
						<ui-select-choices repeat="community.id_community as community in communities | propsFilter: {name: $select.search}">
							{{community.name}}
						</ui-select-choices>
					</ui-select>
					<a ng-show="query.community" ng-click="query.community=null" href=""><button class="button button-small button-empty button-green"><i class="fa fa-trash-o"></i></button></a>
				</td>
				<th>Driver</th>
				<td>
					<ui-select ng-model="query.driver" theme="select2" close-on-select="true" style="width: 200px;" title="Select a driver">
						<ui-select-match placeholder="Select a driver">{{$select.selected.name}}</ui-select-match>
						<ui-select-choices repeat="driver.id_admin as driver in drivers | propsFilter: {name: $select.search}">
							{{driver.name}}
						</ui-select-choices>
					</ui-select>
					<a ng-show="query.driver" ng-click="query.driver=null" href=""><button class="button button-small button-empty button-green"><i class="fa fa-trash-o"></i></button></a>
				</td>
				<td></td>
			</tr>
			<tr ng-if="show_more_options">
				<th>Display</th>
				<td>
					<select ng-model="query.limit" ng-options="limit.value as limit.label for limit in limits"></select> per page
				</td>
				<td colspan="4">
					<a href="" ng-click="exports()"><button class="button button-small button-empty button-green"><i class="fa fa-download"></i>&nbsp;&nbsp;Export</button></a>
				</td>
			</tr>
		</table>
	</div>

	<div class="bar-loader bar-loader-search" ng-class="{'bar-loader-loading': loading}"></div>

	<ng-include src="'/assets/view/listview-campus-manager-orders.html'" ng-show="query.view=='list' && campusManagerList"></ng-include>
	<ng-include src="'/assets/view/listview-orders.html'" ng-show="query.view=='list' && regularList"></ng-include>


	<div sticky-bottom="47" class="table-sticky-dependant" ng-show="query.view == 'list' && (pages > 1 || more)">
		<div class="no-box-content-color">
			<ng-include src="'/assets/view/listview-paging.html'"></ng-include>
		</div>
	</div>


	<? /*
	<ng-include src="'/assets/view/mapview-orders.html'" ng-show="query.view=='map'"></ng-include>
	*/ ?>
</div>
