@ironcode/vas-lib 2.3.0 → 3.0.0-alpha.10

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.
Files changed (143) hide show
  1. package/cjs/lib/control-value/vas-camera-control-value.model.d.ts +6 -2
  2. package/cjs/lib/control-value/vas-camera-control-value.model.d.ts.map +1 -1
  3. package/cjs/lib/control-value/vas-camera-control-value.model.js +10 -0
  4. package/cjs/lib/control-value/vas-camera-control-value.model.js.map +1 -1
  5. package/cjs/lib/entity/vas-base.model.d.ts +1 -1
  6. package/cjs/lib/entity/vas-base.model.d.ts.map +1 -1
  7. package/cjs/lib/entity/vas-base.model.js.map +1 -1
  8. package/cjs/lib/entity/vas-control.model.d.ts +4 -4
  9. package/cjs/lib/entity/vas-control.model.d.ts.map +1 -1
  10. package/cjs/lib/entity/vas-control.model.js +1 -1
  11. package/cjs/lib/entity/vas-control.model.js.map +1 -1
  12. package/cjs/lib/entity/vas-field.dto.d.ts +4 -7
  13. package/cjs/lib/entity/vas-field.dto.d.ts.map +1 -1
  14. package/cjs/lib/entity/vas-field.dto.js.map +1 -1
  15. package/cjs/lib/entity/vas-field.model.d.ts +4 -4
  16. package/cjs/lib/entity/vas-field.model.d.ts.map +1 -1
  17. package/cjs/lib/entity/vas-field.model.js +1 -1
  18. package/cjs/lib/entity/vas-field.model.js.map +1 -1
  19. package/cjs/lib/entity/vas-form.model.d.ts +4 -4
  20. package/cjs/lib/entity/vas-form.model.d.ts.map +1 -1
  21. package/cjs/lib/entity/vas-form.model.js +1 -1
  22. package/cjs/lib/entity/vas-form.model.js.map +1 -1
  23. package/cjs/lib/entity/vas-group.model.d.ts +2 -2
  24. package/cjs/lib/entity/vas-group.model.d.ts.map +1 -1
  25. package/cjs/lib/entity/vas-group.model.js.map +1 -1
  26. package/cjs/lib/entity/vas-job-copy.d.ts +12 -12
  27. package/cjs/lib/entity/vas-job-copy.d.ts.map +1 -1
  28. package/cjs/lib/entity/vas-job-copy.js.map +1 -1
  29. package/cjs/lib/entity/vas-job.dto.d.ts +12 -6
  30. package/cjs/lib/entity/vas-job.dto.d.ts.map +1 -1
  31. package/cjs/lib/entity/vas-job.dto.js.map +1 -1
  32. package/cjs/lib/entity/vas-job.model.d.ts +34 -142
  33. package/cjs/lib/entity/vas-job.model.d.ts.map +1 -1
  34. package/cjs/lib/entity/vas-job.model.js +248 -341
  35. package/cjs/lib/entity/vas-job.model.js.map +1 -1
  36. package/cjs/lib/model/estimate-control/estimate-control-value.dto.d.ts +14 -0
  37. package/cjs/lib/model/estimate-control/estimate-control-value.dto.d.ts.map +1 -0
  38. package/cjs/lib/model/estimate-control/estimate-control-value.dto.js +3 -0
  39. package/cjs/lib/model/estimate-control/estimate-control-value.dto.js.map +1 -0
  40. package/cjs/lib/model/estimate-control/estimate-control-value.model.d.ts +11 -0
  41. package/cjs/lib/model/estimate-control/estimate-control-value.model.d.ts.map +1 -0
  42. package/cjs/lib/model/estimate-control/estimate-control-value.model.js +84 -0
  43. package/cjs/lib/model/estimate-control/estimate-control-value.model.js.map +1 -0
  44. package/cjs/lib/model/estimate-control/estimate-item.dto.d.ts +16 -0
  45. package/cjs/lib/model/estimate-control/estimate-item.dto.d.ts.map +1 -0
  46. package/cjs/lib/model/estimate-control/estimate-item.dto.js +3 -0
  47. package/cjs/lib/model/estimate-control/estimate-item.dto.js.map +1 -0
  48. package/cjs/lib/model/estimate-control/estimate-item.model.d.ts +24 -0
  49. package/cjs/lib/model/estimate-control/estimate-item.model.d.ts.map +1 -0
  50. package/cjs/lib/model/estimate-control/estimate-item.model.js +121 -0
  51. package/cjs/lib/model/estimate-control/estimate-item.model.js.map +1 -0
  52. package/cjs/lib/model/estimate-control/estimate.dto.d.ts +37 -0
  53. package/cjs/lib/model/estimate-control/estimate.dto.d.ts.map +1 -0
  54. package/cjs/lib/model/estimate-control/estimate.dto.js +3 -0
  55. package/cjs/lib/model/estimate-control/estimate.dto.js.map +1 -0
  56. package/cjs/lib/model/estimate-control/estimate.model.d.ts +55 -0
  57. package/cjs/lib/model/estimate-control/estimate.model.d.ts.map +1 -0
  58. package/cjs/lib/model/estimate-control/estimate.model.js +279 -0
  59. package/cjs/lib/model/estimate-control/estimate.model.js.map +1 -0
  60. package/cjs/lib/model/estimate-control/estimate.types.d.ts +3 -0
  61. package/cjs/lib/model/estimate-control/estimate.types.d.ts.map +1 -0
  62. package/cjs/lib/model/estimate-control/estimate.types.js +3 -0
  63. package/cjs/lib/model/estimate-control/estimate.types.js.map +1 -0
  64. package/cjs/lib/model/estimate-control/index.d.ts +8 -0
  65. package/cjs/lib/model/estimate-control/index.d.ts.map +1 -0
  66. package/cjs/lib/model/estimate-control/index.js +11 -0
  67. package/cjs/lib/model/estimate-control/index.js.map +1 -0
  68. package/cjs/lib/model/firebase-document-meta.interface.d.ts +6 -0
  69. package/cjs/lib/model/firebase-document-meta.interface.d.ts.map +1 -0
  70. package/cjs/lib/model/firebase-document-meta.interface.js +3 -0
  71. package/cjs/lib/model/firebase-document-meta.interface.js.map +1 -0
  72. package/cjs/lib/model/index.d.ts +3 -0
  73. package/cjs/lib/model/index.d.ts.map +1 -1
  74. package/cjs/lib/model/index.js +3 -0
  75. package/cjs/lib/model/index.js.map +1 -1
  76. package/cjs/lib/model/report-invocation.d.ts +40 -0
  77. package/cjs/lib/model/report-invocation.d.ts.map +1 -0
  78. package/cjs/lib/model/report-invocation.js +3 -0
  79. package/cjs/lib/model/report-invocation.js.map +1 -0
  80. package/cjs/lib/utils/get-value-by-path.d.ts +5 -16
  81. package/cjs/lib/utils/get-value-by-path.d.ts.map +1 -1
  82. package/cjs/lib/utils/get-value-by-path.js +48 -59
  83. package/cjs/lib/utils/get-value-by-path.js.map +1 -1
  84. package/cjs/lib/utils/index.d.ts +8 -0
  85. package/cjs/lib/utils/index.d.ts.map +1 -0
  86. package/cjs/lib/utils/index.js +11 -0
  87. package/cjs/lib/utils/index.js.map +1 -0
  88. package/cjs/lib/utils/is-array-string.d.ts +3 -0
  89. package/cjs/lib/utils/is-array-string.d.ts.map +1 -1
  90. package/cjs/lib/utils/is-array-string.js +3 -0
  91. package/cjs/lib/utils/is-array-string.js.map +1 -1
  92. package/cjs/lib/utils/is-numeric.d.ts +2 -0
  93. package/cjs/lib/utils/is-numeric.d.ts.map +1 -0
  94. package/cjs/lib/utils/is-numeric.js +10 -0
  95. package/cjs/lib/utils/is-numeric.js.map +1 -0
  96. package/cjs/lib/utils/is-plain-object.d.ts +5 -0
  97. package/cjs/lib/utils/is-plain-object.d.ts.map +1 -0
  98. package/cjs/lib/utils/is-plain-object.js +10 -0
  99. package/cjs/lib/utils/is-plain-object.js.map +1 -0
  100. package/cjs/lib/utils/try-json.d.ts +6 -0
  101. package/cjs/lib/utils/try-json.d.ts.map +1 -0
  102. package/cjs/lib/utils/try-json.js +20 -0
  103. package/cjs/lib/utils/try-json.js.map +1 -0
  104. package/cjs/public-api.d.ts +1 -0
  105. package/cjs/public-api.d.ts.map +1 -1
  106. package/cjs/public-api.js +1 -0
  107. package/cjs/public-api.js.map +1 -1
  108. package/fesm2022/ironcode-vas-lib.mjs +831 -390
  109. package/fesm2022/ironcode-vas-lib.mjs.map +1 -1
  110. package/lib/control-value/vas-camera-control-value.model.d.ts +6 -2
  111. package/lib/entity/vas-base.model.d.ts +1 -1
  112. package/lib/entity/vas-control.model.d.ts +4 -4
  113. package/lib/entity/vas-field.dto.d.ts +4 -7
  114. package/lib/entity/vas-field.model.d.ts +4 -4
  115. package/lib/entity/vas-form.model.d.ts +4 -4
  116. package/lib/entity/vas-group.model.d.ts +2 -2
  117. package/lib/entity/vas-job-copy.d.ts +12 -12
  118. package/lib/entity/vas-job.dto.d.ts +12 -6
  119. package/lib/entity/vas-job.model.d.ts +34 -142
  120. package/lib/model/estimate-control/estimate-control-value.dto.d.ts +13 -0
  121. package/lib/model/estimate-control/estimate-control-value.model.d.ts +10 -0
  122. package/lib/model/estimate-control/estimate-item.dto.d.ts +15 -0
  123. package/lib/model/estimate-control/estimate-item.model.d.ts +23 -0
  124. package/lib/model/estimate-control/estimate.dto.d.ts +36 -0
  125. package/lib/model/estimate-control/estimate.model.d.ts +54 -0
  126. package/lib/model/estimate-control/estimate.types.d.ts +2 -0
  127. package/lib/model/estimate-control/index.d.ts +7 -0
  128. package/lib/model/firebase-document-meta.interface.d.ts +5 -0
  129. package/lib/model/index.d.ts +3 -0
  130. package/lib/model/report-invocation.d.ts +39 -0
  131. package/lib/utils/get-value-by-path.d.ts +5 -16
  132. package/lib/utils/index.d.ts +7 -0
  133. package/lib/utils/is-array-string.d.ts +3 -0
  134. package/lib/utils/is-numeric.d.ts +1 -0
  135. package/lib/utils/is-plain-object.d.ts +4 -0
  136. package/lib/utils/omit.d.ts +7 -0
  137. package/lib/utils/try-json.d.ts +5 -0
  138. package/package.json +3 -2
  139. package/public-api.d.ts +1 -0
  140. package/cjs/lib/entity/vas-job.model.spec-data.d.ts +0 -2
  141. package/cjs/lib/entity/vas-job.model.spec-data.d.ts.map +0 -1
  142. package/cjs/lib/entity/vas-job.model.spec-data.js +0 -29
  143. package/cjs/lib/entity/vas-job.model.spec-data.js.map +0 -1
