diff --git a/src/mainapp/migrations/0004_venue_active_alter_venue_description.py b/src/mainapp/migrations/0004_venue_active_alter_venue_description.py new file mode 100644 index 0000000..0eb6bea --- /dev/null +++ b/src/mainapp/migrations/0004_venue_active_alter_venue_description.py @@ -0,0 +1,23 @@ +# Generated by Django 4.1.5 on 2023-11-06 20:31 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('mainapp', '0003_waters'), + ] + + operations = [ + migrations.AddField( + model_name='venue', + name='active', + field=models.BooleanField(default=True), + ), + migrations.AlterField( + model_name='venue', + name='description', + field=models.TextField(blank=True, max_length=500), + ), + ] diff --git a/src/mainapp/models.py b/src/mainapp/models.py index c488af8..1286f5f 100644 --- a/src/mainapp/models.py +++ b/src/mainapp/models.py @@ -37,9 +37,17 @@ class Venue(models.Model): instagram_url = models.URLField(blank=True) facebook_url = models.URLField(blank=True) + active = models.BooleanField(default=True) + def __str__(self): return self.name + def waters(self): + """Returns all waters linked to this venue.""" + + waters = Waters.objects.filter(venue=self) + return waters + class Waters(models.Model): """Represents the waters of a Venue""" diff --git a/src/mainapp/templates/_index.html b/src/mainapp/templates/_index.html new file mode 100644 index 0000000..fe7a57b --- /dev/null +++ b/src/mainapp/templates/_index.html @@ -0,0 +1,31 @@ +{% extends "base.html" %} +{% load static %} + +{% block style %} + +{% endblock style %} + +{% block content %} + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +{% endblock content %} + +{% block scripts %} + +{% endblock scripts %} diff --git a/src/mainapp/templates/index.html b/src/mainapp/templates/index.html index fe7a57b..65e8e92 100644 --- a/src/mainapp/templates/index.html +++ b/src/mainapp/templates/index.html @@ -1,31 +1,482 @@ {% extends "base.html" %} {% load static %} +{% block title %} + Venues | +{% endblock title %} + {% block style %} - + {% endblock style %} +{% block header_buttons %} +{% endblock header_buttons %} + {% block content %} +
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+

Venues & Waters

+
+
+ +
+ +
+
+ + + + +
+
+
+
+
+ +
+
+
+
+
+
+ {% for venue in venues %} +
+
+
+
+

+ {% if venue.venue_type == "FISHERY" %} + Fishery + {% elif venue.venue_type == "PRIVATE" %} + Private + {% elif venue.venue_type == "CLUB" %} + Club + {% endif %} +

+

{{ venue.name }}

+
+ + +
+

{{ venue.description }}

+
+ {% if venue.email_address %} + + + + {% endif %} + {% if venue.phone_number %} + + + + {% endif %} + {% if venue.latitude and venue.longitude %} + + + + {% endif %} + {% if venue.website_url %} + + + + {% endif %} +
+ {% if venue.waters %} +
+ {{ venue.waters|length }} + +
+ {% endif %} + {% if not venue.latitude or not venue.longitude or not venue.phone_number or not venue.website_url or not venue.email_address %} +
+ +
+ {% endif %} + {% if not venue.active %} +
+ +
+ {% endif %} +
+
+
+ {% endfor %} +
+
+
+
+ {% endblock content %} {% block scripts %} - + + + + {% endblock scripts %} diff --git a/src/mainapp/templates/venues.html b/src/mainapp/templates/venues.html index 4d8714c..d32f023 100644 --- a/src/mainapp/templates/venues.html +++ b/src/mainapp/templates/venues.html @@ -57,20 +57,22 @@
-
+
{{ venue.name }}

{{ venue.street_address }}

{{ venue.city }}, {{ venue.provence }}

{{ venue.postal_code }}

-

{{ venue.phone_number }}

-

{{ venue.email_address }}

+
+

{{ venue.phone_number }}

+

{{ venue.email_address }}

