<ol class="breadcrumb">
	<li><a href="#/">Dashboard</a></li>
	<li><a href="#/work-order-visits/{{vm.work_order_visit_id}}">Work Order Visit</a></li>
	<li class="active">{{vm.action}} Picture</li>
</ol>

<div class="container-fluid">
	<div class="row">
		<div class="col-md-12">
			<form name="form" class="form-horizontal" ng-submit="vm._save(vm.picture)" novalidate>
				<input type="hidden" ng-if="vm.action == 'Edit'" name="id" id="id" ng-model="vm.picture.id">
				<div class="panel panel-midnightblue">
					<div class="panel-heading">
						<h2>{{vm.action}} Picture</h2>
					</div>
					<div class="panel-body">
						<p>Fields with <span style="color: #cc0000;">*</span> are required.</p>
						<div class="form-group">
							<label for="when" class="col-sm-2 control-label">When <span style="color: #cc0000;">*</span></label>
							<div class="col-sm-8">
								<select class="form-control" name="when" id="when" ng-model="vm.picture.when" ng-required="true">
									<option value="">-- When --</option>
									<option value="0">Before Service</option>
									<option value="1">After Service</option>
								</select>
								<p class="help-block" ng-show="form.when.$touched && form.when.$error.required">Value is required.</p>
							</div>
						</div>
						<div class="form-group">
							<label for="url" class="col-sm-2 control-label">Picture <span style="color: #cc0000;">*</span></label>
							<div class="col-sm-8">
								<a class="btn btn-default" ngf-multiple="false" ngf-select="vm._uploadImage($file)" ngf-resize="{centerCrop: true, quality: 1.0}" ngf-pattern="'image/*'" ngf-accept="'image/*'" ngf-max-size="1MB" ngf-model-invalid="invalidFiles">Select</a>
								<a ng-if="vm.picture.url" class="btn btn-info" ng-click="vm._viewImage(vm.picture.url)">View</a>
								<span ng-if="invalidFiles">Invalid File. Select Another One.</span>
								<p class="help-block">Only Images up to 1MB.</p>
							</div>
						</div>
					</div>
					<div class="panel-footer">
						<div class="row">
							<div class="col-sm-8 col-sm-offset-2">
								<button type="submit" ng-disabled="!form.$valid || !vm.picture.url" class="btn-primary btn">Save</button>
								<a href="#/work-order-visits/{{vm.work_order_visit_id}}" class="btn-default btn">Cancel</a>
							</div>
						</div>
					</div>
				</div>
			</form>
		</div>
	</div>
</div>
