newportsite 1.1.3
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.
- package/newportsite-1.1.3.tgz +0 -0
- package/ng-package.json +7 -0
- package/obfuscate.js +70 -0
- package/package.json +15 -0
- package/src/lib/app.component.ts +47 -0
- package/src/lib/app.routing.ts +38 -0
- package/src/lib/auth/alert.component.html +5 -0
- package/src/lib/auth/alert.component.ts +24 -0
- package/src/lib/auth/auth.component.html +1 -0
- package/src/lib/auth/auth.component.ts +10 -0
- package/src/lib/auth/auth.routes.ts +16 -0
- package/src/lib/auth/index.ts +4 -0
- package/src/lib/auth/login.component.html +87 -0
- package/src/lib/auth/login.component.ts +158 -0
- package/src/lib/auth/models/index.ts +1 -0
- package/src/lib/auth/models/user.ts +25 -0
- package/src/lib/auth/register.component.html +157 -0
- package/src/lib/auth/register.component.ts +219 -0
- package/src/lib/auth/services/alert.service.ts +47 -0
- package/src/lib/auth/services/auth.service.ts +28 -0
- package/src/lib/auth/services/index.ts +3 -0
- package/src/lib/auth/services/user.service.spec.ts +112 -0
- package/src/lib/auth/services/user.service.ts +47 -0
- package/src/lib/common/card.component.html +72 -0
- package/src/lib/common/card.component.ts +102 -0
- package/src/lib/common/commands.component.html +8 -0
- package/src/lib/common/commands.component.ts +42 -0
- package/src/lib/common/context.component.html +9 -0
- package/src/lib/common/context.component.ts +38 -0
- package/src/lib/common/grid.component.html +20 -0
- package/src/lib/common/grid.component.ts +747 -0
- package/src/lib/common/index.ts +9 -0
- package/src/lib/common/loader.component.html +5 -0
- package/src/lib/common/loader.component.ts +27 -0
- package/src/lib/common/lookup.component.html +29 -0
- package/src/lib/common/lookup.component.ts +115 -0
- package/src/lib/common/messagebox.component.html +39 -0
- package/src/lib/common/messagebox.component.ts +74 -0
- package/src/lib/common/theme-toggle.component.ts +139 -0
- package/src/lib/config.ts +62 -0
- package/src/lib/containers/default-layout/default-layout.component.html +191 -0
- package/src/lib/containers/default-layout/default-layout.component.ts +158 -0
- package/src/lib/containers/default-layout/index.ts +1 -0
- package/src/lib/containers/index.ts +1 -0
- package/src/lib/directives/component.draggable.ts +80 -0
- package/src/lib/directives/index.ts +2 -0
- package/src/lib/directives/input.directive.spec.ts +158 -0
- package/src/lib/directives/input.directive.ts +210 -0
- package/src/lib/home/dashboard/dashboard.component.html +38 -0
- package/src/lib/home/dashboard/dashboard.component.ts +50 -0
- package/src/lib/home/dashboard/index.ts +1 -0
- package/src/lib/home/index.component.html +1 -0
- package/src/lib/home/index.component.ts +10 -0
- package/src/lib/home/index.routes.ts +29 -0
- package/src/lib/home/index.ts +1 -0
- package/src/lib/home/info/index.ts +1 -0
- package/src/lib/home/info/info.component.css +476 -0
- package/src/lib/home/info/info.component.html +174 -0
- package/src/lib/home/info/info.component.ts +287 -0
- package/src/lib/home/model/article.component.html +10 -0
- package/src/lib/home/model/article.component.ts +50 -0
- package/src/lib/home/model/barchart.component.html +8 -0
- package/src/lib/home/model/barchart.component.ts +59 -0
- package/src/lib/home/model/index.ts +7 -0
- package/src/lib/home/model/itemdetail.component.html +25 -0
- package/src/lib/home/model/itemdetail.component.ts +93 -0
- package/src/lib/home/model/itemtab.component.html +25 -0
- package/src/lib/home/model/itemtab.component.ts +105 -0
- package/src/lib/home/model/model.component.html +121 -0
- package/src/lib/home/model/model.component.ts +510 -0
- package/src/lib/home/model/modeltoolbar.component.html +111 -0
- package/src/lib/home/model/modeltoolbar.component.ts +157 -0
- package/src/lib/home/model/navigation.component.html +86 -0
- package/src/lib/home/model/navigation.component.ts +247 -0
- package/src/lib/home/model/services/index.ts +1 -0
- package/src/lib/home/model/services/model.service.spec.ts +423 -0
- package/src/lib/home/model/services/model.service.ts +319 -0
- package/src/lib/home/modelsearch/index.ts +1 -0
- package/src/lib/home/modelsearch/modelsearch.component.html +124 -0
- package/src/lib/home/modelsearch/modelsearch.component.ts +453 -0
- package/src/lib/interfaces/data.interface.ts +131 -0
- package/src/lib/interfaces/index.ts +2 -0
- package/src/lib/interfaces/item.interface.ts +438 -0
- package/src/lib/players/lookup/lookup.directive.ts +6 -0
- package/src/lib/players/lookup/lookup.item.component.ts +37 -0
- package/src/lib/players/lookup/lookup.item.ts +9 -0
- package/src/lib/players/lookup/lookup.player.component.ts +59 -0
- package/src/lib/players/lookup/lookup.selector.component.ts +41 -0
- package/src/lib/players/model/model.directive.ts +6 -0
- package/src/lib/players/model/model.item.component.spec.ts +311 -0
- package/src/lib/players/model/model.item.component.ts +3457 -0
- package/src/lib/players/model/model.item.ts +9 -0
- package/src/lib/players/model/model.player.component.ts +109 -0
- package/src/lib/players/model/model.selector.component.ts +59 -0
- package/src/lib/scheduler/scheduler.component.html +13 -0
- package/src/lib/scheduler/scheduler.component.scss +6 -0
- package/src/lib/scheduler/scheduler.component.ts +296 -0
- package/src/lib/scheduler/scheduler.routes.ts +15 -0
- package/src/lib/scheduler/schedulerdialog.component.html +72 -0
- package/src/lib/scheduler/schedulerdialog.component.ts +208 -0
- package/src/lib/scheduler/services/scheduler.service.ts +133 -0
- package/src/lib/services/auth-state.service.ts +129 -0
- package/src/lib/services/auth.interceptor.spec.ts +144 -0
- package/src/lib/services/auth.interceptor.ts +44 -0
- package/src/lib/services/cache.service.spec.ts +143 -0
- package/src/lib/services/cache.service.ts +71 -0
- package/src/lib/services/global-error-handler.spec.ts +39 -0
- package/src/lib/services/global-error-handler.ts +28 -0
- package/src/lib/services/global.service.spec.ts +801 -0
- package/src/lib/services/global.service.ts +724 -0
- package/src/lib/services/message.service.ts +556 -0
- package/src/lib/services/theme.service.ts +96 -0
- package/src/lib/template/authtemplate.component.html +6 -0
- package/src/lib/template/authtemplate.component.ts +13 -0
- package/src/lib/template/basetemplate.component.html +7 -0
- package/src/lib/template/basetemplate.component.ts +13 -0
- package/src/lib/template/index.ts +3 -0
- package/src/lib/template/modeltemplate.component.html +7 -0
- package/src/lib/template/modeltemplate.component.ts +21 -0
- package/src/lib/utils/piva.spec.ts +56 -0
- package/src/lib/utils/piva.ts +29 -0
- package/src/lib/validators/email.validator.spec.ts +57 -0
- package/src/lib/validators/email.validator.ts +17 -0
- package/src/lib/validators/equalPasswords.validator.spec.ts +54 -0
- package/src/lib/validators/equalPasswords.validator.ts +17 -0
- package/src/lib/validators/index.ts +2 -0
- package/src/lib/version.ts +1 -0
- package/src/public-api.ts +64 -0
- package/src/typings.d.ts +2 -0
- package/tsconfig.lib.json +18 -0
- package/tsconfig.lib.prod.json +9 -0
|
@@ -0,0 +1,453 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Component,
|
|
3
|
+
AfterViewInit,
|
|
4
|
+
viewChild,
|
|
5
|
+
ElementRef,
|
|
6
|
+
HostListener,
|
|
7
|
+
DestroyRef,
|
|
8
|
+
ChangeDetectorRef,
|
|
9
|
+
inject,
|
|
10
|
+
} from '@angular/core';
|
|
11
|
+
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
12
|
+
|
|
13
|
+
import { GlobalService, Languages } from '../../services/global.service';
|
|
14
|
+
|
|
15
|
+
import { AppMessageService } from '../../services/message.service';
|
|
16
|
+
|
|
17
|
+
import { ManagmentService } from '../model/services/index';
|
|
18
|
+
import {
|
|
19
|
+
ItemInterface,
|
|
20
|
+
DataInterface,
|
|
21
|
+
ManagmentInterface,
|
|
22
|
+
PaginationInterface,
|
|
23
|
+
ItemState,
|
|
24
|
+
} from '../../interfaces/index';
|
|
25
|
+
|
|
26
|
+
import { v1 as uuidv1, v4 as uuidv4 } from 'uuid';
|
|
27
|
+
import { HttpEventType } from '@angular/common/http';
|
|
28
|
+
import { saveAs } from 'file-saver';
|
|
29
|
+
|
|
30
|
+
import { ModelTemplateComponent } from '../../template/modeltemplate.component';
|
|
31
|
+
import { InputDirective } from '../../directives/input.directive';
|
|
32
|
+
import { CardComponent } from '../../common/card.component';
|
|
33
|
+
|
|
34
|
+
@Component({
|
|
35
|
+
selector: 'app-modelsearch',
|
|
36
|
+
templateUrl: 'modelsearch.component.html',
|
|
37
|
+
imports: [ModelTemplateComponent, InputDirective, CardComponent],
|
|
38
|
+
})
|
|
39
|
+
export class ModelSearchComponent implements AfterViewInit {
|
|
40
|
+
gsv = inject(GlobalService);
|
|
41
|
+
msv = inject(ManagmentService);
|
|
42
|
+
msg = inject(AppMessageService);
|
|
43
|
+
private destroyRef = inject(DestroyRef);
|
|
44
|
+
private cdr = inject(ChangeDetectorRef);
|
|
45
|
+
|
|
46
|
+
readonly inputfilter = viewChild<ElementRef>('inputfilter');
|
|
47
|
+
|
|
48
|
+
public exitState = false;
|
|
49
|
+
public plusState = false;
|
|
50
|
+
|
|
51
|
+
public firstState = true;
|
|
52
|
+
public previousState = true;
|
|
53
|
+
public nextState = true;
|
|
54
|
+
public lastState = true;
|
|
55
|
+
public printState = true;
|
|
56
|
+
|
|
57
|
+
public totalPages = 1;
|
|
58
|
+
|
|
59
|
+
public items: DataInterface[] = [];
|
|
60
|
+
public filter = '';
|
|
61
|
+
public itemsCount!: number;
|
|
62
|
+
|
|
63
|
+
public currentPage = 1;
|
|
64
|
+
|
|
65
|
+
public printHidden = false;
|
|
66
|
+
|
|
67
|
+
/** Creates a ManagmentInterface pre-filled with current project/year. */
|
|
68
|
+
private createManagment(): ManagmentInterface {
|
|
69
|
+
const m = this.gsv.getManagmentInterface();
|
|
70
|
+
m.appId = this.gsv.getProject().project;
|
|
71
|
+
m.year = this.gsv.getYear();
|
|
72
|
+
return m;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** Returns the upper-cased printable entity name for the active project schema. */
|
|
76
|
+
private getPrintableEntityName(managment: ManagmentInterface): string {
|
|
77
|
+
return this.gsv
|
|
78
|
+
.getSchemaJson(managment.appId + '.' + managment.year)
|
|
79
|
+
.entities.find((_: any) => _.printable)!
|
|
80
|
+
.name.toLocaleUpperCase();
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/** Lifecycle: focuses the search input and restores a saved filter from localStorage if available. */
|
|
84
|
+
public ngAfterViewInit() {
|
|
85
|
+
this.readData();
|
|
86
|
+
this.inputfilter()?.nativeElement?.focus();
|
|
87
|
+
this.printHidden = !this.gsv
|
|
88
|
+
.getSchemaJson(this.gsv.getProject().project + '.' + this.gsv.getYear())
|
|
89
|
+
.entities.find((_: any) => _.printable)?.printable;
|
|
90
|
+
try {
|
|
91
|
+
const search = localStorage.getItem('search');
|
|
92
|
+
if (search) {
|
|
93
|
+
localStorage.removeItem('search');
|
|
94
|
+
this.activate(search);
|
|
95
|
+
}
|
|
96
|
+
} catch (error) {
|
|
97
|
+
console.error('Error reading search from localStorage:', error);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/** Handles download responses (progress + completion), saves the blob, and hides the loader. */
|
|
102
|
+
private handleDownload(ext: string) {
|
|
103
|
+
return {
|
|
104
|
+
next: (data: any) => {
|
|
105
|
+
if (data.type === HttpEventType.Response) {
|
|
106
|
+
const blob = new Blob([data.body], { type: data.body.type });
|
|
107
|
+
saveAs(blob, uuidv4() + '.' + ext);
|
|
108
|
+
this.gsv.setLoaderState(false);
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
error: () => {
|
|
112
|
+
this.gsv.setLoaderState(false);
|
|
113
|
+
},
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/** Initiates a batch-print download: fetches all matching records as a streamed ZIP file. */
|
|
118
|
+
public printAll(id: string) {
|
|
119
|
+
this.gsv.setLoaderState(true);
|
|
120
|
+
const managment = this.createManagment();
|
|
121
|
+
managment.filterId =
|
|
122
|
+
this.filter.length === 0 ? btoa(' ') : btoa(this.filter);
|
|
123
|
+
managment.page = this.currentPage;
|
|
124
|
+
managment.entId = this.getPrintableEntityName(managment);
|
|
125
|
+
managment.functionId = 'print';
|
|
126
|
+
this.msv
|
|
127
|
+
.downloadFileAll(managment, 'zip')
|
|
128
|
+
.pipe(takeUntilDestroyed(this.destroyRef))
|
|
129
|
+
.subscribe(this.handleDownload('zip'));
|
|
130
|
+
this.inputfilter()?.nativeElement?.focus();
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/** Downloads a single record as a PDF blob and saves it using file-saver. */
|
|
134
|
+
public print(id: string) {
|
|
135
|
+
this.gsv.setLoaderState(true);
|
|
136
|
+
const managment = this.createManagment();
|
|
137
|
+
managment.entId = this.getPrintableEntityName(managment);
|
|
138
|
+
managment.keyId = id;
|
|
139
|
+
managment.keys = 'prg=1';
|
|
140
|
+
managment.functionId = 'print';
|
|
141
|
+
this.msv
|
|
142
|
+
.downloadFile(managment)
|
|
143
|
+
.pipe(takeUntilDestroyed(this.destroyRef))
|
|
144
|
+
.subscribe(this.handleDownload('pdf'));
|
|
145
|
+
this.inputfilter()?.nativeElement?.focus();
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Toggles the card face (front → back or back → front).
|
|
150
|
+
* On back-face reveal, fetches fresh entity state from the API.
|
|
151
|
+
*/
|
|
152
|
+
public flipflop(id: string[]) {
|
|
153
|
+
const idx = this.items.findIndex(item => item.key_id === id[0]);
|
|
154
|
+
if (idx === -1) return;
|
|
155
|
+
const old = this.items[idx];
|
|
156
|
+
|
|
157
|
+
// Immediately populate backitems with already-available data so the card
|
|
158
|
+
// shows content as soon as it flips (before the API responds)
|
|
159
|
+
const populated: DataInterface = {
|
|
160
|
+
...old,
|
|
161
|
+
backitems: (old.backitems ?? []).map((b, i) => {
|
|
162
|
+
if (i === 0)
|
|
163
|
+
return {
|
|
164
|
+
...b,
|
|
165
|
+
id: old.key_id ?? '',
|
|
166
|
+
name_id: this.msg?.get('app.error') ?? '',
|
|
167
|
+
value_id: old.errors_id,
|
|
168
|
+
};
|
|
169
|
+
if (i === 1)
|
|
170
|
+
return {
|
|
171
|
+
...b,
|
|
172
|
+
id: old.key_id ?? '',
|
|
173
|
+
name_id: this.msg?.get('app.warning') ?? '',
|
|
174
|
+
value_id: old.warnings_id,
|
|
175
|
+
};
|
|
176
|
+
return b;
|
|
177
|
+
}),
|
|
178
|
+
};
|
|
179
|
+
this.items = [
|
|
180
|
+
...this.items.slice(0, idx),
|
|
181
|
+
populated,
|
|
182
|
+
...this.items.slice(idx + 1),
|
|
183
|
+
];
|
|
184
|
+
|
|
185
|
+
// Then fetch fresh state from the API and update state_id
|
|
186
|
+
const managment = this.createManagment();
|
|
187
|
+
managment.keyId = id[0];
|
|
188
|
+
this.msv
|
|
189
|
+
.getItemsState(managment)
|
|
190
|
+
.pipe(takeUntilDestroyed(this.destroyRef))
|
|
191
|
+
.subscribe({
|
|
192
|
+
next: (data: ItemInterface[]) => {
|
|
193
|
+
let errors = 0,
|
|
194
|
+
warnings = 0;
|
|
195
|
+
for (const e of data) {
|
|
196
|
+
if (e.state === 1) errors++;
|
|
197
|
+
else if (e.state === 2) warnings++;
|
|
198
|
+
}
|
|
199
|
+
const i2 = this.items.findIndex(item => item.key_id === id[0]);
|
|
200
|
+
if (i2 === -1) return;
|
|
201
|
+
const cur = this.items[i2];
|
|
202
|
+
const updated: DataInterface = {
|
|
203
|
+
...cur,
|
|
204
|
+
state_id:
|
|
205
|
+
errors > 0
|
|
206
|
+
? ItemState.Error
|
|
207
|
+
: warnings > 0
|
|
208
|
+
? ItemState.Warning
|
|
209
|
+
: ItemState.Valid,
|
|
210
|
+
};
|
|
211
|
+
this.items = [
|
|
212
|
+
...this.items.slice(0, i2),
|
|
213
|
+
updated,
|
|
214
|
+
...this.items.slice(i2 + 1),
|
|
215
|
+
];
|
|
216
|
+
},
|
|
217
|
+
error: () => {},
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/** Navigates to the model item form for the given record key id. */
|
|
222
|
+
public activate(id: string) {
|
|
223
|
+
this.gsv.setKeyId(id);
|
|
224
|
+
this.gsv.setActiveLink('/home/model');
|
|
225
|
+
this.gsv.navigate('/home/model');
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/** Deletes the record with the given key id and refreshes the list on success. */
|
|
229
|
+
public delete(id: string) {
|
|
230
|
+
const managment = this.createManagment();
|
|
231
|
+
managment.page = this.currentPage;
|
|
232
|
+
managment.keyId = id;
|
|
233
|
+
this.msv
|
|
234
|
+
.deleteItem(managment)
|
|
235
|
+
.pipe(takeUntilDestroyed(this.destroyRef))
|
|
236
|
+
.subscribe({
|
|
237
|
+
next: (data: boolean) => {
|
|
238
|
+
if (data === true) {
|
|
239
|
+
this.readData();
|
|
240
|
+
}
|
|
241
|
+
},
|
|
242
|
+
error: () => {},
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/** Triggers readData() when the Enter key is pressed in the search input. */
|
|
247
|
+
public onKeyUp(event: KeyboardEvent) {
|
|
248
|
+
if (event.key === 'Enter') {
|
|
249
|
+
this.readData();
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Fetches one page of search results. Normalises date filter strings before the
|
|
255
|
+
* request and decides between getAllItemsData (show all mode) and getItemsData.
|
|
256
|
+
*/
|
|
257
|
+
public readData() {
|
|
258
|
+
if (
|
|
259
|
+
this.gsv.getProject().type === 'D' ||
|
|
260
|
+
this.gsv.getProject().type === 'G'
|
|
261
|
+
) {
|
|
262
|
+
this.gsv.setLoaderState(true);
|
|
263
|
+
const managment = this.createManagment();
|
|
264
|
+
const tryDate = this.filter.split('/');
|
|
265
|
+
if (tryDate.length === 3) {
|
|
266
|
+
if (this.gsv.getLng() === 'IT') {
|
|
267
|
+
this.filter = tryDate[2] + '/' + tryDate[1] + '/' + tryDate[0];
|
|
268
|
+
} else {
|
|
269
|
+
this.filter = tryDate[2] + '/' + tryDate[0] + '/' + tryDate[1];
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
managment.page = this.currentPage;
|
|
273
|
+
managment.entId = this.getPrintableEntityName(managment);
|
|
274
|
+
managment.functionId = 'default';
|
|
275
|
+
|
|
276
|
+
const observer = {
|
|
277
|
+
next: (data: PaginationInterface) => {
|
|
278
|
+
this.gsv.setLoaderState(false);
|
|
279
|
+
this.items = data.data as DataInterface[];
|
|
280
|
+
this.storeItems(this.items);
|
|
281
|
+
this.checkStates(data);
|
|
282
|
+
this.cdr.detectChanges();
|
|
283
|
+
},
|
|
284
|
+
error: () => {
|
|
285
|
+
this.gsv.setLoaderState(false);
|
|
286
|
+
this.currentPage = 1;
|
|
287
|
+
this.readData();
|
|
288
|
+
},
|
|
289
|
+
};
|
|
290
|
+
|
|
291
|
+
if (this.filter.length === 0) {
|
|
292
|
+
managment.filterId = btoa(' ');
|
|
293
|
+
this.msv
|
|
294
|
+
.getAllItemsData(managment)
|
|
295
|
+
.pipe(takeUntilDestroyed(this.destroyRef))
|
|
296
|
+
.subscribe(observer);
|
|
297
|
+
} else {
|
|
298
|
+
managment.filterId = btoa(this.filter);
|
|
299
|
+
this.msv
|
|
300
|
+
.getItemsData(managment)
|
|
301
|
+
.pipe(takeUntilDestroyed(this.destroyRef))
|
|
302
|
+
.subscribe(observer);
|
|
303
|
+
}
|
|
304
|
+
} else {
|
|
305
|
+
this.gsv.navigateToDefault();
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
/** Enriches each DataInterface item with back-card state info from the API. */
|
|
310
|
+
storeItems(items: DataInterface[]) {
|
|
311
|
+
const dateFormatter = new Intl.DateTimeFormat(
|
|
312
|
+
this.gsv.getLng() === Languages.IT ? 'it-IT' : 'en-US',
|
|
313
|
+
{ day: '2-digit', month: '2-digit', year: 'numeric' }
|
|
314
|
+
);
|
|
315
|
+
|
|
316
|
+
for (const item of items) {
|
|
317
|
+
const keyId = item.key_id ?? '';
|
|
318
|
+
const emptyBack = { id: keyId, name_id: '', value_id: '' };
|
|
319
|
+
item.frontitems = [];
|
|
320
|
+
item.backitems = [];
|
|
321
|
+
|
|
322
|
+
const addRow = (name: string, value: any) => {
|
|
323
|
+
item.frontitems!.push({ id: keyId, name_id: name, value_id: value });
|
|
324
|
+
item.backitems!.push({ ...emptyBack });
|
|
325
|
+
};
|
|
326
|
+
|
|
327
|
+
if (item.prog_id && item.prog_id.toString() !== '0') {
|
|
328
|
+
addRow(this.msg?.get('app.identifier'), item.prog_id);
|
|
329
|
+
}
|
|
330
|
+
if (item.tag_id !== '') {
|
|
331
|
+
addRow(this.msg?.get('app.description'), item.tag_id);
|
|
332
|
+
}
|
|
333
|
+
if (item.date_id && item.date_id !== '') {
|
|
334
|
+
addRow('Data', dateFormatter.format(new Date(item.date_id)));
|
|
335
|
+
}
|
|
336
|
+
if (
|
|
337
|
+
item.denominazione_id !== '' ||
|
|
338
|
+
item.cognome_id !== '' ||
|
|
339
|
+
item.nome_id !== '' ||
|
|
340
|
+
item.tag_id !== ''
|
|
341
|
+
) {
|
|
342
|
+
addRow(
|
|
343
|
+
item.denominazione_id !== '' ? this.msg?.get('app.name') : '',
|
|
344
|
+
`${item.denominazione_id} ${item.cognome_id} ${item.nome_id}`
|
|
345
|
+
);
|
|
346
|
+
}
|
|
347
|
+
if (
|
|
348
|
+
item.codicefiscale_id !== '' ||
|
|
349
|
+
item.partitaiva_id !== '' ||
|
|
350
|
+
item.tag_id !== ''
|
|
351
|
+
) {
|
|
352
|
+
addRow(
|
|
353
|
+
item.codicefiscale_id !== '' ? this.msg?.get('app.cinnumber') : '',
|
|
354
|
+
item.codicefiscale_id + ''
|
|
355
|
+
);
|
|
356
|
+
}
|
|
357
|
+
if (
|
|
358
|
+
item.partitaiva_id !== '' ||
|
|
359
|
+
item.codicefiscale_id !== '' ||
|
|
360
|
+
item.tag_id !== ''
|
|
361
|
+
) {
|
|
362
|
+
addRow(
|
|
363
|
+
item.partitaiva_id !== '' ? this.msg?.get('app.vatnumber') : '',
|
|
364
|
+
item.partitaiva_id + ''
|
|
365
|
+
);
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
/** Updates pagination button states (first/previous/next/last) from the PaginationInterface response. */
|
|
371
|
+
checkStates(data: PaginationInterface) {
|
|
372
|
+
this.itemsCount = data.numRec;
|
|
373
|
+
this.totalPages = data.totPages;
|
|
374
|
+
this.printState = data.numRec === 0;
|
|
375
|
+
|
|
376
|
+
if (data.totPages > 1) {
|
|
377
|
+
this.firstState = data.isFirst;
|
|
378
|
+
this.previousState = data.isFirst;
|
|
379
|
+
this.nextState = data.isLast;
|
|
380
|
+
this.lastState = data.isLast;
|
|
381
|
+
} else {
|
|
382
|
+
this.firstState = true;
|
|
383
|
+
this.previousState = true;
|
|
384
|
+
this.nextState = true;
|
|
385
|
+
this.lastState = true;
|
|
386
|
+
}
|
|
387
|
+
if (this.totalPages < this.currentPage) {
|
|
388
|
+
this.currentPage = Math.max(this.totalPages, 1);
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
/** Stores the upper-cased filter string on every input change. */
|
|
393
|
+
public onEnter(value: string) {
|
|
394
|
+
this.filter = value.toUpperCase();
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
/** Closes the search view when Escape is pressed, regardless of focus location. */
|
|
398
|
+
@HostListener('document:keydown.escape', ['$event']) onKeydownHandler(
|
|
399
|
+
event: KeyboardEvent
|
|
400
|
+
) {
|
|
401
|
+
event.stopImmediatePropagation();
|
|
402
|
+
this.click('exit');
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
/**
|
|
406
|
+
* Toolbar command dispatcher: handles exit, first, previous, next, last, print, delete,
|
|
407
|
+
* and refresh commands, updating pagination state after each navigation action.
|
|
408
|
+
*/
|
|
409
|
+
public click(id: string) {
|
|
410
|
+
switch (id) {
|
|
411
|
+
case 'exit':
|
|
412
|
+
this.gsv.setActiveLink('/home/dashboard');
|
|
413
|
+
this.gsv.navigate('/home/dashboard');
|
|
414
|
+
break;
|
|
415
|
+
case 'plus': {
|
|
416
|
+
const managment = this.createManagment();
|
|
417
|
+
managment.functionId = id;
|
|
418
|
+
managment.keyId = uuidv1();
|
|
419
|
+
this.msv
|
|
420
|
+
.getItemsState(managment)
|
|
421
|
+
.pipe(takeUntilDestroyed(this.destroyRef))
|
|
422
|
+
.subscribe({
|
|
423
|
+
next: () => {
|
|
424
|
+
this.gsv.setKeyId(managment.keyId);
|
|
425
|
+
this.gsv.setActiveLink('/home/model');
|
|
426
|
+
this.gsv.navigate('/home/model');
|
|
427
|
+
},
|
|
428
|
+
error: () => {},
|
|
429
|
+
});
|
|
430
|
+
break;
|
|
431
|
+
}
|
|
432
|
+
case 'print':
|
|
433
|
+
this.printAll(id);
|
|
434
|
+
break;
|
|
435
|
+
case 'first':
|
|
436
|
+
this.currentPage = 1;
|
|
437
|
+
this.readData();
|
|
438
|
+
break;
|
|
439
|
+
case 'previous':
|
|
440
|
+
this.currentPage -= 1;
|
|
441
|
+
this.readData();
|
|
442
|
+
break;
|
|
443
|
+
case 'next':
|
|
444
|
+
this.currentPage += 1;
|
|
445
|
+
this.readData();
|
|
446
|
+
break;
|
|
447
|
+
case 'last':
|
|
448
|
+
this.currentPage = this.totalPages;
|
|
449
|
+
this.readData();
|
|
450
|
+
break;
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Data
|
|
3
|
+
//
|
|
4
|
+
export interface EntitiesData {
|
|
5
|
+
entities: Array<EntityData>;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface EntityData {
|
|
9
|
+
name: string;
|
|
10
|
+
modules: Array<ModuleData>;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface ModuleData {
|
|
14
|
+
prg: number[];
|
|
15
|
+
state: number;
|
|
16
|
+
members: MemberData[];
|
|
17
|
+
insert?: boolean;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export type FieldValue = string | number | boolean | Date | null;
|
|
21
|
+
|
|
22
|
+
export interface MemberData {
|
|
23
|
+
name: string;
|
|
24
|
+
type: number;
|
|
25
|
+
value: FieldValue;
|
|
26
|
+
state: number;
|
|
27
|
+
initialvalue: FieldValue;
|
|
28
|
+
initialstate: number;
|
|
29
|
+
refresh?: boolean;
|
|
30
|
+
scale?: boolean;
|
|
31
|
+
message?: string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
//
|
|
35
|
+
// Schema
|
|
36
|
+
//
|
|
37
|
+
export interface Entities {
|
|
38
|
+
entities: Array<Entity>;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface Entity {
|
|
42
|
+
name: string;
|
|
43
|
+
x: string;
|
|
44
|
+
y: string;
|
|
45
|
+
width: string;
|
|
46
|
+
height: string;
|
|
47
|
+
enabled: boolean;
|
|
48
|
+
visible: boolean;
|
|
49
|
+
linkeditems: string;
|
|
50
|
+
parentitems: string;
|
|
51
|
+
id: string;
|
|
52
|
+
title: string;
|
|
53
|
+
titlegb: string;
|
|
54
|
+
groupname: string;
|
|
55
|
+
focusoninsert: string;
|
|
56
|
+
focusonupdate: string;
|
|
57
|
+
preview: boolean;
|
|
58
|
+
allowadd: boolean;
|
|
59
|
+
allowdelete: string;
|
|
60
|
+
mandatory: boolean;
|
|
61
|
+
printable: boolean;
|
|
62
|
+
viewlist: boolean;
|
|
63
|
+
cache: boolean;
|
|
64
|
+
masterdetail: number;
|
|
65
|
+
prgdim: number;
|
|
66
|
+
svg: string;
|
|
67
|
+
pdf: string;
|
|
68
|
+
type: string;
|
|
69
|
+
index: number;
|
|
70
|
+
pdfoffsetleft: number;
|
|
71
|
+
pdfoffsettop: number;
|
|
72
|
+
members: Array<Member>;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export interface Member {
|
|
76
|
+
type: number;
|
|
77
|
+
value: FieldValue;
|
|
78
|
+
id: string;
|
|
79
|
+
name: string;
|
|
80
|
+
title: string;
|
|
81
|
+
tabindex: number;
|
|
82
|
+
x: string;
|
|
83
|
+
y: string;
|
|
84
|
+
width: string;
|
|
85
|
+
height: string;
|
|
86
|
+
enabled: boolean;
|
|
87
|
+
visible: boolean;
|
|
88
|
+
tabstop: boolean;
|
|
89
|
+
tag: FieldValue;
|
|
90
|
+
initialvalue: string;
|
|
91
|
+
state: number;
|
|
92
|
+
length?: number;
|
|
93
|
+
allowedchars?: string;
|
|
94
|
+
charactercasing?: string;
|
|
95
|
+
generateuid?: boolean;
|
|
96
|
+
alignment: string;
|
|
97
|
+
mandatory: boolean;
|
|
98
|
+
uniqueid: string;
|
|
99
|
+
lookup: string;
|
|
100
|
+
lookuplink: boolean;
|
|
101
|
+
lookupoutput?: boolean;
|
|
102
|
+
match: string;
|
|
103
|
+
replace: string;
|
|
104
|
+
readonly: boolean;
|
|
105
|
+
output: boolean;
|
|
106
|
+
autoformatter: boolean;
|
|
107
|
+
viewlist: number;
|
|
108
|
+
caption: string;
|
|
109
|
+
captiongb: string;
|
|
110
|
+
function: string;
|
|
111
|
+
padleftchar: string;
|
|
112
|
+
padrightchar: string;
|
|
113
|
+
spacing: number;
|
|
114
|
+
groupname?: string;
|
|
115
|
+
precision?: number;
|
|
116
|
+
scale?: number;
|
|
117
|
+
allowsign?: boolean;
|
|
118
|
+
min?: number | string;
|
|
119
|
+
max?: number | string;
|
|
120
|
+
thousandseparator?: boolean;
|
|
121
|
+
combo?: string;
|
|
122
|
+
today?: boolean;
|
|
123
|
+
graphic?: string;
|
|
124
|
+
action?: string;
|
|
125
|
+
sign?: string;
|
|
126
|
+
ivisible?: boolean;
|
|
127
|
+
rootModel?: boolean;
|
|
128
|
+
linkedItems?: string[];
|
|
129
|
+
svg?: string;
|
|
130
|
+
prgDim?: number;
|
|
131
|
+
}
|