Merge branch 'url_in_accompanyingPeriodWork_evaluations' into 'master'

Url in accompanying period work evaluations

See merge request Chill-Projet/chill-bundles!364
This commit is contained in:
Julien Fastré 2022-03-06 21:37:27 +00:00
commit 80aee185a7
7 changed files with 71 additions and 2 deletions

View File

@ -11,6 +11,7 @@ and this project adheres to
## Unreleased ## Unreleased
<!-- write down unreleased development here --> <!-- write down unreleased development here -->
* [person] Add url in accompanying period work evaluations entity and form (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/476)
* [person] Add document generation in admin and in person/{id}/document (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/464) * [person] Add document generation in admin and in person/{id}/document (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/464)
* [activity] do not override location if already exist (when validating new activity) (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/470) * [activity] do not override location if already exist (when validating new activity) (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/470)
* [parcours] Toggle emergency/intensity only by referrer (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/442) * [parcours] Toggle emergency/intensity only by referrer (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/442)

View File

@ -92,9 +92,11 @@ final class PhonenumberHelper implements PhoneNumberHelperInterface
switch ($this->phoneNumberUtil->getNumberType($phonenumber)) { switch ($this->phoneNumberUtil->getNumberType($phonenumber)) {
case PhoneNumberType::MOBILE: case PhoneNumberType::MOBILE:
return 'mobile'; return 'mobile';
case PhoneNumberType::FIXED_LINE: case PhoneNumberType::FIXED_LINE:
case PhoneNumberType::VOIP: case PhoneNumberType::VOIP:
return 'landline'; return 'landline';
default: default:
return 'landline'; return 'landline';
} }

View File

@ -98,7 +98,7 @@ class PersonPhone
public function isEmpty(): bool public function isEmpty(): bool
{ {
return ("" === $this->getDescription() || null === $this->getDescription()) return ('' === $this->getDescription() || null === $this->getDescription())
&& null === $this->getPhonenumber(); && null === $this->getPhonenumber();
} }

View File

@ -62,6 +62,12 @@ class Evaluation
*/ */
private array $title = []; private array $title = [];
/**
* @ORM\Column(type="text", nullable=true)
* @Serializer\Groups({"read", "docgen:read"})
*/
private ?string $url = null;
public function __construct() public function __construct()
{ {
$this->socialActions = new ArrayCollection(); $this->socialActions = new ArrayCollection();
@ -101,6 +107,11 @@ class Evaluation
return $this->title; return $this->title;
} }
public function getUrl(): ?string
{
return $this->url;
}
public function removeSocialAction(SocialAction $socialAction): self public function removeSocialAction(SocialAction $socialAction): self
{ {
if ($this->socialActions->contains($socialAction)) { if ($this->socialActions->contains($socialAction)) {
@ -130,4 +141,11 @@ class Evaluation
return $this; return $this;
} }
public function setUrl(?string $url): self
{
$this->url = $url;
return $this;
}
} }

View File

@ -16,7 +16,6 @@ use Chill\MainBundle\Phonenumber\PhonenumberHelper;
use Chill\PersonBundle\Entity\PersonPhone; use Chill\PersonBundle\Entity\PersonPhone;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\TelType;
use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormEvent; use Symfony\Component\Form\FormEvent;

View File

@ -5,6 +5,11 @@
<span>{{ evaluation.evaluation.title.fr }}</span> <span>{{ evaluation.evaluation.title.fr }}</span>
</div> </div>
<div class="item-url mt-3 mb-4" v-if="evaluation.evaluation.url">
<i class="fa fa-link fa-lg"></i>
<a :href="evaluation.evaluation.url" target="_blank">{{ evaluation.evaluation.url }}</a>
</div>
<div> <div>
<form-evaluation ref="FormEvaluation" :key="evaluation.key" :evaluation="evaluation"></form-evaluation> <form-evaluation ref="FormEvaluation" :key="evaluation.key" :evaluation="evaluation"></form-evaluation>
@ -128,4 +133,11 @@ export default {
} }
} }
} }
div.item-url {
i {
color: unset!important;
margin-left: 1rem;
margin-right: 0.5rem;
}
}
</style> </style>

View File

@ -0,0 +1,37 @@
<?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\Migrations\Person;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Add url to SocialWork Evaluation.
*/
final class Version20220303113855 extends AbstractMigration
{
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE chill_person_social_work_evaluation DROP url');
}
public function getDescription(): string
{
return 'Add url to SocialWork Evaluation';
}
public function up(Schema $schema): void
{
$this->addSql('ALTER TABLE chill_person_social_work_evaluation ADD url TEXT DEFAULT NULL');
$this->addSql("UPDATE chill_person_social_work_evaluation SET url = CASE WHEN title->>'fr' LIKE 'http%' THEN title->>'fr' ELSE null END;");
}
}