Merge branch 'testing' of gitlab.com:Chill-Projet/chill-bundles into testing

This commit is contained in:
Julie Lenaerts 2022-11-21 11:11:57 +01:00
commit 390da7c641
15 changed files with 119 additions and 67 deletions

View File

@ -18,6 +18,7 @@ use Chill\MainBundle\Doctrine\Model\TrackUpdateTrait;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Ramsey\Uuid\Uuid; use Ramsey\Uuid\Uuid;
use Ramsey\Uuid\UuidInterface; use Ramsey\Uuid\UuidInterface;
use Symfony\Component\Validator\Constraints as Assert;
/** /**
* @ORM\Entity * @ORM\Entity
@ -31,6 +32,7 @@ class SavedExport implements TrackCreationInterface, TrackUpdateInterface
/** /**
* @ORM\Column(type="text", nullable=false, options={"default": ""}) * @ORM\Column(type="text", nullable=false, options={"default": ""})
* @Assert\NotBlank
*/ */
private string $description = ''; private string $description = '';
@ -53,6 +55,7 @@ class SavedExport implements TrackCreationInterface, TrackUpdateInterface
/** /**
* @ORM\Column(type="text", nullable=false, options={"default": ""}) * @ORM\Column(type="text", nullable=false, options={"default": ""})
* @Assert\NotBlank
*/ */
private string $title = ''; private string $title = '';
@ -96,9 +99,9 @@ class SavedExport implements TrackCreationInterface, TrackUpdateInterface
return $this->user; return $this->user;
} }
public function setDescription(string $description): SavedExport public function setDescription(?string $description): SavedExport
{ {
$this->description = $description; $this->description = (string) $description;
return $this; return $this;
} }
@ -117,9 +120,9 @@ class SavedExport implements TrackCreationInterface, TrackUpdateInterface
return $this; return $this;
} }
public function setTitle(string $title): SavedExport public function setTitle(?string $title): SavedExport
{ {
$this->title = $title; $this->title = (string) $title;
return $this; return $this;
} }

View File

@ -16,6 +16,8 @@ use Chill\MainBundle\Service\RollingDate\RollingDate;
use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormView;
use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Validator\Constraints\Callback; use Symfony\Component\Validator\Constraints\Callback;
use Symfony\Component\Validator\Context\ExecutionContextInterface; use Symfony\Component\Validator\Context\ExecutionContextInterface;
@ -59,8 +61,13 @@ class PickRollingDateType extends AbstractType
if (RollingDate::T_FIXED_DATE === $data->getRoll() && null === $data->getFixedDate()) { if (RollingDate::T_FIXED_DATE === $data->getRoll() && null === $data->getFixedDate()) {
$context $context
->buildViolation('rolling_date.When fixed date is selected, you must provide a date') ->buildViolation('rolling_date.When fixed date is selected, you must provide a date')
->atPath('roll') ->atPath('fixedDate')
->addViolation(); ->addViolation();
} }
} }
public function buildView(FormView $view, FormInterface $form, array $options)
{
$view->vars['uniqid'] = uniqid('rollingdate-');
}
} }

View File

