<form id='rmaForm' name='rmaForm' ng-submit="save()" class="form-horizontal form-edit" confirm-on-exit>
	@include('bookings::templates.bookings_projects_header')
	@csrf

	@include('bookings::templates.location')

	<h4 class="subheader">RMA Items</h4>
	<div class="input-group">
		<input type="text" class="form-control" ng-model="search" placeholder="Search for items" stock-selected='addItem(data)' lookup-stock />
		<span class="input-group-addon"><i class="fa fa-search"></i></span>
	</div>
	<table class="table">
		<tbody>
			<tr ng-repeat="item in data.items">
				<td style="vertical-align:middle"><strong>{[{ item.name }]}</strong></td>
				<td style="vertical-align:middle">{[{ item.manufacturer_code }]}</td>
				<td style="vertical-align:middle">
					<i class="fa fa-tags"></i> <input type="text" class="input-hidden col-sm-3" ng-model="item.quantity" ng-init="item.quantity = 1" />
				</td>
				<td style="vertical-align:middle"><a href="#" class="btn btn-danger pull-right" ng-click="removeItem(item)" eat-click>Remove</a></td>
			</tr>
			<tr ng-show="data.items.length === 0">
				<td colspan="5">No items are currently selected</td>
			</tr>
		</tbody>
	</table>

	{{--
	<div class="form-group">
		<label for="severity_id" class="col-sm-3 control-label label-required">Urgency:</label>
		<div class="col-sm-9">
			<select name="severity_id" ng-model="data.severity_id" class="col-sm-12" required>
				<option value="">Select Severity</option>
				@foreach($severities_dropdown as $value => $label)
					<option value="{{ $value }}">{{ $label }}</option>
				@endforeach
			</select>
		</div>
	</div>
	--}}

	<br /><br />
	<div class="form-group">
		<label for="problem" class="col-sm-3 control-label label-required">Details:</label>
		<div class="col-sm-9">
			<textarea name="problem" ng-model="data.problem" class="col-sm-12" summernote summernote-height="200"></textarea>
		</div>
	</div>

	<div class="alert alert-warning" ng-if="! formIsValid()">
		<p class="lead"><i class="fa fa-warning"></i> The following are required before saving the job:</p>
		<ul>
			<li ng-if="!clientManager.isSelected()">You need to select a customer from the left hand side.</li>
			<li ng-if="!data.items || data.items.length === 0">You need to add at least one item.</li>
			<li ng-if="!data.problem || data.problem.trim() === ''">Details are required.</li>
		</ul>
	</div>

	<div class="form-actions">
		<input type="hidden" name="client_id" ng-model="data.client_id" required>
		<input type="hidden" name="type" value="support">
		<button class="btn btn-primary" data-loading-text="Saving..." ng-disabled="!formIsValid()">
			Save
		</button>
	</div>

</form>