mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Merge remote-tracking branch 'origin/master' into issue484_link_household
This commit is contained in:
commit
c7f2eedd4b
@ -11,6 +11,8 @@ and this project adheres to
|
||||
## Unreleased
|
||||
|
||||
<!-- write down unreleased development here -->
|
||||
* [main] filter user job in undispatch acc period to assign (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/472)
|
||||
* [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)
|
||||
* [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)
|
||||
@ -28,6 +30,7 @@ and this project adheres to
|
||||
* [confidential] Fix position of toggle button so it does not cover text nor fall outside of box (no issue)
|
||||
* [parcours] Fix edit of both thirdparty and contact name (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/474)
|
||||
* [template] do not list inactive templates (for doc generator)
|
||||
* [parcours] location cannot be removed if linked to a user (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/478)
|
||||
* [person] email added to twig personRenderbox (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/490)
|
||||
* [person] Add link to current household in person banner (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/484)
|
||||
|
||||
|
@ -27,7 +27,7 @@ interface PhoneNumberHelperInterface
|
||||
/**
|
||||
* Get type (mobile, landline, ...) for phone number.
|
||||
*/
|
||||
public function getType(string $phonenumber): string;
|
||||
public function getType(PhoneNumber $phonenumber): string;
|
||||
|
||||
/**
|
||||
* Return true if the validation is configured and available.
|
||||
|
@ -17,6 +17,7 @@ use GuzzleHttp\Exception\ConnectException;
|
||||
use GuzzleHttp\Exception\ServerException;
|
||||
use libphonenumber\NumberParseException;
|
||||
use libphonenumber\PhoneNumber;
|
||||
use libphonenumber\PhoneNumberType;
|
||||
use libphonenumber\PhoneNumberUtil;
|
||||
use Psr\Cache\CacheItemPoolInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
@ -86,9 +87,19 @@ final class PhonenumberHelper implements PhoneNumberHelperInterface
|
||||
/**
|
||||
* Get type (mobile, landline, ...) for phone number.
|
||||
*/
|
||||
public function getType(string $phonenumber): string
|
||||
public function getType(PhoneNumber $phonenumber): string
|
||||
{
|
||||
return $this->performTwilioLookup($phonenumber) ?? 'unknown';
|
||||
switch ($this->phoneNumberUtil->getNumberType($phonenumber)) {
|
||||
case PhoneNumberType::MOBILE:
|
||||
return 'mobile';
|
||||
|
||||
case PhoneNumberType::FIXED_LINE:
|
||||
case PhoneNumberType::VOIP:
|
||||
return 'landline';
|
||||
|
||||
default:
|
||||
return 'landline';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -40,6 +40,10 @@ class PhonenumberNormalizer implements NormalizerInterface, DenormalizerInterfac
|
||||
*/
|
||||
public function denormalize($data, $type, $format = null, array $context = [])
|
||||
{
|
||||
if ('' === trim($data)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
return $this->phoneNumberUtil->parse($data, $this->defaultCarrierCode);
|
||||
} catch (NumberParseException $e) {
|
||||
|
@ -98,7 +98,8 @@ class PersonPhone
|
||||
|
||||
public function isEmpty(): bool
|
||||
{
|
||||
return empty($this->getDescription()) && empty($this->getPhonenumber());
|
||||
return ('' === $this->getDescription() || null === $this->getDescription())
|
||||
&& null === $this->getPhonenumber();
|
||||
}
|
||||
|
||||
public function setDate(DateTime $date): void
|
||||
|
@ -62,6 +62,12 @@ class Evaluation
|
||||
*/
|
||||
private array $title = [];
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="text", nullable=true)
|
||||
* @Serializer\Groups({"read", "docgen:read"})
|
||||
*/
|
||||
private ?string $url = null;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->socialActions = new ArrayCollection();
|
||||
@ -101,6 +107,11 @@ class Evaluation
|
||||
return $this->title;
|
||||
}
|
||||
|
||||
public function getUrl(): ?string
|
||||
{
|
||||
return $this->url;
|
||||
}
|
||||
|
||||
public function removeSocialAction(SocialAction $socialAction): self
|
||||
{
|
||||
if ($this->socialActions->contains($socialAction)) {
|
||||
@ -130,4 +141,11 @@ class Evaluation
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setUrl(?string $url): self
|
||||
{
|
||||
$this->url = $url;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
@ -27,6 +27,7 @@ use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\PersonBundle\Entity\PersonPhone;
|
||||
use Chill\PersonBundle\Form\Type\GenderType;
|
||||
use Chill\PersonBundle\Form\Type\PersonAltNameType;
|
||||
use Chill\PersonBundle\Form\Type\PersonPhoneType;
|
||||
use Chill\PersonBundle\Form\Type\Select2MaritalStatusType;
|
||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
@ -158,7 +159,7 @@ class PersonType extends AbstractType
|
||||
}
|
||||
|
||||
$builder->add('otherPhoneNumbers', ChillCollectionType::class, [
|
||||
'entry_type' => ChillPhoneNumberType::class,
|
||||
'entry_type' => PersonPhoneType::class,
|
||||
'button_add_label' => 'Add new phone',
|
||||
'button_remove_label' => 'Remove phone',
|
||||
'required' => false,
|
||||
|
@ -11,11 +11,11 @@ declare(strict_types=1);
|
||||
|
||||
namespace Chill\PersonBundle\Form\Type;
|
||||
|
||||
use Chill\MainBundle\Form\Type\ChillPhoneNumberType;
|
||||
use Chill\MainBundle\Phonenumber\PhonenumberHelper;
|
||||
use Chill\PersonBundle\Entity\PersonPhone;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
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\FormBuilderInterface;
|
||||
use Symfony\Component\Form\FormEvent;
|
||||
@ -36,7 +36,7 @@ class PersonPhoneType extends AbstractType
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
$builder->add('phonenumber', TelType::class, [
|
||||
$builder->add('phonenumber', ChillPhoneNumberType::class, [
|
||||
'label' => 'Other phonenumber',
|
||||
'required' => true,
|
||||
]);
|
||||
|
@ -19,22 +19,21 @@ import {fetchResults} from 'ChillMainAssets/lib/api/apiMethods.js';
|
||||
*/
|
||||
|
||||
document.querySelectorAll('[data-set-referrer-app]').forEach(function (el) {
|
||||
let
|
||||
periodId = Number.parseInt(el.dataset.setReferrerAccompanyingPeriodId);
|
||||
|
||||
const periodId = Number.parseInt(el.dataset.setReferrerAccompanyingPeriodId);
|
||||
const jobId = Number.parseInt(el.dataset.setReferrerJobId);
|
||||
const url = `/api/1.0/person/accompanying-course/${periodId}/referrers-suggested.json`;
|
||||
|
||||
fetchResults(url).then(suggested => {
|
||||
|
||||
const filteredSuggested = suggested.filter((s) => s.user_job ? s.user_job.id === jobId : false);
|
||||
const app = createApp({
|
||||
components: {
|
||||
SetReferrer,
|
||||
},
|
||||
template:
|
||||
'<set-referrer :suggested="suggested" :periodId="periodId" @referrerSet="onReferrerSet"></set-referrer>',
|
||||
'<set-referrer :suggested="filteredSuggested" :periodId="periodId" @referrerSet="onReferrerSet"></set-referrer>',
|
||||
data() {
|
||||
return {
|
||||
periodId, suggested, original: suggested,
|
||||
periodId, filteredSuggested, original: filteredSuggested,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@ -56,7 +55,7 @@ document.querySelectorAll('[data-set-referrer-app]').forEach(function (el) {
|
||||
label.textContent = ref.text;
|
||||
label.classList.remove('chill-no-data-statement');
|
||||
|
||||
this.suggested = this.original.filter(user => user.id !== ref.id);
|
||||
this.filteredSuggested = this.original.filter(user => user.id !== ref.id);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -59,14 +59,6 @@
|
||||
ref="addAddress">
|
||||
</add-address>
|
||||
</li>
|
||||
<li v-if="isPersonLocation">
|
||||
<button
|
||||
class="btn btn-remove"
|
||||
@click="removeAddress"
|
||||
:title="$t('courselocation.remove_button')">
|
||||
{{ $t('action.remove') }}
|
||||
</button>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@ -180,22 +172,6 @@ export default {
|
||||
}
|
||||
this.$store.commit('setAddressContext', context);
|
||||
},
|
||||
removeAddress() {
|
||||
let payload = {
|
||||
target: this.context.target.name,
|
||||
targetId: this.context.target.id,
|
||||
locationStatusTo: 'none'
|
||||
};
|
||||
//console.log('remove address');
|
||||
this.$store.dispatch('updateLocation', payload)
|
||||
.catch(({name, violations}) => {
|
||||
if (name === 'ValidationException' || name === 'AccessException') {
|
||||
violations.forEach((violation) => this.$toast.open({message: violation}));
|
||||
} else {
|
||||
this.$toast.open({message: 'An error occurred'})
|
||||
}
|
||||
});
|
||||
},
|
||||
displayErrors() {
|
||||
return this.$refs.addAddress.errorMsg;
|
||||
},
|
||||
|
@ -170,7 +170,9 @@ export default {
|
||||
console.log('data', payload.data)
|
||||
body.name = payload.data.name;
|
||||
body.email = payload.data.email;
|
||||
body.telephone = payload.data.phonenumber;
|
||||
body.telephone = payload.data.telephone;
|
||||
body.civility = payload.data.civility;
|
||||
body.profession = payload.data.profession;
|
||||
body.address = payload.data.address ? { id: payload.data.address.address_id } : null;
|
||||
|
||||
makeFetch('PATCH', `/api/1.0/thirdparty/thirdparty/${payload.data.id}.json`, body)
|
||||
|
@ -5,6 +5,11 @@
|
||||
<span>{{ evaluation.evaluation.title.fr }}</span>
|
||||
</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>
|
||||
<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>
|
||||
|
@ -1,12 +1,12 @@
|
||||
<template>
|
||||
<ul class="list-suggest add-items" v-if="suggested.length > 0">
|
||||
<li v-for="r in suggested" @click="setReferrer(r)"><span>{{ r.text }}</span></li>
|
||||
<li v-for="(r, i) in suggested" @click="setReferrer(r)" :key="i"><span>{{ r.text }}</span></li>
|
||||
</ul>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import {makeFetch} from 'ChillMainAssets/lib/api/apiMethods.js';
|
||||
import { makeFetch } from 'ChillMainAssets/lib/api/apiMethods.js';
|
||||
|
||||
export default {
|
||||
name: "SetReferrer",
|
||||
|
@ -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;");
|
||||
}
|
||||
}
|
@ -61,9 +61,9 @@
|
||||
<i class="fa fa-li fa-map-marker"></i>
|
||||
<address-render-box :address="thirdparty.address" :isMultiline="isMultiline"></address-render-box>
|
||||
</li>
|
||||
<li v-if="thirdparty.phonenumber">
|
||||
<li v-if="thirdparty.telephone">
|
||||
<i class="fa fa-li fa-mobile"></i>
|
||||
<a :href="'tel: ' + thirdparty.phonenumber">{{ thirdparty.phonenumber }}</a>
|
||||
<a :href="'tel: ' + thirdparty.telephone">{{ thirdparty.telephone }}</a>
|
||||
</li>
|
||||
<li v-if="thirdparty.email">
|
||||
<i class="fa fa-li fa-envelope-o"></i>
|
||||
@ -78,9 +78,9 @@
|
||||
<i class="fa fa-li fa-map-marker"></i>
|
||||
<address-render-box :address="thirdparty.address" :isMultiline="isMultiline"></address-render-box>
|
||||
</li>
|
||||
<li v-if="thirdparty.phonenumber">
|
||||
<li v-if="thirdparty.telephone">
|
||||
<i class="fa fa-li fa-mobile"></i>
|
||||
<a :href="'tel: ' + thirdparty.phonenumber">{{ thirdparty.phonenumber }}</a>
|
||||
<a :href="'tel: ' + thirdparty.telephone">{{ thirdparty.telephone }}</a>
|
||||
</li>
|
||||
<li v-if="thirdparty.email">
|
||||
<i class="fa fa-li fa-envelope-o"></i>
|
||||
|
@ -118,7 +118,7 @@
|
||||
<div class="input-group mb-3">
|
||||
<span class="input-group-text" id="phonenumber"><i class="fa fa-fw fa-phone"></i></span>
|
||||
<input class="form-control form-control-lg"
|
||||
v-model="thirdparty.phonenumber"
|
||||
v-model="thirdparty.telephone"
|
||||
v-bind:placeholder="$t('thirdparty.phonenumber')"
|
||||
v-bind:aria-label="$t('thirdparty.phonenumber')"
|
||||
aria-describedby="phonenumber" />
|
||||
|
@ -62,7 +62,7 @@ class ThirdPartyNormalizer implements NormalizerAwareInterface, NormalizerInterf
|
||||
}, $thirdParty->getTypesAndCategories()),
|
||||
'profession' => $this->normalizer->normalize($thirdParty->getProfession(), $format, $context),
|
||||
'address' => $this->normalizer->normalize($thirdParty->getAddress(), $format, ['address_rendering' => 'short']),
|
||||
'phonenumber' => $this->normalizer->normalize($thirdParty->getTelephone()),
|
||||
'telephone' => $this->normalizer->normalize($thirdParty->getTelephone()),
|
||||
'email' => $thirdParty->getEmail(),
|
||||
'isChild' => $thirdParty->isChild(),
|
||||
'parent' => $this->normalizer->normalize($thirdParty->getParent(), $format, $context),
|
||||
|
Loading…
x
Reference in New Issue
Block a user