@ -524,6 +524,7 @@ div.exports-list {
flex-basis: 33%; flex-basis: 33%;
@include media-breakpoint-down(lg) { flex-basis: 50%; } @include media-breakpoint-down(lg) { flex-basis: 50%; }
@include media-breakpoint-down(sm) { flex-basis: 100%; } @include media-breakpoint-down(sm) { flex-basis: 100%; }
div:last-child,
p:last-child { p:last-child {
margin-top: auto; margin-top: auto;
} }

View File

@ -0,0 +1,28 @@
import {ShowHide} from 'ChillMainAssets/lib/show_hide/index';
document.addEventListener('DOMContentLoaded', function(_e) {
console.log('pick-rolling-date');
document.querySelectorAll('div[data-rolling-date]').forEach( (picker) => {
const
roll_wrapper = picker.querySelector('div.roll-wrapper'),
fixed_wrapper = picker.querySelector('div.fixed-wrapper');
new ShowHide({
froms: [roll_wrapper],
container: [fixed_wrapper],
test: function (elems) {
console.log('testing');
console.log('elems', elems);
for (let el of elems) {
for (let select_roll of el.querySelectorAll('select[data-roll-picker]')) {
console.log('select_roll', select_roll);
console.log('value', select_roll.value);
return select_roll.value === 'fixed_date';
}
}
return false;
}
})
});
});

View File

@ -52,20 +52,18 @@
<h2 class="display-6">{{ 'Ungrouped exports'|trans }}</h2> <h2 class="display-6">{{ 'Ungrouped exports'|trans }}</h2>
{% endif %} {% endif %}
<div class="row ungrouped"> <div class="row flex-bloc">
{% for export_alias,export in grouped_exports['_'] %} {% for export_alias,export in grouped_exports['_'] %}
<div class="col-6 col-md-4 mb-3"> <div class="item-bloc">
<div class="card"> <div class="item-row card-body">
<div class="card-body"> <h2 class="card-title">{{ export.title|trans }}</h2>
<h2 class="card-title">{{ export.title|trans }}</h2> <p class="card-text my-3">{{ export.description|trans }}</p>
<p class="card-text">{{ export.description|trans }}</p> <p>
<p> <a class="btn btn-action" href="{{ path('chill_main_export_new', { 'alias': export_alias } ) }}">
<a class="btn btn-action" href="{{ path('chill_main_export_new', { 'alias': export_alias } ) }}"> {{ 'Create an export'|trans }}
{{ 'Create an export'|trans }} </a>
</a> </p>
</p>
</div>
</div> </div>
</div> </div>

View File

@ -22,6 +22,7 @@
{% block css %} {% block css %}
{{ encore_entry_link_tags('mod_pickentity_type') }} {{ encore_entry_link_tags('mod_pickentity_type') }}
{{ encore_entry_link_tags('mod_pick_rolling_date') }}
{% endblock %} {% endblock %}
{% block js %} {% block js %}
@ -30,6 +31,7 @@
{% if export_alias == 'count_social_work_actions' %} {% if export_alias == 'count_social_work_actions' %}
{{ encore_entry_script_tags('vue_export_action_goal_result') }} {{ encore_entry_script_tags('vue_export_action_goal_result') }}
{% endif %} {% endif %}
{{ encore_entry_script_tags('mod_pick_rolling_date') }}
{% endblock js %} {% endblock js %}
{% block content %} {% block content %}

View File

@ -257,3 +257,16 @@
<input type="hidden" {{ block('widget_attributes') }} {% if value is not empty %}value="{{ value }}" {% endif %} data-input-uniqid="{{ form.vars['uniqid'] }}"/> <input type="hidden" {{ block('widget_attributes') }} {% if value is not empty %}value="{{ value }}" {% endif %} data-input-uniqid="{{ form.vars['uniqid'] }}"/>
<div data-module="pick-postal-code" data-uniqid="{{ form.vars['uniqid'] }}"></div> <div data-module="pick-postal-code" data-uniqid="{{ form.vars['uniqid'] }}"></div>
{% endblock %} {% endblock %}
{% block pick_rolling_date_widget %}
<div data-rolling-date="{{ form.vars['uniqid'] }}" class="row">
<div class="roll-wrapper col-sm-6">
{{ form_widget(form.roll, { 'attr': { 'data-roll-picker': 'data-roll-picker'}}) }}
{{ form_errors(form.roll) }}
</div>
<div class="fixed-wrapper col-sm-6">
{{ form_widget(form.fixedDate) }}
{{ form_errors(form.fixedDate) }}
</div>
</div>
{% endblock %}

View File

@ -3,6 +3,7 @@
{% block title %}{{ 'saved_export.Edit'|trans }}{% endblock %} {% block title %}{{ 'saved_export.Edit'|trans }}{% endblock %}
{% block content %} {% block content %}
<div class="col-10">
<h1>{{ block('title') }}</h1> <h1>{{ block('title') }}</h1>
{{ form_start(form) }} {{ form_start(form) }}
@ -18,4 +19,5 @@
</li> </li>
</ul> </ul>
{{ form_end(form) }} {{ form_end(form) }}
</div>
{% endblock %} {% endblock %}

View File

@ -3,7 +3,7 @@
{% block title %}{{ 'saved_export.My saved exports'|trans }}{% endblock %} {% block title %}{{ 'saved_export.My saved exports'|trans }}{% endblock %}
{% block content %} {% block content %}
<div class="col-md-10"> <div class="col-md-10 exports-list">
{{ include('@ChillMain/Export/_navbar.html.twig', {'current' : 'my'}) }} {{ include('@ChillMain/Export/_navbar.html.twig', {'current' : 'my'}) }}
@ -16,26 +16,25 @@
{% for group, saveds in grouped_exports %} {% for group, saveds in grouped_exports %}
{% if group != '_' %} {% if group != '_' %}
<h2 class="display-6">{{ group }}</h2> <h2 class="display-6">{{ group }}</h2>
<div class="row grouped"> <div class="row flex-bloc">
{% for s in saveds %} {% for s in saveds %}
<div class="col-6 col-md-4 mb-3"> <div class="item-bloc">
<div class="card"> <div class="item-row card-body">
<div class="card-body"> <p class="card-subtitle"><strong>{{ s.export.title|trans }}</strong></p>
<h2 class="card-title">{{ s.saved.title }}</h2> <h2 class="card-title">{{ s.saved.title }}</h2>
<p class="card-subtitle"><strong>{{ s.export.title|trans }}</strong></p>
<div class="createdBy">{{ 'saved_export.Created on %date%'|trans({'%date%': s.saved.createdAt|format_datetime('long', 'short')}) }}</div>
<div class="card-text">
{{ s.saved.description|chill_markdown_to_html }} <div class="card-text my-3">
</div> {{ s.saved.description|chill_markdown_to_html }}
</div>
<div class="createdBy">{{ 'saved_export.Created on %date%'|trans({'%date%': s.saved.createdAt|format_datetime('long', 'short')}) }}</div>
<div>
<ul class="record_actions"> <ul class="record_actions">
<li><a href="{{ chill_path_add_return_path('chill_main_export_saved_delete', {'id': s.saved.id }) }}" class="btn btn-delete"></a></li> <li><a href="{{ chill_path_add_return_path('chill_main_export_saved_delete', {'id': s.saved.id }) }}" class="btn btn-delete"></a></li>
<li><a href="{{ chill_path_add_return_path('chill_main_export_saved_edit', {'id': s.saved.id }) }}" class="btn btn-edit"></a></li> <li><a href="{{ chill_path_add_return_path('chill_main_export_saved_edit', {'id': s.saved.id }) }}" class="btn btn-edit"></a></li>
<li><a href="{{ path('chill_main_export_generate_from_saved', { id: s.saved.id }) }}" class="btn btn-action"><i class="fa fa-cog"></i></a></li> <li><a href="{{ path('chill_main_export_generate_from_saved', { id: s.saved.id }) }}" class="btn btn-action"><i class="fa fa-cog"></i></a></li>
</ul> </ul>
</div> </div>
</div> </div>
</div> </div>
@ -44,33 +43,30 @@
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% if grouped_exports|keys|length > 1 and grouped_exports['_']|length > 0 %} {% if grouped_exports|keys|length > 1 and grouped_exports['_']|default([])|length > 0 %}
<h2 class="display-6">{{ 'Ungrouped exports'|trans }}</h2> <h2 class="display-6">{{ 'Ungrouped exports'|trans }}</h2>
{% endif %} {% endif %}
<div class="row ungrouped"> <div class="row flex-bloc">
{% for saveds in grouped_exports['_']|default([]) %} {% for saveds in grouped_exports['_']|default([]) %}
{% for s in saveds %} {% for s in saveds %}
<div class="col-6 col-md-4 mb-3"> <div class="item-bloc">
<div class="col-6 col-md-4 mb-3"> <div class="item-row card-body">
<div class="card"> <p class="card-subtitle"><strong>{{ s.export.title|trans }}</strong></p>
<div class="card-body"> <h2 class="card-title">{{ s.saved.title }}</h2>
<h2 class="card-title">{{ s.saved.title }}</h2>
<p class="card-subtitle"><strong>{{ s.export.title|trans }}</strong></p> <div class="createdBy">{{ 'saved_export.Created on %date%'|trans({'%date%': s.saved.createdAt|format_datetime('long', 'short')}) }}</div>
<div class="card-text"> <div class="card-text my-3">
{{ s.saved.description|chill_markdown_to_html }} {{ s.saved.description|chill_markdown_to_html }}
</div> </div>
<div class="createdBy">{{ 'saved_export.Created on %date%'|trans({'%date%': s.saved.createdAt|format_datetime('long', 'short')}) }}</div> <div>
<ul class="record_actions">
<ul class="record_actions"> <li><a href="{{ chill_path_add_return_path('chill_main_export_saved_delete', {'id': s.saved.id }) }}" class="btn btn-delete"></a></li>
<li><a href="{{ chill_path_add_return_path('chill_main_export_saved_delete', {'id': s.saved.id }) }}" class="btn btn-delete"></a></li> <li><a href="{{ chill_path_add_return_path('chill_main_export_saved_edit', {'id': s.saved.id }) }}" class="btn btn-edit"></a></li>
<li><a href="{{ chill_path_add_return_path('chill_main_export_saved_edit', {'id': s.saved.id }) }}" class="btn btn-edit"></a></li> <li><a href="{{ path('chill_main_export_generate_from_saved', { id: s.saved.id }) }}" class="btn btn-action"><i class="fa fa-cog"></i></a></li>
<li><a href="{{ path('chill_main_export_generate_from_saved', { id: s.saved.id }) }}" class="btn btn-action"><i class="fa fa-cog"></i></a></li> </ul>
</ul>
</div>
</div> </div>
</div> </div>
</div> </div>

