/views/task/tasks.blade.php
@extends('layout')
@section('content')
<div class="row">
<div class="col-md-6">
<h1>ALL TASKS</h1>
</div>
<div class="col-md-6">
<form action="{{ route('task.search') }}" class="navbar-form" role="search" method="GET">
<div class="input-group">
<input type="text" class="form-control" placeholder="Search Task..." name="search_task">
<span class="input-group-btn">
<button type="submit" class="btn btn-default">
<span class="glyphicon glyphicon-search">
<span class="sr-only">Search...</span>
</span>
</button>
</span>
</div>
</form>
</div>
</div>
<table class="table table-striped">
<thead>
<tr>
<th><a href="{{ route('task.sort', [ 'key' => 'task' ]) }}">Task Description <span class="glyphicon glyphicon-sort-by-alphabet" aria-hidden="true"></span> </a></th>
<th><a href="{{ route('task.sort', [ 'key' => 'priority' ]) }}">Priority <span class="glyphicon glyphicon-sort-by-alphabet" aria-hidden="true"></span> </a></th>
<th><a href="{{ route('task.sort', [ 'key' => 'completed' ]) }}">Status <span class="glyphicon glyphicon-sort-by-alphabet" aria-hidden="true"></span> </a></th>
<th>Actions</th>
</tr>
</thead>
@if ( !$tasks->isEmpty() )
<tbody>
@foreach ( $tasks as $task)
<tr>
<td>{{ $task->task }} </td>
<td>
@if ( $task->priority == 0 )
<span class="label label-info">Priority: Normal</span>
@else
<span class="label label-danger">Priority: High</span>
@endif
</td>
<td>
@if ( !$task->completed )
<a href="{{ route('task.completed', ['id' => $task->id]) }}" class="btn btn-warning"> Mark as completed</a>
@else
<span class="label label-success">Completed</span>
@endif
</td>
<td>
<a href="{{ route('task.edit', ['id' => $task->id]) }}" class="btn btn-primary"> edit </a>
<a href="{{ route('task.delete', ['id' => $task->id]) }}" class="btn btn-danger">delete</a>
</td>
</tr>
@endforeach
</tbody>
@else
<p><em>There are no tasks assigned yet</em></p>
@endif
</table>
@stop