@eqproject/eqp-dynamic-module 2.6.25 → 2.6.27

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.
@@ -5144,7 +5144,9 @@ class AddFormRecordComponent {
5144
5144
  // Controlla e spara il trigger se necessario
5145
5145
  checkTriggers(record) {
5146
5146
  var fireTrigger = true;
5147
+ GlobalService.debugLog("checkTriggers - inside checkTriggers()", this.form.Triggers);
5147
5148
  if (this.form.Triggers != null) {
5149
+ GlobalService.debugLog("checkTriggers - have triggers in form");
5148
5150
  this.form.Triggers.forEach((trigger) => {
5149
5151
  fireTrigger = true;
5150
5152
  trigger.conditions.forEach((condition) => {
@@ -5157,45 +5159,56 @@ class AddFormRecordComponent {
5157
5159
  var recordValue = record[conditionKey];
5158
5160
  if (logicOperator == LogicOperator['='] && conditionValue != recordValue) {
5159
5161
  fireTrigger = false;
5162
+ this.logTrigger(trigger, condition, record);
5160
5163
  return;
5161
5164
  }
5162
5165
  if (logicOperator == LogicOperator['!='] && conditionValue == recordValue) {
5163
5166
  fireTrigger = false;
5167
+ this.logTrigger(trigger, condition, record);
5164
5168
  return;
5165
5169
  }
5166
5170
  if (logicOperator == LogicOperator['<'] && conditionValue <= recordValue) {
5167
5171
  fireTrigger = false;
5172
+ this.logTrigger(trigger, condition, record);
5168
5173
  return;
5169
5174
  }
5170
5175
  if (logicOperator == LogicOperator['<='] && conditionValue < recordValue) {
5171
5176
  fireTrigger = false;
5177
+ this.logTrigger(trigger, condition, record);
5172
5178
  return;
5173
5179
  }
5174
5180
  if (logicOperator == LogicOperator['>'] && conditionValue >= recordValue) {
5175
5181
  fireTrigger = false;
5182
+ this.logTrigger(trigger, condition, record);
5176
5183
  return;
5177
5184
  }
5178
5185
  if (logicOperator == LogicOperator['>='] && conditionValue > recordValue) {
5179
5186
  fireTrigger = false;
5187
+ this.logTrigger(trigger, condition, record);
5180
5188
  return;
5181
5189
  }
5182
5190
  if (logicOperator == LogicOperator['LIKE'] && recordValue.indexOf(conditionValue) == -1) {
5183
5191
  fireTrigger = false;
5192
+ this.logTrigger(trigger, condition, record);
5184
5193
  return;
5185
5194
  }
5186
5195
  if (logicOperator == LogicOperator['NOT LIKE'] && recordValue.indexOf(conditionValue) != -1) {
5187
5196
  fireTrigger = false;
5197
+ this.logTrigger(trigger, condition, record);
5188
5198
  return;
5189
5199
  }
5190
5200
  if (logicOperator == LogicOperator.Si && !recordValue) {
5191
5201
  fireTrigger = false;
5202
+ this.logTrigger(trigger, condition, record);
5192
5203
  return;
5193
5204
  }
5194
5205
  if (logicOperator == LogicOperator.No && recordValue) {
5195
5206
  fireTrigger = false;
5207
+ this.logTrigger(trigger, condition, record);
5196
5208
  return;
5197
5209
  }
5198
5210
  });
5211
+ GlobalService.debugLog("checkTriggers - fireTrigger? ", fireTrigger);
5199
5212
  if (fireTrigger) {
5200
5213
  // Il trigger va sparato. Valuto le funzioni interne
5201
5214
  var formulas = JSON.parse(JSON.stringify(trigger.formulas));
@@ -5211,11 +5224,17 @@ class AddFormRecordComponent {
5211
5224
  triggerToFire.trigger = trigger; // Il trigger
5212
5225
  triggerToFire.formulas = formulas; // Le formule inviate in input al modulo dinamico, valutate nel contesto del trigger e del record
5213
5226
  triggerToFire.userPatient = this.userID; // UserID
5227
+ GlobalService.debugLog("checkTriggers - Trigger Fired ", triggerToFire);
5214
5228
  this.fireTrigger.emit(triggerToFire);
5215
5229
  }
5216
5230
  });
5217
5231
  }
5218
5232
  }
5233
+ logTrigger(trigger, condition, record) {
5234
+ GlobalService.debugLog("checkTriggers - Condition that invalidated the trigger TRIGGER", trigger);
5235
+ GlobalService.debugLog("checkTriggers - Condition that invalidated the trigger CONDITION", condition);
5236
+ GlobalService.debugLog("checkTriggers - Condition that invalidated the trigger RECORD", record);
5237
+ }
5219
5238
  }
5220
5239
  AddFormRecordComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AddFormRecordComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: UtilityHelperService }], target: i0.ɵɵFactoryTarget.Component });
