@seniorsistemas/yms-integration 1.32.0 → 1.34.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 (35) hide show
  1. package/bundles/seniorsistemas-yms-integration.umd.js +182 -54
  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 +69 -17
  6. package/esm2015/src/wms/components/document-grid/document-grid.module.js +6 -3
  7. package/esm2015/src/wms/components/document-grid/insert-key/insert-key.component.js +38 -3
  8. package/esm2015/src/wms/components/document-grid/register-document/register-document.component.js +20 -7
  9. package/esm2015/src/wms/components/document-grid/register-document/register-document.module.js +4 -3
  10. package/esm2015/src/wms/components/document-list/document-list.component.js +48 -28
  11. package/esm2015/src/wms/entities/document/document-dto.js +1 -1
  12. package/esm2015/src/wms/entities/document/document.js +2 -1
  13. package/esm2015/src/wms/entities/invoice-condition/invoice-condition.js +8 -0
  14. package/esm5/src/wms/components/document-grid/document-grid.component.js +66 -16
  15. package/esm5/src/wms/components/document-grid/document-grid.module.js +6 -3
  16. package/esm5/src/wms/components/document-grid/insert-key/insert-key.component.js +39 -3
  17. package/esm5/src/wms/components/document-grid/register-document/register-document.component.js +20 -7
  18. package/esm5/src/wms/components/document-grid/register-document/register-document.module.js +4 -3
  19. package/esm5/src/wms/components/document-list/document-list.component.js +51 -30
  20. package/esm5/src/wms/entities/document/document-dto.js +1 -1
  21. package/esm5/src/wms/entities/document/document.js +2 -1
  22. package/esm5/src/wms/entities/invoice-condition/invoice-condition.js +8 -0
  23. package/fesm2015/seniorsistemas-yms-integration.js +181 -53
  24. package/fesm2015/seniorsistemas-yms-integration.js.map +1 -1
  25. package/fesm5/seniorsistemas-yms-integration.js +182 -54
  26. package/fesm5/seniorsistemas-yms-integration.js.map +1 -1
  27. package/package.json +1 -1
  28. package/seniorsistemas-yms-integration.metadata.json +1 -1
  29. package/src/wms/components/document-grid/document-grid.component.d.ts +17 -8
  30. package/src/wms/components/document-grid/insert-key/insert-key.component.d.ts +4 -0
  31. package/src/wms/components/document-grid/register-document/register-document.component.d.ts +9 -3
  32. package/src/wms/components/document-list/document-list.component.d.ts +10 -5
  33. package/src/wms/entities/document/document-dto.d.ts +1 -0
  34. package/src/wms/entities/document/document.d.ts +2 -0
  35. package/src/wms/entities/invoice-condition/invoice-condition.d.ts +6 -0
@@ -3066,6 +3066,14 @@ var ProcessType;
3066
3066
  ProcessType["RECEBIMENTO_WMS"] = "RECEBIMENTO_WMS";
3067
3067
  })(ProcessType || (ProcessType = {}));
3068
3068
 
