@iapps/ng-dhis2-ui 1.3.1 → 1.3.3
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.
|
@@ -11352,10 +11352,10 @@ class FlatFormComponent extends BaseFormWrapperComponent {
|
|
|
11352
11352
|
}
|
|
11353
11353
|
ngOnInit() {
|
|
11354
11354
|
this.formGroup = FormUtil.getFormGroup(this.fields(), this.dataValues());
|
|
11355
|
-
this.onFormUpdate();
|
|
11355
|
+
this.onFormUpdate(this.dataValues());
|
|
11356
11356
|
}
|
|
11357
|
-
onFormUpdate() {
|
|
11358
|
-
this.updateDataValues(this.formGroup.getRawValue());
|
|
11357
|
+
onFormUpdate(dataValues) {
|
|
11358
|
+
this.updateDataValues(dataValues ?? this.formGroup.getRawValue());
|
|
11359
11359
|
this.updateFormValidity(this.formGroup.valid);
|
|
11360
11360
|
}
|
|
11361
11361
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: FlatFormComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
@@ -12207,7 +12207,7 @@ class ProgramEntryFormFieldUtil {
|
|
|
12207
12207
|
return [...this.reportFields, ...fields];
|
|
12208
12208
|
}
|
|
12209
12209
|
#getDisabledStatus(field) {
|
|
12210
|
-
if (field?.generated) {
|
|
12210
|
+
if (field?.generated || this.config.disableForm) {
|
|
12211
12211
|
return true;
|
|
12212
12212
|
}
|
|
12213
12213
|
if (this.config.autoAssignedValues &&
|
|
@@ -12224,192 +12224,6 @@ class ProgramEntryFormFieldUtil {
|
|
|
12224
12224
|
}
|
|
12225
12225
|
}
|
|
12226
12226
|
|
|
12227
|
-
// Copyright 2025 UDSM DHIS2 Lab. All rights reserved.
|
|
12228
|
-
// Use of this source code is governed by a BSD-style
|
|
12229
|
-
// license that can be found in the LICENSE file.
|
|
12230
|
-
class ProgramStageEntryFormSection {
|
|
12231
|
-
constructor(props) {
|
|
12232
|
-
this.formFields = [];
|
|
12233
|
-
this.orientation = 'HORIZONTAL';
|
|
12234
|
-
Object.assign(this, props);
|
|
12235
|
-
}
|
|
12236
|
-
}
|
|
12237
|
-
|
|
12238
|
-
class ProgramStageEntryFormSectionUtil {
|
|
12239
|
-
#sortedCanonicalStageFieldsCache = null;
|
|
12240
|
-
constructor(program, config) {
|
|
12241
|
-
this.program = program;
|
|
12242
|
-
this.config = config;
|
|
12243
|
-
this.fieldUtil = new ProgramEntryFormFieldUtil(program, config);
|
|
12244
|
-
}
|
|
12245
|
-
get programStageEntryFormSections() {
|
|
12246
|
-
const programStageId = this.#getStageIdFromConfig();
|
|
12247
|
-
if (!programStageId)
|
|
12248
|
-
return [];
|
|
12249
|
-
const programStage = this.#findStageById(programStageId);
|
|
12250
|
-
if (!programStage)
|
|
12251
|
-
return [];
|
|
12252
|
-
const sections = [];
|
|
12253
|
-
const basicDetailsFields = this.fieldUtil.eventReportFields;
|
|
12254
|
-
if (basicDetailsFields?.length) {
|
|
12255
|
-
sections.push(new ProgramStageEntryFormSection({
|
|
12256
|
-
id: `${programStage.id}_basic_information`,
|
|
12257
|
-
name: 'Basic Information',
|
|
12258
|
-
description: programStage.description ?? '',
|
|
12259
|
-
formFields: basicDetailsFields,
|
|
12260
|
-
orientation: 'VERTICAL',
|
|
12261
|
-
}));
|
|
12262
|
-
}
|
|
12263
|
-
const canonicalFieldsByDataElementId = this.#buildCanonicalStageFieldsByDataElementId(programStage);
|
|
12264
|
-
const programStageSections = programStage.programStageSections ?? [];
|
|
12265
|
-
for (const programStageSection of programStageSections) {
|
|
12266
|
-
const sectionFields = this.#mapStageSectionToFields(programStageSection, canonicalFieldsByDataElementId);
|
|
12267
|
-
if (!sectionFields.length)
|
|
12268
|
-
continue;
|
|
12269
|
-
sections.push(new ProgramStageEntryFormSection({
|
|
12270
|
-
id: programStageSection.id,
|
|
12271
|
-
name: programStageSection.displayName ?? programStageSection.name ?? '',
|
|
12272
|
-
description: programStageSection.description ?? '',
|
|
12273
|
-
formFields: sectionFields,
|
|
12274
|
-
orientation: 'HORIZONTAL',
|
|
12275
|
-
}));
|
|
12276
|
-
}
|
|
12277
|
-
return sections;
|
|
12278
|
-
}
|
|
12279
|
-
// ---------------------------
|
|
12280
|
-
// Canonical stage fields
|
|
12281
|
-
// ---------------------------
|
|
12282
|
-
#buildCanonicalStageFieldsByDataElementId(programStage) {
|
|
12283
|
-
const programStageDataElements = programStage.programStageDataElements ?? [];
|
|
12284
|
-
const fieldsByDataElementId = new Map();
|
|
12285
|
-
for (let i = 0; i < programStageDataElements.length; i++) {
|
|
12286
|
-
const programStageDataElement = programStageDataElements[i];
|
|
12287
|
-
const canonicalField = this.#mapProgramStageDataElementToField(programStageDataElement, programStage.id);
|
|
12288
|
-
if (!canonicalField?.id)
|
|
12289
|
-
continue;
|
|
12290
|
-
fieldsByDataElementId.set(canonicalField.id, canonicalField);
|
|
12291
|
-
}
|
|
12292
|
-
this.#sortedCanonicalStageFieldsCache = null;
|
|
12293
|
-
return fieldsByDataElementId;
|
|
12294
|
-
}
|
|
12295
|
-
// ---------------------------
|
|
12296
|
-
// Map a stage section using canonical fields (like program sections)
|
|
12297
|
-
// ---------------------------
|
|
12298
|
-
#mapStageSectionToFields(programStageSection, canonicalFieldsByDataElementId) {
|
|
12299
|
-
const sectionDataElements = programStageSection.dataElements;
|
|
12300
|
-
const sectionDataElementIdsFromAlt = programStageSection?.dataElementsIds ??
|
|
12301
|
-
undefined;
|
|
12302
|
-
const sectionDataElementIds = (sectionDataElements?.length
|
|
12303
|
-
? sectionDataElements.map((d) => d?.id).filter(Boolean)
|
|
12304
|
-
: sectionDataElementIdsFromAlt?.filter(Boolean)) ?? [];
|
|
12305
|
-
if (sectionDataElementIds.length > 0) {
|
|
12306
|
-
const sectionFields = [];
|
|
12307
|
-
for (let index = 0; index < sectionDataElementIds.length; index++) {
|
|
12308
|
-
const dataElementId = sectionDataElementIds[index];
|
|
12309
|
-
const canonicalField = canonicalFieldsByDataElementId.get(dataElementId);
|
|
12310
|
-
if (!canonicalField)
|
|
12311
|
-
continue;
|
|
12312
|
-
sectionFields.push({
|
|
12313
|
-
...canonicalField,
|
|
12314
|
-
order: index + 1,
|
|
12315
|
-
});
|
|
12316
|
-
}
|
|
12317
|
-
return sectionFields;
|
|
12318
|
-
}
|
|
12319
|
-
return this.#getSortedCanonicalStageFields(canonicalFieldsByDataElementId);
|
|
12320
|
-
}
|
|
12321
|
-
#getSortedCanonicalStageFields(canonicalFieldsByDataElementId) {
|
|
12322
|
-
const cache = this.#sortedCanonicalStageFieldsCache;
|
|
12323
|
-
if (cache?.sourceMap === canonicalFieldsByDataElementId) {
|
|
12324
|
-
return cache.sortedFields;
|
|
12325
|
-
}
|
|
12326
|
-
const sortedFields = Array.from(canonicalFieldsByDataElementId.values());
|
|
12327
|
-
sortedFields.sort((a, b) => (a.order ?? 0) - (b.order ?? 0));
|
|
12328
|
-
this.#sortedCanonicalStageFieldsCache = {
|
|
12329
|
-
sourceMap: canonicalFieldsByDataElementId,
|
|
12330
|
-
sortedFields,
|
|
12331
|
-
};
|
|
12332
|
-
return sortedFields;
|
|
12333
|
-
}
|
|
12334
|
-
// ---------------------------
|
|
12335
|
-
// Map a programStageDataElement => canonical form field
|
|
12336
|
-
// ---------------------------
|
|
12337
|
-
#mapProgramStageDataElementToField(programStageDataElement, programStageId) {
|
|
12338
|
-
const dataElementDefinition = programStageDataElement?.dataElement;
|
|
12339
|
-
if (!dataElementDefinition?.id)
|
|
12340
|
-
return null;
|
|
12341
|
-
const fieldBaseConfig = {
|
|
12342
|
-
id: dataElementDefinition.id,
|
|
12343
|
-
code: dataElementDefinition.code,
|
|
12344
|
-
formName: dataElementDefinition.formName,
|
|
12345
|
-
name: dataElementDefinition.displayName ?? dataElementDefinition.name ?? '',
|
|
12346
|
-
description: dataElementDefinition.description,
|
|
12347
|
-
mandatory: !!programStageDataElement.compulsory,
|
|
12348
|
-
valueType: dataElementDefinition.valueType,
|
|
12349
|
-
sortOrder: programStageDataElement.sortOrder,
|
|
12350
|
-
stepId: programStageId,
|
|
12351
|
-
allowFutureDate: programStageDataElement.allowFutureDate,
|
|
12352
|
-
optionSet: dataElementDefinition.optionSet,
|
|
12353
|
-
};
|
|
12354
|
-
const dropdownOptions = FieldDropdown.getDropdownOptions(fieldBaseConfig);
|
|
12355
|
-
const hasSelectableOptions = (dropdownOptions?.length ?? 0) > 0;
|
|
12356
|
-
const fieldExtension = this.config.formFieldExtensions?.find((extension) => extension?.id === fieldBaseConfig.id);
|
|
12357
|
-
const autoAssignedValue = this.#getAutoAssignedValue(fieldBaseConfig);
|
|
12358
|
-
if (!isUndefined(autoAssignedValue) &&
|
|
12359
|
-
this.config.hideCustomAssignedFields) {
|
|
12360
|
-
return null;
|
|
12361
|
-
}
|
|
12362
|
-
return new FormField({
|
|
12363
|
-
...fieldBaseConfig,
|
|
12364
|
-
label: fieldBaseConfig.formName || fieldBaseConfig.name,
|
|
12365
|
-
key: fieldBaseConfig.code
|
|
12366
|
-
? camelCase(fieldBaseConfig.code)
|
|
12367
|
-
: fieldBaseConfig.id,
|
|
12368
|
-
required: fieldBaseConfig.mandatory,
|
|
12369
|
-
type: FieldUtil.getFieldType(fieldBaseConfig.valueType),
|
|
12370
|
-
options: dropdownOptions,
|
|
12371
|
-
disabled: this.#getDisabledStatus(fieldBaseConfig),
|
|
12372
|
-
order: fieldBaseConfig.sortOrder,
|
|
12373
|
-
hasOptions: hasSelectableOptions,
|
|
12374
|
-
controlType: FieldUtil.getFieldControlType(fieldBaseConfig.valueType, hasSelectableOptions),
|
|
12375
|
-
extension: fieldExtension,
|
|
12376
|
-
});
|
|
12377
|
-
}
|
|
12378
|
-
// ---------------------------
|
|
12379
|
-
// Stage selection helpers
|
|
12380
|
-
// ---------------------------
|
|
12381
|
-
#getStageIdFromConfig() {
|
|
12382
|
-
const programStageRef = this.config?.programStage;
|
|
12383
|
-
if (!programStageRef)
|
|
12384
|
-
return null;
|
|
12385
|
-
if (typeof programStageRef === 'string' && programStageRef.trim()) {
|
|
12386
|
-
return programStageRef.trim();
|
|
12387
|
-
}
|
|
12388
|
-
const candidateId = programStageRef.id ??
|
|
12389
|
-
programStageRef.stageId ??
|
|
12390
|
-
programStageRef.programStageId ??
|
|
12391
|
-
programStageRef.value?.id ??
|
|
12392
|
-
null;
|
|
12393
|
-
return typeof candidateId === 'string' && candidateId.trim()
|
|
12394
|
-
? candidateId.trim()
|
|
12395
|
-
: null;
|
|
12396
|
-
}
|
|
12397
|
-
#findStageById(programStageId) {
|
|
12398
|
-
return ((this.program.programStages ?? []).find((stage) => stage?.id === programStageId) ?? null);
|
|
12399
|
-
}
|
|
12400
|
-
// ---------------------------
|
|
12401
|
-
// Extension hooks
|
|
12402
|
-
// ---------------------------
|
|
12403
|
-
#getAutoAssignedValue(field) {
|
|
12404
|
-
const impl = this?.['#getAutoAssignedValue'];
|
|
12405
|
-
return typeof impl === 'function' ? impl.call(this, field) : undefined;
|
|
12406
|
-
}
|
|
12407
|
-
#getDisabledStatus(field) {
|
|
12408
|
-
const impl = this?.['#getDisabledStatus'];
|
|
12409
|
-
return typeof impl === 'function' ? impl.call(this, field) : false;
|
|
12410
|
-
}
|
|
12411
|
-
}
|
|
12412
|
-
|
|
12413
12227
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
12414
12228
|
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
12415
12229
|
// Copyright 2025 UDSM DHIS2 Lab. All rights reserved.
|
|
@@ -12724,6 +12538,195 @@ class ProgramEntryFormSectionUtil {
|
|
|
12724
12538
|
}
|
|
12725
12539
|
}
|
|
12726
12540
|
|
|
12541
|
+
// Copyright 2025 UDSM DHIS2 Lab. All rights reserved.
|
|
12542
|
+
// Use of this source code is governed by a BSD-style
|
|
12543
|
+
// license that can be found in the LICENSE file.
|
|
12544
|
+
class ProgramStageEntryFormSection {
|
|
12545
|
+
constructor(props) {
|
|
12546
|
+
this.formFields = [];
|
|
12547
|
+
this.orientation = 'HORIZONTAL';
|
|
12548
|
+
Object.assign(this, props);
|
|
12549
|
+
}
|
|
12550
|
+
}
|
|
12551
|
+
|
|
12552
|
+
class ProgramStageEntryFormSectionUtil {
|
|
12553
|
+
#sortedCanonicalStageFieldsCache = null;
|
|
12554
|
+
constructor(program, config) {
|
|
12555
|
+
this.program = program;
|
|
12556
|
+
this.config = config;
|
|
12557
|
+
this.fieldUtil = new ProgramEntryFormFieldUtil(program, config);
|
|
12558
|
+
}
|
|
12559
|
+
get programStageEntryFormSections() {
|
|
12560
|
+
const programStageId = this.#getStageIdFromConfig();
|
|
12561
|
+
if (!programStageId)
|
|
12562
|
+
return [];
|
|
12563
|
+
const programStage = this.#findStageById(programStageId);
|
|
12564
|
+
if (!programStage)
|
|
12565
|
+
return [];
|
|
12566
|
+
const sections = [];
|
|
12567
|
+
const basicDetailsFields = this.fieldUtil.eventReportFields;
|
|
12568
|
+
if (basicDetailsFields?.length) {
|
|
12569
|
+
sections.push(new ProgramStageEntryFormSection({
|
|
12570
|
+
id: `${programStage.id}_basic_information`,
|
|
12571
|
+
name: 'Basic Information',
|
|
12572
|
+
description: programStage.description ?? '',
|
|
12573
|
+
formFields: basicDetailsFields,
|
|
12574
|
+
orientation: 'VERTICAL',
|
|
12575
|
+
}));
|
|
12576
|
+
}
|
|
12577
|
+
const canonicalFieldsByDataElementId = this.#buildCanonicalStageFieldsByDataElementId(programStage);
|
|
12578
|
+
const programStageSections = programStage.programStageSections ?? [];
|
|
12579
|
+
for (const programStageSection of programStageSections) {
|
|
12580
|
+
const sectionFields = this.#mapStageSectionToFields(programStageSection, canonicalFieldsByDataElementId);
|
|
12581
|
+
if (!sectionFields.length)
|
|
12582
|
+
continue;
|
|
12583
|
+
sections.push(new ProgramStageEntryFormSection({
|
|
12584
|
+
id: programStageSection.id,
|
|
12585
|
+
name: programStageSection.displayName ?? programStageSection.name ?? '',
|
|
12586
|
+
description: programStageSection.description ?? '',
|
|
12587
|
+
formFields: sectionFields,
|
|
12588
|
+
orientation: 'HORIZONTAL',
|
|
12589
|
+
}));
|
|
12590
|
+
}
|
|
12591
|
+
return sections;
|
|
12592
|
+
}
|
|
12593
|
+
// ---------------------------
|
|
12594
|
+
// Canonical stage fields
|
|
12595
|
+
// ---------------------------
|
|
12596
|
+
#buildCanonicalStageFieldsByDataElementId(programStage) {
|
|
12597
|
+
const programStageDataElements = programStage.programStageDataElements ?? [];
|
|
12598
|
+
const fieldsByDataElementId = new Map();
|
|
12599
|
+
for (let i = 0; i < programStageDataElements.length; i++) {
|
|
12600
|
+
const programStageDataElement = programStageDataElements[i];
|
|
12601
|
+
const canonicalField = this.#mapProgramStageDataElementToField(programStageDataElement, programStage.id);
|
|
12602
|
+
if (!canonicalField?.id)
|
|
12603
|
+
continue;
|
|
12604
|
+
fieldsByDataElementId.set(canonicalField.id, canonicalField);
|
|
12605
|
+
}
|
|
12606
|
+
this.#sortedCanonicalStageFieldsCache = null;
|
|
12607
|
+
return fieldsByDataElementId;
|
|
12608
|
+
}
|
|
12609
|
+
// ---------------------------
|
|
12610
|
+
// Map a stage section using canonical fields (like program sections)
|
|
12611
|
+
// ---------------------------
|
|
12612
|
+
#mapStageSectionToFields(programStageSection, canonicalFieldsByDataElementId) {
|
|
12613
|
+
const sectionDataElements = programStageSection.dataElements;
|
|
12614
|
+
const sectionDataElementIdsFromAlt = programStageSection?.dataElementsIds ??
|
|
12615
|
+
undefined;
|
|
12616
|
+
const sectionDataElementIds = (sectionDataElements?.length
|
|
12617
|
+
? sectionDataElements.map((d) => d?.id).filter(Boolean)
|
|
12618
|
+
: sectionDataElementIdsFromAlt?.filter(Boolean)) ?? [];
|
|
12619
|
+
if (sectionDataElementIds.length > 0) {
|
|
12620
|
+
const sectionFields = [];
|
|
12621
|
+
for (let index = 0; index < sectionDataElementIds.length; index++) {
|
|
12622
|
+
const dataElementId = sectionDataElementIds[index];
|
|
12623
|
+
const canonicalField = canonicalFieldsByDataElementId.get(dataElementId);
|
|
12624
|
+
if (!canonicalField)
|
|
12625
|
+
continue;
|
|
12626
|
+
sectionFields.push({
|
|
12627
|
+
...canonicalField,
|
|
12628
|
+
order: index + 1,
|
|
12629
|
+
});
|
|
12630
|
+
}
|
|
12631
|
+
return sectionFields;
|
|
12632
|
+
}
|
|
12633
|
+
return this.#getSortedCanonicalStageFields(canonicalFieldsByDataElementId);
|
|
12634
|
+
}
|
|
12635
|
+
#getSortedCanonicalStageFields(canonicalFieldsByDataElementId) {
|
|
12636
|
+
const cache = this.#sortedCanonicalStageFieldsCache;
|
|
12637
|
+
if (cache?.sourceMap === canonicalFieldsByDataElementId) {
|
|
12638
|
+
return cache.sortedFields;
|
|
12639
|
+
}
|
|
12640
|
+
const sortedFields = Array.from(canonicalFieldsByDataElementId.values());
|
|
12641
|
+
sortedFields.sort((a, b) => (a.order ?? 0) - (b.order ?? 0));
|
|
12642
|
+
this.#sortedCanonicalStageFieldsCache = {
|
|
12643
|
+
sourceMap: canonicalFieldsByDataElementId,
|
|
12644
|
+
sortedFields,
|
|
12645
|
+
};
|
|
12646
|
+
return sortedFields;
|
|
12647
|
+
}
|
|
12648
|
+
// ---------------------------
|
|
12649
|
+
// Map a programStageDataElement => canonical form field
|
|
12650
|
+
// ---------------------------
|
|
12651
|
+
#mapProgramStageDataElementToField(programStageDataElement, programStageId) {
|
|
12652
|
+
const dataElementDefinition = programStageDataElement?.dataElement;
|
|
12653
|
+
if (!dataElementDefinition?.id)
|
|
12654
|
+
return null;
|
|
12655
|
+
const fieldBaseConfig = {
|
|
12656
|
+
id: dataElementDefinition.id,
|
|
12657
|
+
code: dataElementDefinition.code,
|
|
12658
|
+
formName: dataElementDefinition.formName,
|
|
12659
|
+
name: dataElementDefinition.displayName ?? dataElementDefinition.name ?? '',
|
|
12660
|
+
description: dataElementDefinition.description,
|
|
12661
|
+
mandatory: !!programStageDataElement.compulsory,
|
|
12662
|
+
valueType: dataElementDefinition.valueType,
|
|
12663
|
+
sortOrder: programStageDataElement.sortOrder,
|
|
12664
|
+
stepId: programStageId,
|
|
12665
|
+
allowFutureDate: programStageDataElement.allowFutureDate,
|
|
12666
|
+
optionSet: dataElementDefinition.optionSet,
|
|
12667
|
+
};
|
|
12668
|
+
const dropdownOptions = FieldDropdown.getDropdownOptions(fieldBaseConfig);
|
|
12669
|
+
const hasSelectableOptions = (dropdownOptions?.length ?? 0) > 0;
|
|
12670
|
+
const fieldExtension = this.config.formFieldExtensions?.find((extension) => extension?.id === fieldBaseConfig.id);
|
|
12671
|
+
const autoAssignedValue = this.#getAutoAssignedValue(fieldBaseConfig);
|
|
12672
|
+
if (!isUndefined(autoAssignedValue) &&
|
|
12673
|
+
this.config.hideCustomAssignedFields) {
|
|
12674
|
+
return null;
|
|
12675
|
+
}
|
|
12676
|
+
return new FormField({
|
|
12677
|
+
...fieldBaseConfig,
|
|
12678
|
+
label: fieldBaseConfig.formName || fieldBaseConfig.name,
|
|
12679
|
+
key: fieldBaseConfig.code
|
|
12680
|
+
? camelCase(fieldBaseConfig.code)
|
|
12681
|
+
: fieldBaseConfig.id,
|
|
12682
|
+
required: fieldBaseConfig.mandatory,
|
|
12683
|
+
type: FieldUtil.getFieldType(fieldBaseConfig.valueType),
|
|
12684
|
+
options: dropdownOptions,
|
|
12685
|
+
disabled: this.#getDisabledStatus(fieldBaseConfig),
|
|
12686
|
+
order: fieldBaseConfig.sortOrder,
|
|
12687
|
+
hasOptions: hasSelectableOptions,
|
|
12688
|
+
controlType: FieldUtil.getFieldControlType(fieldBaseConfig.valueType, hasSelectableOptions),
|
|
12689
|
+
extension: fieldExtension,
|
|
12690
|
+
});
|
|
12691
|
+
}
|
|
12692
|
+
// ---------------------------
|
|
12693
|
+
// Stage selection helpers
|
|
12694
|
+
// ---------------------------
|
|
12695
|
+
#getStageIdFromConfig() {
|
|
12696
|
+
const programStageRef = this.config?.programStage;
|
|
12697
|
+
if (!programStageRef)
|
|
12698
|
+
return null;
|
|
12699
|
+
if (typeof programStageRef === 'string' && programStageRef.trim()) {
|
|
12700
|
+
return programStageRef.trim();
|
|
12701
|
+
}
|
|
12702
|
+
const candidateId = programStageRef.id ??
|
|
12703
|
+
programStageRef.stageId ??
|
|
12704
|
+
programStageRef.programStageId ??
|
|
12705
|
+
programStageRef.value?.id ??
|
|
12706
|
+
null;
|
|
12707
|
+
return typeof candidateId === 'string' && candidateId.trim()
|
|
12708
|
+
? candidateId.trim()
|
|
12709
|
+
: null;
|
|
12710
|
+
}
|
|
12711
|
+
#findStageById(programStageId) {
|
|
12712
|
+
return ((this.program.programStages ?? []).find((stage) => stage?.id === programStageId) ?? null);
|
|
12713
|
+
}
|
|
12714
|
+
// ---------------------------
|
|
12715
|
+
// Extension hooks
|
|
12716
|
+
// ---------------------------
|
|
12717
|
+
#getAutoAssignedValue(field) {
|
|
12718
|
+
const impl = this?.['#getAutoAssignedValue'];
|
|
12719
|
+
return typeof impl === 'function' ? impl.call(this, field) : undefined;
|
|
12720
|
+
}
|
|
12721
|
+
#getDisabledStatus(field) {
|
|
12722
|
+
if (this.config?.disableForm) {
|
|
12723
|
+
return true;
|
|
12724
|
+
}
|
|
12725
|
+
const impl = this?.['#getDisabledStatus'];
|
|
12726
|
+
return typeof impl === 'function' ? impl.call(this, field) : false;
|
|
12727
|
+
}
|
|
12728
|
+
}
|
|
12729
|
+
|
|
12727
12730
|
// Copyright 2025 UDSM DHIS2 Lab. All rights reserved.
|
|
12728
12731
|
// Use of this source code is governed by a BSD-style
|
|
12729
12732
|
// license that can be found in the LICENSE file.
|
|
@@ -12761,6 +12764,9 @@ class ProgramEntryFormMetaData {
|
|
|
12761
12764
|
return this.autoAssignedFieldIdSet;
|
|
12762
12765
|
}
|
|
12763
12766
|
shouldDisableField(field) {
|
|
12767
|
+
if (this.config?.disableForm) {
|
|
12768
|
+
return true;
|
|
12769
|
+
}
|
|
12764
12770
|
const fieldIdentifiers = this.getFieldIdentifiers(field);
|
|
12765
12771
|
if (!fieldIdentifiers.length) {
|
|
12766
12772
|
return false;
|
|
@@ -12801,96 +12807,36 @@ class ProgramEntryFormMetaData {
|
|
|
12801
12807
|
.with(this.d2.programModule.trackedEntityTypeAttribute.select([
|
|
12802
12808
|
'trackedEntityAttribute',
|
|
12803
12809
|
])), 'ToOne')
|
|
12804
|
-
.with(this
|
|
12805
|
-
.
|
|
12806
|
-
|
|
12807
|
-
|
|
12808
|
-
|
|
12809
|
-
|
|
12810
|
+
.with(this.#getProgramRuleVariableQuery())
|
|
12811
|
+
.byId(program);
|
|
12812
|
+
// if (!this.config.programStage) {
|
|
12813
|
+
programQuery.with(this.#getProgramTrackedEntityAttributeQuery());
|
|
12814
|
+
// }
|
|
12815
|
+
// if (this.config.displayType === 'FLAT') {
|
|
12816
|
+
programQuery.with(this.#getProgramSectionQuery());
|
|
12817
|
+
// }
|
|
12818
|
+
programQuery.with(this.#getProgramStageQuery());
|
|
12819
|
+
return programQuery.get({ useIndexDb: true });
|
|
12820
|
+
}
|
|
12821
|
+
#getProgramRuleVariableQuery() {
|
|
12822
|
+
return this.d2.programModule.programRuleVariable
|
|
12823
|
+
.with(this.d2.dataElementModule.dataElement.select(['id', 'code', 'name']), 'ToOne')
|
|
12810
12824
|
.with(this.d2.programModule.trackedEntityAttribute.select([
|
|
12811
12825
|
'id',
|
|
12812
12826
|
'code',
|
|
12813
12827
|
'name',
|
|
12814
|
-
]), 'ToOne')
|
|
12815
|
-
.byId(program);
|
|
12816
|
-
if (!this.config.programStage) {
|
|
12817
|
-
programQuery.with(this.d2.programModule.programTrackedEntityAttribute.with(this.d2.programModule.trackedEntityAttribute.with(this.d2.optionSetModule.optionSet.with(this.d2.optionSetModule.option), 'ToOne'), 'ToOne'));
|
|
12818
|
-
}
|
|
12819
|
-
if (this.config.displayType === 'FLAT') {
|
|
12820
|
-
programQuery.with(this.d2.programModule.programSection.with(this.d2.programModule.trackedEntityAttribute.select(['id'])));
|
|
12821
|
-
}
|
|
12822
|
-
if (!this.config.excludeProgramStages || this.config.programStage) {
|
|
12823
|
-
const programStageQuery = this.d2.programModule.programStage
|
|
12824
|
-
.with(this.d2.programModule.programStageSection)
|
|
12825
|
-
.with(this.d2.programModule.programStageDataElement.with(this.d2.dataElementModule.dataElement.with(this.d2.optionSetModule.optionSet.with(this.d2.optionSetModule.option), 'ToOne'), 'ToOne'));
|
|
12826
|
-
programQuery.with(programStageQuery);
|
|
12827
|
-
}
|
|
12828
|
-
return programQuery.get({ useIndexDb: true });
|
|
12828
|
+
]), 'ToOne');
|
|
12829
12829
|
}
|
|
12830
|
-
|
|
12831
|
-
|
|
12832
|
-
|
|
12833
|
-
|
|
12834
|
-
|
|
12835
|
-
|
|
12836
|
-
|
|
12837
|
-
|
|
12838
|
-
|
|
12839
|
-
|
|
12840
|
-
value: program,
|
|
12841
|
-
})
|
|
12842
|
-
.with(this.d2.programModule.programRuleAction
|
|
12843
|
-
.select([
|
|
12844
|
-
'id',
|
|
12845
|
-
'programRuleActionType',
|
|
12846
|
-
'data',
|
|
12847
|
-
'programRule',
|
|
12848
|
-
'displayContent',
|
|
12849
|
-
'content',
|
|
12850
|
-
])
|
|
12851
|
-
.with(this.d2.dataElementModule.dataElement.select([
|
|
12852
|
-
'id',
|
|
12853
|
-
'code',
|
|
12854
|
-
'name',
|
|
12855
|
-
'description',
|
|
12856
|
-
]), 'ToOne')
|
|
12857
|
-
.with(this.d2.programModule.trackedEntityAttribute.select([
|
|
12858
|
-
'id',
|
|
12859
|
-
'code',
|
|
12860
|
-
'name',
|
|
12861
|
-
'description',
|
|
12862
|
-
]), 'ToOne')
|
|
12863
|
-
.with(this.d2.programModule.programSection.select([
|
|
12864
|
-
'id',
|
|
12865
|
-
'code',
|
|
12866
|
-
'name',
|
|
12867
|
-
'description',
|
|
12868
|
-
]), 'ToOne')
|
|
12869
|
-
.with(this.d2.programModule.programStageSection.select([
|
|
12870
|
-
'id',
|
|
12871
|
-
'code',
|
|
12872
|
-
'name',
|
|
12873
|
-
'description',
|
|
12874
|
-
]), 'ToOne')
|
|
12875
|
-
.with(this.d2.optionSetModule.optionGroup
|
|
12876
|
-
.select(['id'])
|
|
12877
|
-
.with(this.d2.optionSetModule.option.select([
|
|
12878
|
-
'id',
|
|
12879
|
-
'code',
|
|
12880
|
-
'displayName',
|
|
12881
|
-
]), 'ToMany'), 'ToOne')
|
|
12882
|
-
.with(this.d2.optionSetModule.option.select([
|
|
12883
|
-
'id',
|
|
12884
|
-
'code',
|
|
12885
|
-
'displayName',
|
|
12886
|
-
]), 'ToOne'))
|
|
12887
|
-
.paginate(new Pager({ paging: false }))
|
|
12888
|
-
.get({ useIndexDb: true }),
|
|
12889
|
-
]);
|
|
12890
|
-
const [programResponse, programRuleResponse] = metaDataResponse;
|
|
12891
|
-
const metaData = programResponse.data;
|
|
12892
|
-
metaData.programRules = programRuleResponse.data;
|
|
12893
|
-
return metaData;
|
|
12830
|
+
#getProgramSectionQuery() {
|
|
12831
|
+
return this.d2.programModule.programSection.with(this.d2.programModule.trackedEntityAttribute.select(['id']));
|
|
12832
|
+
}
|
|
12833
|
+
#getProgramTrackedEntityAttributeQuery() {
|
|
12834
|
+
return this.d2.programModule.programTrackedEntityAttribute.with(this.d2.programModule.trackedEntityAttribute.with(this.d2.optionSetModule.optionSet.with(this.d2.optionSetModule.option), 'ToOne'), 'ToOne');
|
|
12835
|
+
}
|
|
12836
|
+
#getProgramStageQuery() {
|
|
12837
|
+
return this.d2.programModule.programStage
|
|
12838
|
+
.with(this.d2.programModule.programStageSection)
|
|
12839
|
+
.with(this.d2.programModule.programStageDataElement.with(this.d2.dataElementModule.dataElement.with(this.d2.optionSetModule.optionSet.with(this.d2.optionSetModule.option), 'ToOne'), 'ToOne'));
|
|
12894
12840
|
}
|
|
12895
12841
|
get formFields() {
|
|
12896
12842
|
if (!this.program) {
|
|
@@ -12902,7 +12848,11 @@ class ProgramEntryFormMetaData {
|
|
|
12902
12848
|
if (!autoAssigned?.length) {
|
|
12903
12849
|
return fields;
|
|
12904
12850
|
}
|
|
12905
|
-
return fields.map((field) =>
|
|
12851
|
+
return fields.map((field) => {
|
|
12852
|
+
return this.shouldDisableField(field)
|
|
12853
|
+
? this.withDisabledFlags(field)
|
|
12854
|
+
: field;
|
|
12855
|
+
});
|
|
12906
12856
|
}
|
|
12907
12857
|
// get sections(): IProgramEntryFormSection[] {
|
|
12908
12858
|
// if (!this.program) {
|
|
@@ -13029,7 +12979,7 @@ class ProgramEntryFormMetaData {
|
|
|
13029
12979
|
}
|
|
13030
12980
|
async #getCustomFieldConfigurations() {
|
|
13031
12981
|
try {
|
|
13032
|
-
const response = await this.d2.httpInstance.get('dataStore/field-extensions?fields=id,fieldOptionsDependsOn,optionSet&paging=false');
|
|
12982
|
+
const response = await this.d2.httpInstance.get('dataStore/field-extensions?fields=id,fieldOptionsDependsOn,optionSet&paging=false', { useIndexDb: true });
|
|
13033
12983
|
const responseData = response?.data;
|
|
13034
12984
|
const entries = Array.isArray(responseData)
|
|
13035
12985
|
? responseData
|
|
@@ -13053,15 +13003,18 @@ class ProgramEntryFormMetaData {
|
|
|
13053
13003
|
}
|
|
13054
13004
|
async get() {
|
|
13055
13005
|
try {
|
|
13056
|
-
const program = await
|
|
13006
|
+
const program = await window?.d2Web?.trackerModule?.trackedEntity
|
|
13007
|
+
?.setProgram(this.config?.program)
|
|
13008
|
+
?.getMetaData();
|
|
13057
13009
|
if (program) {
|
|
13058
13010
|
this.program = program;
|
|
13059
|
-
|
|
13060
|
-
|
|
13011
|
+
// TODO FIND ANOTHER WAY TO PASS IN CUSTOM FIELD CONFIGURATIONS, AVOID TIGHT COUPLING HERE
|
|
13012
|
+
// this.customFieldConfigurations =
|
|
13013
|
+
// await this.#getCustomFieldConfigurations();
|
|
13061
13014
|
if (this.config?.formFieldExtensions &&
|
|
13062
13015
|
this.config.formFieldExtensions.length > 0 &&
|
|
13063
13016
|
this.config.formFieldExtensions[0]?.optionsSourceCode) {
|
|
13064
|
-
const orgUnitResponse = await this.d2.httpInstance.get(`organisationUnits.json?fields=id,name,code&paging=false&filter=organisationUnitGroups.code:eq:${this.config.formFieldExtensions[0].optionsSourceCode}
|
|
13017
|
+
const orgUnitResponse = await this.d2.httpInstance.get(`organisationUnits.json?fields=id,name,code&paging=false&filter=organisationUnitGroups.code:eq:${this.config.formFieldExtensions[0].optionsSourceCode}`);
|
|
13065
13018
|
const orgUnitsResponse = orgUnitResponse?.data?.['organisationUnits'];
|
|
13066
13019
|
const organisationUnits = Array.isArray(orgUnitsResponse)
|
|
13067
13020
|
? orgUnitsResponse
|
|
@@ -13115,6 +13068,8 @@ class ProgramEntryFormModule {
|
|
|
13115
13068
|
this.isFormValid$ = toObservable(this.isFormValid);
|
|
13116
13069
|
this.instance = signal(null, /* @ts-ignore */
|
|
13117
13070
|
...(ngDevMode ? [{ debugName: "instance" }] : /* istanbul ignore next */ []));
|
|
13071
|
+
this.trackedEntityInstance = signal(null, /* @ts-ignore */
|
|
13072
|
+
...(ngDevMode ? [{ debugName: "trackedEntityInstance" }] : /* istanbul ignore next */ []));
|
|
13118
13073
|
this.preprocess = input(/* @ts-ignore */
|
|
13119
13074
|
...(ngDevMode ? [undefined, { debugName: "preprocess" }] : /* istanbul ignore next */ []));
|
|
13120
13075
|
this.instanceSave = new EventEmitter();
|
|
@@ -13135,6 +13090,16 @@ class ProgramEntryFormModule {
|
|
|
13135
13090
|
return undefined;
|
|
13136
13091
|
}, /* @ts-ignore */
|
|
13137
13092
|
...(ngDevMode ? [{ debugName: "dataId" }] : /* istanbul ignore next */ []));
|
|
13093
|
+
this.dataEntities = computed(() => {
|
|
13094
|
+
if (!this.instance()) {
|
|
13095
|
+
return {};
|
|
13096
|
+
}
|
|
13097
|
+
return {
|
|
13098
|
+
...(this.trackedEntityInstance() || {}),
|
|
13099
|
+
...(this.instance() || {}),
|
|
13100
|
+
};
|
|
13101
|
+
}, /* @ts-ignore */
|
|
13102
|
+
...(ngDevMode ? [{ debugName: "dataEntities" }] : /* istanbul ignore next */ []));
|
|
13138
13103
|
this.FormActionButtons = computed(() => {
|
|
13139
13104
|
if (this.config().hideActionButtons) {
|
|
13140
13105
|
return React__default.createElement(React__default.Fragment, null);
|
|
@@ -13159,7 +13124,7 @@ class ProgramEntryFormModule {
|
|
|
13159
13124
|
});
|
|
13160
13125
|
};
|
|
13161
13126
|
return (React__default.createElement(ButtonStrip$1, null,
|
|
13162
|
-
!this.config().hideSubmitButton && (React__default.createElement(Button$1, { primary: true, disabled: !isValid, loading: submitting, onClick: onSave }, this.config().submitButtonLabel)),
|
|
13127
|
+
!(this.config().hideSubmitButton || this.config().disableForm) && (React__default.createElement(Button$1, { primary: true, disabled: !isValid, loading: submitting, onClick: onSave }, this.config().submitButtonLabel)),
|
|
13163
13128
|
!this.config().hideCancelButton && (React__default.createElement(Button$1, { onClick: () => {
|
|
13164
13129
|
this.ngZone.run(() => {
|
|
13165
13130
|
this.onCancel();
|
|
@@ -13169,27 +13134,6 @@ class ProgramEntryFormModule {
|
|
|
13169
13134
|
}, /* @ts-ignore */
|
|
13170
13135
|
...(ngDevMode ? [{ debugName: "FormActionButtons" }] : /* istanbul ignore next */ []));
|
|
13171
13136
|
}
|
|
13172
|
-
// async ngOnInit() {
|
|
13173
|
-
// this.loading.set(true);
|
|
13174
|
-
// try {
|
|
13175
|
-
// // Loading metadata
|
|
13176
|
-
// const metaData = await new ProgramEntryFormMetaData()
|
|
13177
|
-
// .setConfig(this.config())
|
|
13178
|
-
// .get();
|
|
13179
|
-
// this.metaData.set(metaData);
|
|
13180
|
-
// // Load initial instance information
|
|
13181
|
-
// const instance = await this.#getInstance();
|
|
13182
|
-
// this.instance.set(instance);
|
|
13183
|
-
// if (this.config().autoAssignedValues) {
|
|
13184
|
-
// this.#updateInstanceWithAutoAssignedValues(
|
|
13185
|
-
// this.config().autoAssignedValues || []
|
|
13186
|
-
// );
|
|
13187
|
-
// }
|
|
13188
|
-
// this.loading.set(false);
|
|
13189
|
-
// } catch (err) {
|
|
13190
|
-
// this.loading.set(false);
|
|
13191
|
-
// }
|
|
13192
|
-
// }
|
|
13193
13137
|
async ngOnInit() {
|
|
13194
13138
|
this.loading.set(true);
|
|
13195
13139
|
try {
|
|
@@ -13392,22 +13336,24 @@ class ProgramEntryFormModule {
|
|
|
13392
13336
|
return instance;
|
|
13393
13337
|
}
|
|
13394
13338
|
async #getTrackerInstance() {
|
|
13395
|
-
|
|
13396
|
-
|
|
13397
|
-
|
|
13339
|
+
const d2 = window.d2Web;
|
|
13340
|
+
this.instanceQuery = d2?.trackerModule?.trackedEntity
|
|
13341
|
+
?.setProgram(this.config().program)
|
|
13342
|
+
?.setOrgUnit(this.orgUnit());
|
|
13343
|
+
if (!this.instanceQuery) {
|
|
13344
|
+
throw new Error('Could not initialize tracker query');
|
|
13345
|
+
}
|
|
13398
13346
|
if (!this.trackedEntity()) {
|
|
13399
|
-
|
|
13400
|
-
return await this.#setReservedValuesForCodeGeneration(instance);
|
|
13347
|
+
return await this.instanceQuery.create();
|
|
13401
13348
|
}
|
|
13402
13349
|
const instanceResult = (await this.instanceQuery
|
|
13403
13350
|
.setTrackedEntity(this.trackedEntity())
|
|
13404
13351
|
.get()).data;
|
|
13405
13352
|
if (!instanceResult) {
|
|
13406
|
-
|
|
13407
|
-
return await this.#setReservedValuesForCodeGeneration(instance);
|
|
13353
|
+
return await this.instanceQuery.create();
|
|
13408
13354
|
}
|
|
13409
13355
|
this.instanceQuery.setInstanceFields(this.metaData()?.program);
|
|
13410
|
-
const instance = await this
|
|
13356
|
+
const instance = await this.instanceQuery.setReservedValues();
|
|
13411
13357
|
if (this.orgUnit()) {
|
|
13412
13358
|
instance.setOrgUnit(this.orgUnit());
|
|
13413
13359
|
}
|
|
@@ -13432,22 +13378,27 @@ class ProgramEntryFormModule {
|
|
|
13432
13378
|
}
|
|
13433
13379
|
return instance;
|
|
13434
13380
|
}
|
|
13435
|
-
#getInstance() {
|
|
13381
|
+
async #getInstance() {
|
|
13436
13382
|
switch (this.config().formType) {
|
|
13437
13383
|
case 'TRACKER':
|
|
13438
13384
|
return this.#getTrackerInstance();
|
|
13439
|
-
case 'EVENT':
|
|
13385
|
+
case 'EVENT': {
|
|
13386
|
+
if (this.trackedEntity()) {
|
|
13387
|
+
const trackedEntityInstance = await this.#getTrackerInstance();
|
|
13388
|
+
this.trackedEntityInstance.set(trackedEntityInstance);
|
|
13389
|
+
}
|
|
13440
13390
|
return this.#getEventInstance();
|
|
13391
|
+
}
|
|
13441
13392
|
default:
|
|
13442
13393
|
return firstValueFrom(of(null));
|
|
13443
13394
|
}
|
|
13444
13395
|
}
|
|
13445
13396
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: ProgramEntryFormModule, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
13446
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.8", 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
|
|
13397
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.8", 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]=\"dataEntities()\"\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: 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"] }], changeDetection: i0.ChangeDetectionStrategy.Eager }); }
|
|
13447
13398
|
}
|
|
13448
13399
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: ProgramEntryFormModule, decorators: [{
|
|
13449
13400
|
type: Component,
|
|
13450
|
-
args: [{ selector: 'ng-dhis2-ui-program-entry-form', changeDetection: ChangeDetectionStrategy.Eager, imports: [D2FormModule, ReactWrapperModule], 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
|
|
13401
|
+
args: [{ selector: 'ng-dhis2-ui-program-entry-form', changeDetection: ChangeDetectionStrategy.Eager, imports: [D2FormModule, ReactWrapperModule], 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]=\"dataEntities()\"\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"] }]
|
|
13451
13402
|
}], propDecorators: { config: [{ type: i0.Input, args: [{ isSignal: true, alias: "config", required: true }] }], trackedEntity: [{ type: i0.Input, args: [{ isSignal: true, alias: "trackedEntity", required: false }] }], event: [{ type: i0.Input, args: [{ isSignal: true, alias: "event", required: false }] }], enrollment: [{ type: i0.Input, args: [{ isSignal: true, alias: "enrollment", required: false }] }], orgUnit: [{ type: i0.Input, args: [{ isSignal: true, alias: "orgUnit", required: false }] }], codeGeneratorOrgUnit: [{ type: i0.Input, args: [{ isSignal: true, alias: "codeGeneratorOrgUnit", required: false }] }], customOrgUnitRoots: [{ type: i0.Input, args: [{ isSignal: true, alias: "customOrgUnitRoots", required: false }] }], formMetaData: [{ type: i0.Input, args: [{ isSignal: true, alias: "formMetaData", required: false }] }], collapsibleSections: [{ type: i0.Input, args: [{ isSignal: true, alias: "collapsibleSections", required: false }] }], preprocess: [{ type: i0.Input, args: [{ isSignal: true, alias: "preprocess", required: false }] }], instanceSave: [{
|
|
13452
13403
|
type: Output
|
|
13453
13404
|
}], instanceSaveCompleted: [{
|