This commit is contained in:
parent
6b55c438f6
commit
347875390f
|
@ -15,6 +15,9 @@ import {EventDetailComponent} from './components/event-detail/event-detail.compo
|
||||||
import {HttpClientModule} from '@angular/common/http';
|
import {HttpClientModule} from '@angular/common/http';
|
||||||
import {FormsModule} from '@angular/forms';
|
import {FormsModule} from '@angular/forms';
|
||||||
import {ApiService} from './services/api/api.service';
|
import {ApiService} from './services/api/api.service';
|
||||||
|
import {MatTooltipModule} from '@angular/material/tooltip';
|
||||||
|
import {UtilitiesService} from './services/utils/utilities.service';
|
||||||
|
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: [
|
declarations: [
|
||||||
|
@ -33,9 +36,11 @@ import {ApiService} from './services/api/api.service';
|
||||||
AppRouting,
|
AppRouting,
|
||||||
HttpClientModule,
|
HttpClientModule,
|
||||||
NgbModule,
|
NgbModule,
|
||||||
FormsModule
|
FormsModule,
|
||||||
|
MatTooltipModule,
|
||||||
|
BrowserAnimationsModule
|
||||||
],
|
],
|
||||||
providers: [ApiService],
|
providers: [ApiService, UtilitiesService],
|
||||||
bootstrap: [AppComponent]
|
bootstrap: [AppComponent]
|
||||||
})
|
})
|
||||||
export class AppModule {
|
export class AppModule {
|
||||||
|
|
|
@ -13,19 +13,19 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Created:</td>
|
<td>Created:</td>
|
||||||
<td> {{latestFullChange.new_created}}</td>
|
<td> {{getDateTime(latestFullChange.new_created.toString())}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Start:</td>
|
<td>Start:</td>
|
||||||
<td> {{latestFullChange.new_start}}</td>
|
<td> {{getDateTime(latestFullChange.new_start.toString())}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>End:</td>
|
<td>End:</td>
|
||||||
<td> {{latestFullChange.new_end}}</td>
|
<td> {{getDateTime(latestFullChange.new_end.toString())}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Last modified:</td>
|
<td>Last modified:</td>
|
||||||
<td> {{latestFullChange.new_last_modified}}</td>
|
<td> {{getDateTime(latestFullChange.new_last_modified.toString())}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Location:</td>
|
<td>Location:</td>
|
||||||
|
@ -52,7 +52,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tbody *ngFor="let change of changeDetails">
|
<tbody *ngFor="let change of changeDetails">
|
||||||
<tr>
|
<tr>
|
||||||
<td class="change-timestamp">{{change.timestamp}}</td>
|
<td class="change-timestamp">{{getDateTime(change.timestamp.toString())}}</td>
|
||||||
<td class="change-summary">{{change.summary}}</td>
|
<td class="change-summary">{{change.summary}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr *ngIf="change.hasDetails">
|
<tr *ngIf="change.hasDetails">
|
||||||
|
|
|
@ -3,6 +3,7 @@ import {ActivatedRoute} from '@angular/router';
|
||||||
import {Event} from '../../models/event';
|
import {Event} from '../../models/event';
|
||||||
import {ApiService} from '../../services/api/api.service';
|
import {ApiService} from '../../services/api/api.service';
|
||||||
import {Change} from '../../models/change';
|
import {Change} from '../../models/change';
|
||||||
|
import {UtilitiesService} from '../../services/utils/utilities.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-event-detail',
|
selector: 'app-event-detail',
|
||||||
|
@ -18,7 +19,8 @@ export class EventDetailComponent implements OnInit {
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private route: ActivatedRoute,
|
private route: ActivatedRoute,
|
||||||
private apiService: ApiService
|
private apiService: ApiService,
|
||||||
|
private utilities: UtilitiesService
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,6 +124,11 @@ export class EventDetailComponent implements OnInit {
|
||||||
closeTab(): void {
|
closeTab(): void {
|
||||||
window.close();
|
window.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getDateTime(date: string): string {
|
||||||
|
console.log(date);
|
||||||
|
return this.utilities.getDateTimeFromString(date);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ChangeDetail {
|
export interface ChangeDetail {
|
||||||
|
|
|
@ -4,6 +4,10 @@
|
||||||
margin: .5em;
|
margin: .5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.event-card:hover {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
.event-card-lecture {
|
.event-card-lecture {
|
||||||
background-color: #0A62D0;
|
background-color: #0A62D0;
|
||||||
}
|
}
|
||||||
|
@ -15,3 +19,8 @@
|
||||||
.event-card-blocker {
|
.event-card-blocker {
|
||||||
background-color: dimgrey;
|
background-color: dimgrey;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.click-hint {
|
||||||
|
font-size: 80%;
|
||||||
|
color: black;
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<div class="event-card {{eventTypeClass}}" (click)="openEventDetails()">
|
<div class="event-card {{eventTypeClass}}" (click)="openEventDetails()">
|
||||||
Titel: {{event.latest_event_summary}}
|
{{event.latest_event_summary}}<br>
|
||||||
Start: {{event.latest_start_date}}
|
Start: {{getTime()}}<br>
|
||||||
Gelöscht: {{event.changes[event.changes.length-1].is_deleted}}
|
Deleted: {{event.changes[event.changes.length-1].is_deleted}}<br>
|
||||||
|
<div class="click-hint">Click for change details</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -2,6 +2,7 @@ import {Component, Input, OnInit} from '@angular/core';
|
||||||
import {Event} from '../../models/event';
|
import {Event} from '../../models/event';
|
||||||
import {Change} from '../../models/change';
|
import {Change} from '../../models/change';
|
||||||
import {Router} from '@angular/router';
|
import {Router} from '@angular/router';
|
||||||
|
import {UtilitiesService} from '../../services/utils/utilities.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-event',
|
selector: 'app-event',
|
||||||
|
@ -15,7 +16,8 @@ export class EventComponent implements OnInit {
|
||||||
latestFullChange: Change = {} as Change;
|
latestFullChange: Change = {} as Change;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private router: Router
|
private router: Router,
|
||||||
|
private utilities: UtilitiesService
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,4 +45,8 @@ export class EventComponent implements OnInit {
|
||||||
openEventDetails() {
|
openEventDetails() {
|
||||||
this.router.navigate([]).then(result => { window.open('/eventDetails/'+this.event.event_uid, '_blank'); });
|
this.router.navigate([]).then(result => { window.open('/eventDetails/'+this.event.event_uid, '_blank'); });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getTime(): string {
|
||||||
|
return this.utilities.getTimeFromString(this.latestFullChange.new_start.toString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
16
Frontend/src/app/services/utils/utilities.service.spec.ts
Normal file
16
Frontend/src/app/services/utils/utilities.service.spec.ts
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
import { TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { UtilitiesService } from './utilities.service';
|
||||||
|
|
||||||
|
describe('UtilitiesService', () => {
|
||||||
|
let service: UtilitiesService;
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
TestBed.configureTestingModule({});
|
||||||
|
service = TestBed.inject(UtilitiesService);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should be created', () => {
|
||||||
|
expect(service).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
34
Frontend/src/app/services/utils/utilities.service.ts
Normal file
34
Frontend/src/app/services/utils/utilities.service.ts
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
import {Injectable} from '@angular/core';
|
||||||
|
|
||||||
|
@Injectable({
|
||||||
|
providedIn: 'root'
|
||||||
|
})
|
||||||
|
export class UtilitiesService {
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
}
|
||||||
|
|
||||||
|
getTimeFromDate(date: Date): string {
|
||||||
|
return date.getHours().toString().padStart(2, '0') + ':' + date.getMinutes().toString().padStart(2, '0');
|
||||||
|
}
|
||||||
|
|
||||||
|
getTimeFromString(dateString: string): string {
|
||||||
|
let date = new Date(dateString);
|
||||||
|
return this.getTimeFromDate(date);
|
||||||
|
}
|
||||||
|
|
||||||
|
getDateTimeFromDate(date: Date): string {
|
||||||
|
let year = date.getFullYear().toString();
|
||||||
|
let month = date.getMonth().toString().padStart(2, '0');
|
||||||
|
let day = date.getDate().toString().padStart(2, '0');
|
||||||
|
let hour = date.getHours().toString().padStart(2, '0');
|
||||||
|
let minute = date.getMinutes().toString().padStart(2, '0');
|
||||||
|
|
||||||
|
return day + '.' + month + '.' + year + ', ' + hour + ':' + minute;
|
||||||
|
}
|
||||||
|
|
||||||
|
getDateTimeFromString(dateString: string): string {
|
||||||
|
let date = new Date(dateString);
|
||||||
|
return this.getDateTimeFromDate(date);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user