@iapps/ng-dhis2-ui 1.1.15 → 1.1.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3142,10 +3142,8 @@ class LineListService {
3142
3142
  const dateFilter = startDate && endDate ? `&programStartDate=${startDate}&programEndDate=${endDate}` : '';
3143
3143
  const ouModeIdentifier = ouMode ? `&ouMode=${ouMode}` : ``;
3144
3144
  return this.httpClient.get(`trackedEntityInstances.json?program=${programId}&ou=${orgUnit}${ouModeIdentifier}&page=${page}&pageSize=${pageSize}&fields=trackedEntityInstance,attributes[*,displayInList],enrollments[*]&totalPages=true&${filterParams}${dateFilter}`).pipe(map$1((response) => {
3145
- response.trackedEntityInstances.forEach((tei) => {
3146
- // Filter attributes to only include those with displayInList=true
3147
- tei.attributes = tei.attributes.filter((attr) => attr.displayInList);
3148
- });
3145
+ //TODO: use the api to to order by desc
3146
+ response.trackedEntityInstances.reverse();
3149
3147
  return response;
3150
3148
  }));
3151
3149
  }
@@ -3313,6 +3311,7 @@ class LineListTableComponent extends ReactWrapperModule {
3313
3311
  this.actionSelected = new EventEmitter();
3314
3312
  this.reactStateUpdaters = null;
3315
3313
  this.approvalSelected = new EventEmitter();
3314
+ this.isButtonLoading = false;
3316
3315
  this.setReactStateUpdaters = (updaters) => {
3317
3316
  this.reactStateUpdaters = updaters;
3318
3317
  };
@@ -3334,6 +3333,7 @@ class LineListTableComponent extends ReactWrapperModule {
3334
3333
  const [startDateState, setStartDateState] = useState(this.startDate);
3335
3334
  const [endDateState, setEndDateState] = useState(this.endDate);
3336
3335
  const [loading, setLoading] = useState(false);
3336
+ const [isButtonLoading, setIsButtonLoading] = useState(this.isButtonLoading);
3337
3337
  // Store updaters in refs for Angular to access
3338
3338
  const updateRefs = useRef({
3339
3339
  setProgramIdState,
@@ -3342,6 +3342,7 @@ class LineListTableComponent extends ReactWrapperModule {
3342
3342
  setAttributeFiltersState,
3343
3343
  setStartDateState,
3344
3344
  setEndDateState,
3345
+ setIsButtonLoading,
3345
3346
  });
3346
3347
  useEffect(() => {
3347
3348
  this.setReactStateUpdaters?.(updateRefs.current);
@@ -3452,8 +3453,7 @@ class LineListTableComponent extends ReactWrapperModule {
3452
3453
  gap: 8,
3453
3454
  padding: 8,
3454
3455
  marginBottom: 16,
3455
- } },
3456
- React__default.createElement(Button$1, { className: "bg-blue-500 text-white px-4 py-2 rounded hover:bg-blue-600", onClick: handleApprovalClick, primary: true }, "Approval"))),
3456
+ } }, this.isButtonLoading ? (React__default.createElement(CircularLoader$1, { small: true })) : (React__default.createElement(Button$1, { className: "bg-blue-500 text-white px-4 py-2 rounded hover:bg-blue-600", onClick: handleApprovalClick, primary: true }, "Approval")))),
3457
3457
  loading ? (React__default.createElement("div", { style: {
3458
3458
  display: 'flex',
3459
3459
  alignItems: 'center',
@@ -3501,6 +3501,9 @@ class LineListTableComponent extends ReactWrapperModule {
3501
3501
  if (changes['endDate']) {
3502
3502
  this.reactStateUpdaters.setEndDateState(this.endDate);
3503
3503
  }
3504
+ if (changes['isButtonLoading']) {
3505
+ this.reactStateUpdaters.setIsButtonLoading(this.isButtonLoading);
3506
+ }
3504
3507
  }
3505
3508
  }
3506
3509
  async ngAfterViewInit() {
@@ -3511,7 +3514,7 @@ class LineListTableComponent extends ReactWrapperModule {
3511
3514
  this.render();
3512
3515
  }
3513
3516
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: LineListTableComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
3514
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.8", type: LineListTableComponent, isStandalone: false, selector: "app-line-list", inputs: { programId: "programId", orgUnit: "orgUnit", programStageId: "programStageId", actionOptions: "actionOptions", attributeFilters: "attributeFilters", startDate: "startDate", endDate: "endDate", filters: "filters", ouMode: "ouMode", showApprovalButton: "showApprovalButton" }, outputs: { actionSelected: "actionSelected", approvalSelected: "approvalSelected" }, usesInheritance: true, usesOnChanges: true, ngImport: i0, template: '<ng-content></ng-content>', isInline: true, styles: ["[data-test=dhis2-uiwidgets-pagination]{display:flex!important;flex-direction:row!important;justify-content:space-between!important;align-items:center!important}\n"] }); }
3517
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.8", type: LineListTableComponent, isStandalone: false, selector: "app-line-list", inputs: { programId: "programId", orgUnit: "orgUnit", programStageId: "programStageId", actionOptions: "actionOptions", attributeFilters: "attributeFilters", startDate: "startDate", endDate: "endDate", filters: "filters", ouMode: "ouMode", showApprovalButton: "showApprovalButton", isButtonLoading: "isButtonLoading" }, outputs: { actionSelected: "actionSelected", approvalSelected: "approvalSelected" }, usesInheritance: true, usesOnChanges: true, ngImport: i0, template: '<ng-content></ng-content>', isInline: true, styles: ["[data-test=dhis2-uiwidgets-pagination]{display:flex!important;flex-direction:row!important;justify-content:space-between!important;align-items:center!important}\n"] }); }
3515
3518
  }
3516
3519
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: LineListTableComponent, decorators: [{
3517
3520
  type: Component,
@@ -3540,6 +3543,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.8", ngImpor
3540
3543
  type: Output
3541
3544
  }], approvalSelected: [{
3542
3545
  type: Output
3546
+ }], isButtonLoading: [{
3547
+ type: Input
3543
3548
  }] } });
