@seniorsistemas/yms-integration 1.30.0 → 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.
@@ -3300,7 +3300,12 @@ var DocumentGridComponent = /** @class */ (function () {
3300
3300
  this.disabled = false;
3301
3301
  };
3302
3302
  DocumentGridComponent.prototype.cantEditStatus = function () {
3303
- var cantEditStatus = ['CANCELADO', 'EM_EXECUCAO', 'CONCLUIDO'].includes(this.agenda.status.toString());
3303
+ var cantEditStatus = [
3304
+ 'CANCELADO',
3305
+ 'EM_EXECUCAO',
3306
+ 'CONCLUIDO',
3307
+ 'AGUARDANDO_POR_VALIDACAO'
3308
+ ].includes(this.agenda.status.toString());
3304
3309
  if (cantEditStatus) {
3305
3310
  this.enableButtonIsClienteExterno = false;
3306
3311
  }
@@ -3309,6 +3314,7 @@ var DocumentGridComponent = /** @class */ (function () {
3309
3314
  var _this = this;
3310
3315
  return [
3311
3316
  {
3317
+ disabled: this.checkWmsSystemInvalid(),
3312
3318
  label: this.translate.instant("yms.int.wms_search"),
3313
3319
  command: function () {
3314
3320
  _this.selection = [];
@@ -3317,6 +3323,7 @@ var DocumentGridComponent = /** @class */ (function () {
3317
3323
  icon: "fa fa-search"
3318
3324
  },
3319
3325
  {
3326
+ disabled: this.checkWmsSystemInvalid(),
3320
3327
  label: this.translate.instant("yms.int.wms_add_document_register"),
3321
3328
  command: function () {
3322
3329
  _this.selection = [];
@@ -3327,6 +3334,12 @@ var DocumentGridComponent = /** @class */ (function () {
3327
3334
  }
3328
3335
  ];
3329
3336
  };
3337
+ DocumentGridComponent.prototype.checkWmsSystemInvalid = function () {
3338
+ if (this.wmsSystem && this.wmsSystem === WmsSystem.NONE) {
3339
+ return true;
3340
+ }
3341
+ return false;
3342
+ };
3330
3343
  DocumentGridComponent.prototype.getProp = function (obj, path) {
3331
3344
  return path.split(".").reduce(function (result, prop) { return (result[prop] === undefined ? "" : result[prop]); }, obj);
3332
3345
  };
@@ -4981,19 +4994,23 @@ var NotaValidatorService = /** @class */ (function () {
4981
4994
  }());
4982
4995
 
4983
4996
  var NotaFormComponent = /** @class */ (function () {
4984
- function NotaFormComponent(fb, notaValidatorService, dialogConfig, confirmationService, dialogRef, verificaNotaFiscal, messageService, translate) {
4997
+ function NotaFormComponent(fb, notaValidatorService, dialogConfig, confirmationService, dialogRef, verificaNotaFiscal) {
4985
4998
  var _this = this;
4986
4999
  this.notaValidatorService = notaValidatorService;
4987
5000
  this.dialogConfig = dialogConfig;
4988
5001
  this.confirmationService = confirmationService;
4989
5002
  this.dialogRef = dialogRef;
4990
5003
  this.verificaNotaFiscal = verificaNotaFiscal;
4991
- this.messageService = messageService;
4992
- this.translate = translate;
4993
5004
  this.loading = false;
4994
5005
  this.botaoDesabilitado = false;
5006
+ this.disabled = true;
4995
5007
  this.unsubscribe$ = new Subject();
4996
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;
4997
5014
  if (!response || !response.documentos[0]) {
4998
5015
  return;
4999
5016
  }
@@ -5027,10 +5044,10 @@ var NotaFormComponent = /** @class */ (function () {
5027
5044
  return !!chave || !!serie || !!numero ? null : { erroMultiplosCampos: true };
5028
5045
  };
5029
5046
  this.formGroup = fb.group({
5030
- chaveNotaFiscal: [undefined],
5031
- serieNotaFiscal: [undefined],
5032
- serieLegalNotaFiscal: [undefined],
5033
- numeroNotaFiscal: [undefined],
5047
+ chaveNotaFiscal: [undefined, Validators.required],
5048
+ serieNotaFiscal: [undefined, Validators.required],
5049
+ serieLegalNotaFiscal: [undefined, Validators.required],
5050
+ numeroNotaFiscal: [undefined, Validators.required],
5034
5051
  }, { validators: this.camposPreenchidosValidation });
5035
5052
  }
5036
5053
  NotaFormComponent.prototype.ngOnInit = function () {
@@ -5074,7 +5091,10 @@ var NotaFormComponent = /** @class */ (function () {
5074
5091
  chaveDocumento: (chaveNotaFiscal || "").replace(/\s/g, ""),
5075
5092
  filialId: this.filialId
5076
5093
  })
5077
- .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; }))
5078
5098
  .subscribe(this.validateNotaFiscal);
5079
5099
  this.botaoDesabilitado = false;
5080
5100
  };
@@ -5133,7 +5153,7 @@ var NotaFormComponent = /** @class */ (function () {
5133
5153
  };
5134
5154
  NotaFormComponent = __decorate([
5135
5155
  Component({
5136
- 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>",
5137
5157
  providers: [ConfirmationService]
5138
5158
  }),
5139
5159
  __metadata("design:paramtypes", [FormBuilder,
@@ -5141,9 +5161,7 @@ var NotaFormComponent = /** @class */ (function () {
5141
5161
  DynamicDialogConfig,
5142
5162
  ConfirmationService,
5143
5163
  DynamicDialogRef,
5144
- VerificaNotafiscal,
5145
- MessageService$1,
5146
- TranslateService])
5164
+ VerificaNotafiscal])
5147
5165
  ], NotaFormComponent);
5148
5166
  return NotaFormComponent;
5149
5167
  }());