Files
doneit-web/src/app/pages/agenda/agenda.page.ts
T

1153 lines
28 KiB
TypeScript
Raw Normal View History

2021-08-30 10:24:46 +01:00
import { Component, OnInit, ViewChild, Inject, LOCALE_ID } from '@angular/core';
import { CalendarComponent } from 'ionic2-calendar';
2023-06-13 14:34:22 +01:00
import { ModalController } from '@ionic/angular';
2020-08-21 16:09:53 +01:00
import { EventsService } from 'src/app/services/events.service';
import { Event } from '../../models/event.model';
2022-05-27 13:36:37 +01:00
import { Router, NavigationEnd, NavigationExtras } from '@angular/router';
2021-10-09 09:15:22 +01:00
import { momentG } from 'src/plugin/momentG';
2022-10-12 17:01:09 +01:00
2021-03-25 10:50:58 +01:00
import { EventPerson } from 'src/app/models/eventperson.model';
2021-10-05 15:02:52 +01:00
import { removeDuplicate } from 'src/plugin/removeDuplicate.js';
2020-08-05 15:39:16 +01:00
2021-01-25 16:18:36 +01:00
// showTimeline
2021-01-22 16:00:37 +01:00
import { setHours, setMinutes } from 'date-fns';
2021-01-25 16:18:36 +01:00
import {
CalendarDateFormatter,
CalendarEvent,
CalendarView,
DAYS_OF_WEEK,
} from 'angular-calendar';
import { CustomDateFormatter } from './custom-date-formatter.provider';
2021-02-25 11:10:30 +01:00
import { NewEventPage } from './new-event/new-event.page';
2021-08-27 15:21:15 +01:00
import { LoginUserRespose } from 'src/app/models/user.model';
2021-06-18 12:02:14 +01:00
import { DateAdapter } from '@angular/material/core';
2021-07-16 22:50:08 +01:00
import { eventSource } from 'src/app/models/agenda/eventSource';
2021-09-27 16:23:41 +01:00
import { CalendarStore } from 'src/app/store/calendar.service';
2021-09-21 10:04:42 +01:00
import { ListBoxService } from 'src/app/services/agenda/list-box.service';
2021-09-28 11:31:10 +01:00
import { ChangeProfileService } from 'src/app/services/change-profile.service';
2021-07-19 13:01:06 +01:00
2021-10-18 17:42:25 +01:00
import { BackgroundService } from 'src/app/services/background.service';
2021-10-21 15:47:00 +01:00
import { ThemeService } from 'src/app/services/theme.service'
2022-04-07 14:24:07 +01:00
import { SessionStore } from 'src/app/store/session.service';
2022-07-07 11:38:48 +01:00
import { PermissionService } from 'src/app/services/permission.service';
2023-03-22 15:31:01 +01:00
import { environment } from 'src/environments/environment';
2023-03-30 14:31:58 +01:00
import { RoleIdService } from 'src/app/services/role-id.service'
import { EventListStore } from 'src/app/models/agenda/AgendaEventList';
2023-07-25 15:56:42 +01:00
import { ContactsService } from 'src/app/services/contacts.service';
2021-10-09 09:15:22 +01:00
2020-08-05 15:39:16 +01:00
@Component({
selector: 'app-agenda',
templateUrl: './agenda.page.html',
styleUrls: ['./agenda.page.scss'],
2021-01-25 16:18:36 +01:00
providers: [
{
provide: CalendarDateFormatter,
useClass: CustomDateFormatter,
},
],
2020-08-05 15:39:16 +01:00
})
export class AgendaPage implements OnInit {
2021-07-29 15:27:12 +01:00
2021-01-22 16:00:37 +01:00
view: CalendarView = CalendarView.Day;
viewDate: Date = new Date();
2021-01-25 16:18:36 +01:00
weekStartsOn: number = DAYS_OF_WEEK.MONDAY;
weekendDays: number[] = [DAYS_OF_WEEK.FRIDAY, DAYS_OF_WEEK.SATURDAY];
CalendarView = CalendarView;
2021-01-27 13:57:55 +01:00
timelineDate: string;
2021-10-09 09:15:22 +01:00
contacts: EventPerson[]
2021-03-25 10:50:58 +01:00
2021-01-25 16:18:36 +01:00
setView(view: CalendarView) {
this.view = view;
}
2021-02-09 16:49:15 +01:00
// calendar
showCalendar: boolean;
2023-07-06 12:18:15 +01:00
calendarHeight = [];
2021-02-09 16:49:15 +01:00
2021-02-03 17:13:32 +01:00
// for timeline
events: CalendarEvent[] = [];
2021-10-09 09:15:22 +01:00
TimelinePR: CalendarEvent[] = [];
2021-03-18 20:02:44 +01:00
TimelineMD: CalendarEvent[] = [];
2023-03-30 14:31:58 +01:00
TimelineMDList = {};
2021-03-18 20:02:44 +01:00
showTimelinePR = false;
showTimelineMD = false;
2021-07-29 15:27:12 +01:00
2021-02-03 17:13:32 +01:00
// timeline filter
timelineFilterState: string = 'Todos';
2021-02-09 16:49:15 +01:00
showTimelineFilterState: boolean;
2021-10-09 09:15:22 +01:00
showTimeline = true;
2021-07-29 15:27:12 +01:00
/* List of events of our calendar */
2021-10-09 09:15:22 +01:00
eventSource: eventSource[] = []
2021-07-16 22:50:08 +01:00
/* The title of the calendar */
viewTitle: string;
calendar = {
/* Se the view of the calendar to a month view */
mode: 'month',
currentDate: new Date(),
};
selectedDate: Date;
eventSelectedDate: Date = new Date();
2020-09-04 01:25:32 +01:00
eventSelectedDate2: Date;
2021-06-08 11:24:01 +01:00
rangeStartDate: Date;
rangeEndDate: Date;
2021-02-24 09:14:58 +01:00
selectedEvent: Event;
selectedEventId: string | number;
2022-05-27 13:36:37 +01:00
selectedEventCalendarId : string | number;
2021-02-24 09:14:58 +01:00
postEvent: any;
2021-04-08 13:39:48 +01:00
// temporary data
2023-01-24 15:56:47 +01:00
taskParticipants: EventPerson[] = [];
taskParticipantsCc: EventPerson[] = [];
2021-04-05 15:00:14 +01:00
adding: "intervenient" | "CC" = "intervenient";
2021-07-29 15:27:12 +01:00
@ViewChild(CalendarComponent) myCal: CalendarComponent;
2021-10-09 09:15:22 +01:00
segment: "Combinado" | "Pessoal" | "Oficial" = "Combinado";
timelineSedment: "Combinado" | "Pessoal" | "Oficial";
2021-07-29 15:27:12 +01:00
2021-10-09 09:15:22 +01:00
profile: 'mdgpr' | 'pr';
2021-03-25 15:18:12 +01:00
// this will make toggle add event and.
2021-10-09 09:15:22 +01:00
showEventEditOrOpen: "edit" | "add" | "" | "eventoToApprove" = ""
prEventList: Event[];
mdEventList: Event[];
2020-08-28 11:45:50 +01:00
showLoader: boolean;
startTime: Date;
endTime: Date;
2020-08-24 12:45:42 +01:00
mobileComponent = {
2021-02-24 09:14:58 +01:00
showAddNewEvent: false,
showEditEvent: false,
2021-03-24 15:10:46 +01:00
showEventDetails: false,
2021-02-26 15:29:05 +01:00
showEventList: false,
transparentEventList: false,
2021-03-03 10:15:44 +01:00
transparentEventToApprove: false,
2021-03-24 15:10:46 +01:00
showEventToApprove: false,
showAttendees: false,
2021-06-29 14:15:56 +01:00
showAttendeeModal: false,
showEditEventToApprove: false,
2021-02-26 15:29:05 +01:00
}
eventToaprove: any = {
back: false,
serialNumber: "",
saveData: {}
2021-02-24 09:14:58 +01:00
}
2020-09-04 01:25:32 +01:00
/**
* @description determinant if edit or add event component is open
*/
IsEvent: "edit" | "add" | "view";
2021-10-09 09:15:22 +01:00
viewingEventObject: CalendarEvent;
2021-08-27 15:21:15 +01:00
loggeduser: LoginUserRespose;
2021-07-29 15:27:12 +01:00
2021-09-21 10:04:42 +01:00
monthNum;
yearNum;
dropdownScrollWeal = false
2021-09-27 16:23:41 +01:00
CalendarStore = CalendarStore
2023-03-30 14:31:58 +01:00
listToPresent: EventListStore[] = []
2021-11-23 13:56:41 +01:00
array = []
2021-09-21 10:04:42 +01:00
2022-10-12 17:01:09 +01:00
SessionStore = SessionStore;
2023-03-22 15:31:01 +01:00
environment = environment
2023-03-28 13:59:37 +01:00
CalendarName = ''
2023-04-05 15:15:42 +01:00
hasEventToday = false
isSelectedDayHasEvent = true
2022-04-07 14:24:07 +01:00
2021-03-18 20:02:44 +01:00
constructor(
2020-08-25 14:17:33 +01:00
@Inject(LOCALE_ID) private locale: string,
2020-08-21 16:09:53 +01:00
private modalCtrl: ModalController,
2022-04-02 09:40:09 +01:00
public eventService: EventsService,
2020-08-28 15:44:03 +01:00
private router: Router,
2021-07-12 11:13:29 +01:00
private dateAdapter: DateAdapter<any>,
2023-08-30 14:18:05 +01:00
public listBoxService: ListBoxService,
2021-10-09 09:15:22 +01:00
private changeProfileService: ChangeProfileService,
2021-10-21 15:47:00 +01:00
private backgroundservice: BackgroundService,
2022-01-31 15:02:26 +01:00
public ThemeService: ThemeService,
2022-12-16 00:33:13 +01:00
public p: PermissionService,
2023-08-29 16:42:46 +01:00
public RoleIdService: RoleIdService
2021-10-09 09:15:22 +01:00
) {
2021-06-18 12:02:14 +01:00
2021-09-28 11:31:10 +01:00
this.dateAdapter.setLocale('es');
2021-06-18 12:02:14 +01:00
this.locale = 'pt'
2022-10-12 17:01:09 +01:00
this.loggeduser = SessionStore.user;
2021-10-09 09:15:22 +01:00
this.changeProfileService.registerCallback(() => {
2021-09-28 11:31:10 +01:00
this.tigerUpdate()
2021-10-09 09:15:22 +01:00
if (this.loggeduser.Profile == 'MDGPR') {
2021-09-28 11:31:10 +01:00
this.mobileComponent.showEventList = true;
this.profile = "mdgpr";
2022-04-02 09:40:09 +01:00
} else if (this.loggeduser.Profile == 'PR') {
2021-09-28 11:31:10 +01:00
this.profile = "pr";
2022-04-02 09:40:09 +01:00
} else {
this.profile = "mdgpr";
2021-09-28 11:31:10 +01:00
}
2022-04-22 15:03:09 +01:00
this.CalendarStore.ResetList([])
2022-08-08 14:52:13 +01:00
this.listToPresent = []
2023-02-08 16:26:52 +01:00
2021-09-28 11:31:10 +01:00
})
2021-10-09 09:15:22 +01:00
if (this.loggeduser.Profile == 'MDGPR') {
2021-09-28 11:31:10 +01:00
this.mobileComponent.showEventList = true;
this.profile = "mdgpr";
2022-04-02 09:40:09 +01:00
} else if (this.loggeduser.Profile == 'PR') {
2021-09-28 11:31:10 +01:00
this.profile = "pr";
2022-04-02 09:40:09 +01:00
} else {
2022-07-04 19:13:28 +01:00
if(this.eventService.usersCalendarIds.length >= 2) {
2022-04-02 09:40:09 +01:00
this.profile = "mdgpr";
} else if (this.eventService.hasOwnCalendar) {
this.profile = "mdgpr";
} else if (this.eventService.hasSharedCalendar) {
this.profile = "pr";
}
2021-09-28 11:31:10 +01:00
}
2023-07-06 12:18:15 +01:00
this.calendarHeight = ["height-356"];
this.showCalendar = true;
2021-10-09 09:15:22 +01:00
this.timelineDate = momentG(new Date(), 'dd MMMM yyyy');
2021-01-27 13:57:55 +01:00
this.showLoader = false;
this.showTimelineFilterState = false;
this.showTimeline = false;
2021-01-25 16:18:36 +01:00
2021-07-19 13:01:06 +01:00
2021-09-28 11:31:10 +01:00
this.tigerUpdate()
2023-08-15 12:03:37 +01:00
window['reloadCalendar'] = () => {
this.reloadCalendar()
}
2023-08-29 16:42:46 +01:00
this.weekToShow()
2021-09-28 11:31:10 +01:00
}
tigerUpdate() {
2021-10-09 09:15:22 +01:00
setTimeout(() => {
2021-07-19 13:01:06 +01:00
try {
this.myCal.update();
this.myCal.loadEvents();
2021-10-09 09:15:22 +01:00
} catch (e) { }
2021-07-19 13:07:12 +01:00
2021-07-19 13:01:06 +01:00
this.updateEventListBox()
2021-07-28 14:47:56 +01:00
}, 1000)
2021-03-18 20:02:44 +01:00
}
2020-08-05 15:39:16 +01:00
2023-03-30 14:31:58 +01:00
2020-08-05 15:39:16 +01:00
ngOnInit() {
2021-07-12 11:13:29 +01:00
2023-03-28 13:59:37 +01:00
this.setCalendarByDefault()
2023-03-30 14:31:58 +01:00
const selectedCalendarIds = this.getSelectedAgendaCalendars();
this.listToPresent = this.CalendarStore.getEventsByCalendarIds(selectedCalendarIds)
2023-03-28 13:59:37 +01:00
2022-07-11 14:33:47 +01:00
setTimeout(() => {
2022-04-26 15:19:48 +01:00
const pathname = window.location.pathname
let realoadCounter = 0
this.router.events.forEach((event) => {
if (event instanceof NavigationEnd && event.url == pathname) {
if (this.segment == null) {
this.segment = "Combinado";
}
if (realoadCounter != 0) {
this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate);
2022-12-27 15:21:01 +01:00
this.updateEventListBox()
2022-04-26 15:19:48 +01:00
}
realoadCounter++;
2023-08-30 14:18:05 +01:00
this.weekToShow()
2021-10-18 17:42:25 +01:00
}
2022-04-26 15:19:48 +01:00
});
this.backgroundservice.registerBackService('Online', () => {
//this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate);
});
window.onresize = (event) => {
// if not table remove all component
if (window.innerWidth <= 1024) {
this.cloneAllmobileComponent();
2021-10-18 17:42:25 +01:00
}
2022-04-26 15:19:48 +01:00
};
}, 1000)
2020-08-05 15:39:16 +01:00
}
2023-08-11 16:38:23 +01:00
weekToShow() {
2023-08-14 10:17:05 +01:00
setTimeout(() => {
2023-08-24 22:19:40 +01:00
try {
let weekNum = 0;
2023-08-30 14:18:05 +01:00
2023-08-24 22:19:40 +01:00
function Week(a) {
for(let b of a.querySelectorAll('td')) {
if(!b.className.includes('text-muted')) {
weekNum++;
return true
}
2023-08-14 10:17:05 +01:00
}
2023-08-11 16:38:23 +01:00
}
2023-08-14 10:17:05 +01:00
2023-08-24 22:19:40 +01:00
const dayBoxHeight = document.querySelector('.monthview-container .swiper-container .swiper-slide-active table tbody tr td').clientHeight
const weeks = document.querySelectorAll('.monthview-container .swiper-container .swiper-slide-active table tbody tr');
2023-08-14 10:17:05 +01:00
2023-08-24 22:19:40 +01:00
for (let week of weeks as any ){
Week(week)
}
this.showCalendar = true
2023-08-30 14:18:05 +01:00
this.listBoxService.height = (weekNum * dayBoxHeight) +'px'
if(dayBoxHeight == 0) {
this.weekToShow()
}
2023-08-24 22:19:40 +01:00
} catch (e) {
setTimeout(()=> {
this.weekToShow()
}, 100)
}
2023-08-14 10:17:05 +01:00
}, 250)
2023-08-11 16:38:23 +01:00
}
2023-03-28 13:59:37 +01:00
setCalendarByDefault() {
if(!this.CalendarName) {
if(this.eventService.calendarNamesAry.includes('Meu calendario')) {
this.CalendarName = 'Meu calendario';
} else {
this.CalendarName = this.eventService.calendarNamesAry[0]
}
}
}
//Go to the next view of the calendar month/week/day
next() {
this.myCal.slideNext();
2021-07-19 06:28:07 +01:00
this.myCal.loadEvents();
this.myCal.update();
}
//Go to the previous view of the calendar
2021-09-30 15:56:04 +01:00
back() {
this.myCal.slidePrev();
2021-07-19 06:28:07 +01:00
this.myCal.loadEvents();
this.myCal.update();
}
2021-09-30 15:56:04 +01:00
//Shows the title of your view
2021-09-30 15:56:04 +01:00
onViewTitleChanged(title) {
this.viewTitle = title;
}
2021-01-27 13:57:55 +01:00
// show information about the clicked event in timeline
2021-10-09 09:15:22 +01:00
eventClicked(event: CalendarEvent): void {
2021-04-08 13:39:48 +01:00
//clear
this.setIntervenient([]);
this.setIntervenientCC([]);
this.clearPostEvent();
2021-10-09 09:15:22 +01:00
this.IsEvent = "view";
2021-07-29 15:27:12 +01:00
2021-06-08 11:24:01 +01:00
this.viewingEventObject = event;
2021-02-24 09:14:58 +01:00
this.selectedEventId = event.id;
2022-05-27 13:36:37 +01:00
this.selectedEventCalendarId = event?.['event']?.CalendarId;
2021-02-24 09:14:58 +01:00
2021-03-25 15:18:12 +01:00
this.cloneAllmobileComponent();
2021-07-29 15:27:12 +01:00
2021-03-25 15:18:12 +01:00
this.showEventEditOrOpen = 'edit';
2021-02-24 11:10:51 +01:00
2021-10-09 09:15:22 +01:00
if (window.innerWidth <= 1024) {
2021-03-25 16:55:32 +01:00
this.viewEventDetail(event.id)
//this.router.navigate(["/home/agenda", event.id, 'agenda']);
2021-02-24 09:14:58 +01:00
} else {
this.cloneAllmobileComponent();
2021-03-25 15:18:12 +01:00
2021-03-24 15:10:46 +01:00
this.mobileComponent.showEventDetails = true;
2021-02-24 09:14:58 +01:00
}
2021-01-27 13:57:55 +01:00
}
2021-03-25 16:55:32 +01:00
//Show information of the event
2021-10-09 09:15:22 +01:00
async onEventSelected(ev: { event: Event }) {
2021-07-18 18:56:53 +01:00
2021-06-10 13:40:57 +01:00
this.router.navigate(["/home/agenda", ev.event.EventId, 'agenda']);
}
2020-09-04 01:25:32 +01:00
onCurrentChanged = (ev: Date) => {
2021-01-27 13:57:55 +01:00
// timeline change date
2021-10-09 09:15:22 +01:00
this.timelineDate = momentG(new Date(ev), 'dd MMMM yyyy');
2021-09-21 10:04:42 +01:00
this.monthNum = new Date(ev).getMonth()
2021-10-09 09:15:22 +01:00
this.yearNum = new Date(ev).getFullYear()
2021-09-21 10:04:42 +01:00
2021-02-08 16:55:55 +01:00
this.viewDate = new Date(ev);
2021-01-27 13:57:55 +01:00
// calendar change date
2021-01-28 16:18:10 +01:00
this.eventSelectedDate = new Date(ev);
2021-02-03 17:13:32 +01:00
2022-07-11 14:33:47 +01:00
this.updateEventListBox();
2021-09-21 10:04:42 +01:00
2020-09-04 01:25:32 +01:00
};
2021-09-21 10:04:42 +01:00
onDropDownScrollWeal() {
2021-10-09 09:15:22 +01:00
setTimeout(() => {
2021-09-21 10:04:42 +01:00
document.querySelector('.dropdown-scroll-weel').querySelectorAll('.active')[0].scrollIntoView({ behavior: 'smooth', block: 'center' });
2021-10-09 09:15:22 +01:00
setTimeout(() => {
2021-09-21 10:04:42 +01:00
document.querySelector('.dropdown-scroll-weel').querySelectorAll('.active')[1].scrollIntoView({ behavior: 'smooth', block: 'center' });
}, 300)
}, 10)
}
2021-01-28 16:18:10 +01:00
2021-02-08 16:55:55 +01:00
onTimeSelected = (ev: { selectedTime: Date, events: any[] }) => {
2021-02-24 20:23:15 +01:00
this.eventSelectedDate2 = ev.selectedTime;
2021-04-05 15:00:14 +01:00
}
2020-09-04 01:25:32 +01:00
2021-10-09 09:15:22 +01:00
onRangeChanged(ev: { startTime: Date, endTime: Date }) {
this.rangeStartDate = ev.startTime;
this.rangeEndDate = ev.endTime;
this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate);
2021-07-29 15:27:12 +01:00
2021-07-19 13:01:06 +01:00
try {
this.myCal.update();
this.myCal.loadEvents();
2021-10-09 09:15:22 +01:00
} catch (e) { }
2021-07-19 13:01:06 +01:00
2021-04-05 15:00:14 +01:00
}
2020-08-24 12:45:42 +01:00
2021-02-03 17:13:32 +01:00
// for calendar
2021-06-17 16:13:37 +01:00
currentDayEventDisplayBorder(day: any, id: any) {
2021-07-29 15:27:12 +01:00
2021-02-03 17:13:32 +01:00
const events = day[id].events;
2021-03-18 20:02:44 +01:00
2021-02-03 17:13:32 +01:00
if (events.length == 0) {
2021-07-29 15:27:12 +01:00
2021-02-03 17:13:32 +01:00
return "";
2021-03-19 15:56:58 +01:00
2021-02-03 17:13:32 +01:00
} else if (events.length >= 1) {
2021-07-29 15:27:12 +01:00
2021-03-19 15:56:58 +01:00
let classs = [];
2021-02-03 17:13:32 +01:00
events.forEach(element => {
2021-07-29 15:27:12 +01:00
2021-10-09 09:15:22 +01:00
const profile_ = element.profile == 'md' ? 'mdgpr' : 'pr';
2021-03-19 15:56:58 +01:00
const eventtype = element.event.CalendarName;
2021-07-18 19:03:01 +01:00
2021-03-19 15:56:58 +01:00
classs.push(`calendar-event-border calendar-${profile_}-event-type-${eventtype}`);
});
2021-07-29 15:27:12 +01:00
2021-03-19 15:56:58 +01:00
return classs.join(' ');
2021-02-03 17:13:32 +01:00
}
return "";
}
// for timeline
2021-10-09 09:15:22 +01:00
get CalendarCurrentDay(): any {
2021-06-10 15:08:35 +01:00
return this.viewDate.getDate()
}
2021-10-09 09:15:22 +01:00
momentG(date, formate, wgs) {
return momentG(date, formate, wgs)
2021-06-08 11:24:01 +01:00
}
2021-02-03 17:13:32 +01:00
// for timeline
2021-10-09 09:15:22 +01:00
timelineFilter(calendarName, eventsList, profile) {
2021-02-03 17:13:32 +01:00
this.timelineFilterState = calendarName;
// remove all event
2021-03-18 20:02:44 +01:00
let events = [];
2021-03-19 15:56:58 +01:00
this.showTimelineFilterState = false;
2021-03-19 16:42:20 +01:00
2021-03-18 20:02:44 +01:00
eventsList.forEach((element, eventIndex) => {
2021-07-29 15:27:12 +01:00
2021-02-03 17:13:32 +01:00
// timeline start
2021-10-09 09:15:22 +01:00
const startHours = new Date(element.StartDate).getHours().toLocaleString();
const EndHours = new Date(element.EndDate).getHours().toLocaleString();
2021-02-03 17:13:32 +01:00
2021-03-18 20:02:44 +01:00
events.push({
start: setHours(setMinutes(new Date(element.StartDate), 0), parseInt(startHours)),
end: setHours(setMinutes(new Date(element.EndDate), 0), parseInt(EndHours)),
color: {
2021-03-26 15:56:04 +01:00
primary: '#0000',
secondary: '#0000'
2021-03-18 20:02:44 +01:00
},
id: element.EventId,
2021-03-26 15:35:23 +01:00
index: eventIndex,
2021-04-12 14:01:07 +01:00
profile: profile,
CalendarName: element.CalendarName,
2021-06-08 11:24:01 +01:00
event: element,
Subject: element.Subject
2021-03-18 20:02:44 +01:00
});
2021-02-03 17:13:32 +01:00
});
2021-03-18 20:02:44 +01:00
return events;
2021-02-03 17:13:32 +01:00
}
2021-07-29 15:27:12 +01:00
2021-10-09 09:15:22 +01:00
eventFilter() { }
2021-06-08 11:24:01 +01:00
TimelineDayEvent(day): string {
2021-10-09 09:15:22 +01:00
return (day).padStart(2, '0') + ' ' + this.viewTitle
2021-06-08 11:24:01 +01:00
}
2023-03-30 14:31:58 +01:00
TimelineDay(day) {
return (day).padStart(2, '0')
}
2021-06-08 11:24:01 +01:00
get calendarDay(): string {
2021-07-29 15:27:12 +01:00
2021-10-09 09:15:22 +01:00
return ((new Date(this.timelineDate)).getDate()).toString().padStart(2, '0')
2021-06-08 11:24:01 +01:00
}
2021-04-12 14:01:07 +01:00
2021-10-09 09:15:22 +01:00
EventTretment({ startTime, endTime }) {
2021-06-29 10:14:57 +01:00
const startTimeSamp = new Date(startTime).toLocaleDateString()
const endTimeSamp = new Date(endTime).toLocaleDateString()
const endMinutes = new Date(endTime).getMinutes()
2021-07-29 15:27:12 +01:00
const endHours = new Date(endTime).getHours()
2021-06-29 10:14:57 +01:00
2021-07-13 14:44:54 +01:00
2021-10-09 09:15:22 +01:00
if (startTimeSamp < endTimeSamp && (endMinutes + endHours) == 0) {
2021-06-29 10:14:57 +01:00
endTime = new Date(endTime);
endTime.setSeconds(endTime.getSeconds() - 1);
return new Date(endTime)
} else {
return new Date(endTime)
}
}
2022-12-20 17:14:23 +01:00
loadRequest: any = {}
loadRequestHistory: any = {}
2021-07-15 12:29:37 +01:00
loadRangeEvents(startTime: Date, endTime: Date) {
2023-08-11 16:38:23 +01:00
this.weekToShow()
2023-01-12 15:27:09 +01:00
if(!this.eventService.hasAnyCalendar) {
return false
}
2021-11-24 11:21:11 +01:00
this.array = [];
2022-12-20 17:14:23 +01:00
this.rangeStartDate = startTime
this.rangeEndDate = endTime
this.showLoader = true;
const index = `${startTime}${endTime}`
if(!this.loadRequest[index]) {
this.loadRequest[index] = {startTime, endTime}
this.loadRequestHistory[index] = {lastTimeUpdate: new Date()}
2021-07-16 22:50:08 +01:00
2022-12-20 17:14:23 +01:00
this.loadRangeEventRun(startTime, endTime)
} else {
2023-05-26 14:23:37 +01:00
2022-12-20 17:14:23 +01:00
}
}
deleteLoadRangeEvent(startTime: Date, endTime: Date) {
const index = `${startTime}${endTime}`
delete this.loadRequest[index]
}
loadRangeEventRun(startTime: Date, endTime: Date) {
2023-01-12 15:27:09 +01:00
if(SessionStore.user.OwnerCalendars.length == 0 && SessionStore.user.SharedCalendars.length == 0) {
return false
}
2021-09-30 11:56:02 +01:00
this.rangeStartDate = startTime
this.rangeEndDate = endTime
2021-10-09 09:15:22 +01:00
this.showLoader = true;
2023-03-30 14:31:58 +01:00
const selectedCalendarIds = this.getSelectedAgendaCalendars();
this.listToPresent = this.CalendarStore.getEventsByCalendarIds(selectedCalendarIds)
2023-08-28 17:06:16 +01:00
// this.calendar.currentDate.setDate(1);
2023-03-30 14:31:58 +01:00
this.updateEventListBox()
2021-05-12 16:28:58 +01:00
2023-03-30 14:31:58 +01:00
try {
this.myCal.update();
this.myCal.loadEvents();
} catch (error) {
2021-06-16 16:55:47 +01:00
2023-03-30 14:31:58 +01:00
}
2021-06-16 16:55:47 +01:00
2023-03-30 14:31:58 +01:00
let load = 0;
2021-06-08 11:24:01 +01:00
2023-03-30 14:31:58 +01:00
for ( const selectedCalendar of selectedCalendarIds) {
2023-03-30 15:22:40 +01:00
this.eventService.getEventsByCalendarId(momentG(new Date(startTime), 'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime), 'yyyy-MM-dd 23:59:59'), selectedCalendar.CalendarId).then((response: any) => {
2021-03-18 20:02:44 +01:00
2023-03-30 14:31:58 +01:00
let label;
2021-07-29 15:27:12 +01:00
2023-05-18 17:40:52 +01:00
if(SessionStore.user.Profile == 'PR') {
label = "pr"
} else if(SessionStore.user.OwnerCalendars.find(e => e.CalendarId == selectedCalendar.CalendarId)) {
2023-03-30 14:31:58 +01:00
label = 'md'
2022-10-20 16:47:43 +01:00
} else {
2023-03-30 14:31:58 +01:00
label = "pr"
2022-10-20 16:47:43 +01:00
}
2022-04-02 09:40:09 +01:00
2023-03-30 14:31:58 +01:00
let eventsList = response;
2023-03-30 15:22:40 +01:00
this.CalendarStore.removeRangeForCalendar(startTime, endTime, label, selectedCalendar.CalendarId)
2023-03-30 14:31:58 +01:00
this.CalendarStore.pushEvent(eventsList, label);
this.listToPresent = this.CalendarStore.getEventsByCalendarIds(selectedCalendarIds)
2023-08-29 16:42:46 +01:00
this.updateEventListBox()
2022-04-02 09:40:09 +01:00
2023-03-30 14:31:58 +01:00
this.showTimelinePR = true;
2022-12-16 17:33:00 +01:00
2023-03-30 14:31:58 +01:00
}).finally(() => {
this.deleteLoadRangeEvent(startTime, endTime);
2021-06-16 13:29:57 +01:00
2023-03-30 14:31:58 +01:00
load++
if(load == selectedCalendarIds.length) {
2023-03-28 13:59:37 +01:00
this.showLoader = false;
2023-03-30 14:31:58 +01:00
}
this.myCal.update();
this.myCal.loadEvents();
this.updateEventListBox()
})
2021-06-16 16:55:47 +01:00
}
2021-10-09 09:15:22 +01:00
}
2021-07-29 15:27:12 +01:00
2023-03-30 14:31:58 +01:00
selectedAgenda = {}
2023-03-28 13:59:37 +01:00
getSelectedAgendaCalendars () {
2023-03-30 15:22:40 +01:00
if(this.CalendarName == 'PR+MDGPR') {
let result = this.SessionStore.user.OwnerCalendars
const pr = this.SessionStore.user.SharedCalendars.filter(e => e.CalendarRoleId == this.RoleIdService.PRES.toString())
const md = this.SessionStore.user.SharedCalendars.filter(e => e.CalendarRoleId == this.RoleIdService.PV.toString())
const join = pr.concat(md)
return result.concat(join)
} else {
2023-03-30 14:31:58 +01:00
const calendar = this.eventService.calendarNamesType[this.CalendarName];
let Oficial = calendar?.['OficialId']
let Pessoal = calendar?.['PessoalId']
2023-06-22 12:53:35 +01:00
2023-03-28 13:59:37 +01:00
if(Oficial && Pessoal) {
2023-03-30 14:31:58 +01:00
return [
{
2023-03-30 15:22:40 +01:00
CalendarId : Oficial,
2023-03-30 14:31:58 +01:00
OwnerId: calendar.OwnerId,
CalendarName: calendar.CalendarName
},
{
OwnerId: calendar.OwnerId,
2023-03-30 15:22:40 +01:00
CalendarId : Pessoal,
2023-03-30 14:31:58 +01:00
CalendarName: calendar.CalendarName
}
]
2023-03-28 13:59:37 +01:00
} else if (Oficial) {
2023-06-22 12:53:35 +01:00
try {
return [{
OwnerId: calendar.OwnerId,
CalendarId : Oficial,
CalendarName: calendar.CalendarName
}]
} catch (error) {
console.log(error)
}
2023-03-28 13:59:37 +01:00
} else {
2023-06-22 12:53:35 +01:00
try {
return [{
OwnerId: calendar.OwnerId,
CalendarId : Pessoal,
CalendarName: calendar.CalendarName
}]
} catch (error) {
console.log(error)
}
2023-03-28 13:59:37 +01:00
}
2023-03-30 15:22:40 +01:00
}
2023-03-28 13:59:37 +01:00
}
2021-07-18 18:56:53 +01:00
updateEventListBox() {
2021-07-19 13:01:06 +01:00
2023-03-30 14:31:58 +01:00
const selectedCalendarIds = this.getSelectedAgendaCalendars();
2023-08-29 16:57:01 +01:00
this.listToPresent = this.CalendarStore.getEventsByCalendarIds(selectedCalendarIds)
2021-10-07 11:12:41 +01:00
2023-08-22 15:43:20 +01:00
this.TimelineMDList = this.listBoxService.list(this.listToPresent, 'md', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
2021-07-19 13:01:06 +01:00
2023-08-29 16:57:01 +01:00
const selectedDay = momentG(this.eventSelectedDate, 'dd', 'pt');
if(this.TimelineMDList[selectedDay]) {
this.hasEventToday = true
} else {
this.hasEventToday = false
}
2023-04-05 15:15:42 +01:00
this.isSelectedDayHasEvent = momentG(new Date(), 'dd MMMM yyyy', 'pt') == momentG(this.eventSelectedDate, 'dd MMMM yyyy', 'pt');
2021-07-18 18:56:53 +01:00
}
2023-08-29 16:57:01 +01:00
changeYear = (year) => {
const a = this.calendar.currentDate
2021-09-21 10:04:42 +01:00
const isInvalidDate = (dateString) => JSON.stringify(new Date(dateString)) === 'null';
2021-10-09 09:15:22 +01:00
const newDate = new Date(year, a.getMonth(), a.getDay());
if (!(isInvalidDate(newDate))) {
2021-09-21 10:04:42 +01:00
this.calendar.currentDate = newDate
2021-10-09 09:15:22 +01:00
2021-09-21 10:04:42 +01:00
try {
this.myCal.update();
this.myCal.loadEvents();
this.onDropDownScrollWeal()
2021-10-09 09:15:22 +01:00
} catch (e) { }
2021-09-21 10:04:42 +01:00
this.updateEventListBox()
} else {
2022-04-28 09:32:27 +01:00
2021-09-21 10:04:42 +01:00
}
2021-10-09 09:15:22 +01:00
}
changeMonth = (month) => {
2021-09-21 10:04:42 +01:00
const a = this.calendar.currentDate;
2022-04-28 09:32:27 +01:00
2021-09-21 10:04:42 +01:00
const isInvalidDate = (dateString) => JSON.stringify(new Date(dateString)) === 'null';
2021-10-09 09:15:22 +01:00
const newDate = new Date(a.getFullYear(), month, a.getDay());
2021-09-21 10:04:42 +01:00
2021-10-09 09:15:22 +01:00
if (!(isInvalidDate(newDate))) {
2021-09-21 10:04:42 +01:00
this.calendar.currentDate = newDate
2021-10-09 09:15:22 +01:00
2021-09-21 10:04:42 +01:00
try {
this.myCal.update();
this.myCal.loadEvents();
this.onDropDownScrollWeal()
2021-10-09 09:15:22 +01:00
} catch (e) { }
2021-09-21 10:04:42 +01:00
this.updateEventListBox()
} else {
2022-04-28 09:32:27 +01:00
2021-09-21 10:04:42 +01:00
}
}
2021-06-08 11:24:01 +01:00
2021-10-09 09:15:22 +01:00
get viewEventMonth() {
return this.viewDate.getMonth()
2021-06-08 11:24:01 +01:00
}
2021-06-17 16:13:37 +01:00
dateMonth(event: any) {
2021-10-09 09:15:22 +01:00
return new Date(event.start).getMonth()
2021-06-08 11:24:01 +01:00
}
2021-06-17 16:13:37 +01:00
eventListVisible(event) {
2021-10-09 09:15:22 +01:00
return momentG(event, 'MMMM yyyy') == momentG(this.calendar.currentDate, 'MMMM yyyy')
}
2021-10-09 09:15:22 +01:00
actions() { }
2021-01-27 13:57:55 +01:00
2021-10-09 09:15:22 +01:00
doRefresh(ev: any) {
this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate);
2020-08-24 12:45:42 +01:00
setTimeout(() => {
ev.target.complete();
2021-02-02 11:09:13 +01:00
}, 250)
2020-08-24 12:45:42 +01:00
}
2021-06-08 11:24:01 +01:00
changeProfile() {
2023-03-30 14:31:58 +01:00
2021-10-09 09:15:22 +01:00
if (this.profile == "mdgpr") {
this.profile = "pr";
this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate);
2023-04-05 15:15:42 +01:00
// this.updateEventListBox()
2021-07-18 18:56:53 +01:00
}
2021-07-18 18:56:53 +01:00
else {
2021-10-09 09:15:22 +01:00
this.profile = "mdgpr";
this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate);
2023-04-05 15:15:42 +01:00
// this.updateEventListBox()
}
2021-02-01 17:00:01 +01:00
}
2020-09-04 01:25:32 +01:00
async openAddEvent() {
2021-07-29 15:27:12 +01:00
2021-03-25 15:18:12 +01:00
await this.cloneAllmobileComponent();
this.showEventEditOrOpen = 'add';
this.IsEvent = 'add';
2021-02-24 11:10:51 +01:00
2021-10-09 09:15:22 +01:00
if (window.innerWidth <= 1024) {
2023-08-21 17:36:32 +01:00
let taskParticipants = [
// {
// EmailAddress: SessionStore.user.Email,
// IsRequired: true,
// Name: SessionStore.user.FullName,
// UserType: "GD"
// }
]
2021-02-24 09:14:58 +01:00
const modal = await this.modalCtrl.create({
component: NewEventPage,
2021-10-09 09:15:22 +01:00
componentProps: {
2021-02-24 09:14:58 +01:00
segment: this.segment,
profile: this.profile,
2023-01-24 15:56:47 +01:00
eventSelectedDate: this.eventSelectedDate,
attendees: taskParticipants,
CalendarDate: this.viewDate
2021-02-24 09:14:58 +01:00
},
2021-03-03 16:24:16 +01:00
cssClass: 'modal modal-desktop',
2021-02-24 09:14:58 +01:00
backdropDismiss: false
});
2023-07-15 11:01:09 +01:00
2021-02-24 09:14:58 +01:00
modal.onDidDismiss().then((data) => {
2021-10-09 09:15:22 +01:00
if (data) {
2021-07-29 15:27:12 +01:00
2021-02-24 20:34:17 +01:00
}
2021-02-24 09:14:58 +01:00
this.openAddEventDismiss(data['data'])
});
2023-07-15 11:01:09 +01:00
await modal.present();
2021-02-24 09:14:58 +01:00
} else {
this.mobileComponent.showAddNewEvent = true;
2023-08-21 17:36:32 +01:00
this.taskParticipants = [
// {
// EmailAddress: SessionStore.user.Email,
// IsRequired: true,
// Name: SessionStore.user.FullName,
// UserType: "GD"
// }
]
2021-02-24 09:14:58 +01:00
}
}
2021-03-25 15:18:12 +01:00
2021-10-09 09:15:22 +01:00
openEditEvent() {
2021-03-25 15:18:12 +01:00
this.showEventEditOrOpen = 'edit';
}
2021-10-09 09:15:22 +01:00
openAddEventDismiss(data) {
2021-02-24 10:08:50 +01:00
2022-12-20 17:14:23 +01:00
try {
let postEvent: Event = data;
if (postEvent.Subject != null) {
// this.eventSource.push({
// title: postEvent.Subject,
// startTime: new Date(postEvent.StartDate),
// endTime: new Date(postEvent.EndDate),
// allDay: false,
// event: postEvent
// });
this.myCal.update();
this.myCal.loadEvents();
this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate);
}
} catch (error) {
2021-02-24 09:14:58 +01:00
}
2021-02-24 10:08:50 +01:00
2022-12-20 17:14:23 +01:00
2021-02-24 20:34:17 +01:00
this.cloneAllmobileComponent();
}
2021-03-24 15:10:46 +01:00
// open component
2021-10-09 09:15:22 +01:00
async viewEventDetail(eventId: any) {
2021-07-22 10:39:55 +01:00
2022-05-27 13:36:37 +01:00
const CalendarId = this.selectedEventCalendarId
let navigationExtras: NavigationExtras = { queryParams: { CalendarId } }
this.router.navigate(['/home/agenda/',eventId,'agenda'], navigationExtras);
}
2021-03-24 15:10:46 +01:00
// open component
2021-06-30 14:44:48 +01:00
async viewEventDetailDismiss(data) {
2021-07-29 15:27:12 +01:00
2021-02-24 09:14:58 +01:00
await this.cloneAllmobileComponent()
2021-06-30 14:44:48 +01:00
if (data.type == 'edit') {
2021-07-29 15:27:12 +01:00
2021-02-24 09:14:58 +01:00
this.selectedEvent = data.event;
this.postEvent = data.event;
this.mobileComponent.showEditEvent = true;
2022-12-19 19:25:21 +01:00
} else if(data.type == 'delete') {
2021-02-24 09:14:58 +01:00
}
this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate);
2022-12-19 19:25:21 +01:00
setTimeout(()=>{
this.onCurrentChanged(this.eventSelectedDate)
}, 500)
2021-02-24 09:14:58 +01:00
}
2021-06-30 11:59:57 +01:00
// called from this template and child event
async viewEventsToApprove() {
2021-06-29 14:15:56 +01:00
await this.cloneAllmobileComponent();
2021-02-24 11:10:51 +01:00
2023-02-27 19:52:30 +01:00
if (window.innerWidth <= 1023) {
2021-06-22 15:17:35 +01:00
this.router.navigate(['/home/agenda/event-list']);
2021-02-24 11:10:51 +01:00
} else {
// hide all components
this.cloneAllmobileComponent();
2021-06-30 11:59:57 +01:00
this.mobileComponent.transparentEventList = false;
2021-02-24 11:10:51 +01:00
this.mobileComponent.showEventList = true;
}
2021-06-30 11:59:57 +01:00
}
approveEventDismissGoBack() {
window['temp.path:/shared/agenda/edit-event-to-approve.ts'] = {}
2021-07-26 15:19:03 +01:00
this.cloneAllmobileComponent()
2021-06-30 11:59:57 +01:00
this.mobileComponent.showEventToApprove = true;
2021-07-26 15:19:03 +01:00
this.mobileComponent.showEditEventToApprove = false
2021-02-24 11:10:51 +01:00
2021-03-24 15:10:46 +01:00
}
2021-02-24 09:14:58 +01:00
2021-10-09 09:15:22 +01:00
approveEventDismiss({ saveData, serialNumber, action }) {
2021-02-26 15:29:05 +01:00
2021-06-30 11:59:57 +01:00
window['temp.path:/shared/agenda/edit-event-to-approve.ts'] = {}
2021-07-29 15:27:12 +01:00
2021-10-09 09:15:22 +01:00
if (action == 'Aprovar') {
2021-02-26 15:29:05 +01:00
this.eventToaprove = {
back: true,
saveData: saveData,
2021-10-09 09:15:22 +01:00
serialNumber: serialNumber,
2021-06-30 14:44:48 +01:00
action: action,
2021-05-04 15:44:48 +01:00
InstanceId: saveData.workflowInstanceDataFields.InstanceId || ""
2021-02-26 15:29:05 +01:00
}
2021-06-30 09:45:56 +01:00
2021-02-26 15:29:05 +01:00
this.mobileComponent.showEventToApprove = true;
2021-07-17 21:22:03 +01:00
this.mobileComponent.showEventList = false
2021-06-30 09:45:56 +01:00
2021-02-26 15:29:05 +01:00
}
2021-06-29 14:16:49 +01:00
2021-06-30 14:44:48 +01:00
this.showEventEditOrOpen = "eventoToApprove"
2021-02-26 15:29:05 +01:00
}
2021-06-30 11:59:57 +01:00
closeEventToApprove() {
2021-10-09 09:15:22 +01:00
if (this.eventToaprove.back == true && this.mobileComponent.showEventList == true) {
2021-06-30 14:44:48 +01:00
this.mobileComponent.transparentEventList = false;
this.mobileComponent.showEventToApprove = false;
this.eventToaprove.back = false;
2021-06-30 11:59:57 +01:00
2021-06-30 14:44:48 +01:00
}
else {
this.mobileComponent.showEventToApprove = false;
this.mobileComponent.showEventList = false;
}
2021-06-30 11:59:57 +01:00
2021-06-30 14:44:48 +01:00
}
2021-07-29 15:27:12 +01:00
2021-06-30 11:59:57 +01:00
closeEventToApproveGoBack() {
2021-10-09 09:15:22 +01:00
if (window.innerWidth <= 801) {
2021-06-30 11:59:57 +01:00
this.router.navigate(['/home/agenda/event-list']);
} else {
// hide all components
this.cloneAllmobileComponent();
2021-02-26 15:29:05 +01:00
this.mobileComponent.transparentEventList = false;
2021-06-30 11:59:57 +01:00
this.mobileComponent.showEventList = true;
2021-02-26 15:29:05 +01:00
}
}
2021-06-30 09:45:56 +01:00
// called from emitters
/** @description open component to edit event to approve */
EditApproveEventDismiss() {
2021-06-29 14:15:56 +01:00
this.cloneAllmobileComponent();
this.mobileComponent.showEditEventToApprove = true;
2021-09-27 16:23:41 +01:00
this.taskParticipants = []
this.taskParticipantsCc = []
2021-06-29 14:15:56 +01:00
}
2021-06-30 14:44:48 +01:00
async cloneAllmobileComponent() {
2021-02-24 09:14:58 +01:00
this.mobileComponent.showAddNewEvent = false;
this.mobileComponent.showEditEvent = false;
this.mobileComponent.showEventDetails = false;
this.mobileComponent.showEventList = false;
this.mobileComponent.showEventToApprove = false;
this.mobileComponent.showAttendees = false;
2021-03-25 15:18:12 +01:00
this.mobileComponent.showAttendeeModal = false;
2021-06-29 14:15:56 +01:00
this.mobileComponent.showEditEventToApprove = false;
2021-02-24 09:14:58 +01:00
2021-02-26 15:29:05 +01:00
this.closeEventToApprove();
2021-02-24 09:14:58 +01:00
}
2021-06-30 14:44:48 +01:00
async AproveEventEditEvent(data) {
2021-10-09 09:15:22 +01:00
this.postEvent = data;
this.mobileComponent.transparentEventToApprove = true;
2021-03-03 10:15:44 +01:00
this.mobileComponent.showAddNewEvent = true;
}
2021-03-24 15:10:46 +01:00
// open component
2021-04-07 15:13:31 +01:00
async openAttendeesComponent(data) {
2021-03-24 15:10:46 +01:00
2021-04-08 13:39:48 +01:00
this.adding = data.type
2021-07-29 15:27:12 +01:00
2021-03-24 15:10:46 +01:00
this.cloneAllmobileComponent();
this.mobileComponent.showAttendees = true;
}
2021-06-30 14:44:48 +01:00
async clearContact() {
2021-03-25 10:50:58 +01:00
this.contacts = [];
}
2021-10-09 09:15:22 +01:00
async setContact(data: EventPerson[]) {
2021-03-25 15:18:12 +01:00
this.contacts = data;
}
2021-10-09 09:15:22 +01:00
async openAttendeeModal() {
2021-03-24 15:10:46 +01:00
this.cloneAllmobileComponent();
this.mobileComponent.showAttendeeModal = true;
}
2021-03-25 15:18:12 +01:00
2021-05-07 17:21:05 +01:00
async GoBackEditOrAdd() {
2021-07-29 15:27:12 +01:00
2021-10-09 09:15:22 +01:00
if (this.showEventEditOrOpen == "edit") {
2021-03-25 15:18:12 +01:00
this.cloneAllmobileComponent();
this.mobileComponent.showEditEvent = true;
2021-10-09 09:15:22 +01:00
} else if (this.showEventEditOrOpen == "add") {
2021-03-25 15:18:12 +01:00
this.cloneAllmobileComponent();
this.mobileComponent.showAddNewEvent = true;
2021-10-09 09:15:22 +01:00
} else if (this.showEventEditOrOpen == "eventoToApprove") {
2021-06-30 14:44:48 +01:00
this.cloneAllmobileComponent();
this.mobileComponent.showEditEventToApprove = true
}
else {
2021-03-25 15:18:12 +01:00
// do Nothings
}
}
2021-05-07 17:21:05 +01:00
async closeComponentEditEventOrAdd() {
2021-10-09 09:15:22 +01:00
if (this.IsEvent = 'edit') {
2021-11-24 15:09:40 +01:00
this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate);
this.eventClicked(this.viewingEventObject);
} else if (this.IsEvent = 'add') {
this.cloneAllmobileComponent();
}
2021-07-26 15:19:03 +01:00
}
2023-03-30 14:31:58 +01:00
reloadCalendar() {
//
this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate);
}
2021-07-26 15:19:03 +01:00
async EventToApproveGoBack() {
}
2021-04-07 15:13:31 +01:00
async setIntervenient(data) {
2021-09-27 16:23:41 +01:00
2021-10-09 09:15:22 +01:00
setTimeout(() => {
2021-09-27 16:23:41 +01:00
this.taskParticipants = removeDuplicate(data)
}, 10)
2021-04-05 15:00:14 +01:00
}
2021-07-29 15:27:12 +01:00
2021-04-07 15:13:31 +01:00
async setIntervenientCC(data) {
2021-10-09 09:15:22 +01:00
setTimeout(() => {
2021-09-27 16:23:41 +01:00
this.taskParticipantsCc = removeDuplicate(data)
}, 10)
2021-04-05 15:00:14 +01:00
}
2021-04-07 15:13:31 +01:00
// Emitters
// adding
2021-10-09 09:15:22 +01:00
async setAdding(adding: "intervenient" | "CC" = "intervenient") {
this.adding = adding;
2021-04-07 15:13:31 +01:00
}
2021-10-09 09:15:22 +01:00
async clearPostEvent() {
2021-04-08 13:39:48 +01:00
this.postEvent = false;
}
2021-10-09 09:15:22 +01:00
async changeSegment(segments: "Combinado" | "Pessoal" | "Oficial") {
this.segment = segments;
2021-04-12 14:01:07 +01:00
2021-10-09 09:15:22 +01:00
if (segments == 'Combinado') {
2021-04-12 14:12:26 +01:00
this.timelineFilterState = 'Todos'
2021-04-12 14:01:07 +01:00
} else {
this.timelineFilterState = segments
}
2021-06-17 16:54:03 +01:00
this.showTimelineFilterState = false;
2021-06-25 10:07:22 +01:00
2021-09-02 16:06:53 +01:00
// THIS LINE
2022-07-11 14:33:47 +01:00
this.updateEventListBox();
2021-06-25 10:07:22 +01:00
2021-07-29 15:27:12 +01:00
2021-06-25 09:43:24 +01:00
}
2021-06-24 16:34:27 +01:00
2021-06-25 10:07:22 +01:00
shoeEventDay(events: any[]) {
2021-10-09 09:15:22 +01:00
if (this.segment == 'Combinado') {
2021-06-25 10:07:22 +01:00
return true;
}
2021-10-09 09:15:22 +01:00
const reuslt = events.filter((e) => e.CalendarName == this.segment)
2021-06-25 10:07:22 +01:00
return reuslt.length != 0
}
checkRoleInArray(str) {
return this.eventService.calendarRole.includes(str);
}
2021-07-29 15:27:12 +01:00
}