@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
@@ -2142,13 +2142,13 @@ class EntityService {
2142
2142
  this.defaultCatch = this.defaultCatch.bind(this);
2143
2143
  }
2144
2144
  getListQueryParams(listParams) {
2145
- const { page = 0, size = 10, sort = [], filterQuery = "", displayFields = [] } = listParams;
2145
+ const { page = 0, size = 10, sort = [], filterQuery = "", displayFields = [], } = listParams;
2146
2146
  let params = new HttpParams();
2147
2147
  params = params.append("size", String(size));
2148
2148
  params = params.append("offset", String(page));
2149
2149
  if (sort && sort.length) {
2150
2150
  params = params.append("orderby", sort
2151
- .map(s => {
2151
+ .map((s) => {
2152
2152
  let order = "";
2153
2153
  if (s.order === 1)
2154
2154
  order = " asc";
@@ -2165,13 +2165,13 @@ class EntityService {
2165
2165
  return params;
2166
2166
  }
2167
2167
  getBodyParams(listParams) {
2168
- const { page = 0, size = 10, sort = [], filterQuery = "", displayFields = [] } = listParams;
2168
+ const { page = 0, size = 10, sort = [], filterQuery = "", displayFields = [], } = listParams;
2169
2169
  const bodyParams = {};
2170
2170
  bodyParams.size = size;
2171
2171
  bodyParams.offset = page;
2172
2172
  if (sort && sort.length) {
2173
2173
  bodyParams.orderBy = sort
2174
- .map(s => {
2174
+ .map((s) => {
2175
2175
  let order = "";
2176
2176
  if (s.order === 1)
2177
2177
  order = " asc";
@@ -2191,7 +2191,10 @@ class EntityService {
2191
2191
  return catchError((err) => {
2192
2192
  if (err) {
2193
2193
  const summary = err.status ? String(err.status) : "Error";
2194
- const detail = (err.error && err.error.message) || err.statusText || err.message || "Error";
2194
+ const detail = (err.error && err.error.message) ||
2195
+ err.statusText ||
2196
+ err.message ||
2197
+ "Error";
2195
2198
  this.messageService.add({
2196
2199
  severity: "error",
2197
2200
  summary,
@@ -2209,22 +2212,34 @@ class EntityService {
2209
2212
  return bodyParams;
2210
2213
  }
2211
2214
  list(listParams) {
2212
- return this.http.get(this.entityUrl, { params: this.getListQueryParams(listParams) }).pipe(this.defaultCatch());
2215
+ return this.http
2216
+ .get(this.entityUrl, { params: this.getListQueryParams(listParams) })
2217
+ .pipe(this.defaultCatch());
2213
2218
  }
2214
2219
  get(id, useCatch = true) {
2215
- return this.http.get(`${this.entityUrl}/${id}`).pipe(useCatch ? this.defaultCatch() : tap());
2220
+ return this.http
2221
+ .get(`${this.entityUrl}/${id}`)
2222
+ .pipe(useCatch ? this.defaultCatch() : tap());
2216
2223
  }
2217
2224
  insert(entity) {
2218
- return this.http.post(`${this.entityUrl}`, entity).pipe(this.defaultCatch());
2225
+ return this.http
2226
+ .post(`${this.entityUrl}`, entity)
2227
+ .pipe(this.defaultCatch());
2219
2228
  }
2220
2229
  update(id, entity, useCatch = true) {
2221
- return this.http.put(`${this.entityUrl}/${id}`, entity).pipe(useCatch ? this.defaultCatch() : tap());
2230
+ return this.http
2231
+ .put(`${this.entityUrl}/${id}`, entity)
2232
+ .pipe(useCatch ? this.defaultCatch() : tap());
2222
2233
  }
2223
2234
  delete(id) {
2224
- return this.http.delete(`${this.entityUrl}/${id}`).pipe(this.defaultCatch());
2235
+ return this.http
2236
+ .delete(`${this.entityUrl}/${id}`)
2237
+ .pipe(this.defaultCatch());
2225
2238
  }
2226
2239
  listCustomFilter(listParams, action) {
2227
- return this.http.post(`${this.actionsUrl}/${action}`, this.getBodyParams(listParams)).pipe(this.defaultCatch());
2240
+ return this.http
2241
+ .post(`${this.actionsUrl}/${action}`, this.getBodyParams(listParams))
2242
+ .pipe(this.defaultCatch());
2228
2243
  }
2229
2244
  }
2230
2245
 
@@ -2802,6 +2817,7 @@ var WmsSystem;
2802
2817
  WmsSystem["WIS"] = "WIS";
2803
2818
  WmsSystem["ALCIS"] = "ALCIS";
2804
2819
  WmsSystem["SENIOR_CONNECT"] = "SENIOR_CONNECT";
2820
+ WmsSystem["SENIOR_ERP"] = "SENIOR_ERP";
2805
2821
  WmsSystem["PARTNER"] = "PARTNER";
2806
2822
  WmsSystem["GENERIC"] = "GENERIC";
2807
2823
  })(WmsSystem || (WmsSystem = {}));
@@ -3028,23 +3044,24 @@ AgendaService = __decorate([
3028
3044
 
3029
3045
  let DocumentService = class DocumentService extends EntityService {
3030
3046
  constructor(http, messageService) {
3031
- super(http, messageService, 'yms_int/wms/entities/document', '');
3047
+ super(http, messageService, "yms_int/wms/entities/document", "");
3032
3048
  this.http = http;
3033
3049
  this.messageService = messageService;
3034
3050
  }
3035
3051
  findDocuments(input) {
3036
- return this.http.post('yms_int/wms/queries/findDocuments', input);
3052
+ return this.http.post("yms_int/wms/queries/findDocuments", input);
3037
3053
  }
3038
3054
  getSystemIntegration() {
3039
- return this.http.get('yms_int/wms/queries/getSystemIntegration');
3055
+ return this.http.get("yms_int/wms/queries/getSystemIntegration");
3040
3056
  }
3041
3057
  getYard(yardId) {
3042
- return this.http.get('yms/patio/entities/planta/' + yardId);
3058
+ return this.http.get("yms/patio/entities/planta/" + yardId);
3043
3059
  }
3044
3060
  };
3045
3061
  DocumentService = __decorate([
3046
3062
  Injectable(),
3047
- __metadata("design:paramtypes", [HttpClient, MessageService])
3063
+ __metadata("design:paramtypes", [HttpClient,
3064
+ MessageService])
3048
3065
  ], DocumentService);
3049
3066
 
3050
3067
  let IntegrationService = class IntegrationService {
@@ -3082,59 +3099,445 @@ var InvoiceCondition;
3082
3099
 
3083
3100
  function getInvoiceConditions(translate) {
3084
3101
  return [
3085
- { label: translate.instant("yms.int.wms_grid_document_invoice_no_way"), value: null },
3086
- { label: translate.instant("yms.int.wms_grid_document_invoice_condition_authorized"), value: InvoiceCondition.AUTHORIZED },
3087
- { label: translate.instant("yms.int.wms_grid_document_invoice_condition_manual_authorized"), value: InvoiceCondition.MANUAL_AUTHORIZED },
3088
- { label: translate.instant("yms.int.wms_grid_document_invoice_condition_partial_authorized"), value: InvoiceCondition.PARTIAL_AUTHORIZED },
3089
- { label: translate.instant("yms.int.wms_grid_document_invoice_condition_devolution"), value: InvoiceCondition.DEVOLUTION },
3090
- { label: translate.instant("yms.int.wms_grid_document_invoice_condition_rejected"), value: InvoiceCondition.REJECTED },
3091
- { label: translate.instant("yms.int.wms_grid_document_invoice_condition_divergence"), value: InvoiceCondition.DIVERGENCE },
3102
+ {
3103
+ label: translate.instant("yms.int.wms_grid_document_invoice_no_way"),
3104
+ value: null,
3105
+ },
3106
+ {
3107
+ label: translate.instant("yms.int.wms_grid_document_invoice_condition_authorized"),
3108
+ value: InvoiceCondition.AUTHORIZED,
3109
+ },
3110
+ {
3111
+ label: translate.instant("yms.int.wms_grid_document_invoice_condition_manual_authorized"),
3112
+ value: InvoiceCondition.MANUAL_AUTHORIZED,
3113
+ },
3114
+ {
3115
+ label: translate.instant("yms.int.wms_grid_document_invoice_condition_partial_authorized"),
3116
+ value: InvoiceCondition.PARTIAL_AUTHORIZED,
3117
+ },
3118
+ {
3119
+ label: translate.instant("yms.int.wms_grid_document_invoice_condition_devolution"),
3120
+ value: InvoiceCondition.DEVOLUTION,
3121
+ },
3122
+ {
3123
+ label: translate.instant("yms.int.wms_grid_document_invoice_condition_rejected"),
3124
+ value: InvoiceCondition.REJECTED,
3125
+ },
3126
+ {
3127
+ label: translate.instant("yms.int.wms_grid_document_invoice_condition_divergence"),
3128
+ value: InvoiceCondition.DIVERGENCE,
3129
+ },
3092
3130
  ];
3093
3131
  }
3094
3132
 
3095
- let DocumentGridComponent = class DocumentGridComponent {
3096
- constructor(translate, documentService, confirmationService, integrationService, agendaService, utils, wmsService) {
3133
+ var ColumnType;
3134
+ (function (ColumnType) {
3135
+ ColumnType["TEXT"] = "text";
3136
+ ColumnType["DROPDOWN"] = "dropdown";
3137
+ ColumnType["FORMATTED"] = "formatted";
3138
+ })(ColumnType || (ColumnType = {}));
3139
+
3140
+ class PartnerStrategy {
3141
+ getGridColumns(translate, isClienteExterno) {
3142
+ return [
3143
+ {
3144
+ field: "invoiceKey",
3145
+ header: translate.instant("yms.int.wms_register_document_invoice_key"),
3146
+ type: ColumnType.TEXT,
3147
+ },
3148
+ {
3149
+ field: "invoiceNumber",
3150
+ header: translate.instant("yms.int.wms_register_document_invoice_number"),
3151
+ type: ColumnType.TEXT,
3152
+ },
3153
+ {
3154
+ field: "invoiceSerialNumber",
3155
+ header: translate.instant("yms.int.wms_register_document_invoice_serial_number"),
3156
+ type: ColumnType.TEXT,
3157
+ },
3158
+ {
3159
+ field: "partnerName",
3160
+ header: translate.instant("yms.int.wms_register_document_partner_name"),
3161
+ type: ColumnType.TEXT,
3162
+ },
3163
+ {
3164
+ field: "partnerDocument",
3165
+ header: translate.instant("yms.int.wms_register_document_partner_document"),
3166
+ type: ColumnType.FORMATTED,
3167
+ pipe: "cpfCnpjFormat",
3168
+ },
3169
+ ];
3170
+ }
3171
+ updateDocumentKey(document) {
3172
+ return document.key || document.invoiceKey;
3173
+ }
3174
+ validateDocument(document, context) {
3175
+ // Partner não tem validações específicas no momento
3176
+ return { isValid: true };
3177
+ }
3178
+ getFilteredInvoiceConditions(invoiceCondition, allConditions) {
3179
+ // Partner não usa invoice conditions
3180
+ return allConditions;
3181
+ }
3182
+ supportsInvoiceCondition() {
3183
+ return false;
3184
+ }
3185
+ }
3186
+
3187
+ class SeniorConnectStrategy {
3188
+ getGridColumns(translate, isClienteExterno) {
3189
+ return [
3190
+ {
3191
+ field: "key",
3192
+ header: translate.instant("yms.int.wms_purchaseOrder"),
3193
+ type: ColumnType.TEXT,
3194
+ },
3195
+ {
3196
+ field: "partnerName",
3197
+ header: translate.instant("yms.int.wms_register_document_partner_name"),
3198
+ type: ColumnType.TEXT,
3199
+ },
3200
+ {
3201
+ field: "partnerDocument",
3202
+ header: translate.instant("yms.int.wms_register_document_partner_document"),
3203
+ type: ColumnType.FORMATTED,
3204
+ pipe: "cpfCnpjFormat",
3205
+ },
3206
+ {
3207
+ field: "logistcUnitName",
3208
+ header: translate.instant("yms.int.wms_register_document_logistc_unit_name"),
3209
+ type: ColumnType.TEXT,
3210
+ },
3211
+ {
3212
+ field: "logistcUnitDocument",
3213
+ header: translate.instant("yms.int.wms_register_document_logistc_unit_document"),
3214
+ type: ColumnType.TEXT,
3215
+ },
3216
+ ];
3217
+ }
3218
+ updateDocumentKey(document) {
3219
+ return document.key || document.invoiceKey;
3220
+ }
3221
+ validateDocument(document, context) {
3222
+ const { yard, schedule } = context;
3223
+ if (!yard.codigo) {
3224
+ return {
3225
+ isValid: false,
3226
+ errorMessageKey: "yms.int.yard_code_not_found_warning_description",
3227
+ };
3228
+ }
3229
+ if (document.logistcUnitDocument !== yard.codigo) {
3230
+ return {
3231
+ isValid: false,
3232
+ errorMessageKey: "yms.int.document_yard_mismatch_agenda_warning_description",
3233
+ };
3234
+ }
3235
+ if (!schedule.externalTenant) {
3236
+ return {
3237
+ isValid: false,
3238
+ errorMessageKey: "yms.int.partner_not_informed_agenda_warning_description",
3239
+ };
3240
+ }
3241
+ if (document.partnerDocument !== schedule.externalTenant.cnpj) {
3242
+ return {
3243
+ isValid: false,
3244
+ errorMessageKey: "yms.int.partner_differs_from_agenda_warning_description",
3245
+ };
3246
+ }
3247
+ return { isValid: true };
3248
+ }
3249
+ getFilteredInvoiceConditions(invoiceCondition, allConditions) {
3250
+ // Senior Connect não usa invoice conditions da mesma forma
3251
+ return allConditions;
3252
+ }
3253
+ supportsInvoiceCondition() {
3254
+ return false;
3255
+ }
3256
+ }
3257
+
3258
+ class SiltStrategy {
3259
+ getGridColumns(translate, isClienteExterno) {
3260
+ const columns = [
3261
+ {
3262
+ field: "invoiceKey",
3263
+ header: translate.instant("yms.int.wms_register_document_invoice_key"),
3264
+ type: ColumnType.TEXT,
3265
+ },
3266
+ {
3267
+ field: "invoiceNumber",
3268
+ header: translate.instant("yms.int.wms_register_document_invoice_number"),
3269
+ type: ColumnType.TEXT,
3270
+ },
3271
+ {
3272
+ field: "invoiceSerialNumber",
3273
+ header: translate.instant("yms.int.wms_register_document_invoice_serial_number"),
3274
+ type: ColumnType.TEXT,
3275
+ },
3276
+ {
3277
+ field: "partnerName",
3278
+ header: translate.instant("yms.int.wms_register_document_partner_name"),
3279
+ type: ColumnType.TEXT,
3280
+ },
3281
+ {
3282
+ field: "partnerDocument",
3283
+ header: translate.instant("yms.int.wms_register_document_partner_document"),
3284
+ type: ColumnType.FORMATTED,
3285
+ pipe: "cpfCnpjFormat",
3286
+ },
3287
+ {
3288
+ field: "logistcUnitName",
3289
+ header: translate.instant("yms.int.wms_register_document_logistc_unit_name"),
3290
+ type: ColumnType.TEXT,
3291
+ },
3292
+ {
3293
+ field: "logistcUnitDocument",
3294
+ header: translate.instant("yms.int.wms_register_document_logistc_unit_document"),
3295
+ type: ColumnType.TEXT,
3296
+ },
3297
+ {
3298
+ field: "ownerName",
3299
+ header: translate.instant("yms.int.wms_register_document_owner_name"),
3300
+ type: ColumnType.TEXT,
3301
+ },
3302
+ {
3303
+ field: "ownerDocument",
3304
+ header: translate.instant("yms.int.wms_register_document_owner_document"),
3305
+ type: ColumnType.TEXT,
3306
+ },
3307
+ ];
3308
+ if (!isClienteExterno) {
3309
+ columns.push({
3310
+ field: "invoiceCondition",
3311
+ header: translate.instant("yms.int.wms_grid_document_invoice_condition"),
3312
+ type: ColumnType.DROPDOWN,
3313
+ editable: true,
3314
+ });
3315
+ }
3316
+ return columns;
3317
+ }
3318
+ updateDocumentKey(document) {
3319
+ return document.key || document.invoiceKey;
3320
+ }
3321
+ validateDocument(document, context) {
3322
+ // SILT não tem validações específicas no momento
3323
+ return { isValid: true };
3324
+ }
3325
+ getFilteredInvoiceConditions(invoiceCondition, allConditions) {
3326
+ if (invoiceCondition === InvoiceCondition.AUTHORIZED) {
3327
+ return allConditions.filter((cond) => cond.value === InvoiceCondition.AUTHORIZED);
3328
+ }
3329
+ return allConditions.filter((cond) => cond.value !== InvoiceCondition.AUTHORIZED);
3330
+ }
3331
+ supportsInvoiceCondition() {
3332
+ return true;
3333
+ }
3334
+ }
3335
+
3336
+ class WisStrategy {
3337
+ getGridColumns(translate, isClienteExterno) {
3338
+ const columns = [
3339
+ {
3340
+ field: "invoiceNumber",
3341
+ header: translate.instant("yms.int.wms_register_document_invoice_number"),
3342
+ type: ColumnType.TEXT,
3343
+ },
3344
+ {
3345
+ field: "invoiceSerialNumber",
3346
+ header: translate.instant("yms.int.wms_register_document_invoice_serial_number"),
3347
+ type: ColumnType.TEXT,
3348
+ },
3349
+ {
3350
+ field: "partnerName",
3351
+ header: translate.instant("yms.int.wms_register_document_partner_name"),
3352
+ type: ColumnType.TEXT,
3353
+ },
3354
+ {
3355
+ field: "partnerDocument",
3356
+ header: translate.instant("yms.int.wms_register_document_partner_document"),
3357
+ type: ColumnType.FORMATTED,
3358
+ pipe: "cpfCnpjFormat",
3359
+ },
3360
+ {
3361
+ field: "logistcUnitName",
3362
+ header: translate.instant("yms.int.wms_register_document_logistc_unit_name"),
3363
+ type: ColumnType.TEXT,
3364
+ },
3365
+ {
3366
+ field: "logistcUnitDocument",
3367
+ header: translate.instant("yms.int.wms_register_document_logistc_unit_document"),
3368
+ type: ColumnType.TEXT,
3369
+ },
3370
+ ];
3371
+ if (!isClienteExterno) {
3372
+ columns.push({
3373
+ field: "invoiceCondition",
3374
+ header: translate.instant("yms.int.wms_grid_document_invoice_condition"),
3375
+ type: ColumnType.DROPDOWN,
3376
+ editable: true,
3377
+ });
3378
+ }
3379
+ return columns;
3380
+ }
3381
+ updateDocumentKey(document) {
3382
+ if (!document.key) {
3383
+ document.key = document.invoiceKey;
3384
+ }
3385
+ return `${document.invoiceNumber}:${document.invoiceSerialNumber}:${document.partnerDocument}`;
3386
+ }
3387
+ validateDocument(document, context) {
3388
+ // WIS não tem validações específicas no momento
3389
+ return { isValid: true };
3390
+ }
3391
+ getFilteredInvoiceConditions(invoiceCondition, allConditions) {
3392
+ if (invoiceCondition === InvoiceCondition.AUTHORIZED) {
3393
+ return allConditions.filter((cond) => cond.value === InvoiceCondition.AUTHORIZED);
3394
+ }
3395
+ return allConditions.filter((cond) => cond.value !== InvoiceCondition.AUTHORIZED);
3396
+ }
3397
+ supportsInvoiceCondition() {
3398
+ return true;
3399
+ }
3400
+ }
3401
+
3402
+ class SeniorERPStrategy {
3403
+ getGridColumns(translate, isClienteExterno) {
3404
+ const columns = [
3405
+ {
3406
+ field: "invoiceKey",
3407
+ header: translate.instant("yms.int.wms_register_document_invoice_key"),
3408
+ type: ColumnType.TEXT,
3409
+ },
3410
+ {
3411
+ field: "invoiceNumber",
3412
+ header: translate.instant("yms.int.wms_register_document_invoice_number"),
3413
+ type: ColumnType.TEXT,
3414
+ },
3415
+ {
3416
+ field: "invoiceSerialNumber",
3417
+ header: translate.instant("yms.int.wms_register_document_invoice_serial_number"),
3418
+ type: ColumnType.TEXT,
3419
+ },
3420
+ {
3421
+ field: "partnerName",
3422
+ header: translate.instant("yms.int.wms_register_document_partner_name"),
3423
+ type: ColumnType.TEXT,
3424
+ },
3425
+ {
3426
+ field: "partnerDocument",
3427
+ header: translate.instant("yms.int.wms_register_document_partner_document_cod_erp"),
3428
+ type: ColumnType.TEXT,
3429
+ },
3430
+ {
3431
+ field: "logistcUnitName",
3432
+ header: translate.instant("yms.int.wms_register_document_logistc_unit_name"),
3433
+ type: ColumnType.TEXT,
3434
+ },
3435
+ {
3436
+ field: "logistcUnitDocument",
3437
+ header: translate.instant("yms.int.wms_register_document_logistc_unit_document_cod_erp"),
3438
+ type: ColumnType.TEXT,
3439
+ },
3440
+ ];
3441
+ return columns;
3442
+ }
3443
+ updateDocumentKey(document) {
3444
+ return document.key || document.invoiceKey;
3445
+ }
3446
+ validateDocument(document, context) {
3447
+ return { isValid: true };
3448
+ }
3449
+ getFilteredInvoiceConditions(invoiceCondition, allConditions) {
3450
+ return allConditions;
3451
+ }
3452
+ supportsInvoiceCondition() {
3453
+ return false;
3454
+ }
3455
+ }
3456
+
3457
+ let WmsIntegrationStrategyFactory = class WmsIntegrationStrategyFactory {
3458
+ constructor() {
3459
+ this.strategies = new Map([
3460
+ [WmsSystem.SENIOR_CONNECT, new SeniorConnectStrategy()],
3461
+ [WmsSystem.WIS, new WisStrategy()],
3462
+ [WmsSystem.SENIOR, new SiltStrategy()],
3463
+ [WmsSystem.SENIOR_ERP, new SeniorERPStrategy()],
3464
+ [WmsSystem.PARTNER, new PartnerStrategy()],
3465
+ ]);
3466
+ }
3467
+ getStrategy(wmsSystem) {
3468
+ return this.strategies.get(wmsSystem) || null;
3469
+ }
3470
+ hasStrategy(wmsSystem) {
3471
+ return this.strategies.has(wmsSystem);
3472
+ }
3473
+ };
3474
+ WmsIntegrationStrategyFactory = __decorate([
3475
+ Injectable(),
3476
+ __metadata("design:paramtypes", [])
3477
+ ], WmsIntegrationStrategyFactory);
3478
+
3479
+ let DocumentGridFacade = class DocumentGridFacade {
3480
+ constructor(translate, documentService, integrationService, agendaService, utils, wmsService, strategyFactory) {
3097
3481
  this.translate = translate;
3098
3482
  this.documentService = documentService;
3099
- this.confirmationService = confirmationService;
3100
3483
  this.integrationService = integrationService;
3101
3484
  this.agendaService = agendaService;
3102
3485
  this.utils = utils;
3103
3486
  this.wmsService = wmsService;
3104
- this.viewDocument = new EventEmitter();
3105
- this.gridData = [];
3106
- this.enableButtonIsClienteExterno = true;
3107
- this.invoiceConditions = getInvoiceConditions(this.translate);
3108
- this.summary = "yms.int.wms_saved_document_message_title";
3487
+ this.strategyFactory = strategyFactory;
3109
3488
  this.ngUnsubscribe = new Subject();
3110
- this.selection = [];
3489
+ this.summary = "yms.int.wms_saved_document_message_title";
3490
+ this.currentStrategy = null;
3491
+ // State subjects
3492
+ this.stateSubject = new BehaviorSubject({
3493
+ gridData: [],
3494
+ selection: [],
3495
+ gridColumns: [],
3496
+ documentTotalRecords: 0,
3497
+ loading: false,
3498
+ disabled: true,
3499
+ showInvoiceSearchModal: false,
3500
+ showAddInvoiceModal: false,
3501
+ edit: false,
3502
+ processType: null,
3503
+ wmsSystem: null,
3504
+ isClienteExterno: false,
3505
+ enableButtonIsClienteExterno: true,
3506
+ });
3507
+ this.state$ = this.stateSubject.asObservable();
3508
+ this.invoiceConditions = getInvoiceConditions(this.translate);
3111
3509
  }
3112
- getFilteredInvoiceConditions(invoiceConditions) {
3113
- if (invoiceConditions === InvoiceCondition.AUTHORIZED) {
3114
- return this.invoiceConditions.filter(cond => cond.value === InvoiceCondition.AUTHORIZED);
3115
- }
3116
- else {
3117
- return this.invoiceConditions.filter(cond => cond.value !== InvoiceCondition.AUTHORIZED);
3118
- }
3510
+ // Getters para acesso direto ao estado atual
3511
+ get state() {
3512
+ return this.stateSubject.getValue();
3119
3513
  }
3120
- ngOnInit() {
3514
+ // Inicialização
3515
+ init(agenda, wmsSystem) {
3516
+ this.agenda = agenda;
3517
+ this.updateState({ wmsSystem });
3121
3518
  this.verifyClienteExterno();
3122
3519
  this.getProcessTypeByScheduling();
3123
3520
  this.listDocuments(false);
3124
- this.wmsService.getSystemIntegration()
3125
- .subscribe(({ system }) => {
3126
- this.wmsSystem = system;
3521
+ this.loadSystemIntegration();
3522
+ }
3523
+ loadSystemIntegration() {
3524
+ this.wmsService.getSystemIntegration().subscribe(({ system }) => {
3525
+ this.updateState({ wmsSystem: system });
3526
+ this.updateStrategy(system);
3127
3527
  if (this.isWmsSeniorConnect()) {
3128
3528
  this.getYard();
3129
3529
  this.getSchedule();
3130
3530
  }
3131
3531
  });
3132
3532
  }
3533
+ updateStrategy(wmsSystem) {
3534
+ this.currentStrategy = this.strategyFactory.getStrategy(wmsSystem);
3535
+ this.updateGridColumns();
3536
+ }
3133
3537
  getYard() {
3134
- this.documentService.getYard(this.agenda.planta.id)
3135
- .pipe(catchError(err => {
3136
- return throwError(err);
3137
- }))
3538
+ this.documentService
3539
+ .getYard(this.agenda.planta.id)
3540
+ .pipe(catchError((err) => throwError(err)))
3138
3541
  .subscribe((content) => {
3139
3542
  this.yard = content;
3140
3543
  });
@@ -3144,25 +3547,81 @@ let DocumentGridComponent = class DocumentGridComponent {
3144
3547
  this.schedule = this.agenda;
3145
3548
  return;
3146
3549
  }
3147
- this.agendaService.get(this.agenda.id)
3148
- .pipe(catchError(err => {
3149
- return throwError(err);
3150
- }))
3550
+ this.agendaService
3551
+ .get(this.agenda.id)
3552
+ .pipe(catchError((err) => throwError(err)))
3151
3553
  .subscribe((content) => {
3152
3554
  this.schedule = content;
3153
3555
  });
3154
3556
  }
3155
3557
  verifyClienteExterno() {
3156
- this.agendaService.isClienteExterno()
3558
+ this.agendaService
3559
+ .isClienteExterno()
3157
3560
  .subscribe((result) => {
3158
- this.isClienteExterno = result.isClienteExterno;
3159
- this.gridColumns = this.getGridColumns();
3561
+ this.updateState({ isClienteExterno: result.isClienteExterno });
3562
+ this.updateGridColumns();
3160
3563
  this.cantEditStatus();
3161
3564
  });
3162
3565
  }
3163
3566
  getProcessTypeByScheduling() {
3164
- this.integrationService.getProcessTypeByScheduling(this.agenda.tipoAgendamento.id)
3165
- .subscribe((result) => this.processType = result.processType);
3567
+ this.integrationService
3568
+ .getProcessTypeByScheduling(this.agenda.tipoAgendamento.id)
3569
+ .subscribe((result) => {
3570
+ this.updateState({ processType: result.processType });
3571
+ });
3572
+ }
3573
+ cantEditStatus() {
3574
+ const cantEditStatus = [
3575
+ "CANCELADO",
3576
+ "EM_EXECUCAO",
3577
+ "CONCLUIDO",
3578
+ "AGUARDANDO_POR_VALIDACAO",
3579
+ ].includes(this.agenda.status.toString());
3580
+ if (cantEditStatus) {
3581
+ this.updateState({ enableButtonIsClienteExterno: false });
3582
+ }
3583
+ }
3584
+ // Ações
3585
+ openInvoiceKeyModal() {
3586
+ this.updateState({
3587
+ selection: [],
3588
+ showInvoiceSearchModal: true,
3589
+ });
3590
+ }
3591
+ openDocumentRegisterModal() {
3592
+ this.updateState({
3593
+ selection: [],
3594
+ edit: true,
3595
+ showAddInvoiceModal: true,
3596
+ });
3597
+ }
3598
+ closeInvoiceSearchModal() {
3599
+ this.updateState({ showInvoiceSearchModal: false });
3600
+ }
3601
+ closeAddInvoiceModal() {
3602
+ this.updateState({ showAddInvoiceModal: false });
3603
+ }
3604
+ viewDocument() {
3605
+ this.updateState({
3606
+ showAddInvoiceModal: true,
3607
+ edit: false,
3608
+ });
3609
+ return this.state.selection[0];
3610
+ }
3611
+ setSelection(selection) {
3612
+ this.updateState({ selection });
3613
+ }
3614
+ addToSelection(document) {
3615
+ this.updateState({ selection: [document] });
3616
+ }
3617
+ setDisabled(disabled) {
3618
+ this.updateState({ disabled });
3619
+ }
3620
+ setShowInvoiceSearchModal(visible) {
3621
+ this.updateState({ showInvoiceSearchModal: visible });
3622
+ }
3623
+ setShowAddInvoiceModal(visible) {
3624
+ this.updateState({ showAddInvoiceModal: visible });
3166
3625
  }
3167
3626
  onChangeDocument(document) {
3168
3627
  if (!this.hasFilledValues(document)) {
@@ -3170,16 +3629,19 @@ let DocumentGridComponent = class DocumentGridComponent {
3170
3629
  return;
3171
3630
  }
3172
3631
  this.assignKeys(document);
3173
- const duplicateDocument = this.gridData.find(gridData => gridData.key === document.key);
3632
+ const duplicateDocument = this.state.gridData.find((gridData) => gridData.key === document.key);
3174
3633
  if (duplicateDocument) {
3175
3634
  this.utils.message("error", "yms.int.wms_error_register_document_message_title", "yms.int.wms_error_register_document_message_description");
3176
3635
  return;
3177
3636
  }
3178
- this.gridData.push(document);
3179
- this.disabled = false;
3637
+ const newGridData = [...this.state.gridData, document];
3638
+ this.updateState({
3639
+ gridData: newGridData,
3640
+ disabled: false,
3641
+ showAddInvoiceModal: false,
3642
+ showInvoiceSearchModal: false,
3643
+ });
3180
3644
  this.utils.message("success", this.summary, "yms.int.wms_success_message_description");
3181
- this.visibleDocumentRegister = false;
3182
- this.visibleInvoiceKey = false;
3183
3645
  }
3184
3646
  assignKeys(document) {
3185
3647
  if (document.id === undefined) {
@@ -3187,68 +3649,20 @@ let DocumentGridComponent = class DocumentGridComponent {
3187
3649
  document.schedulingId = this.agenda.id;
3188
3650
  }
3189
3651
  if (document.key === undefined || document.key === null) {
3190
- document.key = document.invoiceKey;
3191
- if (this.isWmsWIS()) {
3192
- document.key = `${document.invoiceNumber}:${document.invoiceSerialNumber}:${document.partnerDocument}`;
3193
- }
3652
+ document.key =
3653
+ this.currentStrategy.updateDocumentKey(document) ||
3654
+ document.invoiceKey;
3194
3655
  }
3195
3656
  }
3196
3657
  }
3197
3658
  hasFilledValues(document) {
3198
3659
  const formValues = Object.values(document);
3199
- return formValues.some(value => value !== null && value !== '');
3200
- }
3201
- cantEditStatus() {
3202
- const cantEditStatus = [
3203
- 'CANCELADO',
3204
- 'EM_EXECUCAO',
3205
- 'CONCLUIDO',
3206
- 'AGUARDANDO_POR_VALIDACAO'
3207
- ].includes(this.agenda.status.toString());
3208
- if (cantEditStatus) {
3209
- this.enableButtonIsClienteExterno = false;
3210
- }
3211
- }
3212
- getActions() {
3213
- return [
3214
- {
3215
- disabled: this.checkWmsSystemInvalid(),
3216
- label: this.translate.instant("yms.int.wms_search"),
3217
- command: () => {
3218
- this.selection = [];
3219
- this.visibleInvoiceKey = true;
3220
- },
3221
- icon: "fa fa-search"
3222
- },
3223
- {
3224
- disabled: this.checkWmsSystemInvalid(),
3225
- label: this.translate.instant("yms.int.wms_add_document_register"),
3226
- command: () => {
3227
- this.selection = [];
3228
- this.edit = true;
3229
- this.visibleDocumentRegister = true;
3230
- },
3231
- icon: "fas fa-pen-square"
3232
- }
3233
- ];
3234
- }
3235
- checkWmsSystemInvalid() {
3236
- if (this.wmsSystem && this.wmsSystem === WmsSystem.NONE) {
3237
- return true;
3238
- }
3239
- return false;
3240
- }
3241
- getProp(obj, path) {
3242
- return path.split(".").reduce((result, prop) => (result[prop] === undefined ? "" : result[prop]), obj);
3243
- }
3244
- view() {
3245
- this.viewDocument.emit(this.selection[0]);
3246
- this.visibleDocumentRegister = true;
3247
- this.edit = false;
3660
+ return formValues.some((value) => value !== null && value !== "");
3248
3661
  }
3249
3662
  save() {
3250
- if (this.gridData.length > 0) {
3251
- this.gridData.forEach(data => {
3663
+ const { gridData } = this.state;
3664
+ if (gridData.length > 0) {
3665
+ gridData.forEach((data) => {
3252
3666
  if (!data.id) {
3253
3667
  if (!data.schedulingId) {
3254
3668
  data.schedulingId = this.agenda.id;
@@ -3257,12 +3671,12 @@ let DocumentGridComponent = class DocumentGridComponent {
3257
3671
  this.documentService.insert(data).subscribe(() => {
3258
3672
  this.sucessMessage();
3259
3673
  });
3260
- this.disabled = true;
3674
+ this.updateState({ disabled: true });
3261
3675
  }
3262
3676
  else {
3263
3677
  this.documentService.update(data.id, data).subscribe(() => {
3264
3678
  this.sucessMessage();
3265
- this.disabled = true;
3679
+ this.updateState({ disabled: true });
3266
3680
  });
3267
3681
  }
3268
3682
  });
@@ -3270,185 +3684,217 @@ let DocumentGridComponent = class DocumentGridComponent {
3270
3684
  }
3271
3685
  }
3272
3686
  updateKeyByWms(data) {
3273
- if (!data.key) {
3274
- data.key = data.invoiceKey;
3275
- }
3276
- if (this.wmsSystem === WmsSystem.WIS) {
3277
- data.key = `${data.invoiceNumber}:${data.invoiceSerialNumber}:${data.partnerDocument}`;
3278
- }
3279
- return data.key;
3687
+ return this.currentStrategy.updateDocumentKey(data) || data.invoiceKey;
3280
3688
  }
3281
- onDelete() {
3282
- this.confirmationService.confirm({
3283
- message: this.translate.instant("delete_confirmation_message"),
3284
- header: this.translate.instant("delete_confirmation_title"),
3285
- accept: () => {
3286
- this.removeDocumentIfIdUndfined();
3287
- if (this.selection.length < 1) {
3288
- return null;
3289
- }
3290
- return forkJoin(this.selection.map(document => this.documentService.delete(document.id)))
3291
- .pipe(takeUntil(this.ngUnsubscribe))
3292
- .subscribe(() => {
3293
- this.utils.message("success", "deleted_message_title", "deleted_message_content");
3294
- this.listDocuments(true);
3295
- });
3296
- }
3689
+ deleteSelectedDocuments() {
3690
+ this.removeDocumentIfIdUndefined();
3691
+ const { selection } = this.state;
3692
+ if (selection.length < 1) {
3693
+ return;
3694
+ }
3695
+ forkJoin(selection.map((document) => this.documentService.delete(document.id)))
3696
+ .pipe(takeUntil(this.ngUnsubscribe))
3697
+ .subscribe(() => {
3698
+ this.utils.message("success", "yms.patio.warn_deleted_message_title", "yms.patio.deleted_message_detail");
3699
+ this.listDocuments(true);
3297
3700
  });
3298
3701
  }
3299
- removeDocumentIfIdUndfined() {
3300
- this.selection.forEach((value, index) => {
3702
+ removeDocumentIfIdUndefined() {
3703
+ const { selection, gridData } = this.state;
3704
+ const newSelection = [...selection];
3705
+ const newGridData = [...gridData];
3706
+ selection.forEach((value, index) => {
3301
3707
  if (!value.id) {
3302
- const indexGridData = this.gridData.findIndex(document => document.key === value.key);
3303
- this.gridData.splice(indexGridData, 1);
3304
- this.selection.splice(index, 1);
3708
+ const indexGridData = newGridData.findIndex((document) => document.key === value.key);
3709
+ newGridData.splice(indexGridData, 1);
3710
+ newSelection.splice(index, 1);
3305
3711
  }
3306
3712
  });
3713
+ this.updateState({ gridData: newGridData, selection: newSelection });
3307
3714
  }
3308
3715
  notSavedDocuments() {
3309
- return this.gridData.some(document => !document.id);
3716
+ return this.state.gridData.some((document) => !document.id);
3310
3717
  }
3311
3718
  listDocuments(isDelete) {
3312
- this.documentService.list({
3719
+ this.documentService
3720
+ .list({
3313
3721
  filterQuery: `schedulingId eq '${this.agenda.id}'`,
3314
- size: 100
3722
+ size: 100,
3315
3723
  })
3316
3724
  .subscribe((contents) => {
3317
- this.gridData = isDelete ? this.gridData.filter(item => !item.id) : [];
3725
+ let newGridData = isDelete
3726
+ ? this.state.gridData.filter((item) => !item.id)
3727
+ : [];
3318
3728
  if (contents.totalElements > 0) {
3319
- this.gridData.push(...contents.contents);
3320
- this.documentTotalRecords = contents.totalElements;
3321
- }
3322
- else {
3323
- this.documentTotalRecords = this.gridData.length;
3324
- }
3325
- const hasElementWithoutId = this.gridData.some(item => !item.id);
3326
- this.disabled = !hasElementWithoutId;
3327
- this.loading = false;
3328
- this.selection = [];
3729
+ newGridData = [...newGridData, ...contents.contents];
3730
+ }
3731
+ const documentTotalRecords = contents.totalElements > 0
3732
+ ? contents.totalElements
3733
+ : newGridData.length;
3734
+ const hasElementWithoutId = newGridData.some((item) => !item.id);
3735
+ this.updateState({
3736
+ gridData: newGridData,
3737
+ disabled: !hasElementWithoutId,
3738
+ loading: false,
3739
+ selection: [],
3740
+ documentTotalRecords,
3741
+ });
3329
3742
  });
3330
3743
  }
3331
- getGridColumns() {
3332
- let result;
3333
- switch (this.wmsSystem) {
3334
- case WmsSystem.SENIOR_CONNECT:
3335
- result = this.wmsSeniorConnectIntegration();
3336
- break;
3337
- case WmsSystem.WIS:
3338
- result = this.wmsWisIntegration();
3339
- break;
3340
- case WmsSystem.SENIOR:
3341
- result = this.wmsSiltIntegration();
3342
- break;
3343
- case WmsSystem.PARTNER:
3344
- result = this.wmsPartnerIntegration();
3345
- break;
3346
- default:
3347
- result = [];
3348
- }
3349
- return result;
3350
- }
3351
- wmsPartnerIntegration() {
3352
- const columns = [
3353
- { field: "invoiceKey", header: this.translate.instant("yms.int.wms_register_document_invoice_key") },
3354
- { field: "invoiceNumber", header: this.translate.instant("yms.int.wms_register_document_invoice_number") },
3355
- { field: "invoiceSerialNumber", header: this.translate.instant("yms.int.wms_register_document_invoice_serial_number") },
3356
- ...this.getColumnPartner()
3357
- ];
3358
- return columns;
3359
- }
3360
- wmsSeniorConnectIntegration() {
3361
- const columns = [
3362
- { field: "key", header: this.translate.instant("yms.int.wms_purchaseOrder") },
3363
- ...this.getColumnPartner(),
3364
- ...this.getColumnlogistcUnit()
3365
- ];
3366
- return columns;
3367
- }
3368
- wmsWisIntegration() {
3369
- const columns = [
3370
- ...this.getColumnInvoiceAndlogistcUnit(),
3371
- ];
3372
- this.addInvoiceSituationIfNotClienteExterno(columns);
3373
- return columns;
3374
- }
3375
- wmsSiltIntegration() {
3376
- const columns = [
3377
- { field: "invoiceKey", header: this.translate.instant("yms.int.wms_register_document_invoice_key") },
3378
- ...this.getColumnInvoiceAndlogistcUnit(),
3379
- { field: "ownerName", header: this.translate.instant("yms.int.wms_register_document_owner_name") },
3380
- { field: "ownerDocument", header: this.translate.instant("yms.int.wms_register_document_owner_document") },
3381
- ];
3382
- this.addInvoiceSituationIfNotClienteExterno(columns);
3383
- return columns;
3384
- }
3385
- getColumninvoiceCondition() {
3386
- return { field: "invoiceCondition", header: this.translate.instant("yms.int.wms_grid_document_invoice_condition") };
3387
- }
3388
- getColumnInvoiceAndlogistcUnit() {
3744
+ // Menu Actions
3745
+ getActions() {
3389
3746
  return [
3390
- { field: "invoiceNumber", header: this.translate.instant("yms.int.wms_register_document_invoice_number") },
3391
- { field: "invoiceSerialNumber", header: this.translate.instant("yms.int.wms_register_document_invoice_serial_number") },
3392
- ...this.getColumnPartner(),
3393
- ...this.getColumnlogistcUnit()
3747
+ {
3748
+ disabled: this.checkWmsSystemInvalid(),
3749
+ label: this.translate.instant("yms.int.wms_search"),
3750
+ command: () => this.openInvoiceKeyModal(),
3751
+ icon: "fa fa-search",
3752
+ },
3753
+ {
3754
+ disabled: this.checkWmsSystemInvalid(),
3755
+ label: this.translate.instant("yms.int.wms_add_document_register"),
3756
+ command: () => this.openDocumentRegisterModal(),
3757
+ icon: "fas fa-pen-square",
3758
+ },
3394
3759
  ];
3395
3760
  }
3396
- getColumnPartner() {
3397
- return [
3398
- { field: "partnerName", header: this.translate.instant("yms.int.wms_register_document_partner_name") },
3399
- { field: "partnerDocument", header: this.translate.instant("yms.int.wms_register_document_partner_document") },
3400
- ];
3761
+ checkWmsSystemInvalid() {
3762
+ const { wmsSystem } = this.state;
3763
+ return wmsSystem && wmsSystem === WmsSystem.NONE;
3401
3764
  }
3402
- getColumnlogistcUnit() {
3403
- return [
3404
- { field: "logistcUnitName", header: this.translate.instant("yms.int.wms_register_document_logistc_unit_name") },
3405
- { field: "logistcUnitDocument", header: this.translate.instant("yms.int.wms_register_document_logistc_unit_document") },
3406
- ];
3765
+ // Grid columns
3766
+ updateGridColumns() {
3767
+ const gridColumns = this.getGridColumns();
3768
+ this.updateState({ gridColumns });
3407
3769
  }
3408
- addInvoiceSituationIfNotClienteExterno(columns) {
3409
- if (!this.isClienteExterno) {
3410
- columns.push(this.getColumninvoiceCondition());
3770
+ getGridColumns() {
3771
+ if (!this.currentStrategy) {
3772
+ return [];
3411
3773
  }
3774
+ return this.currentStrategy.getGridColumns(this.translate, this.state.isClienteExterno);
3412
3775
  }
3776
+ // WMS Type checks
3413
3777
  isWmsSeniorConnect() {
3414
- return this.wmsSystem === WmsSystem.SENIOR_CONNECT;
3778
+ return this.state.wmsSystem === WmsSystem.SENIOR_CONNECT;
3415
3779
  }
3416
3780
  isWmsWIS() {
3417
- return this.wmsSystem === WmsSystem.WIS;
3781
+ return this.state.wmsSystem === WmsSystem.WIS;
3418
3782
  }
3419
3783
  isWmsSilt() {
3420
- return this.wmsSystem === WmsSystem.SENIOR;
3784
+ return this.state.wmsSystem === WmsSystem.SENIOR;
3421
3785
  }
3422
3786
  isWmsPartner() {
3423
- return this.wmsSystem === WmsSystem.PARTNER;
3424
- }
3425
- sucessMessage() {
3426
- return this.utils.message("success", this.summary, "saved_message_content");
3787
+ return this.state.wmsSystem === WmsSystem.PARTNER;
3427
3788
  }
3789
+ // Validation
3428
3790
  validateDocument(document) {
3429
- if (this.isWmsSeniorConnect()) {
3430
- if (!this.yard.codigo) {
3431
- this.buildMessage("yms.int.yard_code_not_found_warning_description");
3432
- return false;
3433
- }
3434
- if (document.logistcUnitDocument !== this.yard.codigo) {
3435
- this.buildMessage("yms.int.document_yard_mismatch_agenda_warning_description");
3436
- return false;
3437
- }
3438
- if (!this.schedule.externalTenant) {
3439
- this.buildMessage("yms.int.partner_not_informed_agenda_warning_description");
3440
- return false;
3441
- }
3442
- if (document.partnerDocument !== this.schedule.externalTenant.cnpj) {
3443
- this.buildMessage("yms.int.partner_differs_from_agenda_warning_description");
3444
- return false;
3445
- }
3791
+ if (!this.currentStrategy) {
3792
+ return true;
3446
3793
  }
3447
- return true;
3794
+ const result = this.currentStrategy.validateDocument(document, {
3795
+ yard: this.yard,
3796
+ schedule: this.schedule,
3797
+ agenda: this.agenda,
3798
+ });
3799
+ if (!result.isValid && result.errorMessageKey) {
3800
+ this.buildMessage(result.errorMessageKey);
3801
+ }
3802
+ return result.isValid;
3803
+ }
3804
+ // Invoice conditions
3805
+ getFilteredInvoiceConditions(invoiceCondition) {
3806
+ if (!this.currentStrategy) {
3807
+ return this.invoiceConditions;
3808
+ }
3809
+ return this.currentStrategy.getFilteredInvoiceConditions(invoiceCondition, this.invoiceConditions);
3810
+ }
3811
+ supportsInvoiceCondition() {
3812
+ return this.currentStrategy.supportsInvoiceCondition() || false;
3813
+ }
3814
+ // Helpers
3815
+ getProp(obj, path) {
3816
+ return path
3817
+ .split(".")
3818
+ .reduce((result, prop) => result[prop] === undefined ? "" : result[prop], obj);
3819
+ }
3820
+ sucessMessage() {
3821
+ this.utils.message("success", this.summary, "saved_message_content");
3448
3822
  }
3449
3823
  buildMessage(description) {
3450
3824
  this.utils.message("warn", "yms.int.documento_invalido_warning_header", description);
3451
3825
  }
3826
+ updateState(partialState) {
3827
+ this.stateSubject.next(Object.assign({}, this.state, partialState));
3828
+ }
3829
+ destroy() {
3830
+ this.ngUnsubscribe.next();
3831
+ this.ngUnsubscribe.complete();
3832
+ }
3833
+ };
3834
+ DocumentGridFacade = __decorate([
3835
+ Injectable(),
3836
+ __metadata("design:paramtypes", [TranslateService,
3837
+ DocumentService,
3838
+ IntegrationService,
3839
+ AgendaService,
3840
+ UtilsMessageService,
3841
+ FormWmsService,
3842
+ WmsIntegrationStrategyFactory])
3843
+ ], DocumentGridFacade);
3844
+
3845
+ let DocumentGridComponent = class DocumentGridComponent {
3846
+ constructor(facade, confirmationService, translate) {
3847
+ this.facade = facade;
3848
+ this.confirmationService = confirmationService;
3849
+ this.translate = translate;
3850
+ this.viewDocument = new EventEmitter();
3851
+ }
3852
+ ngOnInit() {
3853
+ this.state$ = this.facade.state$;
3854
+ this.facade.init(this.agenda, this.wmsSystem);
3855
+ }
3856
+ ngOnDestroy() {
3857
+ this.facade.destroy();
3858
+ }
3859
+ // UI Event handlers - delegam para o facade
3860
+ onView() {
3861
+ const document = this.facade.viewDocument();
3862
+ this.viewDocument.emit(document);
3863
+ }
3864
+ onSave() {
3865
+ this.facade.save();
3866
+ }
3867
+ onDelete() {
3868
+ this.confirmationService.confirm({
3869
+ message: this.translate.instant("delete_confirmation_message"),
3870
+ header: this.translate.instant("delete_confirmation_title"),
3871
+ accept: () => {
3872
+ this.facade.deleteSelectedDocuments();
3873
+ },
3874
+ });
3875
+ }
3876
+ onRefresh() {
3877
+ this.facade.listDocuments(false);
3878
+ }
3879
+ onRowSelect(rowData) {
3880
+ this.facade.addToSelection(rowData);
3881
+ }
3882
+ onInvoiceConditionChange() {
3883
+ this.facade.setDisabled(false);
3884
+ }
3885
+ // Getters para o template (delegam para o facade)
3886
+ get invoiceConditions() {
3887
+ return this.facade.invoiceConditions;
3888
+ }
3889
+ getActions() {
3890
+ return this.facade.getActions();
3891
+ }
3892
+ getFilteredInvoiceConditions(invoiceCondition) {
3893
+ return this.facade.getFilteredInvoiceConditions(invoiceCondition);
3894
+ }
3895
+ notSavedDocuments() {
3896
+ return this.facade.notSavedDocuments();
3897
+ }
3452
3898
  };
3453
3899
  __decorate([
3454
3900
  Input(),
@@ -3461,11 +3907,11 @@ __decorate([
3461
3907
  __decorate([
3462
3908
  Output(),
3463
3909
  __metadata("design:type", Boolean)
3464
- ], DocumentGridComponent.prototype, "visibleInvoiceKey", void 0);
3910
+ ], DocumentGridComponent.prototype, "showInvoiceSearchModal", void 0);
3465
3911
  __decorate([
3466
3912
  Output(),
3467
3913
  __metadata("design:type", Boolean)
3468
- ], DocumentGridComponent.prototype, "visibleDocumentRegister", void 0);
3914
+ ], DocumentGridComponent.prototype, "showAddInvoiceModal", void 0);
3469
3915
  __decorate([
3470
3916
  Output(),
3471
3917
  __metadata("design:type", EventEmitter)
@@ -3496,17 +3942,13 @@ __decorate([
3496
3942
  ], DocumentGridComponent.prototype, "customGridBody", void 0);
3497
3943
  DocumentGridComponent = __decorate([
3498
3944
  Component({
3499
- selector: 'document-grid',
3500
- 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>",
3945
+ selector: "document-grid",
3946
+ 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",
3501
3947
  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}"]
3502
3948
  }),
3503
- __metadata("design:paramtypes", [TranslateService,
3504
- DocumentService,
3949
+ __metadata("design:paramtypes", [DocumentGridFacade,
3505
3950
  ConfirmationService,
3506
- IntegrationService,
3507
- AgendaService,
3508
- UtilsMessageService,
3509
- FormWmsService])
3951
+ TranslateService])
3510
3952
  ], DocumentGridComponent);
3511
3953
 
3512
3954
  const moment$4 = _moment;
@@ -3549,10 +3991,10 @@ class Document {
3549
3991
  }
3550
3992
 
3551
3993
  let RegisterDocumentComponent = class RegisterDocumentComponent {
3552
- constructor(fb, translate, documentGridComponent) {
3994
+ constructor(fb, translate, facade) {
3553
3995
  this.fb = fb;
3554
3996
  this.translate = translate;
3555
- this.documentGridComponent = documentGridComponent;
3997
+ this.facade = facade;
3556
3998
  this.document = new EventEmitter();
3557
3999
  this.visible = new EventEmitter();
3558
4000
  this.visibleChange = new EventEmitter();
@@ -3583,19 +4025,23 @@ let RegisterDocumentComponent = class RegisterDocumentComponent {
3583
4025
  this.visibleChange.emit(false);
3584
4026
  }
3585
4027
  setValuesFormGroup(document) {
3586
- this.formGroup.get('key').setValue(document.key);
3587
- this.formGroup.get('invoiceKey').setValue(document.invoiceKey);
3588
- this.formGroup.get('invoiceNumber').setValue(document.invoiceNumber);
3589
- this.formGroup.get('invoiceSerialNumber').setValue(document.invoiceSerialNumber);
3590
- this.formGroup.get('logistcUnitDocument').setValue(document.logistcUnitDocument);
3591
- this.formGroup.get('logistcUnitName').setValue(document.logistcUnitName);
3592
- this.formGroup.get('notes').setValue(document.notes);
3593
- this.formGroup.get('code').setValue(document.code);
3594
- this.formGroup.get('partnerName').setValue(document.partnerName);
3595
- this.formGroup.get('partnerDocument').setValue(document.partnerDocument);
3596
- this.formGroup.get('ownerDocument').setValue(document.ownerDocument);
3597
- this.formGroup.get('ownerName').setValue(document.ownerName);
3598
- this.formGroup.get('invoiceCondition').setValue(document.invoiceCondition);
4028
+ this.formGroup.get("key").setValue(document.key);
4029
+ this.formGroup.get("invoiceKey").setValue(document.invoiceKey);
4030
+ this.formGroup.get("invoiceNumber").setValue(document.invoiceNumber);
4031
+ this.formGroup
4032
+ .get("invoiceSerialNumber")
4033
+ .setValue(document.invoiceSerialNumber);
4034
+ this.formGroup
4035
+ .get("logistcUnitDocument")
4036
+ .setValue(document.logistcUnitDocument);
4037
+ this.formGroup.get("logistcUnitName").setValue(document.logistcUnitName);
4038
+ this.formGroup.get("notes").setValue(document.notes);
4039
+ this.formGroup.get("code").setValue(document.code);
4040
+ this.formGroup.get("partnerName").setValue(document.partnerName);
4041
+ this.formGroup.get("partnerDocument").setValue(document.partnerDocument);
4042
+ this.formGroup.get("ownerDocument").setValue(document.ownerDocument);
4043
+ this.formGroup.get("ownerName").setValue(document.ownerName);
4044
+ this.formGroup.get("invoiceCondition").setValue(document.invoiceCondition);
3599
4045
  }
3600
4046
  getFormGroup() {
3601
4047
  this.formGroup = this.fb.group({
@@ -3617,7 +4063,7 @@ let RegisterDocumentComponent = class RegisterDocumentComponent {
3617
4063
  }
3618
4064
  save() {
3619
4065
  const document = Document.fromDto(this.formGroup.getRawValue());
3620
- if (!this.documentGridComponent.validateDocument(document)) {
4066
+ if (!this.facade.validateDocument(document)) {
3621
4067
  return;
3622
4068
  }
3623
4069
  this.document.emit(document);
@@ -3638,7 +4084,7 @@ let RegisterDocumentComponent = class RegisterDocumentComponent {
3638
4084
  watchFormChanges() {
3639
4085
  this.formGroup.valueChanges.subscribe(() => {
3640
4086
  const formValues = Object.values(this.formGroup.value);
3641
- this.isSaveFormValid = formValues.some(value => value !== null && value !== '');
4087
+ this.isSaveFormValid = formValues.some((value) => value !== null && value !== "");
3642
4088
  });
3643
4089
  }
3644
4090
  };
@@ -3677,11 +4123,11 @@ __decorate([
3677
4123
  RegisterDocumentComponent = __decorate([
3678
4124
  Component({
3679
4125
  selector: "register-document",
3680
- 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>"
4126
+ 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"
3681
4127
  }),
3682
4128
  __metadata("design:paramtypes", [FormBuilder,
3683
4129
  TranslateService,
3684
- DocumentGridComponent])
4130
+ DocumentGridFacade])
3685
4131
  ], RegisterDocumentComponent);
3686
4132
 
3687
4133
  let RegisterDocumentModule = class RegisterDocumentModule {
@@ -3720,16 +4166,15 @@ ExternalTenantService = __decorate([
3720
4166
  ], ExternalTenantService);
3721
4167
 
3722
4168
  let InsertKeyComponent = class InsertKeyComponent {
3723
- constructor(formBuilder, documentService, utils, confirmationService, translate, externalTenantService, documentGridComponent) {
4169
+ constructor(formBuilder, documentService, utils, confirmationService, translate, externalTenantService, facade) {
3724
4170
  this.formBuilder = formBuilder;
3725
4171
  this.documentService = documentService;
3726
4172
  this.utils = utils;
3727
4173
  this.confirmationService = confirmationService;
3728
4174
  this.translate = translate;
3729
4175
  this.externalTenantService = externalTenantService;
3730
- this.documentGridComponent = documentGridComponent;
4176
+ this.facade = facade;
3731
4177
  this.visible = new EventEmitter();
3732
- this.document = new EventEmitter();
3733
4178
  this.visibleChange = new EventEmitter();
3734
4179
  this.isLoading = false;
3735
4180
  this.isPartnerloading = false;
@@ -3741,9 +4186,9 @@ let InsertKeyComponent = class InsertKeyComponent {
3741
4186
  purchaseOrder: [undefined],
3742
4187
  invoiceNumber: [undefined],
3743
4188
  invoiceSerie: [undefined],
3744
- partnerDocument: [undefined]
4189
+ partnerDocument: [undefined],
3745
4190
  });
3746
- this.formGroup.get('key').valueChanges.subscribe((nf) => {
4191
+ this.formGroup.get("key").valueChanges.subscribe((nf) => {
3747
4192
  this.validateKeyDetails(nf);
3748
4193
  });
3749
4194
  }
@@ -3762,20 +4207,23 @@ let InsertKeyComponent = class InsertKeyComponent {
3762
4207
  searchKey() {
3763
4208
  this.isLoading = true;
3764
4209
  const key = {
3765
- purchaseOrder: this.formGroup.get('purchaseOrder').value,
3766
- documentKeys: [this.formGroup.get('key').value],
3767
- invoices: [{
3768
- number: this.formGroup.get('invoiceNumber').value,
3769
- serialNumber: this.formGroup.get('invoiceSerie').value,
3770
- partnerDocument: this.formGroup.get('partnerDocument').value
3771
- }],
4210
+ purchaseOrder: this.formGroup.get("purchaseOrder").value,
4211
+ documentKeys: [this.formGroup.get("key").value],
4212
+ invoices: [
4213
+ {
4214
+ number: this.formGroup.get("invoiceNumber").value,
4215
+ serialNumber: this.formGroup.get("invoiceSerie").value,
4216
+ partnerDocument: this.formGroup.get("partnerDocument").value,
4217
+ },
4218
+ ],
3772
4219
  logistcUnitName: undefined,
3773
4220
  size: 0,
3774
- offset: 0
4221
+ offset: 0,
3775
4222
  };
3776
4223
  const errorSearch = "yms.int.wms_error_search_document_message_header";
3777
- this.documentService.findDocuments(key)
3778
- .pipe(catchError(err => {
4224
+ this.documentService
4225
+ .findDocuments(key)
4226
+ .pipe(catchError((err) => {
3779
4227
  if (this.wmsSystem === WmsSystem.PARTNER) {
3780
4228
  this.utils.message("error", errorSearch, "yms.int.wms_error_search_document_not_found_partner");
3781
4229
  }
@@ -3783,7 +4231,8 @@ let InsertKeyComponent = class InsertKeyComponent {
3783
4231
  this.utils.message("error", errorSearch, "yms.int.wms_error_search_document_not_found_message_content");
3784
4232
  }
3785
4233
  else {
3786
- this.utils.translateMessage("error", errorSearch, "yms.int.wms_error_unknown_search_document_message_content " + err.error.message);
4234
+ this.utils.message("error", errorSearch, err.error.message ||
4235
+ "yms.int.wms_error_unknown_search_document_message_content");
3787
4236
  }
3788
4237
  this.confirmInvoiceDialog();
3789
4238
  return throwError(err);
@@ -3796,12 +4245,13 @@ let InsertKeyComponent = class InsertKeyComponent {
3796
4245
  return;
3797
4246
  }
3798
4247
  const document = content.contents[0];
3799
- if (!this.documentGridComponent.validateDocument(document)) {
4248
+ if (!this.facade.validateDocument(document)) {
3800
4249
  return;
3801
4250
  }
3802
- document.invoiceKey = this.formGroup.get('key').value;
4251
+ document.invoiceKey = this.formGroup.get("key").value;
3803
4252
  document.invoiceCondition = InvoiceCondition.AUTHORIZED;
3804
- this.document.emit(document);
4253
+ this.facade.onChangeDocument(document);
4254
+ this.facade.closeInvoiceSearchModal();
3805
4255
  this.formGroup.reset();
3806
4256
  });
3807
4257
  }
@@ -3812,35 +4262,36 @@ let InsertKeyComponent = class InsertKeyComponent {
3812
4262
  acceptLabel: this.translate.instant("yms.int.wms_accept_confirm_invoice_dialog"),
3813
4263
  rejectLabel: this.translate.instant("yms.int.wms_reject_confirm_invoice_dialog"),
3814
4264
  header: this.translate.instant("yms.int.wms_header_content_confirm_invoice_dialog"),
3815
- accept: () => this.buildInvoice()
4265
+ accept: () => this.buildInvoice(),
3816
4266
  });
3817
4267
  }
3818
4268
  }
3819
4269
  buildInvoice() {
3820
4270
  this.isPartnerloading = true;
3821
- const partnerDocument = this.formGroup.get('partnerDocument').value;
3822
- this.externalTenantService.list({
3823
- filterQuery: `cnpj eq '${partnerDocument}'`
4271
+ const partnerDocument = this.formGroup.get("partnerDocument").value;
4272
+ this.externalTenantService
4273
+ .list({
4274
+ filterQuery: `cnpj eq '${partnerDocument}'`,
3824
4275
  })
3825
4276
  .pipe(takeUntil(this.ngUnsubscribe), finalize(() => {
3826
4277
  this.isPartnerloading = false;
3827
4278
  }))
3828
4279
  .subscribe((contents) => {
3829
4280
  const documentInvoice = this.createDocumentInvoice(contents);
3830
- this.document.emit(documentInvoice);
4281
+ this.facade.onChangeDocument(documentInvoice);
3831
4282
  this.formGroup.reset();
3832
4283
  });
3833
4284
  }
3834
4285
  createDocumentInvoice(partners) {
3835
4286
  const documentInvoice = {
3836
- invoiceKey: this.formGroup.get('key').value,
3837
- invoiceNumber: this.formGroup.get('invoiceNumber').value,
3838
- invoiceSerialNumber: this.formGroup.get('invoiceSerie').value,
3839
- partnerDocument: this.formGroup.get('partnerDocument').value,
4287
+ invoiceKey: this.formGroup.get("key").value,
4288
+ invoiceNumber: this.formGroup.get("invoiceNumber").value,
4289
+ invoiceSerialNumber: this.formGroup.get("invoiceSerie").value,
4290
+ partnerDocument: this.formGroup.get("partnerDocument").value,
3840
4291
  partnerName: null,
3841
4292
  type: null,
3842
4293
  key: null,
3843
- schedulingId: null
4294
+ schedulingId: null,
3844
4295
  };
3845
4296
  if (partners.totalElements > 0) {
3846
4297
  const partner = partners.contents[0];
@@ -3876,9 +4327,9 @@ let InsertKeyComponent = class InsertKeyComponent {
3876
4327
  this.setValuesOfKey(invoice, serie, cnpj);
3877
4328
  }
3878
4329
  setValuesOfKey(invoiceNumber, invoiceSerie, partnerDocument) {
3879
- this.formGroup.get('invoiceNumber').setValue(invoiceNumber);
3880
- this.formGroup.get('invoiceSerie').setValue(invoiceSerie);
3881
- this.formGroup.get('partnerDocument').setValue(partnerDocument);
4330
+ this.formGroup.get("invoiceNumber").setValue(invoiceNumber);
4331
+ this.formGroup.get("invoiceSerie").setValue(invoiceSerie);
4332
+ this.formGroup.get("partnerDocument").setValue(partnerDocument);
3882
4333
  }
3883
4334
  cancel() {
3884
4335
  this.visibleChange.emit(false);
@@ -3899,10 +4350,6 @@ __decorate([
3899
4350
  Input(),
3900
4351
  __metadata("design:type", EventEmitter)
3901
4352
  ], InsertKeyComponent.prototype, "visible", void 0);
3902
- __decorate([
3903
- Output(),
3904
- __metadata("design:type", EventEmitter)
3905
- ], InsertKeyComponent.prototype, "document", void 0);
3906
4353
  __decorate([
3907
4354
  Output(),
3908
4355
  __metadata("design:type", Object)
@@ -3910,7 +4357,7 @@ __decorate([
3910
4357
  InsertKeyComponent = __decorate([
3911
4358
  Component({
3912
4359
  selector: "insert-key",
3913
- 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",
4360
+ 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",
3914
4361
  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}"]
3915
4362
  }),
3916
4363
  __metadata("design:paramtypes", [FormBuilder,
@@ -3919,7 +4366,7 @@ InsertKeyComponent = __decorate([
3919
4366
  ConfirmationService,
3920
4367
  TranslateService,
3921
4368
  ExternalTenantService,
3922
- DocumentGridComponent])
4369
+ DocumentGridFacade])
3923
4370
  ], InsertKeyComponent);
3924
4371
 
3925
4372
  let InsertKeyModule = class InsertKeyModule {
@@ -3973,7 +4420,12 @@ DocumentGridModule = __decorate([
3973
4420
  declarations: [DocumentGridComponent, CpfCnpjFormatPipe],
3974
4421
  entryComponents: [DocumentGridComponent],
3975
4422
  exports: [DocumentGridComponent, CpfCnpjFormatPipe],
3976
- providers: [ExternalTenantService],
4423
+ providers: [
4424
+ ExternalTenantService,
4425
+ DocumentGridFacade,
4426
+ WmsIntegrationStrategyFactory,
4427
+ ConfirmationService,
4428
+ ],
3977
4429
  imports: [
3978
4430
  CommonModule,
3979
4431
  TranslateModule,
@@ -3986,7 +4438,8 @@ DocumentGridModule = __decorate([
3986
4438
  ComponentsModule,
3987
4439
  EmptyStateModule,
3988
4440
  DropdownModule,
3989
- FormsModule
4441
+ FormsModule,
4442
+ ConfirmDialogModule,
3990
4443
  ],
3991
4444
  })
3992
4445
  ], DocumentGridModule);
@@ -13842,5 +14295,5 @@ DockModule = __decorate([
13842
14295
  })
13843
14296
  ], DockModule);
13844
14297
 
13845
- 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 };
14298
+ 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 };
13846
14299
  //# sourceMappingURL=seniorsistemas-yms-integration.js.map