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

<div class="content-padding">

	<h1 class="title box-title"><i class="fa fa-slideshare"></i>{{community.name}}</h1>
	<div class="divider"></div>
	<div class="bar-loader bar-loader-search bar-loader-boxes-top" ng-class="{'bar-loader-loading': loading}"></div>

	<div class="support-boxes">

		<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="/community/edit/{{community.permalink}}"><button class="button button-small 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">Name</div>
						<div class="field-value">{{community.name}}<span ng-if="community.name_alt && community.name_alt != community.name"> / {{community.name_alt}}</span></div>
					</div>
					<div class="field-row">
						<div class="field-key">Permalink</div>
						<div class="field-value">{{community.permalink}}</div>
					</div>
					<div class="field-row">
						<div class="field-key">Active</div>
						<div class="field-value">
							<span class="tag tag-red" ng-if="!community.active">Inactive</span>
							<span class="tag tag-green" ng-if="community.active">Active</span>
						</div>
					</div>
					<div class="field-row">
						<div class="field-key">Status</div>
						<div class="field-value">
							<span class="tag tag-red" ng-if="community.close_all_restaurants && community.is_auto_closed || community.close_3rd_party_delivery_restaurants">Closed</span>
							<span class="tag tag-green" ng-if="!community.close_all_restaurants && !community.is_auto_closed  && !community.close_3rd_party_delivery_restaurants">Open</span>
						</div>
					</div>
					<div class="field-row">
						<div class="field-key">Autoclose</div>
						<div class="field-value">
							<span class="tag tag-green" ng-if="community.auto_close">Enabled</span>
							<span class="tag tag-red" ng-if="!community.auto_close">Disabled</span>
						</div>
					</div>
					<div class="field-row">
						<div class="field-key">Ask drivers to check in</div>
						<div class="field-value">
							<span class="tag tag-green" ng-if="community.driver_checkin">Yes</span>
							<span class="tag tag-red" ng-if="!community.driver_checkin">No</span>
						</div>
					</div>
					<div class="field-row">
						<div class="field-key">Type</div>
						<div class="field-value">
							<span class="tag tag-orange" ng-if="community.type == '3rd'">3rd</span>
							<span class="tag tag-blue" ng-if="community.type == '1st'">1st</span>
							<span class="tag tag-purple" ng-if="community.type == 'both'">Both</span>
							<span class="tag tag-lightgrey" ng-if="community.type == 'none'">None</span>
							<span class="tag tag-lightgrey" ng-if="community.type == 'takeout'">Takeout</span>
						</div>
					</div>

					<div class="field-row">
						<div class="field-key">Timezone</div>
						<div class="field-value">{{community.timezone}}</div>
					</div>

				</div>
			</div>
		</div>

		<div class="support-box-wrap box-content2">
			<div class="support-box-wrap-header">
				<h1>Status</h1>
				<div class="support-box-header-actions-wrap">
					<div class="support-box-header-actions">
						<a href ng-click="openClosingTimeContainer()"><button class="button button-small button-small button-empty button-green"><i class="fa fa-power-off"></i>&nbsp;&nbsp;Switch</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">Is Auto Closed</div>
						<div class="field-value">
							<span class="tag tag-red" ng-if="community.is_auto_closed">Yes</span>
							<span class="tag tag-green" ng-if="!community.is_auto_closed">No</span>
						</div>
					</div>
					<div class="field-row">
						<div class="field-key">All Restaurants</div>
						<div class="field-value">
							<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>
						</div>
					</div>
					<div class="field-row" ng-if="community.close_all_restaurants">
						<div class="field-key">Closed by</div>
						<div class="field-value">{{community.close_all_restaurants_admin}}</div>
					</div>
					<div class="field-row" ng-if="community.close_all_restaurants">
						<div class="field-key">Closed at</div>
						<div class="field-value">{{community.close_all_restaurants_date}}</div>
					</div>
					<div class="field-row" ng-if="community.close_all_restaurants">
						<div class="field-key">Message</div>
						<div class="field-value">{{community.close_all_restaurants_note}}</div>
					</div>

					<div class="field-row" ng-if="community.reopen_at_formated">
						<div class="field-key">Will remove force close at</div>
						<div class="field-value">{{community.reopen_at_formated}}</div>
					</div>

					<div class="field-row">
						<div class="field-key">3rd Party Restaurants</div>
						<div class="field-value">
							<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>
						</div>
					</div>
					<div class="field-row" ng-if="community.close_3rd_party_delivery_restaurants">
						<div class="field-key">Closed by</div>
						<div class="field-value">{{community.close_3rd_party_delivery_restaurants_admin}}</div>
					</div>
					<div class="field-row" ng-if="community.close_3rd_party_delivery_restaurants">
						<div class="field-key">Closed at</div>
						<div class="field-value">{{community.close_3rd_party_delivery_restaurants_date}}</div>
					</div>
					<div class="field-row" ng-if="community.close_3rd_party_delivery_restaurants">
						<div class="field-key">Message</div>
						<div class="field-value">{{community.close_3rd_party_delivery_restaurants_note}}</div>
					</div>


					<div class="field-row" ng-if="community.dont_warn_till_formated">
						<div class="field-key">Don't warn CS till</div>
						<div class="field-value">{{community.dont_warn_till_formated}}</div>
					</div>

					<div class="field-row">
						<div class="field-key" title="Combine Restaurant and Driver's Shift Hours">Combine hours</div>
						<div class="field-value">
							<span class="tag tag-green" ng-if="community.combine_restaurant_driver_hours">Yes</span>
							<span class="tag tag-red" ng-if="!community.combine_restaurant_driver_hours">No</span>
						</div>
					</div>

					<div class="field-row">
						<div class="field-key">Can be opened by drivers</div>
						<div class="field-value">
							<span class="tag tag-green" ng-if="community.drivers_can_open">Yes</span>
							<span class="tag tag-red" ng-if="!community.drivers_can_open">No</span>
						</div>
					</div>

					<div class="field-row">
						<div class="field-key" title="Change driver restaurant name automatically based on assigned shifts">Auto restaurant name change</div>
						<div class="field-value">
							<span class="tag tag-green" ng-if="community.automatic_driver_restaurant_name">Yes</span>
							<span class="tag tag-red" ng-if="!community.automatic_driver_restaurant_name">No</span>
						</div>
					</div>

					<div class="field-row">
						<div class="field-key">
							<a href="/shifts/schedule/?communities={{community.id_community}}">View current shifts</a>
						</div>
						<div class="field-value">
						</div>
					</div>

				</div>
			</div>
		</div>

	</div>
