mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-20 05:16:07 +00:00
save
This commit is contained in:
@@ -93,14 +93,6 @@
|
||||
|
||||
</div>
|
||||
|
||||
<!-- <div class="drop-down">
|
||||
<ion-icon slot="icon-only" class="arrow-down" src="assets/images/icons-arrow-arrow-down.svg"></ion-icon>
|
||||
<div class="drop-down-container">
|
||||
<ul>
|
||||
<li *ngFor="let month of monthList" (click)="dropDownChangeDate(month.id)" >{{ month.name }}</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div> -->
|
||||
<!-- Move forward one screen of the slides -->
|
||||
<div (click)="next()" class="arrow cursor-pointer resize">
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " slot="icon-only" src="assets/images/icons-calendar-arrow-right.svg"></ion-icon>
|
||||
@@ -111,11 +103,11 @@
|
||||
</ion-row>
|
||||
<ion-row class="ion-align-items-center">
|
||||
|
||||
<button *ngIf="profile == 'mdgpr' && loggeduser.Profile =='MDGPR' " (click)="changeProfile()" class="d-md-none btn-no-color resize">
|
||||
<button *ngIf="profile == 'mdgpr' && eventService.calendarOwnerIds.length >= 2 " (click)="changeProfile()" class="d-md-none btn-no-color resize">
|
||||
<ion-icon class="right-icons" src="assets/images/icons-profile-calendar-md.svg"></ion-icon>
|
||||
</button>
|
||||
|
||||
<button title="Mudar de Agenda" *ngIf="profile == 'pr' && loggeduser.Profile =='MDGPR' " (click)="changeProfile()" class="btn-no-color resize">
|
||||
<button title="Mudar de Agenda" *ngIf="profile == 'pr'&& eventService.calendarOwnerIds.length >= 2 " (click)="changeProfile()" class="btn-no-color resize">
|
||||
<ion-icon class="right-icons d-md-none" src="assets/images/icons-profile-calendar-pr.svg"></ion-icon>
|
||||
</button>
|
||||
|
||||
@@ -184,9 +176,7 @@
|
||||
|
||||
</div>
|
||||
|
||||
<div class="calendar-border">
|
||||
|
||||
</div>
|
||||
<div class="calendar-border"></div>
|
||||
|
||||
<!-- Calendar currente date -->
|
||||
<ion-row class="timeline-header pb-0 ion-justify-content-between ion-align-items-center currente-date-timelien">
|
||||
@@ -290,7 +280,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="fs-timeline flex-grow-1 d-none d-md-block d-md-block text-black pr-20 width-100 height-100 overflow-y-auto" *ngIf="loggeduser.Profile == 'MDGPR'">
|
||||
<div class="fs-timeline flex-grow-1 d-none d-md-block d-md-block text-black pr-20 width-100 height-100 overflow-y-auto" *ngIf="eventService.calendarOwnerIds.length >= 2">
|
||||
<div *ngFor="let events of TimelineMDList | keyvalue;" >
|
||||
|
||||
<div class="EventListBox-container" >
|
||||
|
||||
@@ -167,7 +167,7 @@ export class AgendaPage implements OnInit {
|
||||
private alertCtrl: AlertController,
|
||||
@Inject(LOCALE_ID) private locale: string,
|
||||
private modalCtrl: ModalController,
|
||||
private eventService: EventsService,
|
||||
public eventService: EventsService,
|
||||
private router: Router,
|
||||
private sanitizer: DomSanitizer,
|
||||
authService: AuthService,
|
||||
@@ -192,16 +192,27 @@ export class AgendaPage implements OnInit {
|
||||
if (this.loggeduser.Profile == 'MDGPR') {
|
||||
this.mobileComponent.showEventList = true;
|
||||
this.profile = "mdgpr";
|
||||
} else {
|
||||
} else if (this.loggeduser.Profile == 'PR') {
|
||||
this.profile = "pr";
|
||||
} else {
|
||||
this.profile = "mdgpr";
|
||||
}
|
||||
})
|
||||
|
||||
if (this.loggeduser.Profile == 'MDGPR') {
|
||||
this.mobileComponent.showEventList = true;
|
||||
this.profile = "mdgpr";
|
||||
} else {
|
||||
} else if (this.loggeduser.Profile == 'PR') {
|
||||
this.profile = "pr";
|
||||
} else {
|
||||
if(this.eventService.calendarOwnerIds.length >= 2) {
|
||||
this.profile = "mdgpr";
|
||||
} else if (this.eventService.hasOwnCalendar) {
|
||||
this.profile = "mdgpr";
|
||||
} else if (this.eventService.hasSharedCalendar) {
|
||||
this.profile = "pr";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
this.calendarHeight = "356px";
|
||||
@@ -529,8 +540,7 @@ export class AgendaPage implements OnInit {
|
||||
|
||||
}).catch((error) => {
|
||||
this.getFromDB();
|
||||
})
|
||||
.finally(() => {
|
||||
}).finally(() => {
|
||||
this.showLoader = false;
|
||||
})
|
||||
|
||||
@@ -560,9 +570,9 @@ export class AgendaPage implements OnInit {
|
||||
}).catch((error) => {
|
||||
this.getFromDB()
|
||||
})
|
||||
.finally(() => {
|
||||
this.showLoader = false;
|
||||
})
|
||||
.finally(() => {
|
||||
this.showLoader = false;
|
||||
})
|
||||
|
||||
}
|
||||
else if (this.loggeduser.Profile == 'PR') {
|
||||
@@ -597,6 +607,70 @@ export class AgendaPage implements OnInit {
|
||||
.finally(() => {
|
||||
this.showLoader = false;
|
||||
})
|
||||
} else if (this.loggeduser.Profile != 'PR' && this.loggeduser.Profile != 'MDGPR'){
|
||||
if(this.profile == "mdgpr") {
|
||||
|
||||
this.eventService.getAllOwnEvents(momentG(new Date(startTime), 'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime), 'yyyy-MM-dd 23:59:59')).then(
|
||||
|
||||
(response: any) => {
|
||||
console.log('ALL MD EVENTS', response);
|
||||
|
||||
this.addEventToDB(response, "md");
|
||||
|
||||
// calendar
|
||||
this.CalendarStore.removeRange(startTime, endTime, 'md')
|
||||
|
||||
// loop
|
||||
this.CalendarStore.pushEvent(response, 'md');
|
||||
|
||||
console.log('CALENDAR STORE', this.CalendarStore.eventSource)
|
||||
this.listToPresent = this.CalendarStore.eventSource
|
||||
this.trasnformData(response, 'md');
|
||||
|
||||
this.TimelineMDList = this.listBoxService.list(this.listToPresent, 'md', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
|
||||
|
||||
console.log('check list to present data', this.listToPresent);
|
||||
this.myCal.update();
|
||||
this.myCal.loadEvents();
|
||||
|
||||
this.showLoader = false;
|
||||
this.showTimeline = true;
|
||||
|
||||
}).catch((error) => {
|
||||
this.getFromDB();
|
||||
}).finally(() => {
|
||||
this.showLoader = false;
|
||||
})
|
||||
|
||||
} else if (this.profile == "pr" ) {
|
||||
|
||||
this.eventService.genericGetAllSharedEvents(momentG(new Date(startTime), 'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime), 'yyyy-MM-dd 23:59:59')).then((response: any) => {
|
||||
this.addEventToDB(response, "pr");
|
||||
|
||||
this.CalendarStore.removeRange(startTime, endTime, 'pr')
|
||||
// calendar
|
||||
this.CalendarStore.pushEvent(response, 'pr');
|
||||
|
||||
this.listToPresent = this.CalendarStore.eventSource
|
||||
|
||||
|
||||
this.TimelineMDList = this.listBoxService.list(this.listToPresent, 'pr', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
|
||||
|
||||
console.log('check list to present data', this.listToPresent);
|
||||
this.myCal.update();
|
||||
this.myCal.loadEvents();
|
||||
|
||||
this.showLoader = false;
|
||||
this.showTimeline = true;
|
||||
|
||||
}).catch((error) => {
|
||||
this.getFromDB()
|
||||
}).finally(() => {
|
||||
this.showLoader = false;
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
@@ -604,9 +678,11 @@ export class AgendaPage implements OnInit {
|
||||
|
||||
let counter = 0;
|
||||
|
||||
// view MDGPR calendar with MDGPR profile
|
||||
if (this.loggeduser.Profile == 'MDGPR') {
|
||||
|
||||
|
||||
alert('MDGPR')
|
||||
|
||||
this.eventService.getAllMdEvents(momentG(new Date(startTime), 'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime), 'yyyy-MM-dd 23:59:59')).then((response: any) => {
|
||||
|
||||
this.addEventToDB(response, "md");
|
||||
@@ -635,13 +711,12 @@ export class AgendaPage implements OnInit {
|
||||
|
||||
}).catch((error) => {
|
||||
this.getFromDB()
|
||||
}).finally(() => {
|
||||
counter++;
|
||||
if (counter == 2) {
|
||||
this.showLoader = false;
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
counter++;
|
||||
if (counter == 2) {
|
||||
this.showLoader = false;
|
||||
}
|
||||
})
|
||||
|
||||
this.eventService.getAllSharedEvents(momentG(new Date(startTime), 'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime), 'yyyy-MM-dd 23:59:59')).then((response: any) => {
|
||||
|
||||
@@ -673,15 +748,14 @@ export class AgendaPage implements OnInit {
|
||||
|
||||
}).catch((error) => {
|
||||
this.getFromDB()
|
||||
})
|
||||
.finally(() => {
|
||||
}).finally(() => {
|
||||
counter++;
|
||||
if (counter == 2) {
|
||||
this.showLoader = false;
|
||||
}
|
||||
})
|
||||
if (counter == 2) {
|
||||
this.showLoader = false;
|
||||
}
|
||||
})
|
||||
|
||||
} else {
|
||||
} else if(this.loggeduser.Profile == 'PR') {
|
||||
|
||||
// view PR calendar with PR profile
|
||||
this.eventService.getAllPrEvents(momentG(new Date(startTime), 'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime), 'yyyy-MM-dd 23:59:59')).then((response: any) => {
|
||||
@@ -719,12 +793,105 @@ export class AgendaPage implements OnInit {
|
||||
|
||||
}).catch((error) => {
|
||||
this.getFromDB()
|
||||
}).finally(() => {
|
||||
if (counter == 1 || this.loggeduser.Profile == 'PR') {
|
||||
this.showLoader = false;
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
if (counter == 1 || this.loggeduser.Profile == 'PR') {
|
||||
|
||||
} else {
|
||||
|
||||
if(this.loggeduser.OwnerCalendars.length != 0) {
|
||||
|
||||
this.eventService.getAllOwnEvents(momentG(new Date(startTime), 'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime), 'yyyy-MM-dd 23:59:59')).then((response: any) => {
|
||||
|
||||
this.addEventToDB(response, "md");
|
||||
let eventsList = response;
|
||||
|
||||
this.CalendarStore.removeRange(startTime, endTime, 'md')
|
||||
|
||||
// loop
|
||||
this.CalendarStore.pushEvent(eventsList, 'md');
|
||||
|
||||
this.listToPresent = this.CalendarStore.eventSource
|
||||
|
||||
this.TimelineMDList = this.listBoxService.list(this.listToPresent, 'md', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
|
||||
|
||||
console.log('check list to present data', this.listToPresent);
|
||||
this.myCal.update();
|
||||
this.myCal.loadEvents();
|
||||
|
||||
this.showTimelineMD = true;
|
||||
|
||||
counter++;
|
||||
if (counter == 2) {
|
||||
this.showLoader = false;
|
||||
}
|
||||
|
||||
|
||||
}).catch((error) => {
|
||||
this.getFromDB()
|
||||
}).finally(() => {
|
||||
counter++;
|
||||
if (counter == 2) {
|
||||
this.showLoader = false;
|
||||
}
|
||||
})
|
||||
} else {
|
||||
counter++;
|
||||
if (counter == 2) {
|
||||
this.showLoader = false;
|
||||
}
|
||||
}
|
||||
|
||||
console.log(this.loggeduser.SharedCalendars)
|
||||
|
||||
if(this.loggeduser.SharedCalendars.length != 0) {
|
||||
|
||||
|
||||
this.eventService.genericGetAllSharedEvents(momentG(new Date(startTime), 'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime), 'yyyy-MM-dd 23:59:59')).then((response: any) => {
|
||||
|
||||
this.addEventToDB(response, "pr");
|
||||
let eventsList = response;
|
||||
|
||||
// clear the current month only
|
||||
this.CalendarStore.removeRange(startTime, endTime, 'pr')
|
||||
|
||||
|
||||
this.CalendarStore.pushEvent(eventsList, 'pr');
|
||||
this.listToPresent = this.CalendarStore.eventSource
|
||||
|
||||
|
||||
this.TimelinePRList = this.listBoxService.list(this.listToPresent, 'pr', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
|
||||
|
||||
console.log('check list to present data', this.listToPresent);
|
||||
|
||||
this.myCal.update();
|
||||
this.myCal.loadEvents();
|
||||
|
||||
this.showTimelinePR = true;
|
||||
|
||||
counter++;
|
||||
|
||||
if (counter == 2 || this.loggeduser.Profile == 'PR') {
|
||||
this.showLoader = false;
|
||||
}
|
||||
|
||||
}).catch((error) => {
|
||||
this.getFromDB()
|
||||
})
|
||||
.finally(() => {
|
||||
counter++;
|
||||
if (counter == 2) {
|
||||
this.showLoader = false;
|
||||
}
|
||||
})
|
||||
} else {
|
||||
counter++;
|
||||
if (counter == 2) {
|
||||
this.showLoader = false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -751,21 +918,25 @@ export class AgendaPage implements OnInit {
|
||||
|
||||
//Deve ser removido para ficar só um method transform
|
||||
trasnformDataDB(response) {
|
||||
console.log('Transform ', response)
|
||||
response.forEach(element => {
|
||||
let event = {
|
||||
startTime: new Date(element.StartDate),
|
||||
endTime: new Date(element.EndDate),
|
||||
allDay: false,
|
||||
event: element,
|
||||
calendarName: element.CalendarName,
|
||||
profile: element.Profile,
|
||||
id: element.EventId,
|
||||
}
|
||||
this.array.push(event)
|
||||
});
|
||||
this.listToPresent = this.array;
|
||||
console.log('LIST TO PRESET', this.listToPresent)
|
||||
|
||||
if(response) {
|
||||
console.log('Transform ', response)
|
||||
response.forEach(element => {
|
||||
let event = {
|
||||
startTime: new Date(element.StartDate),
|
||||
endTime: new Date(element.EndDate),
|
||||
allDay: false,
|
||||
event: element,
|
||||
calendarName: element.CalendarName,
|
||||
profile: element.Profile,
|
||||
id: element.EventId,
|
||||
}
|
||||
this.array.push(event)
|
||||
});
|
||||
this.listToPresent = this.array;
|
||||
console.log('LIST TO PRESET', this.listToPresent)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
addEventToDB(response, profile) {
|
||||
|
||||
@@ -14,7 +14,6 @@ import { AttendeesPageModal } from '../../events/attendees/attendees.page';
|
||||
import { SearchPage } from '../../search/search.page';
|
||||
import { ThemePalette } from '@angular/material/core';
|
||||
import { FormControl, FormGroup, Validators } from '@angular/forms';
|
||||
import { EventRecurrence } from 'src/app/models/agenda/eventrecurrence.model';
|
||||
import { ThemeService } from 'src/app/services/theme.service';
|
||||
import { NgxMatDateFormats } from '@angular-material-components/datetime-picker';
|
||||
import { NGX_MAT_DATE_FORMATS } from '@angular-material-components/datetime-picker';
|
||||
@@ -315,6 +314,8 @@ export class NewEventPage implements OnInit {
|
||||
console.log(this.loggeduser.Profile);
|
||||
|
||||
eventId = await this.eventService.postEventPr(this.postEvent, this.postEvent.CalendarName).toPromise();
|
||||
} else {
|
||||
eventId = await this.eventService.postEventGeneric(this.postEvent, this.postEvent.CalendarName).toPromise();
|
||||
}
|
||||
|
||||
const DocumentToSave: EventAttachment[] = this.documents.map((e) => {
|
||||
|
||||
Reference in New Issue
Block a user