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

<div class="container-fluid">
	<div class="row">
		<div class="col-md-12">
			<div class="panel panel-midnightblue">
				<div class="panel-heading">
					<h2>To Dos</h2>
					<div class="panel-ctrls">
						<a class="button-icon" ng-click="vm._downloadCSV()" title="Download CSV"><i class="ti ti-save"></i></a>
						<a class="button-icon" ng-click="vm._reload()" title="Reload"><i class="ti ti-reload"></i></a>
						<a href="#/to-dos/new" class="button-icon" title="New To Do"><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.status_filter">
								<option value="">-- Status --</option>
								<option value="Pending">Pending</option>
								<option value="Done">Done</option>
								<option value="-1">All</option>
							</select>
						</div>
					</div>
					<table class="table table-striped">
						<thead>
							<tr>
								<th>Title</th>
								<th class="hidden-xs">Date</th>
								<th class="hidden-xs">Employee</th>
								<th class="hidden-xs">Due Date</th>
								<th>Status</th>
								<th width="15%">Actions</th>
							</tr>
						</thead>
						<tbody>
							<tr dir-paginate="todo in vm.todos | filter: searchInput | filter: vm._filterByStatus | itemsPerPage: 10">
								<td>
									<a href="#/to-dos/{{todo.id}}">
										{{todo.title | limitTo: 50}}...
									</a>
								</td>
								<td class="hidden-xs">{{todo.created_at_formatted}}</td>
								<td class="hidden-xs">{{todo.employee.name}}</td>
								<td class="hidden-xs">{{todo.due_date_formatted}}</td>
								<td>
									<span class="badge" ng-class="{'badge-success': todo.status_formatted == 'Done', 'badge-danger': todo.status_formatted == 'Pending'}">{{todo.status_formatted}}</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 ng-if="todo.status_formatted == 'Pending'"><a ng-click="vm._done(todo.id)">Done</a></li>
											<li ng-if="todo.status_formatted == 'Pending'" class="divider"></li>
											<li><a href="#/to-dos/{{todo.id}}/edit">Edit</a></li>
											<li><a ng-click="vm._destroy(todo.id)">Delete</a></li>
										</ul>
									</div>
								</td>
							</tr>
						</tbody>
					</table>
					<p class="text-center" ng-show="vm.todos.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>
