Merge branch 'master' into upgrade-php82

This commit is contained in:
2023-03-06 16:37:09 +01:00
41 changed files with 254 additions and 233 deletions

View File

@@ -11,7 +11,6 @@ declare(strict_types=1);
namespace Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters;
use Chill\MainBundle\Entity\User;
use Chill\MainBundle\Entity\UserJob;
use Chill\MainBundle\Export\FilterInterface;
use Chill\MainBundle\Form\Type\PickRollingDateType;

View File

@@ -2,6 +2,29 @@
<div class="vue-component">
<h2><a id="section-80"></a>{{ $t('referrer.title') }}</h2>
<teleport to="body">
<modal v-if="modal.showModal"
:modalDialogClass="modal.modalDialogClass"
@close="cancelChange">
<template v-slot:header>
<h3 class="modal-title">{{ $t('confirm.title') }}</h3>
</template>
<template v-slot:body-head>
<div class="modal-body">
<p v-html="$t('confirm.sure_referrer', { referrer: this.value.text })"></p>
</div>
</template>
<template v-slot:footer>
<button class="btn btn-save"
@click.prevent="this.confirmReferrer">
{{ $t('confirm.ok_referrer')}}
</button>
</template>
</modal>
</teleport>
<div>
<label class="col-form-label" for="selectJob">
@@ -35,6 +58,7 @@
:searchable="true"
:placeholder="$t('referrer.placeholder')"
v-model="value"
@select="updateReferrer"
:options="users"
:select-label="$t('multiselect.select_label')"
:deselect-label="$t('multiselect.deselect_label')"
@@ -78,16 +102,24 @@ import VueMultiselect from 'vue-multiselect';
import {makeFetch} from 'ChillMainAssets/lib/api/apiMethods';
import {mapState, mapGetters} from 'vuex';
import UserRenderBoxBadge from "ChillMainAssets/vuejs/_components/Entity/UserRenderBoxBadge";
import Modal from 'ChillMainAssets/vuejs/_components/Modal';
export default {
name: "Referrer",
components: {
UserRenderBoxBadge,
VueMultiselect,
Modal
},
data() {
return {
jobs: []
jobs: [],
modal: {
showModal: false,
modalDialogClass: "modal-dialog-scrollable modal-xl"
},
value: this.$store.state.accompanyingCourse.user,
confirmed: false
}
},
computed: {
@@ -118,22 +150,6 @@ export default {
});
}
},
value: {
get() {
return this.$store.state.accompanyingCourse.user;
},
set(value) {
console.log('set referrer', value);
this.$store.dispatch('updateReferrer', value)
.catch(({name, violations}) => {
if (name === 'ValidationException' || name === 'AccessException') {
violations.forEach((violation) => this.$toast.open({message: violation}));
} else {
this.$toast.open({message: 'An error occurred'})
}
});
}
},
},
mounted() {
this.getJobs();
@@ -141,6 +157,7 @@ export default {
methods: {
updateReferrer(value) {
this.value = value;
this.toggleModal();
},
getJobs() {
const url = '/api/1.0/main/user-job.json';
@@ -159,12 +176,27 @@ export default {
const url = `/api/1.0/main/whoami.json`;
makeFetch('GET', url)
.then(user => {
this.value = user
// this.value = user
this.updateReferrer(user);
})
/*.catch((error) => {
commit('catchError', error);
this.$toast.open({message: error.body})
})*/
},
toggleModal() {
this.modal.showModal = !this.modal.showModal;
},
confirmReferrer() {
this.$store.dispatch('updateReferrer', this.value)
.catch(({name, violations}) => {
if (name === 'ValidationException' || name === 'AccessException') {
violations.forEach((violation) => this.$toast.open({message: violation}));
} else {
this.$toast.open({message: 'An error occurred'})
}
});
this.toggleModal()
},
cancelChange() {
this.value = this.$store.state.accompanyingCourse.user
this.toggleModal()
}
}
}

View File

@@ -178,7 +178,7 @@ export default {
body.civility = {type: 'chill_main_civility', id: payload.data.civility.id};
}
if (null !== payload.data.profession) {
body.profession = {type: 'third_party_profession', id: payload.data.profession.id};
body.profession = payload.data.profession;
}
// console.log('body', body);

View File

@@ -139,8 +139,10 @@ const appMessages = {
set_a_scope: "indiquez au moins un service",
sure: "Êtes-vous sûr ?",
sure_description: "Une fois le changement confirmé, il ne sera plus possible de le remettre à l'état de brouillon !",
sure_referrer: "Êtes-vous sûr de vouloir assigner ce parcours à <b>{referrer}</b>",
ok: "Confirmer le parcours",
delete: "Supprimer le parcours",
ok_referrer: "Confirmer le référent",
no_suggested_referrer: "Il n'y a aucun référent qui puisse être suggéré pour ce parcours. Vérifiez la localisation du parcours, les métiers et service indiqués. Si les données sont correctes, vous pouvez confirmer ce parcours.",
one_suggested_referrer: "Un unique référent peut être suggéré pour ce parcours",
choose_suggested_referrer: "Voulez-vous le désigner directement ?",

View File

@@ -1,7 +1,7 @@
<template>
<div class="container tpartycontainer">
<div class="tparty-identification">
<span v-if="item.result.profession" class="profession">{{ item.result.profession.name.fr }}</span>
<span v-if="item.result.profession" class="profession">{{ item.result.profession }}</span>
<span class="name">
{{ item.result.text }}&nbsp;
</span>

View File

@@ -3,6 +3,7 @@
#}{{ period.user.label }},
L'usager {{ oldPersonLocation|chill_entity_render_string }} a déménagé.
{{ app.user|chill_entity_render_string }} a enregistré ce déménagement.
Son adresse était utilisée pour localiser le parcours n°{{ period.id }}, dont vous êtes
le référent.

View File

@@ -79,6 +79,11 @@ class SimilarPersonMatcher
->where('SIMILARITY(p.fullnameCanonical, UNACCENT(LOWER(:fullName))) >= :precision')
->andWhere($qb->expr()->in('p.center', ':centers'));
$qb
->setParameter('fullName', $this->personRender->renderString($person, []))
->setParameter('centers', $centers)
->setParameter('precision', $precision);
if (null !== $person->getBirthdate()) {
$qb->andWhere($qb->expr()->orX(
$qb->expr()->eq('p.birthdate', ':personBirthdate'),
@@ -90,13 +95,13 @@ class SimilarPersonMatcher
if ($person->getId() !== null) {
$qb->andWhere($qb->expr()->neq('p.id', ':personId'));
$query->setParameter('personId', $person->getId());
$qb->setParameter('personId', $person->getId());
$notDuplicatePersons = $this->personNotDuplicateRepository->findNotDuplicatePerson($person);
if (count($notDuplicatePersons)) {
$qb->andWhere($qb->expr()->notIn('p.id', ':notDuplicatePersons'));
$query->setParameter('notDuplicatePersons', $notDuplicatePersons);
$qb->setParameter('notDuplicatePersons', $notDuplicatePersons);
}
}
@@ -109,13 +114,10 @@ class SimilarPersonMatcher
case self::SIMILAR_SEARCH_ORDER_BY_SIMILARITY:
default:
$qb->orderBy('SIMILARITY(p.fullnameCanonical, UNACCENT(LOWER(:fullName)))', 'DESC');
$qb->setParameter('fullName', $this->personRender->renderString($person, []));
}
$qb
->setParameter('fullName', $this->personRender->renderString($person, []))
->setParameter('centers', $centers)
->setParameter('precision', $precision);
dump($qb->getQuery());
return $qb->getQuery()->getResult();
}
}