mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-13 13:54:23 +00:00
Merge remote-tracking branch 'origin/features/edit-accompanying-period-social-work' into _vue_echanges
This commit is contained in:
commit
0b117e5158
@ -35,6 +35,7 @@ use Symfony\Component\Form\Extension\Core\Type\HiddenType;
|
|||||||
use Symfony\Component\Form\CallbackTransformer;
|
use Symfony\Component\Form\CallbackTransformer;
|
||||||
use Chill\PersonBundle\Form\DataTransformer\PersonToIdTransformer;
|
use Chill\PersonBundle\Form\DataTransformer\PersonToIdTransformer;
|
||||||
use Chill\PersonBundle\Templating\Entity\SocialIssueRender;
|
use Chill\PersonBundle\Templating\Entity\SocialIssueRender;
|
||||||
|
use Chill\PersonBundle\Templating\Entity\SocialActionRender;
|
||||||
|
|
||||||
class ActivityType extends AbstractType
|
class ActivityType extends AbstractType
|
||||||
{
|
{
|
||||||
@ -46,6 +47,10 @@ class ActivityType extends AbstractType
|
|||||||
|
|
||||||
protected TranslatableStringHelper $translatableStringHelper;
|
protected TranslatableStringHelper $translatableStringHelper;
|
||||||
|
|
||||||
|
protected SocialIssueRender $socialIssueRender;
|
||||||
|
|
||||||
|
protected SocialActionRender $socialActionRender;
|
||||||
|
|
||||||
protected array $timeChoices;
|
protected array $timeChoices;
|
||||||
|
|
||||||
public function __construct (
|
public function __construct (
|
||||||
@ -54,7 +59,8 @@ class ActivityType extends AbstractType
|
|||||||
ObjectManager $om,
|
ObjectManager $om,
|
||||||
TranslatableStringHelper $translatableStringHelper,
|
TranslatableStringHelper $translatableStringHelper,
|
||||||
array $timeChoices,
|
array $timeChoices,
|
||||||
SocialIssueRender $socialIssueRender
|
SocialIssueRender $socialIssueRender,
|
||||||
|
SocialActionRender $socialActionRender
|
||||||
) {
|
) {
|
||||||
if (!$tokenStorage->getToken()->getUser() instanceof User) {
|
if (!$tokenStorage->getToken()->getUser() instanceof User) {
|
||||||
throw new \RuntimeException("you should have a valid user");
|
throw new \RuntimeException("you should have a valid user");
|
||||||
@ -66,6 +72,7 @@ class ActivityType extends AbstractType
|
|||||||
$this->translatableStringHelper = $translatableStringHelper;
|
$this->translatableStringHelper = $translatableStringHelper;
|
||||||
$this->timeChoices = $timeChoices;
|
$this->timeChoices = $timeChoices;
|
||||||
$this->socialIssueRender = $socialIssueRender;
|
$this->socialIssueRender = $socialIssueRender;
|
||||||
|
$this->socialActionRender = $socialActionRender;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||||
@ -133,7 +140,7 @@ class ActivityType extends AbstractType
|
|||||||
'required' => $activityType->isRequired('socialActions'),
|
'required' => $activityType->isRequired('socialActions'),
|
||||||
'class' => SocialAction::class,
|
'class' => SocialAction::class,
|
||||||
'choice_label' => function (SocialAction $socialAction) {
|
'choice_label' => function (SocialAction $socialAction) {
|
||||||
return $this->translatableStringHelper->localize($socialAction->getTitle());
|
return $this->socialActionRender->renderString($socialAction, []);
|
||||||
},
|
},
|
||||||
'multiple' => true,
|
'multiple' => true,
|
||||||
'choices' => $accompanyingPeriod->getRecursiveSocialActions(),
|
'choices' => $accompanyingPeriod->getRecursiveSocialActions(),
|
||||||
|
@ -32,6 +32,7 @@ services:
|
|||||||
- "@chill.main.helper.translatable_string"
|
- "@chill.main.helper.translatable_string"
|
||||||
- "%chill_activity.form.time_duration%"
|
- "%chill_activity.form.time_duration%"
|
||||||
- '@Chill\PersonBundle\Templating\Entity\SocialIssueRender'
|
- '@Chill\PersonBundle\Templating\Entity\SocialIssueRender'
|
||||||
|
- '@Chill\PersonBundle\Templating\Entity\SocialActionRender'
|
||||||
tags:
|
tags:
|
||||||
- { name: form.type, alias: chill_activitybundle_activity }
|
- { name: form.type, alias: chill_activitybundle_activity }
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ Required: Obligatoire
|
|||||||
Persons: Personnes
|
Persons: Personnes
|
||||||
Users: Utilisateurs
|
Users: Utilisateurs
|
||||||
Emergency: Urgent
|
Emergency: Urgent
|
||||||
Sent received: Envoyer / Recevoir
|
Sent received: Entrant / Sortant
|
||||||
Sent: Envoyer
|
Sent: Envoyer
|
||||||
Received: Recevoir
|
Received: Recevoir
|
||||||
by: 'Par '
|
by: 'Par '
|
||||||
|
@ -22,6 +22,7 @@ use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
|||||||
use Symfony\Component\DependencyInjection\Reference;
|
use Symfony\Component\DependencyInjection\Reference;
|
||||||
use Chill\MainBundle\Routing\MenuComposer;
|
use Chill\MainBundle\Routing\MenuComposer;
|
||||||
use Symfony\Component\DependencyInjection\Definition;
|
use Symfony\Component\DependencyInjection\Definition;
|
||||||
|
use Symfony\Component\DependencyInjection\Alias;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -49,29 +50,32 @@ class CRUDControllerCompilerPass implements CompilerPassInterface
|
|||||||
private function configureCrudController(ContainerBuilder $container, array $crudEntry, string $apiOrCrud): void
|
private function configureCrudController(ContainerBuilder $container, array $crudEntry, string $apiOrCrud): void
|
||||||
{
|
{
|
||||||
$controllerClass = $crudEntry['controller'];
|
$controllerClass = $crudEntry['controller'];
|
||||||
|
|
||||||
$controllerServiceName = 'cs'.$apiOrCrud.'_'.$crudEntry['name'].'_controller';
|
$controllerServiceName = 'cs'.$apiOrCrud.'_'.$crudEntry['name'].'_controller';
|
||||||
|
|
||||||
if ($container->hasDefinition($controllerClass)) {
|
// create config parameter in container
|
||||||
$controller = $container->getDefinition($controllerClass);
|
|
||||||
$container->removeDefinition($controllerClass);
|
|
||||||
$alreadyDefined = true;
|
|
||||||
} else {
|
|
||||||
$controller = new Definition($controllerClass);
|
|
||||||
$alreadyDefined = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
$controller->addTag('controller.service_arguments');
|
|
||||||
if (FALSE === $alreadyDefined) {
|
|
||||||
$controller->setAutoconfigured(true);
|
|
||||||
$controller->setPublic(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
$param = 'chill_main_'.$apiOrCrud.'_config_'.$crudEntry['name'];
|
$param = 'chill_main_'.$apiOrCrud.'_config_'.$crudEntry['name'];
|
||||||
$container->setParameter($param, $crudEntry);
|
$container->setParameter($param, $crudEntry);
|
||||||
$controller->addMethodCall('setCrudConfig', ['%'.$param.'%']);
|
|
||||||
|
|
||||||
$container->setDefinition($controllerServiceName, $controller);
|
if ($container->hasDefinition($controllerClass)) {
|
||||||
|
// create an alias to not to re-create the service
|
||||||
|
$alias = new Alias($controllerClass, true);
|
||||||
|
$container->setAlias($controllerServiceName, $alias);
|
||||||
|
|
||||||
|
// add the "addMethodCall"
|
||||||
|
$container->getDefinition($controllerClass)
|
||||||
|
->addMethodCall('setCrudConfig', ['%'.$param.'%']);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$controller = new Definition($controllerClass);
|
||||||
|
|
||||||
|
$controller->addTag('controller.service_arguments');
|
||||||
|
$controller->setAutoconfigured(true);
|
||||||
|
$controller->setPublic(true);
|
||||||
|
|
||||||
|
$controller->addMethodCall('setCrudConfig', ['%'.$param.'%']);
|
||||||
|
|
||||||
|
$container->setDefinition($controllerServiceName, $controller);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,11 @@ use Symfony\Component\HttpFoundation\Response;
|
|||||||
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
||||||
use Chill\MainBundle\Pagination\PaginatorFactory;
|
use Chill\MainBundle\Pagination\PaginatorFactory;
|
||||||
use Chill\MainBundle\Pagination\PaginatorInterface;
|
use Chill\MainBundle\Pagination\PaginatorInterface;
|
||||||
|
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
|
||||||
|
use Chill\MainBundle\CRUD\Resolver\Resolver;
|
||||||
|
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||||
|
use Symfony\Component\Serializer\SerializerInterface;
|
||||||
|
use Symfony\Component\Translation\TranslatorInterface;
|
||||||
|
|
||||||
class AbstractCRUDController extends AbstractController
|
class AbstractCRUDController extends AbstractController
|
||||||
{
|
{
|
||||||
@ -248,4 +253,24 @@ class AbstractCRUDController extends AbstractController
|
|||||||
{
|
{
|
||||||
return $this->get('validator');
|
return $this->get('validator');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function getSubscribedServices(): array
|
||||||
|
{
|
||||||
|
return \array_merge(
|
||||||
|
parent::getSubscribedServices(),
|
||||||
|
[
|
||||||
|
'chill_main.paginator_factory' => PaginatorFactory::class,
|
||||||
|
|
||||||
|
'translator' => TranslatorInterface::class,
|
||||||
|
AuthorizationHelper::class => AuthorizationHelper::class,
|
||||||
|
EventDispatcherInterface::class => EventDispatcherInterface::class,
|
||||||
|
Resolver::class => Resolver::class,
|
||||||
|
SerializerInterface::class => SerializerInterface::class,
|
||||||
|
'validator' => ValidatorInterface::class,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -359,9 +359,10 @@ class ApiController extends AbstractCRUDController
|
|||||||
* 6. validate the base entity (not the deserialized one). Groups are fetched from getValidationGroups, validation is perform by `validate`
|
* 6. validate the base entity (not the deserialized one). Groups are fetched from getValidationGroups, validation is perform by `validate`
|
||||||
* 7. run onAfterValidation
|
* 7. run onAfterValidation
|
||||||
* 8. if errors, return a 422 response with errors
|
* 8. if errors, return a 422 response with errors
|
||||||
* 9. flush the data
|
* 9. if $forcePersist === true, persist the entity
|
||||||
* 10. run onAfterFlush
|
* 10. flush the data
|
||||||
* 11. return a 202 response for DELETE with empty body, or HTTP 200 for post with serialized posted entity
|
* 11. run onAfterFlush
|
||||||
|
* 12. return a 202 response for DELETE with empty body, or HTTP 200 for post with serialized posted entity
|
||||||
*
|
*
|
||||||
* @param string action
|
* @param string action
|
||||||
* @param mixed id
|
* @param mixed id
|
||||||
@ -370,11 +371,12 @@ class ApiController extends AbstractCRUDController
|
|||||||
* @param string $property the name of the property. This will be used to make a `add+$property` and `remove+$property` method
|
* @param string $property the name of the property. This will be used to make a `add+$property` and `remove+$property` method
|
||||||
* @param string $postedDataType the type of the posted data (the content)
|
* @param string $postedDataType the type of the posted data (the content)
|
||||||
* @param string $postedDataContext a context to deserialize posted data (the content)
|
* @param string $postedDataContext a context to deserialize posted data (the content)
|
||||||
|
* @param bool $forcePersist force to persist the created element (only for POST request)
|
||||||
* @throw BadRequestException if unable to deserialize the posted data
|
* @throw BadRequestException if unable to deserialize the posted data
|
||||||
* @throw BadRequestException if the method is not POST or DELETE
|
* @throw BadRequestException if the method is not POST or DELETE
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
protected function addRemoveSomething(string $action, $id, Request $request, string $_format, string $property, string $postedDataType, $postedDataContext = []): Response
|
protected function addRemoveSomething(string $action, $id, Request $request, string $_format, string $property, string $postedDataType, array $postedDataContext = [], bool $forcePersist = false): Response
|
||||||
{
|
{
|
||||||
$entity = $this->getEntity($action, $id, $request);
|
$entity = $this->getEntity($action, $id, $request);
|
||||||
|
|
||||||
@ -429,6 +431,10 @@ class ApiController extends AbstractCRUDController
|
|||||||
return $this->json($errors, 422);
|
return $this->json($errors, 422);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($forcePersist && $request->getMethod() === Request::METHOD_POST) {
|
||||||
|
$this->getDoctrine()->getManager()->persist($postedData);
|
||||||
|
}
|
||||||
|
|
||||||
$this->getDoctrine()->getManager()->flush();
|
$this->getDoctrine()->getManager()->flush();
|
||||||
|
|
||||||
|
|
||||||
|
@ -142,11 +142,11 @@ class CRUDRoutesLoader extends Loader
|
|||||||
protected function loadApi(array $crudConfig): RouteCollection
|
protected function loadApi(array $crudConfig): RouteCollection
|
||||||
{
|
{
|
||||||
$collection = new RouteCollection();
|
$collection = new RouteCollection();
|
||||||
$controller ='csapi_'.$crudConfig['name'].'_controller';
|
$controller = 'csapi_'.$crudConfig['name'].'_controller';
|
||||||
|
|
||||||
foreach ($crudConfig['actions'] as $name => $action) {
|
foreach ($crudConfig['actions'] as $name => $action) {
|
||||||
// filter only on single actions
|
// filter only on single actions
|
||||||
$singleCollection = $action['single-collection'] ?? $name === '_entity' ? 'single' : NULL;
|
$singleCollection = $action['single_collection'] ?? $name === '_entity' ? 'single' : NULL;
|
||||||
if ('collection' === $singleCollection) {
|
if ('collection' === $singleCollection) {
|
||||||
// continue;
|
// continue;
|
||||||
}
|
}
|
||||||
@ -171,7 +171,7 @@ class CRUDRoutesLoader extends Loader
|
|||||||
// path are rewritten
|
// path are rewritten
|
||||||
// if name === 'default', we rewrite it to nothing :-)
|
// if name === 'default', we rewrite it to nothing :-)
|
||||||
$localName = \in_array($name, [ '_entity', '_index' ]) ? '' : '/'.$name;
|
$localName = \in_array($name, [ '_entity', '_index' ]) ? '' : '/'.$name;
|
||||||
if ('collection' === $action['single-collection'] || '_index' === $name) {
|
if ('collection' === $action['single_collection'] || '_index' === $name) {
|
||||||
$localPath = $action['path'] ?? $localName.'.{_format}';
|
$localPath = $action['path'] ?? $localName.'.{_format}';
|
||||||
} else {
|
} else {
|
||||||
$localPath = $action['path'] ?? '/{id}'.$localName.'.{_format}';
|
$localPath = $action['path'] ?? '/{id}'.$localName.'.{_format}';
|
||||||
|
@ -205,7 +205,7 @@ class Configuration implements ConfigurationInterface
|
|||||||
->ignoreExtraKeys(false)
|
->ignoreExtraKeys(false)
|
||||||
->info('the requirements for the route. Will be set to `[ \'id\' => \'\d+\' ]` if left empty.')
|
->info('the requirements for the route. Will be set to `[ \'id\' => \'\d+\' ]` if left empty.')
|
||||||
->end()
|
->end()
|
||||||
->enumNode('single-collection')
|
->enumNode('single_collection')
|
||||||
->values(['single', 'collection'])
|
->values(['single', 'collection'])
|
||||||
->defaultValue('single')
|
->defaultValue('single')
|
||||||
->info('indicates if the returned object is a single element or a collection. '.
|
->info('indicates if the returned object is a single element or a collection. '.
|
||||||
|
@ -51,7 +51,7 @@ class CommentType extends AbstractType
|
|||||||
|
|
||||||
$builder->addEventListener(FormEvents::PRE_SUBMIT, function (FormEvent $event) {
|
$builder->addEventListener(FormEvents::PRE_SUBMIT, function (FormEvent $event) {
|
||||||
$data = $event->getForm()->getData();
|
$data = $event->getForm()->getData();
|
||||||
$comment = $event->getData();
|
$comment = $event->getData() ?? ['comment' => ''];
|
||||||
|
|
||||||
if ($data->getComment() !== $comment['comment']) {
|
if ($data->getComment() !== $comment['comment']) {
|
||||||
$data->setDate(new \DateTime());
|
$data->setDate(new \DateTime());
|
||||||
|
@ -11,13 +11,16 @@
|
|||||||
*
|
*
|
||||||
* Do not take time into account
|
* Do not take time into account
|
||||||
*
|
*
|
||||||
* **Experimental**
|
|
||||||
*/
|
*/
|
||||||
const dateToISO = (date) => {
|
const dateToISO = (date) => {
|
||||||
|
if (null === date) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
this.$store.state.startDate.getFullYear(),
|
date.getFullYear(),
|
||||||
(this.$store.state.startDate.getMonth() + 1).toString().padStart(2, '0'),
|
(date.getMonth() + 1).toString().padStart(2, '0'),
|
||||||
this.$store.state.startDate.getDate().toString().padStart(2, '0')
|
date.getDate().toString().padStart(2, '0')
|
||||||
].join('-');
|
].join('-');
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -36,15 +39,17 @@ const ISOToDate = (str) => {
|
|||||||
/**
|
/**
|
||||||
* Return a date object from iso string formatted as YYYY-mm-dd:HH:MM:ss+01:00
|
* Return a date object from iso string formatted as YYYY-mm-dd:HH:MM:ss+01:00
|
||||||
*
|
*
|
||||||
* **Experimental**
|
|
||||||
*/
|
*/
|
||||||
const ISOToDatetime = (str) => {
|
const ISOToDatetime = (str) => {
|
||||||
console.log(str);
|
if (null === str) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
let
|
let
|
||||||
[cal, times] = str.split('T'),
|
[cal, times] = str.split('T'),
|
||||||
[year, month, date] = cal.split('-'),
|
[year, month, date] = cal.split('-'),
|
||||||
[time, timezone] = cal.split(times.charAt(9)),
|
[time, timezone] = times.split(times.charAt(8)),
|
||||||
[hours, minutes, seconds] = cal.split(':')
|
[hours, minutes, seconds] = time.split(':')
|
||||||
;
|
;
|
||||||
|
|
||||||
return new Date(year, month-1, date, hours, minutes, seconds);
|
return new Date(year, month-1, date, hours, minutes, seconds);
|
||||||
|
@ -26,6 +26,12 @@
|
|||||||
<div v-if="errors.length > 0">
|
<div v-if="errors.length > 0">
|
||||||
{{ errors }}
|
{{ errors }}
|
||||||
</div>
|
</div>
|
||||||
|
<div v-if="loading">
|
||||||
|
{{ $t('loading') }}
|
||||||
|
</div>
|
||||||
|
<div v-if="success">
|
||||||
|
{{ $t('person_address_creation_success') }}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
@ -68,6 +74,12 @@ export default {
|
|||||||
},
|
},
|
||||||
errors() {
|
errors() {
|
||||||
return this.$store.state.errorMsg;
|
return this.$store.state.errorMsg;
|
||||||
|
},
|
||||||
|
loading() {
|
||||||
|
return this.$store.state.loading;
|
||||||
|
},
|
||||||
|
success() {
|
||||||
|
return this.$store.state.success;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -26,7 +26,9 @@ const addressMessages = {
|
|||||||
date: 'Date de la nouvelle adresse',
|
date: 'Date de la nouvelle adresse',
|
||||||
add_an_address_to_person: 'Ajouter l\'adresse à la personne',
|
add_an_address_to_person: 'Ajouter l\'adresse à la personne',
|
||||||
validFrom: 'Date de la nouvelle adresse',
|
validFrom: 'Date de la nouvelle adresse',
|
||||||
back_to_the_list: 'Retour à la liste'
|
back_to_the_list: 'Retour à la liste',
|
||||||
|
person_address_creation_success: 'La nouvelle adresse de la personne est enregistrée',
|
||||||
|
loading: 'chargement en cours...'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -11,7 +11,9 @@ const store = createStore({
|
|||||||
address: {},
|
address: {},
|
||||||
editAddress: {}, //TODO or should be address?
|
editAddress: {}, //TODO or should be address?
|
||||||
person: {},
|
person: {},
|
||||||
errorMsg: []
|
errorMsg: [],
|
||||||
|
loading: false,
|
||||||
|
success: false
|
||||||
},
|
},
|
||||||
getters: {
|
getters: {
|
||||||
},
|
},
|
||||||
@ -39,11 +41,17 @@ const store = createStore({
|
|||||||
console.log('@M getEditAddress address', address);
|
console.log('@M getEditAddress address', address);
|
||||||
state.editAddress = address;
|
state.editAddress = address;
|
||||||
},
|
},
|
||||||
|
setLoading(state, b) {
|
||||||
|
state.loading = b;
|
||||||
|
},
|
||||||
|
setSuccess(state, b) {
|
||||||
|
state.success = b;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
addAddress({ commit }, payload) {
|
addAddress({ commit }, payload) {
|
||||||
console.log('@A addAddress payload', payload);
|
console.log('@A addAddress payload', payload);
|
||||||
|
commit('setLoading', true);
|
||||||
if('newPostalCode' in payload){
|
if('newPostalCode' in payload){
|
||||||
let postalCodeBody = payload.newPostalCode;
|
let postalCodeBody = payload.newPostalCode;
|
||||||
postalCodeBody = Object.assign(postalCodeBody, {'origin': 3});
|
postalCodeBody = Object.assign(postalCodeBody, {'origin': 3});
|
||||||
@ -55,9 +63,11 @@ const store = createStore({
|
|||||||
.then(address => new Promise((resolve, reject) => {
|
.then(address => new Promise((resolve, reject) => {
|
||||||
commit('addAddress', address);
|
commit('addAddress', address);
|
||||||
resolve();
|
resolve();
|
||||||
|
commit('setLoading', false);
|
||||||
}))
|
}))
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
commit('catchError', error);
|
commit('catchError', error);
|
||||||
|
commit('setLoading', false);
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -66,15 +76,17 @@ const store = createStore({
|
|||||||
.then(address => new Promise((resolve, reject) => {
|
.then(address => new Promise((resolve, reject) => {
|
||||||
commit('addAddress', address);
|
commit('addAddress', address);
|
||||||
resolve();
|
resolve();
|
||||||
|
commit('setLoading', false);
|
||||||
}))
|
}))
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
commit('catchError', error);
|
commit('catchError', error);
|
||||||
|
commit('setLoading', false);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
addDateToAddressAndAddressToPerson({ commit }, payload) {
|
addDateToAddressAndAddressToPerson({ commit }, payload) {
|
||||||
console.log('@A addDateToAddressAndAddressToPerson payload', payload);
|
console.log('@A addDateToAddressAndAddressToPerson payload', payload);
|
||||||
|
commit('setLoading', true);
|
||||||
patchAddress(payload.addressId, payload.body)
|
patchAddress(payload.addressId, payload.body)
|
||||||
.then(address => new Promise((resolve, reject) => {
|
.then(address => new Promise((resolve, reject) => {
|
||||||
commit('addDateToAddress', address.validFrom);
|
commit('addDateToAddress', address.validFrom);
|
||||||
@ -84,13 +96,17 @@ const store = createStore({
|
|||||||
.then(person => new Promise((resolve, reject) => {
|
.then(person => new Promise((resolve, reject) => {
|
||||||
commit('addAddressToPerson', person);
|
commit('addAddressToPerson', person);
|
||||||
resolve();
|
resolve();
|
||||||
|
commit('setLoading', false);
|
||||||
|
commit('setSuccess', true);
|
||||||
}))
|
}))
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
commit('catchError', error);
|
commit('catchError', error);
|
||||||
|
commit('setLoading', false);
|
||||||
})
|
})
|
||||||
))
|
))
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
commit('catchError', error);
|
commit('catchError', error);
|
||||||
|
commit('setLoading', false);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
updateAddress({ commit }, payload) {
|
updateAddress({ commit }, payload) {
|
||||||
|
@ -19,6 +19,10 @@
|
|||||||
<template v-slot:body>
|
<template v-slot:body>
|
||||||
<div class="address_form">
|
<div class="address_form">
|
||||||
|
|
||||||
|
<div v-if="loading">
|
||||||
|
{{ $t('loading') }}
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="address_form__header">
|
<div class="address_form__header">
|
||||||
<h4>{{ $t('select_an_address_title') }}</h4>
|
<h4>{{ $t('select_an_address_title') }}</h4>
|
||||||
</div>
|
</div>
|
||||||
@ -110,6 +114,7 @@ export default {
|
|||||||
showModal: false,
|
showModal: false,
|
||||||
modalDialogClass: "modal-dialog-scrollable modal-xl"
|
modalDialogClass: "modal-dialog-scrollable modal-xl"
|
||||||
},
|
},
|
||||||
|
loading: false,
|
||||||
address: {
|
address: {
|
||||||
writeNewAddress: false,
|
writeNewAddress: false,
|
||||||
writeNewPostalCode: false,
|
writeNewPostalCode: false,
|
||||||
@ -143,7 +148,7 @@ export default {
|
|||||||
extra: null,
|
extra: null,
|
||||||
distribution: null,
|
distribution: null,
|
||||||
},
|
},
|
||||||
errorMsg: {}
|
errorMsg: {},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -170,33 +175,42 @@ export default {
|
|||||||
},
|
},
|
||||||
getCountries() {
|
getCountries() {
|
||||||
console.log('getCountries');
|
console.log('getCountries');
|
||||||
|
this.loading = true;
|
||||||
fetchCountries().then(countries => new Promise((resolve, reject) => {
|
fetchCountries().then(countries => new Promise((resolve, reject) => {
|
||||||
this.address.loaded.countries = countries.results;
|
this.address.loaded.countries = countries.results;
|
||||||
resolve()
|
resolve()
|
||||||
|
this.loading = false;
|
||||||
}))
|
}))
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
this.errorMsg.push(error.message);
|
this.errorMsg.push(error.message);
|
||||||
|
this.loading = false;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
getCities(country) {
|
getCities(country) {
|
||||||
console.log('getCities for', country.name);
|
console.log('getCities for', country.name);
|
||||||
|
this.loading = true;
|
||||||
fetchCities(country).then(cities => new Promise((resolve, reject) => {
|
fetchCities(country).then(cities => new Promise((resolve, reject) => {
|
||||||
this.address.loaded.cities = cities.results.filter(c => c.origin !== 3); // filter out user-defined cities
|
this.address.loaded.cities = cities.results.filter(c => c.origin !== 3); // filter out user-defined cities
|
||||||
resolve();
|
resolve();
|
||||||
|
this.loading = false;
|
||||||
}))
|
}))
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
this.errorMsg.push(error.message);
|
this.errorMsg.push(error.message);
|
||||||
|
this.loading = false;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
getReferenceAddresses(city) {
|
getReferenceAddresses(city) {
|
||||||
|
this.loading = true;
|
||||||
console.log('getReferenceAddresses for', city.name);
|
console.log('getReferenceAddresses for', city.name);
|
||||||
fetchReferenceAddresses(city).then(addresses => new Promise((resolve, reject) => {
|
fetchReferenceAddresses(city).then(addresses => new Promise((resolve, reject) => {
|
||||||
console.log('addresses', addresses);
|
console.log('addresses', addresses);
|
||||||
this.address.loaded.addresses = addresses.results;
|
this.address.loaded.addresses = addresses.results;
|
||||||
resolve();
|
resolve();
|
||||||
|
this.loading = false;
|
||||||
}))
|
}))
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
this.errorMsg.push(error.message);
|
this.errorMsg.push(error.message);
|
||||||
|
this.loading = false;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
updateMapCenter(point) {
|
updateMapCenter(point) {
|
||||||
|
@ -23,7 +23,7 @@ export default {
|
|||||||
},
|
},
|
||||||
methods:{
|
methods:{
|
||||||
init() {
|
init() {
|
||||||
map = L.map('address_map').setView([48.8589, 2.3469], 12);
|
map = L.map('address_map').setView([46.67059, -1.42683], 12);
|
||||||
|
|
||||||
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||||
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
|
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
name="floor"
|
name="floor"
|
||||||
|
maxlength=16
|
||||||
:placeholder="$t('floor')"
|
:placeholder="$t('floor')"
|
||||||
v-model="floor"/>
|
v-model="floor"/>
|
||||||
</div>
|
</div>
|
||||||
@ -13,6 +14,7 @@
|
|||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
name="corridor"
|
name="corridor"
|
||||||
|
maxlength=16
|
||||||
:placeholder="$t('corridor')"
|
:placeholder="$t('corridor')"
|
||||||
v-model="corridor"/>
|
v-model="corridor"/>
|
||||||
</div>
|
</div>
|
||||||
@ -21,6 +23,7 @@
|
|||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
name="steps"
|
name="steps"
|
||||||
|
maxlength=16
|
||||||
:placeholder="$t('steps')"
|
:placeholder="$t('steps')"
|
||||||
v-model="steps"/>
|
v-model="steps"/>
|
||||||
</div>
|
</div>
|
||||||
@ -29,6 +32,7 @@
|
|||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
name="flat"
|
name="flat"
|
||||||
|
maxlength=16
|
||||||
:placeholder="$t('flat')"
|
:placeholder="$t('flat')"
|
||||||
v-model="flat"/>
|
v-model="flat"/>
|
||||||
</div>
|
</div>
|
||||||
@ -37,6 +41,7 @@
|
|||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
name="buildingName"
|
name="buildingName"
|
||||||
|
maxlength=255
|
||||||
:placeholder="$t('buildingName')"
|
:placeholder="$t('buildingName')"
|
||||||
v-model="buildingName"/>
|
v-model="buildingName"/>
|
||||||
</div>
|
</div>
|
||||||
@ -45,6 +50,7 @@
|
|||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
name="extra"
|
name="extra"
|
||||||
|
maxlength=255
|
||||||
:placeholder="$t('extra')"
|
:placeholder="$t('extra')"
|
||||||
v-model="extra"/>
|
v-model="extra"/>
|
||||||
</div>
|
</div>
|
||||||
@ -53,6 +59,7 @@
|
|||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
name="distribution"
|
name="distribution"
|
||||||
|
maxlength=255
|
||||||
:placeholder="$t('distribution')"
|
:placeholder="$t('distribution')"
|
||||||
v-model="distribution"/>
|
v-model="distribution"/>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
|
<div class="chill_address_address chill_address_address--multiline">
|
||||||
<div v-if="address.text">
|
<div v-if="address.text">
|
||||||
{{ address.text }}
|
{{ address.text }}
|
||||||
</div>
|
</div>
|
||||||
@ -28,7 +29,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<div v-if="address.distribution">
|
<div v-if="address.distribution">
|
||||||
<span>{{ $t('distribution') }}</span>: {{ address.distribution }}
|
<span>{{ $t('distribution') }}</span>: {{ address.distribution }}
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
@ -19,7 +19,6 @@ class CollectionNormalizer implements NormalizerInterface, NormalizerAwareInterf
|
|||||||
public function normalize($collection, string $format = null, array $context = [])
|
public function normalize($collection, string $format = null, array $context = [])
|
||||||
{
|
{
|
||||||
/** @var $collection Collection */
|
/** @var $collection Collection */
|
||||||
/** @var $collection Chill\MainBundle\Pagination\PaginatorInterface */
|
|
||||||
$paginator = $collection->getPaginator();
|
$paginator = $collection->getPaginator();
|
||||||
|
|
||||||
$data['count'] = $paginator->getTotalItems();
|
$data['count'] = $paginator->getTotalItems();
|
||||||
|
@ -58,13 +58,14 @@ services:
|
|||||||
arguments:
|
arguments:
|
||||||
- "@chill.main.helper.translatable_string"
|
- "@chill.main.helper.translatable_string"
|
||||||
- '@Symfony\Component\Routing\Generator\UrlGeneratorInterface'
|
- '@Symfony\Component\Routing\Generator\UrlGeneratorInterface'
|
||||||
- '@chill.main.form.choice_loader.postal_code'
|
- '@Chill\MainBundle\Form\ChoiceLoader\PostalCodeChoiceLoader'
|
||||||
- '@Symfony\Component\Translation\TranslatorInterface'
|
- '@Symfony\Component\Translation\TranslatorInterface'
|
||||||
tags:
|
tags:
|
||||||
- { name: form.type }
|
- { name: form.type }
|
||||||
|
|
||||||
chill.main.form.choice_loader.postal_code:
|
Chill\MainBundle\Form\ChoiceLoader\PostalCodeChoiceLoader:
|
||||||
class: Chill\MainBundle\Form\ChoiceLoader\PostalCodeChoiceLoader
|
autowire: true
|
||||||
|
autoconfigure: true
|
||||||
|
|
||||||
chill.main.form.type.export:
|
chill.main.form.type.export:
|
||||||
class: Chill\MainBundle\Form\Type\Export\ExportType
|
class: Chill\MainBundle\Form\Type\Export\ExportType
|
||||||
|
@ -6,6 +6,7 @@ use Chill\MainBundle\CRUD\Controller\ApiController;
|
|||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||||
|
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork;
|
||||||
use Symfony\Component\HttpFoundation\Exception\BadRequestException;
|
use Symfony\Component\HttpFoundation\Exception\BadRequestException;
|
||||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||||
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
||||||
@ -116,6 +117,20 @@ $workflow = $this->registry->get($accompanyingPeriod);
|
|||||||
return $this->addRemoveSomething('socialissue', $id, $request, $_format, 'socialIssue', SocialIssue::class, [ 'groups' => [ 'read' ] ]);
|
return $this->addRemoveSomething('socialissue', $id, $request, $_format, 'socialIssue', SocialIssue::class, [ 'groups' => [ 'read' ] ]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function workApi($id, Request $request, string $_format): Response
|
||||||
|
{
|
||||||
|
return $this->addRemoveSomething(
|
||||||
|
'work',
|
||||||
|
$id,
|
||||||
|
$request,
|
||||||
|
$_format,
|
||||||
|
'work',
|
||||||
|
AccompanyingPeriodWork::class,
|
||||||
|
[ 'groups' => [ 'accompanying_period_work:create' ] ],
|
||||||
|
true // force persist
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public function requestorApi($id, Request $request, string $_format): Response
|
public function requestorApi($id, Request $request, string $_format): Response
|
||||||
{
|
{
|
||||||
/** @var AccompanyingPeriod $accompanyingPeriod */
|
/** @var AccompanyingPeriod $accompanyingPeriod */
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace Chill\PersonBundle\Controller;
|
namespace Chill\PersonBundle\Controller;
|
||||||
|
|
||||||
|
use Chill\ActivityBundle\Entity\Activity;
|
||||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||||
use Chill\PersonBundle\Entity\AccompanyingPeriodParticipation;
|
use Chill\PersonBundle\Entity\AccompanyingPeriodParticipation;
|
||||||
use Chill\PersonBundle\Privacy\AccompanyingPeriodPrivacyEvent;
|
use Chill\PersonBundle\Privacy\AccompanyingPeriodPrivacyEvent;
|
||||||
@ -96,9 +97,15 @@ class AccompanyingCourseController extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$activities = $this->getDoctrine()->getManager()->getRepository(Activity::class)->findBy(
|
||||||
|
['accompanyingPeriod' => $accompanyingCourse],
|
||||||
|
['date' => 'DESC'],
|
||||||
|
);
|
||||||
|
|
||||||
return $this->render('@ChillPerson/AccompanyingCourse/index.html.twig', [
|
return $this->render('@ChillPerson/AccompanyingCourse/index.html.twig', [
|
||||||
'accompanyingCourse' => $accompanyingCourse,
|
'accompanyingCourse' => $accompanyingCourse,
|
||||||
'withoutHousehold' => $withoutHousehold
|
'withoutHousehold' => $withoutHousehold,
|
||||||
|
'activities' => $activities
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Chill\PersonBundle\Controller;
|
||||||
|
|
||||||
|
use Chill\MainBundle\CRUD\Controller\ApiController;
|
||||||
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
|
||||||
|
class AccompanyingCourseWorkApiController extends ApiController
|
||||||
|
{
|
||||||
|
protected function getContextForSerialization(string $action, Request $request, string $_format, $entity): array
|
||||||
|
{
|
||||||
|
switch($action) {
|
||||||
|
case '_entity':
|
||||||
|
switch ($request->getMethod()) {
|
||||||
|
case Request::METHOD_PUT:
|
||||||
|
return [ 'groups' => [ 'accompanying_period_work:edit' ] ];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return parent::getContextForSerialization($action, $request, $_format, $entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,109 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Chill\PersonBundle\Controller;
|
||||||
|
|
||||||
|
use Chill\MainBundle\Pagination\PaginatorFactory;
|
||||||
|
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||||
|
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork;
|
||||||
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
use Symfony\Component\Routing\Annotation\Route;
|
||||||
|
use Symfony\Component\Serializer\SerializerInterface;
|
||||||
|
use Symfony\Component\Translation\TranslatorInterface;
|
||||||
|
use Chill\PersonBundle\Repository\AccompanyingPeriod\AccompanyingPeriodWorkRepository;
|
||||||
|
|
||||||
|
class AccompanyingCourseWorkController extends AbstractController
|
||||||
|
{
|
||||||
|
private TranslatorInterface $trans;
|
||||||
|
private SerializerInterface $serializer;
|
||||||
|
private AccompanyingPeriodWorkRepository $workRepository;
|
||||||
|
private PaginatorFactory $paginator;
|
||||||
|
|
||||||
|
public function __construct(
|
||||||
|
TranslatorInterface $trans,
|
||||||
|
SerializerInterface $serializer,
|
||||||
|
AccompanyingPeriodWorkRepository $workRepository,
|
||||||
|
PaginatorFactory $paginator
|
||||||
|
) {
|
||||||
|
$this->trans = $trans;
|
||||||
|
$this->serializer = $serializer;
|
||||||
|
$this->workRepository = $workRepository;
|
||||||
|
$this->paginator = $paginator;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Route(
|
||||||
|
* "{_locale}/person/accompanying-period/{id}/work/new",
|
||||||
|
* name="chill_person_accompanying_period_work_new",
|
||||||
|
* methods={"GET"}
|
||||||
|
* )
|
||||||
|
*/
|
||||||
|
public function createWork(AccompanyingPeriod $period): Response
|
||||||
|
{
|
||||||
|
// TODO ACL
|
||||||
|
|
||||||
|
if ($period->getSocialIssues()->count() === 0) {
|
||||||
|
$this->addFlash('error', $this->trans->trans(
|
||||||
|
"accompanying_work.You must add at least ".
|
||||||
|
"one social issue on accompanying period")
|
||||||
|
);
|
||||||
|
|
||||||
|
return $this->redirectToRoute('chill_person_accompanying_course_index', [
|
||||||
|
'accompanying_period_id' => $period->getId()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$json = $this->serializer->normalize($period, 'json', [ "groups" => [ "read" ]]);
|
||||||
|
|
||||||
|
return $this->render('@ChillPerson/AccompanyingCourseWork/create.html.twig', [
|
||||||
|
'accompanyingCourse' => $period,
|
||||||
|
'json' => $json
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Route(
|
||||||
|
* "{_locale}/person/accompanying-period/work/{id}/edit",
|
||||||
|
* name="chill_person_accompanying_period_work_edit",
|
||||||
|
* methods={"GET"}
|
||||||
|
* )
|
||||||
|
*/
|
||||||
|
public function editWork(AccompanyingPeriodWork $work): Response
|
||||||
|
{
|
||||||
|
// TODO ACL
|
||||||
|
$json = $this->serializer->normalize($work, 'json', [ "groups" => [ "read" ] ]);
|
||||||
|
return $this->render('@ChillPerson/AccompanyingCourseWork/edit.html.twig', [
|
||||||
|
'accompanyingCourse' => $work->getAccompanyingPeriod(),
|
||||||
|
'work' => $work,
|
||||||
|
'json' => $json
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Route(
|
||||||
|
* "{_locale}/person/accompanying-period/{id}/work",
|
||||||
|
* name="chill_person_accompanying_period_work_list",
|
||||||
|
* methods={"GET"}
|
||||||
|
* )
|
||||||
|
*/
|
||||||
|
public function listWorkByAccompanyingPeriod(AccompanyingPeriod $period): Response
|
||||||
|
{
|
||||||
|
// TODO ACL
|
||||||
|
$totalItems = $this->workRepository->countByAccompanyingPeriod($period);
|
||||||
|
$paginator = $this->paginator->create($totalItems);
|
||||||
|
|
||||||
|
$works = $this->workRepository->findByAccompanyingPeriod(
|
||||||
|
$period,
|
||||||
|
['startDate' => 'DESC', 'endDate' => 'DESC'],
|
||||||
|
$paginator->getItemsPerPage(),
|
||||||
|
$paginator->getCurrentPageFirstItemNumber()
|
||||||
|
);
|
||||||
|
|
||||||
|
return $this->render('@ChillPerson/AccompanyingCourseWork/list_by_accompanying_period.html.twig', [
|
||||||
|
'accompanyingCourse' => $period,
|
||||||
|
'works' => $works,
|
||||||
|
'paginator' => $paginator
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
namespace Chill\PersonBundle\Controller;
|
namespace Chill\PersonBundle\Controller;
|
||||||
|
|
||||||
use Chill\PersonBundle\Form\HouseholdType;
|
|
||||||
use Chill\MainBundle\Entity\Address;
|
use Chill\MainBundle\Entity\Address;
|
||||||
|
use Chill\PersonBundle\Form\HouseholdType;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
use Symfony\Component\Form\FormInterface;
|
use Symfony\Component\Form\FormInterface;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
@ -13,6 +13,7 @@ use Symfony\Component\Translation\TranslatorInterface;
|
|||||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
|
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
|
||||||
use Chill\PersonBundle\Entity\Household\Household;
|
use Chill\PersonBundle\Entity\Household\Household;
|
||||||
use Chill\PersonBundle\Entity\Household\Position;
|
use Chill\PersonBundle\Entity\Household\Position;
|
||||||
|
use Chill\PersonBundle\Repository\Household\PositionRepository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Route("/{_locale}/person/household")
|
* @Route("/{_locale}/person/household")
|
||||||
@ -21,12 +22,13 @@ class HouseholdController extends AbstractController
|
|||||||
{
|
{
|
||||||
private TranslatorInterface $translator;
|
private TranslatorInterface $translator;
|
||||||
|
|
||||||
/**
|
private PositionRepository $positionRepository;
|
||||||
* @param TranslatorInterface $translator
|
|
||||||
*/
|
public function __construct(TranslatorInterface $translator, PositionRepository $positionRepository)
|
||||||
public function __construct(TranslatorInterface $translator)
|
|
||||||
{
|
{
|
||||||
$this->translator = $translator;
|
$this->translator = $translator;
|
||||||
|
$this->positionRepository = $positionRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -41,37 +43,8 @@ class HouseholdController extends AbstractController
|
|||||||
{
|
{
|
||||||
// TODO ACL
|
// TODO ACL
|
||||||
|
|
||||||
$positions = $this->getDoctrine()->getManager()
|
$positions = $this->positionRepository
|
||||||
->getRepository(Position::class)
|
->findByActiveOrdered()
|
||||||
->findAll()
|
|
||||||
;
|
|
||||||
|
|
||||||
// little performance improvement:
|
|
||||||
// initialize members collection, which will avoid
|
|
||||||
// some queries
|
|
||||||
$household->getMembers()->initialize();
|
|
||||||
return $this->render('@ChillPerson/Household/summary.html.twig',
|
|
||||||
[
|
|
||||||
'household' => $household,
|
|
||||||
'positions' => $positions
|
|
||||||
]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Route(
|
|
||||||
* "/{household_id}/members",
|
|
||||||
* name="chill_person_household_members",
|
|
||||||
* methods={"GET", "HEAD"}
|
|
||||||
* )
|
|
||||||
* @ParamConverter("household", options={"id" = "household_id"})
|
|
||||||
*/
|
|
||||||
public function members(Request $request, Household $household)
|
|
||||||
{
|
|
||||||
// TODO ACL
|
|
||||||
$positions = $this->getDoctrine()->getManager()
|
|
||||||
->getRepository(Position::class)
|
|
||||||
->findAll()
|
|
||||||
;
|
;
|
||||||
|
|
||||||
// little performance improvement:
|
// little performance improvement:
|
||||||
@ -85,11 +58,11 @@ class HouseholdController extends AbstractController
|
|||||||
$form = null;
|
$form = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->render('@ChillPerson/Household/members.html.twig',
|
return $this->render('@ChillPerson/Household/summary.html.twig',
|
||||||
[
|
[
|
||||||
'household' => $household,
|
'household' => $household,
|
||||||
'positions' => $positions,
|
'positions' => $positions,
|
||||||
'form' => NULL !== $form ? $form->createView(): $form
|
'form' => NULL !== $form ? $form->createView() : null,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -142,6 +115,28 @@ class HouseholdController extends AbstractController
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Route(
|
||||||
|
* "/{household_id}/address/edit",
|
||||||
|
* name="chill_person_household_address_edit",
|
||||||
|
* methods={"GET", "HEAD", "POST"}
|
||||||
|
* )
|
||||||
|
* @ParamConverter("household", options={"id" = "household_id"})
|
||||||
|
*/
|
||||||
|
public function addressEdit(Request $request, Household $household)
|
||||||
|
{
|
||||||
|
// TODO ACL
|
||||||
|
//$address = $this->findAddressById($household, $address_id); //TODO
|
||||||
|
|
||||||
|
|
||||||
|
return $this->render('@ChillPerson/Household/address_edit.html.twig',
|
||||||
|
[
|
||||||
|
'household' => $household,
|
||||||
|
//'address' => $address,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Route(
|
* @Route(
|
||||||
* "/{household_id}/members/metadata/edit",
|
* "/{household_id}/members/metadata/edit",
|
||||||
@ -162,7 +157,7 @@ class HouseholdController extends AbstractController
|
|||||||
|
|
||||||
$this->addFlash('success', $this->translator->trans('household.data_saved'));
|
$this->addFlash('success', $this->translator->trans('household.data_saved'));
|
||||||
|
|
||||||
return $this->redirectToRoute('chill_person_household_members', [
|
return $this->redirectToRoute('chill_person_household_summary', [
|
||||||
'household_id' => $household->getId()
|
'household_id' => $household->getId()
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
@ -191,25 +186,4 @@ class HouseholdController extends AbstractController
|
|||||||
return $form;
|
return $form;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @Route(
|
|
||||||
* "/{household_id}/address/edit",
|
|
||||||
* name="chill_person_household_address_edit",
|
|
||||||
* methods={"GET", "HEAD", "POST"}
|
|
||||||
* )
|
|
||||||
* @ParamConverter("household", options={"id" = "household_id"})
|
|
||||||
*/
|
|
||||||
public function addressEdit(Request $request, Household $household)
|
|
||||||
{
|
|
||||||
// TODO ACL
|
|
||||||
//$address = $this->findAddressById($household, $address_id); //TODO
|
|
||||||
|
|
||||||
|
|
||||||
return $this->render('@ChillPerson/Household/address_edit.html.twig',
|
|
||||||
[
|
|
||||||
'household' => $household,
|
|
||||||
//'address' => $address,
|
|
||||||
]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -173,7 +173,7 @@ class HouseholdMemberController extends ApiController
|
|||||||
|
|
||||||
return $this->redirect(
|
return $this->redirect(
|
||||||
$request->get('returnPath', null) ??
|
$request->get('returnPath', null) ??
|
||||||
$this->generator->generate('chill_person_household_members', [ 'household_id' =>
|
$this->generator->generate('chill_person_household_summary', [ 'household_id' =>
|
||||||
$member->getHousehold()->getId() ])
|
$member->getHousehold()->getId() ])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -297,18 +297,16 @@ class PersonAddressController extends AbstractController
|
|||||||
*/
|
*/
|
||||||
protected function findAddressById(Person $person, $address_id)
|
protected function findAddressById(Person $person, $address_id)
|
||||||
{
|
{
|
||||||
// filtering address
|
$address = $this->getDoctrine()->getManager()
|
||||||
$criteria = Criteria::create()
|
->getRepository(Address::class)
|
||||||
->where(Criteria::expr()->eq('id', $address_id))
|
->find($address_id)
|
||||||
->setMaxResults(1);
|
;
|
||||||
$addresses = $person->getAddresses()->matching($criteria);
|
|
||||||
|
|
||||||
if (count($addresses) === 0) {
|
if (!$person->getAddresses()->contains($address)) {
|
||||||
throw $this->createNotFoundException("Address with id $address_id "
|
throw $this->createAccessDeniedException("Not allowed to see this address");
|
||||||
. "matching person $person_id not found ");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $addresses->first();
|
return $address;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Chill\PersonBundle\Controller;
|
||||||
|
|
||||||
|
use Chill\MainBundle\CRUD\Controller\ApiController;
|
||||||
|
use Chill\MainBundle\Pagination\PaginatorInterface;
|
||||||
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
|
||||||
|
class SocialIssueApiController extends ApiController
|
||||||
|
{
|
||||||
|
protected function customizeQuery(string $action, Request $request, $query): void
|
||||||
|
{
|
||||||
|
$query->where(
|
||||||
|
$query->expr()->orX(
|
||||||
|
$query->expr()->gt('e.desactivationDate', ':now'),
|
||||||
|
$query->expr()->isNull('e.desactivationDate')
|
||||||
|
)
|
||||||
|
);
|
||||||
|
$query->setParameter('now', new \DateTimeImmutable());
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,40 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Chill\PersonBundle\Controller;
|
||||||
|
|
||||||
|
use Chill\MainBundle\Pagination\PaginatorFactory;
|
||||||
|
use Chill\MainBundle\Serializer\Model\Collection;
|
||||||
|
use Chill\PersonBundle\Entity\SocialWork\SocialAction;
|
||||||
|
use Chill\PersonBundle\Entity\SocialWork\Goal;
|
||||||
|
use Chill\PersonBundle\Repository\SocialWork\GoalRepository;
|
||||||
|
use Chill\MainBundle\CRUD\Controller\ApiController;
|
||||||
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
|
|
||||||
|
class SocialWorkGoalApiController extends ApiController
|
||||||
|
{
|
||||||
|
private GoalRepository $goalRepository;
|
||||||
|
|
||||||
|
private PaginatorFactory $paginator;
|
||||||
|
|
||||||
|
|
||||||
|
public function __construct(GoalRepository $goalRepository, PaginatorFactory $paginator)
|
||||||
|
{
|
||||||
|
$this->goalRepository = $goalRepository;
|
||||||
|
$this->paginator = $paginator;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function listBySocialAction(Request $request, SocialAction $action): Response
|
||||||
|
{
|
||||||
|
$totalItems = $this->goalRepository->countBySocialActionWithDescendants($action);
|
||||||
|
$paginator = $this->getPaginatorFactory()->create($totalItems);
|
||||||
|
|
||||||
|
$entities = $this->goalRepository->findBySocialActionWithDescendants($action, ["id" => "ASC"],
|
||||||
|
$paginator->getItemsPerPage(), $paginator->getCurrentPageFirstItemNumber());
|
||||||
|
|
||||||
|
$model = new Collection($entities, $paginator);
|
||||||
|
|
||||||
|
return $this->json($model, Response::HTTP_OK, [], [ "groups" => [ "read" ]]);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,47 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Chill\PersonBundle\Controller;
|
||||||
|
|
||||||
|
use Chill\MainBundle\Serializer\Model\Collection;
|
||||||
|
use Chill\PersonBundle\Entity\SocialWork\SocialAction;
|
||||||
|
use Chill\PersonBundle\Entity\SocialWork\Goal;
|
||||||
|
use Chill\PersonBundle\Repository\SocialWork\ResultRepository;
|
||||||
|
use Chill\MainBundle\CRUD\Controller\ApiController;
|
||||||
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
|
|
||||||
|
class SocialWorkResultApiController extends ApiController
|
||||||
|
{
|
||||||
|
private ResultRepository $resultRepository;
|
||||||
|
|
||||||
|
public function __construct(ResultRepository $resultRepository)
|
||||||
|
{
|
||||||
|
$this->resultRepository = $resultRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function listBySocialAction(Request $request, SocialAction $action): Response
|
||||||
|
{
|
||||||
|
$totalItems = $this->resultRepository->countBySocialActionWithDescendants($action);
|
||||||
|
$paginator = $this->getPaginatorFactory()->create($totalItems);
|
||||||
|
|
||||||
|
$entities = $this->resultRepository->findBySocialActionWithDescendants($action, ["id" => "ASC"],
|
||||||
|
$paginator->getItemsPerPage(), $paginator->getCurrentPageFirstItemNumber());
|
||||||
|
|
||||||
|
$model = new Collection($entities, $paginator);
|
||||||
|
|
||||||
|
return $this->json($model, Response::HTTP_OK, [], [ "groups" => [ "read" ]]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function listByGoal(Request $request, Goal $goal): Response
|
||||||
|
{
|
||||||
|
$totalItems = $this->resultRepository->countByGoal($goal);
|
||||||
|
$paginator = $this->getPaginatorFactory()->create($totalItems);
|
||||||
|
|
||||||
|
$entities = $this->resultRepository->findByGoal($goal, ["id" => "ASC"],
|
||||||
|
$paginator->getItemsPerPage(), $paginator->getCurrentPageFirstItemNumber());
|
||||||
|
|
||||||
|
$model = new Collection($entities, $paginator);
|
||||||
|
|
||||||
|
return $this->json($model, Response::HTTP_OK, [], [ "groups" => [ "read" ]]);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,47 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Chill\PersonBundle\Controller;
|
||||||
|
|
||||||
|
use Chill\MainBundle\Serializer\Model\Collection;
|
||||||
|
use Chill\MainBundle\Pagination\PaginatorFactory;
|
||||||
|
use Chill\PersonBundle\Repository\SocialWork\SocialIssueRepository;
|
||||||
|
use Chill\MainBundle\CRUD\Controller\ApiController;
|
||||||
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||||
|
|
||||||
|
class SocialWorkSocialActionApiController extends ApiController
|
||||||
|
{
|
||||||
|
private SocialIssueRepository $socialIssueRepository;
|
||||||
|
|
||||||
|
private PaginatorFactory $paginator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param SocialIssueRepository $socialIssueRepository
|
||||||
|
*/
|
||||||
|
public function __construct(SocialIssueRepository $socialIssueRepository, PaginatorFactory $paginator)
|
||||||
|
{
|
||||||
|
$this->socialIssueRepository = $socialIssueRepository;
|
||||||
|
$this->paginator = $paginator;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function listBySocialIssueApi($id, Request $request)
|
||||||
|
{
|
||||||
|
$socialIssue = $this->socialIssueRepository
|
||||||
|
->find($id);
|
||||||
|
|
||||||
|
if (NULL === $socialIssue) {
|
||||||
|
throw $this->createNotFoundException("socialIssue not found");
|
||||||
|
}
|
||||||
|
|
||||||
|
$socialActions = $socialIssue->getRecursiveSocialActions();
|
||||||
|
$pagination = $this->paginator->create(count($socialActions));
|
||||||
|
// max one page
|
||||||
|
$pagination->setItemsPerPage(count($socialActions));
|
||||||
|
|
||||||
|
$collection = new Collection($socialActions, $pagination);
|
||||||
|
|
||||||
|
|
||||||
|
return $this->json($collection, JsonResponse::HTTP_OK, [], [ "groups" => [ "read" ]]);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -438,6 +438,19 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
|
|||||||
Request::METHOD_DELETE=> \Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter::SEE
|
Request::METHOD_DELETE=> \Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter::SEE
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
|
'work' => [
|
||||||
|
'methods' => [
|
||||||
|
Request::METHOD_POST => true,
|
||||||
|
Request::METHOD_DELETE => false,
|
||||||
|
Request::METHOD_GET => false,
|
||||||
|
Request::METHOD_HEAD => false,
|
||||||
|
],
|
||||||
|
'controller_action' => 'workApi',
|
||||||
|
'roles' => [
|
||||||
|
Request::METHOD_POST => \Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter::SEE,
|
||||||
|
Request::METHOD_DELETE => 'ALWAYS_FAILS',
|
||||||
|
]
|
||||||
|
],
|
||||||
|
|
||||||
'confirm' => [
|
'confirm' => [
|
||||||
'methods' => [
|
'methods' => [
|
||||||
@ -475,6 +488,7 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
|
|||||||
[
|
[
|
||||||
'class' => \Chill\PersonBundle\Entity\SocialWork\SocialIssue::class,
|
'class' => \Chill\PersonBundle\Entity\SocialWork\SocialIssue::class,
|
||||||
'name' => 'social_work_social_issue',
|
'name' => 'social_work_social_issue',
|
||||||
|
'controller' => \Chill\PersonBundle\Controller\SocialIssueApiController::class,
|
||||||
'base_path' => '/api/1.0/person/social-work/social-issue',
|
'base_path' => '/api/1.0/person/social-work/social-issue',
|
||||||
'base_role' => 'ROLE_USER',
|
'base_role' => 'ROLE_USER',
|
||||||
'actions' => [
|
'actions' => [
|
||||||
@ -540,7 +554,6 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
|
|||||||
'methods' => [
|
'methods' => [
|
||||||
Request::METHOD_GET => true,
|
Request::METHOD_GET => true,
|
||||||
Request::METHOD_HEAD => true,
|
Request::METHOD_HEAD => true,
|
||||||
Request::METHOD_POST=> true,
|
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
'address' => [
|
'address' => [
|
||||||
@ -555,9 +568,10 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
|
|||||||
]
|
]
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'class' => \Chill\PersonBundle\Entity\Household\Household::class,
|
'class' => \Chill\PersonBundle\Entity\SocialWork\SocialAction::class,
|
||||||
'name' => 'household',
|
'name' => 'social_action',
|
||||||
'base_path' => '/api/1.0/person/household',
|
'base_path' => '/api/1.0/person/social/social-action',
|
||||||
|
'controller' => \Chill\PersonBundle\Controller\SocialWorkSocialActionApiController::class,
|
||||||
// TODO: acl
|
// TODO: acl
|
||||||
'base_role' => 'ROLE_USER',
|
'base_role' => 'ROLE_USER',
|
||||||
'actions' => [
|
'actions' => [
|
||||||
@ -571,6 +585,150 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
|
|||||||
Request::METHOD_HEAD => 'ROLE_USER',
|
Request::METHOD_HEAD => 'ROLE_USER',
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
|
'_index' => [
|
||||||
|
'methods' => [
|
||||||
|
Request::METHOD_GET => true,
|
||||||
|
Request::METHOD_HEAD => true,
|
||||||
|
],
|
||||||
|
'roles' => [
|
||||||
|
Request::METHOD_GET => 'ROLE_USER',
|
||||||
|
Request::METHOD_HEAD => 'ROLE_USER',
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'listBySocialIssue' => [
|
||||||
|
'single-collection' => 'collection',
|
||||||
|
'path' => '/by-social-issue/{id}.{_format}',
|
||||||
|
'methods' => [
|
||||||
|
Request::METHOD_GET => true,
|
||||||
|
Request::METHOD_HEAD => true,
|
||||||
|
],
|
||||||
|
'roles' => [
|
||||||
|
Request::METHOD_GET => 'ROLE_USER',
|
||||||
|
Request::METHOD_HEAD => 'ROLE_USER',
|
||||||
|
]
|
||||||
|
|
||||||
|
]
|
||||||
|
]
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'class' => \Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork::class,
|
||||||
|
'name' => 'accompanying_period_work',
|
||||||
|
'base_path' => '/api/1.0/person/accompanying-course/work',
|
||||||
|
'controller' => \Chill\PersonBundle\Controller\AccompanyingCourseWorkApiController::class,
|
||||||
|
// TODO: acl
|
||||||
|
'base_role' => 'ROLE_USER',
|
||||||
|
'actions' => [
|
||||||
|
'_entity' => [
|
||||||
|
'methods' => [
|
||||||
|
Request::METHOD_GET => true,
|
||||||
|
Request::METHOD_HEAD => true,
|
||||||
|
Request::METHOD_PATCH => true,
|
||||||
|
Request::METHOD_PUT => true,
|
||||||
|
],
|
||||||
|
'roles' => [
|
||||||
|
Request::METHOD_GET => 'ROLE_USER',
|
||||||
|
Request::METHOD_HEAD => 'ROLE_USER',
|
||||||
|
Request::METHOD_PATCH => 'ROLE_USER',
|
||||||
|
Request::METHOD_PUT => 'ROLE_USER',
|
||||||
|
]
|
||||||
|
],
|
||||||
|
]
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'class' => \Chill\PersonBundle\Entity\SocialWork\Result::class,
|
||||||
|
'controller' => \Chill\PersonBundle\Controller\SocialWorkResultApiController::class,
|
||||||
|
'name' => 'social_work_result',
|
||||||
|
'base_path' => '/api/1.0/person/social-work/result',
|
||||||
|
'base_role' => 'ROLE_USER',
|
||||||
|
'actions' => [
|
||||||
|
'_entity' => [
|
||||||
|
'methods' => [
|
||||||
|
Request::METHOD_GET => true,
|
||||||
|
Request::METHOD_HEAD => true,
|
||||||
|
],
|
||||||
|
'roles' => [
|
||||||
|
Request::METHOD_GET => 'ROLE_USER',
|
||||||
|
Request::METHOD_HEAD => 'ROLE_USER',
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'_index' => [
|
||||||
|
'methods' => [
|
||||||
|
Request::METHOD_GET => true,
|
||||||
|
Request::METHOD_HEAD => true,
|
||||||
|
],
|
||||||
|
'roles' => [
|
||||||
|
Request::METHOD_GET => 'ROLE_USER',
|
||||||
|
Request::METHOD_HEAD => 'ROLE_USER',
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'by-social-action' => [
|
||||||
|
'single-collection' => 'collection',
|
||||||
|
'path' => '/by-social-action/{id}.{_format}',
|
||||||
|
'controller_action' => 'listBySocialAction',
|
||||||
|
'methods' => [
|
||||||
|
Request::METHOD_GET => true,
|
||||||
|
Request::METHOD_HEAD => true,
|
||||||
|
],
|
||||||
|
'roles' => [
|
||||||
|
Request::METHOD_GET => 'ROLE_USER',
|
||||||
|
Request::METHOD_HEAD => 'ROLE_USER',
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'by-goal' => [
|
||||||
|
'single-collection' => 'collection',
|
||||||
|
'path' => '/by-goal/{id}.{_format}',
|
||||||
|
'controller_action' => 'listByGoal',
|
||||||
|
'methods' => [
|
||||||
|
Request::METHOD_GET => true,
|
||||||
|
Request::METHOD_HEAD => true,
|
||||||
|
],
|
||||||
|
'roles' => [
|
||||||
|
Request::METHOD_GET => 'ROLE_USER',
|
||||||
|
Request::METHOD_HEAD => 'ROLE_USER',
|
||||||
|
]
|
||||||
|
],
|
||||||
|
]
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'class' => \Chill\PersonBundle\Entity\SocialWork\Goal::class,
|
||||||
|
'controller' => \Chill\PersonBundle\Controller\SocialWorkGoalApiController::class,
|
||||||
|
'name' => 'social_work_goal',
|
||||||
|
'base_path' => '/api/1.0/person/social-work/goal',
|
||||||
|
'base_role' => 'ROLE_USER',
|
||||||
|
'actions' => [
|
||||||
|
'_entity' => [
|
||||||
|
'methods' => [
|
||||||
|
Request::METHOD_GET => true,
|
||||||
|
Request::METHOD_HEAD => true,
|
||||||
|
],
|
||||||
|
'roles' => [
|
||||||
|
Request::METHOD_GET => 'ROLE_USER',
|
||||||
|
Request::METHOD_HEAD => 'ROLE_USER',
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'_index' => [
|
||||||
|
'methods' => [
|
||||||
|
Request::METHOD_GET => true,
|
||||||
|
Request::METHOD_HEAD => true,
|
||||||
|
],
|
||||||
|
'roles' => [
|
||||||
|
Request::METHOD_GET => 'ROLE_USER',
|
||||||
|
Request::METHOD_HEAD => 'ROLE_USER',
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'by-social-action' => [
|
||||||
|
'single-collection' => 'collection',
|
||||||
|
'path' => '/by-social-action/{id}.{_format}',
|
||||||
|
'controller_action' => 'listBySocialAction',
|
||||||
|
'methods' => [
|
||||||
|
Request::METHOD_GET => true,
|
||||||
|
Request::METHOD_HEAD => true,
|
||||||
|
],
|
||||||
|
'roles' => [
|
||||||
|
Request::METHOD_GET => 'ROLE_USER',
|
||||||
|
Request::METHOD_HEAD => 'ROLE_USER',
|
||||||
|
]
|
||||||
|
],
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
]
|
]
|
||||||
|
@ -78,6 +78,7 @@ class Configuration implements ConfigurationInterface
|
|||||||
->append($this->addFieldNode('address'))
|
->append($this->addFieldNode('address'))
|
||||||
->append($this->addFieldNode('accompanying_period'))
|
->append($this->addFieldNode('accompanying_period'))
|
||||||
->append($this->addFieldNode('memo'))
|
->append($this->addFieldNode('memo'))
|
||||||
|
->append($this->addFieldNode('number_of_children'))
|
||||||
->arrayNode('alt_names')
|
->arrayNode('alt_names')
|
||||||
->defaultValue([])
|
->defaultValue([])
|
||||||
->arrayPrototype()
|
->arrayPrototype()
|
||||||
|
@ -25,6 +25,7 @@ namespace Chill\PersonBundle\Entity;
|
|||||||
use Chill\MainBundle\Doctrine\Model\TrackUpdateInterface;
|
use Chill\MainBundle\Doctrine\Model\TrackUpdateInterface;
|
||||||
use Chill\MainBundle\Doctrine\Model\TrackCreationInterface;
|
use Chill\MainBundle\Doctrine\Model\TrackCreationInterface;
|
||||||
use Chill\MainBundle\Entity\Scope;
|
use Chill\MainBundle\Entity\Scope;
|
||||||
|
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork;
|
||||||
use Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive;
|
use Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive;
|
||||||
use Chill\PersonBundle\Entity\AccompanyingPeriod\Comment;
|
use Chill\PersonBundle\Entity\AccompanyingPeriod\Comment;
|
||||||
use Chill\PersonBundle\Entity\AccompanyingPeriod\Origin;
|
use Chill\PersonBundle\Entity\AccompanyingPeriod\Origin;
|
||||||
@ -39,6 +40,7 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
|||||||
use Chill\MainBundle\Entity\User;
|
use Chill\MainBundle\Entity\User;
|
||||||
use Symfony\Component\Serializer\Annotation\Groups;
|
use Symfony\Component\Serializer\Annotation\Groups;
|
||||||
use Symfony\Component\Serializer\Annotation\DiscriminatorMap;
|
use Symfony\Component\Serializer\Annotation\DiscriminatorMap;
|
||||||
|
use Symfony\Component\Validator\Constraints as Assert;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AccompanyingPeriod Class
|
* AccompanyingPeriod Class
|
||||||
@ -280,6 +282,15 @@ class AccompanyingPeriod implements TrackCreationInterface, TrackUpdateInterface
|
|||||||
*/
|
*/
|
||||||
private \DateTimeInterface $updatedAt;
|
private \DateTimeInterface $updatedAt;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\OneToMany(
|
||||||
|
* targetEntity=AccompanyingPeriodWork::class,
|
||||||
|
* mappedBy="accompanyingPeriod"
|
||||||
|
* )
|
||||||
|
* @Assert\Valid(traverse=true)
|
||||||
|
*/
|
||||||
|
private Collection $works;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AccompanyingPeriod constructor.
|
* AccompanyingPeriod constructor.
|
||||||
*
|
*
|
||||||
@ -292,6 +303,7 @@ class AccompanyingPeriod implements TrackCreationInterface, TrackUpdateInterface
|
|||||||
$this->scopes = new ArrayCollection();
|
$this->scopes = new ArrayCollection();
|
||||||
$this->socialIssues = new ArrayCollection();
|
$this->socialIssues = new ArrayCollection();
|
||||||
$this->comments = new ArrayCollection();
|
$this->comments = new ArrayCollection();
|
||||||
|
$this->works = new ArrayCollection();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -896,4 +908,28 @@ class AccompanyingPeriod implements TrackCreationInterface, TrackUpdateInterface
|
|||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return AccompanyingPeriodWork[]
|
||||||
|
*/
|
||||||
|
public function getWorks(): Collection
|
||||||
|
{
|
||||||
|
return $this->works;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addWork(AccompanyingPeriodWork $work): self
|
||||||
|
{
|
||||||
|
$this->works[] = $work;
|
||||||
|
$work->setAccompanyingPeriod($this);
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function removeWork(AccompanyingPeriodWork $work): self
|
||||||
|
{
|
||||||
|
$this->work->removeElement($work);
|
||||||
|
$work->setAccompanyingPeriod(null);
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,103 +4,168 @@ namespace Chill\PersonBundle\Entity\AccompanyingPeriod;
|
|||||||
|
|
||||||
use Chill\PersonBundle\Entity\SocialWork\Result;
|
use Chill\PersonBundle\Entity\SocialWork\Result;
|
||||||
use Chill\PersonBundle\Entity\SocialWork\SocialAction;
|
use Chill\PersonBundle\Entity\SocialWork\SocialAction;
|
||||||
|
use Chill\PersonBundle\Entity\Person;
|
||||||
use Chill\MainBundle\Entity\User;
|
use Chill\MainBundle\Entity\User;
|
||||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||||
use Chill\ThirdPartyBundle\Entity\ThirdParty;
|
use Chill\ThirdPartyBundle\Entity\ThirdParty;
|
||||||
|
use DateTimeInterface;
|
||||||
use Doctrine\Common\Collections\ArrayCollection;
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
use Doctrine\Common\Collections\Collection;
|
use Doctrine\Common\Collections\Collection;
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
use Symfony\Component\Serializer\Annotation as Serializer;
|
||||||
|
use Chill\MainBundle\Doctrine\Model\TrackCreationInterface;
|
||||||
|
use Chill\MainBundle\Doctrine\Model\TrackUpdateInterface;
|
||||||
|
use Symfony\Component\Validator\Constraints as Assert;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Entity
|
* @ORM\Entity
|
||||||
* @ORM\Table(name="chill_person_accompanying_period_work")
|
* @ORM\Table(name="chill_person_accompanying_period_work")
|
||||||
|
* @Serializer\DiscriminatorMap(
|
||||||
|
* typeProperty="type",
|
||||||
|
* mapping={
|
||||||
|
* "accompanying_period_work":AccompanyingPeriodWork::class
|
||||||
|
* }
|
||||||
|
* )
|
||||||
*/
|
*/
|
||||||
class AccompanyingPeriodWork
|
class AccompanyingPeriodWork implements TrackCreationInterface, TrackUpdateInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @ORM\Id
|
* @ORM\Id
|
||||||
* @ORM\GeneratedValue
|
* @ORM\GeneratedValue
|
||||||
* @ORM\Column(type="integer")
|
* @ORM\Column(type="integer")
|
||||||
|
* @Serializer\Groups({"read"})
|
||||||
*/
|
*/
|
||||||
private $id;
|
private ?int $id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Column(type="text")
|
* @ORM\Column(type="text")
|
||||||
|
* @Serializer\Groups({"read", "accompanying_period_work:edit"})
|
||||||
*/
|
*/
|
||||||
private $note;
|
private string $note = "";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\ManyToOne(targetEntity=AccompanyingPeriod::class)
|
* @ORM\ManyToOne(targetEntity=AccompanyingPeriod::class)
|
||||||
|
* @Serializer\Groups({"read"})
|
||||||
*/
|
*/
|
||||||
private $accompanyingPeriod;
|
private ?AccompanyingPeriod $accompanyingPeriod = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\ManyToOne(targetEntity=SocialAction::class)
|
* @ORM\ManyToOne(targetEntity=SocialAction::class)
|
||||||
|
* @Serializer\Groups({"read"})
|
||||||
|
* @Serializer\Groups({"accompanying_period_work:create"})
|
||||||
*/
|
*/
|
||||||
private $socialAction;
|
private ?SocialAction $socialAction = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Column(type="datetime")
|
* @ORM\Column(type="datetime_immutable")
|
||||||
|
* @Serializer\Groups({"read"})
|
||||||
*/
|
*/
|
||||||
private $createdAt;
|
private ?\DateTimeImmutable $createdAt = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\ManyToOne(targetEntity=User::class)
|
* @ORM\ManyToOne(targetEntity=User::class)
|
||||||
* @ORM\JoinColumn(nullable=false)
|
* @ORM\JoinColumn(nullable=false)
|
||||||
|
* @Serializer\Groups({"read"})
|
||||||
*/
|
*/
|
||||||
private $createdBy;
|
private ?User $createdBy = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Column(type="datetime")
|
* @ORM\Column(type="datetime_immutable")
|
||||||
|
* @Serializer\Groups({"read"})
|
||||||
*/
|
*/
|
||||||
private $startDate;
|
private ?\DateTimeImmutable $updatedAt = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Column(type="datetime")
|
* @ORM\ManyToOne(targetEntity=User::class)
|
||||||
|
* @ORM\JoinColumn(nullable=false)
|
||||||
|
* @Serializer\Groups({"read"})
|
||||||
*/
|
*/
|
||||||
private $endDate;
|
private ?User $updatedBy = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="date_immutable")
|
||||||
|
* @Serializer\Groups({"accompanying_period_work:create"})
|
||||||
|
* @Serializer\Groups({"accompanying_period_work:edit"})
|
||||||
|
* @Serializer\Groups({"read"})
|
||||||
|
*/
|
||||||
|
private \DateTimeImmutable $startDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="date_immutable", nullable=true, options={"default":null})
|
||||||
|
* @Serializer\Groups({"accompanying_period_work:create"})
|
||||||
|
* @Serializer\Groups({"accompanying_period_work:edit"})
|
||||||
|
* @Serializer\Groups({"read"})
|
||||||
|
* @Assert\GreaterThan(propertyPath="startDate",
|
||||||
|
* message="accompanying_course_work.The endDate should be greater than the start date"
|
||||||
|
* )
|
||||||
|
*/
|
||||||
|
private ?\DateTimeImmutable $endDate = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\ManyToOne(targetEntity=ThirdParty::class)
|
* @ORM\ManyToOne(targetEntity=ThirdParty::class)
|
||||||
|
* @Serializer\Groups({"read"})
|
||||||
|
* @Serializer\Groups({"accompanying_period_work:edit"})
|
||||||
*
|
*
|
||||||
* In schema : traitant
|
* In schema : traitant
|
||||||
*/
|
*/
|
||||||
private $handlingThierParty;
|
private ?ThirdParty $handlingThierParty = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Column(type="boolean")
|
* @ORM\Column(type="boolean")
|
||||||
*/
|
*/
|
||||||
private $createdAutomatically;
|
private bool $createdAutomatically = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Column(type="text")
|
* @ORM\Column(type="text")
|
||||||
*/
|
*/
|
||||||
private $createdAutomaticallyReason;
|
private string $createdAutomaticallyReason = "";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\OneToMany(targetEntity=AccompanyingPeriodWorkGoal::class, mappedBy="accompanyingPeriodWork")
|
* @ORM\OneToMany(
|
||||||
|
* targetEntity=AccompanyingPeriodWorkGoal::class,
|
||||||
|
* mappedBy="accompanyingPeriodWork",
|
||||||
|
* cascade={"persist"},
|
||||||
|
* orphanRemoval=true
|
||||||
|
* )
|
||||||
|
* @Serializer\Groups({"read"})
|
||||||
|
* @Serializer\Groups({"accompanying_period_work:edit"})
|
||||||
*/
|
*/
|
||||||
private $goals;
|
private Collection $goals;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\ManyToMany(targetEntity=Result::class, inversedBy="accompanyingPeriodWorks")
|
* @ORM\ManyToMany(targetEntity=Result::class, inversedBy="accompanyingPeriodWorks")
|
||||||
* @ORM\JoinTable(name="chill_person_accompanying_period_work_result")
|
* @ORM\JoinTable(name="chill_person_accompanying_period_work_result")
|
||||||
|
* @Serializer\Groups({"read"})
|
||||||
|
* @Serializer\Groups({"accompanying_period_work:edit"})
|
||||||
*/
|
*/
|
||||||
private $results;
|
private Collection $results;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\ManyToMany(targetEntity=ThirdParty::class)
|
* @ORM\ManyToMany(targetEntity=ThirdParty::class)
|
||||||
* @ORM\JoinTable(name="chill_person_accompanying_period_work_third_party")
|
* @ORM\JoinTable(name="chill_person_accompanying_period_work_third_party")
|
||||||
*
|
*
|
||||||
* In schema : intervenants
|
* In schema : intervenants
|
||||||
|
* @Serializer\Groups({"read"})
|
||||||
|
* @Serializer\Groups({"accompanying_period_work:edit"})
|
||||||
*/
|
*/
|
||||||
private $thirdParties;
|
private Collection $thirdParties;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @ORM\ManyToMany(targetEntity=Person::class)
|
||||||
|
* @ORM\JoinTable(name="chill_person_accompanying_period_work_person")
|
||||||
|
* @Serializer\Groups({"read"})
|
||||||
|
* @Serializer\Groups({"accompanying_period_work:edit"})
|
||||||
|
* @Serializer\Groups({"accompanying_period_work:create"})
|
||||||
|
*/
|
||||||
|
private Collection $persons;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->goals = new ArrayCollection();
|
$this->goals = new ArrayCollection();
|
||||||
$this->results = new ArrayCollection();
|
$this->results = new ArrayCollection();
|
||||||
$this->thirdParties = new ArrayCollection();
|
$this->thirdParties = new ArrayCollection();
|
||||||
|
$this->persons = new ArrayCollection();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getId(): ?int
|
public function getId(): ?int
|
||||||
@ -125,8 +190,17 @@ use Doctrine\ORM\Mapping as ORM;
|
|||||||
return $this->accompanyingPeriod;
|
return $this->accompanyingPeriod;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Internal: you should use `$accompanyingPeriod->removeWork($work);` or
|
||||||
|
* `$accompanyingPeriod->addWork($work);`
|
||||||
|
*/
|
||||||
public function setAccompanyingPeriod(?AccompanyingPeriod $accompanyingPeriod): self
|
public function setAccompanyingPeriod(?AccompanyingPeriod $accompanyingPeriod): self
|
||||||
{
|
{
|
||||||
|
if ($this->accompanyingPeriod instanceof AccompanyingPeriod &&
|
||||||
|
$accompanyingPeriod !== $this->accompanyingPeriod) {
|
||||||
|
throw new \LogicException("A work cannot change accompanyingPeriod");
|
||||||
|
}
|
||||||
|
|
||||||
$this->accompanyingPeriod = $accompanyingPeriod;
|
$this->accompanyingPeriod = $accompanyingPeriod;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
@ -144,7 +218,7 @@ use Doctrine\ORM\Mapping as ORM;
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getCreatedAt(): ?\DateTimeInterface
|
public function getCreatedAt(): ?\DateTimeImmutable
|
||||||
{
|
{
|
||||||
return $this->createdAt;
|
return $this->createdAt;
|
||||||
}
|
}
|
||||||
@ -168,6 +242,30 @@ use Doctrine\ORM\Mapping as ORM;
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setUpdatedBy(User $user): TrackUpdateInterface
|
||||||
|
{
|
||||||
|
$this->updatedBy = $user;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setUpdatedAt(DateTimeInterface $datetime): TrackUpdateInterface
|
||||||
|
{
|
||||||
|
$this->updatedAt = $datetime;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getUpdatedAt(): ?\DateTimeImmutable
|
||||||
|
{
|
||||||
|
return $this->updatedAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getUpdatedBy(): ?User
|
||||||
|
{
|
||||||
|
return $this->updatedBy;
|
||||||
|
}
|
||||||
|
|
||||||
public function getStartDate(): ?\DateTimeInterface
|
public function getStartDate(): ?\DateTimeInterface
|
||||||
{
|
{
|
||||||
return $this->startDate;
|
return $this->startDate;
|
||||||
@ -185,7 +283,7 @@ use Doctrine\ORM\Mapping as ORM;
|
|||||||
return $this->endDate;
|
return $this->endDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setEndDate(\DateTimeInterface $endDate): self
|
public function setEndDate(?\DateTimeInterface $endDate = null): self
|
||||||
{
|
{
|
||||||
$this->endDate = $endDate;
|
$this->endDate = $endDate;
|
||||||
|
|
||||||
@ -240,7 +338,7 @@ use Doctrine\ORM\Mapping as ORM;
|
|||||||
{
|
{
|
||||||
if (!$this->goals->contains($goal)) {
|
if (!$this->goals->contains($goal)) {
|
||||||
$this->goals[] = $goal;
|
$this->goals[] = $goal;
|
||||||
$goal->setAccompanyingPeriodWork2($this);
|
$goal->setAccompanyingPeriodWork($this);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
@ -248,10 +346,10 @@ use Doctrine\ORM\Mapping as ORM;
|
|||||||
|
|
||||||
public function removeGoal(AccompanyingPeriodWorkGoal $goal): self
|
public function removeGoal(AccompanyingPeriodWorkGoal $goal): self
|
||||||
{
|
{
|
||||||
if ($this->goals->removeElement($goal)) {
|
if ($this->goals->removeElement($goal)) {
|
||||||
// set the owning side to null (unless already changed)
|
// set the owning side to null (unless already changed)
|
||||||
if ($goal->getAccompanyingPeriodWork2() === $this) {
|
if ($goal->getAccompanyingPeriodWork() === $this) {
|
||||||
$goal->setAccompanyingPeriodWork2(null);
|
$goal->setAccompanyingPeriodWork(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -305,4 +403,25 @@ use Doctrine\ORM\Mapping as ORM;
|
|||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getPersons(): Collection
|
||||||
|
{
|
||||||
|
return $this->persons;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addPerson(Person $person): self
|
||||||
|
{
|
||||||
|
if (!$this->persons->contains($person)) {
|
||||||
|
$this->persons[] = $person;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function removePerson(Person $person): self
|
||||||
|
{
|
||||||
|
$this->persons->removeElement($person);
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,10 +7,17 @@ use Chill\PersonBundle\Entity\SocialWork\Result;
|
|||||||
use Doctrine\Common\Collections\ArrayCollection;
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
use Doctrine\Common\Collections\Collection;
|
use Doctrine\Common\Collections\Collection;
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
use Symfony\Component\Serializer\Annotation as Serializer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Entity
|
* @ORM\Entity
|
||||||
* @ORM\Table(name="chill_person_accompanying_period_work_goal")
|
* @ORM\Table(name="chill_person_accompanying_period_work_goal")
|
||||||
|
* @Serializer\DiscriminatorMap(
|
||||||
|
* typeProperty="type",
|
||||||
|
* mapping={
|
||||||
|
* "accompanying_period_work_goal":AccompanyingPeriodWorkGoal::class
|
||||||
|
* }
|
||||||
|
* )
|
||||||
*/
|
*/
|
||||||
class AccompanyingPeriodWorkGoal
|
class AccompanyingPeriodWorkGoal
|
||||||
{
|
{
|
||||||
@ -18,11 +25,14 @@ class AccompanyingPeriodWorkGoal
|
|||||||
* @ORM\Id
|
* @ORM\Id
|
||||||
* @ORM\GeneratedValue
|
* @ORM\GeneratedValue
|
||||||
* @ORM\Column(type="integer")
|
* @ORM\Column(type="integer")
|
||||||
|
* @Serializer\Groups({"read"})
|
||||||
*/
|
*/
|
||||||
private $id;
|
private $id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Column(type="text")
|
* @ORM\Column(type="text")
|
||||||
|
* @Serializer\Groups({"accompanying_period_work:edit"})
|
||||||
|
* @Serializer\Groups({"read"})
|
||||||
*/
|
*/
|
||||||
private $note;
|
private $note;
|
||||||
|
|
||||||
@ -33,12 +43,16 @@ class AccompanyingPeriodWorkGoal
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\ManyToOne(targetEntity=Goal::class)
|
* @ORM\ManyToOne(targetEntity=Goal::class)
|
||||||
|
* @Serializer\Groups({"accompanying_period_work:edit"})
|
||||||
|
* @Serializer\Groups({"read"})
|
||||||
*/
|
*/
|
||||||
private $goal;
|
private $goal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\ManyToMany(targetEntity=Result::class, inversedBy="accompanyingPeriodWorkGoals")
|
* @ORM\ManyToMany(targetEntity=Result::class, inversedBy="accompanyingPeriodWorkGoals")
|
||||||
* @ORM\JoinTable(name="chill_person_accompanying_period_work_goal_result")
|
* @ORM\JoinTable(name="chill_person_accompanying_period_work_goal_result")
|
||||||
|
* @Serializer\Groups({"accompanying_period_work:edit"})
|
||||||
|
* @Serializer\Groups({"read"})
|
||||||
*/
|
*/
|
||||||
private $results;
|
private $results;
|
||||||
|
|
||||||
@ -71,6 +85,13 @@ class AccompanyingPeriodWorkGoal
|
|||||||
|
|
||||||
public function setAccompanyingPeriodWork(?AccompanyingPeriodWork $accompanyingPeriodWork): self
|
public function setAccompanyingPeriodWork(?AccompanyingPeriodWork $accompanyingPeriodWork): self
|
||||||
{
|
{
|
||||||
|
if ($this->accompanyingPeriodWork instanceof AccompanyingPeriodWork
|
||||||
|
&& $accompanyingPeriodWork !== $this->accompanyingPeriodWork
|
||||||
|
&& $accompanyingPeriodWork !== null
|
||||||
|
) {
|
||||||
|
throw new \LogicException("Change accompanying period work is not allowed");
|
||||||
|
}
|
||||||
|
|
||||||
$this->accompanyingPeriodWork = $accompanyingPeriodWork;
|
$this->accompanyingPeriodWork = $accompanyingPeriodWork;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
|
@ -30,7 +30,7 @@ class Household
|
|||||||
* @ORM\Id
|
* @ORM\Id
|
||||||
* @ORM\GeneratedValue
|
* @ORM\GeneratedValue
|
||||||
* @ORM\Column(type="integer")
|
* @ORM\Column(type="integer")
|
||||||
* @Serializer\Groups({"write"})
|
* @Serializer\Groups({"read"})
|
||||||
*/
|
*/
|
||||||
private ?int $id = null;
|
private ?int $id = null;
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ class Household
|
|||||||
* targetEntity=HouseholdMember::class,
|
* targetEntity=HouseholdMember::class,
|
||||||
* mappedBy="household"
|
* mappedBy="household"
|
||||||
* )
|
* )
|
||||||
* @Serializer\Groups({"write", "read"})
|
* @Serializer\Groups({"read"})
|
||||||
*/
|
*/
|
||||||
private Collection $members;
|
private Collection $members;
|
||||||
|
|
||||||
@ -196,6 +196,11 @@ class Household
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function getCurrentMembers(?\DateTimeImmutable $now = null): Collection
|
public function getCurrentMembers(?\DateTimeImmutable $now = null): Collection
|
||||||
|
{
|
||||||
|
return $this->getMembers()->matching($this->buildCriteriaCurrentMembers($now));
|
||||||
|
}
|
||||||
|
|
||||||
|
private function buildCriteriaCurrentMembers(?\DateTimeImmutable $now = null): Criteria
|
||||||
{
|
{
|
||||||
$criteria = new Criteria();
|
$criteria = new Criteria();
|
||||||
$expr = Criteria::expr();
|
$expr = Criteria::expr();
|
||||||
@ -211,7 +216,53 @@ class Household
|
|||||||
$expr->gte('endDate', $date)
|
$expr->gte('endDate', $date)
|
||||||
));
|
));
|
||||||
|
|
||||||
return $this->getMembers()->matching($criteria);
|
return $criteria;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return HouseholdMember[]
|
||||||
|
*/
|
||||||
|
public function getCurrentMembersOrdered(?\DateTimeImmutable $now = null): Collection
|
||||||
|
{
|
||||||
|
$members = $this->getCurrentMembers($now);
|
||||||
|
|
||||||
|
$members->getIterator()
|
||||||
|
->uasort(
|
||||||
|
function (HouseholdMember $a, HouseholdMember $b) {
|
||||||
|
if ($a->getPosition()->getOrdering() < $b->getPosition()->getOrdering()) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if ($a->getPosition()->getOrdering() > $b->getPosition()->getOrdering()) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if ($a->isHolder() && !$b->isHolder()) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if (!$a->isHolder() && $b->isHolder()) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
return $members;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get current members ids
|
||||||
|
*
|
||||||
|
* Used in serialization
|
||||||
|
*
|
||||||
|
* @Serializer\Groups({"read"})
|
||||||
|
* @Serializer\SerializedName("current_members_id")
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public function getCurrentMembersIds(?\DateTimeImmutable $now = null): Collection
|
||||||
|
{
|
||||||
|
return $this->getCurrentMembers($now)->map(
|
||||||
|
fn (HouseholdMember $m) => $m->getId()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -23,13 +23,17 @@ namespace Chill\PersonBundle\Entity;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
use ArrayIterator;
|
use ArrayIterator;
|
||||||
|
use Chill\MainBundle\Doctrine\Model\TrackCreationInterface;
|
||||||
|
use Chill\MainBundle\Doctrine\Model\TrackUpdateInterface;
|
||||||
use Chill\MainBundle\Entity\Center;
|
use Chill\MainBundle\Entity\Center;
|
||||||
use Chill\MainBundle\Entity\Country;
|
use Chill\MainBundle\Entity\Country;
|
||||||
|
use Chill\MainBundle\Entity\User;
|
||||||
use Chill\PersonBundle\Entity\Household\Household;
|
use Chill\PersonBundle\Entity\Household\Household;
|
||||||
use Chill\PersonBundle\Entity\MaritalStatus;
|
use Chill\PersonBundle\Entity\MaritalStatus;
|
||||||
use Chill\PersonBundle\Entity\Household\HouseholdMember;
|
use Chill\PersonBundle\Entity\Household\HouseholdMember;
|
||||||
use Chill\MainBundle\Entity\HasCenterInterface;
|
use Chill\MainBundle\Entity\HasCenterInterface;
|
||||||
use Chill\MainBundle\Entity\Address;
|
use Chill\MainBundle\Entity\Address;
|
||||||
|
use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable;
|
||||||
use DateTime;
|
use DateTime;
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
use Doctrine\Common\Collections\Collection;
|
use Doctrine\Common\Collections\Collection;
|
||||||
@ -53,7 +57,7 @@ use Chill\PersonBundle\Entity\Household\PersonHouseholdAddress;
|
|||||||
* "person"=Person::class
|
* "person"=Person::class
|
||||||
* })
|
* })
|
||||||
*/
|
*/
|
||||||
class Person implements HasCenterInterface
|
class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The person's id
|
* The person's id
|
||||||
@ -100,6 +104,14 @@ class Person implements HasCenterInterface
|
|||||||
*/
|
*/
|
||||||
private $birthdate; //to change in birthdate
|
private $birthdate; //to change in birthdate
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The person's deathdate
|
||||||
|
* @var \DateTimeImmutable
|
||||||
|
*
|
||||||
|
* @ORM\Column(type="date_immutable", nullable=true)
|
||||||
|
*/
|
||||||
|
private ?\DateTimeImmutable $deathdate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The person's place of birth
|
* The person's place of birth
|
||||||
* @var string
|
* @var string
|
||||||
@ -143,6 +155,14 @@ class Person implements HasCenterInterface
|
|||||||
const MALE_GENDER = 'man';
|
const MALE_GENDER = 'man';
|
||||||
const FEMALE_GENDER = 'woman';
|
const FEMALE_GENDER = 'woman';
|
||||||
const BOTH_GENDER = 'both';
|
const BOTH_GENDER = 'both';
|
||||||
|
const NO_INFORMATION = 'unknown';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Comment on gender
|
||||||
|
* @var CommentEmbeddable
|
||||||
|
* @ORM\Embedded(class="Chill\MainBundle\Entity\Embeddable\CommentEmbeddable", columnPrefix="genderComment_")
|
||||||
|
*/
|
||||||
|
private CommentEmbeddable $genderComment;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The marital status of the person
|
* The marital status of the person
|
||||||
@ -153,6 +173,21 @@ class Person implements HasCenterInterface
|
|||||||
*/
|
*/
|
||||||
private $maritalStatus;
|
private $maritalStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The date of the last marital status change of the person
|
||||||
|
* @var \DateTime
|
||||||
|
*
|
||||||
|
* @ORM\Column(type="date", nullable=true)
|
||||||
|
*/
|
||||||
|
private $maritalStatusDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Comment on marital status
|
||||||
|
* @var CommentEmbeddable
|
||||||
|
* @ORM\Embedded(class="Chill\MainBundle\Entity\Embeddable\CommentEmbeddable", columnPrefix="maritalStatusComment_")
|
||||||
|
*/
|
||||||
|
private CommentEmbeddable $maritalStatusComment;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contact information for contacting the person
|
* Contact information for contacting the person
|
||||||
* @var string
|
* @var string
|
||||||
@ -240,6 +275,54 @@ class Person implements HasCenterInterface
|
|||||||
*/
|
*/
|
||||||
private $memo = ''; // TO-CHANGE in remark
|
private $memo = ''; // TO-CHANGE in remark
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Accept short text message (aka SMS)
|
||||||
|
* @var boolean
|
||||||
|
*
|
||||||
|
* @ORM\Column(type="boolean", options={"default" : false})
|
||||||
|
*/
|
||||||
|
private ?bool $acceptSMS = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Accept receiving email
|
||||||
|
* @var boolean
|
||||||
|
*
|
||||||
|
* @ORM\Column(type="boolean", options={"default" : false})
|
||||||
|
*/
|
||||||
|
private ?bool $acceptEmail = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Number of children
|
||||||
|
* @var int
|
||||||
|
*
|
||||||
|
* @ORM\Column(type="integer", nullable=true)
|
||||||
|
*/
|
||||||
|
private ?int $numberOfChildren = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\ManyToOne(targetEntity=User::class)
|
||||||
|
* @ORM\JoinColumn(nullable=true)
|
||||||
|
*/
|
||||||
|
private $createdBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="datetime", nullable=true, options={"default": NULL})
|
||||||
|
*/
|
||||||
|
private \DateTimeInterface $createdAt;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\ManyToOne(
|
||||||
|
* targetEntity=User::class
|
||||||
|
* )
|
||||||
|
*/
|
||||||
|
private User $updatedBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="datetime", nullable=true, options={"default": NULL})
|
||||||
|
*/
|
||||||
|
private \DateTimeInterface $updatedAt;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var boolean
|
* @var boolean
|
||||||
* @deprecated
|
* @deprecated
|
||||||
@ -316,6 +399,8 @@ class Person implements HasCenterInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->open(new AccompanyingPeriod($opening));
|
$this->open(new AccompanyingPeriod($opening));
|
||||||
|
$this->genderComment = new CommentEmbeddable();
|
||||||
|
$this->maritalStatusComment = new CommentEmbeddable();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1264,15 +1349,24 @@ class Person implements HasCenterInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function getCurrentHousehold(?\DateTimeImmutable $at = null): ?Household
|
public function getCurrentHousehold(?\DateTimeImmutable $at = null): ?Household
|
||||||
|
{
|
||||||
|
$participation = $this->getCurrentHouseholdParticipationShareHousehold($at);
|
||||||
|
|
||||||
|
return $participation instanceof HouseholdMember ?
|
||||||
|
$participation->getHousehold()
|
||||||
|
: null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCurrentHouseholdParticipationShareHousehold(?\DateTimeImmutable $at = null): ?HouseholdMember
|
||||||
{
|
{
|
||||||
$criteria = new Criteria();
|
$criteria = new Criteria();
|
||||||
$expr = Criteria::expr();
|
$expr = Criteria::expr();
|
||||||
$date = NULL === $at ? new \DateTimeImmutable('now') : $at;
|
$date = NULL === $at ? new \DateTimeImmutable('today') : $at;
|
||||||
$datef = $date->format('Y-m-d');
|
$datef = $date->format('Y-m-d');
|
||||||
|
|
||||||
if (
|
if (
|
||||||
NULL !== ($this->currentHouseholdAt[$datef] ?? NULL)) {
|
NULL !== ($this->currentHouseholdParticipationAt[$datef] ?? NULL)) {
|
||||||
return $this->currentHouseholdAt[$datef];
|
return $this->currentHouseholdParticipationAt[$datef];
|
||||||
}
|
}
|
||||||
|
|
||||||
$criteria
|
$criteria
|
||||||
@ -1281,7 +1375,7 @@ class Person implements HasCenterInterface
|
|||||||
$expr->lte('startDate', $date),
|
$expr->lte('startDate', $date),
|
||||||
$expr->orX(
|
$expr->orX(
|
||||||
$expr->isNull('endDate'),
|
$expr->isNull('endDate'),
|
||||||
$expr->gte('endDate', $date)
|
$expr->gt('endDate', $date)
|
||||||
),
|
),
|
||||||
$expr->eq('shareHousehold', true)
|
$expr->eq('shareHousehold', true)
|
||||||
)
|
)
|
||||||
@ -1292,8 +1386,7 @@ class Person implements HasCenterInterface
|
|||||||
;
|
;
|
||||||
|
|
||||||
return $participations->count() > 0 ?
|
return $participations->count() > 0 ?
|
||||||
$this->currentHouseholdAt[$datef] = $participations->first()
|
$this->currentHouseholdParticipationAt[$datef] = $participations->first()
|
||||||
->getHousehold()
|
|
||||||
: null;
|
: null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1333,4 +1426,122 @@ class Person implements HasCenterInterface
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getGenderComment(): CommentEmbeddable
|
||||||
|
{
|
||||||
|
return $this->genderComment;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setGenderComment(CommentEmbeddable $genderComment): self
|
||||||
|
{
|
||||||
|
$this->genderComment = $genderComment;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getMaritalStatusComment(): CommentEmbeddable
|
||||||
|
{
|
||||||
|
return $this->maritalStatusComment;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setMaritalStatusComment(CommentEmbeddable $maritalStatusComment): self
|
||||||
|
{
|
||||||
|
$this->maritalStatusComment = $maritalStatusComment;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDeathdate(): ?\DateTimeInterface
|
||||||
|
{
|
||||||
|
return $this->deathdate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setDeathdate(?\DateTimeInterface $deathdate): self
|
||||||
|
{
|
||||||
|
$this->deathdate = $deathdate;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getMaritalStatusDate(): ?\DateTimeInterface
|
||||||
|
{
|
||||||
|
return $this->maritalStatusDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setMaritalStatusDate(?\DateTimeInterface $maritalStatusDate): self
|
||||||
|
{
|
||||||
|
$this->maritalStatusDate = $maritalStatusDate;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getAcceptSMS(): ?bool
|
||||||
|
{
|
||||||
|
return $this->acceptSMS;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setAcceptSMS(bool $acceptSMS): self
|
||||||
|
{
|
||||||
|
$this->acceptSMS = $acceptSMS;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getAcceptEmail(): ?bool
|
||||||
|
{
|
||||||
|
return $this->acceptEmail;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setAcceptEmail(bool $acceptEmail): self
|
||||||
|
{
|
||||||
|
$this->acceptEmail = $acceptEmail;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getNumberOfChildren(): ?int
|
||||||
|
{
|
||||||
|
return $this->numberOfChildren;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setNumberOfChildren(int $numberOfChildren): self
|
||||||
|
{
|
||||||
|
$this->numberOfChildren = $numberOfChildren;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCreatedBy(): ?User
|
||||||
|
{
|
||||||
|
return $this->createdBy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setCreatedBy(User $createdBy): self
|
||||||
|
{
|
||||||
|
$this->createdBy = $createdBy;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setCreatedAt(\DateTimeInterface $datetime): self
|
||||||
|
{
|
||||||
|
$this->createdAt = $datetime;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setUpdatedBy(User $user): self
|
||||||
|
{
|
||||||
|
$this->updatedBy = $user;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setUpdatedAt(\DateTimeInterface $datetime): self
|
||||||
|
{
|
||||||
|
$this->updatedAt = $datetime;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -5,10 +5,17 @@ namespace Chill\PersonBundle\Entity\SocialWork;
|
|||||||
use Doctrine\Common\Collections\ArrayCollection;
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
use Doctrine\Common\Collections\Collection;
|
use Doctrine\Common\Collections\Collection;
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
use Symfony\Component\Serializer\Annotation as Serializer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Entity
|
* @ORM\Entity
|
||||||
* @ORM\Table(name="chill_person_social_work_goal")
|
* @ORM\Table(name="chill_person_social_work_goal")
|
||||||
|
* @Serializer\DiscriminatorMap(
|
||||||
|
* typeProperty="type",
|
||||||
|
* mapping={
|
||||||
|
* "social_work_goal":Goal::class
|
||||||
|
* }
|
||||||
|
* )
|
||||||
*/
|
*/
|
||||||
class Goal
|
class Goal
|
||||||
{
|
{
|
||||||
@ -16,11 +23,13 @@ class Goal
|
|||||||
* @ORM\Id
|
* @ORM\Id
|
||||||
* @ORM\GeneratedValue
|
* @ORM\GeneratedValue
|
||||||
* @ORM\Column(type="integer")
|
* @ORM\Column(type="integer")
|
||||||
|
* @Serializer\Groups({"read"})
|
||||||
*/
|
*/
|
||||||
private $id;
|
private $id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Column(type="json")
|
* @ORM\Column(type="json")
|
||||||
|
* @Serializer\Groups({"read"})
|
||||||
*/
|
*/
|
||||||
private $title = [];
|
private $title = [];
|
||||||
|
|
||||||
@ -46,6 +55,11 @@ class Goal
|
|||||||
$this->results = new ArrayCollection();
|
$this->results = new ArrayCollection();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getId(): ?int
|
||||||
|
{
|
||||||
|
return $this->id;
|
||||||
|
}
|
||||||
|
|
||||||
public function getTitle(): array
|
public function getTitle(): array
|
||||||
{
|
{
|
||||||
return $this->title;
|
return $this->title;
|
||||||
|
@ -7,10 +7,17 @@ use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWorkGoal;
|
|||||||
use Doctrine\Common\Collections\ArrayCollection;
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
use Doctrine\Common\Collections\Collection;
|
use Doctrine\Common\Collections\Collection;
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
use Symfony\Component\Serializer\Annotation as Serializer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Entity
|
* @ORM\Entity
|
||||||
* @ORM\Table(name="chill_person_social_work_result")
|
* @ORM\Table(name="chill_person_social_work_result")
|
||||||
|
* @Serializer\DiscriminatorMap(
|
||||||
|
* typeProperty="type",
|
||||||
|
* mapping={
|
||||||
|
* "social_work_result":Result::class
|
||||||
|
* }
|
||||||
|
* )
|
||||||
*/
|
*/
|
||||||
class Result
|
class Result
|
||||||
{
|
{
|
||||||
@ -18,11 +25,13 @@ class Result
|
|||||||
* @ORM\Id
|
* @ORM\Id
|
||||||
* @ORM\GeneratedValue
|
* @ORM\GeneratedValue
|
||||||
* @ORM\Column(type="integer")
|
* @ORM\Column(type="integer")
|
||||||
|
* @Serializer\Groups({"read"})
|
||||||
*/
|
*/
|
||||||
private $id;
|
private $id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Column(type="json")
|
* @ORM\Column(type="json")
|
||||||
|
* @Serializer\Groups({"read"})
|
||||||
*/
|
*/
|
||||||
private $title = [];
|
private $title = [];
|
||||||
|
|
||||||
|
@ -5,10 +5,17 @@ namespace Chill\PersonBundle\Entity\SocialWork;
|
|||||||
use Doctrine\Common\Collections\ArrayCollection;
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
use Doctrine\Common\Collections\Collection;
|
use Doctrine\Common\Collections\Collection;
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
use Symfony\Component\Serializer\Annotation as Serializer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Entity
|
* @ORM\Entity
|
||||||
* @ORM\Table(name="chill_person_social_action")
|
* @ORM\Table(name="chill_person_social_action")
|
||||||
|
* @Serializer\DiscriminatorMap(
|
||||||
|
* typeProperty="type",
|
||||||
|
* mapping={
|
||||||
|
* "social_work_social_action":SocialAction::class
|
||||||
|
* }
|
||||||
|
* )
|
||||||
*/
|
*/
|
||||||
class SocialAction
|
class SocialAction
|
||||||
{
|
{
|
||||||
|
@ -34,9 +34,13 @@ use Chill\PersonBundle\Entity\PersonPhone;
|
|||||||
use Chill\PersonBundle\Form\Type\Select2MaritalStatusType;
|
use Chill\PersonBundle\Form\Type\Select2MaritalStatusType;
|
||||||
use Symfony\Component\Form\AbstractType;
|
use Symfony\Component\Form\AbstractType;
|
||||||
use Chill\MainBundle\Form\Type\ChillDateType;
|
use Chill\MainBundle\Form\Type\ChillDateType;
|
||||||
|
use Chill\MainBundle\Form\Type\CommentType;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\EmailType;
|
use Symfony\Component\Form\Extension\Core\Type\EmailType;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\TelType;
|
use Symfony\Component\Form\Extension\Core\Type\TelType;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\DateType;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||||
|
|
||||||
@ -82,8 +86,19 @@ class PersonType extends AbstractType
|
|||||||
->add('birthdate', ChillDateType::class, [
|
->add('birthdate', ChillDateType::class, [
|
||||||
'required' => false,
|
'required' => false,
|
||||||
])
|
])
|
||||||
|
->add('deathdate', DateType::class, [
|
||||||
|
'required' => false,
|
||||||
|
'input' => 'datetime_immutable',
|
||||||
|
'widget' => 'single_text'
|
||||||
|
])
|
||||||
->add('gender', GenderType::class, array(
|
->add('gender', GenderType::class, array(
|
||||||
'required' => true
|
'required' => true
|
||||||
|
))
|
||||||
|
->add('genderComment', CommentType::class, array(
|
||||||
|
'required' => false
|
||||||
|
))
|
||||||
|
->add('numberOfChildren', IntegerType::class, array(
|
||||||
|
'required' => false
|
||||||
));
|
));
|
||||||
|
|
||||||
if ($this->configAltNamesHelper->hasAltNames()) {
|
if ($this->configAltNamesHelper->hasAltNames()) {
|
||||||
@ -111,7 +126,12 @@ class PersonType extends AbstractType
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($this->config['mobilenumber'] === 'visible') {
|
if ($this->config['mobilenumber'] === 'visible') {
|
||||||
$builder->add('mobilenumber', TelType::class, array('required' => false));
|
$builder
|
||||||
|
->add('mobilenumber', TelType::class, array('required' => false))
|
||||||
|
->add('acceptSMS', CheckboxType::class, array(
|
||||||
|
'value' => false,
|
||||||
|
'required' => true
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
$builder->add('otherPhoneNumbers', ChillCollectionType::class, [
|
$builder->add('otherPhoneNumbers', ChillCollectionType::class, [
|
||||||
@ -130,7 +150,9 @@ class PersonType extends AbstractType
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
if ($this->config['email'] === 'visible') {
|
if ($this->config['email'] === 'visible') {
|
||||||
$builder->add('email', EmailType::class, array('required' => false));
|
$builder
|
||||||
|
->add('email', EmailType::class, array('required' => false))
|
||||||
|
->add('acceptEmail', CheckboxType::class, array('required' => false));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->config['country_of_birth'] === 'visible') {
|
if ($this->config['country_of_birth'] === 'visible') {
|
||||||
@ -153,9 +175,16 @@ class PersonType extends AbstractType
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($this->config['marital_status'] === 'visible'){
|
if ($this->config['marital_status'] === 'visible'){
|
||||||
$builder->add('maritalStatus', Select2MaritalStatusType::class, array(
|
$builder
|
||||||
'required' => false
|
->add('maritalStatus', Select2MaritalStatusType::class, array(
|
||||||
));
|
'required' => false
|
||||||
|
))
|
||||||
|
->add('maritalStatusDate', ChillDateType::class, array(
|
||||||
|
'required' => false
|
||||||
|
))
|
||||||
|
->add('maritalStatusComment', CommentType::class, array(
|
||||||
|
'required' => false
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
if($options['cFGroup']) {
|
if($options['cFGroup']) {
|
||||||
|
@ -60,6 +60,13 @@ class AccompanyingCourseMenuBuilder implements LocalMenuBuilderInterface
|
|||||||
'accompanying_period_id' => $period->getId()
|
'accompanying_period_id' => $period->getId()
|
||||||
]])
|
]])
|
||||||
->setExtras(['order' => 30]);
|
->setExtras(['order' => 30]);
|
||||||
|
|
||||||
|
$menu->addChild($this->translator->trans('Accompanying Course Actions'), [
|
||||||
|
'route' => 'chill_person_accompanying_period_work_list',
|
||||||
|
'routeParameters' => [
|
||||||
|
'id' => $period->getId()
|
||||||
|
]])
|
||||||
|
->setExtras(['order' => 40]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -36,13 +36,6 @@ class HouseholdMenuBuilder implements LocalMenuBuilderInterface
|
|||||||
]])
|
]])
|
||||||
->setExtras(['order' => 10]);
|
->setExtras(['order' => 10]);
|
||||||
|
|
||||||
$menu->addChild($this->translator->trans('household.Household members'), [
|
|
||||||
'route' => 'chill_person_household_members',
|
|
||||||
'routeParameters' => [
|
|
||||||
'household_id' => $household->getId()
|
|
||||||
]])
|
|
||||||
->setExtras(['order' => 20]);
|
|
||||||
|
|
||||||
$menu->addChild($this->translator->trans('household.Addresses'), [
|
$menu->addChild($this->translator->trans('household.Addresses'), [
|
||||||
'route' => 'chill_person_household_addresses',
|
'route' => 'chill_person_household_addresses',
|
||||||
'routeParameters' => [
|
'routeParameters' => [
|
||||||
|
@ -3,16 +3,12 @@
|
|||||||
namespace Chill\PersonBundle\Repository\AccompanyingPeriod;
|
namespace Chill\PersonBundle\Repository\AccompanyingPeriod;
|
||||||
|
|
||||||
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork;
|
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork;
|
||||||
|
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Doctrine\ORM\EntityRepository;
|
use Doctrine\ORM\EntityRepository;
|
||||||
|
use Doctrine\Persistence\ObjectRepository;
|
||||||
|
|
||||||
/**
|
final class AccompanyingPeriodWorkRepository implements ObjectRepository
|
||||||
* @method AccompanyingPeriodWork|null find($id, $lockMode = null, $lockVersion = null)
|
|
||||||
* @method AccompanyingPeriodWork|null findOneBy(array $criteria, array $orderBy = null)
|
|
||||||
* @method AccompanyingPeriodWork[] findAll()
|
|
||||||
* @method AccompanyingPeriodWork[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
|
|
||||||
*/
|
|
||||||
final class AccompanyingPeriodWorkRepository
|
|
||||||
{
|
{
|
||||||
private EntityRepository $repository;
|
private EntityRepository $repository;
|
||||||
|
|
||||||
@ -20,4 +16,88 @@ final class AccompanyingPeriodWorkRepository
|
|||||||
{
|
{
|
||||||
$this->repository = $entityManager->getRepository(AccompanyingPeriodWork::class);
|
$this->repository = $entityManager->getRepository(AccompanyingPeriodWork::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function find($id): ?AccompanyingPeriodWork
|
||||||
|
{
|
||||||
|
return $this->repository->find($id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function findAll(): array
|
||||||
|
{
|
||||||
|
return $this->repository->findAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array
|
||||||
|
{
|
||||||
|
return $this->repository->findBy($criteria, $orderBy, $limit, $offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function findOneBy(array $criteria): ?AccompanyingPeriodWork
|
||||||
|
{
|
||||||
|
return $this->findOneBy($criteria);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getClassName()
|
||||||
|
{
|
||||||
|
return AccompanyingPeriodWork::class;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return AccompanyingPeriodWork[]
|
||||||
|
*/
|
||||||
|
public function findByAccompanyingPeriod(AccompanyingPeriod $period, $orderBy = null, $limit = null, $offset = null): array
|
||||||
|
{
|
||||||
|
return $this->repository->findByAccompanyingPeriod($period, $orderBy, $limit, $offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function countByAccompanyingPeriod(AccompanyingPeriod $period): int
|
||||||
|
{
|
||||||
|
return $this->repository->countByAccompanyingPeriod($period);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function toDelete()
|
||||||
|
{
|
||||||
|
$qb = $this->buildQueryBySocialActionWithDescendants($action);
|
||||||
|
$qb->select('g');
|
||||||
|
|
||||||
|
foreach ($orderBy as $sort => $order) {
|
||||||
|
$qb->addOrderBy('g.'.$sort, $order);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $qb
|
||||||
|
->setMaxResults($limit)
|
||||||
|
->setFirstResult($offset)
|
||||||
|
->getQuery()
|
||||||
|
->getResult()
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function countBySocialActionWithDescendants(SocialAction $action): int
|
||||||
|
{
|
||||||
|
$qb = $this->buildQueryBySocialActionWithDescendants($action);
|
||||||
|
$qb->select('COUNT(g)');
|
||||||
|
|
||||||
|
return $qb
|
||||||
|
->getQuery()
|
||||||
|
->getSingleScalarResult()
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function buildQueryBySocialActionWithDescendants(SocialAction $action): QueryBuilder
|
||||||
|
{
|
||||||
|
$actions = $action->getDescendantsWithThis();
|
||||||
|
|
||||||
|
$qb = $this->repository->createQueryBuilder('g');
|
||||||
|
|
||||||
|
$orx = $qb->expr()->orX();
|
||||||
|
$i = 0;
|
||||||
|
foreach ($actions as $action) {
|
||||||
|
$orx->add(":action_{$i} MEMBER OF g.socialActions");
|
||||||
|
$qb->setParameter("action_{$i}", $action);
|
||||||
|
}
|
||||||
|
$qb->where($orx);
|
||||||
|
|
||||||
|
return $qb;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,14 +7,9 @@ use Chill\PersonBundle\Entity\Household\Position;
|
|||||||
//use Doctrine\Persistence\ManagerRegistry;
|
//use Doctrine\Persistence\ManagerRegistry;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Doctrine\ORM\EntityRepository;
|
use Doctrine\ORM\EntityRepository;
|
||||||
|
use Doctrine\Persistence\ObjectRepository;
|
||||||
|
|
||||||
/**
|
final class PositionRepository implements ObjectRepository
|
||||||
* @method Position|null find($id, $lockMode = null, $lockVersion = null)
|
|
||||||
* @method Position|null findOneBy(array $criteria, array $orderBy = null)
|
|
||||||
* @method Position[] findAll()
|
|
||||||
* @method Position[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
|
|
||||||
*/
|
|
||||||
final class PositionRepository
|
|
||||||
{
|
{
|
||||||
private EntityRepository $repository;
|
private EntityRepository $repository;
|
||||||
|
|
||||||
@ -30,4 +25,45 @@ final class PositionRepository
|
|||||||
{
|
{
|
||||||
return $this->repository->findAll();
|
return $this->repository->findAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Position[]
|
||||||
|
*/
|
||||||
|
public function findByActiveOrdered(): array
|
||||||
|
{
|
||||||
|
return $this->repository->createQueryBuilder('p')
|
||||||
|
->select('p')
|
||||||
|
->orderBy('p.ordering', 'ASC')
|
||||||
|
->getQuery()
|
||||||
|
->getResult();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Position[]
|
||||||
|
*/
|
||||||
|
public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array
|
||||||
|
{
|
||||||
|
return $this->repository->findBy($criteria, $orderBy, $limit, $offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Position[]
|
||||||
|
*/
|
||||||
|
public function findOneBy(array $criteria): array
|
||||||
|
{
|
||||||
|
return $this->repository->findOneBy($criteria);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Position
|
||||||
|
*/
|
||||||
|
public function find($id)
|
||||||
|
{
|
||||||
|
return $this->repository->find($id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getClassName()
|
||||||
|
{
|
||||||
|
return Position::class;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,10 +3,13 @@
|
|||||||
namespace Chill\PersonBundle\Repository\SocialWork;
|
namespace Chill\PersonBundle\Repository\SocialWork;
|
||||||
|
|
||||||
use Chill\PersonBundle\Entity\SocialWork\Goal;
|
use Chill\PersonBundle\Entity\SocialWork\Goal;
|
||||||
|
use Chill\PersonBundle\Entity\SocialWork\SocialAction;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Doctrine\ORM\EntityRepository;
|
use Doctrine\ORM\EntityRepository;
|
||||||
|
use Doctrine\ORM\QueryBuilder;
|
||||||
|
use Doctrine\Persistence\ObjectRepository;
|
||||||
|
|
||||||
final class GoalRepository
|
final class GoalRepository implements ObjectRepository
|
||||||
{
|
{
|
||||||
private EntityRepository $repository;
|
private EntityRepository $repository;
|
||||||
|
|
||||||
@ -14,4 +17,78 @@ final class GoalRepository
|
|||||||
{
|
{
|
||||||
$this->repository = $entityManager->getRepository(Goal::class);
|
$this->repository = $entityManager->getRepository(Goal::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function find($id)
|
||||||
|
{
|
||||||
|
return $this->repository->find($id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function findAll()
|
||||||
|
{
|
||||||
|
return $this->repository->findAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null)
|
||||||
|
{
|
||||||
|
return $this->repository->findBy($criteria, $orderBy, $limit, $offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function findOneBy(array $criteria)
|
||||||
|
{
|
||||||
|
return $this->findOneBy($criteria);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getClassName()
|
||||||
|
{
|
||||||
|
return Goal::class;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return Goal[]
|
||||||
|
*/
|
||||||
|
public function findBySocialActionWithDescendants(SocialAction $action, $orderBy = null, $limit = null, $offset = null): array
|
||||||
|
{
|
||||||
|
$qb = $this->buildQueryBySocialActionWithDescendants($action);
|
||||||
|
$qb->select('g');
|
||||||
|
|
||||||
|
foreach ($orderBy as $sort => $order) {
|
||||||
|
$qb->addOrderBy('g.'.$sort, $order);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $qb
|
||||||
|
->setMaxResults($limit)
|
||||||
|
->setFirstResult($offset)
|
||||||
|
->getQuery()
|
||||||
|
->getResult()
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function countBySocialActionWithDescendants(SocialAction $action): int
|
||||||
|
{
|
||||||
|
$qb = $this->buildQueryBySocialActionWithDescendants($action);
|
||||||
|
$qb->select('COUNT(g)');
|
||||||
|
|
||||||
|
return $qb
|
||||||
|
->getQuery()
|
||||||
|
->getSingleScalarResult()
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function buildQueryBySocialActionWithDescendants(SocialAction $action): QueryBuilder
|
||||||
|
{
|
||||||
|
$actions = $action->getDescendantsWithThis();
|
||||||
|
|
||||||
|
$qb = $this->repository->createQueryBuilder('g');
|
||||||
|
|
||||||
|
$orx = $qb->expr()->orX();
|
||||||
|
$i = 0;
|
||||||
|
foreach ($actions as $action) {
|
||||||
|
$orx->add(":action_{$i} MEMBER OF g.socialActions");
|
||||||
|
$qb->setParameter("action_{$i}", $action);
|
||||||
|
}
|
||||||
|
$qb->where($orx);
|
||||||
|
|
||||||
|
return $qb;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,10 +3,14 @@
|
|||||||
namespace Chill\PersonBundle\Repository\SocialWork;
|
namespace Chill\PersonBundle\Repository\SocialWork;
|
||||||
|
|
||||||
use Chill\PersonBundle\Entity\SocialWork\Result;
|
use Chill\PersonBundle\Entity\SocialWork\Result;
|
||||||
|
use Chill\PersonBundle\Entity\SocialWork\SocialAction;
|
||||||
|
use Chill\PersonBundle\Entity\SocialWork\Goal;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Doctrine\ORM\EntityRepository;
|
use Doctrine\ORM\EntityRepository;
|
||||||
|
use Doctrine\ORM\QueryBuilder;
|
||||||
|
use Doctrine\Persistence\ObjectRepository;
|
||||||
|
|
||||||
final class ResultRepository
|
final class ResultRepository implements ObjectRepository
|
||||||
{
|
{
|
||||||
private EntityRepository $repository;
|
private EntityRepository $repository;
|
||||||
|
|
||||||
@ -14,4 +18,120 @@ final class ResultRepository
|
|||||||
{
|
{
|
||||||
$this->repository = $entityManager->getRepository(Result::class);
|
$this->repository = $entityManager->getRepository(Result::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function find($id)
|
||||||
|
{
|
||||||
|
return $this->repository->find($id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function findAll()
|
||||||
|
{
|
||||||
|
return $this->repository->findAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null)
|
||||||
|
{
|
||||||
|
return $this->repository->findBy($criteria, $orderBy, $limit, $offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function findOneBy(array $criteria)
|
||||||
|
{
|
||||||
|
return $this->findOneBy($criteria);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getClassName()
|
||||||
|
{
|
||||||
|
return Result::class;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return Result[]
|
||||||
|
*/
|
||||||
|
public function findBySocialActionWithDescendants(SocialAction $action, $orderBy = null, $limit = null, $offset = null): array
|
||||||
|
{
|
||||||
|
$qb = $this->buildQueryBySocialActionWithDescendants($action);
|
||||||
|
$qb->select('r');
|
||||||
|
|
||||||
|
foreach ($orderBy as $sort => $order) {
|
||||||
|
$qb->addOrderBy('r.'.$sort, $order);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $qb
|
||||||
|
->setMaxResults($limit)
|
||||||
|
->setFirstResult($offset)
|
||||||
|
->getQuery()
|
||||||
|
->getResult()
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function countBySocialActionWithDescendants(SocialAction $action): int
|
||||||
|
{
|
||||||
|
$qb = $this->buildQueryBySocialActionWithDescendants($action);
|
||||||
|
$qb->select('COUNT(r)');
|
||||||
|
|
||||||
|
return $qb
|
||||||
|
->getQuery()
|
||||||
|
->getSingleScalarResult()
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function buildQueryBySocialActionWithDescendants(SocialAction $action): QueryBuilder
|
||||||
|
{
|
||||||
|
$actions = $action->getDescendantsWithThis();
|
||||||
|
|
||||||
|
$qb = $this->repository->createQueryBuilder('r');
|
||||||
|
|
||||||
|
$orx = $qb->expr()->orX();
|
||||||
|
$i = 0;
|
||||||
|
foreach ($actions as $action) {
|
||||||
|
$orx->add(":action_{$i} MEMBER OF r.socialActions");
|
||||||
|
$qb->setParameter("action_{$i}", $action);
|
||||||
|
}
|
||||||
|
$qb->where($orx);
|
||||||
|
|
||||||
|
return $qb;
|
||||||
|
}
|
||||||
|
protected function buildQueryByGoal(Goal $goal): QueryBuilder
|
||||||
|
{
|
||||||
|
$qb = $this->repository->createQueryBuilder('r');
|
||||||
|
|
||||||
|
$qb->where(":goal MEMBER OF r.goals")
|
||||||
|
->setParameter('goal', $goal)
|
||||||
|
;
|
||||||
|
|
||||||
|
return $qb;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Result[]
|
||||||
|
*/
|
||||||
|
public function findByGoal(Goal $goal, $orderBy = null, $limit = null, $offset = null): array
|
||||||
|
{
|
||||||
|
$qb = $this->buildQueryByGoal($goal);
|
||||||
|
|
||||||
|
foreach ($orderBy as $sort => $order) {
|
||||||
|
$qb->addOrderBy('r.'.$sort, $order);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $qb
|
||||||
|
->select('r')
|
||||||
|
->setMaxResults($limit)
|
||||||
|
->setFirstResult($offset)
|
||||||
|
->getQuery()
|
||||||
|
->getResult()
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function countByGoal(Goal $goal): int
|
||||||
|
{
|
||||||
|
$qb = $this->buildQueryByGoal($goal);
|
||||||
|
$qb->select('COUNT(r)');
|
||||||
|
|
||||||
|
return $qb
|
||||||
|
->getQuery()
|
||||||
|
->getSingleScalarResult()
|
||||||
|
;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,8 +6,9 @@ use Chill\PersonBundle\Entity\SocialWork\SocialIssue;
|
|||||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Doctrine\ORM\EntityRepository;
|
use Doctrine\ORM\EntityRepository;
|
||||||
|
use Doctrine\Persistence\ObjectRepository;
|
||||||
|
|
||||||
final class SocialIssueRepository
|
final class SocialIssueRepository implements ObjectRepository
|
||||||
{
|
{
|
||||||
private EntityRepository $repository;
|
private EntityRepository $repository;
|
||||||
|
|
||||||
@ -15,4 +16,44 @@ final class SocialIssueRepository
|
|||||||
{
|
{
|
||||||
$this->repository = $entityManager->getRepository(SocialIssue::class);
|
$this->repository = $entityManager->getRepository(SocialIssue::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public function find($id)
|
||||||
|
{
|
||||||
|
return $this->repository->find($id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public function findAll()
|
||||||
|
{
|
||||||
|
return $this->repository->findAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null)
|
||||||
|
{
|
||||||
|
return $this->repository->findBy($criteria, $orderBy, $limit, $offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public function findOneBy(array $criteria)
|
||||||
|
{
|
||||||
|
return $this->findOneBy($criteria);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public function getClassName()
|
||||||
|
{
|
||||||
|
return SocialIssue::class;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,2 +1,3 @@
|
|||||||
require('./sass/chillperson.scss');
|
require('./sass/chillperson.scss');
|
||||||
require('./sass/person_with_period.scss');
|
require('./sass/person_with_period.scss');
|
||||||
|
require('./sass/household_banner.scss');
|
||||||
|
57
src/Bundle/ChillPersonBundle/Resources/public/js/person.js
Normal file
57
src/Bundle/ChillPersonBundle/Resources/public/js/person.js
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
import { ShowHide } from 'ShowHide/show_hide.js';
|
||||||
|
|
||||||
|
const maritalStatus = document.getElementById("maritalStatus");
|
||||||
|
const maritalStatusDate = document.getElementById("maritalStatusDate");
|
||||||
|
const personEmail = document.getElementById("personEmail");
|
||||||
|
const personAcceptEmail = document.getElementById("personAcceptEmail");
|
||||||
|
const personPhoneNumber = document.getElementById("personPhoneNumber");
|
||||||
|
const personAcceptSMS = document.getElementById("personAcceptSMS");
|
||||||
|
|
||||||
|
|
||||||
|
new ShowHide({
|
||||||
|
froms: [maritalStatus],
|
||||||
|
container: [maritalStatusDate],
|
||||||
|
test: function(froms) {
|
||||||
|
for (let f of froms.values()) {
|
||||||
|
for (let input of f.querySelectorAll('select').values()) {
|
||||||
|
if (input.value) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
event_name: 'change'
|
||||||
|
});
|
||||||
|
|
||||||
|
new ShowHide({
|
||||||
|
froms: [personEmail],
|
||||||
|
container: [personAcceptEmail],
|
||||||
|
test: function(froms) {
|
||||||
|
for (let f of froms.values()) {
|
||||||
|
for (let input of f.querySelectorAll('input').values()) {
|
||||||
|
if (input.value) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
event_name: 'input'
|
||||||
|
});
|
||||||
|
|
||||||
|
new ShowHide({
|
||||||
|
froms: [personPhoneNumber],
|
||||||
|
container: [personAcceptSMS],
|
||||||
|
test: function(froms) {
|
||||||
|
for (let f of froms.values()) {
|
||||||
|
for (let input of f.querySelectorAll('input').values()) {
|
||||||
|
if (input.value) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
event_name: 'input'
|
||||||
|
});
|
@ -0,0 +1 @@
|
|||||||
|
require('./index.scss');
|
@ -0,0 +1,96 @@
|
|||||||
|
|
||||||
|
#accompanying_course_work_list {
|
||||||
|
|
||||||
|
.item {
|
||||||
|
margin-bottom: 1.5rem;
|
||||||
|
padding: 1rem;
|
||||||
|
border: 1px solid gray;
|
||||||
|
|
||||||
|
.title_label {
|
||||||
|
display: block;
|
||||||
|
margin: 0;
|
||||||
|
|
||||||
|
font-variant-caps: small-caps;
|
||||||
|
|
||||||
|
+ * {
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.objective_results {
|
||||||
|
display: grid;
|
||||||
|
grid-template-areas:
|
||||||
|
"obj res"
|
||||||
|
;
|
||||||
|
grid-template-columns: 50%;
|
||||||
|
column-gap: 1rem;
|
||||||
|
|
||||||
|
padding: 0.3rem;
|
||||||
|
|
||||||
|
.obj {
|
||||||
|
grid-area: obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
.res {
|
||||||
|
grid-area: res;
|
||||||
|
|
||||||
|
ul.result_list {
|
||||||
|
list-style-type: none;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.objective_results:nth-child(2n+2) {
|
||||||
|
background-color: var(--chill-llight-gray);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.updatedBy {
|
||||||
|
margin-top: 1rem;
|
||||||
|
text-align: right;
|
||||||
|
font-size: 0.8rem;
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ul.timeline {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 0;
|
||||||
|
list-style-type: none;
|
||||||
|
|
||||||
|
> li {
|
||||||
|
min-width: 210px;
|
||||||
|
|
||||||
|
div.date {
|
||||||
|
margin-bottom: 20px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
div.label {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
padding: 0 40px;
|
||||||
|
border-top: 2px solid var(--chill-green);
|
||||||
|
|
||||||
|
&:before {
|
||||||
|
content: '';
|
||||||
|
display: inline-block;
|
||||||
|
position: relative;
|
||||||
|
width: 25px;
|
||||||
|
height: 25px;
|
||||||
|
|
||||||
|
background-color: white;
|
||||||
|
border-radius: 25px;
|
||||||
|
border: 1px solid #ddd;
|
||||||
|
|
||||||
|
top: -15px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,5 @@
|
|||||||
|
.banner-household {
|
||||||
|
.current-members-explain {
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
}
|
@ -1,7 +1,6 @@
|
|||||||
/// complete and overwrite flex-table in chillmain.scss
|
/// complete and overwrite flex-table in chillmain.scss
|
||||||
div.list-with-period,
|
div.list-with-period,
|
||||||
div.list-household-members,
|
div.list-household-members {
|
||||||
div.list-household-members--summary {
|
|
||||||
|
|
||||||
.chill-entity__person {
|
.chill-entity__person {
|
||||||
.chill-entity__person__first-name,
|
.chill-entity__person__first-name,
|
||||||
|
@ -24,7 +24,6 @@ if (root === 'app') {
|
|||||||
.use(i18n)
|
.use(i18n)
|
||||||
.component('app', App)
|
.component('app', App)
|
||||||
.mount('#accompanying-course');
|
.mount('#accompanying-course');
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,8 +42,7 @@ if (root === 'banner') {
|
|||||||
.use(store)
|
.use(store)
|
||||||
.use(i18n)
|
.use(i18n)
|
||||||
.component('banner', Banner)
|
.component('banner', Banner)
|
||||||
.mount('#accompanying-course');
|
.mount('#banner-accompanying-course');
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,224 @@
|
|||||||
|
<template>
|
||||||
|
|
||||||
|
<h2>{{ $t('pick_social_issue') }}</h2>
|
||||||
|
|
||||||
|
|
||||||
|
<div id="awc_create_form">
|
||||||
|
|
||||||
|
<div id="picking">
|
||||||
|
<p>{{ $t('pick_social_issue_linked_with_action') }}</p>
|
||||||
|
|
||||||
|
<div v-for="si in socialIssues">
|
||||||
|
<input type="radio" v-bind:value="si.id" name="socialIssue" v-model="socialIssuePicked"> {{ si.title.fr }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-if="hasSocialIssuePicked">
|
||||||
|
<h2>{{ $t('pick_an_action') }}</h2>
|
||||||
|
<vue-multiselect
|
||||||
|
v-model="socialActionPicked"
|
||||||
|
label="text"
|
||||||
|
:options="socialActionsReachables"
|
||||||
|
:searchable="true"
|
||||||
|
:close-on-select="true"
|
||||||
|
:show-labels="true"
|
||||||
|
track-by="id"
|
||||||
|
></vue-multiselect>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-if="isLoadingSocialActions">
|
||||||
|
<p>spinner</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-if="hasSocialActionPicked" id="persons">
|
||||||
|
<h2>{{ $t('persons_involved') }}</h2>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li v-for="p in personsReachables" :key="p.id">
|
||||||
|
<input type="checkbox" :value="p.id" v-model="personsPicked">
|
||||||
|
<person :person="p"></person>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div v-if="hasSocialActionPicked" id="start_date">
|
||||||
|
<p><label>{{ $t('startDate') }}</label> <input type="date" v-model="startDate" /></p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-if="hasSocialActionPicked" id="end_date">
|
||||||
|
<p><label>{{ $t('endDate') }}</label> <input type="date" v-model="endDate" /></p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="confirm">
|
||||||
|
<div v-if="hasErrors">
|
||||||
|
<p>{{ $t('form_has_errors') }}</p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li v-for="e in errors">
|
||||||
|
{{ e }}
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<ul class="record_actions">
|
||||||
|
<li class="cancel">
|
||||||
|
<a href="#" class="sc-button bt-cancel">
|
||||||
|
{{ $t('action.cancel') }}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li v-if="hasSocialActionPicked">
|
||||||
|
<button class="sc-button bt-save" v-show="!isPostingWork" @click="submit">
|
||||||
|
{{ $t('action.save') }}
|
||||||
|
</button>
|
||||||
|
<button class="sc-button bt-save" v-show="isPostingWork" disabled>
|
||||||
|
{{ $t('Save') }}
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
|
||||||
|
#awc_create_form {
|
||||||
|
display: grid;
|
||||||
|
grid-template-areas:
|
||||||
|
"picking picking"
|
||||||
|
"start_date end_date"
|
||||||
|
"confirm confirm"
|
||||||
|
;
|
||||||
|
grid-template-columns: 50% 50%;
|
||||||
|
column-gap: 1.5rem;
|
||||||
|
|
||||||
|
#picking {
|
||||||
|
grid-area: picking;
|
||||||
|
|
||||||
|
#persons {
|
||||||
|
ul {
|
||||||
|
padding: 0;
|
||||||
|
|
||||||
|
list-style-type: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#start_date {
|
||||||
|
grid-area: start_date;
|
||||||
|
}
|
||||||
|
|
||||||
|
#end_date {
|
||||||
|
grid-area: end_date;
|
||||||
|
}
|
||||||
|
|
||||||
|
#confirm {
|
||||||
|
grid-area: confirm;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { mapState, mapActions, mapGetters } from 'vuex';
|
||||||
|
import VueMultiselect from 'vue-multiselect';
|
||||||
|
import { dateToISO, ISOToDate } from 'ChillMainAssets/js/date.js';
|
||||||
|
import Person from 'ChillPersonAssets/vuejs/_components/Person/Person.vue';
|
||||||
|
|
||||||
|
const i18n = {
|
||||||
|
messages: {
|
||||||
|
fr: {
|
||||||
|
startDate: "Date de début",
|
||||||
|
endDate: "Date de fin",
|
||||||
|
form_has_errors: "Le formulaire comporte des erreurs",
|
||||||
|
pick_social_issue: "Choisir une problématique sociale",
|
||||||
|
pick_an_action: "Choisir une action d'accompagnement",
|
||||||
|
pick_social_issue_linked_with_action: "Indiquez la problématique sociale liée à l'action d'accompagnement",
|
||||||
|
persons_involved: "Usagers concernés",
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'App',
|
||||||
|
components: {
|
||||||
|
VueMultiselect,
|
||||||
|
Person,
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
submit() {
|
||||||
|
this.$store.dispatch('submit');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
i18n,
|
||||||
|
computed: {
|
||||||
|
...mapState([
|
||||||
|
'socialIssues',
|
||||||
|
'socialActionsReachables',
|
||||||
|
'errors',
|
||||||
|
'personsReachables',
|
||||||
|
]),
|
||||||
|
...mapGetters([
|
||||||
|
'hasSocialIssuePicked',
|
||||||
|
'hasSocialActionPicked',
|
||||||
|
'isLoadingSocialActions',
|
||||||
|
'isPostingWork',
|
||||||
|
'hasErrors',
|
||||||
|
]),
|
||||||
|
personsPicked: {
|
||||||
|
get() {
|
||||||
|
let s = this.$store.state.personsPicked.map(p => p.id);
|
||||||
|
console.log('persons picked', s);
|
||||||
|
|
||||||
|
return s;
|
||||||
|
},
|
||||||
|
set(v) {
|
||||||
|
console.log('persons picked', v);
|
||||||
|
this.$store.commit('setPersonsPickedIds', v);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
socialIssuePicked: {
|
||||||
|
get() {
|
||||||
|
let s = this.$store.state.socialIssuePicked;
|
||||||
|
|
||||||
|
if (s === null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return s.id;
|
||||||
|
},
|
||||||
|
set(value) {
|
||||||
|
this.$store.dispatch('pickSocialIssue', value);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
socialActionPicked: {
|
||||||
|
get() {
|
||||||
|
return this.$store.state.socialActionPicked;
|
||||||
|
},
|
||||||
|
set(value) {
|
||||||
|
this.$store.commit('setSocialAction', value);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
startDate: {
|
||||||
|
get() {
|
||||||
|
let d = this.$store.state.startDate;
|
||||||
|
return dateToISO(d);
|
||||||
|
},
|
||||||
|
set(value) {
|
||||||
|
this.$store.commit('setStartDate', ISOToDate(value));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
endDate: {
|
||||||
|
get() {
|
||||||
|
return dateToISO(this.$store.state.endDate);
|
||||||
|
},
|
||||||
|
set(value) {
|
||||||
|
this.$store.commit('setEndDate', ISOToDate(value));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
@ -0,0 +1,15 @@
|
|||||||
|
import { createApp } from 'vue';
|
||||||
|
import { _createI18n } from 'ChillMainAssets/vuejs/_js/i18n';
|
||||||
|
import { store } from './store';
|
||||||
|
import { personMessages } from 'ChillPersonAssets/vuejs/_js/i18n'
|
||||||
|
import App from './App.vue';
|
||||||
|
|
||||||
|
const i18n = _createI18n(personMessages);
|
||||||
|
|
||||||
|
const app = createApp({
|
||||||
|
template: `<app></app>`,
|
||||||
|
})
|
||||||
|
.use(store)
|
||||||
|
.use(i18n)
|
||||||
|
.component('app', App)
|
||||||
|
.mount('#accompanying_course_work_create');
|
@ -0,0 +1,175 @@
|
|||||||
|
|
||||||
|
import { createStore } from 'vuex';
|
||||||
|
import { datetimeToISO } from 'ChillMainAssets/js/date.js';
|
||||||
|
import { findSocialActionsBySocialIssue } from 'ChillPersonAssets/vuejs/_api/SocialWorkSocialAction.js';
|
||||||
|
import { create } from 'ChillPersonAssets/vuejs/_api/AccompanyingCourseWork.js';
|
||||||
|
|
||||||
|
const debug = process.env.NODE_ENV !== 'production';
|
||||||
|
|
||||||
|
const store = createStore({
|
||||||
|
strict: debug,
|
||||||
|
state: {
|
||||||
|
accompanyingCourse: window.accompanyingCourse,
|
||||||
|
socialIssues: window.accompanyingCourse.socialIssues,
|
||||||
|
socialIssuePicked: null,
|
||||||
|
socialActionsReachables: [],
|
||||||
|
socialActionPicked: null,
|
||||||
|
personsPicked: window.accompanyingCourse.participations.filter(p => p.endDate == null)
|
||||||
|
.map(p => p.person),
|
||||||
|
personsReachables: window.accompanyingCourse.participations.filter(p => p.endDate == null)
|
||||||
|
.map(p => p.person),
|
||||||
|
startDate: new Date(),
|
||||||
|
endDate: null,
|
||||||
|
isLoadingSocialActions: false,
|
||||||
|
isPostingWork: false,
|
||||||
|
errors: [],
|
||||||
|
},
|
||||||
|
getters: {
|
||||||
|
hasSocialActionPicked(state) {
|
||||||
|
console.log(state.socialActionPicked);
|
||||||
|
return null !== state.socialActionPicked;
|
||||||
|
},
|
||||||
|
hasSocialIssuePicked(state) {
|
||||||
|
console.log(state.socialIssuePicked);
|
||||||
|
return null !== state.socialIssuePicked;
|
||||||
|
},
|
||||||
|
isLoadingSocialActions(state) {
|
||||||
|
return state.isLoadingSocialActions;
|
||||||
|
},
|
||||||
|
isPostingWork(state) {
|
||||||
|
return state.isPostingWork;
|
||||||
|
},
|
||||||
|
buildPayloadCreate(state) {
|
||||||
|
let payload = {
|
||||||
|
type: 'accompanying_period_work',
|
||||||
|
socialAction: {
|
||||||
|
type: 'social_work_social_action',
|
||||||
|
id: state.socialActionPicked.id
|
||||||
|
},
|
||||||
|
startDate: {
|
||||||
|
datetime: datetimeToISO(state.startDate)
|
||||||
|
},
|
||||||
|
persons: []
|
||||||
|
};
|
||||||
|
|
||||||
|
for (let i in state.personsPicked) {
|
||||||
|
payload.persons.push({
|
||||||
|
id: state.personsPicked[i].id,
|
||||||
|
type: 'person'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (null !== state.endDate) {
|
||||||
|
payload.endDate = {
|
||||||
|
datetime: datetimeToISO(state.endDate)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return payload;
|
||||||
|
},
|
||||||
|
hasErrors(state) {
|
||||||
|
return state.errors.length > 0;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
mutations: {
|
||||||
|
setSocialActionsReachables(state, actions) {
|
||||||
|
console.log('set social action reachables');
|
||||||
|
console.log(actions);
|
||||||
|
|
||||||
|
state.socialActionsReachables = actions;
|
||||||
|
},
|
||||||
|
setSocialAction(state, socialAction) {
|
||||||
|
console.log('socialAction', socialAction);
|
||||||
|
state.socialActionPicked = socialAction;
|
||||||
|
},
|
||||||
|
setSocialIssue(state, socialIssueId) {
|
||||||
|
console.log('set social issue', socialIssueId);
|
||||||
|
if (socialIssueId === null) {
|
||||||
|
state.socialIssuePicked = null;
|
||||||
|
} else {
|
||||||
|
let mapped = state.socialIssues
|
||||||
|
.find(e => e.id === socialIssueId);
|
||||||
|
console.log('mapped', mapped);
|
||||||
|
state.socialIssuePicked = mapped;
|
||||||
|
console.log('social issue setted', state.socialIssuePicked);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
setIsLoadingSocialActions(state, s) {
|
||||||
|
state.isLoadingSocialActions = s;
|
||||||
|
},
|
||||||
|
setPostingWork(state) {
|
||||||
|
state.isPostingWork = true;
|
||||||
|
},
|
||||||
|
setStartDate(state, date) {
|
||||||
|
state.startDate = date;
|
||||||
|
},
|
||||||
|
setEndDate(state, date) {
|
||||||
|
state.endDate = date;
|
||||||
|
},
|
||||||
|
setPersonsPickedIds(state, ids) {
|
||||||
|
console.log('persons ids', ids);
|
||||||
|
state.personsPicked = state.personsReachables
|
||||||
|
.filter(p => ids.includes(p.id))
|
||||||
|
},
|
||||||
|
addErrors(state, { errors, cancel_posting }) {
|
||||||
|
console.log('add errors', errors);
|
||||||
|
state.errors = errors;
|
||||||
|
if (cancel_posting) {
|
||||||
|
state.isPostingWork = false;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
actions: {
|
||||||
|
pickSocialIssue({ commit }, socialIssueId) {
|
||||||
|
console.log('pick social issue');
|
||||||
|
|
||||||
|
commit('setIsLoadingSocialActions', true);
|
||||||
|
commit('setSocialAction', null);
|
||||||
|
commit('setSocialActionsReachables', []);
|
||||||
|
commit('setSocialIssue', null);
|
||||||
|
|
||||||
|
|
||||||
|
findSocialActionsBySocialIssue(socialIssueId).then(
|
||||||
|
(response) => {
|
||||||
|
console.log(response);
|
||||||
|
console.log(response.results);
|
||||||
|
commit('setSocialIssue', socialIssueId);
|
||||||
|
commit('setSocialActionsReachables', response.results);
|
||||||
|
commit('setIsLoadingSocialActions', false);
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
console.error(err);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
submit({ commit, getters, state }) {
|
||||||
|
console.log('submit');
|
||||||
|
let
|
||||||
|
payload = getters.buildPayloadCreate,
|
||||||
|
errors = [];
|
||||||
|
|
||||||
|
commit('setPostingWork');
|
||||||
|
|
||||||
|
create(state.accompanyingCourse.id, payload)
|
||||||
|
.then( ({status, data}) => {
|
||||||
|
console.log('created return', { status, data});
|
||||||
|
if (status === 200) {
|
||||||
|
console.log('created, nothing to do here any more. Bye-bye!');
|
||||||
|
window.location.assign(`/fr/person/accompanying-period/work/${data.id}/edit`);
|
||||||
|
} else if (status === 422) {
|
||||||
|
console.log(data);
|
||||||
|
for (let i in data.violations) {
|
||||||
|
console.log(i);
|
||||||
|
console.log(data.violations[i].title);
|
||||||
|
errors.push(data.violations[i].title);
|
||||||
|
}
|
||||||
|
console.log('errors after reseponse handling', errors);
|
||||||
|
console.log({errors, cancel_posting: true});
|
||||||
|
commit('addErrors', { errors, cancel_posting: true });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
export { store };
|
@ -0,0 +1,486 @@
|
|||||||
|
<template>
|
||||||
|
<div id="workEditor">
|
||||||
|
<div id="title">
|
||||||
|
<label class="action_title_label">{{ $t('action_title') }}</label>
|
||||||
|
<p class="action_title">{{ work.socialAction.text }}</p>
|
||||||
|
</div>
|
||||||
|
<div id="startDate">
|
||||||
|
<label>{{ $t('startDate') }}</label>
|
||||||
|
<input type="date" v-model="startDate" />
|
||||||
|
</div>
|
||||||
|
<div id="endDate">
|
||||||
|
<label>{{ $t('endDate') }}</label>
|
||||||
|
<input type="date" v-model="endDate" />
|
||||||
|
</div>
|
||||||
|
<div id="comment">
|
||||||
|
<label>Commentaire</label>
|
||||||
|
<ckeditor
|
||||||
|
:editor="editor"
|
||||||
|
v-model="note"
|
||||||
|
tag-name="textarea"
|
||||||
|
></ckeditor>
|
||||||
|
</div>
|
||||||
|
<div id="objectives" class="objectives_list">
|
||||||
|
<div class="title" aria="hidden">
|
||||||
|
<div><h3>Motifs - objectifs - dispositifs</h3></div>
|
||||||
|
<div><h3>Orientations - résultats</h3></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- results which are not attached to an objective -->
|
||||||
|
<div v-if="hasResultsForAction">
|
||||||
|
<div class="results_without_objective">
|
||||||
|
{{ $t('results_without_objective') }}
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<add-result :availableResults="resultsForAction" destination="action"></add-result>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- results which **are** attached to an objective -->
|
||||||
|
<div v-for="g in goalsPicked">
|
||||||
|
<div>
|
||||||
|
<div @click="removeGoal(g)" class="objective-title">
|
||||||
|
<i class="fa fa-times"></i>
|
||||||
|
{{ g.goal.title.fr }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<add-result destination="goal" :goal="g.goal"></add-result>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- box to add goal -->
|
||||||
|
<div class="add_goal">
|
||||||
|
<div>
|
||||||
|
<div v-if="showAddObjective">
|
||||||
|
|
||||||
|
<p>Motifs, objectifs et dispositifs disponibles pour ajout :</p>
|
||||||
|
|
||||||
|
<ul class="list-objectives">
|
||||||
|
<li v-for="g in availableForCheckGoal" @click="addGoal(g)" class="badge badge-primary">
|
||||||
|
<i class="fa fa-plus"></i>
|
||||||
|
{{ g.title.fr }}
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<ul class="record_actions">
|
||||||
|
<li>
|
||||||
|
<button @click="toggleAddObjective" class="sc-button bt-create">
|
||||||
|
Ajouter un objectif
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div><!-- empty for results --></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div id="persons">
|
||||||
|
<h2>{{ $t('persons_involved') }}</h2>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li v-for="p in personsReachables" :key="p.id">
|
||||||
|
<input type="checkbox" :value="p.id" v-model="personsPicked">
|
||||||
|
<person :person="p"></person>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div id="handlingThirdParty">
|
||||||
|
<h2>Tiers traitant</h2>
|
||||||
|
|
||||||
|
<div v-if="!hasHandlingThirdParty">
|
||||||
|
<p class="chill-no-data-statement">
|
||||||
|
Aucun tiers traitant
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<ul class="record_actions">
|
||||||
|
<li>
|
||||||
|
<add-persons
|
||||||
|
buttonTitle="Indiquer un tiers traitant"
|
||||||
|
modalTitle="Choisir un tiers"
|
||||||
|
v-bind:key="handlingThirdPartyPicker.key"
|
||||||
|
v-bind:options="handlingThirdPartyPicker.options"
|
||||||
|
@addNewPersons="setHandlingThirdParty"
|
||||||
|
ref="handlingThirdPartyPicker"> <!-- to cast child method -->
|
||||||
|
</add-persons>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div v-else>
|
||||||
|
<p>{{ handlingThirdParty.text }}</p>
|
||||||
|
<show-address :address="handlingThirdParty.address"></show-address>
|
||||||
|
|
||||||
|
<ul class="record_actions">
|
||||||
|
<li>
|
||||||
|
<button class="sc-button bt-delete" @click="removeHandlingThirdParty">
|
||||||
|
Supprimer le tiers traitant
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div id="thirdParties">
|
||||||
|
<h2>Tiers intervenants</h2>
|
||||||
|
|
||||||
|
<div v-if="!hasThirdParties">
|
||||||
|
<p class="chill-no-data-statement">Aucun tiers intervenant</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div v-else>
|
||||||
|
<ul>
|
||||||
|
<li v-for="t in thirdParties">
|
||||||
|
<p>{{ t.text }}</p>
|
||||||
|
<show-address :address="t.address"></show-address>
|
||||||
|
|
||||||
|
<ul class="record_actions">
|
||||||
|
<button class="sc-button bt-delete" @click="removeThirdParty(t)"></button>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<ul class="record_actions">
|
||||||
|
<li>
|
||||||
|
<add-persons
|
||||||
|
buttonTitle="Ajouter des tiers"
|
||||||
|
modalTitle="Choisir des tiers"
|
||||||
|
v-bind:key="thirdPartyPicker.key"
|
||||||
|
v-bind:options="thirdPartyPicker.options"
|
||||||
|
@addNewPersons="addThirdParties"
|
||||||
|
ref="thirdPartyPicker"> <!-- to cast child method -->
|
||||||
|
</add-persons>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="errors" v-if="errors.length > 0">
|
||||||
|
<p>Veuillez corriger les erreurs suivantes:</p>
|
||||||
|
<ul>
|
||||||
|
<li v-for="e in errors">{{ e }}</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<ul class="record_actions sticky-form-buttons">
|
||||||
|
<li v-if="!isPosting">
|
||||||
|
<button
|
||||||
|
class="sc-button bt-save"
|
||||||
|
@click="submit"
|
||||||
|
>
|
||||||
|
{{ $t('action.save') }}
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
|
<li v-if="isPosting">
|
||||||
|
<button
|
||||||
|
class="sc-button bt-save"
|
||||||
|
disabled
|
||||||
|
>
|
||||||
|
{{ $t('action.save') }}
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
|
||||||
|
#workEditor {
|
||||||
|
display: grid;
|
||||||
|
grid-template-areas:
|
||||||
|
"title title"
|
||||||
|
"startDate endDate"
|
||||||
|
"comment comment"
|
||||||
|
"objectives objectives"
|
||||||
|
"persons persons"
|
||||||
|
"handling handling"
|
||||||
|
"tparties tparties"
|
||||||
|
"errors errors"
|
||||||
|
;
|
||||||
|
|
||||||
|
grid-template-columns: 50%;
|
||||||
|
column-gap: 1rem;
|
||||||
|
|
||||||
|
#title {
|
||||||
|
grid-area: title;
|
||||||
|
|
||||||
|
.action_title_label {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
.action_title {
|
||||||
|
margin-top: 0;
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 1.5rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#startDate {
|
||||||
|
grid-area: startDate;
|
||||||
|
}
|
||||||
|
#endDate {
|
||||||
|
grid-area: endDate;
|
||||||
|
}
|
||||||
|
#comment {
|
||||||
|
grid-area: comment;
|
||||||
|
}
|
||||||
|
#objectives {
|
||||||
|
grid-area: objectives;
|
||||||
|
|
||||||
|
> div.title {
|
||||||
|
background-color: var(--chill-light-gray);
|
||||||
|
color: white;
|
||||||
|
|
||||||
|
h3 {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
> div {
|
||||||
|
display: grid;
|
||||||
|
grid-template-areas: "obj res";
|
||||||
|
grid-template-columns: 50%;
|
||||||
|
column-gap: 1rem;
|
||||||
|
|
||||||
|
> div {
|
||||||
|
&:nth-child(1) {
|
||||||
|
grid-area: obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:nth-child(2) {
|
||||||
|
grid-area: res;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
> div.results_without_objective {
|
||||||
|
background: repeating-linear-gradient(
|
||||||
|
45deg,
|
||||||
|
var(--chill-light-gray),
|
||||||
|
var(--chill-light-gray) 10px,
|
||||||
|
var(--chill-llight-gray) 10px,
|
||||||
|
var(--chill-llight-gray) 20px
|
||||||
|
);
|
||||||
|
|
||||||
|
text-align: center;
|
||||||
|
font-weight: 700;
|
||||||
|
padding-top: 1.5rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ul.list-objectives {
|
||||||
|
list-style-type: none;
|
||||||
|
padding: 0;
|
||||||
|
|
||||||
|
li {
|
||||||
|
margin: 0.5rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
div.objective-title {
|
||||||
|
margin-top: 1rem;
|
||||||
|
font-size: 1.5rem;
|
||||||
|
font-weight: bold;
|
||||||
|
text-align: center;
|
||||||
|
|
||||||
|
|
||||||
|
i.fa {
|
||||||
|
padding: 0.25rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
i.fa-times {
|
||||||
|
background-color: red;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
li.badge, div.badge {
|
||||||
|
padding-bottom: 0;
|
||||||
|
padding-top: 0;
|
||||||
|
padding-left: 0;
|
||||||
|
|
||||||
|
i.fa {
|
||||||
|
padding: 0.25rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
i.fa-plus {
|
||||||
|
background-color: green;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#persons {
|
||||||
|
grid-area: persons;
|
||||||
|
}
|
||||||
|
#handlingThirdParty {
|
||||||
|
grid-area: handling;
|
||||||
|
}
|
||||||
|
#thirdParties {
|
||||||
|
grid-area: tparties;
|
||||||
|
}
|
||||||
|
#errors {
|
||||||
|
grid-area: errors;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
import { mapState, mapGetters, } from 'vuex';
|
||||||
|
import { dateToISO, ISOToDate, ISOToDatetime } from 'ChillMainAssets/js/date.js';
|
||||||
|
import CKEditor from '@ckeditor/ckeditor5-vue';
|
||||||
|
import ClassicEditor from 'ChillMainAssets/modules/ckeditor5/index.js';
|
||||||
|
import AddResult from './_components/AddResult.vue';
|
||||||
|
import Person from 'ChillPersonAssets/vuejs/_components/Person/Person.vue';
|
||||||
|
import AddPersons from 'ChillPersonAssets/vuejs/_components/AddPersons.vue';
|
||||||
|
import ShowAddress from 'ChillMainAssets/vuejs/_components/ShowAddress.vue';
|
||||||
|
|
||||||
|
const i18n = {
|
||||||
|
messages: {
|
||||||
|
fr: {
|
||||||
|
action_title: "Action d'accompagnement",
|
||||||
|
startDate: "Date de début",
|
||||||
|
endDate: "Date de fin",
|
||||||
|
results_without_objective: "Résultats - orientations sans objectifs",
|
||||||
|
add_objectif: "Ajouter un motif - objectif - dispositif",
|
||||||
|
persons_involved: "Usagers concernés",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'App',
|
||||||
|
components: {
|
||||||
|
ckeditor: CKEditor.component,
|
||||||
|
AddResult,
|
||||||
|
AddPersons,
|
||||||
|
Person,
|
||||||
|
ShowAddress,
|
||||||
|
},
|
||||||
|
i18n,
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
editor: ClassicEditor,
|
||||||
|
showAddObjective: false,
|
||||||
|
handlingThirdPartyPicker: {
|
||||||
|
key: 'handling-third-party',
|
||||||
|
options: {
|
||||||
|
type: [ 'thirdparty' ],
|
||||||
|
priority: null,
|
||||||
|
uniq: true
|
||||||
|
},
|
||||||
|
},
|
||||||
|
thirdPartyPicker: {
|
||||||
|
key: 'third-party',
|
||||||
|
options: {
|
||||||
|
type: [ 'thirdparty' ],
|
||||||
|
priority: null,
|
||||||
|
uniq: false,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
...mapState([
|
||||||
|
'work',
|
||||||
|
'resultsForAction',
|
||||||
|
'goalsPicked',
|
||||||
|
'personsReachables',
|
||||||
|
'handlingThirdParty',
|
||||||
|
'thirdParties',
|
||||||
|
'isPosting',
|
||||||
|
'errors',
|
||||||
|
]),
|
||||||
|
...mapGetters([
|
||||||
|
'hasResultsForAction',
|
||||||
|
'hasHandlingThirdParty',
|
||||||
|
'hasThirdParties',
|
||||||
|
]),
|
||||||
|
startDate: {
|
||||||
|
get() {
|
||||||
|
console.log('get start date', this.$store.state.startDate);
|
||||||
|
return dateToISO(this.$store.state.startDate);
|
||||||
|
},
|
||||||
|
set(v) {
|
||||||
|
this.$store.commit('setStartDate', ISOToDate(v));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
endDate: {
|
||||||
|
get() {
|
||||||
|
console.log('get end date', this.$store.state.endDate);
|
||||||
|
return dateToISO(this.$store.state.endDate);
|
||||||
|
},
|
||||||
|
set(v) {
|
||||||
|
this.$store.commit('setEndDate', ISOToDate(v));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
note: {
|
||||||
|
get() {
|
||||||
|
return this.$store.state.note;
|
||||||
|
},
|
||||||
|
set(v) {
|
||||||
|
this.$store.commit('setNote', v);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
availableForCheckGoal() {
|
||||||
|
let pickedIds = this.$store.state.goalsPicked.map(g => g.goal.id);
|
||||||
|
console.log('pickeds goals id', pickedIds);
|
||||||
|
console.log(this.$store.state.goalsForAction);
|
||||||
|
|
||||||
|
return this.$store.state.goalsForAction.filter(g => !pickedIds.includes(g.id));
|
||||||
|
},
|
||||||
|
personsPicked: {
|
||||||
|
get() {
|
||||||
|
let s = this.$store.state.personsPicked.map(p => p.id);
|
||||||
|
console.log('persons picked', s);
|
||||||
|
|
||||||
|
return s;
|
||||||
|
},
|
||||||
|
set(v) {
|
||||||
|
console.log('persons picked', v);
|
||||||
|
this.$store.commit('setPersonsPickedIds', v);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
toggleAddObjective() {
|
||||||
|
this.showAddObjective = !this.showAddObjective;
|
||||||
|
},
|
||||||
|
addGoal(g) {
|
||||||
|
console.log('add Goal', g);
|
||||||
|
this.$store.commit('addGoal', g);
|
||||||
|
},
|
||||||
|
removeGoal(g) {
|
||||||
|
console.log('remove goal', g);
|
||||||
|
this.$store.commit('removeGoal', g);
|
||||||
|
},
|
||||||
|
setHandlingThirdParty({ selected, modal }) {
|
||||||
|
console.log('setHandlingThirdParty', selected);
|
||||||
|
this.$store.commit('setHandlingThirdParty', selected.shift().result);
|
||||||
|
this.$refs.handlingThirdPartyPicker.resetSearch();
|
||||||
|
modal.showModal = false;
|
||||||
|
},
|
||||||
|
removeHandlingThirdParty() {
|
||||||
|
console.log('removeHandlingThirdParty');
|
||||||
|
this.$store.commit('setHandlingThirdParty', null);
|
||||||
|
},
|
||||||
|
addThirdParties({ selected, modal}) {
|
||||||
|
console.log('addThirdParties', selected);
|
||||||
|
this.$store.commit('addThirdParties', selected.map(r => r.result));
|
||||||
|
this.$refs.thirdPartyPicker.resetSearch();
|
||||||
|
modal.showModal = false;
|
||||||
|
},
|
||||||
|
removeThirdParty(t) {
|
||||||
|
console.log('remove third party', t);
|
||||||
|
this.$store.commit('removeThirdParty', t);
|
||||||
|
},
|
||||||
|
submit() {
|
||||||
|
this.$store.dispatch('submit');
|
||||||
|
},
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
</script>
|
@ -0,0 +1,166 @@
|
|||||||
|
<template>
|
||||||
|
<div class="addResult" v-if="hasResult">
|
||||||
|
<p class="chill-no-data-statement" v-if="pickedResults.length ===0">
|
||||||
|
Aucun résultat associé
|
||||||
|
</p>
|
||||||
|
<ul class="list-results">
|
||||||
|
<li v-for="r in pickedResults" @click="removeResult(r)" class="badge badge-primary">
|
||||||
|
<i class="fa fa-times"></i>
|
||||||
|
{{ r.title.fr }}
|
||||||
|
</li>
|
||||||
|
<template v-if="isExpanded">
|
||||||
|
<li v-for="r in availableForCheckResults" @click="addResult(r)" class="badge badge-primary">
|
||||||
|
<i class="fa fa-plus"></i>
|
||||||
|
{{ r.title.fr }}
|
||||||
|
</li>
|
||||||
|
</template>
|
||||||
|
</ul>
|
||||||
|
<ul class="record_actions">
|
||||||
|
<li v-if="isExpanded">
|
||||||
|
<button @click="toggleSelect" class="sc-button bt-hide" >
|
||||||
|
<i class="fa fa-eye-slash"></i>
|
||||||
|
Masquer résultats et orientations disponibles
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
|
<li v-else>
|
||||||
|
<button @click="toggleSelect" class="sc-button bt-show">
|
||||||
|
Afficher résultats et orientations disponibles
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="noResult" v-if="!hasResult">
|
||||||
|
<div class="chill-no-data-statement">
|
||||||
|
{{ $t('goal_has_no_result') }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
|
||||||
|
button.hide {
|
||||||
|
background-color: rgb(51, 77, 92);
|
||||||
|
}
|
||||||
|
|
||||||
|
ul.list-results {
|
||||||
|
list-style-type: none;
|
||||||
|
padding: 0;
|
||||||
|
|
||||||
|
li {
|
||||||
|
margin: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
li.badge {
|
||||||
|
padding-bottom: 0;
|
||||||
|
padding-top: 0;
|
||||||
|
padding-left: 0;
|
||||||
|
|
||||||
|
i.fa {
|
||||||
|
/*border-radius: 0.25rem; */
|
||||||
|
padding: 0.25rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
i.fa-plus {
|
||||||
|
background-color: green;
|
||||||
|
}
|
||||||
|
|
||||||
|
i.fa-times {
|
||||||
|
background-color: red;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
const i18n = {
|
||||||
|
messages: {
|
||||||
|
fr: {
|
||||||
|
add_a_result: "Résultat - orientation disponibles",
|
||||||
|
goal_has_no_result: "Aucun résultat - orientation disponible",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "AddResult",
|
||||||
|
props: [ 'destination', 'goal' ],
|
||||||
|
i18n,
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
isExpanded: false,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
hasResult() {
|
||||||
|
if (this.destination === 'action') {
|
||||||
|
return this.$store.state.resultsForAction.length > 0;
|
||||||
|
} else if (this.destination === 'goal') {
|
||||||
|
return this.$store.getters.resultsForGoal(this.goal).length > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
throw Error(`this.destination is not implemented: ${this.destination}`);
|
||||||
|
},
|
||||||
|
pickedResults() {
|
||||||
|
console.log('get checked');
|
||||||
|
console.log('this.destination', this.destination);
|
||||||
|
console.log('this.goal', this.goal);
|
||||||
|
if (this.destination === 'action') {
|
||||||
|
return this.$store.state.resultsPicked;
|
||||||
|
} else if (this.destination === 'goal') {
|
||||||
|
return this.$store.getters.resultsPickedForGoal(this.goal);
|
||||||
|
}
|
||||||
|
|
||||||
|
throw Error(`this.destination is not implemented: ${this.destination}`);
|
||||||
|
},
|
||||||
|
availableForCheckResults() {
|
||||||
|
console.log('availableForCheckResults');
|
||||||
|
console.log('this.destination', this.destination);
|
||||||
|
console.log('this.goal', this.goal);
|
||||||
|
if (this.destination === 'action') {
|
||||||
|
let pickedIds = this.$store.state.resultsPicked.map(r => r.id);
|
||||||
|
console.log('picked ids', pickedIds);
|
||||||
|
|
||||||
|
return this.$store.state.resultsForAction.filter(r => !pickedIds.includes(r.id));
|
||||||
|
} else if (this.destination === 'goal') {
|
||||||
|
console.log('results picked for goal', this.$store.getters.resultsPickedForGoal(this.goal));
|
||||||
|
let pickedIds = this.$store.getters.resultsPickedForGoal(this.goal).map(r => r.id);
|
||||||
|
|
||||||
|
return this.$store.getters.resultsForGoal(this.goal).filter(r => !pickedIds.includes(r.id));
|
||||||
|
}
|
||||||
|
|
||||||
|
throw Error(`this.destination is not implemented: ${this.destination}`);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
toggleSelect() {
|
||||||
|
this.isExpanded = !this.isExpanded;
|
||||||
|
},
|
||||||
|
addResult(r) {
|
||||||
|
console.log('addResult', r);
|
||||||
|
if (this.destination === 'action') {
|
||||||
|
this.$store.commit('addResultPicked', r);
|
||||||
|
return;
|
||||||
|
} else if (this.destination === 'goal') {
|
||||||
|
this.$store.commit('addResultForGoalPicked', { goal: this.goal, result: r });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
throw Error(`this.destination is not implemented: ${this.destination}`);
|
||||||
|
},
|
||||||
|
removeResult(r) {
|
||||||
|
console.log('removeresult', r);
|
||||||
|
if (this.destination === 'action') {
|
||||||
|
this.$store.commit('removeResultPicked', r);
|
||||||
|
return;
|
||||||
|
} else if (this.destination === 'goal') {
|
||||||
|
this.$store.commit('removeResultForGoalPicked', { goal: this.goal, result: r });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
throw Error(`this.destination is not implemented: ${this.destination}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
@ -0,0 +1,15 @@
|
|||||||
|
import { createApp } from 'vue';
|
||||||
|
import { _createI18n } from 'ChillMainAssets/vuejs/_js/i18n';
|
||||||
|
import { store } from './store';
|
||||||
|
import { personMessages } from 'ChillPersonAssets/vuejs/_js/i18n'
|
||||||
|
import App from './App.vue';
|
||||||
|
|
||||||
|
const i18n = _createI18n(personMessages);
|
||||||
|
|
||||||
|
const app = createApp({
|
||||||
|
template: `<app></app>`,
|
||||||
|
})
|
||||||
|
.use(store)
|
||||||
|
.use(i18n)
|
||||||
|
.component('app', App)
|
||||||
|
.mount('#accompanying_course_work_edit');
|
@ -0,0 +1,304 @@
|
|||||||
|
import { createStore } from 'vuex';
|
||||||
|
import { datetimeToISO, ISOToDatetime } from 'ChillMainAssets/js/date.js';
|
||||||
|
import { findSocialActionsBySocialIssue } from 'ChillPersonAssets/vuejs/_api/SocialWorkSocialAction.js';
|
||||||
|
import { create } from 'ChillPersonAssets/vuejs/_api/AccompanyingCourseWork.js';
|
||||||
|
|
||||||
|
const debug = process.env.NODE_ENV !== 'production';
|
||||||
|
|
||||||
|
console.log(window.accompanyingCourseWork);
|
||||||
|
|
||||||
|
const store = createStore({
|
||||||
|
strict: debug,
|
||||||
|
state: {
|
||||||
|
work: window.accompanyingCourseWork,
|
||||||
|
startDate: ISOToDatetime(window.accompanyingCourseWork.startDate.datetime),
|
||||||
|
endDate: (window.accompanyingCourseWork.endDate !== null ?
|
||||||
|
ISOToDatetime(window.accompanyingCourseWork.endDate.datetime) : null),
|
||||||
|
note: window.accompanyingCourseWork.note,
|
||||||
|
goalsPicked: window.accompanyingCourseWork.goals,
|
||||||
|
resultsPicked: window.accompanyingCourseWork.results,
|
||||||
|
resultsForAction: [],
|
||||||
|
goalsForAction: [],
|
||||||
|
resultsForGoal: [],
|
||||||
|
personsPicked: window.accompanyingCourseWork.persons,
|
||||||
|
personsReachables: window.accompanyingCourseWork.accompanyingPeriod.participations.filter(p => p.endDate == null)
|
||||||
|
.map(p => p.person),
|
||||||
|
handlingThirdParty: window.accompanyingCourseWork.handlingThierParty,
|
||||||
|
thirdParties: window.accompanyingCourseWork.thirdParties,
|
||||||
|
isPosting: false,
|
||||||
|
errors: [],
|
||||||
|
},
|
||||||
|
getters: {
|
||||||
|
socialAction(state) {
|
||||||
|
return state.work.socialAction;
|
||||||
|
},
|
||||||
|
hasResultsForAction(state) {
|
||||||
|
return state.resultsForAction.length > 0;
|
||||||
|
},
|
||||||
|
resultsForGoal: (state) => (goal) => {
|
||||||
|
let founds = state.resultsForGoal.filter(r => r.goalId === goal.id);
|
||||||
|
|
||||||
|
return founds === undefined ? [] : founds;
|
||||||
|
},
|
||||||
|
resultsPickedForGoal: (state) => (goal) => {
|
||||||
|
let found = state.goalsPicked.find(g => g.goal.id === goal.id);
|
||||||
|
|
||||||
|
return found === undefined ? [] : found.results;
|
||||||
|
},
|
||||||
|
hasHandlingThirdParty(state) {
|
||||||
|
return state.handlingThirdParty !== null;
|
||||||
|
},
|
||||||
|
hasThirdParties(state) {
|
||||||
|
return state.thirdParties.length > 0;
|
||||||
|
},
|
||||||
|
buildPayload(state) {
|
||||||
|
return {
|
||||||
|
type: 'accompanying_period_work',
|
||||||
|
id: state.work.id,
|
||||||
|
startDate: {
|
||||||
|
datetime: datetimeToISO(state.startDate)
|
||||||
|
},
|
||||||
|
endDate: state.endDate === null ? null : {
|
||||||
|
datetime: datetimeToISO(state.endDate)
|
||||||
|
},
|
||||||
|
note: state.note,
|
||||||
|
persons: state.personsPicked.map(p => ({id: p.id, type: p.type})),
|
||||||
|
handlingThierParty: state.handlingThirdParty === null ? null : {
|
||||||
|
id: state.handlingThirdParty.id,
|
||||||
|
type: state.handlingThirdParty.type
|
||||||
|
},
|
||||||
|
results: state.resultsPicked.map(r => ({id: r.id, type: r.type})),
|
||||||
|
thirdParties: state.thirdParties.map(t => ({id: t.id, type: t.type})),
|
||||||
|
goals: state.goalsPicked.map(g => {
|
||||||
|
let o = {
|
||||||
|
type: g.type,
|
||||||
|
note: g.note,
|
||||||
|
goal: {
|
||||||
|
type: g.goal.type,
|
||||||
|
id: g.goal.id,
|
||||||
|
},
|
||||||
|
results: g.results.map(r => ({id: r.id, type: r.type})),
|
||||||
|
};
|
||||||
|
|
||||||
|
if (g.id !== undefined) {
|
||||||
|
o.id = g.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
return o;
|
||||||
|
})
|
||||||
|
};
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mutations: {
|
||||||
|
setStartDate(state, date) {
|
||||||
|
state.startDate = date;
|
||||||
|
},
|
||||||
|
setEndDate(state, date) {
|
||||||
|
state.endDate = date;
|
||||||
|
},
|
||||||
|
setResultsForAction(state, results) {
|
||||||
|
console.log('set results for action', results);
|
||||||
|
state.resultsForAction = results;
|
||||||
|
},
|
||||||
|
setResultsForGoal(state, { goal, results }) {
|
||||||
|
console.log('set results for goal', results);
|
||||||
|
state.goalsForAction.push(goal);
|
||||||
|
for (let i in results) {
|
||||||
|
let r = results[i];
|
||||||
|
r.goalId = goal.id;
|
||||||
|
console.log('adding result', r);
|
||||||
|
state.resultsForGoal.push(r);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
addResultPicked(state, result) {
|
||||||
|
state.resultsPicked.push(result);
|
||||||
|
},
|
||||||
|
removeResultPicked(state, result) {
|
||||||
|
state.resultsPicked = state.resultsPicked.filter(r => r.id !== result.id);
|
||||||
|
},
|
||||||
|
addGoal(state, goal) {
|
||||||
|
let g = {
|
||||||
|
type: "accompanying_period_work_goal",
|
||||||
|
goal: goal,
|
||||||
|
note: '',
|
||||||
|
results: []
|
||||||
|
}
|
||||||
|
state.goalsPicked.push(g);
|
||||||
|
},
|
||||||
|
removeGoal(state, goal) {
|
||||||
|
state.goalsPicked = state.goalsPicked.filter(g => g.id !== goal.id);
|
||||||
|
},
|
||||||
|
addResultForGoalPicked(state, { goal, result}) {
|
||||||
|
let found = state.goalsPicked.find(g => g.goal.id === goal.id);
|
||||||
|
console.log('adResultForGoalPicked');
|
||||||
|
console.log('found', found);
|
||||||
|
console.log('goal', goal);
|
||||||
|
console.log('result', result);
|
||||||
|
|
||||||
|
if (found === undefined) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
found.results.push(result);
|
||||||
|
},
|
||||||
|
removeResultForGoalPicked(state, { goal, result}) {
|
||||||
|
let found = state.goalsPicked.find(g => g.goal.id === goal.id);
|
||||||
|
|
||||||
|
if (found === undefined) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
found.results = found.results.filter(r => r.id !== result.id);
|
||||||
|
},
|
||||||
|
setPersonsPickedIds(state, ids) {
|
||||||
|
console.log('persons ids', ids);
|
||||||
|
state.personsPicked = state.personsReachables
|
||||||
|
.filter(p => ids.includes(p.id))
|
||||||
|
},
|
||||||
|
setNote(state, note) {
|
||||||
|
state.note = note;
|
||||||
|
},
|
||||||
|
setHandlingThirdParty(state, thirdParty) {
|
||||||
|
state.handlingThirdParty = thirdParty;
|
||||||
|
},
|
||||||
|
addThirdParties(state, thirdParties) {
|
||||||
|
console.log('addThirdParties', thirdParties);
|
||||||
|
// filter to remove existing thirdparties
|
||||||
|
let ids = state.thirdParties.map(t => t.id);
|
||||||
|
let unexistings = thirdParties.filter(t => !ids.includes(t.id));
|
||||||
|
console.log('unexisting third parties', unexistings);
|
||||||
|
for (let i in unexistings) {
|
||||||
|
state.thirdParties.push(unexistings[i]);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
removeThirdParty(state, thirdParty) {
|
||||||
|
state.thirdParties = state.thirdParties
|
||||||
|
.filter(t => t.id !== thirdParty.id);
|
||||||
|
},
|
||||||
|
setErrors(state, errors) {
|
||||||
|
console.log('handling errors', errors);
|
||||||
|
state.errors = errors;
|
||||||
|
},
|
||||||
|
setIsPosting(state, st) {
|
||||||
|
state.isPosting = st;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
actions: {
|
||||||
|
getReachablesGoalsForAction({ getters, commit, dispatch }) {
|
||||||
|
console.log('getReachablesGoalsForAction');
|
||||||
|
let
|
||||||
|
socialActionId = getters.socialAction.id,
|
||||||
|
url = `/api/1.0/person/social-work/goal/by-social-action/${socialActionId}.json`
|
||||||
|
;
|
||||||
|
|
||||||
|
console.log(url);
|
||||||
|
|
||||||
|
window
|
||||||
|
.fetch(
|
||||||
|
url
|
||||||
|
).then( response => {
|
||||||
|
if (response.ok) {
|
||||||
|
return response.json();
|
||||||
|
}
|
||||||
|
throw { m: 'Error while retriving goal for social action', s: response.status, b: response.body };
|
||||||
|
}).then( data => {
|
||||||
|
for (let i in data.results) {
|
||||||
|
dispatch('getReachablesResultsForGoal', data.results[i]);
|
||||||
|
}
|
||||||
|
}).catch( errors => {
|
||||||
|
commit('addErrors', errors);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
getReachablesResultsForGoal({ commit }, goal) {
|
||||||
|
console.log('getReachablesResultsForGoal');
|
||||||
|
let
|
||||||
|
url = `/api/1.0/person/social-work/result/by-goal/${goal.id}.json`
|
||||||
|
;
|
||||||
|
|
||||||
|
console.log(url);
|
||||||
|
|
||||||
|
window.fetch(url)
|
||||||
|
.then(response => {
|
||||||
|
if (response.ok) {
|
||||||
|
return response.json();
|
||||||
|
}
|
||||||
|
|
||||||
|
throw { m: 'Error while retriving results for goal', s: response.status, b: response.body };
|
||||||
|
})
|
||||||
|
.then(data => {
|
||||||
|
console.log('data');
|
||||||
|
commit('setResultsForGoal', { goal, results: data.results });
|
||||||
|
});
|
||||||
|
},
|
||||||
|
getReachablesResultsForAction({ getters, commit }) {
|
||||||
|
console.log('getReachablesResultsForAction');
|
||||||
|
let
|
||||||
|
socialActionId = getters.socialAction.id,
|
||||||
|
url = `/api/1.0/person/social-work/result/by-social-action/${socialActionId}.json`
|
||||||
|
;
|
||||||
|
|
||||||
|
console.log(url);
|
||||||
|
|
||||||
|
window.fetch(url)
|
||||||
|
.then(response => {
|
||||||
|
if (response.ok) {
|
||||||
|
return response.json();
|
||||||
|
}
|
||||||
|
|
||||||
|
throw { m: 'Error while retriving results for social action', s: response.status, b: response.body };
|
||||||
|
})
|
||||||
|
.then(data => {
|
||||||
|
console.log('data retrived', data);
|
||||||
|
commit('setResultsForAction', data.results);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
submit({ getters, state, commit }) {
|
||||||
|
let
|
||||||
|
payload = getters.buildPayload,
|
||||||
|
url = `/api/1.0/person/accompanying-course/work/${state.work.id}.json`,
|
||||||
|
errors = []
|
||||||
|
;
|
||||||
|
|
||||||
|
console.log('action subitting', payload, url);
|
||||||
|
commit('setIsPosting', true);
|
||||||
|
|
||||||
|
window.fetch(url, {
|
||||||
|
method: 'PUT',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
body: JSON.stringify(payload)
|
||||||
|
}).then(response => {
|
||||||
|
if (response.ok || response.status === 422) {
|
||||||
|
return response.json().then(data => ({data, status: response.status}));
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new Error(response.status);
|
||||||
|
}).then(({data, status}) => {
|
||||||
|
if (status === 422) {
|
||||||
|
for (let i in data.violations) {
|
||||||
|
errors.push(data.violations[i].title);
|
||||||
|
}
|
||||||
|
commit('setErrors', errors);
|
||||||
|
commit('setIsPosting', false);
|
||||||
|
} else {
|
||||||
|
console.info('nothing to do here, bye bye');
|
||||||
|
window.location.assign(`/fr/person/accompanying-period/${state.work.accompanyingPeriod.id}/work`);
|
||||||
|
}
|
||||||
|
}).catch(e => {
|
||||||
|
commit('setErrors', [
|
||||||
|
'Erreur serveur ou réseau: veuillez ré-essayer. Code erreur: ' + e
|
||||||
|
]);
|
||||||
|
commit('setIsPosting', false);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
initAsync({ dispatch }) {
|
||||||
|
dispatch('getReachablesResultsForAction');
|
||||||
|
dispatch('getReachablesGoalsForAction');
|
||||||
|
},
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
store.dispatch('initAsync');
|
||||||
|
|
||||||
|
export { store };
|
@ -24,6 +24,12 @@
|
|||||||
<div v-if="errors.length > 0">
|
<div v-if="errors.length > 0">
|
||||||
{{ errors }}
|
{{ errors }}
|
||||||
</div>
|
</div>
|
||||||
|
<div v-if="loading">
|
||||||
|
{{ $t('loading') }}
|
||||||
|
</div>
|
||||||
|
<div v-if="success">
|
||||||
|
{{ $t('household_address_move_success') }}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<ul class="record_actions sticky-form-buttons">
|
<ul class="record_actions sticky-form-buttons">
|
||||||
@ -65,6 +71,12 @@ export default {
|
|||||||
},
|
},
|
||||||
errors() {
|
errors() {
|
||||||
return this.$store.state.errorMsg;
|
return this.$store.state.errorMsg;
|
||||||
|
},
|
||||||
|
loading() {
|
||||||
|
return this.$store.state.loading;
|
||||||
|
},
|
||||||
|
success() {
|
||||||
|
return this.$store.state.success;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -7,7 +7,9 @@ const appMessages = {
|
|||||||
add_an_address_to_household: 'Déménager le ménage',
|
add_an_address_to_household: 'Déménager le ménage',
|
||||||
validFrom: 'Date du déménagement',
|
validFrom: 'Date du déménagement',
|
||||||
move_date: 'Date du déménagement',
|
move_date: 'Date du déménagement',
|
||||||
back_to_the_list: 'Retour à la liste'
|
back_to_the_list: 'Retour à la liste',
|
||||||
|
household_address_move_success: 'La nouvelle adresse du ménage est enregistrée',
|
||||||
|
loading: 'chargement en cours...'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -12,7 +12,9 @@ const store = createStore({
|
|||||||
newAddress: {},
|
newAddress: {},
|
||||||
household: {},
|
household: {},
|
||||||
validFrom: {},
|
validFrom: {},
|
||||||
errorMsg: []
|
errorMsg: [],
|
||||||
|
loading: false,
|
||||||
|
success: false
|
||||||
},
|
},
|
||||||
getters: {
|
getters: {
|
||||||
},
|
},
|
||||||
@ -31,12 +33,18 @@ const store = createStore({
|
|||||||
addDateToAddress(state, validFrom) {
|
addDateToAddress(state, validFrom) {
|
||||||
console.log('@M addDateToAddress address.validFrom', validFrom);
|
console.log('@M addDateToAddress address.validFrom', validFrom);
|
||||||
state.validFrom = validFrom;
|
state.validFrom = validFrom;
|
||||||
|
},
|
||||||
|
setLoading(state, b) {
|
||||||
|
state.loading = b;
|
||||||
|
},
|
||||||
|
setSuccess(state, b) {
|
||||||
|
state.success = b;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
addAddress({ commit }, payload) {
|
addAddress({ commit }, payload) {
|
||||||
console.log('@A addAddress payload', payload);
|
console.log('@A addAddress payload', payload);
|
||||||
|
commit('setLoading', true);
|
||||||
if('newPostalCode' in payload){
|
if('newPostalCode' in payload){
|
||||||
postPostalCode(payload.newPostalCode)
|
postPostalCode(payload.newPostalCode)
|
||||||
.then(postalCode => {
|
.then(postalCode => {
|
||||||
@ -46,9 +54,11 @@ const store = createStore({
|
|||||||
.then(address => new Promise((resolve, reject) => {
|
.then(address => new Promise((resolve, reject) => {
|
||||||
commit('addAddress', address);
|
commit('addAddress', address);
|
||||||
resolve();
|
resolve();
|
||||||
|
commit('setLoading', false);
|
||||||
}))
|
}))
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
commit('catchError', error);
|
commit('catchError', error);
|
||||||
|
commit('setLoading', false);
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -57,15 +67,17 @@ const store = createStore({
|
|||||||
.then(address => new Promise((resolve, reject) => {
|
.then(address => new Promise((resolve, reject) => {
|
||||||
commit('addAddress', address);
|
commit('addAddress', address);
|
||||||
resolve();
|
resolve();
|
||||||
|
commit('setLoading', false);
|
||||||
}))
|
}))
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
commit('catchError', error);
|
commit('catchError', error);
|
||||||
|
commit('setLoading', false);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
addDateToAddressAndAddressToHousehold({ commit }, payload) {
|
addDateToAddressAndAddressToHousehold({ commit }, payload) {
|
||||||
console.log('@A addDateToAddressAndAddressToHousehold payload', payload);
|
console.log('@A addDateToAddressAndAddressToHousehold payload', payload);
|
||||||
|
commit('setLoading', true);
|
||||||
patchAddress(payload.addressId, payload.body)
|
patchAddress(payload.addressId, payload.body)
|
||||||
.then(address => new Promise((resolve, reject) => {
|
.then(address => new Promise((resolve, reject) => {
|
||||||
commit('addDateToAddress', address.validFrom);
|
commit('addDateToAddress', address.validFrom);
|
||||||
@ -74,14 +86,18 @@ const store = createStore({
|
|||||||
postAddressToHousehold(payload.householdId, payload.addressId)
|
postAddressToHousehold(payload.householdId, payload.addressId)
|
||||||
.then(household => new Promise((resolve, reject) => {
|
.then(household => new Promise((resolve, reject) => {
|
||||||
commit('addAddressToHousehold', household);
|
commit('addAddressToHousehold', household);
|
||||||
|
commit('setSuccess', true);
|
||||||
|
commit('setLoading', false);
|
||||||
resolve();
|
resolve();
|
||||||
}))
|
}))
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
commit('catchError', error);
|
commit('catchError', error);
|
||||||
|
commit('setLoading', false);
|
||||||
})
|
})
|
||||||
))
|
))
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
commit('catchError', error);
|
commit('catchError', error);
|
||||||
|
commit('setLoading', false);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
<template>
|
<template>
|
||||||
<household></household>
|
<household></household>
|
||||||
<concerned></concerned>
|
<concerned v-if="hasHouseholdOrLeave"></concerned>
|
||||||
<dates></dates>
|
<dates v-if="showConfirm"></dates>
|
||||||
<confirmation></confirmation>
|
<confirmation v-if="showConfirm"></confirmation>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
import { mapState } from 'vuex';
|
import { mapGetters } from 'vuex';
|
||||||
import Concerned from './components/Concerned.vue';
|
import Concerned from './components/Concerned.vue';
|
||||||
import Household from './components/Household.vue';
|
import Household from './components/Household.vue';
|
||||||
import Dates from './components/Dates.vue';
|
import Dates from './components/Dates.vue';
|
||||||
@ -22,11 +22,14 @@ export default {
|
|||||||
Confirmation,
|
Confirmation,
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
// for debugging purpose
|
...mapGetters([
|
||||||
// (not working)
|
'hasHouseholdOrLeave',
|
||||||
//...mapState({
|
'hasPersonsWellPositionnated',
|
||||||
// 'concerned', 'household', 'positions'
|
]),
|
||||||
// })
|
showConfirm () {
|
||||||
|
return this.$store.getters.hasHouseholdOrLeave
|
||||||
|
&& this.$store.getters.hasPersonsWellPositionnated;
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,13 +21,10 @@
|
|||||||
<div v-for="conc in concUnpositionned"
|
<div v-for="conc in concUnpositionned"
|
||||||
class="item-bloc"
|
class="item-bloc"
|
||||||
v-bind:key="conc.person.id"
|
v-bind:key="conc.person.id"
|
||||||
draggable="true"
|
|
||||||
@dragstart="onStartDragConcern($event, conc.person.id)"
|
|
||||||
>
|
>
|
||||||
<div class="item-row person">
|
<div class="item-row person">
|
||||||
<div class="item-col box-person">
|
<div class="item-col box-person">
|
||||||
<div>
|
<div>
|
||||||
<img src="~ChillMainAssets/img/draggable.svg" class="drag-icon" />
|
|
||||||
<person :person="conc.person"></person>
|
<person :person="conc.person"></person>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="conc.person.birthdate !== null">
|
<div v-if="conc.person.birthdate !== null">
|
||||||
@ -89,21 +86,18 @@
|
|||||||
v-for="position in positions"
|
v-for="position in positions"
|
||||||
>
|
>
|
||||||
<h3>{{ position.label.fr }}</h3>
|
<h3>{{ position.label.fr }}</h3>
|
||||||
<div class="flex-table list-household-members">
|
|
||||||
|
<div v-if="concByPosition(position.id).length > 0" class="flex-table list-household-members">
|
||||||
<member-details
|
<member-details
|
||||||
v-for="conc in concByPosition(position.id)"
|
v-for="conc in concByPosition(position.id)"
|
||||||
v-bind:key="conc.person.id"
|
v-bind:key="conc.person.id"
|
||||||
v-bind:conc="conc"
|
v-bind:conc="conc"
|
||||||
>
|
>
|
||||||
</member-details>
|
</member-details>
|
||||||
<div
|
</div>
|
||||||
class="droppable_zone"
|
|
||||||
@drop="onDropConcern($event, position.id)"
|
<div v-else>
|
||||||
@dragover.prevent
|
<p class="chill-no-data-statement">{{ $t('household_members_editor.concerned.no_person_in_position') }}</p>
|
||||||
@dragenter.prevent
|
|
||||||
>
|
|
||||||
{{ $t('household_members_editor.drop_persons_here', {'position': position.label.fr }) }}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -120,22 +114,6 @@ div.person {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.drag-icon {
|
|
||||||
height: 1.1em;
|
|
||||||
margin-right: 0.5em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.droppable_zone {
|
|
||||||
background-color: var(--chill-llight-gray);
|
|
||||||
color: white;
|
|
||||||
font-size: large;
|
|
||||||
text-align: center;
|
|
||||||
display: table-cell;
|
|
||||||
vertical-align: middle;
|
|
||||||
padding: 1em;
|
|
||||||
background: linear-gradient(to top, var(--chill-light-gray), 30%, var(--chill-llight-gray));
|
|
||||||
}
|
|
||||||
|
|
||||||
.move_to {
|
.move_to {
|
||||||
.move_hint {
|
.move_hint {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
@ -194,18 +172,8 @@ export default {
|
|||||||
this.$refs.addPersons.resetSearch(); // to cast child method
|
this.$refs.addPersons.resetSearch(); // to cast child method
|
||||||
modal.showModal = false;
|
modal.showModal = false;
|
||||||
},
|
},
|
||||||
onStartDragConcern(evt, person_id) {
|
|
||||||
evt.dataTransfer.dropEffect = 'move'
|
|
||||||
evt.dataTransfer.effectAllowed = 'move'
|
|
||||||
evt.dataTransfer.setData('application/x.person', person_id)
|
|
||||||
},
|
|
||||||
onDropConcern(evt, position_id) {
|
|
||||||
const person_id = Number(evt.dataTransfer.getData('application/x.person'));
|
|
||||||
this.moveToPosition(person_id, position_id);
|
|
||||||
},
|
|
||||||
moveToPosition(person_id, position_id) {
|
moveToPosition(person_id, position_id) {
|
||||||
this.$store.dispatch('markPosition', { person_id, position_id });
|
this.$store.dispatch('markPosition', { person_id, position_id });
|
||||||
|
|
||||||
},
|
},
|
||||||
removeConcerned(conc) {
|
removeConcerned(conc) {
|
||||||
this.$store.dispatch('removeConcerned', conc);
|
this.$store.dispatch('removeConcerned', conc);
|
||||||
|
@ -2,11 +2,8 @@
|
|||||||
<h2>{{ $t('household_members_editor.household_part') }}</h2>
|
<h2>{{ $t('household_members_editor.household_part') }}</h2>
|
||||||
|
|
||||||
<div v-if="hasHousehold">
|
<div v-if="hasHousehold">
|
||||||
<span v-if="isHouseholdNew">
|
<div>
|
||||||
{{ $t('household_members_editor.household.new_household') }}
|
<household-viewer :household="household"></household-viewer>
|
||||||
</span>
|
|
||||||
<div v-else>
|
|
||||||
Ménage existant
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-else-if="isForceLeaveWithoutHousehold">
|
<div v-else-if="isForceLeaveWithoutHousehold">
|
||||||
@ -39,16 +36,20 @@
|
|||||||
<script>
|
<script>
|
||||||
|
|
||||||
import { mapGetters } from 'vuex';
|
import { mapGetters } from 'vuex';
|
||||||
|
import HouseholdViewer from 'ChillPersonAssets/vuejs/_components/Household/Household.vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Household',
|
name: 'Household',
|
||||||
|
components: {
|
||||||
|
HouseholdViewer,
|
||||||
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters([
|
...mapGetters([
|
||||||
'hasHousehold',
|
'hasHousehold',
|
||||||
'isHouseholdNew',
|
'isHouseholdNew',
|
||||||
]),
|
]),
|
||||||
household() {
|
household() {
|
||||||
return this.$store.household;
|
return this.$store.state.household;
|
||||||
},
|
},
|
||||||
allowHouseholdCreate() {
|
allowHouseholdCreate() {
|
||||||
return this.$store.state.allowHouseholdCreate;
|
return this.$store.state.allowHouseholdCreate;
|
||||||
|
@ -19,12 +19,13 @@ const appMessages = {
|
|||||||
move_to: "Déplacer vers",
|
move_to: "Déplacer vers",
|
||||||
persons_to_positionnate: 'Usagers à positionner',
|
persons_to_positionnate: 'Usagers à positionner',
|
||||||
persons_leaving: "Usagers quittant leurs ménages",
|
persons_leaving: "Usagers quittant leurs ménages",
|
||||||
|
no_person_in_position: "Aucun usager ne sera ajouté à cette position",
|
||||||
},
|
},
|
||||||
drop_persons_here: "Glissez-déposez ici les usagers pour la position \"{position}\"",
|
drop_persons_here: "Glissez-déposez ici les usagers pour la position \"{position}\"",
|
||||||
all_positionnated: "Tous les usagers sont positionnés",
|
all_positionnated: "Tous les usagers sont positionnés",
|
||||||
holder: "Titulaire",
|
holder: "Titulaire",
|
||||||
is_holder: "Sera titulaire",
|
is_holder: "Est titulaire",
|
||||||
is_not_holder: "Ne sera pas titulaire",
|
is_not_holder: "N'est pas titulaire",
|
||||||
remove_position: "Retirer des {position}",
|
remove_position: "Retirer des {position}",
|
||||||
remove_concerned: "Ne plus transférer",
|
remove_concerned: "Ne plus transférer",
|
||||||
household_part: "Ménage de destination",
|
household_part: "Ménage de destination",
|
||||||
|
@ -19,7 +19,15 @@ const store = createStore({
|
|||||||
state: {
|
state: {
|
||||||
concerned,
|
concerned,
|
||||||
household: window.household_members_editor_data.household,
|
household: window.household_members_editor_data.household,
|
||||||
positions: window.household_members_editor_data.positions,
|
positions: window.household_members_editor_data.positions.sort((a, b) => {
|
||||||
|
if (a.ordering < b.ordering) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (a.ordering > b.ordering) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}),
|
||||||
startDate: new Date(),
|
startDate: new Date(),
|
||||||
allowHouseholdCreate: window.household_members_editor_data.allowHouseholdCreate,
|
allowHouseholdCreate: window.household_members_editor_data.allowHouseholdCreate,
|
||||||
allowHouseholdSearch: window.household_members_editor_data.allowHouseholdSearch,
|
allowHouseholdSearch: window.household_members_editor_data.allowHouseholdSearch,
|
||||||
@ -35,6 +43,13 @@ const store = createStore({
|
|||||||
hasHousehold(state) {
|
hasHousehold(state) {
|
||||||
return state.household !== null;
|
return state.household !== null;
|
||||||
},
|
},
|
||||||
|
hasHouseholdOrLeave(state) {
|
||||||
|
return state.household !== null || state.forceLeaveWithoutHousehold;
|
||||||
|
},
|
||||||
|
hasPersonsWellPositionnated(state, getters) {
|
||||||
|
return getters.needsPositionning === false
|
||||||
|
|| (getters.persons.length > 0 && getters.concUnpositionned.length === 0);
|
||||||
|
},
|
||||||
persons(state) {
|
persons(state) {
|
||||||
return state.concerned.map(conc => conc.person);
|
return state.concerned.map(conc => conc.person);
|
||||||
},
|
},
|
||||||
@ -150,7 +165,7 @@ const store = createStore({
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
createHousehold(state) {
|
createHousehold(state) {
|
||||||
state.household = { type: 'household', members: [], address: null }
|
state.household = { type: 'household', members: [], current_address: null }
|
||||||
state.forceLeaveWithoutHousehold = false;
|
state.forceLeaveWithoutHousehold = false;
|
||||||
},
|
},
|
||||||
forceLeaveWithoutHousehold(state) {
|
forceLeaveWithoutHousehold(state) {
|
||||||
|
@ -0,0 +1,30 @@
|
|||||||
|
const create = (accompanying_period_id, payload) => {
|
||||||
|
const url = `/api/1.0/person/accompanying-course/${accompanying_period_id}/work.json`;
|
||||||
|
let status;
|
||||||
|
console.log('create', payload);
|
||||||
|
|
||||||
|
return fetch(url, {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
body: JSON.stringify(payload),
|
||||||
|
})
|
||||||
|
.then(response => {
|
||||||
|
if (response.ok || response.status === 422) {
|
||||||
|
status = response.status;
|
||||||
|
|
||||||
|
return response.json();
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new Error("Error while retrieving social actions: " + response.status +
|
||||||
|
" " + response.statusText);
|
||||||
|
})
|
||||||
|
.then(data => {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
resolve({ status, data });
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export { create };
|
@ -0,0 +1,21 @@
|
|||||||
|
|
||||||
|
const findSocialActionsBySocialIssue = (id) => {
|
||||||
|
const url = `/api/1.0/person/social/social-action/by-social-issue/${id}.json`;
|
||||||
|
|
||||||
|
return fetch(url)
|
||||||
|
.then(response => {
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error("Error while retrieving social actions " + response.status
|
||||||
|
+ " " + response.statusText);
|
||||||
|
}
|
||||||
|
return response.json();
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
throw err
|
||||||
|
})
|
||||||
|
;
|
||||||
|
};
|
||||||
|
|
||||||
|
export {
|
||||||
|
findSocialActionsBySocialIssue
|
||||||
|
};
|
@ -0,0 +1,139 @@
|
|||||||
|
<template>
|
||||||
|
<div class="chill-entity chill-entity__household">
|
||||||
|
<!-- identifier -->
|
||||||
|
<div v-if="isHouseholdNew()" class="identifier">
|
||||||
|
<i class="fa fa-home"></i>
|
||||||
|
{{ $t('new_household') }}
|
||||||
|
</div>
|
||||||
|
<div v-else class="identifier">
|
||||||
|
<i class="fa fa-home"></i>
|
||||||
|
{{ $t('household_number', { number: household.id } ) }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- member part -->
|
||||||
|
<div v-if="hasCurrentMembers" class="members">
|
||||||
|
<span class="current-members">{{ $t('current_members') }}: </span>
|
||||||
|
<template v-for="(m, index) in currentMembers()" :key="m.id">
|
||||||
|
<person :person="m.person"></person>
|
||||||
|
<span v-if="m.holder">
|
||||||
|
<span class="badge badge-primary">{{ $t('holder') }}</span>
|
||||||
|
</span>
|
||||||
|
<span v-if="index != (currentMembersLength() - 1)">, </span>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
<div v-else class="members">
|
||||||
|
<p class="chill-no-data-statement">{{ $t('no_members_yet') }}</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- address part -->
|
||||||
|
<div v-if="hasAddress()" class="where">
|
||||||
|
<i class="fa fa-where"></i>
|
||||||
|
<show-address :address="household.current_address"></show-address>
|
||||||
|
</div>
|
||||||
|
<div v-else class="where">
|
||||||
|
<i class="fa fa-where"></i>
|
||||||
|
<p class="chill-no-data-statement">{{ $t('no_current_address') }}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
.chill-entity__household {
|
||||||
|
display: grid;
|
||||||
|
grid-template-areas:
|
||||||
|
"identifier identifier where"
|
||||||
|
"who who where"
|
||||||
|
;
|
||||||
|
grid-template-columns:
|
||||||
|
auto auto 30%
|
||||||
|
;
|
||||||
|
|
||||||
|
.identifier {
|
||||||
|
grid-area: identifier;
|
||||||
|
|
||||||
|
font-size: 1.3em;
|
||||||
|
font-weight: 700;
|
||||||
|
color: var(--chill-blue);
|
||||||
|
|
||||||
|
}
|
||||||
|
.members {
|
||||||
|
grid-area: who;
|
||||||
|
|
||||||
|
.current-members {
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.where {
|
||||||
|
grid-area: where
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
import Person from 'ChillPersonAssets/vuejs/_components/Person/Person.vue';
|
||||||
|
import ShowAddress from 'ChillMainAssets/vuejs/_components/ShowAddress.vue';
|
||||||
|
|
||||||
|
const i18n = {
|
||||||
|
"messages":
|
||||||
|
{
|
||||||
|
"fr":
|
||||||
|
{
|
||||||
|
"household_number": "Ménage #{number}",
|
||||||
|
"current_members": "Membres actuels",
|
||||||
|
"no_current_address": "Sans adresse actuellement",
|
||||||
|
"new_household": "Nouveau ménage",
|
||||||
|
"no_members_yet": "Aucun membre actuellement",
|
||||||
|
"holder": "titulaire",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
;
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'Household',
|
||||||
|
props: ['household'],
|
||||||
|
components: {
|
||||||
|
Person,
|
||||||
|
ShowAddress,
|
||||||
|
},
|
||||||
|
i18n,
|
||||||
|
methods: {
|
||||||
|
hasCurrentMembers() {
|
||||||
|
return this.household.current_members_id.length > 0;
|
||||||
|
},
|
||||||
|
currentMembers() {
|
||||||
|
return this.household.members.filter(m => this.household.current_members_id.includes(m.id))
|
||||||
|
.sort((a, b) => {
|
||||||
|
if (a.position.ordering < b.position.ordering) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (a.position.ordering > b.position.ordering) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if (a.holder && !b.holder) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (!a.holder && b.holder) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
currentMembersLength() {
|
||||||
|
return this.household.current_members_id.length;
|
||||||
|
},
|
||||||
|
isHouseholdNew() {
|
||||||
|
return !Number.isInteger(this.household.id);
|
||||||
|
},
|
||||||
|
hasAddress() {
|
||||||
|
return this.household.current_address !== null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
</script>
|
@ -24,3 +24,4 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<span id="banner-accompanying-course"></span>
|
||||||
|
@ -222,8 +222,10 @@
|
|||||||
|
|
||||||
<h2>{{ 'Social actions'|trans }}</h2>
|
<h2>{{ 'Social actions'|trans }}</h2>
|
||||||
|
|
||||||
<h2>{{ 'Last events on accompanying course'|trans }}</h2>
|
{% set person = null %}
|
||||||
|
{% block contentActivity %}
|
||||||
|
{% include 'ChillActivityBundle:Activity:list.html.twig' with {'context': 'accompanyingCourse', 'context': 'person'} %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
{# ==> insert accompanyingCourse vue component #}
|
{# ==> insert accompanyingCourse vue component #}
|
||||||
<div id="accompanying-course"></div>
|
<div id="accompanying-course"></div>
|
||||||
|
@ -0,0 +1,24 @@
|
|||||||
|
{% extends '@ChillPerson/AccompanyingCourse/layout.html.twig' %}
|
||||||
|
|
||||||
|
{% block title 'accompanying_course_work.Create accompanying course work'|trans %}
|
||||||
|
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<h1>{{ block('title') }}</h1>
|
||||||
|
|
||||||
|
<div id="accompanying_course_work_create"></div>
|
||||||
|
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block js %}
|
||||||
|
<script type="text/javascript">
|
||||||
|
window.accompanyingCourse = {{ json|json_encode|raw }};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{{ encore_entry_script_tags('accompanying_course_work_create') }}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block css %}
|
||||||
|
{{ parent() }}
|
||||||
|
{{ encore_entry_link_tags('accompanying_course_work_create') }}
|
||||||
|
{% endblock %}
|
@ -0,0 +1,25 @@
|
|||||||
|
{% extends '@ChillPerson/AccompanyingCourse/layout.html.twig' %}
|
||||||
|
|
||||||
|
{% block title 'accompanying_course_work.Edit accompanying course work'|trans %}
|
||||||
|
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<h1>{{ block('title') }}</h1>
|
||||||
|
|
||||||
|
<div id="accompanying_course_work_edit"></div>
|
||||||
|
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block js %}
|
||||||
|
{{ parent() }}
|
||||||
|
<script type="text/javascript">
|
||||||
|
window.accompanyingCourseWork = {{ json|json_encode|raw }};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{{ encore_entry_script_tags('accompanying_course_work_edit') }}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block css %}
|
||||||
|
{{ parent() }}
|
||||||
|
{{ encore_entry_link_tags('accompanying_course_work_edit') }}
|
||||||
|
{% endblock %}
|
@ -0,0 +1,124 @@
|
|||||||
|
{% extends '@ChillPerson/AccompanyingCourse/layout.html.twig' %}
|
||||||
|
|
||||||
|
{% block title 'accompanying_course_work.List accompanying course work'|trans %}
|
||||||
|
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<h1>{{ block('title') }}</h1>
|
||||||
|
|
||||||
|
<div id="accompanying_course_work_list">
|
||||||
|
{% for w in works %}
|
||||||
|
<div class="item">
|
||||||
|
<div class="title">
|
||||||
|
<p class="title_label">{{ 'accompanying_course_work.action'|trans }}</p >
|
||||||
|
<h2 class="action_title">
|
||||||
|
{{ w.socialAction|chill_entity_render_box({ 'no-badge': true }) }}
|
||||||
|
</h2>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="timeline">
|
||||||
|
<ul class="timeline">
|
||||||
|
<li class="completed">
|
||||||
|
<div class="date">
|
||||||
|
<span>{{ w.createdAt|format_date('long') }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="label">
|
||||||
|
<span>{{ 'accompanying_course_work.create_date'|trans }}</span>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="completed">
|
||||||
|
<div class="date">
|
||||||
|
<span>{{ w.startDate|format_date('long') }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="label">
|
||||||
|
<span>{{ 'accompanying_course_work.start_date'|trans }}</span>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="{%if date(w.endDate) < date('now') %}completed{% endif %}">
|
||||||
|
<div class="date">
|
||||||
|
<span>{{ w.endDate|format_date('long') }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="label">
|
||||||
|
<span>{{ 'accompanying_course_work.end_date'|trans }}</span>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% if w.results|length > 0 %}
|
||||||
|
<div class="objective_results objective_results__without-objectives">
|
||||||
|
<div class="obj without_objective">
|
||||||
|
<p class="title_label">{{ 'accompanying_course_work.goal'|trans }}</p>
|
||||||
|
<p class="chill-no-data-statement">{{ 'accompanying_course_work.results without objective'|trans }}</p>
|
||||||
|
</div>
|
||||||
|
<div class="res results">
|
||||||
|
<p class="title_label">{{ 'accompanying_course_work.results'|trans }}</p>
|
||||||
|
<ul class="result_list">
|
||||||
|
{% for r in w.results %}
|
||||||
|
<li class="badge badge-primary">{{ r.title|localize_translatable_string }}</li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if w.goals|length > 0 %}
|
||||||
|
{% for g in w.goals %}
|
||||||
|
<div class="objective_results objective_results--with-objectives">
|
||||||
|
<div class="objective obj">
|
||||||
|
<p class="title_label">{{ 'accompanying_course_work.goal'|trans }}</p>
|
||||||
|
<h3 class="goal_title">{{ g.goal.title|localize_translatable_string }}</h3>
|
||||||
|
</div>
|
||||||
|
<div class="results res">
|
||||||
|
{% if g.results|length == 0 %}
|
||||||
|
<p class="title_label">{{ 'accompanying_course_work.results'|trans }}</p>
|
||||||
|
<p class="chill-no-data-statement">{{ 'accompanying_course_work.no_results'|trans }}</p>
|
||||||
|
{% else %}
|
||||||
|
<p class="title_label">{{ 'accompanying_course_work.results'|trans }}</p>
|
||||||
|
<ul class="result_list">
|
||||||
|
{% for r in g.results %}
|
||||||
|
<li class="badge badge-primary">{{ r.title|localize_translatable_string }}</li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<div class="updatedBy">
|
||||||
|
{{ 'Last updated by'|trans}}: {{ w.updatedBy|chill_entity_render_box }}, {{ w.updatedAt|format_datetime('long', 'short') }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="actions">
|
||||||
|
<ul class="record_actions">
|
||||||
|
<li>
|
||||||
|
<a
|
||||||
|
class="sc-button bt-edit"
|
||||||
|
href="{{ chill_path_add_return_path('chill_person_accompanying_period_work_edit', { 'id': w.id }) }}">{{ 'Update'|trans }}</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% else %}
|
||||||
|
<p class="chill-no-data-statement">{{ 'accompanying_course_work.No work'|trans }}</p>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<ul class="record_actions sticky-form-buttons">
|
||||||
|
<li>
|
||||||
|
<a href="{{ chill_path_add_return_path('chill_person_accompanying_period_work_new', { 'id': accompanyingCourse.id }) }}"
|
||||||
|
class="sc-button bt-new">
|
||||||
|
{{ 'accompanying_course_work.create'|trans }}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
|
||||||
|
{% block css %}
|
||||||
|
{{ parent() }}
|
||||||
|
{{ encore_entry_link_tags('accompanying_course_work_list') }}
|
||||||
|
{% endblock %}
|
@ -1,6 +1,6 @@
|
|||||||
{% set reversed_parents = parents|reverse %}
|
{% set reversed_parents = parents|reverse %}
|
||||||
<span class="chill-entity chill-entity__social-action">
|
<span class="chill-entity chill-entity__social-action">
|
||||||
<span class="badge badge-primary">
|
<span class="{% if not options['no-badge'] %}badge badge-primary{% endif %}">
|
||||||
{%- for p in reversed_parents %}
|
{%- for p in reversed_parents %}
|
||||||
<span class="chill-entity__social-action__parent--{{ loop.revindex0 }}">
|
<span class="chill-entity__social-action__parent--{{ loop.revindex0 }}">
|
||||||
{{ p.title|localize_translatable_string }}{{ options['default.separator'] }}
|
{{ p.title|localize_translatable_string }}{{ options['default.separator'] }}
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
<ul class="record_actions sticky-form-buttons">
|
<ul class="record_actions sticky-form-buttons">
|
||||||
<li class="cancel">
|
<li class="cancel">
|
||||||
<a
|
<a
|
||||||
href="{{ chill_return_path_or('chill_person_household_members', { 'household_id': household.id}) }}"
|
href="{{ chill_return_path_or('chill_person_household_summary', { 'household_id': household.id}) }}"
|
||||||
class="sc-button bt-cancel"
|
class="sc-button bt-cancel"
|
||||||
>
|
>
|
||||||
{{ 'Cancel'|trans }}
|
{{ 'Cancel'|trans }}
|
||||||
|
@ -12,28 +12,38 @@
|
|||||||
|
|
||||||
<div class="grid-3" id="banner-flags"></div>
|
<div class="grid-3" id="banner-flags"></div>
|
||||||
|
|
||||||
<div class="grid-3" id="banner-status"></div>
|
<div class="grid-3" id="banner-status">
|
||||||
|
{% set address = household.currentAddress %}
|
||||||
|
{% if address is empty %}
|
||||||
|
<p class="chill-no-data-statement">{{ 'household.Household does not have any address currently'|trans }}</p>
|
||||||
|
{% else %}
|
||||||
|
<div>
|
||||||
|
{{ address|chill_entity_render_box({'multiline': true, 'with_valid_from': false}) }}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="grid-12 parent" id="header-household-details" >
|
<div class="grid-12 parent" id="header-household-details" >
|
||||||
<div class="grid-10 push-1 grid-mobile-12 grid-tablet-12 push-mobile-0 push-tablet-0 parent">
|
<div class="grid-10 push-1 grid-mobile-12 grid-tablet-12 push-mobile-0 push-tablet-0 parent">
|
||||||
<div id="banner-misc">
|
<div id="banner-misc">
|
||||||
{%- set persons = household.getCurrentPersons() -%}
|
{%- set members = household.getCurrentMembersOrdered() -%}
|
||||||
{%- if persons|length > 0 -%}
|
{%- if members|length > 0 -%}
|
||||||
<span class="current-members-explain">
|
<span class="current-members-explain">
|
||||||
{{- 'household.Current household members'|trans }}:
|
{{- 'household.Current household members'|trans }}:
|
||||||
</span>
|
</span>
|
||||||
{%- for p in persons|slice(0, 5) -%}
|
{%- for m in members|slice(0, 5) -%}
|
||||||
{{- p|chill_entity_render_box({'addLink': false}) -}}
|
{{- m.person|chill_entity_render_box({'addLink': false}) -}}
|
||||||
{%- if false == loop.last -%}, {% endif -%}
|
{%- if m.holder %} <span class="badge badge-primary">{{ 'household.holder'|trans }}</span>{% endif -%}
|
||||||
{%- endfor -%}
|
{%- if false == loop.last -%}, {% endif -%}
|
||||||
{% if persons|length > 5 %}
|
{%- endfor -%}
|
||||||
<span class="current-members-more">
|
{% if members|length > 5 %}
|
||||||
{{ 'household.and x other persons'|trans({'x': persons|length-5}) }}
|
<span class="current-members-more">
|
||||||
</span>
|
{{ 'household.and x other persons'|trans({'x': members|length-5}) }}
|
||||||
{% endif %}
|
</span>
|
||||||
{%- endif -%}
|
{% endif %}
|
||||||
|
{%- endif -%}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -5,49 +5,233 @@
|
|||||||
{% block content %}
|
{% block content %}
|
||||||
<h1>{{ block('title') }}</h1>
|
<h1>{{ block('title') }}</h1>
|
||||||
|
|
||||||
<h2>{{ 'household.Current household members'|trans }}</h2>
|
<h2>{{ 'household.Current address'|trans }}</h2>
|
||||||
|
|
||||||
|
{% set address = household.currentAddress %}
|
||||||
|
|
||||||
|
{% if address is empty %}
|
||||||
|
<p class="chill-no-data-statement">{{ 'household.Household does not have any address currently'|trans }}</p>
|
||||||
|
{% else %}
|
||||||
|
<div>
|
||||||
|
{{ address|chill_entity_render_box({'multiline': true}) }}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<h2>{{ 'household.Household members'|trans }}</h2>
|
||||||
|
|
||||||
|
{% if form is not null %}
|
||||||
|
{{ form_start(form) }}
|
||||||
|
|
||||||
|
{{ form_row(form.commentMembers) }}
|
||||||
|
|
||||||
|
<div id="waitingForBirthContainer">
|
||||||
|
{{ form_row(form.waitingForBirth) }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="waitingForBirthDateContainer">
|
||||||
|
{{ form_row(form.waitingForBirthDate) }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<ul class="record_actions">
|
||||||
|
<li>
|
||||||
|
<button type="submit" class="sc-button bt-save">
|
||||||
|
{{ 'Save'|trans }}
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
{{ form_end(form) }}
|
||||||
|
{% else %}
|
||||||
|
|
||||||
|
{% if not household.commentMembers.isEmpty() %}
|
||||||
|
{{ household.commentMembers|chill_entity_render_box }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if household.waitingForBirth %}
|
||||||
|
{% if household.waitingForBirthDate is not null %}
|
||||||
|
{{ 'household.Expecting for birth on date'|trans({ 'date': household.waitingForBirthDate|format_date('long') }) }}
|
||||||
|
{% else %}
|
||||||
|
{{ 'household.Expecting for birth'|trans }}
|
||||||
|
{% endif %}
|
||||||
|
{% else %}
|
||||||
|
<p class="chill-no-data-statement">
|
||||||
|
{{ 'household.Any expecting birth'|trans }}
|
||||||
|
</p>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<ul class="record_actions">
|
||||||
|
<li>
|
||||||
|
<a
|
||||||
|
href="{{ chill_path_add_return_path('chill_person_household_summary', { 'household_id': household.id, 'edit': 1 }) }}"
|
||||||
|
class="sc-button bt-edit"
|
||||||
|
>
|
||||||
|
{{ 'household.Comment and expecting birth'|trans }}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
{% for p in positions %}
|
{% for p in positions %}
|
||||||
{%- set members = household.currentMembersByPosition(p) %}
|
<h3>{{ p.label|localize_translatable_string }}</h3>
|
||||||
{% if members|length > 0 %}
|
|
||||||
<h3>{{ p.label|localize_translatable_string }}</h3>
|
|
||||||
|
|
||||||
{% if false == p.shareHousehold %}
|
{% if false == p.shareHousehold %}
|
||||||
<p>{{ 'household.Those members does not share address'|trans }}</p>
|
<p>{{ 'household.Those members does not share address'|trans }}</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<div class="flex-table list-household-members--summary">
|
{%- set members = household.currentMembersByPosition(p) %}
|
||||||
{% for m in members %}
|
{% if members|length > 0 %}
|
||||||
<div class="item-bloc">
|
<div class="flex-table list-household-members">
|
||||||
<div class="item-row person">
|
{% for m in members %}
|
||||||
<div class="item-col box-person">
|
<div class="item-bloc">
|
||||||
<div>
|
<div class="item-row person">
|
||||||
{{ m.person|chill_entity_render_box({'addLink': true}) }}
|
<div class="item-col box-person">
|
||||||
{% if m.holder %}
|
<div>
|
||||||
<span class="badge badge-primary">{{ 'household.holder'|trans }}</span>
|
{{ m.person|chill_entity_render_box({'addLink': true}) }}
|
||||||
|
{% if m.holder %}
|
||||||
|
<span class="badge badge-primary">{{ 'household.holder'|trans }}</span>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
{{ 'Born the date'|trans({ 'gender': m.person.gender, 'birthdate': m.person.birthdate|format_date('long') }) }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="item-col box-where">
|
||||||
|
<ul class="list-content fa-ul">
|
||||||
|
{% if m.startDate is not empty %}
|
||||||
|
<li>{{ 'Since %date%'|trans({'%date%': m.startDate|format_date('long') }) }}</li>
|
||||||
|
{% endif %}
|
||||||
|
{% if m.endDate is not empty %}
|
||||||
|
<li>{{ 'Until %date%'|trans({'%date%': m.endDate|format_date('long') }) }}</li>
|
||||||
|
{% endif %}
|
||||||
|
</ul>
|
||||||
|
<ul class="record_actions">
|
||||||
|
<li>
|
||||||
|
<a
|
||||||
|
href="{{ chill_path_add_return_path('chill_person_household_member_edit', { 'id': m.id }) }}"
|
||||||
|
class="sc-button bt-edit"
|
||||||
|
/>
|
||||||
|
{{ 'household.Update membership'|trans }}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a
|
||||||
|
href="{{ chill_path_add_return_path(
|
||||||
|
'chill_person_household_members_editor',
|
||||||
|
{
|
||||||
|
'persons': [ m.person.id ],
|
||||||
|
'household': household.id
|
||||||
|
} ) }}"
|
||||||
|
class="sc-button"
|
||||||
|
/>
|
||||||
|
<i class="fa fa-arrows-h"></i>
|
||||||
|
{{ 'household.Change position'|trans }}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a
|
||||||
|
href="{{ chill_path_add_return_path(
|
||||||
|
'chill_person_household_members_editor',
|
||||||
|
{
|
||||||
|
'persons': [ m.person.id ],
|
||||||
|
'allow_leave_without_household': true
|
||||||
|
} ) }}"
|
||||||
|
class="sc-button"
|
||||||
|
/>
|
||||||
|
<i class="fa fa-sign-out"></i>
|
||||||
|
{{ 'household.Leave'|trans }}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% if m.comment is not empty %}
|
||||||
|
<div class="item-row comment">
|
||||||
|
<blockquote class="chill-user-quote">
|
||||||
|
{{ m.comment|chill_markdown_to_html }}
|
||||||
|
</blockquote>
|
||||||
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
<div>
|
{% endfor %}
|
||||||
{{ 'Born the date'|trans({ 'gender': m.person.gender, 'birthdate': m.person.birthdate|format_date('long') }) }}
|
</div>
|
||||||
</div>
|
{% else %}
|
||||||
</div>
|
<p class="chill-no-data-statement">{{ 'household.Any persons into this position'|trans }}</p>
|
||||||
<div class="item-col box-where">
|
{% endif %}
|
||||||
<ul class="list-content fa-ul">
|
|
||||||
{% if m.startDate is not empty %}
|
{% set members = household.nonCurrentMembersByPosition(p) %}
|
||||||
<li>{{ 'Since %date%'|trans({'%date%': m.startDate|format_date('long') }) }}</li>
|
{% if members|length > 0 %}
|
||||||
{% endif %}
|
<p><!-- force a space after table --></p>
|
||||||
{% if m.endDate is not empty %}
|
<button class="sc-button bt-green" type="button" data-toggle="collapse" data-target="#nonCurrent_{{ p.id }}" aria-expanded="false" aria-controls="collapse non current members">
|
||||||
<li>{{ 'Until %date%'|trans({'%date%': m.endDate|format_date('long') }) }}</li>
|
{{ 'household.Show future or past memberships'|trans({'length': members|length}) }}
|
||||||
{% endif %}
|
</button>
|
||||||
</ul>
|
|
||||||
|
<div id="nonCurrent_{{ p.id }}" class="collapse">
|
||||||
|
<div class="flex-table list-household-members">
|
||||||
|
{% for m in members %}
|
||||||
|
<div class="item-bloc">
|
||||||
|
<div class="item-row person">
|
||||||
|
<div class="item-col box-person">
|
||||||
|
<div>
|
||||||
|
{{ m.person|chill_entity_render_box({'addLink': true}) }}
|
||||||
|
{% if m.holder %}
|
||||||
|
<span class="badge badge-primary">{{ 'household.holder'|trans }}</span>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
{{ 'Born the date'|trans({ 'gender': m.person.gender, 'birthdate': m.person.birthdate|format_date('long') }) }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="item-col box-where">
|
||||||
|
<ul class="list-content fa-ul">
|
||||||
|
{% if m.startDate is not empty %}
|
||||||
|
<li>{{ 'Since %date%'|trans({'%date%': m.startDate|format_date('long') }) }}</li>
|
||||||
|
{% endif %}
|
||||||
|
{% if m.endDate is not empty %}
|
||||||
|
<li>{{ 'Until %date%'|trans({'%date%': m.endDate|format_date('long') }) }}</li>
|
||||||
|
{% endif %}
|
||||||
|
</ul>
|
||||||
|
<ul class="record_actions">
|
||||||
|
<li>
|
||||||
|
<a
|
||||||
|
href="{{ chill_path_add_return_path('chill_person_household_member_edit', { 'id': m.id }) }}"
|
||||||
|
class="sc-button bt-edit"
|
||||||
|
/>
|
||||||
|
{{ 'household.Update membership'|trans }}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% if m.comment is not empty %}
|
||||||
|
<div class="item-row comment">
|
||||||
|
<blockquote class="chill-user-quote">
|
||||||
|
{{ m.comment|chill_markdown_to_html }}
|
||||||
|
</blockquote>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
{% endfor %}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
|
<ul class="record_actions">
|
||||||
|
<li>
|
||||||
|
<a
|
||||||
|
href="{{ chill_path_add_return_path('chill_person_household_members_editor', {'household': household.id }) }}"
|
||||||
|
class="sc-button bt-create">
|
||||||
|
{{ 'household.Add a member'|trans }}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block js %}
|
||||||
|
{{ encore_entry_script_tags('household_edit_metadata') }}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
@ -43,6 +43,7 @@
|
|||||||
{{ form_widget(form.altNames, { 'label': 'Alternative names'}) }}
|
{{ form_widget(form.altNames, { 'label': 'Alternative names'}) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{{ form_row(form.gender, {'label' : 'Gender'}) }}
|
{{ form_row(form.gender, {'label' : 'Gender'}) }}
|
||||||
|
{{ form_row(form.genderComment, { 'label' : 'Comment on the gender'} ) }}
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
<fieldset>
|
<fieldset>
|
||||||
@ -54,9 +55,12 @@
|
|||||||
{%- if form.countryOfBirth is defined -%}
|
{%- if form.countryOfBirth is defined -%}
|
||||||
{{ form_row(form.countryOfBirth, { 'label' : 'Country of birth' } ) }}
|
{{ form_row(form.countryOfBirth, { 'label' : 'Country of birth' } ) }}
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
|
{%- if form.deathdate is defined -%}
|
||||||
|
{{ form_row(form.deathdate, { 'label' : 'Date of death' } ) }}
|
||||||
|
{%- endif -%}
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
{%- if form.nationality is defined or form.spokenLanguages is defined or form.maritalStatus is defined -%}
|
{%- if form.nationality is defined or form.spokenLanguages is defined -%}
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend><h2>{{ 'Administrative information'|trans }}</h2></legend>
|
<legend><h2>{{ 'Administrative information'|trans }}</h2></legend>
|
||||||
{%- if form.nationality is defined -%}
|
{%- if form.nationality is defined -%}
|
||||||
@ -65,8 +69,21 @@
|
|||||||
{%- if form.spokenLanguages is defined -%}
|
{%- if form.spokenLanguages is defined -%}
|
||||||
{{ form_row(form.spokenLanguages, {'label' : 'Spoken languages'}) }}
|
{{ form_row(form.spokenLanguages, {'label' : 'Spoken languages'}) }}
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
|
</fieldset>
|
||||||
|
{%- endif -%}
|
||||||
|
|
||||||
|
{%- if form.numberOfChildren is defined or form.maritalStatus is defined -%}
|
||||||
|
<fieldset>
|
||||||
|
<legend><h2>{{ 'Marital status'|trans }}</h2></legend>
|
||||||
|
{{ form_row(form.numberOfChildren, {'label' : 'Number of children'}) }}
|
||||||
{%- if form.maritalStatus is defined -%}
|
{%- if form.maritalStatus is defined -%}
|
||||||
{{ form_row(form.maritalStatus, { 'label' : 'Marital status'} ) }}
|
<div id="maritalStatus">
|
||||||
|
{{ form_row(form.maritalStatus, { 'label' : 'Marital status'} ) }}
|
||||||
|
</div>
|
||||||
|
<div id="maritalStatusDate">
|
||||||
|
{{ form_row(form.maritalStatusDate, { 'label' : 'Date of last marital status change'} ) }}
|
||||||
|
{{ form_row(form.maritalStatusComment, { 'label' : 'Comment on the marital status'} ) }}
|
||||||
|
</div>
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
</fieldset>
|
</fieldset>
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
@ -75,13 +92,24 @@
|
|||||||
<fieldset>
|
<fieldset>
|
||||||
<legend><h2>{{ 'Contact information'|trans }}</h2></legend>
|
<legend><h2>{{ 'Contact information'|trans }}</h2></legend>
|
||||||
{%- if form.email is defined -%}
|
{%- if form.email is defined -%}
|
||||||
{{ form_row(form.email, {'label': 'Email'}) }}
|
<div id="personEmail">
|
||||||
|
{{ form_row(form.email, {'label': 'Email'}) }}
|
||||||
|
</div>
|
||||||
|
<div id="personAcceptEmail">
|
||||||
|
{{ form_row(form.acceptEmail, {'label' : 'Accept emails ?'}) }}
|
||||||
|
</div>
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
|
|
||||||
{%- if form.phonenumber is defined -%}
|
{%- if form.phonenumber is defined -%}
|
||||||
{{ form_row(form.phonenumber, {'label': 'Phonenumber'}) }}
|
{{ form_row(form.phonenumber, {'label': 'Phonenumber'}) }}
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
{%- if form.mobilenumber is defined -%}
|
{%- if form.mobilenumber is defined -%}
|
||||||
{{ form_row(form.mobilenumber, {'label': 'Mobilenumber'}) }}
|
<div id="personPhoneNumber">
|
||||||
|
{{ form_row(form.mobilenumber, {'label': 'Mobilenumber'}) }}
|
||||||
|
</div>
|
||||||
|
<div id="personAcceptSMS">
|
||||||
|
{{ form_row(form.acceptSMS, {'label' : 'Accept short text message ?'}) }}
|
||||||
|
</div>
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
{%- if form.otherPhoneNumbers is defined -%}
|
{%- if form.otherPhoneNumbers is defined -%}
|
||||||
{{ form_widget(form.otherPhoneNumbers) }}
|
{{ form_widget(form.otherPhoneNumbers) }}
|
||||||
@ -114,3 +142,8 @@
|
|||||||
|
|
||||||
|
|
||||||
{% endblock personcontent %}
|
{% endblock personcontent %}
|
||||||
|
|
||||||
|
|
||||||
|
{% block js %}
|
||||||
|
<script type="text/javascript" src="{{ asset('build/person.js') }}"></script>
|
||||||
|
{% endblock js %}
|
||||||
|
@ -73,12 +73,14 @@ This view should receive those arguments:
|
|||||||
|
|
||||||
<dt>{{ 'Gender'|trans }} :</dt>
|
<dt>{{ 'Gender'|trans }} :</dt>
|
||||||
<dd>{{ ( person.gender|default('Not given'))|trans }}</dd>
|
<dd>{{ ( person.gender|default('Not given'))|trans }}</dd>
|
||||||
|
|
||||||
|
{% if not person.genderComment.isEmpty %}
|
||||||
|
<dt>{{ 'Gender comment'|trans }} :</dt>
|
||||||
|
<dd>{{ person.genderComment|chill_entity_render_box }}</dd>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
{% if is_granted('CHILL_PERSON_UPDATE', person) %}
|
|
||||||
{{ include(edit_tmp_name, edit_tmp_args) }}
|
|
||||||
{% endif %}
|
|
||||||
</figure>
|
</figure>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -114,11 +116,14 @@ This view should receive those arguments:
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% endapply %}</dd>
|
{% endapply %}</dd>
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
|
|
||||||
|
{% if person.deathdate is not null %}
|
||||||
|
<dt>{{ 'Date of death'|trans }} :</dt>
|
||||||
|
<dd>{{ person.deathdate|format_date('long') }}</dd>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
{% if is_granted('CHILL_PERSON_UPDATE', person) %}
|
|
||||||
{{ include(edit_tmp_name, edit_tmp_args) }}
|
|
||||||
{% endif %}
|
|
||||||
</figure>
|
</figure>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -155,6 +160,21 @@ This view should receive those arguments:
|
|||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
|
|
||||||
|
|
||||||
|
{%-if chill_person.fields.number_of_children == 'visible' -%}
|
||||||
|
<dl>
|
||||||
|
<dt>{{'Number of children'|trans}} :</dt>
|
||||||
|
<dd>
|
||||||
|
{% if person.numberOfChildren is not null %}
|
||||||
|
{{ person.numberOfChildren }}
|
||||||
|
{% else %}
|
||||||
|
<span class="chill-no-data-statement">{{ 'No data given'|trans }}</span>
|
||||||
|
{% endif %}
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
{%- endif -%}
|
||||||
|
|
||||||
{%- if chill_person.fields.marital_status == 'visible' -%}
|
{%- if chill_person.fields.marital_status == 'visible' -%}
|
||||||
<dl>
|
<dl>
|
||||||
<dt>{{'Marital status'|trans}} :</dt>
|
<dt>{{'Marital status'|trans}} :</dt>
|
||||||
@ -166,11 +186,24 @@ This view should receive those arguments:
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
<dl>
|
||||||
|
<dt>{{'Date of last marital status change'|trans}} :</dt>
|
||||||
|
{% if person.maritalStatusDate is not null %}
|
||||||
|
<dd>
|
||||||
|
{{ person.maritalStatusDate|format_date('long') }}
|
||||||
|
</dd>
|
||||||
|
{% endif %}
|
||||||
|
</dl>
|
||||||
|
<dl>
|
||||||
|
{% if not person.maritalStatusComment.isEmpty %}
|
||||||
|
<dt>{{'Comment on the marital status'|trans}} :</dt>
|
||||||
|
<dd>
|
||||||
|
{{ person.maritalStatusComment|chill_entity_render_box }}
|
||||||
|
</dd>
|
||||||
|
{% endif %}
|
||||||
|
</dl>
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
|
|
||||||
{% if is_granted('CHILL_PERSON_UPDATE', person) %}
|
|
||||||
{{ include(edit_tmp_name, edit_tmp_args) }}
|
|
||||||
{% endif %}
|
|
||||||
</figure>
|
</figure>
|
||||||
</div>
|
</div>
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
@ -213,6 +246,13 @@ This view should receive those arguments:
|
|||||||
<dl>
|
<dl>
|
||||||
<dt>{{ 'Email'|trans }} :</dt>
|
<dt>{{ 'Email'|trans }} :</dt>
|
||||||
<dd>{% if person.email is not empty %}<a href="mailto:{{ person.email|escape('html_attr') }}">{{ person.email }}</a>{% else %}<span class="chill-no-data-statement">{{ 'No data given'|trans }}</span>{% endif %}</dd>
|
<dd>{% if person.email is not empty %}<a href="mailto:{{ person.email|escape('html_attr') }}">{{ person.email }}</a>{% else %}<span class="chill-no-data-statement">{{ 'No data given'|trans }}</span>{% endif %}</dd>
|
||||||
|
{%- if person.email is not empty and person.acceptEmail -%}
|
||||||
|
<dd>
|
||||||
|
<span class="badge badge-secondary">
|
||||||
|
{{- 'Accept emails'|trans -}}
|
||||||
|
</span>
|
||||||
|
</dd>
|
||||||
|
{%- endif -%}
|
||||||
</dl>
|
</dl>
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
{%- if chill_person.fields.phonenumber == 'visible' -%}
|
{%- if chill_person.fields.phonenumber == 'visible' -%}
|
||||||
@ -225,6 +265,13 @@ This view should receive those arguments:
|
|||||||
<dl>
|
<dl>
|
||||||
<dt>{{ 'Mobilenumber'|trans }} :</dt>
|
<dt>{{ 'Mobilenumber'|trans }} :</dt>
|
||||||
<dd>{% if person.mobilenumber is not empty %}<a href="tel:{{ person.mobilenumber }}"><pre>{{ person.mobilenumber|chill_format_phonenumber }}</pre></a>{% else %}<span class="chill-no-data-statement">{{ 'No data given'|trans }}{% endif %}</dd>
|
<dd>{% if person.mobilenumber is not empty %}<a href="tel:{{ person.mobilenumber }}"><pre>{{ person.mobilenumber|chill_format_phonenumber }}</pre></a>{% else %}<span class="chill-no-data-statement">{{ 'No data given'|trans }}{% endif %}</dd>
|
||||||
|
{%- if person.mobilenumber is not empty and person.acceptSMS -%}
|
||||||
|
<dd>
|
||||||
|
<span class="badge badge-secondary">
|
||||||
|
{{- 'Accept short text message'|trans -}}
|
||||||
|
</span>
|
||||||
|
</dd>
|
||||||
|
{%- endif -%}
|
||||||
</dl>
|
</dl>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% for pp in person.otherPhoneNumbers %}
|
{% for pp in person.otherPhoneNumbers %}
|
||||||
@ -253,9 +300,6 @@ This view should receive those arguments:
|
|||||||
</dl>
|
</dl>
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
|
|
||||||
{% if is_granted('CHILL_PERSON_UPDATE', person) %}
|
|
||||||
{{ include(edit_tmp_name, edit_tmp_args) }}
|
|
||||||
{% endif %}
|
|
||||||
</figure>
|
</figure>
|
||||||
</div>
|
</div>
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
@ -272,14 +316,21 @@ This view should receive those arguments:
|
|||||||
|
|
||||||
<div class="grid-10 push-1 grid-mobile-12 grid-tablet-12 push-mobile-0 push-tablet-0 parent">
|
<div class="grid-10 push-1 grid-mobile-12 grid-tablet-12 push-mobile-0 push-tablet-0 parent">
|
||||||
<figure class="person-details">
|
<figure class="person-details">
|
||||||
|
|
||||||
{% if is_granted('CHILL_PERSON_UPDATE', person) %}
|
|
||||||
{{ include(edit_tmp_name, edit_tmp_args) }}
|
|
||||||
{% endif %}
|
|
||||||
</figure>
|
</figure>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{% if is_granted('CHILL_PERSON_UPDATE', person) %}
|
||||||
|
<ul class="grid-12 sticky-form-buttons record_actions ">
|
||||||
|
<li>
|
||||||
|
<a class="sc-button bt-update" href="{{ path('chill_person_general_edit', { 'person_id': person.id }) }}">
|
||||||
|
{{ 'Edit'|trans }}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
</div> <!-- end of div.person-view -->
|
</div> <!-- end of div.person-view -->
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -0,0 +1,45 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Chill\PersonBundle\Serializer\Normalizer;
|
||||||
|
|
||||||
|
use Chill\PersonBundle\Entity\SocialWork\SocialAction;
|
||||||
|
use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait;
|
||||||
|
use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface;
|
||||||
|
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
|
||||||
|
use Chill\PersonBundle\Templating\Entity\SocialActionRender;
|
||||||
|
|
||||||
|
|
||||||
|
class SocialActionNormalizer implements NormalizerInterface, NormalizerAwareInterface
|
||||||
|
{
|
||||||
|
use NormalizerAwareTrait;
|
||||||
|
|
||||||
|
private SocialActionRender $render;
|
||||||
|
|
||||||
|
public function __construct(SocialActionRender $render)
|
||||||
|
{
|
||||||
|
$this->render = $render;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public function normalize($socialAction, string $format = null, array $context = [])
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'id' => $socialAction->getId(),
|
||||||
|
'type' => 'social_work_social_action',
|
||||||
|
'text' => $this->render->renderString($socialAction, []),
|
||||||
|
'parent' => $this->normalizer->normalize($socialAction->getParent()),
|
||||||
|
'desactivationDate' => $this->normalizer->normalize($socialAction->getDesactivationDate()),
|
||||||
|
'title' => $socialAction->getTitle()
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public function supportsNormalization($data, string $format = null)
|
||||||
|
{
|
||||||
|
return $data instanceof SocialAction;
|
||||||
|
}
|
||||||
|
}
|
@ -13,9 +13,14 @@ class SocialActionRender implements ChillEntityRenderInterface
|
|||||||
private EngineInterface $engine;
|
private EngineInterface $engine;
|
||||||
|
|
||||||
public const SEPARATOR_KEY = 'default.separator';
|
public const SEPARATOR_KEY = 'default.separator';
|
||||||
|
/**
|
||||||
|
* if true, the action will not be encapsulated into a "badge"
|
||||||
|
*/
|
||||||
|
public const NO_BADGE = 'no-badge';
|
||||||
|
|
||||||
public const DEFAULT_ARGS = [
|
public const DEFAULT_ARGS = [
|
||||||
self::SEPARATOR_KEY => ' > ',
|
self::SEPARATOR_KEY => ' > ',
|
||||||
|
self::NO_BADGE => false,
|
||||||
];
|
];
|
||||||
|
|
||||||
public function __construct(TranslatableStringHelper $translatableStringHelper, EngineInterface $engine)
|
public function __construct(TranslatableStringHelper $translatableStringHelper, EngineInterface $engine)
|
||||||
@ -33,17 +38,18 @@ class SocialActionRender implements ChillEntityRenderInterface
|
|||||||
{
|
{
|
||||||
/** @var $socialAction SocialAction */
|
/** @var $socialAction SocialAction */
|
||||||
$options = \array_merge(self::DEFAULT_ARGS, $options);
|
$options = \array_merge(self::DEFAULT_ARGS, $options);
|
||||||
|
$titles[] = $this->translatableStringHelper->localize($socialAction->getTitle());
|
||||||
$str = $this->translatableStringHelper->localize($socialAction->getTitle());
|
|
||||||
|
|
||||||
while ($socialAction->hasParent()) {
|
while ($socialAction->hasParent()) {
|
||||||
$socialAction = $socialAction->getParent();
|
$socialAction = $socialAction->getParent();
|
||||||
$str .= $options[self::SEPARATOR_KEY].$this->translatableStringHelper->localize(
|
$titles[] = $this->translatableStringHelper->localize(
|
||||||
$socialAction->getTitle()
|
$socialAction->getTitle()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $str;
|
$titles = \array_reverse($titles);
|
||||||
|
|
||||||
|
return \implode($options[self::SEPARATOR_KEY], $titles);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function buildParents($socialAction): array
|
protected function buildParents($socialAction): array
|
||||||
|
@ -38,16 +38,20 @@ final class SocialIssueRender implements ChillEntityRenderInterface
|
|||||||
/** @var $socialIssue SocialIssue */
|
/** @var $socialIssue SocialIssue */
|
||||||
$options = array_merge(self::DEFAULT_ARGS, $options);
|
$options = array_merge(self::DEFAULT_ARGS, $options);
|
||||||
|
|
||||||
$str = $this->translatableStringHelper->localize($socialIssue->getTitle());
|
$titles[] = $this->translatableStringHelper
|
||||||
|
->localize($socialIssue->getTitle());
|
||||||
|
|
||||||
|
// loop to parent, until root
|
||||||
while ($socialIssue->hasParent()) {
|
while ($socialIssue->hasParent()) {
|
||||||
$socialIssue = $socialIssue->getParent();
|
$socialIssue = $socialIssue->getParent();
|
||||||
$str .= $options[self::SEPARATOR_KEY].$this->translatableStringHelper->localize(
|
$titles[] = $this->translatableStringHelper->localize(
|
||||||
$socialIssue->getTitle()
|
$socialIssue->getTitle()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $str;
|
$titles = \array_reverse($titles);
|
||||||
|
|
||||||
|
return \implode($options[self::SEPARATOR_KEY], $titles);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function buildParents(SocialIssue $socialIssue): array
|
protected function buildParents(SocialIssue $socialIssue): array
|
||||||
|
@ -36,14 +36,30 @@ class HouseholdControllerTest extends WebTestCase
|
|||||||
/**
|
/**
|
||||||
* @dataProvider generateValidHouseholdIds
|
* @dataProvider generateValidHouseholdIds
|
||||||
*/
|
*/
|
||||||
public function testMembers($householdId)
|
public function testEditMetadata($householdId)
|
||||||
{
|
{
|
||||||
$this->client->request(
|
|
||||||
|
$crawler = $this->client->request(
|
||||||
Request::METHOD_GET,
|
Request::METHOD_GET,
|
||||||
"/fr/person/household/{$householdId}/members"
|
"/fr/person/household/{$householdId}/summary",
|
||||||
|
[
|
||||||
|
'edit' => true
|
||||||
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertResponseIsSuccessful();
|
$this->assertResponseIsSuccessful();
|
||||||
|
|
||||||
|
$form = $crawler->selectButton('Enregistrer')
|
||||||
|
->form();
|
||||||
|
|
||||||
|
$form['household[commentMembers][comment]'] = "This is a text **generated** by automatic tests";
|
||||||
|
$form['household[waitingForBirth]']->tick();
|
||||||
|
$form['household[waitingForBirthDate]'] = (new \DateTime('today'))
|
||||||
|
->add(new \DateInterval('P1M'))->format('Y-m-d');
|
||||||
|
|
||||||
|
$this->client->submit($form);
|
||||||
|
|
||||||
|
$this->assertResponseRedirects("/fr/person/household/{$householdId}/summary");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -57,6 +73,7 @@ class HouseholdControllerTest extends WebTestCase
|
|||||||
);
|
);
|
||||||
|
|
||||||
$this->assertResponseIsSuccessful();
|
$this->assertResponseIsSuccessful();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -93,5 +110,7 @@ class HouseholdControllerTest extends WebTestCase
|
|||||||
\shuffle($ids);
|
\shuffle($ids);
|
||||||
|
|
||||||
yield [ \array_pop($ids)['id'] ];
|
yield [ \array_pop($ids)['id'] ];
|
||||||
|
yield [ \array_pop($ids)['id'] ];
|
||||||
|
yield [ \array_pop($ids)['id'] ];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -205,19 +205,18 @@ class HouseholdMemberControllerTest extends WebTestCase
|
|||||||
{
|
{
|
||||||
self::bootKernel();
|
self::bootKernel();
|
||||||
$em = self::$container->get(EntityManagerInterface::class);
|
$em = self::$container->get(EntityManagerInterface::class);
|
||||||
|
$yesterday = new \DateTimeImmutable('yesterday');
|
||||||
|
|
||||||
$personIds = $em->createQuery("SELECT p.id FROM ".Person::class." p ".
|
$personIds = $em->createQuery("SELECT p.id FROM ".Person::class." p ".
|
||||||
"JOIN p.center c ".
|
"JOIN p.center c ".
|
||||||
"JOIN p.householdParticipations hp ".
|
|
||||||
"WHERE ".
|
"WHERE ".
|
||||||
"c.name = :center ".
|
"c.name = :center "
|
||||||
"AND hp.startDate < CURRENT_DATE() ".
|
|
||||||
"AND hp.endDate IS NULL "
|
|
||||||
)
|
)
|
||||||
->setParameter('center', "Center A")
|
->setParameter('center', "Center A")
|
||||||
->setMaxResults(100)
|
->setMaxResults(100)
|
||||||
->getScalarResult()
|
->getScalarResult()
|
||||||
;
|
;
|
||||||
|
|
||||||
\shuffle($personIds);
|
\shuffle($personIds);
|
||||||
|
|
||||||
$household = new Household();
|
$household = new Household();
|
||||||
@ -229,12 +228,31 @@ class HouseholdMemberControllerTest extends WebTestCase
|
|||||||
->getResult()
|
->getResult()
|
||||||
;
|
;
|
||||||
|
|
||||||
yield [
|
$i = 0;
|
||||||
\array_pop($personIds)['id'],
|
do {
|
||||||
$household->getId(),
|
$id = \array_pop($personIds)['id'];
|
||||||
$positions[\random_int(0, count($positions) - 1)]['id'],
|
$person = self::$container->get(EntityManagerInterface::class)
|
||||||
new \DateTimeImmutable('today')
|
->getRepository(Person::Class)
|
||||||
];
|
->find($id);
|
||||||
|
|
||||||
|
$participation = $person->getCurrentHouseholdParticipationShareHousehold();
|
||||||
|
|
||||||
|
if (NULL == $participation ||
|
||||||
|
(
|
||||||
|
NULL === $participation->getEndDate()
|
||||||
|
&& $participation->getStartDate() <= $yesterday
|
||||||
|
)) {
|
||||||
|
|
||||||
|
$i++;
|
||||||
|
yield [
|
||||||
|
$id,
|
||||||
|
$household->getId(),
|
||||||
|
$positions[\random_int(0, count($positions) - 1)]['id'],
|
||||||
|
new \DateTimeImmutable('tomorrow')
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
} while ($i <= 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function provideValidDataEditMember(): \Iterator
|
public function provideValidDataEditMember(): \Iterator
|
||||||
|
@ -210,7 +210,67 @@ components:
|
|||||||
type: string
|
type: string
|
||||||
enum:
|
enum:
|
||||||
- 'household_position'
|
- 'household_position'
|
||||||
|
AccompanyingCourseWork:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
id:
|
||||||
|
type: integer
|
||||||
|
type:
|
||||||
|
type: string
|
||||||
|
enum:
|
||||||
|
- 'accompanying_period_work'
|
||||||
|
note:
|
||||||
|
type: string
|
||||||
|
startDate:
|
||||||
|
$ref: "#/components/schemas/Date"
|
||||||
|
endDate:
|
||||||
|
$ref: "#/components/schemas/Date"
|
||||||
|
handlingThirdParty:
|
||||||
|
$ref: "#/components/schemas/ThirdPartyById"
|
||||||
|
goals:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: "#/components/schemas/AccompanyingCourseWorkGoal"
|
||||||
|
results:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: "#/components/schemas/SocialWorkResultById"
|
||||||
|
AccompanyingCourseWorkGoal:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
id:
|
||||||
|
type: integer
|
||||||
|
type:
|
||||||
|
type: string
|
||||||
|
enum:
|
||||||
|
- 'accompanying_period_work_goal'
|
||||||
|
note:
|
||||||
|
type: string
|
||||||
|
goal:
|
||||||
|
$ref: '#/components/schemas/SocialWorkGoalById'
|
||||||
|
results:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/SocialWorkGoalById'
|
||||||
|
|
||||||
|
SocialWorkResultById:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
id:
|
||||||
|
type: integer
|
||||||
|
type:
|
||||||
|
type: string
|
||||||
|
enum:
|
||||||
|
- 'social_work_result'
|
||||||
|
SocialWorkGoalById:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
id:
|
||||||
|
type: integer
|
||||||
|
type:
|
||||||
|
type: string
|
||||||
|
enum:
|
||||||
|
- 'social_work_goal'
|
||||||
|
|
||||||
paths:
|
paths:
|
||||||
/1.0/person/person/{id}.json:
|
/1.0/person/person/{id}.json:
|
||||||
@ -798,6 +858,56 @@ paths:
|
|||||||
422:
|
422:
|
||||||
description: "object with validation errors"
|
description: "object with validation errors"
|
||||||
|
|
||||||
|
/1.0/person/accompanying-course/{id}/work.json:
|
||||||
|
post:
|
||||||
|
tags:
|
||||||
|
- person
|
||||||
|
- accompanying-course-work
|
||||||
|
summary: "Add a work (AccompanyingPeriodwork) to the accompanying course"
|
||||||
|
parameters:
|
||||||
|
- name: id
|
||||||
|
in: path
|
||||||
|
required: true
|
||||||
|
description: The accompanying period's id
|
||||||
|
schema:
|
||||||
|
type: integer
|
||||||
|
format: integer
|
||||||
|
minimum: 1
|
||||||
|
requestBody:
|
||||||
|
description: "A new work"
|
||||||
|
required: true
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
type:
|
||||||
|
type: string
|
||||||
|
enum:
|
||||||
|
- 'accompanying_period_work'
|
||||||
|
startDate:
|
||||||
|
$ref: '#/components/schemas/Date'
|
||||||
|
endDate:
|
||||||
|
$ref: '#/components/schemas/Date'
|
||||||
|
examples:
|
||||||
|
create a work:
|
||||||
|
value:
|
||||||
|
type: accompanying_period_work
|
||||||
|
social_action:
|
||||||
|
id: 0
|
||||||
|
type: social_work_social_action
|
||||||
|
startDate:
|
||||||
|
datetime: 2021-06-20T15:00:00+0200
|
||||||
|
responses:
|
||||||
|
401:
|
||||||
|
description: "Unauthorized"
|
||||||
|
404:
|
||||||
|
description: "Not found"
|
||||||
|
200:
|
||||||
|
description: "OK"
|
||||||
|
422:
|
||||||
|
description: "object with validation errors"
|
||||||
|
|
||||||
/1.0/person/accompanying-course/{id}/confirm.json:
|
/1.0/person/accompanying-course/{id}/confirm.json:
|
||||||
post:
|
post:
|
||||||
tags:
|
tags:
|
||||||
@ -977,3 +1087,258 @@ paths:
|
|||||||
description: "Unprocessable entity (validation errors)"
|
description: "Unprocessable entity (validation errors)"
|
||||||
400:
|
400:
|
||||||
description: "transition cannot be applyed"
|
description: "transition cannot be applyed"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/1.0/person/accompanying-course/work/{id}.json:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- accompanying-course-work
|
||||||
|
summary: edit an existing accompanying course work
|
||||||
|
parameters:
|
||||||
|
- name: id
|
||||||
|
in: path
|
||||||
|
required: true
|
||||||
|
description: The accompanying course social work's id
|
||||||
|
schema:
|
||||||
|
type: integer
|
||||||
|
format: integer
|
||||||
|
minimum: 1
|
||||||
|
responses:
|
||||||
|
401:
|
||||||
|
description: "Unauthorized"
|
||||||
|
404:
|
||||||
|
description: "Not found"
|
||||||
|
200:
|
||||||
|
description: "OK"
|
||||||
|
400:
|
||||||
|
description: "Bad Request"
|
||||||
|
|
||||||
|
put:
|
||||||
|
tags:
|
||||||
|
- accompanying-course-work
|
||||||
|
summary: edit an existing accompanying course work
|
||||||
|
parameters:
|
||||||
|
- name: id
|
||||||
|
in: path
|
||||||
|
required: true
|
||||||
|
description: The accompanying course social work's id
|
||||||
|
schema:
|
||||||
|
type: integer
|
||||||
|
format: integer
|
||||||
|
minimum: 1
|
||||||
|
requestBody:
|
||||||
|
required: true
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/AccompanyingCourseWork'
|
||||||
|
responses:
|
||||||
|
401:
|
||||||
|
description: "Unauthorized"
|
||||||
|
404:
|
||||||
|
description: "Not found"
|
||||||
|
200:
|
||||||
|
description: "OK"
|
||||||
|
422:
|
||||||
|
description: "Unprocessable entity (validation errors)"
|
||||||
|
400:
|
||||||
|
description: "Bad Request"
|
||||||
|
|
||||||
|
/1.0/person/social/social-action.json:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- accompanying-course-work
|
||||||
|
summary: get a list of social action
|
||||||
|
responses:
|
||||||
|
401:
|
||||||
|
description: "Unauthorized"
|
||||||
|
200:
|
||||||
|
description: "OK"
|
||||||
|
|
||||||
|
/1.0/person/social/social-action/{id}.json:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- accompanying-course-work
|
||||||
|
parameters:
|
||||||
|
- name: id
|
||||||
|
in: path
|
||||||
|
required: true
|
||||||
|
description: The social action's id
|
||||||
|
schema:
|
||||||
|
type: integer
|
||||||
|
format: integer
|
||||||
|
minimum: 1
|
||||||
|
responses:
|
||||||
|
401:
|
||||||
|
description: "Unauthorized"
|
||||||
|
404:
|
||||||
|
description: "Not found"
|
||||||
|
200:
|
||||||
|
description: "OK"
|
||||||
|
400:
|
||||||
|
description: "Bad Request"
|
||||||
|
|
||||||
|
|
||||||
|
/1.0/person/social/social-action/by-social-issue/{id}.json:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- accompanying-course-work
|
||||||
|
parameters:
|
||||||
|
- name: id
|
||||||
|
in: path
|
||||||
|
required: true
|
||||||
|
description: The social action's id
|
||||||
|
schema:
|
||||||
|
type: integer
|
||||||
|
format: integer
|
||||||
|
minimum: 1
|
||||||
|
responses:
|
||||||
|
401:
|
||||||
|
description: "Unauthorized"
|
||||||
|
404:
|
||||||
|
description: "Not found"
|
||||||
|
200:
|
||||||
|
description: "OK"
|
||||||
|
400:
|
||||||
|
description: "Bad Request"
|
||||||
|
|
||||||
|
|
||||||
|
/1.0/person/social-work/result.json:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- accompanying-course-work
|
||||||
|
summary: get a list of social work result
|
||||||
|
responses:
|
||||||
|
401:
|
||||||
|
description: "Unauthorized"
|
||||||
|
200:
|
||||||
|
description: "OK"
|
||||||
|
|
||||||
|
/1.0/person/social-work/result/{id}.json:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- accompanying-course-work
|
||||||
|
parameters:
|
||||||
|
- name: id
|
||||||
|
in: path
|
||||||
|
required: true
|
||||||
|
description: The result's id
|
||||||
|
schema:
|
||||||
|
type: integer
|
||||||
|
format: integer
|
||||||
|
minimum: 1
|
||||||
|
responses:
|
||||||
|
401:
|
||||||
|
description: "Unauthorized"
|
||||||
|
404:
|
||||||
|
description: "Not found"
|
||||||
|
200:
|
||||||
|
description: "OK"
|
||||||
|
400:
|
||||||
|
description: "Bad Request"
|
||||||
|
|
||||||
|
|
||||||
|
/1.0/person/social-work/result/by-goal/{id}.json:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- accompanying-course-work
|
||||||
|
parameters:
|
||||||
|
- name: id
|
||||||
|
in: path
|
||||||
|
required: true
|
||||||
|
description: The goal's id
|
||||||
|
schema:
|
||||||
|
type: integer
|
||||||
|
format: integer
|
||||||
|
minimum: 1
|
||||||
|
responses:
|
||||||
|
401:
|
||||||
|
description: "Unauthorized"
|
||||||
|
404:
|
||||||
|
description: "Not found"
|
||||||
|
200:
|
||||||
|
description: "OK"
|
||||||
|
400:
|
||||||
|
description: "Bad Request"
|
||||||
|
|
||||||
|
/1.0/person/social-work/result/by-social-action/{id}.json:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- accompanying-course-work
|
||||||
|
parameters:
|
||||||
|
- name: id
|
||||||
|
in: path
|
||||||
|
required: true
|
||||||
|
description: The social action's id
|
||||||
|
schema:
|
||||||
|
type: integer
|
||||||
|
format: integer
|
||||||
|
minimum: 1
|
||||||
|
responses:
|
||||||
|
401:
|
||||||
|
description: "Unauthorized"
|
||||||
|
404:
|
||||||
|
description: "Not found"
|
||||||
|
200:
|
||||||
|
description: "OK"
|
||||||
|
400:
|
||||||
|
description: "Bad Request"
|
||||||
|
|
||||||
|
/1.0/person/social-work/goal.json:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- accompanying-course-work
|
||||||
|
summary: get a list of social work goal
|
||||||
|
responses:
|
||||||
|
401:
|
||||||
|
description: "Unauthorized"
|
||||||
|
200:
|
||||||
|
description: "OK"
|
||||||
|
|
||||||
|
/1.0/person/social-work/goal/{id}.json:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- accompanying-course-work
|
||||||
|
parameters:
|
||||||
|
- name: id
|
||||||
|
in: path
|
||||||
|
required: true
|
||||||
|
description: The goal's id
|
||||||
|
schema:
|
||||||
|
type: integer
|
||||||
|
format: integer
|
||||||
|
minimum: 1
|
||||||
|
responses:
|
||||||
|
401:
|
||||||
|
description: "Unauthorized"
|
||||||
|
404:
|
||||||
|
description: "Not found"
|
||||||
|
200:
|
||||||
|
description: "OK"
|
||||||
|
400:
|
||||||
|
description: "Bad Request"
|
||||||
|
|
||||||
|
|
||||||
|
/1.0/person/social-work/goal/by-social-action/{id}.json:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- accompanying-course-work
|
||||||
|
parameters:
|
||||||
|
- name: id
|
||||||
|
in: path
|
||||||
|
required: true
|
||||||
|
description: The social action's id
|
||||||
|
schema:
|
||||||
|
type: integer
|
||||||
|
format: integer
|
||||||
|
minimum: 1
|
||||||
|
responses:
|
||||||
|
401:
|
||||||
|
description: "Unauthorized"
|
||||||
|
404:
|
||||||
|
description: "Not found"
|
||||||
|
200:
|
||||||
|
description: "OK"
|
||||||
|
400:
|
||||||
|
description: "Bad Request"
|
||||||
|
@ -12,4 +12,8 @@ module.exports = function(encore, entries)
|
|||||||
encore.addEntry('household_members_editor', __dirname + '/Resources/public/vuejs/HouseholdMembersEditor/index.js');
|
encore.addEntry('household_members_editor', __dirname + '/Resources/public/vuejs/HouseholdMembersEditor/index.js');
|
||||||
encore.addEntry('vue_accourse', __dirname + '/Resources/public/vuejs/AccompanyingCourse/index.js');
|
encore.addEntry('vue_accourse', __dirname + '/Resources/public/vuejs/AccompanyingCourse/index.js');
|
||||||
encore.addEntry('household_edit_metadata', __dirname + '/Resources/public/modules/household_edit_metadata/index.js');
|
encore.addEntry('household_edit_metadata', __dirname + '/Resources/public/modules/household_edit_metadata/index.js');
|
||||||
|
encore.addEntry('accompanying_course_work_create', __dirname + '/Resources/public/vuejs/AccompanyingCourseWorkCreate/index.js');
|
||||||
|
encore.addEntry('accompanying_course_work_edit', __dirname + '/Resources/public/vuejs/AccompanyingCourseWorkEdit/index.js');
|
||||||
|
encore.addEntry('accompanying_course_work_list', __dirname + '/Resources/public/modules/accompanying_course_work_list/index.js');
|
||||||
|
encore.addEntry('person', __dirname + '/Resources/public/js/person.js');
|
||||||
};
|
};
|
||||||
|
@ -70,6 +70,7 @@ services:
|
|||||||
|
|
||||||
Chill\PersonBundle\Controller\:
|
Chill\PersonBundle\Controller\:
|
||||||
autowire: true
|
autowire: true
|
||||||
|
autoconfigure: true
|
||||||
resource: '../Controller/'
|
resource: '../Controller/'
|
||||||
tags: ['controller.service_arguments']
|
tags: ['controller.service_arguments']
|
||||||
|
|
||||||
|
@ -60,3 +60,18 @@ services:
|
|||||||
$authorizationHelper: '@Chill\MainBundle\Security\Authorization\AuthorizationHelper'
|
$authorizationHelper: '@Chill\MainBundle\Security\Authorization\AuthorizationHelper'
|
||||||
tags: ['controller.service_arguments']
|
tags: ['controller.service_arguments']
|
||||||
|
|
||||||
|
Chill\PersonBundle\Controller\AccompanyingCourseWorkApiController:
|
||||||
|
autowire: true
|
||||||
|
tags: ['controller.service_arguments']
|
||||||
|
|
||||||
|
Chill\PersonBundle\Controller\SocialWorkResultApiController:
|
||||||
|
autowire: true
|
||||||
|
tags: ['controller.service_arguments']
|
||||||
|
|
||||||
|
Chill\PersonBundle\Controller\SocialWorkGoalApiController:
|
||||||
|
autowire: true
|
||||||
|
tags: ['controller.service_arguments']
|
||||||
|
|
||||||
|
Chill\PersonBundle\Controller\HouseholdApiController:
|
||||||
|
autowire: true
|
||||||
|
tags: ['controller.service_arguments']
|
||||||
|
@ -0,0 +1,49 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Chill\Migrations\Person;
|
||||||
|
|
||||||
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
|
use Doctrine\Migrations\AbstractMigration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add new fields to Person entity
|
||||||
|
*/
|
||||||
|
final class Version20210617073504 extends AbstractMigration
|
||||||
|
{
|
||||||
|
public function getDescription(): string
|
||||||
|
{
|
||||||
|
return 'Add new fields to Person entity';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function up(Schema $schema): void
|
||||||
|
{
|
||||||
|
$this->addSql('ALTER TABLE chill_person_person ADD deathdate DATE DEFAULT NULL');
|
||||||
|
$this->addSql('ALTER TABLE chill_person_person ADD maritalStatusDate DATE DEFAULT NULL');
|
||||||
|
$this->addSql('ALTER TABLE chill_person_person ADD acceptSMS BOOLEAN DEFAULT false NOT NULL');
|
||||||
|
$this->addSql('ALTER TABLE chill_person_person ADD acceptEmail BOOLEAN DEFAULT false NOT NULL');
|
||||||
|
$this->addSql('ALTER TABLE chill_person_person ADD numberOfChildren INT DEFAULT NULL');
|
||||||
|
$this->addSql('ALTER TABLE chill_person_person ADD genderComment_comment TEXT DEFAULT NULL');
|
||||||
|
$this->addSql('ALTER TABLE chill_person_person ADD genderComment_userId INT DEFAULT NULL');
|
||||||
|
$this->addSql('ALTER TABLE chill_person_person ADD genderComment_date TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL');
|
||||||
|
$this->addSql('ALTER TABLE chill_person_person ADD maritalStatusComment_comment TEXT DEFAULT NULL');
|
||||||
|
$this->addSql('ALTER TABLE chill_person_person ADD maritalStatusComment_userId INT DEFAULT NULL');
|
||||||
|
$this->addSql('ALTER TABLE chill_person_person ADD maritalStatusComment_date TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema): void
|
||||||
|
{
|
||||||
|
$this->addSql('ALTER TABLE chill_person_person DROP deathdate');
|
||||||
|
$this->addSql('ALTER TABLE chill_person_person DROP maritalStatusDate');
|
||||||
|
$this->addSql('ALTER TABLE chill_person_person DROP acceptSMS');
|
||||||
|
$this->addSql('ALTER TABLE chill_person_person DROP acceptEmail');
|
||||||
|
$this->addSql('ALTER TABLE chill_person_person DROP numberOfChildren');
|
||||||
|
$this->addSql('ALTER TABLE chill_person_person DROP genderComment_comment');
|
||||||
|
$this->addSql('ALTER TABLE chill_person_person DROP genderComment_userId');
|
||||||
|
$this->addSql('ALTER TABLE chill_person_person DROP genderComment_date');
|
||||||
|
$this->addSql('ALTER TABLE chill_person_person DROP maritalStatusComment_comment');
|
||||||
|
$this->addSql('ALTER TABLE chill_person_person DROP maritalStatusComment_userId');
|
||||||
|
$this->addSql('ALTER TABLE chill_person_person DROP maritalStatusComment_date');
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,45 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Chill\Migrations\Person;
|
||||||
|
|
||||||
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
|
use Doctrine\Migrations\AbstractMigration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add createdAt, createdBy, updatedAt, updatedBy fields on Person
|
||||||
|
*/
|
||||||
|
final class Version20210618080702 extends AbstractMigration
|
||||||
|
{
|
||||||
|
public function getDescription(): string
|
||||||
|
{
|
||||||
|
return 'Add createdAt, createdBy, updatedAt, updatedBy fields on Person';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function up(Schema $schema): void
|
||||||
|
{
|
||||||
|
$this->addSql('ALTER TABLE chill_person_person ADD createdAt TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL');
|
||||||
|
$this->addSql('ALTER TABLE chill_person_person ADD updatedAt TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL');
|
||||||
|
$this->addSql('ALTER TABLE chill_person_person ADD createdBy_id INT DEFAULT NULL');
|
||||||
|
$this->addSql('ALTER TABLE chill_person_person ADD updatedBy_id INT DEFAULT NULL');
|
||||||
|
$this->addSql('COMMENT ON COLUMN chill_person_person.deathdate IS \'(DC2Type:date_immutable)\'');
|
||||||
|
$this->addSql('ALTER TABLE chill_person_person ADD CONSTRAINT FK_BF210A143174800F FOREIGN KEY (createdBy_id) REFERENCES users (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||||
|
$this->addSql('ALTER TABLE chill_person_person ADD CONSTRAINT FK_BF210A1465FF1AEC FOREIGN KEY (updatedBy_id) REFERENCES users (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||||
|
$this->addSql('CREATE INDEX IDX_BF210A143174800F ON chill_person_person (createdBy_id)');
|
||||||
|
$this->addSql('CREATE INDEX IDX_BF210A1465FF1AEC ON chill_person_person (updatedBy_id)');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema): void
|
||||||
|
{
|
||||||
|
$this->addSql('ALTER TABLE chill_person_person DROP CONSTRAINT FK_BF210A143174800F');
|
||||||
|
$this->addSql('ALTER TABLE chill_person_person DROP CONSTRAINT FK_BF210A1465FF1AEC');
|
||||||
|
$this->addSql('DROP INDEX IDX_BF210A143174800F');
|
||||||
|
$this->addSql('DROP INDEX IDX_BF210A1465FF1AEC');
|
||||||
|
$this->addSql('ALTER TABLE chill_person_person DROP createdAt');
|
||||||
|
$this->addSql('ALTER TABLE chill_person_person DROP updatedAt');
|
||||||
|
$this->addSql('ALTER TABLE chill_person_person DROP createdBy_id');
|
||||||
|
$this->addSql('ALTER TABLE chill_person_person DROP updatedBy_id');
|
||||||
|
$this->addSql('COMMENT ON COLUMN chill_person_person.deathdate IS NULL');
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,51 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Chill\Migrations\Person;
|
||||||
|
|
||||||
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
|
use Doctrine\Migrations\AbstractMigration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* add updated information to accompanying period work
|
||||||
|
*/
|
||||||
|
final class Version20210620143757 extends AbstractMigration
|
||||||
|
{
|
||||||
|
public function getDescription(): string
|
||||||
|
{
|
||||||
|
return 'add updated information to accompanying period work';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function up(Schema $schema): void
|
||||||
|
{
|
||||||
|
$this->addSql('ALTER TABLE chill_person_accompanying_period_work ADD updatedAt TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL');
|
||||||
|
$this->addSql('ALTER TABLE chill_person_accompanying_period_work ADD updatedBy_id INT NOT NULL');
|
||||||
|
$this->addSql('ALTER TABLE chill_person_accompanying_period_work ALTER createdat TYPE TIMESTAMP(0) WITHOUT TIME ZONE');
|
||||||
|
$this->addSql('ALTER TABLE chill_person_accompanying_period_work ALTER createdat DROP DEFAULT');
|
||||||
|
$this->addSql('ALTER TABLE chill_person_accompanying_period_work ALTER startdate TYPE DATE');
|
||||||
|
$this->addSql('ALTER TABLE chill_person_accompanying_period_work ALTER startdate DROP DEFAULT');
|
||||||
|
$this->addSql('ALTER TABLE chill_person_accompanying_period_work ALTER enddate TYPE DATE');
|
||||||
|
$this->addSql('ALTER TABLE chill_person_accompanying_period_work ALTER enddate DROP NOT NULL');
|
||||||
|
$this->addSql('ALTER TABLE chill_person_accompanying_period_work ALTER enddate SET DEFAULT NULL');
|
||||||
|
$this->addSql('COMMENT ON COLUMN chill_person_accompanying_period_work.updatedAt IS \'(DC2Type:datetime_immutable)\'');
|
||||||
|
$this->addSql('COMMENT ON COLUMN chill_person_accompanying_period_work.createdAt IS \'(DC2Type:datetime_immutable)\'');
|
||||||
|
$this->addSql('COMMENT ON COLUMN chill_person_accompanying_period_work.startDate IS \'(DC2Type:datetime_immutable)\'');
|
||||||
|
$this->addSql('COMMENT ON COLUMN chill_person_accompanying_period_work.endDate IS \'(DC2Type:datetime_immutable)\'');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema): void
|
||||||
|
{
|
||||||
|
$this->addSql('ALTER TABLE chill_person_accompanying_period_work DROP updatedAt');
|
||||||
|
$this->addSql('ALTER TABLE chill_person_accompanying_period_work DROP updatedBy_id');
|
||||||
|
$this->addSql('ALTER TABLE chill_person_accompanying_period_work ALTER createdAt TYPE TIMESTAMP(0) WITHOUT TIME ZONE');
|
||||||
|
$this->addSql('ALTER TABLE chill_person_accompanying_period_work ALTER createdAt DROP DEFAULT');
|
||||||
|
$this->addSql('ALTER TABLE chill_person_accompanying_period_work ALTER startDate TYPE TIMESTAMP(0) WITHOUT TIME ZONE');
|
||||||
|
$this->addSql('ALTER TABLE chill_person_accompanying_period_work ALTER startDate DROP DEFAULT');
|
||||||
|
$this->addSql('ALTER TABLE chill_person_accompanying_period_work ALTER endDate TYPE TIMESTAMP(0) WITHOUT TIME ZONE');
|
||||||
|
$this->addSql('ALTER TABLE chill_person_accompanying_period_work ALTER endDate DROP DEFAULT');
|
||||||
|
$this->addSql('COMMENT ON COLUMN chill_person_accompanying_period_work.createdat IS NULL');
|
||||||
|
$this->addSql('COMMENT ON COLUMN chill_person_accompanying_period_work.startdate IS NULL');
|
||||||
|
$this->addSql('COMMENT ON COLUMN chill_person_accompanying_period_work.enddate IS NULL');
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Chill\Migrations\Person;
|
||||||
|
|
||||||
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
|
use Doctrine\Migrations\AbstractMigration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add link to accompanying period work and persons
|
||||||
|
*/
|
||||||
|
final class Version20210623135043 extends AbstractMigration
|
||||||
|
{
|
||||||
|
public function getDescription(): string
|
||||||
|
{
|
||||||
|
return 'Add link to accompanying period work and persons';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function up(Schema $schema): void
|
||||||
|
{
|
||||||
|
$this->addSql("CREATE TABLE chill_person_accompanying_period_work_person (accompanyingperiodwork_id INT NOT NULL, person_id INT NOT NULL, PRIMARY KEY(accompanyingperiodwork_id, person_id))");
|
||||||
|
$this->addSql("CREATE INDEX IDX_615F494CB99F6060 ON chill_person_accompanying_period_work_person (accompanyingperiodwork_id)");
|
||||||
|
$this->addSql("CREATE INDEX IDX_615F494C217BBB47 ON chill_person_accompanying_period_work_person (person_id)");
|
||||||
|
$this->addSql("ALTER TABLE chill_person_accompanying_period_work_person ADD CONSTRAINT FK_615F494CB99F6060 FOREIGN KEY (accompanyingperiodwork_id) REFERENCES chill_person_accompanying_period_work (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE");
|
||||||
|
$this->addSql("ALTER TABLE chill_person_accompanying_period_work_person ADD CONSTRAINT FK_615F494C217BBB47 FOREIGN KEY (person_id) REFERENCES chill_person_person (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema): void
|
||||||
|
{
|
||||||
|
$this->addSql("DROP TABLE chill_person_accompanying_period_work_person");
|
||||||
|
}
|
||||||
|
}
|
@ -24,6 +24,7 @@ household:
|
|||||||
Leave household: Quitter le ménage
|
Leave household: Quitter le ménage
|
||||||
Leave: Quitter
|
Leave: Quitter
|
||||||
Join: Rejoindre un ménage
|
Join: Rejoindre un ménage
|
||||||
|
Change position: Repositionner
|
||||||
Household file: Dossier ménage
|
Household file: Dossier ménage
|
||||||
Add a member: Ajouter un membre
|
Add a member: Ajouter un membre
|
||||||
Update membership: Modifier
|
Update membership: Modifier
|
||||||
@ -38,6 +39,8 @@ household:
|
|||||||
Current household members: Membres actuels
|
Current household members: Membres actuels
|
||||||
Household summary: Résumé
|
Household summary: Résumé
|
||||||
Addresses: Adresses
|
Addresses: Adresses
|
||||||
|
Current address: Adresse actuelle
|
||||||
|
Household does not have any address currently: Le ménage n'a pas d'adresse renseignée actuellement
|
||||||
Edit household members: Modifier l'appartenance au ménage
|
Edit household members: Modifier l'appartenance au ménage
|
||||||
and x other persons: >-
|
and x other persons: >-
|
||||||
{x, plural,
|
{x, plural,
|
||||||
|
@ -10,6 +10,8 @@ First name or Last name: Prénom ou nom
|
|||||||
id: identifiant
|
id: identifiant
|
||||||
Birthdate: 'Date de naissance'
|
Birthdate: 'Date de naissance'
|
||||||
birthdate: date de naissance
|
birthdate: date de naissance
|
||||||
|
deathdate: date de décès
|
||||||
|
Date of death: Date de décès
|
||||||
'Date of birth': 'Date de naissance'
|
'Date of birth': 'Date de naissance'
|
||||||
dateOfBirth: date de naissance
|
dateOfBirth: date de naissance
|
||||||
dateofbirth: date de naissance
|
dateofbirth: date de naissance
|
||||||
@ -21,6 +23,7 @@ nationality: nationalité
|
|||||||
'Without nationality': 'Sans nationalité'
|
'Without nationality': 'Sans nationalité'
|
||||||
Gender: Genre
|
Gender: Genre
|
||||||
gender: genre
|
gender: genre
|
||||||
|
Gender comment: Remarque sur le genre
|
||||||
'Creation date': 'Date d''ouverture'
|
'Creation date': 'Date d''ouverture'
|
||||||
'Not given': 'Non renseigné'
|
'Not given': 'Non renseigné'
|
||||||
'Place of birth': 'Lieu de naissance'
|
'Place of birth': 'Lieu de naissance'
|
||||||
@ -30,16 +33,22 @@ placeOfBirth: lieu de naissance
|
|||||||
countryOfBirth: 'Pays de naissance'
|
countryOfBirth: 'Pays de naissance'
|
||||||
'Unknown country of birth': 'Pays inconnu'
|
'Unknown country of birth': 'Pays inconnu'
|
||||||
'Marital status': 'État civil'
|
'Marital status': 'État civil'
|
||||||
|
Date of last marital status change: État civil depuis le
|
||||||
|
Comment on the marital status: Commentaires sur l'état civil
|
||||||
'Number of children': 'Nombre d''enfants'
|
'Number of children': 'Nombre d''enfants'
|
||||||
'{0} No child|{1} One child | ]1,Inf] %nb% children': '{0} Aucun enfant|{1} Un enfant | ]1,Inf] %nb% enfants'
|
'{0} No child|{1} One child | ]1,Inf] %nb% children': '{0} Aucun enfant|{1} Un enfant | ]1,Inf] %nb% enfants'
|
||||||
'National number': 'Numéro national'
|
'National number': 'Numéro national'
|
||||||
Email: 'Courrier électronique'
|
Email: 'Courrier électronique'
|
||||||
|
Accept emails ?: Accepte les courriels?
|
||||||
|
Accept emails: Peut être contacté par email
|
||||||
Address: Adresse
|
Address: Adresse
|
||||||
Memo: Mémo
|
Memo: Mémo
|
||||||
Phonenumber: 'Numéro de téléphone'
|
Phonenumber: 'Numéro de téléphone'
|
||||||
phonenumber: numéro de téléphone
|
phonenumber: numéro de téléphone
|
||||||
Mobilenumber: 'Numéro de téléphone portable'
|
Mobilenumber: 'Numéro de téléphone portable'
|
||||||
mobilenumber: numéro de téléphone portable
|
mobilenumber: numéro de téléphone portable
|
||||||
|
Accept short text message ?: Accepte les SMS?
|
||||||
|
Accept short text message: Accepte les SMS
|
||||||
Other phonenumber: Autre numéro de téléphone
|
Other phonenumber: Autre numéro de téléphone
|
||||||
Description: description
|
Description: description
|
||||||
Add new phone: Ajouter un numéro de téléphone
|
Add new phone: Ajouter un numéro de téléphone
|
||||||
@ -328,3 +337,20 @@ Members: Membres
|
|||||||
Addresses: Adresses
|
Addresses: Adresses
|
||||||
Move household: Nouveau déménagement
|
Move household: Nouveau déménagement
|
||||||
Addresses history for household: Historique des adresses
|
Addresses history for household: Historique des adresses
|
||||||
|
|
||||||
|
# accompanying course work
|
||||||
|
Accompanying Course Actions: Actions d'accompagnements
|
||||||
|
accompanying_course_work:
|
||||||
|
create: Créer une action
|
||||||
|
Create accompanying course work: Créer une action d'accompagnement
|
||||||
|
Edit accompanying course work: Modifier une action d'accompagnement
|
||||||
|
List accompanying course work: Liste des actions d'accompagnement
|
||||||
|
action: Action
|
||||||
|
create_date: Date de création
|
||||||
|
start_date: Date de début
|
||||||
|
end_date: Date de fin
|
||||||
|
results without objective: Aucun objectif - motif - dispositif
|
||||||
|
no_results: Aucun résultat - orientation
|
||||||
|
results: Résultats - orientations
|
||||||
|
goal: Objectif - motif - dispositif
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user