@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
@@ -2862,73 +2862,162 @@ DocumentService = __decorate([
2862
2862
  __metadata("design:paramtypes", [HttpClient, MessageService])
2863
2863
  ], DocumentService);
2864
2864
 
2865
- let InsertKeyComponent = class InsertKeyComponent {
2866
- constructor(formBuilder, documentService, messageService, translate) {
2867
- this.formBuilder = formBuilder;
2865
+ let DocumentGridComponent = class DocumentGridComponent {
2866
+ constructor(translate, documentService, messageService) {
2867
+ this.translate = translate;
2868
2868
  this.documentService = documentService;
2869
2869
  this.messageService = messageService;
2870
- this.translate = translate;
2871
- this.document = new EventEmitter();
2870
+ this.viewDocument = new EventEmitter();
2871
+ this.gridData = [];
2872
+ this.ngUnsubscribe = new Subject();
2872
2873
  }
2873
2874
  ngOnInit() {
2874
- this.formGroup = this.formBuilder.group({
2875
- key: [undefined]
2876
- });
2875
+ this.gridColumns = this.getGridColumns();
2876
+ this.listDocuments();
2877
2877
  }
2878
- showInsertKey(visible) {
2879
- this.visible = visible;
2878
+ onChangeDocument(document) {
2879
+ this.gridData.push(document);
2880
+ this.disabled = false;
2880
2881
  }
2881
- add() {
2882
- this.visible = false;
2883
- if (!this.formGroup.get('key').value) {
2882
+ getActions() {
2883
+ return [
2884
+ {
2885
+ label: this.translate.instant("yms.int.wms_add_document_invoice_key"),
2886
+ command: () => {
2887
+ this.visibleInvoiceKey = true;
2888
+ },
2889
+ icon: "fa fa-search"
2890
+ },
2891
+ {
2892
+ label: this.translate.instant("yms.int.wms_add_document_register"),
2893
+ command: () => {
2894
+ this.edit = true;
2895
+ this.visibleDocumentRegister = true;
2896
+ },
2897
+ icon: "fas fa-pen-square"
2898
+ }
2899
+ ];
2900
+ }
2901
+ getProp(obj, path) {
2902
+ return path.split(".").reduce((result, prop) => (result[prop] === undefined ? "" : result[prop]), obj);
2903
+ }
2904
+ view(selection) {
2905
+ this.viewDocument.emit(selection);
2906
+ this.visibleDocumentRegister = true;
2907
+ this.edit = false;
2908
+ }
2909
+ save() {
2910
+ if (this.gridData.length > 0) {
2911
+ this.gridData.forEach(data => {
2912
+ if (!data.id) {
2913
+ if (!data.schedulingId) {
2914
+ data.schedulingId = this.agenda.id;
2915
+ }
2916
+ this.documentService.insert(data).subscribe(() => {
2917
+ this.message("success", "saved_message_title", "saved_message_content");
2918
+ });
2919
+ this.disabled = true;
2920
+ }
2921
+ });
2922
+ }
2923
+ }
2924
+ onDelete(selection) {
2925
+ if (!selection.id) {
2884
2926
  return;
2885
2927
  }
2886
- this.searchKey();
2928
+ this.documentService.delete(selection.id)
2929
+ .pipe(takeUntil(this.ngUnsubscribe), finalize(() => {
2930
+ this.gridData = [];
2931
+ this.listDocuments();
2932
+ })).
2933
+ subscribe(() => this.message("success", "deleted_message_title", "deleted_message_content"));
2887
2934
  }
2888
- searchKey() {
2889
- const key = {
2890
- documentKeys: [this.formGroup.get('key').value],
2891
- invoices: undefined,
2892
- logistcUnitName: undefined,
2893
- size: 0,
2894
- offset: 0
2895
- };
2896
- this.documentService.findDocuments(key).subscribe((content) => {
2897
- if (content.totalElements < 1) {
2898
- this.message("warn", "yms.int.wms_insert_key_warning_message_header", "yms.int.wms_insert_key_warning_message_description");
2899
- return;
2935
+ listDocuments() {
2936
+ this.documentService.list({
2937
+ filterQuery: `schedulingId eq '${this.agenda.id}'`
2938
+ })
2939
+ .subscribe((contents) => {
2940
+ if (contents.totalElements > 0) {
2941
+ this.gridData = contents.contents;
2942
+ this.documentTotalRecords = contents.totalElements;
2900
2943
  }
2901
- this.document.emit(content.contents[0]);
2902
- this.message("success", "yms.int.wms_insert_key_success_message_header", "yms.int.wms_insert_key_success_message_description");
2903
- this.formGroup.reset();
2944
+ else {
2945
+ this.disabled = true;
2946
+ this.documentTotalRecords = this.gridData.length;
2947
+ }
2948
+ this.loading = false;
2904
2949
  });
2905
2950
  }
2906
- message(success, header, description) {
2951
+ getGridColumns() {
2952
+ return [
2953
+ { field: "logistcUnitName", header: this.translate.instant("yms.int.wms_register_document_logistc_unit_name") },
2954
+ { field: "logistcUnitDocument", header: this.translate.instant("yms.int.wms_register_document_logistc_unit_document") },
2955
+ { field: "invoiceKey", header: this.translate.instant("yms.int.wms_register_document_invoice_key") },
2956
+ { field: "invoiceNumber", header: this.translate.instant("yms.int.wms_register_document_invoice_number") },
2957
+ { field: "invoiceSerialNumber", header: this.translate.instant("yms.int.wms_register_document_invoice_serial_number") },
2958
+ { field: "ownerName", header: this.translate.instant("yms.int.wms_register_document_owner_name") },
2959
+ { field: "ownerDocument", header: this.translate.instant("yms.int.wms_register_document_owner_document") },
2960
+ { field: "orderReceivingCode", header: this.translate.instant("yms.int.wms_register_document_order_receiving_code") },
2961
+ ];
2962
+ }
2963
+ message(severity, summary, detail) {
2907
2964
  this.messageService.add({
2908
- severity: success,
2909
- summary: this.translate.instant(header),
2910
- detail: this.translate.instant(description),
2965
+ severity,
2966
+ summary: this.translate.instant(summary),
2967
+ detail: this.translate.instant(detail),
2911
2968
  });
2912
2969
  }
2913
- cancel() {
2914
- this.visible = false;
2915
- }
2916
2970
  };
2971
+ __decorate([
2972
+ Input(),
2973
+ __metadata("design:type", Object)
2974
+ ], DocumentGridComponent.prototype, "agenda", void 0);
2975
+ __decorate([
2976
+ Output(),
2977
+ __metadata("design:type", Boolean)
2978
+ ], DocumentGridComponent.prototype, "visibleInvoiceKey", void 0);
2979
+ __decorate([
2980
+ Output(),
2981
+ __metadata("design:type", Boolean)
2982
+ ], DocumentGridComponent.prototype, "visibleDocumentRegister", void 0);
2917
2983
  __decorate([
2918
2984
  Output(),
2919
2985
  __metadata("design:type", EventEmitter)
2920
- ], InsertKeyComponent.prototype, "document", void 0);
2921
- InsertKeyComponent = __decorate([
2986
+ ], DocumentGridComponent.prototype, "viewDocument", void 0);
2987
+ __decorate([
2988
+ ViewChild("documentTable"),
2989
+ __metadata("design:type", Table)
2990
+ ], DocumentGridComponent.prototype, "table", void 0);
2991
+ __decorate([
2992
+ ViewChild("customTemplate"),
2993
+ __metadata("design:type", TemplateRef)
2994
+ ], DocumentGridComponent.prototype, "customTemplate", void 0);
2995
+ __decorate([
2996
+ ViewChild("customFilterFields"),
2997
+ __metadata("design:type", TemplateRef)
2998
+ ], DocumentGridComponent.prototype, "customFilterFields", void 0);
2999
+ __decorate([
3000
+ ViewChild("customGridColgroup"),
3001
+ __metadata("design:type", TemplateRef)
3002
+ ], DocumentGridComponent.prototype, "customGridColgroup", void 0);
3003
+ __decorate([
3004
+ ViewChild("customGridHeader"),
3005
+ __metadata("design:type", TemplateRef)
3006
+ ], DocumentGridComponent.prototype, "customGridHeader", void 0);
3007
+ __decorate([
3008
+ ViewChild("customGridBody"),
3009
+ __metadata("design:type", TemplateRef)
3010
+ ], DocumentGridComponent.prototype, "customGridBody", void 0);
3011
+ DocumentGridComponent = __decorate([
2922
3012
  Component({
2923
- selector: "insert-key",
2924
- 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>",
2925
- 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}"]
3013
+ selector: 'document-grid',
3014
+ 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",
3015
+ 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}"]
2926
3016
  }),
2927
- __metadata("design:paramtypes", [FormBuilder,
3017
+ __metadata("design:paramtypes", [TranslateService,
2928
3018
  DocumentService,
2929
- MessageService,
2930
- TranslateService])
2931
- ], InsertKeyComponent);
3019
+ MessageService])
3020
+ ], DocumentGridComponent);
2932
3021
 
2933
3022
  const moment$4 = _moment;
2934
3023
  class Document {
@@ -3083,25 +3172,27 @@ let RegisterDocumentComponent = class RegisterDocumentComponent {
3083
3172
  this.translateService = translateService;
3084
3173
  this.agendaService = agendaService;
3085
3174
  this.document = new EventEmitter();
3175
+ this.visible = new EventEmitter();
3176
+ this.visibleChange = new EventEmitter();
3086
3177
  }
3087
3178
  ngOnInit() {
3088
3179
  this.getFormGroup();
3089
3180
  }
3090
- showRegister(isVisible, isEdit, document) {
3091
- if (!isVisible && !isEdit) {
3092
- return;
3093
- }
3094
- this.visible = isVisible;
3095
- this.edit = isEdit;
3096
- if (!this.edit) {
3181
+ ngOnChanges() {
3182
+ this.visibilityConfig();
3183
+ }
3184
+ visibilityConfig() {
3185
+ if (!this.edit && this.visible) {
3097
3186
  this.formGroup.disable();
3098
- this.setValuesFormGroup(document);
3187
+ this.setValuesFormGroup(this.viewDocument);
3099
3188
  this.setValueForPartner();
3100
3189
  this.hideSaveButton = true;
3190
+ return this.visible;
3101
3191
  }
3192
+ return this.visible;
3102
3193
  }
3103
3194
  close() {
3104
- this.visible = false;
3195
+ this.visibleChange.emit(false);
3105
3196
  }
3106
3197
  setValuesFormGroup(document) {
3107
3198
  this.formGroup.get('invoiceKey').setValue(document.invoiceKey);
@@ -3144,7 +3235,7 @@ let RegisterDocumentComponent = class RegisterDocumentComponent {
3144
3235
  }
3145
3236
  this.document.emit(Document.fromDto(value));
3146
3237
  this.successMessage();
3147
- this.visible = false;
3238
+ this.visibleChange.emit(false);
3148
3239
  }
3149
3240
  }
3150
3241
  successMessage() {
@@ -3155,6 +3246,14 @@ let RegisterDocumentComponent = class RegisterDocumentComponent {
3155
3246
  });
3156
3247
  }
3157
3248
  };
3249
+ __decorate([
3250
+ Input(),
3251
+ __metadata("design:type", Document)
3252
+ ], RegisterDocumentComponent.prototype, "viewDocument", void 0);
3253
+ __decorate([
3254
+ Input(),
3255
+ __metadata("design:type", Boolean)
3256
+ ], RegisterDocumentComponent.prototype, "edit", void 0);
3158
3257
  __decorate([
3159
3258
  Input(),
3160
3259
  __metadata("design:type", Agenda)
@@ -3163,6 +3262,14 @@ __decorate([
3163
3262
  Output(),
3164
3263
  __metadata("design:type", EventEmitter)
3165
3264
  ], RegisterDocumentComponent.prototype, "document", void 0);
3265
+ __decorate([
3266
+ Input(),
3267
+ __metadata("design:type", EventEmitter)
3268
+ ], RegisterDocumentComponent.prototype, "visible", void 0);
3269
+ __decorate([
3270
+ Output(),
3271
+ __metadata("design:type", Object)
3272
+ ], RegisterDocumentComponent.prototype, "visibleChange", void 0);
3166
3273
  RegisterDocumentComponent = __decorate([
3167
3274
  Component({
3168
3275
  selector: "register-document",
@@ -3174,158 +3281,6 @@ RegisterDocumentComponent = __decorate([
3174
3281
  AgendaService])
3175
3282
  ], RegisterDocumentComponent);
3176
3283
 
3177
- let DocumentGridComponent = class DocumentGridComponent {
3178
- constructor(translate, documentService, messageService) {
3179
- this.translate = translate;
3180
- this.documentService = documentService;
3181
- this.messageService = messageService;
3182
- this.ngUnsubscribe = new Subject();
3183
- }
3184
- ngOnInit() {
3185
- this.gridColumns = this.getGridColumns();
3186
- this.listDocuments();
3187
- }
3188
- onChangeDocument(document) {
3189
- this.gridData.push(document);
3190
- this.disabled = true;
3191
- }
3192
- getActions() {
3193
- return [
3194
- {
3195
- label: this.translate.instant("yms.int.wms_add_document_invoice_key"),
3196
- command: () => {
3197
- this.registerDocumentComponent.showRegister(false, false);
3198
- this.showInsertKey = true;
3199
- this.insertKeyComponent.showInsertKey(this.showInsertKey);
3200
- },
3201
- icon: "fa fa-search"
3202
- },
3203
- {
3204
- label: this.translate.instant("yms.int.wms_add_document_register"),
3205
- command: () => {
3206
- this.insertKeyComponent.showInsertKey(false);
3207
- this.showRegisterDocument = true;
3208
- this.registerDocumentComponent.showRegister(this.showRegisterDocument, true);
3209
- },
3210
- icon: "fas fa-pen-square"
3211
- }
3212
- ];
3213
- }
3214
- getProp(obj, path) {
3215
- return path.split(".").reduce((result, prop) => (result[prop] === undefined ? "" : result[prop]), obj);
3216
- }
3217
- view() {
3218
- const documentSelectec = this.selection;
3219
- this.showRegisterDocument = true;
3220
- this.registerDocumentComponent.showRegister(this.showRegisterDocument, false, documentSelectec);
3221
- }
3222
- save() {
3223
- if (this.gridData.length > 1) {
3224
- this.gridData.forEach(data => {
3225
- if (!data.id) {
3226
- if (!data.schedulingId) {
3227
- data.schedulingId = this.agenda.id;
3228
- }
3229
- this.documentService.insert(data).subscribe(() => {
3230
- this.message("success", "saved_message_title", "saved_message_content");
3231
- });
3232
- this.disabled = true;
3233
- }
3234
- });
3235
- }
3236
- }
3237
- onDelete(selection) {
3238
- if (!selection.id) {
3239
- return;
3240
- }
3241
- this.documentService.delete(selection.id)
3242
- .pipe(takeUntil(this.ngUnsubscribe), finalize(() => {
3243
- this.listDocuments();
3244
- })).
3245
- subscribe(() => this.message("success", "deleted_message_title", "deleted_message_content"));
3246
- }
3247
- listDocuments() {
3248
- this.documentService.list({
3249
- filterQuery: `schedulingId eq '${this.agenda.id}'`
3250
- })
3251
- .subscribe((contents) => {
3252
- if (contents.totalElements > 0) {
3253
- this.gridData = contents.contents;
3254
- this.documentTotalRecords = contents.totalElements;
3255
- }
3256
- else {
3257
- this.disabled = true;
3258
- }
3259
- this.loading = false;
3260
- });
3261
- }
3262
- getGridColumns() {
3263
- return [
3264
- { field: "logistcUnitName", header: this.translate.instant("yms.int.wms_register_document_logistc_unit_name") },
3265
- { field: "logistcUnitDocument", header: this.translate.instant("yms.int.wms_register_document_logistc_unit_document") },
3266
- { field: "invoiceKey", header: this.translate.instant("yms.int.wms_register_document_invoice_key") },
3267
- { field: "invoiceNumber", header: this.translate.instant("yms.int.wms_register_document_invoice_number") },
3268
- { field: "invoiceSerialNumber", header: this.translate.instant("yms.int.wms_register_document_invoice_serial_number") },
3269
- { field: "ownerName", header: this.translate.instant("yms.int.wms_register_document_owner_name") },
3270
- { field: "ownerDocument", header: this.translate.instant("yms.int.wms_register_document_owner_document") },
3271
- { field: "orderReceivingCode", header: this.translate.instant("yms.int.wms_register_document_order_receiving_code") },
3272
- ];
3273
- }
3274
- message(severity, summary, detail) {
3275
- this.messageService.add({
3276
- severity,
3277
- summary: this.translate.instant(summary),
3278
- detail: this.translate.instant(detail),
3279
- });
3280
- }
3281
- };
3282
- __decorate([
3283
- Input(),
3284
- __metadata("design:type", Object)
3285
- ], DocumentGridComponent.prototype, "agenda", void 0);
3286
- __decorate([
3287
- ViewChild("documentTable"),
3288
- __metadata("design:type", Table)
3289
- ], DocumentGridComponent.prototype, "table", void 0);
3290
- __decorate([
3291
- ViewChild("customTemplate"),
3292
- __metadata("design:type", TemplateRef)
3293
- ], DocumentGridComponent.prototype, "customTemplate", void 0);
3294
- __decorate([
3295
- ViewChild("customFilterFields"),
3296
- __metadata("design:type", TemplateRef)
3297
- ], DocumentGridComponent.prototype, "customFilterFields", void 0);
3298
- __decorate([
3299
- ViewChild("customGridColgroup"),
3300
- __metadata("design:type", TemplateRef)
3301
- ], DocumentGridComponent.prototype, "customGridColgroup", void 0);
3302
- __decorate([
3303
- ViewChild("customGridHeader"),
3304
- __metadata("design:type", TemplateRef)
3305
- ], DocumentGridComponent.prototype, "customGridHeader", void 0);
3306
- __decorate([
3307
- ViewChild("customGridBody"),
3308
- __metadata("design:type", TemplateRef)
3309
- ], DocumentGridComponent.prototype, "customGridBody", void 0);
3310
- __decorate([
3311
- ViewChild("registerDocument"),
3312
- __metadata("design:type", RegisterDocumentComponent)
3313
- ], DocumentGridComponent.prototype, "registerDocumentComponent", void 0);
3314
- __decorate([
3315
- ViewChild("insertKey"),
3316
- __metadata("design:type", InsertKeyComponent)
3317
- ], DocumentGridComponent.prototype, "insertKeyComponent", void 0);
3318
- DocumentGridComponent = __decorate([
3319
- Component({
3320
- selector: 'document-grid',
3321
- 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",
3322
- 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}"]
3323
- }),
3324
- __metadata("design:paramtypes", [TranslateService,
3325
- DocumentService,
3326
- MessageService])
3327
- ], DocumentGridComponent);
3328
-
3329
3284
  let RegisterDocumentModule = class RegisterDocumentModule {
3330
3285
  };
3331
3286
  RegisterDocumentModule = __decorate([
@@ -3348,6 +3303,81 @@ RegisterDocumentModule = __decorate([
3348
3303
  })
3349
3304
  ], RegisterDocumentModule);
3350
3305
 
3306
+ let InsertKeyComponent = class InsertKeyComponent {
3307
+ constructor(formBuilder, documentService, messageService, translate) {
3308
+ this.formBuilder = formBuilder;
3309
+ this.documentService = documentService;
3310
+ this.messageService = messageService;
3311
+ this.translate = translate;
3312
+ this.document = new EventEmitter();
3313
+ this.visible = new EventEmitter();
3314
+ this.visibleChange = new EventEmitter();
3315
+ }
3316
+ ngOnInit() {
3317
+ this.formGroup = this.formBuilder.group({
3318
+ key: [undefined]
3319
+ });
3320
+ }
3321
+ add() {
3322
+ this.visibleChange.emit(false);
3323
+ if (!this.formGroup.get('key').value) {
3324
+ return;
3325
+ }
3326
+ this.searchKey();
3327
+ }
3328
+ searchKey() {
3329
+ const key = {
3330
+ documentKeys: [this.formGroup.get('key').value],
3331
+ invoices: undefined,
3332
+ logistcUnitName: undefined,
3333
+ size: 0,
3334
+ offset: 0
3335
+ };
3336
+ this.documentService.findDocuments(key).subscribe((content) => {
3337
+ if (content.totalElements < 1) {
3338
+ this.message("warn", "yms.int.wms_insert_key_warning_message_header", "yms.int.wms_insert_key_warning_message_description");
3339
+ return;
3340
+ }
3341
+ this.document.emit(content.contents[0]);
3342
+ this.message("success", "yms.int.wms_insert_key_success_message_header", "yms.int.wms_insert_key_success_message_description");
3343
+ this.formGroup.reset();
3344
+ });
3345
+ }
3346
+ message(success, header, description) {
3347
+ this.messageService.add({
3348
+ severity: success,
3349
+ summary: this.translate.instant(header),
3350
+ detail: this.translate.instant(description),
3351
+ });
3352
+ }
3353
+ cancel() {
3354
+ this.visibleChange.emit(false);
3355
+ }
3356
+ };
3357
+ __decorate([
3358
+ Output(),
3359
+ __metadata("design:type", EventEmitter)
3360
+ ], InsertKeyComponent.prototype, "document", void 0);
3361
+ __decorate([
3362
+ Input(),
3363
+ __metadata("design:type", EventEmitter)
3364
+ ], InsertKeyComponent.prototype, "visible", void 0);
3365
+ __decorate([
3366
+ Output(),
3367
+ __metadata("design:type", Object)
3368
+ ], InsertKeyComponent.prototype, "visibleChange", void 0);
3369
+ InsertKeyComponent = __decorate([
3370
+ Component({
3371
+ selector: "insert-key",
3372
+ 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>",
3373
+ 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}"]
3374
+ }),
3375
+ __metadata("design:paramtypes", [FormBuilder,
3376
+ DocumentService,
3377
+ MessageService,
3378
+ TranslateService])
3379
+ ], InsertKeyComponent);
3380
+
3351
3381
  let InsertKeyModule = class InsertKeyModule {
3352
3382
  };
3353
3383
  InsertKeyModule = __decorate([