@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
@@ -3127,74 +3127,166 @@
3127
3127
  return DocumentService;
3128
3128
  }(EntityService));
3129
3129
 
3130
- var InsertKeyComponent = /** @class */ (function () {
3131
- function InsertKeyComponent(formBuilder, documentService, messageService, translate) {
3132
- this.formBuilder = formBuilder;
3130
+ var DocumentGridComponent = /** @class */ (function () {
3131
+ function DocumentGridComponent(translate, documentService, messageService) {
3132
+ this.translate = translate;
3133
3133
  this.documentService = documentService;
3134
3134
  this.messageService = messageService;
3135
- this.translate = translate;
3136
- this.document = new core.EventEmitter();
3135
+ this.viewDocument = new core.EventEmitter();
3136
+ this.gridData = [];
3137
+ this.ngUnsubscribe = new rxjs.Subject();
3137
3138
  }
3138
- InsertKeyComponent.prototype.ngOnInit = function () {
3139
- this.formGroup = this.formBuilder.group({
3140
- key: [undefined]
3141
- });
3139
+ DocumentGridComponent.prototype.ngOnInit = function () {
3140
+ this.gridColumns = this.getGridColumns();
3141
+ this.listDocuments();
3142
3142
  };
3143
- InsertKeyComponent.prototype.showInsertKey = function (visible) {
3144
- this.visible = visible;
3143
+ DocumentGridComponent.prototype.onChangeDocument = function (document) {
3144
+ this.gridData.push(document);
3145
+ this.disabled = false;
3145
3146
  };
3146
- InsertKeyComponent.prototype.add = function () {
3147
- this.visible = false;
3148
- if (!this.formGroup.get('key').value) {
3147
+ DocumentGridComponent.prototype.getActions = function () {
3148
+ var _this = this;
3149
+ return [
3150
+ {
3151
+ label: this.translate.instant("yms.int.wms_add_document_invoice_key"),
3152
+ command: function () {
3153
+ _this.visibleInvoiceKey = true;
3154
+ },
3155
+ icon: "fa fa-search"
3156
+ },
3157
+ {
3158
+ label: this.translate.instant("yms.int.wms_add_document_register"),
3159
+ command: function () {
3160
+ _this.edit = true;
3161
+ _this.visibleDocumentRegister = true;
3162
+ },
3163
+ icon: "fas fa-pen-square"
3164
+ }
3165
+ ];
3166
+ };
3167
+ DocumentGridComponent.prototype.getProp = function (obj, path) {
3168
+ return path.split(".").reduce(function (result, prop) { return (result[prop] === undefined ? "" : result[prop]); }, obj);
3169
+ };
3170
+ DocumentGridComponent.prototype.view = function (selection) {
3171
+ this.viewDocument.emit(selection);
3172
+ this.visibleDocumentRegister = true;
3173
+ this.edit = false;
3174
+ };
3175
+ DocumentGridComponent.prototype.save = function () {
3176
+ var _this = this;
3177
+ if (this.gridData.length > 0) {
3178
+ this.gridData.forEach(function (data) {
3179
+ if (!data.id) {
3180
+ if (!data.schedulingId) {
3181
+ data.schedulingId = _this.agenda.id;
3182
+ }
3183
+ _this.documentService.insert(data).subscribe(function () {
3184
+ _this.message("success", "saved_message_title", "saved_message_content");
3185
+ });
3186
+ _this.disabled = true;
3187
+ }
3188
+ });
3189
+ }
3190
+ };
3191
+ DocumentGridComponent.prototype.onDelete = function (selection) {
3192
+ var _this = this;
3193
+ if (!selection.id) {
3149
3194
  return;
3150
3195
  }
3151
- this.searchKey();
3196
+ this.documentService.delete(selection.id)
3197
+ .pipe(operators.takeUntil(this.ngUnsubscribe), operators.finalize(function () {
3198
+ _this.gridData = [];
3199
+ _this.listDocuments();
3200
+ })).
3201
+ subscribe(function () { return _this.message("success", "deleted_message_title", "deleted_message_content"); });
3152
3202
  };
3153
- InsertKeyComponent.prototype.searchKey = function () {
3203
+ DocumentGridComponent.prototype.listDocuments = function () {
3154
3204
  var _this = this;
3155
- var key = {
3156
- documentKeys: [this.formGroup.get('key').value],
3157
- invoices: undefined,
3158
- logistcUnitName: undefined,
3159
- size: 0,
3160
- offset: 0
3161
- };
3162
- this.documentService.findDocuments(key).subscribe(function (content) {
3163
- if (content.totalElements < 1) {
3164
- _this.message("warn", "yms.int.wms_insert_key_warning_message_header", "yms.int.wms_insert_key_warning_message_description");
3165
- return;
3205
+ this.documentService.list({
3206
+ filterQuery: "schedulingId eq '" + this.agenda.id + "'"
3207
+ })
3208
+ .subscribe(function (contents) {
3209
+ if (contents.totalElements > 0) {
3210
+ _this.gridData = contents.contents;
3211
+ _this.documentTotalRecords = contents.totalElements;
3166
3212
  }
3167
- _this.document.emit(content.contents[0]);
3168
- _this.message("success", "yms.int.wms_insert_key_success_message_header", "yms.int.wms_insert_key_success_message_description");
3169
- _this.formGroup.reset();
3213
+ else {
3214
+ _this.disabled = true;
3215
+ _this.documentTotalRecords = _this.gridData.length;
3216
+ }
3217
+ _this.loading = false;
3170
3218
  });
3171
3219
  };
3172
- InsertKeyComponent.prototype.message = function (success, header, description) {
3220
+ DocumentGridComponent.prototype.getGridColumns = function () {
3221
+ return [
3222
+ { field: "logistcUnitName", header: this.translate.instant("yms.int.wms_register_document_logistc_unit_name") },
3223
+ { field: "logistcUnitDocument", header: this.translate.instant("yms.int.wms_register_document_logistc_unit_document") },
3224
+ { field: "invoiceKey", header: this.translate.instant("yms.int.wms_register_document_invoice_key") },
3225
+ { field: "invoiceNumber", header: this.translate.instant("yms.int.wms_register_document_invoice_number") },
3226
+ { field: "invoiceSerialNumber", header: this.translate.instant("yms.int.wms_register_document_invoice_serial_number") },
3227
+ { field: "ownerName", header: this.translate.instant("yms.int.wms_register_document_owner_name") },
3228
+ { field: "ownerDocument", header: this.translate.instant("yms.int.wms_register_document_owner_document") },
3229
+ { field: "orderReceivingCode", header: this.translate.instant("yms.int.wms_register_document_order_receiving_code") },
3230
+ ];
3231
+ };
3232
+ DocumentGridComponent.prototype.message = function (severity, summary, detail) {
3173
3233
  this.messageService.add({
3174
- severity: success,
3175
- summary: this.translate.instant(header),
3176
- detail: this.translate.instant(description),
3234
+ severity: severity,
3235
+ summary: this.translate.instant(summary),
3236
+ detail: this.translate.instant(detail),
3177
3237
  });
3178
3238
  };
3179
- InsertKeyComponent.prototype.cancel = function () {
3180
- this.visible = false;
3181
- };
3239
+ __decorate([
3240
+ core.Input(),
3241
+ __metadata("design:type", Object)
3242
+ ], DocumentGridComponent.prototype, "agenda", void 0);
3243
+ __decorate([
3244
+ core.Output(),
3245
+ __metadata("design:type", Boolean)
3246
+ ], DocumentGridComponent.prototype, "visibleInvoiceKey", void 0);
3247
+ __decorate([
3248
+ core.Output(),
3249
+ __metadata("design:type", Boolean)
3250
+ ], DocumentGridComponent.prototype, "visibleDocumentRegister", void 0);
3182
3251
  __decorate([
3183
3252
  core.Output(),
3184
3253
  __metadata("design:type", core.EventEmitter)
3185
- ], InsertKeyComponent.prototype, "document", void 0);
3186
- InsertKeyComponent = __decorate([
3254
+ ], DocumentGridComponent.prototype, "viewDocument", void 0);
3255
+ __decorate([
3256
+ core.ViewChild("documentTable"),
3257
+ __metadata("design:type", table.Table)
3258
+ ], DocumentGridComponent.prototype, "table", void 0);
3259
+ __decorate([
3260
+ core.ViewChild("customTemplate"),
3261
+ __metadata("design:type", core.TemplateRef)
3262
+ ], DocumentGridComponent.prototype, "customTemplate", void 0);
3263
+ __decorate([
3264
+ core.ViewChild("customFilterFields"),
3265
+ __metadata("design:type", core.TemplateRef)
3266
+ ], DocumentGridComponent.prototype, "customFilterFields", void 0);
3267
+ __decorate([
3268
+ core.ViewChild("customGridColgroup"),
3269
+ __metadata("design:type", core.TemplateRef)
3270
+ ], DocumentGridComponent.prototype, "customGridColgroup", void 0);
3271
+ __decorate([
3272
+ core.ViewChild("customGridHeader"),
3273
+ __metadata("design:type", core.TemplateRef)
3274
+ ], DocumentGridComponent.prototype, "customGridHeader", void 0);
3275
+ __decorate([
3276
+ core.ViewChild("customGridBody"),
3277
+ __metadata("design:type", core.TemplateRef)
3278
+ ], DocumentGridComponent.prototype, "customGridBody", void 0);
3279
+ DocumentGridComponent = __decorate([
3187
3280
  core.Component({
3188
- selector: "insert-key",
3189
- 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>",
3190
- 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}"]
3281
+ selector: 'document-grid',
3282
+ 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",
3283
+ 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}"]
3191
3284
  }),
3192
- __metadata("design:paramtypes", [forms.FormBuilder,
3285
+ __metadata("design:paramtypes", [core$1.TranslateService,
3193
3286
  DocumentService,
3194
- api.MessageService,
3195
- core$1.TranslateService])
3196
- ], InsertKeyComponent);
3197
- return InsertKeyComponent;
3287
+ api.MessageService])
3288
+ ], DocumentGridComponent);
3289
+ return DocumentGridComponent;
3198
3290
  }());
3199
3291
 
3200
3292
  var moment$4 = _moment;
@@ -3363,25 +3455,27 @@
3363
3455
  this.translateService = translateService;
3364
3456
  this.agendaService = agendaService;
3365
3457
  this.document = new core.EventEmitter();
3458
+ this.visible = new core.EventEmitter();
3459
+ this.visibleChange = new core.EventEmitter();
3366
3460
  }
3367
3461
  RegisterDocumentComponent.prototype.ngOnInit = function () {
3368
3462
  this.getFormGroup();
3369
3463
  };
3370
- RegisterDocumentComponent.prototype.showRegister = function (isVisible, isEdit, document) {
3371
- if (!isVisible && !isEdit) {
3372
- return;
3373
- }
3374
- this.visible = isVisible;
3375
- this.edit = isEdit;
3376
- if (!this.edit) {
3464
+ RegisterDocumentComponent.prototype.ngOnChanges = function () {
3465
+ this.visibilityConfig();
3466
+ };
3467
+ RegisterDocumentComponent.prototype.visibilityConfig = function () {
3468
+ if (!this.edit && this.visible) {
3377
3469
  this.formGroup.disable();
3378
- this.setValuesFormGroup(document);
3470
+ this.setValuesFormGroup(this.viewDocument);
3379
3471
  this.setValueForPartner();
3380
3472
  this.hideSaveButton = true;
3473
+ return this.visible;
3381
3474
  }
3475
+ return this.visible;
3382
3476
  };
3383
3477
  RegisterDocumentComponent.prototype.close = function () {
3384
- this.visible = false;
3478
+ this.visibleChange.emit(false);
3385
3479
  };
3386
3480
  RegisterDocumentComponent.prototype.setValuesFormGroup = function (document) {
3387
3481
  this.formGroup.get('invoiceKey').setValue(document.invoiceKey);
@@ -3425,7 +3519,7 @@
3425
3519
  }
3426
3520
  this.document.emit(Document.fromDto(value));
3427
3521
  this.successMessage();
3428
- this.visible = false;
3522
+ this.visibleChange.emit(false);
3429
3523
  }
3430
3524
  };
3431
3525
  RegisterDocumentComponent.prototype.successMessage = function () {
@@ -3435,6 +3529,14 @@
3435
3529
  detail: this.translateService.instant("saved_message_content"),
3436
3530
  });
3437
3531
  };
3532
+ __decorate([
3533
+ core.Input(),
3534
+ __metadata("design:type", Document)
3535
+ ], RegisterDocumentComponent.prototype, "viewDocument", void 0);
3536
+ __decorate([
3537
+ core.Input(),
3538
+ __metadata("design:type", Boolean)
3539
+ ], RegisterDocumentComponent.prototype, "edit", void 0);
3438
3540
  __decorate([
3439
3541
  core.Input(),
3440
3542
  __metadata("design:type", Agenda)
@@ -3443,6 +3545,14 @@
3443
3545
  core.Output(),
3444
3546
  __metadata("design:type", core.EventEmitter)
3445
3547
  ], RegisterDocumentComponent.prototype, "document", void 0);
3548
+ __decorate([
3549
+ core.Input(),
3550
+ __metadata("design:type", core.EventEmitter)
3551
+ ], RegisterDocumentComponent.prototype, "visible", void 0);
3552
+ __decorate([
3553
+ core.Output(),
3554
+ __metadata("design:type", Object)
3555
+ ], RegisterDocumentComponent.prototype, "visibleChange", void 0);
3446
3556
  RegisterDocumentComponent = __decorate([
3447
3557
  core.Component({
3448
3558
  selector: "register-document",
@@ -3456,163 +3566,6 @@
3456
3566
  return RegisterDocumentComponent;
3457
3567
  }());
3458
3568
 
3459
- var DocumentGridComponent = /** @class */ (function () {
3460
- function DocumentGridComponent(translate, documentService, messageService) {
3461
- this.translate = translate;
3462
- this.documentService = documentService;
3463
- this.messageService = messageService;
3464
- this.ngUnsubscribe = new rxjs.Subject();
3465
- }
3466
- DocumentGridComponent.prototype.ngOnInit = function () {
3467
- this.gridColumns = this.getGridColumns();
3468
- this.listDocuments();
3469
- };
3470
- DocumentGridComponent.prototype.onChangeDocument = function (document) {
3471
- this.gridData.push(document);
3472
- this.disabled = true;
3473
- };
3474
- DocumentGridComponent.prototype.getActions = function () {
3475
- var _this = this;
3476
- return [
3477
- {
3478
- label: this.translate.instant("yms.int.wms_add_document_invoice_key"),
3479
- command: function () {
3480
- _this.registerDocumentComponent.showRegister(false, false);
3481
- _this.showInsertKey = true;
3482
- _this.insertKeyComponent.showInsertKey(_this.showInsertKey);
3483
- },
3484
- icon: "fa fa-search"
3485
- },
3486
- {
3487
- label: this.translate.instant("yms.int.wms_add_document_register"),
3488
- command: function () {
3489
- _this.insertKeyComponent.showInsertKey(false);
3490
- _this.showRegisterDocument = true;
3491
- _this.registerDocumentComponent.showRegister(_this.showRegisterDocument, true);
3492
- },
3493
- icon: "fas fa-pen-square"
3494
- }
3495
- ];
3496
- };
3497
- DocumentGridComponent.prototype.getProp = function (obj, path) {
3498
- return path.split(".").reduce(function (result, prop) { return (result[prop] === undefined ? "" : result[prop]); }, obj);
3499
- };
3500
- DocumentGridComponent.prototype.view = function () {
3501
- var documentSelectec = this.selection;
3502
- this.showRegisterDocument = true;
3503
- this.registerDocumentComponent.showRegister(this.showRegisterDocument, false, documentSelectec);
3504
- };
3505
- DocumentGridComponent.prototype.save = function () {
3506
- var _this = this;
3507
- if (this.gridData.length > 1) {
3508
- this.gridData.forEach(function (data) {
3509
- if (!data.id) {
3510
- if (!data.schedulingId) {
3511
- data.schedulingId = _this.agenda.id;
3512
- }
3513
- _this.documentService.insert(data).subscribe(function () {
3514
- _this.message("success", "saved_message_title", "saved_message_content");
3515
- });
3516
- _this.disabled = true;
3517
- }
3518
- });
3519
- }
3520
- };
3521
- DocumentGridComponent.prototype.onDelete = function (selection) {
3522
- var _this = this;
3523
- if (!selection.id) {
3524
- return;
3525
- }
3526
- this.documentService.delete(selection.id)
3527
- .pipe(operators.takeUntil(this.ngUnsubscribe), operators.finalize(function () {
3528
- _this.listDocuments();
3529
- })).
3530
- subscribe(function () { return _this.message("success", "deleted_message_title", "deleted_message_content"); });
3531
- };
3532
- DocumentGridComponent.prototype.listDocuments = function () {
3533
- var _this = this;
3534
- this.documentService.list({
3535
- filterQuery: "schedulingId eq '" + this.agenda.id + "'"
3536
- })
3537
- .subscribe(function (contents) {
3538
- if (contents.totalElements > 0) {
3539
- _this.gridData = contents.contents;
3540
- _this.documentTotalRecords = contents.totalElements;
3541
- }
3542
- else {
3543
- _this.disabled = true;
3544
- }
3545
- _this.loading = false;
3546
- });
3547
- };
3548
- DocumentGridComponent.prototype.getGridColumns = function () {
3549
- return [
3550
- { field: "logistcUnitName", header: this.translate.instant("yms.int.wms_register_document_logistc_unit_name") },
3551
- { field: "logistcUnitDocument", header: this.translate.instant("yms.int.wms_register_document_logistc_unit_document") },
3552
- { field: "invoiceKey", header: this.translate.instant("yms.int.wms_register_document_invoice_key") },
3553
- { field: "invoiceNumber", header: this.translate.instant("yms.int.wms_register_document_invoice_number") },
3554
- { field: "invoiceSerialNumber", header: this.translate.instant("yms.int.wms_register_document_invoice_serial_number") },
3555
- { field: "ownerName", header: this.translate.instant("yms.int.wms_register_document_owner_name") },
3556
- { field: "ownerDocument", header: this.translate.instant("yms.int.wms_register_document_owner_document") },
3557
- { field: "orderReceivingCode", header: this.translate.instant("yms.int.wms_register_document_order_receiving_code") },
3558
- ];
3559
- };
3560
- DocumentGridComponent.prototype.message = function (severity, summary, detail) {
3561
- this.messageService.add({
3562
- severity: severity,
3563
- summary: this.translate.instant(summary),
3564
- detail: this.translate.instant(detail),
3565
- });
3566
- };
3567
- __decorate([
3568
- core.Input(),
3569
- __metadata("design:type", Object)
3570
- ], DocumentGridComponent.prototype, "agenda", void 0);
3571
- __decorate([
3572
- core.ViewChild("documentTable"),
3573
- __metadata("design:type", table.Table)
3574
- ], DocumentGridComponent.prototype, "table", void 0);
3575
- __decorate([
3576
- core.ViewChild("customTemplate"),
3577
- __metadata("design:type", core.TemplateRef)
3578
- ], DocumentGridComponent.prototype, "customTemplate", void 0);
3579
- __decorate([
3580
- core.ViewChild("customFilterFields"),
3581
- __metadata("design:type", core.TemplateRef)
3582
- ], DocumentGridComponent.prototype, "customFilterFields", void 0);
3583
- __decorate([
3584
- core.ViewChild("customGridColgroup"),
3585
- __metadata("design:type", core.TemplateRef)
3586
- ], DocumentGridComponent.prototype, "customGridColgroup", void 0);
3587
- __decorate([
3588
- core.ViewChild("customGridHeader"),
3589
- __metadata("design:type", core.TemplateRef)
3590
- ], DocumentGridComponent.prototype, "customGridHeader", void 0);
3591
- __decorate([
3592
- core.ViewChild("customGridBody"),
3593
- __metadata("design:type", core.TemplateRef)
3594
- ], DocumentGridComponent.prototype, "customGridBody", void 0);
3595
- __decorate([
3596
- core.ViewChild("registerDocument"),
3597
- __metadata("design:type", RegisterDocumentComponent)
3598
- ], DocumentGridComponent.prototype, "registerDocumentComponent", void 0);
3599
- __decorate([
3600
- core.ViewChild("insertKey"),
3601
- __metadata("design:type", InsertKeyComponent)
3602
- ], DocumentGridComponent.prototype, "insertKeyComponent", void 0);
3603
- DocumentGridComponent = __decorate([
3604
- core.Component({
3605
- selector: 'document-grid',
3606
- 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",
3607
- 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}"]
3608
- }),
3609
- __metadata("design:paramtypes", [core$1.TranslateService,
3610
- DocumentService,
3611
- api.MessageService])
3612
- ], DocumentGridComponent);
3613
- return DocumentGridComponent;
3614
- }());
3615
-
3616
3569
  var RegisterDocumentModule = /** @class */ (function () {
3617
3570
  function RegisterDocumentModule() {
3618
3571
  }
@@ -3638,6 +3591,83 @@
3638
3591
  return RegisterDocumentModule;
3639
3592
  }());
3640
3593
 
3594
+ var InsertKeyComponent = /** @class */ (function () {
3595
+ function InsertKeyComponent(formBuilder, documentService, messageService, translate) {
3596
+ this.formBuilder = formBuilder;
3597
+ this.documentService = documentService;
3598
+ this.messageService = messageService;
3599
+ this.translate = translate;
3600
+ this.document = new core.EventEmitter();
3601
+ this.visible = new core.EventEmitter();
3602
+ this.visibleChange = new core.EventEmitter();
3603
+ }
3604
+ InsertKeyComponent.prototype.ngOnInit = function () {
3605
+ this.formGroup = this.formBuilder.group({
3606
+ key: [undefined]
3607
+ });
3608
+ };
3609
+ InsertKeyComponent.prototype.add = function () {
3610
+ this.visibleChange.emit(false);
3611
+ if (!this.formGroup.get('key').value) {
3612
+ return;
3613
+ }
3614
+ this.searchKey();
3615
+ };
3616
+ InsertKeyComponent.prototype.searchKey = function () {
3617
+ var _this = this;
3618
+ var key = {
3619
+ documentKeys: [this.formGroup.get('key').value],
3620
+ invoices: undefined,
3621
+ logistcUnitName: undefined,
3622
+ size: 0,
3623
+ offset: 0
3624
+ };
3625
+ this.documentService.findDocuments(key).subscribe(function (content) {
3626
+ if (content.totalElements < 1) {
3627
+ _this.message("warn", "yms.int.wms_insert_key_warning_message_header", "yms.int.wms_insert_key_warning_message_description");
3628
+ return;
3629
+ }
3630
+ _this.document.emit(content.contents[0]);
3631
+ _this.message("success", "yms.int.wms_insert_key_success_message_header", "yms.int.wms_insert_key_success_message_description");
3632
+ _this.formGroup.reset();
3633
+ });
3634
+ };
3635
+ InsertKeyComponent.prototype.message = function (success, header, description) {
3636
+ this.messageService.add({
3637
+ severity: success,
3638
+ summary: this.translate.instant(header),
3639
+ detail: this.translate.instant(description),
3640
+ });
3641
+ };
3642
+ InsertKeyComponent.prototype.cancel = function () {
3643
+ this.visibleChange.emit(false);
3644
+ };
3645
+ __decorate([
3646
+ core.Output(),
3647
+ __metadata("design:type", core.EventEmitter)
3648
+ ], InsertKeyComponent.prototype, "document", void 0);
3649
+ __decorate([
3650
+ core.Input(),
3651
+ __metadata("design:type", core.EventEmitter)
3652
+ ], InsertKeyComponent.prototype, "visible", void 0);
3653
+ __decorate([
3654
+ core.Output(),
3655
+ __metadata("design:type", Object)
3656
+ ], InsertKeyComponent.prototype, "visibleChange", void 0);
3657
+ InsertKeyComponent = __decorate([
3658
+ core.Component({
3659
+ selector: "insert-key",
3660
+ 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>",
3661
+ 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}"]
3662
+ }),
3663
+ __metadata("design:paramtypes", [forms.FormBuilder,
3664
+ DocumentService,
3665
+ api.MessageService,
3666
+ core$1.TranslateService])
3667
+ ], InsertKeyComponent);
3668
+ return InsertKeyComponent;
3669
+ }());
3670
+
3641
3671
  var InsertKeyModule = /** @class */ (function () {
3642
3672
  function InsertKeyModule() {
3643
3673
  }