@seniorsistemas/yms-integration 1.32.0 → 1.33.0-c2e82ccb-741e-4184-8c6e-a7197ff2bc08

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 (46) hide show
  1. package/bundles/seniorsistemas-yms-integration.umd.js +320 -103
  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/seniorsistemas-yms-integration.js +44 -43
  6. package/esm2015/src/wms/components/document-grid/document-grid.component.js +84 -19
  7. package/esm2015/src/wms/components/document-grid/document-grid.module.js +8 -3
  8. package/esm2015/src/wms/components/document-grid/insert-key/insert-key.component.js +100 -8
  9. package/esm2015/src/wms/components/document-grid/insert-key/insert-key.module.js +4 -2
  10. package/esm2015/src/wms/components/document-grid/register-document/register-document.component.js +21 -7
  11. package/esm2015/src/wms/components/document-grid/register-document/register-document.module.js +4 -3
  12. package/esm2015/src/wms/components/document-list/document-list.component.js +49 -28
  13. package/esm2015/src/wms/entities/document/document-dto.js +1 -1
  14. package/esm2015/src/wms/entities/document/document.js +2 -1
  15. package/esm2015/src/wms/entities/external-tenant/external-tenant-dto.js +1 -0
  16. package/esm2015/src/wms/entities/external-tenant/external-tenant.service.js +18 -0
  17. package/esm2015/src/wms/entities/invoice-condition/invoice-condition.js +9 -0
  18. package/esm5/seniorsistemas-yms-integration.js +44 -43
  19. package/esm5/src/wms/components/document-grid/document-grid.component.js +81 -18
  20. package/esm5/src/wms/components/document-grid/document-grid.module.js +8 -3
  21. package/esm5/src/wms/components/document-grid/insert-key/insert-key.component.js +103 -8
  22. package/esm5/src/wms/components/document-grid/insert-key/insert-key.module.js +4 -2
  23. package/esm5/src/wms/components/document-grid/register-document/register-document.component.js +21 -7
  24. package/esm5/src/wms/components/document-grid/register-document/register-document.module.js +4 -3
  25. package/esm5/src/wms/components/document-list/document-list.component.js +52 -30
  26. package/esm5/src/wms/entities/document/document-dto.js +1 -1
  27. package/esm5/src/wms/entities/document/document.js +2 -1
  28. package/esm5/src/wms/entities/external-tenant/external-tenant-dto.js +1 -0
  29. package/esm5/src/wms/entities/external-tenant/external-tenant.service.js +21 -0
  30. package/esm5/src/wms/entities/invoice-condition/invoice-condition.js +9 -0
  31. package/fesm2015/seniorsistemas-yms-integration.js +271 -60
  32. package/fesm2015/seniorsistemas-yms-integration.js.map +1 -1
  33. package/fesm5/seniorsistemas-yms-integration.js +277 -61
  34. package/fesm5/seniorsistemas-yms-integration.js.map +1 -1
  35. package/package.json +1 -1
  36. package/seniorsistemas-yms-integration.d.ts +43 -42
  37. package/seniorsistemas-yms-integration.metadata.json +1 -1
  38. package/src/wms/components/document-grid/document-grid.component.d.ts +22 -8
  39. package/src/wms/components/document-grid/insert-key/insert-key.component.d.ts +17 -1
  40. package/src/wms/components/document-grid/register-document/register-document.component.d.ts +9 -3
  41. package/src/wms/components/document-list/document-list.component.d.ts +10 -5
  42. package/src/wms/entities/document/document-dto.d.ts +1 -0
  43. package/src/wms/entities/document/document.d.ts +2 -0
  44. package/src/wms/entities/external-tenant/external-tenant-dto.d.ts +7 -0
  45. package/src/wms/entities/external-tenant/external-tenant.service.d.ts +9 -0
  46. package/src/wms/entities/invoice-condition/invoice-condition.d.ts +7 -0
@@ -3347,6 +3347,15 @@
3347
3347
  ProcessType["RECEBIMENTO_WMS"] = "RECEBIMENTO_WMS";
3348
3348
  })(ProcessType || (ProcessType = {}));
3349
3349
 
3350
+ var InvoiceCondition;
3351
+ (function (InvoiceCondition) {
3352
+ InvoiceCondition["AUTHORIZED"] = "AUTHORIZED";
3353
+ InvoiceCondition["PARTIAL_AUTHORIZED"] = "PARTIAL_AUTHORIZED";
3354
+ InvoiceCondition["MANUAL_AUTHORIZED"] = "MANUAL_AUTHORIZED";
3355
+ InvoiceCondition["DEVOLUTION"] = "DEVOLUTION";
3356
+ InvoiceCondition["REJECTED"] = "REJECTED";
3357
+ })(InvoiceCondition || (InvoiceCondition = {}));
3358
+
3350
3359
  var DocumentGridComponent = /** @class */ (function () {
3351
3360
  function DocumentGridComponent(translate, documentService, confirmationService, integrationService, agendaService, utils) {
3352
3361
  this.translate = translate;
@@ -3358,22 +3367,37 @@
3358
3367
  this.viewDocument = new core.EventEmitter();
3359
3368
  this.gridData = [];
3360
3369
  this.enableButtonIsClienteExterno = true;
3370
+ this.summary = "yms.int.wms_saved_document_message_title";
3361
3371
  this.ngUnsubscribe = new rxjs.Subject();
3372
+ this.invoiceConditions = [
3373
+ { label: this.translate.instant("yms.int.wms_grid_document_invoice_no_way"), value: null },
3374
+ { label: this.translate.instant("yms.int.wms_grid_document_invoice_condition_authorized"), value: InvoiceCondition.AUTHORIZED },
3375
+ { label: this.translate.instant("yms.int.wms_grid_document_invoice_condition_manual_authorized"), value: InvoiceCondition.MANUAL_AUTHORIZED },
3376
+ { label: this.translate.instant("yms.int.wms_grid_document_invoice_condition_partial_authorized"), value: InvoiceCondition.PARTIAL_AUTHORIZED },
3377
+ { label: this.translate.instant("yms.int.wms_grid_document_invoice_condition_devolution"), value: InvoiceCondition.DEVOLUTION },
3378
+ { label: this.translate.instant("yms.int.wms_grid_document_invoice_condition_rejected"), value: InvoiceCondition.REJECTED },
3379
+ ];
3362
3380
  this.selection = [];
3363
3381
  }
3382
+ DocumentGridComponent.prototype.getFilteredInvoiceConditions = function (invoiceConditions) {
3383
+ if (invoiceConditions === InvoiceCondition.AUTHORIZED) {
3384
+ return this.invoiceConditions.filter(function (cond) { return cond.value === InvoiceCondition.AUTHORIZED; });
3385
+ }
3386
+ else {
3387
+ return this.invoiceConditions.filter(function (cond) { return cond.value !== InvoiceCondition.AUTHORIZED; });
3388
+ }
3389
+ };
3364
3390
  DocumentGridComponent.prototype.ngOnInit = function () {
3365
3391
  this.verifyClienteExterno();
3366
3392
  this.getProcessTypeByScheduling();
3367
3393
  this.listDocuments(false);
3368
3394
  };
3369
- DocumentGridComponent.prototype.ngAfterContentChecked = function () {
3370
- this.gridColumns = this.getGridColumns();
3371
- };
3372
3395
  DocumentGridComponent.prototype.verifyClienteExterno = function () {
3373
3396
  var _this = this;
3374
3397
  this.agendaService.isClienteExterno()
3375
3398
  .subscribe(function (result) {
3376
3399
  _this.isClienteExterno = result.isClienteExterno;
3400
+ _this.gridColumns = _this.getGridColumns();
3377
3401
  _this.cantEditStatus();
3378
3402
  });
3379
3403
  };
@@ -3395,7 +3419,7 @@
3395
3419
  }
3396
3420
  this.gridData.push(document);
3397
3421
  this.disabled = false;
3398
- this.utils.message("success", "yms.int.wms_saved_document_message_title", "yms.int.wms_success_message_description");
3422
+ this.utils.message("success", this.summary, "yms.int.wms_success_message_description");
3399
3423
  this.visibleDocumentRegister = false;
3400
3424
  this.visibleInvoiceKey = false;
3401
3425
  };
@@ -3475,12 +3499,18 @@
3475
3499
  }
3476
3500
  data.key = _this.updateKeyByWms(data);
3477
3501
  _this.documentService.insert(data).subscribe(function () {
3478
- _this.utils.message("success", "yms.int.wms_saved_document_message_title", "saved_message_content");
3502
+ _this.sucessMessage();
3479
3503
  });
3480
3504
  _this.disabled = true;
3481
- _this.listDocuments(false);
3505
+ }
3506
+ else {
3507
+ _this.documentService.update(data.id, data).subscribe(function () {
3508
+ _this.sucessMessage();
3509
+ _this.disabled = true;
3510
+ });
3482
3511
  }
3483
3512
  });
3513
+ this.listDocuments(false);
3484
3514
  }
3485
3515
  };
3486
3516
  DocumentGridComponent.prototype.updateKeyByWms = function (data) {
@@ -3521,10 +3551,14 @@
3521
3551
  }
3522
3552
  });
3523
3553
  };
3554
+ DocumentGridComponent.prototype.notSavedDocuments = function () {
3555
+ return this.gridData.some(function (document) { return !document.id; });
3556
+ };
3524
3557
  DocumentGridComponent.prototype.listDocuments = function (isDelete) {
3525
3558
  var _this = this;
3526
3559
  this.documentService.list({
3527
- filterQuery: "schedulingId eq '" + this.agenda.id + "'"
3560
+ filterQuery: "schedulingId eq '" + this.agenda.id + "'",
3561
+ size: 100
3528
3562
  })
3529
3563
  .subscribe(function (contents) {
3530
3564
  var _a;
@@ -3543,20 +3577,46 @@
3543
3577
  });
3544
3578
  };