3069
+ var InvoiceCondition;
3070
+ (function (InvoiceCondition) {
3071
+ InvoiceCondition["AUTHORIZED"] = "AUTHORIZED";
3072
+ InvoiceCondition["PARTIAL_AUTHORIZED"] = "PARTIAL_AUTHORIZED";
3073
+ InvoiceCondition["MANUAL_AUTHORIZED"] = "MANUAL_AUTHORIZED";
3074
+ InvoiceCondition["DEVOLUTION"] = "DEVOLUTION";
3075
+ })(InvoiceCondition || (InvoiceCondition = {}));
3076
+
3069
3077
  let DocumentGridComponent = class DocumentGridComponent {
3070
3078
  constructor(translate, documentService, confirmationService, integrationService, agendaService, utils) {
3071
3079
  this.translate = translate;
@@ -3077,7 +3085,15 @@ let DocumentGridComponent = class DocumentGridComponent {
3077
3085
  this.viewDocument = new EventEmitter();
3078
3086
  this.gridData = [];
3079
3087
  this.enableButtonIsClienteExterno = true;
3088
+ this.summary = "yms.int.wms_saved_document_message_title";
3080
3089
  this.ngUnsubscribe = new Subject();
3090
+ this.invoiceCondition = [
3091
+ { label: this.translate.instant("yms.int.wms_grid_document_invoice_no_way"), value: null },
3092
+ { label: this.translate.instant("yms.int.wms_grid_document_invoice_condition_authorized"), value: InvoiceCondition.AUTHORIZED },
3093
+ { label: this.translate.instant("yms.int.wms_grid_document_invoice_condition_manual_authorized"), value: InvoiceCondition.MANUAL_AUTHORIZED },
3094
+ { label: this.translate.instant("yms.int.wms_grid_document_invoice_condition_partial_authorized"), value: InvoiceCondition.PARTIAL_AUTHORIZED },
3095
+ { label: this.translate.instant("yms.int.wms_grid_document_invoice_condition_devolucion"), value: InvoiceCondition.DEVOLUTION },
3096
+ ];
3081
3097
  this.selection = [];
3082
3098
  }
3083
3099
  ngOnInit() {
@@ -3085,13 +3101,11 @@ let DocumentGridComponent = class DocumentGridComponent {
3085
3101
  this.getProcessTypeByScheduling();
3086
3102
  this.listDocuments(false);
3087
3103
  }
3088
- ngAfterContentChecked() {
3089
- this.gridColumns = this.getGridColumns();
3090
- }
3091
3104
  verifyClienteExterno() {
3092
3105
  this.agendaService.isClienteExterno()
3093
3106
  .subscribe((result) => {
3094
3107
  this.isClienteExterno = result.isClienteExterno;
3108
+ this.gridColumns = this.getGridColumns();
3095
3109
  this.cantEditStatus();
3096
3110
  });
3097
3111
  }
@@ -3112,7 +3126,7 @@ let DocumentGridComponent = class DocumentGridComponent {
3112
3126
  }
3113
3127
  this.gridData.push(document);
3114
3128
  this.disabled = false;
3115
- this.utils.message("success", "yms.int.wms_saved_document_message_title", "yms.int.wms_success_message_description");
3129
+ this.utils.message("success", this.summary, "yms.int.wms_success_message_description");
3116
3130
  this.visibleDocumentRegister = false;
3117
3131
  this.visibleInvoiceKey = false;
3118
3132
  }
@@ -3190,11 +3204,17 @@ let DocumentGridComponent = class DocumentGridComponent {
3190
3204
  }
3191
3205
  data.key = this.updateKeyByWms(data);
3192
3206
  this.documentService.insert(data).subscribe(() => {
3193
- this.utils.message("success", "yms.int.wms_saved_document_message_title", "saved_message_content");
3207
+ this.sucessMessage();
3194
3208
  });
3195
3209
  this.disabled = true;
3196
3210
  this.listDocuments(false);
3197
3211
  }
3212
+ else {
3213
+ this.documentService.update(data.id, data).subscribe(() => {
3214
+ this.sucessMessage();
3215
+ this.disabled = true;
3216
+ });
3217
+ }
3198
3218
  });
3199
3219
  }
3200
3220
  }
@@ -3254,21 +3274,49 @@ let DocumentGridComponent = class DocumentGridComponent {
3254
3274
  });
3255
3275
  }
