Skip to content

Commit 572c2a6

Browse files
committed
feat(structures): making sms day mandatory
1 parent 52b70a6 commit 572c2a6

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

packages/frontend/src/app/modules/structures/components/structures-sms-form/structures-sms-form.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ <h1 class="title">Paramètres d'envoi de SMS pour votre structure</h1>
203203

204204
<div class="col-12 my-2">
205205
<fieldset>
206-
<legend class=" ">
206+
<legend class="required">
207207
Quel(s) jour(s) souhaitez-vous envoyer les SMS (2 jours
208208
par semaine maximum)
209209
</legend>

packages/frontend/src/app/modules/structures/components/structures-sms-form/structures-sms-form.component.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,11 @@ export class StructuresSmsFormComponent implements OnInit, OnDestroy {
125125
return;
126126
}
127127

128+
if (this.structureSmsForm.errors?.atLeastOneDay) {
129+
this.toastService.error("Veuillez sélectionner au moins un jour");
130+
return;
131+
}
132+
128133
if (this.structureSmsForm.invalid) {
129134
this.toastService.error("Veuillez vérifier le formulaire");
130135
return;
@@ -173,6 +178,14 @@ export class StructuresSmsFormComponent implements OnInit, OnDestroy {
173178
count++;
174179
}
175180
});
176-
return count <= 2 ? null : { moreThanTwoDays: true };
181+
if (count >= 2) {
182+
return { moreThanTwoDays: true };
183+
}
184+
185+
if (count === 0) {
186+
return { atLeastOneDay: true };
187+
}
188+
189+
return null;
177190
};
178191
}

0 commit comments

Comments
 (0)