Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed validations #126

Merged
merged 109 commits into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
109 commits
Select commit Hold shift + click to select a range
69b09f2
merge the edits
lksnjw Sep 28, 2024
07fa4e0
Merge pull request #1 from lksnjw/SANJEEWA-ADDING
lksnjw Sep 28, 2024
6b00285
Merge pull request #48 from lksnjw/master
lksnjw Sep 28, 2024
aed5ec3
CHANGES MADE PORT NUMBERS
lksnjw Sep 28, 2024
8eb6ae5
done
lksnjw Sep 28, 2024
5eb7bd9
done
lksnjw Sep 28, 2024
af1ac94
fix cloudinary to the register
lksnjw Sep 28, 2024
589096f
Merge pull request #2 from lksnjw/register-change
lksnjw Sep 28, 2024
0d18f30
creating apdf
lksnjw Sep 29, 2024
d9bb721
Merge pull request #3 from lksnjw/creating-a-pdf
lksnjw Sep 29, 2024
1f4c585
fixed driver profile
lksnjw Sep 29, 2024
1eeb6b8
updated
lksnjw Sep 29, 2024
9b976ea
updated the delivery serach
lksnjw Sep 29, 2024
f324699
header
lksnjw Sep 29, 2024
53162ea
done
lksnjw Sep 29, 2024
9952309
Merge pull request #4 from lksnjw/editing-side-bars
lksnjw Sep 29, 2024
15c88d3
count set
lksnjw Sep 29, 2024
ab42f92
Update DLmangeDash.jsx
lksnjw Sep 29, 2024
8e5323f
done
lksnjw Sep 29, 2024
14732e0
updated driver
lksnjw Sep 29, 2024
5f28fc8
Merge pull request #5 from lksnjw/dashboard-update
lksnjw Sep 30, 2024
62f8847
fix errors
lksnjw Sep 30, 2024
71c23e9
Merge pull request #6 from lksnjw/dashboard-update
lksnjw Sep 30, 2024
c181fb9
editing
lksnjw Sep 30, 2024
1103622
done
lksnjw Sep 30, 2024
b3edb8b
Merge pull request #7 from lksnjw/this-is-the-eding-branch
lksnjw Sep 30, 2024
393e363
added pdf download
lksnjw Sep 30, 2024
064fbc2
done
lksnjw Sep 30, 2024
7b42dec
Merge pull request #8 from lksnjw/this-is-the-eding-branch
lksnjw Sep 30, 2024
5042e48
done edit profile pawword verification
lksnjw Sep 30, 2024
f47235f
Merge pull request #9 from lksnjw/this-is-the-eding-branch
lksnjw Sep 30, 2024
0317bc1
done
lksnjw Sep 30, 2024
15c21b1
fixed driver side all deliveriws
lksnjw Sep 30, 2024
2c30771
validation complete for driver registration
lksnjw Sep 30, 2024
24a1504
registation photo validation complete
lksnjw Sep 30, 2024
24219e6
update the sendind email with a button
lksnjw Sep 30, 2024
3650917
DONE linking pages
lksnjw Oct 1, 2024
7ffc3d5
Merge pull request #10 from lksnjw/this-is-the-eding-branch
lksnjw Oct 1, 2024
9ddf5b9
FIX LICENSE REGISTRATION
lksnjw Oct 1, 2024
ba97229
DONE
lksnjw Oct 1, 2024
d2ac115
Update DLDriverRegistrationForm.jsx
lksnjw Oct 1, 2024
823dde3
Merge pull request #11 from lksnjw/this-is-the-eding-branch
lksnjw Oct 1, 2024
dae7947
Merge pull request #12 from lksnjw/SANJEEWA-ADDING
lksnjw Oct 5, 2024
5a1fc7f
🔀 Automated Docker Image Building & Bug fixes (#57)
nmdra Oct 6, 2024
252bd37
Merge pull request #58 from lksnjw/SANJEEWA-ADDING
lksnjw Oct 7, 2024
620d565
format complete
lksnjw Oct 7, 2024
e23b7ae
Merge pull request #61 from lksnjw/SANJEEWA-ADDING
lksnjw Oct 7, 2024
ab18a9c
🚧 Update (WIP)
nmdra Oct 7, 2024
5e4e54b
updated localhost
lksnjw Oct 7, 2024
64bc423
🔀 Update (WIP)
nmdra Oct 7, 2024
ee6521a
Merge pull request #63 from lksnjw/SANJEEWA-ADDING
lksnjw Oct 7, 2024
095fc81
Merge pull request #13 from lksnjw/SANJEEWA-ADDING
lksnjw Oct 7, 2024
3a802c7
Merge branch 'sanjeewa' into sanjeewa_merge
nmdra Oct 7, 2024
43f6853
done
lksnjw Oct 7, 2024
eed00ef
updated auto assigning
lksnjw Oct 7, 2024
f9a7ce6
updated sendin email
lksnjw Oct 7, 2024
335c983
a
lksnjw Oct 8, 2024
a80bf45
Merge remote-tracking branch 'upstream/sanjeewa_merge' into SANJEEWA-…
lksnjw Oct 8, 2024
1766e57
Update DLImageUpload.jsx
lksnjw Oct 8, 2024
55b4cc8
Merge branch 'SANJEEWA-ADDING'
lksnjw Oct 8, 2024
35960d8
Merge branch 'master' of https://github.com/lksnjw/Farm-Cart-
lksnjw Oct 8, 2024
bdff065
update
lksnjw Oct 8, 2024
b1c39bd
fix dl view delivery and make first step to the map
lksnjw Oct 9, 2024
648e8cd
Added income page
lksnjw Oct 10, 2024
e25ce9d
update loadings
lksnjw Oct 10, 2024
7a61744
formated
lksnjw Oct 10, 2024
e719605
Merge branch 'nmdra:master' into master
lksnjw Oct 10, 2024
60f1463
Merge branch 'after-merge' into friday-mor
lksnjw Oct 10, 2024
9e3bd9f
fix preview one
lksnjw Oct 10, 2024
f2d69d1
fixed dash board
lksnjw Oct 10, 2024
e8bb441
formated
lksnjw Oct 10, 2024
20d0941
added admin login
lksnjw Oct 10, 2024
9d52ad1
updated
lksnjw Oct 10, 2024
26917c1
fixed
lksnjw Oct 11, 2024
2203826
Merge branch 'development' into friday-mor
nmdra Oct 11, 2024
e487094
remove folderr
lksnjw Oct 11, 2024
89dd174
Merge branch 'friday-mor' of https://github.com/lksnjw/Farm-Cart- int…
lksnjw Oct 11, 2024
bbcaa23
done
lksnjw Oct 11, 2024
915781f
Merge branch 'master' into friday-mor
nmdra Oct 11, 2024
261fd0d
add changing status
lksnjw Oct 11, 2024
dc92eb9
Merge branch 'friday-mor' of https://github.com/lksnjw/Farm-Cart- int…
lksnjw Oct 11, 2024
c082b4d
fixed
lksnjw Oct 11, 2024
460ec6e
Merge branch 'master' into friday-mor
lksnjw Oct 11, 2024
c835502
Merge pull request #17 from lksnjw/friday-mor
lksnjw Oct 11, 2024
d9e13fe
Done
lksnjw Oct 11, 2024
2c39c39
done
lksnjw Oct 11, 2024
695035f
done all the things
lksnjw Oct 11, 2024
226ca93
Merge branch 'nmdra:master' into master
lksnjw Oct 11, 2024
6b53b72
Merge branch 'master' into friday-mor
lksnjw Oct 11, 2024
2de872b
Update DLDriverRegistrationForm.jsx
lksnjw Oct 12, 2024
c853079
Merge branch 'friday-mor' of https://github.com/lksnjw/Farm-Cart- int…
lksnjw Oct 12, 2024
922a615
done
lksnjw Oct 12, 2024
d3b4a57
Update DLDriverRegistrationForm.jsx
lksnjw Oct 12, 2024
39f062c
Merge branch 'master' into friday-mor
lksnjw Oct 12, 2024
f32c500
Merge branch 'master' into friday-mor
lksnjw Oct 14, 2024
8548ca6
Merge pull request #21 from lksnjw/friday-mor
lksnjw Oct 14, 2024
4200f24
done editing
lksnjw Oct 14, 2024
767a6c2
Merge pull request #22 from lksnjw/friday-mor
lksnjw Oct 14, 2024
89efe81
done
lksnjw Oct 14, 2024
c89044a
done
lksnjw Oct 14, 2024
a74dc32
Merge branch 'nmdra:master' into master
lksnjw Oct 14, 2024
1a4a99c
done
lksnjw Oct 14, 2024
8960656
Merge pull request #23 from lksnjw/editing-the-final-one
lksnjw Oct 14, 2024
5009565
formated
lksnjw Oct 14, 2024
d1fdf61
Merge pull request #24 from lksnjw/editing-the-final-one
lksnjw Oct 14, 2024
36e06be
done
lksnjw Oct 14, 2024
b7cd9d8
Merge branch 'nmdra:master' into master
lksnjw Oct 14, 2024
a0398af
Merge pull request #25 from lksnjw/editing-the-final-one
lksnjw Oct 14, 2024
bae3e45
Merge branch 'master' into master
nmdra Oct 14, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,5 @@ certs

docker-compose.caddy.yml

uploads
uploads

14 changes: 10 additions & 4 deletions backend/controllers/DLDeliveryController.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,19 @@ export const assignDriverToOrder = async () => {
driverID: driver._id,
drID: driver.driverID,
shopName: order.shopName,
shopEmail: order.shopEmail,
shopPhone: order.shopPhone,
pickupAddress:
`${order.shopAddress.houseNo || ''}, ${order.shopAddress.streetName || ''}, ${order.shopAddress.city || ''}, ${order.shopAddress.district || ''}`
.trim()
.replace(/^,|,$/g, ''),
customerName: order.customerName,
dropOffAddress:
`${order.customerAddress.streetAddress || ''}, ${order.customerAddress.city || ''}, ${order.customerAddress.zipCode || ''}, ${order.customerAddress.district || ''}`
.trim()
.replace(/^,|,$/g, ''),
customerEmail: order.customerEmail,
customerNumber: order.customerNumber,
dropOffAddress: order.customerAddress,
// `${order.customerAddress.streetAddress || ''}, ${order.customerAddress.city || ''}, ${order.customerAddress.zipCode || ''}, ${order.customerAddress.district || ''}`
// .trim()
// .replace(/^,|,$/g, ''),
})

