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

<div class="container-fluid">
	<div class="row">
		<div class="col-md-12">
			<div class="panel panel-midnightblue">
				<div class="panel-heading">
					<h2>Complaints</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="#/complaints/new" class="button-icon" title="New Complaint"><i class="ti ti-plus"></i></a>
					</div>
				</div>
				<div class="panel-body">
					<p><input type="text" class="form-control" ng-model="searchInput" placeholder="Search here..."></p>
					<table class="table table-striped">
						<thead>
							<tr>
								<th>Date</th>
								<th>Customer</th>
								<th class="hidden-xs">Employee</th>
								<th class="hidden-xs">Subject</th>
								<th width="15%">Actions</th>
							</tr>
						</thead>
						<tbody>
							<tr dir-paginate="complaint in vm.complaints | filter: searchInput | itemsPerPage: 10">
								<td>
									<a href="#/complaints/{{complaint.id}}">
										{{complaint.created_at_formatted}}
									</a>
								</td>
								<td>
									<a href="#/customers/{{complaint.customer.id}}">
										{{complaint.customer.name}}
									</a>
								</td>
								<td class="hidden-xs">
									<a href="#/employees/{{complaint.employee.id}}" ng-if="complaint.employee">{{complaint.employee.name}}</a>
									<a ng-if="!complaint.employee">All</a>
								</td>
								<td class="hidden-xs">{{complaint.subject}}</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="#/complaints/{{complaint.id}}/edit">Edit</a></li>
											<li><a ng-click="vm._destroy(complaint.id)">Delete</a></li>
										</ul>
									</div>
								</td>
							</tr>
						</tbody>
					</table>
					<p class="text-center" ng-show="vm.complaints.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>
