@iapps/ng-dhis2-ui 1.1.40 → 1.1.41
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.
|
@@ -3478,6 +3478,15 @@ class LineListTableComponent extends ReactWrapperModule {
|
|
|
3478
3478
|
}
|
|
3479
3479
|
});
|
|
3480
3480
|
};
|
|
3481
|
+
// const handleInputChange = (key: string, value: string) => {
|
|
3482
|
+
// setInputValues((prevValues) => ({
|
|
3483
|
+
// ...prevValues,
|
|
3484
|
+
// [key]: value ?? '', // Ensure no undefined values
|
|
3485
|
+
// }));
|
|
3486
|
+
// };
|
|
3487
|
+
// if (!filteredColumns || filteredColumns.length === 0) {
|
|
3488
|
+
// return <div>No fields available</div>;
|
|
3489
|
+
// }
|
|
3481
3490
|
const handleInputChange = (key, value) => {
|
|
3482
3491
|
setInputValues((prevValues) => ({
|
|
3483
3492
|
...prevValues,
|
|
@@ -3493,7 +3502,29 @@ class LineListTableComponent extends ReactWrapperModule {
|
|
|
3493
3502
|
// console.log(`Updated Filters:`, updatedFilters); // Debugging
|
|
3494
3503
|
return updatedFilters;
|
|
3495
3504
|
});
|
|
3505
|
+
// setAttributeFiltersState((prevFilters = []) => {
|
|
3506
|
+
// // Check if attribute already exists
|
|
3507
|
+
// const existingFilterIndex = prevFilters.findIndex(
|
|
3508
|
+
// (f) => f.attribute === key
|
|
3509
|
+
// );
|
|
3510
|
+
// // Create a new filter object
|
|
3511
|
+
// const newFilter = { attribute: key, operator: 'like', value };
|
|
3512
|
+
// if (existingFilterIndex !== -1) {
|
|
3513
|
+
// // If attribute exists, update its value
|
|
3514
|
+
// const updatedFilters = [...prevFilters];
|
|
3515
|
+
// updatedFilters[existingFilterIndex] = newFilter;
|
|
3516
|
+
// console.log(`Updated Filters:`, updatedFilters); // Log updated filter list
|
|
3517
|
+
// return updatedFilters;
|
|
3518
|
+
// } else {
|
|
3519
|
+
// // If attribute doesn't exist, add a new object
|
|
3520
|
+
// return [...prevFilters, newFilter];
|
|
3521
|
+
// }
|
|
3522
|
+
// });
|
|
3496
3523
|
};
|
|
3524
|
+
// console.log(
|
|
3525
|
+
// 'these are the filtered columns which have the attributes neede',
|
|
3526
|
+
// filteredColumns
|
|
3527
|
+
// );
|
|
3497
3528
|
return (React__default.createElement("div", null,
|
|
3498
3529
|
React__default.createElement("div", { style: {
|
|
3499
3530
|
width: '100%',
|
|
@@ -3523,7 +3554,7 @@ class LineListTableComponent extends ReactWrapperModule {
|
|
|
3523
3554
|
gap: 8,
|
|
3524
3555
|
}, onClick: () => {
|
|
3525
3556
|
setFilters(!filters);
|
|
3526
|
-
}
|
|
3557
|
+
} },
|
|
3527
3558
|
React__default.createElement(IconFilter16, null),
|
|
3528
3559
|
filters ? 'Hide Filters' : 'Show Filters'))),
|
|
3529
3560
|
filters && (React__default.createElement("div", { style: {
|
|
@@ -4516,38 +4547,13 @@ class FormMetaData {
|
|
|
4516
4547
|
#getSectionFromPrograms(programs) {
|
|
4517
4548
|
const sections = flatten(programs.map((program) => {
|
|
4518
4549
|
return [
|
|
4519
|
-
this
|
|
4520
|
-
|
|
4521
|
-
|
|
4522
|
-
|
|
4523
|
-
|
|
4524
|
-
|
|
4525
|
-
|
|
4526
|
-
? program.programSections.map((programSection) => {
|
|
4527
|
-
return {
|
|
4528
|
-
id: programSection.id,
|
|
4529
|
-
name: programSection.name,
|
|
4530
|
-
sortOrder: programSection.sortOrder,
|
|
4531
|
-
fields: programSection.trackedEntityAttributes,
|
|
4532
|
-
};
|
|
4533
|
-
})
|
|
4534
|
-
: [
|
|
4535
|
-
{
|
|
4536
|
-
id: 'registration',
|
|
4537
|
-
name: '',
|
|
4538
|
-
sortOrder: 1,
|
|
4539
|
-
fields: (program.programTrackedEntityAttributes || []).map((programTrackedEntityAttribute) => {
|
|
4540
|
-
return {
|
|
4541
|
-
id: programTrackedEntityAttribute
|
|
4542
|
-
.trackedEntityAttribute?.id,
|
|
4543
|
-
};
|
|
4544
|
-
}),
|
|
4545
|
-
},
|
|
4546
|
-
],
|
|
4547
|
-
},
|
|
4548
|
-
program,
|
|
4549
|
-
locale: this.params.locale,
|
|
4550
|
-
}).toJson(),
|
|
4550
|
+
...(this.params.splitRegistrationSection
|
|
4551
|
+
? [
|
|
4552
|
+
this.#getRegisteringUnitSection(program),
|
|
4553
|
+
this.#getReportingDateSection(program),
|
|
4554
|
+
this.#getRegistrationSection(program),
|
|
4555
|
+
]
|
|
4556
|
+
: [this.#getMergedRegistrationSection(program)]),
|
|
4551
4557
|
...(program.programStages || []).map((programStage) => {
|
|
4552
4558
|
return new FormMetadataSection({
|
|
4553
4559
|
section: {
|
|
@@ -4654,6 +4660,112 @@ class FormMetaData {
|
|
|
4654
4660
|
locale: this.params.locale,
|
|
4655
4661
|
}).toJson();
|
|
4656
4662
|
}
|
|
4663
|
+
#getRegistrationSection(program) {
|
|
4664
|
+
return new FormMetadataSection({
|
|
4665
|
+
section: {
|
|
4666
|
+
id: 'registration',
|
|
4667
|
+
name: 'Registration',
|
|
4668
|
+
fieldGroups: (program.programSections || []).length > 0
|
|
4669
|
+
? program.programSections.map((programSection) => {
|
|
4670
|
+
return {
|
|
4671
|
+
id: programSection.id,
|
|
4672
|
+
name: programSection.name,
|
|
4673
|
+
sortOrder: programSection.sortOrder,
|
|
4674
|
+
fields: programSection.trackedEntityAttributes,
|
|
4675
|
+
};
|
|
4676
|
+
})
|
|
4677
|
+
: [
|
|
4678
|
+
{
|
|
4679
|
+
id: 'registration',
|
|
4680
|
+
name: '',
|
|
4681
|
+
sortOrder: 1,
|
|
4682
|
+
fields: (program.programTrackedEntityAttributes || []).map((programTrackedEntityAttribute) => {
|
|
4683
|
+
return {
|
|
4684
|
+
id: programTrackedEntityAttribute.trackedEntityAttribute
|
|
4685
|
+
?.id,
|
|
4686
|
+
};
|
|
4687
|
+
}),
|
|
4688
|
+
},
|
|
4689
|
+
],
|
|
4690
|
+
},
|
|
4691
|
+
program,
|
|
4692
|
+
locale: this.params.locale,
|
|
4693
|
+
}).toJson();
|
|
4694
|
+
}
|
|
4695
|
+
#getMergedRegistrationSection(program) {
|
|
4696
|
+
return new FormMetadataSection({
|
|
4697
|
+
section: {
|
|
4698
|
+
id: 'registration',
|
|
4699
|
+
name: 'Registration',
|
|
4700
|
+
fieldGroups: [
|
|
4701
|
+
{
|
|
4702
|
+
id: 'registering_unit_details',
|
|
4703
|
+
name: 'Registering unit details',
|
|
4704
|
+
sortOrder: 1,
|
|
4705
|
+
isFormHorizontal: false,
|
|
4706
|
+
fields: [
|
|
4707
|
+
new FormField({
|
|
4708
|
+
id: 'orgUnit',
|
|
4709
|
+
key: 'orgUnit',
|
|
4710
|
+
label: program.orgUnitLabel || 'Registering unit',
|
|
4711
|
+
code: 'orgUnit',
|
|
4712
|
+
required: true,
|
|
4713
|
+
controlType: 'org-unit',
|
|
4714
|
+
}),
|
|
4715
|
+
],
|
|
4716
|
+
},
|
|
4717
|
+
{
|
|
4718
|
+
id: 'reporting_dates',
|
|
4719
|
+
name: 'Reporting dates',
|
|
4720
|
+
sortOrder: 1,
|
|
4721
|
+
isFormHorizontal: false,
|
|
4722
|
+
fields: [
|
|
4723
|
+
new DateField({
|
|
4724
|
+
id: 'enrollmentDate',
|
|
4725
|
+
label: program.enrollmentDateLabel || 'Enrollment date',
|
|
4726
|
+
code: 'enrollmentDate',
|
|
4727
|
+
key: 'enrollmentDate',
|
|
4728
|
+
required: true,
|
|
4729
|
+
}),
|
|
4730
|
+
program.displayIncidentDate
|
|
4731
|
+
? new DateField({
|
|
4732
|
+
id: 'incidentDate',
|
|
4733
|
+
label: program.incidentDateLabel || 'Incident date',
|
|
4734
|
+
code: 'incidentDate',
|
|
4735
|
+
key: 'incidentDate',
|
|
4736
|
+
required: true,
|
|
4737
|
+
})
|
|
4738
|
+
: null,
|
|
4739
|
+
].filter((field) => field),
|
|
4740
|
+
},
|
|
4741
|
+
...((program.programSections || []).length > 0
|
|
4742
|
+
? program.programSections.map((programSection) => {
|
|
4743
|
+
return {
|
|
4744
|
+
id: programSection.id,
|
|
4745
|
+
name: programSection.name,
|
|
4746
|
+
sortOrder: programSection.sortOrder,
|
|
4747
|
+
fields: programSection.trackedEntityAttributes,
|
|
4748
|
+
};
|
|
4749
|
+
})
|
|
4750
|
+
: [
|
|
4751
|
+
{
|
|
4752
|
+
id: 'registration',
|
|
4753
|
+
name: '',
|
|
4754
|
+
sortOrder: 1,
|
|
4755
|
+
fields: (program.programTrackedEntityAttributes || []).map((programTrackedEntityAttribute) => {
|
|
4756
|
+
return {
|
|
4757
|
+
id: programTrackedEntityAttribute.trackedEntityAttribute
|
|
4758
|
+
?.id,
|
|
4759
|
+
};
|
|
4760
|
+
}),
|
|
4761
|
+
},
|
|
4762
|
+
]),
|
|
4763
|
+
],
|
|
4764
|
+
},
|
|
4765
|
+
program,
|
|
4766
|
+
locale: this.params.locale,
|
|
4767
|
+
}).toJson();
|
|
4768
|
+
}
|
|
4657
4769
|
toJson() {
|
|
4658
4770
|
return {
|
|
4659
4771
|
id: this.params.customFormMetaData?.id,
|