@seniorsistemas/yms-integration 1.48.0 → 1.49.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.
@@ -1,5 +1,5 @@
1
1
  import { Subject, throwError, BehaviorSubject, empty, ReplaySubject, NEVER, forkJoin, Observable, of } from 'rxjs';
2
- import { takeUntil, catchError, finalize, map, filter, mergeMap, tap, concatMap, switchMap, debounceTime } from 'rxjs/operators';
2
+ import { takeUntil, catchError, finalize, map, filter, mergeMap, tap, debounceTime, concatMap, switchMap } from 'rxjs/operators';
3
3
  import { __decorate, __metadata, __param } from 'tslib';
4
4
  import { CommonModule } from '@angular/common';
5
5
  import { Injectable, Input, Component, NgModule, Output, defineInjectable, inject, EventEmitter, ViewChild, TemplateRef, Pipe, InjectionToken, Inject, HostListener, Directive, ElementRef } from '@angular/core';
@@ -3810,6 +3810,7 @@ let DocumentGridFacade = class DocumentGridFacade {
3810
3810
  this.dadosColetaService = dadosColetaService;
3811
3811
  this.ngUnsubscribe = new Subject();
3812
3812
  this.summary = "yms.int.wms_saved_document_message_title";
3813
+ this.searchSubject = new Subject();
3813
3814
  this.currentStrategy = null;
3814
3815
  // State subjects
3815
3816
  this.stateSubject = new BehaviorSubject({
@@ -3817,6 +3818,8 @@ let DocumentGridFacade = class DocumentGridFacade {
3817
3818
  selection: [],
3818
3819
  gridColumns: [],
3819
3820
  documentTotalRecords: 0,
3821
+ searchTerm: "",
3822
+ searchLoading: false,
3820
3823
  loading: false,
3821
3824
  disabled: true,
3822
3825
  showInvoiceSearchModal: false,
@@ -3838,6 +3841,11 @@ let DocumentGridFacade = class DocumentGridFacade {
3838
3841
  init(agenda, wmsSystem) {
3839
3842
  this.agenda = agenda;
3840
3843
  this.updateState({ wmsSystem });
3844
+ this.searchSubject
3845
+ .pipe(debounceTime(500), takeUntil(this.ngUnsubscribe))
3846
+ .subscribe(() => {
3847
+ this.listDocuments(false);
3848
+ });
3841
3849
  this.verifyClienteExterno();
3842
3850
  this.getProcessTypeByScheduling();
3843
3851
  this.listDocuments(false);
@@ -4052,10 +4060,16 @@ let DocumentGridFacade = class DocumentGridFacade {
4052
4060
  notSavedDocuments() {
4053
4061
  return this.state.gridData.some((document) => !document.id);
4054
4062
  }
4063
+ onSearchTermChange(searchTerm) {
4064
+ this.updateState({ searchTerm, searchLoading: true });
4065
+ this.searchSubject.next(searchTerm);
4066
+ }
4055
4067
  listDocuments(isDelete) {
4068
+ const filterQuery = this.buildFilterQuery(this.state.searchTerm);
4069
+ this.updateState({ searchLoading: true });
4056
4070
  this.documentService
4057
4071
  .list({
4058
- filterQuery: `schedulingId eq '${this.agenda.id}'`,
4072
+ filterQuery,
4059
4073
  size: 100,
4060
4074
  })
4061
4075
  .subscribe((contents) => {
@@ -4076,6 +4090,7 @@ let DocumentGridFacade = class DocumentGridFacade {
4076
4090
  gridData: documentsWithColeta,
4077
4091
  disabled: !hasElementWithoutId,
4078
4092
  loading: false,
4093
+ searchLoading: false,
4079
4094
  selection: [],
4080
4095
  documentTotalRecords,
4081
4096
  });
@@ -4086,12 +4101,22 @@ let DocumentGridFacade = class DocumentGridFacade {
4086
4101
  gridData: newGridData,
4087
4102
  disabled: !hasElementWithoutId,
4088
4103
  loading: false,
4104
+ searchLoading: false,
4089
4105
  selection: [],
4090
4106
  documentTotalRecords,
4091
4107
  });
4092
4108
  }
4093
4109
  });
4094
4110
  }
4111
+ buildFilterQuery(searchTerm) {
4112
+ const schedulingFilter = `schedulingId eq '${this.agenda.id}'`;
4113
+ const term = (searchTerm || "").trim();
4114
+ if (!term) {
4115
+ return schedulingFilter;
4116
+ }
4117
+ const escapedTerm = term.replace(/'/g, "''");
4118
+ return `${schedulingFilter} and (containing(key,'${escapedTerm}') or containing(invoiceNumber,'${escapedTerm}') or containing(partnerDocument,'${escapedTerm}'))`;
4119
+ }
4095
4120
  fetchNumeroColetaForDocuments(documents) {
4096
4121
  // Busca o número da coleta para a agenda
4097
4122
  return new Observable((observer) => {
@@ -4282,6 +4307,9 @@ let DocumentGridComponent = class DocumentGridComponent {
4282
4307
  onSearch() {
4283
4308
  this.facade.openInvoiceKeyModal();
4284
4309
  }
4310
+ onSearchTermChange(searchTerm) {
4311
+ this.facade.onSearchTermChange(searchTerm);
4312
+ }
4285
4313
  };
4286
4314
  __decorate([
4287
4315
  Input(),
@@ -4330,8 +4358,8 @@ __decorate([
4330
4358
  DocumentGridComponent = __decorate([
4331
4359
  Component({
4332
4360
  selector: "document-grid",
4333
- template: "<ng-container *ngIf=\"state$ | async as state\">\n <div\n *ngIf=\"state.processType === 'RECEBIMENTO_WMS' || state.processType === 'EXPEDICAO_WMS'; else processNotConfigured\"\n >\n <p-panel>\n <p-header>\n <div class=\"buttons\">\n <div>\n <s-button\n *ngIf=\"!isExpedicaoWms(state.processType)\"\n label=\"{{ 'yms.int.wms_add_document' | translate }}\"\n priority=\"primary\"\n [model]=\"getActions()\"\n [auxiliary]=\"false\"\n [disabled]=\"!state.enableButtonIsClienteExterno\"\n >\n </s-button>\n <s-button\n *ngIf=\"isExpedicaoWms(state.processType)\"\n label=\"{{ 'yms.int.wms_search' | translate }}\"\n priority=\"primary\"\n iconClass=\"fa fa-search\"\n [auxiliary]=\"false\"\n [disabled]=\"!state.enableButtonIsClienteExterno\"\n (onClick)=\"onSearch()\"\n >\n </s-button>\n <s-button\n label=\"{{ 'yms.wms_view_button' | translate }}\"\n priority=\"secondary\"\n [auxiliary]=\"false\"\n [disabled]=\"!state.selection || state.selection.length !== 1\"\n (onClick)=\"onView()\"\n >\n </s-button>\n <s-button\n *ngIf=\"!isExpedicaoWms(state.processType)\"\n label=\"{{ 'yms.wms_delete_button' | translate }}\"\n priority=\"secondary\"\n [disabled]=\"\n !state.selection ||\n !state.selection.length ||\n !state.enableButtonIsClienteExterno\n \"\n (onClick)=\"onDelete()\"\n >\n </s-button>\n </div>\n <s-button\n id=\"refresh-button\"\n priority=\"default\"\n iconClass=\"fa fa-refresh\"\n (onClick)=\"onRefresh()\"\n [disabled]=\"notSavedDocuments()\"\n >\n </s-button>\n </div>\n </p-header>\n <div class=\"ui-g\">\n <div\n class=\"ui-g-12\"\n *ngIf=\"state.gridData && state.gridData.length; else emptyList\"\n >\n <p-table\n #documentTable\n [value]=\"state.gridData\"\n [columns]=\"state.gridColumns\"\n dataKey=\"key\"\n [scrollable]=\"true\"\n [resizableColumns]=\"true\"\n [autoLayout]=\"true\"\n [paginator]=\"true\"\n [totalRecords]=\"state.documentTotalRecords\"\n rows=\"10\"\n [rowsPerPageOptions]=\"[10, 20, 50, 100]\"\n [(selection)]=\"state.selection\"\n [loading]=\"state.loading\"\n >\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\n pTemplate=\"body\"\n let-rowData\n let-columns\n let-expanded=\"expanded\"\n >\n <tr [pSelectableRow]=\"rowData\">\n <td class=\"table-checkbox\">\n <p-tableCheckbox [value]=\"rowData\"></p-tableCheckbox>\n </td>\n <td\n *ngFor=\"let col of state.gridColumns\"\n (click)=\"onRowSelect(rowData)\"\n (keypress)=\"onRowSelect(rowData)\"\n [title]=\"rowData[col.field]\"\n >\n <span *ngIf=\"!col.type || col.type === 'text'\">\n {{ rowData[col.field] }}\n </span>\n\n <span\n *ngIf=\"\n col.type === 'formatted' && col.pipe === 'cpfCnpjFormat'\n \"\n >\n {{ rowData[col.field] | cpfCnpjFormat }}\n </span>\n\n <p-dropdown\n *ngIf=\"\n col.type === 'dropdown' &&\n col.field === 'invoiceCondition' &&\n !isExpedicaoWms(state.processType)\n \"\n inputId=\"invoiceCondition\"\n name=\"invoiceCondition\"\n [autoWidth]=\"false\"\n [options]=\"\n getFilteredInvoiceConditions(rowData?.invoiceCondition)\n \"\n appendTo=\"body\"\n [(ngModel)]=\"rowData.invoiceCondition\"\n (onChange)=\"onInvoiceConditionChange()\"\n >\n </p-dropdown>\n </td>\n </tr>\n </ng-template>\n <ng-template pTemplate=\"paginatorright\">\n <span\n [translate]=\"'yms.main.total_records'\"\n [translateParams]=\"{ value: state.documentTotalRecords }\"\n >\n </span>\n </ng-template>\n </p-table>\n </div>\n </div>\n <register-document\n [wmsSystem]=\"state.wmsSystem\"\n [processType]=\"state.processType\"\n [edit]=\"state.edit\"\n [viewDocument]=\"state.selection\"\n [(visible)]=\"state.showAddInvoiceModal\"\n [agenda]=\"agenda\"\n [isClienteExterno]=\"state.isClienteExterno\"\n (document)=\"onDocumentChange($event)\"\n >\n </register-document>\n <insert-key\n [wmsSystem]=\"state.wmsSystem\"\n [agenda]=\"agenda\"\n [(visible)]=\"state.showInvoiceSearchModal\"\n >\n </insert-key>\n </p-panel>\n </div>\n <div class=\"button-save\">\n <s-button\n priority=\"primary\"\n [label]=\"'save' | translate\"\n [disabled]=\"\n state.disabled || !state.gridData || !state.enableButtonIsClienteExterno\n \"\n (onClick)=\"onSave()\"\n >\n </s-button>\n </div>\n</ng-container>\n\n<ng-template #emptyList>\n <div class=\"center\">\n <s-empty-state\n iconClass=\"fa fa-exclamation-triangle\"\n [title]=\"'detail_empty_state_title' | translate\"\n [description]=\"'detail_empty_state_description' | translate\"\n >\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]=\"\n 'yms.int.wms_there_no_process_type_configured_for_this_type_scheduling'\n | translate\n \"\n >\n </s-empty-state>\n </div>\n</ng-template>\n",
4334
- 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;min-width:50px;max-width:50px}.invoice-condition .p-dropdown{position:relative;z-index:1000}::ng-deep p-table .ui-table{table-layout:auto!important}::ng-deep p-table td:nth-child(1),::ng-deep p-table th:nth-child(1){min-width:50px;max-width:50px;width:50px}::ng-deep p-table td:nth-child(3),::ng-deep p-table td:nth-child(4),::ng-deep p-table td:nth-child(5),::ng-deep p-table th:nth-child(3),::ng-deep p-table th:nth-child(4),::ng-deep p-table th:nth-child(5){min-width:100px}::ng-deep p-table td:nth-child(7),::ng-deep p-table td:nth-child(9),::ng-deep p-table th:nth-child(7),::ng-deep p-table th:nth-child(9){min-width:140px}::ng-deep p-table td:nth-child(10),::ng-deep p-table td:nth-child(2),::ng-deep p-table td:nth-child(6),::ng-deep p-table td:nth-child(8),::ng-deep p-table th:nth-child(10),::ng-deep p-table th:nth-child(2),::ng-deep p-table th:nth-child(6),::ng-deep p-table th:nth-child(8){min-width:180px}::ng-deep p-table td span{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}::ng-deep p-table .ui-resizable-column{border-right:1px solid #c8c8c8}::ng-deep p-table .ui-column-resizer{display:block;position:absolute;top:0;right:0;margin:0;width:.5rem;height:100%;padding:0;cursor:col-resize;border:1px solid transparent}::ng-deep p-table .ui-column-resizer:hover{border-color:#007ad9}"]
4361
+ template: "<ng-container *ngIf=\"state$ | async as state\">\n <div\n *ngIf=\"state.processType === 'RECEBIMENTO_WMS' || state.processType === 'EXPEDICAO_WMS'; else processNotConfigured\"\n >\n <p-panel>\n <p-header>\n <div class=\"buttons\">\n <div>\n <s-button\n *ngIf=\"!isExpedicaoWms(state.processType)\"\n label=\"{{ 'yms.int.wms_add_document' | translate }}\"\n priority=\"primary\"\n [model]=\"getActions()\"\n [auxiliary]=\"false\"\n [disabled]=\"!state.enableButtonIsClienteExterno\"\n >\n </s-button>\n <s-button\n *ngIf=\"isExpedicaoWms(state.processType)\"\n label=\"{{ 'yms.int.wms_search' | translate }}\"\n priority=\"primary\"\n iconClass=\"fa fa-search\"\n [auxiliary]=\"false\"\n [disabled]=\"!state.enableButtonIsClienteExterno\"\n (onClick)=\"onSearch()\"\n >\n </s-button>\n <s-button\n label=\"{{ 'yms.wms_view_button' | translate }}\"\n priority=\"secondary\"\n [auxiliary]=\"false\"\n [disabled]=\"!state.selection || state.selection.length !== 1\"\n (onClick)=\"onView()\"\n >\n </s-button>\n <s-button\n *ngIf=\"!isExpedicaoWms(state.processType)\"\n label=\"{{ 'yms.wms_delete_button' | translate }}\"\n priority=\"secondary\"\n [disabled]=\"\n !state.selection ||\n !state.selection.length ||\n !state.enableButtonIsClienteExterno\n \"\n (onClick)=\"onDelete()\"\n >\n </s-button>\n </div>\n <div class=\"document-search\">\n <input\n pInputText\n type=\"text\"\n [ngModel]=\"state.searchTerm\"\n (ngModelChange)=\"onSearchTermChange($event)\"\n [placeholder]=\"'yms.int.wms_search' | translate\"\n />\n <i *ngIf=\"state.searchLoading\" class=\"fa fa-circle-notch fa-spin document-search-spinner\"></i>\n </div>\n <s-button\n id=\"refresh-button\"\n priority=\"default\"\n iconClass=\"fa fa-refresh\"\n (onClick)=\"onRefresh()\"\n [disabled]=\"notSavedDocuments()\"\n >\n </s-button>\n </div>\n </p-header>\n <div class=\"ui-g\">\n <div\n class=\"ui-g-12\"\n *ngIf=\"state.gridData && state.gridData.length; else emptyList\"\n >\n <p-table\n #documentTable\n [value]=\"state.gridData\"\n [columns]=\"state.gridColumns\"\n dataKey=\"key\"\n [scrollable]=\"true\"\n [resizableColumns]=\"true\"\n [autoLayout]=\"true\"\n [paginator]=\"true\"\n [totalRecords]=\"state.documentTotalRecords\"\n rows=\"10\"\n [rowsPerPageOptions]=\"[10, 20, 50, 100]\"\n [(selection)]=\"state.selection\"\n [loading]=\"state.loading\"\n >\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\n pTemplate=\"body\"\n let-rowData\n let-columns\n let-expanded=\"expanded\"\n >\n <tr [pSelectableRow]=\"rowData\">\n <td class=\"table-checkbox\">\n <p-tableCheckbox [value]=\"rowData\"></p-tableCheckbox>\n </td>\n <td\n *ngFor=\"let col of state.gridColumns\"\n (click)=\"onRowSelect(rowData)\"\n (keypress)=\"onRowSelect(rowData)\"\n [title]=\"rowData[col.field]\"\n >\n <span *ngIf=\"!col.type || col.type === 'text'\">\n {{ rowData[col.field] }}\n </span>\n\n <span\n *ngIf=\"\n col.type === 'formatted' && col.pipe === 'cpfCnpjFormat'\n \"\n >\n {{ rowData[col.field] | cpfCnpjFormat }}\n </span>\n\n <p-dropdown\n *ngIf=\"\n col.type === 'dropdown' &&\n col.field === 'invoiceCondition' &&\n !isExpedicaoWms(state.processType)\n \"\n inputId=\"invoiceCondition\"\n name=\"invoiceCondition\"\n [autoWidth]=\"false\"\n [options]=\"\n getFilteredInvoiceConditions(rowData?.invoiceCondition)\n \"\n appendTo=\"body\"\n [(ngModel)]=\"rowData.invoiceCondition\"\n (onChange)=\"onInvoiceConditionChange()\"\n >\n </p-dropdown>\n </td>\n </tr>\n </ng-template>\n <ng-template pTemplate=\"paginatorright\">\n <span\n [translate]=\"'yms.main.total_records'\"\n [translateParams]=\"{ value: state.documentTotalRecords }\"\n >\n </span>\n </ng-template>\n </p-table>\n </div>\n </div>\n <register-document\n [wmsSystem]=\"state.wmsSystem\"\n [processType]=\"state.processType\"\n [edit]=\"state.edit\"\n [viewDocument]=\"state.selection\"\n [(visible)]=\"state.showAddInvoiceModal\"\n [agenda]=\"agenda\"\n [isClienteExterno]=\"state.isClienteExterno\"\n (document)=\"onDocumentChange($event)\"\n >\n </register-document>\n <insert-key\n [wmsSystem]=\"state.wmsSystem\"\n [agenda]=\"agenda\"\n [(visible)]=\"state.showInvoiceSearchModal\"\n >\n </insert-key>\n </p-panel>\n </div>\n <div class=\"button-save\">\n <s-button\n priority=\"primary\"\n [label]=\"'save' | translate\"\n [disabled]=\"\n state.disabled || !state.gridData || !state.enableButtonIsClienteExterno\n \"\n (onClick)=\"onSave()\"\n >\n </s-button>\n </div>\n</ng-container>\n\n<ng-template #emptyList>\n <div class=\"center\">\n <s-empty-state\n iconClass=\"fa fa-exclamation-triangle\"\n [title]=\"'detail_empty_state_title' | translate\"\n [description]=\"'detail_empty_state_description' | translate\"\n >\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]=\"\n 'yms.int.wms_there_no_process_type_configured_for_this_type_scheduling'\n | translate\n \"\n >\n </s-empty-state>\n </div>\n</ng-template>\n",
4362
+ styles: [".buttons{display:flex;justify-content:space-between;align-items:center;gap:12px}.document-search{flex:1;max-width:420px;position:relative}.document-search input{display:block;width:100%;padding-right:32px}.document-search-spinner{position:absolute;right:10px;top:0;bottom:0;margin:auto 0;width:1em;height:1em;line-height:1;color:#007ad9;pointer-events:none}.center{flex-direction:column;text-align:center}.ui-g{display:block}.button-save{margin:5px 0}#refresh-button{color:#fff}@media (max-width:1200px){.buttons{flex-wrap:wrap}.document-search{order:3;flex-basis:100%;max-width:100%}}.table-checkbox{width:50px;min-width:50px;max-width:50px}.invoice-condition .p-dropdown{position:relative;z-index:1000}::ng-deep p-table .ui-table{table-layout:auto!important}::ng-deep p-table td:nth-child(1),::ng-deep p-table th:nth-child(1){min-width:50px;max-width:50px;width:50px}::ng-deep p-table td:nth-child(3),::ng-deep p-table td:nth-child(4),::ng-deep p-table td:nth-child(5),::ng-deep p-table th:nth-child(3),::ng-deep p-table th:nth-child(4),::ng-deep p-table th:nth-child(5){min-width:100px}::ng-deep p-table td:nth-child(7),::ng-deep p-table td:nth-child(9),::ng-deep p-table th:nth-child(7),::ng-deep p-table th:nth-child(9){min-width:140px}::ng-deep p-table td:nth-child(10),::ng-deep p-table td:nth-child(2),::ng-deep p-table td:nth-child(6),::ng-deep p-table td:nth-child(8),::ng-deep p-table th:nth-child(10),::ng-deep p-table th:nth-child(2),::ng-deep p-table th:nth-child(6),::ng-deep p-table th:nth-child(8){min-width:180px}::ng-deep p-table td span{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}::ng-deep p-table .ui-resizable-column{border-right:1px solid #c8c8c8}::ng-deep p-table .ui-column-resizer{display:block;position:absolute;top:0;right:0;margin:0;width:.5rem;height:100%;padding:0;cursor:col-resize;border:1px solid transparent}::ng-deep p-table .ui-column-resizer:hover{border-color:#007ad9}"]
4335
4363
  }),
4336
4364
  __metadata("design:paramtypes", [DocumentGridFacade,
4337
4365
  ConfirmationService,
@@ -4902,6 +4930,7 @@ DocumentGridModule = __decorate([
4902
4930
  DropdownModule,
4903
4931
  FormsModule,
4904
4932
  ConfirmDialogModule,
4933
+ InputTextModule,
4905
4934
  CpfCnpjFormatModule,
4906
4935
  ],
4907
4936
  })
@@ -4965,6 +4994,10 @@ DocumentListDescritor = __decorate([
4965
4994
  ControleCircuito({
4966
4995
  header: INFORMACAOES_ADICIONAIS_HEADER$1,
4967
4996
  name: 'yms.integracao.wms'
4997
+ }),
4998
+ CircuitoFinalizado({
4999
+ header: INFORMACAOES_ADICIONAIS_HEADER$1,
5000
+ name: 'yms.integracao.wms'
4968
5001
  })
4969
5002
  ], DocumentListDescritor);
4970
5003
  let DocumentListComponent = class DocumentListComponent extends DocumentListDescritor {
@@ -4977,6 +5010,7 @@ let DocumentListComponent = class DocumentListComponent extends DocumentListDesc
4977
5010
  this.documents = [];
4978
5011
  this.amendedDocuments = [];
4979
5012
  this.labels = [];
5013
+ this.gridTotalRecords = 0;
4980
5014
  this.selected = [];
4981
5015
  this.gridLoading = true;
4982
5016
  this.ngUnsubscribe = new Subject();