@iapps/ng-dhis2-ui 1.2.113 → 1.2.115
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.
|
@@ -5456,7 +5456,17 @@ class FieldDropdown {
|
|
|
5456
5456
|
order: this.order,
|
|
5457
5457
|
};
|
|
5458
5458
|
}
|
|
5459
|
-
static getDropdownOptions(field, locale) {
|
|
5459
|
+
static getDropdownOptions(field, locale, extension) {
|
|
5460
|
+
if (extension?.organisationUnits &&
|
|
5461
|
+
extension.organisationUnits.length > 0) {
|
|
5462
|
+
return sortBy(extension.organisationUnits.map((orgUnit) => {
|
|
5463
|
+
return new FieldDropdown({
|
|
5464
|
+
key: orgUnit.id,
|
|
5465
|
+
value: orgUnit.id,
|
|
5466
|
+
label: orgUnit.name,
|
|
5467
|
+
});
|
|
5468
|
+
}), 'label');
|
|
5469
|
+
}
|
|
5460
5470
|
if (field?.valueType === FieldType.BOOLEAN) {
|
|
5461
5471
|
return [
|
|
5462
5472
|
{
|
|
@@ -8322,9 +8332,9 @@ class ProgramEntryFormFieldUtil {
|
|
|
8322
8332
|
get fields() {
|
|
8323
8333
|
const fields = [...this.attributes, ...this.dataElements]
|
|
8324
8334
|
.map((field) => {
|
|
8325
|
-
const options = FieldDropdown.getDropdownOptions(field);
|
|
8326
|
-
const hasOptions = options?.length > 0;
|
|
8327
8335
|
const extension = this.config.formFieldExtensions?.find((fieldExtension) => fieldExtension?.id === field.id);
|
|
8336
|
+
const options = FieldDropdown.getDropdownOptions(field, undefined, extension);
|
|
8337
|
+
const hasOptions = options?.length > 0;
|
|
8328
8338
|
const autoAssignedValue = this.#getAutoAssignedValue(field);
|
|
8329
8339
|
if (!isUndefined(autoAssignedValue) &&
|
|
8330
8340
|
this.config.hideCustomAssignedFields) {
|
|
@@ -8530,6 +8540,14 @@ class ProgramEntryFormMetaData {
|
|
|
8530
8540
|
const program = await this.#getProgramMetaData();
|
|
8531
8541
|
if (program) {
|
|
8532
8542
|
this.program = program;
|
|
8543
|
+
if (this.config?.formFieldExtensions &&
|
|
8544
|
+
this.config.formFieldExtensions.length > 0 &&
|
|
8545
|
+
this.config.formFieldExtensions[0]?.optionSetGroup) {
|
|
8546
|
+
const orgUnitResponse = await this.d2.httpInstance.get(`organisationUnits.json?fields=id,name,code&paging=false&filter=organisationUnitGroups.code:eq:${this.config.formFieldExtensions[0].optionSetGroup}`);
|
|
8547
|
+
const orgUnitsResponse = orgUnitResponse?.data?.['organisationUnits'];
|
|
8548
|
+
const organisationUnits = Array.isArray(orgUnitsResponse) ? orgUnitsResponse : [];
|
|
8549
|
+
this.config.formFieldExtensions[0].organisationUnits = organisationUnits;
|
|
8550
|
+
}
|
|
8533
8551
|
return this.toJson();
|
|
8534
8552
|
}
|
|
8535
8553
|
return null;
|
|
@@ -8579,9 +8597,6 @@ class ProgramEntryFormModule {
|
|
|
8579
8597
|
this.FormLoader = () => {
|
|
8580
8598
|
return React__default.createElement(CircularLoader$1, { small: true });
|
|
8581
8599
|
};
|
|
8582
|
-
// dataId = computed(() => {
|
|
8583
|
-
// return this.instance()?.trackedEntity || this.instance()?.event;
|
|
8584
|
-
// });
|
|
8585
8600
|
this.dataId = computed(() => {
|
|
8586
8601
|
if (this.config().formType === 'EVENT') {
|
|
8587
8602
|
return this.instance()?.event;
|