@seniorsistemas/yms-integration 1.30.2 → 1.31.0

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.
Files changed (21) hide show
  1. package/bundles/seniorsistemas-yms-integration.umd.js +96 -71
  2. package/bundles/seniorsistemas-yms-integration.umd.js.map +1 -1
  3. package/bundles/seniorsistemas-yms-integration.umd.min.js +1 -1
  4. package/bundles/seniorsistemas-yms-integration.umd.min.js.map +1 -1
  5. package/esm2015/src/wms/components/document-grid/document-grid.component.js +26 -16
  6. package/esm2015/src/wms/components/document-grid/insert-key/insert-key.component.js +30 -7
  7. package/esm2015/src/wms/components/document-grid/insert-key/insert-key.module.js +6 -5
  8. package/esm2015/src/wms/components/document-grid/register-document/register-document.component.js +5 -14
  9. package/esm5/src/wms/components/document-grid/document-grid.component.js +27 -16
  10. package/esm5/src/wms/components/document-grid/insert-key/insert-key.component.js +30 -7
  11. package/esm5/src/wms/components/document-grid/insert-key/insert-key.module.js +6 -5
  12. package/esm5/src/wms/components/document-grid/register-document/register-document.component.js +5 -14
  13. package/fesm2015/seniorsistemas-yms-integration.js +91 -67
  14. package/fesm2015/seniorsistemas-yms-integration.js.map +1 -1
  15. package/fesm5/seniorsistemas-yms-integration.js +96 -71
  16. package/fesm5/seniorsistemas-yms-integration.js.map +1 -1
  17. package/package.json +1 -1
  18. package/seniorsistemas-yms-integration.metadata.json +1 -1
  19. package/src/wms/components/document-grid/document-grid.component.d.ts +5 -5
  20. package/src/wms/components/document-grid/insert-key/insert-key.component.d.ts +4 -2
  21. package/src/wms/components/document-grid/register-document/register-document.component.d.ts +2 -3
@@ -3152,51 +3152,6 @@
3152
3152
  return FormWmsComponent;
3153
3153
  }(FormWmsDescritor));
3154
3154
 
