verben-workflow-ui 0.6.5 → 0.6.7
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/esm2022/public-api.mjs +3 -1
- package/esm2022/src/lib/components/form-group/form-group.component.mjs +4 -5
- package/esm2022/src/lib/components/form-response/form-response.component.mjs +10 -13
- package/esm2022/src/lib/components/form-values/form-values.component.mjs +1157 -0
- package/esm2022/src/lib/components/form-values/form-values.module.mjs +20 -0
- package/esm2022/src/lib/components/form-values/form-values.service.mjs +48 -0
- package/esm2022/src/lib/components/form-values/index.mjs +2 -0
- package/esm2022/src/lib/components/form-values/public-api.mjs +4 -0
- package/esm2022/src/lib/components/form-values/verben-workflow-ui-src-lib-components-form-values.mjs +5 -0
- package/esm2022/src/lib/components/forms/forms.component.mjs +3 -3
- package/esm2022/src/lib/models/DataExtensionValue.mjs +2 -0
- package/esm2022/src/lib/models/EAVDataType.mjs +20 -0
- package/esm2022/src/lib/models/EntityDataValue.mjs +2 -0
- package/esm2022/src/lib/models/EntityProperty.mjs +2 -0
- package/esm2022/src/lib/models/FormValue.mjs +6 -0
- package/esm2022/src/lib/models/Property.mjs +2 -0
- package/esm2022/src/lib/models/public-api.mjs +4 -2
- package/fesm2022/verben-workflow-ui-src-lib-components-form-group.mjs +3 -4
- package/fesm2022/verben-workflow-ui-src-lib-components-form-group.mjs.map +1 -1
- package/fesm2022/verben-workflow-ui-src-lib-components-form-response.mjs +9 -12
- package/fesm2022/verben-workflow-ui-src-lib-components-form-response.mjs.map +1 -1
- package/fesm2022/verben-workflow-ui-src-lib-components-form-values.mjs +1226 -0
- package/fesm2022/verben-workflow-ui-src-lib-components-form-values.mjs.map +1 -0
- package/fesm2022/verben-workflow-ui-src-lib-components-forms.mjs +2 -2
- package/fesm2022/verben-workflow-ui-src-lib-components-forms.mjs.map +1 -1
- package/fesm2022/verben-workflow-ui-src-lib-models.mjs +5 -0
- package/fesm2022/verben-workflow-ui-src-lib-models.mjs.map +1 -1
- package/fesm2022/verben-workflow-ui.mjs +1 -0
- package/fesm2022/verben-workflow-ui.mjs.map +1 -1
- package/package.json +48 -42
- package/public-api.d.ts +1 -0
- package/src/lib/components/form-response/form-response.component.d.ts +1 -3
- package/src/lib/components/form-values/form-values.component.d.ts +118 -0
- package/src/lib/components/form-values/form-values.module.d.ts +10 -0
- package/src/lib/components/form-values/form-values.service.d.ts +9 -0
- package/src/lib/components/form-values/index.d.ts +1 -0
- package/src/lib/components/form-values/public-api.d.ts +3 -0
- package/src/lib/models/DataExtensionValue.d.ts +4 -0
- package/src/lib/models/EAVDataType.d.ts +18 -0
- package/src/lib/models/EntityDataValue.d.ts +6 -0
- package/src/lib/models/EntityProperty.d.ts +7 -0
- package/src/lib/models/FormValue.d.ts +13 -0
- package/src/lib/models/Property.d.ts +5 -0
- package/src/lib/models/public-api.d.ts +3 -1
- package/esm2022/src/lib/models/FormValues.mjs +0 -2
- package/src/lib/models/FormValues.d.ts +0 -14
|
@@ -0,0 +1,1226 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Injectable, Component, ViewChild, Input, NgModule } from '@angular/core';
|
|
3
|
+
import { Subject, debounceTime } from 'rxjs';
|
|
4
|
+
import * as i5 from 'verben-ng-ui';
|
|
5
|
+
import { DataFilterType } from 'verben-ng-ui';
|
|
6
|
+
import { workflowBaseStyle } from 'verben-workflow-ui/src/lib/components/workflow';
|
|
7
|
+
import { DataType, SearchOperator, SearchPropertySign, SortDirection, ErrorResponse, ObjectState, SearchPropertyValueType } from 'verben-workflow-ui/src/lib/models';
|
|
8
|
+
import * as i1 from 'verben-workflow-ui/src/lib/services';
|
|
9
|
+
import * as i2 from '@angular/router';
|
|
10
|
+
import * as i4 from '@angular/common';
|
|
11
|
+
import { CommonModule } from '@angular/common';
|
|
12
|
+
import * as i6 from 'verben-workflow-ui/src/lib/components/form-control';
|
|
13
|
+
import { FormControlerModule } from 'verben-workflow-ui/src/lib/components/form-control';
|
|
14
|
+
import { SharedModule } from 'verben-workflow-ui/src/lib/shared';
|
|
15
|
+
|
|
16
|
+
class FormValuesService {
|
|
17
|
+
constructor() { }
|
|
18
|
+
get formValueColumns() {
|
|
19
|
+
return [
|
|
20
|
+
{
|
|
21
|
+
id: 'code',
|
|
22
|
+
header: 'CODE',
|
|
23
|
+
accessorKey: 'Code',
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
id: 'createdBy',
|
|
27
|
+
header: 'CREATED BY',
|
|
28
|
+
accessorKey: 'CreatedBy',
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
id: 'createdAt',
|
|
32
|
+
header: 'DATE',
|
|
33
|
+
accessorKey: 'CreatedAt',
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
id: 'isValid',
|
|
37
|
+
header: 'IS VALID',
|
|
38
|
+
accessorKey: 'IsValid',
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
id: 'expiryDate',
|
|
42
|
+
header: 'EXPIRY DATE',
|
|
43
|
+
accessorKey: 'ExpiryDate',
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
id: 'duration',
|
|
47
|
+
header: 'DURATION',
|
|
48
|
+
accessorKey: 'Duration',
|
|
49
|
+
},
|
|
50
|
+
];
|
|
51
|
+
}
|
|
52
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: FormValuesService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
53
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: FormValuesService, providedIn: 'root' });
|
|
54
|
+
}
|
|
55
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: FormValuesService, decorators: [{
|
|
56
|
+
type: Injectable,
|
|
57
|
+
args: [{
|
|
58
|
+
providedIn: 'root',
|
|
59
|
+
}]
|
|
60
|
+
}], ctorParameters: () => [] });
|
|
61
|
+
|
|
62
|
+
var FormValuePropertyName;
|
|
63
|
+
(function (FormValuePropertyName) {
|
|
64
|
+
FormValuePropertyName["Code"] = "Code";
|
|
65
|
+
FormValuePropertyName["CreatedBy"] = "Created By";
|
|
66
|
+
FormValuePropertyName["CreatedAt"] = "Created At";
|
|
67
|
+
FormValuePropertyName["IsValid"] = "Is Valid";
|
|
68
|
+
FormValuePropertyName["AllowAnonymous"] = "Anonymous";
|
|
69
|
+
FormValuePropertyName["ExpiryDate"] = "Expiry Date";
|
|
70
|
+
FormValuePropertyName["Duration"] = "Duration";
|
|
71
|
+
FormValuePropertyName["TaskCode"] = "Task Code";
|
|
72
|
+
})(FormValuePropertyName || (FormValuePropertyName = {}));
|
|
73
|
+
var FormValuePropertyMap;
|
|
74
|
+
(function (FormValuePropertyMap) {
|
|
75
|
+
FormValuePropertyMap["Code"] = "Code";
|
|
76
|
+
FormValuePropertyMap["CreatedBy"] = "CreatedBy";
|
|
77
|
+
FormValuePropertyMap["CreatedAt"] = "CreatedAt";
|
|
78
|
+
FormValuePropertyMap["IsValid"] = "IsValid";
|
|
79
|
+
FormValuePropertyMap["AllowAnonymous"] = "AllowAnonymous";
|
|
80
|
+
FormValuePropertyMap["ExpiryDate"] = "ExpiryDate";
|
|
81
|
+
FormValuePropertyMap["Duration"] = "Duration";
|
|
82
|
+
FormValuePropertyMap["TaskCode"] = "TaskCode";
|
|
83
|
+
})(FormValuePropertyMap || (FormValuePropertyMap = {}));
|
|
84
|
+
var FormValueSearchProperty;
|
|
85
|
+
(function (FormValueSearchProperty) {
|
|
86
|
+
FormValueSearchProperty["Code"] = "Code";
|
|
87
|
+
FormValueSearchProperty["CreatedBy"] = "CreatedBy";
|
|
88
|
+
FormValueSearchProperty["TaskCode"] = "TaskCode";
|
|
89
|
+
})(FormValueSearchProperty || (FormValueSearchProperty = {}));
|
|
90
|
+
var FilterTypes;
|
|
91
|
+
(function (FilterTypes) {
|
|
92
|
+
FilterTypes["Before"] = "LT";
|
|
93
|
+
FilterTypes["On"] = "EQ";
|
|
94
|
+
FilterTypes["After"] = "GT";
|
|
95
|
+
FilterTypes["NEQ"] = "NEQ";
|
|
96
|
+
})(FilterTypes || (FilterTypes = {}));
|
|
97
|
+
class FormValuesComponent {
|
|
98
|
+
utilService;
|
|
99
|
+
server;
|
|
100
|
+
cdr;
|
|
101
|
+
envSvc;
|
|
102
|
+
route;
|
|
103
|
+
formValuesSvc;
|
|
104
|
+
visibleColumnDef = [];
|
|
105
|
+
styles = workflowBaseStyle;
|
|
106
|
+
data = [];
|
|
107
|
+
cardData = [];
|
|
108
|
+
currentData = null;
|
|
109
|
+
active = 0;
|
|
110
|
+
dataType = DataType.Text;
|
|
111
|
+
exportColumns = [];
|
|
112
|
+
exportData = [];
|
|
113
|
+
showExport = false;
|
|
114
|
+
cardDataView;
|
|
115
|
+
dataView;
|
|
116
|
+
dataXport;
|
|
117
|
+
formCodeKey = 'formCode';
|
|
118
|
+
pageSize = 50;
|
|
119
|
+
searchDebounceTime = 500;
|
|
120
|
+
permissionConfig = null;
|
|
121
|
+
formCode = '';
|
|
122
|
+
pageState = null;
|
|
123
|
+
currentFilters = [];
|
|
124
|
+
currentSorts = [];
|
|
125
|
+
searchTerm$ = new Subject();
|
|
126
|
+
currentSearchTerm = '';
|
|
127
|
+
hasMore = true;
|
|
128
|
+
visibleColumns = [];
|
|
129
|
+
filterArray = [
|
|
130
|
+
{
|
|
131
|
+
name: FormValuePropertyName.Code,
|
|
132
|
+
type: DataFilterType.String,
|
|
133
|
+
checked: false,
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
name: FormValuePropertyName.CreatedBy,
|
|
137
|
+
type: DataFilterType.String,
|
|
138
|
+
checked: false,
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
name: FormValuePropertyName.CreatedAt,
|
|
142
|
+
type: DataFilterType.Date,
|
|
143
|
+
checked: false,
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
name: FormValuePropertyName.IsValid,
|
|
147
|
+
type: DataFilterType.Bool,
|
|
148
|
+
checked: false,
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
name: FormValuePropertyName.AllowAnonymous,
|
|
152
|
+
type: DataFilterType.Bool,
|
|
153
|
+
checked: false,
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
name: FormValuePropertyName.ExpiryDate,
|
|
157
|
+
type: DataFilterType.Date,
|
|
158
|
+
checked: false,
|
|
159
|
+
},
|
|
160
|
+
];
|
|
161
|
+
sortOptions = [
|
|
162
|
+
{
|
|
163
|
+
name: FormValuePropertyName.CreatedAt,
|
|
164
|
+
type: DataFilterType.Date,
|
|
165
|
+
checked: false,
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
name: FormValuePropertyName.CreatedBy,
|
|
169
|
+
type: DataFilterType.String,
|
|
170
|
+
checked: false,
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
name: FormValuePropertyName.Code,
|
|
174
|
+
type: DataFilterType.String,
|
|
175
|
+
checked: false,
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
name: FormValuePropertyName.ExpiryDate,
|
|
179
|
+
type: DataFilterType.Date,
|
|
180
|
+
checked: false,
|
|
181
|
+
},
|
|
182
|
+
];
|
|
183
|
+
constructor(utilService, server, cdr, envSvc, route, formValuesSvc) {
|
|
184
|
+
this.utilService = utilService;
|
|
185
|
+
this.server = server;
|
|
186
|
+
this.cdr = cdr;
|
|
187
|
+
this.envSvc = envSvc;
|
|
188
|
+
this.route = route;
|
|
189
|
+
this.formValuesSvc = formValuesSvc;
|
|
190
|
+
this.visibleColumnDef = formValuesSvc.formValueColumns;
|
|
191
|
+
this.visibleColumns = formValuesSvc.formValueColumns.map((col) => ({
|
|
192
|
+
checked: true,
|
|
193
|
+
name: typeof col.header === 'string' ? col.header : col.id,
|
|
194
|
+
type: DataFilterType.Bool,
|
|
195
|
+
}));
|
|
196
|
+
}
|
|
197
|
+
get allowFormResponseEdit() {
|
|
198
|
+
return !!this.permissionConfig?.Actions?.['AllowFormResponseEdit'];
|
|
199
|
+
}
|
|
200
|
+
async ngOnInit() {
|
|
201
|
+
this.active = 0;
|
|
202
|
+
this.route.paramMap.subscribe(async (params) => {
|
|
203
|
+
const code = params.get(this.formCodeKey);
|
|
204
|
+
this.formCode = code ? code.trim() : '';
|
|
205
|
+
await this.initData();
|
|
206
|
+
});
|
|
207
|
+
this.searchTerm$
|
|
208
|
+
.pipe(debounceTime(this.searchDebounceTime))
|
|
209
|
+
.subscribe(async (searchTerm) => {
|
|
210
|
+
this.currentSearchTerm = searchTerm;
|
|
211
|
+
this.updateFiltersAndSorts(true);
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
async initData() {
|
|
215
|
+
this.data = [];
|
|
216
|
+
this.currentData = null;
|
|
217
|
+
this.pageState = null;
|
|
218
|
+
this.hasMore = true;
|
|
219
|
+
this.active = 0;
|
|
220
|
+
const values = await this.getFormValues();
|
|
221
|
+
if (values) {
|
|
222
|
+
this.data = values.map((x) => ({
|
|
223
|
+
...x,
|
|
224
|
+
Id: x.Code || x.Id,
|
|
225
|
+
id: x.Code || x.id,
|
|
226
|
+
CreatedAt: x.CreatedAt ? new Date(x.CreatedAt.toString()) : new Date(),
|
|
227
|
+
ExpiryDate: x.ExpiryDate
|
|
228
|
+
? new Date(x.ExpiryDate.toString())
|
|
229
|
+
: new Date(),
|
|
230
|
+
}));
|
|
231
|
+
this.setUpCardData();
|
|
232
|
+
if (this.cardData.length === 1) {
|
|
233
|
+
this.cardClicked(this.cardData[0]);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
else {
|
|
237
|
+
this.setUpCardData();
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
async getFormValues() {
|
|
241
|
+
const payload = [];
|
|
242
|
+
if (this.formCode && this.formCode.length > 0) {
|
|
243
|
+
payload.push({
|
|
244
|
+
PropertyName: 'Form',
|
|
245
|
+
EntityValue: this.formCode,
|
|
246
|
+
Operator: SearchOperator.And,
|
|
247
|
+
Sign: SearchPropertySign.EQ,
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
this.utilService.sendBI(true);
|
|
251
|
+
const res = payload.length === 0
|
|
252
|
+
? await this.server.get(`GetFormValues/0/${this.pageSize}/CreatedAt/${SortDirection.Desc}`, this.envSvc.environment.WorkFlowAPI)
|
|
253
|
+
: await this.server.post(`SearchFormValues/0/${this.pageSize}`, payload, this.envSvc.environment.WorkFlowAPI);
|
|
254
|
+
this.utilService.sendBI(false);
|
|
255
|
+
if (res instanceof ErrorResponse) {
|
|
256
|
+
return undefined;
|
|
257
|
+
}
|
|
258
|
+
else {
|
|
259
|
+
this.pageState = res;
|
|
260
|
+
const result = res.Result || [];
|
|
261
|
+
this.hasMore =
|
|
262
|
+
res.Total !== undefined
|
|
263
|
+
? this.data.length + result.length <
|
|
264
|
+
res.Total
|
|
265
|
+
: result.length === this.pageSize;
|
|
266
|
+
return result;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
async loadMore() {
|
|
270
|
+
if (!this.pageState) {
|
|
271
|
+
return;
|
|
272
|
+
}
|
|
273
|
+
this.utilService.sendBI(true);
|
|
274
|
+
const res = this.currentFilters.length > 0 ||
|
|
275
|
+
this.currentSorts.length > 0 ||
|
|
276
|
+
this.currentSearchTerm.trim().length > 0
|
|
277
|
+
? await this.loadMoreFiltersAndSorts()
|
|
278
|
+
: this.formCode && this.formCode.length > 0
|
|
279
|
+
? await this.server.post(`SearchFormValues/${this.pageState.Skip}/${this.pageSize}`, [
|
|
280
|
+
{
|
|
281
|
+
PropertyName: 'Form',
|
|
282
|
+
EntityValue: this.formCode,
|
|
283
|
+
Operator: SearchOperator.And,
|
|
284
|
+
Sign: SearchPropertySign.EQ,
|
|
285
|
+
},
|
|
286
|
+
], this.envSvc.environment.WorkFlowAPI)
|
|
287
|
+
: await this.server.get(`GetFormValues/${this.pageState.Skip}/${this.pageSize}/CreatedAt/${SortDirection.Desc}`, this.envSvc.environment.WorkFlowAPI);
|
|
288
|
+
this.utilService.sendBI(false);
|
|
289
|
+
if (res instanceof ErrorResponse) {
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
else {
|
|
293
|
+
this.pageState = res;
|
|
294
|
+
const result = res.Result || [];
|
|
295
|
+
const mapped = result.map((x) => ({
|
|
296
|
+
...x,
|
|
297
|
+
Id: x.Code || x.Id,
|
|
298
|
+
id: x.Code || x.id,
|
|
299
|
+
CreatedAt: x.CreatedAt ? new Date(x.CreatedAt.toString()) : new Date(),
|
|
300
|
+
ExpiryDate: x.ExpiryDate
|
|
301
|
+
? new Date(x.ExpiryDate.toString())
|
|
302
|
+
: new Date(),
|
|
303
|
+
}));
|
|
304
|
+
this.data = this.data.concat(mapped);
|
|
305
|
+
this.setUpCardDataExtra(mapped);
|
|
306
|
+
this.hasMore =
|
|
307
|
+
res.Total !== undefined
|
|
308
|
+
? this.data.length < res.Total
|
|
309
|
+
: result.length === this.pageSize;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
setUpCardData() {
|
|
313
|
+
const cardData = this.data.map((x) => ({
|
|
314
|
+
selected: false,
|
|
315
|
+
title: x.CreatedBy || x.Code || 'Response',
|
|
316
|
+
data: x,
|
|
317
|
+
body: [],
|
|
318
|
+
children: [],
|
|
319
|
+
}));
|
|
320
|
+
this.cardData = cardData;
|
|
321
|
+
this.updateExportColumnsAndData();
|
|
322
|
+
this.cdr.detectChanges();
|
|
323
|
+
}
|
|
324
|
+
setUpCardDataExtra(baseData) {
|
|
325
|
+
const cardData = baseData.map((x) => ({
|
|
326
|
+
selected: false,
|
|
327
|
+
title: x.CreatedBy || x.Code || 'Response',
|
|
328
|
+
data: x,
|
|
329
|
+
body: [],
|
|
330
|
+
children: [],
|
|
331
|
+
}));
|
|
332
|
+
this.cardData = this.cardData.concat(cardData);
|
|
333
|
+
this.updateExportColumnsAndData();
|
|
334
|
+
this.cdr.detectChanges();
|
|
335
|
+
}
|
|
336
|
+
cardClicked(item) {
|
|
337
|
+
this.cardData.forEach((card) => (card.selected = false));
|
|
338
|
+
item.selected = true;
|
|
339
|
+
this.setActive(0);
|
|
340
|
+
this.currentData = this.cardDataView
|
|
341
|
+
? this.cardDataView.onItemClick(item)
|
|
342
|
+
: item;
|
|
343
|
+
}
|
|
344
|
+
setActive(i = 0) {
|
|
345
|
+
this.active = i;
|
|
346
|
+
}
|
|
347
|
+
async saveFormValue() {
|
|
348
|
+
if (!this.allowFormResponseEdit) {
|
|
349
|
+
return;
|
|
350
|
+
}
|
|
351
|
+
if (this.currentData && this.currentData.data) {
|
|
352
|
+
const formValue = this.currentData.data;
|
|
353
|
+
formValue.DataState =
|
|
354
|
+
formValue.DataState === ObjectState.New
|
|
355
|
+
? ObjectState.New
|
|
356
|
+
: ObjectState.Changed;
|
|
357
|
+
this.utilService.sendBI(true);
|
|
358
|
+
const res = await this.server.post(`SaveFormValues`, [formValue], this.envSvc.environment.WorkFlowAPI);
|
|
359
|
+
this.utilService.sendBI(false);
|
|
360
|
+
if (res instanceof ErrorResponse) {
|
|
361
|
+
}
|
|
362
|
+
else {
|
|
363
|
+
this.utilService.showSuccess('Form response saved successfully');
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
async updateFiltersAndSorts(isSearch = false) {
|
|
368
|
+
if (!isSearch) {
|
|
369
|
+
if (this.dataView) {
|
|
370
|
+
this.dataView.onClearSearch();
|
|
371
|
+
}
|
|
372
|
+
this.currentSearchTerm = '';
|
|
373
|
+
this.cdr.detectChanges();
|
|
374
|
+
const clickEvent = new MouseEvent('click', {
|
|
375
|
+
bubbles: true,
|
|
376
|
+
cancelable: true,
|
|
377
|
+
view: window,
|
|
378
|
+
});
|
|
379
|
+
document.dispatchEvent(clickEvent);
|
|
380
|
+
}
|
|
381
|
+
const payload = this.currentFilters.map((x) => ({
|
|
382
|
+
PropertyName: FormValuePropertyMap[x.name.split(' ').join('')],
|
|
383
|
+
EntityValue: x.value,
|
|
384
|
+
Operator: SearchOperator.And,
|
|
385
|
+
Sign: x.condition && Object.keys(FilterTypes).includes(x.condition)
|
|
386
|
+
? FilterTypes[x.condition]
|
|
387
|
+
: SearchPropertySign.EQ,
|
|
388
|
+
Type: x.name === FormValuePropertyName.CreatedAt ||
|
|
389
|
+
x.name === FormValuePropertyName.ExpiryDate
|
|
390
|
+
? SearchPropertyValueType.Date
|
|
391
|
+
: x.name === FormValuePropertyName.AllowAnonymous ||
|
|
392
|
+
x.name === FormValuePropertyName.IsValid
|
|
393
|
+
? SearchPropertyValueType.Bool
|
|
394
|
+
: SearchPropertyValueType.String,
|
|
395
|
+
}));
|
|
396
|
+
for (const sort of this.currentSorts) {
|
|
397
|
+
payload.push({
|
|
398
|
+
PropertyName: FormValuePropertyMap[sort.name.split(' ').join('')],
|
|
399
|
+
EntityValue: '',
|
|
400
|
+
Operator: SearchOperator.And,
|
|
401
|
+
Sign: SearchPropertySign.EQ,
|
|
402
|
+
Sort: sort.value.toLowerCase() === SortDirection.Asc.toLowerCase()
|
|
403
|
+
? SortDirection.Asc
|
|
404
|
+
: sort.value.toLowerCase() === SortDirection.Desc.toLowerCase()
|
|
405
|
+
? SortDirection.Desc
|
|
406
|
+
: SortDirection.None,
|
|
407
|
+
});
|
|
408
|
+
}
|
|
409
|
+
if (this.formCode && this.formCode.length > 0) {
|
|
410
|
+
payload.push({
|
|
411
|
+
PropertyName: 'Form',
|
|
412
|
+
EntityValue: this.formCode,
|
|
413
|
+
Operator: SearchOperator.And,
|
|
414
|
+
Sign: SearchPropertySign.EQ,
|
|
415
|
+
});
|
|
416
|
+
}
|
|
417
|
+
const searchPayload = [];
|
|
418
|
+
const searchTermExists = this.currentSearchTerm.trim().length > 0;
|
|
419
|
+
if (searchTermExists) {
|
|
420
|
+
Object.keys(FormValueSearchProperty).forEach((key) => {
|
|
421
|
+
searchPayload.push({
|
|
422
|
+
PropertyName: key,
|
|
423
|
+
EntityValue: this.currentSearchTerm.trim(),
|
|
424
|
+
Operator: SearchOperator.Or,
|
|
425
|
+
Sign: SearchPropertySign.LIKE,
|
|
426
|
+
});
|
|
427
|
+
});
|
|
428
|
+
if (this.formCode && this.formCode.length > 0) {
|
|
429
|
+
searchPayload.push({
|
|
430
|
+
PropertyName: 'Form',
|
|
431
|
+
EntityValue: this.formCode,
|
|
432
|
+
Operator: SearchOperator.And,
|
|
433
|
+
Sign: SearchPropertySign.EQ,
|
|
434
|
+
});
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
this.utilService.sendBI(true);
|
|
438
|
+
let res;
|
|
439
|
+
if (searchTermExists) {
|
|
440
|
+
res =
|
|
441
|
+
this.formCode && this.formCode.length > 0
|
|
442
|
+
? await this.server.post(`SearchFormValues/0/${this.pageSize}`, searchPayload, this.envSvc.environment.WorkFlowAPI)
|
|
443
|
+
: await this.server.get(`GetFormValuesWithParam/${this.currentSearchTerm.trim()}/0/${this.pageSize}`, this.envSvc.environment.WorkFlowAPI);
|
|
444
|
+
}
|
|
445
|
+
else {
|
|
446
|
+
res =
|
|
447
|
+
payload.length === 0
|
|
448
|
+
? await this.server.get(`GetFormValues/0/${this.pageSize}`, this.envSvc.environment.WorkFlowAPI)
|
|
449
|
+
: await this.server.post(`SearchFormValues/0/${this.pageSize}`, payload, this.envSvc.environment.WorkFlowAPI);
|
|
450
|
+
}
|
|
451
|
+
this.utilService.sendBI(false);
|
|
452
|
+
if (res instanceof ErrorResponse) {
|
|
453
|
+
this.currentFilters = [];
|
|
454
|
+
this.currentSorts = [];
|
|
455
|
+
return;
|
|
456
|
+
}
|
|
457
|
+
else {
|
|
458
|
+
if (this.cardDataView) {
|
|
459
|
+
this.cardDataView.clearData();
|
|
460
|
+
}
|
|
461
|
+
this.currentData = null;
|
|
462
|
+
this.pageState = res;
|
|
463
|
+
const result = res.Result || [];
|
|
464
|
+
this.data = result.map((x) => ({
|
|
465
|
+
...x,
|
|
466
|
+
Id: x.Code || x.Id,
|
|
467
|
+
id: x.Code || x.id,
|
|
468
|
+
CreatedAt: x.CreatedAt ? new Date(x.CreatedAt.toString()) : new Date(),
|
|
469
|
+
ExpiryDate: x.ExpiryDate
|
|
470
|
+
? new Date(x.ExpiryDate.toString())
|
|
471
|
+
: new Date(),
|
|
472
|
+
}));
|
|
473
|
+
this.setUpCardData();
|
|
474
|
+
if (this.cardData.length > 0) {
|
|
475
|
+
this.cardClicked(this.cardData[0]);
|
|
476
|
+
}
|
|
477
|
+
this.hasMore =
|
|
478
|
+
res.Total !== undefined
|
|
479
|
+
? this.data.length < res.Total
|
|
480
|
+
: result.length === this.pageSize;
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
async loadMoreFiltersAndSorts() {
|
|
484
|
+
if (!this.pageState) {
|
|
485
|
+
return;
|
|
486
|
+
}
|
|
487
|
+
const payload = this.currentFilters.map((x) => ({
|
|
488
|
+
PropertyName: FormValuePropertyMap[x.name.split(' ').join('')],
|
|
489
|
+
EntityValue: x.value,
|
|
490
|
+
Operator: SearchOperator.And,
|
|
491
|
+
Sign: x.condition && Object.keys(FilterTypes).includes(x.condition)
|
|
492
|
+
? FilterTypes[x.condition]
|
|
493
|
+
: SearchPropertySign.EQ,
|
|
494
|
+
Type: x.name === FormValuePropertyName.CreatedAt ||
|
|
495
|
+
x.name === FormValuePropertyName.ExpiryDate
|
|
496
|
+
? SearchPropertyValueType.Date
|
|
497
|
+
: x.name === FormValuePropertyName.AllowAnonymous ||
|
|
498
|
+
x.name === FormValuePropertyName.IsValid
|
|
499
|
+
? SearchPropertyValueType.Bool
|
|
500
|
+
: SearchPropertyValueType.String,
|
|
501
|
+
}));
|
|
502
|
+
for (const sort of this.currentSorts) {
|
|
503
|
+
payload.push({
|
|
504
|
+
PropertyName: FormValuePropertyMap[sort.name.split(' ').join('')],
|
|
505
|
+
EntityValue: '',
|
|
506
|
+
Operator: SearchOperator.And,
|
|
507
|
+
Sign: SearchPropertySign.EQ,
|
|
508
|
+
Sort: sort.value.toLowerCase() === SortDirection.Asc.toLowerCase()
|
|
509
|
+
? SortDirection.Asc
|
|
510
|
+
: sort.value.toLowerCase() === SortDirection.Desc.toLowerCase()
|
|
511
|
+
? SortDirection.Desc
|
|
512
|
+
: SortDirection.None,
|
|
513
|
+
});
|
|
514
|
+
}
|
|
515
|
+
if (this.formCode && this.formCode.length > 0) {
|
|
516
|
+
payload.push({
|
|
517
|
+
PropertyName: 'Form',
|
|
518
|
+
EntityValue: this.formCode,
|
|
519
|
+
Operator: SearchOperator.And,
|
|
520
|
+
Sign: SearchPropertySign.EQ,
|
|
521
|
+
});
|
|
522
|
+
}
|
|
523
|
+
const searchPayload = [];
|
|
524
|
+
const searchTermExists = this.currentSearchTerm.trim().length > 0;
|
|
525
|
+
if (searchTermExists) {
|
|
526
|
+
Object.keys(FormValueSearchProperty).forEach((key) => {
|
|
527
|
+
searchPayload.push({
|
|
528
|
+
PropertyName: key,
|
|
529
|
+
EntityValue: this.currentSearchTerm.trim(),
|
|
530
|
+
Operator: SearchOperator.Or,
|
|
531
|
+
Sign: SearchPropertySign.LIKE,
|
|
532
|
+
});
|
|
533
|
+
});
|
|
534
|
+
if (this.formCode && this.formCode.length > 0) {
|
|
535
|
+
searchPayload.push({
|
|
536
|
+
PropertyName: 'Form',
|
|
537
|
+
EntityValue: this.formCode,
|
|
538
|
+
Operator: SearchOperator.And,
|
|
539
|
+
Sign: SearchPropertySign.EQ,
|
|
540
|
+
});
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
this.utilService.sendBI(true);
|
|
544
|
+
let res;
|
|
545
|
+
if (searchTermExists) {
|
|
546
|
+
res =
|
|
547
|
+
this.formCode && this.formCode.length > 0
|
|
548
|
+
? await this.server.post(`SearchFormValues/${this.pageState.Skip}/${this.pageSize}`, searchPayload, this.envSvc.environment.WorkFlowAPI)
|
|
549
|
+
: await this.server.get(`GetFormValuesWithParam/${this.currentSearchTerm.trim()}/${this.pageState.Skip}/${this.pageSize}`, this.envSvc.environment.WorkFlowAPI);
|
|
550
|
+
}
|
|
551
|
+
else {
|
|
552
|
+
res =
|
|
553
|
+
payload.length === 0
|
|
554
|
+
? await this.server.get(`GetFormValues/${this.pageState.Skip}/${this.pageSize}`, this.envSvc.environment.WorkFlowAPI)
|
|
555
|
+
: await this.server.post(`SearchFormValues/${this.pageState.Skip}/${this.pageSize}`, payload, this.envSvc.environment.WorkFlowAPI);
|
|
556
|
+
}
|
|
557
|
+
this.utilService.sendBI(false);
|
|
558
|
+
if (res instanceof ErrorResponse) {
|
|
559
|
+
return undefined;
|
|
560
|
+
}
|
|
561
|
+
else {
|
|
562
|
+
return res;
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
onFilterUpdated(updatedFilters) {
|
|
566
|
+
if (Array.isArray(updatedFilters)) {
|
|
567
|
+
this.currentFilters = updatedFilters;
|
|
568
|
+
this.updateFiltersAndSorts();
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
onSortUpdated(updatedSorts) {
|
|
572
|
+
this.currentSorts = updatedSorts;
|
|
573
|
+
this.updateFiltersAndSorts();
|
|
574
|
+
}
|
|
575
|
+
handleSearch(event) {
|
|
576
|
+
this.searchTerm$.next(event.value);
|
|
577
|
+
}
|
|
578
|
+
onStateChange(event) { }
|
|
579
|
+
onViewChange(isGridView) { }
|
|
580
|
+
// ---------------- Export Logic ----------------
|
|
581
|
+
isFileInput(dataType) {
|
|
582
|
+
if (!dataType)
|
|
583
|
+
return false;
|
|
584
|
+
const str = String(dataType).toLowerCase();
|
|
585
|
+
return (str.includes('file') ||
|
|
586
|
+
str === 'image' ||
|
|
587
|
+
str === 'video' ||
|
|
588
|
+
str === 'audio' ||
|
|
589
|
+
dataType === DataType.Image ||
|
|
590
|
+
dataType === DataType.Video ||
|
|
591
|
+
dataType === DataType.Audio ||
|
|
592
|
+
dataType === DataType.SingleFileSelection ||
|
|
593
|
+
dataType === DataType.MultiFileSelection);
|
|
594
|
+
}
|
|
595
|
+
getEntitiesFromRecord(record) {
|
|
596
|
+
if (!record)
|
|
597
|
+
return [];
|
|
598
|
+
let entities = record.EntityValues ??
|
|
599
|
+
record.Entities ??
|
|
600
|
+
record.entityValues ??
|
|
601
|
+
record.entities ??
|
|
602
|
+
record.Groups ??
|
|
603
|
+
record.groups;
|
|
604
|
+
if (typeof entities === 'string') {
|
|
605
|
+
try {
|
|
606
|
+
entities = JSON.parse(entities);
|
|
607
|
+
}
|
|
608
|
+
catch {
|
|
609
|
+
entities = [];
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
if (Array.isArray(entities)) {
|
|
613
|
+
return entities;
|
|
614
|
+
}
|
|
615
|
+
if (entities && typeof entities === 'object') {
|
|
616
|
+
return [entities];
|
|
617
|
+
}
|
|
618
|
+
return [];
|
|
619
|
+
}
|
|
620
|
+
getEntityProperties(entityVal) {
|
|
621
|
+
if (!entityVal)
|
|
622
|
+
return [];
|
|
623
|
+
let props = entityVal.Values ??
|
|
624
|
+
entityVal.Properties ??
|
|
625
|
+
entityVal.values ??
|
|
626
|
+
entityVal.properties;
|
|
627
|
+
if (typeof props === 'string') {
|
|
628
|
+
try {
|
|
629
|
+
props = JSON.parse(props);
|
|
630
|
+
}
|
|
631
|
+
catch {
|
|
632
|
+
props = [];
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
if (Array.isArray(props)) {
|
|
636
|
+
return props;
|
|
637
|
+
}
|
|
638
|
+
return [];
|
|
639
|
+
}
|
|
640
|
+
groupFormValuesByEntity(rawList) {
|
|
641
|
+
if (!rawList || rawList.length === 0) {
|
|
642
|
+
return [];
|
|
643
|
+
}
|
|
644
|
+
const entityMap = new Map();
|
|
645
|
+
for (const record of rawList) {
|
|
646
|
+
const entities = this.getEntitiesFromRecord(record);
|
|
647
|
+
const baseRow = {
|
|
648
|
+
SubmissionCode: record.Code || record.Id || record.id || '',
|
|
649
|
+
'Submission Code': record.Code || record.Id || record.id || '',
|
|
650
|
+
CreatedBy: record.CreatedBy || record.createdBy || '',
|
|
651
|
+
'Created By': record.CreatedBy || record.createdBy || '',
|
|
652
|
+
SubmissionDate: record.CreatedAt
|
|
653
|
+
? new Date(record.CreatedAt).toLocaleString()
|
|
654
|
+
: '',
|
|
655
|
+
'Submission Date': record.CreatedAt
|
|
656
|
+
? new Date(record.CreatedAt).toLocaleString()
|
|
657
|
+
: '',
|
|
658
|
+
};
|
|
659
|
+
if (entities.length === 0) {
|
|
660
|
+
const entityName = record.Form ? String(record.Form).trim() : 'General';
|
|
661
|
+
if (!entityMap.has(entityName)) {
|
|
662
|
+
entityMap.set(entityName, {
|
|
663
|
+
propertyNames: new Set(),
|
|
664
|
+
rows: [],
|
|
665
|
+
});
|
|
666
|
+
}
|
|
667
|
+
const group = entityMap.get(entityName);
|
|
668
|
+
group.rows.push({
|
|
669
|
+
FormEntity: entityName,
|
|
670
|
+
'Form Entity': entityName,
|
|
671
|
+
...baseRow,
|
|
672
|
+
});
|
|
673
|
+
continue;
|
|
674
|
+
}
|
|
675
|
+
for (const entityVal of entities) {
|
|
676
|
+
const entityName = (entityVal.EntityName ||
|
|
677
|
+
entityVal.Name ||
|
|
678
|
+
entityVal.entityName ||
|
|
679
|
+
entityVal.name ||
|
|
680
|
+
record.Form ||
|
|
681
|
+
'General')
|
|
682
|
+
.toString()
|
|
683
|
+
.trim();
|
|
684
|
+
if (!entityMap.has(entityName)) {
|
|
685
|
+
entityMap.set(entityName, {
|
|
686
|
+
propertyNames: new Set(),
|
|
687
|
+
rows: [],
|
|
688
|
+
});
|
|
689
|
+
}
|
|
690
|
+
const group = entityMap.get(entityName);
|
|
691
|
+
const row = {
|
|
692
|
+
FormEntity: entityName,
|
|
693
|
+
'Form Entity': entityName,
|
|
694
|
+
...baseRow,
|
|
695
|
+
};
|
|
696
|
+
const props = this.getEntityProperties(entityVal);
|
|
697
|
+
for (const prop of props) {
|
|
698
|
+
if (this.isFileInput(prop.DataType || prop.dataType)) {
|
|
699
|
+
continue;
|
|
700
|
+
}
|
|
701
|
+
const propName = (prop.Name ||
|
|
702
|
+
prop.PropertyName ||
|
|
703
|
+
prop.name ||
|
|
704
|
+
prop.propertyName ||
|
|
705
|
+
prop.Label ||
|
|
706
|
+
prop.label ||
|
|
707
|
+
'Property')
|
|
708
|
+
.toString()
|
|
709
|
+
.trim();
|
|
710
|
+
const propValue = prop.Value !== undefined && prop.Value !== null
|
|
711
|
+
? prop.Value
|
|
712
|
+
: prop.value !== undefined && prop.value !== null
|
|
713
|
+
? prop.value
|
|
714
|
+
: '';
|
|
715
|
+
group.propertyNames.add(propName);
|
|
716
|
+
row[propName] = propValue;
|
|
717
|
+
}
|
|
718
|
+
group.rows.push(row);
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
const tables = [];
|
|
722
|
+
entityMap.forEach((group, entityName) => {
|
|
723
|
+
const columns = [
|
|
724
|
+
'Form Entity',
|
|
725
|
+
'Submission Code',
|
|
726
|
+
'Created By',
|
|
727
|
+
'Submission Date',
|
|
728
|
+
...Array.from(group.propertyNames),
|
|
729
|
+
];
|
|
730
|
+
tables.push({
|
|
731
|
+
entityName,
|
|
732
|
+
columns,
|
|
733
|
+
rows: group.rows,
|
|
734
|
+
});
|
|
735
|
+
});
|
|
736
|
+
return tables;
|
|
737
|
+
}
|
|
738
|
+
exportFiltersAndSorts = async (pageState) => {
|
|
739
|
+
const payload = this.currentFilters.map((x) => ({
|
|
740
|
+
PropertyName: FormValuePropertyMap[x.name.split(' ').join('')],
|
|
741
|
+
EntityValue: x.value,
|
|
742
|
+
Operator: SearchOperator.And,
|
|
743
|
+
Sign: x.condition && Object.keys(FilterTypes).includes(x.condition)
|
|
744
|
+
? FilterTypes[x.condition]
|
|
745
|
+
: SearchPropertySign.EQ,
|
|
746
|
+
Type: x.name === FormValuePropertyName.CreatedAt ||
|
|
747
|
+
x.name === FormValuePropertyName.ExpiryDate
|
|
748
|
+
? SearchPropertyValueType.Date
|
|
749
|
+
: x.name === FormValuePropertyName.AllowAnonymous ||
|
|
750
|
+
x.name === FormValuePropertyName.IsValid
|
|
751
|
+
? SearchPropertyValueType.Bool
|
|
752
|
+
: SearchPropertyValueType.String,
|
|
753
|
+
}));
|
|
754
|
+
for (const sort of this.currentSorts) {
|
|
755
|
+
payload.push({
|
|
756
|
+
PropertyName: FormValuePropertyMap[sort.name.split(' ').join('')],
|
|
757
|
+
EntityValue: '',
|
|
758
|
+
Operator: SearchOperator.And,
|
|
759
|
+
Sign: SearchPropertySign.EQ,
|
|
760
|
+
Sort: sort.value.toLowerCase() === SortDirection.Asc.toLowerCase()
|
|
761
|
+
? SortDirection.Asc
|
|
762
|
+
: sort.value.toLowerCase() === SortDirection.Desc.toLowerCase()
|
|
763
|
+
? SortDirection.Desc
|
|
764
|
+
: SortDirection.None,
|
|
765
|
+
});
|
|
766
|
+
}
|
|
767
|
+
if (this.formCode && this.formCode.length > 0) {
|
|
768
|
+
payload.push({
|
|
769
|
+
PropertyName: 'Form',
|
|
770
|
+
EntityValue: this.formCode,
|
|
771
|
+
Operator: SearchOperator.And,
|
|
772
|
+
Sign: SearchPropertySign.EQ,
|
|
773
|
+
});
|
|
774
|
+
}
|
|
775
|
+
const searchPayload = [];
|
|
776
|
+
const searchTermExists = this.currentSearchTerm.trim().length > 0;
|
|
777
|
+
if (searchTermExists) {
|
|
778
|
+
Object.keys(FormValueSearchProperty).forEach((key) => {
|
|
779
|
+
searchPayload.push({
|
|
780
|
+
PropertyName: key,
|
|
781
|
+
EntityValue: this.currentSearchTerm.trim(),
|
|
782
|
+
Operator: SearchOperator.Or,
|
|
783
|
+
Sign: SearchPropertySign.LIKE,
|
|
784
|
+
});
|
|
785
|
+
});
|
|
786
|
+
if (this.formCode && this.formCode.length > 0) {
|
|
787
|
+
searchPayload.push({
|
|
788
|
+
PropertyName: 'Form',
|
|
789
|
+
EntityValue: this.formCode,
|
|
790
|
+
Operator: SearchOperator.And,
|
|
791
|
+
Sign: SearchPropertySign.EQ,
|
|
792
|
+
});
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
const skip = pageState.skip || 0;
|
|
796
|
+
const limit = pageState.limit && pageState.limit > 0
|
|
797
|
+
? pageState.limit
|
|
798
|
+
: this.pageState?.Total && this.pageState.Total > 0
|
|
799
|
+
? this.pageState.Total
|
|
800
|
+
: 10000;
|
|
801
|
+
this.utilService.sendBI(true);
|
|
802
|
+
let res;
|
|
803
|
+
if (searchTermExists) {
|
|
804
|
+
res =
|
|
805
|
+
this.formCode && this.formCode.length > 0
|
|
806
|
+
? await this.server.post(`SearchFormValues/${skip}/${limit}`, searchPayload, this.envSvc.environment.WorkFlowAPI)
|
|
807
|
+
: await this.server.get(`GetFormValuesWithParam/${this.currentSearchTerm.trim()}/${skip}/${limit}`, this.envSvc.environment.WorkFlowAPI);
|
|
808
|
+
}
|
|
809
|
+
else {
|
|
810
|
+
res =
|
|
811
|
+
payload.length === 0
|
|
812
|
+
? await this.server.get(`GetFormValues/${skip}/${limit}`, this.envSvc.environment.WorkFlowAPI)
|
|
813
|
+
: await this.server.post(`SearchFormValues/${skip}/${limit}`, payload, this.envSvc.environment.WorkFlowAPI);
|
|
814
|
+
}
|
|
815
|
+
this.utilService.sendBI(false);
|
|
816
|
+
if (res instanceof ErrorResponse) {
|
|
817
|
+
const tables = this.groupFormValuesByEntity(this.data);
|
|
818
|
+
const csv = this.generateMultiTableCSV(tables);
|
|
819
|
+
this.downloadCSVContent(csv, this.getExportFilename());
|
|
820
|
+
return null;
|
|
821
|
+
}
|
|
822
|
+
else {
|
|
823
|
+
const result = res.Result || [];
|
|
824
|
+
const dataToGroup = result.length > 0 ? result : this.data;
|
|
825
|
+
const tables = this.groupFormValuesByEntity(dataToGroup);
|
|
826
|
+
const csv = this.generateMultiTableCSV(tables);
|
|
827
|
+
this.downloadCSVContent(csv, this.getExportFilename());
|
|
828
|
+
return null;
|
|
829
|
+
}
|
|
830
|
+
};
|
|
831
|
+
getFallbackExportRow() {
|
|
832
|
+
const fallbackRow = {};
|
|
833
|
+
const cols = this.exportColumns.length > 0
|
|
834
|
+
? this.exportColumns
|
|
835
|
+
: [
|
|
836
|
+
{
|
|
837
|
+
id: 'formEntity',
|
|
838
|
+
header: 'Form Entity',
|
|
839
|
+
accessorKey: 'FormEntity',
|
|
840
|
+
},
|
|
841
|
+
{
|
|
842
|
+
id: 'submissionCode',
|
|
843
|
+
header: 'Submission Code',
|
|
844
|
+
accessorKey: 'SubmissionCode',
|
|
845
|
+
},
|
|
846
|
+
{
|
|
847
|
+
id: 'createdBy',
|
|
848
|
+
header: 'Created By',
|
|
849
|
+
accessorKey: 'CreatedBy',
|
|
850
|
+
},
|
|
851
|
+
{
|
|
852
|
+
id: 'submissionDate',
|
|
853
|
+
header: 'Submission Date',
|
|
854
|
+
accessorKey: 'SubmissionDate',
|
|
855
|
+
},
|
|
856
|
+
];
|
|
857
|
+
cols.forEach((c) => {
|
|
858
|
+
const key = String(c.accessorKey || (typeof c.header === 'string' ? c.header : c.id));
|
|
859
|
+
fallbackRow[key] = '';
|
|
860
|
+
});
|
|
861
|
+
return [fallbackRow];
|
|
862
|
+
}
|
|
863
|
+
updateExportColumnsAndData() {
|
|
864
|
+
const propertySet = new Set();
|
|
865
|
+
for (const item of this.data) {
|
|
866
|
+
const entities = this.getEntitiesFromRecord(item);
|
|
867
|
+
for (const entityVal of entities) {
|
|
868
|
+
const props = this.getEntityProperties(entityVal);
|
|
869
|
+
for (const prop of props) {
|
|
870
|
+
if (!this.isFileInput(prop.DataType || prop.dataType)) {
|
|
871
|
+
const propName = (prop.Name ||
|
|
872
|
+
prop.PropertyName ||
|
|
873
|
+
prop.name ||
|
|
874
|
+
prop.propertyName ||
|
|
875
|
+
prop.Label ||
|
|
876
|
+
prop.label ||
|
|
877
|
+
'')
|
|
878
|
+
.toString()
|
|
879
|
+
.trim();
|
|
880
|
+
if (propName) {
|
|
881
|
+
propertySet.add(propName);
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
}
|
|
887
|
+
const cols = [
|
|
888
|
+
{
|
|
889
|
+
id: 'formEntity',
|
|
890
|
+
header: 'Form Entity',
|
|
891
|
+
accessorKey: 'FormEntity',
|
|
892
|
+
},
|
|
893
|
+
{
|
|
894
|
+
id: 'submissionCode',
|
|
895
|
+
header: 'Submission Code',
|
|
896
|
+
accessorKey: 'SubmissionCode',
|
|
897
|
+
},
|
|
898
|
+
{
|
|
899
|
+
id: 'createdBy',
|
|
900
|
+
header: 'Created By',
|
|
901
|
+
accessorKey: 'CreatedBy',
|
|
902
|
+
},
|
|
903
|
+
{
|
|
904
|
+
id: 'submissionDate',
|
|
905
|
+
header: 'Submission Date',
|
|
906
|
+
accessorKey: 'SubmissionDate',
|
|
907
|
+
},
|
|
908
|
+
];
|
|
909
|
+
propertySet.forEach((propName) => {
|
|
910
|
+
cols.push({
|
|
911
|
+
id: propName.toLowerCase().replace(/\s+/g, '_'),
|
|
912
|
+
header: propName,
|
|
913
|
+
accessorKey: propName,
|
|
914
|
+
});
|
|
915
|
+
});
|
|
916
|
+
this.exportColumns = cols;
|
|
917
|
+
const rows = [];
|
|
918
|
+
const tables = this.groupFormValuesByEntity(this.data);
|
|
919
|
+
for (const table of tables) {
|
|
920
|
+
for (const row of table.rows) {
|
|
921
|
+
rows.push(row);
|
|
922
|
+
}
|
|
923
|
+
}
|
|
924
|
+
this.exportData = rows;
|
|
925
|
+
this.showExport = false;
|
|
926
|
+
this.cdr.detectChanges();
|
|
927
|
+
this.showExport = true;
|
|
928
|
+
this.cdr.detectChanges();
|
|
929
|
+
if (this.dataXport?.exportService) {
|
|
930
|
+
this.dataXport.exportService.downloadCSV = () => {
|
|
931
|
+
const currentTables = this.groupFormValuesByEntity(this.data);
|
|
932
|
+
const csv = this.generateMultiTableCSV(currentTables);
|
|
933
|
+
this.downloadCSVContent(csv, this.getExportFilename());
|
|
934
|
+
};
|
|
935
|
+
}
|
|
936
|
+
}
|
|
937
|
+
getExportFilename() {
|
|
938
|
+
return this.formCode ? `${this.formCode}-values.csv` : 'export.csv';
|
|
939
|
+
}
|
|
940
|
+
generateMultiTableCSV(tables) {
|
|
941
|
+
if (!tables || tables.length === 0) {
|
|
942
|
+
const fallbackRow = this.getFallbackExportRow();
|
|
943
|
+
const headers = Object.keys(fallbackRow[0]);
|
|
944
|
+
return (headers.map((h) => `"${h.replace(/"/g, '""')}"`).join(',') +
|
|
945
|
+
'\r\n' +
|
|
946
|
+
headers.map(() => '""').join(','));
|
|
947
|
+
}
|
|
948
|
+
const sections = [];
|
|
949
|
+
for (const table of tables) {
|
|
950
|
+
if (!table.rows || table.rows.length === 0) {
|
|
951
|
+
continue;
|
|
952
|
+
}
|
|
953
|
+
const headers = table.columns;
|
|
954
|
+
const csvRows = [
|
|
955
|
+
headers.map((h) => `"${h.replace(/"/g, '""')}"`).join(','),
|
|
956
|
+
...table.rows.map((row) => headers
|
|
957
|
+
.map((header) => {
|
|
958
|
+
const val = row[header] !== undefined && row[header] !== null
|
|
959
|
+
? String(row[header])
|
|
960
|
+
: '';
|
|
961
|
+
return `"${val.replace(/"/g, '""')}"`;
|
|
962
|
+
})
|
|
963
|
+
.join(',')),
|
|
964
|
+
];
|
|
965
|
+
sections.push(csvRows.join('\r\n'));
|
|
966
|
+
}
|
|
967
|
+
return sections.join('\r\n\r\n\r\n');
|
|
968
|
+
}
|
|
969
|
+
downloadCSVContent(csvContent, filename) {
|
|
970
|
+
const blob = new Blob([csvContent], { type: 'text/csv;charset=utf-8;' });
|
|
971
|
+
const link = document.createElement('a');
|
|
972
|
+
if (link.download !== undefined) {
|
|
973
|
+
const url = URL.createObjectURL(blob);
|
|
974
|
+
link.setAttribute('href', url);
|
|
975
|
+
link.setAttribute('download', filename);
|
|
976
|
+
link.style.visibility = 'hidden';
|
|
977
|
+
document.body.appendChild(link);
|
|
978
|
+
link.click();
|
|
979
|
+
document.body.removeChild(link);
|
|
980
|
+
}
|
|
981
|
+
}
|
|
982
|
+
async handleExport(exportedData) {
|
|
983
|
+
let rawList = this.data;
|
|
984
|
+
if (exportedData &&
|
|
985
|
+
exportedData.length > 0 &&
|
|
986
|
+
exportedData[0]?.EntityValues) {
|
|
987
|
+
rawList = exportedData;
|
|
988
|
+
}
|
|
989
|
+
else if (this.pageState &&
|
|
990
|
+
this.pageState.Total &&
|
|
991
|
+
this.pageState.Total > this.data.length) {
|
|
992
|
+
try {
|
|
993
|
+
const full = await this.fetchAllRecordsForExport(this.pageState.Total);
|
|
994
|
+
if (full && full.length > 0) {
|
|
995
|
+
rawList = full;
|
|
996
|
+
}
|
|
997
|
+
}
|
|
998
|
+
catch (e) {
|
|
999
|
+
rawList = this.data;
|
|
1000
|
+
}
|
|
1001
|
+
}
|
|
1002
|
+
const tables = this.groupFormValuesByEntity(rawList);
|
|
1003
|
+
this.downloadCSV(tables);
|
|
1004
|
+
}
|
|
1005
|
+
async fetchAllRecordsForExport(total) {
|
|
1006
|
+
const payload = this.currentFilters.map((x) => ({
|
|
1007
|
+
PropertyName: FormValuePropertyMap[x.name.split(' ').join('')],
|
|
1008
|
+
EntityValue: x.value,
|
|
1009
|
+
Operator: SearchOperator.And,
|
|
1010
|
+
Sign: x.condition && Object.keys(FilterTypes).includes(x.condition)
|
|
1011
|
+
? FilterTypes[x.condition]
|
|
1012
|
+
: SearchPropertySign.EQ,
|
|
1013
|
+
Type: x.name === FormValuePropertyName.CreatedAt ||
|
|
1014
|
+
x.name === FormValuePropertyName.ExpiryDate
|
|
1015
|
+
? SearchPropertyValueType.Date
|
|
1016
|
+
: x.name === FormValuePropertyName.AllowAnonymous ||
|
|
1017
|
+
x.name === FormValuePropertyName.IsValid
|
|
1018
|
+
? SearchPropertyValueType.Bool
|
|
1019
|
+
: SearchPropertyValueType.String,
|
|
1020
|
+
}));
|
|
1021
|
+
for (const sort of this.currentSorts) {
|
|
1022
|
+
payload.push({
|
|
1023
|
+
PropertyName: FormValuePropertyMap[sort.name.split(' ').join('')],
|
|
1024
|
+
EntityValue: '',
|
|
1025
|
+
Operator: SearchOperator.And,
|
|
1026
|
+
Sign: SearchPropertySign.EQ,
|
|
1027
|
+
Sort: sort.value.toLowerCase() === SortDirection.Asc.toLowerCase()
|
|
1028
|
+
? SortDirection.Asc
|
|
1029
|
+
: sort.value.toLowerCase() === SortDirection.Desc.toLowerCase()
|
|
1030
|
+
? SortDirection.Desc
|
|
1031
|
+
: SortDirection.None,
|
|
1032
|
+
});
|
|
1033
|
+
}
|
|
1034
|
+
if (this.formCode && this.formCode.length > 0) {
|
|
1035
|
+
payload.push({
|
|
1036
|
+
PropertyName: 'Form',
|
|
1037
|
+
EntityValue: this.formCode,
|
|
1038
|
+
Operator: SearchOperator.And,
|
|
1039
|
+
Sign: SearchPropertySign.EQ,
|
|
1040
|
+
});
|
|
1041
|
+
}
|
|
1042
|
+
const searchTermExists = this.currentSearchTerm.trim().length > 0;
|
|
1043
|
+
this.utilService.sendBI(true);
|
|
1044
|
+
let res;
|
|
1045
|
+
if (searchTermExists) {
|
|
1046
|
+
const searchPayload = [];
|
|
1047
|
+
Object.keys(FormValueSearchProperty).forEach((key) => {
|
|
1048
|
+
searchPayload.push({
|
|
1049
|
+
PropertyName: key,
|
|
1050
|
+
EntityValue: this.currentSearchTerm.trim(),
|
|
1051
|
+
Operator: SearchOperator.Or,
|
|
1052
|
+
Sign: SearchPropertySign.LIKE,
|
|
1053
|
+
});
|
|
1054
|
+
});
|
|
1055
|
+
if (this.formCode && this.formCode.length > 0) {
|
|
1056
|
+
searchPayload.push({
|
|
1057
|
+
PropertyName: 'Form',
|
|
1058
|
+
EntityValue: this.formCode,
|
|
1059
|
+
Operator: SearchOperator.And,
|
|
1060
|
+
Sign: SearchPropertySign.EQ,
|
|
1061
|
+
});
|
|
1062
|
+
}
|
|
1063
|
+
res = await this.server.post(`SearchFormValues/0/${total}`, searchPayload, this.envSvc.environment.WorkFlowAPI);
|
|
1064
|
+
}
|
|
1065
|
+
else {
|
|
1066
|
+
res =
|
|
1067
|
+
payload.length === 0
|
|
1068
|
+
? await this.server.get(`GetFormValues/0/${total}`, this.envSvc.environment.WorkFlowAPI)
|
|
1069
|
+
: await this.server.post(`SearchFormValues/0/${total}`, payload, this.envSvc.environment.WorkFlowAPI);
|
|
1070
|
+
}
|
|
1071
|
+
this.utilService.sendBI(false);
|
|
1072
|
+
if (res instanceof ErrorResponse) {
|
|
1073
|
+
return this.data;
|
|
1074
|
+
}
|
|
1075
|
+
return res.Result || this.data;
|
|
1076
|
+
}
|
|
1077
|
+
downloadCSV(tables) {
|
|
1078
|
+
if (!tables || tables.length === 0) {
|
|
1079
|
+
this.utilService.showError('No valid form values found to export');
|
|
1080
|
+
return;
|
|
1081
|
+
}
|
|
1082
|
+
const sections = [];
|
|
1083
|
+
tables.forEach((table) => {
|
|
1084
|
+
const lines = [];
|
|
1085
|
+
lines.push(this.escapeCsv(`Table: ${table.entityName}`));
|
|
1086
|
+
lines.push(table.columns.map((h) => this.escapeCsv(h)).join(','));
|
|
1087
|
+
table.rows.forEach((row) => {
|
|
1088
|
+
lines.push(table.columns
|
|
1089
|
+
.map((col) => this.escapeCsv(row[col] !== undefined && row[col] !== null
|
|
1090
|
+
? String(row[col])
|
|
1091
|
+
: ''))
|
|
1092
|
+
.join(','));
|
|
1093
|
+
});
|
|
1094
|
+
sections.push(lines.join('\r\n'));
|
|
1095
|
+
});
|
|
1096
|
+
const csvContent = sections.join('\r\n\r\n');
|
|
1097
|
+
const blob = new Blob([csvContent], { type: 'text/csv;charset=utf-8;' });
|
|
1098
|
+
const link = document.createElement('a');
|
|
1099
|
+
if (link.download !== undefined) {
|
|
1100
|
+
const url = URL.createObjectURL(blob);
|
|
1101
|
+
link.setAttribute('href', url);
|
|
1102
|
+
link.setAttribute('download', `${this.formCode ? this.formCode + '-responses' : 'form-values'}.csv`);
|
|
1103
|
+
link.style.visibility = 'hidden';
|
|
1104
|
+
document.body.appendChild(link);
|
|
1105
|
+
link.click();
|
|
1106
|
+
document.body.removeChild(link);
|
|
1107
|
+
}
|
|
1108
|
+
}
|
|
1109
|
+
downloadExcel(tables) {
|
|
1110
|
+
if (!tables || tables.length === 0) {
|
|
1111
|
+
this.utilService.showError('No valid form values found to export');
|
|
1112
|
+
return;
|
|
1113
|
+
}
|
|
1114
|
+
let xml = `<?xml version="1.0"?>\n` +
|
|
1115
|
+
`<?mso-application progid="Excel.Sheet"?>\n` +
|
|
1116
|
+
`<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"\n` +
|
|
1117
|
+
` xmlns:o="urn:schemas-microsoft-com:office:office"\n` +
|
|
1118
|
+
` xmlns:x="urn:schemas-microsoft-com:office:excel"\n` +
|
|
1119
|
+
` xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"\n` +
|
|
1120
|
+
` xmlns:html="http://www.w3.org/TR/REC-html40">\n` +
|
|
1121
|
+
` <Styles>\n` +
|
|
1122
|
+
` <Style ss:ID="Header">\n` +
|
|
1123
|
+
` <Font ss:Bold="1"/>\n` +
|
|
1124
|
+
` <Interior ss:Color="#EFEFEF" ss:Pattern="Solid"/>\n` +
|
|
1125
|
+
` </Style>\n` +
|
|
1126
|
+
` </Styles>\n`;
|
|
1127
|
+
for (const table of tables) {
|
|
1128
|
+
const safeSheetName = this.escapeXml(table.entityName.replace(/[:\\/?*\[\]]/g, '').substring(0, 31) ||
|
|
1129
|
+
'Sheet');
|
|
1130
|
+
xml += ` <Worksheet ss:Name="${safeSheetName}">\n`;
|
|
1131
|
+
xml += ` <Table>\n`;
|
|
1132
|
+
// Header row
|
|
1133
|
+
xml += ` <Row ss:StyleID="Header">\n`;
|
|
1134
|
+
for (const col of table.columns) {
|
|
1135
|
+
xml += ` <Cell><Data ss:Type="String">${this.escapeXml(col)}</Data></Cell>\n`;
|
|
1136
|
+
}
|
|
1137
|
+
xml += ` </Row>\n`;
|
|
1138
|
+
// Data rows
|
|
1139
|
+
for (const row of table.rows) {
|
|
1140
|
+
xml += ` <Row>\n`;
|
|
1141
|
+
for (const col of table.columns) {
|
|
1142
|
+
const val = row[col] !== undefined && row[col] !== null ? String(row[col]) : '';
|
|
1143
|
+
xml += ` <Cell><Data ss:Type="String">${this.escapeXml(val)}</Data></Cell>\n`;
|
|
1144
|
+
}
|
|
1145
|
+
xml += ` </Row>\n`;
|
|
1146
|
+
}
|
|
1147
|
+
xml += ` </Table>\n`;
|
|
1148
|
+
xml += ` </Worksheet>\n`;
|
|
1149
|
+
}
|
|
1150
|
+
xml += `</Workbook>`;
|
|
1151
|
+
const blob = new Blob([xml], {
|
|
1152
|
+
type: 'application/vnd.ms-excel;charset=utf-8;',
|
|
1153
|
+
});
|
|
1154
|
+
const link = document.createElement('a');
|
|
1155
|
+
if (link.download !== undefined) {
|
|
1156
|
+
const url = URL.createObjectURL(blob);
|
|
1157
|
+
link.setAttribute('href', url);
|
|
1158
|
+
link.setAttribute('download', `${this.formCode ? this.formCode + '-responses' : 'form-values'}.xls`);
|
|
1159
|
+
link.style.visibility = 'hidden';
|
|
1160
|
+
document.body.appendChild(link);
|
|
1161
|
+
link.click();
|
|
1162
|
+
document.body.removeChild(link);
|
|
1163
|
+
}
|
|
1164
|
+
}
|
|
1165
|
+
escapeXml(str) {
|
|
1166
|
+
return str
|
|
1167
|
+
.replace(/&/g, '&')
|
|
1168
|
+
.replace(/</g, '<')
|
|
1169
|
+
.replace(/>/g, '>')
|
|
1170
|
+
.replace(/"/g, '"')
|
|
1171
|
+
.replace(/'/g, ''');
|
|
1172
|
+
}
|
|
1173
|
+
escapeCsv(value) {
|
|
1174
|
+
if (value.includes(',') ||
|
|
1175
|
+
value.includes('"') ||
|
|
1176
|
+
value.includes('\n') ||
|
|
1177
|
+
value.includes('\r')) {
|
|
1178
|
+
return `"${value.replace(/"/g, '""')}"`;
|
|
1179
|
+
}
|
|
1180
|
+
return value;
|
|
1181
|
+
}
|
|
1182
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: FormValuesComponent, deps: [{ token: i1.UtilService }, { token: i1.HttpWebRequestService }, { token: i0.ChangeDetectorRef }, { token: i1.EnvironmentService }, { token: i2.ActivatedRoute }, { token: FormValuesService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1183
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.14", type: FormValuesComponent, selector: "lib-form-values", inputs: { formCodeKey: "formCodeKey", pageSize: "pageSize", searchDebounceTime: "searchDebounceTime", permissionConfig: "permissionConfig" }, viewQueries: [{ propertyName: "cardDataView", first: true, predicate: ["vdcv"], descendants: true }, { propertyName: "dataView", first: true, predicate: ["vdv"], descendants: true }, { propertyName: "dataXport", first: true, predicate: ["dataXport"], descendants: true }], ngImport: i0, template: "<div #messageLog class=\"flex flex-col gap-4 message-log-container\">\n <verben-data-view\n #vdv\n [isTableView]=\"false\"\n [viewState]=\"{\n isSearch: true,\n isColumn: false,\n isFilter: true,\n isSort: true,\n isExport: !permissionConfig || permissionConfig.Actions['Export'],\n isSelect: false,\n isCreate: false,\n isToggle: false,\n isImport: false,\n }\"\n [buttonClass]=\"'my-custom-button-class'\"\n [iconClass]=\"'my-icon-class'\"\n [activeIconClass]=\"'my-active-icon-class'\"\n [selectedColumnCount]=\"0\"\n [selectedSortCount]=\"currentSorts.length\"\n [selectedFilterTableCount]=\"currentFilters.length\"\n (viewChange)=\"onViewChange($event)\"\n (stateChange)=\"onStateChange($event)\"\n (onSearchChange)=\"handleSearch($event)\"\n >\n <div filter-content>\n <verben-table-filter\n (filtersApplied)=\"onFilterUpdated($event)\"\n width=\"420px\"\n [filterOptions]=\"filterArray\"\n [maxFilterLength]=\"3\"\n ></verben-table-filter>\n </div>\n\n <div sort-content>\n <verben-sort-table\n (selectedOptions)=\"onSortUpdated($event)\"\n width=\"400px\"\n [enableDragAndDrop]=\"true\"\n [sortOptions]=\"sortOptions\"\n ></verben-sort-table>\n </div>\n\n <div export-content>\n <lib-data-xport\n #dataXport\n *ngIf=\"showExport\"\n [useImportKey]=\"true\"\n [columns]=\"exportColumns\"\n [data]=\"exportData\"\n [dataQueryFunction]=\"exportFiltersAndSorts\"\n >\n </lib-data-xport>\n </div>\n\n <div class=\"mt-2\" card-content>\n <verben-card-data-view\n borderRadius=\"12px\"\n #vdcv\n dataId=\"Code\"\n border=\"5px\"\n [cardDataList]=\"cardData\"\n rbgColor=\"var(--vbn-color-surface-alt)\"\n mg=\"0px\"\n >\n <verben-left-card-data-view class=\"space-y-7\">\n <verben-left-card-data\n #vlcd\n [parent]=\"vdcv\"\n dataId=\"Code\"\n class=\"bg-secondary-100 rounded-xl border-primary border-[1px]\"\n [cardDataList]=\"cardData\"\n >\n <ng-template #card let-item>\n <div\n (click)=\"cardClicked(item)\"\n class=\"flex cursor-pointer h-[max-content]\"\n >\n <div class=\"flex w-full bg-secondary rounded-xl\">\n <div\n class=\"w-3 rounded-xl rounded-tr-none rounded-br-none\"\n [ngClass]=\"\n item.selected ? 'bg-primary' : 'bg-secondary-200'\n \"\n ></div>\n <div class=\"py-3 px-4 flex-1 h-[100%]\">\n <div\n class=\"flex items-start flex-1 gap-1 justify-between h-[100%]\"\n >\n <div\n class=\"flex flex-col flex-1 card-min-height justify-between h-[100%]\"\n >\n <div class=\"flex justify-between\">\n <div>\n <h3\n class=\"my-0 font-bold text-[var(--vbn-color-on-primary)] leading-[19.5px]\"\n >\n {{\n item.data.CreatedBy ||\n item.data.Code ||\n \"Response\"\n }}\n </h3>\n <span class=\"flex mt-2 items-center gap-1\">\n <span\n class=\"!text-[10px] font-light text-[var(--vbn-color-on-primary)]\"\n >Date:</span\n >\n <span class=\"!text-[12px] font-semibold\">{{\n item.data.CreatedAt | date: \"medium\"\n }}</span>\n </span>\n </div>\n\n <div>\n <span\n class=\"!text-[10px] text-[var(--vbn-color-on-primary)]\"\n >Code</span\n >\n <p class=\"!text-[12px]\">{{ item.data.Code }}</p>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n </ng-template>\n </verben-left-card-data>\n </verben-left-card-data-view>\n\n <verben-right-card-data-view>\n <ng-template #parent>\n <div *ngIf=\"this.currentData\">\n <div\n *ngIf=\"\n currentData.data.EntityValues &&\n currentData.data.EntityValues.length > 0\n \"\n class=\"flex flex-wrap bg-[#9A9FBF80] rounded-xl px-3 py-2 w-full relative gap-6\"\n >\n <div\n *ngFor=\"\n let group of currentData.data.EntityValues;\n let index = index\n \"\n >\n <p\n (click)=\"setActive(index)\"\n [ngClass]=\"{\n 'bg-[var(--vbn-color-surface)] text-primary rounded-lg shadow-lg':\n active === index,\n }\"\n class=\"px-6 py-2 cursor-pointer\"\n >\n {{ group.EntityName }}\n </p>\n </div>\n </div>\n\n <div\n *ngIf=\"\n currentData.data.EntityValues &&\n currentData.data.EntityValues[active];\n else emptyState\n \"\n class=\"mt-4\"\n >\n <form-control\n [dataType]=\"dataType\"\n [disabled]=\"!allowFormResponseEdit\"\n [formProperties]=\"\n currentData.data.EntityValues[active].Values\n \"\n ></form-control>\n <div\n class=\"flex justify-between w-full bottom-8 left-0 right-0 mt-4\"\n >\n <div></div>\n\n <div class=\"flex gap-3\">\n <verbena-button\n *ngIf=\"allowFormResponseEdit\"\n class=\"verben-primary-button\"\n (click)=\"saveFormValue()\"\n text=\"Save\"\n ></verbena-button>\n </div>\n </div>\n </div>\n\n <ng-template #emptyState>\n <p class=\"mt-4 p-4 text-gray-600 text-center\">\n No entries available for the selected form group.\n </p>\n </ng-template>\n </div>\n </ng-template>\n </verben-right-card-data-view>\n\n <verben-card-data-view-footer>\n <div class=\"flex gap-2 justify-between\">\n <div></div>\n <div\n class=\"flex {{\n vdcv && vdcv.hasCurrentItem() ? 'flex-1' : ''\n }} justify-end items-center gap-5\"\n >\n <span class=\"paginator-text\"\n >{{ cardData.length }} records loaded</span\n >\n <button\n *ngIf=\"hasMore\"\n (click)=\"loadMore()\"\n class=\"load-more view-links\"\n >\n Load more\n </button>\n </div>\n </div>\n </verben-card-data-view-footer>\n </verben-card-data-view>\n </div>\n </verben-data-view>\n</div>\n", styles: [".view-links{font-size:14px!important;color:var(--vbn-color-border-focus);font-weight:600;cursor:pointer}.view-links:hover{text-decoration:underline;text-underline-offset:3px}.card-min-height{gap:10px}::ng-deep .childrenPadding{max-height:300px;overflow-y:auto}::ng-deep .toolbar{margin-bottom:15px}::ng-deep .master-only-container{margin:0!important;padding:0!important}::ng-deep .master-detail-container{margin:0!important;padding:0!important}.pop-up-content{border-radius:4px;background-color:var(--vbn-color-surface);border:1px solid rgba(212,161,7,.5)}.pop-up-value{padding:10px 20px}.pop-up-content>div:nth-child(1){border-bottom:4px solid var(--vbn-color-primary)}\n"], dependencies: [{ kind: "directive", type: i4.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i5.DataViewComponent, selector: "verben-data-view", inputs: ["buttonClass", "iconClass", "activeIconClass", "columnCustomClass", "filterCustomClass", "sortCustomClass", "extendCustomClass", "exportCustomClass", "selectCustomClass", "importCustomClass", "zIndex", "createCustomClass", "tableIcon", "cardIcon", "cardClass", "tableClass", "searchKey", "searchValue", "viewState", "searchTemplate", "importTemplate", "columnTemplate", "extendTemplate", "filterTemplate", "sortTemplate", "children", "exportTemplate", "createTemplate", "selectedColumnCount", "selectedSortCount", "selectedFilterTableCount", "inputWidth", "milliseconds", "showColumnChild", "showSortChild", "showFilterChild", "showImportChild", "showExportChild", "showExtendChild", "create", "showSelected", "useTwoWayBinding", "isTableView"], outputs: ["viewChange", "stateChange", "onSearchChange"] }, { kind: "component", type: i5.CardDataViewComponent, selector: "verben-card-data-view", inputs: ["pd", "mg", "lHeight", "rHeight", "rWidth", "lWidth", "textColor", "lbgColor", "rbgColor", "border", "display", "borderRadius", "activeCss", "inActiveCss", "displayAsRow", "cardDataList", "dataId", "totalRecords", "footer", "noOfVisibleChildren", "showEditIcon", "useVirtualScroll", "virtualScrollItemSize", "onItemClick", "onCardChildClick"], outputs: ["editClicked", "loadMoreClick"] }, { kind: "component", type: i5.LeftCardDataComponent, selector: "verben-left-card-data", inputs: ["pd", "mg", "height", "weight", "activeCss", "inActiveCss", "cardDataList", "iconCollapse", "iconExpanded", "parent", "useVirtualScroll", "virtualScrollItemSize", "dataId", "cardActions", "cardChildActions", "cardActionsPosition"] }, { kind: "component", type: i5.LeftCardDataViewComponent, selector: "verben-left-card-data-view", inputs: ["cardDataList"] }, { kind: "component", type: i5.RightCardDataViewComponent, selector: "verben-right-card-data-view", inputs: ["parentData", "chilData", "meth"] }, { kind: "component", type: i5.CardDataViewFooterComponent, selector: "verben-card-data-view-footer" }, { kind: "component", type: i5.SortTableComponent, selector: "verben-sort-table", inputs: ["enableDragAndDrop", "sortOptions", "columns", "data", "resetText", "displayedOptions", "propertyText", "showMoreText", "sortButtonText", "pd", "mg", "height", "width", "bgColor", "boxShadow", "textColor", "primaryColor", "secondaryColor", "tertiaryColor", "border", "borderRadius", "selectWidth", "containerHeight"], outputs: ["selectedOptions", "resetSortData", "sortApplied", "resetFilter"] }, { kind: "component", type: i5.TableFilterComponent, selector: "verben-table-filter", inputs: ["filterOptions", "columns", "data", "initialFilters", "pd", "mg", "height", "width", "bgColor", "boxShadow", "textColor", "primaryColor", "secondaryColor", "tertiaryColor", "border", "borderRadius", "selectWidth", "maxFilterLength", "savedFilters", "tooltip", "saveCallback"], outputs: ["filtersApplied", "resetSortData", "filterApplied", "resetFilter"] }, { kind: "component", type: i5.VerbenaButtonComponent, selector: "verbena-button", inputs: ["type", "text", "styleType", "size", "block", "disable", "disabled", "isLoading", "spinnerSize", "spinnerColor", "svg", "svgPosition", "svgWidth", "svgHeight", "svgSize", "svgColor", "icon", "useIcon", "iconPosition", "iconColor", "variant", "weight", "bgColor", "textColor", "border", "borderRadius", "pd", "width", "height", "fontSize", "fontWeight", "buttonClass", "buttonTextClass"] }, { kind: "component", type: i5.DataXportComponent, selector: "lib-data-xport", inputs: ["data", "columns", "useImportKey", "includeFooterInExport", "dataFetchUrl", "dataQueryParameters", "dataQueryFunction"], outputs: ["exportDataEvent", "exportDataRangeEvent"] }, { kind: "component", type: i6.FormControlComponent, selector: "form-control", inputs: ["dataType", "value", "boolInputType", "formProperties", "disabled"] }, { kind: "pipe", type: i4.DatePipe, name: "date" }] });
|
|
1184
|
+
}
|
|
1185
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: FormValuesComponent, decorators: [{
|
|
1186
|
+
type: Component,
|
|
1187
|
+
args: [{ selector: 'lib-form-values', template: "<div #messageLog class=\"flex flex-col gap-4 message-log-container\">\n <verben-data-view\n #vdv\n [isTableView]=\"false\"\n [viewState]=\"{\n isSearch: true,\n isColumn: false,\n isFilter: true,\n isSort: true,\n isExport: !permissionConfig || permissionConfig.Actions['Export'],\n isSelect: false,\n isCreate: false,\n isToggle: false,\n isImport: false,\n }\"\n [buttonClass]=\"'my-custom-button-class'\"\n [iconClass]=\"'my-icon-class'\"\n [activeIconClass]=\"'my-active-icon-class'\"\n [selectedColumnCount]=\"0\"\n [selectedSortCount]=\"currentSorts.length\"\n [selectedFilterTableCount]=\"currentFilters.length\"\n (viewChange)=\"onViewChange($event)\"\n (stateChange)=\"onStateChange($event)\"\n (onSearchChange)=\"handleSearch($event)\"\n >\n <div filter-content>\n <verben-table-filter\n (filtersApplied)=\"onFilterUpdated($event)\"\n width=\"420px\"\n [filterOptions]=\"filterArray\"\n [maxFilterLength]=\"3\"\n ></verben-table-filter>\n </div>\n\n <div sort-content>\n <verben-sort-table\n (selectedOptions)=\"onSortUpdated($event)\"\n width=\"400px\"\n [enableDragAndDrop]=\"true\"\n [sortOptions]=\"sortOptions\"\n ></verben-sort-table>\n </div>\n\n <div export-content>\n <lib-data-xport\n #dataXport\n *ngIf=\"showExport\"\n [useImportKey]=\"true\"\n [columns]=\"exportColumns\"\n [data]=\"exportData\"\n [dataQueryFunction]=\"exportFiltersAndSorts\"\n >\n </lib-data-xport>\n </div>\n\n <div class=\"mt-2\" card-content>\n <verben-card-data-view\n borderRadius=\"12px\"\n #vdcv\n dataId=\"Code\"\n border=\"5px\"\n [cardDataList]=\"cardData\"\n rbgColor=\"var(--vbn-color-surface-alt)\"\n mg=\"0px\"\n >\n <verben-left-card-data-view class=\"space-y-7\">\n <verben-left-card-data\n #vlcd\n [parent]=\"vdcv\"\n dataId=\"Code\"\n class=\"bg-secondary-100 rounded-xl border-primary border-[1px]\"\n [cardDataList]=\"cardData\"\n >\n <ng-template #card let-item>\n <div\n (click)=\"cardClicked(item)\"\n class=\"flex cursor-pointer h-[max-content]\"\n >\n <div class=\"flex w-full bg-secondary rounded-xl\">\n <div\n class=\"w-3 rounded-xl rounded-tr-none rounded-br-none\"\n [ngClass]=\"\n item.selected ? 'bg-primary' : 'bg-secondary-200'\n \"\n ></div>\n <div class=\"py-3 px-4 flex-1 h-[100%]\">\n <div\n class=\"flex items-start flex-1 gap-1 justify-between h-[100%]\"\n >\n <div\n class=\"flex flex-col flex-1 card-min-height justify-between h-[100%]\"\n >\n <div class=\"flex justify-between\">\n <div>\n <h3\n class=\"my-0 font-bold text-[var(--vbn-color-on-primary)] leading-[19.5px]\"\n >\n {{\n item.data.CreatedBy ||\n item.data.Code ||\n \"Response\"\n }}\n </h3>\n <span class=\"flex mt-2 items-center gap-1\">\n <span\n class=\"!text-[10px] font-light text-[var(--vbn-color-on-primary)]\"\n >Date:</span\n >\n <span class=\"!text-[12px] font-semibold\">{{\n item.data.CreatedAt | date: \"medium\"\n }}</span>\n </span>\n </div>\n\n <div>\n <span\n class=\"!text-[10px] text-[var(--vbn-color-on-primary)]\"\n >Code</span\n >\n <p class=\"!text-[12px]\">{{ item.data.Code }}</p>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n </ng-template>\n </verben-left-card-data>\n </verben-left-card-data-view>\n\n <verben-right-card-data-view>\n <ng-template #parent>\n <div *ngIf=\"this.currentData\">\n <div\n *ngIf=\"\n currentData.data.EntityValues &&\n currentData.data.EntityValues.length > 0\n \"\n class=\"flex flex-wrap bg-[#9A9FBF80] rounded-xl px-3 py-2 w-full relative gap-6\"\n >\n <div\n *ngFor=\"\n let group of currentData.data.EntityValues;\n let index = index\n \"\n >\n <p\n (click)=\"setActive(index)\"\n [ngClass]=\"{\n 'bg-[var(--vbn-color-surface)] text-primary rounded-lg shadow-lg':\n active === index,\n }\"\n class=\"px-6 py-2 cursor-pointer\"\n >\n {{ group.EntityName }}\n </p>\n </div>\n </div>\n\n <div\n *ngIf=\"\n currentData.data.EntityValues &&\n currentData.data.EntityValues[active];\n else emptyState\n \"\n class=\"mt-4\"\n >\n <form-control\n [dataType]=\"dataType\"\n [disabled]=\"!allowFormResponseEdit\"\n [formProperties]=\"\n currentData.data.EntityValues[active].Values\n \"\n ></form-control>\n <div\n class=\"flex justify-between w-full bottom-8 left-0 right-0 mt-4\"\n >\n <div></div>\n\n <div class=\"flex gap-3\">\n <verbena-button\n *ngIf=\"allowFormResponseEdit\"\n class=\"verben-primary-button\"\n (click)=\"saveFormValue()\"\n text=\"Save\"\n ></verbena-button>\n </div>\n </div>\n </div>\n\n <ng-template #emptyState>\n <p class=\"mt-4 p-4 text-gray-600 text-center\">\n No entries available for the selected form group.\n </p>\n </ng-template>\n </div>\n </ng-template>\n </verben-right-card-data-view>\n\n <verben-card-data-view-footer>\n <div class=\"flex gap-2 justify-between\">\n <div></div>\n <div\n class=\"flex {{\n vdcv && vdcv.hasCurrentItem() ? 'flex-1' : ''\n }} justify-end items-center gap-5\"\n >\n <span class=\"paginator-text\"\n >{{ cardData.length }} records loaded</span\n >\n <button\n *ngIf=\"hasMore\"\n (click)=\"loadMore()\"\n class=\"load-more view-links\"\n >\n Load more\n </button>\n </div>\n </div>\n </verben-card-data-view-footer>\n </verben-card-data-view>\n </div>\n </verben-data-view>\n</div>\n", styles: [".view-links{font-size:14px!important;color:var(--vbn-color-border-focus);font-weight:600;cursor:pointer}.view-links:hover{text-decoration:underline;text-underline-offset:3px}.card-min-height{gap:10px}::ng-deep .childrenPadding{max-height:300px;overflow-y:auto}::ng-deep .toolbar{margin-bottom:15px}::ng-deep .master-only-container{margin:0!important;padding:0!important}::ng-deep .master-detail-container{margin:0!important;padding:0!important}.pop-up-content{border-radius:4px;background-color:var(--vbn-color-surface);border:1px solid rgba(212,161,7,.5)}.pop-up-value{padding:10px 20px}.pop-up-content>div:nth-child(1){border-bottom:4px solid var(--vbn-color-primary)}\n"] }]
|
|
1188
|
+
}], ctorParameters: () => [{ type: i1.UtilService }, { type: i1.HttpWebRequestService }, { type: i0.ChangeDetectorRef }, { type: i1.EnvironmentService }, { type: i2.ActivatedRoute }, { type: FormValuesService }], propDecorators: { cardDataView: [{
|
|
1189
|
+
type: ViewChild,
|
|
1190
|
+
args: ['vdcv']
|
|
1191
|
+
}], dataView: [{
|
|
1192
|
+
type: ViewChild,
|
|
1193
|
+
args: ['vdv']
|
|
1194
|
+
}], dataXport: [{
|
|
1195
|
+
type: ViewChild,
|
|
1196
|
+
args: ['dataXport']
|
|
1197
|
+
}], formCodeKey: [{
|
|
1198
|
+
type: Input
|
|
1199
|
+
}], pageSize: [{
|
|
1200
|
+
type: Input
|
|
1201
|
+
}], searchDebounceTime: [{
|
|
1202
|
+
type: Input
|
|
1203
|
+
}], permissionConfig: [{
|
|
1204
|
+
type: Input
|
|
1205
|
+
}] } });
|
|
1206
|
+
|
|
1207
|
+
class FormValuesModule {
|
|
1208
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: FormValuesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1209
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.14", ngImport: i0, type: FormValuesModule, declarations: [FormValuesComponent], imports: [CommonModule, SharedModule, FormControlerModule], exports: [FormValuesComponent] });
|
|
1210
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: FormValuesModule, imports: [CommonModule, SharedModule, FormControlerModule] });
|
|
1211
|
+
}
|
|
1212
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: FormValuesModule, decorators: [{
|
|
1213
|
+
type: NgModule,
|
|
1214
|
+
args: [{
|
|
1215
|
+
declarations: [FormValuesComponent],
|
|
1216
|
+
imports: [CommonModule, SharedModule, FormControlerModule],
|
|
1217
|
+
exports: [FormValuesComponent],
|
|
1218
|
+
}]
|
|
1219
|
+
}] });
|
|
1220
|
+
|
|
1221
|
+
/**
|
|
1222
|
+
* Generated bundle index. Do not edit.
|
|
1223
|
+
*/
|
|
1224
|
+
|
|
1225
|
+
export { FormValuePropertyMap, FormValuePropertyName, FormValueSearchProperty, FormValuesComponent, FormValuesModule, FormValuesService };
|
|
1226
|
+
//# sourceMappingURL=verben-workflow-ui-src-lib-components-form-values.mjs.map
|