@seniorsistemas/yms-integration 1.19.1-5faa32ff-77ac-459b-a5e6-0b7a1b7fef2a → 1.19.1-6da51aac-437e-4cf3-97a4-eb47a5117d83

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 (21) hide show
  1. package/bundles/seniorsistemas-yms-integration.umd.js +244 -214
  2. package/bundles/seniorsistemas-yms-integration.umd.js.map +1 -1
  3. package/bundles/seniorsistemas-yms-integration.umd.min.js +1 -1
  4. package/bundles/seniorsistemas-yms-integration.umd.min.js.map +1 -1
  5. package/esm2015/src/wms/components/document-grid/document-grid.component.js +28 -25
  6. package/esm2015/src/wms/components/document-grid/insert-key/insert-key.component.js +15 -8
  7. package/esm2015/src/wms/components/document-grid/register-document/register-document.component.js +29 -11
  8. package/esm2015/src/wms/wms.module.js +1 -1
  9. package/esm5/src/wms/components/document-grid/document-grid.component.js +28 -25
  10. package/esm5/src/wms/components/document-grid/insert-key/insert-key.component.js +15 -8
  11. package/esm5/src/wms/components/document-grid/register-document/register-document.component.js +29 -11
  12. package/esm5/src/wms/wms.module.js +1 -1
  13. package/fesm2015/seniorsistemas-yms-integration.js +237 -207
  14. package/fesm2015/seniorsistemas-yms-integration.js.map +1 -1
  15. package/fesm5/seniorsistemas-yms-integration.js +244 -214
  16. package/fesm5/seniorsistemas-yms-integration.js.map +1 -1
  17. package/package.json +1 -1
  18. package/seniorsistemas-yms-integration.metadata.json +1 -1
  19. package/src/wms/components/document-grid/document-grid.component.d.ts +6 -8
  20. package/src/wms/components/document-grid/insert-key/insert-key.component.d.ts +2 -2
  21. package/src/wms/components/document-grid/register-document/register-document.component.d.ts +8 -5
@@ -3068,74 +3068,166 @@ var DocumentService = /** @class */ (function (_super) {
3068
3068
  return DocumentService;
3069
3069
  }(EntityService));
3070
3070
 
3071
- var InsertKeyComponent = /** @class */ (function () {
3072
- function InsertKeyComponent(formBuilder, documentService, messageService, translate) {
3073
- this.formBuilder = formBuilder;
3071
+ var DocumentGridComponent = /** @class */ (function () {
3072
+ function DocumentGridComponent(translate, documentService, messageService) {
3073
+ this.translate = translate;
3074
3074
  this.documentService = documentService;
3075
3075
  this.messageService = messageService;
3076
- this.translate = translate;
3077
- this.document = new EventEmitter();
3076
+ this.viewDocument = new EventEmitter();
3077
+ this.gridData = [];
3078
+ this.ngUnsubscribe = new Subject();
3078
3079
  }
3079
- InsertKeyComponent.prototype.ngOnInit = function () {
3080
- this.formGroup = this.formBuilder.group({
3081
- key: [undefined]
3082
- });
3080
+ DocumentGridComponent.prototype.ngOnInit = function () {
3081
+ this.gridColumns = this.getGridColumns();
3082
+ this.listDocuments();
3083
3083
  };
3084
- InsertKeyComponent.prototype.showInsertKey = function (visible) {
3085
- this.visible = visible;
3084
+ DocumentGridComponent.prototype.onChangeDocument = function (document) {
3085
+ this.gridData.push(document);
3086
+ this.disabled = false;
3086
3087
  };
3087
- InsertKeyComponent.prototype.add = function () {
3088
- this.visible = false;
3089
- if (!this.formGroup.get('key').value) {
3088
+ DocumentGridComponent.prototype.getActions = function () {
3089
+ var _this = this;
3090
+ return [
3091
+ {
3092
+ label: this.translate.instant("yms.int.wms_add_document_invoice_key"),
3093
+ command: function () {
3094
+ _this.visibleInvoiceKey = true;
3095
+ },
3096
+ icon: "fa fa-search"
3097
+ },
3098
+ {
3099
+ label: this.translate.instant("yms.int.wms_add_document_register"),
3100
+ command: function () {
3101
+ _this.edit = true;
3102
+ _this.visibleDocumentRegister = true;
3103
+ },
3104
+ icon: "fas fa-pen-square"
3105
+ }
3106
+ ];
3107
+ };
3108
+ DocumentGridComponent.prototype.getProp = function (obj, path) {
3109
+ return path.split(".").reduce(function (result, prop) { return (result[prop] === undefined ? "" : result[prop]); }, obj);
3110
+ };
3111
+ DocumentGridComponent.prototype.view = function (selection) {
3112
+ this.viewDocument.emit(selection);
3113
+ this.visibleDocumentRegister = true;
3114
+ this.edit = false;
3115
+ };
3116
+ DocumentGridComponent.prototype.save = function () {
3117
+ var _this = this;
3118
+ if (this.gridData.length > 0) {
3119
+ this.gridData.forEach(function (data) {
3120
+ if (!data.id) {
3121
+ if (!data.schedulingId) {
3122
+ data.schedulingId = _this.agenda.id;
3123
+ }
3124
+ _this.documentService.insert(data).subscribe(function () {
3125
+ _this.message("success", "saved_message_title", "saved_message_content");
3126
+ });
3127
+ _this.disabled = true;
3128
+ }
3129
+ });
3130
+ }
3131
+ };
3132
+ DocumentGridComponent.prototype.onDelete = function (selection) {
3133
+ var _this = this;
3134
+ if (!selection.id) {
3090
3135
  return;
3091
3136
  }
3092
- this.searchKey();
3137
+ this.documentService.delete(selection.id)
3138
+ .pipe(takeUntil(this.ngUnsubscribe), finalize(function () {
3139
+ _this.gridData = [];
3140
+ _this.listDocuments();
3141
+ })).
3142
+ subscribe(function () { return _this.message("success", "deleted_message_title", "deleted_message_content"); });
3093
3143
  };
3094
- InsertKeyComponent.prototype.searchKey = function () {
3144
+ DocumentGridComponent.prototype.listDocuments = function () {
3095
3145
  var _this = this;
3096
- var key = {
3097
- documentKeys: [this.formGroup.get('key').value],
3098
- invoices: undefined,
3099
- logistcUnitName: undefined,
3100
- size: 0,
3101
- offset: 0
3102
- };
3103
- this.documentService.findDocuments(key).subscribe(function (content) {
3104
- if (content.totalElements < 1) {
3105
- _this.message("warn", "yms.int.wms_insert_key_warning_message_header", "yms.int.wms_insert_key_warning_message_description");
3106
- return;
3146
+ this.documentService.list({
3147
+ filterQuery: "schedulingId eq '" + this.agenda.id + "'"
3148
+ })
3149
+ .subscribe(function (contents) {
3150
+ if (contents.totalElements > 0) {
3151
+ _this.gridData = contents.contents;
3152
+ _this.documentTotalRecords = contents.totalElements;
3107
3153
  }
3108
- _this.document.emit(content.contents[0]);
3109
- _this.message("success", "yms.int.wms_insert_key_success_message_header", "yms.int.wms_insert_key_success_message_description");
3110
- _this.formGroup.reset();
3154
+ else {
3155
+ _this.disabled = true;
3156
+ _this.documentTotalRecords = _this.gridData.length;
3157
+ }
3158
+ _this.loading = false;
3111
3159
  });
3112
3160
  };
3113
- InsertKeyComponent.prototype.message = function (success, header, description) {
3161
+ DocumentGridComponent.prototype.getGridColumns = function () {
3162
+ return [
3163
+ { field: "logistcUnitName", header: this.translate.instant("yms.int.wms_register_document_logistc_unit_name") },
3164
+ { field: "logistcUnitDocument", header: this.translate.instant("yms.int.wms_register_document_logistc_unit_document") },
3165
+ { field: "invoiceKey", header: this.translate.instant("yms.int.wms_register_document_invoice_key") },
3166
+ { field: "invoiceNumber", header: this.translate.instant("yms.int.wms_register_document_invoice_number") },
3167
+ { field: "invoiceSerialNumber", header: this.translate.instant("yms.int.wms_register_document_invoice_serial_number") },
3168
+ { field: "ownerName", header: this.translate.instant("yms.int.wms_register_document_owner_name") },
3169
+ { field: "ownerDocument", header: this.translate.instant("yms.int.wms_register_document_owner_document") },
3170
+ { field: "orderReceivingCode", header: this.translate.instant("yms.int.wms_register_document_order_receiving_code") },
3171
+ ];
3172
+ };
3173
+ DocumentGridComponent.prototype.message = function (severity, summary, detail) {
3114
3174
  this.messageService.add({
3115
- severity: success,
3116
- summary: this.translate.instant(header),
3117
- detail: this.translate.instant(description),
3175
+ severity: severity,
3176
+ summary: this.translate.instant(summary),
3177
+ detail: this.translate.instant(detail),
3118
3178
  });
3119
3179
  };
3120
- InsertKeyComponent.prototype.cancel = function () {
3121
- this.visible = false;
3122
- };
3180
+ __decorate([
3181
+ Input(),
3182
+ __metadata("design:type", Object)
3183
+ ], DocumentGridComponent.prototype, "agenda", void 0);
3184
+ __decorate([
3185
+ Output(),
3186
+ __metadata("design:type", Boolean)
3187
+ ], DocumentGridComponent.prototype, "visibleInvoiceKey", void 0);
3188
+ __decorate([
3189
+ Output(),
3190
+ __metadata("design:type", Boolean)
3191
+ ], DocumentGridComponent.prototype, "visibleDocumentRegister", void 0);
3123
3192
  __decorate([
3124
3193
  Output(),
3125
3194
  __metadata("design:type", EventEmitter)
3126
- ], InsertKeyComponent.prototype, "document", void 0);
3127
- InsertKeyComponent = __decorate([
3195
+ ], DocumentGridComponent.prototype, "viewDocument", void 0);
3196
+ __decorate([
3197
+ ViewChild("documentTable"),
3198
+ __metadata("design:type", Table)
3199
+ ], DocumentGridComponent.prototype, "table", void 0);
3200
+ __decorate([
3201
+ ViewChild("customTemplate"),
3202
+ __metadata("design:type", TemplateRef)
3203
+ ], DocumentGridComponent.prototype, "customTemplate", void 0);
3204
+ __decorate([
3205
+ ViewChild("customFilterFields"),
3206
+ __metadata("design:type", TemplateRef)
3207
+ ], DocumentGridComponent.prototype, "customFilterFields", void 0);
3208
+ __decorate([
3209
+ ViewChild("customGridColgroup"),
3210
+ __metadata("design:type", TemplateRef)
3211
+ ], DocumentGridComponent.prototype, "customGridColgroup", void 0);
3212
+ __decorate([
3213
+ ViewChild("customGridHeader"),
3214
+ __metadata("design:type", TemplateRef)
3215
+ ], DocumentGridComponent.prototype, "customGridHeader", void 0);
3216
+ __decorate([
3217
+ ViewChild("customGridBody"),
3218
+ __metadata("design:type", TemplateRef)
3219
+ ], DocumentGridComponent.prototype, "customGridBody", void 0);
3220
+ DocumentGridComponent = __decorate([
3128
3221
  Component({
3129
- selector: "insert-key",
3130
- template: "<form [formGroup]=\"formGroup\">\n <p-dialog [(visible)]=\"visible\">\n <p-header>{{'yms.insert_key_header' | translate}}</p-header>\n <div class=\"flex py-2 justify-content-center spacing-bottom\">\n <label for=\"key\">{{'yms.insert_key_label'}}</label>\n <input id=\"key\" class=\"size-input\" pInputText type=\"text\" formControlName=\"key\">\n </div>\n <div class=\"separator\"></div>\n <div class=\"spacing-top\">\n <s-button pButton label=\"{{'save' | 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 </p-dialog>\n</form>",
3131
- 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:550px}"]
3222
+ selector: 'document-grid',
3223
+ template: "<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 </s-button>\n <s-button\n label=\"{{'yms.wms_view_button' | translate}}\"\n priority=\"secondary\"\n [auxiliary]=\"false\"\n [disabled]=\"!selection || disabled\"\n (onClick)=\"view(selection)\">\n </s-button>\n <s-button\n label=\"{{'yms.wms_delete_button' | translate}}\"\n priority=\"secondary\"\n [auxiliary]=\"false\"\n [disabled]=\"!selection || disabled\"\n (click)=\"onDelete(selection)\">\n </s-button>\n </div>\n <s-button\n id=\"refresh-button\"\n priority=\"default\"\n iconClass=\"fa fa-refresh\"\n (onClick)=\"listDocuments()\"\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=\"id\" [lazy]=\"true\" [scrollable]=\"true\" [resizableColumns]=\"true\"\n sortMode=\"single\" [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=\"col\" *ngFor=\"let col of columns\" [pSortableColumn]=\"col.field\" pResizableColumn>\n <div class=\"senior-header\">\n <span class=\"senior-header-title\">{{ col.header }}</span>\n <p-sortIcon [field]=\"col.field\"></p-sortIcon>\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 (click)=\"selection = rowData\">\n <span>{{ rowData[\"logistcUnitName\"] }}</span>\n </td>\n <td (click)=\"selection = rowData\">\n <span>{{ rowData[\"logistcUnitDocument\"] }}</span>\n </td>\n <td (click)=\"selection = rowData\">\n <span>{{ rowData[\"invoiceKey\"] }}</span>\n </td>\n <td (click)=\"selection = rowData\">\n <span>{{ rowData[\"invoiceNumber\"] }}</span>\n </td>\n <td (click)=\"selection = rowData\">\n <span>{{ rowData[\"invoiceSerialNumber\"] }}</span>\n </td>\n <td (click)=\"selection = rowData\">\n <span>{{ rowData[\"ownerName\"] }}</span>\n </td>\n <td (click)=\"selection = rowData\">\n <span>{{ rowData[\"ownerDocument\"] }}</span>\n </td>\n <td (click)=\"selection = rowData\">\n <span>{{ rowData[\"orderReceivingCode\"] }}</span>\n </td>\n </tr>\n </ng-template>\n <ng-template pTemplate=\"paginatorright\">\n <span [translate]=\"'total_records'\" [translateParams]=\"{ value: documentTotalRecords }\"></span>\n </ng-template>\n </p-table> \n </div>\n </div>\n <register-document\n [edit]=\"edit\"\n [viewDocument]=\"selection\"\n (document)=\"onChangeDocument($event)\"\n [(visible)]=\"visibleDocumentRegister\"\n [agenda]=\"agenda\">\n </register-document>\n <insert-key (document)=\"onChangeDocument($event)\" [(visible)]=\"visibleInvoiceKey\"></insert-key>\n</p-panel>\n<div class=\"button-save\">\n <s-button \n priority=\"primary\" [label]=\"'save' | translate\" [disabled]=\"!disabled || !this.gridData\" (click)=\"save()\">\n </s-button>\n</div>\n\n\n<ng-template #emptyList>\n <div class=\"center\">\n <s-empty-state\n iconClass=\"fa fa-exclamation-triangle\" [title]=\"'yms.dock.area_dock_empty_state_title' | translate\"\n [description]=\"'yms.dock.area_dock_empty_state_description' | translate\">\n </s-empty-state>\n </div>\n</ng-template>\n",
3224
+ 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}"]
3132
3225
  }),
3133
- __metadata("design:paramtypes", [FormBuilder,
3226
+ __metadata("design:paramtypes", [TranslateService,
3134
3227
  DocumentService,
3135
- MessageService,
3136
- TranslateService])
3137
- ], InsertKeyComponent);
3138
- return InsertKeyComponent;
3228
+ MessageService])
3229
+ ], DocumentGridComponent);
3230
+ return DocumentGridComponent;
3139
3231
  }());
3140
3232
 
3141
3233
  var moment$4 = _moment;
@@ -3304,25 +3396,27 @@ var RegisterDocumentComponent = /** @class */ (function () {
3304
3396
  this.translateService = translateService;
3305
3397
  this.agendaService = agendaService;
3306
3398
  this.document = new EventEmitter();
3399
+ this.visible = new EventEmitter();
3400
+ this.visibleChange = new EventEmitter();
3307
3401
  }
3308
3402
  RegisterDocumentComponent.prototype.ngOnInit = function () {
3309
3403
  this.getFormGroup();
3310
3404
  };
3311
- RegisterDocumentComponent.prototype.showRegister = function (isVisible, isEdit, document) {
3312
- if (!isVisible && !isEdit) {
3313
- return;
3314
- }
3315
- this.visible = isVisible;
3316
- this.edit = isEdit;
3317
- if (!this.edit) {
3405
+ RegisterDocumentComponent.prototype.ngOnChanges = function () {
3406
+ this.visibilityConfig();
3407
+ };
3408
+ RegisterDocumentComponent.prototype.visibilityConfig = function () {
3409
+ if (!this.edit && this.visible) {
3318
3410
  this.formGroup.disable();
3319
- this.setValuesFormGroup(document);
3411
+ this.setValuesFormGroup(this.viewDocument);
3320
3412
  this.setValueForPartner();
3321
3413
  this.hideSaveButton = true;
3414
+ return this.visible;
3322
3415
  }
3416
+ return this.visible;
3323
3417
  };
3324
3418
  RegisterDocumentComponent.prototype.close = function () {
3325
- this.visible = false;
3419
+ this.visibleChange.emit(false);
3326
3420
  };
3327
3421
  RegisterDocumentComponent.prototype.setValuesFormGroup = function (document) {
3328
3422
  this.formGroup.get('invoiceKey').setValue(document.invoiceKey);
@@ -3366,7 +3460,7 @@ var RegisterDocumentComponent = /** @class */ (function () {
3366
3460
  }
3367
3461
  this.document.emit(Document.fromDto(value));
3368
3462
  this.successMessage();
3369
- this.visible = false;
3463
+ this.visibleChange.emit(false);
3370
3464
  }
3371
3465
  };
3372
3466
  RegisterDocumentComponent.prototype.successMessage = function () {
@@ -3376,6 +3470,14 @@ var RegisterDocumentComponent = /** @class */ (function () {
3376
3470
  detail: this.translateService.instant("saved_message_content"),
3377
3471
  });
3378
3472
  };
3473
+ __decorate([
3474
+ Input(),
3475
+ __metadata("design:type", Document)
3476
+ ], RegisterDocumentComponent.prototype, "viewDocument", void 0);
3477
+ __decorate([
3478
+ Input(),
3479
+ __metadata("design:type", Boolean)
3480
+ ], RegisterDocumentComponent.prototype, "edit", void 0);
3379
3481
  __decorate([
3380
3482
  Input(),
3381
3483
  __metadata("design:type", Agenda)
@@ -3384,6 +3486,14 @@ var RegisterDocumentComponent = /** @class */ (function () {
3384
3486
  Output(),
3385
3487
  __metadata("design:type", EventEmitter)
3386
3488
  ], RegisterDocumentComponent.prototype, "document", void 0);
3489
+ __decorate([
3490
+ Input(),
3491
+ __metadata("design:type", EventEmitter)
3492
+ ], RegisterDocumentComponent.prototype, "visible", void 0);
3493
+ __decorate([
3494
+ Output(),
3495
+ __metadata("design:type", Object)
3496
+ ], RegisterDocumentComponent.prototype, "visibleChange", void 0);
3387
3497
  RegisterDocumentComponent = __decorate([
3388
3498
  Component({
3389
3499
  selector: "register-document",
@@ -3397,163 +3507,6 @@ var RegisterDocumentComponent = /** @class */ (function () {
3397
3507
  return RegisterDocumentComponent;
3398
3508
  }());
3399
3509
 
3400
- var DocumentGridComponent = /** @class */ (function () {
3401
- function DocumentGridComponent(translate, documentService, messageService) {
3402
- this.translate = translate;
3403
- this.documentService = documentService;
3404
- this.messageService = messageService;
3405
- this.ngUnsubscribe = new Subject();
3406
- }
3407
- DocumentGridComponent.prototype.ngOnInit = function () {
3408
- this.gridColumns = this.getGridColumns();
3409
- this.listDocuments();
3410
- };
3411
- DocumentGridComponent.prototype.onChangeDocument = function (document) {
3412
- this.gridData.push(document);
3413
- this.disabled = true;
3414
- };
3415
- DocumentGridComponent.prototype.getActions = function () {
3416
- var _this = this;
3417
- return [
3418
- {
3419
- label: this.translate.instant("yms.int.wms_add_document_invoice_key"),
3420
- command: function () {
3421
- _this.registerDocumentComponent.showRegister(false, false);
3422
- _this.showInsertKey = true;
3423
- _this.insertKeyComponent.showInsertKey(_this.showInsertKey);
3424
- },
3425
- icon: "fa fa-search"
3426
- },
3427
- {
3428
- label: this.translate.instant("yms.int.wms_add_document_register"),
3429
- command: function () {
3430
- _this.insertKeyComponent.showInsertKey(false);
3431
- _this.showRegisterDocument = true;
3432
- _this.registerDocumentComponent.showRegister(_this.showRegisterDocument, true);
3433
- },
3434
- icon: "fas fa-pen-square"
3435
- }
3436
- ];
3437
- };
3438
- DocumentGridComponent.prototype.getProp = function (obj, path) {
3439
- return path.split(".").reduce(function (result, prop) { return (result[prop] === undefined ? "" : result[prop]); }, obj);
3440
- };
3441
- DocumentGridComponent.prototype.view = function () {
3442
- var documentSelectec = this.selection;
3443
- this.showRegisterDocument = true;
3444
- this.registerDocumentComponent.showRegister(this.showRegisterDocument, false, documentSelectec);
3445
- };
3446
- DocumentGridComponent.prototype.save = function () {
3447
- var _this = this;
3448
- if (this.gridData.length > 1) {
3449
- this.gridData.forEach(function (data) {
3450
- if (!data.id) {
3451
- if (!data.schedulingId) {
3452
- data.schedulingId = _this.agenda.id;
3453
- }
3454
- _this.documentService.insert(data).subscribe(function () {
3455
- _this.message("success", "saved_message_title", "saved_message_content");
3456
- });
3457
- _this.disabled = true;
3458
- }
3459
- });
3460
- }
3461
- };
3462
- DocumentGridComponent.prototype.onDelete = function (selection) {
3463
- var _this = this;
3464
- if (!selection.id) {
3465
- return;
3466
- }
3467
- this.documentService.delete(selection.id)
3468
- .pipe(takeUntil(this.ngUnsubscribe), finalize(function () {
3469
- _this.listDocuments();
3470
- })).
3471
- subscribe(function () { return _this.message("success", "deleted_message_title", "deleted_message_content"); });
3472
- };
3473
- DocumentGridComponent.prototype.listDocuments = function () {
3474
- var _this = this;
3475
- this.documentService.list({
3476
- filterQuery: "schedulingId eq '" + this.agenda.id + "'"
3477
- })
3478
- .subscribe(function (contents) {
3479
- if (contents.totalElements > 0) {
3480
- _this.gridData = contents.contents;
3481
- _this.documentTotalRecords = contents.totalElements;
3482
- }
3483
- else {
3484
- _this.disabled = true;
3485
- }
3486
- _this.loading = false;
3487
- });
3488
- };
3489
- DocumentGridComponent.prototype.getGridColumns = function () {
3490
- return [
3491
- { field: "logistcUnitName", header: this.translate.instant("yms.int.wms_register_document_logistc_unit_name") },
3492
- { field: "logistcUnitDocument", header: this.translate.instant("yms.int.wms_register_document_logistc_unit_document") },
3493
- { field: "invoiceKey", header: this.translate.instant("yms.int.wms_register_document_invoice_key") },
3494
- { field: "invoiceNumber", header: this.translate.instant("yms.int.wms_register_document_invoice_number") },
3495
- { field: "invoiceSerialNumber", header: this.translate.instant("yms.int.wms_register_document_invoice_serial_number") },
3496
- { field: "ownerName", header: this.translate.instant("yms.int.wms_register_document_owner_name") },
3497
- { field: "ownerDocument", header: this.translate.instant("yms.int.wms_register_document_owner_document") },
3498
- { field: "orderReceivingCode", header: this.translate.instant("yms.int.wms_register_document_order_receiving_code") },
3499
- ];
3500
- };
3501
- DocumentGridComponent.prototype.message = function (severity, summary, detail) {
3502
- this.messageService.add({
3503
- severity: severity,
3504
- summary: this.translate.instant(summary),
3505
- detail: this.translate.instant(detail),
3506
- });
3507
- };
3508
- __decorate([
3509
- Input(),
3510
- __metadata("design:type", Object)
3511
- ], DocumentGridComponent.prototype, "agenda", void 0);
3512
- __decorate([
3513
- ViewChild("documentTable"),
3514
- __metadata("design:type", Table)
3515
- ], DocumentGridComponent.prototype, "table", void 0);
3516
- __decorate([
3517
- ViewChild("customTemplate"),
3518
- __metadata("design:type", TemplateRef)
3519
- ], DocumentGridComponent.prototype, "customTemplate", void 0);
3520
- __decorate([
3521
- ViewChild("customFilterFields"),
3522
- __metadata("design:type", TemplateRef)
3523
- ], DocumentGridComponent.prototype, "customFilterFields", void 0);
3524
- __decorate([
3525
- ViewChild("customGridColgroup"),
3526
- __metadata("design:type", TemplateRef)
3527
- ], DocumentGridComponent.prototype, "customGridColgroup", void 0);
3528
- __decorate([
3529
- ViewChild("customGridHeader"),
3530
- __metadata("design:type", TemplateRef)
3531
- ], DocumentGridComponent.prototype, "customGridHeader", void 0);
3532
- __decorate([
3533
- ViewChild("customGridBody"),
3534
- __metadata("design:type", TemplateRef)
3535
- ], DocumentGridComponent.prototype, "customGridBody", void 0);
3536
- __decorate([
3537
- ViewChild("registerDocument"),
3538
- __metadata("design:type", RegisterDocumentComponent)
3539
- ], DocumentGridComponent.prototype, "registerDocumentComponent", void 0);
3540
- __decorate([
3541
- ViewChild("insertKey"),
3542
- __metadata("design:type", InsertKeyComponent)
3543
- ], DocumentGridComponent.prototype, "insertKeyComponent", void 0);
3544
- DocumentGridComponent = __decorate([
3545
- Component({
3546
- selector: 'document-grid',
3547
- template: "<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 </s-button>\n <s-button\n label=\"{{'yms.wms_view_button' | translate}}\"\n priority=\"secondary\"\n [auxiliary]=\"false\"\n [disabled]=\"!selection || disabled\"\n (onClick)=\"view()\">\n </s-button>\n <s-button\n label=\"{{'yms.wms_delete_button' | translate}}\"\n priority=\"secondary\"\n [auxiliary]=\"false\"\n [disabled]=\"!selection || disabled\"\n (click)=\"onDelete(selection)\">\n </s-button>\n </div>\n <s-button\n id=\"refresh-button\"\n priority=\"default\"\n iconClass=\"fa fa-refresh\"\n (onClick)=\"listDocuments()\"\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=\"id\" [lazy]=\"true\" [scrollable]=\"true\" [resizableColumns]=\"true\"\n sortMode=\"single\" [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=\"col\" *ngFor=\"let col of columns\" [pSortableColumn]=\"col.field\" pResizableColumn>\n <div class=\"senior-header\">\n <span class=\"senior-header-title\">{{ col.header }}</span>\n <p-sortIcon [field]=\"col.field\"></p-sortIcon>\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 (click)=\"selection = rowData\">\n <span>{{ rowData[\"logistcUnitName\"] }}</span>\n </td>\n <td (click)=\"selection = rowData\">\n <span>{{ rowData[\"logistcUnitDocument\"] }}</span>\n </td>\n <td (click)=\"selection = rowData\">\n <span>{{ rowData[\"invoiceKey\"] }}</span>\n </td>\n <td (click)=\"selection = rowData\">\n <span>{{ rowData[\"invoiceNumber\"] }}</span>\n </td>\n <td (click)=\"selection = rowData\">\n <span>{{ rowData[\"invoiceSerialNumber\"] }}</span>\n </td>\n <td (click)=\"selection = rowData\">\n <span>{{ rowData[\"ownerName\"] }}</span>\n </td>\n <td (click)=\"selection = rowData\">\n <span>{{ rowData[\"ownerDocument\"] }}</span>\n </td>\n <td (click)=\"selection = rowData\">\n <span>{{ rowData[\"orderReceivingCode\"] }}</span>\n </td>\n </tr>\n </ng-template>\n <ng-template pTemplate=\"paginatorright\">\n <span [translate]=\"'total_records'\" [translateParams]=\"{ value: documentTotalRecords }\"></span>\n </ng-template>\n </p-table> \n </div>\n </div>\n <register-document #registerDocument (document)=\"onChangeDocument($event)\" [agenda]=\"agenda\"></register-document>\n <insert-key #insertKey (document)=\"onChangeDocument($event)\"></insert-key>\n</p-panel>\n<div class=\"button-save\">\n <s-button \n priority=\"primary\" [label]=\"'save' | translate\" [disabled]=\"!disabled\" (click)=\"save()\">\n </s-button>\n</div>\n\n\n<ng-template #emptyList>\n <div class=\"center\">\n <s-empty-state\n iconClass=\"fa fa-exclamation-triangle\" [title]=\"'yms.dock.area_dock_empty_state_title' | translate\"\n [description]=\"'yms.dock.area_dock_empty_state_description' | translate\">\n </s-empty-state>\n </div>\n</ng-template>\n",
3548
- 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}"]
3549
- }),
3550
- __metadata("design:paramtypes", [TranslateService,
3551
- DocumentService,
3552
- MessageService])
3553
- ], DocumentGridComponent);
3554
- return DocumentGridComponent;
3555
- }());
3556
-
3557
3510
  var RegisterDocumentModule = /** @class */ (function () {
3558
3511
  function RegisterDocumentModule() {
3559
3512
  }
@@ -3579,6 +3532,83 @@ var RegisterDocumentModule = /** @class */ (function () {
3579
3532
  return RegisterDocumentModule;
3580
3533
  }());
3581
3534
 
3535
+ var InsertKeyComponent = /** @class */ (function () {
3536
+ function InsertKeyComponent(formBuilder, documentService, messageService, translate) {
3537
+ this.formBuilder = formBuilder;
3538
+ this.documentService = documentService;
3539
+ this.messageService = messageService;
3540
+ this.translate = translate;
3541
+ this.document = new EventEmitter();
3542
+ this.visible = new EventEmitter();
3543
+ this.visibleChange = new EventEmitter();
3544
+ }
3545
+ InsertKeyComponent.prototype.ngOnInit = function () {
3546
+ this.formGroup = this.formBuilder.group({
3547
+ key: [undefined]
3548
+ });
3549
+ };
3550
+ InsertKeyComponent.prototype.add = function () {
3551
+ this.visibleChange.emit(false);
3552
+ if (!this.formGroup.get('key').value) {
3553
+ return;
3554
+ }
3555
+ this.searchKey();
3556
+ };
3557
+ InsertKeyComponent.prototype.searchKey = function () {
3558
+ var _this = this;
3559
+ var key = {
3560
+ documentKeys: [this.formGroup.get('key').value],
3561
+ invoices: undefined,
3562
+ logistcUnitName: undefined,
3563
+ size: 0,
3564
+ offset: 0
3565
+ };
3566
+ this.documentService.findDocuments(key).subscribe(function (content) {
3567
+ if (content.totalElements < 1) {
3568
+ _this.message("warn", "yms.int.wms_insert_key_warning_message_header", "yms.int.wms_insert_key_warning_message_description");
3569
+ return;
3570
+ }
3571
+ _this.document.emit(content.contents[0]);
3572
+ _this.message("success", "yms.int.wms_insert_key_success_message_header", "yms.int.wms_insert_key_success_message_description");
3573
+ _this.formGroup.reset();
3574
+ });
3575
+ };
3576
+ InsertKeyComponent.prototype.message = function (success, header, description) {
3577
+ this.messageService.add({
3578
+ severity: success,
3579
+ summary: this.translate.instant(header),
3580
+ detail: this.translate.instant(description),
3581
+ });
3582
+ };
3583
+ InsertKeyComponent.prototype.cancel = function () {
3584
+ this.visibleChange.emit(false);
3585
+ };
3586
+ __decorate([
3587
+ Output(),
3588
+ __metadata("design:type", EventEmitter)
3589
+ ], InsertKeyComponent.prototype, "document", void 0);
3590
+ __decorate([
3591
+ Input(),
3592
+ __metadata("design:type", EventEmitter)
3593
+ ], InsertKeyComponent.prototype, "visible", void 0);
3594
+ __decorate([
3595
+ Output(),
3596
+ __metadata("design:type", Object)
3597
+ ], InsertKeyComponent.prototype, "visibleChange", void 0);
3598
+ InsertKeyComponent = __decorate([
3599
+ Component({
3600
+ selector: "insert-key",
3601
+ template: "<form [formGroup]=\"formGroup\">\n <p-dialog [(visible)]=\"visible\" (visibleChange)=\"cancel()\">\n <p-header>{{'yms.insert_key_header' | translate}}</p-header>\n <div class=\"flex py-2 justify-content-center spacing-bottom\">\n <label for=\"key\">{{'yms.insert_key_label'}}</label>\n <input id=\"key\" class=\"size-input\" pInputText type=\"text\" formControlName=\"key\">\n </div>\n <div class=\"separator\"></div>\n <div class=\"spacing-top\">\n <s-button pButton label=\"{{'save' | 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 </p-dialog>\n</form>",
3602
+ 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:550px}"]
3603
+ }),
3604
+ __metadata("design:paramtypes", [FormBuilder,
3605
+ DocumentService,
3606
+ MessageService,
3607
+ TranslateService])
3608
+ ], InsertKeyComponent);
3609
+ return InsertKeyComponent;
3610
+ }());
3611
+
3582
3612
  var InsertKeyModule = /** @class */ (function () {
3583
3613
  function InsertKeyModule() {
3584
3614
  }