@ironcode/vas-lib 1.7.0 → 1.8.0-alpha.11
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/cjs/lib/control-value/index.d.ts +1 -0
- package/cjs/lib/control-value/index.d.ts.map +1 -1
- package/cjs/lib/control-value/index.js +1 -0
- package/cjs/lib/control-value/index.js.map +1 -1
- package/cjs/lib/control-value/vas-camera-control-value.model.js +1 -2
- package/cjs/lib/control-value/vas-camera-control-value.model.js.map +1 -1
- package/cjs/lib/control-value/vas-function-control-value.dto.d.ts +7 -0
- package/cjs/lib/control-value/vas-function-control-value.dto.d.ts.map +1 -0
- package/cjs/lib/control-value/vas-function-control-value.dto.js +3 -0
- package/cjs/lib/control-value/vas-function-control-value.dto.js.map +1 -0
- package/cjs/lib/controls-config/index.d.ts +1 -0
- package/cjs/lib/controls-config/index.d.ts.map +1 -1
- package/cjs/lib/controls-config/index.js +1 -0
- package/cjs/lib/controls-config/index.js.map +1 -1
- package/cjs/lib/controls-config/vas-control-config-direction.enum.js +1 -1
- package/cjs/lib/controls-config/vas-control-config-direction.enum.js.map +1 -1
- package/cjs/lib/controls-config/vas-function-control-config.dto.d.ts +6 -0
- package/cjs/lib/controls-config/vas-function-control-config.dto.d.ts.map +1 -0
- package/cjs/lib/controls-config/vas-function-control-config.dto.js +3 -0
- package/cjs/lib/controls-config/vas-function-control-config.dto.js.map +1 -0
- package/cjs/lib/elastic/index.d.ts +2 -0
- package/cjs/lib/elastic/index.d.ts.map +1 -0
- package/cjs/lib/elastic/index.js +5 -0
- package/cjs/lib/elastic/index.js.map +1 -0
- package/cjs/lib/elastic/job.elastic-doc.d.ts +14 -0
- package/cjs/lib/elastic/job.elastic-doc.d.ts.map +1 -0
- package/cjs/lib/elastic/job.elastic-doc.js +3 -0
- package/cjs/lib/elastic/job.elastic-doc.js.map +1 -0
- package/cjs/lib/entity/index.d.ts +3 -0
- package/cjs/lib/entity/index.d.ts.map +1 -1
- package/cjs/lib/entity/index.js +3 -0
- package/cjs/lib/entity/index.js.map +1 -1
- package/cjs/lib/entity/vas-account.dto.js +1 -1
- package/cjs/lib/entity/vas-account.dto.js.map +1 -1
- package/cjs/lib/entity/vas-base.model.d.ts +5 -4
- package/cjs/lib/entity/vas-base.model.d.ts.map +1 -1
- package/cjs/lib/entity/vas-base.model.js +1 -1
- package/cjs/lib/entity/vas-base.model.js.map +1 -1
- package/cjs/lib/entity/vas-contact.model.d.ts +1 -0
- package/cjs/lib/entity/vas-contact.model.d.ts.map +1 -1
- package/cjs/lib/entity/vas-contact.model.js +22 -1
- package/cjs/lib/entity/vas-contact.model.js.map +1 -1
- package/cjs/lib/entity/vas-control.model.d.ts +6 -4
- package/cjs/lib/entity/vas-control.model.d.ts.map +1 -1
- package/cjs/lib/entity/vas-control.model.js +23 -3
- package/cjs/lib/entity/vas-control.model.js.map +1 -1
- package/cjs/lib/entity/vas-field.dto.d.ts +5 -1
- package/cjs/lib/entity/vas-field.dto.d.ts.map +1 -1
- package/cjs/lib/entity/vas-field.dto.js.map +1 -1
- package/cjs/lib/entity/vas-field.model.d.ts +10 -9
- package/cjs/lib/entity/vas-field.model.d.ts.map +1 -1
- package/cjs/lib/entity/vas-field.model.js +40 -27
- package/cjs/lib/entity/vas-field.model.js.map +1 -1
- package/cjs/lib/entity/vas-file.dto.js +1 -2
- package/cjs/lib/entity/vas-file.dto.js.map +1 -1
- package/cjs/lib/entity/vas-file.model.d.ts +1 -0
- package/cjs/lib/entity/vas-file.model.d.ts.map +1 -1
- package/cjs/lib/entity/vas-file.model.js +10 -0
- package/cjs/lib/entity/vas-file.model.js.map +1 -1
- package/cjs/lib/entity/vas-fire-user.model.d.ts +1 -1
- package/cjs/lib/entity/vas-fire-user.model.d.ts.map +1 -1
- package/cjs/lib/entity/vas-fire-user.model.js.map +1 -1
- package/cjs/lib/entity/vas-form-config.dto.d.ts +5 -0
- package/cjs/lib/entity/vas-form-config.dto.d.ts.map +1 -1
- package/cjs/lib/entity/vas-form-config.dto.js.map +1 -1
- package/cjs/lib/entity/vas-form-config.model.d.ts +3 -13
- package/cjs/lib/entity/vas-form-config.model.d.ts.map +1 -1
- package/cjs/lib/entity/vas-form-config.model.js.map +1 -1
- package/cjs/lib/entity/vas-form.model.d.ts +5 -0
- package/cjs/lib/entity/vas-form.model.d.ts.map +1 -1
- package/cjs/lib/entity/vas-form.model.js +21 -1
- package/cjs/lib/entity/vas-form.model.js.map +1 -1
- package/cjs/lib/entity/vas-group.model.d.ts +1 -0
- package/cjs/lib/entity/vas-group.model.d.ts.map +1 -1
- package/cjs/lib/entity/vas-group.model.js +11 -0
- package/cjs/lib/entity/vas-group.model.js.map +1 -1
- package/cjs/lib/entity/vas-invitation.js +1 -1
- package/cjs/lib/entity/vas-invitation.js.map +1 -1
- package/cjs/lib/entity/vas-job-email.model.d.ts +2 -0
- package/cjs/lib/entity/vas-job-email.model.d.ts.map +1 -1
- package/cjs/lib/entity/vas-job-email.model.js +15 -9
- package/cjs/lib/entity/vas-job-email.model.js.map +1 -1
- package/cjs/lib/entity/vas-job.dto.d.ts +10 -2
- package/cjs/lib/entity/vas-job.dto.d.ts.map +1 -1
- package/cjs/lib/entity/vas-job.dto.js.map +1 -1
- package/cjs/lib/entity/vas-job.model.d.ts +13 -4
- package/cjs/lib/entity/vas-job.model.d.ts.map +1 -1
- package/cjs/lib/entity/vas-job.model.js +39 -14
- package/cjs/lib/entity/vas-job.model.js.map +1 -1
- package/cjs/lib/entity/vas-lookup.model.d.ts +35 -0
- package/cjs/lib/entity/vas-lookup.model.d.ts.map +1 -0
- package/cjs/lib/entity/vas-lookup.model.js +73 -0
- package/cjs/lib/entity/vas-lookup.model.js.map +1 -0
- package/cjs/lib/entity/vas-note.model.d.ts +1 -0
- package/cjs/lib/entity/vas-note.model.d.ts.map +1 -1
- package/cjs/lib/entity/vas-note.model.js +9 -0
- package/cjs/lib/entity/vas-note.model.js.map +1 -1
- package/cjs/lib/entity/vas-report.dto.d.ts +1 -1
- package/cjs/lib/entity/vas-report.dto.d.ts.map +1 -1
- package/cjs/lib/entity/vas-report.dto.js.map +1 -1
- package/cjs/lib/entity/vas-report.model.d.ts +5 -2
- package/cjs/lib/entity/vas-report.model.d.ts.map +1 -1
- package/cjs/lib/entity/vas-report.model.js +15 -4
- package/cjs/lib/entity/vas-report.model.js.map +1 -1
- package/cjs/lib/entity/vas-task.dto.d.ts +10 -0
- package/cjs/lib/entity/vas-task.dto.d.ts.map +1 -0
- package/cjs/lib/entity/vas-task.dto.js +3 -0
- package/cjs/lib/entity/vas-task.dto.js.map +1 -0
- package/cjs/lib/entity/vas-task.model.d.ts +37 -0
- package/cjs/lib/entity/vas-task.model.d.ts.map +1 -0
- package/cjs/lib/entity/vas-task.model.js +77 -0
- package/cjs/lib/entity/vas-task.model.js.map +1 -0
- package/cjs/lib/entity/vas-user.model.d.ts +2 -2
- package/cjs/lib/entity/vas-user.model.d.ts.map +1 -1
- package/cjs/lib/entity/vas-user.model.js +1 -1
- package/cjs/lib/entity/vas-user.model.js.map +1 -1
- package/cjs/lib/entity/vas-vehicle.model.d.ts +1 -0
- package/cjs/lib/entity/vas-vehicle.model.d.ts.map +1 -1
- package/cjs/lib/entity/vas-vehicle.model.js +12 -0
- package/cjs/lib/entity/vas-vehicle.model.js.map +1 -1
- package/cjs/lib/utils/find-form-control.js.map +1 -1
- package/cjs/lib/utils/get-value-by-path.d.ts.map +1 -1
- package/cjs/lib/utils/get-value-by-path.js.map +1 -1
- package/cjs/lib/utils/is-array-string.d.ts +1 -1
- package/cjs/lib/utils/is-array-string.d.ts.map +1 -1
- package/cjs/lib/utils/omit.d.ts +8 -0
- package/cjs/lib/utils/omit.d.ts.map +1 -0
- package/cjs/lib/utils/omit.js +26 -0
- package/cjs/lib/utils/omit.js.map +1 -0
- package/cjs/lib/utils/only.d.ts +8 -0
- package/cjs/lib/utils/only.d.ts.map +1 -0
- package/cjs/lib/utils/only.js +26 -0
- package/cjs/lib/utils/only.js.map +1 -0
- package/cjs/public-api.d.ts +1 -0
- package/cjs/public-api.d.ts.map +1 -1
- package/cjs/public-api.js +1 -0
- package/cjs/public-api.js.map +1 -1
- package/{fesm2020 → fesm2022}/ironcode-vas-lib.mjs +879 -63
- package/fesm2022/ironcode-vas-lib.mjs.map +1 -0
- package/lib/control-value/index.d.ts +1 -0
- package/lib/control-value/vas-function-control-value.dto.d.ts +6 -0
- package/lib/controls-config/index.d.ts +1 -0
- package/lib/controls-config/vas-function-control-config.dto.d.ts +5 -0
- package/lib/elastic/index.d.ts +1 -0
- package/lib/elastic/job.elastic-doc.d.ts +13 -0
- package/lib/entity/index.d.ts +3 -0
- package/lib/entity/vas-base.model.d.ts +5 -4
- package/lib/entity/vas-contact.model.d.ts +1 -0
- package/lib/entity/vas-control.model.d.ts +6 -4
- package/lib/entity/vas-field.dto.d.ts +5 -1
- package/lib/entity/vas-field.model.d.ts +10 -9
- package/lib/entity/vas-file.model.d.ts +1 -0
- package/lib/entity/vas-fire-user.model.d.ts +1 -1
- package/lib/entity/vas-form-config.dto.d.ts +5 -0
- package/lib/entity/vas-form-config.model.d.ts +3 -13
- package/lib/entity/vas-form.model.d.ts +5 -0
- package/lib/entity/vas-group.model.d.ts +1 -0
- package/lib/entity/vas-job-email.model.d.ts +2 -0
- package/lib/entity/vas-job.dto.d.ts +10 -2
- package/lib/entity/vas-job.model.d.ts +13 -4
- package/lib/entity/vas-lookup.model.d.ts +34 -0
- package/lib/entity/vas-note.model.d.ts +1 -0
- package/lib/entity/vas-report.dto.d.ts +1 -1
- package/lib/entity/vas-report.model.d.ts +5 -2
- package/lib/entity/vas-task.dto.d.ts +9 -0
- package/lib/entity/vas-task.model.d.ts +36 -0
- package/lib/entity/vas-user.model.d.ts +2 -2
- package/lib/entity/vas-vehicle.model.d.ts +1 -0
- package/lib/utils/is-array-string.d.ts +1 -1
- package/lib/utils/only.d.ts +7 -0
- package/package.json +4 -11
- package/public-api.d.ts +1 -0
- package/cjs/package.json +0 -66
- package/esm2020/ironcode-vas-lib.mjs +0 -5
- package/esm2020/lib/control-value/index.mjs +0 -2
- package/esm2020/lib/control-value/vas-camera-control-value.model.mjs +0 -8
- package/esm2020/lib/controls-config/index.mjs +0 -4
- package/esm2020/lib/controls-config/vas-control-config-direction.enum.mjs +0 -8
- package/esm2020/lib/controls-config/vas-control-config.model.mjs +0 -2
- package/esm2020/lib/controls-config/vas-select-control-config.model.mjs +0 -2
- package/esm2020/lib/entity/index.mjs +0 -65
- package/esm2020/lib/entity/vas-access-group.dto.mjs +0 -2
- package/esm2020/lib/entity/vas-account-config.dto.mjs +0 -2
- package/esm2020/lib/entity/vas-account-object.dto.mjs +0 -2
- package/esm2020/lib/entity/vas-account-object.model.mjs +0 -24
- package/esm2020/lib/entity/vas-account.dto.mjs +0 -7
- package/esm2020/lib/entity/vas-base.dto.mjs +0 -2
- package/esm2020/lib/entity/vas-base.model.mjs +0 -34
- package/esm2020/lib/entity/vas-branch.dto.mjs +0 -2
- package/esm2020/lib/entity/vas-branch.model.mjs +0 -68
- package/esm2020/lib/entity/vas-contact-type.dto.mjs +0 -2
- package/esm2020/lib/entity/vas-contact.dto.mjs +0 -2
- package/esm2020/lib/entity/vas-contact.model.mjs +0 -84
- package/esm2020/lib/entity/vas-control-type.dto.mjs +0 -2
- package/esm2020/lib/entity/vas-control-type.model.mjs +0 -52
- package/esm2020/lib/entity/vas-control.dto.mjs +0 -2
- package/esm2020/lib/entity/vas-control.model.mjs +0 -171
- package/esm2020/lib/entity/vas-field.dto.mjs +0 -2
- package/esm2020/lib/entity/vas-field.model.mjs +0 -97
- package/esm2020/lib/entity/vas-file.dto.mjs +0 -9
- package/esm2020/lib/entity/vas-file.model.mjs +0 -125
- package/esm2020/lib/entity/vas-fire-user.dto.mjs +0 -2
- package/esm2020/lib/entity/vas-fire-user.model.mjs +0 -102
- package/esm2020/lib/entity/vas-form-config.dto.mjs +0 -2
- package/esm2020/lib/entity/vas-form-config.model.mjs +0 -31
- package/esm2020/lib/entity/vas-form.dto.mjs +0 -2
- package/esm2020/lib/entity/vas-form.model.mjs +0 -194
- package/esm2020/lib/entity/vas-group.dto.mjs +0 -2
- package/esm2020/lib/entity/vas-group.model.mjs +0 -97
- package/esm2020/lib/entity/vas-instruction-job-field.dto.mjs +0 -2
- package/esm2020/lib/entity/vas-instruction-job-field.model.mjs +0 -48
- package/esm2020/lib/entity/vas-instruction-job.dto.mjs +0 -2
- package/esm2020/lib/entity/vas-instruction-job.model.mjs +0 -81
- package/esm2020/lib/entity/vas-instruction-provider.dto.mjs +0 -2
- package/esm2020/lib/entity/vas-instruction-provider.model.mjs +0 -66
- package/esm2020/lib/entity/vas-instruction.dto.mjs +0 -2
- package/esm2020/lib/entity/vas-instruction.model.mjs +0 -52
- package/esm2020/lib/entity/vas-invitation.mjs +0 -88
- package/esm2020/lib/entity/vas-job-data.dto.mjs +0 -2
- package/esm2020/lib/entity/vas-job-data.model.mjs +0 -21
- package/esm2020/lib/entity/vas-job-email.dto.mjs +0 -2
- package/esm2020/lib/entity/vas-job-email.model.mjs +0 -79
- package/esm2020/lib/entity/vas-job-status.dto.mjs +0 -2
- package/esm2020/lib/entity/vas-job-type.dto.mjs +0 -2
- package/esm2020/lib/entity/vas-job.dto.mjs +0 -2
- package/esm2020/lib/entity/vas-job.model.mjs +0 -496
- package/esm2020/lib/entity/vas-lookup-type.dto.mjs +0 -2
- package/esm2020/lib/entity/vas-lookup.dto.mjs +0 -2
- package/esm2020/lib/entity/vas-membership.dto.mjs +0 -2
- package/esm2020/lib/entity/vas-membership.model.mjs +0 -62
- package/esm2020/lib/entity/vas-note.dto.mjs +0 -2
- package/esm2020/lib/entity/vas-note.model.mjs +0 -59
- package/esm2020/lib/entity/vas-report-layout.dto.mjs +0 -2
- package/esm2020/lib/entity/vas-report-layout.model.mjs +0 -22
- package/esm2020/lib/entity/vas-report-request.dto.mjs +0 -2
- package/esm2020/lib/entity/vas-report-request.model.mjs +0 -44
- package/esm2020/lib/entity/vas-report.dto.mjs +0 -2
- package/esm2020/lib/entity/vas-report.model.mjs +0 -57
- package/esm2020/lib/entity/vas-restricted-account-object.dto.mjs +0 -2
- package/esm2020/lib/entity/vas-restricted-account-object.model.mjs +0 -24
- package/esm2020/lib/entity/vas-task-type.dto.mjs +0 -2
- package/esm2020/lib/entity/vas-user.dto.mjs +0 -2
- package/esm2020/lib/entity/vas-user.model.mjs +0 -42
- package/esm2020/lib/entity/vas-vehicle.dto.mjs +0 -2
- package/esm2020/lib/entity/vas-vehicle.model.mjs +0 -57
- package/esm2020/lib/model/geo-location.mjs +0 -12
- package/esm2020/lib/model/index.mjs +0 -3
- package/esm2020/lib/model/vas-time-range.model.mjs +0 -2
- package/esm2020/lib/utils/get-value-by-path.mjs +0 -64
- package/esm2020/lib/utils/is-array-string.mjs +0 -4
- package/esm2020/public-api.mjs +0 -5
- package/fesm2015/ironcode-vas-lib.mjs +0 -2359
- package/fesm2015/ironcode-vas-lib.mjs.map +0 -1
- package/fesm2020/ironcode-vas-lib.mjs.map +0 -1
|
@@ -1,2359 +0,0 @@
|
|
|
1
|
-
import moment from 'moment/moment';
|
|
2
|
-
import { UUID } from 'angular2-uuid';
|
|
3
|
-
import moment$1 from 'moment';
|
|
4
|
-
|
|
5
|
-
function isCameraControlValueV1(object) {
|
|
6
|
-
return object instanceof Object
|
|
7
|
-
&& 'webPath' in object
|
|
8
|
-
&& 'path' in object
|
|
9
|
-
&& 'url' in object
|
|
10
|
-
&& 'id' in object;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
var VasControlConfigDirection;
|
|
14
|
-
(function (VasControlConfigDirection) {
|
|
15
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
16
|
-
VasControlConfigDirection[VasControlConfigDirection["ROW"] = 0] = "ROW";
|
|
17
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
18
|
-
VasControlConfigDirection[VasControlConfigDirection["COLUMN"] = 1] = "COLUMN";
|
|
19
|
-
})(VasControlConfigDirection || (VasControlConfigDirection = {}));
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* BaseEntityModel
|
|
23
|
-
*/
|
|
24
|
-
class VasBaseModel {
|
|
25
|
-
constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName) {
|
|
26
|
-
this.id = id;
|
|
27
|
-
this.created = created;
|
|
28
|
-
this.serverCreated = serverCreated;
|
|
29
|
-
this.createdBy = createdBy;
|
|
30
|
-
this.modified = modified;
|
|
31
|
-
this.serverModified = serverModified;
|
|
32
|
-
this.modifiedBy = modifiedBy;
|
|
33
|
-
this.createdByName = createdByName;
|
|
34
|
-
this.modifiedByName = modifiedByName;
|
|
35
|
-
}
|
|
36
|
-
static fromDto(dto) {
|
|
37
|
-
return new VasBaseModel(dto.id || '', dto.created || '', dto.serverCreated || '', dto.createdBy || '', dto.modified || '', dto.serverModified || '', dto.modifiedBy || '', dto.createdByName || '', dto.modifiedByName || '');
|
|
38
|
-
}
|
|
39
|
-
static create(user, values = {}) {
|
|
40
|
-
return this.fromDto(Object.assign(Object.assign({}, values), { id: UUID.UUID(), created: moment().toISOString(), modified: moment().toISOString(), createdBy: (user === null || user === void 0 ? void 0 : user.id) || '', createdByName: (user === null || user === void 0 ? void 0 : user.name) || '', modifiedBy: (user === null || user === void 0 ? void 0 : user.id) || '', modifiedByName: (user === null || user === void 0 ? void 0 : user.name) || '' }));
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
class VasUserModel extends VasBaseModel {
|
|
45
|
-
constructor(id, created = '', serverCreated = '', createdBy = '', modified = '', serverModified = '', modifiedBy = '', createdByName, modifiedByName, email, name, username, memberships, instructionProviders) {
|
|
46
|
-
super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName);
|
|
47
|
-
this.id = id;
|
|
48
|
-
this.created = created;
|
|
49
|
-
this.serverCreated = serverCreated;
|
|
50
|
-
this.createdBy = createdBy;
|
|
51
|
-
this.modified = modified;
|
|
52
|
-
this.serverModified = serverModified;
|
|
53
|
-
this.modifiedBy = modifiedBy;
|
|
54
|
-
this.createdByName = createdByName;
|
|
55
|
-
this.modifiedByName = modifiedByName;
|
|
56
|
-
this.email = email;
|
|
57
|
-
this.name = name;
|
|
58
|
-
this.username = username;
|
|
59
|
-
this.memberships = memberships;
|
|
60
|
-
this.instructionProviders = instructionProviders;
|
|
61
|
-
}
|
|
62
|
-
static fromDto(dto) {
|
|
63
|
-
return new VasUserModel(dto.id, dto.created, dto.serverCreated, dto.createdBy, dto.modified, dto.serverModified, dto.modifiedBy, dto.createdByName || '', dto.modifiedByName || '', dto.email, dto.name, dto.username, dto.memberships, dto.instructionProviders);
|
|
64
|
-
}
|
|
65
|
-
toDto() {
|
|
66
|
-
return {
|
|
67
|
-
id: this.id,
|
|
68
|
-
created: this.created,
|
|
69
|
-
serverCreated: this.serverCreated,
|
|
70
|
-
createdBy: this.createdBy,
|
|
71
|
-
modified: this.modified,
|
|
72
|
-
serverModified: this.serverModified,
|
|
73
|
-
modifiedBy: this.modifiedBy,
|
|
74
|
-
createdByName: this.createdByName,
|
|
75
|
-
modifiedByName: this.modifiedByName,
|
|
76
|
-
email: this.email,
|
|
77
|
-
name: this.name,
|
|
78
|
-
username: this.username,
|
|
79
|
-
memberships: this.memberships,
|
|
80
|
-
instructionProviders: this.instructionProviders
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
class VasFireUserModel extends VasUserModel {
|
|
86
|
-
constructor(id, created = '', serverCreated = '', createdBy = '', modified = '', serverModified = '', modifiedBy = '', createdByName, modifiedByName, email, name, username, memberships, instructionProviders, accounts, tokens, topics, language, displayName) {
|
|
87
|
-
super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, email, name, username, memberships, instructionProviders);
|
|
88
|
-
this.id = id;
|
|
89
|
-
this.created = created;
|
|
90
|
-
this.serverCreated = serverCreated;
|
|
91
|
-
this.createdBy = createdBy;
|
|
92
|
-
this.modified = modified;
|
|
93
|
-
this.serverModified = serverModified;
|
|
94
|
-
this.modifiedBy = modifiedBy;
|
|
95
|
-
this.createdByName = createdByName;
|
|
96
|
-
this.modifiedByName = modifiedByName;
|
|
97
|
-
this.email = email;
|
|
98
|
-
this.name = name;
|
|
99
|
-
this.username = username;
|
|
100
|
-
this.memberships = memberships;
|
|
101
|
-
this.instructionProviders = instructionProviders;
|
|
102
|
-
this.accounts = accounts;
|
|
103
|
-
this.tokens = tokens;
|
|
104
|
-
this.topics = topics;
|
|
105
|
-
this.language = language;
|
|
106
|
-
this.displayName = displayName;
|
|
107
|
-
}
|
|
108
|
-
static fromDto(dto) {
|
|
109
|
-
return new VasFireUserModel(dto.id || '', dto.created || '', dto.serverCreated || '', dto.createdBy || '', dto.modified || '', dto.serverModified || '', dto.modifiedBy || '', dto.createdByName || '', dto.modifiedByName || '', dto.email || '', dto.name || '', dto.username || '', dto.memberships || [], dto.instructionProviders || [], dto.accounts || {}, dto.tokens || [], dto.topics || [], dto.language || '', dto.displayName || '');
|
|
110
|
-
}
|
|
111
|
-
static newUser(uid, displayName, email) {
|
|
112
|
-
return new VasFireUserModel(uid, moment().toISOString(), moment().toISOString(), uid, moment().toISOString(), moment().toISOString(), uid, '', '', email, displayName, email, [], [], {}, [], [], '', displayName);
|
|
113
|
-
}
|
|
114
|
-
toDto() {
|
|
115
|
-
return {
|
|
116
|
-
id: this.id,
|
|
117
|
-
created: this.created,
|
|
118
|
-
serverCreated: this.serverCreated,
|
|
119
|
-
createdBy: this.createdBy,
|
|
120
|
-
modified: this.modified,
|
|
121
|
-
serverModified: this.serverModified,
|
|
122
|
-
modifiedBy: this.modifiedBy,
|
|
123
|
-
createdByName: this.createdByName,
|
|
124
|
-
modifiedByName: this.modifiedByName,
|
|
125
|
-
email: this.email,
|
|
126
|
-
name: this.name,
|
|
127
|
-
username: this.username,
|
|
128
|
-
memberships: this.memberships,
|
|
129
|
-
instructionProviders: this.instructionProviders,
|
|
130
|
-
accounts: this.accounts,
|
|
131
|
-
tokens: this.tokens,
|
|
132
|
-
topics: this.topics,
|
|
133
|
-
language: this.language,
|
|
134
|
-
displayName: this.displayName
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
/**
|
|
138
|
-
* Adds token to tokens list if it is not already present
|
|
139
|
-
* @param token the new token
|
|
140
|
-
*/
|
|
141
|
-
addToken(token) {
|
|
142
|
-
if (this.tokens.includes(token)) {
|
|
143
|
-
return;
|
|
144
|
-
}
|
|
145
|
-
this.tokens.push(token);
|
|
146
|
-
}
|
|
147
|
-
/**
|
|
148
|
-
* Remove token from tokens list
|
|
149
|
-
* @param token the token to remove
|
|
150
|
-
*/
|
|
151
|
-
removeToken(token) {
|
|
152
|
-
this.tokens = this.tokens.filter(t => t !== token);
|
|
153
|
-
}
|
|
154
|
-
/**
|
|
155
|
-
* Resets the tokens list
|
|
156
|
-
*/
|
|
157
|
-
resetTokens() {
|
|
158
|
-
this.tokens = [];
|
|
159
|
-
}
|
|
160
|
-
/**
|
|
161
|
-
* Adds topic to topics list if it is not already present
|
|
162
|
-
* @param topic the new token
|
|
163
|
-
*/
|
|
164
|
-
addTopic(topic) {
|
|
165
|
-
if (this.topics.includes(topic)) {
|
|
166
|
-
return;
|
|
167
|
-
}
|
|
168
|
-
this.topics.push(topic);
|
|
169
|
-
}
|
|
170
|
-
/**
|
|
171
|
-
* Remove topic from topic list
|
|
172
|
-
* @param topic the topic to remove
|
|
173
|
-
*/
|
|
174
|
-
removeTopic(topic) {
|
|
175
|
-
this.topics = this.topics.filter(t => t !== topic);
|
|
176
|
-
}
|
|
177
|
-
/**
|
|
178
|
-
* Resets the topic list
|
|
179
|
-
*/
|
|
180
|
-
resetTopics() {
|
|
181
|
-
this.topics = [];
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
var VasAccountIndexingMode;
|
|
186
|
-
(function (VasAccountIndexingMode) {
|
|
187
|
-
VasAccountIndexingMode[VasAccountIndexingMode["DISABLED"] = 0] = "DISABLED";
|
|
188
|
-
VasAccountIndexingMode[VasAccountIndexingMode["ON_CHANGE"] = 1] = "ON_CHANGE";
|
|
189
|
-
VasAccountIndexingMode[VasAccountIndexingMode["ON_REPORT"] = 2] = "ON_REPORT";
|
|
190
|
-
})(VasAccountIndexingMode || (VasAccountIndexingMode = {}));
|
|
191
|
-
|
|
192
|
-
class VasAccountObjectModel extends VasBaseModel {
|
|
193
|
-
constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account) {
|
|
194
|
-
super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName);
|
|
195
|
-
this.id = id;
|
|
196
|
-
this.created = created;
|
|
197
|
-
this.serverCreated = serverCreated;
|
|
198
|
-
this.createdBy = createdBy;
|
|
199
|
-
this.modified = modified;
|
|
200
|
-
this.serverModified = serverModified;
|
|
201
|
-
this.modifiedBy = modifiedBy;
|
|
202
|
-
this.createdByName = createdByName;
|
|
203
|
-
this.modifiedByName = modifiedByName;
|
|
204
|
-
this.account = account;
|
|
205
|
-
}
|
|
206
|
-
toApiDto(options) {
|
|
207
|
-
return {
|
|
208
|
-
id: this.id,
|
|
209
|
-
created: this.created,
|
|
210
|
-
modified: this.modified
|
|
211
|
-
};
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
class VasRestrictedAccountObjectModel extends VasAccountObjectModel {
|
|
216
|
-
constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account, accessGroup) {
|
|
217
|
-
super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account);
|
|
218
|
-
this.id = id;
|
|
219
|
-
this.created = created;
|
|
220
|
-
this.serverCreated = serverCreated;
|
|
221
|
-
this.createdBy = createdBy;
|
|
222
|
-
this.modified = modified;
|
|
223
|
-
this.serverModified = serverModified;
|
|
224
|
-
this.modifiedBy = modifiedBy;
|
|
225
|
-
this.createdByName = createdByName;
|
|
226
|
-
this.modifiedByName = modifiedByName;
|
|
227
|
-
this.account = account;
|
|
228
|
-
this.accessGroup = accessGroup;
|
|
229
|
-
}
|
|
230
|
-
toApiDto(options) {
|
|
231
|
-
return Object.assign(Object.assign({}, super.toApiDto(options)), { accessGroup: this.accessGroup });
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
class VasBranchModel extends VasRestrictedAccountObjectModel {
|
|
236
|
-
constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account, accessGroup, branchType, storeCode, address, city, postcode, email, locationManager, areaManager, regionalDirector, salesManager, cluster, hourWeekdays, hourSaturday, hourSunday, exceptions, active) {
|
|
237
|
-
super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account, accessGroup);
|
|
238
|
-
this.id = id;
|
|
239
|
-
this.created = created;
|
|
240
|
-
this.serverCreated = serverCreated;
|
|
241
|
-
this.createdBy = createdBy;
|
|
242
|
-
this.modified = modified;
|
|
243
|
-
this.serverModified = serverModified;
|
|
244
|
-
this.modifiedBy = modifiedBy;
|
|
245
|
-
this.createdByName = createdByName;
|
|
246
|
-
this.modifiedByName = modifiedByName;
|
|
247
|
-
this.account = account;
|
|
248
|
-
this.accessGroup = accessGroup;
|
|
249
|
-
this.branchType = branchType;
|
|
250
|
-
this.storeCode = storeCode;
|
|
251
|
-
this.address = address;
|
|
252
|
-
this.city = city;
|
|
253
|
-
this.postcode = postcode;
|
|
254
|
-
this.email = email;
|
|
255
|
-
this.locationManager = locationManager;
|
|
256
|
-
this.areaManager = areaManager;
|
|
257
|
-
this.regionalDirector = regionalDirector;
|
|
258
|
-
this.salesManager = salesManager;
|
|
259
|
-
this.cluster = cluster;
|
|
260
|
-
this.hourWeekdays = hourWeekdays;
|
|
261
|
-
this.hourSaturday = hourSaturday;
|
|
262
|
-
this.hourSunday = hourSunday;
|
|
263
|
-
this.exceptions = exceptions;
|
|
264
|
-
this.active = active;
|
|
265
|
-
}
|
|
266
|
-
static fromDto(dto) {
|
|
267
|
-
return new VasBranchModel(dto.id || '', dto.created || '', dto.serverCreated || '', dto.createdBy || '', dto.modified || '', dto.serverModified || '', dto.modifiedBy || '', dto.createdByName || '', dto.modifiedByName || '', dto.account || '', dto.accessGroup || '', dto.branchType || '', dto.storeCode || '', dto.address || '', dto.city || '', dto.postcode || '', dto.email || '', dto.locationManager || undefined, dto.areaManager || undefined, dto.regionalDirector || undefined, dto.salesManager || undefined, dto.cluster || '', dto.hourWeekdays || [], dto.hourSaturday || [], dto.hourSunday || [], dto.exceptions || '', dto.active || true);
|
|
268
|
-
}
|
|
269
|
-
toDto() {
|
|
270
|
-
return {
|
|
271
|
-
id: this.id,
|
|
272
|
-
created: this.created,
|
|
273
|
-
serverCreated: this.serverCreated,
|
|
274
|
-
createdBy: this.createdBy,
|
|
275
|
-
modified: this.modified,
|
|
276
|
-
serverModified: this.serverModified,
|
|
277
|
-
modifiedBy: this.modifiedBy,
|
|
278
|
-
createdByName: this.createdByName,
|
|
279
|
-
modifiedByName: this.modifiedByName,
|
|
280
|
-
account: this.account,
|
|
281
|
-
accessGroup: this.accessGroup,
|
|
282
|
-
branchType: this.branchType,
|
|
283
|
-
storeCode: this.storeCode,
|
|
284
|
-
address: this.address,
|
|
285
|
-
city: this.city,
|
|
286
|
-
postcode: this.postcode,
|
|
287
|
-
email: this.email,
|
|
288
|
-
locationManager: this.locationManager,
|
|
289
|
-
areaManager: this.areaManager,
|
|
290
|
-
regionalDirector: this.regionalDirector,
|
|
291
|
-
salesManager: this.salesManager,
|
|
292
|
-
cluster: this.cluster,
|
|
293
|
-
hourWeekdays: this.hourWeekdays,
|
|
294
|
-
hourSaturday: this.hourSaturday,
|
|
295
|
-
hourSunday: this.hourSunday,
|
|
296
|
-
exceptions: this.exceptions,
|
|
297
|
-
active: this.active
|
|
298
|
-
};
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
class VasContactModel extends VasRestrictedAccountObjectModel {
|
|
303
|
-
constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account, accessGroup, contactType, name, email, mobile, phone, address, address2, address3, billingCode, business, fax, vatNumber, website) {
|
|
304
|
-
super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account, accessGroup);
|
|
305
|
-
this.id = id;
|
|
306
|
-
this.created = created;
|
|
307
|
-
this.serverCreated = serverCreated;
|
|
308
|
-
this.createdBy = createdBy;
|
|
309
|
-
this.modified = modified;
|
|
310
|
-
this.serverModified = serverModified;
|
|
311
|
-
this.modifiedBy = modifiedBy;
|
|
312
|
-
this.createdByName = createdByName;
|
|
313
|
-
this.modifiedByName = modifiedByName;
|
|
314
|
-
this.account = account;
|
|
315
|
-
this.accessGroup = accessGroup;
|
|
316
|
-
this.contactType = contactType;
|
|
317
|
-
this.name = name;
|
|
318
|
-
this.email = email;
|
|
319
|
-
this.mobile = mobile;
|
|
320
|
-
this.phone = phone;
|
|
321
|
-
this.address = address;
|
|
322
|
-
this.address2 = address2;
|
|
323
|
-
this.address3 = address3;
|
|
324
|
-
this.billingCode = billingCode;
|
|
325
|
-
this.business = business;
|
|
326
|
-
this.fax = fax;
|
|
327
|
-
this.vatNumber = vatNumber;
|
|
328
|
-
this.website = website;
|
|
329
|
-
}
|
|
330
|
-
static fromDto(dto) {
|
|
331
|
-
return new VasContactModel(dto.id || '', dto.created || '', dto.serverCreated || '', dto.createdBy || '', dto.modified || '', dto.serverModified || '', dto.modifiedBy || '', dto.createdByName || '', dto.modifiedByName || '', dto.account || '', dto.accessGroup || '', dto.contactType || '', dto.name || '', dto.email || '', dto.mobile || '', dto.phone || '', dto.address || '', dto.address2 || '', dto.address3 || '', dto.billingCode || '', dto.business || '', dto.fax || '', dto.vatNumber || '', dto.website || '');
|
|
332
|
-
}
|
|
333
|
-
toDto() {
|
|
334
|
-
return {
|
|
335
|
-
id: this.id,
|
|
336
|
-
created: this.created,
|
|
337
|
-
serverCreated: this.serverCreated,
|
|
338
|
-
createdBy: this.createdBy,
|
|
339
|
-
modified: this.modified,
|
|
340
|
-
serverModified: this.serverModified,
|
|
341
|
-
modifiedBy: this.modifiedBy,
|
|
342
|
-
createdByName: this.createdByName,
|
|
343
|
-
modifiedByName: this.modifiedByName,
|
|
344
|
-
account: this.account,
|
|
345
|
-
accessGroup: this.accessGroup,
|
|
346
|
-
contactType: this.contactType,
|
|
347
|
-
name: this.name,
|
|
348
|
-
email: this.email,
|
|
349
|
-
mobile: this.mobile,
|
|
350
|
-
phone: this.phone,
|
|
351
|
-
address: this.address,
|
|
352
|
-
address2: this.address2,
|
|
353
|
-
address3: this.address3,
|
|
354
|
-
billingCode: this.billingCode,
|
|
355
|
-
business: this.business,
|
|
356
|
-
fax: this.fax,
|
|
357
|
-
vatNumber: this.vatNumber,
|
|
358
|
-
website: this.website,
|
|
359
|
-
};
|
|
360
|
-
}
|
|
361
|
-
toApiDto(options) {
|
|
362
|
-
return Object.assign(Object.assign({}, super.toApiDto()), { id: this.id, created: this.created || '~', modified: this.modified || '~', accessGroup: this.accessGroup || '~', contactType: this.contactType || '~', name: this.name || '~', email: this.email || '~', mobile: this.mobile || '~', phone: this.phone || '~', address: this.address || '~', address2: this.address2 || '~', address3: this.address3 || '~', billingCode: this.billingCode || '~', business: this.business || '~', fax: this.fax || '~', vatNumber: this.vatNumber || '~', website: this.website || '~' });
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
/**
|
|
367
|
-
* VasControlTypeModel
|
|
368
|
-
*/
|
|
369
|
-
class VasControlTypeModel extends VasBaseModel {
|
|
370
|
-
constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, name) {
|
|
371
|
-
super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName);
|
|
372
|
-
this.id = id;
|
|
373
|
-
this.created = created;
|
|
374
|
-
this.serverCreated = serverCreated;
|
|
375
|
-
this.createdBy = createdBy;
|
|
376
|
-
this.modified = modified;
|
|
377
|
-
this.serverModified = serverModified;
|
|
378
|
-
this.modifiedBy = modifiedBy;
|
|
379
|
-
this.createdByName = createdByName;
|
|
380
|
-
this.modifiedByName = modifiedByName;
|
|
381
|
-
this.name = name;
|
|
382
|
-
}
|
|
383
|
-
/**
|
|
384
|
-
* @return VasControlTypeModel
|
|
385
|
-
*/
|
|
386
|
-
static empty() {
|
|
387
|
-
return new VasControlTypeModel('', '', '', '', '', '', '', '', '', '');
|
|
388
|
-
}
|
|
389
|
-
/**
|
|
390
|
-
* @param {VasControlTypeDto} dto
|
|
391
|
-
* @return {VasControlTypeModel}
|
|
392
|
-
*/
|
|
393
|
-
static fromDto(dto) {
|
|
394
|
-
return new VasControlTypeModel(
|
|
395
|
-
// eslint-disable-next-line new-cap
|
|
396
|
-
dto.id || '', dto.created || '', dto.serverCreated || '', dto.createdBy || '', dto.modified || '', dto.serverModified || '', dto.modifiedBy || '', dto.createdByName || '', dto.modifiedByName || '', dto.name || '');
|
|
397
|
-
}
|
|
398
|
-
/**
|
|
399
|
-
* @return {VasControlTypeDto}
|
|
400
|
-
*/
|
|
401
|
-
toDto() {
|
|
402
|
-
return {
|
|
403
|
-
id: this.id,
|
|
404
|
-
created: this.created,
|
|
405
|
-
serverCreated: this.serverCreated,
|
|
406
|
-
createdBy: this.createdBy,
|
|
407
|
-
modified: this.modified,
|
|
408
|
-
serverModified: this.serverModified,
|
|
409
|
-
modifiedBy: this.modifiedBy,
|
|
410
|
-
createdByName: this.createdByName,
|
|
411
|
-
modifiedByName: this.modifiedByName,
|
|
412
|
-
name: this.name
|
|
413
|
-
};
|
|
414
|
-
}
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
/**
|
|
418
|
-
* ControlModel
|
|
419
|
-
*/
|
|
420
|
-
class VasControlModel extends VasRestrictedAccountObjectModel {
|
|
421
|
-
constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account, accessGroup, controlType, group, validators, name, title, linkable, sequence, description, defaultValue, config, descriptionImage, portalEnabled) {
|
|
422
|
-
super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account, accessGroup);
|
|
423
|
-
this.id = id;
|
|
424
|
-
this.created = created;
|
|
425
|
-
this.serverCreated = serverCreated;
|
|
426
|
-
this.createdBy = createdBy;
|
|
427
|
-
this.modified = modified;
|
|
428
|
-
this.serverModified = serverModified;
|
|
429
|
-
this.modifiedBy = modifiedBy;
|
|
430
|
-
this.createdByName = createdByName;
|
|
431
|
-
this.modifiedByName = modifiedByName;
|
|
432
|
-
this.account = account;
|
|
433
|
-
this.accessGroup = accessGroup;
|
|
434
|
-
this.controlType = controlType;
|
|
435
|
-
this.group = group;
|
|
436
|
-
this.validators = validators;
|
|
437
|
-
this.name = name;
|
|
438
|
-
this.title = title;
|
|
439
|
-
this.linkable = linkable;
|
|
440
|
-
this.sequence = sequence;
|
|
441
|
-
this.description = description;
|
|
442
|
-
this.defaultValue = defaultValue;
|
|
443
|
-
this.config = config;
|
|
444
|
-
this.descriptionImage = descriptionImage;
|
|
445
|
-
this.portalEnabled = portalEnabled;
|
|
446
|
-
this.controlTypeId = '';
|
|
447
|
-
if (typeof controlType === 'string') {
|
|
448
|
-
this.controlTypeId = controlType;
|
|
449
|
-
}
|
|
450
|
-
else {
|
|
451
|
-
this.controlTypeId = controlType.id;
|
|
452
|
-
}
|
|
453
|
-
}
|
|
454
|
-
get controlTypeName() {
|
|
455
|
-
var _a;
|
|
456
|
-
return ((_a = this.controlType) === null || _a === void 0 ? void 0 : _a.name) || '';
|
|
457
|
-
}
|
|
458
|
-
/**
|
|
459
|
-
* The defaultValue property is returned from the api as a string or number,
|
|
460
|
-
* in the case of string, it maybe a json. This getter will return an
|
|
461
|
-
* object if the value is a json string
|
|
462
|
-
*/
|
|
463
|
-
get defaultValueDecoded() {
|
|
464
|
-
if (this.defaultValue === '' && this.controlType) {
|
|
465
|
-
switch (this.controlTypeName) {
|
|
466
|
-
case 'branch':
|
|
467
|
-
case 'camera':
|
|
468
|
-
case 'contact': {
|
|
469
|
-
return {};
|
|
470
|
-
}
|
|
471
|
-
case 'toggle': {
|
|
472
|
-
return {
|
|
473
|
-
checked: false, comment: ''
|
|
474
|
-
};
|
|
475
|
-
}
|
|
476
|
-
}
|
|
477
|
-
}
|
|
478
|
-
return this.parseMaybeJson(this.defaultValue);
|
|
479
|
-
}
|
|
480
|
-
/**
|
|
481
|
-
* Returns the name of this control to be used in the report templates
|
|
482
|
-
* i.e. fields.foo -> foo
|
|
483
|
-
* @return {string}
|
|
484
|
-
*/
|
|
485
|
-
get reportTemplateName() {
|
|
486
|
-
return this.name.replace(/^fields\./, '');
|
|
487
|
-
}
|
|
488
|
-
/**
|
|
489
|
-
* @return {string}
|
|
490
|
-
*/
|
|
491
|
-
get safeName() {
|
|
492
|
-
return this.name;
|
|
493
|
-
}
|
|
494
|
-
/**
|
|
495
|
-
* @return {VasControlModel}
|
|
496
|
-
*/
|
|
497
|
-
static empty() {
|
|
498
|
-
return VasControlModel.fromDto({
|
|
499
|
-
// eslint-disable-next-line new-cap
|
|
500
|
-
id: UUID.UUID()
|
|
501
|
-
});
|
|
502
|
-
}
|
|
503
|
-
/**
|
|
504
|
-
* @param {VasControlDto} dto
|
|
505
|
-
* @return {VasControlModel}
|
|
506
|
-
*/
|
|
507
|
-
static fromDto(dto) {
|
|
508
|
-
const handleControlType = (c) => {
|
|
509
|
-
if (c === undefined) {
|
|
510
|
-
return VasControlTypeModel.empty();
|
|
511
|
-
}
|
|
512
|
-
else if (typeof c === 'string') {
|
|
513
|
-
return VasControlTypeModel.fromDto({ id: c });
|
|
514
|
-
}
|
|
515
|
-
else {
|
|
516
|
-
return VasControlTypeModel.fromDto(c);
|
|
517
|
-
}
|
|
518
|
-
};
|
|
519
|
-
return new VasControlModel(
|
|
520
|
-
// eslint-disable-next-line new-cap
|
|
521
|
-
dto.id || '', dto.created || '', dto.serverCreated || '', dto.createdBy || '', dto.modified || '', dto.serverModified || '', dto.modifiedBy || '', dto.createdByName || '', dto.modifiedByName || '', dto.account || '', dto.accessGroup || '', handleControlType(dto.controlType), dto.group || '', dto.validators || [], dto.name || '', dto.title || '', dto.linkable || false, dto.sequence || 0, dto.description || '', dto.defaultValue || '', JSON.parse(dto.config || '{}'), dto.descriptionImage || '', dto.portalEnabled || false);
|
|
522
|
-
}
|
|
523
|
-
/**
|
|
524
|
-
* @param {string} value
|
|
525
|
-
* @return {VasControlModelDefaultValueType}
|
|
526
|
-
*/
|
|
527
|
-
parseMaybeJson(value) {
|
|
528
|
-
if (typeof value !== 'string') {
|
|
529
|
-
return value;
|
|
530
|
-
}
|
|
531
|
-
try {
|
|
532
|
-
return JSON.parse(value);
|
|
533
|
-
}
|
|
534
|
-
catch (e) {
|
|
535
|
-
return value;
|
|
536
|
-
}
|
|
537
|
-
}
|
|
538
|
-
/**
|
|
539
|
-
* @return {VasControlDto}
|
|
540
|
-
*/
|
|
541
|
-
toDto() {
|
|
542
|
-
return {
|
|
543
|
-
id: this.id,
|
|
544
|
-
created: this.created,
|
|
545
|
-
serverCreated: this.serverCreated,
|
|
546
|
-
createdBy: this.createdBy,
|
|
547
|
-
modified: this.modified,
|
|
548
|
-
serverModified: this.serverModified,
|
|
549
|
-
modifiedBy: this.modifiedBy,
|
|
550
|
-
createdByName: this.createdByName,
|
|
551
|
-
modifiedByName: this.modifiedByName,
|
|
552
|
-
account: this.account,
|
|
553
|
-
accessGroup: this.accessGroup,
|
|
554
|
-
controlType: this.controlType.toDto(),
|
|
555
|
-
group: this.group,
|
|
556
|
-
validators: this.validators,
|
|
557
|
-
name: this.name,
|
|
558
|
-
title: this.title,
|
|
559
|
-
linkable: this.linkable,
|
|
560
|
-
sequence: this.sequence,
|
|
561
|
-
description: this.description,
|
|
562
|
-
defaultValue: this.defaultValue,
|
|
563
|
-
config: JSON.stringify(this.config),
|
|
564
|
-
descriptionImage: this.descriptionImage,
|
|
565
|
-
portalEnabled: this.portalEnabled
|
|
566
|
-
};
|
|
567
|
-
}
|
|
568
|
-
toApiDto(options) {
|
|
569
|
-
return Object.assign(Object.assign({}, super.toApiDto()), { title: this.title || '~', name: this.name || '~', portalEnabled: this.portalEnabled, sequence: this.sequence, description: this.description || '~', defaultValue: this.defaultValue, config: JSON.stringify(this.config), controlType: this.controlType.id, group: this.group, validators: this.validators, linkable: this.linkable });
|
|
570
|
-
}
|
|
571
|
-
}
|
|
572
|
-
|
|
573
|
-
/**
|
|
574
|
-
* VasJobDataModel
|
|
575
|
-
*/
|
|
576
|
-
class VasJobDataModel extends VasAccountObjectModel {
|
|
577
|
-
constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account, job) {
|
|
578
|
-
super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account);
|
|
579
|
-
this.id = id;
|
|
580
|
-
this.created = created;
|
|
581
|
-
this.serverCreated = serverCreated;
|
|
582
|
-
this.createdBy = createdBy;
|
|
583
|
-
this.modified = modified;
|
|
584
|
-
this.serverModified = serverModified;
|
|
585
|
-
this.modifiedBy = modifiedBy;
|
|
586
|
-
this.createdByName = createdByName;
|
|
587
|
-
this.modifiedByName = modifiedByName;
|
|
588
|
-
this.account = account;
|
|
589
|
-
this.job = job;
|
|
590
|
-
}
|
|
591
|
-
}
|
|
592
|
-
|
|
593
|
-
/**
|
|
594
|
-
* VasFieldModel
|
|
595
|
-
*/
|
|
596
|
-
class VasFieldModel extends VasJobDataModel {
|
|
597
|
-
constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account, job, control, fieldJobPointers, value, version, controlName, controlTitle, controlTypeName) {
|
|
598
|
-
super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account, job);
|
|
599
|
-
this.id = id;
|
|
600
|
-
this.created = created;
|
|
601
|
-
this.serverCreated = serverCreated;
|
|
602
|
-
this.createdBy = createdBy;
|
|
603
|
-
this.modified = modified;
|
|
604
|
-
this.serverModified = serverModified;
|
|
605
|
-
this.modifiedBy = modifiedBy;
|
|
606
|
-
this.createdByName = createdByName;
|
|
607
|
-
this.modifiedByName = modifiedByName;
|
|
608
|
-
this.account = account;
|
|
609
|
-
this.job = job;
|
|
610
|
-
this.control = control;
|
|
611
|
-
this.fieldJobPointers = fieldJobPointers;
|
|
612
|
-
this.value = value;
|
|
613
|
-
this.version = version;
|
|
614
|
-
this.controlName = controlName;
|
|
615
|
-
this.controlTitle = controlTitle;
|
|
616
|
-
this.controlTypeName = controlTypeName;
|
|
617
|
-
}
|
|
618
|
-
/**
|
|
619
|
-
* @param {VasFieldDto} fieldDto
|
|
620
|
-
* @return {VasFieldModel}
|
|
621
|
-
*/
|
|
622
|
-
static fromDto(fieldDto) {
|
|
623
|
-
return new VasFieldModel(fieldDto.id || '', fieldDto.created || '', fieldDto.serverCreated || '', fieldDto.createdBy || '', fieldDto.modified || '', fieldDto.serverModified || '', fieldDto.modifiedBy || '', fieldDto.createdByName || '', fieldDto.modifiedByName || '', fieldDto.account || '', fieldDto.job || '', fieldDto.control || '', fieldDto.fieldJobPointers || [], fieldDto.value || '', fieldDto.version || 0, fieldDto.controlName || '', fieldDto.controlTitle || '', fieldDto.controlTypeName || '');
|
|
624
|
-
}
|
|
625
|
-
/**
|
|
626
|
-
* @return {VasFieldDto}
|
|
627
|
-
*/
|
|
628
|
-
toDto() {
|
|
629
|
-
return {
|
|
630
|
-
id: this.id,
|
|
631
|
-
created: this.created,
|
|
632
|
-
serverCreated: this.serverCreated,
|
|
633
|
-
createdBy: this.createdBy,
|
|
634
|
-
modified: this.modified,
|
|
635
|
-
serverModified: this.serverModified,
|
|
636
|
-
modifiedBy: this.modifiedBy,
|
|
637
|
-
createdByName: this.createdByName,
|
|
638
|
-
modifiedByName: this.modifiedByName,
|
|
639
|
-
account: this.account,
|
|
640
|
-
job: this.job,
|
|
641
|
-
control: this.control,
|
|
642
|
-
fieldJobPointers: this.fieldJobPointers,
|
|
643
|
-
value: this.value,
|
|
644
|
-
version: this.version,
|
|
645
|
-
controlName: this.controlName,
|
|
646
|
-
controlTitle: this.controlTitle,
|
|
647
|
-
controlTypeName: this.controlTypeName,
|
|
648
|
-
};
|
|
649
|
-
}
|
|
650
|
-
/**
|
|
651
|
-
* @return {object}
|
|
652
|
-
*/
|
|
653
|
-
toApiDto() {
|
|
654
|
-
return Object.assign(Object.assign({}, super.toApiDto()), { control: this.control, value: this.prepareApiValue(this.value) });
|
|
655
|
-
}
|
|
656
|
-
/**
|
|
657
|
-
* Prepares the value to be sent to the API. The api will only accept strings,
|
|
658
|
-
* numbers and booleans, thus if we have an array or object, we need to JSON
|
|
659
|
-
* encode it
|
|
660
|
-
* @param {VasFieldDto} value
|
|
661
|
-
* @return {string | number | boolean}
|
|
662
|
-
* @protected
|
|
663
|
-
*/
|
|
664
|
-
prepareApiValue(value) {
|
|
665
|
-
switch (typeof value) {
|
|
666
|
-
case 'object': {
|
|
667
|
-
return JSON.stringify(value);
|
|
668
|
-
}
|
|
669
|
-
case 'boolean': {
|
|
670
|
-
return value;
|
|
671
|
-
}
|
|
672
|
-
case 'string': {
|
|
673
|
-
return value;
|
|
674
|
-
}
|
|
675
|
-
case 'number': {
|
|
676
|
-
return value;
|
|
677
|
-
}
|
|
678
|
-
default: {
|
|
679
|
-
return '';
|
|
680
|
-
}
|
|
681
|
-
}
|
|
682
|
-
}
|
|
683
|
-
}
|
|
684
|
-
|
|
685
|
-
function isFileDto(object) {
|
|
686
|
-
return object instanceof Object
|
|
687
|
-
&& 'url' in object
|
|
688
|
-
&& 'uri' in object
|
|
689
|
-
&& 'message' in object
|
|
690
|
-
&& 'status' in object
|
|
691
|
-
&& 'controlPath' in object;
|
|
692
|
-
}
|
|
693
|
-
|
|
694
|
-
/**
|
|
695
|
-
* VasFileDto
|
|
696
|
-
*/
|
|
697
|
-
class VasFileModel extends VasJobDataModel {
|
|
698
|
-
constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account, job, name, fileSize, mimeType, sequence, config, url, controlPath, message, status, uri) {
|
|
699
|
-
super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account, job);
|
|
700
|
-
this.id = id;
|
|
701
|
-
this.created = created;
|
|
702
|
-
this.serverCreated = serverCreated;
|
|
703
|
-
this.createdBy = createdBy;
|
|
704
|
-
this.modified = modified;
|
|
705
|
-
this.serverModified = serverModified;
|
|
706
|
-
this.modifiedBy = modifiedBy;
|
|
707
|
-
this.createdByName = createdByName;
|
|
708
|
-
this.modifiedByName = modifiedByName;
|
|
709
|
-
this.account = account;
|
|
710
|
-
this.job = job;
|
|
711
|
-
this.name = name;
|
|
712
|
-
this.fileSize = fileSize;
|
|
713
|
-
this.mimeType = mimeType;
|
|
714
|
-
this.sequence = sequence;
|
|
715
|
-
this.config = config;
|
|
716
|
-
this.url = url;
|
|
717
|
-
this.controlPath = controlPath;
|
|
718
|
-
this.message = message;
|
|
719
|
-
this.status = status;
|
|
720
|
-
this.uri = uri;
|
|
721
|
-
}
|
|
722
|
-
static empty() {
|
|
723
|
-
return new VasFileModel('', '', '', '', '', '', '', '', '', '', '', '', 0, '', 0, {
|
|
724
|
-
displayAs: 'grid',
|
|
725
|
-
embedLink: false,
|
|
726
|
-
group: 'photo',
|
|
727
|
-
description: '',
|
|
728
|
-
displayedName: '',
|
|
729
|
-
rotation: 0
|
|
730
|
-
}, '', '', '', 'NEW', '');
|
|
731
|
-
}
|
|
732
|
-
static fromDto(dto) {
|
|
733
|
-
return new VasFileModel(dto.id || '', dto.created || '', dto.serverCreated || '', dto.createdBy || '', dto.modified || '', dto.serverModified || '', dto.modifiedBy || '', dto.createdByName || '', dto.modifiedByName || '', dto.account || '', dto.job || '', dto.name || '', dto.fileSize || 0, dto.mimeType || '', dto.sequence || 0, VasFileModel.parseConfig(dto.config), dto.url || '', dto.controlPath || '', dto.message || '', dto.status || 'NEW', dto.uri || '');
|
|
734
|
-
}
|
|
735
|
-
static parseConfig(config = '') {
|
|
736
|
-
try {
|
|
737
|
-
return JSON.parse(config);
|
|
738
|
-
}
|
|
739
|
-
catch (e) {
|
|
740
|
-
return {
|
|
741
|
-
displayAs: 'grid',
|
|
742
|
-
embedLink: false,
|
|
743
|
-
group: 'photo',
|
|
744
|
-
description: '',
|
|
745
|
-
displayedName: '',
|
|
746
|
-
rotation: 0
|
|
747
|
-
};
|
|
748
|
-
}
|
|
749
|
-
}
|
|
750
|
-
/**
|
|
751
|
-
* @return {VasFileDto}
|
|
752
|
-
*/
|
|
753
|
-
toDto() {
|
|
754
|
-
return {
|
|
755
|
-
id: this.id,
|
|
756
|
-
created: this.created,
|
|
757
|
-
serverCreated: this.serverCreated,
|
|
758
|
-
createdBy: this.createdBy,
|
|
759
|
-
modified: this.modified,
|
|
760
|
-
serverModified: this.serverModified,
|
|
761
|
-
modifiedBy: this.modifiedBy,
|
|
762
|
-
createdByName: this.createdByName,
|
|
763
|
-
modifiedByName: this.modifiedByName,
|
|
764
|
-
account: this.account,
|
|
765
|
-
job: this.job,
|
|
766
|
-
name: this.name,
|
|
767
|
-
fileSize: this.fileSize,
|
|
768
|
-
mimeType: this.mimeType,
|
|
769
|
-
sequence: this.sequence,
|
|
770
|
-
config: this.stringifyConfig(this.config),
|
|
771
|
-
url: this.url,
|
|
772
|
-
controlPath: this.controlPath,
|
|
773
|
-
message: this.message,
|
|
774
|
-
status: this.status,
|
|
775
|
-
uri: this.uri,
|
|
776
|
-
};
|
|
777
|
-
}
|
|
778
|
-
stringifyConfig(config) {
|
|
779
|
-
if (!config) {
|
|
780
|
-
return JSON.stringify({
|
|
781
|
-
displayAs: 'grid',
|
|
782
|
-
embedLink: false,
|
|
783
|
-
group: 'photo',
|
|
784
|
-
description: '',
|
|
785
|
-
displayedName: '',
|
|
786
|
-
rotation: 0
|
|
787
|
-
});
|
|
788
|
-
}
|
|
789
|
-
try {
|
|
790
|
-
return JSON.stringify(config);
|
|
791
|
-
}
|
|
792
|
-
catch (e) {
|
|
793
|
-
console.warn(e);
|
|
794
|
-
return '';
|
|
795
|
-
}
|
|
796
|
-
}
|
|
797
|
-
toApiDto(options = { contentUploaded: false }) {
|
|
798
|
-
const apiDto = Object.assign(Object.assign({}, super.toApiDto()), { name: this.name || '~', mimeType: this.mimeType || '~', sequence: this.safeNumber(this.sequence), config: JSON.stringify(this.config) });
|
|
799
|
-
if (options.contentUploaded) {
|
|
800
|
-
apiDto['original'] = this.id;
|
|
801
|
-
}
|
|
802
|
-
return apiDto;
|
|
803
|
-
}
|
|
804
|
-
safeNumber(value) {
|
|
805
|
-
if (!Number.isFinite(value)) {
|
|
806
|
-
return 0;
|
|
807
|
-
}
|
|
808
|
-
return value;
|
|
809
|
-
}
|
|
810
|
-
}
|
|
811
|
-
|
|
812
|
-
/**
|
|
813
|
-
* GroupModel
|
|
814
|
-
*/
|
|
815
|
-
class VasGroupModel extends VasRestrictedAccountObjectModel {
|
|
816
|
-
constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account, accessGroup, name, title, description, sequence, includeInSummary, forms, visibilityControl, visibleIfEquals, controls, scoreWeight) {
|
|
817
|
-
super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account, accessGroup);
|
|
818
|
-
this.id = id;
|
|
819
|
-
this.created = created;
|
|
820
|
-
this.serverCreated = serverCreated;
|
|
821
|
-
this.createdBy = createdBy;
|
|
822
|
-
this.modified = modified;
|
|
823
|
-
this.serverModified = serverModified;
|
|
824
|
-
this.modifiedBy = modifiedBy;
|
|
825
|
-
this.createdByName = createdByName;
|
|
826
|
-
this.modifiedByName = modifiedByName;
|
|
827
|
-
this.account = account;
|
|
828
|
-
this.accessGroup = accessGroup;
|
|
829
|
-
this.name = name;
|
|
830
|
-
this.title = title;
|
|
831
|
-
this.description = description;
|
|
832
|
-
this.sequence = sequence;
|
|
833
|
-
this.includeInSummary = includeInSummary;
|
|
834
|
-
this.forms = forms;
|
|
835
|
-
this.visibilityControl = visibilityControl;
|
|
836
|
-
this.visibleIfEquals = visibleIfEquals;
|
|
837
|
-
this.controls = controls;
|
|
838
|
-
this.scoreWeight = scoreWeight;
|
|
839
|
-
}
|
|
840
|
-
/**
|
|
841
|
-
* @param {VasGroupDto} dto
|
|
842
|
-
* @return {VasGroupModel}
|
|
843
|
-
*/
|
|
844
|
-
static fromDto(dto) {
|
|
845
|
-
return new VasGroupModel(
|
|
846
|
-
// eslint-disable-next-line new-cap
|
|
847
|
-
dto.id || '', dto.created || '', dto.serverCreated || '', dto.createdBy || '', dto.modified || '', dto.serverModified || '', dto.modifiedBy || '', dto.createdByName || '', dto.modifiedByName || '', dto.account || '', dto.accessGroup || '', dto.name || '', dto.title || '', dto.description || '', dto.sequence || 0, dto.includeInSummary || false, dto.forms || [], dto.visibilityControl || '', dto.visibleIfEquals || '', (dto.controls || [])
|
|
848
|
-
.filter(control => control.name.startsWith('fields.'))
|
|
849
|
-
.sort((a, b) => a.sequence - b.sequence)
|
|
850
|
-
.map(c => VasControlModel.fromDto(c)), dto.scoreWeight || 1);
|
|
851
|
-
}
|
|
852
|
-
/**
|
|
853
|
-
* @param {Array<VasControlModel>} valuesByControlId
|
|
854
|
-
* @return {boolean}
|
|
855
|
-
*/
|
|
856
|
-
isVisible(valuesByControlId) {
|
|
857
|
-
if (!this.visibilityControl || !this.visibleIfEquals) {
|
|
858
|
-
return true;
|
|
859
|
-
}
|
|
860
|
-
const control = valuesByControlId
|
|
861
|
-
.find(c => c.id === this.visibilityControl);
|
|
862
|
-
if (!control) {
|
|
863
|
-
console.warn(`control with id ${this.visibilityControl} not found`);
|
|
864
|
-
return true;
|
|
865
|
-
}
|
|
866
|
-
return (control.value || '').toString() === this.visibleIfEquals;
|
|
867
|
-
}
|
|
868
|
-
/**
|
|
869
|
-
* @return {VasGroupDto}
|
|
870
|
-
*/
|
|
871
|
-
toDto() {
|
|
872
|
-
return {
|
|
873
|
-
id: this.id,
|
|
874
|
-
created: this.created,
|
|
875
|
-
serverCreated: this.serverCreated,
|
|
876
|
-
createdBy: this.createdBy,
|
|
877
|
-
modified: this.modified,
|
|
878
|
-
serverModified: this.serverModified,
|
|
879
|
-
modifiedBy: this.modifiedBy,
|
|
880
|
-
createdByName: this.createdByName,
|
|
881
|
-
modifiedByName: this.modifiedByName,
|
|
882
|
-
account: this.account,
|
|
883
|
-
accessGroup: this.accessGroup,
|
|
884
|
-
name: this.name,
|
|
885
|
-
title: this.title,
|
|
886
|
-
description: this.description,
|
|
887
|
-
sequence: this.sequence,
|
|
888
|
-
includeInSummary: this.includeInSummary,
|
|
889
|
-
forms: this.forms,
|
|
890
|
-
visibilityControl: this.visibilityControl,
|
|
891
|
-
visibleIfEquals: this.visibleIfEquals,
|
|
892
|
-
controls: this.controls.map(control => control.toDto()),
|
|
893
|
-
scoreWeight: this.scoreWeight
|
|
894
|
-
};
|
|
895
|
-
}
|
|
896
|
-
toApiDto(options) {
|
|
897
|
-
return Object.assign(Object.assign({}, super.toApiDto(options)), { name: this.name || '~', title: this.title || '~', sequence: this.sequence || 0, includeInSummary: this.includeInSummary });
|
|
898
|
-
}
|
|
899
|
-
}
|
|
900
|
-
|
|
901
|
-
class VasFormConfigModel {
|
|
902
|
-
constructor(emailRecipients, actions) {
|
|
903
|
-
this.emailRecipients = emailRecipients;
|
|
904
|
-
this.actions = actions;
|
|
905
|
-
}
|
|
906
|
-
toDto() {
|
|
907
|
-
return {
|
|
908
|
-
emailRecipients: this.emailRecipients,
|
|
909
|
-
actions: this.actions
|
|
910
|
-
};
|
|
911
|
-
}
|
|
912
|
-
toJsonString() {
|
|
913
|
-
return JSON.stringify(this.toDto());
|
|
914
|
-
}
|
|
915
|
-
static create() {
|
|
916
|
-
return new VasFormConfigModel();
|
|
917
|
-
}
|
|
918
|
-
static fromDto(dto) {
|
|
919
|
-
return new VasFormConfigModel(dto.emailRecipients, dto.actions);
|
|
920
|
-
}
|
|
921
|
-
static fromJsonString(value) {
|
|
922
|
-
try {
|
|
923
|
-
const dto = JSON.parse(value || '{}');
|
|
924
|
-
return VasFormConfigModel.fromDto(dto);
|
|
925
|
-
}
|
|
926
|
-
catch (e) {
|
|
927
|
-
return VasFormConfigModel.create();
|
|
928
|
-
}
|
|
929
|
-
}
|
|
930
|
-
}
|
|
931
|
-
|
|
932
|
-
/**
|
|
933
|
-
* VasFormModel
|
|
934
|
-
*/
|
|
935
|
-
class VasFormModel extends VasRestrictedAccountObjectModel {
|
|
936
|
-
constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account, accessGroup, jobType, title, description, groups, dynamicDescriptor, indexName, pipelineName, config, geoLocationEnabled, filesEnabled) {
|
|
937
|
-
super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account, accessGroup);
|
|
938
|
-
this.id = id;
|
|
939
|
-
this.created = created;
|
|
940
|
-
this.serverCreated = serverCreated;
|
|
941
|
-
this.createdBy = createdBy;
|
|
942
|
-
this.modified = modified;
|
|
943
|
-
this.serverModified = serverModified;
|
|
944
|
-
this.modifiedBy = modifiedBy;
|
|
945
|
-
this.createdByName = createdByName;
|
|
946
|
-
this.modifiedByName = modifiedByName;
|
|
947
|
-
this.account = account;
|
|
948
|
-
this.accessGroup = accessGroup;
|
|
949
|
-
this.jobType = jobType;
|
|
950
|
-
this.title = title;
|
|
951
|
-
this.description = description;
|
|
952
|
-
this.groups = groups;
|
|
953
|
-
this.dynamicDescriptor = dynamicDescriptor;
|
|
954
|
-
this.indexName = indexName;
|
|
955
|
-
this.pipelineName = pipelineName;
|
|
956
|
-
this.config = config;
|
|
957
|
-
this.geoLocationEnabled = geoLocationEnabled;
|
|
958
|
-
this.filesEnabled = filesEnabled;
|
|
959
|
-
}
|
|
960
|
-
/**
|
|
961
|
-
* Returns the name of this form in a "safe" way, i.e. no spaces, special
|
|
962
|
-
* characters
|
|
963
|
-
* @return {string}
|
|
964
|
-
*/
|
|
965
|
-
get safeTitle() {
|
|
966
|
-
return this.title
|
|
967
|
-
.replace(/[^a-z0-9]/gi, '-')
|
|
968
|
-
.replace(/-+/g, '-')
|
|
969
|
-
.toLowerCase();
|
|
970
|
-
}
|
|
971
|
-
/**
|
|
972
|
-
* The VAS API response for Form will inline Group and Control but not
|
|
973
|
-
* ControlType. This method is a help which will allows us to construct an
|
|
974
|
-
* instance of VasFormModel with the ControlType model set appropriately into
|
|
975
|
-
* each VasControlModel
|
|
976
|
-
* @param {VasFormDto} formDto
|
|
977
|
-
* @param {Array<VasControlTypeDto>} controlTypeDtos
|
|
978
|
-
* @return {VasFormModel}
|
|
979
|
-
* @deprecated vas-rest has been updated to inline control types into the
|
|
980
|
-
* control so this method is no longer required. use VasFormModel.fromDto()
|
|
981
|
-
*/
|
|
982
|
-
static fromApiResponse(formDto, controlTypeDtos) {
|
|
983
|
-
const controlTypeModels = controlTypeDtos
|
|
984
|
-
.map(ctDto => VasControlTypeModel.fromDto(ctDto));
|
|
985
|
-
const formModel = VasFormModel.fromDto(formDto);
|
|
986
|
-
formModel.groups
|
|
987
|
-
.forEach(group => {
|
|
988
|
-
group.controls
|
|
989
|
-
.forEach(control => {
|
|
990
|
-
// Note that we are forcing types here. This is because we have
|
|
991
|
-
// updated the typings for ControlModel and ControlDto to reflect
|
|
992
|
-
// the fact that VASREST is updating the response from certain
|
|
993
|
-
// controllers to inline ControlType into the Control. Consumers of
|
|
994
|
-
// the library will know what version of the API they are consuming
|
|
995
|
-
// so can decide when to migrate away from fromApiResponse, and can
|
|
996
|
-
// use fromDto instead
|
|
997
|
-
control.controlType = controlTypeModels
|
|
998
|
-
.find(ct => ct.id === (control.controlTypeId));
|
|
999
|
-
});
|
|
1000
|
-
});
|
|
1001
|
-
return formModel;
|
|
1002
|
-
}
|
|
1003
|
-
static empty() {
|
|
1004
|
-
return VasFormModel.fromDto({});
|
|
1005
|
-
}
|
|
1006
|
-
/**
|
|
1007
|
-
* @param {VasFormDto} dto
|
|
1008
|
-
* @return {VasFormModel}
|
|
1009
|
-
*/
|
|
1010
|
-
static fromDto(dto) {
|
|
1011
|
-
return new VasFormModel(dto.id || '', dto.created || '', dto.serverCreated || '', dto.createdBy || '', dto.modified || '', dto.serverModified || '', dto.modifiedBy || '', dto.createdByName || '', dto.modifiedByName || '', dto.account || '', dto.accessGroup || '', dto.jobType || '', dto.title || '', dto.description || '', (dto.groups || [])
|
|
1012
|
-
.sort((a, b) => a.sequence - b.sequence)
|
|
1013
|
-
.map(g => VasGroupModel.fromDto(g)), dto.dynamicDescriptor || '', dto.indexName || '', dto.pipelineName || '', VasFormConfigModel.fromJsonString(dto.config), dto.geoLocationEnabled || false, dto.filesEnabled || false);
|
|
1014
|
-
}
|
|
1015
|
-
/**
|
|
1016
|
-
* @param {string} id
|
|
1017
|
-
* @return {VasControlModel | undefined}
|
|
1018
|
-
*/
|
|
1019
|
-
findControlModelById(id) {
|
|
1020
|
-
let result;
|
|
1021
|
-
this.groups
|
|
1022
|
-
.find(group => group.controls
|
|
1023
|
-
.find(control => {
|
|
1024
|
-
if (control.id !== id) {
|
|
1025
|
-
return;
|
|
1026
|
-
}
|
|
1027
|
-
result = control;
|
|
1028
|
-
return true;
|
|
1029
|
-
}));
|
|
1030
|
-
return result;
|
|
1031
|
-
}
|
|
1032
|
-
/**
|
|
1033
|
-
*
|
|
1034
|
-
* @param {string} name
|
|
1035
|
-
* @return {VasControlModel | undefined}
|
|
1036
|
-
*/
|
|
1037
|
-
findControlModelByName(name) {
|
|
1038
|
-
let result;
|
|
1039
|
-
this.groups
|
|
1040
|
-
.find(group => group.controls
|
|
1041
|
-
.find(control => {
|
|
1042
|
-
if (control.name !== name) {
|
|
1043
|
-
return;
|
|
1044
|
-
}
|
|
1045
|
-
result = control;
|
|
1046
|
-
return true;
|
|
1047
|
-
}));
|
|
1048
|
-
return result;
|
|
1049
|
-
}
|
|
1050
|
-
/**
|
|
1051
|
-
*
|
|
1052
|
-
* @return {Array<Array<string>>}
|
|
1053
|
-
*/
|
|
1054
|
-
getCameraControlPaths() {
|
|
1055
|
-
const paths = [];
|
|
1056
|
-
this.groups.forEach(group => {
|
|
1057
|
-
group.controls.forEach(control => {
|
|
1058
|
-
if (control.controlTypeName !== 'camera') {
|
|
1059
|
-
return;
|
|
1060
|
-
}
|
|
1061
|
-
paths.push([group.name, control.safeName]);
|
|
1062
|
-
});
|
|
1063
|
-
});
|
|
1064
|
-
return paths;
|
|
1065
|
-
}
|
|
1066
|
-
/**
|
|
1067
|
-
* @param {VasJobModel} jobModel
|
|
1068
|
-
* @return {Array<{id: string, value: VasFieldDtoValue}>}
|
|
1069
|
-
*/
|
|
1070
|
-
getValuesByControlId(jobModel) {
|
|
1071
|
-
const items = [];
|
|
1072
|
-
this.groups
|
|
1073
|
-
.forEach(group => {
|
|
1074
|
-
group.controls
|
|
1075
|
-
.forEach(control => {
|
|
1076
|
-
items.push({
|
|
1077
|
-
id: control.id,
|
|
1078
|
-
value: jobModel.getValueByPath([group.name, control.safeName])
|
|
1079
|
-
});
|
|
1080
|
-
});
|
|
1081
|
-
});
|
|
1082
|
-
return items;
|
|
1083
|
-
}
|
|
1084
|
-
/**
|
|
1085
|
-
* @return {VasFormDto}
|
|
1086
|
-
*/
|
|
1087
|
-
toDto() {
|
|
1088
|
-
return {
|
|
1089
|
-
id: this.id,
|
|
1090
|
-
created: this.created,
|
|
1091
|
-
serverCreated: this.serverCreated,
|
|
1092
|
-
createdBy: this.createdBy,
|
|
1093
|
-
modified: this.modified,
|
|
1094
|
-
serverModified: this.serverModified,
|
|
1095
|
-
modifiedBy: this.modifiedBy,
|
|
1096
|
-
createdByName: this.createdByName,
|
|
1097
|
-
modifiedByName: this.modifiedByName,
|
|
1098
|
-
account: this.account,
|
|
1099
|
-
accessGroup: this.accessGroup,
|
|
1100
|
-
jobType: this.jobType,
|
|
1101
|
-
title: this.title,
|
|
1102
|
-
description: this.description,
|
|
1103
|
-
groups: this.groups.map(group => group.toDto()),
|
|
1104
|
-
dynamicDescriptor: this.dynamicDescriptor,
|
|
1105
|
-
indexName: this.indexName,
|
|
1106
|
-
pipelineName: this.pipelineName,
|
|
1107
|
-
config: this.config.toJsonString(),
|
|
1108
|
-
geoLocationEnabled: this.geoLocationEnabled,
|
|
1109
|
-
filesEnabled: this.filesEnabled
|
|
1110
|
-
};
|
|
1111
|
-
}
|
|
1112
|
-
toApiDto(options) {
|
|
1113
|
-
return Object.assign(Object.assign({}, super.toApiDto(options)), { title: this.title || '~', description: this.description || '~', jobType: this.jobType });
|
|
1114
|
-
}
|
|
1115
|
-
}
|
|
1116
|
-
|
|
1117
|
-
var VasInvitationTypeEnum;
|
|
1118
|
-
(function (VasInvitationTypeEnum) {
|
|
1119
|
-
VasInvitationTypeEnum["TYPE_VAS_DESKTOP"] = "vas-desktop";
|
|
1120
|
-
VasInvitationTypeEnum["TYPE_VAS_MOBILE"] = "vas-mobile";
|
|
1121
|
-
VasInvitationTypeEnum["TYPE_VAS_PORTAL"] = "vas-portal";
|
|
1122
|
-
VasInvitationTypeEnum["TYPE_P2C_DESKTOP"] = "p2c-desktop";
|
|
1123
|
-
VasInvitationTypeEnum["TYPE_P2C_MOBILE"] = "p2c-mobile";
|
|
1124
|
-
})(VasInvitationTypeEnum || (VasInvitationTypeEnum = {}));
|
|
1125
|
-
class VasInvitationModel extends VasAccountObjectModel {
|
|
1126
|
-
constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account, secret, type, accessGroups, contactTypes, jobStatuses, jobTypes, lookupTypes, taskTypes, instructionProviders) {
|
|
1127
|
-
super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account);
|
|
1128
|
-
this.id = id;
|
|
1129
|
-
this.created = created;
|
|
1130
|
-
this.serverCreated = serverCreated;
|
|
1131
|
-
this.createdBy = createdBy;
|
|
1132
|
-
this.modified = modified;
|
|
1133
|
-
this.serverModified = serverModified;
|
|
1134
|
-
this.modifiedBy = modifiedBy;
|
|
1135
|
-
this.createdByName = createdByName;
|
|
1136
|
-
this.modifiedByName = modifiedByName;
|
|
1137
|
-
this.account = account;
|
|
1138
|
-
this.secret = secret;
|
|
1139
|
-
this.type = type;
|
|
1140
|
-
this.accessGroups = accessGroups;
|
|
1141
|
-
this.contactTypes = contactTypes;
|
|
1142
|
-
this.jobStatuses = jobStatuses;
|
|
1143
|
-
this.jobTypes = jobTypes;
|
|
1144
|
-
this.lookupTypes = lookupTypes;
|
|
1145
|
-
this.taskTypes = taskTypes;
|
|
1146
|
-
this.instructionProviders = instructionProviders;
|
|
1147
|
-
}
|
|
1148
|
-
toDto() {
|
|
1149
|
-
return {
|
|
1150
|
-
id: this.id,
|
|
1151
|
-
created: this.created,
|
|
1152
|
-
serverCreated: this.serverCreated,
|
|
1153
|
-
createdBy: this.createdBy,
|
|
1154
|
-
modified: this.modified,
|
|
1155
|
-
serverModified: this.serverModified,
|
|
1156
|
-
modifiedBy: this.modifiedBy,
|
|
1157
|
-
createdByName: this.createdByName,
|
|
1158
|
-
modifiedByName: this.modifiedByName,
|
|
1159
|
-
account: this.account,
|
|
1160
|
-
secret: this.secret,
|
|
1161
|
-
type: this.type,
|
|
1162
|
-
accessGroups: this.accessGroups,
|
|
1163
|
-
contactTypes: this.contactTypes,
|
|
1164
|
-
jobStatuses: this.jobStatuses,
|
|
1165
|
-
jobTypes: this.jobTypes,
|
|
1166
|
-
lookupTypes: this.lookupTypes,
|
|
1167
|
-
taskTypes: this.taskTypes,
|
|
1168
|
-
instructionProviders: this.instructionProviders,
|
|
1169
|
-
};
|
|
1170
|
-
}
|
|
1171
|
-
static fromDto(dto) {
|
|
1172
|
-
return new VasInvitationModel(dto.id || '', dto.created || '', dto.serverCreated || '', dto.createdBy || '', dto.modified || '', dto.serverModified || '', dto.modifiedBy || '', dto.createdByName || '', dto.modifiedByName || '', dto.account || '', dto.secret || '', dto.type || VasInvitationTypeEnum.TYPE_VAS_PORTAL, dto.accessGroups || [], dto.contactTypes || [], dto.jobStatuses || [], dto.jobTypes || [], dto.lookupTypes || [], dto.taskTypes || [], dto.instructionProviders || []);
|
|
1173
|
-
}
|
|
1174
|
-
toApiDto(options) {
|
|
1175
|
-
const dto = Object.assign(Object.assign({}, super.toApiDto()), { type: this.type });
|
|
1176
|
-
if (this.accessGroups.length) {
|
|
1177
|
-
dto['accessGroups'] = this.accessGroups.map(d => d.id);
|
|
1178
|
-
}
|
|
1179
|
-
if (this.contactTypes.length) {
|
|
1180
|
-
dto['contactTypes'] = this.contactTypes.map(d => d.id);
|
|
1181
|
-
}
|
|
1182
|
-
if (this.jobStatuses.length) {
|
|
1183
|
-
dto['jobStatuses'] = this.jobStatuses.map(d => d.id);
|
|
1184
|
-
}
|
|
1185
|
-
if (this.jobTypes.length) {
|
|
1186
|
-
dto['jobTypes'] = this.jobTypes.map(d => d.id);
|
|
1187
|
-
}
|
|
1188
|
-
if (this.lookupTypes.length) {
|
|
1189
|
-
dto['lookupTypes'] = this.lookupTypes.map(d => d.id);
|
|
1190
|
-
}
|
|
1191
|
-
if (this.taskTypes.length) {
|
|
1192
|
-
dto['taskTypes'] = this.taskTypes.map(d => d.id);
|
|
1193
|
-
}
|
|
1194
|
-
if (this.instructionProviders.length) {
|
|
1195
|
-
dto['instructionProviders'] = this.instructionProviders.map(d => d.id);
|
|
1196
|
-
}
|
|
1197
|
-
return dto;
|
|
1198
|
-
}
|
|
1199
|
-
}
|
|
1200
|
-
|
|
1201
|
-
/**
|
|
1202
|
-
* VasNoteModel
|
|
1203
|
-
*/
|
|
1204
|
-
class VasNoteModel extends VasJobDataModel {
|
|
1205
|
-
constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account, job, content, sensitive) {
|
|
1206
|
-
super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account, job);
|
|
1207
|
-
this.id = id;
|
|
1208
|
-
this.created = created;
|
|
1209
|
-
this.serverCreated = serverCreated;
|
|
1210
|
-
this.createdBy = createdBy;
|
|
1211
|
-
this.modified = modified;
|
|
1212
|
-
this.serverModified = serverModified;
|
|
1213
|
-
this.modifiedBy = modifiedBy;
|
|
1214
|
-
this.createdByName = createdByName;
|
|
1215
|
-
this.modifiedByName = modifiedByName;
|
|
1216
|
-
this.account = account;
|
|
1217
|
-
this.job = job;
|
|
1218
|
-
this.content = content;
|
|
1219
|
-
this.sensitive = sensitive;
|
|
1220
|
-
}
|
|
1221
|
-
/**
|
|
1222
|
-
* @param dto VasNoteDto
|
|
1223
|
-
* @return VasNoteModel
|
|
1224
|
-
*/
|
|
1225
|
-
static fromDto(dto) {
|
|
1226
|
-
return new VasNoteModel(dto.id || '', dto.created || '', dto.serverCreated || '', dto.createdBy || '', dto.modified || '', dto.serverModified || '', dto.modifiedBy || '', dto.createdByName || '', dto.modifiedByName || '', dto.account || '', dto.job || '', dto.content || '', dto.sensitive || false);
|
|
1227
|
-
}
|
|
1228
|
-
/**
|
|
1229
|
-
* @returns VasNoteDto
|
|
1230
|
-
*/
|
|
1231
|
-
toDto() {
|
|
1232
|
-
return {
|
|
1233
|
-
id: this.id,
|
|
1234
|
-
created: this.created,
|
|
1235
|
-
serverCreated: this.serverCreated,
|
|
1236
|
-
createdBy: this.createdBy,
|
|
1237
|
-
modified: this.modified,
|
|
1238
|
-
serverModified: this.serverModified,
|
|
1239
|
-
modifiedBy: this.modifiedBy,
|
|
1240
|
-
createdByName: this.createdByName,
|
|
1241
|
-
modifiedByName: this.modifiedByName,
|
|
1242
|
-
account: this.account,
|
|
1243
|
-
job: this.job,
|
|
1244
|
-
content: this.content,
|
|
1245
|
-
sensitive: this.sensitive,
|
|
1246
|
-
};
|
|
1247
|
-
}
|
|
1248
|
-
toApiDto(options) {
|
|
1249
|
-
return Object.assign(Object.assign({}, super.toApiDto(options)), { content: this.content, sensitive: this.sensitive, created: this.created, modified: this.modified });
|
|
1250
|
-
}
|
|
1251
|
-
}
|
|
1252
|
-
|
|
1253
|
-
/**
|
|
1254
|
-
* VasInstructionJobFieldModel
|
|
1255
|
-
*/
|
|
1256
|
-
class VasInstructionJobFieldModel extends VasBaseModel {
|
|
1257
|
-
constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, value, name, title, sequence, controlType) {
|
|
1258
|
-
super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName);
|
|
1259
|
-
this.id = id;
|
|
1260
|
-
this.created = created;
|
|
1261
|
-
this.serverCreated = serverCreated;
|
|
1262
|
-
this.createdBy = createdBy;
|
|
1263
|
-
this.modified = modified;
|
|
1264
|
-
this.serverModified = serverModified;
|
|
1265
|
-
this.modifiedBy = modifiedBy;
|
|
1266
|
-
this.createdByName = createdByName;
|
|
1267
|
-
this.modifiedByName = modifiedByName;
|
|
1268
|
-
this.value = value;
|
|
1269
|
-
this.name = name;
|
|
1270
|
-
this.title = title;
|
|
1271
|
-
this.sequence = sequence;
|
|
1272
|
-
this.controlType = controlType;
|
|
1273
|
-
}
|
|
1274
|
-
static empty() {
|
|
1275
|
-
return new VasInstructionJobFieldModel('', '', '', '', '', '', '', '', '', '', '', '', 0, '');
|
|
1276
|
-
}
|
|
1277
|
-
static fromDto(dto) {
|
|
1278
|
-
return new VasInstructionJobFieldModel(dto.id || '', dto.created || '', dto.serverCreated || '', dto.createdBy || '', dto.modified || '', dto.serverModified || '', dto.modifiedBy || '', dto.createdByName || '', dto.modifiedByName || '', dto.value || '', dto.name || '', dto.title || '', dto.sequence || 0, dto.controlType || '');
|
|
1279
|
-
}
|
|
1280
|
-
toDto() {
|
|
1281
|
-
return {
|
|
1282
|
-
id: this.id,
|
|
1283
|
-
created: this.created,
|
|
1284
|
-
serverCreated: this.serverCreated,
|
|
1285
|
-
createdBy: this.createdBy,
|
|
1286
|
-
modified: this.modified,
|
|
1287
|
-
serverModified: this.serverModified,
|
|
1288
|
-
modifiedBy: this.modifiedBy,
|
|
1289
|
-
createdByName: this.createdByName,
|
|
1290
|
-
modifiedByName: this.modifiedByName,
|
|
1291
|
-
value: this.value,
|
|
1292
|
-
name: this.name,
|
|
1293
|
-
title: this.title,
|
|
1294
|
-
sequence: this.sequence,
|
|
1295
|
-
controlType: this.controlType
|
|
1296
|
-
};
|
|
1297
|
-
}
|
|
1298
|
-
}
|
|
1299
|
-
|
|
1300
|
-
class VasReportModel extends VasJobDataModel {
|
|
1301
|
-
constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account, job, reportLayoutId, title, sendEmail, message, attempted, completed, succeeded, attempts, notificationId) {
|
|
1302
|
-
super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account, job);
|
|
1303
|
-
this.id = id;
|
|
1304
|
-
this.created = created;
|
|
1305
|
-
this.serverCreated = serverCreated;
|
|
1306
|
-
this.createdBy = createdBy;
|
|
1307
|
-
this.modified = modified;
|
|
1308
|
-
this.serverModified = serverModified;
|
|
1309
|
-
this.modifiedBy = modifiedBy;
|
|
1310
|
-
this.createdByName = createdByName;
|
|
1311
|
-
this.modifiedByName = modifiedByName;
|
|
1312
|
-
this.account = account;
|
|
1313
|
-
this.job = job;
|
|
1314
|
-
this.reportLayoutId = reportLayoutId;
|
|
1315
|
-
this.title = title;
|
|
1316
|
-
this.sendEmail = sendEmail;
|
|
1317
|
-
this.message = message;
|
|
1318
|
-
this.attempted = attempted;
|
|
1319
|
-
this.completed = completed;
|
|
1320
|
-
this.succeeded = succeeded;
|
|
1321
|
-
this.attempts = attempts;
|
|
1322
|
-
this.notificationId = notificationId;
|
|
1323
|
-
}
|
|
1324
|
-
static empty() {
|
|
1325
|
-
return VasReportModel.fromDto({});
|
|
1326
|
-
}
|
|
1327
|
-
static fromDto(dto) {
|
|
1328
|
-
return new VasReportModel(dto.id || '', dto.created || '', dto.serverCreated || '', dto.createdBy || '', dto.modified || '', dto.serverModified || '', dto.modifiedBy || '', dto.createdByName || '', dto.modifiedByName || '', dto.account || '', dto.job || '', dto.reportLayoutId || '', dto.title || '', dto.sendEmail || '', dto.message || '', dto.attempted || '', dto.completed || '', dto.succeeded || '', dto.attempts || 0, dto.notificationId || '');
|
|
1329
|
-
}
|
|
1330
|
-
toDto() {
|
|
1331
|
-
return {
|
|
1332
|
-
id: this.id,
|
|
1333
|
-
created: this.created,
|
|
1334
|
-
serverCreated: this.serverCreated,
|
|
1335
|
-
createdBy: this.createdBy,
|
|
1336
|
-
modified: this.modified,
|
|
1337
|
-
serverModified: this.serverModified,
|
|
1338
|
-
modifiedBy: this.modifiedBy,
|
|
1339
|
-
createdByName: this.createdByName,
|
|
1340
|
-
modifiedByName: this.modifiedByName,
|
|
1341
|
-
account: this.account,
|
|
1342
|
-
job: this.job,
|
|
1343
|
-
reportLayoutId: this.reportLayoutId,
|
|
1344
|
-
title: this.title,
|
|
1345
|
-
sendEmail: this.sendEmail,
|
|
1346
|
-
message: this.message,
|
|
1347
|
-
attempted: this.attempted,
|
|
1348
|
-
completed: this.completed,
|
|
1349
|
-
succeeded: this.succeeded,
|
|
1350
|
-
attempts: this.attempts,
|
|
1351
|
-
notificationId: this.notificationId,
|
|
1352
|
-
};
|
|
1353
|
-
}
|
|
1354
|
-
}
|
|
1355
|
-
|
|
1356
|
-
/**
|
|
1357
|
-
* VasNoteModel
|
|
1358
|
-
*/
|
|
1359
|
-
class VasInstructionJobModel extends VasBaseModel {
|
|
1360
|
-
/**
|
|
1361
|
-
* @param id id
|
|
1362
|
-
* @param created created
|
|
1363
|
-
* @param serverCreated serverCreated
|
|
1364
|
-
* @param createdBy createdBy
|
|
1365
|
-
* @param modified modified
|
|
1366
|
-
* @param serverModified serverModified
|
|
1367
|
-
* @param modifiedBy modifiedBy
|
|
1368
|
-
* @param reference reference
|
|
1369
|
-
* @param jobStatus jobStatus
|
|
1370
|
-
* @param createdByName createdByName
|
|
1371
|
-
* @param modifiedByName modifiedByName
|
|
1372
|
-
* @param notes notes
|
|
1373
|
-
* @param fields fields
|
|
1374
|
-
* @param files files
|
|
1375
|
-
* @param reports reports
|
|
1376
|
-
*/
|
|
1377
|
-
constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, reference, jobStatus, notes, fields, files, reports) {
|
|
1378
|
-
super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName);
|
|
1379
|
-
this.id = id;
|
|
1380
|
-
this.created = created;
|
|
1381
|
-
this.serverCreated = serverCreated;
|
|
1382
|
-
this.createdBy = createdBy;
|
|
1383
|
-
this.modified = modified;
|
|
1384
|
-
this.serverModified = serverModified;
|
|
1385
|
-
this.modifiedBy = modifiedBy;
|
|
1386
|
-
this.createdByName = createdByName;
|
|
1387
|
-
this.modifiedByName = modifiedByName;
|
|
1388
|
-
this.reference = reference;
|
|
1389
|
-
this.jobStatus = jobStatus;
|
|
1390
|
-
this.notes = notes;
|
|
1391
|
-
this.fields = fields;
|
|
1392
|
-
this.files = files;
|
|
1393
|
-
this.reports = reports;
|
|
1394
|
-
}
|
|
1395
|
-
/**
|
|
1396
|
-
* @return empty VasInstructionJobModel
|
|
1397
|
-
*/
|
|
1398
|
-
static empty() {
|
|
1399
|
-
return new VasInstructionJobModel('', '', '', '', '', '', '', '', '', '', '', [], [], [], []);
|
|
1400
|
-
}
|
|
1401
|
-
/**
|
|
1402
|
-
* @param dto VasInstructionDto
|
|
1403
|
-
* @return VasInstructionModel
|
|
1404
|
-
*/
|
|
1405
|
-
static fromDto(dto) {
|
|
1406
|
-
return new VasInstructionJobModel(dto.id || '', dto.created || '', dto.serverCreated || '', dto.createdBy || '', dto.modified || '', dto.serverModified || '', dto.modifiedBy || '', dto.reference || '', dto.jobStatus || '', dto.createdByName || '', dto.modifiedByName || '', (dto.notes || []).map(d => VasNoteModel.fromDto(d)), (dto.fields || []).map(d => VasInstructionJobFieldModel.fromDto(d)), (dto.files || []).map(d => VasFileModel.fromDto(d)), (dto.reports || []).map(d => VasReportModel.fromDto(d)));
|
|
1407
|
-
}
|
|
1408
|
-
/**
|
|
1409
|
-
* @returns VasNoteDto
|
|
1410
|
-
*/
|
|
1411
|
-
toDto() {
|
|
1412
|
-
return {
|
|
1413
|
-
id: this.id,
|
|
1414
|
-
created: this.created,
|
|
1415
|
-
serverCreated: this.serverCreated,
|
|
1416
|
-
createdBy: this.createdBy,
|
|
1417
|
-
modified: this.modified,
|
|
1418
|
-
serverModified: this.serverModified,
|
|
1419
|
-
modifiedBy: this.modifiedBy,
|
|
1420
|
-
reference: this.reference,
|
|
1421
|
-
jobStatus: this.jobStatus,
|
|
1422
|
-
createdByName: this.createdByName,
|
|
1423
|
-
modifiedByName: this.modifiedByName,
|
|
1424
|
-
notes: this.notes.map(m => m.toDto()),
|
|
1425
|
-
fields: this.fields.map(m => m.toDto()),
|
|
1426
|
-
files: this.files.map(m => m.toDto()),
|
|
1427
|
-
reports: this.reports.map(m => m.toDto()),
|
|
1428
|
-
};
|
|
1429
|
-
}
|
|
1430
|
-
}
|
|
1431
|
-
|
|
1432
|
-
/**
|
|
1433
|
-
* VasInstructionProviderModel
|
|
1434
|
-
*/
|
|
1435
|
-
class VasInstructionProviderModel extends VasAccountObjectModel {
|
|
1436
|
-
constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account, form, title, secret, portalEnabled, portalVisible) {
|
|
1437
|
-
super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account);
|
|
1438
|
-
this.id = id;
|
|
1439
|
-
this.created = created;
|
|
1440
|
-
this.serverCreated = serverCreated;
|
|
1441
|
-
this.createdBy = createdBy;
|
|
1442
|
-
this.modified = modified;
|
|
1443
|
-
this.serverModified = serverModified;
|
|
1444
|
-
this.modifiedBy = modifiedBy;
|
|
1445
|
-
this.createdByName = createdByName;
|
|
1446
|
-
this.modifiedByName = modifiedByName;
|
|
1447
|
-
this.account = account;
|
|
1448
|
-
this.form = form;
|
|
1449
|
-
this.title = title;
|
|
1450
|
-
this.secret = secret;
|
|
1451
|
-
this.portalEnabled = portalEnabled;
|
|
1452
|
-
this.portalVisible = portalVisible;
|
|
1453
|
-
}
|
|
1454
|
-
/**
|
|
1455
|
-
* @param dto VasInstructionDto
|
|
1456
|
-
* @return VasInstructionModel
|
|
1457
|
-
*/
|
|
1458
|
-
static fromDto(dto) {
|
|
1459
|
-
return new VasInstructionProviderModel(dto.id || '', dto.created || '', dto.serverCreated || '', dto.createdBy || '', dto.modified || '', dto.serverModified || '', dto.modifiedBy || '', dto.createdByName || '', dto.modifiedByName || '', dto.account || '', dto.form ?
|
|
1460
|
-
VasFormModel.fromDto(dto.form) :
|
|
1461
|
-
VasFormModel.empty(), dto.title || '', dto.secret || '', dto.portalEnabled || false, dto.portalVisible || true);
|
|
1462
|
-
}
|
|
1463
|
-
/**
|
|
1464
|
-
* @returns VasNoteDto
|
|
1465
|
-
*/
|
|
1466
|
-
toDto() {
|
|
1467
|
-
return {
|
|
1468
|
-
id: this.id,
|
|
1469
|
-
created: this.created,
|
|
1470
|
-
serverCreated: this.serverCreated,
|
|
1471
|
-
createdBy: this.createdBy,
|
|
1472
|
-
modified: this.modified,
|
|
1473
|
-
serverModified: this.serverModified,
|
|
1474
|
-
modifiedBy: this.modifiedBy,
|
|
1475
|
-
createdByName: this.createdByName,
|
|
1476
|
-
modifiedByName: this.modifiedByName,
|
|
1477
|
-
account: this.account,
|
|
1478
|
-
form: this.form.toDto(),
|
|
1479
|
-
title: this.title,
|
|
1480
|
-
secret: this.secret,
|
|
1481
|
-
portalEnabled: this.portalEnabled,
|
|
1482
|
-
portalVisible: this.portalVisible
|
|
1483
|
-
};
|
|
1484
|
-
}
|
|
1485
|
-
toApiDto(options) {
|
|
1486
|
-
return Object.assign(Object.assign({}, super.toApiDto(options)), { title: this.title, form: this.form.id, portalEnabled: this.portalEnabled, portalVisible: this.portalVisible });
|
|
1487
|
-
}
|
|
1488
|
-
}
|
|
1489
|
-
|
|
1490
|
-
/**
|
|
1491
|
-
* VasNoteModel
|
|
1492
|
-
*/
|
|
1493
|
-
class VasInstructionModel extends VasAccountObjectModel {
|
|
1494
|
-
constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account, job, instructionProvider) {
|
|
1495
|
-
super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account);
|
|
1496
|
-
this.id = id;
|
|
1497
|
-
this.created = created;
|
|
1498
|
-
this.serverCreated = serverCreated;
|
|
1499
|
-
this.createdBy = createdBy;
|
|
1500
|
-
this.modified = modified;
|
|
1501
|
-
this.serverModified = serverModified;
|
|
1502
|
-
this.modifiedBy = modifiedBy;
|
|
1503
|
-
this.createdByName = createdByName;
|
|
1504
|
-
this.modifiedByName = modifiedByName;
|
|
1505
|
-
this.account = account;
|
|
1506
|
-
this.job = job;
|
|
1507
|
-
this.instructionProvider = instructionProvider;
|
|
1508
|
-
}
|
|
1509
|
-
/**
|
|
1510
|
-
* @param dto VasInstructionDto
|
|
1511
|
-
* @return VasInstructionModel
|
|
1512
|
-
*/
|
|
1513
|
-
static fromDto(dto) {
|
|
1514
|
-
return new VasInstructionModel(dto.id || '', dto.created || '', dto.serverCreated || '', dto.createdBy || '', dto.modified || '', dto.serverModified || '', dto.modifiedBy || '', dto.createdByName || '', dto.modifiedByName || '', dto.account || '', dto.job ?
|
|
1515
|
-
VasInstructionJobModel.fromDto(dto.job) :
|
|
1516
|
-
VasInstructionJobModel.empty(), VasInstructionProviderModel.fromDto(dto.instructionProvider || {}));
|
|
1517
|
-
}
|
|
1518
|
-
/**
|
|
1519
|
-
* @returns VasNoteDto
|
|
1520
|
-
*/
|
|
1521
|
-
toDto() {
|
|
1522
|
-
return {
|
|
1523
|
-
id: this.id,
|
|
1524
|
-
created: this.created,
|
|
1525
|
-
serverCreated: this.serverCreated,
|
|
1526
|
-
createdBy: this.createdBy,
|
|
1527
|
-
modified: this.modified,
|
|
1528
|
-
serverModified: this.serverModified,
|
|
1529
|
-
modifiedBy: this.modifiedBy,
|
|
1530
|
-
createdByName: this.createdByName,
|
|
1531
|
-
modifiedByName: this.modifiedByName,
|
|
1532
|
-
account: this.account,
|
|
1533
|
-
job: this.job.toDto(),
|
|
1534
|
-
instructionProvider: this.instructionProvider.toDto()
|
|
1535
|
-
};
|
|
1536
|
-
}
|
|
1537
|
-
}
|
|
1538
|
-
|
|
1539
|
-
class VasJobEmailModel extends VasJobDataModel {
|
|
1540
|
-
constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account, job, body, cc, files, message, recipients, replyTo, reports, sender, sentTime, subject, succeeded) {
|
|
1541
|
-
super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account, job);
|
|
1542
|
-
this.id = id;
|
|
1543
|
-
this.created = created;
|
|
1544
|
-
this.serverCreated = serverCreated;
|
|
1545
|
-
this.createdBy = createdBy;
|
|
1546
|
-
this.modified = modified;
|
|
1547
|
-
this.serverModified = serverModified;
|
|
1548
|
-
this.modifiedBy = modifiedBy;
|
|
1549
|
-
this.createdByName = createdByName;
|
|
1550
|
-
this.modifiedByName = modifiedByName;
|
|
1551
|
-
this.account = account;
|
|
1552
|
-
this.job = job;
|
|
1553
|
-
this.body = body;
|
|
1554
|
-
this.cc = cc;
|
|
1555
|
-
this.files = files;
|
|
1556
|
-
this.message = message;
|
|
1557
|
-
this.recipients = recipients;
|
|
1558
|
-
this.replyTo = replyTo;
|
|
1559
|
-
this.reports = reports;
|
|
1560
|
-
this.sender = sender;
|
|
1561
|
-
this.sentTime = sentTime;
|
|
1562
|
-
this.subject = subject;
|
|
1563
|
-
this.succeeded = succeeded;
|
|
1564
|
-
}
|
|
1565
|
-
static fromDto(dto) {
|
|
1566
|
-
return new VasJobEmailModel(dto.id || '', dto.created || '', dto.serverCreated || '', dto.createdBy || '', dto.modified || '', dto.serverModified || '', dto.modifiedBy || '', dto.createdByName || '', dto.modifiedByName || '', dto.account || '', dto.job || '', dto.body || '', dto.cc || [], dto.files || [], dto.message || '', dto.recipients || [], dto.replyTo || '', dto.reports || [], dto.sender || '', dto.sentTime || '', dto.subject || '', dto.succeeded || false);
|
|
1567
|
-
}
|
|
1568
|
-
toDto() {
|
|
1569
|
-
return {
|
|
1570
|
-
id: this.id,
|
|
1571
|
-
created: this.created,
|
|
1572
|
-
serverCreated: this.serverCreated,
|
|
1573
|
-
createdBy: this.createdBy,
|
|
1574
|
-
modified: this.modified,
|
|
1575
|
-
serverModified: this.serverModified,
|
|
1576
|
-
modifiedBy: this.modifiedBy,
|
|
1577
|
-
createdByName: this.createdByName,
|
|
1578
|
-
modifiedByName: this.modifiedByName,
|
|
1579
|
-
account: this.account,
|
|
1580
|
-
job: this.job,
|
|
1581
|
-
body: this.body,
|
|
1582
|
-
cc: this.cc,
|
|
1583
|
-
files: this.files,
|
|
1584
|
-
message: this.message,
|
|
1585
|
-
recipients: this.recipients,
|
|
1586
|
-
replyTo: this.replyTo,
|
|
1587
|
-
reports: this.reports,
|
|
1588
|
-
sender: this.sender,
|
|
1589
|
-
sentTime: this.sentTime,
|
|
1590
|
-
subject: this.subject,
|
|
1591
|
-
succeeded: this.succeeded,
|
|
1592
|
-
};
|
|
1593
|
-
}
|
|
1594
|
-
toApiDto(options) {
|
|
1595
|
-
return {
|
|
1596
|
-
id: this.id,
|
|
1597
|
-
created: this.created,
|
|
1598
|
-
createdBy: this.createdBy,
|
|
1599
|
-
modified: this.modified,
|
|
1600
|
-
account: this.account,
|
|
1601
|
-
job: this.job,
|
|
1602
|
-
body: this.body,
|
|
1603
|
-
cc: this.cc,
|
|
1604
|
-
files: this.files,
|
|
1605
|
-
message: this.message,
|
|
1606
|
-
recipients: this.recipients,
|
|
1607
|
-
replyTo: this.replyTo,
|
|
1608
|
-
reports: this.reports,
|
|
1609
|
-
sender: this.sender,
|
|
1610
|
-
sentTime: this.sentTime,
|
|
1611
|
-
subject: this.subject,
|
|
1612
|
-
succeeded: this.succeeded,
|
|
1613
|
-
};
|
|
1614
|
-
}
|
|
1615
|
-
}
|
|
1616
|
-
|
|
1617
|
-
/**
|
|
1618
|
-
* A non sophisticated way to get values from the job via paths. For example:
|
|
1619
|
-
*
|
|
1620
|
-
* getValueByPath(
|
|
1621
|
-
* ['foo', 'bar'],
|
|
1622
|
-
* {
|
|
1623
|
-
* foo: {
|
|
1624
|
-
* bar: 'value'
|
|
1625
|
-
* }
|
|
1626
|
-
* }
|
|
1627
|
-
* );
|
|
1628
|
-
*
|
|
1629
|
-
* will return "value"
|
|
1630
|
-
* @param {string[]} path
|
|
1631
|
-
* @param {Record<string, VasFieldDtoValue>} object
|
|
1632
|
-
* @return {T | undefined}
|
|
1633
|
-
*/
|
|
1634
|
-
const getValueByPath = (path, object) => {
|
|
1635
|
-
switch (path.length) {
|
|
1636
|
-
case 0: {
|
|
1637
|
-
return;
|
|
1638
|
-
}
|
|
1639
|
-
case 1: {
|
|
1640
|
-
return (object)[path[0]];
|
|
1641
|
-
}
|
|
1642
|
-
case 2: {
|
|
1643
|
-
const val0 = object[path[0]];
|
|
1644
|
-
if (!val0) {
|
|
1645
|
-
return undefined;
|
|
1646
|
-
}
|
|
1647
|
-
return val0[path[1]];
|
|
1648
|
-
}
|
|
1649
|
-
case 3: {
|
|
1650
|
-
const val0 = object[path[0]];
|
|
1651
|
-
if (!val0) {
|
|
1652
|
-
return undefined;
|
|
1653
|
-
}
|
|
1654
|
-
const val1 = val0[path[1]];
|
|
1655
|
-
if (!val1) {
|
|
1656
|
-
return undefined;
|
|
1657
|
-
}
|
|
1658
|
-
return val1[path[2]];
|
|
1659
|
-
}
|
|
1660
|
-
case 4: {
|
|
1661
|
-
const val0 = object[path[0]];
|
|
1662
|
-
if (!val0) {
|
|
1663
|
-
return undefined;
|
|
1664
|
-
}
|
|
1665
|
-
const val1 = val0[path[1]];
|
|
1666
|
-
if (!val1) {
|
|
1667
|
-
return undefined;
|
|
1668
|
-
}
|
|
1669
|
-
const val2 = val1[path[2]];
|
|
1670
|
-
if (!val2) {
|
|
1671
|
-
return undefined;
|
|
1672
|
-
}
|
|
1673
|
-
return val2[path[3]];
|
|
1674
|
-
}
|
|
1675
|
-
default: {
|
|
1676
|
-
throw Error('path has too many segments');
|
|
1677
|
-
}
|
|
1678
|
-
}
|
|
1679
|
-
};
|
|
1680
|
-
|
|
1681
|
-
const getEmptyGeoLocation = () => ({
|
|
1682
|
-
accuracy: 0,
|
|
1683
|
-
altitude: 0,
|
|
1684
|
-
altitudeAccuracy: 0,
|
|
1685
|
-
geoPoint: [],
|
|
1686
|
-
lonLat: {
|
|
1687
|
-
lon: 0,
|
|
1688
|
-
lat: 0,
|
|
1689
|
-
},
|
|
1690
|
-
timestamp: ''
|
|
1691
|
-
});
|
|
1692
|
-
|
|
1693
|
-
const isArrayString = (value) => {
|
|
1694
|
-
return Array.isArray(value) && value.every(i => typeof i === 'string');
|
|
1695
|
-
};
|
|
1696
|
-
|
|
1697
|
-
/**
|
|
1698
|
-
* JobModel
|
|
1699
|
-
*/
|
|
1700
|
-
class VasJobModel extends VasRestrictedAccountObjectModel {
|
|
1701
|
-
constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account, accessGroup, reference, jobDate, jobStatus, jobType, assigneeId, formId, timeZoneOffset, pendingFields, childModified, version, fields, files, createdByDisplayName, modifiedByDisplayName, geoLocation) {
|
|
1702
|
-
super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account, accessGroup);
|
|
1703
|
-
this.id = id;
|
|
1704
|
-
this.created = created;
|
|
1705
|
-
this.serverCreated = serverCreated;
|
|
1706
|
-
this.createdBy = createdBy;
|
|
1707
|
-
this.modified = modified;
|
|
1708
|
-
this.serverModified = serverModified;
|
|
1709
|
-
this.modifiedBy = modifiedBy;
|
|
1710
|
-
this.createdByName = createdByName;
|
|
1711
|
-
this.modifiedByName = modifiedByName;
|
|
1712
|
-
this.account = account;
|
|
1713
|
-
this.accessGroup = accessGroup;
|
|
1714
|
-
this.reference = reference;
|
|
1715
|
-
this.jobDate = jobDate;
|
|
1716
|
-
this.jobStatus = jobStatus;
|
|
1717
|
-
this.jobType = jobType;
|
|
1718
|
-
this.assigneeId = assigneeId;
|
|
1719
|
-
this.formId = formId;
|
|
1720
|
-
this.timeZoneOffset = timeZoneOffset;
|
|
1721
|
-
this.pendingFields = pendingFields;
|
|
1722
|
-
this.childModified = childModified;
|
|
1723
|
-
this.version = version;
|
|
1724
|
-
this.fields = fields;
|
|
1725
|
-
this.files = files;
|
|
1726
|
-
this.createdByDisplayName = createdByDisplayName;
|
|
1727
|
-
this.modifiedByDisplayName = modifiedByDisplayName;
|
|
1728
|
-
this.geoLocation = geoLocation;
|
|
1729
|
-
}
|
|
1730
|
-
/**
|
|
1731
|
-
* Returns this with the dynamic interface
|
|
1732
|
-
* @return {VasJobModelDynamicInterface}
|
|
1733
|
-
*/
|
|
1734
|
-
get $this() {
|
|
1735
|
-
return this;
|
|
1736
|
-
}
|
|
1737
|
-
/**
|
|
1738
|
-
* Returns a list of Job dynamic properties i.e. those that are added by the
|
|
1739
|
-
* dynamic forms
|
|
1740
|
-
*/
|
|
1741
|
-
get dynamicProperties() {
|
|
1742
|
-
const nativeProps = this.staticProperties;
|
|
1743
|
-
return Object
|
|
1744
|
-
.getOwnPropertyNames(this)
|
|
1745
|
-
.filter(prop => !nativeProps.includes(prop));
|
|
1746
|
-
}
|
|
1747
|
-
/**
|
|
1748
|
-
* Returns the list of properties of the Job type
|
|
1749
|
-
*/
|
|
1750
|
-
get staticProperties() {
|
|
1751
|
-
return Object.getOwnPropertyNames(VasJobModel.empty());
|
|
1752
|
-
}
|
|
1753
|
-
/**
|
|
1754
|
-
* @return {VasJobModel}
|
|
1755
|
-
*/
|
|
1756
|
-
static empty() {
|
|
1757
|
-
return new VasJobModel('', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', moment$1().utcOffset(), 0, '', 0, [], [], '', '', getEmptyGeoLocation());
|
|
1758
|
-
}
|
|
1759
|
-
static fromDto(dto) {
|
|
1760
|
-
const model = new VasJobModel(dto.id || '', dto.created || '', dto.serverCreated || '', dto.createdBy || '', dto.modified || '', dto.serverModified || '', dto.modifiedBy || '', dto.createdByName || '', dto.modifiedByName || '', dto.account || '', dto.accessGroup || '', dto.reference || '', dto.jobDate || '', dto.jobStatus || '', dto.jobType || '', dto.assigneeId || '', dto.formId || '', dto.timeZoneOffset || moment$1().utcOffset(), dto.pendingFields || 0, dto.childModified || '', dto.version || 0, dto.fields || [], dto.files || [], dto.createdByDisplayName || '', dto.modifiedByDisplayName || '', dto.geoLocation || getEmptyGeoLocation());
|
|
1761
|
-
const emptyKeys = model.staticProperties;
|
|
1762
|
-
Object
|
|
1763
|
-
.keys(dto)
|
|
1764
|
-
.filter(key => emptyKeys.indexOf(key) === -1)
|
|
1765
|
-
.forEach((key) => model.$this[key] = dto[key]);
|
|
1766
|
-
return model;
|
|
1767
|
-
}
|
|
1768
|
-
/**
|
|
1769
|
-
* This method will instantiate a new JobModel. The difference with this
|
|
1770
|
-
* method of instantiation is that we are coming from a relation frame i.e.
|
|
1771
|
-
* the job has a list of {@link VasFieldDto} instead of a Job document.
|
|
1772
|
-
*
|
|
1773
|
-
*/
|
|
1774
|
-
static fromRelational(dto, form) {
|
|
1775
|
-
const model = new VasJobModel(dto.id || '', dto.created || '', dto.serverCreated || '', dto.createdBy || '', dto.modified || '', dto.serverModified || '', dto.modifiedBy || '', dto.createdByName || '', dto.modifiedByName || '', dto.account || '', dto.accessGroup || '', dto.reference || '', dto.jobDate || '', dto.jobStatus || '', dto.jobType || '', dto.assigneeId || '', dto.formId || '', dto.timeZoneOffset || moment$1().utcOffset(), dto.pendingFields || 0, dto.childModified || '', dto.version || 0, dto.fields || [], dto.files || [], dto.createdByDisplayName || '', dto.modifiedByDisplayName || '', dto.geoLocation || getEmptyGeoLocation());
|
|
1776
|
-
form.groups
|
|
1777
|
-
.forEach(group => {
|
|
1778
|
-
group.controls
|
|
1779
|
-
.forEach(control => {
|
|
1780
|
-
var _a;
|
|
1781
|
-
const field = (_a = dto.fields) === null || _a === void 0 ? void 0 : _a.find(f => f.control === control.id);
|
|
1782
|
-
if (!field) {
|
|
1783
|
-
return;
|
|
1784
|
-
}
|
|
1785
|
-
model.getGroup(group.name)[control.name] = field.value;
|
|
1786
|
-
});
|
|
1787
|
-
});
|
|
1788
|
-
return model;
|
|
1789
|
-
}
|
|
1790
|
-
/**
|
|
1791
|
-
* @param {VasFormModel} formModel
|
|
1792
|
-
* @return {Record<string, VasFieldDtoValue>}
|
|
1793
|
-
*/
|
|
1794
|
-
getFields(formModel) {
|
|
1795
|
-
const fields = {};
|
|
1796
|
-
formModel.groups
|
|
1797
|
-
.forEach(group => {
|
|
1798
|
-
group.controls.forEach(control => {
|
|
1799
|
-
(fields)[control.reportTemplateName] =
|
|
1800
|
-
this.getValueByPath([group.name, control.name]);
|
|
1801
|
-
});
|
|
1802
|
-
});
|
|
1803
|
-
return fields;
|
|
1804
|
-
}
|
|
1805
|
-
/**
|
|
1806
|
-
* Will return an object whose keys are the names of all fields in the job.
|
|
1807
|
-
* This method is similar to `getFields` except that this method will only
|
|
1808
|
-
* return values where a value was set, as opposed to `getFields` which will
|
|
1809
|
-
* return a value for every control even if not value was set, because it uses
|
|
1810
|
-
* the form to drive the logic. Note also this method will return values for
|
|
1811
|
-
* any Fields in the fields array.
|
|
1812
|
-
* @return {Record<string, VasFieldDtoValue>}
|
|
1813
|
-
*/
|
|
1814
|
-
getFields2() {
|
|
1815
|
-
let fields = {};
|
|
1816
|
-
this.dynamicProperties
|
|
1817
|
-
.forEach((groupName) => {
|
|
1818
|
-
Object
|
|
1819
|
-
.keys(this.$this[groupName])
|
|
1820
|
-
.forEach(controlName => {
|
|
1821
|
-
fields[controlName] = this.getValueByPath([groupName, controlName]);
|
|
1822
|
-
});
|
|
1823
|
-
}, {});
|
|
1824
|
-
this.fields.forEach(field => fields[field.controlName] = field.value);
|
|
1825
|
-
return fields;
|
|
1826
|
-
}
|
|
1827
|
-
/**
|
|
1828
|
-
* Returns an object describing how many attachments were added to this job
|
|
1829
|
-
* (camera controls and files), and how many have not been uploaded yet.
|
|
1830
|
-
*
|
|
1831
|
-
* @param formModel instance of {@link VasFormModel} that was used when the
|
|
1832
|
-
* job was created
|
|
1833
|
-
*/
|
|
1834
|
-
getFilesUploadStatus(formModel) {
|
|
1835
|
-
const pathsWithValue = formModel
|
|
1836
|
-
.getCameraControlPaths()
|
|
1837
|
-
.map(path => {
|
|
1838
|
-
const value = this.getValueByPath(path);
|
|
1839
|
-
if (value && !!value.id) {
|
|
1840
|
-
return path;
|
|
1841
|
-
}
|
|
1842
|
-
return null;
|
|
1843
|
-
})
|
|
1844
|
-
.filter(path => path !== null ? path : null)
|
|
1845
|
-
.filter(isArrayString);
|
|
1846
|
-
let total = pathsWithValue.length;
|
|
1847
|
-
total += this.files.length;
|
|
1848
|
-
// calculate the number of camera images still to upload
|
|
1849
|
-
let pending = pathsWithValue
|
|
1850
|
-
.map(path => this.getValueByPath(path))
|
|
1851
|
-
.map((value) => {
|
|
1852
|
-
if (isFileDto(value)) {
|
|
1853
|
-
return value.id && value.status !== 'COMPLETE';
|
|
1854
|
-
}
|
|
1855
|
-
else if (isCameraControlValueV1(value)) {
|
|
1856
|
-
// if url is not set, it hasn't been uploaded
|
|
1857
|
-
return value.id && !value.url;
|
|
1858
|
-
}
|
|
1859
|
-
return false;
|
|
1860
|
-
})
|
|
1861
|
-
.filter(hasUploaded => hasUploaded)
|
|
1862
|
-
.length;
|
|
1863
|
-
// add total from files that are pending
|
|
1864
|
-
pending += this.files
|
|
1865
|
-
.filter(value => value.status !== 'COMPLETE')
|
|
1866
|
-
.length;
|
|
1867
|
-
return {
|
|
1868
|
-
pending,
|
|
1869
|
-
total
|
|
1870
|
-
};
|
|
1871
|
-
}
|
|
1872
|
-
/**
|
|
1873
|
-
* This method will return the dynamic property from the JobModel that
|
|
1874
|
-
* represent a group (from a form).
|
|
1875
|
-
*
|
|
1876
|
-
* @param name the name of the group
|
|
1877
|
-
* @param init if true (default) and group is not found, initialise an empty
|
|
1878
|
-
* group, otherwise throw an error
|
|
1879
|
-
*/
|
|
1880
|
-
getGroup(name, init = true) {
|
|
1881
|
-
let prop;
|
|
1882
|
-
if (this.staticProperties.includes(name)) {
|
|
1883
|
-
throw Error(`invalid group name ${name}, not a dynamic property`);
|
|
1884
|
-
}
|
|
1885
|
-
else if (this.$this[name] === undefined) {
|
|
1886
|
-
if (init) {
|
|
1887
|
-
prop = this.$this[name] = {};
|
|
1888
|
-
}
|
|
1889
|
-
else {
|
|
1890
|
-
throw Error(`invalid group name ${name}, not found`);
|
|
1891
|
-
}
|
|
1892
|
-
}
|
|
1893
|
-
else {
|
|
1894
|
-
prop = this.$this[name];
|
|
1895
|
-
if (typeof prop !== 'object') {
|
|
1896
|
-
throw Error(`invalid group name ${name}, not an object`);
|
|
1897
|
-
}
|
|
1898
|
-
}
|
|
1899
|
-
return prop;
|
|
1900
|
-
}
|
|
1901
|
-
/**
|
|
1902
|
-
* @param path path segments
|
|
1903
|
-
*/
|
|
1904
|
-
getValueByPath(path = []) {
|
|
1905
|
-
return getValueByPath(path, this.$this);
|
|
1906
|
-
}
|
|
1907
|
-
/**
|
|
1908
|
-
* In order to understand why we need this method it is important to
|
|
1909
|
-
* understand that within the system, Jobs can be represented in one of two
|
|
1910
|
-
* ways, document and relational.
|
|
1911
|
-
*
|
|
1912
|
-
* The important distinction is how values submitted by a form are stored.
|
|
1913
|
-
*
|
|
1914
|
-
* Jobs stored as documents (JSON objects) will store user values, as dynamic
|
|
1915
|
-
* properties of the document.
|
|
1916
|
-
*
|
|
1917
|
-
* Whereas, Jobs stored as relational, will store user values in an array of
|
|
1918
|
-
* {@link VasFieldDto} objects.
|
|
1919
|
-
*
|
|
1920
|
-
* Depending on where we are in the system, either one of these approaches can
|
|
1921
|
-
* be more useful than the other.
|
|
1922
|
-
*
|
|
1923
|
-
* This method, assumes that the JobModel has been instantiated from a
|
|
1924
|
-
* document representation, and serves to hydrate the fields array. In order
|
|
1925
|
-
* to achieve this, knowledge of the {@link VasFormDto} that created the job
|
|
1926
|
-
* is required.
|
|
1927
|
-
*
|
|
1928
|
-
*
|
|
1929
|
-
* Job in document representation
|
|
1930
|
-
* {
|
|
1931
|
-
* id: <guid>,
|
|
1932
|
-
* reference: "something"
|
|
1933
|
-
* <other static job properties>...
|
|
1934
|
-
* foo: {
|
|
1935
|
-
* bar: "value"
|
|
1936
|
-
* }
|
|
1937
|
-
* }
|
|
1938
|
-
*
|
|
1939
|
-
* Job in relational representation
|
|
1940
|
-
* {
|
|
1941
|
-
* id: <guid>,
|
|
1942
|
-
* reference: "something"
|
|
1943
|
-
* <other static job properties>...
|
|
1944
|
-
* <will not have dynamic properties>...
|
|
1945
|
-
* fields: [
|
|
1946
|
-
* {
|
|
1947
|
-
* id: <guid>,
|
|
1948
|
-
* <other field properties>,
|
|
1949
|
-
* value: "value"
|
|
1950
|
-
* }
|
|
1951
|
-
* ]
|
|
1952
|
-
* }
|
|
1953
|
-
*
|
|
1954
|
-
*
|
|
1955
|
-
* @param formModel the VasFormModel that was used to create the job
|
|
1956
|
-
* @param controlFieldIdMap This is used to determine the id each field.
|
|
1957
|
-
* Either one will be found in the map, or a new one is generated.
|
|
1958
|
-
* @param controlNames if a value is provided, it will be used
|
|
1959
|
-
* to filter the fields that are returned.
|
|
1960
|
-
* @return {Array<VasFieldDto>}
|
|
1961
|
-
*/
|
|
1962
|
-
hydrateFields(formModel, controlFieldIdMap = new Map(), controlNames) {
|
|
1963
|
-
const fields = [];
|
|
1964
|
-
formModel.groups
|
|
1965
|
-
.forEach(group => {
|
|
1966
|
-
group.controls.forEach(control => {
|
|
1967
|
-
if (!control.name.startsWith('fields.')) {
|
|
1968
|
-
return;
|
|
1969
|
-
}
|
|
1970
|
-
if (controlNames && !controlNames.includes(control.name)) {
|
|
1971
|
-
return;
|
|
1972
|
-
}
|
|
1973
|
-
fields.push(VasFieldModel.fromDto({
|
|
1974
|
-
// if the controlId exists in the map, use the associated fieldId,
|
|
1975
|
-
// otherwise generate a new id for the field.
|
|
1976
|
-
id: controlFieldIdMap.get(control.id) || UUID.UUID(),
|
|
1977
|
-
account: this.account,
|
|
1978
|
-
job: this.id,
|
|
1979
|
-
createdBy: this.createdBy,
|
|
1980
|
-
created: this.created,
|
|
1981
|
-
modifiedBy: this.modifiedBy,
|
|
1982
|
-
modified: this.modified,
|
|
1983
|
-
control: control.id,
|
|
1984
|
-
value: this.getValueByPath([group.name, control.name])
|
|
1985
|
-
}));
|
|
1986
|
-
});
|
|
1987
|
-
});
|
|
1988
|
-
this.fields = fields;
|
|
1989
|
-
}
|
|
1990
|
-
/**
|
|
1991
|
-
* A very non sophisticated way to set values in the job via paths
|
|
1992
|
-
*
|
|
1993
|
-
* For example:
|
|
1994
|
-
*
|
|
1995
|
-
* setValueByPath('value', ['foo', 'bar']);
|
|
1996
|
-
*
|
|
1997
|
-
* will make results in job
|
|
1998
|
-
* {
|
|
1999
|
-
* foo: {
|
|
2000
|
-
* bar: 'value'
|
|
2001
|
-
* }
|
|
2002
|
-
* }
|
|
2003
|
-
*
|
|
2004
|
-
* @param value the value to set
|
|
2005
|
-
* @param path path segments
|
|
2006
|
-
*/
|
|
2007
|
-
setValueByPath(value, path = []) {
|
|
2008
|
-
switch (path.length) {
|
|
2009
|
-
case 0: {
|
|
2010
|
-
return;
|
|
2011
|
-
}
|
|
2012
|
-
case 1: {
|
|
2013
|
-
this[path[0]] = value;
|
|
2014
|
-
return;
|
|
2015
|
-
}
|
|
2016
|
-
case 2: {
|
|
2017
|
-
// eslint-disable-next-line max-len
|
|
2018
|
-
this.$this[path[0]][path[1]] = value;
|
|
2019
|
-
return;
|
|
2020
|
-
}
|
|
2021
|
-
case 3: {
|
|
2022
|
-
// eslint-disable-next-line max-len
|
|
2023
|
-
this.$this[path[0]][path[1]][path[2]] = value;
|
|
2024
|
-
return;
|
|
2025
|
-
}
|
|
2026
|
-
default: {
|
|
2027
|
-
throw Error('path has too many segments');
|
|
2028
|
-
}
|
|
2029
|
-
}
|
|
2030
|
-
}
|
|
2031
|
-
/**
|
|
2032
|
-
* @param staticOnly if true, will only output values for the static
|
|
2033
|
-
* properties in the dto
|
|
2034
|
-
*/
|
|
2035
|
-
toDto(staticOnly = false) {
|
|
2036
|
-
if (staticOnly) {
|
|
2037
|
-
return {
|
|
2038
|
-
id: this.id,
|
|
2039
|
-
created: this.created,
|
|
2040
|
-
createdBy: this.createdBy,
|
|
2041
|
-
modified: this.modified,
|
|
2042
|
-
modifiedBy: this.modifiedBy,
|
|
2043
|
-
serverCreated: this.serverCreated,
|
|
2044
|
-
serverModified: this.serverModified,
|
|
2045
|
-
createdByName: this.createdByName,
|
|
2046
|
-
modifiedByName: this.modifiedByName,
|
|
2047
|
-
account: this.account,
|
|
2048
|
-
accessGroup: this.accessGroup,
|
|
2049
|
-
reference: this.reference,
|
|
2050
|
-
jobDate: this.jobDate,
|
|
2051
|
-
jobStatus: this.jobStatus,
|
|
2052
|
-
jobType: this.jobType,
|
|
2053
|
-
assigneeId: this.assigneeId,
|
|
2054
|
-
formId: this.formId,
|
|
2055
|
-
timeZoneOffset: this.timeZoneOffset,
|
|
2056
|
-
pendingFields: this.pendingFields,
|
|
2057
|
-
childModified: this.childModified,
|
|
2058
|
-
version: this.version,
|
|
2059
|
-
fields: this.fields,
|
|
2060
|
-
files: this.files,
|
|
2061
|
-
createdByDisplayName: this.createdByDisplayName,
|
|
2062
|
-
modifiedByDisplayName: this.modifiedByDisplayName,
|
|
2063
|
-
geoLocation: this.geoLocation
|
|
2064
|
-
};
|
|
2065
|
-
}
|
|
2066
|
-
const dto = {};
|
|
2067
|
-
[...this.staticProperties, ...this.dynamicProperties]
|
|
2068
|
-
.forEach(prop => dto[prop] = this.$this[prop]);
|
|
2069
|
-
return dto;
|
|
2070
|
-
}
|
|
2071
|
-
/**
|
|
2072
|
-
* This method will parse a syntax that allows us to build strings from the
|
|
2073
|
-
* values of from the job model. For example if the job model was:
|
|
2074
|
-
*
|
|
2075
|
-
* {
|
|
2076
|
-
* foo: 'bar'
|
|
2077
|
-
* }
|
|
2078
|
-
*
|
|
2079
|
-
* and we pass "i am foo {foo}", the result would be:
|
|
2080
|
-
*
|
|
2081
|
-
* "i am foo bar"
|
|
2082
|
-
*
|
|
2083
|
-
* we can also use moment to parse dates, for example if the job model was:
|
|
2084
|
-
*
|
|
2085
|
-
* {
|
|
2086
|
-
* created: "2022-01-01T00:00:00+0000"
|
|
2087
|
-
* }
|
|
2088
|
-
*
|
|
2089
|
-
* and we pass "{created|date:YY-MM-DD}", the result would be:
|
|
2090
|
-
*
|
|
2091
|
-
* "2022-01-01"
|
|
2092
|
-
*
|
|
2093
|
-
* @param {string} value a string with the syntax
|
|
2094
|
-
* @param {ParseSyntaxOptions} options
|
|
2095
|
-
* @return the results of parsing the syntax on this job
|
|
2096
|
-
*/
|
|
2097
|
-
parseSyntax(value, options = {
|
|
2098
|
-
timeZoneOffset: 0
|
|
2099
|
-
}) {
|
|
2100
|
-
if (!value || typeof value !== 'string') {
|
|
2101
|
-
return '';
|
|
2102
|
-
}
|
|
2103
|
-
return value.replace(/({[^}]*})/g, (match, token) => {
|
|
2104
|
-
const syntax = token.substring(1, token.length - 1);
|
|
2105
|
-
let [key, filter] = syntax.split('|');
|
|
2106
|
-
key = (key || '').trim();
|
|
2107
|
-
filter = (filter || '').trim();
|
|
2108
|
-
let filterName, filterArg = '';
|
|
2109
|
-
if (filter) {
|
|
2110
|
-
const splitIndex = filter.indexOf(':');
|
|
2111
|
-
if (splitIndex !== -1) {
|
|
2112
|
-
filterName = filter.substring(0, splitIndex);
|
|
2113
|
-
filterArg = filter.substring(splitIndex + 1);
|
|
2114
|
-
}
|
|
2115
|
-
else {
|
|
2116
|
-
filterName = filter;
|
|
2117
|
-
filterArg = '';
|
|
2118
|
-
}
|
|
2119
|
-
filterName = (filterName || '').trim();
|
|
2120
|
-
filterArg = (filterArg || '').trim();
|
|
2121
|
-
}
|
|
2122
|
-
const path = key.split('.');
|
|
2123
|
-
const objectKey = path.shift() || '';
|
|
2124
|
-
let result = '';
|
|
2125
|
-
if (objectKey === 'job') {
|
|
2126
|
-
result = (this.getValueByPath(path) || '').toString();
|
|
2127
|
-
}
|
|
2128
|
-
else if (objectKey === 'fields') {
|
|
2129
|
-
result = (getValueByPath(['fields.' + path.shift(), ...path], this.getFields2()) || '').toString();
|
|
2130
|
-
}
|
|
2131
|
-
else if (objectKey.length) {
|
|
2132
|
-
if (options.objects) {
|
|
2133
|
-
if (options.objects[objectKey] === undefined) {
|
|
2134
|
-
console.debug(`objectKey ${objectKey} is not present in options.object`);
|
|
2135
|
-
result = '';
|
|
2136
|
-
}
|
|
2137
|
-
else {
|
|
2138
|
-
result = (getValueByPath(path, options.objects[objectKey]) || '')
|
|
2139
|
-
.toString();
|
|
2140
|
-
}
|
|
2141
|
-
}
|
|
2142
|
-
else {
|
|
2143
|
-
console.debug(`objectKey ${objectKey} was used but options.object is not set`);
|
|
2144
|
-
return '';
|
|
2145
|
-
}
|
|
2146
|
-
}
|
|
2147
|
-
else {
|
|
2148
|
-
return '';
|
|
2149
|
-
}
|
|
2150
|
-
if (filterName && result) {
|
|
2151
|
-
switch (filterName) {
|
|
2152
|
-
case 'date': {
|
|
2153
|
-
return moment$1(result)
|
|
2154
|
-
.utcOffset(options.timeZoneOffset)
|
|
2155
|
-
.format(filterArg || '');
|
|
2156
|
-
}
|
|
2157
|
-
default: {
|
|
2158
|
-
console.warn('unknown filter %s', filterName);
|
|
2159
|
-
}
|
|
2160
|
-
}
|
|
2161
|
-
}
|
|
2162
|
-
return result;
|
|
2163
|
-
}).trim();
|
|
2164
|
-
}
|
|
2165
|
-
;
|
|
2166
|
-
/**
|
|
2167
|
-
* @return {object}
|
|
2168
|
-
*/
|
|
2169
|
-
toApiDto() {
|
|
2170
|
-
return Object.assign(Object.assign({}, super.toApiDto()), { reference: this.reference || '~', jobDate: this.jobDate || '~', jobType: this.jobType || '~', accessGroup: this.accessGroup || '~', jobStatus: this.jobStatus || '~', assigneeId: this.assigneeId || '~', timeZoneOffset: this.timeZoneOffset || 0, pendingFields: this.pendingFields || 0, lastForm: this.formId || '~' });
|
|
2171
|
-
}
|
|
2172
|
-
}
|
|
2173
|
-
|
|
2174
|
-
/**
|
|
2175
|
-
* VasMembershipModel
|
|
2176
|
-
*/
|
|
2177
|
-
class VasMembershipModel extends VasAccountObjectModel {
|
|
2178
|
-
constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account, user, admin, lookupTypes, contactTypes, accessGroups, jobStatuses, jobTypes, taskTypes) {
|
|
2179
|
-
super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account);
|
|
2180
|
-
this.id = id;
|
|
2181
|
-
this.created = created;
|
|
2182
|
-
this.serverCreated = serverCreated;
|
|
2183
|
-
this.createdBy = createdBy;
|
|
2184
|
-
this.modified = modified;
|
|
2185
|
-
this.serverModified = serverModified;
|
|
2186
|
-
this.modifiedBy = modifiedBy;
|
|
2187
|
-
this.createdByName = createdByName;
|
|
2188
|
-
this.modifiedByName = modifiedByName;
|
|
2189
|
-
this.account = account;
|
|
2190
|
-
this.user = user;
|
|
2191
|
-
this.admin = admin;
|
|
2192
|
-
this.lookupTypes = lookupTypes;
|
|
2193
|
-
this.contactTypes = contactTypes;
|
|
2194
|
-
this.accessGroups = accessGroups;
|
|
2195
|
-
this.jobStatuses = jobStatuses;
|
|
2196
|
-
this.jobTypes = jobTypes;
|
|
2197
|
-
this.taskTypes = taskTypes;
|
|
2198
|
-
}
|
|
2199
|
-
static empty() {
|
|
2200
|
-
return VasMembershipModel.fromDto({
|
|
2201
|
-
// eslint-disable-next-line new-cap
|
|
2202
|
-
id: UUID.UUID()
|
|
2203
|
-
});
|
|
2204
|
-
}
|
|
2205
|
-
static fromDto(dto) {
|
|
2206
|
-
return new VasMembershipModel(
|
|
2207
|
-
// eslint-disable-next-line new-cap
|
|
2208
|
-
dto.id || '', dto.created || '', dto.serverCreated || '', dto.createdBy || '', dto.modified || '', dto.serverModified || '', dto.modifiedBy || '', dto.createdByName || '', dto.modifiedByName || '', dto.account || '', dto.user || '', dto.admin || false, dto.lookupTypes || [], dto.contactTypes || [], dto.accessGroups || [], dto.jobStatuses || [], dto.jobTypes || [], dto.taskTypes || []);
|
|
2209
|
-
}
|
|
2210
|
-
toDto() {
|
|
2211
|
-
return {
|
|
2212
|
-
id: this.id,
|
|
2213
|
-
created: this.created,
|
|
2214
|
-
serverCreated: this.serverCreated,
|
|
2215
|
-
createdBy: this.createdBy,
|
|
2216
|
-
modified: this.modified,
|
|
2217
|
-
serverModified: this.serverModified,
|
|
2218
|
-
modifiedBy: this.modifiedBy,
|
|
2219
|
-
createdByName: this.createdByName,
|
|
2220
|
-
modifiedByName: this.modifiedByName,
|
|
2221
|
-
account: this.account,
|
|
2222
|
-
user: this.user,
|
|
2223
|
-
admin: this.admin,
|
|
2224
|
-
lookupTypes: this.lookupTypes,
|
|
2225
|
-
contactTypes: this.contactTypes,
|
|
2226
|
-
accessGroups: this.accessGroups,
|
|
2227
|
-
jobStatuses: this.jobStatuses,
|
|
2228
|
-
jobTypes: this.jobTypes,
|
|
2229
|
-
taskTypes: this.taskTypes
|
|
2230
|
-
};
|
|
2231
|
-
}
|
|
2232
|
-
}
|
|
2233
|
-
|
|
2234
|
-
class VasReportLayoutModel extends VasRestrictedAccountObjectModel {
|
|
2235
|
-
constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account, accessGroup, jobType, title, description, entryPoint) {
|
|
2236
|
-
super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account, accessGroup);
|
|
2237
|
-
this.id = id;
|
|
2238
|
-
this.created = created;
|
|
2239
|
-
this.serverCreated = serverCreated;
|
|
2240
|
-
this.createdBy = createdBy;
|
|
2241
|
-
this.modified = modified;
|
|
2242
|
-
this.serverModified = serverModified;
|
|
2243
|
-
this.modifiedBy = modifiedBy;
|
|
2244
|
-
this.createdByName = createdByName;
|
|
2245
|
-
this.modifiedByName = modifiedByName;
|
|
2246
|
-
this.account = account;
|
|
2247
|
-
this.accessGroup = accessGroup;
|
|
2248
|
-
this.jobType = jobType;
|
|
2249
|
-
this.title = title;
|
|
2250
|
-
this.description = description;
|
|
2251
|
-
this.entryPoint = entryPoint;
|
|
2252
|
-
}
|
|
2253
|
-
}
|
|
2254
|
-
|
|
2255
|
-
class VasReportRequestModel extends VasAccountObjectModel {
|
|
2256
|
-
constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account, error, jobId, title, url, reportId) {
|
|
2257
|
-
super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account);
|
|
2258
|
-
this.id = id;
|
|
2259
|
-
this.created = created;
|
|
2260
|
-
this.serverCreated = serverCreated;
|
|
2261
|
-
this.createdBy = createdBy;
|
|
2262
|
-
this.modified = modified;
|
|
2263
|
-
this.serverModified = serverModified;
|
|
2264
|
-
this.modifiedBy = modifiedBy;
|
|
2265
|
-
this.createdByName = createdByName;
|
|
2266
|
-
this.modifiedByName = modifiedByName;
|
|
2267
|
-
this.account = account;
|
|
2268
|
-
this.error = error;
|
|
2269
|
-
this.jobId = jobId;
|
|
2270
|
-
this.title = title;
|
|
2271
|
-
this.url = url;
|
|
2272
|
-
this.reportId = reportId;
|
|
2273
|
-
}
|
|
2274
|
-
static fromDto(dto) {
|
|
2275
|
-
return new VasReportRequestModel(dto.id || '', dto.created || '', dto.serverCreated || '', dto.createdBy || '', dto.modified || '', dto.serverModified || '', dto.modifiedBy || '', dto.createdByName || '', dto.modifiedByName || '', dto.account || '', dto.error || '', dto.jobId || '', dto.title || '', dto.url || '', dto.reportId || '');
|
|
2276
|
-
}
|
|
2277
|
-
toDto() {
|
|
2278
|
-
return {
|
|
2279
|
-
id: this.id,
|
|
2280
|
-
created: this.created,
|
|
2281
|
-
serverCreated: this.serverCreated,
|
|
2282
|
-
createdBy: this.createdBy,
|
|
2283
|
-
modified: this.modified,
|
|
2284
|
-
serverModified: this.serverModified,
|
|
2285
|
-
modifiedBy: this.modifiedBy,
|
|
2286
|
-
createdByName: this.createdByName,
|
|
2287
|
-
modifiedByName: this.modifiedByName,
|
|
2288
|
-
account: this.account,
|
|
2289
|
-
error: this.error,
|
|
2290
|
-
jobId: this.jobId,
|
|
2291
|
-
title: this.title,
|
|
2292
|
-
url: this.url,
|
|
2293
|
-
reportId: this.reportId
|
|
2294
|
-
};
|
|
2295
|
-
}
|
|
2296
|
-
}
|
|
2297
|
-
|
|
2298
|
-
class VasVehicleModel extends VasAccountObjectModel {
|
|
2299
|
-
constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account, registration, make, model, archived, description) {
|
|
2300
|
-
super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account);
|
|
2301
|
-
this.id = id;
|
|
2302
|
-
this.created = created;
|
|
2303
|
-
this.serverCreated = serverCreated;
|
|
2304
|
-
this.createdBy = createdBy;
|
|
2305
|
-
this.modified = modified;
|
|
2306
|
-
this.serverModified = serverModified;
|
|
2307
|
-
this.modifiedBy = modifiedBy;
|
|
2308
|
-
this.createdByName = createdByName;
|
|
2309
|
-
this.modifiedByName = modifiedByName;
|
|
2310
|
-
this.account = account;
|
|
2311
|
-
this.registration = registration;
|
|
2312
|
-
this.make = make;
|
|
2313
|
-
this.model = model;
|
|
2314
|
-
this.archived = archived;
|
|
2315
|
-
this.description = description;
|
|
2316
|
-
}
|
|
2317
|
-
static fromDto(dto) {
|
|
2318
|
-
return new VasVehicleModel(dto.id || '', dto.created || '', dto.serverCreated || '', dto.createdBy || '', dto.modified || '', dto.serverModified || '', dto.modifiedBy || '', dto.createdByName || '', dto.modifiedByName || '', dto.account || '', dto.registration || '', dto.make || '', dto.model || '', dto.archived || false, dto.description || '');
|
|
2319
|
-
}
|
|
2320
|
-
toDto() {
|
|
2321
|
-
return {
|
|
2322
|
-
id: this.id,
|
|
2323
|
-
created: this.created,
|
|
2324
|
-
serverCreated: this.serverCreated,
|
|
2325
|
-
createdBy: this.createdBy,
|
|
2326
|
-
modified: this.modified,
|
|
2327
|
-
serverModified: this.serverModified,
|
|
2328
|
-
modifiedBy: this.modifiedBy,
|
|
2329
|
-
createdByName: this.createdByName,
|
|
2330
|
-
modifiedByName: this.modifiedByName,
|
|
2331
|
-
account: this.account,
|
|
2332
|
-
registration: this.registration,
|
|
2333
|
-
make: this.make,
|
|
2334
|
-
model: this.model,
|
|
2335
|
-
archived: this.archived,
|
|
2336
|
-
description: this.description
|
|
2337
|
-
};
|
|
2338
|
-
}
|
|
2339
|
-
toApiDto(options) {
|
|
2340
|
-
return {
|
|
2341
|
-
id: this.id,
|
|
2342
|
-
created: this.created,
|
|
2343
|
-
modified: this.modified,
|
|
2344
|
-
account: this.account,
|
|
2345
|
-
registration: this.registration,
|
|
2346
|
-
make: this.make,
|
|
2347
|
-
model: this.model,
|
|
2348
|
-
archived: this.archived,
|
|
2349
|
-
description: this.description
|
|
2350
|
-
};
|
|
2351
|
-
}
|
|
2352
|
-
}
|
|
2353
|
-
|
|
2354
|
-
/**
|
|
2355
|
-
* Generated bundle index. Do not edit.
|
|
2356
|
-
*/
|
|
2357
|
-
|
|
2358
|
-
export { VasAccountIndexingMode, VasAccountObjectModel, VasBaseModel, VasBranchModel, VasContactModel, VasControlConfigDirection, VasControlModel, VasControlTypeModel, VasFieldModel, VasFileModel, VasFireUserModel, VasFormConfigModel, VasFormModel, VasGroupModel, VasInstructionJobFieldModel, VasInstructionJobModel, VasInstructionModel, VasInstructionProviderModel, VasInvitationModel, VasInvitationTypeEnum, VasJobDataModel, VasJobEmailModel, VasJobModel, VasMembershipModel, VasNoteModel, VasReportLayoutModel, VasReportModel, VasReportRequestModel, VasRestrictedAccountObjectModel, VasUserModel, VasVehicleModel, getEmptyGeoLocation, isCameraControlValueV1, isFileDto };
|
|
2359
|
-
//# sourceMappingURL=ironcode-vas-lib.mjs.map
|