await delivery.save()
Expand Down Expand Up @@ -112,8 +116,10 @@ export const sendEmailToDriver = async (driver, delivery) => {
<li><strong>Order ID:</strong> ${delivery.oID}</li>
<li><strong>Tracking ID:</strong> ${delivery.trackingID}</li>
<li><strong>Shop Name:</strong> ${delivery.shopName}</li>
<li><strong>Shop Contact:</strong> ${delivery.shopPhone}</li>
<li><strong>Pickup Address:</strong> ${delivery.pickupAddress}</li>
<li><strong>Customer Name:</strong> ${delivery.customerName}</li>
<li><strong>Customer Contact:</strong> ${delivery.customerNumber}</li>
<li><strong>Drop-Off Address:</strong> ${delivery.dropOffAddress}</li>
</ul>

Expand Down
28 changes: 19 additions & 9 deletions backend/controllers/DLOcontroller.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,22 +148,32 @@ const assignReadyOrders = async () => {
const customerName =
`${user.firstname || ''} ${user.lastname || ''}`.trim()

// Use the defaultAddress from the User model
const customerAddress = {
streetAddress: user.defaultAddress.streetAddress || 'N/A',
city: user.defaultAddress.city || 'N/A',
zipCode: user.defaultAddress.zipCode || 'N/A',
district: user.defaultAddress.district || 'N/A',
}
// console.log(`Customer Address: ${customerAddress.streetAddress}, ${customerAddress.city}`)
// // Use the defaultAddress from the User model
// const customerAddress = {
// streetAddress: user.defaultAddress.streetAddress || 'N/A',
// city: user.defaultAddress.city || 'N/A',
// zipCode: user.defaultAddress.zipCode || 'N/A',
// district: user.defaultAddress.district || 'N/A',
// }
// // console.log(`Customer Address: ${customerAddress.streetAddress}, ${customerAddress.city}`)

// Extract the shippingAddress fields from the user
const { name, address, city, phone, email } = order.shippingAddress

// Combine address and city into a single string
const cusAddress = `${address}, ${city}`

// Create a new dOrder with the customer and shop address and order data
const newDOrder = new dOrder({
oID: order._id.toString(), // Assigning the order ID from the Order model
orderID: generateOrderId(), // Randomly generated order ID
customerName: customerName, // Full name from User model
customerAddress: customerAddress, // Address from User model
customerEmail: email, // Email from User model
customerNumber: phone, // Phone number from User model
customerAddress: cusAddress, // Address from User model
shopName: shop.name, // Shop name from the Shop model
shopEmail: shop.email, // Shop email from the Shop model
shopPhone: shop.contactNumber, // Shop phone from the Shop model
shopAddress: {
houseNo: shop.address.houseNo, // House number from the Shop model
streetName: shop.address.streetName, // Street name from the Shop model
Expand Down
11 changes: 6 additions & 5 deletions backend/controllers/orderController.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,6 @@ export const getTotalSales = async (req, res) => {
}
}


export const getShopTotalIncome = async (req, res) => {
try {
const totalIncome = await Order.aggregate([
Expand Down Expand Up @@ -290,11 +289,13 @@ export const getShopTotalIncome = async (req, res) => {
ownerName: '$farmerDetails.name', // Include the owner's name
},
},
]);
])

res.status(200).json(totalIncome); // Send the total income response
res.status(200).json(totalIncome) // Send the total income response
} catch (error) {
console.error('Error fetching shop total income with owner:', error);
res.status(500).json({ message: 'Error fetching total income for shops with owner' });
console.error('Error fetching shop total income with owner:', error)
res.status(500).json({
message: 'Error fetching total income for shops with owner',
})
}
}
22 changes: 22 additions & 0 deletions backend/models/DLDeliveryModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,35 @@ const DLDeliverySchema = new mongoose.Schema({
drID: {
type: String,
},

shopName: String,

shopEmail: {
type: String,
required: false,
},

shopPhone: {
type: String,
required: false,
},

pickupAddress: {
type: String,
},

customerName: String,

customerEmail: {
type: String,
required: false,
},

customerNumber: {
type: String,
required: false,
},

dropOffAddress: {
type: String,
},
Expand Down
30 changes: 26 additions & 4 deletions backend/models/DLOModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,23 @@ const dorderSchema = new mongoose.Schema(
type: String,
required: false,
},

customerEmail: {
type: String,
required: false,
},

customerNumber: {
type: String,
required: false,
},
customerAddress: {
streetAddress: { type: String, required: false },
city: { type: String, required: false },
zipCode: { type: String, required: false },
district: { type: String, required: false },
type: String,
required: false,
// streetAddress: { type: String, required: false },
// city: { type: String, required: false },
// zipCode: { type: String, required: false },
// district: { type: String, required: false },
},
shopName: {
type: String,
Expand All @@ -43,6 +55,16 @@ const dorderSchema = new mongoose.Schema(
required: [false, 'City is required'],
},
},
shopEmail: {
type: String,
required: false,
},

shopPhone: {
type: String,
required: false,
},

orderStatus: {
type: String,
enum: ['Pending', 'Ready', 'Picked Up', 'On The Way', 'Delivered'],
Expand Down
2 changes: 1 addition & 1 deletion backend/routes/orderRoute.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ orderRouter.get('/get-user-orders/:id', getOrdersByUserId)
orderRouter.put('/:id', updateOrderStatus)
orderRouter.delete('/:id', DeleteOrder)
orderRouter.get('/get-shop/:id', getShopByFarmerId)
orderRouter.get('/shop-total-income', getShopTotalIncome);
orderRouter.get('/shop-total-income', getShopTotalIncome)

orderRouter.get('/:id', getOrderById) // Fetch order details by ID with populated farmer and user details

Expand Down
1 change: 1 addition & 0 deletions backend/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ import commentRoutes from './routes/comments.js'
import newsRoutes from './routes/newsRoutes.js'

// Error handling

import { errorHandler, notFound } from './middlewares/errorMiddleware.js'

// Set up port from environment or default to 8000
Expand Down
5 changes: 4 additions & 1 deletion frontend/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,10 @@ const router = createBrowserRouter(
/>
<Route path="/coupens" element={<Coupens />} />
<Route path="/finance" element={<Finance />} />
<Route path="/manage-shop-income" element={<ManageShopIncome />} />
<Route
path="/manage-shop-income"
element={<ManageShopIncome />}
/>
</Route>

{/*
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/Components/Admin/admnlogins.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const AdminLogin = ({ manager }) => {
<img
src={farmcartLogo} // Replace with the path to your logo image
alt="Logo"
className="h-16 w-auto mb-4 mx-auto"
className="h-10 w-auto mb-4 mx-auto"
/>
<div className="text-left mb-5">
<h2 className="text-3xl font-bold">Admin Login</h2>
Expand Down
19 changes: 0 additions & 19 deletions frontend/src/Components/Home/DHeader.jsx

This file was deleted.

31 changes: 31 additions & 0 deletions frontend/src/Components/delivery/DHeader.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import React from 'react'
import { Link } from 'react-router-dom'
import logo from '../../assets/Logo.png'

const Header = () => {
return (
<div>
<div className="flex items-center justify-between py-6 mx-auto border-b max-w-7xl">
<div>
<Link to="/">
<img src={logo} alt="Logo" width={160} height={160} />
</Link>
</div>

<div className="flex items-center gap-4 text-sm">
<div className="flex items-center gap-4">
<h1>Welcome to FarmCart🌱 </h1>
<Link
to="/help"
className="text-black hover:text-[#99DD05] cursor-pointer hover:underline text-sm"
>
Help & Support
</Link>
</div>
</div>
</div>
</div>
)
}

export default Header
1 change: 0 additions & 1 deletion frontend/src/Layouts/BlogLayout.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Outlet } from 'react-router-dom'
// import Footer from '../Components/Home/Footer'
import Footer from '../Components/Home/FooterDashboard'
import DHeader from '../Components/Home/DHeader'
import BlogHeader from '../Components/Home/BlogHeader'

function BlogLayout() {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/Layouts/DLayout.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Outlet } from 'react-router-dom'
// import Footer from '../Components/Home/Footer'
import Footer from '../Components/Home/FooterDashboard'
import DHeader from '../Components/Home/DHeader'
import DHeader from '../Components/delivery/DHeader'

function DLayout() {
return (
Expand Down
25 changes: 13 additions & 12 deletions frontend/src/Layouts/HelpLayout.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,22 @@ import HelpFooter from '../Components/Help/HelpFooter'
import HelpChatIcon from '../Components/Help/HelpChatIcon'

function HelpLayout() {

const user = JSON.parse(localStorage.getItem('user'))

// Handle the case where user is null or undefined
const customer = user ? {
id: user._id,
name: user.firstname,
email: user.email,
createdAt: Date.now(),
} : {
id: '01JA3JDNTD35GP144D83PPJVR6',
name: 'Guest',
email: 'guest@example.com',
createdAt: Date.now(),
}
const customer = user
? {
id: user._id,
name: user.firstname,
email: user.email,
createdAt: Date.now(),
}
: {
id: '01JA3JDNTD35GP144D83PPJVR6',
name: 'Guest',
email: 'guest@example.com',
createdAt: Date.now(),
}

return (
<div>
Expand Down
Loading
Loading