3544
3549
 
3545
3550
  class LineListModule {
@@ -5790,26 +5795,32 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.8", ngImpor
5790
5795
  class TrackerFormComponent {
5791
5796
  constructor() {
5792
5797
  this.program = input.required();
5798
+ this.trackedEntity = input();
5793
5799
  this.d2 = window.d2Web;
5794
5800
  }
5795
5801
  async ngOnInit() {
5796
5802
  this.trackerQuery = this.d2.trackerModule.trackedEntity.setProgram(this.program());
5797
5803
  const program = await this.trackerQuery.getMetaData();
5798
- const instance = await this.trackerQuery.create();
5804
+ this.instance = this.trackedEntity()
5805
+ ? (await this.trackerQuery
5806
+ .setTrackedEntity(this.trackedEntity())
5807
+ .get()).data || (await this.trackerQuery.create())
5808
+ : await this.trackerQuery.create();
5799
5809
  if (program) {
5800
5810
  this.formMetaData = new FormMetaData({
5801
5811
  programs: [program],
5802
5812
  }).toJson();
5813
+ console.log(this.formMetaData, this.instance.enrollmentDate);
5803
5814
  }
5804
5815
  }
5805
5816
  onSave(event) { }
5806
5817
  onCancel() { }
5807
5818
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: TrackerFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
5808
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.8", type: TrackerFormComponent, isStandalone: false, selector: "ng-dhis2-ui-tracker-form", inputs: { program: { classPropertyName: "program", publicName: "program", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: "@if(formMetaData) {\n<ng-dhis2-ui-section-form\n [formMetaData]=\"formMetaData\"\n [dataValueEntities]=\"{}\"\n (save)=\"onSave($event)\"\n (cancel)=\"onCancel()\"\n/>\n}\n", dependencies: [{ kind: "component", type: SectionFormComponent, selector: "ng-dhis2-ui-section-form", inputs: ["loading", "formMetaData", "dataValueEntities"], outputs: ["save", "formUpdate", "cancel"] }] }); }
5819
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.8", type: TrackerFormComponent, isStandalone: false, selector: "ng-dhis2-ui-tracker-form", inputs: { program: { classPropertyName: "program", publicName: "program", isSignal: true, isRequired: true, transformFunction: null }, trackedEntity: { classPropertyName: "trackedEntity", publicName: "trackedEntity", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "@if(formMetaData) {\n<ng-dhis2-ui-section-form\n [formMetaData]=\"formMetaData\"\n [dataValueEntities]=\"instance\"\n (save)=\"onSave($event)\"\n (cancel)=\"onCancel()\"\n/>\n}\n", dependencies: [{ kind: "component", type: SectionFormComponent, selector: "ng-dhis2-ui-section-form", inputs: ["loading", "formMetaData", "dataValueEntities"], outputs: ["save", "formUpdate", "cancel"] }] }); }
5809
5820
  }
5810
5821
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: TrackerFormComponent, decorators: [{
5811
5822
  type: Component,
5812
- args: [{ selector: 'ng-dhis2-ui-tracker-form', standalone: false, template: "@if(formMetaData) {\n<ng-dhis2-ui-section-form\n [formMetaData]=\"formMetaData\"\n [dataValueEntities]=\"{}\"\n (save)=\"onSave($event)\"\n (cancel)=\"onCancel()\"\n/>\n}\n" }]
5823
+ args: [{ selector: 'ng-dhis2-ui-tracker-form', standalone: false, template: "@if(formMetaData) {\n<ng-dhis2-ui-section-form\n [formMetaData]=\"formMetaData\"\n [dataValueEntities]=\"instance\"\n (save)=\"onSave($event)\"\n (cancel)=\"onCancel()\"\n/>\n}\n" }]
5813
5824
  }] });
5814
5825
 
5815
5826
  class TrackerFormModule {