@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.
@@ -3359,7 +3359,12 @@
3359
3359
  this.disabled = false;
3360
3360
  };
3361
3361
  DocumentGridComponent.prototype.cantEditStatus = function () {
3362
- var cantEditStatus = ['CANCELADO', 'EM_EXECUCAO', 'CONCLUIDO'].includes(this.agenda.status.toString());
3362
+ var cantEditStatus = [
3363
+ 'CANCELADO',
3364
+ 'EM_EXECUCAO',
3365
+ 'CONCLUIDO',
3366
+ 'AGUARDANDO_POR_VALIDACAO'
3367
+ ].includes(this.agenda.status.toString());
3363
3368
  if (cantEditStatus) {
3364
3369
  this.enableButtonIsClienteExterno = false;
3365
3370
  }
@@ -3368,6 +3373,7 @@
3368
3373
  var _this = this;
3369
3374
  return [
3370
3375
  {
3376
+ disabled: this.checkWmsSystemInvalid(),
3371
3377
  label: this.translate.instant("yms.int.wms_search"),
3372
3378
  command: function () {
3373
3379
  _this.selection = [];
@@ -3376,6 +3382,7 @@
3376
3382
  icon: "fa fa-search"
3377
3383
  },
3378
3384
  {
3385
+ disabled: this.checkWmsSystemInvalid(),
3379
3386
  label: this.translate.instant("yms.int.wms_add_document_register"),
3380
3387
  command: function () {
3381
3388
  _this.selection = [];
@@ -3386,6 +3393,12 @@
3386
3393
  }
3387
3394
  ];
3388
3395
  };
3396
+ DocumentGridComponent.prototype.checkWmsSystemInvalid = function () {
3397
+ if (this.wmsSystem && this.wmsSystem === WmsSystem.NONE) {
3398
+ return true;
3399
+ }
3400
+ return false;
3401
+ };
3389
3402
  DocumentGridComponent.prototype.getProp = function (obj, path) {
3390
3403
  return path.split(".").reduce(function (result, prop) { return (result[prop] === undefined ? "" : result[prop]); }, obj);
3391
3404
  };
@@ -5040,19 +5053,23 @@
5040
5053
  }());
5041
5054
 
5042
5055
  var NotaFormComponent = /** @class */ (function () {
5043
- function NotaFormComponent(fb, notaValidatorService, dialogConfig, confirmationService, dialogRef, verificaNotaFiscal, messageService, translate) {
5056
+ function NotaFormComponent(fb, notaValidatorService, dialogConfig, confirmationService, dialogRef, verificaNotaFiscal) {
5044
5057
  var _this = this;
5045
5058
  this.notaValidatorService = notaValidatorService;
5046
5059
  this.dialogConfig = dialogConfig;
5047
5060
  this.confirmationService = confirmationService;
5048
5061
  this.dialogRef = dialogRef;
5049
5062
  this.verificaNotaFiscal = verificaNotaFiscal;
5050
- this.messageService = messageService;
5051
- this.translate = translate;
5052
5063
  this.loading = false;
5053
5064
  this.botaoDesabilitado = false;
5065
+ this.disabled = true;
5054
5066
  this.unsubscribe$ = new rxjs.Subject();
5055
5067
  this.validateNotaFiscal = function (response) {
5068
+ var chaveNotaFiscal = _this.formGroup.get("chaveNotaFiscal").value;
5069
+ if (chaveNotaFiscal.length === 0) {
5070
+ return;
5071
+ }
5072
+ _this.disabled = false;
5056
5073
  if (!response || !response.documentos[0]) {
5057
5074
  return;
5058
5075
  }
@@ -5086,10 +5103,10 @@
5086
5103
  return !!chave || !!serie || !!numero ? null : { erroMultiplosCampos: true };
5087
5104
  };
5088
5105
  this.formGroup = fb.group({
5089
- chaveNotaFiscal: [undefined],
5090
- serieNotaFiscal: [undefined],
5091
- serieLegalNotaFiscal: [undefined],
5092
- numeroNotaFiscal: [undefined],
5106
+ chaveNotaFiscal: [undefined, forms.Validators.required],
5107
+ serieNotaFiscal: [undefined, forms.Validators.required],
5108
+ serieLegalNotaFiscal: [undefined, forms.Validators.required],
5109
+ numeroNotaFiscal: [undefined, forms.Validators.required],
5093
5110
  }, { validators: this.camposPreenchidosValidation });
5094
5111
  }
5095
5112
  NotaFormComponent.prototype.ngOnInit = function () {
@@ -5133,7 +5150,10 @@
5133
5150
  chaveDocumento: (chaveNotaFiscal || "").replace(/\s/g, ""),
5134
5151
  filialId: this.filialId
5135
5152
  })
5136
- .pipe(operators.takeUntil(this.unsubscribe$), operators.finalize(function () { return _this.loading = false; }))
5153
+ .pipe(operators.takeUntil(this.unsubscribe$), operators.catchError(function () {
5154
+ _this.disabled = false;
5155
+ return rxjs.of(null);
5156
+ }), operators.finalize(function () { return _this.loading = false; }))
5137
5157
  .subscribe(this.validateNotaFiscal);
5138
5158
  this.botaoDesabilitado = false;
5139
5159
  };
@@ -5192,7 +5212,7 @@
5192
5212
  };
5193
5213
  NotaFormComponent = __decorate([
5194
5214
  core.Component({
5195
- 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>",
5215
+ 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>",
5196
5216
  providers: [api.ConfirmationService]
5197
5217
  }),
5198
5218
  __metadata("design:paramtypes", [forms.FormBuilder,
@@ -5200,9 +5220,7 @@
5200
5220
  api.DynamicDialogConfig,
5201
5221
  api.ConfirmationService,
5202
5222
  api.DynamicDialogRef,
5203
- VerificaNotafiscal,
5204
- messageservice.MessageService,
5205
- core$1.TranslateService])
5223
+ VerificaNotafiscal])
5206
5224
  ], NotaFormComponent);
5207
5225
  return NotaFormComponent;
5208
5226
  }());