diff --git a/app/bookings/routes.py b/app/bookings/routes.py index 650eeea5eb5230606ccc28150be25faeb7d13539..39129c8ff19ccb8f47db940e7181a31075a18487 100644 --- a/app/bookings/routes.py +++ b/app/bookings/routes.py @@ -4,14 +4,6 @@ from app.models import Listings, ListingImages @bp.route('/home') def index(): - return render_template('bookings/index.html') - -@bp.route('/') -def redirect_index(): - return redirect(url_for('bookings.index'), code=301) - -@bp.route('/listings') -def listings(): listing_ids = [] top_listings = Listings.get_top_listings(5) @@ -20,4 +12,12 @@ def listings(): top_listing_images = ListingImages.get_selected_main_images(listing_ids) - return render_template('bookings/listings.html', top_listings=top_listings, top_listing_images=top_listing_images) + return render_template('bookings/index.html', top_listings=top_listings, top_listing_images=top_listing_images) + +@bp.route('/') +def redirect_index(): + return redirect(url_for('bookings.index'), code=301) + +@bp.route('/listings') +def listings(): + return render_template('bookings/listings.html') diff --git a/app/models/listing_images.py b/app/models/listing_images.py index 5429614e112aacc9b631440cd2fe141531bfc11c..a68b52d875b8078a2d11a056248f7beaddf4ae54 100644 --- a/app/models/listing_images.py +++ b/app/models/listing_images.py @@ -9,8 +9,8 @@ class ListingImages(db.Model): image_location = db.Column(db.String(255), nullable=False) image_description = db.Column(db.String(255), nullable=True) main_image = db.Column(db.SmallInteger(), nullable=False) - listings_id = mapped_column(ForeignKey("listings.id")) - listings = relationship("Listings", back_populates="listing_images") + # listings_id = mapped_column(ForeignKey("listings.id")) + # listings = relationship("Listings", back_populates="listing_images") @classmethod def get_selected_main_images(cls, listing_ids): diff --git a/app/models/listings.py b/app/models/listings.py index a04b2fb92d0c9ad026b929c6ec485dd750384c06..6c79da147ad17c0b63e316fe232fd9a3e09e1163 100644 --- a/app/models/listings.py +++ b/app/models/listings.py @@ -13,7 +13,7 @@ class Listings(db.Model): transport_type = db.Column(db.String(255), nullable=False) business_tickets = db.Column(db.Integer(), nullable=False) economy_tickets = db.Column(db.Integer(), nullable=False) - listing_images = relationship("ListingImages", back_populates="listing_images") + # listing_images = relationship("ListingImages", back_populates="listing_images") @classmethod def get_all_listings(cls): diff --git a/app/static/listings.css b/app/static/listings.css new file mode 100644 index 0000000000000000000000000000000000000000..4fc4a6aa1e674086fd64d4c7765ebd4a29a7fec7 --- /dev/null +++ b/app/static/listings.css @@ -0,0 +1,27 @@ +/* https://codepen.io/enbee81/pen/popZGoX */ +.deals_text { + font-size: 80px; + text-transform: uppercase; + text-align: center; + line-height: 1; + font-family: "Work Sans", sans-serif; + padding: 20px 20px; +} + +.deals_underline { +position: relative; +white-space: nowrap; +&:after { + --deco-height: 0.3125em; + content: ""; + position: absolute; + left: 0; + right: 0; + bottom: calc(var(--deco-height) * -0.625); + height: var(--deco-height); + background-image: url("data:image/svg+xml,%3Csvg width='100' height='64' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cg clip-path='url(%23a)'%3E%3Cpath d='M-17 30.5C-1 22 72-4 54 13 37.9 28.2-2.5 57.5 16 55.5s72-29 104-40' stroke='%2300FDCF' stroke-width='10'/%3E%3C/g%3E%3Cdefs%3E%3CclipPath id='a'%3E%3Cpath fill='%23fff' d='M0 0h100v64H0z'/%3E%3C/clipPath%3E%3C/defs%3E%3C/svg%3E%0A"); + background-size: auto 100%; + background-repeat: round; + background-position: 0em; +} +} diff --git a/app/static/listings_slider.css b/app/static/listings_slider.css deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/app/templates/bookings/index.html b/app/templates/bookings/index.html index e0e3f1e199047ff85af2a1982cb6f9bca6f6ab7e..511b12109d474a6d7f2a700769cb4c9494ce271c 100644 --- a/app/templates/bookings/index.html +++ b/app/templates/bookings/index.html @@ -1,10 +1,44 @@ {% extends 'base.html' %} {% block content %} - <div class="content"> - <h2>Top Deals For you</h2> - <h3>Create slide show of top bookings here<h3> - - <div style="margin-left:50px"> <a href= "{{ url_for('bookings.listings') }}" class="button_1">View All Deals</a></div> +<head> + <link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='listings.css')}}"> + <script src="https://cdn.jsdelivr.net/npm/swiffy-slider@1.6.0/dist/js/swiffy-slider.min.js" crossorigin="anonymous" defer></script> + <link href="https://cdn.jsdelivr.net/npm/swiffy-slider@1.6.0/dist/css/swiffy-slider.min.css" rel="stylesheet" crossorigin="anonymous"> +</head> +<div class="content"> + <div class="deals_text"><span class="deals_underline">Deals for you</span></div> + <div class="swiffy-slider slider-item-show2 slider-item-reveal slider-nav-outside slider-nav-round slider-nav-visible slider-indicators-outside slider-indicators-round slider-indicators-dark slider-nav-animation slider-nav-animation-fadein slider-item-first-visible"> + <ul class="slider-container py-4"> + {% for listing in top_listings %} + <li class="slide-visible"> + <div class="card shadow h-100"> + <div class="ratio ratio-16x9"> + <th>{{top_listing_images[listing.id]}}</th> + <img src="{{ url_for('main.upload_file', filename=top_listing_images[listing.id]) }}" class="card-img-top" loading="lazy" alt="Main Image"> + </div> + <div class="card-body p-3 p-xl-4"> + <h3 class="card-title h5">{{listing.destination_location}}</h3> + <p class="card-text">Add Location description here once implemented</p> + <div><a href="#" class="btn btn-primary">Book now</a> + </div> + </div> + </div> + </li> + {% endfor %} + </ul> + + <button type="button" class="slider-nav" aria-label="Go left"></button> + <button type="button" class="slider-nav slider-nav-next" aria-label="Go left"></button> + + <div class="slider-indicators"> + <button class="active" aria-label="Go to slide"></button> + <button aria-label="Go to slide" class=""></button> + <button aria-label="Go to slide" class=""></button> + <button aria-label="Go to slide" class=""></button> + </div> </div> +</div> + +<div style="margin-left:50px"> <a href= "{{ url_for('bookings.listings') }}" class="button_1">View All Deals</a></div> {% endblock %} \ No newline at end of file diff --git a/app/templates/bookings/listings.html b/app/templates/bookings/listings.html index 5754b158cdae94d2b2fe3dd8b18f2f68efdb5639..5fba48d4811285e412deaa3fdb9b317dc43b515d 100644 --- a/app/templates/bookings/listings.html +++ b/app/templates/bookings/listings.html @@ -7,35 +7,6 @@ <link href="https://cdn.jsdelivr.net/npm/swiffy-slider@1.6.0/dist/css/swiffy-slider.min.css" rel="stylesheet" crossorigin="anonymous"> </head> <div class="content"> - <div class="swiffy-slider slider-item-show2 slider-item-reveal slider-nav-outside slider-nav-round slider-nav-visible slider-indicators-outside slider-indicators-round slider-indicators-dark slider-nav-animation slider-nav-animation-fadein slider-item-first-visible"> - <ul class="slider-container py-4"> - {% for listing in top_listings %} - <li class="slide-visible"> - <div class="card shadow h-100"> - <div class="ratio ratio-16x9"> - <th>{{top_listing_images[listing.id]}}</th> - <img src="{{ url_for('main.upload_file', filename=top_listing_images[listing.id]) }}" class="card-img-top" loading="lazy" alt="Main Image"> - </div> - <div class="card-body p-3 p-xl-4"> - <h3 class="card-title h5">{{listing.destination_location}}</h3> - <p class="card-text">Add Location description here once implemented</p> - <div><a href="#" class="btn btn-primary">Book now</a> - </div> - </div> - </div> - </li> - {% endfor %} - </ul> - - <button type="button" class="slider-nav" aria-label="Go left"></button> - <button type="button" class="slider-nav slider-nav-next" aria-label="Go left"></button> - - <div class="slider-indicators"> - <button class="active" aria-label="Go to slide"></button> - <button aria-label="Go to slide" class=""></button> - <button aria-label="Go to slide" class=""></button> - <button aria-label="Go to slide" class=""></button> - </div> - </div> + <p>Create full listings page here with search functionality</p> </div> {% endblock %} \ No newline at end of file