Commit e2f623a9 authored by Sachintha Nipun M.M. it19046594's avatar Sachintha Nipun M.M. it19046594

Merge branch 'IT19046594' into 'master'

redux issues fixed

See merge request !29
parents 2ab9e839 678b8a82
API_KEY_SECRET = 'AIzaSyDzvpMhG1TmXhpoCfPCq-G4snf-R0vSWF4'
API_KEY_SECRET = 'AIzaSyC_mV5GkYx8ULNDqXgwBobTczkM7j6T0uc'
JWT_SECRET = cb6969137082baf1baeeed271a270ae29dde0c6f5775e9508e808965405c99b5
BASE_URL = http://localhost:3000/
HOST=smtp.gmail.com
......
......@@ -103,10 +103,11 @@ const createUser = async (req, res) => {
bcrypt.genSalt(saltRounds, function (err, salt) {
bcrypt.hash(req.body.password, salt, async function (err, hash) {
req.body.password = hash;
req.body.googleUser = false;
req.body.emailToken = crypto.randomBytes(64).toString('hex'),
req.body.isVerified = false;
req.body.isVerified = false;
let usercreate = new User(req.body);
console.log( usercreate.emailToken);
console.log(usercreate.emailToken);
try {
const data = await usercreate.save()
let mailOptions = {
......@@ -170,8 +171,9 @@ const createGoogleUser = async (req, res) => {
bcrypt.genSalt(saltRounds, function (err, salt) {
bcrypt.hash(req.body.password, salt, async function (err, hash) {
req.body.password = hash;
req.body.googleUser = true;
req.body.emailToken = null,
req.body.isVerified = true;
req.body.isVerified = true;
let user = new User(req.body);
try {
const data = await user.save()
......@@ -216,7 +218,7 @@ const validateUser = async (req, res) => {
fullName: user.fullName,
}, process.env.JWT_SECRET)
res.status(200).send({ user: token ,userDetails:user});
res.status(200).send({ user: token, userDetails: user });
} else {
console.log("Credentials Does Not Matched");
res.status(500).send({ message: "Credentials Does Not Matched" });
......@@ -300,8 +302,9 @@ const verifyEmail = async (req, res) => {
//getUserByEmail
const getUserByEmail = async (req, res) => {
console.log(req.body)
const user = await User.findOne({ where: { email: req.body.email } })
console.log("req.body.email", req.body.email)
const user = await User.findOne({ email: req.body.email })
console.log("user---", user);
if (!user) {
res.status(200).send(null)
} else {
......@@ -316,7 +319,7 @@ const updateUser = async (req, res) => {
if (req.body) {
let count = req.body.predictionCount;
let countLimit = req.body.predictionCountLimit;
if(count == countLimit){
if (count == countLimit) {
req.body.subscriptionStatus = "Over";
}
await User.updateOne({ _id: req.params.id }, { $set: req.body }, (err, result) => {
......@@ -333,14 +336,14 @@ const updateUser = async (req, res) => {
// Delete User
const deleteUser = async (req, res) => {
try{
try {
const data = await User.findByIdAndDelete(req.params.id);
if(!data){
res.status(404).send({message:"User Not Found"});
}else{
res.status(200).send({message:"User Deleted Successfully"});
if (!data) {
res.status(404).send({ message: "User Not Found" });
} else {
res.status(200).send({ message: "User Deleted Successfully" });
}
}catch(err){
} catch (err) {
console.log(err);
res.status(500).send(err);
}
......
......@@ -5,8 +5,9 @@ const UserSchema = new mongoose.Schema({
email: { type: String, required: true, unique: true },
role: { type: String, required: true },
isVerified: { type: Boolean, required: false },
googleUser: { type: Boolean, required: false },
emailToken: { type: String, required: false },
password: { type: String, required: true ,select: false },
password: { type: String, required: true },
predictionCount: { type: Number, required: false },
predictionCountLimit: { type: Number, required: false },
paymentType: { type: String, required: true },
......
This diff is collapsed.
......@@ -202,8 +202,10 @@ export default function SignIn() {
API.post('/user/getUser', body)
.then(function (response) {
console.log(response)
console.log("responseeeeeeeee",response)
if (response.data.length === 0) {
API.post('user/createGoogleUser', body)
.then(function (response) {
API.post('user/validate', body).then(function (result) {
......
......@@ -91,7 +91,6 @@ export default function InputDetails() {
const [activeStep, setActiveStep] = React.useState(0);
const businessDetails = useSelector((state) => state.business)
let navigate = useNavigate();
const handleClose = () => {
setOpen(false);
};
......
......@@ -10,15 +10,15 @@ import {
MarkerF,
InfoWindow
} from "@react-google-maps/api";
import {FaUmbrellaBeach} from 'react-icons/fa';
import {AiOutlineWifi} from 'react-icons/ai';
import {MdOutlinePool} from 'react-icons/md';
import {RiParkingBoxLine} from 'react-icons/ri';
import {BsWind} from 'react-icons/bs';
import { FaUmbrellaBeach } from 'react-icons/fa';
import { AiOutlineWifi } from 'react-icons/ai';
import { MdOutlinePool } from 'react-icons/md';
import { RiParkingBoxLine } from 'react-icons/ri';
import { BsWind } from 'react-icons/bs';
import { useSelector, useDispatch } from 'react-redux';
import { addBusiness } from './../../features/business';
import {MdOutlineDeliveryDining} from 'react-icons/md';
import {AiOutlineClockCircle} from 'react-icons/ai';
import { MdOutlineDeliveryDining } from 'react-icons/md';
import { AiOutlineClockCircle } from 'react-icons/ai';
export default function Review() {
const businessDetails = useSelector((state) => state.business)
......@@ -47,7 +47,7 @@ export default function Review() {
const { isLoaded } = useLoadScript({
// Enter your own Google Maps API key
googleMapsApiKey: "AIzaSyDzvpMhG1TmXhpoCfPCq-G4snf-R0vSWF4"
googleMapsApiKey: "AIzaSyC_mV5GkYx8ULNDqXgwBobTczkM7j6T0uc"
});
return (
......@@ -56,61 +56,61 @@ export default function Review() {
Summary
</Typography>
{businessDetails && businessDetails.value[0].type == 'hotel' ?
<List disablePadding sx={{paddingInline:2}}>
<ListItem sx={{ py: 1, px: 0 }}>
<FaUmbrellaBeach style={{color:'#ff802f',fontSize:'18px',marginRight:'8px'}}/> <ListItemText primary="Beach Access" />
<Typography variant="subtitle1" sx={{ fontWeight: 500}}>{businessDetails.value[0].serviceDetails.beach ? `Available` : `Not Available`}</Typography>
</ListItem>
<ListItem sx={{ py: 1, px: 0 }}>
<MdOutlinePool style={{color:'#344ab1',fontSize:'20px',marginRight:'8px'}}/> <ListItemText primary="Pool Availabily" />
<Typography variant="subtitle1" sx={{ fontWeight: 500 }}>{businessDetails.value[0].serviceDetails.pool ? `Available` : `Not Available`}</Typography>
</ListItem>
<ListItem sx={{ py: 1, px: 0 }}>
<AiOutlineWifi style={{color:'#4534b1',fontSize:'20px',marginRight:'8px'}}/> <ListItemText primary="WiFi Availabily" />
<Typography variant="subtitle1" sx={{ fontWeight: 500}}>{businessDetails.value[0].serviceDetails.wifi ? `Available` : `Not Available`}</Typography>
</ListItem>
<ListItem sx={{ py: 1, px: 0 }}>
<RiParkingBoxLine style={{color:'#b13434',fontSize:'20px',marginRight:'8px'}}/> <ListItemText primary="Parking Availabily" />
<Typography variant="subtitle1" sx={{ fontWeight: 500 }}>{businessDetails.value[0].serviceDetails.parking ? `Available` : `Not Available`}</Typography>
</ListItem>
<ListItem sx={{ py: 1, px: 0 }}>
<BsWind style={{color:'#34b13f',fontSize:'20px',marginRight:'8px'}}/> <ListItemText primary="A/C Availabily" />
<Typography variant="subtitle1" sx={{ fontWeight: 500}}>{businessDetails.value[0].serviceDetails.ac ? `Available` : `Not Available`}</Typography>
</ListItem>
</List> :
businessDetails && businessDetails.value[0].type == 'restaurant' ?
<List disablePadding>
<ListItem sx={{ py: 1, px: 0 }}>
<AiOutlineClockCircle style={{ color: '#1d7e20',fontSize:'20px',marginRight:'8px'}}/> <ListItemText primary="Opening Hours" />
<Typography variant="subtitle1" sx={{ fontWeight: 500 }}>{businessDetails.value[0].serviceDetails.opening }</Typography>
</ListItem>
<ListItem sx={{ py: 1, px: 0 }}>
<AiOutlineClockCircle style={{ color: '#ff462f',fontSize:'20px',marginRight:'8px'}}/> <ListItemText primary="Closing Hours" />
<Typography variant="subtitle1" sx={{ fontWeight: 500 }}>{businessDetails.value[0].serviceDetails.closing }</Typography>
</ListItem>
<ListItem sx={{ py: 1, px: 0 }}>
<MdOutlineDeliveryDining style={{ color: '#2f8eff',fontSize:'20px',marginRight:'8px'}}/> <ListItemText primary="Delivery" />
<Typography variant="subtitle1" sx={{ fontWeight: 500 }}>{businessDetails.value[0].serviceDetails.delivery == 'Delivery' ? `Available` : businessDetails.value[0].serviceDetails.delivery}</Typography>
</ListItem>
</List>
: <div></div>}
<List disablePadding sx={{ paddingInline: 2 }}>
<ListItem sx={{ py: 1, px: 0 }}>
<FaUmbrellaBeach style={{ color: '#ff802f', fontSize: '18px', marginRight: '8px' }} /> <ListItemText primary="Beach Access" />
<Typography variant="subtitle1" sx={{ fontWeight: 500 }}>{businessDetails.value[0].serviceDetails.beach ? `Available` : `Not Available`}</Typography>
</ListItem>
<ListItem sx={{ py: 1, px: 0 }}>
<MdOutlinePool style={{ color: '#344ab1', fontSize: '20px', marginRight: '8px' }} /> <ListItemText primary="Pool Availabily" />
<Typography variant="subtitle1" sx={{ fontWeight: 500 }}>{businessDetails.value[0].serviceDetails.pool ? `Available` : `Not Available`}</Typography>
</ListItem>
<ListItem sx={{ py: 1, px: 0 }}>
<AiOutlineWifi style={{ color: '#4534b1', fontSize: '20px', marginRight: '8px' }} /> <ListItemText primary="WiFi Availabily" />
<Typography variant="subtitle1" sx={{ fontWeight: 500 }}>{businessDetails.value[0].serviceDetails.wifi ? `Available` : `Not Available`}</Typography>
</ListItem>
<ListItem sx={{ py: 1, px: 0 }}>
<RiParkingBoxLine style={{ color: '#b13434', fontSize: '20px', marginRight: '8px' }} /> <ListItemText primary="Parking Availabily" />
<Typography variant="subtitle1" sx={{ fontWeight: 500 }}>{businessDetails.value[0].serviceDetails.parking ? `Available` : `Not Available`}</Typography>
</ListItem>
<ListItem sx={{ py: 1, px: 0 }}>
<BsWind style={{ color: '#34b13f', fontSize: '20px', marginRight: '8px' }} /> <ListItemText primary="A/C Availabily" />
<Typography variant="subtitle1" sx={{ fontWeight: 500 }}>{businessDetails.value[0].serviceDetails.ac ? `Available` : `Not Available`}</Typography>
</ListItem>
</List> :
businessDetails && businessDetails.value[0].type == 'restaurant' ?
<List disablePadding>
<ListItem sx={{ py: 1, px: 0 }}>
<AiOutlineClockCircle style={{ color: '#1d7e20', fontSize: '20px', marginRight: '8px' }} /> <ListItemText primary="Opening Hours" />
<Typography variant="subtitle1" sx={{ fontWeight: 500 }}>{businessDetails.value[0].serviceDetails.opening}</Typography>
</ListItem>
<ListItem sx={{ py: 1, px: 0 }}>
<AiOutlineClockCircle style={{ color: '#ff462f', fontSize: '20px', marginRight: '8px' }} /> <ListItemText primary="Closing Hours" />
<Typography variant="subtitle1" sx={{ fontWeight: 500 }}>{businessDetails.value[0].serviceDetails.closing}</Typography>
</ListItem>
<ListItem sx={{ py: 1, px: 0 }}>
<MdOutlineDeliveryDining style={{ color: '#2f8eff', fontSize: '20px', marginRight: '8px' }} /> <ListItemText primary="Delivery" />
<Typography variant="subtitle1" sx={{ fontWeight: 500 }}>{businessDetails.value[0].serviceDetails.delivery == 'Delivery' ? `Available` : businessDetails.value[0].serviceDetails.delivery}</Typography>
</ListItem>
</List>
: <div></div>}
<Grid container spacing={2}>
<Grid item xs={12} >
<Typography variant="h6" gutterBottom sx={{ mt: 2,display:'flex',alignItems:'center',gap:'5px'}}>
<Typography variant="h6" gutterBottom sx={{ mt: 2, display: 'flex', alignItems: 'center', gap: '5px' }}>
Location : {position && (
<div style={{fontSize:"12px",marginTop:'5px',color:'#c4c2c0',fontStyle:'italic'}}>
({position.lat}, {position.lng})
</div>
)}
<div style={{ fontSize: "12px", marginTop: '5px', color: '#c4c2c0', fontStyle: 'italic' }}>
({position.lat}, {position.lng})
</div>
)}
</Typography>
<div>
{isLoaded ?
......
......@@ -5,6 +5,8 @@ import { useSelector } from 'react-redux'
const InputHotelDetails = () => {
const themeColor = useSelector((state) => state.theme.value);
window.onbeforeunload = function () { return "Your work will be lost."; };
return (
<Box
sx={{
......
......@@ -26,7 +26,7 @@ function Map() {
const { isLoaded } = useLoadScript({
// Enter your own Google Maps API key
googleMapsApiKey: "AIzaSyDzvpMhG1TmXhpoCfPCq-G4snf-R0vSWF4"
googleMapsApiKey: "AIzaSyC_mV5GkYx8ULNDqXgwBobTczkM7j6T0uc"
});
......@@ -64,6 +64,7 @@ function Map() {
useEffect(() => {
if (clickedLatLng) {
console.log('sqqqqqqqqqqqqqqqqqqqq')
setPosition(clickedLatLng)
console.log("clickedLatLng", clickedLatLng, businessDetails.value[0].type)
dispatch(addBusiness({
......@@ -130,73 +131,73 @@ function Map() {
{/* Position of the user's map click */}
{clickedLatLng && (
<div>
{ clickedLatLng.lat && clickedLatLng.lng &&
<Box
sx={{
width: "fit-content",
height: "100%",
display: "flex",
justifyContent: "flex-start",
alignItems: "center",
// background: "#0f4bfb4d",
borderRadius: "8px",
paddingInline: "10px",
mt: "10px",
}}
>
<div style={{fontSize:'15px',fontWeight:200,marginLeft:"5px",width:'fit-content'}}> Coordinates of the Selected Location </div>
<Box
sx={{
width: "fit-content",
height: "fit-content",
display: "flex",
justifyContent: "flex-start",
alignItems: "center",
p:1,
gap:1
}}
>
<Box
sx={{
width: "fit-content",
height: "fit-content",
background: "radial-gradient(circle, rgba(84,111,185,0.8074580173866421) 0%, rgba(53,141,198,0.7682423311121324) 100%)",
borderRadius: "15px",
boxShadow: 1,
padding:'5px',
paddingInline:'15px',
fontSize:'14px',
color:'white',
fontWeight:'400',
display: "flex",
justifyContent: "center",
alignItems: "center",
}}
>
Latitude : <div style={{fontSize:'12px',fontWeight:200,marginLeft:"5px"}}> {clickedLatLng.lat} </div>
</Box>
<Box
sx={{
width: "fit-content",
height: "fit-content",
background: "radial-gradient(circle, rgba(84,111,185,0.8074580173866421) 0%, rgba(53,141,198,0.7682423311121324) 100%)",
borderRadius: "15px",
boxShadow: 1,
padding:'5px',
paddingInline:'15px',
fontSize:'14px',
color:'white',
fontWeight:'400',
display: "flex",
justifyContent: "center",
alignItems: "center",
}}
>
Longitude : <div style={{fontSize:'12px',fontWeight:200,marginLeft:"5px"}}> {clickedLatLng.lng} </div>
</Box>
</Box>
</Box>}
{clickedLatLng.lat && clickedLatLng.lng &&
<Box
sx={{
width: "fit-content",
height: "100%",
display: "flex",
justifyContent: "flex-start",
alignItems: "center",
// background: "#0f4bfb4d",
borderRadius: "8px",
paddingInline: "10px",
mt: "10px",
}}
>
<div style={{ fontSize: '15px', fontWeight: 200, marginLeft: "5px", width: 'fit-content' }}> Coordinates of the Selected Location </div>
<Box
sx={{
width: "fit-content",
height: "fit-content",
display: "flex",
justifyContent: "flex-start",
alignItems: "center",
p: 1,
gap: 1
}}
>
<Box
sx={{
width: "fit-content",
height: "fit-content",
background: "radial-gradient(circle, rgba(84,111,185,0.8074580173866421) 0%, rgba(53,141,198,0.7682423311121324) 100%)",
borderRadius: "15px",
boxShadow: 1,
padding: '5px',
paddingInline: '15px',
fontSize: '14px',
color: 'white',
fontWeight: '400',
display: "flex",
justifyContent: "center",
alignItems: "center",
}}
>
Latitude : <div style={{ fontSize: '12px', fontWeight: 200, marginLeft: "5px" }}> {clickedLatLng.lat} </div>
</Box>
<Box
sx={{
width: "fit-content",
height: "fit-content",
background: "radial-gradient(circle, rgba(84,111,185,0.8074580173866421) 0%, rgba(53,141,198,0.7682423311121324) 100%)",
borderRadius: "15px",
boxShadow: 1,
padding: '5px',
paddingInline: '15px',
fontSize: '14px',
color: 'white',
fontWeight: '400',
display: "flex",
justifyContent: "center",
alignItems: "center",
}}
>
Longitude : <div style={{ fontSize: '12px', fontWeight: 200, marginLeft: "5px" }}> {clickedLatLng.lng} </div>
</Box>
</Box>
</Box>}
</div>
)}
......
......@@ -12,12 +12,12 @@ import {
} from "@react-google-maps/api";
import { useSelector, useDispatch } from 'react-redux';
import { addBusiness } from '../../features/business';
import {FaRegCreditCard} from 'react-icons/fa';
import {BsFillClockFill} from 'react-icons/bs';
import {FaWheelchair} from 'react-icons/fa';
import {GrWheelchairActive} from 'react-icons/gr';
import {BsCashCoin} from 'react-icons/bs';
import {TbTruckDelivery} from 'react-icons/tb'
import { FaRegCreditCard } from 'react-icons/fa';
import { BsFillClockFill } from 'react-icons/bs';
import { FaWheelchair } from 'react-icons/fa';
import { GrWheelchairActive } from 'react-icons/gr';
import { BsCashCoin } from 'react-icons/bs';
import { TbTruckDelivery } from 'react-icons/tb'
export default function Review() {
const businessDetails = useSelector((state) => state.business)
......@@ -41,7 +41,7 @@ export default function Review() {
}, [businessDetails]);
const { isLoaded } = useLoadScript({
googleMapsApiKey: "AIzaSyDzvpMhG1TmXhpoCfPCq-G4snf-R0vSWF4"
googleMapsApiKey: "AIzaSyC_mV5GkYx8ULNDqXgwBobTczkM7j6T0uc"
});
return (
......@@ -50,46 +50,46 @@ export default function Review() {
Summary
</Typography>
{businessDetails && businessDetails.value[0].type == 'pharmacy' ?
<List disablePadding sx={{paddingInline:2}}>
<ListItem sx={{ py: 1, px: 0 }}>
<BsFillClockFill style={{color:'#ff802f',fontSize:'18px',marginRight:'8px'}}/> <ListItemText primary="Open 24 Hours" />
<Typography variant="subtitle1" sx={{ fontWeight: 500}}>{businessDetails.value[0].serviceDetails.open ? `Available` : `Not Available`}</Typography>
</ListItem>
<List disablePadding sx={{ paddingInline: 2 }}>
<ListItem sx={{ py: 1, px: 0 }}>
<BsFillClockFill style={{ color: '#ff802f', fontSize: '18px', marginRight: '8px' }} /> <ListItemText primary="Open 24 Hours" />
<Typography variant="subtitle1" sx={{ fontWeight: 500 }}>{businessDetails.value[0].serviceDetails.open ? `Available` : `Not Available`}</Typography>
</ListItem>
<ListItem sx={{ py: 1, px: 0 }}>
<TbTruckDelivery style={{color:'#800040',fontSize:'20px',marginRight:'8px'}}/> <ListItemText primary="Delivery Service" />
<Typography variant="subtitle1" sx={{ fontWeight: 500 }}>{businessDetails.value[0].serviceDetails.deliver ? `Available` : `Not Available`}</Typography>
</ListItem>
<ListItem sx={{ py: 1, px: 0 }}>
<TbTruckDelivery style={{ color: '#800040', fontSize: '20px', marginRight: '8px' }} /> <ListItemText primary="Delivery Service" />
<Typography variant="subtitle1" sx={{ fontWeight: 500 }}>{businessDetails.value[0].serviceDetails.deliver ? `Available` : `Not Available`}</Typography>
</ListItem>
<ListItem sx={{ py: 1, px: 0 }}>
<FaWheelchair style={{color:'#344ab1',fontSize:'20px',marginRight:'8px'}}/> <ListItemText primary="Wheel Chair Accesible Entrance" />
<Typography variant="subtitle1" sx={{ fontWeight: 500}}>{businessDetails.value[0].serviceDetails.whlentrence ? `Available` : `Not Available`}</Typography>
</ListItem>
<ListItem sx={{ py: 1, px: 0 }}>
<FaWheelchair style={{ color: '#344ab1', fontSize: '20px', marginRight: '8px' }} /> <ListItemText primary="Wheel Chair Accesible Entrance" />
<Typography variant="subtitle1" sx={{ fontWeight: 500 }}>{businessDetails.value[0].serviceDetails.whlentrence ? `Available` : `Not Available`}</Typography>
</ListItem>
<ListItem sx={{ py: 1, px: 0 }}>
<GrWheelchairActive style={{color:'#9370db',fontSize:'20px',marginRight:'8px'}}/> <ListItemText primary="Wheel Chair Accesible Car Park" />
<Typography variant="subtitle1" sx={{ fontWeight: 500 }}>{businessDetails.value[0].serviceDetails.whlpark ? `Available` : `Not Available`}</Typography>
</ListItem>
<ListItem sx={{ py: 1, px: 0 }}>
<GrWheelchairActive style={{ color: '#9370db', fontSize: '20px', marginRight: '8px' }} /> <ListItemText primary="Wheel Chair Accesible Car Park" />
<Typography variant="subtitle1" sx={{ fontWeight: 500 }}>{businessDetails.value[0].serviceDetails.whlpark ? `Available` : `Not Available`}</Typography>
</ListItem>
<ListItem sx={{ py: 1, px: 0 }}>
<BsCashCoin style={{color:'#34b13f',fontSize:'20px',marginRight:'8px'}}/> <ListItemText primary="Cash Payment" />
<Typography variant="subtitle1" sx={{ fontWeight: 500}}>{businessDetails.value[0].serviceDetails.cash ? `Available` : `Not Available`}</Typography>
</ListItem>
<ListItem sx={{ py: 1, px: 0 }}>
<BsCashCoin style={{ color: '#34b13f', fontSize: '20px', marginRight: '8px' }} /> <ListItemText primary="Cash Payment" />
<Typography variant="subtitle1" sx={{ fontWeight: 500 }}>{businessDetails.value[0].serviceDetails.cash ? `Available` : `Not Available`}</Typography>
</ListItem>
<ListItem sx={{ py: 1, px: 0 }}>
<FaRegCreditCard style={{color:'#006400',fontSize:'20px',marginRight:'8px'}}/> <ListItemText primary="Card Payment" />
<Typography variant="subtitle1" sx={{ fontWeight: 500}}>{businessDetails.value[0].serviceDetails.card ? `Available` : `Not Available`}</Typography>
</ListItem>
</List>
: <div></div>}
<ListItem sx={{ py: 1, px: 0 }}>
<FaRegCreditCard style={{ color: '#006400', fontSize: '20px', marginRight: '8px' }} /> <ListItemText primary="Card Payment" />
<Typography variant="subtitle1" sx={{ fontWeight: 500 }}>{businessDetails.value[0].serviceDetails.card ? `Available` : `Not Available`}</Typography>
</ListItem>
</List>
: <div></div>}
<Grid container spacing={2}>
<Grid item xs={12} >
<Typography variant="h6" gutterBottom sx={{ mt: 2,display:'flex',alignItems:'center',gap:'5px'}}>
<Typography variant="h6" gutterBottom sx={{ mt: 2, display: 'flex', alignItems: 'center', gap: '5px' }}>
Location {position && (
<div style={{fontSize:"12px",marginTop:'5px',color:'#c4c2c0',fontStyle:'italic'}}>
({position.lat}, {position.lng})
</div>
)}
<div style={{ fontSize: "12px", marginTop: '5px', color: '#c4c2c0', fontStyle: 'italic' }}>
({position.lat}, {position.lng})
</div>
)}
</Typography>
<div>
{isLoaded ?
......
......@@ -42,13 +42,13 @@ import { useSelector, useDispatch } from 'react-redux';
import { compareBusiness } from '../features/business';
import { useNavigate } from "react-router-dom";
import BGImage from '../images/vadim-bogulov-Vq-Sqr7D_7k-unsplash.jpg';
import {GiPathDistance} from 'react-icons/gi';
import {MdWork} from 'react-icons/md';
import {IoMdSchool} from 'react-icons/io';
import {HiShoppingBag} from 'react-icons/hi';
import {RiRestaurantFill} from 'react-icons/ri';
import {MdOutlineDeliveryDining} from 'react-icons/md';
import {AiOutlineClockCircle} from 'react-icons/ai';
import { GiPathDistance } from 'react-icons/gi';
import { MdWork } from 'react-icons/md';
import { IoMdSchool } from 'react-icons/io';
import { HiShoppingBag } from 'react-icons/hi';
import { RiRestaurantFill } from 'react-icons/ri';
import { MdOutlineDeliveryDining } from 'react-icons/md';
import { AiOutlineClockCircle } from 'react-icons/ai';
import { jsPDF } from "jspdf";
......@@ -271,7 +271,7 @@ const Results = () => {
const { isLoaded } = useLoadScript({
// Enter your own Google Maps API key
googleMapsApiKey: "AIzaSyDzvpMhG1TmXhpoCfPCq-G4snf-R0vSWF4"
googleMapsApiKey: "AIzaSyC_mV5GkYx8ULNDqXgwBobTczkM7j6T0uc"
});
const [checked, setChecked] = useState(true);
......@@ -293,9 +293,9 @@ const Results = () => {
}
const downloadReport = () => {
const doc = new jsPDF();
const doc = new jsPDF();
if (businessDetails.value[0].type == 'hotel') {
doc.setFontSize(22);
doc.setFont("courier", "bolditalic");
......@@ -311,7 +311,7 @@ const doc = new jsPDF();
doc.setFont("helvetica", "bold");
doc.text(`Final Prediction : ${businessDetails.value[0].ml_result}%`, 20, 90);
doc.save("Report.pdf");
} else if (businessDetails.value[0].type == 'restaurant'){
} else if (businessDetails.value[0].type == 'restaurant') {
doc.setFontSize(22);
......@@ -329,10 +329,10 @@ const doc = new jsPDF();
doc.text(`Education Related Places Count : ${businessDetails.value[0].locationFeatures.educationRelatedPlacesCount}`, 20, 70);
doc.text(`Office Related Places Count : ${businessDetails.value[0].locationFeatures.workPlacesCount}`, 20, 80);
doc.text(`Shopping Malls Count : ${businessDetails.value[0].locationFeatures.shoppingMallsCount}`, 20, 90);
doc.text(`Competitors Count : ${businessDetails.value[0].locationFeatures.competitors}`, 20, 100);
doc.text(`Competitors Count : ${businessDetails.value[0].locationFeatures.competitors}`, 20, 100);
doc.setFont("helvetica", "bold");
doc.text(`Final Prediction : ${businessDetails.value[0].ml_result}%`, 20, 110);
doc.save("Report.pdf");
doc.save("Report.pdf");
}
......@@ -351,11 +351,11 @@ const doc = new jsPDF();
gridTemplateColumns: "6fr 3fr",
gap: "30px",
padding: "50px 70px 50px 70px",
backgroundImage:`url(${BGImage})`,
backgroundImage: `url(${BGImage})`,
backgroundRepeat: 'no-repeat',
backgroundSize: 'cover',
backgroundAttachment:'fixed',
backgroundBlendMode:'overlay',
backgroundAttachment: 'fixed',
backgroundBlendMode: 'overlay',
}}>
......@@ -477,11 +477,11 @@ const doc = new jsPDF();
<Box className={classes.featuresBoxFlex}>
<div className={classes.featureTitleTxt}>Location Based Features</div>
<Box className={classes.featuresBox}>
<div className={classes.features}><GiPathDistance style={{ color: '#df5e52',fontSize: '20px' }} />Distance to city - {businessDetails && businessDetails.value[0].locationFeatures.distanceToCity}</div>
<div className={classes.features}><HiShoppingBag style={{ color: '#2f9f48',fontSize: '20px' }} />Education Related Places Count - {businessDetails && businessDetails.value[0].locationFeatures.educationRelatedPlacesCount}</div>
<div className={classes.features}><IoMdSchool style={{ color: '#ce7c39',fontSize: '20px' }} />Shopping Malls Count - {businessDetails && businessDetails.value[0].locationFeatures.shoppingMallsCount}</div>
<div className={classes.features}><MdWork style={{ color: '#4e4c2e',fontSize: '20px' }} />Shopping Malls Count - {businessDetails && businessDetails.value[0].locationFeatures.workPlacesCount}</div>
<div className={classes.features}><RiRestaurantFill style={{ color: '#e2da5f',fontSize: '20px' }} />Competitors Count - {businessDetails && businessDetails.value[0].locationFeatures.competitors}</div>
<div className={classes.features}><GiPathDistance style={{ color: '#df5e52', fontSize: '20px' }} />Distance to city - {businessDetails && businessDetails.value[0].locationFeatures.distanceToCity}</div>
<div className={classes.features}><HiShoppingBag style={{ color: '#2f9f48', fontSize: '20px' }} />Education Related Places Count - {businessDetails && businessDetails.value[0].locationFeatures.educationRelatedPlacesCount}</div>
<div className={classes.features}><IoMdSchool style={{ color: '#ce7c39', fontSize: '20px' }} />Shopping Malls Count - {businessDetails && businessDetails.value[0].locationFeatures.shoppingMallsCount}</div>
<div className={classes.features}><MdWork style={{ color: '#4e4c2e', fontSize: '20px' }} />Shopping Malls Count - {businessDetails && businessDetails.value[0].locationFeatures.workPlacesCount}</div>
<div className={classes.features}><RiRestaurantFill style={{ color: '#e2da5f', fontSize: '20px' }} />Competitors Count - {businessDetails && businessDetails.value[0].locationFeatures.competitors}</div>
</Box>
</Box>
......
......@@ -3,53 +3,46 @@ import { createSlice } from '@reduxjs/toolkit'
export const businessSlice = createSlice({
name: "business",
initialState: {
value: [{
"type": "hotel",
"latitude": 6.704581206797783,
"longitude": 81.27638881048588,
"serviceDetails": {
"pool": true,
"beach": true,
"wifi": true,
"ac": false,
"parking": false
},
"locationFeatures": {
"attractionPlacesCount": 1,
"transportationModesCount": 0,
"nearByHotelReviewCount": 0,
"competitors": 0
},
"businessCount": {
"atmCount": 0,
"restaurantCount": 0,
"hospitalCount": 0,
"pharmacyCount": 0,
"gasStationCount": 0,
"movieTheaterCount": 0,
"hotelCount": 0
},
"ml_result": 48.6782
}
]
value: []
},
reducers: {
addBusiness: (state, action) => {
// state.value.push(action.payload)
console.log("sssssssssssssssssss", action.payload)
state.value[0] = action.payload
},
addNewBusiness: (state, action) => {
let temp = []
for (let i = 0; i < state.value.length; i++) {
if (i == 0) {
temp.push("")
}
temp.push(state.value[i])
}
// state.value.push(action.payload)
state.value= [];
console.log("temppppppppppppppppppppppppppppppppppppppppppp", temp)
state.value = temp;
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
// console.log("action.payload", action.payload)
// state.value[action.payload.length] = state.value[0]
// state.value[0] = null
let temp = []
for (let i = 0; i < state.value.length; i++) {
if (i == 0) {
temp.push("")
}
temp.push(state.value[i])
}
// state.value.push(action.payload)
// console.log("temppppppppppppppppppppppppppppppppppppppppppp", temp)
state.value = temp;
state.value[0] = action.payload
},
}
});
export const { addBusiness: addBusiness, compareBusiness: compareBusiness ,addNewBusiness:addNewBusiness} = businessSlice.actions;
export const { addBusiness: addBusiness, compareBusiness: compareBusiness, addNewBusiness: addNewBusiness } = businessSlice.actions;
export default businessSlice.reducer;
\ No newline at end of file
......@@ -5,7 +5,7 @@ export const userSlice = createSlice({
name: "user",
initialState: {
value: [],
userDetails: null,
userDetails: [],
},
reducers: {
login: (state, action) => {
......
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