From 40e3fefa2c3150eefdd2e8b1f2d0aa0d5b208353 Mon Sep 17 00:00:00 2001 From: Hugo SUBTIL <ext.sopra.husubtil@grandlyon.com> Date: Wed, 13 Jan 2021 17:28:14 +0100 Subject: [PATCH] fix: openning hours handling when there is no hours --- src/app/models/week.model.ts | 16 ++++++++++++++++ .../structure-details.component.html | 6 +++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/app/models/week.model.ts b/src/app/models/week.model.ts index 742c749d8..b3a91d97e 100644 --- a/src/app/models/week.model.ts +++ b/src/app/models/week.model.ts @@ -41,4 +41,20 @@ export class Week { return null; } } + + public hasData() { + console.log('has data'); + if ( + this.monday.time.length === 0 && + this.tuesday.time.length === 0 && + this.wednesday.time.length === 0 && + this.thursday.time.length === 0 && + this.friday.time.length === 0 && + this.saturday.time.length === 0 && + this.sunday.time.length === 0 + ) { + return false; + } + return true; + } } 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 95e09eeb6..4c5061cec 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 @@ -67,7 +67,7 @@ <div fxLayout="column" fxFlex="50%"> <div *ngIf="structure.contactMail" fxLayout="row" fxLayoutAlign="none center" fxLayoutGap="13px"> <app-svg-icon [type]="'ico'" [icon]="'email'"></app-svg-icon> - <a [href]="'mailto:' + structure.contactMail">{{ structure.contactMail }}</a> + <p>{{ structure.contactMail }}</p> </div> <div fxLayout="row" fxLayoutAlign="none flex-end" fxLayoutGap="13px"> <app-svg-icon [type]="'ico'" [icon]="'calendar'"></app-svg-icon> @@ -133,8 +133,8 @@ </div> <!-- Openning Hours --> <div fxLayout="row" class="w-100" fxLayout.lt-sm="column"> - <div fxFlex="50%"> - <h3 class="subtitle">Horaires d’ouverture au public :</h3> + <div *ngIf="structure.hours.hasData()" fxFlex="50%"> + <h3 class="subtitle">Horaires d’ouverture au public</h3> <div fxLayout="column"> <div *ngFor="let day of structure.hours | keyvalue: keepOriginalOrder"> <div *ngIf="day.value.open"> -- GitLab