add filter

This commit is contained in:
Peter Maquiran
2024-06-17 10:33:35 +01:00
parent 54cdf512c0
commit 768dc10308
10 changed files with 135 additions and 55 deletions
@@ -19,6 +19,12 @@ import { map } from 'rxjs/operators';
import { Observable } from 'rxjs';
import { TableSharedCalendar } from 'src/app/services/Repositorys/Agenda/agenda-local-data-source.service';
import { RoleIdService } from 'src/app/services/role-id.service'
import { EEventFilterStatus } from 'src/app/services/Repositorys/Agenda/model/enums';
import { isHttpError } from 'src/app/services/http.service';
import { ToastService } from 'src/app/services/toast.service';
import { TracingType, XTracerAsync } from 'src/app/services/monitoring/opentelemetry/tracer';
@Component({
selector: 'app-event-list',
templateUrl: './event-list.page.html',
@@ -67,6 +73,7 @@ export class EventListPage implements OnInit {
public TaskService: TaskService,
public AgendaDataRepositoryService: AgendaDataRepositoryService,
public RoleIdService: RoleIdService,
private toastService: ToastService,
) { }
ngOnInit() {
@@ -210,7 +217,8 @@ export class EventListPage implements OnInit {
this.LoadToApproveEvents();
}
async LoadToApproveEvents() {
@XTracerAsync({name:'EventListPage/LoadToApproveEvents', log: false, bugPrint: true})
async LoadToApproveEvents(tracing?: TracingType) {
console.log('aprove event')
this.showLoader = true;
this.skeletonLoader = true
@@ -232,8 +240,13 @@ export class EventListPage implements OnInit {
}
let allEvents = await this.AgendaDataRepositoryService.eventToApproveList({userId})
let allEvents = await this.AgendaDataRepositoryService.eventToApproveList({
userId,
status: EEventFilterStatus.Pending
})
if(allEvents.isOk()) {
tracing.setAttribute('outcome', 'success')
if(allEvents.value.length >= 1) {
const eventsList = this.sortService.sortArrayByDate(allEvents.value).reverse();
@@ -242,6 +255,12 @@ export class EventListPage implements OnInit {
this.eventoaprovacaostore.save(segment, [])
}
} 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.eventoaprovacaostore.save(segment, [])
// this.showLoader = false;
}