Skip to content

Commit fe76ab9

Browse files
committed
truck inqueue logic changed & add section implementing
1 parent e349e9e commit fe76ab9

28 files changed

+1885
-750
lines changed

netlify.toml

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[[redirects]]
2+
from = "/*"
3+
to = "/index.html"
4+
status = 200

package-lock.json

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

package.json

+8-3
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,23 @@
55
"dependencies": {
66
"@cloudinary/react": "^1.13.0",
77
"@cloudinary/url-gen": "^1.16.1",
8+
"@date-io/date-fns": "^3.0.0",
89
"@emotion/cache": "^11.9.3",
9-
"@emotion/react": "^11.9.3",
10-
"@emotion/styled": "^11.9.3",
10+
"@emotion/react": "^11.11.4",
11+
"@emotion/styled": "^11.11.5",
1112
"@mui/icons-material": "^5.8.4",
1213
"@mui/lab": "^5.0.0-alpha.88",
13-
"@mui/material": "^5.8.6",
14+
"@mui/material": "^5.15.18",
1415
"@mui/system": "^5.8.6",
1516
"@mui/utils": "^5.8.6",
17+
"@mui/x-date-pickers": "^7.5.0",
1618
"@tabler/icons": "^1.72.0",
1719
"apexcharts": "^3.35.3",
1820
"axios": "^1.6.7",
1921
"cloudinary": "^2.0.1",
22+
"clsx": "^2.1.1",
23+
"date-fns": "^3.6.0",
24+
"dayjs": "^1.11.11",
2025
"firebase": "^10.8.0",
2126
"formik": "^2.2.9",
2227
"framer-motion": "^6.3.16",

src/menu-items/pages.js

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// assets
2-
import {IconAd2,IconNote,IconClockEdit,IconLocation,IconCash,IconNavigationOff,IconDiscount2,IconTruckDelivery,IconTruckLoading } from '@tabler/icons';
2+
import {IconAd2,IconBrandBooking,IconNote,IconClockEdit,IconLocation,IconCash,IconNavigationOff,IconDiscount2,IconTruckDelivery,IconTruckLoading } from '@tabler/icons';
33

44
// constant
55
const icons = {
@@ -11,7 +11,8 @@ const icons = {
1111
IconLocation,
1212
IconCash,
1313
IconTruckLoading,
14-
IconNavigationOff
14+
IconNavigationOff,
15+
IconBrandBooking
1516
};
1617

1718

@@ -36,6 +37,13 @@ const pages = {
3637
url: '/manageTrucks',
3738
icon: icons.IconTruckDelivery,
3839
},
40+
{
41+
id: 'truckBooking',
42+
title: 'Manage Truck Booking',
43+
type: 'item',
44+
url: '/truckBooking',
45+
icon: icons.IconBrandBooking,
46+
},
3947
{
4048
id: 'allocatedTrucks',
4149
title: 'Allocated Trucks',

src/routes/MainRoutes.js

+5
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import Loadable from 'ui-component/Loadable';
88
const DashboardDefault = Loadable(lazy(() => import('views/dashboard/Default')));
99
const ManageTrucks = Loadable(lazy(() => import('views/pages/manageTrucks')));
1010
const AllocatedTrucks = Loadable(lazy(() => import('views/pages/allocatedTrucks')));
11+
const TruckBooking = Loadable(lazy(() => import('views/pages/truckBooking')));
1112
const Parties = Loadable(lazy(() => import('views/pages/parties')));
1213
const Locations = Loadable(lazy(() => import('views/pages/location')));
1314
const DoBooking = Loadable(lazy(() => import('views/pages/doBooking')));
@@ -32,6 +33,10 @@ const MainRoutes = {
3233
path: 'allocatedTrucks',
3334
element: <AllocatedTrucks />
3435
},
36+
{
37+
path: 'truckBooking',
38+
element: <TruckBooking />
39+
},
3540

3641
//forwarder routes
3742
{

src/ui-component/StyledTable.js

+11-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,17 @@ if(onClickAction){
9191
</Button>
9292
</TableCell>
9393
);
94-
} else {
94+
95+
}
96+
else if (dt.status != 'isHighRangeArea' && head.toUpperCase() === 'ISHIGHRANGEAREA') {
97+
return (
98+
<TableCell key={i}>
99+
{dt[`${head}`]?'Yes':'No'}
100+
101+
</TableCell>
102+
);
103+
}
104+
else {
95105
return <TableCell key={i}>{dt[`${head}`]}</TableCell>;
96106
}
97107
})}

src/ui-component/TableActionButton.js

+26-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { styled, alpha } from '@mui/material/styles';
33
import Menu from '@mui/material/Menu';
44
import MenuItem from '@mui/material/MenuItem';
55
import EditIcon from '@mui/icons-material/Edit';
6-
import { Delete, MoreVert, Cancel, Preview, Settings } from '@mui/icons-material';
6+
import { Delete, MoreVert,AddCircle, Cancel, Preview, Settings } from '@mui/icons-material';
77
import { IconButton } from '@mui/material';
88

