1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00

Working on kanban

This commit is contained in:
Hillel Coren 2017-12-20 10:41:40 +02:00
parent 13cf166eeb
commit 4b27192ed8
3 changed files with 27 additions and 5 deletions

View File

@ -5,6 +5,7 @@ namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\Models\Task;
use App\Models\TaskStatus;
use App\Models\Client;
use App\Models\Project;
@ -21,9 +22,10 @@ class TimeTrackerController extends Controller
$data = [
'title' => trans('texts.time_tracker'),
'tasks' => Task::scope()->with('project', 'client.contacts')->whereNull('invoice_id')->get(),
'tasks' => Task::scope()->with('project', 'client.contacts', 'task_status')->whereNull('invoice_id')->get(),
'clients' => Client::scope()->with('contacts')->orderBy('name')->get(),
'projects' => Project::scope()->with('client.contacts')->orderBy('name')->get(),
'statuses' => TaskStatus::scope()->orderBy('sort_order')->get(),
'account' => $account,
];

View File

@ -165,7 +165,7 @@
<!-- Navbar Filter -->
<div class="input-group input-group-lg">
<span class="input-group-addon" style="width:1%;" data-bind="click: onFilterClick, style: { 'background-color': filterState() != 'all' ? '#ffffaa' : '' }" title="{{ trans('texts.filter_sort') }}"><span class="glyphicon glyphicon-filter"></span></span>
<span class="input-group-addon" style="width:1%;" data-bind="click: onFilterClick, style: { 'background-color': (filterState() != 'all' || filterStatusId() != '') ? '#ffffaa' : '' }" title="{{ trans('texts.filter_sort') }}"><span class="glyphicon glyphicon-filter"></span></span>
<input id="search" type="search" class="form-control search" autocomplete="off" autofocus="autofocus"
data-bind="event: { focus: onFilterFocus, input: onFilterChanged, keypress: onFilterKeyPress }, value: filter, valueUpdate: 'afterkeydown', attr: {placeholder: placeholder, style: filterStyle, disabled: selectedTask().isChanged }">
<span class="input-group-addon" style="width:1%;" data-bind="click: onClearClick, visible: filter()" title="{{ trans('texts.clear') }}">
@ -307,7 +307,16 @@
<div class="panel panel-default">
<div class="panel-body">
<div class="row" xstyle="padding-bottom:22px;">
<div class="col-md-12">
@if ($statuses->count())
<div class="col-md-6">
{!! Former::select('filter_status')
->label('status')
->addOption(trans('texts.all'), '')
->fromQuery($statuses, 'name', 'public_id')
->data_bind('value: filterStatusId') !!}
</div>
@endif
<div class="col-md-{{ $statuses->count() ? '6' : '12' }}">
{!! Former::select('filter_state')
->label('filter')
->addOption(trans('texts.all'), 'all')

View File

@ -187,6 +187,7 @@
}
self.filterState = ko.observable('all');
self.filterStatusId = ko.observable(false);
self.sortField = ko.observable(defaultSortField);
self.sortDirection = ko.observable(defaultSortDirection);
@ -519,7 +520,7 @@
var tasks = self.tasks();
var filtered = ko.utils.arrayFilter(tasks, function(task) {
return task.matchesFilter(self.filter(), self.filterState());
return task.matchesFilter(self.filter(), self.filterState(), self.filterStatusId());
});
if (! self.filter() || filtered.length > 0) {
@ -602,6 +603,7 @@
self.project = ko.observable();
self.isHovered = ko.observable(false);
self.created_at = ko.observable(moment.utc().format('YYYY-MM-DD HH:mm:ss'));
self.task_status_id = ko.observable();
self.mapping = {
'client': {
@ -768,6 +770,9 @@
if (! self.isRunning()) {
self.addTime();
}
if (data.task_status) {
self.task_status_id(data.task_status.public_id);
}
// Trigger isChanged to update
self.client_id.valueHasMutated();
@ -928,7 +933,7 @@
return times;
}
self.matchesFilter = function(filter, filterState) {
self.matchesFilter = function(filter, filterState, filterStatusId) {
if (filter) {
filter = model.filter().toLowerCase();
var parts = filter.split(' ');
@ -964,6 +969,12 @@
return false;
}
if (filterStatusId) {
if (self.task_status_id() != filterStatusId) {
return false;
}
}
return true;
}