<div class="top-pad"></div>
<div class="driver-top-pad"></div>
<div class="content-padding">
	<div ng-show="oc.order.status.status != 'canceled' && oc.order.status.status != 'accepted' && oc.order.status.status != 'delivered' && oc.order.status.status != 'rejected' && oc.order.status.driver.id_admin == account.user.id_admin">
		<div ng-show="!text_customer_5_min_away_sending && !oc.order.hasCustomerBeenTexted5Minutes">
			<br><br>
			<button ng-click="oc.text_customer_5_min_away()" id="textCustomer5" class="ladda-button button orange-on-orange" data-color="orange" data-style="zoom-in"><span class="ladda-label">Text Customer I'm 5 Min Away</span></button>
		</div>
		<div ng-show="oc.order.hasCustomerBeenTexted5Minutes">
			<br><br>
			<div class="order-item-block-big">
				<div class="order-info2 order-info-small">
					&nbsp;&nbsp;&nbsp;You texted the customer you're 5 min away at {{oc.order.hasCustomerBeenTexted5Minutes}}
				</div>
			</div>
		</div>
	</div>
	<div class="header order-header hide-mobile">
		#{{oc.order.id_order}}
	</div>
	<div class="map">
		<br>
		<div class="info-block" ng-if="oc.order.status.status != 'delivered'">
			<div class="order-icon2"><i class="fa fa-clock-o"></i></div>
			<div class="order-info2 order-info-small">
				Ordered @ {{oc.order.date | convertimeformat:account.user.timezone:'h:mm a'}}.
					<span ng-if="!oc.order.preordered && oc.order._delivery_estimated_time"> Deliver by {{oc.order._delivery_estimated_time_timestamp | tsToHour}}</span>
					<span ng-if="oc.order.preordered && oc.order.preordered.date_delivery"> Pre-order. Expected Delivery {{oc.order.preordered.date_delivery}}.</span>
			</div>
		</div>
		<br>

		<div ng-click="openMap( 'route', oc.order.address, oc.order._restaurant_address );" ng-if="iOS">
			<div class="order-map" style="background: url('https://maps.googleapis.com/maps/api/staticmap?size=400x100&markers=color:green%7Clabel:A%7C{{oc.order.address | clearAddress}}&markers=color:red%7Clabel:B%7C{{oc.order._restaurant_lat}},{{oc.order._restaurant_lon}}&sensor=false&visual_refresh=true&scale=2');"></div>
		</div>
		<a href="http://maps.google.com/maps?daddr={{oc.order.address}}&saddr={{oc.order._restaurant_address}}" ng-if="!iOS" target="_system">
			<div class="order-map" style="background: url('https://maps.googleapis.com/maps/api/staticmap?size=400x100&markers=color:green%7Clabel:A%7C{{oc.order.address | clearAddress}}&markers=color:red%7Clabel:B%7C{{oc.order._restaurant_lat}},{{oc.order._restaurant_lon}}&sensor=false&visual_refresh=true&scale=2');"></div>
		</a>
		<div class="info-block">
			<div class="order-icon3"><i class="icon-chef"></i></div>
			<div class="order-info">
				<div class="info-name">{{oc.order._restaurant_name}}</div>
				<div class="info-phone"><a href="tel:+1{{oc.order._restaurant_phone}}" target="_system">{{oc.order._restaurant_phone | formatPhone}}</a></div>
				<div class="divider"></div>
				<div class="info-address"><p class="order-info-address">
					<div class="info-address-link" ng-click="openMap( 'query', oc.order._restaurant_address );" ng-if="iOS">
						<span>{{oc.order._restaurant_address}}</span>
					</div>
					<a class="info-address-link" href="http://maps.google.com/maps?q={{oc.order._restaurant_address}}" ng-if="!iOS" target="_system">
						<span>{{oc.order._restaurant_address}}</span>
					</a>
				</div>
			</div>
		</div>
		<div class="info-block">
			<div class="order-icon3"><i class="icon-user"></i></div>
			<div class="order-info">
				<div class="info-name">{{oc.order.name}}</div>
				<div class="info-phone"><a href ng-click="callText(oc.order.phone)">{{oc.order.phone | formatPhone}}</a></div>
				<div class="divider"></div>
				<div class="info-address"><p class="order-info-address">
					<div class="info-address-link" ng-click="openMap( 'query', oc.order.address );" ng-if="iOS">
						{{oc.order.address}}
					</div>
					<a class="info-address-link" href="http://maps.google.com/maps?q={{oc.order.address}}" ng-if="!iOS" target="_system">
						{{oc.order.address}}
					</a>
				</div>
			</div>
		</div>

	</div>
	<div class="order" ng-if="oc.order.status.status != 'canceled' && oc.order.status.status != 'rejected' && oc.order.status.driver.id_admin == account.user.id_admin">

		<div class="info-block">
			<div ng-repeat="resource in oc.order.resources" class="order-info-resource">
				<div class="order-icon3"><i class="fa fa-file"></i></div>
				<div class="order-info2 order-info-small">
					<a href="{{resource.path}}" target="_blank">{{resource.name}}</a>
				</div>
			</div>
		</div>

		<br><br>
		<? /*
		<div class="order-item-info">
			<div class="order-item-block left">
				<div class="order-icon" ng-if="oc.order.delivery_type=='takeout'"><i class="fa fa-taxi"></i></div>
				<div class="order-icon" ng-if="oc.order.delivery_type=='delivery'"><i class="fa fa-car"></i></div>
				<div class="order-info">
					<span ng-if="oc.order.delivery_type=='takeout'">Takeout</span>
					<span ng-if="oc.order.delivery_type=='delivery'">Delivery</span>
				</div>
			</div>
			<div class="order-item-block right">
				<div class="order-icon" ng-if="oc.order.pay_type=='card'"><i class="fa fa-credit-card"></i></div>
				<div class="order-icon" ng-if="oc.order.pay_type=='cash'"><i class="fa fa-money"></i></div>
				<div class="order-info">
					<span ng-if="oc.order.pay_type=='card'">Card</span>
					<span ng-if="oc.order.pay_type=='cash'">Cash</span>
				</div>
			</div>
			<div class="divider"></div>
			<div class="order-item-block left">
				<div class="order-icon"><i class="fa fa-clock-o"></i></div>
				<div class="order-info">
					Ordered @ {{oc.order.time_formated}}
				</div>
			</div>
			<div class="order-item-block right" ng-if="oc.order._delivery_estimated_time">
				<div class="order-icon"><i class="fa fa-heart"></i></div>
				<div class="order-info">
					<span ng-if="oc.order._delivery_estimated_time">Delivery expected by </br> {{oc.order._delivery_estimated_time}}</span>
					<span ng-if="!oc.order._delivery_estimated_time">None</span>
				</div>
			</div>
			<div class="divider"></div>
		</div>
		*/ ?>
		<span ng-if="oc.order.notes_to_driver">
			<div class="divider dots"></div>
			<div class="order-item-block-big">
				<div class="order-icon2"><i class="fa fa-exclamation"></i></div>
				<div class="order-info2 order-info-small">
					<span ng-bind-html="oc.order.notes_to_driver | linkfy"></span>
				</div>
			</div>
		</span>
		<div class="order-item-block-big background-{{oc.order._instructions_payment_bgcolor}}" ng-if="(oc.order.status.status == 'accepted') && oc.order.status.driver.id_admin == account.user.id_admin">
			<div class="order-icon2"><i class="fa fa-money"></i></div>
			<div class="order-info2 order-info-small">
				{{oc.order._instructions_payment}}
			</div>
		</div>
		<div class="order-item-block-big" ng-if="(oc.order.status.status == 'accepted') && oc.order.status.driver.id_admin == account.user.id_admin">
			<div class="order-icon2"><i class="fa fa-hand-o-right"></i></div>
			<div class="order-info2 order-info-small">
				{{oc.order._instructions_food}}
			</div>
		</div>

		<div class="order-item-block-big" ng-if="oc.order.campus_cash">
			<div class="order-icon2"><i class="fa fa-thumbs-o-up"></i></div>
			<div class="order-info2 order-info-small">
				<span ng-if="oc.order.campus_cash_name">
					{{oc.order.campus_cash_name}} Order
				</span>
				<span ng-if="!oc.order.campus_cash_name">
					Campus Cash Order
				</span>
			</div>
		</div>

		<span ng-if="oc.order._stealth_notification">
			<div class="order-item-block-bigger">
				Skip the line. Tell restaurant: <i>"I'm here to pick up a faxed order for {{oc.order.name}}, #{{oc.order.id_order}}</i>".
			</div>
			<div class="divider"></div>
			<div class="divider dots"></div>
		</span>
		<br>
		<div>
			<div class="order-contents">
				<table width="100%" celpadding="0" cellspacing="0" class="detail">
					<thead>
						<td class="topitem order-contents-item-qty">Qty</td>
						<td class="topitem itemname">Item</td>
						<td class="topitem itemname"></td>
						<td class="topitem itemprice">Store Price</td>
					</thead>
					<tbody>
						<tr ng-repeat="dish in oc.order._dishes_qty">
							<td nowrap="nowrap" class="fooditem order-contents-item-qty" ng-class="{ 'order-contents-item-qty-highlight': dish.quantity > 1 }">{{dish.quantity}}
							<span ng-if="dish.quantity > 1">x</span>
							</td>
							<td class="fooditem dish-name">
								<b>{{dish.name}}</b>
								<div ng-if="dish.options.select_options">{{dish.options.select_options}}</div>
								<div ng-if="dish.options.with_option"><i class="fa fa-plus-circle"></i> {{dish.options.with_option}}</div>
								<div ng-if="dish.options.without_default_options"><i class="fa fa-minus-circle"></i> {{dish.options.without_default_options}}</div>
							</td>
							<td class="fooditem dish-price-unity">
								<span ng-if="dish.quantity > 1">
									{{dish.quantity}} * ${{dish.price.regular_unity | formatPrice}}
								</span>
							</td>
							<td class="fooditem dish-price">
								${{dish.price.regular | formatPrice}}
							</td>
						</tr>
						<tr class="class">
							<td></td>
							<td>
								<span ng-show="oc.order.duplicated_items" class="order-contents-item-qty-highlight">
									Don't forget to check qty of each item
								</span>
							</td>
							<td class="dish-price">Subtotal</td>
							<td class="dish-price">
								${{oc.order.price | formatPrice}}
							</td>
						</tr>

						<tr class="class">
							<td></td>
							<td>Reminder: include napkins/straws/condiments as needed.</td>
							<td></td>
							<td></td>
						</tr>

						<tr ng-if="oc.order.notes">
							<td colspan="4" class="order-notes">
								<div class="order-item-block-big order-notes" ng-if="oc.order.notes">
									<div class="order-icon2"><i class="fa fa-bullhorn"></i></div>
									<div class="order-info2 order-info-small">
										<span ng-bind-html-unsafe="oc.order.notes | nl2br"></span>
									</div>
								</div>
							</td>
						</tr>
						<tr>
							<td colspan="4">
								<div class="dialog-message dialog-message-notice check-reminder" ng-if="oc.order.status.status != 'delivered' && oc.order.status.status != 'rejected' && oc.order.status.driver.id_admin == account.user.id_admin">
									<b>Double check</b> to make sure you received exactly the right food!
								</div>
							</td>
						</tr>


						<?php /*
						<!-- IN CASE WE NEED TO ADD THIS IN THE FUTURE
						<tr ng-if="oc.order._tip">
									<td></td>
									<td style="text-align:right; font-size:24px;color:#666;">Tip <span ng-if="oc.order.tip_type != 'number'"></span></td>
									<td style="text-align:right; font-size:24px;color:#666;">${{oc.order._tip | formatPrice}}</td>
						</tr>
						<tr ng-if="oc.order.delivery_fee">
									<td></td>
									<td style="text-align:right; font-size:24px;color:#666;">Delivery Fee</td>
									<td style="text-align:right; font-size:24px;color:#666;">${{oc.order.delivery_fee | formatPrice}}</td>
						</tr>
						<tr ng-if="oc.order.service_fee">
									<td></td>
									<td style="text-align:right">Service Fee</td>
									<td>${{oc.order.service_fee | formatPrice}}</td>
									<php if( $isDriverCockpit ) {  />
								</tr>
							-->
							*/ ?>
							<tr>
								<td></td>
								<td></td>
								<td class="dish-price">Tax</td>
								<td class="dish-price">
									${{oc.order._tax | formatPrice}}
								</td>
							</tr>
							<tr class="order-total-row">
								<td></td>
								<td></td>
								<td class="order-total-text" ng-if="oc.order.pay_type=='card'">Total</td>
								<td class="order-total-text" nowrap="" ng-if="oc.order.pay_type=='cash'">Store Total</td>
								<td class="dish-price order-total-text">
									${{oc.order._final_price | formatPrice}}
								</td>
							</tr>
						</tbody>
					</table>
				</div>
			</div>


			<div ng-class="oc.order.pay_type=='cash' ? 'order-item-block-big' : 'info-block'">
				<div class="order-icon2">
					<i class="fa fa-money" ng-if="oc.order.pay_type=='cash'"></i>
					<i class="fa fa-credit-card" ng-if="oc.order.pay_type=='card'"></i>
				</div>
				<div class="order-info2 order-info-small">
					<span ng-if="oc.order.pay_type == 'card' && oc.order.campus_cash">
						REQUIRED to visually inspect student ID card to confirm person in possession of card is person pictured on ID when dropping off food.
					</span>
					<span ng-if="oc.order.pay_type == 'card' && !oc.order.campus_cash">Customer is paying by card</span>
					<span ng-if="oc.order.pay_type == 'cash'">Customer is paying by cash</span>
				</div>
			</div>
			<div class="info-block" ng-if="oc.order._instructions_fax">
				<div class="order-icon2"><i class="fa fa-exclamation-triangle"></i></div>
				<div class="order-info2 order-info-small">
					{{oc.order._instructions_fax}}
				</div>
			</div>
			<div class="info-block">
				<div class="order-icon2">
					<i class="fa fa-smile-o"></i>
				</div>
				<div class="order-info2 order-info-small" ng-show="oc.order.orders_by_phone <= 1">
					New customer so create a great first experience!
				</div>
				<div class="order-info2 order-info-small" ng-show="oc.order.orders_by_phone > 1">
					Return customer (placed {{oc.order.orders_by_phone}} orders), so treat 'em nice!
				</div>
			</div>
			<div class="customer-total-block total-block" ng-show="oc.order.pay_type=='cash'">
				<span class="order-total-price">
					<div class="order-total-block-tip-title">Customer Owes</div>
					<span class="tip-total-price-dollar">$</span>{{oc.order.final_price_plus_delivery_markup | formatPrice}}
				</span>
				</br>
			</div>
			<? /*
			<div class="tip-total-block">
				<?//SAME CSS CONFIGURATION ?>
				<span class="tip-total-price">${{driverTake.total | formatPrice}}</span></br></br>
				<span class="tip-total-text"><strong>Your take (fee+tip)</strong></span>
				</br>
			</div>
			*/ ?>
			<div class="tip-total-block total-block" ng-if="account.user.show_credit_card_tips || ( oc.order._tip_with_cash || oc.order._tip == '0.00' )">

				<div ng-if="oc.order.pay_type=='cash' && ( oc.order._tip_with_cash || oc.order._tip == 0 )" class="order-total-block-tip">
					For bigger tips, we suggest saying when the customer asks how much it is, <br>"${{oc.order.final_price_plus_delivery_markup | formatPrice}}, not including tip" and flash them your best smile!
				</div>

				<span class="order-total-price" ng-if="oc.order.pay_type=='card'">
					<span ng-if="oc.order._tip_with_cash || oc.order._tip == 0">CASH</span>
					<span ng-if="!oc.order._tip_with_cash && oc.order._tip != 0"><span class="tip-total-price-dollar">$</span>{{oc.order._tip | formatPrice}}</span>
				</span>
				<span ng-if="oc.order.pay_type=='card'"></br></br></span>
				<span class="order-total-block-text" ng-if="oc.order.pay_type=='card'">Tip</span>
				</br>
			</div>
			<div class="divider"></div><br><br><br>

			<div ng-switch="randomFooter">
				<div ng-switch-when="0">
					<div class="order-info2 order-info-small">
						If prices in store or ANY little menu details differ from what it says above, plz let us know!<br>
						Just email your receipt and the order number and a pic of the menu to <a target="_system" href="mailto:menus@crunchbutton.com">menus@crunchbutton.com</a>.<br>
						1 in 3 menu updates will earn you a random $ amount bonus ;)
					</div>
				</div>
				<div ng-switch-when="1">
					<div class="order-info2 order-info-small">
						Got any tips for other drivers to deliver faster from this restaurant? <br>
						Faster parking nearby, calling in orders, skipping lines, etc?<br>
						Just email your ideas and the restaurant name to <a target="_system" href="mailto:faster@crunchbutton.com">faster@crunchbutton.com</a><br>
						1 in 3 suggestions will earn you a random $ amount bonus ;)
					</div>
				</div>
			</div>
	</div>
			<div ng-if="oc.order.status.status != 'canceled' && account.user.permissions['COMMUNITY-CS']">
				<br><br>
				<button ng-click="oc.cancel_order()" id="cancelOrder" class="button orange-on-orange">Cancel Order</span></button>
				<br><br>
		</div>
</div>

<div class="driver-cancel-order-container zoom-anim-dialog mfp-hide dialog">
	<div ng-controller="DriverCancelOrder">
		<h2 class="title left"><span>Cancel Order #: {{order.id_order}}</span></h2>
		<div class="divider"></div>
		<form name="formCancel" novalidate>
			<ul ng-class="{'submitted':formCancelSubmitted}" class="ul-inputs">
				<li class="li-input" ng-class="{'error':formCancel.message.$invalid}">
					<div class="label">Please write an apology message that'll get texted to the customer when the order is canceled:</div>
					<div class="input">
						<div class="input"><input type="text" name="message" ng-model="order.message" required placeholder=""></div>
					</div>
					<div class="box-error">
						<small ng-show="formCancel.message.$error.required">Required.</small>
					</div>
				</li>
				<li class="li-input" ng-show="!isCancelling">
					<button class="button save" ng-click="cancel_order();">Send message and cancel order</button>
				</li>
				<li class="li-input" ng-show="isCancelling">
					<button class="button save"><i class="fa fa-spinner fa-spin"></i> Canceling </button>
				</li>
			</ul>
		</form>
	</div>
</div>
