add person exports in a group

This commit is contained in:
Mathieu Jaumotte 2022-07-13 10:08:18 +02:00
parent 28ed09b9d9
commit ec38dc4d21
5 changed files with 27 additions and 11 deletions

View File

@ -26,10 +26,10 @@
<h1>{{ 'Exports list'|trans }}</h1> <h1>{{ 'Exports list'|trans }}</h1>
<div class="container mt-4"> <div class="container mt-4">
{% for group, exports in grouped_exports %}{% if group != '_' %} {% for group, exports in grouped_exports %}{% if group != '_' %}
<h2>{{ group }}</h2> <h2 class="display-6">{{ group|trans }}</h2>
<div class="row grouped">
<div class="row">
{% for export_alias, export in exports %} {% for export_alias, export in exports %}
<div class="col-6 col-md-4 mb-3"> <div class="col-6 col-md-4 mb-3">
<h2>{{ export.title|trans }}</h2> <h2>{{ export.title|trans }}</h2>
@ -45,13 +45,10 @@
{% endif %}{% endfor %} {% endif %}{% endfor %}
{% if grouped_exports|keys|length > 1 %} {% if grouped_exports|keys|length > 1 %}
<h2>{{ 'Ungrouped exports'|trans }}</h2> <h2 class="display-6">{{ 'Ungrouped exports'|trans }}</h2>
{% endif %} {% endif %}
</div> <div class="row ungrouped">
<div class="container">
<div class="row">
{% 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="col-6 col-md-4 mb-3">

View File

@ -13,6 +13,7 @@ namespace Chill\PersonBundle\Export\Export;
use Chill\MainBundle\Export\ExportInterface; use Chill\MainBundle\Export\ExportInterface;
use Chill\MainBundle\Export\FormatterInterface; use Chill\MainBundle\Export\FormatterInterface;
use Chill\MainBundle\Export\GroupedExportInterface;
use Chill\PersonBundle\Export\Declarations; use Chill\PersonBundle\Export\Declarations;
use Chill\PersonBundle\Security\Authorization\PersonVoter; use Chill\PersonBundle\Security\Authorization\PersonVoter;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
@ -22,7 +23,7 @@ use LogicException;
use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Security\Core\Role\Role; use Symfony\Component\Security\Core\Role\Role;
class CountPerson implements ExportInterface class CountPerson implements ExportInterface, GroupedExportInterface
{ {
/** /**
* @var EntityManagerInterface * @var EntityManagerInterface
@ -114,4 +115,9 @@ class CountPerson implements ExportInterface
{ {
return [Declarations::PERSON_TYPE, Declarations::PERSON_IMPLIED_IN]; return [Declarations::PERSON_TYPE, Declarations::PERSON_IMPLIED_IN];
} }
public function getGroup(): string
{
return 'Exports of persons';
}
} }

View File

@ -16,6 +16,7 @@ use Chill\CustomFieldsBundle\Entity\CustomField;
use Chill\CustomFieldsBundle\Service\CustomFieldProvider; use Chill\CustomFieldsBundle\Service\CustomFieldProvider;
use Chill\MainBundle\Export\ExportElementValidatedInterface; use Chill\MainBundle\Export\ExportElementValidatedInterface;
use Chill\MainBundle\Export\FormatterInterface; use Chill\MainBundle\Export\FormatterInterface;
use Chill\MainBundle\Export\GroupedExportInterface;
use Chill\MainBundle\Export\ListInterface; use Chill\MainBundle\Export\ListInterface;
use Chill\MainBundle\Templating\TranslatableStringHelper; use Chill\MainBundle\Templating\TranslatableStringHelper;
use Chill\PersonBundle\Entity\Person; use Chill\PersonBundle\Entity\Person;
@ -45,7 +46,7 @@ use function uniqid;
/** /**
* Render a list of people. * Render a list of people.
*/ */
class ListPerson implements ExportElementValidatedInterface, ListInterface class ListPerson implements ExportElementValidatedInterface, ListInterface, GroupedExportInterface
{ {
protected CustomFieldProvider $customFieldProvider; protected CustomFieldProvider $customFieldProvider;
@ -474,4 +475,9 @@ class ListPerson implements ExportElementValidatedInterface, ListInterface
return $uid; return $uid;
} }
public function getGroup(): string
{
return 'Exports of persons';
}
} }

View File

@ -13,6 +13,7 @@ namespace Chill\PersonBundle\Export\Export;
use Chill\MainBundle\Export\DirectExportInterface; use Chill\MainBundle\Export\DirectExportInterface;
use Chill\MainBundle\Export\ExportElementValidatedInterface; use Chill\MainBundle\Export\ExportElementValidatedInterface;
use Chill\MainBundle\Export\GroupedExportInterface;
use Chill\PersonBundle\Security\Authorization\PersonVoter; use Chill\PersonBundle\Security\Authorization\PersonVoter;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use PhpOffice\PhpSpreadsheet\Spreadsheet; use PhpOffice\PhpSpreadsheet\Spreadsheet;
@ -30,7 +31,7 @@ use Symfony\Contracts\Translation\TranslatorInterface;
/** /**
* Render a list of duplicate peoples. * Render a list of duplicate peoples.
*/ */
class ListPersonDuplicate implements DirectExportInterface, ExportElementValidatedInterface class ListPersonDuplicate implements DirectExportInterface, ExportElementValidatedInterface, GroupedExportInterface
{ {
/** /**
* @var float * @var float
@ -196,4 +197,9 @@ class ListPersonDuplicate implements DirectExportInterface, ExportElementValidat
return $result->fetchAllAssociative(); return $result->fetchAllAssociative();
} }
public function getGroup(): string
{
return 'Exports of persons';
}
} }

View File

@ -326,6 +326,7 @@ Pediod closing form is not valide: Le formulaire de fermeture n'est pas valide
Accompanyied people: Personnes accompagnées Accompanyied people: Personnes accompagnées
## exports ## exports
Exports of persons: Exports des personnes
Count peoples by various parameters.: Compte le nombre de personnes en fonction de différents filtres. Count peoples by various parameters.: Compte le nombre de personnes en fonction de différents filtres.
Count peoples: Nombre de personnes Count peoples: Nombre de personnes
List peoples: Liste des personnes List peoples: Liste des personnes