diff --git a/src/app/shared/components/hour-picker/hour-picker.component.html b/src/app/shared/components/hour-picker/hour-picker.component.html
index b52deadd1dd4f0a8e33ddefa7f6ddb1d6d839181..4cf6b42b83114afed317e8fc152e55dfc23c8c6b 100644
--- a/src/app/shared/components/hour-picker/hour-picker.component.html
+++ b/src/app/shared/components/hour-picker/hour-picker.component.html
@@ -19,7 +19,7 @@
[label]="'De :'"
[size]="'large'"
[status]="getStatus(hour.start)"
- [statusText]="getStatusText(hour)"
+ [statusText]="getStatusText(hour.start)"
[(value)]="hour.start"
(valueChange)="submitForm()"
/>
@@ -31,7 +31,7 @@
[label]="'Jusqu’à :'"
[size]="'large'"
[status]="getStatus(hour.start, hour.end)"
- [statusText]="getStatusText(hour)"
+ [statusText]="getStatusText(hour.start, hour.end)"
[(value)]="hour.end"
(valueChange)="submitForm()"
/>
diff --git a/src/app/shared/components/hour-picker/hour-picker.component.ts b/src/app/shared/components/hour-picker/hour-picker.component.ts
index 88616a331e1dbd872051891a579326ebb774a7cf..217fd8a14e84c42fbe7690f1a2ed23d68370b53e 100644
--- a/src/app/shared/components/hour-picker/hour-picker.component.ts
+++ b/src/app/shared/components/hour-picker/hour-picker.component.ts
@@ -174,7 +174,7 @@ export class HourPickerComponent implements OnInit {
return end && end > start ? 'success' : 'error';
}
- getStatusText(hour: { start: string; end: string }): string {
- return 'Horaire ' + (this.getStatus(hour.start, hour.end) === 'error' ? 'invalide' : 'valide');
+ getStatusText(start: string, end?: string): string {
+ return 'Horaire ' + (this.getStatus(start, end) === 'error' ? 'invalide' : 'valide');
}
}
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 e6ba1b6ccd517f4d272a547598ea3680cbb83f14..cdc28cb548e990e09bdf4158b875b0009b69a308 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
@@ -21,7 +21,14 @@
[clickable]="false"
/>
</div>
- <app-svg-icon tabindex="0" [folder]="'ico'" [icon]="'cross'" [iconColor]="'grey-1'" (click)="close()" (keyup.enter)="close()" />
+ <app-svg-icon
+ tabindex="0"
+ [folder]="'ico'"
+ [icon]="'cross'"
+ [iconColor]="'grey-1'"
+ (click)="close()"
+ (keyup.enter)="close()"
+ />
</section>
<section *ngIf="showButtons" class="actions hide-on-print">
@@ -66,7 +73,7 @@
</div>
<!-- Je travaille ici -->
<div
- *ngIf="!profileService.isLinkedToStructure(structure._id)"
+ *ngIf="!isInStructure"
class="clickableDiv"
role="button"
tabindex="0"
@@ -78,7 +85,7 @@
</div>
<!-- Modifier la structure -->
<div
- *ngIf="profileService.isLinkedToStructure(structure._id) || profileService.isAdmin()"
+ *ngIf="isInStructure || profileService.isAdmin()"
class="clickableDiv"
role="button"
tabindex="0"
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 bf023d60945a34bc772f8839cfe527cbe9da87ec..973eba153f519626031ae9444e04b067efccdc93 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
@@ -56,6 +56,7 @@ export class StructureDetailsComponent implements OnInit {
public showButtons = true;
public Equipment = Equipment;
public FreeWorkshop = FreeWorkshop;
+ public isInStructure = false;
constructor(
private searchService: SearchService,
@@ -74,6 +75,7 @@ export class StructureDetailsComponent implements OnInit {
if (queryParams.id) {
this.structureService.getStructure(queryParams.id).subscribe((structure) => {
this.structure = new Structure(structure);
+ this.profileIsLinkedToStructure(this.structure._id);
this.isLoading = true;
this.initForm();
});
@@ -107,6 +109,10 @@ export class StructureDetailsComponent implements OnInit {
});
}
+ public async profileIsLinkedToStructure(id: string): Promise<void> {
+ this.isInStructure = await this.profileService.isLinkedToStructure(id);
+ }
+
public userIsLoggedIn(): boolean {
return this.authService.isLoggedIn();
}