layout for rendering list

This commit is contained in:
2023-06-13 15:00:16 +02:00
parent 1f1ebb6adb
commit 909d2dfb60
18 changed files with 162 additions and 52 deletions

View File

@@ -23,4 +23,9 @@ final readonly class GenericDocDTO
public AccompanyingPeriod|Person $linked,
) {
}
public function getContext(): string
{
return $this->linked instanceof AccompanyingPeriod ? 'accompanying-period' : 'person';
}
}

View File

@@ -40,19 +40,20 @@ final readonly class AccompanyingCourseDocumentGenericDocRenderer implements Gen
public function getTemplateData(GenericDocDTO $genericDocDTO, $options = []): array
{
dump($genericDocDTO);
if (AccompanyingCourseDocumentGenericDocProvider::KEY === $genericDocDTO->key) {
return [
'document' => $doc = $this->accompanyingCourseDocumentRepository->find($genericDocDTO->identifiers['id']),
'accompanyingCourse' => $doc->getCourse(),
'options' => $options,
'context' => $genericDocDTO->getContext(),
];
}
// this is a person
return [
'document' => $doc = dump($this->personDocumentRepository->find($genericDocDTO->identifiers['id'])),
'document' => $doc = $this->personDocumentRepository->find($genericDocDTO->identifiers['id']),
'person' => $doc->getPerson(),
'options' => $options,
'context' => $genericDocDTO->getContext(),
];
}
}

View File

@@ -10,8 +10,16 @@
{% elseif document.object.isFailure %}
<div class="badge text-bg-warning">{{ 'docgen.Doc generation failed'|trans }}</div>
{% endif %}
{% if context == 'person' and accompanyingCourse is defined %}
<div>
<span class="badge bg-primary">
<i class="fa fa-random"></i> {{ accompanyingCourse.id }}
</span>&nbsp;
</div>
{% endif %}
<div class="denomination h2">
{{ document.title }}
{{ document.title|chill_print_or_message("No title") }}
</div>
{% if document.object.type is not empty %}
<div>