Feature: Adapt filters and aggregators with new steps

This commit is contained in:
Julien Fastré 2023-04-24 15:40:20 +02:00
parent e80a6e417b
commit 229af2e4f9
Signed by: julienfastre
GPG Key ID: BDE2190974723FCB
7 changed files with 64 additions and 13 deletions

View File

@ -564,6 +564,7 @@ export:
_as_string: Adresse formattée _as_string: Adresse formattée
confidential: Adresse confidentielle ? confidential: Adresse confidentielle ?
isNoAddress: Adresse incomplète ? isNoAddress: Adresse incomplète ?
steps: Escaliers
_lat: Latitude _lat: Latitude
_lon: Longitude _lon: Longitude

View File

@ -358,6 +358,7 @@ class AccompanyingPeriod implements
/** /**
* @ORM\Column(type="string", length=32, nullable=true) * @ORM\Column(type="string", length=32, nullable=true)
* @Groups({"read"}) * @Groups({"read"})
* @var AccompanyingPeriod::STEP_*
*/ */
private string $step = self::STEP_DRAFT; private string $step = self::STEP_DRAFT;
@ -730,11 +731,9 @@ class AccompanyingPeriod implements
if ($this->getStep() === self::STEP_DRAFT) { if ($this->getStep() === self::STEP_DRAFT) {
return [[self::STEP_DRAFT]]; return [[self::STEP_DRAFT]];
} }
if (str_starts_with($this->getStep(), 'CONFIRM')) {
if ($this->getStep() === self::STEP_CONFIRMED) {
return [[self::STEP_DRAFT, self::STEP_CONFIRMED]]; return [[self::STEP_DRAFT, self::STEP_CONFIRMED]];
} }
if ($this->getStep() === self::STEP_CLOSED) { if ($this->getStep() === self::STEP_CLOSED) {
return [[self::STEP_DRAFT, self::STEP_CONFIRMED, self::STEP_CLOSED]]; return [[self::STEP_DRAFT, self::STEP_CONFIRMED, self::STEP_CLOSED]];
} }

View File

