mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-20 16:40:55 -04:00
Working on task kanban
This commit is contained in:
parent
543c80564c
commit
eb41340b03
@ -247,21 +247,25 @@ class Task extends EntityModel
|
||||
return $statuses;
|
||||
}
|
||||
|
||||
public static function calcStatusLabel($isRunning, $balance, $invoiceNumber)
|
||||
public static function calcStatusLabel($isRunning, $balance, $invoiceNumber, $taskStatus)
|
||||
{
|
||||
if ($invoiceNumber) {
|
||||
if (floatval($balance) > 0) {
|
||||
$label = 'invoiced';
|
||||
$label = trans('texts.invoiced');
|
||||
} else {
|
||||
$label = 'paid';
|
||||
$label = trans('texts.paid');
|
||||
}
|
||||
} elseif ($isRunning) {
|
||||
$label = 'running';
|
||||
} elseif ($taskStatus) {
|
||||
$label = $taskStatus;
|
||||
} else {
|
||||
$label = 'logged';
|
||||
$label = trans('texts.logged');
|
||||
}
|
||||
|
||||
return trans("texts.{$label}");
|
||||
if ($isRunning) {
|
||||
$label .= ' | ' . trans('texts.running');
|
||||
}
|
||||
|
||||
return $label;
|
||||
}
|
||||
|
||||
public static function calcStatusClass($isRunning, $balance, $invoiceNumber)
|
||||
@ -275,7 +279,7 @@ class Task extends EntityModel
|
||||
} elseif ($isRunning) {
|
||||
return 'primary';
|
||||
} else {
|
||||
return 'warning';
|
||||
return 'info';
|
||||
}
|
||||
}
|
||||
|
||||
@ -302,7 +306,9 @@ class Task extends EntityModel
|
||||
$invoiceNumber = false;
|
||||
}
|
||||
|
||||
return static::calcStatusLabel($this->is_running, $balance, $invoiceNumber);
|
||||
$taskStatus = $this->task_status ? $this->task_status->name : false;
|
||||
|
||||
return static::calcStatusLabel($this->is_running, $balance, $invoiceNumber, $taskStatus);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,11 @@ class TaskDatatable extends EntityDatatable
|
||||
[
|
||||
'duration',
|
||||
function ($model) {
|
||||
return Utils::formatTime(Task::calcDuration($model));
|
||||
if (! Auth::user()->can('viewByOwner', [ENTITY_EXPENSE, $model->user_id])) {
|
||||
return Utils::formatTime(Task::calcDuration($model));
|
||||
}
|
||||
|
||||
return link_to("tasks/{$model->public_id}/edit", Utils::formatTime(Task::calcDuration($model)))->toHtml();
|
||||
},
|
||||
],
|
||||
[
|
||||
@ -120,7 +124,7 @@ class TaskDatatable extends EntityDatatable
|
||||
|
||||
private function getStatusLabel($model)
|
||||
{
|
||||
$label = Task::calcStatusLabel($model->is_running, $model->balance, $model->invoice_number);
|
||||
$label = Task::calcStatusLabel($model->is_running, $model->balance, $model->invoice_number, $model->task_status);
|
||||
$class = Task::calcStatusClass($model->is_running, $model->balance, $model->invoice_number);
|
||||
|
||||
return "<h4><div class=\"label label-{$class}\">$label</div></h4>";
|
||||
|
@ -25,6 +25,7 @@ class TaskRepository extends BaseRepository
|
||||
->leftJoin('contacts', 'contacts.client_id', '=', 'clients.id')
|
||||
->leftJoin('invoices', 'invoices.id', '=', 'tasks.invoice_id')
|
||||
->leftJoin('projects', 'projects.id', '=', 'tasks.project_id')
|
||||
->leftJoin('task_statuses', 'task_statuses.id', '=', 'tasks.task_status_id')
|
||||
->where('tasks.account_id', '=', Auth::user()->account_id)
|
||||
->where(function ($query) { // handle when client isn't set
|
||||
$query->where('contacts.is_primary', '=', true)
|
||||
@ -56,7 +57,8 @@ class TaskRepository extends BaseRepository
|
||||
'tasks.user_id',
|
||||
'projects.name as project',
|
||||
'projects.public_id as project_public_id',
|
||||
'projects.user_id as project_user_id'
|
||||
'projects.user_id as project_user_id',
|
||||
'task_statuses.name as task_status'
|
||||
);
|
||||
|
||||
if ($clientPublicId) {
|
||||
|
@ -36,7 +36,7 @@ class AddRemember2faToken extends Migration
|
||||
});
|
||||
|
||||
Schema::table('tasks', function ($table) {
|
||||
$table->unsignedInteger('task_status_id')->nullable();
|
||||
$table->unsignedInteger('task_status_id')->index()->nullable();
|
||||
$table->smallInteger('task_status_sort_order')->default(0);
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user