3545
3579
  DocumentGridComponent.prototype.getGridColumns = function () {
3546
- if (this.isWmsSeniorConnect()) {
3547
- return __spread([
3548
- { field: "key", header: this.translate.instant("yms.int.wms_purchaseOrder") }
3549
- ], this.getColumnPartner());
3550
- }
3551
- if (this.isWmsWIS()) {
3552
- return this.getColumnInvoiceAndlogistcUnit();
3553
- }
3554
- return __spread([
3580
+ var result;
3581
+ switch (this.wmsSystem) {
3582
+ case WmsSystem.SENIOR_CONNECT:
3583
+ result = this.wmsSeniorConnectIntegration();
3584
+ break;
3585
+ case WmsSystem.WIS:
3586
+ result = this.wmsWisIntegration();
3587
+ break;
3588
+ case WmsSystem.SENIOR:
3589
+ result = this.wmsSiltIntegration();
3590
+ break;
3591
+ default:
3592
+ result = [];
3593
+ }
3594
+ return result;
3595
+ };
3596
+ DocumentGridComponent.prototype.wmsSeniorConnectIntegration = function () {
3597
+ var columns = __spread([
3598
+ { field: "key", header: this.translate.instant("yms.int.wms_purchaseOrder") }
3599
+ ], this.getColumnPartner());
3600
+ this.addInvoiceSituationIfNotClienteExterno(columns);
3601
+ return columns;
3602
+ };
3603
+ DocumentGridComponent.prototype.wmsWisIntegration = function () {
3604
+ var columns = __spread(this.getColumnInvoiceAndlogistcUnit());
3605
+ this.addInvoiceSituationIfNotClienteExterno(columns);
3606
+ return columns;
3607
+ };
3608
+ DocumentGridComponent.prototype.wmsSiltIntegration = function () {
3609
+ var columns = __spread([
3555
3610
  { field: "invoiceKey", header: this.translate.instant("yms.int.wms_register_document_invoice_key") }
3556
3611
  ], this.getColumnInvoiceAndlogistcUnit(), [
3557
3612
  { field: "ownerName", header: this.translate.instant("yms.int.wms_register_document_owner_name") },
3558
3613
  { field: "ownerDocument", header: this.translate.instant("yms.int.wms_register_document_owner_document") },
3559
3614
  ]);
3615
+ this.addInvoiceSituationIfNotClienteExterno(columns);
3616
+ return columns;
3617
+ };
3618
+ DocumentGridComponent.prototype.getColumninvoiceCondition = function () {
3619
+ return { field: "invoiceCondition", header: this.translate.instant("yms.int.wms_grid_document_invoice_condition") };
3560
3620
  };
3561
3621
  DocumentGridComponent.prototype.getColumnInvoiceAndlogistcUnit = function () {
3562
3622
  return __spread([
@@ -3573,12 +3633,23 @@
3573
3633
  { field: "partnerDocument", header: this.translate.instant("yms.int.wms_register_document_partner_document") },
3574
3634
  ];
3575
3635
  };
3636
+ DocumentGridComponent.prototype.addInvoiceSituationIfNotClienteExterno = function (columns) {
3637
+ if (!this.isClienteExterno) {
3638
+ columns.push(this.getColumninvoiceCondition());
3639
+ }
3640
+ };
3576
3641
  DocumentGridComponent.prototype.isWmsSeniorConnect = function () {
3577
3642
  return this.wmsSystem === WmsSystem.SENIOR_CONNECT;
3578
3643
  };
3579
3644
  DocumentGridComponent.prototype.isWmsWIS = function () {
3580
3645
  return this.wmsSystem === WmsSystem.WIS;
3581
3646
  };
3647
+ DocumentGridComponent.prototype.isWmsSilt = function () {
3648
+ return this.wmsSystem === WmsSystem.SENIOR;
3649
+ };
3650
+ DocumentGridComponent.prototype.sucessMessage = function () {
3651
+ return this.utils.message("success", this.summary, "saved_message_content");
3652
+ };
3582
3653
  __decorate([
3583
3654
  core.Input(),
3584
3655
  __metadata("design:type", Object)
@@ -3626,8 +3697,8 @@
3626
3697
  DocumentGridComponent = __decorate([
3627
3698
  core.Component({
3628
3699
  selector: 'document-grid',
3629
- 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>",
3630
- 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}"]
3700
+ 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 [disabled]=\"notSavedDocuments()\"\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\" [scrollable]=\"true\" [resizableColumns]=\"true\"\n [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\" pResizableColumn>\n <div class=\"senior-header\">\n <span class=\"senior-header-title\">{{ col.header }}</span>\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 *ngIf=\"isWmsSeniorConnect()\" (click)=\"selection = [rowData]\">\n <span>{{rowData[\"key\"]}}</span>\n </td>\n <td *ngIf=\"isWmsSilt()\" (click)=\"selection = [rowData]\">\n <span>{{rowData[\"invoiceKey\"]}}</span>\n </td>\n <td *ngIf=\"isWmsWIS() || isWmsSilt()\" (click)=\"selection = [rowData]\">\n <span>{{rowData[\"invoiceNumber\"]}}</span>\n </td>\n <td *ngIf=\"isWmsWIS() || isWmsSilt()\" (click)=\"selection = [rowData]\">\n <span>{{rowData[\"invoiceSerialNumber\"]}}</span>\n </td>\n <td *ngIf=\"isWmsWIS() || isWmsSeniorConnect() || isWmsSilt()\" (click)=\"selection = [rowData]\">\n <span>{{rowData[\"partnerName\"]}}</span>\n </td>\n <td *ngIf=\"isWmsWIS() || isWmsSeniorConnect() || isWmsSilt()\" (click)=\"selection = [rowData]\">\n <span>{{rowData[\"partnerDocument\"]}}</span>\n </td>\n <td *ngIf=\"isWmsWIS() || isWmsSilt()\" (click)=\"selection = [rowData]\">\n <span>{{rowData[\"logistcUnitName\"]}}</span>\n </td>\n <td *ngIf=\"isWmsWIS() || isWmsSilt()\" (click)=\"selection = [rowData]\">\n <span>{{rowData[\"logistcUnitDocument\"]}}</span>\n </td>\n <td *ngIf=\"isWmsSilt()\" (click)=\"selection = [rowData]\">\n <span>{{rowData[\"ownerName\"]}}</span>\n </td>\n <td *ngIf=\"isWmsSilt()\" (click)=\"selection = [rowData]\">\n <span>{{rowData[\"ownerDocument\"]}}</span>\n </td>\n <td *ngIf=\"!isClienteExterno\" (click)=\"selection = [rowData]\">\n <p-dropdown\n inputId=\"invoiceCondition\"\n name=\"invoiceCondition\"\n [autoWidth]=\"false\"\n [options]=\"getFilteredInvoiceConditions(rowData?.invoiceCondition)\"\n appendTo=\"body\"\n [(ngModel)]=\"rowData.invoiceCondition\"\n (onChange)=\"disabled = false\">\n </p-dropdown>\n </td>\n </tr>\n </ng-template>\n <ng-template pTemplate=\"paginatorright\">\n <span [translate]=\"'yms.main.total_records'\" \n [translateParams]=\"{ value: documentTotalRecords }\">\n </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 [isClienteExterno]=\"isClienteExterno\">\n </register-document> \n <insert-key\n [wmsSystem]=\"wmsSystem\" \n (document)=\"onChangeDocument($event)\"\n [(visible)]=\"visibleInvoiceKey\">\n </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\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 </s-empty-state>\n </div>\n</ng-template>",
3701
+ 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}.invoice-condition .p-dropdown{position:relative;z-index:1000}"]
3631
3702
  }),
3632
3703
  __metadata("design:paramtypes", [core$1.TranslateService,
3633
3704
  DocumentService,
@@ -3661,6 +3732,7 @@
3661
3732
  "ownerDocument",
3662
3733
  "partnerName",
3663
3734
  "partnerDocument",
3735
+ "invoiceCondition",
3664
3736
  "notes",
3665
3737
  "code",
3666
3738
  "createdBy",
@@ -3681,13 +3753,21 @@
3681
3753
  }());
3682
3754
 
3683
3755
  var RegisterDocumentComponent = /** @class */ (function () {
3684
- function RegisterDocumentComponent(fb, utils) {
3756
+ function RegisterDocumentComponent(fb, translate) {
3685
3757
  this.fb = fb;
3686
- this.utils = utils;
3758
+ this.translate = translate;
3687
3759
  this.document = new core.EventEmitter();
3688
3760
  this.visible = new core.EventEmitter();
3689
3761
  this.visibleChange = new core.EventEmitter();
3690
3762
  this.isSaveFormValid = false;
3763
+ this.invoiceCondition = [
3764
+ { label: this.translate.instant("yms.int.wms_grid_document_invoice_no_way"), value: null },
3765
+ { label: this.translate.instant("yms.int.wms_grid_document_invoice_condition_authorized"), value: InvoiceCondition.AUTHORIZED },
3766
+ { label: this.translate.instant("yms.int.wms_grid_document_invoice_condition_manual_authorized"), value: InvoiceCondition.MANUAL_AUTHORIZED },
3767
+ { label: this.translate.instant("yms.int.wms_grid_document_invoice_condition_partial_authorized"), value: InvoiceCondition.PARTIAL_AUTHORIZED },
3768
+ { label: this.translate.instant("yms.int.wms_grid_document_invoice_condition_devolution"), value: InvoiceCondition.DEVOLUTION },
3769
+ { label: this.translate.instant("yms.int.wms_grid_document_invoice_condition_rejected"), value: InvoiceCondition.REJECTED },
3770
+ ];
3691
3771
  }
3692
3772
  RegisterDocumentComponent.prototype.ngOnInit = function () {
3693
3773
  this.getFormGroup();
@@ -3725,6 +3805,7 @@
3725
3805
  this.formGroup.get('partnerDocument').setValue(document.partnerDocument);
3726
3806
  this.formGroup.get('ownerDocument').setValue(document.ownerDocument);
3727
3807
  this.formGroup.get('ownerName').setValue(document.ownerName);
3808
+ this.formGroup.get('invoiceCondition').setValue(document.invoiceCondition);
3728
3809
  };
3729
3810
  RegisterDocumentComponent.prototype.getFormGroup = function () {
3730
3811
  this.formGroup = this.fb.group({
@@ -3741,6 +3822,7 @@
3741
3822
  partnerDocument: [undefined],
3742
3823
  notes: [undefined],
3743
3824
  code: [undefined],
3825
+ invoiceCondition: [undefined],
3744
3826
  });
3745
3827
  };
3746
3828
  RegisterDocumentComponent.prototype.save = function () {
@@ -3772,6 +3854,10 @@
3772
3854
  core.Input(),
3773
3855
  __metadata("design:type", Agenda)
3774
3856
  ], RegisterDocumentComponent.prototype, "agenda", void 0);
3857
+ __decorate([
3858
+ core.Input(),
3859
+ __metadata("design:type", Boolean)
3860
+ ], RegisterDocumentComponent.prototype, "isClienteExterno", void 0);
3775
3861
  __decorate([
3776
3862
  core.Output(),
3777
3863
  __metadata("design:type", core.EventEmitter)
@@ -3791,10 +3877,9 @@
3791
3877
  RegisterDocumentComponent = __decorate([
3792
3878
  core.Component({
3793
3879
  selector: "register-document",
3794
- template: "<s-sidebar\n [visible]=\"visible\"\n header=\"{{ 'yms.int.wms_register_document_add_document' | translate }} {{ wmsSystem }}\"\n (visibleChange)=\"close()\"\n (onclose)=\"close()\">\n <form [formGroup]=\"formGroup\">\n <div class=\"ui-g ui-fluid\">\n <div class=\"ui-g-6\" *ngIf=\"isWmsSeniorConnect()\">\n <label for=\"key\">{{'yms.int.wms_purchaseOrder' | translate}}</label>\n <input id=\"key\" pInputText type=\"text\" formControlName=\"key\">\n </div>\n <div class=\"ui-g-6\" *ngIf=\"!isWmsSeniorConnect() && !isWmsWis()\">\n <label for=\"invoiceKey\">{{'yms.int.wms_register_document_invoice_key' | translate}}</label>\n <input id=\"invoiceKey\" pInputText type=\"text\" formControlName=\"invoiceKey\">\n </div>\n <div class=\"ui-g-6\" *ngIf=\"!isWmsSeniorConnect()\">\n <label for=\"invoiceNumber\">{{'yms.int.wms_register_document_invoice_number' | translate}}</label>\n <input id=\"invoiceNumber\" pInputText type=\"text\" formControlName=\"invoiceNumber\">\n </div>\n <div class=\"ui-g-6\" *ngIf=\"!isWmsSeniorConnect()\">\n <label for=\"invoiceSerialNumber\">\n {{'yms.int.wms_register_document_invoice_serial_number' | translate}}\n </label>\n <input id=\"invoiceSerialNumber\" pInputText type=\"text\" formControlName=\"invoiceSerialNumber\">\n </div>\n <div class=\"ui-g-8\">\n <label for=\"logistcUnitName\">{{'yms.int.wms_register_document_logistc_unit_name' | translate}}</label>\n <input id=\"logistcUnitName\" pInputText type=\"text\" formControlName=\"logistcUnitName\">\n </div>\n <div class=\"ui-g-4\">\n <label for=\"logistcUnitDocument\">\n {{'yms.int.wms_register_document_logistc_unit_document' | translate}}\n </label>\n <input id=\"logistcUnitDocument\" pInputText type=\"text\" formControlName=\"logistcUnitDocument\">\n </div>\n <div class=\"ui-g-8\" *ngIf=\"!isWmsSeniorConnect() && !isWmsWis()\">\n <label for=\"documentOwnerName\">{{'yms.int.wms_register_document_owner_name' | translate}}</label>\n <input id=\"documentOwnerName\" pInputText type=\"text\" formControlName=\"ownerName\">\n </div>\n <div class=\"ui-g-4\" *ngIf=\"!isWmsSeniorConnect() && !isWmsWis()\">\n <label for=\"ownerDocument\">{{'yms.int.wms_register_document_owner_document' | translate}}</label>\n <input id=\"ownerDocument\" pInputText type=\"text\" formControlName=\"ownerDocument\">\n </div>\n <div class=\"ui-g-8\">\n <label for=\"partnerName\">{{'yms.int.wms_register_document_partner_name' | translate}}</label>\n <input id=\"partnerName\" pInputText type=\"text\" formControlName=\"partnerName\">\n </div>\n <div class=\"ui-g-4\">\n <label for=\"partnerDocument\">{{'yms.int.wms_register_document_partner_document' | translate}}</label>\n <input id=\"partnerDocument\" pInputText type=\"text\" formControlName=\"partnerDocument\">\n </div>\n <div class=\"ui-g-12\">\n <label for=\"notes\" id=\"notes\">{{'yms.int.wms_register_document_notes' | translate}}</label>\n <textarea id=\"notes\" rows=\"4\" pInputTextarea autoResize=\"autoResize\" formControlName=\"notes\"></textarea>\n </div>\n <div class=\"ui-g-4\">\n <label for=\"code\">\n {{'yms.int.wms_register_document_order_receiving_code' | translate}}\n </label>\n <input id=\"code\" pInputText type=\"text\" formControlName=\"code\">\n </div>\n </div>\n </form>\n <div class=\"space-between\">\n <button\n pButton label=\"{{'save' | translate}}\"\n (click)=\"save()\"\n [attr.data-hidden]=\"hideSaveButton\"\n [disabled]=\"!isSaveFormValid\">\n </button>\n <button\n type=\"button\" class=\"ui-button-link\" pButton label=\"{{'cancel' | translate}}\" (click)=\"close()\">\n </button>\n </div>\n</s-sidebar>"
3880
+ template: "<s-sidebar\n [visible]=\"visible\"\n header=\"{{ 'yms.int.wms_register_document_add_document' | translate }} {{ wmsSystem }}\"\n (visibleChange)=\"close()\"\n (onclose)=\"close()\">\n <form [formGroup]=\"formGroup\">\n <div class=\"ui-g ui-fluid\">\n <div class=\"ui-g-6\" *ngIf=\"isWmsSeniorConnect()\">\n <label for=\"key\">{{'yms.int.wms_purchaseOrder' | translate}}</label>\n <input id=\"key\" pInputText type=\"text\" formControlName=\"key\">\n </div>\n <div class=\"ui-g-6\" *ngIf=\"!isWmsSeniorConnect() && !isWmsWis()\">\n <label for=\"invoiceKey\">{{'yms.int.wms_register_document_invoice_key' | translate}}</label>\n <input id=\"invoiceKey\" pInputText type=\"text\" formControlName=\"invoiceKey\">\n </div>\n <div class=\"ui-g-6\" *ngIf=\"!isWmsSeniorConnect()\">\n <label for=\"invoiceNumber\">{{'yms.int.wms_register_document_invoice_number' | translate}}</label>\n <input id=\"invoiceNumber\" pInputText type=\"text\" formControlName=\"invoiceNumber\">\n </div>\n <div class=\"ui-g-6\" *ngIf=\"!isWmsSeniorConnect()\">\n <label for=\"invoiceSerialNumber\">\n {{'yms.int.wms_register_document_invoice_serial_number' | translate}}\n </label>\n <input id=\"invoiceSerialNumber\" pInputText type=\"text\" formControlName=\"invoiceSerialNumber\">\n </div>\n <div class=\"ui-g-8\">\n <label for=\"logistcUnitName\">{{'yms.int.wms_register_document_logistc_unit_name' | translate}}</label>\n <input id=\"logistcUnitName\" pInputText type=\"text\" formControlName=\"logistcUnitName\">\n </div>\n <div class=\"ui-g-4\">\n <label for=\"logistcUnitDocument\">\n {{'yms.int.wms_register_document_logistc_unit_document' | translate}}\n </label>\n <input id=\"logistcUnitDocument\" pInputText type=\"text\" formControlName=\"logistcUnitDocument\">\n </div>\n <div class=\"ui-g-8\" *ngIf=\"!isWmsSeniorConnect() && !isWmsWis()\">\n <label for=\"documentOwnerName\">{{'yms.int.wms_register_document_owner_name' | translate}}</label>\n <input id=\"documentOwnerName\" pInputText type=\"text\" formControlName=\"ownerName\">\n </div>\n <div class=\"ui-g-4\" *ngIf=\"!isWmsSeniorConnect() && !isWmsWis()\">\n <label for=\"ownerDocument\">{{'yms.int.wms_register_document_owner_document' | translate}}</label>\n <input id=\"ownerDocument\" pInputText type=\"text\" formControlName=\"ownerDocument\">\n </div>\n <div class=\"ui-g-8\">\n <label for=\"partnerName\">{{'yms.int.wms_register_document_partner_name' | translate}}</label>\n <input id=\"partnerName\" pInputText type=\"text\" formControlName=\"partnerName\">\n </div>\n <div class=\"ui-g-4\">\n <label for=\"partnerDocument\">{{'yms.int.wms_register_document_partner_document' | translate}}</label>\n <input id=\"partnerDocument\" pInputText type=\"text\" formControlName=\"partnerDocument\">\n </div>\n <div class=\"ui-g-12\">\n <label for=\"notes\" id=\"notes\">{{'yms.int.wms_register_document_notes' | translate}}</label>\n <textarea id=\"notes\" rows=\"4\" pInputTextarea autoResize=\"autoResize\" formControlName=\"notes\"></textarea>\n </div>\n <div class=\"ui-g-4\">\n <label for=\"code\">\n {{'yms.int.wms_register_document_order_receiving_code' | translate}}\n </label>\n <input id=\"code\" pInputText type=\"text\" formControlName=\"code\">\n </div>\n <div class=\"ui-g-4\" *ngIf=\"!isClienteExterno\">\n <label for=\"invoiceCondition\" id=\"invoiceCondition\">\n {{'yms.int.wms_grid_document_invoice_condition' | translate}}\n </label>\n <p-dropdown\n inputId=\"invoiceCondition\"\n name=\"invoiceCondition\"\n [autoWidth]=\"false\"\n [options]=\"invoiceCondition\"\n formControlName=\"invoiceCondition\"\n ></p-dropdown>\n </div>\n </div>\n </form>\n <div class=\"space-between\">\n <button\n pButton label=\"{{'save' | translate}}\"\n (click)=\"save()\"\n [attr.data-hidden]=\"hideSaveButton\"\n [disabled]=\"!isSaveFormValid\">\n </button>\n <button\n type=\"button\" class=\"ui-button-link\" pButton label=\"{{'cancel' | translate}}\" (click)=\"close()\">\n </button>\n </div>\n</s-sidebar>"
3795
3881
  }),
3796
- __metadata("design:paramtypes", [forms.FormBuilder,
3797
- UtilsMessageService])
3882
+ __metadata("design:paramtypes", [forms.FormBuilder, core$1.TranslateService])
3798
3883
  ], RegisterDocumentComponent);
3799
3884
  return RegisterDocumentComponent;
3800
3885
  }());
@@ -3814,7 +3899,8 @@
3814
3899
  primeng.InputTextModule,
3815
3900
  angularComponents.ControlErrorsModule,
3816
3901
  primeng.InputTextareaModule,
3817
- forms.ReactiveFormsModule
3902
+ forms.ReactiveFormsModule,
3903
+ primeng.DropdownModule,
3818
3904
  ],
3819
3905
  exports: [RegisterDocumentComponent],
3820
3906
  declarations: [RegisterDocumentComponent],
@@ -3824,17 +3910,38 @@
3824
3910
  return RegisterDocumentModule;
3825
3911
  }());
3826
3912
 
3913
+ var ExternalTenantService = /** @class */ (function (_super) {
3914
+ __extends(ExternalTenantService, _super);
3915
+ function ExternalTenantService(http, messageService) {
3916
+ var _this = _super.call(this, http, messageService, 'yms/agenda/entities/externalTenant', '') || this;
3917
+ _this.http = http;
3918
+ _this.messageService = messageService;
3919
+ return _this;
3920
+ }
3921
+ ExternalTenantService = __decorate([
3922
+ core.Injectable(),
3923
+ __metadata("design:paramtypes", [http.HttpClient, api.MessageService])
3924
+ ], ExternalTenantService);
3925
+ return ExternalTenantService;
3926
+ }(EntityService));
3927
+
3827
3928
  var InsertKeyComponent = /** @class */ (function () {
3828
- function InsertKeyComponent(formBuilder, documentService, utils) {
3929
+ function InsertKeyComponent(formBuilder, documentService, utils, confirmationService, translate, externalTenantService) {
3829
3930
  this.formBuilder = formBuilder;
3830
3931
  this.documentService = documentService;
3831
3932
  this.utils = utils;
3933
+ this.confirmationService = confirmationService;
3934
+ this.translate = translate;
3935
+ this.externalTenantService = externalTenantService;
3832
3936
  this.document = new core.EventEmitter();
3833
3937
  this.visible = new core.EventEmitter();
3834
3938
  this.visibleChange = new core.EventEmitter();
3835
3939
  this.isLoading = false;
3940
+ this.isPartnerloading = false;
3941
+ this.ngUnsubscribe = new rxjs.Subject();
3836
3942
  }
3837
3943
  InsertKeyComponent.prototype.ngOnInit = function () {
3944
+ var _this = this;
3838
3945
  this.formGroup = this.formBuilder.group({
3839
3946
  key: [undefined],
3840
3947
  purchaseOrder: [undefined],
@@ -3842,6 +3949,9 @@
3842
3949
  invoiceSerie: [undefined],
3843
3950
  partnerDocument: [undefined]
3844
3951
  });
3952
+ this.formGroup.get('key').valueChanges.subscribe(function (nf) {
3953
+ _this.validateKeyDetails(nf);
3954
+ });
3845
3955
  };
3846
3956
  InsertKeyComponent.prototype.isWmsWis = function () {
3847
3957
  return this.wmsSystem === WmsSystem.WIS;
@@ -3874,6 +3984,7 @@
3874
3984
  else {
3875
3985
  _this.utils.translateMessage("error", "yms.int.wms_error_search_document_message_header", "yms.int.wms_error_unknown_search_document_message_content" + err.error.message);
3876
3986
  }
3987
+ _this.confirmInvoiceDialog();
3877
3988
  return rxjs.throwError(err);
3878
3989
  }), operators.finalize(function () {
3879
3990
  _this.isLoading = false;
@@ -3883,10 +3994,88 @@
3883
3994
  _this.utils.message("warn", "yms.int.wms_insert_key_warning_message_header", "yms.int.wms_insert_key_warning_message_description");
3884
3995
  return;
3885
3996
  }
3886
- _this.document.emit(content.contents[0]);
3997
+ var document = content.contents[0];
3998
+ document.invoiceKey = _this.formGroup.get('key').value;
3999
+ document.invoiceCondition = InvoiceCondition.AUTHORIZED;
4000
+ _this.document.emit(document);
4001
+ _this.formGroup.reset();
4002
+ });
4003
+ };
4004
+ InsertKeyComponent.prototype.confirmInvoiceDialog = function () {
4005
+ var _this = this;
4006
+ this.confirmationService.confirm({
4007
+ message: this.translate.instant("yms.int.wms_message_confirm_invoice_dialog"),
4008
+ acceptLabel: this.translate.instant("yms.int.wms_accept_confirm_invoice_dialog"),
4009
+ rejectLabel: this.translate.instant("yms.int.wms_reject_confirm_invoice_dialog"),
4010
+ header: this.translate.instant("yms.int.wms_header_content_confirm_invoice_dialog"),
4011
+ accept: function () { return _this.buildInvoice(); }
4012
+ });
4013
+ };
4014
+ InsertKeyComponent.prototype.buildInvoice = function () {
4015
+ var _this = this;
4016
+ this.isPartnerloading = true;
4017
+ var partnerDocument = this.formGroup.get('partnerDocument').value;
4018
+ this.externalTenantService.list({
4019
+ filterQuery: "cnpj eq '" + partnerDocument + "'"
4020
+ })
4021
+ .pipe(operators.takeUntil(this.ngUnsubscribe), operators.finalize(function () {
4022
+ _this.isPartnerloading = false;
4023
+ }))
4024
+ .subscribe(function (contents) {
4025
+ var documentInvoice = _this.createDocumentInvoice(contents);
4026
+ _this.document.emit(documentInvoice);
3887
4027
  _this.formGroup.reset();
3888
4028
  });
3889
4029
  };
4030
+ InsertKeyComponent.prototype.createDocumentInvoice = function (partners) {
4031
+ var documentInvoice = {
4032
+ invoiceKey: this.formGroup.get('key').value,
4033
+ invoiceNumber: this.formGroup.get('invoiceNumber').value,
4034
+ invoiceSerialNumber: this.formGroup.get('invoiceSerie').value,
4035
+ partnerDocument: this.formGroup.get('partnerDocument').value,
4036
+ partnerName: null,
4037
+ type: null,
4038
+ key: null,
4039
+ schedulingId: null
4040
+ };
4041
+ if (partners.totalElements > 0) {
4042
+ var partner = partners.contents[0];
4043
+ documentInvoice.partnerName = partner.descricao;
4044
+ }
4045
+ return documentInvoice;
4046
+ };
4047
+ InsertKeyComponent.prototype.validateKeyDetails = function (nf) {
4048
+ if (!nf) {
4049
+ this.keyErrorMessage = null;
4050
+ this.setValuesOfKey(undefined, undefined, undefined);
4051
+ return;
4052
+ }
4053
+ var nfLength = 44;
4054
+ if (nf.length === nfLength) {
4055
+ this.keyErrorMessage = null;
4056
+ this.extractKeyDetails(nf);
4057
+ }
4058
+ else {
4059
+ this.keyErrorMessage = "yms.int.wms_error_key_message";
4060
+ }
4061
+ };
4062
+ InsertKeyComponent.prototype.extractKeyDetails = function (nf) {
4063
+ var startCnpj = 6;
4064
+ var endCnpj = 20;
4065
+ var cnpj = nf.substring(startCnpj, endCnpj);
4066
+ var startSerie = 22;
4067
+ var endSerie = 25;
4068
+ var serie = nf.substring(startSerie, endSerie);
4069
+ var startInvoice = 25;
4070
+ var endInvoice = 34;
4071
+ var invoice = nf.substring(startInvoice, endInvoice);
4072
+ this.setValuesOfKey(invoice, serie, cnpj);
4073
+ };
4074
+ InsertKeyComponent.prototype.setValuesOfKey = function (invoiceNumber, invoiceSerie, partnerDocument) {
4075
+ this.formGroup.get('invoiceNumber').setValue(invoiceNumber);
4076
+ this.formGroup.get('invoiceSerie').setValue(invoiceSerie);
4077
+ this.formGroup.get('partnerDocument').setValue(partnerDocument);
4078
+ };
3890
4079
  InsertKeyComponent.prototype.cancel = function () {
3891
4080
  this.visibleChange.emit(false);
3892
4081
  };
@@ -3912,12 +4101,15 @@
3912
4101
  InsertKeyComponent = __decorate([
3913
4102
  core.Component({
3914
4103
  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}"]
4104
+ 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 || isPartnerloading\">\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",
4105
+ 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
4106
  }),
3918
4107
  __metadata("design:paramtypes", [forms.FormBuilder,
3919
4108
  DocumentService,
3920
- UtilsMessageService])
4109
+ UtilsMessageService,
4110
+ api.ConfirmationService,
4111
+ core$1.TranslateService,
4112
+ ExternalTenantService])
3921
4113
  ], InsertKeyComponent);
3922
4114
  return InsertKeyComponent;
3923
4115
  }());
@@ -3937,7 +4129,8 @@
3937
4129
  angularComponents.LoadingStateModule
3938
4130
  ],
3939
4131
  exports: [InsertKeyComponent],
3940
- declarations: [InsertKeyComponent]
4132
+ declarations: [InsertKeyComponent],
4133
+ providers: [ExternalTenantService]
3941
4134
  })
3942
4135
  ], InsertKeyModule);
3943
4136
  return InsertKeyModule;
@@ -3951,6 +4144,7 @@
3951
4144
  declarations: [DocumentGridComponent],
3952
4145
  entryComponents: [DocumentGridComponent],
3953
4146
  exports: [DocumentGridComponent],
4147
+ providers: [ExternalTenantService],
3954
4148
  imports: [
3955
4149
  common.CommonModule,
3956
4150
  core$1.TranslateModule,
@@ -3961,7 +4155,9 @@
3961
4155
  InsertKeyModule,
3962
4156
  button.ButtonModule,
3963
4157
  ymsComponents.ComponentsModule,
3964
- angularComponents.EmptyStateModule
4158
+ angularComponents.EmptyStateModule,
4159
+ primeng.DropdownModule,
4160
+ forms.FormsModule
3965
4161
  ],
3966
4162
  })
3967
4163
  ], DocumentGridModule);
