@ironcode/vas-lib 3.0.0-alpha.2 → 3.0.0-alpha.23
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/vas-camera-control-value.model.d.ts +4 -2
- package/cjs/lib/control-value/vas-camera-control-value.model.d.ts.map +1 -1
- package/cjs/lib/control-value/vas-camera-control-value.model.js.map +1 -1
- package/cjs/lib/entity/vas-base.model.d.ts +1 -1
- package/cjs/lib/entity/vas-base.model.d.ts.map +1 -1
- package/cjs/lib/entity/vas-base.model.js.map +1 -1
- package/cjs/lib/entity/vas-field.dto.d.ts +3 -4
- 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.js +1 -1
- package/cjs/lib/entity/vas-field.model.js.map +1 -1
- package/cjs/lib/entity/vas-form.model.d.ts +1 -1
- package/cjs/lib/entity/vas-form.model.d.ts.map +1 -1
- package/cjs/lib/entity/vas-form.model.js +1 -1
- package/cjs/lib/entity/vas-form.model.js.map +1 -1
- package/cjs/lib/entity/vas-job-copy.d.ts +12 -12
- package/cjs/lib/entity/vas-job-copy.d.ts.map +1 -1
- package/cjs/lib/entity/vas-job-copy.js.map +1 -1
- package/cjs/lib/entity/vas-job.dto.d.ts +12 -3
- 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 +30 -13
- package/cjs/lib/entity/vas-job.model.d.ts.map +1 -1
- package/cjs/lib/entity/vas-job.model.js +273 -95
- package/cjs/lib/entity/vas-job.model.js.map +1 -1
- package/cjs/lib/model/estimate-control/estimate-control-value.dto.d.ts +14 -0
- package/cjs/lib/model/estimate-control/estimate-control-value.dto.d.ts.map +1 -0
- package/cjs/lib/model/estimate-control/estimate-control-value.dto.js +3 -0
- package/cjs/lib/model/estimate-control/estimate-control-value.dto.js.map +1 -0
- package/cjs/lib/model/estimate-control/estimate-control-value.model.d.ts +11 -0
- package/cjs/lib/model/estimate-control/estimate-control-value.model.d.ts.map +1 -0
- package/cjs/lib/model/estimate-control/estimate-control-value.model.js +84 -0
- package/cjs/lib/model/estimate-control/estimate-control-value.model.js.map +1 -0
- package/cjs/lib/model/estimate-control/estimate-item.dto.d.ts +17 -0
- package/cjs/lib/model/estimate-control/estimate-item.dto.d.ts.map +1 -0
- package/cjs/lib/model/estimate-control/estimate-item.dto.js +3 -0
- package/cjs/lib/model/estimate-control/estimate-item.dto.js.map +1 -0
- package/cjs/lib/model/estimate-control/estimate-item.model.d.ts +25 -0
- package/cjs/lib/model/estimate-control/estimate-item.model.d.ts.map +1 -0
- package/cjs/lib/model/estimate-control/estimate-item.model.js +126 -0
- package/cjs/lib/model/estimate-control/estimate-item.model.js.map +1 -0
- package/cjs/lib/model/estimate-control/estimate-source.d.ts +2 -0
- package/cjs/lib/model/estimate-control/estimate-source.d.ts.map +1 -0
- package/cjs/lib/model/estimate-control/estimate-source.js +3 -0
- package/cjs/lib/model/estimate-control/estimate-source.js.map +1 -0
- package/cjs/lib/model/estimate-control/estimate.dto.d.ts +38 -0
- package/cjs/lib/model/estimate-control/estimate.dto.d.ts.map +1 -0
- package/cjs/lib/model/estimate-control/estimate.dto.js +3 -0
- package/cjs/lib/model/estimate-control/estimate.dto.js.map +1 -0
- package/cjs/lib/model/estimate-control/estimate.model.d.ts +55 -0
- package/cjs/lib/model/estimate-control/estimate.model.d.ts.map +1 -0
- package/cjs/lib/model/estimate-control/estimate.model.js +278 -0
- package/cjs/lib/model/estimate-control/estimate.model.js.map +1 -0
- package/cjs/lib/model/estimate-control/estimate.types.d.ts +3 -0
- package/cjs/lib/model/estimate-control/estimate.types.d.ts.map +1 -0
- package/cjs/lib/model/estimate-control/estimate.types.js +3 -0
- package/cjs/lib/model/estimate-control/estimate.types.js.map +1 -0
- package/cjs/lib/model/estimate-control/index.d.ts +9 -0
- package/cjs/lib/model/estimate-control/index.d.ts.map +1 -0
- package/cjs/lib/model/estimate-control/index.js +11 -0
- package/cjs/lib/model/estimate-control/index.js.map +1 -0
- package/cjs/lib/model/index.d.ts +2 -0
- package/cjs/lib/model/index.d.ts.map +1 -1
- package/cjs/lib/model/index.js +2 -0
- package/cjs/lib/model/index.js.map +1 -1
- package/cjs/lib/model/report-invocation.d.ts +40 -0
- package/cjs/lib/model/report-invocation.d.ts.map +1 -0
- package/cjs/lib/model/report-invocation.js +3 -0
- package/cjs/lib/model/report-invocation.js.map +1 -0
- package/cjs/lib/utils/get-value-by-path.d.ts +5 -15
- package/cjs/lib/utils/get-value-by-path.d.ts.map +1 -1
- package/cjs/lib/utils/get-value-by-path.js +48 -59
- package/cjs/lib/utils/get-value-by-path.js.map +1 -1
- package/cjs/lib/utils/index.d.ts +8 -0
- package/cjs/lib/utils/index.d.ts.map +1 -0
- package/cjs/lib/utils/index.js +11 -0
- package/cjs/lib/utils/index.js.map +1 -0
- package/cjs/lib/utils/is-array-string.d.ts +3 -0
- package/cjs/lib/utils/is-array-string.d.ts.map +1 -1
- package/cjs/lib/utils/is-array-string.js +3 -0
- package/cjs/lib/utils/is-array-string.js.map +1 -1
- package/cjs/lib/utils/is-numeric.d.ts +2 -0
- package/cjs/lib/utils/is-numeric.d.ts.map +1 -0
- package/cjs/lib/utils/is-numeric.js +10 -0
- package/cjs/lib/utils/is-numeric.js.map +1 -0
- package/cjs/lib/utils/is-plain-object.d.ts +3 -0
- package/cjs/lib/utils/is-plain-object.d.ts.map +1 -1
- package/cjs/lib/utils/is-plain-object.js +3 -0
- package/cjs/lib/utils/is-plain-object.js.map +1 -1
- package/cjs/lib/utils/try-json.d.ts +2 -2
- package/cjs/lib/utils/try-json.js +2 -2
- package/cjs/lib/utils/try-json.js.map +1 -1
- 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/fesm2022/ironcode-vas-lib.mjs +841 -149
- package/fesm2022/ironcode-vas-lib.mjs.map +1 -1
- package/lib/control-value/vas-camera-control-value.model.d.ts +4 -2
- package/lib/entity/vas-base.model.d.ts +1 -1
- package/lib/entity/vas-field.dto.d.ts +3 -4
- package/lib/entity/vas-form.model.d.ts +1 -1
- package/lib/entity/vas-job-copy.d.ts +12 -12
- package/lib/entity/vas-job.dto.d.ts +12 -3
- package/lib/entity/vas-job.model.d.ts +30 -13
- package/lib/model/estimate-control/estimate-control-value.dto.d.ts +13 -0
- package/lib/model/estimate-control/estimate-control-value.model.d.ts +10 -0
- package/lib/model/estimate-control/estimate-item.dto.d.ts +16 -0
- package/lib/model/estimate-control/estimate-item.model.d.ts +24 -0
- package/lib/model/estimate-control/estimate-source.d.ts +1 -0
- package/lib/model/estimate-control/estimate.dto.d.ts +37 -0
- package/lib/model/estimate-control/estimate.model.d.ts +54 -0
- package/lib/model/estimate-control/estimate.types.d.ts +2 -0
- package/lib/model/estimate-control/index.d.ts +8 -0
- package/lib/model/index.d.ts +2 -0
- package/lib/model/report-invocation.d.ts +39 -0
- package/lib/utils/get-value-by-path.d.ts +5 -15
- package/lib/utils/index.d.ts +7 -0
- package/lib/utils/is-array-string.d.ts +4 -0
- package/lib/utils/is-numeric.d.ts +1 -0
- package/lib/utils/is-plain-object.d.ts +3 -0
- package/lib/utils/omit.d.ts +7 -0
- package/lib/utils/try-json.d.ts +2 -2
- package/package.json +3 -2
- package/public-api.d.ts +1 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.VasJobDocumentModel = exports.VasJobRelationalModel = exports.VasJobBaseModel = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const vas_file_dto_1 = require("./vas-file.dto");
|
|
6
6
|
const moment_1 = tslib_1.__importDefault(require("moment"));
|
|
@@ -8,21 +8,38 @@ const get_value_by_path_1 = require("../utils/get-value-by-path");
|
|
|
8
8
|
const vas_restricted_account_object_model_1 = require("./vas-restricted-account-object.model");
|
|
9
9
|
const model_1 = require("../model");
|
|
10
10
|
const control_value_1 = require("../control-value");
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
11
|
+
const utils_1 = require("../utils");
|
|
12
|
+
const vas_field_model_1 = require("./vas-field.model");
|
|
13
|
+
const nullables = new Set([
|
|
14
|
+
'created',
|
|
15
|
+
'modified',
|
|
16
|
+
'reference',
|
|
17
|
+
'jobDate',
|
|
18
|
+
'followUpDate',
|
|
19
|
+
'followUpStatus',
|
|
20
|
+
'followUpNote',
|
|
21
|
+
]);
|
|
14
22
|
let jobStaticProps;
|
|
15
|
-
function
|
|
23
|
+
function getStaticProps() {
|
|
16
24
|
if (jobStaticProps) {
|
|
17
25
|
return jobStaticProps;
|
|
18
26
|
}
|
|
19
|
-
return jobStaticProps = new Set(
|
|
27
|
+
return jobStaticProps = new Set([
|
|
28
|
+
...Object.getOwnPropertyNames(VasJobDocumentModel.empty()),
|
|
29
|
+
'assignee'
|
|
30
|
+
]);
|
|
31
|
+
}
|
|
32
|
+
function isArrayOfFields(value) {
|
|
33
|
+
return !!value && Array.isArray(value);
|
|
34
|
+
}
|
|
35
|
+
function isDictionaryOfFields(value) {
|
|
36
|
+
return !!value && (0, utils_1.isPlainObject)(value);
|
|
20
37
|
}
|
|
21
38
|
/**
|
|
22
|
-
*
|
|
39
|
+
* VasJobBaseModel
|
|
23
40
|
*/
|
|
24
|
-
class
|
|
25
|
-
constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account, accessGroup, reference, jobDate, jobStatus, jobType, assigneeId, formId, timeZoneOffset, pendingFields, childModified, version, geoLocation, files, fields, jobEmails, notes, reports, tasks, instruction) {
|
|
41
|
+
class VasJobBaseModel extends vas_restricted_account_object_model_1.VasRestrictedAccountObjectModel {
|
|
42
|
+
constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account, accessGroup, reference, jobDate, jobStatus, jobStatusLastUpdate, jobType, assigneeId, formId, timeZoneOffset, pendingFields, childModified, version, followUpDate, followUpStatus, followUpNote, geoLocation, files, fields, jobEmails, notes, reports, tasks, instruction) {
|
|
26
43
|
super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account, accessGroup);
|
|
27
44
|
this.id = id;
|
|
28
45
|
this.created = created;
|
|
@@ -38,6 +55,7 @@ class VasJobModel extends vas_restricted_account_object_model_1.VasRestrictedAcc
|
|
|
38
55
|
this.reference = reference;
|
|
39
56
|
this.jobDate = jobDate;
|
|
40
57
|
this.jobStatus = jobStatus;
|
|
58
|
+
this.jobStatusLastUpdate = jobStatusLastUpdate;
|
|
41
59
|
this.jobType = jobType;
|
|
42
60
|
this.assigneeId = assigneeId;
|
|
43
61
|
this.formId = formId;
|
|
@@ -45,6 +63,9 @@ class VasJobModel extends vas_restricted_account_object_model_1.VasRestrictedAcc
|
|
|
45
63
|
this.pendingFields = pendingFields;
|
|
46
64
|
this.childModified = childModified;
|
|
47
65
|
this.version = version;
|
|
66
|
+
this.followUpDate = followUpDate;
|
|
67
|
+
this.followUpStatus = followUpStatus;
|
|
68
|
+
this.followUpNote = followUpNote;
|
|
48
69
|
this.geoLocation = geoLocation;
|
|
49
70
|
this.files = files;
|
|
50
71
|
this.fields = fields;
|
|
@@ -64,52 +85,7 @@ class VasJobModel extends vas_restricted_account_object_model_1.VasRestrictedAcc
|
|
|
64
85
|
* Return the list of Job properties
|
|
65
86
|
*/
|
|
66
87
|
get staticProperties() {
|
|
67
|
-
|
|
68
|
-
return jobStaticProps;
|
|
69
|
-
}
|
|
70
|
-
return jobStaticProps = new Set(Object.getOwnPropertyNames(VasJobModel.empty()));
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* @return {VasJobModel}
|
|
74
|
-
*/
|
|
75
|
-
static empty() {
|
|
76
|
-
return new VasJobModel('', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', (0, moment_1.default)().utcOffset(), 0, '', 0, (0, model_1.getEmptyGeoLocation)(), [], {}, [], [], [], [], null);
|
|
77
|
-
}
|
|
78
|
-
static fromDto(dto) {
|
|
79
|
-
// we have changed the job model and stopped using the dynamic properties
|
|
80
|
-
// from form group names to hold fields. Instead, we store a simple object
|
|
81
|
-
// where the control name (minus the "fields." prefix) is the key, and the
|
|
82
|
-
// field value is the value. However, we have to cater for data that may
|
|
83
|
-
// be persisted in the old structure, or an API response where fields is an
|
|
84
|
-
// array of VasFieldDto.
|
|
85
|
-
// 1: if dto.fields is already an object, we use the existing value
|
|
86
|
-
const fields = (0, is_plain_object_1.isPlainObject)(dto.fields) ?
|
|
87
|
-
dto.fields :
|
|
88
|
-
{};
|
|
89
|
-
// 2: if dto.fields is an array, we're handling a vas-rest response, we
|
|
90
|
-
// iterate over the fields and update the fields object.
|
|
91
|
-
Array.isArray(dto.fields) && dto.fields.forEach((field) => {
|
|
92
|
-
fields[field.controlName.replace('fields.', '')] = (0, try_json_1.tryJson)(field.value);
|
|
93
|
-
});
|
|
94
|
-
// 3: if `fields` still has no keys, we're restoring a VasJobDto object that
|
|
95
|
-
// was saved in the old "form-group" style, where dynamic keys are
|
|
96
|
-
// derived from the form-group names. We'll iterate over those keys, and
|
|
97
|
-
// update the `fields` object. Once this model is serialized back to a
|
|
98
|
-
// dto, it will have the new shape.
|
|
99
|
-
if (Object.keys(fields).length === 0) {
|
|
100
|
-
Object
|
|
101
|
-
.keys(dto)
|
|
102
|
-
.filter(key => !getJobStaticProperties().has(key))
|
|
103
|
-
.forEach(groupName => {
|
|
104
|
-
Object
|
|
105
|
-
.keys(dto[groupName])
|
|
106
|
-
.forEach(controlName => {
|
|
107
|
-
const cn = controlName.replace('fields.', '');
|
|
108
|
-
fields[cn] = dto[groupName][controlName];
|
|
109
|
-
});
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
return 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.lastForm || '', dto.timeZoneOffset || (0, moment_1.default)().utcOffset(), dto.pendingFields || 0, dto.childModified || '', dto.version || 0, dto.geoLocation || (0, model_1.getEmptyGeoLocation)(), dto.files || [], fields, dto.jobEmails || [], dto.notes || [], dto.reports || [], dto.tasks || [], dto.instruction || null);
|
|
88
|
+
return getStaticProps();
|
|
113
89
|
}
|
|
114
90
|
/**
|
|
115
91
|
* Returns an object describing how many attachments were added to this job
|
|
@@ -150,39 +126,6 @@ class VasJobModel extends vas_restricted_account_object_model_1.VasRestrictedAcc
|
|
|
150
126
|
getValueByPath(path = []) {
|
|
151
127
|
return (0, get_value_by_path_1.getValueByPath)(Array.isArray(path) ? path : path.split('.'), this);
|
|
152
128
|
}
|
|
153
|
-
toDto() {
|
|
154
|
-
return {
|
|
155
|
-
id: this.id,
|
|
156
|
-
created: this.created,
|
|
157
|
-
createdBy: this.createdBy,
|
|
158
|
-
modified: this.modified,
|
|
159
|
-
modifiedBy: this.modifiedBy,
|
|
160
|
-
serverCreated: this.serverCreated,
|
|
161
|
-
serverModified: this.serverModified,
|
|
162
|
-
createdByName: this.createdByName,
|
|
163
|
-
modifiedByName: this.modifiedByName,
|
|
164
|
-
account: this.account,
|
|
165
|
-
accessGroup: this.accessGroup,
|
|
166
|
-
reference: this.reference,
|
|
167
|
-
jobDate: this.jobDate,
|
|
168
|
-
jobStatus: this.jobStatus,
|
|
169
|
-
jobType: this.jobType,
|
|
170
|
-
assigneeId: this.assigneeId,
|
|
171
|
-
formId: this.formId,
|
|
172
|
-
timeZoneOffset: this.timeZoneOffset,
|
|
173
|
-
pendingFields: this.pendingFields,
|
|
174
|
-
childModified: this.childModified,
|
|
175
|
-
version: this.version,
|
|
176
|
-
geoLocation: this.geoLocation,
|
|
177
|
-
files: this.files,
|
|
178
|
-
fields: this.fields,
|
|
179
|
-
jobEmails: this.jobEmails,
|
|
180
|
-
notes: this.notes,
|
|
181
|
-
reports: this.reports,
|
|
182
|
-
tasks: this.tasks,
|
|
183
|
-
instruction: this.instruction
|
|
184
|
-
};
|
|
185
|
-
}
|
|
186
129
|
/**
|
|
187
130
|
* This method will parse a syntax that allows us to build strings from the
|
|
188
131
|
* values of from the job model. For example if the job model was:
|
|
@@ -215,7 +158,6 @@ class VasJobModel extends vas_restricted_account_object_model_1.VasRestrictedAcc
|
|
|
215
158
|
if (!value || typeof value !== 'string') {
|
|
216
159
|
return '';
|
|
217
160
|
}
|
|
218
|
-
const fields = this.fields;
|
|
219
161
|
return value.replace(/({[^}]*})/g, (match, token) => {
|
|
220
162
|
const syntax = token.substring(1, token.length - 1);
|
|
221
163
|
let [key, filter] = syntax.split('|');
|
|
@@ -241,8 +183,8 @@ class VasJobModel extends vas_restricted_account_object_model_1.VasRestrictedAcc
|
|
|
241
183
|
if (objectKey === 'job') {
|
|
242
184
|
result = (this.getValueByPath(path) || '').toString();
|
|
243
185
|
}
|
|
244
|
-
else if (objectKey === 'fields'
|
|
245
|
-
result = (
|
|
186
|
+
else if (objectKey === 'fields') {
|
|
187
|
+
result = (this.getValueByPath(['fields', ...path]) || '').toString();
|
|
246
188
|
}
|
|
247
189
|
else if (objectKey.length && options.objects && options.objects[objectKey] !== undefined) {
|
|
248
190
|
result = ((0, get_value_by_path_1.getValueByPath)(path, options.objects[objectKey]) || '').toString();
|
|
@@ -278,7 +220,7 @@ class VasJobModel extends vas_restricted_account_object_model_1.VasRestrictedAcc
|
|
|
278
220
|
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 || '~' });
|
|
279
221
|
}
|
|
280
222
|
static toApiPatchDto(item) {
|
|
281
|
-
return (0,
|
|
223
|
+
return (0, utils_1.only)(item, [
|
|
282
224
|
'created',
|
|
283
225
|
'modified',
|
|
284
226
|
'reference',
|
|
@@ -289,9 +231,245 @@ class VasJobModel extends vas_restricted_account_object_model_1.VasRestrictedAcc
|
|
|
289
231
|
'assigneeId',
|
|
290
232
|
'timeZoneOffset',
|
|
291
233
|
'pendingFields',
|
|
292
|
-
'formId'
|
|
293
|
-
|
|
234
|
+
'formId',
|
|
235
|
+
'followUpDate',
|
|
236
|
+
'followUpStatus',
|
|
237
|
+
'followUpNote',
|
|
238
|
+
], (value, key) => value[key] === null && nullables.has(key) ? '~' : value[key]);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
exports.VasJobBaseModel = VasJobBaseModel;
|
|
242
|
+
class VasJobRelationalModel extends VasJobBaseModel {
|
|
243
|
+
getValueByPath(path = []) {
|
|
244
|
+
const parts = Array.isArray(path) ? path : path.split('.');
|
|
245
|
+
if (parts[0] === 'fields') {
|
|
246
|
+
return this.getFieldValueByPath(parts[1], parts.slice(2));
|
|
247
|
+
}
|
|
248
|
+
return (0, get_value_by_path_1.getValueByPath)(parts, this);
|
|
249
|
+
}
|
|
250
|
+
getFieldsMap() {
|
|
251
|
+
return this.fields.reduce((p, c) => {
|
|
252
|
+
p[c.controlName] = c.value;
|
|
253
|
+
return p;
|
|
254
|
+
}, {});
|
|
255
|
+
}
|
|
256
|
+
getFieldValueByPath(controlName, path) {
|
|
257
|
+
for (const field of this.fields) {
|
|
258
|
+
if (field.controlName === controlName) {
|
|
259
|
+
if (path.length === 0) {
|
|
260
|
+
return field.value;
|
|
261
|
+
}
|
|
262
|
+
if (field.value === null) {
|
|
263
|
+
return path.length >= 1 ? undefined : null;
|
|
264
|
+
}
|
|
265
|
+
if ((0, utils_1.isPlainObject)(field.value)) {
|
|
266
|
+
return (0, get_value_by_path_1.getValueByPath)(path, field.value);
|
|
267
|
+
}
|
|
268
|
+
return undefined;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
return undefined;
|
|
272
|
+
}
|
|
273
|
+
static fromDto(dto) {
|
|
274
|
+
if (dto.fields !== undefined && !Array.isArray(dto.fields)) {
|
|
275
|
+
throw Error('fields must be an array');
|
|
276
|
+
}
|
|
277
|
+
return new VasJobRelationalModel(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.jobStatusLastUpdate || '', dto.jobType || '', dto.assigneeId || '', dto.formId || dto.lastForm || '', dto.timeZoneOffset || (0, moment_1.default)().utcOffset(), dto.pendingFields || 0, dto.childModified || '', dto.version || 0, dto.followUpDate || '', dto.followUpStatus || '', dto.followUpNote || '', dto.geoLocation || (0, model_1.getEmptyGeoLocation)(), dto.files || [], (dto.fields || []).map(f => vas_field_model_1.VasFieldModel.fromDto(f)), dto.jobEmails || [], dto.notes || [], dto.reports || [], dto.tasks || [], dto.instruction || null);
|
|
278
|
+
}
|
|
279
|
+
static empty() {
|
|
280
|
+
return new VasJobRelationalModel('', // id
|
|
281
|
+
'', // created
|
|
282
|
+
'', // serverCreated
|
|
283
|
+
'', // createdBy
|
|
284
|
+
'', // modified
|
|
285
|
+
'', // serverModified
|
|
286
|
+
'', // modifiedBy
|
|
287
|
+
'', // createdByName
|
|
288
|
+
'', // modifiedByName
|
|
289
|
+
'', // account
|
|
290
|
+
'', // accessGroup
|
|
291
|
+
'', // reference
|
|
292
|
+
'', // jobDate
|
|
293
|
+
'', // jobStatus
|
|
294
|
+
'', // jobStatusLastUpdate
|
|
295
|
+
'', // jobType
|
|
296
|
+
'', // assigneeId
|
|
297
|
+
'', // formId
|
|
298
|
+
(0, moment_1.default)().utcOffset(), // timeZoneOffset
|
|
299
|
+
0, // pendingFields: number,
|
|
300
|
+
'', // childModified: string,
|
|
301
|
+
0, // version: number,
|
|
302
|
+
'', // followUpDate: string,
|
|
303
|
+
'', // followUpStatus: string,
|
|
304
|
+
'', // followUpNote: string,
|
|
305
|
+
(0, model_1.getEmptyGeoLocation)(), // geoLocation: GeoLocation,
|
|
306
|
+
[], // files: Array<VasFileDto>,
|
|
307
|
+
[], // fields: FType,
|
|
308
|
+
[], // jobEmails: Array<VasJobEmailDto>,
|
|
309
|
+
[], // notes: Array<VasNoteDto>,
|
|
310
|
+
[], // reports: Array<VasReportDto>,
|
|
311
|
+
[], // tasks: Array<VasTaskDto>,
|
|
312
|
+
null // instruction: VasInstructionDto | null
|
|
313
|
+
);
|
|
314
|
+
}
|
|
315
|
+
toDto() {
|
|
316
|
+
return {
|
|
317
|
+
id: this.id,
|
|
318
|
+
created: this.created,
|
|
319
|
+
createdBy: this.createdBy,
|
|
320
|
+
modified: this.modified,
|
|
321
|
+
modifiedBy: this.modifiedBy,
|
|
322
|
+
serverCreated: this.serverCreated,
|
|
323
|
+
serverModified: this.serverModified,
|
|
324
|
+
createdByName: this.createdByName,
|
|
325
|
+
modifiedByName: this.modifiedByName,
|
|
326
|
+
account: this.account,
|
|
327
|
+
accessGroup: this.accessGroup,
|
|
328
|
+
reference: this.reference,
|
|
329
|
+
jobDate: this.jobDate,
|
|
330
|
+
jobStatus: this.jobStatus,
|
|
331
|
+
jobStatusLastUpdate: this.jobStatusLastUpdate,
|
|
332
|
+
jobType: this.jobType,
|
|
333
|
+
assigneeId: this.assigneeId,
|
|
334
|
+
formId: this.formId,
|
|
335
|
+
timeZoneOffset: this.timeZoneOffset,
|
|
336
|
+
pendingFields: this.pendingFields,
|
|
337
|
+
childModified: this.childModified,
|
|
338
|
+
version: this.version,
|
|
339
|
+
followUpDate: this.followUpDate,
|
|
340
|
+
followUpStatus: this.followUpStatus,
|
|
341
|
+
followUpNote: this.followUpNote,
|
|
342
|
+
geoLocation: this.geoLocation,
|
|
343
|
+
files: this.files,
|
|
344
|
+
fields: this.fields.map(f => f.toDto()),
|
|
345
|
+
jobEmails: this.jobEmails,
|
|
346
|
+
notes: this.notes,
|
|
347
|
+
reports: this.reports,
|
|
348
|
+
tasks: this.tasks,
|
|
349
|
+
instruction: this.instruction
|
|
350
|
+
};
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
exports.VasJobRelationalModel = VasJobRelationalModel;
|
|
354
|
+
class VasJobDocumentModel extends VasJobBaseModel {
|
|
355
|
+
static fromRelationalDto(dto) {
|
|
356
|
+
return new VasJobDocumentModel(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.jobStatusLastUpdate || '', dto.jobType || '', dto.assigneeId || '', dto.formId || dto.lastForm || '', dto.timeZoneOffset || (0, moment_1.default)().utcOffset(), dto.pendingFields || 0, dto.childModified || '', dto.version || 0, dto.followUpDate || '', dto.followUpStatus || '', dto.followUpNote || '', dto.geoLocation || (0, model_1.getEmptyGeoLocation)(), dto.files || [], (dto.fields || []).reduce((p, c) => {
|
|
357
|
+
p[c.controlName.replace('fields.', '')] = c.value;
|
|
358
|
+
return p;
|
|
359
|
+
}, {}), dto.jobEmails || [], dto.notes || [], dto.reports || [], dto.tasks || [], dto.instruction || null);
|
|
360
|
+
}
|
|
361
|
+
static fromDto(dto, options = { disableMigrateCheck: false }) {
|
|
362
|
+
let fields = {};
|
|
363
|
+
if (dto.fields !== undefined) {
|
|
364
|
+
if (isArrayOfFields(dto.fields)) {
|
|
365
|
+
for (const field of dto.fields) {
|
|
366
|
+
fields[field.controlName.replace('fields.', '')] =
|
|
367
|
+
(0, utils_1.tryJson)(field.value);
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
else if (isDictionaryOfFields(dto.fields)) {
|
|
371
|
+
fields = dto.fields;
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
// this code is checking if a have a document in the old dynamic job style,
|
|
375
|
+
// i.e. where there are keys in the job object that come from the form-group
|
|
376
|
+
// names. I did consider comparing the number of keys in the dto vs the
|
|
377
|
+
// number of expected keys, but this will fail if we try to read old objects
|
|
378
|
+
// that don't have new properties added. So we always check by default. We
|
|
379
|
+
// can skip this check by setting disableMigrateCheck in the options.
|
|
380
|
+
if (!options || !options.disableMigrateCheck) {
|
|
381
|
+
const ddto = dto;
|
|
382
|
+
const actualKeys = Object.keys(ddto);
|
|
383
|
+
actualKeys.reduce((f, groupName) => {
|
|
384
|
+
if (getStaticProps().has(groupName)) {
|
|
385
|
+
return f;
|
|
386
|
+
}
|
|
387
|
+
Object
|
|
388
|
+
.keys(ddto[groupName])
|
|
389
|
+
.forEach(controlName => {
|
|
390
|
+
if (!controlName.startsWith('fields.')) {
|
|
391
|
+
return;
|
|
392
|
+
}
|
|
393
|
+
f[controlName.slice(7)] = ddto[groupName][controlName];
|
|
394
|
+
});
|
|
395
|
+
return f;
|
|
396
|
+
}, fields);
|
|
397
|
+
}
|
|
398
|
+
return new VasJobDocumentModel(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.jobStatusLastUpdate || '', dto.jobType || '', dto.assigneeId || '', dto.formId || dto.lastForm || '', dto.timeZoneOffset || (0, moment_1.default)().utcOffset(), dto.pendingFields || 0, dto.childModified || '', dto.version || 0, dto.followUpDate || '', dto.followUpStatus || '', dto.followUpNote || '', dto.geoLocation || (0, model_1.getEmptyGeoLocation)(), dto.files || [], fields, dto.jobEmails || [], dto.notes || [], dto.reports || [], dto.tasks || [], dto.instruction || null);
|
|
399
|
+
}
|
|
400
|
+
static empty() {
|
|
401
|
+
return new VasJobDocumentModel('', // id
|
|
402
|
+
'', // created
|
|
403
|
+
'', // serverCreated
|
|
404
|
+
'', // createdBy
|
|
405
|
+
'', // modified
|
|
406
|
+
'', // serverModified
|
|
407
|
+
'', // modifiedBy
|
|
408
|
+
'', // createdByName
|
|
409
|
+
'', // modifiedByName
|
|
410
|
+
'', // account
|
|
411
|
+
'', // accessGroup
|
|
412
|
+
'', // reference
|
|
413
|
+
'', // jobDate
|
|
414
|
+
'', // jobStatus
|
|
415
|
+
'', // jobStatusLastUpdate
|
|
416
|
+
'', // jobType
|
|
417
|
+
'', // assigneeId
|
|
418
|
+
'', // formId
|
|
419
|
+
(0, moment_1.default)().utcOffset(), // timeZoneOffset
|
|
420
|
+
0, // pendingFields: number,
|
|
421
|
+
'', // childModified: string,
|
|
422
|
+
0, // version: number,
|
|
423
|
+
'', // followUpDate: string,
|
|
424
|
+
'', // followUpStatus: string,
|
|
425
|
+
'', // followUpNote: string,
|
|
426
|
+
(0, model_1.getEmptyGeoLocation)(), // geoLocation: GeoLocation,
|
|
427
|
+
[], // files: Array<VasFileDto>,
|
|
428
|
+
{}, // fields: FType,
|
|
429
|
+
[], // jobEmails: Array<VasJobEmailDto>,
|
|
430
|
+
[], // notes: Array<VasNoteDto>,
|
|
431
|
+
[], // reports: Array<VasReportDto>,
|
|
432
|
+
[], // tasks: Array<VasTaskDto>,
|
|
433
|
+
null // instruction: VasInstructionDto | null
|
|
434
|
+
);
|
|
435
|
+
}
|
|
436
|
+
toDto() {
|
|
437
|
+
return {
|
|
438
|
+
id: this.id,
|
|
439
|
+
created: this.created,
|
|
440
|
+
createdBy: this.createdBy,
|
|
441
|
+
modified: this.modified,
|
|
442
|
+
modifiedBy: this.modifiedBy,
|
|
443
|
+
serverCreated: this.serverCreated,
|
|
444
|
+
serverModified: this.serverModified,
|
|
445
|
+
createdByName: this.createdByName,
|
|
446
|
+
modifiedByName: this.modifiedByName,
|
|
447
|
+
account: this.account,
|
|
448
|
+
accessGroup: this.accessGroup,
|
|
449
|
+
reference: this.reference,
|
|
450
|
+
jobDate: this.jobDate,
|
|
451
|
+
jobStatus: this.jobStatus,
|
|
452
|
+
jobStatusLastUpdate: this.jobStatusLastUpdate,
|
|
453
|
+
jobType: this.jobType,
|
|
454
|
+
assigneeId: this.assigneeId,
|
|
455
|
+
formId: this.formId,
|
|
456
|
+
timeZoneOffset: this.timeZoneOffset,
|
|
457
|
+
pendingFields: this.pendingFields,
|
|
458
|
+
childModified: this.childModified,
|
|
459
|
+
version: this.version,
|
|
460
|
+
followUpDate: this.followUpDate,
|
|
461
|
+
followUpStatus: this.followUpStatus,
|
|
462
|
+
followUpNote: this.followUpNote,
|
|
463
|
+
geoLocation: this.geoLocation,
|
|
464
|
+
files: this.files,
|
|
465
|
+
fields: this.fields,
|
|
466
|
+
jobEmails: this.jobEmails,
|
|
467
|
+
notes: this.notes,
|
|
468
|
+
reports: this.reports,
|
|
469
|
+
tasks: this.tasks,
|
|
470
|
+
instruction: this.instruction
|
|
471
|
+
};
|
|
294
472
|
}
|
|
295
473
|
}
|
|
296
|
-
exports.
|
|
474
|
+
exports.VasJobDocumentModel = VasJobDocumentModel;
|
|
297
475
|
//# sourceMappingURL=vas-job.model.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vas-job.model.js","sourceRoot":"","sources":["../../../../../projects/vas-lib/src/lib/entity/vas-job.model.ts"],"names":[],"mappings":";;;;AAAA,iDAAuD;AACvD,4DAA4B;AAC5B,kEAA4D;AAK5D,+FAAwF;AACxF,oCAA4D;AAC5D,oDAA8G;AAC9G,wCAAqC;AAMrC,gDAA4C;AAC5C,8DAAyD;AAgBzD,IAAI,cAAuC,CAAC;AAE5C,SAAS,sBAAsB;IAC7B,IAAI,cAAc,EAAE,CAAC;QACnB,OAAO,cAAc,CAAC;IACxB,CAAC;IACD,OAAO,cAAc,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,mBAAmB,CAAC,WAAW,CAAC,KAAK,EAAE,CAAC,CAAC,CA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,CAAC,IAAI,EAAE,CAAC;IACZ,CAAC;IAAA,CAAC;IAEF;;OAEG;IACM,QAAQ;QACf,uCACK,KAAK,CAAC,QAAQ,EAAE,KACnB,SAAS,EAAE,IAAI,CAAC,SAAS,IAAI,GAAG,EAChC,OAAO,EAAE,IAAI,CAAC,OAAO,IAAI,GAAG,EAC5B,OAAO,EAAE,IAAI,CAAC,OAAO,IAAI,GAAG,EAC5B,WAAW,EAAE,IAAI,CAAC,WAAW,IAAI,GAAG,EACpC,SAAS,EAAE,IAAI,CAAC,SAAS,IAAI,GAAG,EAChC,UAAU,EAAE,IAAI,CAAC,UAAU,IAAI,GAAG,EAClC,cAAc,EAAE,IAAI,CAAC,cAAc,IAAI,CAAC,EACxC,aAAa,EAAE,IAAI,CAAC,aAAa,IAAI,CAAC,EACtC,QAAQ,EAAE,IAAI,CAAC,MAAM,IAAI,GAAG,IAC5B;IACJ,CAAC;IAEM,MAAM,CAAC,aAAa,CACzB,IAAwB;QAExB,OAAO,IAAA,WAAI,EACT,IAAI,EACJ;YACE,SAAS;YACT,UAAU;YACV,WAAW;YACX,SAAS;YACT,SAAS;YACT,aAAa;YACb,WAAW;YACX,YAAY;YACZ,gBAAgB;YAChB,eAAe;YACf,QAAQ;SACT,CACF,CAAC;IACJ,CAAC;CACF;AAvYD,kCAuYC","sourcesContent":["import { isFileDto, VasFileDto } from './vas-file.dto';\nimport moment from 'moment';\nimport { getValueByPath } from '../utils/get-value-by-path';\nimport { VasBaseDto } from './vas-base.dto';\nimport { FieldValueType, VasFieldDto } from './vas-field.dto';\nimport { VasFormModel } from './vas-form.model';\nimport { VasJobDto } from './vas-job.dto';\nimport { VasRestrictedAccountObjectModel } from './vas-restricted-account-object.model';\nimport { GeoLocation, getEmptyGeoLocation } from '../model';\nimport { isCameraControlValueV1, VasCameraControlValueModel, isCameraControlValueV2 } from '../control-value';\nimport { only } from '../utils/only';\nimport { VasReportDto } from './vas-report.dto';\nimport { VasTaskDto } from './vas-task.dto';\nimport { VasNoteDto } from './vas-note.dto';\nimport { VasJobEmailDto } from './vas-job-email.dto';\nimport { VasInstructionDto } from './vas-instruction.dto';\nimport { tryJson } from \"../utils/try-json\";\nimport { isPlainObject } from \"../utils/is-plain-object\";\n\nexport interface ParseSyntaxOptions {\n // This value will be used to adjust any datetime values that are referenced\n // in the syntax string. See\n // https://momentjscom.readthedocs.io/en/latest/moment/03-manipulating/09-utc-offset/\n // for more information about how `moment` will handle the value.\n timeZoneOffset: number,\n // this dictionary can be passed in to contain other objects to be referenced\n // in the syntax. For example if we have {job.foo} this will reference the\n // job's `foo` property, however if we have \"reportLayout.title\" this will\n // expect to find a property of `objects` called `reportLayout` which will\n // have a property called `title`\n objects?: Record<string, Partial<VasBaseDto> | Record<string, FieldValueType>>;\n}\n\nlet jobStaticProps: Set<string> | undefined;\n\nfunction getJobStaticProperties() {\n if (jobStaticProps) {\n return jobStaticProps;\n }\n return jobStaticProps = new Set(Object.getOwnPropertyNames(VasJobModel.empty()));\n}\n\n/**\n * JobModel\n */\nexport class VasJobModel extends VasRestrictedAccountObjectModel {\n\n constructor(\n public override id: string,\n public override created: string,\n public override serverCreated: string,\n public override createdBy: string,\n public override modified: string,\n public override serverModified: string,\n public override modifiedBy: string,\n public override createdByName: string,\n public override modifiedByName: string,\n public override account: string,\n public override accessGroup: string,\n public reference: string,\n public jobDate: string,\n public jobStatus: string,\n public jobType: string,\n public assigneeId: string,\n public formId: string,\n public timeZoneOffset: number,\n public pendingFields: number,\n public childModified: string,\n public version: number,\n public geoLocation: GeoLocation,\n public files: Array<VasFileDto>,\n public fields: Record<string, FieldValueType>,\n public jobEmails: Array<VasJobEmailDto>,\n public notes: Array<VasNoteDto>,\n public reports: Array<VasReportDto>,\n public tasks: Array<VasTaskDto>,\n public instruction: VasInstructionDto | null\n ) {\n super(\n id,\n created,\n serverCreated,\n createdBy,\n modified,\n serverModified,\n modifiedBy,\n createdByName,\n modifiedByName,\n account,\n accessGroup\n );\n }\n\n get createdByDisplayName(): string {\n return this.createdByName;\n }\n\n get modifiedByDisplayName(): string {\n return this.modifiedByName;\n }\n\n /**\n * Return the list of Job properties\n */\n get staticProperties(): Set<string> {\n if (jobStaticProps) {\n return jobStaticProps;\n }\n return jobStaticProps = new Set(Object.getOwnPropertyNames(VasJobModel.empty()));\n }\n\n /**\n * @return {VasJobModel}\n */\n static empty(): VasJobModel {\n return new VasJobModel(\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n moment().utcOffset(),\n 0,\n '',\n 0,\n getEmptyGeoLocation(),\n [],\n {},\n [],\n [],\n [],\n [],\n null\n );\n }\n\n static override fromDto(dto: Partial<VasJobDto>): VasJobModel {\n // we have changed the job model and stopped using the dynamic properties\n // from form group names to hold fields. Instead, we store a simple object\n // where the control name (minus the \"fields.\" prefix) is the key, and the\n // field value is the value. However, we have to cater for data that may\n // be persisted in the old structure, or an API response where fields is an\n // array of VasFieldDto.\n\n // 1: if dto.fields is already an object, we use the existing value\n const fields: Record<string, FieldValueType> =\n isPlainObject<Record<string, FieldValueType>>(dto.fields) ?\n dto.fields :\n {};\n\n // 2: if dto.fields is an array, we're handling a vas-rest response, we\n // iterate over the fields and update the fields object.\n Array.isArray(dto.fields) && dto.fields.forEach((field: VasFieldDto) => {\n fields[field.controlName.replace('fields.', '')] = tryJson(field.value);\n });\n\n // 3: if `fields` still has no keys, we're restoring a VasJobDto object that\n // was saved in the old \"form-group\" style, where dynamic keys are\n // derived from the form-group names. We'll iterate over those keys, and\n // update the `fields` object. Once this model is serialized back to a\n // dto, it will have the new shape.\n if (Object.keys(fields).length === 0) {\n Object\n .keys(dto)\n .filter(key => !getJobStaticProperties().has(key))\n .forEach(groupName => {\n Object\n .keys((dto as any)[groupName])\n .forEach(controlName => {\n const cn = controlName.replace('fields.', '');\n fields[cn] = (dto as any)[groupName][controlName];\n });\n });\n }\n\n return new VasJobModel(\n dto.id || '',\n dto.created || '',\n dto.serverCreated || '',\n dto.createdBy || '',\n dto.modified || '',\n dto.serverModified || '',\n dto.modifiedBy || '',\n dto.createdByName || '',\n dto.modifiedByName || '',\n dto.account || '',\n dto.accessGroup || '',\n dto.reference || '',\n dto.jobDate || '',\n dto.jobStatus || '',\n dto.jobType || '',\n dto.assigneeId || '',\n dto.formId || (dto as any).lastForm || '',\n dto.timeZoneOffset || moment().utcOffset(),\n dto.pendingFields || 0,\n dto.childModified || '',\n dto.version || 0,\n dto.geoLocation || getEmptyGeoLocation(),\n dto.files || [],\n fields,\n dto.jobEmails || [],\n dto.notes || [],\n dto.reports || [],\n dto.tasks || [],\n dto.instruction || null\n );\n }\n\n /**\n * Returns an object describing how many attachments were added to this job\n * (camera controls and files), and how many have not been uploaded yet.\n *\n * @param formModel instance of {@link VasFormModel} that was used when the\n * job was created\n */\n getFilesUploadStatus(\n formModel: VasFormModel\n ): { pending: number; total: number } {\n\n const cameraFieldValues = Object\n .values(this.fields)\n .filter(value => isCameraControlValueV2(value) || isCameraControlValueV1(value));\n\n\n let total = cameraFieldValues.length + this.files.length;\n\n // calculate the number of camera images still to upload\n let pending = cameraFieldValues\n .map((value: VasFileDto | VasCameraControlValueModel) => {\n if (isFileDto(value)) {\n return value.id && value.status !== 'COMPLETE';\n } else if (isCameraControlValueV1(value)) {\n // if url is not set, it hasn't been uploaded\n return value.id && !value.url;\n }\n return false;\n })\n .filter(hasUploaded => hasUploaded)\n .length;\n\n // add count of job.files that are complete\n pending += this.files.filter(value => value.status !== 'COMPLETE').length;\n\n return {\n pending,\n total\n };\n }\n\n /**\n * @param path path segments\n */\n getValueByPath<T>(\n path: string | string[] = []\n ): T | undefined {\n return getValueByPath<T>(\n Array.isArray(path) ? path : path.split('.'),\n this\n );\n }\n\n public toDto(): VasJobDto {\n return {\n id: this.id,\n created: this.created,\n createdBy: this.createdBy,\n modified: this.modified,\n modifiedBy: this.modifiedBy,\n serverCreated: this.serverCreated,\n serverModified: this.serverModified,\n createdByName: this.createdByName,\n modifiedByName: this.modifiedByName,\n account: this.account,\n accessGroup: this.accessGroup,\n reference: this.reference,\n jobDate: this.jobDate,\n jobStatus: this.jobStatus,\n jobType: this.jobType,\n assigneeId: this.assigneeId,\n formId: this.formId,\n timeZoneOffset: this.timeZoneOffset,\n pendingFields: this.pendingFields,\n childModified: this.childModified,\n version: this.version,\n geoLocation: this.geoLocation,\n files: this.files,\n fields: this.fields,\n jobEmails: this.jobEmails,\n notes: this.notes,\n reports: this.reports,\n tasks: this.tasks,\n instruction: this.instruction\n };\n }\n\n /**\n * This method will parse a syntax that allows us to build strings from the\n * values of from the job model. For example if the job model was:\n *\n * {\n * foo: 'bar'\n * }\n *\n * and we pass \"i am foo {foo}\", the result would be:\n *\n * \"i am foo bar\"\n *\n * we can also use moment to parse dates, for example if the job model was:\n *\n * {\n * created: \"2022-01-01T00:00:00+0000\"\n * }\n *\n * and we pass \"{created|date:YY-MM-DD}\", the result would be:\n *\n * \"2022-01-01\"\n *\n * @param {string} value a string with the syntax\n * @param {ParseSyntaxOptions} options\n * @return the results of parsing the syntax on this job\n */\n parseSyntax(\n value: string,\n options: ParseSyntaxOptions = {\n timeZoneOffset: 0\n }\n ): string {\n\n if (!value || typeof value !== 'string') {\n return '';\n }\n const fields = this.fields;\n return value.replace(/({[^}]*})/g, (match: string, token: string) => {\n const syntax = token.substring(1, token.length - 1);\n\n let [key, filter] = syntax.split('|');\n key = (key || '').trim();\n filter = (filter || '').trim();\n\n let filterName, filterArg: string = '';\n if (filter) {\n const splitIndex = filter.indexOf(':');\n if (splitIndex !== -1) {\n filterName = filter.substring(0, splitIndex);\n filterArg = filter.substring(splitIndex + 1);\n } else {\n filterName = filter;\n filterArg = '';\n }\n filterName = (filterName || '').trim();\n filterArg = (filterArg || '').trim();\n }\n const path = key.split('.');\n const objectKey = path.shift() || '';\n let result = '';\n if (objectKey === 'job') {\n result = (this.getValueByPath(path) || '').toString();\n } else if (objectKey === 'fields' || this.fields[path[0]] !== undefined) {\n result = (getValueByPath(path, fields) || '').toString();\n } else if (objectKey.length && options.objects && options.objects[objectKey] !== undefined) {\n result = (getValueByPath(path, options.objects[objectKey]) || '').toString();\n } else {\n return '';\n }\n\n if (filterName && result) {\n switch (filterName) {\n case 'date': {\n if (!options.timeZoneOffset) {\n return moment(result).format(filterArg || '');\n } else {\n return moment(result)\n .utcOffset(options.timeZoneOffset)\n .format(filterArg || '');\n }\n }\n default: {\n console.warn('unknown filter %s', filterName);\n }\n }\n }\n\n return result;\n }).trim();\n };\n\n /**\n * @return {object}\n */\n override toApiDto(): Record<string, string | number | boolean> {\n return {\n ...super.toApiDto(),\n reference: this.reference || '~',\n jobDate: this.jobDate || '~',\n jobType: this.jobType || '~',\n accessGroup: this.accessGroup || '~',\n jobStatus: this.jobStatus || '~',\n assigneeId: this.assigneeId || '~',\n timeZoneOffset: this.timeZoneOffset || 0,\n pendingFields: this.pendingFields || 0,\n lastForm: this.formId || '~'\n };\n }\n\n public static toApiPatchDto(\n item: Partial<VasJobDto>\n ): Partial<VasJobDto> {\n return only(\n item,\n [\n 'created',\n 'modified',\n 'reference',\n 'jobDate',\n 'jobType',\n 'accessGroup',\n 'jobStatus',\n 'assigneeId',\n 'timeZoneOffset',\n 'pendingFields',\n 'formId'\n ]\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"vas-job.model.js","sourceRoot":"","sources":["../../../../../projects/vas-lib/src/lib/entity/vas-job.model.ts"],"names":[],"mappings":";;;;AAAA,iDAAuD;AACvD,4DAA4B;AAC5B,kEAA4D;AAK5D,+FAAwF;AACxF,oCAA4D;AAC5D,oDAA8G;AAC9G,oCAAwD;AAMxD,uDAAkD;AAElD,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC;IACxB,SAAS;IACT,UAAU;IACV,WAAW;IACX,SAAS;IACT,cAAc;IACd,gBAAgB;IAChB,cAAc;CACf,CAAC,CAAC;AAkBH,IAAI,cAAuC,CAAC;AAE5C,SAAS,cAAc;IACrB,IAAI,cAAc,EAAE,CAAC;QACnB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EAAE,IAAI,CAAC,SAAS;YACzB,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,mBAAmB,EAAE,IAAI,CAAC,mBAAmB;YAC7C,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,cAAc,EAAE,IAAI,CAAC,cAAc;YACnC,aAAa,EAAE,IAAI,CAAC,aAAa;YACjC,aAAa,EAAE,IAAI,CAAC,aAAa;YACjC,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,cAAc,EAAE,IAAI,CAAC,cAAc;YACnC,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,WAAW,EAAE,IAAI,CAAC,WAAW;SAC9B,CAAC;IACJ,CAAC;CACF;AArMD,kDAqMC","sourcesContent":["import { isFileDto, VasFileDto } from './vas-file.dto';\nimport moment from 'moment';\nimport { getValueByPath } from '../utils/get-value-by-path';\nimport { VasBaseDto } from './vas-base.dto';\nimport { FieldValueType, VasFieldDto } from './vas-field.dto';\nimport { VasFormModel } from './vas-form.model';\nimport { VasJobBaseDto, VasJobDocumentDto, VasJobRelationalDto } from './vas-job.dto';\nimport { VasRestrictedAccountObjectModel } from './vas-restricted-account-object.model';\nimport { GeoLocation, getEmptyGeoLocation } from '../model';\nimport { isCameraControlValueV1, isCameraControlValueV2, VasCameraControlValueModel } from '../control-value';\nimport { isPlainObject, only, tryJson } from '../utils';\nimport { VasReportDto } from './vas-report.dto';\nimport { VasTaskDto } from './vas-task.dto';\nimport { VasNoteDto } from './vas-note.dto';\nimport { VasJobEmailDto } from './vas-job-email.dto';\nimport { VasInstructionDto } from './vas-instruction.dto';\nimport { VasFieldModel } from './vas-field.model';\n\nconst nullables = new Set([\n 'created',\n 'modified',\n 'reference',\n 'jobDate',\n 'followUpDate',\n 'followUpStatus',\n 'followUpNote',\n]);\n\ntype VasJobDynamicDto = Partial<VasJobDocumentDto> & Record<string, any>;\n\nexport interface ParseSyntaxOptions {\n // This value will be used to adjust any datetime values that are referenced\n // in the syntax string. See\n // https://momentjscom.readthedocs.io/en/latest/moment/03-manipulating/09-utc-offset/\n // for more information about how `moment` will handle the value.\n timeZoneOffset: number,\n // this dictionary can be passed in to contain other objects to be referenced\n // in the syntax. For example if we have {job.foo} this will reference the\n // job's `foo` property, however if we have \"reportLayout.title\" this will\n // expect to find a property of `objects` called `reportLayout` which will\n // have a property called `title`\n objects?: Record<string, Partial<VasBaseDto> | Record<string, FieldValueType>>;\n}\n\nlet jobStaticProps: Set<string> | undefined;\n\nfunction getStaticProps(): Set<string> {\n if (jobStaticProps) {\n return jobStaticProps;\n }\n return jobStaticProps = new Set([\n ...Object.getOwnPropertyNames(VasJobDocumentModel.empty()),\n 'assignee'\n ]);\n}\n\nfunction isArrayOfFields(\n value: unknown\n): value is Array<VasFieldDto> {\n return !!value && Array.isArray(value);\n}\n\nfunction isDictionaryOfFields(\n value: unknown\n): value is Record<string, FieldValueType> {\n return !!value && isPlainObject(value);\n}\n\n/**\n * VasJobBaseModel\n */\nexport abstract class VasJobBaseModel<FType extends Record<string, FieldValueType> | Array<VasFieldModel>> extends VasRestrictedAccountObjectModel {\n\n constructor(\n public override id: string,\n public override created: string,\n public override serverCreated: string,\n public override createdBy: string,\n public override modified: string,\n public override serverModified: string,\n public override modifiedBy: string,\n public override createdByName: string,\n public override modifiedByName: string,\n public override account: string,\n public override accessGroup: string,\n public reference: string,\n public jobDate: string,\n public jobStatus: string,\n public jobStatusLastUpdate: string,\n public jobType: string,\n public assigneeId: string,\n public formId: string,\n public timeZoneOffset: number,\n public pendingFields: number,\n public childModified: string,\n public version: number,\n public followUpDate: string,\n public followUpStatus: string,\n public followUpNote: string,\n public geoLocation: GeoLocation,\n public files: Array<VasFileDto>,\n public fields: FType,\n public jobEmails: Array<VasJobEmailDto>,\n public notes: Array<VasNoteDto>,\n public reports: Array<VasReportDto>,\n public tasks: Array<VasTaskDto>,\n public instruction: VasInstructionDto | null\n ) {\n super(\n id,\n created,\n serverCreated,\n createdBy,\n modified,\n serverModified,\n modifiedBy,\n createdByName,\n modifiedByName,\n account,\n accessGroup\n );\n }\n\n get createdByDisplayName(): string {\n return this.createdByName;\n }\n\n get modifiedByDisplayName(): string {\n return this.modifiedByName;\n }\n\n /**\n * Return the list of Job properties\n */\n get staticProperties(): Set<string> {\n\n return getStaticProps();\n }\n\n /**\n * Returns an object describing how many attachments were added to this job\n * (camera controls and files), and how many have not been uploaded yet.\n *\n * @param formModel instance of {@link VasFormModel} that was used when the\n * job was created\n */\n getFilesUploadStatus(\n formModel: VasFormModel\n ): { pending: number; total: number } {\n\n const cameraFieldValues = Object\n .values(this.fields)\n .filter(value => isCameraControlValueV2(value) || isCameraControlValueV1(value));\n\n\n let total = cameraFieldValues.length + this.files.length;\n\n // calculate the number of camera images still to upload\n let pending = cameraFieldValues\n .map((value: VasFileDto | VasCameraControlValueModel) => {\n if (isFileDto(value)) {\n return value.id && value.status !== 'COMPLETE';\n } else if (isCameraControlValueV1(value)) {\n // if url is not set, it hasn't been uploaded\n return value.id && !value.url;\n }\n return false;\n })\n .filter(hasUploaded => hasUploaded)\n .length;\n\n // add count of job.files that are complete\n pending += this.files.filter(value => value.status !== 'COMPLETE').length;\n\n return {\n pending,\n total\n };\n }\n\n /**\n * @param path path segments\n */\n getValueByPath<T>(\n path: string | string[] = []\n ): T | null | undefined {\n return getValueByPath<T>(\n Array.isArray(path) ? path : path.split('.'),\n this\n );\n }\n\n /**\n * This method will parse a syntax that allows us to build strings from the\n * values of from the job model. For example if the job model was:\n *\n * {\n * foo: 'bar'\n * }\n *\n * and we pass \"i am foo {foo}\", the result would be:\n *\n * \"i am foo bar\"\n *\n * we can also use moment to parse dates, for example if the job model was:\n *\n * {\n * created: \"2022-01-01T00:00:00+0000\"\n * }\n *\n * and we pass \"{created|date:YY-MM-DD}\", the result would be:\n *\n * \"2022-01-01\"\n *\n * @param {string} value a string with the syntax\n * @param {ParseSyntaxOptions} options\n * @return the results of parsing the syntax on this job\n */\n parseSyntax(\n value: string,\n options: ParseSyntaxOptions = {\n timeZoneOffset: 0\n }\n ): string {\n\n if (!value || typeof value !== 'string') {\n return '';\n }\n return value.replace(/({[^}]*})/g, (match: string, token: string) => {\n const syntax = token.substring(1, token.length - 1);\n\n let [key, filter] = syntax.split('|');\n key = (key || '').trim();\n filter = (filter || '').trim();\n\n let filterName, filterArg: string = '';\n if (filter) {\n const splitIndex = filter.indexOf(':');\n if (splitIndex !== -1) {\n filterName = filter.substring(0, splitIndex);\n filterArg = filter.substring(splitIndex + 1);\n } else {\n filterName = filter;\n filterArg = '';\n }\n filterName = (filterName || '').trim();\n filterArg = (filterArg || '').trim();\n }\n const path = key.split('.');\n const objectKey = path.shift() || '';\n let result = '';\n if (objectKey === 'job') {\n result = (this.getValueByPath(path) || '').toString();\n } else if (objectKey === 'fields') {\n result = (this.getValueByPath(['fields', ...path]) || '').toString();\n } else if (objectKey.length && options.objects && options.objects[objectKey] !== undefined) {\n result = (getValueByPath(path, options.objects[objectKey]) || '').toString();\n } else {\n return '';\n }\n\n if (filterName && result) {\n switch (filterName) {\n case 'date': {\n if (!options.timeZoneOffset) {\n return moment(result).format(filterArg || '');\n } else {\n return moment(result)\n .utcOffset(options.timeZoneOffset)\n .format(filterArg || '');\n }\n }\n default: {\n console.warn('unknown filter %s', filterName);\n }\n }\n }\n\n return result;\n }).trim();\n };\n\n /**\n * @return {object}\n */\n override toApiDto(): Record<string, string | number | boolean> {\n return {\n ...super.toApiDto(),\n reference: this.reference || '~',\n jobDate: this.jobDate || '~',\n jobType: this.jobType || '~',\n accessGroup: this.accessGroup || '~',\n jobStatus: this.jobStatus || '~',\n assigneeId: this.assigneeId || '~',\n timeZoneOffset: this.timeZoneOffset || 0,\n pendingFields: this.pendingFields || 0,\n lastForm: this.formId || '~'\n };\n }\n\n public static toApiPatchDto(\n item: Partial<VasJobBaseDto>\n ): Partial<VasJobBaseDto> {\n return only(\n item,\n [\n 'created',\n 'modified',\n 'reference',\n 'jobDate',\n 'jobType',\n 'accessGroup',\n 'jobStatus',\n 'assigneeId',\n 'timeZoneOffset',\n 'pendingFields',\n 'formId',\n 'followUpDate',\n 'followUpStatus',\n 'followUpNote',\n ],\n (value: any, key: keyof VasJobRelationalDto) =>\n value[key] === null && nullables.has(key) ? '~' : value[key]\n );\n }\n}\n\nexport class VasJobRelationalModel extends VasJobBaseModel<Array<VasFieldModel>> {\n\n override getValueByPath<T>(\n path: string | string[] = []\n ): T | null | undefined {\n const parts = Array.isArray(path) ? path : path.split('.');\n if (parts[0] === 'fields') {\n return this.getFieldValueByPath(parts[1], parts.slice(2)) as T;\n }\n return getValueByPath<T>(parts, this);\n }\n\n getFieldsMap(): Record<string, FieldValueType> {\n return this.fields.reduce((p, c) => {\n p[c.controlName] = c.value;\n return p;\n }, {} as Record<string, FieldValueType>);\n }\n\n getFieldValueByPath<T extends FieldValueType>(\n controlName: string,\n path: string[]\n ): T | null | undefined {\n for (const field of this.fields) {\n if (field.controlName === controlName) {\n if (path.length === 0) {\n return field.value as T;\n }\n if (field.value === null) {\n return path.length >= 1 ? undefined : null;\n }\n if (isPlainObject<object>(field.value)) {\n return getValueByPath(path, field.value);\n }\n return undefined;\n }\n }\n return undefined;\n }\n\n static override fromDto(dto: Partial<VasJobRelationalDto>): VasJobRelationalModel {\n\n if (dto.fields !== undefined && !Array.isArray(dto.fields)) {\n throw Error('fields must be an array');\n }\n\n return new VasJobRelationalModel(\n dto.id || '',\n dto.created || '',\n dto.serverCreated || '',\n dto.createdBy || '',\n dto.modified || '',\n dto.serverModified || '',\n dto.modifiedBy || '',\n dto.createdByName || '',\n dto.modifiedByName || '',\n dto.account || '',\n dto.accessGroup || '',\n dto.reference || '',\n dto.jobDate || '',\n dto.jobStatus || '',\n dto.jobStatusLastUpdate || '',\n dto.jobType || '',\n dto.assigneeId || '',\n dto.formId || (dto as any).lastForm || '',\n dto.timeZoneOffset || moment().utcOffset(),\n dto.pendingFields || 0,\n dto.childModified || '',\n dto.version || 0,\n dto.followUpDate || '',\n dto.followUpStatus || '',\n dto.followUpNote || '',\n dto.geoLocation || getEmptyGeoLocation(),\n dto.files || [],\n (dto.fields || []).map(f => VasFieldModel.fromDto(f)),\n dto.jobEmails || [],\n dto.notes || [],\n dto.reports || [],\n dto.tasks || [],\n dto.instruction || null\n );\n }\n\n static empty(): VasJobRelationalModel {\n return new VasJobRelationalModel(\n '', // id\n '', // created\n '', // serverCreated\n '', // createdBy\n '', // modified\n '', // serverModified\n '', // modifiedBy\n '', // createdByName\n '', // modifiedByName\n '', // account\n '', // accessGroup\n '', // reference\n '', // jobDate\n '', // jobStatus\n '', // jobStatusLastUpdate\n '', // jobType\n '', // assigneeId\n '', // formId\n moment().utcOffset(), // timeZoneOffset\n 0, // pendingFields: number,\n '', // childModified: string,\n 0, // version: number,\n '', // followUpDate: string,\n '', // followUpStatus: string,\n '', // followUpNote: string,\n getEmptyGeoLocation(), // geoLocation: GeoLocation,\n [], // files: Array<VasFileDto>,\n [], // fields: FType,\n [], // jobEmails: Array<VasJobEmailDto>,\n [], // notes: Array<VasNoteDto>,\n [], // reports: Array<VasReportDto>,\n [], // tasks: Array<VasTaskDto>,\n null // instruction: VasInstructionDto | null\n );\n }\n\n public toDto(): VasJobRelationalDto {\n return {\n id: this.id,\n created: this.created,\n createdBy: this.createdBy,\n modified: this.modified,\n modifiedBy: this.modifiedBy,\n serverCreated: this.serverCreated,\n serverModified: this.serverModified,\n createdByName: this.createdByName,\n modifiedByName: this.modifiedByName,\n account: this.account,\n accessGroup: this.accessGroup,\n reference: this.reference,\n jobDate: this.jobDate,\n jobStatus: this.jobStatus,\n jobStatusLastUpdate: this.jobStatusLastUpdate,\n jobType: this.jobType,\n assigneeId: this.assigneeId,\n formId: this.formId,\n timeZoneOffset: this.timeZoneOffset,\n pendingFields: this.pendingFields,\n childModified: this.childModified,\n version: this.version,\n followUpDate: this.followUpDate,\n followUpStatus: this.followUpStatus,\n followUpNote: this.followUpNote,\n geoLocation: this.geoLocation,\n files: this.files,\n fields: this.fields.map(f => f.toDto()),\n jobEmails: this.jobEmails,\n notes: this.notes,\n reports: this.reports,\n tasks: this.tasks,\n instruction: this.instruction\n };\n }\n}\n\nexport class VasJobDocumentModel extends VasJobBaseModel<Record<string, FieldValueType>> {\n\n static fromRelationalDto(dto: Partial<VasJobRelationalDto>): VasJobDocumentModel {\n return new VasJobDocumentModel(\n dto.id || '',\n dto.created || '',\n dto.serverCreated || '',\n dto.createdBy || '',\n dto.modified || '',\n dto.serverModified || '',\n dto.modifiedBy || '',\n dto.createdByName || '',\n dto.modifiedByName || '',\n dto.account || '',\n dto.accessGroup || '',\n dto.reference || '',\n dto.jobDate || '',\n dto.jobStatus || '',\n dto.jobStatusLastUpdate || '',\n dto.jobType || '',\n dto.assigneeId || '',\n dto.formId || (dto as any).lastForm || '',\n dto.timeZoneOffset || moment().utcOffset(),\n dto.pendingFields || 0,\n dto.childModified || '',\n dto.version || 0,\n dto.followUpDate || '',\n dto.followUpStatus || '',\n dto.followUpNote || '',\n dto.geoLocation || getEmptyGeoLocation(),\n dto.files || [],\n (dto.fields || []).reduce((p, c) => {\n p[c.controlName.replace('fields.', '')] = c.value;\n return p;\n }, {} as Record<string, FieldValueType>),\n dto.jobEmails || [],\n dto.notes || [],\n dto.reports || [],\n dto.tasks || [],\n dto.instruction || null\n );\n }\n\n static override fromDto(\n dto: Partial<VasJobDocumentDto>,\n options = { disableMigrateCheck: false }\n ): VasJobDocumentModel {\n\n let fields: Record<string, FieldValueType> = {};\n\n if (dto.fields !== undefined) {\n if (isArrayOfFields(dto.fields)) {\n for (const field of dto.fields) {\n fields[field.controlName.replace('fields.', '')] =\n tryJson(field.value);\n }\n } else if (isDictionaryOfFields(dto.fields)) {\n fields = dto.fields;\n }\n }\n\n // this code is checking if a have a document in the old dynamic job style,\n // i.e. where there are keys in the job object that come from the form-group\n // names. I did consider comparing the number of keys in the dto vs the\n // number of expected keys, but this will fail if we try to read old objects\n // that don't have new properties added. So we always check by default. We\n // can skip this check by setting disableMigrateCheck in the options.\n if (!options || !options.disableMigrateCheck) {\n const ddto: Record<string, Record<string, FieldValueType>> = dto as any;\n const actualKeys = Object.keys(ddto);\n actualKeys.reduce((f, groupName) => {\n if (getStaticProps().has(groupName)) {\n return f;\n }\n Object\n .keys(ddto[groupName])\n .forEach(controlName => {\n if (!controlName.startsWith('fields.')) {\n return;\n }\n f[controlName.slice(7)] = ddto[groupName][controlName];\n });\n return f;\n }, fields);\n }\n return new VasJobDocumentModel(\n dto.id || '',\n dto.created || '',\n dto.serverCreated || '',\n dto.createdBy || '',\n dto.modified || '',\n dto.serverModified || '',\n dto.modifiedBy || '',\n dto.createdByName || '',\n dto.modifiedByName || '',\n dto.account || '',\n dto.accessGroup || '',\n dto.reference || '',\n dto.jobDate || '',\n dto.jobStatus || '',\n dto.jobStatusLastUpdate || '',\n dto.jobType || '',\n dto.assigneeId || '',\n dto.formId || (dto as any).lastForm || '',\n dto.timeZoneOffset || moment().utcOffset(),\n dto.pendingFields || 0,\n dto.childModified || '',\n dto.version || 0,\n dto.followUpDate || '',\n dto.followUpStatus || '',\n dto.followUpNote || '',\n dto.geoLocation || getEmptyGeoLocation(),\n dto.files || [],\n fields,\n dto.jobEmails || [],\n dto.notes || [],\n dto.reports || [],\n dto.tasks || [],\n dto.instruction || null\n );\n }\n\n static empty(): VasJobDocumentModel {\n return new VasJobDocumentModel(\n '', // id\n '', // created\n '', // serverCreated\n '', // createdBy\n '', // modified\n '', // serverModified\n '', // modifiedBy\n '', // createdByName\n '', // modifiedByName\n '', // account\n '', // accessGroup\n '', // reference\n '', // jobDate\n '', // jobStatus\n '', // jobStatusLastUpdate\n '', // jobType\n '', // assigneeId\n '', // formId\n moment().utcOffset(), // timeZoneOffset\n 0, // pendingFields: number,\n '', // childModified: string,\n 0, // version: number,\n '', // followUpDate: string,\n '', // followUpStatus: string,\n '', // followUpNote: string,\n getEmptyGeoLocation(), // geoLocation: GeoLocation,\n [], // files: Array<VasFileDto>,\n {}, // fields: FType,\n [], // jobEmails: Array<VasJobEmailDto>,\n [], // notes: Array<VasNoteDto>,\n [], // reports: Array<VasReportDto>,\n [], // tasks: Array<VasTaskDto>,\n null // instruction: VasInstructionDto | null\n );\n }\n\n public toDto(): VasJobDocumentDto {\n return {\n id: this.id,\n created: this.created,\n createdBy: this.createdBy,\n modified: this.modified,\n modifiedBy: this.modifiedBy,\n serverCreated: this.serverCreated,\n serverModified: this.serverModified,\n createdByName: this.createdByName,\n modifiedByName: this.modifiedByName,\n account: this.account,\n accessGroup: this.accessGroup,\n reference: this.reference,\n jobDate: this.jobDate,\n jobStatus: this.jobStatus,\n jobStatusLastUpdate: this.jobStatusLastUpdate,\n jobType: this.jobType,\n assigneeId: this.assigneeId,\n formId: this.formId,\n timeZoneOffset: this.timeZoneOffset,\n pendingFields: this.pendingFields,\n childModified: this.childModified,\n version: this.version,\n followUpDate: this.followUpDate,\n followUpStatus: this.followUpStatus,\n followUpNote: this.followUpNote,\n geoLocation: this.geoLocation,\n files: this.files,\n fields: this.fields,\n jobEmails: this.jobEmails,\n notes: this.notes,\n reports: this.reports,\n tasks: this.tasks,\n instruction: this.instruction\n };\n }\n}\n\n/** @deprecated use either VasJobDocumentModel or VasJobRelationalModel **/\nexport type VasJobModel = VasJobDocumentModel | VasJobRelationalModel;\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { EstimateDto, EstimateSummaryDto } from './estimate.dto';
|
|
2
|
+
export interface EstimateControlValueSummaryDto {
|
|
3
|
+
original: EstimateSummaryDto;
|
|
4
|
+
latest: EstimateSummaryDto;
|
|
5
|
+
savings: EstimateSummaryDto;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Describes the value of the estimate control
|
|
9
|
+
*/
|
|
10
|
+
export interface EstimateControlValueDto {
|
|
11
|
+
estimates: Array<EstimateDto>;
|
|
12
|
+
summary: EstimateControlValueSummaryDto;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=estimate-control-value.dto.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"estimate-control-value.dto.d.ts","sourceRoot":"","sources":["../../../../../../projects/vas-lib/src/lib/model/estimate-control/estimate-control-value.dto.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEjE,MAAM,WAAW,8BAA8B;IAC7C,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,MAAM,EAAE,kBAAkB,CAAC;IAC3B,OAAO,EAAE,kBAAkB,CAAC;CAC7B;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,SAAS,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC;IAC9B,OAAO,EAAE,8BAA8B,CAAC;CACzC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"estimate-control-value.dto.js","sourceRoot":"","sources":["../../../../../../projects/vas-lib/src/lib/model/estimate-control/estimate-control-value.dto.ts"],"names":[],"mappings":"","sourcesContent":["import { EstimateDto, EstimateSummaryDto } from './estimate.dto';\n\nexport interface EstimateControlValueSummaryDto {\n original: EstimateSummaryDto;\n latest: EstimateSummaryDto;\n savings: EstimateSummaryDto;\n}\n\n/**\n * Describes the value of the estimate control\n */\nexport interface EstimateControlValueDto {\n estimates: Array<EstimateDto>;\n summary: EstimateControlValueSummaryDto;\n}\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { EstimateControlValueSummaryDto } from './estimate-control-value.dto';
|
|
2
|
+
import { EstimateModel } from './estimate.model';
|
|
3
|
+
/**
|
|
4
|
+
* Utility class for computing the summary value for an estimate control given
|
|
5
|
+
* the first and last estimates
|
|
6
|
+
*/
|
|
7
|
+
export declare class EstimateControlValueModel {
|
|
8
|
+
static calculateSummary(original: EstimateModel, latest: EstimateModel): EstimateControlValueSummaryDto;
|
|
9
|
+
static getEmptySummary(): EstimateControlValueSummaryDto;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=estimate-control-value.model.d.ts.map
|