diff --git a/src/app/form/form.component.html b/src/app/form/form.component.html index 5f5583778de275c811224da2443f65dd27019c0e..7378f6c9c4ed6863a41d3757cc4cf8145be303d7 100644 --- a/src/app/form/form.component.html +++ b/src/app/form/form.component.html @@ -6,7 +6,7 @@ ></app-modal-confirmation> <div class="content" *ngIf="!isLoading" [ngClass]="{ editMode: isEditMode }"> <div class="headerEditMode" *ngIf="isEditMode" fxLayout="row" fxLayoutAlign="space-between center"> - <h2>Modification de {{ editForm.get('structureName').value }}</h2> + <h2 class="no-margin">Modification de {{ editForm.get('structureName').value }}</h2> <app-structure-options-modal [structure]="structureWithOwners" [isEditFormView]="true" @@ -74,21 +74,19 @@ fxLayout="column" fxLayoutAlign="space-between" > - <div> - <div class="summary" *ngFor="let page of pagesValidation; let index = index"> - <div - class="itemSummary" - [ngClass]="{ last: index == 22 }" - fxLayout="row" - fxLayoutAlign="space-between center" - *ngIf="page.name" - (click)="goToSpecificPage(index, false)" - > - {{ page.name }} - <svg class="chevronRight" aria-hidden="true"> - <use [attr.xlink:href]="'assets/form/sprite.svg#chevronRight'"></use> - </svg> - </div> + <div class="summary" *ngFor="let page of pagesValidation; let index = index"> + <div + class="itemSummary" + [ngClass]="{ last: index == 22 }" + fxLayout="row" + fxLayoutAlign="space-between center" + *ngIf="page.name" + (click)="goToSpecificPage(index, false)" + > + {{ page.name }} + <svg class="chevronRight" aria-hidden="true"> + <use [attr.xlink:href]="'assets/form/sprite.svg#chevronRight'"></use> + </svg> </div> </div> </div> @@ -105,7 +103,11 @@ </ul> </div> </div> - <form [formGroup]="accountForm" *ngIf="accountForm && !profile" (keyup.enter)="isPageValid && !isEditMode? nextPage() : null"> + <form + [formGroup]="accountForm" + *ngIf="accountForm && !profile" + (keyup.enter)="isPageValid && !isEditMode ? nextPage() : null" + > <div *ngIf="currentPage == pageTypeEnum.accountInfo" class="page"> <div class="title"> <h3>Qui êtes-vous ?</h3> @@ -274,7 +276,11 @@ </div> </div> </form> - <form [formGroup]="structureForm" *ngIf="structureForm" (keyup.enter)="isPageValid && !isEditMode? nextPage() : null"> + <form + [formGroup]="structureForm" + *ngIf="structureForm" + (keyup.enter)="isPageValid && !isEditMode ? nextPage() : null" + > <div *ngIf="currentPage == pageTypeEnum.structureNameAndAddress" class="page"> <div class="title"> <h3>Quelle structure voulez-vous réferencer ?</h3> @@ -1016,7 +1022,7 @@ <div class="textareaBlock" fxLayout="column"> <textarea rows="8" - placeholder="Exemple : nous sommes une équipe de 7 bénévoles qui orientont les personnes pour qui le numérique est une langue étrangère" + placeholder="Exemple : nous sommes une équipe de 7 bénévoles qui orientons les personnes pour qui le numérique est une langue étrangère" maxlength="500" formControlName="description" ></textarea> diff --git a/src/app/form/form.component.scss b/src/app/form/form.component.scss index 9ed4fd2ae3ff1051a5a5f4c5fdd49c636dfad2c7..aef1dad977e5d18604c602a35463173e436b492a 100644 --- a/src/app/form/form.component.scss +++ b/src/app/form/form.component.scss @@ -87,7 +87,7 @@ h3 { .content { .editHome { height: calc( - 100vh - #{$header-height} - #{$footer-height} - 81px - 1px - 55px - 24px + 100vh - #{$header-height} - #{$footer-height} - 81px - 1px - 55px - 48px ) !important; // -1px because of header border } @media #{$tablet} { @@ -99,7 +99,8 @@ h3 { ); // -1px because of header border } .editHome { - height: calc(100vh - #{$header-height-phone} - 87px - 1px - 55px) !important; // -1px because of header border + height: unset !important; // -1px because of header border + margin-bottom: 80px; } } } @@ -526,12 +527,10 @@ img { max-width: 960px; margin: auto; margin-top: 24px; + margin-bottom: 24px; h2 { white-space: nowrap; text-overflow: ellipsis; overflow: hidden; } - @media #{$tablet} { - margin-top: 0; - } } diff --git a/src/app/form/form.component.ts b/src/app/form/form.component.ts index 769104607de5d09bddcbffc238c0fa979c1a5f03..1acd268a7d580617c62d2238923c115c1a769d5c 100644 --- a/src/app/form/form.component.ts +++ b/src/app/form/form.component.ts @@ -566,7 +566,7 @@ export class FormComponent implements OnInit { this.progressStatus = 100; }); } else { - this.structureService.claimStructureWithAccount(this.claimStructure._id, user).subscribe(() => { + this.structureService.claimStructureWithAccount(this.claimStructure._id, user.email).subscribe(() => { this.progressStatus = 100; }); } diff --git a/src/app/header/header.component.html b/src/app/header/header.component.html index ee833e54bba24f81e6701e48a308f1c793505c1a..9d31ad373f001e665fc94c0dd52a5943ca6c0b4e 100644 --- a/src/app/header/header.component.html +++ b/src/app/header/header.component.html @@ -33,6 +33,7 @@ </div> <div fxLayout="column" class="right-header" fxLayoutAlign="none baseline" fxLayoutGap="5vw"> <a routerLink="/home" [routerLinkActive]="'active'" (click)="closeMenu()" i18n>Les acteurs</a> + <a routerLink="/about" [routerLinkActive]="'active'" i18n>Qui sommes-nous ?</a> <a *ngIf="isAdmin" routerLink="/admin" [routerLinkActive]="'active'" (click)="closeMenu()">Administration</a> </div> </div> diff --git a/src/app/header/header.component.scss b/src/app/header/header.component.scss index 37b4b41bc170f8c86a8de22aaf54290bd7b36d27..7470c080a1e12b117c225ac5910cdbc98606a54f 100644 --- a/src/app/header/header.component.scss +++ b/src/app/header/header.component.scss @@ -130,6 +130,7 @@ a { .mobile-show { display: none; + @include cn-bold-16; @media #{$tablet} { display: block; } diff --git a/src/app/profile/services/profile.service.ts b/src/app/profile/services/profile.service.ts index 5ac816cbf5135eb07f444b631b973a16c6665d71..370137312c0da1f504f624ec8be949cfc7683559 100644 --- a/src/app/profile/services/profile.service.ts +++ b/src/app/profile/services/profile.service.ts @@ -36,6 +36,14 @@ export class ProfileService { return this.currentProfile.structuresLink.includes(idStructure); } + public isPendingLinkedToStructure(idStructure: string): boolean { + if (!this.currentProfile) { + return false; + } + console.log(this.currentProfile.pendingStructuresLink); + return this.currentProfile.pendingStructuresLink.includes(idStructure); + } + public removeProfile(): void { this.currentProfile = null; } diff --git a/src/app/services/structure.service.ts b/src/app/services/structure.service.ts index b94990936c418e29db4af3b19cc086e9c2e64cf7..fe7e093961d7a19e4887e3cc944cece615040cfd 100644 --- a/src/app/services/structure.service.ts +++ b/src/app/services/structure.service.ts @@ -44,8 +44,8 @@ export class StructureService { return this.http.post<boolean>(`${this.baseUrl}/${id}/isClaimed`, profile); } - public claimStructureWithAccount(id: string, user: User): Observable<string[]> { - return this.http.post<any>(`${this.baseUrl}/${id}/claim`, user); + public claimStructureWithAccount(id: string, email: string): Observable<string[]> { + return this.http.post<any>(`${this.baseUrl}/${id}/claim`, { email }); } public getStructure(id: string): Observable<Structure> { diff --git a/src/app/shared/components/button/button.component.html b/src/app/shared/components/button/button.component.html index dcfb2a0f7d2a438b078f8871f7c192d9e5dd0cb1..d9ee298fbb39f6719832c21d774ec8fe0435dfa0 100644 --- a/src/app/shared/components/button/button.component.html +++ b/src/app/shared/components/button/button.component.html @@ -8,7 +8,7 @@ fxLayoutAlign="space-between center" fxLayoutGap="5px" > - <app-svg-icon style="height: 100%" [type]="'ico'" [icon]="iconBtn" [iconColor]="'currentColor'"></app-svg-icon> + <app-svg-icon [type]="'ico'" [icon]="iconBtn" [iconColor]="'currentColor'"></app-svg-icon> <span>{{ text }}</span> </div> </button> diff --git a/src/app/structure-list/components/structure-details/structure-details.component.html b/src/app/structure-list/components/structure-details/structure-details.component.html index 9eda0b47023334ae28c87c4811e46ad925f37785..2e865d93f5335b273cd93956684749734cf5af3b 100644 --- a/src/app/structure-list/components/structure-details/structure-details.component.html +++ b/src/app/structure-list/components/structure-details/structure-details.component.html @@ -5,7 +5,7 @@ </div> <div fxLayout="row" class="structure-details-block" fxLayoutAlign="baseline baseline" fxLayoutGap="8px"> <div fxLayout="column" fxLayoutGap="10px" fxFlex="100%"> - <div fxLayout="column" fxLayoutAlign="space-between start"> + <div fxLayout="column" class="no-margin" fxLayoutAlign="space-between start"> <h2 class="bold">{{ structure.structureName }}</h2> </div> <div fxLayout="row" fxLayoutAlign="space-between center"> diff --git a/src/app/structure-list/components/structure-details/structure-details.component.scss b/src/app/structure-list/components/structure-details/structure-details.component.scss index 5759b6c02e443a3c362e2a3eac1b0ff35c96f2d4..19284a7cc69c13612863296b2667cefa0dfa7332 100644 --- a/src/app/structure-list/components/structure-details/structure-details.component.scss +++ b/src/app/structure-list/components/structure-details/structure-details.component.scss @@ -67,7 +67,7 @@ h2 { @include cn-regular-26; } h3 { - margin: 0; + margin: 0 0 8px 0; @include cn-regular-16; } h4 { diff --git a/src/app/structure-list/components/structure-details/structure-details.component.ts b/src/app/structure-list/components/structure-details/structure-details.component.ts index 1e12ab4d7f70d18919ceff0cf1b10afb59ee230f..9604623b998ad702839646fcd29bad779078a6e6 100644 --- a/src/app/structure-list/components/structure-details/structure-details.component.ts +++ b/src/app/structure-list/components/structure-details/structure-details.component.ts @@ -161,11 +161,13 @@ export class StructureDetailsComponent implements OnInit { public claimStructure(shouldClaim: boolean): void { this.toggleClaimModal(); if (shouldClaim) { - this.profileService.getProfile().then((user: User) => { - this.structureService.claimStructureWithAccount(this.structure._id, user).subscribe(() => { - this.isClaimed = true; + this.structureService + .claimStructureWithAccount(this.structure._id, this.authService.userValue.username) + .subscribe(() => { + this.profileService.getProfile().then((user: User) => { + this.isClaimed = true; + }); }); - }); } } @@ -173,7 +175,9 @@ export class StructureDetailsComponent implements OnInit { this.toggleJoinModal(); if (shouldClaim) { this.structureService.joinStructure(this.structure._id, this.authService.userValue.username).subscribe((res) => { - this.isClaimed = true; + this.profileService.getProfile().then((user: User) => { + this.isClaimed = true; + }); }); } } @@ -247,7 +251,9 @@ export class StructureDetailsComponent implements OnInit { public displayJoin(): boolean { return ( - !(this.profileService.isLinkedToStructure(this.structure._id) || this.profileService.isAdmin()) && this.isClaimed + !(this.profileService.isLinkedToStructure(this.structure._id) || this.profileService.isAdmin()) && + this.isClaimed && + !this.profileService.isPendingLinkedToStructure(this.structure._id) ); } } diff --git a/src/styles.scss b/src/styles.scss index 3a1cf55d2fbadd5a1ced0d5c0b5ac68eaa00ab81..747d5da15a984bd5b107acc00ceaaeabe882de53 100644 --- a/src/styles.scss +++ b/src/styles.scss @@ -266,3 +266,7 @@ button { } @include background-hash($grey-2); } + +.no-margin { + margin: 0 !important; +}