mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 21:34:25 +00:00
Merge remote-tracking branch 'origin/master' into features/household-editor
This commit is contained in:
commit
e135b98072
@ -23,16 +23,20 @@
|
|||||||
namespace Chill\ActivityBundle\Controller;
|
namespace Chill\ActivityBundle\Controller;
|
||||||
|
|
||||||
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
|
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
|
||||||
|
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||||
|
use Chill\PersonBundle\Entity\Person;
|
||||||
use Chill\PersonBundle\Privacy\PrivacyEvent;
|
use Chill\PersonBundle\Privacy\PrivacyEvent;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||||
|
use Symfony\Component\Form\Form;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||||
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\Security\Core\Role\Role;
|
use Symfony\Component\Security\Core\Role\Role;
|
||||||
use Chill\ActivityBundle\Entity\Activity;
|
use Chill\ActivityBundle\Entity\Activity;
|
||||||
use Chill\PersonBundle\Entity\Person;
|
|
||||||
use Chill\ActivityBundle\Form\ActivityType;
|
use Chill\ActivityBundle\Form\ActivityType;
|
||||||
|
use Symfony\Component\Serializer\SerializerInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class ActivityController
|
* Class ActivityController
|
||||||
@ -41,216 +45,227 @@ use Chill\ActivityBundle\Form\ActivityType;
|
|||||||
*/
|
*/
|
||||||
class ActivityController extends AbstractController
|
class ActivityController extends AbstractController
|
||||||
{
|
{
|
||||||
|
protected EventDispatcherInterface $eventDispatcher;
|
||||||
|
|
||||||
/**
|
protected AuthorizationHelper $authorizationHelper;
|
||||||
* @var EventDispatcherInterface
|
|
||||||
*/
|
|
||||||
protected $eventDispatcher;
|
|
||||||
|
|
||||||
/**
|
protected LoggerInterface $logger;
|
||||||
* @var AuthorizationHelper
|
|
||||||
*/
|
|
||||||
protected $authorizationHelper;
|
|
||||||
|
|
||||||
/**
|
protected SerializerInterface $serializer;
|
||||||
* @var LoggerInterface
|
|
||||||
*/
|
|
||||||
protected $logger;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ActivityController constructor.
|
|
||||||
*
|
|
||||||
* @param EventDispatcherInterface $eventDispatcher
|
|
||||||
* @param AuthorizationHelper $authorizationHelper
|
|
||||||
*/
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
EventDispatcherInterface $eventDispatcher,
|
EventDispatcherInterface $eventDispatcher,
|
||||||
AuthorizationHelper $authorizationHelper,
|
AuthorizationHelper $authorizationHelper,
|
||||||
LoggerInterface $logger
|
LoggerInterface $logger,
|
||||||
|
SerializerInterface $serializer
|
||||||
) {
|
) {
|
||||||
$this->eventDispatcher = $eventDispatcher;
|
$this->eventDispatcher = $eventDispatcher;
|
||||||
$this->authorizationHelper = $authorizationHelper;
|
$this->authorizationHelper = $authorizationHelper;
|
||||||
$this->logger = $logger;
|
$this->logger = $logger;
|
||||||
|
$this->serializer = $serializer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Lists all Activity entities.
|
* Lists all Activity entities.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public function listAction($person_id, Request $request)
|
public function listAction(Request $request): Response
|
||||||
{
|
{
|
||||||
$em = $this->getDoctrine()->getManager();
|
$em = $this->getDoctrine()->getManager();
|
||||||
$person = $em->getRepository('ChillPersonBundle:Person')->find($person_id);
|
$view = null;
|
||||||
|
|
||||||
if ($person === NULL) {
|
[$person, $accompanyingPeriod] = $this->getEntity($request);
|
||||||
throw $this->createNotFoundException('Person not found');
|
|
||||||
|
if ($person instanceof Person) {
|
||||||
|
$reachableScopes = $this->authorizationHelper
|
||||||
|
->getReachableCircles($this->getUser(), new Role('CHILL_ACTIVITY_SEE'),
|
||||||
|
$person->getCenter());
|
||||||
|
|
||||||
|
$activities = $em->getRepository('ChillActivityBundle:Activity')->findBy(
|
||||||
|
['person' => $person, 'scope' => $reachableScopes],
|
||||||
|
['date' => 'DESC'],
|
||||||
|
);
|
||||||
|
|
||||||
|
$event = new PrivacyEvent($person, array(
|
||||||
|
'element_class' => Activity::class,
|
||||||
|
'action' => 'list'
|
||||||
|
));
|
||||||
|
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event);
|
||||||
|
|
||||||
|
$view = 'ChillActivityBundle:Activity:listPerson.html.twig';
|
||||||
|
} elseif ($accompanyingPeriod instanceof AccompanyingPeriod) {
|
||||||
|
$activities = $em->getRepository('ChillActivityBundle:Activity')->findBy(
|
||||||
|
['accompanyingPeriod' => $accompanyingPeriod],
|
||||||
|
['date' => 'DESC'],
|
||||||
|
);
|
||||||
|
|
||||||
|
$view = 'ChillActivityBundle:Activity:listAccompanyingCourse.html.twig';
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->denyAccessUnlessGranted('CHILL_PERSON_SEE', $person);
|
return $this->render($view, array(
|
||||||
|
|
||||||
$reachableScopes = $this->authorizationHelper
|
|
||||||
->getReachableScopes($this->getUser(), new Role('CHILL_ACTIVITY_SEE'),
|
|
||||||
$person->getCenter());
|
|
||||||
|
|
||||||
$activities = $em->getRepository('ChillActivityBundle:Activity')
|
|
||||||
->findBy(
|
|
||||||
array('person' => $person, 'scope' => $reachableScopes),
|
|
||||||
array('date' => 'DESC')
|
|
||||||
);
|
|
||||||
|
|
||||||
$event = new PrivacyEvent($person, array(
|
|
||||||
'element_class' => Activity::class,
|
|
||||||
'action' => 'list'
|
|
||||||
));
|
|
||||||
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event);
|
|
||||||
|
|
||||||
return $this->render('ChillActivityBundle:Activity:list.html.twig', array(
|
|
||||||
'activities' => $activities,
|
'activities' => $activities,
|
||||||
'person' => $person
|
'person' => $person,
|
||||||
|
'accompanyingCourse' => $accompanyingPeriod,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* Creates a new Activity entity.
|
public function selectTypeAction(Request $request): Response
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function createAction($person_id, Request $request)
|
|
||||||
{
|
{
|
||||||
$em = $this->getDoctrine()->getManager();
|
$em = $this->getDoctrine()->getManager();
|
||||||
$person = $em->getRepository('ChillPersonBundle:Person')->find($person_id);
|
$view = null;
|
||||||
|
|
||||||
if ($person === NULL) {
|
[$person, $accompanyingPeriod] = $this->getEntity($request);
|
||||||
throw $this->createNotFoundException('person not found');
|
|
||||||
|
if ($accompanyingPeriod instanceof AccompanyingPeriod) {
|
||||||
|
$view = 'ChillActivityBundle:Activity:selectTypeAccompanyingCourse.html.twig';
|
||||||
|
} elseif ($person instanceof Person) {
|
||||||
|
$view = 'ChillActivityBundle:Activity:selectTypePerson.html.twig';
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->denyAccessUnlessGranted('CHILL_PERSON_SEE', $person);
|
$data = [];
|
||||||
|
|
||||||
|
$activityTypeCategories = $em->getRepository(\Chill\ActivityBundle\Entity\ActivityTypeCategory::class)
|
||||||
|
->findBy(['active' => true], ['ordering' => 'ASC']);
|
||||||
|
|
||||||
|
foreach ($activityTypeCategories as $activityTypeCategory) {
|
||||||
|
$activityTypes = $em->getRepository(\Chill\ActivityBundle\Entity\ActivityType::class)
|
||||||
|
->findBy(['active' => true, 'category' => $activityTypeCategory], ['ordering' => 'ASC']);
|
||||||
|
|
||||||
|
$data[] = [
|
||||||
|
'activityTypeCategory' => $activityTypeCategory,
|
||||||
|
'activityTypes' => $activityTypes,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($view === null) {
|
||||||
|
throw $this->createNotFoundException('Template not found');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->render($view, [
|
||||||
|
'person' => $person,
|
||||||
|
'accompanyingCourse' => $accompanyingPeriod,
|
||||||
|
'data' => $data,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function newAction(Request $request): Response
|
||||||
|
{
|
||||||
|
$em = $this->getDoctrine()->getManager();
|
||||||
|
|
||||||
|
[$person, $accompanyingPeriod] = $this->getEntity($request);
|
||||||
|
|
||||||
|
if ($accompanyingPeriod instanceof AccompanyingPeriod) {
|
||||||
|
$view = 'ChillActivityBundle:Activity:newAccompanyingCourse.html.twig';
|
||||||
|
} elseif ($person instanceof Person) {
|
||||||
|
$view = 'ChillActivityBundle:Activity:newPerson.html.twig';
|
||||||
|
}
|
||||||
|
|
||||||
|
$activityType_id = $request->get('activityType_id', 0);
|
||||||
|
$activityType = $em->getRepository(\Chill\ActivityBundle\Entity\ActivityType::class)
|
||||||
|
->find($activityType_id);
|
||||||
|
|
||||||
|
if (!$activityType instanceof \Chill\ActivityBundle\Entity\ActivityType ||
|
||||||
|
!$activityType->isActive()) {
|
||||||
|
|
||||||
|
$params = $this->buildParamsToUrl($person, $accompanyingPeriod);
|
||||||
|
return $this->redirectToRoute('chill_activity_activity_select_type', $params);
|
||||||
|
}
|
||||||
|
|
||||||
$entity = new Activity();
|
$entity = new Activity();
|
||||||
$entity->setPerson($person);
|
$entity->setUser($this->getUser());
|
||||||
$form = $this->createCreateForm($entity, $person);
|
|
||||||
$form->handleRequest($request);
|
|
||||||
|
|
||||||
if ($form->isValid()) {
|
if ($person instanceof Person) {
|
||||||
$em = $this->getDoctrine()->getManager();
|
$entity->setPerson($person);
|
||||||
|
}
|
||||||
|
|
||||||
$this->denyAccessUnlessGranted('CHILL_ACTIVITY_CREATE', $entity,
|
if ($accompanyingPeriod instanceof AccompanyingPeriod) {
|
||||||
'creation of this activity not allowed');
|
$entity->setAccompanyingPeriod($accompanyingPeriod);
|
||||||
|
}
|
||||||
|
|
||||||
|
$entity->setType($activityType);
|
||||||
|
$entity->setDate(new \DateTime('now'));
|
||||||
|
|
||||||
|
// TODO revoir le Voter de Activity pour tenir compte qu'une activité peut appartenir a une période
|
||||||
|
// $this->denyAccessUnlessGranted('CHILL_ACTIVITY_CREATE', $entity);
|
||||||
|
|
||||||
|
$form = $this->createForm(ActivityType::class, $entity, [
|
||||||
|
'center' => $entity->getCenter(),
|
||||||
|
'role' => new Role('CHILL_ACTIVITY_CREATE'),
|
||||||
|
'activityType' => $entity->getType(),
|
||||||
|
'accompanyingPeriod' => $accompanyingPeriod,
|
||||||
|
])->handleRequest($request);
|
||||||
|
|
||||||
|
if ($form->isSubmitted() && $form->isValid()) {
|
||||||
$em->persist($entity);
|
$em->persist($entity);
|
||||||
$em->flush();
|
$em->flush();
|
||||||
|
|
||||||
$this->get('session')
|
$this->addFlash('success', $this->get('translator')->trans('Success : activity created!'));
|
||||||
->getFlashBag()
|
|
||||||
->add('success',
|
|
||||||
$this->get('translator')
|
|
||||||
->trans('Success : activity created!')
|
|
||||||
);
|
|
||||||
|
|
||||||
return $this->redirect(
|
$params = $this->buildParamsToUrl($person, $accompanyingPeriod);
|
||||||
$this->generateUrl('chill_activity_activity_show',
|
$params['id'] = $entity->getId();
|
||||||
array('id' => $entity->getId(), 'person_id' => $person_id)));
|
|
||||||
|
return $this->redirectToRoute('chill_activity_activity_show', $params);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->get('session')
|
if ($view === null) {
|
||||||
->getFlashBag()->add('danger',
|
throw $this->createNotFoundException('Template not found');
|
||||||
$this->get('translator')
|
|
||||||
->trans('The form is not valid. The activity has not been created !')
|
|
||||||
);
|
|
||||||
|
|
||||||
return $this->render('ChillActivityBundle:Activity:new.html.twig', array(
|
|
||||||
'entity' => $entity,
|
|
||||||
'form' => $form->createView(),
|
|
||||||
'person' => $person
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a form to create a Activity entity.
|
|
||||||
*
|
|
||||||
* @param Activity $entity The entity
|
|
||||||
*
|
|
||||||
* @return \Symfony\Component\Form\Form The form
|
|
||||||
*/
|
|
||||||
private function createCreateForm(Activity $entity)
|
|
||||||
{
|
|
||||||
$form = $this->createForm(ActivityType::class, $entity,
|
|
||||||
array(
|
|
||||||
'action' => $this->generateUrl('chill_activity_activity_create', [
|
|
||||||
'person_id' => $entity->getPerson()->getId(),
|
|
||||||
]),
|
|
||||||
'method' => 'POST',
|
|
||||||
'center' => $entity->getCenter(),
|
|
||||||
'role' => new Role('CHILL_ACTIVITY_CREATE')
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
return $form;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Displays a form to create a new Activity entity.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function newAction($person_id)
|
|
||||||
{
|
|
||||||
$em = $this->getDoctrine()->getManager();
|
|
||||||
$person = $em->getRepository('ChillPersonBundle:Person')->find($person_id);
|
|
||||||
|
|
||||||
if ($person === NULL){
|
|
||||||
throw $this->createNotFoundException('Person not found');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->denyAccessUnlessGranted('CHILL_PERSON_SEE', $person);
|
$activity_array = $this->serializer->normalize($entity, 'json', ['groups' => 'read']);
|
||||||
|
|
||||||
$entity = new Activity();
|
return $this->render($view, [
|
||||||
$entity->setUser($this->get('security.token_storage')->getToken()->getUser());
|
|
||||||
$entity->setPerson($person);
|
|
||||||
$entity->setDate(new \DateTime('now'));
|
|
||||||
|
|
||||||
$this->denyAccessUnlessGranted('CHILL_ACTIVITY_CREATE', $entity);
|
|
||||||
|
|
||||||
$form = $this->createCreateForm($entity, $person);
|
|
||||||
|
|
||||||
return $this->render('ChillActivityBundle:Activity:new.html.twig', array(
|
|
||||||
'person' => $person,
|
'person' => $person,
|
||||||
|
'accompanyingCourse' => $accompanyingPeriod,
|
||||||
'entity' => $entity,
|
'entity' => $entity,
|
||||||
'form' => $form->createView(),
|
'form' => $form->createView(),
|
||||||
));
|
'activity_json' => $activity_array
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function showAction(Request $request, $id): Response
|
||||||
* Finds and displays a Activity entity.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function showAction($person_id, $id)
|
|
||||||
{
|
{
|
||||||
$em = $this->getDoctrine()->getManager();
|
$em = $this->getDoctrine()->getManager();
|
||||||
$person = $em->getRepository('ChillPersonBundle:Person')->find($person_id);
|
|
||||||
|
|
||||||
if (!$person) {
|
[$person, $accompanyingPeriod] = $this->getEntity($request);
|
||||||
throw $this->createNotFoundException('person not found');
|
|
||||||
|
if ($accompanyingPeriod instanceof AccompanyingPeriod) {
|
||||||
|
$view = 'ChillActivityBundle:Activity:showAccompanyingCourse.html.twig';
|
||||||
|
} elseif ($person instanceof Person) {
|
||||||
|
$view = 'ChillActivityBundle:Activity:showPerson.html.twig';
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->denyAccessUnlessGranted('CHILL_PERSON_SEE', $person);
|
|
||||||
|
|
||||||
$entity = $em->getRepository('ChillActivityBundle:Activity')->find($id);
|
$entity = $em->getRepository('ChillActivityBundle:Activity')->find($id);
|
||||||
|
|
||||||
if (!$entity) {
|
if (!$entity) {
|
||||||
throw $this->createNotFoundException('Unable to find Activity entity.');
|
throw $this->createNotFoundException('Unable to find Activity entity.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (null !== $accompanyingPeriod) {
|
||||||
|
$entity->personsAssociated = $entity->getPersonsAssociated();
|
||||||
|
$entity->personsNotAssociated = $entity->getPersonsNotAssociated();
|
||||||
|
}
|
||||||
|
|
||||||
$this->denyAccessUnlessGranted('CHILL_ACTIVITY_SEE', $entity);
|
// TODO revoir le Voter de Activity pour tenir compte qu'une activité peut appartenir a une période
|
||||||
|
// $this->denyAccessUnlessGranted('CHILL_ACTIVITY_SEE', $entity);
|
||||||
|
|
||||||
$deleteForm = $this->createDeleteForm($id, $person);
|
$deleteForm = $this->createDeleteForm($id, $person, $accompanyingPeriod);
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
/*
|
||||||
$event = new PrivacyEvent($person, array(
|
$event = new PrivacyEvent($person, array(
|
||||||
'element_class' => Activity::class,
|
'element_class' => Activity::class,
|
||||||
'element_id' => $entity->getId(),
|
'element_id' => $entity->getId(),
|
||||||
'action' => 'show'
|
'action' => 'show'
|
||||||
));
|
));
|
||||||
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event);
|
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event);
|
||||||
|
*/
|
||||||
|
|
||||||
return $this->render('ChillActivityBundle:Activity:show.html.twig', array(
|
if ($view === null) {
|
||||||
|
throw $this->createNotFoundException('Template not found');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->render($view, array(
|
||||||
'person' => $person,
|
'person' => $person,
|
||||||
|
'accompanyingCourse' => $accompanyingPeriod,
|
||||||
'entity' => $entity,
|
'entity' => $entity,
|
||||||
'delete_form' => $deleteForm->createView(),
|
'delete_form' => $deleteForm->createView(),
|
||||||
));
|
));
|
||||||
@ -260,118 +275,70 @@ class ActivityController extends AbstractController
|
|||||||
* Displays a form to edit an existing Activity entity.
|
* Displays a form to edit an existing Activity entity.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function editAction($person_id, $id)
|
public function editAction($id, Request $request): Response
|
||||||
{
|
{
|
||||||
$em = $this->getDoctrine()->getManager();
|
$em = $this->getDoctrine()->getManager();
|
||||||
$person = $em->getRepository('ChillPersonBundle:Person')->find($person_id);
|
|
||||||
|
|
||||||
if (!$person) {
|
[$person, $accompanyingPeriod] = $this->getEntity($request);
|
||||||
throw $this->createNotFoundException('person not found');
|
|
||||||
|
if ($accompanyingPeriod instanceof AccompanyingPeriod) {
|
||||||
|
$view = 'ChillActivityBundle:Activity:editAccompanyingCourse.html.twig';
|
||||||
|
} elseif ($person instanceof Person) {
|
||||||
|
$view = 'ChillActivityBundle:Activity:editPerson.html.twig';
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->denyAccessUnlessGranted('CHILL_PERSON_SEE', $person);
|
|
||||||
|
|
||||||
$entity = $em->getRepository('ChillActivityBundle:Activity')->find($id);
|
$entity = $em->getRepository('ChillActivityBundle:Activity')->find($id);
|
||||||
|
|
||||||
if (!$entity) {
|
if (!$entity) {
|
||||||
throw $this->createNotFoundException('Unable to find Activity entity.');
|
throw $this->createNotFoundException('Unable to find Activity entity.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->denyAccessUnlessGranted('CHILL_ACTIVITY_UPDATE', $entity);
|
// TODO
|
||||||
|
// $this->denyAccessUnlessGranted('CHILL_ACTIVITY_UPDATE', $entity);
|
||||||
|
|
||||||
$editForm = $this->createEditForm($entity);
|
$form = $this->createForm(ActivityType::class, $entity, [
|
||||||
$deleteForm = $this->createDeleteForm($id, $person);
|
'center' => $entity->getCenter(),
|
||||||
|
'role' => new Role('CHILL_ACTIVITY_UPDATE'),
|
||||||
|
'activityType' => $entity->getType(),
|
||||||
|
'accompanyingPeriod' => $accompanyingPeriod,
|
||||||
|
])->handleRequest($request);
|
||||||
|
|
||||||
|
if ($form->isSubmitted() && $form->isValid()) {
|
||||||
|
$em->persist($entity);
|
||||||
|
$em->flush();
|
||||||
|
|
||||||
|
$this->addFlash('success', $this->get('translator')->trans('Success : activity updated!'));
|
||||||
|
|
||||||
|
$params = $this->buildParamsToUrl($person, $accompanyingPeriod);
|
||||||
|
$params['id'] = $id;
|
||||||
|
return $this->redirectToRoute('chill_activity_activity_show', $params);
|
||||||
|
}
|
||||||
|
|
||||||
|
$deleteForm = $this->createDeleteForm($id, $person, $accompanyingPeriod);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* TODO
|
||||||
$event = new PrivacyEvent($person, array(
|
$event = new PrivacyEvent($person, array(
|
||||||
'element_class' => Activity::class,
|
'element_class' => Activity::class,
|
||||||
'element_id' => $entity->getId(),
|
'element_id' => $entity->getId(),
|
||||||
'action' => 'edit'
|
'action' => 'edit'
|
||||||
));
|
));
|
||||||
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event);
|
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event);
|
||||||
|
*/
|
||||||
|
|
||||||
return $this->render('ChillActivityBundle:Activity:edit.html.twig', array(
|
if ($view === null) {
|
||||||
'entity' => $entity,
|
throw $this->createNotFoundException('Template not found');
|
||||||
'edit_form' => $editForm->createView(),
|
|
||||||
'delete_form' => $deleteForm->createView(),
|
|
||||||
'person' => $person
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a form to edit a Activity entity.
|
|
||||||
*
|
|
||||||
* @param Activity $entity The entity
|
|
||||||
*
|
|
||||||
* @return \Symfony\Component\Form\Form The form
|
|
||||||
*/
|
|
||||||
private function createEditForm(Activity $entity)
|
|
||||||
{
|
|
||||||
$form = $this->createForm(ActivityType::class, $entity, array(
|
|
||||||
'action' => $this->generateUrl('chill_activity_activity_update',
|
|
||||||
array(
|
|
||||||
'id' => $entity->getId(),
|
|
||||||
'person_id' => $entity->getPerson()->getId()
|
|
||||||
)),
|
|
||||||
'method' => 'PUT',
|
|
||||||
'center' => $entity->getCenter(),
|
|
||||||
'role' => new Role('CHILL_ACTIVITY_UPDATE')
|
|
||||||
));
|
|
||||||
|
|
||||||
return $form;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Edits an existing Activity entity.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function updateAction(Request $request, $person_id, $id)
|
|
||||||
{
|
|
||||||
$em = $this->getDoctrine()->getManager();
|
|
||||||
|
|
||||||
$person = $em->getRepository('ChillPersonBundle:Person')->find($person_id);
|
|
||||||
$entity = $em->getRepository('ChillActivityBundle:Activity')->find($id);
|
|
||||||
|
|
||||||
if (!$entity) {
|
|
||||||
throw $this->createNotFoundException('Unable to find Activity entity.');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->denyAccessUnlessGranted('CHILL_ACTIVITY_UPDATE', $entity);
|
$activity_array = $this->serializer->normalize($entity, 'json', ['groups' => 'read']);
|
||||||
|
|
||||||
$deleteForm = $this->createDeleteForm($id, $person);
|
return $this->render($view, array(
|
||||||
$editForm = $this->createEditForm($entity);
|
|
||||||
$editForm->handleRequest($request);
|
|
||||||
|
|
||||||
$event = new PrivacyEvent($person, array(
|
|
||||||
'element_class' => Activity::class,
|
|
||||||
'element_id' => $entity->getId(),
|
|
||||||
'action' => 'update'
|
|
||||||
));
|
|
||||||
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event);
|
|
||||||
|
|
||||||
if ($editForm->isValid()) {
|
|
||||||
$em->flush();
|
|
||||||
|
|
||||||
$this->get('session')
|
|
||||||
->getFlashBag()
|
|
||||||
->add('success',
|
|
||||||
$this->get('translator')
|
|
||||||
->trans('Success : activity updated!')
|
|
||||||
);
|
|
||||||
|
|
||||||
return $this->redirect($this->generateUrl('chill_activity_activity_show', array('id' => $id, 'person_id' => $person_id)));
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->get('session')
|
|
||||||
->getFlashBag()
|
|
||||||
->add('error',
|
|
||||||
$this->get('translator')
|
|
||||||
->trans('This form contains errors')
|
|
||||||
);
|
|
||||||
|
|
||||||
return $this->render('ChillActivityBundle:Activity:edit.html.twig', array(
|
|
||||||
'person' => $entity->getPerson(),
|
|
||||||
'entity' => $entity,
|
'entity' => $entity,
|
||||||
'edit_form' => $editForm->createView(),
|
'edit_form' => $form->createView(),
|
||||||
'delete_form' => $deleteForm->createView(),
|
'delete_form' => $deleteForm->createView(),
|
||||||
|
'person' => $person,
|
||||||
|
'accompanyingCourse' => $accompanyingPeriod,
|
||||||
|
'activity_json' => $activity_array
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -379,22 +346,29 @@ class ActivityController extends AbstractController
|
|||||||
* Deletes a Activity entity.
|
* Deletes a Activity entity.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function deleteAction(Request $request, $id, $person_id)
|
public function deleteAction(Request $request, $id)
|
||||||
{
|
{
|
||||||
$em = $this->getDoctrine()->getManager();
|
$em = $this->getDoctrine()->getManager();
|
||||||
|
|
||||||
|
[$person, $accompanyingPeriod] = $this->getEntity($request);
|
||||||
|
|
||||||
|
if ($accompanyingPeriod instanceof AccompanyingPeriod) {
|
||||||
|
$view = 'ChillActivityBundle:Activity:confirm_deleteAccompanyingCourse.html.twig';
|
||||||
|
} elseif ($person instanceof Person) {
|
||||||
|
$view = 'ChillActivityBundle:Activity:confirm_deletePerson.html.twig';
|
||||||
|
}
|
||||||
|
|
||||||
/* @var $activity Activity */
|
/* @var $activity Activity */
|
||||||
$activity = $em->getRepository('ChillActivityBundle:Activity')
|
$activity = $em->getRepository('ChillActivityBundle:Activity')->find($id);
|
||||||
->find($id);
|
|
||||||
$person = $activity->getPerson();
|
|
||||||
|
|
||||||
if (!$activity) {
|
if (!$activity) {
|
||||||
throw $this->createNotFoundException('Unable to find Activity entity.');
|
throw $this->createNotFoundException('Unable to find Activity entity.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->denyAccessUnlessGranted('CHILL_ACTIVITY_DELETE', $activity);
|
// TODO
|
||||||
|
// $this->denyAccessUnlessGranted('CHILL_ACTIVITY_DELETE', $activity);
|
||||||
|
|
||||||
$form = $this->createDeleteForm($id, $person);
|
$form = $this->createDeleteForm($id, $person, $accompanyingPeriod);
|
||||||
|
|
||||||
if ($request->getMethod() === Request::METHOD_DELETE) {
|
if ($request->getMethod() === Request::METHOD_DELETE) {
|
||||||
$form->handleRequest($request);
|
$form->handleRequest($request);
|
||||||
@ -404,14 +378,14 @@ class ActivityController extends AbstractController
|
|||||||
$this->logger->notice("An activity has been removed", array(
|
$this->logger->notice("An activity has been removed", array(
|
||||||
'by_user' => $this->getUser()->getUsername(),
|
'by_user' => $this->getUser()->getUsername(),
|
||||||
'activity_id' => $activity->getId(),
|
'activity_id' => $activity->getId(),
|
||||||
'person_id' => $activity->getPerson()->getId(),
|
'person_id' => $activity->getPerson() ? $activity->getPerson()->getId() : null,
|
||||||
'comment' => $activity->getComment()->getComment(),
|
'comment' => $activity->getComment()->getComment(),
|
||||||
'scope_id' => $activity->getScope()->getId(),
|
'scope_id' => $activity->getScope() ? $activity->getScope()->getId() : null,
|
||||||
'reasons_ids' => $activity->getReasons()
|
'reasons_ids' => $activity->getReasons()
|
||||||
->map(function ($ar) { return $ar->getId(); })
|
->map(function ($ar) { return $ar->getId(); })
|
||||||
->toArray(),
|
->toArray(),
|
||||||
'type_id' => $activity->getType()->getId(),
|
'type_id' => $activity->getType()->getId(),
|
||||||
'duration' => $activity->getDurationTime()->format('U'),
|
'duration' => $activity->getDurationTime() ? $activity->getDurationTime()->format('U') : null,
|
||||||
'date' => $activity->getDate()->format('Y-m-d'),
|
'date' => $activity->getDate()->format('Y-m-d'),
|
||||||
'attendee' => $activity->getAttendee()
|
'attendee' => $activity->getAttendee()
|
||||||
));
|
));
|
||||||
@ -422,37 +396,86 @@ class ActivityController extends AbstractController
|
|||||||
$this->addFlash('success', $this->get('translator')
|
$this->addFlash('success', $this->get('translator')
|
||||||
->trans("The activity has been successfully removed."));
|
->trans("The activity has been successfully removed."));
|
||||||
|
|
||||||
return $this->redirect($this->generateUrl(
|
$params = $this->buildParamsToUrl($person, $accompanyingPeriod);
|
||||||
'chill_activity_activity_list', array(
|
return $this->redirectToRoute('chill_activity_activity_list', $params);
|
||||||
'person_id' => $person_id
|
|
||||||
)));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->render('ChillActivityBundle:Activity:confirm_delete.html.twig', array(
|
if ($view === null) {
|
||||||
|
throw $this->createNotFoundException('Template not found');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->render($view, array(
|
||||||
'activity' => $activity,
|
'activity' => $activity,
|
||||||
'delete_form' => $form->createView()
|
'delete_form' => $form->createView(),
|
||||||
|
'person' => $person,
|
||||||
|
'accompanyingCourse' => $accompanyingPeriod,
|
||||||
));
|
));
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a form to delete a Activity entity by id.
|
* Creates a form to delete a Activity entity by id.
|
||||||
*
|
|
||||||
* @param mixed $id The entity id
|
|
||||||
*
|
|
||||||
* @return \Symfony\Component\Form\Form The form
|
|
||||||
*/
|
*/
|
||||||
private function createDeleteForm($id, $person)
|
private function createDeleteForm(int $id, ?Person $person, ?AccompanyingPeriod $accompanyingPeriod): Form
|
||||||
{
|
{
|
||||||
|
$params = $this->buildParamsToUrl($person, $accompanyingPeriod);
|
||||||
|
$params['id'] = $id;
|
||||||
|
|
||||||
return $this->createFormBuilder()
|
return $this->createFormBuilder()
|
||||||
->setAction($this->generateUrl(
|
->setAction($this->generateUrl('chill_activity_activity_delete', $params))
|
||||||
'chill_activity_activity_delete',
|
|
||||||
array('id' => $id, 'person_id' => $person->getId())))
|
|
||||||
->setMethod('DELETE')
|
->setMethod('DELETE')
|
||||||
->add('submit', SubmitType::class, array('label' => 'Delete'))
|
->add('submit', SubmitType::class, array('label' => 'Delete'))
|
||||||
->getForm()
|
->getForm()
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function getEntity(Request $request): array
|
||||||
|
{
|
||||||
|
$em = $this->getDoctrine()->getManager();
|
||||||
|
$person = $accompanyingPeriod = null;
|
||||||
|
|
||||||
|
if ($request->query->has('person_id')) {
|
||||||
|
$person_id = $request->get('person_id');
|
||||||
|
$person = $em->getRepository(Person::class)->find($person_id);
|
||||||
|
|
||||||
|
if ($person === null) {
|
||||||
|
throw $this->createNotFoundException('Person not found');
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->denyAccessUnlessGranted('CHILL_PERSON_SEE', $person);
|
||||||
|
} elseif ($request->query->has('accompanying_period_id')) {
|
||||||
|
$accompanying_period_id = $request->get('accompanying_period_id');
|
||||||
|
$accompanyingPeriod = $em->getRepository(AccompanyingPeriod::class)->find($accompanying_period_id);
|
||||||
|
|
||||||
|
if ($accompanyingPeriod === null) {
|
||||||
|
throw $this->createNotFoundException('Accompanying Period not found');
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO Add permission
|
||||||
|
// $this->denyAccessUnlessGranted('CHILL_PERSON_SEE', $person);
|
||||||
|
} else {
|
||||||
|
throw $this->createNotFoundException("Person or Accompanying Period not found");
|
||||||
|
}
|
||||||
|
|
||||||
|
return [
|
||||||
|
$person, $accompanyingPeriod
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
private function buildParamsToUrl(
|
||||||
|
?Person $person,
|
||||||
|
?AccompanyingPeriod $accompanyingPeriod
|
||||||
|
): array {
|
||||||
|
$params = [];
|
||||||
|
|
||||||
|
if ($person) {
|
||||||
|
$params['person_id'] = $person->getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($accompanyingPeriod) {
|
||||||
|
$params['accompanying_period_id'] = $accompanyingPeriod->getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $params;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,178 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Chill\ActivityBundle\Controller;
|
|
||||||
|
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
|
||||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
|
||||||
use Chill\ActivityBundle\Entity\ActivityType;
|
|
||||||
use Chill\ActivityBundle\Form\ActivityTypeType;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class ActivityTypeController
|
|
||||||
*
|
|
||||||
* @package Chill\ActivityBundle\Controller
|
|
||||||
*/
|
|
||||||
class ActivityTypeController extends AbstractController
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Lists all ActivityType entities.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function indexAction()
|
|
||||||
{
|
|
||||||
$em = $this->getDoctrine()->getManager();
|
|
||||||
|
|
||||||
$entities = $em->getRepository('ChillActivityBundle:ActivityType')->findAll();
|
|
||||||
|
|
||||||
return $this->render('ChillActivityBundle:ActivityType:index.html.twig', array(
|
|
||||||
'entities' => $entities,
|
|
||||||
));
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Creates a new ActivityType entity.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function createAction(Request $request)
|
|
||||||
{
|
|
||||||
$entity = new ActivityType();
|
|
||||||
$form = $this->createCreateForm($entity);
|
|
||||||
$form->handleRequest($request);
|
|
||||||
|
|
||||||
if ($form->isValid()) {
|
|
||||||
$em = $this->getDoctrine()->getManager();
|
|
||||||
$em->persist($entity);
|
|
||||||
$em->flush();
|
|
||||||
|
|
||||||
return $this->redirect($this->generateUrl('chill_activity_activitytype_show', array('id' => $entity->getId())));
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->render('ChillActivityBundle:ActivityType:new.html.twig', array(
|
|
||||||
'entity' => $entity,
|
|
||||||
'form' => $form->createView(),
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a form to create a ActivityType entity.
|
|
||||||
*
|
|
||||||
* @param ActivityType $entity The entity
|
|
||||||
*
|
|
||||||
* @return \Symfony\Component\Form\Form The form
|
|
||||||
*/
|
|
||||||
private function createCreateForm(ActivityType $entity)
|
|
||||||
{
|
|
||||||
$form = $this->createForm(ActivityTypeType::class, $entity, array(
|
|
||||||
'action' => $this->generateUrl('chill_activity_activitytype_create'),
|
|
||||||
'method' => 'POST',
|
|
||||||
));
|
|
||||||
|
|
||||||
$form->add('submit', SubmitType::class, array('label' => 'Create'));
|
|
||||||
|
|
||||||
return $form;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Displays a form to create a new ActivityType entity.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function newAction()
|
|
||||||
{
|
|
||||||
$entity = new ActivityType();
|
|
||||||
$form = $this->createCreateForm($entity);
|
|
||||||
|
|
||||||
return $this->render('ChillActivityBundle:ActivityType:new.html.twig', array(
|
|
||||||
'entity' => $entity,
|
|
||||||
'form' => $form->createView(),
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Finds and displays a ActivityType entity.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function showAction($id)
|
|
||||||
{
|
|
||||||
$em = $this->getDoctrine()->getManager();
|
|
||||||
|
|
||||||
$entity = $em->getRepository('ChillActivityBundle:ActivityType')->find($id);
|
|
||||||
|
|
||||||
if (!$entity) {
|
|
||||||
throw $this->createNotFoundException('Unable to find ActivityType entity.');
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->render('ChillActivityBundle:ActivityType:show.html.twig', array(
|
|
||||||
'entity' => $entity,
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Displays a form to edit an existing ActivityType entity.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function editAction($id)
|
|
||||||
{
|
|
||||||
$em = $this->getDoctrine()->getManager();
|
|
||||||
|
|
||||||
$entity = $em->getRepository('ChillActivityBundle:ActivityType')->find($id);
|
|
||||||
|
|
||||||
if (!$entity) {
|
|
||||||
throw $this->createNotFoundException('Unable to find ActivityType entity.');
|
|
||||||
}
|
|
||||||
|
|
||||||
$editForm = $this->createEditForm($entity);
|
|
||||||
|
|
||||||
return $this->render('ChillActivityBundle:ActivityType:edit.html.twig', array(
|
|
||||||
'entity' => $entity,
|
|
||||||
'edit_form' => $editForm->createView()
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a form to edit a ActivityType entity.
|
|
||||||
*
|
|
||||||
* @param ActivityType $entity The entity
|
|
||||||
*
|
|
||||||
* @return \Symfony\Component\Form\Form The form
|
|
||||||
*/
|
|
||||||
private function createEditForm(ActivityType $entity)
|
|
||||||
{
|
|
||||||
$form = $this->createForm(ActivityTypeType::class, $entity, array(
|
|
||||||
'action' => $this->generateUrl('chill_activity_activitytype_update', array('id' => $entity->getId())),
|
|
||||||
'method' => 'PUT',
|
|
||||||
));
|
|
||||||
|
|
||||||
$form->add('submit', SubmitType::class, array('label' => 'Update'));
|
|
||||||
|
|
||||||
return $form;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Edits an existing ActivityType entity.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function updateAction(Request $request, $id)
|
|
||||||
{
|
|
||||||
$em = $this->getDoctrine()->getManager();
|
|
||||||
|
|
||||||
$entity = $em->getRepository('ChillActivityBundle:ActivityType')->find($id);
|
|
||||||
|
|
||||||
if (!$entity) {
|
|
||||||
throw $this->createNotFoundException('Unable to find ActivityType entity.');
|
|
||||||
}
|
|
||||||
|
|
||||||
$editForm = $this->createEditForm($entity);
|
|
||||||
$editForm->handleRequest($request);
|
|
||||||
|
|
||||||
if ($editForm->isValid()) {
|
|
||||||
$em->flush();
|
|
||||||
|
|
||||||
return $this->redirect($this->generateUrl('chill_activity_activitytype_edit', array('id' => $id)));
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->render('ChillActivityBundle:ActivityType:edit.html.twig', array(
|
|
||||||
'entity' => $entity,
|
|
||||||
'edit_form' => $editForm->createView(),
|
|
||||||
));
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Chill\ActivityBundle\Controller;
|
||||||
|
|
||||||
|
use Chill\MainBundle\CRUD\Controller\CRUDController;
|
||||||
|
use Chill\MainBundle\Pagination\PaginatorInterface;
|
||||||
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
|
||||||
|
class AdminActivityPresenceController extends CRUDController
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @param string $action
|
||||||
|
* @param \Doctrine\ORM\QueryBuilder|mixed $query
|
||||||
|
* @param Request $request
|
||||||
|
* @param PaginatorInterface $paginator
|
||||||
|
* @return \Doctrine\ORM\QueryBuilder|mixed
|
||||||
|
*/
|
||||||
|
protected function orderQuery(string $action, $query, Request $request, PaginatorInterface $paginator)
|
||||||
|
{
|
||||||
|
/** @var \Doctrine\ORM\QueryBuilder $query */
|
||||||
|
return $query->orderBy('e.id', 'ASC');
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Chill\ActivityBundle\Controller;
|
||||||
|
|
||||||
|
use Chill\MainBundle\CRUD\Controller\CRUDController;
|
||||||
|
use Chill\MainBundle\Pagination\PaginatorInterface;
|
||||||
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
|
||||||
|
class AdminActivityTypeCategoryController extends CRUDController
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @param string $action
|
||||||
|
* @param \Doctrine\ORM\QueryBuilder|mixed $query
|
||||||
|
* @param Request $request
|
||||||
|
* @param PaginatorInterface $paginator
|
||||||
|
* @return \Doctrine\ORM\QueryBuilder|mixed
|
||||||
|
*/
|
||||||
|
protected function orderQuery(string $action, $query, Request $request, PaginatorInterface $paginator)
|
||||||
|
{
|
||||||
|
/** @var \Doctrine\ORM\QueryBuilder $query */
|
||||||
|
return $query->orderBy('e.ordering', 'ASC');
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Chill\ActivityBundle\Controller;
|
||||||
|
|
||||||
|
use Chill\MainBundle\CRUD\Controller\CRUDController;
|
||||||
|
use Chill\MainBundle\Pagination\PaginatorInterface;
|
||||||
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
|
||||||
|
class AdminActivityTypeController extends CRUDController
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @param string $action
|
||||||
|
* @param \Doctrine\ORM\QueryBuilder|mixed $query
|
||||||
|
* @param Request $request
|
||||||
|
* @param PaginatorInterface $paginator
|
||||||
|
* @return \Doctrine\ORM\QueryBuilder|mixed
|
||||||
|
*/
|
||||||
|
protected function orderQuery(string $action, $query, Request $request, PaginatorInterface $paginator)
|
||||||
|
{
|
||||||
|
/** @var \Doctrine\ORM\QueryBuilder $query */
|
||||||
|
return $query->orderBy('e.ordering', 'ASC');
|
||||||
|
}
|
||||||
|
}
|
@ -116,9 +116,10 @@ class LoadActivity extends AbstractFixture implements OrderedFixtureInterface, C
|
|||||||
->setDurationTime($this->faker->dateTime(36000))
|
->setDurationTime($this->faker->dateTime(36000))
|
||||||
->setType($this->getRandomActivityType())
|
->setType($this->getRandomActivityType())
|
||||||
->setScope($this->getRandomScope())
|
->setScope($this->getRandomScope())
|
||||||
->setAttendee($this->faker->boolean())
|
|
||||||
;
|
;
|
||||||
|
|
||||||
|
// ->setAttendee($this->faker->boolean())
|
||||||
|
|
||||||
$usedId = array();
|
$usedId = array();
|
||||||
for ($i = 0; $i < rand(0, 4); $i++) {
|
for ($i = 0; $i < rand(0, 4); $i++) {
|
||||||
$reason = $this->getRandomActivityReason($usedId);
|
$reason = $this->getRandomActivityReason($usedId);
|
||||||
|
@ -2,27 +2,27 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Chill is a software for social workers
|
* Chill is a software for social workers
|
||||||
*
|
*
|
||||||
* Copyright (C) 2014-2015, Champs Libres Cooperative SCRLFS,
|
* Copyright (C) 2014-2015, Champs Libres Cooperative SCRLFS,
|
||||||
* <http://www.champs-libres.coop>, <info@champs-libres.coop>
|
* <http://www.champs-libres.coop>, <info@champs-libres.coop>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as
|
* it under the terms of the GNU Affero General Public License as
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
* License, or (at your option) any later version.
|
* License, or (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Affero General Public License for more details.
|
* GNU Affero General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Chill\ActivityBundle\DataFixtures\ORM;
|
namespace Chill\ActivityBundle\DataFixtures\ORM;
|
||||||
|
|
||||||
use Doctrine\Common\DataFixtures\AbstractFixture;
|
use Doctrine\Bundle\FixturesBundle\Fixture;
|
||||||
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
|
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
|
||||||
use Doctrine\Persistence\ObjectManager;
|
use Doctrine\Persistence\ObjectManager;
|
||||||
use Chill\ActivityBundle\Entity\ActivityType;
|
use Chill\ActivityBundle\Entity\ActivityType;
|
||||||
@ -32,36 +32,59 @@ use Chill\ActivityBundle\Entity\ActivityType;
|
|||||||
*
|
*
|
||||||
* @author Champs-Libres Coop
|
* @author Champs-Libres Coop
|
||||||
*/
|
*/
|
||||||
class LoadActivityType extends AbstractFixture implements OrderedFixtureInterface
|
class LoadActivityType extends Fixture implements OrderedFixtureInterface
|
||||||
{
|
{
|
||||||
public function getOrder()
|
public function getOrder()
|
||||||
{
|
{
|
||||||
return 16100;
|
return 16100;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static $references = array();
|
public static $references = array();
|
||||||
|
|
||||||
public function load(ObjectManager $manager)
|
public function load(ObjectManager $manager)
|
||||||
{
|
{
|
||||||
$types = [
|
$types = [
|
||||||
[ 'name' =>
|
# Exange
|
||||||
['fr' => 'Appel téléphonique', 'en' => 'Telephone call', 'nl' => 'Telefoon appel']],
|
[
|
||||||
[ 'name' =>
|
'name' =>
|
||||||
['fr' => 'Entretien', 'en' => 'Interview', 'nl' => 'Vraaggesprek']],
|
['fr' => 'Entretien physique avec l\'usager'],
|
||||||
[ 'name' =>
|
'category' => 'exchange' ],
|
||||||
['fr' => 'Inspection', 'en' => 'Inspection', 'nl' => 'Inspectie']]
|
[
|
||||||
|
'name' =>
|
||||||
|
['fr' => 'Appel téléphonique', 'en' => 'Telephone call', 'nl' => 'Telefoon appel'],
|
||||||
|
'category' => 'exchange' ],
|
||||||
|
[
|
||||||
|
'name' =>
|
||||||
|
['fr' => 'Courriel', 'en' => 'Email', 'nl' => 'Email'],
|
||||||
|
'category' => 'exchange' ],
|
||||||
|
# Meeting
|
||||||
|
[
|
||||||
|
'name' =>
|
||||||
|
['fr' => 'Point technique encadrant'],
|
||||||
|
'category' => 'meeting' ],
|
||||||
|
[
|
||||||
|
'name' =>
|
||||||
|
['fr' => 'Réunion avec des partenaires'],
|
||||||
|
'category' => 'meeting' ],
|
||||||
|
[
|
||||||
|
'name' =>
|
||||||
|
['fr' => 'Commission pluridisciplinaire et pluri-institutionnelle'],
|
||||||
|
'category' => 'meeting' ],
|
||||||
];
|
];
|
||||||
|
|
||||||
foreach ($types as $t) {
|
foreach ($types as $t) {
|
||||||
print "Creating activity type : " . $t['name']['en'] . "\n";
|
print "Creating activity type : " . $t['name']['fr'] . " (cat:". $t['category'] . " \n";
|
||||||
$activityType = (new ActivityType())
|
$activityType = (new ActivityType())
|
||||||
->setName(($t['name']));
|
->setName(($t['name']))
|
||||||
|
->setCategory($this->getReference('activity_type_cat_'.$t['category']))
|
||||||
|
->setSocialIssuesVisible(1)
|
||||||
|
->setSocialActionsVisible(1);
|
||||||
$manager->persist($activityType);
|
$manager->persist($activityType);
|
||||||
$reference = 'activity_type_'.$t['name']['en'];
|
$reference = 'activity_type_'.$t['name']['fr'];
|
||||||
$this->addReference($reference, $activityType);
|
$this->addReference($reference, $activityType);
|
||||||
static::$references[] = $reference;
|
static::$references[] = $reference;
|
||||||
}
|
}
|
||||||
|
|
||||||
$manager->flush();
|
$manager->flush();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,72 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Chill is a software for social workers
|
||||||
|
*
|
||||||
|
* Copyright (C) 2014-2021, Champs Libres Cooperative SCRLFS,
|
||||||
|
* <http://www.champs-libres.coop>, <info@champs-libres.coop>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as
|
||||||
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Chill\ActivityBundle\DataFixtures\ORM;
|
||||||
|
|
||||||
|
use Doctrine\Bundle\FixturesBundle\Fixture;
|
||||||
|
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
|
||||||
|
use Doctrine\Persistence\ObjectManager;
|
||||||
|
use Chill\ActivityBundle\Entity\ActivityTypeCategory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fixtures for ActivityTypeCategory
|
||||||
|
*
|
||||||
|
* @author Champs-Libres Coop
|
||||||
|
*/
|
||||||
|
class LoadActivityTypeCategory extends Fixture implements OrderedFixtureInterface
|
||||||
|
{
|
||||||
|
public static $references = array();
|
||||||
|
|
||||||
|
public function getOrder()
|
||||||
|
{
|
||||||
|
return 16050;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function load(ObjectManager $manager)
|
||||||
|
{
|
||||||
|
$categories = [
|
||||||
|
[
|
||||||
|
'name' => ['fr' => 'Échange avec usager', 'en' => 'Exchange with user'],
|
||||||
|
'ref' => 'exchange',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'name' => ['fr' => 'Réunion', 'en' => 'Meeting'],
|
||||||
|
'ref' => 'meeting',
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach ($categories as $cat) {
|
||||||
|
print "Creating activity type category : " . $cat['ref'] . "\n";
|
||||||
|
|
||||||
|
$newCat = (new ActivityTypeCategory())
|
||||||
|
->setName(($cat['name']));
|
||||||
|
|
||||||
|
$manager->persist($newCat);
|
||||||
|
$reference = 'activity_type_cat_'.$cat['ref'];
|
||||||
|
|
||||||
|
$this->addReference($reference, $newCat);
|
||||||
|
static::$references[] = $reference;
|
||||||
|
}
|
||||||
|
|
||||||
|
$manager->flush();
|
||||||
|
}
|
||||||
|
}
|
@ -3,7 +3,7 @@
|
|||||||
/*
|
/*
|
||||||
* Chill is a software for social workers
|
* Chill is a software for social workers
|
||||||
*
|
*
|
||||||
* Copyright (C) 2014-2015, Champs Libres Cooperative SCRLFS,
|
* Copyright (C) 2014-2015, Champs Libres Cooperative SCRLFS,
|
||||||
* <http://www.champs-libres.coop>, <info@champs-libres.coop>
|
* <http://www.champs-libres.coop>, <info@champs-libres.coop>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
@ -44,7 +44,7 @@ class ChillActivityExtension extends Extension implements PrependExtensionInterf
|
|||||||
{
|
{
|
||||||
$configuration = new Configuration();
|
$configuration = new Configuration();
|
||||||
$config = $this->processConfiguration($configuration, $configs);
|
$config = $this->processConfiguration($configuration, $configs);
|
||||||
|
|
||||||
$container->setParameter('chill_activity.form.time_duration', $config['form']['time_duration']);
|
$container->setParameter('chill_activity.form.time_duration', $config['form']['time_duration']);
|
||||||
|
|
||||||
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../config'));
|
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../config'));
|
||||||
@ -56,17 +56,18 @@ class ChillActivityExtension extends Extension implements PrependExtensionInterf
|
|||||||
$loader->load('services/form.yaml');
|
$loader->load('services/form.yaml');
|
||||||
$loader->load('services/templating.yaml');
|
$loader->load('services/templating.yaml');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function prepend(ContainerBuilder $container)
|
public function prepend(ContainerBuilder $container)
|
||||||
{
|
{
|
||||||
$this->prependRoutes($container);
|
$this->prependRoutes($container);
|
||||||
$this->prependAuthorization($container);
|
$this->prependAuthorization($container);
|
||||||
|
$this->prependCruds($container);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-PHPdoc)
|
/* (non-PHPdoc)
|
||||||
* @see \Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface::prepend()
|
* @see \Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface::prepend()
|
||||||
*/
|
*/
|
||||||
public function prependRoutes(ContainerBuilder $container)
|
public function prependRoutes(ContainerBuilder $container)
|
||||||
{
|
{
|
||||||
//add routes for custom bundle
|
//add routes for custom bundle
|
||||||
$container->prependExtensionConfig('chill_main', array(
|
$container->prependExtensionConfig('chill_main', array(
|
||||||
@ -77,7 +78,7 @@ class ChillActivityExtension extends Extension implements PrependExtensionInterf
|
|||||||
)
|
)
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function prependAuthorization(ContainerBuilder $container)
|
public function prependAuthorization(ContainerBuilder $container)
|
||||||
{
|
{
|
||||||
$container->prependExtensionConfig('security', array(
|
$container->prependExtensionConfig('security', array(
|
||||||
@ -89,4 +90,75 @@ class ChillActivityExtension extends Extension implements PrependExtensionInterf
|
|||||||
)
|
)
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function prependCruds(ContainerBuilder $container)
|
||||||
|
{
|
||||||
|
$container->prependExtensionConfig('chill_main', [
|
||||||
|
'cruds' => [
|
||||||
|
[
|
||||||
|
'class' => \Chill\ActivityBundle\Entity\ActivityType::class,
|
||||||
|
'name' => 'activity_type',
|
||||||
|
'base_path' => '/admin/activity/type',
|
||||||
|
'form_class' => \Chill\ActivityBundle\Form\ActivityTypeType::class,
|
||||||
|
'controller' => \Chill\ActivityBundle\Controller\AdminActivityTypeController::class,
|
||||||
|
'actions' => [
|
||||||
|
'index' => [
|
||||||
|
'template' => '@ChillActivity/ActivityType/index.html.twig',
|
||||||
|
'role' => 'ROLE_ADMIN'
|
||||||
|
],
|
||||||
|
'new' => [
|
||||||
|
'role' => 'ROLE_ADMIN',
|
||||||
|
'template' => '@ChillActivity/ActivityType/new.html.twig',
|
||||||
|
],
|
||||||
|
'edit' => [
|
||||||
|
'role' => 'ROLE_ADMIN',
|
||||||
|
'template' => '@ChillActivity/ActivityType/edit.html.twig',
|
||||||
|
]
|
||||||
|
]
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'class' => \Chill\ActivityBundle\Entity\ActivityTypeCategory::class,
|
||||||
|
'name' => 'activity_type_category',
|
||||||
|
'base_path' => '/admin/activity/type_category',
|
||||||
|
'form_class' => \Chill\ActivityBundle\Form\ActivityTypeCategoryType::class,
|
||||||
|
'controller' => \Chill\ActivityBundle\Controller\AdminActivityTypeCategoryController::class,
|
||||||
|
'actions' => [
|
||||||
|
'index' => [
|
||||||
|
'template' => '@ChillActivity/ActivityTypeCategory/index.html.twig',
|
||||||
|
'role' => 'ROLE_ADMIN'
|
||||||
|
],
|
||||||
|
'new' => [
|
||||||
|
'role' => 'ROLE_ADMIN',
|
||||||
|
'template' => '@ChillActivity/ActivityTypeCategory/new.html.twig',
|
||||||
|
],
|
||||||
|
'edit' => [
|
||||||
|
'role' => 'ROLE_ADMIN',
|
||||||
|
'template' => '@ChillActivity/ActivityTypeCategory/edit.html.twig',
|
||||||
|
]
|
||||||
|
]
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'class' => \Chill\ActivityBundle\Entity\ActivityPresence::class,
|
||||||
|
'name' => 'activity_presence',
|
||||||
|
'base_path' => '/admin/activity/presence',
|
||||||
|
'form_class' => \Chill\ActivityBundle\Form\ActivityPresenceType::class,
|
||||||
|
'controller' => \Chill\ActivityBundle\Controller\AdminActivityPresenceController::class,
|
||||||
|
'actions' => [
|
||||||
|
'index' => [
|
||||||
|
'template' => '@ChillActivity/ActivityPresence/index.html.twig',
|
||||||
|
'role' => 'ROLE_ADMIN'
|
||||||
|
],
|
||||||
|
'new' => [
|
||||||
|
'role' => 'ROLE_ADMIN',
|
||||||
|
'template' => '@ChillActivity/ActivityPresence/new.html.twig',
|
||||||
|
],
|
||||||
|
'edit' => [
|
||||||
|
'role' => 'ROLE_ADMIN',
|
||||||
|
'template' => '@ChillActivity/ActivityPresence/edit.html.twig',
|
||||||
|
]
|
||||||
|
]
|
||||||
|
],
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,19 +20,25 @@
|
|||||||
|
|
||||||
namespace Chill\ActivityBundle\Entity;
|
namespace Chill\ActivityBundle\Entity;
|
||||||
|
|
||||||
|
use Chill\DocStoreBundle\Entity\Document;
|
||||||
|
use Chill\DocStoreBundle\Entity\StoredObject;
|
||||||
use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable;
|
use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable;
|
||||||
|
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||||
|
use Chill\PersonBundle\Entity\SocialWork\SocialAction;
|
||||||
|
use Chill\PersonBundle\Entity\SocialWork\SocialIssue;
|
||||||
|
use Chill\ThirdPartyBundle\Entity\ThirdParty;
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
use Chill\MainBundle\Entity\Scope;
|
use Chill\MainBundle\Entity\Scope;
|
||||||
use Chill\MainBundle\Entity\User;
|
use Chill\MainBundle\Entity\User;
|
||||||
use Chill\MainBundle\Entity\Center;
|
use Chill\MainBundle\Entity\Center;
|
||||||
use Chill\ActivityBundle\Entity\ActivityReason;
|
|
||||||
use Chill\ActivityBundle\Entity\ActivityType;
|
|
||||||
use Chill\PersonBundle\Entity\Person;
|
use Chill\PersonBundle\Entity\Person;
|
||||||
use Chill\MainBundle\Entity\HasCenterInterface;
|
use Chill\MainBundle\Entity\HasCenterInterface;
|
||||||
use Chill\MainBundle\Entity\HasScopeInterface;
|
use Chill\MainBundle\Entity\HasScopeInterface;
|
||||||
use Doctrine\Common\Collections\Collection;
|
use Doctrine\Common\Collections\Collection;
|
||||||
use Doctrine\Common\Collections\ArrayCollection;
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
use Chill\MainBundle\Validator\Constraints\Entity\UserCircleConsistency;
|
use Chill\MainBundle\Validator\Constraints\Entity\UserCircleConsistency;
|
||||||
|
use Symfony\Component\Serializer\Annotation\Groups;
|
||||||
|
use Symfony\Component\Serializer\Annotation\DiscriminatorMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Activity
|
* Class Activity
|
||||||
@ -41,311 +47,513 @@ use Chill\MainBundle\Validator\Constraints\Entity\UserCircleConsistency;
|
|||||||
* @ORM\Entity(repositoryClass="Chill\ActivityBundle\Repository\ActivityRepository")
|
* @ORM\Entity(repositoryClass="Chill\ActivityBundle\Repository\ActivityRepository")
|
||||||
* @ORM\Table(name="activity")
|
* @ORM\Table(name="activity")
|
||||||
* @ORM\HasLifecycleCallbacks()
|
* @ORM\HasLifecycleCallbacks()
|
||||||
|
* @DiscriminatorMap(typeProperty="type", mapping={
|
||||||
|
* "activity"=Activity::class
|
||||||
|
* })
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* TODO : revoir
|
||||||
* @UserCircleConsistency(
|
* @UserCircleConsistency(
|
||||||
* "CHILL_ACTIVITY_SEE_DETAILS",
|
* "CHILL_ACTIVITY_SEE_DETAILS",
|
||||||
* getUserFunction="getUser",
|
* getUserFunction="getUser",
|
||||||
* path="scope")
|
* path="scope")
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class Activity implements HasCenterInterface, HasScopeInterface
|
class Activity implements HasCenterInterface, HasScopeInterface
|
||||||
{
|
{
|
||||||
|
const SENTRECEIVED_SENT = 'sent';
|
||||||
|
const SENTRECEIVED_RECEIVED = 'received';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var integer
|
|
||||||
*
|
|
||||||
* @ORM\Id
|
* @ORM\Id
|
||||||
* @ORM\Column(name="id", type="integer")
|
* @ORM\Column(name="id", type="integer")
|
||||||
* @ORM\GeneratedValue(strategy="AUTO")
|
* @ORM\GeneratedValue(strategy="AUTO")
|
||||||
|
* @Groups({"read"})
|
||||||
*/
|
*/
|
||||||
private $id;
|
private ?int $id = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var User
|
|
||||||
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\User")
|
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\User")
|
||||||
*/
|
*/
|
||||||
private $user;
|
private User $user;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var \DateTime
|
|
||||||
* @ORM\Column(type="datetime")
|
* @ORM\Column(type="datetime")
|
||||||
*/
|
*/
|
||||||
private $date;
|
private \DateTime $date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var \DateTime
|
* @ORM\Column(type="time", nullable=true)
|
||||||
* @ORM\Column(type="time")
|
|
||||||
*/
|
*/
|
||||||
private $durationTime;
|
private ?\DateTime $durationTime = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var boolean
|
* @ORM\Column(type="time", nullable=true)
|
||||||
* @ORM\Column(type="boolean")
|
|
||||||
*/
|
*/
|
||||||
private $attendee;
|
private ?\DateTime $travelTime = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\ManyToOne(targetEntity="Chill\ActivityBundle\Entity\ActivityPresence")
|
||||||
|
*/
|
||||||
|
private ?ActivityPresence $attendee = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var ActivityReason
|
|
||||||
* @ORM\ManyToMany(targetEntity="Chill\ActivityBundle\Entity\ActivityReason")
|
* @ORM\ManyToMany(targetEntity="Chill\ActivityBundle\Entity\ActivityReason")
|
||||||
*/
|
*/
|
||||||
private $reasons;
|
private Collection $reasons;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\ManyToMany(targetEntity="Chill\PersonBundle\Entity\SocialWork\SocialIssue")
|
||||||
|
* @ORM\JoinTable(name="chill_activity_activity_chill_person_socialissue")
|
||||||
|
*/
|
||||||
|
private $socialIssues;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\ManyToMany(targetEntity="Chill\PersonBundle\Entity\SocialWork\SocialAction")
|
||||||
|
* @ORM\JoinTable(name="chill_activity_activity_chill_person_socialaction")
|
||||||
|
*/
|
||||||
|
private $socialActions;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var ActivityType
|
|
||||||
* @ORM\ManyToOne(targetEntity="Chill\ActivityBundle\Entity\ActivityType")
|
* @ORM\ManyToOne(targetEntity="Chill\ActivityBundle\Entity\ActivityType")
|
||||||
*/
|
*/
|
||||||
private $type;
|
private ActivityType $type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var Scope
|
|
||||||
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Scope")
|
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Scope")
|
||||||
*/
|
*/
|
||||||
private $scope;
|
private ?Scope $scope = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var Person
|
|
||||||
* @ORM\ManyToOne(targetEntity="Chill\PersonBundle\Entity\Person")
|
* @ORM\ManyToOne(targetEntity="Chill\PersonBundle\Entity\Person")
|
||||||
*/
|
*/
|
||||||
private $person;
|
private ?Person $person = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\ManyToOne(targetEntity="Chill\PersonBundle\Entity\AccompanyingPeriod")
|
||||||
|
* @Groups({"read"})
|
||||||
|
*/
|
||||||
|
private ?AccompanyingPeriod $accompanyingPeriod = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Embedded(class="Chill\MainBundle\Entity\Embeddable\CommentEmbeddable", columnPrefix="comment_")
|
* @ORM\Embedded(class="Chill\MainBundle\Entity\Embeddable\CommentEmbeddable", columnPrefix="comment_")
|
||||||
*/
|
*/
|
||||||
private $comment;
|
private CommentEmbeddable $comment;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Activity constructor.
|
* @ORM\ManyToMany(targetEntity="Chill\PersonBundle\Entity\Person")
|
||||||
|
* @Groups({"read"})
|
||||||
*/
|
*/
|
||||||
|
private ?Collection $persons = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\ManyToMany(targetEntity="Chill\ThirdPartyBundle\Entity\ThirdParty")
|
||||||
|
* @Groups({"read"})
|
||||||
|
*/
|
||||||
|
private ?Collection $thirdParties = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\ManyToMany(targetEntity="Chill\DocStoreBundle\Entity\StoredObject")
|
||||||
|
*/
|
||||||
|
private Collection $documents;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\ManyToMany(targetEntity="Chill\MainBundle\Entity\User")
|
||||||
|
* @Groups({"read"})
|
||||||
|
*/
|
||||||
|
private ?Collection $users = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="boolean", options={"default"=false})
|
||||||
|
*/
|
||||||
|
private bool $emergency = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="string", options={"default"=""})
|
||||||
|
*/
|
||||||
|
private string $sentReceived = '';
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->reasons = new ArrayCollection();
|
$this->reasons = new ArrayCollection();
|
||||||
$this->comment = new CommentEmbeddable();
|
$this->comment = new CommentEmbeddable();
|
||||||
|
$this->persons = new ArrayCollection();
|
||||||
|
$this->thirdParties = new ArrayCollection();
|
||||||
|
$this->documents = new ArrayCollection();
|
||||||
|
$this->users = new ArrayCollection();
|
||||||
|
$this->socialIssues = new ArrayCollection();
|
||||||
|
$this->socialActions = new ArrayCollection();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function getId(): ?int
|
||||||
* Get id
|
|
||||||
*
|
|
||||||
* @return integer
|
|
||||||
*/
|
|
||||||
public function getId()
|
|
||||||
{
|
{
|
||||||
return $this->id;
|
return $this->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function setUser(User $user): self
|
||||||
* Set user
|
|
||||||
*
|
|
||||||
* @param User $user
|
|
||||||
* @return Activity
|
|
||||||
*/
|
|
||||||
public function setUser(User $user)
|
|
||||||
{
|
{
|
||||||
$this->user = $user;
|
$this->user = $user;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function getUser(): User
|
||||||
* Get user
|
|
||||||
*
|
|
||||||
* @return User
|
|
||||||
*/
|
|
||||||
public function getUser()
|
|
||||||
{
|
{
|
||||||
return $this->user;
|
return $this->user;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function setDate(\DateTime $date): self
|
||||||
* Set date
|
|
||||||
*
|
|
||||||
* @param \DateTime $date
|
|
||||||
* @return Activity
|
|
||||||
*/
|
|
||||||
public function setDate($date)
|
|
||||||
{
|
{
|
||||||
$this->date = $date;
|
$this->date = $date;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function getDate(): \DateTime
|
||||||
* Get date
|
|
||||||
*
|
|
||||||
* @return \DateTime
|
|
||||||
*/
|
|
||||||
public function getDate()
|
|
||||||
{
|
{
|
||||||
return $this->date;
|
return $this->date;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function setDurationTime(?\DateTime $durationTime): self
|
||||||
* Set durationTime
|
|
||||||
*
|
|
||||||
* @param \DateTime $durationTime
|
|
||||||
* @return Activity
|
|
||||||
*/
|
|
||||||
public function setDurationTime($durationTime)
|
|
||||||
{
|
{
|
||||||
$this->durationTime = $durationTime;
|
$this->durationTime = $durationTime;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function getDurationTime(): ?\DateTime
|
||||||
* Get durationTime
|
|
||||||
*
|
|
||||||
* @return \DateTime
|
|
||||||
*/
|
|
||||||
public function getDurationTime()
|
|
||||||
{
|
{
|
||||||
return $this->durationTime;
|
return $this->durationTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function setTravelTime(\DateTime $travelTime): self
|
||||||
* Set attendee
|
{
|
||||||
*
|
$this->travelTime = $travelTime;
|
||||||
* @param boolean $attendee
|
|
||||||
* @return Activity
|
return $this;
|
||||||
*/
|
}
|
||||||
public function setAttendee($attendee)
|
|
||||||
|
public function getTravelTime(): ?\DateTime
|
||||||
|
{
|
||||||
|
return $this->travelTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setAttendee(ActivityPresence $attendee): self
|
||||||
{
|
{
|
||||||
$this->attendee = $attendee;
|
$this->attendee = $attendee;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function getAttendee(): ?ActivityPresence
|
||||||
* Get attendee
|
|
||||||
*
|
|
||||||
* @return boolean
|
|
||||||
*/
|
|
||||||
public function getAttendee()
|
|
||||||
{
|
{
|
||||||
return $this->attendee;
|
return $this->attendee;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function addReason(ActivityReason $reason): self
|
||||||
* Add a reason
|
|
||||||
*
|
|
||||||
* @param ActivityReason $reason
|
|
||||||
* @return Activity
|
|
||||||
*/
|
|
||||||
public function addReason(ActivityReason $reason)
|
|
||||||
{
|
{
|
||||||
$this->reasons[] = $reason;
|
$this->reasons->add($reason);
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function removeReason(ActivityReason $reason): void
|
||||||
|
{
|
||||||
|
$this->reasons->removeElement($reason);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getReasons(): Collection
|
||||||
|
{
|
||||||
|
return $this->reasons;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setReasons(?ArrayCollection $reasons): self
|
||||||
|
{
|
||||||
|
$this->reasons = $reasons;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getSocialIssues(): Collection
|
||||||
|
{
|
||||||
|
return $this->socialIssues;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addSocialIssue(SocialIssue $socialIssue): self
|
||||||
|
{
|
||||||
|
if (!$this->socialIssues->contains($socialIssue)) {
|
||||||
|
$this->socialIssues[] = $socialIssue;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function removeSocialIssue(SocialIssue $socialIssue): self
|
||||||
|
{
|
||||||
|
$this->socialIssues->removeElement($socialIssue);
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param ActivityReason $reason
|
* @return Collection|SocialAction[]
|
||||||
*/
|
*/
|
||||||
public function removeReason(ActivityReason $reason)
|
public function getSocialActions(): Collection
|
||||||
{
|
{
|
||||||
$this->reasons->removeElement($reason);
|
return $this->socialActions;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function addSocialAction(SocialAction $socialAction): self
|
||||||
* Get reasons
|
|
||||||
*
|
|
||||||
* @return Collection
|
|
||||||
*/
|
|
||||||
public function getReasons()
|
|
||||||
{
|
{
|
||||||
return $this->reasons;
|
if (!$this->socialActions->contains($socialAction)) {
|
||||||
|
$this->socialActions[] = $socialAction;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function removeSocialAction(SocialAction $socialAction): self
|
||||||
* Set type
|
{
|
||||||
*
|
$this->socialActions->removeElement($socialAction);
|
||||||
* @param ActivityType $type
|
|
||||||
* @return Activity
|
return $this;
|
||||||
*/
|
}
|
||||||
public function setType(ActivityType $type)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public function setType(ActivityType $type): self
|
||||||
{
|
{
|
||||||
$this->type = $type;
|
$this->type = $type;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function getType(): ActivityType
|
||||||
* Get type
|
|
||||||
*
|
|
||||||
* @return ActivityType
|
|
||||||
*/
|
|
||||||
public function getType()
|
|
||||||
{
|
{
|
||||||
return $this->type;
|
return $this->type;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function setScope(Scope $scope): self
|
||||||
* Set scope
|
|
||||||
*
|
|
||||||
* @param Scope $scope
|
|
||||||
* @return Activity
|
|
||||||
*/
|
|
||||||
public function setScope(Scope $scope)
|
|
||||||
{
|
{
|
||||||
$this->scope = $scope;
|
$this->scope = $scope;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function getScope(): ?Scope
|
||||||
* Get scope
|
|
||||||
*
|
|
||||||
* @return Scope
|
|
||||||
*/
|
|
||||||
public function getScope()
|
|
||||||
{
|
{
|
||||||
return $this->scope;
|
return $this->scope;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function setPerson(?Person $person): self
|
||||||
* Set person
|
|
||||||
*
|
|
||||||
* @param Person $person
|
|
||||||
* @return Activity
|
|
||||||
*/
|
|
||||||
public function setPerson(Person $person)
|
|
||||||
{
|
{
|
||||||
$this->person = $person;
|
$this->person = $person;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function getPerson(): ?Person
|
||||||
* Get person
|
|
||||||
*
|
|
||||||
* @return Person
|
|
||||||
*/
|
|
||||||
public function getPerson()
|
|
||||||
{
|
{
|
||||||
return $this->person;
|
return $this->person;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getAccompanyingPeriod(): ?AccompanyingPeriod
|
||||||
|
{
|
||||||
|
return $this->accompanyingPeriod;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setAccompanyingPeriod(?AccompanyingPeriod $accompanyingPeriod): self
|
||||||
|
{
|
||||||
|
$this->accompanyingPeriod = $accompanyingPeriod;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get the center
|
* get the center
|
||||||
* center is extracted from person
|
* center is extracted from person
|
||||||
*
|
|
||||||
* @return Center
|
|
||||||
*/
|
*/
|
||||||
public function getCenter()
|
public function getCenter(): ?Center
|
||||||
{
|
{
|
||||||
return $this->person->getCenter();
|
if ($this->person instanceof Person) {
|
||||||
|
return $this->person->getCenter();
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function getComment(): CommentEmbeddable
|
||||||
* @return \Chill\MainBundle\Entity\Embeddalbe\CommentEmbeddable
|
|
||||||
*/
|
|
||||||
public function getComment()
|
|
||||||
{
|
{
|
||||||
return $this->comment;
|
return $this->comment;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function setComment(CommentEmbeddable $comment): self
|
||||||
* @param \Chill\MainBundle\Entity\Embeddalbe\CommentEmbeddable $comment
|
|
||||||
*/
|
|
||||||
public function setComment($comment)
|
|
||||||
{
|
{
|
||||||
$this->comment = $comment;
|
$this->comment = $comment;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a person to the person list
|
||||||
|
*/
|
||||||
|
public function addPerson(?Person $person): self
|
||||||
|
{
|
||||||
|
if (null !== $person) {
|
||||||
|
$this->persons[] = $person;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function removePerson(Person $person): void
|
||||||
|
{
|
||||||
|
$this->persons->removeElement($person);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPersons(): Collection
|
||||||
|
{
|
||||||
|
return $this->persons;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPersonsAssociated(): array
|
||||||
|
{
|
||||||
|
if (null !== $this->accompanyingPeriod) {
|
||||||
|
$personsAssociated = [];
|
||||||
|
foreach ($this->accompanyingPeriod->getParticipations() as $participation) {
|
||||||
|
if ($this->persons->contains($participation->getPerson())) {
|
||||||
|
$personsAssociated[] = $participation->getPerson();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $personsAssociated;
|
||||||
|
}
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPersonsNotAssociated(): array
|
||||||
|
{
|
||||||
|
if (null !== $this->accompanyingPeriod) {
|
||||||
|
$personsNotAssociated = [];
|
||||||
|
foreach ($this->persons as $person) {
|
||||||
|
if (!in_array($person, $this->getPersonsAssociated())) {
|
||||||
|
$personsNotAssociated[] = $person;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $personsNotAssociated;
|
||||||
|
}
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setPersons(?Collection $persons): self
|
||||||
|
{
|
||||||
|
$this->persons = $persons;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addThirdParty(?ThirdParty $thirdParty): self
|
||||||
|
{
|
||||||
|
if (null !== $thirdParty) {
|
||||||
|
$this->thirdParties[] = $thirdParty;
|
||||||
|
}
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function removeThirdParty(ThirdParty $thirdParty): void
|
||||||
|
{
|
||||||
|
$this->thirdParties->removeElement($thirdParty);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getThirdParties(): Collection
|
||||||
|
{
|
||||||
|
return $this->thirdParties;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setThirdParties(?Collection $thirdParties): self
|
||||||
|
{
|
||||||
|
$this->thirdParties = $thirdParties;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addDocument(Document $document): self
|
||||||
|
{
|
||||||
|
$this->documents[] = $document;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function removeDocument(Document $document): void
|
||||||
|
{
|
||||||
|
$this->documents->removeElement($document);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDocuments(): Collection
|
||||||
|
{
|
||||||
|
return $this->documents;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setDocuments(Collection $documents): self
|
||||||
|
{
|
||||||
|
$this->documents = $documents;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addUser(?User $user): self
|
||||||
|
{
|
||||||
|
if (null !== $user) {
|
||||||
|
$this->users[] = $user;
|
||||||
|
}
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function removeUser(User $user): void
|
||||||
|
{
|
||||||
|
$this->users->removeElement($user);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getUsers(): Collection
|
||||||
|
{
|
||||||
|
return $this->users;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setUsers(?Collection $users): self
|
||||||
|
{
|
||||||
|
$this->users = $users;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isEmergency(): bool
|
||||||
|
{
|
||||||
|
return $this->getEmergency();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getEmergency(): bool
|
||||||
|
{
|
||||||
|
return $this->emergency;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setEmergency(bool $emergency): self
|
||||||
|
{
|
||||||
|
$this->emergency = $emergency;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getSentReceived(): string
|
||||||
|
{
|
||||||
|
return $this->sentReceived;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setSentReceived(?string $sentReceived): self
|
||||||
|
{
|
||||||
|
$this->sentReceived = (string) $sentReceived;
|
||||||
|
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
97
src/Bundle/ChillActivityBundle/Entity/ActivityPresence.php
Normal file
97
src/Bundle/ChillActivityBundle/Entity/ActivityPresence.php
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* Copyright (C) 2015, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as
|
||||||
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Chill\ActivityBundle\Entity;
|
||||||
|
|
||||||
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class ActivityPresence
|
||||||
|
*
|
||||||
|
* @package Chill\ActivityBundle\Entity
|
||||||
|
* @ORM\Entity()
|
||||||
|
* @ORM\Table(name="activitytpresence")
|
||||||
|
* @ORM\HasLifecycleCallbacks()
|
||||||
|
*/
|
||||||
|
class ActivityPresence
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @ORM\Id
|
||||||
|
* @ORM\Column(name="id", type="integer")
|
||||||
|
* @ORM\GeneratedValue(strategy="AUTO")
|
||||||
|
*/
|
||||||
|
private ?int $id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="json")
|
||||||
|
*/
|
||||||
|
private array $name = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="boolean")
|
||||||
|
*/
|
||||||
|
private bool $active = true;
|
||||||
|
|
||||||
|
public function getId(): int
|
||||||
|
{
|
||||||
|
return $this->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setName(array $name): self
|
||||||
|
{
|
||||||
|
$this->name = $name;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getName(): array
|
||||||
|
{
|
||||||
|
return $this->name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get active
|
||||||
|
* return true if the category type is active.
|
||||||
|
*/
|
||||||
|
public function getActive(): bool
|
||||||
|
{
|
||||||
|
return $this->active;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is active
|
||||||
|
* return true if the category type is active
|
||||||
|
*/
|
||||||
|
public function isActive(): bool
|
||||||
|
{
|
||||||
|
return $this->getActive();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set active
|
||||||
|
* set to true if the category type is active
|
||||||
|
*/
|
||||||
|
public function setActive(bool $active): self
|
||||||
|
{
|
||||||
|
$this->active = $active;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
}
|
@ -1,19 +1,19 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
|
* Copyright (C) 2015, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as
|
* it under the terms of the GNU Affero General Public License as
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
* License, or (at your option) any later version.
|
* License, or (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Affero General Public License for more details.
|
* GNU Affero General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
@ -32,45 +32,239 @@ use Doctrine\ORM\Mapping as ORM;
|
|||||||
*/
|
*/
|
||||||
class ActivityType
|
class ActivityType
|
||||||
{
|
{
|
||||||
|
const FIELD_INVISIBLE = 0;
|
||||||
|
const FIELD_OPTIONAL = 1;
|
||||||
|
const FIELD_REQUIRED = 2;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var integer
|
|
||||||
*
|
|
||||||
* @ORM\Id
|
* @ORM\Id
|
||||||
* @ORM\Column(name="id", type="integer")
|
* @ORM\Column(name="id", type="integer")
|
||||||
* @ORM\GeneratedValue(strategy="AUTO")
|
* @ORM\GeneratedValue(strategy="AUTO")
|
||||||
*/
|
*/
|
||||||
private $id;
|
private ?int $id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var array
|
|
||||||
* @ORM\Column(type="json_array")
|
* @ORM\Column(type="json_array")
|
||||||
*/
|
*/
|
||||||
private $name;
|
private array $name = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var bool
|
|
||||||
* @ORM\Column(type="boolean")
|
* @ORM\Column(type="boolean")
|
||||||
*/
|
*/
|
||||||
private $active = true;
|
private bool $active = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\ManyToOne(targetEntity="Chill\ActivityBundle\Entity\ActivityTypeCategory")
|
||||||
|
*/
|
||||||
|
private ?ActivityTypeCategory $category = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="smallint", nullable=false, options={"default"=2})
|
||||||
|
*/
|
||||||
|
private int $personVisible = self::FIELD_REQUIRED;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="string", nullable=false, options={"default"=""})
|
||||||
|
*/
|
||||||
|
private string $personLabel = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="smallint", nullable=false, options={"default"=2})
|
||||||
|
*/
|
||||||
|
private int $userVisible = self::FIELD_REQUIRED;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="string", nullable=false, options={"default"=""})
|
||||||
|
*/
|
||||||
|
private string $userLabel = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="smallint", nullable=false, options={"default"=2})
|
||||||
|
*/
|
||||||
|
private int $dateVisible = self::FIELD_REQUIRED;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="string", nullable=false, options={"default"=""})
|
||||||
|
*/
|
||||||
|
private string $dateLabel = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="smallint", nullable=false, options={"default"=1})
|
||||||
|
*/
|
||||||
|
private int $placeVisible = self::FIELD_OPTIONAL;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="string", nullable=false, options={"default"=""})
|
||||||
|
*/
|
||||||
|
private string $placeLabel = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="smallint", nullable=false, options={"default"=1})
|
||||||
|
*/
|
||||||
|
private int $personsVisible = self::FIELD_OPTIONAL;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="string", nullable=false, options={"default"=""})
|
||||||
|
*/
|
||||||
|
private string $personsLabel = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="smallint", nullable=false, options={"default"=1})
|
||||||
|
*/
|
||||||
|
private int $thirdPartiesVisible = self::FIELD_INVISIBLE;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="string", nullable=false, options={"default"=""})
|
||||||
|
*/
|
||||||
|
private string $thirdPartiesLabel = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="smallint", nullable=false, options={"default"=1})
|
||||||
|
*/
|
||||||
|
private int $durationTimeVisible = self::FIELD_OPTIONAL;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="string", nullable=false, options={"default"=""})
|
||||||
|
*/
|
||||||
|
private string $durationTimeLabel = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="smallint", nullable=false, options={"default"=1})
|
||||||
|
*/
|
||||||
|
private int $travelTimeVisible = self::FIELD_OPTIONAL;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="string", nullable=false, options={"default"=""})
|
||||||
|
*/
|
||||||
|
private string $travelTimeLabel = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="smallint", nullable=false, options={"default"=1})
|
||||||
|
*/
|
||||||
|
private int $attendeeVisible = self::FIELD_OPTIONAL;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="string", nullable=false, options={"default"=""})
|
||||||
|
*/
|
||||||
|
private string $attendeeLabel = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="smallint", nullable=false, options={"default"=1})
|
||||||
|
*/
|
||||||
|
private int $reasonsVisible = self::FIELD_OPTIONAL;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="string", nullable=false, options={"default"=""})
|
||||||
|
*/
|
||||||
|
private string $reasonsLabel = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="smallint", nullable=false, options={"default"=1})
|
||||||
|
*/
|
||||||
|
private int $commentVisible = self::FIELD_OPTIONAL;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="string", nullable=false, options={"default"=""})
|
||||||
|
*/
|
||||||
|
private string $commentLabel = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="smallint", nullable=false, options={"default"=1})
|
||||||
|
*/
|
||||||
|
private int $sentReceivedVisible = self::FIELD_OPTIONAL;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="string", nullable=false, options={"default"=""})
|
||||||
|
*/
|
||||||
|
private string $sentReceivedLabel = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="smallint", nullable=false, options={"default"=1})
|
||||||
|
*/
|
||||||
|
private int $documentsVisible = self::FIELD_OPTIONAL;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="string", nullable=false, options={"default"=""})
|
||||||
|
*/
|
||||||
|
private string $documentsLabel = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="smallint", nullable=false, options={"default"=1})
|
||||||
|
*/
|
||||||
|
private int $usersVisible = self::FIELD_OPTIONAL;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="string", nullable=false, options={"default"=""})
|
||||||
|
*/
|
||||||
|
private string $usersLabel = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="smallint", nullable=false, options={"default"=1})
|
||||||
|
*/
|
||||||
|
private int $emergencyVisible = self::FIELD_INVISIBLE;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="string", nullable=false, options={"default"=""})
|
||||||
|
*/
|
||||||
|
private string $emergencyLabel = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="smallint", nullable=false, options={"default"=1})
|
||||||
|
*/
|
||||||
|
private int $accompanyingPeriodVisible = self::FIELD_INVISIBLE;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="string", nullable=false, options={"default"=""})
|
||||||
|
*/
|
||||||
|
private string $accompanyingPeriodLabel = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="smallint", nullable=false, options={"default"=1})
|
||||||
|
*/
|
||||||
|
private int $socialDataVisible = self::FIELD_INVISIBLE;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="string", nullable=false, options={"default"=""})
|
||||||
|
*/
|
||||||
|
private string $socialDataLabel = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="smallint", nullable=false, options={"default"=1})
|
||||||
|
*/
|
||||||
|
private int $socialIssuesVisible = self::FIELD_INVISIBLE;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="string", nullable=false, options={"default"=""})
|
||||||
|
*/
|
||||||
|
private string $socialIssuesLabel = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="smallint", nullable=false, options={"default"=1})
|
||||||
|
*/
|
||||||
|
private int $socialActionsVisible = self::FIELD_INVISIBLE;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="string", nullable=false, options={"default"=""})
|
||||||
|
*/
|
||||||
|
private string $socialActionsLabel = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="float", options={"default"="0.0"})
|
||||||
|
*/
|
||||||
|
private float $ordering = 0.0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get id
|
* Get id
|
||||||
*
|
|
||||||
* @return integer
|
|
||||||
*/
|
*/
|
||||||
public function getId()
|
public function getId(): int
|
||||||
{
|
{
|
||||||
return $this->id;
|
return $this->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set name
|
* Set name
|
||||||
*
|
|
||||||
* @param array $name
|
|
||||||
* @return ActivityType
|
|
||||||
*/
|
*/
|
||||||
public function setName($name)
|
public function setName(array $name): self
|
||||||
{
|
{
|
||||||
$this->name = $name;
|
$this->name = $name;
|
||||||
|
|
||||||
@ -79,58 +273,551 @@ class ActivityType
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get name
|
* Get name
|
||||||
*
|
|
||||||
* @return array | string
|
|
||||||
*/
|
*/
|
||||||
public function getName($locale = null)
|
public function getName(): array
|
||||||
{
|
{
|
||||||
if ($locale) {
|
return $this->name;
|
||||||
if (isset($this->name[$locale])) {
|
|
||||||
return $this->name[$locale];
|
|
||||||
} else {
|
|
||||||
foreach ($this->name as $name) {
|
|
||||||
if (!empty($name)) {
|
|
||||||
return $name;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return '';
|
|
||||||
} else {
|
|
||||||
return $this->name;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get active
|
* Get active
|
||||||
* return true if the type is active.
|
* return true if the type is active.
|
||||||
*
|
|
||||||
* @return boolean
|
|
||||||
*/
|
*/
|
||||||
public function getActive() {
|
public function getActive(): bool
|
||||||
|
{
|
||||||
return $this->active;
|
return $this->active;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is active
|
* Is active
|
||||||
* return true if the type is active
|
* return true if the type is active
|
||||||
*
|
|
||||||
* @return boolean
|
|
||||||
*/
|
*/
|
||||||
public function isActive() {
|
public function isActive(): bool
|
||||||
|
{
|
||||||
return $this->getActive();
|
return $this->getActive();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set active
|
* Set active
|
||||||
* set to true if the type is active
|
* set to true if the type is active
|
||||||
*
|
|
||||||
* @param boolean $active
|
|
||||||
* @return ActivityType
|
|
||||||
*/
|
*/
|
||||||
public function setActive($active) {
|
public function setActive(bool $active): self
|
||||||
|
{
|
||||||
$this->active = $active;
|
$this->active = $active;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
public function getCategory(): ?ActivityTypeCategory
|
||||||
|
{
|
||||||
|
return $this->category;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setCategory(?ActivityTypeCategory $category): self
|
||||||
|
{
|
||||||
|
$this->category = $category;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPersonVisible(): int
|
||||||
|
{
|
||||||
|
return $this->personVisible;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setPersonVisible(int $personVisible): self
|
||||||
|
{
|
||||||
|
$this->personVisible = $personVisible;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPersonLabel(): string
|
||||||
|
{
|
||||||
|
return $this->personLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setPersonLabel(string $personLabel): self
|
||||||
|
{
|
||||||
|
$this->personLabel = $personLabel;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getUserVisible(): int
|
||||||
|
{
|
||||||
|
return $this->userVisible;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setUserVisible(int $userVisible): self
|
||||||
|
{
|
||||||
|
$this->userVisible = $userVisible;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getUserLabel(): string
|
||||||
|
{
|
||||||
|
return $this->userLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setUserLabel(string $userLabel): self
|
||||||
|
{
|
||||||
|
$this->userLabel = $userLabel;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDateVisible(): int
|
||||||
|
{
|
||||||
|
return $this->dateVisible;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setDateVisible(int $dateVisible): self
|
||||||
|
{
|
||||||
|
$this->dateVisible = $dateVisible;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDateLabel(): string
|
||||||
|
{
|
||||||
|
return $this->dateLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setDateLabel(string $dateLabel): self
|
||||||
|
{
|
||||||
|
$this->dateLabel = $dateLabel;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPlaceVisible(): int
|
||||||
|
{
|
||||||
|
return $this->placeVisible;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setPlaceVisible(int $placeVisible): self
|
||||||
|
{
|
||||||
|
$this->placeVisible = $placeVisible;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPlaceLabel(): string
|
||||||
|
{
|
||||||
|
return $this->placeLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setPlaceLabel(string $placeLabel): self
|
||||||
|
{
|
||||||
|
$this->placeLabel = $placeLabel;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPersonsVisible(): int
|
||||||
|
{
|
||||||
|
return $this->personsVisible;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setPersonsVisible(int $personsVisible): self
|
||||||
|
{
|
||||||
|
$this->personsVisible = $personsVisible;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPersonsLabel(): string
|
||||||
|
{
|
||||||
|
return $this->personsLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setPersonsLabel(string $personsLabel): self
|
||||||
|
{
|
||||||
|
$this->personsLabel = $personsLabel;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getThirdPartiesVisible(): int
|
||||||
|
{
|
||||||
|
return $this->thirdPartiesVisible;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setThirdPartiesVisible(int $thirdPartiesVisible): self
|
||||||
|
{
|
||||||
|
$this->thirdPartiesVisible = $thirdPartiesVisible;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getThirdPartiesLabel(): string
|
||||||
|
{
|
||||||
|
return $this->thirdPartiesLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setThirdPartiesLabel(string $thirdPartiesLabel): self
|
||||||
|
{
|
||||||
|
$this->thirdPartiesLabel = $thirdPartiesLabel;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDurationTimeVisible(): int
|
||||||
|
{
|
||||||
|
return $this->durationTimeVisible;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setDurationTimeVisible(int $durationTimeVisible): self
|
||||||
|
{
|
||||||
|
$this->durationTimeVisible = $durationTimeVisible;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDurationTimeLabel(): string
|
||||||
|
{
|
||||||
|
return $this->durationTimeLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setDurationTimeLabel(string $durationTimeLabel): self
|
||||||
|
{
|
||||||
|
$this->durationTimeLabel = $durationTimeLabel;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTravelTimeVisible(): int
|
||||||
|
{
|
||||||
|
return $this->travelTimeVisible;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setTravelTimeVisible(int $TravelTimeVisible): self
|
||||||
|
{
|
||||||
|
$this->travelTimeVisible = $TravelTimeVisible;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTravelTimeLabel(): string
|
||||||
|
{
|
||||||
|
return $this->travelTimeLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setTravelTimeLabel(string $TravelTimeLabel): self
|
||||||
|
{
|
||||||
|
$this->travelTimeLabel = $TravelTimeLabel;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getAttendeeVisible(): int
|
||||||
|
{
|
||||||
|
return $this->attendeeVisible;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setAttendeeVisible(int $attendeeVisible): self
|
||||||
|
{
|
||||||
|
$this->attendeeVisible = $attendeeVisible;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getAttendeeLabel(): string
|
||||||
|
{
|
||||||
|
return $this->attendeeLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setAttendeeLabel(string $attendeeLabel): self
|
||||||
|
{
|
||||||
|
$this->attendeeLabel = $attendeeLabel;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getReasonsVisible(): int
|
||||||
|
{
|
||||||
|
return $this->reasonsVisible;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setReasonsVisible(int $reasonsVisible): self
|
||||||
|
{
|
||||||
|
$this->reasonsVisible = $reasonsVisible;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getReasonsLabel(): string
|
||||||
|
{
|
||||||
|
return $this->reasonsLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setReasonsLabel(string $reasonsLabel): self
|
||||||
|
{
|
||||||
|
$this->reasonsLabel = $reasonsLabel;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCommentVisible(): int
|
||||||
|
{
|
||||||
|
return $this->commentVisible;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setCommentVisible(int $commentVisible): self
|
||||||
|
{
|
||||||
|
$this->commentVisible = $commentVisible;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCommentLabel(): string
|
||||||
|
{
|
||||||
|
return $this->commentLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setCommentLabel(string $commentLabel): self
|
||||||
|
{
|
||||||
|
$this->commentLabel = $commentLabel;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getSentReceivedVisible(): int
|
||||||
|
{
|
||||||
|
return $this->sentReceivedVisible;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setSentReceivedVisible(int $sentReceivedVisible): self
|
||||||
|
{
|
||||||
|
$this->sentReceivedVisible = $sentReceivedVisible;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getSentReceivedLabel(): string
|
||||||
|
{
|
||||||
|
return $this->sentReceivedLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setSentReceivedLabel(string $sentReceivedLabel): self
|
||||||
|
{
|
||||||
|
$this->sentReceivedLabel = $sentReceivedLabel;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDocumentsVisible(): int
|
||||||
|
{
|
||||||
|
return $this->documentsVisible;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setDocumentsVisible(int $documentsVisible): self
|
||||||
|
{
|
||||||
|
$this->documentsVisible = $documentsVisible;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDocumentsLabel(): string
|
||||||
|
{
|
||||||
|
return $this->documentsLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setDocumentsLabel(string $documentsLabel): self
|
||||||
|
{
|
||||||
|
$this->documentsLabel = $documentsLabel;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getUsersVisible(): int
|
||||||
|
{
|
||||||
|
return $this->usersVisible;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setUsersVisible(int $usersVisible): self
|
||||||
|
{
|
||||||
|
$this->usersVisible = $usersVisible;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getUsersLabel(): string
|
||||||
|
{
|
||||||
|
return $this->usersLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setUsersLabel(string $usersLabel): self
|
||||||
|
{
|
||||||
|
$this->usersLabel = $usersLabel;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getEmergencyVisible(): int
|
||||||
|
{
|
||||||
|
return $this->emergencyVisible;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setEmergencyVisible(int $emergencyVisible): self
|
||||||
|
{
|
||||||
|
$this->emergencyVisible = $emergencyVisible;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getEmergencyLabel(): string
|
||||||
|
{
|
||||||
|
return $this->emergencyLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setEmergencyLabel(string $emergencyLabel): self
|
||||||
|
{
|
||||||
|
$this->emergencyLabel = $emergencyLabel;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getAccompanyingPeriodVisible(): int
|
||||||
|
{
|
||||||
|
return $this->accompanyingPeriodVisible;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setAccompanyingPeriodVisible(int $accompanyingPeriodVisible): self
|
||||||
|
{
|
||||||
|
$this->accompanyingPeriodVisible = $accompanyingPeriodVisible;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getAccompanyingPeriodLabel(): string
|
||||||
|
{
|
||||||
|
return $this->accompanyingPeriodLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setAccompanyingPeriodLabel(string $accompanyingPeriodLabel): self
|
||||||
|
{
|
||||||
|
$this->accompanyingPeriodLabel = $accompanyingPeriodLabel;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getSocialDataVisible(): int
|
||||||
|
{
|
||||||
|
return $this->socialDataVisible;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setSocialDataVisible(int $socialDataVisible): self
|
||||||
|
{
|
||||||
|
$this->socialDataVisible = $socialDataVisible;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getSocialDataLabel(): string
|
||||||
|
{
|
||||||
|
return $this->socialDataLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setSocialDataLabel(string $socialDataLabel): self
|
||||||
|
{
|
||||||
|
$this->socialDataLabel = $socialDataLabel;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isVisible(string $field): bool
|
||||||
|
{
|
||||||
|
$property = $field.'Visible';
|
||||||
|
|
||||||
|
if (!property_exists($this, $property)) {
|
||||||
|
throw new \InvalidArgumentException('Field "'.$field.'" not found');
|
||||||
|
}
|
||||||
|
|
||||||
|
return self::FIELD_INVISIBLE !== $this->$property;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isRequired(string $field): bool
|
||||||
|
{
|
||||||
|
$property = $field.'Visible';
|
||||||
|
|
||||||
|
if (!property_exists($this, $property)) {
|
||||||
|
throw new \InvalidArgumentException('Field "'.$field.'" not found');
|
||||||
|
}
|
||||||
|
|
||||||
|
return self::FIELD_REQUIRED === $this->$property;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getLabel(string $field): ?string
|
||||||
|
{
|
||||||
|
$property = $field.'Label';
|
||||||
|
|
||||||
|
if (!property_exists($this, $property)) {
|
||||||
|
throw new \InvalidArgumentException('Field "'.$field.'" not found');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->$property;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getOrdering(): float
|
||||||
|
{
|
||||||
|
return $this->ordering;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setOrdering(float $ordering): self
|
||||||
|
{
|
||||||
|
$this->ordering = $ordering;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getSocialIssuesVisible(): ?int
|
||||||
|
{
|
||||||
|
return $this->socialIssuesVisible;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setSocialIssuesVisible(int $socialIssuesVisible): self
|
||||||
|
{
|
||||||
|
$this->socialIssuesVisible = $socialIssuesVisible;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getSocialIssuesLabel(): ?string
|
||||||
|
{
|
||||||
|
return $this->socialIssuesLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setSocialIssuesLabel(string $socialIssuesLabel): self
|
||||||
|
{
|
||||||
|
$this->socialIssuesLabel = $socialIssuesLabel;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getSocialActionsVisible(): ?int
|
||||||
|
{
|
||||||
|
return $this->socialActionsVisible;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setSocialActionsVisible(int $socialActionsVisible): self
|
||||||
|
{
|
||||||
|
$this->socialActionsVisible = $socialActionsVisible;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getSocialActionsLabel(): ?string
|
||||||
|
{
|
||||||
|
return $this->socialActionsLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setSocialActionsLabel(string $socialActionsLabel): self
|
||||||
|
{
|
||||||
|
$this->socialActionsLabel = $socialActionsLabel;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
123
src/Bundle/ChillActivityBundle/Entity/ActivityTypeCategory.php
Normal file
123
src/Bundle/ChillActivityBundle/Entity/ActivityTypeCategory.php
Normal file
@ -0,0 +1,123 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* Copyright (C) 2015, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as
|
||||||
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Chill\ActivityBundle\Entity;
|
||||||
|
|
||||||
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class ActivityTypeCateogry
|
||||||
|
*
|
||||||
|
* @package Chill\ActivityBundle\Entity
|
||||||
|
* @ORM\Entity()
|
||||||
|
* @ORM\Table(name="activitytypecategory")
|
||||||
|
* @ORM\HasLifecycleCallbacks()
|
||||||
|
*/
|
||||||
|
class ActivityTypeCategory
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @ORM\Id
|
||||||
|
* @ORM\Column(name="id", type="integer")
|
||||||
|
* @ORM\GeneratedValue(strategy="AUTO")
|
||||||
|
*/
|
||||||
|
private ?int $id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="json_array")
|
||||||
|
*/
|
||||||
|
private array $name = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="boolean")
|
||||||
|
*/
|
||||||
|
private bool $active = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="float", options={"default"="0.0"})
|
||||||
|
*/
|
||||||
|
private float $ordering = 0.0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get id
|
||||||
|
*/
|
||||||
|
public function getId(): int
|
||||||
|
{
|
||||||
|
return $this->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set name
|
||||||
|
*/
|
||||||
|
public function setName(array $name): self
|
||||||
|
{
|
||||||
|
$this->name = $name;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get name
|
||||||
|
*/
|
||||||
|
public function getName(): array
|
||||||
|
{
|
||||||
|
return $this->name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get active
|
||||||
|
* return true if the category type is active.
|
||||||
|
*/
|
||||||
|
public function getActive(): bool
|
||||||
|
{
|
||||||
|
return $this->active;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is active
|
||||||
|
* return true if the category type is active
|
||||||
|
*/
|
||||||
|
public function isActive(): bool
|
||||||
|
{
|
||||||
|
return $this->getActive();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set active
|
||||||
|
* set to true if the category type is active
|
||||||
|
*/
|
||||||
|
public function setActive(bool $active): self
|
||||||
|
{
|
||||||
|
$this->active = $active;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getOrdering(): float
|
||||||
|
{
|
||||||
|
return $this->ordering;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setOrdering(float $ordering): self
|
||||||
|
{
|
||||||
|
$this->ordering = $ordering;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
}
|
33
src/Bundle/ChillActivityBundle/Form/ActivityPresenceType.php
Normal file
33
src/Bundle/ChillActivityBundle/Form/ActivityPresenceType.php
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Chill\ActivityBundle\Form;
|
||||||
|
|
||||||
|
use Chill\ActivityBundle\Entity\ActivityPresence;
|
||||||
|
use Symfony\Component\Form\AbstractType;
|
||||||
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||||
|
use Chill\MainBundle\Form\Type\TranslatableStringFormType;
|
||||||
|
|
||||||
|
class ActivityPresenceType extends AbstractType
|
||||||
|
{
|
||||||
|
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||||
|
{
|
||||||
|
$builder
|
||||||
|
->add('name', TranslatableStringFormType::class)
|
||||||
|
->add('active', ChoiceType::class, array(
|
||||||
|
'choices' => array(
|
||||||
|
'Yes' => true,
|
||||||
|
'No' => false
|
||||||
|
),
|
||||||
|
'expanded' => true
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function configureOptions(OptionsResolver $resolver): void
|
||||||
|
{
|
||||||
|
$resolver->setDefaults(array(
|
||||||
|
'data_class' => ActivityPresence::class
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
@ -2,8 +2,21 @@
|
|||||||
|
|
||||||
namespace Chill\ActivityBundle\Form;
|
namespace Chill\ActivityBundle\Form;
|
||||||
|
|
||||||
|
use Chill\ActivityBundle\Entity\Activity;
|
||||||
|
use Chill\ActivityBundle\Entity\ActivityPresence;
|
||||||
|
use Chill\ActivityBundle\Entity\ActivityReason;
|
||||||
|
use Chill\DocStoreBundle\Form\StoredObjectType;
|
||||||
|
use Chill\MainBundle\Form\Type\ChillCollectionType;
|
||||||
use Chill\MainBundle\Form\Type\CommentType;
|
use Chill\MainBundle\Form\Type\CommentType;
|
||||||
|
use Chill\PersonBundle\Entity\Person;
|
||||||
|
use Chill\PersonBundle\Entity\SocialWork\SocialIssue;
|
||||||
|
use Chill\PersonBundle\Entity\SocialWork\SocialAction;
|
||||||
|
use Chill\ThirdPartyBundle\Entity\ThirdParty;
|
||||||
|
use Doctrine\ORM\EntityRepository;
|
||||||
|
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||||
use Symfony\Component\Form\AbstractType;
|
use Symfony\Component\Form\AbstractType;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\CollectionType;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||||
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
|
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
|
||||||
@ -15,178 +28,341 @@ use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToTimestampTra
|
|||||||
use Symfony\Component\Form\FormEvent;
|
use Symfony\Component\Form\FormEvent;
|
||||||
use Symfony\Component\Form\FormEvents;
|
use Symfony\Component\Form\FormEvents;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||||
use Chill\ActivityBundle\Form\Type\TranslatableActivityType;
|
|
||||||
use Chill\ActivityBundle\Form\Type\TranslatableActivityReason;
|
|
||||||
use Chill\MainBundle\Form\Type\UserPickerType;
|
use Chill\MainBundle\Form\Type\UserPickerType;
|
||||||
use Chill\MainBundle\Form\Type\ScopePickerType;
|
use Chill\MainBundle\Form\Type\ScopePickerType;
|
||||||
use Chill\MainBundle\Form\Type\ChillDateType;
|
use Chill\MainBundle\Form\Type\ChillDateType;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
|
||||||
|
use Symfony\Component\Form\CallbackTransformer;
|
||||||
|
use Chill\PersonBundle\Form\DataTransformer\PersonToIdTransformer;
|
||||||
|
use Chill\PersonBundle\Templating\Entity\SocialIssueRender;
|
||||||
|
|
||||||
class ActivityType extends AbstractType
|
class ActivityType extends AbstractType
|
||||||
{
|
{
|
||||||
|
protected User $user;
|
||||||
|
|
||||||
/**
|
protected AuthorizationHelper $authorizationHelper;
|
||||||
* the user running this form
|
|
||||||
*
|
|
||||||
* @var User
|
|
||||||
*/
|
|
||||||
protected $user;
|
|
||||||
|
|
||||||
/**
|
protected ObjectManager $om;
|
||||||
*
|
|
||||||
* @var AuthorizationHelper
|
|
||||||
*/
|
|
||||||
protected $authorizationHelper;
|
|
||||||
|
|
||||||
/**
|
protected TranslatableStringHelper $translatableStringHelper;
|
||||||
*
|
|
||||||
* @var ObjectManager
|
|
||||||
*/
|
|
||||||
protected $om;
|
|
||||||
|
|
||||||
/**
|
protected array $timeChoices;
|
||||||
*
|
|
||||||
* @var TranslatableStringHelper
|
|
||||||
*/
|
|
||||||
protected $translatableStringHelper;
|
|
||||||
|
|
||||||
protected $timeChoices;
|
public function __construct (
|
||||||
|
TokenStorageInterface $tokenStorage,
|
||||||
public function __construct(
|
AuthorizationHelper $authorizationHelper,
|
||||||
TokenStorageInterface $tokenStorage,
|
ObjectManager $om,
|
||||||
AuthorizationHelper $authorizationHelper, ObjectManager $om,
|
TranslatableStringHelper $translatableStringHelper,
|
||||||
TranslatableStringHelper $translatableStringHelper,
|
array $timeChoices,
|
||||||
array $timeChoices
|
SocialIssueRender $socialIssueRender
|
||||||
)
|
) {
|
||||||
{
|
|
||||||
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");
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->user = $tokenStorage->getToken()->getUser();
|
$this->user = $tokenStorage->getToken()->getUser();
|
||||||
$this->authorizationHelper = $authorizationHelper;
|
$this->authorizationHelper = $authorizationHelper;
|
||||||
$this->om = $om;
|
$this->om = $om;
|
||||||
$this->translatableStringHelper = $translatableStringHelper;
|
$this->translatableStringHelper = $translatableStringHelper;
|
||||||
$this->timeChoices = $timeChoices;
|
$this->timeChoices = $timeChoices;
|
||||||
|
$this->socialIssueRender = $socialIssueRender;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||||
* @param FormBuilderInterface $builder
|
|
||||||
* @param array $options
|
|
||||||
*/
|
|
||||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
|
||||||
{
|
{
|
||||||
// handle times choices
|
// handle times choices
|
||||||
$timeChoices = array();
|
$timeChoices = [];
|
||||||
|
|
||||||
foreach ($this->timeChoices as $e) {
|
foreach ($this->timeChoices as $e) {
|
||||||
$timeChoices[$e['label']] = $e['seconds'];
|
$timeChoices[$e['label']] = $e['seconds'];
|
||||||
};
|
}
|
||||||
|
|
||||||
$durationTimeTransformer = new DateTimeToTimestampTransformer('GMT', 'GMT');
|
$durationTimeTransformer = new DateTimeToTimestampTransformer('GMT', 'GMT');
|
||||||
$durationTimeOptions = array(
|
$durationTimeOptions = [
|
||||||
'choices' => $timeChoices,
|
'choices' => $timeChoices,
|
||||||
'placeholder' => 'Choose the duration',
|
'placeholder' => 'Choose the duration',
|
||||||
);
|
];
|
||||||
|
|
||||||
$builder
|
/** @var \Chill\ActivityBundle\Entity\ActivityType $activityType */
|
||||||
->add('date', ChillDateType::class, array(
|
$activityType = $options['activityType'];
|
||||||
'required' => true
|
|
||||||
))
|
if (!$activityType->isActive()) {
|
||||||
->add('durationTime', ChoiceType::class, $durationTimeOptions)
|
throw new \InvalidArgumentException('Activity type must be active');
|
||||||
->add('attendee', ChoiceType::class, array(
|
}
|
||||||
'expanded' => true,
|
|
||||||
'required' => false,
|
// TODO revoir la gestion des center au niveau du form des activité.
|
||||||
'choices' => array(
|
if ($options['center']) {
|
||||||
'present' => true,
|
$builder->add('scope', ScopePickerType::class, [
|
||||||
'not present' => false
|
|
||||||
)
|
|
||||||
))
|
|
||||||
->add('user', UserPickerType::class, [
|
|
||||||
'center' => $options['center'],
|
'center' => $options['center'],
|
||||||
'role' => $options['role']
|
'role' => $options['role']
|
||||||
])
|
]);
|
||||||
->add('scope', ScopePickerType::class, [
|
}
|
||||||
'center' => $options['center'],
|
|
||||||
'role' => $options['role']
|
/** @var ? \Chill\PersonBundle\Entity\AccompanyingPeriod $accompanyingPeriod */
|
||||||
])
|
$accompanyingPeriod = NULL;
|
||||||
->add('reasons', TranslatableActivityReason::class, array(
|
if ($options['accompanyingPeriod']) {
|
||||||
|
$accompanyingPeriod = $options['accompanyingPeriod'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($activityType->isVisible('socialIssues') && $accompanyingPeriod) {
|
||||||
|
$builder->add('socialIssues', EntityType::class, [
|
||||||
|
'label' => $activityType->getLabel('socialIssues'),
|
||||||
|
'required' => $activityType->isRequired('socialIssues'),
|
||||||
|
'class' => SocialIssue::class,
|
||||||
|
'choice_label' => function (SocialIssue $socialIssue) {
|
||||||
|
return $this->socialIssueRender->renderString($socialIssue, []);
|
||||||
|
},
|
||||||
'multiple' => true,
|
'multiple' => true,
|
||||||
'required' => false,
|
'choices' => $accompanyingPeriod->getRecursiveSocialIssues(),
|
||||||
))
|
'expanded' => true,
|
||||||
->add('type', TranslatableActivityType::class, array(
|
]);
|
||||||
'placeholder' => 'Choose a type',
|
}
|
||||||
'active_only' => true
|
|
||||||
))
|
|
||||||
->add('comment', CommentType::class, [
|
|
||||||
'required' => false,
|
|
||||||
])
|
|
||||||
;
|
|
||||||
|
|
||||||
$builder->get('durationTime')
|
if ($activityType->isVisible('socialActions') && $accompanyingPeriod) {
|
||||||
|
$builder->add('socialActions', EntityType::class, [
|
||||||
|
'label' => $activityType->getLabel('socialActions'),
|
||||||
|
'required' => $activityType->isRequired('socialActions'),
|
||||||
|
'class' => SocialAction::class,
|
||||||
|
'choice_label' => function (SocialAction $socialAction) {
|
||||||
|
return $this->translatableStringHelper->localize($socialAction->getTitle());
|
||||||
|
},
|
||||||
|
'multiple' => true,
|
||||||
|
'choices' => $accompanyingPeriod->getRecursiveSocialActions(),
|
||||||
|
'expanded' => true,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($activityType->isVisible('date')) {
|
||||||
|
$builder->add('date', ChillDateType::class, [
|
||||||
|
'label' => $activityType->getLabel('date'),
|
||||||
|
'required' => $activityType->isRequired('date'),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($activityType->isVisible('durationTime')) {
|
||||||
|
$durationTimeOptions['label'] = $activityType->getLabel('durationTime');
|
||||||
|
$durationTimeOptions['required'] = $activityType->isRequired('durationTime');
|
||||||
|
|
||||||
|
$builder->add('durationTime', ChoiceType::class, $durationTimeOptions);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($activityType->isVisible('travelTime')) {
|
||||||
|
$durationTimeOptions['label'] = $activityType->getLabel('travelTime');
|
||||||
|
$durationTimeOptions['required'] = $activityType->isRequired('travelTime');
|
||||||
|
|
||||||
|
$builder->add('travelTime', ChoiceType::class, $durationTimeOptions);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($activityType->isVisible('attendee')) {
|
||||||
|
$builder->add('attendee', EntityType::class, [
|
||||||
|
'label' => $activityType->getLabel('attendee'),
|
||||||
|
'required' => $activityType->isRequired('attendee'),
|
||||||
|
'expanded' => true,
|
||||||
|
'class' => ActivityPresence::class,
|
||||||
|
'choice_label' => function (ActivityPresence $activityPresence) {
|
||||||
|
return $this->translatableStringHelper->localize($activityPresence->getName());
|
||||||
|
},
|
||||||
|
'query_builder' => function (EntityRepository $er) {
|
||||||
|
return $er->createQueryBuilder('a')
|
||||||
|
->where('a.active = true');
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($activityType->isVisible('user') && $options['center']) {
|
||||||
|
$builder->add('user', UserPickerType::class, [
|
||||||
|
'label' => $activityType->getLabel('user'),
|
||||||
|
'required' => $activityType->isRequired('user'),
|
||||||
|
'center' => $options['center'],
|
||||||
|
'role' => $options['role']
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($activityType->isVisible('reasons')) {
|
||||||
|
$builder->add('reasons', EntityType::class, [
|
||||||
|
'label' => $activityType->getLabel('reasons'),
|
||||||
|
'required' => $activityType->isRequired('reasons'),
|
||||||
|
'class' => ActivityReason::class,
|
||||||
|
'multiple' => true,
|
||||||
|
'choice_label' => function (ActivityReason $activityReason) {
|
||||||
|
return $this->translatableStringHelper->localize($activityReason->getName());
|
||||||
|
},
|
||||||
|
'attr' => array('class' => 'select2 '),
|
||||||
|
'query_builder' => function (EntityRepository $er) {
|
||||||
|
return $er->createQueryBuilder('a')
|
||||||
|
->where('a.active = true');
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($activityType->isVisible('comment')) {
|
||||||
|
$builder->add('comment', CommentType::class, [
|
||||||
|
'label' => $activityType->getLabel('comment'),
|
||||||
|
'required' => $activityType->isRequired('comment'),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($activityType->isVisible('persons')) {
|
||||||
|
$builder->add('persons', HiddenType::class, [
|
||||||
|
//'data_class' => Person::class,
|
||||||
|
]);
|
||||||
|
$builder->get('persons')
|
||||||
|
->addModelTransformer(new CallbackTransformer(
|
||||||
|
function (iterable $personsAsIterable): string {
|
||||||
|
$personIds = [];
|
||||||
|
foreach ($personsAsIterable as $value) {
|
||||||
|
$personIds[] = $value->getId();
|
||||||
|
}
|
||||||
|
return implode(',', $personIds);
|
||||||
|
},
|
||||||
|
function (?string $personsAsString): array {
|
||||||
|
return array_map(
|
||||||
|
fn(string $id): ?Person => $this->om->getRepository(Person::class)->findOneBy(['id' => (int) $id]),
|
||||||
|
explode(',', $personsAsString)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
))
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($activityType->isVisible('thirdParties')) {
|
||||||
|
$builder->add('thirdParties', HiddenType::class, [
|
||||||
|
//'data_class' => ThirdParty::class,
|
||||||
|
]);
|
||||||
|
$builder->get('thirdParties')
|
||||||
|
->addModelTransformer(new CallbackTransformer(
|
||||||
|
function (iterable $thirdpartyAsIterable): string {
|
||||||
|
$thirdpartyIds = [];
|
||||||
|
foreach ($thirdpartyAsIterable as $value) {
|
||||||
|
$thirdpartyIds[] = $value->getId();
|
||||||
|
}
|
||||||
|
return implode(',', $thirdpartyIds);
|
||||||
|
},
|
||||||
|
function (?string $thirdpartyAsString): array {
|
||||||
|
return array_map(
|
||||||
|
fn(string $id): ?ThirdParty => $this->om->getRepository(ThirdParty::class)->findOneBy(['id' => (int) $id]),
|
||||||
|
explode(',', $thirdpartyAsString)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
))
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($activityType->isVisible('documents')) {
|
||||||
|
$builder->add('documents', ChillCollectionType::class, [
|
||||||
|
'entry_type' => StoredObjectType::class,
|
||||||
|
'label' => $activityType->getLabel('documents'),
|
||||||
|
'required' => $activityType->isRequired('documents'),
|
||||||
|
'allow_add' => true,
|
||||||
|
'button_add_label' => 'activity.Insert a document',
|
||||||
|
'button_remove_label' => 'activity.Remove a document'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($activityType->isVisible('users')) {
|
||||||
|
$builder->add('users', HiddenType::class, [
|
||||||
|
//'data_class' => User::class,
|
||||||
|
]);
|
||||||
|
$builder->get('users')
|
||||||
|
->addModelTransformer(new CallbackTransformer(
|
||||||
|
function (iterable $usersAsIterable): string {
|
||||||
|
$userIds = [];
|
||||||
|
foreach ($usersAsIterable as $value) {
|
||||||
|
$userIds[] = $value->getId();
|
||||||
|
}
|
||||||
|
return implode(',', $userIds);
|
||||||
|
},
|
||||||
|
function (?string $usersAsString): array {
|
||||||
|
return array_map(
|
||||||
|
fn(string $id): ?User => $this->om->getRepository(User::class)->findOneBy(['id' => (int) $id]),
|
||||||
|
explode(',', $usersAsString)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
))
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($activityType->isVisible('emergency')) {
|
||||||
|
$builder->add('emergency', CheckboxType::class, [
|
||||||
|
'label' => $activityType->getLabel('emergency'),
|
||||||
|
'required' => $activityType->isRequired('emergency'),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($activityType->isVisible('sentReceived')) {
|
||||||
|
$builder->add('sentReceived', ChoiceType::class, [
|
||||||
|
'label' => $activityType->getLabel('sentReceived'),
|
||||||
|
'required' => $activityType->isRequired('sentReceived'),
|
||||||
|
'choices' => [
|
||||||
|
'Sent' => Activity::SENTRECEIVED_SENT,
|
||||||
|
'Received' => Activity::SENTRECEIVED_RECEIVED,
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (['durationTime', 'travelTime'] as $fieldName) {
|
||||||
|
if (!$activityType->isVisible($fieldName)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$builder->get($fieldName)
|
||||||
->addModelTransformer($durationTimeTransformer);
|
->addModelTransformer($durationTimeTransformer);
|
||||||
|
|
||||||
|
$builder->get($fieldName)
|
||||||
|
->addEventListener(FormEvents::PRE_SET_DATA, function(FormEvent $formEvent) use (
|
||||||
|
$timeChoices,
|
||||||
|
$builder,
|
||||||
|
$durationTimeTransformer,
|
||||||
|
$durationTimeOptions,
|
||||||
|
$fieldName
|
||||||
|
) {
|
||||||
|
// set the timezone to GMT, and fix the difference between current and GMT
|
||||||
|
// the datetimetransformer will then handle timezone as GMT
|
||||||
|
$timezoneUTC = new \DateTimeZone('GMT');
|
||||||
|
/* @var $data \DateTime */
|
||||||
|
$data = $formEvent->getData() === NULL ?
|
||||||
|
\DateTime::createFromFormat('U', 300) :
|
||||||
|
$formEvent->getData();
|
||||||
|
$seconds = $data->getTimezone()->getOffset($data);
|
||||||
|
$data->setTimeZone($timezoneUTC);
|
||||||
|
$data->add(new \DateInterval('PT'.$seconds.'S'));
|
||||||
|
|
||||||
$builder->get('durationTime')
|
// test if the timestamp is in the choices.
|
||||||
->addEventListener(
|
// If not, recreate the field with the new timestamp
|
||||||
FormEvents::PRE_SET_DATA,
|
if (!in_array($data->getTimestamp(), $timeChoices)) {
|
||||||
function(FormEvent $formEvent) use (
|
// the data are not in the possible values. add them
|
||||||
$timeChoices,
|
$timeChoices[$data->format('H:i')] = $data->getTimestamp();
|
||||||
$builder,
|
$form = $builder->create($fieldName, ChoiceType::class, array_merge(
|
||||||
$durationTimeTransformer,
|
$durationTimeOptions, [
|
||||||
$durationTimeOptions
|
'choices' => $timeChoices,
|
||||||
)
|
'auto_initialize' => false
|
||||||
{
|
]
|
||||||
// set the timezone to GMT, and fix the difference between current and GMT
|
));
|
||||||
// the datetimetransformer will then handle timezone as GMT
|
$form->addModelTransformer($durationTimeTransformer);
|
||||||
$timezoneUTC = new \DateTimeZone('GMT');
|
$formEvent->getForm()->getParent()->add($form->getForm());
|
||||||
/* @var $data \DateTime */
|
}
|
||||||
$data = $formEvent->getData() === NULL ?
|
});
|
||||||
\DateTime::createFromFormat('U', 300) :
|
}
|
||||||
$formEvent->getData();
|
|
||||||
$seconds = $data->getTimezone()->getOffset($data);
|
|
||||||
$data->setTimeZone($timezoneUTC);
|
|
||||||
$data->add(new \DateInterval('PT'.$seconds.'S'));
|
|
||||||
|
|
||||||
// test if the timestamp is in the choices.
|
|
||||||
// If not, recreate the field with the new timestamp
|
|
||||||
if (!in_array($data->getTimestamp(), $timeChoices)) {
|
|
||||||
// the data are not in the possible values. add them
|
|
||||||
$timeChoices[$data->format('H:i')] = $data->getTimestamp();
|
|
||||||
$form = $builder->create(
|
|
||||||
'durationTime',
|
|
||||||
ChoiceType::class,
|
|
||||||
array_merge(
|
|
||||||
$durationTimeOptions,
|
|
||||||
array(
|
|
||||||
'choices' => $timeChoices,
|
|
||||||
'auto_initialize' => false
|
|
||||||
)
|
|
||||||
));
|
|
||||||
$form->addModelTransformer($durationTimeTransformer);
|
|
||||||
$formEvent->getForm()->getParent()->add($form->getForm());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param OptionsResolverInterface $resolver
|
|
||||||
*/
|
public function configureOptions(OptionsResolver $resolver): void
|
||||||
public function configureOptions(OptionsResolver $resolver)
|
|
||||||
{
|
{
|
||||||
$resolver->setDefaults(array(
|
$resolver->setDefaults([
|
||||||
'data_class' => 'Chill\ActivityBundle\Entity\Activity'
|
'data_class' => Activity::class
|
||||||
));
|
]);
|
||||||
|
|
||||||
$resolver
|
$resolver
|
||||||
->setRequired(array('center', 'role'))
|
->setRequired(['center', 'role', 'activityType', 'accompanyingPeriod'])
|
||||||
->setAllowedTypes('center', 'Chill\MainBundle\Entity\Center')
|
->setAllowedTypes('center', ['null', 'Chill\MainBundle\Entity\Center'])
|
||||||
->setAllowedTypes('role', 'Symfony\Component\Security\Core\Role\Role')
|
->setAllowedTypes('role', 'Symfony\Component\Security\Core\Role\Role')
|
||||||
;
|
->setAllowedTypes('activityType', \Chill\ActivityBundle\Entity\ActivityType::class)
|
||||||
|
->setAllowedTypes('accompanyingPeriod', [\Chill\PersonBundle\Entity\AccompanyingPeriod::class, 'null'])
|
||||||
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function getBlockPrefix(): string
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getBlockPrefix()
|
|
||||||
{
|
{
|
||||||
return 'chill_activitybundle_activity';
|
return 'chill_activitybundle_activity';
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,39 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Chill\ActivityBundle\Form;
|
||||||
|
|
||||||
|
use Chill\ActivityBundle\Entity\ActivityTypeCategory;
|
||||||
|
use Symfony\Component\Form\AbstractType;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\NumberType;
|
||||||
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||||
|
use Chill\MainBundle\Form\Type\TranslatableStringFormType;
|
||||||
|
|
||||||
|
class ActivityTypeCategoryType extends AbstractType
|
||||||
|
{
|
||||||
|
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||||
|
{
|
||||||
|
$builder
|
||||||
|
->add('name', TranslatableStringFormType::class)
|
||||||
|
->add('active', ChoiceType::class, array(
|
||||||
|
'choices' => array(
|
||||||
|
'Yes' => true,
|
||||||
|
'No' => false
|
||||||
|
),
|
||||||
|
'expanded' => true
|
||||||
|
))
|
||||||
|
->add('ordering', NumberType::class, [
|
||||||
|
'required' => true,
|
||||||
|
'scale' => 5
|
||||||
|
])
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function configureOptions(OptionsResolver $resolver): void
|
||||||
|
{
|
||||||
|
$resolver->setDefaults(array(
|
||||||
|
'data_class' => ActivityTypeCategory::class
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
@ -2,7 +2,13 @@
|
|||||||
|
|
||||||
namespace Chill\ActivityBundle\Form;
|
namespace Chill\ActivityBundle\Form;
|
||||||
|
|
||||||
|
use Chill\ActivityBundle\Entity\ActivityTypeCategory;
|
||||||
|
use Chill\ActivityBundle\Form\Type\ActivityFieldPresence;
|
||||||
|
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||||
|
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||||
use Symfony\Component\Form\AbstractType;
|
use Symfony\Component\Form\AbstractType;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\NumberType;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||||
@ -10,38 +16,56 @@ use Chill\MainBundle\Form\Type\TranslatableStringFormType;
|
|||||||
|
|
||||||
class ActivityTypeType extends AbstractType
|
class ActivityTypeType extends AbstractType
|
||||||
{
|
{
|
||||||
/**
|
private TranslatableStringHelper $translatableStringHelper;
|
||||||
* @param FormBuilderInterface $builder
|
|
||||||
* @param array $options
|
public function __construct(TranslatableStringHelper $translatableStringHelper)
|
||||||
*/
|
{
|
||||||
|
$this->translatableStringHelper = $translatableStringHelper;
|
||||||
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||||
{
|
{
|
||||||
$builder
|
$builder
|
||||||
->add('name', TranslatableStringFormType::class)
|
->add('name', TranslatableStringFormType::class)
|
||||||
->add('active', ChoiceType::class, array(
|
->add('active', ChoiceType::class, [
|
||||||
'choices' => array(
|
'choices' => [
|
||||||
'Yes' => true,
|
'Yes' => true,
|
||||||
'No' => false
|
'No' => false
|
||||||
),
|
],
|
||||||
'expanded' => true
|
'expanded' => true
|
||||||
));
|
])
|
||||||
|
->add('category', EntityType::class, [
|
||||||
|
'class' => ActivityTypeCategory::class,
|
||||||
|
'choice_label' => function (ActivityTypeCategory $activityTypeCategory) {
|
||||||
|
return $this->translatableStringHelper->localize($activityTypeCategory->getName());
|
||||||
|
},
|
||||||
|
])
|
||||||
|
->add('ordering', NumberType::class, [
|
||||||
|
'required' => true,
|
||||||
|
'scale' => 5
|
||||||
|
])
|
||||||
|
;
|
||||||
|
|
||||||
|
$fields = [
|
||||||
|
'persons', 'user', 'date', 'place', 'persons',
|
||||||
|
'thirdParties', 'durationTime', 'travelTime', 'attendee',
|
||||||
|
'reasons', 'comment', 'sentReceived', 'documents',
|
||||||
|
'emergency', 'accompanyingPeriod', 'socialData', 'users'
|
||||||
|
];
|
||||||
|
foreach ($fields as $field) {
|
||||||
|
$builder
|
||||||
|
->add($field.'Visible', ActivityFieldPresence::class)
|
||||||
|
->add($field.'Label', TextType::class, [
|
||||||
|
'required' => false,
|
||||||
|
'empty_data' => '',
|
||||||
|
]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param OptionsResolverInterface $resolver
|
|
||||||
*/
|
|
||||||
public function configureOptions(OptionsResolver $resolver)
|
public function configureOptions(OptionsResolver $resolver)
|
||||||
{
|
{
|
||||||
$resolver->setDefaults(array(
|
$resolver->setDefaults(array(
|
||||||
'data_class' => 'Chill\ActivityBundle\Entity\ActivityType'
|
'data_class' => \Chill\ActivityBundle\Entity\ActivityType::class
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getBlockPrefix()
|
|
||||||
{
|
|
||||||
return 'chill_activitybundle_activitytype';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Chill\ActivityBundle\Form\Type;
|
||||||
|
|
||||||
|
use Chill\ActivityBundle\Entity\ActivityType;
|
||||||
|
use Symfony\Component\Form\AbstractType;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||||
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||||
|
|
||||||
|
class ActivityFieldPresence extends AbstractType
|
||||||
|
{
|
||||||
|
public function getParent()
|
||||||
|
{
|
||||||
|
return ChoiceType::class;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function configureOptions(OptionsResolver $resolver)
|
||||||
|
{
|
||||||
|
$resolver->setDefaults(
|
||||||
|
array(
|
||||||
|
'choices' => [
|
||||||
|
'Invisible' => ActivityType::FIELD_INVISIBLE,
|
||||||
|
'Optional' => ActivityType::FIELD_OPTIONAL,
|
||||||
|
'Required' => ActivityType::FIELD_REQUIRED,
|
||||||
|
],
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,54 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Chill\ActivityBundle\Menu;
|
||||||
|
|
||||||
|
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
|
||||||
|
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
|
||||||
|
use Knp\Menu\MenuItem;
|
||||||
|
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
||||||
|
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||||
|
|
||||||
|
class AccompanyingCourseMenuBuilder implements LocalMenuBuilderInterface
|
||||||
|
{
|
||||||
|
protected TokenStorageInterface $tokenStorage;
|
||||||
|
|
||||||
|
protected AuthorizationHelper $authorizationHelper;
|
||||||
|
|
||||||
|
protected TranslatorInterface $translator;
|
||||||
|
|
||||||
|
public function __construct(
|
||||||
|
TokenStorageInterface $tokenStorage,
|
||||||
|
AuthorizationHelper $authorizationHelper,
|
||||||
|
TranslatorInterface $translator
|
||||||
|
) {
|
||||||
|
$this->translator = $translator;
|
||||||
|
$this->authorizationHelper = $authorizationHelper;
|
||||||
|
$this->tokenStorage = $tokenStorage;
|
||||||
|
}
|
||||||
|
public static function getMenuIds(): array
|
||||||
|
{
|
||||||
|
return ['accompanyingCourse'];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function buildMenu($menuId, MenuItem $menu, array $parameters)
|
||||||
|
{
|
||||||
|
$period = $parameters['accompanyingCourse'];
|
||||||
|
|
||||||
|
$menu->addChild($this->translator->trans('Activity list'), [
|
||||||
|
'route' => 'chill_activity_activity_list',
|
||||||
|
'routeParameters' => [
|
||||||
|
'accompanying_period_id' => $period->getId(),
|
||||||
|
]])
|
||||||
|
->setExtras(['order' => 40]);
|
||||||
|
|
||||||
|
$menu->addChild($this->translator->trans('Add a new activity'), [
|
||||||
|
'route' => 'chill_activity_activity_select_type',
|
||||||
|
'routeParameters' => [
|
||||||
|
'accompanying_period_id' => $period->getId(),
|
||||||
|
]])
|
||||||
|
->setExtras(['order' => 41]);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -1,10 +0,0 @@
|
|||||||
@import '~ChillMainSass/custom/config/colors';
|
|
||||||
@import '~ChillMainSass/custom/mixins/entity';
|
|
||||||
|
|
||||||
.chill-entity.chill-entity__activity-reason {
|
|
||||||
@include entity($chill-pink, white);
|
|
||||||
}
|
|
||||||
|
|
||||||
.activity {
|
|
||||||
color: $chill-green;
|
|
||||||
}
|
|
@ -1 +1 @@
|
|||||||
require('./activity/activity.scss');
|
require('./scss/chillactivity.scss');
|
||||||
|
@ -0,0 +1,114 @@
|
|||||||
|
@import '~ChillMainSass/custom/config/colors';
|
||||||
|
@import '~ChillMainSass/custom/mixins/entity';
|
||||||
|
|
||||||
|
.chill-entity.chill-entity__activity-reason {
|
||||||
|
@include entity($chill-pink, white);
|
||||||
|
}
|
||||||
|
|
||||||
|
.activity {
|
||||||
|
color: $chill-green;
|
||||||
|
}
|
||||||
|
|
||||||
|
// exceptions for flex-bloc in concerned-groups
|
||||||
|
div.flex-bloc.concerned-groups {
|
||||||
|
margin-top: 1em;
|
||||||
|
div.item-bloc {
|
||||||
|
flex-grow: 0; flex-shrink: 0; flex-basis: 25%; //4 blocs
|
||||||
|
ul.list-content {
|
||||||
|
list-style-type: none;
|
||||||
|
padding-left: 0;
|
||||||
|
li {
|
||||||
|
margin-bottom: 0.2em;
|
||||||
|
a {
|
||||||
|
color: white;
|
||||||
|
cursor: pointer;
|
||||||
|
&:hover {
|
||||||
|
color: #ffffffab;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
&.person div.item-bloc {
|
||||||
|
flex-basis: 33%; //3 blocs
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// exceptions for flex-table in list-records
|
||||||
|
div.flex-table.list-records {
|
||||||
|
div.item-bloc {
|
||||||
|
div.item-row.main {
|
||||||
|
div.item-col {
|
||||||
|
&:first-child {
|
||||||
|
flex-basis: 27%;
|
||||||
|
}
|
||||||
|
ul.list-content {
|
||||||
|
li.social-issues, li.social-actions {
|
||||||
|
.badge-primary {
|
||||||
|
font-variant: small-caps;
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 88%;
|
||||||
|
margin-bottom: 0.2em;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
li.social-issues .badge-primary {
|
||||||
|
background-color: var(--chill-orange);
|
||||||
|
}
|
||||||
|
li.social-actions .badge-primary {
|
||||||
|
background-color: var(--chill-green);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
div.item-row.details {
|
||||||
|
flex-direction: row;
|
||||||
|
& > div.item-col {
|
||||||
|
justify-content: flex-start;
|
||||||
|
align-self: center;
|
||||||
|
&:nth-child(1) {
|
||||||
|
flex-grow: 1; flex-shrink: 0; flex-basis: 30%;
|
||||||
|
}
|
||||||
|
&:nth-child(2) {
|
||||||
|
flex-grow: 0; flex-shrink: 1; flex-basis: 70%;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:only-child {
|
||||||
|
flex-grow: 0; flex-shrink: 0; flex-basis: 100%;
|
||||||
|
& > div.concerned-groups {
|
||||||
|
flex-grow: 0; flex-shrink: 0; flex-basis: 100%;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column; // TODO pas fini
|
||||||
|
div.group {
|
||||||
|
flex-grow: 1; flex-shrink: 0; flex-basis: 30%;
|
||||||
|
h4 {}
|
||||||
|
ul.list-content {
|
||||||
|
li {
|
||||||
|
display: inline;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
div.concerned-groups {
|
||||||
|
font-size: 85%;
|
||||||
|
h4 {
|
||||||
|
text-transform: uppercase;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ul.list-content {
|
||||||
|
list-style-type: none;
|
||||||
|
padding-left: 1em;
|
||||||
|
margin: 0 0;
|
||||||
|
li {
|
||||||
|
margin-bottom: 0.2em;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
div.duration {
|
||||||
|
font-size: smaller;
|
||||||
|
padding-left: 1em;
|
||||||
|
margin-top: 1em;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,170 @@
|
|||||||
|
<template>
|
||||||
|
<teleport to="#add-persons">
|
||||||
|
|
||||||
|
<div class="flex-bloc concerned-groups" :class="getContext">
|
||||||
|
<persons-bloc
|
||||||
|
v-for="bloc in contextPersonsBlocs"
|
||||||
|
v-bind:key="bloc.key"
|
||||||
|
v-bind:bloc="bloc"
|
||||||
|
v-bind:setPersonsInBloc="setPersonsInBloc">
|
||||||
|
</persons-bloc>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<add-persons
|
||||||
|
buttonTitle="activity.add_persons"
|
||||||
|
modalTitle="activity.add_persons"
|
||||||
|
v-bind:key="addPersons.key"
|
||||||
|
v-bind:options="addPersons.options"
|
||||||
|
@addNewPersons="addNewPersons"
|
||||||
|
ref="addPersons">
|
||||||
|
</add-persons>
|
||||||
|
|
||||||
|
</teleport>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { mapState } from 'vuex';
|
||||||
|
import AddPersons from 'ChillPersonAssets/vuejs/_components/AddPersons.vue';
|
||||||
|
import PersonsBloc from './components/PersonsBloc.vue';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "App",
|
||||||
|
components: {
|
||||||
|
AddPersons,
|
||||||
|
PersonsBloc
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
personsBlocs: [
|
||||||
|
{ key: 'persons',
|
||||||
|
title: 'activity.bloc_persons',
|
||||||
|
persons: [],
|
||||||
|
included: false
|
||||||
|
},
|
||||||
|
{ key: 'personsAssociated',
|
||||||
|
title: 'activity.bloc_persons_associated',
|
||||||
|
persons: [],
|
||||||
|
included: false
|
||||||
|
},
|
||||||
|
{ key: 'personsNotAssociated',
|
||||||
|
title: 'activity.bloc_persons_not_associated',
|
||||||
|
persons: [],
|
||||||
|
included: false
|
||||||
|
},
|
||||||
|
{ key: 'thirdparty',
|
||||||
|
title: 'activity.bloc_thirdparty',
|
||||||
|
persons: [],
|
||||||
|
included: true
|
||||||
|
},
|
||||||
|
{ key: 'users',
|
||||||
|
title: 'activity.bloc_users',
|
||||||
|
persons: [],
|
||||||
|
included: true
|
||||||
|
},
|
||||||
|
],
|
||||||
|
addPersons: {
|
||||||
|
key: 'activity',
|
||||||
|
options: {
|
||||||
|
type: ['person', 'thirdparty'], // TODO add 'user'
|
||||||
|
priority: null,
|
||||||
|
uniq: false,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
...mapState({
|
||||||
|
persons: state => state.activity.persons,
|
||||||
|
thirdParties: state => state.activity.thirdParties,
|
||||||
|
users: state => state.activity.users,
|
||||||
|
accompanyingCourse: state => state.activity.accompanyingPeriod
|
||||||
|
}),
|
||||||
|
getContext() {
|
||||||
|
return (this.accompanyingCourse) ? "accompanyingCourse" : "person";
|
||||||
|
},
|
||||||
|
contextPersonsBlocs() {
|
||||||
|
return this.personsBlocs.filter(bloc => bloc.included !== false);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.setPersonsInBloc();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
setPersonsInBloc() {
|
||||||
|
let groups;
|
||||||
|
if (this.accompanyingCourse) {
|
||||||
|
groups = this.splitPersonsInGroups();
|
||||||
|
}
|
||||||
|
this.personsBlocs.forEach(bloc => {
|
||||||
|
if (this.accompanyingCourse) {
|
||||||
|
switch (bloc.key) {
|
||||||
|
case 'personsAssociated':
|
||||||
|
bloc.persons = groups.personsAssociated;
|
||||||
|
bloc.included = true;
|
||||||
|
break;
|
||||||
|
case 'personsNotAssociated':
|
||||||
|
bloc.persons = groups.personsNotAssociated;
|
||||||
|
bloc.included = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
switch (bloc.key) {
|
||||||
|
case 'persons':
|
||||||
|
bloc.persons = this.persons;
|
||||||
|
bloc.included = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
switch (bloc.key) {
|
||||||
|
case 'thirdparty':
|
||||||
|
bloc.persons = this.thirdParties;
|
||||||
|
break;
|
||||||
|
case 'users':
|
||||||
|
bloc.persons = this.users;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}, groups);
|
||||||
|
},
|
||||||
|
splitPersonsInGroups() {
|
||||||
|
let personsAssociated = [];
|
||||||
|
let personsNotAssociated = this.persons;
|
||||||
|
let participations = this.getCourseParticipations();
|
||||||
|
this.persons.forEach(person => {
|
||||||
|
participations.forEach(participation => {
|
||||||
|
if (person.id === participation.id) {
|
||||||
|
console.log(person.id);
|
||||||
|
personsAssociated.push(person);
|
||||||
|
personsNotAssociated = personsNotAssociated.filter(p => p !== person);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
return {
|
||||||
|
'personsAssociated': personsAssociated,
|
||||||
|
'personsNotAssociated': personsNotAssociated
|
||||||
|
};
|
||||||
|
},
|
||||||
|
getCourseParticipations() {
|
||||||
|
let participations = [];
|
||||||
|
this.accompanyingCourse.participations.forEach(participation => {
|
||||||
|
if (!participation.endDate) {
|
||||||
|
participations.push(participation.person);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return participations;
|
||||||
|
},
|
||||||
|
addNewPersons({ selected, modal }) {
|
||||||
|
console.log('@@@ CLICK button addNewPersons', selected);
|
||||||
|
selected.forEach(function(item) {
|
||||||
|
this.$store.dispatch('addPersonsInvolved', item);
|
||||||
|
}, this
|
||||||
|
);
|
||||||
|
this.$refs.addPersons.resetSearch(); // to cast child method
|
||||||
|
modal.showModal = false;
|
||||||
|
this.setPersonsInBloc();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
</style>
|
@ -0,0 +1,29 @@
|
|||||||
|
<template>
|
||||||
|
<li>
|
||||||
|
<span class="badge badge-primary" :title="person.text">
|
||||||
|
<span class="chill_denomination">
|
||||||
|
{{ textCutted }}
|
||||||
|
</span>
|
||||||
|
<a class="fa fa-fw fa-times"
|
||||||
|
@click.prevent="$emit('remove', person)">
|
||||||
|
</a>
|
||||||
|
</span>
|
||||||
|
</li>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: "PersonBadge",
|
||||||
|
props: ['person'],
|
||||||
|
computed: {
|
||||||
|
textCutted() {
|
||||||
|
let more = (this.person.text.length > 15) ?'…' : '';
|
||||||
|
return this.person.text.slice(0,15) + more;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
emits: ['remove'],
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="css" scoped>
|
||||||
|
</style>
|
@ -0,0 +1,41 @@
|
|||||||
|
<template>
|
||||||
|
<div class="item-bloc">
|
||||||
|
<div class="item-row">
|
||||||
|
<div class="item-col">
|
||||||
|
<h4>{{ $t(bloc.title) }}</h4>
|
||||||
|
</div>
|
||||||
|
<div class="item-col">
|
||||||
|
<ul class="list-content">
|
||||||
|
<person-badge
|
||||||
|
v-for="person in bloc.persons"
|
||||||
|
v-bind:key="person.id"
|
||||||
|
v-bind:person="person"
|
||||||
|
@remove="removePerson">
|
||||||
|
</person-badge>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import PersonBadge from './PersonBadge.vue';
|
||||||
|
export default {
|
||||||
|
name:"PersonsBloc",
|
||||||
|
components: {
|
||||||
|
PersonBadge
|
||||||
|
},
|
||||||
|
props: ['bloc', 'setPersonsInBloc'],
|
||||||
|
methods: {
|
||||||
|
removePerson(item) {
|
||||||
|
console.log('@@ CLICK remove person: item', item);
|
||||||
|
this.$store.dispatch('removePersonInvolved', item);
|
||||||
|
this.setPersonsInBloc();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
|
||||||
|
</style>
|
@ -0,0 +1,20 @@
|
|||||||
|
import { personMessages } from 'ChillPersonAssets/vuejs/_js/i18n'
|
||||||
|
|
||||||
|
const appMessages = {
|
||||||
|
fr: {
|
||||||
|
activity: {
|
||||||
|
add_persons: "Ajouter des personnes concernées",
|
||||||
|
bloc_persons: "Usagers",
|
||||||
|
bloc_persons_associated: "Usagers du parcours",
|
||||||
|
bloc_persons_not_associated: "Tiers non-pro.",
|
||||||
|
bloc_thirdparty: "Tiers professionnels",
|
||||||
|
bloc_users: "T(M)S",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Object.assign(appMessages.fr, personMessages.fr);
|
||||||
|
|
||||||
|
export {
|
||||||
|
appMessages
|
||||||
|
};
|
@ -0,0 +1,16 @@
|
|||||||
|
import { createApp } from 'vue';
|
||||||
|
import { _createI18n } from 'ChillMainAssets/vuejs/_js/i18n'
|
||||||
|
import { appMessages } from './i18n'
|
||||||
|
import store from './store'
|
||||||
|
|
||||||
|
import App from './App.vue';
|
||||||
|
|
||||||
|
const i18n = _createI18n(appMessages);
|
||||||
|
|
||||||
|
const app = createApp({
|
||||||
|
template: `<app></app>`,
|
||||||
|
})
|
||||||
|
.use(store)
|
||||||
|
.use(i18n)
|
||||||
|
.component('app', App)
|
||||||
|
.mount('#activity');
|
@ -0,0 +1,98 @@
|
|||||||
|
import 'es6-promise/auto';
|
||||||
|
import { createStore } from 'vuex';
|
||||||
|
|
||||||
|
const debug = process.env.NODE_ENV !== 'production';
|
||||||
|
//console.log('window.activity', window.activity);
|
||||||
|
|
||||||
|
const addIdToValue = (string, id) => {
|
||||||
|
let array = string ? string.split(',') : [];
|
||||||
|
array.push(id.toString());
|
||||||
|
let str = array.join();
|
||||||
|
return str;
|
||||||
|
};
|
||||||
|
|
||||||
|
const removeIdFromValue = (string, id) => {
|
||||||
|
let array = string.split(',');
|
||||||
|
array = array.filter(el => el !== id.toString());
|
||||||
|
let str = array.join();
|
||||||
|
return str;
|
||||||
|
};
|
||||||
|
|
||||||
|
const store = createStore({
|
||||||
|
strict: debug,
|
||||||
|
state: {
|
||||||
|
activity: window.activity
|
||||||
|
},
|
||||||
|
getters: {
|
||||||
|
},
|
||||||
|
mutations: {
|
||||||
|
addPersonsInvolved(state, payload) {
|
||||||
|
//console.log('### mutation addPersonsInvolved', payload.result.type);
|
||||||
|
switch (payload.result.type) {
|
||||||
|
case 'person':
|
||||||
|
state.activity.persons.push(payload.result);
|
||||||
|
break;
|
||||||
|
case 'thirdparty':
|
||||||
|
state.activity.thirdParties.push(payload.result);
|
||||||
|
break;
|
||||||
|
case 'user':
|
||||||
|
state.activity.users.push(payload.result);
|
||||||
|
break;
|
||||||
|
};
|
||||||
|
},
|
||||||
|
removePersonInvolved(state, payload) {
|
||||||
|
//console.log('### mutation removePersonInvolved', payload.type);
|
||||||
|
switch (payload.type) {
|
||||||
|
case 'person':
|
||||||
|
state.activity.persons = state.activity.persons.filter(person => person !== payload);
|
||||||
|
break;
|
||||||
|
case 'thirdparty':
|
||||||
|
state.activity.thirdParties = state.activity.thirdParties.filter(thirdparty => thirdparty !== payload);
|
||||||
|
break;
|
||||||
|
case 'user':
|
||||||
|
state.activity.users = state.activity.users.filter(user => user !== payload);
|
||||||
|
break;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
},
|
||||||
|
actions: {
|
||||||
|
addPersonsInvolved({ commit }, payload) {
|
||||||
|
console.log('### action addPersonsInvolved', payload.result.type);
|
||||||
|
switch (payload.result.type) {
|
||||||
|
case 'person':
|
||||||
|
let aPersons = document.getElementById("chill_activitybundle_activity_persons");
|
||||||
|
aPersons.value = addIdToValue(aPersons.value, payload.result.id);
|
||||||
|
break;
|
||||||
|
case 'thirdparty':
|
||||||
|
let aThirdParties = document.getElementById("chill_activitybundle_activity_thirdParties");
|
||||||
|
aThirdParties.value = addIdToValue(aThirdParties.value, payload.result.id);
|
||||||
|
break;
|
||||||
|
case 'user':
|
||||||
|
let aUsers = document.getElementById("chill_activitybundle_activity_users");
|
||||||
|
aUsers.value = addIdToValue(aUsers.value, payload.result.id);
|
||||||
|
break;
|
||||||
|
};
|
||||||
|
commit('addPersonsInvolved', payload);
|
||||||
|
},
|
||||||
|
removePersonInvolved({ commit }, payload) {
|
||||||
|
console.log('### action removePersonInvolved', payload);
|
||||||
|
switch (payload.type) {
|
||||||
|
case 'person':
|
||||||
|
let aPersons = document.getElementById("chill_activitybundle_activity_persons");
|
||||||
|
aPersons.value = removeIdFromValue(aPersons.value, payload.id);
|
||||||
|
break;
|
||||||
|
case 'thirdparty':
|
||||||
|
let aThirdParties = document.getElementById("chill_activitybundle_activity_thirdParties");
|
||||||
|
aThirdParties.value = removeIdFromValue(aThirdParties.value, payload.id);
|
||||||
|
break;
|
||||||
|
case 'user':
|
||||||
|
let aUsers = document.getElementById("chill_activitybundle_activity_users");
|
||||||
|
aUsers.value = removeIdFromValue(aUsers.value, payload.id);
|
||||||
|
break;
|
||||||
|
};
|
||||||
|
commit('removePersonInvolved', payload);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
export default store;
|
@ -0,0 +1,97 @@
|
|||||||
|
{% macro href(pathname, key, value) %}
|
||||||
|
{% set parms = { (key): value } %}
|
||||||
|
{{ path(pathname, parms) }}
|
||||||
|
{% endmacro %}
|
||||||
|
|
||||||
|
{% if context == 'person' %}
|
||||||
|
{% set blocs = [
|
||||||
|
{ 'title': 'Others persons'|trans,
|
||||||
|
'items': entity.persons,
|
||||||
|
'path' : 'chill_person_view',
|
||||||
|
'key' : 'person_id'
|
||||||
|
},
|
||||||
|
{ 'title': 'Third parties'|trans,
|
||||||
|
'items': entity.thirdParties,
|
||||||
|
'path' : 'chill_3party_3party_show',
|
||||||
|
'key' : 'thirdparty_id'
|
||||||
|
},
|
||||||
|
{ 'title': 'Users concerned'|trans,
|
||||||
|
'items': entity.users,
|
||||||
|
'path' : 'admin_user_show',
|
||||||
|
'key' : 'id'
|
||||||
|
},
|
||||||
|
] %}
|
||||||
|
{% else %}
|
||||||
|
{% set blocs = [
|
||||||
|
{ 'title': 'Persons in accompanying course'|trans,
|
||||||
|
'items': entity.personsAssociated,
|
||||||
|
'path' : 'chill_person_view',
|
||||||
|
'key' : 'person_id'
|
||||||
|
},
|
||||||
|
{ 'title': 'Third persons'|trans,
|
||||||
|
'items': entity.personsNotAssociated,
|
||||||
|
'path' : 'chill_person_view',
|
||||||
|
'key' : 'person_id'
|
||||||
|
},
|
||||||
|
{ 'title': 'Third parties'|trans,
|
||||||
|
'items': entity.thirdParties,
|
||||||
|
'path' : 'chill_3party_3party_show',
|
||||||
|
'key' : 'thirdparty_id'
|
||||||
|
},
|
||||||
|
{ 'title': 'Users concerned'|trans,
|
||||||
|
'items': entity.users,
|
||||||
|
'path' : 'admin_user_show',
|
||||||
|
'key' : 'id'
|
||||||
|
},
|
||||||
|
] %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if (with_display == 'bloc') %}
|
||||||
|
<div class="{{ context }} flex-bloc concerned-groups">
|
||||||
|
{% for bloc in blocs %}
|
||||||
|
<div class="item-bloc">
|
||||||
|
<div class="item-row">
|
||||||
|
<div class="item-col">
|
||||||
|
<h4>{{ bloc.title }}</h4>
|
||||||
|
</div>
|
||||||
|
<div class="item-col">
|
||||||
|
<ul class="list-content">
|
||||||
|
{% for item in bloc.items %}
|
||||||
|
<li>
|
||||||
|
<a href="{{ _self.href(bloc.path, bloc.key, item.id) }}">
|
||||||
|
<span class="badge badge-primary">
|
||||||
|
{{ item|chill_entity_render_box({'only_denomination': true}) }}
|
||||||
|
</span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if (with_display == 'row') %}
|
||||||
|
<div class="concerned-groups">
|
||||||
|
{% for bloc in blocs %}
|
||||||
|
<div class="group">
|
||||||
|
{% if bloc.items|length > 0 %}
|
||||||
|
<h4>{{ bloc.title }}</h4>
|
||||||
|
<ul class="list-content">
|
||||||
|
{% for item in bloc.items %}
|
||||||
|
<li>
|
||||||
|
<a href="{{ _self.href(bloc.path, bloc.key, item.id) }}">
|
||||||
|
<span class="badge badge-primary">
|
||||||
|
{{ item|chill_entity_render_box({'only_denomination': true}) }}
|
||||||
|
</span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
@ -0,0 +1,16 @@
|
|||||||
|
{% extends "@ChillPerson/AccompanyingCourse/layout.html.twig" %}
|
||||||
|
|
||||||
|
{% set activeRouteKey = 'chill_activity_activity_list' %}
|
||||||
|
|
||||||
|
{% block title 'Remove activity'|trans %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
{{ include('@ChillMain/Util/confirmation_template.html.twig',
|
||||||
|
{
|
||||||
|
'title' : 'Remove activity'|trans,
|
||||||
|
'confirm_question' : 'Are you sure you want to remove the activity about "%name%" ?'|trans({ '%name%' : accompanyingCourse.id } ),
|
||||||
|
'cancel_route' : 'chill_activity_activity_list',
|
||||||
|
'cancel_parameters' : { 'accompanying_course_id' : accompanyingCourse.id, 'id' : activity.id },
|
||||||
|
'form' : delete_form
|
||||||
|
} ) }}
|
||||||
|
{% endblock %}
|
@ -6,7 +6,6 @@
|
|||||||
{% block title 'Remove activity'|trans %}
|
{% block title 'Remove activity'|trans %}
|
||||||
|
|
||||||
{% block personcontent %}
|
{% block personcontent %}
|
||||||
|
|
||||||
{{ include('@ChillMain/Util/confirmation_template.html.twig',
|
{{ include('@ChillMain/Util/confirmation_template.html.twig',
|
||||||
{
|
{
|
||||||
'title' : 'Remove activity'|trans,
|
'title' : 'Remove activity'|trans,
|
||||||
@ -15,5 +14,4 @@
|
|||||||
'cancel_parameters' : { 'person_id' : activity.person.id, 'id' : activity.id },
|
'cancel_parameters' : { 'person_id' : activity.person.id, 'id' : activity.id },
|
||||||
'form' : delete_form
|
'form' : delete_form
|
||||||
} ) }}
|
} ) }}
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
@ -1,59 +1,101 @@
|
|||||||
{#
|
<h1>{{ "Update activity"|trans }}</h1>
|
||||||
* Copyright (C) 2014, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as
|
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
|
||||||
* License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
#}
|
|
||||||
{% extends "@ChillPerson/layout.html.twig" %}
|
|
||||||
|
|
||||||
{% set activeRouteKey = 'chill_activity_activity_list' %}
|
{{ form_start(edit_form) }}
|
||||||
|
{{ form_errors(edit_form) }}
|
||||||
|
|
||||||
{% block title 'Update activity'|trans %}
|
{%- if edit_form.emergency is defined -%}
|
||||||
|
{{ form_row(edit_form.emergency) }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% block personcontent %}
|
{%- if edit_form.sentReceived is defined -%}
|
||||||
<h1>{{ "Update activity"|trans }}</h1>
|
{{ form_row(edit_form.sentReceived) }}
|
||||||
|
{% endif %}
|
||||||
{{ form_start(edit_form) }}
|
|
||||||
|
|
||||||
|
{%- if edit_form.user is defined -%}
|
||||||
{{ form_row(edit_form.user) }}
|
{{ form_row(edit_form.user) }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{%- if edit_form.scope is defined -%}
|
||||||
{{ form_row(edit_form.scope) }}
|
{{ form_row(edit_form.scope) }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<h2>{{ 'Activity data'|trans }}</h2>
|
{%- if edit_form.socialActions is defined -%}
|
||||||
{{ form_row(edit_form.date) }}
|
{{ form_row(edit_form.socialActions) }}
|
||||||
{{ form_row(edit_form.durationTime) }}
|
{% endif %}
|
||||||
{{ form_row(edit_form.type) }}
|
|
||||||
{{ form_row(edit_form.attendee) }}
|
{%- if edit_form.socialIssues is defined -%}
|
||||||
|
{{ form_row(edit_form.socialIssues) }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{%- if edit_form.reasons is defined -%}
|
||||||
{{ form_row(edit_form.reasons) }}
|
{{ form_row(edit_form.reasons) }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<h2 class="chill-red">{{ 'Concerned groups'|trans }}</h2>
|
||||||
|
|
||||||
|
{%- if edit_form.persons is defined -%}
|
||||||
|
{{ form_widget(edit_form.persons) }}
|
||||||
|
{% endif %}
|
||||||
|
{%- if edit_form.thirdParties is defined -%}
|
||||||
|
{{ form_widget(edit_form.thirdParties) }}
|
||||||
|
{% endif %}
|
||||||
|
{%- if edit_form.users is defined -%}
|
||||||
|
{{ form_widget(edit_form.users) }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<div id="add-persons"></div>
|
||||||
|
|
||||||
|
<h2 class="chill-red">{{ 'Activity data'|trans }}</h2>
|
||||||
|
|
||||||
|
{%- if edit_form.date is defined -%}
|
||||||
|
{{ form_row(edit_form.date) }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
.. location
|
||||||
|
|
||||||
|
{%- if edit_form.durationTime is defined -%}
|
||||||
|
{{ form_row(edit_form.durationTime) }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{%- if edit_form.travelTime is defined -%}
|
||||||
|
{{ form_row(edit_form.travelTime) }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{%- if edit_form.comment is defined -%}
|
||||||
|
.. public and private
|
||||||
{{ form_row(edit_form.comment) }}
|
{{ form_row(edit_form.comment) }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{{ form_widget(edit_form) }}
|
{%- if edit_form.documents is defined -%}
|
||||||
<ul class="record_actions sticky-form-buttons">
|
{{ form_row(edit_form.documents) }}
|
||||||
<li class="cancel">
|
{% endif %}
|
||||||
<a href="{{ path('chill_activity_activity_show', { 'id': entity.id, 'person_id': entity.person.id } ) }}" class="sc-button bt-cancel">
|
|
||||||
{{ 'Cancel'|trans }}
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<button class="sc-button bt-update" type="submit">{{ 'Save activity'|trans }}</button>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
{{ form_end(edit_form) }}
|
|
||||||
|
|
||||||
{# {{ form(delete_form) }} #}
|
{%- if edit_form.attendee is defined -%}
|
||||||
{% endblock %}
|
{{ form_row(edit_form.attendee) }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% block js %}
|
.. status
|
||||||
<script type="text/javascript">
|
|
||||||
chill.displayAlertWhenLeavingModifiedForm('form[name="{{ edit_form.vars.form.vars.name }}"]', '{{ "You are going to leave a page with unsubmitted data. Are you sure you want to leave ?"|trans }}');
|
{% set person_id = null %}
|
||||||
</script>
|
{% if entity.person %}
|
||||||
{% endblock %}
|
{% set person_id = entity.person.id %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% set accompanying_course_id = null %}
|
||||||
|
{% if accompanyingCourse %}
|
||||||
|
{% set accompanying_course_id = accompanyingCourse.id %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<ul class="record_actions sticky-form-buttons">
|
||||||
|
<li class="cancel">
|
||||||
|
<a href="{{ path('chill_activity_activity_show', { 'id': entity.id, 'person_id': person_id, 'accompanying_period_id': accompanying_course_id } ) }}" class="sc-button bt-cancel">
|
||||||
|
{{ 'Cancel'|trans }}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<button class="sc-button bt-update" type="submit">{{ 'Save activity'|trans }}</button>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
{{ form_end(edit_form) }}
|
||||||
|
|
||||||
|
{# {{ form(delete_form) }} #}
|
||||||
|
@ -0,0 +1,25 @@
|
|||||||
|
{% extends "@ChillPerson/AccompanyingCourse/layout.html.twig" %}
|
||||||
|
|
||||||
|
{% set activeRouteKey = 'chill_activity_activity_list' %}
|
||||||
|
|
||||||
|
{% block title 'Update activity'|trans %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div id="activity"></div> {# <=== vue component #}
|
||||||
|
{% include 'ChillActivityBundle:Activity:edit.html.twig' %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block js %}
|
||||||
|
{{ encore_entry_link_tags('async_upload') }}
|
||||||
|
<script type="text/javascript">
|
||||||
|
chill.displayAlertWhenLeavingModifiedForm('form[name="{{ edit_form.vars.form.vars.name }}"]',
|
||||||
|
'{{ "You are going to leave a page with unsubmitted data. Are you sure you want to leave ?"|trans }}');
|
||||||
|
window.activity = {{ activity_json|json_encode|raw }};
|
||||||
|
</script>
|
||||||
|
{{ encore_entry_script_tags('vue_activity') }}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block css %}
|
||||||
|
{{ encore_entry_link_tags('async_upload') }}
|
||||||
|
{{ encore_entry_link_tags('vue_activity') }}
|
||||||
|
{% endblock %}
|
@ -0,0 +1,41 @@
|
|||||||
|
{#
|
||||||
|
* Copyright (C) 2014, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as
|
||||||
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
#}
|
||||||
|
{% extends "@ChillPerson/layout.html.twig" %}
|
||||||
|
|
||||||
|
{% set activeRouteKey = 'chill_activity_activity_list' %}
|
||||||
|
|
||||||
|
{% block title 'Update activity'|trans %}
|
||||||
|
|
||||||
|
{% block personcontent %}
|
||||||
|
{% include 'ChillActivityBundle:Activity:edit.html.twig' %}
|
||||||
|
<div id="activity"></div> {# <=== vue component #}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block js %}
|
||||||
|
{{ encore_entry_link_tags('async_upload') }}
|
||||||
|
<script type="text/javascript">
|
||||||
|
chill.displayAlertWhenLeavingModifiedForm('form[name="{{ edit_form.vars.form.vars.name }}"]',
|
||||||
|
'{{ "You are going to leave a page with unsubmitted data. Are you sure you want to leave ?"|trans }}');
|
||||||
|
window.activity = {{ activity_json|json_encode|raw }};
|
||||||
|
</script>
|
||||||
|
{{ encore_entry_script_tags('vue_activity') }}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block css %}
|
||||||
|
{{ encore_entry_link_tags('async_upload') }}
|
||||||
|
{{ encore_entry_link_tags('vue_activity') }}
|
||||||
|
{% endblock %}
|
@ -1,87 +1,179 @@
|
|||||||
{#
|
{% set person_id = null %}
|
||||||
* Copyright (C) 2014, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
|
{% if person %}
|
||||||
*
|
{% set person_id = person.id %}
|
||||||
* This program is free software: you can redistribute it and/or modify
|
{% endif %}
|
||||||
* it under the terms of the GNU Affero General Public License as
|
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
|
||||||
* License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
#}
|
|
||||||
{% extends "@ChillPerson/layout.html.twig" %}
|
|
||||||
|
|
||||||
{% set activeRouteKey = 'chill_activity_activity_list' %}
|
{% set accompanying_course_id = null %}
|
||||||
|
{% if accompanyingCourse %}
|
||||||
|
{% set accompanying_course_id = accompanyingCourse.id %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% block title %}{{ 'Activity list' |trans }}{% endblock title %}
|
<h2>{{ 'Activity list' |trans }}</h2>
|
||||||
|
|
||||||
{% block personcontent %}
|
{% if activities|length == 0 %}
|
||||||
<h2>{{ 'Activity list' |trans }}</h2>
|
<p class="chill-no-data-statement">
|
||||||
|
{{ "There isn't any activities."|trans }}
|
||||||
|
<a href="{{ path('chill_activity_activity_new', {'person_id': person_id, 'accompanying_period_id': accompanying_course_id}) }}" class="sc-button bt-create button-small"></a>
|
||||||
|
</p>
|
||||||
|
{% else %}
|
||||||
|
|
||||||
{% if activities|length == 0 %}
|
<div class="flex-table list-records {{ context }}">
|
||||||
<p class="chill-no-data-statement">
|
<!--
|
||||||
{{ "There isn't any activities."|trans }}
|
<thead>
|
||||||
<a href="{{ path('chill_activity_activity_new', {'person_id': person.id}) }}" class="sc-button bt-create button-small"></a>
|
<tr>
|
||||||
</p>
|
<th class="chill-red">{{'Date' | trans }}</th>
|
||||||
{% else %}
|
<th class="chill-green">{{'Duration Time' | trans }}</th>
|
||||||
<table class="records_list">
|
<th class="chill-orange">{{'Reasons' | trans}}</th>
|
||||||
<thead>
|
<th>{{'Type' | trans}}</th>
|
||||||
<tr>
|
<th> </th>
|
||||||
<th class="chill-red">{{'Date' | trans }}</th>
|
</tr>
|
||||||
<th class="chill-green">{{'Duration Time' | trans }}</th>
|
</thead>
|
||||||
<th class="chill-orange">{{'Reasons' | trans}}</th>
|
-->
|
||||||
<th>{{'Type' | trans}}</th>
|
{% for activity in activities %}
|
||||||
<th> </th>
|
{% set t = activity.type %}
|
||||||
</tr>
|
<div class="item-bloc">
|
||||||
</thead>
|
<div class="item-row main">
|
||||||
<tbody>
|
<div class="item-col">
|
||||||
{% for activity in activities %}
|
|
||||||
<tr>
|
{% if activity.date %}
|
||||||
<td>{% if activity.date %}{{ activity.date|format_date('long') }}{% endif %}</td>
|
<h3>{{ activity.date|format_date('long') }}</h3>
|
||||||
<td>{{ activity.durationTime|date('H:i') }}</td>
|
|
||||||
<td>
|
|
||||||
{% if activity.comment.comment is not empty %}
|
|
||||||
{{ activity.comment|chill_entity_render_box( { 'limit_lines': 3, 'metadata': false } ) }}
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{%- if activity.reasons is empty -%}
|
|
||||||
{{ 'No reason associated'|trans }}
|
<div class="duration">
|
||||||
{%- else -%}
|
{% if t.durationTimeVisible > 0 %}
|
||||||
{% for r in activity.reasons %}{{ r|chill_entity_render_box }} {% endfor %}
|
<p>
|
||||||
{%- endif -%}
|
<i class="fa fa-fw fa-hourglass-end"></i>
|
||||||
</td>
|
{{ activity.durationTime|date('H:i') }}
|
||||||
<td>{{ activity.type.name | localize_translatable_string }}</td>
|
</p>
|
||||||
<td>
|
{% endif %}
|
||||||
|
|
||||||
|
{% if activity.travelTime and t.travelTimeVisible %}
|
||||||
|
<p>
|
||||||
|
<i class="fa fa-fw fa-car"></i>
|
||||||
|
{{ activity.travelTime|date('H:i') }}
|
||||||
|
</p>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="item-col">
|
||||||
|
<ul class="list-content">
|
||||||
|
{% if activity.user and t.userVisible %}
|
||||||
|
<li>
|
||||||
|
<b>{{ 'by'|trans }}{{ activity.user.usernameCanonical }}</b>
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<b>{{ activity.type.name | localize_translatable_string }}</b>
|
||||||
|
|
||||||
|
{% if activity.attendee is not null and t.attendeeVisible %}
|
||||||
|
{% if activity.attendee %}
|
||||||
|
{{ '→ ' ~ 'present'|trans|capitalize }}
|
||||||
|
{% else %}
|
||||||
|
{{ '→ ' ~ 'not present'|trans|capitalize }}
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<b>{{ 'location'|trans ~ ': ' }}</b>
|
||||||
|
Domicile de l'usager
|
||||||
|
{#
|
||||||
|
{% if activity.location %}{{ activity.location }}{% endif %}
|
||||||
|
#}
|
||||||
|
</li>
|
||||||
|
|
||||||
|
{%- if t.reasonsVisible -%}
|
||||||
|
<li>
|
||||||
|
{%- if activity.reasons is empty -%}
|
||||||
|
<span class="chill-no-data-statement">{{ 'No reason associated'|trans }}</span>
|
||||||
|
{%- else -%}
|
||||||
|
{% for r in activity.reasons %}
|
||||||
|
{{ r|chill_entity_render_box }}
|
||||||
|
{% endfor %}
|
||||||
|
{%- endif -%}
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{%- if t.socialIssuesVisible %}
|
||||||
|
<li class="social-issues">
|
||||||
|
{%- if activity.socialIssues is empty -%}
|
||||||
|
<span class="chill-no-data-statement">{{ 'No social issues associated'|trans }}</span>
|
||||||
|
{%- else -%}
|
||||||
|
{% for r in activity.socialIssues %}
|
||||||
|
{{ r|chill_entity_render_box }}
|
||||||
|
{% endfor %}
|
||||||
|
{%- endif -%}
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{%- if t.socialActionsVisible -%}
|
||||||
|
<li class="social-actions">
|
||||||
|
{%- if activity.socialActions is empty -%}
|
||||||
|
<span class="chill-no-data-statement">{{ 'No social actions associated'|trans }}</span>
|
||||||
|
{%- else -%}
|
||||||
|
{% for r in activity.socialActions %}
|
||||||
|
<span class="badge badge-primary">{{ r.title|localize_translatable_string }}</span>
|
||||||
|
{% endfor %}
|
||||||
|
{%- endif -%}
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
<ul class="record_actions">
|
<ul class="record_actions">
|
||||||
<li>
|
<li>
|
||||||
<a href="{{ path('chill_activity_activity_show', { 'id': activity.id, 'person_id': person.id }) }}" class="sc-button bt-show "></a>
|
<a href="{{ path('chill_activity_activity_show', { 'id': activity.id, 'person_id': person_id, 'accompanying_period_id': accompanying_course_id }) }}" class="sc-button bt-show "></a>
|
||||||
</li>
|
</li>
|
||||||
|
{# TOOD
|
||||||
{% if is_granted('CHILL_ACTIVITY_UPDATE', activity) %}
|
{% if is_granted('CHILL_ACTIVITY_UPDATE', activity) %}
|
||||||
|
#}
|
||||||
<li>
|
<li>
|
||||||
<a href="{{ path('chill_activity_activity_edit', { 'id': activity.id, 'person_id': person.id }) }}" class="sc-button bt-update "></a>
|
<a href="{{ path('chill_activity_activity_edit', { 'id': activity.id, 'person_id': person_id, 'accompanying_period_id': accompanying_course_id }) }}" class="sc-button bt-update "></a>
|
||||||
</li>
|
</li>
|
||||||
|
{# TOOD
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if is_granted('CHILL_ACTIVITY_DELETE', activity) %}
|
{% if is_granted('CHILL_ACTIVITY_DELETE', activity) %}
|
||||||
|
#}
|
||||||
<li>
|
<li>
|
||||||
<a href="{{ path('chill_activity_activity_delete', { 'id': activity.id, 'person_id' : person.id } ) }}" class="sc-button bt-delete "></a>
|
<a href="{{ path('chill_activity_activity_delete', { 'id': activity.id, 'person_id' : person_id, 'accompanying_period_id': accompanying_course_id } ) }}" class="sc-button bt-delete "></a>
|
||||||
</li>
|
</li>
|
||||||
|
{#
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
#}
|
||||||
</tr>
|
</ul>
|
||||||
{% endfor %}
|
</div>
|
||||||
</tbody>
|
</div>
|
||||||
</table>
|
|
||||||
{% endif %}
|
{%
|
||||||
|
if activity.comment.comment is not empty
|
||||||
|
or activity.persons|length > 0
|
||||||
|
or activity.thirdParties|length > 0
|
||||||
|
or activity.users|length > 0
|
||||||
|
%}
|
||||||
|
<div class="item-row details">
|
||||||
|
<div class="item-col">
|
||||||
|
{% include 'ChillActivityBundle:Activity:concernedGroups.html.twig' with {'context': context, 'with_display': 'row', 'entity': activity } %}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% if activity.comment.comment is not empty %}
|
||||||
|
<div class="item-col comment">
|
||||||
|
{{ activity.comment|chill_entity_render_box( { 'limit_lines': 3, 'metadata': false } ) }}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<ul class="record_actions">
|
<ul class="record_actions">
|
||||||
<li>
|
<li>
|
||||||
<a href="{{ path('chill_activity_activity_new', {'person_id': person.id}) }}" class="sc-button bt-create">
|
<a href="{{ path('chill_activity_activity_new', {'person_id': person_id, 'accompanying_period_id': accompanying_course_id}) }}" class="sc-button bt-create">
|
||||||
{{ 'Add a new activity' | trans }}
|
{{ 'Add a new activity' | trans }}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
{% endblock %}
|
|
||||||
|
@ -0,0 +1,9 @@
|
|||||||
|
{% extends "@ChillPerson/AccompanyingCourse/layout.html.twig" %}
|
||||||
|
|
||||||
|
{% set activeRouteKey = 'chill_activity_activity_list' %}
|
||||||
|
|
||||||
|
{% block title %}{{ 'Activity list' |trans }}{% endblock title %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
{% include 'ChillActivityBundle:Activity:list.html.twig' with {'context': 'accompanyingCourse'} %}
|
||||||
|
{% endblock %}
|
@ -0,0 +1,25 @@
|
|||||||
|
{#
|
||||||
|
* Copyright (C) 2014, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as
|
||||||
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
#}
|
||||||
|
{% extends "@ChillPerson/layout.html.twig" %}
|
||||||
|
|
||||||
|
{% set activeRouteKey = 'chill_activity_activity_list' %}
|
||||||
|
|
||||||
|
{% block title %}{{ 'Activity list' |trans }}{% endblock title %}
|
||||||
|
|
||||||
|
{% block personcontent %}
|
||||||
|
{% include 'ChillActivityBundle:Activity:list.html.twig' with {'context': 'person'} %}
|
||||||
|
{% endblock %}
|
@ -1,50 +1,100 @@
|
|||||||
{#
|
<h1>{{ "Activity creation"|trans }}</h1>
|
||||||
* Copyright (C) 2014, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as
|
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
|
||||||
* License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
#}
|
|
||||||
{% extends "@ChillPerson/layout.html.twig" %}
|
|
||||||
|
|
||||||
{% set activeRouteKey = 'chill_activity_activity_new' %}
|
{{ form_start(form) }}
|
||||||
|
{{ form_errors(form) }}
|
||||||
|
|
||||||
{% block title 'Activity creation' |trans %}
|
|
||||||
|
|
||||||
{% block personcontent %}
|
{%- if form.emergency is defined -%}
|
||||||
<h2 class="chill-red">{{ "Activity creation"|trans }}</h1>
|
{{ form_row(form.emergency) }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{{ form_start(form) }}
|
{%- if form.sentReceived is defined -%}
|
||||||
|
{{ form_row(form.sentReceived) }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{%- if form.user is defined -%}
|
||||||
{{ form_row(form.user) }}
|
{{ form_row(form.user) }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{%- if form.scope is defined -%}
|
||||||
{{ form_row(form.scope) }}
|
{{ form_row(form.scope) }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<h2 class="chill-red">{{ 'Activity data'|trans }}</h2>
|
{%- if form.socialActions is defined -%}
|
||||||
|
{{ form_row(form.socialActions) }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{{ form_row(form.date) }}
|
{%- if form.socialIssues is defined -%}
|
||||||
{{ form_row(form.durationTime) }}
|
{{ form_row(form.socialIssues) }}
|
||||||
{{ form_row(form.type) }}
|
{% endif %}
|
||||||
{{ form_row(form.attendee) }}
|
|
||||||
|
|
||||||
|
{%- if form.reasons is defined -%}
|
||||||
{{ form_row(form.reasons) }}
|
{{ form_row(form.reasons) }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<h2 class="chill-red">{{ 'Concerned groups'|trans }}</h2>
|
||||||
|
|
||||||
|
{%- if form.persons is defined -%}
|
||||||
|
{{ form_widget(form.persons) }}
|
||||||
|
{% endif %}
|
||||||
|
{%- if form.thirdParties is defined -%}
|
||||||
|
{{ form_widget(form.thirdParties) }}
|
||||||
|
{% endif %}
|
||||||
|
{%- if form.users is defined -%}
|
||||||
|
{{ form_widget(form.users) }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<div id="add-persons"></div>
|
||||||
|
|
||||||
|
<h2 class="chill-red">{{ 'Activity data'|trans }}</h2>
|
||||||
|
|
||||||
|
{%- if form.date is defined -%}
|
||||||
|
{{ form_row(form.date) }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
.. location
|
||||||
|
|
||||||
|
{%- if form.durationTime is defined -%}
|
||||||
|
{{ form_row(form.durationTime) }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{%- if form.travelTime is defined -%}
|
||||||
|
{{ form_row(form.travelTime) }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{%- if form.comment is defined -%}
|
||||||
|
.. public and private
|
||||||
{{ form_row(form.comment) }}
|
{{ form_row(form.comment) }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<div class="grid-12 centered sticky-form-buttons">
|
{%- if form.documents is defined -%}
|
||||||
<button class="sc-button green margin-10" type="submit"><i class="fa fa-save"></i> {{ 'Add a new activity'|trans }}</button>
|
{{ form_row(form.documents) }}
|
||||||
</div>
|
{% endif %}
|
||||||
{{ form_end(form) }}
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block js %}
|
{%- if form.attendee is defined -%}
|
||||||
<script type="text/javascript">
|
{{ form_row(form.attendee) }}
|
||||||
chill.displayAlertWhenLeavingUnsubmittedForm('form[name="{{ form.vars.form.vars.name }}"]', '{{ "You are going to leave a page with unsubmitted data. Are you sure you want to leave ?"|trans }}');
|
{% endif %}
|
||||||
</script>
|
|
||||||
{% endblock %}
|
.. status
|
||||||
|
|
||||||
|
<ul class="record_actions sticky-form-buttons">
|
||||||
|
<li class="cancel">
|
||||||
|
<a
|
||||||
|
class="sc-button bt-cancel"
|
||||||
|
{%- if context == 'person' -%}
|
||||||
|
href="{{ chill_return_path_or('chill_activity_activity_list', { 'person_id': person.id } )}}"
|
||||||
|
{%- else -%}
|
||||||
|
href="{{ chill_return_path_or('chill_activity_activity_list', { 'accompanying_period_id': accompanyingCourse.id } )}}"
|
||||||
|
{%- endif -%}
|
||||||
|
>
|
||||||
|
{{ 'Cancel'|trans|chill_return_path_label }}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<button class="sc-button bt-create" type="submit">
|
||||||
|
{{ 'Add a new activity'|trans }}
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
{{ form_end(form) }}
|
||||||
|
@ -0,0 +1,25 @@
|
|||||||
|
{% extends "@ChillPerson/AccompanyingCourse/layout.html.twig" %}
|
||||||
|
|
||||||
|
{% set activeRouteKey = 'chill_activity_activity_new' %}
|
||||||
|
|
||||||
|
{% block title 'Activity creation' |trans %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div id="activity"></div> {# <=== vue component #}
|
||||||
|
{% include 'ChillActivityBundle:Activity:new.html.twig' with {'context': 'accompanyingCourse'} %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block js %}
|
||||||
|
{{ encore_entry_script_tags('async_upload') }}
|
||||||
|
<script type="text/javascript">
|
||||||
|
chill.displayAlertWhenLeavingUnsubmittedForm('form[name="{{ form.vars.form.vars.name }}"]',
|
||||||
|
'{{ "You are going to leave a page with unsubmitted data. Are you sure you want to leave ?"|trans }}');
|
||||||
|
window.activity = {{ activity_json|json_encode|raw }};
|
||||||
|
</script>
|
||||||
|
{{ encore_entry_script_tags('vue_activity') }}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block css %}
|
||||||
|
<link rel="stylesheet" href="{{ asset('build/async_upload.css') }}"/>
|
||||||
|
{{ encore_entry_link_tags('vue_activity') }}
|
||||||
|
{% endblock %}
|
@ -0,0 +1,25 @@
|
|||||||
|
{% extends "@ChillPerson/layout.html.twig" %}
|
||||||
|
|
||||||
|
{% set activeRouteKey = 'chill_activity_activity_new' %}
|
||||||
|
|
||||||
|
{% block title 'Activity creation' |trans %}
|
||||||
|
|
||||||
|
{% block personcontent %}
|
||||||
|
{% include 'ChillActivityBundle:Activity:new.html.twig' with {'context': 'person'} %}
|
||||||
|
<div id="activity"></div> {# <=== vue component #}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block js %}
|
||||||
|
{{ encore_entry_link_tags('async_upload') }}
|
||||||
|
<script type="text/javascript">
|
||||||
|
chill.displayAlertWhenLeavingUnsubmittedForm('form[name="{{ form.vars.form.vars.name }}"]',
|
||||||
|
'{{ "You are going to leave a page with unsubmitted data. Are you sure you want to leave ?"|trans }}');
|
||||||
|
window.activity = {{ activity_json|json_encode|raw }};
|
||||||
|
</script>
|
||||||
|
{{ encore_entry_script_tags('vue_activity') }}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block css %}
|
||||||
|
{{ encore_entry_link_tags('async_upload') }}
|
||||||
|
{{ encore_entry_link_tags('vue_activity') }}
|
||||||
|
{% endblock %}
|
@ -0,0 +1,28 @@
|
|||||||
|
<h2 class="chill-red">{{ "Activity creation"|trans }}</h2>
|
||||||
|
|
||||||
|
{# TODO: refaire l'html css des tuilles #}
|
||||||
|
|
||||||
|
{% for row in data %}
|
||||||
|
<h3>{{ row.activityTypeCategory.name|localize_translatable_string }}</h3>
|
||||||
|
<div style="display:flex;justify-content:center;gap:12px;flex-wrap:wrap;">
|
||||||
|
{% for activityType in row.activityTypes %}
|
||||||
|
|
||||||
|
{% set person_id = null %}
|
||||||
|
{% if person %}
|
||||||
|
{% set person_id = person.id %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% set accompanying_course_id = null %}
|
||||||
|
{% if accompanyingCourse %}
|
||||||
|
{% set accompanying_course_id = accompanyingCourse.id %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<a href="{{ path('chill_activity_activity_new', {'person_id': person_id, 'activityType_id': activityType.id, 'accompanying_period_id': accompanying_course_id }) }}">
|
||||||
|
|
||||||
|
<div style="width:200px;height:200px;border:1px dotted red;display:flex;justify-content:center;align-items:center;align-content:center;">
|
||||||
|
{{ activityType.name|localize_translatable_string }}
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
@ -0,0 +1,9 @@
|
|||||||
|
{% extends "@ChillPerson/AccompanyingCourse/layout.html.twig" %}
|
||||||
|
|
||||||
|
{% set activeRouteKey = 'chill_activity_activity_new' %}
|
||||||
|
|
||||||
|
{% block title 'Activity creation'|trans %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
{% include 'ChillActivityBundle:Activity:selectType.html.twig' %}
|
||||||
|
{% endblock %}
|
@ -0,0 +1,9 @@
|
|||||||
|
{% extends "@ChillPerson/layout.html.twig" %}
|
||||||
|
|
||||||
|
{% set activeRouteKey = 'chill_activity_activity_new' %}
|
||||||
|
|
||||||
|
{% block title 'Activity creation'|trans %}
|
||||||
|
|
||||||
|
{% block personcontent %}
|
||||||
|
{% include 'ChillActivityBundle:Activity:selectType.html.twig' %}
|
||||||
|
{% endblock %}
|
@ -1,68 +1,134 @@
|
|||||||
{% extends "@ChillPerson/layout.html.twig" %}
|
{%- set t = entity.type -%}
|
||||||
|
{%- import "@ChillDocStore/Macro/macro.html.twig" as m -%}
|
||||||
|
|
||||||
{% set activeRouteKey = 'chill_activity_activity_list' %}
|
<h1>
|
||||||
|
{{ "Activity"|trans }}
|
||||||
|
{%- if t.emergencyVisible and entity.emergency -%}
|
||||||
|
<span class="badge badge-secondary">
|
||||||
|
{{- 'Emergency'|trans -}}
|
||||||
|
</span>
|
||||||
|
{%- endif -%}
|
||||||
|
</h1>
|
||||||
|
|
||||||
{% block title 'Activity'|trans %}
|
<dl class="chill_view_data">
|
||||||
|
|
||||||
{% import 'ChillActivityBundle:ActivityReason:macro.html.twig' as m %}
|
<dt class="inline">{{ 'by'|trans|capitalize }}</dt>
|
||||||
|
<dd>{{ entity.user }}</dd>
|
||||||
|
|
||||||
{% block personcontent -%}
|
<dt class="inline">{{ 'Type'|trans }}</dt>
|
||||||
<h1 >{{ "Activity"|trans }}</h1>
|
<dd>{{ entity.type.name | localize_translatable_string }}</dd>
|
||||||
|
|
||||||
<dl class="chill_view_data">
|
{%- if entity.scope -%}
|
||||||
<dt class="inline">{{ 'User'|trans }}</dt>
|
|
||||||
<dd>{{ entity.user }}</dd>
|
|
||||||
<dt class="inline">{{ 'Scope'|trans }}</dt>
|
<dt class="inline">{{ 'Scope'|trans }}</dt>
|
||||||
<dd><span class="scope">{{ entity.scope.name|localize_translatable_string }}</span></dd>
|
<dd><span class="scope">{{ entity.scope.name|localize_translatable_string }}</span></dd>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<h2 class="chill-red">{{ 'Activity data'|trans }}</h2>
|
{% if t.socialIssuesVisible %}
|
||||||
<dt class="inline">{{ 'Person'|trans }}</dt>
|
<dt class="inline">{{ 'Social issues'|trans }}</dt>
|
||||||
<dd>{{ entity.person }}</dd>
|
<dd>
|
||||||
|
{% if entity.socialIssues|length == 0 %}
|
||||||
<dt class="inline">{{ 'Date'|trans }}</dt>
|
<p class="chill-no-data-statement">{{ 'Any social issues'|trans }}</p>
|
||||||
<dd>{{ entity.date|format_date('long') }}</dd>
|
{% else %}
|
||||||
<dt class="inline">{{ 'Duration Time'|trans }}</dt>
|
{% for si in entity.socialIssues %}{{ si|chill_entity_render_box }}{% endfor %}
|
||||||
<dd>{{ entity.durationTime|date('H:i') }}</dd>
|
|
||||||
<dt class="inline">{{ 'Type'|trans }}</dt>
|
|
||||||
<dd>{{ entity.type.name | localize_translatable_string }}</dd>
|
|
||||||
|
|
||||||
<dt class="inline">{{ 'Attendee'|trans }}</dt>
|
|
||||||
<dd>{% if entity.attendee is not null %}{% if entity.attendee %}{{ 'present'|trans|capitalize }} {% else %} {{ 'not present'|trans|capitalize }}{% endif %}{% else %}{{ 'None'|trans|capitalize }}{% endif %}</dd>
|
|
||||||
|
|
||||||
<dt class="inline">{{ 'Reasons'|trans }}</dt>
|
|
||||||
{%- if entity.reasons is empty -%}
|
|
||||||
<dd><span class="chill-no-data-statement">{{ 'No reason associated'|trans }}</span></dd>
|
|
||||||
{%- else -%}
|
|
||||||
<dd>{% for r in entity.reasons %}{{ r|chill_entity_render_box }} {% endfor %}</dd>
|
|
||||||
{%- endif -%}
|
|
||||||
|
|
||||||
<dt class="inline">{{ 'Comment'|trans }}</dt>
|
|
||||||
{%- if entity.comment is empty -%}
|
|
||||||
<dd><span class="chill-no-data-statement">{{ 'No comment associated'|trans }}</span></dd>
|
|
||||||
{%- else -%}
|
|
||||||
<dd>{{ entity.comment|chill_entity_render_box }}</dd>
|
|
||||||
{%- endif -%}
|
|
||||||
|
|
||||||
</dl>
|
|
||||||
|
|
||||||
<ul class="record_actions">
|
|
||||||
<li class="cancel">
|
|
||||||
<a class="sc-button bt-cancel" href="{{ path('chill_activity_activity_list', { 'person_id': person.id } ) }}">
|
|
||||||
{{ 'Back to the list'|trans }}
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a class="sc-button bt-update" href="{{ path('chill_activity_activity_edit', { 'id': entity.id, 'person_id': person.id }) }}">
|
|
||||||
{{ 'Edit the activity'|trans }}
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
{% if is_granted('CHILL_ACTIVITY_DELETE', entity) %}
|
|
||||||
<li>
|
|
||||||
<a href="{{ path('chill_activity_activity_delete', { 'id': entity.id, 'person_id' : person.id } ) }}" class="sc-button bt-delete">
|
|
||||||
{{ 'Delete'|trans }}
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</ul>
|
</dd>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% endblock personcontent %}
|
{% if t.socialActionsVisible %}
|
||||||
|
<dt class="inline">{{ 'Social actions'|trans }}</dt>
|
||||||
|
<dd>
|
||||||
|
{% if entity.socialActions|length == 0 %}
|
||||||
|
<p class="chill-no-data-statement">{{ 'Any social actions'|trans }}</p>
|
||||||
|
{% else %}
|
||||||
|
{% for sa in entity.socialActions %}{{ sa|chill_entity_render_box }}{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
</dd>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if t.reasonsVisible %}
|
||||||
|
<dt class="inline">{{ 'Reasons'|trans }}</dt>
|
||||||
|
{%- if entity.reasons is empty -%}
|
||||||
|
<dd><span class="chill-no-data-statement">{{ 'No reason associated'|trans }}</span></dd>
|
||||||
|
{%- else -%}
|
||||||
|
<dd>{% for r in entity.reasons %}{{ r|chill_entity_render_box }} {% endfor %}</dd>
|
||||||
|
{%- endif -%}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<h2 class="chill-red">{{ 'Concerned groups'|trans }}</h2>
|
||||||
|
{% include 'ChillActivityBundle:Activity:concernedGroups.html.twig' with {'context': context, 'with_display': 'bloc' } %}
|
||||||
|
|
||||||
|
<h2 class="chill-red">{{ 'Activity data'|trans }}</h2>
|
||||||
|
|
||||||
|
<dt class="inline">{{ 'Date'|trans }}</dt>
|
||||||
|
<dd>{{ entity.date|format_date('long') }}</dd>
|
||||||
|
|
||||||
|
{% if t.durationTimeVisible %}
|
||||||
|
<dt class="inline">{{ 'Duration Time'|trans }}</dt>
|
||||||
|
<dd>{{ entity.durationTime|date('H:i') }}</dd>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if t.travelTimeVisible %}
|
||||||
|
<dt class="inline">{{ 'Travel Time'|trans }}</dt>
|
||||||
|
<dd>{{ entity.travelTime|date('H:i') }}</dd>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if t.commentVisible %}
|
||||||
|
<dt class="inline">{{ 'Comment'|trans }}</dt>
|
||||||
|
{%- if entity.comment.empty -%}
|
||||||
|
<dd><span class="chill-no-data-statement">{{ 'No comment associated'|trans }}</span></dd>
|
||||||
|
{%- else -%}
|
||||||
|
<dd>{{ entity.comment|chill_entity_render_box }}</dd>
|
||||||
|
{%- endif -%}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if t.documentsVisible and entity.documents|length > 0 %}
|
||||||
|
<dt>{{ 'Documents'|trans }}</dt>
|
||||||
|
<dd>
|
||||||
|
<ul>
|
||||||
|
{% for d in entity.documents %}
|
||||||
|
<li>{{ m.download_button(d) }}</li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
</dd>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if t.attendeeVisible %}
|
||||||
|
<dt class="inline">{{ 'Attendee'|trans }}</dt>
|
||||||
|
<dd>{% if entity.attendee is not null %}{% if entity.attendee %}{{ 'present'|trans|capitalize }} {% else %} {{ 'not present'|trans|capitalize }}{% endif %}{% else %}{{ 'None'|trans|capitalize }}{% endif %}</dd>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
{% set person_id = null %}
|
||||||
|
{% if person %}
|
||||||
|
{% set person_id = person.id %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% set accompanying_course_id = null %}
|
||||||
|
{% if accompanyingCourse %}
|
||||||
|
{% set accompanying_course_id = accompanyingCourse.id %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<ul class="record_actions">
|
||||||
|
<li class="cancel">
|
||||||
|
<a class="sc-button bt-cancel" href="{{ path('chill_activity_activity_list', { 'person_id': person_id, 'accompanying_period_id': accompanying_course_id } ) }}">
|
||||||
|
{{ 'Back to the list'|trans }}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a class="sc-button bt-update" href="{{ path('chill_activity_activity_edit', { 'id': entity.id, 'person_id': person_id, 'accompanying_period_id': accompanying_course_id }) }}">
|
||||||
|
{{ 'Edit the activity'|trans }}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
{# TODO
|
||||||
|
{% if is_granted('CHILL_ACTIVITY_DELETE', entity) %}
|
||||||
|
#}
|
||||||
|
<li>
|
||||||
|
<a href="{{ path('chill_activity_activity_delete', { 'id': entity.id, 'person_id' : person_id, 'accompanying_period_id': accompanying_course_id } ) }}" class="sc-button bt-delete">
|
||||||
|
{{ 'Delete'|trans }}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
{#
|
||||||
|
{% endif %}
|
||||||
|
#}
|
||||||
|
</ul>
|
||||||
|
@ -0,0 +1,11 @@
|
|||||||
|
{% extends "@ChillPerson/AccompanyingCourse/layout.html.twig" %}
|
||||||
|
|
||||||
|
{% set activeRouteKey = 'chill_activity_activity_list' %}
|
||||||
|
|
||||||
|
{% block title 'Activity'|trans %}
|
||||||
|
|
||||||
|
{% import 'ChillActivityBundle:ActivityReason:macro.html.twig' as m %}
|
||||||
|
|
||||||
|
{% block content -%}
|
||||||
|
{% include 'ChillActivityBundle:Activity:show.html.twig' with {'context': 'accompanyingCourse'} %}
|
||||||
|
{% endblock content %}
|
@ -0,0 +1,11 @@
|
|||||||
|
{% extends "@ChillPerson/layout.html.twig" %}
|
||||||
|
|
||||||
|
{% set activeRouteKey = 'chill_activity_activity_list' %}
|
||||||
|
|
||||||
|
{% block title 'Activity'|trans %}
|
||||||
|
|
||||||
|
{% import 'ChillActivityBundle:ActivityReason:macro.html.twig' as m %}
|
||||||
|
|
||||||
|
{% block personcontent -%}
|
||||||
|
{% include 'ChillActivityBundle:Activity:show.html.twig' with {'context': 'person'} %}
|
||||||
|
{% endblock personcontent %}
|
@ -0,0 +1,12 @@
|
|||||||
|
{% extends "@ChillActivity/Admin/layout_activity.html.twig" %}
|
||||||
|
|
||||||
|
{% block title %}
|
||||||
|
{% include('@ChillMain/CRUD/_edit_title.html.twig') %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block layout_wvm_content %}
|
||||||
|
{% embed '@ChillMain/CRUD/_edit_content.html.twig' %}
|
||||||
|
{% block content_form_actions_view %}{% endblock %}
|
||||||
|
{% block content_form_actions_save_and_show %}{% endblock %}
|
||||||
|
{% endembed %}
|
||||||
|
{% endblock %}
|
@ -0,0 +1,44 @@
|
|||||||
|
{% extends "@ChillActivity/Admin/layout_activity.html.twig" %}
|
||||||
|
|
||||||
|
{% block admin_content %}
|
||||||
|
<h1>{{ 'ActivityPresence list'|trans }}</h1>
|
||||||
|
|
||||||
|
<table class="records_list">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>{{ 'Name'|trans }}</th>
|
||||||
|
<th>{{ 'Active'|trans }}</th>
|
||||||
|
<th>{{ 'Actions'|trans }}</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for entity in entities %}
|
||||||
|
<tr>
|
||||||
|
<td>{{ entity.name|localize_translatable_string }}</td>
|
||||||
|
<td style="text-align:center;">
|
||||||
|
{%- if entity.active -%}
|
||||||
|
<i class="fa fa-check-square-o"></i>
|
||||||
|
{%- else -%}
|
||||||
|
<i class="fa fa-square-o"></i>
|
||||||
|
{%- endif -%}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<ul class="record_actions">
|
||||||
|
<li>
|
||||||
|
<a href="{{ path('chill_crud_activity_presence_edit', { 'id': entity.id }) }}" class="sc-button bt-edit" title="{{ 'edit'|trans }}"></a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<ul class="record_actions">
|
||||||
|
<li>
|
||||||
|
<a href="{{ path('chill_crud_activity_presence_new') }}" class="sc-button bt-create">
|
||||||
|
{{ 'Create a new activity presence'|trans }}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
{% endblock %}
|
@ -0,0 +1,11 @@
|
|||||||
|
{% extends "@ChillActivity/Admin/layout_activity.html.twig" %}
|
||||||
|
|
||||||
|
{% block title %}
|
||||||
|
{% include('@ChillMain/CRUD/_new_title.html.twig') %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block layout_wvm_content %}
|
||||||
|
{% embed '@ChillMain/CRUD/_new_content.html.twig' %}
|
||||||
|
{% block content_form_actions_save_and_show %}{% endblock %}
|
||||||
|
{% endembed %}
|
||||||
|
{% endblock %}
|
@ -1,40 +1,12 @@
|
|||||||
{#
|
|
||||||
* Copyright (C) 2014, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as
|
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
|
||||||
* License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
#}
|
|
||||||
{% extends "@ChillActivity/Admin/layout_activity.html.twig" %}
|
{% extends "@ChillActivity/Admin/layout_activity.html.twig" %}
|
||||||
|
|
||||||
{% block admin_content %}
|
{% block title %}
|
||||||
<h1>{{ 'ActivityType edit'|trans }}</h1>
|
{% include('@ChillMain/CRUD/_edit_title.html.twig') %}
|
||||||
|
{% endblock %}
|
||||||
{{ form_start(edit_form) }}
|
|
||||||
{{ form_row(edit_form.active) }}
|
{% block layout_wvm_content %}
|
||||||
{{ form_row(edit_form.name) }}
|
{% embed '@ChillMain/CRUD/_edit_content.html.twig' %}
|
||||||
|
{% block content_form_actions_view %}{% endblock %}
|
||||||
|
{% block content_form_actions_save_and_show %}{% endblock %}
|
||||||
|
{% endembed %}
|
||||||
<ul class="record_actions">
|
|
||||||
<li class="cancel">
|
|
||||||
<a href="{{ path('chill_activity_activitytype') }}" class="sc-button bt-cancel">
|
|
||||||
{{ 'Back to the list'|trans }}
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
{{ form_widget(edit_form.submit, { 'attr' : { 'class' : 'sc-button bt-update' } } ) }}
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
{{ form_end(edit_form) }}
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
{% for entity in entities %}
|
{% for entity in entities %}
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href="{{ path('chill_activity_activitytype_show', { 'id': entity.id }) }}">{{ entity.name|localize_translatable_string }}</a></td>
|
<td>{{ entity.name|localize_translatable_string }}</td>
|
||||||
<td style="text-align:center;">
|
<td style="text-align:center;">
|
||||||
{%- if entity.active -%}
|
{%- if entity.active -%}
|
||||||
<i class="fa fa-check-square-o"></i>
|
<i class="fa fa-check-square-o"></i>
|
||||||
@ -41,10 +41,7 @@
|
|||||||
<td>
|
<td>
|
||||||
<ul class="record_actions">
|
<ul class="record_actions">
|
||||||
<li>
|
<li>
|
||||||
<a href="{{ path('chill_activity_activitytype_show', { 'id': entity.id }) }}" class="sc-button bt-show" title="{{ 'show'|trans }}"></a>
|
<a href="{{ path('chill_crud_activity_type_edit', { 'id': entity.id }) }}" class="sc-button bt-edit" title="{{ 'edit'|trans }}"></a>
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href="{{ path('chill_activity_activitytype_edit', { 'id': entity.id }) }}" class="sc-button bt-edit" title="{{ 'edit'|trans }}"></a>
|
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</td>
|
</td>
|
||||||
@ -55,7 +52,7 @@
|
|||||||
|
|
||||||
<ul class="record_actions">
|
<ul class="record_actions">
|
||||||
<li>
|
<li>
|
||||||
<a href="{{ path('chill_activity_activitytype_new') }}" class="sc-button bt-create">
|
<a href="{{ path('chill_crud_activity_type_new') }}" class="sc-button bt-create">
|
||||||
{{ 'Create a new activity type'|trans }}
|
{{ 'Create a new activity type'|trans }}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
@ -1,38 +1,11 @@
|
|||||||
{#
|
|
||||||
* Copyright (C) 2014, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as
|
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
|
||||||
* License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
#}
|
|
||||||
{% extends "@ChillActivity/Admin/layout_activity.html.twig" %}
|
{% extends "@ChillActivity/Admin/layout_activity.html.twig" %}
|
||||||
|
|
||||||
{% block admin_content %}
|
{% block title %}
|
||||||
<h1>{{ 'ActivityType creation'|trans }}</h1>
|
{% include('@ChillMain/CRUD/_new_title.html.twig') %}
|
||||||
|
{% endblock %}
|
||||||
{{ form_start(form) }}
|
|
||||||
{{ form_row(form.active) }}
|
{% block layout_wvm_content %}
|
||||||
{{ form_row(form.name) }}
|
{% embed '@ChillMain/CRUD/_new_content.html.twig' %}
|
||||||
|
{% block content_form_actions_save_and_show %}{% endblock %}
|
||||||
<ul class="record_actions">
|
{% endembed %}
|
||||||
<li class="cancel">
|
|
||||||
<a href="{{ path('chill_activity_activitytype') }}" class="sc-button bt-cancel">
|
|
||||||
{{ 'Back to the list'|trans }}
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
{{ form_widget(form.submit, { 'attr' : { 'class' : 'sc-button bt-new' } } ) }}
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
{{ form_end(form) }}
|
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -1,42 +0,0 @@
|
|||||||
{#
|
|
||||||
* Copyright (C) 2014, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as
|
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
|
||||||
* License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
#}
|
|
||||||
{% extends "@ChillActivity/Admin/layout_activity.html.twig" %}
|
|
||||||
|
|
||||||
{% block admin_content %}
|
|
||||||
<h1>{{ 'ActivityType'|trans }}</h1>
|
|
||||||
|
|
||||||
<table class="record_properties">
|
|
||||||
<tbody>
|
|
||||||
<tr>
|
|
||||||
<th>{{ 'Name'|trans }}</th>
|
|
||||||
<td>{{ entity.name|localize_translatable_string }}</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
<ul class="record_actions">
|
|
||||||
<li class="cancel">
|
|
||||||
<a href="{{ path('chill_activity_activitytype') }}" class="sc-button bt-cancel">
|
|
||||||
{{ 'Back to the list'|trans }}
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href="{{ path('chill_activity_activitytype_edit', { 'id': entity.id }) }}" class="sc-button bt-edit">
|
|
||||||
{{ 'Edit'|trans }}
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
{% endblock %}
|
|
@ -0,0 +1,12 @@
|
|||||||
|
{% extends "@ChillActivity/Admin/layout_activity.html.twig" %}
|
||||||
|
|
||||||
|
{% block title %}
|
||||||
|
{% include('@ChillMain/CRUD/_edit_title.html.twig') %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block layout_wvm_content %}
|
||||||
|
{% embed '@ChillMain/CRUD/_edit_content.html.twig' %}
|
||||||
|
{% block content_form_actions_view %}{% endblock %}
|
||||||
|
{% block content_form_actions_save_and_show %}{% endblock %}
|
||||||
|
{% endembed %}
|
||||||
|
{% endblock %}
|
@ -0,0 +1,44 @@
|
|||||||
|
{% extends "@ChillActivity/Admin/layout_activity.html.twig" %}
|
||||||
|
|
||||||
|
{% block admin_content %}
|
||||||
|
<h1>{{ 'ActivityTypeCategory list'|trans }}</h1>
|
||||||
|
|
||||||
|
<table class="records_list">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>{{ 'Name'|trans }}</th>
|
||||||
|
<th>{{ 'Active'|trans }}</th>
|
||||||
|
<th>{{ 'Actions'|trans }}</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for entity in entities %}
|
||||||
|
<tr>
|
||||||
|
<td>{{ entity.name|localize_translatable_string }}</td>
|
||||||
|
<td style="text-align:center;">
|
||||||
|
{%- if entity.active -%}
|
||||||
|
<i class="fa fa-check-square-o"></i>
|
||||||
|
{%- else -%}
|
||||||
|
<i class="fa fa-square-o"></i>
|
||||||
|
{%- endif -%}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<ul class="record_actions">
|
||||||
|
<li>
|
||||||
|
<a href="{{ path('chill_crud_activity_type_category_edit', { 'id': entity.id }) }}" class="sc-button bt-edit" title="{{ 'edit'|trans }}"></a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<ul class="record_actions">
|
||||||
|
<li>
|
||||||
|
<a href="{{ path('chill_crud_activity_type_category_new') }}" class="sc-button bt-create">
|
||||||
|
{{ 'Create a new activity type category'|trans }}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
{% endblock %}
|
@ -0,0 +1,11 @@
|
|||||||
|
{% extends "@ChillActivity/Admin/layout_activity.html.twig" %}
|
||||||
|
|
||||||
|
{% block title %}
|
||||||
|
{% include('@ChillMain/CRUD/_new_title.html.twig') %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block layout_wvm_content %}
|
||||||
|
{% embed '@ChillMain/CRUD/_new_content.html.twig' %}
|
||||||
|
{% block content_form_actions_save_and_show %}{% endblock %}
|
||||||
|
{% endembed %}
|
||||||
|
{% endblock %}
|
@ -1,4 +1,10 @@
|
|||||||
// this file loads all assets from the Chill person bundle
|
// this file loads all assets from the Chill person bundle
|
||||||
module.exports = function(encore, entries) {
|
module.exports = function(encore, entries) {
|
||||||
entries.push(__dirname + '/Resources/public/index.js');
|
entries.push(__dirname + '/Resources/public/index.js');
|
||||||
|
|
||||||
|
encore.addAliases({
|
||||||
|
ChillActivityAssets: __dirname + '/Resources/public'
|
||||||
|
});
|
||||||
|
|
||||||
|
encore.addEntry('vue_activity', __dirname + '/Resources/public/vuejs/Activity/index.js');
|
||||||
};
|
};
|
||||||
|
@ -10,10 +10,6 @@ chill_activity_activityreasoncategory:
|
|||||||
resource: "@ChillActivityBundle/config/routes/activityreasoncategory.yaml"
|
resource: "@ChillActivityBundle/config/routes/activityreasoncategory.yaml"
|
||||||
prefix: /
|
prefix: /
|
||||||
|
|
||||||
chill_activity_activitytype:
|
|
||||||
resource: "@ChillActivityBundle/config/routes/activitytype.yaml"
|
|
||||||
prefix: /
|
|
||||||
|
|
||||||
chill_admin_activity_index:
|
chill_admin_activity_index:
|
||||||
path: /{_locale}/admin/activity
|
path: /{_locale}/admin/activity
|
||||||
controller: Chill\ActivityBundle\Controller\AdminController::indexActivityAction
|
controller: Chill\ActivityBundle\Controller\AdminController::indexActivityAction
|
||||||
@ -32,3 +28,30 @@ chill_admin_activity_redirect_to_admin_index:
|
|||||||
admin_activity:
|
admin_activity:
|
||||||
order: 0
|
order: 0
|
||||||
label: Main admin menu
|
label: Main admin menu
|
||||||
|
|
||||||
|
chill_activity_type_admin:
|
||||||
|
path: /{_locale}/admin/activity/type
|
||||||
|
controller: cscrud_activity_type_controller:index
|
||||||
|
options:
|
||||||
|
menus:
|
||||||
|
admin_activity:
|
||||||
|
order: 2020
|
||||||
|
label: 'Activity Types'
|
||||||
|
|
||||||
|
chill_activity_type_category_admin:
|
||||||
|
path: /{_locale}/admin/activity/type_category
|
||||||
|
controller: cscrud_activity_type_category_controller:index
|
||||||
|
options:
|
||||||
|
menus:
|
||||||
|
admin_activity:
|
||||||
|
order: 2999
|
||||||
|
label: 'Activity Types Categories'
|
||||||
|
|
||||||
|
chill_activity_presence_admin:
|
||||||
|
path: /{_locale}/admin/activity/presence
|
||||||
|
controller: cscrud_activity_presence_controller:index
|
||||||
|
options:
|
||||||
|
menus:
|
||||||
|
admin_activity:
|
||||||
|
order: 2021
|
||||||
|
label: 'Activity Presences'
|
||||||
|
@ -1,30 +1,26 @@
|
|||||||
chill_activity_activity_list:
|
chill_activity_activity_list:
|
||||||
path: /{_locale}/person/{person_id}/activity/
|
path: /{_locale}/activity/
|
||||||
controller: Chill\ActivityBundle\Controller\ActivityController::listAction
|
controller: Chill\ActivityBundle\Controller\ActivityController::listAction
|
||||||
|
|
||||||
chill_activity_activity_show:
|
chill_activity_activity_show:
|
||||||
path: /{_locale}/person/{person_id}/activity/{id}/show
|
path: /{_locale}/activity/{id}/show
|
||||||
controller: Chill\ActivityBundle\Controller\ActivityController::showAction
|
controller: Chill\ActivityBundle\Controller\ActivityController::showAction
|
||||||
|
|
||||||
chill_activity_activity_new:
|
chill_activity_activity_select_type:
|
||||||
path: /{_locale}/person/{person_id}/activity/new
|
path: /{_locale}/activity/select-type
|
||||||
controller: Chill\ActivityBundle\Controller\ActivityController::newAction
|
controller: Chill\ActivityBundle\Controller\ActivityController::selectTypeAction
|
||||||
|
|
||||||
chill_activity_activity_create:
|
chill_activity_activity_new:
|
||||||
path: /{_locale}/person/{person_id}/activity/create
|
path: /{_locale}/activity/new
|
||||||
controller: Chill\ActivityBundle\Controller\ActivityController::createAction
|
controller: Chill\ActivityBundle\Controller\ActivityController::newAction
|
||||||
methods: POST
|
methods: [POST, GET]
|
||||||
|
|
||||||
chill_activity_activity_edit:
|
chill_activity_activity_edit:
|
||||||
path: /{_locale}/person/{person_id}/activity/{id}/edit
|
path: /{_locale}/activity/{id}/edit
|
||||||
controller: Chill\ActivityBundle\Controller\ActivityController::editAction
|
controller: Chill\ActivityBundle\Controller\ActivityController::editAction
|
||||||
|
methods: [GET, POST, PUT]
|
||||||
chill_activity_activity_update:
|
|
||||||
path: /{_locale}/person/{person_id}/activity/{id}/update
|
|
||||||
controller: Chill\ActivityBundle\Controller\ActivityController::updateAction
|
|
||||||
methods: [POST, PUT]
|
|
||||||
|
|
||||||
chill_activity_activity_delete:
|
chill_activity_activity_delete:
|
||||||
path: /{_locale}/person/{person_id}/activity/{id}/delete
|
path: /{_locale}/activity/{id}/delete
|
||||||
controller: Chill\ActivityBundle\Controller\ActivityController::deleteAction
|
controller: Chill\ActivityBundle\Controller\ActivityController::deleteAction
|
||||||
methods: [GET, POST, DELETE]
|
methods: [GET, POST, DELETE]
|
||||||
|
@ -1,35 +0,0 @@
|
|||||||
chill_activity_activitytype:
|
|
||||||
path: /{_locale}/admin/activitytype/
|
|
||||||
controller: Chill\ActivityBundle\Controller\ActivityTypeController::indexAction
|
|
||||||
options:
|
|
||||||
menus:
|
|
||||||
admin_activity:
|
|
||||||
order: 2020
|
|
||||||
label: "Activity Types"
|
|
||||||
|
|
||||||
chill_activity_activitytype_show:
|
|
||||||
path: /{_locale}/admin/activitytype/{id}/show
|
|
||||||
controller: Chill\ActivityBundle\Controller\ActivityTypeController::showAction
|
|
||||||
|
|
||||||
chill_activity_activitytype_new:
|
|
||||||
path: /{_locale}/admin/activitytype/new
|
|
||||||
controller: Chill\ActivityBundle\Controller\ActivityTypeController::newAction
|
|
||||||
|
|
||||||
chill_activity_activitytype_create:
|
|
||||||
path: /{_locale}/admin/activitytype/create
|
|
||||||
controller: Chill\ActivityBundle\Controller\ActivityTypeController::createAction
|
|
||||||
methods: POST
|
|
||||||
|
|
||||||
chill_activity_activitytype_edit:
|
|
||||||
path: /{_locale}/admin/activitytype/{id}/edit
|
|
||||||
controller: Chill\ActivityBundle\Controller\ActivityTypeController::editAction
|
|
||||||
|
|
||||||
chill_activity_activitytype_update:
|
|
||||||
path: /{_locale}/admin/activitytype/{id}/update
|
|
||||||
controller: Chill\ActivityBundle\Controller\ActivityTypeController::updateAction
|
|
||||||
methods: [POST, PUT]
|
|
||||||
|
|
||||||
chill_activity_activitytype_delete:
|
|
||||||
path: /{_locale}/admin/activitytype/{id}/delete
|
|
||||||
controller: Chill\ActivityBundle\Controller\ActivityTypeController::deleteAction
|
|
||||||
methods: [POST, DELETE]
|
|
@ -4,4 +4,5 @@ services:
|
|||||||
$eventDispatcher: '@Symfony\Component\EventDispatcher\EventDispatcherInterface'
|
$eventDispatcher: '@Symfony\Component\EventDispatcher\EventDispatcherInterface'
|
||||||
$authorizationHelper: '@Chill\MainBundle\Security\Authorization\AuthorizationHelper'
|
$authorizationHelper: '@Chill\MainBundle\Security\Authorization\AuthorizationHelper'
|
||||||
$logger: '@chill.main.logger'
|
$logger: '@chill.main.logger'
|
||||||
|
$serializer: '@Symfony\Component\Serializer\SerializerInterface'
|
||||||
tags: ['controller.service_arguments']
|
tags: ['controller.service_arguments']
|
||||||
|
@ -6,7 +6,7 @@ services:
|
|||||||
- "@request_stack"
|
- "@request_stack"
|
||||||
tags:
|
tags:
|
||||||
- { name: form.type, alias: translatable_activity_reason_category }
|
- { name: form.type, alias: translatable_activity_reason_category }
|
||||||
|
|
||||||
chill.activity.form.type.translatableactivityreason:
|
chill.activity.form.type.translatableactivityreason:
|
||||||
class: Chill\ActivityBundle\Form\Type\TranslatableActivityReason
|
class: Chill\ActivityBundle\Form\Type\TranslatableActivityReason
|
||||||
arguments:
|
arguments:
|
||||||
@ -14,7 +14,7 @@ services:
|
|||||||
$reasonRender: '@Chill\ActivityBundle\Templating\Entity\ActivityReasonRender'
|
$reasonRender: '@Chill\ActivityBundle\Templating\Entity\ActivityReasonRender'
|
||||||
tags:
|
tags:
|
||||||
- { name: form.type, alias: translatable_activity_reason }
|
- { name: form.type, alias: translatable_activity_reason }
|
||||||
|
|
||||||
chill.activity.form.type.translatableactivitytype:
|
chill.activity.form.type.translatableactivitytype:
|
||||||
class: Chill\ActivityBundle\Form\Type\TranslatableActivityType
|
class: Chill\ActivityBundle\Form\Type\TranslatableActivityType
|
||||||
arguments:
|
arguments:
|
||||||
@ -22,7 +22,7 @@ services:
|
|||||||
- "@chill_activity.repository.activity_type"
|
- "@chill_activity.repository.activity_type"
|
||||||
tags:
|
tags:
|
||||||
- { name: form.type, alias: translatable_activity_type }
|
- { name: form.type, alias: translatable_activity_type }
|
||||||
|
|
||||||
chill.activity.form.type.activity:
|
chill.activity.form.type.activity:
|
||||||
class: Chill\ActivityBundle\Form\ActivityType
|
class: Chill\ActivityBundle\Form\ActivityType
|
||||||
arguments:
|
arguments:
|
||||||
@ -31,5 +31,13 @@ services:
|
|||||||
- "@doctrine.orm.entity_manager"
|
- "@doctrine.orm.entity_manager"
|
||||||
- "@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'
|
||||||
tags:
|
tags:
|
||||||
- { name: form.type, alias: chill_activitybundle_activity }
|
- { name: form.type, alias: chill_activitybundle_activity }
|
||||||
|
|
||||||
|
chill.activity.form.type.activityTypeType:
|
||||||
|
class: Chill\ActivityBundle\Form\ActivityTypeType
|
||||||
|
arguments:
|
||||||
|
- "@chill.main.helper.translatable_string"
|
||||||
|
tags:
|
||||||
|
- { name: form.type, alias: translatable_activity_type }
|
||||||
|
@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Chill\Migrations\Activity;
|
||||||
|
|
||||||
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
|
use Doctrine\Migrations\AbstractMigration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Auto-generated Migration: Please modify to your needs!
|
||||||
|
*/
|
||||||
|
final class Version20210401090853 extends AbstractMigration
|
||||||
|
{
|
||||||
|
public function getDescription() : string
|
||||||
|
{
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function up(Schema $schema) : void
|
||||||
|
{
|
||||||
|
// this up() migration is auto-generated, please modify it to your needs
|
||||||
|
$this->addSql('CREATE SEQUENCE activitytypecategory_id_seq INCREMENT BY 1 MINVALUE 1 START 1000');
|
||||||
|
$this->addSql('CREATE TABLE activitytypecategory (id INT NOT NULL, name JSON NOT NULL, active BOOLEAN NOT NULL, PRIMARY KEY(id))');
|
||||||
|
$this->addSql('COMMENT ON COLUMN activitytypecategory.name IS \'(DC2Type:json_array)\'');
|
||||||
|
$this->addSql('INSERT INTO activitytypecategory VALUES(1, \'{"fr": "Défaut", "en": "Default"}\', true)');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema) : void
|
||||||
|
{
|
||||||
|
// this down() migration is auto-generated, please modify it to your needs
|
||||||
|
$this->addSql('DROP SEQUENCE activitytypecategory_id_seq CASCADE');
|
||||||
|
$this->addSql('DROP TABLE activitytypecategory');
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,93 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Chill\Migrations\Activity;
|
||||||
|
|
||||||
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
|
use Doctrine\Migrations\AbstractMigration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Auto-generated Migration: Please modify to your needs!
|
||||||
|
*/
|
||||||
|
final class Version20210408122329 extends AbstractMigration
|
||||||
|
{
|
||||||
|
public function getDescription() : string
|
||||||
|
{
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function up(Schema $schema) : void
|
||||||
|
{
|
||||||
|
$this->addSql('ALTER TABLE activitytype ADD personVisible SMALLINT DEFAULT 2 NOT NULL');
|
||||||
|
$this->addSql('ALTER TABLE activitytype ADD personLabel VARCHAR(255) DEFAULT \'\' NOT NULL');
|
||||||
|
$this->addSql('ALTER TABLE activitytype ADD userVisible SMALLINT DEFAULT 2 NOT NULL');
|
||||||
|
$this->addSql('ALTER TABLE activitytype ADD userLabel VARCHAR(255) DEFAULT \'\' NOT NULL');
|
||||||
|
$this->addSql('ALTER TABLE activitytype ADD dateVisible SMALLINT DEFAULT 2 NOT NULL');
|
||||||
|
$this->addSql('ALTER TABLE activitytype ADD dateLabel VARCHAR(255) DEFAULT \'\' NOT NULL');
|
||||||
|
$this->addSql('ALTER TABLE activitytype ADD placeVisible SMALLINT DEFAULT 1 NOT NULL');
|
||||||
|
$this->addSql('ALTER TABLE activitytype ADD placeLabel VARCHAR(255) DEFAULT \'\' NOT NULL');
|
||||||
|
$this->addSql('ALTER TABLE activitytype ADD personsVisible SMALLINT DEFAULT 1 NOT NULL');
|
||||||
|
$this->addSql('ALTER TABLE activitytype ADD personsLabel VARCHAR(255) DEFAULT \'\' NOT NULL');
|
||||||
|
$this->addSql('ALTER TABLE activitytype ADD thirdpartyVisible SMALLINT DEFAULT 1 NOT NULL');
|
||||||
|
$this->addSql('ALTER TABLE activitytype ADD thirdpartyLabel VARCHAR(255) DEFAULT \'\' NOT NULL');
|
||||||
|
$this->addSql('ALTER TABLE activitytype ADD durationTimeVisible SMALLINT DEFAULT 1 NOT NULL');
|
||||||
|
$this->addSql('ALTER TABLE activitytype ADD durationTimeLabel VARCHAR(255) DEFAULT \'\' NOT NULL');
|
||||||
|
$this->addSql('ALTER TABLE activitytype ADD attendeeVisible SMALLINT DEFAULT 1 NOT NULL');
|
||||||
|
$this->addSql('ALTER TABLE activitytype ADD attendeeLabel VARCHAR(255) DEFAULT \'\' NOT NULL');
|
||||||
|
$this->addSql('ALTER TABLE activitytype ADD reasonsVisible SMALLINT DEFAULT 1 NOT NULL');
|
||||||
|
$this->addSql('ALTER TABLE activitytype ADD reasonsLabel VARCHAR(255) DEFAULT \'\' NOT NULL');
|
||||||
|
$this->addSql('ALTER TABLE activitytype ADD commentVisible SMALLINT DEFAULT 1 NOT NULL');
|
||||||
|
$this->addSql('ALTER TABLE activitytype ADD commentLabel VARCHAR(255) DEFAULT \'\' NOT NULL');
|
||||||
|
$this->addSql('ALTER TABLE activitytype ADD sentReceivedVisible SMALLINT DEFAULT 1 NOT NULL');
|
||||||
|
$this->addSql('ALTER TABLE activitytype ADD sentReceivedLabel VARCHAR(255) DEFAULT \'\' NOT NULL');
|
||||||
|
$this->addSql('ALTER TABLE activitytype ADD documentVisible SMALLINT DEFAULT 1 NOT NULL');
|
||||||
|
$this->addSql('ALTER TABLE activitytype ADD documentLabel VARCHAR(255) DEFAULT \'\' NOT NULL');
|
||||||
|
$this->addSql('ALTER TABLE activitytype ADD emergencyVisible SMALLINT DEFAULT 1 NOT NULL');
|
||||||
|
$this->addSql('ALTER TABLE activitytype ADD emergencyLabel VARCHAR(255) DEFAULT \'\' NOT NULL');
|
||||||
|
$this->addSql('ALTER TABLE activitytype ADD accompanyingPeriodVisible SMALLINT DEFAULT 1 NOT NULL');
|
||||||
|
$this->addSql('ALTER TABLE activitytype ADD accompanyingPeriodLabel VARCHAR(255) DEFAULT \'\' NOT NULL');
|
||||||
|
$this->addSql('ALTER TABLE activitytype ADD socialDataVisible SMALLINT DEFAULT 1 NOT NULL');
|
||||||
|
$this->addSql('ALTER TABLE activitytype ADD socialDataLabel VARCHAR(255) DEFAULT \'\' NOT NULL');
|
||||||
|
$this->addSql('ALTER TABLE activitytype ALTER name SET NOT NULL');
|
||||||
|
$this->addSql('ALTER TABLE activitytype ALTER active DROP DEFAULT');
|
||||||
|
$this->addSql('COMMENT ON COLUMN activitytype.name IS \'(DC2Type:json_array)\'');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema) : void
|
||||||
|
{
|
||||||
|
$this->addSql('ALTER TABLE activitytype DROP personVisible');
|
||||||
|
$this->addSql('ALTER TABLE activitytype DROP personLabel');
|
||||||
|
$this->addSql('ALTER TABLE activitytype DROP userVisible');
|
||||||
|
$this->addSql('ALTER TABLE activitytype DROP userLabel');
|
||||||
|
$this->addSql('ALTER TABLE activitytype DROP dateVisible');
|
||||||
|
$this->addSql('ALTER TABLE activitytype DROP dateLabel');
|
||||||
|
$this->addSql('ALTER TABLE activitytype DROP placeVisible');
|
||||||
|
$this->addSql('ALTER TABLE activitytype DROP placeLabel');
|
||||||
|
$this->addSql('ALTER TABLE activitytype DROP personsVisible');
|
||||||
|
$this->addSql('ALTER TABLE activitytype DROP personsLabel');
|
||||||
|
$this->addSql('ALTER TABLE activitytype DROP thirdpartyVisible');
|
||||||
|
$this->addSql('ALTER TABLE activitytype DROP thirdpartyLabel');
|
||||||
|
$this->addSql('ALTER TABLE activitytype DROP durationTimeVisible');
|
||||||
|
$this->addSql('ALTER TABLE activitytype DROP durationTimeLabel');
|
||||||
|
$this->addSql('ALTER TABLE activitytype DROP attendeeVisible');
|
||||||
|
$this->addSql('ALTER TABLE activitytype DROP attendeeLabel');
|
||||||
|
$this->addSql('ALTER TABLE activitytype DROP reasonsVisible');
|
||||||
|
$this->addSql('ALTER TABLE activitytype DROP reasonsLabel');
|
||||||
|
$this->addSql('ALTER TABLE activitytype DROP commentVisible');
|
||||||
|
$this->addSql('ALTER TABLE activitytype DROP commentLabel');
|
||||||
|
$this->addSql('ALTER TABLE activitytype DROP sentReceivedVisible');
|
||||||
|
$this->addSql('ALTER TABLE activitytype DROP sentReceivedLabel');
|
||||||
|
$this->addSql('ALTER TABLE activitytype DROP documentVisible');
|
||||||
|
$this->addSql('ALTER TABLE activitytype DROP documentLabel');
|
||||||
|
$this->addSql('ALTER TABLE activitytype DROP emergencyVisible');
|
||||||
|
$this->addSql('ALTER TABLE activitytype DROP emergencyLabel');
|
||||||
|
$this->addSql('ALTER TABLE activitytype DROP accompanyingPeriodVisible');
|
||||||
|
$this->addSql('ALTER TABLE activitytype DROP accompanyingPeriodLabel');
|
||||||
|
$this->addSql('ALTER TABLE activitytype DROP socialDataVisible');
|
||||||
|
$this->addSql('ALTER TABLE activitytype DROP socialDataLabel');
|
||||||
|
$this->addSql('ALTER TABLE activitytype ALTER name DROP NOT NULL');
|
||||||
|
$this->addSql('ALTER TABLE activitytype ALTER active SET DEFAULT \'true\'');
|
||||||
|
$this->addSql('COMMENT ON COLUMN activitytype.name IS NULL');
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,43 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Chill\Migrations\Activity;
|
||||||
|
|
||||||
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
|
use Doctrine\Migrations\AbstractMigration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Auto-generated Migration: Please modify to your needs!
|
||||||
|
*/
|
||||||
|
final class Version20210415113216 extends AbstractMigration
|
||||||
|
{
|
||||||
|
public function getDescription() : string
|
||||||
|
{
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function up(Schema $schema) : void
|
||||||
|
{
|
||||||
|
$this->addSql('ALTER TABLE activitytype ADD thirdPartiesVisible SMALLINT DEFAULT 1 NOT NULL');
|
||||||
|
$this->addSql('ALTER TABLE activitytype ADD thirdPartiesLabel VARCHAR(255) DEFAULT \'\' NOT NULL');
|
||||||
|
$this->addSql('ALTER TABLE activitytype ADD documentsVisible SMALLINT DEFAULT 1 NOT NULL');
|
||||||
|
$this->addSql('ALTER TABLE activitytype ADD documentsLabel VARCHAR(255) DEFAULT \'\' NOT NULL');
|
||||||
|
$this->addSql('ALTER TABLE activitytype DROP thirdpartyvisible');
|
||||||
|
$this->addSql('ALTER TABLE activitytype DROP thirdpartylabel');
|
||||||
|
$this->addSql('ALTER TABLE activitytype DROP documentvisible');
|
||||||
|
$this->addSql('ALTER TABLE activitytype DROP documentlabel');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema) : void
|
||||||
|
{
|
||||||
|
$this->addSql('ALTER TABLE activitytype ADD thirdpartyvisible SMALLINT DEFAULT 1 NOT NULL');
|
||||||
|
$this->addSql('ALTER TABLE activitytype ADD thirdpartylabel VARCHAR(255) DEFAULT \'\' NOT NULL');
|
||||||
|
$this->addSql('ALTER TABLE activitytype ADD documentvisible SMALLINT DEFAULT 1 NOT NULL');
|
||||||
|
$this->addSql('ALTER TABLE activitytype ADD documentlabel VARCHAR(255) DEFAULT \'\' NOT NULL');
|
||||||
|
$this->addSql('ALTER TABLE activitytype DROP thirdPartiesVisible');
|
||||||
|
$this->addSql('ALTER TABLE activitytype DROP thirdPartiesLabel');
|
||||||
|
$this->addSql('ALTER TABLE activitytype DROP documentsVisible');
|
||||||
|
$this->addSql('ALTER TABLE activitytype DROP documentsLabel');
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,52 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Chill\Migrations\Activity;
|
||||||
|
|
||||||
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
|
use Doctrine\Migrations\AbstractMigration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Auto-generated Migration: Please modify to your needs!
|
||||||
|
*/
|
||||||
|
final class Version20210422073711 extends AbstractMigration
|
||||||
|
{
|
||||||
|
public function getDescription() : string
|
||||||
|
{
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function up(Schema $schema) : void
|
||||||
|
{
|
||||||
|
$this->addSql('CREATE SEQUENCE activitytpresence_id_seq INCREMENT BY 1 MINVALUE 1 START 6');
|
||||||
|
$this->addSql('CREATE TABLE activitytpresence (id INT NOT NULL, name JSON NOT NULL, active BOOLEAN NOT NULL, PRIMARY KEY(id))');
|
||||||
|
|
||||||
|
$list = [
|
||||||
|
'Usager pésent', "Absence de l''usager",
|
||||||
|
"Refus de visite ou d''entretien", 'Domicile non trouvé',
|
||||||
|
'Domicile erronéee'
|
||||||
|
];
|
||||||
|
for ($i = 1; $i <= count($list); $i++) {
|
||||||
|
$this->addSql("INSERT INTO activitytpresence VALUES(".$i.", json_build_object('fr', '".$list[$i-1]."'), true)");
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->addSql('ALTER TABLE activity ADD emergency BOOLEAN NOT NULL DEFAULT false');
|
||||||
|
$this->addSql('ALTER TABLE activity ADD sentReceived VARCHAR(255) NOT NULL DEFAULT \'\' ');
|
||||||
|
$this->addSql('ALTER TABLE activity ALTER attendee TYPE INT USING CASE WHEN attendee is false THEN 2 WHEN attendee is true THEN 1 ELSE null END');
|
||||||
|
$this->addSql('ALTER TABLE activity RENAME COLUMN attendee TO attendee_id');
|
||||||
|
$this->addSql('ALTER TABLE activity ADD CONSTRAINT FK_AC74095ABCFD782A FOREIGN KEY (attendee_id) REFERENCES activitytpresence (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema) : void
|
||||||
|
{
|
||||||
|
$this->addSql('ALTER TABLE activity DROP emergency');
|
||||||
|
$this->addSql('ALTER TABLE activity DROP CONSTRAINT FK_AC74095ABCFD782A');
|
||||||
|
$this->addSql('ALTER TABLE activity ADD attendee BOOLEAN DEFAULT NULL');
|
||||||
|
$this->addSql('ALTER TABLE activity DROP attendee_id');
|
||||||
|
$this->addSql('ALTER TABLE activity DROP sentReceived');
|
||||||
|
|
||||||
|
$this->addSql('DROP SEQUENCE activitytpresence_id_seq CASCADE');
|
||||||
|
$this->addSql('DROP TABLE activitytpresence');
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,65 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Chill\Migrations\Activity;
|
||||||
|
|
||||||
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
|
use Doctrine\Migrations\AbstractMigration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Auto-generated Migration: Please modify to your needs!
|
||||||
|
*/
|
||||||
|
final class Version20210422123846 extends AbstractMigration
|
||||||
|
{
|
||||||
|
public function getDescription() : string
|
||||||
|
{
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function up(Schema $schema) : void
|
||||||
|
{
|
||||||
|
$this->addSql('CREATE TABLE activity_person (activity_id INT NOT NULL, person_id INT NOT NULL, PRIMARY KEY(activity_id, person_id))');
|
||||||
|
$this->addSql('CREATE INDEX IDX_66AA317681C06096 ON activity_person (activity_id)');
|
||||||
|
$this->addSql('CREATE INDEX IDX_66AA3176217BBB47 ON activity_person (person_id)');
|
||||||
|
$this->addSql('CREATE TABLE activity_thirdparty (activity_id INT NOT NULL, thirdparty_id INT NOT NULL, PRIMARY KEY(activity_id, thirdparty_id))');
|
||||||
|
$this->addSql('CREATE INDEX IDX_C6F0DE0381C06096 ON activity_thirdparty (activity_id)');
|
||||||
|
$this->addSql('CREATE INDEX IDX_C6F0DE03C7D3A8E6 ON activity_thirdparty (thirdparty_id)');
|
||||||
|
$this->addSql('CREATE TABLE activity_document (activity_id INT NOT NULL, document_id INT NOT NULL, PRIMARY KEY(activity_id, document_id))');
|
||||||
|
$this->addSql('CREATE INDEX IDX_78633A7881C06096 ON activity_document (activity_id)');
|
||||||
|
$this->addSql('CREATE INDEX IDX_78633A78C33F7837 ON activity_document (document_id)');
|
||||||
|
$this->addSql('CREATE TABLE activity_user (activity_id INT NOT NULL, user_id INT NOT NULL, PRIMARY KEY(activity_id, user_id))');
|
||||||
|
$this->addSql('CREATE INDEX IDX_8E570DDB81C06096 ON activity_user (activity_id)');
|
||||||
|
$this->addSql('CREATE INDEX IDX_8E570DDBA76ED395 ON activity_user (user_id)');
|
||||||
|
$this->addSql('ALTER TABLE activity_person ADD CONSTRAINT FK_66AA317681C06096 FOREIGN KEY (activity_id) REFERENCES activity (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||||
|
$this->addSql('ALTER TABLE activity_person ADD CONSTRAINT FK_66AA3176217BBB47 FOREIGN KEY (person_id) REFERENCES chill_person_person (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||||
|
$this->addSql('ALTER TABLE activity_thirdparty ADD CONSTRAINT FK_C6F0DE0381C06096 FOREIGN KEY (activity_id) REFERENCES activity (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||||
|
$this->addSql('ALTER TABLE activity_thirdparty ADD CONSTRAINT FK_C6F0DE03C7D3A8E6 FOREIGN KEY (thirdparty_id) REFERENCES chill_3party.third_party (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||||
|
$this->addSql('ALTER TABLE activity_document ADD CONSTRAINT FK_78633A7881C06096 FOREIGN KEY (activity_id) REFERENCES activity (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||||
|
#$this->addSql('ALTER TABLE activity_document ADD CONSTRAINT FK_78633A78C33F7837 FOREIGN KEY (document_id) REFERENCES Document (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||||
|
$this->addSql('ALTER TABLE activity_user ADD CONSTRAINT FK_8E570DDB81C06096 FOREIGN KEY (activity_id) REFERENCES activity (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||||
|
$this->addSql('ALTER TABLE activity_user ADD CONSTRAINT FK_8E570DDBA76ED395 FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||||
|
|
||||||
|
$this->addSql('ALTER TABLE activity ADD travelTime TIME(0) WITHOUT TIME ZONE DEFAULT NULL');
|
||||||
|
|
||||||
|
$this->addSql('ALTER TABLE activitytype ADD travelTimeVisible SMALLINT DEFAULT 1 NOT NULL');
|
||||||
|
$this->addSql('ALTER TABLE activitytype ADD travelTimeLabel VARCHAR(255) DEFAULT \'\' NOT NULL');
|
||||||
|
$this->addSql('ALTER TABLE activitytype ADD usersVisible SMALLINT DEFAULT 1 NOT NULL');
|
||||||
|
$this->addSql('ALTER TABLE activitytype ADD usersLabel VARCHAR(255) DEFAULT \'\' NOT NULL');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema) : void
|
||||||
|
{
|
||||||
|
$this->addSql('DROP TABLE activity_person');
|
||||||
|
$this->addSql('DROP TABLE activity_thirdparty');
|
||||||
|
$this->addSql('DROP TABLE activity_document');
|
||||||
|
$this->addSql('DROP TABLE activity_user');
|
||||||
|
|
||||||
|
$this->addSql('ALTER TABLE activity DROP travelTime');
|
||||||
|
|
||||||
|
$this->addSql('ALTER TABLE activitytype DROP travelTimeVisible');
|
||||||
|
$this->addSql('ALTER TABLE activitytype DROP travelTimeLabel');
|
||||||
|
$this->addSql('ALTER TABLE activitytype DROP usersVisible');
|
||||||
|
$this->addSql('ALTER TABLE activitytype DROP usersLabel');
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Chill\Migrations\Activity;
|
||||||
|
|
||||||
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
|
use Doctrine\Migrations\AbstractMigration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Auto-generated Migration: Please modify to your needs!
|
||||||
|
*/
|
||||||
|
final class Version20210506071150 extends AbstractMigration
|
||||||
|
{
|
||||||
|
public function getDescription() : string
|
||||||
|
{
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function up(Schema $schema) : void
|
||||||
|
{
|
||||||
|
// this up() migration is auto-generated, please modify it to your needs
|
||||||
|
$this->addSql('ALTER TABLE activity ALTER durationtime DROP NOT NULL');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema) : void
|
||||||
|
{
|
||||||
|
$this->addSql('ALTER TABLE activity ALTER durationTime SET NOT NULL');
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Chill\Migrations\Activity;
|
||||||
|
|
||||||
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
|
use Doctrine\Migrations\AbstractMigration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Auto-generated Migration: Please modify to your needs!
|
||||||
|
*/
|
||||||
|
final class Version20210506090417 extends AbstractMigration
|
||||||
|
{
|
||||||
|
public function up(Schema $schema) : void
|
||||||
|
{
|
||||||
|
$this->addSql('ALTER TABLE activitytype ADD ordering DOUBLE PRECISION DEFAULT \'0.0\' NOT NULL');
|
||||||
|
$this->addSql('ALTER TABLE activitytypecategory ADD ordering DOUBLE PRECISION DEFAULT \'0.0\' NOT NULL');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema) : void
|
||||||
|
{
|
||||||
|
$this->addSql('ALTER TABLE activitytypecategory DROP ordering');
|
||||||
|
$this->addSql('ALTER TABLE activitytype DROP ordering');
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Chill\Migrations\Activity;
|
||||||
|
|
||||||
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
|
use Doctrine\Migrations\AbstractMigration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Auto-generated Migration: Please modify to your needs!
|
||||||
|
*/
|
||||||
|
final class Version20210506094520 extends AbstractMigration
|
||||||
|
{
|
||||||
|
public function getDescription() : string
|
||||||
|
{
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function up(Schema $schema) : void
|
||||||
|
{
|
||||||
|
$this->addSql('ALTER TABLE activitytype ADD category_id INT DEFAULT 1');
|
||||||
|
$this->addSql('ALTER TABLE activitytype ADD CONSTRAINT FK_B38CD05112469DE2 FOREIGN KEY (category_id) REFERENCES activitytypecategory (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema) : void
|
||||||
|
{
|
||||||
|
$this->addSql('ALTER TABLE activitytype DROP CONSTRAINT FK_B38CD05112469DE2');;
|
||||||
|
$this->addSql('ALTER TABLE activitytype DROP category_id');
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,42 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Chill\Migrations\Activity;
|
||||||
|
|
||||||
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
|
use Doctrine\Migrations\AbstractMigration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Auto-generated Migration: Please modify to your needs!
|
||||||
|
*/
|
||||||
|
final class Version20210506112500 extends AbstractMigration
|
||||||
|
{
|
||||||
|
public function getDescription() : string
|
||||||
|
{
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function up(Schema $schema) : void
|
||||||
|
{
|
||||||
|
// this up() migration is auto-generated, please modify it to your needs
|
||||||
|
$this->addSql('CREATE TABLE activity_storedobject (activity_id INT NOT NULL, storedobject_id INT NOT NULL, PRIMARY KEY(activity_id, storedobject_id))');
|
||||||
|
$this->addSql('CREATE INDEX IDX_6F660E9381C06096 ON activity_storedobject (activity_id)');
|
||||||
|
$this->addSql('CREATE INDEX IDX_6F660E93EE684399 ON activity_storedobject (storedobject_id)');
|
||||||
|
$this->addSql('ALTER TABLE activity_storedobject ADD CONSTRAINT FK_6F660E9381C06096 FOREIGN KEY (activity_id) REFERENCES activity (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||||
|
$this->addSql('ALTER TABLE activity_storedobject ADD CONSTRAINT FK_6F660E93EE684399 FOREIGN KEY (storedobject_id) REFERENCES chill_doc.stored_object (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||||
|
$this->addSql('DROP TABLE activity_document');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema) : void
|
||||||
|
{
|
||||||
|
// this down() migration is auto-generated, please modify it to your needs
|
||||||
|
$this->addSql('CREATE SCHEMA public');
|
||||||
|
$this->addSql('CREATE TABLE activity_document (activity_id INT NOT NULL, document_id INT NOT NULL, PRIMARY KEY(activity_id, document_id))');
|
||||||
|
$this->addSql('CREATE INDEX idx_78633a78c33f7837 ON activity_document (document_id)');
|
||||||
|
$this->addSql('CREATE INDEX idx_78633a7881c06096 ON activity_document (activity_id)');
|
||||||
|
$this->addSql('ALTER TABLE activity_document ADD CONSTRAINT fk_78633a7881c06096 FOREIGN KEY (activity_id) REFERENCES activity (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||||
|
$this->addSql('DROP TABLE activity_storedobject');
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Chill\Migrations\Activity;
|
||||||
|
|
||||||
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
|
use Doctrine\Migrations\AbstractMigration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Auto-generated Migration: Please modify to your needs!
|
||||||
|
*/
|
||||||
|
final class Version20210520095626 extends AbstractMigration
|
||||||
|
{
|
||||||
|
public function getDescription(): string
|
||||||
|
{
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function up(Schema $schema): void
|
||||||
|
{
|
||||||
|
$this->addSql('ALTER TABLE activity ADD accompanyingPeriod_id INT DEFAULT NULL');
|
||||||
|
$this->addSql('ALTER TABLE activity ADD CONSTRAINT FK_AC74095AD7FA8EF0 FOREIGN KEY (accompanyingPeriod_id) REFERENCES chill_person_accompanying_period (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema): void
|
||||||
|
{
|
||||||
|
$this->addSql('ALTER TABLE activity DROP CONSTRAINT FK_AC74095AD7FA8EF0');
|
||||||
|
$this->addSql('ALTER TABLE activity DROP accompanyingPeriod_id');
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,39 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Chill\Migrations\Activity;
|
||||||
|
|
||||||
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
|
use Doctrine\Migrations\AbstractMigration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add socialIssues & socialActions fields to Activity
|
||||||
|
*/
|
||||||
|
final class Version20210528161250 extends AbstractMigration
|
||||||
|
{
|
||||||
|
public function getDescription(): string
|
||||||
|
{
|
||||||
|
return 'Add socialIssues & socialActions fields to Activity';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function up(Schema $schema): void
|
||||||
|
{
|
||||||
|
$this->addSql('CREATE TABLE chill_activity_activity_chill_person_socialissue (activity_id INT NOT NULL, socialissue_id INT NOT NULL, PRIMARY KEY(activity_id, socialissue_id))');
|
||||||
|
$this->addSql('CREATE INDEX IDX_3DA33F2681C06096 ON chill_activity_activity_chill_person_socialissue (activity_id)');
|
||||||
|
$this->addSql('CREATE INDEX IDX_3DA33F26A549916C ON chill_activity_activity_chill_person_socialissue (socialissue_id)');
|
||||||
|
$this->addSql('CREATE TABLE chill_activity_activity_chill_person_socialaction (activity_id INT NOT NULL, socialaction_id INT NOT NULL, PRIMARY KEY(activity_id, socialaction_id))');
|
||||||
|
$this->addSql('CREATE INDEX IDX_548F1AD881C06096 ON chill_activity_activity_chill_person_socialaction (activity_id)');
|
||||||
|
$this->addSql('CREATE INDEX IDX_548F1AD83DC32179 ON chill_activity_activity_chill_person_socialaction (socialaction_id)');
|
||||||
|
$this->addSql('ALTER TABLE chill_activity_activity_chill_person_socialissue ADD CONSTRAINT FK_3DA33F2681C06096 FOREIGN KEY (activity_id) REFERENCES activity (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||||
|
$this->addSql('ALTER TABLE chill_activity_activity_chill_person_socialissue ADD CONSTRAINT FK_3DA33F26A549916C FOREIGN KEY (socialissue_id) REFERENCES chill_person_social_issue (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||||
|
$this->addSql('ALTER TABLE chill_activity_activity_chill_person_socialaction ADD CONSTRAINT FK_548F1AD881C06096 FOREIGN KEY (activity_id) REFERENCES activity (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||||
|
$this->addSql('ALTER TABLE chill_activity_activity_chill_person_socialaction ADD CONSTRAINT FK_548F1AD83DC32179 FOREIGN KEY (socialaction_id) REFERENCES chill_person_social_action (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema): void
|
||||||
|
{
|
||||||
|
$this->addSql('DROP TABLE chill_activity_activity_chill_person_socialissue');
|
||||||
|
$this->addSql('DROP TABLE chill_activity_activity_chill_person_socialaction');
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Chill\Migrations\Activity;
|
||||||
|
|
||||||
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
|
use Doctrine\Migrations\AbstractMigration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add info for socialIssues & socialActions in ActivityType
|
||||||
|
*/
|
||||||
|
final class Version20210602103243 extends AbstractMigration
|
||||||
|
{
|
||||||
|
public function getDescription(): string
|
||||||
|
{
|
||||||
|
return 'Add info for socialIssues & socialActions in ActivityType';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function up(Schema $schema): void
|
||||||
|
{
|
||||||
|
$this->addSql('ALTER TABLE activitytype ADD socialIssuesVisible SMALLINT DEFAULT 1 NOT NULL');
|
||||||
|
$this->addSql('ALTER TABLE activitytype ADD socialIssuesLabel VARCHAR(255) DEFAULT \'\' NOT NULL');
|
||||||
|
$this->addSql('ALTER TABLE activitytype ADD socialActionsVisible SMALLINT DEFAULT 1 NOT NULL');
|
||||||
|
$this->addSql('ALTER TABLE activitytype ADD socialActionsLabel VARCHAR(255) DEFAULT \'\' NOT NULL');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema): void
|
||||||
|
{
|
||||||
|
$this->addSql('ALTER TABLE activitytype DROP socialIssuesVisible');
|
||||||
|
$this->addSql('ALTER TABLE activitytype DROP socialIssuesLabel');
|
||||||
|
$this->addSql('ALTER TABLE activitytype DROP socialActionsVisible');
|
||||||
|
$this->addSql('ALTER TABLE activitytype DROP socialActionsLabel');
|
||||||
|
}
|
||||||
|
}
|
@ -5,6 +5,7 @@ Activity: Activité
|
|||||||
Duration time: Durée
|
Duration time: Durée
|
||||||
Duration Time: Durée
|
Duration Time: Durée
|
||||||
durationTime: durée
|
durationTime: durée
|
||||||
|
Travel time: Durée de déplacement
|
||||||
Reasons: Sujets
|
Reasons: Sujets
|
||||||
Attendee: Présence de la personne
|
Attendee: Présence de la personne
|
||||||
attendee: présence de la personne
|
attendee: présence de la personne
|
||||||
@ -19,16 +20,30 @@ present: présent
|
|||||||
not present: absent
|
not present: absent
|
||||||
Delete: Supprimer
|
Delete: Supprimer
|
||||||
Update: Mettre à jour
|
Update: Mettre à jour
|
||||||
Update activity: Édition de l'activité
|
Update activity: Modifier l'activité
|
||||||
Scope: Cercle
|
Scope: Cercle
|
||||||
Activity data: Données de l'activité
|
Activity data: Données de l'activité
|
||||||
No reason associated: Aucun sujet
|
No reason associated: Aucun sujet
|
||||||
|
No social issues associated: Aucune problématique sociale
|
||||||
|
No social actions associated: Aucune action d'accompagnement
|
||||||
There isn't any activities.: Aucune activité enregistrée.
|
There isn't any activities.: Aucune activité enregistrée.
|
||||||
type_name: type de l'activité
|
type_name: type de l'activité
|
||||||
person_firstname: prénom
|
person_firstname: prénom
|
||||||
person_lastname: nom de famille
|
person_lastname: nom de famille
|
||||||
person_id: identifiant de la personne
|
person_id: identifiant de la personne
|
||||||
Type: Type
|
Type: Type
|
||||||
|
Invisible: Invisible
|
||||||
|
Optional: Optionnel
|
||||||
|
Required: Obligatoire
|
||||||
|
Persons: Personnes
|
||||||
|
Users: Utilisateurs
|
||||||
|
Emergency: Urgent
|
||||||
|
Sent received: Envoyer / Recevoir
|
||||||
|
Sent: Envoyer
|
||||||
|
Received: Recevoir
|
||||||
|
by: 'Par '
|
||||||
|
location: Lieu
|
||||||
|
|
||||||
|
|
||||||
#forms
|
#forms
|
||||||
Activity creation: Nouvelle activité
|
Activity creation: Nouvelle activité
|
||||||
@ -50,6 +65,15 @@ Choose a type: Choisir un type
|
|||||||
1 hour 30: 1 heure 30
|
1 hour 30: 1 heure 30
|
||||||
1 hour 45: 1 heure 45
|
1 hour 45: 1 heure 45
|
||||||
2 hours: 2 heures
|
2 hours: 2 heures
|
||||||
|
Concerned groups: Parties concernées
|
||||||
|
Persons in accompanying course: Usagers du parcours
|
||||||
|
Third persons: Tiers non-pro.
|
||||||
|
Others persons: Usagers
|
||||||
|
Third parties: Tiers professionnels
|
||||||
|
Users concerned: T(M)S
|
||||||
|
activity:
|
||||||
|
Insert a document: Insérer un document
|
||||||
|
Remove a document: Supprimer le document
|
||||||
|
|
||||||
|
|
||||||
#timeline
|
#timeline
|
||||||
@ -77,6 +101,16 @@ Activity configuration menu: Configuration des activités
|
|||||||
Activity Types: Types d'activité
|
Activity Types: Types d'activité
|
||||||
Activity Reasons: Sujets d'une activité
|
Activity Reasons: Sujets d'une activité
|
||||||
Activity Reasons Category: Catégories de sujet d'activités
|
Activity Reasons Category: Catégories de sujet d'activités
|
||||||
|
Activity Types Categories: Catégories des types d'activité
|
||||||
|
|
||||||
|
# Crud
|
||||||
|
crud:
|
||||||
|
activity_type:
|
||||||
|
title_new: Nouveau type d'activité
|
||||||
|
title_edit: Edition d'un type d'activité
|
||||||
|
activity_type_category:
|
||||||
|
title_new: Nouvelle catégorie de type d'activité
|
||||||
|
title_edit: Edition d'une catégorie de type d'activité
|
||||||
|
|
||||||
# activity reason admin
|
# activity reason admin
|
||||||
ActivityReason list: Liste des sujets
|
ActivityReason list: Liste des sujets
|
||||||
@ -98,12 +132,41 @@ ActivityReasonCategory: Catégorie de sujet d'activité
|
|||||||
ActivityReasonCategory is active and will be proposed: La catégorie est active et sera proposée
|
ActivityReasonCategory is active and will be proposed: La catégorie est active et sera proposée
|
||||||
ActivityReasonCategory is inactive and won't be proposed: La catégorie est inactive et ne sera pas proposée
|
ActivityReasonCategory is inactive and won't be proposed: La catégorie est inactive et ne sera pas proposée
|
||||||
|
|
||||||
# activity type admin
|
# activity type type admin
|
||||||
ActivityType list: Types d'activités
|
ActivityType list: Types d'activités
|
||||||
Create a new activity type: Créer un nouveau type d'activité
|
Create a new activity type: Créer un nouveau type d'activité
|
||||||
ActivityType creation: Nouveau type d'activité
|
Persons visible: Visibilté du champ Personnes
|
||||||
ActivityType: Type d'activité
|
Persons label: Libellé du champ Personnes
|
||||||
ActivityType edit: Modifier une activité
|
User visible: Visibilté du champ Utilisateur
|
||||||
|
User label: Libellé du champ Utilisateur
|
||||||
|
Date visible: Visibilté du champ Date
|
||||||
|
Date label: Libellé du champ Date
|
||||||
|
Place visible: Visibilté du champ Lieu
|
||||||
|
Place label: Libellé du champ Lieu
|
||||||
|
Third parties visible: Visibilté du champ Tiers
|
||||||
|
Third parties label: Libellé du champ Tiers
|
||||||
|
Duration time visible: Visibilté du champ Durée
|
||||||
|
Duration time label: Libellé du champ Durée
|
||||||
|
Travel time visible: Visibilté du champ Durée de déplacement
|
||||||
|
Travel time label: Libellé du champ Durée de déplacement
|
||||||
|
Attendee visible: Visibilté du champ Présence de l'usager
|
||||||
|
Attendee label: Libellé du champ Présence de l'usager
|
||||||
|
Reasons visible: Visibilté du champ Sujet
|
||||||
|
Reasons label: Libellé du champ Sujet
|
||||||
|
Comment visible: Visibilté du champ Commentaire
|
||||||
|
Comment label: Libellé du champ Commentaire
|
||||||
|
Emergency visible: Visibilté du champ Urgent
|
||||||
|
Emergency label: Libellé du champ Urgent
|
||||||
|
Accompanying period visible: Visibilté du champ Période d'accompagnement
|
||||||
|
Accompanying period label: Libellé du champ Période d'accompagnement
|
||||||
|
Social data visible: Visibilté du champ Données sociales
|
||||||
|
Social data label: Libellé du champ Données sociales
|
||||||
|
Users visible: Visibilté du champ Utilisateurs
|
||||||
|
Users label: Libellé du champ Utilisateurs
|
||||||
|
|
||||||
|
# activity type category admin
|
||||||
|
ActivityTypeCategory list: Liste des catégories des types d'activité
|
||||||
|
Create a new activity type category: Créer une nouvelle catégorie de type d'activité
|
||||||
|
|
||||||
# activity delete
|
# activity delete
|
||||||
Remove activity: Supprimer une activité
|
Remove activity: Supprimer une activité
|
||||||
|
@ -37,6 +37,11 @@ class CommentEmbeddable
|
|||||||
return $this->comment;
|
return $this->comment;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function isEmpty()
|
||||||
|
{
|
||||||
|
return empty($this->getComment());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $comment
|
* @param string $comment
|
||||||
*/
|
*/
|
||||||
|
@ -23,9 +23,9 @@ use Symfony\Component\Form\AbstractType;
|
|||||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\DateType;
|
|
||||||
use Chill\MainBundle\Entity\Address;
|
use Chill\MainBundle\Entity\Address;
|
||||||
use Chill\MainBundle\Form\Type\PostalCodeType;
|
use Chill\MainBundle\Form\Type\PostalCodeType;
|
||||||
|
use Chill\MainBundle\Form\Type\ChillDateType;
|
||||||
use Chill\MainBundle\Form\DataMapper\AddressDataMapper;
|
use Chill\MainBundle\Form\DataMapper\AddressDataMapper;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||||
|
|
||||||
@ -60,10 +60,8 @@ class AddressType extends AbstractType
|
|||||||
|
|
||||||
if ($options['has_valid_from']) {
|
if ($options['has_valid_from']) {
|
||||||
$builder
|
$builder
|
||||||
->add('validFrom', DateType::class, array(
|
->add('validFrom', ChillDateType::class, array(
|
||||||
'required' => true,
|
'required' => true,
|
||||||
'widget' => 'single_text',
|
|
||||||
'format' => 'dd-MM-yyyy'
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -35,8 +35,7 @@ class ChillDateType extends AbstractType
|
|||||||
{
|
{
|
||||||
$resolver
|
$resolver
|
||||||
->setDefault('widget', 'single_text')
|
->setDefault('widget', 'single_text')
|
||||||
->setDefault('attr', [ 'class' => 'datepicker' ])
|
->setDefault('html5', true)
|
||||||
->setDefault('format', 'dd-MM-yyyy')
|
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,84 +5,6 @@
|
|||||||
|
|
||||||
var chill = function() {
|
var chill = function() {
|
||||||
|
|
||||||
/* intialiase the pikaday module */
|
|
||||||
function initPikaday(locale) {
|
|
||||||
var i18n_trad = {
|
|
||||||
fr: {
|
|
||||||
previousMonth : 'Mois précédent',
|
|
||||||
nextMonth : 'Mois suivant',
|
|
||||||
months : ['Janvier','Février','Mars','Avril','Mai','Juin','Juillet','Août','Septembre','Octobre','Novembre','Décembre'],
|
|
||||||
weekdays : ['Dimanche','Lundi','Mardi','Mercredi','Jeudi','Vendredi','Samedi'],
|
|
||||||
weekdaysShort : ['Dim','Lun','Mar','Mer','Jeu','Ven','Sam']
|
|
||||||
},
|
|
||||||
nl: {
|
|
||||||
previousMonth : 'Vorig maand',
|
|
||||||
nextMonth : 'Volgende maand',
|
|
||||||
months : ['Januari','Februari','Maart','April','Mei','Juni','Juli','Augustus','September','Oktober','November','December'],
|
|
||||||
weekdays : ['Zondag','Maandag','Dinsdag','Woensdag','Donderdag','Vrijdag','Zaterdag'],
|
|
||||||
weekdaysShort : ['Zon','Ma','Di','Wo','Do','Vri','Zat']
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
var pikaday_options = {
|
|
||||||
format: 'D-M-YYYY',
|
|
||||||
yearRange: [parseInt(moment().format('YYYY')) - 100, parseInt(moment().format('YYYY'))],
|
|
||||||
};
|
|
||||||
|
|
||||||
if(locale in i18n_trad) {
|
|
||||||
pikaday_options.i18n = i18n_trad[locale];
|
|
||||||
}
|
|
||||||
|
|
||||||
$('.datepicker').pikaday(
|
|
||||||
pikaday_options
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* emulate the position:sticky */
|
|
||||||
function emulateSticky() {
|
|
||||||
var need_emulation = false;
|
|
||||||
|
|
||||||
$('.sticky-form-buttons').each(function(i,stick_element) {
|
|
||||||
if($(stick_element).css('position') !== 'sticky') {
|
|
||||||
need_emulation = true;
|
|
||||||
stick_element.init_offset_top = $(stick_element).offset().top;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
function emulate() {
|
|
||||||
$('.sticky-form-buttons').each(function(i,stick_element) {
|
|
||||||
if (($(window).scrollTop() + $(window).height()) < stick_element.init_offset_top) {
|
|
||||||
//sticky at bottom
|
|
||||||
$(stick_element).css('position','fixed');
|
|
||||||
$(stick_element).css('bottom','0');
|
|
||||||
$(stick_element).css('top','');
|
|
||||||
$(stick_element).css('width',$(stick_element).parent().outerWidth());
|
|
||||||
} else if (stick_element.init_offset_top < $(window).scrollTop()) {
|
|
||||||
//sticky at top
|
|
||||||
$(stick_element).css('position','fixed');
|
|
||||||
$(stick_element).css('top','0');
|
|
||||||
$(stick_element).css('bottom','');
|
|
||||||
$(stick_element).css('width',$(stick_element).parent().outerWidth());
|
|
||||||
} else {
|
|
||||||
//no sticky
|
|
||||||
$(stick_element).css('position','initial');
|
|
||||||
$(stick_element).css('bottom','');
|
|
||||||
$(stick_element).css('width','');
|
|
||||||
$(stick_element).css('top','');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if(need_emulation) {
|
|
||||||
$(window).scroll(function() {
|
|
||||||
emulate();
|
|
||||||
});
|
|
||||||
|
|
||||||
emulate();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display an alert message when the user wants to leave a page containing a given form
|
* Display an alert message when the user wants to leave a page containing a given form
|
||||||
* in a given state.
|
* in a given state.
|
||||||
@ -411,8 +333,6 @@ var chill = function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
initPikaday: initPikaday,
|
|
||||||
emulateSticky: emulateSticky,
|
|
||||||
checkOtherValueOnChange: checkOtherValueOnChange,
|
checkOtherValueOnChange: checkOtherValueOnChange,
|
||||||
displayAlertWhenLeavingModifiedForm: displayAlertWhenLeavingModifiedForm,
|
displayAlertWhenLeavingModifiedForm: displayAlertWhenLeavingModifiedForm,
|
||||||
displayAlertWhenLeavingUnsubmittedForm: displayAlertWhenLeavingUnsubmittedForm,
|
displayAlertWhenLeavingUnsubmittedForm: displayAlertWhenLeavingUnsubmittedForm,
|
||||||
|
@ -57,7 +57,6 @@ var handleAdd = function(button) {
|
|||||||
entry.classList.add('chill-collection__list__entry');
|
entry.classList.add('chill-collection__list__entry');
|
||||||
initializeRemove(collection, entry);
|
initializeRemove(collection, entry);
|
||||||
collection.appendChild(entry);
|
collection.appendChild(entry);
|
||||||
chill.initPikaday('fr');
|
|
||||||
|
|
||||||
collection.dispatchEvent(event);
|
collection.dispatchEvent(event);
|
||||||
window.dispatchEvent(event);
|
window.dispatchEvent(event);
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,920 +0,0 @@
|
|||||||
/*!
|
|
||||||
* Pikaday
|
|
||||||
*
|
|
||||||
* Copyright © 2014 David Bushell | BSD & MIT license | https://github.com/dbushell/Pikaday
|
|
||||||
*/
|
|
||||||
|
|
||||||
(function (root, factory)
|
|
||||||
{
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
var moment;
|
|
||||||
if (typeof exports === 'object') {
|
|
||||||
// CommonJS module
|
|
||||||
// Load moment.js as an optional dependency
|
|
||||||
try { moment = require('moment'); } catch (e) {}
|
|
||||||
module.exports = factory(moment);
|
|
||||||
} else if (typeof define === 'function' && define.amd) {
|
|
||||||
// AMD. Register as an anonymous module.
|
|
||||||
define(function (req)
|
|
||||||
{
|
|
||||||
// Load moment.js as an optional dependency
|
|
||||||
var id = 'moment';
|
|
||||||
moment = req.defined && req.defined(id) ? req(id) : undefined;
|
|
||||||
return factory(moment);
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
root.Pikaday = factory(root.moment);
|
|
||||||
}
|
|
||||||
}(this, function (moment)
|
|
||||||
{
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* feature detection and helper functions
|
|
||||||
*/
|
|
||||||
var hasMoment = typeof moment === 'function',
|
|
||||||
|
|
||||||
hasEventListeners = !!window.addEventListener,
|
|
||||||
|
|
||||||
document = window.document,
|
|
||||||
|
|
||||||
sto = window.setTimeout,
|
|
||||||
|
|
||||||
addEvent = function(el, e, callback, capture)
|
|
||||||
{
|
|
||||||
if (hasEventListeners) {
|
|
||||||
el.addEventListener(e, callback, !!capture);
|
|
||||||
} else {
|
|
||||||
el.attachEvent('on' + e, callback);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
removeEvent = function(el, e, callback, capture)
|
|
||||||
{
|
|
||||||
if (hasEventListeners) {
|
|
||||||
el.removeEventListener(e, callback, !!capture);
|
|
||||||
} else {
|
|
||||||
el.detachEvent('on' + e, callback);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
fireEvent = function(el, eventName, data)
|
|
||||||
{
|
|
||||||
var ev;
|
|
||||||
|
|
||||||
if (document.createEvent) {
|
|
||||||
ev = document.createEvent('HTMLEvents');
|
|
||||||
ev.initEvent(eventName, true, false);
|
|
||||||
ev = extend(ev, data);
|
|
||||||
el.dispatchEvent(ev);
|
|
||||||
} else if (document.createEventObject) {
|
|
||||||
ev = document.createEventObject();
|
|
||||||
ev = extend(ev, data);
|
|
||||||
el.fireEvent('on' + eventName, ev);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
trim = function(str)
|
|
||||||
{
|
|
||||||
return str.trim ? str.trim() : str.replace(/^\s+|\s+$/g,'');
|
|
||||||
},
|
|
||||||
|
|
||||||
hasClass = function(el, cn)
|
|
||||||
{
|
|
||||||
return (' ' + el.className + ' ').indexOf(' ' + cn + ' ') !== -1;
|
|
||||||
},
|
|
||||||
|
|
||||||
addClass = function(el, cn)
|
|
||||||
{
|
|
||||||
if (!hasClass(el, cn)) {
|
|
||||||
el.className = (el.className === '') ? cn : el.className + ' ' + cn;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
removeClass = function(el, cn)
|
|
||||||
{
|
|
||||||
el.className = trim((' ' + el.className + ' ').replace(' ' + cn + ' ', ' '));
|
|
||||||
},
|
|
||||||
|
|
||||||
isArray = function(obj)
|
|
||||||
{
|
|
||||||
return (/Array/).test(Object.prototype.toString.call(obj));
|
|
||||||
},
|
|
||||||
|
|
||||||
isDate = function(obj)
|
|
||||||
{
|
|
||||||
return (/Date/).test(Object.prototype.toString.call(obj)) && !isNaN(obj.getTime());
|
|
||||||
},
|
|
||||||
|
|
||||||
isLeapYear = function(year)
|
|
||||||
{
|
|
||||||
// solution by Matti Virkkunen: http://stackoverflow.com/a/4881951
|
|
||||||
return year % 4 === 0 && year % 100 !== 0 || year % 400 === 0;
|
|
||||||
},
|
|
||||||
|
|
||||||
getDaysInMonth = function(year, month)
|
|
||||||
{
|
|
||||||
return [31, isLeapYear(year) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month];
|
|
||||||
},
|
|
||||||
|
|
||||||
setToStartOfDay = function(date)
|
|
||||||
{
|
|
||||||
if (isDate(date)) date.setHours(0,0,0,0);
|
|
||||||
},
|
|
||||||
|
|
||||||
compareDates = function(a,b)
|
|
||||||
{
|
|
||||||
// weak date comparison (use setToStartOfDay(date) to ensure correct result)
|
|
||||||
return a.getTime() === b.getTime();
|
|
||||||
},
|
|
||||||
|
|
||||||
extend = function(to, from, overwrite)
|
|
||||||
{
|
|
||||||
var prop, hasProp;
|
|
||||||
for (prop in from) {
|
|
||||||
hasProp = to[prop] !== undefined;
|
|
||||||
if (hasProp && typeof from[prop] === 'object' && from[prop].nodeName === undefined) {
|
|
||||||
if (isDate(from[prop])) {
|
|
||||||
if (overwrite) {
|
|
||||||
to[prop] = new Date(from[prop].getTime());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (isArray(from[prop])) {
|
|
||||||
if (overwrite) {
|
|
||||||
to[prop] = from[prop].slice(0);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
to[prop] = extend({}, from[prop], overwrite);
|
|
||||||
}
|
|
||||||
} else if (overwrite || !hasProp) {
|
|
||||||
to[prop] = from[prop];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return to;
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* defaults and localisation
|
|
||||||
*/
|
|
||||||
defaults = {
|
|
||||||
|
|
||||||
// bind the picker to a form field
|
|
||||||
field: null,
|
|
||||||
|
|
||||||
// automatically show/hide the picker on `field` focus (default `true` if `field` is set)
|
|
||||||
bound: undefined,
|
|
||||||
|
|
||||||
// position of the datepicker, relative to the field (default to bottom & left)
|
|
||||||
// ('bottom' & 'left' keywords are not used, 'top' & 'right' are modifier on the bottom/left position)
|
|
||||||
position: 'bottom left',
|
|
||||||
|
|
||||||
// the default output format for `.toString()` and `field` value
|
|
||||||
format: 'YYYY-MM-DD',
|
|
||||||
|
|
||||||
// the initial date to view when first opened
|
|
||||||
defaultDate: null,
|
|
||||||
|
|
||||||
// make the `defaultDate` the initial selected value
|
|
||||||
setDefaultDate: false,
|
|
||||||
|
|
||||||
// first day of week (0: Sunday, 1: Monday etc)
|
|
||||||
firstDay: 0,
|
|
||||||
|
|
||||||
// the minimum/earliest date that can be selected
|
|
||||||
minDate: null,
|
|
||||||
// the maximum/latest date that can be selected
|
|
||||||
maxDate: null,
|
|
||||||
|
|
||||||
// number of years either side, or array of upper/lower range
|
|
||||||
yearRange: 10,
|
|
||||||
|
|
||||||
// used internally (don't config outside)
|
|
||||||
minYear: 0,
|
|
||||||
maxYear: 9999,
|
|
||||||
minMonth: undefined,
|
|
||||||
maxMonth: undefined,
|
|
||||||
|
|
||||||
isRTL: false,
|
|
||||||
|
|
||||||
// Additional text to append to the year in the calendar title
|
|
||||||
yearSuffix: '',
|
|
||||||
|
|
||||||
// Render the month after year in the calendar title
|
|
||||||
showMonthAfterYear: false,
|
|
||||||
|
|
||||||
// how many months are visible (not implemented yet)
|
|
||||||
numberOfMonths: 1,
|
|
||||||
|
|
||||||
// internationalization
|
|
||||||
i18n: {
|
|
||||||
previousMonth : 'Previous Month',
|
|
||||||
nextMonth : 'Next Month',
|
|
||||||
months : ['January','February','March','April','May','June','July','August','September','October','November','December'],
|
|
||||||
weekdays : ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],
|
|
||||||
weekdaysShort : ['Sun','Mon','Tue','Wed','Thu','Fri','Sat']
|
|
||||||
},
|
|
||||||
|
|
||||||
// callback function
|
|
||||||
onSelect: null,
|
|
||||||
onOpen: null,
|
|
||||||
onClose: null,
|
|
||||||
onDraw: null
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* templating functions to abstract HTML rendering
|
|
||||||
*/
|
|
||||||
renderDayName = function(opts, day, abbr)
|
|
||||||
{
|
|
||||||
day += opts.firstDay;
|
|
||||||
while (day >= 7) {
|
|
||||||
day -= 7;
|
|
||||||
}
|
|
||||||
return abbr ? opts.i18n.weekdaysShort[day] : opts.i18n.weekdays[day];
|
|
||||||
},
|
|
||||||
|
|
||||||
renderDay = function(i, isSelected, isToday, isDisabled, isEmpty)
|
|
||||||
{
|
|
||||||
if (isEmpty) {
|
|
||||||
return '<td class="is-empty"></td>';
|
|
||||||
}
|
|
||||||
var arr = [];
|
|
||||||
if (isDisabled) {
|
|
||||||
arr.push('is-disabled');
|
|
||||||
}
|
|
||||||
if (isToday) {
|
|
||||||
arr.push('is-today');
|
|
||||||
}
|
|
||||||
if (isSelected) {
|
|
||||||
arr.push('is-selected');
|
|
||||||
}
|
|
||||||
return '<td data-day="' + i + '" class="' + arr.join(' ') + '"><button class="pika-button" type="button">' + i + '</button>' + '</td>';
|
|
||||||
},
|
|
||||||
|
|
||||||
renderRow = function(days, isRTL)
|
|
||||||
{
|
|
||||||
return '<tr>' + (isRTL ? days.reverse() : days).join('') + '</tr>';
|
|
||||||
},
|
|
||||||
|
|
||||||
renderBody = function(rows)
|
|
||||||
{
|
|
||||||
return '<tbody>' + rows.join('') + '</tbody>';
|
|
||||||
},
|
|
||||||
|
|
||||||
renderHead = function(opts)
|
|
||||||
{
|
|
||||||
var i, arr = [];
|
|
||||||
for (i = 0; i < 7; i++) {
|
|
||||||
arr.push('<th scope="col"><abbr title="' + renderDayName(opts, i) + '">' + renderDayName(opts, i, true) + '</abbr></th>');
|
|
||||||
}
|
|
||||||
return '<thead>' + (opts.isRTL ? arr.reverse() : arr).join('') + '</thead>';
|
|
||||||
},
|
|
||||||
|
|
||||||
renderTitle = function(instance)
|
|
||||||
{
|
|
||||||
var i, j, arr,
|
|
||||||
opts = instance._o,
|
|
||||||
month = instance._m,
|
|
||||||
year = instance._y,
|
|
||||||
isMinYear = year === opts.minYear,
|
|
||||||
isMaxYear = year === opts.maxYear,
|
|
||||||
html = '<div class="pika-title">',
|
|
||||||
monthHtml,
|
|
||||||
yearHtml,
|
|
||||||
prev = true,
|
|
||||||
next = true;
|
|
||||||
|
|
||||||
for (arr = [], i = 0; i < 12; i++) {
|
|
||||||
arr.push('<option value="' + i + '"' +
|
|
||||||
(i === month ? ' selected': '') +
|
|
||||||
((isMinYear && i < opts.minMonth) || (isMaxYear && i > opts.maxMonth) ? 'disabled' : '') + '>' +
|
|
||||||
opts.i18n.months[i] + '</option>');
|
|
||||||
}
|
|
||||||
monthHtml = '<div class="pika-label">' + opts.i18n.months[month] + '<select class="pika-select pika-select-month">' + arr.join('') + '</select></div>';
|
|
||||||
|
|
||||||
if (isArray(opts.yearRange)) {
|
|
||||||
i = opts.yearRange[0];
|
|
||||||
j = opts.yearRange[1] + 1;
|
|
||||||
} else {
|
|
||||||
i = year - opts.yearRange;
|
|
||||||
j = 1 + year + opts.yearRange;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (arr = []; i < j && i <= opts.maxYear; i++) {
|
|
||||||
if (i >= opts.minYear) {
|
|
||||||
arr.push('<option value="' + i + '"' + (i === year ? ' selected': '') + '>' + (i) + '</option>');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
yearHtml = '<div class="pika-label">' + year + opts.yearSuffix + '<select class="pika-select pika-select-year">' + arr.join('') + '</select></div>';
|
|
||||||
|
|
||||||
if (opts.showMonthAfterYear) {
|
|
||||||
html += yearHtml + monthHtml;
|
|
||||||
} else {
|
|
||||||
html += monthHtml + yearHtml;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isMinYear && (month === 0 || opts.minMonth >= month)) {
|
|
||||||
prev = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isMaxYear && (month === 11 || opts.maxMonth <= month)) {
|
|
||||||
next = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
html += '<button class="pika-prev' + (prev ? '' : ' is-disabled') + '" type="button">' + opts.i18n.previousMonth + '</button>';
|
|
||||||
html += '<button class="pika-next' + (next ? '' : ' is-disabled') + '" type="button">' + opts.i18n.nextMonth + '</button>';
|
|
||||||
|
|
||||||
return html += '</div>';
|
|
||||||
},
|
|
||||||
|
|
||||||
renderTable = function(opts, data)
|
|
||||||
{
|
|
||||||
return '<table cellpadding="0" cellspacing="0" class="pika-table">' + renderHead(opts) + renderBody(data) + '</table>';
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Pikaday constructor
|
|
||||||
*/
|
|
||||||
Pikaday = function(options)
|
|
||||||
{
|
|
||||||
var self = this,
|
|
||||||
opts = self.config(options);
|
|
||||||
|
|
||||||
self._onMouseDown = function(e)
|
|
||||||
{
|
|
||||||
if (!self._v) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
e = e || window.event;
|
|
||||||
var target = e.target || e.srcElement;
|
|
||||||
if (!target) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!hasClass(target, 'is-disabled')) {
|
|
||||||
if (hasClass(target, 'pika-button') && !hasClass(target, 'is-empty')) {
|
|
||||||
self.setDate(new Date(self._y, self._m, parseInt(target.innerHTML, 10)));
|
|
||||||
if (opts.bound) {
|
|
||||||
sto(function() {
|
|
||||||
self.hide();
|
|
||||||
}, 100);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if (hasClass(target, 'pika-prev')) {
|
|
||||||
self.prevMonth();
|
|
||||||
}
|
|
||||||
else if (hasClass(target, 'pika-next')) {
|
|
||||||
self.nextMonth();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!hasClass(target, 'pika-select')) {
|
|
||||||
if (e.preventDefault) {
|
|
||||||
e.preventDefault();
|
|
||||||
} else {
|
|
||||||
e.returnValue = false;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
self._c = true;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
self._onChange = function(e)
|
|
||||||
{
|
|
||||||
e = e || window.event;
|
|
||||||
var target = e.target || e.srcElement;
|
|
||||||
if (!target) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (hasClass(target, 'pika-select-month')) {
|
|
||||||
self.gotoMonth(target.value);
|
|
||||||
}
|
|
||||||
else if (hasClass(target, 'pika-select-year')) {
|
|
||||||
self.gotoYear(target.value);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
self._onInputChange = function(e)
|
|
||||||
{
|
|
||||||
var date;
|
|
||||||
|
|
||||||
if (e.firedBy === self) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (hasMoment) {
|
|
||||||
date = moment(opts.field.value, opts.format);
|
|
||||||
date = (date && date.isValid()) ? date.toDate() : null;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
date = new Date(Date.parse(opts.field.value));
|
|
||||||
}
|
|
||||||
self.setDate(isDate(date) ? date : null);
|
|
||||||
if (!self._v) {
|
|
||||||
self.show();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
self._onInputFocus = function()
|
|
||||||
{
|
|
||||||
self.show();
|
|
||||||
};
|
|
||||||
|
|
||||||
self._onInputClick = function()
|
|
||||||
{
|
|
||||||
self.show();
|
|
||||||
};
|
|
||||||
|
|
||||||
self._onInputBlur = function()
|
|
||||||
{
|
|
||||||
if (!self._c) {
|
|
||||||
self._b = sto(function() {
|
|
||||||
self.hide();
|
|
||||||
}, 50);
|
|
||||||
}
|
|
||||||
self._c = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
self._onClick = function(e)
|
|
||||||
{
|
|
||||||
e = e || window.event;
|
|
||||||
var target = e.target || e.srcElement,
|
|
||||||
pEl = target;
|
|
||||||
if (!target) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!hasEventListeners && hasClass(target, 'pika-select')) {
|
|
||||||
if (!target.onchange) {
|
|
||||||
target.setAttribute('onchange', 'return;');
|
|
||||||
addEvent(target, 'change', self._onChange);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
do {
|
|
||||||
if (hasClass(pEl, 'pika-single')) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
while ((pEl = pEl.parentNode));
|
|
||||||
if (self._v && target !== opts.trigger) {
|
|
||||||
self.hide();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
self.el = document.createElement('div');
|
|
||||||
self.el.className = 'pika-single' + (opts.isRTL ? ' is-rtl' : '');
|
|
||||||
|
|
||||||
addEvent(self.el, 'mousedown', self._onMouseDown, true);
|
|
||||||
addEvent(self.el, 'change', self._onChange);
|
|
||||||
|
|
||||||
if (opts.field) {
|
|
||||||
if (opts.bound) {
|
|
||||||
document.body.appendChild(self.el);
|
|
||||||
} else {
|
|
||||||
opts.field.parentNode.insertBefore(self.el, opts.field.nextSibling);
|
|
||||||
}
|
|
||||||
addEvent(opts.field, 'change', self._onInputChange);
|
|
||||||
|
|
||||||
if (!opts.defaultDate) {
|
|
||||||
if (hasMoment && opts.field.value) {
|
|
||||||
opts.defaultDate = moment(opts.field.value, opts.format).toDate();
|
|
||||||
} else {
|
|
||||||
opts.defaultDate = new Date(Date.parse(opts.field.value));
|
|
||||||
}
|
|
||||||
opts.setDefaultDate = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var defDate = opts.defaultDate;
|
|
||||||
|
|
||||||
if (isDate(defDate)) {
|
|
||||||
if (opts.setDefaultDate) {
|
|
||||||
self.setDate(defDate, true);
|
|
||||||
} else {
|
|
||||||
self.gotoDate(defDate);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
self.gotoDate(new Date());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (opts.bound) {
|
|
||||||
this.hide();
|
|
||||||
self.el.className += ' is-bound';
|
|
||||||
addEvent(opts.trigger, 'click', self._onInputClick);
|
|
||||||
addEvent(opts.trigger, 'focus', self._onInputFocus);
|
|
||||||
addEvent(opts.trigger, 'blur', self._onInputBlur);
|
|
||||||
} else {
|
|
||||||
this.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* public Pikaday API
|
|
||||||
*/
|
|
||||||
Pikaday.prototype = {
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* configure functionality
|
|
||||||
*/
|
|
||||||
config: function(options)
|
|
||||||
{
|
|
||||||
if (!this._o) {
|
|
||||||
this._o = extend({}, defaults, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
var opts = extend(this._o, options, true);
|
|
||||||
|
|
||||||
opts.isRTL = !!opts.isRTL;
|
|
||||||
|
|
||||||
opts.field = (opts.field && opts.field.nodeName) ? opts.field : null;
|
|
||||||
|
|
||||||
opts.bound = !!(opts.bound !== undefined ? opts.field && opts.bound : opts.field);
|
|
||||||
|
|
||||||
opts.trigger = (opts.trigger && opts.trigger.nodeName) ? opts.trigger : opts.field;
|
|
||||||
|
|
||||||
var nom = parseInt(opts.numberOfMonths, 10) || 1;
|
|
||||||
opts.numberOfMonths = nom > 4 ? 4 : nom;
|
|
||||||
|
|
||||||
if (!isDate(opts.minDate)) {
|
|
||||||
opts.minDate = false;
|
|
||||||
}
|
|
||||||
if (!isDate(opts.maxDate)) {
|
|
||||||
opts.maxDate = false;
|
|
||||||
}
|
|
||||||
if ((opts.minDate && opts.maxDate) && opts.maxDate < opts.minDate) {
|
|
||||||
opts.maxDate = opts.minDate = false;
|
|
||||||
}
|
|
||||||
if (opts.minDate) {
|
|
||||||
setToStartOfDay(opts.minDate);
|
|
||||||
opts.minYear = opts.minDate.getFullYear();
|
|
||||||
opts.minMonth = opts.minDate.getMonth();
|
|
||||||
}
|
|
||||||
if (opts.maxDate) {
|
|
||||||
setToStartOfDay(opts.maxDate);
|
|
||||||
opts.maxYear = opts.maxDate.getFullYear();
|
|
||||||
opts.maxMonth = opts.maxDate.getMonth();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isArray(opts.yearRange)) {
|
|
||||||
var fallback = new Date().getFullYear() - 10;
|
|
||||||
opts.yearRange[0] = parseInt(opts.yearRange[0], 10) || fallback;
|
|
||||||
opts.yearRange[1] = parseInt(opts.yearRange[1], 10) || fallback;
|
|
||||||
} else {
|
|
||||||
opts.yearRange = Math.abs(parseInt(opts.yearRange, 10)) || defaults.yearRange;
|
|
||||||
if (opts.yearRange > 100) {
|
|
||||||
opts.yearRange = 100;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return opts;
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* return a formatted string of the current selection (using Moment.js if available)
|
|
||||||
*/
|
|
||||||
toString: function(format)
|
|
||||||
{
|
|
||||||
return !isDate(this._d) ? '' : hasMoment ? moment(this._d).format(format || this._o.format) : this._d.toDateString();
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* return a Moment.js object of the current selection (if available)
|
|
||||||
*/
|
|
||||||
getMoment: function()
|
|
||||||
{
|
|
||||||
return hasMoment ? moment(this._d) : null;
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* set the current selection from a Moment.js object (if available)
|
|
||||||
*/
|
|
||||||
setMoment: function(date, preventOnSelect)
|
|
||||||
{
|
|
||||||
if (hasMoment && moment.isMoment(date)) {
|
|
||||||
this.setDate(date.toDate(), preventOnSelect);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* return a Date object of the current selection
|
|
||||||
*/
|
|
||||||
getDate: function()
|
|
||||||
{
|
|
||||||
return isDate(this._d) ? new Date(this._d.getTime()) : null;
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* set the current selection
|
|
||||||
*/
|
|
||||||
setDate: function(date, preventOnSelect)
|
|
||||||
{
|
|
||||||
if (!date) {
|
|
||||||
this._d = null;
|
|
||||||
return this.draw();
|
|
||||||
}
|
|
||||||
if (typeof date === 'string') {
|
|
||||||
date = new Date(Date.parse(date));
|
|
||||||
}
|
|
||||||
if (!isDate(date)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var min = this._o.minDate,
|
|
||||||
max = this._o.maxDate;
|
|
||||||
|
|
||||||
if (isDate(min) && date < min) {
|
|
||||||
date = min;
|
|
||||||
} else if (isDate(max) && date > max) {
|
|
||||||
date = max;
|
|
||||||
}
|
|
||||||
|
|
||||||
this._d = new Date(date.getTime());
|
|
||||||
setToStartOfDay(this._d);
|
|
||||||
this.gotoDate(this._d);
|
|
||||||
|
|
||||||
if (this._o.field) {
|
|
||||||
this._o.field.value = this.toString();
|
|
||||||
fireEvent(this._o.field, 'change', { firedBy: this });
|
|
||||||
}
|
|
||||||
if (!preventOnSelect && typeof this._o.onSelect === 'function') {
|
|
||||||
this._o.onSelect.call(this, this.getDate());
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* change view to a specific date
|
|
||||||
*/
|
|
||||||
gotoDate: function(date)
|
|
||||||
{
|
|
||||||
if (!isDate(date)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this._y = date.getFullYear();
|
|
||||||
this._m = date.getMonth();
|
|
||||||
this.draw();
|
|
||||||
},
|
|
||||||
|
|
||||||
gotoToday: function()
|
|
||||||
{
|
|
||||||
this.gotoDate(new Date());
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* change view to a specific month (zero-index, e.g. 0: January)
|
|
||||||
*/
|
|
||||||
gotoMonth: function(month)
|
|
||||||
{
|
|
||||||
if (!isNaN( (month = parseInt(month, 10)) )) {
|
|
||||||
this._m = month < 0 ? 0 : month > 11 ? 11 : month;
|
|
||||||
this.draw();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
nextMonth: function()
|
|
||||||
{
|
|
||||||
if (++this._m > 11) {
|
|
||||||
this._m = 0;
|
|
||||||
this._y++;
|
|
||||||
}
|
|
||||||
this.draw();
|
|
||||||
},
|
|
||||||
|
|
||||||
prevMonth: function()
|
|
||||||
{
|
|
||||||
if (--this._m < 0) {
|
|
||||||
this._m = 11;
|
|
||||||
this._y--;
|
|
||||||
}
|
|
||||||
this.draw();
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* change view to a specific full year (e.g. "2012")
|
|
||||||
*/
|
|
||||||
gotoYear: function(year)
|
|
||||||
{
|
|
||||||
if (!isNaN(year)) {
|
|
||||||
this._y = parseInt(year, 10);
|
|
||||||
this.draw();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* change the minDate
|
|
||||||
*/
|
|
||||||
setMinDate: function(value)
|
|
||||||
{
|
|
||||||
this._o.minDate = value;
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* change the maxDate
|
|
||||||
*/
|
|
||||||
setMaxDate: function(value)
|
|
||||||
{
|
|
||||||
this._o.maxDate = value;
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* refresh the HTML
|
|
||||||
*/
|
|
||||||
draw: function(force)
|
|
||||||
{
|
|
||||||
if (!this._v && !force) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var opts = this._o,
|
|
||||||
minYear = opts.minYear,
|
|
||||||
maxYear = opts.maxYear,
|
|
||||||
minMonth = opts.minMonth,
|
|
||||||
maxMonth = opts.maxMonth;
|
|
||||||
|
|
||||||
if (this._y <= minYear) {
|
|
||||||
this._y = minYear;
|
|
||||||
if (!isNaN(minMonth) && this._m < minMonth) {
|
|
||||||
this._m = minMonth;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (this._y >= maxYear) {
|
|
||||||
this._y = maxYear;
|
|
||||||
if (!isNaN(maxMonth) && this._m > maxMonth) {
|
|
||||||
this._m = maxMonth;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this.el.innerHTML = renderTitle(this) + this.render(this._y, this._m);
|
|
||||||
|
|
||||||
if (opts.bound) {
|
|
||||||
this.adjustPosition();
|
|
||||||
if(opts.field.type !== 'hidden') {
|
|
||||||
sto(function() {
|
|
||||||
opts.trigger.focus();
|
|
||||||
}, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof this._o.onDraw === 'function') {
|
|
||||||
var self = this;
|
|
||||||
sto(function() {
|
|
||||||
self._o.onDraw.call(self);
|
|
||||||
}, 0);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
adjustPosition: function()
|
|
||||||
{
|
|
||||||
var field = this._o.trigger, pEl = field,
|
|
||||||
width = this.el.offsetWidth, height = this.el.offsetHeight,
|
|
||||||
viewportWidth = window.innerWidth || document.documentElement.clientWidth,
|
|
||||||
viewportHeight = window.innerHeight || document.documentElement.clientHeight,
|
|
||||||
scrollTop = window.pageYOffset || document.body.scrollTop || document.documentElement.scrollTop,
|
|
||||||
left, top, clientRect;
|
|
||||||
|
|
||||||
if (typeof field.getBoundingClientRect === 'function') {
|
|
||||||
clientRect = field.getBoundingClientRect();
|
|
||||||
left = clientRect.left + window.pageXOffset;
|
|
||||||
top = clientRect.bottom + window.pageYOffset;
|
|
||||||
} else {
|
|
||||||
left = pEl.offsetLeft;
|
|
||||||
top = pEl.offsetTop + pEl.offsetHeight;
|
|
||||||
while((pEl = pEl.offsetParent)) {
|
|
||||||
left += pEl.offsetLeft;
|
|
||||||
top += pEl.offsetTop;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// default position is bottom & left
|
|
||||||
if (left + width > viewportWidth ||
|
|
||||||
(
|
|
||||||
this._o.position.indexOf('right') > -1 &&
|
|
||||||
left - width + field.offsetWidth > 0
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
left = left - width + field.offsetWidth;
|
|
||||||
}
|
|
||||||
if (top + height > viewportHeight + scrollTop ||
|
|
||||||
(
|
|
||||||
this._o.position.indexOf('top') > -1 &&
|
|
||||||
top - height - field.offsetHeight > 0
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
top = top - height - field.offsetHeight;
|
|
||||||
}
|
|
||||||
this.el.style.cssText = [
|
|
||||||
'position: absolute',
|
|
||||||
'left: ' + left + 'px',
|
|
||||||
'top: ' + top + 'px'
|
|
||||||
].join(';');
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* render HTML for a particular month
|
|
||||||
*/
|
|
||||||
render: function(year, month)
|
|
||||||
{
|
|
||||||
var opts = this._o,
|
|
||||||
now = new Date(),
|
|
||||||
days = getDaysInMonth(year, month),
|
|
||||||
before = new Date(year, month, 1).getDay(),
|
|
||||||
data = [],
|
|
||||||
row = [];
|
|
||||||
setToStartOfDay(now);
|
|
||||||
if (opts.firstDay > 0) {
|
|
||||||
before -= opts.firstDay;
|
|
||||||
if (before < 0) {
|
|
||||||
before += 7;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var cells = days + before,
|
|
||||||
after = cells;
|
|
||||||
while(after > 7) {
|
|
||||||
after -= 7;
|
|
||||||
}
|
|
||||||
cells += 7 - after;
|
|
||||||
for (var i = 0, r = 0; i < cells; i++)
|
|
||||||
{
|
|
||||||
var day = new Date(year, month, 1 + (i - before)),
|
|
||||||
isDisabled = (opts.minDate && day < opts.minDate) || (opts.maxDate && day > opts.maxDate),
|
|
||||||
isSelected = isDate(this._d) ? compareDates(day, this._d) : false,
|
|
||||||
isToday = compareDates(day, now),
|
|
||||||
isEmpty = i < before || i >= (days + before);
|
|
||||||
|
|
||||||
row.push(renderDay(1 + (i - before), isSelected, isToday, isDisabled, isEmpty));
|
|
||||||
|
|
||||||
if (++r === 7) {
|
|
||||||
data.push(renderRow(row, opts.isRTL));
|
|
||||||
row = [];
|
|
||||||
r = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return renderTable(opts, data);
|
|
||||||
},
|
|
||||||
|
|
||||||
isVisible: function()
|
|
||||||
{
|
|
||||||
return this._v;
|
|
||||||
},
|
|
||||||
|
|
||||||
show: function()
|
|
||||||
{
|
|
||||||
if (!this._v) {
|
|
||||||
if (this._o.bound) {
|
|
||||||
addEvent(document, 'click', this._onClick);
|
|
||||||
}
|
|
||||||
removeClass(this.el, 'is-hidden');
|
|
||||||
this._v = true;
|
|
||||||
this.draw();
|
|
||||||
if (typeof this._o.onOpen === 'function') {
|
|
||||||
this._o.onOpen.call(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
hide: function()
|
|
||||||
{
|
|
||||||
var v = this._v;
|
|
||||||
if (v !== false) {
|
|
||||||
if (this._o.bound) {
|
|
||||||
removeEvent(document, 'click', this._onClick);
|
|
||||||
}
|
|
||||||
this.el.style.cssText = '';
|
|
||||||
addClass(this.el, 'is-hidden');
|
|
||||||
this._v = false;
|
|
||||||
if (v !== undefined && typeof this._o.onClose === 'function') {
|
|
||||||
this._o.onClose.call(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* GAME OVER
|
|
||||||
*/
|
|
||||||
destroy: function()
|
|
||||||
{
|
|
||||||
this.hide();
|
|
||||||
removeEvent(this.el, 'mousedown', this._onMouseDown, true);
|
|
||||||
removeEvent(this.el, 'change', this._onChange);
|
|
||||||
if (this._o.field) {
|
|
||||||
removeEvent(this._o.field, 'change', this._onInputChange);
|
|
||||||
if (this._o.bound) {
|
|
||||||
removeEvent(this._o.trigger, 'click', this._onInputClick);
|
|
||||||
removeEvent(this._o.trigger, 'focus', this._onInputFocus);
|
|
||||||
removeEvent(this._o.trigger, 'blur', this._onInputBlur);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (this.el.parentNode) {
|
|
||||||
this.el.parentNode.removeChild(this.el);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
return Pikaday;
|
|
||||||
|
|
||||||
}));
|
|
@ -1,52 +0,0 @@
|
|||||||
/*!
|
|
||||||
* Pikaday jQuery plugin.
|
|
||||||
*
|
|
||||||
* Copyright © 2013 David Bushell | BSD & MIT license | https://github.com/dbushell/Pikaday
|
|
||||||
*/
|
|
||||||
|
|
||||||
(function (root, factory)
|
|
||||||
{
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
if (typeof exports === 'object') {
|
|
||||||
// CommonJS module
|
|
||||||
factory(require('jquery'), require('../pikaday'));
|
|
||||||
} else if (typeof define === 'function' && define.amd) {
|
|
||||||
// AMD. Register as an anonymous module.
|
|
||||||
define(['jquery', 'pikaday'], factory);
|
|
||||||
} else {
|
|
||||||
// Browser globals
|
|
||||||
factory(root.jQuery, root.Pikaday);
|
|
||||||
}
|
|
||||||
}(this, function ($, Pikaday)
|
|
||||||
{
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
$.fn.pikaday = function()
|
|
||||||
{
|
|
||||||
var args = arguments;
|
|
||||||
|
|
||||||
if (!args || !args.length) {
|
|
||||||
args = [{ }];
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.each(function()
|
|
||||||
{
|
|
||||||
var self = $(this),
|
|
||||||
plugin = self.data('pikaday');
|
|
||||||
|
|
||||||
if (!(plugin instanceof Pikaday)) {
|
|
||||||
if (typeof args[0] === 'object') {
|
|
||||||
var options = $.extend({}, args[0]);
|
|
||||||
options.field = self[0];
|
|
||||||
self.data('pikaday', new Pikaday(options));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (typeof args[0] === 'string' && typeof plugin[args[0]] === 'function') {
|
|
||||||
plugin[args[0]].apply(plugin, Array.prototype.slice.call(args,1));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
}));
|
|
@ -5,11 +5,6 @@ const $ = require('jquery');
|
|||||||
// create global $ and jQuery variables
|
// create global $ and jQuery variables
|
||||||
global.$ = global.jQuery = $;
|
global.$ = global.jQuery = $;
|
||||||
|
|
||||||
const moment = require('moment');
|
|
||||||
global.moment = moment;
|
|
||||||
|
|
||||||
const pikaday = require('pikaday-jquery');
|
|
||||||
|
|
||||||
const select2 = require('select2');
|
const select2 = require('select2');
|
||||||
global.select2 = select2;
|
global.select2 = select2;
|
||||||
|
|
||||||
@ -23,7 +18,6 @@ global.chill = chill;
|
|||||||
*/
|
*/
|
||||||
require('./scss/chillmain.scss');
|
require('./scss/chillmain.scss');
|
||||||
require('./css/chillmain.css');
|
require('./css/chillmain.css');
|
||||||
require('./css/pikaday.css');
|
|
||||||
|
|
||||||
require('./js/collection/collections.js');
|
require('./js/collection/collections.js');
|
||||||
|
|
||||||
|
@ -41,6 +41,12 @@ table {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// règle la typo des étiquettes de dénomination rendues avec renderBox
|
||||||
|
.chill_denomination {
|
||||||
|
font-size: 1.3em;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ACCOMPANYING_COURSE
|
* ACCOMPANYING_COURSE
|
||||||
* Header custom for Accompanying Course
|
* Header custom for Accompanying Course
|
||||||
@ -79,6 +85,18 @@ div.flex-table {
|
|||||||
h2, h3, h4 {
|
h2, h3, h4 {
|
||||||
color: var(--chill-blue);
|
color: var(--chill-blue);
|
||||||
}
|
}
|
||||||
|
div.item-bloc {
|
||||||
|
// We use box-shadow instead of border
|
||||||
|
// to avoid to manage border double-width
|
||||||
|
// when blocs are resized for small screen !
|
||||||
|
// Then we can simulate border-collapse: collapse (table)
|
||||||
|
box-shadow:
|
||||||
|
1px 0 0 0 #000,
|
||||||
|
0 1px 0 0 #000,
|
||||||
|
1px 1px 0 0 #000, /* fix the corner */
|
||||||
|
1px 0 0 0 #000 inset,
|
||||||
|
0 1px 0 0 #000 inset;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -94,11 +112,8 @@ div.flex-bloc {
|
|||||||
|
|
||||||
div.item-bloc {
|
div.item-bloc {
|
||||||
flex-grow: 0; flex-shrink: 1; flex-basis: 50%;
|
flex-grow: 0; flex-shrink: 1; flex-basis: 50%;
|
||||||
|
|
||||||
margin: 0;
|
margin: 0;
|
||||||
border: 1px solid #000;
|
|
||||||
padding: 1em;
|
padding: 1em;
|
||||||
|
|
||||||
border-top: 0;
|
border-top: 0;
|
||||||
&:nth-child(1), &:nth-child(2) {
|
&:nth-child(1), &:nth-child(2) {
|
||||||
border-top: 1px solid #000;
|
border-top: 1px solid #000;
|
||||||
@ -167,11 +182,6 @@ div.flex-table {
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
padding: 1em;
|
padding: 1em;
|
||||||
border: 1px solid #000;
|
|
||||||
border-top: 0;
|
|
||||||
&:first-child {
|
|
||||||
border-top: 1px solid #000;
|
|
||||||
}
|
|
||||||
&:nth-child(even) {
|
&:nth-child(even) {
|
||||||
background-color: #e6e6e6;
|
background-color: #e6e6e6;
|
||||||
}
|
}
|
||||||
|
@ -112,24 +112,6 @@
|
|||||||
</div>
|
</div>
|
||||||
{% endblock money_widget %}
|
{% endblock money_widget %}
|
||||||
|
|
||||||
|
|
||||||
{% block date_widget %}
|
|
||||||
{% apply spaceless %}
|
|
||||||
{% if widget == 'single_text' %}
|
|
||||||
{% set attr = {'class' : 'input datepicker'} %}
|
|
||||||
{{ block('form_widget_simple') }}
|
|
||||||
{% else %}
|
|
||||||
<div {{ block('widget_container_attributes') }}>
|
|
||||||
{{ date_pattern|replace({
|
|
||||||
'{{ year }}': form_widget(form.year ),
|
|
||||||
'{{ month }}': form_widget(form.month ),
|
|
||||||
'{{ day }}': form_widget(form.day ),
|
|
||||||
})|raw }}
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
{% endapply %}
|
|
||||||
{% endblock date_widget %}
|
|
||||||
|
|
||||||
{%- block time_widget -%}
|
{%- block time_widget -%}
|
||||||
{%- if widget == 'single_text' -%}
|
{%- if widget == 'single_text' -%}
|
||||||
{{ block('form_widget_simple') }}
|
{{ block('form_widget_simple') }}
|
||||||
@ -196,4 +178,4 @@
|
|||||||
{{ form_widget(entry) }}
|
{{ form_widget(entry) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -164,8 +164,6 @@
|
|||||||
{{ encore_entry_script_tags('ckeditor5') }}
|
{{ encore_entry_script_tags('ckeditor5') }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
chill.initPikaday('{{ app.request.locale }}');
|
|
||||||
chill.emulateSticky();
|
|
||||||
chill.checkOtherValueOnChange();
|
chill.checkOtherValueOnChange();
|
||||||
$('.select2').select2({allowClear: true});
|
$('.select2').select2({allowClear: true});
|
||||||
chill.categoryLinkParentChildSelect();
|
chill.categoryLinkParentChildSelect();
|
||||||
|
@ -31,13 +31,13 @@ final class ChillMarkdownRenderExtension extends AbstractExtension
|
|||||||
* @var Parsedown
|
* @var Parsedown
|
||||||
*/
|
*/
|
||||||
protected $parsedown;
|
protected $parsedown;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->parsedown = new Parsedown();
|
$this->parsedown = new Parsedown();
|
||||||
$this->parsedown->setSafeMode(true);
|
$this->parsedown->setSafeMode(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getFilters(): array
|
public function getFilters(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
@ -46,9 +46,9 @@ final class ChillMarkdownRenderExtension extends AbstractExtension
|
|||||||
])
|
])
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function renderMarkdownToHtml(string $var): string
|
public function renderMarkdownToHtml(?string $var): string
|
||||||
{
|
{
|
||||||
return $this->parsedown->parse($var);
|
return $this->parsedown->parse((string) $var);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -57,6 +57,9 @@ Centers: Centres
|
|||||||
comment: commentaire
|
comment: commentaire
|
||||||
Comment: Commentaire
|
Comment: Commentaire
|
||||||
|
|
||||||
|
# comment embeddable
|
||||||
|
No comment associated: Aucun commentaire
|
||||||
|
|
||||||
#pagination
|
#pagination
|
||||||
Previous: Précédent
|
Previous: Précédent
|
||||||
Next: Suivant
|
Next: Suivant
|
||||||
|
@ -53,36 +53,36 @@ class AccompanyingPeriod implements TrackCreationInterface, TrackUpdateInterface
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Mark an accompanying period as "occasional"
|
* Mark an accompanying period as "occasional"
|
||||||
*
|
*
|
||||||
* used in INTENSITY
|
* used in INTENSITY
|
||||||
*/
|
*/
|
||||||
public const INTENSITY_OCCASIONAL = 'occasional';
|
public const INTENSITY_OCCASIONAL = 'occasional';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mark an accompanying period as "regular"
|
* Mark an accompanying period as "regular"
|
||||||
*
|
*
|
||||||
* used in INTENSITY
|
* used in INTENSITY
|
||||||
*/
|
*/
|
||||||
public const INTENSITY_REGULAR = 'regular';
|
public const INTENSITY_REGULAR = 'regular';
|
||||||
|
|
||||||
public const INTENSITIES = [self::INTENSITY_OCCASIONAL, self::INTENSITY_REGULAR];
|
public const INTENSITIES = [self::INTENSITY_OCCASIONAL, self::INTENSITY_REGULAR];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mark an accompanying period as "draft".
|
* Mark an accompanying period as "draft".
|
||||||
*
|
*
|
||||||
* This means that the accompanying period is not yet
|
* This means that the accompanying period is not yet
|
||||||
* confirmed by the creator
|
* confirmed by the creator
|
||||||
*/
|
*/
|
||||||
public const STEP_DRAFT = 'DRAFT';
|
public const STEP_DRAFT = 'DRAFT';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mark an accompanying period as "confirmed".
|
* Mark an accompanying period as "confirmed".
|
||||||
*
|
*
|
||||||
* This means that the accompanying period **is**
|
* This means that the accompanying period **is**
|
||||||
* confirmed by the creator
|
* confirmed by the creator
|
||||||
*/
|
*/
|
||||||
public const STEP_CONFIRMED = 'CONFIRMED';
|
public const STEP_CONFIRMED = 'CONFIRMED';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var integer
|
* @var integer
|
||||||
*
|
*
|
||||||
@ -176,7 +176,7 @@ class AccompanyingPeriod implements TrackCreationInterface, TrackUpdateInterface
|
|||||||
* @Groups({"read"})
|
* @Groups({"read"})
|
||||||
*/
|
*/
|
||||||
private $step = self::STEP_DRAFT;
|
private $step = self::STEP_DRAFT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\ManyToOne(targetEntity=Origin::class)
|
* @ORM\ManyToOne(targetEntity=Origin::class)
|
||||||
* @ORM\JoinColumn(nullable=true)
|
* @ORM\JoinColumn(nullable=true)
|
||||||
@ -274,7 +274,7 @@ class AccompanyingPeriod implements TrackCreationInterface, TrackUpdateInterface
|
|||||||
* )
|
* )
|
||||||
*/
|
*/
|
||||||
private User $updatedBy;
|
private User $updatedBy;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Column(type="datetime", nullable=true, options={"default": NULL})
|
* @ORM\Column(type="datetime", nullable=true, options={"default": NULL})
|
||||||
*/
|
*/
|
||||||
@ -412,7 +412,7 @@ class AccompanyingPeriod implements TrackCreationInterface, TrackUpdateInterface
|
|||||||
{
|
{
|
||||||
if (NULL !== $this->initialComment) {
|
if (NULL !== $this->initialComment) {
|
||||||
$this->removeComment($this->initialComment);
|
$this->removeComment($this->initialComment);
|
||||||
}
|
}
|
||||||
if ($comment instanceof Comment) {
|
if ($comment instanceof Comment) {
|
||||||
$this->addComment($comment);
|
$this->addComment($comment);
|
||||||
}
|
}
|
||||||
@ -471,7 +471,7 @@ class AccompanyingPeriod implements TrackCreationInterface, TrackUpdateInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return true if the accompanying period contains a person.
|
* Return true if the accompanying period contains a person.
|
||||||
*
|
*
|
||||||
* **Note**: this participation can be opened or not.
|
* **Note**: this participation can be opened or not.
|
||||||
*/
|
*/
|
||||||
@ -518,7 +518,7 @@ class AccompanyingPeriod implements TrackCreationInterface, TrackUpdateInterface
|
|||||||
|
|
||||||
return $participation;
|
return $participation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove Person
|
* Remove Person
|
||||||
@ -822,6 +822,44 @@ class AccompanyingPeriod implements TrackCreationInterface, TrackUpdateInterface
|
|||||||
$this->socialIssues->removeElement($socialIssue);
|
$this->socialIssues->removeElement($socialIssue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Collection|SocialIssues[] All social issues and their descendants
|
||||||
|
*/
|
||||||
|
public function getRecursiveSocialIssues(): Collection
|
||||||
|
{
|
||||||
|
$recursiveSocialIssues = new ArrayCollection();
|
||||||
|
|
||||||
|
foreach( $this->socialIssues as $socialIssue) {
|
||||||
|
foreach ($socialIssue->getDescendantsWithThis() as $descendant) {
|
||||||
|
if(! $recursiveSocialIssues->contains($descendant)) {
|
||||||
|
$recursiveSocialIssues->add($descendant);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $recursiveSocialIssues;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Collection|SocialAction[] All the descendant social actions of all
|
||||||
|
* the descendants of the entity
|
||||||
|
*/
|
||||||
|
public function getRecursiveSocialActions(): Collection
|
||||||
|
{
|
||||||
|
$recursiveSocialActions = new ArrayCollection();
|
||||||
|
|
||||||
|
foreach( $this->socialIssues as $socialIssue) {
|
||||||
|
foreach ($socialIssue->getRecursiveSocialActions() as $descendant) {
|
||||||
|
if(! $recursiveSocialActions->contains($descendant)) {
|
||||||
|
$recursiveSocialActions->add($descendant);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $recursiveSocialActions;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a list of all persons which are participating to this course
|
* Get a list of all persons which are participating to this course
|
||||||
*
|
*
|
||||||
|
@ -102,6 +102,11 @@ class SocialAction
|
|||||||
return $this->parent;
|
return $this->parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function hasParent(): bool
|
||||||
|
{
|
||||||
|
return $this->getParent() instanceof self;
|
||||||
|
}
|
||||||
|
|
||||||
public function setParent(?self $parent): self
|
public function setParent(?self $parent): self
|
||||||
{
|
{
|
||||||
$this->parent = $parent;
|
$this->parent = $parent;
|
||||||
@ -139,6 +144,41 @@ class SocialAction
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Collection|self[] All the descendants (children, children of children, ...)
|
||||||
|
*/
|
||||||
|
public function getDescendants(): Collection
|
||||||
|
{
|
||||||
|
$descendants = new ArrayCollection();
|
||||||
|
|
||||||
|
foreach ($this->getChildren() as $child) {
|
||||||
|
if(! $descendants->contains($child)) {
|
||||||
|
$descendants->add($child);
|
||||||
|
foreach($child->getDescendants() as $descendantsOfChild) {
|
||||||
|
if(! $descendants->contains($descendantsOfChild)) {
|
||||||
|
$descendants->add($descendantsOfChild);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $descendants;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Collection|self[] All the descendants with the current entity (this)
|
||||||
|
*/
|
||||||
|
public function getDescendantsWithThis(): Collection
|
||||||
|
{
|
||||||
|
$descendants = $this->getDescendants();
|
||||||
|
|
||||||
|
if(! $descendants->contains($this)) {
|
||||||
|
$descendants->add($this);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $descendants;
|
||||||
|
}
|
||||||
|
|
||||||
public function getDefaultNotificationDelay(): ?\DateInterval
|
public function getDefaultNotificationDelay(): ?\DateInterval
|
||||||
{
|
{
|
||||||
return $this->defaultNotificationDelay;
|
return $this->defaultNotificationDelay;
|
||||||
|
@ -107,6 +107,42 @@ class SocialIssue
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Collection|self[] All the descendants (children, children of children, ...)
|
||||||
|
*/
|
||||||
|
public function getDescendants(): Collection
|
||||||
|
{
|
||||||
|
$descendants = new ArrayCollection();
|
||||||
|
|
||||||
|
foreach ($this->getChildren() as $child) {
|
||||||
|
if(! $descendants->contains($child)) {
|
||||||
|
$descendants->add($child);
|
||||||
|
foreach($child->getDescendants() as $descendantsOfChild) {
|
||||||
|
if(! $descendants->contains($descendantsOfChild)) {
|
||||||
|
$descendants->add($descendantsOfChild);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $descendants;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Collection|self[] All the descendants with the current entity (this)
|
||||||
|
*/
|
||||||
|
public function getDescendantsWithThis(): Collection
|
||||||
|
{
|
||||||
|
$descendants = $this->getDescendants();
|
||||||
|
|
||||||
|
if(! $descendants->contains($this)) {
|
||||||
|
$descendants->add($this);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $descendants;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public function getDesactivationDate(): ?\DateTimeInterface
|
public function getDesactivationDate(): ?\DateTimeInterface
|
||||||
{
|
{
|
||||||
return $this->desactivationDate;
|
return $this->desactivationDate;
|
||||||
@ -160,4 +196,41 @@ class SocialIssue
|
|||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Collection|SocialAction[] All the descendant social actions of the entity
|
||||||
|
*/
|
||||||
|
public function getDescendantsSocialActions(): Collection
|
||||||
|
{
|
||||||
|
$descendantsSocialActions = new ArrayCollection();
|
||||||
|
|
||||||
|
foreach ($this->getSocialActions() as $socialAction) {
|
||||||
|
foreach ($socialAction->getDescendantsWithThis() as $descendant) {
|
||||||
|
if(! $descendantsSocialActions->contains($descendant)) {
|
||||||
|
$descendantsSocialActions->add($descendant);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $descendantsSocialActions;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Collection|SocialAction[] All the descendant social actions of all
|
||||||
|
* the descendants of the entity
|
||||||
|
*/
|
||||||
|
public function getRecursiveSocialActions(): Collection
|
||||||
|
{
|
||||||
|
$recursiveSocialActions = new ArrayCollection();
|
||||||
|
|
||||||
|
foreach ($this->getDescendantsWithThis() as $socialIssue) {
|
||||||
|
foreach ($socialIssue->getDescendantsSocialActions() as $descendant) {
|
||||||
|
if(! $recursiveSocialActions->contains($descendant)) {
|
||||||
|
$recursiveSocialActions->add($descendant);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $recursiveSocialActions;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ use Chill\PersonBundle\Form\Type\PersonPhoneType;
|
|||||||
use Chill\PersonBundle\Entity\PersonPhone;
|
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 Symfony\Component\Form\Extension\Core\Type\DateType;
|
use Chill\MainBundle\Form\Type\ChillDateType;
|
||||||
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;
|
||||||
@ -79,7 +79,9 @@ class PersonType extends AbstractType
|
|||||||
$builder
|
$builder
|
||||||
->add('firstName')
|
->add('firstName')
|
||||||
->add('lastName')
|
->add('lastName')
|
||||||
->add('birthdate', DateType::class, array('required' => false, 'widget' => 'single_text', 'format' => 'dd-MM-yyyy'))
|
->add('birthdate', ChillDateType::class, [
|
||||||
|
'required' => false,
|
||||||
|
])
|
||||||
->add('gender', GenderType::class, array(
|
->add('gender', GenderType::class, array(
|
||||||
'required' => true
|
'required' => true
|
||||||
));
|
));
|
||||||
|
@ -44,7 +44,6 @@ div.list-household-members--summary {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.chill-entity__person {
|
.chill-entity__person {
|
||||||
.chill-entity__person__first-name,
|
.chill-entity__person__first-name,
|
||||||
.chill-entity__person__last-name,
|
.chill-entity__person__last-name,
|
||||||
@ -55,5 +54,3 @@ div.list-household-members--summary {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<a @click="toggleIntensity" class="flag-toggle">
|
<a @click="toggleIntensity" class="flag-toggle">
|
||||||
{{ $t('course.occasional') }}
|
<span :class="{ 'on': !isRegular }">{{ $t('course.occasional') }}</span>
|
||||||
<i class="fa" :class="{ 'fa-toggle-on': isRegular, 'fa-toggle-on fa-flip-horizontal': !isRegular }"></i>
|
<i class="fa" :class="{ 'fa-toggle-on': isRegular, 'fa-toggle-on fa-flip-horizontal': !isRegular }"></i>
|
||||||
{{ $t('course.regular') }}
|
<span :class="{ 'on': isRegular }">{{ $t('course.regular') }}</span>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -76,6 +76,9 @@ export default {
|
|||||||
i {
|
i {
|
||||||
margin: auto 0.4em;
|
margin: auto 0.4em;
|
||||||
}
|
}
|
||||||
|
span.on {
|
||||||
|
font-weight: bolder;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
button.badge {
|
button.badge {
|
||||||
margin-left: 0.8em;
|
margin-left: 0.8em;
|
||||||
|
@ -56,7 +56,6 @@
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ul class="record_actions">
|
<ul class="record_actions">
|
||||||
<li>
|
<li>
|
||||||
<button class="sc-button bt-remove"
|
<button class="sc-button bt-remove"
|
||||||
@ -66,7 +65,6 @@
|
|||||||
</button>
|
</button>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div v-else>
|
<div v-else>
|
||||||
<label>{{ $t('requestor.counter') }}</label>
|
<label>{{ $t('requestor.counter') }}</label>
|
||||||
@ -147,7 +145,6 @@ div.flex-table {
|
|||||||
}
|
}
|
||||||
div.item-bloc {
|
div.item-bloc {
|
||||||
background-color: white !important;
|
background-color: white !important;
|
||||||
border: 1px solid #000;
|
|
||||||
padding: 1em;
|
padding: 1em;
|
||||||
margin-top: 1em;
|
margin-top: 1em;
|
||||||
.content-bloc {
|
.content-bloc {
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
track-by="id"
|
track-by="id"
|
||||||
label="text"
|
label="text"
|
||||||
:multiple="true"
|
:multiple="true"
|
||||||
:searchable="false"
|
:searchable="true"
|
||||||
:placeholder="$t('social_issue.label')"
|
:placeholder="$t('social_issue.label')"
|
||||||
@update:model-value="updateSocialIssues"
|
@update:model-value="updateSocialIssues"
|
||||||
:model-value="value"
|
:model-value="value"
|
||||||
@ -75,6 +75,6 @@ export default {
|
|||||||
<style src="vue-multiselect/dist/vue-multiselect.css"></style>
|
<style src="vue-multiselect/dist/vue-multiselect.css"></style>
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
span.multiselect__tag {
|
span.multiselect__tag {
|
||||||
background: #e2793d;
|
background: var(--chill-orange);
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
<template>
|
<template>
|
||||||
<ul class="record_actions">
|
<ul class="record_actions">
|
||||||
<li>
|
<li class="add-persons">
|
||||||
<button class="sc-button bt-create" @click="openModal">
|
<a class="sc-button bt-create" @click="openModal">
|
||||||
{{ $t(buttonTitle) }}
|
{{ $t(buttonTitle) }}
|
||||||
</button>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
@ -220,6 +220,11 @@ export default {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
|
li.add-persons {
|
||||||
|
a {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
}
|
||||||
div.body-head {
|
div.body-head {
|
||||||
overflow-y: unset;
|
overflow-y: unset;
|
||||||
div.modal-body:first-child {
|
div.modal-body:first-child {
|
||||||
|
@ -15,5 +15,5 @@
|
|||||||
window.accompanyingCourseId = {{ accompanyingCourse.id|e('js') }};
|
window.accompanyingCourseId = {{ accompanyingCourse.id|e('js') }};
|
||||||
window.vueRootComponent = 'app';
|
window.vueRootComponent = 'app';
|
||||||
</script>
|
</script>
|
||||||
{{ encore_entry_script_tags('accompanying_course') }}
|
{{ encore_entry_script_tags('vue_accourse') }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block css %}
|
{% block css %}
|
||||||
{{ encore_entry_link_tags('accompanying_course') }}
|
{{ encore_entry_link_tags('vue_accourse') }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block js %}
|
{% block js %}
|
||||||
@ -24,5 +24,5 @@
|
|||||||
window.accompanyingCourseId = {{ accompanyingCourse.id|e('js') }};
|
window.accompanyingCourseId = {{ accompanyingCourse.id|e('js') }};
|
||||||
window.vueRootComponent = 'banner';
|
window.vueRootComponent = 'banner';
|
||||||
</script>
|
</script>
|
||||||
{{ encore_entry_script_tags('accompanying_course') }}
|
{{ encore_entry_script_tags('vue_accourse') }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user