@iapps/ng-dhis2-ui 1.2.112 → 1.2.114
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.
- package/fesm2022/iapps-ng-dhis2-ui.mjs +67 -236
- package/fesm2022/iapps-ng-dhis2-ui.mjs.map +1 -1
- package/index.d.ts +6 -4
- package/package.json +1 -1
|
@@ -6499,66 +6499,13 @@ const buildReadableFullName = (unit) => {
|
|
|
6499
6499
|
return pathParts.join(' / ');
|
|
6500
6500
|
};
|
|
6501
6501
|
const OrgUnitFormField = (props) => {
|
|
6502
|
-
// const { onSelectOrgUnit, label, required, selected, disabled, key, customOrgUnitRoots } = props;
|
|
6503
|
-
// const d2 = (window as unknown as D2Window)?.d2Web;
|
|
6504
|
-
// const classes = useDynamicStyles(orgUnitFieldStyles);
|
|
6505
|
-
// const config = useMemo(() => {
|
|
6506
|
-
// return d2.systemInfo?.toInitObject();
|
|
6507
|
-
// }, []);
|
|
6508
|
-
// TODO: Improvements
|
|
6509
6502
|
const { onSelectOrgUnit, label, required, selected, disabled, key, field, customOrgUnitRoots, } = props;
|
|
6510
6503
|
const d2 = window?.d2Web;
|
|
6511
6504
|
const classes = useDynamicStyles$2(orgUnitFieldStyles);
|
|
6512
6505
|
const config = useMemo(() => d2.systemInfo?.toInitObject(), []);
|
|
6513
|
-
// TODO: Improvements
|
|
6514
|
-
// New state to hold full orgUnit info from customOrgUnitRoots
|
|
6515
|
-
// const [configuredRootInfo, setConfiguredRootInfo] = useState<
|
|
6516
|
-
// { id: string; name: string; code?: string; path: string; level: number }[]
|
|
6517
|
-
// >([]);
|
|
6518
6506
|
const [configuredRootInfo, setConfiguredRootInfo] = useState([]);
|
|
6519
6507
|
const [configuredRootsLoading, setConfiguredRootsLoading] = useState(false);
|
|
6520
|
-
// Strike-through (fallback) current user roots
|
|
6521
6508
|
const [useCustomRoots, setUseCustomRoots] = useState(customOrgUnitRoots && customOrgUnitRoots.length ? true : false);
|
|
6522
|
-
// TODO: START | Deprecated Approach that doesn't support passing ID of Organisation Unit as root
|
|
6523
|
-
// const rootOrgUnits = useMemo(() => {
|
|
6524
|
-
// return d2.currentUser?.organisationUnits || [];
|
|
6525
|
-
// }, []);
|
|
6526
|
-
// TODO: END | Deprecated Approach that doesn't support passing ID of Organisation Unit as root
|
|
6527
|
-
// TODO: Improvements
|
|
6528
|
-
// Fetch matching configured roots on mount or when key changes:
|
|
6529
|
-
// useEffect(() => {
|
|
6530
|
-
// const matchList =
|
|
6531
|
-
// customOrgUnitRoots?.filter((entry) => entry.field === (field || key)) ||
|
|
6532
|
-
// [];
|
|
6533
|
-
// if (matchList?.length > 0) {
|
|
6534
|
-
// setUseCustomRoots(true);
|
|
6535
|
-
// Promise.all(
|
|
6536
|
-
// (matchList || []).map((entry) =>
|
|
6537
|
-
// d2.httpInstance
|
|
6538
|
-
// .get(
|
|
6539
|
-
// `organisationUnits/${entry.orgUnit}.json?fields=id,displayName,name,code,path,level`
|
|
6540
|
-
// )
|
|
6541
|
-
// .then((res) => {
|
|
6542
|
-
// const u = res.data as OrgUnitResponse;
|
|
6543
|
-
// return {
|
|
6544
|
-
// id: u.id,
|
|
6545
|
-
// name: u.displayName || u.name,
|
|
6546
|
-
// code: u.code,
|
|
6547
|
-
// path: u.path,
|
|
6548
|
-
// level: u.level,
|
|
6549
|
-
// };
|
|
6550
|
-
// })
|
|
6551
|
-
// )
|
|
6552
|
-
// )
|
|
6553
|
-
// .then(setConfiguredRootInfo)
|
|
6554
|
-
// .catch((err) =>
|
|
6555
|
-
// console.warn(
|
|
6556
|
-
// `[OrgUnitFormField] Failed to fetch customOrgUnitRoots:`,
|
|
6557
|
-
// err
|
|
6558
|
-
// )
|
|
6559
|
-
// );
|
|
6560
|
-
// }
|
|
6561
|
-
// }, [customOrgUnitRoots, key, field, d2.httpInstance]);
|
|
6562
6509
|
useEffect(() => {
|
|
6563
6510
|
const matchList = customOrgUnitRoots?.filter((entry) => entry.field === (field || key)) ||
|
|
6564
6511
|
[];
|
|
@@ -6567,7 +6514,7 @@ const OrgUnitFormField = (props) => {
|
|
|
6567
6514
|
setConfiguredRootsLoading(true);
|
|
6568
6515
|
Promise.allSettled(matchList.map(async (orgUnitConfig) => {
|
|
6569
6516
|
try {
|
|
6570
|
-
const orgUnitResponse = await d2.httpInstance.get(`organisationUnits/${orgUnitConfig.orgUnit}.json?fields=id,displayName,name,code,path,level,ancestors[displayName],children[id,displayName,name,code,path,level,ancestors[displayName],children[id,displayName,name,code,path,level,ancestors[displayName]]]&paging=false`);
|
|
6517
|
+
const orgUnitResponse = await d2.httpInstance.get(`organisationUnits/${orgUnitConfig.orgUnit}.json?fields=id,displayName,name,code,path,level,ancestors[displayName],children[id,displayName,name,code,path,level,ancestors[displayName],children[id,displayName,name,code,path,level,ancestors[displayName],children[id,displayName,name,code,path,level,ancestors[displayName]]]]&paging=false`);
|
|
6571
6518
|
const rootOrgUnitData = orgUnitResponse.data;
|
|
6572
6519
|
const allDescendantOrgUnits = flattenChildren([rootOrgUnitData]);
|
|
6573
6520
|
const matchingConfig = customOrgUnitRoots?.find((config) => config.orgUnit === orgUnitConfig.orgUnit);
|
|
@@ -6599,6 +6546,7 @@ const OrgUnitFormField = (props) => {
|
|
|
6599
6546
|
const allFacilities = settledResults
|
|
6600
6547
|
.filter((result) => result.status === 'fulfilled')
|
|
6601
6548
|
.flatMap((result) => result.value);
|
|
6549
|
+
console.log("ALL FACILITIES::: ", allFacilities);
|
|
6602
6550
|
setConfiguredRootInfo(allFacilities);
|
|
6603
6551
|
setConfiguredRootsLoading(false);
|
|
6604
6552
|
})
|
|
@@ -6608,28 +6556,6 @@ const OrgUnitFormField = (props) => {
|
|
|
6608
6556
|
});
|
|
6609
6557
|
}
|
|
6610
6558
|
}, [customOrgUnitRoots, key, field, d2.httpInstance]);
|
|
6611
|
-
// const rootOrgUnits = useMemo(() => {
|
|
6612
|
-
// if (customOrgUnitRoots && customOrgUnitRoots.length > 0) {
|
|
6613
|
-
// return customOrgUnitRoots.map((id) => ({ id }));
|
|
6614
|
-
// }
|
|
6615
|
-
// return d2.currentUser?.organisationUnits || [];
|
|
6616
|
-
// }, [customOrgUnitRoots]);
|
|
6617
|
-
// const getExpandedItems = () => {
|
|
6618
|
-
// if (rootOrgUnits && rootOrgUnits.length === 1) {
|
|
6619
|
-
// return [`/${rootOrgUnits[0].id}`];
|
|
6620
|
-
// } else if (rootOrgUnits?.length > 1) {
|
|
6621
|
-
// return rootOrgUnits.map((root) => root.path);
|
|
6622
|
-
// }
|
|
6623
|
-
// return undefined;
|
|
6624
|
-
// };
|
|
6625
|
-
// TODO: Improvements
|
|
6626
|
-
// Decide which roots to render
|
|
6627
|
-
// const rootOrgUnits = useMemo(() => {
|
|
6628
|
-
// if (useCustomRoots && configuredRootInfo.length > 0) {
|
|
6629
|
-
// return configuredRootInfo.map((u) => u);
|
|
6630
|
-
// }
|
|
6631
|
-
// return d2.currentUser?.organisationUnits || [];
|
|
6632
|
-
// }, [useCustomRoots, configuredRootInfo, d2.currentUser]);
|
|
6633
6559
|
const rootOrgUnits = useMemo(() => {
|
|
6634
6560
|
if (useCustomRoots) {
|
|
6635
6561
|
if (configuredRootsLoading) {
|
|
@@ -6749,9 +6675,6 @@ const OrgUnitFormField = (props) => {
|
|
|
6749
6675
|
onSelectOrgUnit(event.id);
|
|
6750
6676
|
} })));
|
|
6751
6677
|
};
|
|
6752
|
-
const handleBlur = () => {
|
|
6753
|
-
// onBlur && onBlur(null);
|
|
6754
|
-
};
|
|
6755
6678
|
return (config && (React__default.createElement(Provider, { config: config, plugin: false, parentAlertsAdd: undefined, showAlertsInPlugin: false },
|
|
6756
6679
|
React__default.createElement("div", null,
|
|
6757
6680
|
label && (React__default.createElement("div", { className: classes.orgUnitFieldLabel },
|
|
@@ -7713,6 +7636,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImpor
|
|
|
7713
7636
|
// Use of this source code is governed by a BSD-style
|
|
7714
7637
|
// license that can be found in the LICENSE file.
|
|
7715
7638
|
|
|
7639
|
+
/* eslint-disable @angular-eslint/component-selector */
|
|
7716
7640
|
class SelectionFiltersComponent extends ReactWrapperModule {
|
|
7717
7641
|
constructor() {
|
|
7718
7642
|
super(...arguments);
|
|
@@ -7727,20 +7651,9 @@ class SelectionFiltersComponent extends ReactWrapperModule {
|
|
|
7727
7651
|
const [selected, setSelected] = useState([]);
|
|
7728
7652
|
const [rootOrgUnits, setRootOrgUnits] = useState();
|
|
7729
7653
|
const [config, setConfig] = useState();
|
|
7730
|
-
// TODO: START::: Improve approach on handling observables
|
|
7731
|
-
// useEffect(() => {
|
|
7732
|
-
// zip(this.getAppConfig(), this.getRootOrgUnits()).subscribe({
|
|
7733
|
-
// next: ([appConfig, rootOrgUnits]) => {
|
|
7734
|
-
// setConfig(appConfig);
|
|
7735
|
-
// setRootOrgUnits(rootOrgUnits);
|
|
7736
|
-
// },
|
|
7737
|
-
// error: (error) => console.error(error),
|
|
7738
|
-
// });
|
|
7739
|
-
// }, []);
|
|
7740
|
-
// TODO: END::: Improve approach on handling observables
|
|
7741
7654
|
useEffect(() => {
|
|
7742
7655
|
const subscription = zip(this.getAppConfig(), this.getRootOrgUnits())
|
|
7743
|
-
.pipe(take(1))
|
|
7656
|
+
.pipe(take(1))
|
|
7744
7657
|
.subscribe({
|
|
7745
7658
|
next: ([appConfig, rootOrgUnits]) => {
|
|
7746
7659
|
setConfig(appConfig);
|
|
@@ -7748,9 +7661,7 @@ class SelectionFiltersComponent extends ReactWrapperModule {
|
|
|
7748
7661
|
},
|
|
7749
7662
|
error: (error) => console.error(error),
|
|
7750
7663
|
});
|
|
7751
|
-
return () =>
|
|
7752
|
-
subscription.unsubscribe(); // Cleanup to avoid memory leaks
|
|
7753
|
-
};
|
|
7664
|
+
return () => subscription.unsubscribe();
|
|
7754
7665
|
}, []);
|
|
7755
7666
|
return config
|
|
7756
7667
|
? React__default.createElement(Provider, {
|
|
@@ -7758,7 +7669,7 @@ class SelectionFiltersComponent extends ReactWrapperModule {
|
|
|
7758
7669
|
plugin: false,
|
|
7759
7670
|
parentAlertsAdd: undefined,
|
|
7760
7671
|
showAlertsInPlugin: false,
|
|
7761
|
-
children: React__default.createElement(Modal$1, { position: 'middle', large: true }, React__default.createElement(ModalTitle$1, null, 'Organisation
|
|
7672
|
+
children: React__default.createElement(Modal$1, { position: 'middle', large: true }, React__default.createElement(ModalTitle$1, null, this.orgUnitFieldTitle ? this.orgUnitFieldTitle : 'Organisation Unit'), React__default.createElement(ModalContent$1, null, React__default.createElement(OrgUnitDimension, {
|
|
7762
7673
|
selected: selected,
|
|
7763
7674
|
hideGroupSelect: this.orgUnitSelectionConfig.hideGroupSelect,
|
|
7764
7675
|
hideLevelSelect: this.orgUnitSelectionConfig.hideLevelSelect,
|
|
@@ -7769,16 +7680,10 @@ class SelectionFiltersComponent extends ReactWrapperModule {
|
|
|
7769
7680
|
orgUnitGroupPromise: this.getOrgUnitGroups(),
|
|
7770
7681
|
orgUnitLevelPromise: this.getOrgUnitLevels(),
|
|
7771
7682
|
roots: rootOrgUnits,
|
|
7772
|
-
})), React__default.createElement(ModalActions$1, null, React__default.createElement(ButtonStrip$1, { end: true }, React__default.createElement(Button$1, {
|
|
7773
|
-
onClick: () => {
|
|
7774
|
-
onCancelOrgUnit();
|
|
7775
|
-
},
|
|
7776
|
-
}, 'Cancel'), React__default.createElement(Button$1, {
|
|
7683
|
+
})), React__default.createElement(ModalActions$1, null, React__default.createElement(ButtonStrip$1, { end: true }, React__default.createElement(Button$1, { onClick: onCancelOrgUnit }, 'Cancel'), React__default.createElement(Button$1, {
|
|
7777
7684
|
primary: true,
|
|
7778
7685
|
disabled: selected.length === 0,
|
|
7779
|
-
onClick: () =>
|
|
7780
|
-
onSelectOrgUnit(selected);
|
|
7781
|
-
},
|
|
7686
|
+
onClick: () => onSelectOrgUnit(selected),
|
|
7782
7687
|
}, 'Confirm')))),
|
|
7783
7688
|
})
|
|
7784
7689
|
: React__default.createElement(CircularLoader$1, { small: true });
|
|
@@ -7791,8 +7696,9 @@ class SelectionFiltersComponent extends ReactWrapperModule {
|
|
|
7791
7696
|
allowSingleSelection: true,
|
|
7792
7697
|
usageType: 'DATA_ENTRY',
|
|
7793
7698
|
};
|
|
7794
|
-
|
|
7795
|
-
this.
|
|
7699
|
+
// Renamed to avoid shadowing the @Input
|
|
7700
|
+
this.selectedOrgUnitSignal = signal(null, ...(ngDevMode ? [{ debugName: "selectedOrgUnitSignal" }] : []));
|
|
7701
|
+
this.selectedOrgUnit$ = toObservable(this.selectedOrgUnitSignal);
|
|
7796
7702
|
this.SelectionFiltersUI = () => {
|
|
7797
7703
|
const [filters, setFilters] = useState({
|
|
7798
7704
|
programAttributesFilters: this.programAttributesFilters || [],
|
|
@@ -7810,6 +7716,28 @@ class SelectionFiltersComponent extends ReactWrapperModule {
|
|
|
7810
7716
|
const [value, setValue] = useState(null);
|
|
7811
7717
|
const [showMoreFilters, setShowMoreFilters] = useState(false);
|
|
7812
7718
|
const toggleMoreFilters = () => setShowMoreFilters((prev) => !prev);
|
|
7719
|
+
useEffect(() => {
|
|
7720
|
+
const su = this.selectedOrgUnit;
|
|
7721
|
+
if (su) {
|
|
7722
|
+
if (typeof su === 'object') {
|
|
7723
|
+
const id = su.id ?? su.uid ?? su.code ?? su.value ?? undefined;
|
|
7724
|
+
if (su.name) {
|
|
7725
|
+
setDisplayValue(su.name);
|
|
7726
|
+
}
|
|
7727
|
+
if (id) {
|
|
7728
|
+
setSelectedOrganisationUnit(id);
|
|
7729
|
+
setFilters((prev) => ({ ...prev, organisationUnit: id }));
|
|
7730
|
+
setValue(id);
|
|
7731
|
+
}
|
|
7732
|
+
}
|
|
7733
|
+
else if (typeof su === 'string') {
|
|
7734
|
+
setSelectedOrganisationUnit(su);
|
|
7735
|
+
setFilters((prev) => ({ ...prev, organisationUnit: su }));
|
|
7736
|
+
setDisplayValue(su);
|
|
7737
|
+
setValue(su);
|
|
7738
|
+
}
|
|
7739
|
+
}
|
|
7740
|
+
}, [this.selectedOrgUnit]);
|
|
7813
7741
|
useEffect(() => {
|
|
7814
7742
|
setFilters({
|
|
7815
7743
|
programAttributesFilters: this.programAttributesFilters,
|
|
@@ -7824,6 +7752,8 @@ class SelectionFiltersComponent extends ReactWrapperModule {
|
|
|
7824
7752
|
this.programStageDataElementFilters,
|
|
7825
7753
|
this.startDate,
|
|
7826
7754
|
this.endDate,
|
|
7755
|
+
this.program,
|
|
7756
|
+
this.organisationUnit,
|
|
7827
7757
|
]);
|
|
7828
7758
|
const handleAttributeChange = (index, selectedValue) => {
|
|
7829
7759
|
setFilters((prevFilters) => {
|
|
@@ -7862,62 +7792,36 @@ class SelectionFiltersComponent extends ReactWrapperModule {
|
|
|
7862
7792
|
const getAttributeColumnSpan = (index) => {
|
|
7863
7793
|
const totalItems = filters.programAttributesFilters.length;
|
|
7864
7794
|
if (totalItems <= 4) {
|
|
7865
|
-
if (totalItems === 1)
|
|
7795
|
+
if (totalItems === 1)
|
|
7866
7796
|
return 'span 4';
|
|
7867
|
-
|
|
7868
|
-
if (totalItems === 2) {
|
|
7797
|
+
if (totalItems === 2)
|
|
7869
7798
|
return 'span 2';
|
|
7870
|
-
|
|
7871
|
-
if (totalItems === 3) {
|
|
7872
|
-
return 'span 1';
|
|
7873
|
-
}
|
|
7874
|
-
if (totalItems === 4) {
|
|
7875
|
-
return 'span 1';
|
|
7876
|
-
}
|
|
7799
|
+
return 'span 1';
|
|
7877
7800
|
}
|
|
7878
7801
|
else {
|
|
7879
|
-
|
|
7880
|
-
if (index % 2 === 0) {
|
|
7802
|
+
if (index % 2 === 0)
|
|
7881
7803
|
return 'span 2';
|
|
7882
|
-
|
|
7883
|
-
else if (index === totalItems - 1) {
|
|
7804
|
+
if (index === totalItems - 1)
|
|
7884
7805
|
return 'span 4';
|
|
7885
|
-
|
|
7886
|
-
else {
|
|
7887
|
-
return 'span 2';
|
|
7888
|
-
}
|
|
7806
|
+
return 'span 2';
|
|
7889
7807
|
}
|
|
7890
|
-
return 'span 1';
|
|
7891
7808
|
};
|
|
7892
7809
|
const getDataElementColumnSpan = (index) => {
|
|
7893
7810
|
const totalItems = filters.programStageDataElementFilters.length;
|
|
7894
7811
|
if (totalItems <= 4) {
|
|
7895
|
-
if (totalItems === 1)
|
|
7812
|
+
if (totalItems === 1)
|
|
7896
7813
|
return 'span 4';
|
|
7897
|
-
|
|
7898
|
-
if (totalItems === 2) {
|
|
7814
|
+
if (totalItems === 2)
|
|
7899
7815
|
return 'span 2';
|
|
7900
|
-
|
|
7901
|
-
if (totalItems === 3) {
|
|
7902
|
-
return 'span 1';
|
|
7903
|
-
}
|
|
7904
|
-
if (totalItems === 4) {
|
|
7905
|
-
return 'span 1';
|
|
7906
|
-
}
|
|
7816
|
+
return 'span 1';
|
|
7907
7817
|
}
|
|
7908
7818
|
else {
|
|
7909
|
-
|
|
7910
|
-
if (index % 2 === 0) {
|
|
7819
|
+
if (index % 2 === 0)
|
|
7911
7820
|
return 'span 2';
|
|
7912
|
-
|
|
7913
|
-
else if (index === totalItems - 1) {
|
|
7821
|
+
if (index === totalItems - 1)
|
|
7914
7822
|
return 'span 4';
|
|
7915
|
-
|
|
7916
|
-
else {
|
|
7917
|
-
return 'span 2';
|
|
7918
|
-
}
|
|
7823
|
+
return 'span 2';
|
|
7919
7824
|
}
|
|
7920
|
-
return 'span 1';
|
|
7921
7825
|
};
|
|
7922
7826
|
return React__default.createElement('div', {
|
|
7923
7827
|
style: {
|
|
@@ -7930,40 +7834,32 @@ class SelectionFiltersComponent extends ReactWrapperModule {
|
|
|
7930
7834
|
}, React__default.createElement('div', {
|
|
7931
7835
|
style: {
|
|
7932
7836
|
display: 'grid',
|
|
7933
|
-
gridTemplateColumns: '1fr 1fr 1fr auto',
|
|
7837
|
+
gridTemplateColumns: '1fr 1fr 1fr auto',
|
|
7934
7838
|
gap: '16px',
|
|
7935
|
-
|
|
7839
|
+
// 👇 Bottom-align everything in the row so labels don't push inputs higher than the button
|
|
7840
|
+
alignItems: 'end',
|
|
7936
7841
|
marginBottom: '16px',
|
|
7937
7842
|
},
|
|
7938
7843
|
},
|
|
7939
|
-
|
|
7844
|
+
// Organization Unit
|
|
7940
7845
|
React__default.createElement('div', { style: { width: '100%' } }, React__default.createElement(InputField$1, {
|
|
7941
7846
|
value: displayValue,
|
|
7942
|
-
label: '
|
|
7847
|
+
label: this.orgUnitFieldTitle ? this.orgUnitFieldTitle : 'Organisation Unit',
|
|
7943
7848
|
readOnly: false,
|
|
7944
7849
|
onFocus: () => setShowOrgUnit(true),
|
|
7945
|
-
onBlur: () => {
|
|
7946
|
-
setTouched(true);
|
|
7947
|
-
},
|
|
7948
7850
|
}), showOrgUnit &&
|
|
7949
7851
|
React__default.createElement(this.FieldOrgUnitSelector, {
|
|
7950
|
-
onCancelOrgUnit: () =>
|
|
7951
|
-
setShowOrgUnit(false);
|
|
7952
|
-
setTouched(true);
|
|
7953
|
-
},
|
|
7852
|
+
onCancelOrgUnit: () => setShowOrgUnit(false),
|
|
7954
7853
|
onSelectOrgUnit: (selectedOrgUnits) => {
|
|
7955
7854
|
if ((selectedOrgUnits || [])[0]) {
|
|
7956
7855
|
const selectedOrgUnit = selectedOrgUnits[0];
|
|
7957
7856
|
setDisplayValue(selectedOrgUnit.name);
|
|
7958
|
-
setSelected(selectedOrgUnit.id);
|
|
7959
7857
|
setSelectedOrganisationUnit(selectedOrgUnit.id);
|
|
7960
|
-
setValue(selectedOrgUnit.id);
|
|
7961
7858
|
setShowOrgUnit(false);
|
|
7962
|
-
setTouched(true);
|
|
7963
7859
|
}
|
|
7964
7860
|
},
|
|
7965
7861
|
})),
|
|
7966
|
-
|
|
7862
|
+
// Start Date
|
|
7967
7863
|
React__default.createElement(InputField$1, {
|
|
7968
7864
|
className: 'input-field',
|
|
7969
7865
|
label: 'Start Date',
|
|
@@ -7971,7 +7867,7 @@ class SelectionFiltersComponent extends ReactWrapperModule {
|
|
|
7971
7867
|
value: filters.startDate,
|
|
7972
7868
|
onChange: (event) => setFilters({ ...filters, startDate: event.value }),
|
|
7973
7869
|
}),
|
|
7974
|
-
|
|
7870
|
+
// End Date
|
|
7975
7871
|
React__default.createElement(InputField$1, {
|
|
7976
7872
|
className: 'input-field',
|
|
7977
7873
|
label: 'End Date',
|
|
@@ -7979,84 +7875,15 @@ class SelectionFiltersComponent extends ReactWrapperModule {
|
|
|
7979
7875
|
value: filters.endDate,
|
|
7980
7876
|
onChange: (event) => setFilters({ ...filters, endDate: event.value }),
|
|
7981
7877
|
}),
|
|
7982
|
-
|
|
7878
|
+
// Action Button (same line, bottom-aligned)
|
|
7983
7879
|
React__default.createElement('div', {
|
|
7984
7880
|
style: {
|
|
7985
7881
|
display: 'flex',
|
|
7986
|
-
|
|
7987
|
-
|
|
7988
|
-
|
|
7989
|
-
height: '100%',
|
|
7990
|
-
},
|
|
7991
|
-
}, React__default.createElement('label', {
|
|
7992
|
-
style: {
|
|
7993
|
-
color: 'transparent', // Hides label text but keeps spacing
|
|
7994
|
-
fontSize: '14px',
|
|
7995
|
-
marginBottom: '4px',
|
|
7882
|
+
justifyContent: 'flex-end',
|
|
7883
|
+
// 👇 Ensure this cell itself bottoms out in the grid row
|
|
7884
|
+
alignSelf: 'end',
|
|
7996
7885
|
},
|
|
7997
|
-
},
|
|
7998
|
-
style: { height: '40px' }, // Match input field height
|
|
7999
|
-
onClick: () => setShowMoreFilters(!showMoreFilters),
|
|
8000
|
-
}, showMoreFilters ? 'Hide Filters' : 'More Filters')), showMoreFilters &&
|
|
8001
|
-
React__default.createElement(React__default.Fragment, null,
|
|
8002
|
-
/* Attribute Filters Grid */
|
|
8003
|
-
React__default.createElement('div', {
|
|
8004
|
-
style: {
|
|
8005
|
-
display: 'grid',
|
|
8006
|
-
gridTemplateColumns: 'repeat(4, 1fr)',
|
|
8007
|
-
gap: '16px',
|
|
8008
|
-
},
|
|
8009
|
-
}, filters.programAttributesFilters.map((filter, index) => React__default.createElement('div', {
|
|
8010
|
-
key: index,
|
|
8011
|
-
style: { gridColumn: getAttributeColumnSpan(index) },
|
|
8012
|
-
}, filter.hasOptions && filter.options.length > 0
|
|
8013
|
-
? React__default.createElement(SingleSelectField, {
|
|
8014
|
-
className: 'single-select',
|
|
8015
|
-
label: filter.name || 'Select Option',
|
|
8016
|
-
selected: filter.value,
|
|
8017
|
-
onChange: (event) => handleAttributeChange(index, event.selected),
|
|
8018
|
-
}, filter.options.map((option, i) => React__default.createElement(SingleSelectOption, {
|
|
8019
|
-
key: crypto.randomUUID() || i,
|
|
8020
|
-
label: option.name,
|
|
8021
|
-
value: option.code,
|
|
8022
|
-
})))
|
|
8023
|
-
: React__default.createElement(InputField$1, {
|
|
8024
|
-
className: 'input-field',
|
|
8025
|
-
label: filter.name || 'Program name',
|
|
8026
|
-
type: filter.valueType,
|
|
8027
|
-
value: filter.value,
|
|
8028
|
-
onChange: (event) => handleAttributeChange(index, event.value),
|
|
8029
|
-
})))),
|
|
8030
|
-
/* Data Element Filters Grid */
|
|
8031
|
-
React__default.createElement('div', {
|
|
8032
|
-
style: {
|
|
8033
|
-
display: 'grid',
|
|
8034
|
-
gridTemplateColumns: 'repeat(4, 1fr)',
|
|
8035
|
-
gap: '16px',
|
|
8036
|
-
},
|
|
8037
|
-
}, filters.programStageDataElementFilters.map((filter, index) => React__default.createElement('div', {
|
|
8038
|
-
key: index,
|
|
8039
|
-
style: { gridColumn: getDataElementColumnSpan(index) },
|
|
8040
|
-
}, filter.hasOptions && filter.options.length > 0
|
|
8041
|
-
? React__default.createElement(SingleSelectField, {
|
|
8042
|
-
className: 'single-select',
|
|
8043
|
-
label: filter.name || 'Aggregation type',
|
|
8044
|
-
selected: filter.value,
|
|
8045
|
-
onChange: (event) => handleDataElementChange(index, event.selected),
|
|
8046
|
-
}, filter.options.map((option, i) => React__default.createElement(SingleSelectOption, {
|
|
8047
|
-
key: crypto.randomUUID() || i,
|
|
8048
|
-
label: option.name,
|
|
8049
|
-
value: option.code,
|
|
8050
|
-
})))
|
|
8051
|
-
: React__default.createElement(InputField$1, {
|
|
8052
|
-
className: 'input-field',
|
|
8053
|
-
type: filter.valueType,
|
|
8054
|
-
label: filter.name || 'Program name',
|
|
8055
|
-
value: filter.value,
|
|
8056
|
-
onChange: (event) => handleDataElementChange(index, event.value),
|
|
8057
|
-
})))),
|
|
8058
|
-
/* Search Button */
|
|
8059
|
-
React__default.createElement('div', { style: { textAlign: 'right', marginTop: '16px' } }, React__default.createElement(Button$1, { onClick: handleSearch }, 'Search')))));
|
|
7886
|
+
}, React__default.createElement(Button$1, { style: { height: '40px' }, onClick: handleSearch }, 'Generate Report'))));
|
|
8060
7887
|
};
|
|
8061
7888
|
}
|
|
8062
7889
|
async getAppConfig() {
|
|
@@ -8091,7 +7918,7 @@ class SelectionFiltersComponent extends ReactWrapperModule {
|
|
|
8091
7918
|
onSelectOrgUnit(selectedOrgUnits) {
|
|
8092
7919
|
this.showOrgUnitTree.set(false);
|
|
8093
7920
|
if ((selectedOrgUnits || [])[0]) {
|
|
8094
|
-
this.
|
|
7921
|
+
this.selectedOrgUnitSignal.set(selectedOrgUnits[0]);
|
|
8095
7922
|
}
|
|
8096
7923
|
}
|
|
8097
7924
|
getOrgUnitAttributeByUsage(usageType) {
|
|
@@ -8112,11 +7939,11 @@ class SelectionFiltersComponent extends ReactWrapperModule {
|
|
|
8112
7939
|
this.render();
|
|
8113
7940
|
}
|
|
8114
7941
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: SelectionFiltersComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
8115
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.1.3", type: SelectionFiltersComponent, isStandalone: false, selector: "app-selection-filters-ui", inputs: { actionOptions: "actionOptions", programAttributesFilters: "programAttributesFilters", programStageDataElementFilters: "programStageDataElementFilters", startDate: "startDate", endDate: "endDate", program: "program", organisationUnit: "organisationUnit" }, outputs: { actionSelected: "actionSelected" }, usesInheritance: true, ngImport: i0, template: '<ng-content></ng-content>', isInline: true, styles: [".react-filters-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:20px;margin-bottom:20px}.input-field,.single-select{width:100%}\n"] }); }
|
|
7942
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.1.3", type: SelectionFiltersComponent, isStandalone: false, selector: "app-selection-filters-ui", inputs: { actionOptions: "actionOptions", programAttributesFilters: "programAttributesFilters", programStageDataElementFilters: "programStageDataElementFilters", startDate: "startDate", endDate: "endDate", program: "program", organisationUnit: "organisationUnit", selectedOrgUnit: "selectedOrgUnit", orgUnitFieldTitle: "orgUnitFieldTitle" }, outputs: { actionSelected: "actionSelected" }, usesInheritance: true, ngImport: i0, template: '<ng-content></ng-content>', isInline: true, styles: [".react-filters-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:20px;margin-bottom:20px}.input-field,.single-select{width:100%}.clickable-field input{cursor:pointer!important}\n"] }); }
|
|
8116
7943
|
}
|
|
8117
7944
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: SelectionFiltersComponent, decorators: [{
|
|
8118
7945
|
type: Component,
|
|
8119
|
-
args: [{ selector: 'app-selection-filters-ui', template: '<ng-content></ng-content>', standalone: false, styles: [".react-filters-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:20px;margin-bottom:20px}.input-field,.single-select{width:100%}\n"] }]
|
|
7946
|
+
args: [{ selector: 'app-selection-filters-ui', template: '<ng-content></ng-content>', standalone: false, styles: [".react-filters-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:20px;margin-bottom:20px}.input-field,.single-select{width:100%}.clickable-field input{cursor:pointer!important}\n"] }]
|
|
8120
7947
|
}], propDecorators: { actionOptions: [{
|
|
8121
7948
|
type: Input
|
|
8122
7949
|
}], programAttributesFilters: [{
|
|
@@ -8131,6 +7958,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImpor
|
|
|
8131
7958
|
type: Input
|
|
8132
7959
|
}], organisationUnit: [{
|
|
8133
7960
|
type: Input
|
|
7961
|
+
}], selectedOrgUnit: [{
|
|
7962
|
+
type: Input
|
|
7963
|
+
}], orgUnitFieldTitle: [{
|
|
7964
|
+
type: Input
|
|
8134
7965
|
}], actionSelected: [{
|
|
8135
7966
|
type: Output
|
|
8136
7967
|
}] } });
|