mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-08 17:14:31 -04:00
Display client task rate in projects datatable (#2879)
* Display client task rate in projects datatable Displays the client task rate in the projects datatable if a project rate has not been set. Also adds an icon indicating what type of rate is being used. Fixes #2527 * Added account task rate display to project datatable
This commit is contained in:
parent
2124417c31
commit
3335f78e52
@ -55,7 +55,21 @@ class ProjectDatatable extends EntityDatatable
|
||||
[
|
||||
'task_rate',
|
||||
function ($model) {
|
||||
return floatval($model->task_rate) ? Utils::formatMoney($model->task_rate) : '';
|
||||
$taskRate = 0.0000;
|
||||
$taskRateIcon = '';
|
||||
|
||||
if($model->task_rate !== '0.0000') {
|
||||
$taskRate = $model->task_rate;
|
||||
$taskRateIcon = '<i class="fa fa-briefcase"></i> ';
|
||||
} elseif($model->client_task_rate !== '0.0000') {
|
||||
$taskRate = $model->client_task_rate;
|
||||
$taskRateIcon = '<i class="fa fa-user"></i> ';
|
||||
} elseif($model->account_task_rate !== '0.0000') {
|
||||
$taskRate = $model->account_task_rate;
|
||||
$taskRateIcon = '<i class="fa fa-cog"></i> ';
|
||||
}
|
||||
|
||||
return floatval($taskRate) ? $taskRateIcon . Utils::formatMoney($taskRate) : '';
|
||||
}
|
||||
],
|
||||
];
|
||||
|
@ -23,6 +23,7 @@ class ProjectRepository extends BaseRepository
|
||||
{
|
||||
$query = DB::table('projects')
|
||||
->where('projects.account_id', '=', Auth::user()->account_id)
|
||||
->join('accounts', 'accounts.id', '=', 'projects.account_id')
|
||||
->leftjoin('clients', 'clients.id', '=', 'projects.client_id')
|
||||
->leftJoin('contacts', 'contacts.client_id', '=', 'clients.id')
|
||||
->where('contacts.deleted_at', '=', null)
|
||||
@ -43,7 +44,9 @@ class ProjectRepository extends BaseRepository
|
||||
'projects.private_notes',
|
||||
DB::raw("COALESCE(NULLIF(clients.name,''), NULLIF(CONCAT(contacts.first_name, ' ', contacts.last_name),''), NULLIF(contacts.email,'')) client_name"),
|
||||
'clients.user_id as client_user_id',
|
||||
'clients.public_id as client_public_id'
|
||||
'clients.public_id as client_public_id',
|
||||
'clients.task_rate as client_task_rate',
|
||||
'accounts.task_rate as account_task_rate'
|
||||
);
|
||||
|
||||
$this->applyFilters($query, ENTITY_PROJECT);
|
||||
|
Loading…
x
Reference in New Issue
Block a user