From dd7756d4ca694b78c4a903f1900f2c2ab9d02e60 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Sun, 17 Dec 2017 19:54:54 +0200 Subject: [PATCH] Working on task kanban --- app/Constants.php | 1 + app/Http/Controllers/TaskKanbanController.php | 42 +++ app/Models/TaskStatus.php | 30 ++ ...17_12_13_074024_add_remember_2fa_token.php | 38 +++ resources/lang/en/texts.php | 5 + resources/views/list.blade.php | 1 + resources/views/tasks/kanban.blade.php | 303 ++++++++++++++++++ routes/web.php | 1 + 8 files changed, 421 insertions(+) create mode 100644 app/Http/Controllers/TaskKanbanController.php create mode 100644 app/Models/TaskStatus.php create mode 100644 resources/views/tasks/kanban.blade.php diff --git a/app/Constants.php b/app/Constants.php index 14e112c2fc..661935285f 100644 --- a/app/Constants.php +++ b/app/Constants.php @@ -23,6 +23,7 @@ if (! defined('APP_NAME')) { define('ENTITY_CREDIT', 'credit'); define('ENTITY_QUOTE', 'quote'); define('ENTITY_TASK', 'task'); + define('ENTITY_TASK_STATUS', 'task_status'); define('ENTITY_ACCOUNT_GATEWAY', 'account_gateway'); define('ENTITY_USER', 'user'); define('ENTITY_TOKEN', 'token'); diff --git a/app/Http/Controllers/TaskKanbanController.php b/app/Http/Controllers/TaskKanbanController.php new file mode 100644 index 0000000000..e0e1397be6 --- /dev/null +++ b/app/Http/Controllers/TaskKanbanController.php @@ -0,0 +1,42 @@ +get(); + + if (! $stauses->count()) { + $stauses = []; + $defaults = [ + 'backlog', + 'ready_to_do', + 'in_progress', + 'done', + ]; + for ($i=0; $iname = trans('texts.' . $defaults[$i]); + $status->sort_order = $i; + $status->save(); + $stauses[] = $status; + } + } + + $data = [ + 'title' => trans('texts.kanban'), + 'statuses' => $stauses, + ]; + + return view('tasks.kanban', $data); + } + +} diff --git a/app/Models/TaskStatus.php b/app/Models/TaskStatus.php new file mode 100644 index 0000000000..479b5cfff6 --- /dev/null +++ b/app/Models/TaskStatus.php @@ -0,0 +1,30 @@ +string('remember_2fa_token', 100)->nullable(); }); + + Schema::dropIfExists('task_statuses'); + Schema::create('task_statuses', function ($table) { + $table->increments('id'); + $table->unsignedInteger('user_id'); + $table->unsignedInteger('account_id')->index(); + $table->timestamps(); + $table->softDeletes(); + + $table->string('name')->nullable(); + $table->smallInteger('sort_order')->default(0); + + $table->foreign('account_id')->references('id')->on('accounts')->onDelete('cascade'); + $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); + + $table->unsignedInteger('public_id')->index(); + $table->unique(['account_id', 'public_id']); + }); + + Schema::table('tasks', function ($table) { + $table->unsignedInteger('task_status_id')->nullable(); + $table->smallInteger('task_status_sort_order')->default(0); + }); + + Schema::table('tasks', function ($table) { + $table->foreign('task_status_id')->references('id')->on('task_statuses')->onDelete('cascade'); + }); } /** @@ -28,5 +55,16 @@ class AddRemember2faToken extends Migration Schema::table('users', function ($table) { $table->dropColumn('remember_2fa_token'); }); + + Schema::table('tasks', function ($table) { + $table->dropForeign('tasks_task_status_id_foreign'); + }); + + Schema::table('tasks', function ($table) { + $table->dropColumn('task_status_id'); + $table->dropColumn('task_status_sort_order'); + }); + + Schema::dropIfExists('task_statuses'); } } diff --git a/resources/lang/en/texts.php b/resources/lang/en/texts.php index 4c9dc92360..efc03f9b44 100644 --- a/resources/lang/en/texts.php +++ b/resources/lang/en/texts.php @@ -2613,6 +2613,11 @@ $LANG = array( 'do_not_trust' => 'Do not remember this device', 'trust_for_30_days' => 'Trust for 30 days', 'trust_forever' => 'Trust forever', + 'kanban' => 'Kanban', + 'backlog' => 'Backlog', + 'ready_to_do' => 'Ready to do', + 'in_progress' => 'In progress', + 'add_status' => 'Add status', ); diff --git a/resources/views/list.blade.php b/resources/views/list.blade.php index 8c28f29f91..b26ae8e546 100644 --- a/resources/views/list.blade.php +++ b/resources/views/list.blade.php @@ -84,6 +84,7 @@ }); @elseif ($entityType == ENTITY_TASK) + {!! Button::normal(trans('texts.kanban'))->asLinkTo(url('/tasks/kanban'))->appendIcon(Icon::create('th')) !!} {!! Button::normal(trans('texts.time_tracker'))->asLinkTo('javascript:openTimeTracker()')->appendIcon(Icon::create('time')) !!} @endif diff --git a/resources/views/tasks/kanban.blade.php b/resources/views/tasks/kanban.blade.php new file mode 100644 index 0000000000..2708ad018d --- /dev/null +++ b/resources/views/tasks/kanban.blade.php @@ -0,0 +1,303 @@ +@extends('header') + +@section('head') + @parent + + + +@stop + +@section('content') + + + + + + + +
+
+
+ +
+
+
+ +
+
+ +

+
+ +
+
+
+
+
+
+
+
+ +
+ + +
+
+
+
+ +
+ +
+ +
+ + +
+
+
+ +
+
+
+ +@stop diff --git a/routes/web.php b/routes/web.php index e1ea830522..7dfe98d1ac 100644 --- a/routes/web.php +++ b/routes/web.php @@ -143,6 +143,7 @@ Route::group(['middleware' => ['lookup:user', 'auth:user']], function () { Route::get('clients/statement/{client_id}/{status_id?}/{start_date?}/{end_date?}', 'ClientController@statement'); Route::get('time_tracker', 'TimeTrackerController@index'); + Route::get('tasks/kanban', 'TaskKanbanController@index'); Route::resource('tasks', 'TaskController'); Route::get('api/tasks/{client_id?}', 'TaskController@getDatatable'); Route::get('tasks/create/{client_id?}/{project_id?}', 'TaskController@create');