Commit 9e76e025 authored by Sachintha Nipun M.M. it19046594's avatar Sachintha Nipun M.M. it19046594

Merge branch 'IT19046594' into 'master'

It19046594

See merge request !23
parents 0ba23d9e df860b1c
...@@ -138,22 +138,24 @@ const createUser = async (req, res) => { ...@@ -138,22 +138,24 @@ const createUser = async (req, res) => {
transporter.sendMail(mailOptions, function (error, info) { transporter.sendMail(mailOptions, function (error, info) {
if (error) { if (error) {
console.log("error", error) console.log("error", error)
res.status(500).send(error);
} else { } else {
console.log("Verification email is sent to your account") console.log("Verification email is sent to your email address")
console.log(data);
res.status(200).send({ data: data, message: "Verification email is sent to your email address" });
} }
}) })
console.log(data);
res.status(200).send(data);
} catch (err) { } catch (err) {
console.log(err); console.log(err);
res.send(err); res.status(500).send(err);
} }
}); });
}); });
} else { } else {
res.send({ message: "User Already Exist" }); res.status(500).send({ message: "User Already Exist" });
} }
} }
}); });
...@@ -194,7 +196,7 @@ const createGoogleUser = async (req, res) => { ...@@ -194,7 +196,7 @@ const createGoogleUser = async (req, res) => {
}); });
}); });
} else { } else {
res.send({ message: "User Already Exist" }); res.status(500).send({ message: "User Already Exist" });
} }
} }
}); });
...@@ -206,31 +208,31 @@ const validateUser = async (req, res) => { ...@@ -206,31 +208,31 @@ const validateUser = async (req, res) => {
console.log(req); console.log(req);
let user = await User.findOne({ email: req.body.email }, (err, user) => { let user = await User.findOne({ email: req.body.email }, (err, user) => {
if (!user.isVerified) {
return res.status(400).send("Please Verify your E-mail Address");
}
if (err) { if (err) {
console.log(err); console.log(err);
res.status(500).send(err); res.status(500).send(err);
} else { } else {
if (user == null) return res.status(500).send("User Not Found"); if (user == null) return res.status(500).send({ message: "User Not Found" });
else { else {
if (!user.isVerified) {
return res.status(400).send({ message: "Please Verify your E-mail Address" });
bcrypt.compare(req.body.password, user.password, function (err, result) { } else {
if (result) { bcrypt.compare(req.body.password, user.password, function (err, result) {
const token = jwt.sign({ if (result) {
email: user.email, const token = jwt.sign({
fullName: user.fullName, email: user.email,
}, process.env.JWT_SECRET) fullName: user.fullName,
}, process.env.JWT_SECRET)
res.status(200).send({ user: token });
} else { res.status(200).send({ user: token });
console.log("Credentials Does Not Matched"); } else {
res.status(500).send("Credentials Does Not Matched"); console.log("Credentials Does Not Matched");
} res.status(500).send({ message: "Credentials Does Not Matched" });
}); }
});
}
} }
...@@ -294,7 +296,7 @@ const verifyEmail = async (req, res) => { ...@@ -294,7 +296,7 @@ const verifyEmail = async (req, res) => {
user.emailToken = null user.emailToken = null
user.isVerified = true user.isVerified = true
await user.save() await user.save()
res.status(200).redirect('http://localhost:3000/signIn'); res.status(200).redirect('http://localhost:3000/signIn');
} }
else { else {
......
This diff is collapsed.
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
"chart.js": "^3.9.1", "chart.js": "^3.9.1",
"export-to-csv-file": "^0.2.2", "export-to-csv-file": "^0.2.2",
"gapi-script": "^1.2.0", "gapi-script": "^1.2.0",
"jspdf": "^2.5.1",
"jwt-decode": "^3.1.2", "jwt-decode": "^3.1.2",
"mdb-react-ui-kit": "^4.2.0", "mdb-react-ui-kit": "^4.2.0",
"react": "^18.1.0", "react": "^18.1.0",
......
...@@ -30,6 +30,15 @@ import API from '../../api'; ...@@ -30,6 +30,15 @@ import API from '../../api';
import jwt_decode from "jwt-decode"; import jwt_decode from "jwt-decode";
import { useSelector, useDispatch } from 'react-redux'; import { useSelector, useDispatch } from 'react-redux';
import { login } from '../../features/user'; import { login } from '../../features/user';
import Snackbar from '@mui/material/Snackbar';
import MuiAlert, { AlertProps } from '@mui/material/Alert';
const Alert = React.forwardRef(function Alert(
props,
ref,
) {
return <MuiAlert elevation={6} ref={ref} variant="filled" {...props} />;
});
const FacebookButton = styled(Button)(() => ({ const FacebookButton = styled(Button)(() => ({
transitionProperty: "box-shadow", transitionProperty: "box-shadow",
...@@ -135,6 +144,8 @@ export default function SignIn() { ...@@ -135,6 +144,8 @@ export default function SignIn() {
const dispatch = useDispatch(); const dispatch = useDispatch();
const userDetails = useSelector((state) => state.user) const userDetails = useSelector((state) => state.user)
const clientId = '380810221970-6p2h323ibdoknuaddgrb432skkdm157o.apps.googleusercontent.com' const clientId = '380810221970-6p2h323ibdoknuaddgrb432skkdm157o.apps.googleusercontent.com'
const [error, setError] = React.useState(false);
const [errorMsg, setErrorMsg] = React.useState("Error");
useEffect(() => { useEffect(() => {
console.log("userDetails", userDetails); console.log("userDetails", userDetails);
...@@ -156,6 +167,16 @@ export default function SignIn() { ...@@ -156,6 +167,16 @@ export default function SignIn() {
console.log("FB", response); console.log("FB", response);
} }
const handleError = () => {
setError(true);
};
const handleCloseError = (event, reason) => {
if (reason === 'clickaway') {
return;
}
setError(false);
}
const onSuccess = (res) => { const onSuccess = (res) => {
console.log("LOGIN SUCCESS!", res.profileObj) console.log("LOGIN SUCCESS!", res.profileObj)
...@@ -187,11 +208,15 @@ export default function SignIn() { ...@@ -187,11 +208,15 @@ export default function SignIn() {
}) })
.catch(function (error) { .catch(function (error) {
console.log(error); console.log(error);
setErrorMsg(error.response.data.message)
handleError()
}); });
}) })
.catch(function (error) { .catch(function (error) {
console.log(error); console.log(error);
setErrorMsg(error.response.data.message)
handleError()
}); });
} else { } else {
API.post('user/validate', body).then(function (result) { API.post('user/validate', body).then(function (result) {
...@@ -206,18 +231,24 @@ export default function SignIn() { ...@@ -206,18 +231,24 @@ export default function SignIn() {
}) })
.catch(function (error) { .catch(function (error) {
console.log(error); console.log(error);
setErrorMsg(error.response.data.message)
handleError()
}); });
} }
}) })
.catch(function (error) { .catch(function (error) {
console.log(error); console.log(error);
setErrorMsg(error.response.data.message)
handleError()
}); });
} }
} }
const onFailure = (res) => { const onFailure = (res) => {
console.log("LOGIN FAILED!", res) console.log("LOGIN FAILED!", res)
setErrorMsg("Google Login Failed")
handleError()
} }
useEffect(() => { useEffect(() => {
...@@ -239,15 +270,25 @@ export default function SignIn() { ...@@ -239,15 +270,25 @@ export default function SignIn() {
email: data.get('email'), email: data.get('email'),
password: data.get('password') password: data.get('password')
} }
const result = await API.post('user/validate', body)
console.log("result", result)
let decodedToken = jwt_decode(result.data.user) try {
console.log("decodedToken", decodedToken) const result = await API.post('user/validate', body)
console.log("result", result)
localStorage.setItem('token', result.data.user) let decodedToken = jwt_decode(result.data.user)
dispatch(login({ 'fullName': decodedToken.fullName, 'email': decodedToken.email })) console.log("decodedToken", decodedToken)
dispatch(addHeader({ 'header': true, 'footer': true }))
navigate('/') localStorage.setItem('token', result.data.user)
dispatch(login({ 'fullName': decodedToken.fullName, 'email': decodedToken.email }))
dispatch(addHeader({ 'header': true, 'footer': true }))
navigate('/')
} catch (error) {
console.log("errrrr",error)
setErrorMsg(error.response.data.message)
handleError()
}
}; };
return ( return (
...@@ -262,6 +303,9 @@ export default function SignIn() { ...@@ -262,6 +303,9 @@ export default function SignIn() {
justifyContent: 'center', justifyContent: 'center',
alignItems: 'center' alignItems: 'center'
}}> }}>
<Snackbar open={error} autoHideDuration={6000} onClose={handleCloseError}>
<Alert onClose={handleCloseError} severity="error">{errorMsg}</Alert>
</Snackbar>
<ThemeProvider theme={theme}> <ThemeProvider theme={theme}>
<div style={{ <div style={{
paddingTop: '50px', paddingTop: '50px',
......
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState, useRef } from 'react';
import Avatar from '@mui/material/Avatar'; import Avatar from '@mui/material/Avatar';
import Button from '@mui/material/Button'; import Button from '@mui/material/Button';
import CssBaseline from '@mui/material/CssBaseline'; import CssBaseline from '@mui/material/CssBaseline';
...@@ -22,6 +22,15 @@ import { makeStyles } from '@mui/styles'; ...@@ -22,6 +22,15 @@ import { makeStyles } from '@mui/styles';
import { useNavigate } from "react-router-dom"; import { useNavigate } from "react-router-dom";
import Logo from './../../images/logo.png' import Logo from './../../images/logo.png'
import API from '../../api'; import API from '../../api';
import Snackbar from '@mui/material/Snackbar';
import MuiAlert, { AlertProps } from '@mui/material/Alert';
const Alert = React.forwardRef(function Alert(
props,
ref,
) {
return <MuiAlert elevation={6} ref={ref} variant="filled" {...props} />;
});
function Copyright(props) { function Copyright(props) {
return ( return (
...@@ -58,11 +67,41 @@ const useStyles = makeStyles({ ...@@ -58,11 +67,41 @@ const useStyles = makeStyles({
}) })
export default function SignUp() { export default function SignUp() {
const [open, setOpen] = React.useState(false);
const [error, setError] = React.useState(false);
const [errorMsg, setErrorMsg] = React.useState("Error");
const [successMsg, setSuccessMsg] = React.useState("Successful");
let navigate = useNavigate(); let navigate = useNavigate();
const dispatch = useDispatch(); const dispatch = useDispatch();
const headerVisibility = useSelector((state) => state.header) const headerVisibility = useSelector((state) => state.header)
const classes = useStyles(); const classes = useStyles();
const inputFNameRef = useRef()
const inputLNameRef = useRef()
const inputEmailRef = useRef()
const inputPasswordRef = useRef()
const handleClick = () => {
setOpen(true);
};
const handleClose = (event, reason) => {
if (reason === 'clickaway') {
return;
}
setOpen(false);
};
const handleError = () => {
setError(true);
};
const handleCloseError = (event, reason) => {
if (reason === 'clickaway') {
return;
}
setError(false);
}
useEffect(() => { useEffect(() => {
dispatch(addHeader({ 'header': false, 'footer': false })) dispatch(addHeader({ 'header': false, 'footer': false }))
}, []); }, []);
...@@ -87,9 +126,30 @@ export default function SignUp() { ...@@ -87,9 +126,30 @@ export default function SignUp() {
password: data.get('password'), password: data.get('password'),
role: 'user' role: 'user'
} }
const result = await API.post('user/create', body) try {
navigate('/signIn') const result = await API.post('user/create', body)
console.log("result", result) console.log("hh", result)
setSuccessMsg(result.data.message)
handleClick()
// navigate('/signIn')
console.log("result", result)
if (inputFNameRef.current || inputLNameRef.current || inputEmailRef.current || inputPasswordRef.current) {
inputFNameRef.current.value = "";
inputLNameRef.current.value = "";
inputEmailRef.current.value = "";
inputPasswordRef.current.value = "";
}
} catch (error) {
setErrorMsg(error.response.data.message)
handleError()
console.log("error", error.response.data.message)
if (inputFNameRef.current || inputLNameRef.current || inputEmailRef.current || inputPasswordRef.current) {
inputFNameRef.current.value = "";
inputLNameRef.current.value = "";
inputEmailRef.current.value = "";
inputPasswordRef.current.value = "";
}
}
}; };
return ( return (
...@@ -104,7 +164,14 @@ export default function SignUp() { ...@@ -104,7 +164,14 @@ export default function SignUp() {
justifyContent: 'center', justifyContent: 'center',
alignItems: 'center' alignItems: 'center'
}}> }}>
<Snackbar open={open} autoHideDuration={10000} onClose={handleClose}>
<Alert onClose={handleClose} severity="success" sx={{ width: '100%' }}>
{successMsg}
</Alert>
</Snackbar>
<Snackbar open={error} autoHideDuration={6000} onClose={handleCloseError}>
<Alert onClose={handleCloseError} severity="error">{errorMsg}</Alert>
</Snackbar>
<img src={Logo} onClick={() => { navigate(`/`); dispatch(addHeader({ 'header': true, 'footer': true })) }} style={{ cursor: 'pointer', position: 'absolute', left: '0', top: '0', width: '180px' }} /> <img src={Logo} onClick={() => { navigate(`/`); dispatch(addHeader({ 'header': true, 'footer': true })) }} style={{ cursor: 'pointer', position: 'absolute', left: '0', top: '0', width: '180px' }} />
<ThemeProvider theme={theme}> <ThemeProvider theme={theme}>
<div style={{ <div style={{
...@@ -160,6 +227,7 @@ export default function SignUp() { ...@@ -160,6 +227,7 @@ export default function SignUp() {
id="firstName" id="firstName"
label="First Name" label="First Name"
autoFocus autoFocus
inputRef={inputFNameRef}
/> />
</Grid> </Grid>
<Grid item xs={12} sm={6}> <Grid item xs={12} sm={6}>
...@@ -170,6 +238,7 @@ export default function SignUp() { ...@@ -170,6 +238,7 @@ export default function SignUp() {
label="Last Name" label="Last Name"
name="lastName" name="lastName"
autoComplete="family-name" autoComplete="family-name"
inputRef={inputLNameRef}
/> />
</Grid> </Grid>
<Grid item xs={12}> <Grid item xs={12}>
...@@ -180,6 +249,7 @@ export default function SignUp() { ...@@ -180,6 +249,7 @@ export default function SignUp() {
label="Email Address" label="Email Address"
name="email" name="email"
autoComplete="email" autoComplete="email"
inputRef={inputEmailRef}
/> />
</Grid> </Grid>
<Grid item xs={12}> <Grid item xs={12}>
...@@ -191,6 +261,7 @@ export default function SignUp() { ...@@ -191,6 +261,7 @@ export default function SignUp() {
type="password" type="password"
id="password" id="password"
autoComplete="new-password" autoComplete="new-password"
inputRef={inputPasswordRef}
/> />
</Grid> </Grid>
<Grid item xs={12}> <Grid item xs={12}>
......
This diff is collapsed.
...@@ -162,7 +162,11 @@ export default function InputDetails() { ...@@ -162,7 +162,11 @@ export default function InputDetails() {
dispatch(addBusiness({ dispatch(addBusiness({
...businessDetails.value[0], locationFeatures: locationFeatures, businessCount: BusinessCount, ml_result: ML_Result.data.data ...businessDetails.value[0], locationFeatures: locationFeatures, businessCount: BusinessCount, ml_result: ML_Result.data.data
})) }))
navigate(`/result`) if (businessDetails.value.length > 1) {
navigate(`/multipleResult`)
} else {
navigate(`/result`)
}
handleClose() handleClose()
}).catch(function (error) { }).catch(function (error) {
return error; return error;
...@@ -313,7 +317,7 @@ export default function InputDetails() { ...@@ -313,7 +317,7 @@ export default function InputDetails() {
{getStepContent(activeStep)} {getStepContent(activeStep)}
<Box sx={{ display: 'flex', justifyContent: 'flex-end' }}> <Box sx={{ display: 'flex', justifyContent: 'flex-end' }}>
{activeStep !== 0 && ( {activeStep !== 0 && (
<Button onClick={handleBack} sx={{ mt: 3, ml: 1 ,color:'#33449e'}}> <Button onClick={handleBack} sx={{ mt: 3, ml: 1, color: '#33449e' }}>
Back Back
</Button> </Button>
)} )}
......
...@@ -13,11 +13,11 @@ import { pink } from '@mui/material/colors'; ...@@ -13,11 +13,11 @@ import { pink } from '@mui/material/colors';
import Switch from '@mui/material/Switch'; import Switch from '@mui/material/Switch';
import { useSelector, useDispatch } from 'react-redux'; import { useSelector, useDispatch } from 'react-redux';
import { addBusiness } from './../../features/business'; import { addBusiness } from './../../features/business';
import {FaUmbrellaBeach} from 'react-icons/fa'; import { FaUmbrellaBeach } from 'react-icons/fa';
import {AiOutlineWifi} from 'react-icons/ai'; import { AiOutlineWifi } from 'react-icons/ai';
import {MdOutlinePool} from 'react-icons/md'; import { MdOutlinePool } from 'react-icons/md';
import {RiParkingBoxLine} from 'react-icons/ri'; import { RiParkingBoxLine } from 'react-icons/ri';
import {BsWind} from 'react-icons/bs'; import { BsWind } from 'react-icons/bs';
const IOSSwitch = styled((props) => ( const IOSSwitch = styled((props) => (
<Switch focusVisibleClassName=".Mui-focusVisible" disableRipple {...props} /> <Switch focusVisibleClassName=".Mui-focusVisible" disableRipple {...props} />
...@@ -100,19 +100,25 @@ export default function ServiceDetailsForm() { ...@@ -100,19 +100,25 @@ export default function ServiceDetailsForm() {
}, [businessDetails]); }, [businessDetails]);
useEffect(() => { useEffect(() => {
console.log("serviceDetails", hotelServiceDetails) if (businessDetails.value[0].type == 'hotel') {
dispatch(addBusiness({ console.log("serviceDetails", hotelServiceDetails)
...businessDetails.value[0], serviceDetails: hotelServiceDetails dispatch(addBusiness({
})) ...businessDetails.value[0], serviceDetails: hotelServiceDetails
}))
}
}, [hotelServiceDetails]); }, [hotelServiceDetails]);
useEffect(() => { useEffect(() => {
console.log("serviceDetails", restaurantServiceDetails) if (businessDetails.value[0].type == 'restaurant') {
dispatch(addBusiness({ console.log("serviceDetails", restaurantServiceDetails)
...businessDetails.value[0], serviceDetails: restaurantServiceDetails
})) dispatch(addBusiness({
...businessDetails.value[0], serviceDetails: restaurantServiceDetails
}))
}
}, [restaurantServiceDetails]); }, [restaurantServiceDetails]);
const handleSwitchChange = e => { const handleSwitchChange = e => {
...@@ -129,31 +135,31 @@ export default function ServiceDetailsForm() { ...@@ -129,31 +135,31 @@ export default function ServiceDetailsForm() {
businessDetails && businessDetails.value[0].type == 'hotel' ? businessDetails && businessDetails.value[0].type == 'hotel' ?
<React.Fragment> <React.Fragment>
<Typography variant="h6" gutterBottom> <Typography variant="h6" gutterBottom>
Availability of the services Availability of the services
</Typography> </Typography>
<Grid container spacing={3}> <Grid container spacing={3}>
<Grid item xs={12} md={6}> <Grid item xs={12} md={6}>
<div style={{display:'flex',alignItems:'center',justifyContent:'flex-start'}}> <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'flex-start' }}>
<FaUmbrellaBeach style={{color:'#ff802f',fontSize:'18px'}}/> <FaUmbrellaBeach style={{ color: '#ff802f', fontSize: '18px' }} />
<FormControlLabel <FormControlLabel
control={ control={
<IOSSwitch <IOSSwitch
sx={{ m: 1 ,}} sx={{ m: 1, }}
name="beach" name="beach"
onChange={handleSwitchChange} onChange={handleSwitchChange}
checked={hotelServiceDetails.beach} /> checked={hotelServiceDetails.beach} />
} }
label="Beach Access" label="Beach Access"
labelPlacement="start" labelPlacement="start"
/> />
</div> </div>
</Grid> </Grid>
<Grid item xs={12} md={6}> <Grid item xs={12} md={6}>
<div style={{display:'flex',alignItems:'center',justifyContent:'flex-start'}}> <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'flex-start' }}>
<MdOutlinePool style={{color:'#344ab1',fontSize:'20px'}}/> <MdOutlinePool style={{ color: '#344ab1', fontSize: '20px' }} />
<FormControlLabel <FormControlLabel
control={ control={
<IOSSwitch <IOSSwitch
sx={{ m: 1 }} sx={{ m: 1 }}
name="pool" name="pool"
...@@ -165,45 +171,45 @@ export default function ServiceDetailsForm() { ...@@ -165,45 +171,45 @@ export default function ServiceDetailsForm() {
</div> </div>
</Grid> </Grid>
<Grid item xs={12} md={6}> <Grid item xs={12} md={6}>
<div style={{display:'flex',alignItems:'center',justifyContent:'flex-start'}}> <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'flex-start' }}>
<AiOutlineWifi style={{color:'#4534b1',fontSize:'20px'}}/> <AiOutlineWifi style={{ color: '#4534b1', fontSize: '20px' }} />
<FormControlLabel <FormControlLabel
control={<IOSSwitch control={<IOSSwitch
sx={{ m: 1 }} sx={{ m: 1 }}
name="wifi" name="wifi"
onChange={handleSwitchChange} onChange={handleSwitchChange}
checked={hotelServiceDetails.wifi} />} checked={hotelServiceDetails.wifi} />}
label="WiFi Availability" label="WiFi Availability"
labelPlacement="start" labelPlacement="start"
/> />
</div> </div>
</Grid> </Grid>
<Grid item xs={12} md={6}> <Grid item xs={12} md={6}>
<div style={{display:'flex',alignItems:'center',justifyContent:'flex-start'}}> <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'flex-start' }}>
<RiParkingBoxLine style={{color:'#b13434',fontSize:'20px'}}/> <RiParkingBoxLine style={{ color: '#b13434', fontSize: '20px' }} />
<FormControlLabel <FormControlLabel
control={<IOSSwitch control={<IOSSwitch
sx={{ m: 1 }} sx={{ m: 1 }}
name="parking" name="parking"
onChange={handleSwitchChange} onChange={handleSwitchChange}
checked={hotelServiceDetails.parking} />} checked={hotelServiceDetails.parking} />}
label="Parking Availability" label="Parking Availability"
labelPlacement="start" labelPlacement="start"
/> />
</div> </div>
</Grid> </Grid>
<Grid item xs={12} md={6}> <Grid item xs={12} md={6}>
<div style={{display:'flex',alignItems:'center',justifyContent:'flex-start'}}> <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'flex-start' }}>
<BsWind style={{color:'#34b13f',fontSize:'20px'}}/> <BsWind style={{ color: '#34b13f', fontSize: '20px' }} />
<FormControlLabel <FormControlLabel
control={<IOSSwitch control={<IOSSwitch
sx={{ m: 1 }} sx={{ m: 1 }}
name="ac" name="ac"
onChange={handleSwitchChange} onChange={handleSwitchChange}
checked={hotelServiceDetails.ac} />} checked={hotelServiceDetails.ac} />}
label="A/C Availability" label="A/C Availability"
labelPlacement="start" labelPlacement="start"
/> />
</div> </div>
</Grid> </Grid>
</Grid> </Grid>
......
This diff is collapsed.
...@@ -16,7 +16,7 @@ import { useNavigate } from "react-router-dom"; ...@@ -16,7 +16,7 @@ import { useNavigate } from "react-router-dom";
import Switch, { SwitchProps } from '@mui/material/Switch'; import Switch, { SwitchProps } from '@mui/material/Switch';
import { useDispatch } from "react-redux"; import { useDispatch } from "react-redux";
import { useSelector } from "react-redux"; import { useSelector } from "react-redux";
import Logo from './../images/logo.png' import Logo from './../images/logo-new.png'
import { darkMode, lightMode } from "../features/theme"; import { darkMode, lightMode } from "../features/theme";
import { styled } from '@mui/material/styles'; import { styled } from '@mui/material/styles';
import AccountMenu from './AccountMenu'; import AccountMenu from './AccountMenu';
...@@ -76,7 +76,6 @@ const ResponsiveAppBar = () => { ...@@ -76,7 +76,6 @@ const ResponsiveAppBar = () => {
setAnchorElUser(null); setAnchorElUser(null);
}; };
const handleChange = (event) => { const handleChange = (event) => {
if (event.target.checked) { if (event.target.checked) {
console.log("dark") console.log("dark")
...@@ -99,7 +98,7 @@ const ResponsiveAppBar = () => { ...@@ -99,7 +98,7 @@ const ResponsiveAppBar = () => {
<Container maxWidth="xl"> <Container maxWidth="xl">
<Toolbar disableGutters> <Toolbar disableGutters>
<Box onClick={() => { navigate(`/`) }} {/* <Box
sx={{ sx={{
display: { xs: 'none', md: 'flex' }, display: { xs: 'none', md: 'flex' },
mr: 1, mr: 1,
...@@ -112,7 +111,9 @@ const ResponsiveAppBar = () => { ...@@ -112,7 +111,9 @@ const ResponsiveAppBar = () => {
cursor: 'pointer', cursor: 'pointer',
}} /> }} /> */}
<img onClick={() => { navigate(`/`) }} src={Logo}
style={{ width: '200px', cursor: 'pointer' }} alt="logo" />
...@@ -153,7 +154,7 @@ const ResponsiveAppBar = () => { ...@@ -153,7 +154,7 @@ const ResponsiveAppBar = () => {
))} ))}
</Menu> </Menu>
</Box> </Box>
<Box onClick={() => { navigate(`/`) }} {/* <Box onClick={() => { navigate(`/`) }}
sx={{ sx={{
display: { xs: 'flex', md: 'none' }, display: { xs: 'flex', md: 'none' },
height: '70px', height: '70px',
...@@ -164,7 +165,8 @@ const ResponsiveAppBar = () => { ...@@ -164,7 +165,8 @@ const ResponsiveAppBar = () => {
backgroundPosition: 'center', backgroundPosition: 'center',
cursor: 'pointer', cursor: 'pointer',
}} /> }} /> */}
<Box sx={{ flexGrow: 1, display: { xs: 'none', md: 'flex' } }}> <Box sx={{ flexGrow: 1, display: { xs: 'none', md: 'flex' } }}>
{pages.map((page) => ( {pages.map((page) => (
<Button <Button
......
This diff is collapsed.
...@@ -3,35 +3,34 @@ import { createSlice } from '@reduxjs/toolkit' ...@@ -3,35 +3,34 @@ import { createSlice } from '@reduxjs/toolkit'
export const businessSlice = createSlice({ export const businessSlice = createSlice({
name: "business", name: "business",
initialState: { initialState: {
value: [ value: [{
{ "type": "hotel",
"type": "hotel", "latitude": 6.704581206797783,
"latitude": 5.968120503548374, "longitude": 81.27638881048588,
"longitude": 80.51454807585506, "serviceDetails": {
"serviceDetails": { "pool": true,
"opening": false, "beach": true,
"closing": false, "wifi": true,
"delivery": false, "ac": false,
"parking": true, "parking": false
"pool": true },
}, "locationFeatures": {
"locationFeatures": { "attractionPlacesCount": 1,
"attractionPlacesCount": 0, "transportationModesCount": 0,
"transportationModesCount": 1, "nearByHotelReviewCount": 0,
"nearByHotelReviewCount": 0, "competitors": 0
"competitors": 0 },
}, "businessCount": {
"businessCount": { "atmCount": 0,
"atmCount": 0, "restaurantCount": 0,
"restaurantCount": 3, "hospitalCount": 0,
"hospitalCount": 1, "pharmacyCount": 0,
"pharmacyCount": 0, "gasStationCount": 0,
"gasStationCount": 0, "movieTheaterCount": 0,
"movieTheaterCount": 3, "hotelCount": 0
"hotelCount": 0 },
}, "ml_result": 48.6782
"ml_result": 28.480000000000008 }
}
] ]
}, },
reducers: { reducers: {
...@@ -39,6 +38,12 @@ export const businessSlice = createSlice({ ...@@ -39,6 +38,12 @@ export const businessSlice = createSlice({
// state.value.push(action.payload) // state.value.push(action.payload)
state.value[0] = action.payload state.value[0] = action.payload
}, },
compareBusiness: (state, action) => {
console.log("action.payload", action.payload)
state.value[action.payload.length] = state.value[0]
state.value[0] = null
},
// updateBusiness: (state, action) => { // updateBusiness: (state, action) => {
// state.value.map((business)=>{ // state.value.map((business)=>{
...@@ -47,5 +52,5 @@ export const businessSlice = createSlice({ ...@@ -47,5 +52,5 @@ export const businessSlice = createSlice({
// } // }
} }
}); });
export const { addBusiness: addBusiness } = businessSlice.actions; export const { addBusiness: addBusiness, compareBusiness: compareBusiness } = businessSlice.actions;
export default businessSlice.reducer; export default businessSlice.reducer;
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment