@ironcode/vas-lib 3.0.0-alpha.2 → 3.0.0-alpha.5
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.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 +9 -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 +25 -13
- package/cjs/lib/entity/vas-job.model.d.ts.map +1 -1
- package/cjs/lib/entity/vas-job.model.js +139 -90
- 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 +16 -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 +24 -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 +121 -0
- package/cjs/lib/model/estimate-control/estimate-item.model.js.map +1 -0
- package/cjs/lib/model/estimate-control/estimate.dto.d.ts +37 -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 +265 -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 +8 -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 +694 -154
- 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 +9 -3
- package/lib/entity/vas-job.model.d.ts +25 -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 +15 -0
- package/lib/model/estimate-control/estimate-item.model.d.ts +23 -0
- package/lib/model/estimate-control/estimate.dto.d.ts +36 -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 +7 -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"));
|
|
@@ -9,20 +9,14 @@ const vas_restricted_account_object_model_1 = require("./vas-restricted-account-
|
|
|
9
9
|
const model_1 = require("../model");
|
|
10
10
|
const control_value_1 = require("../control-value");
|
|
11
11
|
const only_1 = require("../utils/only");
|
|
12
|
-
const try_json_1 = require("../utils/try-json");
|
|
13
12
|
const is_plain_object_1 = require("../utils/is-plain-object");
|
|
13
|
+
const vas_field_model_1 = require("./vas-field.model");
|
|
14
14
|
let jobStaticProps;
|
|
15
|
-
function getJobStaticProperties() {
|
|
16
|
-
if (jobStaticProps) {
|
|
17
|
-
return jobStaticProps;
|
|
18
|
-
}
|
|
19
|
-
return jobStaticProps = new Set(Object.getOwnPropertyNames(VasJobModel.empty()));
|
|
20
|
-
}
|
|
21
15
|
/**
|
|
22
|
-
*
|
|
16
|
+
* VasJobBaseModel
|
|
23
17
|
*/
|
|
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) {
|
|
18
|
+
class VasJobBaseModel extends vas_restricted_account_object_model_1.VasRestrictedAccountObjectModel {
|
|
19
|
+
constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account, accessGroup, reference, jobDate, jobStatus, jobStatusLastUpdate, jobType, assigneeId, formId, timeZoneOffset, pendingFields, childModified, version, geoLocation, files, fields, jobEmails, notes, reports, tasks, instruction) {
|
|
26
20
|
super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account, accessGroup);
|
|
27
21
|
this.id = id;
|
|
28
22
|
this.created = created;
|
|
@@ -38,6 +32,7 @@ class VasJobModel extends vas_restricted_account_object_model_1.VasRestrictedAcc
|
|
|
38
32
|
this.reference = reference;
|
|
39
33
|
this.jobDate = jobDate;
|
|
40
34
|
this.jobStatus = jobStatus;
|
|
35
|
+
this.jobStatusLastUpdate = jobStatusLastUpdate;
|
|
41
36
|
this.jobType = jobType;
|
|
42
37
|
this.assigneeId = assigneeId;
|
|
43
38
|
this.formId = formId;
|
|
@@ -67,49 +62,8 @@ class VasJobModel extends vas_restricted_account_object_model_1.VasRestrictedAcc
|
|
|
67
62
|
if (jobStaticProps) {
|
|
68
63
|
return jobStaticProps;
|
|
69
64
|
}
|
|
70
|
-
return jobStaticProps =
|
|
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);
|
|
65
|
+
return jobStaticProps =
|
|
66
|
+
new Set(Object.getOwnPropertyNames(VasJobDocumentModel.empty()));
|
|
113
67
|
}
|
|
114
68
|
/**
|
|
115
69
|
* Returns an object describing how many attachments were added to this job
|
|
@@ -150,39 +104,6 @@ class VasJobModel extends vas_restricted_account_object_model_1.VasRestrictedAcc
|
|
|
150
104
|
getValueByPath(path = []) {
|
|
151
105
|
return (0, get_value_by_path_1.getValueByPath)(Array.isArray(path) ? path : path.split('.'), this);
|
|
152
106
|
}
|
|
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
107
|
/**
|
|
187
108
|
* This method will parse a syntax that allows us to build strings from the
|
|
188
109
|
* values of from the job model. For example if the job model was:
|
|
@@ -241,8 +162,8 @@ class VasJobModel extends vas_restricted_account_object_model_1.VasRestrictedAcc
|
|
|
241
162
|
if (objectKey === 'job') {
|
|
242
163
|
result = (this.getValueByPath(path) || '').toString();
|
|
243
164
|
}
|
|
244
|
-
else if (objectKey === 'fields'
|
|
245
|
-
result = (
|
|
165
|
+
else if (objectKey === 'fields') {
|
|
166
|
+
result = (this.getValueByPath(['fields', ...path]) || '').toString();
|
|
246
167
|
}
|
|
247
168
|
else if (objectKey.length && options.objects && options.objects[objectKey] !== undefined) {
|
|
248
169
|
result = ((0, get_value_by_path_1.getValueByPath)(path, options.objects[objectKey]) || '').toString();
|
|
@@ -293,5 +214,133 @@ class VasJobModel extends vas_restricted_account_object_model_1.VasRestrictedAcc
|
|
|
293
214
|
]);
|
|
294
215
|
}
|
|
295
216
|
}
|
|
296
|
-
exports.
|
|
217
|
+
exports.VasJobBaseModel = VasJobBaseModel;
|
|
218
|
+
class VasJobRelationalModel extends VasJobBaseModel {
|
|
219
|
+
getValueByPath(path = []) {
|
|
220
|
+
const parts = Array.isArray(path) ? path : path.split('.');
|
|
221
|
+
if (parts[0] === 'fields') {
|
|
222
|
+
return this.getFieldValueByPath(parts[1], parts.slice(2));
|
|
223
|
+
}
|
|
224
|
+
return (0, get_value_by_path_1.getValueByPath)(parts, this);
|
|
225
|
+
}
|
|
226
|
+
getFieldsMap() {
|
|
227
|
+
return this.fields.reduce((p, c) => {
|
|
228
|
+
p[c.controlName] = c.value;
|
|
229
|
+
return p;
|
|
230
|
+
}, {});
|
|
231
|
+
}
|
|
232
|
+
getFieldValueByPath(controlName, path) {
|
|
233
|
+
for (const field of this.fields) {
|
|
234
|
+
if (field.controlName === controlName) {
|
|
235
|
+
if (path.length === 0) {
|
|
236
|
+
return field.value;
|
|
237
|
+
}
|
|
238
|
+
if (field.value === null) {
|
|
239
|
+
return path.length >= 1 ? undefined : null;
|
|
240
|
+
}
|
|
241
|
+
if ((0, is_plain_object_1.isPlainObject)(field.value)) {
|
|
242
|
+
return (0, get_value_by_path_1.getValueByPath)(path, field.value);
|
|
243
|
+
}
|
|
244
|
+
return undefined;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
return undefined;
|
|
248
|
+
}
|
|
249
|
+
static fromDto(dto) {
|
|
250
|
+
if (dto.fields !== undefined && !Array.isArray(dto.fields)) {
|
|
251
|
+
throw Error('fields must be an array');
|
|
252
|
+
}
|
|
253
|
+
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.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);
|
|
254
|
+
}
|
|
255
|
+
static empty() {
|
|
256
|
+
return new VasJobRelationalModel('', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', (0, moment_1.default)().utcOffset(), 0, '', 0, (0, model_1.getEmptyGeoLocation)(), [], [], [], [], [], [], null);
|
|
257
|
+
}
|
|
258
|
+
toDto() {
|
|
259
|
+
return {
|
|
260
|
+
id: this.id,
|
|
261
|
+
created: this.created,
|
|
262
|
+
createdBy: this.createdBy,
|
|
263
|
+
modified: this.modified,
|
|
264
|
+
modifiedBy: this.modifiedBy,
|
|
265
|
+
serverCreated: this.serverCreated,
|
|
266
|
+
serverModified: this.serverModified,
|
|
267
|
+
createdByName: this.createdByName,
|
|
268
|
+
modifiedByName: this.modifiedByName,
|
|
269
|
+
account: this.account,
|
|
270
|
+
accessGroup: this.accessGroup,
|
|
271
|
+
reference: this.reference,
|
|
272
|
+
jobDate: this.jobDate,
|
|
273
|
+
jobStatus: this.jobStatus,
|
|
274
|
+
jobStatusLastUpdate: this.jobStatusLastUpdate,
|
|
275
|
+
jobType: this.jobType,
|
|
276
|
+
assigneeId: this.assigneeId,
|
|
277
|
+
formId: this.formId,
|
|
278
|
+
timeZoneOffset: this.timeZoneOffset,
|
|
279
|
+
pendingFields: this.pendingFields,
|
|
280
|
+
childModified: this.childModified,
|
|
281
|
+
version: this.version,
|
|
282
|
+
geoLocation: this.geoLocation,
|
|
283
|
+
files: this.files,
|
|
284
|
+
fields: this.fields.map(f => f.toDto()),
|
|
285
|
+
jobEmails: this.jobEmails,
|
|
286
|
+
notes: this.notes,
|
|
287
|
+
reports: this.reports,
|
|
288
|
+
tasks: this.tasks,
|
|
289
|
+
instruction: this.instruction
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
exports.VasJobRelationalModel = VasJobRelationalModel;
|
|
294
|
+
class VasJobDocumentModel extends VasJobBaseModel {
|
|
295
|
+
static fromRelationalDto(dto) {
|
|
296
|
+
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.geoLocation || (0, model_1.getEmptyGeoLocation)(), dto.files || [], (dto.fields || []).reduce((p, c) => {
|
|
297
|
+
p[c.controlName.replace('fields.', '')] = c.value;
|
|
298
|
+
return p;
|
|
299
|
+
}, {}), dto.jobEmails || [], dto.notes || [], dto.reports || [], dto.tasks || [], dto.instruction || null);
|
|
300
|
+
}
|
|
301
|
+
static fromDto(dto) {
|
|
302
|
+
if (dto.fields !== undefined && !(0, is_plain_object_1.isPlainObject)(dto.fields)) {
|
|
303
|
+
throw Error('fields must be an object');
|
|
304
|
+
}
|
|
305
|
+
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.geoLocation || (0, model_1.getEmptyGeoLocation)(), dto.files || [], dto.fields || {}, dto.jobEmails || [], dto.notes || [], dto.reports || [], dto.tasks || [], dto.instruction || null);
|
|
306
|
+
}
|
|
307
|
+
static empty() {
|
|
308
|
+
return new VasJobDocumentModel('', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', (0, moment_1.default)().utcOffset(), 0, '', 0, (0, model_1.getEmptyGeoLocation)(), [], {}, [], [], [], [], null);
|
|
309
|
+
}
|
|
310
|
+
toDto() {
|
|
311
|
+
return {
|
|
312
|
+
id: this.id,
|
|
313
|
+
created: this.created,
|
|
314
|
+
createdBy: this.createdBy,
|
|
315
|
+
modified: this.modified,
|
|
316
|
+
modifiedBy: this.modifiedBy,
|
|
317
|
+
serverCreated: this.serverCreated,
|
|
318
|
+
serverModified: this.serverModified,
|
|
319
|
+
createdByName: this.createdByName,
|
|
320
|
+
modifiedByName: this.modifiedByName,
|
|
321
|
+
account: this.account,
|
|
322
|
+
accessGroup: this.accessGroup,
|
|
323
|
+
reference: this.reference,
|
|
324
|
+
jobDate: this.jobDate,
|
|
325
|
+
jobStatus: this.jobStatus,
|
|
326
|
+
jobStatusLastUpdate: this.jobStatusLastUpdate,
|
|
327
|
+
jobType: this.jobType,
|
|
328
|
+
assigneeId: this.assigneeId,
|
|
329
|
+
formId: this.formId,
|
|
330
|
+
timeZoneOffset: this.timeZoneOffset,
|
|
331
|
+
pendingFields: this.pendingFields,
|
|
332
|
+
childModified: this.childModified,
|
|
333
|
+
version: this.version,
|
|
334
|
+
geoLocation: this.geoLocation,
|
|
335
|
+
files: this.files,
|
|
336
|
+
fields: this.fields,
|
|
337
|
+
jobEmails: this.jobEmails,
|
|
338
|
+
notes: this.notes,
|
|
339
|
+
reports: this.reports,
|
|
340
|
+
tasks: this.tasks,
|
|
341
|
+
instruction: this.instruction
|
|
342
|
+
};
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
exports.VasJobDocumentModel = VasJobDocumentModel;
|
|
297
346
|
//# 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,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CAAC,cAAc,CAAC;iCACjC,MAAM,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC;wBAC7B,CAAC;oBACH,CAAC;oBACD,OAAO,CAAC,CAAC,CAAC;wBACR,OAAO,CAAC,IAAI,CAAC,mBAAmB,EAAE,UAAU,CAAC,CAAC;oBAChD,CAAC;gBACH,CAAC;YACH,CAAC;YAED,OAAO,MAAM,CAAC;QAChB,CAAC,CAAC,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;AAC5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AO;YACL,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,aAAa,EAAE,IAAI,CAAC,aAAa;YACjC,cAAc,EAAE,IAAI,CAAC,cAAc;YACnC,aAAa,EAAE,IAAI,CAAC,aAAa;YACjC,cAAc,EAAE,IAAI,CAAC,cAAc;YACnC,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,SAAS,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,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;AArJD,kDAqJC","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 { 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 { isPlainObject } from \"../utils/is-plain-object\";\nimport { VasFieldModel } from './vas-field.model';\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\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 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 if (jobStaticProps) {\n return jobStaticProps;\n }\n return jobStaticProps =\n new Set(Object.getOwnPropertyNames(VasJobDocumentModel.empty()));\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 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') {\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 ]\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.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 '',\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 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 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.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(dto: Partial<VasJobDocumentDto>): VasJobDocumentModel {\n\n if (dto.fields !== undefined && !isPlainObject(dto.fields)) {\n throw Error('fields must be an object');\n }\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.geoLocation || getEmptyGeoLocation(),\n dto.files || [],\n dto.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 '',\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 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 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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"estimate-control-value.model.d.ts","sourceRoot":"","sources":["../../../../../../projects/vas-lib/src/lib/model/estimate-control/estimate-control-value.model.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,8BAA8B,EAAE,MAAM,8BAA8B,CAAC;AAC9E,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAKjD;;;GAGG;AACH,qBAAa,yBAAyB;IAEpC,MAAM,CAAC,gBAAgB,CACrB,QAAQ,EAAE,aAAa,EACvB,MAAM,EAAE,aAAa,GACpB,8BAA8B;IA6BjC,MAAM,CAAC,eAAe,IAAI,8BAA8B;CA8CzD"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EstimateControlValueModel = void 0;
|
|
4
|
+
const big_js_1 = require("big.js");
|
|
5
|
+
const b = (value = '0') => new big_js_1.Big(value);
|
|
6
|
+
/**
|
|
7
|
+
* Utility class for computing the summary value for an estimate control given
|
|
8
|
+
* the first and last estimates
|
|
9
|
+
*/
|
|
10
|
+
class EstimateControlValueModel {
|
|
11
|
+
static calculateSummary(original, latest) {
|
|
12
|
+
const o = original.summary;
|
|
13
|
+
const l = latest.adjusted ?
|
|
14
|
+
latest.summaryAdjusted :
|
|
15
|
+
latest.summary;
|
|
16
|
+
const s = {
|
|
17
|
+
labour: b(o.labour).minus(l.labour).toFixed(2),
|
|
18
|
+
none: b(o.none).minus(l.none).toFixed(2),
|
|
19
|
+
parts: b(o.parts).minus(l.parts).toFixed(2),
|
|
20
|
+
pm: b(o.pm).minus(l.pm).toFixed(2),
|
|
21
|
+
pl: b(o.pm).minus(l.pl).toFixed(2),
|
|
22
|
+
specialist: b(o.specialist).minus(l.specialist).toFixed(2),
|
|
23
|
+
other: b(o.other).minus(l.other).toFixed(2),
|
|
24
|
+
net: b(o.net).minus(l.net).toFixed(2),
|
|
25
|
+
vat: b(o.vat).minus(l.vat).toFixed(2),
|
|
26
|
+
gross: b(o.gross).minus(l.gross).toFixed(2),
|
|
27
|
+
hours: b(o.hours).minus(l.hours).toFixed(0),
|
|
28
|
+
labourRate: b(o.labourRate).minus(l.labourRate).toFixed(0)
|
|
29
|
+
};
|
|
30
|
+
return {
|
|
31
|
+
original: o,
|
|
32
|
+
latest: l,
|
|
33
|
+
savings: s
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
static getEmptySummary() {
|
|
37
|
+
return {
|
|
38
|
+
original: {
|
|
39
|
+
labour: '0.00',
|
|
40
|
+
none: '0.00',
|
|
41
|
+
parts: '0.00',
|
|
42
|
+
pm: '0.00',
|
|
43
|
+
pl: '0.00',
|
|
44
|
+
specialist: '0.00',
|
|
45
|
+
other: '0.00',
|
|
46
|
+
net: '0.00',
|
|
47
|
+
vat: '0.00',
|
|
48
|
+
gross: '0.00',
|
|
49
|
+
hours: '0',
|
|
50
|
+
labourRate: '0.00'
|
|
51
|
+
},
|
|
52
|
+
latest: {
|
|
53
|
+
labour: '0.00',
|
|
54
|
+
none: '0.00',
|
|
55
|
+
parts: '0.00',
|
|
56
|
+
pm: '0.00',
|
|
57
|
+
pl: '0.00',
|
|
58
|
+
specialist: '0.00',
|
|
59
|
+
other: '0.00',
|
|
60
|
+
net: '0.00',
|
|
61
|
+
vat: '0.00',
|
|
62
|
+
gross: '0.00',
|
|
63
|
+
hours: '0',
|
|
64
|
+
labourRate: '0.00'
|
|
65
|
+
},
|
|
66
|
+
savings: {
|
|
67
|
+
labour: '0.00',
|
|
68
|
+
none: '0.00',
|
|
69
|
+
parts: '0.00',
|
|
70
|
+
pm: '0.00',
|
|
71
|
+
pl: '0.00',
|
|
72
|
+
specialist: '0.00',
|
|
73
|
+
other: '0.00',
|
|
74
|
+
net: '0.00',
|
|
75
|
+
vat: '0.00',
|
|
76
|
+
gross: '0.00',
|
|
77
|
+
hours: '0',
|
|
78
|
+
labourRate: '0.00'
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
exports.EstimateControlValueModel = EstimateControlValueModel;
|
|
84
|
+
//# sourceMappingURL=estimate-control-value.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"estimate-control-value.model.js","sourceRoot":"","sources":["../../../../../../projects/vas-lib/src/lib/model/estimate-control/estimate-control-value.model.ts"],"names":[],"mappings":";;;AAAA,mCAAwC;AAKxC,MAAM,CAAC,GAAG,CAAC,QAAmB,GAAG,EAAE,EAAE,CAAC,IAAI,YAAG,CAAC,KAAK,CAAC,CAAC;AAErD;;;GAGG;AACH,MAAa,yBAAyB;IAEpC,MAAM,CAAC,gBAAgB,CACrB,QAAuB,EACvB,MAAqB;QAGrB,MAAM,CAAC,GAAuB,QAAQ,CAAC,OAAO,CAAC;QAE/C,MAAM,CAAC,GAAuB,MAAM,CAAC,QAAQ,CAAC,CAAC;YAC7C,MAAM,CAAC,eAAqC,CAAC,CAAC;YAC9C,MAAM,CAAC,OAAO,CAAC;QAEjB,MAAM,CAAC,GAA8C;YACnD,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;YAC9C,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;YACxC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;YAC3C,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;YAClC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,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M;gBAClB,KAAK,EAAE,MAAM;gBACb,GAAG,EAAE,MAAM;gBACX,GAAG,EAAE,MAAM;gBACX,KAAK,EAAE,MAAM;gBACb,KAAK,EAAE,GAAG;gBACV,UAAU,EAAE,MAAM;aACnB;YACD,MAAM,EAAE;gBACN,MAAM,EAAE,MAAM;gBACd,IAAI,EAAE,MAAM;gBACZ,KAAK,EAAE,MAAM;gBACb,EAAE,EAAE,MAAM;gBACV,EAAE,EAAE,MAAM;gBACV,UAAU,EAAE,MAAM;gBAClB,KAAK,EAAE,MAAM;gBACb,GAAG,EAAE,MAAM;gBACX,GAAG,EAAE,MAAM;gBACX,KAAK,EAAE,MAAM;gBACb,KAAK,EAAE,GAAG;gBACV,UAAU,EAAE,MAAM;aACnB;YACD,OAAO,EAAE;gBACP,MAAM,EAAE,MAAM;gBACd,IAAI,EAAE,MAAM;gBACZ,KAAK,EAAE,MAAM;gBACb,EAAE,EAAE,MAAM;gBACV,EAAE,EAAE,MAAM;gBACV,UAAU,EAAE,MAAM;gBAClB,KAAK,EAAE,MAAM;gBACb,GAAG,EAAE,MAAM;gBACX,GAAG,EAAE,MAAM;gBACX,KAAK,EAAE,MAAM;gBACb,KAAK,EAAE,GAAG;gBACV,UAAU,EAAE,MAAM;aACnB;SACF,CAAC;IACJ,CAAC;CACF;AAhFD,8DAgFC","sourcesContent":["import { Big, BigSource } from 'big.js';\nimport { EstimateControlValueSummaryDto } from './estimate-control-value.dto';\nimport { EstimateModel } from './estimate.model';\nimport { EstimateSummaryDto } from './estimate.dto';\n\nconst b = (value: BigSource = '0') => new Big(value);\n\n/**\n * Utility class for computing the summary value for an estimate control given\n * the first and last estimates\n */\nexport class EstimateControlValueModel {\n\n static calculateSummary(\n original: EstimateModel,\n latest: EstimateModel\n ): EstimateControlValueSummaryDto {\n\n const o: EstimateSummaryDto = original.summary;\n\n const l: EstimateSummaryDto = latest.adjusted ?\n latest.summaryAdjusted as EstimateSummaryDto :\n latest.summary;\n\n const s: EstimateControlValueSummaryDto['savings'] = {\n labour: b(o.labour).minus(l.labour).toFixed(2),\n none: b(o.none).minus(l.none).toFixed(2),\n parts: b(o.parts).minus(l.parts).toFixed(2),\n pm: b(o.pm).minus(l.pm).toFixed(2),\n pl: b(o.pm).minus(l.pl).toFixed(2),\n specialist: b(o.specialist).minus(l.specialist).toFixed(2),\n other: b(o.other).minus(l.other).toFixed(2),\n net: b(o.net).minus(l.net).toFixed(2),\n vat: b(o.vat).minus(l.vat).toFixed(2),\n gross: b(o.gross).minus(l.gross).toFixed(2),\n hours: b(o.hours).minus(l.hours).toFixed(0),\n labourRate: b(o.labourRate).minus(l.labourRate).toFixed(0)\n };\n return {\n original: o,\n latest: l,\n savings: s\n };\n }\n\n static getEmptySummary(): EstimateControlValueSummaryDto {\n return {\n original: {\n labour: '0.00',\n none: '0.00',\n parts: '0.00',\n pm: '0.00',\n pl: '0.00',\n specialist: '0.00',\n other: '0.00',\n net: '0.00',\n vat: '0.00',\n gross: '0.00',\n hours: '0',\n labourRate: '0.00'\n },\n latest: {\n labour: '0.00',\n none: '0.00',\n parts: '0.00',\n pm: '0.00',\n pl: '0.00',\n specialist: '0.00',\n other: '0.00',\n net: '0.00',\n vat: '0.00',\n gross: '0.00',\n hours: '0',\n labourRate: '0.00'\n },\n savings: {\n labour: '0.00',\n none: '0.00',\n parts: '0.00',\n pm: '0.00',\n pl: '0.00',\n specialist: '0.00',\n other: '0.00',\n net: '0.00',\n vat: '0.00',\n gross: '0.00',\n hours: '0',\n labourRate: '0.00'\n }\n };\n }\n}\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { EstimateCostCategory, EstimateWorkCategory } from './estimate.types';
|
|
2
|
+
export interface EstimateItemDto {
|
|
3
|
+
id: string;
|
|
4
|
+
description: string;
|
|
5
|
+
type: string;
|
|
6
|
+
quantity: number;
|
|
7
|
+
units: number;
|
|
8
|
+
price: string;
|
|
9
|
+
workCategory: EstimateWorkCategory;
|
|
10
|
+
costCategory: EstimateCostCategory;
|
|
11
|
+
comment: string;
|
|
12
|
+
quantityAdjusted: number;
|
|
13
|
+
unitsAdjusted: number;
|
|
14
|
+
priceAdjusted: string;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=estimate-item.dto.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"estimate-item.dto.d.ts","sourceRoot":"","sources":["../../../../../../projects/vas-lib/src/lib/model/estimate-control/estimate-item.dto.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAE9E,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,oBAAoB,CAAC;IACnC,YAAY,EAAE,oBAAoB,CAAC;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,gBAAgB,EAAE,MAAM,CAAC;IACzB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;CACvB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"estimate-item.dto.js","sourceRoot":"","sources":["../../../../../../projects/vas-lib/src/lib/model/estimate-control/estimate-item.dto.ts"],"names":[],"mappings":"","sourcesContent":["import { EstimateCostCategory, EstimateWorkCategory } from './estimate.types';\n\nexport interface EstimateItemDto {\n id: string;\n description: string;\n type: string;\n quantity: number;\n units: number;\n price: string;\n workCategory: EstimateWorkCategory;\n costCategory: EstimateCostCategory;\n comment: string;\n quantityAdjusted: number;\n unitsAdjusted: number;\n priceAdjusted: string;\n}\n"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { EstimateItemDto } from './estimate-item.dto';
|
|
2
|
+
import { EstimateCostCategory, EstimateWorkCategory } from './estimate.types';
|
|
3
|
+
export declare class EstimateItemModel {
|
|
4
|
+
id: string;
|
|
5
|
+
description: string;
|
|
6
|
+
type: string;
|
|
7
|
+
quantity: number;
|
|
8
|
+
quantityAdjusted: number;
|
|
9
|
+
units: number;
|
|
10
|
+
unitsAdjusted: number;
|
|
11
|
+
price: string;
|
|
12
|
+
priceAdjusted: string;
|
|
13
|
+
workCategory: EstimateWorkCategory;
|
|
14
|
+
costCategory: EstimateCostCategory;
|
|
15
|
+
comment: string;
|
|
16
|
+
constructor(id: string, description: string, type: string, quantity: number, quantityAdjusted: number, units: number, unitsAdjusted: number, price: string, priceAdjusted: string, workCategory: EstimateWorkCategory, costCategory: EstimateCostCategory, comment: string);
|
|
17
|
+
getTotalUnits(adjusted?: boolean): string;
|
|
18
|
+
getLineValue(labourRate?: string, timeBasis?: string, adjusted?: boolean): string;
|
|
19
|
+
toDto(): EstimateItemDto;
|
|
20
|
+
static create(): EstimateItemModel;
|
|
21
|
+
static fromDto(dto: Partial<EstimateItemDto>): EstimateItemModel;
|
|
22
|
+
static equal(a: EstimateItemDto | undefined, b: EstimateItemDto | undefined): boolean;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=estimate-item.model.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"estimate-item.model.d.ts","sourceRoot":"","sources":["../../../../../../projects/vas-lib/src/lib/model/estimate-control/estimate-item.model.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAe9E,qBAAa,iBAAiB;IAGnB,EAAE,EAAE,MAAM;IACV,WAAW,EAAE,MAAM;IACnB,IAAI,EAAE,MAAM;IACZ,QAAQ,EAAE,MAAM;IAChB,gBAAgB,EAAE,MAAM;IACxB,KAAK,EAAE,MAAM;IACb,aAAa,EAAE,MAAM;IACrB,KAAK,EAAE,MAAM;IACb,aAAa,EAAE,MAAM;IACrB,YAAY,EAAE,oBAAoB;IAClC,YAAY,EAAE,oBAAoB;IAClC,OAAO,EAAE,MAAM;gBAXf,EAAE,EAAE,MAAM,EACV,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,gBAAgB,EAAE,MAAM,EACxB,KAAK,EAAE,MAAM,EACb,aAAa,EAAE,MAAM,EACrB,KAAK,EAAE,MAAM,EACb,aAAa,EAAE,MAAM,EACrB,YAAY,EAAE,oBAAoB,EAClC,YAAY,EAAE,oBAAoB,EAClC,OAAO,EAAE,MAAM;IAIxB,aAAa,CAAC,QAAQ,UAAQ,GAAG,MAAM;IAMvC,YAAY,CACV,UAAU,SAAM,EAChB,SAAS,SAAM,EACf,QAAQ,UAAQ,GACf,MAAM;IA+CT,KAAK,IAAI,eAAe;IAiBxB,MAAM,CAAC,MAAM,IAAI,iBAAiB;IAiBlC,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,iBAAiB;IAiBhE,MAAM,CAAC,KAAK,CACV,CAAC,EAAE,eAAe,GAAG,SAAS,EAC9B,CAAC,EAAE,eAAe,GAAG,SAAS,GAC7B,OAAO;CAiBX"}
|