Airline Reservation System
Airline Reservation System
OBJECT ORIENTED
SOFTWARE ENGINEERING
1
2
TABLE OF CONTENTS
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
3
Ex.no:1
Date: IDENTIFY SOFTWARE THAT NEEDS DEVELOPMENT
AIM:
To write a study about the software that needs development.
PROBLEM STATEMENT:
BACKGROUND:
The airline industry is experiencing rapid growth, with an increasing number of
travelers requiring efficient and reliable means of booking flights. To meet this demand, an
Airline Reservation System (ARS) needs to be developed. This system will enable customers
to search for flights, make reservations, manage bookings, and perform other related tasks
seamlessly.
OBJECTIVE:
The objective of this project is to design and develop a user-friendly Airline
Reservation System that streamlines the booking process for both customers and airline staff.
The system should be robust, scalable, and capable of handling a large volume of transactions
while ensuring data security and integrity.
FEATURES:
1. Flight Search: Customers should be able to search for flights based on various
criteria such as origin, destination, date, and preferred airline.
2. Booking Management: Customers should be able to view available flights, select
seats, and make reservations. They should also have the option to modify or cancel
bookings.
3. User Authentication: The system should support user authentication to ensure that
only authorized users can access and manage their bookings.
4. Payment Gateway Integration: Customers should be able to make secure online
payments for their reservations using various payment methods.
5. Flight Status Updates: The system should provide real-time updates on flight
schedules, delays, cancellations, and other relevant information.
6. Admin Panel: An admin panel should be available for airline staff to manage flights,
update schedules, view bookings, generate reports, and perform other administrative
tasks.
7. Notification System: The system should have a notification feature to alert customers
about booking confirmations, changes in flight status, and other important updates via
email or SMS.
4
CONSTRAINTS:
1. The system should be developed using object-oriented principles and design patterns
to ensure modularity and maintainability.
2. The user interface should be intuitive and responsive, catering to both desktop and
mobile users.
3. Data security measures should be implemented to protect sensitive customer
information and payment transactions.
4. The system should be capable of handling concurrent user requests without
compromising performance.
NEED FOR DEVELOPMENT:
1. Enhanced User Experience: The existing system fails to provide a seamless booking
experience for users, leading to frustration and abandonment of the reservation
process. Developing a new system with intuitive interfaces, streamlined workflows,
and personalized recommendations will improve user satisfaction and increase
conversion rates.
2. Improved Efficiency and Accuracy: Manual processes and outdated technologies
contribute to errors, delays, and inconsistencies in reservation management and
ticketing. By automating routine tasks, integrating real-time data updates, and
implementing robust validation mechanisms, the new system will enhance operational
efficiency and ensure data accuracy.
3. Scalability and Performance: As air travel demand continues to grow, the current
system struggles to handle increasing transaction volumes and concurrent user
interactions. Developing a scalable architecture with cloud-based infrastructure,
distributed computing, and load balancing mechanisms will enable the system to
handle peak loads effectively and accommodate future growth.
4. Integration and Interoperability: The siloed nature of the current system hampers
integration with third-party services, such as payment gateways, travel agencies, and
loyalty programs. Developing an open architecture with standardized APIs and
support for industry standards will facilitate seamless integration with external
systems and enhance the ecosystem's interoperability.
5. Data Analytics and Insights: Limited data analytics capabilities restrict airlines'
ability to gain actionable insights into customer behavior, market trends, and
operational performance. Developing advanced analytics features, such as predictive
modelling, customer segmentation, and revenue optimization, will enable airlines to
make data-driven decisions and improve business outcomes.
5
IMPROVEMENT STRATEGIES:
1. User-Centric Design: Conduct user research, usability testing, and feedback analysis
to understand user needs and preferences better. Incorporate design thinking
principles to create an intuitive and engaging user interface that prioritizes simplicity,
clarity, and accessibility.
2. Agile Development Methodology: Adopt an agile development approach to
iteratively build and release features, gather feedback, and respond to changing
requirements quickly. Embrace cross-functional collaboration, continuous integration,
and iterative testing to deliver high-quality software increments regularly.
3. Modern Technology Stack: Evaluate and select modern technologies, frameworks,
and platforms that offer scalability, performance, and flexibility. Embrace cloud-
native architectures, micro services, and containerization to build a resilient and
adaptable system infrastructure.
4. Continuous Improvement: Establish processes for monitoring system performance,
collecting user feedback, and tracking key performance indicators (KPIs). Implement
a culture of continuous improvement, where teams regularly reflect on their practices,
identify areas for enhancement, and implement iterative changes to drive innovation
and excellence.
5. Comprehensive Training and Support: Provide comprehensive training and
support resources for users, administrators, and support staff to ensure smooth
adoption and operation of the new system. Offer documentation, tutorials, and online
forums to facilitate self-service assistance and foster a community of learning and
collaboration.
RESULT:
Thus a study on software that needs development was written.
6
Ex.no:2
Date: SOFTWARE REQUIREMENT SYSTEM
AIM:
To write a Software requirement system for Airline Reservation system
PURPOSE:
The purpose of this document is to provide a detailed description of the requirements
for the development of the Airline Reservation System. This document serves as a guide for
the development team and stakeholders, outlining the system's functionality, constraints, and
performance requirements.
SCOPE:
The Airline Reservation System is intended to streamline the flight booking process
for both customers and airline staff. It will enable users to search for flights, make
reservations, manage bookings, and receive real-time updates on flight statuses. The system
will also include an admin panel for airline staff to manage flights, view bookings, and
perform administrative tasks.
OVERALL DESCRIPTION:
The Airline Reservation System will be a standalone application, interacting with
users through a web interface. It will integrate with external payment gateways for online
transactions and may interface with external systems for flight schedules and availability.
Product Features:
● Flight Search
● Booking
● User Authentication
● Payment Gateway Integration
● Flight Status Updates
User Classes and Characteristics: The system will cater to two main user classes:
customers and airline staff. Customers will include individuals looking to book flights for
personal or business travel, while airline staff will include administrators responsible for
managing flights and bookings.
7
EXTERNAL INTERFACE REQUIREMENTS
User Interfaces: The user interface will be web-based, accessible through standard
web browsers. It will be responsive and intuitive, catering to both desktop and
mobile users.
Hardware Interfaces: The system will run on standard web servers and client
devices, requiring internet connectivity for accessing the application.
Software Interfaces: The system will integrate with external payment gateways for
processing online transactions. It may also interface with external systems for
retrieving flight schedules and availability.
FUNCTIONAL REQUIREMENTS
1. Flight Search
● The system shall allow users to search for flights based on criteria such as
origin, destination, date, and preferred airline.
● Users shall be able to view available flights matching their search criteria.
2. Booking Management
● Users shall be able to select flights and make reservations.
● Users shall have the option to view, modify, or cancel their bookings.
3. User Authentication
● The system shall support user registration and login functionality.
● Users shall be required to log in to make reservations or manage bookings.
4. Payment Gateway Integration
● The system shall integrate with external payment gateways to facilitate secure
online transactions.
● Users shall be able to make payments for their reservations using various
payment methods.
5. Flight Status Updates
● The system shall provide real-time updates on flight schedules, delays,
cancellations, and other relevant information.
● Users shall receive notifications about changes in flight status for their booked
flights.
6. Admin Panel
● The system shall include an admin panel accessible to authorized airline staff.
8
● Admins shall be able to manage flights, update schedules, view bookings, and
generate reports.
7. Notification System
● The system shall have a notification feature to alert users about booking
confirmations, changes in flight status, and other important updates.
● Notifications shall be sent via email or SMS.
TECHNOLOGY STACK:
● Front-end:
● HTML, CSS for markup and styling
● Bootstrap for responsive design and UI components
● Back-end:
● Python with Flask framework for server-side logic and routing
● MySQL database for storing user information, flight data, and booking details
● Front-end Back-end Connection:
● Flask will handle the server-side logic and communicate with the MySQL
database to retrieve and manipulate data based on user requests.
● HTML forms will be used to capture user input for flight searches, booking
details, and authentication.
● CSS and Bootstrap will be used to style and structure the front-end interface,
ensuring a user-friendly experience.
NON-FUNCTIONAL REQUIREMENTS
Performance Requirements:
● The system should be capable of handling concurrent user requests without
degradation in performance.
● Response times for search queries and booking transactions should be minimal.
● The system should be scalable to accommodate future growth in user traffic.
Security Requirements:
● User authentication and authorization mechanisms should be implemented to protect
sensitive data and ensure secure access to the system.
● Payment transactions should be encrypted to prevent unauthorized access to payment
information.
● The system should comply with industry standards and regulations for data security
and privacy.
9
Reliability Requirements:
● The system should be highly available, with minimal downtime for maintenance and
upgrades.
● Data backups and disaster recovery mechanisms should be in place to prevent data
loss in the event of system failures.
RESULTS:
Thus Software Requirement System for Airline Reservation System was written.
10
Ex.no:3
Date: USE CASE DIAGRAM
AIM:
To write about the use case diagram and draw the use case diagram for Airline
Reservation System.
USE CAS DIAGRAM FOR AIRLINE RESERVATION SYSTEM:
Book a Flight:Allows users to search for available flights based on criteria, select a
flight, provide passenger details, and confirm booking.
Modify/Cancel Booking:Enables users to modify or cancel existing flight bookings,
including changing details or canceling the entire booking.
Flight Checking:Provides users with real-time information on flight schedules, delays,
gate changes, and cancellations.
Additional Requirements:Covers additional services or requirements beyond booking a
standard flight ticket, such as special meals, wheelchair assistance, or seat upgrades.
Payment:Facilitates the secure processing of payment transactions for booked flights
using various payment methods.
Refund:Involves users receiving refunds for cancelled bookings or other eligible
scenarios, including initiating the refund process and processing the refund amount.
11
USE CASE DIAGRAM:
Result:
Thus the use case diagram description and use case diagram for Airline Reservation
System was written, drawn.
12
Ex.no:4
Date: CONCEPTUAL CLASSES, DOMAIN MODEL AND CLASS
DIAGRAM
AIM:
To write about the conceptual classes, domain model and draw class diagram for
airline reservation system.
CONCEPTUAL CLASSES:
Passenger: Represents individuals who book flights. They provide personal information
such as name, contact details, and frequent flyer information.
Flight: Represents scheduled flights operated by airlines. It includes attributes such as
flight number, departure and arrival airports, departure and arrival times, and available
seats.
Booking: Represents the act of reserving seats on a flight for one or more passengers. It
includes details such as booking ID, passenger information, flight details, and payment
status.
Ticket: Represents a booked seat on a specific flight for a passenger. It is associated with
a booking and includes information such as seat number, ticket number, and fare details.
Payment: Represents the payment made by passengers to confirm their bookings. It
includes information about the payment method, transaction details, and payment status.
Passenger-Flight Association: Passengers are associated with flights through bookings.
A passenger can be associated with multiple flights through different bookings,
representing the flights they have booked.
Passenger-Booking Aggregation: Passengers are aggregated with bookings. Each
passenger may have multiple bookings, representing the flights they have reserved.
Ticket-Booking Composition: Tickets are composed within bookings. Each booking
can have multiple tickets corresponding to the seats reserved for different passengers on
a particular flight.
Payment-Booking Composition: Payments are composed within bookings. Each
booking is associated with a payment representing the transaction made by the passenger
to confirm the booking.
13
CLASS DIAGRAM:
Result:
Thus the conceptual classes, domain model and class diagram for airline reservation
system was written, drawn.
14
Ex.no:5
Date: SEQUENCE AND COLLABORATION DIAGRAM
AIM:
To write about sequence and collaboration diagram and draw them for Airline
Reservation System.
SEQUENCE DIAGRAM FOR AIRLINE RESERVATION SYSTEM:
Fill Passenger Info: The "Passenger" actor fills in their information, such as name,
contact details, and any special requirements.
Book Flight: The information provided by the passenger is used to initiate the booking
process. The "Book Flight" component searches for available flights based on the
passenger's preferences. Once a suitable flight is found, the booking is made, and a
reservation is created.
Proceed to Payment: After the flight booking is confirmed, the passenger proceeds to
make the payment. The "Payment" component handles the payment process securely,
using the payment method provided by the passenger.
Payment Confirmation: Upon successful payment, the "Payment" component confirms
the transaction. This confirmation is sent back to the "Book Flight" component,
indicating that the payment was successful.
Reserve Seat: The "Book Flight" component finalizes the booking by reserving a seat on
the chosen flight for the passenger. This involves updating the flight database with the
passenger's details and seat assignment.
Seat Reservation Confirmation: The "Flight" component confirms the seat reservation,
indicating that the booking process is complete.
Request Refund: If the passenger requests a refund for any reason, the "Refund"
component handles the refund process. The request is processed based on the refund
policy and conditions.
Refund Confirmation: Upon successful processing of the refund request, the "Refund"
component confirms the refund transaction. This confirmation is sent back to the "Book
Flight" component, indicating that the refund was successfully processed.
15
SEQUENCE DIAGRAM:
16
Ticket Issue: The "Ticket Issue" object is responsible for generating and issuing tickets
to passengers upon successful completion of the booking and payment process, providing
essential travel information like flight details, seat assignments, and passenger names.
Refund: The "Refund" object handles refund requests for canceled bookings or other
eligible scenarios, calculating refund amounts based on policies and initiating refund
transactions to ensure passengers receive appropriate refunds when applicable.
COLLABORATION DIAGRAM:
RESULT:
Thus the collaboration and sequence diagram for airline reservation system was
drawn.
17
Ex.no:6
Date: ACTIVITY AND STATE DIAGRAM
AIM:
To draw activity and state diagram for airline reservation system.
ACTIVITY DIAGRAM FOR AIRLINE RESERVATION SYSTEM:
Availability Check: The availability check activity involves checking the availability of
flights based on the passenger's preferences, such as departure/arrival locations, dates,
and times. It determines whether there are suitable flights matching the specified criteria
in the system's database. If flights are available, the process proceeds to the next activity;
otherwise, it may prompt the passenger to adjust their preferences or display alternative
options.
Book Flight: The book flight activity is responsible for initiating the flight booking
process once the availability check is successful. It involves selecting a specific flight
from the available options and providing passenger details such as names and contact
information. Once the booking details are confirmed, the process moves to the next
activity to confirm the booking.
Confirm Booking: The confirm booking activity confirms the flight booking, ensuring
that the selected flight and passenger details are correct. It may involve displaying a
summary of the booking details for the passenger to review and confirm. Upon
confirmation, the process proceeds to the payment activity to complete the booking
process.
Payment: The payment activity handles the payment process for the confirmed flight
booking. It involves processing the payment transaction securely using various payment
methods such as credit/debit cards, electronic funds transfer, or other accepted methods.
Once the payment is successfully processed, the booking process is complete, and the
passenger receives a booking confirmation.
Refund: The refund activity manages the refund process for canceled bookings or other
eligible scenarios. It involves processing refund requests from passengers, calculating the
refund amount based on applicable policies, and initiating the refund transaction. The
refund activity ensures that passengers receive appropriate refunds for canceled bookings
in a timely manner.
18
ACTIVITY DIAGRAM:
19
payment methods such as credit/debit cards, electronic funds transfer, or other accepted
methods. Upon successful payment, the system transitions to the Issue Ticket state.
Issue Ticket State: In the Issue Ticket state, the system generates and issues tickets to
the user upon completion of the booking and payment process. It provides the user with
essential travel information such as flight details, seat assignments, and passenger names.
Once the tickets are issued, the booking process is complete, and the system transitions
back to the initial state (Check Flight) or awaits further user interaction depending on the
system's design.
STATE DIAGRAM:
Result:
Thus the collaboration and state diagram for airline reservation system was drawn.
20
Ex.no:7
Date:01/01/24 IMPLEMENTATION OF THE SYSTEM
Aim:
To implement the system as per the detailed design.
CODING:
Book.html:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Ahar Airways</title>
<!-- Bootstrap CSS -->
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css"
rel="stylesheet">
<link rel="stylesheet" href="style.css">
</head>
<body>
<header>
<img class="above-navbar" src="\static\back.png" alt="Image Above Navbar"
style="width: 100vw;height: 150px;">
<nav class="navbar navbar-expand-lg navbar-light bg-warning" style="padding-top:
2px;">
<a class="navbar-brand" href="#">Navbar</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-
target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-
expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNavAltMarkup">
21
<div class="navbar-nav">
<a class="nav-item nav-link active" href="#book">Book a Flight<span class="sr-
only">(current)</span></a>
<a class="nav-item nav-link" href="#aboutus">About Us</a>
<a class="nav-item nav-link" href="#fleet">Fleet Details</a>
<a class="nav-item nav-link" href="#safety-connectivity">Connectivity</a>
</div>
</div>
</nav>
</header>
<section id="book" class="cont" >
<div class="container">
<form method="post" action="/" onsubmit="return validateForm()" class="form" >
<header><b>BOOK A FLIGHT</b></header>
<div class="form-group" style="align-items: center;justify-content: center;text-
align: center;">
<input type="radio" value="trip" id="trip" name="trips"
onclick="toggleInput('trip')">
<label for="trip">One-Way</label>
<input type="radio" value="trips" name="trips" id="trips"
onclick="toggleInput('trips')">
<label for="trips">Two-Way</label>
<input type="radio" name="tripss" id="multistop" value="multistop"
onclick="toggleTripOption('multistop')">
<label for="multistop">Multistop</label>
<input type="radio" name="tripss" id="nonstop" value="nonstop"
onclick="toggleTripOption('nonstop')">
<label for="nonstop">Nonstop</label>
</div>
<div class="row">
<div class="col-md-6">
22
<div class="form-group">
<label for="Dep">Departure City:</label>
<input type="text" class="form-control" name="Dep" id="Dep">
</div>
<div class="form-group">
<label for="stops">Stops:</label>
<button type="button" class="btn btn-primary" id="stops"
onclick="addStop()">Add Stop</button>
<div id="stops-container"></div>
</div>
<div class="form-group">
<label for="Arr">Arrival City:</label>
<input type="text" class="form-control" name="Arr" id="Arr">
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="Depdate">Departure Date:</label>
<input type="date" class="form-control" id="Depdate">
</div>
<div class="form-group">
<label for="Arrdat">Return Date:</label>
<input type="date" class="form-control" id="Arrdat">
</div>
<div class="form-group">
<label for="Passe">Passengers:</label>
<input type="number" name="Passe" class="form-control" id="Passe">
</div>
23
<div class="form-group">
<label for="class">Choose your Class:</label>
<select name="Class" class="form-control" id="class">
<option name="Economy" value="Economy">Economy Class</option>
<option name="Business" value="Business">Business Class</option>
<option name="First" value="First">First Class</option>
</select>
</div>
</div>
</div>
<div class="form-group text-center">
<button type="submit" class="btn btn-primary">Search Flight</button>
<button type="reset" class="btn btn-secondary">Clear</button>
</div><center>
<p style="color: red;">{{failmsg|safe}}</p>
</center>
<!-- Error message display -->
<div id="error-message" style="display: none; color: red; text-align:
center;"></div>
</form>
<form action="\Modif" class="form">
<button class="btn btn-primary" type="submit">Modify</button>
</form>
</div>
</section>
24
<script
src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
<script>
function toggleInput(option){
var Arr = document.getElementById("Arrdat");
if(option == 'trip'){
Arr.disabled = true;
}
if(option == 'trips'){
Arr.disabled = false;
}
}
function toggleTripOption(option) {
var Arr = document.getElementById("stops");
if (option == 'nonstop') {
Arr.disabled = true; // Disable Arrival Date input for one-way trips
}
if(option == 'multistop') {
Arr.disabled = false; // Enable Arrival Date input for two-way and multistop trips
}
}
let stopCounter = 0; // Counter to track added boxes
function addStop() {
if (stopCounter >= 2) {
alert("You can only add up to two stops.");
return; // Stop adding more boxes
}
var stopsContainer = document.getElementById("stops-container");
var stopInput = document.createElement("input");
25
stopInput.type = "text";
stopInput.name = "stop";
stopInput.placeholder = "Stop";
stopsContainer.appendChild(stopInput);
stopCounter++; // Increment the counter after adding a box
}
function validateForm() {
var passs = document.getElementById("Passe").value;
var depd = document.getElementById("Depdate").value;
var arrd = document.getElementById("Arrdat").value;
var tripType = document.querySelector('input[name="trips"]:checked');
var currentDate = new Date().toISOString().split('T')[0];
if (passs === "" || depd === "" || !tripType) {
document.getElementById("error-message").innerText = "Please fill all necessary fields
and select trip type";
document.getElementById("error-message").style.display = "block";
return false; // Prevent form submission
} else if (tripType.value === "trips" && arrd === "") {
document.getElementById("error-message").innerText = "Please fill return date";
document.getElementById("error-message").style.display = "block";
return false; // Prevent form submission
} else if (tripType.value === "trips" && arrd <= depd) {
document.getElementById("error-message").innerText = "Return date must be later than
departure date";
document.getElementById("error-message").style.display = "block";
return false; // Prevent form submission
} else if (depd < currentDate || (tripType.value === "trips" && arrd < currentDate)) {
document.getElementById("error-message").innerText = "Please select a future date";
document.getElementById("error-message").style.display = "block";
return false; // Prevent form submission
26
} else {
document.getElementById("error-message").style.display = "none";
// If all fields are filled and return date is later than departure date, return true to allow
form submission
return true;
}
}
function reloadpage(){
location.reload();
}
window.addEventListener('pageshow',function(event){
if(event.persisted){
reloadpage();
}
});
</script>
</body>
</html>
Detail.html:
<h1 class="card-title">Flight Details</h1>
</div>
<p><strong>
<input type="hidden" name="hid" value="{{s|safe}}">
{{s}}
</strong></p>
<div class="card-body">{% for values in processed_rows%}
<p><strong>Flight Number:</strong>{{values[3]|safe}} </p>
<p><strong>Origin:</strong>{{values[0]|safe}}</p>
27
<p><strong>Destination:</strong>{{values[1]|safe}} </p>
<p><strong>Number of Passengers:</strong>{{values[7]|safe}} </p>
<p><strong>Price:</strong>{{values[2]|safe}} </p>
<form action="/Billbef" method="post">
<button type="submit">Book</button>
</form>
{% endfor %}
Fill.html:
<div class="container payment-container">
<h2 class="text-center mb-4">Payment Details</h2>
<form class="payment-form" action="\download1" method="POST" onsubmit="return
validatePaymentForm()">
<input type="text" name="Nam" id="Name" value="{{Nam|safe}}" hidden>
<input type="text" name="Dep" id="Depc" value="{{Dep|safe}}" hidden>
<input type="text" name="Arr" id="Arrc" value="{{Arr|safe}}" hidden>
<input type="text" name="Fli" id="Flid" value="{{I|safe}}" hidden>
<input type="text" name="pric" id="pric" value="{{pric|safe}}" hidden>
<div class="form-group">
<label for="card_number">Card Number</label>
<input type="text" class="form-control" name="Carno" id="card_number"
placeholder="Enter Card Number">
</div>
<div class="form-group">
<label for="expiry_date">Expiry Date</label>
<input type="text" class="form-control" name="Exp" id="expiry_date"
placeholder="MM/YY">
</div>
<div class="form-group">
<label for="cvv">CVV</label>
28
<input type="number" class="form-control" id="cvv" name="Cvv" placeholder="Enter
CVV">
</div>
<div class="form-group">
<label for="name">Cardholder's Name</label>
<input type="text" class="form-control" name="name" id="name" placeholder="Enter
Name">
</div>
<div class="form-group">
<label for="amount">Amount</label>
<input type="number" class="form-control" name="Amount" id="amount"
placeholder="Enter Amount">
</div>
<div class="form-group">
<label for="currency">Currency</label>
<select class="form-control" id="currency">
<option value="USD">USD</option>
<option value="EUR">EUR</option>
<option value="GBP">GBP</option>
<!-- Add more options as needed -->
</select>
</div>
<error id="error-msg" style="color: red;"></error>
<button type="submit" class="btn btn-primary">Pay Now</button>
</form>
Ticket.html:
<form action="/Pay">
<div class="ticket-container">
<div class="ticket-details">
29
<h1 class="text-center mb-4">Ahar Air Flight Ticket</h1>
<!-- Ticket details -->
<div class="row">
<div class="col-md-6">
<input type="text" name="Name" id="Name" value="{{Name|safe}}" readonly
hidden>
<input type="text" name="Depc" id="Depc" value="{{Depc|safe}}" readonly hidden>
<input type="text" name="Arrc" id="Arrc" value="{{Arrc|safe}}" readonly hidden>
<input type="text" name="Flid" id="Flid" value="{{ID|safe}}" readonly hidden>
{%for i in processed_row%}
<p><strong>Name:</strong>{{i[0]|safe}}</p>
<p><strong>Date of Birth:</strong>{{i[3]|safe}} </p>
<p><strong>Mobile Number:</strong>{{i[2]|safe}} </p>
<p><strong>EmailID:</strong>{{i[1]|safe}} </p>
<p><strong>Departure City::</strong>{{i[9]|safe}} </p>
<p><strong>Arrival City::</strong>{{i[10]|safe}} </p>
<!-- <p><strong>Departure Date:</strong>{{i[8]|safe}} </p> -->
<p><strong>Flight ID:</strong>{{i[11]|safe}} </p>
</div>
</div>
<div class="row mt-4">
<div class="col-md-6">
<p><strong>Class:</strong>{{i[12]|safe}}</p>
</div>
<div class="col-md-6">
<p><strong>Ticket Price:</strong>{{price|safe}}</p>
</div>
</div>
</div>
30
{%endfor%}
</form>
BACKEND CONNECTION:
Validate.py:
from flask import Flask,render_template,request,redirect,url_for
import mysql.connector
a=[]
s=0
a=[0]*1
print(a)
mydb=mysql.connector.connect(host='localhost',database='Route1',user='Ahamed',password
='Ahamed@2003',auth_plugin='caching_sha2_password')
cu=mydb.cursor()
def fetch(deptci,arrci,sclass):
try:
if mydb.is_connected():
print("Connected")
except mysql.connector.Error as r:
print(f'Error:{r}')
deptci=str(request.form.get('Dep'))
arrci=str(request.form.get('Arr'))
sclass=sclass
query="select * from route where Deptcity=(%s) and Arrcity=(%s)and class=(%s)"
cu.execute(query,(deptci,arrci,sclass))
ff=cu.fetchall()
return ff
app=Flask(__name__,template_folder="templates")
@app.route('/',methods=['GET'])
31
def index():
return render_template("Untitled.html")
@app.route('/',methods=["POST"])
def enabbook():
passcount=request.form.get('Passe')
s=passcount
deptci=str(request.form.get('Dep'))
arrci=str(request.form.get('Arr'))
passc=(request.form.get('Passe'))
print(passc)
Class=request.form.get(('Class'))
failmsg=""
print((deptci),(arrci))
if len(deptci)==0:
failmsg="Please fill the necessary fields"
return render_template("Untitled.html", failmsg=failmsg)
if len(arrci)==0:
failmsg="Please fill the necessary fields"
return render_template("Untitled.html", failmsg=failmsg)
if deptci==arrci:
return render_template("Untitled.html", failmsg="Please choose a different arrival and
departure city")
else:
rows=fetch((deptci),(arrci),(Class))
p=[]
v1=""
for i in rows:
v1=i[1] #departure city
v2=i[2] #Arrival city
32
v3=i[3] #stops
v4=i[4] #Date
v5=int(i[5])*int(passc) #price
v6=i[6] #Flightid
v7=i[7]
print(type(v5))
p.append((v1,v2,int(v5),v6,v3,v4,v7,passcount))
a.pop(0)
for i in range(len(p)):
a.append(p[i])
if deptci!=v1:
return render_template("Info.html",failmsg="Sorry Flight not available")
else:
return render_template('Info.html',processed_rows=p)
@app.route('/Billbef', methods=['POST'])
def load_bill():
# Redirect to Billbef.html after form submission
print(len(a))
print(a)
return redirect(url_for('billbef'))
# Route to render Billbef.html
@app.route('/billbef')
def billbef():
return render_template("Billbef.html",a=a)
@app.route('/Modif',methods=['GET'])
def mod():
return render_template('Modif.html')
def fetcsh():
33
try:
if mydb.is_connected():
print("Connected")
except mysql.connector.Error as r:
print(f'Error:{r}')
a=str(request.form.get('name'))
b=request.form.get('email')
c=request.form.get('mobile')
d=request.form.get('dob')
e=request.form.get('price')
f=request.form.get('price1')
g=request.form.get('price2')
dat=request.form.get('dob') #Change this
classs=request.form.get('class')
depcit=request.form.get('depc')
arrcit=request.form.get('arc')
id=request.form.get('id')
s=[a,b,c,d,e,f,g,d,c,depcit,arrcit,id]
query="insert into
passenger(name,email,Mobileno,dob,Origprice,Totprice,Finalpri,Depdate,Depcity,Arrcity,Fli
ghtid,class) values(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)"
cu.execute(query,(a,b,c,d,e,f,g,dat,depcit,arrcit,id,classs))
mydb.commit()
@app.route('/download',methods=['POST'])
def down():
fetcsh()
query="Select * from passenger where Name=(%s) and Depdate=(%s) and Depcity=(%s)
and Arrcity=(%s) and Flightid=(%s)"
cu.execute(query,((str(request.form.get('name'))),request.form.get('dob'),request.form.get('dep
c'),request.form.get('arc'),request.form.get('id')))
ff=cu.fetchone()
34
print(ff)
a=[]
for i in range(0,1):
a.append(ff)
return render_template('download.html',processed_row=a)
@app.route('/Pay',methods=['GET'])
def doswn():
return render_template('Pay.html')
def fetchh():
query="Select * from passenger"
cu.execute(query)
ff=cu.fetchone()
return ff
@app.route('/download1',methods=['POST'])
def downd():
ff=fetchh()
print(ff)
a=[]
for i in range(1):
a.append(ff)
print(a)
return render_template('download1.html',processed_row=a)
if __name__== "__main__":
app.run(debug=True,port=8000)
35
FORM DESIGNS:
36
37
RESULT:
38
Ex.no:8
Date: PROJECT TESTING
AIM:
TESTING:
39
Case 2:When flight not available
40
TEST 3: Fill other details for ticket
41
TEST 4: Payment
42
RESULT:
Thus for various use case scenario were tested for the system
43
Ex.no:9
Date:01/01/24 IMPROVING REUSABILITY AND MAINTAINABILITY
AIM:
To improve the re-usability and maintainability of the system.
IMPROVEMENT:
The system that was designed currently allows users to book flights and manage their
travel itineraries. However, until now, there hasn't been a dedicated page for users to view
comprehensive details about their travel plans.
Need for Enhancement: The decision to add a travel details viewing feature stemmed
from feedback received from users who expressed the desire for more transparency and
accessibility regarding their travel arrangements.
Feature Description: The new travel details viewing page provides users with a
comprehensive overview of their travel itinerary. Users can access this page from their
dashboard or booking confirmation page. Once on the page, users can view detailed
information about their flights, including departure/arrival times, flight numbers, seat
assignments, and booking status.
Implementation Details: We implemented the travel details viewing feature using
HTML, CSS, and JavaScript for the front-end interface. The back-end functionality was
developed using Python and Django, allowing us to retrieve and display relevant travel
information from our database. We integrated the new page seamlessly into the existing
software interface, ensuring a consistent user experience across the application.
Benefits and Impact: The addition of the travel details viewing feature enhances the
user experience by providing users with easy access to essential travel information. Users
can now review their travel plans more conveniently, helping to reduce confusion and
improve satisfaction with the software.
CODING:
Book.html:
<body>
<header>
<img class="above-navbar" src="\static\back.png" alt="Image Above Navbar"
style="width: 100vw;height: 150px;">
<nav class="navbar navbar-expand-lg navbar-light bg-warning" style="padding-top:
2px;">
<a class="navbar-brand" href="#">Navbar</a>
44
<button class="navbar-toggler" type="button" data-toggle="collapse" data-
target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-
expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNavAltMarkup">
<div class="navbar-nav">
<a class="nav-item nav-link active" href="#book">Book a Flight<span class="sr-
only">(current)</span></a>
<a class="nav-item nav-link" href="#aboutus">About Us</a>
<a class="nav-item nav-link" href="#fleet">Fleet Details</a>
<a class="nav-item nav-link" href="#safety-connectivity">Connectivity</a>
</div>
</div>
</nav>
</header>
<section id="book" class="cont" style="background-image:
url(https://wallpapers.com/images/featured/plane-background-etxz0fp95slobqec.webp);
background-repeat: no-repeat; background-size: cover; background-position: center;padding:
50px;">
<div class="container">
<form method="post" action="/" onsubmit="return validateForm()" class="form"
style="padding: 20px;border-radius: 50px; border: 2px solid rgba(255, 255, 255, 0.5);
transition: background-color 0.3s;">
<header style="text-align: center; font-size: larger; border-bottom: 2px solid white;
background-image: linear-gradient(to left, white, blue); margin-bottom: 20px;"><b>BOOK
A FLIGHT</b></header>
<div class="form-group" style="align-items: center;justify-content: center;text-
align: center;">
<input type="radio" value="trip" id="trip" name="trips"
onclick="toggleInput('trip')">
<label for="trip">One-Way</label>
<input type="radio" value="trips" name="trips" id="trips"
onclick="toggleInput('trips')">
<label for="trips">Two-Way</label>
45
<input type="radio" name="tripss" id="multistop" value="multistop"
onclick="toggleTripOption('multistop')">
<label for="multistop">Multistop</label>
<input type="radio" name="tripss" id="nonstop" value="nonstop"
onclick="toggleTripOption('nonstop')">
<label for="nonstop">Nonstop</label>
</div>
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label for="Dep">Departure City:</label>
<input type="text" class="form-control" name="Dep" id="Dep">
</div>
<div class="form-group">
<label for="stops">Stops:</label>
<button type="button" class="btn btn-primary" id="stops"
onclick="addStop()">Add Stop</button>
<div id="stops-container"></div>
</div>
<div class="form-group">
<label for="Arr">Arrival City:</label>
<input type="text" class="form-control" name="Arr" id="Arr">
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="Depdate">Departure Date:</label>
<input type="date" class="form-control" name="Dat" id="Depdate">
</div>
<div class="form-group">
<label for="Arrdat">Return Date:</label>
46
<input type="date" class="form-control" id="Arrdat">
</div>
<div class="form-group">
<label for="Passe">Passengers:</label>
<input type="number" name="Passe" class="form-control" id="Passe">
</div>
<div class="form-group">
<label for="class">Choose your Class:</label>
<select name="Class" class="form-control" id="class">
<option name="Economy" value="Economy">Economy Class</option>
<option name="Business" value="Business">Business Class</option>
<option name="First" value="First">First Class</option>
</select>
</div>
</div>
</div>
<div class="form-group text-center">
<button type="submit" class="btn btn-primary">Search Flight</button>
<button type="reset" class="btn btn-secondary">Clear</button>
</div><center>
<p style="color: red;">{{failmsg|safe}}</p>
</center>
<!-- Error message display -->
<div id="error-message" style="display: none; color: red; text-align:
center;"></div>
</form>
<!-- <form action="\Modif" class="form">
<button class="btn btn-primary" type="submit">Modify</button>
</form> -->
</div>
</section>
47
APPEARANCE:
Preview.html:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Flight Ticket</title>
<!-- Bootstrap CSS -->
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css"
rel="stylesheet">
<style>
@media print {
.btn {
display: none;
}
}
.ticket-container {
max-width: 600px;
margin: 50px auto;
48
padding: 20px;
background-color: #f8f9fa;
border: 1px solid #ccc;
border-radius: 10px;
box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.1);
}
.ticket-details {
background-color: #fff;
padding: 20px;
border-radius: 5px;
}
.btn-download {
padding: 10px 20px;
background-color: #007bff;
color: #fff;
border: none;
cursor: pointer;
border-radius: 5px;
}
</style>
</head>
<body>
<form action="/Pay">
<div class="ticket-container">
<div class="ticket-details">
<h1 class="text-center mb-4">Ahar Air Flight Ticket</h1>
<!-- Ticket details -->
<div class="row">
<div class="col-md-6">
{%for i in processed_row%}
49
<p><strong>Name:</strong>{{i[0]|safe}}</p>
<p><strong>Date of Birth:</strong>{{i[3]|safe}} </p>
<p><strong>Mobile Number:</strong>{{i[2]|safe}} </p>
<p><strong>Email ID:</strong>{{i[1]|safe}} </p>
<p><strong>Departure City::</strong>{{i[9]|safe}} </p>
<p><strong>Arrival City::</strong>{{i[10]|safe}} </p>
<p><strong>Departure Date:</strong>{{i[8]|safe}} </p>
<p><strong>Flight ID:</strong>{{i[11]|safe}} </p>
</div>
</div>
<div class="row mt-4">
<div class="col-md-6">
<p><strong>Class:</strong>{{i[12]|safe}}</p>
</div>
<div class="col-md-6">
<p><strong>Ticket Price:</strong>{{i[6]|safe}}</p>
</div>
</div>
</div>
{%endfor%}
<!-- Button to download -->
<input type="submit" value="PAY" class="btn btn-primary">
</form>
</div>
<!-- Bootstrap JS and jQuery (required for Bootstrap) -->
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
<script
src="https://cdn.jsdelivr.net/npm/@popperjs/[email protected]/dist/umd/popper.min.js"></script>
<script
src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
<script>
50
function printOrDownload() {
window.print(); // This will open the browser's print dialog
}
</script>
</body>
</html>
APPEARANCE:
Pay.html:
<div class="container payment-container">
<h2 class="text-center mb-4">Payment Details</h2>
<form class="payment-form" action="\download1" method="POST" onsubmit="return
validatePaymentForm()">
<input type="text" name="Nam" id="Name" value="{{Nam|safe}}" hidden>
<input type="text" name="Dep" id="Depc" value="{{Dep|safe}}" hidden>
<input type="text" name="Arr" id="Arrc" value="{{Arr|safe}}" hidden>
<input type="text" name="Fli" id="Flid" value="{{I|safe}}" hidden>
<input type="text" name="pric" id="pric" value="{{pric|safe}}" hidden>
<div class="form-group">
<label for="card_number">Card Number</label>
51
<input type="text" class="form-control" name="Carno" id="card_number"
placeholder="Enter Card Number">
</div>
<div class="form-group">
<label for="expiry_date">Expiry Date</label>
<input type="text" class="form-control" name="Exp" id="expiry_date"
placeholder="MM/YY">
</div>
<div class="form-group">
<label for="cvv">CVV</label>
<input type="number" class="form-control" id="cvv" name="Cvv" placeholder="Enter
CVV">
</div>
<div class="form-group">
<label for="name">Cardholder's Name</label>
<input type="text" class="form-control" name="name" id="name" placeholder="Enter
Name">
</div>
<div class="form-group">
<label for="amount">Amount</label>
<input type="number" class="form-control" name="Amount" id="amount"
placeholder="Enter Amount">
</div>
<div class="form-group">
<label for="currency">Currency</label>
<select class="form-control" id="currency">
<option value="USD">USD</option>
<option value="EUR">EUR</option>
<option value="GBP">GBP</option>
<!-- Add more options as needed -->
</select>
</div>
52
<error id="error-msg" style="color: red;"></error>
<button type="submit" class="btn btn-primary">Pay Now</button>
</form>
APPEARANCE:
53
3. Ticket Viewing and Downloading Part of Code: This part of the code allows users
to view their booked tickets and download them for offline access. It can be designed
as a reusable component that can be integrated into various parts of the application,
such as the user profile section, booking confirmation page, or even as a standalone
ticket management module. This way, users can access their tickets from different
parts of the application without duplicating code.
By designing these components as reusable modules, you can improve code maintainability,
reduce development time, and ensure consistency across different parts of the airline
reservation system. Additionally, it allows for easier updates and enhancements to the
functionality since changes only need to be made in one place, rather than scattered
throughout the code base.
RESULT:
Thus improvements were done to the software for re-usability and maintainability.
54
Ex.no:10
Date: IMPLEMENTATION OF MODIFIED CODE
AIM:
To implement the system after doing the improvements for reusability and
maintainability
IMPROVED SYSTEM:
CODING:
Book.html:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Ahar Airways</title>
<!-- Bootstrap CSS -->
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css"
rel="stylesheet">
<style>
/* Add this to your existing CSS */
.table-transparent {
background-color: rgba(255, 255, 255, 1); /* White color with full opacity by default
*/
transition: background-color 0.3s ease; /* Smooth transition for background color
change */
}
.table-transparent:hover {
background-color: rgba(255, 255, 255, 0.5); /* White color with 50% opacity on
hover */
}
55
.form:hover {
background-color: rgba(0, 0, 0, 0.5);
}
form {
color: white;
}
</style>
<link rel="stylesheet" href="style.css">
</head>
<body>
<header>
<img class="above-navbar" src="\static\back.png" alt="Image Above Navbar"
style="width: 100vw;height: 150px;">
<nav class="navbar navbar-expand-lg navbar-light bg-warning" style="padding-top:
2px;">
<a class="navbar-brand" href="#">Navbar</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-
target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-
expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNavAltMarkup">
<div class="navbar-nav">
<a class="nav-item nav-link active" href="#book">Book a Flight<span class="sr-
only">(current)</span></a>
<a class="nav-item nav-link" href="#aboutus">About Us</a>
<a class="nav-item nav-link" href="#fleet">Fleet Details</a>
<a class="nav-item nav-link" href="#safety-connectivity">Connectivity</a>
</div>
</div>
</nav>
56
</header>
<section id="book" class="cont" style="background-image:
url(https://wallpapers.com/images/featured/plane-background-etxz0fp95slobqec.webp);
background-repeat: no-repeat; background-size: cover; background-position: center;padding:
50px;">
<div class="container">
<form method="post" action="/" onsubmit="return validateForm()" class="form"
style="padding: 20px;border-radius: 50px; border: 2px solid rgba(255, 255, 255, 0.5);
transition: background-color 0.3s;">
<header style="text-align: center; font-size: larger; border-bottom: 2px solid white;
background-image: linear-gradient(to left, white, blue); margin-bottom: 20px;"><b>BOOK
A FLIGHT</b></header>
<div class="form-group" style="align-items: center;justify-content: center;text-
align: center;">
<input type="radio" value="trip" id="trip" name="trips"
onclick="toggleInput('trip')">
<label for="trip">One-Way</label>
<input type="radio" value="trips" name="trips" id="trips"
onclick="toggleInput('trips')">
<label for="trips">Two-Way</label>
<input type="radio" name="tripss" id="multistop" value="multistop"
onclick="toggleTripOption('multistop')">
<label for="multistop">Multistop</label>
<input type="radio" name="tripss" id="nonstop" value="nonstop"
onclick="toggleTripOption('nonstop')">
<label for="nonstop">Nonstop</label>
</div>
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label for="Dep">Departure City:</label>
<input type="text" class="form-control" name="Dep" id="Dep">
</div>
57
<div class="form-group">
<label for="stops">Stops:</label>
<button type="button" class="btn btn-primary" id="stops"
onclick="addStop()">Add Stop</button>
<div id="stops-container"></div>
</div>
<div class="form-group">
<label for="Arr">Arrival City:</label>
<input type="text" class="form-control" name="Arr" id="Arr">
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="Depdate">Departure Date:</label>
<input type="date" class="form-control" id="Depdate">
</div>
<div class="form-group">
<label for="Arrdat">Return Date:</label>
<input type="date" class="form-control" id="Arrdat">
</div>
<div class="form-group">
<label for="Passe">Passengers:</label>
<input type="number" name="Passe" class="form-control" id="Passe">
</div>
<div class="form-group">
<label for="class">Choose your Class:</label>
<select name="Class" class="form-control" id="class">
<option name="Economy" value="Economy">Economy Class</option>
<option name="Business" value="Business">Business Class</option>
58
<option name="First" value="First">First Class</option>
</select>
</div>
</div>
</div>
<div class="form-group text-center">
<button type="submit" class="btn btn-primary">Search Flight</button>
<button type="reset" class="btn btn-secondary">Clear</button>
</div><center>
<p style="color: red;">{{failmsg|safe}}</p>
</center>
<!-- Error message display -->
<div id="error-message" style="display: none; color: red; text-align:
center;"></div>
</form>
<form action="\Modif" class="form">
<button class="btn btn-primary" type="submit">Modify</button>
</form>
</div>
</section>
<!-- Bootstrap JS and jQuery -->
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
<script
src="https://cdn.jsdelivr.net/npm/@popperjs/[email protected]/dist/umd/popper.min.js"></script>
<script
src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
<script>
function toggleInput(option){
var Arr = document.getElementById("Arrdat");
if(option == 'trip'){
59
Arr.disabled = true;
}
if(option == 'trips'){
Arr.disabled = false;
}
}
function toggleTripOption(option) {
var Arr = document.getElementById("stops");
if (option == 'nonstop') {
Arr.disabled = true; // Disable Arrival Date input for one-way trips
}
if(option == 'multistop') {
Arr.disabled = false; // Enable Arrival Date input for two-way and multistop trips
}
}
let stopCounter = 0; // Counter to track added boxes
function addStop() {
if (stopCounter >= 2) {
alert("You can only add up to two stops.");
return; // Stop adding more boxes
}
var stopsContainer = document.getElementById("stops-container");
var stopInput = document.createElement("input");
stopInput.type = "text";
stopInput.name = "stop";
stopInput.placeholder = "Stop";
stopsContainer.appendChild(stopInput);
stopCounter++; // Increment the counter after adding a box
}
60
function validateForm() {
var passs = document.getElementById("Passe").value;
var depd = document.getElementById("Depdate").value;
var arrd = document.getElementById("Arrdat").value;
var tripType = document.querySelector('input[name="trips"]:checked');
61
// If all fields are filled and return date is later than departure date, return true to allow
form submission
return true;
}
}
function reloadpage(){
location.reload();
}
window.addEventListener('pageshow',function(event){
if(event.persisted){
reloadpage();
}
});
</script>
</body>
</html>
Detail.html:
<h1 class="card-title">Flight Details</h1>
</div>
<p><strong>
<input type="hidden" name="hid" value="{{s|safe}}">
{{s}}
</strong></p>
<div class="card-body">{% for values in processed_rows%}
<p><strong>Flight Number:</strong>{{values[3]|safe}} </p>
<p><strong>Origin:</strong>{{values[0]|safe}}</p>
<p><strong>Destination:</strong>{{values[1]|safe}} </p>
<p><strong>Number of Passengers:</strong>{{values[7]|safe}} </p>
62
<p><strong>Price:</strong>{{values[2]|safe}} </p>
<form action="/Billbef" method="post">
<button type="submit">Book</button>
</form>
{% endfor %}
Fill.html:
<div class="container payment-container">
<h2 class="text-center mb-4">Payment Details</h2>
<form class="payment-form" action="\download1" method="POST" onsubmit="return
validatePaymentForm()">
<input type="text" name="Nam" id="Name" value="{{Nam|safe}}" hidden>
<input type="text" name="Dep" id="Depc" value="{{Dep|safe}}" hidden>
<input type="text" name="Arr" id="Arrc" value="{{Arr|safe}}" hidden>
<input type="text" name="Fli" id="Flid" value="{{I|safe}}" hidden>
<input type="text" name="pric" id="pric" value="{{pric|safe}}" hidden>
<div class="form-group">
<label for="card_number">Card Number</label>
<input type="text" class="form-control" name="Carno" id="card_number"
placeholder="Enter Card Number">
</div>
<div class="form-group">
<label for="expiry_date">Expiry Date</label>
<input type="text" class="form-control" name="Exp" id="expiry_date"
placeholder="MM/YY">
</div>
<div class="form-group">
<label for="cvv">CVV</label>
<input type="number" class="form-control" id="cvv" name="Cvv" placeholder="Enter
CVV">
</div>
63
<div class="form-group">
<label for="name">Cardholder's Name</label>
<input type="text" class="form-control" name="name" id="name" placeholder="Enter
Name">
</div>
<div class="form-group">
<label for="amount">Amount</label>
<input type="number" class="form-control" name="Amount" id="amount"
placeholder="Enter Amount">
</div>
<div class="form-group">
<label for="currency">Currency</label>
<select class="form-control" id="currency">
<option value="USD">USD</option>
<option value="EUR">EUR</option>
<option value="GBP">GBP</option>
<!-- Add more options as needed -->
</select>
</div>
<error id="error-msg" style="color: red;"></error>
<button type="submit" class="btn btn-primary">Pay Now</button>
</form>
Ticket.html:
<form action="/Pay" method="post">
<div class="ticket-container">
<div class="ticket-details">
<h1 class="text-center mb-4">Ahar Air Flight Ticket</h1>
<!-- Ticket details -->
<div class="row">
64
<div class="col-md-6">
<input type="text" name="Nam" id="Nam" value="{{Name|safe}}" readonly hidden>
<input type="text" name="Dep" id="Dep" value="{{Depc|safe}}" readonly hidden>
<input type="text" name="Arr" id="Arr" value="{{Arrc|safe}}" readonly hidden >
<input type="text" name="Fli" id="Fli" value="{{ID|safe}}" readonly hidden>
<input type="text" name="pri" id="pri" value="{{pri|safe}}" readonly hidden>
{%for i in processed_row%}
<p><strong>Name:</strong>{{i[0]|safe}}</p>
<p><strong>Date of Birth:</strong>{{i[3]|safe}} </p>
<p><strong>Mobile Number:</strong>{{i[2]|safe}} </p>
<p><strong>Email ID:</strong>{{i[1]|safe}} </p>
<p><strong>Departure City::</strong>{{i[9]|safe}} </p>
<p><strong>Arrival City::</strong>{{i[10]|safe}} </p>
<p><strong>Departure Date:</strong>{{i[8]|safe}} </p>
<p><strong>Flight ID:</strong>{{i[11]|safe}} </p>
</div>
</div>
<div class="row mt-4">
<div class="col-md-6">
<p><strong>Class:</strong>{{i[12]|safe}}</p>
</div>
<div class="col-md-6">
<p><strong>Ticket Price:</strong>{{i[6]|safe}}</p>
</div>
</div>
</div>
{%endfor%}
<input type="submit" value="PAY" class="btn btn-primary">
</form>
65
Download.html:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Flight Ticket</title>
<!-- Bootstrap CSS -->
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css"
rel="stylesheet">
<style>
@media print {
.btn {
display: none;
}
}
.ticket-container {
max-width: 600px;
margin: 50px auto;
padding: 20px;
background-color: #f8f9fa;
border: 1px solid #ccc;
border-radius: 10px;
box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.1);
}
.ticket-details {
background-color: #fff;
padding: 20px;
}
66
.btn-download {
padding: 10px 20px;
background-color: #007bff;
color: #fff;
border: none;
cursor: pointer;
border-radius: 5px;
}
</style>
</head>
<body>
<form action="/Pay">
<div class="ticket-container">
<div class="ticket-details">
<h1 class="text-center mb-4">Ahar Air Flight Ticket</h1>
<!-- Ticket details -->
<div class="row">
<div class="col-md-6">
{%for i in processed_row%}
<p><strong>Name:</strong>{{i[0]|safe}}</p>
<p><strong>Date of Birth:</strong>{{i[3]|safe}} </p>
<p><strong>Mobile Number:</strong>{{i[2]|safe}} </p>
<p><strong>Email ID:</strong>{{i[1]|safe}} </p>
<p><strong>Departure City::</strong>{{i[9]|safe}} </p>
<p><strong>Arrival City::</strong>{{i[10]|safe}} </p>
<p><strong>Departure Date:</strong>{{i[8]|safe}} </p>
<p><strong>Flight ID:</strong>{{i[11]|safe}} </p>
</div>
</div>
67
<div class="row mt-4">
<div class="col-md-6">
<p><strong>Class:</strong>{{i[12]|safe}}</p>
</div>
<div class="col-md-6">
<p><strong>Ticket Price:</strong>{{i[6]|safe}}</p>
</div>
</div>
</div>
{%endfor%}
<!-- Button to download -->
<input type="submit" value="PAY" class="btn btn-primary">
</form>
</div>
<!-- Bootstrap JS and jQuery (required for Bootstrap) -->
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
<script
src="https://cdn.jsdelivr.net/npm/@popperjs/[email protected]/dist/umd/popper.min.js"></script>
<script
src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
<script>
function printOrDownload() {
window.print(); // This will open the browser's print dialog
}
</script>
</body>
</html>
68
BACKEND CONNECTION:
Validate.py:
from flask import Flask,render_template,request,redirect,url_for
import mysql.connector
a=[]
s=0
a=[0]*1
print(a)
mydb=mysql.connector.connect(host='localhost',database='Route1',user='Ahamed',password
='Ahamed@2003',auth_plugin='caching_sha2_password')
cu=mydb.cursor()
def fetch(deptci,arrci,sclass):
try:
if mydb.is_connected():
print("Connected")
except mysql.connector.Error as r:
print(f'Error:{r}')
deptci=str(request.form.get('Dep'))
arrci=str(request.form.get('Arr'))
sclass=sclass
query="select * from route where Deptcity=(%s) and Arrcity=(%s)and class=(%s)"
cu.execute(query,(deptci,arrci,sclass))
ff=cu.fetchall()
return ff
app=Flask(__name__,template_folder="templates")
@app.route('/',methods=['GET'])
def index():
return render_template("Untitled.html")
@app.route('/',methods=["POST"])
69
def enabbook():
passcount=request.form.get('Passe')
s=passcount
deptci=str(request.form.get('Dep'))
arrci=str(request.form.get('Arr'))
passc=(request.form.get('Passe'))
print(passc)
Class=request.form.get(('Class'))
failmsg=""
print((deptci),(arrci))
if len(deptci)==0:
failmsg="Please fill the necessary fields"
return render_template("Untitled.html", failmsg=failmsg)
if len(arrci)==0:
failmsg="Please fill the necessary fields"
return render_template("Untitled.html", failmsg=failmsg)
if deptci==arrci:
return render_template("Untitled.html", failmsg="Please choose a different arrival and
departure city")
else:
rows=fetch((deptci),(arrci),(Class))
p=[]
v1=""
for i in rows:
v1=i[1] #departure city
v2=i[2] #Arrival city
v3=i[3] #stops
v4=i[4] #Date
v5=int(i[5])*int(passc) #price
70
v6=i[6] #Flightid
v7=i[7]
print(type(v5))
p.append((v1,v2,int(v5),v6,v3,v4,v7,passcount))
a.pop(0)
for i in range(len(p)):
a.append(p[i])
if deptci!=v1:
return render_template("Info.html",failmsg="Sorry Flight not available")
else:
return render_template('Info.html',processed_rows=p)
@app.route('/Billbef', methods=['POST'])
def load_bill():
# Redirect to Billbef.html after form submission
print(len(a))
print(a)
return redirect(url_for('billbef'))
# Route to render Billbef.html
@app.route('/billbef')
def billbef():
return render_template("Billbef.html",a=a)
@app.route('/Modif',methods=['GET'])
def mod():
return render_template('Modif.html')
def fetcsh():
try:
if mydb.is_connected():
print("Connected")
except mysql.connector.Error as r:
71
print(f'Error:{r}')
a=str(request.form.get('name'))
b=request.form.get('email')
c=request.form.get('mobile')
d=request.form.get('dob')
e=request.form.get('price')
f=request.form.get('price1')
g=request.form.get('price2')
dat=request.form.get('dob') #Change this
classs=request.form.get('class')
depcit=request.form.get('depc')
arrcit=request.form.get('arc')
id=request.form.get('id')
s=[a,b,c,d,e,f,g,d,c,depcit,arrcit,id]
query="insert into
passenger(name,email,Mobileno,dob,Origprice,Totprice,Finalpri,Depdate,Depcity,Arrcity,Fli
ghtid,class) values(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)"
cu.execute(query,(a,b,c,d,e,f,g,dat,depcit,arrcit,id,classs))
mydb.commit()
@app.route('/download',methods=['POST'])
def down():
fetcsh()
query="Select * from passenger where Name=(%s) and Depdate=(%s) and Depcity=(%s)
and Arrcity=(%s) and Flightid=(%s)"
cu.execute(query,((str(request.form.get('name'))),request.form.get('dob'),request.form.get('dep
c'),request.form.get('arc'),request.form.get('id')))
ff=cu.fetchone()
print(ff)
a=[]
for i in range(0,1):
72
a.append(ff)
return render_template('download.html',processed_row=a)
@app.route('/Pay',methods=['GET'])
def doswn():
return render_template('Pay.html')
def fetchh():
query="Select * from passenger"
cu.execute(query)
ff=cu.fetchone()
return ff
@app.route('/download1',methods=['POST'])
def downd():
ff=fetchh()
print(ff)
a=[]
for i in range(1):
a.append(ff)
print(a)
return render_template('download1.html',processed_row=a)
if __name__== "__main__":
app.run(debug=True,port=8000)
73
FORMS AFTER IMPROVEMENT:
74
75
76
Result:
Thus the system was successfully implemented after doing improvements.
77