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

<div class="content-padding">


	<div class="support-boxes">


		<div class="support-box-wrap box-content2">
			<br>
			<div class="no-box-content-color customer-content-box">
				<div class="restaurant-image-button-wrap">
					<div class="restaurant-image-upload-button" restaurant-image-upload id_restaurant="{{id_restaurant}}">
						<button class="ladda-button ladda-button-nohover button button-empty button-small button-green" data-color="" data-style="zoom-in"><span class="ladda-label"><i class="fa fa-image"></i>&nbsp;&nbsp;Upload Image</span></button>
						<input ng-if="init" type="file" nv-file-select="" uploader="uploader" name="file" class="file file-hidden">
					</div>
				</div>

				<a href="{{restaurant.images.original}}" target="_blank">
					<div class="customer-image-crop customer-image-crop-large customer-image-updater restaurant-image-updater">
						<img ng-if="restaurant.image" class="customer-image-large" hasImage="{{ restaurant.images.thumb != '' }}" src="{{restaurant.images.thumb}}" id="restaurant-image-thumb"></img>
						<div ng-if="!restaurant.image" class="customer-image-large restaurant-image-null"></div>
					</div>
				</a>

				<h1 class="customer-name-large">{{restaurant.name}}</h1>
				<br><br>
					<div class="double-cols" ng-if="!account.user.isCommunityDirector">
						<a href="/tools/fax?id_restaurant={{restaurant.id_restaurant}}&fax={{restaurant.fax}}" class="button button-empty button-border button-orange">
							<i class="fa fa-fax"></i>&nbsp;&nbsp;Send a Fax
						</a>
						<button  ng-click="callText(restaurant.phone)" class="button button-empty button-border button-blue"><i class="fa fa-phone"></i>&nbsp;&nbsp;Call / Text</button>
				</div>
			</div>
		</div>

		<div class="support-box-wrap box-content2">
			<div class="support-box-wrap-header">
				<h1>Payment Info</h1>
				<div class="support-box-header-actions-wrap">
					<div class="support-box-header-actions" ng-if="!account.user.isCommunityDirector">
						<a href="/restaurant/payment-info/{{restaurant.permalink}}"><button class="button button-small button-empty button-green"><i class="fa fa-pencil"></i>&nbsp;&nbsp;Edit</button></a>
					</div>
				</div>
				<div class="divider"></div>
			</div>

			<div class="no-box-content-color">
				<div class="field-container">
					<div class="field-row">
						<div class="field-key">Balanced</div>
						<div class="field-value">
							<span class="tag tag-green" ng-if="restaurant.payment_type.balanced_bank && restaurant.payment_type.balanced_id">Yes</span>
							<span class="tag tag-red" ng-if="!restaurant.payment_type.balanced_bank || !restaurant.payment_type.balanced_id">No</span>
						</div>
					</div>
					<div class="field-row">
						<div class="field-key">Stripe</div>
						<div class="field-value">
							<span class="tag tag-green" ng-if="restaurant.payment_type.stripe_id && restaurant.payment_type.stripe_account_id">Yes</span>
							<span class="tag tag-red" ng-if="!restaurant.payment_type.stripe_id || !restaurant.payment_type.stripe_account_id">No</span>
						</div>
					</div>
				</div>
			</div>
		</div>

		<br><br>

		<div class="support-box-wrap box-content2">
			<div class="support-box-wrap-header">
				<h1>Details</h1>
				<div class="support-box-header-actions-wrap">
					<div class="support-box-header-actions">
						<a href="/restaurant/edit/{{restaurant.permalink}}"><button class="button button-small button-empty button-green"><i class="fa fa-pencil"></i>&nbsp;&nbsp;Edit</button></a>
					</div>
				</div>
				<div class="divider"></div>
			</div>

			<div class="no-box-content-color">

				<div class="field-container">
					<div class="field-row">
						<div class="field-key">Phone</div>
						<div class="field-value"><a href ng-click="callText(restaurant.phone)">{{restaurant.phone | formatPhone}}</a></div>
					</div>
					<div class="field-row">
						<div class="field-key">Address</div>
						<div class="field-value"><a href ng-click="routeAddress(restaurant.address)">{{restaurant.address}}</a></div>
					</div>

					<div class="field-row">
						<div class="field-key">Status</div>
						<div class="field-value">
							<span class="tag tag-green" ng-if="restaurant.active">Active</span>
							<span class="tag tag-red" ng-if="!restaurant.active">Inactive</span>
						</div>
					</div>
					<div class="field-row">
						<div class="field-key">Open</div>
						<div class="field-value">
							<span class="tag tag-red" ng-if="!restaurant.open_for_business">Closed</span>
								<span ng-if="restaurant.open_for_business">
								<span class="tag tag-green" ng-if="restaurant.open">Open</span>
								<span class="tag tag-red" ng-if="!restaurant.open">Closed</span>
							</span>
						</div>
					</div>


					<div class="field-row">
						<div class="field-key">Type</div>
						<div class="field-value">
							<span class="tag tag-orange" ng-if="restaurant.delivery && restaurant.delivery_service">3rd</span>
							<span class="tag tag-blue" ng-if="restaurant.delivery && !restaurant.delivery_service">1st</span>
							<span class="tag tag-lightgrey" ng-if="restaurant.takeout && !restaurant.delivery">Takeout</span>
							<span class="tag tag-lightgrey" ng-if="!restaurant.takeout && !restaurant.delivery">None</span>
						</div>
					</div>
					<div class="field-row">
						<div class="field-key">Relationship</div>
						<div class="field-value">
							<span class="tag tag-purple" ng-if="restaurant.formal_relationship">Formal</span>
							<span class="tag tag-grey" ng-if="!restaurant.formal_relationship">Informal</span>
						</div>
					</div>
					<div class="field-row">
						<div class="field-key">Notification Sent</div>
						<div class="field-value">
							<span class="tag tag-green" ng-if="restaurant.order_notifications_sent">Yes</span>
							<span class="tag tag-red" ng-if="!restaurant.order_notifications_sent">No</span>
						</div>
					</div>
					<div class="field-row">
						<div class="field-key">Community</div>
						<div class="field-value">
							<a href="/community/{{restaurant.id_community}}">{{restaurant.community}}</a>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
	<div class="page-title-nav">
		<a href="/orders?restaurant={{restaurant.id_restaurant}}"><button class="button button-green nav-button-green">View all orders</button></a>
	</div>
	<h1 class="title"><i class="fa fa-car"></i>Orders</h1>


	<div class="bar-loader bar-loader-title" ng-class="{'bar-loader-loading': loadingOrders}"></div>
	<div class="box-content2 box-content-table">
		<table class="tb-zebra">
			<tr>
				<th>Info</th>
				<th>Date</th>
				<th>Restaurant</th>
				<th>Driver</th>
				<th>Order</th>
				<th>Status</th>
			</tr>
			<tr ng-repeat="order in orders">
				<td><a href="/order/{{order.id_order}}">{{order.id_order}}</td>
				<td>{{order.date | localtime | timestamp | date:'MM/dd @ HH:mm'}}</td>
				<td>
					<a href="/restaurant/{{order.id_restaurant}}">{{order._restaurant_name}}</a><br>
					<a href="/community/{{order._community_name}}">{{order._community_name}}</a>
				</td>
				<td><a href="/staff/{{order.status.driver.id_admin}}">{{order.status.driver.name}}</a></td>
				<td>${{order.final_price_plus_delivery_markup}}</td>
				<td>
					<b>{{order.status.status}}</b><br>
					<span ng-if="order.status"><span am-time-ago="order.status.date | localtime | timestamp"></span></span>
				</td>
			</tr>
		</table>
	</div>

	<table class="tb-pagination right" ng-if="pages > 1" page-key>
		<tbody>
			<tr>
				<td class="td-prev"><button class="button orange" ng-if="query.page > 1" ng-click="setPage(query.page-1)">prev</button></td>
				<td class="td-info">Page {{query.page}} of {{pages}}</td>
				<td class="td-next"><button class="button orange" ng-if="query.page < pages" ng-click="setPage(query.page+1)">next</button></td>
			</tr>
		</tbody>
	</table>

	<div class="divider"></div>

	<? /*
	<div class="support-box-wrap box-content2">
		<div class="support-box-wrap-header">
			<h1>Location</h1>
			<div class="support-box-header-actions-wrap">
				<div class="support-box-header-actions">
					<span class="tag tag-red">BETA</span>
				</div>
			</div>
			<div class="divider"></div>
		</div>

		<map zoom="12" center="false" class="maps-map" map-type-control="false" style="height: 230px;" options="{streetViewControl: false}"></map>
	</div>
	*/ ?>


</div>