@@ -4040,42 +4236,31 @@
4040
4236
  _this.getColumns = [];
4041
4237
  _this.documents = [];
4042
4238
  _this.labels = [];
4239
+ _this.selected = [];
4240
+ _this.gridLoading = true;
4241
+ _this.ngUnsubscribe = new rxjs.Subject();
4043
4242
  return _this;
4044
4243
  }
4045
- DocumentListComponent.prototype.ngOnInit = function () {
4046
- this.getSystemIntegration();
4047
- };
4048
- DocumentListComponent.prototype.getSystemIntegration = function () {
4049
- var _this = this;
4050
- this.documentService.getSystemIntegration().subscribe(function (system) {
4051
- _this.wmsSystem = system.system;
4052
- _this.getDocumentBySchedulingId();
4053
- });
4054
- };
4055
- DocumentListComponent.prototype.getDocumentBySchedulingId = function () {
4056
- var _this = this;
4057
- this.documentService.list({
4058
- filterQuery: "schedulingId eq '" + this.agenda.id + "'"
4059
- }).subscribe(function (contents) {
4060
- if (contents.totalElements > 0) {
4061
- _this.documents = contents.contents;
4062
- _this.getColumns = _this.getColumnLabels();
4063
- }
4064
- });
4065
- };
4066
4244
  DocumentListComponent.prototype.getColumnLabels = function () {
4067
4245
  if (this.isWmsWIS()) {
4068
- return __spread(this.getLabelsInvoice());
4246
+ return __spread(this.getLabelsInvoice(), [
4247
+ { field: "invoiceKey", label: 'yms.int.wms_register_document_invoice_invoice_key' },
4248
+ { field: "partnerName", label: 'yms.int.wms_register_document_invoice_partner_name' },
4249
+ { field: "partnerDocument", label: 'yms.int.wms_register_document_invoice_partner_document' },
4250
+ { field: "code", label: 'yms.int.wms_register_document_invoice_code' },
4251
+ { field: "invoiceCondition", label: 'yms.int.wms_register_document_invoice_condition' },
4252
+ { field: "notes", label: 'yms.int.wms_register_document_invoice_notes' },
4253
+ ]);
4069
4254
  }
4070
4255
  if (this.isWmsSeniorConnect()) {
4071
4256
  return [
4072
- { label: 'yms.int.wms_purchaseOrder' },
4073
- { label: 'yms.int.wms_register_document_partner_name' },
4074
- { label: 'yms.int.wms_register_document_partner_document' }
4257
+ { field: "key", label: 'yms.int.wms_purchaseOrder' },
4258
+ { field: "partnerName", label: 'yms.int.wms_register_document_invoice_partner_name' },
4259
+ { field: "partnerDocument", label: 'yms.int.wms_register_document_invoice_partner_document' },
4075
4260
  ];
4076
4261
  }
4077
4262
  return __spread([
4078
- { label: 'yms.int.wms_register_document_invoice_key' }
4263
+ { field: "invoiceKey", label: 'yms.int.wms_register_document_invoice_key' }
4079
4264
  ], this.getLabelsInvoice());
4080
4265
  };
