mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 21:06:06 +00:00
list events
This commit is contained in:
@@ -30,10 +30,10 @@ import { BackgroundService } from 'src/app/services/background.service';
|
||||
import { ThemeService } from 'src/app/services/theme.service'
|
||||
import { SessionStore } from 'src/app/store/session.service';
|
||||
import { PermissionService } from 'src/app/services/permission.service';
|
||||
import { AgendaDataRepositoryService } from 'src/app/services/Repositorys/Agenda/agenda-data-repository.service';
|
||||
import { environment } from 'src/environments/environment';
|
||||
import { RoleIdService } from 'src/app/services/role-id.service'
|
||||
import { EventListStore } from 'src/app/models/agenda/AgendaEventList';
|
||||
import { ContactsService } from 'src/app/services/contacts.service';
|
||||
import { Cy } from 'cypress/enum'
|
||||
@Component({
|
||||
selector: 'app-agenda',
|
||||
@@ -184,7 +184,8 @@ export class AgendaPage implements OnInit {
|
||||
private backgroundservice: BackgroundService,
|
||||
public ThemeService: ThemeService,
|
||||
public p: PermissionService,
|
||||
public RoleIdService: RoleIdService
|
||||
public RoleIdService: RoleIdService,
|
||||
public AgendaDataRepositoryService: AgendaDataRepositoryService
|
||||
) {
|
||||
|
||||
this.dateAdapter.setLocale('es');
|
||||
@@ -280,13 +281,8 @@ export class AgendaPage implements OnInit {
|
||||
if (this.segment == null) {
|
||||
this.segment = "Combinado";
|
||||
}
|
||||
if (realoadCounter != 0) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
this.calendar.currentDate = new Date();
|
||||
//this.onCurrentChanged(new Date())
|
||||
|
||||
try {
|
||||
this.myCal.update();
|
||||
@@ -425,6 +421,9 @@ export class AgendaPage implements OnInit {
|
||||
|
||||
onCurrentChanged = (ev: Date) => {
|
||||
// timeline change date
|
||||
|
||||
// console.log(new Date(ev))
|
||||
|
||||
this.timelineDate = momentG(new Date(ev), 'dd MMMM yyyy');
|
||||
|
||||
this.monthNum = new Date(ev).getMonth()
|
||||
@@ -435,8 +434,7 @@ export class AgendaPage implements OnInit {
|
||||
this.eventSelectedDate = new Date(ev);
|
||||
|
||||
this.updateEventListBox();
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
// onDropDownScrollWeal() {
|
||||
|
||||
@@ -605,15 +603,7 @@ export class AgendaPage implements OnInit {
|
||||
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() }
|
||||
|
||||
this.loadRangeEventRun(startTime, endTime)
|
||||
} else {
|
||||
// alert('other')
|
||||
}
|
||||
this.loadRangeEventRun(startTime, endTime)
|
||||
}
|
||||
|
||||
deleteLoadRangeEvent(startTime: Date, endTime: Date) {
|
||||
@@ -644,11 +634,10 @@ export class AgendaPage implements OnInit {
|
||||
|
||||
}
|
||||
|
||||
|
||||
let load = 0;
|
||||
|
||||
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) => {
|
||||
|
||||
this.AgendaDataRepositoryService.EventList({userId: selectedCalendar.OwnerUserId, calendarOwnerName: selectedCalendar['FullName'] }).subscribe( response => {
|
||||
|
||||
let label;
|
||||
|
||||
@@ -661,7 +650,6 @@ export class AgendaPage implements OnInit {
|
||||
}
|
||||
|
||||
let eventsList = response;
|
||||
this.CalendarStore.removeRangeForCalendar(startTime, endTime, label, selectedCalendar.CalendarId)
|
||||
this.CalendarStore.pushEvent(eventsList, label);
|
||||
|
||||
this.listToPresent = this.CalendarStore.getEventsByCalendarIds(selectedCalendarIds)
|
||||
@@ -669,9 +657,6 @@ export class AgendaPage implements OnInit {
|
||||
|
||||
this.showTimelinePR = true;
|
||||
|
||||
}).finally(() => {
|
||||
this.deleteLoadRangeEvent(startTime, endTime);
|
||||
|
||||
load++
|
||||
if (load == selectedCalendarIds.length) {
|
||||
this.showLoader = false;
|
||||
@@ -679,6 +664,18 @@ export class AgendaPage implements OnInit {
|
||||
|
||||
this.myCal.update();
|
||||
this.myCal.loadEvents();
|
||||
this.updateEventListBox()
|
||||
}, () => {
|
||||
|
||||
load++
|
||||
if (load == selectedCalendarIds.length) {
|
||||
this.showLoader = false;
|
||||
}
|
||||
|
||||
this.myCal.update();
|
||||
this.myCal.loadEvents();
|
||||
|
||||
console.log('111b')
|
||||
this.listToPresent = this.CalendarStore.getEventsByCalendarIds(selectedCalendarIds)
|
||||
this.updateEventListBox()
|
||||
})
|
||||
@@ -687,17 +684,15 @@ export class AgendaPage implements OnInit {
|
||||
|
||||
selectedAgenda = {}
|
||||
|
||||
getSelectedAgendaCalendars() {
|
||||
getSelectedAgendaCalendars(): any {
|
||||
|
||||
if (this.CalendarName == 'PR+MDGPR') {
|
||||
|
||||
let result = this.SessionStore.user.OwnerCalendars
|
||||
return[{
|
||||
...this.eventService.calendarNamesType['Meu calendario'],
|
||||
OwnerUserId: this.SessionStore.user.UserId
|
||||
}]
|
||||
|
||||
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 {
|
||||
|
||||
const calendar = this.eventService.calendarNamesType[this.CalendarName];
|
||||
@@ -708,23 +703,29 @@ export class AgendaPage implements OnInit {
|
||||
|
||||
return [
|
||||
{
|
||||
OwnerUserId: calendar.OwnerId,
|
||||
CalendarId: Oficial,
|
||||
OwnerId: calendar.OwnerId,
|
||||
CalendarName: calendar.CalendarName
|
||||
CalendarName: calendar.CalendarName,
|
||||
FullName: calendar.FullName
|
||||
},
|
||||
{
|
||||
OwnerUserId: calendar.OwnerId,
|
||||
OwnerId: calendar.OwnerId,
|
||||
CalendarId: Pessoal,
|
||||
CalendarName: calendar.CalendarName
|
||||
CalendarName: calendar.CalendarName,
|
||||
FullName: calendar.FullName
|
||||
}
|
||||
]
|
||||
|
||||
} else if (Oficial) {
|
||||
try {
|
||||
return [{
|
||||
OwnerUserId: calendar.OwnerId,
|
||||
OwnerId: calendar.OwnerId,
|
||||
CalendarId: Oficial,
|
||||
CalendarName: calendar.CalendarName
|
||||
CalendarName: calendar.CalendarName,
|
||||
FullName: calendar.FullName
|
||||
}]
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
@@ -732,9 +733,11 @@ export class AgendaPage implements OnInit {
|
||||
} else {
|
||||
try {
|
||||
return [{
|
||||
OwnerUserId: calendar.OwnerId,
|
||||
OwnerId: calendar.OwnerId,
|
||||
CalendarId: Pessoal,
|
||||
CalendarName: calendar.CalendarName
|
||||
CalendarName: calendar.CalendarName,
|
||||
FullName: calendar.FullName
|
||||
}]
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
@@ -743,8 +746,6 @@ export class AgendaPage implements OnInit {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
updateEventListBox() {
|
||||
@@ -1139,8 +1140,8 @@ export class AgendaPage implements OnInit {
|
||||
reloadCalendar() {
|
||||
//
|
||||
this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate);
|
||||
|
||||
this.onCurrentChanged(new Date(this.timelineDate))
|
||||
this.updateEventListBox();
|
||||
// this.onCurrentChanged(new Date(this.timelineDate))
|
||||
}
|
||||
|
||||
async EventToApproveGoBack() {
|
||||
|
||||
Reference in New Issue
Block a user