mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-20 05:16:07 +00:00
fix
This commit is contained in:
@@ -16,6 +16,7 @@ import { ThemeService } from 'src/app/services/theme.service'
|
||||
import { RouteService } from 'src/app/services/route.service';
|
||||
import { Storage } from '@ionic/storage';
|
||||
import { EventsService } from 'src/app/services/events.service';
|
||||
import { SessionStore } from 'src/app/store/session.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-event-list',
|
||||
@@ -37,6 +38,8 @@ export class EventListPage implements OnInit {
|
||||
|
||||
skeletonLoader = true
|
||||
eventoaprovacaostore = EventoAprovacaoStore;
|
||||
eventsList: any = []
|
||||
color: 'pr' | 'mdgpr'
|
||||
|
||||
constructor(
|
||||
private processes: ProcessesService,
|
||||
@@ -149,52 +152,53 @@ export class EventListPage implements OnInit {
|
||||
}
|
||||
|
||||
async LoadToApproveEvents() {
|
||||
// this.processes.GetTasksList('Agenda Oficial MDGPR', false).subscribe(async res => {
|
||||
this.showLoader = true;
|
||||
this.skeletonLoader = true
|
||||
this.showLoader = true;
|
||||
this.skeletonLoader = true
|
||||
|
||||
const segment = this.segment
|
||||
|
||||
if(this.segment == 'MDGPR') {
|
||||
// color
|
||||
if(SessionStore.user.Profile == 'PR') {
|
||||
this.color = 'pr'
|
||||
} else {
|
||||
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)
|
||||
|
||||
if (this.segment != 'PR') {
|
||||
const segment = this.segment
|
||||
let mdEventsOficial = await this.processes.GetTasksList('Agenda Oficial MDGPR,Agenda Pessoal MDGPR', false).toPromise();
|
||||
this.eventsMDGPRList = mdEventsOficial
|
||||
} else {
|
||||
|
||||
this.eventsMDGPRList = this.sortService.sortDate(this.eventsMDGPRList, 'taskStartDate')
|
||||
this.eventsMDGPRList = this.sortService.sortArrayByDate(this.eventsMDGPRList)
|
||||
this.eventoaprovacaostore.resetmd(this.eventsMDGPRList);
|
||||
|
||||
this.eventoaprovacaostore.save('MDGPR', this.eventsMDGPRList)
|
||||
this.color = 'pr'
|
||||
|
||||
this.storage.set('event-to-aproveMD',this.eventsMDGPRList).then(() => {
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
else if (this.segment == 'PR') {
|
||||
const segment = this.segment
|
||||
let prEventsOficial = await this.processes.GetTasksList('Agenda Oficial PR,Agenda Pessoal PR', false).toPromise();
|
||||
|
||||
this.eventsPRList = prEventsOficial
|
||||
|
||||
this.eventsPRList = this.sortService.sortDate(this.eventsPRList, 'taskStartDate')
|
||||
this.eventsPRList = this.sortService.sortArrayByDate(this.eventsPRList)
|
||||
this.eventoaprovacaostore.resetpr(this.eventsPRList);
|
||||
this.eventoaprovacaostore.save('PR', this.eventsPRList)
|
||||
|
||||
this.storage.set('event-to-aprovePR',this.eventsPRList).then(() => {
|
||||
|
||||
})
|
||||
|
||||
let allEvents = await this.processes.eventsToApprove(segment).toPromise()
|
||||
try {
|
||||
this.eventsList = this.sortService.sortArrayByDate(allEvents).reverse();
|
||||
} catch(error) {
|
||||
this.eventsList = []
|
||||
}
|
||||
|
||||
this.eventsList = this.eventsList
|
||||
this.eventsList = this.eventsList
|
||||
this.showLoader = false;
|
||||
this.skeletonLoader = false
|
||||
this.eventoaprovacaostore.save(segment, this.eventsList)
|
||||
}
|
||||
|
||||
this.showLoader = false;
|
||||
this.skeletonLoader = false
|
||||
|
||||
// }, (error) => {
|
||||
// this.getEventToAproveFromDB();
|
||||
// })
|
||||
}
|
||||
|
||||
|
||||
toDateString(e) {
|
||||
return new Date(e).toDateString()
|
||||
}
|
||||
|
||||
async openApproveModal(eventSerialNumber, event) {
|
||||
const modal = await this.modalController.create({
|
||||
|
||||
Reference in New Issue
Block a user