Skip to content

Commit

Permalink
[ FIX ][ AIR- 1] finalisation parti frontend pour client home - resul…
Browse files Browse the repository at this point in the history
…ts - vol description confirmation
  • Loading branch information
e.elhjoujy committed Oct 20, 2023
1 parent a233305 commit 149900d
Show file tree
Hide file tree
Showing 12 changed files with 659 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws Se
//TODO : if those information are not null then we will search for the vols
Collection<VolEntity> vols = searchVolsService.searchVols(origin,depart,departuredate,retourdate,"1");
req.setAttribute("vols",vols);
req.getRequestDispatcher("recherchePage.jsp").forward(req, resp);
req.getRequestDispatcher("recherche-page.jsp").forward(req, resp);
}


Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package ma.yc.airafraik.web;

import jakarta.servlet.ServletConfig;
import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import ma.yc.airafraik.core.Print;
import ma.yc.airafraik.entities.VolEntity;
import ma.yc.airafraik.service.SearchVolsService;
import ma.yc.airafraik.service.impl.SearchVolsServiceImpl;

import java.io.IOException;
import java.util.Collection;

@WebServlet(name = "RservationConfirmationController", value = "/reservation-confirmation")
public class RservationConfirmationController extends HttpServlet {

private SearchVolsService searchVolsService ;
@Override
public void init(ServletConfig config) throws ServletException {
super.init(config);
this.searchVolsService = new SearchVolsServiceImpl();
}

@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
String id = req.getParameter("id");

if (id != null) {
Print.log("id : " + id);
VolEntity vols = searchVolsService.searchVolParId(id);
req.setAttribute("vols",vols);
req.getRequestDispatcher("reservation-confirmation.jsp").forward(req, resp);

}else{
resp.sendRedirect("/");
}
super.doGet(req, resp);
}

@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
super.doPost(req, resp);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,15 @@ protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws Se

String id = req.getParameter("id");
Print.log("id : " + id);
// VolEntity reservationEntity = searchVolsService.searchVolParId(id);
VolEntity vol = searchVolsService.searchVolParId(id);
req.setAttribute("vol",vol);
//TODO : we will use this attribute in the jsp page

