@seniorsistemas/hcm-clocking-event-rule-nodejs 0.35.0
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/.github/copilot-instructions.md +11 -0
- package/.github/workflows/release.yaml +10 -0
- package/.gitlab-ci.yml +68 -0
- package/CHANGELOG.md +274 -0
- package/README.doc.md +658 -0
- package/README.md +117 -0
- package/assets/favicon.ico +0 -0
- package/catalog-info.yaml +19 -0
- package/jest.config.js +17 -0
- package/package.json +48 -0
- package/prompt.md +15 -0
- package/run_build_win.bat +1 -0
- package/run_link.bat +3 -0
- package/run_test.bat +1 -0
- package/sonar-project.properties +21 -0
- package/src/data/changes/changes.ts +92 -0
- package/src/data/context/context.ts +251 -0
- package/src/data/context/contextReference.ts +376 -0
- package/src/data/contract/contract.ts +272 -0
- package/src/data/dataset/database.ts +130 -0
- package/src/data/dataset/dataset.ts +275 -0
- package/src/data/definition/timeEvaluationSituationDefinitionHistory.ts +1425 -0
- package/src/data/employee/employee.ts +434 -0
- package/src/data/foundation/companyBranch.ts +66 -0
- package/src/data/foundation/costCenter.ts +47 -0
- package/src/data/foundation/employer.ts +35 -0
- package/src/data/foundation/employmentRelationship.ts +63 -0
- package/src/data/foundation/holiday.ts +84 -0
- package/src/data/foundation/holidayGroup.ts +47 -0
- package/src/data/foundation/jobPosition.ts +73 -0
- package/src/data/foundation/person.ts +35 -0
- package/src/data/foundation/situation.ts +301 -0
- package/src/data/foundation/syndicate.ts +244 -0
- package/src/data/foundation/workschedule.ts +688 -0
- package/src/data/foundation/workshift.ts +647 -0
- package/src/data/foundation/workshiftBase.ts +113 -0
- package/src/data/histories/companyBranchHistory.ts +128 -0
- package/src/data/histories/costCenterHistory.ts +114 -0
- package/src/data/histories/employmentRelationshipHistory.ts +116 -0
- package/src/data/histories/histories.ts +419 -0
- package/src/data/histories/jobPositionHistory.ts +117 -0
- package/src/data/histories/leaveHistory.ts +227 -0
- package/src/data/histories/timeEvaluationHistory.ts +191 -0
- package/src/data/histories/workshiftHistory.ts +66 -0
- package/src/data/hourBank/hourBank.ts +43 -0
- package/src/data/hourBank/hourBankAccount.ts +77 -0
- package/src/data/log/log.ts +38 -0
- package/src/data/schedules/bridge.ts +84 -0
- package/src/data/schedules/compensation.ts +332 -0
- package/src/data/schedules/overtimeAuthorization.ts +174 -0
- package/src/data/schedules/readiness.ts +150 -0
- package/src/data/schedules/schedules.ts +398 -0
- package/src/data/schedules/workscheduleChange.ts +91 -0
- package/src/data/schedules/workshiftChange.ts +76 -0
- package/src/data/timeEvaluation/adjustmentReason.ts +46 -0
- package/src/data/timeEvaluation/clockingEvent.ts +198 -0
- package/src/data/timeEvaluation/estimatedHours.ts +245 -0
- package/src/data/timeEvaluation/interval.ts +568 -0
- package/src/data/timeEvaluation/separatedHours.ts +134 -0
- package/src/data/timeEvaluation/timeEvaluation.ts +1540 -0
- package/src/data/timeEvaluation/timeEvaluationSituation.ts +154 -0
- package/src/data/user/user.ts +44 -0
- package/src/index.ts +60 -0
- package/src/test/builder/bridgeBuilder.builder.ts +28 -0
- package/src/test/builder/clockingEvent.builder.ts +49 -0
- package/src/test/builder/companyBranchHistoryBuilder.ts +29 -0
- package/src/test/builder/compensation.builder.ts +84 -0
- package/src/test/builder/contextReference.builder.ts +69 -0
- package/src/test/builder/costCenterHistoryBuilder.ts +29 -0
- package/src/test/builder/database.builder.ts +21 -0
- package/src/test/builder/datasetBuilder.ts +111 -0
- package/src/test/builder/dateIntervalBuilder.ts +25 -0
- package/src/test/builder/employee.builder.ts +91 -0
- package/src/test/builder/employmentRelationshipBuilder.ts +35 -0
- package/src/test/builder/employmentRelationshipHistoryBuilder.ts +29 -0
- package/src/test/builder/historiesBuilder.ts +56 -0
- package/src/test/builder/holiday.builder.ts +44 -0
- package/src/test/builder/hourBankAccountBuilder.ts +77 -0
- package/src/test/builder/hourBankBuilder.ts +32 -0
- package/src/test/builder/interval.builder.ts +113 -0
- package/src/test/builder/jobPositionHistoryBuilder.ts +29 -0
- package/src/test/builder/overtimeAuthorization.builder.ts +42 -0
- package/src/test/builder/readinessBuilder.builder.ts +57 -0
- package/src/test/builder/schedules.builder.ts +126 -0
- package/src/test/builder/situation.builder.ts +59 -0
- package/src/test/builder/syndicate.builder.ts +96 -0
- package/src/test/builder/syndicateHistoryBuilder.ts +33 -0
- package/src/test/builder/timeEvaluation.builder.ts +138 -0
- package/src/test/builder/timeEvaluationHistory.builder.ts +49 -0
- package/src/test/builder/timeEvaluationSituation.builder.ts +34 -0
- package/src/test/builder/workschedule.builder.ts +96 -0
- package/src/test/builder/workshift.builder.ts +179 -0
- package/src/test/builder/workshiftBuilder.ts +55 -0
- package/src/test/data/clockingEvent.spec.ts +56 -0
- package/src/test/data/context.spec.ts +176 -0
- package/src/test/data/currentUser.spec.ts +11 -0
- package/src/test/data/dataset.spec.ts +144 -0
- package/src/test/data/employee/employee.spec.ts +20 -0
- package/src/test/data/employmentRelationship/employmentRelationship.spec.ts +48 -0
- package/src/test/data/estimatedHours/estimatedHours.spec.ts +96 -0
- package/src/test/data/histories/costCenterHistory.spec.ts +32 -0
- package/src/test/data/histories/histories.spec.ts +306 -0
- package/src/test/data/holyday.spec.ts +89 -0
- package/src/test/data/hourBank/hourBank.spec.ts +48 -0
- package/src/test/data/hourBank/hourBankAccount.spec.ts +32 -0
- package/src/test/data/schedules/bridge.spec.ts +13 -0
- package/src/test/data/schedules/compesation.spect.ts +89 -0
- package/src/test/data/schedules/overtimeAuthorization.spec.ts +52 -0
- package/src/test/data/schedules/readiness.spec.ts +64 -0
- package/src/test/data/schedules/schedules.spec.ts +134 -0
- package/src/test/data/schedules/workscheduleChange.spec.ts +21 -0
- package/src/test/data/syndicate/syndicate.spec.ts +51 -0
- package/src/test/data/timeEvaluation.spec.ts +1057 -0
- package/src/test/data/timeEvaluationDefinition.spec.ts +144 -0
- package/src/test/data/workschedule/workschedule.spec.ts +194 -0
- package/src/test/data/workshift/workshift.spec.ts +79 -0
- package/src/test/utils/date.utils.spec.ts +198 -0
- package/src/test/utils/dateIntervalUtils.spec.ts +210 -0
- package/src/test/utils/object.utils.spec.ts +83 -0
- package/src/utils/dateIntervalUtils.ts +284 -0
- package/src/utils/dateUtils.ts +456 -0
- package/src/utils/decompressGzipLambda.ts +15 -0
- package/src/utils/object.utils.ts +156 -0
- package/trivy/vulnerabilities_scan.json +1160 -0
- package/tsconfig.json +32 -0
- package/tsconfig.spec.json +21 -0
- package/tslint.json +92 -0
- package/typedoc.json +22 -0
|
@@ -0,0 +1,568 @@
|
|
|
1
|
+
import { ObjectUtils } from "../../utils/object.utils";
|
|
2
|
+
import { DateUtils } from "../../utils/dateUtils";
|
|
3
|
+
import { Situation } from "./../foundation/situation";
|
|
4
|
+
import { ContextReference } from "../context/contextReference";
|
|
5
|
+
import { AdjustmentReason } from "./adjustmentReason";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @hidden
|
|
9
|
+
*/
|
|
10
|
+
export interface IntervalParams {
|
|
11
|
+
clockingEventStart: Date;
|
|
12
|
+
clockingEventEnd: Date;
|
|
13
|
+
type: IntervalTypes;
|
|
14
|
+
subType: IntervalSubTypes;
|
|
15
|
+
typeIntervalTolerance: IntervalTypes;
|
|
16
|
+
subTypeIntervalTolerance: IntervalSubTypes;
|
|
17
|
+
situationId: string;
|
|
18
|
+
adjustmentReason: AdjustmentReason | undefined;
|
|
19
|
+
justifiedDays: number;
|
|
20
|
+
positionWorkingPart: PositionWorkHours;
|
|
21
|
+
isNightly: boolean;
|
|
22
|
+
isOvertimeAuthorized: boolean;
|
|
23
|
+
isTolerancePeriod: boolean;
|
|
24
|
+
inClockingEventTolerance: boolean;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Representa um intervalo do espelho de cálculo de apuração.
|
|
29
|
+
* O intervalo é o nucleo da apuração, nele está detalhado como cada hora do dia é considerada em cada intervalo de tempo.
|
|
30
|
+
* Cenário: Qual é o intervalo de falta do dia, qual é o intervalo de refeição do dia, qual é o intervalo de horas extras do dia, etc.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```typescript
|
|
34
|
+
* interval.clockingEventStart; // Retorna a data e hora inicial do intervalo.
|
|
35
|
+
* interval.clockingEventEnd; // Retorna a data e hora final do intervalo.
|
|
36
|
+
* interval.type; // Retorna o tipo do intervalo.
|
|
37
|
+
* interval.subType; // Retorna o subtipo do intervalo.
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export class Interval {
|
|
41
|
+
private readonly _clockingEventStart: Date;
|
|
42
|
+
private readonly _clockingEventEnd: Date;
|
|
43
|
+
private readonly _type: IntervalTypes;
|
|
44
|
+
private readonly _subType: IntervalSubTypes;
|
|
45
|
+
private readonly _typeIntervalTolerance: IntervalTypes;
|
|
46
|
+
private readonly _subTypeIntervalTolerance: IntervalSubTypes;
|
|
47
|
+
private readonly _situationId: string;
|
|
48
|
+
private readonly _adjustmentReason: AdjustmentReason | undefined;
|
|
49
|
+
private readonly _justifiedDays: number;
|
|
50
|
+
private readonly _positionWorkingPart: PositionWorkHours;
|
|
51
|
+
private readonly _isNightly: boolean;
|
|
52
|
+
private readonly _isOvertimeAuthorized: boolean;
|
|
53
|
+
private readonly _isTolerancePeriod: boolean;
|
|
54
|
+
private readonly _inClockingEventTolerance: boolean;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* @hidden
|
|
58
|
+
*/
|
|
59
|
+
constructor(params: IntervalParams) {
|
|
60
|
+
this._clockingEventStart = ObjectUtils.toDateOrThrow(params.clockingEventStart, "Interval.clockingEventStart");
|
|
61
|
+
this._clockingEventEnd = ObjectUtils.toDateOrThrow(params.clockingEventEnd, "Interval.clockingEventEnd");
|
|
62
|
+
this._type = params.type;
|
|
63
|
+
this._subType = params.subType;
|
|
64
|
+
this._typeIntervalTolerance = params.typeIntervalTolerance;
|
|
65
|
+
this._subTypeIntervalTolerance = params.subTypeIntervalTolerance;
|
|
66
|
+
this._situationId = params.situationId;
|
|
67
|
+
this._adjustmentReason = params.adjustmentReason;
|
|
68
|
+
this._justifiedDays = params.justifiedDays;
|
|
69
|
+
this._positionWorkingPart = params.positionWorkingPart;
|
|
70
|
+
this._isNightly = params.isNightly;
|
|
71
|
+
this._isOvertimeAuthorized = params.isOvertimeAuthorized;
|
|
72
|
+
this._isTolerancePeriod = params.isTolerancePeriod;
|
|
73
|
+
this._inClockingEventTolerance = params.inClockingEventTolerance;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Retorna a data e hora inicial do intervalo.
|
|
78
|
+
* @example
|
|
79
|
+
* ```typescript
|
|
80
|
+
* let start = interval.clockingEventStart; // Retorna a data e hora inicial do intervalo.
|
|
81
|
+
* ```
|
|
82
|
+
* @return A data e hora inicial do intervalo.
|
|
83
|
+
*/
|
|
84
|
+
get clockingEventStart(): Date {
|
|
85
|
+
return this._clockingEventStart;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Retorna a data e hora final do intervalo.
|
|
90
|
+
* @example
|
|
91
|
+
* ```typescript
|
|
92
|
+
* let end = interval.clockingEventEnd; // Retorna a data e hora final do intervalo.
|
|
93
|
+
* ```
|
|
94
|
+
* @return A data e hora final do intervalo.
|
|
95
|
+
*
|
|
96
|
+
*/
|
|
97
|
+
get clockingEventEnd(): Date {
|
|
98
|
+
return this._clockingEventEnd;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Retorna o tipo do intervalo.
|
|
103
|
+
* @example
|
|
104
|
+
* ```typescript
|
|
105
|
+
* let type = interval.type; // Retorna o tipo do intervalo.
|
|
106
|
+
* ```
|
|
107
|
+
* @return O tipo do intervalo.
|
|
108
|
+
*/
|
|
109
|
+
get type(): IntervalTypes {
|
|
110
|
+
return this._type;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Retorna o subtipo do intervalo, exemplo: type OVERTIME (extra) e subType BEFORE_WORKING (antes do expediente).
|
|
115
|
+
*
|
|
116
|
+
* @example
|
|
117
|
+
* ```typescript
|
|
118
|
+
* let subType = interval.subType; // Retorna o subtipo do intervalo.
|
|
119
|
+
* ```
|
|
120
|
+
* @return O subtipo do intervalo.
|
|
121
|
+
* @see {@link IntervalSubTypes}
|
|
122
|
+
*/
|
|
123
|
+
get subType(): IntervalSubTypes {
|
|
124
|
+
return this._subType;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Retorna o tipo do intervalo de tolerância.
|
|
129
|
+
*
|
|
130
|
+
* @example
|
|
131
|
+
* ```typescript
|
|
132
|
+
* let typeIntervalTolerance = interval.typeIntervalTolerance; // Retorna o tipo do intervalo de tolerância.
|
|
133
|
+
* ```
|
|
134
|
+
* @return O tipo do intervalo de tolerância.
|
|
135
|
+
* @see {@link IntervalTypes}
|
|
136
|
+
*
|
|
137
|
+
*/
|
|
138
|
+
get typeIntervalTolerance(): IntervalTypes {
|
|
139
|
+
return this._typeIntervalTolerance;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Retorna o subtipo do intervalo de tolerância.
|
|
144
|
+
* @example
|
|
145
|
+
* ```typescript
|
|
146
|
+
* let subTypeIntervalTolerance = interval.subTypeIntervalTolerance; // Retorna o subtipo do intervalo de tolerância.
|
|
147
|
+
* ```
|
|
148
|
+
* @return O subtipo do intervalo de tolerância.
|
|
149
|
+
* @see {@link IntervalSubTypes}
|
|
150
|
+
*/
|
|
151
|
+
get subTypeIntervalTolerance(): IntervalSubTypes {
|
|
152
|
+
return this._subTypeIntervalTolerance;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* @hidden
|
|
157
|
+
* Identificador da situação caso o tipo do intervalo for JUSTIFIED_ENTRY, JUSTIFIED_EXIT ou SCHEDULED.
|
|
158
|
+
* @returns Identificador da situação do intervalo.
|
|
159
|
+
*/
|
|
160
|
+
private get situationId(): string {
|
|
161
|
+
return this._situationId;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Situação do intervalo caso o tipo do intervalo for JUSTIFIED_ENTRY, JUSTIFIED_EXIT ou SCHEDULED.
|
|
166
|
+
*
|
|
167
|
+
* @example
|
|
168
|
+
* ```typescript
|
|
169
|
+
* let situation = interval.situation; // Retorna a situação do intervalo.
|
|
170
|
+
* sitation.code; // Retorna o código da situação.
|
|
171
|
+
* ```
|
|
172
|
+
* @returns Situação do afastamento.
|
|
173
|
+
*/
|
|
174
|
+
get situation(): Situation | undefined {
|
|
175
|
+
const situation = ContextReference.getGlobalInstance().getSituationById(this._situationId);
|
|
176
|
+
if (!situation && !!situation) {
|
|
177
|
+
throw new Error(`Situation with ID ${this._situationId} not found in context.`);
|
|
178
|
+
}
|
|
179
|
+
return situation;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Retorna o código do motivo de acerto do intervalo.
|
|
184
|
+
*
|
|
185
|
+
* @example
|
|
186
|
+
* ```typescript
|
|
187
|
+
* let adjustmentReason = interval.adjustmentReason; // Retorna o motivo de acerto do intervalo.
|
|
188
|
+
* adjustmentReason.code; // Retorna o código do motivo de acerto.
|
|
189
|
+
* ```
|
|
190
|
+
* @returns Motivo de acerto do intervalo.
|
|
191
|
+
* @see {@link AdjustmentReason}
|
|
192
|
+
*/
|
|
193
|
+
get adjustmentReason(): AdjustmentReason | undefined {
|
|
194
|
+
return this._adjustmentReason;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Retorna os dias justificados.
|
|
199
|
+
*
|
|
200
|
+
* @example
|
|
201
|
+
* ```typescript
|
|
202
|
+
* let justifiedDays = interval.justifiedDays; // Retorna a quantidade de dias justificados.
|
|
203
|
+
* ```
|
|
204
|
+
* @return A quantidade de dias justificados.
|
|
205
|
+
*/
|
|
206
|
+
get justifiedDays(): number {
|
|
207
|
+
return this._justifiedDays;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Retorna a posição das horas trabalhadas no intervalo.
|
|
212
|
+
*
|
|
213
|
+
* @example
|
|
214
|
+
* ```typescript
|
|
215
|
+
* let positionWorkingPart = interval.positionWorkingPart; // Retorna a posição das horas trabalhadas no intervalo.
|
|
216
|
+
* ```
|
|
217
|
+
* @return A posição das horas trabalhadas no intervalo.
|
|
218
|
+
* @see {@link PositionWorkHours}
|
|
219
|
+
*/
|
|
220
|
+
get positionWorkingPart(): PositionWorkHours {
|
|
221
|
+
return this._positionWorkingPart;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Retorna se o intervalo é noturno.
|
|
226
|
+
*
|
|
227
|
+
* @example
|
|
228
|
+
* ```typescript
|
|
229
|
+
* let isNightly = interval.isNightly; // Retorna se o intervalo é noturno.
|
|
230
|
+
* ```
|
|
231
|
+
* @return Verdadeiro se o intervalo é noturno, falso caso contrário.
|
|
232
|
+
*
|
|
233
|
+
*/
|
|
234
|
+
get isNightly(): boolean {
|
|
235
|
+
return this._isNightly;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Retorna se o intervalo tem horas extras autorizadas.
|
|
240
|
+
*
|
|
241
|
+
* @example
|
|
242
|
+
* ```typescript
|
|
243
|
+
* let isOvertimeAuthorized = interval.isOvertimeAuthorized; // Retorna se o intervalo tem horas extras autorizadas.
|
|
244
|
+
* ```
|
|
245
|
+
* @return Verdadeiro se o intervalo tem horas extras autorizadas, falso caso contrário.
|
|
246
|
+
*
|
|
247
|
+
*/
|
|
248
|
+
get isOvertimeAuthorized(): boolean {
|
|
249
|
+
return this._isOvertimeAuthorized;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* Retorna se o intervalo está dentro da tolerância de alguma marcação do horário e se é afetado por ela.
|
|
254
|
+
*
|
|
255
|
+
* @example
|
|
256
|
+
* ```typescript
|
|
257
|
+
* let isTolerancePeriod = interval.isTolerancePeriod; // Retorna se o intervalo está dentro da tolerância de evento de marcação.
|
|
258
|
+
* ```
|
|
259
|
+
* @return Verdadeiro se o intervalo está dentro da tolerância de evento de marcação, falso caso contrário.
|
|
260
|
+
*
|
|
261
|
+
*/
|
|
262
|
+
get isTolerancePeriod(): boolean {
|
|
263
|
+
return this._isTolerancePeriod;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* Retorna se o intervalo está dentro da tolerância de evento de marcação.
|
|
268
|
+
*
|
|
269
|
+
* @example
|
|
270
|
+
* ```typescript
|
|
271
|
+
* let inClockingEventTolerance = interval.inClockingEventTolerance; // Retorna se o intervalo está dentro da tolerância de evento de marcação.
|
|
272
|
+
* ```
|
|
273
|
+
* @return Verdadeiro se o intervalo está dentro da tolerância de evento de marcação, falso caso contrário.
|
|
274
|
+
*
|
|
275
|
+
*/
|
|
276
|
+
get inClockingEventTolerance(): boolean {
|
|
277
|
+
return this._inClockingEventTolerance;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* Retorna a quantidade de minutos do intervalo.
|
|
282
|
+
* @example
|
|
283
|
+
* ```typescript
|
|
284
|
+
* let intervalInMinutes = interval.getIntervalInMinutes(); // Retorna a quantidade de minutos do intervalo.
|
|
285
|
+
* ```
|
|
286
|
+
* @return A quantidade de minutos do intervalo.
|
|
287
|
+
*/
|
|
288
|
+
public getIntervalInMinutes(): number {
|
|
289
|
+
return DateUtils.getDateInMinutes(this._clockingEventEnd, this._clockingEventStart);
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
public static clone(interval: Interval): Interval {
|
|
293
|
+
return new Interval({
|
|
294
|
+
clockingEventStart: interval.clockingEventStart,
|
|
295
|
+
clockingEventEnd: interval.clockingEventEnd,
|
|
296
|
+
type: interval.type,
|
|
297
|
+
subType: interval.subType,
|
|
298
|
+
typeIntervalTolerance: interval.typeIntervalTolerance,
|
|
299
|
+
subTypeIntervalTolerance: interval.subTypeIntervalTolerance,
|
|
300
|
+
situationId: interval.situationId,
|
|
301
|
+
adjustmentReason: interval.adjustmentReason,
|
|
302
|
+
justifiedDays: interval.justifiedDays,
|
|
303
|
+
positionWorkingPart: interval.positionWorkingPart,
|
|
304
|
+
isNightly: interval.isNightly,
|
|
305
|
+
isOvertimeAuthorized: interval.isOvertimeAuthorized,
|
|
306
|
+
isTolerancePeriod: interval.isTolerancePeriod,
|
|
307
|
+
inClockingEventTolerance: interval.inClockingEventTolerance
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* Enumeração para os tipos de intervalo.
|
|
314
|
+
* @enum
|
|
315
|
+
*/
|
|
316
|
+
export enum IntervalTypes {
|
|
317
|
+
/**
|
|
318
|
+
* Trabalho.
|
|
319
|
+
*/
|
|
320
|
+
WORKING = "WORKING",
|
|
321
|
+
/**
|
|
322
|
+
* Extras.
|
|
323
|
+
*/
|
|
324
|
+
OVERTIME = "OVERTIME",
|
|
325
|
+
/**
|
|
326
|
+
* Faltas.
|
|
327
|
+
*/
|
|
328
|
+
ABSENCE = "ABSENCE",
|
|
329
|
+
/**
|
|
330
|
+
* Refeição.
|
|
331
|
+
*/
|
|
332
|
+
MEAL = "MEAL",
|
|
333
|
+
/**
|
|
334
|
+
* Lanche.
|
|
335
|
+
*/
|
|
336
|
+
SNACK = "SNACK",
|
|
337
|
+
/**
|
|
338
|
+
* Entrada justificada.
|
|
339
|
+
*/
|
|
340
|
+
JUSTIFIED_ENTRY = "JUSTIFIED_ENTRY",
|
|
341
|
+
/**
|
|
342
|
+
* Saída justificada.
|
|
343
|
+
*/
|
|
344
|
+
JUSTIFIED_EXIT = "JUSTIFIED_EXIT",
|
|
345
|
+
/**
|
|
346
|
+
* Entrada indicada.
|
|
347
|
+
*/
|
|
348
|
+
INDICATED_ENTRY = "INDICATED_ENTRY",
|
|
349
|
+
/**
|
|
350
|
+
* Saída indicada.
|
|
351
|
+
*/
|
|
352
|
+
INDICATED_EXIT = "INDICATED_EXIT",
|
|
353
|
+
/**
|
|
354
|
+
* Programado.
|
|
355
|
+
*/
|
|
356
|
+
SCHEDULED = "SCHEDULED",
|
|
357
|
+
/**
|
|
358
|
+
* Simulado.
|
|
359
|
+
*/
|
|
360
|
+
SIMULATED = "SIMULATED",
|
|
361
|
+
/**
|
|
362
|
+
* Descanso mulher.
|
|
363
|
+
*/
|
|
364
|
+
WOMENS_REST = "WOMENS_REST",
|
|
365
|
+
/**
|
|
366
|
+
* Compensado.
|
|
367
|
+
*/
|
|
368
|
+
COMPENSATED = "COMPENSATED",
|
|
369
|
+
/**
|
|
370
|
+
* Espera.
|
|
371
|
+
*/
|
|
372
|
+
WAITING = "WAITING",
|
|
373
|
+
/**
|
|
374
|
+
* Parada obrigatória.
|
|
375
|
+
*/
|
|
376
|
+
MANDATORY_STOP = "MANDATORY_STOP",
|
|
377
|
+
/**
|
|
378
|
+
* Parada obrigatória com refeição.
|
|
379
|
+
*/
|
|
380
|
+
MEAL_WITH_MANDATORY_STOP = "MEAL_WITH_MANDATORY_STOP",
|
|
381
|
+
/**
|
|
382
|
+
* Direção.
|
|
383
|
+
*/
|
|
384
|
+
DIRECTION = "DIRECTION",
|
|
385
|
+
/**
|
|
386
|
+
* Tolerância.
|
|
387
|
+
*/
|
|
388
|
+
TOLERANCE = "TOLERANCE",
|
|
389
|
+
/**
|
|
390
|
+
* Refeição programada/prevista.
|
|
391
|
+
*/
|
|
392
|
+
SCHEDULED_MEAL = "SCHEDULED_MEAL"
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
/**
|
|
396
|
+
* Enumeração para os subtipos de intervalo.
|
|
397
|
+
* @enum
|
|
398
|
+
*/
|
|
399
|
+
export enum IntervalSubTypes {
|
|
400
|
+
/**
|
|
401
|
+
* Antes do expediente.
|
|
402
|
+
*/
|
|
403
|
+
BEFORE_WORKING = "BEFORE_WORKING",
|
|
404
|
+
|
|
405
|
+
/**
|
|
406
|
+
* Após o expediente.
|
|
407
|
+
*/
|
|
408
|
+
AFTER_WORKING = "AFTER_WORKING",
|
|
409
|
+
|
|
410
|
+
/**
|
|
411
|
+
* Entrada do expediente.
|
|
412
|
+
*/
|
|
413
|
+
ENTER = "ENTER",
|
|
414
|
+
|
|
415
|
+
/**
|
|
416
|
+
* Saída do expediente.
|
|
417
|
+
*/
|
|
418
|
+
CHECKOUT = "CHECKOUT",
|
|
419
|
+
|
|
420
|
+
/**
|
|
421
|
+
* Intervalo para lanche.
|
|
422
|
+
*/
|
|
423
|
+
SNACK = "SNACK",
|
|
424
|
+
|
|
425
|
+
/**
|
|
426
|
+
* Intervalo para refeição.
|
|
427
|
+
*/
|
|
428
|
+
MEAL = "MEAL",
|
|
429
|
+
|
|
430
|
+
/**
|
|
431
|
+
* Dia de folga.
|
|
432
|
+
*/
|
|
433
|
+
DAY_OFF = "DAY_OFF",
|
|
434
|
+
|
|
435
|
+
/**
|
|
436
|
+
* Feriado.
|
|
437
|
+
*/
|
|
438
|
+
HOLIDAY = "HOLIDAY",
|
|
439
|
+
|
|
440
|
+
/**
|
|
441
|
+
* Dia compensado.
|
|
442
|
+
*/
|
|
443
|
+
COMPENSATED = "COMPENSATED",
|
|
444
|
+
|
|
445
|
+
/**
|
|
446
|
+
* Dia para descanso.
|
|
447
|
+
*/
|
|
448
|
+
REST = "REST",
|
|
449
|
+
|
|
450
|
+
/**
|
|
451
|
+
* Atraso.
|
|
452
|
+
*/
|
|
453
|
+
DELAY = "DELAY",
|
|
454
|
+
|
|
455
|
+
/**
|
|
456
|
+
* Saída intermediária.
|
|
457
|
+
*/
|
|
458
|
+
INTERMEDIATE_EXIT = "INTERMEDIATE_EXIT",
|
|
459
|
+
|
|
460
|
+
/**
|
|
461
|
+
* Saída antecipada.
|
|
462
|
+
*/
|
|
463
|
+
EARLY_EXIT = "EARLY_EXIT",
|
|
464
|
+
|
|
465
|
+
/**
|
|
466
|
+
* Jornada integral.
|
|
467
|
+
*/
|
|
468
|
+
FULL_PART = "FULL_PART",
|
|
469
|
+
|
|
470
|
+
/**
|
|
471
|
+
* Afastamento.
|
|
472
|
+
*/
|
|
473
|
+
LEAVE = "LEAVE",
|
|
474
|
+
|
|
475
|
+
/**
|
|
476
|
+
* Autorização para saída.
|
|
477
|
+
*/
|
|
478
|
+
EXIT_AUTHORIZATION = "EXIT_AUTHORIZATION",
|
|
479
|
+
|
|
480
|
+
/**
|
|
481
|
+
* Compensação de ausência.
|
|
482
|
+
*/
|
|
483
|
+
ABSENSION_COMPENSATION = "ABSENSION_COMPENSATION",
|
|
484
|
+
|
|
485
|
+
/**
|
|
486
|
+
* Compensação extra.
|
|
487
|
+
*/
|
|
488
|
+
EXTRA_COMPENSATION = "EXTRA_COMPENSATION",
|
|
489
|
+
|
|
490
|
+
/**
|
|
491
|
+
* Sobreaviso/Prontidão.
|
|
492
|
+
*/
|
|
493
|
+
PRECAUTION = "PRECAUTION",
|
|
494
|
+
|
|
495
|
+
/**
|
|
496
|
+
* Parada.
|
|
497
|
+
*/
|
|
498
|
+
STOP = "STOP",
|
|
499
|
+
|
|
500
|
+
/**
|
|
501
|
+
* Dia facultativo.
|
|
502
|
+
*/
|
|
503
|
+
OPTIONAL_DAY = "OPTIONAL_DAY"
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
/**
|
|
507
|
+
* @hidden
|
|
508
|
+
*/
|
|
509
|
+
export interface PositionWorkHoursParams {
|
|
510
|
+
workingHours: number;
|
|
511
|
+
part: number;
|
|
512
|
+
}
|
|
513
|
+
/**
|
|
514
|
+
* Representa as horas trabalhadas em uma parte do expediente.
|
|
515
|
+
* A divisão do expediente em partes acontece na hora final dos intervalos do tipo meal (refeição).
|
|
516
|
+
*
|
|
517
|
+
* ```
|
|
518
|
+
* Representação das partes do expediente
|
|
519
|
+
*
|
|
520
|
+
* |----------------------------------------expedient-----------------------------------------|
|
|
521
|
+
* |----------------------part(1)----------------------|---------------part(2)----------------|
|
|
522
|
+
* 08:00 10:00 10:15 12:00 13:30 16:30 16:45 18:00
|
|
523
|
+
* |------------|------------|------------|------------|------------|------------|------------|
|
|
524
|
+
* | work(1) | snack(1) | work(2) | meal(1) | work(3) | snack(2) | work(4) |
|
|
525
|
+
* ```
|
|
526
|
+
*
|
|
527
|
+
* @example
|
|
528
|
+
* ```typescript
|
|
529
|
+
* positionWorkHours.workingHours; // Retorna as horas trabalhadas na parte.
|
|
530
|
+
* positionWorkHours.part; // Retorna a parte do expediente.
|
|
531
|
+
* ```
|
|
532
|
+
*
|
|
533
|
+
*/
|
|
534
|
+
export class PositionWorkHours {
|
|
535
|
+
private readonly _workingHours: number;
|
|
536
|
+
private readonly _part: number;
|
|
537
|
+
|
|
538
|
+
constructor(params: PositionWorkHoursParams) {
|
|
539
|
+
this._workingHours = params.workingHours;
|
|
540
|
+
this._part = params.part;
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
/**
|
|
544
|
+
* Retorna as horas trabalhadas na parte do expediente.
|
|
545
|
+
*
|
|
546
|
+
* @example
|
|
547
|
+
* ```typescript
|
|
548
|
+
* let workingHours = positionWorkHours.workingHours; // Retorna as horas trabalhadas na parte do expediente.
|
|
549
|
+
* ```
|
|
550
|
+
* @return As horas trabalhadas na parte do expediente.
|
|
551
|
+
*/
|
|
552
|
+
get workingHours(): number {
|
|
553
|
+
return this._workingHours;
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
/**
|
|
557
|
+
* Retorna a parte do expediente.
|
|
558
|
+
*
|
|
559
|
+
* @example
|
|
560
|
+
* ```typescript
|
|
561
|
+
* let part = positionWorkHours.part; // Retorna a parte do expediente.
|
|
562
|
+
* ```
|
|
563
|
+
* @return A parte do expediente.
|
|
564
|
+
*/
|
|
565
|
+
get part(): number {
|
|
566
|
+
return this._part;
|
|
567
|
+
}
|
|
568
|
+
}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @hidden
|
|
3
|
+
*/
|
|
4
|
+
export interface SeparatedHoursParams {
|
|
5
|
+
dailyHours: number;
|
|
6
|
+
nightlyHours: number;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Representa um conjunto de horas separadas em diurnas e noturnas.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* separatedHours.dailyHours; // Retorna a quantidade de horas diurnas.
|
|
15
|
+
* separatedHours.nightlyHours; // Retorna a quantidade de horas noturnas.
|
|
16
|
+
* separatedHours.total; // Retorna a quantidade total de horas.
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export class SeparatedHours {
|
|
20
|
+
private _dailyHours: number;
|
|
21
|
+
private _nightlyHours: number;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @hidden
|
|
25
|
+
*/
|
|
26
|
+
constructor(params: SeparatedHoursParams) {
|
|
27
|
+
this._dailyHours = params.dailyHours;
|
|
28
|
+
this._nightlyHours = params.nightlyHours;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Retorna a quantidade de horas diurnas.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```typescript
|
|
36
|
+
* let separatedHours = new SeparatedHours({ dailyHours: 5, nightlyHours: 3 });
|
|
37
|
+
* console.log(separatedHours.getDailyHours()); // Saída: 5
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* @returns {number} Horas diurnas.
|
|
41
|
+
*/
|
|
42
|
+
get dailyHours(): number {
|
|
43
|
+
return this._dailyHours;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Retorna a quantidade de horas noturnas.
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```typescript
|
|
51
|
+
* let separatedHours = new SeparatedHours({ dailyHours: 5, nightlyHours: 3 });
|
|
52
|
+
* console.log(separatedHours.getNightlyHours()); // Saída: 3
|
|
53
|
+
* ```
|
|
54
|
+
*
|
|
55
|
+
* @returns {number} Horas noturnas.
|
|
56
|
+
*/
|
|
57
|
+
get nightlyHours(): number {
|
|
58
|
+
return this._nightlyHours;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Retorna a quantidade total de horas somando as horas diurnas e noturnas.
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* ```typescript
|
|
66
|
+
* let separatedHours = new SeparatedHours({ dailyHours: 5, nightlyHours: 3 });
|
|
67
|
+
* console.log(separatedHours.total); // Saída: 8
|
|
68
|
+
* ```
|
|
69
|
+
*
|
|
70
|
+
* @returns {number} Total de horas.
|
|
71
|
+
*/
|
|
72
|
+
get total(): number {
|
|
73
|
+
return this.dailyHours + this.nightlyHours;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Retorna a quantidade total de horas separadas.
|
|
78
|
+
* @returns {string} - Daytime: ${this.dailyHours}, Nighttime: ${this.nightlyHours}.
|
|
79
|
+
*/
|
|
80
|
+
public toString(): string {
|
|
81
|
+
return `Daytime: ${this.dailyHours}, Nighttime: ${this.nightlyHours}`;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Soma a quantidade de horas noturnas.
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* ```typescript
|
|
89
|
+
* let separatedHours = new SeparatedHours({ dailyHours: 5, nightlyHours: 3 });
|
|
90
|
+
* separatedHours.sumNightlyHours(2);
|
|
91
|
+
* console.log(separatedHours.toString()); // Saída: Daytime: 5, Nighttime: 5
|
|
92
|
+
* ```
|
|
93
|
+
*
|
|
94
|
+
* @param {number} nightlyHours Horas noturnas a serem adicionadas.
|
|
95
|
+
*/
|
|
96
|
+
public sumNightlyHours(nightlyHours: number): void {
|
|
97
|
+
this._nightlyHours += nightlyHours;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Soma a quantidade de horas diurnas.
|
|
102
|
+
*
|
|
103
|
+
* @example
|
|
104
|
+
* ```typescript
|
|
105
|
+
* let separatedHours = new SeparatedHours({ dailyHours: 5, nightlyHours: 3 });
|
|
106
|
+
* separatedHours.sumDailyHours(2);
|
|
107
|
+
* console.log(separatedHours.toString()); // Saída: Daytime: 7, Nighttime: 3
|
|
108
|
+
* ```
|
|
109
|
+
*
|
|
110
|
+
* @param {number} dailyHours Horas diurnas a serem adicionadas.
|
|
111
|
+
*/
|
|
112
|
+
public sumDailyHours(dailyHours: number): void {
|
|
113
|
+
this._dailyHours += dailyHours;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Soma duas separação de horas, adicionando as horas diurnas e noturnas, separadamente.
|
|
118
|
+
*
|
|
119
|
+
* @example
|
|
120
|
+
* ```typescript
|
|
121
|
+
* let separatedHours1 = new SeparatedHours({ dailyHours: 5, nightlyHours: 3 });
|
|
122
|
+
* let separatedHours2 = new SeparatedHours({ dailyHours: 2, nightlyHours: 4 });
|
|
123
|
+
* separatedHours1.sumSeparatedHours(separatedHours2);
|
|
124
|
+
* console.log(separatedHours1.toString()); // Saída: Daytime: 7, Nighttime: 7
|
|
125
|
+
* ```
|
|
126
|
+
*
|
|
127
|
+
* @param {SeparatedHours} separatedHours Horas separadas a serem adicionadas.
|
|
128
|
+
*/
|
|
129
|
+
public sumSeparatedHours(separatedHours: SeparatedHours): void {
|
|
130
|
+
this.sumDailyHours(separatedHours.dailyHours);
|
|
131
|
+
this.sumNightlyHours(separatedHours.nightlyHours);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|