${startTimeWisthS}${eventlocation}
@@ -366,7 +377,26 @@ export class AgendaPage implements OnInit {
var minutes = ((endEvent.getTime() - startEvent.getTime()) / 1000) / 60;
const top = (startEvent.getTime() - (new Date(2020, 1, 3)).getTime()) /60;
- document.querySelectorAll('.timeline-box').forEach(ele => {
+ document.querySelectorAll('.fs-timeline .timeline-box').forEach(ele => {
+
+ if(ele.className.indexOf(`timeline-box-event-${eventIndex}`)>=0){
+ ele.setAttribute('style',`height:${minutes}px`);
+ }
+ });
+
+ });
+ },timeout)
+
+ setTimeout(()=>{
+ this.TimelinePR.forEach((el, eventIndex)=>{
+
+ const startEvent = new Date(el['startTime']);
+ const endEvent = new Date(el['endTime']);
+
+ var minutes = ((endEvent.getTime() - startEvent.getTime()) / 1000) / 60;
+ const top = (startEvent.getTime() - (new Date(2020, 1, 3)).getTime()) /60;
+
+ document.querySelectorAll('.sd-timeline .timeline-box').forEach(ele => {
if(ele.className.indexOf(`timeline-box-event-${eventIndex}`)>=0){
ele.setAttribute('style',`height:${minutes}px`);
@@ -379,14 +409,18 @@ export class AgendaPage implements OnInit {
// for timeline
- timelineFilter(calendarName){
+ timelineFilter(calendarName, eventsList, profile){
this.timelineFilterState = calendarName;
// remove all event
- this.events = [];
+ let events = [];
- this.eventsList.forEach((element, eventIndex) => {
+ console.log(eventsList);
+
+ this.showTimelineFilterState = false;
+
+ eventsList.forEach((element, eventIndex) => {
// timeline start
const startHours = new Date(element.StartDate).getHours().toLocaleString();
@@ -395,207 +429,274 @@ export class AgendaPage implements OnInit {
const startHoursOtherFormate = new Date(element.StartDate).getHours().toLocaleString()+':'+new Date(element.StartDate).getMinutes().toLocaleString();
const EndHoursOtherFormate = formatDate(new Date(element.EndDate), 'HH:mm', 'pt');
- if (element.CalendarName == calendarName) {
- this.events.push({
- title: this.timeLineTemplate(startHours, element.Location, element.Body, element.CalendarName, element.Subject,startHoursOtherFormate,EndHoursOtherFormate, eventIndex),
- start: setHours(setMinutes(new Date(element.StartDate), 0), parseInt(startHours)),
- end: setHours(setMinutes(new Date(element.EndDate), 0), parseInt(EndHours)),
- color: {
- primary: 'white',
- secondary: 'white'
- },
- id: element.EventId
- });
- } else if (calendarName == 'Todos'){
- this.events.push({
- title: this.timeLineTemplate(startHours, element.Location, element.Body, element.CalendarName, element.Subject,startHoursOtherFormate,EndHoursOtherFormate, eventIndex),
- start: setHours(setMinutes(new Date(element.StartDate), 0), parseInt(startHours)),
- end: setHours(setMinutes(new Date(element.EndDate), 0), parseInt(EndHours)),
- color: {
- primary: 'white',
- secondary: 'white'
- },
- id: element.EventId
- });
- }
-
+ events.push({
+ title: this.timeLineTemplate(startHours, element.Location, element.Body, element.CalendarName, element.Subject,startHoursOtherFormate,EndHoursOtherFormate, eventIndex, profile),
+ start: setHours(setMinutes(new Date(element.StartDate), 0), parseInt(startHours)),
+ end: setHours(setMinutes(new Date(element.EndDate), 0), parseInt(EndHours)),
+ color: {
+ primary: 'white',
+ secondary: 'white'
+ },
+ id: element.EventId,
+ });
+
});
this.onCurrentChanged(this.eventSelectedDate);
- //
- this.showTimelineFilterState = false;
+
+ return events;
}
loadRangeEvents(startTime: Date, endTime: Date){
- this.showTimeline = false;
this.showLoader = true;
- switch (this.segment)
- {
- case "Combinada":
- //Inicializa o array eventSource
- this.eventSource=[];
-
+ if(window.innerWidth < 1024){
+
+ this.showTimeline = false;
- if(this.profile == "mdgpr"){
- this.eventService.getAllMdEvents( momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59') ).subscribe(
- response => {
-
- this.eventSource=[];
-
- this.eventsList = response;
- // loop
- this.eventsList.forEach((element, eventIndex) => {
-
- this.eventSource.push({
- title: element.Subject,
- startTime: new Date(element.StartDate),
- endTime: new Date(element.EndDate),
- allDay: false,
- event: element,
- calendarName: element.CalendarName
+ switch (this.segment) {
+ case "Combinada":
+ //Inicializa o array eventSource
+ this.eventSource=[];
+
+
+ if(this.profile == "mdgpr"){
+ this.eventService.getAllMdEvents( momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59') ).subscribe(
+ response => {
+
+ this.eventSource=[];
+
+ this.eventsList = response;
+ // loop
+ this.eventsList.forEach((element, eventIndex) => {
+
+ this.eventSource.push({
+ title: element.Subject,
+ startTime: new Date(element.StartDate),
+ endTime: new Date(element.EndDate),
+ allDay: false,
+ event: element,
+ calendarName: element.CalendarName,
+ profile: 'md'
+ });
});
+
+ this.events = this.timelineFilter(this.timelineFilterState, this.eventsList, 'md');
+
+ this.myCal.update();
+ this.myCal.loadEvents();
+
+ this.showLoader = false;
+ this.showTimeline = true;
+
+ this.timelineBoxCorrectHeight(500);
+ this.centralizeTimeline(500);
+
});
-
- this.timelineFilter(this.timelineFilterState);
-
- this.myCal.update();
- this.myCal.loadEvents();
-
- this.showLoader = false;
- this.showTimeline = true;
-
- this.timelineBoxCorrectHeight(500);
- this.centralizeTimeline(500);
-
- });
-
- }
- else{
- this.eventService.getAllPrEvents(momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59')).subscribe(
- response => {
-
- this.eventSource=[];
-
- this.eventsList = response;
- this.eventsList.forEach((element, eventIndex) => {
- this.eventSource.push({
- title: element.Subject,
- startTime: new Date(element.StartDate),
- endTime: new Date(element.EndDate),
- allDay: false,
- event: element,
- calendarName: element.CalendarName
+
+ }
+ else{
+ this.eventService.getAllPrEvents(momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59')).subscribe(
+ response => {
+
+ this.eventSource=[];
+
+ this.eventsList = response;
+ this.eventsList.forEach((element, eventIndex) => {
+ this.eventSource.push({
+ title: element.Subject,
+ startTime: new Date(element.StartDate),
+ endTime: new Date(element.EndDate),
+ allDay: false,
+ event: element,
+ calendarName: element.CalendarName,
+ profile: 'pr'
+ });
+
});
-
+
+ this.events = this.timelineFilter(this.timelineFilterState, this.eventsList, 'pr');
+
+ this.myCal.update();
+ this.myCal.loadEvents();
+ this.showLoader = false;
+ this.showTimeline = true;
+
+ this.timelineBoxCorrectHeight(500);
+ this.centralizeTimeline(500);
+
});
-
- this.timelineFilter(this.timelineFilterState);
-
- this.myCal.update();
- this.myCal.loadEvents();
- this.showLoader = false;
- this.showTimeline = true;
-
- this.timelineBoxCorrectHeight(500);
- this.centralizeTimeline(500);
-
- });
- }
- break;
-
- case "Pessoal":
- //Inicializa o array eventSource
- this.eventSource=[];
- if(this.profile == "mdgpr"){
- this.eventService.getAllMdEvents(momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59')).subscribe(response => {
-
- this.eventSource=[];
- this.eventsListPessoal = response.filter(data => data.CalendarName == "Pessoal");
- this.eventsListPessoal.forEach(element => {
-
- this.eventSource.push({
- title: element.Subject,
- startTime: new Date(element.StartDate),
- endTime: new Date(element.EndDate),
- allDay: false,
- event: element
- });
- });
- this.myCal.update();
- this.myCal.loadEvents();
- this.showLoader = false;
- });
-
- }
- else{
- this.eventService.getAllPrEvents(momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59')).subscribe(response => {
- this.eventSource=[];
-
- this.eventsListPessoal = response.filter(data => data.CalendarName == "Pessoal");
- this.eventsListPessoal.forEach(element => {
- this.eventSource.push({
- title: element.Subject,
- startTime: new Date(element.StartDate),
- endTime: new Date(element.EndDate),
- allDay: false,
- event: element
- });
- });
- this.myCal.update();
- this.myCal.loadEvents();
- this.showLoader = false;
- });
- }
+ }
break;
-
- case "Oficial":
- //Inicializa o array eventSource
- this.eventSource=[];
- if(this.profile == "mdgpr"){
- this.eventService.getAllMdEvents(momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59')).subscribe(res => {
- this.eventSource=[];
- this.eventsListOficial = res.filter(data => data.CalendarName == "Oficial");
+
+ case "Pessoal":
+ //Inicializa o array eventSource
+ this.eventSource=[];
+ if(this.profile == "mdgpr"){
+ this.eventService.getAllMdEvents(momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59')).subscribe(response => {
+
+ this.eventSource=[];
+ this.eventsListPessoal = response.filter(data => data.CalendarName == "Pessoal");
+ this.eventsListPessoal.forEach(element => {
+
+ this.eventSource.push({
+ title: element.Subject,
+ startTime: new Date(element.StartDate),
+ endTime: new Date(element.EndDate),
+ allDay: false,
+ event: element,
+ profile: 'md'
+ });
+ });
+ this.myCal.update();
+ this.myCal.loadEvents();
+ this.showLoader = false;
+ });
+
+ }
+ else{
+ this.eventService.getAllPrEvents(momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59')).subscribe(response => {
+ this.eventSource=[];
+
+ this.eventsListPessoal = response.filter(data => data.CalendarName == "Pessoal");
+ this.eventsListPessoal.forEach(element => {
+ this.eventSource.push({
+ title: element.Subject,
+ startTime: new Date(element.StartDate),
+ endTime: new Date(element.EndDate),
+ allDay: false,
+ event: element,
+ profile: 'pr'
+ });
+ });
+ this.myCal.update();
+ this.myCal.loadEvents();
+ this.showLoader = false;
+ });
+ }
+ break;
+
+ case "Oficial":
+ //Inicializa o array eventSource
+ this.eventSource=[];
+ if(this.profile == "mdgpr"){
+ this.eventService.getAllMdEvents(momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59')).subscribe(res => {
+ this.eventSource=[];
+ this.eventsListOficial = res.filter(data => data.CalendarName == "Oficial");
+ this.eventsListOficial.forEach(element => {
+ this.eventSource.push({
+ title: element.Subject,
+ startTime: new Date(element.StartDate),
+ endTime: new Date(element.EndDate),
+ allDay: false,
+ event: element,
+ profile: 'md'
+ });
+ });
+ this.myCal.update();
+ this.myCal.loadEvents();
+ this.showLoader = false;
+ });
+ }else{
+ this.eventService.getAllPrEvents(momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59')).subscribe(res => {
+ this.eventSource=[];
+ this.eventsListOficial = res.filter(data => data.CalendarName == "Oficial");
this.eventsListOficial.forEach(element => {
this.eventSource.push({
title: element.Subject,
startTime: new Date(element.StartDate),
endTime: new Date(element.EndDate),
allDay: false,
- event: element
+ event: element,
+ profile: 'pr'
});
});
this.myCal.update();
this.myCal.loadEvents();
this.showLoader = false;
});
- }else{
- this.eventService.getAllPrEvents(momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59')).subscribe(res => {
- this.eventSource=[];
- this.eventsListOficial = res.filter(data => data.CalendarName == "Oficial");
- this.eventsListOficial.forEach(element => {
- this.eventSource.push({
- title: element.Subject,
- startTime: new Date(element.StartDate),
- endTime: new Date(element.EndDate),
- allDay: false,
- event: element
- });
- });
- this.myCal.update();
- this.myCal.loadEvents();
- this.showLoader = false;
- });
- }
- break;
+ }
+ break;
+
+ }
+ } else {
+
+ this.showTimelinePR = false;
+ this.showTimelineMD = false;
+ this.eventSource=[];
+
+ this.eventService.getAllMdEvents( momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59') ).subscribe(
+ response => {
+
+ this.eventsList = response;
+ // loop
+ this.eventsList.forEach((element, eventIndex) => {
+
+ this.eventSource.push({
+ title: element.Subject,
+ startTime: new Date(element.StartDate),
+ endTime: new Date(element.EndDate),
+ allDay: false,
+ event: element,
+ calendarName: element.CalendarName,
+ profile: 'md'
+ });
+ });
+
+
+ this.TimelineMD = this.timelineFilter(this.timelineFilterState, this.eventsList, 'md');
+ this.events = this.timelineFilter(this.timelineFilterState, this.eventsList, 'md');
+
+ this.myCal.update();
+ this.myCal.loadEvents();
+
+ this.showTimelineMD = true;
+
+ this.timelineBoxCorrectHeight(500);
+ this.centralizeTimeline(500);
+
+ });
+
+ this.eventService.getAllPrEvents(momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59')).subscribe(
+ response => {
+
+ this.eventsList = response;
+ this.eventsList.forEach((element, eventIndex) => {
+ this.eventSource.push({
+ title: element.Subject,
+ startTime: new Date(element.StartDate),
+ endTime: new Date(element.EndDate),
+ allDay: false,
+ event: element,
+ calendarName: element.CalendarName,
+ profile:'pr'
+ });
+
+ });
+
+ this.TimelinePR = this.timelineFilter(this.timelineFilterState, this.eventsList, 'pr');
+
+ console.log(this.TimelinePR);
+
+ this.myCal.update();
+ this.myCal.loadEvents();
+
+ this.showTimelinePR = true;
+
+ this.timelineBoxCorrectHeight(500);
+ this.centralizeTimeline(500);
+
+ this.showLoader = false;
+ });
+
+ }
- }
}
actions(){
- }
+ }
doRefresh(ev: any){
this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate);
diff --git a/src/app/pages/events/events.page.html b/src/app/pages/events/events.page.html
index 9f435f677..bcf14acdb 100644
--- a/src/app/pages/events/events.page.html
+++ b/src/app/pages/events/events.page.html
@@ -55,7 +55,6 @@