mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 13:02:56 +00:00
change api source for mobile
This commit is contained in:
@@ -95,39 +95,6 @@ export class ApproveEventPage implements OnInit {
|
||||
|
||||
}
|
||||
|
||||
addProcessToDB(data) {
|
||||
|
||||
}
|
||||
|
||||
getProcessFromDB() {
|
||||
|
||||
|
||||
}
|
||||
|
||||
getTask1 = () => {
|
||||
this.processes.GetTask(this.serialNumber).subscribe(async res => {
|
||||
|
||||
this.loadedEvent = res
|
||||
this.addProcessToDB(this.loadedEvent)
|
||||
|
||||
try {
|
||||
this.today = new Date(this.loadedEvent.workflowInstanceDataFields.StartDate);
|
||||
this.customDate = this.days[this.today.getDay()] + ", " + this.today.getDate() + " de " + (this.months[this.today.getMonth()]);
|
||||
|
||||
} catch(error) {
|
||||
// console.log(this.loadedEvent)
|
||||
throw(error)
|
||||
}
|
||||
|
||||
}, (error) => {
|
||||
if(error.status == 0) {
|
||||
this.getProcessFromDB();
|
||||
} else {
|
||||
this.httpErrorHandle.httpStatusHandle(error)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
async getTask () {
|
||||
|
||||
const res = await this.AgendaDataRepositoryService.getEventToApproveById(this.serialNumber)
|
||||
|
||||
@@ -14,6 +14,7 @@ import { RouteService } from 'src/app/services/route.service';
|
||||
import { EventsService } from 'src/app/services/events.service';
|
||||
import { SessionStore } from 'src/app/store/session.service';
|
||||
import { environment } from 'src/environments/environment';
|
||||
import { AgendaDataRepositoryService } from 'src/app/services/Repositorys/Agenda/agenda-data-repository.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-event-list',
|
||||
@@ -48,7 +49,7 @@ export class EventListPage implements OnInit {
|
||||
}
|
||||
|
||||
SessionStore = SessionStore;
|
||||
|
||||
|
||||
constructor(
|
||||
private processes: ProcessesService,
|
||||
private modalController: ModalController,
|
||||
@@ -59,6 +60,7 @@ export class EventListPage implements OnInit {
|
||||
private RouteService: RouteService,
|
||||
public eventService: EventsService,
|
||||
public TaskService: TaskService,
|
||||
public AgendaDataRepositoryService: AgendaDataRepositoryService
|
||||
) { }
|
||||
|
||||
ngOnInit() {
|
||||
@@ -66,7 +68,7 @@ export class EventListPage implements OnInit {
|
||||
if(window.location.pathname.includes('gabinete-digital')) {
|
||||
this.showFilter = true
|
||||
}
|
||||
|
||||
|
||||
|
||||
this.eventService.onCalendarFinishLoad.subscribe(() => {
|
||||
if(!this.segment) {
|
||||
@@ -75,7 +77,7 @@ export class EventListPage implements OnInit {
|
||||
} else {
|
||||
this.segment = this.eventService.calendarNamesAry[0].OwnerUserId
|
||||
}
|
||||
|
||||
|
||||
// select pr by default
|
||||
const pr = this.eventService.calendarNamesAry.find( e => e.Role == 'Presidente da República')
|
||||
if(pr) {
|
||||
@@ -93,7 +95,7 @@ export class EventListPage implements OnInit {
|
||||
funx:() => {
|
||||
|
||||
this.dynamicSearch()
|
||||
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
@@ -127,14 +129,14 @@ export class EventListPage implements OnInit {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
ngOnDestroy() {
|
||||
this.listSubscription.delete()
|
||||
}
|
||||
|
||||
|
||||
ngAfterViewInit(): void {
|
||||
|
||||
ngAfterViewInit(): void {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -149,7 +151,7 @@ export class EventListPage implements OnInit {
|
||||
async dynamicSearch() {
|
||||
|
||||
if(this.showSearch && this.searchSubject) {
|
||||
|
||||
|
||||
const list = this.eventoaprovacaostore.get(this.segment).filter((task) => {
|
||||
let subject = task.Folio || task.Subject || task.workflowInstanceDataFields.Subject
|
||||
subject = subject.toLowerCase();
|
||||
@@ -174,43 +176,35 @@ export class EventListPage implements OnInit {
|
||||
this.showLoader = true;
|
||||
this.skeletonLoader = true
|
||||
|
||||
const segment = this.segment
|
||||
const segment: any = this.segment
|
||||
let userId;
|
||||
|
||||
if(this.segment == 'Meu calendario') {
|
||||
// color
|
||||
if(SessionStore.user.Profile == 'PR') {
|
||||
this.color = 'pr'
|
||||
} else {
|
||||
this.color = 'mdgpr'
|
||||
}
|
||||
userId = SessionStore.user.UserId
|
||||
|
||||
let eventsList
|
||||
let genericEvents = await this.processes.eventsToApprove(SessionStore.user.UserId,'mobile agenda').toPromise()
|
||||
try {
|
||||
eventsList = this.sortService.sortArrayByDate(genericEvents).reverse();
|
||||
} catch (error) {
|
||||
this.skeletonLoader = false
|
||||
eventsList = [];
|
||||
}
|
||||
|
||||
this.eventoaprovacaostore.save(segment, eventsList as any)
|
||||
this.dynamicSearch()
|
||||
|
||||
} else if(segment) {
|
||||
|
||||
this.color = 'pr'
|
||||
let eventsList = []
|
||||
let allEvents = await this.processes.eventsToApprove(segment,'mobile agenda').toPromise()
|
||||
try {
|
||||
eventsList = this.sortService.sortArrayByDate(allEvents).reverse();
|
||||
} catch(error) {
|
||||
this.skeletonLoader = false
|
||||
eventsList = []
|
||||
userId = segment
|
||||
}
|
||||
|
||||
|
||||
let allEvents = await this.AgendaDataRepositoryService.eventToApproveList({userId})
|
||||
if(allEvents.isOk()) {
|
||||
|
||||
if(allEvents.value.length >= 1) {
|
||||
const eventsList = this.sortService.sortArrayByDate(allEvents.value).reverse();
|
||||
this.eventoaprovacaostore.save(segment, eventsList)
|
||||
} else {
|
||||
this.eventoaprovacaostore.save(segment, [])
|
||||
}
|
||||
|
||||
this.showLoader = false;
|
||||
this.eventoaprovacaostore.save(segment, eventsList)
|
||||
this.dynamicSearch()
|
||||
} else {
|
||||
this.eventoaprovacaostore.save(segment, [])
|
||||
// this.showLoader = false;
|
||||
}
|
||||
|
||||
this.showLoader = false;
|
||||
@@ -235,7 +229,7 @@ export class EventListPage implements OnInit {
|
||||
}
|
||||
|
||||
goToEventToApproveDetail(serialNumber: string) {
|
||||
|
||||
|
||||
|
||||
/* let navigationExtras: NavigationExtras = {
|
||||
queryParams: {
|
||||
|
||||
Reference in New Issue
Block a user