validation constraints on steps

This commit is contained in:
Tykayn 2022-02-14 11:13:49 +01:00 committed by tykayn
parent c52153770d
commit aa9f8ff9be
4 changed files with 5 additions and 0 deletions

View File

@ -84,6 +84,7 @@
<app-nav-steps <app-nav-steps
[display_previous_button]="false" [display_previous_button]="false"
[display_next_button]="true" [display_next_button]="true"
[next_is_disabled]="!pollService.form.value.title"
[next_step_number]="pollService.step_current + 1" [next_step_number]="pollService.step_current + 1"
[previous_step_number]="pollService.step_current - 1" [previous_step_number]="pollService.step_current - 1"
></app-nav-steps> ></app-nav-steps>

View File

@ -25,4 +25,5 @@
<app-nav-steps <app-nav-steps
[next_step_number]="pollService.step_current + 1" [next_step_number]="pollService.step_current + 1"
[previous_step_number]="pollService.step_current - 1" [previous_step_number]="pollService.step_current - 1"
[next_is_disabled]="!pollService.form.value.creatorEmail || !pollService.form.value.creatorPseudo"
></app-nav-steps> ></app-nav-steps>

View File

@ -12,6 +12,7 @@
<button <button
*ngIf="display_next_button" *ngIf="display_next_button"
class="button-next pull-right" class="button-next pull-right"
[disabled]="next_is_disabled"
[attr.aria-label]="(is_finish_step ? 'nav.save' : 'nav.next') | translate" [attr.aria-label]="(is_finish_step ? 'nav.save' : 'nav.next') | translate"
[ngClass]="{ 'is-finish': is_finish_step, 'is-primary': !is_finish_step }" [ngClass]="{ 'is-finish': is_finish_step, 'is-primary': !is_finish_step }"
[routerLink]="['/administration/step/' + next_step_number]" [routerLink]="['/administration/step/' + next_step_number]"

View File

@ -23,6 +23,8 @@ export class NavStepsComponent implements OnInit {
*/ */
@Input() @Input()
actionBeforeNextStep: Function; actionBeforeNextStep: Function;
@Input()
next_is_disabled: any = false;
constructor(private router: Router, public pollService: PollService) {} constructor(private router: Router, public pollService: PollService) {}