@@ -1,7 +1,11 @@
1
- export interface VasCameraControlValueModel {
1
+ import { VasFileDto } from '../entity';
2
+ export interface VasCameraControlValueValue {
2
3
  webPath: string;
3
4
  path: string;
4
5
  url?: string;
5
6
  id?: string;
6
7
  }
7
- export declare function isCameraControlValueV1(object: any): object is VasCameraControlValueModel;
8
+ /** @deprecated */
9
+ export type VasCameraControlValueModel = VasCameraControlValueValue;
10
+ export declare function isCameraControlValueV1(object: any): object is VasCameraControlValueValue;
11
+ export declare function isCameraControlValueV2(object: any): object is VasFileDto;
@@ -18,7 +18,7 @@ export declare class VasBaseModel implements VasBaseDto {
18
18
  modifiedByName: string;
19
19
  constructor(id: string, created: string, serverCreated: string, createdBy: string, modified: string, serverModified: string, modifiedBy: string, createdByName: string, modifiedByName: string);
20
20
  static fromDto(dto: Partial<VasBaseDto>): VasBaseModel;
21
- static create<T extends VasBaseDto>(this: VasModelStatic<T>, user: {
21
+ static create<T extends VasBaseModel>(this: VasModelStatic<T>, user: {
22
22
  id: string;
23
23
  name: string;
24
24
  }, values?: Partial<T>): T;
@@ -1,7 +1,7 @@
1
1
  import { VasControlTypeModel } from './vas-control-type.model';
2
2
  import { VasControlDto } from './vas-control.dto';
3
3
  import { VasRestrictedAccountObjectModel } from './vas-restricted-account-object.model';
4
- import { VasFieldDtoValue } from './vas-field.dto';
4
+ import { FieldValueType } from './vas-field.dto';
5
5
  export declare type VasControlModelDefaultValueType = string | number | object;
6
6
  /**
7
7
  * ControlModel
@@ -39,7 +39,7 @@ export declare class VasControlModel extends VasRestrictedAccountObjectModel {
39
39
  * in the case of string, it maybe a json. This getter will return an
40
40
  * object if the value is a json string
41
41
  */
42
- get defaultValueDecoded(): VasFieldDtoValue;
42
+ get defaultValueDecoded(): FieldValueType;
43
43
  /**
44
44
  * Returns the name of this control to be used in the report templates
45
45
  * i.e. fields.foo -> foo
@@ -61,9 +61,9 @@ export declare class VasControlModel extends VasRestrictedAccountObjectModel {
61
61
  static fromDto(dto: Partial<VasControlDto>): VasControlModel;
62
62
  /**
63
63
  * @param {any} value the value to be parsed
64
- * @return {VasFieldDtoValue} the parsed value
64
+ * @return {FieldValueType} the parsed value
65
65
  */
66
- protected parseMaybeJson(value: any): VasFieldDtoValue;
66
+ protected parseMaybeJson(value: any): FieldValueType;
67
67
  /**
68
68
  * @return {VasControlDto}
69
69
  */
@@ -1,17 +1,14 @@
1
1
  import { VasJobDataDto } from './vas-job-data.dto';
2
2
  import { VasFileDto } from './vas-file.dto';
3
- import { GeoLocation } from '../model/geo-location';
4
- import { VasFunctionControlValueDto } from '../control-value';
5
- import { VasCameraControlValueModel } from '../control-value';
6
- declare type FieldValueType = string | number | boolean | null | GeoLocation | Array<object | string | number | boolean | VasFileDto> | Record<string, any> | VasCameraControlValueModel | VasFunctionControlValueDto;
7
- export declare type VasFieldDtoValue = FieldValueType | Record<string, FieldValueType>;
3
+ import { EstimateControlValueDto, GeoLocation } from '../model';
4
+ import { VasCameraControlValueValue, VasFunctionControlValueDto } from '../control-value';
5
+ export declare type FieldValueType = string | number | boolean | null | GeoLocation | Array<object | string | number | boolean | VasFileDto> | Record<string, any> | VasCameraControlValueValue | EstimateControlValueDto | VasFunctionControlValueDto;
8
6
  export interface VasFieldDto extends VasJobDataDto {
9
7
  control: string;
10
8
  fieldJobPointers: Array<string>;
11
- value: VasFieldDtoValue;
9
+ value: FieldValueType;
12
10
  version: number;
13
11
  controlName: string;
14
12
  controlTitle: string;
15
13
  controlTypeName: string;
16
14
  }
17
- export {};
@@ -1,4 +1,4 @@
1
- import { VasFieldDto, VasFieldDtoValue } from './vas-field.dto';
1
+ import { VasFieldDto, FieldValueType } from './vas-field.dto';
2
2
  import { VasJobDataModel } from './vas-job-data.model';
3
3
  /**
4
4
  * Prepares the value to be sent to the API. The api will only accept strings,
@@ -8,7 +8,7 @@ import { VasJobDataModel } from './vas-job-data.model';
8
8
  * @return {string | number | boolean}
9
9
  * @protected
10
10
  */
11
- export declare const prepareFieldApiValue: (value: VasFieldDtoValue) => string | number | boolean;
11
+ export declare const prepareFieldApiValue: (value: FieldValueType) => string | number | boolean;
12
12
  /**
13
13
  * VasFieldModel
14
14
  */
@@ -26,12 +26,12 @@ export declare class VasFieldModel extends VasJobDataModel {
26
26
  job: string;
27
27
  control: string;
28
28
  fieldJobPointers: Array<string>;
29
- value: VasFieldDtoValue;
29
+ value: FieldValueType;
30
30
  version: number;
31
31
  controlName: string;
32
32
  controlTitle: string;
33
33
  controlTypeName: string;
34
- constructor(id: string, created: string, serverCreated: string, createdBy: string, modified: string, serverModified: string, modifiedBy: string, createdByName: string, modifiedByName: string, account: string, job: string, control: string, fieldJobPointers: Array<string>, value: VasFieldDtoValue, version: number, controlName: string, controlTitle: string, controlTypeName: string);
34
+ constructor(id: string, created: string, serverCreated: string, createdBy: string, modified: string, serverModified: string, modifiedBy: string, createdByName: string, modifiedByName: string, account: string, job: string, control: string, fieldJobPointers: Array<string>, value: FieldValueType, version: number, controlName: string, controlTitle: string, controlTypeName: string);
35
35
  /**
36
36
  * @param {VasFieldDto} fieldDto
37
37
  * @return {VasFieldModel}
@@ -1,11 +1,11 @@
1
1
  import { VasRestrictedAccountObjectModel } from './vas-restricted-account-object.model';
2
2
  import { VasControlTypeDto } from './vas-control-type.dto';
3
3
  import { VasControlModel } from './vas-control.model';
4
- import { VasFieldDtoValue } from './vas-field.dto';
4
+ import { FieldValueType } from './vas-field.dto';
5
5
  import { VasFormDto } from './vas-form.dto';
6
6
  import { VasGroupModel } from './vas-group.model';
7
- import { VasJobModel } from './vas-job.model';
8
7
  import { VasFormConfigModel } from './vas-form-config.model';
8
+ import { VasJobModel } from './vas-job.model';
9
9
  /**
10
10
  * VasFormModel
11
11
  */
@@ -78,11 +78,11 @@ export declare class VasFormModel extends VasRestrictedAccountObjectModel {
78
78
  getControls(): Array<VasControlModel>;
79
79
  /**
80
80
  * @param {VasJobModel} jobModel
81
- * @return {Array<{id: string, value: VasFieldDtoValue}>}
81
+ * @return {Array<{id: string, value: FieldValueType}>}
82
82
  */
83
83
  getValuesByControlId(jobModel: VasJobModel): Array<{
84
84
  id: string;
85
- value: VasFieldDtoValue | undefined;
85
+ value: FieldValueType | undefined;
86
86
  }>;
87
87
  /**
88
88
  * @return {VasFormDto}
@@ -1,6 +1,6 @@
1
1
  import { VasControlModel } from './vas-control.model';
2
2
  import { VasGroupDto } from './vas-group.dto';
3
- import { VasFieldDtoValue } from './vas-field.dto';
3
+ import { FieldValueType } from './vas-field.dto';
4
4
  import { VasRestrictedAccountObjectModel } from './vas-restricted-account-object.model';
5
5
  /**
6
6
  * GroupModel
@@ -39,7 +39,7 @@ export declare class VasGroupModel extends VasRestrictedAccountObjectModel {
39
39
  */
40
40
  isVisible(valuesByControlId: Array<{
41
41
  id: string;
42
- value: VasFieldDtoValue | undefined;
42
+ value: FieldValueType | undefined;
43
43
  }>): boolean;
44
44
  /**
45
45
  * @return {VasGroupDto}
@@ -1,24 +1,24 @@
1
- import { VasJobDto } from './vas-job.dto';
1
+ import { VasJobBaseDto } from './vas-job.dto';
2
2
  export interface VasJobCopyDto {
3
- accessGroup: VasJobDto['accessGroup'];
4
- jobType: VasJobDto['jobType'];
5
- jobStatus: VasJobDto['jobStatus'];
6
- jobDate: VasJobDto['jobDate'];
7
- assigneeId: VasJobDto['assigneeId'];
3
+ accessGroup: VasJobBaseDto['accessGroup'];
4
+ jobType: VasJobBaseDto['jobType'];
5
+ jobStatus: VasJobBaseDto['jobStatus'];
6
+ jobDate: VasJobBaseDto['jobDate'];
7
+ assigneeId: VasJobBaseDto['assigneeId'];
8
8
  fields: Array<string>;
9
9
  files: Array<string>;
10
10
  reports: Array<string>;
11
11
  }
12
12
  export declare class VasJobCopyModel {
13
- accessGroup: VasJobDto['accessGroup'];
14
- jobType: VasJobDto['jobType'];
15
- jobStatus: VasJobDto['jobStatus'];
16
- jobDate: VasJobDto['jobDate'];
17
- assigneeId: VasJobDto['assigneeId'];
13
+ accessGroup: VasJobBaseDto['accessGroup'];
14
+ jobType: VasJobBaseDto['jobType'];
15
+ jobStatus: VasJobBaseDto['jobStatus'];
16
+ jobDate: VasJobBaseDto['jobDate'];
17
+ assigneeId: VasJobBaseDto['assigneeId'];
18
18
  fields: Array<string>;
19
19
  files: Array<string>;
20
20
  reports: Array<string>;
21
- constructor(accessGroup: VasJobDto['accessGroup'], jobType: VasJobDto['jobType'], jobStatus: VasJobDto['jobStatus'], jobDate: VasJobDto['jobDate'], assigneeId: VasJobDto['assigneeId'], fields: Array<string>, files: Array<string>, reports: Array<string>);
21
+ constructor(accessGroup: VasJobBaseDto['accessGroup'], jobType: VasJobBaseDto['jobType'], jobStatus: VasJobBaseDto['jobStatus'], jobDate: VasJobBaseDto['jobDate'], assigneeId: VasJobBaseDto['assigneeId'], fields: Array<string>, files: Array<string>, reports: Array<string>);
22
22
  static fromDto(dto: Partial<VasJobCopyDto>): VasJobCopyModel;
23
23
  toDto(): VasJobCopyDto;
24
24
  toApiDto(): Record<string, unknown>;
@@ -1,16 +1,17 @@
1
1
  import { VasFileDto } from './vas-file.dto';
2
2
  import { VasRestrictedAccountObjectDto } from './vas-restricted-account-object.dto';
3
- import { VasFieldDto, VasFieldDtoValue } from './vas-field.dto';
3
+ import { FieldValueType, VasFieldDto } from './vas-field.dto';
4
4
  import { GeoLocation } from '../model';
5
5
  import { VasReportDto } from './vas-report.dto';
6
6
  import { VasTaskDto } from './vas-task.dto';
7
7
  import { VasNoteDto } from './vas-note.dto';
8
8
  import { VasJobEmailDto } from './vas-job-email.dto';
9
9
  import { VasInstructionDto } from './vas-instruction.dto';
10
- export interface VasJobStaticDto extends VasRestrictedAccountObjectDto {
10
+ export interface VasJobBaseDto extends VasRestrictedAccountObjectDto {
11
11
  reference: string;
12
12
  jobDate: string;
13
13
  jobStatus: string;
14
+ jobStatusLastUpdate: string;
14
15
  jobType: string;
15
16
  assigneeId: string;
16
17
  formId: string;
@@ -18,15 +19,20 @@ export interface VasJobStaticDto extends VasRestrictedAccountObjectDto {
18
19
  pendingFields: number;
19
20
  childModified: string;
20
21
  version: number;
21
- createdByDisplayName: string;
22
- modifiedByDisplayName: string;
22
+ followUpDate: string;
23
+ followUpStatus: string;
24
+ followUpNote: string;
23
25
  geoLocation: GeoLocation;
24
26
  files: Array<VasFileDto>;
25
- fields: Array<VasFieldDto>;
26
27
  jobEmails: Array<VasJobEmailDto>;
27
28
  notes: Array<VasNoteDto>;
28
29
  reports: Array<VasReportDto>;
29
30
  tasks: Array<VasTaskDto>;
30
31
  instruction: null | VasInstructionDto;
31
32
  }
32
- export declare type VasJobDto = VasJobStaticDto & Record<string, VasFieldDtoValue>;
33
+ export interface VasJobRelationalDto extends VasJobBaseDto {
34
+ fields: Array<VasFieldDto>;
35
+ }
36
+ export interface VasJobDocumentDto extends VasJobBaseDto {
37
+ fields: Record<string, FieldValueType>;
38
+ }
@@ -1,27 +1,24 @@
1
1
  import { VasFileDto } from './vas-file.dto';
2
2
  import { VasBaseDto } from './vas-base.dto';
3
- import { VasFieldDto, VasFieldDtoValue } from './vas-field.dto';
3
+ import { FieldValueType } from './vas-field.dto';
4
4
  import { VasFormModel } from './vas-form.model';
5
- import { VasJobDto } from './vas-job.dto';
5
+ import { VasJobBaseDto, VasJobDocumentDto, VasJobRelationalDto } from './vas-job.dto';
6
6
  import { VasRestrictedAccountObjectModel } from './vas-restricted-account-object.model';
7
7
  import { GeoLocation } from '../model';
8
- import { VasFormDto } from './vas-form.dto';
9
8
  import { VasReportDto } from './vas-report.dto';
10
9
  import { VasTaskDto } from './vas-task.dto';
11
10
  import { VasNoteDto } from './vas-note.dto';
12
11
  import { VasJobEmailDto } from './vas-job-email.dto';
13
12
  import { VasInstructionDto } from './vas-instruction.dto';
14
- export declare interface VasJobModelDynamicInterface {
15
- [s: string]: string | number | Record<string, VasFieldDtoValue>;
16
- }
13
+ import { VasFieldModel } from './vas-field.model';
17
14
  export interface ParseSyntaxOptions {
18
15
  timeZoneOffset: number;
19
- objects?: Record<string, Partial<VasBaseDto> | Record<string, VasFieldDtoValue>>;
16
+ objects?: Record<string, Partial<VasBaseDto> | Record<string, FieldValueType>>;
20
17
  }
21
18
  /**
22
- * JobModel
19
+ * VasJobBaseModel
23
20
  */
24
- export declare class VasJobModel extends VasRestrictedAccountObjectModel {
21
+ export declare abstract class VasJobBaseModel<FType extends Record<string, FieldValueType> | Array<VasFieldModel>> extends VasRestrictedAccountObjectModel {
25
22
  id: string;
26
23
  created: string;
27
24
  serverCreated: string;
@@ -36,6 +33,7 @@ export declare class VasJobModel extends VasRestrictedAccountObjectModel {
36
33
  reference: string;
37
34
  jobDate: string;
38
35
  jobStatus: string;
36
+ jobStatusLastUpdate: string;
39
37
  jobType: string;
40
38
  assigneeId: string;
41
39
  formId: string;
@@ -43,58 +41,24 @@ export declare class VasJobModel extends VasRestrictedAccountObjectModel {
43
41
  pendingFields: number;
44
42
  childModified: string;
45
43
  version: number;
46
- createdByDisplayName: string;
47
- modifiedByDisplayName: string;
44
+ followUpDate: string;
45
+ followUpStatus: string;
46
+ followUpNote: string;
48
47
  geoLocation: GeoLocation;
49
48
  files: Array<VasFileDto>;
50
- fields: Array<VasFieldDto>;
49
+ fields: FType;
51
50
  jobEmails: Array<VasJobEmailDto>;
52
51
  notes: Array<VasNoteDto>;
53
52
  reports: Array<VasReportDto>;
54
53
  tasks: Array<VasTaskDto>;
55
54
  instruction: VasInstructionDto | null;
56
- constructor(id: string, created: string, serverCreated: string, createdBy: string, modified: string, serverModified: string, modifiedBy: string, createdByName: string, modifiedByName: string, account: string, accessGroup: string, reference: string, jobDate: string, jobStatus: string, jobType: string, assigneeId: string, formId: string, timeZoneOffset: number, pendingFields: number, childModified: string, version: number, createdByDisplayName: string, modifiedByDisplayName: string, geoLocation: GeoLocation, files: Array<VasFileDto>, fields: Array<VasFieldDto>, jobEmails: Array<VasJobEmailDto>, notes: Array<VasNoteDto>, reports: Array<VasReportDto>, tasks: Array<VasTaskDto>, instruction: VasInstructionDto | null);
57
- /**
58
- * Returns this with the dynamic interface
59
- * @return {VasJobModelDynamicInterface}
60
- */
61
- get $this(): VasJobModelDynamicInterface;
62
- /**
63
- * Returns a list of Job dynamic properties i.e. those that are added by the
64
- * dynamic forms
65
- */
66
- get dynamicProperties(): Array<string>;
67
- /**
68
- * Returns the list of properties of the Job type
69
- */
70
- get staticProperties(): Array<string>;
71
- /**
72
- * @return {VasJobModel}
73
- */
74
- static empty(): VasJobModel;
75
- static fromDto(dto: Partial<VasJobDto>): VasJobModel;
76
- /**
77
- * This method will instantiate a new JobModel. The difference with this
78
- * method of instantiation is that we are coming from a relation frame i.e.
79
- * the job has a list of {@link VasFieldDto} instead of a Job document.
80
- *
81
- */
82
- static fromRelational(dto: Partial<VasJobDto>, form: VasFormDto): VasJobModel;
55
+ constructor(id: string, created: string, serverCreated: string, createdBy: string, modified: string, serverModified: string, modifiedBy: string, createdByName: string, modifiedByName: string, account: string, accessGroup: string, reference: string, jobDate: string, jobStatus: string, jobStatusLastUpdate: string, jobType: string, assigneeId: string, formId: string, timeZoneOffset: number, pendingFields: number, childModified: string, version: number, followUpDate: string, followUpStatus: string, followUpNote: string, geoLocation: GeoLocation, files: Array<VasFileDto>, fields: FType, jobEmails: Array<VasJobEmailDto>, notes: Array<VasNoteDto>, reports: Array<VasReportDto>, tasks: Array<VasTaskDto>, instruction: VasInstructionDto | null);
56
+ get createdByDisplayName(): string;
57
+ get modifiedByDisplayName(): string;
83
58
  /**
84
- * @param {VasFormModel} formModel
85
- * @return {Record<string, VasFieldDtoValue>}
59
+ * Return the list of Job properties
86
60
  */
87
- getFields(formModel: VasFormModel): Record<string, VasFieldDtoValue>;
88
- /**
89
- * Will return an object whose keys are the names of all fields in the job.
90
- * This method is similar to `getFields` except that this method will only
91
- * return values where a value was set, as opposed to `getFields` which will
92
- * return a value for every control even if no value was set, because it uses
93
- * the form to drive the logic. Note also this method will return values for
94
- * any Fields in the fields array.
95
- * @return {Record<string, VasFieldDtoValue>}
96
- */
97
- getFields2(): Record<string, VasFieldDtoValue>;
61
+ get staticProperties(): Set<string>;
98
62
  /**
99
63
  * Returns an object describing how many attachments were added to this job
100
64
  * (camera controls and files), and how many have not been uploaded yet.
@@ -107,97 +71,9 @@ export declare class VasJobModel extends VasRestrictedAccountObjectModel {
107
71
  total: number;
108
72
  };
109
73
  /**
110
- * This method will return the dynamic property from the JobModel that
111
- * represent a group (from a form).
112
- *
113
- * @param name the name of the group
114
- * @param init if true (default) and group is not found, initialise an empty
115
- * group, otherwise throw an error
116
- */
117
- getGroup(name: string, init?: boolean): Record<string, VasFieldDtoValue>;
118
- /**
119
- * @param path path segments
120
- */
121
- getValueByPath<T extends VasFieldDtoValue>(path?: string[]): T | undefined;
122
- /**
123
- * In order to understand why we need this method it is important to
124
- * understand that within the system, Jobs can be represented in one of two
125
- * ways, document and relational.
126
- *
127
- * The important distinction is how values submitted by a form are stored.
128
- *
129
- * Jobs stored as documents (JSON objects) will store user values, as dynamic
130
- * properties of the document.
131
- *
132
- * Whereas, Jobs stored as relational, will store user values in an array of
133
- * {@link VasFieldDto} objects.
134
- *
135
- * Depending on where we are in the system, either one of these approaches can
136
- * be more useful than the other.
137
- *
138
- * This method, assumes that the JobModel has been instantiated from a
139
- * document representation, and serves to hydrate the fields array. In order
140
- * to achieve this, knowledge of the {@link VasFormDto} that created the job
141
- * is required.
142
- *
143
- *
144
- * Job in document representation
145
- * {
146
- * id: <guid>,
147
- * reference: "something"
148
- * <other static job properties>...
149
- * foo: {
150
- * bar: "value"
151
- * }
152
- * }
153
- *
154
- * Job in relational representation
155
- * {
156
- * id: <guid>,
157
- * reference: "something"
158
- * <other static job properties>...
159
- * <will not have dynamic properties>...
160
- * fields: [
161
- * {
162
- * id: <guid>,
163
- * <other field properties>,
164
- * value: "value"
165
- * }
166
- * ]
167
- * }
168
- *
169
- *
170
- * @param formModel the VasFormModel that was used to create the job
171
- * @param controlFieldIdMap This is used to determine the id each field.
172
- * Either one will be found in the map, or a new one is generated.
173
- * @param controlNames if a value is provided, it will be used
174
- * to filter the fields that are returned.
175
- * @return {Array<VasFieldDto>}
176
- */
177
- hydrateFields(formModel: VasFormModel, controlFieldIdMap?: Map<string, string>, controlNames?: Array<string>): void;
178
- /**
179
- * A very non sophisticated way to set values in the job via paths
180
- *
181
- * For example:
182
- *
183
- * setValueByPath('value', ['foo', 'bar']);
184
- *
185
- * will make results in job
186
- * {
187
- * foo: {
188
- * bar: 'value'
189
- * }
190
- * }
191
- *
192
- * @param value the value to set
193
74
  * @param path path segments
194
75
  */
195
- setValueByPath(value: VasFieldDtoValue, path?: string[]): void;
196
- /**
197
- * @param staticOnly if true, will only output values for the static
198
- * properties in the dto
199
- */
200
- toDto(staticOnly?: boolean): VasJobDto;
76
+ getValueByPath<T>(path?: string | string[]): T | null | undefined;
201
77
  /**
202
78
  * This method will parse a syntax that allows us to build strings from the
203
79
  * values of from the job model. For example if the job model was:
@@ -229,5 +105,21 @@ export declare class VasJobModel extends VasRestrictedAccountObjectModel {
229
105
  * @return {object}
230
106
  */
231
107
  toApiDto(): Record<string, string | number | boolean>;
232
- static toApiPatchDto(item: Partial<VasJobDto>): Partial<VasJobDto>;
108
+ static toApiPatchDto(item: Partial<VasJobBaseDto>): Partial<VasJobBaseDto>;
109
+ }
110
+ export declare class VasJobRelationalModel extends VasJobBaseModel<Array<VasFieldModel>> {
111
+ getValueByPath<T>(path?: string | string[]): T | null | undefined;
112
+ getFieldsMap(): Record<string, FieldValueType>;
113
+ getFieldValueByPath<T extends FieldValueType>(controlName: string, path: string[]): T | null | undefined;
114
+ static fromDto(dto: Partial<VasJobRelationalDto>): VasJobRelationalModel;
115
+ static empty(): VasJobRelationalModel;
116
+ toDto(): VasJobRelationalDto;
117
+ }
118
+ export declare class VasJobDocumentModel extends VasJobBaseModel<Record<string, FieldValueType>> {
119
+ static fromRelationalDto(dto: Partial<VasJobRelationalDto>): VasJobDocumentModel;
120
+ static fromDto(dto: Partial<VasJobDocumentDto>): VasJobDocumentModel;
121
+ static empty(): VasJobDocumentModel;
122
+ toDto(): VasJobDocumentDto;
233
123
  }
124
+ /** @deprecated use either VasJobDocumentModel or VasJobRelationalModel **/
125
+ export type VasJobModel = VasJobDocumentModel | VasJobRelationalModel;
@@ -0,0 +1,13 @@
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
+ }
@@ -0,0 +1,10 @@
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
+ }
@@ -0,0 +1,15 @@
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
+ }
@@ -0,0 +1,23 @@
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
+ }
@@ -0,0 +1,36 @@
1
+ import { EstimateItemDto } from './estimate-item.dto';
2
+ import { EstimateSource, EstimateSundryMethod } from './estimate.model';
3
+ import { EstimateCostCategory } from './estimate.types';
4
+ export type CostCategorySummary = Record<EstimateCostCategory, string>;
5
+ export interface CostCategorySummaryTotals {
6
+ net: string;
7
+ vat: string;
8
+ gross: string;
9
+ hours: string;
10
+ labourRate: string;
11
+ }
12
+ export type EstimateSummaryDto = CostCategorySummary & CostCategorySummaryTotals;
13
+ export interface EstimateDto {
14
+ id: string;
15
+ source: EstimateSource;
16
+ label: string;
17
+ comment: string;
18
+ timestamp: string;
19
+ version: number;
20
+ net: string;
21
+ vat: string;
22
+ gross: string;
23
+ labourRate: string;
24
+ vatRate: string;
25
+ sundryRate: string;
26
+ sundryMax: string;
27
+ sundryFixed: string;
28
+ sundryMethod: EstimateSundryMethod;
29
+ partsDiscount: string;
30
+ paintDiscount: string;
31
+ timeBasis: string;
32
+ adjusted: boolean;
33
+ items: Array<EstimateItemDto>;
34
+ summary: EstimateSummaryDto;
35
+ summaryAdjusted: EstimateSummaryDto | null;
36
+ }
@@ -0,0 +1,54 @@
1
+ import { EstimateItemModel } from './estimate-item.model';
2
+ import { EstimateDto, EstimateSummaryDto } from './estimate.dto';
3
+ import { EstimateItemDto } from './estimate-item.dto';
4
+ export declare type EstimateSundryMethod = 'fixed' | 'percentage' | 'percentage-with-max';
5
+ export declare type EstimateSource = 'audatex' | 'glassmatix' | 'gtmotive' | 'ibody' | 'manual';
6
+ export declare class EstimateModel {
7
+ id: string;
8
+ source: EstimateSource;
9
+ label: string;
10
+ comment: string;
11
+ timestamp: string;
12
+ version: number;
13
+ net: string;
14
+ vat: string;
15
+ gross: string;
16
+ labourRate: string;
17
+ vatRate: string;
18
+ sundryRate: string;
19
+ sundryMax: string;
20
+ sundryFixed: string;
21
+ sundryMethod: EstimateSundryMethod;
22
+ partsDiscount: string;
23
+ paintDiscount: string;
24
+ timeBasis: string;
25
+ adjusted: boolean;
26
+ items: Array<EstimateItemModel>;
27
+ summaryNet: EstimateSummaryDto;
28
+ summary: EstimateSummaryDto;
29
+ summaryAdjusted: EstimateSummaryDto;
30
+ get timeBasisSafe(): string;
31
+ static create(source?: EstimateSource): EstimateModel;
32
+ static fromDto<T extends EstimateModel>(this: new () => T, dto: Partial<EstimateDto>): T;
33
+ addItem(modelOrDto: EstimateItemModel | Partial<EstimateItemDto>, opts?: {
34
+ calculate?: boolean;
35
+ }): void;
36
+ addItems(items: Array<EstimateItemModel>, opts?: {
37
+ calculate?: boolean;
38
+ }): void;
39
+ calculate(): void;
40
+ /**
41
+ * Returns the net summary (before sundries and discounts) of the estimate.
42
+ * By summary, we mean grouping the costs by cost category.
43
+ *
44
+ * @param adjusted if the values should be calculated using the original or
45
+ * adjusted values
46
+ */
47
+ getSummaryNet(adjusted?: boolean): EstimateSummaryDto;
48
+ /**
49
+ * Applies the sundry and discount values to the net summary.
50
+ */
51
+ getSummary(summaryNet: EstimateDto['summary'], sundryRate: string, sundryMax: string, sundryFixed: string, sundryMethod: EstimateSundryMethod, partsDiscount: string, paintDiscount: string, adjusted: boolean): EstimateDto['summary'];
52
+ toDto(): EstimateDto;
53
+ getTotalHours(adjusted?: boolean): string;
54
+ }
@@ -0,0 +1,2 @@
1
+ export declare type EstimateWorkCategory = 'none' | 'blend' | 'check' | 'new' | 'paint' | 'rr' | 'removed' | 'repair' | 'specialist';
2
+ export declare type EstimateCostCategory = 'labour' | 'none' | 'pm' | 'pl' | 'parts' | 'other' | 'specialist';
@@ -0,0 +1,7 @@
1
+ export * from './estimate.dto';
2
+ export * from './estimate.model';
3
+ export * from './estimate.types';
4
+ export * from './estimate-control-value.dto';
5
+ export * from './estimate-control-value.model';
6
+ export * from './estimate-item.dto';
7
+ export * from './estimate-item.model';
@@ -0,0 +1,5 @@
1
+ export interface FirebaseDocumentMetaInterface {
2
+ _meta: {
3
+ source: 'client' | 'server';
4
+ };
5
+ }
@@ -1,2 +1,5 @@
1
+ export * from './estimate-control';
2
+ export * from './firebase-document-meta.interface';
1
3
  export * from './geo-location';
4
+ export * from './report-invocation';
2
5
  export * from './vas-time-range.model';