This commit is contained in:
Peter Maquiran
2023-11-09 12:07:33 +01:00
31 changed files with 398 additions and 77492 deletions
+2 -1
View File
@@ -228,6 +228,7 @@
<!-- {{year.yearInfo.yearName}} -->
<div *ngFor="let month of year.months " class="header-day" >
<!-- {{ month.monthInfo.monthName | json }} -->
<!-- <hr> -->
<div *ngFor="let day of month.days " class="EventListBox-container" >
@@ -237,7 +238,7 @@
<div *ngFor="let event of day.events " class="EventListBox mb-10" >
<div class="d-flex content-{{event.profile}}-{{event.event.CalendarName}} mt-10 cursor-pointer width-100 " (click)="eventClicked(event)"
*ngIf="viewEventMonth <= dateMonth(event) ">
>
<div class="schedule-time" *ngIf="!event.event.IsAllDayEvent">
+75 -72
View File
@@ -105,7 +105,7 @@ export class AgendaPage implements OnInit {
selectedEvent: Event;
selectedEventId: string | number;
selectedEventCalendarId : string | number;
selectedEventCalendarId: string | number;
postEvent: any;
// temporary data
@@ -213,7 +213,7 @@ export class AgendaPage implements OnInit {
} else if (this.loggeduser.Profile == 'PR') {
this.profile = "pr";
} else {
if(this.eventService.usersCalendarIds.length >= 2) {
if (this.eventService.usersCalendarIds.length >= 2) {
this.profile = "mdgpr";
} else if (this.eventService.hasOwnCalendar) {
this.profile = "mdgpr";
@@ -309,8 +309,8 @@ export class AgendaPage implements OnInit {
let weekNum = 0;
function Week(a) {
for(let b of a.querySelectorAll('td')) {
if(!b.className.includes('text-muted')) {
for (let b of a.querySelectorAll('td')) {
if (!b.className.includes('text-muted')) {
weekNum++;
return true
}
@@ -320,18 +320,18 @@ export class AgendaPage implements OnInit {
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');
for (let week of weeks as any ){
for (let week of weeks as any) {
Week(week)
}
this.showCalendar = true
this.listBoxService.height = (weekNum * dayBoxHeight) +'px'
this.listBoxService.height = (weekNum * dayBoxHeight) + 'px'
if(dayBoxHeight == 0) {
if (dayBoxHeight == 0) {
this.weekToShow()
}
} catch (e) {
setTimeout(()=> {
setTimeout(() => {
this.weekToShow()
}, 100)
}
@@ -339,8 +339,8 @@ export class AgendaPage implements OnInit {
}
setCalendarByDefault() {
if(!this.CalendarName) {
if(this.eventService.calendarNamesAry.includes('Meu calendario')) {
if (!this.CalendarName) {
if (this.eventService.calendarNamesAry.includes('Meu calendario')) {
this.CalendarName = 'Meu calendario';
} else {
this.CalendarName = this.eventService.calendarNamesAry[0]
@@ -421,13 +421,16 @@ export class AgendaPage implements OnInit {
onDropDownScrollWeal() {
setTimeout(() => {
document.querySelector('.dropdown-scroll-weel').querySelectorAll('.active')[0].scrollIntoView({ behavior: 'smooth', block: 'center' });
try {
setTimeout(() => {
document.querySelector('.dropdown-scroll-weel').querySelectorAll('.active')[1].scrollIntoView({ behavior: 'smooth', block: 'center' });
}, 300)
}, 10)
document.querySelector('.dropdown-scroll-weel').querySelectorAll('.active')[0].scrollIntoView({ behavior: 'smooth', block: 'center' });
setTimeout(() => {
document.querySelector('.dropdown-scroll-weel').querySelectorAll('.active')[1].scrollIntoView({ behavior: 'smooth', block: 'center' });
}, 300)
}, 10)
} catch (error) {
console.log(error)
}
}
@@ -445,7 +448,7 @@ export class AgendaPage implements OnInit {
this.rangeStartDate = ev.startTime;
this.rangeEndDate = ev.endTime;
if(this.currentMoth.rangeEndDate == null) {
if (this.currentMoth.rangeEndDate == null) {
this.currentMoth = {
rangeStartDate: ev.startTime,
rangeEndDate: ev.endTime
@@ -579,7 +582,7 @@ export class AgendaPage implements OnInit {
loadRangeEvents(startTime: Date, endTime: Date) {
this.weekToShow()
if(!this.eventService.hasAnyCalendar) {
if (!this.eventService.hasAnyCalendar) {
return false
}
@@ -589,9 +592,9 @@ export class AgendaPage implements OnInit {
this.showLoader = true;
const index = `${startTime}${endTime}`
if(!this.loadRequest[index]) {
this.loadRequest[index] = {startTime, endTime}
this.loadRequestHistory[index] = {lastTimeUpdate: new Date()}
if (!this.loadRequest[index]) {
this.loadRequest[index] = { startTime, endTime }
this.loadRequestHistory[index] = { lastTimeUpdate: new Date() }
this.loadRangeEventRun(startTime, endTime)
} else {
@@ -606,7 +609,7 @@ export class AgendaPage implements OnInit {
loadRangeEventRun(startTime: Date, endTime: Date) {
if(SessionStore.user.OwnerCalendars.length == 0 && SessionStore.user.SharedCalendars.length == 0) {
if (SessionStore.user.OwnerCalendars.length == 0 && SessionStore.user.SharedCalendars.length == 0) {
return false
}
@@ -628,16 +631,16 @@ export class AgendaPage implements OnInit {
}
let load = 0;
let load = 0;
for ( const selectedCalendar of selectedCalendarIds) {
for (const selectedCalendar of selectedCalendarIds) {
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) => {
let label;
if(SessionStore.user.Profile == 'PR') {
if (SessionStore.user.Profile == 'PR') {
label = "pr"
} else if(SessionStore.user.OwnerCalendars.find(e => e.CalendarId == selectedCalendar.CalendarId)) {
} else if (SessionStore.user.OwnerCalendars.find(e => e.CalendarId == selectedCalendar.CalendarId)) {
label = 'md'
} else {
label = "pr"
@@ -656,7 +659,7 @@ export class AgendaPage implements OnInit {
this.deleteLoadRangeEvent(startTime, endTime);
load++
if(load == selectedCalendarIds.length) {
if (load == selectedCalendarIds.length) {
this.showLoader = false;
}
@@ -669,9 +672,9 @@ export class AgendaPage implements OnInit {
selectedAgenda = {}
getSelectedAgendaCalendars () {
getSelectedAgendaCalendars() {
if(this.CalendarName == 'PR+MDGPR') {
if (this.CalendarName == 'PR+MDGPR') {
let result = this.SessionStore.user.OwnerCalendars
@@ -682,46 +685,46 @@ export class AgendaPage implements OnInit {
return result.concat(join)
} else {
const calendar = this.eventService.calendarNamesType[this.CalendarName];
let Oficial = calendar?.['OficialId']
let Pessoal = calendar?.['PessoalId']
const calendar = this.eventService.calendarNamesType[this.CalendarName];
let Oficial = calendar?.['OficialId']
let Pessoal = calendar?.['PessoalId']
if(Oficial && Pessoal) {
if (Oficial && Pessoal) {
return [
{
CalendarId : Oficial,
OwnerId: calendar.OwnerId,
CalendarName: calendar.CalendarName
},
{
OwnerId: calendar.OwnerId,
CalendarId : Pessoal,
CalendarName: calendar.CalendarName
return [
{
CalendarId: Oficial,
OwnerId: calendar.OwnerId,
CalendarName: calendar.CalendarName
},
{
OwnerId: calendar.OwnerId,
CalendarId: Pessoal,
CalendarName: calendar.CalendarName
}
]
} else if (Oficial) {
try {
return [{
OwnerId: calendar.OwnerId,
CalendarId: Oficial,
CalendarName: calendar.CalendarName
}]
} catch (error) {
console.log(error)
}
} else {
try {
return [{
OwnerId: calendar.OwnerId,
CalendarId: Pessoal,
CalendarName: calendar.CalendarName
}]
} catch (error) {
console.log(error)
}
]
} else if (Oficial) {
try {
return [{
OwnerId: calendar.OwnerId,
CalendarId : Oficial,
CalendarName: calendar.CalendarName
}]
} catch (error) {
console.log(error)
}
} else {
try {
return [{
OwnerId: calendar.OwnerId,
CalendarId : Pessoal,
CalendarName: calendar.CalendarName
}]
} catch (error) {
console.log(error)
}
}
}
@@ -781,7 +784,7 @@ export class AgendaPage implements OnInit {
} catch (e) { }
this.updateEventListBox()
} else {}
} else { }
}
@@ -920,7 +923,7 @@ export class AgendaPage implements OnInit {
this.myCal.loadEvents();
this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate);
}
} catch (error) {
} catch (error) {
}
@@ -935,7 +938,7 @@ export class AgendaPage implements OnInit {
let navigationExtras: NavigationExtras = { queryParams: { CalendarId } }
this.router.navigate(['/home/agenda/',eventId,'agenda'], navigationExtras);
this.router.navigate(['/home/agenda/', eventId, 'agenda'], navigationExtras);
}
@@ -950,13 +953,13 @@ export class AgendaPage implements OnInit {
this.postEvent = data.event;
this.mobileComponent.showEditEvent = true;
} else if(data.type == 'delete') {
} else if (data.type == 'delete') {
}
this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate);
setTimeout(()=>{
setTimeout(() => {
this.onCurrentChanged(this.eventSelectedDate)
}, 500)
@@ -1185,10 +1188,10 @@ export class AgendaPage implements OnInit {
}
function endOfMonth(myDate){
function endOfMonth(myDate) {
let date = new Date(myDate);
date.setDate(1); // Avoids edge cases on the 31st day of some months
date.setMonth(date.getMonth() +1);
date.setMonth(date.getMonth() + 1);
date.setDate(0);
date.setHours(23);
date.setMinutes(59);
@@ -22,6 +22,7 @@ import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
import { environment } from 'src/environments/environment';
import { ProcessesService } from 'src/app/services/processes.service';
import { TaskService } from 'src/app/services/task.service'
import { ContactsService } from 'src/app/services/contacts.service';
const CUSTOM_DATE_FORMATS: NgxMatDateFormats = {
parse: {
@@ -93,6 +94,9 @@ export class NewEventPage implements OnInit {
roomId: string;
globalEnd = new Date('1999')
environment = environment
eventPersons: EventPerson[];
contacts: EventPerson[];
constructor(
private modalController: ModalController,
@@ -105,7 +109,8 @@ export class NewEventPage implements OnInit {
private chatMethodService: ChatMethodsService,
private hhtpErrorHandle: HttpErrorHandle,
private processeService: ProcessesService,
public TaskService: TaskService
public TaskService: TaskService,
private contactsService: ContactsService,
) {
this.loggeduser = SessionStore.user;
this.postEvent = new Event();
@@ -196,6 +201,7 @@ export class NewEventPage implements OnInit {
this.checkRoleInArray()
this.changeAgenda()
this.fetchContacts("")
}
ngOnDestroy() {
@@ -831,4 +837,33 @@ export class NewEventPage implements OnInit {
return toAproveObject;
}
async fetchContacts(filter: string) {
if (this.loggeduser.Profile == 'PR') {
this.contactsService.getContacts(filter).subscribe(result => {
if (this.eventPersons != null) {
this.eventPersons.forEach(attendee => {
const index: number = result.findIndex((cont) => {
return cont.EmailAddress.toLocaleLowerCase() == attendee.EmailAddress.toLocaleLowerCase()
});
result.splice(index, 1);
});
}
this.contacts = result;
console.log('Attendes Email', this.loggeduser.Email)
let filterLoggedUserEmail = this.contacts.filter(item => item.RoleDescription == "Ministro e Director do Gabinete do PR")
console.log('Attendes Email', filterLoggedUserEmail)
this.contacts = filterLoggedUserEmail;
const newAttendees: EventPerson[] = this.contacts;
this.setIntervenient(newAttendees);
console.log('Attendes Email', this.contacts)
}
);
}
}
}