household address: fix conflict on branch merge

This commit is contained in:
nobohan 2021-06-29 17:47:40 +02:00
commit 5553c7314c
20 changed files with 310 additions and 122 deletions

View File

@ -4,6 +4,7 @@ namespace Chill\ActivityBundle\Menu;
use Chill\MainBundle\Routing\LocalMenuBuilderInterface; use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
use Chill\MainBundle\Security\Authorization\AuthorizationHelper; use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Knp\Menu\MenuItem; use Knp\Menu\MenuItem;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Symfony\Contracts\Translation\TranslatorInterface; use Symfony\Contracts\Translation\TranslatorInterface;
@ -34,21 +35,13 @@ class AccompanyingCourseMenuBuilder implements LocalMenuBuilderInterface
{ {
$period = $parameters['accompanyingCourse']; $period = $parameters['accompanyingCourse'];
$menu->addChild($this->translator->trans('Activity list'), [ if (AccompanyingPeriod::STEP_DRAFT !== $period->getStep()) {
'route' => 'chill_activity_activity_list', $menu->addChild($this->translator->trans('Activity list'), [
'routeParameters' => [ 'route' => 'chill_activity_activity_list',
'accompanying_period_id' => $period->getId(), 'routeParameters' => [
]]) 'accompanying_period_id' => $period->getId(),
->setExtras(['order' => 40]); ]])
->setExtras(['order' => 40]);
$menu->addChild($this->translator->trans('Add a new activity'), [ }
'route' => 'chill_activity_activity_select_type',
'routeParameters' => [
'accompanying_period_id' => $period->getId(),
]])
->setExtras(['order' => 41]);
} }
} }

View File

@ -132,6 +132,7 @@ class Address
/** /**
* True if the address is a "no address", aka homeless person, ... * True if the address is a "no address", aka homeless person, ...
* @groups({"write"}) * @groups({"write"})
* @ORM\Column(type="boolean")
* *
* @var bool * @var bool
*/ */
@ -298,7 +299,7 @@ class Address
* @param bool $isNoAddress * @param bool $isNoAddress
* @return $this * @return $this
*/ */
public function setIsNoAddress(bool $isNoAddress) public function setIsNoAddress(bool $isNoAddress): self
{ {
$this->isNoAddress = $isNoAddress; $this->isNoAddress = $isNoAddress;
return $this; return $this;

View File

@ -35,6 +35,7 @@ $table-body-td-text-align: left;
// Tabs // Tabs
$tabs-nav-margin-bottom: 0.2em; $tabs-nav-margin-bottom: 0.2em;
$tabs-nav-bg-color: $yellow; $tabs-nav-bg-color: $yellow;
$tabs-nav-bg-color-light: lighten($yellow, 10%);
$tabs-nav-text-color: $blue; $tabs-nav-text-color: $blue;
$tabs-new-border: none; $tabs-new-border: none;
$tabs-nav-hover-border: none; $tabs-nav-hover-border: none;

View File

@ -26,7 +26,13 @@ $global-bg-color: $yellow;
color: $tabs-nav-title-text-color; color: $tabs-nav-title-text-color;
} }
> a { &.sub-menu {
padding-left: 20px;
> a {
background-color: $tabs-nav-bg-color-light;
}
}
> a {
display: block; display: block;
width: auto; width: auto;
padding: $tabs-nav-padding; padding: $tabs-nav-padding;
@ -38,11 +44,11 @@ $global-bg-color: $yellow;
@include border-top-radius($base-border-radius); @include border-top-radius($base-border-radius);
@include border-bottom-radius($base-border-radius); @include border-bottom-radius($base-border-radius);
&:hover, &:active { &:hover, &:active {
border: $tabs-nav-hover-border; border: $tabs-nav-hover-border;
color: $tabs-nav-hover-text-color; color: $tabs-nav-hover-text-color;
text-decoration: none; text-decoration: none;
} }
} }
} }
} }

View File

