From 2a1932a62f7b8b5d7ae72c3f280787ba3a35dde0 Mon Sep 17 00:00:00 2001 From: archisbhoir Date: Mon, 28 Sep 2020 22:18:43 +0530 Subject: [PATCH 01/69] add slice button --- .../SalesAndOrganisation/SitesView.tsx | 50 +++++++++++-------- src/features/Settings/AgreementView.tsx | 2 +- src/features/Settings/DeviceForm.tsx | 6 +-- 3 files changed, 30 insertions(+), 28 deletions(-) diff --git a/src/features/SalesAndOrganisation/SitesView.tsx b/src/features/SalesAndOrganisation/SitesView.tsx index 80b1792..944eaa8 100644 --- a/src/features/SalesAndOrganisation/SitesView.tsx +++ b/src/features/SalesAndOrganisation/SitesView.tsx @@ -1,15 +1,16 @@ +import { Box, createStyles, Grid, Paper, Theme } from "@material-ui/core"; +import { makeStyles } from "@material-ui/core/styles"; +import { RootState } from 'app/rootReducer'; +import CustomButton from "components/Button"; +import { CustomMenuItem } from 'components/CustomMenuItem'; import React, { FunctionComponent, useEffect } from 'react'; -import {Box, createStyles, Grid, Paper, Theme} from "@material-ui/core"; +import { useDispatch, useSelector } from 'react-redux'; import SearchInput from "../../components/SearchInput"; -import TableWrapper from "../../components/TableWrapper"; -import {makeStyles} from "@material-ui/core/styles"; import SelectInput from "../../components/SelectInput"; -import { CustomMenuItem } from 'components/CustomMenuItem'; -import { useDispatch, useSelector } from 'react-redux'; -import { RootState } from 'app/rootReducer'; +import TableWrapper from "../../components/TableWrapper"; import { fetchSites } from './siteSlice'; -interface OwnProps {} +interface OwnProps { } type Props = OwnProps; @@ -74,11 +75,11 @@ const SitesView: FunctionComponent = (props) => { const TableConfig = { columns: columns, data: sites, - pagination:true, - pageChange:(page:number,count:number)=>{ - dispatch(fetchSites(page,count)) + pagination: true, + pageChange: (page: number, count: number) => { + dispatch(fetchSites(page, count)) }, - totalCount:pageCount, + totalCount: pageCount, menuOptions: [{ item: (id: any) => console.log('check out ' + id)}> Check Out @@ -87,21 +88,26 @@ const SitesView: FunctionComponent = (props) => { } useEffect(() => { - dispatch(fetchSites(0,10)) + dispatch(fetchSites(0, 10)) }, [dispatch]) return ( - - - - - - + + + + + + + + Add Site + + + - - - - ); + + + + ); }; export default SitesView; diff --git a/src/features/Settings/AgreementView.tsx b/src/features/Settings/AgreementView.tsx index 8df1d09..5fba240 100644 --- a/src/features/Settings/AgreementView.tsx +++ b/src/features/Settings/AgreementView.tsx @@ -41,7 +41,7 @@ const AgreementView: FunctionComponent = (props) => { const classes = useStyles() return ( - +
Non Disclosure Agreement diff --git a/src/features/Settings/DeviceForm.tsx b/src/features/Settings/DeviceForm.tsx index b49b5c4..81de438 100644 --- a/src/features/Settings/DeviceForm.tsx +++ b/src/features/Settings/DeviceForm.tsx @@ -132,7 +132,7 @@ const DeviceForm: FunctionComponent = (props) => {
- Save + Save @@ -180,10 +180,6 @@ const DeviceForm: FunctionComponent = (props) => { value={checkinpoint} />
- - - - From 233d5dd1e97ad7bd2b8bdaeabcad559eaa386da7 Mon Sep 17 00:00:00 2001 From: yadneshgharat Date: Mon, 28 Sep 2020 22:50:46 +0530 Subject: [PATCH 02/69] company name --- src/CustomDrawer.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CustomDrawer.tsx b/src/CustomDrawer.tsx index 8a9c7e7..ac026f2 100644 --- a/src/CustomDrawer.tsx +++ b/src/CustomDrawer.tsx @@ -215,7 +215,7 @@ const CustomDrawer: FunctionComponent = (props) => { - Company Logo + AUROCHEMICALS {/* */} From c11db6d342f82aecbbd908c57e3db3d2dcbae656 Mon Sep 17 00:00:00 2001 From: archisbhoir Date: Mon, 28 Sep 2020 23:06:08 +0530 Subject: [PATCH 03/69] site form --- src/api/Apis.tsx | 8 + src/app/App.tsx | 5 +- .../SalesAndOrganisation/SiteForm.tsx | 149 ++++++++++++++++++ .../SalesAndOrganisation/siteSlice.ts | 41 ++++- 4 files changed, 199 insertions(+), 4 deletions(-) create mode 100644 src/features/SalesAndOrganisation/SiteForm.tsx diff --git a/src/api/Apis.tsx b/src/api/Apis.tsx index 8ff6675..53cc2ae 100644 --- a/src/api/Apis.tsx +++ b/src/api/Apis.tsx @@ -258,6 +258,14 @@ export async function createInvite(json: string) { }) } export async function createDevice(json: string) { + // return await apis.post('/product/acountDetail/device/register', json, { + // headers: { + // "Content-Type": "application/json", + // // "Content-Length": 2617 + // }, + // }) +} +export async function createSite(json: string) { return await apis.post('/product/acountDetail/device/register', json, { headers: { "Content-Type": "application/json", diff --git a/src/app/App.tsx b/src/app/App.tsx index 58ce150..f888405 100644 --- a/src/app/App.tsx +++ b/src/app/App.tsx @@ -25,6 +25,7 @@ import {outhUser,setAuthUser} from 'features/auth/AuthSlice' import './styles.css' import VisitorsForm from "features/Settings/VisitorsForm" import Notification from "features/Settings/Notification" +import SiteForm from "features/SalesAndOrganisation/SiteForm" const useStyles = makeStyles((theme: Theme) => @@ -100,7 +101,8 @@ export default function App() { - + + @@ -130,6 +132,7 @@ export default function App() { + diff --git a/src/features/SalesAndOrganisation/SiteForm.tsx b/src/features/SalesAndOrganisation/SiteForm.tsx new file mode 100644 index 0000000..e6d6cc3 --- /dev/null +++ b/src/features/SalesAndOrganisation/SiteForm.tsx @@ -0,0 +1,149 @@ +import { Box, createStyles, Grid, Paper } from "@material-ui/core"; +import { makeStyles } from "@material-ui/core/styles"; +import { Theme } from "@material-ui/core/styles/createMuiTheme"; +import { ArrowBackIos } from "@material-ui/icons"; +// import { saveSite, setCurrentSite } from './siteSlice'; +import { RootState } from 'app/rootReducer'; +import CustomButton from "components/Button"; +import TextInput from "components/TextInput"; +import React, { FunctionComponent, useEffect } from 'react'; +import { useDispatch, useSelector } from "react-redux"; +import { RouteComponentProps } from 'react-router-dom'; +import { defaultInputState, saveSite, setCurrentSite } from './siteSlice'; + +const useStyles = makeStyles((theme: Theme) => createStyles({ + paper: { + backgroundColor: '#E7ECF6', + borderRadius: theme.shape.borderRadius - 5, + marginRight: 30, + height: '100%', + width: '100%' + // marginTop + }, + header: { + fontSize: '22px', + fontWeight: 'bold', + padding: theme.spacing(2, 0, 0, 4), + color: theme.palette.text.primary + }, + headerSecondary: { + fontSize: '20px', + fontWeight: 'bold', + padding: theme.spacing(0, 0, 4, 0), + color: theme.palette.text.primary, + }, + arrowBack: { + height: '30px', + verticalAlign: 'bottom', + cursor: 'pointer', + }, + rightInputs: { + marginTop: 134, + }, + button: { + marginRight: 20 + }, + inputGrid: { + marginTop: '30px', + padding: theme.spacing(1, 0, 0, 2) + } +})) + +interface OwnProps extends RouteComponentProps { +} + +type Props = OwnProps; + +const SiteForm: FunctionComponent = (props) => { + const classes = useStyles() + + const dispatch = useDispatch() + + const { + sites, + currentSite, + sitesById, + error + } = useSelector((state: RootState) => state.sites) + + const { + sitename, + address, + checkinpoint, + } = currentSite + const inputState = currentSite; + + const setInputState = (site: any) => { + dispatch(setCurrentSite(site)); + } + + const id = props.match.params.siteId + // debugger; + useEffect(() => { + // if (sitesById[id]) { + // const tempId = sitesById[id] + // //setInputState(tempId) + // dispatch(setCurrentSite(tempId)); + // } + }, [id]) + + const handleChange = (e: any) => setInputState({ + ...inputState, + [e.target.name]: e.target.value + }) + + const handleSubmit = async (e: any) => { + e.preventDefault() + dispatch(saveSite(JSON.stringify({ + "sitename": sitename, + "address": address, + "checkinpoint": checkinpoint + }), () => setInputState(defaultInputState))) + } + + + return ( + + +
+
+ props.history.push('/sites')} /> + Site details +
+ + + Save + + + + + {/*
*/} + + + + + + + + + + + + ); +}; + +export default SiteForm; diff --git a/src/features/SalesAndOrganisation/siteSlice.ts b/src/features/SalesAndOrganisation/siteSlice.ts index aa27b69..e9aec9b 100644 --- a/src/features/SalesAndOrganisation/siteSlice.ts +++ b/src/features/SalesAndOrganisation/siteSlice.ts @@ -1,8 +1,9 @@ import { createSlice, PayloadAction } from '@reduxjs/toolkit' import { Links } from 'parse-link-header' -import { getSitesData } from 'api/Apis' +import { createSite, getSitesData } from 'api/Apis' import { AppThunk } from 'app/store' +import { getBackdropStart, getBackdropStop } from 'app/BackdropSlice' export interface Site { @@ -17,6 +18,18 @@ export interface SitesResult { sites: Site[] } +export interface SiteInputState { + sitename: string + address: string + checkinpoint: string +} + +export const defaultInputState: SiteInputState = { + sitename: '', + address: '', + checkinpoint: '', +} + interface SiteState { sites: Site[] sitesById: Record @@ -25,6 +38,7 @@ interface SiteState { pageLinks: Links | null isLoading: boolean error: string | null + currentSite: SiteInputState } const sitesInitialState: SiteState = { @@ -34,7 +48,8 @@ const sitesInitialState: SiteState = { pageCount: 0, pageLinks: {}, isLoading: false, - error: null + error: null, + currentSite: defaultInputState } function startLoading(state: SiteState) { @@ -62,13 +77,17 @@ const sites = createSlice({ state.sites.map(site => (state.sitesById[site.site_id] = site)) }, getSitesFailure: loadingFailed, + setCurrentSite(state, { payload }: PayloadAction) { + state.currentSite = payload + } } }) export const { getSitesStart, getSitesSuccess, - getSitesFailure + getSitesFailure, + setCurrentSite } = sites.actions export default sites.reducer @@ -85,5 +104,21 @@ export const fetchSites = ( } catch (err) { dispatch(getSitesFailure(err.toString())) } + } + +export const saveSite = ( + site: any, + callback?: (() => void) +): AppThunk => async dispatch => { + try { + dispatch(getBackdropStart()) + await createSite(site) + .then(() => dispatch(getBackdropStart())).catch(() => dispatch(getBackdropStop())) + //return setInputState(defaultInputState) + callback && callback(); + //dispatch(saveInvitesSuccess(invites)) + } catch (err) { + dispatch(getBackdropStop()) + } } From a49c813cc148819544ff5515098652db114bdd75 Mon Sep 17 00:00:00 2001 From: archisbhoir Date: Mon, 28 Sep 2020 23:36:15 +0530 Subject: [PATCH 04/69] site form submit --- src/api/Apis.tsx | 14 +++++++------- src/features/SalesAndOrganisation/siteSlice.ts | 2 +- src/features/UserManagement/UserManagementView.tsx | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/api/Apis.tsx b/src/api/Apis.tsx index 53cc2ae..7842569 100644 --- a/src/api/Apis.tsx +++ b/src/api/Apis.tsx @@ -258,15 +258,15 @@ export async function createInvite(json: string) { }) } export async function createDevice(json: string) { - // return await apis.post('/product/acountDetail/device/register', json, { - // headers: { - // "Content-Type": "application/json", - // // "Content-Length": 2617 - // }, - // }) + return await apis.post('/product/acountDetail/device/register', json, { + headers: { + "Content-Type": "application/json", + // "Content-Length": 2617 + }, + }) } export async function createSite(json: string) { - return await apis.post('/product/acountDetail/device/register', json, { + return await apis.post('/product/register/site', json, { headers: { "Content-Type": "application/json", // "Content-Length": 2617 diff --git a/src/features/SalesAndOrganisation/siteSlice.ts b/src/features/SalesAndOrganisation/siteSlice.ts index e9aec9b..d58849a 100644 --- a/src/features/SalesAndOrganisation/siteSlice.ts +++ b/src/features/SalesAndOrganisation/siteSlice.ts @@ -113,7 +113,7 @@ export const saveSite = ( try { dispatch(getBackdropStart()) await createSite(site) - .then(() => dispatch(getBackdropStart())).catch(() => dispatch(getBackdropStop())) + .then(() => dispatch(getBackdropStop())).catch(() => dispatch(getBackdropStop())) //return setInputState(defaultInputState) callback && callback(); //dispatch(saveInvitesSuccess(invites)) diff --git a/src/features/UserManagement/UserManagementView.tsx b/src/features/UserManagement/UserManagementView.tsx index 8554f96..9b9f0f1 100644 --- a/src/features/UserManagement/UserManagementView.tsx +++ b/src/features/UserManagement/UserManagementView.tsx @@ -44,7 +44,7 @@ const useStyles = makeStyles((theme: Theme) => footer: { fontSize: '22px', fontWeight: 'bold', - padding: theme.spacing(6, 0, 0, 4), + padding: theme.spacing(5, 0, 0, 4), // paddingTop: '100px', color: theme.palette.text.primary }, @@ -114,7 +114,7 @@ const UserManagementView: FunctionComponent = (props) => { } return ( - +
props.history.push('/')}/> From 08533ef2dd6c5a7e72d1f1ac3391ac2a8446a39a Mon Sep 17 00:00:00 2001 From: archisbhoir Date: Tue, 29 Sep 2020 00:09:30 +0530 Subject: [PATCH 05/69] in office button --- src/features/Home/HomeView.tsx | 15 ++++++++++++++- .../SalesAndOrganisation/CheckInPointsView.tsx | 6 +++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/features/Home/HomeView.tsx b/src/features/Home/HomeView.tsx index 02654ca..04572eb 100644 --- a/src/features/Home/HomeView.tsx +++ b/src/features/Home/HomeView.tsx @@ -98,6 +98,15 @@ const useStyles = makeStyles((theme: Theme) => transition: theme.transitions.create('width'), }, + label: { + textTransform: 'capitalize', + }, + buttonRoot: { + fontSize: '12px', + backgroundColor: 'white', + borderRadius: theme.shape.borderRadius - 5, + boxShadow: 'none' + } }) ) @@ -268,7 +277,11 @@ const HomeView: FunctionComponent = (props) => { - + {/* */} + diff --git a/src/features/SalesAndOrganisation/CheckInPointsView.tsx b/src/features/SalesAndOrganisation/CheckInPointsView.tsx index 310dad4..0462679 100644 --- a/src/features/SalesAndOrganisation/CheckInPointsView.tsx +++ b/src/features/SalesAndOrganisation/CheckInPointsView.tsx @@ -32,7 +32,7 @@ const data = { //const columns = ['Check In ports', 'Site name', 'Device'] const columns = [ - + { id: "checkinpoint", label: 'Check In Point' @@ -88,8 +88,8 @@ const CheckInPointsView: FunctionComponent = (props) => { return ( - - + + From 4e211293bd70ed61405a869c67af99c64980838d Mon Sep 17 00:00:00 2001 From: archisbhoir Date: Tue, 29 Sep 2020 00:32:56 +0530 Subject: [PATCH 06/69] checkin form --- src/api/Apis.tsx | 8 + src/app/App.tsx | 5 +- .../SalesAndOrganisation/CheckInPointForm.tsx | 149 ++++++++++++++++++ .../CheckInPointsView.tsx | 12 +- .../SalesAndOrganisation/checkInPointSlice.ts | 39 ++++- 5 files changed, 206 insertions(+), 7 deletions(-) create mode 100644 src/features/SalesAndOrganisation/CheckInPointForm.tsx diff --git a/src/api/Apis.tsx b/src/api/Apis.tsx index 7842569..39dd527 100644 --- a/src/api/Apis.tsx +++ b/src/api/Apis.tsx @@ -273,6 +273,14 @@ export async function createSite(json: string) { }, }) } +export async function createCheckInPoint(json: string) { + return await apis.post('/product/register/checkinpoint', json, { + headers: { + "Content-Type": "application/json", + // "Content-Length": 2617 + }, + }) +} export async function signIn(username: string, password: string) { return await apis.post('/product/login', JSON.stringify({ diff --git a/src/app/App.tsx b/src/app/App.tsx index f888405..f5f6fa3 100644 --- a/src/app/App.tsx +++ b/src/app/App.tsx @@ -26,6 +26,7 @@ import './styles.css' import VisitorsForm from "features/Settings/VisitorsForm" import Notification from "features/Settings/Notification" import SiteForm from "features/SalesAndOrganisation/SiteForm" +import CheckInPointForm from "features/SalesAndOrganisation/CheckInPointForm" const useStyles = makeStyles((theme: Theme) => @@ -103,7 +104,8 @@ export default function App() { - + + @@ -134,6 +136,7 @@ export default function App() { + diff --git a/src/features/SalesAndOrganisation/CheckInPointForm.tsx b/src/features/SalesAndOrganisation/CheckInPointForm.tsx new file mode 100644 index 0000000..68e3357 --- /dev/null +++ b/src/features/SalesAndOrganisation/CheckInPointForm.tsx @@ -0,0 +1,149 @@ +import { Box, createStyles, Grid, Paper } from "@material-ui/core"; +import { makeStyles } from "@material-ui/core/styles"; +import { Theme } from "@material-ui/core/styles/createMuiTheme"; +import { ArrowBackIos } from "@material-ui/icons"; +// import { saveCheckInPoint, setCurrentCheckInPoint } from './checkInPointSlice'; +import { RootState } from 'app/rootReducer'; +import CustomButton from "components/Button"; +import TextInput from "components/TextInput"; +import React, { FunctionComponent, useEffect } from 'react'; +import { useDispatch, useSelector } from "react-redux"; +import { RouteComponentProps } from 'react-router-dom'; +import { defaultInputState, saveCheckInPoint, setCurrentCheckInPoint } from './checkInPointSlice'; + +const useStyles = makeStyles((theme: Theme) => createStyles({ + paper: { + backgroundColor: '#E7ECF6', + borderRadius: theme.shape.borderRadius - 5, + marginRight: 30, + height: '100%', + width: '100%' + // marginTop + }, + header: { + fontSize: '22px', + fontWeight: 'bold', + padding: theme.spacing(2, 0, 0, 4), + color: theme.palette.text.primary + }, + headerSecondary: { + fontSize: '20px', + fontWeight: 'bold', + padding: theme.spacing(0, 0, 4, 0), + color: theme.palette.text.primary, + }, + arrowBack: { + height: '30px', + verticalAlign: 'bottom', + cursor: 'pointer', + }, + rightInputs: { + marginTop: 134, + }, + button: { + marginRight: 20 + }, + inputGrid: { + marginTop: '30px', + padding: theme.spacing(1, 0, 0, 2) + } +})) + +interface OwnProps extends RouteComponentProps { +} + +type Props = OwnProps; + +const CheckInPointForm: FunctionComponent = (props) => { + const classes = useStyles() + + const dispatch = useDispatch() + + const { + checkInPoints, + currentCheckInPoint, + checkInPointsById, + error + } = useSelector((state: RootState) => state.checkinpoints) + + const { + sitename, + device, + checkinpoint, + } = currentCheckInPoint + const inputState = currentCheckInPoint; + + const setInputState = (checkInPoint: any) => { + dispatch(setCurrentCheckInPoint(checkInPoint)); + } + + // const id = props.match.params.checkInPointId + // // debugger; + // useEffect(() => { + // // if (checkInPointsById[id]) { + // // const tempId = checkInPointsById[id] + // // //setInputState(tempId) + // // dispatch(setCurrentCheckInPoint(tempId)); + // // } + // }, [id]) + + const handleChange = (e: any) => setInputState({ + ...inputState, + [e.target.name]: e.target.value + }) + + const handleSubmit = async (e: any) => { + e.preventDefault() + dispatch(saveCheckInPoint(JSON.stringify({ + "sitename": sitename, + "device": device, + "checkinpoint": checkinpoint + }), () => setInputState(defaultInputState))) + } + + + return ( + + +
+
+ props.history.push('/checkInPoints')} /> + CheckInPoint details +
+ + + Save + + + + + {/*
*/} + + + + + + + + + + + + ); +}; + +export default CheckInPointForm; diff --git a/src/features/SalesAndOrganisation/CheckInPointsView.tsx b/src/features/SalesAndOrganisation/CheckInPointsView.tsx index 0462679..50028ad 100644 --- a/src/features/SalesAndOrganisation/CheckInPointsView.tsx +++ b/src/features/SalesAndOrganisation/CheckInPointsView.tsx @@ -8,6 +8,7 @@ import { CustomMenuItem } from 'components/CustomMenuItem'; import { useDispatch, useSelector } from 'react-redux'; import { RootState } from 'app/rootReducer'; import { fetchCheckInPoints } from './checkInPointSlice'; +import CustomButton from 'components/Button'; interface OwnProps {} @@ -86,14 +87,19 @@ const CheckInPointsView: FunctionComponent = (props) => { }, [dispatch]) return ( - + - + + + + Add Checkin point + + - + ); diff --git a/src/features/SalesAndOrganisation/checkInPointSlice.ts b/src/features/SalesAndOrganisation/checkInPointSlice.ts index 20fe4ff..1aaebe9 100644 --- a/src/features/SalesAndOrganisation/checkInPointSlice.ts +++ b/src/features/SalesAndOrganisation/checkInPointSlice.ts @@ -1,8 +1,9 @@ import { createSlice, PayloadAction } from '@reduxjs/toolkit' import { Links } from 'parse-link-header' -import { getCheckInPointsData } from 'api/Apis' +import { createCheckInPoint, getCheckInPointsData } from 'api/Apis' import { AppThunk } from 'app/store' +import { getBackdropStart, getBackdropStop } from 'app/BackdropSlice' export interface CheckInPoint { @@ -16,6 +17,16 @@ export interface CheckInPointsResult { pageCount: number checkInPoints: CheckInPoint[] } +export interface CheckInPointInputState { + sitename: string + device: string + checkinpoint: string +} +export const defaultInputState: CheckInPointInputState = { + sitename: '', + device: '', + checkinpoint: '', +} interface CheckInPointState { checkInPoints: CheckInPoint[] @@ -25,6 +36,8 @@ interface CheckInPointState { pageLinks: Links | null isLoading: boolean error: string | null + currentCheckInPoint: CheckInPointInputState + } const checkInPointsInitialState: CheckInPointState = { @@ -34,7 +47,8 @@ const checkInPointsInitialState: CheckInPointState = { pageCount: 0, pageLinks: {}, isLoading: false, - error: null + error: null, + currentCheckInPoint: defaultInputState } function startLoading(state: CheckInPointState) { @@ -62,13 +76,17 @@ const checkInPoint = createSlice({ state.checkInPoints.map(checkInPoint => (state.checkInPointsById[checkInPoint.checkInPoint_id] = checkInPoint)) }, getCheckInPointsFailure: loadingFailed, + setCurrentCheckInPoint(state, { payload }: PayloadAction) { + state.currentCheckInPoint = payload + } } }) export const { getCheckInPointsStart, getCheckInPointsSuccess, - getCheckInPointsFailure + getCheckInPointsFailure, + setCurrentCheckInPoint } = checkInPoint.actions export default checkInPoint.reducer @@ -87,3 +105,18 @@ export const fetchCheckInPoints = ( } } +export const saveCheckInPoint = ( + site: any, + callback?: (() => void) +): AppThunk => async dispatch => { + try { + dispatch(getBackdropStart()) + await createCheckInPoint(site) + .then(() => dispatch(getBackdropStop())).catch(() => dispatch(getBackdropStop())) + //return setInputState(defaultInputState) + callback && callback(); + //dispatch(saveInvitesSuccess(invites)) + } catch (err) { + dispatch(getBackdropStop()) + } +} From 51e7ddb5ab9f0d6e199d3a577a95cfd88ac58bb1 Mon Sep 17 00:00:00 2001 From: yadneshgharat Date: Tue, 29 Sep 2020 00:35:49 +0530 Subject: [PATCH 07/69] purpose commit --- src/api/Apis.tsx | 13 +++++++++++++ src/features/Home/HomeView.tsx | 9 +++++++-- src/features/Home/visitorSlice.ts | 21 +++++++++++++++++---- 3 files changed, 37 insertions(+), 6 deletions(-) diff --git a/src/api/Apis.tsx b/src/api/Apis.tsx index 53cc2ae..5a9ec93 100644 --- a/src/api/Apis.tsx +++ b/src/api/Apis.tsx @@ -226,6 +226,19 @@ export async function getDevicesData(page:number=0,count:number=10) { } +export async function getPurpose(page:number=0,count:number=10) { + const url = `/product/reception/meeting/purpose/data?page=${page}&count=${count}` + + const { data } = await apis.get(url) + // debugger + return { + //pageLinks: '', + pageCount: data.totalCount || 20, + purpose: data.data + } + +} + export async function getUsersData() { const url = `/product/device/data?page=0&count=10` diff --git a/src/features/Home/HomeView.tsx b/src/features/Home/HomeView.tsx index 02654ca..1592e4f 100644 --- a/src/features/Home/HomeView.tsx +++ b/src/features/Home/HomeView.tsx @@ -161,9 +161,14 @@ const HomeView: FunctionComponent = (props) => { pageCount, pageLinks, isLoading: isLoadingVisitor, - error + error, + purpose } = useSelector((state: RootState) => state.visitors) + const { + sites + } = useSelector((state: RootState) => state.sites) + const { checked_out, in_office, @@ -269,7 +274,7 @@ const HomeView: FunctionComponent = (props) => { - + ({title:item}))} value="All Purpose" /> diff --git a/src/features/Home/visitorSlice.ts b/src/features/Home/visitorSlice.ts index 42dffed..4f21c5a 100644 --- a/src/features/Home/visitorSlice.ts +++ b/src/features/Home/visitorSlice.ts @@ -1,8 +1,9 @@ import { createSlice, PayloadAction } from '@reduxjs/toolkit' import { Links } from 'parse-link-header' -import { VisitorsResult, getVisitorInfo, getVisitorData } from 'api/Apis' +import { VisitorsResult, getVisitorInfo, getVisitorData, getPurpose } from 'api/Apis' import { AppThunk } from 'app/store' +import { fetchSites } from 'features/SalesAndOrganisation/siteSlice' export interface VisitorInfo { answer1: any, @@ -77,6 +78,8 @@ interface VisitorState { pageLinks: Links | null isLoading: boolean error: string | null + purpose: any[], + filter:any } const visitorsInitialState: VisitorState = { @@ -87,7 +90,9 @@ const visitorsInitialState: VisitorState = { pageCount: 0, pageLinks: {}, isLoading: false, - error: null + error: null, + purpose: [], + filter:{} } function startLoading(state: VisitorState) { @@ -115,6 +120,10 @@ const visitors = createSlice({ state.visitors.map(visitor => (state.visitorsById[visitor.checkin_id] = visitor)) //state.visitorsById = state.visitors.map(visitor => ({ ...visitor, id: visitor.id })) }, + getPurposeSuccess(state,{payload}: PayloadAction){ + const { purpose } = payload + state.purpose = purpose + }, getVisitorsFailure: loadingFailed, setCurrentVisitor(state, { payload }: PayloadAction) { state.currentVisitor = payload @@ -126,7 +135,8 @@ export const { getVisitorsStart, getVisitorsSuccess, getVisitorsFailure, - setCurrentVisitor + setCurrentVisitor, + getPurposeSuccess } = visitors.actions export default visitors.reducer @@ -136,10 +146,13 @@ export const fetchVisitors = ( , count?: number ): AppThunk => async dispatch => { try { + dispatch(fetchSites()) dispatch(getVisitorsStart()) const visitors = await getVisitorData(page,count) - dispatch(getVisitorsSuccess(visitors)) + + const purpose = await getPurpose() + dispatch(getPurposeSuccess(purpose)) } catch (err) { dispatch(getVisitorsFailure(err.toString())) } From 60886934ac23673a545d4e1c8933b96579a1425d Mon Sep 17 00:00:00 2001 From: archisbhoir Date: Tue, 29 Sep 2020 00:35:55 +0530 Subject: [PATCH 08/69] reverted checkbox --- src/components/CheckBoxComponent.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/CheckBoxComponent.tsx b/src/components/CheckBoxComponent.tsx index 66063d8..abe0d64 100644 --- a/src/components/CheckBoxComponent.tsx +++ b/src/components/CheckBoxComponent.tsx @@ -11,6 +11,6 @@ type CheckBoxComponentProps = { export const CheckBoxComponent: FunctionComponent = ({isChecked, handleChange, title}) => } + control={} label={title} /> \ No newline at end of file From 94159857fbe23cd1d31364824f6e714f5395797d Mon Sep 17 00:00:00 2001 From: yadneshgharat Date: Tue, 29 Sep 2020 00:59:37 +0530 Subject: [PATCH 09/69] filter --- src/api/Apis.tsx | 13 +++++++++++++ src/components/SearchInput.tsx | 2 +- src/features/Home/HomeView.tsx | 19 +++++++++---------- src/features/Home/visitorSlice.ts | 18 +++++++++++++++++- 4 files changed, 40 insertions(+), 12 deletions(-) diff --git a/src/api/Apis.tsx b/src/api/Apis.tsx index add881e..0c71928 100644 --- a/src/api/Apis.tsx +++ b/src/api/Apis.tsx @@ -129,6 +129,19 @@ export async function getVisitorData(page:number=0,count:number=10) { // debugger } +export async function getInOfficeVisitorData(page:number=0,count:number=10) { + const url = `/product/reception/checkin/user/data?page=${page}&count=${count}` + + const { data } = await apis.get(url) + // debugger + return { + //pageLinks: '', + pageCount: data.totalCount, + visitors: data.data + } + // debugger +} + export async function getVisitorInfo() { const url = `` diff --git a/src/components/SearchInput.tsx b/src/components/SearchInput.tsx index e019c82..ca817bd 100644 --- a/src/components/SearchInput.tsx +++ b/src/components/SearchInput.tsx @@ -1,5 +1,5 @@ import React, { FunctionComponent } from 'react'; -import {Box, createStyles, fade, InputBase, Paper, Theme} from "@material-ui/core"; +import {Box, createStyles, fade, InputBase, InputBaseProps, Paper, Theme} from "@material-ui/core"; import SearchIcon from "@material-ui/icons/Search"; import {makeStyles} from "@material-ui/core/styles"; diff --git a/src/features/Home/HomeView.tsx b/src/features/Home/HomeView.tsx index 05d9195..27d7771 100644 --- a/src/features/Home/HomeView.tsx +++ b/src/features/Home/HomeView.tsx @@ -26,7 +26,7 @@ import TableWrapper from "components/TableWrapper"; import SearchInput from "components/SearchInput"; import SelectInput from "components/SelectInput"; import { useSelector, useDispatch } from 'react-redux'; -import { fetchVisitors } from 'features/Home/visitorSlice' +import { fetchInOfficeVisitors, fetchVisitors } from 'features/Home/visitorSlice' import { fetchHomeStats } from 'features/Home/homeSlice' import { RootState } from 'app/rootReducer' import { MyChart2 } from 'components/Chart' @@ -171,7 +171,8 @@ const HomeView: FunctionComponent = (props) => { pageLinks, isLoading: isLoadingVisitor, error, - purpose + purpose, + filter } = useSelector((state: RootState) => state.visitors) const { @@ -231,10 +232,7 @@ const HomeView: FunctionComponent = (props) => { callback: handleCheckOut, item: (id: any) => { - return ( { - - } - }> + return ( {'Check Out'} ) } @@ -281,14 +279,15 @@ const HomeView: FunctionComponent = (props) => { - + {/* */} - - ({title:item}))} value="All Purpose" /> - + ({title:item}))} defaultValue="All Purpose" value={filter.purpose||''}/> + diff --git a/src/features/Home/visitorSlice.ts b/src/features/Home/visitorSlice.ts index 4f21c5a..9752532 100644 --- a/src/features/Home/visitorSlice.ts +++ b/src/features/Home/visitorSlice.ts @@ -1,7 +1,7 @@ import { createSlice, PayloadAction } from '@reduxjs/toolkit' import { Links } from 'parse-link-header' -import { VisitorsResult, getVisitorInfo, getVisitorData, getPurpose } from 'api/Apis' +import { VisitorsResult, getVisitorInfo, getVisitorData, getPurpose, getInOfficeVisitorData } from 'api/Apis' import { AppThunk } from 'app/store' import { fetchSites } from 'features/SalesAndOrganisation/siteSlice' @@ -158,4 +158,20 @@ export const fetchVisitors = ( } } +export const fetchInOfficeVisitors = ( + page?: number + , count?: number +): AppThunk => async dispatch => { + try { + dispatch(fetchSites()) + dispatch(getVisitorsStart()) + const visitors = await getInOfficeVisitorData() + dispatch(getVisitorsSuccess(visitors)) + + const purpose = await getPurpose() + dispatch(getPurposeSuccess(purpose)) + } catch (err) { + dispatch(getVisitorsFailure(err.toString())) + } +} From 01b8650fdc0a0d338f21b117533a20a47123ec19 Mon Sep 17 00:00:00 2001 From: archisbhoir Date: Tue, 29 Sep 2020 01:13:50 +0530 Subject: [PATCH 10/69] value and onChange --- src/components/SearchInput.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/SearchInput.tsx b/src/components/SearchInput.tsx index e019c82..40e316e 100644 --- a/src/components/SearchInput.tsx +++ b/src/components/SearchInput.tsx @@ -1,5 +1,5 @@ import React, { FunctionComponent } from 'react'; -import {Box, createStyles, fade, InputBase, Paper, Theme} from "@material-ui/core"; +import {Box, createStyles, fade, InputBase, InputBaseProps, Paper, Theme} from "@material-ui/core"; import SearchIcon from "@material-ui/icons/Search"; import {makeStyles} from "@material-ui/core/styles"; @@ -9,7 +9,7 @@ interface OwnProps extends React.HTMLAttributes { height?: number } -type Props = OwnProps; +type Props = OwnProps & InputBaseProps; const useStyles = makeStyles((theme: Theme) => createStyles({ @@ -76,6 +76,8 @@ const SearchInput: FunctionComponent = (props) => {
Date: Tue, 29 Sep 2020 02:24:27 +0530 Subject: [PATCH 11/69] home filters --- src/api/Apis.tsx | 6 +++--- src/components/SelectInput.tsx | 9 +++++++-- src/features/Home/HomeView.tsx | 31 +++++++++++++++++++++++-------- src/features/Home/visitorSlice.ts | 19 +++++++++++++------ 4 files changed, 46 insertions(+), 19 deletions(-) diff --git a/src/api/Apis.tsx b/src/api/Apis.tsx index 0c71928..bf7b675 100644 --- a/src/api/Apis.tsx +++ b/src/api/Apis.tsx @@ -116,8 +116,8 @@ interface VisitorModel { "vehicleno": any//"vehicleno" } -export async function getVisitorData(page:number=0,count:number=10) { - const url = `/product/reception/checkin/user/data?page=${page}&count=${count}` +export async function getVisitorData(page:number=0,count:number=10,visitor:String = '',purpose:String = '', site:String='') { + const url = `/product/reception/checkin/user/data?page=${page}&count=${count}&visitor=${visitor}&purpose=${purpose}&site=${site}` const { data } = await apis.get(url) // debugger @@ -130,7 +130,7 @@ export async function getVisitorData(page:number=0,count:number=10) { } export async function getInOfficeVisitorData(page:number=0,count:number=10) { - const url = `/product/reception/checkin/user/data?page=${page}&count=${count}` + const url = `/product/reception/checkin/in/user/data?page=${page}&count=${count}` const { data } = await apis.get(url) // debugger diff --git a/src/components/SelectInput.tsx b/src/components/SelectInput.tsx index 07cac9c..04f2995 100644 --- a/src/components/SelectInput.tsx +++ b/src/components/SelectInput.tsx @@ -111,6 +111,7 @@ const SelectInput: FunctionComponent = (props) => { labelId="demo-simple-select-label" IconComponent={() => } disableUnderline + onChange={props.onChange} className={classes.inputRoot} style={{ borderBottom: 'none', @@ -134,8 +135,12 @@ const SelectInput: FunctionComponent = (props) => { }} > { - props.menuOptions ? props.menuOptions.map(item => {item.title}) : 1 + props.menuOptions ? [ + {props.defaultValue} + ,...props.menuOptions.map(item => {item.title})] : 1 }
diff --git a/src/features/Home/HomeView.tsx b/src/features/Home/HomeView.tsx index d9f8a5c..a4e788f 100644 --- a/src/features/Home/HomeView.tsx +++ b/src/features/Home/HomeView.tsx @@ -26,7 +26,7 @@ import TableWrapper from "components/TableWrapper"; import SearchInput from "components/SearchInput"; import SelectInput from "components/SelectInput"; import { useSelector, useDispatch } from 'react-redux'; -import { fetchInOfficeVisitors, fetchVisitors } from 'features/Home/visitorSlice' +import { fetchInOfficeVisitors, fetchVisitors, setFilter } from 'features/Home/visitorSlice' import { fetchHomeStats } from 'features/Home/homeSlice' import { RootState } from 'app/rootReducer' import { MyChart2 } from 'components/Chart' @@ -118,11 +118,24 @@ const HomeView: FunctionComponent = (props) => { const classes = useStyles() const [anchorEl, setAnchorEl] = useState(null); - + const [filter,setFilter]=useState({visitor:"",purpose:"",site:""}) const handleClick = (event: React.MouseEvent) => { setAnchorEl(event.currentTarget); }; + + const handleFilterChange= (f:any)=>{ + debugger; + const newFilter = {...filter,...f} + setFilter(newFilter) + const { + purpose:purpose1, + site:site1, + visitor:visitor1 + } = newFilter + + dispatch(fetchVisitors(0,pageCount,visitor1,purpose1,site1)) + } const handleClose = () => { setAnchorEl(null); }; @@ -163,6 +176,9 @@ const HomeView: FunctionComponent = (props) => { const dispatch = useDispatch() + const { + sites + } = useSelector((state: RootState) => state.sites) const { visitors, currentPageVisitors, @@ -170,8 +186,7 @@ const HomeView: FunctionComponent = (props) => { pageLinks, isLoading: isLoadingVisitor, error, - purpose, - filter + purpose } = useSelector((state: RootState) => state.visitors) const { @@ -274,15 +289,15 @@ const HomeView: FunctionComponent = (props) => { - + {debugger;handleFilterChange({visitor:e.target.value})}} value = {filter.visitor} placeholder="Search visitor" /> {/* */} - - ({title:item}))} defaultValue="All Purpose" value={filter.purpose||''}/> - + {debugger; handleFilterChange({purpose:e.target.value})}} menuOptions={purpose.map(item=>({title:item}))} defaultValue="All Purpose" value={filter.purpose}/> + {debugger; handleFilterChange({site:e.target.value})}} menuOptions={sites.map(item=>({title:item.sitename}))} defaultValue ="All Sites" value={filter.site}/> diff --git a/src/features/Home/visitorSlice.ts b/src/features/Home/visitorSlice.ts index 9752532..8c818b1 100644 --- a/src/features/Home/visitorSlice.ts +++ b/src/features/Home/visitorSlice.ts @@ -92,7 +92,7 @@ const visitorsInitialState: VisitorState = { isLoading: false, error: null, purpose: [], - filter:{} + filter:{visitor:"",purpose:"All Purpose",site:"All Sites"} } function startLoading(state: VisitorState) { @@ -127,6 +127,9 @@ const visitors = createSlice({ getVisitorsFailure: loadingFailed, setCurrentVisitor(state, { payload }: PayloadAction) { state.currentVisitor = payload + }, + setFilter(state,{payload}: PayloadAction){ + state.filter = {...state.filter, ...payload} } } }) @@ -136,23 +139,27 @@ export const { getVisitorsSuccess, getVisitorsFailure, setCurrentVisitor, - getPurposeSuccess + getPurposeSuccess, + setFilter } = visitors.actions export default visitors.reducer export const fetchVisitors = ( page?: number - , count?: number + , count?: number, + visitor?: string, + purpose?: string, + site?: string ): AppThunk => async dispatch => { try { dispatch(fetchSites()) dispatch(getVisitorsStart()) - const visitors = await getVisitorData(page,count) + const visitors = await getVisitorData(page,count,visitor,purpose,site) dispatch(getVisitorsSuccess(visitors)) - const purpose = await getPurpose() - dispatch(getPurposeSuccess(purpose)) + const pur = await getPurpose() + dispatch(getPurposeSuccess(pur)) } catch (err) { dispatch(getVisitorsFailure(err.toString())) } From 35289fb25c2b141b7bcbcf3ce0e3f4aad034e263 Mon Sep 17 00:00:00 2001 From: yadneshgharat Date: Tue, 29 Sep 2020 09:29:44 +0530 Subject: [PATCH 12/69] filter --- src/api/Apis.tsx | 44 ++++++++++---------------- src/features/Home/HomeView.tsx | 7 ++++- src/features/Home/visitorSlice.ts | 2 +- src/features/Invites/InviteView.tsx | 48 +++++++++++++++++++++++------ src/features/Invites/inviteSlice.ts | 32 +++++++++++++++++-- 5 files changed, 91 insertions(+), 42 deletions(-) diff --git a/src/api/Apis.tsx b/src/api/Apis.tsx index bf7b675..dce2cb6 100644 --- a/src/api/Apis.tsx +++ b/src/api/Apis.tsx @@ -142,32 +142,6 @@ export async function getInOfficeVisitorData(page:number=0,count:number=10) { // debugger } -export async function getVisitorInfo() { - const url = `` - - //const { data } = await apis.post(url) - const sample = { - avatar: '', - name: 'Vijaya Tondon from API', - mobileNo: 9754821630, - personToMeet: 'Ramesh Chawla', - purpose: 'Meeting', - inTime: '11:30 am', - outTime: '2:30 pm', - } - let data = [] - for (let i = 0; i < 10; i++) { - let copy: any = sample - - data.push(copy) - } - return { - //pageLinks: '', - pageCount: 1, - visitors: data - } -} - export async function getHomeStats() { const url = `/product/stats/data?page=0&count=10` @@ -175,8 +149,8 @@ export async function getHomeStats() { return data } -export async function getInvitesData(page:number=0,count:number=10) { - const url = `/product/reception/invite/user/data?page=${page}&count=${count}` +export async function getInvitesData(page:number=0,count:number=10,visitor:String = '',purpose:String = '', site:String='') { + const url = `/product/reception/invite/user/data?page=${page}&count=${count}&visitor=${visitor}&purpose=${purpose}&site=${site}` const { data } = await apis.get(url) @@ -188,6 +162,20 @@ export async function getInvitesData(page:number=0,count:number=10) { } +export async function getInOfficeInviteData(page:number=0,count:number=10) { + const url = `/product/reception/checkin/in/user/data?page=${page}&count=${count}` + + const { data } = await apis.get(url) + // debugger + return { + //pageLinks: '', + pageCount: data.totalCount, + invites: data.data + } + // debugger +} + + export async function getEmployeesData(page:number=0,count:number=10) { const url = `/product/reception/checkin/user/data?page=${page}&count=${count}` diff --git a/src/features/Home/HomeView.tsx b/src/features/Home/HomeView.tsx index a4e788f..16e9706 100644 --- a/src/features/Home/HomeView.tsx +++ b/src/features/Home/HomeView.tsx @@ -234,7 +234,12 @@ const HomeView: FunctionComponent = (props) => { })), pagination:true, pageChange:(page:number,count:number)=>{ - dispatch(fetchVisitors(page,count)) + const { + purpose:purpose1, + site:site1, + visitor:visitor1 + } = filter + dispatch(fetchVisitors(page,count,visitor1,purpose1,site1)) }, totalCount:pageCount, menuOptions: [{ diff --git a/src/features/Home/visitorSlice.ts b/src/features/Home/visitorSlice.ts index 8c818b1..fc0e061 100644 --- a/src/features/Home/visitorSlice.ts +++ b/src/features/Home/visitorSlice.ts @@ -1,7 +1,7 @@ import { createSlice, PayloadAction } from '@reduxjs/toolkit' import { Links } from 'parse-link-header' -import { VisitorsResult, getVisitorInfo, getVisitorData, getPurpose, getInOfficeVisitorData } from 'api/Apis' +import { VisitorsResult, getVisitorData, getPurpose, getInOfficeVisitorData } from 'api/Apis' import { AppThunk } from 'app/store' import { fetchSites } from 'features/SalesAndOrganisation/siteSlice' diff --git a/src/features/Invites/InviteView.tsx b/src/features/Invites/InviteView.tsx index 8f3e45d..c10bb4f 100644 --- a/src/features/Invites/InviteView.tsx +++ b/src/features/Invites/InviteView.tsx @@ -25,7 +25,7 @@ import TableWrapper from "../../components/TableWrapper"; import SearchInput from "../../components/SearchInput"; import SelectInput from "../../components/SelectInput"; import { useSelector, useDispatch } from 'react-redux'; -import { fetchInvites } from 'features/Invites/inviteSlice' +import { fetchInOfficeInvites, fetchInvites } from 'features/Invites/inviteSlice' import { RootState } from 'app/rootReducer' import { CustomMenuItem } from 'components/CustomMenuItem'; import HomeDateDropdown from 'features/Home/HomeDateDropdown'; @@ -137,6 +137,7 @@ const InviteView: FunctionComponent = (props) => { const classes = useStyles() const [anchorEl, setAnchorEl] = useState(null); + const [filter,setFilter]=useState({visitor:"",purpose:"",site:""}) const handleClick = (event: React.MouseEvent) => { setAnchorEl(event.currentTarget); @@ -144,14 +145,16 @@ const InviteView: FunctionComponent = (props) => { const handleClose = () => { setAnchorEl(null); - }; - - let tableRows: any = [] - - + }; const dispatch = useDispatch() + const { + sites + } = useSelector((state: RootState) => state.sites) + const { + purpose + } = useSelector((state: RootState) => state.visitors) const { invites, currentPageInvites, @@ -193,6 +196,19 @@ const InviteView: FunctionComponent = (props) => { return {...visitor} } + const handleFilterChange= (f:any)=>{ + debugger; + const newFilter = {...filter,...f} + setFilter(newFilter) + const { + purpose:purpose1, + site:site1, + visitor:visitor1 + } = newFilter + + dispatch(fetchInvites(0,10,visitor1,purpose1,site1)) + } + const TableConfig = { columns: columns, data: invites.map(el => ({ @@ -202,7 +218,12 @@ const InviteView: FunctionComponent = (props) => { isLoading: isLoadingInvites, pagination: true, pageChange:(page:number,count:number)=>{ - dispatch(fetchInvites(page,count)) + const { + purpose:purpose1, + site:site1, + visitor:visitor1 + } = filter + dispatch(fetchInvites(page,count,visitor1,purpose1,site1)) }, totalCount:pageCount, menuOptions: [{ @@ -221,10 +242,19 @@ const InviteView: FunctionComponent = (props) => { - + {/* - + */} + {debugger;handleFilterChange({visitor:e.target.value})}} value = {filter.visitor} placeholder="Search visitor" /> + {/* */} + {/* */} + {debugger; handleFilterChange({purpose:e.target.value})}} menuOptions={purpose.map(item=>({title:item}))} defaultValue="All Purpose" value={filter.purpose}/> + {debugger; handleFilterChange({site:e.target.value})}} menuOptions={sites.map(item=>({title:item.sitename}))} defaultValue ="All Sites" value={filter.site}/>
diff --git a/src/features/Invites/inviteSlice.ts b/src/features/Invites/inviteSlice.ts index f599ee8..38d971a 100644 --- a/src/features/Invites/inviteSlice.ts +++ b/src/features/Invites/inviteSlice.ts @@ -1,9 +1,11 @@ import { createSlice, PayloadAction } from '@reduxjs/toolkit' import { Links } from 'parse-link-header' -import { getInvitesData, createInvite } from 'api/Apis' +import { getInvitesData, createInvite, getPurpose, getInOfficeInviteData } from 'api/Apis' import { AppThunk } from 'app/store' import {getBackdropStart, getBackdropStop} from 'app/BackdropSlice' +import { fetchSites } from 'features/SalesAndOrganisation/siteSlice' +import { getPurposeSuccess } from 'features/Home/visitorSlice' export interface Invite { @@ -80,13 +82,19 @@ export default invites.reducer export const fetchInvites = ( page?: number, - count?: number + count?: number, + visitor?: string, + purpose?: string, + site?: string ): AppThunk => async dispatch => { try { + dispatch(fetchSites()) dispatch(getInvitesStart()) - const invites = await getInvitesData(page,count) + const invites = await getInvitesData(page,count,visitor,purpose,site) dispatch(getInvitesSuccess(invites)) + const pur = await getPurpose() + dispatch(getPurposeSuccess(pur)) } catch (err) { dispatch(getInvitesFailure(err.toString())) } @@ -109,3 +117,21 @@ export const saveInvite = ( dispatch(getBackdropStop()) } } + + +export const fetchInOfficeInvites = ( + page?: number + , count?: number +): AppThunk => async dispatch => { + try { + dispatch(fetchSites()) + dispatch(getInvitesStart()) + const visitors = await getInOfficeInviteData() + dispatch(getInvitesSuccess(visitors)) + + const purpose = await getPurpose() + dispatch(getPurposeSuccess(purpose)) + } catch (err) { + dispatch(getInvitesFailure(err.toString())) + } +} From 072caaefb61c32cbb20a2c0664f40dfcbc20ee11 Mon Sep 17 00:00:00 2001 From: archisbhoir Date: Tue, 29 Sep 2020 10:15:53 +0530 Subject: [PATCH 13/69] select input fixed --- src/api/Apis.tsx | 2 +- src/components/SelectInput.tsx | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/api/Apis.tsx b/src/api/Apis.tsx index dce2cb6..fac7f60 100644 --- a/src/api/Apis.tsx +++ b/src/api/Apis.tsx @@ -4,7 +4,7 @@ import { VisitorInfo } from 'features/Home/visitorSlice'; export const apis = axios.create({ baseURL: 'http://52.66.55.89:18446', - timeout: 5000, + timeout: 10000, //headers: {'X-Custom-Header': 'foobar'} }); diff --git a/src/components/SelectInput.tsx b/src/components/SelectInput.tsx index 04f2995..575efb8 100644 --- a/src/components/SelectInput.tsx +++ b/src/components/SelectInput.tsx @@ -81,16 +81,21 @@ const useStyles = makeStyles((theme: Theme) => createStyles({ }, menuItem: { backgroundColor: theme.palette.common.white, + fontSize: '11.25px', }, menuPapaer: { backgroundColor: theme.palette.common.white, + fontSize: '11.25px', '& .MuiListItem-root.Mui-selected, & .MuiListItem-root.Mui-selected:hover': { backgroundColor: 'white !important', - padding: theme.spacing(0.5, 1) + padding: theme.spacing(0.5, 1), + fontSize: '11.25px', }, }, menuRoot: { // backgroundColor: theme.palette.common.white, + fontSize: '11.25px', + }, })) @@ -111,6 +116,7 @@ const SelectInput: FunctionComponent = (props) => { labelId="demo-simple-select-label" IconComponent={() => } disableUnderline + value='' onChange={props.onChange} className={classes.inputRoot} style={{ From 4d3a378fadaff3e7a354a0644d14c0c3b4f6298a Mon Sep 17 00:00:00 2001 From: yadneshgharat Date: Tue, 29 Sep 2020 10:34:33 +0530 Subject: [PATCH 14/69] bug --- src/components/SelectInput.tsx | 2 +- src/features/Home/HomeView.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/SelectInput.tsx b/src/components/SelectInput.tsx index 575efb8..e21c725 100644 --- a/src/components/SelectInput.tsx +++ b/src/components/SelectInput.tsx @@ -114,7 +114,7 @@ const SelectInput: FunctionComponent = (props) => { }}>{props.value} = (props) => { }} > { - props.menuOptions ? [ - {props.defaultValue} - ,...props.menuOptions.map(item => + {props.defaultValue} + , ...props.menuOptions.map(item => {item.title})] : 1 From 37a53358b939d2d6f77129ef4f26d4fdd6b0db4a Mon Sep 17 00:00:00 2001 From: yadneshgharat Date: Tue, 29 Sep 2020 11:31:49 +0530 Subject: [PATCH 17/69] page bug --- src/features/Home/HomeView.tsx | 4 +++- src/features/Invites/InviteView.tsx | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/features/Home/HomeView.tsx b/src/features/Home/HomeView.tsx index 4116391..2d41381 100644 --- a/src/features/Home/HomeView.tsx +++ b/src/features/Home/HomeView.tsx @@ -117,6 +117,7 @@ type Props = OwnProps; const HomeView: FunctionComponent = (props) => { const classes = useStyles() + const [rowPerPage,setRowPerPage] = useState(10); const [anchorEl, setAnchorEl] = useState(null); const [filter,setFilter]=useState({visitor:"",purpose:"",site:""}) const handleClick = (event: React.MouseEvent) => { @@ -134,7 +135,7 @@ const HomeView: FunctionComponent = (props) => { visitor:visitor1 } = newFilter - dispatch(fetchVisitors(0,pageCount,visitor1,purpose1,site1)) + dispatch(fetchVisitors(0,rowPerPage,visitor1,purpose1,site1)) } const handleClose = () => { setAnchorEl(null); @@ -239,6 +240,7 @@ const HomeView: FunctionComponent = (props) => { site:site1, visitor:visitor1 } = filter + setRowPerPage(count) dispatch(fetchVisitors(page,count,visitor1,purpose1,site1)) }, totalCount:pageCount, diff --git a/src/features/Invites/InviteView.tsx b/src/features/Invites/InviteView.tsx index c10bb4f..92bdcc9 100644 --- a/src/features/Invites/InviteView.tsx +++ b/src/features/Invites/InviteView.tsx @@ -138,6 +138,7 @@ const InviteView: FunctionComponent = (props) => { const [anchorEl, setAnchorEl] = useState(null); const [filter,setFilter]=useState({visitor:"",purpose:"",site:""}) + const [rowPerPage,setRowPerPage] = useState(10); const handleClick = (event: React.MouseEvent) => { setAnchorEl(event.currentTarget); @@ -206,7 +207,7 @@ const InviteView: FunctionComponent = (props) => { visitor:visitor1 } = newFilter - dispatch(fetchInvites(0,10,visitor1,purpose1,site1)) + dispatch(fetchInvites(0,rowPerPage,visitor1,purpose1,site1)) } const TableConfig = { @@ -223,6 +224,7 @@ const InviteView: FunctionComponent = (props) => { site:site1, visitor:visitor1 } = filter + setRowPerPage(count) dispatch(fetchInvites(page,count,visitor1,purpose1,site1)) }, totalCount:pageCount, From aef43082afe99e20f9ed5092be9adaebe2ba4d31 Mon Sep 17 00:00:00 2001 From: yadneshgharat Date: Tue, 29 Sep 2020 14:06:47 +0530 Subject: [PATCH 18/69] bug --- src/components/SelectInput.tsx | 105 ++++++++++++++++++--------------- 1 file changed, 58 insertions(+), 47 deletions(-) diff --git a/src/components/SelectInput.tsx b/src/components/SelectInput.tsx index f12b06b..eded7b6 100644 --- a/src/components/SelectInput.tsx +++ b/src/components/SelectInput.tsx @@ -18,40 +18,49 @@ interface OwnProps extends React.HTMLAttributes { type Props = OwnProps; const useStyles = makeStyles((theme: Theme) => createStyles({ + root: { + backgroundColor: '#fff', + fontSize: '11.25px', + position: 'absolute', + //top: '15px', + //left: '15px' + height:25, + color: theme.palette.text.primary, + }, inputContainer: { // padding: (props: Props) => props.padding ? props.padding : 15, marginRight: 20, - '& .MuiButtonBase-root.MuiListItem-root.MuiMenuItem-root.Mui-selected.MuiMenuItem-gutters.MuiListItem-gutters.MuiListItem-button.Mui-selected': { - backgroundColor: '#fff', - }, - '& .MuiInputBase-root.MuiInput-root, & .MuiSelect-select.MuiSelect-select, & .MuiSelect-nativeInput': { - height: 'inherit' - }, - '& .MuiSelect-select.MuiSelect-select': { - padding: 0, - borderRadius: theme.shape.borderRadius - 5, - }, - '& .MuiListItem-root.Mui-selected, & .MuiListItem-root.Mui-selected:hover': { - backgroundColor: 'white !important', - padding: 0 - }, + // '& .MuiButtonBase-root.MuiListItem-root.MuiMenuItem-root.Mui-selected.MuiMenuItem-gutters.MuiListItem-gutters.MuiListItem-button.Mui-selected': { + // backgroundColor: '#fff', + // }, + // '& .MuiInputBase-root.MuiInput-root, & .MuiSelect-select.MuiSelect-select, & .MuiSelect-nativeInput': { + // height: 'inherit' + // }, + // '& .MuiSelect-select.MuiSelect-select': { + // padding: 0, + // borderRadius: theme.shape.borderRadius - 5, + // }, + // '& .MuiListItem-root.Mui-selected, & .MuiListItem-root.Mui-selected:hover': { + // backgroundColor: 'white !important', + // padding: 0 + // }, // '& .makeStyles-inputRoot-46': { // backgroundColor: theme.palette.common.white, // '&:hover': { // backgroundColor: theme.palette.common.white, // }, // }, - '& .MuiSelect-root, & .MuiSelect-select, & .MuiSelect-selectMenu, & .MuiInputBase-input, & .MuiInput-input': { - opacity: 1, - color: theme.palette.text.primary, - }, - '& .MuiFormLabel-root, & .MuiInputLabel-root, & .MuiInputLabel-animated': { - fontSize: '11.25px', - position: 'absolute', - top: '15px', - left: '15px', - color: theme.palette.text.primary, - } + // '& .MuiSelect-root, & .MuiSelect-select, & .MuiSelect-selectMenu, & .MuiInputBase-input, & .MuiInput-input': { + // opacity: 1, + // color: theme.palette.text.primary, + // }, + // '& .MuiFormLabel-root, & .MuiInputLabel-root, & .MuiInputLabel-animated': { + // fontSize: '11.25px', + // position: 'absolute', + // top: '15px', + // left: '15px', + // color: theme.palette.text.primary, + // } }, nativeInput: { fontSize: '11.25px', @@ -59,19 +68,21 @@ const useStyles = makeStyles((theme: Theme) => createStyles({ top: '15px', left: '15px', alignItems: 'center', - paddingTop:'25px!important', + paddingTop: '25px!important', color: theme.palette.text.primary, }, select: { + //padding: 0, + //borderRadius: theme.shape.borderRadius - 5, position: 'relative', borderRadius: theme.shape.borderRadius - 5, backgroundColor: theme.palette.common.white, '&:hover': { backgroundColor: theme.palette.common.white, }, - width: '135px', - height: '40px', - // padding: '12px' + width: 135, + //height: 40, + //paddingTop: 12, '& .MuiSvgIcon-root': { position: 'absolute', top: '7px', @@ -88,31 +99,30 @@ const useStyles = makeStyles((theme: Theme) => createStyles({ // backgroundColor: theme.palette.common.white, // }, }, - menuItem: { + +})) + +const useMenuStyles = makeStyles((theme: Theme) => createStyles({ + root: { backgroundColor: theme.palette.common.white, + padding: theme.spacing(0.5, 1), fontSize: '11.25px', }, - menuPapaer: { + selected: { backgroundColor: theme.palette.common.white, + padding: theme.spacing(0.5, 1), fontSize: '11.25px', - '& .MuiListItem-root.Mui-selected, & .MuiListItem-root.Mui-selected:hover': { - backgroundColor: 'white !important', - padding: theme.spacing(0.5, 1), - fontSize: '11.25px', - }, }, - menuRoot: { - // backgroundColor: theme.palette.common.white, - fontSize: '11.25px', - }, -})) +} +)) const SelectInput: FunctionComponent = (props) => { const classes = useStyles(props) + const menuClasses = useMenuStyles() return (
-
+
{/* = (props) => { // justifyContent: 'center', }}>{props.value} */}