Skip to content

Commit 8effd33

Browse files
committed
bug fixing
1 parent 1fb61c6 commit 8effd33

File tree

5 files changed

+19
-16
lines changed

5 files changed

+19
-16
lines changed

src/api/Apis.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,8 @@ export async function getInOfficeInviteData(page:number=0,count:number=10) {
161161
}
162162

163163

164-
export async function getEmployeesData(page:number=0,count:number=10) {
165-
const url = `/product/employee/data?page=${page}&count=${count}`
164+
export async function getEmployeesData(page:number=0,count:number=10,filter:string='') {
165+
const url = `/product/employee/data?page=${page}&count=${count}&keyword=${filter}`
166166

167167
const { data } = await apis.get(url)
168168

src/features/Employees/EmployeesView.tsx

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { FunctionComponent, useEffect } from 'react';
1+
import React, { FunctionComponent, useEffect, useState } from 'react';
22
import TableWrapper from "../../components/TableWrapper";
33
import { Avatar, Box, createStyles, fade, Grid, Paper, Theme } from "@material-ui/core";
44
import { makeStyles } from "@material-ui/core/styles";
@@ -26,12 +26,7 @@ const useStyles = makeStyles((theme: Theme) =>
2626
)
2727

2828

29-
const data = {
30-
name: 'Vijaya Tondon',
31-
mobileNo: 9754821630,
32-
email: 'Vijaytandon@gmail.com',
33-
organization: 'Company Name'
34-
}
29+
3530

3631
//const columns = ['Visitor name', 'Mobile No.', 'Email', 'Organization']
3732
// designation: any,//developer,
@@ -79,6 +74,9 @@ const columns = [
7974
const EmployeesView: FunctionComponent<Props> = (props) => {
8075
const classes = useStyles()
8176

77+
const [filter, setfilter] = useState("")
78+
const [rowPerPage, setRowPerPage] = useState(10);
79+
8280
const dispatch = useDispatch()
8381

8482
const {
@@ -95,6 +93,10 @@ const EmployeesView: FunctionComponent<Props> = (props) => {
9593

9694
}, [dispatch])
9795

96+
useEffect(() => {
97+
debugger
98+
dispatch(fetchEmployees(0, rowPerPage,filter))
99+
}, [filter])
98100

99101
if (error) {
100102
return (
@@ -114,7 +116,7 @@ const EmployeesView: FunctionComponent<Props> = (props) => {
114116
isLoading: isLoadingEmployee,
115117
pagination: true,
116118
pageChange: (page: number, count: number) => {
117-
dispatch(fetchEmployees(page, count))
119+
dispatch(fetchEmployees(page, count,filter))
118120
},
119121
totalCount: pageCount,
120122
//@ts-ignore
@@ -132,7 +134,7 @@ const EmployeesView: FunctionComponent<Props> = (props) => {
132134
<Paper className={classes.paper}>
133135

134136
<Box display="flex" justifyContent="space-between" style={{ paddingTop: '37px', paddingLeft: '30px', paddingBottom: '25.5px'}} >
135-
<SearchInput /*style={{ margin: '0 23px 30px', paddingTop: '37px' }}*/ placeholder="Search Employees by name, email or mobile" width={500} />
137+
<SearchInput onChange={(e: any) => { setfilter(e.target.value ) }} value={filter}/*style={{ margin: '0 23px 30px', paddingTop: '37px' }}*/ placeholder="Search Employees by name" width={500} />
136138
{/* <SelectInput value="Action" /> */}
137139
<CustomMenuItem to='/employee/add'>
138140
<CustomButton style={{ width: '150px', fontSize: '12px', height: '39px', padding: 0 }}>

src/features/Employees/employeeSlice.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,12 @@ export default employees.reducer
107107

108108
export const fetchEmployees = (
109109
page?: number
110-
, count?: number
110+
, count?: number,
111+
filter?:string
111112
): AppThunk => async dispatch => {
112113
try {
113114
dispatch(getEmployeesStart())
114-
const employees = await getEmployeesData(page,count)
115+
const employees = await getEmployeesData(page,count,filter)
115116

116117
dispatch(getEmployeesSuccess(employees))
117118
} catch (err) {

src/features/Invites/InviteView.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ const InviteView: FunctionComponent<Props> = (props) => {
264264
label: classes.label, // class name, e.g. `classes-nesting-label-x`
265265
}} variant="contained" style={{ marginTop: '33px', marginLeft: '27px', height: '40px'}}>In Office</Button> */}
266266
<SelectInput style={{ marginLeft: '27px' }} onChange={(e: any) => { debugger; handleFilterChange({ purpose: e.target.value }) }} menuOptions={purpose.map(item => ({ title: item }))} defaultValue="All Purpose" value={filter.purpose} />
267-
<SelectInput style={{ marginLeft: '27px' }} onChange={(e: any) => { debugger; handleFilterChange({ site: e.target.value }) }} menuOptions={sites.map(item => ({ title: item.sitename }))} defaultValue="All Sites" value={filter.site} />
267+
{/* <SelectInput style={{ marginLeft: '27px' }} onChange={(e: any) => { debugger; handleFilterChange({ site: e.target.value }) }} menuOptions={sites.map(item => ({ title: item.sitename }))} defaultValue="All Sites" value={filter.site} /> */}
268268
<Button onClick={() => { handleFilterChange({ site: "", purpose: "", visitor: "" }) }}
269269
classes={{
270270
root: classes.buttonRoot, // class name, e.g. `classes-nesting-root-x`

src/features/Settings/DevicesView.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ const DevicesView: FunctionComponent<Props> = (props) => {
117117
<Box display="flex" justifyContent="space-between" style={{ paddingTop: '37.5px', paddingBottom: '24px' }}>
118118
<SearchInput style={{ marginLeft: '28.5px', height: '39px' }} placeholder="Search Devices" width={400} />
119119
<Box display="flex">
120-
<SelectInput style={{ marginRight: '26px', width: '122px', height: '39px' }} value = {""} defaultValue="All Sites" menuOptions={[]} />
121-
<SelectInput style={{ marginRight: '26px', width: '122px', height: '39px' }} value = {""} defaultValue="All Status" menuOptions={[]} />
120+
{/* <SelectInput style={{ marginRight: '26px', width: '122px', height: '39px' }} value = {""} defaultValue="All Sites" menuOptions={[]} /> */}
121+
{/* <SelectInput style={{ marginRight: '26px', width: '122px', height: '39px' }} value = {""} defaultValue="All Status" menuOptions={[]} /> */}
122122
<CustomMenuItem to='/devices/device'>
123123
<CustomButton style={{ marginRight: '63px', width: '116px', fontSize: '12px', height: '39px', padding: 0, marginTop: '2px' }}>
124124
Add Device

0 commit comments

Comments
 (0)