display all on creation

This commit is contained in:
Tykayn 2021-05-03 16:10:13 +02:00 committed by tykayn
parent 1d8aeb2f54
commit d7eac8d56c
6 changed files with 76 additions and 57 deletions

View File

@ -1,7 +1,8 @@
<form [formGroup]="form"> <form [formGroup]="form" class="box">
<fieldset class="complete well"> <fieldset class="complete well">
<h2>{{ 'creation.advanced' | translate }}</h2> <h2>{{ 'creation.advanced' | translate }}</h2>
<label for="descr">Description (optionnel)</label> <label for="descr">Description (optionnel)</label>
<br />
<textarea <textarea
#description #description
matInput matInput
@ -23,41 +24,32 @@
<br /> <br />
<label for="slug"> <label for="custom_url">
Url personnalisée pour les participants Url personnalisée pour les participants
<i class="fa fa-close"></i> <i class="fa fa-close"></i>
</label> </label>
<br /> <br />
<span
>{{ urlPrefix }}
<strong>
{{ form.controls.custom_url.value }}
</strong>
</span>
<app-copy-text [textToCopy]="form.controls.custom_url.value"></app-copy-text>
<button <button
mat-button mat-button
*ngIf="form.controls.custom_url.value" *ngIf="form.controls.custom_url.value"
matSuffix matSuffix
mat-icon-button mat-icon-button
aria-label="Clear" aria-label="Clear"
(click)="slug.value = ''" (click)="form.patchValue({ custom_url: '' })"
></button> ></button>
<input #slug matInput id="slug" placeholder="Url" formControlName="slug" required /> <input #custom_url matInput id="custom_url" placeholder="Url" formControlName="custom_url" required />
<br /> <br />
<div appearance="outline" class="is-not-flex"> <div appearance="outline" class="is-not-flex">
<mat-label <mat-label
>Nombre de jours avant expiration de la possibilité de voter, après le sondage reste >Nombre de jours avant expiration de la possibilité de voter, après le sondage reste consultable
consultable</mat-label </mat-label>
>
<input <input
#expiresDaysDelay #expiresDaysDelay
id="expiresDaysDelay" id="expiresDaysDelay"
matInput matInput
type="number" type="number"
placeholder="Nombre de jours avant fin des votes" placeholder="Nombre de jours avant fin des votes"
formControlName="expiracyNumberOfDays" formControlName="expiresDaysDelay"
required required
/> />
<button <button
@ -71,30 +63,6 @@
<i class="fa fa-close"></i> <i class="fa fa-close"></i>
</button> </button>
</div> </div>
<div appearance="outline" class="is-not-flex">
<mat-label
>Nombre de jours avant archivage, après quoi le sondage n'est plus visible par le public</mat-label
>
<input
#archive
id="archive"
matInput
type="number"
placeholder="Nombre de jours avant archivage"
formControlName="archiveNumberOfDays"
required
/>
<button
mat-button
*ngIf="archive.value"
matSuffix
mat-icon-button
aria-label="Clear"
(click)="archive.value = ''"
>
<i class="fa fa-close"></i>
</button>
</div>
<mat-checkbox class="is-not-flex" formControlName="areResultsPublic"> <mat-checkbox class="is-not-flex" formControlName="areResultsPublic">
Les participants pourront consulter les résultats Les participants pourront consulter les résultats
</mat-checkbox> </mat-checkbox>
@ -119,7 +87,7 @@
/> />
<h3 class="title is-3"> <h3 class="title is-3">
<i class="fa fa-enveloppe"></i> <i class="fa fa-envelope-open"></i>
Notifications Notifications
</h3> </h3>
<mat-checkbox class="is-not-flex" formControlName="isOwnerNotifiedByEmailOnNewVote"> <mat-checkbox class="is-not-flex" formControlName="isOwnerNotifiedByEmailOnNewVote">
@ -128,19 +96,29 @@
<mat-checkbox class="is-not-flex" formControlName="isOwnerNotifiedByEmailOnNewComment"> <mat-checkbox class="is-not-flex" formControlName="isOwnerNotifiedByEmailOnNewComment">
Vous recevrez un mail à chaque nouveau commentaire Vous recevrez un mail à chaque nouveau commentaire
</mat-checkbox> </mat-checkbox>
<h3 class="title is-3">
<i class="fa fa-check-square"></i>
Réponses proposées
</h3>
<img class="image is-24x24 pull-right" src="assets/img/icon_voter_YES.svg" />
<img class="image is-24x24 pull-right" src="assets/img/icon_voter_MAYBE.svg" />
<img class="image is-24x24 pull-right" src="assets/img/icon_voter_NO.svg" />
<mat-checkbox class="is-not-flex" formControlName="isYesAnswerAvailable">
La réponse « oui » sera disponible
</mat-checkbox>
<mat-checkbox class="is-not-flex" formControlName="isMaybeAnswerAvailable"> <mat-checkbox class="is-not-flex" formControlName="isMaybeAnswerAvailable">
La réponse « peut-être » sera disponible La réponse « peut-être » sera disponible
</mat-checkbox> </mat-checkbox>
</fieldset> <mat-checkbox class="is-not-flex" formControlName="isNoAnswerAvailable">
La réponse « non » sera disponible
<fieldset>
<h2>
Fonctionnalités pas encore disponibles:
</h2>
<app-wip-todo></app-wip-todo>
<mat-checkbox class="is-not-flex" formControlName="isProtectedByPassword">
Spécifier un lien unique de vote à des participants définis
</mat-checkbox> </mat-checkbox>
<h3 class="title is-3">
<i class="fa fa-user-secret"></i>
Restrictions visiteurs
</h3>
<mat-checkbox class="is-not-flex" formControlName="allowComments"> <mat-checkbox class="is-not-flex" formControlName="allowComments">
Autoriser les commentaires Autoriser les commentaires
</mat-checkbox> </mat-checkbox>
@ -157,7 +135,29 @@
formControlName="maxCountOfAnswers" formControlName="maxCountOfAnswers"
required required
/> />
</fieldset>
<fieldset>
<h2 class="title is-2">
<i class="fa fa-wikidata"></i>
Fonctionnalités pas encore disponibles:
</h2>
<app-wip-todo></app-wip-todo>
<div>
<mat-checkbox class="is-not-flex" formControlName="isProtectedByPassword">
Spécifier un lien unique de vote à des participants définis
</mat-checkbox>
<p>
lister les email des participants et leur fournir un lien unique pour voter à chacun, au lieu d'un lien
avec une clé permettant de voter pour n'importe qui ayant le lien. Nécessite: évolution de la BDD et de
l'API
</p>
</div>
<mat-checkbox class="is-not-flex" formControlName="allowNewDateTime">
Permettre au public de proposer un créneau de vote supplémentaire
</mat-checkbox>
<mat-checkbox class="is-not-flex" formControlName="isZeroKnoledge"> <mat-checkbox class="is-not-flex" formControlName="isZeroKnoledge">
Les informations du sondage seront chiffrés en base de données Les informations du sondage seront chiffrés en base de données
</mat-checkbox> </mat-checkbox>

