harmonizing poll default properties with payload and advanced config
This commit is contained in:
parent
237984c040
commit
2a4219e149
|
@ -3,26 +3,32 @@ import { DateService } from '../services/date.service';
|
||||||
|
|
||||||
export class PollConfiguration {
|
export class PollConfiguration {
|
||||||
constructor(
|
constructor(
|
||||||
public isAboutDate: boolean = false,
|
public allowComments: boolean = true,
|
||||||
public isProtectedByPassword: boolean = false,
|
public areResultsPublic: boolean = true,
|
||||||
|
public dateCreated: Date = new Date(Date.now()),
|
||||||
public password: string = '',
|
public password: string = '',
|
||||||
|
public isAboutDate: boolean = false,
|
||||||
|
public isAllowingtoChangeOwnAnswers: boolean = true,
|
||||||
|
public isMaybeAnswerAvailable: boolean = false,
|
||||||
|
public isProtectedByPassword: boolean = false,
|
||||||
public isOwnerNotifiedByEmailOnNewVote: boolean = false,
|
public isOwnerNotifiedByEmailOnNewVote: boolean = false,
|
||||||
public isOwnerNotifiedByEmailOnNewComment: boolean = false,
|
public isOwnerNotifiedByEmailOnNewComment: boolean = false,
|
||||||
public isMaybeAnswerAvailable: boolean = false,
|
public isZeroKnoledge: boolean = true,
|
||||||
public areResultsPublic: boolean = true,
|
public hasSeveralHours: boolean = false,
|
||||||
public isAllowingtoChangeOwnAnswers: boolean = true,
|
public hasMaxCountOfAnswers: boolean = false,
|
||||||
public whoCanChangeAnswers: string = 'everybody',
|
public whoCanChangeAnswers: string = 'everybody',
|
||||||
public dateCreated: Date = new Date(Date.now()),
|
public maxCountOfAnswers: number = environment.poll.defaultConfig.maxCountOfAnswers,
|
||||||
public expiresDaysDelay: number = environment.poll.defaultConfig.expiracyInDays,
|
public expiresDaysDelay: number = environment.poll.defaultConfig.expiresDaysDelay,
|
||||||
public expiracyAfterLastModificationInDays: number = environment.poll.defaultConfig
|
public expiracyAfterLastModificationInDays: number = environment.poll.defaultConfig
|
||||||
.expiracyAfterLastModificationInDays,
|
.expiracyAfterLastModificationInDays,
|
||||||
public expires: Date = DateService.addDaysToDate(
|
// date after creation day when people will not be able to vote anymore
|
||||||
environment.poll.defaultConfig.expiracyInDays,
|
public expiracyDate: Date = DateService.addDaysToDate(
|
||||||
|
environment.poll.defaultConfig.expiresDaysDelay,
|
||||||
new Date(Date.now())
|
new Date(Date.now())
|
||||||
)
|
)
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
public static isArchived(configuration: PollConfiguration): boolean {
|
public static isArchived(configuration: PollConfiguration): boolean {
|
||||||
return configuration.expires ? DateService.isDateInPast(configuration.expires) : undefined;
|
return configuration.expiracyDate ? DateService.isDateInPast(configuration.expiracyDate) : undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,9 @@ export class Poll {
|
||||||
public creatorPseudo?: string,
|
public creatorPseudo?: string,
|
||||||
public creatorEmail?: string,
|
public creatorEmail?: string,
|
||||||
public isAboutDate?: boolean,
|
public isAboutDate?: boolean,
|
||||||
|
public isZeroKnoledge?: boolean,
|
||||||
|
public allowSeveralHours?: boolean,
|
||||||
|
public archiveNumberOfDays?: number,
|
||||||
public configuration: PollConfiguration = new PollConfiguration(),
|
public configuration: PollConfiguration = new PollConfiguration(),
|
||||||
public comments: Comment[] = [],
|
public comments: Comment[] = [],
|
||||||
public choices: Choice[] = [],
|
public choices: Choice[] = [],
|
||||||
|
|
|
@ -64,7 +64,7 @@ export class PollService implements Resolve<Poll> {
|
||||||
console.log('getAllAvailablePolls res', res);
|
console.log('getAllAvailablePolls res', res);
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log('getAllAvailablePolls e', e);
|
console.error('getAllAvailablePolls e', e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,8 +52,8 @@
|
||||||
consultable</mat-label
|
consultable</mat-label
|
||||||
>
|
>
|
||||||
<input
|
<input
|
||||||
#expiracy
|
#expiresDaysDelay
|
||||||
id="expiracy"
|
id="expiresDaysDelay"
|
||||||
matInput
|
matInput
|
||||||
type="number"
|
type="number"
|
||||||
placeholder="Nombre de jours avant fin des votes"
|
placeholder="Nombre de jours avant fin des votes"
|
||||||
|
@ -62,11 +62,11 @@
|
||||||
/>
|
/>
|
||||||
<button
|
<button
|
||||||
mat-button
|
mat-button
|
||||||
*ngIf="expiracy.value"
|
*ngIf="expiresDaysDelay.value"
|
||||||
matSuffix
|
matSuffix
|
||||||
mat-icon-button
|
mat-icon-button
|
||||||
aria-label="Clear"
|
aria-label="Clear"
|
||||||
(click)="expiracy.value = ''"
|
(click)="expiresDaysDelay.value = ''"
|
||||||
>
|
>
|
||||||
<i class="fa fa-close"></i>
|
<i class="fa fa-close"></i>
|
||||||
</button>
|
</button>
|
||||||
|
@ -149,8 +149,8 @@
|
||||||
</mat-checkbox>
|
</mat-checkbox>
|
||||||
<input
|
<input
|
||||||
*ngIf="form.value.hasMaxCountOfAnswers"
|
*ngIf="form.value.hasMaxCountOfAnswers"
|
||||||
#limitCount
|
#maxCountOfAnswers
|
||||||
id="limitCount"
|
id="maxCountOfAnswers"
|
||||||
matInput
|
matInput
|
||||||
type="number"
|
type="number"
|
||||||
placeholder="Nombre de réponses max"
|
placeholder="Nombre de réponses max"
|
||||||
|
|
|
@ -1,145 +1,146 @@
|
||||||
<div class="date-selection">
|
<div class="date-selection">
|
||||||
<form [formGroup]="form">
|
<!-- <form [formGroup]="form">-->
|
||||||
<!-- interval-->
|
<!-- interval-->
|
||||||
|
|
||||||
<!-- <section *ngIf="showDateInterval" class="date-interval form-row">-->
|
<!-- <section *ngIf="showDateInterval" class="date-interval form-row">-->
|
||||||
<!-- <button-->
|
<!-- <button-->
|
||||||
<!-- (click)="showDateInterval = !showDateInterval"-->
|
<!-- (click)="showDateInterval = !showDateInterval"-->
|
||||||
<!-- [ngClass]="{ active: showDateInterval }"-->
|
<!-- [ngClass]="{ active: showDateInterval }"-->
|
||||||
<!-- class="btn btn--primary"-->
|
<!-- class="btn btn--primary"-->
|
||||||
<!-- id="toggle_interval_button"-->
|
<!-- id="toggle_interval_button"-->
|
||||||
<!-- >-->
|
<!-- >-->
|
||||||
<!-- <i class="fa fa-clock-o" aria-hidden="true"></i>-->
|
<!-- <i class="fa fa-clock-o" aria-hidden="true"></i>-->
|
||||||
<!-- {{ 'dates.add_interval' | translate }}-->
|
<!-- {{ 'dates.add_interval' | translate }}-->
|
||||||
<!-- </button>-->
|
<!-- </button>-->
|
||||||
<!-- <h2>{{ 'dates.add_interval' | translate }}</h2>-->
|
<!-- <h2>{{ 'dates.add_interval' | translate }}</h2>-->
|
||||||
<!-- <div class="columns">-->
|
<!-- <div class="columns">-->
|
||||||
<!-- <div class="column">-->
|
<!-- <div class="column">-->
|
||||||
<!-- {{ 'dates.interval_propose' | translate }}-->
|
<!-- {{ 'dates.interval_propose' | translate }}-->
|
||||||
<!-- </div>-->
|
<!-- </div>-->
|
||||||
<!-- <div class="column">-->
|
<!-- <div class="column">-->
|
||||||
<!-- <label for="start_interval" class="hidden">start</label>-->
|
<!-- <label for="start_interval" class="hidden">start</label>-->
|
||||||
<!-- <input id="start_interval" (change)="countDays()" formControlName="startDateInterval" type="date" />-->
|
<!-- <input id="start_interval" (change)="countDays()" formControlName="startDateInterval" type="date" />-->
|
||||||
<!-- </div>-->
|
<!-- </div>-->
|
||||||
<!-- </div>-->
|
<!-- </div>-->
|
||||||
<!-- <div class="columns">-->
|
<!-- <div class="columns">-->
|
||||||
<!-- <div class="column">-->
|
<!-- <div class="column">-->
|
||||||
<!-- {{ 'dates.interval_span' | translate }}-->
|
<!-- {{ 'dates.interval_span' | translate }}-->
|
||||||
<!-- </div>-->
|
<!-- </div>-->
|
||||||
<!-- <div class="column">-->
|
<!-- <div class="column">-->
|
||||||
<!-- <label for="end_interval" class="hidden">end</label>-->
|
<!-- <label for="end_interval" class="hidden">end</label>-->
|
||||||
<!-- <input id="end_interval" formControlName="endDateInterval" type="date" />-->
|
<!-- <input id="end_interval" formControlName="endDateInterval" type="date" />-->
|
||||||
<!-- </div>-->
|
<!-- </div>-->
|
||||||
<!-- </div>-->
|
<!-- </div>-->
|
||||||
<!-- <button (click)="addIntervalOfDates()" class="btn btn-block btn--primary">-->
|
<!-- <button (click)="addIntervalOfDates()" class="btn btn-block btn--primary">-->
|
||||||
<!-- <i class="fa fa-plus" aria-hidden="true"></i>-->
|
<!-- <i class="fa fa-plus" aria-hidden="true"></i>-->
|
||||||
<!-- {{ 'dates.interval_button' | translate }}-->
|
<!-- {{ 'dates.interval_button' | translate }}-->
|
||||||
<!-- {{ intervalDays }}-->
|
<!-- {{ intervalDays }}-->
|
||||||
<!-- {{ 'dates.interval_button_dates' | translate }}-->
|
<!-- {{ 'dates.interval_button_dates' | translate }}-->
|
||||||
<!-- </button>-->
|
<!-- </button>-->
|
||||||
<!-- </section>-->
|
<!-- </section>-->
|
||||||
|
|
||||||
<div class="dates-list">
|
<!-- </form>-->
|
||||||
<div class="title">
|
<div class="dates-list">
|
||||||
<span class="count-dates">
|
<div class="title">
|
||||||
{{ timeList.length }}
|
<span class="count-dates">
|
||||||
</span>
|
{{ timeList.length }}
|
||||||
<span class="count-dates-txt">
|
|
||||||
{{ 'dates.count_time' | translate }}
|
|
||||||
(pour chaque jour)
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div class="actions">
|
|
||||||
<button
|
|
||||||
(click)="addTime()"
|
|
||||||
*ngIf="'false' === allowSeveralHours"
|
|
||||||
class="btn btn--primary"
|
|
||||||
id="add_time_button"
|
|
||||||
>
|
|
||||||
<i class="fa fa-plus" aria-hidden="true"></i>
|
|
||||||
{{ 'dates.add_time' | translate }}
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
(click)="removeAllTimes()"
|
|
||||||
*ngIf="'false' === allowSeveralHours"
|
|
||||||
class="btn btn--warning"
|
|
||||||
id="remove_time_button"
|
|
||||||
>
|
|
||||||
<i class="fa fa-trash" aria-hidden="true"></i>
|
|
||||||
Aucune plage horaire
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
(click)="resetTimes()"
|
|
||||||
*ngIf="'false' === allowSeveralHours"
|
|
||||||
class="btn btn--warning"
|
|
||||||
id="reset_time_button"
|
|
||||||
>
|
|
||||||
<i class="fa fa-refresh" aria-hidden="true"></i>
|
|
||||||
réinitialiser
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div *ngIf="'false' === allowSeveralHours" class="identical-dates">
|
|
||||||
<div cdkDropList class="example-list" (cdkDropListDropped)="drop($event)">
|
|
||||||
<div *ngFor="let time of timeList; index as id" class="time-choice" cdkDrag>
|
|
||||||
<label for="timeChoices_{{ id }}">
|
|
||||||
<i class="fa fa-clock-o" aria-hidden="true"></i>
|
|
||||||
</label>
|
|
||||||
<input
|
|
||||||
[(ngModel)]="time.literal"
|
|
||||||
name="timeChoices_{{ id }}"
|
|
||||||
type="text"
|
|
||||||
id="timeChoices_{{ id }}"
|
|
||||||
/>
|
|
||||||
<button (click)="time.timeList.splice(id, 1)" class="btn btn-warning">
|
|
||||||
<i class="fa fa-times" aria-hidden="true"></i>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<hr />
|
|
||||||
<span class="count-dates title">
|
|
||||||
{{ dateList.length }}
|
|
||||||
</span>
|
</span>
|
||||||
<span>
|
<span class="count-dates-txt">
|
||||||
{{ 'dates.count_dates' | translate }}
|
{{ 'dates.count_time' | translate }}
|
||||||
|
(pour chaque jour)
|
||||||
</span>
|
</span>
|
||||||
<button class="btn btn--primary" (click)="addChoice()">
|
</div>
|
||||||
{{ 'dates.add' | translate }}
|
<div class="actions">
|
||||||
|
<pre class="debug padded warning">
|
||||||
|
form.value.hasSeveralHours :
|
||||||
|
{{ form.value.hasSeveralHours | json }}
|
||||||
|
</pre
|
||||||
|
>
|
||||||
|
<button
|
||||||
|
(click)="addTime()"
|
||||||
|
*ngIf="!form.value.hasSeveralHours"
|
||||||
|
class="btn btn--primary"
|
||||||
|
id="add_time_button"
|
||||||
|
>
|
||||||
|
<i class="fa fa-plus" aria-hidden="true"></i>
|
||||||
|
{{ 'dates.add_time' | translate }}
|
||||||
</button>
|
</button>
|
||||||
<div *ngFor="let choice of dateList; index as id" class="date-choice">
|
<button
|
||||||
{{ id }})
|
(click)="removeAllTimes()"
|
||||||
<input
|
*ngIf="'false' === allowSeveralHours"
|
||||||
[(ngModel)]="choice.date_object"
|
class="btn btn--warning"
|
||||||
name="dateChoices_{{ id }}"
|
id="remove_time_button"
|
||||||
id="dateChoices_{{ id }}"
|
>
|
||||||
useValueAsDate
|
<i class="fa fa-trash" aria-hidden="true"></i>
|
||||||
type="date"
|
Aucune plage horaire
|
||||||
/>
|
</button>
|
||||||
<button (click)="dateList.splice(id, 1)" class="btn btn-warning">
|
<button
|
||||||
<i class="fa fa-times" aria-hidden="true"></i>
|
(click)="resetTimes()"
|
||||||
</button>
|
*ngIf="'false' === allowSeveralHours"
|
||||||
<button
|
class="btn btn--warning"
|
||||||
(click)="addTimeToDate(choice, id)"
|
id="reset_time_button"
|
||||||
*ngIf="'true' === allowSeveralHours"
|
>
|
||||||
class="btn btn--primary"
|
<i class="fa fa-refresh" aria-hidden="true"></i>
|
||||||
>
|
réinitialiser
|
||||||
{{ 'dates.add_time' | translate }}
|
</button>
|
||||||
</button>
|
</div>
|
||||||
<div *ngIf="'true' === allowSeveralHours" class="several-times">
|
|
||||||
<div *ngFor="let timeItem of choice.timeList; index as idTime" class="time-choice">
|
<!-- <div *ngIf="'false' === allowSeveralHours" class="identical-dates">-->
|
||||||
<input
|
<!-- <div cdkDropList class="example-list" (cdkDropListDropped)="drop($event)">-->
|
||||||
[(ngModel)]="timeItem.literal"
|
<!-- <div *ngFor="let time of timeList; index as id" class="time-choice" cdkDrag>-->
|
||||||
name="dateTime_{{ id }}_Choices_{{ idTime }}"
|
<!-- <label for="timeChoices_{{ id }}">-->
|
||||||
id="dateTime_{{ id }}_Choices_{{ idTime }}"
|
<!-- <i class="fa fa-clock-o" aria-hidden="true"></i>-->
|
||||||
type="text"
|
<!-- </label>-->
|
||||||
/>
|
<!-- <input-->
|
||||||
<button (click)="choice.timeList.splice(idTime, 1)" class="btn btn-warning">
|
<!-- [(ngModel)]="time.literal"-->
|
||||||
<i class="fa fa-times" aria-hidden="true"></i>
|
<!-- name="timeChoices_{{ id }}"-->
|
||||||
</button>
|
<!-- type="text"-->
|
||||||
</div>
|
<!-- id="timeChoices_{{ id }}"-->
|
||||||
|
<!-- />-->
|
||||||
|
<!-- <button (click)="time.timeList.splice(id, 1)" class="btn btn-warning">-->
|
||||||
|
<!-- <i class="fa fa-times" aria-hidden="true"></i>-->
|
||||||
|
<!-- </button>-->
|
||||||
|
<!-- </div>-->
|
||||||
|
<!-- </div>-->
|
||||||
|
<!-- </div>-->
|
||||||
|
<hr />
|
||||||
|
<span class="count-dates title">
|
||||||
|
{{ dateList.length }}
|
||||||
|
</span>
|
||||||
|
<span>
|
||||||
|
{{ 'dates.count_dates' | translate }}
|
||||||
|
</span>
|
||||||
|
<button class="btn btn--primary" (click)="addChoice()">
|
||||||
|
{{ 'dates.add' | translate }}
|
||||||
|
</button>
|
||||||
|
<div *ngFor="let choice of dateList; index as id" class="date-choice">
|
||||||
|
{{ id }})
|
||||||
|
<input
|
||||||
|
[(ngModel)]="choice.date_object"
|
||||||
|
name="dateChoices_{{ id }}"
|
||||||
|
id="dateChoices_{{ id }}"
|
||||||
|
useValueAsDate
|
||||||
|
type="date"
|
||||||
|
/>
|
||||||
|
<button (click)="dateList.splice(id, 1)" class="btn btn-warning">
|
||||||
|
<i class="fa fa-times" aria-hidden="true"></i>
|
||||||
|
</button>
|
||||||
|
<button (click)="addTimeToDate(choice, id)" *ngIf="'true' === allowSeveralHours" class="btn btn--primary">
|
||||||
|
{{ 'dates.add_time' | translate }}
|
||||||
|
</button>
|
||||||
|
<div *ngIf="'true' === allowSeveralHours" class="several-times">
|
||||||
|
<div *ngFor="let timeItem of choice.timeList; index as idTime" class="time-choice">
|
||||||
|
<input
|
||||||
|
[(ngModel)]="timeItem.literal"
|
||||||
|
name="dateTime_{{ id }}_Choices_{{ idTime }}"
|
||||||
|
id="dateTime_{{ id }}_Choices_{{ idTime }}"
|
||||||
|
type="text"
|
||||||
|
/>
|
||||||
|
<button (click)="choice.timeList.splice(idTime, 1)" class="btn btn-warning">
|
||||||
|
<i class="fa fa-times" aria-hidden="true"></i>
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,44 +1,11 @@
|
||||||
<div class="admin-form padded">
|
<div class="admin-form padded">
|
||||||
<form [formGroup]="form">
|
<form [formGroup]="form">
|
||||||
<div class="columns">
|
<header class="columns">
|
||||||
<div class="column">
|
<div class="column">
|
||||||
<h1>
|
<h1>
|
||||||
{{ 'creation.title' | translate }}
|
{{ 'creation.title' | translate }}
|
||||||
</h1>
|
</h1>
|
||||||
<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-base-config [form]="form"></app-base-config>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
<div class="column">
|
|
||||||
<pre class="debug padded warning">
|
|
||||||
form values :
|
|
||||||
{{ form.value | json }}
|
|
||||||
</pre
|
|
||||||
>
|
|
||||||
<pre class="debug padded warning">
|
|
||||||
poll initial values :
|
|
||||||
{{ poll | json }}
|
|
||||||
</pre
|
|
||||||
>
|
|
||||||
</div>
|
|
||||||
<!-- choix spécialement pour les dates-->
|
|
||||||
|
|
||||||
<button class="btn is-info" (click)="advancedDisplayEnabled = !advancedDisplayEnabled">
|
|
||||||
<i class="fa fa-save"></i>
|
|
||||||
{{ 'creation.advanced' | translate }}
|
|
||||||
</button>
|
|
||||||
<app-advanced-config [poll]="poll" [form]="form" *ngIf="advancedDisplayEnabled"></app-advanced-config>
|
|
||||||
|
|
||||||
<hr />
|
|
||||||
|
|
||||||
<div class="columns">
|
|
||||||
<div class="column"></div>
|
|
||||||
<div class="column">
|
<div class="column">
|
||||||
<button
|
<button
|
||||||
class="btn is-success"
|
class="btn is-success"
|
||||||
|
@ -49,9 +16,40 @@
|
||||||
Enregistrer le sondage
|
Enregistrer le sondage
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</header>
|
||||||
|
<main class="columns">
|
||||||
|
<div class="column">
|
||||||
|
<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-base-config [form]="form"></app-base-config>-->
|
||||||
|
|
||||||
|
<button class="btn is-info" (click)="advancedDisplayEnabled = !advancedDisplayEnabled">
|
||||||
|
<i class="fa fa-save"></i>
|
||||||
|
{{ 'creation.advanced' | translate }}
|
||||||
|
</button>
|
||||||
|
<app-advanced-config [poll]="poll" [form]="form" *ngIf="advancedDisplayEnabled"></app-advanced-config>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
<footer class="column">
|
||||||
|
<pre class="debug padded warning">
|
||||||
|
form values :
|
||||||
|
{{ form.value | json }}
|
||||||
|
</pre
|
||||||
|
>
|
||||||
|
<pre class="debug padded warning">
|
||||||
|
poll initial values :
|
||||||
|
{{ poll | json }}
|
||||||
|
</pre
|
||||||
|
>
|
||||||
|
</footer>
|
||||||
|
<hr />
|
||||||
<div class="validation">
|
<div class="validation">
|
||||||
<div class="has-background-danger" *ngIf="!form.valid">
|
<div class="has-background-danger" *ngIf="!form.valid && form.touched">
|
||||||
le formulaire est invalide
|
le formulaire est invalide
|
||||||
<pre>
|
<pre>
|
||||||
{{ form.errors | json }}
|
{{ form.errors | json }}
|
||||||
|
|
|
@ -20,7 +20,7 @@ export class FormComponent implements OnInit {
|
||||||
public poll?: Poll;
|
public poll?: Poll;
|
||||||
public form: FormGroup;
|
public form: FormGroup;
|
||||||
|
|
||||||
public advancedDisplayEnabled = true;
|
public advancedDisplayEnabled = false;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private fb: FormBuilder,
|
private fb: FormBuilder,
|
||||||
|
@ -53,10 +53,11 @@ export class FormComponent implements OnInit {
|
||||||
whoModifiesAnswers: ['', [Validators.required]],
|
whoModifiesAnswers: ['', [Validators.required]],
|
||||||
whoCanChangeAnswers: ['', [Validators.required]],
|
whoCanChangeAnswers: ['', [Validators.required]],
|
||||||
isAboutDate: [true, [Validators.required]],
|
isAboutDate: [true, [Validators.required]],
|
||||||
|
isProtectedByPassword: [false, [Validators.required]],
|
||||||
startDateInterval: ['', [Validators.required]],
|
startDateInterval: ['', [Validators.required]],
|
||||||
endDateInterval: ['', [Validators.required]],
|
endDateInterval: ['', [Validators.required]],
|
||||||
isProtectedByPassword: [false, [Validators.required]],
|
hasMaxCountOfAnswers: [true, [Validators.required, Validators.min(1)]],
|
||||||
hasMaxCountOfAnswers: [true, [Validators.required]],
|
hasSeveralHours: [false, [Validators.required]],
|
||||||
allowComments: [true, [Validators.required]],
|
allowComments: [true, [Validators.required]],
|
||||||
maxCountOfAnswers: [150, [Validators.required]],
|
maxCountOfAnswers: [150, [Validators.required]],
|
||||||
isOwnerNotifiedByEmailOnNewVote: [false, [Validators.required]],
|
isOwnerNotifiedByEmailOnNewVote: [false, [Validators.required]],
|
||||||
|
@ -74,7 +75,7 @@ export class FormComponent implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* add example values to the form
|
* add example values to the form, overrides defaults of PollConfiguration
|
||||||
*/
|
*/
|
||||||
setDemoValues(): void {
|
setDemoValues(): void {
|
||||||
this.form.patchValue({
|
this.form.patchValue({
|
||||||
|
@ -84,6 +85,7 @@ export class FormComponent implements OnInit {
|
||||||
creatorPseudo: 'Chuck Norris',
|
creatorPseudo: 'Chuck Norris',
|
||||||
creatorEmail: 'chucknorris@example.com',
|
creatorEmail: 'chucknorris@example.com',
|
||||||
isAboutDate: true,
|
isAboutDate: true,
|
||||||
|
hasSeveralHours: true,
|
||||||
configuration: {
|
configuration: {
|
||||||
whoModifiesAnswers: 'everybody',
|
whoModifiesAnswers: 'everybody',
|
||||||
whoCanChangeAnswers: 'everybody',
|
whoCanChangeAnswers: 'everybody',
|
||||||
|
|
|
@ -50,7 +50,7 @@ export class StepperComponent implements OnInit {
|
||||||
],
|
],
|
||||||
areResultsPublic: [this.poll ? this.poll.configuration.areResultsPublic : true, [Validators.required]],
|
areResultsPublic: [this.poll ? this.poll.configuration.areResultsPublic : true, [Validators.required]],
|
||||||
expiracyNumberOfDays: [
|
expiracyNumberOfDays: [
|
||||||
this.poll ? DateService.diffInDays(new Date(), this.poll.configuration.expires) : 60,
|
this.poll ? DateService.diffInDays(new Date(), this.poll.configuration.expiracyDate) : 60,
|
||||||
[Validators.required],
|
[Validators.required],
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
|
@ -39,7 +39,7 @@ export const environment = {
|
||||||
},
|
},
|
||||||
poll: {
|
poll: {
|
||||||
defaultConfig: {
|
defaultConfig: {
|
||||||
expiracyInDays: 60,
|
expiresDaysDelay: 60,
|
||||||
expiracyAfterLastModificationInDays: 180,
|
expiracyAfterLastModificationInDays: 180,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -54,7 +54,8 @@ export const environment = {
|
||||||
},
|
},
|
||||||
poll: {
|
poll: {
|
||||||
defaultConfig: {
|
defaultConfig: {
|
||||||
expiracyInDays: 60,
|
maxCountOfAnswers: 150,
|
||||||
|
expiresDaysDelay: 60,
|
||||||
expiracyAfterLastModificationInDays: 180,
|
expiracyAfterLastModificationInDays: 180,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue