Skip to content

Commit 7a0da9e

Browse files
committed
updated
1 parent 1bc6489 commit 7a0da9e

File tree

18 files changed

+1094
-463
lines changed

18 files changed

+1094
-463
lines changed

package-lock.json

+233-206
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
"@cloudinary/url-gen": "^1.16.1",
88
"@date-io/date-fns": "^3.0.0",
99
"@emotion/cache": "^11.9.3",
10-
"@emotion/react": "^11.11.4",
11-
"@emotion/styled": "^11.11.5",
10+
"@emotion/react": "^11.13.3",
11+
"@emotion/styled": "^11.13.0",
1212
"@mui/icons-material": "^5.8.4",
1313
"@mui/lab": "^5.0.0-alpha.88",
14-
"@mui/material": "^5.15.18",
14+
"@mui/material": "^5.16.7",
1515
"@mui/system": "^5.8.6",
1616
"@mui/utils": "^5.8.6",
1717
"@mui/x-date-pickers": "^7.5.0",

src/layout/MainLayout/Sidebar/MenuList/index.js

+8
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,19 @@ import { Typography } from '@mui/material';
44
// project imports
55
import NavGroup from './NavGroup';
66
import menuItem from 'menu-items';
7+
import { useEffect } from 'react';
78

89
// ==============================|| SIDEBAR MENU LIST ||============================== //
910

