@fluxhub/fluxhub-lib 9.0.58 → 9.0.60

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.
@@ -1,15 +1,15 @@
1
1
  import { __decorate, __metadata, __param } from 'tslib';
2
- import { forwardRef, EventEmitter, Input, Output, Component, ViewChild, ViewContainerRef, ɵɵdefineInjectable, Injectable, ɵɵinject, Directive, Inject, ElementRef, HostListener, Pipe, PLATFORM_ID, Optional, NgModule } from '@angular/core';
3
- import { NG_VALUE_ACCESSOR, NgControl, FormsModule } from '@angular/forms';
2
+ import { ɵɵdefineInjectable, Injectable, ɵɵinject, Inject, Component, EventEmitter, Input, ViewChild, ElementRef, Output, forwardRef, ViewContainerRef, Directive, HostListener, Pipe, PLATFORM_ID, Optional, NgModule } from '@angular/core';
4
3
  import { HttpHeaders, HttpClient } from '@angular/common/http';
5
4
  import { ToastrService } from 'ngx-toastr';
6
- import { map, catchError, flatMap } from 'rxjs/operators';
7
- import { Observable } from 'rxjs';
8
5
  import { SimpleCrypt } from 'ngx-simple-crypt';
9
6
  import { AES, enc } from 'crypto-js';
10
- import { MatDialogRef, MatDialog, MAT_DIALOG_DATA, MatDialogModule } from '@angular/material/dialog';
7
+ import { map, catchError, flatMap } from 'rxjs/operators';
8
+ import { MatDialogRef, MAT_DIALOG_DATA, MatDialog, MatDialogModule } from '@angular/material/dialog';
11
9
  import { FileUploader, FileUploadModule } from 'ng2-file-upload';
10
+ import { NG_VALUE_ACCESSOR, NgControl, FormsModule } from '@angular/forms';
12
11
  import { Router, ActivatedRoute } from '@angular/router';
12
+ import { Observable } from 'rxjs';
13
13
  import { SlimLoadingBarService } from 'ng2-slim-loading-bar';
14
14
  import 'ag-grid-enterprise';
15
15
  import { MatSelect, MatSelectModule } from '@angular/material/select';
@@ -70,139 +70,6 @@ import { MatSortModule } from '@angular/material/sort';
70
70
  import { MatTableModule } from '@angular/material/table';
71
71
  import { MatBadgeModule } from '@angular/material/badge';
72
72
 
73
- const noop = () => {
74
- };
75
- const ɵ0 = noop;
76
- const CUSTOM_INPUT_CONTROL_VALUE_ACCESSOR = {
77
- provide: NG_VALUE_ACCESSOR,
78
- useExisting: forwardRef(() => FHTextArea),
79
- multi: true
80
- };
81
- let FHTextArea = class FHTextArea {
82
- constructor() {
83
- this.hidden = false;
84
- this.label = "";
85
- this.enabled = true;
86
- this.required = false;
87
- this.rows = 3;
88
- this.change = new EventEmitter();
89
- this.focusout = new EventEmitter();
90
- this.focusin = new EventEmitter();
91
- this.text_v = '';
92
- this.onChange = (_) => {
93
- };
94
- this.onTouched = () => {
95
- };
96
- }
97
- onFi() {
98
- setTimeout(() => {
99
- this.focusin.emit(this.text_v);
100
- });
101
- }
102
- onFu() {
103
- setTimeout(() => {
104
- this.focusout.emit(this.text_v);
105
- });
106
- }
107
- modelch() {
108
- setTimeout(() => {
109
- this.onChange(this.text_v);
110
- this.change.emit(this.text_v);
111
- });
112
- }
113
- ngAfterViewInit() { }
114
- writeValue(value) {
115
- this.text_v = value;
116
- }
117
- registerOnChange(fn) {
118
- this.onChange = fn;
119
- }
120
- registerOnTouched(fn) {
121
- this.onTouched = fn;
122
- }
123
- };
124
- __decorate([
125
- Input(),
126
- __metadata("design:type", Boolean)
127
- ], FHTextArea.prototype, "hidden", void 0);
128
- __decorate([
129
- Input(),
130
- __metadata("design:type", String)
131
- ], FHTextArea.prototype, "label", void 0);
132
- __decorate([
133
- Input(),
134
- __metadata("design:type", Boolean)
135
- ], FHTextArea.prototype, "enabled", void 0);
136
- __decorate([
137
- Input(),
138
- __metadata("design:type", Boolean)
139
- ], FHTextArea.prototype, "required", void 0);
140
- __decorate([
141
- Input(),
142
- __metadata("design:type", Number)
143
- ], FHTextArea.prototype, "rows", void 0);
144
- __decorate([
145
- Output(),
146
- __metadata("design:type", EventEmitter)
147
- ], FHTextArea.prototype, "change", void 0);
148
- __decorate([
149
- Output(),
150
- __metadata("design:type", EventEmitter)
151
- ], FHTextArea.prototype, "focusout", void 0);
152
- __decorate([
153
- Output(),
154
- __metadata("design:type", EventEmitter)
155
- ], FHTextArea.prototype, "focusin", void 0);
156
- FHTextArea = __decorate([
157
- Component({
158
- selector: 'FHTextArea',
159
- providers: [CUSTOM_INPUT_CONTROL_VALUE_ACCESSOR],
160
- template: `
161
- <mat-form-field [hidden]="hidden" appearance="outline" floatLabel="always"><mat-label>{{label}}</mat-label>
162
- <textarea matInput [rows]="rows" type="text" [(ngModel)]="text_v" [readonly]="!enabled" [required]="required" (focusout)="onFu()" (focusin)="onFi()" (ngModelChange)="modelch()"></textarea>
163
- </mat-form-field>
164
- `,
165
- styles: [`
166
-
167
- `]
168
- }),
169
- __metadata("design:paramtypes", [])
170
- ], FHTextArea);
171
-
172
- let CheckboxEditorComponent = class CheckboxEditorComponent {
173
- constructor() {
174
- }
175
- agInit(params) {
176
- this.params = params;
177
- this.value = this.params.value;
178
- }
179
- getValue() {
180
- return this.value;
181
- }
182
- ngAfterViewInit() {
183
- setTimeout(() => {
184
- if (this.input != null)
185
- if (this.input.element != null)
186
- if (this.input.element.nativeElement != null)
187
- this.input.element.nativeElement.focus();
188
- });
189
- }
190
- };
191
- __decorate([
192
- ViewChild('input', { read: ViewContainerRef }),
193
- __metadata("design:type", Object)
194
- ], CheckboxEditorComponent.prototype, "input", void 0);
195
- CheckboxEditorComponent = __decorate([
196
- Component({
197
- selector: 'checkbox-cell',
198
- template: `
199
- <FHCheckBox [(ngModel)]="value">
200
- </FHCheckBox>
201
- `
202
- }),
203
- __metadata("design:paramtypes", [])
204
- ], CheckboxEditorComponent);
205
-
206
73
  /**
207
74
  * App service
208
75
  */
@@ -293,255 +160,69 @@ AppService = __decorate([
293
160
  })
294
161
  ], AppService);
295
162
 
