mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
fix misc in activity (WIP)
This commit is contained in:
parent
a947634f30
commit
0aa909f060
@ -31,7 +31,6 @@ use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
use Chill\MainBundle\Form\Type\UserPickerType;
|
||||
use Chill\MainBundle\Form\Type\ScopePickerType;
|
||||
use Chill\MainBundle\Form\Type\ChillDateType;
|
||||
|
||||
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
|
||||
use Symfony\Component\Form\CallbackTransformer;
|
||||
use Chill\PersonBundle\Form\DataTransformer\PersonToIdTransformer;
|
||||
@ -104,7 +103,7 @@ class ActivityType extends AbstractType
|
||||
if ($options['accompanyingPeriod']) {
|
||||
$accompanyingPeriod = $options['accompanyingPeriod'];
|
||||
}
|
||||
|
||||
dump($options['data']->getType());
|
||||
if ($activityType->isVisible('socialIssues') && $accompanyingPeriod) {
|
||||
$builder->add('socialIssues', EntityType::class, [
|
||||
'label' => $activityType->getLabel('socialIssues'),
|
||||
@ -255,6 +254,8 @@ class ActivityType extends AbstractType
|
||||
'label' => $activityType->getLabel('documents'),
|
||||
'required' => $activityType->isRequired('documents'),
|
||||
'allow_add' => true,
|
||||
'button_add_label' => 'activity.Insert a document',
|
||||
'button_remove_label' => 'activity.Remove a document'
|
||||
]);
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ class AccompanyingCourseMenuBuilder implements LocalMenuBuilderInterface
|
||||
{
|
||||
$period = $parameters['accompanyingCourse'];
|
||||
|
||||
$menu->addChild($this->translator->trans('List of activities'), [
|
||||
$menu->addChild($this->translator->trans('Activity list'), [
|
||||
'route' => 'chill_activity_activity_list',
|
||||
'routeParameters' => [
|
||||
'accompanying_period_id' => $period->getId(),
|
||||
|
@ -19,12 +19,12 @@
|
||||
{{ form_row(edit_form.scope) }}
|
||||
{% endif %}
|
||||
|
||||
{%- if form.socialActions is defined -%}
|
||||
{{ form_row(form.socialActions) }}
|
||||
{%- if edit_form.socialActions is defined -%}
|
||||
{{ form_row(edit_form.socialActions) }}
|
||||
{% endif %}
|
||||
|
||||
{%- if form.socialIssues is defined -%}
|
||||
{{ form_row(form.socialIssues) }}
|
||||
{%- if edit_form.socialIssues is defined -%}
|
||||
{{ form_row(edit_form.socialIssues) }}
|
||||
{% endif %}
|
||||
|
||||
{%- if edit_form.reasons is defined -%}
|
||||
@ -86,7 +86,6 @@
|
||||
{% set accompanying_course_id = accompanyingCourse.id %}
|
||||
{% endif %}
|
||||
|
||||
{{ form_widget(edit_form) }}
|
||||
<ul class="record_actions sticky-form-buttons">
|
||||
<li class="cancel">
|
||||
<a href="{{ path('chill_activity_activity_show', { 'id': entity.id, 'person_id': person_id, 'accompanying_period_id': accompanying_course_id } ) }}" class="sc-button bt-cancel">
|
||||
|
@ -30,21 +30,24 @@
|
||||
</thead>
|
||||
-->
|
||||
{% for activity in activities %}
|
||||
{% set t = activity.type %}
|
||||
<div class="item-bloc">
|
||||
<div class="item-row main">
|
||||
<div class="item-col">
|
||||
|
||||
|
||||
{% if activity.date %}
|
||||
<h3>{{ activity.date|format_date('long') }}</h3>
|
||||
{% endif %}
|
||||
|
||||
|
||||
<div class="duration">
|
||||
{% if t.durationTimeVisible > 0 %}
|
||||
<p>
|
||||
<i class="fa fa-fw fa-hourglass-end"></i>
|
||||
{{ activity.durationTime|date('H:i') }}
|
||||
</p>
|
||||
{% endif %}
|
||||
|
||||
{% if activity.travelTime %}
|
||||
{% if activity.travelTime and t.travelTimeVisible %}
|
||||
<p>
|
||||
<i class="fa fa-fw fa-car"></i>
|
||||
{{ activity.travelTime|date('H:i') }}
|
||||
@ -55,8 +58,7 @@
|
||||
</div>
|
||||
<div class="item-col">
|
||||
<ul class="list-content">
|
||||
|
||||
{% if activity.user %}
|
||||
{% if activity.user and t.userVisible %}
|
||||
<li>
|
||||
<b>{{ 'by'|trans }}{{ activity.user.usernameCanonical }}</b>
|
||||
</li>
|
||||
@ -65,7 +67,7 @@
|
||||
<li>
|
||||
<b>{{ activity.type.name | localize_translatable_string }}</b>
|
||||
|
||||
{% if activity.attendee is not null %}
|
||||
{% if activity.attendee is not null and t.attendeeVisible %}
|
||||
{% if activity.attendee %}
|
||||
{{ '→ ' ~ 'present'|trans|capitalize }}
|
||||
{% else %}
|
||||
@ -82,7 +84,7 @@
|
||||
#}
|
||||
</li>
|
||||
|
||||
{%- if activity.reasons is defined -%}
|
||||
{%- if t.reasonsVisible -%}
|
||||
<li>
|
||||
{%- if activity.reasons is empty -%}
|
||||
<span class="chill-no-data-statement">{{ 'No reason associated'|trans }}</span>
|
||||
@ -94,24 +96,19 @@
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{%- if activity.socialIssues is defined -%}
|
||||
{%- if t.socialIssuesVisible %}
|
||||
<li class="social-issues">
|
||||
{%- if activity.socialIssues is empty -%}
|
||||
<span class="chill-no-data-statement">{{ 'No social issues associated'|trans }}</span>
|
||||
{%- else -%}
|
||||
{% for r in activity.socialIssues %}
|
||||
<span class="badge badge-primary">
|
||||
{% if r.parent %}
|
||||
{{ r.parent.title|localize_translatable_string ~ ' > ' }}
|
||||
{% endif %}
|
||||
{{ r.title|localize_translatable_string }}
|
||||
</span>
|
||||
{{ r|chill_entity_render_box }}
|
||||
{% endfor %}
|
||||
{%- endif -%}
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{%- if activity.socialActions is defined -%}
|
||||
{%- if t.socialActionsVisible -%}
|
||||
<li class="social-actions">
|
||||
{%- if activity.socialActions is empty -%}
|
||||
<span class="chill-no-data-statement">{{ 'No social actions associated'|trans }}</span>
|
||||
|
@ -78,7 +78,23 @@
|
||||
|
||||
.. status
|
||||
|
||||
<div class="grid-12 centered sticky-form-buttons">
|
||||
<button class="sc-button green margin-10" type="submit"><i class="fa fa-save"></i> {{ 'Add a new activity'|trans }}</button>
|
||||
</div>
|
||||
<ul class="record_actions sticky-form-buttons">
|
||||
<li class="cancel">
|
||||
<a
|
||||
class="sc-button bt-cancel"
|
||||
{%- if context == 'person' -%}
|
||||
href="{{ chill_return_path_or('chill_activity_activity_list', { 'person_id': person.id } )}}"
|
||||
{%- else -%}
|
||||
href="{{ chill_return_path_or('chill_activity_activity_list', { 'accompanying_period_id': accompanyingCourse.id } )}}"
|
||||
{%- endif -%}
|
||||
>
|
||||
{{ 'Cancel'|trans|chill_return_path_label }}
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<button class="sc-button bt-create" type="submit">
|
||||
{{ 'Add a new activity'|trans }}
|
||||
</button>
|
||||
</li>
|
||||
</ul>
|
||||
{{ form_end(form) }}
|
||||
|
@ -6,11 +6,11 @@
|
||||
|
||||
{% block content %}
|
||||
<div id="activity"></div> {# <=== vue component #}
|
||||
{% include 'ChillActivityBundle:Activity:new.html.twig' %}
|
||||
{% include 'ChillActivityBundle:Activity:new.html.twig' with {'context': 'accompanyingCourse'} %}
|
||||
{% endblock %}
|
||||
|
||||
{% block js %}
|
||||
<script src="{{ asset('build/async_upload.js') }}" type="text/javascript"></script>
|
||||
{{ encore_entry_script_tags('async_upload') }}
|
||||
<script type="text/javascript">
|
||||
chill.displayAlertWhenLeavingUnsubmittedForm('form[name="{{ form.vars.form.vars.name }}"]',
|
||||
'{{ "You are going to leave a page with unsubmitted data. Are you sure you want to leave ?"|trans }}');
|
||||
|
@ -5,7 +5,7 @@
|
||||
{% block title 'Activity creation' |trans %}
|
||||
|
||||
{% block personcontent %}
|
||||
{% include 'ChillActivityBundle:Activity:new.html.twig' %}
|
||||
{% include 'ChillActivityBundle:Activity:new.html.twig' with {'context': 'person'} %}
|
||||
<div id="activity"></div> {# <=== vue component #}
|
||||
{% endblock %}
|
||||
|
||||
|
@ -1,48 +1,102 @@
|
||||
<h1 >{{ "Activity"|trans }}</h1>
|
||||
{%- set t = entity.type -%}
|
||||
{%- import "@ChillDocStore/Macro/macro.html.twig" as m -%}
|
||||
|
||||
<h1>
|
||||
{{ "Activity"|trans }}
|
||||
{%- if t.emergencyVisible and entity.emergency -%}
|
||||
<span class="badge badge-secondary">
|
||||
{{- 'Emergency'|trans -}}
|
||||
</span>
|
||||
{%- endif -%}
|
||||
</h1>
|
||||
|
||||
<dl class="chill_view_data">
|
||||
<dt class="inline">{{ 'User'|trans }}</dt>
|
||||
|
||||
<dt class="inline">{{ 'by'|trans|capitalize }}</dt>
|
||||
<dd>{{ entity.user }}</dd>
|
||||
|
||||
<dt class="inline">{{ 'Type'|trans }}</dt>
|
||||
<dd>{{ entity.type.name | localize_translatable_string }}</dd>
|
||||
|
||||
{%- if entity.scope -%}
|
||||
<dt class="inline">{{ 'Scope'|trans }}</dt>
|
||||
<dd><span class="scope">{{ entity.scope.name|localize_translatable_string }}</span></dd>
|
||||
{% endif %}
|
||||
</dl>
|
||||
|
||||
<h2 class="chill-red">{{ 'Concerned groups'|trans }}</h2>
|
||||
{% include 'ChillActivityBundle:Activity:concernedGroups.html.twig' with {'context': context, 'with_display': 'bloc' } %}
|
||||
|
||||
<h2 class="chill-red">{{ 'Activity data'|trans }}</h2>
|
||||
<dl class="chill_view_data">
|
||||
|
||||
{%- if entity.person is defined -%}
|
||||
<dt class="inline">{{ 'Person'|trans }}</dt>
|
||||
<dd>{{ entity.person }}</dd>
|
||||
{% if t.socialIssuesVisible %}
|
||||
<dt class="inline">{{ 'Social issues'|trans }}</dt>
|
||||
<dd>
|
||||
{% if entity.socialIssues|length == 0 %}
|
||||
<p class="chill-no-data-statement">{{ 'Any social issues'|trans }}</p>
|
||||
{% else %}
|
||||
{% for si in entity.socialIssues %}{{ si|chill_entity_render_box }}{% endfor %}
|
||||
{% endif %}
|
||||
</dd>
|
||||
{% endif %}
|
||||
|
||||
<dt class="inline">{{ 'Date'|trans }}</dt>
|
||||
<dd>{{ entity.date|format_date('long') }}</dd>
|
||||
<dt class="inline">{{ 'Duration Time'|trans }}</dt>
|
||||
<dd>{{ entity.durationTime|date('H:i') }}</dd>
|
||||
<dt class="inline">{{ 'Type'|trans }}</dt>
|
||||
<dd>{{ entity.type.name | localize_translatable_string }}</dd>
|
||||
|
||||
<dt class="inline">{{ 'Attendee'|trans }}</dt>
|
||||
<dd>{% if entity.attendee is not null %}{% if entity.attendee %}{{ 'present'|trans|capitalize }} {% else %} {{ 'not present'|trans|capitalize }}{% endif %}{% else %}{{ 'None'|trans|capitalize }}{% endif %}</dd>
|
||||
{% if t.socialActionsVisible %}
|
||||
<dt class="inline">{{ 'Social actions'|trans }}</dt>
|
||||
<dd>
|
||||
{% if entity.socialActions|length == 0 %}
|
||||
<p class="chill-no-data-statement">{{ 'Any social actions'|trans }}</p>
|
||||
{% else %}
|
||||
{% for sa in entity.socialActions %}{{ sa|chill_entity_render_box }}{% endfor %}
|
||||
{% endif %}
|
||||
</dd>
|
||||
{% endif %}
|
||||
|
||||
{% if t.reasonsVisible %}
|
||||
<dt class="inline">{{ 'Reasons'|trans }}</dt>
|
||||
{%- if entity.reasons is empty -%}
|
||||
<dd><span class="chill-no-data-statement">{{ 'No reason associated'|trans }}</span></dd>
|
||||
{%- else -%}
|
||||
<dd>{% for r in entity.reasons %}{{ r|chill_entity_render_box }} {% endfor %}</dd>
|
||||
{%- endif -%}
|
||||
{% endif %}
|
||||
|
||||
<h2 class="chill-red">{{ 'Concerned groups'|trans }}</h2>
|
||||
{% include 'ChillActivityBundle:Activity:concernedGroups.html.twig' with {'context': context, 'with_display': 'bloc' } %}
|
||||
|
||||
<h2 class="chill-red">{{ 'Activity data'|trans }}</h2>
|
||||
|
||||
<dt class="inline">{{ 'Date'|trans }}</dt>
|
||||
<dd>{{ entity.date|format_date('long') }}</dd>
|
||||
|
||||
{% if t.durationTimeVisible %}
|
||||
<dt class="inline">{{ 'Duration Time'|trans }}</dt>
|
||||
<dd>{{ entity.durationTime|date('H:i') }}</dd>
|
||||
{% endif %}
|
||||
|
||||
{% if t.travelTimeVisible %}
|
||||
<dt class="inline">{{ 'Travel Time'|trans }}</dt>
|
||||
<dd>{{ entity.travelTime|date('H:i') }}</dd>
|
||||
{% endif %}
|
||||
|
||||
{% if t.commentVisible %}
|
||||
<dt class="inline">{{ 'Comment'|trans }}</dt>
|
||||
{%- if entity.comment is empty -%}
|
||||
<dd><span class="chill-no-data-statement">{{ 'No comment associated'|trans }}</span></dd>
|
||||
{%- else -%}
|
||||
<dd>{{ entity.comment|chill_entity_render_box }}</dd>
|
||||
{%- endif -%}
|
||||
{%- if entity.comment.empty -%}
|
||||
<dd><span class="chill-no-data-statement">{{ 'No comment associated'|trans }}</span></dd>
|
||||
{%- else -%}
|
||||
<dd>{{ entity.comment|chill_entity_render_box }}</dd>
|
||||
{%- endif -%}
|
||||
{% endif %}
|
||||
|
||||
{% if t.documentsVisible and entity.documents|length > 0 %}
|
||||
<dt>{{ 'Documents'|trans }}</dt>
|
||||
<dd>
|
||||
<ul>
|
||||
{% for d in entity.documents %}
|
||||
<li>{{ m.download_button(d) }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</dd>
|
||||
{% endif %}
|
||||
|
||||
{% if t.attendeeVisible %}
|
||||
<dt class="inline">{{ 'Attendee'|trans }}</dt>
|
||||
<dd>{% if entity.attendee is not null %}{% if entity.attendee %}{{ 'present'|trans|capitalize }} {% else %} {{ 'not present'|trans|capitalize }}{% endif %}{% else %}{{ 'None'|trans|capitalize }}{% endif %}</dd>
|
||||
{% endif %}
|
||||
|
||||
</dl>
|
||||
|
||||
{% set person_id = null %}
|
||||
|
@ -71,6 +71,9 @@ Third persons: Tiers non-pro.
|
||||
Others persons: Usagers
|
||||
Third parties: Tiers professionnels
|
||||
Users concerned: T(M)S
|
||||
activity:
|
||||
Insert a document: Insérer un document
|
||||
Remove a document: Supprimer le document
|
||||
|
||||
|
||||
#timeline
|
||||
|
@ -37,6 +37,11 @@ class CommentEmbeddable
|
||||
return $this->comment;
|
||||
}
|
||||
|
||||
public function isEmpty()
|
||||
{
|
||||
return empty($this->getComment());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $comment
|
||||
*/
|
||||
|
@ -52,6 +52,9 @@ Centers: Centres
|
||||
comment: commentaire
|
||||
Comment: Commentaire
|
||||
|
||||
# comment embeddable
|
||||
No comment associated: Aucun commentaire
|
||||
|
||||
#pagination
|
||||
Previous: Précédent
|
||||
Next: Suivant
|
||||
|
@ -0,0 +1,13 @@
|
||||
{% set reversed_parents = parents|reverse %}
|
||||
<span class="chill-entity chill-entity__social-action">
|
||||
<span class="badge badge-primary">
|
||||
{%- for p in reversed_parents %}
|
||||
<span class="chill-entity__social-action__parent--{{ loop.revindex0 }}">
|
||||
{{ p.title|localize_translatable_string }}{{ options['default.separator'] }}
|
||||
</span>
|
||||
{%- endfor -%}
|
||||
<span class="chill-entity__social-action__child">
|
||||
{{ socialIssue.title|localize_translatable_string }}
|
||||
</span>
|
||||
</span>
|
||||
</span>
|
@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
namespace Chill\PersonBundle\Templating\Entity;
|
||||
|
||||
use Chill\MainBundle\Templating\Entity\ChillEntityRenderInterface;
|
||||
use Chill\PersonBundle\Entity\SocialWork\SocialAction;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||
use Symfony\Component\Templating\EngineInterface;
|
||||
|
||||
class SocialActionRender implements ChillEntityRenderInterface
|
||||
{
|
||||
private TranslatableStringHelper $translatableStringHelper;
|
||||
private EngineInterface $engine;
|
||||
|
||||
public const SEPARATOR_KEY = 'default.separator';
|
||||
|
||||
public const DEFAULT_ARGS = [
|
||||
self::SEPARATOR_KEY => ' > ',
|
||||
];
|
||||
|
||||
public function __construct(TranslatableStringHelper $translatableStringHelper, EngineInterface $engine)
|
||||
{
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
$this->engine = $engine;
|
||||
}
|
||||
|
||||
public function supports($entity, array $options): bool
|
||||
{
|
||||
return $entity instanceof SocialAction;
|
||||
}
|
||||
|
||||
public function renderString($socialAction, array $options): string
|
||||
{
|
||||
/** @var $socialAction SocialAction */
|
||||
$options = \array_merge(self::DEFAULT_ARGS, $options);
|
||||
|
||||
$str = $this->translatableStringHelper->localize($socialAction->getTitle());
|
||||
|
||||
while ($socialAction->hasParent()) {
|
||||
$socialAction = $socialAction->getParent();
|
||||
$str .= $options[self::SEPARATOR_KEY].$this->translatableStringHelper->localize(
|
||||
$socialAction->getTitle()
|
||||
);
|
||||
}
|
||||
|
||||
return $str;
|
||||
}
|
||||
|
||||
protected function buildParents($socialAction): array
|
||||
{
|
||||
$parents = [];
|
||||
while ($socialAction->hasParent()) {
|
||||
$socialAction = $parents[] = $socialAction->getParent();
|
||||
}
|
||||
|
||||
return $parents;
|
||||
}
|
||||
|
||||
public function renderBox($socialAction, array $options): string
|
||||
{
|
||||
$options = \array_merge(self::DEFAULT_ARGS, $options);
|
||||
// give some help to twig: an array of parents
|
||||
$parents = $this->buildParents($socialAction);
|
||||
|
||||
return $this->engine->render('@ChillPerson/Entity/social_action.html.twig', [
|
||||
'socialAction' => $socialAction,
|
||||
'parents' => $parents,
|
||||
'options' => $options
|
||||
]);
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace Chill\PersonBundle\Validator\Constraints\Household;
|
||||
|
||||
class MaxHolderValidator
|
||||
{
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user