+{% set accompanying_course_id = null %}
+{% if activity.accompanyingPeriod %}
+ {% set accompanying_course_id = activity.accompanyingPeriod.id %}
+{% endif %}
+
+
- {% if document.storedObject.isPending %}
-
{{ 'docgen.Doc generation is pending'|trans }}
- {% elseif document.storedObject.isFailure %}
+ {% if document.isPending %}
+
{{ 'docgen.Doc generation is pending'|trans }}
+ {% elseif document.isFailure %}
{{ 'docgen.Doc generation failed'|trans }}
{% endif %}
- {{ document.storedObject.title }}
+ {{ document.title }}
-
- {{ 'chill_calendar.Document'|trans }}
-
- {% if document.storedObject.hasTemplate %}
+ {% if document.hasTemplate %}
-
{{ document.storedObject.template.name|localize_translatable_string }}
+
{{ document.template.name|localize_translatable_string }}
{% endif %}
@@ -28,7 +33,7 @@
- {{ document.storedObject.createdAt|format_date('short') }}
+ {{ document.createdAt|format_date('short') }}
@@ -36,15 +41,15 @@
-
- {% if c.endDate.diff(c.startDate).days >= 1 %}
- {{ c.startDate|format_datetime('short', 'short') }}
- - {{ c.endDate|format_datetime('short', 'short') }}
- {% else %}
- {{ c.startDate|format_datetime('short', 'short') }}
- - {{ c.endDate|format_datetime('none', 'short') }}
- {% endif %}
-
+
+
+
+ {{ activity.type.name | localize_translatable_string }}
+ {% if activity.emergency %}
+ {{ 'Emergency'|trans|upper }}
+ {% endif %}
+
+
@@ -53,17 +58,19 @@
{{ mmm.createdBy(document) }}
- -
- {{ chill_entity_workflow_list('Chill\\PersonBundle\\Entity\\AccompanyingPeriod\\AccompanyingPeriodWorkEvaluationDocument', document.id) }}
-
- {% if is_granted('CHILL_CALENDAR_DOC_SEE', document) %}
+ {% if is_granted('CHILL_ACTIVITY_SEE_DETAILS', activity) %}
-
- {{ document.storedObject|chill_document_button_group(document.storedObject.title, is_granted('CHILL_CALENDAR_CALENDAR_EDIT', c)) }}
+ {{ document|chill_document_button_group(document.title, is_granted('CHILL_ACTIVITY_UPDATE', activity), {small: false}) }}
{% endif %}
- {% if is_granted('CHILL_CALENDAR_CALENDAR_EDIT', c) %}
+ {% if is_granted('CHILL_ACTIVITY_SEE', activity)%}
-
-
+
+
+ {% endif %}
+ {% if is_granted('CHILL_ACTIVITY_UPDATE', activity) %}
+ -
+
{% endif %}
diff --git a/src/Bundle/ChillActivityBundle/Service/GenericDoc/Providers/AccompanyingPeriodActivityGenericDocProvider.php b/src/Bundle/ChillActivityBundle/Service/GenericDoc/Providers/AccompanyingPeriodActivityGenericDocProvider.php
index bf7a022f1..8c787fd3a 100644
--- a/src/Bundle/ChillActivityBundle/Service/GenericDoc/Providers/AccompanyingPeriodActivityGenericDocProvider.php
+++ b/src/Bundle/ChillActivityBundle/Service/GenericDoc/Providers/AccompanyingPeriodActivityGenericDocProvider.php
@@ -27,32 +27,19 @@ final class AccompanyingPeriodActivityGenericDocProvider implements GenericDocFo
{
public const KEY = 'accompanying_period_activity_document';
- private EntityManagerInterface $em;
-
- private Security $security;
-
- public function __construct(Security $security, EntityManagerInterface $entityManager)
- {
- $this->em = $entityManager;
- $this->security = $security;
+ public function __construct(
+ private EntityManagerInterface $em,
+ private Security $security
+ ){
}
- /**
- * @param AccompanyingPeriod $accompanyingPeriod
- * @param DateTimeImmutable|null $startDate
- * @param DateTimeImmutable|null $endDate
- * @param string|null $content
- * @param string|null $origin
- * @return FetchQueryInterface
- * @throws MappingException
- */
public function buildFetchQueryForAccompanyingPeriod(AccompanyingPeriod $accompanyingPeriod, ?DateTimeImmutable $startDate = null, ?DateTimeImmutable $endDate = null, ?string $content = null, ?string $origin = null): FetchQueryInterface
{
$storedObjectMetadata = $this->em->getClassMetadata(StoredObject::class);
$query = new FetchQuery(
self::KEY,
- "jsonb_build_object('id', doc_obj.id)",
+ "jsonb_build_object('id', doc_obj.id, 'activity_id', activity.id)",
'doc_obj.'.$storedObjectMetadata->getColumnName('createdAt'),
$storedObjectMetadata->getSchemaName().'.'.$storedObjectMetadata->getTableName().' AS doc_obj'
);
diff --git a/src/Bundle/ChillActivityBundle/Service/GenericDoc/Renderers/AccompanyingPeriodActivityGenericDocRenderer.php b/src/Bundle/ChillActivityBundle/Service/GenericDoc/Renderers/AccompanyingPeriodActivityGenericDocRenderer.php
index f243fb941..f3b70dac2 100644
--- a/src/Bundle/ChillActivityBundle/Service/GenericDoc/Renderers/AccompanyingPeriodActivityGenericDocRenderer.php
+++ b/src/Bundle/ChillActivityBundle/Service/GenericDoc/Renderers/AccompanyingPeriodActivityGenericDocRenderer.php
@@ -36,13 +36,13 @@ final class AccompanyingPeriodActivityGenericDocRenderer implements GenericDocRe
public function getTemplate(GenericDocDTO $genericDocDTO, $options = []): string
{
- return '@ChillCalendar/GenericDoc/activity_document.html.twig';
+ return '@ChillActivity/GenericDoc/activity_document.html.twig';
}
public function getTemplateData(GenericDocDTO $genericDocDTO, $options = []): array
{
return [
- 'activity' => $this->activityRepository->findOneByDocument($genericDocDTO->identifiers['id']),
+ 'activity' => $this->activityRepository->find($genericDocDTO->identifiers['activity_id']),
'document' => $this->objectRepository->find($genericDocDTO->identifiers['id'])
];
}
diff --git a/src/Bundle/ChillActivityBundle/config/services.yaml b/src/Bundle/ChillActivityBundle/config/services.yaml
index d55f86d4f..18be76ec9 100644
--- a/src/Bundle/ChillActivityBundle/config/services.yaml
+++ b/src/Bundle/ChillActivityBundle/config/services.yaml
@@ -38,3 +38,6 @@ services:
Chill\ActivityBundle\Service\EntityInfo\:
resource: '../Service/EntityInfo/'
+
+ Chill\ActivityBundle\Service\GenericDoc\:
+ resource: '../Service/GenericDoc/'