cat-qw-lib 0.43.19 → 0.43.21

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.
@@ -717,9 +717,12 @@ class BaseControlComponent {
717
717
  checkUnsavedChanges() {
718
718
  this.formStateService.selectIsFormSaved().subscribe((res) => {
719
719
  console.log("3=> isFormSaved", res);
720
- if (res === false) {
720
+ const hasChanges = JSON.stringify(this.initialRecord) !== JSON.stringify(this.record);
721
+ console.log("InitialRecord", this.initialRecord);
722
+ console.log("currentRecord", this.record);
723
+ console.log("hasChange", hasChanges);
724
+ if (res === false && hasChanges) {
721
725
  console.log("4=> if false", res);
722
- const hasChanges = JSON.stringify(this.initialRecord) !== JSON.stringify(this.record);
723
726
  if (this.formStateService && hasChanges) {
724
727
  console.log("5=> false", hasChanges);
725
728
  this.formStateService.setShowConfirmation(hasChanges);
@@ -1333,6 +1336,7 @@ class BaseFormComponent {
1333
1336
  return this.baseQuery?.getValue();
1334
1337
  }
1335
1338
  init() {
1339
+ this.formStateService.setIsFormSaved(true);
1336
1340
  this.service.initList();
1337
1341
  this.baseStore?.setRecordChange(SHARED.EMPTY);
1338
1342
  let id = this.activatedRoute ? this.activatedRoute.snapshot.params[SHARED.ID] : '';
@@ -1409,7 +1413,7 @@ class BaseFormComponent {
1409
1413
  this.baseStore?.setIsApiValidated(null);
1410
1414
  if (this.formStateService) {
1411
1415
  console.log("Update");
1412
- this.formStateService.setIsFormSaved(true);
1416
+ this.formStateService.setShowConfirmation(false);
1413
1417
  }
1414
1418
  this.onFormNavigate.emit(response);
1415
1419
  },
@@ -1428,7 +1432,7 @@ class BaseFormComponent {
1428
1432
  this.baseStore?.setIsApiValidated(null);
1429
1433
  if (this.formStateService) {
1430
1434
  console.log("Add");
1431
- this.formStateService.setIsFormSaved(true);
1435
+ this.formStateService.setShowConfirmation(true);
1432
1436
  }
1433
1437
  this.onFormNavigate.emit(response);
1434
1438
  },