@iapps/ng-dhis2-ui 1.2.158 → 1.2.160

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.
@@ -4628,6 +4628,9 @@ const getEvents = (response, programStageId, pager, metaData, columnNameSource =
4628
4628
  const dataElementsData = events.map((event, idx) => {
4629
4629
  const row = {
4630
4630
  event: { value: event.event },
4631
+ responseData: {
4632
+ value: event,
4633
+ },
4631
4634
  index: {
4632
4635
  value: (pager.page - 1) * pager.pageSize + idx + 1,
4633
4636
  },
@@ -12828,6 +12831,7 @@ class ProgramEntryFormModule {
12828
12831
  this.event = input(...(ngDevMode ? [undefined, { debugName: "event" }] : []));
12829
12832
  this.enrollment = input(...(ngDevMode ? [undefined, { debugName: "enrollment" }] : []));
12830
12833
  this.orgUnit = input(...(ngDevMode ? [undefined, { debugName: "orgUnit" }] : []));
12834
+ this.codeGeneratorOrgUnit = input(...(ngDevMode ? [undefined, { debugName: "codeGeneratorOrgUnit" }] : []));
12831
12835
  this.customOrgUnitRoots = input(...(ngDevMode ? [undefined, { debugName: "customOrgUnitRoots" }] : []));
12832
12836
  this.formMetaData = input(...(ngDevMode ? [undefined, { debugName: "formMetaData" }] : []));
12833
12837
  this.collapsibleSections = input(false, ...(ngDevMode ? [{ debugName: "collapsibleSections" }] : []));
@@ -13099,22 +13103,36 @@ class ProgramEntryFormModule {
13099
13103
  return firstValueFrom(of(null));
13100
13104
  }
13101
13105
  }
13106
+ async #setReservedValuesForCodeGeneration(instance) {
13107
+ const orgUnitForCodeGeneration = this.codeGeneratorOrgUnit() || this.orgUnit();
13108
+ const reservedValueQuery = this.d2.trackerModule.trackedEntity.setProgram(this.config().program);
13109
+ if (orgUnitForCodeGeneration) {
13110
+ reservedValueQuery.setOrgUnit(orgUnitForCodeGeneration);
13111
+ }
13112
+ const reservedValues = await reservedValueQuery.generateReservedValues(instance);
13113
+ reservedValues.forEach((reserved) => {
13114
+ instance.setAttributeValue(reserved.ownerUid, reserved.value);
13115
+ });
13116
+ return instance;
13117
+ }
13102
13118
  async #getTrackerInstance() {
13103
13119
  this.instanceQuery = this.d2.trackerModule.trackedEntity
13104
13120
  .setProgram(this.config().program)
13105
13121
  .setOrgUnit(this.orgUnit());
13106
13122
  if (!this.trackedEntity()) {
13107
- return await this.instanceQuery.create();
13123
+ const instance = await this.instanceQuery.create();
13124
+ return await this.#setReservedValuesForCodeGeneration(instance);
13108
13125
  }
13109
13126
  const instanceResult = (await this.instanceQuery
13110
13127
  .setTrackedEntity(this.trackedEntity())
13111
13128
  .get()).data;
13112
13129
  if (!instanceResult) {
13113
- return await this.instanceQuery.create();
13130
+ const instance = await this.instanceQuery.create();
13131
+ return await this.#setReservedValuesForCodeGeneration(instance);
13114
13132
  }
13115
- const instance = await this.instanceQuery
13116
- .setInstanceFields(this.metaData()?.program)
13117
- .setReservedValues();
13133
+ this.instanceQuery
13134
+ .setInstanceFields(this.metaData()?.program);
13135
+ const instance = await this.#setReservedValuesForCodeGeneration(this.instanceQuery.instance);
13118
13136
  if (this.orgUnit()) {
13119
13137
  instance.setOrgUnit(this.orgUnit());
13120
13138
  }
@@ -13150,7 +13168,7 @@ class ProgramEntryFormModule {
13150
13168
  }
13151
13169
  }
13152
13170
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: ProgramEntryFormModule, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
13153
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.3", type: ProgramEntryFormModule, isStandalone: true, selector: "ng-dhis2-ui-program-entry-form", inputs: { config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: true, transformFunction: null }, trackedEntity: { classPropertyName: "trackedEntity", publicName: "trackedEntity", isSignal: true, isRequired: false, transformFunction: null }, event: { classPropertyName: "event", publicName: "event", isSignal: true, isRequired: false, transformFunction: null }, enrollment: { classPropertyName: "enrollment", publicName: "enrollment", isSignal: true, isRequired: false, transformFunction: null }, orgUnit: { classPropertyName: "orgUnit", publicName: "orgUnit", isSignal: true, isRequired: false, transformFunction: null }, customOrgUnitRoots: { classPropertyName: "customOrgUnitRoots", publicName: "customOrgUnitRoots", isSignal: true, isRequired: false, transformFunction: null }, formMetaData: { classPropertyName: "formMetaData", publicName: "formMetaData", isSignal: true, isRequired: false, transformFunction: null }, collapsibleSections: { classPropertyName: "collapsibleSections", publicName: "collapsibleSections", isSignal: true, isRequired: false, transformFunction: null }, preprocess: { classPropertyName: "preprocess", publicName: "preprocess", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { instanceSave: "instanceSave", instanceSaveCompleted: "instanceSaveCompleted", instanceUpdate: "instanceUpdate", formValidityUpdate: "formValidityUpdate", formCancel: "formCancel" }, ngImport: i0, template: "@if (loading()) {\n<div className=\"program-entry__form-loader\">\n <ng-dhis2-ui-wrapper [component]=\"FormLoader\" />\n</div>\n} @else if(metaData()) {\n\n<div>\n <!-- Form content -->\n @switch (config().displayType) {\n\n <!-- Flat display -->\n @case ('FLAT') {\n <ng-dhis2-ui-flat-form\n [programEntryFormConfig]=\"config()\"\n [optionCascadeConfigs]=\"config().optionCascadeConfigs || []\"\n [collapsibleSections]=\"collapsibleSections()\"\n [programEntryFormMetaData]=\"metaData()!\"\n [name]=\"metaData()!.name\"\n [dataValues]=\"instance() || {}\"\n [dataId]=\"dataId()\"\n [rules]=\"metaData()!.rules\"\n [fields]=\"metaData()!.formFields\"\n [customOrgUnitRoots]=\"customOrgUnitRoots()\"\n [coordinatePickerGeoConfig]=\"config().coordinatePickerGeoConfig\"\n (formUpdate)=\"onFormUpdate($event)\"\n (formValidityUpdate)=\"onValidityUpdate($event)\"\n />\n\n <!-- <ng-dhis2-ui-flat-form\n [name]=\"metaData()!.name\"\n [dataValues]=\"instance() || {}\"\n [dataId]=\"dataId()\"\n [rules]=\"metaData()!.rules\"\n [fields]=\"metaData()!.formFields\"\n [customOrgUnitRoots]=\"customOrgUnitRoots()\"\n [program]=\"config().program\"\n (formUpdate)=\"onFormUpdate($event)\"\n (formValidityUpdate)=\"onValidityUpdate($event)\"\n /> -->\n }\n\n <!-- SECTION display -->\n @case ('SECTION') { Section form }\n\n <!-- CUSTOM FORM -->\n @case ('CUSTOM') { } }\n\n <!-- Action buttons -->\n\n @if(!config().hideActionButtons) {\n <ng-dhis2-ui-wrapper [component]=\"FormActionButtons()\" />\n }\n</div>\n}\n", styles: ["::ng-deep .program-entry__form-loader{padding:8px}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: D2FormModule }, { kind: "component", type: FlatFormComponent, selector: "ng-dhis2-ui-flat-form", inputs: ["collapsibleSections", "programEntryFormConfig", "optionCascadeConfigs"] }, { kind: "directive", type: ReactWrapperModule, selector: "ng-dhis2-ui-wrapper", inputs: ["props", "component"] }] }); }
13171
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.3", type: ProgramEntryFormModule, isStandalone: true, selector: "ng-dhis2-ui-program-entry-form", inputs: { config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: true, transformFunction: null }, trackedEntity: { classPropertyName: "trackedEntity", publicName: "trackedEntity", isSignal: true, isRequired: false, transformFunction: null }, event: { classPropertyName: "event", publicName: "event", isSignal: true, isRequired: false, transformFunction: null }, enrollment: { classPropertyName: "enrollment", publicName: "enrollment", isSignal: true, isRequired: false, transformFunction: null }, orgUnit: { classPropertyName: "orgUnit", publicName: "orgUnit", isSignal: true, isRequired: false, transformFunction: null }, codeGeneratorOrgUnit: { classPropertyName: "codeGeneratorOrgUnit", publicName: "codeGeneratorOrgUnit", isSignal: true, isRequired: false, transformFunction: null }, customOrgUnitRoots: { classPropertyName: "customOrgUnitRoots", publicName: "customOrgUnitRoots", isSignal: true, isRequired: false, transformFunction: null }, formMetaData: { classPropertyName: "formMetaData", publicName: "formMetaData", isSignal: true, isRequired: false, transformFunction: null }, collapsibleSections: { classPropertyName: "collapsibleSections", publicName: "collapsibleSections", isSignal: true, isRequired: false, transformFunction: null }, preprocess: { classPropertyName: "preprocess", publicName: "preprocess", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { instanceSave: "instanceSave", instanceSaveCompleted: "instanceSaveCompleted", instanceUpdate: "instanceUpdate", formValidityUpdate: "formValidityUpdate", formCancel: "formCancel" }, ngImport: i0, template: "@if (loading()) {\n<div className=\"program-entry__form-loader\">\n <ng-dhis2-ui-wrapper [component]=\"FormLoader\" />\n</div>\n} @else if(metaData()) {\n\n<div>\n <!-- Form content -->\n @switch (config().displayType) {\n\n <!-- Flat display -->\n @case ('FLAT') {\n <ng-dhis2-ui-flat-form\n [programEntryFormConfig]=\"config()\"\n [optionCascadeConfigs]=\"config().optionCascadeConfigs || []\"\n [collapsibleSections]=\"collapsibleSections()\"\n [programEntryFormMetaData]=\"metaData()!\"\n [name]=\"metaData()!.name\"\n [dataValues]=\"instance() || {}\"\n [dataId]=\"dataId()\"\n [rules]=\"metaData()!.rules\"\n [fields]=\"metaData()!.formFields\"\n [customOrgUnitRoots]=\"customOrgUnitRoots()\"\n [coordinatePickerGeoConfig]=\"config().coordinatePickerGeoConfig\"\n (formUpdate)=\"onFormUpdate($event)\"\n (formValidityUpdate)=\"onValidityUpdate($event)\"\n />\n\n <!-- <ng-dhis2-ui-flat-form\n [name]=\"metaData()!.name\"\n [dataValues]=\"instance() || {}\"\n [dataId]=\"dataId()\"\n [rules]=\"metaData()!.rules\"\n [fields]=\"metaData()!.formFields\"\n [customOrgUnitRoots]=\"customOrgUnitRoots()\"\n [program]=\"config().program\"\n (formUpdate)=\"onFormUpdate($event)\"\n (formValidityUpdate)=\"onValidityUpdate($event)\"\n /> -->\n }\n\n <!-- SECTION display -->\n @case ('SECTION') { Section form }\n\n <!-- CUSTOM FORM -->\n @case ('CUSTOM') { } }\n\n <!-- Action buttons -->\n\n @if(!config().hideActionButtons) {\n <ng-dhis2-ui-wrapper [component]=\"FormActionButtons()\" />\n }\n</div>\n}\n", styles: ["::ng-deep .program-entry__form-loader{padding:8px}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: D2FormModule }, { kind: "component", type: FlatFormComponent, selector: "ng-dhis2-ui-flat-form", inputs: ["collapsibleSections", "programEntryFormConfig", "optionCascadeConfigs"] }, { kind: "directive", type: ReactWrapperModule, selector: "ng-dhis2-ui-wrapper", inputs: ["props", "component"] }] }); }
13154
13172
  }
13155
13173
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: ProgramEntryFormModule, decorators: [{
13156
13174
  type: Component,