View File

@ -3,6 +3,7 @@
{% block title %}{{ 'saved_export.New'|trans }}{% endblock %} {% block title %}{{ 'saved_export.New'|trans }}{% endblock %}
{% block content %} {% block content %}
<div class="col-10">
<h1>{{ block('title') }}</h1> <h1>{{ block('title') }}</h1>
{{ form_start(form) }} {{ form_start(form) }}
@ -18,4 +19,5 @@
</li> </li>
</ul> </ul>
{{ form_end(form) }} {{ form_end(form) }}
</div>
{% endblock %} {% endblock %}

View File

@ -71,6 +71,7 @@ module.exports = function(encore, entries)
encore.addEntry('mod_entity_workflow_pick', __dirname + '/Resources/public/module/entity-workflow-pick/index.js'); encore.addEntry('mod_entity_workflow_pick', __dirname + '/Resources/public/module/entity-workflow-pick/index.js');
encore.addEntry('mod_wopi_link', __dirname + '/Resources/public/module/wopi-link/index.js'); encore.addEntry('mod_wopi_link', __dirname + '/Resources/public/module/wopi-link/index.js');
encore.addEntry('mod_pick_postal_code', __dirname + '/Resources/public/module/pick-postal-code/index.js'); encore.addEntry('mod_pick_postal_code', __dirname + '/Resources/public/module/pick-postal-code/index.js');
encore.addEntry('mod_pick_rolling_date', __dirname + '/Resources/public/module/pick-rolling-date/index.js');
// Vue entrypoints // Vue entrypoints
encore.addEntry('vue_address', __dirname + '/Resources/public/vuejs/Address/index.js'); encore.addEntry('vue_address', __dirname + '/Resources/public/vuejs/Address/index.js');