@ -86,13 +86,19 @@ final class StepAggregator implements AggregatorInterface
return function ($value): string { return function ($value): string {
switch ($value) { switch ($value) {
case AccompanyingPeriod::STEP_DRAFT: case AccompanyingPeriod::STEP_DRAFT:
return $this->translator->trans('Draft'); return $this->translator->trans('course.draft');
case AccompanyingPeriod::STEP_CONFIRMED: case AccompanyingPeriod::STEP_CONFIRMED:
return $this->translator->trans('Confirmed'); return $this->translator->trans('course.confirmed');
case AccompanyingPeriod::STEP_CLOSED: case AccompanyingPeriod::STEP_CLOSED:
return $this->translator->trans('Closed'); return $this->translator->trans('course.closed');
case AccompanyingPeriod::STEP_CONFIRMED_INACTIVE_SHORT:
return $this->translator->trans('course.inactive_short');
case AccompanyingPeriod::STEP_CONFIRMED_INACTIVE_LONG:
return $this->translator->trans('course.inactive_long');
case '_header': case '_header':
return 'Step'; return 'Step';

View File

@ -41,6 +41,7 @@ use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\Query\Expr\Join; use Doctrine\ORM\Query\Expr\Join;
use Doctrine\ORM\QueryBuilder; use Doctrine\ORM\QueryBuilder;
use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Contracts\Translation\TranslatorInterface;
use function strlen; use function strlen;
class ListAccompanyingPeriod implements ListInterface, GroupedExportInterface class ListAccompanyingPeriod implements ListInterface, GroupedExportInterface
@ -100,6 +101,8 @@ class ListAccompanyingPeriod implements ListInterface, GroupedExportInterface
private TranslatableStringHelperInterface $translatableStringHelper; private TranslatableStringHelperInterface $translatableStringHelper;
private TranslatorInterface $translator;
private UserHelper $userHelper; private UserHelper $userHelper;
public function __construct( public function __construct(
@ -113,6 +116,7 @@ class ListAccompanyingPeriod implements ListInterface, GroupedExportInterface
SocialIssueRepository $socialIssueRepository, SocialIssueRepository $socialIssueRepository,
SocialIssueRender $socialIssueRender, SocialIssueRender $socialIssueRender,
TranslatableStringHelperInterface $translatableStringHelper, TranslatableStringHelperInterface $translatableStringHelper,
TranslatorInterface $translator,
RollingDateConverterInterface $rollingDateConverter, RollingDateConverterInterface $rollingDateConverter,
UserHelper $userHelper UserHelper $userHelper
) { ) {
@ -126,6 +130,7 @@ class ListAccompanyingPeriod implements ListInterface, GroupedExportInterface
$this->thirdPartyRender = $thirdPartyRender; $this->thirdPartyRender = $thirdPartyRender;
$this->thirdPartyRepository = $thirdPartyRepository; $this->thirdPartyRepository = $thirdPartyRepository;
$this->translatableStringHelper = $translatableStringHelper; $this->translatableStringHelper = $translatableStringHelper;
$this->translator = $translator;
$this->rollingDateConverter = $rollingDateConverter; $this->rollingDateConverter = $rollingDateConverter;
$this->userHelper = $userHelper; $this->userHelper = $userHelper;
} }
@ -250,6 +255,31 @@ class ListAccompanyingPeriod implements ListInterface, GroupedExportInterface
); );
}; };
case 'step':
return function ($value) {
return match ($value) {
'_header' => 'export.list.acp.step',
null => '',
AccompanyingPeriod::STEP_DRAFT => $this->translator->trans('course.draft'),
AccompanyingPeriod::STEP_CONFIRMED => $this->translator->trans('course.confirmed'),
AccompanyingPeriod::STEP_CLOSED => $this->translator->trans('course.closed'),
AccompanyingPeriod::STEP_CONFIRMED_INACTIVE_SHORT => $this->translator->trans('course.inactive_short'),
AccompanyingPeriod::STEP_CONFIRMED_INACTIVE_LONG => $this->translator->trans('course.inactive_long'),
default => $value,
};
};
case 'intensity':
return function ($value) {
return match ($value) {
'_header' => 'export.list.acp.intensity',
null => '',
AccompanyingPeriod::INTENSITY_OCCASIONAL => $this->translator->trans('occasional'),
AccompanyingPeriod::INTENSITY_REGULAR => $this->translator->trans('regular'),
default => $value,
};
};
default: default:
return static function ($value) use ($key) { return static function ($value) use ($key) {
if ('_header' === $value) { if ('_header' === $value) {

View File

@ -32,9 +32,11 @@ class StepFilter implements FilterInterface
private const P = 'acp_step_filter_date'; private const P = 'acp_step_filter_date';
private const STEPS = [ private const STEPS = [
'Draft' => AccompanyingPeriod::STEP_DRAFT, 'course.draft' => AccompanyingPeriod::STEP_DRAFT,
'Confirmed' => AccompanyingPeriod::STEP_CONFIRMED, 'course.confirmed' => AccompanyingPeriod::STEP_CONFIRMED,
'Closed' => AccompanyingPeriod::STEP_CLOSED, 'course.closed' => AccompanyingPeriod::STEP_CLOSED,
'course.inactive_short' => AccompanyingPeriod::STEP_CONFIRMED_INACTIVE_SHORT,
'course.inactive_long' => AccompanyingPeriod::STEP_CONFIRMED_INACTIVE_LONG,
]; ];
private RollingDateConverterInterface $rollingDateConverter; private RollingDateConverterInterface $rollingDateConverter;
@ -96,7 +98,7 @@ class StepFilter implements FilterInterface
'data' => self::DEFAULT_CHOICE, 'data' => self::DEFAULT_CHOICE,
]) ])
->add('calc_date', PickRollingDateType::class, [ ->add('calc_date', PickRollingDateType::class, [
'label' => 'export.acp.filter.by_step.date_calc', 'label' => 'export.filter.course.by_step.date_calc',
'data' => new RollingDate(RollingDate::T_TODAY), 'data' => new RollingDate(RollingDate::T_TODAY),
]); ]);
} }

View File

