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

View File

@ -16,6 +16,8 @@ use Chill\MainBundle\Service\RollingDate\RollingDate;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormView;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Validator\Constraints\Callback;
use Symfony\Component\Validator\Context\ExecutionContextInterface;
@ -59,8 +61,13 @@ class PickRollingDateType extends AbstractType
if (RollingDate::T_FIXED_DATE === $data->getRoll() && null === $data->getFixedDate()) {
$context
->buildViolation('rolling_date.When fixed date is selected, you must provide a date')
->atPath('roll')
->atPath('fixedDate')
->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%;
@include media-breakpoint-down(lg) { flex-basis: 50%; }
@include media-breakpoint-down(sm) { flex-basis: 100%; }
div:last-child,
p:last-child {
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>
{% endif %}
<div class="row ungrouped">
<div class="row flex-bloc">
{% for export_alias,export in grouped_exports['_'] %}
<div class="col-6 col-md-4 mb-3">
<div class="card">
<div class="card-body">
<h2 class="card-title">{{ export.title|trans }}</h2>
<p class="card-text">{{ export.description|trans }}</p>
<p>
<a class="btn btn-action" href="{{ path('chill_main_export_new', { 'alias': export_alias } ) }}">
{{ 'Create an export'|trans }}
</a>
</p>
</div>
<div class="item-bloc">
<div class="item-row card-body">
<h2 class="card-title">{{ export.title|trans }}</h2>
<p class="card-text my-3">{{ export.description|trans }}</p>
<p>
<a class="btn btn-action" href="{{ path('chill_main_export_new', { 'alias': export_alias } ) }}">
{{ 'Create an export'|trans }}
</a>
</p>
</div>
</div>

View File

@ -22,6 +22,7 @@
{% block css %}
{{ encore_entry_link_tags('mod_pickentity_type') }}
{{ encore_entry_link_tags('mod_pick_rolling_date') }}
{% endblock %}
{% block js %}
@ -30,6 +31,7 @@
{% if export_alias == 'count_social_work_actions' %}
{{ encore_entry_script_tags('vue_export_action_goal_result') }}
{% endif %}
{{ encore_entry_script_tags('mod_pick_rolling_date') }}
{% endblock js %}
{% 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'] }}"/>
<div data-module="pick-postal-code" data-uniqid="{{ form.vars['uniqid'] }}"></div>
{% 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 content %}
<div class="col-10">
<h1>{{ block('title') }}</h1>
{{ form_start(form) }}
@ -18,4 +19,5 @@
</li>
</ul>
{{ form_end(form) }}
</div>
{% endblock %}

View File

@ -3,7 +3,7 @@
{% block title %}{{ 'saved_export.My saved exports'|trans }}{% endblock %}
{% block content %}
<div class="col-md-10">
<div class="col-md-10 exports-list">
{{ include('@ChillMain/Export/_navbar.html.twig', {'current' : 'my'}) }}
@ -16,26 +16,25 @@
{% for group, saveds in grouped_exports %}
{% if group != '_' %}
<h2 class="display-6">{{ group }}</h2>
<div class="row grouped">
<div class="row flex-bloc">
{% for s in saveds %}
<div class="col-6 col-md-4 mb-3">
<div class="card">
<div class="card-body">
<h2 class="card-title">{{ s.saved.title }}</h2>
<p class="card-subtitle"><strong>{{ s.export.title|trans }}</strong></p>
<div class="card-text">
{{ 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 class="item-bloc">
<div class="item-row card-body">
<p class="card-subtitle"><strong>{{ s.export.title|trans }}</strong></p>
<h2 class="card-title">{{ s.saved.title }}</h2>
<div class="createdBy">{{ 'saved_export.Created on %date%'|trans({'%date%': s.saved.createdAt|format_datetime('long', 'short')}) }}</div>
<div class="card-text my-3">
{{ s.saved.description|chill_markdown_to_html }}
</div>
<div>
<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_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>
</ul>
</div>
</div>
</div>
@ -44,33 +43,30 @@
{% endif %}
{% 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>
{% endif %}
<div class="row ungrouped">
<div class="row flex-bloc">
{% for saveds in grouped_exports['_']|default([]) %}
{% for s in saveds %}
<div class="col-6 col-md-4 mb-3">
<div class="col-6 col-md-4 mb-3">
<div class="card">
<div class="card-body">
<h2 class="card-title">{{ s.saved.title }}</h2>
<p class="card-subtitle"><strong>{{ s.export.title|trans }}</strong></p>
<div class="card-text">
{{ 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>
<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_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>
</ul>
</div>
<div class="item-bloc">
<div class="item-row card-body">
<p class="card-subtitle"><strong>{{ s.export.title|trans }}</strong></p>
<h2 class="card-title">{{ s.saved.title }}</h2>
<div class="createdBy">{{ 'saved_export.Created on %date%'|trans({'%date%': s.saved.createdAt|format_datetime('long', 'short')}) }}</div>
<div class="card-text my-3">
{{ s.saved.description|chill_markdown_to_html }}
</div>
<div>
<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_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>
</ul>
</div>
</div>
</div>

View File

@ -3,6 +3,7 @@
{% block title %}{{ 'saved_export.New'|trans }}{% endblock %}
{% block content %}
<div class="col-10">
<h1>{{ block('title') }}</h1>
{{ form_start(form) }}
@ -18,4 +19,5 @@
</li>
</ul>
{{ form_end(form) }}
</div>
{% 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_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_rolling_date', __dirname + '/Resources/public/module/pick-rolling-date/index.js');
// Vue entrypoints
encore.addEntry('vue_address', __dirname + '/Resources/public/vuejs/Address/index.js');

View File

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

View File

@ -31,3 +31,6 @@ notification:
workflow:
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\RollingDateConverterInterface;
use Chill\PersonBundle\Export\Declarations;
use DateTimeImmutable;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\Form\FormBuilderInterface;
@ -59,7 +58,6 @@ class ByEndDateFilter implements FilterInterface
->add('start_date', PickRollingDateType::class, [
'label' => 'start period date',
'data' => new RollingDate(RollingDate::T_YEAR_PREVIOUS_START),
'input' => 'datetime_immutable',
])
->add('end_date', PickRollingDateType::class, [
'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\RollingDateConverterInterface;
use Chill\PersonBundle\Export\Declarations;
use DateTimeImmutable;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\Form\FormBuilderInterface;
@ -59,7 +58,6 @@ class ByStartDateFilter implements FilterInterface
->add('start_date', PickRollingDateType::class, [
'label' => 'start period date',
'data' => new RollingDate(RollingDate::T_YEAR_PREVIOUS_START),
'input' => 'datetime_immutable',
])
->add('end_date', PickRollingDateType::class, [
'label' => 'end period date',