5221
5240
  AddFormRecordComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: AddFormRecordComponent, selector: "add-form-record", inputs: { configurations: "configurations", endPointConfiguration: "endPointConfiguration", userID: "userID", orgaID: "orgaID", formID: "formID", form: "form", record: "record", onlyView: "onlyView", isDuplicate: "isDuplicate", inConfig: "inConfig", showAllFields: "showAllFields", QueryEditorComponent: "QueryEditorComponent" }, outputs: { saveRecordEvent: "saveRecordEvent", afterSaveRecordEvent: "afterSaveRecordEvent", out: "out", fireTrigger: "fireTrigger" }, viewQueries: [{ propertyName: "fieldTemplate", predicate: ["fieldTemplate"], descendants: true }], ngImport: i0, template: "<ng-container *ngIf=\"loader\">\r\n\r\n <div class=\"row eqp-dynamic-module-title add-form-record-header\" *ngIf=\"showTitle\">\r\n <div class=\"col-md-12\">\r\n <span>{{form.Name}}</span>\r\n </div>\r\n </div>\r\n\r\n <form [formGroup]=\"formForm\" class=\"add-form-record-form\">\r\n\r\n <!-- VISUALIZZAZIONE SEMPLICE -->\r\n <ng-container *ngIf=\"form.FormScalarType == FormScalarTypeEnum.Semplice\" [ngTemplateOutlet]=\"fieldTemplates\"\r\n [ngTemplateOutletContext]=\"{ fields: form.Fields }\" class=\"add-form-record-semplice\">\r\n </ng-container>\r\n\r\n <!-- VISUALIZZAZIONE A STEPPER -->\r\n <mat-horizontal-stepper linear *ngIf=\"form.FormScalarType == FormScalarTypeEnum['A step']\"\r\n class=\"add-form-record-stepper\">\r\n <mat-step *ngFor=\"let group of form.FormFieldsGroups; let i = index; let first = first; let last = last\">\r\n <ng-template matStepLabel>\r\n {{group.Name}}\r\n </ng-template>\r\n\r\n <ng-container [ngTemplateOutlet]=\"fieldTemplates\"\r\n [ngTemplateOutletContext]=\"{ fields: fieldGroups[group.Name] }\">\r\n </ng-container>\r\n\r\n <div class=\"mt-2 d-flex justify-content-end add-form-record-buttons\">\r\n <button *ngIf=\"!first\" class=\"mr-2 previous\" mat-raised-button matStepperPrevious>\r\n Precedente\r\n </button>\r\n <button *ngIf=\"!last\" class=\"button-next\" color=\"primary\" mat-raised-button matStepperNext>\r\n Successivo\r\n </button>\r\n <button *ngIf=\"last && showSaveButton\" (click)=\"saveOrExitForm(false)\" class=\"button-next\"\r\n color=\"primary\" mat-raised-button>\r\n Salva\r\n </button>\r\n </div>\r\n\r\n </mat-step>\r\n </mat-horizontal-stepper>\r\n\r\n <!-- VISUALIZZAZIONE A TAB -->\r\n <mat-tab-group *ngIf=\"form.FormScalarType == FormScalarTypeEnum['In tab']\" class=\"add-form-record-tab\">\r\n <mat-tab *ngFor=\"let group of form.FormFieldsGroups\" [label]=\"group.Name\">\r\n <div class=\"mt-3\">\r\n <ng-container [ngTemplateOutlet]=\"fieldTemplates\"\r\n [ngTemplateOutletContext]=\"{ fields: fieldGroups[group.Name] }\">\r\n </ng-container>\r\n </div>\r\n </mat-tab>\r\n </mat-tab-group>\r\n\r\n <!-- VISUALIZZAZIONE AD ACCORDION -->\r\n <mat-accordion multi *ngIf=\"form.FormScalarType == FormScalarTypeEnum['In accordion']\"\r\n class=\"add-form-record-accordion\">\r\n <mat-expansion-panel *ngFor=\"let group of form.FormFieldsGroups\">\r\n <mat-expansion-panel-header>\r\n <mat-panel-title>\r\n {{group.Name}}\r\n </mat-panel-title>\r\n </mat-expansion-panel-header>\r\n\r\n <ng-container [ngTemplateOutlet]=\"fieldTemplates\"\r\n [ngTemplateOutletContext]=\"{ fields: fieldGroups[group.Name] }\">\r\n </ng-container>\r\n </mat-expansion-panel>\r\n </mat-accordion>\r\n </form>\r\n\r\n <div class=\"row mt-2 add-form-record-buttons\"\r\n *ngIf=\"(showBackButton || showSaveButton) && form.FormScalarType != FormScalarTypeEnum['A step']\">\r\n <div class=\"col-sm-12 text-right\">\r\n <button class=\"mr-2\" mat-raised-button type=\"button\" *ngIf=\"showBackButton\" (click)=\"saveOrExitForm(true)\">\r\n Annulla\r\n </button>\r\n <button class=\"mr-2\" mat-raised-button color=\"primary\" type=\"button\" *ngIf=\"showSaveButton\"\r\n (click)=\"saveOrExitForm(false)\" [disabled]=\"formForm.invalid || formForm.disabled || isSaving\">\r\n <span *ngIf=\"!isSaving\">Salva</span>\r\n <span *ngIf=\"isSaving\">Salvataggio in Corso...</span>\r\n </button>\r\n </div>\r\n </div>\r\n\r\n</ng-container>\r\n\r\n\r\n\r\n<!-- TEMPLATE PER LA VISUALIZZAZIONE DEI CAMPI DELLA FORM -->\r\n<ng-template #fieldTemplates let-fields='fields'>\r\n <div class=\"row\" *ngIf=\"formloaded\">\r\n <div class=\"mt-2\" *ngFor=\"let field of fields\"\r\n [ngClass]=\"utilityService.getFieldSyleClass(field, showAllFields)\">\r\n <dynamic-module-field-fix #fieldTemplate [field]=\"field\" [QueryEditorComponent]=\"QueryEditorComponent\" [form]=\"form\" [record]=\"record\" [endPointConfiguration]=\"endPointConfiguration\" [userID]=\"userID\" [inConfig]=\"inConfig\"\r\n (recordChange)=\"onRecordChange()\">\r\n </dynamic-module-field-fix>\r\n </div>\r\n </div>\r\n</ng-template>", styles: [".visibility_hidden{display:none}.visibility_transparent{visibility:hidden}\n"], dependencies: [{ kind: "component", type: i2.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i12.MatStep, selector: "mat-step", inputs: ["color"], exportAs: ["matStep"] }, { kind: "directive", type: i12.MatStepLabel, selector: "[matStepLabel]" }, { kind: "component", type: i12.MatStepper, selector: "mat-stepper, mat-vertical-stepper, mat-horizontal-stepper, [matStepper]", inputs: ["selectedIndex", "disableRipple", "color", "labelPosition", "headerPosition", "animationDuration"], outputs: ["animationDone"], exportAs: ["matStepper", "matVerticalStepper", "matHorizontalStepper"] }, { kind: "directive", type: i12.MatStepperNext, selector: "button[matStepperNext]", inputs: ["type"] }, { kind: "directive", type: i12.MatStepperPrevious, selector: "button[matStepperPrevious]", inputs: ["type"] }, { kind: "component", type: i4$4.MatTab, selector: "mat-tab", inputs: ["disabled"], exportAs: ["matTab"] }, { kind: "component", type: i4$4.MatTabGroup, selector: "mat-tab-group", inputs: ["color", "disableRipple", "fitInkBarToContent", "mat-stretch-tabs"], exportAs: ["matTabGroup"] }, { kind: "directive", type: i6$2.MatAccordion, selector: "mat-accordion", inputs: ["multi", "hideToggle", "displayMode", "togglePosition"], exportAs: ["matAccordion"] }, { kind: "component", type: i6$2.MatExpansionPanel, selector: "mat-expansion-panel", inputs: ["disabled", "expanded", "hideToggle", "togglePosition"], outputs: ["opened", "closed", "expandedChange", "afterExpand", "afterCollapse"], exportAs: ["matExpansionPanel"] }, { kind: "component", type: i6$2.MatExpansionPanelHeader, selector: "mat-expansion-panel-header", inputs: ["tabIndex", "expandedHeight", "collapsedHeight"] }, { kind: "directive", type: i6$2.MatExpansionPanelTitle, selector: "mat-panel-title" }, { kind: "directive", type: i5.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i5.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i5.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: DynamicModuleFieldFixComponent, selector: "dynamic-module-field-fix", inputs: ["endPointConfiguration", "field", "form", "record", "inConfig", "userID", "QueryEditorComponent"], outputs: ["recordChange", "out"] }] });
@@ -8078,6 +8097,7 @@ class EqpDynamicModuleComponent {
8078
8097
  GlobalService.debugLog("query params", dynamicModuleParams);
8079
8098
  this.utilityHelperService.RunEndPointCall(this.endPointConfiguration.Forms.GetByIDAndVersionEndPoint, dynamicModuleParams, (res) => {
8080
8099
  this.form = res;
8100
+ this.form.Triggers = JSON.parse(this.form.ObjectTriggers);
8081
8101
  GlobalService.debugLog("RES", res);
8082
8102
  // preparo i dati del record
8083
8103
  var dynamicRecordParams = [
@@ -8114,6 +8134,7 @@ class EqpDynamicModuleComponent {
8114
8134
  this.utilityHelperService.RunEndPointCall(this.endPointConfiguration.Forms.GetByIDEndPoint, dynamicModuleParams, (res) => {
8115
8135
  // console.log("success RunEndPointCall",res,this.defaultViewMode);
8116
8136
  this.form = res;
8137
+ this.form.Triggers = JSON.parse(this.form.ObjectTriggers);
8117
8138
  this.selectedRecord = null;
8118
8139
  if (this.answerToDuplicateId != null) {
8119
8140
  this.selectedRecord = this.answerToDuplicateId;