Skip to content

Commit e752f46

Browse files
committed
demo changes
1 parent 2fd531d commit e752f46

File tree

4 files changed

+77
-36
lines changed

4 files changed

+77
-36
lines changed

src/components/TableWrapper.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ export const TableWrapper: FunctionComponent<Props> = ({ config, ...props }) =>
278278
const [orderBy, setOrderBy] = React.useState<string>('id');
279279
const rows = [...config.data]
280280
const columns = [...config.columns]
281-
const menuOptions = [...config.menuOptions]
281+
const menuOptions = config.menuOptions?[...config.menuOptions]:null
282282
const pageChange = config.pageChange
283283
const totalCount = config.totalCount || rows.length
284284
const handleRequestSort = (event: React.MouseEvent<unknown>, property: string) => {
@@ -379,7 +379,7 @@ export const TableWrapper: FunctionComponent<Props> = ({ config, ...props }) =>
379379
{
380380
columns.map((col: any, j: number) => <TableCell key={i + '' + j}>{row[col.id]}</TableCell>)
381381
}
382-
<TableCell key={i + "-c"} className={classes.cell} align="left">
382+
{menuOptions && <TableCell key={i + "-c"} className={classes.cell} align="left">
383383
<Button aria-controls="simple-menu" aria-haspopup="true" onClick={(e) => {
384384
handleClick(e, i + "-c")
385385
}}>
@@ -406,7 +406,7 @@ export const TableWrapper: FunctionComponent<Props> = ({ config, ...props }) =>
406406
)
407407
})}
408408
</StyledMenu>
409-
</TableCell>
409+
</TableCell>}
410410
</TableRow>
411411
))
412412
}

src/features/Employees/EmployeesView.tsx

Lines changed: 44 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import React, {FunctionComponent, useEffect} from 'react';
1+
import React, { FunctionComponent, useEffect } from 'react';
22
import TableWrapper from "../../components/TableWrapper";
3-
import {Avatar, createStyles, fade, Grid, Paper, Theme} from "@material-ui/core";
4-
import {makeStyles} from "@material-ui/core/styles";
3+
import { Avatar, createStyles, fade, Grid, Paper, Theme } from "@material-ui/core";
4+
import { makeStyles } from "@material-ui/core/styles";
55
import SearchInput from "../../components/SearchInput";
66
import { RootState } from 'app/rootReducer'
77
import { useSelector, useDispatch } from 'react-redux';
@@ -42,22 +42,39 @@ const data = {
4242
// mobile: any,//1any,//2345678,
4343
// profilepicpath:
4444
const columns = [
45+
4546
{
46-
id: "profilepicpath",
47-
label: ''
47+
id: "fname",
48+
label: 'First name'
4849
},
4950
{
50-
id: "name",
51-
label: 'Name'
51+
id: "mname",
52+
label: 'Middle name'
5253
},
5354
{
54-
id: "email",
55-
label: 'Email'
55+
id: "lname",
56+
label: 'Last name'
5657
},
5758
{
5859
id: "mobile",
59-
label: 'Mobile No.'
60-
}]
60+
label: 'Mobile no.'
61+
},
62+
{
63+
id: "email",
64+
label: 'Email id'
65+
},
66+
{
67+
id: "designation",
68+
label: 'Designation'
69+
},
70+
{
71+
id: "empid",
72+
label: 'Employee id'
73+
},
74+
{
75+
id: "profilepicpath",
76+
label: ''
77+
},]
6178
const EmployeesView: FunctionComponent<Props> = (props) => {
6279
const classes = useStyles()
6380

@@ -87,7 +104,7 @@ const EmployeesView: FunctionComponent<Props> = (props) => {
87104
)
88105
}
89106

90-
107+
91108

92109

93110
const TableConfig = {
@@ -97,23 +114,26 @@ const EmployeesView: FunctionComponent<Props> = (props) => {
97114
profilepicpath: <Avatar src={serverUrl + el['profilepicpath']} />
98115
})),
99116
isLoading: isLoadingEmployee,
100-
pagination:true,
101-
pageChange:(page:number,count:number)=>{
102-
dispatch(fetchEmployees(page,count))
117+
pagination: true,
118+
pageChange: (page: number, count: number) => {
119+
dispatch(fetchEmployees(page, count))
103120
},
104-
totalCount:pageCount,
105-
menuOptions: [{
106-
item: (id: any) => <CustomMenuItem to='/' onClick={() => console.log('check out ' + id)}>
107-
Check Out
108-
</CustomMenuItem>
109-
}]
121+
totalCount: pageCount,
122+
//@ts-ignore
123+
// menuOptions: [
124+
// {
125+
// item: (id: any) => <CustomMenuItem to='/' onClick={() => console.log('check out ' + id)}>
126+
// Check Out
127+
// </CustomMenuItem>
128+
// }
129+
// ]
110130
}
111131

