mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
fix
This commit is contained in:
@@ -21,6 +21,8 @@ export class EventListPage implements OnInit {
|
||||
eventsPRList: any = []
|
||||
eventsMDGPRList: any = []
|
||||
eventsGenericList: any = []
|
||||
|
||||
eventsList: any = []
|
||||
eventPerson: EventPerson;
|
||||
eventBody: EventBody;
|
||||
categories: string[];
|
||||
@@ -28,6 +30,7 @@ export class EventListPage implements OnInit {
|
||||
loggeduser: LoginUserRespose;
|
||||
segment:string;
|
||||
eventoaprovacaostore = EventoAprovacaoStore;
|
||||
color: 'pr' | 'mdgpr'
|
||||
|
||||
@Input() profile:string;
|
||||
@Input() showComponent:string;
|
||||
@@ -78,79 +81,49 @@ export class EventListPage implements OnInit {
|
||||
|
||||
async LoadToApproveEvents() {
|
||||
this.showLoader = true;
|
||||
|
||||
try {
|
||||
if(this.segment == 'MDGPR') {
|
||||
const segment = this.segment
|
||||
let mdEventsOficial = await this.processes.GetTasksList('Agenda Oficial MDGPR', false).toPromise();
|
||||
let mdEventsPessoal = await this.processes.GetTasksList('Agenda Pessoal MDGPR', false).toPromise();
|
||||
|
||||
let allEvents = mdEventsOficial.concat(mdEventsPessoal);
|
||||
if(allEvents.length > 0) {
|
||||
this.eventsMDGPRList = this.sortService.sortArrayByDate(allEvents).reverse();
|
||||
}
|
||||
this.showLoader = false;
|
||||
|
||||
this.eventoaprovacaostore.save(segment, this.eventsMDGPRList)
|
||||
}
|
||||
else if(this.segment == 'PR') {
|
||||
const segment = this.segment
|
||||
let prEventsOficial = await this.processes.GetTasksList('Agenda Oficial PR,Agenda Pessoal PR', false).toPromise();
|
||||
let allEvents = prEventsOficial
|
||||
|
||||
if(allEvents.length > 0) {
|
||||
this.eventsPRList = this.sortService.sortArrayByDate(allEvents).reverse();
|
||||
}
|
||||
this.showLoader = false;
|
||||
const segment = this.segment
|
||||
|
||||
this.eventoaprovacaostore.save(segment, this.eventsMDGPRList)
|
||||
if(this.segment == 'MDGPR') {
|
||||
// color
|
||||
if(SessionStore.user.Profile == 'PR') {
|
||||
this.color = 'pr'
|
||||
} else {
|
||||
let genericEvents = await this.processes.GetTasksList('Agendar Evento', false).toPromise();
|
||||
if(genericEvents.length > 0) {
|
||||
this.eventsGenericList = this.sortService.sortArrayByDate(genericEvents).reverse();
|
||||
}
|
||||
this.showLoader = false;
|
||||
this.color = 'mdgpr'
|
||||
}
|
||||
|
||||
let genericEvents = await this.processes.GetTasksList('Agendar Evento', false).toPromise();
|
||||
try {
|
||||
this.eventsList = this.sortService.sortArrayByDate(genericEvents).reverse();
|
||||
} catch (error) {
|
||||
this.eventsList = [];
|
||||
}
|
||||
|
||||
this.eventoaprovacaostore.save(segment, this.eventsList)
|
||||
|
||||
} else {
|
||||
|
||||
this.color = 'pr'
|
||||
|
||||
let allEvents = await this.processes.eventsToApprove(segment).toPromise()
|
||||
try {
|
||||
this.eventsList = this.sortService.sortArrayByDate(allEvents).reverse();
|
||||
} catch(error) {
|
||||
this.eventsList = []
|
||||
}
|
||||
|
||||
} catch(erro) {
|
||||
this.showLoader = false;
|
||||
this.eventsList = this.eventsList
|
||||
this.eventsList = this.eventsList
|
||||
this.eventoaprovacaostore.save(segment, this.eventsList)
|
||||
}
|
||||
|
||||
this.showLoader = false;
|
||||
|
||||
}
|
||||
|
||||
async LoadToApproveEventsNoLoader() {
|
||||
|
||||
try {
|
||||
if(this.segment == 'MDGPR') {
|
||||
let mdEventsOficial = await this.processes.GetTasksList('Agenda Oficial MDGPR,Agenda Pessoal MDGPR', false).toPromise();
|
||||
|
||||
let allEvents = mdEventsOficial
|
||||
if(allEvents.length > 0) {
|
||||
this.eventsMDGPRList = this.sortService.sortArrayByDate(allEvents).reverse();
|
||||
}
|
||||
this.showLoader = false;
|
||||
}
|
||||
else if(this.segment == 'PR') {
|
||||
let prEventsOficial = await this.processes.GetTasksList('Agenda Oficial PR,Agenda Pessoal PR', false).toPromise();
|
||||
let allEvents = prEventsOficial
|
||||
|
||||
if(allEvents.length > 0) {
|
||||
this.eventsPRList = this.sortService.sortArrayByDate(allEvents).reverse();
|
||||
}
|
||||
this.showLoader = false;
|
||||
} else {
|
||||
let genericEvents = await this.processes.GetTasksList('Agendar Evento', false).toPromise();
|
||||
if(genericEvents.length > 0) {
|
||||
this.eventsGenericList = this.sortService.sortArrayByDate(genericEvents).reverse();
|
||||
}
|
||||
this.showLoader = false;
|
||||
}
|
||||
|
||||
} catch(erro) {
|
||||
this.showLoader = false;
|
||||
}
|
||||
|
||||
this.LoadToApproveEvents()
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user