@ -40,6 +40,8 @@ final class StepFilterTest extends AbstractFilterTest
return [ return [
['accepted_steps' => AccompanyingPeriod::STEP_DRAFT], ['accepted_steps' => AccompanyingPeriod::STEP_DRAFT],
['accepted_steps' => AccompanyingPeriod::STEP_CONFIRMED], ['accepted_steps' => AccompanyingPeriod::STEP_CONFIRMED],
['accepted_steps' => AccompanyingPeriod::STEP_CONFIRMED_INACTIVE_LONG],
['accepted_steps' => AccompanyingPeriod::STEP_CONFIRMED_INACTIVE_SHORT],
['accepted_steps' => AccompanyingPeriod::STEP_CLOSED], ['accepted_steps' => AccompanyingPeriod::STEP_CLOSED],
]; ];
} }

View File

@ -57,7 +57,7 @@ Add new phone: Ajouter un numéro de téléphone
Remove phone: Supprimer Remove phone: Supprimer
'Notes on contact information': 'Remarques sur les informations de contact' 'Notes on contact information': 'Remarques sur les informations de contact'
'Remarks': 'Remarques' 'Remarks': 'Remarques'
'Spoken languages': 'Langues parlées' Spoken languages': 'Langues parlées'
'Unknown spoken languages': 'Langues parlées inconnues' 'Unknown spoken languages': 'Langues parlées inconnues'
Male: Homme Male: Homme
Female: Femme Female: Femme
@ -237,8 +237,12 @@ No referrer: Pas d'agent traitant
Some peoples does not belong to any household currently. Add them to an household soon: Certains usagers n'appartiennent à aucun ménage actuellement. Renseignez leur ménage dès que possible. Some peoples does not belong to any household currently. Add them to an household soon: Certains usagers n'appartiennent à aucun ménage actuellement. Renseignez leur ménage dès que possible.
Add to household now: Ajouter à un ménage Add to household now: Ajouter à un ménage
Any resource for this accompanying course: Aucun interlocuteur privilégié pour ce parcours Any resource for this accompanying course: Aucun interlocuteur privilégié pour ce parcours
course.draft: Brouillon course:
course.closed: Clôturé draft: Brouillon
closed: Clôturé
inactive_short: Hors file active
inactive_long: Pré-archivé
confirmed: Confirmé
Origin: Origine de la demande Origin: Origine de la demande
Delete accompanying period: Supprimer le parcours d'accompagnement Delete accompanying period: Supprimer le parcours d'accompagnement
Are you sure you want to remove the accompanying period "%id%" ?: Êtes-vous sûr de vouloir supprimer le parcours d'accompagnement %id% ? Are you sure you want to remove the accompanying period "%id%" ?: Êtes-vous sûr de vouloir supprimer le parcours d'accompagnement %id% ?
@ -1072,6 +1076,8 @@ export:
Status: Statut Status: Statut
course: course:
by_step:
date_calc: Date de prise en compte du statut
by_user_scope: by_user_scope:
Computation date for referrer: Date à laquelle le référent était actif Computation date for referrer: Date à laquelle le référent était actif
by_referrer: by_referrer:
@ -1095,12 +1101,15 @@ export:
id: Identifiant du parcours id: Identifiant du parcours
openingDate: Date d'ouverture du parcours openingDate: Date d'ouverture du parcours
closingDate: Date de fermeture du parcours closingDate: Date de fermeture du parcours
closingMotive: Motif de cloture
job: Métier
confidential: Confidentiel confidential: Confidentiel
emergency: Urgent emergency: Urgent
intensity: Intensité intensity: Intensité
createdAt: Créé le createdAt: Créé le
updatedAt: Dernière mise à jour le updatedAt: Dernière mise à jour le
acpOrigin: Origine du parcours acpOrigin: Origine du parcours
origin: Origine du parcourse
acpClosingMotive: Motif de fermeture acpClosingMotive: Motif de fermeture
acpJob: Métier du parcours acpJob: Métier du parcours
createdBy: Créé par createdBy: Créé par
@ -1120,6 +1129,8 @@ export:
acprequestorPerson: Nom du demandeur usager acprequestorPerson: Nom du demandeur usager
scopes: Services scopes: Services
socialIssues: Problématiques sociales socialIssues: Problématiques sociales
requestorPerson: Demandeur (personne)
requestorThirdParty: Demandeur (tiers)
eval: eval:
List of evaluations: Liste des évaluations List of evaluations: Liste des évaluations
Generate a list of evaluations, filtered on different parameters: Génère une liste des évaluations, filtrée sur différents paramètres. Generate a list of evaluations, filtered on different parameters: Génère une liste des évaluations, filtrée sur différents paramètres.