2017-01-22 11:09:29 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Ninja\Reports;
|
|
|
|
|
|
|
|
use App\Models\Task;
|
2017-01-30 20:40:43 +01:00
|
|
|
use Utils;
|
2017-01-22 11:09:29 +01:00
|
|
|
|
|
|
|
class TaskReport extends AbstractReport
|
|
|
|
{
|
|
|
|
public $columns = [
|
|
|
|
'client',
|
|
|
|
'date',
|
|
|
|
'project',
|
|
|
|
'description',
|
|
|
|
'duration',
|
|
|
|
];
|
|
|
|
|
|
|
|
public function run()
|
|
|
|
{
|
|
|
|
$tasks = Task::scope()
|
2017-03-31 08:01:07 +02:00
|
|
|
->orderBy('created_at', 'desc')
|
2017-01-22 11:09:29 +01:00
|
|
|
->with('client.contacts')
|
|
|
|
->withArchived()
|
|
|
|
->dateRange($this->startDate, $this->endDate);
|
|
|
|
|
|
|
|
foreach ($tasks->get() as $task) {
|
|
|
|
$this->data[] = [
|
|
|
|
$task->client ? ($this->isExport ? $task->client->getDisplayName() : $task->client->present()->link) : trans('texts.unassigned'),
|
2017-08-27 22:18:10 +02:00
|
|
|
$this->isExport ? $task->getStartTime() : link_to($task->present()->url, $task->getStartTime()),
|
2017-01-22 11:09:29 +01:00
|
|
|
$task->present()->project,
|
2017-08-27 22:16:41 +02:00
|
|
|
$task->description,
|
2017-01-22 11:09:29 +01:00
|
|
|
Utils::formatTime($task->getDuration()),
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|