mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-03-12 01:32:12 +00:00
feat: add the app
This commit is contained in:
34
src/app/modules/data/data-routing.module.ts
Normal file
34
src/app/modules/data/data-routing.module.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {NgModule} from '@angular/core';
|
||||
import {RouterModule, Routes} from '@angular/router';
|
||||
import {DataDetailComponent} from './detail/data-detail.component';
|
||||
import {DataListComponent} from './list/data-list.component';
|
||||
|
||||
const dataRoutes: Routes = [
|
||||
{path: 'search', component: DataListComponent},
|
||||
{path: 'data-detail/:uid', component: DataDetailComponent}
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
RouterModule.forChild(dataRoutes)
|
||||
],
|
||||
// tslint:disable-next-line:object-literal-sort-keys
|
||||
exports: [
|
||||
RouterModule
|
||||
]
|
||||
})
|
||||
export class DataRoutingModule {}
|
||||
18
src/app/modules/data/data.html
Normal file
18
src/app/modules/data/data.html
Normal file
@@ -0,0 +1,18 @@
|
||||
<!--
|
||||
Generated template for the DataPage page.
|
||||
|
||||
See http://ionicframework.com/docs/components/#navigation for more info on
|
||||
Ionic pages and navigation.
|
||||
-->
|
||||
<ion-header>
|
||||
|
||||
<ion-toolbar>
|
||||
<ion-title>data</ion-title>
|
||||
</ion-toolbar>
|
||||
|
||||
</ion-header>
|
||||
|
||||
|
||||
<ion-content padding>
|
||||
|
||||
</ion-content>
|
||||
56
src/app/modules/data/data.module.ts
Normal file
56
src/app/modules/data/data.module.ts
Normal file
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {CommonModule} from '@angular/common';
|
||||
import {HttpClientModule} from '@angular/common/http';
|
||||
import {NgModule} from '@angular/core';
|
||||
import {FormsModule} from '@angular/forms';
|
||||
import {IonicModule} from '@ionic/angular';
|
||||
import {DataRoutingModule} from './data-routing.module';
|
||||
import {DataProvider, StAppsWebHttpClient} from './data.provider';
|
||||
import {DataDetailComponent} from './detail/data-detail.component';
|
||||
import {DataListItem} from './list/data-list-item.component';
|
||||
import {DataListComponent} from './list/data-list.component';
|
||||
import {DishDetailContentComponent} from './types/dish/dish-detail-content.component';
|
||||
import {DishListItem} from './types/dish/dish-list-item.component';
|
||||
import {EventListItemComponent} from './types/event/event-list-item.component';
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
DataDetailComponent,
|
||||
|
||||
DishDetailContentComponent,
|
||||
DishListItem,
|
||||
|
||||
EventListItemComponent,
|
||||
|
||||
DataListItem,
|
||||
DataListComponent,
|
||||
],
|
||||
entryComponents: [
|
||||
DataListComponent,
|
||||
],
|
||||
imports: [
|
||||
IonicModule.forRoot(),
|
||||
CommonModule,
|
||||
FormsModule,
|
||||
DataRoutingModule,
|
||||
HttpClientModule,
|
||||
],
|
||||
providers: [
|
||||
DataProvider,
|
||||
StAppsWebHttpClient,
|
||||
],
|
||||
})
|
||||
export class DataModule {}
|
||||
81
src/app/modules/data/data.provider.ts
Normal file
81
src/app/modules/data/data.provider.ts
Normal file
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {HttpClient, HttpResponse} from '@angular/common/http';
|
||||
import {Injectable} from '@angular/core';
|
||||
import {HttpClientInterface, HttpClientRequest} from '@openstapps/api/lib/httpClientInterface';
|
||||
|
||||
/**
|
||||
* Response with generic for the type of body that is returned from the request
|
||||
*/
|
||||
export interface Response<TYPE_OF_BODY> extends HttpResponse<TYPE_OF_BODY> {
|
||||
body: TYPE_OF_BODY;
|
||||
statusCode: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* HttpClient that is based on angular's HttpClient (@TODO: move it to provider or independent package)
|
||||
*/
|
||||
@Injectable()
|
||||
export class StAppsWebHttpClient implements HttpClientInterface {
|
||||
constructor(private http: HttpClient) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Make a request
|
||||
* @param requestConfig Configuration of the request
|
||||
*/
|
||||
async request<TYPE_OF_BODY>(
|
||||
requestConfig: HttpClientRequest,
|
||||
): Promise<Response<TYPE_OF_BODY>> {
|
||||
const options: {
|
||||
[key: string]: any;
|
||||
observe: 'response';
|
||||
} = {
|
||||
body: {},
|
||||
observe: 'response',
|
||||
responseType: 'json',
|
||||
};
|
||||
|
||||
if (typeof requestConfig.body !== 'undefined') {
|
||||
options.body = requestConfig.body;
|
||||
}
|
||||
|
||||
if (typeof requestConfig.headers !== 'undefined') {
|
||||
options.headers = requestConfig.headers;
|
||||
}
|
||||
|
||||
try {
|
||||
const response: HttpResponse<TYPE_OF_BODY> = await this.http.request<TYPE_OF_BODY>(
|
||||
requestConfig.method || 'GET', requestConfig.url.toString(), options)
|
||||
.toPromise();
|
||||
return Object.assign(response, {statusCode: response.status, body: response.body || {}});
|
||||
} catch (err) {
|
||||
throw Error(err);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Generated class for the DataProvider provider.
|
||||
|
||||
See https://angular.io/guide/dependency-injection for more info on providers
|
||||
and Angular DI.
|
||||
*/
|
||||
@Injectable()
|
||||
export class DataProvider {
|
||||
constructor() {
|
||||
// @TODO
|
||||
}
|
||||
}
|
||||
68
src/app/modules/data/detail/data-detail.component.spec.ts
Normal file
68
src/app/modules/data/detail/data-detail.component.spec.ts
Normal file
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {CUSTOM_ELEMENTS_SCHEMA} from '@angular/core';
|
||||
import {async, ComponentFixture, TestBed} from '@angular/core/testing';
|
||||
import {ActivatedRoute, RouterModule} from '@angular/router';
|
||||
import {DataRoutingModule} from '../data-routing.module';
|
||||
import {DataListComponent} from '../list/data-list.component';
|
||||
import {DataDetailComponent} from './data-detail.component';
|
||||
|
||||
describe('DataDetailComponent', () => {
|
||||
let comp: DataDetailComponent;
|
||||
let fixture: ComponentFixture<DataDetailComponent>;
|
||||
let detailPage: HTMLElement;
|
||||
|
||||
// @Component({ selector: 'stapps-data-list-item', template: '' })
|
||||
// class DataListItemComponent {
|
||||
// @Input() item;
|
||||
// }
|
||||
|
||||
const fakeActivatedRoute = {
|
||||
snapshot: {
|
||||
paramMap: {
|
||||
get: (url) => {
|
||||
return url;
|
||||
}
|
||||
}
|
||||
}
|
||||
} as ActivatedRoute;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [DataListComponent, DataDetailComponent],
|
||||
imports: [RouterModule, DataRoutingModule],
|
||||
providers: [{provide: ActivatedRoute, useValue: fakeActivatedRoute}],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(async() => {
|
||||
fixture = await TestBed.createComponent(DataDetailComponent);
|
||||
comp = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create component', () =>
|
||||
expect(comp).toBeDefined(),
|
||||
);
|
||||
|
||||
it('should have apropriate title', () => {
|
||||
detailPage = fixture.nativeElement;
|
||||
const title: HTMLIonTitleElement | null = detailPage.querySelector('ion-title');
|
||||
expect(title).not.toBe(null);
|
||||
expect(title!.innerText).toContain('Detailansicht');
|
||||
});
|
||||
});
|
||||
41
src/app/modules/data/detail/data-detail.component.ts
Normal file
41
src/app/modules/data/detail/data-detail.component.ts
Normal file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {Component} from '@angular/core';
|
||||
import {ActivatedRoute} from '@angular/router';
|
||||
import {SCThings} from '@openstapps/core';
|
||||
|
||||
@Component({
|
||||
selector: 'stapps-data-detail',
|
||||
templateUrl: 'data-detail.html'
|
||||
})
|
||||
export class DataDetailComponent {
|
||||
item: SCThings;
|
||||
constructor(private route: ActivatedRoute) {
|
||||
this.item = {
|
||||
categories: ['main dish'],
|
||||
name: 'Demo-Name',
|
||||
origin: {
|
||||
indexed: '2018-09-11T12:30:00Z',
|
||||
name: 'Dummy',
|
||||
},
|
||||
type: 'dish',
|
||||
uid: '',
|
||||
};
|
||||
}
|
||||
ngOnInit() {
|
||||
this.item.uid = this.route.snapshot.paramMap.get('uid') || '';
|
||||
this.item.description = 'Demo Beschreibung für das Item mit der UID ' + this.item.uid;
|
||||
}
|
||||
}
|
||||
21
src/app/modules/data/detail/data-detail.html
Normal file
21
src/app/modules/data/detail/data-detail.html
Normal file
@@ -0,0 +1,21 @@
|
||||
<ion-header>
|
||||
<ion-toolbar>
|
||||
<ion-buttons slot="start">
|
||||
<ion-back-button></ion-back-button>
|
||||
<ion-menu-button></ion-menu-button>
|
||||
</ion-buttons>
|
||||
<ion-title>Detailansicht</ion-title>
|
||||
</ion-toolbar>
|
||||
</ion-header>
|
||||
|
||||
<ion-content padding>
|
||||
<stapps-data-list-item [item]="item"></stapps-data-list-item>
|
||||
|
||||
<div [ngSwitch]="item.type">
|
||||
<stapps-dish-detail-content [item]="item" *ngSwitchCase="'dish'"></stapps-dish-detail-content>
|
||||
|
||||
<span *ngSwitchDefault>
|
||||
<p *ngIf="item.description">{{item.description}}</p>
|
||||
</span>
|
||||
</div>
|
||||
</ion-content>
|
||||
3
src/app/modules/data/detail/data-detail.scss
Normal file
3
src/app/modules/data/detail/data-detail.scss
Normal file
@@ -0,0 +1,3 @@
|
||||
stapps-data-detail {
|
||||
|
||||
}
|
||||
34
src/app/modules/data/list/data-list-item.component.ts
Normal file
34
src/app/modules/data/list/data-list-item.component.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {Component, Input, OnInit} from '@angular/core';
|
||||
import {SCThings} from '@openstapps/core';
|
||||
|
||||
@Component({
|
||||
selector: 'stapps-data-list-item',
|
||||
templateUrl: 'data-list-item.html'
|
||||
})
|
||||
export class DataListItem implements OnInit {
|
||||
@Input() item: SCThings;
|
||||
|
||||
constructor() {
|
||||
// noop
|
||||
// this.item is not available yet
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
// noop
|
||||
// this.item is available now - the template is loaded and compiled
|
||||
}
|
||||
}
|
||||
17
src/app/modules/data/list/data-list-item.html
Normal file
17
src/app/modules/data/list/data-list-item.html
Normal file
@@ -0,0 +1,17 @@
|
||||
<ion-item text-wrap button="true" lines="inset" [routerLink]="['/data-detail', item.uid]">
|
||||
<ion-thumbnail slot="start">
|
||||
<img src="../../../assets/imgs/logo.png">
|
||||
</ion-thumbnail>
|
||||
<ion-label [ngSwitch]="item.type" lines="full">
|
||||
<div>
|
||||
<stapps-dish-list-item [item]="item" *ngSwitchCase="'Dish'"></stapps-dish-list-item>
|
||||
|
||||
<stapps-event-list-item [item]="item" *ngSwitchCase="'Event'"></stapps-event-list-item>
|
||||
|
||||
<span *ngSwitchDefault>
|
||||
{{item.name}}<br/>
|
||||
<ion-note>{{item.type}}</ion-note>
|
||||
</span>
|
||||
</div>
|
||||
</ion-label>
|
||||
</ion-item>
|
||||
101
src/app/modules/data/list/data-list.component.ts
Normal file
101
src/app/modules/data/list/data-list.component.ts
Normal file
@@ -0,0 +1,101 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {Component} from '@angular/core';
|
||||
import {AlertController, LoadingController} from '@ionic/angular';
|
||||
import {Client} from '@openstapps/api/lib/client';
|
||||
import {SCThing} from '@openstapps/core';
|
||||
import {Subject} from 'rxjs';
|
||||
import {debounceTime, distinctUntilChanged} from 'rxjs/operators';
|
||||
import {StAppsWebHttpClient} from '../data.provider';
|
||||
|
||||
@Component({
|
||||
selector: 'stapps-data-list',
|
||||
templateUrl: 'data-list.html',
|
||||
})
|
||||
export class DataListComponent {
|
||||
selectedItem: any;
|
||||
items: SCThing[] = [];
|
||||
|
||||
client: Client;
|
||||
|
||||
size: number = 30;
|
||||
from: number = 0;
|
||||
|
||||
query: string;
|
||||
queryChanged: Subject<string> = new Subject<string>();
|
||||
|
||||
loading: HTMLIonLoadingElement;
|
||||
|
||||
constructor(private loadingController: LoadingController,
|
||||
private alertController: AlertController,
|
||||
swHttpClient: StAppsWebHttpClient) {
|
||||
this.client = new Client(swHttpClient, 'https://stappsbe01.innocampus.tu-berlin.de', '1.0.6');
|
||||
|
||||
this.queryChanged
|
||||
.pipe(
|
||||
debounceTime(1000),
|
||||
distinctUntilChanged())
|
||||
.subscribe((model) => {
|
||||
this.from = 0;
|
||||
this.query = model;
|
||||
this.items = [];
|
||||
this.fetchItems();
|
||||
});
|
||||
|
||||
this.fetchItems();
|
||||
}
|
||||
|
||||
search(query: string) {
|
||||
this.queryChanged.next(query);
|
||||
}
|
||||
|
||||
async loadMore(event: any): Promise<any> {
|
||||
this.from += this.size;
|
||||
await this.fetchItems();
|
||||
event.target.complete();
|
||||
return;
|
||||
}
|
||||
|
||||
private async fetchItems(): Promise<any> {
|
||||
if (this.from === 0) {
|
||||
this.loading = await this.loadingController.create();
|
||||
await this.loading.present();
|
||||
}
|
||||
|
||||
return this.client.search({
|
||||
from: this.from,
|
||||
query: this.query,
|
||||
size: this.size
|
||||
} as any).then((result) => {
|
||||
result.data.forEach((item) => {
|
||||
this.items.push(item);
|
||||
});
|
||||
|
||||
if (this.from === 0) {
|
||||
this.loading.dismiss();
|
||||
}
|
||||
}, async (err) => {
|
||||
const alert: HTMLIonAlertElement = await this.alertController.create({
|
||||
buttons: ['Dismiss'],
|
||||
header: 'Error',
|
||||
subHeader: err.message,
|
||||
});
|
||||
|
||||
await alert.present();
|
||||
|
||||
await this.loading.dismiss();
|
||||
});
|
||||
}
|
||||
}
|
||||
22
src/app/modules/data/list/data-list.html
Normal file
22
src/app/modules/data/list/data-list.html
Normal file
@@ -0,0 +1,22 @@
|
||||
<ion-header>
|
||||
<ion-toolbar>
|
||||
<ion-buttons slot="start">
|
||||
<ion-back-button></ion-back-button>
|
||||
<ion-menu-button></ion-menu-button>
|
||||
</ion-buttons>
|
||||
|
||||
<ion-searchbar (ngModelChange)="search($event)" [(ngModel)]="query"></ion-searchbar>
|
||||
|
||||
<!--<ion-title>List</ion-title>-->
|
||||
</ion-toolbar>
|
||||
</ion-header>
|
||||
|
||||
<ion-content>
|
||||
<ion-list *ngFor="let item of items">
|
||||
<stapps-data-list-item [item]="item"></stapps-data-list-item>
|
||||
</ion-list>
|
||||
|
||||
<ion-infinite-scroll (ionInfinite)="loadMore($event)">
|
||||
<ion-infinite-scroll-content></ion-infinite-scroll-content>
|
||||
</ion-infinite-scroll>
|
||||
</ion-content>
|
||||
3
src/app/modules/data/list/data-list.scss
Normal file
3
src/app/modules/data/list/data-list.scss
Normal file
@@ -0,0 +1,3 @@
|
||||
stapps-data-list {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {Component, Input} from '@angular/core';
|
||||
import {LangChangeEvent, TranslateService} from '@ngx-translate/core';
|
||||
import {SCDish, SCDishMeta, SCLanguageName, SCThingMeta} from '@openstapps/core';
|
||||
|
||||
@Component({
|
||||
selector: 'stapps-dish-detail-content',
|
||||
templateUrl: 'dish-detail-content.html'
|
||||
})
|
||||
export class DishDetailContentComponent {
|
||||
@Input() item: SCDish;
|
||||
language: SCLanguageName;
|
||||
meta: SCThingMeta;
|
||||
|
||||
constructor(translateService: TranslateService) {
|
||||
this.language = translateService.currentLang as SCLanguageName;
|
||||
|
||||
this.meta = SCDishMeta;
|
||||
|
||||
translateService.onLangChange.subscribe((event: LangChangeEvent) => {
|
||||
this.language = event.lang as SCLanguageName;
|
||||
});
|
||||
}
|
||||
}
|
||||
47
src/app/modules/data/types/dish/dish-detail-content.html
Normal file
47
src/app/modules/data/types/dish/dish-detail-content.html
Normal file
@@ -0,0 +1,47 @@
|
||||
<ion-card *ngIf="item.description">
|
||||
<ion-card-header>{{meta.getFieldTranslation(language, 'description')}}</ion-card-header>
|
||||
<ion-card-content>{{item.description}}</ion-card-content>
|
||||
</ion-card>
|
||||
|
||||
<ion-card *ngIf="item.categories">
|
||||
<ion-card-header>{{meta.getFieldTranslation(language, 'categories')}}</ion-card-header>
|
||||
<ion-card-content>{{item.categories.join(', ')}}</ion-card-content>
|
||||
</ion-card>
|
||||
|
||||
<ion-card *ngIf="item.characteristics">
|
||||
<ion-card-header>{{meta.getFieldTranslation(language, 'characteristics')}}</ion-card-header>
|
||||
<ion-card-content>{{item.characteristics.join(', ')}}</ion-card-content>
|
||||
</ion-card>
|
||||
|
||||
<ion-card *ngIf="item.additives">
|
||||
<ion-card-header>{{meta.getFieldTranslation(language, 'additives')}}</ion-card-header>
|
||||
<ion-card-content>{{item.additives.join(', ')}}</ion-card-content>
|
||||
</ion-card>
|
||||
|
||||
<ion-card *ngIf="item.place">
|
||||
<ion-card-header>{{meta.getFieldTranslation(language, 'place')}}</ion-card-header>
|
||||
<ion-card-content><a>{{item.place.name}}</a></ion-card-content>
|
||||
</ion-card>
|
||||
|
||||
<ion-card>
|
||||
<ion-card-header>{{meta.getFieldTranslation(language, 'price')}}</ion-card-header>
|
||||
<ion-card-content>
|
||||
<ion-grid>
|
||||
<ion-row *ngFor="let offer of item.offers">
|
||||
<ion-col>
|
||||
{{offer.universityRole.name}}
|
||||
</ion-col>
|
||||
<ion-col>{{offer.price}}</ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col>Standard / Gäste</ion-col>
|
||||
<ion-col>{{item.price}}</ion-col>
|
||||
</ion-row>
|
||||
</ion-grid>
|
||||
</ion-card-content>
|
||||
</ion-card>
|
||||
|
||||
<ion-card *ngIf="item.availabilityStarts">
|
||||
<ion-card-header>Verfügbarkeit</ion-card-header>
|
||||
<ion-card-content>{{item.availabilityStarts | date}}</ion-card-content>
|
||||
</ion-card>
|
||||
25
src/app/modules/data/types/dish/dish-list-item.component.ts
Normal file
25
src/app/modules/data/types/dish/dish-list-item.component.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {Component, Input} from '@angular/core';
|
||||
import {SCDish} from '@openstapps/core';
|
||||
import {DataListItem} from '../../list/data-list-item.component';
|
||||
|
||||
@Component({
|
||||
selector: 'stapps-dish-list-item',
|
||||
templateUrl: 'dish-list-item.html',
|
||||
})
|
||||
export class DishListItem extends DataListItem {
|
||||
@Input() item: SCDish;
|
||||
}
|
||||
6
src/app/modules/data/types/dish/dish-list-item.html
Normal file
6
src/app/modules/data/types/dish/dish-list-item.html
Normal file
@@ -0,0 +1,6 @@
|
||||
{{item.name}}<br/>
|
||||
<ion-note>
|
||||
{{item.price}}
|
||||
{{item.categories.join(',')}}
|
||||
{{item.place.name}}
|
||||
</ion-note>
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {Component, Input} from '@angular/core';
|
||||
import {SCDateSeries} from '@openstapps/core';
|
||||
import {DataListItem} from '../../list/data-list-item.component';
|
||||
|
||||
@Component({
|
||||
selector: 'stapps-event-list-item',
|
||||
templateUrl: 'event-list-item.html'
|
||||
})
|
||||
export class EventListItemComponent extends DataListItem {
|
||||
@Input() item: SCDateSeries;
|
||||
}
|
||||
7
src/app/modules/data/types/event/event-list-item.html
Normal file
7
src/app/modules/data/types/event/event-list-item.html
Normal file
@@ -0,0 +1,7 @@
|
||||
{{item.name}}<br/>
|
||||
|
||||
<ion-note>
|
||||
{{item.subProperties.semester}}
|
||||
{{item.categories.join(', ')}}
|
||||
{{item.startDate}} - {{item.endDate}}
|
||||
</ion-note>
|
||||
Reference in New Issue
Block a user