<ol class="breadcrumb">
	<li><a href="#/">Dashboard</a></li>
	<li><a href="#/customers">Customers</a></li>
	<li><a href="#/customers/{{vm.customer.id}}">{{vm.customer.name}}</a></li>
	<li class="active">Properties</li>
</ol>

<div class="container-fluid">
	<div class="row">
		<div class="col-md-12">
			<div class="panel panel-midnightblue">
				<div class="panel-heading">
					<h2>Properties</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="#/properties/{{vm.customer.id}}/new" class="button-icon" title="New Property"><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>Address</th>
								<th class="hidden-xs">City</th>
								<th class="hidden-xs">State</th>
								<th class="hidden-xs">Zip Code</th>
								<th class="hidden-xs">Address Type</th>
								<th class="hidden-xs">Quickbooks</th>
								<th width="15%">Actions</th>
							</tr>
						</thead>
						<tbody>
							<tr dir-paginate="property in vm.properties | filter: searchInput | itemsPerPage: 10">
								<td>
									<a href="#/properties/{{vm.customer.id}}/detail/{{property.id}}">
										{{property.location.address}}
									</a>
								</td>
								<td class="hidden-xs">{{property.location.city}}</td>
								<td class="hidden-xs">{{property.location.state}}</td>
								<td class="hidden-xs">{{property.location.zip_code}}</td>
								<td class="hidden-xs">{{property.address_type_formatted}}</td>
								<td class="hidden-xs">{{property.quickbooks_formatted}}</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="#/properties/{{vm.customer.id}}/edit/{{property.id}}">Edit</a></li>
											<li><a ng-click="vm._destroy(property.id)">Delete</a></li>
											<li class="divider" ng-if="property.customer.quickbooks_id"></li>
											<li ng-if="property.customer.quickbooks_id">
												<a ng-click="vm._sendToQuickbooks(property.id)">Update To Quickbooks</a>
											</li>
										</ul>
									</div>
								</td>
							</tr>
						</tbody>
					</table>
					<p class="text-center" ng-show="vm.properties.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>
