@seniorsistemas/yms-integration 1.30.1 → 1.30.2

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.
@@ -4994,19 +4994,23 @@ var NotaValidatorService = /** @class */ (function () {
4994
4994
  }());
4995
4995
 
4996
4996
  var NotaFormComponent = /** @class */ (function () {
4997
- function NotaFormComponent(fb, notaValidatorService, dialogConfig, confirmationService, dialogRef, verificaNotaFiscal, messageService, translate) {
4997
+ function NotaFormComponent(fb, notaValidatorService, dialogConfig, confirmationService, dialogRef, verificaNotaFiscal) {
4998
4998
  var _this = this;
4999
4999
  this.notaValidatorService = notaValidatorService;
5000
5000
  this.dialogConfig = dialogConfig;
5001
5001
  this.confirmationService = confirmationService;
5002
5002
  this.dialogRef = dialogRef;
5003
5003
  this.verificaNotaFiscal = verificaNotaFiscal;
5004
- this.messageService = messageService;
5005
- this.translate = translate;
5006
5004
  this.loading = false;
5007
5005
  this.botaoDesabilitado = false;
5006
+ this.disabled = true;
5008
5007
  this.unsubscribe$ = new Subject();
5009
5008
  this.validateNotaFiscal = function (response) {
5009
+ var chaveNotaFiscal = _this.formGroup.get("chaveNotaFiscal").value;
5010
+ if (chaveNotaFiscal.length === 0) {
5011
+ return;
5012
+ }
5013
+ _this.disabled = false;
5010
5014
  if (!response || !response.documentos[0]) {
5011
5015
  return;
5012
5016
  }
@@ -5040,10 +5044,10 @@ var NotaFormComponent = /** @class */ (function () {
5040
5044
  return !!chave || !!serie || !!numero ? null : { erroMultiplosCampos: true };
5041
5045
  };
5042
5046
  this.formGroup = fb.group({
5043
- chaveNotaFiscal: [undefined],
5044
- serieNotaFiscal: [undefined],
5045
- serieLegalNotaFiscal: [undefined],
5046
- numeroNotaFiscal: [undefined],
5047
+ chaveNotaFiscal: [undefined, Validators.required],
5048
+ serieNotaFiscal: [undefined, Validators.required],
5049
+ serieLegalNotaFiscal: [undefined, Validators.required],
5050
+ numeroNotaFiscal: [undefined, Validators.required],
5047
5051
  }, { validators: this.camposPreenchidosValidation });
5048
5052
  }
5049
5053
  NotaFormComponent.prototype.ngOnInit = function () {
@@ -5087,7 +5091,10 @@ var NotaFormComponent = /** @class */ (function () {
5087
5091
  chaveDocumento: (chaveNotaFiscal || "").replace(/\s/g, ""),
5088
5092
  filialId: this.filialId
5089
5093
  })
5090
- .pipe(takeUntil(this.unsubscribe$), finalize(function () { return _this.loading = false; }))
5094
+ .pipe(takeUntil(this.unsubscribe$), catchError(function () {
5095
+ _this.disabled = false;
5096
+ return of(null);
5097
+ }), finalize(function () { return _this.loading = false; }))
5091
5098
  .subscribe(this.validateNotaFiscal);
5092
5099
  this.botaoDesabilitado = false;
5093
5100
  };
@@ -5146,7 +5153,7 @@ var NotaFormComponent = /** @class */ (function () {
5146
5153
  };
5147
5154
  NotaFormComponent = __decorate([
5148
5155
  Component({
5149
- template: "<form [formGroup]=\"formGroup\">\n <div class=\"ui-g ui-fluid\" *sLoadingState=\"loading\">\n <div class=\"ui-g-12\">\n <label for=\"chaveNotaFiscal\">{{'yms.erp.recebimento_chave_nota_fiscal' | translate}}</label>\n <input\n id=\"chaveNotaFiscal\"\n trim\n pInputText\n type=\"text\"\n formControlName=\"chaveNotaFiscal\"\n (blur)=\"onBlurNotaFiscal()\"\n >\n <s-control-errors [control]=\"formGroup.controls.chaveNotaFiscal\" [errorMessages]=\"{ errorChaveNota: 'yms.erp.produto_nota_error_detail' | translate }\"></s-control-errors>\n </div>\n <div class=\"ui-g-12\">\n <label for=\"serieNotaFiscal\">{{'yms.erp.recebimento_serie_nota_fiscal' | translate}}</label>\n <input pInputText type=\"text\" formControlName=\"serieNotaFiscal\">\n </div>\n <div class=\"ui-g-12\">\n <label for=\"serieLegalNotaFiscal\">{{'yms.erp.recebimento_serie_legal_nota_fiscal' | translate}}</label>\n <input pInputText type=\"text\" formControlName=\"serieLegalNotaFiscal\">\n </div>\n <div class=\"ui-g-12\">\n <label for=\"numeroNotaFiscal\">{{'yms.erp.recebimento_numero_nota_fiscal' | translate}}</label>\n <input pInputText type=\"text\" formControlName=\"numeroNotaFiscal\">\n </div>\n </div>\n\n <s-control-errors [control]=\"formGroup\" [errorMessages]=\"{ erroMultiplosCampos: 'yms.erp.nota_fiscal_no_value' | translate }\"></s-control-errors>\n\n <s-button label=\"Cancelar\" (onClick)=\"close()\" priority=\"link\"></s-button>\n <s-button label=\"Salvar\" [disabled]=\"botaoDesabilitado\" (onClick)=\"save()\"></s-button>\n</form>\n\n<p-confirmDialog appendTo=\"body\"></p-confirmDialog>",
5156
+ template: "<form [formGroup]=\"formGroup\">\n <div class=\"ui-g ui-fluid\" *sLoadingState=\"loading\">\n <div class=\"ui-g-12 required\">\n <label for=\"chaveNotaFiscal\">{{'yms.erp.recebimento_chave_nota_fiscal' | translate}}</label>\n <input\n id=\"chaveNotaFiscal\"\n trim\n pInputText\n type=\"text\"\n formControlName=\"chaveNotaFiscal\"\n (blur)=\"onBlurNotaFiscal()\"\n >\n <s-control-errors\n [control]=\"formGroup.controls.chaveNotaFiscal\"\n [errorMessages]=\"{ errorChaveNota: 'yms.erp.produto_nota_error_detail' | translate }\">\n </s-control-errors>\n </div>\n <div class=\"ui-g-12 required\" [attr.data-hidden]=\"disabled\">\n <label for=\"serieNotaFiscal\">{{'yms.erp.recebimento_serie_nota_fiscal' | translate}}</label>\n <input pInputText type=\"text\" formControlName=\"serieNotaFiscal\">\n <s-control-errors\n [control]=\"formGroup.controls['serieNotaFiscal']\"\n [errorMessages]=\"{ required: 'yms.erp.error_required' | translate }\">\n </s-control-errors>\n </div>\n <div class=\"ui-g-12 required\" [attr.data-hidden]=\"disabled\">\n <label for=\"serieLegalNotaFiscal\">{{'yms.erp.recebimento_serie_legal_nota_fiscal' | translate}}</label>\n <input pInputText type=\"text\" formControlName=\"serieLegalNotaFiscal\">\n <s-control-errors\n [control]=\"formGroup.controls['serieLegalNotaFiscal']\"\n [errorMessages]=\"{ required: 'yms.erp.error_required' | translate }\">\n </s-control-errors>\n </div>\n <div class=\"ui-g-12 required\" [attr.data-hidden]=\"disabled\">\n <label for=\"numeroNotaFiscal\">{{'yms.erp.recebimento_numero_nota_fiscal' | translate}}</label>\n <input pInputText type=\"text\" formControlName=\"numeroNotaFiscal\">\n <s-control-errors\n [control]=\"formGroup.controls['numeroNotaFiscal']\"\n [errorMessages]=\"{ required: 'yms.erp.error_required' | translate }\">\n </s-control-errors>\n </div>\n </div>\n\n <s-control-errors [control]=\"formGroup\" [errorMessages]=\"{ erroMultiplosCampos: 'yms.erp.nota_fiscal_no_value' | translate }\"></s-control-errors>\n\n <s-button label=\"Cancelar\" (onClick)=\"close()\" priority=\"link\"></s-button>\n <s-button label=\"Salvar\" [disabled]=\"botaoDesabilitado || disabled\" (onClick)=\"save()\"></s-button>\n</form>\n\n<p-confirmDialog appendTo=\"body\"></p-confirmDialog>",
5150
5157
  providers: [ConfirmationService]
5151
5158
  }),
5152
5159
  __metadata("design:paramtypes", [FormBuilder,
@@ -5154,9 +5161,7 @@ var NotaFormComponent = /** @class */ (function () {
5154
5161
  DynamicDialogConfig,
5155
5162
  ConfirmationService,
5156
5163
  DynamicDialogRef,
5157
- VerificaNotafiscal,
5158
- MessageService$1,
5159
- TranslateService])
5164
+ VerificaNotafiscal])
5160
5165
  ], NotaFormComponent);
5161
5166
  return NotaFormComponent;
5162
5167
  }());