// try{
// if (reservationEntity != null){
// req.setAttribute("reservation",reservationEntity);
if (id != null) {
req.getRequestDispatcher("reservation-details.jsp").forward(req, resp);
req.getRequestDispatcher("reservation-confirmation-page.jsp").forward(req, resp);
}else{
resp.sendRedirect("/");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
</div>
</c:if>
<c:if test="${not empty vols}">
<div class="alert alert-success" role="alert">
<div class="alert mt-3 alert-success" role="alert">
${vols.size()} vol(s) trouvé(s)
</div>
</c:if>
Expand Down Expand Up @@ -67,9 +67,9 @@
<h3><c:out value="${vol.prix}" /> - MAD</h3>
<form action="reservation-details" method="get">
<input type="hidden" name="id" value="${vol.id}">
<input type="submit" value="Réservez">
<input class="button-reservation" type="submit" value="Réservez">
</form>
<a href="reservation-details/${vol.id}">Réservez</a>
<%-- <a href="reservation-details/${vol.id}">Réservez</a>--%>
<p>
Lorem ipsum dolor, sit amet consectetur.
</p>
Expand Down
65 changes: 65 additions & 0 deletions src/main/webapp/reservation-confirmation-page.jsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<%@ page import="java.util.Collection" %>
<%@ page import="ma.yc.airafraik.entities.VolEntity" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%
response.setHeader("Cache-Control", "no-cache, no-store, must-revalidate");
%>


<!DOCTYPE html>
<html lang="en">
<link rel="stylesheet" href="./static/css/vol-card.css">
<link rel="stylesheet" href="./static/css/reservation-details.css">

<jsp:include page="templates/head.jsp"/>

<body>
<div class="site-wrap">
<jsp:include page="templates/header.jsp"/>
<div class="container mt-4">
<h2>Contact Details</h2>
<form id="reservation-form" method="post" action="reservation-confirmation">
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label for="name">Full Name</label>
<input type="text" class="form-control" id="name" name="name" placeholder="Enter your full name" required>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="email">Email Address</label>
<input type="email" class="form-control" id="email" name="email" placeholder="Enter your email address" required>
</div>
</div>
</div>
<div class="form-group">
<label for="phone">Phone Number</label>
<input type="tel" class="form-control" id="phone" name="phone" placeholder="Enter your phone number" required>
</div>
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label for="flight">Flight Number</label>
<input type="text" class="form-control" id="flight" name="flight" placeholder="Enter your flight number" required>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="date">Flight Date</label>
<input type="date" class="form-control" id="date" name="date" required>
</div>
</div>
</div>
<div class="form-group">
<label for="comments">Additional Comments</label>
<textarea class="form-control" id="comments" name="comments" rows="4" placeholder="Any additional comments or special requests"></textarea>
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</form>
<jsp:include page="templates/footer.jsp"/>
</div>
</body>
</html>
171 changes: 155 additions & 16 deletions src/main/webapp/reservation-details.jsp
Original file line number Diff line number Diff line change
@@ -1,18 +1,157 @@
<%--
Created by IntelliJ IDEA.
User: pc
Date: 19/10/2023
Time: 14:42
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>Title</title>
</head>
<%@ page import="java.util.Collection" %>
<%@ page import="ma.yc.airafraik.entities.VolEntity" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%
response.setHeader("Cache-Control", "no-cache, no-store, must-revalidate");
VolEntity vol = request.getAttribute("vol") != null ? (VolEntity) request.getAttribute("vol") : null;
%>


<!DOCTYPE html>
<html lang="en">
<link rel="stylesheet" href="./static/css/vol-card.css">
<link rel="stylesheet" href="./static/css/reservation-details.css">

<jsp:include page="templates/head.jsp"/>

<body>
<h1>
Reservation effectuée avec succès !
</h1>
<div class="site-wrap">
<jsp:include page="templates/header.jsp"/>
<% assert vol != null; %>
<div class="container">
<div class="container m-4 reservation-details-container">
<div class="flight-details">
<h2>
This is the flight you have selected :
</h2>
<div class="flight-details-container">
<div class="flight-information-card">
<div class="vol-card">
<div class="vols-info">
<div class="vol-info">
<div class="logo-vol-comapny">
<img src="https://beebom.com/wp-content/uploads/2018/12/IranAir.jpg" alt="logo">
</div>
<div class="vol-info-heure-depart">
<p>12:00</p>
<p>
Safi (SFI)
</p>
</div>
<div class="rounded-divider"></div>
<div class="vol-info-heure-arrive">
<p>14:00</p>
<p>
Casablanca (CMN)
</p>
</div>
<div class="vol-duration">
<p>2h</p>
</div>
</div>
<div class="vol-info">
<div class="logo-vol-comapny">
<img src="https://beebom.com/wp-content/uploads/2018/12/IranAir.jpg" alt="logo">
</div>
<div class="vol-info-heure-depart">
<p>12:00</p>
<p>
Casablanca (CMN)
</p>
</div>
<div class="rounded-divider"></div>
<div class="vol-info-heure-arrive">
<p>14:00</p>
<p>
Rabat (RBA)
</p>
</div>
<div class="vol-duration">
<p>2h</p>
</div>
</div>
</div>
<div class="vol-reservation">
<h3> 435 - MAD </h3>
<p>
Lorem ipsum dolor, sit amet consectetur .
</p>
</div>
</div>
</div>
</div>
<div class="customzie-your-flight-conatainer">
<div class="basic">
<h2>Basic </h2>
</div>
<div class="smart">
<h2>smart</h2>
</div>
<div class="permium">
<h2>Permium</h2>
</div>
</div>
<div class="for-passangers">
<h2>For the passanagers </h2>
</div>
<div class="more-extracs">
<h2>Special meal on the board </h2>
<p>
Lorem ipsum dolor sit amet consectetur adipisicing elit.
Rerum, maiores itaque eaque, id adipisci cumque atque mollitia
impedit blanditiis sint odio, autem eveniet dolorum earum pariatur
quisquam accusantium similique nemo.
</p>
</div>
</div>
<div class="your-booking">
<h2>
Your booking details :
</h2>
<div class="your-booking-container">
<img src="" alt="" class="your-booking-image">
<div class="your-booking-header">
<div class="from-info">
<p>Marrakech</p>
<p>From</p>
<p>17-10-2023</p>
</div>
<div class="logo-info">
🛫
</div>
<div class="to-info">
<p>Istanbul </p>
<p>to</p>
<p>18-10-2023</p>
</div>
</div>
<div class="booking-details">
<hr>
<div class="passnger">
<p>1 Passenger</p>
<p>430.33</p>
</div>
<hr>
<div class="your-booking-total">
<p>Total </p>
<h2>494.22$</h2>
</div>
<div>
<p>Payment method</p>
<p>Visa</p>
</div>
<form class="confirmation" method="get" action="reservation-confirmation">
<input type="hidden" name="id" value="<%=vol.getId()%>" >
<input class="button-reservation btn btn-sm btn-primary" type="submit" value="Confirm">
</form>
</div>
</div>
</div>
</div>
</div>
<jsp:include page="templates/footer.jsp"/>
</div>
</body>
</html>
</html>
9 changes: 8 additions & 1 deletion src/main/webapp/sandbox/assets/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,11 @@ div.rounded-divider {
text-align: center;
font-size: 0.9rem;
grid-row: span 1;
}
}

.reservation-details-container{
display: grid;
grid-template-columns: 2fr 1fr ;
}


Loading

0 comments on commit 149900d

Please sign in to comment.