99
const StyledMenu = styled((props) => (
@@ -77,7 +77,21 @@ export default function TableActionButton({ data, actions = ['Edit', 'Delete'],
7777
>
7878
{
7979
actions.map((item, ind) => {
80-
if (item.toUpperCase() == "EDIT") {
80+
if (item.toUpperCase() == "ADD TO QUEUE") {
81+
return (
82+
<MenuItem key={ind} onClick={() => handleClose(item)}
83+
sx={{
84+
color: 'green', // Change text color to red
85+
'&:hover': {
86+
backgroundColor: 'rgba(72, 113, 247, 0.1)', // Change background color on hover
87+
},
88+
}}>
89+
<AddCircle style={{ color: "green" }} />
90+
Add To Queue
91+
</MenuItem>
92+
)
93+
}
94+
else if (item.toUpperCase() == "EDIT") {
8195
return (
8296
<MenuItem key={ind} onClick={() => handleClose(item)}>
8397
<EditIcon />
@@ -86,8 +100,15 @@ export default function TableActionButton({ data, actions = ['Edit', 'Delete'],
86100
)
87101
} else if (item.toUpperCase() == "DELETE") {
88102
return (
89-
<MenuItem key={ind} onClick={() => handleClose(item)}>
90-
<Delete />
103+
<MenuItem key={ind} onClick={() => handleClose(item)}
104+
sx={{
105+
color: 'red',
106+
'&:hover': {
107+
backgroundColor: 'rgba(255, 0, 0, 0.1)',
108+
},
109+
}}
110+
>
111+
<Delete style={{ color: "red" }} />
91112
Delete
92113
</MenuItem>
93114
)
@@ -99,6 +120,7 @@ export default function TableActionButton({ data, actions = ['Edit', 'Delete'],
99120
</MenuItem>
100121
)
101122
}
123+
102124
else if (item.toUpperCase() == "CANCEL") {
103125
return (
104126
<MenuItem sx={{color:'red'}} key={ind} onClick={() => handleClose(item)}>

src/utils/Service.js

+43-16
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import axios from 'axios';
22

33
// const baseURL = `http://${window.location.hostname}:3005/`;
4-
const baseURL = `https://container-terminal-backend.onrender.com/`;
5-
//const baseURL = `http://localhost:5000/`;
4+
//const baseURL = `https://container-terminal-backend.onrender.com/`;
5+
const baseURL = `http://localhost:5000/`;
66
console.log(window.location.hostname);
77

88
const apiInstance = axios.create({
@@ -34,6 +34,12 @@ const apiInstance = axios.create({
3434

3535

3636
////Trucks
37+
export async function addTruck(data) {
38+
const response = await apiInstance.post(`truck`,data);
39+
console.log(response.data);
40+
return response.data;
41+
}
42+
3743
export async function getAllTruck(data) {
3844
const response = await apiInstance.post(`truck/getAllTruck`,data);
3945
console.log(response.data);
@@ -46,38 +52,46 @@ export async function updateTruck(data) {
4652
return response.data;
4753
}
4854

55+
//Truck Booking API
56+
export async function updateTruckBooking(data) {
57+
const response = await apiInstance.post(`truck/updateTruckBookingStatus`,data);
58+
console.log(response.data);
59+
return response.data;
60+
}
4961

50-
//parties
51-
export async function getAllParties(data) {
52-
const response = await apiInstance.post(`party/getAllParty`,data);
62+
export async function getTruckBooking(data) {
63+
const response = await apiInstance.post(`truck/getAllTruckBookings`,data);
5364
console.log(response.data);
5465
return response.data;
5566
}
5667

57-
export async function createAds(data) {
58-
const response = await apiInstance.post(`ads`,data);
68+
export async function AddTruckBooking(data) {
69+
const response = await apiInstance.post(`truck/addTruckToBooking`,data);
5970
console.log(response.data);
6071
return response.data;
6172
}
6273

63-
export async function deleteAd(data) {
64-
const response = await apiInstance.delete(`ads/${data}`);
74+
//parties
75+
export async function getAllParties(data) {
76+
const response = await apiInstance.post(`party/getAllParty`,data);
77+
console.log(response.data);
78+
return response.data;
79+
}
80+
81+
export async function addParty(data) {
82+
const response = await apiInstance.post(`party`,data);
6583
console.log(response.data);
6684
return response.data;
6785
}
6886

6987

7088

7189
//////Dashboard API
72-
export async function getOngoingTruck() {
73-
const response = await apiInstance.post(`truck/getAllTruck`,{status:'ongoing'});
90+
export async function getTruckBasedOnStatus(data) {
91+
const response = await apiInstance.post(`truck/getAllTruckBookings`,{status:data.status});
7492
return response.data;
7593
}
7694

77-
export async function getInQueueTruck() {
78-
const response = await apiInstance.post(`truck/getAllTruck`,{status:'inqueue'});
79-
return response.data;
80-
}
8195

8296

8397
////allocation
@@ -126,11 +140,16 @@ export async function adminLogin(data) {
126140
}
127141

128142
//location
129-
export async function gellAllLocation(data) {
143+
export async function getAllLocation(data) {
130144
const response = await apiInstance.post(`location/getAllLocation`,data);
131145
console.log(response.data);
132146
return response.data;
133147
}
148+
export async function addLocation(data) {
149+
const response = await apiInstance.post(`location`,data);
150+
console.log(response.data);
151+
return response.data;
152+
}
134153

135154

136155

@@ -140,3 +159,11 @@ export async function gellAllBooking(data) {
140159
console.log(response.data);
141160
return response.data;
142161
}
162+
163+
164+
//driver
165+
export async function getCompanyDrivers() {
166+
const response = await apiInstance.get(`driver/getCompanyDrivers`);
167+
console.log(response.data);
168+
return response.data;
169+
}

0 commit comments

Comments
 (0)