@openmrs/ngx-formentry 3.2.1-pre.214 → 3.2.1-pre.224

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.
@@ -14432,8 +14432,10 @@
14432
14432
  if (node instanceof LeafNode ||
14433
14433
  (node instanceof GroupNode && node.question.extras.type === 'complex-obs')) {
14434
14434
  ___default["default"].each(obsArray, function (item) {
14435
- if (item.concept &&
14436
- item.concept.uuid === node.question.extras.questionOptions.concept) {
14435
+ var _a, _b;
14436
+ var questionId = _this.getQuestionIdFromFormFieldPath(item.formFieldPath);
14437
+ if ((questionId && questionId === ((_b = (_a = node === null || node === void 0 ? void 0 : node.question) === null || _a === void 0 ? void 0 : _a.extras) === null || _b === void 0 ? void 0 : _b.id)) ||
14438
+ (!questionId && item.concept && item.concept.uuid === node.question.extras.questionOptions.concept)) {
14437
14439
  found.push(item);
14438
14440
  }
14439
14441
  });
@@ -14570,10 +14572,25 @@
14570
14572
  }
14571
14573
  };
14572
14574
  ObsAdapterHelper.prototype.comparePath = function (first, second) {
14575
+ var _a, _b;
14573
14576
  if (!first || !second) {
14574
14577
  return -1;
14575
14578
  }
14576
- return Number(first.formFieldPath) - Number(second.formFieldPath);
14579
+ var firstNumber;
14580
+ if ((_a = first.formFieldPath) === null || _a === void 0 ? void 0 : _a.includes('~')) {
14581
+ firstNumber = first.formFieldPath.split('~', 1)[1];
14582
+ }
14583
+ else {
14584
+ firstNumber = first.formFieldPath;
14585
+ }
14586
+ var secondNumber;
14587
+ if ((_b = second.formFieldPath) === null || _b === void 0 ? void 0 : _b.includes('~')) {
14588
+ secondNumber = second.formFieldPath.split('~', 1)[1];
14589
+ }
14590
+ else {
14591
+ secondNumber = second.formFieldPath;
14592
+ }
14593
+ return Number(firstNumber) - Number(secondNumber);
14577
14594
  };
14578
14595
  ObsAdapterHelper.prototype.setNodeValue = function (node, obs) {
14579
14596
  switch (this.getObsNodeType(node)) {
@@ -14674,6 +14691,11 @@
14674
14691
  this.obsIndex++;
14675
14692
  return obs;
14676
14693
  };
14694
+ ObsAdapterHelper.prototype.getQuestionIdFromFormFieldPath = function (formFieldPath) {
14695
+ if (formFieldPath === null || formFieldPath === void 0 ? void 0 : formFieldPath.includes('~')) {
14696
+ return formFieldPath.split('~', 1)[0];
14697
+ }
14698
+ };
14677
14699
  ObsAdapterHelper.prototype.getSimpleObsPayload = function (node) {
14678
14700
  // check for empty values first
14679
14701
  if (this.isEmpty(node.control.value)) {
@@ -15770,6 +15792,7 @@
15770
15792
  return results;
15771
15793
  };
15772
15794
  EncounterAdapter.prototype.setNonFilledPayloadMembers = function (form, payload) {
15795
+ var _a;
15773
15796
  if (form.valueProcessingInfo.patientUuid) {
15774
15797
  this.setPayloadPatientUuid(payload, form.valueProcessingInfo.patientUuid);
15775
15798
  }
@@ -15779,6 +15802,9 @@
15779
15802
  if (form.valueProcessingInfo.encounterTypeUuid) {
15780
15803
  this.setPayloadEncounterTypeUuid(payload, form.valueProcessingInfo.encounterTypeUuid);
15781
15804
  }
15805
+ if (!payload.encounterDatetime) {
15806
+ this.setPayloadEncounterDate(payload, (_a = form.valueProcessingInfo.encounterDatetime) !== null && _a !== void 0 ? _a : new Date().toISOString(), form.valueProcessingInfo.utcOffset);
15807
+ }
15782
15808
  if (form.valueProcessingInfo.formUuid) {
15783
15809
  this.setPayloadFormUuid(payload, form.valueProcessingInfo.formUuid);
15784
15810
  }
@@ -15795,6 +15821,10 @@
15795
15821
  EncounterAdapter.prototype.setPayloadEncounterTypeUuid = function (payload, encounterTypeUuid) {
15796
15822
  payload['encounterType'] = encounterTypeUuid;
15797
15823
  };
15824
+ EncounterAdapter.prototype.setPayloadEncounterDate = function (payload, encounterDatetime, utcOffset) {
15825
+ var dateValue = moment__default["default"](encounterDatetime).utcOffset(utcOffset || '+0300');
15826
+ payload['encounterDatetime'] = dateValue.format();
15827
+ };
15798
15828
  EncounterAdapter.prototype.setPayloadFormUuid = function (payload, formUuid) {
15799
15829
  payload['form'] = formUuid;
15800
15830
  };