4081
4266
  DocumentListComponent.prototype.isWmsSeniorConnect = function () {
@@ -4086,10 +4271,40 @@
4086
4271
  };
4087
4272
  DocumentListComponent.prototype.getLabelsInvoice = function () {
4088
4273
  return [
4089
- { label: 'yms.int.wms_register_document_invoice_number' },
4090
- { label: 'yms.int.wms_register_document_invoice_serial_number' }
4274
+ { field: "invoiceNumber", label: 'yms.int.wms_register_document_invoice_number' },
4275
+ { field: "invoiceSerialNumber", label: 'yms.int.wms_register_document_invoice_serial_number' },
4091
4276
  ];
4092
4277
  };
4278
+ DocumentListComponent.prototype.getInvoiceConditionTranslation = function (invoiceCondition) {
4279
+ return invoiceCondition ? "yms.int.wms_document_invoice_condition_" + invoiceCondition : 'N/A';
4280
+ };
4281
+ DocumentListComponent.prototype.updateGridData = function (event) {
4282
+ var _this = this;
4283
+ this.documentService.getSystemIntegration().subscribe(function (system) {
4284
+ _this.wmsSystem = system.system;
4285
+ _this.searchDocument(event);
4286
+ });
4287
+ };
4288
+ DocumentListComponent.prototype.searchDocument = function (event) {
4289
+ var _this = this;
4290
+ var size = event.rows;
4291
+ var page = event.first / size;
4292
+ var sort = event.multiSortMeta;
4293
+ this.gridLoading = true;
4294
+ this.documentService.list({ page: page, size: size, sort: sort,
4295
+ filterQuery: "schedulingId eq '" + this.agenda.id + "'"
4296
+ })
4297
+ .pipe(operators.takeUntil(this.ngUnsubscribe), operators.finalize(function () {
4298
+ _this.gridLoading = false;
4299
+ }))
4300
+ .subscribe(function (contents) {
4301
+ if (contents.totalElements > 0) {
4302
+ _this.documents = contents.contents;
4303
+ _this.getColumns = _this.getColumnLabels();
4304
+ _this.gridTotalRecords = contents.totalElements;
4305
+ }
4306
+ });
4307
+ };
4093
4308
  __decorate([
4094
4309
  core.Input(),
4095
4310
  __metadata("design:type", Object)
@@ -4100,7 +4315,8 @@
4100
4315
  ], DocumentListComponent.prototype, "wmsSystem", void 0);
