fix brief and project without client

This commit is contained in:
isUnknown 2024-12-09 18:32:29 +01:00
parent e119aa0417
commit b4bc8e80fe
158 changed files with 292 additions and 5 deletions

View file

@ -7,7 +7,7 @@ function getProjectData($project) {
'modified' => $project->modified('Y-MM-d'),
'currentStep' => $project->currentStep()->value(),
'status' => $project->status(),
'logo' => $project->client()->isNotEmpty() ? $project->client()->toPage()->logo()->toFile()->url() : '',
'logo' => $project->client()->toPage() ? $project->client()->toPage()->logo()->toFile()->url() : '',
'steps' => $project->getSteps()
];
}
@ -15,6 +15,7 @@ function getProjectData($project) {
try {
$children = $kirby->user()->role() == 'admin' ? $page->children()->map(fn($project) => getProjectData($project))->values() : $kirby->user()->projects()->toPages()->map(fn($project) => getProjectData($project))->values();
} catch (\Throwable $th) {
throw new Exception($th->getMessage() . ' line ' . $th->getLine(), 1);
$children = [];
}