View File

@ -558,12 +558,12 @@ rolling_date:
fixed_date_date: Date fixe fixed_date_date: Date fixe
saved_export: saved_export:
Any saved export: Aucun rapport enregistré Any saved export: Aucun export enregistré
New: Nouveau rapport enregistré New: Nouvel export enregistré
Edit: Modifier un rapport enregistré Edit: Modifier un export enregistré
Delete saved ?: Supprimer un rapport enregistré ? Delete saved ?: Supprimer un export enregistré ?
Are you sure you want to delete this saved ?: Êtes-vous sûr·e de vouloir supprimer ce rapport ? Are you sure you want to delete this saved ?: Êtes-vous sûr·e de vouloir supprimer cet export ?
My saved exports: Mes rapports enregistrés My saved exports: Mes exports enregistrés
Export is deleted: Le rapport est supprimé Export is deleted: L'export est supprimé
Saved export is saved!: Le rapport est enregistré Saved export is saved!: L'export est enregistré
Created on %date%: Créé le %date% Created on %date%: Créé le %date%

View File

@ -31,3 +31,6 @@ notification:
workflow: workflow:
You must add at least one dest user or email: Indiquez au moins un destinataire ou une adresse email You must add at least one dest user or email: Indiquez au moins un destinataire ou une adresse email
rolling_date:
When fixed date is selected, you must provide a date: Indiquez la date fixe choisie

