mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Merge conflicts resolved
This commit is contained in:
commit
3fd4c6339a
@ -61,7 +61,7 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="Chill\PersonBundle\Entity\AccompanyingPeriod")
|
||||
* @Groups({"read", "docgen:read"})
|
||||
* @Groups({"read"})
|
||||
*/
|
||||
private ?AccompanyingPeriod $accompanyingPeriod = null;
|
||||
|
||||
@ -75,16 +75,19 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="Chill\ActivityBundle\Entity\ActivityPresence")
|
||||
* @Groups({"docgen:read"})
|
||||
*/
|
||||
private ?ActivityPresence $attendee = null;
|
||||
|
||||
/**
|
||||
* @ORM\Embedded(class="Chill\MainBundle\Entity\Embeddable\CommentEmbeddable", columnPrefix="comment_")
|
||||
* @Groups({"docgen:read"})
|
||||
*/
|
||||
private CommentEmbeddable $comment;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="datetime")
|
||||
* @Groups({"docgen:read"})
|
||||
*/
|
||||
private DateTime $date;
|
||||
|
||||
@ -100,6 +103,7 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="boolean", options={"default": false})
|
||||
* @Groups({"docgen:read"})
|
||||
*/
|
||||
private bool $emergency = false;
|
||||
|
||||
@ -130,16 +134,19 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
|
||||
|
||||
/**
|
||||
* @ORM\ManyToMany(targetEntity="Chill\ActivityBundle\Entity\ActivityReason")
|
||||
* @Groups({"docgen:read"})
|
||||
*/
|
||||
private Collection $reasons;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Scope")
|
||||
* @Groups({"docgen:read"})
|
||||
*/
|
||||
private ?Scope $scope = null;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", options={"default": ""})
|
||||
* @Groups({"docgen:read"})
|
||||
*/
|
||||
private string $sentReceived = '';
|
||||
|
||||
@ -170,12 +177,13 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\User")
|
||||
* @Groups({"docgen:read"})
|
||||
*/
|
||||
private User $user;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToMany(targetEntity="Chill\MainBundle\Entity\User")
|
||||
* @Groups({"read"})
|
||||
* @Groups({"read", "docgen:read"})
|
||||
*/
|
||||
private ?Collection $users = null;
|
||||
|
||||
@ -302,6 +310,18 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
|
||||
return $this->documents;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Groups({"docgen:read"})
|
||||
*/
|
||||
public function getDurationMinute(): int
|
||||
{
|
||||
if (null === $this->durationTime) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return (int) round(($this->durationTime->getTimestamp() + $this->durationTime->getOffset()) / 60.0, 0);
|
||||
}
|
||||
|
||||
public function getDurationTime(): ?DateTime
|
||||
{
|
||||
return $this->durationTime;
|
||||
@ -402,6 +422,18 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
|
||||
return $this->travelTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Groups({"docgen:read"})
|
||||
*/
|
||||
public function getTravelTimeMinute(): int
|
||||
{
|
||||
if (null === $this->travelTime) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return (int) round(($this->travelTime->getTimestamp() + $this->travelTime->getOffset()) / 60.0, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
|
@ -12,6 +12,7 @@ declare(strict_types=1);
|
||||
namespace Chill\ActivityBundle\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Serializer\Annotation as Serializer;
|
||||
|
||||
/**
|
||||
* Class ActivityPresence.
|
||||
@ -31,11 +32,14 @@ class ActivityPresence
|
||||
* @ORM\Id
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
* @Serializer\Groups({"docgen:read"})
|
||||
*/
|
||||
private ?int $id;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="json")
|
||||
* @Serializer\Groups({"docgen:read"})
|
||||
* @Serializer\Context({"is-translatable": true}, groups={"docgen:read"})
|
||||
*/
|
||||
private array $name = [];
|
||||
|
||||
|
@ -13,6 +13,7 @@ namespace Chill\ActivityBundle\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use InvalidArgumentException;
|
||||
use Symfony\Component\Serializer\Annotation as Serializer;
|
||||
use Symfony\Component\Serializer\Annotation\Groups;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
@ -118,6 +119,7 @@ class ActivityType
|
||||
* @ORM\Id
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
* @Groups({"docgen:read"})
|
||||
*/
|
||||
private ?int $id;
|
||||
|
||||
@ -133,7 +135,8 @@ class ActivityType
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="json")
|
||||
* @Groups({"read"})
|
||||
* @Groups({"read", "docgen:read"})
|
||||
* @Serializer\Context({"is-translatable": true}, groups={"docgen:read"})
|
||||
*/
|
||||
private array $name = [];
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
<select class="form-select" v-model="template">
|
||||
<option disabled selected value="">{{ $t('choose_a_template') }}</option>
|
||||
<template v-for="t in templates">
|
||||
<option v-bind:value="t.id">{{ t.name.fr }}</option>
|
||||
<option v-bind:value="t.id">{{ t.name.fr || 'Aucun nom défini' }}</option>
|
||||
</template>
|
||||
</select>
|
||||
<button v-if="canGenerate" class="btn btn-update btn-sm change-icon" type="button" @click="generateDocument"><i class="fa fa-fw fa-cog"></i></button>
|
||||
@ -48,6 +48,7 @@ export default {
|
||||
required: true,
|
||||
},
|
||||
templates: {
|
||||
type: Array,
|
||||
required: true,
|
||||
},
|
||||
// beforeMove execute "something" before
|
||||
@ -73,7 +74,11 @@ export default {
|
||||
return true;
|
||||
},
|
||||
getDescription() {
|
||||
return this.templates.find(t => t.id === this.template).description || '';
|
||||
let desc = this.templates.find(t => t.id === this.template);
|
||||
if (null === desc) {
|
||||
return '';
|
||||
}
|
||||
return desc.description || '';
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
|
@ -64,7 +64,7 @@ class Location implements TrackCreationInterface, TrackUpdateInterface
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", length=255, nullable=true)
|
||||
* @Serializer\Groups({"read", "write"})
|
||||
* @Serializer\Groups({"read", "write", "docgen:read"})
|
||||
*/
|
||||
private ?string $email = null;
|
||||
|
||||
|
@ -45,8 +45,6 @@ class EntityToJsonTransformer implements DataTransformerInterface
|
||||
{
|
||||
$denormalized = json_decode($value, true);
|
||||
|
||||
dump($value);
|
||||
|
||||
if ($this->multiple) {
|
||||
if (null === $denormalized) {
|
||||
return [];
|
||||
|
@ -7,7 +7,6 @@ const i18n = _createI18n(appMessages);
|
||||
|
||||
let appsOnPage = new Map();
|
||||
|
||||
|
||||
function loadDynamicPicker(element) {
|
||||
|
||||
let apps = element.querySelectorAll('[data-module="pick-dynamic"]');
|
||||
@ -75,23 +74,23 @@ function loadDynamicPicker(element) {
|
||||
}
|
||||
|
||||
|
||||
// document.addEventListener('show-hide-show', function(e) {
|
||||
// console.log('creation event caught')
|
||||
// loadDynamicPicker(e.detail.container)
|
||||
// })
|
||||
document.addEventListener('show-hide-show', function(e) {
|
||||
console.log('creation event caught')
|
||||
loadDynamicPicker(e.detail.container)
|
||||
})
|
||||
|
||||
// document.addEventListener('show-hide-hide', function(e) {
|
||||
// console.log('hiding event caught')
|
||||
// e.detail.container.querySelectorAll('[data-module="pick-dynamic"]').forEach((el) => {
|
||||
// let uniqId = el.dataset.uniqid;
|
||||
// console.log(uniqId);
|
||||
// if (appsOnPage.has(uniqId)) {
|
||||
// appsOnPage.get(uniqId).unmount();
|
||||
// console.log('App has been unmounted')
|
||||
// appsOnPage.delete(uniqId);
|
||||
// }
|
||||
// })
|
||||
// })
|
||||
document.addEventListener('show-hide-hide', function(e) {
|
||||
console.log('hiding event caught')
|
||||
e.detail.container.querySelectorAll('[data-module="pick-dynamic"]').forEach((el) => {
|
||||
let uniqId = el.dataset.uniqid;
|
||||
console.log(uniqId);
|
||||
if (appsOnPage.has(uniqId)) {
|
||||
appsOnPage.get(uniqId).unmount();
|
||||
console.log('App has been unmounted')
|
||||
appsOnPage.delete(uniqId);
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function(e) {
|
||||
console.log('loaded event', e)
|
||||
|
@ -0,0 +1,88 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\MainBundle\Serializer\Normalizer;
|
||||
|
||||
use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable;
|
||||
use Chill\MainBundle\Entity\User;
|
||||
use Chill\MainBundle\Repository\UserRepository;
|
||||
use DateTime;
|
||||
use Symfony\Component\Serializer\Exception\ExceptionInterface;
|
||||
use Symfony\Component\Serializer\Normalizer\ContextAwareNormalizerInterface;
|
||||
use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface;
|
||||
use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait;
|
||||
use function array_key_exists;
|
||||
|
||||
class CommentEmbeddableDocGenNormalizer implements ContextAwareNormalizerInterface, NormalizerAwareInterface
|
||||
{
|
||||
use NormalizerAwareTrait;
|
||||
|
||||
private UserRepository $userRepository;
|
||||
|
||||
public function __construct(UserRepository $userRepository)
|
||||
{
|
||||
$this->userRepository = $userRepository;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param CommentEmbeddable $object
|
||||
*
|
||||
* @throws ExceptionInterface
|
||||
*/
|
||||
public function normalize($object, ?string $format = null, array $context = []): array
|
||||
{
|
||||
if (null === $object) {
|
||||
return [
|
||||
'comment' => '',
|
||||
'isNull' => true,
|
||||
'date' => $this->normalizer->normalize(null, $format, array_merge($context, [
|
||||
'docgen:expects' => DateTime::class,
|
||||
])),
|
||||
'user' => $this->normalizer->normalize(null, $format, array_merge($context, [
|
||||
'docgen:expects' => User::class,
|
||||
])),
|
||||
];
|
||||
}
|
||||
|
||||
$user = $this->userRepository->find($object->getUserId());
|
||||
|
||||
return [
|
||||
'comment' => (string) $object->getComment(),
|
||||
'isNull' => false,
|
||||
'date' => $this->normalizer->normalize($object->getDate(), $format, array_merge($context, [
|
||||
'docgen:expects' => DateTime::class,
|
||||
])),
|
||||
'user' => $this->normalizer->normalize($user, $format, array_merge($context, [
|
||||
'docgen:expects' => User::class,
|
||||
])),
|
||||
];
|
||||
}
|
||||
|
||||
public function supportsNormalization($data, ?string $format = null, array $context = []): bool
|
||||
{
|
||||
if ('docgen' !== $format) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($data instanceof CommentEmbeddable) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (
|
||||
null === $data
|
||||
&& array_key_exists('docgen:expects', $context)
|
||||
&& CommentEmbeddable::class === $context['docgen:expects']) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
@ -69,7 +69,7 @@ class AccompanyingPeriodWorkEvaluationApiController
|
||||
$paginator->setItemsPerPage(count($evaluations));
|
||||
|
||||
return new JsonResponse($this->serializer->serialize(
|
||||
new Collection($evaluations, $paginator),
|
||||
new Collection(array_values($evaluations), $paginator),
|
||||
'json',
|
||||
[
|
||||
AbstractNormalizer::GROUPS => ['read'],
|
||||
|
@ -114,8 +114,6 @@ final class PersonResourceController extends AbstractController
|
||||
]);
|
||||
}
|
||||
|
||||
dump($resource);
|
||||
|
||||
return $this->render(
|
||||
'ChillPersonBundle:PersonResource:edit.html.twig',
|
||||
[
|
||||
@ -139,7 +137,7 @@ final class PersonResourceController extends AbstractController
|
||||
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($request->getMethod() === Request::METHOD_POST && $form->isValid()) {
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$this->denyAccessUnlessGranted(PersonVoter::CREATE, $personOwner);
|
||||
|
||||
$personResource = new PersonResource();
|
||||
|
@ -12,13 +12,12 @@ declare(strict_types=1);
|
||||
namespace Chill\PersonBundle\Entity\Person;
|
||||
|
||||
use Chill\MainBundle\Doctrine\Model\TrackCreationInterface;
|
||||
use Chill\MainBundle\Doctrine\Model\TrackCreationTrait;
|
||||
use Chill\MainBundle\Doctrine\Model\TrackUpdateInterface;
|
||||
use Chill\MainBundle\Doctrine\Model\TrackUpdateTrait;
|
||||
use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable;
|
||||
use Chill\MainBundle\Entity\User;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\ThirdPartyBundle\Entity\ThirdParty;
|
||||
use DateTime;
|
||||
use DateTimeInterface;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Serializer\Annotation\DiscriminatorMap;
|
||||
use Symfony\Component\Serializer\Annotation\Groups;
|
||||
@ -34,28 +33,20 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
||||
*/
|
||||
class PersonResource implements TrackCreationInterface, TrackUpdateInterface
|
||||
{
|
||||
use TrackCreationTrait;
|
||||
use TrackUpdateTrait;
|
||||
|
||||
/**
|
||||
* @ORM\Embedded(class="Chill\MainBundle\Entity\Embeddable\CommentEmbeddable", columnPrefix="comment_")
|
||||
* @Groups({"read"})
|
||||
*/
|
||||
private CommentEmbeddable $comment;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="datetime")
|
||||
*/
|
||||
private $createdAt;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity=User::class)
|
||||
* @ORM\JoinColumn(nullable=false)
|
||||
*/
|
||||
private User $createdBy;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="text", nullable=true)
|
||||
* @Groups({"read"})
|
||||
*/
|
||||
private $freeText;
|
||||
private ?string $freeText = null;
|
||||
|
||||
/**
|
||||
* @ORM\Id
|
||||
@ -92,16 +83,6 @@ class PersonResource implements TrackCreationInterface, TrackUpdateInterface
|
||||
*/
|
||||
private ?ThirdParty $thirdParty = null;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="datetime", nullable=true)
|
||||
*/
|
||||
private $updatedAt;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity=User::class)
|
||||
*/
|
||||
private User $updatedBy;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->comment = new CommentEmbeddable();
|
||||
@ -112,16 +93,6 @@ class PersonResource implements TrackCreationInterface, TrackUpdateInterface
|
||||
return $this->comment;
|
||||
}
|
||||
|
||||
public function getCreatedAt(): ?DateTimeInterface
|
||||
{
|
||||
return $this->createdAt;
|
||||
}
|
||||
|
||||
public function getCreatedBy(): ?User
|
||||
{
|
||||
return $this->createdBy;
|
||||
}
|
||||
|
||||
public function getFreeText(): ?string
|
||||
{
|
||||
return $this->freeText;
|
||||
@ -155,16 +126,6 @@ class PersonResource implements TrackCreationInterface, TrackUpdateInterface
|
||||
return $this->thirdParty;
|
||||
}
|
||||
|
||||
public function getUpdatedAt(): ?DateTimeInterface
|
||||
{
|
||||
return $this->updatedAt;
|
||||
}
|
||||
|
||||
public function getUpdatedBy(): ?User
|
||||
{
|
||||
return $this->updatedBy;
|
||||
}
|
||||
|
||||
public function setComment(?CommentEmbeddable $comment): self
|
||||
{
|
||||
if (null === $comment) {
|
||||
@ -178,23 +139,6 @@ class PersonResource implements TrackCreationInterface, TrackUpdateInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setCreatedAt(DateTimeInterface $createdAt): self
|
||||
{
|
||||
$this->createdAt = $createdAt;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setCreatedBy(?User $createdBy): self
|
||||
{
|
||||
$this->createdBy = $createdBy;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* SETTERS.
|
||||
*/
|
||||
public function setFreeText(?string $freeText): self
|
||||
{
|
||||
$this->freeText = $freeText;
|
||||
@ -204,6 +148,10 @@ class PersonResource implements TrackCreationInterface, TrackUpdateInterface
|
||||
$this->setThirdParty(null);
|
||||
}
|
||||
|
||||
if ('' === $freeText) {
|
||||
$this->freeText = null;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -245,20 +193,6 @@ class PersonResource implements TrackCreationInterface, TrackUpdateInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setUpdatedAt(DateTimeInterface $updatedAt): self
|
||||
{
|
||||
$this->updatedAt = $updatedAt;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setUpdatedBy(?User $updatedBy): self
|
||||
{
|
||||
$this->updatedBy = $updatedBy;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Assert\Callback
|
||||
*
|
||||
@ -266,9 +200,8 @@ class PersonResource implements TrackCreationInterface, TrackUpdateInterface
|
||||
*/
|
||||
public function validate(ExecutionContextInterface $context, $payload)
|
||||
{
|
||||
if (null === $this->person && null === $this->thirdParty && null === $this->freeText) {
|
||||
if (null === $this->person && null === $this->thirdParty && (null === $this->freeText || '' === $this->freeText)) {
|
||||
$context->buildViolation('You must associate at least one entity')
|
||||
->atPath('person')
|
||||
->addViolation();
|
||||
}
|
||||
}
|
||||
|
@ -58,7 +58,11 @@ const store = createStore({
|
||||
return state.thirdParties.length > 0;
|
||||
},
|
||||
getTemplatesAvailablesForEvaluation: (state) => (evaluation) => {
|
||||
return state.templatesAvailablesForEvaluation.get(evaluation.id) || [];
|
||||
if (state.templatesAvailablesForEvaluation.has(evaluation.id)) {
|
||||
return state.templatesAvailablesForEvaluation.get(evaluation.id);
|
||||
}
|
||||
|
||||
return [];
|
||||
},
|
||||
buildPayload(state) {
|
||||
return {
|
||||
@ -171,7 +175,6 @@ const store = createStore({
|
||||
};
|
||||
g.id = tmpIndex() -1
|
||||
state.goalsPicked.push(g);
|
||||
//console.log('goals picked ids', state.goalsPicked.map(g => g.id))
|
||||
},
|
||||
removeGoal(state, goal) {
|
||||
state.goalsPicked = state.goalsPicked.filter(g => g.id !== goal.id);
|
||||
@ -369,7 +372,6 @@ const store = createStore({
|
||||
|
||||
return makeFetch('PUT', url, payload)
|
||||
.then(data => {
|
||||
console.log('data received', data);
|
||||
if (typeof(callback) !== 'undefined') {
|
||||
return callback(data);
|
||||
} else {
|
||||
|
@ -1,5 +1,6 @@
|
||||
<div class="col-md col-xxl">
|
||||
<div id="collapseForm" class="collapse">
|
||||
<div id="collapseForm" class="{% if not form.vars.submitted %}collapse{% endif %}">
|
||||
<h3 style="margin-bottom: 2rem;">{{ 'Add a person resource'|trans }}</h3>
|
||||
{% include "@ChillPerson/PersonResource/form.html.twig" %}
|
||||
</div>
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
{{ form_start(form, {'attr' : {'id' : 'create-form'}}) }}
|
||||
|
||||
{{ form_errors(form) }}
|
||||
{{ form_row(form.kind) }}
|
||||
|
||||
<div id="linked-entity">
|
||||
<fieldset class="mb-3">
|
||||
<div class="row">
|
||||
@ -10,7 +9,7 @@
|
||||
<div id="entity-selector">
|
||||
<div class="form-check">
|
||||
{% if resource is defined and resource.person is not null %}
|
||||
<input checked type="radio" id="chill_personbundle_person_resource_linkedEntity_0" name="linked-entity" class="form-check-input" value="person" />
|
||||
<input checked type="radio" id="chill_personbundle_person_resource_linkedEntity_0" name="linked-entity" class="form-check-input" value="person" {% if form.vars.submitted and app.request.request.get('linked-entity', null) == 'person' %}checked{% endif %}/>
|
||||
<label class="form-check-label" for="chill_personbundle_person_resource_linkedEntity_0">Usager</label>
|
||||
{% else %}
|
||||
<input type="radio" id="chill_personbundle_person_resource_linkedEntity_0" name="linked-entity" class="form-check-input" value="person" />
|
||||
@ -19,7 +18,7 @@
|
||||
</div>
|
||||
<div class="form-check">
|
||||
{% if resource is defined and resource.thirdparty is not null %}
|
||||
<input checked type="radio" id="chill_personbundle_person_resource_linkedEntity_1" name="linked-entity" class="form-check-input" value="thirdparty" />
|
||||
<input checked type="radio" id="chill_personbundle_person_resource_linkedEntity_1" name="linked-entity" class="form-check-input" value="thirdparty" {% if form.vars.submitted and app.request.request.get('linked-entity', null) == 'thirdparty' %}checked{% endif %}/>
|
||||
<label class="form-check-label" for="chill_personbundle_person_resource_linkedEntity_1">Tiers</label>
|
||||
{% else %}
|
||||
<input type="radio" id="chill_personbundle_person_resource_linkedEntity_1" name="linked-entity" class="form-check-input" value="thirdparty" />
|
||||
@ -28,7 +27,7 @@
|
||||
</div>
|
||||
<div class="form-check">
|
||||
{% if resource is defined and resource.freeText is not null %}
|
||||
<input checked type="radio" id="chill_personbundle_person_resource_linkedEntity_2" name="linked-entity" class="form-check-input" value="freetext" />
|
||||
<input checked type="radio" id="chill_personbundle_person_resource_linkedEntity_2" name="linked-entity" class="form-check-input" value="freetext" {% if form.vars.submitted and app.request.request.get('linked-entity', null) == 'thirdparty' %}checked{% endif %}/>
|
||||
<label class="form-check-label" for="chill_personbundle_person_resource_linkedEntity_2">Description libre</label>
|
||||
{% else %}
|
||||
<input type="radio" id="chill_personbundle_person_resource_linkedEntity_2" name="linked-entity" class="form-check-input" value="freetext" />
|
||||
@ -75,4 +74,4 @@
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
||||
{{ form_end(form) }}
|
||||
{{ form_end(form) }}
|
||||
|
@ -17,48 +17,39 @@
|
||||
{% block personcontent %}
|
||||
|
||||
<h1>{{ 'List of resources'|trans }}</h1>
|
||||
{% if personResources is not empty %}
|
||||
{% for resource in personResources %}
|
||||
<div class="flex-table">
|
||||
|
||||
{% if personResources|length > 0 %}
|
||||
<div class="flex-table">
|
||||
{% for resource in personResources %}
|
||||
<div class="item-bloc">
|
||||
<div class="item-row">
|
||||
<div class="wrap-header">
|
||||
<div class="wh-row">
|
||||
<div class="wh-col">
|
||||
{% if resource.person is not null %}
|
||||
<div class="item-col">
|
||||
<div class="denomination h3">
|
||||
<span class="name">{{ resource.person }}</span>
|
||||
<span class="badge rounded-pill bg-person">{{ 'person'|trans|capitalize }}</span>
|
||||
</div>
|
||||
</div>
|
||||
{% elseif resource.thirdparty is not null %}
|
||||
<div class="item-col">
|
||||
<div class="denomination h3">
|
||||
<span class="name">{{ resource.thirdparty }}</span>
|
||||
<span class="badge rounded-pill bg-thirdparty">
|
||||
{{ 'thirdparty'|trans|capitalize }}
|
||||
<i class="fa fa-fw fa-user-md"></i>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="item-col">
|
||||
<div class="denomination h3">
|
||||
<span>{{ resource.freetext }}</span>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="wh-col">
|
||||
{% if resource.kind %}
|
||||
<span>{{ resource.kind.title.fr|capitalize }}</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="item-col">
|
||||
{% if resource.person is not null %}
|
||||
<div class="denomination h3">
|
||||
<span class="name">{{ resource.person }}</span>
|
||||
<span class="badge rounded-pill bg-person">{{ 'person'|trans|capitalize }}</span>
|
||||
</div>
|
||||
{% elseif resource.thirdparty is not null %}
|
||||
<div class="denomination h3">
|
||||
<span class="name">{{ resource.thirdparty }}</span>
|
||||
<span class="badge rounded-pill bg-thirdparty">
|
||||
{{ 'thirdparty'|trans|capitalize }}
|
||||
<i class="fa fa-fw fa-user-md"></i>
|
||||
</span>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="denomination h3">
|
||||
<span>{{ resource.freetext }}</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="item-col">
|
||||
{% if resource.kind %}
|
||||
<span>{{ resource.kind.title.fr|capitalize }}</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% if resource.comment.comment is not null %}
|
||||
{% if resource.comment.comment is not empty %}
|
||||
<div class="item-row separator">
|
||||
<section class="chill-entity entity-comment-embeddable">
|
||||
<blockquote class="chill-user-quote">
|
||||
@ -67,27 +58,29 @@
|
||||
</section>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="item-row separator">
|
||||
<div class="item-col">
|
||||
<ul class="record_actions">
|
||||
<li>
|
||||
<a href="{{ chill_path_add_return_path('chill_person_resource_edit', {'resource_id': resource.id,
|
||||
'person_id': person.id,}) }}"
|
||||
class="btn btn-sm btn-edit"
|
||||
title="{{ 'Edit'|trans }}"></a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ chill_path_add_return_path('chill_person_resource_delete', {'person_id': person.id,
|
||||
'resource_id': resource.id}) }}"
|
||||
class="btn btn-sm btn-delete"
|
||||
title="{{ 'Delete'|trans }}"></a>
|
||||
</li>
|
||||
</ul>
|
||||
{% if is_granted('CHILL_PERSON_UPDATE', resource.person) %}
|
||||
<div class="item-row separator">
|
||||
<div class="item-col">
|
||||
<ul class="record_actions">
|
||||
<li>
|
||||
<a href="{{ chill_path_add_return_path('chill_person_resource_edit', {'resource_id': resource.id,
|
||||
'person_id': person.id,}) }}"
|
||||
class="btn btn-sm btn-edit"
|
||||
title="{{ 'Edit'|trans }}"></a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ chill_path_add_return_path('chill_person_resource_delete', {'person_id': person.id,
|
||||
'resource_id': resource.id}) }}"
|
||||
class="btn btn-sm btn-delete"
|
||||
title="{{ 'Delete'|trans }}"></a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
{% else %}
|
||||
<p class="chill-no-data-statement">{{ 'There are no available resources'|trans }}</p>
|
||||
|
@ -114,6 +114,7 @@ class AccompanyingPeriodDocGenNormalizer implements ContextAwareNormalizerInterf
|
||||
$userContext = array_merge($context, ['docgen:expects' => User::class, 'groups' => 'docgen:read']);
|
||||
$participationContext = array_merge($context, ['docgen:expects' => AccompanyingPeriodParticipation::class, 'groups' => 'docgen:read']);
|
||||
$administrativeLocationContext = array_merge($context, ['docgen:expects' => Location::class, 'groups' => 'docgen:read']);
|
||||
$workContext = array_merge($context, ['docgen:expects' => AccompanyingPeriod\AccompanyingPeriodWork::class, 'groups' => 'docgen:read']);
|
||||
|
||||
return [
|
||||
'id' => $period->getId(),
|
||||
@ -160,6 +161,7 @@ class AccompanyingPeriodDocGenNormalizer implements ContextAwareNormalizerInterf
|
||||
'locationPerson' => $this->normalizer->normalize($period->getPersonLocation(), $format, array_merge($context, ['docgen:expects' => Person::class])),
|
||||
'location' => $this->normalizer->normalize($period->getLocation(), $format, $addressContext),
|
||||
'administrativeLocation' => $this->normalizer->normalize($period->getAdministrativeLocation(), $format, $administrativeLocationContext),
|
||||
'works' => $this->normalizer->normalize($period->getWorks(), $format, $workContext),
|
||||
];
|
||||
}
|
||||
|
||||
@ -178,6 +180,7 @@ class AccompanyingPeriodDocGenNormalizer implements ContextAwareNormalizerInterf
|
||||
'hasLocation' => false,
|
||||
'hasLocationPerson' => false,
|
||||
'hasAdministrativeLocation' => false,
|
||||
'works' => [],
|
||||
]
|
||||
);
|
||||
}
|
||||
|
@ -76,8 +76,8 @@ class PersonDocGenNormalizer implements
|
||||
'type' => 'person',
|
||||
'isNull' => false,
|
||||
'civility' => $this->normalizer->normalize($person->getCivility(), $format, array_merge($context, ['docgen:expects' => Civility::class])),
|
||||
'firstname' => $person->getFirstName(),
|
||||
'lastname' => $person->getLastName(),
|
||||
'firstName' => $person->getFirstName(),
|
||||
'lastName' => $person->getLastName(),
|
||||
'altNames' => implode(
|
||||
', ',
|
||||
array_map(
|
||||
@ -151,7 +151,7 @@ class PersonDocGenNormalizer implements
|
||||
$normalizer = new NormalizeNullValueHelper($this->normalizer, 'type', 'person');
|
||||
|
||||
$attributes = [
|
||||
'firstname', 'lastname', 'age', 'altNames', 'text',
|
||||
'firstName', 'lastName', 'age', 'altNames', 'text',
|
||||
'civility' => Civility::class,
|
||||
'birthdate' => DateTimeInterface::class,
|
||||
'deathdate' => DateTimeInterface::class,
|
||||
|
@ -49,8 +49,11 @@ class SocialActionNormalizer implements NormalizerAwareInterface, NormalizerInte
|
||||
|
||||
return [
|
||||
'id' => $socialAction->getId(),
|
||||
'type' => 'social_work_social_action',
|
||||
'text' => $this->render->renderString($socialAction, []),
|
||||
'title' => $socialAction->getTitle(),
|
||||
'parent' => $this->normalizer->normalize($socialAction->getParent(), $format, $context),
|
||||
'issue' => $this->normalizer->normalize($socialAction->getIssue(), $format, $context),
|
||||
];
|
||||
|
||||
default:
|
||||
|
@ -98,7 +98,7 @@ class AccompanyingPeriodWorkEvaluationContext implements
|
||||
return $this->translatableStringHelper->localize($e->getTitle());
|
||||
},
|
||||
'multiple' => true,
|
||||
'expanded' => true,
|
||||
'attr' => ['class' => 'select2'],
|
||||
]);
|
||||
}
|
||||
|
||||
|
@ -100,6 +100,7 @@ final class AccompanyingPeriodDocGenNormalizerTest extends KernelTestCase
|
||||
'hasLocationPerson' => false,
|
||||
'location' => '@ignored',
|
||||
'locationPerson' => '@ignored',
|
||||
'works' => [],
|
||||
];
|
||||
|
||||
$this->assertIsArray($data);
|
||||
@ -160,6 +161,7 @@ final class AccompanyingPeriodDocGenNormalizerTest extends KernelTestCase
|
||||
'hasLocationPerson' => false,
|
||||
'location' => '@ignored',
|
||||
'locationPerson' => '@ignored',
|
||||
'works' => [],
|
||||
];
|
||||
|
||||
$this->assertIsArray($data);
|
||||
|
@ -38,8 +38,8 @@ final class PersonDocGenNormalizerTest extends KernelTestCase
|
||||
use ProphecyTrait;
|
||||
|
||||
private const BLANK = [
|
||||
'firstname' => '',
|
||||
'lastname' => '',
|
||||
'firstName' => '',
|
||||
'lastName' => '',
|
||||
'altNames' => '',
|
||||
'text' => '',
|
||||
'isNull' => true,
|
||||
@ -80,7 +80,7 @@ final class PersonDocGenNormalizerTest extends KernelTestCase
|
||||
|
||||
$expected = array_merge(
|
||||
self::BLANK,
|
||||
['firstname' => 'Renaud', 'lastname' => 'Mégane',
|
||||
['firstName' => 'Renaud', 'lastName' => 'Mégane',
|
||||
'text' => 'Renaud Mégane', ]
|
||||
);
|
||||
|
||||
|
@ -530,3 +530,6 @@ household_composition:
|
||||
Currently no composition: Aucune composition famiale renseignée.
|
||||
Add a composition: Ajouter une composition familiale
|
||||
Update composition: Modifier la composition familiale
|
||||
|
||||
# docgen
|
||||
Linked evaluations: Évaluations associées
|
||||
|
@ -50,3 +50,6 @@ household_membership:
|
||||
A course must contains at least one social issue: 'Un parcours doit être associé à au moins une problématique sociale'
|
||||
A course must be associated to at least one scope: 'Un parcours doit être associé à au moins un service'
|
||||
The social %name% issue cannot be deleted because it is associated with an activity or an action: 'La problématique sociale "%name%" ne peut pas être supprimée car elle est associée à une activité ou une action'
|
||||
|
||||
# resource
|
||||
You must associate at least one entity: Associez un usager, un tiers ou indiquez une description libre
|
||||
|
Loading…
x
Reference in New Issue
Block a user