mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-09-19 16:01:34 +02:00
Support /tasks/kanban/{client_id}
This commit is contained in:
parent
27a25d429b
commit
818a781b31
@ -12,7 +12,7 @@ class TaskKanbanController extends BaseController
|
||||
/**
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function index()
|
||||
public function index($clientPublicId = false)
|
||||
{
|
||||
$tasks = Task::scope()
|
||||
->with(['project', 'client', 'task_status'])
|
||||
@ -84,6 +84,7 @@ class TaskKanbanController extends BaseController
|
||||
'tasks' => $tasks,
|
||||
'clients' => $clients,
|
||||
'projects' => $projects,
|
||||
'clientPublicId' => $clientPublicId,
|
||||
];
|
||||
|
||||
return view('tasks.kanban', $data);
|
||||
|
@ -84,7 +84,7 @@
|
||||
});
|
||||
</script>
|
||||
@elseif ($entityType == ENTITY_TASK)
|
||||
{!! Button::normal(trans('texts.kanban'))->asLinkTo(url('/tasks/kanban'))->appendIcon(Icon::create('th')) !!}
|
||||
{!! Button::normal(trans('texts.kanban'))->asLinkTo(url('/tasks/kanban' . (! empty($clientId) ? '/' . $clientId : '')))->appendIcon(Icon::create('th')) !!}
|
||||
{!! Button::normal(trans('texts.time_tracker'))->asLinkTo('javascript:openTimeTracker()')->appendIcon(Icon::create('time')) !!}
|
||||
@endif
|
||||
|
||||
|
@ -121,7 +121,7 @@
|
||||
|
||||
@section('top-right')
|
||||
<div class="form-group">
|
||||
<input type="text" placeholder="{{ trans('texts.filter') }}" id="filter"
|
||||
<input type="text" data-bind="value: filter" placeholder="{{ trans('texts.filter') }}" id="filter"
|
||||
class="form-control" style="background-color: #FFFFFF !important"/>
|
||||
</div>
|
||||
@stop
|
||||
@ -560,14 +560,50 @@
|
||||
function ClientModel(data) {
|
||||
var self = this;
|
||||
self.name = ko.observable();
|
||||
self.contacts = ko.observableArray();
|
||||
|
||||
self.displayName = ko.computed(function() {
|
||||
return self.name();
|
||||
if (self.name()) {
|
||||
return self.name();
|
||||
}
|
||||
|
||||
if (self.contacts().length) {
|
||||
return self.contacts()[0].displayName();
|
||||
}
|
||||
})
|
||||
|
||||
self.mapping = {
|
||||
'contacts': {
|
||||
create: function(options) {
|
||||
return new ContactModel(options.data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (data) {
|
||||
ko.mapping.fromJS(data, self.mapping, this);
|
||||
}
|
||||
}
|
||||
|
||||
function ContactModel(data) {
|
||||
var self = this;
|
||||
self.public_id = ko.observable('');
|
||||
self.first_name = ko.observable('');
|
||||
self.last_name = ko.observable('');
|
||||
self.email = ko.observable('');
|
||||
self.phone = ko.observable('');
|
||||
|
||||
if (data) {
|
||||
ko.mapping.fromJS(data, {}, this);
|
||||
}
|
||||
|
||||
self.displayName = ko.computed(function() {
|
||||
if (self.first_name() || self.last_name()) {
|
||||
return self.first_name() + ' ' + self.last_name();
|
||||
} else {
|
||||
return self.email();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$(function() {
|
||||
@ -610,6 +646,14 @@
|
||||
window.model = new ViewModel();
|
||||
ko.applyBindings(model);
|
||||
|
||||
if ({{ $clientPublicId ? 'true' : 'false' }}) {
|
||||
var client = clientMap[{{ $clientPublicId ?: 0 }}];
|
||||
if (client) {
|
||||
model.filter_client_id({{ $clientPublicId }});
|
||||
model.filter(client.displayName());
|
||||
}
|
||||
}
|
||||
|
||||
$('.kanban').show();
|
||||
});
|
||||
|
||||
|
@ -143,7 +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::get('tasks/kanban/{client_id?}', 'TaskKanbanController@index');
|
||||
Route::post('task_statuses', 'TaskKanbanController@storeStatus');
|
||||
Route::put('task_statuses/{task_status_id}', 'TaskKanbanController@updateStatus');
|
||||
Route::delete('task_statuses/{task_status_id}', 'TaskKanbanController@deleteStatus');
|
||||
|
Loading…
Reference in New Issue
Block a user