@hitsoft/e-donusum 100.1.10-Edo-Test → 100.1.12-Edo-Test

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.
@@ -7020,26 +7020,52 @@ class HitParamsIntegratorComponent {
7020
7020
  this.valid.emit(false);
7021
7021
  return;
7022
7022
  }
7023
- this.formParamsIntegrator.controls.branchId.setValue(null);
7024
7023
  this.submitButtonDisabled = true;
7025
- const request = this.paramsIntegratorDtoWithNavigationPropertiesDto
7024
+ try {
7025
+ const saved = await this.saveParamsIntegrator();
7026
+ if (!saved) {
7027
+ this.valid.emit(false);
7028
+ return;
7029
+ }
7030
+ const testResult = await this.runConnectionTest();
7031
+ this.valid.emit(testResult);
7032
+ }
7033
+ finally {
7034
+ this.submitButtonDisabled = false;
7035
+ }
7036
+ }
7037
+ saveParamsIntegrator() {
7038
+ this.formParamsIntegrator.controls.branchId.setValue(null);
7039
+ const request$ = this.paramsIntegratorDtoWithNavigationPropertiesDto
7026
7040
  ? this.service.update(this.paramsIntegratorDtoWithNavigationPropertiesDto.paramsIntegrator.id, {
7027
7041
  ...this.formParamsIntegrator.value,
7028
7042
  })
7029
7043
  : this.service.create(this.formParamsIntegrator.value);
7030
- request
7031
- .pipe(finalize$1(() => {
7032
- this.submitButtonDisabled = false;
7033
- }))
7034
- .subscribe(async () => {
7035
- await this.getParamsIntegrator(false, this.paramsIntegratorDtoWithNavigationPropertiesDto?.branch
7036
- ? this.paramsIntegratorDtoWithNavigationPropertiesDto.branch.id
7037
- : '00000000-0000-0000-0000-000000000000');
7038
- const testResult = await this.connectionTest();
7039
- this.valid.emit(testResult);
7040
- }, err => {
7041
- this.toasterService.error('eDonusum::TransactionUnsuccessful');
7042
- this.valid.emit(false);
7044
+ return new Promise((resolve) => {
7045
+ request$.subscribe(async () => {
7046
+ await this.getParamsIntegrator(false, this.paramsIntegratorDtoWithNavigationPropertiesDto?.branch
7047
+ ? this.paramsIntegratorDtoWithNavigationPropertiesDto.branch.id
7048
+ : '00000000-0000-0000-0000-000000000000');
7049
+ resolve(true);
7050
+ }, () => {
7051
+ this.toasterService.error('eDonusum::TransactionUnsuccessful');
7052
+ resolve(false);
7053
+ });
7054
+ });
7055
+ }
7056
+ async runConnectionTest() {
7057
+ const request = this.formParamsIntegrator.value;
7058
+ return await this.hitEntegratorsService.connectionTest(request).then(data => {
7059
+ if (data) {
7060
+ this.toasterService.success('eDonusum::ConnectionSuccessful');
7061
+ return true;
7062
+ }
7063
+ else {
7064
+ this.toasterService.error(data?.message);
7065
+ return false;
7066
+ }
7067
+ }).catch(() => {
7068
+ return false;
7043
7069
  });
7044
7070
  }
7045
7071
  async getParamsIntegrator(buildForm = false, branchId) {
@@ -7075,24 +7101,16 @@ class HitParamsIntegratorComponent {
7075
7101
  return false;
7076
7102
  }
7077
7103
  this.connectionTestButtonDisabled = true;
7078
- if (this.formParamsIntegrator.controls.branchId?.value == '')
7079
- this.formParamsIntegrator.controls.branchId.setValue('00000000-0000-0000-0000-000000000000');
7080
- let request = this.formParamsIntegrator.value;
7081
- return await this.hitEntegratorsService.connectionTest(request).then(data => {
7082
- this.connectionTestButtonDisabled = false;
7083
- this.submitButtonDisabled = false;
7084
- if (data) {
7085
- this.toasterService.success('eDonusum::ConnectionSuccessful');
7086
- return true;
7087
- }
7088
- else {
7089
- this.toasterService.error(data.message);
7104
+ try {
7105
+ const saved = await this.saveParamsIntegrator();
7106
+ if (!saved)
7090
7107
  return false;
7091
- }
7092
- }).finally(() => {
7108
+ return await this.runConnectionTest();
7109
+ }
7110
+ finally {
7093
7111
  this.connectionTestButtonDisabled = false;
7094
7112
  this.submitButtonDisabled = false;
7095
- });
7113
+ }
7096
7114
  }
7097
7115
  }
7098
7116
  HitParamsIntegratorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: HitParamsIntegratorComponent, deps: [{ token: i1.ListService }, { token: i1.TrackByService }, { token: ParamsIntegratorService }, { token: i3.ConfirmationService }, { token: i4.FormBuilder }, { token: HitParamsIntegratorsService }, { token: i3.ToasterService }, { token: HitEntegratorsService }], target: i0.ɵɵFactoryTarget.Component });