diff --git a/src/main/java/Team5/SmartTowns/Organisation/OrganisationControllers.java b/src/main/java/Team5/SmartTowns/Organisation/OrganisationControllers.java new file mode 100644 index 0000000000000000000000000000000000000000..29e164a001e8017049e7de49396b1981ff4ed579 --- /dev/null +++ b/src/main/java/Team5/SmartTowns/Organisation/OrganisationControllers.java @@ -0,0 +1,104 @@ +package Team5.SmartTowns.Organisation; + +import Team5.SmartTowns.business.Business; +import Team5.SmartTowns.business.BusinessRepository; +import Team5.SmartTowns.localauthority.LocalAuthority; +import Team5.SmartTowns.localauthority.LocalAuthorityRepository; +import jakarta.validation.Valid; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.ui.Model; +import org.springframework.validation.BindingResult; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.servlet.ModelAndView; +import org.springframework.web.bind.annotation.PostMapping; + +import org.springframework.stereotype.Controller; + +import java.util.List; + +@Controller +public class OrganisationControllers { + @Autowired + private LocalAuthorityRepository localAuthorityRepository; + + @Autowired + private BusinessRepository businessRepository; + + @GetMapping("/local-authorities") + public ModelAndView getLocalAuthoritiesPage(){ + ModelAndView mav = new ModelAndView("local-authorities"); + List<LocalAuthority> localAuthority = localAuthorityRepository.getAllLocalAuthority(); + mav.addObject("localAuth", localAuthority); + return mav; + } + @GetMapping("/localForm") + public ModelAndView getLocalAuthForm(){ + ModelAndView modelAndView = new ModelAndView("local-auth-data"); + modelAndView.addObject("localAuthority",new LocalAuthority()); + return modelAndView; + } + + + @GetMapping("/businesses") + public ModelAndView getBusinessPage() { + ModelAndView modelAndView = new ModelAndView("businesses"); + List<Business> business = businessRepository.getAllBusinesses(); + modelAndView.addObject("busiSub", business); + return modelAndView; + } + + @GetMapping("/businessSub") + public ModelAndView getBusinessSubPage() { + ModelAndView modelAndView = new ModelAndView("business-data"); + modelAndView.addObject("business", new Business()); + return modelAndView; + } + + + @PostMapping("/local-authorities") + public ModelAndView localAuthoritySent(@Valid @ModelAttribute("local-auth-data") LocalAuthority localAuthority, BindingResult bindingResult, Model model) { + ModelAndView modelAndView = new ModelAndView("local-authorities"); + if (bindingResult.hasErrors()) { + LocalAuthority loc = new LocalAuthority(localAuthority.getLocalAuthorityName(), localAuthority.getAddress1(), localAuthority.getAddress2(), localAuthority.getCity(), localAuthority.getCounty(), localAuthority.getPostcode(), localAuthority.getWebsite()); + System.out.println(loc); + localAuthorityRepository.addLocalAuthority(loc); //add local authority to local authority table + List<LocalAuthority> localAuthorities = localAuthorityRepository.getAllLocalAuthority(); + modelAndView.addObject("localAuth", localAuthorities); + + } else { + LocalAuthority loc = new LocalAuthority(localAuthority.getLocalAuthorityName(), localAuthority.getAddress1(), localAuthority.getAddress2(), localAuthority.getCity(), localAuthority.getCounty(), localAuthority.getPostcode(), localAuthority.getWebsite()); + System.out.println(loc); + localAuthorityRepository.addLocalAuthority(loc); //add local authority to local authority table + List<LocalAuthority> localAuthorities = localAuthorityRepository.getAllLocalAuthority(); + modelAndView.addObject("localAuth", localAuthorities); + } + return modelAndView; + } + + @PostMapping("/businesses") + public ModelAndView businessSent (@Valid @ModelAttribute("local-auth-data") Business business, BindingResult bindingResult, Model model ){ + + if (bindingResult.hasErrors()) { + ModelAndView modelAndView = new ModelAndView("businesses", model.asMap()); + return modelAndView; + } else { // converts user input using the organisation constructor into a submittable format to the sql table + Business bus = new Business(business.getBusinessName(), business.getAddress1(), business.getAddress2(), business.getCity(), business.getCounty(), business.getPostcode(), business.getWebsite()); + businessRepository.addBusiness(bus); //add local authority to local authority table + ModelAndView modelAndView = new ModelAndView("businesses"); + List<Business> localBusiness = businessRepository.getAllBusinesses(); + modelAndView.addObject("busiSub", localBusiness); + return modelAndView; + } + } + @GetMapping("/consumers") + public ModelAndView getConsumersPage () { + ModelAndView modelAndView = new ModelAndView("WorkWith/consumers.html"); + return modelAndView; + } + @GetMapping("/towns") + public ModelAndView getTownsPage () { + ModelAndView modelAndView = new ModelAndView("WorkWith/towns.html"); + return modelAndView; + } +} diff --git a/src/main/java/Team5/SmartTowns/business/Business.java b/src/main/java/Team5/SmartTowns/business/Business.java new file mode 100644 index 0000000000000000000000000000000000000000..b4146e11bf94461089e2f76d5cb77a810ec3774b --- /dev/null +++ b/src/main/java/Team5/SmartTowns/business/Business.java @@ -0,0 +1,59 @@ +package Team5.SmartTowns.business; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +@AllArgsConstructor +@NoArgsConstructor +@Data +public class Business { + private String businessName; + private String address1; + private String address2; + private String city; + private String county; + private String postcode; + private String website; + + @Override + public String toString(){ + return "Business:" + " " + + businessName + '\'' + " " + + address1 + '\'' + " " + + address2 + '\'' + " " + + city + '\'' + " " + + county + '\'' + " " + + postcode + '\'' + " " + + website + + " "; + } + + public String getBusinessName() { + return businessName; + } + + 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 String getWebsite() { + return website; + } +} diff --git a/src/main/java/Team5/SmartTowns/business/BusinessRepository.java b/src/main/java/Team5/SmartTowns/business/BusinessRepository.java new file mode 100644 index 0000000000000000000000000000000000000000..d98004ccb48ca4b005a5d4c043342a0e1fcca082 --- /dev/null +++ b/src/main/java/Team5/SmartTowns/business/BusinessRepository.java @@ -0,0 +1,8 @@ +package Team5.SmartTowns.business; + +import java.util.List; + +public interface BusinessRepository { + List<Business> getAllBusinesses(); + void addBusiness(Business bus); +} diff --git a/src/main/java/Team5/SmartTowns/business/BusinessRepositoryJDBC.java b/src/main/java/Team5/SmartTowns/business/BusinessRepositoryJDBC.java new file mode 100644 index 0000000000000000000000000000000000000000..3752c8bf9f0c24f230a3b1183674554ec758e1e3 --- /dev/null +++ b/src/main/java/Team5/SmartTowns/business/BusinessRepositoryJDBC.java @@ -0,0 +1,41 @@ +package Team5.SmartTowns.business; +import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.jdbc.core.RowMapper; +import org.springframework.stereotype.Repository; + +import java.util.List; +@Repository +public class BusinessRepositoryJDBC implements BusinessRepository { + + private JdbcTemplate jdbc; + private RowMapper<Business> businessMapper; + + public BusinessRepositoryJDBC(JdbcTemplate ajdbc){ + this.jdbc = ajdbc; + setbusinessMapper(); + } + + private void setbusinessMapper(){ + businessMapper = (rs, i) -> new Business( + rs.getString("businessName"), + rs.getString("address1"), + rs.getString("address2"), + rs.getString("city"), + rs.getString("county"), + rs.getString("postcode"), + rs.getString("website") + ); + } + public List<Business> getAllBusinesses(){ + String sql = "SELECT * FROM businesses"; + return jdbc.query(sql, businessMapper); + } + + @Override + public void addBusiness(Business bus) { + String sql = "INSERT INTO businesses( businessName, address1, address2, city, county, postcode, website) values (?, ?, ?, ?, ?, ?, ?)"; + jdbc.update(sql, bus.getBusinessName(),bus.getAddress1(),bus.getAddress2(),bus.getCity(),bus.getCounty(),bus.getPostcode(),bus.getWebsite()); + } +} + + diff --git a/src/main/java/Team5/SmartTowns/data/Location.java b/src/main/java/Team5/SmartTowns/data/Location.java index 60b4a772bd93dbd24df5e38a9d62a89dc7b0df74..e013b0f88572eebe5c8d53da4bb4473516322a67 100644 --- a/src/main/java/Team5/SmartTowns/data/Location.java +++ b/src/main/java/Team5/SmartTowns/data/Location.java @@ -60,7 +60,6 @@ public class Location { public boolean isLocationApproved() { return locationApproved; - } diff --git a/src/main/java/Team5/SmartTowns/data/LocationRepository.java b/src/main/java/Team5/SmartTowns/data/LocationRepository.java index 87a282b886ea979f4014ab8dba9d78c1d2bc0f33..da6f1183ea7cd7b472ba69192d57d43c0ec15139 100644 --- a/src/main/java/Team5/SmartTowns/data/LocationRepository.java +++ b/src/main/java/Team5/SmartTowns/data/LocationRepository.java @@ -12,7 +12,7 @@ public interface LocationRepository { List<Location> getAllApprovedLocations(); - int nametoLocationID(String name); + int nametoLocationID(String name); // List<Location> getApprovedLocations2(List<Location> list); diff --git a/src/main/java/Team5/SmartTowns/data/LocationRepositoryJDBC.java b/src/main/java/Team5/SmartTowns/data/LocationRepositoryJDBC.java index 73fe962ea7797900de3fb7465c01fb6ecfe6de12..8ab41dc4589a5ee0a49021c105f31ed40d869546 100644 --- a/src/main/java/Team5/SmartTowns/data/LocationRepositoryJDBC.java +++ b/src/main/java/Team5/SmartTowns/data/LocationRepositoryJDBC.java @@ -41,16 +41,7 @@ public class LocationRepositoryJDBC implements LocationRepository { String sql= "SELECT * FROM locations"; return jdbc.query(sql, locationMapper); } -// public LocationRepositoryJDBC() { -// JdbcTemplate ajdbc = new JdbcTemplate(); -// this.jdbc =ajdbc; -// setlocationMapper(); -// -// } -// public LocationRepositoryJDBC(JdbcTemplate jdbc, RowMapper<Location> locationMapper) { -// this.jdbc = jdbc; -// this.locationMapper = locationMapper; -// } + @Override public List<Location> getAllApprovedLocations(){ diff --git a/src/main/java/Team5/SmartTowns/landmarks/LandmarksController.java b/src/main/java/Team5/SmartTowns/landmarks/LandmarksController.java index f7005bed0229ebaffaa4ee283fb5368001694cec..773fe4e95e0f689bd398736d2f848ae602ed53a3 100644 --- a/src/main/java/Team5/SmartTowns/landmarks/LandmarksController.java +++ b/src/main/java/Team5/SmartTowns/landmarks/LandmarksController.java @@ -79,15 +79,16 @@ public class LandmarksController { int locationID = locationRepository.nametoLocationID(location.getLocationName()); // converts valid response using Location constructor into a submittable format to the sql table + System.out.println(locCoord.getLocationCoordsLong()); LocationsCoordinates ALocCoord = new LocationsCoordinates(locationID, locCoord.getLocationCoordsLat(), locCoord.getLocationCoordsLong()); boolean checkIfCoorsWithinBoundaries = placesCoordinatesRepo.checkIfCoordsAreWithinTownBoundary(ALocCoord); if (checkIfCoorsWithinBoundaries==false){ // if coords outside associated town, form is returned to original state - return new ModelAndView("redirect:/checkpointApproval"); + return new ModelAndView("redirect:/checkpointApproval?error"); } placesCoordinatesRepo.addLocationCoord(ALocCoord); // adds valid landmark to locations table locationRepository.updateApprovalStatus(locationID); // updates approval status accordingly System.out.println(placesCoordinatesRepo.getAllLocationCoords()); - ModelAndView modelAndView = new ModelAndView("redirect:/home"); //redirects back top form in case admin wants to input second location + ModelAndView modelAndView = new ModelAndView("redirect:/mobile-home"); //redirects back top form in case admin wants to input second location return modelAndView; // } diff --git a/src/main/java/Team5/SmartTowns/localauthority/LocalAuthority.java b/src/main/java/Team5/SmartTowns/localauthority/LocalAuthority.java new file mode 100644 index 0000000000000000000000000000000000000000..be01b2c16e4fe13ad1ea444c68143afe547742a5 --- /dev/null +++ b/src/main/java/Team5/SmartTowns/localauthority/LocalAuthority.java @@ -0,0 +1,56 @@ +package Team5.SmartTowns.localauthority; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +@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 String 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 String getWebsite() { + return website; + } +} diff --git a/src/main/java/Team5/SmartTowns/localauthority/LocalAuthorityRepository.java b/src/main/java/Team5/SmartTowns/localauthority/LocalAuthorityRepository.java new file mode 100644 index 0000000000000000000000000000000000000000..e2d732d104adff3cef3e738a223f1a921be5b7e9 --- /dev/null +++ b/src/main/java/Team5/SmartTowns/localauthority/LocalAuthorityRepository.java @@ -0,0 +1,9 @@ +package Team5.SmartTowns.localauthority; + +import java.util.List; + +public interface LocalAuthorityRepository { + List<LocalAuthority> getAllLocalAuthority(); + + void addLocalAuthority(LocalAuthority loc); +} diff --git a/src/main/java/Team5/SmartTowns/localauthority/LocalAuthorityRepositoryJDBC.java b/src/main/java/Team5/SmartTowns/localauthority/LocalAuthorityRepositoryJDBC.java new file mode 100644 index 0000000000000000000000000000000000000000..56aad615c93659cd288b776215571d5cbde36655 --- /dev/null +++ b/src/main/java/Team5/SmartTowns/localauthority/LocalAuthorityRepositoryJDBC.java @@ -0,0 +1,40 @@ +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.getString("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()); + } + +} diff --git a/src/main/java/Team5/SmartTowns/placeswithcoordinates/PlacesController.java b/src/main/java/Team5/SmartTowns/placeswithcoordinates/PlacesController.java index b9f08193e5f31d8285e385cc6c9495cc15ddf3b1..d5c1f96a6a50744b9b54fdf88cd52fc31d4be264 100644 --- a/src/main/java/Team5/SmartTowns/placeswithcoordinates/PlacesController.java +++ b/src/main/java/Team5/SmartTowns/placeswithcoordinates/PlacesController.java @@ -17,6 +17,8 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.ModelAndView; import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; import java.util.List; import java.util.stream.Collectors; @@ -35,6 +37,70 @@ public class PlacesController { private RewardsRepository rewardsRepository; + + + @GetMapping("/towns") + public ModelAndView getTownPages(){ + ModelAndView modelAndView = new ModelAndView("towns/townsPageList.html"); + List<TownWithTrails> townsList = placeRepo.getAllTownCoords(); + List<Trail> trailslocations = trailsRepo.getAllTrails(); + modelAndView.addObject("trails", trailslocations); + modelAndView.addObject("towns", townsList); + return modelAndView; + } + + @RequestMapping(value="/town", method= RequestMethod.POST) + public String sendHtmlFragmentTown(Model map) { + map.addAttribute("foo", "bar"); + return "checkpoint/checkpoint"; + } + + @GetMapping("/towns/{town}") + public ModelAndView getResultBySearchKeyTowns(@PathVariable String town) { + List<TownWithTrails> townsList = placeRepo.getAllTownCoords(); + List<Trail> trailslocations = trailsRepo.getAllTrails(); + List<Trail> correctTrails = new ArrayList<>(); + String townNamee=""; + int indexTown=999; + for (int i=0;i<townsList.size();i++){ + if (Objects.equals(townsList.get(i).getTownName(), town)){ + indexTown=i; + townNamee=town; + } + } + if (indexTown!=999){ + int townIDFromTable= placeRepo.getTownIDFromName(townNamee); + for (int i=0;i<trailslocations.size();i++){ + int trailID = trailsRepo.getTrailIDFromTrailName(trailslocations.get(i).getTrailName()); + if ((trailID>100)&&(trailID<200)&&(Objects.equals(townNamee, "Caerphilly"))){ + correctTrails.add(trailslocations.get(i)); + } + if ((trailID>200)&&(trailID<300)&&(Objects.equals(townNamee, "Risca"))){ + correctTrails.add(trailslocations.get(i)); + } + if ((trailID>300)&&(trailID<400)&& (Objects.equals(townNamee, "Penarth")) ){ + correctTrails.add(trailslocations.get(i)); + } + } + } + + ModelAndView modelAndView= new ModelAndView("fragments/townsPageFrags :: townSection"); + modelAndView.addObject("town", townsList.get(indexTown)); + modelAndView.addObject("trails", correctTrails); + return modelAndView;} + + + + + + + + + + + + + @GetMapping("/checkpoints") public ModelAndView getLocationPages(){ ModelAndView modelAndView = new ModelAndView("landmarks/locationPage.html"); @@ -42,7 +108,7 @@ public class PlacesController { List<Location> approvedLocations = locationRepo.getAllApprovedLocations(); modelAndView.addObject("location", approvedLocations); - modelAndView.addObject("locationCoords", locCoords); + modelAndView.addObject("locationCoords", reorderCoordsWRTLocations(locCoords)); return modelAndView; } @@ -55,19 +121,19 @@ public class PlacesController { - @GetMapping("/checkpoints/{location}") + @GetMapping("/checkpoints/{location}") public ModelAndView getResultBySearchKeyLocation(@PathVariable String location) { - List<LocationsCoordinates> locCoords = placeRepo.getAllLocationCoords(); - List<Location> approvedLocations = locationRepo.getAllApprovedLocations(); + List<LocationsCoordinates> locCoords = reorderCoordsWRTLocations(placeRepo.getAllLocationCoords()); + List<Location> approvedLocations = locationRepo.getAllApprovedLocations(); - int locationID = 999; - for (int i=0;i<approvedLocations.size();i++){ - if ( (approvedLocations.get(i).getLocationName().replace(' ', '-').trim().equals(location)) ){ - locationID= i; - } + int locationID = 999; + for (int i=0;i<approvedLocations.size();i++){ + if ( (approvedLocations.get(i).getLocationName().replace(' ', '-').trim().equals(location)) ){ + locationID= i; } + } - String trailName=trailsRepo.getTrailNameWithID(approvedLocations.get(locationID).getLocationTrailID()).replace(' ', '-').trim(); + String trailName=trailsRepo.getTrailNameWithID(approvedLocations.get(locationID).getLocationTrailID()).replace(' ', '-').trim(); ModelAndView modelAndView= new ModelAndView("fragments/locationPageFrags :: locationSection"); modelAndView.addObject("locCoord", locCoords.get(locationID)); modelAndView.addObject("trail", trailName); @@ -90,7 +156,7 @@ public class PlacesController { modelAndView.addObject("trails", trailslocations); modelAndView.addObject("locations", approvedLocations); - modelAndView.addObject("locationCoords", locCoords); + modelAndView.addObject("locationCoords", reorderCoordsWRTLocations(locCoords)); return modelAndView; } @@ -131,5 +197,41 @@ public class PlacesController { modelAndView.addObject("stickers", rewardsRepository.getAllStickersFromPack(1)); return modelAndView; } +// public List<LocationsCoordinates> reorderCoordsWRTLocations(List<LocationsCoordinates> locCoords){ +// List<Location> approvedList = locationRepo.getAllLocation(); +//// List<LocationsCoordinates> locCoords = placeRepo.getAllLocationCoords(); +// List<Integer> locationID= new ArrayList<Integer>(); +// System.out.println(locCoords); +// System.out.println("///////"); +// Collections.swap(locCoords,0,10); +// for(int i=0;i<locCoords.size();i++){ +// if (i==locCoords.size()-1){ +// if (locCoords.get(i).getLocationID()<locCoords.get(i-1).getLocationID()){ +// Collections.swap(locCoords,i,i--); +// i=0; +// } +// +// } +// if (locCoords.get(i).getLocationID()>locCoords.get(i++).getLocationID()){ +// System.out.println("ASDSADASD"); +// Collections.swap(locCoords,i,i++); +// i=0; +// } +// +// } System.out.println(locCoords); +// return locCoords; +// +// +// +// } + + // When adding to the locationsCoordinates table, the order is not based on LocationID order, therefore it is needed to rearrange this list to + // follow ascending locationID so that any new coordinates match up with their intended locations. + public List<LocationsCoordinates> reorderCoordsWRTLocations(List<LocationsCoordinates> locCoords){ + Collections.sort(locCoords, + Comparator.comparingInt(LocationsCoordinates::getLocationID)); + return locCoords; + + } } diff --git a/src/main/java/Team5/SmartTowns/placeswithcoordinates/PlacesCoordinatesRepositoryJDBC.java b/src/main/java/Team5/SmartTowns/placeswithcoordinates/PlacesCoordinatesRepositoryJDBC.java index a7a7dc86900df8bdfb0c0dd080fcced6d123d313..9065ea29fe0ee822c0ad895bc81dbb441c3f31f5 100644 --- a/src/main/java/Team5/SmartTowns/placeswithcoordinates/PlacesCoordinatesRepositoryJDBC.java +++ b/src/main/java/Team5/SmartTowns/placeswithcoordinates/PlacesCoordinatesRepositoryJDBC.java @@ -18,6 +18,7 @@ public class PlacesCoordinatesRepositoryJDBC implements PlacesCoordinatesReposit private JdbcTemplate jdbc; private RowMapper<LocationsCoordinates> locationCoordMapper; private RowMapper<TownWithTrails> townCoordMapper; + public PlacesCoordinatesRepositoryJDBC(JdbcTemplate aJdbc) { this.jdbc = aJdbc; setLocationCoordsMapper(); @@ -65,7 +66,7 @@ public class PlacesCoordinatesRepositoryJDBC implements PlacesCoordinatesReposit public void addLocationCoord(LocationsCoordinates locCoords) { String sql = "insert into locationCoordinates(locationID, locationCoordsLat,locationCoordsLong) values (?,?,?)"; - jdbc.update(sql,locCoords.getLocationID(), locCoords.getLocationCoordsLong(),locCoords.getLocationCoordsLat()); + jdbc.update(sql,locCoords.getLocationID(), locCoords.getLocationCoordsLat(),locCoords.getLocationCoordsLong()); } @Override @@ -217,369 +218,3 @@ public class PlacesCoordinatesRepositoryJDBC implements PlacesCoordinatesReposit - - - /// if location id == unapproved location id,-> make sure coords within boundaries, -> approve and append lcoations table and add to coords table. - -// List<String> unapprovedLocationTowns = new ArrayList<String>(); -// for (int i=1;unapprovedLocations.size()>i;i++ ){ -// if (Objects.equals(unapprovedLocations.get(i).getLocationPlace(), town)){ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// } -// -//// -// // unapproved list -// // if matches name, approve -// // add long/lat coords -// //use to update table -// } -//} diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index fc40c9e4004d1b4e83234ecefecf308e3e4871b8..52e81d219c68d4702643665e6f9d58c7aebb8308 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,4 +1,4 @@ -spring.datasource.url=jdbc:mariadb://localhost:3306/ +spring.datasource.url=jdbc:mariadb://localhost:3306/towns spring.datasource.username=root spring.datasource.password=comsc diff --git a/src/main/resources/data.sql b/src/main/resources/data.sql index 0f9e519cef18df0356b6bb32c269cedeb3fd7f0a..8ffad04380049d6c6c324827d8b5d80073a578f4 100644 --- a/src/main/resources/data.sql +++ b/src/main/resources/data.sql @@ -54,10 +54,6 @@ INSERT INTO stickers (packID, stickerID, name, description, rarity) VALUE (3, 1, INSERT INTO stickers (packID, stickerID, name, description, rarity) VALUE (3, 2, 'Welsh Outline', 'Welsh Heritage', '1'); INSERT INTO stickers (packID, stickerID, name, description, rarity) VALUE (3, 3, 'Welsh Spoon', 'Welsh Heritage', '1'); -# delete from stickerprogress; -# insert into stickerprogress (userID, stickerID, hasSticker) value ('1', '1', true); -# insert into stickerprogress (userID, stickerID, hasSticker) value ('1', '3', true); -# insert into stickerprogress (userID, stickerID, hasSticker) value ('2', '2', true); delete from locationCoordinates; insert into locationCoordinates(locationID, locationCoordsLat, locationCoordsLong) value (2, 51.57623, -3.21910 ); @@ -73,19 +69,17 @@ insert into locationCoordinates(locationID, locationCoordsLat, locationCoordsLon insert into locationCoordinates(locationID, locationCoordsLat, locationCoordsLong) value (20, 51.43547, -3.16789 ); +delete from localauthority; +insert into localauthority ( localAuthorityName, address1, address2, city, county, postcode, website) value ( 'Caerphilly County Borough Council', 'Tredomen Park','', 'Ystrad Mynach, Hengoed', '', 'CF82 7PG', 'https://www.caerphilly.gov.uk/main.aspx?lang=en-GB'); +insert into localauthority ( localAuthorityName, address1, address2, city, county, postcode, website) value ( 'Risca Town Council', 'Unit B, 75 Tredegar Street', '', 'Risca', '', 'NP11 6BW', 'https://www.riscatowncouncil.org.uk/'); +insert into localauthority ( localAuthorityName, address1, address2, city, county, postcode, website) value ( 'Penarth Town Council West House', 'Stanwell Road', '', 'Penarth', '', 'CF64 2YG', 'https://www.penarthtowncouncil.gov.uk/your-council/'); +delete from businesses; +insert into businesses ( businessName, address1, address2, city, county, postcode, website) value ( 'Caerphilly Castle', 'Castle Street','', 'Caerphilly', '', 'CF836 1JD', 'https://cadw.gov.wales/visit/places-to-visit/caerphilly-castle'); +insert into businesses ( businessName, address1, address2, city, county, postcode, website) value ( 'Risca Museum', 'Grove Road', '', 'Risca', '', 'NP11 6GN', 'https://riscamuseum.wales/'); +insert into businesses ( businessName, address1, address2, city, county, postcode, website) value ( 'Penarth Pier Pavillion Cinema', 'Windsor Court', 'The Esplanade', 'Penarth', '', 'CF64 3AU', 'https://www.valeofglamorgan.gov.uk/en/enjoying/Coast-and-Countryside/Dog-Beach-Ban.aspx'); -# insert into stickerprogress (userID, packID, stickerID) value (1, 1, 1); -# insert into stickerprogress (userID, packID, stickerID) value (1, 1, 2); -# insert into stickerprogress (userID, packID, stickerID) value (1, 1, 3); -# insert into stickerprogress (userID, packID, stickerID) value (1, 1, 5); -# insert into stickerprogress (userID, packID, stickerID) value (1, 2, 1); -# insert into stickerprogress (userID, packID, stickerID) value (1, 2, 3); - - - -# delete from townsWithTrails; insert into townsWithTrails (townName, townCentreCoordsLat, townCentreCoordsLong, townUppermostCoordsLat, townLowermostCoordsLat, townLeftmostCoordsLong, townRightmostCoordsLong) value ('Caerphilly', '51.57903','-3.22075 ','51.60418','51.55093','-3.25222','-3.17696'); insert into townsWithTrails (townName, townCentreCoordsLat, townCentreCoordsLong, townUppermostCoordsLat, townLowermostCoordsLat, townLeftmostCoordsLong, townRightmostCoordsLong) value ('Risca','51.61195','-3.09648','51.63039','51.59175','-3.12129','-3.06438'); diff --git a/src/main/resources/schema.sql b/src/main/resources/schema.sql index 6ab5702936cdab3ff90b69ac0d5104a91cb7be23..12452d458fccc0626341c4017ab3d1720bf24194 100644 --- a/src/main/resources/schema.sql +++ b/src/main/resources/schema.sql @@ -14,7 +14,8 @@ DROP TABLE IF EXISTS users; DROP TABLE IF EXISTS stickers; DROP TABLE IF EXISTS packs; DROP TABLE IF EXISTS stickerProgress; -DROP TABLE IF EXISTS dragonstale; + + /****************************************************************/ @@ -27,8 +28,7 @@ create table if not exists trails city 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, @@ -40,6 +40,7 @@ create table if not exists locations locationApproved boolean ) 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*/ @@ -71,7 +72,6 @@ CREATE TABLE IF NOT EXISTS stickers ( description text NOT NULL, rarity tinyint ); - CREATE TABLE IF NOT EXISTS stickerProgress ( id bigint auto_increment primary key, username varchar(30) NOT NULL, @@ -101,7 +101,8 @@ create table if not exists locationCoordinates )engine=InnoDB; -drop table if exists townsWithTrails; + + create table if not exists townsWithTrails ( townID bigint auto_increment primary key, @@ -115,12 +116,30 @@ create table if not exists townsWithTrails )engine=InnoDB; -CREATE TABLE IF NOT EXISTS dragonstale + +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; + + +create table if not exists businesses ( - landmarkID bigint auto_increment primary key, - landmarkName varchar(255), - landmarkDescription varchar(2000), - imgPath varchar(255) + businessID bigint auto_increment primary key, + businessName varchar(250), + address1 varchar(250), + address2 varchar(250), + city varchar(100), + county varchar(75), + postcode varchar(15), + website varchar(250) +) engine=InnoDB; -)engine=InnoDB; diff --git a/src/main/resources/static/css/businessesStyle.css b/src/main/resources/static/css/businessesStyle.css new file mode 100644 index 0000000000000000000000000000000000000000..b52eaf25fcc7f39db75493543e76437282c9574a --- /dev/null +++ b/src/main/resources/static/css/businessesStyle.css @@ -0,0 +1,13 @@ +body{ + background-color: rgb(41, 41, 41) +} +h3{ + color: wheat; +} +ul{ + list-style: none; +} +ul li{ + color: wheat; + list-style: none; +} \ No newline at end of file diff --git a/src/main/resources/static/css/homePageStyle.css b/src/main/resources/static/css/homePageStyle.css index 4d69af3c489fc11c8772ed8e68eda94d2d536b75..271119c67ab8434f1e99a4525d119a18d1e34649 100644 --- a/src/main/resources/static/css/homePageStyle.css +++ b/src/main/resources/static/css/homePageStyle.css @@ -13,6 +13,11 @@ and (min-device-width: 1000px) { grid-area: submitButton; } + + .reviewLand{ + grid-area: reviewButton; + } + .Banner { margin-top: 20px; background-color: darkslategrey; @@ -146,14 +151,15 @@ and (min-device-width: 1000px) { .gridContainer1 { - display: grid; + display:grid; grid-template-columns: 10% 10% 60% 5% 5% 10%; grid-template-rows: auto; grid-template-areas: ". pageTitle pageTitle pageTitle pageTitle ." - ". . . submitButton submitButton ."; + ". reviewButton . submitButton submitButton ."; } + .gridContainer2 { display: grid; grid-template-columns: 10% 10% 60% 5% 5% 10%; diff --git a/src/main/resources/static/css/localAuthorityPageStyle.css b/src/main/resources/static/css/localAuthorityPageStyle.css new file mode 100644 index 0000000000000000000000000000000000000000..61c59d353fe143d266df045a69f94a8c185827f8 --- /dev/null +++ b/src/main/resources/static/css/localAuthorityPageStyle.css @@ -0,0 +1,16 @@ +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 diff --git a/src/main/resources/static/css/locationApprovalFormStyle.css b/src/main/resources/static/css/locationApprovalFormStyle.css index 99a2f8719b8877f881addd9e029a4562ed713399..e89a755a91fe9c31b0a42456a9cd2462bb9f07ea 100644 --- a/src/main/resources/static/css/locationApprovalFormStyle.css +++ b/src/main/resources/static/css/locationApprovalFormStyle.css @@ -1,7 +1,7 @@ -body{ - background: rgb(41, 41, 41); - color: wheat; -} +/*body{*/ +/* background: rgb(41, 41, 41);*/ +/* color: wheat;*/ +/*}*/ main { background-color: rgb(206, 153, 253); color: black; @@ -9,10 +9,12 @@ main { align-content: center; text-align: center; border-radius: 25px; - max-width: 620px; + max-width: 80vw; margin: 0 auto } - +.coordError{ + color:darkred; +} #formHeader{ padding-top: 10px; color:white; diff --git a/src/main/resources/static/css/mobile-style.css b/src/main/resources/static/css/mobile-style.css index 6be7d20cb2d472f85e42d7154c059181e13a0904..fb82181517d61574e146a036b480a5f108733634 100644 --- a/src/main/resources/static/css/mobile-style.css +++ b/src/main/resources/static/css/mobile-style.css @@ -157,6 +157,31 @@ and (max-device-width: 640px) { flex-direction: column; align-items: center; justify-content: flex-end; + + & ul { + list-style: none; + text-decoration: none; + + + & li { + display: flex; + align-items: center; + justify-content: center; + padding: 15px; + margin-block: 3px; + background-color: #1f1f1f; + border-radius: 20px; + text-decoration: none; + text-align: center; + + & a { + text-decoration: none; + font-weight: 600; + color: white; + font-size: 1.2em; + } + } + } } .rightFooter { @@ -170,6 +195,13 @@ and (max-device-width: 640px) { aspect-ratio: 1; } } + + button { + min-width: 15vw; + min-height: 4svh; + font-size: 1.5em; + } + } diff --git a/src/main/resources/templates/WorkWith/local-authorities.html b/src/main/resources/templates/WorkWith/local-authorities.html new file mode 100644 index 0000000000000000000000000000000000000000..abeb1a1143d7668fcff7e4108830fc789ed4a285 --- /dev/null +++ b/src/main/resources/templates/WorkWith/local-authorities.html @@ -0,0 +1,21 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="UTF-8"> + <title>Local Authorities</title> + <link rel="stylesheet" href="../../static/css/templatingstyle.css"> +</head> +<header th:insert="~{/fragments/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> + </div> + <footer th:insert="~{/fragments/Templating.html::footer}"></footer> +</body> +</html> \ No newline at end of file diff --git a/src/main/resources/templates/business-data.html b/src/main/resources/templates/business-data.html new file mode 100644 index 0000000000000000000000000000000000000000..4f40219afeb298551bf8bf35a94d8a742b7d577b --- /dev/null +++ b/src/main/resources/templates/business-data.html @@ -0,0 +1,45 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="UTF-8"> + <title>Businesses</title> + <link rel="stylesheet" th:href="@{css/landmarkFormStyle.css}"> + <link rel="stylesheet" th:href="@{css/mobile-style.css}"> +</head> + +<body> + <header th:replace="~{/fragments/banners::header}"></header> + <main> + <div id="container1"> + <h2>Enter your Business information</h2> + <form action="/businesses" id="data" name="data" method="post" th:object="${business}"> + <br> + <label>Enter your business + <input type="text" th:field="*{businessName}"> + </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> + </main> + + <div th:replace="~{fragments/banners :: footer}"></div> +</body> +</html> \ No newline at end of file diff --git a/src/main/resources/templates/businesses.html b/src/main/resources/templates/businesses.html new file mode 100644 index 0000000000000000000000000000000000000000..7a907227126c3fc39b42c320f205c02dc0e6a2c5 --- /dev/null +++ b/src/main/resources/templates/businesses.html @@ -0,0 +1,28 @@ +<!DOCTYPE html> +<html lang="en" xmlns:th="http://www.thymeleaf.org"> +<head> + <meta charset="UTF-8"> + <title>Businesses</title> + <link rel="stylesheet" th:href="@{css/landmarkFormStyle.css}"> + <link rel="stylesheet" th:href="@{css/mobile-style.css}"> +</head> + +<body> + <header th:replace="~{/fragments/banners::header}"></header> + + <main> + <p>A business is an organised establishment in a professional manner in order to achieve your particular aim for owning a business.</p> + <h3>Future Proof Businesses</h3> + <h3>Compete with Online Retailers</h3> + <h3>Drive Footfall to the high street</h3> + <h3>Increase Sales</h3> + <ul th:each="businesses:${busiSub}"> + <li th:text="${businesses}"></li> + </ul> + <button><a href="/businessSub" id="business">Businesses please enter here</a></button> + </main> + + <footer th:replace="~{fragments/banners :: footer}"></footer> +</body> + +</html> \ No newline at end of file diff --git a/src/main/resources/templates/fragments/banners.html b/src/main/resources/templates/fragments/banners.html index c336ba3b355e15647b108265ad760a7fc45e0c95..091aee122b74d0109c6e4c3fe90c4e528fc33a97 100644 --- a/src/main/resources/templates/fragments/banners.html +++ b/src/main/resources/templates/fragments/banners.html @@ -11,6 +11,9 @@ <li class="nav-li li-middle"> <a class="nav-links">FAQ</a> </li> + <li class="nav-li li-last"> + <a href="/dragonstale" class="nav-links">Dragon Tale</a> + </li> <li class="nav-li li-last" th:if="${#authentication.principal}==anonymousUser"> <a href="/login" class="nav-links">Log In</a> </li> @@ -36,6 +39,14 @@ </div> <div class="footer-div centerFooter"> <div class="footerText"> + <ul> + <li class="nav-li li-first"> + <a href="/local-authorities" class="nav-links">Local Authorities</a> + </li> + <li class="nav-li li-first"> + <a href="/businesses" class="nav-links">Local Businesses</a> + </li> + </ul> <h3>Follow Us</h3> <a href="https://www.facebook.com/VZTAsmarttowns/" class="icon"><img src="/images/icons/Facebook.png" height="25" width="25" alt="Facebook Logo" class="icon"/></a> <a href="https://www.twitter.com/VZTAsmarttowns/" class="icon"><img src="/images/icons/Twitter.jpg" height="25" width="25" alt="X (formally Twitter) Logo" class="icon"/></a> diff --git a/src/main/resources/templates/fragments/trailsPageFrags.html b/src/main/resources/templates/fragments/trailsPageFrags.html index 9a62be17086ae209a7b3c372e8edacc0992713ed..56dafa2180b9e6b2be30cfa82966a57d261ad4c3 100644 --- a/src/main/resources/templates/fragments/trailsPageFrags.html +++ b/src/main/resources/templates/fragments/trailsPageFrags.html @@ -93,7 +93,6 @@ </div> </div> <H3>Checkpoints:</H3> -<!-- With the trial name, we go through locations list to get --> <div th:each="location:${locations}" > <div> <li id="checkpointList"> diff --git a/src/main/resources/templates/landmarks/locationApprovalFormTh.html b/src/main/resources/templates/landmarks/locationApprovalFormTh.html index eb8c45db5cebcf1f755f1aecdc29f5cb98b98495..df465b669fa5b2b12b5fbeed252ea32c0b26e4b8 100644 --- a/src/main/resources/templates/landmarks/locationApprovalFormTh.html +++ b/src/main/resources/templates/landmarks/locationApprovalFormTh.html @@ -4,21 +4,21 @@ <meta charset="UTF-8"> <title>Title</title> - <link rel="stylesheet" th:href="@{css/templatingstyle.css}"> + <link rel="stylesheet" th:href="@{css/mobile-style.css}"> <link rel="stylesheet" th:href="@{css/locationApprovalFormStyle.css}"> <script src="/scripts/locationApprovalForm.js"></script> </head> <body> -<header th:insert="~{/fragments/Templating.html :: header}"></header> +<header th:insert="~{/fragments/banners.html :: header}"></header> <hr style="height:20px; visibility:hidden;" /> <main> <H1 id="formHeader">Locations To Be Approved:</H1> <form action="/checkpointSubmitted" method="post" id="adminCheckpointApproval" name="adminCheckpointApproval" th:object="${locationCoord}" onsubmit="return acceptanceValidation()"> <label> Location: - <select th:object="${location}" th:field="*{locationName}"}> + <select th:object="${location}" th:field="*{locationName}"> <!-- <select th:field="*{locationName}">--> <option value="" hidden="true">Select Location</option> <option value="" selected disabled>Select Location</option> @@ -27,14 +27,13 @@ </select> </label> <br><br> + <div th:if="${param.error}" class="coordError">Invalid Coordinates entered.</div> <label> Location Latitude: <input type="text" th:field="*{locationCoordsLat}" placeholder="Latitude Here"> - <div th:errors="*{locationCoordsLat}" th:if="${#fields.hasErrors('locationCoordsLat')}">ErrorlocationCoordsLat</div> <br><br> <label> Location Longitude: - <input type="text" th:field="*{locationCoordsLong}" placeholder="Latitude Here"> + <input type="text" th:field="*{locationCoordsLong}" placeholder="Longitude Here"> </label><br><br> - <div th:errors="*{locationCoordsLong}" th:if="${#fields.hasErrors('locationCoordsLong')}">ErrorlocationCoordsLat</div> <input type="submit"> </form> @@ -67,6 +66,6 @@ <hr style="height:20px; visibility:hidden;" /> </main> -<footer th:insert="~{/fragments/Templating.html :: footer}"></footer> +<footer th:insert="~{/fragments/banners.html :: footer}"></footer> </body> </html> \ No newline at end of file diff --git a/src/main/resources/templates/local-auth-data.html b/src/main/resources/templates/local-auth-data.html new file mode 100644 index 0000000000000000000000000000000000000000..1ca493deda18618eab5e00a5dab24facf1ae239f --- /dev/null +++ b/src/main/resources/templates/local-auth-data.html @@ -0,0 +1,44 @@ +<!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/mobile-style.css}"> +</head> +<header th:replace="~{/fragments/banners::header}"></header> +<body> + <main> + <div id="container1"> + <h2>Enter your Local authority</h2> + <form action="/local-authorities" 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> + </main> +</body> +<footer th:replace="~{/fragments/banners::footer}"></footer> +</html> \ No newline at end of file diff --git a/src/main/resources/templates/local-authorities.html b/src/main/resources/templates/local-authorities.html new file mode 100644 index 0000000000000000000000000000000000000000..9b58b057f103bed95204d54998f5fd6acb5444c0 --- /dev/null +++ b/src/main/resources/templates/local-authorities.html @@ -0,0 +1,24 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="UTF-8"> + <title>Local Authorities</title> + <link rel="stylesheet" th:href="@{css/localAuthorityPageStyle.css}"> + <link rel="stylesheet" th:href="@{css/mobile-style.css}"> +</head> + +<body> + <header th:replace="fragments/banners :: header"></header> + <main> + <h1>Local Authorities</h1> + <div id="councils"> + <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> + + </main> + <footer th:replace="fragments/banners :: footer"></footer> +</body> +</html> \ No newline at end of file diff --git a/src/main/resources/templates/towns/home/mobile-homepage.html b/src/main/resources/templates/towns/home/mobile-homepage.html index 43da82f7201b96bd66ab76381a4d450bc2a0ddb2..480cf57421e2066572bb8139b953876a582c66d6 100644 --- a/src/main/resources/templates/towns/home/mobile-homepage.html +++ b/src/main/resources/templates/towns/home/mobile-homepage.html @@ -13,7 +13,9 @@ <div class="title-container"> <h1 class="title">Welcome to VZTA Smart Towns!</h1> <a class="submitLand" href="/landmarkSubmission"> <button> Submit Landmark!</button></a> + <a th:if="${#authentication.getName().equals('Admin')}" class="reviewLand" href="/checkpointApproval"> <button> Review Landmark!</button></a> <p class="small-text">Choose your town and start tracking your trails!</p> + </div> <article class="towns-wrapper"> diff --git a/src/test/java/Team5/SmartTownsOld/DataSourceConfigahhhh.java b/src/test/java/Team5/SmartTownsOld/DataSourceConfig.java similarity index 100% rename from src/test/java/Team5/SmartTownsOld/DataSourceConfigahhhh.java rename to src/test/java/Team5/SmartTownsOld/DataSourceConfig.java