112132
return (
113-
<Grid item xs style={{height: "100%"}}>
133+
<Grid item xs style={{ height: "100%" }}>
114134
<Paper className={classes.paper}>
115-
<SearchInput style={{margin: '0 23px 30px', paddingTop: '37px'}} placeholder="Search Employees by name, email or mobile" width={500}/>
116-
<TableWrapper style={{marginLeft: '54px'}} config={TableConfig}/>
135+
<SearchInput style={{ margin: '0 23px 30px', paddingTop: '37px' }} placeholder="Search Employees by name, email or mobile" width={500} />
136+
<TableWrapper style={{ marginLeft: '54px' }} config={TableConfig} />
117137
</Paper>
118138
</Grid>
119139
);

src/features/SalesAndOrganisation/CheckInPointsView.tsx

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,21 @@ const CheckInPointsView: FunctionComponent<Props> = (props) => {
6363
dispatch(fetchCheckInPoints(page,count))
6464
},
6565
totalCount:pageCount,
66-
menuOptions: [{
67-
item: (id: any) => <CustomMenuItem to='/' onClick={() => console.log('check out ' + id)}>
68-
Check Out
69-
</CustomMenuItem>
70-
}]
66+
// menuOptions: [{
67+
// item: (id: any) => <CustomMenuItem to='/' onClick={() => console.log('check out ' + id)}>
68+
// Delete
69+
// </CustomMenuItem>
70+
// },
71+
// {
72+
// item: (id: any) => <CustomMenuItem to='/' onClick={() => console.log('check out ' + id)}>
73+
// Disable
74+
// </CustomMenuItem>
75+
// },
76+
// {
77+
// item: (id: any) => <CustomMenuItem to='/' onClick={() => console.log('check out ' + id)}>
78+
// View Details
79+
// </CustomMenuItem>
80+
// }]
7181
}
7282

7383
useEffect(() => {
@@ -78,8 +88,9 @@ const CheckInPointsView: FunctionComponent<Props> = (props) => {
7888
<Grid item xs style={{height: "100%"}}>
7989
<Paper className={classes.paper}>
8090
<Box display="flex" justifyContent="space-between" style={{ paddingTop: '37px', paddingLeft: '30px', paddingBottom: '25.5px'}} >
81-
<SearchInput placeholder="Search Employees by name, email or mobile" width={353} />
82-
<SelectInput value="Action" />
91+
<SearchInput hidden placeholder="Search Employees by name, email or mobile" width={353} />
92+
<div style={{width:353}}/>
93+
{/* <SelectInput value="Action" /> */}
8394
<CustomMenuItem to='/checkinpoints/add'>
8495
<CustomButton style={{ width: '150px', fontSize: '12px', height: '39px', padding: 0 }}>
8596
Add Checkin point

src/features/SalesAndOrganisation/SitesView.tsx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,17 @@ const SitesView: FunctionComponent<Props> = (props) => {
7979
totalCount: pageCount,
8080
menuOptions: [{
8181
item: (id: any) => <CustomMenuItem to='/' onClick={() => console.log('check out ' + id)}>
82-
Check Out
82+
Delete
83+
</CustomMenuItem>
84+
},
85+
{
86+
item: (id: any) => <CustomMenuItem to='/' onClick={() => console.log('check out ' + id)}>
87+
Disable
88+
</CustomMenuItem>
89+
},
90+
{
91+
item: (id: any) => <CustomMenuItem to='/' onClick={() => console.log('check out ' + id)}>
92+
View Details
8393
</CustomMenuItem>
8494
}]
8595
}
@@ -93,7 +103,7 @@ const SitesView: FunctionComponent<Props> = (props) => {
93103
<Paper className={classes.paper}>
94104
<Box display="flex" justifyContent="space-between" style={{ paddingTop: '38px', paddingBottom: '26px' }}>
95105
<SearchInput placeholder="Search Employees by name, email or mobile" width={354} style={{ paddingLeft: '30px' }} />
96-
<SelectInput value="Action" menuOptions={selectInputMenu} style={{ width: '122px' }} />
106+
{/* <SelectInput value="Action" menuOptions={selectInputMenu} style={{ width: '122px' }} /> */}
97107
<CustomMenuItem to='/sites/add'>
98108
<CustomButton style={{ width: '122px', fontSize: '12px', height: '39px', padding: 0 }}>
99109
Add Site

0 commit comments

Comments
 (0)