diff --git a/src/app/core/components/header/header.component.html b/src/app/core/components/header/header.component.html index 41034276..86fa1fe5 100644 --- a/src/app/core/components/header/header.component.html +++ b/src/app/core/components/header/header.component.html @@ -6,11 +6,6 @@ {{ appTitle }} - - - (dev) - -
- menu mobile + menu mobile --- + + +
diff --git a/src/app/core/components/sibebar/navigation/navigation.component.html b/src/app/core/components/sibebar/navigation/navigation.component.html index fa4f467a..68a74da5 100644 --- a/src/app/core/components/sibebar/navigation/navigation.component.html +++ b/src/app/core/components/sibebar/navigation/navigation.component.html @@ -5,10 +5,10 @@
- « {{ poll.slug }} » + « {{ poll.custom_url }} » diff --git a/src/app/core/core.module.ts b/src/app/core/core.module.ts index 34d27688..d66183ee 100644 --- a/src/app/core/core.module.ts +++ b/src/app/core/core.module.ts @@ -1,6 +1,6 @@ import { CommonModule } from '@angular/common'; import { NgModule, Optional, SkipSelf } from '@angular/core'; -import { FormsModule } from '@angular/forms'; +import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { RouterModule } from '@angular/router'; import { TranslateModule } from '@ngx-translate/core'; @@ -14,7 +14,7 @@ import { SharedModule } from '../shared/shared.module'; @NgModule({ declarations: [FooterComponent, HeaderComponent, HomeComponent, LogoComponent, NavigationComponent], - imports: [CommonModule, FormsModule, RouterModule, TranslateModule, SharedModule], + imports: [CommonModule, FormsModule, ReactiveFormsModule, RouterModule, TranslateModule, SharedModule], exports: [HeaderComponent, FooterComponent, NavigationComponent, LogoComponent], }) export class CoreModule { diff --git a/src/app/core/services/poll.service.ts b/src/app/core/services/poll.service.ts index d597e52d..5c9eda45 100644 --- a/src/app/core/services/poll.service.ts +++ b/src/app/core/services/poll.service.ts @@ -1,5 +1,5 @@ -import { Injectable } from '@angular/core'; -import { ActivatedRouteSnapshot, Resolve, Router, RouterStateSnapshot } from '@angular/router'; +import { ChangeDetectorRef, Inject, Injectable } from '@angular/core'; +import { ActivatedRoute, ActivatedRouteSnapshot, Resolve, Router, RouterStateSnapshot } from '@angular/router'; import { BehaviorSubject, Observable, Subscription } from 'rxjs'; import { Answer } from '../enums/answer.enum'; @@ -12,6 +12,10 @@ import { UserService } from './user.service'; import { UuidService } from './uuid.service'; import { HttpClient } from '@angular/common/http'; import { environment } from '../../../environments/environment'; +import { FormArray, FormBuilder, FormGroup, Validators } from '@angular/forms'; +import { DateChoice, defaultTimeOfDay, otherDefaultDates } from '../../features/old-stuff/config/defaultConfigs'; +import { DateUtilities } from '../../features/old-stuff/config/DateUtilities'; +import { DOCUMENT } from '@angular/common'; @Injectable({ providedIn: 'root', @@ -19,6 +23,23 @@ import { environment } from '../../../environments/environment'; export class PollService implements Resolve { private _poll: BehaviorSubject = new BehaviorSubject(undefined); public readonly poll: Observable = this._poll.asObservable(); + public form: FormGroup; + public startDateInterval: string; + public endDateInterval: string; + public intervalDays: any; + public intervalDaysDefault = 7; + public dateList: DateChoice[] = otherDefaultDates; // sets of days as strings, config to set identical time for days in a special days poll + public timeList: any = defaultTimeOfDay; // ranges of time expressed as strings + public previousRouteName: string = '/administration'; + public nextRouteName: string = '/administration/step/2'; + public step_current: number = 1; + public step_max: number = 5; + public round: Function; + public urlPrefix: string = window.location.origin + '/participation/'; + public advancedDisplayEnabled = false; + public showDateInterval = false; + public allowSeveralHours = false; + public richTextMode = false; constructor( private http: HttpClient, @@ -26,8 +47,78 @@ export class PollService implements Resolve { private apiService: ApiService, private userService: UserService, private uuidService: UuidService, - private toastService: ToastService - ) {} + private toastService: ToastService, + public dateUtilities: DateUtilities, + public route: ActivatedRoute, + @Inject(DOCUMENT) private document: any, + private fb: FormBuilder + ) { + this.createFormGroup(); + if (environment.poll.autoFillDemo) { + this.setDemoValues(); + } + } + + /** + * add example values to the form + */ + setDemoValues(): void { + this.addChoice('orange'); + this.addChoice('raisin'); + this.addChoice('abricot'); + + this.form.patchValue({ + title: 'mon titre', + description: 'répondez SVP <3 ! *-* ', + custom_url: this.uuidService.getUUID(), + creatorPseudo: 'Chuck Norris', + creatorEmail: 'chucknorris@example.com', + isAboutDate: true, + whoModifiesAnswers: 'everybody', + whoCanChangeAnswers: 'everybody', + isProtectedByPassword: false, + isOwnerNotifiedByEmailOnNewVote: false, + isOwnerNotifiedByEmailOnNewComment: false, + isMaybeAnswerAvailable: false, + richTextMode: false, + areResultsPublic: true, + expiracyNumberOfDays: 60, + }); + this.automaticSlug(); + } + + /** + * set the poll slug from other data of the poll + */ + automaticSlug() { + this.form.patchValue({ custom_url: this.makeSlug(this.form) }); + } + + public createFormGroup() { + let form = this.fb.group({ + title: ['', [Validators.required, Validators.minLength(12)]], + creatorPseudo: ['', [Validators.required]], + created_at: [new Date(), [Validators.required]], + creatorEmail: ['', [Validators.required]], + custom_url: [this.uuidService.getUUID(), [Validators.required]], + description: ['', [Validators.required]], + choices: new FormArray([]), + whoModifiesAnswers: ['', [Validators.required]], + whoCanChangeAnswers: ['', [Validators.required]], + isAboutDate: [true, [Validators.required]], + startDateInterval: ['', [Validators.required]], + endDateInterval: ['', [Validators.required]], + isProtectedByPassword: [false, [Validators.required]], + isOwnerNotifiedByEmailOnNewVote: [false, [Validators.required]], + isOwnerNotifiedByEmailOnNewComment: [false, [Validators.required]], + isMaybeAnswerAvailable: [false, [Validators.required]], + areResultsPublic: [true, [Validators.required]], + richTextMode: [false, [Validators.required]], + expiracyNumberOfDays: [60, [Validators.required, Validators.min(0)]], + }); + this.form = form; + return form; + } /** * auto fetch a poll when route is looking for one in the administration pattern @@ -82,21 +173,217 @@ export class PollService implements Resolve { } /** - * make a uniq slug for the current poll creation - * @param config + * add all the dates between the start and end dates in the interval section */ - makeSlug(config: Poll): string { + addIntervalOfDates(): void { + const newIntervalArray = this.dateUtilities.getDatesInRange( + this.dateUtilities.parseInputDateToDateObject(this.startDateInterval), + this.dateUtilities.parseInputDateToDateObject(this.endDateInterval), + 1 + ); + + const converted = []; + newIntervalArray.forEach((element) => { + converted.push({ + literal: element.literal, + date_object: element.date_object, + timeList: [], + }); + }); + this.dateList = [...new Set(converted)]; + // add only dates that are not already present with a Set of unique items + console.log('this.dateList', this.dateList); + this.showDateInterval = false; + + this.form.patchValue({ choices: this.dateList }); + + this.toastService.display(`les dates ont été ajoutées aux réponses possibles.`); + } + + /** + * handle keyboard shortcuts + * @param $event + * @param choice_number + */ + keyOnChoice($event: KeyboardEvent, choice_number: number): void { + $event.preventDefault(); + + console.log('this.choices.length', this.choices.length); + console.log('choice_number', choice_number); + const lastChoice = this.choices.length - 1 === choice_number; + // reset field with Ctrl + D + // add a field with Ctrl + N + // go to previous choice with arrow up + // go to next choice with arrow down + console.log('$event', $event); + + if ($event.key == 'ArrowUp' && choice_number > 0) { + this.focusOnChoice(choice_number - 1); + } + if ($event.key == 'ArrowDown') { + // add a field if we are on the last choice + if (lastChoice) { + this.addChoice(); + this.toastService.display('choix ajouté par raccourci "flèche bas"'); + } else { + this.focusOnChoice(choice_number + 1); + } + } + if ($event.ctrlKey && $event.key == 'Backspace') { + this.deleteChoiceField(choice_number); + this.toastService.display('choix supprimé par raccourci "Ctrl + retour"'); + this.focusOnChoice(Math.min(choice_number - 1, 0)); + } + if ($event.ctrlKey && $event.key == 'Enter') { + // go to other fields + const elem = this.document.querySelector('#creatorEmail'); + if (elem) { + elem.focus(); + } + } + } + + /** + * change time spans + */ + addTime() { + this.timeList.push({ + literal: '', + timeList: [], + date_object: new Date(), + }); + } + + removeAllTimes() { + this.timeList = []; + } + + resetTimes() { + this.timeList = otherDefaultDates; + } + + /** + * add a time period to a specific date choice, + * focus on the new input + * @param config + * @param id + */ + addTimeToDate(config: any, id: number) { + this.timeList.push({ + literal: '', + timeList: [], + date_object: new Date(), + }); + const selector = '[ng-reflect-choice_label="dateTime_' + id + '_Choices_' + (this.timeList.length - 1) + '"]'; + const elem = this.document.querySelector(selector); + if (elem) { + elem.focus(); + } + } + + public createPoll(): void { + console.log('this.form', this.form); + const newpoll = this.newPollFromForm(this.form); + console.log('newpoll', newpoll); + this.apiService.createPoll(newpoll); + } + + /** + * default interval of dates proposed is from today to 7 days more + */ + setDefaultDatesForInterval(): void { + const dateCurrent = new Date(); + const dateJson = dateCurrent.toISOString(); + this.startDateInterval = dateJson.substring(0, 10); + this.endDateInterval = this.dateUtilities + .addDaysToDate(this.intervalDaysDefault, dateCurrent) + .toISOString() + .substring(0, 10); + this.form.patchValue({ + startDateInterval: this.startDateInterval, + endDateInterval: this.endDateInterval, + }); + this.countDays(); + } + + askInitFormDefault(): void { + this.initFormDefault(false); + this.toastService.display('formulaire réinitialisé'); + } + + countDays(): void { + this.intervalDays = this.dateUtilities.countDays( + this.dateUtilities.parseInputDateToDateObject(this.startDateInterval), + this.dateUtilities.parseInputDateToDateObject(this.endDateInterval) + ); + } + + focusOnChoice(index): void { + const selector = '#choice_label_' + index; + const elem = this.document.querySelector(selector); + if (elem) { + elem.focus(); + } + } + + deleteChoiceField(index: number): void { + if (this.choices.length !== 1) { + this.choices.removeAt(index); + } + } + + initFormDefault(showDemoValues = true): void { + this.form = this.createFormGroup(); + console.log('this.form ', this.form); + this.setDefaultDatesForInterval(); + + if (showDemoValues) { + this.setDemoValues(); + } + } + + get choices(): FormArray { + return this.form.get('choices') as FormArray; + } + + reinitChoices(): void { + this.choices.setValue([]); + } + + addChoice(optionalLabel = ''): void { + const newControlGroup = this.fb.group({ + label: this.fb.control('', [Validators.required]), + imageUrl: ['', [Validators.required]], + }); + + if (optionalLabel) { + newControlGroup.patchValue({ + label: optionalLabel, + imageUrl: 'mon url', + }); + } + this.choices.push(newControlGroup); + console.log('this.choices.length', this.choices.length); + + this.focusOnChoice(this.choices.length - 1); + } + + /** + * make a uniq slug for the current poll creation + * @param form + */ + makeSlug(form: FormGroup): string { let str = ''; str = - config.configuration.dateCreated.getFullYear() + + form.value.created_at.getFullYear() + '_' + - (config.configuration.dateCreated.getMonth() + 1) + + (form.value.created_at.getMonth() + 1) + '_' + - config.configuration.dateCreated.getDate() + + form.value.created_at.getDate() + '_' + - config.owner.pseudo + + form.value.creatorPseudo + '_' + - config.title; + form.value.title; str = str.replace(/^\s+|\s+$/g, ''); // trim str = str.toLowerCase(); @@ -212,7 +499,7 @@ export class PollService implements Resolve { // access visibility: newpoll.configuration.areResultsPublic, // visible to one with the link: voteChoices: newpoll.configuration.isMaybeAnswerAvailable ? 'yes, maybe, no' : 'yes', // possible answers to a vote choice: only "yes", "yes, maybe, no" - creationDate: new Date(), + created_at: new Date(), expirationDate: '', // expiracy date voteStackId: null, // id of the vote stack to update pollId: null, // id of the current poll when created. data given by the backend api diff --git a/src/app/features/administration/form/form.component.html b/src/app/features/administration/form/form.component.html index 2844b1f8..1b609363 100644 --- a/src/app/features/administration/form/form.component.html +++ b/src/app/features/administration/form/form.component.html @@ -3,22 +3,32 @@

{{ 'creation.title' | translate }}

- +
- +
-
- + +
diff --git a/src/app/features/administration/form/form.component.ts b/src/app/features/administration/form/form.component.ts index 2f80c69c..f9085508 100644 --- a/src/app/features/administration/form/form.component.ts +++ b/src/app/features/administration/form/form.component.ts @@ -9,7 +9,7 @@ import { DateUtilities } from '../../old-stuff/config/DateUtilities'; import { DOCUMENT } from '@angular/common'; import { DateChoice, defaultTimeOfDay, otherDefaultDates } from '../../old-stuff/config/defaultConfigs'; import { CdkDragDrop, moveItemInArray } from '@angular/cdk/drag-drop'; -import { Router } from '@angular/router'; +import { ActivatedRoute, Router } from '@angular/router'; @Component({ selector: 'app-admin-form', @@ -21,23 +21,6 @@ export class FormComponent implements OnInit { public poll?: Poll; public form: FormGroup; - public urlPrefix: string = window.location.origin + '/participation/'; - public advancedDisplayEnabled = false; - public showDateInterval = false; - public allowSeveralHours = false; - public richTextMode = false; - startDateInterval: string; - endDateInterval: string; - intervalDays: any; - intervalDaysDefault = 7; - dateList: DateChoice[] = otherDefaultDates; // sets of days as strings, config to set identical time for days in a special days poll - timeList: any = defaultTimeOfDay; // ranges of time expressed as strings - step_current: number = 1; - step_max: number = 5; - public round: Function; - private nextRouteName: string = '/administration/step/2'; - previousRouteName: string = '/administration'; - constructor( private fb: FormBuilder, private cd: ChangeDetectorRef, @@ -46,273 +29,16 @@ export class FormComponent implements OnInit { private pollService: PollService, private router: Router, public dateUtilities: DateUtilities, + public route: ActivatedRoute, private apiService: ApiService, @Inject(DOCUMENT) private document: any - ) {} - drop(event: CdkDragDrop) { - // moveItemInArray(this.choices, event.previousIndex, event.currentIndex); - } - get choices(): FormArray { - return this.form.get('choices') as FormArray; + ) { + this.form = this.pollService.form; } ngOnInit(): void { - this.initFormDefault(); - const pollsAvailable = this.pollService.getAllAvailablePolls(); - console.log('pollsAvailable', pollsAvailable); + this.pollService.askInitFormDefault(); } - public createPoll(): void { - console.log('this.form', this.form); - const newpoll = this.pollService.newPollFromForm(this.form); - console.log('newpoll', newpoll); - this.apiService.createPoll(newpoll); - } - - addChoice(optionalLabel = ''): void { - const newControlGroup = this.fb.group({ - label: this.fb.control('', [Validators.required]), - imageUrl: ['', [Validators.required]], - }); - - if (optionalLabel) { - newControlGroup.patchValue({ - label: optionalLabel, - imageUrl: 'mon url', - }); - } - this.choices.push(newControlGroup); - this.cd.detectChanges(); - console.log('this.choices.length', this.choices.length); - - this.focusOnChoice(this.choices.length - 1); - } - - focusOnChoice(index): void { - const selector = '#choice_label_' + index; - const elem = this.document.querySelector(selector); - if (elem) { - elem.focus(); - } - } - - deleteChoiceField(index: number): void { - if (this.choices.length !== 1) { - this.choices.removeAt(index); - } - } - - reinitChoices(): void { - this.choices.setValue([]); - } - - initFormDefault(showDemoValues = true): void { - this.form = this.fb.group({ - title: ['', [Validators.required, Validators.minLength(12)]], - creatorPseudo: ['', [Validators.required]], - creatorEmail: ['', [Validators.required]], - slug: [this.uuidService.getUUID(), [Validators.required]], - description: ['', [Validators.required]], - choices: new FormArray([]), - whoModifiesAnswers: ['', [Validators.required]], - whoCanChangeAnswers: ['', [Validators.required]], - isAboutDate: [true, [Validators.required]], - startDateInterval: ['', [Validators.required]], - endDateInterval: ['', [Validators.required]], - isProtectedByPassword: [false, [Validators.required]], - isOwnerNotifiedByEmailOnNewVote: [false, [Validators.required]], - isOwnerNotifiedByEmailOnNewComment: [false, [Validators.required]], - isMaybeAnswerAvailable: [false, [Validators.required]], - areResultsPublic: [true, [Validators.required]], - richTextMode: [false, [Validators.required]], - expiracyNumberOfDays: [60, [Validators.required, Validators.min(0)]], - }); - console.log('this.form ', this.form); - this.setDefaultDatesForInterval(); - - if (showDemoValues) { - this.setDemoValues(); - } - } - - /** - * default interval of dates proposed is from today to 7 days more - */ - setDefaultDatesForInterval(): void { - const dateCurrent = new Date(); - const dateJson = dateCurrent.toISOString(); - this.startDateInterval = dateJson.substring(0, 10); - this.endDateInterval = this.dateUtilities - .addDaysToDate(this.intervalDaysDefault, dateCurrent) - .toISOString() - .substring(0, 10); - this.form.patchValue({ - startDateInterval: this.startDateInterval, - endDateInterval: this.endDateInterval, - }); - this.countDays(); - } - - /** - * add example values to the form - */ - setDemoValues(): void { - this.addChoice('orange'); - this.addChoice('raisin'); - this.addChoice('abricot'); - - this.form.patchValue({ - title: 'mon titre', - description: 'répondez SVP <3 ! *-* ', - slug: this.uuidService.getUUID(), - creatorPseudo: 'Chuck Norris', - creatorEmail: 'chucknorris@example.com', - isAboutDate: true, - whoModifiesAnswers: 'everybody', - whoCanChangeAnswers: 'everybody', - isProtectedByPassword: false, - isOwnerNotifiedByEmailOnNewVote: false, - isOwnerNotifiedByEmailOnNewComment: false, - isMaybeAnswerAvailable: false, - richTextMode: false, - areResultsPublic: true, - expiracyNumberOfDays: 60, - }); - this.automaticSlug(); - } - - askInitFormDefault(): void { - this.initFormDefault(false); - this.toastService.display('formulaire réinitialisé'); - } - - countDays(): void { - this.intervalDays = this.dateUtilities.countDays( - this.dateUtilities.parseInputDateToDateObject(this.startDateInterval), - this.dateUtilities.parseInputDateToDateObject(this.endDateInterval) - ); - this.cd.detectChanges(); - } - - /** - * add all the dates between the start and end dates in the interval section - */ - addIntervalOfDates(): void { - const newIntervalArray = this.dateUtilities.getDatesInRange( - this.dateUtilities.parseInputDateToDateObject(this.startDateInterval), - this.dateUtilities.parseInputDateToDateObject(this.endDateInterval), - 1 - ); - - const converted = []; - newIntervalArray.forEach((element) => { - converted.push({ - literal: element.literal, - date_object: element.date_object, - timeList: [], - }); - }); - this.dateList = [...new Set(converted)]; - // add only dates that are not already present with a Set of unique items - console.log('this.dateList', this.dateList); - this.showDateInterval = false; - - this.form.patchValue({ choices: this.dateList }); - - this.toastService.display(`les dates ont été ajoutées aux réponses possibles.`); - } - - /** - * handle keyboard shortcuts - * @param $event - * @param choice_number - */ - keyOnChoice($event: KeyboardEvent, choice_number: number): void { - $event.preventDefault(); - - console.log('this.choices.length', this.choices.length); - console.log('choice_number', choice_number); - const lastChoice = this.choices.length - 1 === choice_number; - // reset field with Ctrl + D - // add a field with Ctrl + N - // go to previous choice with arrow up - // go to next choice with arrow down - console.log('$event', $event); - - if ($event.key == 'ArrowUp' && choice_number > 0) { - this.focusOnChoice(choice_number - 1); - } - if ($event.key == 'ArrowDown') { - // add a field if we are on the last choice - if (lastChoice) { - this.addChoice(); - this.toastService.display('choix ajouté par raccourci "flèche bas"'); - } else { - this.focusOnChoice(choice_number + 1); - } - } - if ($event.ctrlKey && $event.key == 'Backspace') { - this.deleteChoiceField(choice_number); - this.toastService.display('choix supprimé par raccourci "Ctrl + retour"'); - this.cd.detectChanges(); - this.focusOnChoice(Math.min(choice_number - 1, 0)); - } - if ($event.ctrlKey && $event.key == 'Enter') { - // go to other fields - const elem = this.document.querySelector('#creatorEmail'); - if (elem) { - elem.focus(); - } - } - } - - /** - * change time spans - */ - addTime() { - this.timeList.push({ - literal: '', - timeList: [], - date_object: new Date(), - }); - } - - removeAllTimes() { - this.timeList = []; - } - - resetTimes() { - this.timeList = otherDefaultDates; - } - - /** - * add a time period to a specific date choice, - * focus on the new input - * @param config - * @param id - */ - addTimeToDate(config: any, id: number) { - this.timeList.push({ - literal: '', - timeList: [], - date_object: new Date(), - }); - const selector = '[ng-reflect-choice_label="dateTime_' + id + '_Choices_' + (this.timeList.length - 1) + '"]'; - this.cd.detectChanges(); - const elem = this.document.querySelector(selector); - if (elem) { - elem.focus(); - } - } - - /** - * set the poll slug from other data of the poll - */ - automaticSlug() { - this.poll.slug = this.pollService.makeSlug(this.poll); - } - - goNextStep() { - this.router.navigate([this.nextRouteName]); - } + goNextStep() {} } diff --git a/src/app/features/administration/form/step-five/step-five.component.html b/src/app/features/administration/form/step-five/step-five.component.html index 6c0cc0ca..829f19a4 100644 --- a/src/app/features/administration/form/step-five/step-five.component.html +++ b/src/app/features/administration/form/step-five/step-five.component.html @@ -25,7 +25,7 @@
- {{ poll.slug }} + {{ poll.custom_url }}
le formulaire est invalide diff --git a/src/app/features/administration/form/step-four/step-four.component.html b/src/app/features/administration/form/step-four/step-four.component.html index f30221d0..41c2e770 100644 --- a/src/app/features/administration/form/step-four/step-four.component.html +++ b/src/app/features/administration/form/step-four/step-four.component.html @@ -1,5 +1,27 @@ +
+ + + + +
+
+
+
+ + +
+
+ +
+
- - - mode de saisie avancée - - - -
- 300 caractères maximum +
+
+ +
+ + + +
+ +
+ 300 caractères maximum +
+
+
+ +
-
diff --git a/src/app/features/administration/form/step-three/step-three.component.html b/src/app/features/administration/form/step-three/step-three.component.html index ccf44df9..e030c75b 100644 --- a/src/app/features/administration/form/step-three/step-three.component.html +++ b/src/app/features/administration/form/step-three/step-three.component.html @@ -1,23 +1,127 @@ -
-
- - -
-
- - {{ timeList.length }} - - - {{ 'dates.count_time' | translate }} - (pour chaque jour) - -
-
- - - -
- -
-
-
- - - -
-
-
-
- - {{ dateList.length }} - - - {{ 'dates.count_dates' | translate }} - - -
- - - -
-
- - -
-
-
-
- - -
-

{{ 'dates.add_interval' | translate }}

-
-
- {{ 'dates.interval_propose' | translate }} -
-
- - -
-
-
-
- {{ 'dates.interval_span' | translate }} -
-
- - -
-
- -
diff --git a/src/app/features/administration/form/step-two/step-two.component.scss b/src/app/features/administration/form/step-two/step-two.component.scss index e69de29b..182a819e 100644 --- a/src/app/features/administration/form/step-two/step-two.component.scss +++ b/src/app/features/administration/form/step-two/step-two.component.scss @@ -0,0 +1,3 @@ +.fa { + margin-right: 1em; +} diff --git a/src/app/features/administration/form/step-two/step-two.component.ts b/src/app/features/administration/form/step-two/step-two.component.ts index ca14d447..f6d26010 100644 --- a/src/app/features/administration/form/step-two/step-two.component.ts +++ b/src/app/features/administration/form/step-two/step-two.component.ts @@ -1,4 +1,13 @@ -import { Component, Input, OnInit } from '@angular/core'; +import { ChangeDetectorRef, Component, Inject, Input, OnInit } from '@angular/core'; +import { FormArray, FormBuilder } from '@angular/forms'; +import { UuidService } from '../../../../core/services/uuid.service'; +import { ApiService } from '../../../../core/services/api.service'; +import { ToastService } from '../../../../core/services/toast.service'; +import { PollService } from '../../../../core/services/poll.service'; +import { DateUtilities } from '../../../old-stuff/config/DateUtilities'; +import { DOCUMENT } from '@angular/common'; +import { CdkDragDrop } from '@angular/cdk/drag-drop'; +import { Router } from '@angular/router'; @Component({ selector: 'app-step-two', @@ -6,12 +15,51 @@ import { Component, Input, OnInit } from '@angular/core'; styleUrls: ['./step-two.component.scss'], }) export class StepTwoComponent implements OnInit { - constructor() {} - ngOnInit(): void {} + @Input() form: any; @Input() step_max: any; + timeList: any; + allowSeveralHours: string; + dateList: any; + showDateInterval: boolean; + intervalDays: any; + + constructor( + private fb: FormBuilder, + private cd: ChangeDetectorRef, + private uuidService: UuidService, + private toastService: ToastService, + public pollService: PollService, + private router: Router, + public dateUtilities: DateUtilities, + private apiService: ApiService, + @Inject(DOCUMENT) private document: any + ) { + this.form = this.pollService.form; + } + addIntervalOfDates() {} + + get choices(): FormArray { + return this.form.get('choices') as FormArray; + } + + addTime() {} + + removeAllTimes() {} + + resetTimes() {} + + drop(event: CdkDragDrop) { + // moveItemInArray(this.choices, event.previousIndex, event.currentIndex); + } + + addChoice() {} + + addTimeToDate(choice: any, id: number) {} + + countDays() {} } diff --git a/src/app/features/administration/stepper/stepper.component.scss b/src/app/features/administration/stepper/stepper.component.scss index 4967d1b5..186e7dd5 100644 --- a/src/app/features/administration/stepper/stepper.component.scss +++ b/src/app/features/administration/stepper/stepper.component.scss @@ -5,7 +5,7 @@ height: 0.5em; display: inline-block; min-width: 1px; - background: $grey-light; + background: $border-color !important; width: 100%; } .step-bar-progress { @@ -15,5 +15,5 @@ height: 0.5em; display: inline-block; min-width: 1px; - background: $primary; + background: $primary_color; } diff --git a/src/app/features/consultation/consultation.component.html b/src/app/features/consultation/consultation.component.html index b32322e7..8ce89a4a 100644 --- a/src/app/features/consultation/consultation.component.html +++ b/src/app/features/consultation/consultation.component.html @@ -27,10 +27,10 @@
diff --git a/src/app/features/user-profile/user-polls/user-polls.component.html b/src/app/features/user-profile/user-polls/user-polls.component.html index eca9d4f9..8ffe0db1 100644 --- a/src/app/features/user-profile/user-polls/user-polls.component.html +++ b/src/app/features/user-profile/user-polls/user-polls.component.html @@ -13,8 +13,8 @@ {{ poll.title }} - - {{ poll.slug }} + + {{ poll.custom_url }} diff --git a/src/app/shared/components/selectors/language-selector/language-selector.component.html b/src/app/shared/components/selectors/language-selector/language-selector.component.html index ea87ffb2..47ed68c2 100644 --- a/src/app/shared/components/selectors/language-selector/language-selector.component.html +++ b/src/app/shared/components/selectors/language-selector/language-selector.component.html @@ -2,7 +2,7 @@ langue
- diff --git a/src/app/shared/components/selectors/theme-selector/theme-selector.component.html b/src/app/shared/components/selectors/theme-selector/theme-selector.component.html index e8a55d39..14056773 100644 --- a/src/app/shared/components/selectors/theme-selector/theme-selector.component.html +++ b/src/app/shared/components/selectors/theme-selector/theme-selector.component.html @@ -2,21 +2,21 @@