diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index e28cd3efb1450886a6f4989b660cf33da571b6e2..9f1d05bcf580f886740b32f9d9557680a5662c8e 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -2,6 +2,7 @@ import { NgModule } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; import { AboutComponent } from './about/about.component'; import { PanelComponent } from './admin/components/panel/panel.component'; +import { FormComponent } from './form/form.component'; import { AdminGuard } from './guards/admin.guard'; import { AuthGuard } from './guards/auth.guard'; import { HomeComponent } from './home/home.component'; @@ -65,6 +66,10 @@ const routes: Routes = [ canActivate: [AdminGuard], component: PanelComponent, }, + { + path: 'create-structure', + component: FormComponent, + }, { path: '**', redirectTo: 'home', diff --git a/src/app/form/form.component.scss b/src/app/form/form.component.scss index 3f8400e30d7e0b685a8727e71127a27915b07ca4..20530c214b67099eebfb4b3843ac7aa8ae28aac4 100644 --- a/src/app/form/form.component.scss +++ b/src/app/form/form.component.scss @@ -8,13 +8,13 @@ $progressBar-height: 50px; .form { - position: fixed; background: white; width: 100vw; height: calc(100vh - #{$header-height} - #{$footer-height}); top: #{$header-height}; z-index: $structure-details-z-index; @media #{$tablet} { + position: fixed; //Hide default header app. height: calc(100vh); top: 0; } diff --git a/src/app/form/form.component.ts b/src/app/form/form.component.ts index cafe0f037b286a5dc5500e35b0ec0e233f2b131c..2b3cbecc9bbed909425e517c574d838fe85a2820 100644 --- a/src/app/form/form.component.ts +++ b/src/app/form/form.component.ts @@ -25,7 +25,6 @@ export class FormComponent implements OnInit { @Input() public idStructure?: string; @Input() public isEditMode: boolean = true; @Input() public profile?: User; - @Output() closeEvent = new EventEmitter<Structure>(); public structureForm: FormGroup; public labelsQualifications: Category; @@ -272,34 +271,6 @@ export class FormComponent implements OnInit { } return false; } - public onSubmitClaim(accountForm: FormGroup): void { - if (!this.structureForm.invalid && accountForm.valid) { - this.profileService.createUserandLinkStructure(this.structureId, accountForm.value).subscribe((user) => { - this.closeEvent.emit(this.structureForm.value); - }); - } - } - - public onSubmitClaimWithAccount(): void { - this.structureService.claimStructureWithAccount(this.structureId, this.profile).subscribe((structuresLinked) => { - this.profile.pendingStructuresLink = structuresLinked; - this.profileService.setProfile(this.profile); - this.closeEvent.emit(this.structureForm.value); - }); - } - public onSubmit(structureForm: FormGroup): void { - if (structureForm.valid) { - if (this.structureId) { - this.structureService.editStructure(this.structureId, structureForm.value).subscribe((structure: Structure) => { - this.closeEvent.emit(structure); - }); - } else { - this.structureService.createStructure(structureForm.value, this.profile).subscribe((structure: Structure) => { - this.closeEvent.emit(structure); - }); - } - } - } public setValidationsForm(): void { this.pagesValidation[0] = { valid: true }; @@ -523,18 +494,18 @@ export class FormComponent implements OnInit { () => { this.structureService.createStructure(structure, user).subscribe( (structure: Structure) => { - this.closeEvent.emit(structure); + this.router.navigateByUrl('/home'); }, (err) => { - this.closeEvent.emit(null); + this.router.navigateByUrl('/home'); } ); }, (error) => { if (error.error.statusCode === 400) { - console.log('Compte déjà créé'); - this.closeEvent.emit(null); + console.log('Email déjà utilisé'); } + this.router.navigateByUrl('/home'); } ); } else { @@ -543,11 +514,6 @@ export class FormComponent implements OnInit { console.log(this.hoursForm); console.log('invalid'); } - /*if (!this.structureForm.invalid && accountForm.valid) { - this.profileService.createUserandLinkStructure(this.structureId, accountForm.value).subscribe((user) => { - this.closeEvent.emit(this.structureForm.value); - }); - }*/ } public toggleMenu(): void { this.showMenu = !this.showMenu; diff --git a/src/assets/scss/_z-index.scss b/src/assets/scss/_z-index.scss index adcaa8f7acc9a61121daa424aa6a0699581e0411..18c12fc2c0511495842353125e55957dbf5b2e49 100644 --- a/src/assets/scss/_z-index.scss +++ b/src/assets/scss/_z-index.scss @@ -7,4 +7,4 @@ $structure-details-z-index: 1001; // Modals (filters/confirmationPopup/authen/...) $modal-z-index: 1002; -$modal-confirmation-z-index: 1003; +$modal-confirmation-z-index: 1004;