1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-14 15:13:29 +01:00
invoiceninja/app/Ninja/Presenters/ProjectPresenter.php
2017-12-25 12:24:39 +02: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;
}
}
}