Skip to content

Commit

Permalink
Abroger AC ✨
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentlaine committed Feb 19, 2024
1 parent 1d5339e commit e9e10e2
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 6 deletions.
9 changes: 8 additions & 1 deletion client/components/arreteCadre/card.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,14 @@ const arreteCadreActions: Ref<any> = ref([
// },
// },
{
text: 'Abroger',
text: `Abroger l'arrêté et le remplacer`,
show: ['a_venir', 'publie'].includes(props.arreteCadre.statut) && isAcOnDepartementUser,
onclick: () => {
navigateTo(`/arrete-cadre/nouveau/edition?arretecadre=${props.arreteCadre.id}`);
},
},
{
text: `Mettre fin à l'arrêté`,
show: ['a_venir', 'publie'].includes(props.arreteCadre.statut) && isAcOnDepartementUser,
onclick: () => {
repealModalOpened.value = true;
Expand Down
9 changes: 6 additions & 3 deletions client/components/arreteCadre/form/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ const initSticky = () => {
};
};
if (isNewArreteCadre) {
if (isNewArreteCadre && !route.query.arretecadre) {
arreteCadre.value = new ArreteCadre();
} else {
const { data, error } = await api.arreteCadre.get(<string>route.params.id);
const { data, error } = await api.arreteCadre.get(isNewArreteCadre ? <string>route.query.arretecadre : <string>route.params.id);
if (data.value) {
arreteCadre.value = <ArreteCadre>data.value;
if (props.duplicate) {
if (props.duplicate || route.query.arretecadre) {
arreteCadre.value.id = null;
arreteCadre.value.statut = 'a_valider';
arreteCadre.value.dateDebut = null;
Expand All @@ -69,6 +69,9 @@ if (isNewArreteCadre) {
arreteCadre.value.departements.splice(depPiloteIndex, 1);
arreteCadre.value.departements.splice(0, 0, depPilote);
}
if(route.query.arretecadre) {
// Mettre l'id de l'arrêté abrogeant
}
}
}
if (mounted.value) {
Expand Down
2 changes: 1 addition & 1 deletion client/components/arreteCadre/form/usages.vue
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ defineExpose({
</div>
</DsfrTabContent>
<DsfrTabContent panel-id="tab-content-1" tab-id="tab-1" :asc="asc" :selected="selectedTabIndex === 1">
<UsageForm ref="usageFormRef" :loading="loading" :usage="usageToEdit" @createEdit="createEditUsage($event)" />
<UsageForm v-if="selectedTabIndex === 1" ref="usageFormRef" :loading="loading" :usage="usageToEdit" @createEdit="createEditUsage($event)" />
<DsfrButtonGroup :buttons="usageFormButtons" class="fr-mt-2w" align="right" inlineLayoutWhen="always" />
</DsfrTabContent>
</DsfrTabs>
Expand Down
1 change: 1 addition & 0 deletions client/components/arreteCadre/form/wrapper.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ const nextStep = async () => {
errors = usagesFormRef.value?.v$.$errors;
break;
}
console.log(errors);
if(errors && errors.length > 0) {
return;
}
Expand Down
3 changes: 3 additions & 0 deletions client/components/usage/arreteCadreForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,19 @@ const niveauxRestriction = [
attribute: 'descriptionVigilance',
name: 'Vigilance',
badgeType: 'info',
required: false,
},
{
attribute: 'descriptionAlerte',
name: 'Alerte',
badgeType: 'new',
required: false,
},
{
attribute: 'descriptionAlerteRenforcee',
name: 'Alerte renforcée',
badgeType: 'warning',
required: false,
},
{
attribute: 'descriptionCrise',
Expand Down
2 changes: 1 addition & 1 deletion client/components/usage/form.vue
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ const rules = computed(() => {
};
});
const v$ = useVuelidate(rules, props.usage);
const v$ = useVuelidate(rules, props.usage, { $scope: false });
const submitForm = async () => {
await v$.value.$validate();
Expand Down

0 comments on commit e9e10e2

Please sign in to comment.