@seniorsistemas/yms-integration 1.42.1 → 1.44.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 (62) hide show
  1. package/bundles/seniorsistemas-yms-integration.umd.js +876 -388
  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 +53 -51
  6. package/esm2015/src/sam-senior/core/entity-service.js +27 -12
  7. package/esm2015/src/wms/components/document-grid/document-grid.component.js +42 -358
  8. package/esm2015/src/wms/components/document-grid/document-grid.facade.js +380 -0
  9. package/esm2015/src/wms/components/document-grid/document-grid.module.js +19 -10
  10. package/esm2015/src/wms/components/document-grid/insert-key/insert-key.component.js +45 -44
  11. package/esm2015/src/wms/components/document-grid/register-document/register-document.component.js +28 -24
  12. package/esm2015/src/wms/components/document-grid/strategies/partner.strategy.js +48 -0
  13. package/esm2015/src/wms/components/document-grid/strategies/senior-connect.strategy.js +72 -0
  14. package/esm2015/src/wms/components/document-grid/strategies/senior-erp.strategy.js +56 -0
  15. package/esm2015/src/wms/components/document-grid/strategies/silt.strategy.js +80 -0
  16. package/esm2015/src/wms/components/document-grid/strategies/wis.strategy.js +68 -0
  17. package/esm2015/src/wms/components/document-grid/strategies/wms-integration-strategy.factory.js +31 -0
  18. package/esm2015/src/wms/components/document-grid/strategies/wms-integration-strategy.interface.js +7 -0
  19. package/esm2015/src/wms/components/utils/invoice-conditions.js +30 -9
  20. package/esm2015/src/wms/entities/document/document.service.js +11 -10
  21. package/esm2015/src/wms/entities/invoice-condition/invoice-condition.js +1 -1
  22. package/esm2015/src/wms/entities/wms-system/wms-system.js +2 -1
  23. package/esm5/seniorsistemas-yms-integration.js +53 -51
  24. package/esm5/src/sam-senior/core/entity-service.js +23 -8
  25. package/esm5/src/wms/components/document-grid/document-grid.component.js +47 -363
  26. package/esm5/src/wms/components/document-grid/document-grid.facade.js +397 -0
  27. package/esm5/src/wms/components/document-grid/document-grid.module.js +19 -10
  28. package/esm5/src/wms/components/document-grid/insert-key/insert-key.component.js +44 -43
  29. package/esm5/src/wms/components/document-grid/register-document/register-document.component.js +28 -24
  30. package/esm5/src/wms/components/document-grid/strategies/partner.strategy.js +52 -0
  31. package/esm5/src/wms/components/document-grid/strategies/senior-connect.strategy.js +76 -0
  32. package/esm5/src/wms/components/document-grid/strategies/senior-erp.strategy.js +60 -0
  33. package/esm5/src/wms/components/document-grid/strategies/silt.strategy.js +84 -0
  34. package/esm5/src/wms/components/document-grid/strategies/wis.strategy.js +72 -0
  35. package/esm5/src/wms/components/document-grid/strategies/wms-integration-strategy.factory.js +32 -0
  36. package/esm5/src/wms/components/document-grid/strategies/wms-integration-strategy.interface.js +7 -0
  37. package/esm5/src/wms/components/utils/invoice-conditions.js +30 -9
  38. package/esm5/src/wms/entities/document/document.service.js +11 -10
  39. package/esm5/src/wms/entities/invoice-condition/invoice-condition.js +1 -1
  40. package/esm5/src/wms/entities/wms-system/wms-system.js +2 -1
  41. package/fesm2015/seniorsistemas-yms-integration.js +783 -330
  42. package/fesm2015/seniorsistemas-yms-integration.js.map +1 -1
  43. package/fesm5/seniorsistemas-yms-integration.js +824 -338
  44. package/fesm5/seniorsistemas-yms-integration.js.map +1 -1
  45. package/package.json +4 -3
  46. package/seniorsistemas-yms-integration.d.ts +52 -50
  47. package/seniorsistemas-yms-integration.metadata.json +1 -1
  48. package/src/sam-senior/core/entity-service.d.ts +5 -0
  49. package/src/wms/components/document-grid/document-grid.component.d.ts +28 -77
  50. package/src/wms/components/document-grid/document-grid.facade.d.ts +96 -0
  51. package/src/wms/components/document-grid/insert-key/insert-key.component.d.ts +6 -8
  52. package/src/wms/components/document-grid/register-document/register-document.component.d.ts +5 -5
  53. package/src/wms/components/document-grid/strategies/partner.strategy.d.ts +17 -0
  54. package/src/wms/components/document-grid/strategies/senior-connect.strategy.d.ts +17 -0
  55. package/src/wms/components/document-grid/strategies/senior-erp.strategy.d.ts +17 -0
  56. package/src/wms/components/document-grid/strategies/silt.strategy.d.ts +17 -0
  57. package/src/wms/components/document-grid/strategies/wis.strategy.d.ts +17 -0
  58. package/src/wms/components/document-grid/strategies/wms-integration-strategy.factory.d.ts +8 -0
  59. package/src/wms/components/document-grid/strategies/wms-integration-strategy.interface.d.ts +53 -0
  60. package/src/wms/components/utils/invoice-conditions.d.ts +2 -2
  61. package/src/wms/entities/document/document.service.d.ts +9 -6
  62. package/src/wms/entities/wms-system/wms-system.d.ts +1 -0
@@ -2359,7 +2359,10 @@
2359
2359
  return operators.catchError(function (err) {
2360
2360
  if (err) {
2361
2361
  var summary = err.status ? String(err.status) : "Error";
2362
- var detail = (err.error && err.error.message) || err.statusText || err.message || "Error";
2362
+ var detail = (err.error && err.error.message) ||
2363
+ err.statusText ||
2364
+ err.message ||
2365
+ "Error";
2363
2366
  _this.messageService.add({
2364
2367
  severity: "error",
2365
2368
  summary: summary,
@@ -2377,24 +2380,36 @@
2377
2380
  return bodyParams;
2378
2381
  };
2379
2382
  EntityService.prototype.list = function (listParams) {
2380
- return this.http.get(this.entityUrl, { params: this.getListQueryParams(listParams) }).pipe(this.defaultCatch());
2383
+ return this.http
2384
+ .get(this.entityUrl, { params: this.getListQueryParams(listParams) })
2385
+ .pipe(this.defaultCatch());
2381
2386
  };
2382
2387
  EntityService.prototype.get = function (id, useCatch) {
2383
2388
  if (useCatch === void 0) { useCatch = true; }
2384
- return this.http.get(this.entityUrl + "/" + id).pipe(useCatch ? this.defaultCatch() : operators.tap());
2389
+ return this.http
2390
+ .get(this.entityUrl + "/" + id)
2391
+ .pipe(useCatch ? this.defaultCatch() : operators.tap());
2385
2392
  };
2386
2393
  EntityService.prototype.insert = function (entity) {
2387
- return this.http.post("" + this.entityUrl, entity).pipe(this.defaultCatch());
2394
+ return this.http
2395
+ .post("" + this.entityUrl, entity)
2396
+ .pipe(this.defaultCatch());
2388
2397
  };
2389
2398
  EntityService.prototype.update = function (id, entity, useCatch) {
2390
2399
  if (useCatch === void 0) { useCatch = true; }
2391
- return this.http.put(this.entityUrl + "/" + id, entity).pipe(useCatch ? this.defaultCatch() : operators.tap());
2400
+ return this.http
2401
+ .put(this.entityUrl + "/" + id, entity)
2402
+ .pipe(useCatch ? this.defaultCatch() : operators.tap());
2392
2403
  };
2393
2404
  EntityService.prototype.delete = function (id) {
2394
- return this.http.delete(this.entityUrl + "/" + id).pipe(this.defaultCatch());
2405
+ return this.http
2406
+ .delete(this.entityUrl + "/" + id)
2407
+ .pipe(this.defaultCatch());
2395
2408
  };
2396
2409
  EntityService.prototype.listCustomFilter = function (listParams, action) {
2397
- return this.http.post(this.actionsUrl + "/" + action, this.getBodyParams(listParams)).pipe(this.defaultCatch());
2410
+ return this.http
2411
+ .post(this.actionsUrl + "/" + action, this.getBodyParams(listParams))
2412
+ .pipe(this.defaultCatch());
2398
2413
  };
2399
2414
  return EntityService;
2400
2415
  }());
@@ -3061,6 +3076,7 @@
3061
3076
  WmsSystem["WIS"] = "WIS";
3062
3077
  WmsSystem["ALCIS"] = "ALCIS";
3063
3078
  WmsSystem["SENIOR_CONNECT"] = "SENIOR_CONNECT";
3079
+ WmsSystem["SENIOR_ERP"] = "SENIOR_ERP";
3064
3080
  WmsSystem["PARTNER"] = "PARTNER";
3065
3081
  WmsSystem["GENERIC"] = "GENERIC";
3066
3082
  })(WmsSystem || (WmsSystem = {}));
@@ -3306,23 +3322,24 @@
3306
3322
  var DocumentService = /** @class */ (function (_super) {
3307
3323
  __extends(DocumentService, _super);
3308
3324
  function DocumentService(http, messageService) {
3309
- var _this = _super.call(this, http, messageService, 'yms_int/wms/entities/document', '') || this;
3325
+ var _this = _super.call(this, http, messageService, "yms_int/wms/entities/document", "") || this;
3310
3326
  _this.http = http;
3311
3327
  _this.messageService = messageService;
3312
3328
  return _this;
3313
3329
  }
3314
3330
  DocumentService.prototype.findDocuments = function (input) {
3315
- return this.http.post('yms_int/wms/queries/findDocuments', input);
3331
+ return this.http.post("yms_int/wms/queries/findDocuments", input);
3316
3332
  };
3317
3333
  DocumentService.prototype.getSystemIntegration = function () {
3318
- return this.http.get('yms_int/wms/queries/getSystemIntegration');
3334
+ return this.http.get("yms_int/wms/queries/getSystemIntegration");
3319
3335
  };
3320
3336
  DocumentService.prototype.getYard = function (yardId) {
3321
- return this.http.get('yms/patio/entities/planta/' + yardId);
3337
+ return this.http.get("yms/patio/entities/planta/" + yardId);
3322
3338
  };
3323
3339
  DocumentService = __decorate([
3324
3340
  core.Injectable(),
3325
- __metadata("design:paramtypes", [http.HttpClient, api.MessageService])
3341
+ __metadata("design:paramtypes", [http.HttpClient,
3342
+ api.MessageService])
3326
3343
  ], DocumentService);
3327
3344
  return DocumentService;
3328
3345
  }(EntityService));
@@ -3363,181 +3380,597 @@
3363
3380
 
3364
3381
  function getInvoiceConditions(translate) {
3365
3382
  return [
3366
- { label: translate.instant("yms.int.wms_grid_document_invoice_no_way"), value: null },
3367
- { label: translate.instant("yms.int.wms_grid_document_invoice_condition_authorized"), value: InvoiceCondition.AUTHORIZED },
3368
- { label: translate.instant("yms.int.wms_grid_document_invoice_condition_manual_authorized"), value: InvoiceCondition.MANUAL_AUTHORIZED },
3369
- { label: translate.instant("yms.int.wms_grid_document_invoice_condition_partial_authorized"), value: InvoiceCondition.PARTIAL_AUTHORIZED },
3370
- { label: translate.instant("yms.int.wms_grid_document_invoice_condition_devolution"), value: InvoiceCondition.DEVOLUTION },
3371
- { label: translate.instant("yms.int.wms_grid_document_invoice_condition_rejected"), value: InvoiceCondition.REJECTED },
3372
- { label: translate.instant("yms.int.wms_grid_document_invoice_condition_divergence"), value: InvoiceCondition.DIVERGENCE },
3383
+ {
3384
+ label: translate.instant("yms.int.wms_grid_document_invoice_no_way"),
3385
+ value: null,
3386
+ },
3387
+ {
3388
+ label: translate.instant("yms.int.wms_grid_document_invoice_condition_authorized"),
3389
+ value: InvoiceCondition.AUTHORIZED,
3390
+ },
3391
+ {
3392
+ label: translate.instant("yms.int.wms_grid_document_invoice_condition_manual_authorized"),
3393
+ value: InvoiceCondition.MANUAL_AUTHORIZED,
3394
+ },
3395
+ {
3396
+ label: translate.instant("yms.int.wms_grid_document_invoice_condition_partial_authorized"),
3397
+ value: InvoiceCondition.PARTIAL_AUTHORIZED,
3398
+ },
3399
+ {
3400
+ label: translate.instant("yms.int.wms_grid_document_invoice_condition_devolution"),
3401
+ value: InvoiceCondition.DEVOLUTION,
3402
+ },
3403
+ {
3404
+ label: translate.instant("yms.int.wms_grid_document_invoice_condition_rejected"),
3405
+ value: InvoiceCondition.REJECTED,
3406
+ },
3407
+ {
3408
+ label: translate.instant("yms.int.wms_grid_document_invoice_condition_divergence"),
3409
+ value: InvoiceCondition.DIVERGENCE,
3410
+ },
3373
3411
  ];
3374
3412
  }
