mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
change api source for mobile
This commit is contained in:
@@ -15,7 +15,7 @@ import { Router } from '@angular/router';
|
||||
import { SessionStore } from '../store/session.service';
|
||||
import { environment } from "src/environments/environment";
|
||||
import { PermissionService } from '../services/permission.service';
|
||||
import { NetworkServiceService, ConnectionStatus } from 'src/app/services/network-service.service';
|
||||
import { NetworkServiceService } from 'src/app/services/network-service.service';
|
||||
import { RochetChatConnectorService } from 'src/app/services/chat/rochet-chat-connector.service';
|
||||
|
||||
@Injectable()
|
||||
|
||||
@@ -642,13 +642,12 @@ export class AgendaPage implements OnInit {
|
||||
|
||||
if (SessionStore.user.Profile == 'PR') {
|
||||
label = "pr"
|
||||
} else if (SessionStore.user.OwnerCalendars.find(e => e.CalendarId == selectedCalendar.CalendarId)) {
|
||||
} else if (selectedCalendar.OwnerUserId == SessionStore.user.UserId as any) {
|
||||
label = 'md'
|
||||
} else {
|
||||
label = "pr"
|
||||
}
|
||||
|
||||
|
||||
this.CalendarStore.removeRangeForCalendar(startTime, endTime, null , selectedCalendar.OwnerUserId as any)
|
||||
|
||||
let eventsList = response.value;
|
||||
|
||||
@@ -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: {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { HttpClient, HttpHeaderResponse, HttpHeaders } from '@angular/common/http';
|
||||
import { HttpClient, HttpErrorResponse, HttpHeaderResponse, HttpHeaders } from '@angular/common/http';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { ok, err } from 'neverthrow';
|
||||
import { environment } from 'src/environments/environment';
|
||||
|
||||
@Injectable({
|
||||
@@ -9,16 +10,19 @@ export class HttpService {
|
||||
|
||||
constructor(private http:HttpClient) { }
|
||||
|
||||
post(serviceName:string, data:any){
|
||||
const headers = new HttpHeaders();;
|
||||
const options = {header: headers, withCredentials: false};
|
||||
async post(serviceName:string, data:any) {
|
||||
const headers = new HttpHeaders();
|
||||
const url = environment.apiChatUrl+serviceName;
|
||||
const body = {"user": "admin","password": "tabteste@006"};
|
||||
|
||||
return this.http.post(url, /* JSON.stringify( */data/* ), options */)
|
||||
try {
|
||||
const result = await this.http.post(url, {}).toPromise()
|
||||
return ok (result)
|
||||
} catch (e) {
|
||||
return err(e as HttpErrorResponse)
|
||||
}
|
||||
}
|
||||
|
||||
get(serviceName:string, options:any){
|
||||
async get(serviceName:string, options:any) {
|
||||
const url = environment.apiChatUrl+serviceName;
|
||||
return this.http.get(url, options);
|
||||
}
|
||||
|
||||
@@ -83,21 +83,21 @@ export class ProcessesService {
|
||||
return this.http.get<fullTaskList[]>(`${geturl}`, options);
|
||||
}
|
||||
|
||||
eventsToApprove(userid, caller) {
|
||||
const geturl = environment.apiURL + 'tasks/events-to-approve';
|
||||
let params = new HttpParams();
|
||||
// eventsToApprove(userid, caller) {
|
||||
// const geturl = environment.apiURL + 'tasks/events-to-approve';
|
||||
// let params = new HttpParams();
|
||||
|
||||
params = params.set("pageNum", 1);
|
||||
params = params.set("pageSize", 500);
|
||||
params = params.set("userid", userid);
|
||||
// params = params.set("pageNum", 1);
|
||||
// params = params.set("pageSize", 500);
|
||||
// params = params.set("userid", userid);
|
||||
|
||||
let options = {
|
||||
headers: this.headers,
|
||||
params: params
|
||||
};
|
||||
// let options = {
|
||||
// headers: this.headers,
|
||||
// params: params
|
||||
// };
|
||||
|
||||
return this.http.get<fullTaskList[]>(`${geturl}`, options);
|
||||
}
|
||||
// return this.http.get<fullTaskList[]>(`${geturl}`, options);
|
||||
// }
|
||||
|
||||
GetTaskListExpediente(onlycount1): Observable<ExpedienteFullTask[]> {
|
||||
const processname = "Expediente"
|
||||
|
||||
Reference in New Issue
Block a user