hvp-shared 6.51.0 → 6.52.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/dist/constants/index.d.ts +2 -0
- package/dist/constants/index.js +2 -0
- package/dist/constants/time-off.constants.d.ts +24 -0
- package/dist/constants/time-off.constants.js +94 -0
- package/dist/constants/time-off.enums.d.ts +27 -0
- package/dist/constants/time-off.enums.js +47 -0
- package/dist/contracts/index.d.ts +1 -0
- package/dist/contracts/index.js +1 -0
- package/dist/contracts/time-off-request/index.d.ts +6 -0
- package/dist/contracts/time-off-request/index.js +22 -0
- package/dist/contracts/time-off-request/requests.d.ts +42 -0
- package/dist/contracts/time-off-request/requests.js +10 -0
- package/dist/contracts/time-off-request/responses.d.ts +99 -0
- package/dist/contracts/time-off-request/responses.js +10 -0
- package/package.json +1 -1
package/dist/constants/index.js
CHANGED
|
@@ -31,3 +31,5 @@ __exportStar(require("./special-collaborators.constants"), exports);
|
|
|
31
31
|
__exportStar(require("./commissions.constants"), exports);
|
|
32
32
|
__exportStar(require("./hr.enums"), exports);
|
|
33
33
|
__exportStar(require("./qvet-cash-flow.enums"), exports);
|
|
34
|
+
__exportStar(require("./time-off.enums"), exports);
|
|
35
|
+
__exportStar(require("./time-off.constants"), exports);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Time-Off Constants
|
|
3
|
+
*
|
|
4
|
+
* Mexican labor law vacation tables and related constants.
|
|
5
|
+
*/
|
|
6
|
+
import { TimeOffType } from './time-off.enums';
|
|
7
|
+
/**
|
|
8
|
+
* Legal vacation days per anniversary year (Mexican Federal Labor Law, Art. 76).
|
|
9
|
+
*
|
|
10
|
+
* - `old`: Pre-2023 reform (Ley Federal del Trabajo original)
|
|
11
|
+
* - `new`: Post-2022 reform (effective Jan 1, 2023 — doubled minimums)
|
|
12
|
+
*
|
|
13
|
+
* Index = years of service (0 = year of hire, 1 = first anniversary, etc.)
|
|
14
|
+
* Values for ranges (e.g., years 5-9) are repeated for each year in range.
|
|
15
|
+
*/
|
|
16
|
+
export declare const LEGAL_VACATIONS: {
|
|
17
|
+
readonly old: readonly [0, 6, 8, 10, 12, 14, 14, 14, 14, 14, 16, 16, 16, 16, 16, 18, 18, 18, 18, 18, 20, 20, 20, 20, 20, 22, 22, 22, 22, 22, 24];
|
|
18
|
+
readonly new: readonly [0, 12, 14, 16, 18, 20, 22, 22, 22, 22, 22, 24, 24, 24, 24, 26, 26, 26, 26, 26, 28, 28, 28, 28, 28, 30, 30, 30, 30, 30, 30];
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* TimeOffTypes that consume vacation balance.
|
|
22
|
+
* Only these types count against a collaborator's vacation days.
|
|
23
|
+
*/
|
|
24
|
+
export declare const VACATION_CONSUMING_TYPES: readonly TimeOffType[];
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Time-Off Constants
|
|
4
|
+
*
|
|
5
|
+
* Mexican labor law vacation tables and related constants.
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.VACATION_CONSUMING_TYPES = exports.LEGAL_VACATIONS = void 0;
|
|
9
|
+
const time_off_enums_1 = require("./time-off.enums");
|
|
10
|
+
/**
|
|
11
|
+
* Legal vacation days per anniversary year (Mexican Federal Labor Law, Art. 76).
|
|
12
|
+
*
|
|
13
|
+
* - `old`: Pre-2023 reform (Ley Federal del Trabajo original)
|
|
14
|
+
* - `new`: Post-2022 reform (effective Jan 1, 2023 — doubled minimums)
|
|
15
|
+
*
|
|
16
|
+
* Index = years of service (0 = year of hire, 1 = first anniversary, etc.)
|
|
17
|
+
* Values for ranges (e.g., years 5-9) are repeated for each year in range.
|
|
18
|
+
*/
|
|
19
|
+
exports.LEGAL_VACATIONS = {
|
|
20
|
+
old: [
|
|
21
|
+
0, // 0 years
|
|
22
|
+
6, // 1
|
|
23
|
+
8, // 2
|
|
24
|
+
10, // 3
|
|
25
|
+
12, // 4
|
|
26
|
+
14, // 5
|
|
27
|
+
14, // 6
|
|
28
|
+
14, // 7
|
|
29
|
+
14, // 8
|
|
30
|
+
14, // 9
|
|
31
|
+
16, // 10
|
|
32
|
+
16, // 11
|
|
33
|
+
16, // 12
|
|
34
|
+
16, // 13
|
|
35
|
+
16, // 14
|
|
36
|
+
18, // 15
|
|
37
|
+
18, // 16
|
|
38
|
+
18, // 17
|
|
39
|
+
18, // 18
|
|
40
|
+
18, // 19
|
|
41
|
+
20, // 20
|
|
42
|
+
20, // 21
|
|
43
|
+
20, // 22
|
|
44
|
+
20, // 23
|
|
45
|
+
20, // 24
|
|
46
|
+
22, // 25
|
|
47
|
+
22, // 26
|
|
48
|
+
22, // 27
|
|
49
|
+
22, // 28
|
|
50
|
+
22, // 29
|
|
51
|
+
24, // 30
|
|
52
|
+
],
|
|
53
|
+
new: [
|
|
54
|
+
0, // 0 years
|
|
55
|
+
12, // 1
|
|
56
|
+
14, // 2
|
|
57
|
+
16, // 3
|
|
58
|
+
18, // 4
|
|
59
|
+
20, // 5
|
|
60
|
+
22, // 6
|
|
61
|
+
22, // 7
|
|
62
|
+
22, // 8
|
|
63
|
+
22, // 9
|
|
64
|
+
22, // 10
|
|
65
|
+
24, // 11
|
|
66
|
+
24, // 12
|
|
67
|
+
24, // 13
|
|
68
|
+
24, // 14
|
|
69
|
+
26, // 15
|
|
70
|
+
26, // 16
|
|
71
|
+
26, // 17
|
|
72
|
+
26, // 18
|
|
73
|
+
26, // 19
|
|
74
|
+
28, // 20
|
|
75
|
+
28, // 21
|
|
76
|
+
28, // 22
|
|
77
|
+
28, // 23
|
|
78
|
+
28, // 24
|
|
79
|
+
30, // 25
|
|
80
|
+
30,
|
|
81
|
+
30,
|
|
82
|
+
30,
|
|
83
|
+
30,
|
|
84
|
+
30,
|
|
85
|
+
],
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* TimeOffTypes that consume vacation balance.
|
|
89
|
+
* Only these types count against a collaborator's vacation days.
|
|
90
|
+
*/
|
|
91
|
+
exports.VACATION_CONSUMING_TYPES = [
|
|
92
|
+
time_off_enums_1.TimeOffType.Vacation,
|
|
93
|
+
time_off_enums_1.TimeOffType.PersonalLeave,
|
|
94
|
+
];
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Time-Off Request Enums
|
|
3
|
+
*
|
|
4
|
+
* Single source of truth for time-off request statuses and types.
|
|
5
|
+
* Used by both backend and frontend.
|
|
6
|
+
*/
|
|
7
|
+
export declare enum TimeOffStatus {
|
|
8
|
+
Pending = "Pending",
|
|
9
|
+
Approved = "Approved",
|
|
10
|
+
Rejected = "Rejected",
|
|
11
|
+
Canceled = "Canceled"
|
|
12
|
+
}
|
|
13
|
+
export declare enum TimeOffType {
|
|
14
|
+
Vacation = "Vacation",
|
|
15
|
+
PersonalLeave = "Asuntos propios",
|
|
16
|
+
SickLeaveIMSS = "Incapacidad por IMSS",
|
|
17
|
+
ShiftToBeCompensated = "Jornada a reponer",
|
|
18
|
+
JustifiedAbsenceByCompany = "Inasistencia justificada por la empresa",
|
|
19
|
+
AuthorizedUnjustifiedAbsence = "Falta injustificada autorizada",
|
|
20
|
+
EarlyLeavePermission = "Permiso de salida anticipada",
|
|
21
|
+
LatePermission = "Permiso de llegar tarde",
|
|
22
|
+
CompensationShift = "Reposici\u00F3n de jornada"
|
|
23
|
+
}
|
|
24
|
+
/** Spanish display labels for TimeOffType */
|
|
25
|
+
export declare const TIME_OFF_TYPE_LABELS: Record<TimeOffType, string>;
|
|
26
|
+
/** Spanish display labels for TimeOffStatus */
|
|
27
|
+
export declare const TIME_OFF_STATUS_LABELS: Record<TimeOffStatus, string>;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Time-Off Request Enums
|
|
4
|
+
*
|
|
5
|
+
* Single source of truth for time-off request statuses and types.
|
|
6
|
+
* Used by both backend and frontend.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.TIME_OFF_STATUS_LABELS = exports.TIME_OFF_TYPE_LABELS = exports.TimeOffType = exports.TimeOffStatus = void 0;
|
|
10
|
+
var TimeOffStatus;
|
|
11
|
+
(function (TimeOffStatus) {
|
|
12
|
+
TimeOffStatus["Pending"] = "Pending";
|
|
13
|
+
TimeOffStatus["Approved"] = "Approved";
|
|
14
|
+
TimeOffStatus["Rejected"] = "Rejected";
|
|
15
|
+
TimeOffStatus["Canceled"] = "Canceled";
|
|
16
|
+
})(TimeOffStatus || (exports.TimeOffStatus = TimeOffStatus = {}));
|
|
17
|
+
var TimeOffType;
|
|
18
|
+
(function (TimeOffType) {
|
|
19
|
+
TimeOffType["Vacation"] = "Vacation";
|
|
20
|
+
TimeOffType["PersonalLeave"] = "Asuntos propios";
|
|
21
|
+
TimeOffType["SickLeaveIMSS"] = "Incapacidad por IMSS";
|
|
22
|
+
TimeOffType["ShiftToBeCompensated"] = "Jornada a reponer";
|
|
23
|
+
TimeOffType["JustifiedAbsenceByCompany"] = "Inasistencia justificada por la empresa";
|
|
24
|
+
TimeOffType["AuthorizedUnjustifiedAbsence"] = "Falta injustificada autorizada";
|
|
25
|
+
TimeOffType["EarlyLeavePermission"] = "Permiso de salida anticipada";
|
|
26
|
+
TimeOffType["LatePermission"] = "Permiso de llegar tarde";
|
|
27
|
+
TimeOffType["CompensationShift"] = "Reposici\u00F3n de jornada";
|
|
28
|
+
})(TimeOffType || (exports.TimeOffType = TimeOffType = {}));
|
|
29
|
+
/** Spanish display labels for TimeOffType */
|
|
30
|
+
exports.TIME_OFF_TYPE_LABELS = {
|
|
31
|
+
[TimeOffType.Vacation]: 'Vacaciones',
|
|
32
|
+
[TimeOffType.PersonalLeave]: 'Asuntos propios',
|
|
33
|
+
[TimeOffType.SickLeaveIMSS]: 'Incapacidad por IMSS',
|
|
34
|
+
[TimeOffType.ShiftToBeCompensated]: 'Jornada a reponer',
|
|
35
|
+
[TimeOffType.JustifiedAbsenceByCompany]: 'Inasistencia justificada por la empresa',
|
|
36
|
+
[TimeOffType.AuthorizedUnjustifiedAbsence]: 'Falta injustificada autorizada',
|
|
37
|
+
[TimeOffType.EarlyLeavePermission]: 'Permiso de salida anticipada',
|
|
38
|
+
[TimeOffType.LatePermission]: 'Permiso de llegar tarde',
|
|
39
|
+
[TimeOffType.CompensationShift]: 'Reposición de jornada',
|
|
40
|
+
};
|
|
41
|
+
/** Spanish display labels for TimeOffStatus */
|
|
42
|
+
exports.TIME_OFF_STATUS_LABELS = {
|
|
43
|
+
[TimeOffStatus.Pending]: 'Pendiente',
|
|
44
|
+
[TimeOffStatus.Approved]: 'Aprobada',
|
|
45
|
+
[TimeOffStatus.Rejected]: 'Rechazada',
|
|
46
|
+
[TimeOffStatus.Canceled]: 'Cancelada',
|
|
47
|
+
};
|
package/dist/contracts/index.js
CHANGED
|
@@ -24,3 +24,4 @@ __exportStar(require("./order-planning"), exports);
|
|
|
24
24
|
__exportStar(require("./qvet"), exports);
|
|
25
25
|
__exportStar(require("./stock-calculation"), exports);
|
|
26
26
|
__exportStar(require("./cash-reconciliation"), exports);
|
|
27
|
+
__exportStar(require("./time-off-request"), exports);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Time-Off Request API Contracts
|
|
4
|
+
* Request and Response types for Time-Off Request endpoints
|
|
5
|
+
*/
|
|
6
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
|
+
if (k2 === undefined) k2 = k;
|
|
8
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
10
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
11
|
+
}
|
|
12
|
+
Object.defineProperty(o, k2, desc);
|
|
13
|
+
}) : (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
o[k2] = m[k];
|
|
16
|
+
}));
|
|
17
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
18
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
19
|
+
};
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
__exportStar(require("./responses"), exports);
|
|
22
|
+
__exportStar(require("./requests"), exports);
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Time-Off Request Request Types
|
|
3
|
+
*
|
|
4
|
+
* API request contracts for time-off request endpoints.
|
|
5
|
+
*
|
|
6
|
+
* @example POST /api/time-off-requests
|
|
7
|
+
* @example PATCH /api/time-off-requests/:id
|
|
8
|
+
*/
|
|
9
|
+
import { TimeOffStatus, TimeOffType } from '../../constants/time-off.enums';
|
|
10
|
+
/**
|
|
11
|
+
* Create Time-Off Request
|
|
12
|
+
*
|
|
13
|
+
* Used for: Submitting a new time-off request.
|
|
14
|
+
*
|
|
15
|
+
* @example POST /api/time-off-requests
|
|
16
|
+
*/
|
|
17
|
+
export interface CreateTimeOffRequestRequest {
|
|
18
|
+
collaborator: string;
|
|
19
|
+
requestedDays: string[];
|
|
20
|
+
timeOffType: TimeOffType;
|
|
21
|
+
collaboratorNote?: string;
|
|
22
|
+
/** Optional: admin-created requests can set status directly */
|
|
23
|
+
status?: TimeOffStatus;
|
|
24
|
+
approvedAt?: string;
|
|
25
|
+
approvedBy?: string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Update Time-Off Request
|
|
29
|
+
*
|
|
30
|
+
* Used for: Modifying an existing time-off request (approval, notes, etc.)
|
|
31
|
+
*
|
|
32
|
+
* @example PATCH /api/time-off-requests/:id
|
|
33
|
+
*/
|
|
34
|
+
export interface UpdateTimeOffRequestRequest {
|
|
35
|
+
status?: TimeOffStatus;
|
|
36
|
+
managerNote?: string;
|
|
37
|
+
requestedDays?: string[];
|
|
38
|
+
timeOffType?: TimeOffType;
|
|
39
|
+
collaboratorNote?: string;
|
|
40
|
+
approvedAt?: string;
|
|
41
|
+
approvedBy?: string;
|
|
42
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Time-Off Request Request Types
|
|
4
|
+
*
|
|
5
|
+
* API request contracts for time-off request endpoints.
|
|
6
|
+
*
|
|
7
|
+
* @example POST /api/time-off-requests
|
|
8
|
+
* @example PATCH /api/time-off-requests/:id
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Time-Off Request Response Types
|
|
3
|
+
*
|
|
4
|
+
* API response contracts for time-off request endpoints.
|
|
5
|
+
*
|
|
6
|
+
* @example GET /api/time-off-requests
|
|
7
|
+
* @example GET /api/time-off-requests/collaborators/time-off-overview/:id
|
|
8
|
+
*/
|
|
9
|
+
import { TimeOffStatus, TimeOffType } from '../../constants/time-off.enums';
|
|
10
|
+
/**
|
|
11
|
+
* Annual vacation period breakdown.
|
|
12
|
+
*
|
|
13
|
+
* Each period represents one anniversary year, showing how many days
|
|
14
|
+
* were earned, taken, and the running accumulated balance.
|
|
15
|
+
*
|
|
16
|
+
* Used in: CollaboratorTimeOffOverviewResponse.vacationPeriods
|
|
17
|
+
*/
|
|
18
|
+
export interface VacationPeriodResponse {
|
|
19
|
+
/** Period start (anniversary date or hire date for first period) */
|
|
20
|
+
startDate: string;
|
|
21
|
+
/** Period end (next anniversary or current date for incomplete period) */
|
|
22
|
+
endDate: string;
|
|
23
|
+
/** Days earned by law at this anniversary (0 for current incomplete period) */
|
|
24
|
+
legalVacationDays: number;
|
|
25
|
+
/** Company-given extra days (2/year from 2025) */
|
|
26
|
+
extraVacationDays: number;
|
|
27
|
+
/** Pro-rated days for current incomplete period */
|
|
28
|
+
provisionalVacationDays: number;
|
|
29
|
+
/** legalVacationDays + extraVacationDays + provisionalVacationDays */
|
|
30
|
+
totalVacationDays: number;
|
|
31
|
+
/** Days taken (approved + pending) in this period */
|
|
32
|
+
vacationDaysTaken: number;
|
|
33
|
+
/** totalVacationDays - vacationDaysTaken */
|
|
34
|
+
periodBalance: number;
|
|
35
|
+
/** Running total balance across all periods up to this one */
|
|
36
|
+
accumulatedBalance: number;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Collaborator Time-Off Overview
|
|
40
|
+
*
|
|
41
|
+
* Complete vacation summary for a single collaborator, including
|
|
42
|
+
* annual period breakdown.
|
|
43
|
+
*
|
|
44
|
+
* Used for: User profile vacation info, admin vacation dashboard.
|
|
45
|
+
*
|
|
46
|
+
* @example GET /api/time-off-requests/collaborators/time-off-overview/:id
|
|
47
|
+
*/
|
|
48
|
+
export interface CollaboratorTimeOffOverviewResponse {
|
|
49
|
+
collaboratorId: string;
|
|
50
|
+
lastAnniversaryDate: string;
|
|
51
|
+
totalVacationDays: number;
|
|
52
|
+
legalVacationDays: number;
|
|
53
|
+
/** Count of approved vacation dates */
|
|
54
|
+
vacationDaysTaken: number;
|
|
55
|
+
/** Count of pending vacation dates */
|
|
56
|
+
vacationDaysRequested: number;
|
|
57
|
+
remainingVacationDays: number;
|
|
58
|
+
remainingLegalVacationDays: number;
|
|
59
|
+
remainingCurrentYearVacationDays: number;
|
|
60
|
+
/** Annual breakdown of vacation accrual and usage */
|
|
61
|
+
vacationPeriods: VacationPeriodResponse[];
|
|
62
|
+
dateTimeOffRequests: DateTimeOffRequestResponse[];
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Individual date within a time-off request.
|
|
66
|
+
*
|
|
67
|
+
* Flattened view: one entry per date per request.
|
|
68
|
+
*/
|
|
69
|
+
export interface DateTimeOffRequestResponse {
|
|
70
|
+
date: string;
|
|
71
|
+
id: string;
|
|
72
|
+
timeOffType: TimeOffType;
|
|
73
|
+
status: TimeOffStatus;
|
|
74
|
+
collaborator: string;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Time-Off Request Item
|
|
78
|
+
*
|
|
79
|
+
* Single time-off request as returned by list/detail endpoints.
|
|
80
|
+
*
|
|
81
|
+
* @example GET /api/time-off-requests
|
|
82
|
+
* @example GET /api/time-off-requests/:id
|
|
83
|
+
*/
|
|
84
|
+
export interface TimeOffRequestItemResponse {
|
|
85
|
+
id: string;
|
|
86
|
+
collaborator: string;
|
|
87
|
+
requestedAt: string;
|
|
88
|
+
requestedDays: string[];
|
|
89
|
+
timeOffType: TimeOffType;
|
|
90
|
+
status: TimeOffStatus;
|
|
91
|
+
collaboratorNote?: string;
|
|
92
|
+
managerNote?: string;
|
|
93
|
+
approvedAt?: string;
|
|
94
|
+
approvedBy?: string;
|
|
95
|
+
createdAt: string;
|
|
96
|
+
createdBy?: string;
|
|
97
|
+
updatedAt: string;
|
|
98
|
+
updatedBy?: string;
|
|
99
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Time-Off Request Response Types
|
|
4
|
+
*
|
|
5
|
+
* API response contracts for time-off request endpoints.
|
|
6
|
+
*
|
|
7
|
+
* @example GET /api/time-off-requests
|
|
8
|
+
* @example GET /api/time-off-requests/collaborators/time-off-overview/:id
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|