-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from klassecloud/Kalender
Kalender
- Loading branch information
Showing
16 changed files
with
369 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
h3 { | ||
margin: 0 0 10px; | ||
} | ||
|
||
pre { | ||
background-color: #f5f5f5; | ||
padding: 15px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
|
||
<button (click)="toggleWeekends()">toggle weekends</button> | ||
<button (click)="toggleBar()">toggle Bar</button> | ||
<button (click)="activateStartDate()">activate start Date</button> | ||
<button (click)="activateEndDate()">activate end Date</button> | ||
|
||
<full-calendar [options]="calendarOptions" ></full-calendar> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { CalendarComponent } from './calendar.component'; | ||
import {async, ComponentFixture, TestBed} from '@angular/core/testing'; | ||
|
||
describe('CalendarComponent', () => { | ||
let component: CalendarComponent; | ||
let fixture: ComponentFixture<CalendarComponent>; | ||
|
||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [ CalendarComponent ] | ||
}) | ||
.compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(CalendarComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
import {Component, Input, OnInit} from '@angular/core'; | ||
import { CalendarOptions } from '@fullcalendar/angular'; | ||
import {Task_Interface} from '../task-interface'; | ||
import { Tasks } from '../task-data'; | ||
|
||
|
||
@Component({ | ||
selector: 'app-root', | ||
templateUrl: './calendar.component.html', | ||
styleUrls: ['./calendar.component.scss'] | ||
}) | ||
export class CalendarComponent implements OnInit{ | ||
|
||
@Input() tasks: Task_Interface[] = []; | ||
activatebar = false; | ||
activateend = false; | ||
activatestart = false; | ||
|
||
// @ts-ignore | ||
calendarOptions: CalendarOptions = { | ||
initialView: 'dayGridMonth', | ||
weekends: true, // initial value | ||
events: [], | ||
}; | ||
|
||
toggleWeekends() { | ||
this.calendarOptions.weekends = !this.calendarOptions.weekends; // toggle the boolean! | ||
} | ||
showCalendar() | ||
{ | ||
this.tasks = Tasks; | ||
const name = []; | ||
const start = []; | ||
const end = []; | ||
const color = []; | ||
let zaehler = 0; | ||
for (let index = 0; index < this.tasks.length; index++) | ||
{ | ||
if (this.activatestart) | ||
{ | ||
zaehler++; | ||
name.push('Anfang: ' + Tasks[index].name); | ||
start.push(Tasks[index].start); | ||
end.push(Tasks[index].start); | ||
if (Tasks[index].uebung) { | ||
color.push('green'); | ||
} | ||
else { color.push('purple'); } | ||
} | ||
if (this.activateend) | ||
{ | ||
zaehler++; | ||
name.push('Abgabe: ' + Tasks[index].name); | ||
start.push(Tasks[index].end); | ||
end.push(Tasks[index].end); | ||
if (Tasks[index].uebung) { | ||
color.push('green'); | ||
} | ||
else { color.push('purple'); } | ||
} | ||
if (this.activatebar) | ||
{ | ||
zaehler++; | ||
name.push(Tasks[index].name); | ||
start.push(Tasks[index].start); | ||
end.push(Tasks[index].end); | ||
if (Tasks[index].uebung) { | ||
color.push('green'); | ||
} else { | ||
color.push('purple'); | ||
} | ||
} | ||
} | ||
const newEvents = []; | ||
// tslint:disable-next-line:prefer-for-of | ||
for (let index = 0; index <= zaehler; index++) | ||
{ | ||
newEvents.push({ title: name.pop(), color: color.pop(), start: start.pop(), end: end.pop() }); | ||
} | ||
this.calendarOptions.events = newEvents; | ||
} | ||
activateEndDate() | ||
{ | ||
this.activateend = !this.activateend; | ||
this.showCalendar(); | ||
} | ||
|
||
activateStartDate() | ||
{ | ||
this.activatestart = !this.activatestart; | ||
this.showCalendar(); | ||
} | ||
|
||
toggleBar() | ||
{ | ||
this.activatebar = !this.activatebar; | ||
this.showCalendar(); | ||
} | ||
constructor() { | ||
} | ||
ngOnInit() { | ||
this.toggleBar(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.