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

<div class="content-padding">

	<h1 class="title box-title"><i class="fa fa-user"></i>{{staff.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>Info</h1>

				<div class="support-box-header-actions-wrap">
					<div class="support-box-header-actions">
						<a ng-if="isCommunityDirector && !staff.isDriver" href="/staff/community-director/{{staff.login}}"><button class="button button-small button-empty button-green"><i class="fa fa-hand-paper-o"></i>&nbsp;&nbsp;Edit</button></a>
						<a ng-if="staff.login" href ng-click="openStaffNoteContainer(staff.id_admin)"><button class="button button-small button-empty button-green"><i class="fa fa-file"></i>&nbsp;&nbsp;Add Note</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">{{staff.name}}</div>
					</div>
					<div class="field-row" ng-if="isCommunityDirector && !staff.isDriver">
						<div class="field-key">Community Director</div>
						<div class="field-value"><span class="tag tag-green">Community Director</span></div>
					</div>
					<div class="field-row">
						<div class="field-key">Phone</div>
						<div class="field-value"><a href ng-click="callText(staff.phone)">{{staff.phone | formatPhone}}</a></div>
					</div>
					<div class="field-row">
						<div class="field-key">Email</div>
						<div class="field-value"><a target="_system" href="mailto:{{staff.email}}">{{staff.email}}</a></div>
					</div>
					<div class="field-row">
						<div class="field-key">Login</div>
						<div class="field-value">{{staff.login}}</div>
					</div>
					<div class="field-row">
						<div class="field-key">Timezone</div>
						<div class="field-value">{{staff.timezone}}</div>
					</div>
					<div class="field-row" ng-if="staff.note.text">
						<div class="field-key">Last Note</div>
						<div class="field-value">
							<a href="/staff/notes?limit=20&page=1&fullcount=false&search=&admin={{staff.id_admin}}">
								{{staff.note.text}}
							</a>
						</div>
					</div>
					<div class="field-row">
						<div class="field-key">Active</div>
						<div class="field-value">
							<label class="switch-wrap">
								<input type="checkbox" ng-change="change_status();" class="switch" ng-model="staff.active"/><div></div>
							</label>
						</div>
					</div>
					<div class="field-row" ng-if="staff.isDriver">
						<div class="field-key">Community Director</div>
						<div class="field-value">
							<label class="switch-wrap">
								<input type="checkbox" ng-change="makeCommunityDirector();" class="switch" ng-model="isCommunityDirector"/><div></div>
							</label>
						</div>
					</div>
					<div class="field-row" ng-if="staff.created_at">
						<div class="field-key">Created At</div>
						<div class="field-value">
							{{staff.created_at.date}}
						</div>
					</div>
					<div class="field-row" ng-if="staff.date_terminated_formatted">
						<div class="field-key">Inactive since</div>
						<div class="field-value">{{staff.date_terminated_formatted}}</div>
					</div>
					<div class="field-row">
						<div class="field-key">Address</div>
						<div class="field-value">
							{{staff.address}}
						</div>
					</div>
					<div class="field-row" ng-if="!account.user.isCommunityDirector">
						<div class="field-key">Twilio Logs</div>
						<div class="field-value">
							<a target="_blank" href="https://www.twilio.com/user/account/messaging/logs?startDate=&endDate=&fromNumber=&toNumber={{staff.phone}}">Texts</a> |
							<a target="_blank" href="https://www.twilio.com/user/account/log/calls?startDate=&endDate=&fromNumber=&toNumber={{staff.phone}}&callStatus=all">Calls</a>
						</div>
					</div>
				</div>

				<br><br>
				<div class="tripple-cols" ng-if="staff.login && !account.user.isCommunityDirector">

					<a href="/settlement/list?limit=20&page=1&fullcount=false&search=&type=driver&status=0&payment_type=0&date=&id_driver={{staff.id_admin}}" class="button button-empty button-border button-orange"><i class="fa fa-university"></i>&nbsp;&nbsp;Payments</a>

					<a href="/settlement/drivers/payment/arbitrary/{{staff.id_admin}}" class="button button-empty button-border button-green"><i class="fa fa-money"></i>&nbsp;&nbsp;Pay</a>

					<button ng-click="chat();" class="button button-empty button-border button-blue"><i class="fa fa-comment"></i>&nbsp;&nbsp;Chat</button>

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

		<div class="support-box-wrap box-content2" ng-if="staff.isMarketingRep || staff.isDriver && staff.login">
			<div class="support-box-wrap-header">
				<h1>
					<span ng-if="staff.isDriver">Driver Info</span>
					<span ng-if="staff.isMarketingRep">Brand Representative</span>
				</h1>
				<div class="support-box-header-actions-wrap">
					<div class="support-box-header-actions">
						<a ng-if="staff.isDriver" href="/drivers/onboarding/{{staff.login}}"><button class="button button-small button-empty button-green"><i class="fa fa-automobile"></i>&nbsp;&nbsp;Edit Driver</button></a>
						<a ng-if="staff.isMarketingRep" href="/staff/marketing/{{staff.login}}"><button class="button button-small button-empty button-green"><i class="fa fa-paper-plane-o"></i></i>&nbsp;&nbsp;Edit Brand Representative</button></a>
					</div>
				</div>
				<div class="divider"></div>
			</div>


			<div class="no-box-content-color">
				<div class="field-container">
					<div class="field-row" ng-if="staff.isDriver">
						<div class="field-key">Communities</div>
						<div class="field-value">
							<span class="staff-community-repeat" ng-repeat="community in staff.communities">
								{{community}}
							</span>
							&nbsp;&nbsp;&nbsp;&nbsp;<span class="link orange" ng-click="assignCommunities()"><i class="fa fa-plus-circle"></i></span>
						</div>
					</div>
					<div class="field-row">
						<div class="field-key">Orders</div>
						<div class="field-value">
							<a href="/orders?driver={{staff.id_admin}}">{{staff.orders}}</a>
						</div>
					</div>
					<div class="field-row" ng-if="staff.isDriver">
						<div class="field-key">Vehicle</div>
						<div class="field-value">
							<span class="tag tag-orange" ng-if="staff.vehicle == 'car'">Car</span>
							<span class="tag tag-purple" ng-if="staff.vehicle == 'bike'">Bike</span>
							<span class="tag tag-darkgreen" ng-if="staff.vehicle == 'rollerblades'">Rollerblades</span>
							<span class="tag tag-lightblue" ng-if="staff.vehicle == 'rickshaw'">Rickshaw</span>
							<span class="tag tag-yellow" ng-if="staff.vehicle == 'skateboard'">Skateboard</span>
							<span class="tag tag-grey" ng-if="!staff.vehicle">None</span>
						</div>
					</div>
					<div class="field-row">
						<div class="field-key">Is Community Manager</div>
						<div class="field-value">
							<span class="tag tag-green" ng-if="staff.isCampusManager">Yes</span>
							<span class="tag tag-red" ng-if="!staff.isCampusManager">No</span>
						</div>
					</div>
					<div class="field-row">
						<div class="field-key">Referral Code</div>
						<div class="field-value">
							{{staff.invite_code}}
						</div>
					</div>
					<div class="field-row">
						<div class="field-key">Pay for new customers?</div>
						<div class="field-value">
							<span class="tag tag-green" ng-if="staff.pay_for_new_customer">Yes</span>
							<span class="tag tag-red" ng-if="!staff.pay_for_new_customer">No</span>
						</div>
					</div>
					<div class="field-row">
						<div class="field-key">How much per referral</div>
						<div class="field-value">
							${{staff.referral_admin_credit | formatPrice}}
						</div>
					</div>
					<div class="field-row">
						<div class="field-key">Activations</div>
						<div class="field-value">
							{{staff.referral_total || 0}}
						</div>
					</div>
					<div class="field-row">
						<div class="field-key">Activations in past week</div>
						<div class="field-value">
							{{staff.referral_total_last_week || 0}}
						</div>
					</div>
					<div class="field-row">
						<div class="field-key">Credit amount to customer</div>
						<div class="field-value">
							${{staff.referral_customer_credit | formatPrice}}
						</div>
					</div>
					<div class="field-row">
						<div class="field-key">Notify off schedule</div>
						<div class="field-value">
							<span class="tag tag-green" ng-if="staff.down_to_help_out">Yes</span>
							<span class="tag tag-red" ng-if="!staff.down_to_help_out">No</span>
						</div>
					</div>
					<div class="field-row" ng-if="staff.down_to_help_out">
						<div class="field-key">Notify off for today</div>
						<div class="field-value">
							<label class="switch-wrap">
								<input type="checkbox" ng-change="change_down_to_help_notifications();" class="switch" ng-model="staff.down_to_help_out_turn_off_notifications"/><div></div>
							</label>
						</div>
					</div>
				</div>
			</div>
		</div>

		<div class="support-box-wrap box-content2">
			<a name="deliveryBasics" class="mobile-anchor"></a>
			<div class="support-box-wrap-header">
				<h1>Note</h1>
				<div class="support-box-header-actions-wrap" ng-if="staff.login">
					<div class="support-box-header-actions">
						<button ng-click="openStaffNoteContainer(staff.id_admin);" class="button button-small button-empty button-green"><i class="fa fa-pencil"></i></i>&nbsp;&nbsp;Edit</button></a>

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

			<div class="no-box-content-color">
				<br>
				<p>
					{{staff.note.text}}
				</p>

			</div>
		</div>

<!-- aqui -->
		<div class="support-box-wrap box-content2" ng-if="staff.login">
			<div class="support-box-wrap-header">
				<h1>Permissions</h1>
				<div class="support-box-header-actions-wrap">
					<div class="support-box-header-actions" ng-if="!account.user.isCommunityDirector">
						<a href="/permission/staff/{{staff.login}}"><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">Groups</div>
						<div class="field-value">
							<span class="staff-community-repeat" ng-repeat="group in staff.groups_description">
								{{group}}
							</span>
							&nbsp;&nbsp;&nbsp;&nbsp;<span ng-if="!account.user.isCommunityDirector" class="link orange" ng-click="assignGroups()"><i class="fa fa-plus-circle"></i></span>
						</div>
					</div>
				</div>
			</div>
		</div>

		<div class="support-box-wrap box-content2" ng-if="staff.login">
			<div class="support-box-wrap-header">
				<h1>Payment Info</h1>
				<div class="support-box-header-actions-wrap">
					<div class="support-box-header-actions">
						<a href="/staff/{{staff.login}}/pexcard" ng-if="staff.pexcard.active"><button class="button button-small button-empty button-green"><i class="fa fa-pencil"></i>&nbsp;&nbsp;Add PEX Funds</button></a>
						<a href="/pexcard/card/driver/{{staff.id_admin}}" ng-if="!staff.pexcard.active"><button class="button button-small button-empty button-green"><i class="fa fa-plus"></i>&nbsp;&nbsp;Add PEX Card</button></a>
						<a href="/staff/{{staff.login}}/payinfo"><button class="button button-small button-empty button-green"><i class="fa fa-pencil"></i>&nbsp;&nbsp;Edit</button></a>

						<spinner-action-button button-title="Reverify" icon="check" action="reverify"></spinner-action-button>
						<spinner-action-button button-title="Send Driver's Licence" icon="doc" action="sendDriverLicenceToStripe"></spinner-action-button>

					</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">PEX Card</div>
						<div class="field-value">
							<span class="tag tag-green" ng-if="staff.pexcard.active">Active</span>
							<span class="tag tag-red" ng-if="!staff.pexcard.active">Inactive</span>
						</div>
					</div>
					<div class="field-row" ng-if="staff.pexcard.active">
						<div class="field-key">PEX Serial</div>
						<div class="field-value">{{staff.pexcard.card_serial}}</div>
					</div>
					<div class="field-row" ng-if="staff.pexcard.active">
						<div class="field-key">PEX Last Four</div>
						<div class="field-value">{{staff.pexcard.last_four}}</div>
					</div>
					<div class="field-row">
						<div class="field-key">Stripe Status</div>
						<div class="field-value">
							<a href="https://dashboard.stripe.com/applications/users/{{staff.stripe_id}}" target="_blank" class="no-underline">
								<span class="tag tag-green" ng-if="staff.verified">Verified</span>
								<span class="tag tag-red" ng-if="!staff.verified">Unverified</span>
							</a>
						</div>
					</div>
				</div>
			</div>

		</div>

		<div class="support-box-wrap box-content2" ng-if="staff.login">

			<div class="support-box-wrap-header">
				<h1>Additional Info</h1>
				<div class="divider"></div>
			</div>

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

				<div class="field-container">

					<div class="field-row" ng-if="staff.phone_type">
						<div class="field-key">Phone</div>
						<div class="field-value">
							{{staff.phone_type}}
							<span ng-if="staff.phone_subtype"> - {{staff.phone_subtype}}</span>
							<span ng-if="staff.phone_version"> - {{staff.phone_version}}</span>
							<span ng-if="staff.iphone_type"> - {{staff.iphone_type}}</span>
						</div>
					</div>

					<div class="field-row" ng-if="staff.cell_carrier">
						<div class="field-key">Cell Carrier</div>
						<div class="field-value">
							{{staff.cell_carrier}}
						</div>
					</div>

					<div class="field-row" ng-if="staff.is_driver">
						<div class="field-key">Student</div>
						<div class="field-value">
							<span class="tag tag-green" ng-if="staff.student">Yes</span>
							<span class="tag tag-red" ng-if="!staff.student">No</span>
						</div>
					</div>

					<div class="field-row" ng-if="staff.is_driver">
						<div class="field-key">Permashifts</div>
						<div class="field-value">
							<span class="tag tag-green" ng-if="staff.permashifts">Yes</span>
							<span class="tag tag-red" ng-if="!staff.permashifts">No</span>
						</div>
					</div>

					<div class="field-row" ng-if="staff.weekly_hours">
						<div class="field-key">Desired Weekly Hours</div>
						<div class="field-value">
							{{staff.weekly_hours}}
						</div>
					</div>

					<div class="field-row" ng-if="staff.tshirt_size">
						<div class="field-key">T-shirt Size</div>
						<div class="field-value">
							{{staff.tshirt_size}}
						</div>
					</div>

					<div class="field-row" ng-if="staff.address">
						<div class="field-key">Address</div>
						<div class="field-value"><a href ng-click="routeAddress(staff.address)">{{staff.address}}</a></div>
					</div>

					<div class="field-row" ng-if="staff.payment_type">
						<div class="field-key">Pay Structure</div>
						<div class="field-value">
							<span class="tag tag-blue" ng-if="staff.payment_type == 'orders'">Commission</span>
							<span class="tag tag-purple" ng-if="staff.payment_type == 'hours'">Hourly with tips</span>
							<span class="tag tag-orange" ng-if="staff.payment_type == 'hours_without_tips'">Hourly without tips (but a higher hourly rate)</span>
							<span class="tag tag-yellow" ng-if="staff.payment_type == 'making_whole'">Making whole</span>
						</div>
					</div>

					<div class="field-row" ng-if="staff.hour_rate">
						<div class="field-key">Hour rate</div>
						<div class="field-value">
							${{staff.hour_rate | formatPrice}}
						</div>
					</div>

					<div class="field-row" ng-if="staff.payment_type == 'orders' || staff.payment_type == 'making_whole'">
						<div class="field-key">Amount per order</div>
						<div class="field-value">
							<span ng-if="staff.amount_per_order">${{staff.amount_per_order | formatPrice}}</span>
							<span ng-if="!staff.amount_per_order">Delivery Fee</span>
						</div>
					</div>

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

		<div class="support-box-wrap box-content2" ng-if="staff.docs && staff.login && !account.user.isCommunityDirector">
			<div class="support-box-wrap-header">
				<h1>Documents</h1>
				<div class="support-box-header-actions-wrap">
					<div class="support-box-header-actions">
						<a ng-if="staff.isDriver" href="/drivers/onboarding/{{staff.login}}"><button class="button button-small button-empty button-green"><i class="fa fa-briefcase"></i>&nbsp;&nbsp;Upload Driver Docs</button></a>
						<a ng-if="staff.isMarketingRep" href="/staff/marketing/{{staff.login}}"><button class="button button-small button-empty button-green"><i class="fa fa-briefcase"></i></i>&nbsp;&nbsp;Upload Brand Rep Docs</button></a>
					</div>
				</div>
				<div class="divider"></div>
			</div>

			<div class="no-box-content-color">
				<div class="field-container">
					<div class="field-row" ng-repeat="doc in staff.docs">
						<div class="field-key">
							<a href="/api/driver/documents/download/{{doc.status.id_driver_document_status}}" target="_blank" ng-if="doc.status.id_driver_document_status">{{doc.name}}</a>
							<span ng-if="!doc.status.id_driver_document_status">{{doc.name}}</span>
						</div>
						<div class="field-value">
							<span ng-if="doc.status">
								<span ng-if="doc.status.id_admin_approved" class="tag tag-green">Approved</span>
								<span ng-if="!doc.status.id_admin_approved" class="tag tag-lightblue">Not Approved</span>
							</span>
							<span ng-if="!doc.status">
								<span ng-if="doc.required" class="tag tag-red">Required</span>
								<span class="tag tag-lightgrey">Missing</span>
							</span>
						</div>
					</div>
				</div>
			</div>
		</div>

		<div class="support-box-wrap box-content2" ng-if="!account.user.isCommunityDirector">
			<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>
			<? /*
			<div class="no-box-content-color box-content-table">
				<map zoom="12" center="false" class="maps-map" map-type-control="false" style="height: 230px;" options="{streetViewControl: false}"></map>
			</div>
			*/ ?>
		</div>
	</div>

	<span ng-if="!account.user.isCommunityDirector">
		<ng-include src="'/assets/view/staff-group.html'"></ng-include>
		<ng-include src="'/assets/view/staff-community.html'"></ng-include>
		<ng-include src="'/assets/view/listview-admin-notes.html'"></ng-include>
	</span>


	<? /*
	<div class="box-content2 box-content-table">
		<table class="tb-zebra">
			<tr>
				<th>ID</th>
				<th>From</th>
				<th>Updated</th>
				<th>Name</th>
				<th>Message</th>
			</tr>
			<tr ng-repeat="ticket in tickets">
				<td><a href="/ticket/{{ticket.id_support}}">{{ticket.id_support}}</td>
				<td><a href ng-click="callText(ticket.user.phone)">{{ticket.user.phone | formatPhone}}</a></td>
				<td>
					<span ng-if="ticket.timestamp" am-time-ago="ticket.timestamp*1000"></span>
					<span ng-if="!ticket.timestamp"><i>Unknown</i></span>
				</td>
				<td>{{ticket.name}}</td>
				<td>{{ticket.message}}</td>
			</tr>
		</table>
	</div>
	*/ ?>


</div>
