mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 21:34:25 +00:00
merge last AddPerson branch
This commit is contained in:
commit
9d651a70e9
64
.env
64
.env
@ -1,64 +0,0 @@
|
|||||||
##
|
|
||||||
## Manually dump .env files in .env.local.php with
|
|
||||||
## `$ composer symfony:dump-env prod`
|
|
||||||
##
|
|
||||||
|
|
||||||
## Project environment
|
|
||||||
APP_ENV=dev
|
|
||||||
|
|
||||||
## Enable debug
|
|
||||||
APP_DEBUG=true
|
|
||||||
|
|
||||||
## Locale
|
|
||||||
LOCALE=fr
|
|
||||||
|
|
||||||
## Framework secret
|
|
||||||
APP_SECRET=ThisTokenIsNotSoSecretChangeIt
|
|
||||||
|
|
||||||
## Symfony/swiftmailer
|
|
||||||
MAILER_TRANSPORT=smtp
|
|
||||||
MAILER_HOST=smtp
|
|
||||||
MAILER_PORT=1025
|
|
||||||
MAILER_CRYPT=
|
|
||||||
MAILER_AUTH=
|
|
||||||
MAILER_USER=
|
|
||||||
MAILER_PASSWORD=
|
|
||||||
MAILER_URL=${MAILER_TRANSPORT}://${MAILER_HOST}:${MAILER_PORT}?encryption=${MAILER_CRYPT}&auth_mode=${MAILER_AUTH}&username=${MAILER_USER}&password=${MAILER_PASSWORD}
|
|
||||||
|
|
||||||
## Notifications
|
|
||||||
NOTIFICATION_HOST=localhost:8001
|
|
||||||
NOTIFICATION_FROM_EMAIL=admin@chill.social
|
|
||||||
NOTIFICATION_FROM_NAME=Chill
|
|
||||||
|
|
||||||
## Gelf
|
|
||||||
GELF_HOST=gelf
|
|
||||||
GELF_PORT=12201
|
|
||||||
|
|
||||||
## OVH OpenStack Storage User/Role
|
|
||||||
OS_USERNAME=
|
|
||||||
OS_PASSWORD=
|
|
||||||
OS_TENANT_ID=
|
|
||||||
OS_REGION_NAME=GRA
|
|
||||||
OS_AUTH_URL=https://auth.cloud.ovh.net/v2.0/
|
|
||||||
|
|
||||||
## OVH OpenStack Storage Container
|
|
||||||
ASYNC_UPLOAD_TEMP_URL_KEY=
|
|
||||||
ASYNC_UPLOAD_TEMP_URL_BASE_PATH=
|
|
||||||
ASYNC_UPLOAD_TEMP_URL_CONTAINER=
|
|
||||||
|
|
||||||
## Redis Cache
|
|
||||||
REDIS_HOST=redis
|
|
||||||
REDIS_PORT=6379
|
|
||||||
REDIS_URL=redis://${REDIS_HOST}:${REDIS_PORT}
|
|
||||||
|
|
||||||
## Twilio
|
|
||||||
TWILIO_SID=~
|
|
||||||
TWILIO_SECRET=~
|
|
||||||
|
|
||||||
## DOCKER IMAGES REGISTRY
|
|
||||||
#IMAGE_PHP=
|
|
||||||
#IMAGE_NGINX=
|
|
||||||
|
|
||||||
## DOCKER IMAGES VERSION
|
|
||||||
#VERSION=test
|
|
||||||
VERSION=prod
|
|
33
CHANGELOG.md
33
CHANGELOG.md
@ -9,13 +9,36 @@ and this project adheres to
|
|||||||
* date versioning for test releases
|
* date versioning for test releases
|
||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
* AddPersons: remove ul-li html tags from AddPersons (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/419)
|
||||||
|
* [person]: AddPersons: allow creation of person or thirdparty only (no users) (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/422)
|
||||||
|
* [person]: AddPersons: allow creation of person or thirdparty depending on allowed types (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/422)
|
||||||
|
* [person]: AddPersons: add suggestion of name when creating new person or thirdparty (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/422)
|
||||||
|
* [main] Address: fix small bug: when modifying an address without street (isNoAddress), also check errors if street is an empty string as back-end change null value to empty string for street (and streetNumber)
|
||||||
|
* [main] Address: stronger client-side validation of addresses (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/449)
|
||||||
|
|
||||||
|
|
||||||
<!-- write down unreleased development here -->
|
<!-- write down unreleased development here -->
|
||||||
* [person] accompanying course work: fix on-the-fly update of thirdParty
|
* fix normalisation of accompanying course requestor api (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/378)
|
||||||
|
* [person] add a returnPath when clicking on some Person or ThirdParty badge (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/427)
|
||||||
|
* [person] accompanying course work: fix on-the-fly update of thirdParty
|
||||||
* [on-the-fly] close modal only after validation
|
* [on-the-fly] close modal only after validation
|
||||||
* [person] correct thirdparty PATCH url + add email and altnames in AddPerson and serializer (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/433)
|
* [person] correct thirdparty PATCH url + add email and altnames in AddPerson and serializer (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/433)
|
||||||
|
* change order for accompanying course work list
|
||||||
|
* [parcours]: Mes parcours brouillon added to user menu (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/440)
|
||||||
|
* [Documents]: List view adapted to display more information (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/414)
|
||||||
|
* [person]: style fix in parcours listing per person. (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/432)
|
||||||
|
* [household]: display address of current household (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/415)
|
||||||
|
* ajoute un ordre dans les localisation (api)
|
||||||
|
* [pick entity]: fix translations in modal (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/419)
|
||||||
|
* [homepage_widget]: fix translation on emergency badge (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/440)
|
||||||
|
* [person]: create person and household added to button dropdown (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/454)
|
||||||
|
* display full address in address.text in normalization. Adapt AddressRenderBox
|
||||||
|
* [address]: Correction residential address 'depuis le' (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/459)
|
||||||
|
* [Documents]: List view adapted to display more information (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/414)
|
||||||
|
|
||||||
|
## Test releases
|
||||||
|
|
||||||
|
### test release 2021-02-01
|
||||||
|
|
||||||
* renommer "dossier numéro" en "parcours numéro" dans les résultats de recherche
|
* renommer "dossier numéro" en "parcours numéro" dans les résultats de recherche
|
||||||
* renomme date de début en date d'ouverture dans le formulaire parcours
|
* renomme date de début en date d'ouverture dans le formulaire parcours
|
||||||
@ -25,7 +48,7 @@ and this project adheres to
|
|||||||
* [parcours]: validation + message for closing parcours adjusted.
|
* [parcours]: validation + message for closing parcours adjusted.
|
||||||
* [household]: household composition double edit button replaced by a delete action (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/426)
|
* [household]: household composition double edit button replaced by a delete action (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/426)
|
||||||
[fast_actions] improve fast-actions buttons override mechanism, fix https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/413
|
[fast_actions] improve fast-actions buttons override mechanism, fix https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/413
|
||||||
[homepage widget] add vue homepage_widget with asynchone loading, give a global view resume of the user concerned actions, notifications, etc.
|
[homepage widget] add vue homepage_widget with asynchone loading, give a global view resume of the user concerned actions, notifications, etc.
|
||||||
* [person]: Comment on marital status is possible even if marital status is not defined (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/421)
|
* [person]: Comment on marital status is possible even if marital status is not defined (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/421)
|
||||||
* [parcours]: In the list of person results the requestor is not displayed if defined as anonymous (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/424)
|
* [parcours]: In the list of person results the requestor is not displayed if defined as anonymous (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/424)
|
||||||
* [bugfix]: modal closes and newly created person/thirdparty is selected when multiple persons/thirdparties are created through the modal (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/429)
|
* [bugfix]: modal closes and newly created person/thirdparty is selected when multiple persons/thirdparties are created through the modal (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/429)
|
||||||
@ -33,11 +56,15 @@ and this project adheres to
|
|||||||
* [workflow][notification] improve how notifications and workflows are 'attached' to entities: contextual list, counter, buttons and vue modal
|
* [workflow][notification] improve how notifications and workflows are 'attached' to entities: contextual list, counter, buttons and vue modal
|
||||||
* [AddAddress] disable multiselect search, and rely only on most pertinent Cities and Street computed backend
|
* [AddAddress] disable multiselect search, and rely only on most pertinent Cities and Street computed backend
|
||||||
* [fast_actions] improve fast-actions buttons override mechanism, fix https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/413
|
* [fast_actions] improve fast-actions buttons override mechanism, fix https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/413
|
||||||
|
<<<<<<< HEAD
|
||||||
* [homepage widget] add vue homepage_widget with asynchone loading, give a global view resume of the user concerned actions, notifications, etc.
|
* [homepage widget] add vue homepage_widget with asynchone loading, give a global view resume of the user concerned actions, notifications, etc.
|
||||||
* [thirdparty] Add a contact to a thirdparty from within onTheFly (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/345)
|
* [thirdparty] Add a contact to a thirdparty from within onTheFly (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/345)
|
||||||
|
|
||||||
|
|
||||||
## Test releases
|
## Test releases
|
||||||
|
=======
|
||||||
|
* [homepage widget] add vue homepage_widget with asynchone loading, give a global view resume of the user concerned actions, notifications, etc.
|
||||||
|
>>>>>>> issue422_and_others_on_AddPersons
|
||||||
|
|
||||||
### test release 2021-01-31
|
### test release 2021-01-31
|
||||||
|
|
||||||
@ -86,7 +113,7 @@ and this project adheres to
|
|||||||
* [popover] add popover html popup mechanism (used by workflow breadcrumb)
|
* [popover] add popover html popup mechanism (used by workflow breadcrumb)
|
||||||
* [templates] improve updatedBy macro in item metadatas
|
* [templates] improve updatedBy macro in item metadatas
|
||||||
* [parcours]: bug fix when comment is pinned all other comments remain in the collection (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/385)
|
* [parcours]: bug fix when comment is pinned all other comments remain in the collection (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/385)
|
||||||
* [workflow]
|
* [workflow]
|
||||||
* add My workflow section with my opened subscriptions
|
* add My workflow section with my opened subscriptions
|
||||||
* apply workflow on documents, accompanyingCourseWork and Evaluations
|
* apply workflow on documents, accompanyingCourseWork and Evaluations
|
||||||
* [wopi-link] a new vue component allow to open wopi link in a fullscreen chill-themed modal
|
* [wopi-link] a new vue component allow to open wopi link in a fullscreen chill-themed modal
|
||||||
|
@ -408,24 +408,6 @@ parameters:
|
|||||||
count: 1
|
count: 1
|
||||||
path: src/Bundle/ChillCustomFieldsBundle/Form/CustomFieldsGroupType.php
|
path: src/Bundle/ChillCustomFieldsBundle/Form/CustomFieldsGroupType.php
|
||||||
|
|
||||||
-
|
|
||||||
message:
|
|
||||||
"""
|
|
||||||
#^Call to deprecated method getReachableScopes\\(\\) of class Chill\\\\MainBundle\\\\Security\\\\Authorization\\\\AuthorizationHelper\\:
|
|
||||||
Use getReachableCircles$#
|
|
||||||
"""
|
|
||||||
count: 1
|
|
||||||
path: src/Bundle/ChillDocStoreBundle/Controller/DocumentPersonController.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message:
|
|
||||||
"""
|
|
||||||
#^Parameter \\$translator of method Chill\\\\DocStoreBundle\\\\Controller\\\\DocumentPersonController\\:\\:__construct\\(\\) has typehint with deprecated interface Symfony\\\\Component\\\\Translation\\\\TranslatorInterface\\:
|
|
||||||
since Symfony 4\\.2, use Symfony\\\\Contracts\\\\Translation\\\\TranslatorInterface instead$#
|
|
||||||
"""
|
|
||||||
count: 1
|
|
||||||
path: src/Bundle/ChillDocStoreBundle/Controller/DocumentPersonController.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message:
|
message:
|
||||||
"""
|
"""
|
||||||
@ -927,15 +909,6 @@ parameters:
|
|||||||
count: 1
|
count: 1
|
||||||
path: src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php
|
path: src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php
|
||||||
|
|
||||||
-
|
|
||||||
message:
|
|
||||||
"""
|
|
||||||
#^Parameter \\$trans of method Chill\\\\PersonBundle\\\\Controller\\\\AccompanyingCourseWorkController\\:\\:__construct\\(\\) has typehint with deprecated interface Symfony\\\\Component\\\\Translation\\\\TranslatorInterface\\:
|
|
||||||
since Symfony 4\\.2, use Symfony\\\\Contracts\\\\Translation\\\\TranslatorInterface instead$#
|
|
||||||
"""
|
|
||||||
count: 1
|
|
||||||
path: src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message:
|
message:
|
||||||
"""
|
"""
|
||||||
|
@ -19,14 +19,18 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<add-persons
|
<ul class="record_actions">
|
||||||
buttonTitle="activity.add_persons"
|
<li class="add-persons">
|
||||||
modalTitle="activity.add_persons"
|
<add-persons
|
||||||
v-bind:key="addPersons.key"
|
buttonTitle="activity.add_persons"
|
||||||
v-bind:options="addPersonsOptions"
|
modalTitle="activity.add_persons"
|
||||||
@addNewPersons="addNewPersons"
|
v-bind:key="addPersons.key"
|
||||||
ref="addPersons">
|
v-bind:options="addPersonsOptions"
|
||||||
</add-persons>
|
@addNewPersons="addNewPersons"
|
||||||
|
ref="addPersons">
|
||||||
|
</add-persons>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
</teleport>
|
</teleport>
|
||||||
</template>
|
</template>
|
||||||
|
@ -97,7 +97,6 @@ class CalendarType extends AbstractType
|
|||||||
return $res;
|
return $res;
|
||||||
},
|
},
|
||||||
static function (?string $dateAsString): DateTimeImmutable {
|
static function (?string $dateAsString): DateTimeImmutable {
|
||||||
|
|
||||||
return new DateTimeImmutable($dateAsString);
|
return new DateTimeImmutable($dateAsString);
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
|
@ -13,7 +13,9 @@ namespace Chill\DocStoreBundle\Controller;
|
|||||||
|
|
||||||
use Chill\DocStoreBundle\Entity\AccompanyingCourseDocument;
|
use Chill\DocStoreBundle\Entity\AccompanyingCourseDocument;
|
||||||
use Chill\DocStoreBundle\Form\AccompanyingCourseDocumentType;
|
use Chill\DocStoreBundle\Form\AccompanyingCourseDocumentType;
|
||||||
|
use Chill\DocStoreBundle\Repository\AccompanyingCourseDocumentRepository;
|
||||||
use Chill\DocStoreBundle\Security\Authorization\AccompanyingCourseDocumentVoter;
|
use Chill\DocStoreBundle\Security\Authorization\AccompanyingCourseDocumentVoter;
|
||||||
|
use Chill\MainBundle\Pagination\PaginatorFactory;
|
||||||
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
|
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
|
||||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||||
use DateTime;
|
use DateTime;
|
||||||
@ -29,20 +31,15 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
|||||||
*/
|
*/
|
||||||
class DocumentAccompanyingCourseController extends AbstractController
|
class DocumentAccompanyingCourseController extends AbstractController
|
||||||
{
|
{
|
||||||
/**
|
protected AuthorizationHelper $authorizationHelper;
|
||||||
* @var AuthorizationHelper
|
|
||||||
*/
|
|
||||||
protected $authorizationHelper;
|
|
||||||
|
|
||||||
/**
|
protected EventDispatcherInterface $eventDispatcher;
|
||||||
* @var EventDispatcherInterface
|
|
||||||
*/
|
|
||||||
protected $eventDispatcher;
|
|
||||||
|
|
||||||
/**
|
protected TranslatorInterface $translator;
|
||||||
* @var TranslatorInterface
|
|
||||||
*/
|
private AccompanyingCourseDocumentRepository $courseRepository;
|
||||||
protected $translator;
|
|
||||||
|
private PaginatorFactory $paginatorFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DocumentAccompanyingCourseController constructor.
|
* DocumentAccompanyingCourseController constructor.
|
||||||
@ -50,11 +47,15 @@ class DocumentAccompanyingCourseController extends AbstractController
|
|||||||
public function __construct(
|
public function __construct(
|
||||||
TranslatorInterface $translator,
|
TranslatorInterface $translator,
|
||||||
EventDispatcherInterface $eventDispatcher,
|
EventDispatcherInterface $eventDispatcher,
|
||||||
AuthorizationHelper $authorizationHelper
|
AuthorizationHelper $authorizationHelper,
|
||||||
|
PaginatorFactory $paginatorFactory,
|
||||||
|
AccompanyingCourseDocumentRepository $courseRepository
|
||||||
) {
|
) {
|
||||||
$this->translator = $translator;
|
$this->translator = $translator;
|
||||||
$this->eventDispatcher = $eventDispatcher;
|
$this->eventDispatcher = $eventDispatcher;
|
||||||
$this->authorizationHelper = $authorizationHelper;
|
$this->authorizationHelper = $authorizationHelper;
|
||||||
|
$this->paginatorFactory = $paginatorFactory;
|
||||||
|
$this->courseRepository = $courseRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -130,11 +131,15 @@ class DocumentAccompanyingCourseController extends AbstractController
|
|||||||
|
|
||||||
$this->denyAccessUnlessGranted(AccompanyingCourseDocumentVoter::SEE, $course);
|
$this->denyAccessUnlessGranted(AccompanyingCourseDocumentVoter::SEE, $course);
|
||||||
|
|
||||||
$documents = $em
|
$total = $this->courseRepository->countByCourse($course);
|
||||||
->getRepository('ChillDocStoreBundle:AccompanyingCourseDocument')
|
$pagination = $this->paginatorFactory->create($total);
|
||||||
|
|
||||||
|
$documents = $this->courseRepository
|
||||||
->findBy(
|
->findBy(
|
||||||
['course' => $course],
|
['course' => $course],
|
||||||
['date' => 'DESC']
|
['date' => 'DESC'],
|
||||||
|
$pagination->getItemsPerPage(),
|
||||||
|
$pagination->getCurrentPageFirstItemNumber()
|
||||||
);
|
);
|
||||||
|
|
||||||
return $this->render(
|
return $this->render(
|
||||||
@ -142,6 +147,7 @@ class DocumentAccompanyingCourseController extends AbstractController
|
|||||||
[
|
[
|
||||||
'documents' => $documents,
|
'documents' => $documents,
|
||||||
'accompanyingCourse' => $course,
|
'accompanyingCourse' => $course,
|
||||||
|
'pagination' => $pagination,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,8 @@ namespace Chill\DocStoreBundle\Controller;
|
|||||||
|
|
||||||
use Chill\DocStoreBundle\Entity\PersonDocument;
|
use Chill\DocStoreBundle\Entity\PersonDocument;
|
||||||
use Chill\DocStoreBundle\Form\PersonDocumentType;
|
use Chill\DocStoreBundle\Form\PersonDocumentType;
|
||||||
use Chill\DocStoreBundle\Security\Authorization\PersonDocumentVoter;
|
use Chill\DocStoreBundle\Repository\PersonDocumentACLAwareRepositoryInterface;
|
||||||
|
use Chill\MainBundle\Pagination\PaginatorFactory;
|
||||||
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
|
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
|
||||||
use Chill\PersonBundle\Entity\Person;
|
use Chill\PersonBundle\Entity\Person;
|
||||||
use Chill\PersonBundle\Privacy\PrivacyEvent;
|
use Chill\PersonBundle\Privacy\PrivacyEvent;
|
||||||
@ -24,7 +25,7 @@ use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
|||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\Routing\Annotation\Route;
|
use Symfony\Component\Routing\Annotation\Route;
|
||||||
use Symfony\Component\Translation\TranslatorInterface;
|
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class DocumentPersonController.
|
* Class DocumentPersonController.
|
||||||
@ -35,20 +36,15 @@ use Symfony\Component\Translation\TranslatorInterface;
|
|||||||
*/
|
*/
|
||||||
class DocumentPersonController extends AbstractController
|
class DocumentPersonController extends AbstractController
|
||||||
{
|
{
|
||||||
/**
|
protected AuthorizationHelper $authorizationHelper;
|
||||||
* @var AuthorizationHelper
|
|
||||||
*/
|
|
||||||
protected $authorizationHelper;
|
|
||||||
|
|
||||||
/**
|
protected EventDispatcherInterface $eventDispatcher;
|
||||||
* @var EventDispatcherInterface
|
|
||||||
*/
|
|
||||||
protected $eventDispatcher;
|
|
||||||
|
|
||||||
/**
|
protected TranslatorInterface $translator;
|
||||||
* @var TranslatorInterface
|
|
||||||
*/
|
private PaginatorFactory $paginatorFactory;
|
||||||
protected $translator;
|
|
||||||
|
private PersonDocumentACLAwareRepositoryInterface $personDocumentACLAwareRepository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DocumentPersonController constructor.
|
* DocumentPersonController constructor.
|
||||||
@ -56,11 +52,15 @@ class DocumentPersonController extends AbstractController
|
|||||||
public function __construct(
|
public function __construct(
|
||||||
TranslatorInterface $translator,
|
TranslatorInterface $translator,
|
||||||
EventDispatcherInterface $eventDispatcher,
|
EventDispatcherInterface $eventDispatcher,
|
||||||
AuthorizationHelper $authorizationHelper
|
AuthorizationHelper $authorizationHelper,
|
||||||
|
PaginatorFactory $paginatorFactory,
|
||||||
|
PersonDocumentACLAwareRepositoryInterface $personDocumentACLAwareRepository
|
||||||
) {
|
) {
|
||||||
$this->translator = $translator;
|
$this->translator = $translator;
|
||||||
$this->eventDispatcher = $eventDispatcher;
|
$this->eventDispatcher = $eventDispatcher;
|
||||||
$this->authorizationHelper = $authorizationHelper;
|
$this->authorizationHelper = $authorizationHelper;
|
||||||
|
$this->paginatorFactory = $paginatorFactory;
|
||||||
|
$this->personDocumentACLAwareRepository = $personDocumentACLAwareRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -156,19 +156,15 @@ class DocumentPersonController extends AbstractController
|
|||||||
|
|
||||||
$this->denyAccessUnlessGranted(PersonVoter::SEE, $person);
|
$this->denyAccessUnlessGranted(PersonVoter::SEE, $person);
|
||||||
|
|
||||||
$reachableScopes = $this->authorizationHelper
|
$total = $this->personDocumentACLAwareRepository->countByPerson($person);
|
||||||
->getReachableScopes(
|
$pagination = $this->paginatorFactory->create($total);
|
||||||
$this->getUser(),
|
|
||||||
PersonDocumentVoter::SEE,
|
|
||||||
$person->getCenter()
|
|
||||||
);
|
|
||||||
|
|
||||||
$documents = $em
|
$documents = $this->personDocumentACLAwareRepository->findByPerson(
|
||||||
->getRepository('ChillDocStoreBundle:PersonDocument')
|
$person,
|
||||||
->findBy(
|
[],
|
||||||
['person' => $person, 'scope' => $reachableScopes],
|
$pagination->getItemsPerPage(),
|
||||||
['date' => 'DESC']
|
$pagination->getCurrentPageFirstItemNumber()
|
||||||
);
|
);
|
||||||
|
|
||||||
$event = new PrivacyEvent($person, [
|
$event = new PrivacyEvent($person, [
|
||||||
'element_class' => PersonDocument::class,
|
'element_class' => PersonDocument::class,
|
||||||
@ -181,6 +177,7 @@ class DocumentPersonController extends AbstractController
|
|||||||
[
|
[
|
||||||
'documents' => $documents,
|
'documents' => $documents,
|
||||||
'person' => $person,
|
'person' => $person,
|
||||||
|
'pagination' => $pagination,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -38,6 +38,7 @@ class ChillDocStoreExtension extends Extension implements PrependExtensionInterf
|
|||||||
$loader->load('services/menu.yaml');
|
$loader->load('services/menu.yaml');
|
||||||
$loader->load('services/fixtures.yaml');
|
$loader->load('services/fixtures.yaml');
|
||||||
$loader->load('services/form.yaml');
|
$loader->load('services/form.yaml');
|
||||||
|
$loader->load('services/templating.yaml');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function prepend(ContainerBuilder $container)
|
public function prepend(ContainerBuilder $container)
|
||||||
|
@ -11,7 +11,13 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Chill\DocStoreBundle\Entity;
|
namespace Chill\DocStoreBundle\Entity;
|
||||||
|
|
||||||
|
use Chill\DocGeneratorBundle\Entity\DocGeneratorTemplate;
|
||||||
|
use Chill\MainBundle\Doctrine\Model\TrackCreationInterface;
|
||||||
|
use Chill\MainBundle\Doctrine\Model\TrackCreationTrait;
|
||||||
|
use Chill\MainBundle\Doctrine\Model\TrackUpdateInterface;
|
||||||
|
use Chill\MainBundle\Doctrine\Model\TrackUpdateTrait;
|
||||||
use Chill\MainBundle\Entity\HasScopeInterface;
|
use Chill\MainBundle\Entity\HasScopeInterface;
|
||||||
|
use Chill\MainBundle\Entity\Scope;
|
||||||
use Chill\MainBundle\Entity\User;
|
use Chill\MainBundle\Entity\User;
|
||||||
use DateTimeInterface;
|
use DateTimeInterface;
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
@ -20,8 +26,12 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||||||
/**
|
/**
|
||||||
* @ORM\MappedSuperclass
|
* @ORM\MappedSuperclass
|
||||||
*/
|
*/
|
||||||
class Document implements HasScopeInterface
|
class Document implements HasScopeInterface, TrackCreationInterface, TrackUpdateInterface
|
||||||
{
|
{
|
||||||
|
use TrackCreationTrait;
|
||||||
|
|
||||||
|
use TrackUpdateTrait;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\ManyToOne(targetEntity="Chill\DocStoreBundle\Entity\DocumentCategory")
|
* @ORM\ManyToOne(targetEntity="Chill\DocStoreBundle\Entity\DocumentCategory")
|
||||||
* @ORM\JoinColumns({
|
* @ORM\JoinColumns({
|
||||||
@ -67,6 +77,11 @@ class Document implements HasScopeInterface
|
|||||||
*/
|
*/
|
||||||
private $scope;
|
private $scope;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\ManyToOne(targetEntity="Chill\DocGeneratorBundle\Entity\DocGeneratorTemplate")
|
||||||
|
*/
|
||||||
|
private $template;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Column(type="text")
|
* @ORM\Column(type="text")
|
||||||
* @Assert\Length(
|
* @Assert\Length(
|
||||||
@ -82,9 +97,6 @@ class Document implements HasScopeInterface
|
|||||||
*/
|
*/
|
||||||
private $user;
|
private $user;
|
||||||
|
|
||||||
/**
|
|
||||||
* @return DocumentCategory
|
|
||||||
*/
|
|
||||||
public function getCategory(): ?DocumentCategory
|
public function getCategory(): ?DocumentCategory
|
||||||
{
|
{
|
||||||
return $this->category;
|
return $this->category;
|
||||||
@ -115,11 +127,16 @@ class Document implements HasScopeInterface
|
|||||||
*
|
*
|
||||||
* @return \Chill\MainBundle\Entity\Scope
|
* @return \Chill\MainBundle\Entity\Scope
|
||||||
*/
|
*/
|
||||||
public function getScope()
|
public function getScope(): ?Scope
|
||||||
{
|
{
|
||||||
return $this->scope;
|
return $this->scope;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getTemplate(): ?DocGeneratorTemplate
|
||||||
|
{
|
||||||
|
return $this->template;
|
||||||
|
}
|
||||||
|
|
||||||
public function getTitle(): ?string
|
public function getTitle(): ?string
|
||||||
{
|
{
|
||||||
return $this->title;
|
return $this->title;
|
||||||
@ -165,6 +182,13 @@ class Document implements HasScopeInterface
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setTemplate(?DocGeneratorTemplate $template): self
|
||||||
|
{
|
||||||
|
$this->template = $template;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
public function setTitle(string $title): self
|
public function setTitle(string $title): self
|
||||||
{
|
{
|
||||||
$this->title = $title;
|
$this->title = $title;
|
||||||
|
@ -18,10 +18,12 @@ use Chill\MainBundle\Form\Type\ChillDateType;
|
|||||||
use Chill\MainBundle\Form\Type\ChillTextareaType;
|
use Chill\MainBundle\Form\Type\ChillTextareaType;
|
||||||
use Chill\MainBundle\Form\Type\ScopePickerType;
|
use Chill\MainBundle\Form\Type\ScopePickerType;
|
||||||
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
|
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
|
||||||
|
use Chill\MainBundle\Security\Resolver\ScopeResolverDispatcher;
|
||||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||||
use Doctrine\ORM\EntityRepository;
|
use Doctrine\ORM\EntityRepository;
|
||||||
use Doctrine\Persistence\ObjectManager;
|
use Doctrine\Persistence\ObjectManager;
|
||||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||||
|
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||||
use Symfony\Component\Form\AbstractType;
|
use Symfony\Component\Form\AbstractType;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
@ -51,14 +53,25 @@ class PersonDocumentType extends AbstractType
|
|||||||
*/
|
*/
|
||||||
protected $user;
|
protected $user;
|
||||||
|
|
||||||
|
private ParameterBagInterface $parameterBag;
|
||||||
|
|
||||||
|
private ScopeResolverDispatcher $scopeResolverDispatcher;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
TranslatableStringHelper $translatableStringHelper
|
TranslatableStringHelper $translatableStringHelper,
|
||||||
|
ScopeResolverDispatcher $scopeResolverDispatcher,
|
||||||
|
ParameterBagInterface $parameterBag
|
||||||
) {
|
) {
|
||||||
$this->translatableStringHelper = $translatableStringHelper;
|
$this->translatableStringHelper = $translatableStringHelper;
|
||||||
|
$this->scopeResolverDispatcher = $scopeResolverDispatcher;
|
||||||
|
$this->parameterBag = $parameterBag;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||||
{
|
{
|
||||||
|
$document = $options['data'];
|
||||||
|
$isScopeConcerned = $this->scopeResolverDispatcher->isConcerned($document);
|
||||||
|
|
||||||
$builder
|
$builder
|
||||||
->add('title', TextType::class)
|
->add('title', TextType::class)
|
||||||
->add('description', ChillTextareaType::class, [
|
->add('description', ChillTextareaType::class, [
|
||||||
@ -67,10 +80,6 @@ class PersonDocumentType extends AbstractType
|
|||||||
->add('object', StoredObjectType::class, [
|
->add('object', StoredObjectType::class, [
|
||||||
'error_bubbling' => true,
|
'error_bubbling' => true,
|
||||||
])
|
])
|
||||||
->add('scope', ScopePickerType::class, [
|
|
||||||
'center' => $options['center'],
|
|
||||||
'role' => $options['role'],
|
|
||||||
])
|
|
||||||
->add('date', ChillDateType::class)
|
->add('date', ChillDateType::class)
|
||||||
->add('category', EntityType::class, [
|
->add('category', EntityType::class, [
|
||||||
'placeholder' => 'Choose a document category',
|
'placeholder' => 'Choose a document category',
|
||||||
@ -84,6 +93,13 @@ class PersonDocumentType extends AbstractType
|
|||||||
return $entity ? $this->translatableStringHelper->localize($entity->getName()) : '';
|
return $entity ? $this->translatableStringHelper->localize($entity->getName()) : '';
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
if ($isScopeConcerned && $this->parameterBag->get('chill_main')['acl']['form_show_scopes']) {
|
||||||
|
$builder->add('scope', ScopePickerType::class, [
|
||||||
|
'center' => $options['center'],
|
||||||
|
'role' => $options['role'],
|
||||||
|
]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function configureOptions(OptionsResolver $resolver)
|
public function configureOptions(OptionsResolver $resolver)
|
||||||
|
@ -0,0 +1,75 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Chill is a software for social workers
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view
|
||||||
|
* the LICENSE file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Chill\DocStoreBundle\Repository;
|
||||||
|
|
||||||
|
use Chill\DocStoreBundle\Entity\AccompanyingCourseDocument;
|
||||||
|
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||||
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
use Doctrine\ORM\EntityRepository;
|
||||||
|
use Doctrine\ORM\QueryBuilder;
|
||||||
|
use Doctrine\Persistence\ObjectRepository;
|
||||||
|
|
||||||
|
class AccompanyingCourseDocumentRepository implements ObjectRepository
|
||||||
|
{
|
||||||
|
private EntityManagerInterface $em;
|
||||||
|
|
||||||
|
private EntityRepository $repository;
|
||||||
|
|
||||||
|
public function __construct(EntityManagerInterface $em)
|
||||||
|
{
|
||||||
|
$this->em = $em;
|
||||||
|
$this->repository = $em->getRepository(AccompanyingCourseDocument::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function buildQueryByCourse(AccompanyingPeriod $course): QueryBuilder
|
||||||
|
{
|
||||||
|
$qb = $this->repository->createQueryBuilder('d');
|
||||||
|
|
||||||
|
$qb
|
||||||
|
->where($qb->expr()->eq('d.course', ':course'))
|
||||||
|
->setParameter('course', $course);
|
||||||
|
|
||||||
|
return $qb;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function countByCourse(AccompanyingPeriod $course): int
|
||||||
|
{
|
||||||
|
$qb = $this->buildQueryByCourse($course)->select('COUNT(d)');
|
||||||
|
|
||||||
|
return $qb->getQuery()->getSingleScalarResult();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function find($id): ?AccompanyingCourseDocument
|
||||||
|
{
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
return $this->repository->findBy($criteria, $orderBy, $limit, $offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function findOneBy(array $criteria): ?AccompanyingCourseDocument
|
||||||
|
{
|
||||||
|
return $this->findOneBy($criteria);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getClassName()
|
||||||
|
{
|
||||||
|
return AccompanyingCourseDocument::class;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,90 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Chill is a software for social workers
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view
|
||||||
|
* the LICENSE file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Chill\DocStoreBundle\Repository;
|
||||||
|
|
||||||
|
use Chill\DocStoreBundle\Entity\PersonDocument;
|
||||||
|
use Chill\DocStoreBundle\Security\Authorization\PersonDocumentVoter;
|
||||||
|
use Chill\MainBundle\Security\Authorization\AuthorizationHelperInterface;
|
||||||
|
use Chill\MainBundle\Security\Resolver\CenterResolverDispatcher;
|
||||||
|
use Chill\PersonBundle\Entity\Person;
|
||||||
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
use Doctrine\ORM\QueryBuilder;
|
||||||
|
use Symfony\Component\Security\Core\Security;
|
||||||
|
|
||||||
|
class PersonDocumentACLAwareRepository implements PersonDocumentACLAwareRepositoryInterface
|
||||||
|
{
|
||||||
|
private AuthorizationHelperInterface $authorizationHelper;
|
||||||
|
|
||||||
|
private CenterResolverDispatcher $centerResolverDispatcher;
|
||||||
|
|
||||||
|
private EntityManagerInterface $em;
|
||||||
|
|
||||||
|
private Security $security;
|
||||||
|
|
||||||
|
public function __construct(EntityManagerInterface $em, AuthorizationHelperInterface $authorizationHelper, CenterResolverDispatcher $centerResolverDispatcher, Security $security)
|
||||||
|
{
|
||||||
|
$this->em = $em;
|
||||||
|
$this->authorizationHelper = $authorizationHelper;
|
||||||
|
$this->centerResolverDispatcher = $centerResolverDispatcher;
|
||||||
|
$this->security = $security;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function buildQueryByPerson(Person $person): QueryBuilder
|
||||||
|
{
|
||||||
|
$qb = $this->em->getRepository(PersonDocument::class)->createQueryBuilder('d');
|
||||||
|
|
||||||
|
$qb
|
||||||
|
->where($qb->expr()->eq('d.person', ':person'))
|
||||||
|
->setParameter('person', $person);
|
||||||
|
|
||||||
|
return $qb;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function countByPerson(Person $person): int
|
||||||
|
{
|
||||||
|
$qb = $this->buildQueryByPerson($person)->select('COUNT(d)');
|
||||||
|
|
||||||
|
$this->addACL($qb, $person);
|
||||||
|
|
||||||
|
return $qb->getQuery()->getSingleScalarResult();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function findByPerson(Person $person, array $orderBy = [], int $limit = 20, int $offset = 0): array
|
||||||
|
{
|
||||||
|
$qb = $this->buildQueryByPerson($person)->select('d');
|
||||||
|
|
||||||
|
$this->addACL($qb, $person);
|
||||||
|
|
||||||
|
foreach ($orderBy as [$field, $order]) {
|
||||||
|
$qb->addOrderBy($field, $order);
|
||||||
|
}
|
||||||
|
|
||||||
|
$qb->setFirstResult($offset)->setMaxResults($limit);
|
||||||
|
|
||||||
|
return $qb->getQuery()->getResult();
|
||||||
|
}
|
||||||
|
|
||||||
|
private function addACL(QueryBuilder $qb, Person $person): void
|
||||||
|
{
|
||||||
|
$center = $this->centerResolverDispatcher->resolveCenter($person);
|
||||||
|
|
||||||
|
$reachableScopes = $this->authorizationHelper
|
||||||
|
->getReachableScopes(
|
||||||
|
$this->security->getUser(),
|
||||||
|
PersonDocumentVoter::SEE,
|
||||||
|
$center
|
||||||
|
);
|
||||||
|
|
||||||
|
$qb->andWhere($qb->expr()->in('d.scope', ':scopes'))
|
||||||
|
->setParameter('scopes', $reachableScopes);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Chill is a software for social workers
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view
|
||||||
|
* the LICENSE file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Chill\DocStoreBundle\Repository;
|
||||||
|
|
||||||
|
use Chill\PersonBundle\Entity\Person;
|
||||||
|
|
||||||
|
interface PersonDocumentACLAwareRepositoryInterface
|
||||||
|
{
|
||||||
|
public function countByPerson(Person $person): int;
|
||||||
|
|
||||||
|
public function findByPerson(Person $person, array $orderBy = [], int $limit = 20, int $offset = 0): array;
|
||||||
|
}
|
@ -1,4 +1,5 @@
|
|||||||
{% import "@ChillDocStore/Macro/macro.html.twig" as m %}
|
{% import "@ChillDocStore/Macro/macro.html.twig" as m %}
|
||||||
|
{% import "@ChillDocStore/Macro/macro_mimeicon.html.twig" as mm %}
|
||||||
|
|
||||||
<div class="flex-table accompanying_course_work-list">
|
<div class="flex-table accompanying_course_work-list">
|
||||||
<div class="item-bloc document-item bg-chill-llight-gray">
|
<div class="item-bloc document-item bg-chill-llight-gray">
|
||||||
@ -9,8 +10,10 @@
|
|||||||
<div class="col-8">
|
<div class="col-8">
|
||||||
<h3>{{ document.title }}</h3>
|
<h3>{{ document.title }}</h3>
|
||||||
|
|
||||||
|
{{ mm.mimeIcon(document.object.type) }}
|
||||||
|
|
||||||
{% if document.description is not empty %}
|
{% if document.description is not empty %}
|
||||||
<blockquote class="chill-user-quote mt-2">
|
<blockquote class="chill-user-quote mt-4">
|
||||||
{{ document.description }}
|
{{ document.description }}
|
||||||
</blockquote>
|
</blockquote>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@ -42,26 +45,14 @@
|
|||||||
{{ m.download_button(document.object, document.title) }}
|
{{ m.download_button(document.object, document.title) }}
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
{% if not freezed %}
|
{% if chill_document_is_editable(document.object) %}
|
||||||
{% set button = {
|
{% if not freezed %}
|
||||||
'changeIcon': 'fa-unlock',
|
{{ document.object|chill_document_edit_button({'title': document.title|e('html') }) }}
|
||||||
} %}{#
|
{% else %}
|
||||||
'changeClass' string
|
<a class="btn btn-wopilink disabled" href="#" title="{{ 'workflow.freezed document'|trans }}">
|
||||||
'noText' boolean
|
{{ 'Update document'|trans }}
|
||||||
#}
|
</a>
|
||||||
{# vue component
|
{% endif %}
|
||||||
<span
|
|
||||||
data-module="wopi-link"
|
|
||||||
data-wopi-url="{{ path('chill_wopi_file_edit', {'fileId': document.object.uuid}) }}"
|
|
||||||
data-doc-title="{{ document.title|e('html_attr') }}"
|
|
||||||
data-doc-type="{{ document.object.type|e('html_attr') }}"
|
|
||||||
data-button="{{ button|json_encode }}"
|
|
||||||
></span> #}
|
|
||||||
<a class="btn btn-update" href="{{ chill_path_add_return_path('chill_wopi_file_edit', {'fileId': document.object.uuid}) }}">{{ 'Edit'|trans }}</a>
|
|
||||||
{% else %}
|
|
||||||
<a class="btn btn-update change-icon disabled" href="#" title="{{ 'workflow.freezed document'|trans }}">
|
|
||||||
<i class="fa fa-lock me-2"></i>{{ 'Update document'|trans }}
|
|
||||||
</a>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if is_granted('CHILL_ACCOMPANYING_COURSE_DOCUMENT_SEE', document) and document.course != null %}
|
{% if is_granted('CHILL_ACCOMPANYING_COURSE_DOCUMENT_SEE', document) and document.course != null %}
|
||||||
<li>
|
<li>
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
{{ form_row(form.description) }}
|
{{ form_row(form.description) }}
|
||||||
{{ form_row(form.object, { 'label': 'Document', 'existing': document.object }) }}
|
{{ form_row(form.object, { 'label': 'Document', 'existing': document.object }) }}
|
||||||
|
|
||||||
<ul class="record_actions">
|
<ul class="record_actions sticky-form-buttons">
|
||||||
<li class="cancel">
|
<li class="cancel">
|
||||||
<a href="{{ path('accompanying_course_document_index', {'course': accompanyingCourse.id}) }}" class="btn btn-cancel">
|
<a href="{{ path('accompanying_course_document_index', {'course': accompanyingCourse.id}) }}" class="btn btn-cancel">
|
||||||
{{ 'Back to the list' | trans }}
|
{{ 'Back to the list' | trans }}
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
{% set activeRouteKey = '' %}
|
{% set activeRouteKey = '' %}
|
||||||
|
|
||||||
{% import "@ChillDocStore/Macro/macro.html.twig" as m %}
|
|
||||||
|
|
||||||
{% block title %}
|
{% block title %}
|
||||||
{{ 'Documents' }}
|
{{ 'Documents' }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
@ -11,64 +9,35 @@
|
|||||||
{% block js %}
|
{% block js %}
|
||||||
{{ parent() }}
|
{{ parent() }}
|
||||||
{{ encore_entry_script_tags('mod_async_upload') }}
|
{{ encore_entry_script_tags('mod_async_upload') }}
|
||||||
{{ encore_entry_script_tags('mod_docgen_picktemplate') }}
|
{{ encore_entry_script_tags('mod_docgen_picktemplate') }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block css %}
|
{% block css %}
|
||||||
{{ parent() }}
|
{{ parent() }}
|
||||||
{{ encore_entry_link_tags('mod_async_upload') }}
|
{{ encore_entry_link_tags('mod_async_upload') }}
|
||||||
{{ encore_entry_link_tags('mod_docgen_picktemplate') }}
|
{{ encore_entry_link_tags('mod_docgen_picktemplate') }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
<div class="col-md-10 col-xxl">
|
||||||
<h1>{{ 'Documents' }}</h1>
|
<h1>{{ 'Documents' }}</h1>
|
||||||
|
|
||||||
<table class="table table-bordered border-dark table-striped">
|
{% if documents|length == 0 %}
|
||||||
|
<p class="chill-no-data-statement">{{ 'No documents'|trans }}</p>
|
||||||
<thead>
|
{% else %}
|
||||||
<tr>
|
<div class="flex-table chill-task-list">
|
||||||
<th>{{ 'Title' | trans }}</th>
|
|
||||||
<th>{{ 'Category'|trans }}</th>
|
|
||||||
<th>{{ 'Actions' | trans }}</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
{% for document in documents %}
|
{% for document in documents %}
|
||||||
<tr>
|
{% include 'ChillDocStoreBundle:List:list_item.html.twig' %}
|
||||||
<td>{{ document.title }}</td>
|
|
||||||
<td>{% if document.category %}{{ document.category.name|localize_translatable_string }}{% endif %}</td>
|
|
||||||
<td>
|
|
||||||
<ul class="record_actions">
|
|
||||||
{% if is_granted('CHILL_ACCOMPANYING_COURSE_DOCUMENT_SEE_DETAILS', document) %}
|
|
||||||
<li>
|
|
||||||
{{ m.download_button(document.object, document.title) }}
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href="{{ chill_path_add_return_path('accompanying_course_document_show', {'course': accompanyingCourse.id, 'id': document.id}) }}" class="btn btn-show"></a>
|
|
||||||
</li>
|
|
||||||
{% endif %}
|
|
||||||
{% if is_granted('CHILL_ACCOMPANYING_COURSE_DOCUMENT_UPDATE', document) %}
|
|
||||||
<li>
|
|
||||||
<a href="{{ path('accompanying_course_document_edit', {'course': accompanyingCourse.id, 'id': document.id }) }}" class="btn btn-update"></a>
|
|
||||||
</li>
|
|
||||||
{% endif %}
|
|
||||||
</ul>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
{% else %}
|
|
||||||
<tr>
|
|
||||||
<td colspan="9" style="text-align:center;">
|
|
||||||
<span class="chill-no-data-statement">{{ 'Any document found'|trans }}</span>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</div>
|
||||||
</table>
|
{% endif %}
|
||||||
|
|
||||||
<div data-docgen-template-picker="data-docgen-template-picker" data-entity-class="Chill\PersonBundle\Entity\AccompanyingPeriod" data-entity-id="{{ accompanyingCourse.id }}"></div>
|
{{ chill_pagination(pagination) }}
|
||||||
|
|
||||||
|
<div data-docgen-template-picker="data-docgen-template-picker" data-entity-class="Chill\PersonBundle\Entity\AccompanyingPeriod" data-entity-id="{{ accompanyingCourse.id }}"></div>
|
||||||
|
|
||||||
{% if is_granted('CHILL_ACCOMPANYING_COURSE_DOCUMENT_CREATE', accompanyingCourse) %}
|
{% if is_granted('CHILL_ACCOMPANYING_COURSE_DOCUMENT_CREATE', accompanyingCourse) %}
|
||||||
<ul class="record_actions">
|
<ul class="record_actions sticky-form-buttons">
|
||||||
<li class="create">
|
<li class="create">
|
||||||
<a href="{{ path('accompanying_course_document_new', {'course': accompanyingCourse.id}) }}" class="btn btn-create">
|
<a href="{{ path('accompanying_course_document_new', {'course': accompanyingCourse.id}) }}" class="btn btn-create">
|
||||||
{{ 'Create'|trans }}
|
{{ 'Create'|trans }}
|
||||||
@ -76,4 +45,6 @@
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
{% set activeRouteKey = '' %}
|
{% set activeRouteKey = '' %}
|
||||||
|
|
||||||
{% import "@ChillDocStore/Macro/macro.html.twig" as m %}
|
{% import "@ChillDocStore/Macro/macro.html.twig" as m %}
|
||||||
|
{% import "@ChillDocStore/Macro/macro_mimeicon.html.twig" as mm %}
|
||||||
|
|
||||||
{% block title %}
|
{% block title %}
|
||||||
{# {{ 'Detail of document of %name%'|trans({ '%name%': accompanyingCourse|chill_entity_render_string } ) }} #}
|
{# {{ 'Detail of document of %name%'|trans({ '%name%': accompanyingCourse|chill_entity_render_string } ) }} #}
|
||||||
@ -18,16 +19,18 @@
|
|||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="document-show">
|
<div class="document-show">
|
||||||
<h1>{{ block('title') }}</h1>
|
<h1>{{ block('title') }}</h1>
|
||||||
|
|
||||||
<dl class="chill_view_data">
|
{{ mm.mimeIcon(document.object.type) }}
|
||||||
|
|
||||||
|
<dl class="chill_view_data mt-4">
|
||||||
<dt>{{ 'Title'|trans }}</dt>
|
<dt>{{ 'Title'|trans }}</dt>
|
||||||
<dd>{{ document.title }}</dd>
|
<dd>{{ document.title }}</dd>
|
||||||
|
|
||||||
{% if document.category is not null %}
|
{% if document.category is not null %}
|
||||||
<dt>{{ 'Category'|trans }}</dt>
|
<dt>{{ 'Category'|trans }}</dt>
|
||||||
<dd>{{ document.category.name|localize_translatable_string }}</dd>
|
<dd>{{ document.category.name|localize_translatable_string }}</dd>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<dt>{{ 'Description' | trans }}</dt>
|
<dt>{{ 'Description' | trans }}</dt>
|
||||||
<dd>
|
<dd>
|
||||||
{% if document.description is empty %}
|
{% if document.description is empty %}
|
||||||
@ -39,7 +42,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
<ul class="record_actions sticky-form-buttons">
|
<ul class="record_actions sticky-form-buttons">
|
||||||
<li class="cancel">
|
<li class="cancel">
|
||||||
<a href="{{ path('accompanying_course_document_index', {'course': accompanyingCourse.id}) }}" class="btn btn-cancel">
|
<a href="{{ path('accompanying_course_document_index', {'course': accompanyingCourse.id}) }}" class="btn btn-cancel">
|
||||||
@ -49,11 +52,15 @@
|
|||||||
<li>
|
<li>
|
||||||
{{ m.download_button(document.object, document.title) }}
|
{{ m.download_button(document.object, document.title) }}
|
||||||
</li>
|
</li>
|
||||||
|
{% if chill_document_is_editable(document.object) %}
|
||||||
|
<li>
|
||||||
|
{{ document.object|chill_document_edit_button }}
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
{% if is_granted('CHILL_ACCOMPANYING_COURSE_DOCUMENT_UPDATE', document) %}
|
{% if is_granted('CHILL_ACCOMPANYING_COURSE_DOCUMENT_UPDATE', document) %}
|
||||||
<li>
|
<li>
|
||||||
<a href="{{ path('accompanying_course_document_edit', {'id': document.id, 'course': accompanyingCourse.id}) }}" class="btn btn-edit">
|
<a href="{{ path('accompanying_course_document_edit', {'id': document.id, 'course': accompanyingCourse.id}) }}"
|
||||||
{{ 'Edit' | trans }}
|
class="btn btn-edit" title="{{ 'Edit attributes' | trans }}"></a>
|
||||||
</a>
|
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% set workflows_frame = chill_entity_workflow_list('Chill\\DocStoreBundle\\Entity\\AccompanyingCourseDocument', document.id) %}
|
{% set workflows_frame = chill_entity_workflow_list('Chill\\DocStoreBundle\\Entity\\AccompanyingCourseDocument', document.id) %}
|
||||||
@ -65,7 +72,7 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block block_post_menu %}
|
{% block block_post_menu %}
|
||||||
<div class="post-menu pt-4"></div>
|
<div class="post-menu pt-4"></div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
@ -74,4 +81,4 @@
|
|||||||
{{ parent() }}
|
{{ parent() }}
|
||||||
{{ encore_entry_script_tags('mod_async_upload') }}
|
{{ encore_entry_script_tags('mod_async_upload') }}
|
||||||
{{ encore_entry_script_tags('mod_entity_workflow_pick') }}
|
{{ encore_entry_script_tags('mod_entity_workflow_pick') }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -0,0 +1,9 @@
|
|||||||
|
|
||||||
|
{# Twig way
|
||||||
|
TODO: une route, un template avec un header CHILL et un iframe
|
||||||
|
#}
|
||||||
|
<a href="{{ chill_path_add_return_path('chill_wopi_file_edit', {'fileId': document.uuid}) }}"
|
||||||
|
class="btn btn-wopilink">
|
||||||
|
{{ 'online_edit_document'|trans }}
|
||||||
|
</a>
|
||||||
|
|
@ -0,0 +1,83 @@
|
|||||||
|
{% import "@ChillDocStore/Macro/macro.html.twig" as m %}
|
||||||
|
{% import "@ChillDocStore/Macro/macro_mimeicon.html.twig" as mm %}
|
||||||
|
<div class="item-bloc">
|
||||||
|
<div class="item-row">
|
||||||
|
<div class="item-col">
|
||||||
|
<div class="denomination h2">
|
||||||
|
{{ document.title }}
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
{{ mm.mimeIcon(document.object.type) }}
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<p>{{ document.category.name|localize_translatable_string }}</p>
|
||||||
|
</div>
|
||||||
|
{% if document.template is not null %}
|
||||||
|
<div>
|
||||||
|
<p>{{ document.template.name.fr }}</p>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="item-col">
|
||||||
|
<div class="container">
|
||||||
|
{% if document.date is not null %}
|
||||||
|
<div class="dates row" style="float: right;">
|
||||||
|
<span>{{ document.createdAt|format_date('short') }}</span>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% if document.description is not empty %}
|
||||||
|
<div class="item-row separator">
|
||||||
|
<blockquote class="chill-user-quote">
|
||||||
|
{{ document.description|chill_markdown_to_html }}
|
||||||
|
</blockquote>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
<div class="item-row separator">
|
||||||
|
<div class="item-col item-meta">
|
||||||
|
<div class="updatedBy">
|
||||||
|
{{ 'Created by'|trans }}:
|
||||||
|
<span class="user">{{ document.createdBy|chill_entity_render_string }}</span>
|
||||||
|
<span class="date">le {{ document.createdAt|format_date('long') }}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
{% if document.course is defined %}
|
||||||
|
<ul class="record_actions">
|
||||||
|
{% if is_granted('CHILL_ACCOMPANYING_COURSE_DOCUMENT_SEE_DETAILS', document) %}
|
||||||
|
<li>
|
||||||
|
{{ m.download_button(document.object, document.title) }}
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="{{ chill_path_add_return_path('accompanying_course_document_show', {'course': accompanyingCourse.id, 'id': document.id}) }}" class="btn btn-show"></a>
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
{% if is_granted('CHILL_ACCOMPANYING_COURSE_DOCUMENT_UPDATE', document) %}
|
||||||
|
<li>
|
||||||
|
<a href="{{ path('accompanying_course_document_edit', {'course': accompanyingCourse.id, 'id': document.id }) }}" class="btn btn-update"></a>
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
</ul>
|
||||||
|
{% else %}
|
||||||
|
<ul class="record_actions">
|
||||||
|
{% if is_granted('CHILL_PERSON_DOCUMENT_SEE_DETAILS', document) %}
|
||||||
|
<li>
|
||||||
|
{{ m.download_button(document.object, document.title) }}
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="{{ path('person_document_show', {'person': person.id, 'id': document.id}) }}" class="btn btn-show"></a>
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
{% if is_granted('CHILL_PERSON_DOCUMENT_UPDATE', document) %}
|
||||||
|
<li>
|
||||||
|
<a href="{{ path('person_document_edit', {'person': person.id, 'id': document.id}) }}" class="btn btn-update"></a>
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
</ul>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
</div>
|
@ -0,0 +1,55 @@
|
|||||||
|
{% macro mimeIcon(type) %}
|
||||||
|
|
||||||
|
{# mapping
|
||||||
|
forkawesome and mime type https://gist.github.com/colemanw/9c9a12aae16a4bfe2678de86b661d922
|
||||||
|
#}
|
||||||
|
{% set mapmime = {
|
||||||
|
'image': 'fa-file-image-o',
|
||||||
|
'audio': 'fa-file-audio-o',
|
||||||
|
'video': 'fa-file-video-o',
|
||||||
|
'application/pdf': 'fa-file-pdf-o',
|
||||||
|
'application/msword': 'fa-file-word-o',
|
||||||
|
'application/vnd.ms-word': 'fa-file-word-o',
|
||||||
|
'application/vnd.oasis.opendocument.text': 'fa-file-word-o',
|
||||||
|
'application/vnd.openxmlformats-officedocument.wordprocessingml': 'fa-file-word-o',
|
||||||
|
'application/vnd.ms-excel': 'fa-file-excel-o',
|
||||||
|
'application/vnd.openxmlformats-officedocument.spreadsheetml': 'fa-file-excel-o',
|
||||||
|
'application/vnd.oasis.opendocument.spreadsheet': 'fa-file-excel-o',
|
||||||
|
'application/vnd.ms-powerpoint': 'fa-file-powerpoint-o',
|
||||||
|
'application/vnd.openxmlformats-officedocument.presentationml': 'fa-file-powerpoint-o',
|
||||||
|
'application/vnd.oasis.opendocument.presentation': 'fa-file-powerpoint-o',
|
||||||
|
'text/plain': 'fa-file-text-o',
|
||||||
|
'text/html': 'fa-file-code-o',
|
||||||
|
'application/json': 'fa-file-code-o',
|
||||||
|
'application/gzip': 'fa-file-archive-o',
|
||||||
|
'application/zip': 'fa-file-archive-o',
|
||||||
|
} %}
|
||||||
|
|
||||||
|
{% set icon = 'fa-file-o' %}
|
||||||
|
{% for key,val in mapmime %}
|
||||||
|
{% if type starts with key %}
|
||||||
|
{% set icon = val %}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
{# TODO improve mapping
|
||||||
|
mime type and friendly name https://gist.github.com/rosskmurphy/3724501
|
||||||
|
#}
|
||||||
|
{% set maptype = {
|
||||||
|
'fa-file-word-o': 'office document/texte',
|
||||||
|
'fa-file-excel-o': 'office document/tableur',
|
||||||
|
'fa-file-powerpoint-o': 'office document/presentation',
|
||||||
|
} %}
|
||||||
|
|
||||||
|
{% set label = type %}
|
||||||
|
{% for key, val in maptype %}
|
||||||
|
{% if icon == key %}
|
||||||
|
{% set label = val %}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
<div class="metadata">
|
||||||
|
<i class="fa {{ icon }} fa-lg me-1"></i>
|
||||||
|
{{ label|capitalize }}
|
||||||
|
</div>
|
||||||
|
{% endmacro %}
|
@ -30,7 +30,9 @@
|
|||||||
{{ form_row(form.title) }}
|
{{ form_row(form.title) }}
|
||||||
{{ form_row(form.date) }}
|
{{ form_row(form.date) }}
|
||||||
{{ form_row(form.category) }}
|
{{ form_row(form.category) }}
|
||||||
{{ form_row(form.scope) }}
|
{% if form.scope is defined %}
|
||||||
|
{{ form_row(form.scope) }}
|
||||||
|
{% endif %}
|
||||||
{{ form_row(form.description) }}
|
{{ form_row(form.description) }}
|
||||||
{{ form_row(form.object, { 'label': 'Document', 'existing': document.object }) }}
|
{{ form_row(form.object, { 'label': 'Document', 'existing': document.object }) }}
|
||||||
|
|
||||||
|
@ -30,54 +30,24 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block personcontent %}
|
{% block personcontent %}
|
||||||
|
|
||||||
|
<div class="col-md-10 col-xxl">
|
||||||
<h1>{{ 'Documents for %name%'|trans({ '%name%': person|chill_entity_render_string } ) }}</h1>
|
<h1>{{ 'Documents for %name%'|trans({ '%name%': person|chill_entity_render_string } ) }}</h1>
|
||||||
|
|
||||||
<table class="table table-bordered border-dark table-striped">
|
{% if documents|length == 0 %}
|
||||||
|
<p class="chill-no-data-statement">{{ 'No documents'|trans }}</p>
|
||||||
<thead>
|
{% else %}
|
||||||
<tr>
|
<div class="flex-table chill-task-list">
|
||||||
<th>{{ 'Title' | trans }}</th>
|
|
||||||
<th>{{ 'Category'|trans }}</th>
|
|
||||||
<th>{{ 'Circle' | trans }}</th>
|
|
||||||
<th>{{ 'Actions' | trans }}</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
{% for document in documents %}
|
{% for document in documents %}
|
||||||
<tr>
|
{% include 'ChillDocStoreBundle:List:list_item.html.twig' %}
|
||||||
<td>{{ document.title }}</td>
|
|
||||||
<td>{{ document.category.name|localize_translatable_string }}</td>
|
|
||||||
<td>{{ document.scope.name|localize_translatable_string }}</td>
|
|
||||||
<td>
|
|
||||||
<ul class="record_actions">
|
|
||||||
{% if is_granted('CHILL_PERSON_DOCUMENT_SEE_DETAILS', document) %}
|
|
||||||
<li>
|
|
||||||
{{ m.download_button(document.object, document.title) }}
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href="{{ path('person_document_show', {'person': person.id, 'id': document.id}) }}" class="btn btn-show"></a>
|
|
||||||
</li>
|
|
||||||
{% endif %}
|
|
||||||
{% if is_granted('CHILL_PERSON_DOCUMENT_UPDATE', document) %}
|
|
||||||
<li>
|
|
||||||
<a href="{{ path('person_document_edit', {'person': person.id, 'id': document.id}) }}" class="btn btn-update"></a>
|
|
||||||
</li>
|
|
||||||
{% endif %}
|
|
||||||
</ul>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
{% else %}
|
|
||||||
<tr>
|
|
||||||
<td colspan="9" style="text-align:center;">
|
|
||||||
<span class="chill-no-data-statement">{{ 'Any document found'|trans }}</span>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</div>
|
||||||
</table>
|
{% endif %}
|
||||||
|
|
||||||
|
{{ chill_pagination(pagination) }}
|
||||||
|
|
||||||
{% if is_granted('CHILL_PERSON_DOCUMENT_CREATE', person) %}
|
{% if is_granted('CHILL_PERSON_DOCUMENT_CREATE', person) %}
|
||||||
<ul class="record_actions">
|
<ul class="record_actions sticky-form-buttons">
|
||||||
<li class="create">
|
<li class="create">
|
||||||
<a href="{{ path('person_document_new', {'person': person.id}) }}" class="btn btn-create">
|
<a href="{{ path('person_document_new', {'person': person.id}) }}" class="btn btn-create">
|
||||||
{{ 'Create new document' | trans }}
|
{{ 'Create new document' | trans }}
|
||||||
@ -85,4 +55,6 @@
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
{% set activeRouteKey = '' %}
|
{% set activeRouteKey = '' %}
|
||||||
|
|
||||||
{% import "@ChillDocStore/Macro/macro.html.twig" as m %}
|
{% import "@ChillDocStore/Macro/macro.html.twig" as m %}
|
||||||
|
{% import "@ChillDocStore/Macro/macro_mimeicon.html.twig" as mm %}
|
||||||
|
|
||||||
{% block title %}{{ 'Detail of document of %name%'|trans({ '%name%': person|chill_entity_render_string } ) }}{% endblock %}
|
{% block title %}{{ 'Detail of document of %name%'|trans({ '%name%': person|chill_entity_render_string } ) }}{% endblock %}
|
||||||
|
|
||||||
@ -29,12 +30,16 @@
|
|||||||
{% block personcontent %}
|
{% block personcontent %}
|
||||||
<h1>{{ 'Document %title%' | trans({ '%title%': document.title }) }}</h1>
|
<h1>{{ 'Document %title%' | trans({ '%title%': document.title }) }}</h1>
|
||||||
|
|
||||||
|
{{ mm.mimeIcon(document.object.type) }}
|
||||||
|
|
||||||
<dl class="chill_view_data">
|
<dl class="chill_view_data">
|
||||||
<dt>{{ 'Title'|trans }}</dt>
|
<dt>{{ 'Title'|trans }}</dt>
|
||||||
<dd>{{ document.title }}</dd>
|
<dd>{{ document.title }}</dd>
|
||||||
|
|
||||||
|
{% if document.scope is not null %}
|
||||||
<dt>{{ 'Scope' | trans }}</dt>
|
<dt>{{ 'Scope' | trans }}</dt>
|
||||||
<dd>{{ document.scope.name | localize_translatable_string }}</dd>
|
<dd>{{ document.scope.name | localize_translatable_string }}</dd>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<dt>{{ 'Category'|trans }}</dt>
|
<dt>{{ 'Category'|trans }}</dt>
|
||||||
<dd>{{ document.category.name|localize_translatable_string }}</dd>
|
<dd>{{ document.category.name|localize_translatable_string }}</dd>
|
||||||
@ -52,7 +57,7 @@
|
|||||||
|
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
<ul class="record_actions">
|
<ul class="record_actions sticky-form-buttons">
|
||||||
<li class="cancel">
|
<li class="cancel">
|
||||||
<a href="{{ path('person_document_index', {'person': person.id}) }}" class="btn btn-cancel">
|
<a href="{{ path('person_document_index', {'person': person.id}) }}" class="btn btn-cancel">
|
||||||
{{ 'Back to the list' | trans }}
|
{{ 'Back to the list' | trans }}
|
||||||
@ -63,6 +68,12 @@
|
|||||||
{{ m.download_button(document.object, document.title) }}
|
{{ m.download_button(document.object, document.title) }}
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
{% if chill_document_is_editable(document.object) %}
|
||||||
|
<li>
|
||||||
|
{{ document.object|chill_document_edit_button }}
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% if is_granted('CHILL_PERSON_DOCUMENT_UPDATE', document) %}
|
{% if is_granted('CHILL_PERSON_DOCUMENT_UPDATE', document) %}
|
||||||
<li>
|
<li>
|
||||||
<a href="{{ path('person_document_edit', {'id': document.id, 'person': person.id}) }}" class="btn btn-edit">
|
<a href="{{ path('person_document_edit', {'id': document.id, 'person': person.id}) }}" class="btn btn-edit">
|
||||||
|
@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Chill is a software for social workers
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view
|
||||||
|
* the LICENSE file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Chill\DocStoreBundle\Templating;
|
||||||
|
|
||||||
|
use Twig\Extension\AbstractExtension;
|
||||||
|
use Twig\TwigFilter;
|
||||||
|
use Twig\TwigFunction;
|
||||||
|
|
||||||
|
class WopiEditTwigExtension extends AbstractExtension
|
||||||
|
{
|
||||||
|
public function getFilters(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
new TwigFilter('chill_document_edit_button', [WopiEditTwigExtensionRuntime::class, 'renderEditButton'], [
|
||||||
|
'needs_environment' => true,
|
||||||
|
'is_safe' => ['html'],
|
||||||
|
]),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getFunctions(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
new TwigFunction('chill_document_is_editable', [WopiEditTwigExtensionRuntime::class, 'isEditable']),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,55 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Chill is a software for social workers
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view
|
||||||
|
* the LICENSE file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Chill\DocStoreBundle\Templating;
|
||||||
|
|
||||||
|
use ChampsLibres\WopiLib\Contract\Service\Discovery\DiscoveryInterface;
|
||||||
|
use Chill\DocStoreBundle\Entity\StoredObject;
|
||||||
|
use Twig\Environment;
|
||||||
|
use Twig\Extension\RuntimeExtensionInterface;
|
||||||
|
use function array_key_exists;
|
||||||
|
|
||||||
|
class WopiEditTwigExtensionRuntime implements RuntimeExtensionInterface
|
||||||
|
{
|
||||||
|
public const TEMPLATE = '@ChillDocStore/Button/wopi_edit_document.html.twig';
|
||||||
|
|
||||||
|
private DiscoveryInterface $discovery;
|
||||||
|
|
||||||
|
public function __construct(DiscoveryInterface $discovery)
|
||||||
|
{
|
||||||
|
$this->discovery = $discovery;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isEditable(StoredObject $document): bool
|
||||||
|
{
|
||||||
|
$mime_type = $this->discovery->discoverMimeType($document->getType());
|
||||||
|
|
||||||
|
if ([] === $mime_type) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($mime_type as $item) {
|
||||||
|
if (array_key_exists('default', $item) && 'true' === $item['default']) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function renderEditButton(Environment $environment, StoredObject $document, ?array $options = null): string
|
||||||
|
{
|
||||||
|
return $environment->render(self::TEMPLATE, [
|
||||||
|
'document' => $document,
|
||||||
|
'options' => $options,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
@ -6,7 +6,6 @@ services:
|
|||||||
autowire: true
|
autowire: true
|
||||||
autoconfigure: true
|
autoconfigure: true
|
||||||
resource: "../Repository/"
|
resource: "../Repository/"
|
||||||
tags: ["doctrine.repository_service"]
|
|
||||||
|
|
||||||
Chill\DocStoreBundle\Form\DocumentCategoryType:
|
Chill\DocStoreBundle\Form\DocumentCategoryType:
|
||||||
class: Chill\DocStoreBundle\Form\DocumentCategoryType
|
class: Chill\DocStoreBundle\Form\DocumentCategoryType
|
||||||
@ -16,8 +15,10 @@ services:
|
|||||||
|
|
||||||
Chill\DocStoreBundle\Form\PersonDocumentType:
|
Chill\DocStoreBundle\Form\PersonDocumentType:
|
||||||
class: Chill\DocStoreBundle\Form\PersonDocumentType
|
class: Chill\DocStoreBundle\Form\PersonDocumentType
|
||||||
arguments:
|
autowire: true
|
||||||
- "@chill.main.helper.translatable_string"
|
autoconfigure: true
|
||||||
|
# arguments:
|
||||||
|
# - "@chill.main.helper.translatable_string"
|
||||||
tags:
|
tags:
|
||||||
- { name: form.type, alias: chill_docstorebundle_form_document }
|
- { name: form.type, alias: chill_docstorebundle_form_document }
|
||||||
|
|
||||||
|
@ -0,0 +1,6 @@
|
|||||||
|
services:
|
||||||
|
|
||||||
|
Chill\DocStoreBundle\Templating\:
|
||||||
|
resource: ../../Templating
|
||||||
|
autoconfigure: true
|
||||||
|
autowire: true
|
@ -0,0 +1,76 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Chill is a software for social workers
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view
|
||||||
|
* the LICENSE file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Chill\Migrations\DocStore;
|
||||||
|
|
||||||
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
|
use Doctrine\Migrations\AbstractMigration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implementations of create and update traits for Document entity + template property added.
|
||||||
|
*/
|
||||||
|
final class Version20220131093117 extends AbstractMigration
|
||||||
|
{
|
||||||
|
public function down(Schema $schema): void
|
||||||
|
{
|
||||||
|
$this->addSql('ALTER TABLE chill_doc.person_document DROP CONSTRAINT FK_41DA53C5DA0FB8');
|
||||||
|
$this->addSql('ALTER TABLE chill_doc.person_document DROP CONSTRAINT FK_41DA53C3174800F');
|
||||||
|
$this->addSql('ALTER TABLE chill_doc.person_document DROP CONSTRAINT FK_41DA53C65FF1AEC');
|
||||||
|
$this->addSql('ALTER TABLE chill_doc.person_document DROP template_id');
|
||||||
|
$this->addSql('ALTER TABLE chill_doc.person_document DROP createdAt');
|
||||||
|
$this->addSql('ALTER TABLE chill_doc.person_document DROP updatedAt');
|
||||||
|
$this->addSql('ALTER TABLE chill_doc.person_document DROP createdBy_id');
|
||||||
|
$this->addSql('ALTER TABLE chill_doc.person_document DROP updatedBy_id');
|
||||||
|
$this->addSql('ALTER TABLE chill_doc.accompanyingcourse_document DROP CONSTRAINT FK_A45098F65DA0FB8');
|
||||||
|
$this->addSql('ALTER TABLE chill_doc.accompanyingcourse_document DROP CONSTRAINT FK_A45098F63174800F');
|
||||||
|
$this->addSql('ALTER TABLE chill_doc.accompanyingcourse_document DROP CONSTRAINT FK_A45098F665FF1AEC');
|
||||||
|
$this->addSql('ALTER TABLE chill_doc.accompanyingcourse_document DROP template_id');
|
||||||
|
$this->addSql('ALTER TABLE chill_doc.accompanyingcourse_document DROP createdAt');
|
||||||
|
$this->addSql('ALTER TABLE chill_doc.accompanyingcourse_document DROP updatedAt');
|
||||||
|
$this->addSql('ALTER TABLE chill_doc.accompanyingcourse_document DROP createdBy_id');
|
||||||
|
$this->addSql('ALTER TABLE chill_doc.accompanyingcourse_document DROP updatedBy_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDescription(): string
|
||||||
|
{
|
||||||
|
return 'Implementations of create and update traits for Document entity + template property added';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function up(Schema $schema): void
|
||||||
|
{
|
||||||
|
$this->addSql('ALTER TABLE chill_doc.accompanyingcourse_document ADD template_id INT DEFAULT NULL');
|
||||||
|
$this->addSql('ALTER TABLE chill_doc.accompanyingcourse_document ADD createdAt TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL');
|
||||||
|
$this->addSql('ALTER TABLE chill_doc.accompanyingcourse_document ADD updatedAt TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL');
|
||||||
|
$this->addSql('ALTER TABLE chill_doc.accompanyingcourse_document ADD createdBy_id INT DEFAULT NULL');
|
||||||
|
$this->addSql('ALTER TABLE chill_doc.accompanyingcourse_document ADD updatedBy_id INT DEFAULT NULL');
|
||||||
|
$this->addSql('COMMENT ON COLUMN chill_doc.accompanyingcourse_document.createdAt IS \'(DC2Type:datetime_immutable)\'');
|
||||||
|
$this->addSql('COMMENT ON COLUMN chill_doc.accompanyingcourse_document.updatedAt IS \'(DC2Type:datetime_immutable)\'');
|
||||||
|
$this->addSql('ALTER TABLE chill_doc.accompanyingcourse_document ADD CONSTRAINT FK_A45098F65DA0FB8 FOREIGN KEY (template_id) REFERENCES chill_docgen_template (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||||
|
$this->addSql('ALTER TABLE chill_doc.accompanyingcourse_document ADD CONSTRAINT FK_A45098F63174800F FOREIGN KEY (createdBy_id) REFERENCES users (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||||
|
$this->addSql('ALTER TABLE chill_doc.accompanyingcourse_document ADD CONSTRAINT FK_A45098F665FF1AEC FOREIGN KEY (updatedBy_id) REFERENCES users (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||||
|
$this->addSql('CREATE INDEX IDX_A45098F65DA0FB8 ON chill_doc.accompanyingcourse_document (template_id)');
|
||||||
|
$this->addSql('CREATE INDEX IDX_A45098F63174800F ON chill_doc.accompanyingcourse_document (createdBy_id)');
|
||||||
|
$this->addSql('CREATE INDEX IDX_A45098F665FF1AEC ON chill_doc.accompanyingcourse_document (updatedBy_id)');
|
||||||
|
$this->addSql('ALTER TABLE chill_doc.person_document ADD template_id INT DEFAULT NULL');
|
||||||
|
$this->addSql('ALTER TABLE chill_doc.person_document ADD createdAt TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL');
|
||||||
|
$this->addSql('ALTER TABLE chill_doc.person_document ADD updatedAt TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL');
|
||||||
|
$this->addSql('ALTER TABLE chill_doc.person_document ADD createdBy_id INT DEFAULT NULL');
|
||||||
|
$this->addSql('ALTER TABLE chill_doc.person_document ADD updatedBy_id INT DEFAULT NULL');
|
||||||
|
$this->addSql('COMMENT ON COLUMN chill_doc.person_document.createdAt IS \'(DC2Type:datetime_immutable)\'');
|
||||||
|
$this->addSql('COMMENT ON COLUMN chill_doc.person_document.updatedAt IS \'(DC2Type:datetime_immutable)\'');
|
||||||
|
$this->addSql('ALTER TABLE chill_doc.person_document ADD CONSTRAINT FK_41DA53C5DA0FB8 FOREIGN KEY (template_id) REFERENCES chill_docgen_template (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||||
|
$this->addSql('ALTER TABLE chill_doc.person_document ADD CONSTRAINT FK_41DA53C3174800F FOREIGN KEY (createdBy_id) REFERENCES users (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||||
|
$this->addSql('ALTER TABLE chill_doc.person_document ADD CONSTRAINT FK_41DA53C65FF1AEC FOREIGN KEY (updatedBy_id) REFERENCES users (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||||
|
$this->addSql('CREATE INDEX IDX_41DA53C5DA0FB8 ON chill_doc.person_document (template_id)');
|
||||||
|
$this->addSql('CREATE INDEX IDX_41DA53C3174800F ON chill_doc.person_document (createdBy_id)');
|
||||||
|
$this->addSql('CREATE INDEX IDX_41DA53C65FF1AEC ON chill_doc.person_document (updatedBy_id)');
|
||||||
|
}
|
||||||
|
}
|
@ -10,6 +10,7 @@ New document for %name%: Nouveau document pour %name%
|
|||||||
Editing document for %name%: Modification d'un document pour %name%
|
Editing document for %name%: Modification d'un document pour %name%
|
||||||
Edit Document: Modification d'un document
|
Edit Document: Modification d'un document
|
||||||
Update document: Modifier le document
|
Update document: Modifier le document
|
||||||
|
Edit attributes: Modifier les propriétés du document
|
||||||
Existing document: Document existant
|
Existing document: Document existant
|
||||||
No document to download: Aucun document à télécharger
|
No document to download: Aucun document à télécharger
|
||||||
'Choose a document category': Choisissez une catégorie de document
|
'Choose a document category': Choisissez une catégorie de document
|
||||||
@ -51,4 +52,7 @@ Id inside bundle: Identifiant
|
|||||||
Document class: Classe de document
|
Document class: Classe de document
|
||||||
no records found:
|
no records found:
|
||||||
Create new category: Créer une nouvelle catégorie
|
Create new category: Créer une nouvelle catégorie
|
||||||
Back to the category list: Retour à la liste
|
Back to the category list: Retour à la liste
|
||||||
|
|
||||||
|
# WOPI EDIT
|
||||||
|
online_edit_document: Éditer en ligne
|
||||||
|
@ -12,6 +12,8 @@ declare(strict_types=1);
|
|||||||
namespace Chill\MainBundle\Controller;
|
namespace Chill\MainBundle\Controller;
|
||||||
|
|
||||||
use Chill\MainBundle\CRUD\Controller\ApiController;
|
use Chill\MainBundle\CRUD\Controller\ApiController;
|
||||||
|
use Chill\MainBundle\Pagination\PaginatorInterface;
|
||||||
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -19,7 +21,7 @@ use Symfony\Component\HttpFoundation\Request;
|
|||||||
*/
|
*/
|
||||||
class LocationApiController extends ApiController
|
class LocationApiController extends ApiController
|
||||||
{
|
{
|
||||||
public function customizeQuery(string $action, Request $request, $query): void
|
protected function customizeQuery(string $action, Request $request, $query): void
|
||||||
{
|
{
|
||||||
$query
|
$query
|
||||||
->leftJoin('e.locationType', 'lt')
|
->leftJoin('e.locationType', 'lt')
|
||||||
@ -31,4 +33,14 @@ class LocationApiController extends ApiController
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param QueryBuilder $query
|
||||||
|
* @param mixed $_format
|
||||||
|
*/
|
||||||
|
protected function orderQuery(string $action, $query, Request $request, PaginatorInterface $paginator, $_format)
|
||||||
|
{
|
||||||
|
return $query
|
||||||
|
->addOrderBy('e.name', 'ASC');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -236,6 +236,10 @@ class NotificationController extends AbstractController
|
|||||||
'_fragment' => 'comment-' . $commentId,
|
'_fragment' => 'comment-' . $commentId,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($editedCommentForm->isSubmitted() && !$editedCommentForm->isValid()) {
|
||||||
|
$this->addFlash('error', $this->translator->trans('This form contains errors'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -257,6 +261,10 @@ class NotificationController extends AbstractController
|
|||||||
'id' => $notification->getId(),
|
'id' => $notification->getId(),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($appendCommentForm->isSubmitted() && !$appendCommentForm->isValid()) {
|
||||||
|
$this->addFlash('error', $this->translator->trans('This form contains errors'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,6 +167,7 @@ class WorkflowController extends AbstractController
|
|||||||
|
|
||||||
$handler = $this->entityWorkflowManager->getHandler($entityWorkflow);
|
$handler = $this->entityWorkflowManager->getHandler($entityWorkflow);
|
||||||
$workflow = $this->registry->get($entityWorkflow, $entityWorkflow->getWorkflowName());
|
$workflow = $this->registry->get($entityWorkflow, $entityWorkflow->getWorkflowName());
|
||||||
|
$errors = [];
|
||||||
|
|
||||||
if (count($workflow->getEnabledTransitions($entityWorkflow)) > 0) {
|
if (count($workflow->getEnabledTransitions($entityWorkflow)) > 0) {
|
||||||
// possible transition
|
// possible transition
|
||||||
@ -245,7 +246,7 @@ class WorkflowController extends AbstractController
|
|||||||
'handler_template_data' => $handler->getTemplateData($entityWorkflow),
|
'handler_template_data' => $handler->getTemplateData($entityWorkflow),
|
||||||
'transition_form' => isset($transitionForm) ? $transitionForm->createView() : null,
|
'transition_form' => isset($transitionForm) ? $transitionForm->createView() : null,
|
||||||
'entity_workflow' => $entityWorkflow,
|
'entity_workflow' => $entityWorkflow,
|
||||||
'transition_form_errors' => $errors ?? [],
|
'transition_form_errors' => $errors,
|
||||||
//'comment_form' => $commentForm->createView(),
|
//'comment_form' => $commentForm->createView(),
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
@ -18,6 +18,7 @@ use DateTimeInterface;
|
|||||||
use Doctrine\ORM\Event\LifecycleEventArgs;
|
use Doctrine\ORM\Event\LifecycleEventArgs;
|
||||||
use Doctrine\ORM\Event\PreFlushEventArgs;
|
use Doctrine\ORM\Event\PreFlushEventArgs;
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
use Symfony\Component\Validator\Constraints as Assert;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Entity
|
* @ORM\Entity
|
||||||
@ -28,6 +29,7 @@ class NotificationComment implements TrackCreationInterface, TrackUpdateInterfac
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @ORM\Column(type="text")
|
* @ORM\Column(type="text")
|
||||||
|
* @Assert\NotBlank(message="notification.Comment content might not be blank")
|
||||||
*/
|
*/
|
||||||
private string $content = '';
|
private string $content = '';
|
||||||
|
|
||||||
@ -136,9 +138,9 @@ class NotificationComment implements TrackCreationInterface, TrackUpdateInterfac
|
|||||||
$this->recentlyPersisted = true;
|
$this->recentlyPersisted = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setContent(string $content): self
|
public function setContent(?string $content): self
|
||||||
{
|
{
|
||||||
$this->content = $content;
|
$this->content = (string) $content;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
@ -135,6 +135,7 @@ class EntityWorkflow implements TrackCreationInterface, TrackUpdateInterface
|
|||||||
if (!$this->steps->contains($step)) {
|
if (!$this->steps->contains($step)) {
|
||||||
$this->steps[] = $step;
|
$this->steps[] = $step;
|
||||||
$step->setEntityWorkflow($this);
|
$step->setEntityWorkflow($this);
|
||||||
|
$this->stepsChainedCache = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
@ -332,32 +333,26 @@ class EntityWorkflow implements TrackCreationInterface, TrackUpdateInterface
|
|||||||
|
|
||||||
public function isFinal(): bool
|
public function isFinal(): bool
|
||||||
{
|
{
|
||||||
$steps = $this->getStepsChained();
|
foreach ($this->getStepsChained() as $step) {
|
||||||
|
if ($step->isFinal()) {
|
||||||
if (1 === count($steps)) {
|
return true;
|
||||||
// the initial step cannot be finalized
|
}
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @var EntityWorkflowStep $last */
|
return false;
|
||||||
$last = end($steps);
|
|
||||||
|
|
||||||
return $last->isFinal();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isFreeze(): bool
|
public function isFreeze(): bool
|
||||||
{
|
{
|
||||||
$steps = $this->getStepsChained();
|
$steps = $this->getStepsChained();
|
||||||
|
|
||||||
if (1 === count($steps)) {
|
foreach ($this->getStepsChained() as $step) {
|
||||||
// the initial step cannot be finalized
|
if ($step->isFreezeAfter()) {
|
||||||
return false;
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @var EntityWorkflowStep $last */
|
return false;
|
||||||
$last = end($steps);
|
|
||||||
|
|
||||||
return $last->getPrevious()->isFreezeAfter();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isUserSubscribedToFinal(User $user): bool
|
public function isUserSubscribedToFinal(User $user): bool
|
||||||
@ -434,7 +429,7 @@ class EntityWorkflow implements TrackCreationInterface, TrackUpdateInterface
|
|||||||
$newStep->setCurrentStep($step);
|
$newStep->setCurrentStep($step);
|
||||||
|
|
||||||
// copy the freeze
|
// copy the freeze
|
||||||
if ($this->getCurrentStep()->isFreezeAfter()) {
|
if ($this->isFreeze()) {
|
||||||
$newStep->setFreezeAfter(true);
|
$newStep->setFreezeAfter(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,11 +79,8 @@ class NotificationMailer
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$email = new Email();
|
|
||||||
$email
|
|
||||||
->subject($notification->getTitle());
|
|
||||||
|
|
||||||
if ($notification->isSystem()) {
|
if ($notification->isSystem()) {
|
||||||
|
$email = new Email();
|
||||||
$email
|
$email
|
||||||
->text($notification->getMessage());
|
->text($notification->getMessage());
|
||||||
} else {
|
} else {
|
||||||
@ -96,7 +93,9 @@ class NotificationMailer
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$email->to($addressee->getEmail());
|
$email
|
||||||
|
->subject($notification->getTitle())
|
||||||
|
->to($addressee->getEmail());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$this->mailer->send($email);
|
$this->mailer->send($email);
|
||||||
|
@ -56,7 +56,7 @@ class EntityWorkflowStepRepository implements ObjectRepository
|
|||||||
|
|
||||||
public function getClassName()
|
public function getClassName()
|
||||||
{
|
{
|
||||||
return EntityWorkflow::class;
|
return EntityWorkflowStep::class;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function buildQueryByUser(User $user): QueryBuilder
|
private function buildQueryByUser(User $user): QueryBuilder
|
||||||
|
@ -15,6 +15,7 @@ $chill-theme-buttons: (
|
|||||||
"action": $chill-orange,
|
"action": $chill-orange,
|
||||||
"edit": $chill-orange,
|
"edit": $chill-orange,
|
||||||
"update": $chill-orange,
|
"update": $chill-orange,
|
||||||
|
"wopilink": $chill-orange,
|
||||||
"show": $chill-blue,
|
"show": $chill-blue,
|
||||||
"view": $chill-blue,
|
"view": $chill-blue,
|
||||||
"misc": $gray-300,
|
"misc": $gray-300,
|
||||||
@ -54,6 +55,7 @@ $chill-theme-buttons: (
|
|||||||
&.btn-action,
|
&.btn-action,
|
||||||
&.btn-edit,
|
&.btn-edit,
|
||||||
&.btn-tpchild,
|
&.btn-tpchild,
|
||||||
|
&.btn-wopilink,
|
||||||
&.btn-update {
|
&.btn-update {
|
||||||
&, &:hover {
|
&, &:hover {
|
||||||
color: $light;
|
color: $light;
|
||||||
@ -66,6 +68,7 @@ $chill-theme-buttons: (
|
|||||||
&.btn-create::before,
|
&.btn-create::before,
|
||||||
&.btn-edit::before,
|
&.btn-edit::before,
|
||||||
&.btn-update::before,
|
&.btn-update::before,
|
||||||
|
&.btn-wopilink::before,
|
||||||
&.btn-show::before,
|
&.btn-show::before,
|
||||||
&.btn-view::before,
|
&.btn-view::before,
|
||||||
&.btn-save::before,
|
&.btn-save::before,
|
||||||
@ -98,6 +101,7 @@ $chill-theme-buttons: (
|
|||||||
&.btn-create::before { content: "\f067"; } // fa-plus
|
&.btn-create::before { content: "\f067"; } // fa-plus
|
||||||
&.btn-edit::before,
|
&.btn-edit::before,
|
||||||
&.btn-update::before { content: "\f040"; } // fa-pencil
|
&.btn-update::before { content: "\f040"; } // fa-pencil
|
||||||
|
&.btn-wopilink::before { content: "\f1dd"; } // fa-paragraph
|
||||||
&.btn-show::before,
|
&.btn-show::before,
|
||||||
&.btn-view::before { content: "\f06e"; } // fa-eye
|
&.btn-view::before { content: "\f06e"; } // fa-eye
|
||||||
&.btn-save::before { content: "\f0c7"; } // fa-floppy-o
|
&.btn-save::before { content: "\f0c7"; } // fa-floppy-o
|
||||||
|
@ -17,7 +17,12 @@ function loadDynamicPicker(element) {
|
|||||||
isMultiple = parseInt(el.dataset.multiple) === 1,
|
isMultiple = parseInt(el.dataset.multiple) === 1,
|
||||||
uniqId = el.dataset.uniqid,
|
uniqId = el.dataset.uniqid,
|
||||||
input = element.querySelector('[data-input-uniqid="'+ el.dataset.uniqid +'"]'),
|
input = element.querySelector('[data-input-uniqid="'+ el.dataset.uniqid +'"]'),
|
||||||
picked = (isMultiple) ? (JSON.parse(input.value)) : ((input.value === '[]') ? (null) : ([JSON.parse(input.value)]));
|
picked = isMultiple ?
|
||||||
|
JSON.parse(input.value) : (
|
||||||
|
(input.value === '[]' || input.value === '') ?
|
||||||
|
null : [ JSON.parse(input.value) ]
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
if (!isMultiple) {
|
if (!isMultiple) {
|
||||||
if (input.value === '[]'){
|
if (input.value === '[]'){
|
||||||
|
@ -4,20 +4,34 @@ import {_createI18n} from "ChillMainAssets/vuejs/_js/i18n";
|
|||||||
|
|
||||||
const i18n = _createI18n({});
|
const i18n = _createI18n({});
|
||||||
|
|
||||||
|
|
||||||
|
//TODO move to chillDocStore or ChillWopi
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
tags to load module:
|
||||||
|
|
||||||
|
<span data-module="wopi-link"
|
||||||
|
data-wopi-url="{{ path('chill_wopi_file_edit', {'fileId': document.uuid}) }}"
|
||||||
|
data-doc-type="{{ document.type|e('html_attr') }}"
|
||||||
|
data-options="{{ options|json_encode }}"
|
||||||
|
></span>
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
window.addEventListener('DOMContentLoaded', function (e) {
|
window.addEventListener('DOMContentLoaded', function (e) {
|
||||||
document.querySelectorAll('span[data-module="wopi-link"]')
|
document.querySelectorAll('span[data-module="wopi-link"]')
|
||||||
.forEach(function (el) {
|
.forEach(function (el) {
|
||||||
createApp({
|
createApp({
|
||||||
template: '<open-wopi-link :wopiUrl="wopiUrl" :title="title" :type="type" :button="button"></open-wopi-link>',
|
template: '<open-wopi-link :wopiUrl="wopiUrl" :type="type" :options="options"></open-wopi-link>',
|
||||||
components: {
|
components: {
|
||||||
OpenWopiLink
|
OpenWopiLink
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
wopiUrl: el.dataset.wopiUrl,
|
wopiUrl: el.dataset.wopiUrl,
|
||||||
title: el.dataset.docTitle,
|
|
||||||
type: el.dataset.docType,
|
type: el.dataset.docType,
|
||||||
button: el.dataset.button ? JSON.parse(el.dataset.button) : {}
|
options: el.dataset.options !== 'null' ? JSON.parse(el.dataset.options) : {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -26,4 +40,4 @@ window.addEventListener('DOMContentLoaded', function (e) {
|
|||||||
;
|
;
|
||||||
})
|
})
|
||||||
;
|
;
|
||||||
});
|
});
|
||||||
|
@ -260,8 +260,7 @@ export default {
|
|||||||
editPane: false,
|
editPane: false,
|
||||||
datePane: false,
|
datePane: false,
|
||||||
loading: false,
|
loading: false,
|
||||||
success: false,
|
success: false
|
||||||
dirty: false
|
|
||||||
},
|
},
|
||||||
errors: [],
|
errors: [],
|
||||||
defaultz: {
|
defaultz: {
|
||||||
@ -537,17 +536,19 @@ export default {
|
|||||||
|
|
||||||
checkErrors() {
|
checkErrors() {
|
||||||
this.errors = [];
|
this.errors = [];
|
||||||
if (this.flag.dirty) {
|
if (this.entity.selected.country === null) {
|
||||||
if (this.entity.selected.country === null) {
|
this.errors.push("Un pays doit être sélectionné.");
|
||||||
this.errors.push("Un pays doit être sélectionné.");
|
}
|
||||||
}
|
if (this.entity.selected.city === null) {
|
||||||
|
this.errors.push("Une ville doit être sélectionnée.");
|
||||||
|
} else {
|
||||||
if (Object.keys(this.entity.selected.city).length === 0) {
|
if (Object.keys(this.entity.selected.city).length === 0) {
|
||||||
this.errors.push("Une ville doit être sélectionnée.");
|
this.errors.push("Une ville doit être sélectionnée.");
|
||||||
}
|
}
|
||||||
if (!this.entity.selected.isNoAddress) {
|
}
|
||||||
if (this.entity.selected.address.street === null || this.entity.selected.address.streetNumber === null) {
|
if (!this.entity.selected.isNoAddress) {
|
||||||
this.errors.push("Une adresse doit être sélectionnée.");
|
if (this.entity.selected.address.street === null || this.entity.selected.address.street === '' || this.entity.selected.address.streetNumber === null || this.entity.selected.address.streetNumber === '') {
|
||||||
}
|
this.errors.push("Une adresse doit être sélectionnée.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -567,7 +568,7 @@ export default {
|
|||||||
|
|
||||||
this.entity.selected.country = this.context.edit ? this.entity.address.country : {};
|
this.entity.selected.country = this.context.edit ? this.entity.address.country : {};
|
||||||
this.entity.selected.postcode = this.context.edit ? this.entity.address.postcode : {};
|
this.entity.selected.postcode = this.context.edit ? this.entity.address.postcode : {};
|
||||||
this.entity.selected.city = {};
|
this.entity.selected.city = this.context.edit ? this.entity.address.postcode : {};
|
||||||
|
|
||||||
this.entity.selected.address = {};
|
this.entity.selected.address = {};
|
||||||
this.entity.selected.address.street = this.context.edit ? this.entity.address.street: null;
|
this.entity.selected.address.street = this.context.edit ? this.entity.address.street: null;
|
||||||
@ -583,6 +584,8 @@ export default {
|
|||||||
this.entity.selected.writeNew.address = this.context.edit && this.entity.address.addressReference === null && this.entity.address.street.length > 0
|
this.entity.selected.writeNew.address = this.context.edit && this.entity.address.addressReference === null && this.entity.address.street.length > 0
|
||||||
this.entity.selected.writeNew.postcode = false // NB: this used to be this.context.edit, but think it was erroneous;
|
this.entity.selected.writeNew.postcode = false // NB: this used to be this.context.edit, but think it was erroneous;
|
||||||
console.log('!! just set writeNew.postcode to', this.entity.selected.writeNew.postcode);
|
console.log('!! just set writeNew.postcode to', this.entity.selected.writeNew.postcode);
|
||||||
|
|
||||||
|
this.checkErrors();
|
||||||
},
|
},
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -111,11 +111,9 @@ export default {
|
|||||||
this.entity.selected.address.streetNumber = value.streetNumber;
|
this.entity.selected.address.streetNumber = value.streetNumber;
|
||||||
this.entity.selected.writeNew.address = false;
|
this.entity.selected.writeNew.address = false;
|
||||||
this.updateMapCenter(value.point);
|
this.updateMapCenter(value.point);
|
||||||
this.flag.dirty = true;
|
|
||||||
this.checkErrors();
|
this.checkErrors();
|
||||||
},
|
},
|
||||||
remove() {
|
remove() {
|
||||||
this.flag.dirty = true;
|
|
||||||
this.entity.selected.address = {};
|
this.entity.selected.address = {};
|
||||||
this.checkErrors();
|
this.checkErrors();
|
||||||
},
|
},
|
||||||
@ -158,7 +156,6 @@ export default {
|
|||||||
this.entity.selected.address.street = addr.street;
|
this.entity.selected.address.street = addr.street;
|
||||||
this.entity.selected.address.streetNumber = addr.number;
|
this.entity.selected.address.streetNumber = addr.number;
|
||||||
this.entity.selected.writeNew.address = true;
|
this.entity.selected.writeNew.address = true;
|
||||||
this.flag.dirty = true;
|
|
||||||
this.checkErrors();
|
this.checkErrors();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -125,11 +125,9 @@ export default {
|
|||||||
if (value.center) {
|
if (value.center) {
|
||||||
this.updateMapCenter(value.center);
|
this.updateMapCenter(value.center);
|
||||||
}
|
}
|
||||||
this.flag.dirty = true;
|
|
||||||
this.checkErrors();
|
this.checkErrors();
|
||||||
},
|
},
|
||||||
remove() {
|
remove() {
|
||||||
this.flag.dirty = true;
|
|
||||||
this.entity.selected.city = {};
|
this.entity.selected.city = {};
|
||||||
this.checkErrors();
|
this.checkErrors();
|
||||||
},
|
},
|
||||||
|
@ -51,7 +51,6 @@ export default {
|
|||||||
init() {
|
init() {
|
||||||
if (this.value !== undefined) {
|
if (this.value !== undefined) {
|
||||||
this.selectCountry(this.value);
|
this.selectCountry(this.value);
|
||||||
this.flag.dirty = false;
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
selectCountryByCode(countryCode) {
|
selectCountryByCode(countryCode) {
|
||||||
@ -67,7 +66,6 @@ export default {
|
|||||||
this.checkErrors();
|
this.checkErrors();
|
||||||
},
|
},
|
||||||
remove() {
|
remove() {
|
||||||
this.flag.dirty = true;
|
|
||||||
this.entity.selected.country = null;
|
this.entity.selected.country = null;
|
||||||
this.checkErrors();
|
this.checkErrors();
|
||||||
},
|
},
|
||||||
|
@ -157,6 +157,7 @@ export default {
|
|||||||
set(value) {
|
set(value) {
|
||||||
console.log('isNoAddress value', value);
|
console.log('isNoAddress value', value);
|
||||||
this.entity.selected.isNoAddress = value;
|
this.entity.selected.isNoAddress = value;
|
||||||
|
this.checkErrors();
|
||||||
},
|
},
|
||||||
get() {
|
get() {
|
||||||
return this.entity.selected.isNoAddress;
|
return this.entity.selected.isNoAddress;
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<span v-if="c.emergency" class="badge rounded-pill bg-danger">{{ $t('emergency') }}</span>
|
<span v-if="c.emergency" class="badge rounded-pill bg-danger me-1">{{ $t('emergency') }}</span>
|
||||||
<span v-if="c.confidential" class="badge rounded-pill bg-danger">{{ $t('confidential') }}</span>
|
<span v-if="c.confidential" class="badge rounded-pill bg-danger">{{ $t('confidential') }}</span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
@ -80,5 +80,7 @@ export default {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
span.badge.rounded-pill.bg-danger {
|
||||||
|
text-transform: uppercase;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
@ -50,7 +50,9 @@ const appMessages = {
|
|||||||
assignated_evaluations: "{n} évaluation assignée | {n} évaluations assignées",
|
assignated_evaluations: "{n} évaluation assignée | {n} évaluations assignées",
|
||||||
alert_tasks: "{n} tâche en rappel | {n} tâches en rappel",
|
alert_tasks: "{n} tâche en rappel | {n} tâches en rappel",
|
||||||
warning_tasks: "{n} tâche à échéance | {n} tâches à échéance",
|
warning_tasks: "{n} tâche à échéance | {n} tâches à échéance",
|
||||||
}
|
},
|
||||||
|
emergency: "Urgent",
|
||||||
|
confidential: "Confidentiel",
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<ul class="nav nav-tabs">
|
<ul class="nav nav-tabs">
|
||||||
<li class="nav-item">
|
<li v-if="allowedTypes.includes('person')" class="nav-item">
|
||||||
<a class="nav-link" :class="{ active: isActive('person') }">
|
<a class="nav-link" :class="{ active: isActive('person') }">
|
||||||
<label for="person">
|
<label for="person">
|
||||||
<input type="radio" name="person" id="person" v-model="radioType" value="person">
|
<input type="radio" name="person" id="person" v-model="radioType" value="person">
|
||||||
@ -8,7 +8,7 @@
|
|||||||
</label>
|
</label>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li v-if="allowedTypes.includes('thirdparty')" class="nav-item">
|
||||||
<a class="nav-link" :class="{ active: isActive('thirdparty') }">
|
<a class="nav-link" :class="{ active: isActive('thirdparty') }">
|
||||||
<label for="thirdparty">
|
<label for="thirdparty">
|
||||||
<input type="radio" name="thirdparty" id="thirdparty" v-model="radioType" value="thirdparty">
|
<input type="radio" name="thirdparty" id="thirdparty" v-model="radioType" value="thirdparty">
|
||||||
@ -21,14 +21,16 @@
|
|||||||
<div class="my-4">
|
<div class="my-4">
|
||||||
<on-the-fly-person
|
<on-the-fly-person
|
||||||
v-if="type === 'person'"
|
v-if="type === 'person'"
|
||||||
v-bind:action="action"
|
:action="action"
|
||||||
|
:query="query"
|
||||||
ref="castPerson"
|
ref="castPerson"
|
||||||
>
|
>
|
||||||
</on-the-fly-person>
|
</on-the-fly-person>
|
||||||
|
|
||||||
<on-the-fly-thirdparty
|
<on-the-fly-thirdparty
|
||||||
v-if="type === 'thirdparty'"
|
v-if="type === 'thirdparty'"
|
||||||
v-bind:action="action"
|
:action="action"
|
||||||
|
:query="query"
|
||||||
ref="castThirdparty"
|
ref="castThirdparty"
|
||||||
>
|
>
|
||||||
</on-the-fly-thirdparty>
|
</on-the-fly-thirdparty>
|
||||||
@ -38,18 +40,17 @@
|
|||||||
<script>
|
<script>
|
||||||
import OnTheFlyPerson from 'ChillPersonAssets/vuejs/_components/OnTheFly/Person.vue';
|
import OnTheFlyPerson from 'ChillPersonAssets/vuejs/_components/OnTheFly/Person.vue';
|
||||||
import OnTheFlyThirdparty from 'ChillThirdPartyAssets/vuejs/_components/OnTheFly/ThirdParty.vue';
|
import OnTheFlyThirdparty from 'ChillThirdPartyAssets/vuejs/_components/OnTheFly/ThirdParty.vue';
|
||||||
import { postPerson } from "ChillPersonAssets/vuejs/_api/OnTheFly";
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "OnTheFlyCreate",
|
name: "OnTheFlyCreate",
|
||||||
props: ['action'],
|
props: ['action', 'allowedTypes', 'query'],
|
||||||
components: {
|
components: {
|
||||||
OnTheFlyPerson,
|
OnTheFlyPerson,
|
||||||
OnTheFlyThirdparty
|
OnTheFlyThirdparty
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
type: 'person' //by default
|
type: null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -61,7 +62,10 @@ export default {
|
|||||||
get() {
|
get() {
|
||||||
return this.type;
|
return this.type;
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.type = (this.allowedTypes.length === 1 && this.allowedTypes.includes('thirdparty')) ? 'thirdparty' : 'person'
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
isActive(tab) {
|
isActive(tab) {
|
||||||
|
@ -64,6 +64,8 @@
|
|||||||
<template v-slot:body v-else>
|
<template v-slot:body v-else>
|
||||||
<on-the-fly-create
|
<on-the-fly-create
|
||||||
:action="action"
|
:action="action"
|
||||||
|
:allowedTypes="allowedTypes"
|
||||||
|
:query="query"
|
||||||
ref="castNew">
|
ref="castNew">
|
||||||
</on-the-fly-create>
|
</on-the-fly-create>
|
||||||
</template>
|
</template>
|
||||||
@ -101,7 +103,7 @@ export default {
|
|||||||
OnTheFlyThirdparty,
|
OnTheFlyThirdparty,
|
||||||
OnTheFlyCreate
|
OnTheFlyCreate
|
||||||
},
|
},
|
||||||
props: ['type', 'id', 'action', 'buttonText', 'displayBadge', 'isDead', 'parent'],
|
props: ['type', 'id', 'action', 'buttonText', 'displayBadge', 'isDead', 'parent', 'allowedTypes', 'query'],
|
||||||
emits: ['saveFormOnTheFly'],
|
emits: ['saveFormOnTheFly'],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@ -144,6 +146,13 @@ export default {
|
|||||||
return 'action.addContact';
|
return 'action.addContact';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
titleCreate() {
|
||||||
|
return this.allowedTypes.every(t => t === 'person')
|
||||||
|
? 'onthefly.create.title.person'
|
||||||
|
: this.allowedTypes.every(t => t === 'thirdparty')
|
||||||
|
? 'onthefly.create.title.thirdparty'
|
||||||
|
: 'onthefly.create.title.default'
|
||||||
|
},
|
||||||
titleModal() {
|
titleModal() {
|
||||||
switch (this.action) {
|
switch (this.action) {
|
||||||
case 'show':
|
case 'show':
|
||||||
@ -151,7 +160,7 @@ export default {
|
|||||||
case 'edit':
|
case 'edit':
|
||||||
return 'onthefly.edit.' + this.type;
|
return 'onthefly.edit.' + this.type;
|
||||||
case 'create':
|
case 'create':
|
||||||
return 'onthefly.create.title';
|
return this.titleCreate;
|
||||||
case 'addContact':
|
case 'addContact':
|
||||||
return 'onthefly.addContact.title';
|
return 'onthefly.addContact.title';
|
||||||
}
|
}
|
||||||
@ -177,7 +186,10 @@ export default {
|
|||||||
},
|
},
|
||||||
badgeType() {
|
badgeType() {
|
||||||
return 'entity-' + this.type + ' badge-' + this.type;
|
return 'entity-' + this.type + ' badge-' + this.type;
|
||||||
}
|
},
|
||||||
|
getReturnPath() {
|
||||||
|
return `?returnPath=${window.location.pathname}${window.location.search}${window.location.hash}`;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
closeModal() {
|
closeModal() {
|
||||||
@ -243,9 +255,9 @@ export default {
|
|||||||
buildLocation(id, type) {
|
buildLocation(id, type) {
|
||||||
if (type === 'person') {
|
if (type === 'person') {
|
||||||
// TODO i18n
|
// TODO i18n
|
||||||
return `/fr/person/${id}/general`;
|
return encodeURI(`/fr/person/${id}/general${this.getReturnPath}`);
|
||||||
} else if (type === 'thirdparty') {
|
} else if (type === 'thirdparty') {
|
||||||
return `/fr/3party/3party/${id}/view`;
|
return encodeURI(`/fr/3party/3party/${id}/view${this.getReturnPath}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,11 +9,15 @@ const ontheflyMessages = {
|
|||||||
},
|
},
|
||||||
edit: {
|
edit: {
|
||||||
person: "Modifier un usager",
|
person: "Modifier un usager",
|
||||||
thirdparty: "Modifier un tiers"
|
thirdparty: "Modifier un tiers",
|
||||||
},
|
},
|
||||||
create: {
|
create: {
|
||||||
button: "Créer \"{q}\"",
|
button: "Créer \"{q}\"",
|
||||||
title: "Création d'un nouvel usager ou d'un tiers professionnel",
|
title: {
|
||||||
|
default: "Création d'un nouvel usager ou d'un tiers professionnel",
|
||||||
|
person: "Création d'un nouvel usager",
|
||||||
|
thirdparty: "Création d'un nouveau tiers professionnel",
|
||||||
|
},
|
||||||
person: "un nouvel usager",
|
person: "un nouvel usager",
|
||||||
thirdparty: "un nouveau tiers professionnel"
|
thirdparty: "un nouveau tiers professionnel"
|
||||||
},
|
},
|
||||||
|
@ -5,8 +5,8 @@
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<ul class="record_actions">
|
<ul class="record_actions">
|
||||||
<li>
|
<li class="add-persons">
|
||||||
<AddPersons
|
<add-persons
|
||||||
:options="addPersonsOptions"
|
:options="addPersonsOptions"
|
||||||
:key="uniqid"
|
:key="uniqid"
|
||||||
:buttonTitle="translatedListOfTypes"
|
:buttonTitle="translatedListOfTypes"
|
||||||
@ -14,7 +14,7 @@
|
|||||||
ref="addPersons"
|
ref="addPersons"
|
||||||
@addNewPersons="addNewEntity"
|
@addNewPersons="addNewEntity"
|
||||||
>
|
>
|
||||||
</AddPersons>
|
</add-persons>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</template>
|
</template>
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
import { personMessages } from 'ChillPersonAssets/vuejs/_js/i18n';
|
import { personMessages } from 'ChillPersonAssets/vuejs/_js/i18n';
|
||||||
|
import { thirdpartyMessages } from 'ChillThirdPartyAssets/vuejs/_js/i18n';
|
||||||
|
import { addressMessages } from 'ChillMainAssets/vuejs/Address/i18n';
|
||||||
|
import { ontheflyMessages } from 'ChillMainAssets/vuejs/OnTheFly/i18n';
|
||||||
|
|
||||||
const appMessages = {
|
const appMessages = {
|
||||||
fr: {
|
fr: {
|
||||||
@ -12,6 +15,6 @@ const appMessages = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Object.assign(appMessages.fr, personMessages.fr);
|
Object.assign(appMessages.fr, personMessages.fr, thirdpartyMessages.fr, addressMessages.fr, ontheflyMessages.fr );
|
||||||
|
|
||||||
export { appMessages };
|
export { appMessages };
|
||||||
|
@ -42,57 +42,11 @@
|
|||||||
class="street">
|
class="street">
|
||||||
{{ address.text }}
|
{{ address.text }}
|
||||||
</p>
|
</p>
|
||||||
<p v-if="address.postcode"
|
|
||||||
class="postcode">
|
|
||||||
{{ address.postcode.code }} {{ address.postcode.name }}
|
|
||||||
</p>
|
|
||||||
<p v-if="address.country"
|
|
||||||
class="country">
|
|
||||||
{{ address.country.name.fr }}
|
|
||||||
</p>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</component>
|
</component>
|
||||||
|
|
||||||
<!-- <div v-if="isMultiline === true" class="address-more">
|
|
||||||
<div v-if="address.floor">
|
|
||||||
<span class="floor">
|
|
||||||
<b>{{ $t('floor') }}</b>: {{ address.floor }}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div v-if="address.corridor">
|
|
||||||
<span class="corridor">
|
|
||||||
<b>{{ $t('corridor') }}</b>: {{ address.corridor }}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div v-if="address.steps">
|
|
||||||
<span class="steps">
|
|
||||||
<b>{{ $t('steps') }}</b>: {{ address.steps }}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div v-if="address.flat">
|
|
||||||
<span class="flat">
|
|
||||||
<b>{{ $t('flat') }}</b>: {{ address.flat }}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div v-if="address.buildingName">
|
|
||||||
<span class="buildingName">
|
|
||||||
<b>{{ $t('buildingName') }}</b>: {{ address.buildingName }}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div v-if="address.extra">
|
|
||||||
<span class="extra">
|
|
||||||
<b>{{ $t('extra') }}</b>: {{ address.extra }}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div v-if="address.distribution">
|
|
||||||
<span class="distribution">
|
|
||||||
<b>{{ $t('distribution') }}</b>: {{ address.distribution }}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div> -->
|
|
||||||
|
|
||||||
<div v-if="useDatePane === true" class="address-more">
|
<div v-if="useDatePane === true" class="address-more">
|
||||||
<div v-if="address.validFrom">
|
<div v-if="address.validFrom">
|
||||||
<span class="validFrom">
|
<span class="validFrom">
|
||||||
|
@ -1,12 +1,14 @@
|
|||||||
<template>
|
<template>
|
||||||
<a v-if="isOpenDocument"
|
<a v-if="isOpenDocument"
|
||||||
class="btn change-icon" :class="[isChangeClass ? button.changeClass : 'btn-edit']"
|
class="btn" :class="[
|
||||||
|
isChangeIcon ? 'change-icon' : '',
|
||||||
|
isChangeClass ? options.changeClass : 'btn-wopilink' ]"
|
||||||
@click="openModal">
|
@click="openModal">
|
||||||
|
|
||||||
<i class="fa me-2" :class="[isChangeIcon ? button.changeIcon : 'fa-pencil']"></i>
|
<i v-if="isChangeIcon" class="fa me-2" :class="options.changeIcon"></i>
|
||||||
|
|
||||||
<span v-if="!noText">
|
<span v-if="!noText">
|
||||||
{{ $t('Update_document') }}
|
{{ $t('online_edit_document') }}
|
||||||
</span>
|
</span>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
@ -20,12 +22,14 @@
|
|||||||
<template v-slot:header>
|
<template v-slot:header>
|
||||||
<img class="logo" :src="logo" height="45"/>
|
<img class="logo" :src="logo" height="45"/>
|
||||||
<span class="ms-auto me-3">
|
<span class="ms-auto me-3">
|
||||||
{{ this.title }}
|
<span v-if="options.title">{{ options.title }}</span>
|
||||||
</span>
|
</span>
|
||||||
|
<!--
|
||||||
<a class="btn btn-outline-light">
|
<a class="btn btn-outline-light">
|
||||||
<i class="fa fa-save fa-fw"></i>
|
<i class="fa fa-save fa-fw"></i>
|
||||||
{{ $t('save_and_quit') }}
|
{{ $t('save_and_quit') }}
|
||||||
</a>
|
</a>
|
||||||
|
-->
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template v-slot:body>
|
<template v-slot:body>
|
||||||
@ -71,15 +75,11 @@ export default {
|
|||||||
type: String,
|
type: String,
|
||||||
required: true
|
required: true
|
||||||
},
|
},
|
||||||
title: {
|
|
||||||
type: String,
|
|
||||||
required: true
|
|
||||||
},
|
|
||||||
type: {
|
type: {
|
||||||
type: String,
|
type: String,
|
||||||
required: true
|
required: true
|
||||||
},
|
},
|
||||||
button: {
|
options: {
|
||||||
type: Object,
|
type: Object,
|
||||||
required: false
|
required: false
|
||||||
}
|
}
|
||||||
@ -175,20 +175,20 @@ export default {
|
|||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
noText() {
|
noText() {
|
||||||
if (typeof this.button.noText !== 'undefined') {
|
if (typeof this.options.noText !== 'undefined') {
|
||||||
return this.button.noText === true;
|
return this.options.noText === true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
isChangeIcon() {
|
isChangeIcon() {
|
||||||
if (typeof this.button.changeIcon !== 'undefined') {
|
if (typeof this.options.changeIcon !== 'undefined') {
|
||||||
return (!(this.button.changeIcon === null || this.button.changeIcon === ''))
|
return (!(this.options.changeIcon === null || this.options.changeIcon === ''))
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
isChangeClass() {
|
isChangeClass() {
|
||||||
if (typeof this.button.changeClass !== 'undefined') {
|
if (typeof this.options.changeClass !== 'undefined') {
|
||||||
return (!(this.button.changeClass === null || this.button.changeClass === ''))
|
return (!(this.options.changeClass === null || this.options.changeClass === ''))
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -205,7 +205,7 @@ export default {
|
|||||||
i18n: {
|
i18n: {
|
||||||
messages: {
|
messages: {
|
||||||
fr: {
|
fr: {
|
||||||
Update_document: "Modifier le document",
|
online_edit_document: "Éditer en ligne",
|
||||||
save_and_quit: "Enregistrer et quitter",
|
save_and_quit: "Enregistrer et quitter",
|
||||||
loading: "Chargement de l'éditeur en ligne",
|
loading: "Chargement de l'éditeur en ligne",
|
||||||
invalid_title: "Format incompatible",
|
invalid_title: "Format incompatible",
|
||||||
|
@ -92,11 +92,11 @@ export const multiSelectMessages = {
|
|||||||
multiselect: {
|
multiselect: {
|
||||||
placeholder: 'Choisir',
|
placeholder: 'Choisir',
|
||||||
tag_placeholder: 'Créer un nouvel élément',
|
tag_placeholder: 'Créer un nouvel élément',
|
||||||
select_label: 'Appuyer sur "Entrée" pour sélectionner',
|
select_label: '"Entrée" ou cliquez pour sélectionner',
|
||||||
deselect_label: 'Appuyer sur "Entrée" pour désélectionner',
|
deselect_label: '"Entrée" ou cliquez pour désélectionner',
|
||||||
select_group_label: 'Appuyer sur "Entrée" pour sélectionner ce groupe',
|
select_group_label: 'Appuyer sur "Entrée" pour sélectionner ce groupe',
|
||||||
deselect_group_label: 'Appuyer sur "Entrée" pour désélectionner ce groupe',
|
deselect_group_label: 'Appuyer sur "Entrée" pour désélectionner ce groupe',
|
||||||
selected_label: 'Sélectionné'
|
selected_label: 'Sélectionné'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -15,11 +15,11 @@
|
|||||||
|
|
||||||
<div class="notification-comment-list my-5">
|
<div class="notification-comment-list my-5">
|
||||||
<h2 class="chill-blue">{{ 'notification.comments_list'|trans }}</h2>
|
<h2 class="chill-blue">{{ 'notification.comments_list'|trans }}</h2>
|
||||||
|
|
||||||
{% if notification.comments|length > 0 %}
|
{% if notification.comments|length > 0 %}
|
||||||
<div class="flex-table">
|
<div class="flex-table">
|
||||||
{% for comment in notification.comments %}
|
{% for comment in notification.comments %}
|
||||||
|
|
||||||
{% if editedCommentForm is null or editedCommentId != comment.id %}
|
{% if editedCommentForm is null or editedCommentId != comment.id %}
|
||||||
{{ m.show_comment(comment, {
|
{{ m.show_comment(comment, {
|
||||||
'recordAction': _self.recordAction(comment)
|
'recordAction': _self.recordAction(comment)
|
||||||
@ -28,10 +28,11 @@
|
|||||||
<div class="item-bloc">
|
<div class="item-bloc">
|
||||||
<div class="item-row row">
|
<div class="item-row row">
|
||||||
<a id="comment-{{ comment.id }}"></a>
|
<a id="comment-{{ comment.id }}"></a>
|
||||||
|
|
||||||
{{ form_start(editedCommentForm) }}
|
{{ form_start(editedCommentForm) }}
|
||||||
{{ form_errors(editedCommentForm) }}
|
{{ form_errors(editedCommentForm) }}
|
||||||
{{ form_widget(editedCommentForm.content) }}
|
{{ form_widget(editedCommentForm.content) }}
|
||||||
|
{{ form_errors(editedCommentForm.content) }}
|
||||||
<input type="hidden" name="form" value="edit" />
|
<input type="hidden" name="form" value="edit" />
|
||||||
<ul class="record_actions">
|
<ul class="record_actions">
|
||||||
<li class="cancel">
|
<li class="cancel">
|
||||||
@ -46,24 +47,25 @@
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
{{ form_end(editedCommentForm) }}
|
{{ form_end(editedCommentForm) }}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
{% else %}
|
{% else %}
|
||||||
<span class="chill-no-data-statement">{{ 'No comments'|trans }}</span>
|
<span class="chill-no-data-statement">{{ 'No comments'|trans }}</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if appendCommentForm is not null %}
|
{% if appendCommentForm is not null %}
|
||||||
<div class="new-comment my-5">
|
<div class="new-comment my-5">
|
||||||
<h2 class="chill-blue mb-4">{{ 'Write a new comment'|trans }}</h2>
|
<h2 class="chill-blue mb-4">{{ 'Write a new comment'|trans }}</h2>
|
||||||
|
|
||||||
{{ form_start(appendCommentForm) }}
|
{{ form_start(appendCommentForm) }}
|
||||||
{{ form_errors(appendCommentForm) }}
|
{{ form_errors(appendCommentForm) }}
|
||||||
{{ form_widget(appendCommentForm.content) }}
|
{{ form_widget(appendCommentForm.content) }}
|
||||||
|
{{ form_errors(appendCommentForm.content) }}
|
||||||
<input type="hidden" name="form" value="append" />
|
<input type="hidden" name="form" value="append" />
|
||||||
<ul class="record_actions">
|
<ul class="record_actions">
|
||||||
<li>
|
<li>
|
||||||
@ -71,7 +73,7 @@
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
{{ form_end(appendCommentForm) }}
|
{{ form_end(appendCommentForm) }}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
|
|
||||||
{% block js %}
|
{% block js %}
|
||||||
{{ parent() }}
|
{{ parent() }}
|
||||||
|
|
||||||
{{ encore_entry_script_tags('mod_async_upload') }}
|
{{ encore_entry_script_tags('mod_async_upload') }}
|
||||||
{{ encore_entry_script_tags('mod_pickentity_type') }}
|
{{ encore_entry_script_tags('mod_pickentity_type') }}
|
||||||
{{ encore_entry_script_tags('mod_entity_workflow_subscribe') }}
|
{{ encore_entry_script_tags('mod_entity_workflow_subscribe') }}
|
||||||
|
@ -64,7 +64,7 @@ class AddressNormalizer implements ContextAwareNormalizerInterface, NormalizerAw
|
|||||||
if ($address instanceof Address) {
|
if ($address instanceof Address) {
|
||||||
$data = [
|
$data = [
|
||||||
'address_id' => $address->getId(),
|
'address_id' => $address->getId(),
|
||||||
'text' => $address->isNoAddress() ? null : $this->addressRender->renderStreetLine($address, []),
|
'text' => $this->addressRender->renderString($address, []),
|
||||||
'street' => $address->getStreet(),
|
'street' => $address->getStreet(),
|
||||||
'streetNumber' => $address->getStreetNumber(),
|
'streetNumber' => $address->getStreetNumber(),
|
||||||
'postcode' => [
|
'postcode' => [
|
||||||
|
@ -12,6 +12,7 @@ declare(strict_types=1);
|
|||||||
namespace Chill\MainBundle\Serializer\Normalizer;
|
namespace Chill\MainBundle\Serializer\Normalizer;
|
||||||
|
|
||||||
use LogicException;
|
use LogicException;
|
||||||
|
use Symfony\Component\Serializer\Exception\NotNormalizableValueException;
|
||||||
use Symfony\Component\Serializer\Exception\RuntimeException;
|
use Symfony\Component\Serializer\Exception\RuntimeException;
|
||||||
use Symfony\Component\Serializer\Normalizer\ContextAwareDenormalizerInterface;
|
use Symfony\Component\Serializer\Normalizer\ContextAwareDenormalizerInterface;
|
||||||
use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface;
|
use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface;
|
||||||
@ -44,7 +45,7 @@ class DiscriminatedObjectDenormalizer implements ContextAwareDenormalizerInterfa
|
|||||||
if ($this->denormalizer->supportsDenormalization($data, $localType, $format)) {
|
if ($this->denormalizer->supportsDenormalization($data, $localType, $format)) {
|
||||||
try {
|
try {
|
||||||
return $this->denormalizer->denormalize($data, $localType, $format, $context);
|
return $this->denormalizer->denormalize($data, $localType, $format, $context);
|
||||||
} catch (RuntimeException $e) {
|
} catch (RuntimeException|NotNormalizableValueException $e) {
|
||||||
$lastException = $e;
|
$lastException = $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -124,7 +124,7 @@ class AddressRender implements ChillEntityRenderInterface
|
|||||||
*/
|
*/
|
||||||
public function renderString($addr, array $options): string
|
public function renderString($addr, array $options): string
|
||||||
{
|
{
|
||||||
return implode(' - ', $this->renderLines($addr));
|
return implode(' — ', $this->renderLines($addr));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function supports($entity, array $options): bool
|
public function supports($entity, array $options): bool
|
||||||
|
@ -24,30 +24,30 @@ final class EntityWorkflowTest extends TestCase
|
|||||||
{
|
{
|
||||||
$entityWorkflow = new EntityWorkflow();
|
$entityWorkflow = new EntityWorkflow();
|
||||||
|
|
||||||
$entityWorkflow->getCurrentStep()->setFinalizeAfter(true);
|
|
||||||
$entityWorkflow->setStep('final');
|
$entityWorkflow->setStep('final');
|
||||||
|
$entityWorkflow->getCurrentStep()->setIsFinal(true);
|
||||||
|
|
||||||
$this->assertTrue($entityWorkflow->isFinalize());
|
$this->assertTrue($entityWorkflow->isFinal());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testIsFinalizeWith4Steps()
|
public function testIsFinalizeWith4Steps()
|
||||||
{
|
{
|
||||||
$entityWorkflow = new EntityWorkflow();
|
$entityWorkflow = new EntityWorkflow();
|
||||||
|
|
||||||
$this->assertFalse($entityWorkflow->isFinalize());
|
$this->assertFalse($entityWorkflow->isFinal());
|
||||||
|
|
||||||
$entityWorkflow->setStep('two');
|
$entityWorkflow->setStep('two');
|
||||||
|
|
||||||
$this->assertFalse($entityWorkflow->isFinalize());
|
$this->assertFalse($entityWorkflow->isFinal());
|
||||||
|
|
||||||
$entityWorkflow->setStep('previous_final');
|
$entityWorkflow->setStep('previous_final');
|
||||||
|
|
||||||
$this->assertFalse($entityWorkflow->isFinalize());
|
$this->assertFalse($entityWorkflow->isFinal());
|
||||||
|
|
||||||
$entityWorkflow->getCurrentStep()->setFinalizeAfter(true);
|
$entityWorkflow->getCurrentStep()->setIsFinal(true);
|
||||||
$entityWorkflow->setStep('final');
|
$entityWorkflow->setStep('final');
|
||||||
|
|
||||||
$this->assertTrue($entityWorkflow->isFinalize());
|
$this->assertTrue($entityWorkflow->isFinal());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testIsFreeze()
|
public function testIsFreeze()
|
||||||
@ -64,11 +64,8 @@ final class EntityWorkflowTest extends TestCase
|
|||||||
|
|
||||||
$this->assertFalse($entityWorkflow->isFreeze());
|
$this->assertFalse($entityWorkflow->isFreeze());
|
||||||
|
|
||||||
$entityWorkflow->getCurrentStep()->setFreezeAfter(true);
|
|
||||||
|
|
||||||
$this->assertFalse($entityWorkflow->isFreeze());
|
|
||||||
|
|
||||||
$entityWorkflow->setStep('freezed');
|
$entityWorkflow->setStep('freezed');
|
||||||
|
$entityWorkflow->getCurrentStep()->setFreezeAfter(true);
|
||||||
|
|
||||||
$this->assertTrue($entityWorkflow->isFreeze());
|
$this->assertTrue($entityWorkflow->isFreeze());
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ final class AddressRenderTest extends KernelTestCase
|
|||||||
|
|
||||||
$addr->setBuildingName('Résidence "Les Bleuets"');
|
$addr->setBuildingName('Résidence "Les Bleuets"');
|
||||||
|
|
||||||
yield [$addr, 'Résidence "Les Bleuets" - Rue ABC, 5 - 012345 Locality - Belgium'];
|
yield [$addr, 'Résidence "Les Bleuets" — Rue ABC, 5 — 012345 Locality — Belgium'];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addressDataProviderBEWithSteps(): Iterator
|
public function addressDataProviderBEWithSteps(): Iterator
|
||||||
@ -68,7 +68,7 @@ final class AddressRenderTest extends KernelTestCase
|
|||||||
|
|
||||||
$addr->setSteps('4');
|
$addr->setSteps('4');
|
||||||
|
|
||||||
yield [$addr, 'esc 4 - Rue ABC, 5 - 012345 Locality - Belgium'];
|
yield [$addr, 'esc 4 — Rue ABC, 5 — 012345 Locality — Belgium'];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addressDataProviderFRWithBuilding(): Iterator
|
public function addressDataProviderFRWithBuilding(): Iterator
|
||||||
@ -88,7 +88,7 @@ final class AddressRenderTest extends KernelTestCase
|
|||||||
|
|
||||||
$addr->setBuildingName('Résidence "Les Bleuets"');
|
$addr->setBuildingName('Résidence "Les Bleuets"');
|
||||||
|
|
||||||
yield [$addr, 'Résidence "Les Bleuets" - 5, Rue ABC - 012345 Locality - France'];
|
yield [$addr, 'Résidence "Les Bleuets" — 5, Rue ABC — 012345 Locality — France'];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addressDataProviderFRWithSteps(): Iterator
|
public function addressDataProviderFRWithSteps(): Iterator
|
||||||
@ -108,7 +108,7 @@ final class AddressRenderTest extends KernelTestCase
|
|||||||
|
|
||||||
$addr->setSteps('4');
|
$addr->setSteps('4');
|
||||||
|
|
||||||
yield [$addr, 'esc 4 - 5, Rue ABC - 012345 Locality - France'];
|
yield [$addr, 'esc 4 — 5, Rue ABC — 012345 Locality — France'];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function complexAddressDataProviderBE(): Iterator
|
public function complexAddressDataProviderBE(): Iterator
|
||||||
@ -132,7 +132,7 @@ final class AddressRenderTest extends KernelTestCase
|
|||||||
$addr->setCorridor('3');
|
$addr->setCorridor('3');
|
||||||
$addr->setSteps('4');
|
$addr->setSteps('4');
|
||||||
|
|
||||||
yield [$addr, 'Résidence "Les Bleuets" - appart 1 - ét 2 - coul 3 - esc 4 - Rue ABC, 5 - 012345 Locality - Belgium'];
|
yield [$addr, 'Résidence "Les Bleuets" - appart 1 - ét 2 - coul 3 - esc 4 — Rue ABC, 5 — 012345 Locality — Belgium'];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function complexAddressDataProviderFR(): Iterator
|
public function complexAddressDataProviderFR(): Iterator
|
||||||
@ -158,7 +158,7 @@ final class AddressRenderTest extends KernelTestCase
|
|||||||
$addr->setExtra('A droite de la porte');
|
$addr->setExtra('A droite de la porte');
|
||||||
$addr->setDistribution('CEDEX');
|
$addr->setDistribution('CEDEX');
|
||||||
|
|
||||||
yield [$addr, 'appart 1 - ét 2 - coul 3 - esc 4 - Résidence "Les Bleuets" - 5, Rue ABC - A droite de la porte - 012345 Locality CEDEX - France'];
|
yield [$addr, 'appart 1 - ét 2 - coul 3 - esc 4 — Résidence "Les Bleuets" — 5, Rue ABC — A droite de la porte — 012345 Locality CEDEX — France'];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function noFullAddressDataProviderBE(): Iterator
|
public function noFullAddressDataProviderBE(): Iterator
|
||||||
@ -175,7 +175,7 @@ final class AddressRenderTest extends KernelTestCase
|
|||||||
$addr->setPostcode($postCode)
|
$addr->setPostcode($postCode)
|
||||||
->setIsNoAddress(true);
|
->setIsNoAddress(true);
|
||||||
|
|
||||||
yield [$addr, '012345 Locality - Belgium'];
|
yield [$addr, '012345 Locality — Belgium'];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function simpleAddressDataProviderBE(): Iterator
|
public function simpleAddressDataProviderBE(): Iterator
|
||||||
@ -193,7 +193,7 @@ final class AddressRenderTest extends KernelTestCase
|
|||||||
->setStreetNumber('5')
|
->setStreetNumber('5')
|
||||||
->setPostcode($postCode);
|
->setPostcode($postCode);
|
||||||
|
|
||||||
yield [$addr, 'Rue ABC, 5 - 012345 Locality - Belgium'];
|
yield [$addr, 'Rue ABC, 5 — 012345 Locality — Belgium'];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function simpleAddressDataProviderFR(): Iterator
|
public function simpleAddressDataProviderFR(): Iterator
|
||||||
@ -211,7 +211,7 @@ final class AddressRenderTest extends KernelTestCase
|
|||||||
->setStreetNumber('5')
|
->setStreetNumber('5')
|
||||||
->setPostcode($postCode);
|
->setPostcode($postCode);
|
||||||
|
|
||||||
yield [$addr, '5, Rue ABC - 012345 Locality - France'];
|
yield [$addr, '5, Rue ABC — 012345 Locality — France'];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -16,36 +16,36 @@ use Chill\MainBundle\Entity\Workflow\EntityWorkflow;
|
|||||||
use Chill\MainBundle\Repository\Workflow\EntityWorkflowStepRepository;
|
use Chill\MainBundle\Repository\Workflow\EntityWorkflowStepRepository;
|
||||||
use Chill\MainBundle\Templating\UI\NotificationCounterInterface;
|
use Chill\MainBundle\Templating\UI\NotificationCounterInterface;
|
||||||
use Psr\Cache\CacheItemPoolInterface;
|
use Psr\Cache\CacheItemPoolInterface;
|
||||||
|
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||||
use Symfony\Component\Security\Core\User\UserInterface;
|
use Symfony\Component\Security\Core\User\UserInterface;
|
||||||
use Symfony\Component\Workflow\Event\Event;
|
use Symfony\Component\Workflow\Event\Event;
|
||||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
|
||||||
|
|
||||||
final class WorkflowByUserCounter implements NotificationCounterInterface, EventSubscriberInterface
|
final class WorkflowByUserCounter implements NotificationCounterInterface, EventSubscriberInterface
|
||||||
{
|
{
|
||||||
private EntityWorkflowStepRepository $workflowStepRepository;
|
|
||||||
|
|
||||||
private CacheItemPoolInterface $cacheItemPool;
|
private CacheItemPoolInterface $cacheItemPool;
|
||||||
|
|
||||||
|
private EntityWorkflowStepRepository $workflowStepRepository;
|
||||||
|
|
||||||
public function __construct(EntityWorkflowStepRepository $workflowStepRepository, CacheItemPoolInterface $cacheItemPool)
|
public function __construct(EntityWorkflowStepRepository $workflowStepRepository, CacheItemPoolInterface $cacheItemPool)
|
||||||
{
|
{
|
||||||
$this->workflowStepRepository = $workflowStepRepository;
|
$this->workflowStepRepository = $workflowStepRepository;
|
||||||
$this->cacheItemPool = $cacheItemPool;
|
$this->cacheItemPool = $cacheItemPool;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addNotification(UserInterface $user): int
|
public function addNotification(UserInterface $u): int
|
||||||
{
|
{
|
||||||
if (!$user instanceof User) {
|
if (!$u instanceof User) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$key = self::generateCacheKeyWorkflowByUser($user);
|
$key = self::generateCacheKeyWorkflowByUser($u);
|
||||||
$item = $this->cacheItemPool->getItem($key);
|
$item = $this->cacheItemPool->getItem($key);
|
||||||
|
|
||||||
if ($item->isHit()) {
|
if ($item->isHit()) {
|
||||||
return $item->get();
|
return $item->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
$nb = $this->getCountUnreadByUser($user);
|
$nb = $this->getCountUnreadByUser($u);
|
||||||
|
|
||||||
$item->set($nb)
|
$item->set($nb)
|
||||||
->expiresAfter(60 * 15);
|
->expiresAfter(60 * 15);
|
||||||
@ -54,14 +54,21 @@ final class WorkflowByUserCounter implements NotificationCounterInterface, Event
|
|||||||
return $nb;
|
return $nb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function generateCacheKeyWorkflowByUser(User $user): string
|
||||||
|
{
|
||||||
|
return 'chill_main_workflow_by_u_' . $user->getId();
|
||||||
|
}
|
||||||
|
|
||||||
public function getCountUnreadByUser(User $user): int
|
public function getCountUnreadByUser(User $user): int
|
||||||
{
|
{
|
||||||
return $this->workflowStepRepository->countUnreadByUser($user);
|
return $this->workflowStepRepository->countUnreadByUser($user);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function generateCacheKeyWorkflowByUser(User $user): string
|
public static function getSubscribedEvents()
|
||||||
{
|
{
|
||||||
return 'chill_main_workflow_by_u_'.$user->getId();
|
return [
|
||||||
|
'workflow.leave' => 'resetWorkflowCache',
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function resetWorkflowCache(Event $event): void
|
public function resetWorkflowCache(Event $event): void
|
||||||
@ -74,11 +81,12 @@ final class WorkflowByUserCounter implements NotificationCounterInterface, Event
|
|||||||
$entityWorkflow = $event->getSubject();
|
$entityWorkflow = $event->getSubject();
|
||||||
$step = $entityWorkflow->getCurrentStep();
|
$step = $entityWorkflow->getCurrentStep();
|
||||||
|
|
||||||
if ($step === null) {
|
if (null === $step) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$keys = [];
|
$keys = [];
|
||||||
|
|
||||||
foreach ($step->getDestUser() as $user) {
|
foreach ($step->getDestUser() as $user) {
|
||||||
$keys[] = self::generateCacheKeyWorkflowByUser($user);
|
$keys[] = self::generateCacheKeyWorkflowByUser($user);
|
||||||
}
|
}
|
||||||
@ -86,15 +94,5 @@ final class WorkflowByUserCounter implements NotificationCounterInterface, Event
|
|||||||
if ([] !== $keys) {
|
if ([] !== $keys) {
|
||||||
$this->cacheItemPool->deleteItems($keys);
|
$this->cacheItemPool->deleteItems($keys);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getSubscribedEvents()
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
'workflow.leave' => 'resetWorkflowCache',
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -72,17 +72,18 @@ class MetadataExtractor
|
|||||||
|
|
||||||
foreach ($transitions as $transition) {
|
foreach ($transitions as $transition) {
|
||||||
if ($transition->getName() === $transitionName) {
|
if ($transition->getName() === $transitionName) {
|
||||||
break;
|
$metadata = $workflow->getMetadataStore()->getTransitionMetadata($transition);
|
||||||
|
|
||||||
|
return [
|
||||||
|
'name' => $transition->getName(),
|
||||||
|
'text' => array_key_exists('label', $metadata) ?
|
||||||
|
$this->translatableStringHelper->localize($metadata['label']) : $transition->getName(),
|
||||||
|
'isForward' => $metadata['isForward'] ?? null,
|
||||||
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$metadata = $workflow->getMetadataStore()->getTransitionMetadata($transition);
|
|
||||||
|
|
||||||
return [
|
return [];
|
||||||
'name' => $transition->getName(),
|
|
||||||
'text' => array_key_exists('label', $metadata) ?
|
|
||||||
$this->translatableStringHelper->localize($metadata['label']) : $transition->getName(),
|
|
||||||
'isForward' => $metadata['isForward'] ?? null,
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildArrayPresentationForWorkflow(WorkflowInterface $workflow): array
|
public function buildArrayPresentationForWorkflow(WorkflowInterface $workflow): array
|
||||||
|
@ -27,4 +27,4 @@ address:
|
|||||||
notification:
|
notification:
|
||||||
At least one addressee: Indiquez au moins un destinataire
|
At least one addressee: Indiquez au moins un destinataire
|
||||||
Title must be defined: Un titre doit être indiqué
|
Title must be defined: Un titre doit être indiqué
|
||||||
|
Comment content might not be blank: Le commentaire ne peut pas être vide
|
||||||
|
@ -16,6 +16,7 @@ use Chill\MainBundle\Entity\Scope;
|
|||||||
use Chill\MainBundle\Entity\User;
|
use Chill\MainBundle\Entity\User;
|
||||||
use Chill\MainBundle\Serializer\Model\Collection;
|
use Chill\MainBundle\Serializer\Model\Collection;
|
||||||
use Chill\MainBundle\Serializer\Model\Counter;
|
use Chill\MainBundle\Serializer\Model\Counter;
|
||||||
|
use Chill\MainBundle\Serializer\Normalizer\DiscriminatedObjectDenormalizer;
|
||||||
use Chill\PersonBundle\AccompanyingPeriod\Suggestion\ReferralsSuggestionInterface;
|
use Chill\PersonBundle\AccompanyingPeriod\Suggestion\ReferralsSuggestionInterface;
|
||||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||||
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork;
|
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork;
|
||||||
@ -234,17 +235,19 @@ final class AccompanyingCourseApiController extends ApiController
|
|||||||
$requestor = null;
|
$requestor = null;
|
||||||
$exceptions = [];
|
$exceptions = [];
|
||||||
|
|
||||||
foreach ([Person::class, ThirdParty::class] as $class) {
|
try {
|
||||||
try {
|
$requestor = $this->getSerializer()->deserialize(
|
||||||
$requestor = $this->getSerializer()
|
$request->getContent(),
|
||||||
->deserialize($request->getContent(), $class, $_format, []);
|
'@multi',
|
||||||
} catch (RuntimeException $e) {
|
$_format,
|
||||||
$exceptions[] = $e;
|
[DiscriminatedObjectDenormalizer::ALLOWED_TYPES => [Person::class, ThirdParty::class]]
|
||||||
}
|
);
|
||||||
|
} catch (RuntimeException $e) {
|
||||||
|
$exceptions[] = $e;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (null === $requestor) {
|
if (null === $requestor) {
|
||||||
throw new BadRequestException('Could not find any person or requestor', 0, $exceptions[0]);
|
throw new BadRequestException('Could not find any person or thirdparty', 0, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
$accompanyingPeriod->setRequestor($requestor);
|
$accompanyingPeriod->setRequestor($requestor);
|
||||||
|
@ -15,6 +15,7 @@ use Chill\MainBundle\Pagination\PaginatorFactory;
|
|||||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||||
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork;
|
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork;
|
||||||
use Chill\PersonBundle\Repository\AccompanyingPeriod\AccompanyingPeriodWorkRepository;
|
use Chill\PersonBundle\Repository\AccompanyingPeriod\AccompanyingPeriodWorkRepository;
|
||||||
|
use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodWorkVoter;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||||
@ -23,7 +24,7 @@ use Symfony\Component\HttpFoundation\Request;
|
|||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
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\Contracts\Translation\TranslatorInterface;
|
||||||
|
|
||||||
class AccompanyingCourseWorkController extends AbstractController
|
class AccompanyingCourseWorkController extends AbstractController
|
||||||
{
|
{
|
||||||
@ -60,7 +61,7 @@ class AccompanyingCourseWorkController extends AbstractController
|
|||||||
*/
|
*/
|
||||||
public function createWork(AccompanyingPeriod $period): Response
|
public function createWork(AccompanyingPeriod $period): Response
|
||||||
{
|
{
|
||||||
// TODO ACL
|
$this->denyAccessUnlessGranted(AccompanyingPeriodWorkVoter::CREATE, $period);
|
||||||
|
|
||||||
if ($period->getSocialIssues()->count() === 0) {
|
if ($period->getSocialIssues()->count() === 0) {
|
||||||
$this->addFlash(
|
$this->addFlash(
|
||||||
@ -93,7 +94,8 @@ class AccompanyingCourseWorkController extends AbstractController
|
|||||||
*/
|
*/
|
||||||
public function deleteWork(AccompanyingPeriodWork $work, Request $request): Response
|
public function deleteWork(AccompanyingPeriodWork $work, Request $request): Response
|
||||||
{
|
{
|
||||||
// TODO ACL
|
$this->denyAccessUnlessGranted(AccompanyingPeriodWorkVoter::UPDATE, $work);
|
||||||
|
|
||||||
$em = $this->getDoctrine()->getManager();
|
$em = $this->getDoctrine()->getManager();
|
||||||
|
|
||||||
$form = $this->createDeleteForm($work->getId());
|
$form = $this->createDeleteForm($work->getId());
|
||||||
@ -138,7 +140,8 @@ class AccompanyingCourseWorkController extends AbstractController
|
|||||||
*/
|
*/
|
||||||
public function editWork(AccompanyingPeriodWork $work): Response
|
public function editWork(AccompanyingPeriodWork $work): Response
|
||||||
{
|
{
|
||||||
// TODO ACL
|
$this->denyAccessUnlessGranted(AccompanyingPeriodWorkVoter::UPDATE, $work);
|
||||||
|
|
||||||
$json = $this->serializer->normalize($work, 'json', ['groups' => ['read']]);
|
$json = $this->serializer->normalize($work, 'json', ['groups' => ['read']]);
|
||||||
|
|
||||||
return $this->render('@ChillPerson/AccompanyingCourseWork/edit.html.twig', [
|
return $this->render('@ChillPerson/AccompanyingCourseWork/edit.html.twig', [
|
||||||
@ -157,13 +160,13 @@ class AccompanyingCourseWorkController extends AbstractController
|
|||||||
*/
|
*/
|
||||||
public function listWorkByAccompanyingPeriod(AccompanyingPeriod $period): Response
|
public function listWorkByAccompanyingPeriod(AccompanyingPeriod $period): Response
|
||||||
{
|
{
|
||||||
// TODO ACL
|
$this->denyAccessUnlessGranted(AccompanyingPeriodWorkVoter::SEE, $period);
|
||||||
|
|
||||||
$totalItems = $this->workRepository->countByAccompanyingPeriod($period);
|
$totalItems = $this->workRepository->countByAccompanyingPeriod($period);
|
||||||
$paginator = $this->paginator->create($totalItems);
|
$paginator = $this->paginator->create($totalItems);
|
||||||
|
|
||||||
$works = $this->workRepository->findByAccompanyingPeriod(
|
$works = $this->workRepository->findByAccompanyingPeriodOpenFirst(
|
||||||
$period,
|
$period,
|
||||||
['startDate' => 'DESC', 'endDate' => 'DESC'],
|
|
||||||
$paginator->getItemsPerPage(),
|
$paginator->getItemsPerPage(),
|
||||||
$paginator->getCurrentPageFirstItemNumber()
|
$paginator->getCurrentPageFirstItemNumber()
|
||||||
);
|
);
|
||||||
|
@ -50,7 +50,6 @@ class HouseholdApiController extends ApiController
|
|||||||
*/
|
*/
|
||||||
public function getHouseholdByAddressReference(AddressReference $addressReference): Response
|
public function getHouseholdByAddressReference(AddressReference $addressReference): Response
|
||||||
{
|
{
|
||||||
// TODO ACL
|
|
||||||
$this->denyAccessUnlessGranted('ROLE_USER');
|
$this->denyAccessUnlessGranted('ROLE_USER');
|
||||||
|
|
||||||
$total = $this->householdACLAwareRepository->countByAddressReference($addressReference);
|
$total = $this->householdACLAwareRepository->countByAddressReference($addressReference);
|
||||||
|
@ -224,6 +224,8 @@ final class PersonController extends AbstractController
|
|||||||
'label' => 'Add the person',
|
'label' => 'Add the person',
|
||||||
])->add('createPeriod', SubmitType::class, [
|
])->add('createPeriod', SubmitType::class, [
|
||||||
'label' => 'Add the person and create an accompanying period',
|
'label' => 'Add the person and create an accompanying period',
|
||||||
|
])->add('createHousehold', SubmitType::class, [
|
||||||
|
'label' => 'Add the person and create a household',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$form->handleRequest($request);
|
$form->handleRequest($request);
|
||||||
@ -252,6 +254,12 @@ final class PersonController extends AbstractController
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($form->get('createHousehold')->isClicked()) {
|
||||||
|
return $this->redirectToRoute('chill_person_household_members_editor', [
|
||||||
|
'persons' => [$person->getId()],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
return $this->redirectToRoute(
|
return $this->redirectToRoute(
|
||||||
'chill_person_general_edit',
|
'chill_person_general_edit',
|
||||||
['person_id' => $person->getId()]
|
['person_id' => $person->getId()]
|
||||||
|
@ -34,16 +34,36 @@ class UserAccompanyingPeriodController extends AbstractController
|
|||||||
*/
|
*/
|
||||||
public function listAction(Request $request)
|
public function listAction(Request $request)
|
||||||
{
|
{
|
||||||
$total = $this->accompanyingPeriodRepository->countBy(['user' => $this->getUser()]);
|
$total = $this->accompanyingPeriodRepository->countBy(['user' => $this->getUser(), 'step' => ['CONFIRMED', 'CLOSED']]);
|
||||||
$pagination = $this->paginatorFactory->create($total);
|
$pagination = $this->paginatorFactory->create($total);
|
||||||
$accompanyingPeriods = $this->accompanyingPeriodRepository->findBy(
|
$accompanyingPeriods = $this->accompanyingPeriodRepository->findBy(
|
||||||
['user' => $this->getUser()],
|
['user' => $this->getUser(), 'step' => ['CONFIRMED', 'CLOSED']],
|
||||||
['openingDate' => 'DESC'],
|
['openingDate' => 'DESC'],
|
||||||
$pagination->getItemsPerPage(),
|
$pagination->getItemsPerPage(),
|
||||||
$pagination->getCurrentPageFirstItemNumber()
|
$pagination->getCurrentPageFirstItemNumber()
|
||||||
);
|
);
|
||||||
|
|
||||||
return $this->render('@ChillPerson/AccompanyingPeriod/user_periods_list.html.twig', [
|
return $this->render('@ChillPerson/AccompanyingPeriod/user_periods_list.html.twig', [
|
||||||
|
'accompanyingds' => $accompanyingPeriods,
|
||||||
|
'pagination' => $pagination,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Route("/{_locale}/accompanying-periods/drafts", name="chill_person_accompanying_period_draft_user")
|
||||||
|
*/
|
||||||
|
public function listDraftsAction(Request $request)
|
||||||
|
{
|
||||||
|
$total = $this->accompanyingPeriodRepository->countBy(['user' => $this->getUser(), 'step' => 'DRAFT']);
|
||||||
|
$pagination = $this->paginatorFactory->create($total);
|
||||||
|
$accompanyingPeriods = $this->accompanyingPeriodRepository->findBy(
|
||||||
|
['createdBy' => $this->getUser(), 'step' => 'DRAFT'],
|
||||||
|
['id' => 'DESC'],
|
||||||
|
$pagination->getItemsPerPage(),
|
||||||
|
$pagination->getCurrentPageFirstItemNumber()
|
||||||
|
);
|
||||||
|
|
||||||
|
return $this->render('@ChillPerson/AccompanyingPeriod/user_draft_periods_list.html.twig', [
|
||||||
'accompanyingPeriods' => $accompanyingPeriods,
|
'accompanyingPeriods' => $accompanyingPeriods,
|
||||||
'pagination' => $pagination,
|
'pagination' => $pagination,
|
||||||
]);
|
]);
|
||||||
|
@ -1153,11 +1153,8 @@ class AccompanyingPeriod implements
|
|||||||
$this->removeComment($this->pinnedComment);
|
$this->removeComment($this->pinnedComment);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($comment instanceof Comment) {
|
if (null !== $this->pinnedComment) {
|
||||||
if (null !== $this->pinnedComment) {
|
$this->addComment($this->pinnedComment);
|
||||||
$this->addComment($this->pinnedComment);
|
|
||||||
}
|
|
||||||
$this->addComment($comment);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->pinnedComment = $comment;
|
$this->pinnedComment = $comment;
|
||||||
|
@ -44,8 +44,8 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @ORM\ManyToOne(targetEntity=AccompanyingPeriod::class)
|
* @ORM\ManyToOne(targetEntity=AccompanyingPeriod::class)
|
||||||
* @Serializer\Groups({"read","read:accompanyingPeriodWork:light"})
|
* @Serializer\Groups({"read", "read:accompanyingPeriodWork:light"})
|
||||||
* @Serializer\Context(normalizationContext={"groups"={"read"}}, groups={"read:accompanyingPeriodWork:light"})
|
* @Serializer\Context(normalizationContext={"groups": {"read"}}, groups={"read:accompanyingPeriodWork:light"})
|
||||||
*/
|
*/
|
||||||
private ?AccompanyingPeriod $accompanyingPeriod = null;
|
private ?AccompanyingPeriod $accompanyingPeriod = null;
|
||||||
|
|
||||||
|
@ -13,7 +13,10 @@ namespace Chill\PersonBundle\Menu;
|
|||||||
|
|
||||||
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
|
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
|
||||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||||
|
use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter;
|
||||||
|
use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodWorkVoter;
|
||||||
use Knp\Menu\MenuItem;
|
use Knp\Menu\MenuItem;
|
||||||
|
use Symfony\Component\Security\Core\Security;
|
||||||
use Symfony\Component\Workflow\Registry;
|
use Symfony\Component\Workflow\Registry;
|
||||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||||
|
|
||||||
@ -24,15 +27,18 @@ class AccompanyingCourseMenuBuilder implements LocalMenuBuilderInterface
|
|||||||
{
|
{
|
||||||
protected Registry $registry;
|
protected Registry $registry;
|
||||||
|
|
||||||
|
protected Security $security;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var TranslatorInterface
|
* @var TranslatorInterface
|
||||||
*/
|
*/
|
||||||
protected $translator;
|
protected $translator;
|
||||||
|
|
||||||
public function __construct(TranslatorInterface $translator, Registry $registry)
|
public function __construct(TranslatorInterface $translator, Registry $registry, Security $security)
|
||||||
{
|
{
|
||||||
$this->translator = $translator;
|
$this->translator = $translator;
|
||||||
$this->registry = $registry;
|
$this->registry = $registry;
|
||||||
|
$this->security = $security;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildMenu($menuId, MenuItem $menu, array $parameters): void
|
public function buildMenu($menuId, MenuItem $menu, array $parameters): void
|
||||||
@ -47,38 +53,44 @@ class AccompanyingCourseMenuBuilder implements LocalMenuBuilderInterface
|
|||||||
], ])
|
], ])
|
||||||
->setExtras(['order' => 10]);
|
->setExtras(['order' => 10]);
|
||||||
|
|
||||||
$menu->addChild($this->translator->trans('Edit Accompanying Course'), [
|
if ($this->security->isGranted(AccompanyingPeriodVoter::EDIT, $period)) {
|
||||||
'route' => 'chill_person_accompanying_course_edit',
|
$menu->addChild($this->translator->trans('Edit Accompanying Course'), [
|
||||||
'routeParameters' => [
|
'route' => 'chill_person_accompanying_course_edit',
|
||||||
'accompanying_period_id' => $period->getId(),
|
'routeParameters' => [
|
||||||
], ])
|
'accompanying_period_id' => $period->getId(),
|
||||||
->setExtras(['order' => 20]);
|
], ])
|
||||||
|
->setExtras(['order' => 20]);
|
||||||
|
}
|
||||||
|
|
||||||
if (AccompanyingPeriod::STEP_DRAFT === $period->getStep()) {
|
if (AccompanyingPeriod::STEP_DRAFT === $period->getStep()) {
|
||||||
// no more menu items if the period is draft
|
// no more menu items if the period is draft
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$menu->addChild($this->translator->trans('Accompanying Course History'), [
|
if ($this->security->isGranted(AccompanyingPeriodVoter::SEE_DETAILS, $period)) {
|
||||||
'route' => 'chill_person_accompanying_course_history',
|
$menu->addChild($this->translator->trans('Accompanying Course History'), [
|
||||||
'routeParameters' => [
|
'route' => 'chill_person_accompanying_course_history',
|
||||||
'accompanying_period_id' => $period->getId(),
|
'routeParameters' => [
|
||||||
], ])
|
'accompanying_period_id' => $period->getId(),
|
||||||
->setExtras(['order' => 30]);
|
], ])
|
||||||
|
->setExtras(['order' => 30]);
|
||||||
|
|
||||||
$menu->addChild($this->translator->trans('Accompanying Course Action'), [
|
$menu->addChild($this->translator->trans('Accompanying Course Comment'), [
|
||||||
'route' => 'chill_person_accompanying_period_work_list',
|
'route' => 'chill_person_accompanying_period_comment_list',
|
||||||
'routeParameters' => [
|
'routeParameters' => [
|
||||||
'id' => $period->getId(),
|
'accompanying_period_id' => $period->getId(),
|
||||||
], ])
|
], ])
|
||||||
->setExtras(['order' => 40]);
|
->setExtras(['order' => 50]);
|
||||||
|
}
|
||||||
|
|
||||||
$menu->addChild($this->translator->trans('Accompanying Course Comment'), [
|
if ($this->security->isGranted(AccompanyingPeriodWorkVoter::SEE, $period)) {
|
||||||
'route' => 'chill_person_accompanying_period_comment_list',
|
$menu->addChild($this->translator->trans('Accompanying Course Action'), [
|
||||||
'routeParameters' => [
|
'route' => 'chill_person_accompanying_period_work_list',
|
||||||
'accompanying_period_id' => $period->getId(),
|
'routeParameters' => [
|
||||||
], ])
|
'id' => $period->getId(),
|
||||||
->setExtras(['order' => 50]);
|
], ])
|
||||||
|
->setExtras(['order' => 40]);
|
||||||
|
}
|
||||||
|
|
||||||
$workflow = $this->registry->get($period, 'accompanying_period_lifecycle');
|
$workflow = $this->registry->get($period, 'accompanying_period_lifecycle');
|
||||||
|
|
||||||
|
@ -44,6 +44,13 @@ class UserMenuBuilder implements LocalMenuBuilderInterface
|
|||||||
'order' => 20,
|
'order' => 20,
|
||||||
'icon' => 'tasks',
|
'icon' => 'tasks',
|
||||||
]);
|
]);
|
||||||
|
$menu->addChild('My accompanying periods in draft', [
|
||||||
|
'route' => 'chill_person_accompanying_period_draft_user',
|
||||||
|
])
|
||||||
|
->setExtras([
|
||||||
|
'order' => 30,
|
||||||
|
'icon' => 'tasks',
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,17 +16,22 @@ use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
|||||||
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork;
|
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork;
|
||||||
use Chill\PersonBundle\Entity\SocialWork\SocialAction;
|
use Chill\PersonBundle\Entity\SocialWork\SocialAction;
|
||||||
use DateTimeImmutable;
|
use DateTimeImmutable;
|
||||||
|
use Doctrine\DBAL\Types\Types;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Doctrine\ORM\EntityRepository;
|
use Doctrine\ORM\EntityRepository;
|
||||||
|
use Doctrine\ORM\Query\ResultSetMappingBuilder;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use Doctrine\Persistence\ObjectRepository;
|
use Doctrine\Persistence\ObjectRepository;
|
||||||
|
|
||||||
final class AccompanyingPeriodWorkRepository implements ObjectRepository
|
final class AccompanyingPeriodWorkRepository implements ObjectRepository
|
||||||
{
|
{
|
||||||
|
private EntityManagerInterface $em;
|
||||||
|
|
||||||
private EntityRepository $repository;
|
private EntityRepository $repository;
|
||||||
|
|
||||||
public function __construct(EntityManagerInterface $entityManager)
|
public function __construct(EntityManagerInterface $entityManager)
|
||||||
{
|
{
|
||||||
|
$this->em = $entityManager;
|
||||||
$this->repository = $entityManager->getRepository(AccompanyingPeriodWork::class);
|
$this->repository = $entityManager->getRepository(AccompanyingPeriodWork::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,6 +83,36 @@ final class AccompanyingPeriodWorkRepository implements ObjectRepository
|
|||||||
return $this->repository->findByAccompanyingPeriod($period, $orderBy, $limit, $offset);
|
return $this->repository->findByAccompanyingPeriod($period, $orderBy, $limit, $offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a list of accompanying period with a defined order:.
|
||||||
|
*
|
||||||
|
* * first, opened works
|
||||||
|
* * then, closed works
|
||||||
|
*
|
||||||
|
* @return AccompanyingPeriodWork[]
|
||||||
|
*/
|
||||||
|
public function findByAccompanyingPeriodOpenFirst(AccompanyingPeriod $period, int $limit = 10, int $offset = 0): array
|
||||||
|
{
|
||||||
|
$rsm = new ResultSetMappingBuilder($this->em);
|
||||||
|
$rsm->addRootEntityFromClassMetadata(AccompanyingPeriodWork::class, 'w');
|
||||||
|
|
||||||
|
$sql = "SELECT {$rsm} FROM chill_person_accompanying_period_work w
|
||||||
|
WHERE accompanyingPeriod_id = :periodId
|
||||||
|
ORDER BY
|
||||||
|
CASE WHEN enddate IS NULL THEN '-infinity'::timestamp ELSE 'infinity'::timestamp END ASC,
|
||||||
|
startdate DESC,
|
||||||
|
enddate DESC,
|
||||||
|
id DESC
|
||||||
|
LIMIT :limit OFFSET :offset";
|
||||||
|
|
||||||
|
$nq = $this->em->createNativeQuery($sql, $rsm)
|
||||||
|
->setParameter('periodId', $period->getId(), Types::INTEGER)
|
||||||
|
->setParameter('limit', $limit, Types::INTEGER)
|
||||||
|
->setParameter('offset', $offset, Types::INTEGER);
|
||||||
|
|
||||||
|
return $nq->getResult();
|
||||||
|
}
|
||||||
|
|
||||||
public function findNearEndDateByUser(User $user, DateTimeImmutable $since, DateTimeImmutable $until, int $limit = 20, int $offset = 0): array
|
public function findNearEndDateByUser(User $user, DateTimeImmutable $since, DateTimeImmutable $until, int $limit = 20, int $offset = 0): array
|
||||||
{
|
{
|
||||||
return $this->buildQueryNearEndDateByUser($user, $since, $until)
|
return $this->buildQueryNearEndDateByUser($user, $since, $until)
|
||||||
|
@ -14,7 +14,7 @@ namespace Chill\PersonBundle\Repository\Household;
|
|||||||
use Chill\MainBundle\Entity\AddressReference;
|
use Chill\MainBundle\Entity\AddressReference;
|
||||||
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
|
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
|
||||||
use Chill\PersonBundle\Entity\Household\Household;
|
use Chill\PersonBundle\Entity\Household\Household;
|
||||||
use Chill\PersonBundle\Security\Authorization\HouseholdVoter;
|
use Chill\PersonBundle\Security\Authorization\PersonVoter;
|
||||||
use DateTime;
|
use DateTime;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
@ -39,7 +39,7 @@ final class HouseholdACLAwareRepository implements HouseholdACLAwareRepositoryIn
|
|||||||
{
|
{
|
||||||
$centers = $this->authorizationHelper->getReachableCenters(
|
$centers = $this->authorizationHelper->getReachableCenters(
|
||||||
$this->security->getUser(),
|
$this->security->getUser(),
|
||||||
HouseholdVoter::SEE
|
PersonVoter::SEE // the authorization to see a household is the same as seeing a person
|
||||||
);
|
);
|
||||||
|
|
||||||
if ([] === $centers) {
|
if ([] === $centers) {
|
||||||
|
@ -60,14 +60,14 @@
|
|||||||
<template v-slot:body>
|
<template v-slot:body>
|
||||||
<p>{{ $t('confirm.sure_description') }}</p>
|
<p>{{ $t('confirm.sure_description') }}</p>
|
||||||
<div v-if="accompanyingCourse.user === null">
|
<div v-if="accompanyingCourse.user === null">
|
||||||
<div v-if="filteredReferrersSuggested.length === 0">
|
<div v-if="usersSuggestedFilteredByJob.length === 0">
|
||||||
<p class="alert alert-warning">{{ $t('confirm.no_suggested_referrer') }}</p>
|
<p class="alert alert-warning">{{ $t('confirm.no_suggested_referrer') }}</p>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="filteredReferrersSuggested.length === 1" class="alert alert-info">
|
<div v-if="usersSuggestedFilteredByJob.length === 1" class="alert alert-info">
|
||||||
<p>{{ $t('confirm.one_suggested_referrer') }}:</p>
|
<p>{{ $t('confirm.one_suggested_referrer') }}:</p>
|
||||||
<ul class="list-suggest add-items inline">
|
<ul class="list-suggest add-items inline">
|
||||||
<li>
|
<li>
|
||||||
<user-render-box-badge :user="filteredReferrersSuggested[0]"></user-render-box-badge>
|
<user-render-box-badge :user="usersSuggestedFilteredByJob[0]"></user-render-box-badge>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<p>{{ $t('confirm.choose_suggested_referrer') }}</p>
|
<p>{{ $t('confirm.choose_suggested_referrer') }}</p>
|
||||||
@ -150,7 +150,6 @@ export default {
|
|||||||
computed: {
|
computed: {
|
||||||
...mapState({
|
...mapState({
|
||||||
accompanyingCourse: state => state.accompanyingCourse,
|
accompanyingCourse: state => state.accompanyingCourse,
|
||||||
filteredReferrersSuggested: state => state.filteredReferrersSuggested
|
|
||||||
}),
|
}),
|
||||||
...mapGetters([
|
...mapGetters([
|
||||||
'isParticipationValid',
|
'isParticipationValid',
|
||||||
@ -160,15 +159,16 @@ export default {
|
|||||||
'isLocationValid',
|
'isLocationValid',
|
||||||
'isJobValid',
|
'isJobValid',
|
||||||
'validationKeys',
|
'validationKeys',
|
||||||
'isValidToBeConfirmed'
|
'isValidToBeConfirmed',
|
||||||
|
'usersSuggestedFilteredByJob',
|
||||||
]),
|
]),
|
||||||
deleteLink() {
|
deleteLink() {
|
||||||
return `/fr/parcours/${this.accompanyingCourse.id}/delete`; //TODO locale
|
return `/fr/parcours/${this.accompanyingCourse.id}/delete`; //TODO locale
|
||||||
},
|
},
|
||||||
disableConfirm() {
|
disableConfirm() {
|
||||||
return this.clickedDoNotChooseReferrer
|
return (this.accompanyingCourse.user === null
|
||||||
? (this.accompanyingCourse.user === null && this.filteredReferrersSuggested.length === 0)
|
&& this.usersSuggestedFilteredByJob.length === 1
|
||||||
: (this.accompanyingCourse.user === null && this.filteredReferrersSuggested.length === 0) || (this.filteredReferrersSuggested.length === 1);
|
&& this.clickedDoNotChooseReferrer === false);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@ -183,7 +183,7 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
chooseSuggestedReferrer() {
|
chooseSuggestedReferrer() {
|
||||||
this.$store.dispatch('updateReferrer', this.filteredReferrersSuggested[0])
|
this.$store.dispatch('updateReferrer', this.usersSuggestedFilteredByJob[0])
|
||||||
.catch(({name, violations}) => {
|
.catch(({name, violations}) => {
|
||||||
if (name === 'ValidationException' || name === 'AccessException') {
|
if (name === 'ValidationException' || name === 'AccessException') {
|
||||||
violations.forEach((violation) => this.$toast.open({message: violation}));
|
violations.forEach((violation) => this.$toast.open({message: violation}));
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
<div class="form-check" v-for="p in participationWithoutHousehold" :key="p.id">
|
<div class="form-check" v-for="p in participationWithoutHousehold" :key="p.id">
|
||||||
<input type="checkbox"
|
<input type="checkbox"
|
||||||
class="form-check-input"
|
class="form-check-input"
|
||||||
v-model="hasNoHousehold"
|
|
||||||
name="persons[]"
|
name="persons[]"
|
||||||
checked="checked"
|
checked="checked"
|
||||||
:id="p.person.id"
|
:id="p.person.id"
|
||||||
@ -56,14 +55,18 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<add-persons
|
<ul class="record_actions">
|
||||||
buttonTitle="persons_associated.add_persons"
|
<li class="add-persons">
|
||||||
modalTitle="add_persons.title"
|
<add-persons
|
||||||
v-bind:key="addPersons.key"
|
buttonTitle="persons_associated.add_persons"
|
||||||
v-bind:options="addPersons.options"
|
modalTitle="add_persons.title"
|
||||||
@addNewPersons="addNewPersons"
|
v-bind:key="addPersons.key"
|
||||||
ref="addPersons"> <!-- to cast child method -->
|
v-bind:options="addPersons.options"
|
||||||
</add-persons>
|
@addNewPersons="addNewPersons"
|
||||||
|
ref="addPersons"> <!-- to cast child method -->
|
||||||
|
</add-persons>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="!isParticipationValid" class="alert alert-warning to-confirm">
|
<div v-if="!isParticipationValid" class="alert alert-warning to-confirm">
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
addAge : true,
|
addAge : true,
|
||||||
hLevel : 3,
|
hLevel : 3,
|
||||||
isConfidential : false,
|
isConfidential : false,
|
||||||
|
isMultiline: true,
|
||||||
}"
|
}"
|
||||||
:person="participation.person"
|
:person="participation.person"
|
||||||
:returnPath="getAccompanyingCourseReturnPath">
|
:returnPath="getAccompanyingCourseReturnPath">
|
||||||
|
@ -1,164 +1,172 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="vue-component">
|
<div class="vue-component">
|
||||||
<h2><a id="section-80"></a>{{ $t('referrer.title') }}</h2>
|
<h2><a id="section-80"></a>{{ $t('referrer.title') }}</h2>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
|
|
||||||
<label class="col-form-label" for="selectJob">
|
<label class="col-form-label" for="selectJob">
|
||||||
{{ $t('job.label') }}
|
{{ $t('job.label') }}
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<VueMultiselect
|
<VueMultiselect
|
||||||
name="selectJob"
|
name="selectJob"
|
||||||
label="text"
|
label="text"
|
||||||
:custom-label="customJobLabel"
|
:custom-label="customJobLabel"
|
||||||
track-by="id"
|
track-by="id"
|
||||||
:multiple="false"
|
:multiple="false"
|
||||||
:searchable="true"
|
:searchable="true"
|
||||||
:placeholder="$t('job.placeholder')"
|
:placeholder="$t('job.placeholder')"
|
||||||
v-model="valueJob"
|
v-model="valueJob"
|
||||||
:options="jobs"
|
:options="jobs"
|
||||||
:select-label="$t('multiselect.select_label')"
|
:select-label="$t('multiselect.select_label')"
|
||||||
:deselect-label="$t('multiselect.deselect_label')"
|
:deselect-label="$t('multiselect.deselect_label')"
|
||||||
:selected-label="$t('multiselect.selected_label')"
|
:selected-label="$t('multiselect.selected_label')"
|
||||||
@select="updateJob">
|
></VueMultiselect>
|
||||||
</VueMultiselect>
|
|
||||||
|
|
||||||
<label class="col-form-label" for="selectReferrer">
|
<label class="col-form-label" for="selectReferrer">
|
||||||
{{ $t('referrer.label') }}
|
{{ $t('referrer.label') }}
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<VueMultiselect
|
<VueMultiselect
|
||||||
name="selectReferrer"
|
name="selectReferrer"
|
||||||
label="text"
|
label="text"
|
||||||
track-by="id"
|
track-by="id"
|
||||||
:multiple="false"
|
:multiple="false"
|
||||||
:searchable="true"
|
:searchable="true"
|
||||||
:placeholder="$t('referrer.placeholder')"
|
:placeholder="$t('referrer.placeholder')"
|
||||||
v-model="value"
|
v-model="value"
|
||||||
:options="users"
|
:options="users"
|
||||||
:select-label="$t('multiselect.select_label')"
|
:select-label="$t('multiselect.select_label')"
|
||||||
:deselect-label="$t('multiselect.deselect_label')"
|
:deselect-label="$t('multiselect.deselect_label')"
|
||||||
:selected-label="$t('multiselect.selected_label')"
|
:selected-label="$t('multiselect.selected_label')"
|
||||||
@select="updateReferrer">
|
></VueMultiselect>
|
||||||
</VueMultiselect>
|
|
||||||
|
|
||||||
<template v-if="filteredReferrersSuggested.length > 0">
|
<template v-if="usersSuggestedFilteredByJob.length > 0">
|
||||||
<ul class="list-suggest add-items inline">
|
<ul class="list-suggest add-items inline">
|
||||||
<li v-for="(u, i) in filteredReferrersSuggested" @click="updateReferrer(u)" :key="`referrer-${i}`">
|
<li v-for="(u, i) in usersSuggestedFilteredByJob" @click="updateReferrer(u)" :key="`referrer-${i}`">
|
||||||
<span>
|
<span>
|
||||||
<user-render-box-badge :user="u"></user-render-box-badge>
|
<user-render-box-badge :user="u"></user-render-box-badge>
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<ul class="record_actions">
|
<ul class="record_actions">
|
||||||
<li>
|
<li>
|
||||||
<button
|
<button
|
||||||
class="btn btn-create"
|
class="btn btn-create"
|
||||||
type="button"
|
type="button"
|
||||||
name="button"
|
name="button"
|
||||||
@click="assignMe">
|
@click="assignMe">
|
||||||
{{ $t('referrer.assign_me') }}
|
{{ $t('referrer.assign_me') }}
|
||||||
</button>
|
</button>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="!isJobValid" class="alert alert-warning to-confirm">
|
<div v-if="!isJobValid" class="alert alert-warning to-confirm">
|
||||||
{{ $t('job.not_valid') }}
|
{{ $t('job.not_valid') }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import VueMultiselect from 'vue-multiselect';
|
import VueMultiselect from 'vue-multiselect';
|
||||||
import { makeFetch } from 'ChillMainAssets/lib/api/apiMethods';
|
import {makeFetch} from 'ChillMainAssets/lib/api/apiMethods';
|
||||||
import { mapState, mapGetters } from 'vuex';
|
import {mapState, mapGetters} from 'vuex';
|
||||||
import UserRenderBoxBadge from "ChillMainAssets/vuejs/_components/Entity/UserRenderBoxBadge";
|
import UserRenderBoxBadge from "ChillMainAssets/vuejs/_components/Entity/UserRenderBoxBadge";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Referrer",
|
name: "Referrer",
|
||||||
components: {
|
components: {
|
||||||
UserRenderBoxBadge,
|
UserRenderBoxBadge,
|
||||||
VueMultiselect,
|
VueMultiselect,
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
jobs: []
|
jobs: []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
...mapState({
|
||||||
|
valueJob: state => state.accompanyingCourse.job,
|
||||||
|
}),
|
||||||
|
...mapGetters(['isJobValid', 'usersSuggestedFilteredByJob']),
|
||||||
|
users: function () {
|
||||||
|
let users = this.$store.getters.usersFilteredByJob;
|
||||||
|
// ensure that the selected user is in the list. add it if necessary
|
||||||
|
if (this.$store.state.accompanyingCourse.user !== null && users.find(u => this.$store.state.accompanyingCourse.user.id === u.id) === undefined) {
|
||||||
|
users.push(this.$store.state.accompanyingCourse.user);
|
||||||
}
|
}
|
||||||
},
|
return users;
|
||||||
computed: {
|
},
|
||||||
...mapState({
|
valueJob: {
|
||||||
value: state => state.accompanyingCourse.user,
|
get() {
|
||||||
valueJob: state => state.accompanyingCourse.job,
|
return this.$store.state.accompanyingCourse.job;
|
||||||
users: state => state.users.filter(u => {
|
},
|
||||||
if (u.user_job && state.accompanyingCourse.job) {
|
set(value) {
|
||||||
return u.user_job.id === state.accompanyingCourse.job.id;
|
this.$store.dispatch('updateJob', value)
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
filteredReferrersSuggested: state => state.filteredReferrersSuggested,
|
|
||||||
}),
|
|
||||||
...mapGetters([
|
|
||||||
'isJobValid'
|
|
||||||
])
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
this.getJobs();
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
updateReferrer(value) {
|
|
||||||
this.$store.dispatch('updateReferrer', value)
|
|
||||||
.catch(({name, violations}) => {
|
.catch(({name, violations}) => {
|
||||||
if (name === 'ValidationException' || name === 'AccessException') {
|
if (name === 'ValidationException' || name === 'AccessException') {
|
||||||
violations.forEach((violation) => this.$toast.open({message: violation}));
|
violations.forEach((violation) => this.$toast.open({message: violation}));
|
||||||
} else {
|
} else {
|
||||||
this.$toast.open({message: 'An error occurred'})
|
this.$toast.open({message: 'An error occurred'})
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
|
||||||
getJobs() {
|
|
||||||
const url = '/api/1.0/main/user-job.json';
|
|
||||||
makeFetch('GET', url)
|
|
||||||
.then(response => {
|
|
||||||
this.jobs = response.results;
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
this.$toast.open({message: error.txt})
|
|
||||||
})
|
|
||||||
},
|
|
||||||
updateJob(value) {
|
|
||||||
this.$store.dispatch('updateJob', value)
|
|
||||||
.catch(({name, violations}) => {
|
|
||||||
if (name === 'ValidationException' || name === 'AccessException') {
|
|
||||||
violations.forEach((violation) => this.$toast.open({message: violation}));
|
|
||||||
} else {
|
|
||||||
this.$toast.open({message: 'An error occurred'})
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
customJobLabel(value) {
|
|
||||||
return value.label.fr;
|
|
||||||
},
|
|
||||||
assignMe() {
|
|
||||||
const url = `/api/1.0/main/whoami.json`;
|
|
||||||
makeFetch('GET', url)
|
|
||||||
.then(response => {
|
|
||||||
this.$store.dispatch('updateReferrer', response);
|
|
||||||
return response;
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
commit('catchError', error);
|
|
||||||
this.$toast.open({message: error.body})
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
value: {
|
||||||
|
get() {
|
||||||
|
return this.$store.state.accompanyingCourse.user;
|
||||||
|
},
|
||||||
|
set(value) {
|
||||||
|
console.log('set referrer', value);
|
||||||
|
this.$store.dispatch('updateReferrer', value)
|
||||||
|
.catch(({name, violations}) => {
|
||||||
|
if (name === 'ValidationException' || name === 'AccessException') {
|
||||||
|
violations.forEach((violation) => this.$toast.open({message: violation}));
|
||||||
|
} else {
|
||||||
|
this.$toast.open({message: 'An error occurred'})
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.getJobs();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
updateReferrer(value) {
|
||||||
|
this.value = value;
|
||||||
|
},
|
||||||
|
getJobs() {
|
||||||
|
const url = '/api/1.0/main/user-job.json';
|
||||||
|
makeFetch('GET', url)
|
||||||
|
.then(response => {
|
||||||
|
this.jobs = response.results;
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
this.$toast.open({message: error.txt})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
customJobLabel(value) {
|
||||||
|
return value.label.fr;
|
||||||
|
},
|
||||||
|
assignMe() {
|
||||||
|
const url = `/api/1.0/main/whoami.json`;
|
||||||
|
makeFetch('GET', url)
|
||||||
|
.then(user => {
|
||||||
|
this.value = user
|
||||||
|
})
|
||||||
|
/*.catch((error) => {
|
||||||
|
commit('catchError', error);
|
||||||
|
this.$toast.open({message: error.body})
|
||||||
|
})*/
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<div v-if="accompanyingCourse.requestor && isAnonymous" class="flex-table">
|
<div v-if="accompanyingCourse.requestor && isAnonymous" class="flex-table">
|
||||||
|
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" v-model="isAnonymous" class="me-2" />
|
<input type="checkbox" v-model="requestorIsAnonymous" class="me-2" />
|
||||||
{{ $t('requestor.is_anonymous') }}
|
{{ $t('requestor.is_anonymous') }}
|
||||||
</label>
|
</label>
|
||||||
<confidential v-if="accompanyingCourse.requestor.type === 'thirdparty'">
|
<confidential v-if="accompanyingCourse.requestor.type === 'thirdparty'">
|
||||||
@ -72,7 +72,7 @@
|
|||||||
|
|
||||||
<div v-else-if="accompanyingCourse.requestor && !isAnonymous" class="flex-table">
|
<div v-else-if="accompanyingCourse.requestor && !isAnonymous" class="flex-table">
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" v-model="isAnonymous" class="me-2" />
|
<input type="checkbox" v-model="requestorIsAnonymous" class="me-2" />
|
||||||
{{ $t('requestor.is_anonymous') }}
|
{{ $t('requestor.is_anonymous') }}
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
@ -144,14 +144,18 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<add-persons v-if="accompanyingCourse.requestor === null"
|
<ul class="record_actions">
|
||||||
buttonTitle="requestor.add_requestor"
|
<li class="add-persons">
|
||||||
modalTitle="requestor.add_requestor"
|
<add-persons v-if="accompanyingCourse.requestor === null"
|
||||||
v-bind:key="addPersons.key"
|
buttonTitle="requestor.add_requestor"
|
||||||
v-bind:options="addPersons.options"
|
modalTitle="requestor.add_requestor"
|
||||||
@addNewPersons="addNewPersons"
|
v-bind:key="addPersons.key"
|
||||||
ref="addPersons"> <!-- to cast child method -->
|
v-bind:options="addPersons.options"
|
||||||
</add-persons>
|
@addNewPersons="addNewPersons"
|
||||||
|
ref="addPersons"> <!-- to cast child method -->
|
||||||
|
</add-persons>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@ -214,7 +218,7 @@ export default {
|
|||||||
accompanyingCourse() {
|
accompanyingCourse() {
|
||||||
return this.$store.state.accompanyingCourse
|
return this.$store.state.accompanyingCourse
|
||||||
},
|
},
|
||||||
isAnonymous: {
|
requestorIsAnonymous: {
|
||||||
set(value) {
|
set(value) {
|
||||||
this.$store.dispatch('requestorIsAnonymous', value);
|
this.$store.dispatch('requestorIsAnonymous', value);
|
||||||
},
|
},
|
||||||
@ -283,7 +287,9 @@ export default {
|
|||||||
body.name = payload.data.text;
|
body.name = payload.data.text;
|
||||||
body.email = payload.data.email;
|
body.email = payload.data.email;
|
||||||
body.telephone = payload.data.phonenumber;
|
body.telephone = payload.data.phonenumber;
|
||||||
body.address = { id: payload.data.address.address_id };
|
if (payload.data.address) {
|
||||||
|
body.address = { id: payload.data.address.address_id };
|
||||||
|
}
|
||||||
|
|
||||||
makeFetch('PATCH', `/api/1.0/thirdparty/thirdparty/${payload.data.id}.json`, body)
|
makeFetch('PATCH', `/api/1.0/thirdparty/thirdparty/${payload.data.id}.json`, body)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
|
@ -29,14 +29,18 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<add-persons
|
<ul class="record_actions">
|
||||||
buttonTitle="resources.add_resources"
|
<li class="add-persons">
|
||||||
modalTitle="resources.add_resources"
|
<add-persons
|
||||||
v-bind:key="addPersons.key"
|
buttonTitle="resources.add_resources"
|
||||||
v-bind:options="addPersons.options"
|
modalTitle="resources.add_resources"
|
||||||
@addNewPersons="addNewPersons"
|
v-bind:key="addPersons.key"
|
||||||
ref="addPersons"> <!-- to cast child method -->
|
v-bind:options="addPersons.options"
|
||||||
</add-persons>
|
@addNewPersons="addNewPersons"
|
||||||
|
ref="addPersons"> <!-- to cast child method -->
|
||||||
|
</add-persons>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -140,7 +140,7 @@ const appMessages = {
|
|||||||
sure_description: "Une fois le changement confirmé, il ne sera plus possible de le remettre à l'état de brouillon !",
|
sure_description: "Une fois le changement confirmé, il ne sera plus possible de le remettre à l'état de brouillon !",
|
||||||
ok: "Confirmer le parcours",
|
ok: "Confirmer le parcours",
|
||||||
delete: "Supprimer le parcours",
|
delete: "Supprimer le parcours",
|
||||||
no_suggested_referrer: "Il n'y a aucun référent qui puisse être désigné pour ce parcours. Vérifiez la localisation du parcours, les métiers et service indiqués. Si le problème persiste, contactez l'administrateur du logiciel.",
|
no_suggested_referrer: "Il n'y a aucun référent qui puisse être suggéré pour ce parcours. Vérifiez la localisation du parcours, les métiers et service indiqués. Si les données sont correctes, vous pouvez confirmer ce parcours.",
|
||||||
one_suggested_referrer: "Un unique référent peut être suggéré pour ce parcours",
|
one_suggested_referrer: "Un unique référent peut être suggéré pour ce parcours",
|
||||||
choose_suggested_referrer: "Voulez-vous le désigner directement ?",
|
choose_suggested_referrer: "Voulez-vous le désigner directement ?",
|
||||||
choose_button: "Désigner",
|
choose_button: "Désigner",
|
||||||
|
@ -40,7 +40,6 @@ let initPromise = (root) => Promise.all([getScopesPromise(root), accompanyingCou
|
|||||||
scopesAtBackend: accompanyingCourse.scopes.map(scope => scope),
|
scopesAtBackend: accompanyingCourse.scopes.map(scope => scope),
|
||||||
// the users which are available for referrer
|
// the users which are available for referrer
|
||||||
referrersSuggested: [],
|
referrersSuggested: [],
|
||||||
filteredReferrersSuggested: [],
|
|
||||||
// all the users available
|
// all the users available
|
||||||
users: [],
|
users: [],
|
||||||
permissions: {}
|
permissions: {}
|
||||||
@ -93,6 +92,30 @@ let initPromise = (root) => Promise.all([getScopesPromise(root), accompanyingCou
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
usersFilteredByJob(state) {
|
||||||
|
return state.users.filter(u => {
|
||||||
|
if (null !== state.accompanyingCourse.job) {
|
||||||
|
return (u.user_job === null ? null : u.user_job.id) === state.accompanyingCourse.job.id;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
usersSuggestedFilteredByJob(state) {
|
||||||
|
return state.referrersSuggested.filter(u => {
|
||||||
|
if (null !== state.accompanyingCourse.job) {
|
||||||
|
return (u.user_job === null ? null : u.user_job.id) === state.accompanyingCourse.job.id;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}).filter(u => {
|
||||||
|
if (null !== state.accompanyingCourse.user) {
|
||||||
|
return u.id !== state.accompanyingCourse.user.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
},
|
||||||
},
|
},
|
||||||
mutations: {
|
mutations: {
|
||||||
catchError(state, error) {
|
catchError(state, error) {
|
||||||
@ -216,22 +239,6 @@ let initPromise = (root) => Promise.all([getScopesPromise(root), accompanyingCou
|
|||||||
return u;
|
return u;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
setFilteredReferrersSuggested(state) {
|
|
||||||
state.filteredReferrersSuggested = state.referrersSuggested.filter(u => {
|
|
||||||
if (u.user_job && state.accompanyingCourse.job && state.accompanyingCourse.user) {
|
|
||||||
return u.user_job.id === state.accompanyingCourse.job.id && state.accompanyingCourse.user.id !== u.id
|
|
||||||
} else {
|
|
||||||
if (null === state.accompanyingCourse.user) {
|
|
||||||
if (u.user_job && state.accompanyingCourse.job) {
|
|
||||||
return u.user_job.id === state.accompanyingCourse.job.id
|
|
||||||
} else {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return state.accompanyingCourse.user.id !== u.id;
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
confirmAccompanyingCourse(state, response) {
|
confirmAccompanyingCourse(state, response) {
|
||||||
//console.log('### mutation: confirmAccompanyingCourse: response', response);
|
//console.log('### mutation: confirmAccompanyingCourse: response', response);
|
||||||
state.accompanyingCourse.step = response.step;
|
state.accompanyingCourse.step = response.step;
|
||||||
@ -421,42 +428,6 @@ let initPromise = (root) => Promise.all([getScopesPromise(root), accompanyingCou
|
|||||||
throw error;
|
throw error;
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
/**
|
|
||||||
* On The Fly
|
|
||||||
*/
|
|
||||||
patchOnTheFly({ commit }, payload) {
|
|
||||||
// TODO should be into the dedicated component, no ? JF
|
|
||||||
console.log('## action: patch OnTheFly', payload);
|
|
||||||
let body = { type: payload.type };
|
|
||||||
if (payload.type === 'person') {
|
|
||||||
body.firstName = payload.data.firstName;
|
|
||||||
body.lastName = payload.data.lastName;
|
|
||||||
if (payload.data.birthdate !== null) { body.birthdate = payload.data.birthdate; }
|
|
||||||
body.phonenumber = payload.data.phonenumber;
|
|
||||||
body.mobilenumber = payload.data.mobilenumber;
|
|
||||||
body.gender = payload.data.gender;
|
|
||||||
console.log('id', payload.data.id, 'and body', body);
|
|
||||||
patchPerson(payload.data.id, body)
|
|
||||||
.then(person => new Promise((resolve, reject) => {
|
|
||||||
console.log('patch person', person);
|
|
||||||
commit('updatePerson', { target: payload.target, person: person });
|
|
||||||
resolve();
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
else if (payload.type === 'thirdparty') {
|
|
||||||
body.name = payload.data.text;
|
|
||||||
body.email = payload.data.email;
|
|
||||||
body.telephone = payload.data.phonenumber;
|
|
||||||
body.address = { id: payload.data.address.address_id };
|
|
||||||
console.log('id', payload.data.id, 'and body', body);
|
|
||||||
patchThirdparty(payload.data.id, body)
|
|
||||||
.then(thirdparty => new Promise((resolve, reject) => {
|
|
||||||
console.log('patch thirdparty', thirdparty);
|
|
||||||
commit('updateThirdparty', { target: payload.target, thirdparty: thirdparty });
|
|
||||||
resolve();
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
},
|
|
||||||
/**
|
/**
|
||||||
* Update accompanying course intensity/emergency/confidentiality
|
* Update accompanying course intensity/emergency/confidentiality
|
||||||
*/
|
*/
|
||||||
@ -689,8 +660,14 @@ let initPromise = (root) => Promise.all([getScopesPromise(root), accompanyingCou
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
updateReferrer({ commit }, payload) {
|
updateReferrer({ commit }, payload) {
|
||||||
|
console.log('update referrer', payload);
|
||||||
|
console.log('payload !== null', payload !== null);
|
||||||
const url = `/api/1.0/person/accompanying-course/${id}.json`;
|
const url = `/api/1.0/person/accompanying-course/${id}.json`;
|
||||||
const body = { type: "accompanying_period", user: { id: payload.id, type: payload.type }};
|
let body = { type: "accompanying_period", user: null };
|
||||||
|
|
||||||
|
if (payload !== null) {
|
||||||
|
body = { type: "accompanying_period", user: { id: payload.id, type: payload.type } };
|
||||||
|
}
|
||||||
|
|
||||||
return makeFetch('PATCH', url, body)
|
return makeFetch('PATCH', url, body)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
@ -704,12 +681,15 @@ let initPromise = (root) => Promise.all([getScopesPromise(root), accompanyingCou
|
|||||||
},
|
},
|
||||||
updateJob({ commit }, payload) {
|
updateJob({ commit }, payload) {
|
||||||
const url = `/api/1.0/person/accompanying-course/${id}.json`;
|
const url = `/api/1.0/person/accompanying-course/${id}.json`;
|
||||||
const body = { type: "accompanying_period", job: { id: payload.id, type: payload.type }};
|
let body = { type: "accompanying_period", job: null };
|
||||||
|
|
||||||
|
if (payload !== null) {
|
||||||
|
body = { type: "accompanying_period", job: { id: payload.id, type: payload.type } };
|
||||||
|
}
|
||||||
|
|
||||||
return makeFetch('PATCH', url, body)
|
return makeFetch('PATCH', url, body)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
commit('updateJob', response.job);
|
commit('updateJob', response.job);
|
||||||
commit('setFilteredReferrersSuggested');
|
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
commit('catchError', error);
|
commit('catchError', error);
|
||||||
@ -734,7 +714,6 @@ let initPromise = (root) => Promise.all([getScopesPromise(root), accompanyingCou
|
|||||||
async fetchReferrersSuggested({ state, commit}) {
|
async fetchReferrersSuggested({ state, commit}) {
|
||||||
let users = await getReferrersSuggested(state.accompanyingCourse);
|
let users = await getReferrersSuggested(state.accompanyingCourse);
|
||||||
commit('setReferrersSuggested', users);
|
commit('setReferrersSuggested', users);
|
||||||
commit('setFilteredReferrersSuggested');
|
|
||||||
if (
|
if (
|
||||||
null === state.accompanyingCourse.user
|
null === state.accompanyingCourse.user
|
||||||
&& !state.accompanyingCourse.confidential
|
&& !state.accompanyingCourse.confidential
|
||||||
|
@ -160,7 +160,7 @@
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<ul class="record_actions">
|
<ul class="record_actions">
|
||||||
<li>
|
<li class="add-persons">
|
||||||
<add-persons
|
<add-persons
|
||||||
ref="handlingThirdPartyPicker"
|
ref="handlingThirdPartyPicker"
|
||||||
v-bind:key="handlingThirdPartyPicker.key"
|
v-bind:key="handlingThirdPartyPicker.key"
|
||||||
@ -222,7 +222,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ul class="record_actions">
|
<ul class="record_actions">
|
||||||
<li>
|
<li class="add-persons">
|
||||||
<add-persons
|
<add-persons
|
||||||
ref="thirdPartyPicker"
|
ref="thirdPartyPicker"
|
||||||
v-bind:key="thirdPartyPicker.key"
|
v-bind:key="thirdPartyPicker.key"
|
||||||
|
@ -397,36 +397,6 @@ const store = createStore({
|
|||||||
commit('setErrors', error.violations);
|
commit('setErrors', error.violations);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
patchOnTheFly({ commit }, payload) {
|
|
||||||
let body = { type: payload.type };
|
|
||||||
const id = payload.data.id;
|
|
||||||
let url = `/api/1.0/person/person/${id}.json`;
|
|
||||||
let mutation = "updatePerson";
|
|
||||||
|
|
||||||
if (payload.type === 'person') {
|
|
||||||
body.firstName = payload.data.firstName;
|
|
||||||
body.lastName = payload.data.lastName;
|
|
||||||
if (payload.data.birthdate !== null) { body.birthdate = payload.data.birthdate; }
|
|
||||||
body.phonenumber = payload.data.phonenumber;
|
|
||||||
body.mobilenumber = payload.data.mobilenumber;
|
|
||||||
body.gender = payload.data.gender;
|
|
||||||
} else if (payload.type === 'thirdparty') {
|
|
||||||
body.name = payload.data.text;
|
|
||||||
body.email = payload.data.email;
|
|
||||||
body.telephone = payload.data.phonenumber;
|
|
||||||
body.address = { id: payload.data.address.address_id };
|
|
||||||
|
|
||||||
url = `/api/1.0/thirdparty/thirdparty/${id}.json`;
|
|
||||||
mutation = 'updateThirdparty'
|
|
||||||
}
|
|
||||||
makeFetch('PATCH', url, body)
|
|
||||||
.then((response) => {
|
|
||||||
commit(mutation, {target: payload.target, thirdparty: response});
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
throw error;
|
|
||||||
})
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ul class="record_actions">
|
<ul class="record_actions">
|
||||||
<li>
|
<li class="add-persons">
|
||||||
<add-persons
|
<add-persons
|
||||||
buttonTitle="household_members_editor.concerned.add_persons"
|
buttonTitle="household_members_editor.concerned.add_persons"
|
||||||
modalTitle="household_members_editor.concerned.search"
|
modalTitle="household_members_editor.concerned.search"
|
||||||
|
@ -61,7 +61,7 @@
|
|||||||
<li v-if="hasHousehold">
|
<li v-if="hasHousehold">
|
||||||
<button @click="resetMode" class="btn btn-sm btn-misc">{{ $t('household_members_editor.household.reset_mode')}}</button>
|
<button @click="resetMode" class="btn btn-sm btn-misc">{{ $t('household_members_editor.household.reset_mode')}}</button>
|
||||||
</li>
|
</li>
|
||||||
<li v-if="!hasHousehold">
|
<li v-if="!hasHousehold" class="add-persons">
|
||||||
<add-persons
|
<add-persons
|
||||||
modalTitle="Chercher un ménage existant"
|
modalTitle="Chercher un ménage existant"
|
||||||
buttonTitle="Chercher un ménage existant"
|
buttonTitle="Chercher un ménage existant"
|
||||||
|
@ -1,10 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<ul class="record_actions">
|
<a class="btn" :class="getClassButton" :title="$t(buttonTitle)" @click="openModal">
|
||||||
<li class="add-persons">
|
<span v-if="displayTextButton">{{ $t(buttonTitle) }}</span>
|
||||||
<a class="btn" :class="getClassButton" :title="$t(buttonTitle)"
|
</a>
|
||||||
@click="openModal"><span v-if="displayTextButton">{{ $t(buttonTitle) }}</span></a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<teleport to="body">
|
<teleport to="body">
|
||||||
<modal v-if="modal.showModal"
|
<modal v-if="modal.showModal"
|
||||||
@ -66,8 +63,10 @@
|
|||||||
|
|
||||||
<div class="create-button">
|
<div class="create-button">
|
||||||
<on-the-fly
|
<on-the-fly
|
||||||
v-if="query.length >= 3"
|
v-if="queryLength >= 3 && (options.type.includes('person') || options.type.includes('thirdparty'))"
|
||||||
:buttonText="$t('onthefly.create.button', {q: query})"
|
:buttonText="$t('onthefly.create.button', {q: query})"
|
||||||
|
:allowedTypes="options.type"
|
||||||
|
:query="query"
|
||||||
action="create"
|
action="create"
|
||||||
@saveFormOnTheFly="saveFormOnTheFly"
|
@saveFormOnTheFly="saveFormOnTheFly"
|
||||||
ref="onTheFly">
|
ref="onTheFly">
|
||||||
|
@ -32,6 +32,14 @@
|
|||||||
<label for="lastname">{{ $t('person.lastname') }}</label>
|
<label for="lastname">{{ $t('person.lastname') }}</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div v-if="queryItems">
|
||||||
|
<ul class="list-suggest add-items inline">
|
||||||
|
<li v-for="(qi, i) in queryItems" :key="i" @click="addQueryItem('lastName', qi)">
|
||||||
|
<span class="person-text">{{ qi }}</span>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="form-floating mb-3">
|
<div class="form-floating mb-3">
|
||||||
<input
|
<input
|
||||||
class="form-control form-control-lg"
|
class="form-control form-control-lg"
|
||||||
@ -43,6 +51,14 @@
|
|||||||
<label for="firstname">{{ $t('person.firstname') }}</label>
|
<label for="firstname">{{ $t('person.firstname') }}</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div v-if="queryItems">
|
||||||
|
<ul class="list-suggest add-items inline">
|
||||||
|
<li v-for="(qi, i) in queryItems" :key="i" @click="addQueryItem('firstName', qi)">
|
||||||
|
<span class="person-text">{{ qi }}</span>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div v-for="(a, i) in config.altNames" :key="a.key" class="form-floating mb-3">
|
<div v-for="(a, i) in config.altNames" :key="a.key" class="form-floating mb-3">
|
||||||
<input
|
<input
|
||||||
class="form-control form-control-lg"
|
class="form-control form-control-lg"
|
||||||
@ -122,7 +138,7 @@ import PersonRenderBox from '../Entity/PersonRenderBox.vue';
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "OnTheFlyPerson",
|
name: "OnTheFlyPerson",
|
||||||
props: ['id', 'type', 'action'],
|
props: ['id', 'type', 'action', 'query'],
|
||||||
//emits: ['createAction'],
|
//emits: ['createAction'],
|
||||||
components: {
|
components: {
|
||||||
PersonRenderBox
|
PersonRenderBox
|
||||||
@ -203,6 +219,9 @@ export default {
|
|||||||
},
|
},
|
||||||
personAltNamesLabels() {
|
personAltNamesLabels() {
|
||||||
return this.person.altNames.map(a => a ? a.label : '');
|
return this.person.altNames.map(a => a ? a.label : '');
|
||||||
|
},
|
||||||
|
queryItems() {
|
||||||
|
return this.query ? this.query.split(' ') : null;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
@ -244,6 +263,16 @@ export default {
|
|||||||
)
|
)
|
||||||
this.person.altNames = updateAltNames;
|
this.person.altNames = updateAltNames;
|
||||||
},
|
},
|
||||||
|
addQueryItem(field, queryItem) {
|
||||||
|
switch (field) {
|
||||||
|
case 'lastName':
|
||||||
|
this.person.lastName = queryItem;
|
||||||
|
break;
|
||||||
|
case 'firstName':
|
||||||
|
this.person.firstName = queryItem;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -23,6 +23,8 @@
|
|||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{{ chill_pagination(paginator) }}
|
||||||
|
|
||||||
<ul class="record_actions sticky-form-buttons">
|
<ul class="record_actions sticky-form-buttons">
|
||||||
<li>
|
<li>
|
||||||
<a href="{{ chill_path_add_return_path('chill_person_accompanying_period_work_new', { 'id': accompanyingCourse.id }) }}"
|
<a href="{{ chill_path_add_return_path('chill_person_accompanying_period_work_new', { 'id': accompanyingCourse.id }) }}"
|
||||||
|
@ -26,9 +26,9 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="wh-row">
|
<div class="wh-row">
|
||||||
<div class="wh-col">
|
<div class="wh-col">
|
||||||
{% if period.closingDate == null %}
|
{% if period.closingDate == null and period.step != 'DRAFT' %}
|
||||||
{{ 'accompanying_period.dates_from_%opening_date%'|trans({ '%opening_date%': period.openingDate|format_date('long') } ) }}
|
{{ 'accompanying_period.dates_from_%opening_date%'|trans({ '%opening_date%': period.openingDate|format_date('long') } ) }}
|
||||||
{% else %}
|
{% elseif period.closingDate != null %}
|
||||||
{{ 'accompanying_period.dates_from_%opening_date%_to_%closing_date%'|trans({
|
{{ 'accompanying_period.dates_from_%opening_date%_to_%closing_date%'|trans({
|
||||||
'%opening_date%': period.openingDate|format_date('long'),
|
'%opening_date%': period.openingDate|format_date('long'),
|
||||||
'%closing_date%': period.closingDate|format_date('long')}
|
'%closing_date%': period.closingDate|format_date('long')}
|
||||||
@ -41,7 +41,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
<div class="wh-col">
|
<div class="wh-col" style="align-items: center;">
|
||||||
{% if chill_accompanying_periods.fields.user == 'visible' %}
|
{% if chill_accompanying_periods.fields.user == 'visible' %}
|
||||||
{# the tags `data-referrer-text` is used by module `@ChillPerson/mod/AccompanyingPeriod/setReferrer.js` #}
|
{# the tags `data-referrer-text` is used by module `@ChillPerson/mod/AccompanyingPeriod/setReferrer.js` #}
|
||||||
{% if period.user %}
|
{% if period.user %}
|
||||||
@ -55,65 +55,67 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="item-row separator">
|
{% if period.requestor is not null or period.participations.count > 0 or period.socialIssues.count > 0%}
|
||||||
<div class="wrap-list">
|
<div class="item-row separator">
|
||||||
{% if period.requestorPerson is not null or period.requestorThirdParty is not null %}
|
<div class="wrap-list">
|
||||||
<div class="wl-row">
|
{% if period.requestorPerson is not null or period.requestorThirdParty is not null %}
|
||||||
<div class="wl-col title"><h3>{{ 'Requestor'|trans({'gender': null }) }}</h3></div>
|
<div class="wl-row">
|
||||||
<div class="wl-col list">
|
<div class="wl-col title"><h3>{{ 'Requestor'|trans({'gender': null }) }}</h3></div>
|
||||||
{% if period.requestorPerson is not null %}
|
<div class="wl-col list">
|
||||||
<span class="wl-item">
|
{% if period.requestorPerson is not null %}
|
||||||
{% include '@ChillMain/OnTheFly/_insert_vue_onthefly.html.twig' with {
|
<span class="wl-item">
|
||||||
action: 'show', displayBadge: true,
|
{% include '@ChillMain/OnTheFly/_insert_vue_onthefly.html.twig' with {
|
||||||
targetEntity: { name: 'person', id: period.requestorPerson.id },
|
action: 'show', displayBadge: true,
|
||||||
buttonText: period.requestorPerson|chill_entity_render_string,
|
targetEntity: { name: 'person', id: period.requestorPerson.id },
|
||||||
isDead: period.requestorPerson.deathdate is not null
|
buttonText: period.requestorPerson|chill_entity_render_string,
|
||||||
} %}
|
isDead: period.requestorPerson.deathdate is not null
|
||||||
</span>
|
} %}
|
||||||
{% endif %}
|
</span>
|
||||||
{% if period.requestorThirdParty is not null %}
|
{% endif %}
|
||||||
<span class="wl-item">
|
{% if period.requestorThirdParty is not null %}
|
||||||
{% include '@ChillMain/OnTheFly/_insert_vue_onthefly.html.twig' with {
|
<span class="wl-item">
|
||||||
action: 'show', displayBadge: true,
|
{% include '@ChillMain/OnTheFly/_insert_vue_onthefly.html.twig' with {
|
||||||
targetEntity: { name: 'thirdparty', id: period.requestorThirdParty.id },
|
action: 'show', displayBadge: true,
|
||||||
buttonText: period.requestorThirdParty|chill_entity_render_string
|
targetEntity: { name: 'thirdparty', id: period.requestorThirdParty.id },
|
||||||
} %}
|
buttonText: period.requestorThirdParty|chill_entity_render_string
|
||||||
</span>
|
} %}
|
||||||
{% endif %}
|
</span>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
{% endif %}
|
||||||
{% endif %}
|
{% if period.participations.count > 0 %}
|
||||||
{% if period.participations.count > 0 %}
|
<div class="wl-row">
|
||||||
<div class="wl-row">
|
<div class="wl-col title"><h3>{{ 'Participants'|trans }}</h3></div>
|
||||||
<div class="wl-col title"><h3>{{ 'Participants'|trans }}</h3></div>
|
<div class="wl-col list">
|
||||||
<div class="wl-col list">
|
{% for p in period.getCurrentParticipations %}
|
||||||
{% for p in period.getCurrentParticipations %}
|
<span class="wl-item">
|
||||||
<span class="wl-item">
|
{% include '@ChillMain/OnTheFly/_insert_vue_onthefly.html.twig' with {
|
||||||
{% include '@ChillMain/OnTheFly/_insert_vue_onthefly.html.twig' with {
|
action: 'show', displayBadge: true,
|
||||||
action: 'show', displayBadge: true,
|
targetEntity: { name: 'person', id: p.person.id },
|
||||||
targetEntity: { name: 'person', id: p.person.id },
|
buttonText: p.person|chill_entity_render_string,
|
||||||
buttonText: p.person|chill_entity_render_string,
|
isDead: p.person.deathdate is not null
|
||||||
isDead: p.person.deathdate is not null
|
} %}
|
||||||
} %}
|
</span>
|
||||||
</span>
|
{% endfor %}
|
||||||
{% endfor %}
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
{% endif %}
|
||||||
{% endif %}
|
{% if period.socialIssues.count > 0 %}
|
||||||
{% if period.socialIssues.count > 0 %}
|
<div class="wl-row">
|
||||||
<div class="wl-row">
|
<div class="wl-col title"><h3>{{ 'Social issues'|trans }}</h3></div>
|
||||||
<div class="wl-col title"><h3>{{ 'Social issues'|trans }}</h3></div>
|
<div class="wl-col list">
|
||||||
<div class="wl-col list">
|
{% for si in period.socialIssues %}
|
||||||
{% for si in period.socialIssues %}
|
<p class="wl-item">
|
||||||
<p class="wl-item">
|
{{ si|chill_entity_render_box }}
|
||||||
{{ si|chill_entity_render_box }}
|
</p>
|
||||||
</p>
|
{% endfor %}
|
||||||
{% endfor %}
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
{% endif %}
|
||||||
{% endif %}
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
{% endif %}
|
||||||
<div class="item-row separator">
|
<div class="item-row separator">
|
||||||
<div class="item-col item-meta">
|
<div class="item-col item-meta">
|
||||||
{% set notif_counter = chill_count_notifications('Chill\\PersonBundle\\Entity\\AccompanyingPeriod', period.id) %}
|
{% set notif_counter = chill_count_notifications('Chill\\PersonBundle\\Entity\\AccompanyingPeriod', period.id) %}
|
||||||
|
@ -0,0 +1,32 @@
|
|||||||
|
{% extends "@ChillMain/layout.html.twig" %}
|
||||||
|
|
||||||
|
{% set activeRouteKey = 'chill_person_accompanying_period_user_list' %}
|
||||||
|
|
||||||
|
{% block title %}{{ 'My accompanying periods in draft'|trans }}{% endblock title %}
|
||||||
|
|
||||||
|
{% macro recordAction(period) %}
|
||||||
|
<li>
|
||||||
|
<a href="{{ path('chill_person_accompanying_course_index', { 'accompanying_period_id': period.id }) }}"
|
||||||
|
class="btn btn-show" title="{{ 'See accompanying period'|trans }}"></a>
|
||||||
|
</li>
|
||||||
|
{% endmacro %}
|
||||||
|
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
|
||||||
|
<div class="col-md-10">
|
||||||
|
<h1>{{ 'My accompanying periods in draft'|trans }}</h1>
|
||||||
|
|
||||||
|
<div class="flex-table accompanyingcourse-list">
|
||||||
|
{% for period in accompanyingPeriods %}
|
||||||
|
{% include '@ChillPerson/AccompanyingPeriod/_list_item.html.twig' with {'period': period, 'recordAction': _self.recordAction(period)} %}
|
||||||
|
{% else %}
|
||||||
|
<p class="chill-no-data-statement">{{ 'Any accompanying period'|trans }}</p>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{ chill_pagination(pagination) }}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% endblock %}
|
@ -115,6 +115,9 @@
|
|||||||
<li>
|
<li>
|
||||||
{{ form_widget(form.editPerson, { 'attr': { 'class': 'dropdown-item' }}) }}
|
{{ form_widget(form.editPerson, { 'attr': { 'class': 'dropdown-item' }}) }}
|
||||||
</li>
|
</li>
|
||||||
|
<li>
|
||||||
|
{{ form_widget(form.createHousehold, { 'attr': { 'class': 'dropdown-item' }}) }}
|
||||||
|
</li>
|
||||||
<li>
|
<li>
|
||||||
{{ form_widget(form.createPeriod, { 'attr': { 'class': 'dropdown-item' }}) }}
|
{{ form_widget(form.createPeriod, { 'attr': { 'class': 'dropdown-item' }}) }}
|
||||||
</li>
|
</li>
|
||||||
|
@ -32,14 +32,28 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="item-row separator">
|
<div class="item-row separator">
|
||||||
<div class="wrap-list">
|
<div class="wrap-list">
|
||||||
|
{% if p.household is same as p.person.getCurrentHousehold %}
|
||||||
|
<div class="wl-row">
|
||||||
|
<div class="wl-col title">
|
||||||
|
<h3>{{ 'Address'|trans }}</h3>
|
||||||
|
</div>
|
||||||
|
<div class="wl-col list">
|
||||||
|
<p class="item">{{ p.household.getCurrentAddress|chill_entity_render_box }}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
<div class="wl-row">
|
<div class="wl-row">
|
||||||
<div class="wl-col title">
|
<div class="wl-col title">
|
||||||
<h3>En tant que</h3>
|
<h3>{{ 'household.As member'|trans }}</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="wl-col list">
|
<div class="wl-col list">
|
||||||
<p class="item">{{ p.position.label|localize_translatable_string }}
|
<p class="item">
|
||||||
|
{{ p.position.label|localize_translatable_string }}
|
||||||
{% if p.holder %}
|
{% if p.holder %}
|
||||||
<span class="holder">{{ 'household.holder'|trans }}</span>
|
<span class="fa-stack fa-holder" title="{{ 'houshold.holder'|trans|e('html_attr') }}">
|
||||||
|
<i class="fa fa-circle fa-stack-1x text-success"></i>
|
||||||
|
<i class="fa fa-stack-1x">T</i>
|
||||||
|
</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
@ -29,10 +29,10 @@
|
|||||||
|
|
||||||
<div class="item-col" style="width: 33%;">
|
<div class="item-col" style="width: 33%;">
|
||||||
<ul class="list-unstyled h3">
|
<ul class="list-unstyled h3">
|
||||||
{% if a.endDate is not null %}
|
|
||||||
<li><span class="item-key">{{'Since'|trans}} : </span>{{ a.startDate|format_date('long') }}</li>
|
<li><span class="item-key">{{'Since'|trans}} : </span>{{ a.startDate|format_date('long') }}</li>
|
||||||
|
{% if a.endDate is not null %}
|
||||||
|
<li><span class="item-key">{{'Until'|trans}} : </span><b>{{ a.endDate|format_date('long') }}</b></li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<li><span class="item-key">{{'Until'|trans}} : </span><b>{{ a.endDate|format_date('long') }}</b></li>
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="item-col flex-column justify-content-start">
|
<div class="item-col flex-column justify-content-start">
|
||||||
|
@ -11,17 +11,23 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Chill\PersonBundle\Security\Authorization;
|
namespace Chill\PersonBundle\Security\Authorization;
|
||||||
|
|
||||||
|
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||||
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork;
|
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork;
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
||||||
use Symfony\Component\Security\Core\Authorization\Voter\Voter;
|
use Symfony\Component\Security\Core\Authorization\Voter\Voter;
|
||||||
use Symfony\Component\Security\Core\Security;
|
use Symfony\Component\Security\Core\Security;
|
||||||
use UnexpectedValueException;
|
use UnexpectedValueException;
|
||||||
|
use function get_class;
|
||||||
use function in_array;
|
use function in_array;
|
||||||
|
|
||||||
class AccompanyingPeriodWorkVoter extends Voter
|
class AccompanyingPeriodWorkVoter extends Voter
|
||||||
{
|
{
|
||||||
|
public const CREATE = 'CHILL_MAIN_ACCOMPANYING_PERIOD_WORK_CREATE';
|
||||||
|
|
||||||
public const SEE = 'CHILL_MAIN_ACCOMPANYING_PERIOD_WORK_SEE';
|
public const SEE = 'CHILL_MAIN_ACCOMPANYING_PERIOD_WORK_SEE';
|
||||||
|
|
||||||
|
public const UPDATE = 'CHILL_MAIN_ACCOMPANYING_PERIOD_WORK_UPDATE';
|
||||||
|
|
||||||
private Security $security;
|
private Security $security;
|
||||||
|
|
||||||
public function __construct(Security $security)
|
public function __construct(Security $security)
|
||||||
@ -31,8 +37,14 @@ class AccompanyingPeriodWorkVoter extends Voter
|
|||||||
|
|
||||||
protected function supports($attribute, $subject): bool
|
protected function supports($attribute, $subject): bool
|
||||||
{
|
{
|
||||||
return $subject instanceof AccompanyingPeriodWork
|
return
|
||||||
&& in_array($attribute, $this->getRoles(), true);
|
(
|
||||||
|
$subject instanceof AccompanyingPeriodWork
|
||||||
|
&& in_array($attribute, $this->getRoles(), true)
|
||||||
|
) || (
|
||||||
|
$subject instanceof AccompanyingPeriod
|
||||||
|
&& in_array($attribute, [self::SEE, self::CREATE], true)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -41,17 +53,40 @@ class AccompanyingPeriodWorkVoter extends Voter
|
|||||||
*/
|
*/
|
||||||
protected function voteOnAttribute($attribute, $subject, TokenInterface $token): bool
|
protected function voteOnAttribute($attribute, $subject, TokenInterface $token): bool
|
||||||
{
|
{
|
||||||
switch ($attribute) {
|
if ($subject instanceof AccompanyingPeriodWork) {
|
||||||
case self::SEE:
|
switch ($attribute) {
|
||||||
return $this->security->isGranted(AccompanyingPeriodVoter::SEE, $subject->getAccompanyingPeriod());
|
case self::SEE:
|
||||||
|
return $this->security->isGranted(AccompanyingPeriodVoter::SEE_DETAILS, $subject->getAccompanyingPeriod());
|
||||||
|
|
||||||
default:
|
case self::CREATE:
|
||||||
throw new UnexpectedValueException("attribute {$attribute} is not supported");
|
case self::UPDATE:
|
||||||
|
return $this->security->isGranted(AccompanyingPeriodVoter::EDIT, $subject->getAccompanyingPeriod());
|
||||||
|
|
||||||
|
|
||||||
|
default:
|
||||||
|
throw new UnexpectedValueException("attribute {$attribute} is not supported");
|
||||||
|
}
|
||||||
|
} elseif ($subject instanceof AccompanyingPeriod) {
|
||||||
|
switch ($attribute) {
|
||||||
|
case self::SEE:
|
||||||
|
return $this->security->isGranted(AccompanyingPeriodVoter::SEE_DETAILS, $subject);
|
||||||
|
|
||||||
|
case self::CREATE:
|
||||||
|
return $this->security->isGranted(AccompanyingPeriodVoter::CREATE, $subject);
|
||||||
|
|
||||||
|
default:
|
||||||
|
throw new UnexpectedValueException(sprintf(
|
||||||
|
"attribute {$attribute} is not supported on instance %s",
|
||||||
|
AccompanyingPeriod::class
|
||||||
|
));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
throw new UnexpectedValueException(sprintf("attribute {$attribute} on instance %s is not supported", get_class($subject)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getRoles(): array
|
private function getRoles(): array
|
||||||
{
|
{
|
||||||
return [self::SEE];
|
return [self::SEE, self::CREATE, self::UPDATE];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -91,7 +91,7 @@ class PersonJsonNormalizer implements
|
|||||||
'deathdate',
|
'deathdate',
|
||||||
'center',
|
'center',
|
||||||
'altNames',
|
'altNames',
|
||||||
'email'
|
'email',
|
||||||
];
|
];
|
||||||
|
|
||||||
$fields = array_filter(
|
$fields = array_filter(
|
||||||
|
@ -241,7 +241,8 @@ class AccompanyingPeriodContext implements
|
|||||||
public function storeGenerated(DocGeneratorTemplate $template, StoredObject $storedObject, object $entity, array $contextGenerationData): void
|
public function storeGenerated(DocGeneratorTemplate $template, StoredObject $storedObject, object $entity, array $contextGenerationData): void
|
||||||
{
|
{
|
||||||
$doc = new AccompanyingCourseDocument();
|
$doc = new AccompanyingCourseDocument();
|
||||||
$doc->setTitle($this->translatableStringHelper->localize($template->getName()))
|
$doc->setTemplate($template)
|
||||||
|
->setTitle($this->translatableStringHelper->localize($template->getName()))
|
||||||
->setDate(new DateTime())
|
->setDate(new DateTime())
|
||||||
->setDescription($this->translatableStringHelper->localize($template->getName()))
|
->setDescription($this->translatableStringHelper->localize($template->getName()))
|
||||||
->setCourse($entity)
|
->setCourse($entity)
|
||||||
|
@ -21,6 +21,7 @@ use Chill\PersonBundle\Entity\Household\HouseholdMember;
|
|||||||
use Chill\PersonBundle\Entity\Person;
|
use Chill\PersonBundle\Entity\Person;
|
||||||
use DateTime;
|
use DateTime;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
use RuntimeException;
|
||||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use function array_map;
|
use function array_map;
|
||||||
@ -58,10 +59,16 @@ final class HouseholdApiControllerTest extends WebTestCase
|
|||||||
$centerA = $em->getRepository(Center::class)->findOneBy(['name' => 'Center A']);
|
$centerA = $em->getRepository(Center::class)->findOneBy(['name' => 'Center A']);
|
||||||
$nbReference = $em->createQueryBuilder()->select('count(ar)')->from(AddressReference::class, 'ar')
|
$nbReference = $em->createQueryBuilder()->select('count(ar)')->from(AddressReference::class, 'ar')
|
||||||
->getQuery()->getSingleScalarResult();
|
->getQuery()->getSingleScalarResult();
|
||||||
|
|
||||||
|
if (0 === $nbReference) {
|
||||||
|
throw new RuntimeException('any reference found. Add a reference in database to perform this test');
|
||||||
|
}
|
||||||
|
|
||||||
$reference = $em->createQueryBuilder()->select('ar')->from(AddressReference::class, 'ar')
|
$reference = $em->createQueryBuilder()->select('ar')->from(AddressReference::class, 'ar')
|
||||||
->setFirstResult(random_int(0, $nbReference))
|
->setFirstResult(random_int(0, $nbReference))
|
||||||
->setMaxResults(1)
|
->setMaxResults(1)
|
||||||
->getQuery()->getSingleResult();
|
->getQuery()->getSingleResult();
|
||||||
|
|
||||||
$p = new Person();
|
$p = new Person();
|
||||||
$p->setFirstname('test')->setLastName('test lastname')
|
$p->setFirstname('test')->setLastName('test lastname')
|
||||||
->setGender(Person::BOTH_GENDER)
|
->setGender(Person::BOTH_GENDER)
|
||||||
@ -79,6 +86,7 @@ final class HouseholdApiControllerTest extends WebTestCase
|
|||||||
[HouseholdMember::class, $m->getId()],
|
[HouseholdMember::class, $m->getId()],
|
||||||
[User::class, $p->getId()],
|
[User::class, $p->getId()],
|
||||||
[Household::class, $h->getId()],
|
[Household::class, $h->getId()],
|
||||||
|
[Person::class, $p->getId()],
|
||||||
];
|
];
|
||||||
|
|
||||||
yield [$reference->getId(), $h->getId()];
|
yield [$reference->getId(), $h->getId()];
|
||||||
|
@ -129,20 +129,27 @@ final class AccompanyingPeriodTest extends \PHPUnit\Framework\TestCase
|
|||||||
$this->assertNull($period->getPinnedComment());
|
$this->assertNull($period->getPinnedComment());
|
||||||
|
|
||||||
$period->setPinnedComment($comment);
|
$period->setPinnedComment($comment);
|
||||||
|
|
||||||
$this->assertSame($period->getPinnedComment(), $comment);
|
$this->assertSame($period->getPinnedComment(), $comment);
|
||||||
$this->assertSame($period, $comment->getAccompanyingPeriod());
|
$this->assertNull($comment->getAccompanyingPeriod());
|
||||||
$this->assertEquals(0, count($period->getComments()), 'The initial comment should not appears in the list of comments');
|
$this->assertEquals(0, count($period->getComments()));
|
||||||
|
|
||||||
$period->setPinnedComment($replacingComment);
|
$period->setPinnedComment($replacingComment);
|
||||||
|
|
||||||
$this->assertSame($period->getPinnedComment(), $replacingComment);
|
$this->assertSame($period->getPinnedComment(), $replacingComment);
|
||||||
$this->assertSame($period, $replacingComment->getAccompanyingPeriod());
|
$this->assertNull($replacingComment->getAccompanyingPeriod());
|
||||||
$this->assertEquals(0, count($period->getComments()), 'The initial comment should not appears in the list of comments');
|
$this->assertSame($period, $comment->getAccompanyingPeriod());
|
||||||
$this->assertNull($comment->getAccompanyingPeriod());
|
$this->assertEquals(1, count($period->getComments()));
|
||||||
|
$this->assertContains($comment, $period->getComments());
|
||||||
|
|
||||||
$period->setPinnedComment(null);
|
$period->setPinnedComment(null);
|
||||||
|
|
||||||
$this->assertNull($period->getPinnedComment());
|
$this->assertNull($period->getPinnedComment());
|
||||||
$this->assertNull($replacingComment->getAccompanyingPeriod());
|
$this->assertSame($period, $comment->getAccompanyingPeriod());
|
||||||
$this->assertEquals(0, count($period->getComments()), 'The initial comment should not appears in the list of comments');
|
$this->assertSame($period, $replacingComment->getAccompanyingPeriod());
|
||||||
|
$this->assertEquals(2, count($period->getComments()));
|
||||||
|
$this->assertContains($comment, $period->getComments());
|
||||||
|
$this->assertContains($replacingComment, $period->getComments());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testRequestor()
|
public function testRequestor()
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user