Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
Flask
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ethan2.Clay@live.uwe.ac.uk
Flask
Commits
a82814ea
Commit
a82814ea
authored
2 months ago
by
Ethan2.Clay@live.uwe.ac.uk
Browse files
Options
Downloads
Patches
Plain Diff
Complete view booking route
parent
077874dd
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/profile/routes.py
+5
-1
5 additions, 1 deletion
app/profile/routes.py
app/templates/profile/view_booking.html
+37
-21
37 additions, 21 deletions
app/templates/profile/view_booking.html
with
42 additions
and
22 deletions
app/profile/routes.py
+
5
−
1
View file @
a82814ea
...
...
@@ -4,6 +4,7 @@ from flask_principal import Identity, identity_changed
from
flask_login
import
login_user
,
logout_user
,
login_required
,
current_user
from
werkzeug.security
import
check_password_hash
from
app.profile
import
bp
from
app.main.utils
import
pretty_time
from
app.models
import
User
,
Bookings
,
Listings
from
app.logger
import
auth_logger
from
app
import
db
,
permission_required
,
user_permission
...
...
@@ -277,4 +278,7 @@ def cancel_booking():
@bp.route
(
'
/manage_bookings/view/<int:id>
'
)
def
manage_profile_view_booking
(
id
):
return
render_template
(
'
profile/view_booking.html
'
)
booking
=
Bookings
.
search_booking
(
id
)
booking
.
listing
.
destination_time
=
pretty_time
(
booking
.
listing
.
destination_time
)
booking
.
listing
.
depart_time
=
pretty_time
(
booking
.
listing
.
depart_time
)
return
render_template
(
'
profile/view_booking.html
'
,
booking
=
booking
)
This diff is collapsed.
Click to expand it.
app/templates/profile/view_booking.html
+
37
−
21
View file @
a82814ea
{% extends 'base.html' %}
{% block content %}
<div
class=
"column is-4 is-offset-4"
>
<div
id=
"login-box"
class=
"form_box_30"
style=
"margin-top: 30px;"
>
<div
class=
"profile_form_background"
>
<h2
class=
"form_header"
>
Login
</h2>
<form
method=
"POST"
action=
"{{ url_for('profile.login_post') }}"
>
<input
type=
"hidden"
name=
"csrf_token"
value=
"{{ csrf_token() }}"
>
<div
class=
"mb-3"
>
<label
class=
"form-label"
autofocus=
""
>
Username/Email
</label>
<input
type=
"text"
class=
"form-control"
name=
"username"
>
<script
src=
"{{ url_for('static', filename='generic.js') }}"
></script>
<div
class=
"container mt-5"
>
<h2
class=
"mb-4 text-center"
>
Booking Details
</h2>
<div
class=
"row justify-content-center"
>
<div
class=
"col-md-8"
>
<div
class=
"card mb-4 shadow-sm"
>
<div
class=
"card-body"
>
<h3
class=
"card-title text-center mb-4"
>
Summary
</h3>
<div
class=
"row"
>
<div
class=
"col-md-6"
>
<p><strong>
Departure Date:
</strong>
{{ booking.depart_date }}
</p>
<p><strong>
Departure Location:
</strong>
{{ booking.listing.depart_location }}
</p>
<p><strong>
Departure Time:
</strong>
{{ booking.listing.depart_time }}
</p>
<p><strong>
Seat Type:
</strong>
{{ booking.seat_type.capitalize() }}
</p>
<p><strong>
Total Cost:
</strong>
£{{ booking.amount_paid }}
</p>
</div>
<div
class=
"col-md-6"
>
<p><strong>
Destination Location:
</strong>
{{ booking.listing.destination_location }}
</p>
<p><strong>
Destination Time:
</strong>
{{ booking.listing.destination_time }}
</p>
<p><strong>
Number of Seats:
</strong>
{{ booking.num_seats }}
</p>
<p><strong>
Cost Per Person:
</strong>
£{{ booking.amount_paid / booking.num_seats }}
</p>
<p><strong>
Cancelled:
</strong>
{{ 'Yes' if booking.cancelled else 'No' }}
</p>
</div>
</div>
</div>
<div
class=
"mb-3"
>
<label
for=
"exampleInputPassword1"
class=
"form-label"
>
Password
</label>
<input
type=
"password"
class=
"form-control"
name=
"password"
>
</div>
<div
class=
"card shadow-sm"
>
<div
class=
"card-body text-center"
>
<h3
class=
"card-title mb-4"
>
Re-Download Booking Details
</h3>
<div
class=
"d-flex justify-content-center"
>
<form
action=
"{{ url_for('bookings.generate_receipt', id=booking.id) }}"
method=
"get"
class=
"d-inline"
>
<button
type=
"submit"
class=
"btn btn-success btn-lg mr-2"
style=
"margin-right: 25px"
>
Download Receipt
</button>
</form>
<form
action=
"{{ url_for('bookings.generate_ticket', id=booking.id) }}"
method=
"get"
class=
"d-inline"
>
<button
type=
"submit"
class=
"btn btn-primary btn-lg"
>
Download Plane Ticket
</button>
</form>
</div>
</div>
<div
class=
"mb-3"
>
<a
class=
"clear-hyperlink"
href=
"{{ url_for('profile.password_reset') }}"
>
Forgot Password?
</a>
</div>
<div
class=
"mb-3 form-check"
>
<input
type=
"checkbox"
class=
"form-check-input"
id=
"remember"
name=
"remember"
>
<label
class=
"form-check-label"
for=
"remember"
>
Remember me
</label>
</div>
<button
type=
"submit"
class=
"btn btn-primary"
>
Log In
</button>
</form>
</div>
</div>
</div>
</div>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment