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"> <p class="subtitle">
{{ 'creation.want' | translate }} {{ 'creation.want' | translate }}
</p> </p>
<!-- <app-kind-select [form]="form"></app-kind-select>--> <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-base-config [form]="form"></app-base-config> <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"> <button class="btn is-info" (click)="advancedDisplayEnabled = !advancedDisplayEnabled">
<i class="fa fa-save"></i> <i class="fa fa-save"></i>

View File

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

View File

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