@ -46,6 +46,7 @@
<city-selection <city-selection
v-bind:address="address" v-bind:address="address"
v-bind:focusOnAddress="focusOnAddress"
v-bind:getReferenceAddresses="getReferenceAddresses"> v-bind:getReferenceAddresses="getReferenceAddresses">
</city-selection> </city-selection>
@ -173,6 +174,14 @@ export default {
// this.$refs.search.focus(); // positionner le curseur à l'ouverture de la modale // this.$refs.search.focus(); // positionner le curseur à l'ouverture de la modale
//}) //})
}, },
focusOnCity() {
const citySelector = document.getElementById('citySelector');
citySelector.focus();
},
focusOnAddress() {
const addressSelector = document.getElementById('addressSelector');
addressSelector.focus();
},
getCountries() { getCountries() {
console.log('getCountries'); console.log('getCountries');
this.loading = true; this.loading = true;

View File

@ -1,6 +1,7 @@
<template> <template>
<div class="container"> <div class="container">
<VueMultiselect <VueMultiselect
id="addressSelector"
v-model="value" v-model="value"
@select="selectAddress" @select="selectAddress"
name="field" name="field"
@ -70,7 +71,7 @@ export default {
}, },
methods: { methods: {
transName(value) { transName(value) {
return value.streetNumber === undefined ? value.street : `${value.street}, ${value.streetNumber}` return value.streetNumber === undefined ? value.street : `${value.streetNumber}, ${value.street}`
}, },
selectAddress(value) { selectAddress(value) {
this.address.selected.address = value; this.address.selected.address = value;

View File

@ -1,6 +1,7 @@
<template> <template>
<div class="container"> <div class="container">
<VueMultiselect <VueMultiselect
id="citySelector"
v-model="value" v-model="value"
@select="selectCity" @select="selectCity"
name="field" name="field"
@ -35,7 +36,7 @@ import VueMultiselect from 'vue-multiselect';
export default { export default {
name: 'CitySelection', name: 'CitySelection',
components: { VueMultiselect }, components: { VueMultiselect },
props: ['address', 'getReferenceAddresses'], props: ['address', 'getReferenceAddresses', 'focusOnAddress'],
data() { data() {
return { return {
value: null value: null
@ -74,6 +75,7 @@ export default {
this.address.newPostalCode.name = value.name; this.address.newPostalCode.name = value.name;
this.address.newPostalCode.code = value.code; this.address.newPostalCode.code = value.code;
this.getReferenceAddresses(value); this.getReferenceAddresses(value);
this.focusOnAddress();
}, },
addPostalCode() { addPostalCode() {
this.address.writeNewPostalCode = true; this.address.writeNewPostalCode = true;

View File

@ -40,7 +40,6 @@ export default {
return name.fr //TODO multilang return name.fr //TODO multilang
}, },
selectCountry(value) { selectCountry(value) {
console.log(value);
this.address.selected.country = value; this.address.selected.country = value;
this.getCities(value); this.getCities(value);
}, },

View File

@ -14,7 +14,7 @@ class AddressNormalizer implements NormalizerAwareInterface, NormalizerInterface
public function normalize($address, string $format = null, array $context = []) public function normalize($address, string $format = null, array $context = [])
{ {
$data['address_id'] = $address->getId(); $data['address_id'] = $address->getId();
$data['text'] = $address->getStreet().', '.$address->getStreetNumber(); $data['text'] = $address->isNoAddress() ? '' : $address->getStreetNumber().', '.$address->getStreet();
$data['street'] = $address->getStreet(); $data['street'] = $address->getStreet();
$data['streetNumber'] = $address->getStreetNumber(); $data['streetNumber'] = $address->getStreetNumber();
$data['postcode']['name'] = $address->getPostCode()->getName(); $data['postcode']['name'] = $address->getPostCode()->getName();

View File

@ -7,6 +7,7 @@ use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\PersonBundle\Entity\AccompanyingPeriodParticipation; use Chill\PersonBundle\Entity\AccompanyingPeriodParticipation;
use Chill\PersonBundle\Privacy\AccompanyingPeriodPrivacyEvent; use Chill\PersonBundle\Privacy\AccompanyingPeriodPrivacyEvent;
use Chill\PersonBundle\Entity\Person; use Chill\PersonBundle\Entity\Person;
use Chill\PersonBundle\Repository\AccompanyingPeriod\AccompanyingPeriodWorkRepository;
use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter; use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter; use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Bundle\FrameworkBundle\Controller\Controller;
@ -35,14 +36,18 @@ class AccompanyingCourseController extends Controller
protected ValidatorInterface $validator; protected ValidatorInterface $validator;
private AccompanyingPeriodWorkRepository $workRepository;
public function __construct( public function __construct(
SerializerInterface $serializer, SerializerInterface $serializer,
EventDispatcherInterface $dispatcher, EventDispatcherInterface $dispatcher,
ValidatorInterface $validator ValidatorInterface $validator,
AccompanyingPeriodWorkRepository $workRepository
) { ) {
$this->serializer = $serializer; $this->serializer = $serializer;
$this->dispatcher = $dispatcher; $this->dispatcher = $dispatcher;
$this->validator = $validator; $this->validator = $validator;
$this->workRepository = $workRepository;
} }
/** /**
@ -102,9 +107,16 @@ class AccompanyingCourseController extends Controller
['date' => 'DESC'], ['date' => 'DESC'],
); );
$works = $this->workRepository->findByAccompanyingPeriod(
$accompanyingCourse,
['startDate' => 'DESC', 'endDate' => 'DESC'],
3
);
return $this->render('@ChillPerson/AccompanyingCourse/index.html.twig', [ return $this->render('@ChillPerson/AccompanyingCourse/index.html.twig', [
'accompanyingCourse' => $accompanyingCourse, 'accompanyingCourse' => $accompanyingCourse,
'withoutHousehold' => $withoutHousehold, 'withoutHousehold' => $withoutHousehold,
'works' => $works,
'activities' => $activities 'activities' => $activities
]); ]);
} }

View File

@ -47,12 +47,12 @@ class AccompanyingPeriodController extends AbstractController
* @var EventDispatcherInterface * @var EventDispatcherInterface
*/ */
protected $eventDispatcher; protected $eventDispatcher;
/** /**
* @var ValidatorInterface * @var ValidatorInterface
*/ */
protected $validator; protected $validator;
/** /**
* AccompanyingPeriodController constructor. * AccompanyingPeriodController constructor.
* *
@ -64,23 +64,25 @@ class AccompanyingPeriodController extends AbstractController
$this->eventDispatcher = $eventDispatcher; $this->eventDispatcher = $eventDispatcher;
$this->validator = $validator; $this->validator = $validator;
} }
public function listAction(int $person_id): Response public function listAction(int $person_id): Response
{ {
$person = $this->_getPerson($person_id); $person = $this->_getPerson($person_id);
$event = new PrivacyEvent($person, [ $event = new PrivacyEvent($person, [
'element_class' => AccompanyingPeriod::class, 'element_class' => AccompanyingPeriod::class,
'action' => 'list' 'action' => 'list'
]); ]);
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event); $this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event);
$accompanyingPeriods = $person->getAccompanyingPeriodsOrdered();
return $this->render('ChillPersonBundle:AccompanyingPeriod:list.html.twig', [ return $this->render('ChillPersonBundle:AccompanyingPeriod:list.html.twig', [
'accompanying_periods' => $person->getAccompanyingPeriodsOrdered(), 'accompanying_periods' => $accompanyingPeriods,
'person' => $person 'person' => $person
]); ]);
} }
public function createAction(int $person_id, Request $request): Response public function createAction(int $person_id, Request $request): Response
{ {
$person = $this->_getPerson($person_id); $person = $this->_getPerson($person_id);
@ -90,17 +92,17 @@ class AccompanyingPeriodController extends AbstractController
$accompanyingPeriod = new AccompanyingPeriod(new \DateTime('now')); $accompanyingPeriod = new AccompanyingPeriod(new \DateTime('now'));
$accompanyingPeriod->setClosingDate(new \DateTime('now')); $accompanyingPeriod->setClosingDate(new \DateTime('now'));
$accompanyingPeriod->addPerson($person); $accompanyingPeriod->addPerson($person);
//or $person->addAccompanyingPeriod($accompanyingPeriod); //or $person->addAccompanyingPeriod($accompanyingPeriod);
$form = $this->createForm( $form = $this->createForm(
AccompanyingPeriodType::class, AccompanyingPeriodType::class,
$accompanyingPeriod, [ $accompanyingPeriod, [
'period_action' => 'create', 'period_action' => 'create',
'center' => $person->getCenter() 'center' => $person->getCenter()
]); ]);
if ($request->getMethod() === 'POST') { if ($request->getMethod() === 'POST') {
$form->handleRequest($request); $form->handleRequest($request);
$errors = $this->_validatePerson($person); $errors = $this->_validatePerson($person);
@ -120,7 +122,7 @@ class AccompanyingPeriodController extends AbstractController
$this->generateUrl('chill_person_accompanying_period_list', [ $this->generateUrl('chill_person_accompanying_period_list', [
'person_id' => $person->getId() 'person_id' => $person->getId()
])); ]));
} else { } else {
$flashBag->add('error', $this->get('translator') $flashBag->add('error', $this->get('translator')
->trans('Error! Period not created!')); ->trans('Error! Period not created!'));
@ -137,7 +139,7 @@ class AccompanyingPeriodController extends AbstractController
'accompanying_period' => $accompanyingPeriod 'accompanying_period' => $accompanyingPeriod
]); ]);
} }
/** /**
* @throws Exception * @throws Exception
*/ */
@ -154,7 +156,7 @@ class AccompanyingPeriodController extends AbstractController
/** @var Person $person */ /** @var Person $person */
$person = $this->_getPerson($person_id); $person = $this->_getPerson($person_id);
// CHECK // CHECK
if (! $accompanyingPeriod->containsPerson($person)) { if (! $accompanyingPeriod->containsPerson($person)) {
throw new Exception("Accompanying period " . $period_id . " does not contain person " . $person_id); throw new Exception("Accompanying period " . $period_id . " does not contain person " . $person_id);
@ -176,7 +178,7 @@ class AccompanyingPeriodController extends AbstractController
if ($form->isValid(['Default', 'closed']) if ($form->isValid(['Default', 'closed'])
&& count($errors) === 0) { && count($errors) === 0) {
$em->flush(); $em->flush();
$flashBag->add('success', $flashBag->add('success',
@ -186,9 +188,9 @@ class AccompanyingPeriodController extends AbstractController
$this->generateUrl('chill_person_accompanying_period_list', [ $this->generateUrl('chill_person_accompanying_period_list', [
'person_id' => $person->getId() 'person_id' => $person->getId()
])); ]));
} else { } else {
$flashBag->add('error', $this->get('translator') $flashBag->add('error', $this->get('translator')
->trans('Error when updating the period')); ->trans('Error when updating the period'));
@ -204,19 +206,19 @@ class AccompanyingPeriodController extends AbstractController
'accompanying_period' => $accompanyingPeriod 'accompanying_period' => $accompanyingPeriod
]); ]);
} }
/** /**
* @throws \Exception * @throws \Exception
*/ */
public function closeAction(int $person_id, Request $request): Response public function closeAction(int $person_id, Request $request): Response
{ {
$person = $this->_getPerson($person_id); $person = $this->_getPerson($person_id);
$this->denyAccessUnlessGranted(PersonVoter::UPDATE, $person, 'You are not allowed to update this person'); $this->denyAccessUnlessGranted(PersonVoter::UPDATE, $person, 'You are not allowed to update this person');
if ($person->isOpen() === false) { if ($person->isOpen() === false) {
$this->get('session')->getFlashBag() $this->get('session')->getFlashBag()
->add('error', $this->get('translator') ->add('error', $this->get('translator')
->trans('Beware period is closed', ['%name%' => $person->__toString()] ->trans('Beware period is closed', ['%name%' => $person->__toString()]
@ -229,7 +231,7 @@ class AccompanyingPeriodController extends AbstractController
} }
$current = $person->getCurrentAccompanyingPeriod(); $current = $person->getCurrentAccompanyingPeriod();
$form = $this->createForm(AccompanyingPeriodType::class, $current, [ $form = $this->createForm(AccompanyingPeriodType::class, $current, [
'period_action' => 'close', 'period_action' => 'close',
'center' => $person->getCenter() 'center' => $person->getCenter()
@ -256,7 +258,7 @@ class AccompanyingPeriodController extends AbstractController
'person_id' => $person->getId() 'person_id' => $person->getId()
]) ])
); );
} else { } else {
$this->get('session')->getFlashBag() $this->get('session')->getFlashBag()
->add('error', $this->get('translator') ->add('error', $this->get('translator')
@ -267,7 +269,7 @@ class AccompanyingPeriodController extends AbstractController
->add('info', $error->getMessage()); ->add('info', $error->getMessage());
} }
} }
} else { //if form is not valid } else { //if form is not valid
$this->get('session')->getFlashBag() $this->get('session')->getFlashBag()
->add('error', ->add('error',
@ -288,7 +290,7 @@ class AccompanyingPeriodController extends AbstractController
'accompanying_period' => $current 'accompanying_period' => $current
]); ]);
} }
private function _validatePerson(Person $person): ConstraintViolationListInterface private function _validatePerson(Person $person): ConstraintViolationListInterface
{ {
$errors = $this->validator->validate($person, null, $errors = $this->validator->validate($person, null,
@ -296,10 +298,10 @@ class AccompanyingPeriodController extends AbstractController
// Can be disabled with config // Can be disabled with config
if (false === $this->container->getParameter('chill_person.allow_multiple_simultaneous_accompanying_periods')) { if (false === $this->container->getParameter('chill_person.allow_multiple_simultaneous_accompanying_periods')) {
$errors_accompanying_period = $this->validator->validate($person, null, $errors_accompanying_period = $this->validator->validate($person, null,
['accompanying_period_consistent']); ['accompanying_period_consistent']);
foreach($errors_accompanying_period as $error ) { foreach($errors_accompanying_period as $error ) {
$errors->add($error); $errors->add($error);
} }
@ -307,7 +309,7 @@ class AccompanyingPeriodController extends AbstractController
return $errors; return $errors;
} }
public function openAction(int $person_id, Request $request): Response public function openAction(int $person_id, Request $request): Response
{ {
$person = $this->_getPerson($person_id); $person = $this->_getPerson($person_id);
@ -384,7 +386,7 @@ class AccompanyingPeriodController extends AbstractController
'accompanying_period' => $accompanyingPeriod 'accompanying_period' => $accompanyingPeriod
]); ]);
} }
public function reOpenAction(int $person_id, int $period_id, Request $request): Response public function reOpenAction(int $person_id, int $period_id, Request $request): Response
{ {
/** @var Person $person */ /** @var Person $person */
@ -392,7 +394,7 @@ class AccompanyingPeriodController extends AbstractController
/* @var $period AccompanyingPeriod */ /* @var $period AccompanyingPeriod */
$period = \array_filter( $period = \array_filter(
$person->getAccompanyingPeriods(), $person->getAccompanyingPeriods(),
function (AccompanyingPeriod $p) use ($period_id) { function (AccompanyingPeriod $p) use ($period_id) {
return $p->getId() === ($period_id); return $p->getId() === ($period_id);
} }
@ -417,13 +419,13 @@ class AccompanyingPeriodController extends AbstractController
return $this->redirectToRoute('chill_person_accompanying_period_list', [ return $this->redirectToRoute('chill_person_accompanying_period_list', [
'person_id' => $person->getId() 'person_id' => $person->getId()
]); ]);
} elseif ($confirm === false && $period->canBeReOpened($person)) { } elseif ($confirm === false && $period->canBeReOpened($person)) {
return $this->render('ChillPersonBundle:AccompanyingPeriod:re_open.html.twig', [ return $this->render('ChillPersonBundle:AccompanyingPeriod:re_open.html.twig', [
'period' => $period, 'period' => $period,
'person' => $person 'person' => $person
]); ]);
} else { } else {
return (new Response()) return (new Response())
->setStatusCode(Response::HTTP_BAD_REQUEST) ->setStatusCode(Response::HTTP_BAD_REQUEST)

View File

@ -118,11 +118,12 @@ export default {
modal.showModal = false; modal.showModal = false;
}, },
addToHousehold() { addToHousehold() {
this.$store.dispatch('addDateToAddressAndAddressToHousehold', { this.$store.dispatch('addDateToAddressAndAddressToHousehold', {
householdId: this.householdId, householdId: this.householdId,
addressId: this.$store.state.newAddress.address_id, addressId: this.$store.state.newAddress.address_id,
body: { validFrom: {datetime: `${this.validFrom}T00:00:00+0100`}} body: { validFrom: {datetime: `${this.validFrom}T00:00:00+0100`}}
}) })
window.location.assign(this.backUrl);
} }
} }
}; };

View File

@ -4,7 +4,7 @@ const appMessages = {
fr: { fr: {
select_a_existing_address: 'Sélectionner une adresse existante', select_a_existing_address: 'Sélectionner une adresse existante',
create_a_new_address: 'Créer une nouvelle adresse', create_a_new_address: 'Créer une nouvelle adresse',
add_an_address_to_household: 'Déménager le ménage', add_an_address_to_household: 'Enregistrer',
validFrom: 'Date du déménagement', validFrom: 'Date du déménagement',
move_date: 'Date du déménagement', move_date: 'Date du déménagement',
back_to_the_list: 'Retour à la liste', back_to_the_list: 'Retour à la liste',

View File

@ -222,11 +222,107 @@
<h2>{{ 'Social actions'|trans }}</h2> <h2>{{ 'Social actions'|trans }}</h2>
{% set person = null %} <div id="accompanying_course_work_list">
{% for w in works %}
<div class="item">
<div class="title">
<h2 class="action_title">
{{ w.socialAction|chill_entity_render_box({ 'no-badge': false }) }}
</h2>
</div>
<div class="timeline">
<ul class="timeline">
<li class="completed">
<div class="date">
<span>{{ w.createdAt|format_date('long') }}</span>
</div>
<div class="label">
<span>{{ 'accompanying_course_work.create_date'|trans }}</span>
</div>
</li>
<li class="completed">
<div class="date">
<span>{{ w.startDate|format_date('long') }}</span>
</div>
<div class="label">
<span>{{ 'accompanying_course_work.start_date'|trans }}</span>
</div>
</li>
<li class="{%if date(w.endDate) < date('now') %}completed{% endif %}">
<div class="date">
<span>{{ w.endDate|format_date('long') }}</span>
</div>
<div class="label">
<span>{{ 'accompanying_course_work.end_date'|trans }}</span>
</div>
</li>
</ul>
</div>
{% if w.results|length > 0 %}
<div class="objective_results objective_results__without-objectives">
<div class="obj without_objective">
<p class="title_label">{{ 'accompanying_course_work.goal'|trans }}</p>
<p class="chill-no-data-statement">{{ 'accompanying_course_work.results without objective'|trans }}</p>
</div>
<div class="res results">
<p class="title_label">{{ 'accompanying_course_work.results'|trans }}</p>
<ul class="result_list">
{% for r in w.results %}
<li class="badge badge-primary">{{ r.title|localize_translatable_string }}</li>
{% endfor %}
</ul>
</div>
</div>
{% endif %}
{% if w.goals|length > 0 %}
{% for g in w.goals %}
<div class="objective_results objective_results--with-objectives">
<div class="objective obj">
<p class="title_label">{{ 'accompanying_course_work.goal'|trans }}</p>
<h3 class="goal_title">{{ g.goal.title|localize_translatable_string }}</h3>
</div>
<div class="results res">
{% if g.results|length == 0 %}
<p class="title_label">{{ 'accompanying_course_work.results'|trans }}</p>
<p class="chill-no-data-statement">{{ 'accompanying_course_work.no_results'|trans }}</p>
{% else %}
<p class="title_label">{{ 'accompanying_course_work.results'|trans }}</p>
<ul class="result_list">
{% for r in g.results %}
<li class="badge badge-primary">{{ r.title|localize_translatable_string }}</li>
{% endfor %}
</ul>
{% endif %}
</div>
</div>
{% endfor %}
{% endif %}
<div class="updatedBy">
{{ 'Last updated by'|trans}}: {{ w.updatedBy|chill_entity_render_box }}, {{ w.updatedAt|format_datetime('long', 'short') }}
</div>
</div>
{% else %}
<p class="chill-no-data-statement">{{ 'accompanying_course_work.Any work'|trans }}</p>
{% endfor %}
</div>
{% block contentActivity %} {% block contentActivity %}
{% set person = null %}
{% include 'ChillActivityBundle:Activity:list.html.twig' with {'context': 'accompanyingCourse', 'context': 'person'} %} {% include 'ChillActivityBundle:Activity:list.html.twig' with {'context': 'accompanyingCourse', 'context': 'person'} %}
{% endblock %} {% endblock %}
{# ==> insert accompanyingCourse vue component #} {# ==> insert accompanyingCourse vue component #}
<div id="accompanying-course"></div> <div id="accompanying-course"></div>
{% endblock %} {% endblock %}
{% block css %}
{{ parent() }}
{{ encore_entry_link_tags('accompanying_course_work_list') }}
{% endblock %}

View File

@ -102,7 +102,7 @@
</div> </div>
</div> </div>
{% else %} {% else %}
<p class="chill-no-data-statement">{{ 'accompanying_course_work.No work'|trans }}</p> <p class="chill-no-data-statement">{{ 'accompanying_course_work.Any work'|trans }}</p>
{% endfor %} {% endfor %}
</div> </div>

View File

@ -8,22 +8,48 @@
<h1>{{ 'Accompanying period list'|trans }}</h1> <h1>{{ 'Accompanying period list'|trans }}</h1>
<table class="rounded"> {% for accompanying_period in accompanying_periods %}
<thead> <div class="flex-table">
<tr> <div class="item-bloc">
<th class="chill-red">{{ 'accompanying_period.dates'|trans }}</th> <div class="item-row">
{% if chill_accompanying_periods.fields.user == 'visible' %} <div class="item-col">
<th class="chill-blue">{{ 'Accompanying user'|trans }}</th> {{'period'|trans}} <b>#{{ accompanying_period.id }}</b>
{% endif %} {% if accompanying_period.emergency %}
<th class="chill-orange">{{ 'Remark'|trans }}</th> &nbsp;
<th>&nbsp;</th> <span class="badge badge-primary">
</tr> {{- 'Emergency'|trans|upper -}}
</span>
{% endif %}
{% if accompanying_period.confidential %}
&nbsp;
<span class="badge badge-primary">
{{- 'Confidential'|trans|upper -}}
</span>
{% endif %}
{% if accompanying_period.step == 'DRAFT' %}
&nbsp;
<span class="badge badge-primary">
{{- 'Draft'|trans|upper -}}
</span>
{% else %}
<span class="badge badge-primary">
{{- 'Confirmed'|trans|upper -}}
</span>
{% endif %}
</div>
</thead> <div class="item-col">
<tbody> {% if chill_accompanying_periods.fields.user == 'visible' %}
{% for accompanying_period in accompanying_periods %} {% if accompanying_period.user %}
<tr> {{ accompanying_period.user.username }}
<td> {% else %}
<span class="chill-no-data-statement">{{ 'No accompanying user'|trans }}</span>
{% endif %}
{% endif %}
</div>
</div>
<div class="item-row">
{% if accompanying_period.closingDate == null %} {% if accompanying_period.closingDate == null %}
{{ 'accompanying_period.dates_from_%opening_date%'|trans({ '%opening_date%': accompanying_period.openingDate|format_date('long') } ) }} {{ 'accompanying_period.dates_from_%opening_date%'|trans({ '%opening_date%': accompanying_period.openingDate|format_date('long') } ) }}
{% else %} {% else %}
@ -32,41 +58,62 @@
'%closing_date%': accompanying_period.closingDate|format_date('long')} '%closing_date%': accompanying_period.closingDate|format_date('long')}
) }} ) }}
{% if accompanying_period.isOpen == false %} {% if accompanying_period.isOpen == false %}
<dl class="chill_view_data"> <dl class="chill_view_data">
<dt>{{ 'Closing motive'|trans }}&nbsp;:</dt> <dt>{{ 'Closing motive'|trans }}&nbsp;:</dt>
<dd>{{ accompanying_period.closingMotive|chill_entity_render_box }}</dd> <dd>{{ accompanying_period.closingMotive|chill_entity_render_box }}</dd>
</dl> </dl>
{% endif %} {% endif %}
{% endif %} {% endif %}
</td> </div>
{% if chill_accompanying_periods.fields.user == 'visible' %}
<td> <div class="item-col">
{% if accompanying_period.user %} <h3>{{ 'Participants'|trans }}</h3>
{{ accompanying_period.user.username }} {% if accompanying_period.participations.count > 0 %}
{% else %} {% for p in accompanying_period.participations %}
<span class="chill-no-data-statement">{{ 'No accompanying user'|trans }}</span> <p>
{% endif %} <a href="{{ path('chill_person_accompanying_period_list', { person_id: p.person.id }) }}">
</td> {{ p.person.firstname ~ ' ' ~ p.person.lastname }}
{% endif %} </a>
<td> </p>
{% if accompanying_period is not empty %} {% endfor %}
<blockquote class="chill-user-quote"> {% else %}
{{ accompanying_period.remark|chill_markdown_to_html }} <span class="chill-no-data-statement">{{ 'No data given'|trans }}</span>
</blockquote> {% endif %}
{% else %} </div>
{{ null|chill_print_or_message('No remark', 'blockquote') }} <div class="item-col">
{% endif %} <h3>{{ 'Requestor'|trans }}</h3>
</td> {% if accompanying_period.requestorPerson is not null or accompanying_period.requestorThirdParty is not null %}
<td> {% if accompanying_period.requestorPerson is not null %}
<p>{{ accompanying_period.requestorPerson.firstname ~ ' ' ~ accompanying_period.requestorPerson.lastname }}</p>
{% endif %}
{% if accompanying_period.requestorThirdParty is not null %}
<p>{{ accompanying_period.requestorThirdParty.name }}</p>
{% endif %}
{% else %}
<span class="chill-no-data-statement">{{ 'No data given'|trans }}</span>
{% endif %}
</div>
<div class="item-col">
<h3>{{ 'Social issues'|trans }}</h3>
{% if accompanying_period.socialIssues.count > 0 %}
{% for si in accompanying_period.socialIssues %}
<p>{{ si.title|localize_translatable_string }}</p>
{% endfor %}
{% else %}
<span class="chill-no-data-statement">{{ 'No data given'|trans }}</span>
{% endif %}
</div>
<div class="item-row">
<ul class="record_actions"> <ul class="record_actions">
{# TODO if enable_accompanying_course_with_multiple_persons is true ... #} {# TODO if enable_accompanying_course_with_multiple_persons is true ... #}
<li> <li>
<a href="{{ path('chill_person_accompanying_course_index', { 'accompanying_period_id': accompanying_period.id }) }}" class="sc-button bt-show"></a> <a href="{{ path('chill_person_accompanying_course_index', { 'accompanying_period_id': accompanying_period.id }) }}" class="sc-button bt-show"></a>
</li> </li>
{#
<li> <li>
<a href="{{ path('chill_person_accompanying_period_update', {'person_id' : person.id, 'period_id' : accompanying_period.id } ) }}" class="sc-button bt-update no-content"></a> <a href="{{ path('chill_person_accompanying_period_update', {'person_id' : person.id, 'period_id' : accompanying_period.id } ) }}" class="sc-button bt-update no-content"></a>
</li> </li>
@ -84,21 +131,29 @@
</a> </a>
</li> </li>
{% endif %} {% endif %}
#}
</ul> </ul>
</div>
</td> </div>
</tr> </div>
{% endfor %} <p></p>
</tbody> {% endfor %}
</table>
<div class="form_control">
<div class="form_control">
<ul class="record_actions"> <ul class="record_actions">
<li class="cancel"> <li class="cancel">
<a href="{{ path ('chill_person_view', {'person_id' : person.id } ) }}" class="sc-button bt-cancel"> <a href="{{ path ('chill_person_view', {'person_id' : person.id } ) }}" class="sc-button bt-cancel">
{{ 'Person details'|trans }} {{ 'Person details'|trans }}
</a> </a>
</li> </li>
<li>
<a href="{{ path ('chill_person_accompanying_course_new', {'person_id' : [ person.id ] } ) }}" class="sc-button bt-create">
{{ 'Create an accompanying period'|trans }}
</a>
</li>
{#
<li> <li>
<a href="{{ path ('chill_person_accompanying_period_create', {'person_id' : person.id } ) }}" class="sc-button bt-create has-hidden"> <a href="{{ path ('chill_person_accompanying_period_create', {'person_id' : person.id } ) }}" class="sc-button bt-create has-hidden">
<span class="show-on-hover">{{ 'Add an accompanying period in the past'|trans }}</span> <span class="show-on-hover">{{ 'Add an accompanying period in the past'|trans }}</span>
@ -112,6 +167,7 @@
</a> </a>
</li> </li>
{% endif %} {% endif %}
#}
</ul> </ul>
</div> </div>

View File

@ -12,11 +12,11 @@
{% else %} {% else %}
<div class="top"><i class="fa fa-caret-up fa-3x"></i></div> <div class="top"><i class="fa fa-caret-up fa-3x"></i></div>
{% endif %} {% endif %}
{% for address in household.addresses %} {% for address in household.addresses %}
<div class="col-b"></div> <div class="col-b"></div>
<div class="col-c content{{ ' row' ~ loop.index }}"> <div class="col-c content{{ ' row' ~ loop.index }}">
<div class="address"> <div class="address">
{% if address.isNoAddress == true %} {% if address.isNoAddress == true %}
@ -39,22 +39,22 @@
{% endif %} {% endif %}
</div> </div>
<ul class="record_actions"> {#<ul class="record_actions">
<li> <li>
<a href="{{ path('chill_person_household_address_edit', { 'household_id': household.id, 'address_id' : address.id } ) }}" class="sc-button bt-edit"></a> <a href="{{ path('chill_person_household_address_edit', { 'household_id': household.id, 'address_id' : address.id } ) }}" class="sc-button bt-edit"></a>
</li> </li>
</ul> </ul> #}
</div> </div>
<div class="date"> <div class="date">
{% if address.validFrom is not empty %} {% if address.validFrom is not empty %}
{{ address.validFrom|format_date('long') }} {{ address.validFrom|format_date('long') }}
{% endif %} {% endif %}
</div> </div>
{% endfor %} {% endfor %}
</div> </div>
<ul class="record_actions"> <ul class="record_actions">

View File

@ -16,8 +16,8 @@
#} #}
<ul class="tab-nav"> <ul class="tab-nav">
{% for menu in menus %} {% for menu in menus %}
<li class=""> <li class="{{ menu.extra('class') }}">
<a href="{{ menu.uri }}" >{{ menu.label|upper }}</a> <a href="{{ menu.uri }}" >{{ menu.label|upper }}</a>
</li> </li>
{% endfor %} {% endfor %}
</ul> </ul>

View File

@ -46,6 +46,7 @@ services:
$serializer: '@Symfony\Component\Serializer\SerializerInterface' $serializer: '@Symfony\Component\Serializer\SerializerInterface'
$dispatcher: '@Symfony\Contracts\EventDispatcher\EventDispatcherInterface' $dispatcher: '@Symfony\Contracts\EventDispatcher\EventDispatcherInterface'
$validator: '@Symfony\Component\Validator\Validator\ValidatorInterface' $validator: '@Symfony\Component\Validator\Validator\ValidatorInterface'
$workRepository: '@Chill\PersonBundle\Repository\AccompanyingPeriod\AccompanyingPeriodWorkRepository'
tags: ['controller.service_arguments'] tags: ['controller.service_arguments']
Chill\PersonBundle\Controller\AccompanyingCourseApiController: Chill\PersonBundle\Controller\AccompanyingCourseApiController:

View File

@ -165,6 +165,8 @@ An accompanying period starts: Une période d'accompagnement est ouverte
Any accompanying periods are open: Aucune période d'accompagnement ouverte Any accompanying periods are open: Aucune période d'accompagnement ouverte
An accompanying period is open: Une période d'accompagnement est ouverte An accompanying period is open: Une période d'accompagnement est ouverte
Accompanying period list: Périodes d'accompagnement Accompanying period list: Périodes d'accompagnement
Accompanying period: Parcours d'accompagnement
period: Parcours
New accompanying course: Nouveau parcours d'accompagnement New accompanying course: Nouveau parcours d'accompagnement
Choose a motive: Motif de fermeture Choose a motive: Motif de fermeture
Re-open accompanying period: Ré-ouvrir Re-open accompanying period: Ré-ouvrir
@ -189,6 +191,8 @@ See accompanying period: Voir cette période d'accompagnement
Referrer: Référent Referrer: Référent
Some peoples does not belong to any household currently. Add them to an household soon: Certaines personnes n'appartiennent à aucun ménage actuellement. Renseignez leur appartenance à un ménage dès que possible. Some peoples does not belong to any household currently. Add them to an household soon: Certaines personnes n'appartiennent à aucun ménage actuellement. Renseignez leur appartenance à un ménage dès que possible.
Add to household now: Ajouter à un ménage Add to household now: Ajouter à un ménage
Requestor: Demandeur
# pickAPersonType # pickAPersonType
Pick a person: Choisir une personne Pick a person: Choisir une personne
@ -320,6 +324,9 @@ accompanying_period:
dates_from_%opening_date%_to_%closing_date%: Ouvert du %opening_date% au %closing_date% dates_from_%opening_date%_to_%closing_date%: Ouvert du %opening_date% au %closing_date%
occasional: ponctuel occasional: ponctuel
regular: régulier regular: régulier
Confidential: confidentiel
Draft: brouillon
Confirmed: en file active
# Accompanying Course # Accompanying Course
Accompanying Course: Parcours d'accompagnement Accompanying Course: Parcours d'accompagnement
@ -353,4 +360,5 @@ accompanying_course_work:
no_results: Aucun résultat - orientation no_results: Aucun résultat - orientation
results: Résultats - orientations results: Résultats - orientations
goal: Objectif - motif - dispositif goal: Objectif - motif - dispositif
Any work: Aucune action d'accompagnement