mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 05:02:36 +01:00
Working on task kanban
This commit is contained in:
parent
2016de98e6
commit
e69b97f31e
@ -14,10 +14,10 @@ class TaskKanbanController extends BaseController
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$tasks = Task::scope()->with(['project', 'client'])->get();
|
||||
$tasks = Task::scope()->with(['project', 'client', 'task_status'])->orderBy('task_status_sort_order')->get();
|
||||
$stauses = TaskStatus::scope()->orderBy('sort_order')->get();
|
||||
$projects = Project::scope()->get();
|
||||
$clients = Client::scope()->get();
|
||||
$stauses = TaskStatus::scope()->get();
|
||||
|
||||
// check initial statuses exist
|
||||
if (! $stauses->count()) {
|
||||
|
@ -79,6 +79,14 @@ class Task extends EntityModel
|
||||
return $this->belongsTo('App\Models\Project')->withTrashed();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function task_status()
|
||||
{
|
||||
return $this->belongsTo('App\Models\TaskStatus')->withTrashed();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $task
|
||||
*
|
||||
|
@ -10,6 +10,10 @@
|
||||
min-height: 540px;
|
||||
}
|
||||
|
||||
.kanban input {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.kanban-column {
|
||||
background-color: #E9E9E9;
|
||||
padding: 10px;
|
||||
@ -110,6 +114,7 @@
|
||||
|
||||
var projectMap = {};
|
||||
var clientMap = {};
|
||||
var statusMap = {};
|
||||
|
||||
ko.bindingHandlers.enterkey = {
|
||||
init: function (element, valueAccessor, allBindings, viewModel) {
|
||||
@ -143,6 +148,7 @@
|
||||
for (var i=0; i<statuses.length; i++) {
|
||||
var status = statuses[i];
|
||||
var statusModel = new StatusModel(status);
|
||||
statusMap[status.public_id] = statusModel;
|
||||
self.statuses.push(statusModel);
|
||||
}
|
||||
|
||||
@ -159,7 +165,11 @@
|
||||
for (var i=0; i<tasks.length; i++) {
|
||||
var task = tasks[i];
|
||||
var taskModel = new TaskModel(task);
|
||||
var statusModel = self.statuses()[tasks.task_status_id || 0];
|
||||
if (task.task_status) {
|
||||
var statusModel = statusMap[task.task_status.public_id];
|
||||
} else {
|
||||
var statusModel = self.statuses()[0];
|
||||
}
|
||||
statusModel.tasks.push(taskModel);
|
||||
}
|
||||
|
||||
@ -467,15 +477,15 @@
|
||||
|
||||
<div class="kanban-column kanban-column-last well">
|
||||
<div class="kanban-column-row" data-bind="css: { editing: is_adding_status }">
|
||||
<div data-bind="event: { click: startAddStatus }" style="padding-bottom: 8px;">
|
||||
<a href="#" class="view text-muted" style="font-size:13px">
|
||||
<div class="view" data-bind="event: { click: startAddStatus }" style="padding-bottom: 8px;">
|
||||
<a href="#" class="text-muted" style="font-size:13px">
|
||||
{{ trans('texts.new_status') }}...
|
||||
</a>
|
||||
</div>
|
||||
<div class="edit">
|
||||
<textarea data-bind="value: new_status, valueUpdate: 'afterkeydown',
|
||||
<input data-bind="value: new_status, valueUpdate: 'afterkeydown',
|
||||
hasfocus: is_adding_status, selected: is_adding_status, enterkey: completeAddStatus"></textarea>
|
||||
<div class="pull-right">
|
||||
<div class="pull-right" style="padding-top:6px">
|
||||
<button type='button' class='btn btn-default btn-sm' data-bind="click: cancelAddStatus">
|
||||
{{ trans('texts.cancel') }}
|
||||
</button>
|
||||
|
Loading…
Reference in New Issue
Block a user