patch kind of poll with patchvalue

This commit is contained in:
tykayn 2021-02-09 09:53:58 +01:00
parent 7140072ecc
commit 77cf4c6d04
3 changed files with 25 additions and 14 deletions

View File

@ -22,11 +22,10 @@
<p class="subtitle">
{{ 'creation.want' | translate }}
</p>
<!-- <app-kind-select [form]="form"></app-kind-select>-->
<app-date-select ng-if="form.value.isAboutDate" [form]="form"></app-date-select>
<!-- <app-text-select ng-if="!form.value.isAboutDate" [form]="form"></app-text-select>-->
<app-kind-select [form]="form"></app-kind-select>
<app-base-config [form]="form"></app-base-config>
<app-date-select ng-if="form.value.configuration.isAboutDate" [form]="form"></app-date-select>
<!-- <app-text-select ng-if="!form.value.isAboutDate" [form]="form"></app-text-select>-->
<button class="btn is-info" (click)="advancedDisplayEnabled = !advancedDisplayEnabled">
<i class="fa fa-save"></i>

View File

@ -3,8 +3,14 @@
<div class="column">
<button
class="btn-block btn"
[ngClass]="{ 'is-primary': form.controls.isAboutDate.value }"
(click)="form.controls.isAboutDate.setValue(true)"
[ngClass]="{ 'is-primary': form.value.configuration.isAboutDate }"
(click)="
form.patchValue({
configuration: {
isAboutDate: true
}
})
"
>
<i class="fa fa-calendar"></i>
{{ 'creation.kind.date' | translate }}
@ -13,8 +19,14 @@
<div class="column">
<button
class="btn-block btn btn-default"
[ngClass]="{ 'is-primary': !form.controls.isAboutDate.value }"
(click)="form.controls.isAboutDate.setValue(false)"
[ngClass]="{ 'is-primary': !form.value.configuration.isAboutDate }"
(click)="
form.patchValue({
configuration: {
isAboutDate: false
}
})
"
>
<i class="fa fa-stats"></i>
{{ 'creation.kind.classic' | translate }}

View File

@ -72,22 +72,22 @@
<i class="fa fa-close"></i>
</button>
</mat-form-field>
<mat-checkbox class="is-flex" formControlName="areResultsPublic">
<mat-checkbox class="is-flex" formControlName="configuration.areResultsPublic">
Les participants pourront consulter les résultats
</mat-checkbox>
<mat-checkbox class="is-flex" formControlName="isAboutDate">
<mat-checkbox class="is-flex" formControlName="configuration.isAboutDate">
Les choix possibles concerneront des dates
</mat-checkbox>
<mat-checkbox class="is-flex" formControlName="isProtectedByPassword">
<mat-checkbox class="is-flex" formControlName="configuration.isProtectedByPassword">
Le sondage sera protégé par un mot de passe
</mat-checkbox>
<mat-checkbox class="is-flex" formControlName="isOwnerNotifiedByEmailOnNewVote">
<mat-checkbox class="is-flex" formControlName="configuration.isOwnerNotifiedByEmailOnNewVote">
Vous recevrez un mail à chaque nouvelle participation
</mat-checkbox>
<mat-checkbox class="is-flex" formControlName="isOwnerNotifiedByEmailOnNewComment">
<mat-checkbox class="is-flex" formControlName="configuration.isOwnerNotifiedByEmailOnNewComment">
Vous recevrez un mail à chaque nouveau commentaire
</mat-checkbox>
<mat-checkbox class="is-flex" formControlName="isMaybeAnswerAvailable">
<mat-checkbox class="is-flex" formControlName="configuration.isMaybeAnswerAvailable">
La réponse « peut-être » sera disponible
</mat-checkbox>