@section('header')
	@include('common.header')
@stop

@section('js')
	@parent

	<script type="text/ng-template" id="admin/settings/statuses/modals/delete.html">
		@include('admin::settings.statuses.templates.modals.delete')
	</script>
@stop

@section('content')
	<div class="row" ng-controller="AdminStatusCtrl">
		<div class="col-sm-8">
			<div class="widget widget-classic">
				<div class="widget-content">
					<p class="lead">Edit status</p>

					@if (Session::has('message'))
						<div class="alert alert-success">
							<i class="fa fa-check-circle"></i> {!! Session::get('message') !!}
						</div>
					@endif

					<form action="{{ route('admin.settings.statuses.update', $status->id) }}" method="post" class="form-horizontal form-edit">
						@csrf
						@method('put')

						<!-- Include form fields -->
						@include('admin::settings.statuses.partials.form-fields')

						<div class="text-right form-actions">
							<!-- Redirect urls -->
							<span ng-init="redirect = '{!! URL::route('admin.settings.statuses.index') !!}'"></span>
							<span ng-init="delete_url = '{!! URL::route('admin.settings.statuses.destroy', $status->id) !!}'"></span>

							@if ($status->id != 1)
								<!-- Cannot delete the first status -->
								<span class="btn btn-danger pull-left" ng-click="remove()"><i class="fa fa-times"></i> Delete Status</span>
							@endif

							<button type="submit" class="btn btn-primary">Save changes</button>
							<a href="{{ route('admin.settings.statuses.index') }}" class="btn btn-default">Cancel</a>
						</div>
					</form>

				</div>
			</div>
		</div>
		<div class="col-sm-4">
			@include('admin::settings.statuses.partials.info')
		</div>
	</div>
@stop