+
diff --git a/src/static/js/mainapp/venues.js b/src/static/js/mainapp/venues.js
index 92e4ac9..6cb68e0 100644
--- a/src/static/js/mainapp/venues.js
+++ b/src/static/js/mainapp/venues.js
@@ -9,8 +9,7 @@ const formControls = [
{
id: "venueName",
validation: function (element) {
- const value = element.val();
- const minlength = element.attr("minlength") || 0; // FIELD IS VALID IF:
+ const value = element.val(); // FIELD IS VALID IF:
return (!element.attr("required") || value.trim() !== ""); // - element is not required OR not empty
},
errorMessage: function (element) {
@@ -18,7 +17,58 @@ const formControls = [
return `Enter a venue name longer than ${minlength} characters`;
}
},
+ {
+ id: "venueType",
+ validation: function (element) {
+ const value = element.val(); // FIELD IS VALID IF:
+ return (!element.attr("required") || value !== null); // - element is not required OR not empty
+ },
+ errorMessage: function (element) {
+ return "Please selected a type of venue";
+ }
+ },
// Address Tab
+ {
+ id: "venueStreetAddress",
+ validation: function (element) {
+ const value = element.val();
+ return (!element.attr("required") || value.trim() !== "");
+ },
+ errorMessage: function (element) {
+ return "Enter the street address of the venue";
+ }
+ },
+ {
+ id: "venueCity",
+ validation: function (element) {
+ const value = element.val();
+ return (!element.attr("required") || value.trim() !== "");
+ },
+ errorMessage: function (element) {
+ return "Enter the town or city of the venue";
+ }
+ },
+ {
+ id: "venueProvence",
+ validation: function (element) {
+ const value = element.val();
+ return (!element.attr("required") || value.trim() !== "");
+ },
+ errorMessage: function (element) {
+ return "Enter the provence of the venue";
+ }
+ },
+ {
+ id: "venuePostCode",
+ validation: function (element) {
+ const value = element.val();
+ return (!element.attr("required") || value.trim() !== "");
+ },
+ errorMessage: function (element) {
+ return "Enter the postal code of the venue";
+ }
+ },
+
];
$(document).ready(function() {
@@ -39,6 +89,12 @@ $("#newVenueAddressTabBtn").on("shown.bs.tab", function() {
zoom:8,
layers: [tileLayer]
});
+
+ const UKSouthWest = L.latLng(49.823809, -8.649357);
+ const UKNorthEast = L.latLng(60.905124, 2.637773);
+ const UKBounds = L.latLngBounds(UKSouthWest, UKNorthEast);
+
+ map.setMaxBounds(UKBounds);
}
venueCoords = {
@@ -137,20 +193,23 @@ function openVenueModal(venue_id) {
const detailsTab = new bootstrap.Tab("#newVenueDetailsTabBtn");
detailsTab.show(); // back to the first tab
+ $("#venueForm .form-control, #venueForm .form-select").removeClass("is-valid is-invalid");
+ $("#venueForm .invalid-feedback").text("");
if (venue_id == -1) {
$("#venueModal .edit").hide();
$("#venueModal .create").show();
$("#venueName").val("");
- $("#venueDescription").val("");
$("#venueType").val("").change();
+ $("#venueDescription").val("");
+ $("#venueExtraNotes").val("");
$("#venueStreetAddress").val("");
$("#venueCity").val("");
$("#venueProvence").val("");
$("#venuePostCode").val("");
- $("#venueCountry").val("");
+ // $("#venueCountry").val("");
$("#venueLatitude").val("");
$("#venueLongitude").val("");
@@ -174,14 +233,15 @@ function openVenueModal(venue_id) {
const venue = response.data;
$("#venueName").val(venue.name);
- $("#venueDescription").val(venue.description);
$("#venueType").val(venue.venue_type).change();
+ $("#venueDescription").val(venue.description);
+ $("#venueExtraNotes").val(venue.extra_notes);
$("#venueStreetAddress").val(venue.street_address);
$("#venueCity").val(venue.city);
$("#venueProvence").val(venue.provence);
$("#venuePostCode").val(venue.postal_code);
- $("#venueCountry").val(venue.country);
+ // $("#venueCountry").val(venue.country);
$("#venueLatitude").val(venue.latitude);
$("#venueLongitude").val(venue.longitude);
@@ -211,7 +271,7 @@ $("#venueForm").on("submit", function(event) {
function validateVenue() {
// Reset the validation indicators and messages
- $("#venueForm .form-control").removeClass("is-valid is-invalid");
+ $("#venueForm .form-control, #venueForm .form-select").removeClass("is-valid is-invalid");
$("#venueForm .invalid-feedback").text("");
var valid = true;
@@ -272,4 +332,40 @@ function saveVenue() {
alert("error: " + JSON.stringify(error));
}
});
-}
\ No newline at end of file
+}
+
+$("#newVenueTabLeft").on("click", function() {
+
+ const currentTab = $("#newVenueTabBtns .nav-link.active").parent();
+ const previousTabParent = currentTab.prev();
+ const previousTab = previousTabParent.find(".nav-link");
+ previousTab.click();
+
+ if (previousTabParent.is(":first-child")) {
+ $("#newVenueTabLeft").prop("disabled", true);
+ $("#newVenueTabRight").prop("disabled", false);
+ }
+ else {
+ $("#newVenueTabRight").prop("disabled", false);
+ $("#saveVenue").hide();
+ }
+
+});
+
+$("#newVenueTabRight").on("click", function() {
+
+ const currentTab = $("#newVenueTabBtns .nav-link.active").parent();
+ const nextTabParent = currentTab.next();
+ const nextTab = nextTabParent.find(".nav-link");
+ nextTab.click();
+
+ if (nextTabParent.is(":last-child")) {
+ $("#newVenueTabRight").prop("disabled", true);
+ $("#saveVenue").show();
+ $("#newVenueTabLeft").prop("disabled", false);
+ }
+ else {
+ $("#newVenueTabLeft").prop("disabled", false);
+ }
+
+});
\ No newline at end of file
diff --git a/src/static/scss/base.scss b/src/static/scss/base.scss
index ddd9719..993312c 100644
--- a/src/static/scss/base.scss
+++ b/src/static/scss/base.scss
@@ -103,26 +103,27 @@
}
-.card-badge-container {
- position: relative;
+// .card-badge-container {
+// position: relative;
- .card-badge {
- width: 60px;
- height: 60px;
+// .card-badge {
+// aspect-ratio: 1 / 1;
- position: absolute;
- top: -30px;
- right: -30px;
+// height: calc(100% + 20px);
- background-color: #04385c;
- border-bottom: 30px;
- border-left: 30px;
- border-right: 30px;
+// position: absolute;
+// top: calc(-30% - 21px);
+// left: -26px;
- transform: rotate(45deg);
- -webkit-transform: rotate(45deg);
- }
-}
+// background-color: #04385c;
+// border-bottom: 30px;
+// border-left: 30px;
+// border-right: 30px;
+
+// transform: rotate(45deg);
+// // -webkit-transform: rotate(45deg);
+// }
+// }
#newVenueTabBtns {