@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
@@ -3066,6 +3066,15 @@ 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["REJECTED"] = "REJECTED";
3076
+ })(InvoiceCondition || (InvoiceCondition = {}));
3077
+
3069
3078
  let DocumentGridComponent = class DocumentGridComponent {
3070
3079
  constructor(translate, documentService, confirmationService, integrationService, agendaService, utils) {
3071
3080
  this.translate = translate;
@@ -3077,21 +3086,36 @@ let DocumentGridComponent = class DocumentGridComponent {
3077
3086
  this.viewDocument = new EventEmitter();
3078
3087
  this.gridData = [];
3079
3088
  this.enableButtonIsClienteExterno = true;
3089
+ this.summary = "yms.int.wms_saved_document_message_title";
3080
3090
  this.ngUnsubscribe = new Subject();
3091
+ this.invoiceConditions = [
3092
+ { label: this.translate.instant("yms.int.wms_grid_document_invoice_no_way"), value: null },
3093
+ { label: this.translate.instant("yms.int.wms_grid_document_invoice_condition_authorized"), value: InvoiceCondition.AUTHORIZED },
3094
+ { label: this.translate.instant("yms.int.wms_grid_document_invoice_condition_manual_authorized"), value: InvoiceCondition.MANUAL_AUTHORIZED },
3095
+ { label: this.translate.instant("yms.int.wms_grid_document_invoice_condition_partial_authorized"), value: InvoiceCondition.PARTIAL_AUTHORIZED },
3096
+ { label: this.translate.instant("yms.int.wms_grid_document_invoice_condition_devolution"), value: InvoiceCondition.DEVOLUTION },
3097
+ { label: this.translate.instant("yms.int.wms_grid_document_invoice_condition_rejected"), value: InvoiceCondition.REJECTED },
3098
+ ];
3081
3099
  this.selection = [];
3082
3100
  }
3101
+ getFilteredInvoiceConditions(invoiceConditions) {
3102
+ if (invoiceConditions === InvoiceCondition.AUTHORIZED) {
3103
+ return this.invoiceConditions.filter(cond => cond.value === InvoiceCondition.AUTHORIZED);
3104
+ }
3105
+ else {
3106
+ return this.invoiceConditions.filter(cond => cond.value !== InvoiceCondition.AUTHORIZED);
3107
+ }
3108
+ }
3083
3109
  ngOnInit() {
3084
3110
  this.verifyClienteExterno();
3085
3111
  this.getProcessTypeByScheduling();
3086
3112
  this.listDocuments(false);
3087
3113
  }
3088
- ngAfterContentChecked() {
3089
- this.gridColumns = this.getGridColumns();
3090
- }
3091
3114
  verifyClienteExterno() {
3092
3115
  this.agendaService.isClienteExterno()
3093
3116
  .subscribe((result) => {
3094
3117
  this.isClienteExterno = result.isClienteExterno;
3118
+ this.gridColumns = this.getGridColumns();
3095
3119
  this.cantEditStatus();
3096
3120
  });
3097
3121
  }
@@ -3112,7 +3136,7 @@ let DocumentGridComponent = class DocumentGridComponent {
3112
3136
  }
3113
3137
  this.gridData.push(document);
3114
3138
  this.disabled = false;
3115
- this.utils.message("success", "yms.int.wms_saved_document_message_title", "yms.int.wms_success_message_description");
3139
+ this.utils.message("success", this.summary, "yms.int.wms_success_message_description");
3116
3140
  this.visibleDocumentRegister = false;
3117
3141
  this.visibleInvoiceKey = false;
3118
3142
  }
@@ -3190,12 +3214,18 @@ let DocumentGridComponent = class DocumentGridComponent {
3190
3214
  }
3191
3215
  data.key = this.updateKeyByWms(data);
3192
3216
  this.documentService.insert(data).subscribe(() => {
3193
- this.utils.message("success", "yms.int.wms_saved_document_message_title", "saved_message_content");
3217
+ this.sucessMessage();
3194
3218
  });
3195
3219
  this.disabled = true;
3196
- this.listDocuments(false);
3220
+ }
3221
+ else {
3222
+ this.documentService.update(data.id, data).subscribe(() => {
3223
+ this.sucessMessage();
3224
+ this.disabled = true;
3225
+ });
3197
3226
  }
3198
3227
  });
3228
+ this.listDocuments(false);
3199
3229
  }
3200
3230
  }
3201
3231
  updateKeyByWms(data) {
@@ -3234,9 +3264,13 @@ let DocumentGridComponent = class DocumentGridComponent {
3234
3264
  }
3235
3265
  });
3236
3266
  }