+
-
+
6 Waters
-
@@ -226,7 +228,7 @@
Please enter a Country
diff --git a/src/mainapp/views.py b/src/mainapp/views.py index 050e90a..fbd6a57 100644 --- a/src/mainapp/views.py +++ b/src/mainapp/views.py @@ -18,7 +18,11 @@ from .models import Venue, Waters def index(request): - return render(request, 'index.html') + + venues = Venue.objects.all() + context = {"venues": venues, "venue_types": Venue.VENUE_TYPES} + + return render(request, 'index.html', context) def results(request): return render(request, 'results.html') diff --git a/src/static/img/logo-horizontal.webp b/src/static/img/logo-horizontal.webp new file mode 100644 index 0000000..7ece068 Binary files /dev/null and b/src/static/img/logo-horizontal.webp differ diff --git a/src/static/img/logo-icon-alt.webp b/src/static/img/logo-icon-alt.webp new file mode 100644 index 0000000..3f28135 Binary files /dev/null and b/src/static/img/logo-icon-alt.webp differ diff --git a/src/static/img/logo-icon.webp b/src/static/img/logo-icon.webp new file mode 100644 index 0000000..80c17cd Binary files /dev/null and b/src/static/img/logo-icon.webp differ diff --git a/src/static/img/logo-text-alt.webp b/src/static/img/logo-text-alt.webp new file mode 100644 index 0000000..257df59 Binary files /dev/null and b/src/static/img/logo-text-alt.webp differ diff --git a/src/static/img/logo-text.webp b/src/static/img/logo-text.webp new file mode 100644 index 0000000..439d66e Binary files /dev/null and b/src/static/img/logo-text.webp differ diff --git a/src/static/js/mainapp/venues.js b/src/static/js/mainapp/venues.js index 6cb68e0..c59898e 100644 --- a/src/static/js/mainapp/venues.js +++ b/src/static/js/mainapp/venues.js @@ -68,13 +68,42 @@ const formControls = [ return "Enter the postal code of the venue"; } }, + { + id: "venueLatitude", + validation: function (element) { + const value = element.val(); + return (!element.attr("required") || value.trim() !== ""); + }, + errorMessage: function (element) { + return "Enter the latitude of the venue"; + } + }, + { + id: "venueLongitude", + validation: function (element) { + const value = element.val(); + return (!element.attr("required") || value.trim() !== ""); + }, + errorMessage: function (element) { + return "Enter the longitude of the venue"; + } + }, ]; $(document).ready(function() { - // $("#newVenueAddressTab input").each(function() { //debuging remove later - // $(this).addClass("is-valid"); - // }); + // allLocationsMap + var allLocationstileLayer = L.tileLayer('https://{s}.tile.osm.org/{z}/{x}/{y}.png', { + attribution: false, + }) + + var allLocationsmap = L.map("allLocationsMap", { + center: originalMapCoords, + zoom:8, + layers: [allLocationstileLayer] + }); + + setTimeout(function() {allLocationsmap.invalidateSize(false)}, 200) }); $("#newVenueAddressTabBtn").on("shown.bs.tab", function() { @@ -152,7 +181,7 @@ $("#newVenueAddressTabBtn").on("shown.bs.tab", function() { $("#venueCity").val(data.address.village || data.address.town || data.address.city); $("#venueProvence").val(data.address.county || data.address.state_district); $("#venuePostCode").val(data.address.postcode || ''); - $("#venueCountry").val(data.address.country || ''); + // $("#venueCountry").val(data.address.country || ''); $("#venueLatitude").val(coordinates.lat); $("#venueLongitude").val(coordinates.lng); }); @@ -168,7 +197,7 @@ function toggleLoadingMap(isLoading) { $("#venueCity").prop("disabled", isLoading) $("#venueProvence").prop("disabled", isLoading) $("#venuePostCode").prop("disabled", isLoading) - $("#venueCountry").prop("disabled", isLoading) + // $("#venueCountry").prop("disabled", isLoading) if (isLoading) { $("#locationMapOverlay").show(); } @@ -315,6 +344,7 @@ function saveVenue() { instagram_url: $("#venueInstagram").val(), csrfmiddlewaretoken: scriptData.csrfmiddlewaretoken, + active: 1 } const venue_id = $("#venueModal").data("venue-id"); diff --git a/src/static/scss/_base.scss b/src/static/scss/_base.scss new file mode 100644 index 0000000..993312c --- /dev/null +++ b/src/static/scss/_base.scss @@ -0,0 +1,195 @@ +#webContent { + margin-left: 80px; + transition: margin 400ms ease-in-out; + + &.webcontent-collapsed { + margin-left: 280px !important; + } +} + +#sidebar { + + color: white; + background-color: #04385c; + + display: flex; + flex-direction: column; + flex-shrink: 0; + + position: fixed; + height: 100%; + z-index: 3; + padding: 1rem 0; + + transition: width 400ms ease-in-out; + overflow: hidden; + + .sidebar-collapse-button { + + display: inline-block; + color: white; + border: none; + background: none; + transition: transform 200ms ease-in-out; + + } + + &.sidebar-enlarged { + width: 280px !important; + + .sidebar-collapse-button { transform: rotate(-180deg); } + + a.nav-link { + text-align: start !important; + + i.bi { + margin: 0 1rem 0 .5rem !important; + } + + span.sidebar-item-text { + display: inline !important; + } + } + } + + &:not(.sidebar-enlarged) { + width: 80px; + } + + #sidebar-brand { + + max-width: 120px; + align-self: center; + display: flex; + align-items: center; + color: inherit; + text-decoration: none; + padding: 0 .5rem; + + } + + ul.sidebar-items { + + flex-direction: column; + margin-bottom: auto; + + li.nav-item { + + a.nav-link { + + color: inherit; + transition: all 200ms; + text-align: center; + white-space: nowrap; + + &:hover { background-color: rgba(0, 0, 0, 0.15); } + + i.bi { + // transition: all 200ms ease-in-out; + // margin: 0 auto; + } + + span.sidebar-item-text { + + display: none; + + } + + } + + } + + } + +} + +// .card-badge-container { +// position: relative; + +// .card-badge { +// aspect-ratio: 1 / 1; + +// height: calc(100% + 20px); + +// position: absolute; +// top: calc(-30% - 21px); +// left: -26px; + +// background-color: #04385c; +// border-bottom: 30px; +// border-left: 30px; +// border-right: 30px; + +// transform: rotate(45deg); +// // -webkit-transform: rotate(45deg); +// } +// } + +#newVenueTabBtns { + + // border-radius: 50rem; + overflow: hidden; + width: fit-content; + + .nav-item > .nav-link { + // border-radius: 1rem !important; + + color: #04385c; + + &.active { + color: white; + background-color: #04385c; + } + } + +} + +.btn-facing-left { + border-top-left-radius: 1.2rem !important; + border-bottom-left-radius: 1.2rem !important; + border-top-right-radius: 0.8rem !important; + border-bottom-right-radius: 0.8rem !important; +} + +.btn-facing-right { + border-top-left-radius: 0.8rem !important; + border-bottom-left-radius: 0.8rem !important; + border-top-right-radius: 1.2rem !important; + border-bottom-right-radius: 1.2rem !important; +} + +#venueModal .modal-content { + min-height: 550px; +} + +#locationMapOverlay { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + background: rgba(0, 0, 0, 0.7); /* Darkened overlay with 70% opacity */ + display: flex; + justify-content: center; + align-items: center; + z-index: 1000; /* Ensure the overlay is above the map */ +} + +.spinner { + border: 4px solid rgba(255, 255, 255, 0.3); /* Light border for the spinner */ + border-top: 4px solid #3498db; /* Blue spinner */ + border-radius: 50%; + width: 40px; + height: 40px; + animation: spin 1s linear infinite; +} + +@keyframes spin { + 0% { transform: rotate(0deg); } + 100% { transform: rotate(360deg); } +} + +.venue-textarea { + resize: none; + min-height: 152px !important; +} \ No newline at end of file diff --git a/src/static/scss/base.scss b/src/static/scss/base.scss index 993312c..9dbddb6 100644 --- a/src/static/scss/base.scss +++ b/src/static/scss/base.scss @@ -1,3 +1,120 @@ + +$primary-colour: #04385c; +$primary-hover-colour: #085c8d; +$danger-colour: #dc3545; +$danger-subtle-colour: #f8d7da; +$danger-emphasis-colour: #58151c; +$secondary-emphasis-colour:red; +$secondary-subtle-colour:red; +$border-color: #dee2e6; + +body { + // background-image: linear-gradient(0deg, #182848, #2980b9) +} + +.btn { + &.btn-primary { + border-color: $primary-colour; + background-color: $primary-colour; + transition: background-color 0.3s, border-color 0.3s; + &:hover { + border-color: $primary-hover-colour; + background-color: $primary-hover-colour; + } + } + + &.btn-outline-primary { + color: $primary-colour; + border-color: $primary-colour; + transition: background-color 0.3s, border-color 0.3s; + &:hover { + color: white; + border-color: $primary-hover-colour; + background-color: $primary-hover-colour + } + } +} + +.venue-description { + display: -webkit-box; + -webkit-line-clamp: 5; + -webkit-box-orient: vertical; + overflow: hidden; + max-width: 100% +} + +.nav-pills { + .nav-item { + .nav-link { + color: $primary-colour; + &.active { + color: white; + background-color: $primary-colour; + transition: background-color 0.3s; + } + } + } +} + +.text-hover-primary { + transition: color 0.3s; + &:hover { color: $primary-colour !important; } +} + +.tooltip-inner { text-align: left; } + +// Width Fit Content +.w-fc { width: fit-content; } +.mw-fc { min-width: fit-content; } +.mxw-fc { max-width: fit-content; } + +.hover-fill-secondary { + background-color: transparent; + transition: color 0.3s, background-color 0.3s; + &:hover { + color: $secondary-emphasis-colour; + background-color: $secondary-subtle-colour; + } +} + +.hover-fill-danger { + background-color: transparent; + transition: color 0.3s, background-color 0.3s; + &:hover { + color: $danger-emphasis-colour; + background-color: $danger-subtle-colour; + } +} + +.separator { + display: flex; + align-items: center; + text-align: center; + line-height: normal; + &::before,&::after { + content: ''; + flex: 1; + border-bottom: 1px solid $border-color; + } + &:not(:empty)::before { + margin-right: .75em; + } + &:not(:empty)::after { + margin-left: .75em; + } +} + + + + + + + + + + + + #webContent { margin-left: 80px; transition: margin 400ms ease-in-out; @@ -125,24 +242,24 @@ // } // } -#newVenueTabBtns { +// #newVenueTabBtns { - // border-radius: 50rem; - overflow: hidden; - width: fit-content; +// // border-radius: 50rem; +// overflow: hidden; +// width: fit-content; - .nav-item > .nav-link { - // border-radius: 1rem !important; +// .nav-item > .nav-link { +// // border-radius: 1rem !important; - color: #04385c; +// color: #04385c; - &.active { - color: white; - background-color: #04385c; - } - } +// &.active { +// color: white; +// background-color: #04385c; +// } +// } -} +// } .btn-facing-left { border-top-left-radius: 1.2rem !important; @@ -162,7 +279,7 @@ min-height: 550px; } -#locationMapOverlay { +.location-map { position: absolute; top: 0; left: 0; diff --git a/src/templates/_base.html b/src/templates/_base.html new file mode 100644 index 0000000..81915e7 --- /dev/null +++ b/src/templates/_base.html @@ -0,0 +1,101 @@ +{% load compress %} + + + + + + {% block title %}{% endblock title %}Angling Trust Results + + {% load static %} + + + + + {% compress css %} + + {% endcompress %} + {% include 'fonts.html' %} + {% block style %} + {% endblock style %} + + +
+ + +
+ +
+ +
+ {% block content %} + {% endblock content %} +
+
+
+
+ + + + + + + + {% block scripts %} + {% endblock scripts %} + + \ No newline at end of file diff --git a/src/templates/base.html b/src/templates/base.html index adf4368..f3d2d87 100644 --- a/src/templates/base.html +++ b/src/templates/base.html @@ -1,3 +1,4 @@ +{% load static %} {% load compress %} @@ -6,11 +7,9 @@ {% block title %}{% endblock title %}Angling Trust Results - {% load static %} + - - {% compress css %} {% endcompress %} @@ -18,80 +17,94 @@ {% block style %} {% endblock style %} - + -
- -
- -
- {% block content %} - {% endblock content %} +
-
+ + {% block content %} + {% endblock %} + - + {% block scripts %} {% endblock scripts %}