3155
- var IntegrationService = /** @class */ (function () {
3156
- function IntegrationService(httpClient) {
3157
- this.httpClient = httpClient;
3158
- }
3159
- IntegrationService.prototype.getProcessTypeByScheduling = function (idSchedulingType) {
3160
- return this.httpClient.post('yms/integration/queries/getProcessTypeByScheduling', { idSchedulingType: idSchedulingType });
3161
- };
3162
- IntegrationService.ngInjectableDef = core.defineInjectable({ factory: function IntegrationService_Factory() { return new IntegrationService(core.inject(http.HttpClient)); }, token: IntegrationService, providedIn: "root" });
3163
- IntegrationService = __decorate([
3164
- core.Injectable({ providedIn: 'root' }),
3165
- __metadata("design:paramtypes", [http.HttpClient])
3166
- ], IntegrationService);
3167
- return IntegrationService;
3168
- }());
3169
- var ProcessType;
3170
- (function (ProcessType) {
3171
- ProcessType["RECEBIMENTO_CONTRATO"] = "RECEBIMENTO_CONTRATO";
3172
- ProcessType["RECEBIMENTO_ORDEM_COMPRA"] = "RECEBIMENTO_ORDEM_COMPRA";
3173
- ProcessType["EXPEDICAO"] = "EXPEDICAO";
3174
- ProcessType["DEVOLUCAO"] = "DEVOLUCAO";
3175
- ProcessType["PROCESSO_AVULSO"] = "PROCESSO_AVULSO";
3176
- ProcessType["RECEBIMENTO_WMS"] = "RECEBIMENTO_WMS";
3177
- })(ProcessType || (ProcessType = {}));
3178
-
3179
- var DocumentService = /** @class */ (function (_super) {
3180
- __extends(DocumentService, _super);
3181
- function DocumentService(http, messageService) {
3182
- var _this = _super.call(this, http, messageService, 'yms_int/wms/entities/document', '') || this;
3183
- _this.http = http;
3184
- _this.messageService = messageService;
3185
- return _this;
3186
- }
3187
- DocumentService.prototype.findDocuments = function (input) {
3188
- return this.http.post('yms_int/wms/queries/findDocuments', input);
3189
- };
3190
- DocumentService.prototype.getSystemIntegration = function () {
3191
- return this.http.get('yms_int/wms/queries/getSystemIntegration');
3192
- };
3193
- DocumentService = __decorate([
3194
- core.Injectable(),
3195
- __metadata("design:paramtypes", [http.HttpClient, api.MessageService])
3196
- ], DocumentService);
3197
- return DocumentService;
3198
- }(EntityService));
3199
-
3200
3155
  var EntityService$1 = /** @class */ (function () {
3201
3156
  function EntityService(http, messageService, entityUrl, actionsUrl) {
3202
3157
  this.http = http;
@@ -3319,6 +3274,51 @@
3319
3274
  return AgendaService;
3320
3275
  }(EntityService$2));
3321
3276
 
3277
+ var DocumentService = /** @class */ (function (_super) {
3278
+ __extends(DocumentService, _super);
3279
+ function DocumentService(http, messageService) {
3280
+ var _this = _super.call(this, http, messageService, 'yms_int/wms/entities/document', '') || this;
3281
+ _this.http = http;
3282
+ _this.messageService = messageService;
3283
+ return _this;
3284
+ }
3285
+ DocumentService.prototype.findDocuments = function (input) {
3286
+ return this.http.post('yms_int/wms/queries/findDocuments', input);
3287
+ };
3288
+ DocumentService.prototype.getSystemIntegration = function () {
3289
+ return this.http.get('yms_int/wms/queries/getSystemIntegration');
3290
+ };
3291
+ DocumentService = __decorate([
3292
+ core.Injectable(),
3293
+ __metadata("design:paramtypes", [http.HttpClient, api.MessageService])
3294
+ ], DocumentService);
3295
+ return DocumentService;
3296
+ }(EntityService));
3297
+
3298
+ var IntegrationService = /** @class */ (function () {
3299
+ function IntegrationService(httpClient) {
3300
+ this.httpClient = httpClient;
3301
+ }
3302
+ IntegrationService.prototype.getProcessTypeByScheduling = function (idSchedulingType) {
3303
+ return this.httpClient.post('yms/integration/queries/getProcessTypeByScheduling', { idSchedulingType: idSchedulingType });
3304
+ };
3305
+ IntegrationService.ngInjectableDef = core.defineInjectable({ factory: function IntegrationService_Factory() { return new IntegrationService(core.inject(http.HttpClient)); }, token: IntegrationService, providedIn: "root" });
3306
+ IntegrationService = __decorate([
3307
+ core.Injectable({ providedIn: 'root' }),
3308
+ __metadata("design:paramtypes", [http.HttpClient])
3309
+ ], IntegrationService);
3310
+ return IntegrationService;
3311
+ }());
3312
+ var ProcessType;
3313
+ (function (ProcessType) {
3314
+ ProcessType["RECEBIMENTO_CONTRATO"] = "RECEBIMENTO_CONTRATO";
3315
+ ProcessType["RECEBIMENTO_ORDEM_COMPRA"] = "RECEBIMENTO_ORDEM_COMPRA";
3316
+ ProcessType["EXPEDICAO"] = "EXPEDICAO";
3317
+ ProcessType["DEVOLUCAO"] = "DEVOLUCAO";
3318
+ ProcessType["PROCESSO_AVULSO"] = "PROCESSO_AVULSO";
3319
+ ProcessType["RECEBIMENTO_WMS"] = "RECEBIMENTO_WMS";
3320
+ })(ProcessType || (ProcessType = {}));
3321
+
3322
3322
  var DocumentGridComponent = /** @class */ (function () {
3323
3323
  function DocumentGridComponent(translate, documentService, messageService, confirmationService, integrationService, agendaService) {
3324
3324
  this.translate = translate;
@@ -3336,7 +3336,7 @@
3336
3336
  DocumentGridComponent.prototype.ngOnInit = function () {
3337
3337
  this.verifyClienteExterno();
3338
3338
  this.getProcessTypeByScheduling();
3339
- this.listDocuments();
3339
+ this.listDocuments(false);
3340
3340
  };
3341
3341
  DocumentGridComponent.prototype.ngAfterContentChecked = function () {
3342
3342
  this.gridColumns = this.getGridColumns();
@@ -3355,8 +3355,17 @@
3355
3355
  .subscribe(function (result) { return _this.processType = result.processType; });
3356
3356
  };
3357
3357
  DocumentGridComponent.prototype.onChangeDocument = function (document) {
3358
+ var duplicateDocument = this.gridData.find(function (gridData) { return gridData.key === document.key; });
3359
+ if (duplicateDocument) {
3360
+ this.message("error", "yms.int.wms_error_register_document_message_title", "yms.int.wms_error_register_document_message_description");
3361
+ this.selection[0] = document;
3362
+ this.visibleDocumentRegister = true;
3363
+ return;
3364
+ }
3358
3365
  this.gridData.push(document);
3359
3366
  this.disabled = false;
3367
+ this.message("success", "yms.int.wms_saved_document_message_title", "yms.int.wms_success_message_description");
3368
+ this.visibleDocumentRegister = false;
3360
3369
  };
3361
3370
  DocumentGridComponent.prototype.cantEditStatus = function () {
3362
3371
  var cantEditStatus = [
@@ -3417,9 +3426,10 @@
3417
3426
  }
3418
3427
  data.key = _this.updateKeyByWms(data);
3419
3428
  _this.documentService.insert(data).subscribe(function () {
3420
- _this.message("success", "saved_message_title", "saved_message_content");
3429
+ _this.message("success", "yms.int.wms_saved_document_message_title", "saved_message_content");
3421
3430
  });
3422
3431
  _this.disabled = true;
3432
+ _this.listDocuments(false);
3423
3433
  }
3424
3434
  });
3425
3435
  }
@@ -3451,8 +3461,7 @@
3451
3461
  summary: _this.translate.instant("deleted_message_title"),
3452
3462
  detail: _this.translate.instant("deleted_message_content"),
3453
3463
  });