3267
+ notSavedDocuments() {
3268
+ return this.gridData.some(document => !document.id);
3269
+ }
3237
3270
  listDocuments(isDelete) {
3238
3271
  this.documentService.list({
3239
- filterQuery: `schedulingId eq '${this.agenda.id}'`
3272
+ filterQuery: `schedulingId eq '${this.agenda.id}'`,
3273
+ size: 100
3240
3274
  })
3241
3275
  .subscribe((contents) => {
3242
3276
  this.gridData = isDelete ? this.gridData.filter(item => !item.id) : [];
@@ -3254,21 +3288,49 @@ let DocumentGridComponent = class DocumentGridComponent {
3254
3288
  });
3255
3289
  }
3256
3290
  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 [
3291
+ let result;
3292
+ switch (this.wmsSystem) {
3293
+ case WmsSystem.SENIOR_CONNECT:
3294
+ result = this.wmsSeniorConnectIntegration();
3295
+ break;
3296
+ case WmsSystem.WIS:
3297
+ result = this.wmsWisIntegration();
3298
+ break;
3299
+ case WmsSystem.SENIOR:
3300
+ result = this.wmsSiltIntegration();
3301
+ break;
3302
+ default:
3303
+ result = [];
3304
+ }
3305
+ return result;
3306
+ }
3307
+ wmsSeniorConnectIntegration() {
3308
+ const columns = [
3309
+ { field: "key", header: this.translate.instant("yms.int.wms_purchaseOrder") },
3310
+ ...this.getColumnPartner(),
3311
+ ];
3312
+ this.addInvoiceSituationIfNotClienteExterno(columns);
3313
+ return columns;
3314
+ }
3315
+ wmsWisIntegration() {
3316
+ const columns = [
3317
+ ...this.getColumnInvoiceAndlogistcUnit(),
3318
+ ];
3319
+ this.addInvoiceSituationIfNotClienteExterno(columns);
3320
+ return columns;
3321
+ }
3322
+ wmsSiltIntegration() {
3323
+ const columns = [
3267
3324
  { field: "invoiceKey", header: this.translate.instant("yms.int.wms_register_document_invoice_key") },
3268
3325
  ...this.getColumnInvoiceAndlogistcUnit(),
3269
3326
  { field: "ownerName", header: this.translate.instant("yms.int.wms_register_document_owner_name") },
3270
3327
  { field: "ownerDocument", header: this.translate.instant("yms.int.wms_register_document_owner_document") },
3271
3328
  ];
3329
+ this.addInvoiceSituationIfNotClienteExterno(columns);
3330
+ return columns;
3331
+ }
3332
+ getColumninvoiceCondition() {
3333
+ return { field: "invoiceCondition", header: this.translate.instant("yms.int.wms_grid_document_invoice_condition") };
3272
3334
  }
3273
3335
  getColumnInvoiceAndlogistcUnit() {
3274
3336
  return [
@@ -3285,12 +3347,23 @@ let DocumentGridComponent = class DocumentGridComponent {
3285
3347
  { field: "partnerDocument", header: this.translate.instant("yms.int.wms_register_document_partner_document") },
3286
3348
  ];
3287
3349
  }
3350
+ addInvoiceSituationIfNotClienteExterno(columns) {
3351
+ if (!this.isClienteExterno) {
3352
+ columns.push(this.getColumninvoiceCondition());
3353
+ }
3354
+ }
3288
3355
  isWmsSeniorConnect() {
3289
3356
  return this.wmsSystem === WmsSystem.SENIOR_CONNECT;
3290
3357
  }
3291
3358
  isWmsWIS() {
3292
3359
  return this.wmsSystem === WmsSystem.WIS;
3293
3360
  }
3361
+ isWmsSilt() {
3362
+ return this.wmsSystem === WmsSystem.SENIOR;
3363
+ }
3364
+ sucessMessage() {
3365
+ return this.utils.message("success", this.summary, "saved_message_content");
3366
+ }
3294
3367
  };
3295
3368
  __decorate([
3296
3369
  Input(),
@@ -3339,8 +3412,8 @@ __decorate([
3339
3412
  DocumentGridComponent = __decorate([
3340
3413
  Component({
3341
3414
  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}"]
3415
+ 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>",
3416
+ 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
3417
  }),
3345
3418
  __metadata("design:paramtypes", [TranslateService,
3346
3419
  DocumentService,
@@ -3370,6 +3443,7 @@ class Document {
3370
3443
  "ownerDocument",
3371
3444
  "partnerName",
3372
3445
  "partnerDocument",
3446
+ "invoiceCondition",
3373
3447
  "notes",
3374
3448
  "code",
3375
3449
  "createdBy",
@@ -3389,13 +3463,21 @@ class Document {
3389
3463
  }
3390
3464
 
3391
3465
  let RegisterDocumentComponent = class RegisterDocumentComponent {
3392
- constructor(fb, utils) {
3466
+ constructor(fb, translate) {
3393
3467
  this.fb = fb;
3394
- this.utils = utils;
3468
+ this.translate = translate;
3395
3469
  this.document = new EventEmitter();
3396
3470
  this.visible = new EventEmitter();
3397
3471
  this.visibleChange = new EventEmitter();
3398
3472
  this.isSaveFormValid = false;
3473
+ this.invoiceCondition = [
3474
+ { label: this.translate.instant("yms.int.wms_grid_document_invoice_no_way"), value: null },
3475
+ { label: this.translate.instant("yms.int.wms_grid_document_invoice_condition_authorized"), value: InvoiceCondition.AUTHORIZED },
3476
+ { label: this.translate.instant("yms.int.wms_grid_document_invoice_condition_manual_authorized"), value: InvoiceCondition.MANUAL_AUTHORIZED },
3477
+ { label: this.translate.instant("yms.int.wms_grid_document_invoice_condition_partial_authorized"), value: InvoiceCondition.PARTIAL_AUTHORIZED },
3478
+ { label: this.translate.instant("yms.int.wms_grid_document_invoice_condition_devolution"), value: InvoiceCondition.DEVOLUTION },
3479
+ { label: this.translate.instant("yms.int.wms_grid_document_invoice_condition_rejected"), value: InvoiceCondition.REJECTED },
3480
+ ];
3399
3481
  }
3400
3482
  ngOnInit() {
3401
3483
  this.getFormGroup();
@@ -3433,6 +3515,7 @@ let RegisterDocumentComponent = class RegisterDocumentComponent {
3433
3515
  this.formGroup.get('partnerDocument').setValue(document.partnerDocument);
3434
3516
  this.formGroup.get('ownerDocument').setValue(document.ownerDocument);
3435
3517
  this.formGroup.get('ownerName').setValue(document.ownerName);
3518
+ this.formGroup.get('invoiceCondition').setValue(document.invoiceCondition);
3436
3519
  }
3437
3520
  getFormGroup() {
3438
3521
  this.formGroup = this.fb.group({
@@ -3449,6 +3532,7 @@ let RegisterDocumentComponent = class RegisterDocumentComponent {
3449
3532
  partnerDocument: [undefined],
3450
3533
  notes: [undefined],
3451
3534
  code: [undefined],
3535
+ invoiceCondition: [undefined],
3452
3536
  });
3453
3537
  }
3454
3538
  save() {
@@ -3480,6 +3564,10 @@ __decorate([
3480
3564
  Input(),
3481
3565
  __metadata("design:type", Agenda)
3482
3566
  ], RegisterDocumentComponent.prototype, "agenda", void 0);
3567
+ __decorate([
3568
+ Input(),
3569
+ __metadata("design:type", Boolean)
3570
+ ], RegisterDocumentComponent.prototype, "isClienteExterno", void 0);
3483
3571
  __decorate([
3484
3572
  Output(),
3485
3573
  __metadata("design:type", EventEmitter)
@@ -3499,10 +3587,9 @@ __decorate([
3499
3587
  RegisterDocumentComponent = __decorate([
3500
3588
  Component({
3501
3589
  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>"
3590
+ 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
3591
  }),
3504
- __metadata("design:paramtypes", [FormBuilder,
3505
- UtilsMessageService])
3592
+ __metadata("design:paramtypes", [FormBuilder, TranslateService])
3506
3593
  ], RegisterDocumentComponent);
3507
3594
 
3508
3595
  let RegisterDocumentModule = class RegisterDocumentModule {
@@ -3519,7 +3606,8 @@ RegisterDocumentModule = __decorate([
3519
3606
  InputTextModule$1,
3520
3607
  ControlErrorsModule,
3521
3608
  InputTextareaModule,
3522
- ReactiveFormsModule
3609
+ ReactiveFormsModule,
3610
+ DropdownModule,
3523
3611
  ],
3524
3612
  exports: [RegisterDocumentComponent],
3525
3613
  declarations: [RegisterDocumentComponent],
@@ -3527,15 +3615,32 @@ RegisterDocumentModule = __decorate([
3527
3615
  })
3528
3616
  ], RegisterDocumentModule);
3529
3617
 
3618
+ let ExternalTenantService = class ExternalTenantService extends EntityService {
3619
+ constructor(http, messageService) {
3620
+ super(http, messageService, 'yms/agenda/entities/externalTenant', '');
3621
+ this.http = http;
3622
+ this.messageService = messageService;
3623
+ }
3624
+ };
3625
+ ExternalTenantService = __decorate([
3626
+ Injectable(),
3627
+ __metadata("design:paramtypes", [HttpClient, MessageService])
3628
+ ], ExternalTenantService);
3629
+
3530
3630
  let InsertKeyComponent = class InsertKeyComponent {
3531
- constructor(formBuilder, documentService, utils) {
3631
+ constructor(formBuilder, documentService, utils, confirmationService, translate, externalTenantService) {
3532
3632
  this.formBuilder = formBuilder;
3533
3633
  this.documentService = documentService;
3534
3634
  this.utils = utils;
3635
+ this.confirmationService = confirmationService;
3636
+ this.translate = translate;
3637
+ this.externalTenantService = externalTenantService;
3535
3638
  this.document = new EventEmitter();
3536
3639
  this.visible = new EventEmitter();
3537
3640
  this.visibleChange = new EventEmitter();
3538
3641
  this.isLoading = false;
3642
+ this.isPartnerloading = false;
3643
+ this.ngUnsubscribe = new Subject();
3539
3644
  }
3540
3645
  ngOnInit() {
3541
3646
  this.formGroup = this.formBuilder.group({
@@ -3545,6 +3650,9 @@ let InsertKeyComponent = class InsertKeyComponent {
3545
3650
  invoiceSerie: [undefined],
3546
3651
  partnerDocument: [undefined]
3547
3652
  });
3653
+ this.formGroup.get('key').valueChanges.subscribe((nf) => {
3654
+ this.validateKeyDetails(nf);
3655
+ });
3548
3656
  }
3549
3657
  isWmsWis() {
3550
3658
  return this.wmsSystem === WmsSystem.WIS;
@@ -3576,6 +3684,7 @@ let InsertKeyComponent = class InsertKeyComponent {
3576
3684
  else {
3577
3685
  this.utils.translateMessage("error", "yms.int.wms_error_search_document_message_header", "yms.int.wms_error_unknown_search_document_message_content" + err.error.message);
3578
3686
  }
3687
+ this.confirmInvoiceDialog();
3579
3688
  return throwError(err);
3580
3689
  }), finalize(() => {
3581
3690
  this.isLoading = false;
@@ -3585,10 +3694,86 @@ let InsertKeyComponent = class InsertKeyComponent {
3585
3694
  this.utils.message("warn", "yms.int.wms_insert_key_warning_message_header", "yms.int.wms_insert_key_warning_message_description");
3586
3695
  return;
3587
3696
  }
3588
- this.document.emit(content.contents[0]);
3697
+ const document = content.contents[0];
3698
+ document.invoiceKey = this.formGroup.get('key').value;
3699
+ document.invoiceCondition = InvoiceCondition.AUTHORIZED;
3700
+ this.document.emit(document);
3589
3701
  this.formGroup.reset();
3590
3702
  });
3591
3703
  }
3704
+ confirmInvoiceDialog() {
3705
+ this.confirmationService.confirm({
3706
+ message: this.translate.instant("yms.int.wms_message_confirm_invoice_dialog"),
3707
+ acceptLabel: this.translate.instant("yms.int.wms_accept_confirm_invoice_dialog"),
3708
+ rejectLabel: this.translate.instant("yms.int.wms_reject_confirm_invoice_dialog"),
3709
+ header: this.translate.instant("yms.int.wms_header_content_confirm_invoice_dialog"),
3710
+ accept: () => this.buildInvoice()
3711
+ });
3712
+ }
3713
+ buildInvoice() {
3714
+ this.isPartnerloading = true;
3715
+ const partnerDocument = this.formGroup.get('partnerDocument').value;
3716
+ this.externalTenantService.list({
3717
+ filterQuery: `cnpj eq '${partnerDocument}'`
3718
+ })
3719
+ .pipe(takeUntil(this.ngUnsubscribe), finalize(() => {
3720
+ this.isPartnerloading = false;
3721
+ }))
3722
+ .subscribe((contents) => {
3723
+ const documentInvoice = this.createDocumentInvoice(contents);
3724
+ this.document.emit(documentInvoice);
3725
+ this.formGroup.reset();
3726
+ });
3727
+ }
3728
+ createDocumentInvoice(partners) {
3729
+ const documentInvoice = {
3730
+ invoiceKey: this.formGroup.get('key').value,
3731
+ invoiceNumber: this.formGroup.get('invoiceNumber').value,
3732
+ invoiceSerialNumber: this.formGroup.get('invoiceSerie').value,
3733
+ partnerDocument: this.formGroup.get('partnerDocument').value,
3734
+ partnerName: null,
3735
+ type: null,
3736
+ key: null,
3737
+ schedulingId: null
3738
+ };
3739
+ if (partners.totalElements > 0) {
3740
+ const partner = partners.contents[0];
3741
+ documentInvoice.partnerName = partner.descricao;
3742
+ }
3743
+ return documentInvoice;
3744
+ }
3745
+ validateKeyDetails(nf) {
3746
+ if (!nf) {
3747
+ this.keyErrorMessage = null;
3748
+ this.setValuesOfKey(undefined, undefined, undefined);
3749
+ return;
3750
+ }
3751
+ const nfLength = 44;
3752
+ if (nf.length === nfLength) {
3753
+ this.keyErrorMessage = null;
3754
+ this.extractKeyDetails(nf);
3755
+ }
3756
+ else {
3757
+ this.keyErrorMessage = "yms.int.wms_error_key_message";
3758
+ }
3759
+ }
3760
+ extractKeyDetails(nf) {
3761
+ const startCnpj = 6;
3762
+ const endCnpj = 20;
3763
+ const cnpj = nf.substring(startCnpj, endCnpj);
3764
+ const startSerie = 22;
3765
+ const endSerie = 25;
3766
+ const serie = nf.substring(startSerie, endSerie);
3767
+ const startInvoice = 25;
3768
+ const endInvoice = 34;
3769
+ const invoice = nf.substring(startInvoice, endInvoice);
3770
+ this.setValuesOfKey(invoice, serie, cnpj);
3771
+ }
3772
+ setValuesOfKey(invoiceNumber, invoiceSerie, partnerDocument) {
3773
+ this.formGroup.get('invoiceNumber').setValue(invoiceNumber);
3774
+ this.formGroup.get('invoiceSerie').setValue(invoiceSerie);
3775
+ this.formGroup.get('partnerDocument').setValue(partnerDocument);
3776
+ }
3592
3777
  cancel() {
3593
3778
  this.visibleChange.emit(false);
3594
3779
  }
@@ -3615,12 +3800,15 @@ __decorate([
3615
3800
  InsertKeyComponent = __decorate([
3616
3801
  Component({
3617
3802
  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}"]
3803
+ 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",
3804
+ 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
3805
  }),
3621
3806
  __metadata("design:paramtypes", [FormBuilder,
3622
3807
  DocumentService,
3623
- UtilsMessageService])
3808
+ UtilsMessageService,
3809
+ ConfirmationService,
3810
+ TranslateService,
3811
+ ExternalTenantService])
3624
3812
  ], InsertKeyComponent);
3625
3813
 
3626
3814
  let InsertKeyModule = class InsertKeyModule {
@@ -3637,7 +3825,8 @@ InsertKeyModule = __decorate([
3637
3825
  LoadingStateModule
3638
3826
  ],
3639
3827
  exports: [InsertKeyComponent],
3640
- declarations: [InsertKeyComponent]
3828
+ declarations: [InsertKeyComponent],
3829
+ providers: [ExternalTenantService]
3641
3830
  })
3642
3831
  ], InsertKeyModule);
3643
3832
 
@@ -3648,6 +3837,7 @@ DocumentGridModule = __decorate([
3648
3837
  declarations: [DocumentGridComponent],
3649
3838
  entryComponents: [DocumentGridComponent],
3650
3839
  exports: [DocumentGridComponent],
3840
+ providers: [ExternalTenantService],
3651
3841
  imports: [
3652
3842
  CommonModule,
3653
3843
  TranslateModule,
@@ -3658,7 +3848,9 @@ DocumentGridModule = __decorate([
3658
3848
  InsertKeyModule,
3659
3849
  ButtonModule$1,
3660
3850
  ComponentsModule,
3661
- EmptyStateModule
3851
+ EmptyStateModule,
3852
+ DropdownModule,
3853
+ FormsModule
3662
3854
  ],
3663
3855
  })
3664
3856
  ], DocumentGridModule);
@@ -3730,41 +3922,31 @@ let DocumentListComponent = class DocumentListComponent extends DocumentListDesc
3730
3922
  this.getColumns = [];
3731
3923
  this.documents = [];
3732
3924
  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
- });
3925
+ this.selected = [];
3926
+ this.gridLoading = true;
3927
+ this.ngUnsubscribe = new Subject();
3752
3928
  }
3753
3929
  getColumnLabels() {
3754
3930
  if (this.isWmsWIS()) {
3755
3931
  return [
3756
- ...this.getLabelsInvoice()
3932
+ ...this.getLabelsInvoice(),
3933
+ { field: "invoiceKey", label: 'yms.int.wms_register_document_invoice_invoice_key' },
3934
+ { field: "partnerName", label: 'yms.int.wms_register_document_invoice_partner_name' },
3935
+ { field: "partnerDocument", label: 'yms.int.wms_register_document_invoice_partner_document' },
3936
+ { field: "code", label: 'yms.int.wms_register_document_invoice_code' },
3937
+ { field: "invoiceCondition", label: 'yms.int.wms_register_document_invoice_condition' },
3938
+ { field: "notes", label: 'yms.int.wms_register_document_invoice_notes' },
3757
3939
  ];
3758
3940
  }
3759
3941
  if (this.isWmsSeniorConnect()) {
3760
3942
  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' }
3943
+ { field: "key", label: 'yms.int.wms_purchaseOrder' },
3944
+ { field: "partnerName", label: 'yms.int.wms_register_document_invoice_partner_name' },
3945
+ { field: "partnerDocument", label: 'yms.int.wms_register_document_invoice_partner_document' },
3764
3946
  ];
3765
3947
  }
3766
3948
  return [
3767
- { label: 'yms.int.wms_register_document_invoice_key' },
3949
+ { field: "invoiceKey", label: 'yms.int.wms_register_document_invoice_key' },
3768
3950
  ...this.getLabelsInvoice()
3769
3951
  ];
3770
3952
  }
@@ -3776,10 +3958,38 @@ let DocumentListComponent = class DocumentListComponent extends DocumentListDesc
3776
3958
  }
3777
3959
  getLabelsInvoice() {
3778
3960
  return [
3779
- { label: 'yms.int.wms_register_document_invoice_number' },
3780
- { label: 'yms.int.wms_register_document_invoice_serial_number' }
3961
+ { field: "invoiceNumber", label: 'yms.int.wms_register_document_invoice_number' },
3962
+ { field: "invoiceSerialNumber", label: 'yms.int.wms_register_document_invoice_serial_number' },
3781
3963
  ];
3782
3964
  }
3965
+ getInvoiceConditionTranslation(invoiceCondition) {
3966
+ return invoiceCondition ? `yms.int.wms_document_invoice_condition_${invoiceCondition}` : 'N/A';
3967
+ }
3968
+ updateGridData(event) {
3969
+ this.documentService.getSystemIntegration().subscribe((system) => {
3970
+ this.wmsSystem = system.system;
3971
+ this.searchDocument(event);
3972
+ });
3973
+ }
3974
+ searchDocument(event) {
3975
+ const size = event.rows;
3976
+ const page = event.first / size;
3977
+ const sort = event.multiSortMeta;
3978
+ this.gridLoading = true;
3979
+ this.documentService.list({ page, size, sort,
3980
+ filterQuery: `schedulingId eq '${this.agenda.id}'`
3981
+ })
3982
+ .pipe(takeUntil(this.ngUnsubscribe), finalize(() => {
3983
+ this.gridLoading = false;
3984
+ }))
3985
+ .subscribe((contents) => {
3986
+ if (contents.totalElements > 0) {
3987
+ this.documents = contents.contents;
3988
+ this.getColumns = this.getColumnLabels();
3989
+ this.gridTotalRecords = contents.totalElements;
3990
+ }
3991
+ });
3992
+ }
3783
3993
  };
3784
3994
  __decorate([
3785
3995
  Input(),
@@ -3791,7 +4001,8 @@ __decorate([
3791
4001
  ], DocumentListComponent.prototype, "wmsSystem", void 0);
3792
4002
  DocumentListComponent = __decorate([
3793
4003
  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>"
4004
+ 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>",
4005
+ styles: [".table-col-width{width:250px}"]
3795
4006
  }),
3796
4007
  __metadata("design:paramtypes", [DocumentService])
3797
4008
  ], DocumentListComponent);
@@ -13440,5 +13651,5 @@ DockModule = __decorate([
13440
13651
  })
13441
13652
  ], DockModule);
13442
13653
 
13443
- export { AgendaModule, AgendaService$1 as AgendaService, BalancaModule, BalancasService, CamerasModule, CamerasService, CancelasModule, CidadeModule, CidadeService, ContratoCompraItemModule, ContratoCompraItemService, ContratoCompraModule, ContratoCompraService, ControladorCancelaComponent, ControladorCancelaDescritor, ControladorCancelasService, CoreModule, DockModule, DockService, DocumentListComponent, DocumentListModule, ERP_ENVIRONMENT, ERP_SENIOR_HEADER, EmpresaModule, EmpresaService, ErpFormConfigService, ErpProcessData, ErpProcessService, ErpSeniorModule, EstadoModule, EstadoService, ExpedicaoChegadaVeiculoOverride, ExpedicaoModule, ExpedicaoService, FamiliaProdutoModule, FamiliaProdutoService, FieldCustomizationService, FilialModule, FilialService, FormComponent, FormDescritor, FormSamComponent, FormSamDescritor, FormWmsComponent, FormWmsDescritor, HasChangeService, INFORMACAOES_ADICIONAIS_HEADER, InfoComponent, InfoDescritor, IntegrationWebSocket, LogsModule, LogsService, LprModule, LprService, PaisModule, PaisService, PedidoVendaItemModule, PedidoVendaItemService, PedidoVendaModule, PedidoVendaService, PessoaEnderecoModule, PessoaEnderecoService, PessoaFisicaModule, PessoaFisicaService, PessoaJuridicaModule, PessoaJuridicaService, PessoaModule, PessoaService, PortariasComponent, PortariasDescritor, PortariasModule, ProdutoModule, ProdutoService, RecebimentoChegadaVeiculoOverride, RecebimentoContratoModule, RecebimentoContratoService, RoyaltyModule, RoyaltyService, SAM_SENIOR_HEADER, SafraModule, SafraService, SamSeniorModule, SnapshotComponent, SnapshotDescritor, TransportadoraModule, TransportadoraService, UnidadeMedidaModule, UnidadeMedidaService, VisitorListComponent, VisitorListModule, VisitorListService, VisualizarBalancaComponent, VisualizarBalancaDescritor, WmsModule, highlightLanguages, Service as ɵa, CustomStompConfig as ɵb, EntityService$2 as ɵba, EntityService$1 as ɵbb, UtilsMessageService as ɵbc, RegisterDocumentModule as ɵbd, RegisterDocumentComponent as ɵbe, InsertKeyModule as ɵbf, InsertKeyComponent as ɵbg, IntegrationService$1 as ɵbh, RecebimentoFormComponent as ɵbi, DerivacaoService as ɵbj, NotaValidatorService as ɵbk, TransgeniaService as ɵbl, VerificaNotafiscal as ɵbm, BuildFormField as ɵbn, ExpedicaoFormComponent as ɵbo, ExpedicaoInfoComponent as ɵbp, RecebimentoInfoComponent as ɵbq, DevolucaoFormComponent as ɵbr, DevolucaoService as ɵbs, DevolucaoChegadaVeiculoOverride as ɵbt, RecebimentoOrdemCompraFormComponent as ɵbu, OrdemCompraService as ɵbv, RecebimentoOrdemCompraService as ɵbw, RecebimentoOrdemCompraChegadaVeiculoOverride as ɵbx, RecebimentoOrdemCompraInfoComponent as ɵby, DevolucaoInfoComponent as ɵbz, ViewImageComponent as ɵc, ContratoFormComponent as ɵca, OrdemCompraFormComponent as ɵcb, ProcessoAvulsoFormComponent as ɵcc, ProcessoAvulsoService as ɵcd, ProcessoAvulsoChegadaVeiculoOverride as ɵce, ProcessoAvulsoInfoComponent as ɵcf, LogIntegracaoDescritor as ɵcg, LogIntegracaoComponent as ɵch, LogIntegracaoService as ɵci, DerivacaoModule as ɵcj, DevolucaoModule as ɵck, OrdemCompraModule as ɵcl, RecebimentoOrdemCompraModule as ɵcm, TransgeniaModule as ɵcn, ProcessoAvulsoModule as ɵco, LogIntegracaoModule as ɵcp, NotaFormModule as ɵcq, DirectivesModule as ɵcr, TrimDirective as ɵcs, NotaFormComponent as ɵct, LogDescritor as ɵd, LogsComponent as ɵe, PortariasService as ɵf, EntradaComponent as ɵg, AgendasComponent as ɵh, ConfirmacaoComponent as ɵi, VisitedInfoDescritor as ɵj, VisitedInfoComponent as ɵk, VisitedInfoService as ɵl, SchedulingComponent as ɵm, LobbyService as ɵn, EntityService as ɵo, SchedulingService as ɵp, VisitanteComponent as ɵq, VisitanteFormComponent as ɵr, CredencialFormComponent as ɵs, FocusService as ɵt, FormWmsService as ɵu, DocumentGridModule as ɵv, DocumentGridComponent as ɵw, DocumentService as ɵx, IntegrationService as ɵy, AgendaService as ɵz };
13654
+ export { AgendaModule, AgendaService$1 as AgendaService, BalancaModule, BalancasService, CamerasModule, CamerasService, CancelasModule, CidadeModule, CidadeService, ContratoCompraItemModule, ContratoCompraItemService, ContratoCompraModule, ContratoCompraService, ControladorCancelaComponent, ControladorCancelaDescritor, ControladorCancelasService, CoreModule, DockModule, DockService, DocumentListComponent, DocumentListModule, ERP_ENVIRONMENT, ERP_SENIOR_HEADER, EmpresaModule, EmpresaService, ErpFormConfigService, ErpProcessData, ErpProcessService, ErpSeniorModule, EstadoModule, EstadoService, ExpedicaoChegadaVeiculoOverride, ExpedicaoModule, ExpedicaoService, FamiliaProdutoModule, FamiliaProdutoService, FieldCustomizationService, FilialModule, FilialService, FormComponent, FormDescritor, FormSamComponent, FormSamDescritor, FormWmsComponent, FormWmsDescritor, HasChangeService, INFORMACAOES_ADICIONAIS_HEADER, InfoComponent, InfoDescritor, IntegrationWebSocket, LogsModule, LogsService, LprModule, LprService, PaisModule, PaisService, PedidoVendaItemModule, PedidoVendaItemService, PedidoVendaModule, PedidoVendaService, PessoaEnderecoModule, PessoaEnderecoService, PessoaFisicaModule, PessoaFisicaService, PessoaJuridicaModule, PessoaJuridicaService, PessoaModule, PessoaService, PortariasComponent, PortariasDescritor, PortariasModule, ProdutoModule, ProdutoService, RecebimentoChegadaVeiculoOverride, RecebimentoContratoModule, RecebimentoContratoService, RoyaltyModule, RoyaltyService, SAM_SENIOR_HEADER, SafraModule, SafraService, SamSeniorModule, SnapshotComponent, SnapshotDescritor, TransportadoraModule, TransportadoraService, UnidadeMedidaModule, UnidadeMedidaService, VisitorListComponent, VisitorListModule, VisitorListService, VisualizarBalancaComponent, VisualizarBalancaDescritor, WmsModule, highlightLanguages, Service as ɵa, CustomStompConfig as ɵb, EntityService$2 as ɵba, EntityService$1 as ɵbb, UtilsMessageService as ɵbc, ExternalTenantService as ɵbd, RegisterDocumentModule as ɵbe, RegisterDocumentComponent as ɵbf, InsertKeyModule as ɵbg, InsertKeyComponent as ɵbh, IntegrationService$1 as ɵbi, RecebimentoFormComponent as ɵbj, DerivacaoService as ɵbk, NotaValidatorService as ɵbl, TransgeniaService as ɵbm, VerificaNotafiscal as ɵbn, BuildFormField as ɵbo, ExpedicaoFormComponent as ɵbp, ExpedicaoInfoComponent as ɵbq, RecebimentoInfoComponent as ɵbr, DevolucaoFormComponent as ɵbs, DevolucaoService as ɵbt, DevolucaoChegadaVeiculoOverride as ɵbu, RecebimentoOrdemCompraFormComponent as ɵbv, OrdemCompraService as ɵbw, RecebimentoOrdemCompraService as ɵbx, RecebimentoOrdemCompraChegadaVeiculoOverride as ɵby, RecebimentoOrdemCompraInfoComponent as ɵbz, ViewImageComponent as ɵc, DevolucaoInfoComponent as ɵca, ContratoFormComponent as ɵcb, OrdemCompraFormComponent as ɵcc, ProcessoAvulsoFormComponent as ɵcd, ProcessoAvulsoService as ɵce, ProcessoAvulsoChegadaVeiculoOverride as ɵcf, ProcessoAvulsoInfoComponent as ɵcg, LogIntegracaoDescritor as ɵch, LogIntegracaoComponent as ɵci, LogIntegracaoService as ɵcj, DerivacaoModule as ɵck, DevolucaoModule as ɵcl, OrdemCompraModule as ɵcm, RecebimentoOrdemCompraModule as ɵcn, TransgeniaModule as ɵco, ProcessoAvulsoModule as ɵcp, LogIntegracaoModule as ɵcq, NotaFormModule as ɵcr, DirectivesModule as ɵcs, TrimDirective as ɵct, NotaFormComponent as ɵcu, LogDescritor as ɵd, LogsComponent as ɵe, PortariasService as ɵf, EntradaComponent as ɵg, AgendasComponent as ɵh, ConfirmacaoComponent as ɵi, VisitedInfoDescritor as ɵj, VisitedInfoComponent as ɵk, VisitedInfoService as ɵl, SchedulingComponent as ɵm, LobbyService as ɵn, EntityService as ɵo, SchedulingService as ɵp, VisitanteComponent as ɵq, VisitanteFormComponent as ɵr, CredencialFormComponent as ɵs, FocusService as ɵt, FormWmsService as ɵu, DocumentGridModule as ɵv, DocumentGridComponent as ɵw, DocumentService as ɵx, IntegrationService as ɵy, AgendaService as ɵz };
13444
13655
  //# sourceMappingURL=seniorsistemas-yms-integration.js.map