@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.
@@ -3835,6 +3835,7 @@
3835
3835
  this.isLoading = false;
3836
3836
  }
3837
3837
  InsertKeyComponent.prototype.ngOnInit = function () {
3838
+ var _this = this;
3838
3839
  this.formGroup = this.formBuilder.group({
3839
3840
  key: [undefined],
3840
3841
  purchaseOrder: [undefined],
@@ -3842,6 +3843,9 @@
3842
3843
  invoiceSerie: [undefined],
3843
3844
  partnerDocument: [undefined]
3844
3845
  });
3846
+ this.formGroup.get('key').valueChanges.subscribe(function (nf) {
3847
+ _this.validateKeyDetails(nf);
3848
+ });
3845
3849
  };
3846
3850
  InsertKeyComponent.prototype.isWmsWis = function () {
3847
3851
  return this.wmsSystem === WmsSystem.WIS;
@@ -3887,6 +3891,38 @@
3887
3891
  _this.formGroup.reset();
3888
3892
  });
3889
3893
  };
3894
+ InsertKeyComponent.prototype.validateKeyDetails = function (nf) {
3895
+ if (!nf) {
3896
+ this.keyErrorMessage = null;
3897
+ this.setValuesOfKey(undefined, undefined, undefined);
3898
+ return;
3899
+ }
3900
+ var nfLength = 44;
3901
+ if (nf.length === nfLength) {
3902
+ this.keyErrorMessage = null;
3903
+ this.extractKeyDetails(nf);
3904
+ }
3905
+ else {
3906
+ this.keyErrorMessage = "yms.int.wms_error_key_message";
3907
+ }
3908
+ };
3909
+ InsertKeyComponent.prototype.extractKeyDetails = function (nf) {
3910
+ var startCnpj = 6;
3911
+ var endCnpj = 20;
3912
+ var cnpj = nf.substring(startCnpj, endCnpj);
3913
+ var startSerie = 22;
3914
+ var endSerie = 25;
3915
+ var serie = nf.substring(startSerie, endSerie);
3916
+ var startInvoice = 25;
3917
+ var endInvoice = 34;
3918
+ var invoice = nf.substring(startInvoice, endInvoice);
3919
+ this.setValuesOfKey(invoice, serie, cnpj);
3920
+ };
3921
+ InsertKeyComponent.prototype.setValuesOfKey = function (invoiceNumber, invoiceSerie, partnerDocument) {
3922
+ this.formGroup.get('invoiceNumber').setValue(invoiceNumber);
3923
+ this.formGroup.get('invoiceSerie').setValue(invoiceSerie);
3924
+ this.formGroup.get('partnerDocument').setValue(partnerDocument);
3925
+ };
3890
3926
  InsertKeyComponent.prototype.cancel = function () {
3891
3927
  this.visibleChange.emit(false);
3892
3928
  };
@@ -3912,8 +3948,8 @@
3912
3948
  InsertKeyComponent = __decorate([
3913
3949
  core.Component({
3914
3950
  selector: "insert-key",
3915
- 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",
3916
- 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}"]
3951
+ 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",
3952
+ 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}"]
3917
3953
  }),
3918
3954
  __metadata("design:paramtypes", [forms.FormBuilder,
3919
3955
  DocumentService,