3256
3276
  getGridColumns() {
3257
- if (this.isWmsSeniorConnect()) {
3258
- return [
3259
- { field: "key", header: this.translate.instant("yms.int.wms_purchaseOrder") },
3260
- ...this.getColumnPartner()
3261
- ];
3262
- }
3263
- if (this.isWmsWIS()) {
3264
- return this.getColumnInvoiceAndlogistcUnit();
3265
- }
3266
- return [
3277
+ let result;
3278
+ switch (this.wmsSystem) {
3279
+ case WmsSystem.SENIOR_CONNECT:
3280
+ result = this.wmsSeniorConnectIntegration();
3281
+ break;
3282
+ case WmsSystem.WIS:
3283
+ result = this.wmsWisIntegration();
3284
+ break;
3285
+ case WmsSystem.SENIOR:
3286
+ result = this.wmsSiltIntegration();
3287
+ break;
3288
+ default:
3289
+ result = [];
3290
+ }
3291
+ return result;
3292
+ }
3293
+ wmsSeniorConnectIntegration() {
3294
+ const columns = [
3295
+ { field: "key", header: this.translate.instant("yms.int.wms_purchaseOrder") },
3296
+ ...this.getColumnPartner(),
3297
+ ];
3298
+ this.addInvoiceSituationIfNotClienteExterno(columns);
3299
+ return columns;
3300
+ }
3301
+ wmsWisIntegration() {
3302
+ const columns = [
3303
+ ...this.getColumnInvoiceAndlogistcUnit(),
3304
+ ];
3305
+ this.addInvoiceSituationIfNotClienteExterno(columns);
3306
+ return columns;
3307
+ }
3308
+ wmsSiltIntegration() {
3309
+ const columns = [
3267
3310
  { field: "invoiceKey", header: this.translate.instant("yms.int.wms_register_document_invoice_key") },
3268
3311
  ...this.getColumnInvoiceAndlogistcUnit(),
3269
3312
  { field: "ownerName", header: this.translate.instant("yms.int.wms_register_document_owner_name") },
3270
3313
  { field: "ownerDocument", header: this.translate.instant("yms.int.wms_register_document_owner_document") },
3271
3314
  ];
3315
+ this.addInvoiceSituationIfNotClienteExterno(columns);
3316
+ return columns;
3317
+ }
3318
+ getColumninvoiceCondition() {
3319
+ return { field: "invoiceCondition", header: this.translate.instant("yms.int.wms_grid_document_invoice_condition") };
3272
3320
  }
3273
3321
  getColumnInvoiceAndlogistcUnit() {
3274
3322
  return [
@@ -3285,12 +3333,23 @@ let DocumentGridComponent = class DocumentGridComponent {
3285
3333
  { field: "partnerDocument", header: this.translate.instant("yms.int.wms_register_document_partner_document") },
3286
3334
  ];
3287
3335
  }
3336
+ addInvoiceSituationIfNotClienteExterno(columns) {
3337
+ if (!this.isClienteExterno) {
3338
+ columns.push(this.getColumninvoiceCondition());
3339
+ }
3340
+ }
3288
3341
  isWmsSeniorConnect() {
3289
3342
  return this.wmsSystem === WmsSystem.SENIOR_CONNECT;
3290
3343
  }
3291
3344
  isWmsWIS() {
3292
3345
  return this.wmsSystem === WmsSystem.WIS;
3293
3346
  }
3347
+ isWmsSilt() {
3348
+ return this.wmsSystem === WmsSystem.SENIOR;
3349
+ }
3350
+ sucessMessage() {
3351
+ return this.utils.message("success", this.summary, "saved_message_content");
3352
+ }
3294
3353
  };
3295
3354
  __decorate([
3296
3355
  Input(),
@@ -3339,8 +3398,8 @@ __decorate([
3339
3398
  DocumentGridComponent = __decorate([
3340
3399
  Component({
3341
3400
  selector: 'document-grid',
3342
- 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>",
3343
- 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}"]
3401
+ 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 *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]=\"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]=\"'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 [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>",
3402
+ 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}"]
3344
3403
  }),
3345
3404
  __metadata("design:paramtypes", [TranslateService,
3346
3405
  DocumentService,
@@ -3370,6 +3429,7 @@ class Document {
3370
3429
  "ownerDocument",
3371
3430
  "partnerName",
3372
3431
  "partnerDocument",
3432
+ "invoiceCondition",
3373
3433
  "notes",
3374
3434
  "code",
3375
3435
  "createdBy",
@@ -3389,13 +3449,20 @@ class Document {
3389
3449
  }
3390
3450
 
3391
3451
  let RegisterDocumentComponent = class RegisterDocumentComponent {
3392
- constructor(fb, utils) {
3452
+ constructor(fb, translate) {
3393
3453
  this.fb = fb;
3394
- this.utils = utils;
3454
+ this.translate = translate;
3395
3455
  this.document = new EventEmitter();
3396
3456
  this.visible = new EventEmitter();
3397
3457
  this.visibleChange = new EventEmitter();
3398
3458
  this.isSaveFormValid = false;
3459
+ this.invoiceCondition = [
3460
+ { label: this.translate.instant("yms.int.wms_grid_document_invoice_no_way"), value: null },
3461
+ { label: this.translate.instant("yms.int.wms_grid_document_invoice_condition_authorized"), value: InvoiceCondition.AUTHORIZED },
3462
+ { label: this.translate.instant("yms.int.wms_grid_document_invoice_condition_manual_authorized"), value: InvoiceCondition.MANUAL_AUTHORIZED },
3463
+ { label: this.translate.instant("yms.int.wms_grid_document_invoice_condition_partial_authorized"), value: InvoiceCondition.PARTIAL_AUTHORIZED },
3464
+ { label: this.translate.instant("yms.int.wms_grid_document_invoice_condition_devolucion"), value: InvoiceCondition.DEVOLUTION },
3465
+ ];
3399
3466
  }
3400
3467
  ngOnInit() {
3401
3468
  this.getFormGroup();
@@ -3433,6 +3500,7 @@ let RegisterDocumentComponent = class RegisterDocumentComponent {
3433
3500
  this.formGroup.get('partnerDocument').setValue(document.partnerDocument);
3434
3501
  this.formGroup.get('ownerDocument').setValue(document.ownerDocument);
3435
3502
  this.formGroup.get('ownerName').setValue(document.ownerName);
3503
+ this.formGroup.get('invoiceCondition').setValue(document.invoiceCondition);
3436
3504
  }
3437
3505
  getFormGroup() {
3438
3506
  this.formGroup = this.fb.group({
@@ -3449,6 +3517,7 @@ let RegisterDocumentComponent = class RegisterDocumentComponent {
3449
3517
  partnerDocument: [undefined],
3450
3518
  notes: [undefined],
3451
3519
  code: [undefined],
3520
+ invoiceCondition: [undefined],
3452
3521
  });
3453
3522
  }
3454
3523
  save() {
@@ -3480,6 +3549,10 @@ __decorate([
3480
3549
  Input(),
3481
3550
  __metadata("design:type", Agenda)
3482
3551
  ], RegisterDocumentComponent.prototype, "agenda", void 0);
3552
+ __decorate([
3553
+ Input(),
3554
+ __metadata("design:type", Boolean)
3555
+ ], RegisterDocumentComponent.prototype, "isClienteExterno", void 0);
3483
3556
  __decorate([
3484
3557
  Output(),
3485
3558
  __metadata("design:type", EventEmitter)
@@ -3499,10 +3572,9 @@ __decorate([
3499
3572
  RegisterDocumentComponent = __decorate([
3500
3573
  Component({
3501
3574
  selector: "register-document",
3502
- 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>"
3575
+ 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>"
3503
3576
  }),
3504
- __metadata("design:paramtypes", [FormBuilder,
3505
- UtilsMessageService])
3577
+ __metadata("design:paramtypes", [FormBuilder, TranslateService])
3506
3578
  ], RegisterDocumentComponent);
3507
3579
 
3508
3580
  let RegisterDocumentModule = class RegisterDocumentModule {
@@ -3519,7 +3591,8 @@ RegisterDocumentModule = __decorate([
3519
3591
  InputTextModule$1,
3520
3592
  ControlErrorsModule,
3521
3593
  InputTextareaModule,
3522
- ReactiveFormsModule
3594
+ ReactiveFormsModule,
3595
+ DropdownModule,
3523
3596
  ],
3524
3597
  exports: [RegisterDocumentComponent],
3525
3598
  declarations: [RegisterDocumentComponent],
@@ -3545,6 +3618,9 @@ let InsertKeyComponent = class InsertKeyComponent {
3545
3618
  invoiceSerie: [undefined],
3546
3619
  partnerDocument: [undefined]
3547
3620
  });
3621
+ this.formGroup.get('key').valueChanges.subscribe((nf) => {
3622
+ this.validateKeyDetails(nf);
3623
+ });
3548
3624
  }
3549
3625
  isWmsWis() {
3550
3626
  return this.wmsSystem === WmsSystem.WIS;
@@ -3589,6 +3665,38 @@ let InsertKeyComponent = class InsertKeyComponent {
3589
3665
  this.formGroup.reset();
3590
3666
  });
3591
3667
  }
3668
+ validateKeyDetails(nf) {
3669
+ if (!nf) {
3670
+ this.keyErrorMessage = null;
3671
+ this.setValuesOfKey(undefined, undefined, undefined);
3672
+ return;
3673
+ }
3674
+ const nfLength = 44;
3675
+ if (nf.length === nfLength) {
3676
+ this.keyErrorMessage = null;
3677
+ this.extractKeyDetails(nf);
3678
+ }
3679
+ else {
3680
+ this.keyErrorMessage = "yms.int.wms_error_key_message";
3681
+ }
3682
+ }
3683
+ extractKeyDetails(nf) {
3684
+ const startCnpj = 6;
3685
+ const endCnpj = 20;
3686
+ const cnpj = nf.substring(startCnpj, endCnpj);
3687
+ const startSerie = 22;
3688
+ const endSerie = 25;
3689
+ const serie = nf.substring(startSerie, endSerie);
3690
+ const startInvoice = 25;
3691
+ const endInvoice = 34;
3692
+ const invoice = nf.substring(startInvoice, endInvoice);
3693
+ this.setValuesOfKey(invoice, serie, cnpj);
3694
+ }
3695
+ setValuesOfKey(invoiceNumber, invoiceSerie, partnerDocument) {
3696
+ this.formGroup.get('invoiceNumber').setValue(invoiceNumber);
3697
+ this.formGroup.get('invoiceSerie').setValue(invoiceSerie);
3698
+ this.formGroup.get('partnerDocument').setValue(partnerDocument);
3699
+ }
3592
3700
  cancel() {
3593
3701
  this.visibleChange.emit(false);
3594
3702
  }
@@ -3615,8 +3723,8 @@ __decorate([
3615
3723
  InsertKeyComponent = __decorate([
3616
3724
  Component({
3617
3725
  selector: "insert-key",
3618
- 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",
3619
- 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}"]
3726
+ 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",
3727
+ 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}"]
3620
3728
  }),
3621
3729
  __metadata("design:paramtypes", [FormBuilder,
3622
3730
  DocumentService,
@@ -3658,7 +3766,9 @@ DocumentGridModule = __decorate([
3658
3766
  InsertKeyModule,
3659
3767
  ButtonModule$1,
3660
3768
  ComponentsModule,
3661
- EmptyStateModule
3769
+ EmptyStateModule,
3770
+ DropdownModule,
3771
+ FormsModule
3662
3772
  ],
3663
3773
  })
3664
3774
  ], DocumentGridModule);
@@ -3730,41 +3840,30 @@ let DocumentListComponent = class DocumentListComponent extends DocumentListDesc
3730
3840
  this.getColumns = [];
3731
3841
  this.documents = [];
3732
3842
  this.labels = [];
3733
- }
3734
- ngOnInit() {
3735
- this.getSystemIntegration();
3736
- }
3737
- getSystemIntegration() {
3738
- this.documentService.getSystemIntegration().subscribe((system) => {
3739
- this.wmsSystem = system.system;
3740
- this.getDocumentBySchedulingId();
3741
- });
3742
- }
3743
- getDocumentBySchedulingId() {
3744
- this.documentService.list({
3745
- filterQuery: `schedulingId eq '${this.agenda.id}'`
3746
- }).subscribe((contents) => {
3747
- if (contents.totalElements > 0) {
3748
- this.documents = contents.contents;
3749
- this.getColumns = this.getColumnLabels();
3750
- }
3751
- });
3843
+ this.selected = [];
3844
+ this.gridLoading = true;
3845
+ this.ngUnsubscribe = new Subject();
3752
3846
  }
3753
3847
  getColumnLabels() {
3754
3848
  if (this.isWmsWIS()) {
3755
3849
  return [
3756
- ...this.getLabelsInvoice()
3850
+ ...this.getLabelsInvoice(),
3851
+ { field: "partnerName", label: 'yms.int.wms_register_document_invoice_partnerName' },
3852
+ { field: "partnerDocument", label: 'yms.int.wms_register_document_invoice_partnerDocument' },
3853
+ { field: "code", label: 'yms.int.wms_register_document_invoice_code' },
3854
+ { field: "invoiceCondition", label: 'yms.int.wms_register_document_invoice_condition' },
3855
+ { field: "notes", label: 'yms.int.wms_register_document_invoice_notes' },
3757
3856
  ];
3758
3857
  }
3759
3858
  if (this.isWmsSeniorConnect()) {
3760
3859
  return [
3761
- { label: 'yms.int.wms_purchaseOrder' },
3762
- { label: 'yms.int.wms_register_document_partner_name' },
3763
- { label: 'yms.int.wms_register_document_partner_document' }
3860
+ { field: "key", label: 'yms.int.wms_purchaseOrder' },
3861
+ { field: "partnerName", label: 'yms.int.wms_register_document_invoice_partnerName' },
3862
+ { field: "partnerDocument", label: 'yms.int.wms_register_document_invoice_partnerDocument' },
3764
3863
  ];
3765
3864
  }
3766
3865
  return [
3767
- { label: 'yms.int.wms_register_document_invoice_key' },
3866
+ { field: "invoiceKey", label: 'yms.int.wms_register_document_invoice_key' },
3768
3867
  ...this.getLabelsInvoice()
3769
3868
  ];
3770
3869
  }
@@ -3776,10 +3875,38 @@ let DocumentListComponent = class DocumentListComponent extends DocumentListDesc
3776
3875
  }
3777
3876
  getLabelsInvoice() {
3778
3877
  return [
3779
- { label: 'yms.int.wms_register_document_invoice_number' },
3780
- { label: 'yms.int.wms_register_document_invoice_serial_number' }
3878
+ { field: "invoiceNumber", label: 'yms.int.wms_register_document_invoice_number' },
3879
+ { field: "invoiceSerialNumber", label: 'yms.int.wms_register_document_invoice_serial_number' },
3781
3880
  ];
3782
3881
  }
3882
+ getInvoiceConditionTranslation(invoiceCondition) {
3883
+ return invoiceCondition ? `yms.int.wms_document_invoice_condition_${invoiceCondition}` : 'N/A';
3884
+ }
3885
+ updateGridData(event) {
3886
+ this.documentService.getSystemIntegration().subscribe((system) => {
3887
+ this.wmsSystem = system.system;
3888
+ this.searchDocument(event);
3889
+ });
3890
+ }
3891
+ searchDocument(event) {
3892
+ const size = event.rows;
3893
+ const page = event.first / size;
3894
+ const sort = event.multiSortMeta;
3895
+ this.gridLoading = true;
3896
+ this.documentService.list({ page, size, sort,
3897
+ filterQuery: `schedulingId eq '${this.agenda.id}'`
3898
+ })
3899
+ .pipe(takeUntil(this.ngUnsubscribe), finalize(() => {
3900
+ this.gridLoading = false;
3901
+ }))
3902
+ .subscribe((contents) => {
3903
+ if (contents.totalElements > 0) {
3904
+ this.documents = contents.contents;
3905
+ this.getColumns = this.getColumnLabels();
3906
+ this.gridTotalRecords = contents.totalElements;
3907
+ }
3908
+ });
3909
+ }
3783
3910
  };
3784
3911
  __decorate([
3785
3912
  Input(),
@@ -3791,7 +3918,8 @@ __decorate([
3791
3918
  ], DocumentListComponent.prototype, "wmsSystem", void 0);
3792
3919
  DocumentListComponent = __decorate([
3793
3920
  Component({
3794
- 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>"
3921
+ 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?.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>",
3922
+ styles: [".table-col-width{width:250px}"]
3795
3923
  }),
3796
3924
  __metadata("design:paramtypes", [DocumentService])
3797
3925
  ], DocumentListComponent);