mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 13:02:56 +00:00
add filter
This commit is contained in:
@@ -17,6 +17,10 @@ import { map } from 'rxjs/operators';
|
||||
import { RoleIdService } from 'src/app/services/role-id.service'
|
||||
import { TableSharedCalendar } from 'src/app/services/Repositorys/Agenda/agenda-local-data-source.service';
|
||||
import { Observable } from 'rxjs';
|
||||
import { EEventFilterStatus } from 'src/app/services/Repositorys/Agenda/model/enums';
|
||||
import { isHttpError } from 'src/app/services/http.service';
|
||||
import { TracingType, XTracerAsync } from 'src/app/services/monitoring/opentelemetry/tracer';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-events-to-approve',
|
||||
@@ -64,7 +68,8 @@ export class EventsToApprovePage implements OnInit {
|
||||
public ThemeService: ThemeService,
|
||||
public AgendaDataRepositoryService: AgendaDataRepositoryService,
|
||||
public RoleIdService: RoleIdService,
|
||||
)
|
||||
private toastService: ToastService,
|
||||
)
|
||||
{}
|
||||
|
||||
ngOnInit() {
|
||||
@@ -190,7 +195,8 @@ export class EventsToApprovePage implements OnInit {
|
||||
this.dynamicSearch()
|
||||
}
|
||||
|
||||
async LoadToApproveEvents() {
|
||||
@XTracerAsync({name:'Events-to-approve/LoadToApproveEvents', log: false, bugPrint: true})
|
||||
async LoadToApproveEvents(tracing?: TracingType) {
|
||||
this.showLoader = true;
|
||||
const segment = this.selectedUserCalendar
|
||||
|
||||
@@ -210,8 +216,13 @@ export class EventsToApprovePage implements OnInit {
|
||||
userId = this.selectedUserCalendar
|
||||
}
|
||||
|
||||
let allEvents = await this.AgendaDataRepositoryService.eventToApproveList({userId})
|
||||
let allEvents = await this.AgendaDataRepositoryService.eventToApproveList({
|
||||
userId,
|
||||
status: EEventFilterStatus.Pending
|
||||
}, tracing)
|
||||
if(allEvents.isOk()) {
|
||||
tracing.setAttribute('outcome', 'success')
|
||||
|
||||
if(allEvents.value.length >= 1) {
|
||||
this.eventsList = this.sortService.sortArrayByDate(allEvents.value).reverse();
|
||||
this.eventoaprovacaostore.save(segment, this.eventsList)
|
||||
@@ -221,6 +232,13 @@ export class EventsToApprovePage implements OnInit {
|
||||
|
||||
this.showLoader = false;
|
||||
} else {
|
||||
|
||||
tracing.setAttribute('outcome', 'failed')
|
||||
tracing.bugFlag()
|
||||
|
||||
if(!isHttpError(allEvents.error)) {
|
||||
this.toastService._badRequest('Pedimos desculpa mas não foi possível executar a acção. Por favor, contacte o apoio técnico. #4')
|
||||
}
|
||||
this.showLoader = false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user