This commit is contained in:
parent
59682c3091
commit
6b55c438f6
|
@ -15,8 +15,6 @@ 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 {MatDialogModule} from '@angular/material/dialog';
|
|
||||||
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
|
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: [
|
declarations: [
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.switchWeekButton {
|
.switchWeekButton {
|
||||||
background-color: dimgrey; /* Green */
|
background-color: dimgrey;
|
||||||
border: none;
|
border: none;
|
||||||
color: #E0E5E9;
|
color: #E0E5E9;
|
||||||
padding: .15em .5em;
|
padding: .15em .5em;
|
||||||
|
@ -13,6 +13,24 @@
|
||||||
margin: .5em;
|
margin: .5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.showDeletedBtn {
|
||||||
|
border: none;
|
||||||
|
color: #E0E5E9;
|
||||||
|
padding: .15em .5em;
|
||||||
|
text-align: center;
|
||||||
|
display: inline-block;
|
||||||
|
border-radius: .5em;
|
||||||
|
margin: .5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.show {
|
||||||
|
background-color: green;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hide {
|
||||||
|
background-color: darkred;
|
||||||
|
}
|
||||||
|
|
||||||
.datePickerDropdown {
|
.datePickerDropdown {
|
||||||
background-color: dimgrey;
|
background-color: dimgrey;
|
||||||
border: none;
|
border: none;
|
||||||
|
|
|
@ -17,5 +17,6 @@
|
||||||
</option>
|
</option>
|
||||||
</select>
|
</select>
|
||||||
<button (click)="switchToToday()" class="switchWeekButton">Today</button>
|
<button (click)="switchToToday()" class="switchWeekButton">Today</button>
|
||||||
|
<button (click)="switchShowDeletedEvents()" class="showDeletedBtn {{switchDeletedBtnClass}}">{{showingDeletedBtnText}}</button>
|
||||||
<button (click)="switchToNextWeek()" class="switchWeekButton">Next week >></button>
|
<button (click)="switchToNextWeek()" class="switchWeekButton">Next week >></button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -16,6 +16,11 @@ export class DatepickerComponent implements OnInit {
|
||||||
|
|
||||||
itIsWednesday: boolean = false;
|
itIsWednesday: boolean = false;
|
||||||
|
|
||||||
|
internalShowDeletedEvents: boolean = true;
|
||||||
|
@Output() showDeletedEvents = new EventEmitter<boolean>();
|
||||||
|
switchDeletedBtnClass: string = 'show';
|
||||||
|
showingDeletedBtnText: string = 'Showing deleted events';
|
||||||
|
|
||||||
@Output() selectedMonday = new EventEmitter<string>();
|
@Output() selectedMonday = new EventEmitter<string>();
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
|
@ -190,4 +195,18 @@ export class DatepickerComponent implements OnInit {
|
||||||
this.selectedDay = currentDate.getDate().toString().padStart(2, '0');
|
this.selectedDay = currentDate.getDate().toString().padStart(2, '0');
|
||||||
this.handleDateChange();
|
this.handleDateChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switchShowDeletedEvents() {
|
||||||
|
if(this.internalShowDeletedEvents) {
|
||||||
|
this.internalShowDeletedEvents = false;
|
||||||
|
this.showDeletedEvents.emit(false);
|
||||||
|
this.switchDeletedBtnClass = 'hide';
|
||||||
|
this.showingDeletedBtnText = 'Deleted events hidden';
|
||||||
|
} else {
|
||||||
|
this.internalShowDeletedEvents = true;
|
||||||
|
this.showDeletedEvents.emit(true);
|
||||||
|
this.switchDeletedBtnClass = 'show';
|
||||||
|
this.showingDeletedBtnText = 'Showing deleted events';
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<h1>{{weekDayName}}</h1>
|
<h1>{{weekDayName}}</h1>
|
||||||
<div *ngFor="let event of events">
|
<div *ngFor="let event of events">
|
||||||
<app-event [event]="event"></app-event>
|
<app-event [event]="event" *ngIf="!(!showDeletedEvents && event.changes[event.changes.length-1].is_deleted)"></app-event>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -9,6 +9,7 @@ import {Event} from '../../models/event';
|
||||||
export class DayComponent implements OnInit {
|
export class DayComponent implements OnInit {
|
||||||
@Input() events: Event[] = [];
|
@Input() events: Event[] = [];
|
||||||
@Input() dayOfWeek: number = 0;
|
@Input() dayOfWeek: number = 0;
|
||||||
|
@Input() showDeletedEvents: boolean = true;
|
||||||
|
|
||||||
weekDayName: string = '';
|
weekDayName: string = '';
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<div id="week" class="container-fluid">
|
<div id="week" class="container-fluid">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<app-day *ngFor="let day of eventsPerDay" [events]="day" [dayOfWeek]="eventsPerDay.indexOf(day)" class="col"></app-day>
|
<app-day *ngFor="let day of eventsPerDay" [events]="day" [dayOfWeek]="eventsPerDay.indexOf(day)" [showDeletedEvents]="showDeletedEvents" class="col"></app-day>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -8,6 +8,7 @@ import {Event} from '../../models/event';
|
||||||
})
|
})
|
||||||
export class WeekComponent implements OnInit {
|
export class WeekComponent implements OnInit {
|
||||||
@Input() events: Event[] = [];
|
@Input() events: Event[] = [];
|
||||||
|
@Input() showDeletedEvents: boolean = true;
|
||||||
eventsPerDay: Event[][] = [];
|
eventsPerDay: Event[][] = [];
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
<header>
|
<header>
|
||||||
<p>TINF19B4 RaPla Changes</p>
|
<p>TINF19B4 RaPla Changes</p>
|
||||||
<app-datepicker (selectedMonday)="dateChangedFromPicker($event)"></app-datepicker>
|
<app-datepicker (selectedMonday)="dateChangedFromPicker($event)" (showDeletedEvents)="showDeletedChangedFromPicker($event)"></app-datepicker>
|
||||||
</header>
|
</header>
|
||||||
<div id="content">
|
<div id="content">
|
||||||
<app-week [events]="events"></app-week>
|
<app-week [events]="events" [showDeletedEvents]="showDeletedEvents"></app-week>
|
||||||
</div>
|
</div>
|
||||||
<footer class="fixed-bottom start-50 translate-middle">
|
<footer class="fixed-bottom start-50 translate-middle">
|
||||||
Copyright © 2021 - Patrick Müller
|
Copyright © 2021 - Patrick Müller
|
||||||
|
|
|
@ -12,6 +12,7 @@ export class LandingpageComponent implements OnInit {
|
||||||
eventCount: number = 0;
|
eventCount: number = 0;
|
||||||
|
|
||||||
selectedDate: string = '';
|
selectedDate: string = '';
|
||||||
|
showDeletedEvents: boolean = true;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private apiService: ApiService
|
private apiService: ApiService
|
||||||
|
@ -32,4 +33,8 @@ export class LandingpageComponent implements OnInit {
|
||||||
this.selectedDate = newDate;
|
this.selectedDate = newDate;
|
||||||
this.getEvents();
|
this.getEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
showDeletedChangedFromPicker(newShowDeleted: boolean) {
|
||||||
|
this.showDeletedEvents = newShowDeleted;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user