</div>
<div class="content-padding">
<? /*
	<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 class="no-box-content-color">
			<div class="field-container">
				<div class="field-row">
					<div class="field-key">Latitude, Longitude</div>
					<div class="field-value">{{community.loc_lat}}, {{community.loc_lon}}</div>
				</div>
			</div>
		</div>
	</div>
	*/?>

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

	<!-- ui-tab directive -->
	<ui-tabs ng-if="!loading">
		<ui-tab title="Orders" icon="car" default="true" id="orders" path="/assets/view/communities-community-tab-orders.html" method="loadOrders"></ui-tab>
		<ui-tab title="Restaurants" icon="coffee" id="restaurants" path="/assets/view/communities-community-tab-restaurants.html" method="loadRestaurants"></ui-tab>
		<ui-tab title="Drivers" icon="road" id="drivers" path="/assets/view/communities-community-tab-drivers.html" method="loadDrivers"></ui-tab>
		<ui-tab title="Broadcast" icon="mobile" id="sms_drivers" path="/assets/view/communities-community-tab-sms-drivers.html" method="loadDriversSMS"></ui-tab>
		<ui-tab title="Aliases" icon="link" id="aliases" path="/assets/view/communities-community-tab-aliases.html" method="loadAliases"></ui-tab>
		<ui-tab title="Status" id="logs" icon="power-off" path="/assets/view/communities-community-tab-logs.html" method="loadLogs"></ui-tab>
		<ui-tab title="Notes" id="notes" icon="file" path="/assets/view/communities-community-tab-notes.html" method="loadNotes"></ui-tab>
	</ui-tabs>


	<ng-include src="'/assets/view/communities-community-open-close-form.html'"></ng-include>

	<!-- alias form -->
	<div class="alias-dialog-container zoom-anim-dialog mfp-hide dialog">
		<h1 ng-bind="alertTitle" ng-show="alertTitle"></h1>
		<div>

			<h2 class="title left"><span>Aliases</span></h2>

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

			<ng-form name="formAlias">

				<div class="ul-inputs">

					<ul ng-class="{'submitted':formAliasSubmitted}" class="box-content2">

						<li class="li-input" ng-class="{'error':formAlias.aliasAlias.$invalid}">
							<div class="label">Alias:</div>
							<div class="input"><input type="text" name="aliasAlias" ng-model="alias.alias" required placeholder="Alias"></div>
							<div class="box-error">
								<small ng-show="formAlias.aliasAlias.$error.required">Required.</small>
							</div>
							<div>Must be entered as all lowercase letters, or it won't work for customers!</div>
						</li>

						<li class="li-input" ng-class="{'error':formAlias.aliasNameAlt.$invalid}">
							<div class="label">Alternative name:</div>
							<div class="input"><input type="text" name="aliasNameAlt" ng-model="alias.name_alt" required placeholder="Alternative name"></div>
							<div class="box-error">
								<small ng-show="formAlias.aliasNameAlt.$error.required">Required.</small>
							</div>
						</li>

						<li class="li-input" ng-class="{'error':formAlias.aliasPrep.$invalid}">
							<div class="label">Preposition (at, in, etc. e.g. "the best delivery at Yale"):</div>
							<div class="input"><input type="text" name="aliasPrep" ng-model="alias.prep" required placeholder="Preposition"></div>
							<div class="box-error">
								<small ng-show="formAlias.aliasPrep.$error.required">Required.</small>
							</div>
						</li>

						<li class="li-input" ng-class="{'error':formAlias.aliasTop.$invalid}">
							<div class="label">Display Location after preposition on Community Error Page? (only do this for one alias per community, and only when community has launched):</div>
							<div class="input">
								<select name="aliasTop" ng-model="alias.top" ng-options="opt.value as opt.label for opt in yesNo" ></select>
							</div>
							<div class="box-error">
								<small ng-show="formAlias.aliasTop.$error.required">Required.</small>
							</div>
						</li>

						<li class="li-input" ng-class="{'error':formAlias.aliasSort.$invalid}" ng-show="alias.top">
							<div class="label">Sort:</div>
							<div class="input">
								<input type="number" ignore-mouse-wheel name="aliasSort" ng-model="alias.sort" ng-required="alias.top">
							</div>
							<div class="box-error">
								<small ng-show="formAlias.aliasSort.$error.required">Required.</small>
							</div>
						</li>

						<li class="li-input" ng-show="!isSavingAlias">
							<button class="button green" ng-click="aliasAdd();">Add</button>
						</li>
						<li class="li-input" ng-show="isSavingAlias">
							<i class="fa fa-circle-o-notch fa-spin"></i>
						</li>
					</ul>

				</div>
			</ng-form>

		</div>
		<p ng-bind-html-unsafe="message" class="small-message"></p>
	</div>

</div>
