Browse Source

added new files to hide the urls dynamically getting pages without switch case

master
AJITHKUMAR12 11 months ago
parent
commit
22711ce3f6
  1. 293
      src/main/java/com/gcc/coworkspace/controller/controller.java
  2. 13
      src/main/resources/templates/caretaker/login.html
  3. 20
      src/main/resources/templates/user/book-Conferance.html
  4. 26
      src/main/resources/templates/user/book-reading.html
  5. 260
      src/main/resources/templates/user/book-workdesk.html
  6. 72
      src/main/resources/templates/user/home.html
  7. 39
      src/main/resources/templates/user/workspacelist.html

293
src/main/java/com/gcc/coworkspace/controller/controller.java

@ -11,6 +11,7 @@ import org.springframework.core.env.Environment;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.Model; import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
@ -180,18 +181,103 @@ public String viewWorkspaceList(Model model) {
// } // }
@GetMapping("/home") @GetMapping("/home")
public String viewHome(@RequestParam int bid,
public String viewHomeGet(@RequestParam(value = "bid", required = false) Integer bid,
@RequestParam(value = "cid", required = false) Integer cidParam, @RequestParam(value = "cid", required = false) Integer cidParam,
Model model) { Model model) {
if (bid == null) {
return "redirect:/muthalvarpadaippagam"; // or show error page
}
return loadHomePage(bid, cidParam, model);
}
// POST – used by hidden form (no URL params visible!)
@PostMapping("/home")
public String viewHomePost(@RequestParam int bid,
@RequestParam(value = "cid", required = false) Integer cidParam,
Model model) {
return loadHomePage(bid, cidParam, model);
}
// previously used
// @GetMapping("/home")
// public String viewHome(@RequestParam int bid,
// @RequestParam(value = "cid", required = false) Integer cidParam,
// Model model) {
// // ✅ Get coworking spaces for this building
// List<Map<String, Object>> spaces = homeService.getActiveCoWorkingSpacesByBuilding(bid);
// //System.out.println("home inside:" + spaces);
// // Remove duplicate category rows (keep first per cid)
// spaces = spaces.stream()
// .collect(Collectors.toMap(
// m -> (Integer) m.get("cid"),
// m -> m,
// (existing, replacement) -> existing
// ))
// .values()
// .stream()
// .toList();
// // ✅ Default CID → first space of that building
// Integer cid = (cidParam != null)
// ? cidParam
// : (spaces.isEmpty() ? null : (Integer) spaces.get(0).get("cid"));
// // ✅ Get subcategory (pricing/capacity) details for this category
// /*List<Map<String, Object>> pricingDetails = (cid != null)
// ? homeService.getPricingDetailsByCid(cid)
// : List.of();*/
// List<Map<String, Object>> readingZoneDetails = homeService.getPricingDetailsByCid(cid);
// List<Map<String, Object>> deskSpaceDetails = homeService.getPricingDetailsByCid(cid);
// List<Map<String, Object>> conferenceHallDetails = homeService.getPricingDetailsByCid(cid);
// // ✅ Get category images for this category
// List<Map<String, Object>> homeImg = (cid != null)
// ? homeService.getImgByCid(cid)
// : List.of();
// // ✅ Identify the selected space
// Map<String, Object> selectedSpace = spaces.stream()
// .filter(space -> cid != null && cid.equals(space.get("cid")))
// .findFirst()
// .orElse(null);
// //ak
// ✅ Get coworking spaces for this building
List<Map<String, Object>> spaces = homeService.getActiveCoWorkingSpacesByBuilding(bid);
//System.out.println("home inside:" + spaces);
// // ✅ Add everything to model
// model.addAttribute("bid", bid);
// model.addAttribute("cid", cid);
// model.addAttribute("spaces", spaces);
// System.out.println("spaces:" + spaces);
// model.addAttribute("selectedSpace", selectedSpace);
// //model.addAttribute("pricingDetails", pricingDetails);
// model.addAttribute("readingZoneDetails", readingZoneDetails);
// model.addAttribute("deskSpaceDetails", deskSpaceDetails);
// model.addAttribute("conferenceHallDetails", conferenceHallDetails);
// model.addAttribute("homeImg", homeImg);
// return "user/home";
// }
// Remove duplicate category rows (keep first per cid)
// 🔥 Reusable method
private String loadHomePage(int bid, Integer cidParam, Model model) {
// Get coworking spaces for this building
List<Map<String, Object>> spaces = homeService.getActiveCoWorkingSpacesByBuilding(bid);
// Remove duplicate CIDs
spaces = spaces.stream() spaces = spaces.stream()
.collect(Collectors.toMap( .collect(Collectors.toMap(
m -> (Integer) m.get("cid"), m -> (Integer) m.get("cid"),
@ -201,48 +287,39 @@ spaces = spaces.stream()
.values() .values()
.stream() .stream()
.toList(); .toList();
// ✅ Default CID → first space of that building
// Default CID
Integer cid = (cidParam != null) Integer cid = (cidParam != null)
? cidParam ? cidParam
: (spaces.isEmpty() ? null : (Integer) spaces.get(0).get("cid")); : (spaces.isEmpty() ? null : (Integer) spaces.get(0).get("cid"));
// ✅ Get subcategory (pricing/capacity) details for this category
/*List<Map<String, Object>> pricingDetails = (cid != null)
? homeService.getPricingDetailsByCid(cid)
: List.of();*/
// Pricing details
List<Map<String, Object>> readingZoneDetails = homeService.getPricingDetailsByCid(cid); List<Map<String, Object>> readingZoneDetails = homeService.getPricingDetailsByCid(cid);
List<Map<String, Object>> deskSpaceDetails = homeService.getPricingDetailsByCid(cid); List<Map<String, Object>> deskSpaceDetails = homeService.getPricingDetailsByCid(cid);
List<Map<String, Object>> conferenceHallDetails = homeService.getPricingDetailsByCid(cid); List<Map<String, Object>> conferenceHallDetails = homeService.getPricingDetailsByCid(cid);
// ✅ Get category images for this category
// Images
List<Map<String, Object>> homeImg = (cid != null) List<Map<String, Object>> homeImg = (cid != null)
? homeService.getImgByCid(cid) ? homeService.getImgByCid(cid)
: List.of(); : List.of();
// ✅ Identify the selected space
// Selected category
Map<String, Object> selectedSpace = spaces.stream() Map<String, Object> selectedSpace = spaces.stream()
.filter(space -> cid != null && cid.equals(space.get("cid"))) .filter(space -> cid != null && cid.equals(space.get("cid")))
.findFirst() .findFirst()
.orElse(null); .orElse(null);
//ak
// ✅ Add everything to model
// Add to model
model.addAttribute("bid", bid); model.addAttribute("bid", bid);
model.addAttribute("cid", cid); model.addAttribute("cid", cid);
model.addAttribute("spaces", spaces); model.addAttribute("spaces", spaces);
System.out.println("spaces:" + spaces);
model.addAttribute("selectedSpace", selectedSpace); model.addAttribute("selectedSpace", selectedSpace);
//model.addAttribute("pricingDetails", pricingDetails);
model.addAttribute("readingZoneDetails", readingZoneDetails); model.addAttribute("readingZoneDetails", readingZoneDetails);
model.addAttribute("deskSpaceDetails", deskSpaceDetails); model.addAttribute("deskSpaceDetails", deskSpaceDetails);
model.addAttribute("conferenceHallDetails", conferenceHallDetails); model.addAttribute("conferenceHallDetails", conferenceHallDetails);
model.addAttribute("homeImg", homeImg); model.addAttribute("homeImg", homeImg);
return "user/home";
return "user/home"; // Thymeleaf view
} }
//ak //ak
@ -529,59 +606,183 @@ public String getSpaceFragment(@RequestParam("cid") Integer cid,
//////////existing code for /book with subId handling
// @GetMapping("/book")
// public String getCategoryPageGet(@RequestParam(value = "buildingId", required = false) Integer buildingId,
// @RequestParam(value = "categoryId", required = false) Integer categoryId,
// @RequestParam(value = "subId", required = false) Integer subId,
// Model model) {
// // Validate required fields
// if (buildingId == null || categoryId == null) {
// return "redirect:/muthalvarpadaippagam"; // Return home safely
// }
// return showCategoryPage(buildingId, categoryId, subId, model);
// }
// //added by yogi
// @PostMapping("/book")
// public String showCategoryPagePost(@RequestParam int buildingId,
// @RequestParam int categoryId,
// @RequestParam(required = false) Integer subId,
// Model model) {
// return showCategoryPage(buildingId, categoryId, subId, model);
// }
// @GetMapping("/book")
// public String showCategoryPage(@RequestParam int buildingId,
// @RequestParam int categoryId,
// @RequestParam(required = false) Integer subId,
// Model model) {
// // System.out.println("buildingId:" + buildingId);
// // System.out.println("categoryId:" + categoryId);
// List<Map<String, Object>> buildingCategoryDetails =
// buildingSer.getBuildingCategoryDetailsById(buildingId, categoryId);
// //System.out.println("buildingCategoryDetails:" + buildingCategoryDetails);
// model.addAttribute("homeImg", homeService.getImgByCid(categoryId));
// if (!buildingCategoryDetails.isEmpty()) {
// Map<String, Object> firstRecord = buildingCategoryDetails.get(0);
// model.addAttribute("details", firstRecord);
// //ak
// Object buildingName = firstRecord.get("Building_Name");
// Object buildingAddress = firstRecord.get("Address");
// Object latitude = firstRecord.get("Latitude");
// Object longitude = firstRecord.get("Longitude");
// model.addAttribute("buildingName", buildingName);
// model.addAttribute("buildingAddress", buildingAddress);
// model.addAttribute("latitude", latitude);
// model.addAttribute("longitude", longitude);
// // ✅ Prefer URL parameter subId, else fallback from DB
// if (subId == null) {
// Object scidObj = firstRecord.get("scid");
// subId = (scidObj != null) ? Integer.parseInt(scidObj.toString()) : 0;
// }
// model.addAttribute("subId", subId);
// System.out.println("SubId: " + subId);
// }
// model.addAttribute("buildingId", buildingId);
// model.addAttribute("categoryId", categoryId);
// String url = switch (categoryId) {
// case 1 -> "user/book-reading";
// case 2 -> "user/book-workdesk";
// case 3 -> "user/book-Conferance";
// case 4 -> "user/book-reading";
// default -> throw new IllegalArgumentException("Invalid category ID: " + categoryId);
// };
// return url;
// }
// --------------------- GET : Visible URL ---------------------
@GetMapping("/book") @GetMapping("/book")
public String showCategoryPage(@RequestParam int buildingId,
@RequestParam int categoryId,
public String getCategoryPage(@RequestParam(value = "buildingId" ,required = false) Integer buildingId,
@RequestParam(value = "categoryId", required = false) Integer categoryId,
@RequestParam(value = "subId", required = false) Integer subId, Model model) {
// Validate required fields
if (buildingId == null || categoryId == null) {
return "redirect:/muthalvarpadaippagam";
}
return showCategoryPage(buildingId, categoryId, subId, model);
}
// --------------------- POST : Hidden Form (no URL params) ---------------------
@PostMapping("/book")
public String postCategoryPage(@RequestParam Integer buildingId,
@RequestParam Integer categoryId,
@RequestParam(required = false) Integer subId, @RequestParam(required = false) Integer subId,
Model model) { Model model) {
// System.out.println("buildingId:" + buildingId);
// System.out.println("categoryId:" + categoryId);
return showCategoryPage(buildingId, categoryId, subId, model);
}
// --------------------- COMMON LOADING METHOD ---------------------
private String showCategoryPage(int buildingId,
int categoryId,
Integer subId,
Model model) {
List<Map<String, Object>> buildingCategoryDetails = List<Map<String, Object>> buildingCategoryDetails =
buildingSer.getBuildingCategoryDetailsById(buildingId, categoryId); buildingSer.getBuildingCategoryDetailsById(buildingId, categoryId);
//System.out.println("buildingCategoryDetails:" + buildingCategoryDetails);
model.addAttribute("homeImg", homeService.getImgByCid(categoryId)); model.addAttribute("homeImg", homeService.getImgByCid(categoryId));
String displayName = null;
if (!buildingCategoryDetails.isEmpty()) { if (!buildingCategoryDetails.isEmpty()) {
Map<String, Object> firstRecord = buildingCategoryDetails.get(0); Map<String, Object> firstRecord = buildingCategoryDetails.get(0);
displayName = (String) firstRecord.get("Category_Display_Name");
model.addAttribute("details", firstRecord); model.addAttribute("details", firstRecord);
//ak
Object buildingName = firstRecord.get("Building_Name");
Object buildingAddress = firstRecord.get("Address");
Object latitude = firstRecord.get("Latitude");
Object longitude = firstRecord.get("Longitude");
model.addAttribute("buildingName", buildingName);
model.addAttribute("buildingAddress", buildingAddress);
model.addAttribute("latitude", latitude);
model.addAttribute("longitude", longitude);
model.addAttribute("buildingName", firstRecord.get("Building_Name"));
model.addAttribute("buildingAddress", firstRecord.get("Address"));
model.addAttribute("latitude", firstRecord.get("Latitude"));
model.addAttribute("longitude", firstRecord.get("Longitude"));
// ✅ Prefer URL parameter subId, else fallback from DB
// If subId is not passed, get from DB
if (subId == null) { if (subId == null) {
Object scidObj = firstRecord.get("scid"); Object scidObj = firstRecord.get("scid");
subId = (scidObj != null) ? Integer.parseInt(scidObj.toString()) : 0; subId = (scidObj != null) ? Integer.parseInt(scidObj.toString()) : 0;
} }
model.addAttribute("subId", subId); model.addAttribute("subId", subId);
System.out.println("SubId: " + subId);
} }
model.addAttribute("buildingId", buildingId); model.addAttribute("buildingId", buildingId);
model.addAttribute("categoryId", categoryId); model.addAttribute("categoryId", categoryId);
String url = switch (categoryId) {
case 1 -> "user/book-reading";
case 2 -> "user/book-workdesk";
case 3 -> "user/book-Conferance";
case 4 -> "user/book-reading";
default -> throw new IllegalArgumentException("Invalid category ID: " + categoryId);
};
// Select page by category
// return switch (categoryId) {
// case 1 -> "user/book-reading";
// case 2 -> "user/book-workdesk";
// case 3 -> "user/book-Conferance";
// case 4 -> "user/book-reading";
// default -> throw new IllegalArgumentException("Invalid category ID: " + categoryId);
// };
return url;
if (displayName == null) {
throw new IllegalArgumentException("Category name not found");
} }
String url = switch (displayName.trim()) {
case "Meeting Rooms" -> "user/book-Conferance";
case "Learning Centre" -> "user/book-reading";
case "Desk Space" -> "user/book-workdesk";
default -> throw new IllegalArgumentException("Unknown Category Name: " + displayName);
};
return url;
}

13
src/main/resources/templates/caretaker/login.html

@ -139,7 +139,8 @@ function login() {
} else { } else {
// If login is successful, redirect // If login is successful, redirect
//redirectToDashboard(response); //redirectToDashboard(response);
redirectToDashboard(response.user_name, response.bid);
// redirectToDashboard(response.user_name, response.bid);
window.location.href = "/muthalvarpadaippagam/Dashboard";
} }
}).fail(function (jqXHR) { }).fail(function (jqXHR) {
// Handle AJAX errors based on status // Handle AJAX errors based on status
@ -148,9 +149,9 @@ function login() {
} else if (jqXHR.status === 417) { } else if (jqXHR.status === 417) {
// Show SweetAlert for unexpected errors // Show SweetAlert for unexpected errors
Swal.fire({ Swal.fire({
icon: 'error',
title: 'Error',
text: jqXHR.responseText,
icon: 'info',
title: 'info',
text: 'Invalid Username or Password. Please enter the correct details!',
}); });
} else { } else {
console.error(jqXHR); console.error(jqXHR);
@ -176,7 +177,7 @@ function login() {
// added by yogi // added by yogi
function redirectToDashboard(userName, bid) {
/* function redirectToDashboard(userName, bid) {
//console.log("Logged in user:", userName); //console.log("Logged in user:", userName);
//console.log("User BID:", bid); //console.log("User BID:", bid);
@ -190,7 +191,7 @@ function login() {
default: default:
console.error("Invalid user:", userName); console.error("Invalid user:", userName);
} }
}
}*/
</script> </script>
</body> </body>

20
src/main/resources/templates/user/book-Conferance.html

@ -273,7 +273,9 @@
<button type="button" id="viewBuildingBtn" class="btn btn-primary">Change</button> <button type="button" id="viewBuildingBtn" class="btn btn-primary">Change</button>
</div> </div>
<input type="hidden" id="buildingId" th:value="${buildingId}">
<input type="hidden" id="categoryId" th:value="${categoryId}">
<input type="hidden" id="subId" th:value="${subId}">
<!-- Date Picker --> <!-- Date Picker -->
<div class="row mb-3"> <div class="row mb-3">
<label style="font-weight:bold;" for="selectDate" class="col-sm-4 col-form-label text-end">Select Date :</label> <label style="font-weight:bold;" for="selectDate" class="col-sm-4 col-form-label text-end">Select Date :</label>
@ -521,10 +523,15 @@
const bookedSlots = ['9:00 AM', '6:00 PM', '8:00 PM']; // Sample booked slots, will show in red const bookedSlots = ['9:00 AM', '6:00 PM', '8:00 PM']; // Sample booked slots, will show in red
const urlParams = new URLSearchParams(window.location.search);
const catId = urlParams.get('categoryId');
const buildId = urlParams.get('buildingId');
const subId = urlParams.get('subId');
// const urlParams = new URLSearchParams(window.location.search);
// const catId = urlParams.get('categoryId');
// const buildId = urlParams.get('buildingId');
// const subId = urlParams.get('subId');
const buildId = document.getElementById("#buildingId")
const catId = document.getElementById("#categoryId")
let subId = document.getElementById("#subId")
// console.log("Category ID:", catId); // console.log("Category ID:", catId);
// console.log("Building ID:", buildId); // console.log("Building ID:", buildId);
@ -723,6 +730,9 @@
let name = $('#personName').val(); let name = $('#personName').val();
let phone = $('#personPhone').val(); let phone = $('#personPhone').val();
let fromDate = $('#selectDate').val(); // Ensure this is a different element let fromDate = $('#selectDate').val(); // Ensure this is a different element
let subId = $('#subId').val();
let buildId = $('#buildingId').val();
let catId = $('#categoryId').val();
let toDate = $('#selectDate').val(); // Ensure this is a different element let toDate = $('#selectDate').val(); // Ensure this is a different element
let selectedSlot = $('#selectedSlot').val(); let selectedSlot = $('#selectedSlot').val();
let noOfPeople = $('#numSeats').val(); let noOfPeople = $('#numSeats').val();

26
src/main/resources/templates/user/book-reading.html

@ -472,14 +472,17 @@
// Read URL parameters // Read URL parameters
const urlParams = new URLSearchParams(window.location.search);
const catId = urlParams.get('categoryId');
const buildId = urlParams.get('buildingId');
let subId = urlParams.get('subId');
// const urlParams = new URLSearchParams(window.location.search);
// const catId = urlParams.get('categoryId');
// const buildId = urlParams.get('buildingId');
// let subId = urlParams.get('subId');
const buildId = document.getElementById("#buildingId")
const catId = document.getElementById("#categoryId")
let subId = document.getElementById("#subId")
// console.log("Category ID:", catId);
// console.log("Building ID:", buildId);
// console.log("Sub ID:", subId);
let slots =[]; let slots =[];
@ -641,6 +644,7 @@ function loadTimeSlots(selectedDate) {
} }
return isValid; return isValid;
} }
function saveBooking() { function saveBooking() {
// console.log(catId); // console.log(catId);
@ -667,6 +671,9 @@ function loadTimeSlots(selectedDate) {
let name = $('#personName').val(); let name = $('#personName').val();
let phone = $('#personPhone').val(); let phone = $('#personPhone').val();
let fromDate = $('#selectDate').val(); // Ensure this is a different element let fromDate = $('#selectDate').val(); // Ensure this is a different element
let subId = $('#subId').val();
let buildId = $('#buildingId').val();
let catId = $('#categoryId').val();
let toDate = $('#selectDate').val(); // Ensure this is a different element let toDate = $('#selectDate').val(); // Ensure this is a different element
let selectedSlot = $('#selectedSlot').val(); let selectedSlot = $('#selectedSlot').val();
let noOfPeople = $('#numSeats').val(); let noOfPeople = $('#numSeats').val();
@ -722,6 +729,11 @@ function loadTimeSlots(selectedDate) {
}); });
} }
//date valisdation //date valisdation
/* $(document).ready(function () { /* $(document).ready(function () {

260
src/main/resources/templates/user/book-workdesk.html

@ -1,5 +1,6 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml"> <html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head th:replace="~{fragments/user-head :: head}"></head> <head th:replace="~{fragments/user-head :: head}"></head>
<header th:replace="~{user/razor-pay :: header}"></header> <header th:replace="~{user/razor-pay :: header}"></header>
@ -14,7 +15,8 @@
.radio-button { .radio-button {
padding: 10px 20px; padding: 10px 20px;
margin: 5px; /* Adds space between buttons */
margin: 5px;
/* Adds space between buttons */
border: 1px solid #007bff; border: 1px solid #007bff;
border-radius: 5px; border-radius: 5px;
cursor: pointer; cursor: pointer;
@ -51,21 +53,26 @@
background-color: #f0f0f0; background-color: #f0f0f0;
padding: 10px; padding: 10px;
} }
.time-slot-box.booked { .time-slot-box.booked {
border-color: red; border-color: red;
color: red; color: red;
cursor: not-allowed; cursor: not-allowed;
} }
.time-slot-box.available { .time-slot-box.available {
border-color: green; border-color: green;
color: green; color: green;
} }
.time-slot-box input[type="radio"] { .time-slot-box input[type="radio"] {
display: none; display: none;
} }
.time-slot-box:hover { .time-slot-box:hover {
background-color: #e0e0e0; background-color: #e0e0e0;
} }
#timeSlots { #timeSlots {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
@ -115,6 +122,7 @@
-webkit-transition: all ease-in 0.3s; -webkit-transition: all ease-in 0.3s;
transition: all ease-in 0.3s; transition: all ease-in 0.3s;
} }
.btn-primary2.active { .btn-primary2.active {
background-color: #E29D25 !important; background-color: #E29D25 !important;
color: #FFF; color: #FFF;
@ -145,11 +153,13 @@
0% { 0% {
transform: translateX(100%); transform: translateX(100%);
} }
100% { 100% {
transform: translateX(-100%); transform: translateX(-100%);
} }
} }
</style> </style>
<body> <body>
<!-- Pre-loader start --> <!-- Pre-loader start -->
<div th:replace="~{fragments/preloader :: div}"></div> <div th:replace="~{fragments/preloader :: div}"></div>
@ -175,7 +185,8 @@
<div class="d-inline"> <div class="d-inline">
<h4 style="font-weight:bold;">Book Desk Space</h4> <h4 style="font-weight:bold;">Book Desk Space</h4>
<!--<span class="address">Jeganathan street, Agaram, Chennai - 600082</span>--> <!--<span class="address">Jeganathan street, Agaram, Chennai - 600082</span>-->
<span class="address" th:text="${buildingAddress}">Address not available</span>
<span class="address" th:text="${buildingAddress}">Address not
available</span>
</div> </div>
</div> </div>
</div> </div>
@ -211,49 +222,79 @@
<div class="scrolling-text"><span>Loading announcement...</span></div> <div class="scrolling-text"><span>Loading announcement...</span></div>
<input type="hidden" id="buildingId" th:value="${buildingId}">
<input type="hidden" id="categoryId" th:value="${categoryId}">
<input type="hidden" id="subId" th:value="${subId}">
<div class="row" id="conferenceHallDiv" style="border-radius: 10px; margin:0px;"> <div class="row" id="conferenceHallDiv" style="border-radius: 10px; margin:0px;">
<div class="col-lg-12 col-sm-12"> <div class="col-lg-12 col-sm-12">
<div style="border: 1px solid rgba(0, 0, 0, .1); border-radius: 10px; padding: 20px; margin-top: 20px;">
<div
style="border: 1px solid rgba(0, 0, 0, .1); border-radius: 10px; padding: 20px; margin-top: 20px;">
<form id="conferenceHallForm"> <form id="conferenceHallForm">
<div class="row"> <div class="row">
<div class="col-lg-6 col-sm-0" style="padding:0px;"> <div class="col-lg-6 col-sm-0" style="padding:0px;">
<!--photo grid start--> <!--photo grid start-->
<div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel">
<div id="carouselExampleIndicators" class="carousel slide"
data-ride="carousel">
<ol class="carousel-indicators"> <ol class="carousel-indicators">
<!-- <li data-target="#carouselExampleIndicators" data-slide-to="0" class="active"></li> <!-- <li data-target="#carouselExampleIndicators" data-slide-to="0" class="active"></li>
<li data-target="#carouselExampleIndicators" data-slide-to="1"></li> <li data-target="#carouselExampleIndicators" data-slide-to="1"></li>
<li data-target="#carouselExampleIndicators" data-slide-to="2"></li> --> <li data-target="#carouselExampleIndicators" data-slide-to="2"></li> -->
<li th:each="homeImg, iterStat : ${homeImg}" class=""
th:classappend="${iterStat.index == 0} ? ' active'" data-target="#carouselExampleIndicators" th:data-slide-to="${iterStat.index}">
<li th:each="homeImg, iterStat : ${homeImg}"
class=""
th:classappend="${iterStat.index == 0} ? ' active'"
data-target="#carouselExampleIndicators"
th:data-slide-to="${iterStat.index}">
</li> </li>
</ol> </ol>
<div class="carousel-inner"> <div class="carousel-inner">
<div th:each="homeImg, iterStat : ${homeImg}" class="carousel-item"
<div th:each="homeImg, iterStat : ${homeImg}"
class="carousel-item"
th:classappend="${iterStat.index == 0} ? ' active'"> th:classappend="${iterStat.index == 0} ? ' active'">
<img style="border-radius:15px;" class="d-block w-100" th:src="${homeImg.imageurl}" width="100%" alt="Slide Image">
<img style="border-radius:15px;"
class="d-block w-100"
th:src="${homeImg.imageurl}" width="100%"
alt="Slide Image">
</div> </div>
<!-- <div class="carousel-caption"> <!-- <div class="carousel-caption">
Welcome to Desk Space Welcome to Desk Space
</div> --> </div> -->
</div> </div>
<a class="carousel-control-prev" href="#carouselExampleIndicators"
role="button" data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<a class="carousel-control-prev"
href="#carouselExampleIndicators" role="button"
data-slide="prev">
<span class="carousel-control-prev-icon"
aria-hidden="true"></span>
<span class="sr-only">Previous</span> <span class="sr-only">Previous</span>
</a> </a>
<a class="carousel-control-next" href="#carouselExampleIndicators"
role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<a class="carousel-control-next"
href="#carouselExampleIndicators" role="button"
data-slide="next">
<span class="carousel-control-next-icon"
aria-hidden="true"></span>
<span class="sr-only">Next</span> <span class="sr-only">Next</span>
</a> </a>
</div> </div>
<!-- Photo Grid End--> <!-- Photo Grid End-->
</div> </div>
<div class="col-lg-6 col-sm-12 justify-content-center align-items-center">
<div
class="col-lg-6 col-sm-12 justify-content-center align-items-center">
<!-- Enter Details --> <!-- Enter Details -->
<h5 class="mb-3" style="color:#E29D25">Select Your Preference:</h5>
<!-- <h5 class="mb-3" style="color:#E29D25">Select Your Preference: <button id="backBtn" class="btn btn-sm btn-outline-primary">Back </button></h5> -->
<div class="d-flex justify-content-between align-items-center mb-3">
<h5 class="mb-0" style="color:#E29D25">Select Your Preference:</h5>
<button id="backBtn" class="btn btn-sm btn-outline-primary">Back</button>
</div>
<div class="mb-3 row"> <div class="mb-3 row">
<label style="font-weight:bold;" for="numSeats" class="col-sm-12 col-md-4 col-form-label"><strong>Number of Seats :</strong></label>
<label style="font-weight:bold;" for="numSeats"
class="col-sm-12 col-md-4 col-form-label"><strong>Number
of Seats :</strong></label>
<div class="col-sm-6 col-md-6"> <div class="col-sm-6 col-md-6">
<select class="form-control" id="numSeats"> <select class="form-control" id="numSeats">
<option value="1">1 Seat</option> <option value="1">1 Seat</option>
@ -277,41 +318,60 @@
</div> </div>
</div>--> </div>-->
<div class="mb-3 row align-items-center"> <div class="mb-3 row align-items-center">
<label for="buildingname" class="col-sm-4 col-form-label text-end fw-semibold" style="font-weight:bold;">
<label for="buildingname"
class="col-sm-4 col-form-label text-end fw-semibold"
style="font-weight:bold;">
Location : Location :
</label> </label>
<div class="col-sm-6 d-flex align-items-center"> <div class="col-sm-6 d-flex align-items-center">
<input type="text" id="buildingname" class="form-control"
th:value="${buildingName}" readonly> <br>
<input type="text" id="buildingname"
class="form-control" th:value="${buildingName}"
readonly> <br>
</div> </div>
<button type="button" id="viewBuildingBtn" class="btn btn-primary">Change</button>
<button type="button" id="viewBuildingBtn"
class="btn btn-primary">Change</button>
</div> </div>
<!-- Date Picker --> <!-- Date Picker -->
<div class="row mb-3"> <div class="row mb-3">
<label style="font-weight:bold;" for="selectDate" class="col-sm-4 col-form-label text-end">Select Date :</label>
<label style="font-weight:bold;" for="selectDate"
class="col-sm-4 col-form-label text-end">Select Date
:</label>
<div class="col-sm-6"> <div class="col-sm-6">
<!-- <input type="date" class="form-control" id="selectDate" onchange="loadTimeSlots()"> --> <!-- <input type="date" class="form-control" id="selectDate" onchange="loadTimeSlots()"> -->
<input class="form-control" id="selectDate" type="text" placeholder="Select a date " readonly >
<input class="form-control" id="selectDate"
type="text" placeholder="Select a date "
readonly>
</div> </div>
</div> </div>
<!-- Time Slots --> <!-- Time Slots -->
<div class="row mb-3"> <div class="row mb-3">
<label style="font-weight:bold;" class="col-sm-4 col-form-label text-end">Seat required for :</label>
<label style="font-weight:bold;"
class="col-sm-4 col-form-label text-end">Seat
required for :</label>
<div class="col-sm-8"> <div class="col-sm-8">
<div id="seatfor" class="d-flex flex-wrap"> <div id="seatfor" class="d-flex flex-wrap">
<div class="btn-group" data-toggle="buttons"> <div class="btn-group" data-toggle="buttons">
<label class="btn btn-primary2 me-2 mb-2" style="margin: 5px;">
<input type="radio" name="booking_type" id="booking_type" autocomplete="off" value="2"> Half Day
<label class="btn btn-primary2 me-2 mb-2"
style="margin: 5px;">
<input type="radio" name="booking_type"
id="booking_type" autocomplete="off"
value="2"> Half Day
</label> </label>
<label class="btn btn-primary2 me-2 mb-2" style="margin: 5px;">
<input type="radio" name="booking_type" id="booking_type" autocomplete="off" value="3"> Full Day
<label class="btn btn-primary2 me-2 mb-2"
style="margin: 5px;">
<input type="radio" name="booking_type"
id="booking_type" autocomplete="off"
value="3"> Full Day
</label> </label>
<label class="btn btn-primary2 mb-2" style="margin: 5px;">
<input type="radio" name="booking_type" id="booking_type" autocomplete="off" value="4"> Month
<label class="btn btn-primary2 mb-2"
style="margin: 5px;">
<input type="radio" name="booking_type"
id="booking_type" autocomplete="off"
value="4"> Month
</label> </label>
</div> </div>
</div> </div>
@ -320,7 +380,9 @@
<!-- Time Slots --> <!-- Time Slots -->
<div class="row mb-3"> <div class="row mb-3">
<label style="font-weight:bold;" class="col-sm-4 col-form-label text-end">Available Time Slot :</label>
<label style="font-weight:bold;"
class="col-sm-4 col-form-label text-end">Available
Time Slot :</label>
<div class="col-sm-8"> <div class="col-sm-8">
<div id="timeSlots" class="d-flex flex-wrap"> <div id="timeSlots" class="d-flex flex-wrap">
<!-- Time slots will be generated here dynamically --> <!-- Time slots will be generated here dynamically -->
@ -332,12 +394,15 @@
<div class="row mb-3"> <div class="row mb-3">
<label style="font-weight:bold;" class="col-sm-4 col-form-label text-end">Selected Time Slot</label> <label style="font-weight:bold;" class="col-sm-4 col-form-label text-end">Selected Time Slot</label>
<div class="col-sm-6">--> <div class="col-sm-6">-->
<input type="hidden" id="selectedSlot" class="form-control" readonly>
<input type="hidden" id="selectedSlot" class="form-control"
readonly>
<!-- </div> <!-- </div>
</div> --> </div> -->
<div class="row mb-3"> <div class="row mb-3">
<label style="font-weight:bold;" for="selectType" class="col-sm-4 col-form-label text-end">Select Type :</label>
<label style="font-weight:bold;" for="selectType"
class="col-sm-4 col-form-label text-end">Select Type
:</label>
<div class="col-sm-6"> <div class="col-sm-6">
<select class="form-control" id="selectType"> <select class="form-control" id="selectType">
<option value="Individual">Individual</option> <option value="Individual">Individual</option>
@ -347,16 +412,25 @@
</div> </div>
<div class="row mb-3"> <div class="row mb-3">
<label style="font-weight:bold;" for="personName" class="col-sm-4 col-form-label text-end">Name :</label>
<label style="font-weight:bold;" for="personName"
class="col-sm-4 col-form-label text-end">Name
:</label>
<div class="col-sm-6"> <div class="col-sm-6">
<input type="text" class="form-control" id="personName">
<input type="text" class="form-control"
id="personName">
</div> </div>
</div> </div>
<div class="row mb-3"> <div class="row mb-3">
<label style="font-weight:bold;" for="personPhone" class="col-sm-4 col-form-label text-end">Mobile Number :</label>
<label style="font-weight:bold;" for="personPhone"
class="col-sm-4 col-form-label text-end">Mobile
Number :</label>
<div class="col-sm-6"> <div class="col-sm-6">
<input type="text" class="form-control" id="personPhone" placeholder="Enter mobile number" pattern="^\d{10}$" maxlength="10" minlength="10" required>
<input type="text" class="form-control"
id="personPhone"
placeholder="Enter mobile number"
pattern="^\d{10}$" maxlength="10" minlength="10"
required>
</div> </div>
</div> </div>
@ -365,8 +439,12 @@
<!-- Action Buttons --> <!-- Action Buttons -->
<div class="d-flex justify-content-center"> <div class="d-flex justify-content-center">
<button type="button" style="width:100px;" class="reset-now-btn mr-1" onclick="resetForm()">Reset</button>
<button type="button" style="width:100px;" class="book-now-btn" onclick="saveBooking()">Book Now</button>
<button type="button" style="width:100px;"
class="reset-now-btn mr-1"
onclick="resetForm()">Reset</button>
<button type="button" style="width:100px;"
class="book-now-btn" onclick="saveBooking()">Book
Now</button>
</div> </div>
<div style="margin-top: 10px"> <div style="margin-top: 10px">
<center> <center>
@ -398,52 +476,84 @@
<!-- First Column --> <!-- First Column -->
<div class="col-lg-6 col-sm-6"> <div class="col-lg-6 col-sm-6">
<ul class="list-unstyled"> <ul class="list-unstyled">
<li style="margin-bottom: 21px;"><img src="/co-workspaceDocuments/icons/cal.png" class="mr-1" width="25px;"> Available days: S M T W T F S </li>
<li style="margin-bottom: 21px;"><img src="/co-workspaceDocuments/icons/clo.png" class="mr-1" width="25px;"> Available time : 09:00 AM to 09:00 PM</li>
<li style="margin-bottom: 21px;"><img
src="/co-workspaceDocuments/icons/cal.png"
class="mr-1" width="25px;"> Available days:
S M T W T F S </li>
<li style="margin-bottom: 21px;"><img
src="/co-workspaceDocuments/icons/clo.png"
class="mr-1" width="25px;"> Available time :
09:00 AM to 09:00 PM</li>
</ul> </ul>
</div> </div>
</div> </div>
<hr> <hr>
<h4 style="font-weight: bold;margin-bottom: 27px;">Amenities</h4>
<h4 style="font-weight: bold;margin-bottom: 27px;">Amenities
</h4>
<div class="row"> <div class="row">
<!-- First Column --> <!-- First Column -->
<div class="col-lg-4 col-sm-4"> <div class="col-lg-4 col-sm-4">
<ul class="list-unstyled"> <ul class="list-unstyled">
<li style="margin-bottom: 21px;"><img src="/co-workspaceDocuments/icons/1.png" class="mr-1" width="15px;"> Wifi / Internet</li>
<li style="margin-bottom: 21px;"><img src="/co-workspaceDocuments/icons/2.png" class="mr-1" width="15px;"> 24/7 Security</li>
<li style="margin-bottom: 21px;"><img src="/co-workspaceDocuments/icons/3.png" class="mr-1" width="15px;"> Housekeeping</li>
<li style="margin-bottom: 21px;"><img
src="/co-workspaceDocuments/icons/1.png"
class="mr-1" width="15px;"> Wifi / Internet
</li>
<li style="margin-bottom: 21px;"><img
src="/co-workspaceDocuments/icons/2.png"
class="mr-1" width="15px;"> 24/7 Security
</li>
<li style="margin-bottom: 21px;"><img
src="/co-workspaceDocuments/icons/3.png"
class="mr-1" width="15px;"> Housekeeping
</li>
</ul> </ul>
</div> </div>
<!-- Second Column --> <!-- Second Column -->
<div class="col-lg-4 col-sm-4"> <div class="col-lg-4 col-sm-4">
<ul class="list-unstyled"> <ul class="list-unstyled">
<li style="margin-bottom: 21px;"><img src="/co-workspaceDocuments/icons/4.png" class="mr-1" width="15px;"> Vehicle Parking</li>
<li style="margin-bottom: 21px;"><img src="/co-workspaceDocuments/icons/5.png" class="mr-1" width="15px;"> Reception</li>
<li style="margin-bottom: 21px;"><img src="/co-workspaceDocuments/icons/6.png" class="mr-1" width="15px;"> Tea / Coffee</li>
<li style="margin-bottom: 21px;"><img
src="/co-workspaceDocuments/icons/4.png"
class="mr-1" width="15px;"> Vehicle Parking
</li>
<li style="margin-bottom: 21px;"><img
src="/co-workspaceDocuments/icons/5.png"
class="mr-1" width="15px;"> Reception</li>
<li style="margin-bottom: 21px;"><img
src="/co-workspaceDocuments/icons/6.png"
class="mr-1" width="15px;"> Tea / Coffee
</li>
</ul> </ul>
</div> </div>
<!-- Third Column --> <!-- Third Column -->
<div class="col-lg-4 col-sm-4"> <div class="col-lg-4 col-sm-4">
<ul class="list-unstyled"> <ul class="list-unstyled">
<li style="margin-bottom: 21px;"><img src="/co-workspaceDocuments/icons/7.png" class="mr-1" width="15px;"> Comfy Workstations</li>
<li style="margin-bottom: 21px;"><img src="/co-workspaceDocuments/icons/8.png" class="mr-1" width="15px;"> Air Conditioning</li>
<li style="margin-bottom: 21px;"><img src="/co-workspaceDocuments/icons/9.png" class="mr-1" width="15px;"> ⁠Informal Collab Area</li>
<li style="margin-bottom: 21px;"><img
src="/co-workspaceDocuments/icons/7.png"
class="mr-1" width="15px;"> Comfy
Workstations</li>
<li style="margin-bottom: 21px;"><img
src="/co-workspaceDocuments/icons/8.png"
class="mr-1" width="15px;"> Air Conditioning
</li>
<li style="margin-bottom: 21px;"><img
src="/co-workspaceDocuments/icons/9.png"
class="mr-1" width="15px;"> ⁠Informal Collab
Area</li>
</ul> </ul>
</div> </div>
</div> </div>
</div> </div>
<div class="col-lg-6 col-sm-12 justify-content-center align-items-center">
<h4 style="font-weight: bold;">Muthalvar Padaippagam Location</h4>
<div
class="col-lg-6 col-sm-12 justify-content-center align-items-center">
<h4 style="font-weight: bold;">Muthalvar Padaippagam Location
</h4>
<div class="locationmap"> <div class="locationmap">
<iframe <iframe
th:src="'https://www.google.com/maps?q=' + ${latitude} + ',' + ${longitude} + '&hl=en&z=14&output=embed'" th:src="'https://www.google.com/maps?q=' + ${latitude} + ',' + ${longitude} + '&hl=en&z=14&output=embed'"
width="100%"
height="450"
style="border:0;"
allowfullscreen
loading="lazy"
width="100%" height="450" style="border:0;"
allowfullscreen loading="lazy"
referrerpolicy="no-referrer-when-downgrade"> referrerpolicy="no-referrer-when-downgrade">
</iframe> </iframe>
<!--- <iframe src="https://www.google.com/maps/embed?pb=!1m17!1m12!1m3!1d3885.7981508771118!2d80.232587!3d13.111970000000001!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m2!1m1!2zMTPCsDA2JzQzLjEiTiA4MMKwMTMnNTcuMyJF!5e0!3m2!1sen!2sin!4v1730288154721!5m2!1sen!2sin" width="100%" height="450" style="border:0;" allowfullscreen="" loading="lazy" referrerpolicy="no-referrer-when-downgrade"></iframe>--> <!--- <iframe src="https://www.google.com/maps/embed?pb=!1m17!1m12!1m3!1d3885.7981508771118!2d80.232587!3d13.111970000000001!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m2!1m1!2zMTPCsDA2JzQzLjEiTiA4MMKwMTMnNTcuMyJF!5e0!3m2!1sen!2sin!4v1730288154721!5m2!1sen!2sin" width="100%" height="450" style="border:0;" allowfullscreen="" loading="lazy" referrerpolicy="no-referrer-when-downgrade"></iframe>-->
@ -464,7 +574,8 @@
</div> </div>
<footer th:replace="~{fragments/footer :: footer}"></footer> <footer th:replace="~{fragments/footer :: footer}"></footer>
</div> </div>
<div class="modal fade" id="visitTourModal" tabindex="-1" aria-labelledby="visitTourModalLabel" aria-hidden="true">
<div class="modal fade" id="visitTourModal" tabindex="-1" aria-labelledby="visitTourModalLabel"
aria-hidden="true">
<div class="modal-dialog modal-lg"> <div class="modal-dialog modal-lg">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
@ -472,13 +583,15 @@
<button type="button" class="btn btn-danger" data-bs-dismiss="modal">Close</button> <button type="button" class="btn btn-danger" data-bs-dismiss="modal">Close</button>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<iframe id="visitTourIframe" src="" style="width: 100%; height: 500px; border: none;"></iframe>
<iframe id="visitTourIframe" src=""
style="width: 100%; height: 500px; border: none;"></iframe>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<!-- modal for confrim booking --> <!-- modal for confrim booking -->
<div class="modal fade" id="ackModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal fade" id="ackModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
aria-hidden="true">
<div class="modal-dialog modal-md" role="document"> <div class="modal-dialog modal-md" role="document">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
@ -542,9 +655,12 @@
window.location.href = '/muthalvarpadaippagam'; window.location.href = '/muthalvarpadaippagam';
}); });
} }
});
});
$(document).on('click', '#backBtn', function () {
window.location.href = '/muthalvarpadaippagam/home';
});
fetch('/muthalvarpadaippagam/book/api/marquee') fetch('/muthalvarpadaippagam/book/api/marquee')
@ -563,19 +679,21 @@
// Extract query parameters from the URL // Extract query parameters from the URL
const urlParams = new URLSearchParams(window.location.search);
const catId = urlParams.get('categoryId');
const buildId = urlParams.get('buildingId');
let subId = urlParams.get('subId');
// const urlParams = new URLSearchParams(window.location.search);
// const catId = urlParams.get('categoryId');
// const buildId = urlParams.get('buildingId');
// let subId = urlParams.get('subId');
// console.log("Category ID:", catId); // console.log("Category ID:", catId);
// console.log("Building ID:", buildId); // console.log("Building ID:", buildId);
// console.log("Sub ID:", subId); // console.log("Sub ID:", subId);
// Optional: fallback if parameters missing // Optional: fallback if parameters missing
if (!buildId) {
alert("Invalid building ID. Please go back and try again.");
}
const buildId = document.getElementById("#buildingId")
const catId = document.getElementById("#categoryId")
let subId = document.getElementById("#subId")
let slots = []; let slots = [];
let timeSlots = []; let timeSlots = [];
@ -777,6 +895,9 @@
let name = $('#personName').val(); let name = $('#personName').val();
let phone = $('#personPhone').val(); let phone = $('#personPhone').val();
let fromDate = $('#selectDate').val(); // Ensure this is a different element let fromDate = $('#selectDate').val(); // Ensure this is a different element
let subId = $('input[name="booking_type"]:checked').val();
let buildId = $('#buildingId').val();
let catId = $('#categoryId').val();
let toDate = fromDate; // Ensure this is a different element let toDate = fromDate; // Ensure this is a different element
if (subId == 4) { if (subId == 4) {
//toDate = convertDateFormat(toDate); //toDate = convertDateFormat(toDate);
@ -980,4 +1101,5 @@ function showTourPopup1(link) {
</script> </script>
</div> </div>
</body> </body>
</html> </html>

72
src/main/resources/templates/user/home.html

@ -1155,7 +1155,10 @@
class="custom-tab-btn" class="custom-tab-btn"
th:data-cid="${space.cid}" th:data-cid="${space.cid}"
th:data-bid="${space.bid}" th:data-bid="${space.bid}"
th:classappend="${space.cid} == cid ? ' active' "
th:classappend="${
(bid == 1 and space.cid == 1) or
(bid == 2 and space.cid == 4)
} ? ' active' : ''"
th:text="${space.display_name}"> th:text="${space.display_name}">
</a> </a>
</th:block> </th:block>
@ -1673,15 +1676,74 @@ document.addEventListener('DOMContentLoaded', () => {
// window.location.href = "/muthalvarpadaippagam/book?buildingId=" + bid + "&categoryId=" + categoryId; // window.location.href = "/muthalvarpadaippagam/book?buildingId=" + bid + "&categoryId=" + categoryId;
// } // }
// function gotoBooking(bid, categoryId, subId) {
// // console.log("bid",bid);
// // Construct the URL with all three parameters
// const url = `/muthalvarpadaippagam/book?buildingId=${bid}&categoryId=${categoryId}&subId=${subId}`;
// window.location.href = url;
// }
// function gotoBooking(bid, categoryId, subId) {
// const form = document.createElement("form");
// form.method = "POST";
// form.action = "/muthalvarpadaippagam/book";
// // buildingId
// const b = document.createElement("input");
// b.type = "hidden";
// b.name = "buildingId";
// b.value = bid;
// form.appendChild(b);
// // categoryId
// const c = document.createElement("input");
// c.type = "hidden";
// c.name = "categoryId";
// c.value = categoryId;
// form.appendChild(c);
// // subId
// const s = document.createElement("input");
// s.type = "hidden";
// s.name = "subId";
// s.value = subId;
// form.appendChild(s);
// document.body.appendChild(form);
// form.submit();
// }
function gotoBooking(bid, categoryId, subId) { function gotoBooking(bid, categoryId, subId) {
// console.log("bid",bid);
// Construct the URL with all three parameters
const url = `/muthalvarpadaippagam/book?buildingId=${bid}&categoryId=${categoryId}&subId=${subId}`;
window.location.href = url;
const form = document.createElement("form");
form.method = "POST";
form.action = "/muthalvarpadaippagam/book";
form.appendChild(hidden("buildingId", bid));
form.appendChild(hidden("categoryId", categoryId));
form.appendChild(hidden("subId", subId));
document.body.appendChild(form);
form.submit();
}
function hidden(name, value) {
const input = document.createElement("input");
input.type = "hidden";
input.name = name;
input.value = value;
return input;
} }
//to scroll down the content //to scroll down the content
function scrollToContainer() { function scrollToContainer() {
document.getElementById("spaceSection").scrollIntoView({behavior: 'smooth', block: 'start'}); document.getElementById("spaceSection").scrollIntoView({behavior: 'smooth', block: 'start'});

39
src/main/resources/templates/user/workspacelist.html

@ -1739,7 +1739,14 @@ function loadBuildings() {
</p> </p>
</div> </div>
<button class="btn btn-primary w-100 mt-auto fw-semibold"
<!--<button class="btn btn-primary w-100 mt-auto fw-semibold"
onclick="showSpaceTabs(${b.bid}, ${b.cid})">
View Details
</button>-->
<button class="btn w-100 mt-auto fw-semibold"
style="background-color:#15455D; color:white; border:none;"
onmouseover="this.style.backgroundColor='#0F3447'"
onmouseout="this.style.backgroundColor='#15455D'"
onclick="showSpaceTabs(${b.bid}, ${b.cid})"> onclick="showSpaceTabs(${b.bid}, ${b.cid})">
View Details View Details
</button> </button>
@ -1758,11 +1765,37 @@ function loadBuildings() {
} }
// function showSpaceTabs(bid, cid) {
// //console.log("Redirecting with bid:", bid, "and cid:", cid);
// window.location.href = `/muthalvarpadaippagam/home?bid=${bid}&cid=${cid}`;
// }
function showSpaceTabs(bid, cid) { function showSpaceTabs(bid, cid) {
//console.log("Redirecting with bid:", bid, "and cid:", cid);
window.location.href = `/muthalvarpadaippagam/home?bid=${bid}&cid=${cid}`;
const form = document.createElement("form");
form.method = "POST";
form.action = "/muthalvarpadaippagam/home";
form.appendChild(hidden("bid", bid));
form.appendChild(hidden("cid", cid));
document.body.appendChild(form);
form.submit();
} }
function hidden(name, value) {
const input = document.createElement("input");
input.type = "hidden";
input.name = name;
input.value = value;
return input;
}
// ✅ Redirect function // ✅ Redirect function
// function showSpaceTabs(bid, cid = 2) { // function showSpaceTabs(bid, cid = 2) {

Loading…
Cancel
Save