View File

@ -0,0 +1,3 @@
.title {
margin-top: 2em;
}

View File

@ -1,6 +1,7 @@
import { Component, Input, OnInit } from '@angular/core'; import { Component, Input, OnInit } from '@angular/core';
import { Poll } from '../../../../core/models/poll.model'; import { Poll } from '../../../../core/models/poll.model';
import { FormGroup } from '@angular/forms'; import { FormGroup } from '@angular/forms';
import { environment } from 'src/environments/environment';
@Component({ @Component({
selector: 'app-advanced-config', selector: 'app-advanced-config',
@ -9,6 +10,7 @@ import { FormGroup } from '@angular/forms';
}) })
export class AdvancedConfigComponent implements OnInit { export class AdvancedConfigComponent implements OnInit {
public urlPrefix = '/participation/'; public urlPrefix = '/participation/';
public environment = environment;
@Input() @Input()
public poll?: Poll; public poll?: Poll;
@Input() @Input()

View File

@ -29,12 +29,13 @@
Ce champ est requis Ce champ est requis
</div> </div>
<br />
<label for="creatorPseudo"> <label for="creatorPseudo">
<span> <span>
{{ 'creation.email' | translate }} {{ 'creation.email' | translate }}
</span> </span>
</label> </label>
<br />
<input <input
#creatorEmail #creatorEmail
matInput matInput

View File

@ -8,14 +8,18 @@
</h1> </h1>
</div> </div>
</header> </header>
<button class="btn is-success is-fixed-bottom" (click)="createPoll()" *ngIf="!environment.production">
<i class="fa fa-save"></i>
Enregistrer le sondage (sans vérifier)
</button>
<main class="columns"> <main class="columns">
<div class="column"> <div class="column">
<p class="label is-medium"> <p class="label is-medium">
{{ 'creation.want' | translate }} {{ 'creation.want' | translate }}
</p> </p>
<!-- <div class="step-choices" *ngIf="currentStep === 'base'">--> <!-- <div class="step-choices" *ngIf="currentStep === 'base'">-->
<!-- <app-kind-select [form]="form"></app-kind-select>--> <app-kind-select [form]="form"></app-kind-select>
<!-- <app-base-config [form]="form"></app-base-config>--> <app-base-config [form]="form"></app-base-config>
<!-- </div>--> <!-- </div>-->
<!-- <div class="step-choices" *ngIf="currentStep === 'choices'"> </div>--> <!-- <div class="step-choices" *ngIf="currentStep === 'choices'"> </div>-->
<app-date-select *ngIf="form.value && form.value.kind == 'date'" [form]="form"></app-date-select> <app-date-select *ngIf="form.value && form.value.kind == 'date'" [form]="form"></app-date-select>
@ -73,7 +77,7 @@
<i class="fa fa-save"></i> <i class="fa fa-save"></i>
Enregistrer le sondage (vérifier la validité) Enregistrer le sondage (vérifier la validité)
</button> </button>
<button class="btn is-success is-fixed-bottom" (click)="createPoll()"> <button class="btn is-success is-fixed-bottom" (click)="createPoll()" *ngIf="!environment.production">
<i class="fa fa-save"></i> <i class="fa fa-save"></i>
Enregistrer le sondage (sans vérifier) Enregistrer le sondage (sans vérifier)
</button> </button>

View File

@ -1,7 +1,6 @@
import { ChangeDetectorRef, Component, Inject, Input, OnInit } from '@angular/core'; import { ChangeDetectorRef, Component, Inject, Input, OnInit } from '@angular/core';
import { Poll } from '../../../core/models/poll.model'; import { Poll } from '../../../core/models/poll.model';
import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { UuidService } from '../../../core/services/uuid.service';
import { ApiService } from '../../../core/services/api.service'; import { ApiService } from '../../../core/services/api.service';
import { ToastService } from '../../../core/services/toast.service'; import { ToastService } from '../../../core/services/toast.service';
import { PollService } from '../../../core/services/poll.service'; import { PollService } from '../../../core/services/poll.service';
@ -9,7 +8,6 @@ import { DOCUMENT } from '@angular/common';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import { environment } from '../../../../environments/environment'; import { environment } from '../../../../environments/environment';
import { PollUtilitiesService } from '../../../core/services/poll.utilities.service'; import { PollUtilitiesService } from '../../../core/services/poll.utilities.service';
import { Subscription } from 'rxjs';
import { StorageService } from '../../../core/services/storage.service'; import { StorageService } from '../../../core/services/storage.service';
@Component({ @Component({
@ -22,10 +20,13 @@ export class FormComponent implements OnInit {
public poll?: Poll; public poll?: Poll;
public form: FormGroup; public form: FormGroup;
public advancedDisplayEnabled = false; public advancedDisplayEnabled = true;
public show_debug_data = false; public show_debug_data = false;
public currentStep = 'base'; public currentStep = 'base';
public steps = ['base', 'choices', 'advanced']; public steps = ['base', 'choices', 'advanced'];
public environment = environment;
constructor( constructor(
private fb: FormBuilder, private fb: FormBuilder,
private cd: ChangeDetectorRef, private cd: ChangeDetectorRef,
@ -79,9 +80,12 @@ export class FormComponent implements OnInit {
areResultsPublic: [true, [Validators.required]], areResultsPublic: [true, [Validators.required]],
whoCanChangeAnswers: ['everybody', [Validators.required]], whoCanChangeAnswers: ['everybody', [Validators.required]],
isProtectedByPassword: [false, [Validators.required]], isProtectedByPassword: [false, [Validators.required]],
allowNewDateTime: [false, [Validators.required]],
isOwnerNotifiedByEmailOnNewVote: [false, [Validators.required]], isOwnerNotifiedByEmailOnNewVote: [false, [Validators.required]],
isOwnerNotifiedByEmailOnNewComment: [false, [Validators.required]], isOwnerNotifiedByEmailOnNewComment: [false, [Validators.required]],
isYesAnswerAvailable: [false, [Validators.required]],
isMaybeAnswerAvailable: [false, [Validators.required]], isMaybeAnswerAvailable: [false, [Validators.required]],
isNoAnswerAvailable: [false, [Validators.required]],
isAboutDate: [true, [Validators.required]], isAboutDate: [true, [Validators.required]],
isZeroKnoledge: [false, [Validators.required]], isZeroKnoledge: [false, [Validators.required]],
expiresDaysDelay: [60, [Validators.required, Validators.min(1)]], expiresDaysDelay: [60, [Validators.required, Validators.min(1)]],
@ -125,11 +129,15 @@ export class FormComponent implements OnInit {
isProtectedByPassword: false, isProtectedByPassword: false,
isOwnerNotifiedByEmailOnNewVote: false, isOwnerNotifiedByEmailOnNewVote: false,
isOwnerNotifiedByEmailOnNewComment: false, isOwnerNotifiedByEmailOnNewComment: false,
isYesAnswerAvailable: true,
isMaybeAnswerAvailable: false, isMaybeAnswerAvailable: false,
isNoAnswerAvailable: false,
isZeroKnoledge: true,
areResultsPublic: true, areResultsPublic: true,
allowComments: true, allowComments: true,
expiresDaysDelay: 60, expiresDaysDelay: 60,
maxCountOfAnswers: 150, maxCountOfAnswers: 150,
allowNewDateTime: false,
comments: [], comments: [],
choices: [ choices: [
{ {
@ -149,6 +157,7 @@ export class FormComponent implements OnInit {
goPreviousStep() { goPreviousStep() {
alert('todo'); alert('todo');
} }
goNextStep() { goNextStep() {
console.log('this.steps', this.steps); console.log('this.steps', this.steps);
let indexCurrentStep = this.steps.indexOf(this.currentStep); let indexCurrentStep = this.steps.indexOf(this.currentStep);