<div class="box-content2 box-content-table">
	<div sticky-header>
		<table class="thead">
			<tr>
				<th>Community</th>
				<? /* <th class="tb-center">Drivers</th> */ ?>
				<th>Status info</th>
				<th title="Restaurants">R</th>
				<th title="Auto closed">Auto</th>
				<th title="All restaurants">All</th>
				<th title="3rd party delivery restaurants">3rd</th>
				<th class="tb-small"></th>
			</tr>
		</table>
		<div class="tbody">
			<table class="tb-zebra">
				<tr ng-repeat="community in communities track by $index" ng-attr-tabindex="{{$index+1}}" tab-select="/community/{{community.permalink || community.id_community}}" ng-init="$last ? ngRepeatFinished() : null">
					<td>
						<span class="listview-bold">{{community.name}}</span>
						<br><span class="listview-smaller listview-light">{{community.timezone}}</span>
						<br>
						<span class="tag tag-empty tag-orange" ng-if="community.type == '3rd'">3rd</span>
						<span class="tag tag-empty tag-blue" ng-if="community.type == '1st'">1st</span>
						<span class="tag tag-empty tag-purple" ng-if="community.type == 'both'">Both</span>
						<span class="tag tag-empty tag-lightgrey" ng-if="community.type == 'none'">None</span>
						<span class="tag tag-empty tag-lightgrey" ng-if="community.type == 'takeout'">Takeout</span>
					</td>
					<? /* <td class="tb-center"><a href="/staff?limit=20&page=1&search={{community.name}}&type=driver&status=active&working=all&pexcard=all">{{community.drivers}}</a></td>*/ ?>
					<td>
						<span class="listview-smaller" ng-if="community.close_all_restaurants && community.is_auto_closed || community.close_3rd_party_delivery_restaurants">
							<span class="listview-bold">{{community.closedLog.closed_by}}</span> @ {{community.closedLog.closed_at}}<br>
							<span class="listview-bold">{{community.closedLog.type}}</span> {{community.closedLog.note}}
						</span>
						<span class="listview-smaller" ng-if="community.note && community.note.text">
							Last Note<span ng-if="community.note.added_by"> by {{community.note.added_by}}</span>: {{community.note.text}}
						</span>

						<? /*
						@todo: might be faster?
						<span ng-if="community.close_all_restaurants">
							All restaurants closed by {{community.close_all_restaurants_id_admin}} on {{community.close_all_restaurants_date}}<br>
							{{community.close_all_restaurants_note}}
						</span>
						<span ng-if="community.close_all_restaurants && community.close_3rd_party_delivery_restaurants">
							<br>
						</span>
						<span ng-if="community.close_3rd_party_delivery_restaurants == '1'">
							3rd party delivery restaurants closed by {{community.close_3rd_party_delivery_restaurants_id_admin}} on {{community.close_3rd_party_delivery_restaurants_date}}<br>
							{{community.close_3rd_party_delivery_restaurants_note}}
						</span>
						*/ ?>
					</td>
					<td class="tb-v-center">
						<a href="/restaurants?community={{community.id_community}}" class="listview-smaller">{{community.restaurants}}</a>
					</td>
					<td class="tb-v-center">
						<span class="tag tag-red" ng-if="community.is_auto_closed">Closed</span>
						<span class="tag tag-green" ng-if="!community.is_auto_closed">Open</span>
					</td>
					<td class="tb-v-center">
						<span class="tag tag-red" ng-if="community.close_all_restaurants">Closed</span>
						<span class="tag tag-green" ng-if="!community.close_all_restaurants">Open</span>
					</td>
					<td class="tb-v-center">
						<span class="tag tag-red" ng-if="community.close_3rd_party_delivery_restaurants">Closed</span>
						<span class="tag tag-green" ng-if="!community.close_3rd_party_delivery_restaurants">Open</span>
					</td>
					<td nowrap class="tb-v-center tb-right">
						<div>
							<a href ng-click="openClosingTimeContainer( community.permalink )"><button class="button button-small button-small button-empty button-green"><i class="fa fa-power-off"></i>&nbsp;&nbsp;Switch</button></a>
							<a href="/community/{{community.permalink || community.id_community}}"><button class="button button-small button-empty button-green"><i class="fa fa-eye"></i>&nbsp;&nbsp;View</button></a>
						</div>
					</td>
				</tr>
			</table>
		</div>
	</div>
</div>