3454
- _this.gridData = [];
3455
- _this.listDocuments();
3464
+ _this.listDocuments(true);
3456
3465
  });
3457
3466
  }
3458
3467
  });
@@ -3461,26 +3470,29 @@
3461
3470
  var _this = this;
3462
3471
  this.selection.forEach(function (value, index) {
3463
3472
  if (!value.id) {
3464
- _this.gridData.splice(index, 1);
3473
+ var indexGridData = _this.gridData.findIndex(function (document) { return document.key === value.key; });
3474
+ _this.gridData.splice(indexGridData, 1);
3465
3475
  _this.selection.splice(index, 1);
3466
3476
  }
3467
3477
  });
3468
3478
  };
3469
- DocumentGridComponent.prototype.listDocuments = function () {
3479
+ DocumentGridComponent.prototype.listDocuments = function (isDelete) {
3470
3480
  var _this = this;
3471
3481
  this.documentService.list({
3472
3482
  filterQuery: "schedulingId eq '" + this.agenda.id + "'"
3473
3483
  })
3474
3484
  .subscribe(function (contents) {
3475
- _this.gridData = [];
3485
+ var _a;
3486
+ _this.gridData = isDelete ? _this.gridData.filter(function (item) { return !item.id; }) : [];
3476
3487
  if (contents.totalElements > 0) {
3477
- _this.gridData = contents.contents;
3488
+ (_a = _this.gridData).push.apply(_a, __spread(contents.contents));
3478
3489
  _this.documentTotalRecords = contents.totalElements;
3479
3490
  }
3480
3491
  else {
3481
3492
  _this.documentTotalRecords = _this.gridData.length;
3482
3493
  }
3483
- _this.disabled = true;
3494
+ var hasElementWithoutId = _this.gridData.some(function (item) { return !item.id; });
3495
+ _this.disabled = !hasElementWithoutId;
3484
3496
  _this.loading = false;
3485
3497
  });
3486
3498
  };
@@ -3575,7 +3587,7 @@
3575
3587
  DocumentGridComponent = __decorate([
3576
3588
  core.Component({
3577
3589
  selector: 'document-grid',
3578
- template: "<div *ngIf=\"this.processType === 'RECEBIMENTO_WMS'; else processNotConfigured\">\n <p-panel>\n <p-header>\n <div class=\"buttons\">\n <div>\n <s-button\n label=\"{{'yms.int.wms_add_document' | translate}}\"\n priority=\"primary\"\n [model]=\"getActions()\"\n [auxiliary]=\"false\"\n [disabled]=\"!enableButtonIsClienteExterno\">\n </s-button>\n <s-button\n label=\"{{'yms.wms_view_button' | translate}}\"\n priority=\"secondary\"\n [auxiliary]=\"false\"\n [disabled]=\"!selection || selection.length !== 1\"\n (onClick)=\"view()\">\n </s-button>\n <s-button\n label=\"{{'yms.wms_delete_button' | translate}}\"\n priority=\"secondary\"\n [disabled]=\"!selection || !selection.length || !enableButtonIsClienteExterno\"\n (click)=\"onDelete()\">\n </s-button>\n </div>\n <s-button\n id=\"refresh-button\"\n priority=\"default\"\n iconClass=\"fa fa-refresh\"\n (onClick)=\"listDocuments()\"\n >\n </s-button>\n </div>\n </p-header>\n <div class=\"ui-g\">\n <div class=\"ui-g-12\" *ngIf=\"gridData && gridData.length; else emptyList\">\n <p-table #documentTable [value]=\"gridData\"\n [columns]=\"gridColumns\" dataKey=\"id\" [lazy]=\"true\" [scrollable]=\"true\" [resizableColumns]=\"true\"\n sortMode=\"multiple\" [paginator]=\"true\" [totalRecords]=\"documentTotalRecords\" rows=\"10\"\n [rowsPerPageOptions]=\"[10, 20, 50, 100]\" [(selection)]=\"selection\"\n [loading]=\"loading\">\n <ng-template pTemplate=\"colgroup\" let-columns>\n <colgroup>\n <col *ngFor=\"let col of columns\" [style.width]=\"col.width\"/>\n </colgroup>\n </ng-template>\n <ng-template pTemplate=\"header\" let-columns>\n <tr>\n <th id=\"checkbox\" class=\"table-checkbox\">\n <p-tableHeaderCheckbox></p-tableHeaderCheckbox>\n </th>\n <th id=\"col\" *ngFor=\"let col of columns\" [pSortableColumn]=\"col.field\" pResizableColumn>\n <div class=\"senior-header\">\n <span class=\"senior-header-title\">{{ col.header }}</span>\n <p-sortIcon [field]=\"col.field\"></p-sortIcon>\n </div>\n </th>\n </tr>\n </ng-template>\n <ng-template pTemplate=\"body\" let-rowData let-columns let-expanded=\"expanded\">\n <tr [pSelectableRow]=\"rowData\">\n <td class=\"table-checkbox\">\n <p-tableCheckbox [value]=\"rowData\"></p-tableCheckbox>\n </td>\n <td *ngFor=\"let column of getGridColumns()\" (click)=\"selection = [rowData]\">\n <span>{{ rowData[ column.field ] }}</span>\n </td>\n </tr>\n </ng-template>\n <ng-template pTemplate=\"paginatorright\">\n <span [translate]=\"'total_records'\" [translateParams]=\"{ value: documentTotalRecords }\"></span>\n </ng-template>\n </p-table> \n </div>\n </div>\n <register-document\n [wmsSystem]=\"wmsSystem\"\n [edit]=\"edit\"\n [viewDocument]=\"selection\"\n (document)=\"onChangeDocument($event)\"\n [(visible)]=\"visibleDocumentRegister\"\n [agenda]=\"agenda\">\n </register-document> \n <insert-key [wmsSystem]=\"wmsSystem\" \n (document)=\"onChangeDocument($event)\" [(visible)]=\"visibleInvoiceKey\"></insert-key>\n </p-panel>\n</div>\n <div class=\"button-save\">\n <s-button \n priority=\"primary\" [label]=\"'save' | translate\"\n [disabled]=\"disabled || !this.gridData || !enableButtonIsClienteExterno\"\n (click)=\"save()\">\n </s-button>\n </div>\n <register-document\n [wmsSystem]=\"wmsSystem\"\n [edit]=\"edit\"\n [viewDocument]=\"selection\"\n (document)=\"onChangeDocument($event)\"\n [(visible)]=\"visibleDocumentRegister\"\n [agenda]=\"agenda\">\n </register-document> \n <insert-key [wmsSystem]=\"wmsSystem\" \n (document)=\"onChangeDocument($event)\" [(visible)]=\"visibleInvoiceKey\"></insert-key>\n\n<ng-template #emptyList>\n <div class=\"center\">\n <s-empty-state\n iconClass=\"fa fa-exclamation-triangle\" [title]=\"'detail_empty_state_title' | translate\"\n [description]=\"'detail_empty_state_description' | translate\">\n </s-empty-state>\n </div>\n</ng-template>\n\n<ng-template #processNotConfigured>\n <div class=\"center\">\n <s-empty-state\n iconClass=\"fa fa-exclamation-triangle\"\n [title]=\"'yms.int.wms_there_no_process_type_configured_for_this_type_scheduling' | translate\"\n >\n </s-empty-state>\n </div>\n</ng-template>",
3590
+ template: "<div *ngIf=\"this.processType === 'RECEBIMENTO_WMS'; else processNotConfigured\">\n <p-panel>\n <p-header>\n <div class=\"buttons\">\n <div>\n <s-button\n label=\"{{'yms.int.wms_add_document' | translate}}\"\n priority=\"primary\"\n [model]=\"getActions()\"\n [auxiliary]=\"false\"\n [disabled]=\"!enableButtonIsClienteExterno\">\n </s-button>\n <s-button\n label=\"{{'yms.wms_view_button' | translate}}\"\n priority=\"secondary\"\n [auxiliary]=\"false\"\n [disabled]=\"!selection || selection.length !== 1\"\n (onClick)=\"view()\">\n </s-button>\n <s-button\n label=\"{{'yms.wms_delete_button' | translate}}\"\n priority=\"secondary\"\n [disabled]=\"!selection || !selection.length || !enableButtonIsClienteExterno\"\n (click)=\"onDelete()\">\n </s-button>\n </div>\n <s-button\n id=\"refresh-button\"\n priority=\"default\"\n iconClass=\"fa fa-refresh\"\n (onClick)=\"listDocuments(false)\"\n >\n </s-button>\n </div>\n </p-header>\n <div class=\"ui-g\">\n <div class=\"ui-g-12\" *ngIf=\"gridData && gridData.length; else emptyList\">\n <p-table #documentTable [value]=\"gridData\"\n [columns]=\"gridColumns\" dataKey=\"key\" [lazy]=\"true\" [scrollable]=\"true\" [resizableColumns]=\"true\"\n sortMode=\"multiple\" [paginator]=\"true\" [totalRecords]=\"documentTotalRecords\" rows=\"10\"\n [rowsPerPageOptions]=\"[10, 20, 50, 100]\" [(selection)]=\"selection\"\n [loading]=\"loading\">\n <ng-template pTemplate=\"colgroup\" let-columns>\n <colgroup>\n <col *ngFor=\"let col of columns\" [style.width]=\"col.width\"/>\n </colgroup>\n </ng-template>\n <ng-template pTemplate=\"header\" let-columns>\n <tr>\n <th id=\"checkbox\" class=\"table-checkbox\">\n <p-tableHeaderCheckbox></p-tableHeaderCheckbox>\n </th>\n <th id=\"col\" *ngFor=\"let col of columns\" [pSortableColumn]=\"col.field\" pResizableColumn>\n <div class=\"senior-header\">\n <span class=\"senior-header-title\">{{ col.header }}</span>\n <p-sortIcon [field]=\"col.field\"></p-sortIcon>\n </div>\n </th>\n </tr>\n </ng-template>\n <ng-template pTemplate=\"body\" let-rowData let-columns let-expanded=\"expanded\">\n <tr [pSelectableRow]=\"rowData\">\n <td class=\"table-checkbox\">\n <p-tableCheckbox [value]=\"rowData\"></p-tableCheckbox>\n </td>\n <td *ngFor=\"let column of getGridColumns()\" (click)=\"selection = [rowData]\">\n <span>{{ rowData[ column.field ] }}</span>\n </td>\n </tr>\n </ng-template>\n <ng-template pTemplate=\"paginatorright\">\n <span [translate]=\"'total_records'\" [translateParams]=\"{ value: documentTotalRecords }\"></span>\n </ng-template>\n </p-table> \n </div>\n </div>\n <register-document\n [wmsSystem]=\"wmsSystem\"\n [edit]=\"edit\"\n [viewDocument]=\"selection\"\n (document)=\"onChangeDocument($event)\"\n [(visible)]=\"visibleDocumentRegister\"\n [agenda]=\"agenda\">\n </register-document> \n <insert-key [wmsSystem]=\"wmsSystem\" \n (document)=\"onChangeDocument($event)\" [(visible)]=\"visibleInvoiceKey\"></insert-key>\n </p-panel>\n</div>\n <div class=\"button-save\">\n <s-button \n priority=\"primary\" [label]=\"'save' | translate\"\n [disabled]=\"disabled || !this.gridData || !enableButtonIsClienteExterno\"\n (click)=\"save()\">\n </s-button>\n </div>\n <register-document\n [wmsSystem]=\"wmsSystem\"\n [edit]=\"edit\"\n [viewDocument]=\"selection\"\n (document)=\"onChangeDocument($event)\"\n [(visible)]=\"visibleDocumentRegister\"\n [agenda]=\"agenda\">\n </register-document> \n <insert-key [wmsSystem]=\"wmsSystem\" \n (document)=\"onChangeDocument($event)\" [(visible)]=\"visibleInvoiceKey\"></insert-key>\n\n<ng-template #emptyList>\n <div class=\"center\">\n <s-empty-state\n iconClass=\"fa fa-exclamation-triangle\" [title]=\"'detail_empty_state_title' | translate\"\n [description]=\"'detail_empty_state_description' | translate\">\n </s-empty-state>\n </div>\n</ng-template>\n\n<ng-template #processNotConfigured>\n <div class=\"center\">\n <s-empty-state\n iconClass=\"fa fa-exclamation-triangle\"\n [title]=\"'yms.int.wms_there_no_process_type_configured_for_this_type_scheduling' | translate\"\n >\n </s-empty-state>\n </div>\n</ng-template>",
3579
3591
  styles: [".buttons{display:flex;justify-content:space-between}.center{flex-direction:column;text-align:center}.ui-g{display:block}.button-save{margin:5px 0}#refresh-button{color:#fff}.table-checkbox{width:50px}"]
3580
3592
  }),
3581
3593
  __metadata("design:paramtypes", [core$1.TranslateService,
@@ -3658,7 +3670,6 @@
3658
3670
  };
3659
3671
  RegisterDocumentComponent.prototype.close = function () {
3660
3672
  this.visibleChange.emit(false);
3661
- this.formGroup.reset();
3662
3673
  };
3663
3674
  RegisterDocumentComponent.prototype.setValuesFormGroup = function (document) {
3664
3675
  this.formGroup.get('key').setValue(document.key);
@@ -3697,24 +3708,16 @@
3697
3708
  if (this.agenda.id !== undefined) {
3698
3709
  value.schedulingId = this.agenda.id;
3699
3710
  }
3700
- if (value.key === undefined) {
3711
+ if (value.key === undefined || value.key === null) {
3701
3712
  value.key = value.invoiceKey;
3702
3713
  if (this.isWmsWis()) {
3703
3714
  value.key = value.invoiceNumber + ":" + value.invoiceSerialNumber + ":" + value.partnerDocument;
3704
3715
  }
3705
3716
  }
3717
+ this.formGroup.reset();
3706
3718
  this.document.emit(Document.fromDto(value));
3707
- this.successMessage();
3708
- this.visibleChange.emit(false);
3709
3719
  }
3710
3720
  };
3711
- RegisterDocumentComponent.prototype.successMessage = function () {
3712
- this.messageService.add({
3713
- severity: "success",
3714
- summary: this.translateService.instant("yms.saved_message_title"),
3715
- detail: this.translateService.instant("yms.int.wms_success_message_description"),
3716
- });
3717
- };
3718
3721
  RegisterDocumentComponent.prototype.isWmsWis = function () {
3719
3722
  return this.wmsSystem === WmsSystem.WIS;
3720
3723
  };
@@ -3795,6 +3798,7 @@
3795
3798
  this.document = new core.EventEmitter();
3796
3799
  this.visible = new core.EventEmitter();
3797
3800
  this.visibleChange = new core.EventEmitter();
3801
+ this.isLoading = false;
3798
3802
  }
3799
3803
  InsertKeyComponent.prototype.ngOnInit = function () {
3800
3804
  this.formGroup = this.formBuilder.group({
@@ -3812,11 +3816,11 @@
3812
3816
  return this.wmsSystem === WmsSystem.SENIOR_CONNECT;
3813
3817
  };
3814
3818
  InsertKeyComponent.prototype.add = function () {
3815
- this.visibleChange.emit(false);
3816
3819
  this.searchKey();
3817
3820
  };
3818
3821
  InsertKeyComponent.prototype.searchKey = function () {
3819
3822
  var _this = this;
3823
+ this.isLoading = true;
3820
3824
  var key = {
3821
3825
  documentKeys: [this.formGroup.get('key').value],
3822
3826
  invoices: [{
@@ -3828,8 +3832,25 @@
3828
3832
  size: 0,
3829
3833
  offset: 0
3830
3834
  };
3831
- this.documentService.findDocuments(key).subscribe(function (content) {
3832
- if (content.totalElements < 1) {
3835
+ this.documentService.findDocuments(key)
3836
+ .pipe(operators.catchError(function (err) {
3837
+ if (err.error && err.error.message.includes("404")) {
3838
+ _this.message("error", "yms.int.wms_error_search_document_message_header", "yms.int.wms_error_search_document_not_found_message_content");
3839
+ }
3840
+ else {
3841
+ _this.messageService.add({
3842
+ severity: "error",
3843
+ summary: _this.translate.instant("yms.int.wms_error_search_document_message_header"),
3844
+ detail: _this.translate.instant("yms.int.wms_error_unknown_search_document_message_content") + err.error.message,
3845
+ });
3846
+ }
3847
+ return rxjs.throwError(err);
3848
+ }), operators.finalize(function () {
3849
+ _this.isLoading = false;
3850
+ }))
3851
+ .subscribe(function (content) {
3852
+ _this.visibleChange.emit(false);
3853
+ if (!content || content.totalElements < 1) {
3833
3854
  _this.message("warn", "yms.int.wms_insert_key_warning_message_header", "yms.int.wms_insert_key_warning_message_description");
3834
3855
  return;
3835
3856
  }
@@ -3848,6 +3869,9 @@
3848
3869
  InsertKeyComponent.prototype.cancel = function () {
3849
3870
  this.visibleChange.emit(false);
3850
3871
  };
3872
+ InsertKeyComponent.prototype.onDialogShow = function () {
3873
+ this.formGroup.reset();
3874
+ };
3851
3875
  __decorate([
3852
3876
  core.Output(),
3853
3877
  __metadata("design:type", core.EventEmitter)
@@ -3867,7 +3891,7 @@
3867
3891
  InsertKeyComponent = __decorate([
3868
3892
  core.Component({
3869
3893
  selector: "insert-key",
3870
- template: "<form [formGroup]=\"formGroup\">\n <p-dialog [(visible)]=\"visible\" [modal]=\"true\" [draggable]=\"false\" (visibleChange)=\"cancel()\">\n <p-header>{{'yms.int.wms_search_document' | translate}} {{ wmsSystem }}</p-header>\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 </p-dialog>\n</form>",
3894
+ 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",
3871
3895
  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}"]
3872
3896
  }),
3873
3897
  __metadata("design:paramtypes", [forms.FormBuilder,
@@ -3889,7 +3913,8 @@
3889
3913
  angularComponents.ButtonModule,
3890
3914
  core$1.TranslateModule,
3891
3915
  primeng.DialogModule,
3892
- primeng.InputTextModule
3916
+ primeng.InputTextModule,
3917
+ angularComponents.LoadingStateModule
3893
3918
  ],
3894
3919
  exports: [InsertKeyComponent],
3895
3920
  declarations: [InsertKeyComponent]