1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-08 20:22:42 +01:00
invoiceninja/app/Ninja/Presenters/ProjectPresenter.php
2019-01-30 22:25:37 +11:00

51 lines
1.1 KiB
PHP

<?php
namespace App\Ninja\Presenters;
use Utils;
class ProjectPresenter extends EntityPresenter
{
public function calendarEvent($subColors = false)
{
$data = parent::calendarEvent();
$project = $this->entity;
$data->title = trans('texts.project') . ': ' . $project->name;
$data->start = $project->due_date;
if ($subColors) {
$data->borderColor = $data->backgroundColor = Utils::brewerColor($project->public_id);
} else {
$data->borderColor = $data->backgroundColor = '#676767';
}
return $data;
}
/**
* @return string
*/
public function taskRate()
{
if (floatval($this->entity->task_rate)) {
return Utils::roundSignificant($this->entity->task_rate);
} else {
return '';
}
}
/**
* @return string
*/
public function defaultTaskRate()
{
if ($rate = $this->taskRate()) {
return $rate;
} else {
return $this->entity->client->present()->defaultTaskRate;
}
}
}