4101
4316
  DocumentListComponent = __decorate([
4102
4317
  core.Component({
4103
- template: "<div> \n <p-table [value]=\"documents\">\n <ng-template pTemplate=\"header\">\n <tr>\n <th id=\"columns\" *ngFor=\"let column of getColumns\">\n <div class=\"senior-header\">\n <span class=\"senior-header-title\">{{ column.label | translate }}</span>\n </div>\n </th>\n </tr>\n </ng-template>\n <ng-template let-rowData pTemplate=\"body\">\n <tr *ngIf=\"isWmsWIS()\">\n <td id=\"\">{{rowData?.invoiceNumber}}</td>\n <td id=\"\">{{rowData?.invoiceSerialNumber}}</td>\n </tr>\n <tr *ngIf=\"isWmsSeniorConnect()\">\n <td id=\"\">{{rowData?.key}}</td>\n <td id=\"\">{{rowData?.partnerName}}</td>\n <td id=\"\">{{rowData?.partnerDocument}}</td>\n </tr>\n <tr *ngIf=\"!isWmsWIS() && !isWmsSeniorConnect()\">\n <td id=\"\">{{rowData?.invoiceKey}}</td>\n <td id=\"\">{{rowData?.invoiceNumber}}</td>\n <td id=\"\">{{rowData?.invoiceSerialNumber}}</td>\n </tr>\n </ng-template>\n </p-table>\n</div>"
4318
+ template: "<div class=\"ui-g\">\n <div class=\"ui-g-12\">\n <p-table\n selectionMode=\"single\"\n [(selection)]=\"selected\"\n [value]=\"documents\"\n [columns]=\"getColumns\"\n dataKey=\"id\"\n rows=\"10\"\n [paginator]=\"true\"\n [totalRecords]=\"gridTotalRecords\"\n [lazy]=\"true\"\n [resizableColumns]=\"true\"\n (onLazyLoad)=\"updateGridData($event)\"\n *sLoadingState=\"gridLoading\"\n sortMode=\"multiple\"\n styleClass=\"sds-table-scrollable\"\n [rowsPerPageOptions]=\"[10, 20, 50, 100, 200]\"\n paginatorDropdownScrollHeight=\"250px\"\n [scrollable]=\"true\"\n >\n <ng-template pTemplate=\"colgroup\" let-columns>\n <colgroup>\n <col *ngFor=\"let col of columns\" class=\"table-col-width\">\n </colgroup>\n </ng-template>\n\n <ng-template pTemplate=\"header\" let-columns>\n <tr>\n <th *ngFor=\"let col of columns\" pResizableColumn [pSortableColumn]=\"col.field\" scope=\"col\">\n <div class=\"senior-header\">\n <span class=\"senior-header-title\">{{ col.label | translate }}</span>\n <p-sortIcon [field]=\"col.field\"></p-sortIcon>\n </div>\n </th>\n </tr>\n </ng-template>\n\n <ng-template pTemplate=\"body\" let-rowData let-columns=\"columns\">\n <tr *ngIf=\"isWmsWIS()\">\n <td>{{ rowData?.invoiceNumber || 'N/A' }}</td>\n <td>{{ rowData?.invoiceSerialNumber || 'N/A' }}</td>\n <td>{{ rowData?.invoiceKey || 'N/A' }}</td>\n <td>{{ rowData?.partnerName || 'N/A' }}</td>\n <td>{{ rowData?.partnerDocument || 'N/A' }}</td>\n <td>{{ rowData?.code || 'N/A' }}</td>\n <td>\n {{ getInvoiceConditionTranslation(rowData?.invoiceCondition) | translate }}\n </td>\n <td>{{ rowData?.notes || 'N/A' }}</td>\n </tr>\n <tr *ngIf=\"isWmsSeniorConnect()\">\n <td>{{rowData?.key}}</td>\n <td>{{rowData?.partnerName}}</td>\n <td>{{rowData?.partnerDocument}}</td>\n </tr>\n <tr *ngIf=\"!isWmsWIS() && !isWmsSeniorConnect()\">\n <td>{{rowData?.invoiceKey}}</td>\n <td>{{rowData?.invoiceNumber}}</td>\n <td>{{rowData?.invoiceSerialNumber}}</td>\n </tr>\n </ng-template>\n\n <ng-template pTemplate=\"paginatorright\">\n <span>\n {{ gridTotalRecords + \" \" + \n ('yms.int.wms_register_document_total_elements' | translate:{value: gridTotalRecords}) }}\n </span>\n </ng-template>\n </p-table>\n </div>\n</div>",
4319
+ styles: [".table-col-width{width:250px}"]
4104
4320
  }),
4105
4321
  __metadata("design:paramtypes", [DocumentService])
4106
4322
  ], DocumentListComponent);
