@extends('layouts.master')

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

@section('content')
	<div class="row">
		<div class="col-sm-8">
			<div class="widget widget-classic">
				<div class="widget-content">

					<!-- Page title -->
					<p class="lead">
						Configure Statuses
						<a href="{{ route('admin.settings.statuses.create') }}" class="btn btn-primary pull-right"><i class="fa fa-plus"></i> Add new status</a>
					</p>

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

					<?php $old_for = ''; ?>
					<table class="table table-hover">
						<tbody>
							@foreach($statuses as $status)
								@if ($status->for != $old_for)
									<?php $old_for = $status->for; ?>
									<tr>
										<td colspan="8"><strong><i class="fa fa-chevron-right"></i> {{ ucwords(str_replace('_', ' ', $status->for)) }}</strong></td>
									</tr>
								@endif
								<tr>
									<td></td>
									<td>{{ $status->id }}</td>
									<td>{{ $status->name }}</td>
									<td><span class="muted">Applies to:</span> {{ ucwords(str_replace('_', ' ', $status->for)) }}</td>
									<td>{!! $status->completed ? '<span class="text-danger">Closes Task</span>' : '' !!}</td>
									<td>{!! $status->private ? '<span class="text-danger">Private</span>' : '' !!}</td>
									<td>{!! $status->exclude_notifications ? '<span class="text-danger"><i class="fa fa-bell-slash-o"></i></span>' : '' !!}</td>
									<td><a href="{{ route('admin.settings.statuses.edit', $status->id) }}" class="pull-right">Edit</a></td>
								</tr>
							@endforeach
						</tbody>
					</table>

					<hr>
					<p><small>Total of {{ count($statuses) }} entries</small></p>
				</div>
			</div>
		</div>
		<div class="col-sm-4">
			@include('admin::settings.statuses.partials.info')
		</div>
	</div>
@stop