@eqproject/eqp-dynamic-module 2.7.18 → 2.7.20

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,35 @@ 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;
4455
+ this.relationsLoaded = true;
4429
4456
  }
4430
- this.relationsLoaded = true;
4431
4457
  }
4432
4458
  else {
4433
4459
  if (this.data == null) {
@@ -4440,6 +4466,10 @@ class DbgetterComponent {
4440
4466
  }
4441
4467
  }
4442
4468
  }
4469
+ checkRelations() {
4470
+ this.relationsLoaded = this.relations.find(x => x.loaded) != null;
4471
+ console.log("RELATIONS LOADED?", this.relationsLoaded);
4472
+ }
4443
4473
  onExternalSQLResultOut(ev) {
4444
4474
  if (ev.Behaviours.indexOf("send-out") != -1) {
4445
4475
  this.out.emit(ev);
@@ -4491,20 +4521,6 @@ class DbgetterComponent {
4491
4521
  }
4492
4522
  }
4493
4523
  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
4524
  this.showTable = true;
4509
4525
  this.showQE = true;
4510
4526
  }