@seniorsistemas/yms-integration 1.31.1-f472999f-36a6-412f-af44-e2024a57be58 → 1.32.0-887e4c69-9c5d-48b3-8b94-14e4ed34ce2a

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.
@@ -3776,6 +3776,7 @@ var InsertKeyComponent = /** @class */ (function () {
3776
3776
  this.isLoading = false;
3777
3777
  }
3778
3778
  InsertKeyComponent.prototype.ngOnInit = function () {
3779
+ var _this = this;
3779
3780
  this.formGroup = this.formBuilder.group({
3780
3781
  key: [undefined],
3781
3782
  purchaseOrder: [undefined],
@@ -3783,6 +3784,9 @@ var InsertKeyComponent = /** @class */ (function () {
3783
3784
  invoiceSerie: [undefined],
3784
3785
  partnerDocument: [undefined]
3785
3786
  });
3787
+ this.formGroup.get('key').valueChanges.subscribe(function (nf) {
3788
+ _this.validateKeyDetails(nf);
3789
+ });
3786
3790
  };
3787
3791
  InsertKeyComponent.prototype.isWmsWis = function () {
3788
3792
  return this.wmsSystem === WmsSystem.WIS;
@@ -3828,6 +3832,38 @@ var InsertKeyComponent = /** @class */ (function () {
3828
3832
  _this.formGroup.reset();
3829
3833
  });
3830
3834
  };
3835
+ InsertKeyComponent.prototype.validateKeyDetails = function (nf) {
3836
+ if (!nf) {
3837
+ this.keyErrorMessage = null;
3838
+ this.setValuesOfKey(undefined, undefined, undefined);
3839
+ return;
3840
+ }
3841
+ var nfLength = 44;
3842
+ if (nf.length === nfLength) {
3843
+ this.keyErrorMessage = null;
3844
+ this.extractKeyDetails(nf);
3845
+ }
3846
+ else {
3847
+ this.keyErrorMessage = "yms.int.wms_error_key_message";
3848
+ }
3849
+ };
3850
+ InsertKeyComponent.prototype.extractKeyDetails = function (nf) {
3851
+ var startCnpj = 6;
3852
+ var endCnpj = 20;
3853
+ var cnpj = nf.substring(startCnpj, endCnpj);
3854
+ var startSerie = 22;
3855
+ var endSerie = 25;
3856
+ var serie = nf.substring(startSerie, endSerie);
3857
+ var startInvoice = 25;
3858
+ var endInvoice = 34;
3859
+ var invoice = nf.substring(startInvoice, endInvoice);
3860
+ this.setValuesOfKey(invoice, serie, cnpj);
3861
+ };
3862
+ InsertKeyComponent.prototype.setValuesOfKey = function (invoiceNumber, invoiceSerie, partnerDocument) {
3863
+ this.formGroup.get('invoiceNumber').setValue(invoiceNumber);
3864
+ this.formGroup.get('invoiceSerie').setValue(invoiceSerie);
3865
+ this.formGroup.get('partnerDocument').setValue(partnerDocument);
3866
+ };
3831
3867
  InsertKeyComponent.prototype.cancel = function () {
3832
3868
  this.visibleChange.emit(false);
3833
3869
  };
@@ -3853,8 +3889,8 @@ var InsertKeyComponent = /** @class */ (function () {
3853
3889
  InsertKeyComponent = __decorate([
3854
3890
  Component({
3855
3891
  selector: "insert-key",
3856
- template: "<form [formGroup]=\"formGroup\">\n <p-dialog [(visible)]=\"visible\" [modal]=\"true\" \n [draggable]=\"false\" (visibleChange)=\"cancel()\" (onShow)=\"onDialogShow()\">\n <p-header>{{'yms.int.wms_search_document' | translate}} {{ wmsSystem }}</p-header>\n <s-loading-state [loading]=\"isLoading\">\n <div class=\"flex py-2 justify-content-center spacing-bottom\" \n *ngIf=\"!isWmsSeniorConnect() && !isWmsWis()\">\n <label for=\"key\">{{'yms.int.wms_insert_key_label' | translate}}</label>\n <input id=\"key\" class=\"size-input\" pInputText type=\"text\" formControlName=\"key\">\n </div>\n <div class=\"flex py-2 justify-content-center spacing-bottom\" *ngIf=\"isWmsSeniorConnect()\">\n <label for=\"purchaseOrder\">{{'yms.int.wms_purchaseOrder' | translate}} </label>\n <input id=\"purchaseOrder\" class=\"size-input\" pInputText type=\"text\" formControlName=\"purchaseOrder\">\n </div>\n <div class=\"flex py-2 justify-content-center spacing-bottom\" *ngIf=\"isWmsWis()\">\n <label for=\"invoiceNumber\">{{'yms.int.wms_invoice_number' | translate}}</label>\n <input id=\"invoiceNumber\" class=\"size-input\" pInputText type=\"text\" formControlName=\"invoiceNumber\">\n </div>\n <div class=\"flex py-2 justify-content-center spacing-bottom\" *ngIf=\"isWmsWis()\">\n <label for=\"invoiceSerie\">{{'yms.int.wms_invoice_serie' | translate}}</label>\n <input id=\"invoiceSerie\" class=\"size-input\" pInputText type=\"text\" formControlName=\"invoiceSerie\">\n </div>\n <div class=\"flex py-2 justify-content-center spacing-bottom\" *ngIf=\"isWmsWis()\">\n <label for=\"partnerDocument\">{{'yms.int.wms_partner_document' | translate}}</label>\n <input id=\"partnerDocument\" class=\"size-input\" pInputText type=\"text\" formControlName=\"partnerDocument\">\n </div>\n <div class=\"separator\"></div>\n <div class=\"spacing-top\">\n <s-button pButton label=\"{{'yms.int.wms_search' | translate}}\" (click)=\"add()\"></s-button>\n <s-button\n type=\"button\"\n class=\"ui-button-link\"\n pButton label=\"{{'cancel' | translate}}\"\n (click)=\"cancel()\">\n </s-button>\n </div>\n </s-loading-state>\n </p-dialog>\n\n</form>\n",
3857
- styles: [".spacing-top{margin-top:10px}.spacing-bottom{margin-bottom:10px}.separator{width:100%;margin:5px 0;height:1px;background-color:#ccc}.size-input{width:480px}"]
3892
+ template: "<form [formGroup]=\"formGroup\">\n <p-dialog [(visible)]=\"visible\" [modal]=\"true\" \n [draggable]=\"false\" (visibleChange)=\"cancel()\" (onShow)=\"onDialogShow()\">\n <p-header>{{'yms.int.wms_search_document' | translate}} {{ wmsSystem }}</p-header>\n <s-loading-state [loading]=\"isLoading\">\n <div class=\"flex py-2 justify-content-center spacing-bottom\"\n *ngIf=\"!isWmsSeniorConnect()\">\n <label for=\"key\">{{'yms.int.wms_insert_key_label' | translate}}</label>\n <input id=\"key\" class=\"size-input\" pInputText type=\"text\" formControlName=\"key\">\n <span class=\"error-message\">{{keyErrorMessage | translate}}</span>\n </div>\n <div class=\"flex py-2 justify-content-center spacing-bottom\" *ngIf=\"isWmsSeniorConnect()\">\n <label for=\"purchaseOrder\">{{'yms.int.wms_purchaseOrder' | translate}} </label>\n <input id=\"purchaseOrder\" class=\"size-input\" pInputText type=\"text\" formControlName=\"purchaseOrder\">\n </div>\n <div class=\"flex py-2 justify-content-center spacing-bottom\" *ngIf=\"isWmsWis()\">\n <label for=\"invoiceNumber\">{{'yms.int.wms_invoice_number' | translate}}</label>\n <input id=\"invoiceNumber\" class=\"size-input\" pInputText type=\"text\" formControlName=\"invoiceNumber\">\n </div>\n <div class=\"flex py-2 justify-content-center spacing-bottom\" *ngIf=\"isWmsWis()\">\n <label for=\"invoiceSerie\">{{'yms.int.wms_invoice_serie' | translate}}</label>\n <input id=\"invoiceSerie\" class=\"size-input\" pInputText type=\"text\" formControlName=\"invoiceSerie\">\n </div>\n <div class=\"flex py-2 justify-content-center spacing-bottom\" *ngIf=\"isWmsWis()\">\n <label for=\"partnerDocument\">{{'yms.int.wms_partner_document' | translate}}</label>\n <input id=\"partnerDocument\" class=\"size-input\" pInputText type=\"text\" formControlName=\"partnerDocument\">\n </div>\n <div class=\"separator\"></div>\n <div class=\"spacing-top\">\n <s-button pButton label=\"{{'yms.int.wms_search' | translate}}\" (click)=\"add()\"></s-button>\n <s-button\n type=\"button\"\n class=\"ui-button-link\"\n pButton label=\"{{'cancel' | translate}}\"\n (click)=\"cancel()\">\n </s-button>\n </div>\n </s-loading-state>\n </p-dialog>\n\n</form>\n",
3893
+ styles: [".spacing-top{margin-top:10px}.spacing-bottom{margin-bottom:10px}.separator{width:100%;margin:5px 0;height:1px;background-color:#ccc}.size-input{width:480px}.error-message{color:#c13018;display:flex}"]
3858
3894
  }),
3859
3895
  __metadata("design:paramtypes", [FormBuilder,
3860
3896
  DocumentService,