Skip to content

Commit 2fd531d

Browse files
committed
employee integrated
1 parent 652e3e1 commit 2fd531d

File tree

3 files changed

+36
-27
lines changed

3 files changed

+36
-27
lines changed

src/api/Apis.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ export async function getInOfficeInviteData(page:number=0,count:number=10) {
162162

163163

164164
export async function getEmployeesData(page:number=0,count:number=10) {
165-
const url = `/product/reception/checkin/user/data?page=${page}&count=${count}`
165+
const url = `/product/employee/data?page=${page}&count=${count}`
166166

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

src/features/Employees/EmployeesView.tsx

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import React, {FunctionComponent, useEffect} from 'react';
22
import TableWrapper from "../../components/TableWrapper";
3-
import {createStyles, fade, Grid, Paper, Theme} from "@material-ui/core";
3+
import {Avatar, createStyles, fade, Grid, Paper, Theme} from "@material-ui/core";
44
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';
88
import { fetchEmployees } from 'features/Employees/employeeSlice'
99
import { CustomMenuItem } from 'components/CustomMenuItem';
10+
import { serverUrl } from 'api/Apis';
1011
interface OwnProps {
1112
}
1213

@@ -32,22 +33,30 @@ const data = {
3233
}
3334

3435
//const columns = ['Visitor name', 'Mobile No.', 'Email', 'Organization']
36+
// designation: any,//developer,
37+
// email: any,//arjunp@gmail.com,
38+
// empid: any,//002,
39+
// fname: any,//arjun,
40+
// lname: any,//pan,
41+
// mname: any,//test,
42+
// mobile: any,//1any,//2345678,
43+
// profilepicpath:
3544
const columns = [
3645
{
37-
id: "name",
38-
label: 'Visitor name'
46+
id: "profilepicpath",
47+
label: ''
3948
},
4049
{
41-
id: "mobile",
42-
label: 'Mobile No.'
50+
id: "name",
51+
label: 'Name'
4352
},
4453
{
45-
id: "tomeet",
54+
id: "email",
4655
label: 'Email'
4756
},
4857
{
49-
id: "purpose",
50-
label: 'Organization'
58+
id: "mobile",
59+
label: 'Mobile No.'
5160
}]
5261
const EmployeesView: FunctionComponent<Props> = (props) => {
5362
const classes = useStyles()
@@ -78,18 +87,15 @@ const EmployeesView: FunctionComponent<Props> = (props) => {
7887
)
7988
}
8089

81-
let tableRows: any = []
82-
83-
for (let i = 0; i < 10; i++) {
84-
let copy: any = tableRows
85-
86-
tableRows = [data, ...copy]
87-
}
90+
8891

8992

9093
const TableConfig = {
9194
columns: columns,
92-
data: employees,
95+
data: employees.map(el => ({
96+
...el,
97+
profilepicpath: <Avatar src={serverUrl + el['profilepicpath']} />
98+
})),
9399
isLoading: isLoadingEmployee,
94100
pagination:true,
95101
pageChange:(page:number,count:number)=>{

src/features/Employees/employeeSlice.ts

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,17 @@ import { AppThunk } from 'app/store'
66

77

88
export interface Employee {
9-
email: any //"admin@gmail.com",
10-
intime: any //"2020-09-14 20:28:34",
11-
employee_id: any //"arj1600095514",
12-
mobileno: any //"123456789",
13-
name: any //"arjunp",
14-
purpose: any //"tomeet",
15-
scheduletime: any //"2020-09-12 15:00"
16-
tomeet: any //"arjun2"
9+
createdOn: any,//2020-09-30 13: 14: 38,
10+
designation: any,//developer,
11+
email: any,//arjunp@gmail.com,
12+
empid: any,//002,
13+
fname: any,//arjun,
14+
lname: any,//pan,
15+
mname: any,//test,
16+
mobile: any,//1any,//2345678,
17+
profilepicpath: any,//uploads/images/arj_pic_1601471678_arjun_pass.JPG,
18+
updatedOn: any,//2020-09-30 13: 14: 38
19+
name:any
1720
}
1821
export interface EmployeesResult {
1922
//pageLinks: Links | null
@@ -61,9 +64,9 @@ const employees = createSlice({
6164
state.pageCount = pageCount
6265
state.isLoading = false
6366
state.error = null
64-
state.employees = employees
67+
state.employees = employees.map(e=>({...e,name:e.fname+' '+e.mname+' '+e.lname}))
6568
// @ts-ignore
66-
state.employees.map(employee => (state.employeesById[employee.employee_id]=employee))
69+
state.employees.map(employee => (state.employeesById[employee.empid]=employee))
6770
},
6871
getEmployeesFailure: loadingFailed,
6972
}

0 commit comments

Comments
 (0)