Skip to content

Commit 49db7ef

Browse files
committed
fixing hiveflow modal
1 parent d520cb1 commit 49db7ef

4 files changed

Lines changed: 32 additions & 11 deletions

File tree

packages/app/hiveflow-frontend/src/views/schedule/modal/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ export const SchedulingModal = (props: any) => {
103103
let skills = skillKeys?.map((x) => {
104104
return {
105105
skill: x,
106-
hours: parseFloat(prev.find((a) => a.skill == x)?.hours || 0) + parseFloat(curr?.requiredSkills?.find((a) => a?.skill?.skill == x).hours || 0)
106+
hours: parseFloat(prev.find((a) => a.skill == x)?.hours || 0) + parseFloat(curr?.requiredSkills?.find((a) => a?.skill?.skill == x)?.hours || 0)
107107
}
108108
})
109109

packages/app/hiveflow-frontend/src/views/schedule/modal/view/people.tsx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,21 @@ export const PeopleView = (props: any) => {
4949
}
5050
}
5151

52+
const [ searchQuery, setSearchQuery ] = useState('')
53+
54+
const search = (item: any) => {
55+
if(!searchQuery || searchQuery.length == 0) return true;
56+
return item.name.indexOf(searchQuery) > -1;
57+
}
58+
5259
return (
5360
<Box>
54-
<TextField fullWidth size="small" label="Search" />
61+
<TextField
62+
value={searchQuery}
63+
onChange={(e) => setSearchQuery(e.target.value)}
64+
fullWidth size="small" label="Search" />
5565
<List sx={{ height: '200px', overflow: 'auto'}}>
56-
{props.people?.filter(onLeave).map((people) => {
66+
{props.people?.filter(onLeave).filter(search).map((people) => {
5767
const {leave: leaveAvailability, scheduled: scheduleAvailability} = getAvailability(people);
5868
return <ListItem
5969
dense

packages/app/hiveflow-frontend/src/views/schedule/modal/view/skills.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export const SkillView = (props: any) => {
99
let skills = skillKeys?.map((x) => {
1010
return {
1111
skill: x,
12-
hours: parseFloat(prev.find((a) => a.skill == x)?.hours || 0) + parseFloat(curr?.requiredSkills?.find((a) => a.skill.skill == x).hours || 0)
12+
hours: parseFloat(prev.find((a) => a.skill == x)?.hours || 0) + parseFloat(curr?.requiredSkills?.find((a) => a.skill.skill == x)?.hours || 0)
1313
}
1414
})
1515

packages/app/hiveflow-frontend/src/views/schedule/modal/view/tasks.tsx

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,31 @@ import { useEffect, useState } from "react"
33

44
export const TasksView = (props: any) => {
55

6-
const [ assignedTasks, setAssignedTasks ] = useState<any[]>([]);
6+
const [assignedTasks, setAssignedTasks] = useState<any[]>([]);
77

88
useEffect(() => {
99
setAssignedTasks(props.selected)
1010
}, [props.selected])
11+
12+
const [searchQuery, setSearchQuery] = useState('')
13+
14+
const search = (item: any) => {
15+
if (!searchQuery || searchQuery.length == 0) return true;
16+
return item.title.indexOf(searchQuery) > -1;
17+
}
18+
1119
return (
1220
<Box>
13-
<TextField fullWidth size="small" label="Search" />
14-
<List sx={{height: '200px', overflow: 'auto'}}>
15-
{props.tasks?.map((task) => (
21+
<TextField
22+
value={searchQuery}
23+
onChange={(e) => setSearchQuery(e.target.value)}
24+
fullWidth size="small" label="Search" />
25+
<List sx={{ height: '200px', overflow: 'auto' }}>
26+
{props.tasks?.filter(search)?.map((task) => (
1627
<ListItem disablePadding sx={{ display: 'flex', alignItems: 'center' }}>
1728
<ListItemButton disableGutters onClick={() => {
18-
console.log("SELECT TASK", {task})
19-
if ((assignedTasks || []).indexOf(task.id) < 0) {
29+
console.log("SELECT TASK", { task })
30+
if ((assignedTasks || []).indexOf(task.id) < 0) {
2031
let newSelection = [
2132
...assignedTasks,
2233
task.id
@@ -32,7 +43,7 @@ export const TasksView = (props: any) => {
3243

3344
<Checkbox
3445
checked={assignedTasks?.indexOf(task.id) > -1}
35-
/>
46+
/>
3647
<Typography>{task.title}</Typography>
3748
</ListItemButton>
3849
</ListItem>

0 commit comments

Comments
 (0)