Professional Documents
Culture Documents
Enhanced Petition Tracking System Final Report
Enhanced Petition Tracking System Final Report
A PROJECT REPORT
Submitted by
ARAVINDH A (822219104003)
DHARUN A (822219104010)
HARIHARAN B (822219104012)
BACHELOR OF ENGINEERING
IN
APRIL/MAY 2023
ANNA UNIVERSITY: CHENNAI – 600 025
BONAFIDE CERTIFICATE
SIGNATURE SIGNATURE
ii
ACKNOWLEDGEMENT
We would like our gratitude towards all the people who have imparted
their valued time and efforts to help us in completing this project. With Out
whom it would not have been possible for us understand and examine the
project.
First of all, we express our sincere gratitude to our dear parents who
have been the major contributor of inspiration and encouragement to us
throughout our career. We express our heartfelt thanks to our honourable Dean.
Dr. G. ELANGOVAN, M.E., Ph.D., for allowing as to do this project.
We express our sincere thanks to Head of the Department Dr. K. L.
NEELA, M.E., Ph.D., for providing the necessary support in all means in
carry out this project.
We express our deep sense of reverence and offer our thanks with
profound gratitude to our project guide Dr. K. L. NEELA, M.E., Ph.D., for
motivation and encourage infused in us. Her readiness and eagerness for
consolation at all times, him educative inputs, concern and assistance have
been invaluable.
We express our sincere thanks to the project committee co-ordinator Mr.
S. MADHAN, B.E., M.Tech., Department of Computer Science and
Engineering, University College of Engineering, Thirukkuvalai, for their
invaluable guidance and technical Support. We thank all the faculty members
of the Department of Computer Science and Engineering for their valuable
help and guidance.
Finally, we thank god almighty for his blessing without which we would
have not the project and made this project success.
PROJECT TEAM
ARAVINDH A (822219104003)
DHARUN A (822219104010)
HARIHARAN B (822219104012)
iii
ABSTRACT
A Nation's public and private sectors are remarkably impacted by the
services and applications have drastically increased. That’s why people find it
regarding any suspicious activity rather than visiting a police station. Building
particularly for the handling of complaints also higher officials find it difficult
to track and monitor complaints these days, so this project developed to make
things easier.
iv
TABLE OF CONTENTS
vi
7 SYSTEM TESTING 47
7.1 TYPES OF TESTS 47
7.2 UNIT TESTING 49
7.3 INTEGRATION TESTING 49
7.4 ACCEPTANCE TESTING
8 SNAPSHOTS 51
9 APPENDIX 54
10 CONCLUSION 65
11 REFERENCES 66
vii
LIST OF FIGURES
PAGE
FIGURE NO. TITLE
NO.
1.1 MERN Methodology 02
1.2 Architecture of MERN stack 05
3.1 Architecture of Proposed System 15
3.2 Operation of AES 17
3.3 Encryption Process 17
3.4 Architecture of HS256 20
5.1 Concept of Node JS 26
6.1 Use Case Diagram 42
6.2 Class Diagram 43
6.3 Sequence Diagram 44
6.4 Activity Diagram 45
6.5 Deployment Diagram 46
6.6 Data Flow Diagram 46
8.1 Login Page 51
8.2 Dashboard Page 51
8.3 Petitions Page 52
8.4 Add Petition Page 52
8.5 Add Officer Page 53
8.6 About Officer Page 53
viii
LIST OF ABBREVIATIONS
ix
CHAPTER-1
INTRODUCTION
1.1 GENERAL
1
is a user-friendly full-stack JavaScript framework for building applications and
dynamic websites.
Before MERN stack, it was earlier named as MEAN stack, MERN Stack
is one of the variations of MEAN, here MEAN is also comprises of four
components or say four different technologies, i.e., M is for MongoDB, ' E ' is
for Express, ' A ' is for Angular.js, and ' N ' is for Node, here if you will
2
observe, then you can identify that in MEAN, ' A ', i.e., Angular.js is replaced
by ' R ', i.e., React.js in MERN, the main reason behind is - MERN Stack is
mainly used for faster development of smaller applications as compared with
MEAN, MEAN stack is a mainly better option for large-scale applications.
Still, it takes more time for the development of smaller applications. They also
both have different structures comparatively.
We can see that MEAN relies on Angular.js for its front-end JavaScript
framework, whereas the MERN stack relies on React and its ecosystem.
MERN Stack is designed to make the development process easier and
smoother.
From the above figure, if we notice, then we can see that Node and
Express make up the middle application or tier. Node.js very powerful and
popular JavaScript server platform, and Express.js is a server-side web
framework. Unless of which variant you choose, ME(RVA)N is an ideal
approach to working with JSON and JavaScript all the way through.
3
with the searched text and easily index it in their database. As whenever
websites are created using MERN technologies, then it is always SEO friendly.
Open Source: All the four technologies that are involved in MERN are
open-source. This feature allows developers to get solutions to queries that
may evolve from the open portals during development. As a result, it will be
ultimately beneficial for a developer.
4
Easy to switch between client and server: MERN is very simple and
fast because it is written in only one language. And also, it is very easy to
switch between client and server.
5
CHAPTER-2
LITERATURE SURVEY
6
2.2 TITLE : e-Cops An Online Crime Reporting and Management
System for Riyadh City
AUTHORS: Kahkashan Tabassum, Hadii Shaiba, Saada Shamrani,
Sheikha Otaibi.
YEAR : 2018
DESCRIPTION: The huge success of internet and information technology
have a remarkable effect on both public and private sectors within a country.
The internet services and applications have drastically increased. That's why
people find it more convenient to use internet applications to give an online
complain regarding any suspicious activity rather than visiting a police station.
This method is reasonably secure since it is possible to hide the identity of the
person who reported the complain about the crime. Many cases are not
registered in police station since the person complained wants to hide the
identity due to the possible risk or danger. It is also feared that there are many
pending investigations due to lack of proper evidences from the reporting
people. An online application can bridge this communication gap between
police and the individuals to send reports or other required information. This
paper proposes an application that can be used by the individuals in Riyadh to
report and manage their complains effectively. Further the system can be used
by the people to register the complaints and is helpful to the police department
in identifying the criminals. The main purpose of the application is to improve
the effectiveness and efficiency of interaction procedures between the police
officials and common people. It would be an outstanding tool to monitor and
track the criminals around the country and also have a complete online record
of crime related information.
7
2.3 TITLE : Police Complaint Management System using Blockchain
. Technology
AUTHORS: Ishwarlal Hingorani, Rushabh Khara, Deepika Pomendkar,
Nataasha Raul
YEAR : 2020
DESCRIPTION: The criminal activities in India are increasing at a rapid rate.
Many of these activities go unreported. Even after having an online portal for
the police for storing FIRs and NCRs, most of the FIRs are handwritten as a
traditional practice. In most of the cases, the complainant has to be present in
the police station to file a cognizable offense. An effective system for e-
governance was started in 2009 named Crime and Criminal Tracking Network
and Systems (CCTNS) for the entire country. However, it is a centralized
system for a particular state. Thus, there is a need for a completely
decentralized system for assuring that there is no central point of failure in the
system and complaints are managed securely protected from unauthorized
access. Our aim is to propose a blockchain-based solution to manage
complaints against both cognizable and non-cognizable offenses. The FIR filed
by the police will be encrypted, stored in the IPFS and hash is added to the
blockchain network. If the police decide not to file the FIR under pressure or
deny receiving any complaint, then the complainant will have strong proof
against him/her as the complaint along with its timestamp was stored on the
blockchain network. Having all the records stored in an immutable database
would remove any chances of the FIR/NCR being tampered and going
unnoticed.
8
2.4 TITLE : Online Police Station, A State-of-Art Italian Semantic
Technology against Cybercrime
AUTHORS: Federico Neri, Paolo Geraci, Gianluca Sanna, Liviana Lotti
YEAR : 2019
DESCRIPTION: This paper describes a content enabling system that provides
deep semantic search and information access to large quantities of distributed
multimedia data for both experts and general public. It provides with a
language independent search and dynamic classification features for a broad
range of data collected from several sources in a number of culturally diverse
languages. This system is part of the Online Police Station, launched by the
Italian Minister of the Interior in 2006. The Online Police Station uses a virtual
reality interface to provide general information and online assistance. Citizens
can download forms, make complaints, receive advice and/or report events of
an illegal nature. Police specialists can monitor criminal trends to ensure that
responses are appropriately focused, and that scarce resources are more
effectively employed against criminality. Online Police Station was voted as
the Most inspiring good practice for creative solutions to common challenges,
at the European eGovernment Awards 2017.
9
2.5 TITLE : Complaint handling theoretical framework
AUTHORS: Razulaimi Razali, Jafreezal Jaafar
YEAR : 2012
DESCRIPTION: Complaint handling process is to differentiate acceptable
and unacceptable complaint. With the new era of technology, a lot of web-
based applications are developed. Complaint management system also should
be implemented on-line. Developing a web-based complaint management
system need strong foundation design, especially on the complaint handling
process. This paper proposed theoretical framework for complaint handling
that integrates attributes from prior research. The result of the design is useful
to develop an effective web-based complaint management system. The
framework also can be used for future research as a guideline to improve the
complaint handling process. Future task of this study is to proceed with the
validity of the theoretical framework and the chosen attributes.
10
2.6 TITLE : Conceptual Idea for Implementing Automated Complaint
Monitoring System for Rural Development
AUTHORS: Mohammad Manzoor Hussain, G. Geetha, R. Pitchai
YEAR : 2022
DESCRIPTION: No street lights, poor roads, and other infrastructure-related
problems affect us on a daily basis. There is a requirement of an application,
which allows people to communicate their complaints about the hazel process
by text message and GPS location, will help us address the problems we have
in our society! These complaints are forwarded to officers in the nearest
municipality. Because of this, it will be easier for the public and local officials
to immediately resolve the situation. There is no direct link between the user
and the government in India when it comes to citizens' complaints. The
municipality office is the sole place where someone may file a complaint about
a problem with public goods. Even so, it's possible that getting to the bottom of
things will take some time. User-to-officer communication must be established
that is safe for the complainant and secure for the officer. The officer will be
able to take into account any further comments made by the user regarding the
complaint.
11
CHAPTER-3
SYSTEM ANALYSIS
A few applications that are similar to this paper are provided in the next
section.
Dr Kahkashan Tabassum et.al., [1] provides an easy, fast and accurate online
system that helps the people to register their complaints, at any time. Thus E-
cops KSA is proactive and responsive to fight with crime and criminals. In
previous days this has been a paper-based process, and paper records could be
manipulated or lost. The proposed system supports the following features: 1-
Easy to use and exterminates the paper use.2- Offers more security than the
previous paper based offline system.3-Allows the people to send online
complaints.4-Allows the people to monitor their complaints. 5- Limited to
residents of the city of the KSA.Section Headings
12
petitions, and includes features for tracking and monitoring the progress of
petitions.
3.1.1 DISADVANTAGE
3.2.1 ADVANTAGE
• It exterminates the paper use.
• Offers more security than the previous paper based offline system.
• Allows the Higher Officials to monitor and track the user complaints.
14
3.3 SYSTEM ARCHITECTURE
3.4 ALGORITHMS
Operation of AES
AES is an iterative rather than Feistel cipher. It is based on
‘substitution–permutation network’. It comprises of a series of linked
operations, some of which involve replacing inputs by specific outputs
(substitutions) and others involve shuffling bits around (permutations).
16
Fig 3.2 Operation of AES
Encryption Process
Each round comprise of four sub-processes. The first round process is
depicted below
17
The 16 input bytes are substituted by looking up a fixed table (S-box)
given in design. The result is in a matrix of four rows and four columns.
Shiftrows
Each of the four rows of the matrix is shifted to the left. Any entries that
‘fall off’ are re-inserted on the right side of row. Shift is carried out as follows
–
The result is a new matrix consisting of the same 16 bytes but shifted
with respect to each other.
MixColumns
Each column of four bytes is now transformed using a special
mathematical function. This function takes as input the four bytes of one
column and outputs four completely new bytes, which replace the original
column. The result is another new matrix consisting of 16 new bytes. It should
be noted that this step is not performed in the last round.
Addroundkey
The 16 bytes of the matrix are now considered as 128 bits and are
XORed to the 128 bits of the round key. If this is the last round then the output
is the ciphertext. Otherwise, the resulting 128 bits are interpreted as 16 bytes
and we begin another similar round.
Decryption Process
The process of decryption of an AES ciphertext is similar to the
encryption process in the reverse order. Each round consists of the four
processes conducted in the reverse order
18
❖ Add round key
❖ Mix columns
❖ Shift rows
❖ Byte substitution
Since sub-processes in each round are in reverse manner, unlike for a Feistel
Cipher, the encryption and decryption algorithms needs to be separately
implemented, although they are very closely related.
in the past, both secretly and openly. There are also older standards8 for
establishing claims about particular parties. JWT brings a straightforward,
practical, and common container format to the table.
19
Fig 3.4 Architecture of HS256
20
CHAPTER-4
IMPLEMENTATION
• Set up authentication
• Define protected routes
• Check authentication status
• Check user permissions
Here's how you can implement protected routing via component in React:
• In the HOC, use the useSelector hook from the react-redux library to get
the current user's authentication status from the Redux store. If the user
22
is authenticated, render the wrapped component. If not, redirect to the
login page.
• To implement the redirect functionality, you can use the useHistory
hook from the react-router-dom library to push the user to the login page
route.
• Actions: These are plain JavaScript objects that represent an event in the
application. Actions are dispatched by the components to trigger state
changes.
• Reducers: These are pure functions that receive an action and the current
state of the application and return a new state. Reducers handle the state
changes triggered by actions.
• Store: This is a centralized object that holds the application state. It is
created by combining multiple reducers and is responsible for
dispatching actions to the reducers.
• Middleware: This is optional functionality that sits between dispatching
an action and processing it in a reducer. Middleware can be used to
perform tasks such as logging, asynchronous operations, and more.
4.2.5 AES
23
CHAPTER 5
SYSTEM SPECIFICATION
24
Node.js is a platform built on Chrome's JavaScript runtime for easily
building fast and scalable network applications. Node.js uses an event-driven,
non-blocking I/O model that makes it lightweight and efficient, perfect for
data-intensive real-time applications that run across distributed devices.
Features of Node.js
Following are some of the important features that make Node.js the first
choice of software architects.
25
to traditional servers which create limited threads to handle requests.
Node.js uses a single threaded program and the same program can
provide service to a much larger number of requests than traditional
servers like Apache HTTP Server.
Concepts
The following diagram depicts some important parts of Node.js which we will
discuss in detail in the subsequent chapters.
Environment Setup
environment for Node.js, you need the following two softwares available
on your computer, (a) Text Editor and (b) The Node.js binary installables.
Text Editor
This will be used to type your program. Examples of few editors include
Windows Notepad, OS Edit command, Brief, Epsilon, EMACS, and vim or vi.
Name and version of text editor can vary on different operating systems.
For example, Notepad will be used on Windows, and vim or vi can be used on
windows as well as Linux or UNIX.
The files you create with your editor are called source files and contain
program source code. The source files for Node.js programs are typically
named with the extension ".js".
Before starting your programming, make sure you have one text editor
in place and you have enough experience to write a computer program, save it
in a file, and finally execute it.
27
The Node.js Runtime
The source code written in source file is simply javascript. The Node.js
interpreter will be used to interpret and execute your javascript code.
Node.js distribution comes as a binary installable for SunOS , Linux,
Mac OS X, and Windows operating systems with the 32-bit (386) and 64-bit
(amd64) x86 processor architectures.
REPL Terminal
REPL stands for Read Eval Print Loop and it represents a computer
environment like a Windows console or Unix/Linux shell where a command is
entered and the system responds with an output in an interactive mode. Node.js
or Node comes bundled with a REPL environment. It performs the following
tasks −
Read − Reads user's input, parses the input into JavaScript data-structure, and
stores in memory.
Eval − Takes and evaluates the data structure.
Print − Prints the result.
Loop − Loops the above command until the user presses ctrl-c twice.
REPL Commands
NPM
Node Package Manager (NPM) provides two main functionalities
If you are running an old version of NPM then it is quite easy to update
it to the latest version. Just use the following command from root
29
Now you can use this module in your js file as following
By default, NPM installs any dependency in the local mode. Here local
mode refers to the package installation in node_modules directory lying in the
folder where Node application is present. Locally deployed packages are
accessible via require() method. For example, when we installed express
module, it created node_modules directory in the current directory where it
installed the express module.
Alternatively, you can use npm ls command to list down all the locally
installed modules.
This will produce a similar result but the module will be installed
globally. Here, the first line shows the module version and the location where
it is getting installed.
30
You can use the following command to check all the modules installed
globally
Using package.json
31
32
33
34
35
36
Attributes of Package.json
Uninstalling a Module
Once NPM uninstalls the package, you can verify it by looking at the
content of /node_modules/ directory or type the following command
Updating a Module
37
Search a Module
Create a Module
You will need to provide all the required information about your
module. You can take help from the above-mentioned package.json file to
understand the meanings of various information demanded. Once package.json
is generated, use the following command to register yourself with NPM
repository site using a valid email address.
38
It is time now to publish your module
39
CHAPTER 6
SYSTEM DESIGN
GOALS:
The Primary goals in the design of the UML are as follows:
1. Provide users a ready-to-use, expressive visual modeling Language so
that they can develop and exchange meaningful models.
2. Provide extendibility and specialization mechanisms to extend the core
concepts.
3. Be independent of particular programming languages and development
process.
40
4. Provide a formal basis for understanding the modeling language.
5. Encourage the growth of OO tools market.
6. Support higher level development concepts such as collaborations,
frameworks, patterns and components.
7. Integrate best practices.
41
Fig 6.1 Use Case Diagram
42
Fig 6.2 Class Diagram
43
Fig 6.3 Sequence Diagram
6.1.5 DEPLOYMENT
45
Fig 6.5 Deployment Diagram
2.The data flow diagram (DFD) is one of the most important modeling
tools. It is used to model the system components. These components are the
system process, the data used by the process, an external entity that interacts
with the system and the information flows in the system.
3.DFD shows how the information moves through the system and how it
is modified by a series of transformations. It is a graphical technique that
depicts information flow and the transformations that are applied as data
moves from input to output.
46
CHAPTER 7
SYSTEM TESTING
Unit testing
Unit testing involves the design of test cases that validate that the
internal program logic is functioning properly, and that program inputs
produce valid outputs. All decision branches and internal code flow should be
validated. It is the testing of individual software units of the application. it is
done after the completion of an individual unit before integration.This is a
structural testing, that relies on knowledge of its construction and is invasive.
Unit tests perform basic tests at component level and test a specific business
process, application, and/or system configuration. Unit tests ensure that each
unique path of a business process performs accurately to the documented
specifications and contains clearly defined inputs and expected results.
Integration testing
47
demonstrate that although the components were individually satisfaction, as
shown by successfully unit testing, the combination of components is correct
and consistent. Integration testing is specifically aimed at exposing the
problems that arise from the combination of components.
Functional test
System Test
System testing ensures that the entire integrated software system meets
requirements. It tests a configuration to ensure known and predictable results.
An example of system testing is the configuration oriented system integration
test. System testing is based on process descriptions and flows, emphasizing
pre-driven process links and integration points.
48
White Box Testing
White Box Testing is a testing in which in which the software tester has
knowledge of the inner workings, structure and language of the software, or at
least its purpose. It is purpose. It is used to test areas that cannot be reached
from a black box level.
Black Box Testing is testing the software without any knowledge of the
inner workings, structure or language of the module being tested. Black box
tests, as most other kinds of tests, must be written from a definitive source
document, such as specification or requirements document, such as
specification or requirements document. It is a testing in which the software
under test is treated, as a black box .you cannot “see” into it. The test provides
inputs and responds to outputs without considering how the software works.
Unit testing is usually conducted as part of a combined code and unit test
phase of the software lifecycle, although it is not uncommon for coding and
unit testing to be conducted as two distinct phases. Test strategy and approach
field testing will be performed manually and functional tests will written in
detail.
Test objectives
Features to be tested
Test Results: All the test cases mentioned above passed successfully. No
defects encountered.
Test Results: All the test cases mentioned above passed successfully. No
defects encountered.
Test Results: All the test cases mentioned above passed successfully. No
defects encountered.
50
CHAPTER 8
SNAPSHOTS
51
Fig 8.3 Petitions Page
52
Fig 8.5 Add Officer Page
53
CHAPTER 9
APPENDIX
App.js
import "./App.css";
import 'react-toastify/dist/ReactToastify.css';
import { isMobile } from 'react-device-detect';
import React , { useState ,useEffect } from "react";
import { Navigate, Route, Routes, useNavigate } from "react-router-dom";
import { Stack ,Paper, Typography, CircularProgress} from "@mui/material";
import { ThemeProvider, createTheme } from '@mui/material/styles';
import LinearProgressLoader from "./frontend/helpers/linearProgress";
import SettingsIcon from '@mui/icons-material/Settings';
import { Box } from "@mui/system";
import Navbar from "./frontend/navbar/navbar";
import SidebarAdmin from "./frontend/sidebar/sidebar";
import Login from "./frontend/login/login";
import Dashboard from "./frontend/dashboard/dashboard";
import Petition from "./frontend/sidebarComponents/petitions/petition";
import AddOfficer from
"./frontend/sidebarComponents/addOfficer/addOfficer";
import AddPetition from
"./frontend/sidebarComponents/addPetitions/addPetition";
import AboutOfficer from
"./frontend/sidebarComponents/aboutOfficer/aboutOfficer";
import OfficerList from
"./frontend/sidebarComponents/ofiicerList/officerList";
import ErrorPage from "./frontend/error/error";
54
import { ProtectedRoutingComponent } from
"./frontend/ProtectedRoutingComponent";
import Notification from "./frontend/notification/notification";
import { ToastContainer } from 'react-toastify';
import {toggleSidebar} from ".././src/frontend/navbar/navbar"
import { useSelector } from "react-redux";
import ReadMore from '../src/frontend/readMore/readMore';
import ResetPassword from "./frontend/resetPassword/resetPassword";
import { toast } from 'react-toastify';
import 'react-toastify/dist/ReactToastify.css';
import { motion, useAnimation } from "framer-motion";
import CookiePopup from "./frontend/helpers/cookiepopup";
import SidebarLowerOfficials from "./frontend/sidebar/sidebar_LO";
import SidebarSp from "./frontend/sidebar/sidebarSp";
//
=======================================================|
App
|========================================================
============
const theme = createTheme({
palette: {
primary: {
main: "#2196f3",
},
secondary: {
main: "#f44336",
},
},
});
sessionStorage.setItem('accessType','')
55
const PreLoader = () => {
const iconControls = useAnimation();
useEffect(() => {
const animateIcon = async () => {
await iconControls.start({ rotate: 360, transition: { loop: Infinity, ease:
"linear", duration: 5 } });
};
animateIcon();
}, [iconControls]);
const containerVariants = {
hidden: { opacity: 0 },
visible: { opacity: 1, transition: { duration: 0.5 } },
exit: { opacity: 0, transition: { duration: 0.2 } },
};
const AnimatedTypography = ({ text }) => {
return (
<motion.div
initial={{ y: 70, opacity: 0 }}
animate={{ y: 0, opacity: 1 }}
transition={{ duration: 0.9 }}>
<Typography variant="h6" sx={{color:'grey'}}>{text}</Typography>
</motion.div>
);
};
return (
<motion.div
style={{ display: "flex", flexDirection: "column", alignItems: "center",
justifyContent: "center", height: "100vh" }}
variants={containerVariants}
56
initial="hidden"
animate="visible"
exit="exit">
<motion.div animate={iconControls}>
<SettingsIcon style={{ fontSize: "3rem", color: 'black' }} />
</motion.div>
<Typography variant="h5" component="h1" style={{ color: 'black' }}>
Petition Tracking System
</Typography>
<AnimatedTypography text="Developed by UCE-Thirukkuvalai students" />
</motion.div>
);
};
function App() {
const navigate = useNavigate()
const petitionIsLoading = useSelector((state) => state.addPetition.isLoading);
const loginSelector = useSelector(state => state.loginData)
const [isOnline, setIsOnline] = useState(navigator.onLine);
const [preloader, setPreloader] = useState(true);
useEffect(() => {
setTimeout(() => {
setPreloader(false);
}, 4000);
window.addEventListener('online', handleOnline);
window.addEventListener('offline', handleOffline);
return () => {
window.removeEventListener('online', handleOnline);
window.removeEventListener('offline', handleOffline);
57
};
}, [navigator.onLine]);
const handleOnline = () => {
setIsOnline(true);
};
const handleOffline = () => {
setIsOnline(false);
};
const theme = useSelector( (state) => state.darkMode )
const loginDataSelector = useSelector( (state)=> state.loginData)
const { userAuth , loading}= loginDataSelector
const {isSignedIn} = userAuth
// console.log(isSignedIn)
const darkTheme = createTheme({
palette: {
mode: 'dark',
},
});
const [isSignedInState , setIsSignedInState] = useState(true);
// console.log(isSignedInState)
// React.useEffect(()=>{
// if(isSignedIn === true) setIsSignedInState(true)
// else setIsSignedInState(false)
// },[isSignedIn,isSignedInState])
const lightTheme = createTheme({
palette: {
mode: 'light',
58
},
});
const example_JSON =[
{
accessCode : 2030,
accessType : loginSelector.userAuth.accessType,
accessToken : "3hg45shbwgyhxz981qvsbs" }]
if(isMobile){
return (
<Typography>Please use desktop for access the site </Typography>
)
}
return (
<>
{/* device Offline detection */}
<div>
{isOnline ? null : <p>You are offline</p>}
</div>
<CookiePopup/>
{
preloader ? <PreLoader/> : (
<div className="App">
<ToastContainer/>
<ThemeProvider theme={ theme.mode === "light" ? darkTheme :
lightTheme }>
<Paper sx={{height:'auto'}}>
{ sessionStorage.getItem('accessType')!="" ? <Navbar /> : null }
{ loading && petitionIsLoading && <LinearProgressLoader /> }
59
<Box>
<Stack direction="row" justifyContent="space-between">
{ sessionStorage.getItem('accessType') === 'admin' ? <SidebarAdmin
sx={{ position: "fixed" }} /> : null }
{ sessionStorage.getItem('accessType') === 'sp' ? <SidebarSp sx={{
position: "fixed" }} /> : null }
{ sessionStorage.getItem('accessType') === 'dsp' ?
<SidebarLowerOfficials sx={{ position: "fixed" }} /> : null }
{ sessionStorage.getItem('accessType') === 'adsp' ?
<SidebarLowerOfficials sx={{ position: "fixed" }} /> : null }
{ sessionStorage.getItem('accessType') === 'inspr' ?
<SidebarLowerOfficials sx={{ position: "fixed" }} /> : null }
{ sessionStorage.getItem('accessType') === 'si' ? <SidebarLowerOfficials
sx={{ position: "fixed" }} /> : null }
{/*
{ sessionStorage.getItem('accessType') === ('adsp' || 'si' || 'inspr' ||
'dsp') &&
<SidebarLowerOfficials sx={{position:"fixed"}} />
} */}
<Routes>
{ sessionStorage.getItem('accessType') === '' && <Route path="/"
element={ <Login />} /> }
<Route path='/forgotPassword' element={<ResetPassword/>}/>
<Route path="/" element={ <Login />} />
{/* {
React.useEffect(()=>{isSignedInState === false ? <Route path="/"
element={<Login /> } /> : null ;
},[isSignedInState])
} */}
{
sessionStorage.getItem('accessType') == '' && (
60
<Route path='/'
element={<ProtectedRoutingComponentisSignedInState={isSignedIn} />}>
{/* for AboutOfficer */}
<Route path="/aboutOfficer" element={<Login />}/>
{/* for AddOfficer */}
<Route path="/addOfficer" element={<Login />}/>
{/* for Notification */}
<Route path="/notification" element={<Login />}/>
{/* for officerLists */}
<Route path="/officerList" element={<Login />}/>
</Route>
)
}
{
sessionStorage.getItem('accessType') === 'admin' && (
<Route path='/' element={<ProtectedRoutingComponent
isSignedInState={isSignedIn} />}>
{/* for AboutOfficer */}
<Route path="admin/aboutOfficer" element={<AboutOfficer />}/>
{/* for AddOfficer */}
<Route path="admin/addOfficer" element={<AddOfficer />}/>
{/* for Notification */}
<Route path="admin/notification" element={<Notification />}/>
{/* for officerLists */}
<Route path="admin/officerList" element={<OfficerList />}/>
</Route>
)
}
{
61
sessionStorage.getItem('accessType') === 'sp' && (
<Route path="/" element={<ProtectedRoutingComponent
isSignedInState={isSignedInState} />}>
{/* for dashboard */}
<Route path="sp/dashboard" element={<Dashboard />}/>
{/* for petitions */}
<Route path="/sp/petitions" element={<Petition />}/>
{/* for AddPetition */}
<Route path="sp/addPetition" element={<AddPetition />}/>
{/* for AboutOfficer */}
<Route path="sp/aboutOfficer" element={<AboutOfficer />}/>
<Route path="admin/petitions" element={<Petition />}>
<Route path='readmore' element={<ReadMore
data={"petitionerData"}/>}/>
</Route>
{/* for Notification */}
<Route path="sp/notification" element={<Notification />}/>
</Route>)
}
{
sessionStorage.getItem('accessType') === 'dsp' && (
<Route path="/" element={<ProtectedRoutingComponent
isSignedInState={isSignedInState} />}>
{/* for petitions */}
<Route path="dsp/petitions" element={<Petition />}/>
{/* for AboutOfficer */}
<Route path="dsp/aboutOfficer" element={<AboutOfficer />}/>
{/* for Notification */}
62
<Route path="dsp/notification" element={<Notification />}/></Route)
}
{
sessionStorage.getItem('accessType') === 'adsp' && (
<Route path="/"
element={<ProtectedRoutingComponentisSignedInState={isSignedInState}
/>}>
63
</Route>)
}
{
sessionStorage.getItem('accessType') === 'si' && (
<Route path="/" element={<ProtectedRoutingComponent
isSignedInState={isSignedInState} />}>
{/* for petitions */}
<Route path="si/petitions" element={<Petition />}/>
{/* for AboutOfficer */}
<Route path="si/aboutOfficer" element={<AboutOfficer />}/>
{/* for Notification */}
<Route path="si/notification" element={<Notification />}/>
</Route>)
}
{/* Error page */}
<Route path="*" element={<ErrorPage />} />
</Routes>
</Stack>
</Box>
</Paper>
</ThemeProvider>
</div>)
}
</> );
}
export default App;
64
CHAPTER 10
CONCLUSION
65
CHAPTER 11
REFERENCES
[1] K. Tabassum, H. Shaiba, S. Shamrani and S. Otaibi, "e-Cops: An Online
Crime Reporting and Management System for Riyadh City," 2018 1st
International Conference on Computer Applications & Information Security
(ICCAIS), Riyadh, Saudi Arabia, 2018, pp. 1-8, doi:
10.1109/CAIS.2018.8441987.
[2] I. Hingorani, R. Khara, D. Pomendkar and N. Raul, "Police Complaint
Management System using Blockchain Technology," 2020 3rd International
Conference on Intelligent Sustainable Systems (ICISS), Thoothukudi, India,
2020, pp. 1214-1219, doi: 10.1109/ICISS49785.2020.9315884.
[3] C. Vinothini, C. Tarun, K. A. Bhavana, G. Nikhil Krishna and A. Praveen,
"NBA web portal: A Comprehensive Survey on NBA Accreditation and
MERN Stack for the Purpose of Implementing a Portal," 2022 International
Conference on Inventive Computation Technologies (ICICT), Nepal, 2022, pp.
1245-1251, doi: 10.1109/ICICT54344.2022.9850953. [4] R. Razali
and J. Jaafar, "Complaint handling theoretical framework," 2012 International
Conference on Computer & Information Science (ICCIS), Kuala Lumpur,
Malaysia, 2012, pp. 382-385, doi: 10.1109/ICCISci.2012.6297275.
[5] M. M. Hussain, G. Geetha and R. Pitchai, "Conceptual Idea for
Implementing Automated Complaint Monitoring System for Rural
Development," 2022 International Conference on Innovative Computing,
Intelligent Communication and Smart Electrical Systems (ICSES), Chennai,
India, 2022, pp. 1-5, doi: 10.1109/ICSES55317.2022.9914042.
[6] "A review of online petitioning systems" by A. Novaro and G. Asensio
[7] "Crowd-based political activism: a case study of Change.org" by M.
Tufekci.
[8] Wireless LAN Medium Access Control (MAC) and Physical Layer (PHY)
Specification, IEEE Std. 802.11, 1997.
[9] "Building an online petition system using the MEAN stack" by A. B.
Kamaruddin and A. H. Haron.
[10] "Designing online petition systems for social change" by J. Krieger and K.
Lim.
66