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

<div class="container-fluid">
	<div class="row">
		<div class="col-md-12">
			<div class="panel panel-midnightblue">
				<div class="panel-heading">
					<h2>Follows Up</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>
					</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 class="hidden-xs" width="15%">Date</th>
								<th class="hidden-xs">FUP Until</th>
								<th>Note</th>
								<th width="15%">Actions</th>
							</tr>
						</thead>
						<tbody>
							<tr dir-paginate="follow_up in vm.follows_up | filter: searchInput | itemsPerPage: 10">
								<td class="hidden-xs">{{follow_up.created_at_formatted}}</td>
								<td class="hidden-xs">{{follow_up.follow_up_until}}</td>
								<td>
									<div class="hidden-sm hidden-md hidden-lg" style="margin-bottom: 5px;">
										Date: <a>{{follow_up.created_at_formatted}}</a>
									</div>
									<div class="hidden-sm hidden-md hidden-lg" style="margin-bottom: 5px;">
										FUP Until: <a>{{follow_up.follow_up_until}}</a>
									</div>
									<div style="margin-bottom: 5px;">
										To: 
										<a ng-click="vm._redirect('App\\Customer', follow_up.notable_id)" ng-if="follow_up.notable_type == 'App\\Customer'">
											{{follow_up.notable.name}}
										</a>
										<a ng-click="vm._redirect('App\\Property', follow_up.notable_id)" ng-if="follow_up.notable_type == 'App\\Property'">
											{{follow_up.notable.location.address}} ({{follow_up.customer.name}})
										</a>
										<a ng-click="vm._redirect('App\\WorkOrderVisit', follow_up.notable_id)" ng-if="follow_up.notable_type == 'App\\WorkOrderVisit'">
											{{follow_up.notable.number}} ({{follow_up.customer.name}})
										</a>
										<a ng-click="vm._redirect('App\\WorkOrder', follow_up.notable_id)" ng-if="follow_up.notable_type == 'App\\WorkOrder'">
											{{follow_up.notable.number}} ({{follow_up.customer.name}})
										</a>
									</div>
									{{follow_up.content}}
									<div ng-if="follow_up.notified_employees_objects.length" style="margin-top: 5px;">
										Tagged: <span ng-repeat="employee in follow_up.notified_employees_objects" style="margin-right: 5px;">
											<a href="#/employees/{{employee.id}}">{{employee.name}}</a>
										</span>
									</div>
								</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 ng-click="vm._follow_up_done(follow_up.id)">Done</a></li>
										</ul>
									</div>
								</td>
							</tr>
						</tbody>
					</table>
					<p class="text-center" ng-show="vm.follows_up.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>
