Advertisement
psi_mmobile

Untitled

Jan 18th, 2024
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.96 KB | None | 0 0
  1. refreshCAW() {
  2. this.trackingService.setIsFetching(false);
  3. combineLatest([
  4. this.trackingService.selectedCAWPerson$,
  5. this.trackingService.selectedPOI$,
  6. this.trackingService.warningCheckbox$,
  7. this.trackingService.exceptionsOnlyCheckbox$,
  8. this.trackingService.pplWithMissingDocs$,
  9. this.trackingService.nonAdminStatusCheckbox$,
  10. this.trackingService.cawFromDate$,
  11. this.trackingService.cawToDate$
  12. ])
  13. .pipe(
  14. take(1),
  15. map(
  16. ([
  17. selectedCAWPerson,
  18. selectedPOI,
  19. warningCheckbox,
  20. exceptionsOnlyCheckbox,
  21. pplWithMissingDocs,
  22. nonAdminStatusCheckbox,
  23. cawFromDate,
  24. cawToDate
  25. ]) => {
  26. return {
  27. selectedCAWPerson,
  28. selectedPOI,
  29. warningCheckbox,
  30. exceptionsOnlyCheckbox,
  31. pplWithMissingDocs,
  32. nonAdminStatusCheckbox,
  33. cawFromDate,
  34. cawToDate
  35. };
  36. }
  37. ),
  38. debounceTime(200),
  39. distinctUntilChanged(),
  40. switchMap((res) => {
  41. if (res.selectedCAWPerson || res.selectedPOI) {
  42. this.trackingService.setIsFetching(true);
  43. this.trackingService.fetchCAWRecords(
  44. res.selectedCAWPerson,
  45. res.selectedPOI,
  46. res.warningCheckbox,
  47. res.exceptionsOnlyCheckbox,
  48. res.pplWithMissingDocs,
  49. res.nonAdminStatusCheckbox,
  50. res.cawFromDate,
  51. res.cawToDate
  52. );
  53. } else {
  54. this.notificationService.warningToast(
  55. 'Please choose at least one POI or one person!'
  56. );
  57. }
  58. return this.trackingService.cawStore$;
  59. })
  60. )
  61. .subscribe(() => {
  62. this.trackingService.setIsFetching(false);
  63. });
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement