[go: up one dir, main page]

0% found this document useful (0 votes)
44 views97 pages

Ngo wasteFoodManagement F

The document outlines a project report for an NGO and Food Waste Management System developed by a group of students under the guidance of Mr. Subhojit Santra. The system aims to connect food donors with NGOs to efficiently redistribute surplus food, utilizing the MERN stack for high performance and security. It includes a comprehensive analysis of system requirements, design, and implementation strategies to minimize food waste and enhance food distribution effectiveness.

Uploaded by

dibyamahato77
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
44 views97 pages

Ngo wasteFoodManagement F

The document outlines a project report for an NGO and Food Waste Management System developed by a group of students under the guidance of Mr. Subhojit Santra. The system aims to connect food donors with NGOs to efficiently redistribute surplus food, utilizing the MERN stack for high performance and security. It includes a comprehensive analysis of system requirements, design, and implementation strategies to minimize food waste and enhance food distribution effectiveness.

Uploaded by

dibyamahato77
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 97

NGO & Food waste Management System

A Project Report for industrial Internship Submitted

Submitted by
Manisha Banerjee
Sutapa Kanthal
Debolina Sau
Debjani Mondal
Albia Parween

Under guidance of Mr. Subhojit santra

Submitted In Partial Fulfilment of The

The Award Of the degree of

Bachelor of Technology in (ECE & CSE)


Of
FUTURE INSTITUTE OF ENGINEERING AND
MANAGEMENT

At
Ardent Computech Pvt. Ltd.
Module
(Note: All entries of the preform of approval should be filled up with appropriate and complete
information of approval in any respect will be summarily rejected.)

Name of the Student With Group:

1. Manisha Banerjee
2. Sutapa Kanthal
3. Debolina Sau
4. Debjani Mondal
5. Albia Parween

1. Title of the Project: NGO & Waste Food Management System


2. Name and Address of the Guide: Mr. Subhojit Santra
Sr. Subject Matter Expert &
Technical Head (c programing) Module #132,
Ground Floor, SDF Building, GP Block,Sector V,
Bidhannagar, Kolkata, West Bengal, Kolkata –
700091

3. Educational Qualification of the Guide: Ph.d* M.Tech B.Tech*/B.E* MCA* M.Sc*

4. Working and Teaching experience of the Guide : ………Years

5. Software used in the Project: a. Visual Studio Code

1.
2. Signature of the Guide
3. Date :
4.
Name: Subhojit Santra
5.
Subject Matter Expert.
Signature of the Student Signature, Designation, Stamp of the
Date : Project Proposal Evaluator
For the office use only

Approved Not Approved


CERTIFICATE FROM SUPERVISOR

This is to certify that “Manisha Banerjee, Sutapa Kanthal, Debolina Sau, Debjani Mondal,
Albia parween ” have successfully completed the project titled " NGO & WASTE FOOD
MANAGEMENT SYSTEM" under mysupervision which is in partial fulfillment of requirements
for the award of the MERN STACK with project and submitted to the Department of “ECE”
& ‘CSE’ of “Future Institute of Engineering & Management”.

Signature of the Supervisor

Date:

Name of the Project Supervisor:


ACKNOWLEDGEMENT

The achievement that is associated with the successful completion of any task would be incomplete
without mentioning the names of those people whose endless cooperation made it possible. Their
constant guidance and encouragement made all our efforts successful.

We take this opportunity to express our deep gratitude towards our project mentor, Mr. Subhojit
Santra for giving such valuable suggestions, guidance and encouragement during the development
of this project work.

Last but not the least we are grateful to all the faculty members of Ardent Computech Pvt. Ltd. for
their support.
Project Responsibility Form

Serial No Name of Member Responsibility

1. Sutapa Kanthal Project Leader, Coding,


database manage,
backend developer,
front end developer
2. Manisha Banerjee Coding, backend
developer

3. Debolina sau coding, Front-end


developer

4. Debjani Mondal Coding, Project


Documentation

5. Albia Parween Coding, Project


Documentation, ppt
Self Certificate

This is to certify that the dissertation/project proposal entitled“ NGO & Food waste management System”

Done by us, is an authentic work carried out for the partial fulfillment of the requirements for the

award ofthe certificate of Bachelor of Technology under the guidance of Mr. Subhojit Santra. The

matter embodied in this project work has not been submitted earlier for the award of any certificate to

the best of our knowledge and belief.

Name of the Student

 Manisha Banerjee

 Debolina Sau

 Sutapa Kanthal

 Debjani Mondal

 Albia Parween

Signature of the students

a.
b.

c.

d.
Certificate by Guide

This is to certify that this project entitled “ NGO & FOOD WASTE MANAGEMENT SYSTEM ”submitted in
partial fulfillment of the certificate of Bachelor of Computer Application through Ardent Computech
Pvt Ltd, done by the Group Members

 Manisha Banerjee

 Sutapa Kanthal

 Debolina Sau

 Debjani Mondal

 Albia Parween

Is an authentic work carried out under my guidance & best ofour knowledge and belief.
a.

b.

c.

d.

Signature of the students Signature of the Guide

Date : Date :
Certificate of Approval

This is to certify that this proposal of Minor project, entitled “NGO & FOOD WASTE MANAGEMENT

SYSTEM” is a record of bona-fide work, carried out by “Manisha Banerjee, Sutapa Kanthal,
Debolina Sau, Debjani Mondal, Albia Parween ” under my supervision and guidance through the
Ardent Computech Pvt Ltd. In my opinion, the report in its present form partially fulfills all the

requirements, as specified by the Future Institute of Engineering & Management as per regulations
of the Ardent®. It has attained the standard, necessary for submission. To the best of my knowledge, the

results embodied in this report, are original and worthy of incorporation in the present version of the report
for Bachelorof Technology.

Guide/Supervisor

Mr. Subhojit Santra


Subject Matter Expert & Technical Head (c programing& data structure)
Ardent Computech Pvt Ltd (An ISO 9001:2015 Certified)
Module #132, Ground Floor, SDF Building, GP Block, Sector V,Bidhannagar,
Kolkata, West Bengal, Kolkata - 700091

External Examiner(s) Head of the Department Department of


Computer Science Sonarpur, W.B
(Affiliated to MAKAUT, WB)
SL. NO. NAME OF THE TOPIC PAGE NO.
1 Company Profile 8

2 Introduction 9 - 11
2.A. Objective 10

2.B. Scope 11

3 System Analysis 12 - 22
3.A. Identification of Need 13

3.B. Feasibility Study 14

3.C. Work Flow 15


3.D. Study of the System 18

3.E. Input & Output 19

3.F. Software Requirements Specification (SRS) 20


3.G. Software Engineering Paradigm Applied 22

4 System Design 23 - 32
4.A. Data Flow Diagram 24

4.B. Sequence Diagram 27

4.C. Use-Case Diagram 29

5 UI snapshot 33 – 82

6 Conclusion 83

7 Future Scope & Further Enhancements 84

8 Bibliography 85
ARDENT COMPUTECH PVT.LTD.

Ardent Computech Private Limited is an ISO 9001-2015 certifiedSoftware Development


Company in India. It has been operatingindependently since 2003. It was recently merged
with ARDENTTECHNOLOGIES.
Ardent Technologies
ARDENT TECHNOLOGIES is a Company successfully providing its services currently in
the UK, USA, Canada and India. The core line of activity at ARDENT TECHNOLOGIES is
to develop customized application software covering the entire responsibility of performing
the initial system study, design, development, implementation and training. It also deals with
consultancy servicesand Electronic Security systems. Its primary clientele includes
educational institutes, entertainment industries, resorts, theme parks, service industry,
telecommute operators, media and other business houses working in various capacities.
Ardent Collaborations
ARDENT COLLABORATIONS, the Research Training and DevelopmentDepartment of
ARDENT COMPUTECH PVT LTD is a professional training Company offering IT enabled
services & industrial training’s for B-Tech, MCA, BCA, MSc and MBA freshers and
experienced developers/programmers in various platforms. Summer Training / Winter
Training / Industrial training will be provided for the students of B. TECH, M. TECH, MBA
and MCA only. Deserving candidates may be awarded stipends, scholarships and other
benefits, depending on their performance and recommendations ofthe mentors.
Associations
Ardent is an ISO 9001:2015 company.
It is affiliated to National Council of Vocational Training (NCVT), Directorate General of
Employment & Training (DGET), Ministry ofLabor & Employment, and Government of India.
1) Introduction

Our NGO and Waste Food Management System is a purpose-driven platform designed to combat
food waste and promote efficient food distribution to those in need. By seamlessly connecting
food donors, NGOs, and beneficiaries, we streamline the donation process through real-time
tracking, intelligent management tools, and location-based services.

Powered by the MERN stack, our system ensures high performance, robust security, and full
transparency. It empowers restaurants, hotels, and individuals to contribute meaningfully to a
sustainable future, while providing NGOs with optimized logistics and valuable data insights to
ensure surplus food reaches the right hands at the right time.

By leveraging technology for social impact, we strive to bridge the gap between food excess and
hunger—creating a collaborative, efficient, and compassionate ecosystem. Join us in our
mission to reduce waste and deliver hope—one meal at a time.
2A. OBJECTIVE

The primary objective of our NGO and Waste Food Management System is to effectively bridge
the gap between food donors and NGOs, ensuring that surplus food is redirected to those who
need it most in a timely and efficient manner. Our platform is designed to simplify and digitize
the food donation process, allowing individuals, restaurants, hotels, grocery stores, and other
businesses to effortlessly list, track, and manage their food contributions through an intuitive
interface.

On the other end, NGOs are equipped with powerful tools to coordinate collections, monitor
donation statuses, and plan distribution routes—reducing manual effort and improving operational
efficiency. By leveraging features like real-time tracking, geolocation-based services, and a
centralized dashboard, NGOs can optimize their logistics, minimize food spoilage, and ensure
that donations are delivered promptly and reliably.

Furthermore, the system promotes transparency and accountability in the food redistribution
process, offering data-driven insights and reporting tools that help stakeholders measure their
impact. Ultimately, our goal is to build a sustainable, tech-enabled ecosystem that not only
reduces food waste but also maximizes social good—making food redistribution more
accessible, organized, and impactful across communities.
2B. SCOPE

Scope of the System


Our NGO and Waste Food Management System is built to minimize food wastage while ensuring the
efficient and equitable distribution of surplus food to underprivileged communities. By connecting food
donors—such as restaurants, hotels, and individuals—with NGOs and volunteers, the platform fosters a
structured, transparent, and tech-enabled donation ecosystem.

1)Food Donation &Collection:


The system allows donors to conveniently list surplus food items, while NGOs and volunteers can
seamlessly coordinate and schedule pickups. This ensures timely collection and reduces the risk of spoilage

2)Real-Time Tracking:
Integrated GPS-based tracking enables stakeholders to monitor donation pickups and deliveries in real-
time, ensuring transparency and helping NGOs optimize their distribution routes.

3)user Authentication Role Management


The platform features secure login and role-based access, with tailored dashboards for donors, NGOs,
volunteers, and administrators. This ensures effective user management and operational control.

4) Scalability & Regional Expansion


Designed with growth in mind, the system can be easily scaled to support operations across multiple cities
and regions, accommodating a wider network of users and donations.

5)Future Enhancements & Technological Integration


Upcoming features include AI-driven demand prediction, automated route scheduling, advanced analytics,
and a dedicated mobile application for enhanced user experience and broader accessibility.
3A. IDENTIFICATION OF NEED

System analysis is a crucial phase in the development of our NGO and Waste Food
Management System, involving the gathering of information, diagnosing existing
problems, and identifying areas for improvement. It requires continuous communication
between system users (donors, NGOs, and volunteers) and developers to create an
efficient and user-friendly platform.

The analysis process examines the current food donation challenges, including food
wastage, lack of coordination between donors and NGOs, and inefficient distribution
methods. Various techniques such as interviews and surveys help in understanding
these issues in-depth. The data collected is carefully reviewed to define the requirements
of the new system.

The existing system of food donation, which often relies on manual coordination, limited
tracking, and inefficient resource allocation, is analyzed to identify bottlenecks.

The proposed solution—a digital platform with real-time tracking, an updated donor
list, and a seamless donation process—aims to address these inefficiencies. The
system is then reviewed by users, and necessary improvements are made based on their
feedback until an optimal solution is reached.
3B. FEASIBILITY STUDY

A Feasibility Study is a comprehensive assessment conducted to evaluate the practicality and


viability of our NGO and Waste Food Management System. This study aims to determine whether
the project is technically, financially, and operationally feasible while addressing challenges
related to food wastage and efficient distribution. It involves an in-depth analysis of factors such
as technical requirements, user adoption, financial sustainability, and potential risks.

During the Feasibility Study, key challenges such as low user engagement, data security concerns,
and system scalability are identified, and potential solutions are explored. The study helps
stakeholders, including donors, NGOs, and developers, make informed decisions by providing
insights into the project's potential success and long-term impact. Key components of this study
include technical feasibility, operational efficiency, financial projections, and risk assessment,
ensuring that the system is both practical and sustainable.

Ultimately, a well-conducted Feasibility Study serves as a crucial foundation for decision-making,


guiding stakeholders in implementing an effective and user-friendly system. This ensures that the
project successfully minimizes food waste, streamlines donations, and enhances food
distribution, creating a positive social impact while leveraging technology for sustainable
solutions.
3C.WORKFLOW

This Document plays a vital role in the development life cycle (SDLC) asit describes the complete
requirements of the system. It is meant for use by the developers and will be the basic during the
testing phase.
Any changes made to the requirements in the future will have to gothrough a formal change approval
process.
The Waterfall Model was the first Process Model to be introduced. It is also referred
to as a linear-sequential life cycle model. Itis very simple to understand and use. In a waterfall
model, each phase must be completed before the next phase can begin and there is no overlapping
in the phases.
The waterfall model is the earliest SDLC approach that was used forsoftware development.
The waterfall Model illustrates the software developmentprocess in a linear
sequential flow; hence it is also referred to as a linear-sequential life cycle model. This means
that any phase in the development process begins only if the previous phase is complete. In the
waterfall model phases do not overlap.
 Waterfall Model design:
The waterfall approach was the first SDLC Model to be used widely in Software Engineering to ensure
the success of the project. In “The Waterfall” approach, the whole process of software development is
divided into separate phases. In the Waterfall model, typically, the Outcome of one phase acts as the
input for the next phase sequentially.
 IterativeWaterfall Design:
 Definition: The Iterative Waterfall Model is a variation of the traditional Waterfall model, which
is a linear and sequential softwaredevelopment methodology. In the Iterative Waterfall
Model, the development process is divided into small, manageable cycles, allowing for the
revisiting and refinement of phases before progressing to the next stage. It combines the
systematic structure ofthe Waterfall model with the flexibility of iterative development.
The sequential phases in Iterative Waterfall model are:
 Requirement Gathering and analysis: All possible requirements ofthe system to be
developed are captured in this phase and documented in a requirement specification doc.
 System Design: The requirement specifications from first phase are studied in this phase
and system design is prepared. System Design helps in specifying hardware and system
requirements and also helpsin defining overall system architecture.
 Implementation: With inputs from system design, the system is firstdeveloped in small
programs called units, which are integrated in thenext phase. Each unit is developed and
tested for its functionality which is referred to as Unit Testing.
 Integration and Testing: All the units developed in the implementation phase are
integrated into a system after testing each unit. Post integration the entire system is tested
for any faultsand failures.
 Deployment of the system: Once the functional and non-functional testing is done, the product
is deployed in the customer environmentor released into the market.
 Maintenance: Some issues come up in the client environment.To fix those issues
patches are released. Also to enhance the product some better versions are
released. Maintenance is done to deliver these changes in the customer environment.
All these phases are cascaded to each other in progress andare seen as flowing
steadily downwards (like a waterfall) through the phases. The next phase is started only after the
defined set of goals areachieved for the previous phase and it is signed off, so the name
“Iterative Waterfall Model”. In this model, phases do not overlap.

 Avantages:
1 . Flexibility: Iterations permit adjustments based on feedback.
2 . Early Delivery: Partial systems can be delivered incrementally.
3 . Risk Management: Identifying and addressing issues early in theprocess.
 Disadvantages:
1. Increased Complexity: The iterative nature can make the process morecomplex.
2. Potential for Scope Creep: Frequent iterations may lead to scopechanges.
3. Resource Intensive: Continuous revisiting of phases may demandmore resources.

 Applications:
The Iterative Waterfall Model is suitable for projects with evolving orunclear requirements. It is
commonly used in software developmentprojects where regular feedback and refinement are
essential.
Additionally, it is applicable in scenarios where partial system delivery is beneficial, allowing
stakeholders to assess progress andmake adjustments.
3.D.STUDY OF THE SYSTEM

Modules: The modules used in this software are as follows:

Login:
1 . User Login: Here user will login to order the product.
2 . Admin Login: Here admin will log in to handle all the data.
3 . Delivery Partner Login: Here Delivery Partner management will log in to see whichfood is
ordered and update accordingly.
4 . Delivery Agent Login: Here Delivery agent will log in to see the order detailsand send the OTP
to the admin after the delivery is done.
Signup:
1 . User Sign up: Here, the user will sign up to order the product.
2 . Admin Sign up: Here, the admin will sign up to handle all the databases.
3 . Delivery Partner Sign-up: Here, Delivery Partner management will sign up to seewhich food
is ordered and update accordingly.
4 . Delivery Agent Sign-up: Here, the Delivery agent will sign up to see the orderdetails and send the
OTP to the admin after the delivery is done.
Home:
1 . Home: This page is for fetching the location of the user.
 About us: This page will show the details about the website developers.
User Interface:
1. Search for Menu: In this case, the user will search the product to order.
2. My Order: Here, the user will see the ordered product.
3. My Account: Here, the user will see the details after login.
4. My Cart: Here, the user will add the product.
Admin Interface:
1. User Database: Here, the admin will see the details of users.
2. Order Database: Here, the admin will see the details of orders.
3. Cancel Database: Here, the admin will see the details of the cancellation oforders.
3.E INPUT AND OUTPUT

The main inputs, outputs and the major function the details are:

 INPUT:

1. Users can log in by entering their credentials on the login page.


2. Donors can provide input for food type, food quantity, and donation amount
(money or resources).

 OUTPUT:

1. Users can view the status of their donation request, along with details of the donor
list and location tracking after a donation is made.
2. The admin can access a centralized database that includes details of users, donations,
cancellations, and order records, ensuring efficient system management.
3F. SOFTWARE REQUIREMENT SPECIFICATIONS

Software Requirements Specification (SRS) provides an overview of the NGO and Waste Food

Management System, detailing its functional and non-functional requirements. It ensures a clear

understanding of the system's purpose, features, and expected behavior, derived through

extensive discussions with stakeholders.

Developer Responsibilities:

a. Develop a system that meets the SRS requirements and fulfills all

necessary functionalities.

b. Demonstrate, install, and deploy the system at the client’s location after

successful testing.

c. Provide a user manual explaining system functionalities and interfaces.

d. Conduct training sessions for users, if required.

e. Maintain the system for one year after deployment.


Functional Requirements:

A. User Registration and Authentication:

1. Users should be able to create and manage accounts securely.

2. The system should provide secure authentication and session management.

B. Food Donation and Tracking:

1. Users should be able to submit donation requests by entering details such as food type, quantity,

and location.

2. The system should track donations and provide real-time updates on the status of contributions.

C. Donor and NGO Interaction:

1. Users should be able to view available donation requests and respond accordingly.

2. NGOs can update donation status and manage records.

D. Location-Based Search and Tracking:

1. Users should be able to search and filter donation requests based on location and urgency.

2. Integrated maps and real-time tracking to assist in food collection and delivery.

 Hardware Requirements:
1 . Computer has Intel I5 Processor
2 . 8 GB RAM
3. DVD-ROM Drive
 Software Requirements:
1. Windows 11 OS
2. Visual Studio Code
3. Mongo DB Atlas
3G. SOFTWARE ENGINEERING PARADIGM APPLIED
Software paradigms refer to the methods and steps, which are taken while designing the software.
There are many methods proposed and are in work today, but we need to see where in software
engineering these paradigms stand. These can be combined into various categories, though each of
them is containedin one another.

The programming paradigm is a subset of Software design paradigm which isfurther a subset of
the Software development paradigm.
There are two levels of reliability. The first is meeting the right requirements. A careful and thorough
systems study is needed to satisfy this aspect of reliability.The second level of systems reliability
involves the actual work delivered to the user. At this level, the system’s reliability is interwoven with
software engineering and development.
There are three approaches to reliability.
1. Error avoidance: Prevents errors from occurring in software.
2. Error detection and correction: In this approach, errors are recognizedwhenever they are
encountered, and correcting the error by the effect of theerror of the system does not fail.
3. Error tolerance: In this approach, errors are recognized whenever they occur,but enables the
system to keep running through degraded performance or Applying values that instruct the system
to continue process.

22
4A. DATA FLOW DIAGRAM

A data flow diagram (DFD) is a graphical representation of the "flow"of data through an
information system, modeling its process aspects. ADFD is often used as a preliminary step to
create an overview of the system, which can later be elaborated.
DFD can also be used for the visualization of data processing(structured design).
A DFD shows what kind of information will be input to and output fromthe system, where the data will
come from and go to, and where the data will be stored. It does not show information about the
timing of the process or information about whether processes will operate in sequence or in parallel
(which is shown on a flowchart).
This context-level DFD is next "exploded", to produce a Level 1DFD that shows some
of the detail of the system being modeled. TheLevel 1 DFD shows how the system is divided
into sub-systems (processes), each of which deals with one or more of the data flows to or from
an external agent, and which together provide all of the functionality of the system as a whole. It
also identifies internal data stores that must be present for the system to do its job and shows the
flow of data between the various parts of the system.
Data flow diagrams are one of the three essential perspectives of the structured-systems
analysis and design method SSADM. The sponsor ofa project and the end users will need to be
briefed and consulted throughout all stages of a system's evolution. With a data flow diagram,
users can visualize how the system will operate, what the system will accomplish, and how the
system will be implemented. Theold system's data-flow diagrams can be drawn up and
compared with
How any system is developed can be determined through a data flow diagrammodel.
In the course of developing a set of leveled data flow diagrams, the analyst/designer is forced to
address how the system may be decomposed into component sub-systems and to identify the
transaction data in the data model. Data flow diagrams can be used in both the Analysis and Design
phase of the SDLC. There are different notations to draw data flow diagrams. Defining different visual
representations for processes, data stores, data flow, and external entities.

DFD Notation:

DFD EXAMPLE:

Steps to Construct Data Flow Diagram: -


Four Steps are generally used to construct a DFD.
 Process should be named and referred for easy reference. Each name shouldbe
representative of the reference.
 The destination of flow is from top to bottom and from left to right.
 When a process is distributed into lower-level details they are numbered.
 The names of data stores, sources, and destinations are written in capitalletters.
Rules for constructing a Data Flow Diagram: -
 Arrows should not cross each other.
 Squares, Circles, and Files must bear a name.
 Decomposed data flow squares and circles can have the same names.
 Draw all data flow around the outside of the diagram.
LEVEL 0 DFD OR CONTEXT DIAGRAM:
LEVEL 1 DFD:
4B. SEQUENCE DIAGRAM

A Sequence diagram is an interaction diagram that shows how processes operate with one
another and what is their order. It is a construct of a Message Sequence Chart. A sequence
diagram shows object interactions arranged in a time sequence. It depicts the objects and
classes involved in the scenario and the sequence of messages exchanged between the
objects needed to carry out the functionalityof the scenario. Sequence diagrams are typically
associated with use case realizations in the Logical View of the system under development.
Sequence diagrams are sometimes called event diagrams or event scenarios.
A sequence diagram shows, as parallel vertical lines (lifelines), different processes or
objects that live simultaneously, and, as horizontal arrows, the messages exchanged
between them, in theorder in which they occur. This allows the specification of simple
runtime scenarios in a graphical manner.
A sequence diagram is the most common kind of interaction diagram,which focuses on the
message interchange between several lifelines.A sequence diagram describes an interaction
by focusing on the sequence of messages that are exchanged, along with their corresponding
occurrence specifications on the lifelines.
The following nodes and edges are typically drawn in a UML sequencediagram: lifeline,
execution specification, message, fragment, interaction, state invariant, continuation, and
destruction occurrence.
28
Use case diagram

A Use case diagram at its simplest is a representation of a user's interaction with the system that shows

the relationship between the userand the different use cases in which the user is involved. A use case

diagram can identify the different types of users of a system and the different use cases and will often be

accompanied by other types of diagrams as well.


So only static behavior is not sufficient to model a system rather dynamic behavior is more important
than static behavior. In UML there are five diagrams available to model dynamic nature and a use case
diagram is oneof them. Now as we have to discuss that the use case diagram is dynamic in nature
there should be some internal or external factors for making theinteraction.
These internal and external agents are known as actors. So, use case diagrams consist of actors, use
cases, and their relationships. The diagramis used to model the system/subsystem of an application. A
single-use casediagram captures a particular functionality of a system.
So, to model the entire system numbers of use case diagrams are used. The purpose of a use case
diagram is to capture the dynamic aspect of asystem. But this definition is too generic to describe
the purpose.
Because the other four diagrams (activity, sequence, collaboration, andState chart) are also having
the same purpose. So, we will look into somespecific purpose that will distinguish it from the other
four diagrams.
Use case diagrams are used to gather the requirements of a system including internal and external
influences. These requirements are mostlydesign requirements. So, when a system is analyzed to
gather its functionalities use cases are prepared and actors are identified.
Now when the initial task is complete use case diagrams are modeled topresent the outside view.
So, in brief, the purposes of use case diagrams can be as follows:
 Used to gather requirements of a system.
 Used to get an outside view of a system.
 Identify external and internal factors influencing the system.
 Show the interaction among the requirements actors.
How to draw Use Case Diagram?

Use case diagrams are considered for high level requirement analysis of a system.
So, when the requirements of a system are analyzed, the functionalities are
captured in use cases.
So, we can say that uses cases are nothing but the system functionalities written
in an organized manner. Now the second thingswhich are relevant to the use
cases are the actors. Actors can be defined as something that interacts with the
system.
The actors can be human user, some internal applications or may be some external
applications. So, in a brief when we are planning to drawa use case diagram, we
should have the following items identified.
 Functionalities to be represented as a use case
 Actors
 Relationships among the use cases and actors.

Use case diagrams are drawn to capture the functional requirements of a system.
So, after identifying the above items we have to follow thefollowing guidelines to
draw an efficient use case diagram.
 The name of a use case is very important. So, the name should bechosen in
