mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-29 18:14:59 +00:00
Compare commits
1 Commits
deploy/qui
...
features/p
Author | SHA1 | Date | |
---|---|---|---|
|
865cedb6ab |
@@ -72,7 +72,6 @@ class ActivityController extends AbstractController
|
|||||||
{
|
{
|
||||||
$em = $this->getDoctrine()->getManager();
|
$em = $this->getDoctrine()->getManager();
|
||||||
$view = null;
|
$view = null;
|
||||||
// TODO: add pagination
|
|
||||||
|
|
||||||
[$person, $accompanyingPeriod] = $this->getEntity($request);
|
[$person, $accompanyingPeriod] = $this->getEntity($request);
|
||||||
|
|
||||||
@@ -81,9 +80,10 @@ class ActivityController extends AbstractController
|
|||||||
->getReachableCircles($this->getUser(), new Role('CHILL_ACTIVITY_SEE'),
|
->getReachableCircles($this->getUser(), new Role('CHILL_ACTIVITY_SEE'),
|
||||||
$person->getCenter());
|
$person->getCenter());
|
||||||
|
|
||||||
$activities = $em->getRepository(Activity::class)
|
$activities = $em->getRepository('ChillActivityBundle:Activity')->findBy(
|
||||||
->findByPersonImplied($person, $reachableScopes)
|
['person' => $person, 'scope' => $reachableScopes],
|
||||||
;
|
['date' => 'DESC'],
|
||||||
|
);
|
||||||
|
|
||||||
$event = new PrivacyEvent($person, array(
|
$event = new PrivacyEvent($person, array(
|
||||||
'element_class' => Activity::class,
|
'element_class' => Activity::class,
|
||||||
|
@@ -106,16 +106,15 @@ class Activity implements HasCenterInterface, HasScopeInterface
|
|||||||
/**
|
/**
|
||||||
* @ORM\ManyToMany(targetEntity="Chill\PersonBundle\Entity\SocialWork\SocialIssue")
|
* @ORM\ManyToMany(targetEntity="Chill\PersonBundle\Entity\SocialWork\SocialIssue")
|
||||||
* @ORM\JoinTable(name="chill_activity_activity_chill_person_socialissue")
|
* @ORM\JoinTable(name="chill_activity_activity_chill_person_socialissue")
|
||||||
* @Groups({"read"})
|
|
||||||
*/
|
*/
|
||||||
private Collection $socialIssues;
|
private $socialIssues;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\ManyToMany(targetEntity="Chill\PersonBundle\Entity\SocialWork\SocialAction")
|
* @ORM\ManyToMany(targetEntity="Chill\PersonBundle\Entity\SocialWork\SocialAction")
|
||||||
* @ORM\JoinTable(name="chill_activity_activity_chill_person_socialaction")
|
* @ORM\JoinTable(name="chill_activity_activity_chill_person_socialaction")
|
||||||
* @Groups({"read"})
|
|
||||||
*/
|
*/
|
||||||
private Collection $socialActions;
|
private $socialActions;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\ManyToOne(targetEntity="Chill\ActivityBundle\Entity\ActivityType")
|
* @ORM\ManyToOne(targetEntity="Chill\ActivityBundle\Entity\ActivityType")
|
||||||
@@ -282,7 +281,7 @@ class Activity implements HasCenterInterface, HasScopeInterface
|
|||||||
return $this->socialIssues;
|
return $this->socialIssues;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addSocialIssue(?SocialIssue $socialIssue): self
|
public function addSocialIssue(SocialIssue $socialIssue): self
|
||||||
{
|
{
|
||||||
if (!$this->socialIssues->contains($socialIssue)) {
|
if (!$this->socialIssues->contains($socialIssue)) {
|
||||||
$this->socialIssues[] = $socialIssue;
|
$this->socialIssues[] = $socialIssue;
|
||||||
@@ -298,12 +297,15 @@ class Activity implements HasCenterInterface, HasScopeInterface
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Collection|SocialAction[]
|
||||||
|
*/
|
||||||
public function getSocialActions(): Collection
|
public function getSocialActions(): Collection
|
||||||
{
|
{
|
||||||
return $this->socialActions;
|
return $this->socialActions;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addSocialAction(?SocialAction $socialAction): self
|
public function addSocialAction(SocialAction $socialAction): self
|
||||||
{
|
{
|
||||||
if (!$this->socialActions->contains($socialAction)) {
|
if (!$this->socialActions->contains($socialAction)) {
|
||||||
$this->socialActions[] = $socialAction;
|
$this->socialActions[] = $socialAction;
|
||||||
|
@@ -35,7 +35,6 @@ use Symfony\Component\Form\Extension\Core\Type\HiddenType;
|
|||||||
use Symfony\Component\Form\CallbackTransformer;
|
use Symfony\Component\Form\CallbackTransformer;
|
||||||
use Chill\PersonBundle\Form\DataTransformer\PersonToIdTransformer;
|
use Chill\PersonBundle\Form\DataTransformer\PersonToIdTransformer;
|
||||||
use Chill\PersonBundle\Templating\Entity\SocialIssueRender;
|
use Chill\PersonBundle\Templating\Entity\SocialIssueRender;
|
||||||
use Chill\PersonBundle\Templating\Entity\SocialActionRender;
|
|
||||||
|
|
||||||
class ActivityType extends AbstractType
|
class ActivityType extends AbstractType
|
||||||
{
|
{
|
||||||
@@ -47,10 +46,6 @@ class ActivityType extends AbstractType
|
|||||||
|
|
||||||
protected TranslatableStringHelper $translatableStringHelper;
|
protected TranslatableStringHelper $translatableStringHelper;
|
||||||
|
|
||||||
protected SocialIssueRender $socialIssueRender;
|
|
||||||
|
|
||||||
protected SocialActionRender $socialActionRender;
|
|
||||||
|
|
||||||
protected array $timeChoices;
|
protected array $timeChoices;
|
||||||
|
|
||||||
public function __construct (
|
public function __construct (
|
||||||
@@ -59,8 +54,7 @@ class ActivityType extends AbstractType
|
|||||||
ObjectManager $om,
|
ObjectManager $om,
|
||||||
TranslatableStringHelper $translatableStringHelper,
|
TranslatableStringHelper $translatableStringHelper,
|
||||||
array $timeChoices,
|
array $timeChoices,
|
||||||
SocialIssueRender $socialIssueRender,
|
SocialIssueRender $socialIssueRender
|
||||||
SocialActionRender $socialActionRender
|
|
||||||
) {
|
) {
|
||||||
if (!$tokenStorage->getToken()->getUser() instanceof User) {
|
if (!$tokenStorage->getToken()->getUser() instanceof User) {
|
||||||
throw new \RuntimeException("you should have a valid user");
|
throw new \RuntimeException("you should have a valid user");
|
||||||
@@ -72,7 +66,6 @@ class ActivityType extends AbstractType
|
|||||||
$this->translatableStringHelper = $translatableStringHelper;
|
$this->translatableStringHelper = $translatableStringHelper;
|
||||||
$this->timeChoices = $timeChoices;
|
$this->timeChoices = $timeChoices;
|
||||||
$this->socialIssueRender = $socialIssueRender;
|
$this->socialIssueRender = $socialIssueRender;
|
||||||
$this->socialActionRender = $socialActionRender;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||||
@@ -112,51 +105,31 @@ class ActivityType extends AbstractType
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($activityType->isVisible('socialIssues') && $accompanyingPeriod) {
|
if ($activityType->isVisible('socialIssues') && $accompanyingPeriod) {
|
||||||
$builder->add('socialIssues', HiddenType::class);
|
$builder->add('socialIssues', EntityType::class, [
|
||||||
$builder->get('socialIssues')
|
'label' => $activityType->getLabel('socialIssues'),
|
||||||
->addModelTransformer(new CallbackTransformer(
|
'required' => $activityType->isRequired('socialIssues'),
|
||||||
function (iterable $socialIssuesAsIterable): string {
|
'class' => SocialIssue::class,
|
||||||
$socialIssueIds = [];
|
'choice_label' => function (SocialIssue $socialIssue) {
|
||||||
foreach ($socialIssuesAsIterable as $value) {
|
return $this->socialIssueRender->renderString($socialIssue, []);
|
||||||
$socialIssueIds[] = $value->getId();
|
},
|
||||||
}
|
'multiple' => true,
|
||||||
return implode(',', $socialIssueIds);
|
'choices' => $accompanyingPeriod->getRecursiveSocialIssues(),
|
||||||
},
|
'expanded' => true,
|
||||||
function (?string $socialIssuesAsString): array {
|
]);
|
||||||
if (null === $socialIssuesAsString) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
return array_map(
|
|
||||||
fn(string $id): ?SocialIssue => $this->om->getRepository(SocialIssue::class)->findOneBy(['id' => (int) $id]),
|
|
||||||
explode(',', $socialIssuesAsString)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
))
|
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($activityType->isVisible('socialActions') && $accompanyingPeriod) {
|
if ($activityType->isVisible('socialActions') && $accompanyingPeriod) {
|
||||||
$builder->add('socialActions', HiddenType::class);
|
$builder->add('socialActions', EntityType::class, [
|
||||||
$builder->get('socialActions')
|
'label' => $activityType->getLabel('socialActions'),
|
||||||
->addModelTransformer(new CallbackTransformer(
|
'required' => $activityType->isRequired('socialActions'),
|
||||||
function (iterable $socialActionsAsIterable): string {
|
'class' => SocialAction::class,
|
||||||
$socialActionIds = [];
|
'choice_label' => function (SocialAction $socialAction) {
|
||||||
foreach ($socialActionsAsIterable as $value) {
|
return $this->translatableStringHelper->localize($socialAction->getTitle());
|
||||||
$socialActionIds[] = $value->getId();
|
},
|
||||||
}
|
'multiple' => true,
|
||||||
return implode(',', $socialActionIds);
|
'choices' => $accompanyingPeriod->getRecursiveSocialActions(),
|
||||||
},
|
'expanded' => true,
|
||||||
function (?string $socialActionsAsString): array {
|
]);
|
||||||
if (null === $socialActionsAsString) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
return array_map(
|
|
||||||
fn(string $id): ?SocialAction => $this->om->getRepository(SocialAction::class)->findOneBy(['id' => (int) $id]),
|
|
||||||
explode(',', $socialActionsAsString)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
))
|
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($activityType->isVisible('date')) {
|
if ($activityType->isVisible('date')) {
|
||||||
@@ -224,14 +197,15 @@ class ActivityType extends AbstractType
|
|||||||
|
|
||||||
if ($activityType->isVisible('comment')) {
|
if ($activityType->isVisible('comment')) {
|
||||||
$builder->add('comment', CommentType::class, [
|
$builder->add('comment', CommentType::class, [
|
||||||
'label' => empty($activityType->getLabel('comment'))
|
'label' => $activityType->getLabel('comment'),
|
||||||
? 'activity.comment' : $activityType->getLabel('comment'),
|
|
||||||
'required' => $activityType->isRequired('comment'),
|
'required' => $activityType->isRequired('comment'),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($activityType->isVisible('persons')) {
|
if ($activityType->isVisible('persons')) {
|
||||||
$builder->add('persons', HiddenType::class);
|
$builder->add('persons', HiddenType::class, [
|
||||||
|
//'data_class' => Person::class,
|
||||||
|
]);
|
||||||
$builder->get('persons')
|
$builder->get('persons')
|
||||||
->addModelTransformer(new CallbackTransformer(
|
->addModelTransformer(new CallbackTransformer(
|
||||||
function (iterable $personsAsIterable): string {
|
function (iterable $personsAsIterable): string {
|
||||||
@@ -252,7 +226,9 @@ class ActivityType extends AbstractType
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($activityType->isVisible('thirdParties')) {
|
if ($activityType->isVisible('thirdParties')) {
|
||||||
$builder->add('thirdParties', HiddenType::class);
|
$builder->add('thirdParties', HiddenType::class, [
|
||||||
|
//'data_class' => ThirdParty::class,
|
||||||
|
]);
|
||||||
$builder->get('thirdParties')
|
$builder->get('thirdParties')
|
||||||
->addModelTransformer(new CallbackTransformer(
|
->addModelTransformer(new CallbackTransformer(
|
||||||
function (iterable $thirdpartyAsIterable): string {
|
function (iterable $thirdpartyAsIterable): string {
|
||||||
@@ -284,7 +260,9 @@ class ActivityType extends AbstractType
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($activityType->isVisible('users')) {
|
if ($activityType->isVisible('users')) {
|
||||||
$builder->add('users', HiddenType::class);
|
$builder->add('users', HiddenType::class, [
|
||||||
|
//'data_class' => User::class,
|
||||||
|
]);
|
||||||
$builder->get('users')
|
$builder->get('users')
|
||||||
->addModelTransformer(new CallbackTransformer(
|
->addModelTransformer(new CallbackTransformer(
|
||||||
function (iterable $usersAsIterable): string {
|
function (iterable $usersAsIterable): string {
|
||||||
|
@@ -4,7 +4,6 @@ namespace Chill\ActivityBundle\Menu;
|
|||||||
|
|
||||||
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
|
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
|
||||||
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
|
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
|
||||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
|
||||||
use Knp\Menu\MenuItem;
|
use Knp\Menu\MenuItem;
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
||||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||||
@@ -35,13 +34,21 @@ class AccompanyingCourseMenuBuilder implements LocalMenuBuilderInterface
|
|||||||
{
|
{
|
||||||
$period = $parameters['accompanyingCourse'];
|
$period = $parameters['accompanyingCourse'];
|
||||||
|
|
||||||
if (AccompanyingPeriod::STEP_DRAFT !== $period->getStep()) {
|
$menu->addChild($this->translator->trans('Activity list'), [
|
||||||
$menu->addChild($this->translator->trans('Activity list'), [
|
'route' => 'chill_activity_activity_list',
|
||||||
'route' => 'chill_activity_activity_list',
|
'routeParameters' => [
|
||||||
'routeParameters' => [
|
'accompanying_period_id' => $period->getId(),
|
||||||
'accompanying_period_id' => $period->getId(),
|
]])
|
||||||
]])
|
->setExtras(['order' => 40]);
|
||||||
->setExtras(['order' => 40]);
|
|
||||||
}
|
$menu->addChild($this->translator->trans('Add a new activity'), [
|
||||||
|
'route' => 'chill_activity_activity_select_type',
|
||||||
|
'routeParameters' => [
|
||||||
|
'accompanying_period_id' => $period->getId(),
|
||||||
|
]])
|
||||||
|
->setExtras(['order' => 41]);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
88
src/Bundle/ChillActivityBundle/Menu/MenuBuilder.php
Normal file
88
src/Bundle/ChillActivityBundle/Menu/MenuBuilder.php
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
namespace Chill\ActivityBundle\Menu;
|
||||||
|
|
||||||
|
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
|
||||||
|
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
|
||||||
|
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
||||||
|
use Symfony\Component\Translation\TranslatorInterface;
|
||||||
|
use Knp\Menu\MenuItem;
|
||||||
|
use Symfony\Component\Security\Core\Role\Role;
|
||||||
|
use Chill\ActivityBundle\Security\Authorization\ActivityVoter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @author Julien Fastré <julien.fastre@champs-libres.coop>
|
||||||
|
*/
|
||||||
|
class MenuBuilder implements LocalMenuBuilderInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @var TokenStorageInterface
|
||||||
|
*/
|
||||||
|
protected $tokenStorage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @var TranslatorInterface
|
||||||
|
*/
|
||||||
|
protected $translator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @var AuthorizationHelper
|
||||||
|
*/
|
||||||
|
protected $authorizationHelper;
|
||||||
|
|
||||||
|
public function __construct(
|
||||||
|
TokenStorageInterface $tokenStorage,
|
||||||
|
TranslatorInterface $translator,
|
||||||
|
AuthorizationHelper $authorizationHelper
|
||||||
|
) {
|
||||||
|
$this->tokenStorage = $tokenStorage;
|
||||||
|
$this->translator = $translator;
|
||||||
|
$this->authorizationHelper = $authorizationHelper;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function buildMenu($menuId, MenuItem $menu, array $parameters)
|
||||||
|
{
|
||||||
|
/* @var $person \Chill\PersonBundle\Entity\Person */
|
||||||
|
$person = $parameters['person'];
|
||||||
|
$user = $this->tokenStorage->getToken()->getUser();
|
||||||
|
$roleSee = new Role(ActivityVoter::SEE);
|
||||||
|
$roleAdd = new Role(ActivityVoter::CREATE);
|
||||||
|
|
||||||
|
if ($this->authorizationHelper->userHasAccess($user, $person, $roleSee)) {
|
||||||
|
$menu->addChild($this->translator->trans('Activity list'), [
|
||||||
|
'route' => 'chill_activity_activity_list',
|
||||||
|
'routeParameters' => [
|
||||||
|
'person_id' => $person->getId()
|
||||||
|
]
|
||||||
|
])
|
||||||
|
->setExtras([
|
||||||
|
'order' => 201
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->authorizationHelper->userHasAccess($user, $person, $roleAdd)) {
|
||||||
|
$menu->addChild($this->translator->trans('Add a new activity'), [
|
||||||
|
'route' => 'chill_activity_activity_new',
|
||||||
|
'routeParameters' => [
|
||||||
|
'person_id' => $person->getId()
|
||||||
|
]
|
||||||
|
])
|
||||||
|
->setExtras([
|
||||||
|
'order' => 200
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getMenuIds(): array
|
||||||
|
{
|
||||||
|
return [ 'person' ];
|
||||||
|
}
|
||||||
|
}
|
@@ -16,6 +16,7 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
namespace Chill\ActivityBundle\Menu;
|
namespace Chill\ActivityBundle\Menu;
|
||||||
|
|
||||||
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
|
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
|
||||||
use Knp\Menu\MenuItem;
|
use Knp\Menu\MenuItem;
|
||||||
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
|
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
|
||||||
@@ -64,6 +65,15 @@ class PersonMenuBuilder implements LocalMenuBuilderInterface
|
|||||||
->setExtra('order', 201)
|
->setExtra('order', 201)
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
if ($this->authorizationChecker->isGranted(ActivityVoter::CREATE, $person)) {
|
||||||
|
$menu->addChild(
|
||||||
|
$this->translator->trans('Add a new activity'), [
|
||||||
|
'route' => 'chill_activity_activity_new',
|
||||||
|
'routeParameters' => [ 'person_id' => $person->getId() ],
|
||||||
|
])
|
||||||
|
->setExtra('order', 200)
|
||||||
|
;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getMenuIds(): array
|
public static function getMenuIds(): array
|
||||||
|
@@ -39,29 +39,4 @@ class ActivityRepository extends ServiceEntityRepository
|
|||||||
parent::__construct($registry, Activity::class);
|
parent::__construct($registry, Activity::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function findByPersonImplied($person, array $scopes, $orderBy = [ 'date' => 'DESC'], $limit = 100, $offset = 0)
|
|
||||||
{
|
|
||||||
$qb = $this->createQueryBuilder('a');
|
|
||||||
$qb->select('a');
|
|
||||||
|
|
||||||
$qb
|
|
||||||
// TODO add acl
|
|
||||||
//->where($qb->expr()->in('a.scope', ':scopes'))
|
|
||||||
//->setParameter('scopes', $scopes)
|
|
||||||
->andWhere(
|
|
||||||
$qb->expr()->orX(
|
|
||||||
$qb->expr()->eq('a.person', ':person'),
|
|
||||||
':person MEMBER OF a.persons'
|
|
||||||
)
|
|
||||||
)
|
|
||||||
->setParameter('person', $person)
|
|
||||||
;
|
|
||||||
|
|
||||||
foreach ($orderBy as $k => $dir) {
|
|
||||||
$qb->addOrderBy('a.'.$k, $dir);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $qb->getQuery()
|
|
||||||
->getResult();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -112,19 +112,3 @@ div.flex-table.list-records {
|
|||||||
margin-top: 1em;
|
margin-top: 1em;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
div.activity-row {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
justify-content: center;
|
|
||||||
gap: 12px;
|
|
||||||
div.bloc {
|
|
||||||
width: 200px;
|
|
||||||
align-self: flex-end;
|
|
||||||
height: 140px;
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@@ -1,17 +1,170 @@
|
|||||||
<template>
|
<template>
|
||||||
<concerned-groups></concerned-groups>
|
<teleport to="#add-persons">
|
||||||
<social-issues-acc></social-issues-acc>
|
|
||||||
|
<div class="flex-bloc concerned-groups" :class="getContext">
|
||||||
|
<persons-bloc
|
||||||
|
v-for="bloc in contextPersonsBlocs"
|
||||||
|
v-bind:key="bloc.key"
|
||||||
|
v-bind:bloc="bloc"
|
||||||
|
v-bind:setPersonsInBloc="setPersonsInBloc">
|
||||||
|
</persons-bloc>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<add-persons
|
||||||
|
buttonTitle="activity.add_persons"
|
||||||
|
modalTitle="activity.add_persons"
|
||||||
|
v-bind:key="addPersons.key"
|
||||||
|
v-bind:options="addPersons.options"
|
||||||
|
@addNewPersons="addNewPersons"
|
||||||
|
ref="addPersons">
|
||||||
|
</add-persons>
|
||||||
|
|
||||||
|
</teleport>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import ConcernedGroups from './components/ConcernedGroups.vue';
|
import { mapState } from 'vuex';
|
||||||
import SocialIssuesAcc from './components/SocialIssuesAcc.vue';
|
import AddPersons from 'ChillPersonAssets/vuejs/_components/AddPersons.vue';
|
||||||
|
import PersonsBloc from './components/PersonsBloc.vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "App",
|
name: "App",
|
||||||
components: {
|
components: {
|
||||||
ConcernedGroups,
|
AddPersons,
|
||||||
SocialIssuesAcc
|
PersonsBloc
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
personsBlocs: [
|
||||||
|
{ key: 'persons',
|
||||||
|
title: 'activity.bloc_persons',
|
||||||
|
persons: [],
|
||||||
|
included: false
|
||||||
|
},
|
||||||
|
{ key: 'personsAssociated',
|
||||||
|
title: 'activity.bloc_persons_associated',
|
||||||
|
persons: [],
|
||||||
|
included: false
|
||||||
|
},
|
||||||
|
{ key: 'personsNotAssociated',
|
||||||
|
title: 'activity.bloc_persons_not_associated',
|
||||||
|
persons: [],
|
||||||
|
included: false
|
||||||
|
},
|
||||||
|
{ key: 'thirdparty',
|
||||||
|
title: 'activity.bloc_thirdparty',
|
||||||
|
persons: [],
|
||||||
|
included: true
|
||||||
|
},
|
||||||
|
{ key: 'users',
|
||||||
|
title: 'activity.bloc_users',
|
||||||
|
persons: [],
|
||||||
|
included: true
|
||||||
|
},
|
||||||
|
],
|
||||||
|
addPersons: {
|
||||||
|
key: 'activity',
|
||||||
|
options: {
|
||||||
|
type: ['person', 'thirdparty'], // TODO add 'user'
|
||||||
|
priority: null,
|
||||||
|
uniq: false,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
...mapState({
|
||||||
|
persons: state => state.activity.persons,
|
||||||
|
thirdParties: state => state.activity.thirdParties,
|
||||||
|
users: state => state.activity.users,
|
||||||
|
accompanyingCourse: state => state.activity.accompanyingPeriod
|
||||||
|
}),
|
||||||
|
getContext() {
|
||||||
|
return (this.accompanyingCourse) ? "accompanyingCourse" : "person";
|
||||||
|
},
|
||||||
|
contextPersonsBlocs() {
|
||||||
|
return this.personsBlocs.filter(bloc => bloc.included !== false);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.setPersonsInBloc();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
setPersonsInBloc() {
|
||||||
|
let groups;
|
||||||
|
if (this.accompanyingCourse) {
|
||||||
|
groups = this.splitPersonsInGroups();
|
||||||
|
}
|
||||||
|
this.personsBlocs.forEach(bloc => {
|
||||||
|
if (this.accompanyingCourse) {
|
||||||
|
switch (bloc.key) {
|
||||||
|
case 'personsAssociated':
|
||||||
|
bloc.persons = groups.personsAssociated;
|
||||||
|
bloc.included = true;
|
||||||
|
break;
|
||||||
|
case 'personsNotAssociated':
|
||||||
|
bloc.persons = groups.personsNotAssociated;
|
||||||
|
bloc.included = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
switch (bloc.key) {
|
||||||
|
case 'persons':
|
||||||
|
bloc.persons = this.persons;
|
||||||
|
bloc.included = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
switch (bloc.key) {
|
||||||
|
case 'thirdparty':
|
||||||
|
bloc.persons = this.thirdParties;
|
||||||
|
break;
|
||||||
|
case 'users':
|
||||||
|
bloc.persons = this.users;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}, groups);
|
||||||
|
},
|
||||||
|
splitPersonsInGroups() {
|
||||||
|
let personsAssociated = [];
|
||||||
|
let personsNotAssociated = this.persons;
|
||||||
|
let participations = this.getCourseParticipations();
|
||||||
|
this.persons.forEach(person => {
|
||||||
|
participations.forEach(participation => {
|
||||||
|
if (person.id === participation.id) {
|
||||||
|
console.log(person.id);
|
||||||
|
personsAssociated.push(person);
|
||||||
|
personsNotAssociated = personsNotAssociated.filter(p => p !== person);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
return {
|
||||||
|
'personsAssociated': personsAssociated,
|
||||||
|
'personsNotAssociated': personsNotAssociated
|
||||||
|
};
|
||||||
|
},
|
||||||
|
getCourseParticipations() {
|
||||||
|
let participations = [];
|
||||||
|
this.accompanyingCourse.participations.forEach(participation => {
|
||||||
|
if (!participation.endDate) {
|
||||||
|
participations.push(participation.person);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return participations;
|
||||||
|
},
|
||||||
|
addNewPersons({ selected, modal }) {
|
||||||
|
console.log('@@@ CLICK button addNewPersons', selected);
|
||||||
|
selected.forEach(function(item) {
|
||||||
|
this.$store.dispatch('addPersonsInvolved', item);
|
||||||
|
}, this
|
||||||
|
);
|
||||||
|
this.$refs.addPersons.resetSearch(); // to cast child method
|
||||||
|
modal.showModal = false;
|
||||||
|
this.setPersonsInBloc();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
</style>
|
||||||
|
@@ -1,18 +0,0 @@
|
|||||||
import { getSocialIssues } from 'ChillPersonAssets/vuejs/AccompanyingCourse/api.js';
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Load socialActions by socialIssue (id)
|
|
||||||
*/
|
|
||||||
const getSocialActionByIssue = (id) => {
|
|
||||||
const url = `/api/1.0/person/social/social-action/by-social-issue/${id}.json`;
|
|
||||||
return fetch(url)
|
|
||||||
.then(response => {
|
|
||||||
if (response.ok) { return response.json(); }
|
|
||||||
throw Error('Error with request resource response');
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
export {
|
|
||||||
getSocialIssues,
|
|
||||||
getSocialActionByIssue
|
|
||||||
};
|
|
@@ -1,170 +0,0 @@
|
|||||||
<template>
|
|
||||||
<teleport to="#add-persons">
|
|
||||||
|
|
||||||
<div class="flex-bloc concerned-groups" :class="getContext">
|
|
||||||
<persons-bloc
|
|
||||||
v-for="bloc in contextPersonsBlocs"
|
|
||||||
v-bind:key="bloc.key"
|
|
||||||
v-bind:bloc="bloc"
|
|
||||||
v-bind:setPersonsInBloc="setPersonsInBloc">
|
|
||||||
</persons-bloc>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<add-persons
|
|
||||||
buttonTitle="activity.add_persons"
|
|
||||||
modalTitle="activity.add_persons"
|
|
||||||
v-bind:key="addPersons.key"
|
|
||||||
v-bind:options="addPersons.options"
|
|
||||||
@addNewPersons="addNewPersons"
|
|
||||||
ref="addPersons">
|
|
||||||
</add-persons>
|
|
||||||
|
|
||||||
</teleport>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import { mapState } from 'vuex';
|
|
||||||
import AddPersons from 'ChillPersonAssets/vuejs/_components/AddPersons.vue';
|
|
||||||
import PersonsBloc from './ConcernedGroups/PersonsBloc.vue';
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: "ConcernedGroups",
|
|
||||||
components: {
|
|
||||||
AddPersons,
|
|
||||||
PersonsBloc
|
|
||||||
},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
personsBlocs: [
|
|
||||||
{ key: 'persons',
|
|
||||||
title: 'activity.bloc_persons',
|
|
||||||
persons: [],
|
|
||||||
included: false
|
|
||||||
},
|
|
||||||
{ key: 'personsAssociated',
|
|
||||||
title: 'activity.bloc_persons_associated',
|
|
||||||
persons: [],
|
|
||||||
included: false
|
|
||||||
},
|
|
||||||
{ key: 'personsNotAssociated',
|
|
||||||
title: 'activity.bloc_persons_not_associated',
|
|
||||||
persons: [],
|
|
||||||
included: false
|
|
||||||
},
|
|
||||||
{ key: 'thirdparty',
|
|
||||||
title: 'activity.bloc_thirdparty',
|
|
||||||
persons: [],
|
|
||||||
included: true
|
|
||||||
},
|
|
||||||
{ key: 'users',
|
|
||||||
title: 'activity.bloc_users',
|
|
||||||
persons: [],
|
|
||||||
included: true
|
|
||||||
},
|
|
||||||
],
|
|
||||||
addPersons: {
|
|
||||||
key: 'activity',
|
|
||||||
options: {
|
|
||||||
type: ['person', 'thirdparty'], // TODO add 'user'
|
|
||||||
priority: null,
|
|
||||||
uniq: false,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
...mapState({
|
|
||||||
persons: state => state.activity.persons,
|
|
||||||
thirdParties: state => state.activity.thirdParties,
|
|
||||||
users: state => state.activity.users,
|
|
||||||
accompanyingCourse: state => state.activity.accompanyingPeriod
|
|
||||||
}),
|
|
||||||
getContext() {
|
|
||||||
return (this.accompanyingCourse) ? "accompanyingCourse" : "person";
|
|
||||||
},
|
|
||||||
contextPersonsBlocs() {
|
|
||||||
return this.personsBlocs.filter(bloc => bloc.included !== false);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
this.setPersonsInBloc();
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
setPersonsInBloc() {
|
|
||||||
let groups;
|
|
||||||
if (this.accompanyingCourse) {
|
|
||||||
groups = this.splitPersonsInGroups();
|
|
||||||
}
|
|
||||||
this.personsBlocs.forEach(bloc => {
|
|
||||||
if (this.accompanyingCourse) {
|
|
||||||
switch (bloc.key) {
|
|
||||||
case 'personsAssociated':
|
|
||||||
bloc.persons = groups.personsAssociated;
|
|
||||||
bloc.included = true;
|
|
||||||
break;
|
|
||||||
case 'personsNotAssociated':
|
|
||||||
bloc.persons = groups.personsNotAssociated;
|
|
||||||
bloc.included = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
switch (bloc.key) {
|
|
||||||
case 'persons':
|
|
||||||
bloc.persons = this.persons;
|
|
||||||
bloc.included = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
switch (bloc.key) {
|
|
||||||
case 'thirdparty':
|
|
||||||
bloc.persons = this.thirdParties;
|
|
||||||
break;
|
|
||||||
case 'users':
|
|
||||||
bloc.persons = this.users;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}, groups);
|
|
||||||
},
|
|
||||||
splitPersonsInGroups() {
|
|
||||||
let personsAssociated = [];
|
|
||||||
let personsNotAssociated = this.persons;
|
|
||||||
let participations = this.getCourseParticipations();
|
|
||||||
this.persons.forEach(person => {
|
|
||||||
participations.forEach(participation => {
|
|
||||||
if (person.id === participation.id) {
|
|
||||||
//console.log(person.id);
|
|
||||||
personsAssociated.push(person);
|
|
||||||
personsNotAssociated = personsNotAssociated.filter(p => p !== person);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
return {
|
|
||||||
'personsAssociated': personsAssociated,
|
|
||||||
'personsNotAssociated': personsNotAssociated
|
|
||||||
};
|
|
||||||
},
|
|
||||||
getCourseParticipations() {
|
|
||||||
let participations = [];
|
|
||||||
this.accompanyingCourse.participations.forEach(participation => {
|
|
||||||
if (!participation.endDate) {
|
|
||||||
participations.push(participation.person);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return participations;
|
|
||||||
},
|
|
||||||
addNewPersons({ selected, modal }) {
|
|
||||||
console.log('@@@ CLICK button addNewPersons', selected);
|
|
||||||
selected.forEach(function(item) {
|
|
||||||
this.$store.dispatch('addPersonsInvolved', item);
|
|
||||||
}, this
|
|
||||||
);
|
|
||||||
this.$refs.addPersons.resetSearch(); // to cast child method
|
|
||||||
modal.showModal = false;
|
|
||||||
this.setPersonsInBloc();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
</style>
|
|
@@ -1,214 +0,0 @@
|
|||||||
<template>
|
|
||||||
<teleport to="#social-issues-acc">
|
|
||||||
|
|
||||||
<div class="container">
|
|
||||||
<div class="grid-4 clear">
|
|
||||||
<label>{{ $t('activity.social_issues') }}</label>
|
|
||||||
</div>
|
|
||||||
<div class="grid-8">
|
|
||||||
|
|
||||||
<check-social-issue
|
|
||||||
v-for="issue in socialIssuesList"
|
|
||||||
v-bind:key="issue.id"
|
|
||||||
v-bind:issue="issue"
|
|
||||||
v-bind:selection="socialIssuesSelected"
|
|
||||||
@updateSelected="updateIssuesSelected">
|
|
||||||
</check-social-issue>
|
|
||||||
|
|
||||||
<div class="my-3">
|
|
||||||
<VueMultiselect
|
|
||||||
name="otherIssues"
|
|
||||||
label="text"
|
|
||||||
track-by="id"
|
|
||||||
open-direction="bottom"
|
|
||||||
v-bind:close-on-select="true"
|
|
||||||
v-bind:preserve-search="false"
|
|
||||||
v-bind:reset-after="true"
|
|
||||||
v-bind:hide-selected="true"
|
|
||||||
v-bind:taggable="false"
|
|
||||||
v-bind:multiple="false"
|
|
||||||
v-bind:searchable="true"
|
|
||||||
v-bind:allow-empty="true"
|
|
||||||
v-bind:show-labels="false"
|
|
||||||
v-bind:loading="issueIsLoading"
|
|
||||||
v-bind:placeholder="$t('activity.choose_other_social_issue')"
|
|
||||||
v-bind:options="socialIssuesOther"
|
|
||||||
v-model="value"
|
|
||||||
@select="addIssueInList">
|
|
||||||
</VueMultiselect>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="container">
|
|
||||||
<div class="grid-4 clear">
|
|
||||||
<label>{{ $t('activity.social_actions') }}</label>
|
|
||||||
</div>
|
|
||||||
<div class="grid-8">
|
|
||||||
|
|
||||||
<div v-if="actionIsLoading === true">
|
|
||||||
<i class="chill-green fa fa-circle-o-notch fa-spin fa-lg"></i>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<check-social-action
|
|
||||||
v-if="socialIssuesSelected.length || socialActionsSelected.length"
|
|
||||||
v-for="action in socialActionsList"
|
|
||||||
v-bind:key="action.id"
|
|
||||||
v-bind:action="action"
|
|
||||||
v-bind:selection="socialActionsSelected"
|
|
||||||
@updateSelected="updateActionsSelected">
|
|
||||||
</check-social-action>
|
|
||||||
|
|
||||||
<span v-else class="inline-choice chill-no-data-statement mt-3">
|
|
||||||
{{ $t('activity.select_first_a_social_issue') }}
|
|
||||||
</span>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</teleport>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import { readonly } from 'vue';
|
|
||||||
import VueMultiselect from 'vue-multiselect';
|
|
||||||
import CheckSocialIssue from './SocialIssuesAcc/CheckSocialIssue.vue';
|
|
||||||
import CheckSocialAction from './SocialIssuesAcc/CheckSocialAction.vue';
|
|
||||||
import { getSocialIssues, getSocialActionByIssue } from '../api.js';
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: "SocialIssuesAcc",
|
|
||||||
components: {
|
|
||||||
CheckSocialIssue,
|
|
||||||
CheckSocialAction,
|
|
||||||
VueMultiselect
|
|
||||||
},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
issueIsLoading: false,
|
|
||||||
actionIsLoading: false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
socialIssuesList() {
|
|
||||||
return this.$store.state.activity.accompanyingPeriod.socialIssues;
|
|
||||||
},
|
|
||||||
socialIssuesSelected() {
|
|
||||||
return this.$store.state.activity.socialIssues;
|
|
||||||
},
|
|
||||||
socialIssuesOther() {
|
|
||||||
return this.$store.state.socialIssuesOther;
|
|
||||||
},
|
|
||||||
socialActionsList() {
|
|
||||||
return this.$store.state.socialActionsList;
|
|
||||||
},
|
|
||||||
socialActionsSelected() {
|
|
||||||
return this.$store.state.activity.socialActions;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
/* Load others issues in multiselect
|
|
||||||
*/
|
|
||||||
this.issueIsLoading = true;
|
|
||||||
getSocialIssues().then(response => new Promise((resolve, reject) => {
|
|
||||||
this.$store.commit('updateIssuesOther', response.results);
|
|
||||||
|
|
||||||
/* Add in list the issues already associated (if not yet listed)
|
|
||||||
*/
|
|
||||||
this.socialIssuesSelected.forEach(issue => {
|
|
||||||
if (this.socialIssuesList.filter(i => i.id === issue.id).length !== 1) {
|
|
||||||
this.$store.commit('addIssueInList', issue);
|
|
||||||
}
|
|
||||||
}, this);
|
|
||||||
|
|
||||||
/* Remove from multiselect the issues that are not yet in checkbox list
|
|
||||||
*/
|
|
||||||
this.socialIssuesList.forEach(issue => {
|
|
||||||
this.$store.commit('removeIssueInOther', issue);
|
|
||||||
}, this);
|
|
||||||
|
|
||||||
/* Filter issues
|
|
||||||
*/
|
|
||||||
this.$store.commit('filterList', 'issues');
|
|
||||||
|
|
||||||
/* Add in list the actions already associated (if not yet listed)
|
|
||||||
*/
|
|
||||||
this.socialActionsSelected.forEach(action => {
|
|
||||||
this.$store.commit('addActionInList', action);
|
|
||||||
}, this);
|
|
||||||
|
|
||||||
/* Filter issues
|
|
||||||
*/
|
|
||||||
this.$store.commit('filterList', 'actions');
|
|
||||||
|
|
||||||
this.issueIsLoading = false;
|
|
||||||
resolve();
|
|
||||||
}));
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
|
|
||||||
/* When choosing an issue in multiselect, add it in checkboxes (as selected),
|
|
||||||
remove it from multiselect, and add socialActions concerned
|
|
||||||
*/
|
|
||||||
addIssueInList(value) {
|
|
||||||
//console.log('addIssueInList', value);
|
|
||||||
this.$store.commit('addIssueInList', value);
|
|
||||||
this.$store.commit('removeIssueInOther', value);
|
|
||||||
this.$store.dispatch('addIssueSelected', value);
|
|
||||||
this.updateActionsList();
|
|
||||||
},
|
|
||||||
/* Update value for selected issues checkboxes
|
|
||||||
*/
|
|
||||||
updateIssuesSelected(issues) {
|
|
||||||
//console.log('updateIssuesSelected', issues);
|
|
||||||
this.$store.dispatch('updateIssuesSelected', issues);
|
|
||||||
this.updateActionsList();
|
|
||||||
},
|
|
||||||
/* Update value for selected actions checkboxes
|
|
||||||
*/
|
|
||||||
updateActionsSelected(actions) {
|
|
||||||
//console.log('updateActionsSelected', actions);
|
|
||||||
this.$store.dispatch('updateActionsSelected', actions);
|
|
||||||
},
|
|
||||||
/* Add socialActions concerned: after reset, loop on each issue selected
|
|
||||||
to get social actions concerned
|
|
||||||
*/
|
|
||||||
updateActionsList() {
|
|
||||||
//console.log('updateActionsList');
|
|
||||||
this.resetActionsList();
|
|
||||||
this.socialIssuesSelected.forEach(item => {
|
|
||||||
|
|
||||||
this.actionIsLoading = true;
|
|
||||||
getSocialActionByIssue(item.id)
|
|
||||||
.then(actions => new Promise((resolve, reject) => {
|
|
||||||
|
|
||||||
actions.results.forEach(action => {
|
|
||||||
this.$store.commit('addActionInList', action);
|
|
||||||
}, this);
|
|
||||||
|
|
||||||
this.$store.commit('filterList', 'actions');
|
|
||||||
|
|
||||||
this.actionIsLoading = false;
|
|
||||||
resolve();
|
|
||||||
}));
|
|
||||||
}, this);
|
|
||||||
},
|
|
||||||
/* Reset socialActions List: flush list and restore selected actions
|
|
||||||
*/
|
|
||||||
resetActionsList() {
|
|
||||||
this.$store.commit('resetActionsList');
|
|
||||||
this.socialActionsSelected.forEach(item => {
|
|
||||||
this.$store.commit('addActionInList', item);
|
|
||||||
}, this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style src="vue-multiselect/dist/vue-multiselect.css"></style>
|
|
||||||
<style lang="scss">
|
|
||||||
span.multiselect__single {
|
|
||||||
display: none !important;
|
|
||||||
}
|
|
||||||
</style>
|
|
@@ -1,34 +0,0 @@
|
|||||||
<template>
|
|
||||||
<span class="inline-choice">
|
|
||||||
|
|
||||||
<input
|
|
||||||
type="checkbox"
|
|
||||||
v-model="selected"
|
|
||||||
name="action"
|
|
||||||
v-bind:id="action.id"
|
|
||||||
v-bind:value="action"
|
|
||||||
/>
|
|
||||||
<label class="inline" v-bind:for="action.id">
|
|
||||||
{{ action.text }}
|
|
||||||
</label>
|
|
||||||
|
|
||||||
</span><br>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
export default {
|
|
||||||
name: "CheckSocialAction",
|
|
||||||
props: [ 'action', 'selection' ],
|
|
||||||
emits: [ 'updateSelected' ],
|
|
||||||
computed: {
|
|
||||||
selected: {
|
|
||||||
set(value) {
|
|
||||||
this.$emit('updateSelected', value);
|
|
||||||
},
|
|
||||||
get() {
|
|
||||||
return this.selection;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
@@ -1,34 +0,0 @@
|
|||||||
<template>
|
|
||||||
<span class="inline-choice">
|
|
||||||
|
|
||||||
<input
|
|
||||||
type="checkbox"
|
|
||||||
v-model="selected"
|
|
||||||
name="issue"
|
|
||||||
v-bind:id="issue.id"
|
|
||||||
v-bind:value="issue"
|
|
||||||
/>
|
|
||||||
<label class="inline" v-bind:for="issue.id">
|
|
||||||
{{ issue.text }}
|
|
||||||
</label>
|
|
||||||
|
|
||||||
</span><br>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
export default {
|
|
||||||
name: "CheckSocialIssue",
|
|
||||||
props: [ 'issue', 'selection' ],
|
|
||||||
emits: [ 'updateSelected' ],
|
|
||||||
computed: {
|
|
||||||
selected: {
|
|
||||||
set(value) {
|
|
||||||
this.$emit('updateSelected', value);
|
|
||||||
},
|
|
||||||
get() {
|
|
||||||
return this.selection;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
@@ -3,13 +3,6 @@ import { personMessages } from 'ChillPersonAssets/vuejs/_js/i18n'
|
|||||||
const appMessages = {
|
const appMessages = {
|
||||||
fr: {
|
fr: {
|
||||||
activity: {
|
activity: {
|
||||||
//
|
|
||||||
social_issues: "Problématiques sociales",
|
|
||||||
choose_other_social_issue: "Ajouter une autre problématique sociale...",
|
|
||||||
social_actions: "Actions d'accompagnement",
|
|
||||||
select_first_a_social_issue: "Sélectionnez d'abord une problématique sociale",
|
|
||||||
|
|
||||||
//
|
|
||||||
add_persons: "Ajouter des personnes concernées",
|
add_persons: "Ajouter des personnes concernées",
|
||||||
bloc_persons: "Usagers",
|
bloc_persons: "Usagers",
|
||||||
bloc_persons_associated: "Usagers du parcours",
|
bloc_persons_associated: "Usagers du parcours",
|
||||||
|
@@ -21,62 +21,11 @@ const removeIdFromValue = (string, id) => {
|
|||||||
const store = createStore({
|
const store = createStore({
|
||||||
strict: debug,
|
strict: debug,
|
||||||
state: {
|
state: {
|
||||||
activity: window.activity,
|
activity: window.activity
|
||||||
socialIssuesOther: [],
|
},
|
||||||
socialActionsList: [],
|
getters: {
|
||||||
},
|
},
|
||||||
mutations: {
|
mutations: {
|
||||||
|
|
||||||
// SocialIssueAcc
|
|
||||||
addIssueInList(state, issue) {
|
|
||||||
//console.log('add issue list', issue.id);
|
|
||||||
state.activity.accompanyingPeriod.socialIssues.push(issue);
|
|
||||||
},
|
|
||||||
addIssueSelected(state, issue) {
|
|
||||||
//console.log('add issue selected', issue.id);
|
|
||||||
state.activity.socialIssues.push(issue);
|
|
||||||
},
|
|
||||||
updateIssuesSelected(state, issues) {
|
|
||||||
//console.log('update issues selected', issues);
|
|
||||||
state.activity.socialIssues = issues;
|
|
||||||
},
|
|
||||||
updateIssuesOther(state, payload) {
|
|
||||||
//console.log('update issues other');
|
|
||||||
state.socialIssuesOther = payload;
|
|
||||||
},
|
|
||||||
removeIssueInOther(state, issue) {
|
|
||||||
//console.log('remove issue other', issue.id);
|
|
||||||
state.socialIssuesOther = state.socialIssuesOther.filter(i => i.id !== issue.id);
|
|
||||||
},
|
|
||||||
resetActionsList(state) {
|
|
||||||
//console.log('reset list actions');
|
|
||||||
state.socialActionsList = [];
|
|
||||||
},
|
|
||||||
addActionInList(state, action) {
|
|
||||||
//console.log('add action list', action.id);
|
|
||||||
state.socialActionsList.push(action);
|
|
||||||
},
|
|
||||||
updateActionsSelected(state, actions) {
|
|
||||||
//console.log('update actions selected', actions);
|
|
||||||
state.activity.socialActions = actions;
|
|
||||||
},
|
|
||||||
filterList(state, list) {
|
|
||||||
const filterList = (list) => {
|
|
||||||
// remove duplicates entries
|
|
||||||
list = list.filter((value, index) => list.findIndex(array => array.id === value.id) === index);
|
|
||||||
// alpha sort
|
|
||||||
list.sort((a,b) => (a.text > b.text) ? 1 : ((b.text > a.text) ? -1 : 0));
|
|
||||||
return list;
|
|
||||||
};
|
|
||||||
if (list === 'issues') {
|
|
||||||
state.activity.accompanyingPeriod.socialIssues = filterList(state.activity.accompanyingPeriod.socialIssues);
|
|
||||||
}
|
|
||||||
if (list === 'actions') {
|
|
||||||
state.socialActionsList = filterList(state.socialActionsList);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
// ConcernedGroups
|
|
||||||
addPersonsInvolved(state, payload) {
|
addPersonsInvolved(state, payload) {
|
||||||
//console.log('### mutation addPersonsInvolved', payload.result.type);
|
//console.log('### mutation addPersonsInvolved', payload.result.type);
|
||||||
switch (payload.result.type) {
|
switch (payload.result.type) {
|
||||||
@@ -107,29 +56,8 @@ const store = createStore({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
addIssueSelected({ commit }, issue) {
|
|
||||||
let aSocialIssues = document.getElementById("chill_activitybundle_activity_socialIssues");
|
|
||||||
aSocialIssues.value = addIdToValue(aSocialIssues.value, issue.id);
|
|
||||||
commit('addIssueSelected', issue);
|
|
||||||
},
|
|
||||||
updateIssuesSelected({ commit }, payload) {
|
|
||||||
let aSocialIssues = document.getElementById("chill_activitybundle_activity_socialIssues");
|
|
||||||
aSocialIssues.value = '';
|
|
||||||
payload.forEach(item => {
|
|
||||||
aSocialIssues.value = addIdToValue(aSocialIssues.value, item.id);
|
|
||||||
});
|
|
||||||
commit('updateIssuesSelected', payload);
|
|
||||||
},
|
|
||||||
updateActionsSelected({ commit }, payload) {
|
|
||||||
let aSocialActions = document.getElementById("chill_activitybundle_activity_socialActions");
|
|
||||||
aSocialActions.value = '';
|
|
||||||
payload.forEach(item => {
|
|
||||||
aSocialActions.value = addIdToValue(aSocialActions.value, item.id);
|
|
||||||
});
|
|
||||||
commit('updateActionsSelected', payload);
|
|
||||||
},
|
|
||||||
addPersonsInvolved({ commit }, payload) {
|
addPersonsInvolved({ commit }, payload) {
|
||||||
//console.log('### action addPersonsInvolved', payload.result.type);
|
console.log('### action addPersonsInvolved', payload.result.type);
|
||||||
switch (payload.result.type) {
|
switch (payload.result.type) {
|
||||||
case 'person':
|
case 'person':
|
||||||
let aPersons = document.getElementById("chill_activitybundle_activity_persons");
|
let aPersons = document.getElementById("chill_activitybundle_activity_persons");
|
||||||
@@ -147,7 +75,7 @@ const store = createStore({
|
|||||||
commit('addPersonsInvolved', payload);
|
commit('addPersonsInvolved', payload);
|
||||||
},
|
},
|
||||||
removePersonInvolved({ commit }, payload) {
|
removePersonInvolved({ commit }, payload) {
|
||||||
//console.log('### action removePersonInvolved', payload);
|
console.log('### action removePersonInvolved', payload);
|
||||||
switch (payload.type) {
|
switch (payload.type) {
|
||||||
case 'person':
|
case 'person':
|
||||||
let aPersons = document.getElementById("chill_activitybundle_activity_persons");
|
let aPersons = document.getElementById("chill_activitybundle_activity_persons");
|
||||||
|
@@ -1,8 +1,4 @@
|
|||||||
<h1>{{ "Update activity"|trans ~ ' :' }}
|
<h1>{{ "Update activity"|trans }}</h1>
|
||||||
<span style="font-size: 70%; text-transform: lowercase; margin-left: 1em;">
|
|
||||||
{{ entity.type.name|localize_translatable_string }}
|
|
||||||
</span>
|
|
||||||
</h1>
|
|
||||||
|
|
||||||
{{ form_start(edit_form) }}
|
{{ form_start(edit_form) }}
|
||||||
{{ form_errors(edit_form) }}
|
{{ form_errors(edit_form) }}
|
||||||
@@ -23,15 +19,13 @@
|
|||||||
{{ form_row(edit_form.scope) }}
|
{{ form_row(edit_form.scope) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{%- if edit_form.socialIssues is defined -%}
|
|
||||||
{{ form_row(edit_form.socialIssues) }}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{%- if edit_form.socialActions is defined -%}
|
{%- if edit_form.socialActions is defined -%}
|
||||||
{{ form_row(edit_form.socialActions) }}
|
{{ form_row(edit_form.socialActions) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<div id="social-issues-acc"></div>
|
{%- if edit_form.socialIssues is defined -%}
|
||||||
|
{{ form_row(edit_form.socialIssues) }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{%- if edit_form.reasons is defined -%}
|
{%- if edit_form.reasons is defined -%}
|
||||||
{{ form_row(edit_form.reasons) }}
|
{{ form_row(edit_form.reasons) }}
|
||||||
@@ -99,7 +93,7 @@
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<button class="sc-button bt-update" type="submit">{{ 'Save'|trans }}</button>
|
<button class="sc-button bt-update" type="submit">{{ 'Save activity'|trans }}</button>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
{{ form_end(edit_form) }}
|
{{ form_end(edit_form) }}
|
||||||
|
@@ -10,20 +10,16 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block js %}
|
{% block js %}
|
||||||
{{ parent() }}
|
|
||||||
{{ encore_entry_link_tags('async_upload') }}
|
{{ encore_entry_link_tags('async_upload') }}
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
window.addEventListener('DOMContentLoaded', function (e) {
|
chill.displayAlertWhenLeavingModifiedForm('form[name="{{ edit_form.vars.form.vars.name }}"]',
|
||||||
chill.displayAlertWhenLeavingModifiedForm('form[name="{{ edit_form.vars.form.vars.name }}"]',
|
|
||||||
'{{ "You are going to leave a page with unsubmitted data. Are you sure you want to leave ?"|trans }}');
|
'{{ "You are going to leave a page with unsubmitted data. Are you sure you want to leave ?"|trans }}');
|
||||||
});
|
|
||||||
window.activity = {{ activity_json|json_encode|raw }};
|
window.activity = {{ activity_json|json_encode|raw }};
|
||||||
</script>
|
</script>
|
||||||
{{ encore_entry_script_tags('vue_activity') }}
|
{{ encore_entry_script_tags('vue_activity') }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block css %}
|
{% block css %}
|
||||||
{{ parent() }}
|
|
||||||
{{ encore_entry_link_tags('async_upload') }}
|
{{ encore_entry_link_tags('async_upload') }}
|
||||||
{{ encore_entry_link_tags('vue_activity') }}
|
{{ encore_entry_link_tags('vue_activity') }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@@ -21,17 +21,15 @@
|
|||||||
{% block title 'Update activity'|trans %}
|
{% block title 'Update activity'|trans %}
|
||||||
|
|
||||||
{% block personcontent %}
|
{% block personcontent %}
|
||||||
<div id="activity"></div> {# <=== vue component #}
|
|
||||||
{% include 'ChillActivityBundle:Activity:edit.html.twig' %}
|
{% include 'ChillActivityBundle:Activity:edit.html.twig' %}
|
||||||
|
<div id="activity"></div> {# <=== vue component #}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block js %}
|
{% block js %}
|
||||||
{{ encore_entry_link_tags('async_upload') }}
|
{{ encore_entry_link_tags('async_upload') }}
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
window.addEventListener('DOMContentLoaded', function (e) {
|
chill.displayAlertWhenLeavingModifiedForm('form[name="{{ edit_form.vars.form.vars.name }}"]',
|
||||||
chill.displayAlertWhenLeavingModifiedForm('form[name="{{ edit_form.vars.form.vars.name }}"]',
|
|
||||||
'{{ "You are going to leave a page with unsubmitted data. Are you sure you want to leave ?"|trans }}');
|
'{{ "You are going to leave a page with unsubmitted data. Are you sure you want to leave ?"|trans }}');
|
||||||
});
|
|
||||||
window.activity = {{ activity_json|json_encode|raw }};
|
window.activity = {{ activity_json|json_encode|raw }};
|
||||||
</script>
|
</script>
|
||||||
{{ encore_entry_script_tags('vue_activity') }}
|
{{ encore_entry_script_tags('vue_activity') }}
|
||||||
|
@@ -17,7 +17,7 @@
|
|||||||
</p>
|
</p>
|
||||||
{% else %}
|
{% else %}
|
||||||
|
|
||||||
<div class="flex-table list-records context-{{ context }}">
|
<div class="flex-table list-records {{ context }}">
|
||||||
<!--
|
<!--
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -55,20 +55,6 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% if context == 'person' and activity.accompanyingPeriod is not empty %}
|
|
||||||
<div class="accompanyingPeriodLink" style="margin-top: 1rem">
|
|
||||||
<a
|
|
||||||
href="{{ chill_path_add_return_path(
|
|
||||||
"chill_person_accompanying_course_index",
|
|
||||||
{ 'accompanying_period_id': activity.accompanyingPeriod.id }
|
|
||||||
) }}"
|
|
||||||
>
|
|
||||||
<i class="fa fa-random"></i>
|
|
||||||
{{ activity.accompanyingPeriod.id }}
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="item-col">
|
<div class="item-col">
|
||||||
<ul class="list-content">
|
<ul class="list-content">
|
||||||
@@ -168,7 +154,6 @@
|
|||||||
%}
|
%}
|
||||||
<div class="item-row details">
|
<div class="item-row details">
|
||||||
<div class="item-col">
|
<div class="item-col">
|
||||||
|
|
||||||
{% include 'ChillActivityBundle:Activity:concernedGroups.html.twig' with {'context': context, 'with_display': 'row', 'entity': activity } %}
|
{% include 'ChillActivityBundle:Activity:concernedGroups.html.twig' with {'context': context, 'with_display': 'row', 'entity': activity } %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -185,13 +170,10 @@
|
|||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if context != 'person' %}
|
<ul class="record_actions">
|
||||||
{# TODO set this condition in configuration #}
|
<li>
|
||||||
<ul class="record_actions">
|
<a href="{{ path('chill_activity_activity_new', {'person_id': person_id, 'accompanying_period_id': accompanying_course_id}) }}" class="sc-button bt-create">
|
||||||
<li>
|
{{ 'Add a new activity' | trans }}
|
||||||
<a href="{{ path('chill_activity_activity_new', {'person_id': person_id, 'accompanying_period_id': accompanying_course_id}) }}" class="sc-button bt-create">
|
</a>
|
||||||
{{ 'Add a new activity' | trans }}
|
</li>
|
||||||
</a>
|
</ul>
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
{% endif %}
|
|
||||||
|
@@ -1,8 +1,4 @@
|
|||||||
<h1>{{ "Activity creation"|trans ~ ' :' }}
|
<h1>{{ "Activity creation"|trans }}</h1>
|
||||||
<span style="font-size: 70%; text-transform: lowercase; margin-left: 1em;">
|
|
||||||
{{ entity.type.name|localize_translatable_string }}
|
|
||||||
</span>
|
|
||||||
</h1>
|
|
||||||
|
|
||||||
{{ form_start(form) }}
|
{{ form_start(form) }}
|
||||||
{{ form_errors(form) }}
|
{{ form_errors(form) }}
|
||||||
@@ -24,15 +20,14 @@
|
|||||||
{{ form_row(form.scope) }}
|
{{ form_row(form.scope) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{%- if form.socialIssues is defined -%}
|
|
||||||
{{ form_row(form.socialIssues) }}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{%- if form.socialActions is defined -%}
|
{%- if form.socialActions is defined -%}
|
||||||
{{ form_row(form.socialActions) }}
|
{{ form_row(form.socialActions) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<div id="social-issues-acc"></div>
|
{%- if form.socialIssues is defined -%}
|
||||||
|
{{ form_row(form.socialIssues) }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
{%- if form.reasons is defined -%}
|
{%- if form.reasons is defined -%}
|
||||||
{{ form_row(form.reasons) }}
|
{{ form_row(form.reasons) }}
|
||||||
@@ -98,7 +93,7 @@
|
|||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<button class="sc-button bt-create" type="submit">
|
<button class="sc-button bt-create" type="submit">
|
||||||
{{ 'Create'|trans }}
|
{{ 'Add a new activity'|trans }}
|
||||||
</button>
|
</button>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
@@ -10,20 +10,16 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block js %}
|
{% block js %}
|
||||||
{{ parent() }}
|
|
||||||
{{ encore_entry_script_tags('async_upload') }}
|
{{ encore_entry_script_tags('async_upload') }}
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
window.addEventListener('DOMContentLoaded', function (e) {
|
chill.displayAlertWhenLeavingUnsubmittedForm('form[name="{{ form.vars.form.vars.name }}"]',
|
||||||
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 }}');
|
'{{ "You are going to leave a page with unsubmitted data. Are you sure you want to leave ?"|trans }}');
|
||||||
});
|
|
||||||
window.activity = {{ activity_json|json_encode|raw }};
|
window.activity = {{ activity_json|json_encode|raw }};
|
||||||
</script>
|
</script>
|
||||||
{{ encore_entry_script_tags('vue_activity') }}
|
{{ encore_entry_script_tags('vue_activity') }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block css %}
|
{% block css %}
|
||||||
{{ parent() }}
|
|
||||||
<link rel="stylesheet" href="{{ asset('build/async_upload.css') }}"/>
|
<link rel="stylesheet" href="{{ asset('build/async_upload.css') }}"/>
|
||||||
{{ encore_entry_link_tags('vue_activity') }}
|
{{ encore_entry_link_tags('vue_activity') }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@@ -5,17 +5,15 @@
|
|||||||
{% block title 'Activity creation' |trans %}
|
{% block title 'Activity creation' |trans %}
|
||||||
|
|
||||||
{% block personcontent %}
|
{% block personcontent %}
|
||||||
<div id="activity"></div> {# <=== vue component #}
|
|
||||||
{% include 'ChillActivityBundle:Activity:new.html.twig' with {'context': 'person'} %}
|
{% include 'ChillActivityBundle:Activity:new.html.twig' with {'context': 'person'} %}
|
||||||
|
<div id="activity"></div> {# <=== vue component #}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block js %}
|
{% block js %}
|
||||||
{{ encore_entry_link_tags('async_upload') }}
|
{{ encore_entry_link_tags('async_upload') }}
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
window.addEventListener('DOMContentLoaded', function (e) {
|
chill.displayAlertWhenLeavingUnsubmittedForm('form[name="{{ form.vars.form.vars.name }}"]',
|
||||||
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 }}');
|
'{{ "You are going to leave a page with unsubmitted data. Are you sure you want to leave ?"|trans }}');
|
||||||
});
|
|
||||||
window.activity = {{ activity_json|json_encode|raw }};
|
window.activity = {{ activity_json|json_encode|raw }};
|
||||||
</script>
|
</script>
|
||||||
{{ encore_entry_script_tags('vue_activity') }}
|
{{ encore_entry_script_tags('vue_activity') }}
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
{% for row in data %}
|
{% for row in data %}
|
||||||
<h3>{{ row.activityTypeCategory.name|localize_translatable_string }}</h3>
|
<h3>{{ row.activityTypeCategory.name|localize_translatable_string }}</h3>
|
||||||
<div class="activity-row">
|
<div style="display:flex;justify-content:center;gap:12px;flex-wrap:wrap;">
|
||||||
{% for activityType in row.activityTypes %}
|
{% for activityType in row.activityTypes %}
|
||||||
|
|
||||||
{% set person_id = null %}
|
{% set person_id = null %}
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
<a href="{{ path('chill_activity_activity_new', {'person_id': person_id, 'activityType_id': activityType.id, 'accompanying_period_id': accompanying_course_id }) }}">
|
<a href="{{ path('chill_activity_activity_new', {'person_id': person_id, 'activityType_id': activityType.id, 'accompanying_period_id': accompanying_course_id }) }}">
|
||||||
|
|
||||||
<div class="bloc btn btn-primary btn-lg btn-block">
|
<div style="width:200px;height:200px;border:1px dotted red;display:flex;justify-content:center;align-items:center;align-content:center;">
|
||||||
{{ activityType.name|localize_translatable_string }}
|
{{ activityType.name|localize_translatable_string }}
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
|
@@ -117,7 +117,7 @@
|
|||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a class="sc-button bt-update" href="{{ path('chill_activity_activity_edit', { 'id': entity.id, 'person_id': person_id, 'accompanying_period_id': accompanying_course_id }) }}">
|
<a class="sc-button bt-update" href="{{ path('chill_activity_activity_edit', { 'id': entity.id, 'person_id': person_id, 'accompanying_period_id': accompanying_course_id }) }}">
|
||||||
{{ 'Edit'|trans }}
|
{{ 'Edit the activity'|trans }}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
{# TODO
|
{# TODO
|
||||||
|
@@ -32,7 +32,6 @@ services:
|
|||||||
- "@chill.main.helper.translatable_string"
|
- "@chill.main.helper.translatable_string"
|
||||||
- "%chill_activity.form.time_duration%"
|
- "%chill_activity.form.time_duration%"
|
||||||
- '@Chill\PersonBundle\Templating\Entity\SocialIssueRender'
|
- '@Chill\PersonBundle\Templating\Entity\SocialIssueRender'
|
||||||
- '@Chill\PersonBundle\Templating\Entity\SocialActionRender'
|
|
||||||
tags:
|
tags:
|
||||||
- { name: form.type, alias: chill_activitybundle_activity }
|
- { name: form.type, alias: chill_activitybundle_activity }
|
||||||
|
|
||||||
|
@@ -38,7 +38,7 @@ Required: Obligatoire
|
|||||||
Persons: Personnes
|
Persons: Personnes
|
||||||
Users: Utilisateurs
|
Users: Utilisateurs
|
||||||
Emergency: Urgent
|
Emergency: Urgent
|
||||||
Sent received: Entrant / Sortant
|
Sent received: Envoyer / Recevoir
|
||||||
Sent: Envoyer
|
Sent: Envoyer
|
||||||
Received: Recevoir
|
Received: Recevoir
|
||||||
by: 'Par '
|
by: 'Par '
|
||||||
@@ -74,7 +74,6 @@ Users concerned: T(M)S
|
|||||||
activity:
|
activity:
|
||||||
Insert a document: Insérer un document
|
Insert a document: Insérer un document
|
||||||
Remove a document: Supprimer le document
|
Remove a document: Supprimer le document
|
||||||
comment: Commentaire
|
|
||||||
|
|
||||||
|
|
||||||
#timeline
|
#timeline
|
||||||
|
@@ -8,11 +8,6 @@ use Symfony\Component\HttpFoundation\Response;
|
|||||||
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
||||||
use Chill\MainBundle\Pagination\PaginatorFactory;
|
use Chill\MainBundle\Pagination\PaginatorFactory;
|
||||||
use Chill\MainBundle\Pagination\PaginatorInterface;
|
use Chill\MainBundle\Pagination\PaginatorInterface;
|
||||||
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
|
|
||||||
use Chill\MainBundle\CRUD\Resolver\Resolver;
|
|
||||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
|
||||||
use Symfony\Component\Serializer\SerializerInterface;
|
|
||||||
use Symfony\Component\Translation\TranslatorInterface;
|
|
||||||
|
|
||||||
class AbstractCRUDController extends AbstractController
|
class AbstractCRUDController extends AbstractController
|
||||||
{
|
{
|
||||||
@@ -253,24 +248,4 @@ class AbstractCRUDController extends AbstractController
|
|||||||
{
|
{
|
||||||
return $this->get('validator');
|
return $this->get('validator');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public static function getSubscribedServices(): array
|
|
||||||
{
|
|
||||||
return \array_merge(
|
|
||||||
parent::getSubscribedServices(),
|
|
||||||
[
|
|
||||||
'chill_main.paginator_factory' => PaginatorFactory::class,
|
|
||||||
|
|
||||||
'translator' => TranslatorInterface::class,
|
|
||||||
AuthorizationHelper::class => AuthorizationHelper::class,
|
|
||||||
EventDispatcherInterface::class => EventDispatcherInterface::class,
|
|
||||||
Resolver::class => Resolver::class,
|
|
||||||
SerializerInterface::class => SerializerInterface::class,
|
|
||||||
'validator' => ValidatorInterface::class,
|
|
||||||
]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -36,7 +36,6 @@ use Chill\MainBundle\Search\SearchProvider;
|
|||||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||||
use Chill\MainBundle\Pagination\PaginatorFactory;
|
use Chill\MainBundle\Pagination\PaginatorFactory;
|
||||||
use Chill\MainBundle\Search\SearchApi;
|
use Chill\MainBundle\Search\SearchApi;
|
||||||
use Symfony\Component\HttpFoundation\Exception\BadRequestException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class SearchController
|
* Class SearchController
|
||||||
@@ -152,14 +151,11 @@ class SearchController extends AbstractController
|
|||||||
{
|
{
|
||||||
//TODO this is an incomplete implementation
|
//TODO this is an incomplete implementation
|
||||||
$query = $request->query->get('q', '');
|
$query = $request->query->get('q', '');
|
||||||
$types = $request->query->get('type', []);
|
|
||||||
|
|
||||||
if (count($types) === 0) {
|
$results = $this->searchApi->getResults($query, 0, 150);
|
||||||
throw new BadRequestException("The request must contains at "
|
$paginator = $this->paginatorFactory->create(count($results));
|
||||||
." one type");
|
|
||||||
}
|
|
||||||
|
|
||||||
$collection = $this->searchApi->getResults($query, $types, []);
|
$collection = new Collection($results, $paginator);
|
||||||
|
|
||||||
return $this->json($collection);
|
return $this->json($collection);
|
||||||
}
|
}
|
||||||
|
@@ -1,27 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Chill\MainBundle\Controller;
|
|
||||||
|
|
||||||
use Chill\MainBundle\CRUD\Controller\ApiController;
|
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
|
||||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
|
||||||
use Symfony\Component\Routing\Annotation\Route;
|
|
||||||
|
|
||||||
class UserApiController extends ApiController
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @Route(
|
|
||||||
* "/api/1.0/main/whoami.{_format}",
|
|
||||||
* name="chill_main_user_whoami",
|
|
||||||
* requirements={
|
|
||||||
* "_format": "json"
|
|
||||||
* }
|
|
||||||
* )
|
|
||||||
*/
|
|
||||||
public function whoami($_format): JsonResponse
|
|
||||||
{
|
|
||||||
return $this->json($this->getUser(), JsonResponse::HTTP_OK, [],
|
|
||||||
[ "groups" => [ "read" ] ]);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@@ -347,28 +347,7 @@ class ChillMainExtension extends Extension implements PrependExtensionInterface,
|
|||||||
]
|
]
|
||||||
],
|
],
|
||||||
]
|
]
|
||||||
],
|
]
|
||||||
[
|
|
||||||
'class' => \Chill\MainBundle\Entity\User::class,
|
|
||||||
'controller' => \Chill\MainBundle\Controller\UserApiController::class,
|
|
||||||
'name' => 'user',
|
|
||||||
'base_path' => '/api/1.0/main/user',
|
|
||||||
'base_role' => 'ROLE_USER',
|
|
||||||
'actions' => [
|
|
||||||
'_index' => [
|
|
||||||
'methods' => [
|
|
||||||
Request::METHOD_GET => true,
|
|
||||||
Request::METHOD_HEAD => true
|
|
||||||
],
|
|
||||||
],
|
|
||||||
'_entity' => [
|
|
||||||
'methods' => [
|
|
||||||
Request::METHOD_GET => true,
|
|
||||||
Request::METHOD_HEAD => true,
|
|
||||||
]
|
|
||||||
],
|
|
||||||
]
|
|
||||||
],
|
|
||||||
]
|
]
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
@@ -132,7 +132,6 @@ class Address
|
|||||||
/**
|
/**
|
||||||
* True if the address is a "no address", aka homeless person, ...
|
* True if the address is a "no address", aka homeless person, ...
|
||||||
* @groups({"write"})
|
* @groups({"write"})
|
||||||
* @ORM\Column(type="boolean")
|
|
||||||
*
|
*
|
||||||
* @var bool
|
* @var bool
|
||||||
*/
|
*/
|
||||||
@@ -299,7 +298,7 @@ class Address
|
|||||||
* @param bool $isNoAddress
|
* @param bool $isNoAddress
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function setIsNoAddress(bool $isNoAddress): self
|
public function setIsNoAddress(bool $isNoAddress)
|
||||||
{
|
{
|
||||||
$this->isNoAddress = $isNoAddress;
|
$this->isNoAddress = $isNoAddress;
|
||||||
return $this;
|
return $this;
|
||||||
|
@@ -45,14 +45,13 @@ class CommentType extends AbstractType
|
|||||||
{
|
{
|
||||||
$builder
|
$builder
|
||||||
->add('comment', ChillTextareaType::class, [
|
->add('comment', ChillTextareaType::class, [
|
||||||
'disable_editor' => $options['disable_editor'],
|
'disable_editor' => $options['disable_editor']
|
||||||
'label' => $options['label'],
|
|
||||||
])
|
])
|
||||||
;
|
;
|
||||||
|
|
||||||
$builder->addEventListener(FormEvents::PRE_SUBMIT, function (FormEvent $event) {
|
$builder->addEventListener(FormEvents::PRE_SUBMIT, function (FormEvent $event) {
|
||||||
$data = $event->getForm()->getData();
|
$data = $event->getForm()->getData();
|
||||||
$comment = $event->getData() ?? ['comment' => ''];
|
$comment = $event->getData();
|
||||||
|
|
||||||
if ($data->getComment() !== $comment['comment']) {
|
if ($data->getComment() !== $comment['comment']) {
|
||||||
$data->setDate(new \DateTime());
|
$data->setDate(new \DateTime());
|
||||||
|
@@ -44,11 +44,6 @@ final class ScopeRepository implements ObjectRepository
|
|||||||
return $this->repository->findBy($criteria, $orderBy, $limit, $offset);
|
return $this->repository->findBy($criteria, $orderBy, $limit, $offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function createQueryBuilder($alias, $indexBy = null)
|
|
||||||
{
|
|
||||||
return $this->repository->createQueryBuilder($alias, $indexBy);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getClassName() {
|
public function getClassName() {
|
||||||
return Scope::class;
|
return Scope::class;
|
||||||
}
|
}
|
||||||
|
@@ -48,8 +48,8 @@ const ISOToDatetime = (str) => {
|
|||||||
let
|
let
|
||||||
[cal, times] = str.split('T'),
|
[cal, times] = str.split('T'),
|
||||||
[year, month, date] = cal.split('-'),
|
[year, month, date] = cal.split('-'),
|
||||||
[time, timezone] = times.split(times.charAt(8)),
|
[time, timezone] = cal.split(times.charAt(9)),
|
||||||
[hours, minutes, seconds] = time.split(':')
|
[hours, minutes, seconds] = cal.split(':')
|
||||||
;
|
;
|
||||||
|
|
||||||
return new Date(year, month-1, date, hours, minutes, seconds);
|
return new Date(year, month-1, date, hours, minutes, seconds);
|
||||||
|
@@ -35,7 +35,6 @@ $table-body-td-text-align: left;
|
|||||||
// Tabs
|
// Tabs
|
||||||
$tabs-nav-margin-bottom: 0.2em;
|
$tabs-nav-margin-bottom: 0.2em;
|
||||||
$tabs-nav-bg-color: $yellow;
|
$tabs-nav-bg-color: $yellow;
|
||||||
$tabs-nav-bg-color-light: lighten($yellow, 10%);
|
|
||||||
$tabs-nav-text-color: $blue;
|
$tabs-nav-text-color: $blue;
|
||||||
$tabs-new-border: none;
|
$tabs-new-border: none;
|
||||||
$tabs-nav-hover-border: none;
|
$tabs-nav-hover-border: none;
|
||||||
|
@@ -26,13 +26,7 @@ $global-bg-color: $yellow;
|
|||||||
color: $tabs-nav-title-text-color;
|
color: $tabs-nav-title-text-color;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.sub-menu {
|
> a {
|
||||||
padding-left: 20px;
|
|
||||||
> a {
|
|
||||||
background-color: $tabs-nav-bg-color-light;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
> a {
|
|
||||||
display: block;
|
display: block;
|
||||||
width: auto;
|
width: auto;
|
||||||
padding: $tabs-nav-padding;
|
padding: $tabs-nav-padding;
|
||||||
|
@@ -45,6 +45,33 @@ table {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ACCOMPANYING_COURSE
|
||||||
|
* Header custom for Accompanying Course
|
||||||
|
*/
|
||||||
|
|
||||||
|
div#header-accompanying_course-name {
|
||||||
|
background: none repeat scroll 0 0 #718596;
|
||||||
|
color: #FFF;
|
||||||
|
h1 {
|
||||||
|
margin: 0.4em 0;
|
||||||
|
}
|
||||||
|
span {
|
||||||
|
a {
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
a:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
div#header-accompanying_course-details {
|
||||||
|
background: none repeat scroll 0 0 #718596ab;
|
||||||
|
color: #FFF;
|
||||||
|
padding-top: 1em;
|
||||||
|
padding-bottom: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* FLEX RESPONSIVE TABLE/BLOCK PRESENTATION
|
* FLEX RESPONSIVE TABLE/BLOCK PRESENTATION
|
||||||
*/
|
*/
|
||||||
@@ -82,13 +109,23 @@ div.flex-bloc {
|
|||||||
align-content: stretch;
|
align-content: stretch;
|
||||||
|
|
||||||
div.item-bloc {
|
div.item-bloc {
|
||||||
flex-grow: 0; flex-shrink: 1; flex-basis: 33%;
|
flex-grow: 0; flex-shrink: 1; flex-basis: 50%;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 1em;
|
padding: 1em;
|
||||||
|
border-top: 0;
|
||||||
|
&:nth-child(1), &:nth-child(2) {
|
||||||
|
border-top: 1px solid #000;
|
||||||
|
}
|
||||||
|
border-left: 0;
|
||||||
|
&:nth-child(odd) {
|
||||||
|
border-left: 1px solid #000;
|
||||||
|
}
|
||||||
|
|
||||||
|
//background-color: #e6e6e6;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|
||||||
div.item-row {
|
& > div.item-row {
|
||||||
flex-grow: 1; flex-shrink: 1; flex-basis: auto;
|
flex-grow: 1; flex-shrink: 1; flex-basis: auto;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
@@ -121,6 +158,12 @@ div.flex-bloc {
|
|||||||
@media only screen and (max-width: 900px) {
|
@media only screen and (max-width: 900px) {
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
margin: auto 0;
|
margin: auto 0;
|
||||||
|
div.item-bloc {
|
||||||
|
border-left: 1px solid #000;
|
||||||
|
&:nth-child(2) {
|
||||||
|
border-top: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -189,6 +232,8 @@ div.flex-table {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Address form
|
* Address form
|
||||||
*/
|
*/
|
||||||
@@ -232,3 +277,5 @@ div.address_form {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -26,12 +26,6 @@
|
|||||||
<div v-if="errors.length > 0">
|
<div v-if="errors.length > 0">
|
||||||
{{ errors }}
|
{{ errors }}
|
||||||
</div>
|
</div>
|
||||||
<div v-if="loading">
|
|
||||||
{{ $t('loading') }}
|
|
||||||
</div>
|
|
||||||
<div v-if="success">
|
|
||||||
{{ $t('person_address_creation_success') }}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
@@ -74,12 +68,6 @@ export default {
|
|||||||
},
|
},
|
||||||
errors() {
|
errors() {
|
||||||
return this.$store.state.errorMsg;
|
return this.$store.state.errorMsg;
|
||||||
},
|
|
||||||
loading() {
|
|
||||||
return this.$store.state.loading;
|
|
||||||
},
|
|
||||||
success() {
|
|
||||||
return this.$store.state.success;
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@@ -26,9 +26,7 @@ const addressMessages = {
|
|||||||
date: 'Date de la nouvelle adresse',
|
date: 'Date de la nouvelle adresse',
|
||||||
add_an_address_to_person: 'Ajouter l\'adresse à la personne',
|
add_an_address_to_person: 'Ajouter l\'adresse à la personne',
|
||||||
validFrom: 'Date de la nouvelle adresse',
|
validFrom: 'Date de la nouvelle adresse',
|
||||||
back_to_the_list: 'Retour à la liste',
|
back_to_the_list: 'Retour à la liste'
|
||||||
person_address_creation_success: 'La nouvelle adresse de la personne est enregistrée',
|
|
||||||
loading: 'chargement en cours...'
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -11,9 +11,7 @@ const store = createStore({
|
|||||||
address: {},
|
address: {},
|
||||||
editAddress: {}, //TODO or should be address?
|
editAddress: {}, //TODO or should be address?
|
||||||
person: {},
|
person: {},
|
||||||
errorMsg: [],
|
errorMsg: []
|
||||||
loading: false,
|
|
||||||
success: false
|
|
||||||
},
|
},
|
||||||
getters: {
|
getters: {
|
||||||
},
|
},
|
||||||
@@ -41,17 +39,11 @@ const store = createStore({
|
|||||||
console.log('@M getEditAddress address', address);
|
console.log('@M getEditAddress address', address);
|
||||||
state.editAddress = address;
|
state.editAddress = address;
|
||||||
},
|
},
|
||||||
setLoading(state, b) {
|
|
||||||
state.loading = b;
|
|
||||||
},
|
|
||||||
setSuccess(state, b) {
|
|
||||||
state.success = b;
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
addAddress({ commit }, payload) {
|
addAddress({ commit }, payload) {
|
||||||
console.log('@A addAddress payload', payload);
|
console.log('@A addAddress payload', payload);
|
||||||
commit('setLoading', true);
|
|
||||||
if('newPostalCode' in payload){
|
if('newPostalCode' in payload){
|
||||||
let postalCodeBody = payload.newPostalCode;
|
let postalCodeBody = payload.newPostalCode;
|
||||||
postalCodeBody = Object.assign(postalCodeBody, {'origin': 3});
|
postalCodeBody = Object.assign(postalCodeBody, {'origin': 3});
|
||||||
@@ -63,11 +55,9 @@ const store = createStore({
|
|||||||
.then(address => new Promise((resolve, reject) => {
|
.then(address => new Promise((resolve, reject) => {
|
||||||
commit('addAddress', address);
|
commit('addAddress', address);
|
||||||
resolve();
|
resolve();
|
||||||
commit('setLoading', false);
|
|
||||||
}))
|
}))
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
commit('catchError', error);
|
commit('catchError', error);
|
||||||
commit('setLoading', false);
|
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -76,17 +66,15 @@ const store = createStore({
|
|||||||
.then(address => new Promise((resolve, reject) => {
|
.then(address => new Promise((resolve, reject) => {
|
||||||
commit('addAddress', address);
|
commit('addAddress', address);
|
||||||
resolve();
|
resolve();
|
||||||
commit('setLoading', false);
|
|
||||||
}))
|
}))
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
commit('catchError', error);
|
commit('catchError', error);
|
||||||
commit('setLoading', false);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
addDateToAddressAndAddressToPerson({ commit }, payload) {
|
addDateToAddressAndAddressToPerson({ commit }, payload) {
|
||||||
console.log('@A addDateToAddressAndAddressToPerson payload', payload);
|
console.log('@A addDateToAddressAndAddressToPerson payload', payload);
|
||||||
commit('setLoading', true);
|
|
||||||
patchAddress(payload.addressId, payload.body)
|
patchAddress(payload.addressId, payload.body)
|
||||||
.then(address => new Promise((resolve, reject) => {
|
.then(address => new Promise((resolve, reject) => {
|
||||||
commit('addDateToAddress', address.validFrom);
|
commit('addDateToAddress', address.validFrom);
|
||||||
@@ -96,17 +84,13 @@ const store = createStore({
|
|||||||
.then(person => new Promise((resolve, reject) => {
|
.then(person => new Promise((resolve, reject) => {
|
||||||
commit('addAddressToPerson', person);
|
commit('addAddressToPerson', person);
|
||||||
resolve();
|
resolve();
|
||||||
commit('setLoading', false);
|
|
||||||
commit('setSuccess', true);
|
|
||||||
}))
|
}))
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
commit('catchError', error);
|
commit('catchError', error);
|
||||||
commit('setLoading', false);
|
|
||||||
})
|
})
|
||||||
))
|
))
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
commit('catchError', error);
|
commit('catchError', error);
|
||||||
commit('setLoading', false);
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
updateAddress({ commit }, payload) {
|
updateAddress({ commit }, payload) {
|
||||||
|
@@ -19,10 +19,6 @@
|
|||||||
<template v-slot:body>
|
<template v-slot:body>
|
||||||
<div class="address_form">
|
<div class="address_form">
|
||||||
|
|
||||||
<div v-if="loading">
|
|
||||||
{{ $t('loading') }}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="address_form__header">
|
<div class="address_form__header">
|
||||||
<h4>{{ $t('select_an_address_title') }}</h4>
|
<h4>{{ $t('select_an_address_title') }}</h4>
|
||||||
</div>
|
</div>
|
||||||
@@ -46,7 +42,6 @@
|
|||||||
|
|
||||||
<city-selection
|
<city-selection
|
||||||
v-bind:address="address"
|
v-bind:address="address"
|
||||||
v-bind:focusOnAddress="focusOnAddress"
|
|
||||||
v-bind:getReferenceAddresses="getReferenceAddresses">
|
v-bind:getReferenceAddresses="getReferenceAddresses">
|
||||||
</city-selection>
|
</city-selection>
|
||||||
|
|
||||||
@@ -115,7 +110,6 @@ export default {
|
|||||||
showModal: false,
|
showModal: false,
|
||||||
modalDialogClass: "modal-dialog-scrollable modal-xl"
|
modalDialogClass: "modal-dialog-scrollable modal-xl"
|
||||||
},
|
},
|
||||||
loading: false,
|
|
||||||
address: {
|
address: {
|
||||||
writeNewAddress: false,
|
writeNewAddress: false,
|
||||||
writeNewPostalCode: false,
|
writeNewPostalCode: false,
|
||||||
@@ -149,7 +143,7 @@ export default {
|
|||||||
extra: null,
|
extra: null,
|
||||||
distribution: null,
|
distribution: null,
|
||||||
},
|
},
|
||||||
errorMsg: {},
|
errorMsg: {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@@ -174,52 +168,35 @@ export default {
|
|||||||
// this.$refs.search.focus(); // positionner le curseur à l'ouverture de la modale
|
// this.$refs.search.focus(); // positionner le curseur à l'ouverture de la modale
|
||||||
//})
|
//})
|
||||||
},
|
},
|
||||||
focusOnCity() {
|
|
||||||
const citySelector = document.getElementById('citySelector');
|
|
||||||
citySelector.focus();
|
|
||||||
},
|
|
||||||
focusOnAddress() {
|
|
||||||
const addressSelector = document.getElementById('addressSelector');
|
|
||||||
addressSelector.focus();
|
|
||||||
},
|
|
||||||
getCountries() {
|
getCountries() {
|
||||||
console.log('getCountries');
|
console.log('getCountries');
|
||||||
this.loading = true;
|
|
||||||
fetchCountries().then(countries => new Promise((resolve, reject) => {
|
fetchCountries().then(countries => new Promise((resolve, reject) => {
|
||||||
this.address.loaded.countries = countries.results;
|
this.address.loaded.countries = countries.results;
|
||||||
resolve()
|
resolve()
|
||||||
this.loading = false;
|
|
||||||
}))
|
}))
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
this.errorMsg.push(error.message);
|
this.errorMsg.push(error.message);
|
||||||
this.loading = false;
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
getCities(country) {
|
getCities(country) {
|
||||||
console.log('getCities for', country.name);
|
console.log('getCities for', country.name);
|
||||||
this.loading = true;
|
|
||||||
fetchCities(country).then(cities => new Promise((resolve, reject) => {
|
fetchCities(country).then(cities => new Promise((resolve, reject) => {
|
||||||
this.address.loaded.cities = cities.results.filter(c => c.origin !== 3); // filter out user-defined cities
|
this.address.loaded.cities = cities.results.filter(c => c.origin !== 3); // filter out user-defined cities
|
||||||
resolve();
|
resolve();
|
||||||
this.loading = false;
|
|
||||||
}))
|
}))
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
this.errorMsg.push(error.message);
|
this.errorMsg.push(error.message);
|
||||||
this.loading = false;
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
getReferenceAddresses(city) {
|
getReferenceAddresses(city) {
|
||||||
this.loading = true;
|
|
||||||
console.log('getReferenceAddresses for', city.name);
|
console.log('getReferenceAddresses for', city.name);
|
||||||
fetchReferenceAddresses(city).then(addresses => new Promise((resolve, reject) => {
|
fetchReferenceAddresses(city).then(addresses => new Promise((resolve, reject) => {
|
||||||
console.log('addresses', addresses);
|
console.log('addresses', addresses);
|
||||||
this.address.loaded.addresses = addresses.results;
|
this.address.loaded.addresses = addresses.results;
|
||||||
resolve();
|
resolve();
|
||||||
this.loading = false;
|
|
||||||
}))
|
}))
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
this.errorMsg.push(error.message);
|
this.errorMsg.push(error.message);
|
||||||
this.loading = false;
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
updateMapCenter(point) {
|
updateMapCenter(point) {
|
||||||
|
@@ -23,7 +23,7 @@ export default {
|
|||||||
},
|
},
|
||||||
methods:{
|
methods:{
|
||||||
init() {
|
init() {
|
||||||
map = L.map('address_map').setView([46.67059, -1.42683], 12);
|
map = L.map('address_map').setView([48.8589, 2.3469], 12);
|
||||||
|
|
||||||
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||||
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
|
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
|
||||||
|
@@ -5,7 +5,6 @@
|
|||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
name="floor"
|
name="floor"
|
||||||
maxlength=16
|
|
||||||
:placeholder="$t('floor')"
|
:placeholder="$t('floor')"
|
||||||
v-model="floor"/>
|
v-model="floor"/>
|
||||||
</div>
|
</div>
|
||||||
@@ -14,7 +13,6 @@
|
|||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
name="corridor"
|
name="corridor"
|
||||||
maxlength=16
|
|
||||||
:placeholder="$t('corridor')"
|
:placeholder="$t('corridor')"
|
||||||
v-model="corridor"/>
|
v-model="corridor"/>
|
||||||
</div>
|
</div>
|
||||||
@@ -23,7 +21,6 @@
|
|||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
name="steps"
|
name="steps"
|
||||||
maxlength=16
|
|
||||||
:placeholder="$t('steps')"
|
:placeholder="$t('steps')"
|
||||||
v-model="steps"/>
|
v-model="steps"/>
|
||||||
</div>
|
</div>
|
||||||
@@ -32,7 +29,6 @@
|
|||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
name="flat"
|
name="flat"
|
||||||
maxlength=16
|
|
||||||
:placeholder="$t('flat')"
|
:placeholder="$t('flat')"
|
||||||
v-model="flat"/>
|
v-model="flat"/>
|
||||||
</div>
|
</div>
|
||||||
@@ -41,7 +37,6 @@
|
|||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
name="buildingName"
|
name="buildingName"
|
||||||
maxlength=255
|
|
||||||
:placeholder="$t('buildingName')"
|
:placeholder="$t('buildingName')"
|
||||||
v-model="buildingName"/>
|
v-model="buildingName"/>
|
||||||
</div>
|
</div>
|
||||||
@@ -50,7 +45,6 @@
|
|||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
name="extra"
|
name="extra"
|
||||||
maxlength=255
|
|
||||||
:placeholder="$t('extra')"
|
:placeholder="$t('extra')"
|
||||||
v-model="extra"/>
|
v-model="extra"/>
|
||||||
</div>
|
</div>
|
||||||
@@ -59,7 +53,6 @@
|
|||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
name="distribution"
|
name="distribution"
|
||||||
maxlength=255
|
|
||||||
:placeholder="$t('distribution')"
|
:placeholder="$t('distribution')"
|
||||||
v-model="distribution"/>
|
v-model="distribution"/>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -1,7 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<VueMultiselect
|
<VueMultiselect
|
||||||
id="addressSelector"
|
|
||||||
v-model="value"
|
v-model="value"
|
||||||
@select="selectAddress"
|
@select="selectAddress"
|
||||||
name="field"
|
name="field"
|
||||||
@@ -71,7 +70,7 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
transName(value) {
|
transName(value) {
|
||||||
return value.streetNumber === undefined ? value.street : `${value.streetNumber}, ${value.street}`
|
return value.streetNumber === undefined ? value.street : `${value.street}, ${value.streetNumber}`
|
||||||
},
|
},
|
||||||
selectAddress(value) {
|
selectAddress(value) {
|
||||||
this.address.selected.address = value;
|
this.address.selected.address = value;
|
||||||
|
@@ -1,7 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<VueMultiselect
|
<VueMultiselect
|
||||||
id="citySelector"
|
|
||||||
v-model="value"
|
v-model="value"
|
||||||
@select="selectCity"
|
@select="selectCity"
|
||||||
name="field"
|
name="field"
|
||||||
@@ -36,7 +35,7 @@ import VueMultiselect from 'vue-multiselect';
|
|||||||
export default {
|
export default {
|
||||||
name: 'CitySelection',
|
name: 'CitySelection',
|
||||||
components: { VueMultiselect },
|
components: { VueMultiselect },
|
||||||
props: ['address', 'getReferenceAddresses', 'focusOnAddress'],
|
props: ['address', 'getReferenceAddresses'],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
value: null
|
value: null
|
||||||
@@ -75,7 +74,6 @@ export default {
|
|||||||
this.address.newPostalCode.name = value.name;
|
this.address.newPostalCode.name = value.name;
|
||||||
this.address.newPostalCode.code = value.code;
|
this.address.newPostalCode.code = value.code;
|
||||||
this.getReferenceAddresses(value);
|
this.getReferenceAddresses(value);
|
||||||
this.focusOnAddress();
|
|
||||||
},
|
},
|
||||||
addPostalCode() {
|
addPostalCode() {
|
||||||
this.address.writeNewPostalCode = true;
|
this.address.writeNewPostalCode = true;
|
||||||
|
@@ -40,6 +40,7 @@ export default {
|
|||||||
return name.fr //TODO multilang
|
return name.fr //TODO multilang
|
||||||
},
|
},
|
||||||
selectCountry(value) {
|
selectCountry(value) {
|
||||||
|
console.log(value);
|
||||||
this.address.selected.country = value;
|
this.address.selected.country = value;
|
||||||
this.getCities(value);
|
this.getCities(value);
|
||||||
},
|
},
|
||||||
|
@@ -58,9 +58,9 @@ const messages = {
|
|||||||
},
|
},
|
||||||
create: {
|
create: {
|
||||||
button: "Créer \"{q}\"",
|
button: "Créer \"{q}\"",
|
||||||
title: "Création d'un nouvel usager ou d'un tiers professionnel",
|
title: "Créer à la volée…",
|
||||||
person: "un nouvel usager",
|
person: "un nouvel usager",
|
||||||
thirdparty: "un nouveau tiers professionnel"
|
thirdparty: "un nouveau tiers"
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@@ -2,169 +2,88 @@
|
|||||||
|
|
||||||
namespace Chill\MainBundle\Search;
|
namespace Chill\MainBundle\Search;
|
||||||
|
|
||||||
use Chill\MainBundle\Serializer\Model\Collection;
|
use Chill\PersonBundle\Entity\Person;
|
||||||
use Chill\MainBundle\Pagination\PaginatorFactory;
|
use Chill\ThirdPartyBundle\Entity\ThirdParty;
|
||||||
use Chill\PersonBundle\Search\SearchPersonApiProvider;
|
|
||||||
use Chill\ThirdPartyBundle\Search\ThirdPartyApiSearch;
|
|
||||||
use Doctrine\DBAL\Types\Types;
|
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Doctrine\ORM\Query\ResultSetMappingBuilder;
|
|
||||||
use Chill\MainBundle\Search\SearchProvider;
|
use Chill\MainBundle\Search\SearchProvider;
|
||||||
use Symfony\Component\VarDumper\Resources\functions\dump;
|
use Symfony\Component\VarDumper\Resources\functions\dump;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* ***Warning*** This is an incomplete implementation ***Warning***
|
||||||
*/
|
*/
|
||||||
class SearchApi
|
class SearchApi
|
||||||
{
|
{
|
||||||
private EntityManagerInterface $em;
|
private EntityManagerInterface $em;
|
||||||
private PaginatorFactory $paginator;
|
private SearchProvider $search;
|
||||||
|
|
||||||
private array $providers = [];
|
public function __construct(EntityManagerInterface $em, SearchProvider $search)
|
||||||
|
|
||||||
public function __construct(
|
|
||||||
EntityManagerInterface $em,
|
|
||||||
SearchPersonApiProvider $searchPerson,
|
|
||||||
ThirdPartyApiSearch $thirdPartyApiSearch,
|
|
||||||
PaginatorFactory $paginator
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
$this->em = $em;
|
$this->em = $em;
|
||||||
$this->providers[] = $searchPerson;
|
$this->search = $search;
|
||||||
$this->providers[] = $thirdPartyApiSearch;
|
|
||||||
$this->paginator = $paginator;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Model/Result[]
|
* @return Model/Result[]
|
||||||
*/
|
*/
|
||||||
public function getResults(string $pattern, array $types, array $parameters): Collection
|
public function getResults(string $query, int $offset, int $maxResult): array
|
||||||
{
|
{
|
||||||
$queries = $this->findQueries($pattern, $types, $parameters);
|
// **warning again**: this is an incomplete implementation
|
||||||
|
$results = [];
|
||||||
|
|
||||||
$total = $this->countItems($queries, $types, $parameters);
|
foreach ($this->getPersons($query) as $p) {
|
||||||
$paginator = $this->paginator->create($total);
|
$results[] = new Model\Result((float)\rand(0, 100) / 100, $p);
|
||||||
|
}
|
||||||
$rawResults = $this->fetchRawResult($queries, $types, $parameters, $paginator);
|
foreach ($this->getThirdParties($query) as $t) {
|
||||||
|
$results[] = new Model\Result((float)\rand(0, 100) / 100, $t);
|
||||||
$this->prepareProviders($rawResults);
|
|
||||||
$results = $this->buildResults($rawResults);
|
|
||||||
|
|
||||||
$collection = new Collection($results, $paginator);
|
|
||||||
|
|
||||||
return $collection;
|
|
||||||
}
|
|
||||||
|
|
||||||
private function findQueries($pattern, array $types, array $parameters): array
|
|
||||||
{
|
|
||||||
return \array_map(
|
|
||||||
fn($p) => $p->provideQuery($pattern, $parameters),
|
|
||||||
$this->findProviders($pattern, $types, $parameters),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
private function findProviders(string $pattern, array $types, array $parameters): array
|
|
||||||
{
|
|
||||||
return \array_filter(
|
|
||||||
$this->providers,
|
|
||||||
fn($p) => $p->supportsTypes($pattern, $types, $parameters)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
private function countItems($providers, $types, $parameters): int
|
|
||||||
{
|
|
||||||
list($countQuery, $parameters) = $this->buildCountQuery($providers, $types, $parameters);
|
|
||||||
$rsmCount = new ResultSetMappingBuilder($this->em);
|
|
||||||
$rsmCount->addScalarResult('count', 'count');
|
|
||||||
$countNq = $this->em->createNativeQuery($countQuery, $rsmCount);
|
|
||||||
$countNq->setParameters($parameters);
|
|
||||||
|
|
||||||
return $countNq->getSingleScalarResult();
|
|
||||||
}
|
|
||||||
|
|
||||||
private function buildCountQuery(array $queries, $types, $parameters)
|
|
||||||
{
|
|
||||||
$query = "SELECT COUNT(sq.key) AS count FROM ({union_unordered}) AS sq";
|
|
||||||
$unions = [];
|
|
||||||
$parameters = [];
|
|
||||||
|
|
||||||
foreach ($queries as $q) {
|
|
||||||
$unions[] = $q->buildQuery();
|
|
||||||
$parameters = \array_merge($parameters, $q->buildParameters());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$unionUnordered = \implode(" UNION ", $unions);
|
\usort($results, function(Model\Result $a, Model\Result $b) {
|
||||||
|
return ($a->getRelevance() <=> $b->getRelevance()) * -1;
|
||||||
|
});
|
||||||
|
|
||||||
return [
|
return $results;
|
||||||
\strtr($query, [ '{union_unordered}' => $unionUnordered ]),
|
|
||||||
$parameters
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function buildUnionQuery(array $queries, $types, $parameters)
|
public function countResults(string $query): int
|
||||||
{
|
{
|
||||||
$query = "{unions} ORDER BY pertinence DESC";
|
return 0;
|
||||||
$unions = [];
|
}
|
||||||
$parameters = [];
|
|
||||||
|
|
||||||
foreach ($queries as $q) {
|
private function getThirdParties(string $query)
|
||||||
$unions[] = $q->buildQuery();
|
{
|
||||||
$parameters = \array_merge($parameters, $q->buildParameters());
|
$thirdPartiesIds = $this->em->createQuery('SELECT t.id FROM '.ThirdParty::class.' t')
|
||||||
|
->getScalarResult();
|
||||||
|
$nbResults = rand(0, 15);
|
||||||
|
|
||||||
|
if ($nbResults === 1) {
|
||||||
|
$nbResults++;
|
||||||
|
} elseif ($nbResults === 0) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
$ids = \array_map(function ($e) use ($thirdPartiesIds) { return $thirdPartiesIds[$e]['id'];},
|
||||||
|
\array_rand($thirdPartiesIds, $nbResults));
|
||||||
|
|
||||||
|
$a = $this->em->getRepository(ThirdParty::class)
|
||||||
|
->findById($ids);
|
||||||
|
return $a;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getPersons(string $query)
|
||||||
|
{
|
||||||
|
$params = [
|
||||||
|
SearchInterface::SEARCH_PREVIEW_OPTION => false
|
||||||
|
];
|
||||||
|
$search = $this->search->getResultByName($query, 'person_regular', 0, 50, $params, 'json');
|
||||||
|
$ids = \array_map(function($r) { return $r['id']; }, $search['results']);
|
||||||
|
|
||||||
|
|
||||||
|
if (count($ids) === 0) {
|
||||||
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
$union = \implode(" UNION ", $unions);
|
return $this->em->getRepository(Person::class)
|
||||||
|
->findById($ids)
|
||||||
return [
|
|
||||||
\strtr($query, [ '{unions}' => $union]),
|
|
||||||
$parameters
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
private function fetchRawResult($queries, $types, $parameters, $paginator): array
|
|
||||||
{
|
|
||||||
list($union, $parameters) = $this->buildUnionQuery($queries, $types, $parameters, $paginator);
|
|
||||||
$rsm = new ResultSetMappingBuilder($this->em);
|
|
||||||
$rsm->addScalarResult('key', 'key', Types::STRING)
|
|
||||||
->addScalarResult('metadata', 'metadata', Types::JSON)
|
|
||||||
->addScalarResult('pertinence', 'pertinence', Types::FLOAT)
|
|
||||||
;
|
;
|
||||||
|
|
||||||
$nq = $this->em->createNativeQuery($union, $rsm);
|
|
||||||
$nq->setParameters($parameters);
|
|
||||||
|
|
||||||
return $nq->getResult();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function prepareProviders($rawResults)
|
|
||||||
{
|
|
||||||
$metadatas = [];
|
|
||||||
foreach ($rawResults as $r) {
|
|
||||||
foreach ($this->providers as $k => $p) {
|
|
||||||
if ($p->supportsResult($r['key'], $r['metadata'])) {
|
|
||||||
$metadatas[$k][] = $r['metadata'];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($metadatas as $k => $m) {
|
|
||||||
$this->providers[$k]->prepare($m);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private function buildResults($rawResults)
|
|
||||||
{
|
|
||||||
foreach ($rawResults as $r) {
|
|
||||||
foreach ($this->providers as $k => $p) {
|
|
||||||
if ($p->supportsResult($r['key'], $r['metadata'])) {
|
|
||||||
$items[] = (new SearchApiResult($r['pertinence']))
|
|
||||||
->setResult(
|
|
||||||
$p->getResult($r['key'], $r['metadata'], $r['pertinence'])
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $items ?? [];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -1,18 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Chill\MainBundle\Search;
|
|
||||||
|
|
||||||
use Chill\MainBundle\Search\SearchApiQuery;
|
|
||||||
|
|
||||||
interface SearchApiInterface
|
|
||||||
{
|
|
||||||
public function provideQuery(string $pattern, array $parameters): SearchApiQuery;
|
|
||||||
|
|
||||||
public function supportsTypes(string $pattern, array $types, array $parameters): bool;
|
|
||||||
|
|
||||||
public function prepare(array $metadatas): void;
|
|
||||||
|
|
||||||
public function supportsResult(string $key, array $metadatas): bool;
|
|
||||||
|
|
||||||
public function getResult(string $key, array $metadata, float $pertinence);
|
|
||||||
}
|
|
@@ -1,85 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Chill\MainBundle\Search;
|
|
||||||
|
|
||||||
class SearchApiQuery
|
|
||||||
{
|
|
||||||
private ?string $selectKey;
|
|
||||||
private array $selectKeyParams = [];
|
|
||||||
private ?string $jsonbMetadata;
|
|
||||||
private array $jsonbMetadataParams = [];
|
|
||||||
private ?string $pertinence;
|
|
||||||
private array $pertinenceParams = [];
|
|
||||||
private ?string $fromClause;
|
|
||||||
private array $fromClauseParams = [];
|
|
||||||
private ?string $whereClause;
|
|
||||||
private array $whereClauseParams = [];
|
|
||||||
|
|
||||||
public function setSelectKey(string $selectKey, array $params = []): self
|
|
||||||
{
|
|
||||||
$this->selectKey = $selectKey;
|
|
||||||
$this->selectKeyParams = $params;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setSelectJsonbMetadata(string $jsonbMetadata, array $params = []): self
|
|
||||||
{
|
|
||||||
$this->jsonbMetadata = $jsonbMetadata;
|
|
||||||
$this->jsonbMetadataParams = $params;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setSelectPertinence(string $pertinence, array $params = []): self
|
|
||||||
{
|
|
||||||
$this->pertinence = $pertinence;
|
|
||||||
$this->pertinenceParams = $params;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setFromClause(string $fromClause, array $params = []): self
|
|
||||||
{
|
|
||||||
$this->fromClause = $fromClause;
|
|
||||||
$this->fromClauseParams = $params;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setWhereClause(string $whereClause, array $params = []): self
|
|
||||||
{
|
|
||||||
$this->whereClause = $whereClause;
|
|
||||||
$this->whereClauseParams = $params;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function buildQuery(): string
|
|
||||||
{
|
|
||||||
return \strtr("SELECT
|
|
||||||
'{key}' AS key,
|
|
||||||
{metadata} AS metadata,
|
|
||||||
{pertinence} AS pertinence
|
|
||||||
FROM {from}
|
|
||||||
WHERE {where}
|
|
||||||
", [
|
|
||||||
'{key}' => $this->selectKey,
|
|
||||||
'{metadata}' => $this->jsonbMetadata,
|
|
||||||
'{pertinence}' => $this->pertinence,
|
|
||||||
'{from}' => $this->fromClause,
|
|
||||||
'{where}' => $this->whereClause
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function buildParameters(): array
|
|
||||||
{
|
|
||||||
return \array_merge(
|
|
||||||
$this->selectKeyParams,
|
|
||||||
$this->jsonbMetadataParams,
|
|
||||||
$this->pertinenceParams,
|
|
||||||
$this->fromClauseParams,
|
|
||||||
$this->whereClauseParams
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,40 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Chill\MainBundle\Search;
|
|
||||||
|
|
||||||
use Symfony\Component\Serializer\Annotation as Serializer;
|
|
||||||
|
|
||||||
class SearchApiResult
|
|
||||||
{
|
|
||||||
private float $pertinence;
|
|
||||||
|
|
||||||
private $result;
|
|
||||||
|
|
||||||
public function __construct(float $relevance)
|
|
||||||
{
|
|
||||||
$this->relevance = $relevance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setResult($result): self
|
|
||||||
{
|
|
||||||
$this->result = $result;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Serializer\Groups({"read"})
|
|
||||||
*/
|
|
||||||
public function getResult()
|
|
||||||
{
|
|
||||||
return $this->result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Serializer\Groups({"read"})
|
|
||||||
*/
|
|
||||||
public function getRelevance(): float
|
|
||||||
{
|
|
||||||
return $this->relevance;
|
|
||||||
}
|
|
||||||
}
|
|
@@ -14,7 +14,7 @@ class AddressNormalizer implements NormalizerAwareInterface, NormalizerInterface
|
|||||||
public function normalize($address, string $format = null, array $context = [])
|
public function normalize($address, string $format = null, array $context = [])
|
||||||
{
|
{
|
||||||
$data['address_id'] = $address->getId();
|
$data['address_id'] = $address->getId();
|
||||||
$data['text'] = $address->isNoAddress() ? '' : $address->getStreetNumber().', '.$address->getStreet();
|
$data['text'] = $address->getStreet().', '.$address->getStreetNumber();
|
||||||
$data['street'] = $address->getStreet();
|
$data['street'] = $address->getStreet();
|
||||||
$data['streetNumber'] = $address->getStreetNumber();
|
$data['streetNumber'] = $address->getStreetNumber();
|
||||||
$data['postcode']['name'] = $address->getPostCode()->getName();
|
$data['postcode']['name'] = $address->getPostCode()->getName();
|
||||||
|
@@ -1,36 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Bundle\ChillMainBundle\Tests\Controller;
|
|
||||||
|
|
||||||
use Chill\MainBundle\Test\PrepareClientTrait;
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
|
||||||
|
|
||||||
class SearchApiControllerTest extends WebTestCase
|
|
||||||
{
|
|
||||||
use PrepareClientTrait;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @dataProvider generateSearchData
|
|
||||||
*/
|
|
||||||
public function testSearch(string $pattern, array $types)
|
|
||||||
{
|
|
||||||
$client = $this->getClientAuthenticated();
|
|
||||||
|
|
||||||
$client->request(
|
|
||||||
Request::METHOD_GET,
|
|
||||||
'/api/1.0/search.json',
|
|
||||||
[ 'q' => $pattern, 'type' => $types ]
|
|
||||||
);
|
|
||||||
|
|
||||||
$this->assertResponseIsSuccessful();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function generateSearchData()
|
|
||||||
{
|
|
||||||
yield ['per', ['person', 'thirdparty'] ];
|
|
||||||
yield ['per', ['thirdparty'] ];
|
|
||||||
yield ['per', ['person'] ];
|
|
||||||
yield ['fjklmeqjfkdqjklrmefdqjklm', ['person', 'thirdparty'] ];
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,49 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Chill\MainBundle\Tests\Controller;
|
|
||||||
|
|
||||||
use Chill\MainBundle\Test\PrepareClientTrait;
|
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
|
||||||
|
|
||||||
class UserApiControllerTest extends WebTestCase
|
|
||||||
{
|
|
||||||
use PrepareClientTrait;
|
|
||||||
|
|
||||||
public function testIndex()
|
|
||||||
{
|
|
||||||
$client = $this->getClientAuthenticated();
|
|
||||||
|
|
||||||
$client->request(Request::METHOD_GET, '/api/1.0/main/user.json');
|
|
||||||
|
|
||||||
$this->assertResponseIsSuccessful();
|
|
||||||
|
|
||||||
$data = \json_decode($client->getResponse()->getContent(), true);
|
|
||||||
$this->assertTrue(\array_key_exists('count', $data));
|
|
||||||
$this->assertGreaterThan(0, $data['count']);
|
|
||||||
$this->assertTrue(\array_key_exists('results', $data));
|
|
||||||
|
|
||||||
return $data['results'][0];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @depends testIndex
|
|
||||||
*/
|
|
||||||
public function testEntity($existingUser)
|
|
||||||
{
|
|
||||||
$client = $this->getClientAuthenticated();
|
|
||||||
|
|
||||||
$client->request(Request::METHOD_GET, '/api/1.0/main/user/'.$existingUser['id'].'.json');
|
|
||||||
|
|
||||||
$this->assertResponseIsSuccessful();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testWhoami()
|
|
||||||
{
|
|
||||||
$client = $this->getClientAuthenticated();
|
|
||||||
|
|
||||||
$client->request(Request::METHOD_GET, '/api/1.0/main/whoami.json');
|
|
||||||
|
|
||||||
$this->assertResponseIsSuccessful();
|
|
||||||
}
|
|
||||||
}
|
|
@@ -10,19 +10,6 @@ servers:
|
|||||||
|
|
||||||
components:
|
components:
|
||||||
schemas:
|
schemas:
|
||||||
User:
|
|
||||||
type: object
|
|
||||||
properties:
|
|
||||||
id:
|
|
||||||
type: integer
|
|
||||||
type:
|
|
||||||
type: string
|
|
||||||
enum:
|
|
||||||
- user
|
|
||||||
username:
|
|
||||||
type: string
|
|
||||||
text:
|
|
||||||
type: string
|
|
||||||
Center:
|
Center:
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
@@ -438,46 +425,3 @@ paths:
|
|||||||
description: "not found"
|
description: "not found"
|
||||||
401:
|
401:
|
||||||
description: "Unauthorized"
|
description: "Unauthorized"
|
||||||
|
|
||||||
|
|
||||||
/1.0/main/user.json:
|
|
||||||
get:
|
|
||||||
tags:
|
|
||||||
- user
|
|
||||||
summary: Return a list of all user
|
|
||||||
responses:
|
|
||||||
200:
|
|
||||||
description: "ok"
|
|
||||||
/1.0/main/whoami.json:
|
|
||||||
get:
|
|
||||||
tags:
|
|
||||||
- user
|
|
||||||
summary: Return the currently authenticated user
|
|
||||||
responses:
|
|
||||||
200:
|
|
||||||
description: "ok"
|
|
||||||
/1.0/main/user/{id}.json:
|
|
||||||
get:
|
|
||||||
tags:
|
|
||||||
- user
|
|
||||||
summary: Return a user by id
|
|
||||||
parameters:
|
|
||||||
- name: id
|
|
||||||
in: path
|
|
||||||
required: true
|
|
||||||
description: The user id
|
|
||||||
schema:
|
|
||||||
type: integer
|
|
||||||
format: integer
|
|
||||||
minimum: 1
|
|
||||||
responses:
|
|
||||||
200:
|
|
||||||
description: "ok"
|
|
||||||
content:
|
|
||||||
application/json:
|
|
||||||
schema:
|
|
||||||
$ref: '#/components/schemas/User'
|
|
||||||
404:
|
|
||||||
description: "not found"
|
|
||||||
401:
|
|
||||||
description: "Unauthorized"
|
|
||||||
|
@@ -56,6 +56,7 @@ module.exports = function(encore, entries)
|
|||||||
// Chill2 new assets
|
// Chill2 new assets
|
||||||
encore.addEntry('forkawesome', __dirname + '/Resources/public/modules/forkawesome/index.js');
|
encore.addEntry('forkawesome', __dirname + '/Resources/public/modules/forkawesome/index.js');
|
||||||
encore.addEntry('bootstrap', __dirname + '/Resources/public/modules/bootstrap/index.js');
|
encore.addEntry('bootstrap', __dirname + '/Resources/public/modules/bootstrap/index.js');
|
||||||
|
//encore.addEntry('vuejs', __dirname + '/Resources/public/modules/vue/index.js');
|
||||||
|
|
||||||
// CKEditor5
|
// CKEditor5
|
||||||
buildCKEditor(encore);
|
buildCKEditor(encore);
|
||||||
|
@@ -5,5 +5,6 @@ services:
|
|||||||
Chill\MainBundle\Search\SearchProvider: '@chill_main.search_provider'
|
Chill\MainBundle\Search\SearchProvider: '@chill_main.search_provider'
|
||||||
|
|
||||||
Chill\MainBundle\Search\SearchApi:
|
Chill\MainBundle\Search\SearchApi:
|
||||||
autowire: true
|
arguments:
|
||||||
autoconfigure: true
|
$em: '@Doctrine\ORM\EntityManagerInterface'
|
||||||
|
$search: '@Chill\MainBundle\Search\SearchProvider'
|
||||||
|
@@ -2,12 +2,10 @@
|
|||||||
|
|
||||||
namespace Chill\PersonBundle\Controller;
|
namespace Chill\PersonBundle\Controller;
|
||||||
|
|
||||||
use Chill\ActivityBundle\Entity\Activity;
|
|
||||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||||
use Chill\PersonBundle\Entity\AccompanyingPeriodParticipation;
|
use Chill\PersonBundle\Entity\AccompanyingPeriodParticipation;
|
||||||
use Chill\PersonBundle\Privacy\AccompanyingPeriodPrivacyEvent;
|
use Chill\PersonBundle\Privacy\AccompanyingPeriodPrivacyEvent;
|
||||||
use Chill\PersonBundle\Entity\Person;
|
use Chill\PersonBundle\Entity\Person;
|
||||||
use Chill\PersonBundle\Repository\AccompanyingPeriod\AccompanyingPeriodWorkRepository;
|
|
||||||
use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter;
|
use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter;
|
||||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
|
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||||
@@ -36,18 +34,14 @@ class AccompanyingCourseController extends Controller
|
|||||||
|
|
||||||
protected ValidatorInterface $validator;
|
protected ValidatorInterface $validator;
|
||||||
|
|
||||||
private AccompanyingPeriodWorkRepository $workRepository;
|
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
SerializerInterface $serializer,
|
SerializerInterface $serializer,
|
||||||
EventDispatcherInterface $dispatcher,
|
EventDispatcherInterface $dispatcher,
|
||||||
ValidatorInterface $validator,
|
ValidatorInterface $validator
|
||||||
AccompanyingPeriodWorkRepository $workRepository
|
|
||||||
) {
|
) {
|
||||||
$this->serializer = $serializer;
|
$this->serializer = $serializer;
|
||||||
$this->dispatcher = $dispatcher;
|
$this->dispatcher = $dispatcher;
|
||||||
$this->validator = $validator;
|
$this->validator = $validator;
|
||||||
$this->workRepository = $workRepository;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -102,22 +96,9 @@ class AccompanyingCourseController extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$activities = $this->getDoctrine()->getManager()->getRepository(Activity::class)->findBy(
|
|
||||||
['accompanyingPeriod' => $accompanyingCourse],
|
|
||||||
['date' => 'DESC'],
|
|
||||||
);
|
|
||||||
|
|
||||||
$works = $this->workRepository->findByAccompanyingPeriod(
|
|
||||||
$accompanyingCourse,
|
|
||||||
['startDate' => 'DESC', 'endDate' => 'DESC'],
|
|
||||||
3
|
|
||||||
);
|
|
||||||
|
|
||||||
return $this->render('@ChillPerson/AccompanyingCourse/index.html.twig', [
|
return $this->render('@ChillPerson/AccompanyingCourse/index.html.twig', [
|
||||||
'accompanyingCourse' => $accompanyingCourse,
|
'accompanyingCourse' => $accompanyingCourse,
|
||||||
'withoutHousehold' => $withoutHousehold,
|
'withoutHousehold' => $withoutHousehold
|
||||||
'works' => $works,
|
|
||||||
'activities' => $activities
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,23 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Chill\PersonBundle\Controller;
|
|
||||||
|
|
||||||
use Chill\MainBundle\CRUD\Controller\ApiController;
|
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
|
||||||
|
|
||||||
class AccompanyingCourseWorkApiController extends ApiController
|
|
||||||
{
|
|
||||||
protected function getContextForSerialization(string $action, Request $request, string $_format, $entity): array
|
|
||||||
{
|
|
||||||
switch($action) {
|
|
||||||
case '_entity':
|
|
||||||
switch ($request->getMethod()) {
|
|
||||||
case Request::METHOD_PUT:
|
|
||||||
return [ 'groups' => [ 'accompanying_period_work:edit' ] ];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return parent::getContextForSerialization($action, $request, $_format, $entity);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@@ -2,44 +2,32 @@
|
|||||||
|
|
||||||
namespace Chill\PersonBundle\Controller;
|
namespace Chill\PersonBundle\Controller;
|
||||||
|
|
||||||
use Chill\MainBundle\Pagination\PaginatorFactory;
|
|
||||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||||
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork;
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\Routing\Annotation\Route;
|
use Symfony\Component\Routing\Annotation\Route;
|
||||||
use Symfony\Component\Serializer\SerializerInterface;
|
use Symfony\Component\Serializer\SerializerInterface;
|
||||||
use Symfony\Component\Translation\TranslatorInterface;
|
use Symfony\Component\Translation\TranslatorInterface;
|
||||||
use Chill\PersonBundle\Repository\AccompanyingPeriod\AccompanyingPeriodWorkRepository;
|
|
||||||
|
|
||||||
class AccompanyingCourseWorkController extends AbstractController
|
class AccompanyingCourseWorkController extends AbstractController
|
||||||
{
|
{
|
||||||
private TranslatorInterface $trans;
|
private TranslatorInterface $trans;
|
||||||
private SerializerInterface $serializer;
|
private SerializerInterface $serializer;
|
||||||
private AccompanyingPeriodWorkRepository $workRepository;
|
|
||||||
private PaginatorFactory $paginator;
|
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(TranslatorInterface $trans, SerializerInterface $serializer)
|
||||||
TranslatorInterface $trans,
|
{
|
||||||
SerializerInterface $serializer,
|
|
||||||
AccompanyingPeriodWorkRepository $workRepository,
|
|
||||||
PaginatorFactory $paginator
|
|
||||||
) {
|
|
||||||
$this->trans = $trans;
|
$this->trans = $trans;
|
||||||
$this->serializer = $serializer;
|
$this->serializer = $serializer;
|
||||||
$this->workRepository = $workRepository;
|
|
||||||
$this->paginator = $paginator;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Route(
|
* @Route(
|
||||||
* "{_locale}/person/accompanying-period/{id}/work/new",
|
* "{_locale}/person/accompanying-period/{id}/work/new",
|
||||||
* name="chill_person_accompanying_period_work_new",
|
* methods={"GET", "POST"}
|
||||||
* methods={"GET"}
|
|
||||||
* )
|
* )
|
||||||
*/
|
*/
|
||||||
public function createWork(AccompanyingPeriod $period): Response
|
public function createWork(AccompanyingPeriod $period)
|
||||||
{
|
{
|
||||||
// TODO ACL
|
// TODO ACL
|
||||||
|
|
||||||
@@ -61,49 +49,4 @@ class AccompanyingCourseWorkController extends AbstractController
|
|||||||
'json' => $json
|
'json' => $json
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @Route(
|
|
||||||
* "{_locale}/person/accompanying-period/work/{id}/edit",
|
|
||||||
* name="chill_person_accompanying_period_work_edit",
|
|
||||||
* methods={"GET"}
|
|
||||||
* )
|
|
||||||
*/
|
|
||||||
public function editWork(AccompanyingPeriodWork $work): Response
|
|
||||||
{
|
|
||||||
// TODO ACL
|
|
||||||
$json = $this->serializer->normalize($work, 'json', [ "groups" => [ "read" ] ]);
|
|
||||||
return $this->render('@ChillPerson/AccompanyingCourseWork/edit.html.twig', [
|
|
||||||
'accompanyingCourse' => $work->getAccompanyingPeriod(),
|
|
||||||
'work' => $work,
|
|
||||||
'json' => $json
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Route(
|
|
||||||
* "{_locale}/person/accompanying-period/{id}/work",
|
|
||||||
* name="chill_person_accompanying_period_work_list",
|
|
||||||
* methods={"GET"}
|
|
||||||
* )
|
|
||||||
*/
|
|
||||||
public function listWorkByAccompanyingPeriod(AccompanyingPeriod $period): Response
|
|
||||||
{
|
|
||||||
// TODO ACL
|
|
||||||
$totalItems = $this->workRepository->countByAccompanyingPeriod($period);
|
|
||||||
$paginator = $this->paginator->create($totalItems);
|
|
||||||
|
|
||||||
$works = $this->workRepository->findByAccompanyingPeriod(
|
|
||||||
$period,
|
|
||||||
['startDate' => 'DESC', 'endDate' => 'DESC'],
|
|
||||||
$paginator->getItemsPerPage(),
|
|
||||||
$paginator->getCurrentPageFirstItemNumber()
|
|
||||||
);
|
|
||||||
|
|
||||||
return $this->render('@ChillPerson/AccompanyingCourseWork/list_by_accompanying_period.html.twig', [
|
|
||||||
'accompanyingCourse' => $period,
|
|
||||||
'works' => $works,
|
|
||||||
'paginator' => $paginator
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -75,10 +75,8 @@ class AccompanyingPeriodController extends AbstractController
|
|||||||
]);
|
]);
|
||||||
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event);
|
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event);
|
||||||
|
|
||||||
$accompanyingPeriods = $person->getAccompanyingPeriodsOrdered();
|
|
||||||
|
|
||||||
return $this->render('ChillPersonBundle:AccompanyingPeriod:list.html.twig', [
|
return $this->render('ChillPersonBundle:AccompanyingPeriod:list.html.twig', [
|
||||||
'accompanying_periods' => $accompanyingPeriods,
|
'accompanying_periods' => $person->getAccompanyingPeriodsOrdered(),
|
||||||
'person' => $person
|
'person' => $person
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
@@ -4,50 +4,15 @@ namespace Chill\PersonBundle\Controller;
|
|||||||
|
|
||||||
use Chill\MainBundle\CRUD\Controller\ApiController;
|
use Chill\MainBundle\CRUD\Controller\ApiController;
|
||||||
use Chill\MainBundle\Entity\Address;
|
use Chill\MainBundle\Entity\Address;
|
||||||
use Chill\MainBundle\Serializer\Model\Collection;
|
|
||||||
use Chill\PersonBundle\Entity\Person;
|
|
||||||
use Chill\PersonBundle\Repository\Household\HouseholdRepository;
|
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
|
|
||||||
|
|
||||||
class HouseholdApiController extends ApiController
|
class HouseholdApiController extends ApiController
|
||||||
{
|
{
|
||||||
private HouseholdRepository $householdRepository;
|
|
||||||
|
|
||||||
public function __construct(HouseholdRepository $householdRepository)
|
|
||||||
{
|
|
||||||
$this->householdRepository = $householdRepository;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public function householdAddressApi($id, Request $request, string $_format): Response
|
public function householdAddressApi($id, Request $request, string $_format): Response
|
||||||
{
|
{
|
||||||
return $this->addRemoveSomething('address', $id, $request, $_format, 'address', Address::class, [ 'groups' => [ 'read' ] ]);
|
return $this->addRemoveSomething('address', $id, $request, $_format, 'address', Address::class, [ 'groups' => [ 'read' ] ]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Find Household of people participating to the same AccompanyingPeriod
|
|
||||||
*
|
|
||||||
* @ParamConverter("person", options={"id" = "person_id"})
|
|
||||||
*/
|
|
||||||
public function suggestHouseholdByAccompanyingPeriodParticipationApi(Person $person, string $_format)
|
|
||||||
{
|
|
||||||
// TODO add acl
|
|
||||||
|
|
||||||
$count = $this->householdRepository->countByAccompanyingPeriodParticipation($person);
|
|
||||||
$paginator = $this->getPaginatorFactory()->create($count);
|
|
||||||
|
|
||||||
if ($count === 0) {
|
|
||||||
$households = [];
|
|
||||||
} else {
|
|
||||||
$households = $this->householdRepository->findByAccompanyingPeriodParticipation($person,
|
|
||||||
$paginator->getItemsPerPage(), $paginator->getCurrentPageFirstItemNumber());
|
|
||||||
}
|
|
||||||
|
|
||||||
$collection = new Collection($households, $paginator);
|
|
||||||
|
|
||||||
return $this->json($collection, Response::HTTP_OK, [],
|
|
||||||
[ "groups" => ["read"]]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -67,31 +67,6 @@ class HouseholdController extends AbstractController
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @Route(
|
|
||||||
* "/{household_id}/accompanying-period",
|
|
||||||
* name="chill_person_household_accompanying_period",
|
|
||||||
* methods={"GET", "HEAD"}
|
|
||||||
* )
|
|
||||||
* @ParamConverter("household", options={"id" = "household_id"})
|
|
||||||
*/
|
|
||||||
public function accompanyingPeriod(Request $request, Household $household)
|
|
||||||
{
|
|
||||||
// TODO ACL
|
|
||||||
|
|
||||||
$members = $household->getMembers();
|
|
||||||
foreach($members as $m) {
|
|
||||||
$accompanyingPeriods = $m->getPerson()->getAccompanyingPeriods();
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->render('@ChillPerson/Household/accompanying_period.html.twig',
|
|
||||||
[
|
|
||||||
'household' => $household,
|
|
||||||
'accompanying_periods' => $accompanyingPeriods
|
|
||||||
]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Route(
|
* @Route(
|
||||||
* "/{household_id}/addresses",
|
* "/{household_id}/addresses",
|
||||||
|
@@ -3,7 +3,6 @@
|
|||||||
namespace Chill\PersonBundle\Controller;
|
namespace Chill\PersonBundle\Controller;
|
||||||
|
|
||||||
use Chill\PersonBundle\Entity\Household\Position;
|
use Chill\PersonBundle\Entity\Household\Position;
|
||||||
use Chill\PersonBundle\Repository\AccompanyingPeriodRepository;
|
|
||||||
use Chill\PersonBundle\Security\Authorization\PersonVoter;
|
use Chill\PersonBundle\Security\Authorization\PersonVoter;
|
||||||
use Chill\PersonBundle\Entity\Person;
|
use Chill\PersonBundle\Entity\Person;
|
||||||
use Chill\PersonBundle\Entity\Household\Household;
|
use Chill\PersonBundle\Entity\Household\Household;
|
||||||
@@ -26,17 +25,11 @@ class HouseholdMemberController extends ApiController
|
|||||||
|
|
||||||
private TranslatorInterface $translator;
|
private TranslatorInterface $translator;
|
||||||
|
|
||||||
private AccompanyingPeriodRepository $periodRepository;
|
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(UrlGeneratorInterface $generator, TranslatorInterface $translator)
|
||||||
UrlGeneratorInterface $generator,
|
|
||||||
TranslatorInterface $translator,
|
|
||||||
AccompanyingPeriodRepository $periodRepository
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
$this->generator = $generator;
|
$this->generator = $generator;
|
||||||
$this->translator = $translator;
|
$this->translator = $translator;
|
||||||
$this->periodRepository = $periodRepository;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -151,23 +144,8 @@ class HouseholdMemberController extends ApiController
|
|||||||
'allowLeaveWithoutHousehold' => $allowLeaveWithoutHousehold ?? $request->query->has('allow_leave_without_household'),
|
'allowLeaveWithoutHousehold' => $allowLeaveWithoutHousehold ?? $request->query->has('allow_leave_without_household'),
|
||||||
];
|
];
|
||||||
|
|
||||||
// context
|
|
||||||
if ($request->query->has('accompanying_period_id')) {
|
|
||||||
$period = $this->periodRepository->find(
|
|
||||||
$request->query->getInt('accompanying_period_id')
|
|
||||||
);
|
|
||||||
|
|
||||||
if ($period === null) {
|
|
||||||
throw $this->createNotFoundException('period not found');
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO add acl on accompanying Course
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->render('@ChillPerson/Household/members_editor.html.twig', [
|
return $this->render('@ChillPerson/Household/members_editor.html.twig', [
|
||||||
'data' => $data,
|
'data' => $data
|
||||||
'expandSuggestions' => (int) $request->query->getBoolean('expand_suggestions', false),
|
|
||||||
'accompanyingCourse' => $period ?? null,
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -297,16 +297,18 @@ class PersonAddressController extends AbstractController
|
|||||||
*/
|
*/
|
||||||
protected function findAddressById(Person $person, $address_id)
|
protected function findAddressById(Person $person, $address_id)
|
||||||
{
|
{
|
||||||
$address = $this->getDoctrine()->getManager()
|
// filtering address
|
||||||
->getRepository(Address::class)
|
$criteria = Criteria::create()
|
||||||
->find($address_id)
|
->where(Criteria::expr()->eq('id', $address_id))
|
||||||
;
|
->setMaxResults(1);
|
||||||
|
$addresses = $person->getAddresses()->matching($criteria);
|
||||||
|
|
||||||
if (!$person->getAddresses()->contains($address)) {
|
if (count($addresses) === 0) {
|
||||||
throw $this->createAccessDeniedException("Not allowed to see this address");
|
throw $this->createNotFoundException("Address with id $address_id "
|
||||||
|
. "matching person $person_id not found ");
|
||||||
}
|
}
|
||||||
|
|
||||||
return $address;
|
return $addresses->first();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -1,21 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Chill\PersonBundle\Controller;
|
|
||||||
|
|
||||||
use Chill\MainBundle\CRUD\Controller\ApiController;
|
|
||||||
use Chill\MainBundle\Pagination\PaginatorInterface;
|
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
|
||||||
|
|
||||||
class SocialIssueApiController extends ApiController
|
|
||||||
{
|
|
||||||
protected function customizeQuery(string $action, Request $request, $query): void
|
|
||||||
{
|
|
||||||
$query->where(
|
|
||||||
$query->expr()->orX(
|
|
||||||
$query->expr()->gt('e.desactivationDate', ':now'),
|
|
||||||
$query->expr()->isNull('e.desactivationDate')
|
|
||||||
)
|
|
||||||
);
|
|
||||||
$query->setParameter('now', new \DateTimeImmutable());
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,40 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Chill\PersonBundle\Controller;
|
|
||||||
|
|
||||||
use Chill\MainBundle\Pagination\PaginatorFactory;
|
|
||||||
use Chill\MainBundle\Serializer\Model\Collection;
|
|
||||||
use Chill\PersonBundle\Entity\SocialWork\SocialAction;
|
|
||||||
use Chill\PersonBundle\Entity\SocialWork\Goal;
|
|
||||||
use Chill\PersonBundle\Repository\SocialWork\GoalRepository;
|
|
||||||
use Chill\MainBundle\CRUD\Controller\ApiController;
|
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
|
||||||
|
|
||||||
class SocialWorkGoalApiController extends ApiController
|
|
||||||
{
|
|
||||||
private GoalRepository $goalRepository;
|
|
||||||
|
|
||||||
private PaginatorFactory $paginator;
|
|
||||||
|
|
||||||
|
|
||||||
public function __construct(GoalRepository $goalRepository, PaginatorFactory $paginator)
|
|
||||||
{
|
|
||||||
$this->goalRepository = $goalRepository;
|
|
||||||
$this->paginator = $paginator;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function listBySocialAction(Request $request, SocialAction $action): Response
|
|
||||||
{
|
|
||||||
$totalItems = $this->goalRepository->countBySocialActionWithDescendants($action);
|
|
||||||
$paginator = $this->getPaginatorFactory()->create($totalItems);
|
|
||||||
|
|
||||||
$entities = $this->goalRepository->findBySocialActionWithDescendants($action, ["id" => "ASC"],
|
|
||||||
$paginator->getItemsPerPage(), $paginator->getCurrentPageFirstItemNumber());
|
|
||||||
|
|
||||||
$model = new Collection($entities, $paginator);
|
|
||||||
|
|
||||||
return $this->json($model, Response::HTTP_OK, [], [ "groups" => [ "read" ]]);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@@ -1,47 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Chill\PersonBundle\Controller;
|
|
||||||
|
|
||||||
use Chill\MainBundle\Serializer\Model\Collection;
|
|
||||||
use Chill\PersonBundle\Entity\SocialWork\SocialAction;
|
|
||||||
use Chill\PersonBundle\Entity\SocialWork\Goal;
|
|
||||||
use Chill\PersonBundle\Repository\SocialWork\ResultRepository;
|
|
||||||
use Chill\MainBundle\CRUD\Controller\ApiController;
|
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
|
||||||
|
|
||||||
class SocialWorkResultApiController extends ApiController
|
|
||||||
{
|
|
||||||
private ResultRepository $resultRepository;
|
|
||||||
|
|
||||||
public function __construct(ResultRepository $resultRepository)
|
|
||||||
{
|
|
||||||
$this->resultRepository = $resultRepository;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function listBySocialAction(Request $request, SocialAction $action): Response
|
|
||||||
{
|
|
||||||
$totalItems = $this->resultRepository->countBySocialActionWithDescendants($action);
|
|
||||||
$paginator = $this->getPaginatorFactory()->create($totalItems);
|
|
||||||
|
|
||||||
$entities = $this->resultRepository->findBySocialActionWithDescendants($action, ["id" => "ASC"],
|
|
||||||
$paginator->getItemsPerPage(), $paginator->getCurrentPageFirstItemNumber());
|
|
||||||
|
|
||||||
$model = new Collection($entities, $paginator);
|
|
||||||
|
|
||||||
return $this->json($model, Response::HTTP_OK, [], [ "groups" => [ "read" ]]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function listByGoal(Request $request, Goal $goal): Response
|
|
||||||
{
|
|
||||||
$totalItems = $this->resultRepository->countByGoal($goal);
|
|
||||||
$paginator = $this->getPaginatorFactory()->create($totalItems);
|
|
||||||
|
|
||||||
$entities = $this->resultRepository->findByGoal($goal, ["id" => "ASC"],
|
|
||||||
$paginator->getItemsPerPage(), $paginator->getCurrentPageFirstItemNumber());
|
|
||||||
|
|
||||||
$model = new Collection($entities, $paginator);
|
|
||||||
|
|
||||||
return $this->json($model, Response::HTTP_OK, [], [ "groups" => [ "read" ]]);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -488,7 +488,6 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
|
|||||||
[
|
[
|
||||||
'class' => \Chill\PersonBundle\Entity\SocialWork\SocialIssue::class,
|
'class' => \Chill\PersonBundle\Entity\SocialWork\SocialIssue::class,
|
||||||
'name' => 'social_work_social_issue',
|
'name' => 'social_work_social_issue',
|
||||||
'controller' => \Chill\PersonBundle\Controller\SocialIssueApiController::class,
|
|
||||||
'base_path' => '/api/1.0/person/social-work/social-issue',
|
'base_path' => '/api/1.0/person/social-work/social-issue',
|
||||||
'base_role' => 'ROLE_USER',
|
'base_role' => 'ROLE_USER',
|
||||||
'actions' => [
|
'actions' => [
|
||||||
@@ -554,6 +553,7 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
|
|||||||
'methods' => [
|
'methods' => [
|
||||||
Request::METHOD_GET => true,
|
Request::METHOD_GET => true,
|
||||||
Request::METHOD_HEAD => true,
|
Request::METHOD_HEAD => true,
|
||||||
|
Request::METHOD_POST=> true,
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
'address' => [
|
'address' => [
|
||||||
@@ -565,13 +565,25 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
|
|||||||
],
|
],
|
||||||
'controller_action' => 'householdAddressApi'
|
'controller_action' => 'householdAddressApi'
|
||||||
],
|
],
|
||||||
'suggestHouseholdByAccompanyingPeriodParticipation' => [
|
]
|
||||||
'path' => '/suggest/by-person/{person_id}/through-accompanying-period-participation.{_format}',
|
],
|
||||||
|
[
|
||||||
|
'class' => \Chill\PersonBundle\Entity\Household\Household::class,
|
||||||
|
'name' => 'household',
|
||||||
|
'base_path' => '/api/1.0/person/household',
|
||||||
|
// TODO: acl
|
||||||
|
'base_role' => 'ROLE_USER',
|
||||||
|
'actions' => [
|
||||||
|
'_entity' => [
|
||||||
'methods' => [
|
'methods' => [
|
||||||
Request::METHOD_GET => true,
|
Request::METHOD_GET => true,
|
||||||
Request::METHOD_HEAD => true,
|
Request::METHOD_HEAD => true,
|
||||||
|
],
|
||||||
|
'roles' => [
|
||||||
|
Request::METHOD_GET => 'ROLE_USER',
|
||||||
|
Request::METHOD_HEAD => 'ROLE_USER',
|
||||||
]
|
]
|
||||||
]
|
],
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
@@ -617,127 +629,6 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
|
|||||||
]
|
]
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
[
|
|
||||||
'class' => \Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork::class,
|
|
||||||
'name' => 'accompanying_period_work',
|
|
||||||
'base_path' => '/api/1.0/person/accompanying-course/work',
|
|
||||||
'controller' => \Chill\PersonBundle\Controller\AccompanyingCourseWorkApiController::class,
|
|
||||||
// TODO: acl
|
|
||||||
'base_role' => 'ROLE_USER',
|
|
||||||
'actions' => [
|
|
||||||
'_entity' => [
|
|
||||||
'methods' => [
|
|
||||||
Request::METHOD_GET => true,
|
|
||||||
Request::METHOD_HEAD => true,
|
|
||||||
Request::METHOD_PATCH => true,
|
|
||||||
Request::METHOD_PUT => true,
|
|
||||||
],
|
|
||||||
'roles' => [
|
|
||||||
Request::METHOD_GET => 'ROLE_USER',
|
|
||||||
Request::METHOD_HEAD => 'ROLE_USER',
|
|
||||||
Request::METHOD_PATCH => 'ROLE_USER',
|
|
||||||
Request::METHOD_PUT => 'ROLE_USER',
|
|
||||||
]
|
|
||||||
],
|
|
||||||
]
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'class' => \Chill\PersonBundle\Entity\SocialWork\Result::class,
|
|
||||||
'controller' => \Chill\PersonBundle\Controller\SocialWorkResultApiController::class,
|
|
||||||
'name' => 'social_work_result',
|
|
||||||
'base_path' => '/api/1.0/person/social-work/result',
|
|
||||||
'base_role' => 'ROLE_USER',
|
|
||||||
'actions' => [
|
|
||||||
'_entity' => [
|
|
||||||
'methods' => [
|
|
||||||
Request::METHOD_GET => true,
|
|
||||||
Request::METHOD_HEAD => true,
|
|
||||||
],
|
|
||||||
'roles' => [
|
|
||||||
Request::METHOD_GET => 'ROLE_USER',
|
|
||||||
Request::METHOD_HEAD => 'ROLE_USER',
|
|
||||||
]
|
|
||||||
],
|
|
||||||
'_index' => [
|
|
||||||
'methods' => [
|
|
||||||
Request::METHOD_GET => true,
|
|
||||||
Request::METHOD_HEAD => true,
|
|
||||||
],
|
|
||||||
'roles' => [
|
|
||||||
Request::METHOD_GET => 'ROLE_USER',
|
|
||||||
Request::METHOD_HEAD => 'ROLE_USER',
|
|
||||||
]
|
|
||||||
],
|
|
||||||
'by-social-action' => [
|
|
||||||
'single-collection' => 'collection',
|
|
||||||
'path' => '/by-social-action/{id}.{_format}',
|
|
||||||
'controller_action' => 'listBySocialAction',
|
|
||||||
'methods' => [
|
|
||||||
Request::METHOD_GET => true,
|
|
||||||
Request::METHOD_HEAD => true,
|
|
||||||
],
|
|
||||||
'roles' => [
|
|
||||||
Request::METHOD_GET => 'ROLE_USER',
|
|
||||||
Request::METHOD_HEAD => 'ROLE_USER',
|
|
||||||
]
|
|
||||||
],
|
|
||||||
'by-goal' => [
|
|
||||||
'single-collection' => 'collection',
|
|
||||||
'path' => '/by-goal/{id}.{_format}',
|
|
||||||
'controller_action' => 'listByGoal',
|
|
||||||
'methods' => [
|
|
||||||
Request::METHOD_GET => true,
|
|
||||||
Request::METHOD_HEAD => true,
|
|
||||||
],
|
|
||||||
'roles' => [
|
|
||||||
Request::METHOD_GET => 'ROLE_USER',
|
|
||||||
Request::METHOD_HEAD => 'ROLE_USER',
|
|
||||||
]
|
|
||||||
],
|
|
||||||
]
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'class' => \Chill\PersonBundle\Entity\SocialWork\Goal::class,
|
|
||||||
'controller' => \Chill\PersonBundle\Controller\SocialWorkGoalApiController::class,
|
|
||||||
'name' => 'social_work_goal',
|
|
||||||
'base_path' => '/api/1.0/person/social-work/goal',
|
|
||||||
'base_role' => 'ROLE_USER',
|
|
||||||
'actions' => [
|
|
||||||
'_entity' => [
|
|
||||||
'methods' => [
|
|
||||||
Request::METHOD_GET => true,
|
|
||||||
Request::METHOD_HEAD => true,
|
|
||||||
],
|
|
||||||
'roles' => [
|
|
||||||
Request::METHOD_GET => 'ROLE_USER',
|
|
||||||
Request::METHOD_HEAD => 'ROLE_USER',
|
|
||||||
]
|
|
||||||
],
|
|
||||||
'_index' => [
|
|
||||||
'methods' => [
|
|
||||||
Request::METHOD_GET => true,
|
|
||||||
Request::METHOD_HEAD => true,
|
|
||||||
],
|
|
||||||
'roles' => [
|
|
||||||
Request::METHOD_GET => 'ROLE_USER',
|
|
||||||
Request::METHOD_HEAD => 'ROLE_USER',
|
|
||||||
]
|
|
||||||
],
|
|
||||||
'by-social-action' => [
|
|
||||||
'single-collection' => 'collection',
|
|
||||||
'path' => '/by-social-action/{id}.{_format}',
|
|
||||||
'controller_action' => 'listBySocialAction',
|
|
||||||
'methods' => [
|
|
||||||
Request::METHOD_GET => true,
|
|
||||||
Request::METHOD_HEAD => true,
|
|
||||||
],
|
|
||||||
'roles' => [
|
|
||||||
Request::METHOD_GET => 'ROLE_USER',
|
|
||||||
Request::METHOD_HEAD => 'ROLE_USER',
|
|
||||||
]
|
|
||||||
],
|
|
||||||
]
|
|
||||||
],
|
|
||||||
]
|
]
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
@@ -848,6 +848,7 @@ class AccompanyingPeriod implements TrackCreationInterface, TrackUpdateInterface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $recursiveSocialIssues;
|
return $recursiveSocialIssues;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -4,7 +4,6 @@ namespace Chill\PersonBundle\Entity\AccompanyingPeriod;
|
|||||||
|
|
||||||
use Chill\PersonBundle\Entity\SocialWork\Result;
|
use Chill\PersonBundle\Entity\SocialWork\Result;
|
||||||
use Chill\PersonBundle\Entity\SocialWork\SocialAction;
|
use Chill\PersonBundle\Entity\SocialWork\SocialAction;
|
||||||
use Chill\PersonBundle\Entity\Person;
|
|
||||||
use Chill\MainBundle\Entity\User;
|
use Chill\MainBundle\Entity\User;
|
||||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||||
use Chill\ThirdPartyBundle\Entity\ThirdParty;
|
use Chill\ThirdPartyBundle\Entity\ThirdParty;
|
||||||
@@ -39,7 +38,7 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Column(type="text")
|
* @ORM\Column(type="text")
|
||||||
* @Serializer\Groups({"read", "accompanying_period_work:edit"})
|
* @Serializer\Groups({"read"})
|
||||||
*/
|
*/
|
||||||
private string $note = "";
|
private string $note = "";
|
||||||
|
|
||||||
@@ -51,8 +50,7 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\ManyToOne(targetEntity=SocialAction::class)
|
* @ORM\ManyToOne(targetEntity=SocialAction::class)
|
||||||
* @Serializer\Groups({"read"})
|
* @Serializer\Groups({"accompanying_period_work:create", "read"})
|
||||||
* @Serializer\Groups({"accompanying_period_work:create"})
|
|
||||||
*/
|
*/
|
||||||
private ?SocialAction $socialAction = null;
|
private ?SocialAction $socialAction = null;
|
||||||
|
|
||||||
@@ -85,16 +83,13 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||||||
/**
|
/**
|
||||||
* @ORM\Column(type="date_immutable")
|
* @ORM\Column(type="date_immutable")
|
||||||
* @Serializer\Groups({"accompanying_period_work:create"})
|
* @Serializer\Groups({"accompanying_period_work:create"})
|
||||||
* @Serializer\Groups({"accompanying_period_work:edit"})
|
|
||||||
* @Serializer\Groups({"read"})
|
* @Serializer\Groups({"read"})
|
||||||
*/
|
*/
|
||||||
private \DateTimeImmutable $startDate;
|
private \DateTimeImmutable $startDate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Column(type="date_immutable", nullable=true, options={"default":null})
|
* @ORM\Column(type="date_immutable", nullable=true, options={"default":null})
|
||||||
* @Serializer\Groups({"accompanying_period_work:create"})
|
* @Serializer\Groups({"accompanying_period_work:create", "read"})
|
||||||
* @Serializer\Groups({"accompanying_period_work:edit"})
|
|
||||||
* @Serializer\Groups({"read"})
|
|
||||||
* @Assert\GreaterThan(propertyPath="startDate",
|
* @Assert\GreaterThan(propertyPath="startDate",
|
||||||
* message="accompanying_course_work.The endDate should be greater than the start date"
|
* message="accompanying_course_work.The endDate should be greater than the start date"
|
||||||
* )
|
* )
|
||||||
@@ -104,7 +99,6 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||||||
/**
|
/**
|
||||||
* @ORM\ManyToOne(targetEntity=ThirdParty::class)
|
* @ORM\ManyToOne(targetEntity=ThirdParty::class)
|
||||||
* @Serializer\Groups({"read"})
|
* @Serializer\Groups({"read"})
|
||||||
* @Serializer\Groups({"accompanying_period_work:edit"})
|
|
||||||
*
|
*
|
||||||
* In schema : traitant
|
* In schema : traitant
|
||||||
*/
|
*/
|
||||||
@@ -121,22 +115,13 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||||||
private string $createdAutomaticallyReason = "";
|
private string $createdAutomaticallyReason = "";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\OneToMany(
|
* @ORM\OneToMany(targetEntity=AccompanyingPeriodWorkGoal::class, mappedBy="accompanyingPeriodWork")
|
||||||
* targetEntity=AccompanyingPeriodWorkGoal::class,
|
|
||||||
* mappedBy="accompanyingPeriodWork",
|
|
||||||
* cascade={"persist"},
|
|
||||||
* orphanRemoval=true
|
|
||||||
* )
|
|
||||||
* @Serializer\Groups({"read"})
|
|
||||||
* @Serializer\Groups({"accompanying_period_work:edit"})
|
|
||||||
*/
|
*/
|
||||||
private Collection $goals;
|
private Collection $goals;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\ManyToMany(targetEntity=Result::class, inversedBy="accompanyingPeriodWorks")
|
* @ORM\ManyToMany(targetEntity=Result::class, inversedBy="accompanyingPeriodWorks")
|
||||||
* @ORM\JoinTable(name="chill_person_accompanying_period_work_result")
|
* @ORM\JoinTable(name="chill_person_accompanying_period_work_result")
|
||||||
* @Serializer\Groups({"read"})
|
|
||||||
* @Serializer\Groups({"accompanying_period_work:edit"})
|
|
||||||
*/
|
*/
|
||||||
private Collection $results;
|
private Collection $results;
|
||||||
|
|
||||||
@@ -145,27 +130,14 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||||||
* @ORM\JoinTable(name="chill_person_accompanying_period_work_third_party")
|
* @ORM\JoinTable(name="chill_person_accompanying_period_work_third_party")
|
||||||
*
|
*
|
||||||
* In schema : intervenants
|
* In schema : intervenants
|
||||||
* @Serializer\Groups({"read"})
|
|
||||||
* @Serializer\Groups({"accompanying_period_work:edit"})
|
|
||||||
*/
|
*/
|
||||||
private Collection $thirdParties;
|
private Collection $thirdParties;
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @ORM\ManyToMany(targetEntity=Person::class)
|
|
||||||
* @ORM\JoinTable(name="chill_person_accompanying_period_work_person")
|
|
||||||
* @Serializer\Groups({"read"})
|
|
||||||
* @Serializer\Groups({"accompanying_period_work:edit"})
|
|
||||||
* @Serializer\Groups({"accompanying_period_work:create"})
|
|
||||||
*/
|
|
||||||
private Collection $persons;
|
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->goals = new ArrayCollection();
|
$this->goals = new ArrayCollection();
|
||||||
$this->results = new ArrayCollection();
|
$this->results = new ArrayCollection();
|
||||||
$this->thirdParties = new ArrayCollection();
|
$this->thirdParties = new ArrayCollection();
|
||||||
$this->persons = new ArrayCollection();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getId(): ?int
|
public function getId(): ?int
|
||||||
@@ -283,7 +255,7 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||||||
return $this->endDate;
|
return $this->endDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setEndDate(?\DateTimeInterface $endDate = null): self
|
public function setEndDate(\DateTimeInterface $endDate): self
|
||||||
{
|
{
|
||||||
$this->endDate = $endDate;
|
$this->endDate = $endDate;
|
||||||
|
|
||||||
@@ -338,7 +310,7 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||||||
{
|
{
|
||||||
if (!$this->goals->contains($goal)) {
|
if (!$this->goals->contains($goal)) {
|
||||||
$this->goals[] = $goal;
|
$this->goals[] = $goal;
|
||||||
$goal->setAccompanyingPeriodWork($this);
|
$goal->setAccompanyingPeriodWork2($this);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
@@ -346,10 +318,10 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||||||
|
|
||||||
public function removeGoal(AccompanyingPeriodWorkGoal $goal): self
|
public function removeGoal(AccompanyingPeriodWorkGoal $goal): self
|
||||||
{
|
{
|
||||||
if ($this->goals->removeElement($goal)) {
|
if ($this->goals->removeElement($goal)) {
|
||||||
// set the owning side to null (unless already changed)
|
// set the owning side to null (unless already changed)
|
||||||
if ($goal->getAccompanyingPeriodWork() === $this) {
|
if ($goal->getAccompanyingPeriodWork2() === $this) {
|
||||||
$goal->setAccompanyingPeriodWork(null);
|
$goal->setAccompanyingPeriodWork2(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -403,25 +375,4 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPersons(): Collection
|
|
||||||
{
|
|
||||||
return $this->persons;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function addPerson(Person $person): self
|
|
||||||
{
|
|
||||||
if (!$this->persons->contains($person)) {
|
|
||||||
$this->persons[] = $person;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function removePerson(Person $person): self
|
|
||||||
{
|
|
||||||
$this->persons->removeElement($person);
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -7,17 +7,10 @@ use Chill\PersonBundle\Entity\SocialWork\Result;
|
|||||||
use Doctrine\Common\Collections\ArrayCollection;
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
use Doctrine\Common\Collections\Collection;
|
use Doctrine\Common\Collections\Collection;
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
use Symfony\Component\Serializer\Annotation as Serializer;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Entity
|
* @ORM\Entity
|
||||||
* @ORM\Table(name="chill_person_accompanying_period_work_goal")
|
* @ORM\Table(name="chill_person_accompanying_period_work_goal")
|
||||||
* @Serializer\DiscriminatorMap(
|
|
||||||
* typeProperty="type",
|
|
||||||
* mapping={
|
|
||||||
* "accompanying_period_work_goal":AccompanyingPeriodWorkGoal::class
|
|
||||||
* }
|
|
||||||
* )
|
|
||||||
*/
|
*/
|
||||||
class AccompanyingPeriodWorkGoal
|
class AccompanyingPeriodWorkGoal
|
||||||
{
|
{
|
||||||
@@ -25,14 +18,11 @@ class AccompanyingPeriodWorkGoal
|
|||||||
* @ORM\Id
|
* @ORM\Id
|
||||||
* @ORM\GeneratedValue
|
* @ORM\GeneratedValue
|
||||||
* @ORM\Column(type="integer")
|
* @ORM\Column(type="integer")
|
||||||
* @Serializer\Groups({"read"})
|
|
||||||
*/
|
*/
|
||||||
private $id;
|
private $id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Column(type="text")
|
* @ORM\Column(type="text")
|
||||||
* @Serializer\Groups({"accompanying_period_work:edit"})
|
|
||||||
* @Serializer\Groups({"read"})
|
|
||||||
*/
|
*/
|
||||||
private $note;
|
private $note;
|
||||||
|
|
||||||
@@ -43,16 +33,12 @@ class AccompanyingPeriodWorkGoal
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\ManyToOne(targetEntity=Goal::class)
|
* @ORM\ManyToOne(targetEntity=Goal::class)
|
||||||
* @Serializer\Groups({"accompanying_period_work:edit"})
|
|
||||||
* @Serializer\Groups({"read"})
|
|
||||||
*/
|
*/
|
||||||
private $goal;
|
private $goal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\ManyToMany(targetEntity=Result::class, inversedBy="accompanyingPeriodWorkGoals")
|
* @ORM\ManyToMany(targetEntity=Result::class, inversedBy="accompanyingPeriodWorkGoals")
|
||||||
* @ORM\JoinTable(name="chill_person_accompanying_period_work_goal_result")
|
* @ORM\JoinTable(name="chill_person_accompanying_period_work_goal_result")
|
||||||
* @Serializer\Groups({"accompanying_period_work:edit"})
|
|
||||||
* @Serializer\Groups({"read"})
|
|
||||||
*/
|
*/
|
||||||
private $results;
|
private $results;
|
||||||
|
|
||||||
@@ -85,13 +71,6 @@ class AccompanyingPeriodWorkGoal
|
|||||||
|
|
||||||
public function setAccompanyingPeriodWork(?AccompanyingPeriodWork $accompanyingPeriodWork): self
|
public function setAccompanyingPeriodWork(?AccompanyingPeriodWork $accompanyingPeriodWork): self
|
||||||
{
|
{
|
||||||
if ($this->accompanyingPeriodWork instanceof AccompanyingPeriodWork
|
|
||||||
&& $accompanyingPeriodWork !== $this->accompanyingPeriodWork
|
|
||||||
&& $accompanyingPeriodWork !== null
|
|
||||||
) {
|
|
||||||
throw new \LogicException("Change accompanying period work is not allowed");
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->accompanyingPeriodWork = $accompanyingPeriodWork;
|
$this->accompanyingPeriodWork = $accompanyingPeriodWork;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
|
@@ -51,7 +51,7 @@ class Household
|
|||||||
* targetEntity=HouseholdMember::class,
|
* targetEntity=HouseholdMember::class,
|
||||||
* mappedBy="household"
|
* mappedBy="household"
|
||||||
* )
|
* )
|
||||||
* @Serializer\Groups({"read"})
|
* @Serializer\Groups({"write", "read"})
|
||||||
*/
|
*/
|
||||||
private Collection $members;
|
private Collection $members;
|
||||||
|
|
||||||
|
@@ -1426,122 +1426,4 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getGenderComment(): CommentEmbeddable
|
|
||||||
{
|
|
||||||
return $this->genderComment;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setGenderComment(CommentEmbeddable $genderComment): self
|
|
||||||
{
|
|
||||||
$this->genderComment = $genderComment;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getMaritalStatusComment(): CommentEmbeddable
|
|
||||||
{
|
|
||||||
return $this->maritalStatusComment;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setMaritalStatusComment(CommentEmbeddable $maritalStatusComment): self
|
|
||||||
{
|
|
||||||
$this->maritalStatusComment = $maritalStatusComment;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getDeathdate(): ?\DateTimeInterface
|
|
||||||
{
|
|
||||||
return $this->deathdate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setDeathdate(?\DateTimeInterface $deathdate): self
|
|
||||||
{
|
|
||||||
$this->deathdate = $deathdate;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getMaritalStatusDate(): ?\DateTimeInterface
|
|
||||||
{
|
|
||||||
return $this->maritalStatusDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setMaritalStatusDate(?\DateTimeInterface $maritalStatusDate): self
|
|
||||||
{
|
|
||||||
$this->maritalStatusDate = $maritalStatusDate;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getAcceptSMS(): ?bool
|
|
||||||
{
|
|
||||||
return $this->acceptSMS;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setAcceptSMS(bool $acceptSMS): self
|
|
||||||
{
|
|
||||||
$this->acceptSMS = $acceptSMS;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getAcceptEmail(): ?bool
|
|
||||||
{
|
|
||||||
return $this->acceptEmail;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setAcceptEmail(bool $acceptEmail): self
|
|
||||||
{
|
|
||||||
$this->acceptEmail = $acceptEmail;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getNumberOfChildren(): ?int
|
|
||||||
{
|
|
||||||
return $this->numberOfChildren;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setNumberOfChildren(int $numberOfChildren): self
|
|
||||||
{
|
|
||||||
$this->numberOfChildren = $numberOfChildren;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getCreatedBy(): ?User
|
|
||||||
{
|
|
||||||
return $this->createdBy;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setCreatedBy(User $createdBy): self
|
|
||||||
{
|
|
||||||
$this->createdBy = $createdBy;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setCreatedAt(\DateTimeInterface $datetime): self
|
|
||||||
{
|
|
||||||
$this->createdAt = $datetime;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setUpdatedBy(User $user): self
|
|
||||||
{
|
|
||||||
$this->updatedBy = $user;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setUpdatedAt(\DateTimeInterface $datetime): self
|
|
||||||
{
|
|
||||||
$this->updatedAt = $datetime;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -5,17 +5,10 @@ namespace Chill\PersonBundle\Entity\SocialWork;
|
|||||||
use Doctrine\Common\Collections\ArrayCollection;
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
use Doctrine\Common\Collections\Collection;
|
use Doctrine\Common\Collections\Collection;
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
use Symfony\Component\Serializer\Annotation as Serializer;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Entity
|
* @ORM\Entity
|
||||||
* @ORM\Table(name="chill_person_social_work_goal")
|
* @ORM\Table(name="chill_person_social_work_goal")
|
||||||
* @Serializer\DiscriminatorMap(
|
|
||||||
* typeProperty="type",
|
|
||||||
* mapping={
|
|
||||||
* "social_work_goal":Goal::class
|
|
||||||
* }
|
|
||||||
* )
|
|
||||||
*/
|
*/
|
||||||
class Goal
|
class Goal
|
||||||
{
|
{
|
||||||
@@ -23,13 +16,11 @@ class Goal
|
|||||||
* @ORM\Id
|
* @ORM\Id
|
||||||
* @ORM\GeneratedValue
|
* @ORM\GeneratedValue
|
||||||
* @ORM\Column(type="integer")
|
* @ORM\Column(type="integer")
|
||||||
* @Serializer\Groups({"read"})
|
|
||||||
*/
|
*/
|
||||||
private $id;
|
private $id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Column(type="json")
|
* @ORM\Column(type="json")
|
||||||
* @Serializer\Groups({"read"})
|
|
||||||
*/
|
*/
|
||||||
private $title = [];
|
private $title = [];
|
||||||
|
|
||||||
@@ -55,11 +46,6 @@ class Goal
|
|||||||
$this->results = new ArrayCollection();
|
$this->results = new ArrayCollection();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getId(): ?int
|
|
||||||
{
|
|
||||||
return $this->id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getTitle(): array
|
public function getTitle(): array
|
||||||
{
|
{
|
||||||
return $this->title;
|
return $this->title;
|
||||||
|
@@ -7,17 +7,10 @@ use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWorkGoal;
|
|||||||
use Doctrine\Common\Collections\ArrayCollection;
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
use Doctrine\Common\Collections\Collection;
|
use Doctrine\Common\Collections\Collection;
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
use Symfony\Component\Serializer\Annotation as Serializer;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Entity
|
* @ORM\Entity
|
||||||
* @ORM\Table(name="chill_person_social_work_result")
|
* @ORM\Table(name="chill_person_social_work_result")
|
||||||
* @Serializer\DiscriminatorMap(
|
|
||||||
* typeProperty="type",
|
|
||||||
* mapping={
|
|
||||||
* "social_work_result":Result::class
|
|
||||||
* }
|
|
||||||
* )
|
|
||||||
*/
|
*/
|
||||||
class Result
|
class Result
|
||||||
{
|
{
|
||||||
@@ -25,13 +18,11 @@ class Result
|
|||||||
* @ORM\Id
|
* @ORM\Id
|
||||||
* @ORM\GeneratedValue
|
* @ORM\GeneratedValue
|
||||||
* @ORM\Column(type="integer")
|
* @ORM\Column(type="integer")
|
||||||
* @Serializer\Groups({"read"})
|
|
||||||
*/
|
*/
|
||||||
private $id;
|
private $id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Column(type="json")
|
* @ORM\Column(type="json")
|
||||||
* @Serializer\Groups({"read"})
|
|
||||||
*/
|
*/
|
||||||
private $title = [];
|
private $title = [];
|
||||||
|
|
||||||
|
@@ -60,13 +60,6 @@ class AccompanyingCourseMenuBuilder implements LocalMenuBuilderInterface
|
|||||||
'accompanying_period_id' => $period->getId()
|
'accompanying_period_id' => $period->getId()
|
||||||
]])
|
]])
|
||||||
->setExtras(['order' => 30]);
|
->setExtras(['order' => 30]);
|
||||||
|
|
||||||
$menu->addChild($this->translator->trans('Accompanying Course Actions'), [
|
|
||||||
'route' => 'chill_person_accompanying_period_work_list',
|
|
||||||
'routeParameters' => [
|
|
||||||
'id' => $period->getId()
|
|
||||||
]])
|
|
||||||
->setExtras(['order' => 40]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -36,13 +36,6 @@ class HouseholdMenuBuilder implements LocalMenuBuilderInterface
|
|||||||
]])
|
]])
|
||||||
->setExtras(['order' => 10]);
|
->setExtras(['order' => 10]);
|
||||||
|
|
||||||
$menu->addChild($this->translator->trans('household.Accompanying period'), [
|
|
||||||
'route' => 'chill_person_household_accompanying_period',
|
|
||||||
'routeParameters' => [
|
|
||||||
'household_id' => $household->getId()
|
|
||||||
]])
|
|
||||||
->setExtras(['order' => 20]);
|
|
||||||
|
|
||||||
$menu->addChild($this->translator->trans('household.Addresses'), [
|
$menu->addChild($this->translator->trans('household.Addresses'), [
|
||||||
'route' => 'chill_person_household_addresses',
|
'route' => 'chill_person_household_addresses',
|
||||||
'routeParameters' => [
|
'routeParameters' => [
|
||||||
|
@@ -3,12 +3,16 @@
|
|||||||
namespace Chill\PersonBundle\Repository\AccompanyingPeriod;
|
namespace Chill\PersonBundle\Repository\AccompanyingPeriod;
|
||||||
|
|
||||||
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork;
|
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork;
|
||||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Doctrine\ORM\EntityRepository;
|
use Doctrine\ORM\EntityRepository;
|
||||||
use Doctrine\Persistence\ObjectRepository;
|
|
||||||
|
|
||||||
final class AccompanyingPeriodWorkRepository implements ObjectRepository
|
/**
|
||||||
|
* @method AccompanyingPeriodWork|null find($id, $lockMode = null, $lockVersion = null)
|
||||||
|
* @method AccompanyingPeriodWork|null findOneBy(array $criteria, array $orderBy = null)
|
||||||
|
* @method AccompanyingPeriodWork[] findAll()
|
||||||
|
* @method AccompanyingPeriodWork[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
|
||||||
|
*/
|
||||||
|
final class AccompanyingPeriodWorkRepository
|
||||||
{
|
{
|
||||||
private EntityRepository $repository;
|
private EntityRepository $repository;
|
||||||
|
|
||||||
@@ -16,88 +20,4 @@ final class AccompanyingPeriodWorkRepository implements ObjectRepository
|
|||||||
{
|
{
|
||||||
$this->repository = $entityManager->getRepository(AccompanyingPeriodWork::class);
|
$this->repository = $entityManager->getRepository(AccompanyingPeriodWork::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function find($id): ?AccompanyingPeriodWork
|
|
||||||
{
|
|
||||||
return $this->repository->find($id);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function findAll(): array
|
|
||||||
{
|
|
||||||
return $this->repository->findAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array
|
|
||||||
{
|
|
||||||
return $this->repository->findBy($criteria, $orderBy, $limit, $offset);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function findOneBy(array $criteria): ?AccompanyingPeriodWork
|
|
||||||
{
|
|
||||||
return $this->findOneBy($criteria);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getClassName()
|
|
||||||
{
|
|
||||||
return AccompanyingPeriodWork::class;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @return AccompanyingPeriodWork[]
|
|
||||||
*/
|
|
||||||
public function findByAccompanyingPeriod(AccompanyingPeriod $period, $orderBy = null, $limit = null, $offset = null): array
|
|
||||||
{
|
|
||||||
return $this->repository->findByAccompanyingPeriod($period, $orderBy, $limit, $offset);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function countByAccompanyingPeriod(AccompanyingPeriod $period): int
|
|
||||||
{
|
|
||||||
return $this->repository->countByAccompanyingPeriod($period);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function toDelete()
|
|
||||||
{
|
|
||||||
$qb = $this->buildQueryBySocialActionWithDescendants($action);
|
|
||||||
$qb->select('g');
|
|
||||||
|
|
||||||
foreach ($orderBy as $sort => $order) {
|
|
||||||
$qb->addOrderBy('g.'.$sort, $order);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $qb
|
|
||||||
->setMaxResults($limit)
|
|
||||||
->setFirstResult($offset)
|
|
||||||
->getQuery()
|
|
||||||
->getResult()
|
|
||||||
;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function countBySocialActionWithDescendants(SocialAction $action): int
|
|
||||||
{
|
|
||||||
$qb = $this->buildQueryBySocialActionWithDescendants($action);
|
|
||||||
$qb->select('COUNT(g)');
|
|
||||||
|
|
||||||
return $qb
|
|
||||||
->getQuery()
|
|
||||||
->getSingleScalarResult()
|
|
||||||
;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function buildQueryBySocialActionWithDescendants(SocialAction $action): QueryBuilder
|
|
||||||
{
|
|
||||||
$actions = $action->getDescendantsWithThis();
|
|
||||||
|
|
||||||
$qb = $this->repository->createQueryBuilder('g');
|
|
||||||
|
|
||||||
$orx = $qb->expr()->orX();
|
|
||||||
$i = 0;
|
|
||||||
foreach ($actions as $action) {
|
|
||||||
$orx->add(":action_{$i} MEMBER OF g.socialActions");
|
|
||||||
$qb->setParameter("action_{$i}", $action);
|
|
||||||
}
|
|
||||||
$qb->where($orx);
|
|
||||||
|
|
||||||
return $qb;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -25,9 +25,8 @@ namespace Chill\PersonBundle\Repository;
|
|||||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Doctrine\ORM\EntityRepository;
|
use Doctrine\ORM\EntityRepository;
|
||||||
use Doctrine\Persistence\ObjectRepository;
|
|
||||||
|
|
||||||
final class AccompanyingPeriodRepository implements ObjectRepository
|
final class AccompanyingPeriodRepository
|
||||||
{
|
{
|
||||||
private EntityRepository $repository;
|
private EntityRepository $repository;
|
||||||
|
|
||||||
@@ -35,32 +34,4 @@ final class AccompanyingPeriodRepository implements ObjectRepository
|
|||||||
{
|
{
|
||||||
$this->repository = $entityManager->getRepository(AccompanyingPeriod::class);
|
$this->repository = $entityManager->getRepository(AccompanyingPeriod::class);
|
||||||
}
|
}
|
||||||
public function find($id): ?AccompanyingPeriod
|
|
||||||
{
|
|
||||||
return $this->repository->find($id);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return AccompanyingPeriod[]
|
|
||||||
*/
|
|
||||||
public function findAll(): array
|
|
||||||
{
|
|
||||||
return $this->repository->findAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): ?AccompanyingPeriod
|
|
||||||
{
|
|
||||||
return $this->repository->findBy($criteria, $orderBy, $limit, $offset);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function findOneBy(array $criteria): ?AccompanyingPeriod
|
|
||||||
{
|
|
||||||
return $this->findOneBy($criteria);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getClassName()
|
|
||||||
{
|
|
||||||
return AccompanyingPeriod::class;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -3,102 +3,15 @@
|
|||||||
namespace Chill\PersonBundle\Repository\Household;
|
namespace Chill\PersonBundle\Repository\Household;
|
||||||
|
|
||||||
use Chill\PersonBundle\Entity\Household\Household;
|
use Chill\PersonBundle\Entity\Household\Household;
|
||||||
use Chill\PersonBundle\Entity\Person;
|
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Doctrine\ORM\EntityRepository;
|
use Doctrine\ORM\EntityRepository;
|
||||||
use Doctrine\ORM\Query\ResultSetMappingBuilder;
|
|
||||||
use Doctrine\Persistence\ObjectRepository;
|
|
||||||
|
|
||||||
final class HouseholdRepository implements ObjectRepository
|
final class HouseholdRepository
|
||||||
{
|
{
|
||||||
private EntityRepository $repository;
|
private EntityRepository $repository;
|
||||||
private EntityManagerInterface $em;
|
|
||||||
|
|
||||||
public function __construct(EntityManagerInterface $entityManager)
|
public function __construct(EntityManagerInterface $entityManager)
|
||||||
{
|
{
|
||||||
$this->repository = $entityManager->getRepository(Household::class);
|
$this->repository = $entityManager->getRepository(Household::class);
|
||||||
$this->em = $entityManager;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function find($id)
|
|
||||||
{
|
|
||||||
return $this->repository->find($id);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function findAll()
|
|
||||||
{
|
|
||||||
return $this->repository->findAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null)
|
|
||||||
{
|
|
||||||
return $this->repository->findBy($criteria, $orderBy, $limit, $offset);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function findOneBy(array $criteria)
|
|
||||||
{
|
|
||||||
return $this->findOneBy($criteria);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getClassName()
|
|
||||||
{
|
|
||||||
return Household::class;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function countByAccompanyingPeriodParticipation(Person $person)
|
|
||||||
{
|
|
||||||
return $this->buildQueryByAccompanyingPeriodParticipation($person, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function findByAccompanyingPeriodParticipation(Person $person, int $limit, int $offset)
|
|
||||||
{
|
|
||||||
return $this->buildQueryByAccompanyingPeriodParticipation($person, false, $limit, $offset);
|
|
||||||
}
|
|
||||||
|
|
||||||
private function buildQueryByAccompanyingPeriodParticipation(Person $person, bool $isCount = false, int $limit = 50, int $offset = 0)
|
|
||||||
{
|
|
||||||
$rsm = new ResultSetMappingBuilder($this->em);
|
|
||||||
$rsm->addRootEntityFromClassMetadata(Household::class, 'h');
|
|
||||||
|
|
||||||
if ($isCount) {
|
|
||||||
$rsm->addScalarResult('count', 'count');
|
|
||||||
$sql = \strtr(self::SQL_BY_ACCOMPANYING_PERIOD_PARTICIPATION, [
|
|
||||||
'{select}' => 'COUNT(households.*) AS count',
|
|
||||||
'{limits}' => ''
|
|
||||||
]);
|
|
||||||
} else {
|
|
||||||
$sql = \strtr(self::SQL_BY_ACCOMPANYING_PERIOD_PARTICIPATION, [
|
|
||||||
'{select}' => $rsm->generateSelectClause(['h' => 'households']),
|
|
||||||
'{limits}' => "OFFSET {$offset} LIMIT {$limit}"
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
$native = $this->em->createNativeQuery($sql, $rsm);
|
|
||||||
$native->setParameters([0 => $person->getId(), 1 => $person->getId()]);
|
|
||||||
|
|
||||||
if ($isCount) {
|
|
||||||
return $native->getSingleScalarResult();
|
|
||||||
} else {
|
|
||||||
return $native->getResult();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private CONST SQL_BY_ACCOMPANYING_PERIOD_PARTICIPATION = <<<SQL
|
|
||||||
WITH participations AS (
|
|
||||||
SELECT DISTINCT part.accompanyingperiod_id
|
|
||||||
FROM chill_person_accompanying_period_participation AS part
|
|
||||||
WHERE person_id = ?),
|
|
||||||
other_participants AS (
|
|
||||||
SELECT person_id, startDate, endDate
|
|
||||||
FROM chill_person_accompanying_period_participation
|
|
||||||
JOIN participations USING (accompanyingperiod_id)
|
|
||||||
WHERE person_id != ?
|
|
||||||
),
|
|
||||||
households AS (SELECT DISTINCT household.*
|
|
||||||
FROM chill_person_household_members AS hmembers
|
|
||||||
JOIN other_participants AS op USING (person_id)
|
|
||||||
JOIN chill_person_household AS household ON hmembers.household_id = household.id
|
|
||||||
WHERE daterange(op.startDate, op.endDate) && daterange(hmembers.startDate, hmembers.endDate)
|
|
||||||
)
|
|
||||||
SELECT {select} FROM households {limits}
|
|
||||||
SQL;
|
|
||||||
}
|
}
|
||||||
|
@@ -37,11 +37,6 @@ final class PersonRepository
|
|||||||
return $this->repository->find($id, $lockMode, $lockVersion);
|
return $this->repository->find($id, $lockMode, $lockVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function findByIds($ids): array
|
|
||||||
{
|
|
||||||
return $this->repository->findBy(['id' => $ids]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $centers
|
* @param $centers
|
||||||
* @param $firstResult
|
* @param $firstResult
|
||||||
|
@@ -3,13 +3,10 @@
|
|||||||
namespace Chill\PersonBundle\Repository\SocialWork;
|
namespace Chill\PersonBundle\Repository\SocialWork;
|
||||||
|
|
||||||
use Chill\PersonBundle\Entity\SocialWork\Goal;
|
use Chill\PersonBundle\Entity\SocialWork\Goal;
|
||||||
use Chill\PersonBundle\Entity\SocialWork\SocialAction;
|
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Doctrine\ORM\EntityRepository;
|
use Doctrine\ORM\EntityRepository;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
|
||||||
use Doctrine\Persistence\ObjectRepository;
|
|
||||||
|
|
||||||
final class GoalRepository implements ObjectRepository
|
final class GoalRepository
|
||||||
{
|
{
|
||||||
private EntityRepository $repository;
|
private EntityRepository $repository;
|
||||||
|
|
||||||
@@ -17,78 +14,4 @@ final class GoalRepository implements ObjectRepository
|
|||||||
{
|
{
|
||||||
$this->repository = $entityManager->getRepository(Goal::class);
|
$this->repository = $entityManager->getRepository(Goal::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function find($id)
|
|
||||||
{
|
|
||||||
return $this->repository->find($id);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function findAll()
|
|
||||||
{
|
|
||||||
return $this->repository->findAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null)
|
|
||||||
{
|
|
||||||
return $this->repository->findBy($criteria, $orderBy, $limit, $offset);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function findOneBy(array $criteria)
|
|
||||||
{
|
|
||||||
return $this->findOneBy($criteria);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getClassName()
|
|
||||||
{
|
|
||||||
return Goal::class;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @return Goal[]
|
|
||||||
*/
|
|
||||||
public function findBySocialActionWithDescendants(SocialAction $action, $orderBy = null, $limit = null, $offset = null): array
|
|
||||||
{
|
|
||||||
$qb = $this->buildQueryBySocialActionWithDescendants($action);
|
|
||||||
$qb->select('g');
|
|
||||||
|
|
||||||
foreach ($orderBy as $sort => $order) {
|
|
||||||
$qb->addOrderBy('g.'.$sort, $order);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $qb
|
|
||||||
->setMaxResults($limit)
|
|
||||||
->setFirstResult($offset)
|
|
||||||
->getQuery()
|
|
||||||
->getResult()
|
|
||||||
;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function countBySocialActionWithDescendants(SocialAction $action): int
|
|
||||||
{
|
|
||||||
$qb = $this->buildQueryBySocialActionWithDescendants($action);
|
|
||||||
$qb->select('COUNT(g)');
|
|
||||||
|
|
||||||
return $qb
|
|
||||||
->getQuery()
|
|
||||||
->getSingleScalarResult()
|
|
||||||
;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function buildQueryBySocialActionWithDescendants(SocialAction $action): QueryBuilder
|
|
||||||
{
|
|
||||||
$actions = $action->getDescendantsWithThis();
|
|
||||||
|
|
||||||
$qb = $this->repository->createQueryBuilder('g');
|
|
||||||
|
|
||||||
$orx = $qb->expr()->orX();
|
|
||||||
$i = 0;
|
|
||||||
foreach ($actions as $action) {
|
|
||||||
$orx->add(":action_{$i} MEMBER OF g.socialActions");
|
|
||||||
$qb->setParameter("action_{$i}", $action);
|
|
||||||
}
|
|
||||||
$qb->where($orx);
|
|
||||||
|
|
||||||
return $qb;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -3,14 +3,10 @@
|
|||||||
namespace Chill\PersonBundle\Repository\SocialWork;
|
namespace Chill\PersonBundle\Repository\SocialWork;
|
||||||
|
|
||||||
use Chill\PersonBundle\Entity\SocialWork\Result;
|
use Chill\PersonBundle\Entity\SocialWork\Result;
|
||||||
use Chill\PersonBundle\Entity\SocialWork\SocialAction;
|
|
||||||
use Chill\PersonBundle\Entity\SocialWork\Goal;
|
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Doctrine\ORM\EntityRepository;
|
use Doctrine\ORM\EntityRepository;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
|
||||||
use Doctrine\Persistence\ObjectRepository;
|
|
||||||
|
|
||||||
final class ResultRepository implements ObjectRepository
|
final class ResultRepository
|
||||||
{
|
{
|
||||||
private EntityRepository $repository;
|
private EntityRepository $repository;
|
||||||
|
|
||||||
@@ -18,120 +14,4 @@ final class ResultRepository implements ObjectRepository
|
|||||||
{
|
{
|
||||||
$this->repository = $entityManager->getRepository(Result::class);
|
$this->repository = $entityManager->getRepository(Result::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function find($id)
|
|
||||||
{
|
|
||||||
return $this->repository->find($id);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function findAll()
|
|
||||||
{
|
|
||||||
return $this->repository->findAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null)
|
|
||||||
{
|
|
||||||
return $this->repository->findBy($criteria, $orderBy, $limit, $offset);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function findOneBy(array $criteria)
|
|
||||||
{
|
|
||||||
return $this->findOneBy($criteria);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getClassName()
|
|
||||||
{
|
|
||||||
return Result::class;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @return Result[]
|
|
||||||
*/
|
|
||||||
public function findBySocialActionWithDescendants(SocialAction $action, $orderBy = null, $limit = null, $offset = null): array
|
|
||||||
{
|
|
||||||
$qb = $this->buildQueryBySocialActionWithDescendants($action);
|
|
||||||
$qb->select('r');
|
|
||||||
|
|
||||||
foreach ($orderBy as $sort => $order) {
|
|
||||||
$qb->addOrderBy('r.'.$sort, $order);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $qb
|
|
||||||
->setMaxResults($limit)
|
|
||||||
->setFirstResult($offset)
|
|
||||||
->getQuery()
|
|
||||||
->getResult()
|
|
||||||
;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function countBySocialActionWithDescendants(SocialAction $action): int
|
|
||||||
{
|
|
||||||
$qb = $this->buildQueryBySocialActionWithDescendants($action);
|
|
||||||
$qb->select('COUNT(r)');
|
|
||||||
|
|
||||||
return $qb
|
|
||||||
->getQuery()
|
|
||||||
->getSingleScalarResult()
|
|
||||||
;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function buildQueryBySocialActionWithDescendants(SocialAction $action): QueryBuilder
|
|
||||||
{
|
|
||||||
$actions = $action->getDescendantsWithThis();
|
|
||||||
|
|
||||||
$qb = $this->repository->createQueryBuilder('r');
|
|
||||||
|
|
||||||
$orx = $qb->expr()->orX();
|
|
||||||
$i = 0;
|
|
||||||
foreach ($actions as $action) {
|
|
||||||
$orx->add(":action_{$i} MEMBER OF r.socialActions");
|
|
||||||
$qb->setParameter("action_{$i}", $action);
|
|
||||||
}
|
|
||||||
$qb->where($orx);
|
|
||||||
|
|
||||||
return $qb;
|
|
||||||
}
|
|
||||||
protected function buildQueryByGoal(Goal $goal): QueryBuilder
|
|
||||||
{
|
|
||||||
$qb = $this->repository->createQueryBuilder('r');
|
|
||||||
|
|
||||||
$qb->where(":goal MEMBER OF r.goals")
|
|
||||||
->setParameter('goal', $goal)
|
|
||||||
;
|
|
||||||
|
|
||||||
return $qb;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return Result[]
|
|
||||||
*/
|
|
||||||
public function findByGoal(Goal $goal, $orderBy = null, $limit = null, $offset = null): array
|
|
||||||
{
|
|
||||||
$qb = $this->buildQueryByGoal($goal);
|
|
||||||
|
|
||||||
foreach ($orderBy as $sort => $order) {
|
|
||||||
$qb->addOrderBy('r.'.$sort, $order);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $qb
|
|
||||||
->select('r')
|
|
||||||
->setMaxResults($limit)
|
|
||||||
->setFirstResult($offset)
|
|
||||||
->getQuery()
|
|
||||||
->getResult()
|
|
||||||
;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function countByGoal(Goal $goal): int
|
|
||||||
{
|
|
||||||
$qb = $this->buildQueryByGoal($goal);
|
|
||||||
$qb->select('COUNT(r)');
|
|
||||||
|
|
||||||
return $qb
|
|
||||||
->getQuery()
|
|
||||||
->getSingleScalarResult()
|
|
||||||
;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,4 +1,3 @@
|
|||||||
require('./sass/chillperson.scss');
|
require('./sass/person.scss');
|
||||||
require('./sass/person_with_period.scss');
|
require('./sass/person_with_period.scss');
|
||||||
require('./sass/household_banner.scss');
|
require('./sass/household_banner.scss');
|
||||||
require('./sass/accompanying_period_work.scss');
|
|
||||||
|
@@ -1 +0,0 @@
|
|||||||
require('./index.scss');
|
|
@@ -1,106 +0,0 @@
|
|||||||
|
|
||||||
#accompanying_course_work_list {
|
|
||||||
|
|
||||||
.item {
|
|
||||||
margin-bottom: 1.5rem;
|
|
||||||
padding: 1rem;
|
|
||||||
border: 1px solid gray;
|
|
||||||
|
|
||||||
.title_label {
|
|
||||||
display: block;
|
|
||||||
margin: 0;
|
|
||||||
|
|
||||||
font-variant-caps: small-caps;
|
|
||||||
|
|
||||||
+ * {
|
|
||||||
margin-top: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.objective_results {
|
|
||||||
display: grid;
|
|
||||||
grid-template-areas:
|
|
||||||
"obj res"
|
|
||||||
;
|
|
||||||
grid-template-columns: 50%;
|
|
||||||
column-gap: 1rem;
|
|
||||||
|
|
||||||
padding: 0.3rem;
|
|
||||||
|
|
||||||
.obj {
|
|
||||||
grid-area: obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
.res {
|
|
||||||
grid-area: res;
|
|
||||||
|
|
||||||
ul.result_list {
|
|
||||||
list-style-type: none;
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.objective_results:nth-child(2n+2) {
|
|
||||||
background-color: var(--chill-llight-gray);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&.short {
|
|
||||||
.item {
|
|
||||||
padding-bottom: 0;
|
|
||||||
ul.record_actions {
|
|
||||||
margin-bottom: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.updatedBy {
|
|
||||||
margin-top: 1rem;
|
|
||||||
text-align: right;
|
|
||||||
font-size: 0.8rem;
|
|
||||||
font-style: italic;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ul.timeline {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
padding: 0;
|
|
||||||
list-style-type: none;
|
|
||||||
|
|
||||||
> li {
|
|
||||||
min-width: 210px;
|
|
||||||
|
|
||||||
div.date {
|
|
||||||
margin-bottom: 20px;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
div.label {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: center;
|
|
||||||
|
|
||||||
padding: 0 40px;
|
|
||||||
border-top: 2px solid var(--chill-green);
|
|
||||||
|
|
||||||
&:before {
|
|
||||||
content: '';
|
|
||||||
display: inline-block;
|
|
||||||
position: relative;
|
|
||||||
width: 25px;
|
|
||||||
height: 25px;
|
|
||||||
|
|
||||||
background-color: white;
|
|
||||||
border-radius: 25px;
|
|
||||||
border: 1px solid #ddd;
|
|
||||||
|
|
||||||
top: -15px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@@ -1,6 +0,0 @@
|
|||||||
|
|
||||||
.chill-entity__social-action {
|
|
||||||
.badge-primary {
|
|
||||||
background-color: var(--chill-green);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,214 +0,0 @@
|
|||||||
@import '~ChillMainSass/custom/config/colors';
|
|
||||||
|
|
||||||
/*
|
|
||||||
* PERSON CONTEXT
|
|
||||||
*/
|
|
||||||
|
|
||||||
div#header-person-name {
|
|
||||||
background: none repeat scroll 0 0 $chill-green-dark;
|
|
||||||
color: #FFF;
|
|
||||||
padding-top: 1em;
|
|
||||||
padding-bottom: 1em;
|
|
||||||
}
|
|
||||||
|
|
||||||
div#header-person-details {
|
|
||||||
background: none repeat scroll 0 0 $chill-green;
|
|
||||||
color: #FFF;
|
|
||||||
padding-top: 1em;
|
|
||||||
padding-bottom: 1em;
|
|
||||||
}
|
|
||||||
|
|
||||||
div#person_details_container {
|
|
||||||
padding-top: 20px;
|
|
||||||
padding-bottom: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.person-view {
|
|
||||||
figure.person-details {
|
|
||||||
h2 {
|
|
||||||
font-family: 'Open Sans';
|
|
||||||
font-weight: 600;
|
|
||||||
margin-bottom: 0.3em;
|
|
||||||
font-variant: small-caps;
|
|
||||||
}
|
|
||||||
dl {
|
|
||||||
margin-top: 0.3em;
|
|
||||||
}
|
|
||||||
dt {
|
|
||||||
font-family: 'Open Sans';
|
|
||||||
font-weight: 600;
|
|
||||||
}
|
|
||||||
dd {
|
|
||||||
margin-left: 0;
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
a.sc-button { background-color: $black; padding-top: 0.2em; padding-bottom: 0.2em; }
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
/* custom fields on the home page */
|
|
||||||
div.custom-fields {
|
|
||||||
figure.person-details {
|
|
||||||
display: flex;
|
|
||||||
flex-flow: row wrap;
|
|
||||||
div.cf_title_box:nth-child(4n+1) h2 {
|
|
||||||
@extend .chill-red;
|
|
||||||
}
|
|
||||||
div.cf_title_box:nth-child(4n+2) h2 {
|
|
||||||
@extend .chill-green;
|
|
||||||
}
|
|
||||||
div.cf_title_box:nth-child(4n+3) h2 {
|
|
||||||
@extend .chill-orange;
|
|
||||||
}
|
|
||||||
div.cf_title_box:nth-child(4n+4) h2 {
|
|
||||||
@extend .chill-blue;
|
|
||||||
}
|
|
||||||
div.cf_title_box:nth-child(2n+1) {
|
|
||||||
width: 50%;
|
|
||||||
margin-right: 40px;
|
|
||||||
}
|
|
||||||
div.cf_title_box:nth-child(2n+2) {
|
|
||||||
width: calc(50% - 40px);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* ACCOMPANYING_COURSE CONTEXT
|
|
||||||
* Header custom for Accompanying Course
|
|
||||||
*/
|
|
||||||
|
|
||||||
div#header-accompanying_course-name {
|
|
||||||
background: none repeat scroll 0 0 #718596;
|
|
||||||
color: #FFF;
|
|
||||||
h1 {
|
|
||||||
margin: 0.4em 0;
|
|
||||||
}
|
|
||||||
span {
|
|
||||||
a {
|
|
||||||
color: white;
|
|
||||||
}
|
|
||||||
a:hover {
|
|
||||||
text-decoration: underline;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
div#header-accompanying_course-details {
|
|
||||||
background: none repeat scroll 0 0 #718596ab;
|
|
||||||
color: #FFF;
|
|
||||||
padding-top: 1em;
|
|
||||||
padding-bottom: 1em;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* HOUSEHOLD CONTEXT
|
|
||||||
* Header custom for Household
|
|
||||||
*/
|
|
||||||
|
|
||||||
div#header-household-name {
|
|
||||||
background: none repeat scroll 0 0 #929d69; //#b97a7a;
|
|
||||||
color: #FFF;
|
|
||||||
h1 {
|
|
||||||
margin: 0.4em 0;
|
|
||||||
}
|
|
||||||
span {
|
|
||||||
a {
|
|
||||||
color: white;
|
|
||||||
}
|
|
||||||
a:hover {
|
|
||||||
text-decoration: underline;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
div#header-household-details {
|
|
||||||
background: none repeat scroll 0 0 #b0b984; //#d29791;
|
|
||||||
color: #FFF;
|
|
||||||
padding-top: 1em;
|
|
||||||
padding-bottom: 1em;
|
|
||||||
span.current-members-explain {
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* ADDRESS HISTORY
|
|
||||||
* context person / household
|
|
||||||
*/
|
|
||||||
div.address-timeline.grid {
|
|
||||||
display: grid;
|
|
||||||
grid-template-rows: auto auto auto;
|
|
||||||
grid-template-columns: auto 120px auto;
|
|
||||||
|
|
||||||
@media only screen and (max-width: 750px) {
|
|
||||||
grid-template-columns: auto 1em auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.top {
|
|
||||||
grid-column: 2;
|
|
||||||
text-align: center;
|
|
||||||
color: lightgrey;
|
|
||||||
margin-bottom: -20px;
|
|
||||||
}
|
|
||||||
div.col-a {
|
|
||||||
grid-column: 1;
|
|
||||||
text-align: right;
|
|
||||||
}
|
|
||||||
div.col-b,
|
|
||||||
div.date {
|
|
||||||
grid-column: 2;
|
|
||||||
position: relative;
|
|
||||||
&:after {
|
|
||||||
position: absolute;
|
|
||||||
content: '';
|
|
||||||
top: 0; bottom: 0;
|
|
||||||
left: 50%;
|
|
||||||
margin: auto -5px;
|
|
||||||
width: 10px;
|
|
||||||
height: 100%;
|
|
||||||
background-color: lightgrey;
|
|
||||||
z-index: -5;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
div.col-c {
|
|
||||||
grid-column: 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.col-b,
|
|
||||||
div.action,
|
|
||||||
div.content {
|
|
||||||
min-height: 30px;
|
|
||||||
padding: 1em;
|
|
||||||
}
|
|
||||||
div.content {
|
|
||||||
margin: 0.3em;
|
|
||||||
border: 1px dashed #00000045;
|
|
||||||
&.row1 { // current address
|
|
||||||
border: 1px solid #000;
|
|
||||||
}
|
|
||||||
div.address {
|
|
||||||
font-variant: small-caps;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
div.date {
|
|
||||||
text-align: center;
|
|
||||||
background-color: lightgrey;
|
|
||||||
padding: 0.5em;
|
|
||||||
border-radius: 0.3em;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.span2 { grid-row: span 3; }
|
|
||||||
div.span3 { grid-row: span 5; }
|
|
||||||
div.span4 { grid-row: span 7; }
|
|
||||||
div.span5 { grid-row: span 9; }
|
|
||||||
|
|
||||||
ul.record_actions {
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
.fake {
|
|
||||||
&:after {
|
|
||||||
content: 'fake, just to test.. ';
|
|
||||||
color: lightgrey;
|
|
||||||
font-style: italic;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
168
src/Bundle/ChillPersonBundle/Resources/public/sass/person.scss
Normal file
168
src/Bundle/ChillPersonBundle/Resources/public/sass/person.scss
Normal file
@@ -0,0 +1,168 @@
|
|||||||
|
|
||||||
|
@import '~ChillMainSass/custom/config/colors';
|
||||||
|
|
||||||
|
div#header-person-name {
|
||||||
|
background: none repeat scroll 0 0 $chill-green-dark;
|
||||||
|
color: #FFF;
|
||||||
|
padding-top: 1em;
|
||||||
|
padding-bottom: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
div#header-person-details {
|
||||||
|
background: none repeat scroll 0 0 $chill-green;
|
||||||
|
color: #FFF;
|
||||||
|
padding-top: 1em;
|
||||||
|
padding-bottom: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
div#person_details_container {
|
||||||
|
padding-top: 20px;
|
||||||
|
padding-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.person-view {
|
||||||
|
figure.person-details {
|
||||||
|
h2 {
|
||||||
|
font-family: 'Open Sans';
|
||||||
|
font-weight: 600;
|
||||||
|
margin-bottom: 0.3em;
|
||||||
|
font-variant: small-caps;
|
||||||
|
}
|
||||||
|
|
||||||
|
dl {
|
||||||
|
margin-top: 0.3em;
|
||||||
|
}
|
||||||
|
|
||||||
|
dt {
|
||||||
|
font-family: 'Open Sans';
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
dd {
|
||||||
|
margin-left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// a.sc-button {
|
||||||
|
/* background-color: $black;
|
||||||
|
padding-top: 0.2em;
|
||||||
|
padding-bottom: 0.2em;
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
|
||||||
|
/* custom fields on the home page */
|
||||||
|
div.custom-fields {
|
||||||
|
figure.person-details {
|
||||||
|
display: flex;
|
||||||
|
flex-flow: row wrap;
|
||||||
|
|
||||||
|
div.cf_title_box:nth-child(4n+1) h2 {
|
||||||
|
@extend .chill-red;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.cf_title_box:nth-child(4n+2) h2 {
|
||||||
|
@extend .chill-green;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.cf_title_box:nth-child(4n+3) h2 {
|
||||||
|
@extend .chill-orange;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.cf_title_box:nth-child(4n+4) h2 {
|
||||||
|
@extend .chill-blue;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.cf_title_box:nth-child(2n+1){
|
||||||
|
width: 50%;
|
||||||
|
margin-right: 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
iv.cf_title_box:nth-child(2n+2) {
|
||||||
|
width: calc(50% - 40px);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* HOUSEHOLD
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
div.household__address, div.person__address {
|
||||||
|
div.row {
|
||||||
|
height: 100px;
|
||||||
|
width: 100%;
|
||||||
|
position: relative;
|
||||||
|
& > div {
|
||||||
|
position: absolute;
|
||||||
|
display: table;
|
||||||
|
height: 100%;
|
||||||
|
border: 1px dotted #c3c3c3;
|
||||||
|
}
|
||||||
|
div.household__address--date, div.person__address--date {
|
||||||
|
width: 30%;
|
||||||
|
background-color: #c3c3c3;
|
||||||
|
height: 100%;
|
||||||
|
div.cell {
|
||||||
|
box-sizing: border-box;
|
||||||
|
position: relative;
|
||||||
|
height: 100%;
|
||||||
|
width: 100%;
|
||||||
|
margin-left: 50%;
|
||||||
|
div.pill {
|
||||||
|
position: absolute;
|
||||||
|
box-sizing: border-box;
|
||||||
|
width: 120px;
|
||||||
|
height: 40px;
|
||||||
|
bottom: -20px;
|
||||||
|
background-color: white;
|
||||||
|
padding: 10px;
|
||||||
|
border-radius: 30px;
|
||||||
|
left: -60px;
|
||||||
|
text-align: center;
|
||||||
|
z-index: 10;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
div.household__address--content, div.person__address--content {
|
||||||
|
width: 70%;
|
||||||
|
left: 30%;
|
||||||
|
text-align: left;
|
||||||
|
background-color: #ececec;
|
||||||
|
border: 1px solid #888;
|
||||||
|
div.cell {
|
||||||
|
display: table-cell;
|
||||||
|
padding: 5px 30px;
|
||||||
|
vertical-align: middle;
|
||||||
|
& > div {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
i.dot::before, i.dot::after {
|
||||||
|
position: absolute;
|
||||||
|
width: 20px;
|
||||||
|
height: 20px;
|
||||||
|
content: '';
|
||||||
|
border: 0;
|
||||||
|
background-color: white;
|
||||||
|
border-radius: 50%;
|
||||||
|
border: 5px solid #c3c3c3;
|
||||||
|
z-index: 10;
|
||||||
|
left: -15px;
|
||||||
|
bottom: -15px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
div.household__address-move {
|
||||||
|
div.household__address-move__create {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
}
|
@@ -57,6 +57,12 @@ export default {
|
|||||||
position: relative;
|
position: relative;
|
||||||
&:before {
|
&:before {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
/*
|
||||||
|
content: "\f192"; //circle-dot
|
||||||
|
content: "\f1dd"; //paragraph
|
||||||
|
content: "\f292"; //hashtag
|
||||||
|
content: "\f069"; //asterisk
|
||||||
|
*/
|
||||||
content: "\f142"; //ellipsis-v
|
content: "\f142"; //ellipsis-v
|
||||||
font-family: "ForkAwesome";
|
font-family: "ForkAwesome";
|
||||||
color: #718596ab;
|
color: #718596ab;
|
||||||
@@ -65,7 +71,7 @@ export default {
|
|||||||
}
|
}
|
||||||
a[name^="section"] {
|
a[name^="section"] {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: -3.5em; // reference for stickNav
|
top: -3.5em; // ref. stickNav
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
padding: 0.8em 0em;
|
padding: 0.8em 0em;
|
||||||
@@ -74,6 +80,18 @@ export default {
|
|||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
border-left: 1px dotted #718596ab;
|
border-left: 1px dotted #718596ab;
|
||||||
border-right: 1px dotted #718596ab;
|
border-right: 1px dotted #718596ab;
|
||||||
|
/* debug components
|
||||||
|
position: relative;
|
||||||
|
&:before {
|
||||||
|
content: "vuejs component";
|
||||||
|
position: absolute;
|
||||||
|
left: 1.5em;
|
||||||
|
top: -0.9em;
|
||||||
|
background-color: white;
|
||||||
|
color: grey;
|
||||||
|
padding: 0 0.3em;
|
||||||
|
}
|
||||||
|
*/
|
||||||
dd {
|
dd {
|
||||||
margin-left: 1em;
|
margin-left: 1em;
|
||||||
}
|
}
|
||||||
|
@@ -18,6 +18,9 @@
|
|||||||
|
|
||||||
<dl class="content-bloc" v-if="accompanyingCourse.requestor.type === 'person'">
|
<dl class="content-bloc" v-if="accompanyingCourse.requestor.type === 'person'">
|
||||||
|
|
||||||
|
<dt>{{ $t('requestor.birthdate') }}</dt>
|
||||||
|
<dd>{{ $d(accompanyingCourse.requestor.birthdate.datetime, 'short') }}</dd>
|
||||||
|
|
||||||
<dt>{{ $t('requestor.center') }}</dt>
|
<dt>{{ $t('requestor.center') }}</dt>
|
||||||
<dd>{{ accompanyingCourse.requestor.center.name }}</dd>
|
<dd>{{ accompanyingCourse.requestor.center.name }}</dd>
|
||||||
|
|
||||||
@@ -115,12 +118,7 @@ export default {
|
|||||||
get() {
|
get() {
|
||||||
return this.$store.state.accompanyingCourse.requestorAnonymous;
|
return this.$store.state.accompanyingCourse.requestorAnonymous;
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
hasRequestorPersonBirthdate() {
|
|
||||||
console.log('hasRequestorBirthdate');
|
|
||||||
console.log(this.$store.state.accompanyingCourse.requestor);
|
|
||||||
return this.$store.state.accompanyingCourse.requestor.birthdate !== null;
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
removeRequestor() {
|
removeRequestor() {
|
||||||
|
@@ -11,9 +11,9 @@
|
|||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td v-if="resource.resource.type === 'person'">
|
<td v-if="resource.resource.type === 'person'">
|
||||||
|
{{ $tc('person.born') }}{{ $d(resource.resource.birthdate.datetime, 'short') }}
|
||||||
</td>
|
</td>
|
||||||
<td v-if="resource.resource.type === 'thirdparty'">
|
<td v-else-if="resource.resource.type === 'thirdparty'">
|
||||||
{{ resource.resource.address.text }}<br>
|
{{ resource.resource.address.text }}<br>
|
||||||
{{ resource.resource.address.postcode.name }}
|
{{ resource.resource.address.postcode.name }}
|
||||||
</td>
|
</td>
|
||||||
|
@@ -24,6 +24,7 @@ if (root === 'app') {
|
|||||||
.use(i18n)
|
.use(i18n)
|
||||||
.component('app', App)
|
.component('app', App)
|
||||||
.mount('#accompanying-course');
|
.mount('#accompanying-course');
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,7 +43,8 @@ if (root === 'banner') {
|
|||||||
.use(store)
|
.use(store)
|
||||||
.use(i18n)
|
.use(i18n)
|
||||||
.component('banner', Banner)
|
.component('banner', Banner)
|
||||||
.mount('#banner-accompanying-course');
|
.mount('#accompanying-course');
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -14,6 +14,7 @@
|
|||||||
|
|
||||||
<div v-if="hasSocialIssuePicked">
|
<div v-if="hasSocialIssuePicked">
|
||||||
<h2>{{ $t('pick_an_action') }}</h2>
|
<h2>{{ $t('pick_an_action') }}</h2>
|
||||||
|
|
||||||
<vue-multiselect
|
<vue-multiselect
|
||||||
v-model="socialActionPicked"
|
v-model="socialActionPicked"
|
||||||
label="text"
|
label="text"
|
||||||
@@ -28,19 +29,8 @@
|
|||||||
<div v-if="isLoadingSocialActions">
|
<div v-if="isLoadingSocialActions">
|
||||||
<p>spinner</p>
|
<p>spinner</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="hasSocialActionPicked" id="persons">
|
|
||||||
<h2>{{ $t('persons_involved') }}</h2>
|
|
||||||
|
|
||||||
<ul>
|
|
||||||
<li v-for="p in personsReachables" :key="p.id">
|
|
||||||
<input type="checkbox" :value="p.id" v-model="personsPicked">
|
|
||||||
<person :person="p"></person>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="hasSocialActionPicked" id="start_date">
|
<div v-if="hasSocialActionPicked" id="start_date">
|
||||||
<p><label>{{ $t('startDate') }}</label> <input type="date" v-model="startDate" /></p>
|
<p><label>{{ $t('startDate') }}</label> <input type="date" v-model="startDate" /></p>
|
||||||
</div>
|
</div>
|
||||||
@@ -96,14 +86,6 @@
|
|||||||
|
|
||||||
#picking {
|
#picking {
|
||||||
grid-area: picking;
|
grid-area: picking;
|
||||||
|
|
||||||
#persons {
|
|
||||||
ul {
|
|
||||||
padding: 0;
|
|
||||||
|
|
||||||
list-style-type: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#start_date {
|
#start_date {
|
||||||
@@ -124,7 +106,6 @@
|
|||||||
import { mapState, mapActions, mapGetters } from 'vuex';
|
import { mapState, mapActions, mapGetters } from 'vuex';
|
||||||
import VueMultiselect from 'vue-multiselect';
|
import VueMultiselect from 'vue-multiselect';
|
||||||
import { dateToISO, ISOToDate } from 'ChillMainAssets/js/date.js';
|
import { dateToISO, ISOToDate } from 'ChillMainAssets/js/date.js';
|
||||||
import Person from 'ChillPersonAssets/vuejs/_components/Person/Person.vue';
|
|
||||||
|
|
||||||
const i18n = {
|
const i18n = {
|
||||||
messages: {
|
messages: {
|
||||||
@@ -135,7 +116,6 @@ const i18n = {
|
|||||||
pick_social_issue: "Choisir une problématique sociale",
|
pick_social_issue: "Choisir une problématique sociale",
|
||||||
pick_an_action: "Choisir une action d'accompagnement",
|
pick_an_action: "Choisir une action d'accompagnement",
|
||||||
pick_social_issue_linked_with_action: "Indiquez la problématique sociale liée à l'action d'accompagnement",
|
pick_social_issue_linked_with_action: "Indiquez la problématique sociale liée à l'action d'accompagnement",
|
||||||
persons_involved: "Usagers concernés",
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -145,7 +125,6 @@ export default {
|
|||||||
name: 'App',
|
name: 'App',
|
||||||
components: {
|
components: {
|
||||||
VueMultiselect,
|
VueMultiselect,
|
||||||
Person,
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
submit() {
|
submit() {
|
||||||
@@ -158,7 +137,6 @@ export default {
|
|||||||
'socialIssues',
|
'socialIssues',
|
||||||
'socialActionsReachables',
|
'socialActionsReachables',
|
||||||
'errors',
|
'errors',
|
||||||
'personsReachables',
|
|
||||||
]),
|
]),
|
||||||
...mapGetters([
|
...mapGetters([
|
||||||
'hasSocialIssuePicked',
|
'hasSocialIssuePicked',
|
||||||
@@ -167,18 +145,6 @@ export default {
|
|||||||
'isPostingWork',
|
'isPostingWork',
|
||||||
'hasErrors',
|
'hasErrors',
|
||||||
]),
|
]),
|
||||||
personsPicked: {
|
|
||||||
get() {
|
|
||||||
let s = this.$store.state.personsPicked.map(p => p.id);
|
|
||||||
console.log('persons picked', s);
|
|
||||||
|
|
||||||
return s;
|
|
||||||
},
|
|
||||||
set(v) {
|
|
||||||
console.log('persons picked', v);
|
|
||||||
this.$store.commit('setPersonsPickedIds', v);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
socialIssuePicked: {
|
socialIssuePicked: {
|
||||||
get() {
|
get() {
|
||||||
let s = this.$store.state.socialIssuePicked;
|
let s = this.$store.state.socialIssuePicked;
|
||||||
|
@@ -14,10 +14,6 @@ const store = createStore({
|
|||||||
socialIssuePicked: null,
|
socialIssuePicked: null,
|
||||||
socialActionsReachables: [],
|
socialActionsReachables: [],
|
||||||
socialActionPicked: null,
|
socialActionPicked: null,
|
||||||
personsPicked: window.accompanyingCourse.participations.filter(p => p.endDate == null)
|
|
||||||
.map(p => p.person),
|
|
||||||
personsReachables: window.accompanyingCourse.participations.filter(p => p.endDate == null)
|
|
||||||
.map(p => p.person),
|
|
||||||
startDate: new Date(),
|
startDate: new Date(),
|
||||||
endDate: null,
|
endDate: null,
|
||||||
isLoadingSocialActions: false,
|
isLoadingSocialActions: false,
|
||||||
@@ -42,23 +38,15 @@ const store = createStore({
|
|||||||
buildPayloadCreate(state) {
|
buildPayloadCreate(state) {
|
||||||
let payload = {
|
let payload = {
|
||||||
type: 'accompanying_period_work',
|
type: 'accompanying_period_work',
|
||||||
socialAction: {
|
social_action: {
|
||||||
type: 'social_work_social_action',
|
type: 'social_work_social_action',
|
||||||
id: state.socialActionPicked.id
|
id: state.socialActionPicked.id
|
||||||
},
|
},
|
||||||
startDate: {
|
startDate: {
|
||||||
datetime: datetimeToISO(state.startDate)
|
datetime: datetimeToISO(state.startDate)
|
||||||
},
|
}
|
||||||
persons: []
|
|
||||||
};
|
};
|
||||||
|
|
||||||
for (let i in state.personsPicked) {
|
|
||||||
payload.persons.push({
|
|
||||||
id: state.personsPicked[i].id,
|
|
||||||
type: 'person'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (null !== state.endDate) {
|
if (null !== state.endDate) {
|
||||||
payload.endDate = {
|
payload.endDate = {
|
||||||
datetime: datetimeToISO(state.endDate)
|
datetime: datetimeToISO(state.endDate)
|
||||||
@@ -83,16 +71,12 @@ const store = createStore({
|
|||||||
state.socialActionPicked = socialAction;
|
state.socialActionPicked = socialAction;
|
||||||
},
|
},
|
||||||
setSocialIssue(state, socialIssueId) {
|
setSocialIssue(state, socialIssueId) {
|
||||||
console.log('set social issue', socialIssueId);
|
|
||||||
if (socialIssueId === null) {
|
if (socialIssueId === null) {
|
||||||
state.socialIssuePicked = null;
|
state.socialIssuePicked = null;
|
||||||
} else {
|
return;
|
||||||
let mapped = state.socialIssues
|
|
||||||
.find(e => e.id === socialIssueId);
|
|
||||||
console.log('mapped', mapped);
|
|
||||||
state.socialIssuePicked = mapped;
|
|
||||||
console.log('social issue setted', state.socialIssuePicked);
|
|
||||||
}
|
}
|
||||||
|
state.socialIssuePicked = state.socialIssues
|
||||||
|
.find(e => e.id === socialIssueId);
|
||||||
},
|
},
|
||||||
setIsLoadingSocialActions(state, s) {
|
setIsLoadingSocialActions(state, s) {
|
||||||
state.isLoadingSocialActions = s;
|
state.isLoadingSocialActions = s;
|
||||||
@@ -106,11 +90,6 @@ const store = createStore({
|
|||||||
setEndDate(state, date) {
|
setEndDate(state, date) {
|
||||||
state.endDate = date;
|
state.endDate = date;
|
||||||
},
|
},
|
||||||
setPersonsPickedIds(state, ids) {
|
|
||||||
console.log('persons ids', ids);
|
|
||||||
state.personsPicked = state.personsReachables
|
|
||||||
.filter(p => ids.includes(p.id))
|
|
||||||
},
|
|
||||||
addErrors(state, { errors, cancel_posting }) {
|
addErrors(state, { errors, cancel_posting }) {
|
||||||
console.log('add errors', errors);
|
console.log('add errors', errors);
|
||||||
state.errors = errors;
|
state.errors = errors;
|
||||||
@@ -124,10 +103,8 @@ const store = createStore({
|
|||||||
console.log('pick social issue');
|
console.log('pick social issue');
|
||||||
|
|
||||||
commit('setIsLoadingSocialActions', true);
|
commit('setIsLoadingSocialActions', true);
|
||||||
commit('setSocialAction', null);
|
|
||||||
commit('setSocialActionsReachables', []);
|
|
||||||
commit('setSocialIssue', null);
|
commit('setSocialIssue', null);
|
||||||
|
commit('setSocialActionsReachables', []);
|
||||||
|
|
||||||
findSocialActionsBySocialIssue(socialIssueId).then(
|
findSocialActionsBySocialIssue(socialIssueId).then(
|
||||||
(response) => {
|
(response) => {
|
||||||
@@ -167,6 +144,9 @@ const store = createStore({
|
|||||||
commit('addErrors', { errors, cancel_posting: true });
|
commit('addErrors', { errors, cancel_posting: true });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@@ -1,486 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div id="workEditor">
|
|
||||||
<div id="title">
|
|
||||||
<label class="action_title_label">{{ $t('action_title') }}</label>
|
|
||||||
<p class="action_title">{{ work.socialAction.text }}</p>
|
|
||||||
</div>
|
|
||||||
<div id="startDate">
|
|
||||||
<label>{{ $t('startDate') }}</label>
|
|
||||||
<input type="date" v-model="startDate" />
|
|
||||||
</div>
|
|
||||||
<div id="endDate">
|
|
||||||
<label>{{ $t('endDate') }}</label>
|
|
||||||
<input type="date" v-model="endDate" />
|
|
||||||
</div>
|
|
||||||
<div id="comment">
|
|
||||||
<label>Commentaire</label>
|
|
||||||
<ckeditor
|
|
||||||
:editor="editor"
|
|
||||||
v-model="note"
|
|
||||||
tag-name="textarea"
|
|
||||||
></ckeditor>
|
|
||||||
</div>
|
|
||||||
<div id="objectives" class="objectives_list">
|
|
||||||
<div class="title" aria="hidden">
|
|
||||||
<div><h3>Motifs - objectifs - dispositifs</h3></div>
|
|
||||||
<div><h3>Orientations - résultats</h3></div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- results which are not attached to an objective -->
|
|
||||||
<div v-if="hasResultsForAction">
|
|
||||||
<div class="results_without_objective">
|
|
||||||
{{ $t('results_without_objective') }}
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<add-result :availableResults="resultsForAction" destination="action"></add-result>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- results which **are** attached to an objective -->
|
|
||||||
<div v-for="g in goalsPicked">
|
|
||||||
<div>
|
|
||||||
<div @click="removeGoal(g)" class="objective-title">
|
|
||||||
<i class="fa fa-times"></i>
|
|
||||||
{{ g.goal.title.fr }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<add-result destination="goal" :goal="g.goal"></add-result>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- box to add goal -->
|
|
||||||
<div class="add_goal">
|
|
||||||
<div>
|
|
||||||
<div v-if="showAddObjective">
|
|
||||||
|
|
||||||
<p>Motifs, objectifs et dispositifs disponibles pour ajout :</p>
|
|
||||||
|
|
||||||
<ul class="list-objectives">
|
|
||||||
<li v-for="g in availableForCheckGoal" @click="addGoal(g)" class="badge badge-primary">
|
|
||||||
<i class="fa fa-plus"></i>
|
|
||||||
{{ g.title.fr }}
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<ul class="record_actions">
|
|
||||||
<li>
|
|
||||||
<button @click="toggleAddObjective" class="sc-button bt-create">
|
|
||||||
Ajouter un objectif
|
|
||||||
</button>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<div><!-- empty for results --></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<div id="persons">
|
|
||||||
<h2>{{ $t('persons_involved') }}</h2>
|
|
||||||
|
|
||||||
<ul>
|
|
||||||
<li v-for="p in personsReachables" :key="p.id">
|
|
||||||
<input type="checkbox" :value="p.id" v-model="personsPicked">
|
|
||||||
<person :person="p"></person>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<div id="handlingThirdParty">
|
|
||||||
<h2>Tiers traitant</h2>
|
|
||||||
|
|
||||||
<div v-if="!hasHandlingThirdParty">
|
|
||||||
<p class="chill-no-data-statement">
|
|
||||||
Aucun tiers traitant
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<ul class="record_actions">
|
|
||||||
<li>
|
|
||||||
<add-persons
|
|
||||||
buttonTitle="Indiquer un tiers traitant"
|
|
||||||
modalTitle="Choisir un tiers"
|
|
||||||
v-bind:key="handlingThirdPartyPicker.key"
|
|
||||||
v-bind:options="handlingThirdPartyPicker.options"
|
|
||||||
@addNewPersons="setHandlingThirdParty"
|
|
||||||
ref="handlingThirdPartyPicker"> <!-- to cast child method -->
|
|
||||||
</add-persons>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<div v-else>
|
|
||||||
<p>{{ handlingThirdParty.text }}</p>
|
|
||||||
<show-address :address="handlingThirdParty.address"></show-address>
|
|
||||||
|
|
||||||
<ul class="record_actions">
|
|
||||||
<li>
|
|
||||||
<button class="sc-button bt-delete" @click="removeHandlingThirdParty">
|
|
||||||
Supprimer le tiers traitant
|
|
||||||
</button>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<div id="thirdParties">
|
|
||||||
<h2>Tiers intervenants</h2>
|
|
||||||
|
|
||||||
<div v-if="!hasThirdParties">
|
|
||||||
<p class="chill-no-data-statement">Aucun tiers intervenant</p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div v-else>
|
|
||||||
<ul>
|
|
||||||
<li v-for="t in thirdParties">
|
|
||||||
<p>{{ t.text }}</p>
|
|
||||||
<show-address :address="t.address"></show-address>
|
|
||||||
|
|
||||||
<ul class="record_actions">
|
|
||||||
<button class="sc-button bt-delete" @click="removeThirdParty(t)"></button>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<ul class="record_actions">
|
|
||||||
<li>
|
|
||||||
<add-persons
|
|
||||||
buttonTitle="Ajouter des tiers"
|
|
||||||
modalTitle="Choisir des tiers"
|
|
||||||
v-bind:key="thirdPartyPicker.key"
|
|
||||||
v-bind:options="thirdPartyPicker.options"
|
|
||||||
@addNewPersons="addThirdParties"
|
|
||||||
ref="thirdPartyPicker"> <!-- to cast child method -->
|
|
||||||
</add-persons>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="errors" v-if="errors.length > 0">
|
|
||||||
<p>Veuillez corriger les erreurs suivantes:</p>
|
|
||||||
<ul>
|
|
||||||
<li v-for="e in errors">{{ e }}</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<ul class="record_actions sticky-form-buttons">
|
|
||||||
<li v-if="!isPosting">
|
|
||||||
<button
|
|
||||||
class="sc-button bt-save"
|
|
||||||
@click="submit"
|
|
||||||
>
|
|
||||||
{{ $t('action.save') }}
|
|
||||||
</button>
|
|
||||||
</li>
|
|
||||||
<li v-if="isPosting">
|
|
||||||
<button
|
|
||||||
class="sc-button bt-save"
|
|
||||||
disabled
|
|
||||||
>
|
|
||||||
{{ $t('action.save') }}
|
|
||||||
</button>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<style lang="scss">
|
|
||||||
|
|
||||||
#workEditor {
|
|
||||||
display: grid;
|
|
||||||
grid-template-areas:
|
|
||||||
"title title"
|
|
||||||
"startDate endDate"
|
|
||||||
"comment comment"
|
|
||||||
"objectives objectives"
|
|
||||||
"persons persons"
|
|
||||||
"handling handling"
|
|
||||||
"tparties tparties"
|
|
||||||
"errors errors"
|
|
||||||
;
|
|
||||||
|
|
||||||
grid-template-columns: 50%;
|
|
||||||
column-gap: 1rem;
|
|
||||||
|
|
||||||
#title {
|
|
||||||
grid-area: title;
|
|
||||||
|
|
||||||
.action_title_label {
|
|
||||||
margin-bottom: 0;
|
|
||||||
}
|
|
||||||
.action_title {
|
|
||||||
margin-top: 0;
|
|
||||||
font-weight: bold;
|
|
||||||
font-size: 1.5rem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#startDate {
|
|
||||||
grid-area: startDate;
|
|
||||||
}
|
|
||||||
#endDate {
|
|
||||||
grid-area: endDate;
|
|
||||||
}
|
|
||||||
#comment {
|
|
||||||
grid-area: comment;
|
|
||||||
}
|
|
||||||
#objectives {
|
|
||||||
grid-area: objectives;
|
|
||||||
|
|
||||||
> div.title {
|
|
||||||
background-color: var(--chill-light-gray);
|
|
||||||
color: white;
|
|
||||||
|
|
||||||
h3 {
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
> div {
|
|
||||||
display: grid;
|
|
||||||
grid-template-areas: "obj res";
|
|
||||||
grid-template-columns: 50%;
|
|
||||||
column-gap: 1rem;
|
|
||||||
|
|
||||||
> div {
|
|
||||||
&:nth-child(1) {
|
|
||||||
grid-area: obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
&:nth-child(2) {
|
|
||||||
grid-area: res;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
> div.results_without_objective {
|
|
||||||
background: repeating-linear-gradient(
|
|
||||||
45deg,
|
|
||||||
var(--chill-light-gray),
|
|
||||||
var(--chill-light-gray) 10px,
|
|
||||||
var(--chill-llight-gray) 10px,
|
|
||||||
var(--chill-llight-gray) 20px
|
|
||||||
);
|
|
||||||
|
|
||||||
text-align: center;
|
|
||||||
font-weight: 700;
|
|
||||||
padding-top: 1.5rem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ul.list-objectives {
|
|
||||||
list-style-type: none;
|
|
||||||
padding: 0;
|
|
||||||
|
|
||||||
li {
|
|
||||||
margin: 0.5rem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
div.objective-title {
|
|
||||||
margin-top: 1rem;
|
|
||||||
font-size: 1.5rem;
|
|
||||||
font-weight: bold;
|
|
||||||
text-align: center;
|
|
||||||
|
|
||||||
|
|
||||||
i.fa {
|
|
||||||
padding: 0.25rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
i.fa-times {
|
|
||||||
background-color: red;
|
|
||||||
color: white;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
li.badge, div.badge {
|
|
||||||
padding-bottom: 0;
|
|
||||||
padding-top: 0;
|
|
||||||
padding-left: 0;
|
|
||||||
|
|
||||||
i.fa {
|
|
||||||
padding: 0.25rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
i.fa-plus {
|
|
||||||
background-color: green;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#persons {
|
|
||||||
grid-area: persons;
|
|
||||||
}
|
|
||||||
#handlingThirdParty {
|
|
||||||
grid-area: handling;
|
|
||||||
}
|
|
||||||
#thirdParties {
|
|
||||||
grid-area: tparties;
|
|
||||||
}
|
|
||||||
#errors {
|
|
||||||
grid-area: errors;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
|
|
||||||
import { mapState, mapGetters, } from 'vuex';
|
|
||||||
import { dateToISO, ISOToDate, ISOToDatetime } from 'ChillMainAssets/js/date.js';
|
|
||||||
import CKEditor from '@ckeditor/ckeditor5-vue';
|
|
||||||
import ClassicEditor from 'ChillMainAssets/modules/ckeditor5/index.js';
|
|
||||||
import AddResult from './_components/AddResult.vue';
|
|
||||||
import Person from 'ChillPersonAssets/vuejs/_components/Person/Person.vue';
|
|
||||||
import AddPersons from 'ChillPersonAssets/vuejs/_components/AddPersons.vue';
|
|
||||||
import ShowAddress from 'ChillMainAssets/vuejs/_components/ShowAddress.vue';
|
|
||||||
|
|
||||||
const i18n = {
|
|
||||||
messages: {
|
|
||||||
fr: {
|
|
||||||
action_title: "Action d'accompagnement",
|
|
||||||
startDate: "Date de début",
|
|
||||||
endDate: "Date de fin",
|
|
||||||
results_without_objective: "Résultats - orientations sans objectifs",
|
|
||||||
add_objectif: "Ajouter un motif - objectif - dispositif",
|
|
||||||
persons_involved: "Usagers concernés",
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: 'App',
|
|
||||||
components: {
|
|
||||||
ckeditor: CKEditor.component,
|
|
||||||
AddResult,
|
|
||||||
AddPersons,
|
|
||||||
Person,
|
|
||||||
ShowAddress,
|
|
||||||
},
|
|
||||||
i18n,
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
editor: ClassicEditor,
|
|
||||||
showAddObjective: false,
|
|
||||||
handlingThirdPartyPicker: {
|
|
||||||
key: 'handling-third-party',
|
|
||||||
options: {
|
|
||||||
type: [ 'thirdparty' ],
|
|
||||||
priority: null,
|
|
||||||
uniq: true
|
|
||||||
},
|
|
||||||
},
|
|
||||||
thirdPartyPicker: {
|
|
||||||
key: 'third-party',
|
|
||||||
options: {
|
|
||||||
type: [ 'thirdparty' ],
|
|
||||||
priority: null,
|
|
||||||
uniq: false,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
};
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
...mapState([
|
|
||||||
'work',
|
|
||||||
'resultsForAction',
|
|
||||||
'goalsPicked',
|
|
||||||
'personsReachables',
|
|
||||||
'handlingThirdParty',
|
|
||||||
'thirdParties',
|
|
||||||
'isPosting',
|
|
||||||
'errors',
|
|
||||||
]),
|
|
||||||
...mapGetters([
|
|
||||||
'hasResultsForAction',
|
|
||||||
'hasHandlingThirdParty',
|
|
||||||
'hasThirdParties',
|
|
||||||
]),
|
|
||||||
startDate: {
|
|
||||||
get() {
|
|
||||||
console.log('get start date', this.$store.state.startDate);
|
|
||||||
return dateToISO(this.$store.state.startDate);
|
|
||||||
},
|
|
||||||
set(v) {
|
|
||||||
this.$store.commit('setStartDate', ISOToDate(v));
|
|
||||||
}
|
|
||||||
},
|
|
||||||
endDate: {
|
|
||||||
get() {
|
|
||||||
console.log('get end date', this.$store.state.endDate);
|
|
||||||
return dateToISO(this.$store.state.endDate);
|
|
||||||
},
|
|
||||||
set(v) {
|
|
||||||
this.$store.commit('setEndDate', ISOToDate(v));
|
|
||||||
}
|
|
||||||
},
|
|
||||||
note: {
|
|
||||||
get() {
|
|
||||||
return this.$store.state.note;
|
|
||||||
},
|
|
||||||
set(v) {
|
|
||||||
this.$store.commit('setNote', v);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
availableForCheckGoal() {
|
|
||||||
let pickedIds = this.$store.state.goalsPicked.map(g => g.goal.id);
|
|
||||||
console.log('pickeds goals id', pickedIds);
|
|
||||||
console.log(this.$store.state.goalsForAction);
|
|
||||||
|
|
||||||
return this.$store.state.goalsForAction.filter(g => !pickedIds.includes(g.id));
|
|
||||||
},
|
|
||||||
personsPicked: {
|
|
||||||
get() {
|
|
||||||
let s = this.$store.state.personsPicked.map(p => p.id);
|
|
||||||
console.log('persons picked', s);
|
|
||||||
|
|
||||||
return s;
|
|
||||||
},
|
|
||||||
set(v) {
|
|
||||||
console.log('persons picked', v);
|
|
||||||
this.$store.commit('setPersonsPickedIds', v);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
toggleAddObjective() {
|
|
||||||
this.showAddObjective = !this.showAddObjective;
|
|
||||||
},
|
|
||||||
addGoal(g) {
|
|
||||||
console.log('add Goal', g);
|
|
||||||
this.$store.commit('addGoal', g);
|
|
||||||
},
|
|
||||||
removeGoal(g) {
|
|
||||||
console.log('remove goal', g);
|
|
||||||
this.$store.commit('removeGoal', g);
|
|
||||||
},
|
|
||||||
setHandlingThirdParty({ selected, modal }) {
|
|
||||||
console.log('setHandlingThirdParty', selected);
|
|
||||||
this.$store.commit('setHandlingThirdParty', selected.shift().result);
|
|
||||||
this.$refs.handlingThirdPartyPicker.resetSearch();
|
|
||||||
modal.showModal = false;
|
|
||||||
},
|
|
||||||
removeHandlingThirdParty() {
|
|
||||||
console.log('removeHandlingThirdParty');
|
|
||||||
this.$store.commit('setHandlingThirdParty', null);
|
|
||||||
},
|
|
||||||
addThirdParties({ selected, modal}) {
|
|
||||||
console.log('addThirdParties', selected);
|
|
||||||
this.$store.commit('addThirdParties', selected.map(r => r.result));
|
|
||||||
this.$refs.thirdPartyPicker.resetSearch();
|
|
||||||
modal.showModal = false;
|
|
||||||
},
|
|
||||||
removeThirdParty(t) {
|
|
||||||
console.log('remove third party', t);
|
|
||||||
this.$store.commit('removeThirdParty', t);
|
|
||||||
},
|
|
||||||
submit() {
|
|
||||||
this.$store.dispatch('submit');
|
|
||||||
},
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
</script>
|
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user