@seniorsistemas/yms-integration 1.35.0 → 1.36.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 (24) hide show
  1. package/bundles/seniorsistemas-yms-integration.umd.js +71 -21
  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 +3 -9
  6. package/esm2015/src/wms/components/document-grid/register-document/register-document.component.js +3 -10
  7. package/esm2015/src/wms/components/document-list/document-list.component.js +56 -5
  8. package/esm2015/src/wms/components/document-list/document-list.module.js +8 -3
  9. package/esm2015/src/wms/components/utils/invoice-conditions.js +12 -0
  10. package/esm5/src/wms/components/document-grid/document-grid.component.js +3 -9
  11. package/esm5/src/wms/components/document-grid/register-document/register-document.component.js +3 -10
  12. package/esm5/src/wms/components/document-list/document-list.component.js +58 -5
  13. package/esm5/src/wms/components/document-list/document-list.module.js +8 -3
  14. package/esm5/src/wms/components/utils/invoice-conditions.js +12 -0
  15. package/fesm2015/seniorsistemas-yms-integration.js +69 -21
  16. package/fesm2015/seniorsistemas-yms-integration.js.map +1 -1
  17. package/fesm5/seniorsistemas-yms-integration.js +71 -21
  18. package/fesm5/seniorsistemas-yms-integration.js.map +1 -1
  19. package/package.json +1 -1
  20. package/seniorsistemas-yms-integration.metadata.json +1 -1
  21. package/src/wms/components/document-grid/document-grid.component.d.ts +4 -4
  22. package/src/wms/components/document-grid/register-document/register-document.component.d.ts +1 -1
  23. package/src/wms/components/document-list/document-list.component.d.ts +19 -1
  24. package/src/wms/components/utils/invoice-conditions.d.ts +6 -0
@@ -3356,6 +3356,17 @@
3356
3356
  InvoiceCondition["REJECTED"] = "REJECTED";
3357
3357
  })(InvoiceCondition || (InvoiceCondition = {}));
3358
3358
 
