Grocery comparison feature

parent 9d1c9166
API_KEY_SECRET = 'AIzaSyDzvpMhG1TmXhpoCfPCq-G4snf-R0vSWF4'
API_KEY_SECRET = 'AIzaSyC_mV5GkYx8ULNDqXgwBobTczkM7j6T0uc'
JWT_SECRET = cb6969137082baf1baeeed271a270ae29dde0c6f5775e9508e808965405c99b5
BASE_URL = http://localhost:3000/
HOST=smtp.gmail.com
......
......@@ -27,6 +27,7 @@ import InputGroceryDetails from './components/InputGroceryDetails';
import MultipleResult from './components/MultipleResult';
import ResultsWOTypes from './components/ResultsWOTypes';
import LocationBasedPredict from './components/LocationBasedPredict';
import MultipleResultG from './components/Grocery Input/MultipleResultG'
const store = configureStore({
reducer: {
......@@ -61,6 +62,7 @@ function App() {
<Route path="/resultWOTypes" element={<ResultsWOTypes/>} />
<Route path="/Service" element={<BusinessTypePage />} />
<Route path="/locationBasedPredict" element={<LocationBasedPredict />} />
<Route path="/multipleResultG" element={<MultipleResultG/>} />
</Route>
</Routes>
<Footer />
......
......@@ -85,13 +85,21 @@ export default function InputDetails() {
"longitude": businessDetails.value[0].longitude
}
API.post('grocery/grocerycompetitor',body).then((competResult)=>{
const competitorsCount = competResult.data.CompetitorCount
API.post('grocery/grocerycompetitor',body).then((competResult)=>{
const competitorsCount = competResult.data.CompetitorCount
API.post('grocery/grocerytraffci',body).then((trafficResult)=>{
const trafficSum = trafficResult.data.TraffciSummation
API.post('grocery/grocerytraffci',body).then((trafficResult)=>{
console.log("tree--->",trafficResult)
var trafficSum;
if(!trafficResult.data.TraffciSummation){
trafficSum=0
}
else{
trafficSum = trafficResult.data.TraffciSummation
}
console.log("comp:",competitorsCount,"traffic:",trafficSum)
console.log("comp:",competitorsCount,"traffic:",trafficSum)
let groceryModelReq = {
"Trafficflow": trafficSum,
......@@ -112,14 +120,22 @@ export default function InputDetails() {
let locationFeatures = {
trafficSum: trafficSum,
competitorsCount: competitorsCount,
Instoreshopping:businessDetails.value[0].serviceDetails.shopping ? "available" : "unavalable",
Delivery:businessDetails.value[0].serviceDetails.delivery ?"available" : "unavalable",
Website: businessDetails.value[0].serviceDetails.web ? "available" : "unavalable",
Parking :businessDetails.value[0].serviceDetails.parking ?"available" : "unavalable"
}
console.log(groceryModelReq)
axios.post(' http://127.0.0.1:5000/grocery', groceryModelReq)
.then(function (GroceryResult) {
console.log("Prediction", GroceryResult.data)
dispatch(addBusiness({
...businessDetails.value[0], locationFeatures: locationFeatures, ml_result: GroceryResult.data.data
}))
navigate(`/result`)
if (businessDetails.value.length > 1) {
navigate(`/multipleResultG`)
}else{navigate(`/result`)}
handleClose()
}).catch((error)=>{
console.log("error:",error)
......
This diff is collapsed.
......@@ -186,6 +186,11 @@ const MultipleResult = () => {
dispatch(addBusiness({ 'type': 'restaurant' }))
navigate('/inputHotel');
}
else if (businessDetails.value[businessDetails.value.length - 1].type == 'grocery') {
dispatch(addBusiness({ 'type': 'grocery' }))
navigate('/inputGrocery');
}
}
......
......@@ -49,7 +49,9 @@ 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 {BiWorld} from 'react-icons/bi';
import { AiOutlineShoppingCart,AiFillCalendar } from "react-icons/ai";
import { TbTruckDelivery } from "react-icons/tb";
import { jsPDF } from "jspdf";
ChartJS.register(
......@@ -288,6 +290,10 @@ const Results = () => {
dispatch(addBusiness({ 'type': 'restaurant' }))
navigate('/inputHotel');
}
else if (businessDetails.value[businessDetails.value.length - 1].type == 'Grocery') {
dispatch(addBusiness({ 'type': 'Grocery' }))
navigate('/inputGrocery');
}
}
......@@ -334,6 +340,29 @@ const doc = new jsPDF();
doc.text(`Final Prediction : ${businessDetails.value[0].ml_result}%`, 20, 110);
doc.save("Report.pdf");
}
else if (businessDetails.value[0].type == 'Grocery'){
doc.setFontSize(22);
doc.setFont("courier", "bolditalic");
doc.text("Grocery Success Percentage Prediction", 105, 8, null, null, "center");
doc.setFont("helvetica", "normal");
doc.setFontSize(16);
doc.text(`Type : ${businessDetails.value[0].type}`, 20, 30);
doc.setFont("helvetica", "normal");
doc.setFontSize(16);
doc.text(`Type : ${businessDetails.value[0].type}`, 20, 30);
doc.text(`Latitude : ${businessDetails.value[0].latitude}`, 20, 40);
doc.text(`Longitude : ${businessDetails.value[0].longitude}`, 20, 50);
doc.text(`Traffic Summation : ${businessDetails.value[0].locationFeatures.trafficSum}`, 20, 60);
doc.text(`In-Store-Shopping : ${businessDetails.value[0].locationFeatures.Instoreshopping}`, 20, 70);
doc.text(`Delivery : ${businessDetails.value[0].locationFeatures.Delivery}`, 20, 80);
doc.text(`Website : ${businessDetails.value[0].locationFeatures.Website}`, 20, 90);
doc.text(`Competitors Count : ${businessDetails.value[0].locationFeatures.competitorsCount}`, 20, 100);
doc.setFont("helvetica", "bold");
doc.text(`Final Prediction : ${businessDetails.value[0].ml_result}%`, 20, 110);
doc.save("Report.pdf");
}
......@@ -494,7 +523,52 @@ const doc = new jsPDF();
</Box>
</Box>
</Box>
:
: businessDetails && businessDetails.value[0].type == 'Grocery' ?
<Box
sx={{
width: "100%",
height: "100%",
display: "flex",
justifyContent: "space-between",
alignItems: "center",
gap: "20px",
boxSizing: "border-box",
}}>
<Box className={classes.featuresBoxFlex}>
<div className={classes.featureTitleTxt}>Grocery Location Based Features</div>
<Box className={classes.featuresBox}>
<Grow in={checked} style={{ transformOrigin: '0 0 0' }} {...(checked ? { timeout: 500 } : {})} >
<div className={classes.features}><GiPathDistance style={{ color: '#df5e52',fontSize: '20px' }} />Competitors Count - {businessDetails.value[0].locationFeatures.competitorsCount}</div>
</Grow>
<Grow in={checked} style={{ transformOrigin: '0 0 0' }} {...(checked ? { timeout: 800 } : {})} >
<div className={classes.features}><HiShoppingBag style={{ color: '#2f9f48',fontSize: '20px' }} />Traffic around the area - {businessDetails.value[0].locationFeatures.trafficSum}</div>
</Grow>
</Box>
</Box>
<Box className={classes.featuresBoxFlex}>
<div className={classes.featureTitleTxt}>Service Based Features</div>
<Box className={classes.featuresBox}>
<Grow in={checked} style={{ transformOrigin: '0 0 0' }} {...(checked ? { timeout: 1100 } : {})} >
<div className={classes.features}><AiOutlineShoppingCart style={{ color: '#ce7c39',fontSize: '20px' }} />In-store shopping - {businessDetails.value[0].locationFeatures.Instoreshopping}</div>
</Grow>
<Grow in={checked} style={{ transformOrigin: '0 0 0' }} {...(checked ? { timeout: 1400 } : {})} >
<div className={classes.features}><TbTruckDelivery style={{ color: '#df5e52',fontSize: '20px' }} />Delivery - {businessDetails.value[0].locationFeatures.Delivery}</div>
</Grow>
<Grow in={checked} style={{ transformOrigin: '0 0 0' }} {...(checked ? { timeout: 1400 } : {})} >
<div className={classes.features}><BiWorld style={{ color: '#e2da5f',fontSize: '20px' }} /> Website - {businessDetails.value[0].locationFeatures.Website}</div>
</Grow>
<Grow in={checked} style={{ transformOrigin: '0 0 0' }} {...(checked ? { timeout: 1400 } : {})} >
<div className={classes.features}><RiParkingBoxLine style={{ color: '#e2da5f',fontSize: '20px' }} /> Parking - {businessDetails.value[0].locationFeatures.Parking}</div>
</Grow>
</Box>
</Box>
</Box>
:
<div>
</div>}
......
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