such a way so that it can identify the functionalities performed.
 Give a suitable name for actors.
 Show relationships and dependencies clearly in the diagram.
 Do not try to include all types of relationships. Because the mainpurpose of
the diagram is to identify requirements.
 Use note whenever required to clarify some important point
Schema Design
The schema is an abstract structure or outline representing the logical view of the
database as a whole. Defining categories ofdata and relationships between those
categories, database schema design makes data much easier to retrieve, consume,
manipulate, and interpret.

DB schema design organizes data into separate entities, determines how to create
relationships between organized entities, and influences the applications of
constraints on data.Designers create database schema to give other database users,
such as programmers and analysts, a logical understanding of data.
Hero Page: -
code
import React from 'react';
import './Hero.css';
import logo from '../../assets/logo_png.png';
import {NavLink} from 'react-router-dom';

const Hero = () => {


return (
<div className="hero">
<nav className='container'>
<div className="nav-logo">
<img src={logo} alt="FoodSaver Logo" className='logo'/>
</div>
<ul className="nav-links">
<li><NavLink to='/home' activeClassName="active">Home</NavLink></li>
<li><NavLink to='/about' activeClassName="active">About</NavLink></li>
<li><NavLink to='/loginSignup' activeClassName="active">Login</NavLink></li>
<li><NavLink to='/contact' activeClassName="active">Contact</NavLink></li>
<li><NavLink to='/dash' activeClassName="active">Dashboard</NavLink></li>
</ul>
</nav>

{/* Hero Section */}


<div className="hero-content">
<h1 className="hero-title white-text">Welcome to <span
className="highlight">FoodSaver NGO</span></h1>
<p className="hero-description white-text"> Together, we take a stand against food
waste and nourish those in need. Join our mission today! 🍽</p>
<NavLink to='/about' className="hero-button"> Learn More</NavLink>
</div>
</div>
);
}

export default Hero;


import React from 'react'
import {NavLink} from 'react-router-dom';
import './Navbar.css'
import logo from '../../assets/logo_png.png'

const navbar = () => {


return (
<nav className='container'>
<img src={logo} alt="Company logo" className='logo'/>
<ul>

<li><NavLink to='/'>Hero</NavLink></li>
<li><NavLink to='/navb'>Navbar</NavLink></li>
<li><NavLink to='/home'>Home</NavLink></li>
<li><NavLink to='/about'>About</NavLink></li>
<li><NavLink to='/loginSignup'>LoginSignup</NavLink></li>
<li><button className='btn'><NavLink
to='/contact'>contact</NavLink></button></li>
</ul>
</nav>
)
};

import React from 'react';


import { useNavigate } from 'react-router-dom';
import { Link } from 'react-router-dom';
import '../css/Home.css';