3359
+ function getInvoiceConditions(translate) {
3360
+ return [
3361
+ { label: translate.instant("yms.int.wms_grid_document_invoice_no_way"), value: null },
3362
+ { label: translate.instant("yms.int.wms_grid_document_invoice_condition_authorized"), value: InvoiceCondition.AUTHORIZED },
3363
+ { label: translate.instant("yms.int.wms_grid_document_invoice_condition_manual_authorized"), value: InvoiceCondition.MANUAL_AUTHORIZED },
3364
+ { label: translate.instant("yms.int.wms_grid_document_invoice_condition_partial_authorized"), value: InvoiceCondition.PARTIAL_AUTHORIZED },
3365
+ { label: translate.instant("yms.int.wms_grid_document_invoice_condition_devolution"), value: InvoiceCondition.DEVOLUTION },
3366
+ { label: translate.instant("yms.int.wms_grid_document_invoice_condition_rejected"), value: InvoiceCondition.REJECTED },
3367
+ ];
3368
+ }
3369
+
3359
3370
  var DocumentGridComponent = /** @class */ (function () {
3360
3371
  function DocumentGridComponent(translate, documentService, confirmationService, integrationService, agendaService, utils) {
3361
3372
  this.translate = translate;
@@ -3367,16 +3378,9 @@
3367
3378
  this.viewDocument = new core.EventEmitter();
3368
3379
  this.gridData = [];
3369
3380
  this.enableButtonIsClienteExterno = true;
3381
+ this.invoiceConditions = getInvoiceConditions(this.translate);
3370
3382
  this.summary = "yms.int.wms_saved_document_message_title";
3371
3383
  this.ngUnsubscribe = new rxjs.Subject();
3372
- this.invoiceConditions = [
3373
- { label: this.translate.instant("yms.int.wms_grid_document_invoice_no_way"), value: null },
3374
- { label: this.translate.instant("yms.int.wms_grid_document_invoice_condition_authorized"), value: InvoiceCondition.AUTHORIZED },
3375
- { label: this.translate.instant("yms.int.wms_grid_document_invoice_condition_manual_authorized"), value: InvoiceCondition.MANUAL_AUTHORIZED },
3376
- { label: this.translate.instant("yms.int.wms_grid_document_invoice_condition_partial_authorized"), value: InvoiceCondition.PARTIAL_AUTHORIZED },
3377
- { label: this.translate.instant("yms.int.wms_grid_document_invoice_condition_devolution"), value: InvoiceCondition.DEVOLUTION },
3378
- { label: this.translate.instant("yms.int.wms_grid_document_invoice_condition_rejected"), value: InvoiceCondition.REJECTED },
3379
- ];
3380
3384
  this.selection = [];
3381
3385
  }
3382
3386
  DocumentGridComponent.prototype.getFilteredInvoiceConditions = function (invoiceConditions) {
@@ -3760,14 +3764,7 @@
3760
3764
  this.visible = new core.EventEmitter();
3761
3765
  this.visibleChange = new core.EventEmitter();
3762
3766
  this.isSaveFormValid = false;
3763
- this.invoiceCondition = [
3764
- { label: this.translate.instant("yms.int.wms_grid_document_invoice_no_way"), value: null },
3765
- { label: this.translate.instant("yms.int.wms_grid_document_invoice_condition_authorized"), value: InvoiceCondition.AUTHORIZED },
3766
- { label: this.translate.instant("yms.int.wms_grid_document_invoice_condition_manual_authorized"), value: InvoiceCondition.MANUAL_AUTHORIZED },
3767
- { label: this.translate.instant("yms.int.wms_grid_document_invoice_condition_partial_authorized"), value: InvoiceCondition.PARTIAL_AUTHORIZED },
3768
- { label: this.translate.instant("yms.int.wms_grid_document_invoice_condition_devolution"), value: InvoiceCondition.DEVOLUTION },
3769
- { label: this.translate.instant("yms.int.wms_grid_document_invoice_condition_rejected"), value: InvoiceCondition.REJECTED },
3770
- ];
3767
+ this.invoiceCondition = getInvoiceConditions(this.translate);
3771
3768
  }
3772
3769
  RegisterDocumentComponent.prototype.ngOnInit = function () {
3773
3770
  this.getFormGroup();
@@ -4230,15 +4227,27 @@
4230
4227
  }());
4231
4228
  var DocumentListComponent = /** @class */ (function (_super) {
4232
4229
  __extends(DocumentListComponent, _super);
4233
- function DocumentListComponent(documentService) {
4230
+ function DocumentListComponent(documentService, translate, utils) {
4234
4231
  var _this = _super.call(this) || this;
4235
4232
  _this.documentService = documentService;
4233
+ _this.translate = translate;
4234
+ _this.utils = utils;
4236
4235
  _this.getColumns = [];
4237
4236
  _this.documents = [];
4237
+ _this.amendedDocuments = [];
4238
4238
  _this.labels = [];
4239
4239
  _this.selected = [];
4240
4240
  _this.gridLoading = true;
4241
4241
  _this.ngUnsubscribe = new rxjs.Subject();
4242
+ _this.invoiceConditions = [
4243
+ { label: _this.translate.instant("yms.int.wms_grid_document_invoice_no_way"), value: null },
4244
+ { label: _this.translate.instant("yms.int.wms_grid_document_invoice_condition_authorized"), value: InvoiceCondition.AUTHORIZED },
4245
+ { label: _this.translate.instant("yms.int.wms_grid_document_invoice_condition_manual_authorized"), value: InvoiceCondition.MANUAL_AUTHORIZED },
4246
+ { label: _this.translate.instant("yms.int.wms_grid_document_invoice_condition_partial_authorized"), value: InvoiceCondition.PARTIAL_AUTHORIZED },
4247
+ { label: _this.translate.instant("yms.int.wms_grid_document_invoice_condition_devolution"), value: InvoiceCondition.DEVOLUTION },
4248
+ { label: _this.translate.instant("yms.int.wms_grid_document_invoice_condition_rejected"), value: InvoiceCondition.REJECTED },
4249
+ ];
4250
+ _this.isAuthorized = function (condition) { return (condition === InvoiceCondition.AUTHORIZED); };
4242
4251
  return _this;
4243
4252
  }
4244
4253
  DocumentListComponent.prototype.getColumnLabels = function () {
@@ -4285,6 +4294,42 @@
4285
4294
  _this.searchDocument(event);
4286
4295
  });
4287
4296
  };
4297
+ DocumentListComponent.prototype.getFilteredInvoiceConditions = function (invoiceConditions) {
4298
+ if (invoiceConditions === InvoiceCondition.AUTHORIZED) {
4299
+ return this.invoiceConditions.filter(function (cond) { return cond.value === InvoiceCondition.AUTHORIZED; });
4300
+ }
4301
+ else {
4302
+ return this.invoiceConditions.filter(function (cond) { return cond.value !== InvoiceCondition.AUTHORIZED; });
4303
+ }
4304
+ };
4305
+ DocumentListComponent.prototype.onInvoiceConditionChange = function (event, document) {
4306
+ var _this = this;
4307
+ this.disabled = true;
4308
+ document.invoiceCondition = event.value;
4309
+ if (this.amendedDocuments.length > 0) {
4310
+ this.amendedDocuments.forEach(function (doc) {
4311
+ if (doc.id === document.id) {
4312
+ doc.invoiceCondition = event.value;
4313
+ }
4314
+ else {
4315
+ _this.amendedDocuments.push(document);
4316
+ }
4317
+ });
4318
+ }
4319
+ else {
4320
+ this.amendedDocuments.push(document);
4321
+ }
4322
+ };
4323
+ DocumentListComponent.prototype.save = function () {
4324
+ var _this = this;
4325
+ this.amendedDocuments.forEach(function (document) {
4326
+ _this.documentService.update(document.id, document).subscribe(function () {
4327
+ _this.utils.message("success", "yms.int.wms_saved_document_message_title", "saved_message_content");
4328
+ _this.disabled = false;
4329
+ });
4330
+ });
4331
+ this.amendedDocuments = [];
4332
+ };
4288
4333
  DocumentListComponent.prototype.searchDocument = function (event) {
4289
4334
  var _this = this;
4290
4335
  var size = event.rows;
@@ -4315,10 +4360,12 @@
4315
4360
  ], DocumentListComponent.prototype, "wmsSystem", void 0);
4316
4361
  DocumentListComponent = __decorate([
4317
4362
  core.Component({
4318
- template: "<div class=\"ui-g\">\n <div class=\"ui-g-12\">\n <p-table\n selectionMode=\"single\"\n [(selection)]=\"selected\"\n [value]=\"documents\"\n [columns]=\"getColumns\"\n dataKey=\"id\"\n rows=\"10\"\n [paginator]=\"true\"\n [totalRecords]=\"gridTotalRecords\"\n [lazy]=\"true\"\n [resizableColumns]=\"true\"\n (onLazyLoad)=\"updateGridData($event)\"\n *sLoadingState=\"gridLoading\"\n sortMode=\"multiple\"\n styleClass=\"sds-table-scrollable\"\n [rowsPerPageOptions]=\"[10, 20, 50, 100, 200]\"\n paginatorDropdownScrollHeight=\"250px\"\n [scrollable]=\"true\"\n >\n <ng-template pTemplate=\"colgroup\" let-columns>\n <colgroup>\n <col *ngFor=\"let col of columns\" class=\"table-col-width\">\n </colgroup>\n </ng-template>\n\n <ng-template pTemplate=\"header\" let-columns>\n <tr>\n <th *ngFor=\"let col of columns\" pResizableColumn [pSortableColumn]=\"col.field\" scope=\"col\">\n <div class=\"senior-header\">\n <span class=\"senior-header-title\">{{ col.label | translate }}</span>\n <p-sortIcon [field]=\"col.field\"></p-sortIcon>\n </div>\n </th>\n </tr>\n </ng-template>\n\n <ng-template pTemplate=\"body\" let-rowData let-columns=\"columns\">\n <tr *ngIf=\"isWmsWIS()\">\n <td>{{ rowData?.invoiceNumber || 'N/A' }}</td>\n <td>{{ rowData?.invoiceSerialNumber || 'N/A' }}</td>\n <td>{{ rowData?.invoiceKey || 'N/A' }}</td>\n <td>{{ rowData?.partnerName || 'N/A' }}</td>\n <td>{{ rowData?.partnerDocument || 'N/A' }}</td>\n <td>{{ rowData?.code || 'N/A' }}</td>\n <td>\n {{ getInvoiceConditionTranslation(rowData?.invoiceCondition) | translate }}\n </td>\n <td>{{ rowData?.notes || 'N/A' }}</td>\n </tr>\n <tr *ngIf=\"isWmsSeniorConnect()\">\n <td>{{rowData?.key}}</td>\n <td>{{rowData?.partnerName}}</td>\n <td>{{rowData?.partnerDocument}}</td>\n </tr>\n <tr *ngIf=\"!isWmsWIS() && !isWmsSeniorConnect()\">\n <td>{{rowData?.invoiceKey}}</td>\n <td>{{rowData?.invoiceNumber}}</td>\n <td>{{rowData?.invoiceSerialNumber}}</td>\n </tr>\n </ng-template>\n\n <ng-template pTemplate=\"paginatorright\">\n <span>\n {{ gridTotalRecords + \" \" + \n ('yms.int.wms_register_document_total_elements' | translate:{value: gridTotalRecords}) }}\n </span>\n </ng-template>\n </p-table>\n </div>\n</div>",
4319
- styles: [".table-col-width{width:250px}"]
4363
+ 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 <p-dropdown\n inputId=\"invoiceCondition\"\n name=\"invoiceCondition\"\n [autoWidth]=\"false\"\n [options]=\"getFilteredInvoiceConditions(rowData?.invoiceCondition)\"\n appendTo=\"body\"\n [(ngModel)]=\"rowData.invoiceCondition\"\n [disabled]=\"isAuthorized(rowData.invoiceCondition)\"\n (onChange)=\"onInvoiceConditionChange($event, rowData)\">\n </p-dropdown>\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 class=\"button-save\">\n <s-button priority=\"primary\" [label]=\"'save' | translate\"\n [disabled]=\"!disabled || !this.documents\"\n (click)=\"save()\">\n </s-button>\n </div>\n </div>\n</div>",
4364
+ styles: [".table-col-width{width:250px}.button-save{margin:5px 0}"]
4320
4365
  }),
4321
- __metadata("design:paramtypes", [DocumentService])
4366
+ __metadata("design:paramtypes", [DocumentService,
4367
+ core$1.TranslateService,
4368
+ UtilsMessageService])
4322
4369
  ], DocumentListComponent);
4323
4370
  return DocumentListComponent;
4324
4371
  }(DocumentListDescritor));
@@ -4334,7 +4381,10 @@
4334
4381
  common.CommonModule,
4335
4382
  core$1.TranslateModule,
4336
4383
  angularComponents.LoadingStateModule,
4337
- table.TableModule
4384
+ table.TableModule,
4385
+ primeng.DropdownModule,
4386
+ angularComponents.ButtonModule,
4387
+ forms.FormsModule
4338
4388
  ],
4339
4389
  declarations: [DocumentListComponent],
4340
4390
  entryComponents: [DocumentListComponent],