3375
3413
 
3376
- var DocumentGridComponent = /** @class */ (function () {
3377
- function DocumentGridComponent(translate, documentService, confirmationService, integrationService, agendaService, utils, wmsService) {
3414
+ var ColumnType;
3415
+ (function (ColumnType) {
3416
+ ColumnType["TEXT"] = "text";
3417
+ ColumnType["DROPDOWN"] = "dropdown";
3418
+ ColumnType["FORMATTED"] = "formatted";
3419
+ })(ColumnType || (ColumnType = {}));
3420
+
3421
+ var PartnerStrategy = /** @class */ (function () {
3422
+ function PartnerStrategy() {
3423
+ }
3424
+ PartnerStrategy.prototype.getGridColumns = function (translate, isClienteExterno) {
3425
+ return [
3426
+ {
3427
+ field: "invoiceKey",
3428
+ header: translate.instant("yms.int.wms_register_document_invoice_key"),
3429
+ type: ColumnType.TEXT,
3430
+ },
3431
+ {
3432
+ field: "invoiceNumber",
3433
+ header: translate.instant("yms.int.wms_register_document_invoice_number"),
3434
+ type: ColumnType.TEXT,
3435
+ },
3436
+ {
3437
+ field: "invoiceSerialNumber",
3438
+ header: translate.instant("yms.int.wms_register_document_invoice_serial_number"),
3439
+ type: ColumnType.TEXT,
3440
+ },
3441
+ {
3442
+ field: "partnerName",
3443
+ header: translate.instant("yms.int.wms_register_document_partner_name"),
3444
+ type: ColumnType.TEXT,
3445
+ },
3446
+ {
3447
+ field: "partnerDocument",
3448
+ header: translate.instant("yms.int.wms_register_document_partner_document"),
3449
+ type: ColumnType.FORMATTED,
3450
+ pipe: "cpfCnpjFormat",
3451
+ },
3452
+ ];
3453
+ };
3454
+ PartnerStrategy.prototype.updateDocumentKey = function (document) {
3455
+ return document.key || document.invoiceKey;
3456
+ };
3457
+ PartnerStrategy.prototype.validateDocument = function (document, context) {
3458
+ // Partner não tem validações específicas no momento
3459
+ return { isValid: true };
3460
+ };
3461
+ PartnerStrategy.prototype.getFilteredInvoiceConditions = function (invoiceCondition, allConditions) {
3462
+ // Partner não usa invoice conditions
3463
+ return allConditions;
3464
+ };
3465
+ PartnerStrategy.prototype.supportsInvoiceCondition = function () {
3466
+ return false;
3467
+ };
3468
+ return PartnerStrategy;
3469
+ }());
3470
+
3471
+ var SeniorConnectStrategy = /** @class */ (function () {
3472
+ function SeniorConnectStrategy() {
3473
+ }
3474
+ SeniorConnectStrategy.prototype.getGridColumns = function (translate, isClienteExterno) {
3475
+ return [
3476
+ {
3477
+ field: "key",
3478
+ header: translate.instant("yms.int.wms_purchaseOrder"),
3479
+ type: ColumnType.TEXT,
3480
+ },
3481
+ {
3482
+ field: "partnerName",
3483
+ header: translate.instant("yms.int.wms_register_document_partner_name"),
3484
+ type: ColumnType.TEXT,
3485
+ },
3486
+ {
3487
+ field: "partnerDocument",
3488
+ header: translate.instant("yms.int.wms_register_document_partner_document"),
3489
+ type: ColumnType.FORMATTED,
3490
+ pipe: "cpfCnpjFormat",
3491
+ },
3492
+ {
3493
+ field: "logistcUnitName",
3494
+ header: translate.instant("yms.int.wms_register_document_logistc_unit_name"),
3495
+ type: ColumnType.TEXT,
3496
+ },
3497
+ {
3498
+ field: "logistcUnitDocument",
3499
+ header: translate.instant("yms.int.wms_register_document_logistc_unit_document"),
3500
+ type: ColumnType.TEXT,
3501
+ },
3502
+ ];
3503
+ };
3504
+ SeniorConnectStrategy.prototype.updateDocumentKey = function (document) {
3505
+ return document.key || document.invoiceKey;
3506
+ };
3507
+ SeniorConnectStrategy.prototype.validateDocument = function (document, context) {
3508
+ var yard = context.yard, schedule = context.schedule;
3509
+ if (!yard.codigo) {
3510
+ return {
3511
+ isValid: false,
3512
+ errorMessageKey: "yms.int.yard_code_not_found_warning_description",
3513
+ };
3514
+ }
3515
+ if (document.logistcUnitDocument !== yard.codigo) {
3516
+ return {
3517
+ isValid: false,
3518
+ errorMessageKey: "yms.int.document_yard_mismatch_agenda_warning_description",
3519
+ };
3520
+ }
3521
+ if (!schedule.externalTenant) {
3522
+ return {
3523
+ isValid: false,
3524
+ errorMessageKey: "yms.int.partner_not_informed_agenda_warning_description",
3525
+ };
3526
+ }
3527
+ if (document.partnerDocument !== schedule.externalTenant.cnpj) {
3528
+ return {
3529
+ isValid: false,
3530
+ errorMessageKey: "yms.int.partner_differs_from_agenda_warning_description",
3531
+ };
3532
+ }
3533
+ return { isValid: true };
3534
+ };
3535
+ SeniorConnectStrategy.prototype.getFilteredInvoiceConditions = function (invoiceCondition, allConditions) {
3536
+ // Senior Connect não usa invoice conditions da mesma forma
3537
+ return allConditions;
3538
+ };
3539
+ SeniorConnectStrategy.prototype.supportsInvoiceCondition = function () {
3540
+ return false;
3541
+ };
3542
+ return SeniorConnectStrategy;
3543
+ }());
3544
+
3545
+ var SiltStrategy = /** @class */ (function () {
3546
+ function SiltStrategy() {
3547
+ }
3548
+ SiltStrategy.prototype.getGridColumns = function (translate, isClienteExterno) {
3549
+ var columns = [
3550
+ {
3551
+ field: "invoiceKey",
3552
+ header: translate.instant("yms.int.wms_register_document_invoice_key"),
3553
+ type: ColumnType.TEXT,
3554
+ },
3555
+ {
3556
+ field: "invoiceNumber",
3557
+ header: translate.instant("yms.int.wms_register_document_invoice_number"),
3558
+ type: ColumnType.TEXT,
3559
+ },
3560
+ {
3561
+ field: "invoiceSerialNumber",
3562
+ header: translate.instant("yms.int.wms_register_document_invoice_serial_number"),
3563
+ type: ColumnType.TEXT,
3564
+ },
3565
+ {
3566
+ field: "partnerName",
3567
+ header: translate.instant("yms.int.wms_register_document_partner_name"),
3568
+ type: ColumnType.TEXT,
3569
+ },
3570
+ {
3571
+ field: "partnerDocument",
3572
+ header: translate.instant("yms.int.wms_register_document_partner_document"),
3573
+ type: ColumnType.FORMATTED,
3574
+ pipe: "cpfCnpjFormat",
3575
+ },
3576
+ {
3577
+ field: "logistcUnitName",
3578
+ header: translate.instant("yms.int.wms_register_document_logistc_unit_name"),
3579
+ type: ColumnType.TEXT,
3580
+ },
3581
+ {
3582
+ field: "logistcUnitDocument",
3583
+ header: translate.instant("yms.int.wms_register_document_logistc_unit_document"),
3584
+ type: ColumnType.TEXT,
3585
+ },
3586
+ {
3587
+ field: "ownerName",
3588
+ header: translate.instant("yms.int.wms_register_document_owner_name"),
3589
+ type: ColumnType.TEXT,
3590
+ },
3591
+ {
3592
+ field: "ownerDocument",
3593
+ header: translate.instant("yms.int.wms_register_document_owner_document"),
3594
+ type: ColumnType.TEXT,
3595
+ },
3596
+ ];
3597
+ if (!isClienteExterno) {
3598
+ columns.push({
3599
+ field: "invoiceCondition",
3600
+ header: translate.instant("yms.int.wms_grid_document_invoice_condition"),
3601
+ type: ColumnType.DROPDOWN,
3602
+ editable: true,
3603
+ });
3604
+ }
3605
+ return columns;
3606
+ };
3607
+ SiltStrategy.prototype.updateDocumentKey = function (document) {
3608
+ return document.key || document.invoiceKey;
3609
+ };
3610
+ SiltStrategy.prototype.validateDocument = function (document, context) {
3611
+ // SILT não tem validações específicas no momento
3612
+ return { isValid: true };
3613
+ };
3614
+ SiltStrategy.prototype.getFilteredInvoiceConditions = function (invoiceCondition, allConditions) {
3615
+ if (invoiceCondition === InvoiceCondition.AUTHORIZED) {
3616
+ return allConditions.filter(function (cond) { return cond.value === InvoiceCondition.AUTHORIZED; });
3617
+ }
3618
+ return allConditions.filter(function (cond) { return cond.value !== InvoiceCondition.AUTHORIZED; });
3619
+ };
3620
+ SiltStrategy.prototype.supportsInvoiceCondition = function () {
3621
+ return true;
3622
+ };
3623
+ return SiltStrategy;
3624
+ }());
3625
+
3626
+ var WisStrategy = /** @class */ (function () {
3627
+ function WisStrategy() {
3628
+ }
3629
+ WisStrategy.prototype.getGridColumns = function (translate, isClienteExterno) {
3630
+ var columns = [
3631
+ {
3632
+ field: "invoiceNumber",
3633
+ header: translate.instant("yms.int.wms_register_document_invoice_number"),
3634
+ type: ColumnType.TEXT,
3635
+ },
3636
+ {
3637
+ field: "invoiceSerialNumber",
3638
+ header: translate.instant("yms.int.wms_register_document_invoice_serial_number"),
3639
+ type: ColumnType.TEXT,
3640
+ },
3641
+ {
3642
+ field: "partnerName",
3643
+ header: translate.instant("yms.int.wms_register_document_partner_name"),
3644
+ type: ColumnType.TEXT,
3645
+ },
3646
+ {
3647
+ field: "partnerDocument",
3648
+ header: translate.instant("yms.int.wms_register_document_partner_document"),
3649
+ type: ColumnType.FORMATTED,
3650
+ pipe: "cpfCnpjFormat",
3651
+ },
3652
+ {
3653
+ field: "logistcUnitName",
3654
+ header: translate.instant("yms.int.wms_register_document_logistc_unit_name"),
3655
+ type: ColumnType.TEXT,
3656
+ },
3657
+ {
3658
+ field: "logistcUnitDocument",
3659
+ header: translate.instant("yms.int.wms_register_document_logistc_unit_document"),
3660
+ type: ColumnType.TEXT,
3661
+ },
3662
+ ];
3663
+ if (!isClienteExterno) {
3664
+ columns.push({
3665
+ field: "invoiceCondition",
3666
+ header: translate.instant("yms.int.wms_grid_document_invoice_condition"),
3667
+ type: ColumnType.DROPDOWN,
3668
+ editable: true,
3669
+ });
3670
+ }
3671
+ return columns;
3672
+ };
3673
+ WisStrategy.prototype.updateDocumentKey = function (document) {
3674
+ if (!document.key) {
3675
+ document.key = document.invoiceKey;
3676
+ }
3677
+ return document.invoiceNumber + ":" + document.invoiceSerialNumber + ":" + document.partnerDocument;
3678
+ };
3679
+ WisStrategy.prototype.validateDocument = function (document, context) {
3680
+ // WIS não tem validações específicas no momento
3681
+ return { isValid: true };
3682
+ };
3683
+ WisStrategy.prototype.getFilteredInvoiceConditions = function (invoiceCondition, allConditions) {
3684
+ if (invoiceCondition === InvoiceCondition.AUTHORIZED) {
3685
+ return allConditions.filter(function (cond) { return cond.value === InvoiceCondition.AUTHORIZED; });
3686
+ }
3687
+ return allConditions.filter(function (cond) { return cond.value !== InvoiceCondition.AUTHORIZED; });
3688
+ };
3689
+ WisStrategy.prototype.supportsInvoiceCondition = function () {
3690
+ return true;
3691
+ };
3692
+ return WisStrategy;
3693
+ }());
3694
+
3695
+ var SeniorERPStrategy = /** @class */ (function () {
3696
+ function SeniorERPStrategy() {
3697
+ }
3698
+ SeniorERPStrategy.prototype.getGridColumns = function (translate, isClienteExterno) {
3699
+ var columns = [
3700
+ {
3701
+ field: "invoiceKey",
3702
+ header: translate.instant("yms.int.wms_register_document_invoice_key"),
3703
+ type: ColumnType.TEXT,
3704
+ },
3705
+ {
3706
+ field: "invoiceNumber",
3707
+ header: translate.instant("yms.int.wms_register_document_invoice_number"),
3708
+ type: ColumnType.TEXT,
3709
+ },
3710
+ {
3711
+ field: "invoiceSerialNumber",
3712
+ header: translate.instant("yms.int.wms_register_document_invoice_serial_number"),
3713
+ type: ColumnType.TEXT,
3714
+ },
3715
+ {
3716
+ field: "partnerName",
3717
+ header: translate.instant("yms.int.wms_register_document_partner_name"),
3718
+ type: ColumnType.TEXT,
3719
+ },
3720
+ {
3721
+ field: "partnerDocument",
3722
+ header: translate.instant("yms.int.wms_register_document_partner_document_cod_erp"),
3723
+ type: ColumnType.TEXT,
3724
+ },
3725
+ {
3726
+ field: "logistcUnitName",
3727
+ header: translate.instant("yms.int.wms_register_document_logistc_unit_name"),
3728
+ type: ColumnType.TEXT,
3729
+ },
3730
+ {
3731
+ field: "logistcUnitDocument",
3732
+ header: translate.instant("yms.int.wms_register_document_logistc_unit_document_cod_erp"),
3733
+ type: ColumnType.TEXT,
3734
+ },
3735
+ ];
3736
+ return columns;
3737
+ };
3738
+ SeniorERPStrategy.prototype.updateDocumentKey = function (document) {
3739
+ return document.key || document.invoiceKey;
3740
+ };
3741
+ SeniorERPStrategy.prototype.validateDocument = function (document, context) {
3742
+ return { isValid: true };
3743
+ };
3744
+ SeniorERPStrategy.prototype.getFilteredInvoiceConditions = function (invoiceCondition, allConditions) {
3745
+ return allConditions;
3746
+ };
3747
+ SeniorERPStrategy.prototype.supportsInvoiceCondition = function () {
3748
+ return false;
3749
+ };
3750
+ return SeniorERPStrategy;
3751
+ }());
3752
+
3753
+ var WmsIntegrationStrategyFactory = /** @class */ (function () {
3754
+ function WmsIntegrationStrategyFactory() {
3755
+ this.strategies = new Map([
3756
+ [WmsSystem.SENIOR_CONNECT, new SeniorConnectStrategy()],
3757
+ [WmsSystem.WIS, new WisStrategy()],
3758
+ [WmsSystem.SENIOR, new SiltStrategy()],
3759
+ [WmsSystem.SENIOR_ERP, new SeniorERPStrategy()],
3760
+ [WmsSystem.PARTNER, new PartnerStrategy()],
3761
+ ]);
3762
+ }
3763
+ WmsIntegrationStrategyFactory.prototype.getStrategy = function (wmsSystem) {
3764
+ return this.strategies.get(wmsSystem) || null;
3765
+ };
3766
+ WmsIntegrationStrategyFactory.prototype.hasStrategy = function (wmsSystem) {
3767
+ return this.strategies.has(wmsSystem);
3768
+ };
3769
+ WmsIntegrationStrategyFactory = __decorate([
3770
+ core.Injectable(),
3771
+ __metadata("design:paramtypes", [])
3772
+ ], WmsIntegrationStrategyFactory);
3773
+ return WmsIntegrationStrategyFactory;
3774
+ }());
3775
+
3776
+ var DocumentGridFacade = /** @class */ (function () {
3777
+ function DocumentGridFacade(translate, documentService, integrationService, agendaService, utils, wmsService, strategyFactory) {
3378
3778
  this.translate = translate;
3379
3779
  this.documentService = documentService;
3380
- this.confirmationService = confirmationService;
3381
3780
  this.integrationService = integrationService;
3382
3781
  this.agendaService = agendaService;
3383
3782
  this.utils = utils;
3384
3783
  this.wmsService = wmsService;
3385
- this.viewDocument = new core.EventEmitter();
3386
- this.gridData = [];
3387
- this.enableButtonIsClienteExterno = true;
3388
- this.invoiceConditions = getInvoiceConditions(this.translate);
3389
- this.summary = "yms.int.wms_saved_document_message_title";
3784
+ this.strategyFactory = strategyFactory;
3390
3785
  this.ngUnsubscribe = new rxjs.Subject();
3391
- this.selection = [];
3786
+ this.summary = "yms.int.wms_saved_document_message_title";
3787
+ this.currentStrategy = null;
3788
+ // State subjects
3789
+ this.stateSubject = new rxjs.BehaviorSubject({
3790
+ gridData: [],
3791
+ selection: [],
3792
+ gridColumns: [],
3793
+ documentTotalRecords: 0,
3794
+ loading: false,
3795
+ disabled: true,
3796
+ showInvoiceSearchModal: false,
3797
+ showAddInvoiceModal: false,
3798
+ edit: false,
3799
+ processType: null,
3800
+ wmsSystem: null,
3801
+ isClienteExterno: false,
3802
+ enableButtonIsClienteExterno: true,
3803
+ });
3804
+ this.state$ = this.stateSubject.asObservable();
3805
+ this.invoiceConditions = getInvoiceConditions(this.translate);
3392
3806
  }
3393
- DocumentGridComponent.prototype.getFilteredInvoiceConditions = function (invoiceConditions) {
3394
- if (invoiceConditions === InvoiceCondition.AUTHORIZED) {
3395
- return this.invoiceConditions.filter(function (cond) { return cond.value === InvoiceCondition.AUTHORIZED; });
3396
- }
3397
- else {
3398
- return this.invoiceConditions.filter(function (cond) { return cond.value !== InvoiceCondition.AUTHORIZED; });
3399
- }
3400
- };
3401
- DocumentGridComponent.prototype.ngOnInit = function () {
3402
- var _this = this;
3807
+ Object.defineProperty(DocumentGridFacade.prototype, "state", {
3808
+ // Getters para acesso direto ao estado atual
3809
+ get: function () {
3810
+ return this.stateSubject.getValue();
3811
+ },
3812
+ enumerable: true,
3813
+ configurable: true
3814
+ });
3815
+ // Inicialização
3816
+ DocumentGridFacade.prototype.init = function (agenda, wmsSystem) {
3817
+ this.agenda = agenda;
3818
+ this.updateState({ wmsSystem: wmsSystem });
3403
3819
  this.verifyClienteExterno();
3404
3820
  this.getProcessTypeByScheduling();
3405
3821
  this.listDocuments(false);
3406
- this.wmsService.getSystemIntegration()
3407
- .subscribe(function (_a) {
3822
+ this.loadSystemIntegration();
3823
+ };
3824
+ DocumentGridFacade.prototype.loadSystemIntegration = function () {
3825
+ var _this = this;
3826
+ this.wmsService.getSystemIntegration().subscribe(function (_a) {
3408
3827
  var system = _a.system;
3409
- _this.wmsSystem = system;
3828
+ _this.updateState({ wmsSystem: system });
3829
+ _this.updateStrategy(system);
3410
3830
  if (_this.isWmsSeniorConnect()) {
3411
3831
  _this.getYard();
3412
3832
  _this.getSchedule();
3413
3833
  }
3414
3834
  });
3415
3835
  };
3416
- DocumentGridComponent.prototype.getYard = function () {
3836
+ DocumentGridFacade.prototype.updateStrategy = function (wmsSystem) {
3837
+ this.currentStrategy = this.strategyFactory.getStrategy(wmsSystem);
3838
+ this.updateGridColumns();
3839
+ };
3840
+ DocumentGridFacade.prototype.getYard = function () {
3417
3841
  var _this = this;
3418
- this.documentService.getYard(this.agenda.planta.id)
3419
- .pipe(operators.catchError(function (err) {
3420
- return rxjs.throwError(err);
3421
- }))
3842
+ this.documentService
3843
+ .getYard(this.agenda.planta.id)
3844
+ .pipe(operators.catchError(function (err) { return rxjs.throwError(err); }))
3422
3845
  .subscribe(function (content) {
3423
3846
  _this.yard = content;
3424
3847
  });
3425
3848
  };
3426
- DocumentGridComponent.prototype.getSchedule = function () {
3849
+ DocumentGridFacade.prototype.getSchedule = function () {
3427
3850
  var _this = this;
3428
3851
  if (this.agenda.externalTenant && this.agenda.externalTenant.cnpj) {
3429
3852
  this.schedule = this.agenda;
3430
3853
  return;
3431
3854
  }
3432
- this.agendaService.get(this.agenda.id)
3433
- .pipe(operators.catchError(function (err) {
3434
- return rxjs.throwError(err);
3435
- }))
3855
+ this.agendaService
3856
+ .get(this.agenda.id)
3857
+ .pipe(operators.catchError(function (err) { return rxjs.throwError(err); }))
3436
3858
  .subscribe(function (content) {
3437
3859
  _this.schedule = content;
3438
3860
  });
3439
3861
  };
3440
- DocumentGridComponent.prototype.verifyClienteExterno = function () {
3862
+ DocumentGridFacade.prototype.verifyClienteExterno = function () {
3441
3863
  var _this = this;
3442
- this.agendaService.isClienteExterno()
3864
+ this.agendaService
3865
+ .isClienteExterno()
3443
3866
  .subscribe(function (result) {
3444
- _this.isClienteExterno = result.isClienteExterno;
3445
- _this.gridColumns = _this.getGridColumns();
3867
+ _this.updateState({ isClienteExterno: result.isClienteExterno });
3868
+ _this.updateGridColumns();
3446
3869
  _this.cantEditStatus();
3447
3870
  });
3448
3871
  };
3449
- DocumentGridComponent.prototype.getProcessTypeByScheduling = function () {
3872
+ DocumentGridFacade.prototype.getProcessTypeByScheduling = function () {
3450
3873
  var _this = this;
3451
- this.integrationService.getProcessTypeByScheduling(this.agenda.tipoAgendamento.id)
3452
- .subscribe(function (result) { return _this.processType = result.processType; });
3874
+ this.integrationService
3875
+ .getProcessTypeByScheduling(this.agenda.tipoAgendamento.id)
3876
+ .subscribe(function (result) {
3877
+ _this.updateState({ processType: result.processType });
3878
+ });
3879
+ };
3880
+ DocumentGridFacade.prototype.cantEditStatus = function () {
3881
+ var cantEditStatus = [
3882
+ "CANCELADO",
3883
+ "EM_EXECUCAO",
3884
+ "CONCLUIDO",
3885
+ "AGUARDANDO_POR_VALIDACAO",
3886
+ ].includes(this.agenda.status.toString());
3887
+ if (cantEditStatus) {
3888
+ this.updateState({ enableButtonIsClienteExterno: false });
3889
+ }
3890
+ };
3891
+ // Ações
3892
+ DocumentGridFacade.prototype.openInvoiceKeyModal = function () {
3893
+ this.updateState({
3894
+ selection: [],
3895
+ showInvoiceSearchModal: true,
3896
+ });
3897
+ };
3898
+ DocumentGridFacade.prototype.openDocumentRegisterModal = function () {
3899
+ this.updateState({
3900
+ selection: [],
3901
+ edit: true,
3902
+ showAddInvoiceModal: true,
3903
+ });
3904
+ };
3905
+ DocumentGridFacade.prototype.closeInvoiceSearchModal = function () {
3906
+ this.updateState({ showInvoiceSearchModal: false });
3907
+ };
3908
+ DocumentGridFacade.prototype.closeAddInvoiceModal = function () {
3909
+ this.updateState({ showAddInvoiceModal: false });
3910
+ };
3911
+ DocumentGridFacade.prototype.viewDocument = function () {
3912
+ this.updateState({
3913
+ showAddInvoiceModal: true,
3914
+ edit: false,
3915
+ });
3916
+ return this.state.selection[0];
3917
+ };
3918
+ DocumentGridFacade.prototype.setSelection = function (selection) {
3919
+ this.updateState({ selection: selection });
3453
3920
  };
3454
- DocumentGridComponent.prototype.onChangeDocument = function (document) {
3921
+ DocumentGridFacade.prototype.addToSelection = function (document) {
3922
+ this.updateState({ selection: [document] });
3923
+ };
3924
+ DocumentGridFacade.prototype.setDisabled = function (disabled) {
3925
+ this.updateState({ disabled: disabled });
3926
+ };
3927
+ DocumentGridFacade.prototype.setShowInvoiceSearchModal = function (visible) {
3928
+ this.updateState({ showInvoiceSearchModal: visible });
3929
+ };
3930
+ DocumentGridFacade.prototype.setShowAddInvoiceModal = function (visible) {
3931
+ this.updateState({ showAddInvoiceModal: visible });
3932
+ };
3933
+ DocumentGridFacade.prototype.onChangeDocument = function (document) {
3455
3934
  if (!this.hasFilledValues(document)) {
3456
3935
  this.utils.message("error", "yms.int.wms_save_error_register_document_message_title", "yms.int.wms_save_error_register_document_message_description");
3457
3936
  return;
3458
3937
  }
3459
3938
  this.assignKeys(document);
3460
- var duplicateDocument = this.gridData.find(function (gridData) { return gridData.key === document.key; });
3939
+ var duplicateDocument = this.state.gridData.find(function (gridData) { return gridData.key === document.key; });
3461
3940
  if (duplicateDocument) {
3462
3941
  this.utils.message("error", "yms.int.wms_error_register_document_message_title", "yms.int.wms_error_register_document_message_description");
3463
3942
  return;
3464
3943
  }
3465
- this.gridData.push(document);
3466
- this.disabled = false;
3944
+ var newGridData = __spread(this.state.gridData, [document]);
3945
+ this.updateState({
3946
+ gridData: newGridData,
3947
+ disabled: false,
3948
+ showAddInvoiceModal: false,
3949
+ showInvoiceSearchModal: false,
3950
+ });
3467
3951
  this.utils.message("success", this.summary, "yms.int.wms_success_message_description");
3468
- this.visibleDocumentRegister = false;
3469
- this.visibleInvoiceKey = false;
3470
3952
  };
3471
- DocumentGridComponent.prototype.assignKeys = function (document) {
3953
+ DocumentGridFacade.prototype.assignKeys = function (document) {
3472
3954
  if (document.id === undefined) {
3473
3955
  if (this.agenda.id !== undefined) {
3474
3956
  document.schedulingId = this.agenda.id;
3475
3957
  }
3476
3958
  if (document.key === undefined || document.key === null) {
3477
- document.key = document.invoiceKey;
3478
- if (this.isWmsWIS()) {
3479
- document.key = document.invoiceNumber + ":" + document.invoiceSerialNumber + ":" + document.partnerDocument;
3480
- }
3959
+ document.key =
3960
+ this.currentStrategy.updateDocumentKey(document) ||
3961
+ document.invoiceKey;
3481
3962
  }
3482
3963
  }
3483
3964
  };
3484
- DocumentGridComponent.prototype.hasFilledValues = function (document) {
3965
+ DocumentGridFacade.prototype.hasFilledValues = function (document) {
3485
3966
  var formValues = Object.values(document);
3486
- return formValues.some(function (value) { return value !== null && value !== ''; });
3967
+ return formValues.some(function (value) { return value !== null && value !== ""; });
3487
3968
  };
3488
- DocumentGridComponent.prototype.cantEditStatus = function () {
3489
- var cantEditStatus = [
3490
- 'CANCELADO',
3491
- 'EM_EXECUCAO',
3492
- 'CONCLUIDO',
3493
- 'AGUARDANDO_POR_VALIDACAO'
3494
- ].includes(this.agenda.status.toString());
3495
- if (cantEditStatus) {
3496
- this.enableButtonIsClienteExterno = false;
3497
- }
3498
- };
3499
- DocumentGridComponent.prototype.getActions = function () {
3969
+ DocumentGridFacade.prototype.save = function () {
3500
3970
  var _this = this;
3501
- return [
3502
- {
3503
- disabled: this.checkWmsSystemInvalid(),
3504
- label: this.translate.instant("yms.int.wms_search"),
3505
- command: function () {
3506
- _this.selection = [];
3507
- _this.visibleInvoiceKey = true;
3508
- },
3509
- icon: "fa fa-search"
3510
- },
3511
- {
3512
- disabled: this.checkWmsSystemInvalid(),
3513
- label: this.translate.instant("yms.int.wms_add_document_register"),
3514
- command: function () {
3515
- _this.selection = [];
3516
- _this.edit = true;
3517
- _this.visibleDocumentRegister = true;
3518
- },
3519
- icon: "fas fa-pen-square"
3520
- }
3521
- ];
3522
- };
3523
- DocumentGridComponent.prototype.checkWmsSystemInvalid = function () {
3524
- if (this.wmsSystem && this.wmsSystem === WmsSystem.NONE) {
3525
- return true;
3526
- }
3527
- return false;
3528
- };
3529
- DocumentGridComponent.prototype.getProp = function (obj, path) {
3530
- return path.split(".").reduce(function (result, prop) { return (result[prop] === undefined ? "" : result[prop]); }, obj);
3531
- };
3532
- DocumentGridComponent.prototype.view = function () {
3533
- this.viewDocument.emit(this.selection[0]);
3534
- this.visibleDocumentRegister = true;
3535
- this.edit = false;
3536
- };
3537
- DocumentGridComponent.prototype.save = function () {
3538
- var _this = this;
3539
- if (this.gridData.length > 0) {
3540
- this.gridData.forEach(function (data) {
3971
+ var gridData = this.state.gridData;
3972
+ if (gridData.length > 0) {
3973
+ gridData.forEach(function (data) {
3541
3974
  if (!data.id) {
3542
3975
  if (!data.schedulingId) {
3543
3976
  data.schedulingId = _this.agenda.id;
@@ -3546,194 +3979,240 @@
3546
3979
  _this.documentService.insert(data).subscribe(function () {
3547
3980
  _this.sucessMessage();
3548
3981
  });
3549
- _this.disabled = true;
3982
+ _this.updateState({ disabled: true });
3550
3983
  }
3551
3984
  else {
3552
3985
  _this.documentService.update(data.id, data).subscribe(function () {
3553
3986
  _this.sucessMessage();
3554
- _this.disabled = true;
3987
+ _this.updateState({ disabled: true });
3555
3988
  });
3556
3989
  }
3557
3990
  });
3558
3991
  this.listDocuments(false);
3559
3992
  }
3560
3993
  };
3561
- DocumentGridComponent.prototype.updateKeyByWms = function (data) {
3562
- if (!data.key) {
3563
- data.key = data.invoiceKey;
3564
- }
3565
- if (this.wmsSystem === WmsSystem.WIS) {
3566
- data.key = data.invoiceNumber + ":" + data.invoiceSerialNumber + ":" + data.partnerDocument;
3567
- }
3568
- return data.key;
3994
+ DocumentGridFacade.prototype.updateKeyByWms = function (data) {
3995
+ return this.currentStrategy.updateDocumentKey(data) || data.invoiceKey;
3569
3996
  };
3570
- DocumentGridComponent.prototype.onDelete = function () {
3997
+ DocumentGridFacade.prototype.deleteSelectedDocuments = function () {
3571
3998
  var _this = this;
3572
- this.confirmationService.confirm({
3573
- message: this.translate.instant("delete_confirmation_message"),
3574
- header: this.translate.instant("delete_confirmation_title"),
3575
- accept: function () {
3576
- _this.removeDocumentIfIdUndfined();
3577
- if (_this.selection.length < 1) {
3578
- return null;
3579
- }
3580
- return rxjs.forkJoin(_this.selection.map(function (document) { return _this.documentService.delete(document.id); }))
3581
- .pipe(operators.takeUntil(_this.ngUnsubscribe))
3582
- .subscribe(function () {
3583
- _this.utils.message("success", "deleted_message_title", "deleted_message_content");
3584
- _this.listDocuments(true);
3585
- });
3586
- }
3999
+ this.removeDocumentIfIdUndefined();
4000
+ var selection = this.state.selection;
4001
+ if (selection.length < 1) {
4002
+ return;
4003
+ }
4004
+ rxjs.forkJoin(selection.map(function (document) { return _this.documentService.delete(document.id); }))
4005
+ .pipe(operators.takeUntil(this.ngUnsubscribe))
4006
+ .subscribe(function () {
4007
+ _this.utils.message("success", "yms.patio.warn_deleted_message_title", "yms.patio.deleted_message_detail");
4008
+ _this.listDocuments(true);
3587
4009
  });
3588
4010
  };
3589
- DocumentGridComponent.prototype.removeDocumentIfIdUndfined = function () {
3590
- var _this = this;
3591
- this.selection.forEach(function (value, index) {
4011
+ DocumentGridFacade.prototype.removeDocumentIfIdUndefined = function () {
4012
+ var _a = this.state, selection = _a.selection, gridData = _a.gridData;
4013
+ var newSelection = __spread(selection);
4014
+ var newGridData = __spread(gridData);
4015
+ selection.forEach(function (value, index) {
3592
4016
  if (!value.id) {
3593
- var indexGridData = _this.gridData.findIndex(function (document) { return document.key === value.key; });
3594
- _this.gridData.splice(indexGridData, 1);
3595
- _this.selection.splice(index, 1);
4017
+ var indexGridData = newGridData.findIndex(function (document) { return document.key === value.key; });
4018
+ newGridData.splice(indexGridData, 1);
4019
+ newSelection.splice(index, 1);
3596
4020
  }
3597
4021
  });
4022
+ this.updateState({ gridData: newGridData, selection: newSelection });
3598
4023
  };
3599
- DocumentGridComponent.prototype.notSavedDocuments = function () {
3600
- return this.gridData.some(function (document) { return !document.id; });
4024
+ DocumentGridFacade.prototype.notSavedDocuments = function () {
4025
+ return this.state.gridData.some(function (document) { return !document.id; });
3601
4026
  };
3602
- DocumentGridComponent.prototype.listDocuments = function (isDelete) {
4027
+ DocumentGridFacade.prototype.listDocuments = function (isDelete) {
3603
4028
  var _this = this;
3604
- this.documentService.list({
4029
+ this.documentService
4030
+ .list({
3605
4031
  filterQuery: "schedulingId eq '" + this.agenda.id + "'",
3606
- size: 100
4032
+ size: 100,
3607
4033
  })
3608
4034
  .subscribe(function (contents) {
3609
- var _a;
3610
- _this.gridData = isDelete ? _this.gridData.filter(function (item) { return !item.id; }) : [];
4035
+ var newGridData = isDelete
4036
+ ? _this.state.gridData.filter(function (item) { return !item.id; })
4037
+ : [];
3611
4038
  if (contents.totalElements > 0) {
3612
- (_a = _this.gridData).push.apply(_a, __spread(contents.contents));
3613
- _this.documentTotalRecords = contents.totalElements;
3614
- }
3615
- else {
3616
- _this.documentTotalRecords = _this.gridData.length;
3617
- }
3618
- var hasElementWithoutId = _this.gridData.some(function (item) { return !item.id; });
3619
- _this.disabled = !hasElementWithoutId;
3620
- _this.loading = false;
3621
- _this.selection = [];
4039
+ newGridData = __spread(newGridData, contents.contents);
4040
+ }
4041
+ var documentTotalRecords = contents.totalElements > 0
4042
+ ? contents.totalElements
4043
+ : newGridData.length;
4044
+ var hasElementWithoutId = newGridData.some(function (item) { return !item.id; });
4045
+ _this.updateState({
4046
+ gridData: newGridData,
4047
+ disabled: !hasElementWithoutId,
4048
+ loading: false,
4049
+ selection: [],
4050
+ documentTotalRecords: documentTotalRecords,
4051
+ });
3622
4052
  });
3623
4053
  };
3624
- DocumentGridComponent.prototype.getGridColumns = function () {
3625
- var result;
3626
- switch (this.wmsSystem) {
3627
- case WmsSystem.SENIOR_CONNECT:
3628
- result = this.wmsSeniorConnectIntegration();
3629
- break;
3630
- case WmsSystem.WIS:
3631
- result = this.wmsWisIntegration();
3632
- break;
3633
- case WmsSystem.SENIOR:
3634
- result = this.wmsSiltIntegration();
3635
- break;
3636
- case WmsSystem.PARTNER:
3637
- result = this.wmsPartnerIntegration();
3638
- break;
3639
- default:
3640
- result = [];
3641
- }
3642
- return result;
3643
- };
3644
- DocumentGridComponent.prototype.wmsPartnerIntegration = function () {
3645
- var columns = __spread([
3646
- { field: "invoiceKey", header: this.translate.instant("yms.int.wms_register_document_invoice_key") },
3647
- { field: "invoiceNumber", header: this.translate.instant("yms.int.wms_register_document_invoice_number") },
3648
- { field: "invoiceSerialNumber", header: this.translate.instant("yms.int.wms_register_document_invoice_serial_number") }
3649
- ], this.getColumnPartner());
3650
- return columns;
4054
+ // Menu Actions
4055
+ DocumentGridFacade.prototype.getActions = function () {
4056
+ var _this = this;
4057
+ return [
4058
+ {
4059
+ disabled: this.checkWmsSystemInvalid(),
4060
+ label: this.translate.instant("yms.int.wms_search"),
4061
+ command: function () { return _this.openInvoiceKeyModal(); },
4062
+ icon: "fa fa-search",
4063
+ },
4064
+ {
4065
+ disabled: this.checkWmsSystemInvalid(),
4066
+ label: this.translate.instant("yms.int.wms_add_document_register"),
4067
+ command: function () { return _this.openDocumentRegisterModal(); },
4068
+ icon: "fas fa-pen-square",
4069
+ },
4070
+ ];
3651
4071
  };
3652
- DocumentGridComponent.prototype.wmsSeniorConnectIntegration = function () {
3653
- var columns = __spread([
3654
- { field: "key", header: this.translate.instant("yms.int.wms_purchaseOrder") }
3655
- ], this.getColumnPartner(), this.getColumnlogistcUnit());
3656
- return columns;
4072
+ DocumentGridFacade.prototype.checkWmsSystemInvalid = function () {
4073
+ var wmsSystem = this.state.wmsSystem;
4074
+ return wmsSystem && wmsSystem === WmsSystem.NONE;
3657
4075
  };
3658
- DocumentGridComponent.prototype.wmsWisIntegration = function () {
3659
- var columns = __spread(this.getColumnInvoiceAndlogistcUnit());
3660
- this.addInvoiceSituationIfNotClienteExterno(columns);
3661
- return columns;
4076
+ // Grid columns
4077
+ DocumentGridFacade.prototype.updateGridColumns = function () {
4078
+ var gridColumns = this.getGridColumns();
4079
+ this.updateState({ gridColumns: gridColumns });
3662
4080
  };
3663
- DocumentGridComponent.prototype.wmsSiltIntegration = function () {
3664
- var columns = __spread([
3665
- { field: "invoiceKey", header: this.translate.instant("yms.int.wms_register_document_invoice_key") }
3666
- ], this.getColumnInvoiceAndlogistcUnit(), [
3667
- { field: "ownerName", header: this.translate.instant("yms.int.wms_register_document_owner_name") },
3668
- { field: "ownerDocument", header: this.translate.instant("yms.int.wms_register_document_owner_document") },
3669
- ]);
3670
- this.addInvoiceSituationIfNotClienteExterno(columns);
3671
- return columns;
4081
+ DocumentGridFacade.prototype.getGridColumns = function () {
4082
+ if (!this.currentStrategy) {
4083
+ return [];
4084
+ }
4085
+ return this.currentStrategy.getGridColumns(this.translate, this.state.isClienteExterno);
3672
4086
  };
3673
- DocumentGridComponent.prototype.getColumninvoiceCondition = function () {
3674
- return { field: "invoiceCondition", header: this.translate.instant("yms.int.wms_grid_document_invoice_condition") };
4087
+ // WMS Type checks
4088
+ DocumentGridFacade.prototype.isWmsSeniorConnect = function () {
4089
+ return this.state.wmsSystem === WmsSystem.SENIOR_CONNECT;
3675
4090
  };
3676
- DocumentGridComponent.prototype.getColumnInvoiceAndlogistcUnit = function () {
3677
- return __spread([
3678
- { field: "invoiceNumber", header: this.translate.instant("yms.int.wms_register_document_invoice_number") },
3679
- { field: "invoiceSerialNumber", header: this.translate.instant("yms.int.wms_register_document_invoice_serial_number") }
3680
- ], this.getColumnPartner(), this.getColumnlogistcUnit());
4091
+ DocumentGridFacade.prototype.isWmsWIS = function () {
4092
+ return this.state.wmsSystem === WmsSystem.WIS;
3681
4093
  };
3682
- DocumentGridComponent.prototype.getColumnPartner = function () {
3683
- return [
3684
- { field: "partnerName", header: this.translate.instant("yms.int.wms_register_document_partner_name") },
3685
- { field: "partnerDocument", header: this.translate.instant("yms.int.wms_register_document_partner_document") },
3686
- ];
4094
+ DocumentGridFacade.prototype.isWmsSilt = function () {
4095
+ return this.state.wmsSystem === WmsSystem.SENIOR;
3687
4096
  };
3688
- DocumentGridComponent.prototype.getColumnlogistcUnit = function () {
3689
- return [
3690
- { field: "logistcUnitName", header: this.translate.instant("yms.int.wms_register_document_logistc_unit_name") },
3691
- { field: "logistcUnitDocument", header: this.translate.instant("yms.int.wms_register_document_logistc_unit_document") },
3692
- ];
4097
+ DocumentGridFacade.prototype.isWmsPartner = function () {
4098
+ return this.state.wmsSystem === WmsSystem.PARTNER;
3693
4099
  };
3694
- DocumentGridComponent.prototype.addInvoiceSituationIfNotClienteExterno = function (columns) {
3695
- if (!this.isClienteExterno) {
3696
- columns.push(this.getColumninvoiceCondition());
4100
+ // Validation
4101
+ DocumentGridFacade.prototype.validateDocument = function (document) {
4102
+ if (!this.currentStrategy) {
4103
+ return true;
4104
+ }
4105
+ var result = this.currentStrategy.validateDocument(document, {
4106
+ yard: this.yard,
4107
+ schedule: this.schedule,
4108
+ agenda: this.agenda,
4109
+ });
4110
+ if (!result.isValid && result.errorMessageKey) {
4111
+ this.buildMessage(result.errorMessageKey);
3697
4112
  }
4113
+ return result.isValid;
3698
4114
  };
3699
- DocumentGridComponent.prototype.isWmsSeniorConnect = function () {
3700
- return this.wmsSystem === WmsSystem.SENIOR_CONNECT;
4115
+ // Invoice conditions
4116
+ DocumentGridFacade.prototype.getFilteredInvoiceConditions = function (invoiceCondition) {
4117
+ if (!this.currentStrategy) {
4118
+ return this.invoiceConditions;
4119
+ }
4120
+ return this.currentStrategy.getFilteredInvoiceConditions(invoiceCondition, this.invoiceConditions);
3701
4121
  };
3702
- DocumentGridComponent.prototype.isWmsWIS = function () {
3703
- return this.wmsSystem === WmsSystem.WIS;
4122
+ DocumentGridFacade.prototype.supportsInvoiceCondition = function () {
4123
+ return this.currentStrategy.supportsInvoiceCondition() || false;
3704
4124
  };
3705
- DocumentGridComponent.prototype.isWmsSilt = function () {
3706
- return this.wmsSystem === WmsSystem.SENIOR;
4125
+ // Helpers
4126
+ DocumentGridFacade.prototype.getProp = function (obj, path) {
4127
+ return path
4128
+ .split(".")
4129
+ .reduce(function (result, prop) {
4130
+ return result[prop] === undefined ? "" : result[prop];
4131
+ }, obj);
3707
4132
  };
3708
- DocumentGridComponent.prototype.isWmsPartner = function () {
3709
- return this.wmsSystem === WmsSystem.PARTNER;
4133
+ DocumentGridFacade.prototype.sucessMessage = function () {
4134
+ this.utils.message("success", this.summary, "saved_message_content");
3710
4135
  };
3711
- DocumentGridComponent.prototype.sucessMessage = function () {
3712
- return this.utils.message("success", this.summary, "saved_message_content");
4136
+ DocumentGridFacade.prototype.buildMessage = function (description) {
4137
+ this.utils.message("warn", "yms.int.documento_invalido_warning_header", description);
3713
4138
  };
3714
- DocumentGridComponent.prototype.validateDocument = function (document) {
3715
- if (this.isWmsSeniorConnect()) {
3716
- if (!this.yard.codigo) {
3717
- this.buildMessage("yms.int.yard_code_not_found_warning_description");
3718
- return false;
3719
- }
3720
- if (document.logistcUnitDocument !== this.yard.codigo) {
3721
- this.buildMessage("yms.int.document_yard_mismatch_agenda_warning_description");
3722
- return false;
3723
- }
3724
- if (!this.schedule.externalTenant) {
3725
- this.buildMessage("yms.int.partner_not_informed_agenda_warning_description");
3726
- return false;
3727
- }
3728
- if (document.partnerDocument !== this.schedule.externalTenant.cnpj) {
3729
- this.buildMessage("yms.int.partner_differs_from_agenda_warning_description");
3730
- return false;
3731
- }
3732
- }
3733
- return true;
4139
+ DocumentGridFacade.prototype.updateState = function (partialState) {
4140
+ this.stateSubject.next(__assign({}, this.state, partialState));
3734
4141
  };
3735
- DocumentGridComponent.prototype.buildMessage = function (description) {
3736
- this.utils.message("warn", "yms.int.documento_invalido_warning_header", description);
4142
+ DocumentGridFacade.prototype.destroy = function () {
4143
+ this.ngUnsubscribe.next();
4144
+ this.ngUnsubscribe.complete();
4145
+ };
4146
+ DocumentGridFacade = __decorate([
4147
+ core.Injectable(),
4148
+ __metadata("design:paramtypes", [core$1.TranslateService,
4149
+ DocumentService,
4150
+ IntegrationService,
4151
+ AgendaService,
4152
+ UtilsMessageService,
4153
+ FormWmsService,
4154
+ WmsIntegrationStrategyFactory])
4155
+ ], DocumentGridFacade);
4156
+ return DocumentGridFacade;
4157
+ }());
4158
+
4159
+ var DocumentGridComponent = /** @class */ (function () {
4160
+ function DocumentGridComponent(facade, confirmationService, translate) {
4161
+ this.facade = facade;
4162
+ this.confirmationService = confirmationService;
4163
+ this.translate = translate;
4164
+ this.viewDocument = new core.EventEmitter();
4165
+ }
4166
+ DocumentGridComponent.prototype.ngOnInit = function () {
4167
+ this.state$ = this.facade.state$;
4168
+ this.facade.init(this.agenda, this.wmsSystem);
4169
+ };
4170
+ DocumentGridComponent.prototype.ngOnDestroy = function () {
4171
+ this.facade.destroy();
4172
+ };
4173
+ // UI Event handlers - delegam para o facade
4174
+ DocumentGridComponent.prototype.onView = function () {
4175
+ var document = this.facade.viewDocument();
4176
+ this.viewDocument.emit(document);
4177
+ };
4178
+ DocumentGridComponent.prototype.onSave = function () {
4179
+ this.facade.save();
4180
+ };
4181
+ DocumentGridComponent.prototype.onDelete = function () {
4182
+ var _this = this;
4183
+ this.confirmationService.confirm({
4184
+ message: this.translate.instant("delete_confirmation_message"),
4185
+ header: this.translate.instant("delete_confirmation_title"),
4186
+ accept: function () {
4187
+ _this.facade.deleteSelectedDocuments();
4188
+ },
4189
+ });
4190
+ };
4191
+ DocumentGridComponent.prototype.onRefresh = function () {
4192
+ this.facade.listDocuments(false);
4193
+ };
4194
+ DocumentGridComponent.prototype.onRowSelect = function (rowData) {
4195
+ this.facade.addToSelection(rowData);
4196
+ };
4197
+ DocumentGridComponent.prototype.onInvoiceConditionChange = function () {
4198
+ this.facade.setDisabled(false);
4199
+ };
4200
+ Object.defineProperty(DocumentGridComponent.prototype, "invoiceConditions", {
4201
+ // Getters para o template (delegam para o facade)
4202
+ get: function () {
4203
+ return this.facade.invoiceConditions;
4204
+ },
4205
+ enumerable: true,
4206
+ configurable: true
4207
+ });
4208
+ DocumentGridComponent.prototype.getActions = function () {
4209
+ return this.facade.getActions();
4210
+ };
4211
+ DocumentGridComponent.prototype.getFilteredInvoiceConditions = function (invoiceCondition) {
4212
+ return this.facade.getFilteredInvoiceConditions(invoiceCondition);
4213
+ };
4214
+ DocumentGridComponent.prototype.notSavedDocuments = function () {
4215
+ return this.facade.notSavedDocuments();
3737
4216
  };
3738
4217
  __decorate([
3739
4218
  core.Input(),
@@ -3746,11 +4225,11 @@
3746
4225
  __decorate([
3747
4226
  core.Output(),
3748
4227
  __metadata("design:type", Boolean)
3749
- ], DocumentGridComponent.prototype, "visibleInvoiceKey", void 0);
4228
+ ], DocumentGridComponent.prototype, "showInvoiceSearchModal", void 0);
3750
4229
  __decorate([
3751
4230
  core.Output(),
3752
4231
  __metadata("design:type", Boolean)
3753
- ], DocumentGridComponent.prototype, "visibleDocumentRegister", void 0);
4232
+ ], DocumentGridComponent.prototype, "showAddInvoiceModal", void 0);
3754
4233
  __decorate([
3755
4234
  core.Output(),
3756
4235
  __metadata("design:type", core.EventEmitter)
@@ -3781,17 +4260,13 @@
3781
4260
  ], DocumentGridComponent.prototype, "customGridBody", void 0);
3782
4261
  DocumentGridComponent = __decorate([
3783
4262
  core.Component({
3784
- selector: 'document-grid',
3785
- 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()\" \n (click)=\"selection = [rowData]\" (keypress)=\"selection = [rowData]\">\n <span>{{rowData[\"key\"]}}</span>\n </td>\n <td *ngIf=\"isWmsSilt() || isWmsPartner()\" \n (click)=\"selection = [rowData]\" (keypress)=\"selection = [rowData]\">\n <span>{{rowData[\"invoiceKey\"]}}</span>\n </td>\n <td *ngIf=\"isWmsWIS() || isWmsSilt() || isWmsPartner()\" \n (click)=\"selection = [rowData]\" (keypress)=\"selection = [rowData]\">\n <span>{{rowData[\"invoiceNumber\"]}}</span>\n </td>\n <td *ngIf=\"isWmsWIS() || isWmsSilt() || isWmsPartner()\" \n (click)=\"selection = [rowData]\" (keypress)=\"selection = [rowData]\">\n <span>{{rowData[\"invoiceSerialNumber\"]}}</span>\n </td>\n <td *ngIf=\"isWmsWIS() || isWmsSeniorConnect() || isWmsSilt() || isWmsPartner()\" \n (click)=\"selection = [rowData]\" (keypress)=\"selection = [rowData]\">\n <span>{{rowData[\"partnerName\"]}}</span>\n </td>\n <td *ngIf=\"isWmsWIS() || isWmsSeniorConnect() || isWmsSilt() || isWmsPartner()\" \n (click)=\"selection = [rowData]\" (keypress)=\"selection = [rowData]\">\n <span>{{rowData[\"partnerDocument\"] | cpfCnpjFormat}}</span>\n </td>\n <td *ngIf=\"isWmsWIS() || isWmsSilt() || isWmsSeniorConnect()\" \n (click)=\"selection = [rowData]\" (keypress)=\"selection = [rowData]\">\n <span>{{rowData[\"logistcUnitName\"]}}</span>\n </td>\n <td *ngIf=\"isWmsWIS() || isWmsSilt() || isWmsSeniorConnect()\" \n (click)=\"selection = [rowData]\" (keypress)=\"selection = [rowData]\">\n <span>{{rowData[\"logistcUnitDocument\"]}}</span>\n </td>\n <td *ngIf=\"isWmsSilt()\" (click)=\"selection = [rowData]\" (keypress)=\"selection = [rowData]\">\n <span>{{rowData[\"ownerName\"]}}</span>\n </td>\n <td *ngIf=\"isWmsSilt()\" (click)=\"selection = [rowData]\" (keypress)=\"selection = [rowData]\">\n <span>{{rowData[\"ownerDocument\"]}}</span>\n </td>\n <td *ngIf=\"!isClienteExterno && isWmsWIS()\" \n (click)=\"selection = [rowData]\" (keypress)=\"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 [agenda]=\"agenda\"\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>",
4263
+ selector: "document-grid",
4264
+ template: "<ng-container *ngIf=\"state$ | async as state\">\n <div\n *ngIf=\"state.processType === 'RECEBIMENTO_WMS'; else processNotConfigured\"\n >\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]=\"!state.enableButtonIsClienteExterno\"\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 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 [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=\"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\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 >\n <!-- Texto simples -->\n <span *ngIf=\"!col.type || col.type === 'text'\">\n {{ rowData[col.field] }}\n </span>\n\n <!-- Texto com pipe de formata\u00E7\u00E3o -->\n <span\n *ngIf=\"\n col.type === 'formatted' && col.pipe === 'cpfCnpjFormat'\n \"\n >\n {{ rowData[col.field] | cpfCnpjFormat }}\n </span>\n\n <!-- Dropdown edit\u00E1vel -->\n <p-dropdown\n *ngIf=\"\n col.type === 'dropdown' &&\n col.field === 'invoiceCondition'\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 [edit]=\"state.edit\"\n [viewDocument]=\"state.selection\"\n [(visible)]=\"state.showAddInvoiceModal\"\n [agenda]=\"agenda\"\n [isClienteExterno]=\"state.isClienteExterno\"\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",
3786
4265
  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}"]
3787
4266
  }),
3788
- __metadata("design:paramtypes", [core$1.TranslateService,
3789
- DocumentService,
4267
+ __metadata("design:paramtypes", [DocumentGridFacade,
3790
4268
  api.ConfirmationService,
3791
- IntegrationService,
3792
- AgendaService,
3793
- UtilsMessageService,
3794
- FormWmsService])
4269
+ core$1.TranslateService])
3795
4270
  ], DocumentGridComponent);
3796
4271
  return DocumentGridComponent;
3797
4272
  }());
@@ -3839,10 +4314,10 @@
3839
4314
  }());
3840
4315
 
3841
4316
  var RegisterDocumentComponent = /** @class */ (function () {
3842
- function RegisterDocumentComponent(fb, translate, documentGridComponent) {
4317
+ function RegisterDocumentComponent(fb, translate, facade) {
3843
4318
  this.fb = fb;
3844
4319
  this.translate = translate;
3845
- this.documentGridComponent = documentGridComponent;
4320
+ this.facade = facade;
3846
4321
  this.document = new core.EventEmitter();
3847
4322
  this.visible = new core.EventEmitter();
3848
4323
  this.visibleChange = new core.EventEmitter();
@@ -3873,19 +4348,23 @@
3873
4348
  this.visibleChange.emit(false);
3874
4349
  };
3875
4350
  RegisterDocumentComponent.prototype.setValuesFormGroup = function (document) {
3876
- this.formGroup.get('key').setValue(document.key);
3877
- this.formGroup.get('invoiceKey').setValue(document.invoiceKey);
3878
- this.formGroup.get('invoiceNumber').setValue(document.invoiceNumber);
3879
- this.formGroup.get('invoiceSerialNumber').setValue(document.invoiceSerialNumber);
3880
- this.formGroup.get('logistcUnitDocument').setValue(document.logistcUnitDocument);
3881
- this.formGroup.get('logistcUnitName').setValue(document.logistcUnitName);
3882
- this.formGroup.get('notes').setValue(document.notes);
3883
- this.formGroup.get('code').setValue(document.code);
3884
- this.formGroup.get('partnerName').setValue(document.partnerName);
3885
- this.formGroup.get('partnerDocument').setValue(document.partnerDocument);
3886
- this.formGroup.get('ownerDocument').setValue(document.ownerDocument);
3887
- this.formGroup.get('ownerName').setValue(document.ownerName);
3888
- this.formGroup.get('invoiceCondition').setValue(document.invoiceCondition);
4351
+ this.formGroup.get("key").setValue(document.key);
4352
+ this.formGroup.get("invoiceKey").setValue(document.invoiceKey);
4353
+ this.formGroup.get("invoiceNumber").setValue(document.invoiceNumber);
4354
+ this.formGroup
4355
+ .get("invoiceSerialNumber")
4356
+ .setValue(document.invoiceSerialNumber);
4357
+ this.formGroup
4358
+ .get("logistcUnitDocument")
4359
+ .setValue(document.logistcUnitDocument);
4360
+ this.formGroup.get("logistcUnitName").setValue(document.logistcUnitName);
4361
+ this.formGroup.get("notes").setValue(document.notes);
4362
+ this.formGroup.get("code").setValue(document.code);
4363
+ this.formGroup.get("partnerName").setValue(document.partnerName);
4364
+ this.formGroup.get("partnerDocument").setValue(document.partnerDocument);
4365
+ this.formGroup.get("ownerDocument").setValue(document.ownerDocument);
4366
+ this.formGroup.get("ownerName").setValue(document.ownerName);
4367
+ this.formGroup.get("invoiceCondition").setValue(document.invoiceCondition);
3889
4368
  };
3890
4369
  RegisterDocumentComponent.prototype.getFormGroup = function () {
3891
4370
  this.formGroup = this.fb.group({
@@ -3907,7 +4386,7 @@
3907
4386
  };
3908
4387
  RegisterDocumentComponent.prototype.save = function () {
3909
4388
  var document = Document.fromDto(this.formGroup.getRawValue());
3910
- if (!this.documentGridComponent.validateDocument(document)) {
4389
+ if (!this.facade.validateDocument(document)) {
3911
4390
  return;
3912
4391
  }
3913
4392
  this.document.emit(document);
@@ -3929,7 +4408,7 @@
3929
4408
  var _this = this;
3930
4409
  this.formGroup.valueChanges.subscribe(function () {
3931
4410
  var formValues = Object.values(_this.formGroup.value);
3932
- _this.isSaveFormValid = formValues.some(function (value) { return value !== null && value !== ''; });
4411
+ _this.isSaveFormValid = formValues.some(function (value) { return value !== null && value !== ""; });
3933
4412
  });
3934
4413
  };
3935
4414
  __decorate([
@@ -3967,11 +4446,11 @@
3967
4446
  RegisterDocumentComponent = __decorate([
3968
4447
  core.Component({
3969
4448
  selector: "register-document",
3970
- template: "<s-sidebar\n [visible]=\"visible\"\n header=\"{{isWmsPartner() ? ('yms.int.wms_register_document_add_document' | translate ) : \n ('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\" *ngIf=\"!isWmsPartner()\">\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\" *ngIf=\"!isWmsPartner()\">\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() && !isWmsPartner()\">\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() && !isWmsPartner()\">\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\" *ngIf=\"isWmsSenior() || isWmsWis()\">\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 && ( isWmsWis() || isWmsPartner() ) \">\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>"
4449
+ template: "<s-sidebar\n [visible]=\"visible\"\n header=\"{{ 'yms.int.wms_register_document_add_document' | translate }}\"\n (visibleChange)=\"close()\"\n (onclose)=\"close()\"\n>\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\">{{\n \"yms.int.wms_register_document_invoice_key\" | translate\n }}</label>\n <input\n id=\"invoiceKey\"\n pInputText\n type=\"text\"\n formControlName=\"invoiceKey\"\n />\n </div>\n <div class=\"ui-g-6\" *ngIf=\"!isWmsSeniorConnect()\">\n <label for=\"invoiceNumber\">{{\n \"yms.int.wms_register_document_invoice_number\" | translate\n }}</label>\n <input\n id=\"invoiceNumber\"\n pInputText\n type=\"text\"\n formControlName=\"invoiceNumber\"\n />\n </div>\n <div class=\"ui-g-6\" *ngIf=\"!isWmsSeniorConnect()\">\n <label for=\"invoiceSerialNumber\">\n {{\n \"yms.int.wms_register_document_invoice_serial_number\" | translate\n }}\n </label>\n <input\n id=\"invoiceSerialNumber\"\n pInputText\n type=\"text\"\n formControlName=\"invoiceSerialNumber\"\n />\n </div>\n <div class=\"ui-g-8\" *ngIf=\"!isWmsPartner()\">\n <label for=\"logistcUnitName\">{{\n \"yms.int.wms_register_document_logistc_unit_name\" | translate\n }}</label>\n <input\n id=\"logistcUnitName\"\n pInputText\n type=\"text\"\n formControlName=\"logistcUnitName\"\n />\n </div>\n <div class=\"ui-g-4\" *ngIf=\"!isWmsPartner()\">\n <label for=\"logistcUnitDocument\">\n {{\n \"yms.int.wms_register_document_logistc_unit_document\" | translate\n }}\n </label>\n <input\n id=\"logistcUnitDocument\"\n pInputText\n type=\"text\"\n formControlName=\"logistcUnitDocument\"\n />\n </div>\n <div\n class=\"ui-g-8\"\n *ngIf=\"!isWmsSeniorConnect() && !isWmsWis() && !isWmsPartner()\"\n >\n <label for=\"documentOwnerName\">{{\n \"yms.int.wms_register_document_owner_name\" | translate\n }}</label>\n <input\n id=\"documentOwnerName\"\n pInputText\n type=\"text\"\n formControlName=\"ownerName\"\n />\n </div>\n <div\n class=\"ui-g-4\"\n *ngIf=\"!isWmsSeniorConnect() && !isWmsWis() && !isWmsPartner()\"\n >\n <label for=\"ownerDocument\">{{\n \"yms.int.wms_register_document_owner_document\" | translate\n }}</label>\n <input\n id=\"ownerDocument\"\n pInputText\n type=\"text\"\n formControlName=\"ownerDocument\"\n />\n </div>\n <div class=\"ui-g-8\">\n <label for=\"partnerName\">{{\n \"yms.int.wms_register_document_partner_name\" | translate\n }}</label>\n <input\n id=\"partnerName\"\n pInputText\n type=\"text\"\n formControlName=\"partnerName\"\n />\n </div>\n <div class=\"ui-g-4\">\n <label for=\"partnerDocument\">{{\n \"yms.int.wms_register_document_partner_document\" | translate\n }}</label>\n <input\n id=\"partnerDocument\"\n pInputText\n type=\"text\"\n formControlName=\"partnerDocument\"\n />\n </div>\n <div class=\"ui-g-12\">\n <label for=\"notes\" id=\"notes\">{{\n \"yms.int.wms_register_document_notes\" | translate\n }}</label>\n <textarea\n id=\"notes\"\n rows=\"4\"\n pInputTextarea\n autoResize=\"autoResize\"\n formControlName=\"notes\"\n ></textarea>\n </div>\n <div class=\"ui-g-4\" *ngIf=\"isWmsSenior() || isWmsWis()\">\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 class=\"ui-g-4\"\n *ngIf=\"!isClienteExterno && (isWmsWis() || isWmsPartner())\"\n >\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\n label=\"{{ 'save' | translate }}\"\n (click)=\"save()\"\n [attr.data-hidden]=\"hideSaveButton\"\n [disabled]=\"!isSaveFormValid\"\n ></button>\n <button\n type=\"button\"\n class=\"ui-button-link\"\n pButton\n label=\"{{ 'cancel' | translate }}\"\n (click)=\"close()\"\n ></button>\n </div>\n</s-sidebar>\n"
3971
4450
  }),
3972
4451
  __metadata("design:paramtypes", [forms.FormBuilder,
3973
4452
  core$1.TranslateService,
3974
- DocumentGridComponent])
4453
+ DocumentGridFacade])
3975
4454
  ], RegisterDocumentComponent);
3976
4455
  return RegisterDocumentComponent;
3977
4456
  }());
@@ -4018,16 +4497,15 @@
4018
4497
  }(EntityService));
4019
4498
 
4020
4499
  var InsertKeyComponent = /** @class */ (function () {
4021
- function InsertKeyComponent(formBuilder, documentService, utils, confirmationService, translate, externalTenantService, documentGridComponent) {
4500
+ function InsertKeyComponent(formBuilder, documentService, utils, confirmationService, translate, externalTenantService, facade) {
4022
4501
  this.formBuilder = formBuilder;
4023
4502
  this.documentService = documentService;
4024
4503
  this.utils = utils;
4025
4504
  this.confirmationService = confirmationService;
4026
4505
  this.translate = translate;
4027
4506
  this.externalTenantService = externalTenantService;
4028
- this.documentGridComponent = documentGridComponent;
4507
+ this.facade = facade;
4029
4508
  this.visible = new core.EventEmitter();
4030
- this.document = new core.EventEmitter();
4031
4509
  this.visibleChange = new core.EventEmitter();
4032
4510
  this.isLoading = false;
4033
4511
  this.isPartnerloading = false;
@@ -4040,9 +4518,9 @@
4040
4518
  purchaseOrder: [undefined],
4041
4519
  invoiceNumber: [undefined],
4042
4520
  invoiceSerie: [undefined],
4043
- partnerDocument: [undefined]
4521
+ partnerDocument: [undefined],
4044
4522
  });
4045
- this.formGroup.get('key').valueChanges.subscribe(function (nf) {
4523
+ this.formGroup.get("key").valueChanges.subscribe(function (nf) {
4046
4524
  _this.validateKeyDetails(nf);
4047
4525
  });
4048
4526
  };
@@ -4062,19 +4540,22 @@
4062
4540
  var _this = this;
4063
4541
  this.isLoading = true;
4064
4542
  var key = {
4065
- purchaseOrder: this.formGroup.get('purchaseOrder').value,
4066
- documentKeys: [this.formGroup.get('key').value],
4067
- invoices: [{
4068
- number: this.formGroup.get('invoiceNumber').value,
4069
- serialNumber: this.formGroup.get('invoiceSerie').value,
4070
- partnerDocument: this.formGroup.get('partnerDocument').value
4071
- }],
4543
+ purchaseOrder: this.formGroup.get("purchaseOrder").value,
4544
+ documentKeys: [this.formGroup.get("key").value],
4545
+ invoices: [
4546
+ {
4547
+ number: this.formGroup.get("invoiceNumber").value,
4548
+ serialNumber: this.formGroup.get("invoiceSerie").value,
4549
+ partnerDocument: this.formGroup.get("partnerDocument").value,
4550
+ },
4551
+ ],
4072
4552
  logistcUnitName: undefined,
4073
4553
  size: 0,
4074
- offset: 0
4554
+ offset: 0,
4075
4555
  };
4076
4556
  var errorSearch = "yms.int.wms_error_search_document_message_header";
4077
- this.documentService.findDocuments(key)
4557
+ this.documentService
4558
+ .findDocuments(key)
4078
4559
  .pipe(operators.catchError(function (err) {
4079
4560
  if (_this.wmsSystem === WmsSystem.PARTNER) {
4080
4561
  _this.utils.message("error", errorSearch, "yms.int.wms_error_search_document_not_found_partner");
@@ -4083,7 +4564,8 @@
4083
4564
  _this.utils.message("error", errorSearch, "yms.int.wms_error_search_document_not_found_message_content");
4084
4565
  }
4085
4566
  else {
4086
- _this.utils.translateMessage("error", errorSearch, "yms.int.wms_error_unknown_search_document_message_content " + err.error.message);
4567
+ _this.utils.message("error", errorSearch, err.error.message ||
4568
+ "yms.int.wms_error_unknown_search_document_message_content");
4087
4569
  }
4088
4570
  _this.confirmInvoiceDialog();
4089
4571
  return rxjs.throwError(err);
@@ -4096,12 +4578,13 @@
4096
4578
  return;
4097
4579
  }
4098
4580
  var document = content.contents[0];
4099
- if (!_this.documentGridComponent.validateDocument(document)) {
4581
+ if (!_this.facade.validateDocument(document)) {
4100
4582
  return;
4101
4583
  }
4102
- document.invoiceKey = _this.formGroup.get('key').value;
4584
+ document.invoiceKey = _this.formGroup.get("key").value;
4103
4585
  document.invoiceCondition = InvoiceCondition.AUTHORIZED;
4104
- _this.document.emit(document);
4586
+ _this.facade.onChangeDocument(document);
4587
+ _this.facade.closeInvoiceSearchModal();
4105
4588
  _this.formGroup.reset();
4106
4589
  });
4107
4590
  };
@@ -4113,36 +4596,37 @@
4113
4596
  acceptLabel: this.translate.instant("yms.int.wms_accept_confirm_invoice_dialog"),
4114
4597
  rejectLabel: this.translate.instant("yms.int.wms_reject_confirm_invoice_dialog"),
4115
4598
  header: this.translate.instant("yms.int.wms_header_content_confirm_invoice_dialog"),
4116
- accept: function () { return _this.buildInvoice(); }
4599
+ accept: function () { return _this.buildInvoice(); },
4117
4600
  });
4118
4601
  }
4119
4602
  };
4120
4603
  InsertKeyComponent.prototype.buildInvoice = function () {
4121
4604
  var _this = this;
4122
4605
  this.isPartnerloading = true;
4123
- var partnerDocument = this.formGroup.get('partnerDocument').value;
4124
- this.externalTenantService.list({
4125
- filterQuery: "cnpj eq '" + partnerDocument + "'"
4606
+ var partnerDocument = this.formGroup.get("partnerDocument").value;
4607
+ this.externalTenantService
4608
+ .list({
4609
+ filterQuery: "cnpj eq '" + partnerDocument + "'",
4126
4610
  })
4127
4611
  .pipe(operators.takeUntil(this.ngUnsubscribe), operators.finalize(function () {
4128
4612
  _this.isPartnerloading = false;
4129
4613
  }))
4130
4614
  .subscribe(function (contents) {
4131
4615
  var documentInvoice = _this.createDocumentInvoice(contents);
4132
- _this.document.emit(documentInvoice);
4616
+ _this.facade.onChangeDocument(documentInvoice);
4133
4617
  _this.formGroup.reset();
4134
4618
  });
4135
4619
  };
4136
4620
  InsertKeyComponent.prototype.createDocumentInvoice = function (partners) {
4137
4621
  var documentInvoice = {
4138
- invoiceKey: this.formGroup.get('key').value,
4139
- invoiceNumber: this.formGroup.get('invoiceNumber').value,
4140
- invoiceSerialNumber: this.formGroup.get('invoiceSerie').value,
4141
- partnerDocument: this.formGroup.get('partnerDocument').value,
4622
+ invoiceKey: this.formGroup.get("key").value,
4623
+ invoiceNumber: this.formGroup.get("invoiceNumber").value,
4624
+ invoiceSerialNumber: this.formGroup.get("invoiceSerie").value,
4625
+ partnerDocument: this.formGroup.get("partnerDocument").value,
4142
4626
  partnerName: null,
4143
4627
  type: null,
4144
4628
  key: null,
4145
- schedulingId: null
4629
+ schedulingId: null,
4146
4630
  };
4147
4631
  if (partners.totalElements > 0) {
4148
4632
  var partner = partners.contents[0];
@@ -4178,9 +4662,9 @@
4178
4662
  this.setValuesOfKey(invoice, serie, cnpj);
4179
4663
  };
4180
4664
  InsertKeyComponent.prototype.setValuesOfKey = function (invoiceNumber, invoiceSerie, partnerDocument) {
4181
- this.formGroup.get('invoiceNumber').setValue(invoiceNumber);
4182
- this.formGroup.get('invoiceSerie').setValue(invoiceSerie);
4183
- this.formGroup.get('partnerDocument').setValue(partnerDocument);
4665
+ this.formGroup.get("invoiceNumber").setValue(invoiceNumber);
4666
+ this.formGroup.get("invoiceSerie").setValue(invoiceSerie);
4667
+ this.formGroup.get("partnerDocument").setValue(partnerDocument);
4184
4668
  };
4185
4669
  InsertKeyComponent.prototype.cancel = function () {
4186
4670
  this.visibleChange.emit(false);
@@ -4200,10 +4684,6 @@
4200
4684
  core.Input(),
4201
4685
  __metadata("design:type", core.EventEmitter)
4202
4686
  ], InsertKeyComponent.prototype, "visible", void 0);
4203
- __decorate([
4204
- core.Output(),
4205
- __metadata("design:type", core.EventEmitter)
4206
- ], InsertKeyComponent.prototype, "document", void 0);
4207
4687
  __decorate([
4208
4688
  core.Output(),
4209
4689
  __metadata("design:type", Object)
@@ -4211,7 +4691,7 @@
4211
4691
  InsertKeyComponent = __decorate([
4212
4692
  core.Component({
4213
4693
  selector: "insert-key",
4214
- template: "<form [formGroup]=\"formGroup\">\n <p-dialog [(visible)]=\"visible\" [modal]=\"true\" \n [draggable]=\"false\" (visibleChange)=\"cancel()\" (onShow)=\"onDialogShow()\">\n <p-header>{{isWmsPartner() ? ('yms.int.wms_search_document' | translate) : \n ('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",
4694
+ template: "<form [formGroup]=\"formGroup\">\n <p-dialog\n [(visible)]=\"visible\"\n [modal]=\"true\"\n [draggable]=\"false\"\n (visibleChange)=\"cancel()\"\n (onShow)=\"onDialogShow()\"\n >\n <p-header>{{ \"yms.int.wms_search_document\" | translate }}</p-header>\n <s-loading-state [loading]=\"isLoading || isPartnerloading\">\n <div\n class=\"flex py-2 justify-content-center spacing-bottom\"\n *ngIf=\"!isWmsSeniorConnect()\"\n >\n <label for=\"key\">{{\n \"yms.int.wms_insert_key_label\" | translate\n }}</label>\n <input\n id=\"key\"\n class=\"size-input\"\n pInputText\n type=\"text\"\n formControlName=\"key\"\n />\n <span class=\"error-message\">{{ keyErrorMessage | translate }}</span>\n </div>\n <div\n class=\"flex py-2 justify-content-center spacing-bottom\"\n *ngIf=\"isWmsSeniorConnect()\"\n >\n <label for=\"purchaseOrder\"\n >{{ \"yms.int.wms_purchaseOrder\" | translate }}\n </label>\n <input\n id=\"purchaseOrder\"\n class=\"size-input\"\n pInputText\n type=\"text\"\n formControlName=\"purchaseOrder\"\n />\n </div>\n <div\n class=\"flex py-2 justify-content-center spacing-bottom\"\n *ngIf=\"isWmsWis()\"\n >\n <label for=\"invoiceNumber\">{{\n \"yms.int.wms_invoice_number\" | translate\n }}</label>\n <input\n id=\"invoiceNumber\"\n class=\"size-input\"\n pInputText\n type=\"text\"\n formControlName=\"invoiceNumber\"\n />\n </div>\n <div\n class=\"flex py-2 justify-content-center spacing-bottom\"\n *ngIf=\"isWmsWis()\"\n >\n <label for=\"invoiceSerie\">{{\n \"yms.int.wms_invoice_serie\" | translate\n }}</label>\n <input\n id=\"invoiceSerie\"\n class=\"size-input\"\n pInputText\n type=\"text\"\n formControlName=\"invoiceSerie\"\n />\n </div>\n <div\n class=\"flex py-2 justify-content-center spacing-bottom\"\n *ngIf=\"isWmsWis()\"\n >\n <label for=\"partnerDocument\">{{\n \"yms.int.wms_partner_document\" | translate\n }}</label>\n <input\n id=\"partnerDocument\"\n class=\"size-input\"\n pInputText\n type=\"text\"\n formControlName=\"partnerDocument\"\n />\n </div>\n <div class=\"separator\"></div>\n <div class=\"spacing-top\">\n <s-button\n pButton\n label=\"{{ 'yms.int.wms_search' | translate }}\"\n (click)=\"add()\"\n (keyup)=\"$event.key === 'Enter' || $event.key === ' ' ? add() : null\"\n ></s-button>\n <s-button\n type=\"button\"\n class=\"ui-button-link\"\n pButton\n label=\"{{ 'cancel' | translate }}\"\n (click)=\"cancel()\"\n (keyup)=\"$event.key === 'Enter' || $event.key === ' ' ? add() : null\"\n >\n </s-button>\n </div>\n </s-loading-state>\n </p-dialog>\n</form>\n",
4215
4695
  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}"]
4216
4696
  }),
4217
4697
  __metadata("design:paramtypes", [forms.FormBuilder,
@@ -4220,7 +4700,7 @@
4220
4700
  api.ConfirmationService,
4221
4701
  core$1.TranslateService,
4222
4702
  ExternalTenantService,
4223
- DocumentGridComponent])
4703
+ DocumentGridFacade])
4224
4704
  ], InsertKeyComponent);
4225
4705
  return InsertKeyComponent;
4226
4706
  }());
@@ -4283,7 +4763,12 @@
4283
4763
  declarations: [DocumentGridComponent, CpfCnpjFormatPipe],
4284
4764
  entryComponents: [DocumentGridComponent],
4285
4765
  exports: [DocumentGridComponent, CpfCnpjFormatPipe],
4286
- providers: [ExternalTenantService],
4766
+ providers: [
4767
+ ExternalTenantService,
4768
+ DocumentGridFacade,
4769
+ WmsIntegrationStrategyFactory,
4770
+ api.ConfirmationService,
4771
+ ],
4287
4772
  imports: [
4288
4773
  common.CommonModule,
4289
4774
  core$1.TranslateModule,
@@ -4296,7 +4781,8 @@
4296
4781
  ymsComponents.ComponentsModule,
4297
4782
  angularComponents.EmptyStateModule,
4298
4783
  primeng.DropdownModule,
4299
- forms.FormsModule
4784
+ forms.FormsModule,
4785
+ primeng.ConfirmDialogModule,
4300
4786
  ],
4301
4787
  })
4302
4788
  ], DocumentGridModule);
@@ -14744,55 +15230,57 @@
14744
15230
  exports.highlightLanguages = highlightLanguages;
14745
15231
  exports.ɵa = Service;
14746
15232
  exports.ɵb = CustomStompConfig;
14747
- exports.ɵba = EntityService$2;
14748
- exports.ɵbb = EntityService$1;
14749
- exports.ɵbc = UtilsMessageService;
14750
- exports.ɵbd = CpfCnpjFormatPipe;
14751
- exports.ɵbe = ExternalTenantService;
14752
- exports.ɵbf = RegisterDocumentModule;
14753
- exports.ɵbg = RegisterDocumentComponent;
14754
- exports.ɵbh = InsertKeyModule;
14755
- exports.ɵbi = InsertKeyComponent;
14756
- exports.ɵbj = IntegrationService$1;
14757
- exports.ɵbk = RecebimentoFormComponent;
14758
- exports.ɵbl = DerivacaoService;
14759
- exports.ɵbm = NotaValidatorService;
14760
- exports.ɵbn = TransgeniaService;
14761
- exports.ɵbo = VerificaNotafiscal;
14762
- exports.ɵbp = BuildFormField;
14763
- exports.ɵbq = ExpedicaoFormComponent;
14764
- exports.ɵbr = ExpedicaoInfoComponent;
14765
- exports.ɵbs = RecebimentoInfoComponent;
14766
- exports.ɵbt = DevolucaoFormComponent;
14767
- exports.ɵbu = DevolucaoService;
14768
- exports.ɵbv = DevolucaoChegadaVeiculoOverride;
14769
- exports.ɵbw = RecebimentoOrdemCompraFormComponent;
14770
- exports.ɵbx = OrdemCompraService;
14771
- exports.ɵby = RecebimentoOrdemCompraService;
14772
- exports.ɵbz = RecebimentoOrdemCompraChegadaVeiculoOverride;
15233
+ exports.ɵba = AgendaService;
15234
+ exports.ɵbb = EntityService$2;
15235
+ exports.ɵbc = EntityService$1;
15236
+ exports.ɵbd = UtilsMessageService;
15237
+ exports.ɵbe = WmsIntegrationStrategyFactory;
15238
+ exports.ɵbf = CpfCnpjFormatPipe;
15239
+ exports.ɵbg = ExternalTenantService;
15240
+ exports.ɵbh = RegisterDocumentModule;
15241
+ exports.ɵbi = RegisterDocumentComponent;
15242
+ exports.ɵbj = InsertKeyModule;
15243
+ exports.ɵbk = InsertKeyComponent;
15244
+ exports.ɵbl = IntegrationService$1;
15245
+ exports.ɵbm = RecebimentoFormComponent;
15246
+ exports.ɵbn = DerivacaoService;
15247
+ exports.ɵbo = NotaValidatorService;
15248
+ exports.ɵbp = TransgeniaService;
15249
+ exports.ɵbq = VerificaNotafiscal;
15250
+ exports.ɵbr = BuildFormField;
15251
+ exports.ɵbs = ExpedicaoFormComponent;
15252
+ exports.ɵbt = ExpedicaoInfoComponent;
15253
+ exports.ɵbu = RecebimentoInfoComponent;
15254
+ exports.ɵbv = DevolucaoFormComponent;
15255
+ exports.ɵbw = DevolucaoService;
15256
+ exports.ɵbx = DevolucaoChegadaVeiculoOverride;
15257
+ exports.ɵby = RecebimentoOrdemCompraFormComponent;
15258
+ exports.ɵbz = OrdemCompraService;
14773
15259
  exports.ɵc = ViewImageComponent;
14774
- exports.ɵca = RecebimentoOrdemCompraInfoComponent;
14775
- exports.ɵcb = DevolucaoInfoComponent;
14776
- exports.ɵcc = ContratoFormComponent;
14777
- exports.ɵcd = OrdemCompraFormComponent;
14778
- exports.ɵce = ProcessoAvulsoFormComponent;
14779
- exports.ɵcf = ProcessoAvulsoService;
14780
- exports.ɵcg = ProcessoAvulsoChegadaVeiculoOverride;
14781
- exports.ɵch = ProcessoAvulsoInfoComponent;
14782
- exports.ɵci = LogIntegracaoDescritor;
14783
- exports.ɵcj = LogIntegracaoComponent;
14784
- exports.ɵck = LogIntegracaoService;
14785
- exports.ɵcl = DerivacaoModule;
14786
- exports.ɵcm = DevolucaoModule;
14787
- exports.ɵcn = OrdemCompraModule;
14788
- exports.ɵco = RecebimentoOrdemCompraModule;
14789
- exports.ɵcp = TransgeniaModule;
14790
- exports.ɵcq = ProcessoAvulsoModule;
14791
- exports.ɵcr = LogIntegracaoModule;
14792
- exports.ɵcs = NotaFormModule;
14793
- exports.ɵct = DirectivesModule;
14794
- exports.ɵcu = TrimDirective;
14795
- exports.ɵcv = NotaFormComponent;
15260
+ exports.ɵca = RecebimentoOrdemCompraService;
15261
+ exports.ɵcb = RecebimentoOrdemCompraChegadaVeiculoOverride;
15262
+ exports.ɵcc = RecebimentoOrdemCompraInfoComponent;
15263
+ exports.ɵcd = DevolucaoInfoComponent;
15264
+ exports.ɵce = ContratoFormComponent;
15265
+ exports.ɵcf = OrdemCompraFormComponent;
15266
+ exports.ɵcg = ProcessoAvulsoFormComponent;
15267
+ exports.ɵch = ProcessoAvulsoService;
15268
+ exports.ɵci = ProcessoAvulsoChegadaVeiculoOverride;
15269
+ exports.ɵcj = ProcessoAvulsoInfoComponent;
15270
+ exports.ɵck = LogIntegracaoDescritor;
15271
+ exports.ɵcl = LogIntegracaoComponent;
15272
+ exports.ɵcm = LogIntegracaoService;
15273
+ exports.ɵcn = DerivacaoModule;
15274
+ exports.ɵco = DevolucaoModule;
15275
+ exports.ɵcp = OrdemCompraModule;
15276
+ exports.ɵcq = RecebimentoOrdemCompraModule;
15277
+ exports.ɵcr = TransgeniaModule;
15278
+ exports.ɵcs = ProcessoAvulsoModule;
15279
+ exports.ɵct = LogIntegracaoModule;
15280
+ exports.ɵcu = NotaFormModule;
15281
+ exports.ɵcv = DirectivesModule;
15282
+ exports.ɵcw = TrimDirective;
15283
+ exports.ɵcx = NotaFormComponent;
14796
15284
  exports.ɵd = LogDescritor;
14797
15285
  exports.ɵe = LogsComponent;
14798
15286
  exports.ɵf = PortariasService;
@@ -14813,9 +15301,9 @@
14813
15301
  exports.ɵu = FormWmsService;
14814
15302
  exports.ɵv = DocumentGridModule;
14815
15303
  exports.ɵw = DocumentGridComponent;
14816
- exports.ɵx = DocumentService;
14817
- exports.ɵy = IntegrationService;
14818
- exports.ɵz = AgendaService;
15304
+ exports.ɵx = DocumentGridFacade;
15305
+ exports.ɵy = DocumentService;
15306
+ exports.ɵz = IntegrationService;
14819
15307
 
14820
15308
  Object.defineProperty(exports, '__esModule', { value: true });
14821
15309