296
- class QGResult {
297
- }
298
-
299
- let OdbcService = class OdbcService {
300
- constructor(http, app_s, toastr) {
301
- this.http = http;
163
+ var UtilityService_1;
164
+ let UtilityService = UtilityService_1 = class UtilityService {
165
+ constructor(app_s) {
302
166
  this.app_s = app_s;
303
- this.toastr = toastr;
304
- this.url = this.app_s.API_ENDPOINT + this.app_s.ODBC_ENDPOINT; // URL to web API
167
+ this.simpleCrypt = new SimpleCrypt();
305
168
  }
306
- doQuery(queryp, displayError = true) {
307
- this.headers = new HttpHeaders({
308
- 'Content-Type': 'application/json',
309
- 'Authorization': 'Bearer ' + localStorage.getItem(this.app_s.COMPANY_KEY + "token"),
169
+ set_home_title(s) {
170
+ setTimeout(() => { console.log('set_title->', s); this.app_s.getState().topnavTitle = s; }, 100);
171
+ }
172
+ check_value_combo(obj_value, combo_value) {
173
+ if (combo_value != null)
174
+ if (combo_value != '-1')
175
+ return combo_value;
176
+ if (obj_value != null)
177
+ return obj_value;
178
+ return combo_value;
179
+ }
180
+ gridDateRenderer(params) {
181
+ if (params.value == null)
182
+ return " ------ ";
183
+ if (params.value == "null")
184
+ return " ------ ";
185
+ let dt = UtilityService_1.prototype.string2date(params.value, 2);
186
+ if (dt == null)
187
+ return " ------ ";
188
+ if (dt.getFullYear() == 1970)
189
+ return " ------ ";
190
+ return UtilityService_1.prototype.pad(dt.getDate(), 2) + '/' +
191
+ UtilityService_1.prototype.pad(dt.getMonth() + 1, 2) + '/' +
192
+ dt.getFullYear();
193
+ }
194
+ gridDateStyle(params) {
195
+ return { 'text-align': 'center' };
196
+ }
197
+ newGuid() {
198
+ return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
199
+ var r = Math.random() * 16 | 0, v = c == 'x'
200
+ ? r
201
+ : (r & 0x3 | 0x8);
202
+ return v.toString(16);
310
203
  });
311
- this.url = this.app_s.API_ENDPOINT + this.app_s.ODBC_ENDPOINT;
312
- let post_v = JSON.stringify(queryp);
313
- return this.http.post(this.url, post_v, { headers: this.headers })
314
- .pipe(map((res) => {
315
- // Handle errors, display if enabled
316
- let err;
317
- if (!res) {
318
- err = new Error('Empty server response');
319
- }
320
- else if (res.result_msg === 'KO') {
321
- err = new Error(res.msg);
322
- }
323
- if (err) {
324
- console.error(err);
325
- if (displayError) {
326
- this.toastr.error(err.message);
327
- }
328
- throw new Error(err);
204
+ }
205
+ array_move(arr, old_index, new_index) {
206
+ if (new_index >= arr.length) {
207
+ var k = new_index - arr.length + 1;
208
+ while (k--) {
209
+ arr.push(undefined);
329
210
  }
330
- return res || new QGResult();
331
- }), catchError((err) => {
332
- // In a real world app, we might use a remote logging infrastructure
333
- // We'd also dig deeper into the error to get a better message
334
- let errMsg = (err.message) ? err.message : err.status ? `${err.status} - ${err.statusText}` : 'Server error';
335
- console.error(errMsg); // log to console instead
336
- throw err;
337
- }));
211
+ }
212
+ arr.splice(new_index, 0, arr.splice(old_index, 1)[0]);
213
+ return arr; // for testing
338
214
  }
339
- };
340
- OdbcService.ctorParameters = () => [
341
- { type: HttpClient },
342
- { type: AppService },
343
- { type: ToastrService }
344
- ];
345
- OdbcService.ɵprov = ɵɵdefineInjectable({ factory: function OdbcService_Factory() { return new OdbcService(ɵɵinject(HttpClient), ɵɵinject(AppService), ɵɵinject(ToastrService)); }, token: OdbcService, providedIn: "root" });
346
- OdbcService = __decorate([
347
- Injectable({
348
- providedIn: 'root',
349
- }),
350
- __metadata("design:paramtypes", [HttpClient, AppService, ToastrService])
351
- ], OdbcService);
352
-
353
- let FileService = class FileService {
354
- constructor(http, app_s, toastr) {
355
- this.http = http;
356
- this.app_s = app_s;
357
- this.toastr = toastr;
358
- this.url = this.app_s.API_ENDPOINT + this.app_s.FILE_ENDPOINT; // URL to web API this.app_s.API_ENDPOINT
359
- }
360
- doQuery(queryp, displayError = true) {
361
- this.headers = new HttpHeaders({
362
- 'Content-Type': 'application/json',
363
- 'Authorization': 'Bearer ' + localStorage.getItem(this.app_s.COMPANY_KEY + "token"),
364
- });
365
- this.url = this.app_s.API_ENDPOINT + this.app_s.FILE_ENDPOINT;
366
- // console.log('FileService url: '+ this.url);
367
- let post_v = JSON.stringify(queryp);
368
- // console.log(post_v);
369
- return this.http.post(this.url, post_v, {
370
- headers: this.headers
371
- }).pipe(map((res) => {
372
- // Handle errors, display if enabled
373
- let r = res;
374
- let err;
375
- if (!res) {
376
- err = new Error('Empty server response');
377
- }
378
- else if (r.result_msg === 'KO') {
379
- err = new Error(r.msg);
380
- }
381
- if (err) {
382
- console.error(err);
383
- if (displayError) {
384
- this.toastr.error(err.message);
385
- }
386
- throw new Error(err);
387
- }
388
- return res || new QGResult();
389
- }), catchError((err) => {
390
- // In a real world app, we might use a remote logging infrastructure
391
- // We'd also dig deeper into the error to get a better message
392
- let errMsg = (err.message) ? err.message : err.status ? `${err.status} - ${err.statusText}` : 'Server error';
393
- console.error(errMsg); // log to console instead
394
- throw err;
395
- }));
396
- }
397
- };
398
- FileService.ctorParameters = () => [
399
- { type: HttpClient },
400
- { type: AppService },
401
- { type: ToastrService }
402
- ];
403
- FileService.ɵprov = ɵɵdefineInjectable({ factory: function FileService_Factory() { return new FileService(ɵɵinject(HttpClient), ɵɵinject(AppService), ɵɵinject(ToastrService)); }, token: FileService, providedIn: "root" });
404
- FileService = __decorate([
405
- Injectable({
406
- providedIn: 'root',
407
- }),
408
- __metadata("design:paramtypes", [HttpClient, AppService, ToastrService])
409
- ], FileService);
410
-
411
- let AppMakerService = class AppMakerService {
412
- constructor(http, app_s, toastr) {
413
- this.http = http;
414
- this.app_s = app_s;
415
- this.toastr = toastr;
416
- this.url = this.app_s.API_ENDPOINT + this.app_s.APPMAKER_ENDPOINT; // URL to web API
417
- }
418
- doQuery(queryp, displayError = true) {
419
- this.url = this.app_s.API_ENDPOINT + this.app_s.APPMAKER_ENDPOINT;
420
- this.headers = new HttpHeaders({
421
- 'Content-Type': 'application/json',
422
- 'Authorization': 'Bearer ' + localStorage.getItem(this.app_s.COMPANY_KEY + "token"),
423
- });
424
- // console.log('AppMakerService url: '+ this.url);
425
- let post_v = JSON.stringify(queryp);
426
- // console.log(post_v);
427
- return this.http.post(this.url, post_v)
428
- .pipe(map((res) => {
429
- // Handle errors, display if enabled
430
- let r = res;
431
- let err;
432
- if (!res) {
433
- err = new Error('Empty server response');
434
- }
435
- else if (r.result_msg === 'KO') {
436
- err = new Error(r.msg);
437
- }
438
- if (err) {
439
- console.error(err);
440
- if (displayError) {
441
- this.toastr.error(err.message);
442
- }
443
- throw new Error(err);
444
- }
445
- return r || new QGResult();
446
- }), catchError((err) => {
447
- // In a real world app, we might use a remote logging infrastructure
448
- // We'd also dig deeper into the error to get a better message
449
- let errMsg = (err.message) ? err.message : err.status ? `${err.status} - ${err.statusText}` : 'Server error';
450
- console.error(errMsg); // log to console instead
451
- throw err;
452
- }));
453
- }
454
- extractData(res) {
455
- //console.log(res);
456
- let body = res.json();
457
- // console.log(body);
458
- return body || {};
459
- }
460
- handleError(error) {
461
- // In a real world app, we might use a remote logging infrastructure
462
- // We'd also dig deeper into the error to get a better message
463
- let errMsg = (error.message) ? error.message :
464
- error.status ? `${error.status} - ${error.statusText}` : 'Server error';
465
- console.error(errMsg); // log to console instead
466
- return Observable.throw(errMsg);
467
- }
468
- };
469
- AppMakerService.ctorParameters = () => [
470
- { type: HttpClient },
471
- { type: AppService },
472
- { type: ToastrService }
473
- ];
474
- AppMakerService.ɵprov = ɵɵdefineInjectable({ factory: function AppMakerService_Factory() { return new AppMakerService(ɵɵinject(HttpClient), ɵɵinject(AppService), ɵɵinject(ToastrService)); }, token: AppMakerService, providedIn: "root" });
475
- AppMakerService = __decorate([
476
- Injectable({
477
- providedIn: 'root',
478
- }),
479
- __metadata("design:paramtypes", [HttpClient, AppService, ToastrService])
480
- ], AppMakerService);
481
-
482
- var UtilityService_1;
483
- let UtilityService = UtilityService_1 = class UtilityService {
484
- constructor(app_s) {
485
- this.app_s = app_s;
486
- this.simpleCrypt = new SimpleCrypt();
487
- }
488
- set_home_title(s) {
489
- setTimeout(() => { console.log('set_title->', s); this.app_s.getState().topnavTitle = s; }, 100);
490
- }
491
- check_value_combo(obj_value, combo_value) {
492
- if (combo_value != null)
493
- if (combo_value != '-1')
494
- return combo_value;
495
- if (obj_value != null)
496
- return obj_value;
497
- return combo_value;
498
- }
499
- gridDateRenderer(params) {
500
- if (params.value == null)
501
- return " ------ ";
502
- if (params.value == "null")
503
- return " ------ ";
504
- let dt = UtilityService_1.prototype.string2date(params.value, 2);
505
- if (dt == null)
506
- return " ------ ";
507
- if (dt.getFullYear() == 1970)
508
- return " ------ ";
509
- return UtilityService_1.prototype.pad(dt.getDate(), 2) + '/' +
510
- UtilityService_1.prototype.pad(dt.getMonth() + 1, 2) + '/' +
511
- dt.getFullYear();
512
- }
513
- gridDateStyle(params) {
514
- return { 'text-align': 'center' };
515
- }
516
- newGuid() {
517
- return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
518
- var r = Math.random() * 16 | 0, v = c == 'x'
519
- ? r
520
- : (r & 0x3 | 0x8);
521
- return v.toString(16);
522
- });
523
- }
524
- array_move(arr, old_index, new_index) {
525
- if (new_index >= arr.length) {
526
- var k = new_index - arr.length + 1;
527
- while (k--) {
528
- arr.push(undefined);
529
- }
530
- }
531
- arr.splice(new_index, 0, arr.splice(old_index, 1)[0]);
532
- return arr; // for testing
533
- }
534
- format_currency(value, fractionSize = 2, DECIMAL_SEPARATOR = ',', THOUSANDS_SEPARATOR = '.', PADDING = '000000') {
535
- if ((value || "").toString().indexOf(',') > 0)
536
- value = (value || "").toString().split('.').join('').split(',').join('.');
537
- if (value == "")
538
- value = "0";
539
- let [integer, fraction = ""] = (value || "").toString().split('.');
540
- fraction = fractionSize > 0
541
- ? DECIMAL_SEPARATOR + (fraction + PADDING).substring(0, fractionSize)
542
- : "";
543
- integer = integer.replace(/\B(?=(\d{3})+(?!\d))/g, THOUSANDS_SEPARATOR);
544
- return integer + fraction;
215
+ format_currency(value, fractionSize = 2, DECIMAL_SEPARATOR = ',', THOUSANDS_SEPARATOR = '.', PADDING = '000000') {
216
+ if ((value || "").toString().indexOf(',') > 0)
217
+ value = (value || "").toString().split('.').join('').split(',').join('.');
218
+ if (value == "")
219
+ value = "0";
220
+ let [integer, fraction = ""] = (value || "").toString().split('.');
221
+ fraction = fractionSize > 0
222
+ ? DECIMAL_SEPARATOR + (fraction + PADDING).substring(0, fractionSize)
223
+ : "";
224
+ integer = integer.replace(/\B(?=(\d{3})+(?!\d))/g, THOUSANDS_SEPARATOR);
225
+ return integer + fraction;
545
226
  }
546
227
  number2bool(n) {
547
228
  if (n == null)
@@ -1004,284 +685,36 @@ UtilityService = UtilityService_1 = __decorate([
1004
685
  __metadata("design:paramtypes", [AppService])
1005
686
  ], UtilityService);
1006
687
 
1007
- let NumericEditorComponent = class NumericEditorComponent {
1008
- constructor(uti_s) {
688
+ class QGResult {
689
+ }
690
+
691
+ let QueryService = class QueryService {
692
+ constructor(http, toastr, app_s, uti_s) {
693
+ this.http = http;
694
+ this.toastr = toastr;
695
+ this.app_s = app_s;
1009
696
  this.uti_s = uti_s;
1010
- this.cancelBeforeStart = false;
1011
- }
1012
- agInit(params) {
1013
- this.params = params;
1014
- if (typeof (this.value) == "string")
1015
- this.value = this.params.value;
1016
- else
1017
- this.value = this.uti_s.format_currency(this.params.value);
1018
- // console.log('numeric editore: agInit');
1019
- // only start edit if key pressed is a number, not a letter
1020
- // this.input.element.nativeElement.select();
1021
- // this.uti_s.print_param(new QParam());
1022
- // this.input.element.nativeElement.setSelectionRange(0, String(this.value).length)
1023
- if ('1234567890,'.indexOf(params.charPress) >= 0) {
1024
- this.value = params.charPress;
1025
- setTimeout(() => {
1026
- this.uti_s.setSelectionRange(this.input.element.nativeElement, 1, String(this.value).length);
1027
- }, 100);
1028
- }
1029
- else
1030
- setTimeout(() => {
1031
- this.uti_s.setSelectionRange(this.input.element.nativeElement, 0, String(this.value).length);
1032
- }, 100);
1033
- this.cancelBeforeStart = params.charPress && ('1234567890,'.indexOf(params.charPress) < 0);
697
+ this.url = this.app_s.API_ENDPOINT + this.app_s.QUERY_ENDPOINT; // URL to web API
1034
698
  }
1035
- getValue() {
1036
- // console.log('numeric editore: getValue ['+String(this.value)+']');
1037
- if (String(this.value) == '')
1038
- return 0;
1039
- let appov = 0;
1040
- if (typeof (this.value) == "string") {
1041
- appov = parseFloat(this.value.split('.').join('').split(',').join('.'));
699
+ /**
700
+ * Perform a query on the server
701
+ *
702
+ * @param queryp the query object
703
+ * @param displayError whether to show a toaster with the error message in the UI
704
+ * @return Observable with result, throws an error if response invalid or not ok
705
+ */
706
+ doQuery(queryp, displayError = true, url_sec = null) {
707
+ if (localStorage.getItem(this.app_s.COMPANY_KEY + "token") == null) {
708
+ console.log('token non online');
709
+ return;
1042
710
  }
1043
- else
1044
- appov = this.value;
1045
- if (appov != null)
1046
- return appov;
1047
- else
1048
- return 0;
1049
- }
1050
- isCancelBeforeStart() {
1051
- return this.cancelBeforeStart;
1052
- }
1053
- // will reject the number if it greater than 1,000,000
1054
- // not very practical, but demonstrates the method.
1055
- isCancelAfterEnd() {
1056
- if (typeof (this.value) == "string")
1057
- return parseFloat(this.value.split('.').join('').split(',').join('.')) > 1000000;
1058
- else
1059
- return false;
1060
- }
1061
- ;
1062
- onKeyDown(event) {
1063
- if (!this.isKeyPressedNumeric(event)) {
1064
- if (event.preventDefault)
1065
- event.preventDefault();
1066
- }
1067
- }
1068
- // dont use afterGuiAttached for post gui events - hook into ngAfterViewInit instead for this
1069
- ngAfterViewInit() {
1070
- setTimeout(() => {
1071
- //console.log(this.input.element.nativeElement);
1072
- // this.input.first.nativeElement.focus();
1073
- if (this.input != null)
1074
- if (this.input.element != null)
1075
- if (this.input.element.nativeElement != null)
1076
- this.input.element.nativeElement.focus();
1077
- });
1078
- // this.input.element.nativeElement.setSelectionRange(0, this.input.element.nativeElement.value.length)
1079
- /*if (this.input.nativeElement.classList.contains('ng-untouched')) {
1080
- this.input.invokeElementMethod(this.input.nativeElement, 'focus', []);
1081
- }*/
1082
- }
1083
- getCharCodeFromEvent(event) {
1084
- event = event || window.event;
1085
- return (typeof event.which == "undefined") ? event.keyCode : event.which;
1086
- }
1087
- isCharNumeric(charStr) {
1088
- return !!/\d/.test(charStr);
1089
- }
1090
- isKeyPressedNumeric(event) {
1091
- var charCode = this.getCharCodeFromEvent(event);
1092
- if (charCode == 8)
1093
- return true;
1094
- if (charCode == 188)
1095
- return true;
1096
- if (charCode >= 96 && charCode <= 109)
1097
- return true;
1098
- var charStr = String.fromCharCode(charCode);
1099
- // console.log(charCode);
1100
- return this.isCharNumeric(charStr);
1101
- }
1102
- };
1103
- NumericEditorComponent.ctorParameters = () => [
1104
- { type: UtilityService }
1105
- ];
1106
- __decorate([
1107
- ViewChild('input', { read: ViewContainerRef }),
1108
- __metadata("design:type", Object)
1109
- ], NumericEditorComponent.prototype, "input", void 0);
1110
- NumericEditorComponent = __decorate([
1111
- Component({
1112
- selector: 'numeric-cell',
1113
- template: `<input #input (keydown)="onKeyDown($event)" [(ngModel)]="value" style="fontSize:40;height:30px;">`
1114
- }),
1115
- __metadata("design:paramtypes", [UtilityService])
1116
- ], NumericEditorComponent);
1117
-
1118
- let win_time_slider = class win_time_slider {
1119
- constructor(dialogRef, toastr, m_appService, uti_s) {
1120
- this.dialogRef = dialogRef;
1121
- this.toastr = toastr;
1122
- this.m_appService = m_appService;
1123
- this.uti_s = uti_s;
1124
- this.res = "";
1125
- this.h = 0;
1126
- this.m = 0;
1127
- }
1128
- close() { this.dialogRef.close(null); }
1129
- change() {
1130
- this.res = this.uti_s.pad(this.h, 2) + ":" + this.uti_s.pad(this.m, 2).replace("NaN", "00");
1131
- }
1132
- ok() {
1133
- if (this.res.length != 5) {
1134
- this.toastr.error("ERRORE", "SELEZIONARE L'ORARIO", {
1135
- timeOut: 1000,
1136
- progressBar: true,
1137
- positionClass: 'toast-bottom-right'
1138
- });
1139
- return;
1140
- }
1141
- this.dialogRef.close(this.res);
1142
- }
1143
- ngAfterViewInit() {
1144
- setTimeout(() => {
1145
- if (this.m_appService.getState().appo_dialog != null)
1146
- if (this.m_appService.getState().appo_dialog.val != null) {
1147
- let a = this.m_appService.getState().appo_dialog.val.split(':');
1148
- this.h = parseInt(a[0]);
1149
- this.m = parseInt(a[1]);
1150
- this.res = this.m_appService.getState().appo_dialog.val;
1151
- return;
1152
- }
1153
- });
1154
- }
1155
- };
1156
- win_time_slider.ctorParameters = () => [
1157
- { type: MatDialogRef },
1158
- { type: ToastrService },
1159
- { type: AppService },
1160
- { type: UtilityService }
1161
- ];
1162
- win_time_slider = __decorate([
1163
- Component({
1164
- selector: 'fhtimeslider',
1165
- template: `
1166
- <div style="width:100%" fxLayout="row" fxLayoutAlign="end start"><img src="assets/icons/x.png" style="cursor: pointer;" (click)="close()" /> </div>
1167
- <hr width="100%" size="0.5" color="#DDDDDD">
1168
-
1169
- <h2 mat-dialog-title style="min-width:300px">Seleziona Orario -> {{res}}</h2>
1170
-
1171
- <mat-dialog-content style="font-size: 15px;"><br><br>
1172
- <table>
1173
- <tr>
1174
- <td>Ore:</td>
1175
- <td>
1176
- <mat-slider
1177
- [max]="23" (change)="change()"
1178
- [min]="0"
1179
- [step]="1"
1180
- thumbLabel
1181
- [(ngModel)]="h">
1182
- </mat-slider>
1183
- </td>
1184
- </tr>
1185
- <tr>
1186
- <td>Minuti:</td>
1187
- <td>
1188
- <mat-slider
1189
- [max]="45"
1190
- [min]="0" (change)="change()"
1191
- [step]="15"
1192
- thumbLabel
1193
- [(ngModel)]="m">
1194
- </mat-slider>
1195
- </td>
1196
- </tr>
1197
- </table>
1198
- </mat-dialog-content>
1199
-
1200
-
1201
- <mat-dialog-actions>
1202
-
1203
-
1204
- <button mat-flat-button color="primary" (click)="ok()">OK</button>
1205
- <button mat-flat-button style="background-color: #F5F5F5" (click)="dialogRef.close('')">CHIUDI</button>
1206
-
1207
- </mat-dialog-actions>
1208
- `
1209
- }),
1210
- __metadata("design:paramtypes", [MatDialogRef, ToastrService, AppService, UtilityService])
1211
- ], win_time_slider);
1212
-
1213
- let DecimalMask = class DecimalMask {
1214
- constructor(model) {
1215
- this.model = model;
1216
- }
1217
- onInputChange(event, backspace) {
1218
- var valArray = event.toString().split(',');
1219
- for (var i = 0; i < valArray.length; ++i) {
1220
- valArray[i] = valArray[i].replace(/\D/g, '');
1221
- }
1222
- var newVal;
1223
- if (valArray.length === 0) {
1224
- newVal = '';
1225
- }
1226
- else {
1227
- let matches = valArray[0].match(/[0-9]{3}/mig);
1228
- if (matches !== null && valArray[0].length > 3) {
1229
- let commaGroups = Array.from(Array.from(valArray[0]).reverse().join('').match(/[0-9]{3}/mig).join()).reverse().join('');
1230
- let replacement = valArray[0].replace(commaGroups.replace(/\D/g, ''), '');
1231
- newVal = (replacement.length > 0 ? replacement + "." : "") + commaGroups;
1232
- }
1233
- else {
1234
- newVal = valArray[0];
1235
- }
1236
- if (valArray.length > 1) {
1237
- newVal += "," + valArray[1].substring(0, 2);
1238
- }
1239
- }
1240
- // set the new value
1241
- // console.log('new val:'+newVal);
1242
- this.model.valueAccessor.writeValue(newVal);
1243
- }
1244
- };
1245
- DecimalMask.ctorParameters = () => [
1246
- { type: NgControl }
1247
- ];
1248
- DecimalMask = __decorate([
1249
- Directive({
1250
- selector: '[ngModel][decimal]',
1251
- host: {
1252
- '(ngModelChange)': 'onInputChange($event)'
1253
- }
1254
- }),
1255
- __metadata("design:paramtypes", [NgControl])
1256
- ], DecimalMask);
1257
-
1258
- let QueryService = class QueryService {
1259
- constructor(http, toastr, app_s, uti_s) {
1260
- this.http = http;
1261
- this.toastr = toastr;
1262
- this.app_s = app_s;
1263
- this.uti_s = uti_s;
1264
- this.url = this.app_s.API_ENDPOINT + this.app_s.QUERY_ENDPOINT; // URL to web API
1265
- }
1266
- /**
1267
- * Perform a query on the server
1268
- *
1269
- * @param queryp the query object
1270
- * @param displayError whether to show a toaster with the error message in the UI
1271
- * @return Observable with result, throws an error if response invalid or not ok
1272
- */
1273
- doQuery(queryp, displayError = true, url_sec = null) {
1274
- if (localStorage.getItem(this.app_s.COMPANY_KEY + "token") == null) {
1275
- console.log('token non online');
1276
- return;
1277
- }
1278
- //console.log('queryp before ',queryp);
1279
- this.headers = new HttpHeaders({
1280
- 'Content-Type': 'application/json',
1281
- 'Authorization': 'Bearer ' + localStorage.getItem(this.app_s.COMPANY_KEY + "token"),
1282
- });
1283
- if (url_sec == null)
1284
- this.url = this.app_s.API_ENDPOINT + this.app_s.QUERY_ENDPOINT;
711
+ //console.log('queryp before ',queryp);
712
+ this.headers = new HttpHeaders({
713
+ 'Content-Type': 'application/json',
714
+ 'Authorization': 'Bearer ' + localStorage.getItem(this.app_s.COMPANY_KEY + "token"),
715
+ });
716
+ if (url_sec == null)
717
+ this.url = this.app_s.API_ENDPOINT + this.app_s.QUERY_ENDPOINT;
1285
718
  else
1286
719
  this.url = url_sec;
1287
720
  // console.log('QueryService url: '+ this.url);
@@ -1369,459 +802,640 @@ QueryService = __decorate([
1369
802
  ToastrService, AppService, UtilityService])
1370
803
  ], QueryService);
1371
804
 
1372
- const noop$1 = () => {
1373
- };
1374
- const ɵ0$1 = noop$1;
1375
- const CUSTOM_INPUT_CONTROL_VALUE_ACCESSOR$1 = {
1376
- provide: NG_VALUE_ACCESSOR,
1377
- useExisting: forwardRef(() => FHTimePickerComponent),
1378
- multi: true
1379
- };
1380
- let FHTimePickerComponent = class FHTimePickerComponent {
1381
- /**
1382
- *
1383
- */
1384
- constructor(_dataService, dialog, m_appService, toastr, uti_s) {
1385
- this._dataService = _dataService;
1386
- this.dialog = dialog;
1387
- this.m_appService = m_appService;
1388
- this.toastr = toastr;
1389
- this.uti_s = uti_s;
1390
- this.maxore = 23;
1391
- this.label = "";
1392
- this.enabled = true;
1393
- this.show_picker = false;
1394
- this.selchange = new EventEmitter(); // it's preferable to use standart output: '(change)'
1395
- this.ngChange = new EventEmitter();
1396
- this.h = 0;
1397
- this.m = 0;
1398
- this.res = "";
1399
- this.onChange = (_) => {
1400
- };
1401
- this.onTouched = () => {
1402
- };
805
+ class FHConfirmValues {
806
+ constructor() {
807
+ this.title_dialog = "";
808
+ this.msg_dialog = "";
1403
809
  }
1404
- uph() {
1405
- if (this.h < this.maxore) {
1406
- this.h++;
810
+ }
811
+
812
+ /**
813
+ * A Sample of how simple it is to create a new window, with its own injects.
814
+ */
815
+ let FHConfirmComponent = class FHConfirmComponent {
816
+ constructor(dialogRef, app_s, conf) {
817
+ this.dialogRef = dialogRef;
818
+ this.app_s = app_s;
819
+ this.conf = conf;
820
+ this.title = "";
821
+ this.msg = "";
822
+ this.confirm_mgs = "CONFERMA";
823
+ this.annulla_mgs = "ANNULLA";
824
+ if (conf == null) {
825
+ this.title = localStorage.getItem(this.app_s.COMPANY_KEY + "title_dialog");
826
+ this.msg = localStorage.getItem(this.app_s.COMPANY_KEY + "msg_dialog");
827
+ return;
1407
828
  }
1408
- this.sc();
829
+ this.title = conf.title_dialog;
830
+ this.msg = conf.msg_dialog;
1409
831
  }
1410
- doh() {
1411
- if (this.h > 0) {
1412
- this.h--;
1413
- }
1414
- this.sc();
832
+ close() {
833
+ this.dialogRef.close(null);
1415
834
  }
1416
- upm() {
1417
- if (this.m < 60) {
1418
- this.m++;
1419
- }
1420
- this.sc();
835
+ setTitle(texto) {
836
+ this.title = texto;
1421
837
  }
1422
- dom() {
1423
- if (this.m > 0) {
1424
- this.m--;
1425
- }
1426
- this.sc();
838
+ setMsg(texto) {
839
+ this.msg = texto;
1427
840
  }
1428
- onFu() {
1429
- if (this.h > this.maxore) {
1430
- this.h = this.maxore;
1431
- }
1432
- this.sc();
841
+ ngAfterViewInit() { }
842
+ };
843
+ FHConfirmComponent.ctorParameters = () => [
844
+ { type: MatDialogRef },
845
+ { type: AppService },
846
+ { type: FHConfirmValues, decorators: [{ type: Inject, args: [MAT_DIALOG_DATA,] }] }
847
+ ];
848
+ FHConfirmComponent = __decorate([
849
+ Component({
850
+ template: `
851
+
852
+ <h1 mat-dialog-title>{{title}}</h1>
853
+ <div mat-dialog-content style="font-size:12px">{{msg}}</div>
854
+ <div mat-dialog-actions>
855
+ <button mat-button (click)="dialogRef.close(true)" color="primary">{{confirm_mgs}}</button>
856
+ <button mat-button (click)="dialogRef.close(false)" color="warn">{{annulla_mgs}}</button>
857
+ </div>
858
+ `,
859
+ styles: [`
860
+ `]
861
+ }),
862
+ __param(2, Inject(MAT_DIALOG_DATA)),
863
+ __metadata("design:paramtypes", [MatDialogRef, AppService, FHConfirmValues])
864
+ ], FHConfirmComponent);
865
+
866
+ class QParam {
867
+ constructor() {
868
+ this.values = new Array();
869
+ this.types = new Array();
870
+ this.names = new Array();
1433
871
  }
1434
- onMi() {
1435
- if (this.m > 59) {
1436
- this.m = 59;
1437
- }
1438
- this.sc();
872
+ }
873
+
874
+ let FHListComponent = class FHListComponent {
875
+ constructor(_dataService) {
876
+ this._dataService = _dataService;
877
+ this.init_fill = true;
878
+ this.sql = "";
879
+ this.types = [];
880
+ this.values = [];
881
+ this.label = "";
882
+ this.enabled = true;
883
+ this.single_sel = false;
884
+ this.separator = ",";
885
+ this.fillend = new EventEmitter();
886
+ this.selchange = new EventEmitter();
887
+ this.initend = new EventEmitter();
888
+ this.myData = new Array();
889
+ this.selval = "-1";
890
+ this.errorMsg = "";
891
+ this.valDef = "-1";
1439
892
  }
1440
- onKeyDown(event) {
1441
- if (!this.isKeyPressedNumeric(event)) {
1442
- if (event.preventDefault) {
1443
- event.preventDefault();
1444
- }
1445
- }
1446
- this.sc();
893
+ change_v(u, o) {
894
+ u.checked = !u.checked;
895
+ this.upd_f(u, o);
1447
896
  }
1448
- onKeyDown1(event) {
1449
- if (!this.isKeyPressedNumeric(event)) {
1450
- if (event.preventDefault) {
1451
- event.preventDefault();
1452
- }
1453
- }
1454
- this.sc();
897
+ upd_f(u, b) {
898
+ if (this.single_sel)
899
+ u.checked = true;
900
+ /*console.log(b.descrizione_valore +" "+b.checked);
901
+ for(let i:number=0;i<this.myData.length;i++)
902
+ if(this.myData[i].descrizione_valore==u.descrizione_valore){
903
+ this.myData[i].checked=b.checked
904
+
905
+ break;
906
+ }*/
907
+ let o = new Object();
908
+ o.u = u;
909
+ o.b = b;
910
+ this
911
+ .selchange
912
+ .emit(o);
1455
913
  }
1456
914
  resetValue() {
1457
- this.h = 0;
1458
- this.m = 0;
915
+ for (let i = 0; i < this.myData.length; i++)
916
+ this.myData[i].checked = false;
1459
917
  }
1460
- annulla() {
1461
- this.show_picker = false;
918
+ reset() {
919
+ this.myData = new Array();
920
+ this.resetValue();
1462
921
  }
1463
- ok() {
1464
- if (this.h == 0 && this.m == 0) {
1465
- this.toastr.error("ERRORE", "SELEZIONARE L'ORARIO", {
1466
- timeOut: 1000,
1467
- progressBar: true,
1468
- positionClass: 'toast-bottom-right'
1469
- });
922
+ fillCombo() {
923
+ //(this.init_fill);
924
+ if (!this.init_fill) {
1470
925
  return;
1471
926
  }
1472
- //this.selval=this.res;
1473
- this.sc();
1474
- //this.show_picker=false;
1475
- }
1476
- change() {
1477
- this.res = this.uti_s.pad(this.h, 2) + ":" + this.uti_s.pad(this.m, 2).replace("NaN", "00");
927
+ //console.log("fillcombolist");
928
+ let p = new QParam();
929
+ p.sql = this.sql;
930
+ p.types = this.types;
931
+ p.values = this.values;
932
+ this
933
+ ._dataService
934
+ .doQuery(p)
935
+ .subscribe(data => {
936
+ let ok_op = false;
937
+ if (data != null)
938
+ if (data.result_msg == "OK") {
939
+ this.myData = data.result_data;
940
+ this.resetValue();
941
+ // console.log(this.smtr); console.log(this.smtr.nativeElement);
942
+ this.setByValue(this.valDef);
943
+ if (this.getValue() == "" && this.valDef != "-1")
944
+ this.setByDescri(this.valDef);
945
+ this.fillend.emit();
946
+ }
947
+ }, err => {
948
+ this.errorMsg = "ERRORE DI CONNESSIONE CON IL SERVER.RITENTARE PIU' TARDI [" + this.sql + "]";
949
+ });
1478
950
  }
1479
951
  setByDescri(desc_val) {
1480
- if (desc_val == null) {
1481
- desc_val = "00:00";
1482
- }
1483
- if (desc_val == '') {
1484
- desc_val = "00:00";
1485
- }
1486
- if (desc_val.indexOf(':') == -1) {
1487
- desc_val = "00:00";
1488
- }
1489
- let a = desc_val.split(':');
1490
- this.h = parseInt(a[0]);
1491
- this.m = parseInt(a[1]);
1492
- if (desc_val.length != 5) {
1493
- this.onChange(this.getValue());
1494
- }
952
+ //console.log("setByDescri "+desc_val);
953
+ this.valDef = desc_val;
954
+ if (desc_val == null)
955
+ return;
956
+ if (desc_val == "")
957
+ return;
958
+ if (this.myData == null)
959
+ return;
960
+ if (this.myData.length == 0 || this.myData[0] == null)
961
+ return;
962
+ let arr_val = desc_val.split(this.separator);
963
+ for (let j = 0; j < this.myData.length; j++)
964
+ for (let j1 = 0; j1 < arr_val.length; j1++) {
965
+ if (this.myData[j].descrizione_valore == arr_val[j1]) {
966
+ this.myData[j].checked = true;
967
+ }
968
+ }
1495
969
  }
1496
- isValidVal() {
1497
- return true;
970
+ setByIndex(ind) {
971
+ this.valDef = "";
972
+ this.selval = '-1';
973
+ if (this.myData == null)
974
+ return;
975
+ if (this.myData.length == 0 || this.myData[0] == null)
976
+ return;
977
+ if (this.myData.length > ind) {
978
+ this.setByDescri(this.myData[ind].descrizione_valore);
979
+ }
1498
980
  }
1499
981
  setByValue(desc_val) {
1500
- this.setByDescri(desc_val);
1501
- }
1502
- setValue(desc_val) {
1503
- this.setByDescri(desc_val);
1504
- }
1505
- getDescri() {
1506
- return this.uti_s.pad(this.h, 2) + ":" + this.uti_s.pad(this.m, 2).replace("NaN", "00");
1507
- }
1508
- getData(campo) {
1509
- return this.uti_s.pad(this.h, 2) + ":" + this.uti_s.pad(this.m, 2).replace("NaN", "00");
1510
- }
1511
- getObj() {
1512
- return this.uti_s.pad(this.h, 2) + ":" + this.uti_s.pad(this.m, 2).replace("NaN", "00");
1513
- }
1514
- getValue() {
1515
- return this.uti_s.pad(this.h, 2) + ":" + this.uti_s.pad(this.m, 2).replace("NaN", "00");
1516
- }
1517
- getHours() {
1518
- return this.h;
982
+ //console.log("setbyval " + desc_val);
983
+ this.valDef = desc_val;
984
+ if (desc_val == null)
985
+ return;
986
+ // console.log(this.myData);
987
+ if ("" + desc_val == "") {
988
+ // console.log('qqq1111');
989
+ return;
990
+ }
991
+ // console.log("qui");
992
+ if (this.myData == null)
993
+ return;
994
+ // console.log("qui1");
995
+ if (this.myData.length == 0 || this.myData[0] == null)
996
+ return;
997
+ //console.log("qui2");
998
+ let arr_val = desc_val.split(this.separator);
999
+ for (let j = 0; j < this.myData.length; j++)
1000
+ for (let j1 = 0; j1 < arr_val.length; j1++) {
1001
+ if (this.myData[j].valore == arr_val[j1]) {
1002
+ this.myData[j].checked = true;
1003
+ //console.log("selval: "+this.selval);
1004
+ }
1005
+ }
1519
1006
  }
1520
- getMinutes() {
1521
- return this.m;
1007
+ getDescri() {
1008
+ let sx = "";
1009
+ for (let j = 0; j < this.myData.length; j++)
1010
+ if (this.myData[j].checked) {
1011
+ if (sx != '')
1012
+ sx = sx + this.separator;
1013
+ sx = sx + this.myData[j].descrizione_valore;
1014
+ }
1015
+ return sx;
1522
1016
  }
1523
- ngAfterViewInit() {
1017
+ getObjects() {
1018
+ let sx = new Array();
1019
+ for (let j = 0; j < this.myData.length; j++)
1020
+ if (this.myData[j].checked) {
1021
+ sx.push(this.myData[j]);
1022
+ }
1023
+ return sx;
1524
1024
  }
1525
- sc() {
1526
- const value = this.getValue();
1527
- this
1528
- .selchange
1529
- .emit();
1530
- this.ngChange.emit(value);
1531
- this.onChange(value);
1025
+ getValue() {
1026
+ let sx = "";
1027
+ for (let j = 0; j < this.myData.length; j++)
1028
+ if (this.myData[j].checked) {
1029
+ if (sx != '')
1030
+ sx = sx + this.separator;
1031
+ sx = sx + this.myData[j].valore;
1032
+ }
1033
+ return sx;
1532
1034
  }
1533
- isCharNumeric(charStr) {
1534
- return !!/\d/.test(charStr);
1035
+ getData(campo) {
1036
+ for (var x in this.myData) {
1037
+ if (this.myData[x]['valore'] == this.selval) {
1038
+ return (this.myData[x][campo]);
1039
+ }
1040
+ else {
1041
+ continue;
1042
+ }
1043
+ }
1535
1044
  }
1536
- getCharCodeFromEvent(event) {
1537
- event = event || window.event;
1538
- return (typeof event.which == "undefined") ? event.keyCode : event.which;
1045
+ add_option(o) {
1046
+ o.valore = o.valore.toString();
1047
+ this.myData.push(o);
1539
1048
  }
1540
- isKeyPressedNumeric(event) {
1541
- //console.log(event.key);
1542
- if ('0123456789'.indexOf(event.key) !== -1
1543
- || event.key == "ArrowRight"
1544
- || event.key == "ArrowLeft"
1545
- || event.key == "ArrowDown"
1546
- || event.key == "ArrowUp"
1547
- || event.key == "Backspace") {
1548
- return true;
1549
- }
1550
- else {
1551
- return false;
1049
+ set_options(s) {
1050
+ this.myData = new Array();
1051
+ var a = s.split('$');
1052
+ for (let i = 0; i < a.length; i++) {
1053
+ var o = new Object();
1054
+ var av = a[i].split('|');
1055
+ o.valore = av[1];
1056
+ o.descrizione_valore = av[0];
1057
+ o.checked = false;
1058
+ this
1059
+ .myData
1060
+ .push(o);
1552
1061
  }
1062
+ this.setByValue(this.valDef);
1063
+ if (this.getValue() == "-1")
1064
+ this.setByDescri(this.valDef);
1553
1065
  }
1554
- writeValue(value) {
1555
- this.setByValue(value);
1556
- }
1557
- registerOnChange(fn) {
1558
- this.onChange = fn;
1066
+ ngAfterViewInit() {
1067
+ setTimeout(() => {
1068
+ // console.log("ngAfterViewInit"); console.log(this.init_fill);
1069
+ if (this.init_fill == true) {
1070
+ if (this.sql == '') {
1071
+ //this.errorMsg="QUERY NON CONFIGURATA";
1072
+ return;
1073
+ }
1074
+ this.fillCombo();
1075
+ }
1076
+ else {
1077
+ this.errorMsg = "";
1078
+ }
1079
+ this
1080
+ .initend
1081
+ .emit();
1082
+ });
1559
1083
  }
1560
- registerOnTouched(fn) {
1561
- this.onTouched = fn;
1084
+ sc() {
1085
+ this
1086
+ .selchange
1087
+ .emit();
1562
1088
  }
1563
- }; // -
1564
- FHTimePickerComponent.ctorParameters = () => [
1565
- { type: QueryService },
1566
- { type: MatDialog },
1567
- { type: AppService },
1568
- { type: ToastrService },
1569
- { type: UtilityService }
1089
+ };
1090
+ FHListComponent.ctorParameters = () => [
1091
+ { type: QueryService }
1570
1092
  ];
1571
1093
  __decorate([
1572
1094
  Input(),
1573
- __metadata("design:type", Number)
1574
- ], FHTimePickerComponent.prototype, "maxore", void 0);
1095
+ __metadata("design:type", Boolean)
1096
+ ], FHListComponent.prototype, "init_fill", void 0);
1575
1097
  __decorate([
1576
1098
  Input(),
1577
1099
  __metadata("design:type", String)
1578
- ], FHTimePickerComponent.prototype, "label", void 0);
1100
+ ], FHListComponent.prototype, "sql", void 0);
1101
+ __decorate([
1102
+ Input(),
1103
+ __metadata("design:type", Array)
1104
+ ], FHListComponent.prototype, "types", void 0);
1105
+ __decorate([
1106
+ Input(),
1107
+ __metadata("design:type", Array)
1108
+ ], FHListComponent.prototype, "values", void 0);
1109
+ __decorate([
1110
+ Input(),
1111
+ __metadata("design:type", String)
1112
+ ], FHListComponent.prototype, "label", void 0);
1579
1113
  __decorate([
1580
1114
  Input(),
1581
1115
  __metadata("design:type", Boolean)
1582
- ], FHTimePickerComponent.prototype, "enabled", void 0);
1116
+ ], FHListComponent.prototype, "enabled", void 0);
1117
+ __decorate([
1118
+ Input(),
1119
+ __metadata("design:type", Boolean)
1120
+ ], FHListComponent.prototype, "single_sel", void 0);
1121
+ __decorate([
1122
+ Input(),
1123
+ __metadata("design:type", String)
1124
+ ], FHListComponent.prototype, "separator", void 0);
1125
+ __decorate([
1126
+ ViewChild('cmb'),
1127
+ __metadata("design:type", ElementRef)
1128
+ ], FHListComponent.prototype, "smtr", void 0);
1583
1129
  __decorate([
1584
1130
  Output(),
1585
1131
  __metadata("design:type", EventEmitter)
1586
- ], FHTimePickerComponent.prototype, "selchange", void 0);
1132
+ ], FHListComponent.prototype, "fillend", void 0);
1587
1133
  __decorate([
1588
- Output('change'),
1134
+ Output(),
1589
1135
  __metadata("design:type", EventEmitter)
1590
- ], FHTimePickerComponent.prototype, "ngChange", void 0);
1591
- FHTimePickerComponent = __decorate([
1136
+ ], FHListComponent.prototype, "selchange", void 0);
1137
+ __decorate([
1138
+ Output(),
1139
+ __metadata("design:type", EventEmitter)
1140
+ ], FHListComponent.prototype, "initend", void 0);
1141
+ FHListComponent = __decorate([
1592
1142
  Component({
1593
- selector: 'FHTimePicker',
1594
- providers: [CUSTOM_INPUT_CONTROL_VALUE_ACCESSOR$1],
1595
- template: `
1596
- <div fxLayout="row" fxLayoutAlign="center center"><b>{{label}}</b>&nbsp;&nbsp;
1597
- <div fxLayout="column" fxLayoutAlign="center center">
1598
- <div *ngIf="enabled" class="yourClass">
1599
- <mat-icon (click)="uph()">keyboard_arrow_up</mat-icon>
1600
- </div>
1143
+ selector: 'FHList', template: `
1601
1144
 
1602
- <input
1603
- style="width:40px;text-align:center;" (keydown)="onKeyDown($event)" (focusout)="onFu()" [disabled]="!enabled"
1604
- [(ngModel)]="h">
1605
- <div class="yourClass" *ngIf="enabled">
1606
- <mat-icon class="yourClass" (click)="doh()">keyboard_arrow_down</mat-icon>
1607
- </div>
1608
- </div>
1609
1145
 
1610
- &nbsp;&nbsp;<b style="font-size:28px">:</b>&nbsp;&nbsp;
1146
+ <table class="fh_table" style="width:100%;">
1147
+ <thead>
1148
+ <tr>
1149
+ <th *ngIf="!single_sel"></th>
1150
+ <th>
1151
+ {{label}}
1152
+
1153
+ </th>
1154
+ <th *ngIf="single_sel"></th>
1155
+ </tr>
1156
+ </thead>
1157
+ <tbody>
1158
+
1159
+ <tr *ngFor="let u of myData;let odd=odd; let even=even;" [ngClass]="{ odd: odd, even: even }">
1160
+ <td style="width:20px;" valign="middle" *ngIf="!single_sel">
1161
+ <mat-slide-toggle (change)="upd_f(u,$event)" [disabled]="!enabled"
1162
+ [(ngModel)]="u.checked"></mat-slide-toggle>
1163
+ </td>
1164
+ <td (click)="change_v(u,$event)" valign="middle">{{u.descrizione_valore}}</td>
1165
+ <td valign="middle" style="width:20px;text-align: center" *ngIf="single_sel" >
1166
+
1167
+ <button mat-flat-button color="primary" (click)="upd_f(u,$event)" [disabled]="!enabled" ><mat-icon>send</mat-icon></button>&nbsp;&nbsp;&nbsp;
1168
+
1169
+
1170
+ </td>
1171
+ </tr>
1172
+ </tbody>
1173
+ </table>
1174
+
1611
1175
 
1612
- <div fxLayout="column" fxLayoutAlign="center center">
1613
- <div class="yourClass" *ngIf="enabled">
1614
- <mat-icon class="yourClass" (click)="upm()">keyboard_arrow_up</mat-icon>
1615
- </div>
1616
1176
 
1617
- <input
1618
- style="width:40px;text-align:center;" (keydown)="onKeyDown1($event)" (focusout)="onMi()" [disabled]="!enabled"
1619
- [(ngModel)]="m">
1620
- <div class="yourClass" *ngIf="enabled">
1621
- <mat-icon class="yourClass" (click)="dom()">keyboard_arrow_down</mat-icon>
1622
- </div>
1623
- </div>
1624
- </div>
1625
1177
  `,
1626
1178
  styles: [`
1627
- .hhh {
1628
- height: 63px;
1629
- width: 100px;
1630
- background-color: rgba(255, 0, 0, .1);
1631
- }
1632
1179
 
1633
- .yourClass {
1634
- cursor: pointer;
1635
- user-select: none;
1636
- }
1180
+
1637
1181
  `]
1638
1182
  }),
1639
- __metadata("design:paramtypes", [QueryService,
1640
- MatDialog,
1641
- AppService,
1642
- ToastrService,
1643
- UtilityService])
1644
- ], FHTimePickerComponent);
1645
-
1646
- let CurrencyComponent = class CurrencyComponent {
1647
- agInit(params) {
1648
- this.params = params;
1649
- }
1650
- refresh() {
1651
- return true;
1652
- }
1653
- };
1654
- CurrencyComponent = __decorate([
1655
- Component({
1656
- selector: 'currency-cell',
1657
- template: `{{params.value | currency:'EUR'}}`
1658
- })
1659
- ], CurrencyComponent);
1660
-
1661
- class FHConfirmValues {
1662
- constructor() {
1663
- this.title_dialog = "";
1664
- this.msg_dialog = "";
1665
- }
1666
- }
1183
+ __metadata("design:paramtypes", [QueryService])
1184
+ ], FHListComponent);
1667
1185
 
1668
- /**
1669
- * A Sample of how simple it is to create a new window, with its own injects.
1670
- */
1671
- let FHConfirmComponent = class FHConfirmComponent {
1672
- constructor(dialogRef, app_s, conf) {
1186
+ let WinWait = class WinWait {
1187
+ constructor(dialogRef, toastr, m_appService) {
1673
1188
  this.dialogRef = dialogRef;
1674
- this.app_s = app_s;
1675
- this.conf = conf;
1676
- this.title = "";
1677
- this.msg = "";
1678
- this.confirm_mgs = "CONFERMA";
1679
- this.annulla_mgs = "ANNULLA";
1680
- if (conf == null) {
1681
- this.title = localStorage.getItem(this.app_s.COMPANY_KEY + "title_dialog");
1682
- this.msg = localStorage.getItem(this.app_s.COMPANY_KEY + "msg_dialog");
1683
- return;
1684
- }
1685
- this.title = conf.title_dialog;
1686
- this.msg = conf.msg_dialog;
1687
- }
1688
- close() {
1689
- this.dialogRef.close(null);
1189
+ this.toastr = toastr;
1190
+ this.m_appService = m_appService;
1191
+ this.label = "";
1192
+ this.progress_p = 0;
1690
1193
  }
1691
- setTitle(texto) {
1692
- this.title = texto;
1194
+ close() { this.dialogRef.close(null); }
1195
+ update_progess(p) {
1196
+ this.progress_p = p;
1197
+ if (p == 100)
1198
+ this.dialogRef.close();
1693
1199
  }
1694
- setMsg(texto) {
1695
- this.msg = texto;
1200
+ ngAfterViewInit() {
1696
1201
  }
1697
- ngAfterViewInit() { }
1698
1202
  };
1699
- FHConfirmComponent.ctorParameters = () => [
1203
+ WinWait.ctorParameters = () => [
1700
1204
  { type: MatDialogRef },
1701
- { type: AppService },
1702
- { type: FHConfirmValues, decorators: [{ type: Inject, args: [MAT_DIALOG_DATA,] }] }
1205
+ { type: ToastrService },
1206
+ { type: AppService }
1703
1207
  ];
1704
- FHConfirmComponent = __decorate([
1208
+ __decorate([
1209
+ ViewChild('cmb_sel'),
1210
+ __metadata("design:type", FHListComponent)
1211
+ ], WinWait.prototype, "cmb_sel", void 0);
1212
+ WinWait = __decorate([
1705
1213
  Component({
1214
+ selector: 'fhwinwait',
1706
1215
  template: `
1707
1216
 
1708
- <h1 mat-dialog-title>{{title}}</h1>
1709
- <div mat-dialog-content style="font-size:12px">{{msg}}</div>
1710
- <div mat-dialog-actions>
1711
- <button mat-button (click)="dialogRef.close(true)" color="primary">{{confirm_mgs}}</button>
1712
- <button mat-button (click)="dialogRef.close(false)" color="warn">{{annulla_mgs}}</button>
1713
- </div>
1714
- `,
1715
- styles: [`
1716
- `]
1217
+ <h2 mat-dialog-title>
1218
+ {{label | uppercase}}
1219
+ </h2>
1220
+ <mat-dialog-content style="min-width:700px">
1221
+ <mat-progress-bar style="height:50px" color="accent" mode="determinate" value="{{progress_p}}"></mat-progress-bar>
1222
+ </mat-dialog-content>
1223
+
1224
+ `
1717
1225
  }),
1718
- __param(2, Inject(MAT_DIALOG_DATA)),
1719
- __metadata("design:paramtypes", [MatDialogRef, AppService, FHConfirmValues])
1720
- ], FHConfirmComponent);
1226
+ __metadata("design:paramtypes", [MatDialogRef, ToastrService, AppService])
1227
+ ], WinWait);
1721
1228
 
1722
- class QParam {
1723
- constructor() {
1724
- this.values = new Array();
1725
- this.types = new Array();
1726
- this.names = new Array();
1229
+ let OdbcService = class OdbcService {
1230
+ constructor(http, app_s, toastr) {
1231
+ this.http = http;
1232
+ this.app_s = app_s;
1233
+ this.toastr = toastr;
1234
+ this.url = this.app_s.API_ENDPOINT + this.app_s.ODBC_ENDPOINT; // URL to web API
1727
1235
  }
1728
- }
1236
+ doQuery(queryp, displayError = true) {
1237
+ this.headers = new HttpHeaders({
1238
+ 'Content-Type': 'application/json',
1239
+ 'Authorization': 'Bearer ' + localStorage.getItem(this.app_s.COMPANY_KEY + "token"),
1240
+ });
1241
+ this.url = this.app_s.API_ENDPOINT + this.app_s.ODBC_ENDPOINT;
1242
+ let post_v = JSON.stringify(queryp);
1243
+ return this.http.post(this.url, post_v, { headers: this.headers })
1244
+ .pipe(map((res) => {
1245
+ // Handle errors, display if enabled
1246
+ let err;
1247
+ if (!res) {
1248
+ err = new Error('Empty server response');
1249
+ }
1250
+ else if (res.result_msg === 'KO') {
1251
+ err = new Error(res.msg);
1252
+ }
1253
+ if (err) {
1254
+ console.error(err);
1255
+ if (displayError) {
1256
+ this.toastr.error(err.message);
1257
+ }
1258
+ throw new Error(err);
1259
+ }
1260
+ return res || new QGResult();
1261
+ }), catchError((err) => {
1262
+ // In a real world app, we might use a remote logging infrastructure
1263
+ // We'd also dig deeper into the error to get a better message
1264
+ let errMsg = (err.message) ? err.message : err.status ? `${err.status} - ${err.statusText}` : 'Server error';
1265
+ console.error(errMsg); // log to console instead
1266
+ throw err;
1267
+ }));
1268
+ }
1269
+ };
1270
+ OdbcService.ctorParameters = () => [
1271
+ { type: HttpClient },
1272
+ { type: AppService },
1273
+ { type: ToastrService }
1274
+ ];
1275
+ OdbcService.ɵprov = ɵɵdefineInjectable({ factory: function OdbcService_Factory() { return new OdbcService(ɵɵinject(HttpClient), ɵɵinject(AppService), ɵɵinject(ToastrService)); }, token: OdbcService, providedIn: "root" });
1276
+ OdbcService = __decorate([
1277
+ Injectable({
1278
+ providedIn: 'root',
1279
+ }),
1280
+ __metadata("design:paramtypes", [HttpClient, AppService, ToastrService])
1281
+ ], OdbcService);
1729
1282
 
1730
- let FHListComponent = class FHListComponent {
1731
- constructor(_dataService) {
1283
+ const noop = () => {
1284
+ };
1285
+ const ɵ0 = noop;
1286
+ const CUSTOM_INPUT_CONTROL_VALUE_ACCESSOR = {
1287
+ provide: NG_VALUE_ACCESSOR,
1288
+ useExisting: forwardRef(() => FHComboboxComponent),
1289
+ multi: true
1290
+ };
1291
+ let FHComboboxComponent = class FHComboboxComponent {
1292
+ constructor(_dataService, _dataService_odbc) {
1732
1293
  this._dataService = _dataService;
1294
+ this._dataService_odbc = _dataService_odbc;
1733
1295
  this.init_fill = true;
1734
1296
  this.sql = "";
1735
1297
  this.types = [];
1736
1298
  this.values = [];
1299
+ this.hidden = false;
1737
1300
  this.label = "";
1738
1301
  this.enabled = true;
1739
- this.single_sel = false;
1740
- this.separator = ",";
1302
+ this.required = false;
1303
+ this.sel_label = "";
1741
1304
  this.fillend = new EventEmitter();
1742
1305
  this.selchange = new EventEmitter();
1743
1306
  this.initend = new EventEmitter();
1744
- this.myData = new Array();
1307
+ this.myData = [];
1308
+ this.valDef = "-1";
1745
1309
  this.selval = "-1";
1746
1310
  this.errorMsg = "";
1747
- this.valDef = "-1";
1311
+ this.db_type = "1";
1312
+ this.dis_value = '';
1313
+ this.descri_val = "";
1314
+ this.onChange = (_) => {
1315
+ };
1316
+ this.onTouched = () => {
1317
+ };
1748
1318
  }
1749
- change_v(u, o) {
1750
- u.checked = !u.checked;
1751
- this.upd_f(u, o);
1319
+ setValue(desc_val) {
1320
+ this.setByValue(desc_val);
1752
1321
  }
1753
- upd_f(u, b) {
1754
- if (this.single_sel)
1755
- u.checked = true;
1756
- /*console.log(b.descrizione_valore +" "+b.checked);
1757
- for(let i:number=0;i<this.myData.length;i++)
1758
- if(this.myData[i].descrizione_valore==u.descrizione_valore){
1759
- this.myData[i].checked=b.checked
1760
-
1761
- break;
1762
- }*/
1763
- let o = new Object();
1764
- o.u = u;
1765
- o.b = b;
1766
- this
1767
- .selchange
1768
- .emit(o);
1322
+ update_dis() {
1323
+ this.dis_value = '';
1324
+ try {
1325
+ if (this.descri_val != null)
1326
+ if (this.descri_val != "") {
1327
+ this.dis_value = this.descri_val;
1328
+ return;
1329
+ }
1330
+ if (this.valDef == null)
1331
+ this.dis_value = '';
1332
+ else
1333
+ this.dis_value = this.valDef.split('-1').join('');
1334
+ }
1335
+ catch (e) {
1336
+ console.log('errore split -> this.valDef ', this.valDef);
1337
+ }
1769
1338
  }
1770
1339
  resetValue() {
1771
- for (let i = 0; i < this.myData.length; i++)
1772
- this.myData[i].checked = false;
1340
+ this.selval = '-1';
1341
+ this.valDef = '-1';
1342
+ this.update_dis();
1343
+ }
1344
+ focus() {
1345
+ this.smtr.nativeElement.focus();
1773
1346
  }
1774
1347
  reset() {
1348
+ console.log('reset');
1349
+ this.selval = '-1';
1350
+ this.valDef = '-1';
1775
1351
  this.myData = new Array();
1776
- this.resetValue();
1352
+ this.update_dis();
1777
1353
  }
1778
1354
  fillCombo() {
1779
- //(this.init_fill);
1780
- if (!this.init_fill) {
1355
+ // console.log(this.init_fill);
1356
+ // if(!this.init_fill){this.init_fill=true;return;}
1357
+ if (this.sql == null)
1358
+ this.sql = '';
1359
+ if (this.sql.indexOf('|') != -1 && this.sql.indexOf('$') != -1) {
1360
+ this.set_options(this.sql);
1781
1361
  return;
1782
1362
  }
1783
- //console.log("fillcombolist");
1784
1363
  let p = new QParam();
1785
1364
  p.sql = this.sql;
1786
1365
  p.types = this.types;
1787
1366
  p.values = this.values;
1788
- this
1789
- ._dataService
1790
- .doQuery(p)
1791
- .subscribe(data => {
1792
- let ok_op = false;
1793
- if (data != null)
1794
- if (data.result_msg == "OK") {
1795
- this.myData = data.result_data;
1796
- this.resetValue();
1797
- // console.log(this.smtr); console.log(this.smtr.nativeElement);
1798
- this.setByValue(this.valDef);
1799
- if (this.getValue() == "" && this.valDef != "-1")
1800
- this.setByDescri(this.valDef);
1801
- this.fillend.emit();
1367
+ let ok_op = false;
1368
+ // console.log(p);
1369
+ if (this.db_type == "1")
1370
+ this
1371
+ ._dataService
1372
+ .doQuery(p)
1373
+ .subscribe(data => {
1374
+ let ok_op = false;
1375
+ if (data != null)
1376
+ if (data.result_msg == "OK") {
1377
+ this.resetD(data.result_data);
1378
+ ok_op = true;
1379
+ }
1380
+ if (!ok_op) {
1802
1381
  }
1803
- }, err => {
1804
- this.errorMsg = "ERRORE DI CONNESSIONE CON IL SERVER.RITENTARE PIU' TARDI [" + this.sql + "]";
1805
- });
1382
+ }, err => {
1383
+ this.errorMsg = "ERRORE DI CONNESSIONE CON IL SERVER.RITENTARE PIU' TARDI [" + this.sql + "]";
1384
+ });
1385
+ if (this.db_type == "2")
1386
+ this
1387
+ ._dataService_odbc
1388
+ .doQuery(p)
1389
+ .subscribe(data => {
1390
+ let ok_op = false;
1391
+ if (data != null)
1392
+ if (data.result_msg == "OK") {
1393
+ for (let i = 0; i < data.result_data.length; i++) {
1394
+ if (data.result_data[i].VALORE != null)
1395
+ data.result_data[i].valore = data.result_data[i].VALORE;
1396
+ if (data.result_data[i].DESCRIZIONE_VALORE != null)
1397
+ data.result_data[i].descrizione_valore = data.result_data[i].DESCRIZIONE_VALORE;
1398
+ }
1399
+ this.resetD(data.result_data);
1400
+ ok_op = true;
1401
+ }
1402
+ if (!ok_op) {
1403
+ }
1404
+ }, err => {
1405
+ this.errorMsg = "ERRORE DI CONNESSIONE CON IL SERVER.RITENTARE PIU' TARDI [" + this.sql + "]";
1406
+ });
1407
+ }
1408
+ add_option(o) {
1409
+ this.myData.push(o);
1410
+ }
1411
+ resetD(o) {
1412
+ this.myData = o;
1413
+ this.selval = '-1';
1414
+ // console.log(this.smtr); console.log(this.smtr.nativeElement);
1415
+ this.setByValue(this.valDef);
1416
+ if (this.getValue() == "-1" && this.valDef != "-1")
1417
+ this.setByDescri(this.valDef);
1418
+ this.fillend.emit();
1806
1419
  }
1807
1420
  setByDescri(desc_val) {
1808
- //console.log("setByDescri "+desc_val);
1421
+ // console.log("setByDescri "+desc_val);
1809
1422
  this.valDef = desc_val;
1810
- if (desc_val == null)
1811
- return;
1423
+ this.selval = '-1';
1812
1424
  if (desc_val == "")
1813
1425
  return;
1814
1426
  if (this.myData == null)
1815
1427
  return;
1816
1428
  if (this.myData.length == 0 || this.myData[0] == null)
1817
1429
  return;
1818
- let arr_val = desc_val.split(this.separator);
1819
1430
  for (let j = 0; j < this.myData.length; j++)
1820
- for (let j1 = 0; j1 < arr_val.length; j1++) {
1821
- if (this.myData[j].descrizione_valore == arr_val[j1]) {
1822
- this.myData[j].checked = true;
1823
- }
1431
+ if (this.myData[j].descrizione_valore == desc_val) {
1432
+ this.selval = "" + this.myData[j].valore;
1433
+ if (this.myData[j].descrizione_valore != null)
1434
+ this.descri_val = this.myData[j].descrizione_valore;
1435
+ this.update_dis();
1436
+ return;
1824
1437
  }
1438
+ this.update_dis();
1825
1439
  }
1826
1440
  setByIndex(ind) {
1827
1441
  this.valDef = "";
@@ -1834,11 +1448,20 @@ let FHListComponent = class FHListComponent {
1834
1448
  this.setByDescri(this.myData[ind].descrizione_valore);
1835
1449
  }
1836
1450
  }
1451
+ getObj() {
1452
+ if (this.selval == null)
1453
+ return null;
1454
+ if (this.selval == "-1")
1455
+ return null;
1456
+ else
1457
+ for (let j = 0; j < this.myData.length; j++)
1458
+ if (this.myData[j].valore == this.selval) {
1459
+ return this.myData[j];
1460
+ }
1461
+ }
1837
1462
  setByValue(desc_val) {
1838
- //console.log("setbyval " + desc_val);
1839
1463
  this.valDef = desc_val;
1840
- if (desc_val == null)
1841
- return;
1464
+ this.selval = '-1';
1842
1465
  // console.log(this.myData);
1843
1466
  if ("" + desc_val == "") {
1844
1467
  // console.log('qqq1111');
@@ -1851,42 +1474,49 @@ let FHListComponent = class FHListComponent {
1851
1474
  if (this.myData.length == 0 || this.myData[0] == null)
1852
1475
  return;
1853
1476
  //console.log("qui2");
1854
- let arr_val = desc_val.split(this.separator);
1855
- for (let j = 0; j < this.myData.length; j++)
1856
- for (let j1 = 0; j1 < arr_val.length; j1++) {
1857
- if (this.myData[j].valore == arr_val[j1]) {
1858
- this.myData[j].checked = true;
1859
- //console.log("selval: "+this.selval);
1860
- }
1477
+ for (let j = 0; j < this.myData.length; j++) {
1478
+ //console.log(this.myData[j].valore +' '+ desc_val);
1479
+ if (this.myData[j].valore == desc_val) {
1480
+ this.selval = "" + this.myData[j].valore;
1481
+ if (this.myData[j].descrizione_valore != null)
1482
+ this.descri_val = this.myData[j].descrizione_valore;
1483
+ this.update_dis();
1484
+ return;
1861
1485
  }
1486
+ }
1487
+ this.update_dis();
1862
1488
  }
1863
1489
  getDescri() {
1864
- let sx = "";
1865
- for (let j = 0; j < this.myData.length; j++)
1866
- if (this.myData[j].checked) {
1867
- if (sx != '')
1868
- sx = sx + this.separator;
1869
- sx = sx + this.myData[j].descrizione_valore;
1870
- }
1871
- return sx;
1872
- }
1873
- getObjects() {
1874
- let sx = new Array();
1875
- for (let j = 0; j < this.myData.length; j++)
1876
- if (this.myData[j].checked) {
1877
- sx.push(this.myData[j]);
1878
- }
1879
- return sx;
1490
+ if (!this.enabled) {
1491
+ if (this.selval == null)
1492
+ return this.valDef;
1493
+ if (this.selval == "-1")
1494
+ return this.valDef;
1495
+ }
1496
+ if (this.selval == null)
1497
+ return "-1";
1498
+ if (this.selval == "-1")
1499
+ return "-1";
1500
+ else
1501
+ for (let j = 0; j < this.myData.length; j++)
1502
+ if (this.myData[j].valore == this.selval) {
1503
+ return this.myData[j].descrizione_valore;
1504
+ }
1880
1505
  }
1881
1506
  getValue() {
1882
- let sx = "";
1883
- for (let j = 0; j < this.myData.length; j++)
1884
- if (this.myData[j].checked) {
1885
- if (sx != '')
1886
- sx = sx + this.separator;
1887
- sx = sx + this.myData[j].valore;
1888
- }
1889
- return sx;
1507
+ // console.log(this.selval);
1508
+ if (!this.enabled) {
1509
+ if (this.selval == null)
1510
+ return this.valDef;
1511
+ if (this.selval == "-1")
1512
+ return this.valDef;
1513
+ }
1514
+ if (this.selval == null)
1515
+ return "-1";
1516
+ if (this.selval == "")
1517
+ return "-1";
1518
+ else
1519
+ return this.selval;
1890
1520
  }
1891
1521
  getData(campo) {
1892
1522
  for (var x in this.myData) {
@@ -1898,19 +1528,14 @@ let FHListComponent = class FHListComponent {
1898
1528
  }
1899
1529
  }
1900
1530
  }
1901
- add_option(o) {
1902
- o.valore = o.valore.toString();
1903
- this.myData.push(o);
1904
- }
1905
1531
  set_options(s) {
1906
1532
  this.myData = new Array();
1907
- var a = s.split('$');
1533
+ let a = s.split('$');
1908
1534
  for (let i = 0; i < a.length; i++) {
1909
1535
  var o = new Object();
1910
1536
  var av = a[i].split('|');
1911
1537
  o.valore = av[1];
1912
1538
  o.descrizione_valore = av[0];
1913
- o.checked = false;
1914
1539
  this
1915
1540
  .myData
1916
1541
  .push(o);
@@ -1921,7 +1546,6 @@ let FHListComponent = class FHListComponent {
1921
1546
  }
1922
1547
  ngAfterViewInit() {
1923
1548
  setTimeout(() => {
1924
- // console.log("ngAfterViewInit"); console.log(this.init_fill);
1925
1549
  if (this.init_fill == true) {
1926
1550
  if (this.sql == '') {
1927
1551
  //this.errorMsg="QUERY NON CONFIGURATA";
@@ -1938,993 +1562,625 @@ let FHListComponent = class FHListComponent {
1938
1562
  });
1939
1563
  }
1940
1564
  sc() {
1565
+ this.onChange(this.getValue());
1941
1566
  this
1942
1567
  .selchange
1943
- .emit();
1568
+ .emit({ event: this.getObj(), valore: this.getValue(), descrizione_valore: this.getDescri() });
1569
+ }
1570
+ getModelValue() {
1571
+ const value = this.getData('valore');
1572
+ return value;
1573
+ }
1574
+ writeValue(value) {
1575
+ this.setByValue(value);
1576
+ }
1577
+ registerOnChange(fn) {
1578
+ this.onChange = fn;
1579
+ }
1580
+ registerOnTouched(fn) {
1581
+ this.onTouched = fn;
1944
1582
  }
1945
1583
  };
1946
- FHListComponent.ctorParameters = () => [
1947
- { type: QueryService }
1584
+ FHComboboxComponent.ctorParameters = () => [
1585
+ { type: QueryService },
1586
+ { type: OdbcService }
1948
1587
  ];
1949
1588
  __decorate([
1950
1589
  Input(),
1951
1590
  __metadata("design:type", Boolean)
1952
- ], FHListComponent.prototype, "init_fill", void 0);
1591
+ ], FHComboboxComponent.prototype, "init_fill", void 0);
1953
1592
  __decorate([
1954
1593
  Input(),
1955
1594
  __metadata("design:type", String)
1956
- ], FHListComponent.prototype, "sql", void 0);
1595
+ ], FHComboboxComponent.prototype, "sql", void 0);
1957
1596
  __decorate([
1958
1597
  Input(),
1959
1598
  __metadata("design:type", Array)
1960
- ], FHListComponent.prototype, "types", void 0);
1599
+ ], FHComboboxComponent.prototype, "types", void 0);
1961
1600
  __decorate([
1962
1601
  Input(),
1963
1602
  __metadata("design:type", Array)
1964
- ], FHListComponent.prototype, "values", void 0);
1603
+ ], FHComboboxComponent.prototype, "values", void 0);
1604
+ __decorate([
1605
+ Input(),
1606
+ __metadata("design:type", Boolean)
1607
+ ], FHComboboxComponent.prototype, "hidden", void 0);
1965
1608
  __decorate([
1966
1609
  Input(),
1967
1610
  __metadata("design:type", String)
1968
- ], FHListComponent.prototype, "label", void 0);
1611
+ ], FHComboboxComponent.prototype, "label", void 0);
1969
1612
  __decorate([
1970
1613
  Input(),
1971
1614
  __metadata("design:type", Boolean)
1972
- ], FHListComponent.prototype, "enabled", void 0);
1615
+ ], FHComboboxComponent.prototype, "enabled", void 0);
1973
1616
  __decorate([
1974
1617
  Input(),
1975
1618
  __metadata("design:type", Boolean)
1976
- ], FHListComponent.prototype, "single_sel", void 0);
1619
+ ], FHComboboxComponent.prototype, "required", void 0);
1977
1620
  __decorate([
1978
1621
  Input(),
1979
1622
  __metadata("design:type", String)
1980
- ], FHListComponent.prototype, "separator", void 0);
1623
+ ], FHComboboxComponent.prototype, "sel_label", void 0);
1981
1624
  __decorate([
1982
1625
  ViewChild('cmb'),
1983
1626
  __metadata("design:type", ElementRef)
1984
- ], FHListComponent.prototype, "smtr", void 0);
1627
+ ], FHComboboxComponent.prototype, "smtr", void 0);
1985
1628
  __decorate([
1986
1629
  Output(),
1987
1630
  __metadata("design:type", EventEmitter)
1988
- ], FHListComponent.prototype, "fillend", void 0);
1631
+ ], FHComboboxComponent.prototype, "fillend", void 0);
1989
1632
  __decorate([
1990
1633
  Output(),
1991
1634
  __metadata("design:type", EventEmitter)
1992
- ], FHListComponent.prototype, "selchange", void 0);
1635
+ ], FHComboboxComponent.prototype, "selchange", void 0);
1993
1636
  __decorate([
1994
1637
  Output(),
1995
1638
  __metadata("design:type", EventEmitter)
1996
- ], FHListComponent.prototype, "initend", void 0);
1997
- FHListComponent = __decorate([
1639
+ ], FHComboboxComponent.prototype, "initend", void 0);
1640
+ __decorate([
1641
+ Input(),
1642
+ __metadata("design:type", String)
1643
+ ], FHComboboxComponent.prototype, "valDef", void 0);
1644
+ __decorate([
1645
+ Input(),
1646
+ __metadata("design:type", String)
1647
+ ], FHComboboxComponent.prototype, "db_type", void 0);
1648
+ FHComboboxComponent = __decorate([
1998
1649
  Component({
1999
- selector: 'FHList', template: `
2000
-
2001
-
2002
- <table class="fh_table" style="width:100%;">
2003
- <thead>
2004
- <tr>
2005
- <th *ngIf="!single_sel"></th>
2006
- <th>
2007
- {{label}}
2008
-
2009
- </th>
2010
- <th *ngIf="single_sel"></th>
2011
- </tr>
2012
- </thead>
2013
- <tbody>
2014
-
2015
- <tr *ngFor="let u of myData;let odd=odd; let even=even;" [ngClass]="{ odd: odd, even: even }">
2016
- <td style="width:20px;" valign="middle" *ngIf="!single_sel">
2017
- <mat-slide-toggle (change)="upd_f(u,$event)" [disabled]="!enabled"
2018
- [(ngModel)]="u.checked"></mat-slide-toggle>
2019
- </td>
2020
- <td (click)="change_v(u,$event)" valign="middle">{{u.descrizione_valore}}</td>
2021
- <td valign="middle" style="width:20px;text-align: center" *ngIf="single_sel" >
2022
-
2023
- <button mat-flat-button color="primary" (click)="upd_f(u,$event)" [disabled]="!enabled" ><mat-icon>send</mat-icon></button>&nbsp;&nbsp;&nbsp;
2024
-
2025
-
2026
- </td>
2027
- </tr>
2028
- </tbody>
2029
- </table>
2030
-
2031
-
2032
-
2033
- `,
2034
- styles: [`
1650
+ selector: 'FHComboBox',
1651
+ providers: [CUSTOM_INPUT_CONTROL_VALUE_ACCESSOR],
1652
+ template: `
1653
+ <mat-form-field [hidden]="!enabled || hidden" appearance="outline" floatLabel="always"><mat-label>{{label}}</mat-label>
1654
+ <mat-select #cmb [(ngModel)]="selval" (selectionChange)="sc()" [required]="required">
1655
+ <mat-option value="-1">{{sel_label}}</mat-option>
1656
+ <mat-option value="{{app.valore}}" *ngFor="let app of myData">{{app.descrizione_valore}}</mat-option>
1657
+ </mat-select>
1658
+ </mat-form-field>
2035
1659
 
1660
+ <mat-form-field [hidden]="enabled || hidden" appearance="outline" floatLabel="always"><mat-label>{{label}}</mat-label>
1661
+ <input type="text" #el1 matInput [disabled]="true" [(ngModel)]="dis_value">
1662
+ </mat-form-field>
1663
+ `,
1664
+ styles: [`
2036
1665
 
2037
1666
  `]
2038
1667
  }),
2039
- __metadata("design:paramtypes", [QueryService])
2040
- ], FHListComponent);
2041
-
2042
- let WinWait = class WinWait {
2043
- constructor(dialogRef, toastr, m_appService) {
2044
- this.dialogRef = dialogRef;
2045
- this.toastr = toastr;
2046
- this.m_appService = m_appService;
2047
- this.label = "";
2048
- this.progress_p = 0;
2049
- }
2050
- close() { this.dialogRef.close(null); }
2051
- update_progess(p) {
2052
- this.progress_p = p;
2053
- if (p == 100)
2054
- this.dialogRef.close();
2055
- }
2056
- ngAfterViewInit() {
2057
- }
2058
- };
2059
- WinWait.ctorParameters = () => [
2060
- { type: MatDialogRef },
2061
- { type: ToastrService },
2062
- { type: AppService }
2063
- ];
2064
- __decorate([
2065
- ViewChild('cmb_sel'),
2066
- __metadata("design:type", FHListComponent)
2067
- ], WinWait.prototype, "cmb_sel", void 0);
2068
- WinWait = __decorate([
2069
- Component({
2070
- selector: 'fhwinwait',
2071
- template: `
2072
-
2073
- <h2 mat-dialog-title>
2074
- {{label | uppercase}}
2075
- </h2>
2076
- <mat-dialog-content style="min-width:700px">
2077
- <mat-progress-bar style="height:50px" color="accent" mode="determinate" value="{{progress_p}}"></mat-progress-bar>
2078
- </mat-dialog-content>
2079
-
2080
- `
2081
- }),
2082
- __metadata("design:paramtypes", [MatDialogRef, ToastrService, AppService])
2083
- ], WinWait);
1668
+ __metadata("design:paramtypes", [QueryService, OdbcService])
1669
+ ], FHComboboxComponent);
2084
1670
 
2085
- const noop$2 = () => {
2086
- };
2087
- const ɵ0$2 = noop$2;
2088
- const CUSTOM_INPUT_CONTROL_VALUE_ACCESSOR$2 = {
2089
- provide: NG_VALUE_ACCESSOR,
2090
- useExisting: forwardRef(() => FHComboboxComponent),
2091
- multi: true
2092
- };
2093
- let FHComboboxComponent = class FHComboboxComponent {
2094
- constructor(_dataService, _dataService_odbc) {
1671
+ let FHUploadComponent = class FHUploadComponent {
1672
+ constructor(_dataService, toastr, dialog, app_s) {
2095
1673
  this._dataService = _dataService;
2096
- this._dataService_odbc = _dataService_odbc;
2097
- this.init_fill = true;
2098
- this.sql = "";
2099
- this.types = [];
2100
- this.values = [];
2101
- this.hidden = false;
2102
- this.label = "";
1674
+ this.toastr = toastr;
1675
+ this.dialog = dialog;
1676
+ this.app_s = app_s;
1677
+ this.show_descri = true;
2103
1678
  this.enabled = true;
2104
- this.required = false;
2105
- this.sel_label = "";
2106
- this.fillend = new EventEmitter();
2107
- this.selchange = new EventEmitter();
2108
- this.initend = new EventEmitter();
2109
- this.myData = [];
2110
- this.valDef = "-1";
2111
- this.selval = "-1";
2112
- this.errorMsg = "";
2113
- this.db_type = "1";
2114
- this.dis_value = '';
2115
- this.descri_val = "";
2116
- this.onChange = (_) => {
1679
+ this.single = true;
1680
+ this.descri_obb = false;
1681
+ this.programma_da_eseguire = '';
1682
+ this.label_attendere = 'ATTENDERE UPLOAD IN CORSO';
1683
+ this.fixed_label = ' (INSERISCI QUI LA DESCRIZIONE PRIMA DI CARICARE IL FILE)';
1684
+ this.limit_string = 'Il file di <size>MB supera il limite di 500MB';
1685
+ this.allegato_inserito = 'ALLEGATO INSERITO';
1686
+ this.inserire_descrizione = 'Descrizione Obbligatoria';
1687
+ this.lista_allegati = [];
1688
+ this.change = new EventEmitter();
1689
+ this.upload_ended = new EventEmitter();
1690
+ this.call_upload = new EventEmitter();
1691
+ this.multi_list = false;
1692
+ this.allow_delete = false;
1693
+ this.loading = false;
1694
+ this.App = '';
1695
+ this.K = '';
1696
+ this.label_b = "";
1697
+ this.descrizione = '';
1698
+ this.file_name = '';
1699
+ this.label = '';
1700
+ this.username = '';
1701
+ this.b_edit_loaded = false;
1702
+ this.tipo = '';
1703
+ this.b_ini = false;
1704
+ this.uploader = new FileUploader({
1705
+ url: this.app_s.API_ENDPOINT + this.app_s.UPLOAD_ENDPOINT,
1706
+ 'maxFileSize': 500 * 1024 * 1024
1707
+ });
1708
+ this.id = null;
1709
+ this.username = this.app_s.user;
1710
+ this.uploader.onBeforeUploadItem = (item) => {
1711
+ item.withCredentials = false;
2117
1712
  };
2118
- this.onTouched = () => {
1713
+ this.uploader.onCompleteItem = (item, response, status, header) => {
1714
+ if (status === 200) {
1715
+ this.descrizione = '';
1716
+ this.toastr.info("INFO", this.allegato_inserito, {
1717
+ timeOut: 1000,
1718
+ progressBar: true
1719
+ });
1720
+ this.ref_allegato();
1721
+ this.change.emit({ item: item, response: response, status: status, header: header });
1722
+ }
2119
1723
  };
2120
1724
  }
2121
- setValue(desc_val) {
2122
- this.setByValue(desc_val);
2123
- }
2124
- update_dis() {
2125
- this.dis_value = '';
2126
- try {
2127
- if (this.descri_val != null)
2128
- if (this.descri_val != "") {
2129
- this.dis_value = this.descri_val;
2130
- return;
2131
- }
2132
- if (this.valDef == null)
2133
- this.dis_value = '';
2134
- else
2135
- this.dis_value = this.valDef.split('-1').join('');
2136
- }
2137
- catch (e) {
2138
- console.log('errore split -> this.valDef ', this.valDef);
2139
- }
2140
- }
2141
- resetValue() {
2142
- this.selval = '-1';
2143
- this.valDef = '-1';
2144
- this.update_dis();
2145
- }
2146
- focus() {
2147
- this.smtr.nativeElement.focus();
1725
+ call_up() {
1726
+ this.call_upload.emit({
1727
+ App: this.App,
1728
+ K: this.K,
1729
+ descrizione: this.descrizione,
1730
+ single: false,
1731
+ username: this.app_s.user,
1732
+ tipo: this.tipo,
1733
+ local_path: this.app_s.LOCAL_PATH,
1734
+ p1: this.programma_da_eseguire
1735
+ });
2148
1736
  }
2149
- reset() {
2150
- console.log('reset');
2151
- this.selval = '-1';
2152
- this.valDef = '-1';
2153
- this.myData = new Array();
2154
- this.update_dis();
1737
+ del_doc() {
1738
+ localStorage.setItem(this.app_s.COMPANY_KEY + "title_dialog", 'Conferma Operazione');
1739
+ localStorage.setItem(this.app_s.COMPANY_KEY + "msg_dialog", "Confermi l'eliminazione dell'elemento?");
1740
+ let dialogRef = this
1741
+ .dialog
1742
+ .open(FHConfirmComponent);
1743
+ dialogRef
1744
+ .afterClosed()
1745
+ .subscribe(result => {
1746
+ if (result) {
1747
+ let p = new QParam();
1748
+ p.sql = "DELETE_ALLEGATO";
1749
+ p.types = ['int', 'string'];
1750
+ p.values = [this.id, this.app_s.user];
1751
+ let ok_op = false;
1752
+ this
1753
+ ._dataService
1754
+ .doQuery(p)
1755
+ .subscribe(data => {
1756
+ let ok_op = false;
1757
+ if (data != null)
1758
+ if (data.result_msg == "OK") {
1759
+ // this.arr_g = data.result_data;
1760
+ this.ref_allegato();
1761
+ this
1762
+ .toastr
1763
+ .info("INFO", "ALLEGATO ELIMINATO", {
1764
+ timeOut: 1000,
1765
+ progressBar: true
1766
+ });
1767
+ ok_op = true;
1768
+ }
1769
+ }, err => {
1770
+ });
1771
+ }
1772
+ });
2155
1773
  }
2156
- fillCombo() {
2157
- // console.log(this.init_fill);
2158
- // if(!this.init_fill){this.init_fill=true;return;}
2159
- if (this.sql == null)
2160
- this.sql = '';
2161
- if (this.sql.indexOf('|') != -1 && this.sql.indexOf('$') != -1) {
2162
- this.set_options(this.sql);
1774
+ load_types() {
1775
+ if (this.cmb_tipo == null) {
1776
+ setTimeout(() => { this.load_types(); }, 200);
2163
1777
  return;
2164
1778
  }
2165
- let p = new QParam();
2166
- p.sql = this.sql;
2167
- p.types = this.types;
2168
- p.values = this.values;
2169
- let ok_op = false;
2170
- // console.log(p);
2171
- if (this.db_type == "1")
2172
- this
2173
- ._dataService
2174
- .doQuery(p)
2175
- .subscribe(data => {
2176
- let ok_op = false;
2177
- if (data != null)
2178
- if (data.result_msg == "OK") {
2179
- this.resetD(data.result_data);
2180
- ok_op = true;
2181
- }
2182
- if (!ok_op) {
2183
- }
2184
- }, err => {
2185
- this.errorMsg = "ERRORE DI CONNESSIONE CON IL SERVER.RITENTARE PIU' TARDI [" + this.sql + "]";
2186
- });
2187
- if (this.db_type == "2")
2188
- this
2189
- ._dataService_odbc
2190
- .doQuery(p)
2191
- .subscribe(data => {
2192
- let ok_op = false;
2193
- if (data != null)
2194
- if (data.result_msg == "OK") {
2195
- for (let i = 0; i < data.result_data.length; i++) {
2196
- if (data.result_data[i].VALORE != null)
2197
- data.result_data[i].valore = data.result_data[i].VALORE;
2198
- if (data.result_data[i].DESCRIZIONE_VALORE != null)
2199
- data.result_data[i].descrizione_valore = data.result_data[i].DESCRIZIONE_VALORE;
2200
- }
2201
- this.resetD(data.result_data);
2202
- ok_op = true;
2203
- }
2204
- if (!ok_op) {
2205
- }
2206
- }, err => {
2207
- this.errorMsg = "ERRORE DI CONNESSIONE CON IL SERVER.RITENTARE PIU' TARDI [" + this.sql + "]";
2208
- });
2209
- }
2210
- add_option(o) {
2211
- this.myData.push(o);
2212
- }
2213
- resetD(o) {
2214
- this.myData = o;
2215
- this.selval = '-1';
2216
- // console.log(this.smtr); console.log(this.smtr.nativeElement);
2217
- this.setByValue(this.valDef);
2218
- if (this.getValue() == "-1" && this.valDef != "-1")
2219
- this.setByDescri(this.valDef);
2220
- this.fillend.emit();
2221
- }
2222
- setByDescri(desc_val) {
2223
- // console.log("setByDescri "+desc_val);
2224
- this.valDef = desc_val;
2225
- this.selval = '-1';
2226
- if (desc_val == "")
2227
- return;
2228
- if (this.myData == null)
2229
- return;
2230
- if (this.myData.length == 0 || this.myData[0] == null)
2231
- return;
2232
- for (let j = 0; j < this.myData.length; j++)
2233
- if (this.myData[j].descrizione_valore == desc_val) {
2234
- this.selval = "" + this.myData[j].valore;
2235
- if (this.myData[j].descrizione_valore != null)
2236
- this.descri_val = this.myData[j].descrizione_valore;
2237
- this.update_dis();
2238
- return;
2239
- }
2240
- this.update_dis();
2241
- }
2242
- setByIndex(ind) {
2243
- this.valDef = "";
2244
- this.selval = '-1';
2245
- if (this.myData == null)
2246
- return;
2247
- if (this.myData.length == 0 || this.myData[0] == null)
1779
+ if (this.tipo == '') {
1780
+ setTimeout(() => { this.load_types(); }, 200);
2248
1781
  return;
2249
- if (this.myData.length > ind) {
2250
- this.setByDescri(this.myData[ind].descrizione_valore);
2251
1782
  }
1783
+ console.log('this.cmb_tipo.sql ', this.cmb_tipo.sql);
1784
+ this.cmb_tipo.sql = this.tipo;
1785
+ this.cmb_tipo.fillCombo();
2252
1786
  }
2253
- getObj() {
2254
- if (this.selval == null)
2255
- return null;
2256
- if (this.selval == "-1")
2257
- return null;
2258
- else
2259
- for (let j = 0; j < this.myData.length; j++)
2260
- if (this.myData[j].valore == this.selval) {
2261
- return this.myData[j];
1787
+ ngAfterViewInit() {
1788
+ setTimeout(() => {
1789
+ let uo = {};
1790
+ uo.headers = [{ name: 'Authorization', value: 'Bearer ' + localStorage.getItem(this.app_s.COMPANY_KEY + "token") }];
1791
+ // console.log('ngAfterViewInit!!');
1792
+ this.uploader.setOptions(uo);
1793
+ this.uploader.onCompleteAll = () => {
1794
+ this.loading = false;
1795
+ this.upload_ended.emit();
1796
+ if (this.dialogRef != null)
1797
+ if (this.dialogRef.componentInstance != null) {
1798
+ this.dialogRef.componentInstance.update_progess(100);
1799
+ this.dialogRef = null;
1800
+ }
1801
+ };
1802
+ this.uploader.onErrorItem = (a, b, c, d) => {
1803
+ this.toastr.error(b);
1804
+ };
1805
+ this.uploader.onAfterAddingFile = (fileItem) => {
1806
+ this.ch(fileItem);
1807
+ };
1808
+ this.uploader.onProgressItem = (fileItem, progress) => {
1809
+ // console.log(fileItem);
1810
+ // console.log(progress);
1811
+ this.loading = true;
1812
+ if (this.dialogRef != null)
1813
+ if (this.dialogRef.componentInstance != null)
1814
+ this.dialogRef.componentInstance.update_progess(progress);
1815
+ };
1816
+ this.uploader.onWhenAddingFileFailed = (item, filter, options) => {
1817
+ switch (filter.name) {
1818
+ case 'fileSize':
1819
+ let ar = Math.round(item.size / 1024 / 1024);
1820
+ this.toastr.error(this.limit_string.split('<size>').join('' + ar));
1821
+ break;
1822
+ default:
1823
+ this.toastr.error("Errore: " + filter.name);
2262
1824
  }
1825
+ };
1826
+ });
2263
1827
  }
2264
- setByValue(desc_val) {
2265
- this.valDef = desc_val;
2266
- this.selval = '-1';
2267
- // console.log(this.myData);
2268
- if ("" + desc_val == "") {
2269
- // console.log('qqq1111');
1828
+ download_all() {
1829
+ window.open(this.app_s.COMPANY_SITE_ROOT + '/uploads/' + this.App + '/' + this.K + '/' + this.file_name);
1830
+ }
1831
+ ch(fileItem) {
1832
+ if (this.descri_obb && this.descrizione == '') {
1833
+ this.toastr.error(this.inserire_descrizione);
2270
1834
  return;
2271
1835
  }
2272
- // console.log("qui");
2273
- if (this.myData == null)
2274
- return;
2275
- // console.log("qui1");
2276
- if (this.myData.length == 0 || this.myData[0] == null)
2277
- return;
2278
- //console.log("qui2");
2279
- for (let j = 0; j < this.myData.length; j++) {
2280
- //console.log(this.myData[j].valore +' '+ desc_val);
2281
- if (this.myData[j].valore == desc_val) {
2282
- this.selval = "" + this.myData[j].valore;
2283
- if (this.myData[j].descrizione_valore != null)
2284
- this.descri_val = this.myData[j].descrizione_valore;
2285
- this.update_dis();
1836
+ for (let i = 0; i < this.lista_allegati.length; i++) {
1837
+ if (this.lista_allegati[i].Filename.toLowerCase() == fileItem.file.name.toLowerCase()) {
1838
+ this.toastr.error('File già presente (cancellarlo per aggiornarlo)');
2286
1839
  return;
2287
1840
  }
2288
1841
  }
2289
- this.update_dis();
2290
- }
2291
- getDescri() {
2292
- if (!this.enabled) {
2293
- if (this.selval == null)
2294
- return this.valDef;
2295
- if (this.selval == "-1")
2296
- return this.valDef;
2297
- }
2298
- if (this.selval == null)
2299
- return "-1";
2300
- if (this.selval == "-1")
2301
- return "-1";
2302
- else
2303
- for (let j = 0; j < this.myData.length; j++)
2304
- if (this.myData[j].valore == this.selval) {
2305
- return this.myData[j].descrizione_valore;
1842
+ this.uploader.onBuildItemForm = (item, form) => {
1843
+ form.append('App', this.App);
1844
+ form.append('K', this.K);
1845
+ form.append('descrizione', this.descrizione);
1846
+ form.append('single', this.single);
1847
+ form.append('username', this.username);
1848
+ if (this.multi_list)
1849
+ form.append('tipo', this.cmb_tipo.getDescri().split('-1').join(''));
1850
+ else
1851
+ form.append('tipo', this.tipo);
1852
+ form.append('local_path', this.app_s.LOCAL_PATH);
1853
+ if (this.programma_da_eseguire != '')
1854
+ form.append('p1', this.programma_da_eseguire);
1855
+ };
1856
+ if (this.dialogRef == null) {
1857
+ this.dialogRef = this.dialog.open(WinWait, { 'disableClose': true });
1858
+ setTimeout(() => {
1859
+ this.dialogRef.componentInstance.label = this.label_attendere;
1860
+ });
1861
+ this.dialogRef.afterClosed().subscribe(result => {
1862
+ if (result != "") {
2306
1863
  }
2307
- }
2308
- getValue() {
2309
- // console.log(this.selval);
2310
- if (!this.enabled) {
2311
- if (this.selval == null)
2312
- return this.valDef;
2313
- if (this.selval == "-1")
2314
- return this.valDef;
2315
- }
2316
- if (this.selval == null)
2317
- return "-1";
2318
- if (this.selval == "")
2319
- return "-1";
2320
- else
2321
- return this.selval;
2322
- }
2323
- getData(campo) {
2324
- for (var x in this.myData) {
2325
- if (this.myData[x]['valore'] == this.selval) {
2326
- return (this.myData[x][campo]);
2327
- }
2328
- else {
2329
- continue;
2330
- }
1864
+ });
2331
1865
  }
1866
+ this.uploader.uploadAll();
2332
1867
  }
2333
- set_options(s) {
2334
- this.myData = new Array();
2335
- let a = s.split('$');
2336
- for (let i = 0; i < a.length; i++) {
2337
- var o = new Object();
2338
- var av = a[i].split('|');
2339
- o.valore = av[1];
2340
- o.descrizione_valore = av[0];
2341
- this
2342
- .myData
2343
- .push(o);
1868
+ init(p_app, p_k, p_label, p_tipo = "", programma_da_eseguire = "", allow_delete = false) {
1869
+ this.App = p_app;
1870
+ this.K = p_k;
1871
+ this.label = p_label;
1872
+ this.tipo = p_tipo;
1873
+ this.b_ini = true;
1874
+ this.b_edit_loaded = false;
1875
+ this.descrizione = '';
1876
+ this.programma_da_eseguire = programma_da_eseguire;
1877
+ this.allow_delete = allow_delete;
1878
+ this.ref_allegato();
1879
+ // console.log('init! ',this.tipo)
1880
+ if (this.tipo.indexOf('SELECT_') > -1) {
1881
+ this.multi_list = true;
1882
+ this.load_types();
1883
+ //console.log('fillCombo');
2344
1884
  }
2345
- this.setByValue(this.valDef);
2346
- if (this.getValue() == "-1")
2347
- this.setByDescri(this.valDef);
2348
1885
  }
2349
- ngAfterViewInit() {
2350
- setTimeout(() => {
2351
- if (this.init_fill == true) {
2352
- if (this.sql == '') {
2353
- //this.errorMsg="QUERY NON CONFIGURATA";
2354
- return;
2355
- }
2356
- this.fillCombo();
2357
- }
2358
- else {
2359
- this.errorMsg = "";
2360
- }
2361
- this
2362
- .initend
2363
- .emit();
1886
+ ref_allegato() {
1887
+ // console.log(' ref_allegato')
1888
+ this.id = null;
1889
+ this.descrizione = '';
1890
+ this.file_name = '';
1891
+ this.label_b = '';
1892
+ this.cmb_tipo.resetValue();
1893
+ if (!this.single)
1894
+ return;
1895
+ if (this.App == null)
1896
+ return;
1897
+ if (this.App == "")
1898
+ return;
1899
+ let p = new QParam();
1900
+ p.sql = "SELECT_ALLEGATO_INFO";
1901
+ p.types = ['string', 'string'];
1902
+ p.values = [this.App, this.K];
1903
+ this._dataService.doQuery(p).subscribe(data => {
1904
+ if (data != null)
1905
+ if (data.result_msg == "OK") {
1906
+ let a = data.result_data;
1907
+ if (a.length > 0) {
1908
+ this.id = a[0].id;
1909
+ this.descrizione = a[0].descrizione;
1910
+ this.file_name = a[0].Filename;
1911
+ this.label_b = "" + a[0].Filename + " - " + a[0].Filesize + "";
1912
+ this.b_edit_loaded = true;
1913
+ }
1914
+ }
2364
1915
  });
2365
1916
  }
2366
- sc() {
2367
- this.onChange(this.getValue());
2368
- this
2369
- .selchange
2370
- .emit({ event: this.getObj(), valore: this.getValue(), descrizione_valore: this.getDescri() });
2371
- }
2372
- getModelValue() {
2373
- const value = this.getData('valore');
2374
- return value;
2375
- }
2376
- writeValue(value) {
2377
- this.setByValue(value);
2378
- }
2379
- registerOnChange(fn) {
2380
- this.onChange = fn;
2381
- }
2382
- registerOnTouched(fn) {
2383
- this.onTouched = fn;
2384
- }
2385
1917
  };
2386
- FHComboboxComponent.ctorParameters = () => [
1918
+ FHUploadComponent.ctorParameters = () => [
2387
1919
  { type: QueryService },
2388
- { type: OdbcService }
1920
+ { type: ToastrService },
1921
+ { type: MatDialog },
1922
+ { type: AppService }
2389
1923
  ];
2390
1924
  __decorate([
2391
1925
  Input(),
2392
1926
  __metadata("design:type", Boolean)
2393
- ], FHComboboxComponent.prototype, "init_fill", void 0);
1927
+ ], FHUploadComponent.prototype, "show_descri", void 0);
2394
1928
  __decorate([
2395
1929
  Input(),
2396
- __metadata("design:type", String)
2397
- ], FHComboboxComponent.prototype, "sql", void 0);
1930
+ __metadata("design:type", Boolean)
1931
+ ], FHUploadComponent.prototype, "enabled", void 0);
2398
1932
  __decorate([
2399
1933
  Input(),
2400
- __metadata("design:type", Array)
2401
- ], FHComboboxComponent.prototype, "types", void 0);
1934
+ __metadata("design:type", Boolean)
1935
+ ], FHUploadComponent.prototype, "single", void 0);
2402
1936
  __decorate([
2403
1937
  Input(),
2404
- __metadata("design:type", Array)
2405
- ], FHComboboxComponent.prototype, "values", void 0);
1938
+ __metadata("design:type", Boolean)
1939
+ ], FHUploadComponent.prototype, "descri_obb", void 0);
2406
1940
  __decorate([
2407
1941
  Input(),
2408
- __metadata("design:type", Boolean)
2409
- ], FHComboboxComponent.prototype, "hidden", void 0);
1942
+ __metadata("design:type", String)
1943
+ ], FHUploadComponent.prototype, "programma_da_eseguire", void 0);
2410
1944
  __decorate([
2411
1945
  Input(),
2412
1946
  __metadata("design:type", String)
2413
- ], FHComboboxComponent.prototype, "label", void 0);
1947
+ ], FHUploadComponent.prototype, "label_attendere", void 0);
2414
1948
  __decorate([
2415
1949
  Input(),
2416
- __metadata("design:type", Boolean)
2417
- ], FHComboboxComponent.prototype, "enabled", void 0);
1950
+ __metadata("design:type", String)
1951
+ ], FHUploadComponent.prototype, "fixed_label", void 0);
2418
1952
  __decorate([
2419
1953
  Input(),
2420
- __metadata("design:type", Boolean)
2421
- ], FHComboboxComponent.prototype, "required", void 0);
1954
+ __metadata("design:type", String)
1955
+ ], FHUploadComponent.prototype, "limit_string", void 0);
2422
1956
  __decorate([
2423
1957
  Input(),
2424
1958
  __metadata("design:type", String)
2425
- ], FHComboboxComponent.prototype, "sel_label", void 0);
1959
+ ], FHUploadComponent.prototype, "allegato_inserito", void 0);
2426
1960
  __decorate([
2427
- ViewChild('cmb'),
2428
- __metadata("design:type", ElementRef)
2429
- ], FHComboboxComponent.prototype, "smtr", void 0);
1961
+ Input(),
1962
+ __metadata("design:type", String)
1963
+ ], FHUploadComponent.prototype, "inserire_descrizione", void 0);
1964
+ __decorate([
1965
+ Input(),
1966
+ __metadata("design:type", Array)
1967
+ ], FHUploadComponent.prototype, "lista_allegati", void 0);
2430
1968
  __decorate([
2431
1969
  Output(),
2432
1970
  __metadata("design:type", EventEmitter)
2433
- ], FHComboboxComponent.prototype, "fillend", void 0);
1971
+ ], FHUploadComponent.prototype, "change", void 0);
2434
1972
  __decorate([
2435
1973
  Output(),
2436
1974
  __metadata("design:type", EventEmitter)
2437
- ], FHComboboxComponent.prototype, "selchange", void 0);
1975
+ ], FHUploadComponent.prototype, "upload_ended", void 0);
2438
1976
  __decorate([
2439
1977
  Output(),
2440
1978
  __metadata("design:type", EventEmitter)
2441
- ], FHComboboxComponent.prototype, "initend", void 0);
2442
- __decorate([
2443
- Input(),
2444
- __metadata("design:type", String)
2445
- ], FHComboboxComponent.prototype, "valDef", void 0);
1979
+ ], FHUploadComponent.prototype, "call_upload", void 0);
2446
1980
  __decorate([
2447
- Input(),
2448
- __metadata("design:type", String)
2449
- ], FHComboboxComponent.prototype, "db_type", void 0);
2450
- FHComboboxComponent = __decorate([
1981
+ ViewChild('cmb_tipo'),
1982
+ __metadata("design:type", FHComboboxComponent)
1983
+ ], FHUploadComponent.prototype, "cmb_tipo", void 0);
1984
+ FHUploadComponent = __decorate([
2451
1985
  Component({
2452
- selector: 'FHComboBox',
2453
- providers: [CUSTOM_INPUT_CONTROL_VALUE_ACCESSOR$2],
1986
+ selector: 'FHUpload',
2454
1987
  template: `
2455
- <mat-form-field [hidden]="!enabled || hidden" appearance="outline" floatLabel="always"><mat-label>{{label}}</mat-label>
2456
- <mat-select #cmb [(ngModel)]="selval" (selectionChange)="sc()" [required]="required">
2457
- <mat-option value="-1">{{sel_label}}</mat-option>
2458
- <mat-option value="{{app.valore}}" *ngFor="let app of myData">{{app.descrizione_valore}}</mat-option>
2459
- </mat-select>
2460
- </mat-form-field>
2461
1988
 
2462
- <mat-form-field [hidden]="enabled || hidden" appearance="outline" floatLabel="always"><mat-label>{{label}}</mat-label>
2463
- <input type="text" #el1 matInput [disabled]="true" [(ngModel)]="dis_value">
2464
- </mat-form-field>
1989
+ <div *ngIf="loading" fxLayout="row">
1990
+ WAIT
1991
+ </div>
1992
+ <div [hidden]="!(enabled && !loading)" fxLayout="row" fxLayoutAlign="start center">
1993
+ <div [hidden]="!multi_list" style="width:380px" fxLayoutAlign="start center">
1994
+ <FHComboBox [sql]="tipo" #cmb_tipo [init_fill]="false" label="Tipologia"></FHComboBox>&nbsp;&nbsp;
1995
+ </div>
1996
+ <mat-form-field [hidden]="!show_descri" style="width: 100%" appearance="outline" floatLabel="always"><mat-label>{{label}} {{fixed_label}}</mat-label>
1997
+ <input matInput type="text" name="descrizione" [(ngModel)]="descrizione"
1998
+ >
1999
+ </mat-form-field>
2000
+ &nbsp;&nbsp;&nbsp;&nbsp;
2001
+ <div style="width:140px" fxLayout="row" fxLayoutAlign="start start" (click)="call_up()">
2002
+ <input type="file" multiple ng2FileSelect [uploader]="uploader" name="file-fh{{App}}" id="file-fh{{App}}" class="inputfile inputfile-fh" />
2003
+ <label for="file-fh{{App}}" style="width:210px"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="17" viewBox="0 0 20 17"><path d="M10 0l-5.2 4.9h3.3v5.1h3.8v-5.1h3.3l-5.2-4.9zm9.3 11.5l-3.2-2.1h-2l3.4 2.6h-3.5c-.1 0-.2.1-.2.1l-.8 2.3h-6l-.8-2.2c-.1-.1-.1-.2-.2-.2h-3.6l3.4-2.6h-2l-3.2 2.1c-.4.3-.7 1-.6 1.5l.6 3.1c.1.5.7.9 1.2.9h16.3c.6 0 1.1-.4 1.3-.9l.6-3.1c.1-.5-.2-1.2-.7-1.5z"/></svg><span style="font-size: 12px">&nbsp;&nbsp;&nbsp;Upload</span></label>
2004
+ </div>
2005
+ <div fxLayout="row" fxLayoutAlign="start start">
2006
+ <button mat-flat-button *ngIf="b_edit_loaded" (click)="download_all()" style="font-size: 12px">{{label_b}}</button>&nbsp;&nbsp;&nbsp;
2007
+ <button mat-flat-button *ngIf="id!=null && allow_delete" (click)="del_doc()" color="warn">
2008
+ <mat-icon>delete</mat-icon>
2009
+ </button>
2010
+ </div>
2011
+ </div>
2012
+ <div *ngIf="!enabled" fxLayout="row">
2013
+ <label>{{label}}:</label>{{descrizione}}
2014
+ <button mat-flat-button *ngIf="b_edit_loaded" (click)="download_all()" style="font-size: 15px;background-color: #F5F5F5">{{label_b}}</button>
2015
+
2016
+ </div>
2017
+
2465
2018
  `,
2466
2019
  styles: [`
2467
2020
 
2468
2021
  `]
2469
2022
  }),
2470
- __metadata("design:paramtypes", [QueryService, OdbcService])
2471
- ], FHComboboxComponent);
2023
+ __metadata("design:paramtypes", [QueryService, ToastrService, MatDialog, AppService])
2024
+ ], FHUploadComponent);
2472
2025
 
2473
- let FHUploadComponent = class FHUploadComponent {
2474
- constructor(_dataService, toastr, dialog, app_s) {
2475
- this._dataService = _dataService;
2476
- this.toastr = toastr;
2477
- this.dialog = dialog;
2026
+ let FileService = class FileService {
2027
+ constructor(http, app_s, toastr) {
2028
+ this.http = http;
2478
2029
  this.app_s = app_s;
2479
- this.show_descri = true;
2480
- this.enabled = true;
2481
- this.single = true;
2482
- this.descri_obb = false;
2483
- this.programma_da_eseguire = '';
2484
- this.label_attendere = 'ATTENDERE UPLOAD IN CORSO';
2485
- this.fixed_label = ' (INSERISCI QUI LA DESCRIZIONE PRIMA DI CARICARE IL FILE)';
2486
- this.limit_string = 'Il file di <size>MB supera il limite di 500MB';
2487
- this.allegato_inserito = 'ALLEGATO INSERITO';
2488
- this.inserire_descrizione = 'Descrizione Obbligatoria';
2489
- this.lista_allegati = [];
2490
- this.change = new EventEmitter();
2491
- this.upload_ended = new EventEmitter();
2492
- this.call_upload = new EventEmitter();
2493
- this.multi_list = false;
2494
- this.allow_delete = false;
2495
- this.loading = false;
2496
- this.App = '';
2497
- this.K = '';
2498
- this.label_b = "";
2499
- this.descrizione = '';
2500
- this.file_name = '';
2501
- this.label = '';
2502
- this.username = '';
2503
- this.b_edit_loaded = false;
2504
- this.tipo = '';
2505
- this.b_ini = false;
2506
- this.uploader = new FileUploader({
2507
- url: this.app_s.API_ENDPOINT + this.app_s.UPLOAD_ENDPOINT,
2508
- 'maxFileSize': 500 * 1024 * 1024
2030
+ this.toastr = toastr;
2031
+ this.url = this.app_s.API_ENDPOINT + this.app_s.FILE_ENDPOINT; // URL to web API this.app_s.API_ENDPOINT
2032
+ }
2033
+ doQuery(queryp, displayError = true) {
2034
+ this.headers = new HttpHeaders({
2035
+ 'Content-Type': 'application/json',
2036
+ 'Authorization': 'Bearer ' + localStorage.getItem(this.app_s.COMPANY_KEY + "token"),
2509
2037
  });
2510
- this.id = null;
2511
- this.username = this.app_s.user;
2512
- this.uploader.onBeforeUploadItem = (item) => {
2513
- item.withCredentials = false;
2514
- };
2515
- this.uploader.onCompleteItem = (item, response, status, header) => {
2516
- if (status === 200) {
2517
- this.descrizione = '';
2518
- this.toastr.info("INFO", this.allegato_inserito, {
2519
- timeOut: 1000,
2520
- progressBar: true
2521
- });
2522
- this.ref_allegato();
2523
- this.change.emit({ item: item, response: response, status: status, header: header });
2038
+ this.url = this.app_s.API_ENDPOINT + this.app_s.FILE_ENDPOINT;
2039
+ // console.log('FileService url: '+ this.url);
2040
+ let post_v = JSON.stringify(queryp);
2041
+ // console.log(post_v);
2042
+ return this.http.post(this.url, post_v, {
2043
+ headers: this.headers
2044
+ }).pipe(map((res) => {
2045
+ // Handle errors, display if enabled
2046
+ let r = res;
2047
+ let err;
2048
+ if (!res) {
2049
+ err = new Error('Empty server response');
2524
2050
  }
2525
- };
2051
+ else if (r.result_msg === 'KO') {
2052
+ err = new Error(r.msg);
2053
+ }
2054
+ if (err) {
2055
+ console.error(err);
2056
+ if (displayError) {
2057
+ this.toastr.error(err.message);
2058
+ }
2059
+ throw new Error(err);
2060
+ }
2061
+ return res || new QGResult();
2062
+ }), catchError((err) => {
2063
+ // In a real world app, we might use a remote logging infrastructure
2064
+ // We'd also dig deeper into the error to get a better message
2065
+ let errMsg = (err.message) ? err.message : err.status ? `${err.status} - ${err.statusText}` : 'Server error';
2066
+ console.error(errMsg); // log to console instead
2067
+ throw err;
2068
+ }));
2526
2069
  }
2527
- call_up() {
2528
- this.call_upload.emit({
2529
- App: this.App,
2530
- K: this.K,
2531
- descrizione: this.descrizione,
2532
- single: false,
2533
- username: this.app_s.user,
2534
- tipo: this.tipo,
2535
- local_path: this.app_s.LOCAL_PATH,
2536
- p1: this.programma_da_eseguire
2537
- });
2538
- }
2539
- del_doc() {
2540
- localStorage.setItem(this.app_s.COMPANY_KEY + "title_dialog", 'Conferma Operazione');
2541
- localStorage.setItem(this.app_s.COMPANY_KEY + "msg_dialog", "Confermi l'eliminazione dell'elemento?");
2542
- let dialogRef = this
2543
- .dialog
2544
- .open(FHConfirmComponent);
2545
- dialogRef
2546
- .afterClosed()
2547
- .subscribe(result => {
2548
- if (result) {
2549
- let p = new QParam();
2550
- p.sql = "DELETE_ALLEGATO";
2551
- p.types = ['int', 'string'];
2552
- p.values = [this.id, this.app_s.user];
2553
- let ok_op = false;
2554
- this
2555
- ._dataService
2556
- .doQuery(p)
2557
- .subscribe(data => {
2558
- let ok_op = false;
2559
- if (data != null)
2560
- if (data.result_msg == "OK") {
2561
- // this.arr_g = data.result_data;
2562
- this.ref_allegato();
2563
- this
2564
- .toastr
2565
- .info("INFO", "ALLEGATO ELIMINATO", {
2566
- timeOut: 1000,
2567
- progressBar: true
2568
- });
2569
- ok_op = true;
2570
- }
2571
- }, err => {
2572
- });
2573
- }
2070
+ };
2071
+ FileService.ctorParameters = () => [
2072
+ { type: HttpClient },
2073
+ { type: AppService },
2074
+ { type: ToastrService }
2075
+ ];
2076
+ FileService.ɵprov = ɵɵdefineInjectable({ factory: function FileService_Factory() { return new FileService(ɵɵinject(HttpClient), ɵɵinject(AppService), ɵɵinject(ToastrService)); }, token: FileService, providedIn: "root" });
2077
+ FileService = __decorate([
2078
+ Injectable({
2079
+ providedIn: 'root',
2080
+ }),
2081
+ __metadata("design:paramtypes", [HttpClient, AppService, ToastrService])
2082
+ ], FileService);
2083
+
2084
+ let AuthenticationService = class AuthenticationService {
2085
+ constructor(_dataService, toastr, http, router, route, _fileService, app_s, uti_s) {
2086
+ this._dataService = _dataService;
2087
+ this.toastr = toastr;
2088
+ this.http = http;
2089
+ this.router = router;
2090
+ this.route = route;
2091
+ this._fileService = _fileService;
2092
+ this.app_s = app_s;
2093
+ this.uti_s = uti_s;
2094
+ this.url = this.app_s.API_ENDPOINT + this.app_s.LOGIN_ENDPOINT;
2095
+ this.goto_after = "";
2096
+ this.username = '';
2097
+ this.headers = new HttpHeaders({
2098
+ 'Content-Type': 'application/json',
2574
2099
  });
2575
2100
  }
2576
- load_types() {
2577
- if (this.cmb_tipo == null) {
2578
- setTimeout(() => { this.load_types(); }, 200);
2579
- return;
2580
- }
2581
- if (this.tipo == '') {
2582
- setTimeout(() => { this.load_types(); }, 200);
2583
- return;
2101
+ logout() {
2102
+ this.app_s.user = null;
2103
+ this.app_s.user_name = null;
2104
+ this.app_s.user_surname = null;
2105
+ this.app_s.user_idp = null;
2106
+ this.app_s.user_email = null;
2107
+ this.app_s.user_roles = null;
2108
+ this.app_s.user_lang = null;
2109
+ this.app_s.user_isadmin = null;
2110
+ this.app_s.token = null;
2111
+ localStorage.removeItem(this.app_s.COMPANY_KEY + "token");
2112
+ if (this.app_s.LOGIN_EXT != 1)
2113
+ this.router.navigate(['login']);
2114
+ else {
2115
+ window.location.href = (this.app_s.LOGOUT_URL_EXT);
2584
2116
  }
2585
- console.log('this.cmb_tipo.sql ', this.cmb_tipo.sql);
2586
- this.cmb_tipo.sql = this.tipo;
2587
- this.cmb_tipo.fillCombo();
2588
2117
  }
2589
- ngAfterViewInit() {
2590
- setTimeout(() => {
2591
- let uo = {};
2592
- uo.headers = [{ name: 'Authorization', value: 'Bearer ' + localStorage.getItem(this.app_s.COMPANY_KEY + "token") }];
2593
- // console.log('ngAfterViewInit!!');
2594
- this.uploader.setOptions(uo);
2595
- this.uploader.onCompleteAll = () => {
2596
- this.loading = false;
2597
- this.upload_ended.emit();
2598
- if (this.dialogRef != null)
2599
- if (this.dialogRef.componentInstance != null) {
2600
- this.dialogRef.componentInstance.update_progess(100);
2601
- this.dialogRef = null;
2602
- }
2603
- };
2604
- this.uploader.onErrorItem = (a, b, c, d) => {
2605
- this.toastr.error(b);
2606
- };
2607
- this.uploader.onAfterAddingFile = (fileItem) => {
2608
- this.ch(fileItem);
2609
- };
2610
- this.uploader.onProgressItem = (fileItem, progress) => {
2611
- // console.log(fileItem);
2612
- // console.log(progress);
2613
- this.loading = true;
2614
- if (this.dialogRef != null)
2615
- if (this.dialogRef.componentInstance != null)
2616
- this.dialogRef.componentInstance.update_progess(progress);
2617
- };
2618
- this.uploader.onWhenAddingFileFailed = (item, filter, options) => {
2619
- switch (filter.name) {
2620
- case 'fileSize':
2621
- let ar = Math.round(item.size / 1024 / 1024);
2622
- this.toastr.error(this.limit_string.split('<size>').join('' + ar));
2623
- break;
2624
- default:
2625
- this.toastr.error("Errore: " + filter.name);
2118
+ login(username, password, displayError = true) {
2119
+ this.url = this.app_s.API_ENDPOINT + this.app_s.LOGIN_ENDPOINT;
2120
+ let post_v = JSON.stringify({ username: username, password: password });
2121
+ if (this.app_s.LDAP_AUTH == 1)
2122
+ post_v = JSON.stringify({ username: username, password: password, ldap_auth: 1 });
2123
+ return this.http.post(this.url, post_v, {
2124
+ headers: this.headers
2125
+ }).pipe(map((res) => {
2126
+ // Handle errors, display if enabled
2127
+ let err;
2128
+ if (!res) {
2129
+ err = new Error('Empty server response');
2130
+ }
2131
+ else if (res.result_msg === 'KO') {
2132
+ err = new Error(res.msg);
2133
+ }
2134
+ else {
2135
+ if (res.result_data.length > 0) {
2136
+ localStorage.setItem(this.app_s.COMPANY_KEY + "token", res.result_data[0].token);
2626
2137
  }
2627
- };
2628
- });
2629
- }
2630
- download_all() {
2631
- window.open(this.app_s.COMPANY_SITE_ROOT + '/uploads/' + this.App + '/' + this.K + '/' + this.file_name);
2632
- }
2633
- ch(fileItem) {
2634
- if (this.descri_obb && this.descrizione == '') {
2635
- this.toastr.error(this.inserire_descrizione);
2636
- return;
2637
- }
2638
- for (let i = 0; i < this.lista_allegati.length; i++) {
2639
- if (this.lista_allegati[i].Filename.toLowerCase() == fileItem.file.name.toLowerCase()) {
2640
- this.toastr.error('File già presente (cancellarlo per aggiornarlo)');
2641
- return;
2642
2138
  }
2643
- }
2644
- this.uploader.onBuildItemForm = (item, form) => {
2645
- form.append('App', this.App);
2646
- form.append('K', this.K);
2647
- form.append('descrizione', this.descrizione);
2648
- form.append('single', this.single);
2649
- form.append('username', this.username);
2650
- if (this.multi_list)
2651
- form.append('tipo', this.cmb_tipo.getDescri().split('-1').join(''));
2652
- else
2653
- form.append('tipo', this.tipo);
2654
- form.append('local_path', this.app_s.LOCAL_PATH);
2655
- if (this.programma_da_eseguire != '')
2656
- form.append('p1', this.programma_da_eseguire);
2657
- };
2658
- if (this.dialogRef == null) {
2659
- this.dialogRef = this.dialog.open(WinWait, { 'disableClose': true });
2660
- setTimeout(() => {
2661
- this.dialogRef.componentInstance.label = this.label_attendere;
2662
- });
2663
- this.dialogRef.afterClosed().subscribe(result => {
2664
- if (result != "") {
2139
+ if (err) {
2140
+ console.error(err);
2141
+ if (displayError) {
2142
+ this.toastr.error(err.message);
2665
2143
  }
2666
- });
2667
- }
2668
- this.uploader.uploadAll();
2144
+ throw new Error(err);
2145
+ }
2146
+ return res || new QGResult();
2147
+ }), catchError((err) => {
2148
+ // In a real world app, we might use a remote logging infrastructure
2149
+ // We'd also dig deeper into the error to get a better message
2150
+ let errMsg = (err.message) ? err.message : err.status ? `${err.status} - ${err.statusText}` : 'Server error';
2151
+ console.error(errMsg); // log to console instead
2152
+ throw err;
2153
+ }));
2669
2154
  }
2670
- init(p_app, p_k, p_label, p_tipo = "", programma_da_eseguire = "", allow_delete = false) {
2671
- this.App = p_app;
2672
- this.K = p_k;
2673
- this.label = p_label;
2674
- this.tipo = p_tipo;
2675
- this.b_ini = true;
2676
- this.b_edit_loaded = false;
2677
- this.descrizione = '';
2678
- this.programma_da_eseguire = programma_da_eseguire;
2679
- this.allow_delete = allow_delete;
2680
- this.ref_allegato();
2681
- // console.log('init! ',this.tipo)
2682
- if (this.tipo.indexOf('SELECT_') > -1) {
2683
- this.multi_list = true;
2684
- this.load_types();
2685
- //console.log('fillCombo');
2686
- }
2687
- }
2688
- ref_allegato() {
2689
- // console.log(' ref_allegato')
2690
- this.id = null;
2691
- this.descrizione = '';
2692
- this.file_name = '';
2693
- this.label_b = '';
2694
- this.cmb_tipo.resetValue();
2695
- if (!this.single)
2696
- return;
2697
- if (this.App == null)
2698
- return;
2699
- if (this.App == "")
2700
- return;
2701
- let p = new QParam();
2702
- p.sql = "SELECT_ALLEGATO_INFO";
2703
- p.types = ['string', 'string'];
2704
- p.values = [this.App, this.K];
2705
- this._dataService.doQuery(p).subscribe(data => {
2706
- if (data != null)
2707
- if (data.result_msg == "OK") {
2708
- let a = data.result_data;
2709
- if (a.length > 0) {
2710
- this.id = a[0].id;
2711
- this.descrizione = a[0].descrizione;
2712
- this.file_name = a[0].Filename;
2713
- this.label_b = "" + a[0].Filename + " - " + a[0].Filesize + "";
2714
- this.b_edit_loaded = true;
2715
- }
2716
- }
2717
- });
2718
- }
2719
- };
2720
- FHUploadComponent.ctorParameters = () => [
2721
- { type: QueryService },
2722
- { type: ToastrService },
2723
- { type: MatDialog },
2724
- { type: AppService }
2725
- ];
2726
- __decorate([
2727
- Input(),
2728
- __metadata("design:type", Boolean)
2729
- ], FHUploadComponent.prototype, "show_descri", void 0);
2730
- __decorate([
2731
- Input(),
2732
- __metadata("design:type", Boolean)
2733
- ], FHUploadComponent.prototype, "enabled", void 0);
2734
- __decorate([
2735
- Input(),
2736
- __metadata("design:type", Boolean)
2737
- ], FHUploadComponent.prototype, "single", void 0);
2738
- __decorate([
2739
- Input(),
2740
- __metadata("design:type", Boolean)
2741
- ], FHUploadComponent.prototype, "descri_obb", void 0);
2742
- __decorate([
2743
- Input(),
2744
- __metadata("design:type", String)
2745
- ], FHUploadComponent.prototype, "programma_da_eseguire", void 0);
2746
- __decorate([
2747
- Input(),
2748
- __metadata("design:type", String)
2749
- ], FHUploadComponent.prototype, "label_attendere", void 0);
2750
- __decorate([
2751
- Input(),
2752
- __metadata("design:type", String)
2753
- ], FHUploadComponent.prototype, "fixed_label", void 0);
2754
- __decorate([
2755
- Input(),
2756
- __metadata("design:type", String)
2757
- ], FHUploadComponent.prototype, "limit_string", void 0);
2758
- __decorate([
2759
- Input(),
2760
- __metadata("design:type", String)
2761
- ], FHUploadComponent.prototype, "allegato_inserito", void 0);
2762
- __decorate([
2763
- Input(),
2764
- __metadata("design:type", String)
2765
- ], FHUploadComponent.prototype, "inserire_descrizione", void 0);
2766
- __decorate([
2767
- Input(),
2768
- __metadata("design:type", Array)
2769
- ], FHUploadComponent.prototype, "lista_allegati", void 0);
2770
- __decorate([
2771
- Output(),
2772
- __metadata("design:type", EventEmitter)
2773
- ], FHUploadComponent.prototype, "change", void 0);
2774
- __decorate([
2775
- Output(),
2776
- __metadata("design:type", EventEmitter)
2777
- ], FHUploadComponent.prototype, "upload_ended", void 0);
2778
- __decorate([
2779
- Output(),
2780
- __metadata("design:type", EventEmitter)
2781
- ], FHUploadComponent.prototype, "call_upload", void 0);
2782
- __decorate([
2783
- ViewChild('cmb_tipo'),
2784
- __metadata("design:type", FHComboboxComponent)
2785
- ], FHUploadComponent.prototype, "cmb_tipo", void 0);
2786
- FHUploadComponent = __decorate([
2787
- Component({
2788
- selector: 'FHUpload',
2789
- template: `
2790
-
2791
- <div *ngIf="loading" fxLayout="row">
2792
- WAIT
2793
- </div>
2794
- <div [hidden]="!(enabled && !loading)" fxLayout="row" fxLayoutAlign="start center">
2795
- <div [hidden]="!multi_list" style="width:380px" fxLayoutAlign="start center">
2796
- <FHComboBox [sql]="tipo" #cmb_tipo [init_fill]="false" label="Tipologia"></FHComboBox>&nbsp;&nbsp;
2797
- </div>
2798
- <mat-form-field [hidden]="!show_descri" style="width: 100%" appearance="outline" floatLabel="always"><mat-label>{{label}} {{fixed_label}}</mat-label>
2799
- <input matInput type="text" name="descrizione" [(ngModel)]="descrizione"
2800
- >
2801
- </mat-form-field>
2802
- &nbsp;&nbsp;&nbsp;&nbsp;
2803
- <div style="width:140px" fxLayout="row" fxLayoutAlign="start start" (click)="call_up()">
2804
- <input type="file" multiple ng2FileSelect [uploader]="uploader" name="file-fh{{App}}" id="file-fh{{App}}" class="inputfile inputfile-fh" />
2805
- <label for="file-fh{{App}}" style="width:210px"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="17" viewBox="0 0 20 17"><path d="M10 0l-5.2 4.9h3.3v5.1h3.8v-5.1h3.3l-5.2-4.9zm9.3 11.5l-3.2-2.1h-2l3.4 2.6h-3.5c-.1 0-.2.1-.2.1l-.8 2.3h-6l-.8-2.2c-.1-.1-.1-.2-.2-.2h-3.6l3.4-2.6h-2l-3.2 2.1c-.4.3-.7 1-.6 1.5l.6 3.1c.1.5.7.9 1.2.9h16.3c.6 0 1.1-.4 1.3-.9l.6-3.1c.1-.5-.2-1.2-.7-1.5z"/></svg><span style="font-size: 12px">&nbsp;&nbsp;&nbsp;Upload</span></label>
2806
- </div>
2807
- <div fxLayout="row" fxLayoutAlign="start start">
2808
- <button mat-flat-button *ngIf="b_edit_loaded" (click)="download_all()" style="font-size: 12px">{{label_b}}</button>&nbsp;&nbsp;&nbsp;
2809
- <button mat-flat-button *ngIf="id!=null && allow_delete" (click)="del_doc()" color="warn">
2810
- <mat-icon>delete</mat-icon>
2811
- </button>
2812
- </div>
2813
- </div>
2814
- <div *ngIf="!enabled" fxLayout="row">
2815
- <label>{{label}}:</label>{{descrizione}}
2816
- <button mat-flat-button *ngIf="b_edit_loaded" (click)="download_all()" style="font-size: 15px;background-color: #F5F5F5">{{label_b}}</button>
2817
-
2818
- </div>
2819
-
2820
- `,
2821
- styles: [`
2822
-
2823
- `]
2824
- }),
2825
- __metadata("design:paramtypes", [QueryService, ToastrService, MatDialog, AppService])
2826
- ], FHUploadComponent);
2827
-
2828
- let AuthenticationService = class AuthenticationService {
2829
- constructor(_dataService, toastr, http, router, route, _fileService, app_s, uti_s) {
2830
- this._dataService = _dataService;
2831
- this.toastr = toastr;
2832
- this.http = http;
2833
- this.router = router;
2834
- this.route = route;
2835
- this._fileService = _fileService;
2836
- this.app_s = app_s;
2837
- this.uti_s = uti_s;
2838
- this.url = this.app_s.API_ENDPOINT + this.app_s.LOGIN_ENDPOINT;
2839
- this.goto_after = "";
2840
- this.username = '';
2841
- this.headers = new HttpHeaders({
2842
- 'Content-Type': 'application/json',
2843
- });
2844
- }
2845
- logout() {
2846
- this.app_s.user = null;
2847
- this.app_s.user_name = null;
2848
- this.app_s.user_surname = null;
2849
- this.app_s.user_idp = null;
2850
- this.app_s.user_email = null;
2851
- this.app_s.user_roles = null;
2852
- this.app_s.user_lang = null;
2853
- this.app_s.user_isadmin = null;
2854
- this.app_s.token = null;
2855
- localStorage.removeItem(this.app_s.COMPANY_KEY + "token");
2856
- if (this.app_s.LOGIN_EXT != 1)
2857
- this.router.navigate(['login']);
2858
- else {
2859
- window.location.href = (this.app_s.LOGOUT_URL_EXT);
2860
- }
2861
- }
2862
- login(username, password, displayError = true) {
2863
- this.url = this.app_s.API_ENDPOINT + this.app_s.LOGIN_ENDPOINT;
2864
- let post_v = JSON.stringify({ username: username, password: password });
2865
- if (this.app_s.LDAP_AUTH == 1)
2866
- post_v = JSON.stringify({ username: username, password: password, ldap_auth: 1 });
2867
- return this.http.post(this.url, post_v, {
2868
- headers: this.headers
2869
- }).pipe(map((res) => {
2870
- // Handle errors, display if enabled
2871
- let err;
2872
- if (!res) {
2873
- err = new Error('Empty server response');
2874
- }
2875
- else if (res.result_msg === 'KO') {
2876
- err = new Error(res.msg);
2877
- }
2878
- else {
2879
- if (res.result_data.length > 0) {
2880
- localStorage.setItem(this.app_s.COMPANY_KEY + "token", res.result_data[0].token);
2881
- }
2882
- }
2883
- if (err) {
2884
- console.error(err);
2885
- if (displayError) {
2886
- this.toastr.error(err.message);
2887
- }
2888
- throw new Error(err);
2889
- }
2890
- return res || new QGResult();
2891
- }), catchError((err) => {
2892
- // In a real world app, we might use a remote logging infrastructure
2893
- // We'd also dig deeper into the error to get a better message
2894
- let errMsg = (err.message) ? err.message : err.status ? `${err.status} - ${err.statusText}` : 'Server error';
2895
- console.error(errMsg); // log to console instead
2896
- throw err;
2897
- }));
2898
- }
2899
- get_user_info(username, displayError = true) {
2900
- this.url = this.app_s.API_ENDPOINT + this.app_s.LOGIN_ENDPOINT;
2901
- let post_v = JSON.stringify({ username_info: username });
2902
- return this.http.post(this.url, post_v, {
2903
- headers: this.headers
2904
- }).pipe(map((res) => {
2905
- // Handle errors, display if enabled
2906
- let err;
2907
- if (!res) {
2908
- err = new Error('Empty server response');
2909
- }
2910
- else if (res.result_msg === 'KO') {
2911
- err = new Error(res.msg);
2912
- }
2913
- if (err) {
2914
- console.error(err);
2915
- if (displayError) {
2916
- this.toastr.error(err.message);
2917
- }
2918
- throw new Error(err);
2919
- }
2920
- return res || new QGResult();
2921
- }), catchError((err) => {
2922
- // In a real world app, we might use a remote logging infrastructure
2923
- // We'd also dig deeper into the error to get a better message
2924
- let errMsg = (err.message) ? err.message : err.status ? `${err.status} - ${err.statusText}` : 'Server error';
2925
- console.error(errMsg); // log to console instead
2926
- throw err;
2927
- }));
2155
+ get_user_info(username, displayError = true) {
2156
+ this.url = this.app_s.API_ENDPOINT + this.app_s.LOGIN_ENDPOINT;
2157
+ let post_v = JSON.stringify({ username_info: username });
2158
+ return this.http.post(this.url, post_v, {
2159
+ headers: this.headers
2160
+ }).pipe(map((res) => {
2161
+ // Handle errors, display if enabled
2162
+ let err;
2163
+ if (!res) {
2164
+ err = new Error('Empty server response');
2165
+ }
2166
+ else if (res.result_msg === 'KO') {
2167
+ err = new Error(res.msg);
2168
+ }
2169
+ if (err) {
2170
+ console.error(err);
2171
+ if (displayError) {
2172
+ this.toastr.error(err.message);
2173
+ }
2174
+ throw new Error(err);
2175
+ }
2176
+ return res || new QGResult();
2177
+ }), catchError((err) => {
2178
+ // In a real world app, we might use a remote logging infrastructure
2179
+ // We'd also dig deeper into the error to get a better message
2180
+ let errMsg = (err.message) ? err.message : err.status ? `${err.status} - ${err.statusText}` : 'Server error';
2181
+ console.error(errMsg); // log to console instead
2182
+ throw err;
2183
+ }));
2928
2184
  }
2929
2185
  passrecovery(email, displayError = true) {
2930
2186
  let post_v = JSON.stringify({ email: email, websiteroot: this.app_s.COMPANY_SITE_ROOT, op: 'send_email' });
@@ -3697,41 +2953,865 @@ FHUploadPanelComponent = __decorate([
3697
2953
  <mat-icon>delete</mat-icon>
3698
2954
  </a>
3699
2955
 
3700
- <a mat-icon-button [matTooltip]="'Cancellazione consentita solo a: '+app.can_delete_m" *ngIf="!app.can_delete" [disabled]="true" >
3701
- <mat-icon>delete</mat-icon>
3702
- </a>
2956
+ <a mat-icon-button [matTooltip]="'Cancellazione consentita solo a: '+app.can_delete_m" *ngIf="!app.can_delete" [disabled]="true" >
2957
+ <mat-icon>delete</mat-icon>
2958
+ </a>
2959
+
2960
+ </td>
2961
+
2962
+ </tr>
2963
+ </tbody>
2964
+ </table>
2965
+ <table width="98%" class="fh_table" *ngIf="b_mobile">
2966
+ <tbody>
2967
+
2968
+ <tr *ngFor="let app of arr_g;let odd=odd; let even=even;" style="font-size: 15px;" [ngClass]="{ odd: odd, even: even }">
2969
+ <td style="text-align:center;vertical-align: middle;width:36px;height:36px;">
2970
+ <div style="text-align:center;vertical-align: middle;width:28px;height:28px;">
2971
+ <img src="assets/icons/square-o/{{app.icon}}" style="width:28px;height:28px;"></div> </td>
2972
+ <td *ngIf="b_mobile" style="text-align:center">{{app.Filename}}<br><br>
2973
+ <button style="background-color: #F5F5F5" (click)="download_all(app)" mat-flat-button>DOWNLOAD</button>
2974
+ </td>
2975
+ </tr>
2976
+ </tbody>
2977
+ </table>
2978
+ </div>
2979
+ </div>
2980
+ <div *ngIf="!b_ini && b_initt" style="color:#ff0000"><b>ATTENZIONE COMPONENTE NON INIZIALIZZATO</b></div>
2981
+
2982
+ `,
2983
+ styles: [`
2984
+
2985
+
2986
+
2987
+ `]
2988
+ }),
2989
+ __metadata("design:paramtypes", [AppService, QueryService, ToastrService, MatDialog, AuthenticationService, UtilityService])
2990
+ ], FHUploadPanelComponent);
2991
+
2992
+ let win_uploads = class win_uploads {
2993
+ constructor(data, dialogRef, _dataService, toastr, dialog, app_s) {
2994
+ this.data = data;
2995
+ this.dialogRef = dialogRef;
2996
+ this._dataService = _dataService;
2997
+ this.toastr = toastr;
2998
+ this.dialog = dialog;
2999
+ this.app_s = app_s;
3000
+ this.enabled = true;
3001
+ this.access_control = true;
3002
+ this.App = '';
3003
+ this.K = '';
3004
+ this.title = "ALLEGATI";
3005
+ this.sovrascrivi_path = '';
3006
+ if (data != null) {
3007
+ if (data.App != null)
3008
+ this.App = data.App;
3009
+ if (data.K != null)
3010
+ this.K = data.K;
3011
+ }
3012
+ }
3013
+ close() { this.dialogRef.close(null); }
3014
+ ngAfterViewInit() {
3015
+ setTimeout(() => {
3016
+ if (this.App == '') {
3017
+ this.App = this.app_s.getState().wkf_doc_info.uiid_app;
3018
+ this.K = this.app_s.getState().wkf_doc_info.uiid_doc;
3019
+ }
3020
+ this.init(this.App, this.K);
3021
+ });
3022
+ }
3023
+ init(p_app, p_k) {
3024
+ this.App = p_app;
3025
+ this.K = p_k;
3026
+ this.upc.init(this.App, this.K);
3027
+ }
3028
+ };
3029
+ win_uploads.ctorParameters = () => [
3030
+ { type: undefined, decorators: [{ type: Inject, args: [MAT_DIALOG_DATA,] }] },
3031
+ { type: MatDialogRef },
3032
+ { type: QueryService },
3033
+ { type: ToastrService },
3034
+ { type: MatDialog },
3035
+ { type: AppService }
3036
+ ];
3037
+ __decorate([
3038
+ ViewChild('upc'),
3039
+ __metadata("design:type", FHUploadPanelComponent)
3040
+ ], win_uploads.prototype, "upc", void 0);
3041
+ win_uploads = __decorate([
3042
+ Component({
3043
+ selector: 'wkf_win_upload',
3044
+ template: `
3045
+ <div style="width:100%" fxLayout="row" fxLayoutAlign="end start"><img src="assets/icons/x.png" style="cursor: pointer;" (click)="close()" /> </div>
3046
+ <hr width="100%" size="0.5" color="#DDDDDD">
3047
+ <mat-toolbar color="primary" style="width:90%;"><div fxFlex="20">{{title}}</div>
3048
+ <div fxLayout="row" fxLayoutAlign="center end" fxFlex="90" >
3049
+
3050
+
3051
+ </div>
3052
+ </mat-toolbar>
3053
+ <mat-dialog-content style="font-size:12px">
3054
+ <FHUploadPanel [enabled]="enabled" #upc [access_control]="access_control" [sovrascrivi_path]="sovrascrivi_path"></FHUploadPanel>
3055
+ </mat-dialog-content>
3056
+ <br><br>
3057
+ <div style="width:100%;text-align:center;" >
3058
+ <button mat-flat-button style="background-color: #F5F5F5" (click)="close()">CHIUDI</button>
3059
+
3060
+ </div>
3061
+
3062
+ `,
3063
+ styles: [`
3064
+
3065
+
3066
+ `]
3067
+ }),
3068
+ __param(0, Inject(MAT_DIALOG_DATA)),
3069
+ __metadata("design:paramtypes", [Object, MatDialogRef, QueryService, ToastrService, MatDialog, AppService])
3070
+ ], win_uploads);
3071
+
3072
+ const noop$1 = () => {
3073
+ };
3074
+ const ɵ0$1 = noop$1;
3075
+ const CUSTOM_INPUT_CONTROL_VALUE_ACCESSOR$1 = {
3076
+ provide: NG_VALUE_ACCESSOR,
3077
+ useExisting: forwardRef(() => FHTextArea),
3078
+ multi: true
3079
+ };
3080
+ let FHTextArea = class FHTextArea {
3081
+ constructor() {
3082
+ this.hidden = false;
3083
+ this.label = "";
3084
+ this.enabled = true;
3085
+ this.required = false;
3086
+ this.rows = 3;
3087
+ this.change = new EventEmitter();
3088
+ this.focusout = new EventEmitter();
3089
+ this.focusin = new EventEmitter();
3090
+ this.text_v = '';
3091
+ this.onChange = (_) => {
3092
+ };
3093
+ this.onTouched = () => {
3094
+ };
3095
+ }
3096
+ onFi() {
3097
+ setTimeout(() => {
3098
+ this.focusin.emit(this.text_v);
3099
+ });
3100
+ }
3101
+ onFu() {
3102
+ setTimeout(() => {
3103
+ this.focusout.emit(this.text_v);
3104
+ });
3105
+ }
3106
+ modelch() {
3107
+ setTimeout(() => {
3108
+ this.onChange(this.text_v);
3109
+ this.change.emit(this.text_v);
3110
+ });
3111
+ }
3112
+ ngAfterViewInit() { }
3113
+ writeValue(value) {
3114
+ this.text_v = value;
3115
+ }
3116
+ registerOnChange(fn) {
3117
+ this.onChange = fn;
3118
+ }
3119
+ registerOnTouched(fn) {
3120
+ this.onTouched = fn;
3121
+ }
3122
+ };
3123
+ __decorate([
3124
+ Input(),
3125
+ __metadata("design:type", Boolean)
3126
+ ], FHTextArea.prototype, "hidden", void 0);
3127
+ __decorate([
3128
+ Input(),
3129
+ __metadata("design:type", String)
3130
+ ], FHTextArea.prototype, "label", void 0);
3131
+ __decorate([
3132
+ Input(),
3133
+ __metadata("design:type", Boolean)
3134
+ ], FHTextArea.prototype, "enabled", void 0);
3135
+ __decorate([
3136
+ Input(),
3137
+ __metadata("design:type", Boolean)
3138
+ ], FHTextArea.prototype, "required", void 0);
3139
+ __decorate([
3140
+ Input(),
3141
+ __metadata("design:type", Number)
3142
+ ], FHTextArea.prototype, "rows", void 0);
3143
+ __decorate([
3144
+ Output(),
3145
+ __metadata("design:type", EventEmitter)
3146
+ ], FHTextArea.prototype, "change", void 0);
3147
+ __decorate([
3148
+ Output(),
3149
+ __metadata("design:type", EventEmitter)
3150
+ ], FHTextArea.prototype, "focusout", void 0);
3151
+ __decorate([
3152
+ Output(),
3153
+ __metadata("design:type", EventEmitter)
3154
+ ], FHTextArea.prototype, "focusin", void 0);
3155
+ FHTextArea = __decorate([
3156
+ Component({
3157
+ selector: 'FHTextArea',
3158
+ providers: [CUSTOM_INPUT_CONTROL_VALUE_ACCESSOR$1],
3159
+ template: `
3160
+ <mat-form-field [hidden]="hidden" appearance="outline" floatLabel="always"><mat-label>{{label}}</mat-label>
3161
+ <textarea matInput [rows]="rows" type="text" [(ngModel)]="text_v" [readonly]="!enabled" [required]="required" (focusout)="onFu()" (focusin)="onFi()" (ngModelChange)="modelch()"></textarea>
3162
+ </mat-form-field>
3163
+ `,
3164
+ styles: [`
3165
+
3166
+ `]
3167
+ }),
3168
+ __metadata("design:paramtypes", [])
3169
+ ], FHTextArea);
3170
+
3171
+ let CheckboxEditorComponent = class CheckboxEditorComponent {
3172
+ constructor() {
3173
+ }
3174
+ agInit(params) {
3175
+ this.params = params;
3176
+ this.value = this.params.value;
3177
+ }
3178
+ getValue() {
3179
+ return this.value;
3180
+ }
3181
+ ngAfterViewInit() {
3182
+ setTimeout(() => {
3183
+ if (this.input != null)
3184
+ if (this.input.element != null)
3185
+ if (this.input.element.nativeElement != null)
3186
+ this.input.element.nativeElement.focus();
3187
+ });
3188
+ }
3189
+ };
3190
+ __decorate([
3191
+ ViewChild('input', { read: ViewContainerRef }),
3192
+ __metadata("design:type", Object)
3193
+ ], CheckboxEditorComponent.prototype, "input", void 0);
3194
+ CheckboxEditorComponent = __decorate([
3195
+ Component({
3196
+ selector: 'checkbox-cell',
3197
+ template: `
3198
+ <FHCheckBox [(ngModel)]="value">
3199
+ </FHCheckBox>
3200
+ `
3201
+ }),
3202
+ __metadata("design:paramtypes", [])
3203
+ ], CheckboxEditorComponent);
3204
+
3205
+ let AppMakerService = class AppMakerService {
3206
+ constructor(http, app_s, toastr) {
3207
+ this.http = http;
3208
+ this.app_s = app_s;
3209
+ this.toastr = toastr;
3210
+ this.url = this.app_s.API_ENDPOINT + this.app_s.APPMAKER_ENDPOINT; // URL to web API
3211
+ }
3212
+ doQuery(queryp, displayError = true) {
3213
+ this.url = this.app_s.API_ENDPOINT + this.app_s.APPMAKER_ENDPOINT;
3214
+ this.headers = new HttpHeaders({
3215
+ 'Content-Type': 'application/json',
3216
+ 'Authorization': 'Bearer ' + localStorage.getItem(this.app_s.COMPANY_KEY + "token"),
3217
+ });
3218
+ // console.log('AppMakerService url: '+ this.url);
3219
+ let post_v = JSON.stringify(queryp);
3220
+ // console.log(post_v);
3221
+ return this.http.post(this.url, post_v)
3222
+ .pipe(map((res) => {
3223
+ // Handle errors, display if enabled
3224
+ let r = res;
3225
+ let err;
3226
+ if (!res) {
3227
+ err = new Error('Empty server response');
3228
+ }
3229
+ else if (r.result_msg === 'KO') {
3230
+ err = new Error(r.msg);
3231
+ }
3232
+ if (err) {
3233
+ console.error(err);
3234
+ if (displayError) {
3235
+ this.toastr.error(err.message);
3236
+ }
3237
+ throw new Error(err);
3238
+ }
3239
+ return r || new QGResult();
3240
+ }), catchError((err) => {
3241
+ // In a real world app, we might use a remote logging infrastructure
3242
+ // We'd also dig deeper into the error to get a better message
3243
+ let errMsg = (err.message) ? err.message : err.status ? `${err.status} - ${err.statusText}` : 'Server error';
3244
+ console.error(errMsg); // log to console instead
3245
+ throw err;
3246
+ }));
3247
+ }
3248
+ extractData(res) {
3249
+ //console.log(res);
3250
+ let body = res.json();
3251
+ // console.log(body);
3252
+ return body || {};
3253
+ }
3254
+ handleError(error) {
3255
+ // In a real world app, we might use a remote logging infrastructure
3256
+ // We'd also dig deeper into the error to get a better message
3257
+ let errMsg = (error.message) ? error.message :
3258
+ error.status ? `${error.status} - ${error.statusText}` : 'Server error';
3259
+ console.error(errMsg); // log to console instead
3260
+ return Observable.throw(errMsg);
3261
+ }
3262
+ };
3263
+ AppMakerService.ctorParameters = () => [
3264
+ { type: HttpClient },
3265
+ { type: AppService },
3266
+ { type: ToastrService }
3267
+ ];
3268
+ AppMakerService.ɵprov = ɵɵdefineInjectable({ factory: function AppMakerService_Factory() { return new AppMakerService(ɵɵinject(HttpClient), ɵɵinject(AppService), ɵɵinject(ToastrService)); }, token: AppMakerService, providedIn: "root" });
3269
+ AppMakerService = __decorate([
3270
+ Injectable({
3271
+ providedIn: 'root',
3272
+ }),
3273
+ __metadata("design:paramtypes", [HttpClient, AppService, ToastrService])
3274
+ ], AppMakerService);
3275
+
3276
+ let NumericEditorComponent = class NumericEditorComponent {
3277
+ constructor(uti_s) {
3278
+ this.uti_s = uti_s;
3279
+ this.cancelBeforeStart = false;
3280
+ }
3281
+ agInit(params) {
3282
+ this.params = params;
3283
+ if (typeof (this.value) == "string")
3284
+ this.value = this.params.value;
3285
+ else
3286
+ this.value = this.uti_s.format_currency(this.params.value);
3287
+ // console.log('numeric editore: agInit');
3288
+ // only start edit if key pressed is a number, not a letter
3289
+ // this.input.element.nativeElement.select();
3290
+ // this.uti_s.print_param(new QParam());
3291
+ // this.input.element.nativeElement.setSelectionRange(0, String(this.value).length)
3292
+ if ('1234567890,'.indexOf(params.charPress) >= 0) {
3293
+ this.value = params.charPress;
3294
+ setTimeout(() => {
3295
+ this.uti_s.setSelectionRange(this.input.element.nativeElement, 1, String(this.value).length);
3296
+ }, 100);
3297
+ }
3298
+ else
3299
+ setTimeout(() => {
3300
+ this.uti_s.setSelectionRange(this.input.element.nativeElement, 0, String(this.value).length);
3301
+ }, 100);
3302
+ this.cancelBeforeStart = params.charPress && ('1234567890,'.indexOf(params.charPress) < 0);
3303
+ }
3304
+ getValue() {
3305
+ // console.log('numeric editore: getValue ['+String(this.value)+']');
3306
+ if (String(this.value) == '')
3307
+ return 0;
3308
+ let appov = 0;
3309
+ if (typeof (this.value) == "string") {
3310
+ appov = parseFloat(this.value.split('.').join('').split(',').join('.'));
3311
+ }
3312
+ else
3313
+ appov = this.value;
3314
+ if (appov != null)
3315
+ return appov;
3316
+ else
3317
+ return 0;
3318
+ }
3319
+ isCancelBeforeStart() {
3320
+ return this.cancelBeforeStart;
3321
+ }
3322
+ // will reject the number if it greater than 1,000,000
3323
+ // not very practical, but demonstrates the method.
3324
+ isCancelAfterEnd() {
3325
+ if (typeof (this.value) == "string")
3326
+ return parseFloat(this.value.split('.').join('').split(',').join('.')) > 1000000;
3327
+ else
3328
+ return false;
3329
+ }
3330
+ ;
3331
+ onKeyDown(event) {
3332
+ if (!this.isKeyPressedNumeric(event)) {
3333
+ if (event.preventDefault)
3334
+ event.preventDefault();
3335
+ }
3336
+ }
3337
+ // dont use afterGuiAttached for post gui events - hook into ngAfterViewInit instead for this
3338
+ ngAfterViewInit() {
3339
+ setTimeout(() => {
3340
+ //console.log(this.input.element.nativeElement);
3341
+ // this.input.first.nativeElement.focus();
3342
+ if (this.input != null)
3343
+ if (this.input.element != null)
3344
+ if (this.input.element.nativeElement != null)
3345
+ this.input.element.nativeElement.focus();
3346
+ });
3347
+ // this.input.element.nativeElement.setSelectionRange(0, this.input.element.nativeElement.value.length)
3348
+ /*if (this.input.nativeElement.classList.contains('ng-untouched')) {
3349
+ this.input.invokeElementMethod(this.input.nativeElement, 'focus', []);
3350
+ }*/
3351
+ }
3352
+ getCharCodeFromEvent(event) {
3353
+ event = event || window.event;
3354
+ return (typeof event.which == "undefined") ? event.keyCode : event.which;
3355
+ }
3356
+ isCharNumeric(charStr) {
3357
+ return !!/\d/.test(charStr);
3358
+ }
3359
+ isKeyPressedNumeric(event) {
3360
+ var charCode = this.getCharCodeFromEvent(event);
3361
+ if (charCode == 8)
3362
+ return true;
3363
+ if (charCode == 188)
3364
+ return true;
3365
+ if (charCode >= 96 && charCode <= 109)
3366
+ return true;
3367
+ var charStr = String.fromCharCode(charCode);
3368
+ // console.log(charCode);
3369
+ return this.isCharNumeric(charStr);
3370
+ }
3371
+ };
3372
+ NumericEditorComponent.ctorParameters = () => [
3373
+ { type: UtilityService }
3374
+ ];
3375
+ __decorate([
3376
+ ViewChild('input', { read: ViewContainerRef }),
3377
+ __metadata("design:type", Object)
3378
+ ], NumericEditorComponent.prototype, "input", void 0);
3379
+ NumericEditorComponent = __decorate([
3380
+ Component({
3381
+ selector: 'numeric-cell',
3382
+ template: `<input #input (keydown)="onKeyDown($event)" [(ngModel)]="value" style="fontSize:40;height:30px;">`
3383
+ }),
3384
+ __metadata("design:paramtypes", [UtilityService])
3385
+ ], NumericEditorComponent);
3386
+
3387
+ let win_time_slider = class win_time_slider {
3388
+ constructor(dialogRef, toastr, m_appService, uti_s) {
3389
+ this.dialogRef = dialogRef;
3390
+ this.toastr = toastr;
3391
+ this.m_appService = m_appService;
3392
+ this.uti_s = uti_s;
3393
+ this.res = "";
3394
+ this.h = 0;
3395
+ this.m = 0;
3396
+ }
3397
+ close() { this.dialogRef.close(null); }
3398
+ change() {
3399
+ this.res = this.uti_s.pad(this.h, 2) + ":" + this.uti_s.pad(this.m, 2).replace("NaN", "00");
3400
+ }
3401
+ ok() {
3402
+ if (this.res.length != 5) {
3403
+ this.toastr.error("ERRORE", "SELEZIONARE L'ORARIO", {
3404
+ timeOut: 1000,
3405
+ progressBar: true,
3406
+ positionClass: 'toast-bottom-right'
3407
+ });
3408
+ return;
3409
+ }
3410
+ this.dialogRef.close(this.res);
3411
+ }
3412
+ ngAfterViewInit() {
3413
+ setTimeout(() => {
3414
+ if (this.m_appService.getState().appo_dialog != null)
3415
+ if (this.m_appService.getState().appo_dialog.val != null) {
3416
+ let a = this.m_appService.getState().appo_dialog.val.split(':');
3417
+ this.h = parseInt(a[0]);
3418
+ this.m = parseInt(a[1]);
3419
+ this.res = this.m_appService.getState().appo_dialog.val;
3420
+ return;
3421
+ }
3422
+ });
3423
+ }
3424
+ };
3425
+ win_time_slider.ctorParameters = () => [
3426
+ { type: MatDialogRef },
3427
+ { type: ToastrService },
3428
+ { type: AppService },
3429
+ { type: UtilityService }
3430
+ ];
3431
+ win_time_slider = __decorate([
3432
+ Component({
3433
+ selector: 'fhtimeslider',
3434
+ template: `
3435
+ <div style="width:100%" fxLayout="row" fxLayoutAlign="end start"><img src="assets/icons/x.png" style="cursor: pointer;" (click)="close()" /> </div>
3436
+ <hr width="100%" size="0.5" color="#DDDDDD">
3437
+
3438
+ <h2 mat-dialog-title style="min-width:300px">Seleziona Orario -> {{res}}</h2>
3439
+
3440
+ <mat-dialog-content style="font-size: 15px;"><br><br>
3441
+ <table>
3442
+ <tr>
3443
+ <td>Ore:</td>
3444
+ <td>
3445
+ <mat-slider
3446
+ [max]="23" (change)="change()"
3447
+ [min]="0"
3448
+ [step]="1"
3449
+ thumbLabel
3450
+ [(ngModel)]="h">
3451
+ </mat-slider>
3452
+ </td>
3453
+ </tr>
3454
+ <tr>
3455
+ <td>Minuti:</td>
3456
+ <td>
3457
+ <mat-slider
3458
+ [max]="45"
3459
+ [min]="0" (change)="change()"
3460
+ [step]="15"
3461
+ thumbLabel
3462
+ [(ngModel)]="m">
3463
+ </mat-slider>
3464
+ </td>
3465
+ </tr>
3466
+ </table>
3467
+ </mat-dialog-content>
3468
+
3469
+
3470
+ <mat-dialog-actions>
3471
+
3472
+
3473
+ <button mat-flat-button color="primary" (click)="ok()">OK</button>
3474
+ <button mat-flat-button style="background-color: #F5F5F5" (click)="dialogRef.close('')">CHIUDI</button>
3475
+
3476
+ </mat-dialog-actions>
3477
+ `
3478
+ }),
3479
+ __metadata("design:paramtypes", [MatDialogRef, ToastrService, AppService, UtilityService])
3480
+ ], win_time_slider);
3481
+
3482
+ let DecimalMask = class DecimalMask {
3483
+ constructor(model) {
3484
+ this.model = model;
3485
+ }
3486
+ onInputChange(event, backspace) {
3487
+ var valArray = event.toString().split(',');
3488
+ for (var i = 0; i < valArray.length; ++i) {
3489
+ valArray[i] = valArray[i].replace(/\D/g, '');
3490
+ }
3491
+ var newVal;
3492
+ if (valArray.length === 0) {
3493
+ newVal = '';
3494
+ }
3495
+ else {
3496
+ let matches = valArray[0].match(/[0-9]{3}/mig);
3497
+ if (matches !== null && valArray[0].length > 3) {
3498
+ let commaGroups = Array.from(Array.from(valArray[0]).reverse().join('').match(/[0-9]{3}/mig).join()).reverse().join('');
3499
+ let replacement = valArray[0].replace(commaGroups.replace(/\D/g, ''), '');
3500
+ newVal = (replacement.length > 0 ? replacement + "." : "") + commaGroups;
3501
+ }
3502
+ else {
3503
+ newVal = valArray[0];
3504
+ }
3505
+ if (valArray.length > 1) {
3506
+ newVal += "," + valArray[1].substring(0, 2);
3507
+ }
3508
+ }
3509
+ // set the new value
3510
+ // console.log('new val:'+newVal);
3511
+ this.model.valueAccessor.writeValue(newVal);
3512
+ }
3513
+ };
3514
+ DecimalMask.ctorParameters = () => [
3515
+ { type: NgControl }
3516
+ ];
3517
+ DecimalMask = __decorate([
3518
+ Directive({
3519
+ selector: '[ngModel][decimal]',
3520
+ host: {
3521
+ '(ngModelChange)': 'onInputChange($event)'
3522
+ }
3523
+ }),
3524
+ __metadata("design:paramtypes", [NgControl])
3525
+ ], DecimalMask);
3526
+
3527
+ const noop$2 = () => {
3528
+ };
3529
+ const ɵ0$2 = noop$2;
3530
+ const CUSTOM_INPUT_CONTROL_VALUE_ACCESSOR$2 = {
3531
+ provide: NG_VALUE_ACCESSOR,
3532
+ useExisting: forwardRef(() => FHTimePickerComponent),
3533
+ multi: true
3534
+ };
3535
+ let FHTimePickerComponent = class FHTimePickerComponent {
3536
+ /**
3537
+ *
3538
+ */
3539
+ constructor(_dataService, dialog, m_appService, toastr, uti_s) {
3540
+ this._dataService = _dataService;
3541
+ this.dialog = dialog;
3542
+ this.m_appService = m_appService;
3543
+ this.toastr = toastr;
3544
+ this.uti_s = uti_s;
3545
+ this.maxore = 23;
3546
+ this.label = "";
3547
+ this.enabled = true;
3548
+ this.show_picker = false;
3549
+ this.selchange = new EventEmitter(); // it's preferable to use standart output: '(change)'
3550
+ this.ngChange = new EventEmitter();
3551
+ this.h = 0;
3552
+ this.m = 0;
3553
+ this.res = "";
3554
+ this.onChange = (_) => {
3555
+ };
3556
+ this.onTouched = () => {
3557
+ };
3558
+ }
3559
+ uph() {
3560
+ if (this.h < this.maxore) {
3561
+ this.h++;
3562
+ }
3563
+ this.sc();
3564
+ }
3565
+ doh() {
3566
+ if (this.h > 0) {
3567
+ this.h--;
3568
+ }
3569
+ this.sc();
3570
+ }
3571
+ upm() {
3572
+ if (this.m < 60) {
3573
+ this.m++;
3574
+ }
3575
+ this.sc();
3576
+ }
3577
+ dom() {
3578
+ if (this.m > 0) {
3579
+ this.m--;
3580
+ }
3581
+ this.sc();
3582
+ }
3583
+ onFu() {
3584
+ if (this.h > this.maxore) {
3585
+ this.h = this.maxore;
3586
+ }
3587
+ this.sc();
3588
+ }
3589
+ onMi() {
3590
+ if (this.m > 59) {
3591
+ this.m = 59;
3592
+ }
3593
+ this.sc();
3594
+ }
3595
+ onKeyDown(event) {
3596
+ if (!this.isKeyPressedNumeric(event)) {
3597
+ if (event.preventDefault) {
3598
+ event.preventDefault();
3599
+ }
3600
+ }
3601
+ this.sc();
3602
+ }
3603
+ onKeyDown1(event) {
3604
+ if (!this.isKeyPressedNumeric(event)) {
3605
+ if (event.preventDefault) {
3606
+ event.preventDefault();
3607
+ }
3608
+ }
3609
+ this.sc();
3610
+ }
3611
+ resetValue() {
3612
+ this.h = 0;
3613
+ this.m = 0;
3614
+ }
3615
+ annulla() {
3616
+ this.show_picker = false;
3617
+ }
3618
+ ok() {
3619
+ if (this.h == 0 && this.m == 0) {
3620
+ this.toastr.error("ERRORE", "SELEZIONARE L'ORARIO", {
3621
+ timeOut: 1000,
3622
+ progressBar: true,
3623
+ positionClass: 'toast-bottom-right'
3624
+ });
3625
+ return;
3626
+ }
3627
+ //this.selval=this.res;
3628
+ this.sc();
3629
+ //this.show_picker=false;
3630
+ }
3631
+ change() {
3632
+ this.res = this.uti_s.pad(this.h, 2) + ":" + this.uti_s.pad(this.m, 2).replace("NaN", "00");
3633
+ }
3634
+ setByDescri(desc_val) {
3635
+ if (desc_val == null) {
3636
+ desc_val = "00:00";
3637
+ }
3638
+ if (desc_val == '') {
3639
+ desc_val = "00:00";
3640
+ }
3641
+ if (desc_val.indexOf(':') == -1) {
3642
+ desc_val = "00:00";
3643
+ }
3644
+ let a = desc_val.split(':');
3645
+ this.h = parseInt(a[0]);
3646
+ this.m = parseInt(a[1]);
3647
+ if (desc_val.length != 5) {
3648
+ this.onChange(this.getValue());
3649
+ }
3650
+ }
3651
+ isValidVal() {
3652
+ return true;
3653
+ }
3654
+ setByValue(desc_val) {
3655
+ this.setByDescri(desc_val);
3656
+ }
3657
+ setValue(desc_val) {
3658
+ this.setByDescri(desc_val);
3659
+ }
3660
+ getDescri() {
3661
+ return this.uti_s.pad(this.h, 2) + ":" + this.uti_s.pad(this.m, 2).replace("NaN", "00");
3662
+ }
3663
+ getData(campo) {
3664
+ return this.uti_s.pad(this.h, 2) + ":" + this.uti_s.pad(this.m, 2).replace("NaN", "00");
3665
+ }
3666
+ getObj() {
3667
+ return this.uti_s.pad(this.h, 2) + ":" + this.uti_s.pad(this.m, 2).replace("NaN", "00");
3668
+ }
3669
+ getValue() {
3670
+ return this.uti_s.pad(this.h, 2) + ":" + this.uti_s.pad(this.m, 2).replace("NaN", "00");
3671
+ }
3672
+ getHours() {
3673
+ return this.h;
3674
+ }
3675
+ getMinutes() {
3676
+ return this.m;
3677
+ }
3678
+ ngAfterViewInit() {
3679
+ }
3680
+ sc() {
3681
+ const value = this.getValue();
3682
+ this
3683
+ .selchange
3684
+ .emit();
3685
+ this.ngChange.emit(value);
3686
+ this.onChange(value);
3687
+ }
3688
+ isCharNumeric(charStr) {
3689
+ return !!/\d/.test(charStr);
3690
+ }
3691
+ getCharCodeFromEvent(event) {
3692
+ event = event || window.event;
3693
+ return (typeof event.which == "undefined") ? event.keyCode : event.which;
3694
+ }
3695
+ isKeyPressedNumeric(event) {
3696
+ //console.log(event.key);
3697
+ if ('0123456789'.indexOf(event.key) !== -1
3698
+ || event.key == "ArrowRight"
3699
+ || event.key == "ArrowLeft"
3700
+ || event.key == "ArrowDown"
3701
+ || event.key == "ArrowUp"
3702
+ || event.key == "Backspace") {
3703
+ return true;
3704
+ }
3705
+ else {
3706
+ return false;
3707
+ }
3708
+ }
3709
+ writeValue(value) {
3710
+ this.setByValue(value);
3711
+ }
3712
+ registerOnChange(fn) {
3713
+ this.onChange = fn;
3714
+ }
3715
+ registerOnTouched(fn) {
3716
+ this.onTouched = fn;
3717
+ }
3718
+ }; // -
3719
+ FHTimePickerComponent.ctorParameters = () => [
3720
+ { type: QueryService },
3721
+ { type: MatDialog },
3722
+ { type: AppService },
3723
+ { type: ToastrService },
3724
+ { type: UtilityService }
3725
+ ];
3726
+ __decorate([
3727
+ Input(),
3728
+ __metadata("design:type", Number)
3729
+ ], FHTimePickerComponent.prototype, "maxore", void 0);
3730
+ __decorate([
3731
+ Input(),
3732
+ __metadata("design:type", String)
3733
+ ], FHTimePickerComponent.prototype, "label", void 0);
3734
+ __decorate([
3735
+ Input(),
3736
+ __metadata("design:type", Boolean)
3737
+ ], FHTimePickerComponent.prototype, "enabled", void 0);
3738
+ __decorate([
3739
+ Output(),
3740
+ __metadata("design:type", EventEmitter)
3741
+ ], FHTimePickerComponent.prototype, "selchange", void 0);
3742
+ __decorate([
3743
+ Output('change'),
3744
+ __metadata("design:type", EventEmitter)
3745
+ ], FHTimePickerComponent.prototype, "ngChange", void 0);
3746
+ FHTimePickerComponent = __decorate([
3747
+ Component({
3748
+ selector: 'FHTimePicker',
3749
+ providers: [CUSTOM_INPUT_CONTROL_VALUE_ACCESSOR$2],
3750
+ template: `
3751
+ <div fxLayout="row" fxLayoutAlign="center center"><b>{{label}}</b>&nbsp;&nbsp;
3752
+ <div fxLayout="column" fxLayoutAlign="center center">
3753
+ <div *ngIf="enabled" class="yourClass">
3754
+ <mat-icon (click)="uph()">keyboard_arrow_up</mat-icon>
3755
+ </div>
3756
+
3757
+ <input
3758
+ style="width:40px;text-align:center;" (keydown)="onKeyDown($event)" (focusout)="onFu()" [disabled]="!enabled"
3759
+ [(ngModel)]="h">
3760
+ <div class="yourClass" *ngIf="enabled">
3761
+ <mat-icon class="yourClass" (click)="doh()">keyboard_arrow_down</mat-icon>
3762
+ </div>
3763
+ </div>
3703
3764
 
3704
- </td>
3765
+ &nbsp;&nbsp;<b style="font-size:28px">:</b>&nbsp;&nbsp;
3705
3766
 
3706
- </tr>
3707
- </tbody>
3708
- </table>
3709
- <table width="98%" class="fh_table" *ngIf="b_mobile">
3710
- <tbody>
3767
+ <div fxLayout="column" fxLayoutAlign="center center">
3768
+ <div class="yourClass" *ngIf="enabled">
3769
+ <mat-icon class="yourClass" (click)="upm()">keyboard_arrow_up</mat-icon>
3770
+ </div>
3711
3771
 
3712
- <tr *ngFor="let app of arr_g;let odd=odd; let even=even;" style="font-size: 15px;" [ngClass]="{ odd: odd, even: even }">
3713
- <td style="text-align:center;vertical-align: middle;width:36px;height:36px;">
3714
- <div style="text-align:center;vertical-align: middle;width:28px;height:28px;">
3715
- <img src="assets/icons/square-o/{{app.icon}}" style="width:28px;height:28px;"></div> </td>
3716
- <td *ngIf="b_mobile" style="text-align:center">{{app.Filename}}<br><br>
3717
- <button style="background-color: #F5F5F5" (click)="download_all(app)" mat-flat-button>DOWNLOAD</button>
3718
- </td>
3719
- </tr>
3720
- </tbody>
3721
- </table>
3772
+ <input
3773
+ style="width:40px;text-align:center;" (keydown)="onKeyDown1($event)" (focusout)="onMi()" [disabled]="!enabled"
3774
+ [(ngModel)]="m">
3775
+ <div class="yourClass" *ngIf="enabled">
3776
+ <mat-icon class="yourClass" (click)="dom()">keyboard_arrow_down</mat-icon>
3777
+ </div>
3722
3778
  </div>
3723
3779
  </div>
3724
- <div *ngIf="!b_ini && b_initt" style="color:#ff0000"><b>ATTENZIONE COMPONENTE NON INIZIALIZZATO</b></div>
3725
-
3726
3780
  `,
3727
3781
  styles: [`
3782
+ .hhh {
3783
+ height: 63px;
3784
+ width: 100px;
3785
+ background-color: rgba(255, 0, 0, .1);
3786
+ }
3728
3787
 
3729
-
3730
-
3788
+ .yourClass {
3789
+ cursor: pointer;
3790
+ user-select: none;
3791
+ }
3731
3792
  `]
3732
3793
  }),
3733
- __metadata("design:paramtypes", [AppService, QueryService, ToastrService, MatDialog, AuthenticationService, UtilityService])
3734
- ], FHUploadPanelComponent);
3794
+ __metadata("design:paramtypes", [QueryService,
3795
+ MatDialog,
3796
+ AppService,
3797
+ ToastrService,
3798
+ UtilityService])
3799
+ ], FHTimePickerComponent);
3800
+
3801
+ let CurrencyComponent = class CurrencyComponent {
3802
+ agInit(params) {
3803
+ this.params = params;
3804
+ }
3805
+ refresh() {
3806
+ return true;
3807
+ }
3808
+ };
3809
+ CurrencyComponent = __decorate([
3810
+ Component({
3811
+ selector: 'currency-cell',
3812
+ template: `{{params.value | currency:'EUR'}}`
3813
+ })
3814
+ ], CurrencyComponent);
3735
3815
 
3736
3816
  let GridService = class GridService {
3737
3817
  constructor(http, app_s, toastr) {
@@ -10142,86 +10222,6 @@ win_select_level = __decorate([
10142
10222
  __metadata("design:paramtypes", [MatDialogRef, AppService, ToastrService])
10143
10223
  ], win_select_level);
10144
10224
 
10145
- let win_uploads = class win_uploads {
10146
- constructor(data, dialogRef, _dataService, toastr, dialog, app_s) {
10147
- this.data = data;
10148
- this.dialogRef = dialogRef;
10149
- this._dataService = _dataService;
10150
- this.toastr = toastr;
10151
- this.dialog = dialog;
10152
- this.app_s = app_s;
10153
- this.enabled = true;
10154
- this.access_control = true;
10155
- this.App = '';
10156
- this.K = '';
10157
- this.title = "ALLEGATI";
10158
- this.sovrascrivi_path = '';
10159
- if (data != null) {
10160
- if (data.App != null)
10161
- this.App = data.App;
10162
- if (data.K != null)
10163
- this.K = data.K;
10164
- }
10165
- }
10166
- close() { this.dialogRef.close(null); }
10167
- ngAfterViewInit() {
10168
- setTimeout(() => {
10169
- if (this.App == '') {
10170
- this.App = this.app_s.getState().wkf_doc_info.uiid_app;
10171
- this.K = this.app_s.getState().wkf_doc_info.uiid_doc;
10172
- }
10173
- this.init(this.App, this.K);
10174
- });
10175
- }
10176
- init(p_app, p_k) {
10177
- this.App = p_app;
10178
- this.K = p_k;
10179
- this.upc.init(this.App, this.K);
10180
- }
10181
- };
10182
- win_uploads.ctorParameters = () => [
10183
- { type: undefined, decorators: [{ type: Inject, args: [MAT_DIALOG_DATA,] }] },
10184
- { type: MatDialogRef },
10185
- { type: QueryService },
10186
- { type: ToastrService },
10187
- { type: MatDialog },
10188
- { type: AppService }
10189
- ];
10190
- __decorate([
10191
- ViewChild('upc'),
10192
- __metadata("design:type", FHUploadPanelComponent)
10193
- ], win_uploads.prototype, "upc", void 0);
10194
- win_uploads = __decorate([
10195
- Component({
10196
- selector: 'wkf_win_upload',
10197
- template: `
10198
- <div style="width:100%" fxLayout="row" fxLayoutAlign="end start"><img src="assets/icons/x.png" style="cursor: pointer;" (click)="close()" /> </div>
10199
- <hr width="100%" size="0.5" color="#DDDDDD">
10200
- <mat-toolbar color="primary" style="width:90%;"><div fxFlex="20">{{title}}</div>
10201
- <div fxLayout="row" fxLayoutAlign="center end" fxFlex="90" >
10202
-
10203
-
10204
- </div>
10205
- </mat-toolbar>
10206
- <mat-dialog-content style="font-size:12px">
10207
- <FHUploadPanel [enabled]="enabled" #upc [access_control]="access_control" [sovrascrivi_path]="sovrascrivi_path"></FHUploadPanel>
10208
- </mat-dialog-content>
10209
- <br><br>
10210
- <div style="width:100%;text-align:center;" >
10211
- <button mat-flat-button style="background-color: #F5F5F5" (click)="close()">CHIUDI</button>
10212
-
10213
- </div>
10214
-
10215
- `,
10216
- styles: [`
10217
-
10218
-
10219
- `]
10220
- }),
10221
- __param(0, Inject(MAT_DIALOG_DATA)),
10222
- __metadata("design:paramtypes", [Object, MatDialogRef, QueryService, ToastrService, MatDialog, AppService])
10223
- ], win_uploads);
10224
-
10225
10225
  let win_commento_sel_notif = class win_commento_sel_notif {
10226
10226
  constructor(dialogRef, m_appService, toastr, _dataService) {
10227
10227
  this.dialogRef = dialogRef;
@@ -16423,5 +16423,5 @@ class FSResult {
16423
16423
  * Generated bundle index. Do not edit.
16424
16424
  */
16425
16425
 
16426
- export { AppMakerService, AppService, ApprovaGridComponent, AuthenticationService, CheckboxEditorComponent, ComboBoxEditor, CurrencyComponent, FHAutoCompleteComponent, FHCheckBox, FHComboboxComponent, FHConfirmComponent, FHConfirmValues, FHCurrencyFieldComponent, FHCurrencyFormatterDirective, FHCurrencyPipe, FHDatePickerComponent, FHFieldPickListComponent, FHGridComponent, FHGridJSONComponent, FHGuard, FHListComponent, FHListPick, FHLogPanelComponent, FHMdReader, FHNumericFieldComponent, FHPickListComponent, FHRichText, FHRoleManager, FHTableManager, FHTextArea, FHTextInput, FHTimePickerComponent, FHUploadComponent, FHUploadPanelComponent, FHUserFieldComponent, FHUserPickerComponent, FHWinComboSelect, FSInput, FSResult, FileService, FluxhubLibModule, FormBuilderComponent, FormExecuterComponent, GridService, LocalDBService, NumericEditorComponent, OdbcService, OfficeAutomatorService, QGParam, QGResult, QParam, QResult, QueryService, ReplaceLineBreaks, TextAreaEditor, UtilityService, WinAskButtonsComponent, WinAskNumberComponent, WinAskTextBigComponent, WinAskTextComponent, WinOutputComponent, WinWait, WkfService, dati_aggiuntivi, fhimagepreview, win_insert_commento, win_mappa, win_salva_annulla, win_show_image, win_time_slider, win_user_info, wkf_header_bar, wkfapp, CUSTOM_INPUT_CONTROL_VALUE_ACCESSOR as ɵa, CUSTOM_INPUT_CONTROL_VALUE_ACCESSOR$8 as ɵb, win_uploads as ɵba, win_commenti as ɵbb, win_info_doc as ɵbc, win_log as ɵbd, win_recupera_doc as ɵbe, win_riassegna_select_level as ɵbf, win_riassegna_select_user as ɵbg, win_sostituisci_utente as ɵbh, win_commento_sel_notif as ɵbi, win_manage_values as ɵbj, win_manage_roles as ɵbk, FHComboboxComponentFilter as ɵbl, CUSTOM_INPUT_CONTROL_VALUE_ACCESSOR$4 as ɵc, CUSTOM_INPUT_CONTROL_VALUE_ACCESSOR$2 as ɵd, CUSTOM_INPUT_CONTROL_VALUE_ACCESSOR$7 as ɵe, CUSTOM_INPUT_CONTROL_VALUE_ACCESSOR$5 as ɵf, CUSTOM_INPUT_CONTROL_VALUE_ACCESSOR_NUMERIC as ɵg, CUSTOM_INPUT_CONTROL_VALUE_ACCESSOR_RT as ɵh, CUSTOM_INPUT_CONTROL_VALUE_ACCESSOR$1 as ɵi, CUSTOM_INPUT_CONTROL_VALUE_ACCESSOR$3 as ɵj, CUSTOM_INPUT_CONTROL_VALUE_ACCESSOR$6 as ɵk, CUSTOM_INPUT_CONTROL_VALUE_ACCESSOR$9 as ɵl, FHHelpButton as ɵm, SafePipe as ɵn, DecimalMask as ɵo, MOMENT_DATE_FORMATS as ɵp, MomentDateAdapter as ɵq, win_grid_help as ɵr, HighlightService as ɵs, FHViewerComponent as ɵt, FHGridToolBarComponent as ɵv, win_assegna as ɵw, win_conferma as ɵx, win_select_canale as ɵy, win_select_level as ɵz };
16426
+ export { AppMakerService, AppService, ApprovaGridComponent, AuthenticationService, CheckboxEditorComponent, ComboBoxEditor, CurrencyComponent, FHAutoCompleteComponent, FHCheckBox, FHComboboxComponent, FHConfirmComponent, FHConfirmValues, FHCurrencyFieldComponent, FHCurrencyFormatterDirective, FHCurrencyPipe, FHDatePickerComponent, FHFieldPickListComponent, FHGridComponent, FHGridJSONComponent, FHGuard, FHListComponent, FHListPick, FHLogPanelComponent, FHMdReader, FHNumericFieldComponent, FHPickListComponent, FHRichText, FHRoleManager, FHTableManager, FHTextArea, FHTextInput, FHTimePickerComponent, FHUploadComponent, FHUploadPanelComponent, FHUserFieldComponent, FHUserPickerComponent, FHWinComboSelect, FSInput, FSResult, FileService, FluxhubLibModule, FormBuilderComponent, FormExecuterComponent, GridService, LocalDBService, NumericEditorComponent, OdbcService, OfficeAutomatorService, QGParam, QGResult, QParam, QResult, QueryService, ReplaceLineBreaks, TextAreaEditor, UtilityService, WinAskButtonsComponent, WinAskNumberComponent, WinAskTextBigComponent, WinAskTextComponent, WinOutputComponent, WinWait, WkfService, dati_aggiuntivi, fhimagepreview, win_insert_commento, win_mappa, win_salva_annulla, win_show_image, win_time_slider, win_uploads, win_user_info, wkf_header_bar, wkfapp, CUSTOM_INPUT_CONTROL_VALUE_ACCESSOR$1 as ɵa, CUSTOM_INPUT_CONTROL_VALUE_ACCESSOR$8 as ɵb, win_commenti as ɵba, win_info_doc as ɵbb, win_log as ɵbc, win_recupera_doc as ɵbd, win_riassegna_select_level as ɵbe, win_riassegna_select_user as ɵbf, win_sostituisci_utente as ɵbg, win_commento_sel_notif as ɵbh, win_manage_values as ɵbi, win_manage_roles as ɵbj, FHComboboxComponentFilter as ɵbk, CUSTOM_INPUT_CONTROL_VALUE_ACCESSOR$4 as ɵc, CUSTOM_INPUT_CONTROL_VALUE_ACCESSOR as ɵd, CUSTOM_INPUT_CONTROL_VALUE_ACCESSOR$7 as ɵe, CUSTOM_INPUT_CONTROL_VALUE_ACCESSOR$5 as ɵf, CUSTOM_INPUT_CONTROL_VALUE_ACCESSOR_NUMERIC as ɵg, CUSTOM_INPUT_CONTROL_VALUE_ACCESSOR_RT as ɵh, CUSTOM_INPUT_CONTROL_VALUE_ACCESSOR$2 as ɵi, CUSTOM_INPUT_CONTROL_VALUE_ACCESSOR$3 as ɵj, CUSTOM_INPUT_CONTROL_VALUE_ACCESSOR$6 as ɵk, CUSTOM_INPUT_CONTROL_VALUE_ACCESSOR$9 as ɵl, FHHelpButton as ɵm, SafePipe as ɵn, DecimalMask as ɵo, MOMENT_DATE_FORMATS as ɵp, MomentDateAdapter as ɵq, win_grid_help as ɵr, HighlightService as ɵs, FHViewerComponent as ɵt, FHGridToolBarComponent as ɵv, win_assegna as ɵw, win_conferma as ɵx, win_select_canale as ɵy, win_select_level as ɵz };
16427
16427
  //# sourceMappingURL=fluxhub-fluxhub-lib.js.map