diff --git a/app.js b/app.js
index 3a8b728..18e83a5 100644
--- a/app.js
+++ b/app.js
@@ -5,8 +5,10 @@ const bodyParser = require("body-parser");
const path = require('path');
const app = express();
+
const moment = require('moment');
const hbs = require('nodemailer-express-handlebars');
+const methodOverride = require('method-override');
const {transporter}=require("./helpers/emailHelpers")
@@ -16,6 +18,7 @@ const Admin=require("./model/admin")
app.use(bodyParser.urlencoded({ extended: true }));
app.use(express.static("public"));
+app.use(methodOverride('_method'));
const NGO=require("./model/ngo")
const isAdmin=require("./middleware/isAdmin");
diff --git a/public/css/ngo_dashboard.css b/public/css/ngo_dashboard.css
index 019a4b8..92948ac 100644
--- a/public/css/ngo_dashboard.css
+++ b/public/css/ngo_dashboard.css
@@ -1,9 +1,52 @@
body {
min-height: 100vh;
- background-color: var(--primary-color);
transition: background-color var(--tran-03);
margin: 0;
font-family: "Poppins", sans-serif;
+ background-color: #e7e5e586;
+}
+.uil{
+ font-size: 1.5rem;
+}
+.nav-links {
+ padding: 0rem 1rem;
+}
+
+.logout-mode{
+ padding-left: 1.2rem;
+}
+
+/* Edit Form */
+.Edit_profile{
+ display: none;
+ justify-content: center;
+ align-items: center;
+}
+.edit_header{
+ text-align: center;
+ margin-bottom: 1rem;
+}
+.Edit_profile h4{
+ margin-bottom: 7px;
+}
+.Edit_profile button{
+ padding: 0.6rem 2rem;
+ border-radius: 10px;
+ margin: 1rem 0rem;
+ cursor: pointer;
+ font-size: medium;
+ border: 0;
+}
+.update-btn{
+ background-color: orange;
+
+}
+.cancle-btn{
+ background-color: #3e8e41;
+}
+.edit-btns{
+ display: flex;
+ justify-content: space-between;
}
body.dark {
@@ -37,6 +80,7 @@ body.dark {
border-radius: 12%;
}
+
.NAME-block {
display: flex;
gap: 5px;
@@ -54,28 +98,25 @@ body.dark {
.top-border {
border-style: double;
border-color: #f07070;
+
}
.Left-name {
+ font-weight: 500;
+ font-size: 20px;
display: inline-block;
position: absolute;
right: 3%;
- padding-top: 3px;
+
}
.top {
display: flex;
justify-content: space-between;
align-items: center;
- padding: 10px;
+ padding: 1.2rem 1rem;
}
-.Profile-sec {
- display: flex;
- padding: 9%;
- justify-content: center;
- align-content: center;
-}
.dashboard {
display: inline-block;
@@ -104,7 +145,7 @@ body.dark {
.dash {
position: fixed;
- left: 35px;
+ left: 80px;
}
/* aditya End */
@@ -126,8 +167,10 @@ body.dark {
}
nav .logo-name {
+ text-decoration: none;
display: flex;
align-items: center;
+ padding: 1rem 0rem 1rem 0rem;
}
nav .logo-img {
@@ -150,7 +193,7 @@ nav .logo-name .logo_name {
}
nav .menu-items {
- margin-top: 40px;
+ margin-top: 10px;
height: calc(100% - 90px);
display: flex;
flex-direction: column;
@@ -162,12 +205,17 @@ nav .menu-items {
}
.menu-items li a {
+ color :#242526;
display: flex;
align-items: center;
height: 50px;
text-decoration: none;
position: relative;
}
+.manu-items li a:hover{
+ background-color: #d8d6d6;
+ border-radius: 10px;
+}
.nav-links li a:hover:before {
content: "";
@@ -175,11 +223,12 @@ nav .menu-items {
height: 5px;
width: 5px;
border-radius: 50%;
- background-color: var(--primary-color);
+ /* background-color: var(--primary-color); */
left: -7px;
}
.menu-items li {
+ margin-bottom: 1rem;
list-style: none;
}
@@ -195,8 +244,8 @@ nav .menu-items {
.menu-items li a .link-name {
font-size: 18px;
- font-weight: 400;
- color: green;
+ font-weight: 600;
+
}
.nav-links li a:hover i,
@@ -247,6 +296,10 @@ body.dark .switch::before {
}
body.dark .Profile-sec {
+ background-color: #5b5a5a;
+ color: #fff;
+}
+body.dark .Profile-sec .card {
background-color: #333;
color: #fff;
}
diff --git a/public/img/user.ico b/public/img/user.ico
new file mode 100644
index 0000000..0786064
Binary files /dev/null and b/public/img/user.ico differ
diff --git a/public/img/userProfile.jpg b/public/img/userProfile.jpg
new file mode 100644
index 0000000..b369d17
Binary files /dev/null and b/public/img/userProfile.jpg differ
diff --git a/routers/NgoRoutes.js b/routers/NgoRoutes.js
index 887bb97..3b871b0 100644
--- a/routers/NgoRoutes.js
+++ b/routers/NgoRoutes.js
@@ -15,6 +15,33 @@ const Admin = require("../model/admin");
const NGO = require("../model/ngo");
const Query = require("../model/query"); // Adjust the path based on your project structure
+
+router.post("/ngo",async(req,res)=>{
+ let {email,fullName,phoneNo,address} =req.body;
+ let id=req.query.id;
+ let ngo=await NGO.findByIdAndUpdate(id,{NGOName:fullName,Mobile:phoneNo,NgoLocation:address, username:email},{new:true});
+
+ const dooner = await User.find();
+ console.log(ngo);
+ return res.render("NGO-Dashboard", {
+ userId:ngo._id,
+ fullName: ngo.NGOName,
+ email: ngo.username,
+ id: ngo.NGOID,
+ phoneNo: ngo.Mobile,
+ address: ngo.NgoLocation,
+ Donation: dooner,
+ Pickup: dooner,
+ complain: "",
+ });
+})
+
+router.post("/ngo/:id",async(req,res)=>{
+ let deletedngo=await NGO.findByIdAndDelete(req.params.id);
+ console.log(deletedngo);
+ res.redirect("/")
+})
+
router.post("/NGO-login", async (req, res) => {
const username = req.body.username;
const password = req.body.password;
@@ -30,11 +57,12 @@ router.post("/NGO-login", async (req, res) => {
const dooner = await User.find(); // Assuming User is your Mongoose model for users
res.render("NGO-Dashboard", {
+ userId:ngo._id,
fullName: ngo.NGOName,
email: ngo.username,
id: ngo.NGOID,
phoneNo: ngo.Mobile,
- address: ngo.NGOLocation,
+ address: ngo.NgoLocation,
Donation: dooner,
Pickup: dooner,
complain: "",
@@ -326,11 +354,12 @@ router.route("/reset-password-ngo").post(async (req, res) => {
const dooner = await User.find();
return res.render("NGO-DashBoard", {
+ userId:ngo._id,
fullName: ngo.NGOName,
email: ngo.username,
id: ngo.NGOID,
phoneNo: ngo.Mobile,
- address: ngo.NGOLocation,
+ address: ngo.NgoLocation,
Donation: dooner,
Pickup: dooner,
complain: "",
diff --git a/routers/userRoutes.js b/routers/userRoutes.js
index 281a298..04e2d40 100644
--- a/routers/userRoutes.js
+++ b/routers/userRoutes.js
@@ -72,6 +72,41 @@ router.post("/", async function (req, res) {
}
});
+
+router.post("/user",async(req,res)=>{
+ let {email,fullName,phoneNo,address} =req.body;
+ console.log(req.body);
+ let id=req.query.id;
+ let foundUser=await User.findByIdAndUpdate(id,{fullName:fullName,Mobile:phoneNo,address:address, email:email},{new:true});
+ // res.redirect("/login");
+ const userQuerys = await Query.find({ user_id: foundUser._id });
+
+ const donationInfo = {
+ food: foundUser.foodInventory,
+ city: foundUser.city,
+ flat: foundUser.flatNo,
+ destination: foundUser.destinaion,
+ acceptedBy: foundUser.acceptedBy,
+ status: foundUser.status,
+ };
+
+ return res.render("UserDashBoard", {
+ userId:foundUser._id,
+ fullName: foundUser.fullName,
+ email: foundUser.email,
+ phoneNo: foundUser.Mobile,
+ address: foundUser.address,
+ complain: userQuerys,
+ donationInfo: donationInfo,
+ });
+})
+
+router.post("/user/:id",async (req,res)=>{
+ // console.log(req.params.id);
+ await User.findByIdAndDelete(req.params.id);
+ return res.redirect("/");
+})
+
// user login (seems to be something wrong here - user cant login even if he gives correct credentials)
router.post("/login", async function (req, res) {
const { username, password } = req.body;
@@ -98,6 +133,7 @@ router.post("/login", async function (req, res) {
if (result) {
return res.render("UserDashBoard", {
+ userId:foundUser._id,
fullName: foundUser.fullName,
email: foundUser.email,
phoneNo: foundUser.Mobile,
@@ -217,6 +253,7 @@ router.post("/approve-donation/:email/:ngoEmail", async (req, res) => {
const dooner = await User.find(); // Assuming User is your Mongoose model for users
res.render("NGO-Dashboard", {
+ userId:ngo._id,
fullName: ngo.NGOName,
email: ngo.username,
id: ngo.NGOID,
@@ -321,6 +358,7 @@ router.post("/User_singUp", async function (req, res) {
const userQuerys = await Query.find({ user_id: foundUser._id });
return res.render("UserDashBoard", {
+ userId:foundUser._id,
fullName: foundUser.fullName,
email: foundUser.email,
phoneNo: foundUser.Mobile,
@@ -465,6 +503,7 @@ router.route("/reset-password-user").post(async (req, res) => {
await user.save();
const userQuerys = await Query.find({ user_id: user._id });
return res.render("UserDashBoard", {
+ userId:user._id,
fullName: user.fullName,
email: user.email,
phoneNo: user.Mobile,
@@ -497,6 +536,7 @@ router.post("/delete-query/:id/:email", async (req, res) => {
const userQuerys = await Query.find({ user_id: foundUser._id });
return res.render("UserDashBoard", {
+ userId:foundUser._id,
fullName: foundUser.fullName,
email: foundUser.email,
phoneNo: foundUser.Mobile,
@@ -542,6 +582,7 @@ router.post("/donation-status/:email", async (req, res) => {
};
const userQuerys = await Query.find({ user_id: user._id });
return res.render("UserDashBoard", {
+ userId:user._id,
fullName: user.fullName,
email: user.email,
phoneNo: user.Mobile,
@@ -554,6 +595,7 @@ router.post("/donation-status/:email", async (req, res) => {
const ngo = await NGO.findOne({ NGOName: user.acceptedBy });
res.render("NGO-Dashboard", {
+ userId:user._id,
fullName: ngo.NGOName,
email: ngo.username,
id: ngo.NGOID,
diff --git a/views/NGO-Dashboard.ejs b/views/NGO-Dashboard.ejs
index 9ce8e19..4d8f131 100644
--- a/views/NGO-Dashboard.ejs
+++ b/views/NGO-Dashboard.ejs
@@ -14,6 +14,89 @@