mirror of https://github.com/Ombi-app/Ombi
parent
f748ea9db6
commit
9a267465a7
@ -0,0 +1,3 @@
|
||||
<div class="small-middle-container">
|
||||
<p-fullCalendar [events]="entries" [options]="options"></p-fullCalendar>
|
||||
</div>
|
@ -0,0 +1,5 @@
|
||||
|
||||
.small-middle-container{
|
||||
margin: auto;
|
||||
width: 80%;
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
import { Component, OnInit } from "@angular/core";
|
||||
import { CalendarService } from "../../services/calendar.service";
|
||||
import { ICalendarModel } from "../../interfaces/ICalendar";
|
||||
|
||||
@Component({
|
||||
templateUrl: "./calendar.component.html",
|
||||
styleUrls: ["./calendar.component.scss"],
|
||||
})
|
||||
export class CalendarComponent implements OnInit {
|
||||
|
||||
public loadingFlag: boolean;
|
||||
events: any[];
|
||||
options: any;
|
||||
entries: ICalendarModel[];
|
||||
|
||||
constructor(private calendarService: CalendarService) { }
|
||||
|
||||
public async ngOnInit() {
|
||||
debugger;
|
||||
this.loading()
|
||||
this.entries = await this.calendarService.getCalendarEntries();
|
||||
this.events = [
|
||||
{
|
||||
"title": "All Day Event",
|
||||
"start": new Date(),
|
||||
"eventColor":"black"
|
||||
},
|
||||
{
|
||||
"title": "Long Event",
|
||||
"start": "2016-01-07",
|
||||
"end": "2016-01-10"
|
||||
},
|
||||
{
|
||||
"title": "Repeating Event",
|
||||
"start": "2016-01-09T16:00:00"
|
||||
},
|
||||
{
|
||||
"title": "Repeating Event",
|
||||
"start": "2016-01-16T16:00:00"
|
||||
},
|
||||
{
|
||||
"title": "Conference",
|
||||
"start": "2016-01-11",
|
||||
"end": "2016-01-13"
|
||||
}
|
||||
];
|
||||
|
||||
this.options = {
|
||||
defaultDate: new Date(),
|
||||
header: {
|
||||
left: 'prev,next',
|
||||
center: 'title',
|
||||
right: 'month,agendaWeek'
|
||||
},
|
||||
};
|
||||
this.finishLoading();
|
||||
}
|
||||
|
||||
private loading() {
|
||||
this.loadingFlag = true;
|
||||
}
|
||||
|
||||
private finishLoading() {
|
||||
this.loadingFlag = false;
|
||||
}
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
import { CalendarComponent } from "./calendar.component";
|
||||
|
||||
export const components: any[] = [
|
||||
CalendarComponent,
|
||||
];
|
@ -0,0 +1,18 @@
|
||||
import { PlatformLocation, APP_BASE_HREF } from "@angular/common";
|
||||
import { Injectable, Inject } from "@angular/core";
|
||||
|
||||
import { HttpClient } from "@angular/common/http";
|
||||
import { Observable } from "rxjs";
|
||||
|
||||
import { ServiceHelpers } from "./service.helpers";
|
||||
import { ICalendarModel } from "../interfaces/ICalendar";
|
||||
|
||||
@Injectable()
|
||||
export class CalendarService extends ServiceHelpers {
|
||||
constructor(http: HttpClient, @Inject(APP_BASE_HREF) href:string) {
|
||||
super(http, "/api/v2/Calendar/", href);
|
||||
}
|
||||
public getCalendarEntries(): Promise<ICalendarModel[]> {
|
||||
return this.http.get<ICalendarModel[]>(`${this.url}`, {headers: this.headers}).toPromise();
|
||||
}
|
||||
}
|
Loading…
Reference in new issue