mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Merge branch 'issue318_internal_addIssue_fromAction' into 'master'
Adding an unrelated to issue to an accompanyingCourseWork See merge request Chill-Projet/chill-bundles!246
This commit is contained in:
commit
1823a1b031
@ -13,8 +13,8 @@ and this project adheres to
|
|||||||
<!-- write down unreleased development here -->
|
<!-- write down unreleased development here -->
|
||||||
* [person] add validator for accompanying period with a test on social issues (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/76)
|
* [person] add validator for accompanying period with a test on social issues (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/76)
|
||||||
* [activity] fix visibility for location
|
* [activity] fix visibility for location
|
||||||
|
* [action] add an unrelated issue within action creation.
|
||||||
* [origin] fix origin: use correctly the translatable strings
|
* [origin] fix origin: use correctly the translatable strings
|
||||||
|
|
||||||
* /!\ everyone must update the origin table. As there is only one row, execute `update chill_person_accompanying_period_origin set label = jsonb_build_object('fr', 'appel téléphonique');`
|
* /!\ everyone must update the origin table. As there is only one row, execute `update chill_person_accompanying_period_origin set label = jsonb_build_object('fr', 'appel téléphonique');`
|
||||||
|
|
||||||
## Test releases
|
## Test releases
|
||||||
|
@ -6,17 +6,17 @@ const debug = process.env.NODE_ENV !== 'production';
|
|||||||
//console.log('window.activity', window.activity);
|
//console.log('window.activity', window.activity);
|
||||||
|
|
||||||
const addIdToValue = (string, id) => {
|
const addIdToValue = (string, id) => {
|
||||||
let array = string ? string.split(',') : [];
|
let array = string ? string.split(',') : [];
|
||||||
array.push(id.toString());
|
array.push(id.toString());
|
||||||
let str = array.join();
|
let str = array.join();
|
||||||
return str;
|
return str;
|
||||||
};
|
};
|
||||||
|
|
||||||
const removeIdFromValue = (string, id) => {
|
const removeIdFromValue = (string, id) => {
|
||||||
let array = string.split(',');
|
let array = string.split(',');
|
||||||
array = array.filter(el => el !== id.toString());
|
array = array.filter(el => el !== id.toString());
|
||||||
let str = array.join();
|
let str = array.join();
|
||||||
return str;
|
return str;
|
||||||
};
|
};
|
||||||
|
|
||||||
const store = createStore({
|
const store = createStore({
|
||||||
@ -50,9 +50,9 @@ const store = createStore({
|
|||||||
return state.activity.activityType.personsVisible === 0
|
return state.activity.activityType.personsVisible === 0
|
||||||
? []
|
? []
|
||||||
: state.activity.accompanyingPeriod.participations
|
: state.activity.accompanyingPeriod.participations
|
||||||
.filter((p) => p.endDate === null)
|
.filter((p) => p.endDate === null)
|
||||||
.map((p) => p.person)
|
.map((p) => p.person)
|
||||||
.filter((p) => !existingPersonIds.includes(p.id));
|
.filter((p) => !existingPersonIds.includes(p.id));
|
||||||
},
|
},
|
||||||
suggestedRequestor(state) {
|
suggestedRequestor(state) {
|
||||||
if (state.activity.accompanyingPeriod.requestor === null) {
|
if (state.activity.accompanyingPeriod.requestor === null) {
|
||||||
@ -78,8 +78,8 @@ const store = createStore({
|
|||||||
return state.activity.activityType.usersVisible === 0
|
return state.activity.activityType.usersVisible === 0
|
||||||
? []
|
? []
|
||||||
: [state.activity.accompanyingPeriod.user].filter(
|
: [state.activity.accompanyingPeriod.user].filter(
|
||||||
(u) => u !== null && !existingUserIds.includes(u.id)
|
(u) => u !== null && !existingUserIds.includes(u.id)
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
suggestedResources(state) {
|
suggestedResources(state) {
|
||||||
const resources = state.activity.accompanyingPeriod.resources;
|
const resources = state.activity.accompanyingPeriod.resources;
|
||||||
|
@ -34,6 +34,8 @@ use Symfony\Component\HttpFoundation\Response;
|
|||||||
use Symfony\Component\Routing\Annotation\Route;
|
use Symfony\Component\Routing\Annotation\Route;
|
||||||
use Symfony\Component\Serializer\Exception\RuntimeException;
|
use Symfony\Component\Serializer\Exception\RuntimeException;
|
||||||
use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
|
use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
|
||||||
|
use Symfony\Component\Validator\ConstraintViolationList;
|
||||||
|
use Symfony\Component\Validator\ConstraintViolationListInterface;
|
||||||
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
||||||
use Symfony\Component\Workflow\Registry;
|
use Symfony\Component\Workflow\Registry;
|
||||||
use function array_values;
|
use function array_values;
|
||||||
@ -294,4 +296,17 @@ final class AccompanyingCourseApiController extends ApiController
|
|||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function validate(string $action, Request $request, string $_format, $entity, array $more = []): ConstraintViolationListInterface
|
||||||
|
{
|
||||||
|
if ('work' !== $action) {
|
||||||
|
return parent::validate($action, $request, $_format, $entity, $more);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Request::METHOD_POST === $request->getMethod()) {
|
||||||
|
return $this->getValidator()->validate($more[0], null);
|
||||||
|
}
|
||||||
|
|
||||||
|
return new ConstraintViolationList([]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -79,6 +79,7 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
|
|||||||
$loader->load('services/serializer.yaml');
|
$loader->load('services/serializer.yaml');
|
||||||
$loader->load('services/security.yaml');
|
$loader->load('services/security.yaml');
|
||||||
$loader->load('services/doctrineEventListener.yaml');
|
$loader->load('services/doctrineEventListener.yaml');
|
||||||
|
$loader->load('services/accompanyingPeriodConsistency.yaml');
|
||||||
|
|
||||||
if ($container->getParameter('chill_person.accompanying_period') !== 'hidden') {
|
if ($container->getParameter('chill_person.accompanying_period') !== 'hidden') {
|
||||||
$loader->load('services/exports_accompanying_period.yaml');
|
$loader->load('services/exports_accompanying_period.yaml');
|
||||||
|
@ -14,10 +14,12 @@ namespace Chill\PersonBundle\Entity\AccompanyingPeriod;
|
|||||||
use Chill\MainBundle\Doctrine\Model\TrackCreationInterface;
|
use Chill\MainBundle\Doctrine\Model\TrackCreationInterface;
|
||||||
use Chill\MainBundle\Doctrine\Model\TrackUpdateInterface;
|
use Chill\MainBundle\Doctrine\Model\TrackUpdateInterface;
|
||||||
use Chill\MainBundle\Entity\User;
|
use Chill\MainBundle\Entity\User;
|
||||||
|
use Chill\PersonBundle\AccompanyingPeriod\SocialIssueConsistency\AccompanyingPeriodLinkedWithSocialIssuesEntityInterface;
|
||||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||||
use Chill\PersonBundle\Entity\Person;
|
use Chill\PersonBundle\Entity\Person;
|
||||||
use Chill\PersonBundle\Entity\SocialWork\Result;
|
use Chill\PersonBundle\Entity\SocialWork\Result;
|
||||||
use Chill\PersonBundle\Entity\SocialWork\SocialAction;
|
use Chill\PersonBundle\Entity\SocialWork\SocialAction;
|
||||||
|
use Chill\PersonBundle\Entity\SocialWork\SocialIssue;
|
||||||
use Chill\ThirdPartyBundle\Entity\ThirdParty;
|
use Chill\ThirdPartyBundle\Entity\ThirdParty;
|
||||||
use DateTimeImmutable;
|
use DateTimeImmutable;
|
||||||
use DateTimeInterface;
|
use DateTimeInterface;
|
||||||
@ -28,458 +30,470 @@ use LogicException;
|
|||||||
use Symfony\Component\Serializer\Annotation as Serializer;
|
use Symfony\Component\Serializer\Annotation as Serializer;
|
||||||
use Symfony\Component\Validator\Constraints as Assert;
|
use Symfony\Component\Validator\Constraints as Assert;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Entity
|
* @ORM\Entity
|
||||||
* @ORM\Table(name="chill_person_accompanying_period_work")
|
* @ORM\Table(name="chill_person_accompanying_period_work")
|
||||||
* @Serializer\DiscriminatorMap(
|
* @Serializer\DiscriminatorMap(
|
||||||
* typeProperty="type",
|
* typeProperty="type",
|
||||||
* mapping={
|
* mapping={
|
||||||
* "accompanying_period_work": AccompanyingPeriodWork::class
|
* "accompanying_period_work": AccompanyingPeriodWork::class
|
||||||
* }
|
* }
|
||||||
* )
|
* )
|
||||||
*/
|
*/
|
||||||
class AccompanyingPeriodWork implements TrackCreationInterface, TrackUpdateInterface
|
class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterface, TrackCreationInterface, TrackUpdateInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @ORM\ManyToOne(targetEntity=AccompanyingPeriod::class)
|
* @ORM\ManyToOne(targetEntity=AccompanyingPeriod::class)
|
||||||
* @Serializer\Groups({"read"})
|
* @Serializer\Groups({"read"})
|
||||||
*/
|
*/
|
||||||
private ?AccompanyingPeriod $accompanyingPeriod = null;
|
private ?AccompanyingPeriod $accompanyingPeriod = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\OneToMany(
|
* @ORM\OneToMany(
|
||||||
* targetEntity=AccompanyingPeriodWorkEvaluation::class,
|
* targetEntity=AccompanyingPeriodWorkEvaluation::class,
|
||||||
* mappedBy="accompanyingPeriodWork",
|
* mappedBy="accompanyingPeriodWork",
|
||||||
* cascade={"remove", "persist"},
|
* cascade={"remove", "persist"},
|
||||||
* orphanRemoval=true
|
* orphanRemoval=true
|
||||||
* )
|
* )
|
||||||
* @Serializer\Groups({"read", "docgen:read"})
|
* @Serializer\Groups({"read", "docgen:read"})
|
||||||
*
|
*
|
||||||
* @internal /!\ the serialization for write evaluations is handled in `AccompanyingPeriodWorkDenormalizer`
|
* @internal /!\ the serialization for write evaluations is handled in `AccompanyingPeriodWorkDenormalizer`
|
||||||
*/
|
*/
|
||||||
private Collection $accompanyingPeriodWorkEvaluations;
|
private Collection $accompanyingPeriodWorkEvaluations;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Column(type="datetime_immutable")
|
* @ORM\Column(type="datetime_immutable")
|
||||||
* @Serializer\Groups({"read", "docgen:read"})
|
* @Serializer\Groups({"read", "docgen:read"})
|
||||||
*/
|
*/
|
||||||
private ?DateTimeImmutable $createdAt = null;
|
private ?DateTimeImmutable $createdAt = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Column(type="boolean")
|
* @ORM\Column(type="boolean")
|
||||||
* @Serializer\Groups({"read", "docgen:read"})
|
* @Serializer\Groups({"read", "docgen:read"})
|
||||||
*/
|
*/
|
||||||
private bool $createdAutomatically = false;
|
private bool $createdAutomatically = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Column(type="text")
|
* @ORM\Column(type="text")
|
||||||
* @Serializer\Groups({"read", "docgen:read"})
|
* @Serializer\Groups({"read", "docgen:read"})
|
||||||
*/
|
*/
|
||||||
private string $createdAutomaticallyReason = '';
|
private string $createdAutomaticallyReason = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\ManyToOne(targetEntity=User::class)
|
* @ORM\ManyToOne(targetEntity=User::class)
|
||||||
* @ORM\JoinColumn(nullable=false)
|
* @ORM\JoinColumn(nullable=false)
|
||||||
* @Serializer\Groups({"read", "docgen:read"})
|
* @Serializer\Groups({"read", "docgen:read"})
|
||||||
*/
|
*/
|
||||||
private ?User $createdBy = null;
|
private ?User $createdBy = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Column(type="date_immutable", nullable=true, options={"default": null})
|
* @ORM\Column(type="date_immutable", nullable=true, options={"default": null})
|
||||||
* @Serializer\Groups({"accompanying_period_work:create"})
|
* @Serializer\Groups({"accompanying_period_work:create"})
|
||||||
* @Serializer\Groups({"accompanying_period_work:edit"})
|
* @Serializer\Groups({"accompanying_period_work:edit"})
|
||||||
* @Serializer\Groups({"read", "docgen:read"})
|
* @Serializer\Groups({"read", "docgen:read"})
|
||||||
* @Assert\GreaterThan(propertyPath="startDate",
|
* @Assert\GreaterThan(propertyPath="startDate",
|
||||||
* message="accompanying_course_work.The endDate should be greater than the start date"
|
* message="accompanying_course_work.The endDate should be greater than the start date"
|
||||||
* )
|
* )
|
||||||
*/
|
*/
|
||||||
private ?DateTimeImmutable $endDate = null;
|
private ?DateTimeImmutable $endDate = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\OneToMany(
|
* @ORM\OneToMany(
|
||||||
* targetEntity=AccompanyingPeriodWorkGoal::class,
|
* targetEntity=AccompanyingPeriodWorkGoal::class,
|
||||||
* mappedBy="accompanyingPeriodWork",
|
* mappedBy="accompanyingPeriodWork",
|
||||||
* cascade={"persist"},
|
* cascade={"persist"},
|
||||||
* orphanRemoval=true
|
* orphanRemoval=true
|
||||||
* )
|
* )
|
||||||
* @Serializer\Groups({"read", "docgen:read"})
|
* @Serializer\Groups({"read", "docgen:read"})
|
||||||
* @Serializer\Groups({"accompanying_period_work:edit"})
|
* @Serializer\Groups({"accompanying_period_work:edit"})
|
||||||
*/
|
*/
|
||||||
private Collection $goals;
|
private Collection $goals;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\ManyToOne(targetEntity=ThirdParty::class)
|
* @ORM\ManyToOne(targetEntity=ThirdParty::class)
|
||||||
* @Serializer\Groups({"read", "docgen:read"})
|
* @Serializer\Groups({"read", "docgen:read"})
|
||||||
* @Serializer\Groups({"accompanying_period_work:edit"})
|
* @Serializer\Groups({"accompanying_period_work:edit"})
|
||||||
*
|
*
|
||||||
* In schema : traitant
|
* In schema : traitant
|
||||||
*/
|
*/
|
||||||
private ?ThirdParty $handlingThierParty = null;
|
private ?ThirdParty $handlingThierParty = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Id
|
* @ORM\Id
|
||||||
* @ORM\GeneratedValue
|
* @ORM\GeneratedValue
|
||||||
* @ORM\Column(type="integer")
|
* @ORM\Column(type="integer")
|
||||||
* @Serializer\Groups({"read", "docgen:read"})
|
* @Serializer\Groups({"read", "docgen:read"})
|
||||||
*/
|
*/
|
||||||
private ?int $id = null;
|
private ?int $id = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Column(type="text")
|
* @ORM\Column(type="text")
|
||||||
* @Serializer\Groups({"read", "accompanying_period_work:edit", "docgen:read"})
|
* @Serializer\Groups({"read", "accompanying_period_work:edit", "docgen:read"})
|
||||||
*/
|
*/
|
||||||
private string $note = '';
|
private string $note = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\ManyToMany(targetEntity=Person::class)
|
* @ORM\ManyToMany(targetEntity=Person::class)
|
||||||
* @ORM\JoinTable(name="chill_person_accompanying_period_work_person")
|
* @ORM\JoinTable(name="chill_person_accompanying_period_work_person")
|
||||||
* @Serializer\Groups({"read", "docgen:read"})
|
* @Serializer\Groups({"read", "docgen:read"})
|
||||||
* @Serializer\Groups({"accompanying_period_work:edit"})
|
* @Serializer\Groups({"accompanying_period_work:edit"})
|
||||||
* @Serializer\Groups({"accompanying_period_work:create"})
|
* @Serializer\Groups({"accompanying_period_work:create"})
|
||||||
*/
|
*/
|
||||||
private Collection $persons;
|
private Collection $persons;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\ManyToMany(targetEntity=Result::class, inversedBy="accompanyingPeriodWorks")
|
* @ORM\ManyToMany(targetEntity=Result::class, inversedBy="accompanyingPeriodWorks")
|
||||||
* @ORM\JoinTable(name="chill_person_accompanying_period_work_result")
|
* @ORM\JoinTable(name="chill_person_accompanying_period_work_result")
|
||||||
* @Serializer\Groups({"read", "docgen:read"})
|
* @Serializer\Groups({"read", "docgen:read"})
|
||||||
* @Serializer\Groups({"accompanying_period_work:edit"})
|
* @Serializer\Groups({"accompanying_period_work:edit"})
|
||||||
*/
|
*/
|
||||||
private Collection $results;
|
private Collection $results;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\ManyToOne(targetEntity=SocialAction::class)
|
* @ORM\ManyToOne(targetEntity=SocialAction::class)
|
||||||
* @Serializer\Groups({"read", "docgen:read"})
|
* @Serializer\Groups({"read", "docgen:read"})
|
||||||
* @Serializer\Groups({"accompanying_period_work:create"})
|
* @Serializer\Groups({"accompanying_period_work:create"})
|
||||||
*/
|
*/
|
||||||
private ?SocialAction $socialAction = null;
|
private ?SocialAction $socialAction = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Column(type="date_immutable")
|
* @ORM\Column(type="date_immutable")
|
||||||
* @Serializer\Groups({"accompanying_period_work:create"})
|
* @Serializer\Groups({"accompanying_period_work:create"})
|
||||||
* @Serializer\Groups({"accompanying_period_work:edit"})
|
* @Serializer\Groups({"accompanying_period_work:edit"})
|
||||||
* @Serializer\Groups({"read", "docgen:read"})
|
* @Serializer\Groups({"read", "docgen:read"})
|
||||||
*/
|
*/
|
||||||
private ?DateTimeImmutable $startDate = null;
|
private ?DateTimeImmutable $startDate = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\ManyToMany(targetEntity=ThirdParty::class)
|
* @ORM\ManyToMany(targetEntity=ThirdParty::class)
|
||||||
* @ORM\JoinTable(name="chill_person_accompanying_period_work_third_party")
|
* @ORM\JoinTable(name="chill_person_accompanying_period_work_third_party")
|
||||||
*
|
*
|
||||||
* In schema : intervenants
|
* In schema : intervenants
|
||||||
* @Serializer\Groups({"read", "docgen:read"})
|
* @Serializer\Groups({"read", "docgen:read"})
|
||||||
* @Serializer\Groups({"accompanying_period_work:edit"})
|
* @Serializer\Groups({"accompanying_period_work:edit"})
|
||||||
*/
|
*/
|
||||||
private Collection $thirdParties;
|
private Collection $thirdParties;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Column(type="datetime_immutable")
|
* @ORM\Column(type="datetime_immutable")
|
||||||
* @Serializer\Groups({"read", "docgen:read"})
|
* @Serializer\Groups({"read", "docgen:read"})
|
||||||
*/
|
*/
|
||||||
private ?DateTimeImmutable $updatedAt = null;
|
private ?DateTimeImmutable $updatedAt = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\ManyToOne(targetEntity=User::class)
|
* @ORM\ManyToOne(targetEntity=User::class)
|
||||||
* @ORM\JoinColumn(nullable=false)
|
* @ORM\JoinColumn(nullable=false)
|
||||||
* @Serializer\Groups({"read", "docgen:read"})
|
* @Serializer\Groups({"read", "docgen:read"})
|
||||||
*/
|
*/
|
||||||
private ?User $updatedBy = null;
|
private ?User $updatedBy = null;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->goals = new ArrayCollection();
|
$this->goals = new ArrayCollection();
|
||||||
$this->results = new ArrayCollection();
|
$this->results = new ArrayCollection();
|
||||||
$this->thirdParties = new ArrayCollection();
|
$this->thirdParties = new ArrayCollection();
|
||||||
$this->persons = new ArrayCollection();
|
$this->persons = new ArrayCollection();
|
||||||
$this->accompanyingPeriodWorkEvaluations = new ArrayCollection();
|
$this->accompanyingPeriodWorkEvaluations = new ArrayCollection();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addAccompanyingPeriodWorkEvaluation(AccompanyingPeriodWorkEvaluation $evaluation): self
|
public function addAccompanyingPeriodWorkEvaluation(AccompanyingPeriodWorkEvaluation $evaluation): self
|
||||||
{
|
{
|
||||||
if (!$this->accompanyingPeriodWorkEvaluations->contains($evaluation)) {
|
if (!$this->accompanyingPeriodWorkEvaluations->contains($evaluation)) {
|
||||||
$this->accompanyingPeriodWorkEvaluations[] = $evaluation;
|
$this->accompanyingPeriodWorkEvaluations[] = $evaluation;
|
||||||
$evaluation->setAccompanyingPeriodWork($this);
|
$evaluation->setAccompanyingPeriodWork($this);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addGoal(AccompanyingPeriodWorkGoal $goal): self
|
public function addGoal(AccompanyingPeriodWorkGoal $goal): self
|
||||||
{
|
{
|
||||||
if (!$this->goals->contains($goal)) {
|
if (!$this->goals->contains($goal)) {
|
||||||
$this->goals[] = $goal;
|
$this->goals[] = $goal;
|
||||||
$goal->setAccompanyingPeriodWork($this);
|
$goal->setAccompanyingPeriodWork($this);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addPerson(Person $person): self
|
public function addPerson(Person $person): self
|
||||||
{
|
{
|
||||||
if (!$this->persons->contains($person)) {
|
if (!$this->persons->contains($person)) {
|
||||||
$this->persons[] = $person;
|
$this->persons[] = $person;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addResult(Result $result): self
|
public function addResult(Result $result): self
|
||||||
{
|
{
|
||||||
if (!$this->results->contains($result)) {
|
if (!$this->results->contains($result)) {
|
||||||
$this->results[] = $result;
|
$this->results[] = $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addThirdParty(ThirdParty $thirdParty): self
|
public function addThirdParty(ThirdParty $thirdParty): self
|
||||||
{
|
{
|
||||||
if (!$this->thirdParties->contains($thirdParty)) {
|
if (!$this->thirdParties->contains($thirdParty)) {
|
||||||
$this->thirdParties[] = $thirdParty;
|
$this->thirdParties[] = $thirdParty;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getAccompanyingPeriod(): ?AccompanyingPeriod
|
public function getAccompanyingPeriod(): ?AccompanyingPeriod
|
||||||
{
|
{
|
||||||
return $this->accompanyingPeriod;
|
return $this->accompanyingPeriod;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Collection
|
* @return Collection
|
||||||
*/
|
*/
|
||||||
public function getAccompanyingPeriodWorkEvaluations()
|
public function getAccompanyingPeriodWorkEvaluations()
|
||||||
{
|
{
|
||||||
return $this->accompanyingPeriodWorkEvaluations;
|
return $this->accompanyingPeriodWorkEvaluations;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getCreatedAt(): ?DateTimeImmutable
|
public function getCreatedAt(): ?DateTimeImmutable
|
||||||
{
|
{
|
||||||
return $this->createdAt;
|
return $this->createdAt;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getCreatedAutomatically(): ?bool
|
public function getCreatedAutomatically(): ?bool
|
||||||
{
|
{
|
||||||
return $this->createdAutomatically;
|
return $this->createdAutomatically;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getCreatedAutomaticallyReason(): ?string
|
public function getCreatedAutomaticallyReason(): ?string
|
||||||
{
|
{
|
||||||
return $this->createdAutomaticallyReason;
|
return $this->createdAutomaticallyReason;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getCreatedBy(): ?User
|
public function getCreatedBy(): ?User
|
||||||
{
|
{
|
||||||
return $this->createdBy;
|
return $this->createdBy;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getEndDate(): ?DateTimeInterface
|
public function getEndDate(): ?DateTimeInterface
|
||||||
{
|
{
|
||||||
return $this->endDate;
|
return $this->endDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return AccompanyingPeriodWorkGoal[]|Collection
|
* @return AccompanyingPeriodWorkGoal[]|Collection
|
||||||
*/
|
*/
|
||||||
public function getGoals(): Collection
|
public function getGoals(): Collection
|
||||||
{
|
{
|
||||||
return $this->goals;
|
return $this->goals;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHandlingThierParty(): ?ThirdParty
|
public function getHandlingThierParty(): ?ThirdParty
|
||||||
{
|
{
|
||||||
return $this->handlingThierParty;
|
return $this->handlingThierParty;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getId(): ?int
|
public function getId(): ?int
|
||||||
{
|
{
|
||||||
return $this->id;
|
return $this->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getNote(): ?string
|
public function getNote(): ?string
|
||||||
{
|
{
|
||||||
return $this->note;
|
return $this->note;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPersons(): Collection
|
public function getPersons(): Collection
|
||||||
{
|
{
|
||||||
return $this->persons;
|
return $this->persons;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Collection|Result[]
|
* @return Collection|Result[]
|
||||||
*/
|
*/
|
||||||
public function getResults(): Collection
|
public function getResults(): Collection
|
||||||
{
|
{
|
||||||
return $this->results;
|
return $this->results;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getSocialAction(): ?SocialAction
|
public function getSocialAction(): ?SocialAction
|
||||||
{
|
{
|
||||||
return $this->socialAction;
|
return $this->socialAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getStartDate(): ?DateTimeInterface
|
public function getSocialIssues(): Collection
|
||||||
{
|
{
|
||||||
return $this->startDate;
|
return new ArrayCollection([$this->getSocialAction()->getIssue()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function getStartDate(): ?DateTimeInterface
|
||||||
* @return Collection|ThirdParty[]
|
{
|
||||||
*/
|
return $this->startDate;
|
||||||
public function getThirdParties(): Collection
|
}
|
||||||
{
|
|
||||||
return $this->thirdParties;
|
/**
|
||||||
}
|
* @return Collection|ThirdParty[]
|
||||||
|
*/
|
||||||
public function getThirdPartys(): Collection
|
public function getThirdParties(): Collection
|
||||||
{
|
{
|
||||||
return $this->getThirdParties();
|
return $this->thirdParties;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getUpdatedAt(): ?DateTimeImmutable
|
public function getThirdPartys(): Collection
|
||||||
{
|
{
|
||||||
return $this->updatedAt;
|
return $this->getThirdParties();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getUpdatedBy(): ?User
|
public function getUpdatedAt(): ?DateTimeImmutable
|
||||||
{
|
{
|
||||||
return $this->updatedBy;
|
return $this->updatedAt;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function removeAccompanyingPeriodWorkEvaluation(AccompanyingPeriodWorkEvaluation $evaluation): self
|
public function getUpdatedBy(): ?User
|
||||||
{
|
{
|
||||||
$this->accompanyingPeriodWorkEvaluations
|
return $this->updatedBy;
|
||||||
->removeElement($evaluation);
|
}
|
||||||
$evaluation->setAccompanyingPeriodWork(null);
|
|
||||||
|
public function removeAccompanyingPeriodWorkEvaluation(AccompanyingPeriodWorkEvaluation $evaluation): self
|
||||||
return $this;
|
{
|
||||||
}
|
$this->accompanyingPeriodWorkEvaluations
|
||||||
|
->removeElement($evaluation);
|
||||||
public function removeGoal(AccompanyingPeriodWorkGoal $goal): self
|
$evaluation->setAccompanyingPeriodWork(null);
|
||||||
{
|
|
||||||
if ($this->goals->removeElement($goal)) {
|
return $this;
|
||||||
// set the owning side to null (unless already changed)
|
}
|
||||||
if ($goal->getAccompanyingPeriodWork() === $this) {
|
|
||||||
$goal->setAccompanyingPeriodWork(null);
|
public function removeGoal(AccompanyingPeriodWorkGoal $goal): self
|
||||||
}
|
{
|
||||||
}
|
if ($this->goals->removeElement($goal)) {
|
||||||
|
// set the owning side to null (unless already changed)
|
||||||
return $this;
|
if ($goal->getAccompanyingPeriodWork() === $this) {
|
||||||
}
|
$goal->setAccompanyingPeriodWork(null);
|
||||||
|
}
|
||||||
public function removePerson(Person $person): self
|
}
|
||||||
{
|
|
||||||
$this->persons->removeElement($person);
|
return $this;
|
||||||
|
}
|
||||||
return $this;
|
|
||||||
}
|
public function removePerson(Person $person): self
|
||||||
|
{
|
||||||
public function removeResult(Result $result): self
|
$this->persons->removeElement($person);
|
||||||
{
|
|
||||||
$this->results->removeElement($result);
|
return $this;
|
||||||
|
}
|
||||||
return $this;
|
|
||||||
}
|
public function removeResult(Result $result): self
|
||||||
|
{
|
||||||
public function removeThirdParty(ThirdParty $thirdParty): self
|
$this->results->removeElement($result);
|
||||||
{
|
|
||||||
$this->thirdParties->removeElement($thirdParty);
|
return $this;
|
||||||
|
}
|
||||||
return $this;
|
|
||||||
}
|
public function removeSocialIssue(SocialIssue $issue): AccompanyingPeriodLinkedWithSocialIssuesEntityInterface
|
||||||
|
{
|
||||||
/**
|
$this->getSocialIssues()->removeElement($issue);
|
||||||
* Internal: you should use `$accompanyingPeriod->removeWork($work);` or
|
|
||||||
* `$accompanyingPeriod->addWork($work);`.
|
return $this;
|
||||||
*/
|
}
|
||||||
public function setAccompanyingPeriod(?AccompanyingPeriod $accompanyingPeriod): self
|
|
||||||
{
|
public function removeThirdParty(ThirdParty $thirdParty): self
|
||||||
if ($this->accompanyingPeriod instanceof AccompanyingPeriod
|
{
|
||||||
&& $accompanyingPeriod !== $this->accompanyingPeriod) {
|
$this->thirdParties->removeElement($thirdParty);
|
||||||
throw new LogicException('A work cannot change accompanyingPeriod');
|
|
||||||
}
|
return $this;
|
||||||
|
}
|
||||||
$this->accompanyingPeriod = $accompanyingPeriod;
|
|
||||||
|
/**
|
||||||
return $this;
|
* Internal: you should use `$accompanyingPeriod->removeWork($work);` or
|
||||||
}
|
* `$accompanyingPeriod->addWork($work);`.
|
||||||
|
*/
|
||||||
public function setCreatedAt(DateTimeInterface $createdAt): self
|
public function setAccompanyingPeriod(?AccompanyingPeriod $accompanyingPeriod): self
|
||||||
{
|
{
|
||||||
$this->createdAt = $createdAt;
|
if ($this->accompanyingPeriod instanceof AccompanyingPeriod
|
||||||
|
&& $accompanyingPeriod !== $this->accompanyingPeriod) {
|
||||||
return $this;
|
throw new LogicException('A work cannot change accompanyingPeriod');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setCreatedAutomatically(bool $createdAutomatically): self
|
$this->accompanyingPeriod = $accompanyingPeriod;
|
||||||
{
|
|
||||||
$this->createdAutomatically = $createdAutomatically;
|
return $this;
|
||||||
|
}
|
||||||
return $this;
|
|
||||||
}
|
public function setCreatedAt(DateTimeInterface $createdAt): self
|
||||||
|
{
|
||||||
public function setCreatedAutomaticallyReason(string $createdAutomaticallyReason): self
|
$this->createdAt = $createdAt;
|
||||||
{
|
|
||||||
$this->createdAutomaticallyReason = $createdAutomaticallyReason;
|
return $this;
|
||||||
|
}
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setCreatedBy(?User $createdBy): self
|
|
||||||
{
|
|
||||||
$this->createdBy = $createdBy;
|
|
||||||
|
|
||||||
return $this;
|
public function setCreatedAutomatically(bool $createdAutomatically): self
|
||||||
}
|
{
|
||||||
|
$this->createdAutomatically = $createdAutomatically;
|
||||||
|
|
||||||
public function setEndDate(?DateTimeInterface $endDate = null): self
|
return $this;
|
||||||
{
|
}
|
||||||
$this->endDate = $endDate;
|
|
||||||
|
public function setCreatedAutomaticallyReason(string $createdAutomaticallyReason): self
|
||||||
|
{
|
||||||
|
$this->createdAutomaticallyReason = $createdAutomaticallyReason;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setHandlingThierParty(?ThirdParty $handlingThierParty): self
|
public function setCreatedBy(?User $createdBy): self
|
||||||
{
|
{
|
||||||
$this->handlingThierParty = $handlingThierParty;
|
$this->createdBy = $createdBy;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setNote(string $note): self
|
public function setEndDate(?DateTimeInterface $endDate = null): self
|
||||||
{
|
{
|
||||||
$this->note = $note;
|
$this->endDate = $endDate;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setSocialAction(?SocialAction $socialAction): self
|
public function setHandlingThierParty(?ThirdParty $handlingThierParty): self
|
||||||
{
|
{
|
||||||
$this->socialAction = $socialAction;
|
$this->handlingThierParty = $handlingThierParty;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setStartDate(DateTimeInterface $startDate): self
|
public function setNote(string $note): self
|
||||||
{
|
{
|
||||||
$this->startDate = $startDate;
|
$this->note = $note;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setUpdatedAt(DateTimeInterface $datetime): TrackUpdateInterface
|
public function setSocialAction(?SocialAction $socialAction): self
|
||||||
{
|
{
|
||||||
$this->updatedAt = $datetime;
|
$this->socialAction = $socialAction;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setUpdatedBy(User $user): TrackUpdateInterface
|
public function setStartDate(DateTimeInterface $startDate): self
|
||||||
{
|
{
|
||||||
$this->updatedBy = $user;
|
$this->startDate = $startDate;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
public function setUpdatedAt(DateTimeInterface $datetime): TrackUpdateInterface
|
||||||
|
{
|
||||||
|
$this->updatedAt = $datetime;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setUpdatedBy(User $user): TrackUpdateInterface
|
||||||
|
{
|
||||||
|
$this->updatedBy = $user;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -22,9 +22,9 @@ const getUsers = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const getReferrersSuggested = (course) => {
|
const getReferrersSuggested = (course) => {
|
||||||
const url = `/api/1.0/person/accompanying-course/${course.id}/referrers-suggested.json`;
|
const url = `/api/1.0/person/accompanying-course/${course.id}/referrers-suggested.json`;
|
||||||
|
|
||||||
return fetchResults(url);
|
return fetchResults(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -132,6 +132,10 @@ const appMessages = {
|
|||||||
sure_description: "Une fois le changement confirmé, il ne sera plus possible de le remettre à l'état de brouillon !",
|
sure_description: "Une fois le changement confirmé, il ne sera plus possible de le remettre à l'état de brouillon !",
|
||||||
ok: "Confirmer le parcours"
|
ok: "Confirmer le parcours"
|
||||||
},
|
},
|
||||||
|
action: {
|
||||||
|
choose_other_social_issue: "Veuillez choisir un autre problématique",
|
||||||
|
cancel: "Annuler",
|
||||||
|
},
|
||||||
// catch errors
|
// catch errors
|
||||||
'Error while updating AccompanyingPeriod Course.': "Erreur du serveur lors de la mise à jour du parcours d'accompagnement.",
|
'Error while updating AccompanyingPeriod Course.': "Erreur du serveur lors de la mise à jour du parcours d'accompagnement.",
|
||||||
'Error while retriving AccompanyingPeriod Course.': "Erreur du serveur lors du chargement du parcours d'accompagnement.",
|
'Error while retriving AccompanyingPeriod Course.': "Erreur du serveur lors du chargement du parcours d'accompagnement.",
|
||||||
|
@ -5,24 +5,47 @@
|
|||||||
|
|
||||||
<div id="awc_create_form">
|
<div id="awc_create_form">
|
||||||
|
|
||||||
<div id="picking">
|
<div id="picking">
|
||||||
<p>{{ $t('pick_social_issue_linked_with_action') }}</p>
|
<p>{{ $t('pick_social_issue_linked_with_action') }}</p>
|
||||||
|
<div v-for="si in socialIssues">
|
||||||
<div v-for="si in socialIssues">
|
<input type="radio" checked v-bind:value="si.id" name="socialIssue" v-model="socialIssuePicked"><span class="badge bg-chill-l-gray text-dark">{{ si.text }}</span>
|
||||||
<input type="radio" v-bind:value="si.id" name="socialIssue" v-model="socialIssuePicked"><span class="badge bg-chill-l-gray text-dark">{{ si.text }}</span>
|
</div>
|
||||||
|
<div class="my-3">
|
||||||
|
<div class="col-8">
|
||||||
|
<vue-multiselect
|
||||||
|
name="otherIssues"
|
||||||
|
label="text"
|
||||||
|
track-by="id"
|
||||||
|
open-direction="bottom"
|
||||||
|
:close-on-select="true"
|
||||||
|
:preserve-search="false"
|
||||||
|
:reset-after="true"
|
||||||
|
:hide-selected="true"
|
||||||
|
:taggable="false"
|
||||||
|
:multiple="false"
|
||||||
|
:searchable="true"
|
||||||
|
:allow-empty="true"
|
||||||
|
:show-labels="false"
|
||||||
|
:loading="issueIsLoading"
|
||||||
|
:placeholder="$t('action.choose_other_social_issue')"
|
||||||
|
:options="socialIssuesOther"
|
||||||
|
@select="addIssueInList">
|
||||||
|
</vue-multiselect>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="hasSocialIssuePicked">
|
<div v-if="hasSocialIssuePicked">
|
||||||
<h2>{{ $t('pick_an_action') }}</h2>
|
<h2>{{ $t('pick_an_action') }}</h2>
|
||||||
<vue-multiselect
|
<div class="col-8">
|
||||||
v-model="socialActionPicked"
|
<vue-multiselect
|
||||||
label="text"
|
v-model="socialActionPicked"
|
||||||
:options="socialActionsReachables"
|
label="text"
|
||||||
:searchable="true"
|
:options="socialActionsReachables"
|
||||||
:close-on-select="true"
|
:searchable="true"
|
||||||
:show-labels="true"
|
:close-on-select="true"
|
||||||
track-by="id"
|
:show-labels="true"
|
||||||
></vue-multiselect>
|
track-by="id"
|
||||||
|
></vue-multiselect>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="isLoadingSocialActions">
|
<div v-if="isLoadingSocialActions">
|
||||||
@ -63,9 +86,9 @@
|
|||||||
<div>
|
<div>
|
||||||
<ul class="record_actions">
|
<ul class="record_actions">
|
||||||
<li class="cancel">
|
<li class="cancel">
|
||||||
<a href="#" class="btn btn-cancel">
|
<button class="btn btn-cancel" @click="goToPrevious">
|
||||||
{{ $t('action.cancel') }}
|
{{ $t('action.cancel') }}
|
||||||
</a>
|
</button>
|
||||||
</li>
|
</li>
|
||||||
<li v-if="hasSocialActionPicked">
|
<li v-if="hasSocialActionPicked">
|
||||||
<button class="btn btn-save" v-show="!isPostingWork" @click="submit">
|
<button class="btn btn-save" v-show="!isPostingWork" @click="submit">
|
||||||
@ -82,43 +105,7 @@
|
|||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="scss">
|
|
||||||
|
|
||||||
#awc_create_form {
|
|
||||||
display: grid;
|
|
||||||
grid-template-areas:
|
|
||||||
"picking picking"
|
|
||||||
"start_date end_date"
|
|
||||||
"confirm confirm"
|
|
||||||
;
|
|
||||||
grid-template-columns: 50% 50%;
|
|
||||||
column-gap: 1.5rem;
|
|
||||||
|
|
||||||
#picking {
|
|
||||||
grid-area: picking;
|
|
||||||
|
|
||||||
#persons {
|
|
||||||
ul {
|
|
||||||
padding: 0;
|
|
||||||
|
|
||||||
list-style-type: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#start_date {
|
|
||||||
grid-area: start_date;
|
|
||||||
}
|
|
||||||
|
|
||||||
#end_date {
|
|
||||||
grid-area: end_date;
|
|
||||||
}
|
|
||||||
|
|
||||||
#confirm {
|
|
||||||
grid-area: confirm;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapState, mapActions, mapGetters } from 'vuex';
|
import { mapState, mapActions, mapGetters } from 'vuex';
|
||||||
@ -145,17 +132,38 @@ export default {
|
|||||||
name: 'App',
|
name: 'App',
|
||||||
components: {
|
components: {
|
||||||
VueMultiselect,
|
VueMultiselect,
|
||||||
PersonRenderBox,
|
PersonRenderBox,
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
submit() {
|
submit() {
|
||||||
this.$store.dispatch('submit');
|
this.$store.dispatch('submit')
|
||||||
}
|
.catch(({name, violations}) => {
|
||||||
|
if (name === 'ValidationException' || name === 'AccessException') {
|
||||||
|
violations.forEach((violation) => this.$toast.open({message: violation}));
|
||||||
|
} else {
|
||||||
|
this.$toast.open({message: 'An error occurred'})
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
addIssueInList(value) {
|
||||||
|
this.$store.commit('addIssueInList', value);
|
||||||
|
this.$store.commit('removeIssueInOther', value);
|
||||||
|
this.$store.dispatch('pickSocialIssue', value.id);
|
||||||
|
},
|
||||||
|
goToPrevious() {
|
||||||
|
let params = new URLSearchParams(window.location.search);
|
||||||
|
if (params.has('returnPath')) {
|
||||||
|
window.location.replace(params.get('returnPath'));
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
i18n,
|
i18n,
|
||||||
computed: {
|
computed: {
|
||||||
...mapState([
|
...mapState([
|
||||||
'socialIssues',
|
'socialIssues',
|
||||||
|
'socialIssuesOther',
|
||||||
'socialActionsReachables',
|
'socialActionsReachables',
|
||||||
'errors',
|
'errors',
|
||||||
'personsReachables',
|
'personsReachables',
|
||||||
@ -170,12 +178,12 @@ export default {
|
|||||||
personsPicked: {
|
personsPicked: {
|
||||||
get() {
|
get() {
|
||||||
let s = this.$store.state.personsPicked.map(p => p.id);
|
let s = this.$store.state.personsPicked.map(p => p.id);
|
||||||
console.log('persons picked', s);
|
// console.log('persons picked', s);
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
},
|
},
|
||||||
set(v) {
|
set(v) {
|
||||||
console.log('persons picked', v);
|
// console.log('persons picked', v);
|
||||||
this.$store.commit('setPersonsPickedIds', v);
|
this.$store.commit('setPersonsPickedIds', v);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -228,10 +236,48 @@ export default {
|
|||||||
@import 'ChillPersonAssets/chill/scss/mixins';
|
@import 'ChillPersonAssets/chill/scss/mixins';
|
||||||
@import 'ChillMainAssets/chill/scss/chill_variables';
|
@import 'ChillMainAssets/chill/scss/chill_variables';
|
||||||
span.badge {
|
span.badge {
|
||||||
@include badge_social($social-issue-color);
|
@include badge_social($social-issue-color);
|
||||||
font-size: 95%;
|
font-size: 95%;
|
||||||
margin-bottom: 5px;
|
margin-bottom: 5px;
|
||||||
margin-right: 1em;
|
margin-right: 1em;
|
||||||
margin-left: 1em;
|
margin-left: 1em;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
|
||||||
|
#awc_create_form {
|
||||||
|
display: grid;
|
||||||
|
grid-template-areas:
|
||||||
|
"picking picking"
|
||||||
|
"start_date end_date"
|
||||||
|
"confirm confirm"
|
||||||
|
;
|
||||||
|
grid-template-columns: 50% 50%;
|
||||||
|
column-gap: 1.5rem;
|
||||||
|
|
||||||
|
#picking {
|
||||||
|
grid-area: picking;
|
||||||
|
|
||||||
|
#persons {
|
||||||
|
ul {
|
||||||
|
padding: 0;
|
||||||
|
|
||||||
|
list-style-type: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#start_date {
|
||||||
|
grid-area: start_date;
|
||||||
|
}
|
||||||
|
|
||||||
|
#end_date {
|
||||||
|
grid-area: end_date;
|
||||||
|
}
|
||||||
|
|
||||||
|
#confirm {
|
||||||
|
grid-area: confirm;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
@ -2,7 +2,8 @@
|
|||||||
import { createStore } from 'vuex';
|
import { createStore } from 'vuex';
|
||||||
import { datetimeToISO } from 'ChillMainAssets/chill/js/date.js';
|
import { datetimeToISO } from 'ChillMainAssets/chill/js/date.js';
|
||||||
import { findSocialActionsBySocialIssue } from 'ChillPersonAssets/vuejs/_api/SocialWorkSocialAction.js';
|
import { findSocialActionsBySocialIssue } from 'ChillPersonAssets/vuejs/_api/SocialWorkSocialAction.js';
|
||||||
import { create } from 'ChillPersonAssets/vuejs/_api/AccompanyingCourseWork.js';
|
// import { create } from 'ChillPersonAssets/vuejs/_api/AccompanyingCourseWork.js';
|
||||||
|
import { makeFetch } from 'ChillMainAssets/lib/api/apiMethods';
|
||||||
|
|
||||||
const debug = process.env.NODE_ENV !== 'production';
|
const debug = process.env.NODE_ENV !== 'production';
|
||||||
|
|
||||||
@ -12,6 +13,7 @@ const store = createStore({
|
|||||||
accompanyingCourse: window.accompanyingCourse,
|
accompanyingCourse: window.accompanyingCourse,
|
||||||
socialIssues: window.accompanyingCourse.socialIssues,
|
socialIssues: window.accompanyingCourse.socialIssues,
|
||||||
socialIssuePicked: null,
|
socialIssuePicked: null,
|
||||||
|
socialIssuesOther: [],
|
||||||
socialActionsReachables: [],
|
socialActionsReachables: [],
|
||||||
socialActionPicked: null,
|
socialActionPicked: null,
|
||||||
personsPicked: window.accompanyingCourse.participations.filter(p => p.endDate == null)
|
personsPicked: window.accompanyingCourse.participations.filter(p => p.endDate == null)
|
||||||
@ -26,7 +28,6 @@ const store = createStore({
|
|||||||
},
|
},
|
||||||
getters: {
|
getters: {
|
||||||
hasSocialActionPicked(state) {
|
hasSocialActionPicked(state) {
|
||||||
console.log(state.socialActionPicked);
|
|
||||||
return null !== state.socialActionPicked;
|
return null !== state.socialActionPicked;
|
||||||
},
|
},
|
||||||
hasSocialIssuePicked(state) {
|
hasSocialIssuePicked(state) {
|
||||||
@ -73,27 +74,43 @@ const store = createStore({
|
|||||||
},
|
},
|
||||||
mutations: {
|
mutations: {
|
||||||
setSocialActionsReachables(state, actions) {
|
setSocialActionsReachables(state, actions) {
|
||||||
console.log('set social action reachables');
|
// console.log('set social action reachables');
|
||||||
console.log(actions);
|
// console.log(actions);
|
||||||
|
|
||||||
state.socialActionsReachables = actions;
|
state.socialActionsReachables = actions;
|
||||||
},
|
},
|
||||||
setSocialAction(state, socialAction) {
|
setSocialAction(state, socialAction) {
|
||||||
console.log('socialAction', socialAction);
|
// console.log('socialAction', socialAction);
|
||||||
state.socialActionPicked = socialAction;
|
state.socialActionPicked = socialAction;
|
||||||
},
|
},
|
||||||
setSocialIssue(state, socialIssueId) {
|
setSocialIssue(state, socialIssueId) {
|
||||||
console.log('set social issue', socialIssueId);
|
// console.log('set social issue', socialIssueId);
|
||||||
if (socialIssueId === null) {
|
if (socialIssueId === null) {
|
||||||
state.socialIssuePicked = null;
|
state.socialIssuePicked = null;
|
||||||
} else {
|
} else {
|
||||||
let mapped = state.socialIssues
|
let mapped = state.socialIssues
|
||||||
.find(e => e.id === socialIssueId);
|
.find(e => e.id === socialIssueId);
|
||||||
console.log('mapped', mapped);
|
|
||||||
state.socialIssuePicked = mapped;
|
state.socialIssuePicked = mapped;
|
||||||
console.log('social issue setted', state.socialIssuePicked);
|
// console.log('social issue setted', state.socialIssuePicked);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
addIssueInList(state, issue) {
|
||||||
|
//console.log('add issue list', issue.id);
|
||||||
|
state.socialIssues.push(issue);
|
||||||
|
},
|
||||||
|
updateIssuesOther(state, payload) {
|
||||||
|
//console.log('update issues other');
|
||||||
|
state.socialIssuesOther = payload;
|
||||||
|
},
|
||||||
|
removeIssueInOther(state, issue) {
|
||||||
|
//console.log('remove issue other', issue.id);
|
||||||
|
state.socialIssuesOther = state.socialIssuesOther.filter(
|
||||||
|
(i) => i.id !== issue.id
|
||||||
|
);
|
||||||
|
},
|
||||||
|
updateSelected(state, payload) {
|
||||||
|
state.socialIssueSelected = payload;
|
||||||
|
},
|
||||||
setIsLoadingSocialActions(state, s) {
|
setIsLoadingSocialActions(state, s) {
|
||||||
state.isLoadingSocialActions = s;
|
state.isLoadingSocialActions = s;
|
||||||
},
|
},
|
||||||
@ -131,8 +148,6 @@ const store = createStore({
|
|||||||
|
|
||||||
findSocialActionsBySocialIssue(socialIssueId).then(
|
findSocialActionsBySocialIssue(socialIssueId).then(
|
||||||
(response) => {
|
(response) => {
|
||||||
console.log(response);
|
|
||||||
console.log(response.results);
|
|
||||||
commit('setSocialIssue', socialIssueId);
|
commit('setSocialIssue', socialIssueId);
|
||||||
commit('setSocialActionsReachables', response.results);
|
commit('setSocialActionsReachables', response.results);
|
||||||
commit('setIsLoadingSocialActions', false);
|
commit('setIsLoadingSocialActions', false);
|
||||||
@ -142,34 +157,34 @@ const store = createStore({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
submit({ commit, getters, state }) {
|
submit({ commit, getters, state }) {
|
||||||
console.log('submit');
|
let payload = getters.buildPayloadCreate;
|
||||||
let
|
const url = `/api/1.0/person/accompanying-course/${state.accompanyingCourse.id}/work.json`;
|
||||||
payload = getters.buildPayloadCreate,
|
|
||||||
errors = [];
|
|
||||||
|
|
||||||
commit('setPostingWork');
|
commit('setPostingWork');
|
||||||
|
|
||||||
create(state.accompanyingCourse.id, payload)
|
makeFetch('POST', url, payload)
|
||||||
.then( ({status, data}) => {
|
.then((response) => {
|
||||||
console.log('created return', { status, data});
|
window.location.assign(`/fr/person/accompanying-period/work/${response.id}/edit`)
|
||||||
if (status === 200) {
|
})
|
||||||
console.log('created, nothing to do here any more. Bye-bye!');
|
.catch((error) => {
|
||||||
window.location.assign(`/fr/person/accompanying-period/work/${data.id}/edit`);
|
throw error;
|
||||||
} else if (status === 422) {
|
|
||||||
console.log(data);
|
|
||||||
for (let i in data.violations) {
|
|
||||||
console.log(i);
|
|
||||||
console.log(data.violations[i].title);
|
|
||||||
errors.push(data.violations[i].title);
|
|
||||||
}
|
|
||||||
console.log('errors after reseponse handling', errors);
|
|
||||||
console.log({errors, cancel_posting: true});
|
|
||||||
commit('addErrors', { errors, cancel_posting: true });
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
fetchOtherSocialIssues({commit}) {
|
||||||
|
const url = `/api/1.0/person/social-work/social-issue.json`;
|
||||||
|
return makeFetch('GET', url)
|
||||||
|
.then((response) => {
|
||||||
|
commit('updateIssuesOther', response.results);
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
throw error;
|
||||||
|
})
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
store.dispatch('fetchOtherSocialIssues');
|
||||||
|
|
||||||
export { store };
|
export { store };
|
||||||
|
@ -1,30 +1,30 @@
|
|||||||
const create = (accompanying_period_id, payload) => {
|
// const create = (accompanying_period_id, payload) => {
|
||||||
const url = `/api/1.0/person/accompanying-course/${accompanying_period_id}/work.json`;
|
// const url = `/api/1.0/person/accompanying-course/${accompanying_period_id}/work.json`;
|
||||||
let status;
|
// let status;
|
||||||
console.log('create', payload);
|
// console.log('create', payload);
|
||||||
|
|
||||||
return fetch(url, {
|
// return fetch(url, {
|
||||||
method: 'POST',
|
// method: 'POST',
|
||||||
headers: {
|
// headers: {
|
||||||
'Content-Type': 'application/json',
|
// 'Content-Type': 'application/json',
|
||||||
},
|
// },
|
||||||
body: JSON.stringify(payload),
|
// body: JSON.stringify(payload),
|
||||||
})
|
// })
|
||||||
.then(response => {
|
// .then(response => {
|
||||||
if (response.ok || response.status === 422) {
|
// if (response.ok || response.status === 422) {
|
||||||
status = response.status;
|
// status = response.status;
|
||||||
|
|
||||||
return response.json();
|
// return response.json();
|
||||||
}
|
// }
|
||||||
|
|
||||||
throw new Error("Error while retrieving social actions: " + response.status +
|
// throw new Error("Error while retrieving social actions: " + response.status +
|
||||||
" " + response.statusText);
|
// " " + response.statusText);
|
||||||
})
|
// })
|
||||||
.then(data => {
|
// .then(data => {
|
||||||
return new Promise((resolve, reject) => {
|
// return new Promise((resolve, reject) => {
|
||||||
resolve({ status, data });
|
// resolve({ status, data });
|
||||||
});
|
// });
|
||||||
});
|
// });
|
||||||
};
|
// };
|
||||||
|
|
||||||
export { create };
|
// export { create };
|
||||||
|
@ -0,0 +1,14 @@
|
|||||||
|
services:
|
||||||
|
accompanying_period_social_issue_consistency_with_action:
|
||||||
|
class: 'Chill\PersonBundle\AccompanyingPeriod\SocialIssueConsistency\AccompanyingPeriodSocialIssueConsistencyEntityListener'
|
||||||
|
tags:
|
||||||
|
-
|
||||||
|
name: 'doctrine.orm.entity_listener'
|
||||||
|
event: 'prePersist'
|
||||||
|
entity: 'Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork'
|
||||||
|
lazy: true
|
||||||
|
-
|
||||||
|
name: 'doctrine.orm.entity_listener'
|
||||||
|
event: 'preUpdate'
|
||||||
|
entity: 'Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork'
|
||||||
|
lazy: true
|
@ -1 +1 @@
|
|||||||
Subproject commit 5952eda44831896991989c2e4881adc26329140e
|
Subproject commit bd95d3c96a437757b7e8f35cdfd30da9aeac1a01
|
Loading…
x
Reference in New Issue
Block a user