Skip to content

updating branch #66

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

Merged
merged 96 commits into from
Mar 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
96 commits
Select commit Hold shift + click to select a range
851aef9
calculated actual trip duration
shawon-majid Mar 27, 2024
18d93f0
Merge pull request #43 from definecoder/main
codermehraj Mar 27, 2024
ee5e547
bill generation api done
shawon-majid Mar 27, 2024
0d0bb5b
Merge pull request #45 from definecoder/data-entry-interface
shawon-majid Mar 27, 2024
5f4073c
Fixed STS Management Component in the admin section
codermehraj Mar 27, 2024
779c1d9
fixed roles api
shawon-majid Mar 27, 2024
510b89b
Added Landfill management table & Fixed modal folder structure
codermehraj Mar 27, 2024
3e58cd6
LANDFILL & STS MANAGEMENT FINISHED
codermehraj Mar 27, 2024
b8b8878
updated bill schema, added bill no
shawon-majid Mar 27, 2024
154d8ec
Merge pull request #46 from definecoder/role-based-access-system
shawon-majid Mar 27, 2024
f29d6f9
bill number field added
shawon-majid Mar 27, 2024
5696183
edited trip completion api
shawon-majid Mar 27, 2024
6ae2a69
Merge pull request #47 from definecoder/sts-systems
nafi-ullah Mar 27, 2024
0a38331
Captcha added
codermehraj Mar 27, 2024
edba3e0
getVehicleList Hook done
nafi-ullah Mar 27, 2024
ca28f8e
end points added for rbac
shawon-majid Mar 28, 2024
6854791
getVehicle List in dashboard
nafi-ullah Mar 28, 2024
6a5f5ac
data view change in landFill
nafi-ullah Mar 28, 2024
1f6bcad
Vehicle list rendered from server and deletation of vehicle added
codermehraj Mar 28, 2024
1d8250c
Merge pull request #48 from definecoder/landfill-manager-integration
codermehraj Mar 28, 2024
03a18ff
Merge pull request #49 from definecoder/main
codermehraj Mar 28, 2024
11b8875
landfill trip complete
nafi-ullah Mar 28, 2024
9e1290a
rbac schema updated
shawon-majid Mar 28, 2024
5969472
rbac pipeline created
shawon-majid Mar 28, 2024
2c29b18
seeded permissions
shawon-majid Mar 28, 2024
518d559
vehicle trip complete list initiate
nafi-ullah Mar 28, 2024
d4371b7
update vehciel trip complete hook
nafi-ullah Mar 28, 2024
b40346b
vehicle trip complete list in landfill dashboard
nafi-ullah Mar 28, 2024
c50c24f
Delivered table showed in landfill dashboard
nafi-ullah Mar 28, 2024
e4b7572
Merge pull request #50 from definecoder/landfill-systems
nafi-ullah Mar 28, 2024
94882a3
Merge pull request #51 from definecoder/main
nafi-ullah Mar 28, 2024
6b6b0f8
datadashboard null update
nafi-ullah Mar 28, 2024
49de3d5
added authorizer
shawon-majid Mar 28, 2024
7a8d881
Create new vehicle completed
codermehraj Mar 28, 2024
a4580d2
STS data fetch
nafi-ullah Mar 28, 2024
65692eb
Edit vehicle info functionality completed
codermehraj Mar 28, 2024
1681768
added layout for landfill manager bill entry
codermehraj Mar 28, 2024
e3c16f2
show sts cooridnates in map
nafi-ullah Mar 28, 2024
295d10f
pending bill list section added
codermehraj Mar 28, 2024
ddc4389
Merge pull request #52 from definecoder/landfill-systems
nafi-ullah Mar 28, 2024
eb84a2e
Merge branch 'landfill-manager-integration' into main
codermehraj Mar 28, 2024
d646bc4
Merge pull request #53 from definecoder/main
codermehraj Mar 28, 2024
a310cd7
added global rendering of username, landfillname and stsname of the m…
codermehraj Mar 28, 2024
0ecb76f
completed bill posting
codermehraj Mar 28, 2024
5d26077
route search via sts done
nafi-ullah Mar 28, 2024
ff5f67f
seeds updated
nafi-ullah Mar 28, 2024
05833b7
Merge pull request #54 from definecoder/role-based-access-system
codermehraj Mar 28, 2024
8304413
Merge pull request #55 from definecoder/landfill-manager-integration
codermehraj Mar 28, 2024
154ccc8
Merge pull request #56 from definecoder/landfill-systems
nafi-ullah Mar 28, 2024
7d7313b
bill creation bug fixed
codermehraj Mar 28, 2024
8bbf5b3
profile page layout done
nafi-ullah Mar 28, 2024
839a735
completed bill list genarated and view done
codermehraj Mar 28, 2024
2aeb0a2
Cascading delete bug fixed
shawon-majid Mar 28, 2024
9d10242
user profile hook created
nafi-ullah Mar 28, 2024
efc2511
null handle in userprofile
nafi-ullah Mar 28, 2024
75ebf73
userData shown in profile
nafi-ullah Mar 28, 2024
e9f555b
Download Bill PDF done and completed bills fetched
codermehraj Mar 28, 2024
1ca8d8f
rbac roles and permissions added to seed
shawon-majid Mar 28, 2024
c5d85d1
Merge pull request #58 from definecoder/role-based-access-system
shawon-majid Mar 28, 2024
a540d58
user role updated
nafi-ullah Mar 28, 2024
aae67d2
fixed layout of rbac admin panel
codermehraj Mar 28, 2024
5bab2c8
backend call of fetching permisson and roles done
codermehraj Mar 29, 2024
be316de
Completed rendering role base permisson list
codermehraj Mar 29, 2024
d662175
Added frontend functionality to edit each permission
codermehraj Mar 29, 2024
fa6203a
RBAC permission add and delete integrated with backend
codermehraj Mar 29, 2024
488260c
Fixed RBAC component initial State
codermehraj Mar 29, 2024
48cc5b6
Delete role functionality integrated with backend and added
codermehraj Mar 29, 2024
88adc52
next js popup removed
codermehraj Mar 29, 2024
3ee55f4
Merge pull request #59 from definecoder/rbac-integration
codermehraj Mar 29, 2024
85c6840
title update in profile page
nafi-ullah Mar 29, 2024
267bb30
Merge branch 'main' into profile-page
nafi-ullah Mar 29, 2024
be841d7
Merge pull request #60 from definecoder/profile-page
nafi-ullah Mar 29, 2024
e179798
profile edit done
nafi-ullah Mar 29, 2024
05efe3b
console nd comments deleted
nafi-ullah Mar 29, 2024
bf5a84b
Merge pull request #61 from definecoder/profile-design
nafi-ullah Mar 29, 2024
857397c
date picker added
nafi-ullah Mar 29, 2024
27bfed4
datepicker added in landfill entry and sts release
nafi-ullah Mar 29, 2024
0e05b67
Merge pull request #62 from definecoder/component-update-validate
nafi-ullah Mar 29, 2024
442edcd
added global loading page
codermehraj Mar 29, 2024
f86ff64
upcoming trips rendered in the dashboard of landfill
codermehraj Mar 29, 2024
f94a5dc
permissions in profile page
nafi-ullah Mar 29, 2024
77c8600
updated trip data view in landfill manager
codermehraj Mar 29, 2024
ad2d6ec
Storage heatmap rendered in the storage section
codermehraj Mar 29, 2024
81194d3
Fixed map and rendered delivered history in the landfill
codermehraj Mar 29, 2024
c181bc1
Merge pull request #63 from definecoder/component-update-validate
nafi-ullah Mar 29, 2024
b71b2d7
Merge branch 'rbac-integration' into main
codermehraj Mar 29, 2024
4e6b9d0
Merge pull request #64 from definecoder/main
codermehraj Mar 29, 2024
d58c6a0
adjusted backend to get landfill Storage status
codermehraj Mar 30, 2024
234c01b
added mantine ui library for graphs
codermehraj Mar 30, 2024
b929d81
added loading page
codermehraj Mar 30, 2024
e86422a
Fixed the header of the main panel
codermehraj Mar 30, 2024
06d897c
updated charts and maps
codermehraj Mar 30, 2024
41e18eb
Showed landfill storage info from backend and also finalized landfill…
codermehraj Mar 30, 2024
5bc613e
landfill manager admin panel completed
codermehraj Mar 30, 2024
389f1ae
update role info bug fixed
codermehraj Mar 30, 2024
ba93ccd
Merge pull request #65 from definecoder/rbac-integration
codermehraj Mar 30, 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
30 changes: 16 additions & 14 deletions client/app/auth/change-password/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ import { setCookie } from "@/lib/cookieFunctions";
import Link from "next/link";
import { useRouter } from "next/navigation";
import { useEffect, useState } from "react";
import ReCAPTCHA from "react-google-recaptcha";

