Skip to content

Commit dec32aa

Browse files
committed
allow selecting multiple employees
1 parent c7dd2cc commit dec32aa

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

components/breathe/sources/new-leave-request-created/new-leave-request-created.mjs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,15 @@ export default {
1010
dedupe: "unique",
1111
props: {
1212
...common.props,
13-
employeeId: {
13+
employeeIds: {
1414
propDefinition: [
1515
common.props.breathe,
1616
"employeeId",
1717
],
18+
type: "string[]",
19+
label: "Employee IDs",
20+
description: "Return leave requests for the selected employees only",
21+
optional: true,
1822
},
1923
},
2024
methods: {
@@ -26,16 +30,21 @@ export default {
2630
return this.breathe.listLeaveRequests;
2731
},
2832
getArgs(lastTs) {
29-
return {
33+
const args = {
3034
params: {
31-
employee_id: this.employeeId,
3235
startDate: lastTs,
3336
},
3437
};
38+
if (this.employeeIds?.length === 1) {
39+
args.params.employee_id = this.employeeIds[0];
40+
}
3541
},
3642
getResourceKey() {
3743
return "leave_requests";
3844
},
45+
isRelevant(leaveRequest) {
46+
return !this.employeeIds?.length || this.employeeIds.includes(leaveRequest.employee.id);
47+
},
3948
generateMeta(leaveRequest) {
4049
return {
4150
id: leaveRequest.id,

0 commit comments

Comments
 (0)