Skip to content

Commit 724b2cc

Browse files
committed
Enhance Buddee component with new props, actions, and sources for employee and leave management
- Added new props for leaveTypeId, jobId, locationId, departmentId, timeRegistrationTypeId, and projectId in buddee.app.mjs. - Implemented actions for creating leave requests and listing employees, leave requests, and time registrations. - Introduced new sources for tracking new employee creations and updates, as well as new leave requests and time registrations. - Updated utility functions for pagination in common/base.mjs. - Removed deprecated object types and utility functions from common/utils.mjs. - Bumped component version to 0.0.1 in package.json.
1 parent e3a152c commit 724b2cc

File tree

19 files changed

+1990
-849
lines changed

19 files changed

+1990
-849
lines changed

components/buddee/actions/create-employee/create-employee.mjs

Lines changed: 49 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import buddee from "../../buddee.app.mjs";
33
export default {
44
name: "Create Employee",
55
description: "Create a new employee record. [See the documentation](https://developers.buddee.nl/#d08b1399-6333-4f08-a17b-26b2d8485d7e)",
6-
key: "createEmployee",
6+
key: "buddee-create-employee",
77
version: "0.0.1",
88
type: "action",
99
props: {
@@ -14,20 +14,49 @@ export default {
1414
"companyId",
1515
],
1616
},
17+
employmentDate: {
18+
type: "string",
19+
label: "Employment Date",
20+
description: "Employee's employment date (YYYY-MM-DD)",
21+
},
22+
firstDayAtWorkDate: {
23+
type: "string",
24+
label: "First Day at Work Date",
25+
description: "Employee's first day at work date (YYYY-MM-DD)",
26+
},
1727
firstName: {
1828
type: "string",
1929
label: "First Name",
2030
description: "Employee's first name",
2131
},
32+
initials: {
33+
type: "string",
34+
label: "Initials",
35+
description: "Employee's initials",
36+
optional: true,
37+
},
2238
lastName: {
2339
type: "string",
2440
label: "Last Name",
2541
description: "Employee's last name",
2642
},
27-
employmentDate: {
43+
lastNamePrefix: {
2844
type: "string",
29-
label: "Employment Date",
30-
description: "Employee's employment date (YYYY-MM-DD)",
45+
label: "Last Name Prefix",
46+
description: "Employee's last name prefix",
47+
optional: true,
48+
},
49+
workEmail: {
50+
type: "string",
51+
label: "Work Email",
52+
description: "The work email of the employee",
53+
optional: true,
54+
},
55+
personalEmail: {
56+
type: "string",
57+
label: "Personal Email",
58+
description: "The personal email of the employee",
59+
optional: true,
3160
},
3261
managerId: {
3362
propDefinition: [
@@ -47,42 +76,22 @@ export default {
4776
description: "The ID of the indirect manager to create the employee for",
4877
optional: true,
4978
},
50-
costCenterId: {
79+
hrManagerId: {
5180
propDefinition: [
5281
buddee,
53-
"costCenterId",
82+
"employeeId",
5483
],
84+
label: "HR Manager ID",
85+
description: "The ID of the HR manager to create the employee for",
5586
optional: true,
5687
},
57-
costUnitId: {
88+
buddyId: {
5889
propDefinition: [
5990
buddee,
60-
"costUnitId",
91+
"employeeId",
6192
],
62-
optional: true,
63-
},
64-
gender: {
65-
type: "string",
66-
label: "Gender",
67-
description: "The gender of the employee",
68-
optional: true,
69-
},
70-
birthDate: {
71-
type: "string",
72-
label: "Birth Date",
73-
description: "The birth date of the employee (YYYY-MM-DD)",
74-
optional: true,
75-
},
76-
workEmail: {
77-
type: "string",
78-
label: "Work Email",
79-
description: "The work email of the employee",
80-
optional: true,
81-
},
82-
personalEmail: {
83-
type: "string",
84-
label: "Personal Email",
85-
description: "The personal email of the employee",
93+
label: "Buddee ID",
94+
description: "A buddy is an existing employee who guides the new employee through the first few weeks or months on the job.",
8695
optional: true,
8796
},
8897
},
@@ -91,17 +100,18 @@ export default {
91100
$,
92101
data: {
93102
company_id: this.companyId,
103+
employment_date: this.employmentDate,
104+
first_day_at_work_date: this.firstDayAtWorkDate,
94105
first_name: this.firstName,
106+
initials: this.initials,
95107
last_name: this.lastName,
96-
employment_date: this.employmentDate,
97-
manager_id: this.managerId,
98-
indirect_manager_id: this.indirectManagerId,
99-
cost_center_id: this.costCenterId,
100-
cost_unit_id: this.costUnitId,
101-
gender: this.gender,
102-
birth_date: this.birthDate,
108+
last_name_prefix: this.lastNamePrefix,
103109
work_email: this.workEmail,
104110
personal_email: this.personalEmail,
111+
manager_id: this.managerId,
112+
indirect_manager_id: this.indirectManagerId,
113+
hr_manager_id: this.hrManagerId,
114+
buddy_id: this.buddyId,
105115
},
106116
});
107117

Lines changed: 46 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,85 +1,76 @@
1-
import { API_ENDPOINTS } from "../../common/constants.mjs";
1+
import buddee from "../../buddee.app.mjs";
22

33
export default {
44
name: "Create Leave Request",
5-
description: "Employee creates a new time-off request",
6-
key: "createLeaveRequest",
7-
version: "0.1.0",
5+
description: "Creates a new leave request. [See the documentation](https://developers.buddee.nl/#b5a0cea5-e416-4521-8bc1-46cc4c3d95cb)",
6+
key: "buddee-create-leave-request",
7+
version: "0.0.1",
88
type: "action",
99
props: {
10-
buddee: {
11-
type: "app",
12-
app: "buddee",
13-
label: "Buddee",
14-
description: "The Buddee app instance to use",
15-
},
10+
buddee,
1611
employeeId: {
17-
type: "string",
18-
label: "Employee ID",
19-
description: "ID of the employee requesting leave",
20-
required: true,
12+
propDefinition: [
13+
buddee,
14+
"employeeId",
15+
],
2116
},
2217
leaveTypeId: {
18+
propDefinition: [
19+
buddee,
20+
"leaveTypeId",
21+
],
22+
},
23+
hours: {
24+
type: "string",
25+
label: "Hours",
26+
description: "Number of leave hours",
27+
optional: true,
28+
},
29+
reason: {
2330
type: "string",
24-
label: "Leave Type ID",
25-
description: "ID of the leave type (vacation, personal, etc.)",
26-
required: true,
31+
label: "Reason",
32+
description: "Reason for the leave",
33+
optional: true,
2734
},
2835
startDate: {
2936
type: "string",
3037
label: "Start Date",
3138
description: "Start date of the leave request (YYYY-MM-DD)",
32-
required: true,
39+
},
40+
startTime: {
41+
type: "string",
42+
label: "Start Time",
43+
description: "Start time of the leave request (HH:MM)",
44+
optional: true,
3345
},
3446
endDate: {
3547
type: "string",
3648
label: "End Date",
3749
description: "End date of the leave request (YYYY-MM-DD)",
38-
required: true,
3950
},
40-
reason: {
51+
endTime: {
4152
type: "string",
42-
label: "Reason",
43-
description: "Reason for the leave request",
44-
},
45-
halfDay: {
46-
type: "boolean",
47-
label: "Half Day",
48-
description: "Whether this is a half-day leave request",
49-
default: false,
50-
},
51-
morningHalfDay: {
52-
type: "boolean",
53-
label: "Morning Half Day",
54-
description: "If half day, whether it's morning or afternoon",
55-
default: false,
53+
label: "End Time",
54+
description: "End time of the leave request (HH:MM)",
55+
optional: true,
5656
},
5757
},
5858
async run({ $ }) {
59-
const data = {
60-
employee_id: this.employeeId,
61-
leave_type_id: this.leaveTypeId,
62-
start_date: this.startDate,
63-
end_date: this.endDate,
64-
};
65-
66-
if (this.reason) {
67-
data.reason = this.reason;
68-
}
69-
if (this.halfDay) {
70-
data.half_day = this.halfDay;
71-
}
72-
if (this.morningHalfDay) {
73-
data.morning_half_day = this.morningHalfDay;
74-
}
75-
76-
const response = await this.buddee._makeRequest({
59+
const response = await this.buddee.createLeaveRequest({
7760
$,
78-
method: "POST",
79-
path: API_ENDPOINTS.LEAVE_REQUESTS,
80-
data,
61+
data: {
62+
employee_id: this.employeeId,
63+
leave_type_id: this.leaveTypeId,
64+
hours: this.hours && parseFloat(this.hours),
65+
reason: this.reason,
66+
start_date: this.startDate,
67+
start_time: this.startTime,
68+
end_date: this.endDate,
69+
end_time: this.endTime,
70+
},
8171
});
8272

73+
$.export("$summary", `Successfully created leave request with ID: ${response.data.id}`);
8374
return response.data;
8475
},
8576
};

0 commit comments

Comments
 (0)