<script type="text/ng-template" id="clients/modals/edit-customer.html">
	<div id="customer-edit-modal-header" class="modal-header">
		<button type="button" class="close" ng-click="close()" aria-hidden="true">×</button>
		<h3>Edit customer</h3>
	</div>
	<form id="customer-edit-form" name="customerForm" class="basic-form" ng-submit="save()">
		<div class="modal-body">
			<div class="row">
				<div class="col-sm-5 col-sm-offset-1">

					<input type="hidden" name="id" ng-model="data.id">

					<fieldset>
						<legend>Basic Details</legend>
							<div class="control-group col-sm-12">
								<label for="first_name" class="control-label col-sm-2">First Name</label>
								<div class="controls col-sm-7 pull-right">
									<input type="text" name="first_name" ng-model="data.first_name" required class="form-control">
								</div>
							</div>
							<div class="control-group col-sm-12">
								<label for="last_name" class="control-label col-sm-2">Last Name</label>
								<div class="controls col-sm-7 pull-right">
									<input type="text" name="last_name" ng-model="data.last_name" required class="form-control">
								</div>
							</div>

					</fieldset>

					<fieldset id="contact-details-fieldset">
						<legend>Contact Details</legend>
						<div class="input-group margin-bottom-sm">
							<span class="input-group-addon"><i class="fa fa-envelope fa-fw"></i></span>
							<input type="text" name="email" ng-model="data.email" class="form-control col-sm-11" placeholder="E-mail" maxlength="128">
						</div>
						<div class="input-group margin-bottom-sm">
							<input type="text" name="phone" ng-model="data.phone" class="form-control col-sm-11" placeholder="Phone" numbers-only maxlength="15">
						</div>
						<div class="input-group margin-bottom-sm">
							<input type="text" name="phone2" ng-model="data.phone2" class="form-control col-sm-11" placeholder="Additional Phone" numbers-only maxlength="15">
						</div>
						<div class="input-group margin-bottom-sm">
							<input type="text" name="mobile" ng-model="data.mobile" class="form-control col-sm-11" placeholder="Mobile phone" numbers-only maxlength="15">
						</div>
					</fieldset>
				</div>

				<div class="col-sm-5">
					<fieldset>
						<legend>Address Details</legend>
						<div class="input-group margin-bottom-sm">
							<span class="input-group-addon"><i class="fa fa-home fa-fw"></i></span>
							<input type="text" name="address" ng-model="data.address" class="form-control col-sm-11" placeholder="Address Line 1">
						</div>
						<div class="input-group margin-bottom-sm">
							<span class="input-group-addon"><i class="fa fa-home fa-fw"></i></span>
							<input type="text" name="address2" ng-model="data.address2" class="form-control col-sm-11" placeholder="Address Line 2">
						</div>
						<div class="input-group margin-bottom-sm">
							<span class="input-group-addon"><i class="fa fa-building-o fa-fw"></i></span>
							<input type="text" name="town" ng-model="data.town" class="form-control col-sm-11" placeholder="Town">
						</div>
						<div class="input-group margin-bottom-sm">
							<span class="input-group-addon"><i class="fa fa-globe fa-fw"></i></span>
							<input type="text" name="county" ng-model="data.county" class="form-control col-sm-11" placeholder="County">
						</div>
						<div class="input-group margin-bottom-sm">
							<span class="input-group-addon"><i class="fa fa-map-marker fa-fw"></i></span>
							<input ng-model="data.postcode" required="required" class="form-control col-sm-11" placeholder="Postcode" name="postcode" type="text" value="">
							<span class="input-group-addon" ng-click="lookupPostcode(data.postcode)" title="Find the address"><i ng-class=" postcode.icon" class="fa fa-crosshairs fa-fw text-primary"></i></span>
						</div>

					</fieldset>

					<fieldset id="additional-notes-fieldset">
						<legend id="additional-notes-legend">Additional Notes</legend>
						<div class="control">
							<label class="control-label col-sm-2" style="width: auto;">Send feedback email? </label> &nbsp;&nbsp;
							<label class="inline">
								<input type="radio" value="1" name="enable_feedback" ng-model="data.enable_feedback"> Yes
							</label>
							<label class="inline">
								<input type="radio" value="0" name="enable_feedback" ng-model="data.enable_feedback"> No
							</label>
						</div>

						<div class="control">
							<label for="blind_notes" class="blind-notes">Blind Notes</label>
							<textarea name="blind_notes" ng-model="data.blind_notes" class="form-control col-sm-12" rows="4"></textarea>
						</div>
					</fieldset>
				</div>
			</div>
		</div>
		<div class="modal-footer">
			<button class="btn" ng-click="cancel()">Cancel</button>
			<button class="btn btn-primary" ng-disabled="service.isBusy || service.loading" ng-click="save()" data-eat-click="" style="height: 34px; line-height: 1.42857143;">
				<i ng-class="{'fa-spinner fa-spin': service.loading, 'fa-floppy-o': !service.loading}" class="fa fa-floppy-o"></i>
				<span ng-if="!service.loading">&nbsp; Save changes</span>
			</button>
		</div>
	</form>
</script>