mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
merge
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user