export default function ChangePassword() {
const router = useRouter();

const { changePass, setPassChangeData } = useChangePass();

const [correctCaptcha, setCorrectCaptcha] = useState("");
const [userCaptcha, setUserCaptcha] = useState("");
const [isVerified, setIsCaptchaVerified] = useState<string | null>();
const [oldPassword, setOldPassword] = useState("");
const [newPassword, setNewPassword] = useState("");

Expand All @@ -33,8 +33,8 @@ export default function ChangePassword() {
let timer = setInterval(() => {
setTime((time) => {
if (time === 0) {
clearInterval(timer);
alert("Time Expired!");
clearInterval(timer);
alert("Time Expired!");
router.push("/dashboard");
return 0;
} else return time - 0.5;
Expand All @@ -44,15 +44,15 @@ export default function ChangePassword() {

async function submitForm() {
setPassChangeData({ oldPassword, newPassword });
correctCaptcha === userCaptcha &&
(await changePass()) &&
router.push("/dashboard");
correctCaptcha !== userCaptcha && alert("Invalid Captcha!");
isVerified && (await changePass()) && router.push("/dashboard");
!isVerified && alert("Invalid Captcha!");
}

return (
<div className="flex flex-col gap-4 justify-center items-center h-screen w-screen">
<Button variant="outline" onClick={() => router.push("/dashboard")}>Back to Dashboard</Button>
<Button variant="outline" onClick={() => router.push("/dashboard")}>
Back to Dashboard
</Button>
<Card className="w-full max-w-sm">
<CardHeader className="text-center">
<CardTitle className="text-2xl">Change Password</CardTitle>
Expand All @@ -62,7 +62,7 @@ export default function ChangePassword() {
{`${time % 60}`.padStart(2, "0")} mins.
</CardDescription>
</CardHeader>
<CardContent className="grid gap-4">
<CardContent className="grid gap-6">
<form onSubmit={submitForm}>
<div className="grid gap-2">
<Label htmlFor="old-password">Old Password</Label>
Expand All @@ -84,10 +84,12 @@ export default function ChangePassword() {
required
/>
</div>
<CaptchaDiv
setCorrectCaptcha={setCorrectCaptcha}
setUserCaptcha={setUserCaptcha}
/>
<div className="mt-3 flex items-center justify-center">
<ReCAPTCHA
sitekey={process.env.NEXT_PUBLIC_RECAPTCHA_SITE_KEY!}
onChange={setIsCaptchaVerified}
/>
</div>
</form>
</CardContent>
<CardFooter>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,20 @@ import { Label } from "@/components/ui/label";

import { useRouter } from "next/navigation";
import useForgetPassInitiate from "@/hooks/auth/useForgetPassInitiate";
import { useContext } from "react";
import { useContext, useState } from "react";
import ReCAPTCHA from "react-google-recaptcha";

function ForgetPassInitiateForm() {
const { userEmail, setUserEmail, initiate } = useForgetPassInitiate();
const [isCaptchaVerified, setIsCaptchaVerified] = useState<string | null>();
const router = useRouter();

async function handleFormSubmit(e: React.FormEvent<HTMLFormElement>) {
e.preventDefault();
if (!isCaptchaVerified) {
alert("Please verify that you are not a robot.");
return;
}
const success = await initiate();
success && router.push("/auth/reset-password/confirm" + "?email=" + userEmail);
}
Expand All @@ -34,7 +40,8 @@ function ForgetPassInitiateForm() {
}
required
/>
</div>
</div>
<ReCAPTCHA sitekey={process.env.NEXT_PUBLIC_RECAPTCHA_SITE_KEY!} className="mx-auto" onChange={setIsCaptchaVerified} />
<Button type="submit" className="w-full">
Send Reset Password Link
</Button>
Expand Down
138 changes: 138 additions & 0 deletions client/app/billPrint/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
"use client";
import { useSearchParams } from "next/navigation";
import { useEffect, useState } from "react";
import Head from "next/head";
import { Bill } from "@/components/dataTables/CompletedBillList";
import { Button } from "@/components/ui/button";

const BillPrintComponent = () => {
const searchParams = useSearchParams();
const [queryParams, setQueryParams] = useState({
id: "",
billNo: "",
stsName: "",
landFillName: "",
vehicleNumber: "",
vehicleType: "",
weightOfWaste: 0,
shortage: 0,
loadedFuelCostPerKm: 0,
unloadedFuelCostPerKm: 0,
capacity: 0,
estimatedFuelCost: 0,
distance: 0,
estimatedDuration: 0,
actualDuration: 0,
allocatedFuelCost: 0,
tripId: "",
});

useEffect(() => {
setQueryParams({
id: searchParams.get("id") || "",
billNo: searchParams.get("billNo") || "",
stsName: searchParams.get("stsName") || "",
landFillName: searchParams.get("landFillName") || "",
vehicleNumber: searchParams.get("vehicleNumber") || "",
vehicleType: searchParams.get("vehicleType") || "",
weightOfWaste: Number(searchParams.get("weightOfWaste")) || 0,
shortage: Number(searchParams.get("shortage")) || 0,
loadedFuelCostPerKm: Number(searchParams.get("loadedFuelCostPerKm")) || 0,
unloadedFuelCostPerKm:
Number(searchParams.get("unloadedFuelCostPerKm")) || 0,
capacity: Number(searchParams.get("capacity")) || 0,
estimatedFuelCost: Number(searchParams.get("estimatedFuelCost")) || 0,
distance: Number(searchParams.get("distance")) || 0,
estimatedDuration: Number(searchParams.get("estimatedDuration")) || 0,
actualDuration: Number(searchParams.get("actualDuration")) || 0,
allocatedFuelCost: Number(searchParams.get("allocatedFuelCost")) || 0,
tripId: searchParams.get("tripId") || "",
});
}, [searchParams]);

return (
<>
<div className="flex justify-center items-center mt-4 print:mt-0 w-screen print:h-[99vh]">
<div className="m-4 p-10 border rounded-xl bg-primary-foreground text-primary flex flex-col gap-4 min-w-[500px] max-w-min">
<div className="flex justify-between items-center mb-2">
<span>
<b>Bill number:</b>&nbsp; {queryParams.billNo}
</span>
<img src="logoBlack.png" alt="logo" className="w-16 h-16" />
</div>
<div className="flex justify-between">
<div>
<b>STS:</b> <br /> {queryParams.stsName}{" "}
</div>
<div className="text-right">
<b>Landfill:</b> <br /> {queryParams.landFillName}
</div>
</div>
<div className="flex justify-between">
<div>
<b>Vehicle Number:</b> <br /> {queryParams.vehicleNumber}{" "}
</div>
<div className="text-right">
<b>Vehicle Type:</b> <br /> {queryParams.vehicleType}
</div>
</div>
<div className="flex justify-between">
<div>
<b>Capacity:</b> <br /> {queryParams.capacity} Ton{" "}
</div>
<div className="text-center">
<b>
Weight Trasfered: <br /> {queryParams.weightOfWaste} Ton{" "}
</b>
</div>
<div className="text-right">
<b>Shortage:</b> <br /> {queryParams.shortage} Ton
</div>
</div>
<div className="flex justify-between">
<div>
<b>Loaded Fuel Cost:</b> <br /> {queryParams.loadedFuelCostPerKm}{" "}
BDT
</div>
<div className="text-right">
<b>Unloaded Fuel Cost:</b> <br />{" "}
{queryParams.unloadedFuelCostPerKm} BDT
</div>
</div>
<div className="flex justify-between">
<div>
<b>Actual Duration:</b> <br /> {queryParams.estimatedDuration} min
</div>
<div className="text-right">
<b>Estimated Duration:</b> <br /> {queryParams.actualDuration} min
</div>
</div>
<div className="flex justify-between">
<div>
<b>Total Distance:</b> <br /> {queryParams.distance} km
</div>
<div className="text-right">
<b>Estimated Fuel Cost:</b> <br /> {queryParams.estimatedFuelCost}{" "}
BDT
</div>
</div>
<div className="flex justify-center text-lg m-2">
<span>
<b>ALLOCATED BILL:&nbsp; {queryParams.allocatedFuelCost} BDT </b>
</span>
</div>
</div>
</div>
<div className="flex justify-center mt-4 print:hidden">
<Button
onClick={() => window.print()}
className="bg-primary text-primary-foreground"
>
Print
</Button>
</div>
</>
);
};

export default BillPrintComponent;
2 changes: 1 addition & 1 deletion client/app/dashboard/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default function Dashboard() {
setCurrentActive(getCookie(curActive));
}, []);

console.log('Role: ' + curRole + ' Current Active: ' + currentActive);
//console.log('Role: ' + curRole + ' Current Active: ' + currentActive);

return (
<div className="grid min-h-screen w-full md:grid-cols-[220px_1fr] lg:grid-cols-[280px_1fr]">
Expand Down
18 changes: 18 additions & 0 deletions client/app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,21 @@
background: #0F172A; /* Color of the scrollbar handle on hover */
border: 2px solid white; /* Color of the scrollbar handle on hover */
}

nextjs-portal {
display: none;
}

@keyframes spin {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}

.loader {
border-top-color: #3498db;
animation: spin 1s linear infinite;
}
9 changes: 8 additions & 1 deletion client/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import type { Metadata } from "next";
import { Inter } from "next/font/google";
import "./globals.css";
import '@mantine/core/styles.css';
import '@mantine/charts/styles.css';

import { ColorSchemeScript, MantineProvider } from '@mantine/core';

const inter = Inter({ subsets: ["latin"] });

Expand All @@ -19,7 +23,10 @@ export default function RootLayout({
}>) {
return (
<html lang="en">
<body className={inter.className}>{children}</body>
<head>
<ColorSchemeScript />
</head>
<body className={inter.className}><MantineProvider>{children}</MantineProvider></body>
</html>
);
}
16 changes: 16 additions & 0 deletions client/app/loading.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import React from 'react';

const LoadingPage = () => {
return (
<div className="fixed inset-0 flex items-center justify-center bg-white z-50">
<div className="flex flex-col items-center justify-center gap-4">
<img src={"logoBlack.png"} alt="logo" className="mb-4 w-32 h-32 mx-auto" />
<div className="loader ease-linear rounded-full border-4 border-t-4 border-gray-200 h-16 w-16 mb-4">
</div>
<h2 className="text-2xl font-semibold text-gray-900">EcoSync is loading...</h2>
</div>
</div>
);
};

export default LoadingPage;
16 changes: 13 additions & 3 deletions client/app/maps/page.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
"use client";
import { AllStsMapShow } from '@/components/maps/AllStsShow';
import GoogleMapComponent from '@/components/maps/GoogleMap'
import RouteMap from '@/components/maps/RouteMap';
import SetZone from '@/components/maps/SetZone';
import { ChakraProvider, theme } from '@chakra-ui/react'

type StsShow = {

lat: number,
lng: number,
// storagePercentage: number

};

const Map = () => {
const coordinates = [
const coordinates : StsShow[] = [
{ lat: 23.7031879, lng: 90.35564201 },
{ lat: 23.6856870, lng: 90.44630134 },
{ lat: 23.6843407, lng: 90.56538359 },
Expand All @@ -20,9 +29,10 @@ const Map = () => {
<div className='w-full h-screen'>
{/* <GoogleMapComponent coordinates={coordinates} dumpFills={dumpFills}></GoogleMapComponent> */}
{/* <SetZone></SetZone> */}
<ChakraProvider theme={theme}>
{/* <ChakraProvider theme={theme}>
<RouteMap/>
</ChakraProvider>
</ChakraProvider> */}
<AllStsMapShow />
</div>

)
Expand Down
Loading