const Home = () => {


const navigate = useNavigate();

return (
<div className="home-container">
{/* Header */}
<header className="header">
<div className="header-content">
<h1 className="logo" color='#008080'>🍽 <span className="highlight" style={{ color:
'#008080' }}>FoodSaver NGO</span></h1>
<nav className="nav-buttons">
<Link to="/dash" className="nav-link">
<button className="donate-button" > Donate</button>
</Link>
<button className="home-button" onClick={() => navigate('/')}> Home</button>
</nav>
</div>
</header>
{/* Hero Section */}
<section className="hero-section">
<div className="hero-content">
<h2 className="hero-title"> Ending Food Waste. Nourishing Lives.</h2>
<p className="hero-description">
<strong>Join us</strong> in our mission to fight food waste and provide meals to those
in need.
We work with businesses, volunteers, and donors to rescue surplus food and distribute it
where it's needed most.
</p>
<Link to="/contact" className="hero-link">
<button className="join-button"> Get Involved</button>
</Link>
</div>
<div className="hero-image">
<img
src="https://images.unsplash.com/photo-1556740749-887f6717d7e4"
alt="Food Donation"
className="responsive-image shadow-effect"
/>
</div>
</section>

{/* Info Section */}


<section className="info-section">
<h2 className="section-title"> How You Can Help</h2>
<div className="info-cards">
{[
{ title: " Our Mission", text: "We strive to create a sustainable solution to food waste
while feeding the hungry." },
{ title: " Volunteer With Us", text: "Your time and effort can make a difference. Join our
team today!" },
{ title: " Impact Stories", text: "See how rescued food is changing lives in communities
across the country." }
].map((card, index) => (
<div key={index} className="info-card stylish-card">
<h3>{card.title}</h3>
<p>{card.text}</p>
</div>
))}
</div>
</section>

{/* Footer */}


<footer className="footer">
<p>© 2025 <span className="footer-highlight" style={{ color: '#ff5733' }}>FoodSaver
NGO</span> | Making the world a better place, one meal at a time.</p>
</footer>
</div>
);
};
export default Home;
import React from 'react'
import Hero from './components/Hero/Hero'
import Navbar from './components/navbar/Navbar'
import './App.css'
import { BrowserRouter,Routes,Route } from 'react-router-dom'
import Home from './components/Home'
import About from './components/About'
import Contact from './components/Contact'
import LoginSignup from './components/LoginSignup'
import Dashboard from './Dashboard/client/src/services/Dashboard'

const App = () => {


return <>
<BrowserRouter>
<Routes>

<Route path='/' element={<Hero/>}></Route>


<Route path='/navb' element={<Navbar/>}></Route>
<Route path='/home' element={<Home/>}></Route>
<Route path='/about' element={<About/>}></Route>
<Route path='/contact' element={<Contact/>}></Route>
<Route path='/loginsignup' element={<LoginSignup/>}></Route>
<Route path='/dash' element={<Dashboard/>}></Route>

</Routes>
</BrowserRouter>
</>
}

export default App


Login/signup:
import React, { useState } from 'react';
import '../css/LoginSignup.css';
import { Link } from 'react-router-dom';

const LoginSignup = () => {


const [name, setName] = useState("");
const [email, setEmail] = useState("");
const [password, setPassword] = useState("");
const [isLogged, setIsLogged] = useState(false);

const handleLogin = (e) => {


e.preventDefault();

const userData = { name, email, password };


localStorage.setItem("token-info", JSON.stringify(userData));

setIsLogged(true);
setName("");
setEmail("");
setPassword("");
};

const handleLogout = () => {


localStorage.removeItem("token-info");
setIsLogged(false);
};

return (
<div className="login-container enhanced-background">
{!isLogged ? (
<div className="login-box animated-box shadow-box">
<h2 className="login-title gradient-text">Login</h2>
<form onSubmit={handleLogin}>
<div className="form-group">
<label>Name</label>
<input
type="text"
value={name}
onChange={(e) => setName(e.target.value)}
placeholder="Enter your name"
required
/>
</div>
<div className="form-group">
<label>Email</label>
<input
type="email"
value={email}
onChange={(e) => setEmail (e.target.value)}
placeholder="Enter your email"
required
/>
</div>
<div className="form-group">
<label>Password</label>
<input
/>
</div>
<button type="submit" className="btn neon-btn glow-effect">Login</button>
</form>
</div>
):(
<div className="welcome-box animated-box shadow-box">
<h2 className="welcome-title gradient-text">Welcome, {name}!</h2>
<p className="welcome-text">You are successfully logged in. Explore your
dashboard!</p>
<Link to='/dash'>
<button className="btn dashboard-btn neon-btn glow-effect"
onClick={handleLogout}>Go to Dashboard</button>
</Link>
</div>
)}
</div>
);
};

export default Login Signup;


Home page:
import React from 'react';
import { useNavigate } from 'react-router-dom';
import { Link } from 'react-router-dom';
import '../css/Home.css';

const Home = () => {


const navigate = useNavigate();

return (
<div className="home-container">
{/* Header */}
<header className="header">
<div className="header-content">
<h1 className="logo" color='#008080'>🍽 <span className="highlight" style={{ color: '#008080'
}}>FoodSaver NGO</span></h1>
<nav className="nav-buttons">
<Link to="/dash" className="nav-link">
<button className="donate-button" > Donate</button>
</Link>
<button className="home-button" onClick={() => navigate('/')}> Home</button>
</nav>
</div>
</header>

{/* Hero Section */}


<section className="hero-section">
<div className="hero-content">
<h2 className="hero-title"> Ending Food Waste. Nourishing Lives.</h2>
<p className="hero-description">
<strong>Join us</strong> in our mission to fight food waste and provide meals to those in need.
We work with businesses, volunteers, and donors to rescue surplus food and distribute it where it's
needed most.
</p>
<Link to="/contact" className="hero-link">
<button className="join-button"> Get Involved</button>
</Link>
</div>
<div className="hero-image">
<img
src="https://images.unsplash.com/photo-1556740749-887f6717d7e4"
alt="Food Donation"
className="responsive-image shadow-effect"
/>
</div>
</section>

{/* Info Section */}


<section className="info-section">
<h2 className="section-title"> How You Can Help</h2>
<div className="info-cards">
{[
{ title: " Our Mission", text: "We strive to create a sustainable solution to food waste while
feeding the hungry." },
{ title: " Volunteer With Us", text: "Your time and effort can make a difference. Join our team
today!" },
{ title: " Impact Stories", text: "See how rescued food is changing lives in communities across the
country." }
].map((card, index) => (
<div key={index} className="info-card stylish-card">
<h3>{card.title}</h3>
<p>{card.text}</p>
</div>
))}
</div>
</section>

{/* Footer */}


<footer className="footer">
<p>© 2025 <span className="footer-highlight" style={{ color: '#ff5733' }}>FoodSaver NGO</span> |
Making the world a better place, one meal at a time.</p>
</footer>
</div>
);
};

export default Home;


Hero.css
/* *{
margin:0;
padding: 0;
}

.hero {
height: 100%;
width: 100%;
position: fixed;
top: 60px;
left: 0;
z-index: -1;
display: grid;
background: url('../../assets/FoodBackground.jpg');
background-repeat: no-repeat;
background-size: cover;
} */
* Hero.css */
*{
margin: 0;
padding: 0;
box-sizing: border-box;
}

.hero {
height: 100vh;
width: 100%;
position: fixed;
top: 0;
left: 0;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
text-align: center;
background: url('../../assets/FoodBackground.jpg') no-repeat center center;
background-size: cover;
background-position: center;
color: white;
padding: 20px;
}
container {
display: flex;
justify-content: space-between;
align-items: center;
width: 90%;
padding: 20px;
background: rgba(0, 0, 0, 0.9);
border-radius: 10px;
}

.nav-logo .logo {
width: 150px;
}
.nav-links {
display: flex;
list-style: none;
gap: 20px;
}

.nav-links li a {
text-decoration: none;
color: #ffcc00;
font-size: 20px;
font-weight: bold;
transition: 0.3s;
}

.nav-links li a:hover, .nav-links li a.active {


color: #ff5733;
}

.hero-title {
font-size: 4rem;
font-weight: bold;
text-shadow: 4px 4px 8px rgba(0, 0, 0, 0.9);
color: #ffffff;
}
hero-content-box {
background: rgba(0, 0, 0, 0.8);
padding: 20px;
border-radius: 10px;
max-width: 900px;
}

.quote-box {
background: rgba(0, 0, 0, 0.8);
padding: 15px;
border-radius: 8px;
display: inline-block;
margin-top: 15px;
max-width: 600px;
}

.hero-description {
font-size: 1.5rem;
font-weight: bold;
text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.8);
color: #ffffff;
}
white-text {
color: #ffffff !important;
text-shadow: 2px 2px 6px rgba(255, 255, 255, 0.8);
font-weight: bold;
}
.hero-button {
display: inline-block;
margin-top: 25px;
padding: 15px 30px;
background: linear-gradient(45deg, #ffcc00, #ff9900);
color: black;
font-size: 22px;
font-weight: bold;
border-radius: 10px;
text-decoration: none;
transition: all 0.3s ease-in-out;
box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.5);
}

.hero-button:hover {
background: linear-gradient(45deg, #ffb300, #e67e00);
transform: scale(1.1);
box-shadow: 4px 4px 15px rgba(0, 0, 0, 0.7);
}
About page:
import React from "react";
import '../css/About.css'
import { Link } from "react-router-dom";
const About = () => {
return (
<div className="about">
<div className="about-container">
<div className="about-content">
<h1 className="about-title">About Us</h1>
<p className="about-text">
Welcome to <span className="highlight">FoodSaver NGO</span>, an organization
dedicated to reducing food waste and fighting hunger. We believe that surplus food should be
redirected to those in need instead of being discarded.
</p>
<h2 className="about-subtitle">Our Mission</h2>
<p className="about-text">
Our mission is to create a sustainable and efficient food redistribution system that minimizes
waste and maximizes social impact. By partnering with restaurants, grocery stores, and food
producers, we ensure that excess food reaches underprivileged communities.
</p>
<h2 className="about-subtitle">Why Manage Food Waste?</h2>
<ul className="about-list">
<li><span className="highlight">Reduces Hunger:</span> Millions of people go hungry while
food is wasted daily. Redistribution helps those in need.</li>
<li><span className="highlight">Environmental Protection:</span> Food waste in landfills
produces methane, a harmful greenhouse gas. Managing waste helps reduce emissions.</li>
<li><span className="highlight">Economic Benefits:</span> Reducing food waste saves
money for businesses and households.</li>
<li><span className="highlight">Efficient Resource Use:</span> Growing and transporting
food requires water, land, and energy. Reducing waste conserves these resources.</li>
<li><span className="highlight">Supports Sustainability:</span> Managing waste food aligns
with sustainable practices and responsible consumption.</li>
</ul>
<h2 className="about-subtitle">Get Involved</h2>
<p className="about-text">
Whether you're a business looking to donate surplus food, a volunteer eager to help, or a
supporter of sustainable practices, we welcome you to join our cause. Together, we can make a
difference.
</p>

<Link to='/contact'>
<button className="about-button">contact</button>
</Link>

</div>
</div>
</div>
);
};

export default About;


about-css
.about-container {
background: url("../assets/about.jpg") no-repeat center center/cover;
background-attachment: fixed; /* Keeps background fixed on scroll */
min-height: 100vh;
display: flex;
justify-content: center;
align-items: center;
padding: 40px;
}

/* Card-style content box */


.about-content {
background: rgba(255, 255, 255, 0.85); /* Soft transparency for text visibility */
padding: 40px;
max-width: 900px;
border-radius: 15px;
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
text-align: center;
transition: transform 0.3s ease-in-out;
}

/* Hover effect on content */


.about-content:hover {
transform: scale(1.02);
}

/* Main title styling */


.about-title {
font-size: 2.5rem;
font-weight: bold;
color: #2e7d32;
margin-bottom: 20px;
}

/* Subtitle styling */
.about-subtitle {
font-size: 1.8rem;
font-weight: 600;
color: #388e3c;
margin-top: 25px;
}

/* Paragraph text */
.about-text {
font-size: 1.1rem;
color: #333;
margin-bottom: 20px;
line-height: 1.7;
}
* Highlighted text */
.highlight {
font-weight: bold;
color: #1b5e20;
}

/* List styling */
.about-list {
text-align: left;
color: #444;
margin-bottom: 25px;
padding-left: 25px;
}

.about-list li {
margin-bottom: 12px;
font-size: 1.1rem;
transition: color 0.3s ease-in-out;
}
* List item hover effect */
.about-list li:hover {
color: #2e7d32;
font-weight: bold;
}

/* Button Styling */
.about-button {
background-color: #2e7d32;
color: white;
padding: 14px 28px;
border: none;
border-radius: 10px;
font-size: 1.1rem;
cursor: pointer;
transition: background-color 0.3s ease-in-out, transform 0.2s;
}
.about-button:hover {
background-color: #1b5e20;
transform: scale(1.05);
}
Contact us page:
import React from 'react'
import '../css/Contact.css'
import { Link } from 'react-router-dom';

const Contact = () => {


return (
<div className='contact-page flex-column align-items-center'>
<h2 className='fs-1 b-3 text-uppercase fw-bold'>Where to Find Us</h2>
<p className='mb-5'>
<div className="map-container">
<iframe
title="Google Map"
width="100%"
height="100%"
frameBorder="0"
style={{ border: 0 }}

src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3687.6193195499627!2d88.41285357529
668!3d22.443349679583918!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x3a0272166e4cb263%3A
0x27f12170efd9ddee!2sFuture%20Institute%20of%20Engineering%20and%20Management!5e0!3m2!1sen!2sin!
4v1739679942092!5m2!1sen!2sin"
allowFullScreen
loading="lazy"
referrerPolicy="no-referrer-when-downgrade"
></iframe>
</div>
</p>
<h3>Working Hours</h3>
<p>Mon - Sat: 8:00-21:00</p>
<p>Sun: 10:00-19:00</p>

<Link to="/about">
<button type='button' className='btn btn-outline-dark btn-lg'>
Check Us Out!
</button>
</Link>

<Link to="/">
<button type='button' className='btn btn-outline-dark btn-lg'>
Go to first page!
</button>
</Link>

<p><b><center>CONTACT US: 8653015622</center></b></p>


<a href="tell:8653015622" className="contact-button">
<center>CALL US NOW</center>
</a>

<p><center>Email: <a
href="mailto:sutapak2903@gmail.com">sutapak2903@gmail.com</a></center></p>
</div>

)
}
/* Contact Page Styles */
.contact-page {
display: flex;
flex-direction: column;
align-items: center;
text-align: center;
padding: 20px;
}

/* Heading Styles */
.contact-page h2 {
color: #222;
font-size: 2rem;
margin-bottom: 15px;
}

.contact-page h3 {
color: #444;
font-size: 1.5rem;
margin-top: 20px;
}

/* Map Container */
.contact-page .map-container {
position: relative;
z-index: 1;
width: 1000px;
height: 400px;
border-radius: 10px;
overflow: hidden;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.81);
}

/* Contact Button */
.contact-page .contact-button {
display: inline-block;
margin-top: 10px;
padding: 12px 20px;
font-size: 1rem;
font-weight: bold;
text-decoration: none;
color: white;
background-color: #5eff00b6;
border-radius: 5px;
transition: background 0.3s ease;
}

.contact-page .contact-button:hover {
background-color: #0056b3;
}
/* Call Button */
.contact-page a[href^="tel"] {
display: block;
margin: 10px 0;
font-size: 1.2rem;
font-weight: bold;
color: #007bff;
text-decoration: none;
}

.contact-page a[href^="mailto"]:hover {
text-decoration: underline;
}
/* Button Styles */
.contact-page .btn-outline-dark {
margin-top: 15px;
padding: 10px 20px;
font-size: 1rem;
border-radius: 5px;
transition: background 0.3s ease, color 0.3s ease;
}

.contact-page .btn-outline-dark:hover {
background-color: black;
color: white;
}

/* Responsive Design */
@media (max-width: 768px) {
.contact-page h2 {
font-size: 1.8rem;
}

.contact-page .map-container {
height: 300px;
}

.contact-page .contact-button {
font-size: 0.9rem;
padding: 10px 15px;
}
}
{
}
Dash board
DASHBOARD
import React, { useState, useEffect } from "react";
import {
FaRegUser,
FaUserAlt,
FaHandsHelping,
FaSeedling,
FaUsers,
FaHome,
} from "react-icons/fa"; // Icons
import "../css/Dashboard.css";
import axios from "axios";

const Dashboard = () => {


const [isSidebarOpen, setIsSidebarOpen] = useState(true); // Toggle sidebar visibility
const [selectedLogin, setSelectedLogin] = useState(null); // Track login selection (Admin/Donor)
const [donorName, setDonorName] = useState(""); // Donor's name
const [donorEmail, setDonorEmail] = useState(""); // Donor's email
const [donorPassword, setDonorPassword] = useState(""); // Donor's password
const [donorLoggedIn, setDonorLoggedIn] = useState(false); // Track if donor is logged in
const [donorFoodSelection, setDonorFoodSelection] = useState({
foodType: "",
quantity: 0,
}); // Donor's food selection
const [donorsList, setDonorsList] = useState([]); // List of all donors and their donations
const [adminLoggedIn, setAdminLoggedIn] = useState(false); // Track if admin is logged in
const [showDonorDetails, setShowDonorDetails] = useState(false); // Toggle donor details table
visibility

const [editingDonor, setEditingDonor] = useState(null);


const [editFoodType, setEditFoodType] = useState("");
const [editQuantity, setEditQuantity] = useState(0);
const [donorMoneyDonation, setDonorMoneyDonation] = useState(0); // Money donation amount
const [editMoneyDonation, setEditMoneyDonation] = useState(0); // For editing money donations
const [deletingDonor, setDeletingDonor] = useState(null); // Track donor being deleted

// Handle Admin Login


const handleAdminLogin = (e) => {
e.preventDefault();
setAdminLoggedIn(true); // Admin is logged in
alert("Admin logged in successfully!");
};

// Handle Donor Login


const handleDonorLogin = (e) => {
e.preventDefault();
if (donorEmail && donorPassword) {
setDonorLoggedIn(true); // Donor is logged in
console.log("donorEmail: ", donorEmail);
console.log("donorPassword: ", donorPassword);

alert("Donor logged in successfully!");


} else {
alert("Please provide email and password.");
}
};
// Handle Donor Food Selection Change
const handleFoodChange = (e) => {
const { name, value } = e.target;
setDonorFoodSelection({ ...donorFoodSelection, [name]: value });
};

const API_URL = "http://localhost:8000/api/donors";

const handleSubmitDonation = async (e) => {


e.preventDefault();

if (donorFoodSelection.quantity <= 0 && donorMoneyDonation <= 0) {


alert("Please donate either food or money.");
return;
}
const donor = {
name: donorName,
email: donorEmail,
foodType: donorFoodSelection.foodType,
// quantity: donorFoodSelection.quantity,
// moneyDonation: donorMoneyDonation,
quantity: parseInt(donorFoodSelection.quantity), // Ensure number type
moneyDonation: parseInt(donorMoneyDonation), // Ensure number type
};
console.log("Sending Data: ", donor);

try {
// Send POST request to create donor
const response = await axios.post(API_URL, donor, {
headers: { "Content-Type": "application/json" },
});
if (response.status === 201) {
alert(Thank you ${donorName} for your donation!);
setDonorFoodSelection({ foodType: "", quantity: 0 });
setDonorMoneyDonation(0);
setDonorLoggedIn(false);
setDonorName("");
setDonorEmail("");
setDonorPassword("");

fetchDonors(); // Call this at the end


}
} catch (error) {
console.error(
"Error submitting donation:",
error.response?.data || error.message
);
alert("Failed to submit donation. Please try again.");
}
};
// Function to fetch donors list
const fetchDonors = async () => {
try {
const response = await axios.get(API_URL);
if (response.status === 200) {
setDonorsList(response.data);
}
} catch (error) {
console.error("Error fetching donors:", error);
}
};

const handleEditClick = (donor) => {


setEditingDonor(donor._id);
setEditFoodType(donor.foodType);
setEditQuantity(donor.quantity);
setEditMoneyDonation(donor.moneyDonation || 0);
};

const handleSaveEdit = async (id) => {


const updatedDonor = {
foodType: editFoodType,
quantity: Number(editQuantity), // Ensure quantity is a number
moneyDonation: Number(editMoneyDonation), // Ensure moneyDonation is a number
};
console.log("Updating Donor:", updatedDonor);

try {
const response = await axios.put(${API_URL}/${id}, updatedDonor);

if (response.status === 200) {


alert("Donor details updated successfully!");

// Fetch the latest donor list to reflect changes


fetchDonors();

// Clear editing state


setEditingDonor(null);
} else {
alert("Failed to update donor details. Please try again.");
}
} catch (error) {
console.error(
"Error updating donor:",
error.response?.data || error.message
);
alert("An error occurred while updating the donor.");
}
};
const updateDonor = async (donorId, updatedData) => {
try {
const response = await axios.put(
http://localhost:8000/api/donors/${donorId},
updatedData
);
console.log("Update successful:", response.data);
} catch (error) {
console.error(
"Failed to update donation details:",
error.response?.data || error.message
);
}
};

const handleDeleteDonor = async (id) => {


if (window.confirm("Are you sure you want to delete this donor?")) {
try {
await axios.delete(http://localhost:8000/api/donors/${id});
alert("Donor deleted successfully!");

// Update donor list after deletion


setDonorsList((prevDonors) =>
prevDonors.filter((donor) => donor._id !== id)
);
} catch (error) {
console.error(
"Error deleting donor:",
error.response?.data || error.message
);
alert("Failed to delete donor. Please try again.");
}
}
};

// Call fetchDonors() when the component mounts to get the initial list
useEffect(() => {
fetchDonors();
}, [fetchDonors]);

// Render Donor Details Table (for Admin and Donor)


const renderDonorDetailsTable = () => {
if (donorsList.length === 0) {
return <p>No donations yet.</p>;
}

return (
<table
border="1"
style={{ width: "100%", padding: "10px", borderCollapse: "collapse" }}
>
<thead>
<tr>
<th>Name</th>
<th>Email</th>
<th>Food Type</th>
<th>Quantity (kg)</th>
<th>Money (₹)</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{donorsList.map((donor) => (
<tr key={donor._id}>
<td>{donor.name}</td>
<td>{donor.email}</td>
<td>
{editingDonor === donor._id ? (
<select
value={editFoodType}
onChange={(e) => setEditFoodType(e.target.value)}
>
<option value="Fruits">Fruits</option>
<option value="Vegetables">Vegetables</option>
<option value="Grains">Grains</option>
<option value="Other">Other</option>
</select>
):(
donor.foodType
)}
</td>
<td>
{editingDonor === donor._id ? (
<input
type="number"
value={editQuantity}
onChange={(e) => setEditQuantity(e.target.value)}
min="1"
/>
):(
donor.quantity
)}
</td>
<td>
{editingDonor === donor._id ? (
<input
type="number"
value={editMoneyDonation}
onChange={(e) =>
setEditMoneyDonation(Number(e.target.value))
} // Ensure it's a number
min="0"
/>
):(
donor.moneyDonation || 0
)}
</td>
<td>
{editingDonor === donor._id ? (
<>
<button onClick={() => handleSaveEdit(donor._id)}>
Save
</button>
<button onClick={() => setEditingDonor(null)}>
Cancel
</button>
</>
):(
<>
<button onClick={() => handleEditClick(donor)}>Edit</button>
<button
onClick={() => handleDeleteDonor(donor._id)}
style={{ marginLeft: "5px", color: "red" }}
>
Delete
</button>
</>
)}
</td>
</tr>
))}
</tbody>
</table>
);
};

return (
<div style={{ display: "flex" }}>
{/* Sidebar */}
<div
style={{
width: isSidebarOpen ? "250px" : "60px",
backgroundColor: "#2C3E50",
height: "100vh",
color: "#fff",
transition: "0.3s",
}}
>
<div
onClick={() => setIsSidebarOpen(!isSidebarOpen)}
style={{
padding: "10px",
textAlign: "center",
cursor: "pointer",
fontSize: "1.5rem",
}}
>
{isSidebarOpen ? "Close" : "Open"} Sidebar
</div>
<ul style={{ padding: 0, listStyleType: "none" }}>
<li
onClick={() => setSelectedLogin("admin")}
style={{
padding: "20px",
cursor: "pointer",
display: "flex",
alignItems: "center",
backgroundColor:
selectedLogin === "admin" ? "#34495E" : "transparent",
}}
>
<FaRegUser style={{ marginRight: "10px", width: "50px" }} /> Admin
Login
</li>
<li
onClick={() => setSelectedLogin("donor")}
style={{
padding: "20px",
cursor: "pointer",
display: "flex",
alignItems: "center",
backgroundColor:
selectedLogin === "donor" ? "#34495E" : "transparent",
}}
>
<FaUserAlt style={{ marginRight: "10px", width: "50px" }} /> Donor
Login
</li>

{/* Donor List Section */}


<li
style={{
padding: "20px",
cursor: "pointer",
display: "flex",
alignItems: "center",
}}
onClick={() => {
// Show donor details when clicked
setShowDonorDetails(true);
}}
>
<FaUsers style={{ marginRight: "10px" }} /> Donor List
</li>
</ul>
</div>
{/* Main Content */}
<div style={{ flex: 1, padding: "20px" }}>
<h1>NGO Waste Food Management Dashboard</h1>
{/* Render login forms based on selected login */}
{selectedLogin === "admin" && !adminLoggedIn && (
<div>
<h3>Admin Login</h3>
<form onSubmit={handleAdminLogin}>
<div style={{ marginBottom: "10px" }}>
<label>Username:</label>
<input
type="text"
placeholder="Enter admin username"
style={{ width: "50%" }}
/>
</div>
<div style={{ marginBottom: "10px" }}>
<label>Password:</label>
<input
type="password"
placeholder="Enter admin password"
style={{ width: "50%" }}
/>
</div>
<button type="submit" style={{ width: "120px" }}>
Login
</button>
</form>
</div>
)}
{selectedLogin === "donor" && !donorLoggedIn && (
<div>
<h3>Donor Login</h3>
<form onSubmit={handleDonorLogin}>
<div style={{ marginBottom: "10px" }}>
<label>Name:</label>
<input
type="text"
placeholder="Enter your name"
style={{ width: "50%" }}
value={donorName}
onChange={(e) => setDonorName(e.target.value)}
required
/>
</div>
<div style={{ marginBottom: "10px" }}>
<label>Email:</label>
<input
type="email"
placeholder="Enter donor email"
style={{ width: "50%" }}
value={donorEmail}
onChange={(e) => setDonorEmail(e.target.value)}
required
/>
</div>
<div style={{ marginBottom: "10px" }}>
<label>Password:</label>
<input
type="password"
placeholder="Enter donor password"
style={{ width: "50%" }}
value={donorPassword}
onChange={(e) => setDonorPassword(e.target.value)}
required
/>
</div>

<button type="submit" style={{ width: "120px" }}>


Login
</button>
</form>
</div>
)}

{selectedLogin === "donor" && donorLoggedIn && (


<div>
<h3>Food & Money Donation</h3>
<form onSubmit={handleSubmitDonation}>
<div style={{ marginBottom: "10px" }}>
<label>Food Type:</label>
<select
name="foodType"
value={donorFoodSelection.foodType}
onChange={handleFoodChange}
style={{ width: "50%" }}
required
>
<option value="">Select Food Type</option>
<option value="Fruits">Fruits</option>
<option value="Vegetables">Vegetables</option>
<option value="Grains">Grains</option>
<option value="Other">Other</option>
</select>
</div>
<div style={{ marginBottom: "10px" }}>
<label>Quantity (kg):</label>
<input
type="number"
name="quantity"
value={donorFoodSelection.quantity}
onChange={handleFoodChange}
min="0"
style={{ width: "50%" }}
required
/>
</div>
<div style={{ marginBottom: "10px" }}>
<label>Money Donation (₹):</label>
<input
type="number"
value={donorMoneyDonation}
onChange={(e) =>
setDonorMoneyDonation(Number(e.target.value) || 0)
}
min="0"
style={{ width: "50%" }}
/>
</div>

<button type="submit" style={{ width: "120px" }}>


Donate
</button>
</form>
</div>
)}

{/* Donor List */}


{(adminLoggedIn || showDonorDetails) && (
<div>
<h3>Donor Details</h3>
{renderDonorDetailsTable()}
</div>
)}
</div>
</div>
);
};

export default Dashboard;


Config :

1)db.js

const mongoose = require('mongoose');

const connectDB = async () => {


try {
await mongoose.connect(process.env.MONGO_URI); // Removed deprecated options
console.log('MongoDB Connected');
} catch (error) {
console.error('MongoDB Connection Error:', error);
process.exit(1);
}
};

module.exports = connectDB;
middleware :
authMiddleware.js:

const jwt = require("jsonwebtoken");

exports.verifyAdmin = (req, res, next) => {


try {
const token = req.header("Authorization")?.replace("Bearer ", ""); // Optional chaining to
avoid errors

if (!token) {
return res.status(401).json({ message: "Unauthorized: No token provided" });
}

const decoded = jwt.verify(token, process.env.JWT_SECRET);

if (!decoded.isAdmin) {
return res.status(403).json({ message: "Forbidden: Only admins can perform this action"
});
}

req.admin = { adminId: decoded.adminId }; // Ensure adminId is attached

console.log("Admin Verified:", req.admin); // Debugging line

next();
} catch (error) {
res.status(401).json({ message: "Unauthorized: Invalid token" });
}
};
server.js

const express = require("express");


const cors = require("cors");
require("dotenv").config();
const connectDB = require("./config/db");

const userRoutes = require("./routes/userRoutes.js");


const donorRoutes = require("./routes/donorRoutes.js");
const requestRoutes = require("./routes/requestRoutes.js");
const adminRoutes = require("./routes/adminRoutes.js"); // Import Admin Routes

connectDB(); // Connect to MongoDB

const app = express();


app.use(cors());
app.use(express.json());

// Routes
app.use("/api/users", userRoutes);
app.use("/api/donors", donorRoutes);
app.use("/api/requests", requestRoutes);
app.use("/api/admin", adminRoutes); // Register Admin Routes

// Port Setup
const PORT = process.env.PORT || 8000;
console.log("Checking registered routes:");
app._router.stack.forEach((middleware) => {
if (middleware.route) {
console.log(Object.keys(middleware.route.methods).join(", ").toUpperCase(),
middleware.route.path);
} else if (middleware.name === "router") {
middleware.handle.stack.forEach((handler) => {
if (handler.route) {
console.log(Object.keys(handler.route.methods).join(", ").toUpperCase(),
handler.route.path);
}
});
}
});

app.listen(PORT, () => {
console.log(Server running on port ${PORT});
});
Donor data:
models - donar.js

const mongoose = require('mongoose');

const donorSchema = new mongoose.Schema({


name: {
type: String,
required: true,
trim: true,
},
email: {
type: String,
required: true,
unique: true,
trim: true,
},
foodType: {
type: String,
trim: true, // Food type should not be required since money donations are allowed
},
quantity: {
type: Number,
default: 0, // Default to 0 if not provided
},
moneyDonation: {
type: Number,
default: 0 // Add this field to store money donations
}
}, { timestamps: true });

const Donor = mongoose.model('donorDetails', donorSchema);


module.exports = Donor;
Controller - donorController.js :

const Donor = require('../models/Donar');

// Get all donors


const getAllDonors = async (req, res) => {
try {
const donors = await Donor.find();
res.status(200).json(donors);
} catch (error) {
res.status(500).json({ message: 'Server Error', error: error.message });
}
};

// Create a new donor


const createDonor = async (req, res) => {
console.log("Create Donor API hit!")
try {
const { name, email, foodType, quantity, moneyDonation } = req.body;

if (!name || !email || (!foodType && !moneyDonation) || (foodType && quantity <= 0) ||


(moneyDonation&& moneyDonation< 0)) {
return res.status(400).json({ message: 'Invalid donation details' });
}

const newDonor = new Donor({ name, email, foodType, quantity, moneyDonation });
await newDonor.save();

res.status(201).json({ message: 'Donor added successfully', donor: newDonor });


} catch (error) {
res.status(500).json({ message: 'Server Error', error: error.message });
}
};

// Update donor details


const updateDonor = async (req, res) => {
try {
const { foodType, quantity, moneyDonation } = req.body; // Fix here

if ((foodType && quantity <= 0) || (moneyDonation && moneyDonation < 0)) {


return res.status(400).json({ message: 'Invalid update values' });
}

const donor = await Donor.findByIdAndUpdate(


req.params.id,
{ foodType, quantity, moneyDonation }, // Now it updates correctly
{ new: true, runValidators: true }
);
if (!donor) {
return res.status(404).json({ message: 'Donor not found' });
}

res.json(donor);
} catch (error) {
console.error('Error updating donor:', error);
res.status(500).json({ message: 'Failed to update donor details' });
}
};

// Delete a donor
const deleteDonor = async (req, res) => {
try {
const donor = await Donor.findByIdAndDelete(req.params.id);
if (!donor) {
return res.status(404).json({ message: 'Donor not found' });
}
res.json({ message: 'Donor deleted successfully' });
} catch (error) {
res.status(500).json({ message: 'Server Error', error: error.message });
}
};

module.exports = { getAllDonors, createDonor, updateDonor, deleteDonor };

module.exports = { getAllDonors, createDonor,updateDonor , deleteDonor};


routes
donorRoutes.js

const express = require('express');


const { getAllDonors, createDonor, updateDonor, deleteDonor } =
require('../controller/donorController'); // Import deleteDonor

const router = express.Router();

router.get('/', getAllDonors);
router.post('/', createDonor);
router.put('/:id', updateDonor);
router.delete('/:id', deleteDonor); // Add DELETE route

module.exports = router;
request data:
User data:
models - Request.js:

const mongoose = require("mongoose");

// Check if the model already exists to prevent overwrite errors


const Request = mongoose.models.Request || mongoose.model("Request", new
mongoose.Schema({
donor_id: { type: mongoose.Schema.Types.ObjectId, ref: "donorDetails" }, // Reference
to Donor
request_date: { type: Date, default: Date.now },
status: { type: String, enum: ["Pending", "Assigned", "Approved", "Completed"], default:
"Pending" },
admin_assigned: { type: mongoose.Schema.Types.ObjectId, ref: "Admin", default: null
} // Reference to Admin
}));

module.exports = Request;
requestController.js

const Request = require("../models/Requests.js");


const Admin = require("../models/Admin.js");
const mongoose = require("mongoose"); // Import mongoose

exports.assignAdminToRequest = async (req, res) => {


try {
let requestId = req.params.id.trim(); // Trim extra spaces
const adminId = req.admin.adminId;

console.log("Request ID Received:", "${requestId}"); // Debugging

if (!mongoose.Types.ObjectId.isValid(requestId)) {
return res.status(400).json({ message: "Invalid request ID format" });
}

const request = await Request.findById(requestId);


if (!request) {
return res.status(404).json({ message: "Request not found" });
}

if (request.admin_assigned) {
return res.status(400).json({ message: "Request already assigned" });
}

request.admin_assigned = adminId;
request.status = "Assigned";
await request.save();
res.json({ message: "Admin assigned successfully", request });
} catch (error) {
res.status(500).json({ message: error.message });
}
};

// Create a new food request


exports.createRequest = async (req, res) => {
try {
const request = new Request(req.body);
await request.save();
res.status(201).json(request);
} catch (error) {
res.status(500).json({ message: error.message });
}
};
// Get all requests (with donor details)
exports.getRequests = async (req, res) => {
try {
const requests = await Request.find()
.populate("donor_id") // Populate donor details
.populate("admin_assigned", "name email"); // Populate assigned admin details
res.json(requests);
} catch (error) {
res.status(500).json({ message: error.message });
}
};
// Assign an Admin to a Request
exports.assignAdminToRequest = async (req, res) => {
try {
let requestId = req.params.id.trim(); // Trim whitespace/newline
const adminId = req.admin.adminId;

if (!mongoose.Types.ObjectId.isValid(requestId)) {
return res.status(400).json({ message: "Invalid request ID format" });
}

const request = await Request.findById(requestId);


if (!request) {
return res.status(404).json({ message: "Request not found" });
}
if (request.admin_assigned) {
return res.status(400).json({ message: "Request already assigned" });
}

request.admin_assigned = adminId;
request.status = "Assigned";
await request.save();

res.json({ message: "Admin assigned successfully", request });


} catch (error) {
res.status(500).json({ message: error.message });
}
};

// Approve a request (Only assigned admin can approve)


exports.approveRequest = async (req, res) => {
try {
let requestId = req.params.id.trim(); // Trim to prevent newline issues
const adminId = req.admin.adminId; // Extract from JWT
const request = await Request.findById(requestId);
if (!request) return res.status(404).json({ message: "Request not found" });
if (!request.admin_assigned || request.admin_assigned.toString() !== adminId) {
return res.status(403).json({ message: "Forbidden: Only assigned admin can approve" });
}

if (request.status === "Approved") {


return res.status(400).json({ message: "Request is already approved" }); // Prevent
duplicate approvals
}

request.status = "Approved";
await request.save();

res.json({ message: "Request approved successfully", request });


} catch (error) {
res.status(500).json({ message: error.message });
}
};
// Get requests assigned to the logged-in admin
exports.getAssignedRequests = async (req, res) => {
try {
console.log("Inside getAssignedRequests API"); // Check if this logs
console.log("Admin ID:", req.admin.adminId);

const adminId = req.admin.adminId;

const requests = await Request.find({ admin_assigned: adminId })


.populate("donor_id");

res.json({ requests });


} catch (error) {
res.status(500).json({ message: error.message });
}
};
routes - requestRoute.js

const express = require('express');


const { createRequest, getRequests, approveRequest, assignAdminToRequest, getAssignedRequests
} = require('../controller/requestcontroller.js');
const { verifyAdmin } = require("../middleware/authMiddleware.js");

const router = express.Router();

router.post('/create', createRequest);
router.get('/', getRequests);
router.put("/assign/:id", verifyAdmin, assignAdminToRequest);
router.put("/:id/approve", verifyAdmin, approveRequest);
router.get("/assigned", verifyAdmin, getAssignedRequests);

module.exports = router;
FURTHER ENHANCEMENT

 Technology Enhancement
 Mobile App Integration: Build a cross-platform app for donors and volunteers to log food availability
and pickup requests in real time.
 AI-Powered Forecasting: Use machine learning to predict food donation trends and optimize
logistics.
 Real-Time GPS Tracking: Track vehicles collecting and distributing food to ensure timely
deliveries.
 Smart Inventory Management: Implement RFID or QR code systems for better tracking of food
stock and expiry dates.
 Donor & Receiver Dashboard: Provide analytics to donors (e.g., amount donated, CO2 saved) and
feedback to receivers.

 Process Improvement
 Standard Operating Procedures (SOPs): Develop SOPs for food collection, handling, and
distribution to maintain hygiene and efficiency.
 Quality Control Checks: Introduce food quality checks (temperature logs, packaging standards).
 Volunteer Training Modules: Provide structured training on food safety and logistics .

 Community Engagement
 Awareness Campaigns: Run social media campaigns and community workshops to encourage
donations.
 School/College Programs: Involve students through internships or credits for volunteering.
 Gamification: Reward donors or volunteers with points, badges, or recognition
 Partnerships
 Tie-ups with Restaurants & Supermarkets: Regular pickup schedules from high-waste food
sources.
 Local Government Support: Collaborate with municipal bodies for regulations and support.
 NGO Networks: Partner with other NGOs to expand reach and reduce redundancy.

 Sustainability & Impact Measurement


 Carbon Footprint Calculator: Show environmental impact saved via the app or dashboard.
 Data-Driven Reports: Generate monthly/quarterly reports for stakeholders and donors.
 Waste Segregation: Separate edible and compostable waste for further sustainability .


CONCLUSION

In conclusion, the NGO Waste Food Management System is an effective initiative aimed at minimizing food
wastage and redistributing surplus food to those in need. Through efficient collection, storage, and
distribution mechanisms, the system ensures that edible food is saved from being wasted and reaches
underprivileged communities.

This project highlights the importance of collaboration between restaurants, grocery stores, households,
and volunteers in creating a sustainable food supply chain. By leveraging technology, awareness
campaigns, and strong partnerships, the NGO can maximize its impact, reducing both food insecurity and
environmental waste.
Future scope

The future scope of our NGO and Waste Food Management System focuses on continuous improvements,
technological advancements, and expanded reach to make food donation more efficient and impactful.
We plan to integrate AI-powered analytics to predict food demand in different locations, ensuring
optimized food distribution and minimizing waste. Machine learning algorithms will enhance donor
engagement by providing personalized donation suggestions based on past contributions. Additionally, we
aim to collaborate with more NGOs, corporate partners, and government initiatives to expand the reach
and accessibility of the platform.
User experience enhancements will include real-time donation tracking, automated notifications, and a
detailed donor history section for better transparency. We also plan to introduce seamless payment
integration for monetary donations using UPI, digital wallets, and even cryptocurrency, ensuring secure
and diverse payment options.
Moreover, mobile app development will be a key enhancement, allowing users to donate food, track
contributions, and receive instant updates from anywhere. Future iterations will also focus on
sustainability and minimizing carbon footprints by optimizing food delivery logistics.
Our commitment to innovation ensures that this system will continue to evolve, making food donation
more accessible, transparent, and impactful for society.
BIBLIOGRAPHY

1)www.w3schools.com
2)www.youtube.com
3)www.pexels.com
4)www.codepen.io
5)www.google.com
6)www.googlefont.com
7)www.react.our
8)www.codingworld.com

You might also like