Skip to content
Snippets Groups Projects
Commit 2d7a638c authored by Connor Brock's avatar Connor Brock
Browse files

Merge remote-tracking branch...

Merge remote-tracking branch 'origin/74-as-a-user-i-want-to-see-a-page-of-local-authorities-so-that-i-can-easily-source-contact-details' into businesses

# Conflicts:
#	src/main/java/Team5/SmartTowns/Organisation/organisationControllers.java
#	src/main/resources/WorkWith/local-authorities.html
#	src/main/resources/data.sql
#	src/main/resources/schema.sql
#	src/main/resources/templates/fragments/Templating.html
parents 25c1564a 65fb5939
No related branches found
No related tags found
2 merge requests!38Draft: Businesses,!31Resolve "As a user, I want to see a page of local authorities so that I can easily source contact details for a variety of different local authorities."
package Team5.SmartTowns.localauthority;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.net.URL;
@AllArgsConstructor
@NoArgsConstructor
@Data
public class localAuthority {
private String localAuthorityName;
private String address1;
private String address2;
private String city;
private String county;
private String postcode;
private URL website;
@Override
public String toString() {
return "Local Authority:" + " " +
localAuthorityName + '\'' + " " +
address1 + '\'' + " " +
address2 + '\'' + " " +
city + '\'' + " " +
county + '\'' + " " +
postcode + '\'' + " " +
website +
" ";
}
public String getLocalAuthorityName() {
return localAuthorityName;
}
public String getAddress1() { return address1; }
public String getAddress2() {
return address2;
}
public String getCity() {
return city;
}
public String getCounty() {
return county;
}
public String getPostcode() {
return postcode;
}
public URL getWebsite() {
return website;
}
}
package Team5.SmartTowns.localauthority;
import java.util.List;
public interface localAuthorityRepository {
List<localAuthority> getAllLocalAuthority();
void addLocalAuthority(localAuthority loc);
}
package Team5.SmartTowns.localauthority;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public class localAuthorityRepositoryJDBC implements localAuthorityRepository {
private JdbcTemplate jdbc;
private RowMapper<localAuthority> localAuthorityMapper;
public localAuthorityRepositoryJDBC(JdbcTemplate ajdbc){
this.jdbc = ajdbc;
setlocalauthorityMapper();
}
private void setlocalauthorityMapper(){
localAuthorityMapper = (rs, i) -> new localAuthority(
rs.getString("localAuthorityName"),
rs.getString("address1"),
rs.getString("address2"),
rs.getString("city"),
rs.getString("county"),
rs.getString("postcode"),
rs.getURL("website")
);
}
public List<localAuthority> getAllLocalAuthority(){
String sql = "SELECT * FROM localAuthority";
return jdbc.query(sql, localAuthorityMapper);
}
@Override
public void addLocalAuthority(localAuthority loc){
String sql = "INSERT INTO localAuthority( localAuthorityName, address1, address2, city, county, postcode, website) values (?, ?, ?, ?, ?, ?, ?)";
jdbc.update(sql, loc.getLocalAuthorityName(),loc.getAddress1(),loc.getAddress2(),loc.getCity(),loc.getCounty(),loc.getPostcode(),loc.getWebsite());
}
}
/* DELETES AND RECREATES DATABASE EVERY TIME THE SYSTEM IS BOOTED*/
DROP DATABASE IF EXISTS towns;
CREATE DATABASE IF NOT EXISTS towns;
USE towns;
/****************************************************************/
/* DROPS ALL TABLES IF THEY EXIST (they wont but just in case) */
DROP TABLE IF EXISTS trails;
DROP TABLE IF EXISTS locations;
DROP TABLE IF EXISTS users;
DROP TABLE IF EXISTS stickers;
DROP TABLE IF EXISTS packs;
DROP TABLE IF EXISTS stickerProgress;
/****************************************************************/
/* CREATES ALL TABLES */
CREATE TABLE IF NOT EXISTS trails (
drop table if exists trails;
create table if not exists trails
(
trailID bigint auto_increment primary key,
name varchar(128),
tru boolean
name varchar(128)
) engine=InnoDB;
drop table if exists locationCoordinates;
drop table if exists locations;
create table if not exists locations
(
locationID bigint auto_increment primary key,
......@@ -30,84 +14,60 @@ create table if not exists locations
locationEmail varchar(128),
locationDescription longtext,
locationPlace varchar(255),
locationTrailID varchar(128),
locationApproved boolean
locationTrailID varchar(128)
) engine=InnoDB;
CREATE TABLE IF NOT EXISTS users (
username varchar(30) primary key NOT NULL,
id bigint auto_increment unique, /*DEPRECATED COLUMN, LEFT IN WHILE SOME OTHER FUNCTIONS STILL USE IT*/
drop table if exists users;
create table if not exists users
(
userID bigint auto_increment primary key,
email varchar(128),
password varchar(30) NOT NULL,
enabled boolean default true
);
CREATE TABLE IF NOT EXISTS authorities (
id bigint primary key auto_increment NOT NULL,
username varchar(30) NOT NULL ,
authority varchar(45) NOT NULL
);
CREATE TABLE IF NOT EXISTS packs (
id bigint auto_increment primary key,
name varchar(20) NOT NULL,
description text
);
CREATE TABLE IF NOT EXISTS stickers (
id bigint auto_increment primary key,
packID bigint NOT NULL,
FOREIGN KEY (packID) REFERENCES packs(id)
ON DELETE CASCADE
ON UPDATE RESTRICT,
stickerID bigint NOT NULL, /*STICKER ID NUMBER WITHIN ITS OWN PACK*/
name varchar(30) NOT NULL,
description text NOT NULL,
rarity tinyint
);
CREATE TABLE IF NOT EXISTS stickerProgress (
id bigint auto_increment primary key,
username varchar(30) NOT NULL,
FOREIGN KEY (username) REFERENCES users(username)
ON DELETE CASCADE
ON UPDATE RESTRICT,
packID bigint NOT NULL,
FOREIGN KEY (packID) REFERENCES packs(id)
ON DELETE CASCADE
ON UPDATE RESTRICT,
stickerID bigint NOT NULL,
FOREIGN KEY (stickerID) REFERENCES stickers(id)
ON DELETE CASCADE
ON UPDATE RESTRICT
);
name varchar(128),
dragonProgress int
) engine=InnoDB;
create table if not exists locationCoordinates
drop table if exists badges;
create table if not exists badges
(
locationCoordID bigint auto_increment primary key,
locationID bigint,
Foreign Key (locationID) REFERENCES locations(locationID)
ON DELETE CASCADE
ON UPDATE RESTRICT,
locationCoordsLat DECIMAL(8,6),
locationCoordsLong DECIMAL(8,6)
)engine=InnoDB;
badgeID bigint auto_increment primary key,
name varchar(128),
description varchar(128),
difficulty bigint
) engine=InnoDB;
drop table if exists stickers;
create table if not exists stickers
(
stickerID bigint auto_increment primary key,
name varchar(128),
description varchar(128),
rarity bigint
) engine=InnoDB;
drop table if exists townsWithTrails;
create table if not exists townsWithTrails
drop table if exists badgeProgress;
create table if not exists badgeProgress
(
townID bigint auto_increment primary key,
townName varchar(128),
townCentreCoordsLat varchar(128),
townCentreCoordsLong varchar(128),
townUppermostCoordsLat varchar(128),
townLowermostCoordsLat varchar(128),
townLeftmostCoordsLong varchar(128),
townRightmostCoordsLong varchar(128)
userID bigint,
badgeID bigint,
progress int /*0-100*/
) engine=InnoDB;
)engine=InnoDB;
create table if not exists stickerProgress
(
userID bigint,
stickerID bigint,
hasSticker boolean /*Has sticker or not*/
) engine=InnoDB;
drop table if exists localAuthority;
create table if not exists localAuthority
(
localAuthorityID bigint auto_increment primary key,
localAuthorityName varchar(250),
address1 varchar(250),
address2 varchar(250),
city varchar(100),
county varchar(75),
postcode varchar(15),
website varchar(250)
) engine=InnoDB;
\ No newline at end of file
* {
box-sizing: border-box;
}
body {
background-color: rgb(41, 41, 41);
margin: 0;
display: flex;
flex-direction: column;
min-height: 100svh;
}
main {
}
/** {*/
/* box-sizing: border-box;*/
/*}*/
/*body {*/
/* background-color: rgb(41, 41, 41);*/
/* margin: 0;*/
/* display: flex;*/
/* flex-direction: column;*/
/* min-height: 100svh;*/
/*}*/
/*main {*/
/*}*/
.centerFlex {
display: flex;
justify-content: center;
}
#allTrailsBar {
width: 100%;
height: auto;
/*margin: 1svh auto;*/
padding: 0 5svh;
display: flex;
flex-wrap: wrap;
justify-content: space-evenly;
/*.centerFlex {*/
/* display: flex;*/
/* justify-content: center;*/
/*}*/
/*#allTrailsBar {*/
/* width: 100%;*/
/* height: auto;*/
/* !*margin: 1svh auto;*!*/
/* padding: 0 5svh;*/
/* display: flex;*/
/* flex-wrap: wrap;*/
/* justify-content: space-evenly;*/
}
.trailsImages {
margin: 1svh auto;
height: 12svh;
width: auto;
border-radius: 20px;
border: solid grey 2px;
transition: 0.5s ease-out 100ms;
box-shadow: 0 10px 20px rgba(0, 0, 0, 0.85);
}
/*}*/
/*.trailsImages {*/
/* margin: 1svh auto;*/
/* height: 12svh;*/
/* width: auto;*/
/* border-radius: 20px;*/
/* border: solid grey 2px;*/
/* transition: 0.5s ease-out 100ms;*/
/* box-shadow: 0 10px 20px rgba(0, 0, 0, 0.85);*/
/*}*/
.trailsImages:hover {
box-shadow: 0 0 20px 10px #bbbb00;
transform: scale(1.2,1.2);
}
/*.trailsImages:hover {*/
/* box-shadow: 0 0 20px 10px #bbbb00;*/
/* transform: scale(1.2,1.2);*/
/*}*/
.selected {
box-shadow: 0 0 20px 10px #bbbb00;
}
@keyframes fadeIn {
0% { opacity: 0; }
100% { opacity: 1; }
}
main {
margin: 0;
}
/*.selected {*/
/* box-shadow: 0 0 20px 10px #bbbb00;*/
/*}*/
/*@keyframes fadeIn {*/
/* 0% { opacity: 0; }*/
/* 100% { opacity: 1; }*/
/*}*/
/*main {*/
/* margin: 0;*/
/*}*/
#trailInfoContainer {
/*#trailInfoContainer {*/
overflow: scroll;
}
/* overflow: scroll;*/
/*}*/
.trailInfoFrag {
background-color: rgb(84, 33, 128);
border: #000000 solid 2px;
border-radius: 10px;
box-shadow: 0 5px 20px 0 #000000;
margin: 2svh auto;
padding-bottom: 2svw;
width: 70vw;
height: auto;
min-height: 30svh;
animation: fadeIn 3s;
/*.trailInfoFrag {*/
/* background-color: rgb(84, 33, 128);*/
/* border: #000000 solid 2px;*/
/* border-radius: 10px;*/
/* box-shadow: 0 5px 20px 0 #000000;*/
/* margin: 2svh auto;*/
/* padding-bottom: 2svw;*/
/* width: 70vw;*/
/* height: auto;*/
/* min-height: 30svh;*/
/* animation: fadeIn 3s;*/
display: grid;
grid-template-areas:
"header header header"
"image text text";
grid-template-columns: 30% 30% auto;
grid-template-rows: 10% auto;
grid-column-gap: 2vw;
grid-row-gap: 2svh;
& .trailInfoHeader {
grid-area: header;
width: 100%;
height: 100%;
margin-top: 1svh;
padding: 0;
& h1 {
color: white;
padding:0;
margin:0 25%;
font-size: 2vw;
text-align: center;
box-shadow: 0 10px 10px -10px black;
}
/* display: grid;*/
/* grid-template-areas:*/
/* "header header header"*/
/* "image text text";*/
/* grid-template-columns: 30% 30% auto;*/
/* grid-template-rows: 10% auto;*/
/* grid-column-gap: 2vw;*/
/* grid-row-gap: 2svh;*/
/* & .trailInfoHeader {*/
/* grid-area: header;*/
/* width: 100%;*/
/* height: 100%;*/
/* margin-top: 1svh;*/
/* padding: 0;*/
/* & h1 {*/
/* color: white;*/
/* padding:0;*/
/* margin:0 25%;*/
/* font-size: 2vw;*/
/* text-align: center;*/
/* box-shadow: 0 10px 10px -10px black;*/
/* }*/
}
/* }*/
& img {
grid-area: image;
border-radius: 10px;
border: black solid 1px;
margin-left: 2vw;
margin-right: 2vw;
width: 100%;
height: auto;
box-shadow: 0 10px 20px -10px black;
}
& p {
grid-area: text;
color: white;
margin: 0;
padding: 0 2vw;
font-size: 1.3vw;
text-align: justify;
text-justify: inter-character;
line-height: 1.5;
width: fit-content;
height: fit-content;
overflow: scroll;
/* & img {*/
/* grid-area: image;*/
/* border-radius: 10px;*/
/* border: black solid 1px;*/
/* margin-left: 2vw;*/
/* margin-right: 2vw;*/
/* width: 100%;*/
/* height: auto;*/
/* box-shadow: 0 10px 20px -10px black;*/
/* }*/
/* & p {*/
/* grid-area: text;*/
/* color: white;*/
/* margin: 0;*/
/* padding: 0 2vw;*/
/* font-size: 1.3vw;*/
/* text-align: justify;*/
/* text-justify: inter-character;*/
/* line-height: 1.5;*/
/* width: fit-content;*/
/* height: fit-content;*/
/* overflow: scroll;*/
}
}
/* }*/
/*}*/
#trailFragContent {
margin: 0;
padding: 0;
display: flex;
min-height: 40svh;
flex-wrap: wrap;
/*#trailFragContent {*/
/* margin: 0;*/
/* padding: 0;*/
/* display: flex;*/
/* min-height: 40svh;*/
/* flex-wrap: wrap;*/
}
/*}*/
header {
box-shadow: #1e1e1e 0 0 10px 10px;
font-size: 1vw;
}
/*header {*/
/* box-shadow: #1e1e1e 0 0 10px 10px;*/
/* font-size: 1vw;*/
/*}*/
body{
background-color: rgb(41, 41, 41)
}
h1{
color: wheat;
}
h3{
color: wheat;
}
ul{
list-style: none;
}
ul li{
color: wheat;
list-style: none;
}
\ No newline at end of file
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/html">
<head>
<meta charset="UTF-8">
<title>Local Authority</title>
<link rel="stylesheet" th:href="@{css/landmarkFormStyle.css}">
<link rel="stylesheet" th:href="@{css/templatingstyle.css}">
</head>
<header th:insert="~{/towns/Templating.html::header}"></header>
<body>
<div id="container1">
<h2>Enter your Local authority</h2>
<form action="/local-auth-data" id="data" name="data" method="post" th:object="${localAuthority}">
<br>
<label>Enter your local authority
<input type="text" th:field="*{localAuthorityName}">
</label><br><br>
<label>Please enter first line of your address
<input type="text" th:field="*{address1}">
</label><br><br>
<label>Please enter second line of your address (optional)
<input type="text" th:field="*{address2}">
</label><br><br>
<label>Please enter the City/Town
<input type="text" th:field="*{city}">
</label><br><br>
<label>Please enter you county (optional)
<input type="text" th:field="*{county}">
</label><br><br>
<label>Please enter your postcode
<input type="text" th:field="*{postcode}">
</label><br><br>
<label>Please enter your website address
<input type="text" th:field="*{website}">
</label><br><br>
<input type="submit">
</form>
</div>
</body>
<footer th:insert="~{/towns/Templating.html::footer}"></footer>
</html>
\ No newline at end of file
......@@ -3,19 +3,18 @@
<head>
<meta charset="UTF-8">
<title>Local Authorities</title>
<link rel="stylesheet" th:href="@{/css/templatingstyle.css}">
<link rel="stylesheet" th:href="@{css/localAuthorityPageStyle.css}">
<link rel="stylesheet" th:href="@{css/templatingstyle.css}">
</head>
<header th:insert="~{/towns/Templating.html::header}"></header>
<body>
<h1>Local Authorities</h1>
<div id="councils">
<p>Caerphilly County Borough Council,<br>Tredomen Park,<br> Ystrad Mynach,<br> Hengoed,<br> CF82 7PG</p>
<a href="https://www.caerphilly.gov.uk/main.aspx?lang=en-GB">Caerphilly County Borough Council Website</a>
<p>Risca Town Council,<br>Risca Palace Library,<br>Unit B,<br>75 Tredegar Street,<br>Risca,<br>NP11 6BW</p>
<a href="https://www.riscatowncouncil.org.uk/">Risca Town Council Website</a>
<p>Penarth Town Council West House,<br>Stanwell Road,<br>Penarth,<br> CF64 2YG</p>
<a href="https://www.penarthtowncouncil.gov.uk/your-council/">Penarth Town Council Website</a>
<ul th:each="local:${localAuth}">
<li th:text="${local}"></li>
</ul>
</div>
<button><a href="/localForm" id="authority">Local Authorities please enter here</a></button>
<footer th:insert="~{/towns/Templating.html::footer}"></footer>
</body>
</html>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment