From b559f6cabac98868fb7d8278e093c48ec0c2a51a Mon Sep 17 00:00:00 2001 From: Tykayn Date: Mon, 18 Oct 2021 16:02:54 +0200 Subject: [PATCH] :zap: creation forms, dispatch step one --- .../administration-routing.module.ts | 22 +++++- .../administration/administration.module.ts | 6 ++ .../administration/form/form.component.html | 78 +++++-------------- .../administration/form/form.component.ts | 8 ++ .../form/step-five/step-five.component.html | 1 + .../form/step-five/step-five.component.scss | 0 .../step-five/step-five.component.spec.ts | 24 ++++++ .../form/step-five/step-five.component.ts | 12 +++ .../form/step-four/step-four.component.html | 1 + .../form/step-four/step-four.component.scss | 0 .../step-four/step-four.component.spec.ts | 24 ++++++ .../form/step-four/step-four.component.ts | 12 +++ .../form/step-one/step-one.component.html | 48 ++++++++++++ .../form/step-one/step-one.component.ts | 2 + .../form/step-three/step-three.component.html | 1 + .../form/step-three/step-three.component.scss | 0 .../step-three/step-three.component.spec.ts | 24 ++++++ .../form/step-three/step-three.component.ts | 12 +++ 18 files changed, 217 insertions(+), 58 deletions(-) create mode 100644 src/app/features/administration/form/step-five/step-five.component.html create mode 100644 src/app/features/administration/form/step-five/step-five.component.scss create mode 100644 src/app/features/administration/form/step-five/step-five.component.spec.ts create mode 100644 src/app/features/administration/form/step-five/step-five.component.ts create mode 100644 src/app/features/administration/form/step-four/step-four.component.html create mode 100644 src/app/features/administration/form/step-four/step-four.component.scss create mode 100644 src/app/features/administration/form/step-four/step-four.component.spec.ts create mode 100644 src/app/features/administration/form/step-four/step-four.component.ts create mode 100644 src/app/features/administration/form/step-three/step-three.component.html create mode 100644 src/app/features/administration/form/step-three/step-three.component.scss create mode 100644 src/app/features/administration/form/step-three/step-three.component.spec.ts create mode 100644 src/app/features/administration/form/step-three/step-three.component.ts diff --git a/src/app/features/administration/administration-routing.module.ts b/src/app/features/administration/administration-routing.module.ts index 8b2bf8f4..af3a55d7 100644 --- a/src/app/features/administration/administration-routing.module.ts +++ b/src/app/features/administration/administration-routing.module.ts @@ -2,8 +2,28 @@ import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; import { AdministrationComponent } from './administration.component'; +import { StepTwoComponent } from './form/step-two/step-two.component'; +import { StepThreeComponent } from './form/step-three/step-three.component'; +import { StepFourComponent } from './form/step-four/step-four.component'; +import { StepFiveComponent } from './form/step-five/step-five.component'; +import { StepOneComponent } from './form/step-one/step-one.component'; -const routes: Routes = [{ path: '', component: AdministrationComponent }]; +const routes: Routes = [ + { + path: '', + component: AdministrationComponent, + }, + { + path: 'step', + children: [ + { path: '1', component: StepOneComponent }, + { path: '2', component: StepTwoComponent }, + { path: '3', component: StepThreeComponent }, + { path: '4', component: StepFourComponent }, + { path: '5', component: StepFiveComponent }, + ], + }, +]; @NgModule({ imports: [RouterModule.forChild(routes)], diff --git a/src/app/features/administration/administration.module.ts b/src/app/features/administration/administration.module.ts index 5a5a2e84..1a76397b 100644 --- a/src/app/features/administration/administration.module.ts +++ b/src/app/features/administration/administration.module.ts @@ -12,6 +12,9 @@ import { DateValueAccessorModule } from 'angular-date-value-accessor'; import { ClassicChoicesComponent } from './form/classic-choices/classic-choices.component'; import { StepOneComponent } from './form/step-one/step-one.component'; import { StepTwoComponent } from './form/step-two/step-two.component'; +import { StepThreeComponent } from './form/step-three/step-three.component'; +import { StepFourComponent } from './form/step-four/step-four.component'; +import { StepFiveComponent } from './form/step-five/step-five.component'; @NgModule({ declarations: [ @@ -21,6 +24,9 @@ import { StepTwoComponent } from './form/step-two/step-two.component'; ClassicChoicesComponent, StepOneComponent, StepTwoComponent, + StepThreeComponent, + StepFourComponent, + StepFiveComponent, ], imports: [ AdministrationRoutingModule, diff --git a/src/app/features/administration/form/form.component.html b/src/app/features/administration/form/form.component.html index 99a59178..300d7312 100644 --- a/src/app/features/administration/form/form.component.html +++ b/src/app/features/administration/form/form.component.html @@ -1,65 +1,29 @@
-

- {{ 'creation.title' | translate }} -

-
+
+

+ {{ 'creation.title' | translate }} +

- -
- - {{ 'creation.choose_title' | translate }} - - - - -
-
- - - mode de saisie avancée - - - -
- 300 caractères maximum +
+
+ + + +
+
+
+
+ +
+
+
-
+
+
+ +
diff --git a/src/app/features/administration/form/form.component.ts b/src/app/features/administration/form/form.component.ts index 39802bfc..8749f888 100644 --- a/src/app/features/administration/form/form.component.ts +++ b/src/app/features/administration/form/form.component.ts @@ -9,6 +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'; @Component({ selector: 'app-admin-form', @@ -34,6 +35,8 @@ export class FormComponent implements OnInit { step_current: number = 1; step_max: number = 5; public round: Function; + private nextRouteName: string = '/administration/step/2'; + previousRouteName: string = '/administration'; constructor( private fb: FormBuilder, @@ -41,6 +44,7 @@ export class FormComponent implements OnInit { private uuidService: UuidService, private toastService: ToastService, private pollService: PollService, + private router: Router, public dateUtilities: DateUtilities, private apiService: ApiService, @Inject(DOCUMENT) private document: any @@ -312,4 +316,8 @@ export class FormComponent implements OnInit { automaticSlug() { this.poll.slug = this.pollService.makeSlug(this.poll); } + + goNextStep() { + this.router.navigate([this.nextRouteName]); + } } 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 new file mode 100644 index 00000000..e8446c57 --- /dev/null +++ b/src/app/features/administration/form/step-five/step-five.component.html @@ -0,0 +1 @@ +

step-five works!

diff --git a/src/app/features/administration/form/step-five/step-five.component.scss b/src/app/features/administration/form/step-five/step-five.component.scss new file mode 100644 index 00000000..e69de29b diff --git a/src/app/features/administration/form/step-five/step-five.component.spec.ts b/src/app/features/administration/form/step-five/step-five.component.spec.ts new file mode 100644 index 00000000..19eb8e0c --- /dev/null +++ b/src/app/features/administration/form/step-five/step-five.component.spec.ts @@ -0,0 +1,24 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { StepFiveComponent } from './step-five.component'; + +describe('StepFiveComponent', () => { + let component: StepFiveComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [StepFiveComponent], + }).compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(StepFiveComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/features/administration/form/step-five/step-five.component.ts b/src/app/features/administration/form/step-five/step-five.component.ts new file mode 100644 index 00000000..b9146108 --- /dev/null +++ b/src/app/features/administration/form/step-five/step-five.component.ts @@ -0,0 +1,12 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-step-five', + templateUrl: './step-five.component.html', + styleUrls: ['./step-five.component.scss'], +}) +export class StepFiveComponent implements OnInit { + constructor() {} + + ngOnInit(): void {} +} 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 new file mode 100644 index 00000000..bfb71787 --- /dev/null +++ b/src/app/features/administration/form/step-four/step-four.component.html @@ -0,0 +1 @@ +

step-four works!

diff --git a/src/app/features/administration/form/step-four/step-four.component.scss b/src/app/features/administration/form/step-four/step-four.component.scss new file mode 100644 index 00000000..e69de29b diff --git a/src/app/features/administration/form/step-four/step-four.component.spec.ts b/src/app/features/administration/form/step-four/step-four.component.spec.ts new file mode 100644 index 00000000..a86bd20d --- /dev/null +++ b/src/app/features/administration/form/step-four/step-four.component.spec.ts @@ -0,0 +1,24 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { StepFourComponent } from './step-four.component'; + +describe('StepFourComponent', () => { + let component: StepFourComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [StepFourComponent], + }).compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(StepFourComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/features/administration/form/step-four/step-four.component.ts b/src/app/features/administration/form/step-four/step-four.component.ts new file mode 100644 index 00000000..2a33592a --- /dev/null +++ b/src/app/features/administration/form/step-four/step-four.component.ts @@ -0,0 +1,12 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-step-four', + templateUrl: './step-four.component.html', + styleUrls: ['./step-four.component.scss'], +}) +export class StepFourComponent implements OnInit { + constructor() {} + + ngOnInit(): void {} +} diff --git a/src/app/features/administration/form/step-one/step-one.component.html b/src/app/features/administration/form/step-one/step-one.component.html index 76d35d10..0b6b2203 100644 --- a/src/app/features/administration/form/step-one/step-one.component.html +++ b/src/app/features/administration/form/step-one/step-one.component.html @@ -1,3 +1,51 @@
Nom de sondage + +
+ + {{ 'creation.choose_title' | translate }} + + + + +
+
+ + + mode de saisie avancée + + + +
+ 300 caractères maximum +
+ +
diff --git a/src/app/features/administration/form/step-one/step-one.component.ts b/src/app/features/administration/form/step-one/step-one.component.ts index 12fbe8de..37b76009 100644 --- a/src/app/features/administration/form/step-one/step-one.component.ts +++ b/src/app/features/administration/form/step-one/step-one.component.ts @@ -9,4 +9,6 @@ export class StepOneComponent implements OnInit { constructor() {} ngOnInit(): void {} + + updateSlug() {} } 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 new file mode 100644 index 00000000..18ce914d --- /dev/null +++ b/src/app/features/administration/form/step-three/step-three.component.html @@ -0,0 +1 @@ +

step-three works!

diff --git a/src/app/features/administration/form/step-three/step-three.component.scss b/src/app/features/administration/form/step-three/step-three.component.scss new file mode 100644 index 00000000..e69de29b diff --git a/src/app/features/administration/form/step-three/step-three.component.spec.ts b/src/app/features/administration/form/step-three/step-three.component.spec.ts new file mode 100644 index 00000000..c7d2c651 --- /dev/null +++ b/src/app/features/administration/form/step-three/step-three.component.spec.ts @@ -0,0 +1,24 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { StepThreeComponent } from './step-three.component'; + +describe('StepThreeComponent', () => { + let component: StepThreeComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [StepThreeComponent], + }).compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(StepThreeComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/features/administration/form/step-three/step-three.component.ts b/src/app/features/administration/form/step-three/step-three.component.ts new file mode 100644 index 00000000..dd448514 --- /dev/null +++ b/src/app/features/administration/form/step-three/step-three.component.ts @@ -0,0 +1,12 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-step-three', + templateUrl: './step-three.component.html', + styleUrls: ['./step-three.component.scss'], +}) +export class StepThreeComponent implements OnInit { + constructor() {} + + ngOnInit(): void {} +}