refactor: add opening hours

This commit is contained in:
Rainer Killinger
2021-08-03 15:02:59 +02:00
parent b89f5c4edd
commit bb8a9f6ba5
11 changed files with 204 additions and 36 deletions

View File

@@ -1,19 +1,36 @@
<stapps-simple-card *ngIf="item.description" [title]="'description' | propertyNameTranslate: item | titlecase" [content]="'description' | thingTranslate: item"></stapps-simple-card>
<div [ngSwitch]="true">
<stapps-article-detail-content [item]="item" *ngSwitchCase="item.type === 'article'"></stapps-article-detail-content>
<stapps-catalog-detail-content [item]="item" *ngSwitchCase="item.type === 'catalog'"></stapps-catalog-detail-content>
<stapps-date-series-detail-content [item]="item" *ngSwitchCase="item.type === 'date series'"></stapps-date-series-detail-content>
<stapps-dish-detail-content [item]="item" *ngSwitchCase="item.type === 'dish'"></stapps-dish-detail-content>
<stapps-event-detail-content [item]="item" *ngSwitchCase="item.type === 'academic event'"></stapps-event-detail-content>
<stapps-event-detail-content [item]="item" *ngSwitchCase="item.type === 'sport course'"></stapps-event-detail-content>
<stapps-favorite-detail-content [item]="item" *ngSwitchCase="item.type === 'favorite'"></stapps-favorite-detail-content>
<stapps-message-detail-content [item]="item" *ngSwitchCase="item.type === 'message'"></stapps-message-detail-content>
<stapps-person-detail-content [item]="item" *ngSwitchCase="item.type === 'person'"></stapps-person-detail-content>
<stapps-place-detail-content [item]="item" *ngSwitchCase="item.type === 'building'"></stapps-place-detail-content>
<stapps-place-detail-content [item]="item" *ngSwitchCase="item.type === 'floor'"></stapps-place-detail-content>
<stapps-place-detail-content [item]="item" *ngSwitchCase="item.type === 'point of interest'"></stapps-place-detail-content>
<stapps-place-detail-content [item]="item" *ngSwitchCase="item.type === 'room'"></stapps-place-detail-content>
<stapps-semester-detail-content [item]="item" *ngSwitchCase="item.type === 'semester'"></stapps-semester-detail-content>
<stapps-video-detail-content [item]="item" *ngSwitchCase="item.type === 'video'"></stapps-video-detail-content>
<stapps-origin-detail [origin]="item.origin" ></stapps-origin-detail>
<div [ngSwitch]="item.type">
<stapps-article-detail-content [item]="item" *ngSwitchCase="'article'"></stapps-article-detail-content>
<stapps-catalog-detail-content [item]="item" *ngSwitchCase="'catalog'"></stapps-catalog-detail-content>
<stapps-date-series-detail-content [item]="item" *ngSwitchCase="'date series'"></stapps-date-series-detail-content>
<stapps-dish-detail-content [item]="item" *ngSwitchCase="'dish'"></stapps-dish-detail-content>
<stapps-event-detail-content [item]="item" *ngSwitchCase="'academic event'"></stapps-event-detail-content>
<stapps-event-detail-content [item]="item" *ngSwitchCase="'sport course'"></stapps-event-detail-content>
<stapps-favorite-detail-content [item]="item" *ngSwitchCase="'favorite'"></stapps-favorite-detail-content>
<stapps-message-detail-content [item]="item" *ngSwitchCase="'message'"></stapps-message-detail-content>
<stapps-person-detail-content [item]="item" *ngSwitchCase="'person'"></stapps-person-detail-content>
<stapps-place-detail-content [item]="item" *ngSwitchCase="'building'"></stapps-place-detail-content>
<stapps-place-detail-content [item]="item" *ngSwitchCase="'floor'"></stapps-place-detail-content>
<stapps-place-detail-content [item]="item" *ngSwitchCase="'point of interest'"></stapps-place-detail-content>
<stapps-place-detail-content [item]="item" *ngSwitchCase="'room'"></stapps-place-detail-content>
<stapps-semester-detail-content [item]="item" *ngSwitchCase="'semester'"></stapps-semester-detail-content>
<stapps-video-detail-content [item]="item" *ngSwitchCase="'video'"></stapps-video-detail-content>
<ng-container *ngSwitchDefault>
<ion-item class="ion-text-wrap" lines="inset">
<ion-thumbnail slot="start" class="ion-margin-end">
<ion-icon color="medium" [attr.name]="item.type | dataIcon"></ion-icon>
</ion-thumbnail>
<ion-grid>
<ion-row>
<ion-col>
<div class="ion-text-wrap">
<h2 class="name">{{item.name}}</h2>
<ion-note>{{item.type}}</ion-note>
</div>
</ion-col>
</ion-row>
</ion-grid>
</ion-item>
<stapps-simple-card *ngIf="item.description" [title]="'description' | propertyNameTranslate: item | titlecase" [content]="'description' | thingTranslate: item"></stapps-simple-card>
</ng-container>
</div>
<stapps-origin-detail [origin]="item.origin" ></stapps-origin-detail>

View File

@@ -5,7 +5,7 @@
<h2 class="name">{{ 'name' | thingTranslate: item }}</h2>
<p>
<ion-icon name="calendar"></ion-icon>
<span>
<span *ngIf="item.dates[0] && item.dates[item.dates.length - 1]">
{{ item.repeatFrequency | amDuration }},
{{ item.dates[0] | dateFormat: 'weekday:long' }}
<span>

View File

@@ -2,9 +2,26 @@
<ion-row>
<ion-col>
<div class="ion-text-wrap">
<h2 class="name">{{ 'name' | thingTranslate: item }}</h2>
<ion-label>{{'name' | thingTranslate: item}}</ion-label>
<ng-container *ngIf="item.type !== 'floor'">
<p>
<ion-note *ngIf="item.openingHours">
{{item.openingHours | openingHours}}
</ion-note>
</p>
<p>
<ion-note *ngIf="item.categories && item.type !== 'building'; else onlyType">
{{'categories' | thingTranslate: item | join:', ' | titlecase }}
</ion-note>
</p>
<ng-template #onlyType>
<ion-note>
{{'type' | thingTranslate: item}}
</ion-note>
</ng-template>
</ng-container>
<p *ngIf="item.description">
{{ 'description' | thingTranslate: item }}
{{'description' | thingTranslate: item}}
</p>
<ion-note>
<ul>
@@ -17,11 +34,10 @@
</ion-note>
</div>
</ion-col>
<ion-col width-20 text-right *ngIf="item.type !== 'building'">
<span *ngIf="item.inPlace">
<ion-icon name="location"></ion-icon
>{{ 'name' | thingTranslate: item.inPlace }}
</span>
</ion-col>
<div *ngIf="item.type !== 'building'">
<ion-col width-20 text-right *ngIf="item.inPlace">
<ion-icon name="location"></ion-icon>{{'name' | thingTranslate: item.inPlace}}
</ion-col>
</div>
</ion-row>
</ion-grid>

View File

@@ -39,7 +39,7 @@ export class PlaceMensaDetailComponent implements AfterViewInit {
/**
* number of days to display mensa menus for
*/
@Input() displayRange = 5;
@Input() displayRange = 7;
/**
* TODO