1011
const MenuList = () => {
12+
13+
useEffect(()=>{
14+
15+
},[])
16+
console.log(menuItem)
17+
console.log("menuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuIUtem")
1118
const navItems = menuItem.items.map((item) => {
19+
console.log(item)
1220
switch (item.type) {
1321
case 'group':
1422
return <NavGroup key={item.id} item={item} />;

src/layout/MainLayout/Sidebar/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { drawerWidth } from 'store/constant';
1818
const Sidebar = ({ drawerOpen, drawerToggle, window }) => {
1919
const theme = useTheme();
2020
const matchUpMd = useMediaQuery(theme.breakpoints.up('md'));
21-
21+
console.log("menuuuuu22222222222222222222222222uuuuuuuuIUtem")
2222
const drawer = (
2323
<>
2424
<Box sx={{ display: { xs: 'block', md: 'none' } }}>

src/menu-items/pages.js

+14-13
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,6 @@ const pages = {
5555
url: '/manageTrucks',
5656
icon: icons.IconTruckDelivery,
5757
},
58-
{
59-
id: 'parties',
60-
title: 'Parties',
61-
type: 'item',
62-
url: '/parties',
63-
icon: icons.IconNote,
64-
},
6558
{
6659
id: 'truckBooking',
6760
title: 'Manage Truck Booking',
@@ -86,14 +79,14 @@ const pages = {
8679
//fowarder routes
8780
{
8881
id: 'doupload',
89-
title: 'DoUploads',
82+
title: 'DO Details',
9083
type: 'item',
9184
url: '/doUpload',
9285
icon: icons.IconNote,
9386
},
9487
{
9588
id: 'opendoupload',
96-
title: 'Open Dos',
89+
title: 'Open DOs',
9790
type: 'item',
9891
url: '/openDoUpload',
9992
icon: icons.IconNote,
@@ -131,18 +124,26 @@ const pages = {
131124
type: 'item',
132125
url: '/manageUsers',
133126
icon: icons.IconUsers,
134-
}
127+
},
128+
129+
{
130+
id: 'parties',
131+
title: 'Parties',
132+
type: 'item',
133+
url: '/parties',
134+
icon: icons.IconNote,
135+
},
135136
]
136137
};
137138

138139

139140

140141

141142

142-
// Filter menu items based on role
143+
143144
pages.children = pages.children.filter((item) => {
144145
if (isBoth) {
145-
return true; // Render all items for 'Both' role
146+
return true;
146147
}
147148
if (isAdmin){
148149
return item.id === "manageCompany" || item.id === 'manageDriver' || item.id === 'manageTrucks' || item.id === 'doupload' || item.id === 'parties' || item.id === 'doBooking' || item.id === 'allocatedDo' || item.id === 'canceledDo' || item.id === 'manageUsers';
@@ -153,7 +154,7 @@ pages.children = pages.children.filter((item) => {
153154
if (isForwarder) {
154155
return item.id === 'parties' || item.id === 'doupload' || item.id === 'opendoupload' || item.id === 'location' || item.id === 'rateMap' || item.id === 'allocatedDo' || item.id === 'canceledDo';
155156
}
156-
return false; // Default case: do not render any item
157+
return false;
157158
});
158159

159160
export default pages;

src/utils/Service.js

+26-3
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import axios from 'axios';
33

44
// const baseURL = `http://${window.location.hostname}:3005/`;
55

6-
//const baseURL = `http://localhost:5000/`;
7-
const baseURL = `https://apis.fleetq.live/`
6+
const baseURL = `http://localhost:5000/`;
7+
//const baseURL = `https://apis.fleetq.live/`
88
console.log(window.location.hostname);
99

1010
const apiInstance = axios.create({
@@ -187,7 +187,6 @@ export async function getAllUsers() {
187187

188188
export async function adminLogin(data) {
189189
const response = await apiInstance.post(`user/login`,data);
190-
console.log("heeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee")
191190
console.log(response)
192191
console.log(response.data);
193192
return response.data;
@@ -226,6 +225,30 @@ export async function uploadDo(data) {
226225
return response.data;
227226
}
228227

228+
export async function updateDo(id, data) {
229+
try {
230+
const response = await apiInstance.put(`doBooking/updateDO/${id}`, data);
231+
console.log(response.data);
232+
return response.data;
233+
} catch (error) {
234+
console.error("Error updating delivery order:", error);
235+
throw error; // Rethrow the error to handle it in the calling function if necessary
236+
}
237+
}
238+
239+
240+
export async function cancelDo(id, data) {
241+
try {
242+
const response = await apiInstance.post(`doBooking/cancelDO/${id}`, data);
243+
console.log(response.data);
244+
return response.data;
245+
} catch (error) {
246+
console.error("Error updating delivery order:", error);
247+
throw error; // Rethrow the error to handle it in the calling function if necessary
248+
}
249+
}
250+
251+
229252
export async function getAllDoUpload(data) {
230253
const response = await apiInstance.post(`doBooking/getAllDeliveryOrders`,data);
231254
console.log(response.data);

src/views/dashboard/Default/AllocatedOrders.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -151,10 +151,10 @@ const AllocatedOrders = ({ isLoading, data }) => {
151151
sx={{
152152
fontSize: '1rem',
153153
fontWeight: 500,
154-
color: theme.palette.secondary[200]
154+
155155
}}
156156
>
157-
uploadDate: {new Date(truckData.deliveryOrderId.createdAt).toLocaleString('en-US', {
157+
uploaded date: {new Date(truckData.deliveryOrderId.createdAt).toLocaleString('en-US', {
158158
month: 'long',
159159
day: 'numeric',
160160
year: 'numeric'

src/views/dashboard/Default/OpenDos.js

+16-15
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import TruckIcon from 'assets/images/icons/icons8-truck-24.png';
1313
import HourglassBottomIcon from '@mui/icons-material/HourglassBottom';
1414
import MoreVertIcon from '@mui/icons-material/MoreVert';
1515
import { useEffect, useState } from 'react';
16-
import { useNavigate } from 'react-router';
16+
// import { useNavigate } from 'react-router';
1717
import PopupState, { bindTrigger, bindMenu } from 'material-ui-popup-state';
1818

1919
const CardWrapper = styled(MainCard)(({ theme }) => ({
@@ -58,10 +58,10 @@ const CardWrapper = styled(MainCard)(({ theme }) => ({
5858
}
5959
}));
6060

61-
const OpenDos = ({ isLoading, data }) => {
61+
const OpenDos = ({ isLoading, data,update,handleCancel }) => {
6262
const theme = useTheme();
6363
const [doData, setDoData] = useState(data);
64-
const navigate = useNavigate();
64+
// const navigate = useNavigate();
6565

6666
useEffect(() => {
6767
setDoData(data);
@@ -74,14 +74,16 @@ const OpenDos = ({ isLoading, data }) => {
7474
return text;
7575
};
7676

77-
const handleUpdate = () => {
77+
const handleUpdate = (data) => {
7878
console.log("Update clicked");
79+
update(data)
7980
// Your update logic here
8081
};
8182

82-
const handleCancel = () => {
83-
console.log("Cancel clicked");
84-
// Your cancel logic here
83+
const handleCancelClick = (data) => {
84+
console.log(data)
85+
console.log(data._id)
86+
handleCancel(data._id,data.name)
8587
};
8688

8789
return (
@@ -94,7 +96,7 @@ const OpenDos = ({ isLoading, data }) => {
9496
<Grid container direction="column">
9597
<Grid item>
9698
<Grid container justifyContent="space-between">
97-
<Grid item>
99+
<Grid item onClick={() => { handleUpdate(doData); }}>
98100
<Avatar
99101
variant="rounded"
100102
sx={{
@@ -118,16 +120,16 @@ const OpenDos = ({ isLoading, data }) => {
118120
<MoreVertIcon />
119121
</IconButton>
120122
<Menu {...bindMenu(popupState)}>
121-
<MenuItem onClick={() => { handleUpdate(); popupState.close(); }}>Update</MenuItem>
122-
<MenuItem onClick={() => { handleCancel(); popupState.close(); }}>Cancel</MenuItem>
123+
<MenuItem onClick={() => { handleUpdate(doData); popupState.close(); }}>Update</MenuItem>
124+
<MenuItem onClick={() => { handleCancelClick(doData); popupState.close(); }}>Cancel</MenuItem>
123125
</Menu>
124126
</>
125127
)}
126128
</PopupState>
127129
</Grid>
128130
</Grid>
129131
</Grid>
130-
<Grid item onClick={() => navigate('/doUpload')}>
132+
<Grid item onClick={() => { handleUpdate(doData); }}>
131133
<Grid container alignItems="center">
132134
<Grid item>
133135
<Tooltip title={doData.name} arrow>
@@ -158,16 +160,16 @@ const OpenDos = ({ isLoading, data }) => {
158160
</Grid>
159161
</Grid>
160162
</Grid>
161-
<Grid item sx={{ mb: 1.25 }}>
163+
<Grid item sx={{ mb: 1.25 }}>
162164
<Box style={{ display: 'flex', justifyContent: 'space-between' }}>
163165
<Typography
164166
sx={{
165167
fontSize: '1rem',
166168
fontWeight: 500,
167-
color: theme.palette.primary[200]
169+
168170
}}
169171
>
170-
uploadDate: {doData.uploadDate}
172+
uploaded date: {doData.uploadDate}
171173
</Typography>
172174
<Button variant="contained" onClick={() => window.open(doData.link)}>
173175
Download DO
@@ -179,7 +181,6 @@ const OpenDos = ({ isLoading, data }) => {
179181
sx={{
180182
fontSize: '1rem',
181183
fontWeight: 300,
182-
color: theme.palette.primary[200]
183184
}}
184185
>
185186
fileName: {truncateText(doData.fileName, 20)}

0 commit comments

Comments
 (0)