Skip to content

Commit

Permalink
fix(bo-comptes): correction création de comptes 640 (#518)
Browse files Browse the repository at this point in the history
- Correction de la liste vide (département lors de la création des
comptes)
- Correction de la mauvaise interprétation d'une compétence
départemental en compétence régionale
- Correction d'affichage de la région et département lorsque le compte
est en lecture seule est que l'on était hors du service de compétence.
  • Loading branch information
l-scherer authored Sep 25, 2024
2 parents 1799c33 + 03415e7 commit 4fb9758
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
20 changes: 12 additions & 8 deletions packages/frontend-bo/src/components/user/Compte.vue
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,7 @@
</div>
</div>
<div
class="fr-fieldset__element fr-col-12 fr-col-sm-8 fr-col-md-8 fr-col-lg-8 fr-col-xl-8"
>
class="fr-fieldset__element fr-col-12 fr-col-sm-8 fr-col-md-8 fr-col-lg-8 fr-col-xl-8">
<div class="fr-fieldset__element">
<div class="fr-input-group fr-col-12">
<DsfrRadioButtonSet
Expand Down Expand Up @@ -265,24 +264,24 @@ const departementStore = useDepartementStore();
departementStore.fetch();
const userDepartements = computed(() => {
if (props.user.territoireCode === "FRA") {
if (usersStore.user.territoireCode === "FRA" || isFormDisabled.value) {
return departementStore.departements;
}
const departementsByRegion = departementStore.departements.filter(
(d) => d.region === props.user.territoireCode,
(d) => d.region === usersStore.user.territoireCode,
);
if (departementsByRegion?.length) {
return departementsByRegion;
}
return (
departementStore.departements.filter(
(d) => d.value === props.user.territoireCode,
(d) => d.value === usersStore.user.territoireCode,
) ?? []
);
});
const userRegions = computed(() => {
if (usersStore.user.territoireCode === "FRA") {
if (usersStore.user.territoireCode === "FRA" || isFormDisabled.value) {
return regionStore.regions;
}
return (
Expand Down Expand Up @@ -501,17 +500,22 @@ watch([() => serviceCompetenceField.modelValue], function () {
onMounted(async () => {
log.i("Mounted - IN");
serviceCompetenceOptions = [];
if (!usersStore.user.serviceCompetent) {
await usersStore.refreshProfile();
}
if (isFormDisabled.value) {
serviceCompetenceOptions.push(serviceCompetenceNAT);
serviceCompetenceOptions.push(serviceCompetenceREG);
} else {
if (usersStore.user.serviceCompetent === competence.NATIONALE)
if (usersStore.user.serviceCompetent === competence.NATIONALE) {
serviceCompetenceOptions.push(serviceCompetenceNAT);
}
if (
usersStore.user.serviceCompetent === competence.NATIONALE ||
usersStore.user.serviceCompetent === competence.REGIONALE
)
) {
serviceCompetenceOptions.push(serviceCompetenceREG);
}
}
serviceCompetenceOptions.push(serviceCompetenceDEP);
// Mode Edition
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend-bo/src/stores/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const useUserStore = defineStore("user", {
this.user.serviceCompetent =
this.user.territoireCode === "FRA"
? "NAT"
: /^"\d"+$/.test(user.territoireCode)
: /^\d+$/.test(this.user.territoireCode)
? "DEP"
: "REG";
}
Expand Down

0 comments on commit 4fb9758

Please sign in to comment.