From 41c4e29c5c3bef2874158f7b8f21d78093be2850 Mon Sep 17 00:00:00 2001 From: Nishant Kaushal <101548649+nishant0708@users.noreply.github.com> Date: Wed, 12 Jun 2024 04:29:44 +0530 Subject: [PATCH] Added FooD List Menu --- server/controllers/canteenController.js | 14 +- src/App.css | 3 + src/pages/AddFoodItem.jsx | 2 +- src/pages/Foodlist.jsx | 225 ++++++++++++++++++++++++ src/pages/Login.jsx | 5 +- src/pages/SectionPage.jsx | 46 +++-- 6 files changed, 270 insertions(+), 25 deletions(-) create mode 100644 src/pages/Foodlist.jsx diff --git a/server/controllers/canteenController.js b/server/controllers/canteenController.js index f3d5b1b..fc4e569 100644 --- a/server/controllers/canteenController.js +++ b/server/controllers/canteenController.js @@ -28,7 +28,7 @@ const getBreakfast = async(req , res , next) =>{ try{ const id = req.params.id; - console.log(id); + const breakfastData = await Breakfast.find({ canteen: id }).select("dish").select("dishId").exec(); @@ -118,9 +118,9 @@ const addBreakfastDish = asyncHandler(async (req, res, next) => { // Controller function to remove a breakfast dish const removeBreakfastDish = asyncHandler(async (req, res, next) => { const canteenId = req.params.id; - const { dish } = req.body; + const dish = req.body._id; - await Breakfast.deleteOne({ canteen: canteenId, dish }).exec(); + await Breakfast.deleteOne({ _id:dish }).exec(); res.json({ message: 'Dish removed successfully' }); }); @@ -147,9 +147,9 @@ const addLunchDish = asyncHandler(async (req, res, next) => { // Controller function to remove a lunch dish const removeLunchDish = asyncHandler(async (req, res, next) => { const canteenId = req.params.id; - const { dish } = req.body; + const dish = req.body._id; - await Lunch.deleteOne({ canteen: canteenId, dish }).exec(); + await Lunch.deleteOne({ _id:dish }).exec(); res.json({ message: 'Dish removed successfully' }); }); @@ -175,9 +175,9 @@ const addDinnerDish = asyncHandler(async (req, res, next) => { // Controller function to remove a dinner dish const removeDinnerDish = asyncHandler(async (req, res, next) => { const canteenId = req.params.id; - const { dish } = req.body; + const dish = req.body._id; - await Dinner.deleteOne({ canteen: canteenId, dish }).exec(); + await Dinner.deleteOne({ _id:dish }).exec(); res.json({ message: 'Dish removed successfully' }); }); diff --git a/src/App.css b/src/App.css index 74b5e05..d123d60 100644 --- a/src/App.css +++ b/src/App.css @@ -12,6 +12,9 @@ animation: App-logo-spin infinite 20s linear; } } +li:hover span { + opacity: 1; +} .App-header { background-color: #282c34; diff --git a/src/pages/AddFoodItem.jsx b/src/pages/AddFoodItem.jsx index 2bc0e77..7e25280 100644 --- a/src/pages/AddFoodItem.jsx +++ b/src/pages/AddFoodItem.jsx @@ -83,7 +83,7 @@ function AddFoodItem() { }; return ( -