This commit is contained in:
omkieit 2024-10-01 18:14:18 +05:30
parent c43f306d57
commit 170d7525d0
7 changed files with 479 additions and 205 deletions

View File

@ -10,7 +10,7 @@ const secret = process.env.SECRET_KEY;
// This is signup
export const signup = async (req, res) => {
const { title, email, password, firstName, middleName, lastName, termsconditions, userType } = req.body;
const { title, email, password, firstName, middleName, lastName, termsconditions, userType, profileImage } = req.body;
function generateRandomNumber() {
return Math.floor(Math.random() * 90000) + 10000;
@ -39,6 +39,7 @@ export const signup = async (req, res) => {
termsconditions,
userType,
userId:userId,
profileImage,
});
// Generate JWT (if needed)
@ -216,11 +217,14 @@ export const resetPassword = async (req, res) => {
export const updateUser = async (req, res) => {
try {
const { userId, title, firstName, middleName, lastName, email, aboutme, profileImage } = req.body;
const {
userId, title, firstName,
middleName, lastName, email,
aboutme, city, state, county, zip, profileImage } = req.body;
// Use findOneAndUpdate instead, querying by userId (custom field)
const updatedUser = await UserModal.findOneAndUpdate(
{ userId }, // Query by custom userId, not ObjectId
{ title, firstName, middleName, lastName, email, aboutme, profileImage },
{ title, firstName, middleName, lastName, email, aboutme, city, state, county, zip, profileImage },
{ new: true } // Return the updated document
);

View File

@ -9,6 +9,10 @@ const userSchema = new mongoose.Schema({
profileImage:String,
// profileImage: { type: String, required: true, unique: true },
aboutme: { type: String, required: true, unique: true },
city: { type: String, required: true, unique: true },
state: { type: String, required: true, unique: true },
county: { type: String, required: true, unique: true },
zip: { type: String, required: true, unique: true },
password: { type: String, required: true },
termsconditions:{type: String,},
userType:{ type: String, required: true },

File diff suppressed because one or more lines are too long

View File

@ -45,7 +45,7 @@
<script type="module" crossorigin src="/assets/index-DPPwfV95.js"></script>
<script type="module" crossorigin src="/assets/index-BFXSv0_C.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-iEl-il0E.css">
</head>

View File

@ -2,6 +2,8 @@ import { useEffect } from "react";
import { useDispatch, useSelector } from "react-redux";
import { showUser } from "../redux/features/userSlice";
import { useParams } from "react-router-dom";
import profilepic from "../img/samplepic.jpg";
import propertydummy from "../img/propertydummy.jpg";
import "../profileview.css";
import Navbar from "./Navbar";
@ -39,201 +41,217 @@ const ProfileView = () => {
<div className="card-body">
<div className="d-flex flex-column align-items-center text-center">
<img
src="https://bootdey.com/img/Content/avatar/avatar7.png"
// src={user.profileImage}
// src="https://bootdey.com/img/Content/avatar/avatar7.png"
src={user.profileImage}
alt="Admin"
className="rounded-circle"
width={150}
/>
<div className="mt-3">
<h4>John Doe</h4>
<p className="text-secondary mb-1">Full Stack Developer</p>
<p className="text-muted font-size-sm">
Bay Area, San Francisco, CA
</p>
{/* <button className="btn btn-outline-primary">Message</button> */}
</div>
<h4>
{user.title}. {user.firstName} {user.middleName}{" "}
{user.lastName}
</h4>
{/* <span className="text-secondary mb-1">Full Stack Developer</span> */}
<span className="text-muted font-size-sm">
<i
className="fa fa-map-marker"
style={{ color: "#F74B02", fontSize: "20px" }} // Set the desired font size here
/>
{" "}
{user.city}, {user.state}, {user.county}, {user.zip}
</span>
{/* <button className="btn btn-outline-primary">Message</button> */}
</div>
</div>
</div>
</div>
<div className="col-md-8">
<div className="col-md-4 mb-3">
<div className="card">
<div className="card-body">
<h1
className="d-flex align-items-center mb-3"
style={{ color: "#F74B02", fontSize: "26px" }}
>
<i
className="material-icons text-info mr-2"
style={{ color: "#fda417", fontSize: "26px" }}
>
Recent
</i>
Project investments
</h1>
<img
src={propertydummy}
alt="Admin"
className="rounded-circle"
style={{
marginRight: "10px",
maxWidth: "50px",
maxHeight: "50px",
}}
/>
<small>Web Design project in California</small>
<div
className="progress"
style={{ width: "100%", marginTop: "10px" }}
>
<div
className="progress-bar"
role="progressbar"
style={{ width: "25%" }}
aria-valuenow={25}
aria-valuemin={0}
aria-valuemax={100}
>
25% completed
</div>
</div>
<hr />
<img
src={propertydummy}
alt="Admin"
className="rounded-circle"
style={{
marginRight: "10px",
maxWidth: "50px",
maxHeight: "50px",
}}
/>
<small>Web Design project in California</small>
<div
className="progress"
style={{ width: "100%", marginTop: "10px" }}
>
<div
className="progress-bar"
role="progressbar"
style={{ width: "75%" }}
aria-valuenow={75}
aria-valuemin={0}
aria-valuemax={100}
>
75% completed
</div>
</div>
</div>
</div>
</div>
<div className="col-md-4 mb-3">
<div className="card">
<div className="card-body">
<h1
className="d-flex align-items-center mb-3"
style={{ color: "#F74B02", fontSize: "26px" }}
>
<i className="material-icons text-info mr-2">Projects</i>
Seeking investments
</h1>
<img
src={propertydummy}
alt="Admin"
className="rounded-circle"
style={{
marginRight: "10px",
maxWidth: "50px",
maxHeight: "50px",
}}
/>
<small>Web Design project in California</small>
<br /> <br />
<hr />
<img
src={propertydummy}
alt="Admin"
className="rounded-circle"
style={{
marginRight: "10px",
maxWidth: "50px",
maxHeight: "50px",
}}
/>
<small>Web Design project in California</small>
<br /> <br />
</div>
</div>
</div>
<div className="col-md-4">
<div className="card mb-3">
<div className="card-body">
<div className="row">
<div className="col-sm-3">
<h6 className="mb-0">Full Name</h6>
</div>
<div className="col-sm-9 text-secondary">Kenneth Valdez</div>
</div>
<hr />
<div className="row">
<div className="col-sm-3">
<h6 className="mb-0">Email</h6>
</div>
<div className="col-sm-9 text-secondary">fip@jukmuh.al</div>
</div>
<hr />
<div className="row">
<div className="col-sm-3">
<h6 className="mb-0">Phone</h6>
</div>
<div className="col-sm-9 text-secondary">(239) 816-9029</div>
</div>
<hr />
<div className="row">
<div className="col-sm-3">
<h6 className="mb-0">Mobile</h6>
</div>
<div className="col-sm-9 text-secondary">(320) 380-4539</div>
</div>
<hr />
<div className="row">
<div className="col-sm-3">
<h6 className="mb-0">Address</h6>
</div>
<div className="col-sm-9 text-secondary">
Bay Area, San Francisco, CA
</div>
</div>
<hr />
This is about me content
<br /> <br />
<br />
<br />
<br /> <br />
<br />
<br />
<br /> <br />
<br />
<br />
</div>
</div>
<div className="row gutters-sm">
<div className="col-sm-6 mb-3">
<div className="card h-100">
<div className="card-body">
<h6 className="d-flex align-items-center mb-3">
<i className="material-icons text-info mr-2">
assignment
</i>
Project Status
</h6>
<small>Web Design</small>
<div className="progress mb-3" style={{ height: "5px" }}>
<div
className="progress-bar bg-primary"
role="progressbar"
style={{ width: "80%" }}
aria-valuenow={80}
aria-valuemin={0}
aria-valuemax={100}
/>
</div>
<small>Website Markup</small>
<div className="progress mb-3" style={{ height: "5px" }}>
<div
className="progress-bar bg-primary"
role="progressbar"
style={{ width: "72%" }}
aria-valuenow={72}
aria-valuemin={0}
aria-valuemax={100}
/>
</div>
<small>One Page</small>
<div className="progress mb-3" style={{ height: "5px" }}>
<div
className="progress-bar bg-primary"
role="progressbar"
style={{ width: "89%" }}
aria-valuenow={89}
aria-valuemin={0}
aria-valuemax={100}
/>
</div>
<small>Mobile Template</small>
<div className="progress mb-3" style={{ height: "5px" }}>
<div
className="progress-bar bg-primary"
role="progressbar"
style={{ width: "55%" }}
aria-valuenow={55}
aria-valuemin={0}
aria-valuemax={100}
/>
</div>
<small>Backend API</small>
<div className="progress mb-3" style={{ height: "5px" }}>
<div
className="progress-bar bg-primary"
role="progressbar"
style={{ width: "66%" }}
aria-valuenow={66}
aria-valuemin={0}
aria-valuemax={100}
/>
</div>
</div>
</div>
</div>
<div className="col-md-4 mb-3">
<div className="card">
<div className="card-body">
<div className="d-flex flex-column align-items-center text-center">
<div className="mt-3">
<h2
style={{
color: "#fda417",
border: "#fda417",
fontSize: "40px",
fontWeight: "bold",
}}
>
$ 500,000
</h2>
<span className="text-secondary mb-1">
I am willing to invest {" "}
</span>
<span className="text-muted font-size-sm">
<button
className="btn btn-primary btn-lg"
type="submit"
style={{
backgroundColor: "#fda417",
border: "#fda417",
}}
>
Request
</button>
</span>
{/* <button className="btn btn-outline-primary">Message</button> */}
<hr />
<div className="card-body">
<div className="row">
<div className="col-sm-3">
<span className="mb-0">Email</span>
</div>
<div className="col-sm-6 mb-3">
<div className="card h-100">
<div className="card-body">
<h6 className="d-flex align-items-center mb-3">
<i className="material-icons text-info mr-2">
assignment
</i>
Project Status
</h6>
<small>Web Design</small>
<div className="progress mb-3" style={{ height: "5px" }}>
<div
className="progress-bar bg-primary"
role="progressbar"
style={{ width: "80%" }}
aria-valuenow={80}
aria-valuemin={0}
aria-valuemax={100}
/>
</div>
<small>Website Markup</small>
<div className="progress mb-3" style={{ height: "5px" }}>
<div
className="progress-bar bg-primary"
role="progressbar"
style={{ width: "72%" }}
aria-valuenow={72}
aria-valuemin={0}
aria-valuemax={100}
/>
</div>
<small>One Page</small>
<div className="progress mb-3" style={{ height: "5px" }}>
<div
className="progress-bar bg-primary"
role="progressbar"
style={{ width: "89%" }}
aria-valuenow={89}
aria-valuemin={0}
aria-valuemax={100}
/>
</div>
<small>Mobile Template</small>
<div className="progress mb-3" style={{ height: "5px" }}>
<div
className="progress-bar bg-primary"
role="progressbar"
style={{ width: "55%" }}
aria-valuenow={55}
aria-valuemin={0}
aria-valuemax={100}
/>
</div>
<small>Backend API</small>
<div className="progress mb-3" style={{ height: "5px" }}>
<div
className="progress-bar bg-primary"
role="progressbar"
style={{ width: "66%" }}
aria-valuenow={66}
aria-valuemin={0}
aria-valuemax={100}
/>
</div>
{user.email}
<div className="col-sm-9 text-secondary"></div>
</div>
<hr />
<div className="row">
<div className="col-sm-3">
<span className="mb-0">Phone</span>
</div>
6765746584687
<div className="col-sm-9 text-secondary"></div>
</div>
</div>
</div>
</div>
</div>
@ -241,8 +259,89 @@ const ProfileView = () => {
</div>
<div className="col-md-4 mb-3">
<div className="card">
<div className="card-body">
<h1
className="d-flex align-items-center mb-3"
style={{ color: "#F74B02", fontSize: "26px" }}
>
<i className="material-icons text-info mr-2">Suggested</i>
Borrowers
</h1>
<ul className="list-group list-group-flush">
<li className="list-group-item d-flex justify-content-between align-items-center flex-wrap">
<h6 className="mb-0">
<img
src={profilepic}
style={{
marginTop: "0px",
maxWidth: "50px",
maxHeight: "50px",
}}
/>
Ravichandu
</h6>
{/* <span className="text-secondary">https://bootdey.com</span> */}
</li>
<li className="list-group-item d-flex justify-content-between align-items-center flex-wrap">
<h6 className="mb-0">
<img
src={profilepic}
style={{
marginTop: "0px",
maxWidth: "50px",
maxHeight: "50px",
}}
/>
Ravichandu
</h6>
{/* <span className="text-secondary">https://bootdey.com</span> */}
</li>
<li className="list-group-item d-flex justify-content-between align-items-center flex-wrap">
<h6 className="mb-0">
<img
src={profilepic}
style={{
marginTop: "0px",
maxWidth: "50px",
maxHeight: "50px",
}}
/>
Ravichandu
</h6>
{/* <span className="text-secondary">https://bootdey.com</span> */}
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
{/* <div className="col-md-4">
<div className="card mb-3">
<div className="card-body">
<div className="row">
<div className="col-sm-3">
<h6 className="mb-0">Email</h6>
</div>
<div className="col-sm-9 text-secondary">{user.email}</div>
</div>
<hr />
<div className="row">
<div className="col-sm-3">
<h6 className="mb-0">Phone</h6>
</div>
<div className="col-sm-9 text-secondary">(239) 816-9029</div>
</div>
<hr />
</div>
</div>
</div> */}
</>
);
};

View File

@ -17,6 +17,10 @@ const UserProfile = () => {
lastName: user?.result?.lastName || "",
email: user?.result?.email || "",
aboutme: user?.result?.aboutme || "",
city: user?.result?.city || "",
state: user?.result?.state || "",
county: user?.result?.county || "",
zip: user?.result?.zip || "",
profileImage: user?.result?.profileImage || "", // For storing the image
});
@ -30,6 +34,10 @@ const UserProfile = () => {
lastName: user.result.lastName,
email: user.result.email,
aboutme: user.result.aboutme,
city: user.result.city,
state: user.result.state,
county: user.result.county,
zip: user.result.zip,
profileImage: user.result.profileImage,
});
}
@ -144,6 +152,162 @@ const UserProfile = () => {
</div>
</div>
<div className="col-4">
<div className="form-floating mb-3">
City
<input
type="text"
className="form-control"
name="city"
placeholder="city"
value={formData.city}
onChange={handleChange}
required
/>
</div>
</div>
<div className="col-md-4">
<div className="form-floating mb-3">
State
<select
className="form-floating mb-3 form-control"
name="state"
value={formData.state}
onChange={handleChange}
required
>
<option value="">Please Select State</option>
<option value="Alaska">Alaska</option>
<option value="Alabama">Alabama</option>
<option value="Arkansas">Arkansas</option>
<option value="Arizona">Arizona</option>
<option value="California">California</option>
<option value="Colorado">Colorado</option>
<option value="Connecticut">Connecticut</option>
<option value="District Of Columbia">
District Of Columbia
</option>
<option value="Delaware">Delaware</option>
<option value="Florida">Florida</option>
<option value="Georgia">Georgia</option>
<option value="Hawaii">Hawaii</option>
<option value="Iowa">Iowa</option>
<option value="Idaho">Idaho</option>
<option value="Illinois">Illinois</option>
<option value="Indiana">Indiana</option>
<option value="Kansas">Kansas</option>
<option value="Kentucky">Kentucky</option>
<option value="Louisiana">Louisiana</option>
<option value="Massachusetts">Massachusetts</option>
<option value="Maryland">Maryland</option>
<option value="Michigan">Michigan</option>
<option value="Minnesota">Minnesota</option>
<option value="Missouri">Missouri</option>
<option value="Mississippi">Mississippi</option>
<option value="Montana">Montana</option>
<option value="North Carolina">North Carolina</option>
<option value="North Dakota">North Dakota</option>
<option value="Nebraska">Nebraska</option>
<option value="New Hampshire">New Hampshire</option>
<option value="New Jersey">New Jersey</option>
<option value="New Mexico">New Mexico</option>
<option value="Nevada">Nevada</option>
<option value="New York">New York</option>
<option value="Ohio">Ohio</option>
<option value="Oklahoma">Oklahoma</option>
<option value="Oregon">Oregon</option>
<option value="Pennsylvania">Pennsylvania</option>
<option value="Rhode Island">Rhode Island</option>
<option value="South Carolina">South Carolina</option>
<option value="South Dakota">South Dakota</option>
<option value="Tennessee">Tennessee</option>
<option value="Texas">Texas</option>
<option value="Utah">Utah</option>
<option value="Virginia">Virginia</option>
<option value="Vermont">Vermont</option>
<option value="Washington">Washington</option>
<option value="Wisconsin">Wisconsin</option>
<option value="West Virginia">West Virginia</option>
<option value="Wyoming">Wyoming</option>
</select>
</div>
</div>
<div className="col-md-4">
County
<select
className="form-floating mb-3 form-control"
name="county"
value={formData.county}
onChange={handleChange}
required
>
<option value="">Please Select County</option>
<option value="Abbeville">Abbeville</option>
<option value="Aiken">Aiken</option>
<option value="Allendale">Allendale</option>
<option value="Anderson">Anderson</option>
<option value="Bamberg">Bamberg</option>
<option value="Barnwell">Barnwell</option>
<option value="Beaufort">Beaufort</option>
<option value="Berkeley">Berkeley</option>
<option value="Calhoun">Calhoun</option>
<option value="Charleston">Charleston</option>
<option value="Cherokee">Cherokee</option>
<option value="Chester">Chester</option>
<option value="Chesterfield">Chesterfield</option>
<option value="Clarendon">Clarendon</option>
<option value="Colleton">Colleton</option>
<option value="Darlington">Darlington</option>
<option value="Dillon">Dillon</option>
<option value="Dorchester">Dorchester</option>
<option value="Edgefield">Edgefield</option>
<option value="Fairfield">Fairfield</option>
<option value="Florence">Florence</option>
<option value="Georgetown">Georgetown</option>
<option value="Greenville">Greenville</option>
<option value="Greenwood">Greenwood</option>
<option value="Hampton">Hampton</option>
<option value="Horry">Horry</option>
<option value="Jasper">Jasper</option>
<option value="Kershaw">Kershaw</option>
<option value="Lancaster">Lancaster</option>
<option value="Laurens">Laurens</option>
<option value="Lee">Lee</option>
<option value="Lexington">Lexington</option>
<option value="Marion">Marion</option>
<option value="Marlboro">Marlboro</option>
<option value="McCormick">McCormick</option>
<option value="Newberry">Newberry</option>
<option value="Oconee">Oconee</option>
<option value="Orangeburg">Orangeburg</option>
<option value="Pickens">Pickens</option>
<option value="Richland">Richland</option>
<option value="Saluda">Saluda</option>
<option value="Spartanburg">Spartanburg</option>
<option value="Sumter">Sumter</option>
<option value="Union">Union</option>
<option value="Williamsburg">Williamsburg</option>
<option value="York">York</option>
</select>
</div>
<div className="col-4">
<div className="form-floating mb-3">
Zip
<input
type="text"
className="form-control"
name="zip"
placeholder="zip"
value={formData.zip}
onChange={handleChange}
required
/>
</div>
</div>
{/* Profile Image Upload Section */}
<div className="col-4">
<label>Profile Image</label>

View File

@ -31,7 +31,10 @@ const userSlice = createSlice({
error: "",
loading: false,
verified: false,
user: null,
// user: null,
user: {},
},
reducers: {},
extraReducers: (builder) => {