@eqproject/eqp-dynamic-module 2.7.17 → 2.7.19

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.
@@ -4409,7 +4409,7 @@ class DbgetterComponent {
4409
4409
  this.showQE = true;
4410
4410
  this.haveQuestions = false;
4411
4411
  this.haveRelations = false;
4412
- this.relationsLoaded = false;
4412
+ this.relations = new Array();
4413
4413
  }
4414
4414
  ngOnInit() {
4415
4415
  console.log("INSIDE DBGETTER", this.form, this.record, this.field, this.QueryEditorComponent);
@@ -4425,9 +4425,34 @@ class DbgetterComponent {
4425
4425
  if (this.field.DataGetter.DataGetterValue.openedFields.find(x => x.QueryPropertyValue.indexOf('!') != -1) != null) {
4426
4426
  // Il campo ha almeno un valore con "!nomerelazione"
4427
4427
  this.haveRelations = true;
4428
+ this.field.DataGetter.DataGetterValue.openedFields.filter(x => x.QueryPropertyValue.indexOf('!') != -1).forEach((fieldWithRelation) => {
4429
+ var fieldRelated = fieldWithRelation.QueryPropertyValue.replace("!", "");
4430
+ if (this.record[fieldRelated] == null) {
4431
+ console.log("this.record[fieldRelated] E' NULL", this.field.Name, fieldRelated, this.record[fieldRelated], this.record);
4432
+ this.relations.push({ field: this.record[fieldRelated], loaded: false });
4433
+ this.checkRelations();
4434
+ this.interval = setInterval(() => {
4435
+ console.log("this.record[fieldRelated] CHECK", this.field.Name, fieldRelated, this.record[fieldRelated], this.record);
4436
+ if (this.record[fieldRelated] != null) {
4437
+ console.log("this.record[fieldRelated] E' CAMBIATO E NON E' NULL!! :)", this.field.Name, fieldRelated, this.record[fieldRelated], this.record);
4438
+ this.relations.find(x => x.field == this.record[fieldRelated]).loaded = true;
4439
+ this.checkRelations();
4440
+ fieldWithRelation.QueryPropertyValue = this.record[fieldRelated];
4441
+ }
4442
+ }, 1000);
4443
+ }
4444
+ else {
4445
+ console.log("this.record[fieldRelated] NON E' NULL!! :)", this.field.Name, fieldRelated, this.record[fieldRelated], this.record);
4446
+ fieldWithRelation.QueryPropertyValue = this.record[fieldRelated] != null ? this.record[fieldRelated] : '';
4447
+ this.relations.push({ field: this.record[fieldRelated], loaded: true });
4448
+ this.checkRelations();
4449
+ }
4450
+ this.showButtonReply = true;
4451
+ });
4452
+ }
4453
+ else {
4428
4454
  this.showButtonReply = true;
4429
4455
  }
4430
- this.relationsLoaded = true;
4431
4456
  }
4432
4457
  else {
4433
4458
  if (this.data == null) {
@@ -4440,6 +4465,10 @@ class DbgetterComponent {
4440
4465
  }
4441
4466
  }
4442
4467
  }
4468
+ checkRelations() {
4469
+ this.relationsLoaded = this.relations.find(x => x.loaded) != null;
4470
+ console.log("RELATIONS LOADED?", this.relationsLoaded);
4471
+ }
4443
4472
  onExternalSQLResultOut(ev) {
4444
4473
  if (ev.Behaviours.indexOf("send-out") != -1) {
4445
4474
  this.out.emit(ev);
@@ -4491,53 +4520,21 @@ class DbgetterComponent {
4491
4520
  }
4492
4521
  }
4493
4522
  onClickButtonReply() {
4494
- if (this.haveRelations) {
4495
- var relationLoaded = true;
4496
- this.field.DataGetter.DataGetterValue.openedFields.filter(x => x.QueryPropertyValue.indexOf('!') != -1).forEach((fieldWithRelation) => {
4497
- var fieldRelated = fieldWithRelation.QueryPropertyValue.replace("!", "");
4498
- if (this.record[fieldRelated] != null) {
4499
- console.log("this.record[fieldRelated] NON E' NULL!! :)", this.field.Name, fieldRelated, this.record[fieldRelated], this.record);
4500
- fieldWithRelation.QueryPropertyValue = this.record[fieldRelated] != null ? this.record[fieldRelated] : '';
4501
- }
4502
- else {
4503
- relationLoaded = false;
4504
- }
4505
- });
4506
- this.relationsLoaded = relationLoaded;
4507
- }
4508
4523
  this.showTable = true;
4509
4524
  this.showQE = true;
4510
4525
  }
4511
4526
  selectValue(row, value) {
4527
+ var valueToBeSet = "";
4512
4528
  if (this.field.DataGetter.DataGetterColumnForce == null) {
4513
- this.selectValueNotForced(value);
4514
- }
4515
- else {
4516
- this.selectValueForced(row);
4517
- }
4518
- }
4519
- selectValueNotForced(value) {
4520
- if (value == null) {
4521
- value = "";
4522
- this.showButtonReply = false;
4529
+ valueToBeSet = value;
4523
4530
  }
4524
4531
  else {
4525
- this.showButtonReply = true;
4532
+ valueToBeSet = row[this.field.DataGetter.DataGetterColumnForce.key];
4526
4533
  }
4527
- this.record[this.field.Name] = value;
4528
- this.showTable = false;
4529
- this.showQE = false;
4530
- this.selectedValue.emit([value, false]);
4531
- }
4532
- selectValueForced(row) {
4533
- var valueToBeSet = row[this.field.DataGetter.DataGetterColumnForce.key];
4534
4534
  if (valueToBeSet == null) {
4535
4535
  valueToBeSet = "";
4536
- this.showButtonReply = false;
4537
- }
4538
- else {
4539
- this.showButtonReply = true;
4540
4536
  }
4537
+ this.showButtonReply = true;
4541
4538
  this.record[this.field.Name] = valueToBeSet;
4542
4539
  this.showTable = false;
4543
4540
  this.showQE = false;