View File

@ -16,7 +16,6 @@ use Chill\MainBundle\Form\Type\PickRollingDateType;
use Chill\MainBundle\Service\RollingDate\RollingDate; use Chill\MainBundle\Service\RollingDate\RollingDate;
use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface; use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface;
use Chill\PersonBundle\Export\Declarations; use Chill\PersonBundle\Export\Declarations;
use DateTimeImmutable;
use Doctrine\ORM\QueryBuilder; use Doctrine\ORM\QueryBuilder;
use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormBuilderInterface;
@ -59,7 +58,6 @@ class ByEndDateFilter implements FilterInterface
->add('start_date', PickRollingDateType::class, [ ->add('start_date', PickRollingDateType::class, [
'label' => 'start period date', 'label' => 'start period date',
'data' => new RollingDate(RollingDate::T_YEAR_PREVIOUS_START), 'data' => new RollingDate(RollingDate::T_YEAR_PREVIOUS_START),
'input' => 'datetime_immutable',
]) ])
->add('end_date', PickRollingDateType::class, [ ->add('end_date', PickRollingDateType::class, [
'label' => 'end period date', 'label' => 'end period date',

View File

@ -16,7 +16,6 @@ use Chill\MainBundle\Form\Type\PickRollingDateType;
use Chill\MainBundle\Service\RollingDate\RollingDate; use Chill\MainBundle\Service\RollingDate\RollingDate;
use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface; use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface;
use Chill\PersonBundle\Export\Declarations; use Chill\PersonBundle\Export\Declarations;
use DateTimeImmutable;
use Doctrine\ORM\QueryBuilder; use Doctrine\ORM\QueryBuilder;
use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormBuilderInterface;
@ -59,7 +58,6 @@ class ByStartDateFilter implements FilterInterface
->add('start_date', PickRollingDateType::class, [ ->add('start_date', PickRollingDateType::class, [
'label' => 'start period date', 'label' => 'start period date',
'data' => new RollingDate(RollingDate::T_YEAR_PREVIOUS_START), 'data' => new RollingDate(RollingDate::T_YEAR_PREVIOUS_START),
'input' => 'datetime_immutable',
]) ])
->add('end_date', PickRollingDateType::class, [ ->add('end_date', PickRollingDateType::class, [
'label' => 'end period date', 'label' => 'end period date',