-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ @include('searches.tasks.task_table')
diff --git a/resources/views/searches/tasks/task_table.blade.php b/resources/views/searches/tasks/task_table.blade.php
new file mode 100644
index 00000000..a8a0767c
--- /dev/null
+++ b/resources/views/searches/tasks/task_table.blade.php
@@ -0,0 +1,173 @@
+
+
+
+
+
+
+
+
+ {{ __('forms.sector') }} |
+ {{ __('forms.status') }} |
+ {{ __('forms.task_group') }} |
+ {{ __('forms.task_start') }} |
+ {{ __('forms.task_end') }} |
+ {{ __('forms.task_type') }} |
+ {{ __('forms.description') }} |
+ {{ __('forms.gpx') }} |
+ {{ __('forms.actions') }} |
+
+
+
+
+
+
+ @foreach ($tasks as $task)
+
+
+
+ {{ $task->sector }}
+ |
+
+
+ @if( $task->status == "to_do" )
+
+ {{ __('activity.to_do') }}
+
+ @elseif( $task->status == "in_progress" )
+
+ {{ __('activity.in_progress') }}
+
+ @elseif( $task->status == "done" )
+
+ {{ __('activity.done') }}
+
+ @endif
+ |
+
+
+ @if ($task->group != NULL)
+ {{ $task->group }}
+ @endif
+ |
+
+
+ @if ($task->start == NULL)
+ --
+ @else
+ @php
+ $date = new Date($task->start);
+ echo $date->format('d M. Y | H:i');
+ @endphp
+ @endif
+ |
+
+
+ @if ($task->end == NULL)
+ --
+ @else
+ @php
+ $date = new Date($task->end);
+ echo $date->format('d M. Y | H:i');
+ @endphp
+ @endif
+ |
+
+
+ {{ $task->type }}
+ |
+
+
+
+ @include('searches.tasks.buttons.show_description')
+ |
+
+
+ @if($task->gpx == 0)
+
+ {{ __('actions.no') }}
+
+ @else
+
+ {{ __('actions.yes') }}
+
+ @endif
+ |
+
+
+
+ @include('searches.tasks.buttons.edit_task')
+
+
+
+ @include('searches.tasks.buttons.delete_task')
+
+ |
+
+ @endforeach
+
+
+
+
+
+
+
+
+
+
diff --git a/routes/web.php b/routes/web.php
index f4445598..26290524 100644
--- a/routes/web.php
+++ b/routes/web.php
@@ -16,6 +16,19 @@
Route::group(['middleware' => 'auth'], function () {
Route::resource('searches', 'SearchController');
+ // Task Route
+
+ Route::get('task/create/{search_id}', 'TaskController@create')->name('createTask');
+
+ Route::post('task/post', 'TaskController@store')->name('storeTask');
+
+ Route::post('task', 'TaskController@store')->name('postTask');
+
+ Route::delete('task/{id}', 'TaskController@destroy')->name('deleteTask');
+
+ Route::patch('task/{id}', 'TaskController@update')->name('editTask');
+ //
+
Route::get('/', ['uses' => 'SearchController@index', 'as' => 'index']);
Route::get('/searches', ['uses' => 'SearchController@index', 'as' => 'searches']);
diff --git a/storage/app/.gitignore b/storage/app/.gitignore
old mode 100755
new mode 100644
diff --git a/storage/app/public/.gitignore b/storage/app/public/.gitignore
old mode 100755
new mode 100644
diff --git a/storage/framework/.gitignore b/storage/framework/.gitignore
old mode 100755
new mode 100644
diff --git a/storage/framework/cache/.gitignore b/storage/framework/cache/.gitignore
old mode 100755
new mode 100644
diff --git a/storage/framework/cache/data/.gitignore b/storage/framework/cache/data/.gitignore
old mode 100755
new mode 100644
diff --git a/storage/framework/sessions/.gitignore b/storage/framework/sessions/.gitignore
old mode 100755
new mode 100644
diff --git a/storage/framework/testing/.gitignore b/storage/framework/testing/.gitignore
old mode 100755
new mode 100644
diff --git a/storage/framework/views/.gitignore b/storage/framework/views/.gitignore
old mode 100755
new mode 100644
diff --git a/storage/logs/.gitignore b/storage/logs/.gitignore
old mode 100755
new mode 100644
diff --git a/tests/Feature/TaskTest.php b/tests/Feature/TaskTest.php
new file mode 100644
index 00000000..86542091
--- /dev/null
+++ b/tests/Feature/TaskTest.php
@@ -0,0 +1,54 @@
+create();
+
+ $response = $this->actingAs($user)->post('/task', $task->toArray());
+
+ $response = $this->assertDatabaseHas('tasks', $task->toArray());
+ }
+
+ public function test_admin_can_delete_task()
+ {
+ $user = Auth::loginUsingId(1);
+
+ $task = factory('App\Task')->create();
+
+ $response = $this->actingAs($user)->post('/task', $task->toArray());
+
+ $reponse = $this->actingAs($user)->delete(route('deleteTask', $task->id));
+
+ $response = $this->assertDatabaseMissing('tasks', $task->toArray());
+ }
+
+ public function test_user_cannot_delete_task()
+ {
+ $user = Auth::loginUsingId(2);
+
+ $task = factory('App\Task')->create();
+
+ $response = $this->actingAs($user)->post('/task', $task->toArray());
+
+ $reponse = $this->actingAs($user)->delete(route('deleteTask', $task->id));
+
+ $response = $this->assertDatabaseHas('tasks', $task->toArray());
+ }
+}