<ol class="breadcrumb">
	<li><a href="#/">Dashboard</a></li>
	<li class="active">Employees</li>
</ol>

<div class="container-fluid">
	<div class="row">
		<div class="col-md-12">
			<div class="panel panel-midnightblue">
				<div class="panel-heading">
					<h2>Employees</h2>
					<div class="panel-ctrls">
						<a class="button-icon" href="#/employees-map" title="Map"><i class="ti ti-map-alt"></i></a>
						<a class="button-icon" ng-click="vm._downloadCSV()" title="Download CSV"><i class="ti ti-save"></i></a>
						<a class="button-icon" href="#/employees-import" title="Import From Quickbooks"><i class="ti ti-import"></i></a>
						<a class="button-icon" ng-click="vm._reload()" title="Reload"><i class="ti ti-reload"></i></a>
						<a href="#/employees/new" class="button-icon" title="New Employee"><i class="ti ti-plus"></i></a>
					</div>
				</div>
				<div class="panel-body">
					<div class="row" style="margin-bottom: 15px;">
						<div class="col-md-9">
							<input type="text" class="form-control" ng-model="searchInput" placeholder="Search here...">
						</div>
						<div class="col-md-3">
							<select class="form-control" ng-model="vm.quickbooks_filter">
								<option value="">-- Quickbooks --</option>
								<option value="Yes">Yes</option>
								<option value="No">No</option>
								<option value="-1">All</option>
							</select>
						</div>
					</div>
					<table class="table table-striped">
						<thead>
							<tr>
								<th>Name</th>
								<th class="hidden-xs">Email</th>
								<th class="hidden-xs">Phone</th>
								<th class="hidden-xs">Color</th>
								<th class="hidden-xs">Quickbooks</th>
								<th width="15%">Actions</th>
							</tr>
						</thead>
						<tbody>
							<tr dir-paginate="employee in vm.employees | filter: searchInput | filter: vm._filterByQuickbooks | itemsPerPage: 10">
								<td>
									<a href="#/employees/{{employee.id}}">
										{{employee.name}} ({{employee.initials}})
									</a>
								</td>
								<td class="hidden-xs">{{employee.contacts.email}}</td>
								<td class="hidden-xs">{{employee.contacts.phone}}</td>
								<td class="hidden-xs"><span style="display: block; width: 20px; height: 20px; background-color: {{employee.preferences.color}}"></span></td>
								<td class="hidden-xs">
									<span ng-if="employee.quickbooks_id">Yes</span>
									<span ng-if="!employee.quickbooks_id">No</span>
								</td>
								<td>
									<div class="btn-group">
										<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
											<i class="ti ti-settings"></i>&nbsp;&nbsp;<span class="caret"></span>
										</button>
										<ul class="dropdown-menu" role="menu">
											<li><a href="#/employees/{{employee.id}}/edit">Edit</a></li>
											<li><a ng-click="vm._destroy(employee.id)">Delete</a></li>
											<li class="divider"></li>
											<li ng-if="!employee.credential"><a href="#/credentials/{{employee.id}}/new">New Credential</a></li>
											<li ng-if="employee.credential"><a href="#/credentials/{{employee.id}}/edit/{{employee.credential.id}}">Edit Credential</a></li>
											<li ng-if="employee.credential"><a ng-click="vm._revoke(employee.credential.id)">Revoke Credential</a></li>
											<li class="divider"></li>
											<li>
												<a ng-click="vm._sendToQuickbooks(employee.id)">
													<span ng-if="employee.quickbooks_id">Update To Quickbooks</span>
													<span ng-if="!employee.quickbooks_id">Add To Quickbooks</span>
												</a>
											</li>
										</ul>
									</div>
								</td>
							</tr>
						</tbody>
					</table>
					<p class="text-center" ng-show="vm.employees.length == 0">No records found</p>
					<div class="row">
						<div class="col-sm-12 text-center">
							<dir-pagination-controls></dir-pagination-controls>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
