Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kalender #12

Merged
merged 9 commits into from
Jul 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.

/node_modules
.idea/workspace.xml
.idea/vcs.xml
.idea/modules.xml
.idea/misc.xml
.idea/inspectionProfiles/Project_Default.xml
.idea/frontendTeacher.iml
# compiled output
/dist
/tmp
Expand Down
81 changes: 79 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
"@angular/platform-browser": "~9.1.7",
"@angular/platform-browser-dynamic": "~9.1.7",
"@angular/router": "~9.1.7",
"@fullcalendar/angular": "^5.1.0",
"@fullcalendar/daygrid": "^5.1.0",
"@fullcalendar/interaction": "^5.1.0",
"ng-katex": "^2.0.3",
"rxjs": "~6.5.4",
"tslib": "^1.10.0",
Expand Down
4 changes: 3 additions & 1 deletion src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ import { PreloadAllModules, Routes, RouterModule } from '@angular/router';
import { TaskListComponent } from './task-list/task-list.component';
import { TaskComponent } from './task/task.component';
import { EditTaskComponent } from './edit-task/edit-task.component';
import { CalendarComponent } from './calendar/calendar.component';
import { TaskDetailsComponent } from './task-details/task-details.component';

const routes: Routes = [
{path: '', redirectTo: "tasklist", pathMatch: 'full'},
{path: '', redirectTo: 'tasklist', pathMatch: 'full'},
{path: 'tasklist', component: TaskListComponent},
{path: 'newtask', component: EditTaskComponent},
{path: 'edittask/:id', component: EditTaskComponent},
{path: 'calendar', component: CalendarComponent},
{path: 'taskdetails/:id', component: TaskDetailsComponent},
];

Expand Down
3 changes: 2 additions & 1 deletion src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
<br>

<button [routerLink]="'/newtask'">New task</button>
<button [routerLink]="'/tasklist'">Tasklist</button>
<button [routerLink]="'/tasklist'">Tasklist</button>
<button [routerLink]="'/calendar'">calendar</button>
19 changes: 16 additions & 3 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,32 +1,43 @@
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';

import { FullCalendarModule } from '@fullcalendar/angular';
import dayGridPlugin from '@fullcalendar/daygrid';
import interactionPlugin from '@fullcalendar/interaction';


import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';

import {HttpClientModule} from '@angular/common/http';
import { HttpClientModule} from '@angular/common/http';

import { TaskComponent } from './task/task.component';

import { BrowserAnimationsModule } from '@angular/platform-browser/animations';

import { MatGridListModule } from '@angular/material/grid-list';
import { MaterialModule } from './material-module';
import { FlexLayoutModule } from '@angular/flex-layout';
import { TaskListComponent } from './task-list/task-list.component';

import { EditTaskComponent } from './edit-task/edit-task.component';
import { FormsModule } from '@angular/forms';
import { CalendarComponent } from './calendar/calendar.component';
import { KatexModule } from 'ng-katex';
import { TaskDetailsComponent } from './task-details/task-details.component';
import { KatexInputComponent } from './katex-input/katex-input.component';

FullCalendarModule.registerPlugins([ // register FullCalendar plugins
dayGridPlugin,
interactionPlugin
]);

@NgModule({
declarations: [
AppComponent,
TaskComponent,
TaskListComponent,
EditTaskComponent,
CalendarComponent,
TaskDetailsComponent,
KatexInputComponent
],
Expand All @@ -37,7 +48,9 @@ import { KatexInputComponent } from './katex-input/katex-input.component';
FlexLayoutModule,
FormsModule,
HttpClientModule,
KatexModule
FullCalendarModule,
BrowserAnimationsModule,
KatexModule,
],
providers: [],
bootstrap: [AppComponent]
Expand Down
8 changes: 8 additions & 0 deletions src/app/calendar/calendar.component.css
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;
}
8 changes: 8 additions & 0 deletions src/app/calendar/calendar.component.html
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>

24 changes: 24 additions & 0 deletions src/app/calendar/calendar.component.spec.ts
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();
});
});
105 changes: 105 additions & 0 deletions src/app/calendar/calendar.component.ts
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();
}

}
5 changes: 4 additions & 1 deletion src/app/edit-task/edit-task.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,10 @@
<div class="input-title">Schüler:</div>
<div class="students">{{task.allocate}}</div>
</div>

<div class="flex-container">
<div class="input-title">Auswahl Übung oder Vorlesung:</div>
<button (click)="toggleUebung()" > {{ buttonheader }} > </button>
</div>
</div>


Expand Down
Loading