@@ -14335,50 +14551,51 @@
14335
14551
  exports.ɵba = EntityService$2;
14336
14552
  exports.ɵbb = EntityService$1;
14337
14553
  exports.ɵbc = UtilsMessageService;
14338
- exports.ɵbd = RegisterDocumentModule;
14339
- exports.ɵbe = RegisterDocumentComponent;
14340
- exports.ɵbf = InsertKeyModule;
14341
- exports.ɵbg = InsertKeyComponent;
14342
- exports.ɵbh = IntegrationService$1;
14343
- exports.ɵbi = RecebimentoFormComponent;
14344
- exports.ɵbj = DerivacaoService;
14345
- exports.ɵbk = NotaValidatorService;
14346
- exports.ɵbl = TransgeniaService;
14347
- exports.ɵbm = VerificaNotafiscal;
14348
- exports.ɵbn = BuildFormField;
14349
- exports.ɵbo = ExpedicaoFormComponent;
14350
- exports.ɵbp = ExpedicaoInfoComponent;
14351
- exports.ɵbq = RecebimentoInfoComponent;
14352
- exports.ɵbr = DevolucaoFormComponent;
14353
- exports.ɵbs = DevolucaoService;
14354
- exports.ɵbt = DevolucaoChegadaVeiculoOverride;
14355
- exports.ɵbu = RecebimentoOrdemCompraFormComponent;
14356
- exports.ɵbv = OrdemCompraService;
14357
- exports.ɵbw = RecebimentoOrdemCompraService;
14358
- exports.ɵbx = RecebimentoOrdemCompraChegadaVeiculoOverride;
14359
- exports.ɵby = RecebimentoOrdemCompraInfoComponent;
14360
- exports.ɵbz = DevolucaoInfoComponent;
14554
+ exports.ɵbd = ExternalTenantService;
14555
+ exports.ɵbe = RegisterDocumentModule;
14556
+ exports.ɵbf = RegisterDocumentComponent;
14557
+ exports.ɵbg = InsertKeyModule;
14558
+ exports.ɵbh = InsertKeyComponent;
14559
+ exports.ɵbi = IntegrationService$1;
14560
+ exports.ɵbj = RecebimentoFormComponent;
14561
+ exports.ɵbk = DerivacaoService;
14562
+ exports.ɵbl = NotaValidatorService;
14563
+ exports.ɵbm = TransgeniaService;
14564
+ exports.ɵbn = VerificaNotafiscal;
14565
+ exports.ɵbo = BuildFormField;
14566
+ exports.ɵbp = ExpedicaoFormComponent;
14567
+ exports.ɵbq = ExpedicaoInfoComponent;
14568
+ exports.ɵbr = RecebimentoInfoComponent;
14569
+ exports.ɵbs = DevolucaoFormComponent;
14570
+ exports.ɵbt = DevolucaoService;
14571
+ exports.ɵbu = DevolucaoChegadaVeiculoOverride;
14572
+ exports.ɵbv = RecebimentoOrdemCompraFormComponent;
14573
+ exports.ɵbw = OrdemCompraService;
14574
+ exports.ɵbx = RecebimentoOrdemCompraService;
14575
+ exports.ɵby = RecebimentoOrdemCompraChegadaVeiculoOverride;
14576
+ exports.ɵbz = RecebimentoOrdemCompraInfoComponent;
14361
14577
  exports.ɵc = ViewImageComponent;
14362
- exports.ɵca = ContratoFormComponent;
14363
- exports.ɵcb = OrdemCompraFormComponent;
14364
- exports.ɵcc = ProcessoAvulsoFormComponent;
14365
- exports.ɵcd = ProcessoAvulsoService;
14366
- exports.ɵce = ProcessoAvulsoChegadaVeiculoOverride;
14367
- exports.ɵcf = ProcessoAvulsoInfoComponent;
14368
- exports.ɵcg = LogIntegracaoDescritor;
14369
- exports.ɵch = LogIntegracaoComponent;
14370
- exports.ɵci = LogIntegracaoService;
14371
- exports.ɵcj = DerivacaoModule;
14372
- exports.ɵck = DevolucaoModule;
14373
- exports.ɵcl = OrdemCompraModule;
14374
- exports.ɵcm = RecebimentoOrdemCompraModule;
14375
- exports.ɵcn = TransgeniaModule;
14376
- exports.ɵco = ProcessoAvulsoModule;
14377
- exports.ɵcp = LogIntegracaoModule;
14378
- exports.ɵcq = NotaFormModule;
14379
- exports.ɵcr = DirectivesModule;
14380
- exports.ɵcs = TrimDirective;
14381
- exports.ɵct = NotaFormComponent;
14578
+ exports.ɵca = DevolucaoInfoComponent;
14579
+ exports.ɵcb = ContratoFormComponent;
14580
+ exports.ɵcc = OrdemCompraFormComponent;
14581
+ exports.ɵcd = ProcessoAvulsoFormComponent;
14582
+ exports.ɵce = ProcessoAvulsoService;
14583
+ exports.ɵcf = ProcessoAvulsoChegadaVeiculoOverride;
14584
+ exports.ɵcg = ProcessoAvulsoInfoComponent;
14585
+ exports.ɵch = LogIntegracaoDescritor;
14586
+ exports.ɵci = LogIntegracaoComponent;
14587
+ exports.ɵcj = LogIntegracaoService;
14588
+ exports.ɵck = DerivacaoModule;
14589
+ exports.ɵcl = DevolucaoModule;
14590
+ exports.ɵcm = OrdemCompraModule;
14591
+ exports.ɵcn = RecebimentoOrdemCompraModule;
14592
+ exports.ɵco = TransgeniaModule;
14593
+ exports.ɵcp = ProcessoAvulsoModule;
14594
+ exports.ɵcq = LogIntegracaoModule;
14595
+ exports.ɵcr = NotaFormModule;
14596
+ exports.ɵcs = DirectivesModule;
14597
+ exports.ɵct = TrimDirective;
14598
+ exports.ɵcu = NotaFormComponent;
14382
14599
  exports.ɵd = LogDescritor;
14383
14600
  exports.ɵe = LogsComponent;
14384
14601
  exports.ɵf = PortariasService;