@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
@@ -2300,7 +2300,10 @@ var EntityService = /** @class */ (function () {
2300
2300
  return catchError(function (err) {
2301
2301
  if (err) {
2302
2302
  var summary = err.status ? String(err.status) : "Error";
2303
- var detail = (err.error && err.error.message) || err.statusText || err.message || "Error";
2303
+ var detail = (err.error && err.error.message) ||
2304
+ err.statusText ||
2305
+ err.message ||
2306
+ "Error";
2304
2307
  _this.messageService.add({
2305
2308
  severity: "error",
2306
2309
  summary: summary,
@@ -2318,24 +2321,36 @@ var EntityService = /** @class */ (function () {
2318
2321
  return bodyParams;
2319
2322
  };
2320
2323
  EntityService.prototype.list = function (listParams) {
2321
- return this.http.get(this.entityUrl, { params: this.getListQueryParams(listParams) }).pipe(this.defaultCatch());
2324
+ return this.http
2325
+ .get(this.entityUrl, { params: this.getListQueryParams(listParams) })
2326
+ .pipe(this.defaultCatch());
2322
2327
  };
2323
2328
  EntityService.prototype.get = function (id, useCatch) {
2324
2329
  if (useCatch === void 0) { useCatch = true; }
2325
- return this.http.get(this.entityUrl + "/" + id).pipe(useCatch ? this.defaultCatch() : tap());
2330
+ return this.http
2331
+ .get(this.entityUrl + "/" + id)
2332
+ .pipe(useCatch ? this.defaultCatch() : tap());
2326
2333
  };
2327
2334
  EntityService.prototype.insert = function (entity) {
2328
- return this.http.post("" + this.entityUrl, entity).pipe(this.defaultCatch());
2335
+ return this.http
2336
+ .post("" + this.entityUrl, entity)
2337
+ .pipe(this.defaultCatch());
2329
2338
  };
2330
2339
  EntityService.prototype.update = function (id, entity, useCatch) {
2331
2340
  if (useCatch === void 0) { useCatch = true; }
2332
- return this.http.put(this.entityUrl + "/" + id, entity).pipe(useCatch ? this.defaultCatch() : tap());
2341
+ return this.http
2342
+ .put(this.entityUrl + "/" + id, entity)
2343
+ .pipe(useCatch ? this.defaultCatch() : tap());
2333
2344
  };
2334
2345
  EntityService.prototype.delete = function (id) {
2335
- return this.http.delete(this.entityUrl + "/" + id).pipe(this.defaultCatch());
2346
+ return this.http
2347
+ .delete(this.entityUrl + "/" + id)
2348
+ .pipe(this.defaultCatch());
2336
2349
  };
2337
2350
  EntityService.prototype.listCustomFilter = function (listParams, action) {
2338
- return this.http.post(this.actionsUrl + "/" + action, this.getBodyParams(listParams)).pipe(this.defaultCatch());
2351
+ return this.http
2352
+ .post(this.actionsUrl + "/" + action, this.getBodyParams(listParams))
2353
+ .pipe(this.defaultCatch());
2339
2354
  };
2340
2355
  return EntityService;
2341
2356
  }());
@@ -3002,6 +3017,7 @@ var WmsSystem;
3002
3017
  WmsSystem["WIS"] = "WIS";
3003
3018
  WmsSystem["ALCIS"] = "ALCIS";
3004
3019
  WmsSystem["SENIOR_CONNECT"] = "SENIOR_CONNECT";
3020
+ WmsSystem["SENIOR_ERP"] = "SENIOR_ERP";
3005
3021
  WmsSystem["PARTNER"] = "PARTNER";
3006
3022
  WmsSystem["GENERIC"] = "GENERIC";
3007
3023
  })(WmsSystem || (WmsSystem = {}));
@@ -3247,23 +3263,24 @@ var AgendaService = /** @class */ (function (_super) {
3247
3263
  var DocumentService = /** @class */ (function (_super) {
3248
3264
  __extends(DocumentService, _super);
3249
3265
  function DocumentService(http, messageService) {
3250
- var _this = _super.call(this, http, messageService, 'yms_int/wms/entities/document', '') || this;
3266
+ var _this = _super.call(this, http, messageService, "yms_int/wms/entities/document", "") || this;
3251
3267
  _this.http = http;
3252
3268
  _this.messageService = messageService;
3253
3269
  return _this;
3254
3270
  }
3255
3271
  DocumentService.prototype.findDocuments = function (input) {
3256
- return this.http.post('yms_int/wms/queries/findDocuments', input);
3272
+ return this.http.post("yms_int/wms/queries/findDocuments", input);
3257
3273
  };
3258
3274
  DocumentService.prototype.getSystemIntegration = function () {
3259
- return this.http.get('yms_int/wms/queries/getSystemIntegration');
3275
+ return this.http.get("yms_int/wms/queries/getSystemIntegration");
3260
3276
  };
3261
3277
  DocumentService.prototype.getYard = function (yardId) {
3262
- return this.http.get('yms/patio/entities/planta/' + yardId);
3278
+ return this.http.get("yms/patio/entities/planta/" + yardId);
3263
3279
  };
3264
3280
  DocumentService = __decorate([
3265
3281
  Injectable(),
3266
- __metadata("design:paramtypes", [HttpClient, MessageService])
3282
+ __metadata("design:paramtypes", [HttpClient,
3283
+ MessageService])
3267
3284
  ], DocumentService);
3268
3285
  return DocumentService;
3269
3286
  }(EntityService));
@@ -3304,181 +3321,597 @@ var InvoiceCondition;
3304
3321
 
3305
3322
  function getInvoiceConditions(translate) {
3306
3323
  return [
3307
- { label: translate.instant("yms.int.wms_grid_document_invoice_no_way"), value: null },
3308
- { label: translate.instant("yms.int.wms_grid_document_invoice_condition_authorized"), value: InvoiceCondition.AUTHORIZED },
3309
- { label: translate.instant("yms.int.wms_grid_document_invoice_condition_manual_authorized"), value: InvoiceCondition.MANUAL_AUTHORIZED },
3310
- { label: translate.instant("yms.int.wms_grid_document_invoice_condition_partial_authorized"), value: InvoiceCondition.PARTIAL_AUTHORIZED },
3311
- { label: translate.instant("yms.int.wms_grid_document_invoice_condition_devolution"), value: InvoiceCondition.DEVOLUTION },
3312
- { label: translate.instant("yms.int.wms_grid_document_invoice_condition_rejected"), value: InvoiceCondition.REJECTED },
3313
- { label: translate.instant("yms.int.wms_grid_document_invoice_condition_divergence"), value: InvoiceCondition.DIVERGENCE },
3324
+ {
3325
+ label: translate.instant("yms.int.wms_grid_document_invoice_no_way"),
3326
+ value: null,
3327
+ },
3328
+ {
3329
+ label: translate.instant("yms.int.wms_grid_document_invoice_condition_authorized"),
3330
+ value: InvoiceCondition.AUTHORIZED,
3331
+ },
3332
+ {
3333
+ label: translate.instant("yms.int.wms_grid_document_invoice_condition_manual_authorized"),
3334
+ value: InvoiceCondition.MANUAL_AUTHORIZED,
3335
+ },
3336
+ {
3337
+ label: translate.instant("yms.int.wms_grid_document_invoice_condition_partial_authorized"),
3338
+ value: InvoiceCondition.PARTIAL_AUTHORIZED,
3339
+ },
3340
+ {
3341
+ label: translate.instant("yms.int.wms_grid_document_invoice_condition_devolution"),
3342
+ value: InvoiceCondition.DEVOLUTION,
3343
+ },
3344
+ {
3345
+ label: translate.instant("yms.int.wms_grid_document_invoice_condition_rejected"),
3346
+ value: InvoiceCondition.REJECTED,
3347
+ },
3348
+ {
3349
+ label: translate.instant("yms.int.wms_grid_document_invoice_condition_divergence"),
3350
+ value: InvoiceCondition.DIVERGENCE,
3351
+ },
3314
3352
  ];
3315
3353
  }
3316
3354
 
3317
- var DocumentGridComponent = /** @class */ (function () {
3318
- function DocumentGridComponent(translate, documentService, confirmationService, integrationService, agendaService, utils, wmsService) {
3355
+ var ColumnType;
3356
+ (function (ColumnType) {
3357
+ ColumnType["TEXT"] = "text";
3358
+ ColumnType["DROPDOWN"] = "dropdown";
3359
+ ColumnType["FORMATTED"] = "formatted";
3360
+ })(ColumnType || (ColumnType = {}));
3361
+
3362
+ var PartnerStrategy = /** @class */ (function () {
3363
+ function PartnerStrategy() {
3364
+ }
3365
+ PartnerStrategy.prototype.getGridColumns = function (translate, isClienteExterno) {
3366
+ return [
3367
+ {
3368
+ field: "invoiceKey",
3369
+ header: translate.instant("yms.int.wms_register_document_invoice_key"),
3370
+ type: ColumnType.TEXT,
3371
+ },
3372
+ {
3373
+ field: "invoiceNumber",
3374
+ header: translate.instant("yms.int.wms_register_document_invoice_number"),
3375
+ type: ColumnType.TEXT,
3376
+ },
3377
+ {
3378
+ field: "invoiceSerialNumber",
3379
+ header: translate.instant("yms.int.wms_register_document_invoice_serial_number"),
3380
+ type: ColumnType.TEXT,
3381
+ },
3382
+ {
3383
+ field: "partnerName",
3384
+ header: translate.instant("yms.int.wms_register_document_partner_name"),
3385
+ type: ColumnType.TEXT,
3386
+ },
3387
+ {
3388
+ field: "partnerDocument",
3389
+ header: translate.instant("yms.int.wms_register_document_partner_document"),
3390
+ type: ColumnType.FORMATTED,
3391
+ pipe: "cpfCnpjFormat",
3392
+ },
3393
+ ];
3394
+ };
3395
+ PartnerStrategy.prototype.updateDocumentKey = function (document) {
3396
+ return document.key || document.invoiceKey;
3397
+ };
3398
+ PartnerStrategy.prototype.validateDocument = function (document, context) {
3399
+ // Partner não tem validações específicas no momento
3400
+ return { isValid: true };
3401
+ };
3402
+ PartnerStrategy.prototype.getFilteredInvoiceConditions = function (invoiceCondition, allConditions) {
3403
+ // Partner não usa invoice conditions
3404
+ return allConditions;
3405
+ };
3406
+ PartnerStrategy.prototype.supportsInvoiceCondition = function () {
3407
+ return false;
3408
+ };
3409
+ return PartnerStrategy;
3410
+ }());
3411
+
3412
+ var SeniorConnectStrategy = /** @class */ (function () {
3413
+ function SeniorConnectStrategy() {
3414
+ }
3415
+ SeniorConnectStrategy.prototype.getGridColumns = function (translate, isClienteExterno) {
3416
+ return [
3417
+ {
3418
+ field: "key",
3419
+ header: translate.instant("yms.int.wms_purchaseOrder"),
3420
+ type: ColumnType.TEXT,
3421
+ },
3422
+ {
3423
+ field: "partnerName",
3424
+ header: translate.instant("yms.int.wms_register_document_partner_name"),
3425
+ type: ColumnType.TEXT,
3426
+ },
3427
+ {
3428
+ field: "partnerDocument",
3429
+ header: translate.instant("yms.int.wms_register_document_partner_document"),
3430
+ type: ColumnType.FORMATTED,
3431
+ pipe: "cpfCnpjFormat",
3432
+ },
3433
+ {
3434
+ field: "logistcUnitName",
3435
+ header: translate.instant("yms.int.wms_register_document_logistc_unit_name"),
3436
+ type: ColumnType.TEXT,
3437
+ },
3438
+ {
3439
+ field: "logistcUnitDocument",
3440
+ header: translate.instant("yms.int.wms_register_document_logistc_unit_document"),
3441
+ type: ColumnType.TEXT,
3442
+ },
3443
+ ];
3444
+ };
3445
+ SeniorConnectStrategy.prototype.updateDocumentKey = function (document) {
3446
+ return document.key || document.invoiceKey;
3447
+ };
3448
+ SeniorConnectStrategy.prototype.validateDocument = function (document, context) {
3449
+ var yard = context.yard, schedule = context.schedule;
3450
+ if (!yard.codigo) {
3451
+ return {
3452
+ isValid: false,
3453
+ errorMessageKey: "yms.int.yard_code_not_found_warning_description",
3454
+ };
3455
+ }
3456
+ if (document.logistcUnitDocument !== yard.codigo) {
3457
+ return {
3458
+ isValid: false,
3459
+ errorMessageKey: "yms.int.document_yard_mismatch_agenda_warning_description",
3460
+ };
3461
+ }
3462
+ if (!schedule.externalTenant) {
3463
+ return {
3464
+ isValid: false,
3465
+ errorMessageKey: "yms.int.partner_not_informed_agenda_warning_description",
3466
+ };
3467
+ }
3468
+ if (document.partnerDocument !== schedule.externalTenant.cnpj) {
3469
+ return {
3470
+ isValid: false,
3471
+ errorMessageKey: "yms.int.partner_differs_from_agenda_warning_description",
3472
+ };
3473
+ }
3474
+ return { isValid: true };
3475
+ };
3476
+ SeniorConnectStrategy.prototype.getFilteredInvoiceConditions = function (invoiceCondition, allConditions) {
3477
+ // Senior Connect não usa invoice conditions da mesma forma
3478
+ return allConditions;
3479
+ };
3480
+ SeniorConnectStrategy.prototype.supportsInvoiceCondition = function () {
3481
+ return false;
3482
+ };
3483
+ return SeniorConnectStrategy;
3484
+ }());
3485
+
3486
+ var SiltStrategy = /** @class */ (function () {
3487
+ function SiltStrategy() {
3488
+ }
3489
+ SiltStrategy.prototype.getGridColumns = function (translate, isClienteExterno) {
3490
+ var columns = [
3491
+ {
3492
+ field: "invoiceKey",
3493
+ header: translate.instant("yms.int.wms_register_document_invoice_key"),
3494
+ type: ColumnType.TEXT,
3495
+ },
3496
+ {
3497
+ field: "invoiceNumber",
3498
+ header: translate.instant("yms.int.wms_register_document_invoice_number"),
3499
+ type: ColumnType.TEXT,
3500
+ },
3501
+ {
3502
+ field: "invoiceSerialNumber",
3503
+ header: translate.instant("yms.int.wms_register_document_invoice_serial_number"),
3504
+ type: ColumnType.TEXT,
3505
+ },
3506
+ {
3507
+ field: "partnerName",
3508
+ header: translate.instant("yms.int.wms_register_document_partner_name"),
3509
+ type: ColumnType.TEXT,
3510
+ },
3511
+ {
3512
+ field: "partnerDocument",
3513
+ header: translate.instant("yms.int.wms_register_document_partner_document"),
3514
+ type: ColumnType.FORMATTED,
3515
+ pipe: "cpfCnpjFormat",
3516
+ },
3517
+ {
3518
+ field: "logistcUnitName",
3519
+ header: translate.instant("yms.int.wms_register_document_logistc_unit_name"),
3520
+ type: ColumnType.TEXT,
3521
+ },
3522
+ {
3523
+ field: "logistcUnitDocument",
3524
+ header: translate.instant("yms.int.wms_register_document_logistc_unit_document"),
3525
+ type: ColumnType.TEXT,
3526
+ },
3527
+ {
3528
+ field: "ownerName",
3529
+ header: translate.instant("yms.int.wms_register_document_owner_name"),
3530
+ type: ColumnType.TEXT,
3531
+ },
3532
+ {
3533
+ field: "ownerDocument",
3534
+ header: translate.instant("yms.int.wms_register_document_owner_document"),
3535
+ type: ColumnType.TEXT,
3536
+ },
3537
+ ];
3538
+ if (!isClienteExterno) {
3539
+ columns.push({
3540
+ field: "invoiceCondition",
3541
+ header: translate.instant("yms.int.wms_grid_document_invoice_condition"),
3542
+ type: ColumnType.DROPDOWN,
3543
+ editable: true,
3544
+ });
3545
+ }
3546
+ return columns;
3547
+ };
3548
+ SiltStrategy.prototype.updateDocumentKey = function (document) {
3549
+ return document.key || document.invoiceKey;
3550
+ };
3551
+ SiltStrategy.prototype.validateDocument = function (document, context) {
3552
+ // SILT não tem validações específicas no momento
3553
+ return { isValid: true };
3554
+ };
3555
+ SiltStrategy.prototype.getFilteredInvoiceConditions = function (invoiceCondition, allConditions) {
3556
+ if (invoiceCondition === InvoiceCondition.AUTHORIZED) {
3557
+ return allConditions.filter(function (cond) { return cond.value === InvoiceCondition.AUTHORIZED; });
3558
+ }
3559
+ return allConditions.filter(function (cond) { return cond.value !== InvoiceCondition.AUTHORIZED; });
3560
+ };
3561
+ SiltStrategy.prototype.supportsInvoiceCondition = function () {
3562
+ return true;
3563
+ };
3564
+ return SiltStrategy;
3565
+ }());
3566
+
3567
+ var WisStrategy = /** @class */ (function () {
3568
+ function WisStrategy() {
3569
+ }
3570
+ WisStrategy.prototype.getGridColumns = function (translate, isClienteExterno) {
3571
+ var columns = [
3572
+ {
3573
+ field: "invoiceNumber",
3574
+ header: translate.instant("yms.int.wms_register_document_invoice_number"),
3575
+ type: ColumnType.TEXT,
3576
+ },
3577
+ {
3578
+ field: "invoiceSerialNumber",
3579
+ header: translate.instant("yms.int.wms_register_document_invoice_serial_number"),
3580
+ type: ColumnType.TEXT,
3581
+ },
3582
+ {
3583
+ field: "partnerName",
3584
+ header: translate.instant("yms.int.wms_register_document_partner_name"),
3585
+ type: ColumnType.TEXT,
3586
+ },
3587
+ {
3588
+ field: "partnerDocument",
3589
+ header: translate.instant("yms.int.wms_register_document_partner_document"),
3590
+ type: ColumnType.FORMATTED,
3591
+ pipe: "cpfCnpjFormat",
3592
+ },
3593
+ {
3594
+ field: "logistcUnitName",
3595
+ header: translate.instant("yms.int.wms_register_document_logistc_unit_name"),
3596
+ type: ColumnType.TEXT,
3597
+ },
3598
+ {
3599
+ field: "logistcUnitDocument",
3600
+ header: translate.instant("yms.int.wms_register_document_logistc_unit_document"),
3601
+ type: ColumnType.TEXT,
3602
+ },
3603
+ ];
3604
+ if (!isClienteExterno) {
3605
+ columns.push({
3606
+ field: "invoiceCondition",
3607
+ header: translate.instant("yms.int.wms_grid_document_invoice_condition"),
3608
+ type: ColumnType.DROPDOWN,
3609
+ editable: true,
3610
+ });
3611
+ }
3612
+ return columns;
3613
+ };
3614
+ WisStrategy.prototype.updateDocumentKey = function (document) {
3615
+ if (!document.key) {
3616
+ document.key = document.invoiceKey;
3617
+ }
3618
+ return document.invoiceNumber + ":" + document.invoiceSerialNumber + ":" + document.partnerDocument;
3619
+ };
3620
+ WisStrategy.prototype.validateDocument = function (document, context) {
3621
+ // WIS não tem validações específicas no momento
3622
+ return { isValid: true };
3623
+ };
3624
+ WisStrategy.prototype.getFilteredInvoiceConditions = function (invoiceCondition, allConditions) {
3625
+ if (invoiceCondition === InvoiceCondition.AUTHORIZED) {
3626
+ return allConditions.filter(function (cond) { return cond.value === InvoiceCondition.AUTHORIZED; });
3627
+ }
3628
+ return allConditions.filter(function (cond) { return cond.value !== InvoiceCondition.AUTHORIZED; });
3629
+ };
3630
+ WisStrategy.prototype.supportsInvoiceCondition = function () {
3631
+ return true;
3632
+ };
3633
+ return WisStrategy;
3634
+ }());
3635
+
3636
+ var SeniorERPStrategy = /** @class */ (function () {
3637
+ function SeniorERPStrategy() {
3638
+ }
3639
+ SeniorERPStrategy.prototype.getGridColumns = function (translate, isClienteExterno) {
3640
+ var columns = [
3641
+ {
3642
+ field: "invoiceKey",
3643
+ header: translate.instant("yms.int.wms_register_document_invoice_key"),
3644
+ type: ColumnType.TEXT,
3645
+ },
3646
+ {
3647
+ field: "invoiceNumber",
3648
+ header: translate.instant("yms.int.wms_register_document_invoice_number"),
3649
+ type: ColumnType.TEXT,
3650
+ },
3651
+ {
3652
+ field: "invoiceSerialNumber",
3653
+ header: translate.instant("yms.int.wms_register_document_invoice_serial_number"),
3654
+ type: ColumnType.TEXT,
3655
+ },
3656
+ {
3657
+ field: "partnerName",
3658
+ header: translate.instant("yms.int.wms_register_document_partner_name"),
3659
+ type: ColumnType.TEXT,
3660
+ },
3661
+ {
3662
+ field: "partnerDocument",
3663
+ header: translate.instant("yms.int.wms_register_document_partner_document_cod_erp"),
3664
+ type: ColumnType.TEXT,
3665
+ },
3666
+ {
3667
+ field: "logistcUnitName",
3668
+ header: translate.instant("yms.int.wms_register_document_logistc_unit_name"),
3669
+ type: ColumnType.TEXT,
3670
+ },
3671
+ {
3672
+ field: "logistcUnitDocument",
3673
+ header: translate.instant("yms.int.wms_register_document_logistc_unit_document_cod_erp"),
3674
+ type: ColumnType.TEXT,
3675
+ },
3676
+ ];
3677
+ return columns;
3678
+ };
3679
+ SeniorERPStrategy.prototype.updateDocumentKey = function (document) {
3680
+ return document.key || document.invoiceKey;
3681
+ };
3682
+ SeniorERPStrategy.prototype.validateDocument = function (document, context) {
3683
+ return { isValid: true };
3684
+ };
3685
+ SeniorERPStrategy.prototype.getFilteredInvoiceConditions = function (invoiceCondition, allConditions) {
3686
+ return allConditions;
3687
+ };
3688
+ SeniorERPStrategy.prototype.supportsInvoiceCondition = function () {
3689
+ return false;
3690
+ };
3691
+ return SeniorERPStrategy;
3692
+ }());
3693
+
3694
+ var WmsIntegrationStrategyFactory = /** @class */ (function () {
3695
+ function WmsIntegrationStrategyFactory() {
3696
+ this.strategies = new Map([
3697
+ [WmsSystem.SENIOR_CONNECT, new SeniorConnectStrategy()],
3698
+ [WmsSystem.WIS, new WisStrategy()],
3699
+ [WmsSystem.SENIOR, new SiltStrategy()],
3700
+ [WmsSystem.SENIOR_ERP, new SeniorERPStrategy()],
3701
+ [WmsSystem.PARTNER, new PartnerStrategy()],
3702
+ ]);
3703
+ }
3704
+ WmsIntegrationStrategyFactory.prototype.getStrategy = function (wmsSystem) {
3705
+ return this.strategies.get(wmsSystem) || null;
3706
+ };
3707
+ WmsIntegrationStrategyFactory.prototype.hasStrategy = function (wmsSystem) {
3708
+ return this.strategies.has(wmsSystem);
3709
+ };
3710
+ WmsIntegrationStrategyFactory = __decorate([
3711
+ Injectable(),
3712
+ __metadata("design:paramtypes", [])
3713
+ ], WmsIntegrationStrategyFactory);
3714
+ return WmsIntegrationStrategyFactory;
3715
+ }());
3716
+
3717
+ var DocumentGridFacade = /** @class */ (function () {
3718
+ function DocumentGridFacade(translate, documentService, integrationService, agendaService, utils, wmsService, strategyFactory) {
3319
3719
  this.translate = translate;
3320
3720
  this.documentService = documentService;
3321
- this.confirmationService = confirmationService;
3322
3721
  this.integrationService = integrationService;
3323
3722
  this.agendaService = agendaService;
3324
3723
  this.utils = utils;
3325
3724
  this.wmsService = wmsService;
3326
- this.viewDocument = new EventEmitter();
3327
- this.gridData = [];
3328
- this.enableButtonIsClienteExterno = true;
3329
- this.invoiceConditions = getInvoiceConditions(this.translate);
3330
- this.summary = "yms.int.wms_saved_document_message_title";
3725
+ this.strategyFactory = strategyFactory;
3331
3726
  this.ngUnsubscribe = new Subject();
3332
- this.selection = [];
3727
+ this.summary = "yms.int.wms_saved_document_message_title";
3728
+ this.currentStrategy = null;
3729
+ // State subjects
3730
+ this.stateSubject = new BehaviorSubject({
3731
+ gridData: [],
3732
+ selection: [],
3733
+ gridColumns: [],
3734
+ documentTotalRecords: 0,
3735
+ loading: false,
3736
+ disabled: true,
3737
+ showInvoiceSearchModal: false,
3738
+ showAddInvoiceModal: false,
3739
+ edit: false,
3740
+ processType: null,
3741
+ wmsSystem: null,
3742
+ isClienteExterno: false,
3743
+ enableButtonIsClienteExterno: true,
3744
+ });
3745
+ this.state$ = this.stateSubject.asObservable();
3746
+ this.invoiceConditions = getInvoiceConditions(this.translate);
3333
3747
  }
3334
- DocumentGridComponent.prototype.getFilteredInvoiceConditions = function (invoiceConditions) {
3335
- if (invoiceConditions === InvoiceCondition.AUTHORIZED) {
3336
- return this.invoiceConditions.filter(function (cond) { return cond.value === InvoiceCondition.AUTHORIZED; });
3337
- }
3338
- else {
3339
- return this.invoiceConditions.filter(function (cond) { return cond.value !== InvoiceCondition.AUTHORIZED; });
3340
- }
3341
- };
3342
- DocumentGridComponent.prototype.ngOnInit = function () {
3343
- var _this = this;
3748
+ Object.defineProperty(DocumentGridFacade.prototype, "state", {
3749
+ // Getters para acesso direto ao estado atual
3750
+ get: function () {
3751
+ return this.stateSubject.getValue();
3752
+ },
3753
+ enumerable: true,
3754
+ configurable: true
3755
+ });
3756
+ // Inicialização
3757
+ DocumentGridFacade.prototype.init = function (agenda, wmsSystem) {
3758
+ this.agenda = agenda;
3759
+ this.updateState({ wmsSystem: wmsSystem });
3344
3760
  this.verifyClienteExterno();
3345
3761
  this.getProcessTypeByScheduling();
3346
3762
  this.listDocuments(false);
3347
- this.wmsService.getSystemIntegration()
3348
- .subscribe(function (_a) {
3763
+ this.loadSystemIntegration();
3764
+ };
3765
+ DocumentGridFacade.prototype.loadSystemIntegration = function () {
3766
+ var _this = this;
3767
+ this.wmsService.getSystemIntegration().subscribe(function (_a) {
3349
3768
  var system = _a.system;
3350
- _this.wmsSystem = system;
3769
+ _this.updateState({ wmsSystem: system });
3770
+ _this.updateStrategy(system);
3351
3771
  if (_this.isWmsSeniorConnect()) {
3352
3772
  _this.getYard();
3353
3773
  _this.getSchedule();
3354
3774
  }
3355
3775
  });
3356
3776
  };
3357
- DocumentGridComponent.prototype.getYard = function () {
3777
+ DocumentGridFacade.prototype.updateStrategy = function (wmsSystem) {
3778
+ this.currentStrategy = this.strategyFactory.getStrategy(wmsSystem);
3779
+ this.updateGridColumns();
3780
+ };
3781
+ DocumentGridFacade.prototype.getYard = function () {
3358
3782
  var _this = this;
3359
- this.documentService.getYard(this.agenda.planta.id)
3360
- .pipe(catchError(function (err) {
3361
- return throwError(err);
3362
- }))
3783
+ this.documentService
3784
+ .getYard(this.agenda.planta.id)
3785
+ .pipe(catchError(function (err) { return throwError(err); }))
3363
3786
  .subscribe(function (content) {
3364
3787
  _this.yard = content;
3365
3788
  });
3366
3789
  };
3367
- DocumentGridComponent.prototype.getSchedule = function () {
3790
+ DocumentGridFacade.prototype.getSchedule = function () {
3368
3791
  var _this = this;
3369
3792
  if (this.agenda.externalTenant && this.agenda.externalTenant.cnpj) {
3370
3793
  this.schedule = this.agenda;
3371
3794
  return;
3372
3795
  }
3373
- this.agendaService.get(this.agenda.id)
3374
- .pipe(catchError(function (err) {
3375
- return throwError(err);
3376
- }))
3796
+ this.agendaService
3797
+ .get(this.agenda.id)
3798
+ .pipe(catchError(function (err) { return throwError(err); }))
3377
3799
  .subscribe(function (content) {
3378
3800
  _this.schedule = content;
3379
3801
  });
3380
3802
  };
3381
- DocumentGridComponent.prototype.verifyClienteExterno = function () {
3803
+ DocumentGridFacade.prototype.verifyClienteExterno = function () {
3382
3804
  var _this = this;
3383
- this.agendaService.isClienteExterno()
3805
+ this.agendaService
3806
+ .isClienteExterno()
3384
3807
  .subscribe(function (result) {
3385
- _this.isClienteExterno = result.isClienteExterno;
3386
- _this.gridColumns = _this.getGridColumns();
3808
+ _this.updateState({ isClienteExterno: result.isClienteExterno });
3809
+ _this.updateGridColumns();
3387
3810
  _this.cantEditStatus();
3388
3811
  });
3389
3812
  };
3390
- DocumentGridComponent.prototype.getProcessTypeByScheduling = function () {
3813
+ DocumentGridFacade.prototype.getProcessTypeByScheduling = function () {
3391
3814
  var _this = this;
3392
- this.integrationService.getProcessTypeByScheduling(this.agenda.tipoAgendamento.id)
3393
- .subscribe(function (result) { return _this.processType = result.processType; });
3815
+ this.integrationService
3816
+ .getProcessTypeByScheduling(this.agenda.tipoAgendamento.id)
3817
+ .subscribe(function (result) {
3818
+ _this.updateState({ processType: result.processType });
3819
+ });
3820
+ };
3821
+ DocumentGridFacade.prototype.cantEditStatus = function () {
3822
+ var cantEditStatus = [
3823
+ "CANCELADO",
3824
+ "EM_EXECUCAO",
3825
+ "CONCLUIDO",
3826
+ "AGUARDANDO_POR_VALIDACAO",
3827
+ ].includes(this.agenda.status.toString());
3828
+ if (cantEditStatus) {
3829
+ this.updateState({ enableButtonIsClienteExterno: false });
3830
+ }
3831
+ };
3832
+ // Ações
3833
+ DocumentGridFacade.prototype.openInvoiceKeyModal = function () {
3834
+ this.updateState({
3835
+ selection: [],
3836
+ showInvoiceSearchModal: true,
3837
+ });
3838
+ };
3839
+ DocumentGridFacade.prototype.openDocumentRegisterModal = function () {
3840
+ this.updateState({
3841
+ selection: [],
3842
+ edit: true,
3843
+ showAddInvoiceModal: true,
3844
+ });
3845
+ };
3846
+ DocumentGridFacade.prototype.closeInvoiceSearchModal = function () {
3847
+ this.updateState({ showInvoiceSearchModal: false });
3848
+ };
3849
+ DocumentGridFacade.prototype.closeAddInvoiceModal = function () {
3850
+ this.updateState({ showAddInvoiceModal: false });
3851
+ };
3852
+ DocumentGridFacade.prototype.viewDocument = function () {
3853
+ this.updateState({
3854
+ showAddInvoiceModal: true,
3855
+ edit: false,
3856
+ });
3857
+ return this.state.selection[0];
3858
+ };
3859
+ DocumentGridFacade.prototype.setSelection = function (selection) {
3860
+ this.updateState({ selection: selection });
3394
3861
  };
3395
- DocumentGridComponent.prototype.onChangeDocument = function (document) {
3862
+ DocumentGridFacade.prototype.addToSelection = function (document) {
3863
+ this.updateState({ selection: [document] });
3864
+ };
3865
+ DocumentGridFacade.prototype.setDisabled = function (disabled) {
3866
+ this.updateState({ disabled: disabled });
3867
+ };
3868
+ DocumentGridFacade.prototype.setShowInvoiceSearchModal = function (visible) {
3869
+ this.updateState({ showInvoiceSearchModal: visible });
3870
+ };
3871
+ DocumentGridFacade.prototype.setShowAddInvoiceModal = function (visible) {
3872
+ this.updateState({ showAddInvoiceModal: visible });
3873
+ };
3874
+ DocumentGridFacade.prototype.onChangeDocument = function (document) {
3396
3875
  if (!this.hasFilledValues(document)) {
3397
3876
  this.utils.message("error", "yms.int.wms_save_error_register_document_message_title", "yms.int.wms_save_error_register_document_message_description");
3398
3877
  return;
3399
3878
  }
3400
3879
  this.assignKeys(document);
3401
- var duplicateDocument = this.gridData.find(function (gridData) { return gridData.key === document.key; });
3880
+ var duplicateDocument = this.state.gridData.find(function (gridData) { return gridData.key === document.key; });
3402
3881
  if (duplicateDocument) {
3403
3882
  this.utils.message("error", "yms.int.wms_error_register_document_message_title", "yms.int.wms_error_register_document_message_description");
3404
3883
  return;
3405
3884
  }
3406
- this.gridData.push(document);
3407
- this.disabled = false;
3885
+ var newGridData = __spread(this.state.gridData, [document]);
3886
+ this.updateState({
3887
+ gridData: newGridData,
3888
+ disabled: false,
3889
+ showAddInvoiceModal: false,
3890
+ showInvoiceSearchModal: false,
3891
+ });
3408
3892
  this.utils.message("success", this.summary, "yms.int.wms_success_message_description");
3409
- this.visibleDocumentRegister = false;
3410
- this.visibleInvoiceKey = false;
3411
3893
  };
3412
- DocumentGridComponent.prototype.assignKeys = function (document) {
3894
+ DocumentGridFacade.prototype.assignKeys = function (document) {
3413
3895
  if (document.id === undefined) {
3414
3896
  if (this.agenda.id !== undefined) {
3415
3897
  document.schedulingId = this.agenda.id;
3416
3898
  }
3417
3899
  if (document.key === undefined || document.key === null) {
3418
- document.key = document.invoiceKey;
3419
- if (this.isWmsWIS()) {
3420
- document.key = document.invoiceNumber + ":" + document.invoiceSerialNumber + ":" + document.partnerDocument;
3421
- }
3900
+ document.key =
3901
+ this.currentStrategy.updateDocumentKey(document) ||
3902
+ document.invoiceKey;
3422
3903
  }
3423
3904
  }
3424
3905
  };
3425
- DocumentGridComponent.prototype.hasFilledValues = function (document) {
3906
+ DocumentGridFacade.prototype.hasFilledValues = function (document) {
3426
3907
  var formValues = Object.values(document);
3427
- return formValues.some(function (value) { return value !== null && value !== ''; });
3908
+ return formValues.some(function (value) { return value !== null && value !== ""; });
3428
3909
  };
3429
- DocumentGridComponent.prototype.cantEditStatus = function () {
3430
- var cantEditStatus = [
3431
- 'CANCELADO',
3432
- 'EM_EXECUCAO',
3433
- 'CONCLUIDO',
3434
- 'AGUARDANDO_POR_VALIDACAO'
3435
- ].includes(this.agenda.status.toString());
3436
- if (cantEditStatus) {
3437
- this.enableButtonIsClienteExterno = false;
3438
- }
3439
- };
3440
- DocumentGridComponent.prototype.getActions = function () {
3910
+ DocumentGridFacade.prototype.save = function () {
3441
3911
  var _this = this;
3442
- return [
3443
- {
3444
- disabled: this.checkWmsSystemInvalid(),
3445
- label: this.translate.instant("yms.int.wms_search"),
3446
- command: function () {
3447
- _this.selection = [];
3448
- _this.visibleInvoiceKey = true;
3449
- },
3450
- icon: "fa fa-search"
3451
- },
3452
- {
3453
- disabled: this.checkWmsSystemInvalid(),
3454
- label: this.translate.instant("yms.int.wms_add_document_register"),
3455
- command: function () {
3456
- _this.selection = [];
3457
- _this.edit = true;
3458
- _this.visibleDocumentRegister = true;
3459
- },
3460
- icon: "fas fa-pen-square"
3461
- }
3462
- ];
3463
- };
3464
- DocumentGridComponent.prototype.checkWmsSystemInvalid = function () {
3465
- if (this.wmsSystem && this.wmsSystem === WmsSystem.NONE) {
3466
- return true;
3467
- }
3468
- return false;
3469
- };
3470
- DocumentGridComponent.prototype.getProp = function (obj, path) {
3471
- return path.split(".").reduce(function (result, prop) { return (result[prop] === undefined ? "" : result[prop]); }, obj);
3472
- };
3473
- DocumentGridComponent.prototype.view = function () {
3474
- this.viewDocument.emit(this.selection[0]);
3475
- this.visibleDocumentRegister = true;
3476
- this.edit = false;
3477
- };
3478
- DocumentGridComponent.prototype.save = function () {
3479
- var _this = this;
3480
- if (this.gridData.length > 0) {
3481
- this.gridData.forEach(function (data) {
3912
+ var gridData = this.state.gridData;
3913
+ if (gridData.length > 0) {
3914
+ gridData.forEach(function (data) {
3482
3915
  if (!data.id) {
3483
3916
  if (!data.schedulingId) {
3484
3917
  data.schedulingId = _this.agenda.id;
@@ -3487,194 +3920,240 @@ var DocumentGridComponent = /** @class */ (function () {
3487
3920
  _this.documentService.insert(data).subscribe(function () {
3488
3921
  _this.sucessMessage();
3489
3922
  });
3490
- _this.disabled = true;
3923
+ _this.updateState({ disabled: true });
3491
3924
  }
3492
3925
  else {
3493
3926
  _this.documentService.update(data.id, data).subscribe(function () {
3494
3927
  _this.sucessMessage();
3495
- _this.disabled = true;
3928
+ _this.updateState({ disabled: true });
3496
3929
  });
3497
3930
  }
3498
3931
  });
3499
3932
  this.listDocuments(false);
3500
3933
  }
3501
3934
  };
3502
- DocumentGridComponent.prototype.updateKeyByWms = function (data) {
3503
- if (!data.key) {
3504
- data.key = data.invoiceKey;
3505
- }
3506
- if (this.wmsSystem === WmsSystem.WIS) {
3507
- data.key = data.invoiceNumber + ":" + data.invoiceSerialNumber + ":" + data.partnerDocument;
3508
- }
3509
- return data.key;
3935
+ DocumentGridFacade.prototype.updateKeyByWms = function (data) {
3936
+ return this.currentStrategy.updateDocumentKey(data) || data.invoiceKey;
3510
3937
  };
3511
- DocumentGridComponent.prototype.onDelete = function () {
3938
+ DocumentGridFacade.prototype.deleteSelectedDocuments = function () {
3512
3939
  var _this = this;
3513
- this.confirmationService.confirm({
3514
- message: this.translate.instant("delete_confirmation_message"),
3515
- header: this.translate.instant("delete_confirmation_title"),
3516
- accept: function () {
3517
- _this.removeDocumentIfIdUndfined();
3518
- if (_this.selection.length < 1) {
3519
- return null;
3520
- }
3521
- return forkJoin(_this.selection.map(function (document) { return _this.documentService.delete(document.id); }))
3522
- .pipe(takeUntil(_this.ngUnsubscribe))
3523
- .subscribe(function () {
3524
- _this.utils.message("success", "deleted_message_title", "deleted_message_content");
3525
- _this.listDocuments(true);
3526
- });
3527
- }
3940
+ this.removeDocumentIfIdUndefined();
3941
+ var selection = this.state.selection;
3942
+ if (selection.length < 1) {
3943
+ return;
3944
+ }
3945
+ forkJoin(selection.map(function (document) { return _this.documentService.delete(document.id); }))
3946
+ .pipe(takeUntil(this.ngUnsubscribe))
3947
+ .subscribe(function () {
3948
+ _this.utils.message("success", "yms.patio.warn_deleted_message_title", "yms.patio.deleted_message_detail");
3949
+ _this.listDocuments(true);
3528
3950
  });
3529
3951
  };
3530
- DocumentGridComponent.prototype.removeDocumentIfIdUndfined = function () {
3531
- var _this = this;
3532
- this.selection.forEach(function (value, index) {
3952
+ DocumentGridFacade.prototype.removeDocumentIfIdUndefined = function () {
3953
+ var _a = this.state, selection = _a.selection, gridData = _a.gridData;
3954
+ var newSelection = __spread(selection);
3955
+ var newGridData = __spread(gridData);
3956
+ selection.forEach(function (value, index) {
3533
3957
  if (!value.id) {
3534
- var indexGridData = _this.gridData.findIndex(function (document) { return document.key === value.key; });
3535
- _this.gridData.splice(indexGridData, 1);
3536
- _this.selection.splice(index, 1);
3958
+ var indexGridData = newGridData.findIndex(function (document) { return document.key === value.key; });
3959
+ newGridData.splice(indexGridData, 1);
3960
+ newSelection.splice(index, 1);
3537
3961
  }
3538
3962
  });
3963
+ this.updateState({ gridData: newGridData, selection: newSelection });
3539
3964
  };
3540
- DocumentGridComponent.prototype.notSavedDocuments = function () {
3541
- return this.gridData.some(function (document) { return !document.id; });
3965
+ DocumentGridFacade.prototype.notSavedDocuments = function () {
3966
+ return this.state.gridData.some(function (document) { return !document.id; });
3542
3967
  };
3543
- DocumentGridComponent.prototype.listDocuments = function (isDelete) {
3968
+ DocumentGridFacade.prototype.listDocuments = function (isDelete) {
3544
3969
  var _this = this;
3545
- this.documentService.list({
3970
+ this.documentService
3971
+ .list({
3546
3972
  filterQuery: "schedulingId eq '" + this.agenda.id + "'",
3547
- size: 100
3973
+ size: 100,
3548
3974
  })
3549
3975
  .subscribe(function (contents) {
3550
- var _a;
3551
- _this.gridData = isDelete ? _this.gridData.filter(function (item) { return !item.id; }) : [];
3976
+ var newGridData = isDelete
3977
+ ? _this.state.gridData.filter(function (item) { return !item.id; })
3978
+ : [];
3552
3979
  if (contents.totalElements > 0) {
3553
- (_a = _this.gridData).push.apply(_a, __spread(contents.contents));
3554
- _this.documentTotalRecords = contents.totalElements;
3555
- }
3556
- else {
3557
- _this.documentTotalRecords = _this.gridData.length;
3558
- }
3559
- var hasElementWithoutId = _this.gridData.some(function (item) { return !item.id; });
3560
- _this.disabled = !hasElementWithoutId;
3561
- _this.loading = false;
3562
- _this.selection = [];
3980
+ newGridData = __spread(newGridData, contents.contents);
3981
+ }
3982
+ var documentTotalRecords = contents.totalElements > 0
3983
+ ? contents.totalElements
3984
+ : newGridData.length;
3985
+ var hasElementWithoutId = newGridData.some(function (item) { return !item.id; });
3986
+ _this.updateState({
3987
+ gridData: newGridData,
3988
+ disabled: !hasElementWithoutId,
3989
+ loading: false,
3990
+ selection: [],
3991
+ documentTotalRecords: documentTotalRecords,
3992
+ });
3563
3993
  });
3564
3994
  };
3565
- DocumentGridComponent.prototype.getGridColumns = function () {
3566
- var result;
3567
- switch (this.wmsSystem) {
3568
- case WmsSystem.SENIOR_CONNECT:
3569
- result = this.wmsSeniorConnectIntegration();
3570
- break;
3571
- case WmsSystem.WIS:
3572
- result = this.wmsWisIntegration();
3573
- break;
3574
- case WmsSystem.SENIOR:
3575
- result = this.wmsSiltIntegration();
3576
- break;
3577
- case WmsSystem.PARTNER:
3578
- result = this.wmsPartnerIntegration();
3579
- break;
3580
- default:
3581
- result = [];
3582
- }
3583
- return result;
3584
- };
3585
- DocumentGridComponent.prototype.wmsPartnerIntegration = function () {
3586
- var columns = __spread([
3587
- { field: "invoiceKey", header: this.translate.instant("yms.int.wms_register_document_invoice_key") },
3588
- { field: "invoiceNumber", header: this.translate.instant("yms.int.wms_register_document_invoice_number") },
3589
- { field: "invoiceSerialNumber", header: this.translate.instant("yms.int.wms_register_document_invoice_serial_number") }
3590
- ], this.getColumnPartner());
3591
- return columns;
3995
+ // Menu Actions
3996
+ DocumentGridFacade.prototype.getActions = function () {
3997
+ var _this = this;
3998
+ return [
3999
+ {
4000
+ disabled: this.checkWmsSystemInvalid(),
4001
+ label: this.translate.instant("yms.int.wms_search"),
4002
+ command: function () { return _this.openInvoiceKeyModal(); },
4003
+ icon: "fa fa-search",
4004
+ },
4005
+ {
4006
+ disabled: this.checkWmsSystemInvalid(),
4007
+ label: this.translate.instant("yms.int.wms_add_document_register"),
4008
+ command: function () { return _this.openDocumentRegisterModal(); },
4009
+ icon: "fas fa-pen-square",
4010
+ },
4011
+ ];
3592
4012
  };
3593
- DocumentGridComponent.prototype.wmsSeniorConnectIntegration = function () {
3594
- var columns = __spread([
3595
- { field: "key", header: this.translate.instant("yms.int.wms_purchaseOrder") }
3596
- ], this.getColumnPartner(), this.getColumnlogistcUnit());
3597
- return columns;
4013
+ DocumentGridFacade.prototype.checkWmsSystemInvalid = function () {
4014
+ var wmsSystem = this.state.wmsSystem;
4015
+ return wmsSystem && wmsSystem === WmsSystem.NONE;
3598
4016
  };
3599
- DocumentGridComponent.prototype.wmsWisIntegration = function () {
3600
- var columns = __spread(this.getColumnInvoiceAndlogistcUnit());
3601
- this.addInvoiceSituationIfNotClienteExterno(columns);
3602
- return columns;
4017
+ // Grid columns
4018
+ DocumentGridFacade.prototype.updateGridColumns = function () {
4019
+ var gridColumns = this.getGridColumns();
4020
+ this.updateState({ gridColumns: gridColumns });
3603
4021
  };
3604
- DocumentGridComponent.prototype.wmsSiltIntegration = function () {
3605
- var columns = __spread([
3606
- { field: "invoiceKey", header: this.translate.instant("yms.int.wms_register_document_invoice_key") }
3607
- ], this.getColumnInvoiceAndlogistcUnit(), [
3608
- { field: "ownerName", header: this.translate.instant("yms.int.wms_register_document_owner_name") },
3609
- { field: "ownerDocument", header: this.translate.instant("yms.int.wms_register_document_owner_document") },
3610
- ]);
3611
- this.addInvoiceSituationIfNotClienteExterno(columns);
3612
- return columns;
4022
+ DocumentGridFacade.prototype.getGridColumns = function () {
4023
+ if (!this.currentStrategy) {
4024
+ return [];
4025
+ }
4026
+ return this.currentStrategy.getGridColumns(this.translate, this.state.isClienteExterno);
3613
4027
  };
3614
- DocumentGridComponent.prototype.getColumninvoiceCondition = function () {
3615
- return { field: "invoiceCondition", header: this.translate.instant("yms.int.wms_grid_document_invoice_condition") };
4028
+ // WMS Type checks
4029
+ DocumentGridFacade.prototype.isWmsSeniorConnect = function () {
4030
+ return this.state.wmsSystem === WmsSystem.SENIOR_CONNECT;
3616
4031
  };
3617
- DocumentGridComponent.prototype.getColumnInvoiceAndlogistcUnit = function () {
3618
- return __spread([
3619
- { field: "invoiceNumber", header: this.translate.instant("yms.int.wms_register_document_invoice_number") },
3620
- { field: "invoiceSerialNumber", header: this.translate.instant("yms.int.wms_register_document_invoice_serial_number") }
3621
- ], this.getColumnPartner(), this.getColumnlogistcUnit());
4032
+ DocumentGridFacade.prototype.isWmsWIS = function () {
4033
+ return this.state.wmsSystem === WmsSystem.WIS;
3622
4034
  };
3623
- DocumentGridComponent.prototype.getColumnPartner = function () {
3624
- return [
3625
- { field: "partnerName", header: this.translate.instant("yms.int.wms_register_document_partner_name") },
3626
- { field: "partnerDocument", header: this.translate.instant("yms.int.wms_register_document_partner_document") },
3627
- ];
4035
+ DocumentGridFacade.prototype.isWmsSilt = function () {
4036
+ return this.state.wmsSystem === WmsSystem.SENIOR;
3628
4037
  };
3629
- DocumentGridComponent.prototype.getColumnlogistcUnit = function () {
3630
- return [
3631
- { field: "logistcUnitName", header: this.translate.instant("yms.int.wms_register_document_logistc_unit_name") },
3632
- { field: "logistcUnitDocument", header: this.translate.instant("yms.int.wms_register_document_logistc_unit_document") },
3633
- ];
4038
+ DocumentGridFacade.prototype.isWmsPartner = function () {
4039
+ return this.state.wmsSystem === WmsSystem.PARTNER;
3634
4040
  };
3635
- DocumentGridComponent.prototype.addInvoiceSituationIfNotClienteExterno = function (columns) {
3636
- if (!this.isClienteExterno) {
3637
- columns.push(this.getColumninvoiceCondition());
4041
+ // Validation
4042
+ DocumentGridFacade.prototype.validateDocument = function (document) {
4043
+ if (!this.currentStrategy) {
4044
+ return true;
4045
+ }
4046
+ var result = this.currentStrategy.validateDocument(document, {
4047
+ yard: this.yard,
4048
+ schedule: this.schedule,
4049
+ agenda: this.agenda,
4050
+ });
4051
+ if (!result.isValid && result.errorMessageKey) {
4052
+ this.buildMessage(result.errorMessageKey);
3638
4053
  }
4054
+ return result.isValid;
3639
4055
  };
3640
- DocumentGridComponent.prototype.isWmsSeniorConnect = function () {
3641
- return this.wmsSystem === WmsSystem.SENIOR_CONNECT;
4056
+ // Invoice conditions
4057
+ DocumentGridFacade.prototype.getFilteredInvoiceConditions = function (invoiceCondition) {
4058
+ if (!this.currentStrategy) {
4059
+ return this.invoiceConditions;
4060
+ }
4061
+ return this.currentStrategy.getFilteredInvoiceConditions(invoiceCondition, this.invoiceConditions);
3642
4062
  };
3643
- DocumentGridComponent.prototype.isWmsWIS = function () {
3644
- return this.wmsSystem === WmsSystem.WIS;
4063
+ DocumentGridFacade.prototype.supportsInvoiceCondition = function () {
4064
+ return this.currentStrategy.supportsInvoiceCondition() || false;
3645
4065
  };
3646
- DocumentGridComponent.prototype.isWmsSilt = function () {
3647
- return this.wmsSystem === WmsSystem.SENIOR;
4066
+ // Helpers
4067
+ DocumentGridFacade.prototype.getProp = function (obj, path) {
4068
+ return path
4069
+ .split(".")
4070
+ .reduce(function (result, prop) {
4071
+ return result[prop] === undefined ? "" : result[prop];
4072
+ }, obj);
3648
4073
  };
3649
- DocumentGridComponent.prototype.isWmsPartner = function () {
3650
- return this.wmsSystem === WmsSystem.PARTNER;
4074
+ DocumentGridFacade.prototype.sucessMessage = function () {
4075
+ this.utils.message("success", this.summary, "saved_message_content");
3651
4076
  };
3652
- DocumentGridComponent.prototype.sucessMessage = function () {
3653
- return this.utils.message("success", this.summary, "saved_message_content");
4077
+ DocumentGridFacade.prototype.buildMessage = function (description) {
4078
+ this.utils.message("warn", "yms.int.documento_invalido_warning_header", description);
3654
4079
  };
3655
- DocumentGridComponent.prototype.validateDocument = function (document) {
3656
- if (this.isWmsSeniorConnect()) {
3657
- if (!this.yard.codigo) {
3658
- this.buildMessage("yms.int.yard_code_not_found_warning_description");
3659
- return false;
3660
- }
3661
- if (document.logistcUnitDocument !== this.yard.codigo) {
3662
- this.buildMessage("yms.int.document_yard_mismatch_agenda_warning_description");
3663
- return false;
3664
- }
3665
- if (!this.schedule.externalTenant) {
3666
- this.buildMessage("yms.int.partner_not_informed_agenda_warning_description");
3667
- return false;
3668
- }
3669
- if (document.partnerDocument !== this.schedule.externalTenant.cnpj) {
3670
- this.buildMessage("yms.int.partner_differs_from_agenda_warning_description");
3671
- return false;
3672
- }
3673
- }
3674
- return true;
4080
+ DocumentGridFacade.prototype.updateState = function (partialState) {
4081
+ this.stateSubject.next(__assign({}, this.state, partialState));
3675
4082
  };
3676
- DocumentGridComponent.prototype.buildMessage = function (description) {
3677
- this.utils.message("warn", "yms.int.documento_invalido_warning_header", description);
4083
+ DocumentGridFacade.prototype.destroy = function () {
4084
+ this.ngUnsubscribe.next();
4085
+ this.ngUnsubscribe.complete();
4086
+ };
4087
+ DocumentGridFacade = __decorate([
4088
+ Injectable(),
4089
+ __metadata("design:paramtypes", [TranslateService,
4090
+ DocumentService,
4091
+ IntegrationService,
4092
+ AgendaService,
4093
+ UtilsMessageService,
4094
+ FormWmsService,
4095
+ WmsIntegrationStrategyFactory])
4096
+ ], DocumentGridFacade);
4097
+ return DocumentGridFacade;
4098
+ }());
4099
+
4100
+ var DocumentGridComponent = /** @class */ (function () {
4101
+ function DocumentGridComponent(facade, confirmationService, translate) {
4102
+ this.facade = facade;
4103
+ this.confirmationService = confirmationService;
4104
+ this.translate = translate;
4105
+ this.viewDocument = new EventEmitter();
4106
+ }
4107
+ DocumentGridComponent.prototype.ngOnInit = function () {
4108
+ this.state$ = this.facade.state$;
4109
+ this.facade.init(this.agenda, this.wmsSystem);
4110
+ };
4111
+ DocumentGridComponent.prototype.ngOnDestroy = function () {
4112
+ this.facade.destroy();
4113
+ };
4114
+ // UI Event handlers - delegam para o facade
4115
+ DocumentGridComponent.prototype.onView = function () {
4116
+ var document = this.facade.viewDocument();
4117
+ this.viewDocument.emit(document);
4118
+ };
4119
+ DocumentGridComponent.prototype.onSave = function () {
4120
+ this.facade.save();
4121
+ };
4122
+ DocumentGridComponent.prototype.onDelete = function () {
4123
+ var _this = this;
4124
+ this.confirmationService.confirm({
4125
+ message: this.translate.instant("delete_confirmation_message"),
4126
+ header: this.translate.instant("delete_confirmation_title"),
4127
+ accept: function () {
4128
+ _this.facade.deleteSelectedDocuments();
4129
+ },
4130
+ });
4131
+ };
4132
+ DocumentGridComponent.prototype.onRefresh = function () {
4133
+ this.facade.listDocuments(false);
4134
+ };
4135
+ DocumentGridComponent.prototype.onRowSelect = function (rowData) {
4136
+ this.facade.addToSelection(rowData);
4137
+ };
4138
+ DocumentGridComponent.prototype.onInvoiceConditionChange = function () {
4139
+ this.facade.setDisabled(false);
4140
+ };
4141
+ Object.defineProperty(DocumentGridComponent.prototype, "invoiceConditions", {
4142
+ // Getters para o template (delegam para o facade)
4143
+ get: function () {
4144
+ return this.facade.invoiceConditions;
4145
+ },
4146
+ enumerable: true,
4147
+ configurable: true
4148
+ });
4149
+ DocumentGridComponent.prototype.getActions = function () {
4150
+ return this.facade.getActions();
4151
+ };
4152
+ DocumentGridComponent.prototype.getFilteredInvoiceConditions = function (invoiceCondition) {
4153
+ return this.facade.getFilteredInvoiceConditions(invoiceCondition);
4154
+ };
4155
+ DocumentGridComponent.prototype.notSavedDocuments = function () {
4156
+ return this.facade.notSavedDocuments();
3678
4157
  };
3679
4158
  __decorate([
3680
4159
  Input(),
@@ -3687,11 +4166,11 @@ var DocumentGridComponent = /** @class */ (function () {
3687
4166
  __decorate([
3688
4167
  Output(),
3689
4168
  __metadata("design:type", Boolean)
3690
- ], DocumentGridComponent.prototype, "visibleInvoiceKey", void 0);
4169
+ ], DocumentGridComponent.prototype, "showInvoiceSearchModal", void 0);
3691
4170
  __decorate([
3692
4171
  Output(),
3693
4172
  __metadata("design:type", Boolean)
3694
- ], DocumentGridComponent.prototype, "visibleDocumentRegister", void 0);
4173
+ ], DocumentGridComponent.prototype, "showAddInvoiceModal", void 0);
3695
4174
  __decorate([
3696
4175
  Output(),
3697
4176
  __metadata("design:type", EventEmitter)
@@ -3722,17 +4201,13 @@ var DocumentGridComponent = /** @class */ (function () {
3722
4201
  ], DocumentGridComponent.prototype, "customGridBody", void 0);
3723
4202
  DocumentGridComponent = __decorate([
3724
4203
  Component({
3725
- selector: 'document-grid',
3726
- 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>",
4204
+ selector: "document-grid",
4205
+ 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",
3727
4206
  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}"]
3728
4207
  }),
3729
- __metadata("design:paramtypes", [TranslateService,
3730
- DocumentService,
4208
+ __metadata("design:paramtypes", [DocumentGridFacade,
3731
4209
  ConfirmationService,
3732
- IntegrationService,
3733
- AgendaService,
3734
- UtilsMessageService,
3735
- FormWmsService])
4210
+ TranslateService])
3736
4211
  ], DocumentGridComponent);
3737
4212
  return DocumentGridComponent;
3738
4213
  }());
@@ -3780,10 +4255,10 @@ var Document = /** @class */ (function () {
3780
4255
  }());
3781
4256
 
3782
4257
  var RegisterDocumentComponent = /** @class */ (function () {
3783
- function RegisterDocumentComponent(fb, translate, documentGridComponent) {
4258
+ function RegisterDocumentComponent(fb, translate, facade) {
3784
4259
  this.fb = fb;
3785
4260
  this.translate = translate;
3786
- this.documentGridComponent = documentGridComponent;
4261
+ this.facade = facade;
3787
4262
  this.document = new EventEmitter();
3788
4263
  this.visible = new EventEmitter();
3789
4264
  this.visibleChange = new EventEmitter();
@@ -3814,19 +4289,23 @@ var RegisterDocumentComponent = /** @class */ (function () {
3814
4289
  this.visibleChange.emit(false);
3815
4290
  };
3816
4291
  RegisterDocumentComponent.prototype.setValuesFormGroup = function (document) {
3817
- this.formGroup.get('key').setValue(document.key);
3818
- this.formGroup.get('invoiceKey').setValue(document.invoiceKey);
3819
- this.formGroup.get('invoiceNumber').setValue(document.invoiceNumber);
3820
- this.formGroup.get('invoiceSerialNumber').setValue(document.invoiceSerialNumber);
3821
- this.formGroup.get('logistcUnitDocument').setValue(document.logistcUnitDocument);
3822
- this.formGroup.get('logistcUnitName').setValue(document.logistcUnitName);
3823
- this.formGroup.get('notes').setValue(document.notes);
3824
- this.formGroup.get('code').setValue(document.code);
3825
- this.formGroup.get('partnerName').setValue(document.partnerName);
3826
- this.formGroup.get('partnerDocument').setValue(document.partnerDocument);
3827
- this.formGroup.get('ownerDocument').setValue(document.ownerDocument);
3828
- this.formGroup.get('ownerName').setValue(document.ownerName);
3829
- this.formGroup.get('invoiceCondition').setValue(document.invoiceCondition);
4292
+ this.formGroup.get("key").setValue(document.key);
4293
+ this.formGroup.get("invoiceKey").setValue(document.invoiceKey);
4294
+ this.formGroup.get("invoiceNumber").setValue(document.invoiceNumber);
4295
+ this.formGroup
4296
+ .get("invoiceSerialNumber")
4297
+ .setValue(document.invoiceSerialNumber);
4298
+ this.formGroup
4299
+ .get("logistcUnitDocument")
4300
+ .setValue(document.logistcUnitDocument);
4301
+ this.formGroup.get("logistcUnitName").setValue(document.logistcUnitName);
4302
+ this.formGroup.get("notes").setValue(document.notes);
4303
+ this.formGroup.get("code").setValue(document.code);
4304
+ this.formGroup.get("partnerName").setValue(document.partnerName);
4305
+ this.formGroup.get("partnerDocument").setValue(document.partnerDocument);
4306
+ this.formGroup.get("ownerDocument").setValue(document.ownerDocument);
4307
+ this.formGroup.get("ownerName").setValue(document.ownerName);
4308
+ this.formGroup.get("invoiceCondition").setValue(document.invoiceCondition);
3830
4309
  };
3831
4310
  RegisterDocumentComponent.prototype.getFormGroup = function () {
3832
4311
  this.formGroup = this.fb.group({
@@ -3848,7 +4327,7 @@ var RegisterDocumentComponent = /** @class */ (function () {
3848
4327
  };
3849
4328
  RegisterDocumentComponent.prototype.save = function () {
3850
4329
  var document = Document.fromDto(this.formGroup.getRawValue());
3851
- if (!this.documentGridComponent.validateDocument(document)) {
4330
+ if (!this.facade.validateDocument(document)) {
3852
4331
  return;
3853
4332
  }
3854
4333
  this.document.emit(document);
@@ -3870,7 +4349,7 @@ var RegisterDocumentComponent = /** @class */ (function () {
3870
4349
  var _this = this;
3871
4350
  this.formGroup.valueChanges.subscribe(function () {
3872
4351
  var formValues = Object.values(_this.formGroup.value);
3873
- _this.isSaveFormValid = formValues.some(function (value) { return value !== null && value !== ''; });
4352
+ _this.isSaveFormValid = formValues.some(function (value) { return value !== null && value !== ""; });
3874
4353
  });
3875
4354
  };
3876
4355
  __decorate([
@@ -3908,11 +4387,11 @@ var RegisterDocumentComponent = /** @class */ (function () {
3908
4387
  RegisterDocumentComponent = __decorate([
3909
4388
  Component({
3910
4389
  selector: "register-document",
3911
- 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>"
4390
+ 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"
3912
4391
  }),
3913
4392
  __metadata("design:paramtypes", [FormBuilder,
3914
4393
  TranslateService,
3915
- DocumentGridComponent])
4394
+ DocumentGridFacade])
3916
4395
  ], RegisterDocumentComponent);
3917
4396
  return RegisterDocumentComponent;
3918
4397
  }());
@@ -3959,16 +4438,15 @@ var ExternalTenantService = /** @class */ (function (_super) {
3959
4438
  }(EntityService));
3960
4439
 
3961
4440
  var InsertKeyComponent = /** @class */ (function () {
3962
- function InsertKeyComponent(formBuilder, documentService, utils, confirmationService, translate, externalTenantService, documentGridComponent) {
4441
+ function InsertKeyComponent(formBuilder, documentService, utils, confirmationService, translate, externalTenantService, facade) {
3963
4442
  this.formBuilder = formBuilder;
3964
4443
  this.documentService = documentService;
3965
4444
  this.utils = utils;
3966
4445
  this.confirmationService = confirmationService;
3967
4446
  this.translate = translate;
3968
4447
  this.externalTenantService = externalTenantService;
3969
- this.documentGridComponent = documentGridComponent;
4448
+ this.facade = facade;
3970
4449
  this.visible = new EventEmitter();
3971
- this.document = new EventEmitter();
3972
4450
  this.visibleChange = new EventEmitter();
3973
4451
  this.isLoading = false;
3974
4452
  this.isPartnerloading = false;
@@ -3981,9 +4459,9 @@ var InsertKeyComponent = /** @class */ (function () {
3981
4459
  purchaseOrder: [undefined],
3982
4460
  invoiceNumber: [undefined],
3983
4461
  invoiceSerie: [undefined],
3984
- partnerDocument: [undefined]
4462
+ partnerDocument: [undefined],
3985
4463
  });
3986
- this.formGroup.get('key').valueChanges.subscribe(function (nf) {
4464
+ this.formGroup.get("key").valueChanges.subscribe(function (nf) {
3987
4465
  _this.validateKeyDetails(nf);
3988
4466
  });
3989
4467
  };
@@ -4003,19 +4481,22 @@ var InsertKeyComponent = /** @class */ (function () {
4003
4481
  var _this = this;
4004
4482
  this.isLoading = true;
4005
4483
  var key = {
4006
- purchaseOrder: this.formGroup.get('purchaseOrder').value,
4007
- documentKeys: [this.formGroup.get('key').value],
4008
- invoices: [{
4009
- number: this.formGroup.get('invoiceNumber').value,
4010
- serialNumber: this.formGroup.get('invoiceSerie').value,
4011
- partnerDocument: this.formGroup.get('partnerDocument').value
4012
- }],
4484
+ purchaseOrder: this.formGroup.get("purchaseOrder").value,
4485
+ documentKeys: [this.formGroup.get("key").value],
4486
+ invoices: [
4487
+ {
4488
+ number: this.formGroup.get("invoiceNumber").value,
4489
+ serialNumber: this.formGroup.get("invoiceSerie").value,
4490
+ partnerDocument: this.formGroup.get("partnerDocument").value,
4491
+ },
4492
+ ],
4013
4493
  logistcUnitName: undefined,
4014
4494
  size: 0,
4015
- offset: 0
4495
+ offset: 0,
4016
4496
  };
4017
4497
  var errorSearch = "yms.int.wms_error_search_document_message_header";
4018
- this.documentService.findDocuments(key)
4498
+ this.documentService
4499
+ .findDocuments(key)
4019
4500
  .pipe(catchError(function (err) {
4020
4501
  if (_this.wmsSystem === WmsSystem.PARTNER) {
4021
4502
  _this.utils.message("error", errorSearch, "yms.int.wms_error_search_document_not_found_partner");
@@ -4024,7 +4505,8 @@ var InsertKeyComponent = /** @class */ (function () {
4024
4505
  _this.utils.message("error", errorSearch, "yms.int.wms_error_search_document_not_found_message_content");
4025
4506
  }
4026
4507
  else {
4027
- _this.utils.translateMessage("error", errorSearch, "yms.int.wms_error_unknown_search_document_message_content " + err.error.message);
4508
+ _this.utils.message("error", errorSearch, err.error.message ||
4509
+ "yms.int.wms_error_unknown_search_document_message_content");
4028
4510
  }
4029
4511
  _this.confirmInvoiceDialog();
4030
4512
  return throwError(err);
@@ -4037,12 +4519,13 @@ var InsertKeyComponent = /** @class */ (function () {
4037
4519
  return;
4038
4520
  }
4039
4521
  var document = content.contents[0];
4040
- if (!_this.documentGridComponent.validateDocument(document)) {
4522
+ if (!_this.facade.validateDocument(document)) {
4041
4523
  return;
4042
4524
  }
4043
- document.invoiceKey = _this.formGroup.get('key').value;
4525
+ document.invoiceKey = _this.formGroup.get("key").value;
4044
4526
  document.invoiceCondition = InvoiceCondition.AUTHORIZED;
4045
- _this.document.emit(document);
4527
+ _this.facade.onChangeDocument(document);
4528
+ _this.facade.closeInvoiceSearchModal();
4046
4529
  _this.formGroup.reset();
4047
4530
  });
4048
4531
  };
@@ -4054,36 +4537,37 @@ var InsertKeyComponent = /** @class */ (function () {
4054
4537
  acceptLabel: this.translate.instant("yms.int.wms_accept_confirm_invoice_dialog"),
4055
4538
  rejectLabel: this.translate.instant("yms.int.wms_reject_confirm_invoice_dialog"),
4056
4539
  header: this.translate.instant("yms.int.wms_header_content_confirm_invoice_dialog"),
4057
- accept: function () { return _this.buildInvoice(); }
4540
+ accept: function () { return _this.buildInvoice(); },
4058
4541
  });
4059
4542
  }
4060
4543
  };
4061
4544
  InsertKeyComponent.prototype.buildInvoice = function () {
4062
4545
  var _this = this;
4063
4546
  this.isPartnerloading = true;
4064
- var partnerDocument = this.formGroup.get('partnerDocument').value;
4065
- this.externalTenantService.list({
4066
- filterQuery: "cnpj eq '" + partnerDocument + "'"
4547
+ var partnerDocument = this.formGroup.get("partnerDocument").value;
4548
+ this.externalTenantService
4549
+ .list({
4550
+ filterQuery: "cnpj eq '" + partnerDocument + "'",
4067
4551
  })
4068
4552
  .pipe(takeUntil(this.ngUnsubscribe), finalize(function () {
4069
4553
  _this.isPartnerloading = false;
4070
4554
  }))
4071
4555
  .subscribe(function (contents) {
4072
4556
  var documentInvoice = _this.createDocumentInvoice(contents);
4073
- _this.document.emit(documentInvoice);
4557
+ _this.facade.onChangeDocument(documentInvoice);
4074
4558
  _this.formGroup.reset();
4075
4559
  });
4076
4560
  };
4077
4561
  InsertKeyComponent.prototype.createDocumentInvoice = function (partners) {
4078
4562
  var documentInvoice = {
4079
- invoiceKey: this.formGroup.get('key').value,
4080
- invoiceNumber: this.formGroup.get('invoiceNumber').value,
4081
- invoiceSerialNumber: this.formGroup.get('invoiceSerie').value,
4082
- partnerDocument: this.formGroup.get('partnerDocument').value,
4563
+ invoiceKey: this.formGroup.get("key").value,
4564
+ invoiceNumber: this.formGroup.get("invoiceNumber").value,
4565
+ invoiceSerialNumber: this.formGroup.get("invoiceSerie").value,
4566
+ partnerDocument: this.formGroup.get("partnerDocument").value,
4083
4567
  partnerName: null,
4084
4568
  type: null,
4085
4569
  key: null,
4086
- schedulingId: null
4570
+ schedulingId: null,
4087
4571
  };
4088
4572
  if (partners.totalElements > 0) {
4089
4573
  var partner = partners.contents[0];
@@ -4119,9 +4603,9 @@ var InsertKeyComponent = /** @class */ (function () {
4119
4603
  this.setValuesOfKey(invoice, serie, cnpj);
4120
4604
  };
4121
4605
  InsertKeyComponent.prototype.setValuesOfKey = function (invoiceNumber, invoiceSerie, partnerDocument) {
4122
- this.formGroup.get('invoiceNumber').setValue(invoiceNumber);
4123
- this.formGroup.get('invoiceSerie').setValue(invoiceSerie);
4124
- this.formGroup.get('partnerDocument').setValue(partnerDocument);
4606
+ this.formGroup.get("invoiceNumber").setValue(invoiceNumber);
4607
+ this.formGroup.get("invoiceSerie").setValue(invoiceSerie);
4608
+ this.formGroup.get("partnerDocument").setValue(partnerDocument);
4125
4609
  };
4126
4610
  InsertKeyComponent.prototype.cancel = function () {
4127
4611
  this.visibleChange.emit(false);
@@ -4141,10 +4625,6 @@ var InsertKeyComponent = /** @class */ (function () {
4141
4625
  Input(),
4142
4626
  __metadata("design:type", EventEmitter)
4143
4627
  ], InsertKeyComponent.prototype, "visible", void 0);
4144
- __decorate([
4145
- Output(),
4146
- __metadata("design:type", EventEmitter)
4147
- ], InsertKeyComponent.prototype, "document", void 0);
4148
4628
  __decorate([
4149
4629
  Output(),
4150
4630
  __metadata("design:type", Object)
@@ -4152,7 +4632,7 @@ var InsertKeyComponent = /** @class */ (function () {
4152
4632
  InsertKeyComponent = __decorate([
4153
4633
  Component({
4154
4634
  selector: "insert-key",
4155
- 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",
4635
+ 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",
4156
4636
  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}"]
4157
4637
  }),
4158
4638
  __metadata("design:paramtypes", [FormBuilder,
@@ -4161,7 +4641,7 @@ var InsertKeyComponent = /** @class */ (function () {
4161
4641
  ConfirmationService,
4162
4642
  TranslateService,
4163
4643
  ExternalTenantService,
4164
- DocumentGridComponent])
4644
+ DocumentGridFacade])
4165
4645
  ], InsertKeyComponent);
4166
4646
  return InsertKeyComponent;
4167
4647
  }());
@@ -4224,7 +4704,12 @@ var DocumentGridModule = /** @class */ (function () {
4224
4704
  declarations: [DocumentGridComponent, CpfCnpjFormatPipe],
4225
4705
  entryComponents: [DocumentGridComponent],
4226
4706
  exports: [DocumentGridComponent, CpfCnpjFormatPipe],
4227
- providers: [ExternalTenantService],
4707
+ providers: [
4708
+ ExternalTenantService,
4709
+ DocumentGridFacade,
4710
+ WmsIntegrationStrategyFactory,
4711
+ ConfirmationService,
4712
+ ],
4228
4713
  imports: [
4229
4714
  CommonModule,
4230
4715
  TranslateModule,
@@ -4237,7 +4722,8 @@ var DocumentGridModule = /** @class */ (function () {
4237
4722
  ComponentsModule,
4238
4723
  EmptyStateModule,
4239
4724
  DropdownModule,
4240
- FormsModule
4725
+ FormsModule,
4726
+ ConfirmDialogModule,
4241
4727
  ],
4242
4728
  })
4243
4729
  ], DocumentGridModule);
@@ -14588,5 +15074,5 @@ var DockModule = /** @class */ (function () {
14588
15074
  return DockModule;
14589
15075
  }());
14590
15076
 
14591
- export { AgendaModule, AgendaService$1 as AgendaService, BalancaModule, BalancasService, CamerasModule, CamerasService, CancelasModule, CidadeModule, CidadeService, ContratoCompraItemModule, ContratoCompraItemService, ContratoCompraModule, ContratoCompraService, ControladorCancelaComponent, ControladorCancelaDescritor, ControladorCancelasService, CoreModule, DockModule, DockService, DocumentListComponent, DocumentListModule, ERP_ENVIRONMENT, ERP_SENIOR_HEADER, EmpresaModule, EmpresaService, ErpFormConfigService, ErpProcessData, ErpProcessService, ErpSeniorModule, EstadoModule, EstadoService, ExpedicaoChegadaVeiculoOverride, ExpedicaoModule, ExpedicaoService, FamiliaProdutoModule, FamiliaProdutoService, FieldCustomizationService, FilialModule, FilialService, FormComponent, FormDescritor, FormSamComponent, FormSamDescritor, FormWmsComponent, FormWmsDescritor, HasChangeService, INFORMACAOES_ADICIONAIS_HEADER, InfoComponent, InfoDescritor, IntegrationWebSocket, LogsModule, LogsService, LprModule, LprService, PaisModule, PaisService, PedidoVendaItemModule, PedidoVendaItemService, PedidoVendaModule, PedidoVendaService, PessoaEnderecoModule, PessoaEnderecoService, PessoaFisicaModule, PessoaFisicaService, PessoaJuridicaModule, PessoaJuridicaService, PessoaModule, PessoaService, PortariasComponent, PortariasDescritor, PortariasModule, ProdutoModule, ProdutoService, RecebimentoChegadaVeiculoOverride, RecebimentoContratoModule, RecebimentoContratoService, RoyaltyModule, RoyaltyService, SAM_SENIOR_HEADER, SafraModule, SafraService, SamSeniorModule, SnapshotComponent, SnapshotDescritor, TransportadoraModule, TransportadoraService, UnidadeMedidaModule, UnidadeMedidaService, VisitorListComponent, VisitorListModule, VisitorListService, VisualizarBalancaComponent, VisualizarBalancaDescritor, WmsModule, highlightLanguages, Service as ɵa, CustomStompConfig as ɵb, EntityService$2 as ɵba, EntityService$1 as ɵbb, UtilsMessageService as ɵbc, CpfCnpjFormatPipe as ɵbd, ExternalTenantService as ɵbe, RegisterDocumentModule as ɵbf, RegisterDocumentComponent as ɵbg, InsertKeyModule as ɵbh, InsertKeyComponent as ɵbi, IntegrationService$1 as ɵbj, RecebimentoFormComponent as ɵbk, DerivacaoService as ɵbl, NotaValidatorService as ɵbm, TransgeniaService as ɵbn, VerificaNotafiscal as ɵbo, BuildFormField as ɵbp, ExpedicaoFormComponent as ɵbq, ExpedicaoInfoComponent as ɵbr, RecebimentoInfoComponent as ɵbs, DevolucaoFormComponent as ɵbt, DevolucaoService as ɵbu, DevolucaoChegadaVeiculoOverride as ɵbv, RecebimentoOrdemCompraFormComponent as ɵbw, OrdemCompraService as ɵbx, RecebimentoOrdemCompraService as ɵby, RecebimentoOrdemCompraChegadaVeiculoOverride as ɵbz, ViewImageComponent as ɵc, RecebimentoOrdemCompraInfoComponent as ɵca, DevolucaoInfoComponent as ɵcb, ContratoFormComponent as ɵcc, OrdemCompraFormComponent as ɵcd, ProcessoAvulsoFormComponent as ɵce, ProcessoAvulsoService as ɵcf, ProcessoAvulsoChegadaVeiculoOverride as ɵcg, ProcessoAvulsoInfoComponent as ɵch, LogIntegracaoDescritor as ɵci, LogIntegracaoComponent as ɵcj, LogIntegracaoService as ɵck, DerivacaoModule as ɵcl, DevolucaoModule as ɵcm, OrdemCompraModule as ɵcn, RecebimentoOrdemCompraModule as ɵco, TransgeniaModule as ɵcp, ProcessoAvulsoModule as ɵcq, LogIntegracaoModule as ɵcr, NotaFormModule as ɵcs, DirectivesModule as ɵct, TrimDirective as ɵcu, NotaFormComponent as ɵcv, LogDescritor as ɵd, LogsComponent as ɵe, PortariasService as ɵf, EntradaComponent as ɵg, AgendasComponent as ɵh, ConfirmacaoComponent as ɵi, VisitedInfoDescritor as ɵj, VisitedInfoComponent as ɵk, VisitedInfoService as ɵl, SchedulingComponent as ɵm, LobbyService as ɵn, EntityService as ɵo, SchedulingService as ɵp, VisitanteComponent as ɵq, VisitanteFormComponent as ɵr, CredencialFormComponent as ɵs, FocusService as ɵt, FormWmsService as ɵu, DocumentGridModule as ɵv, DocumentGridComponent as ɵw, DocumentService as ɵx, IntegrationService as ɵy, AgendaService as ɵz };
15077
+ export { AgendaModule, AgendaService$1 as AgendaService, BalancaModule, BalancasService, CamerasModule, CamerasService, CancelasModule, CidadeModule, CidadeService, ContratoCompraItemModule, ContratoCompraItemService, ContratoCompraModule, ContratoCompraService, ControladorCancelaComponent, ControladorCancelaDescritor, ControladorCancelasService, CoreModule, DockModule, DockService, DocumentListComponent, DocumentListModule, ERP_ENVIRONMENT, ERP_SENIOR_HEADER, EmpresaModule, EmpresaService, ErpFormConfigService, ErpProcessData, ErpProcessService, ErpSeniorModule, EstadoModule, EstadoService, ExpedicaoChegadaVeiculoOverride, ExpedicaoModule, ExpedicaoService, FamiliaProdutoModule, FamiliaProdutoService, FieldCustomizationService, FilialModule, FilialService, FormComponent, FormDescritor, FormSamComponent, FormSamDescritor, FormWmsComponent, FormWmsDescritor, HasChangeService, INFORMACAOES_ADICIONAIS_HEADER, InfoComponent, InfoDescritor, IntegrationWebSocket, LogsModule, LogsService, LprModule, LprService, PaisModule, PaisService, PedidoVendaItemModule, PedidoVendaItemService, PedidoVendaModule, PedidoVendaService, PessoaEnderecoModule, PessoaEnderecoService, PessoaFisicaModule, PessoaFisicaService, PessoaJuridicaModule, PessoaJuridicaService, PessoaModule, PessoaService, PortariasComponent, PortariasDescritor, PortariasModule, ProdutoModule, ProdutoService, RecebimentoChegadaVeiculoOverride, RecebimentoContratoModule, RecebimentoContratoService, RoyaltyModule, RoyaltyService, SAM_SENIOR_HEADER, SafraModule, SafraService, SamSeniorModule, SnapshotComponent, SnapshotDescritor, TransportadoraModule, TransportadoraService, UnidadeMedidaModule, UnidadeMedidaService, VisitorListComponent, VisitorListModule, VisitorListService, VisualizarBalancaComponent, VisualizarBalancaDescritor, WmsModule, highlightLanguages, Service as ɵa, CustomStompConfig as ɵb, AgendaService as ɵba, EntityService$2 as ɵbb, EntityService$1 as ɵbc, UtilsMessageService as ɵbd, WmsIntegrationStrategyFactory as ɵbe, CpfCnpjFormatPipe as ɵbf, ExternalTenantService as ɵbg, RegisterDocumentModule as ɵbh, RegisterDocumentComponent as ɵbi, InsertKeyModule as ɵbj, InsertKeyComponent as ɵbk, IntegrationService$1 as ɵbl, RecebimentoFormComponent as ɵbm, DerivacaoService as ɵbn, NotaValidatorService as ɵbo, TransgeniaService as ɵbp, VerificaNotafiscal as ɵbq, BuildFormField as ɵbr, ExpedicaoFormComponent as ɵbs, ExpedicaoInfoComponent as ɵbt, RecebimentoInfoComponent as ɵbu, DevolucaoFormComponent as ɵbv, DevolucaoService as ɵbw, DevolucaoChegadaVeiculoOverride as ɵbx, RecebimentoOrdemCompraFormComponent as ɵby, OrdemCompraService as ɵbz, ViewImageComponent as ɵc, RecebimentoOrdemCompraService as ɵca, RecebimentoOrdemCompraChegadaVeiculoOverride as ɵcb, RecebimentoOrdemCompraInfoComponent as ɵcc, DevolucaoInfoComponent as ɵcd, ContratoFormComponent as ɵce, OrdemCompraFormComponent as ɵcf, ProcessoAvulsoFormComponent as ɵcg, ProcessoAvulsoService as ɵch, ProcessoAvulsoChegadaVeiculoOverride as ɵci, ProcessoAvulsoInfoComponent as ɵcj, LogIntegracaoDescritor as ɵck, LogIntegracaoComponent as ɵcl, LogIntegracaoService as ɵcm, DerivacaoModule as ɵcn, DevolucaoModule as ɵco, OrdemCompraModule as ɵcp, RecebimentoOrdemCompraModule as ɵcq, TransgeniaModule as ɵcr, ProcessoAvulsoModule as ɵcs, LogIntegracaoModule as ɵct, NotaFormModule as ɵcu, DirectivesModule as ɵcv, TrimDirective as ɵcw, NotaFormComponent as ɵcx, LogDescritor as ɵd, LogsComponent as ɵe, PortariasService as ɵf, EntradaComponent as ɵg, AgendasComponent as ɵh, ConfirmacaoComponent as ɵi, VisitedInfoDescritor as ɵj, VisitedInfoComponent as ɵk, VisitedInfoService as ɵl, SchedulingComponent as ɵm, LobbyService as ɵn, EntityService as ɵo, SchedulingService as ɵp, VisitanteComponent as ɵq, VisitanteFormComponent as ɵr, CredencialFormComponent as ɵs, FocusService as ɵt, FormWmsService as ɵu, DocumentGridModule as ɵv, DocumentGridComponent as ɵw, DocumentGridFacade as ɵx, DocumentService as ɵy, IntegrationService as ɵz };
14592
15078
  //# sourceMappingURL=seniorsistemas-yms-integration.js.map