Browse Source

building id dynamically and live issue fixed (wrong build & category) booking by user & fixed the changes officerdashboard page for caretaker2

master
AJITHKUMAR12 9 months ago
parent
commit
f340c42d4b
  1. 216
      src/main/java/com/gcc/coworkspace/controller/BookingController.java
  2. 256
      src/main/java/com/gcc/coworkspace/controller/controller.java
  3. 708
      src/main/java/com/gcc/coworkspace/service/BookingService.java
  4. 9
      src/main/java/com/gcc/coworkspace/service/NormalSMS.java
  5. 26
      src/main/java/com/gcc/coworkspace/service/WhatsAppService.java
  6. 5
      src/main/resources/templates/caretaker/abstract.html
  7. 13
      src/main/resources/templates/caretaker/bookingdetails.html
  8. 2
      src/main/resources/templates/caretaker/bookingdetails.html.29112024.html
  9. 84
      src/main/resources/templates/caretaker/officer-dashboard.html
  10. 2
      src/main/resources/templates/fragments/user-nav.html
  11. 249
      src/main/resources/templates/user/book-Conferance.html
  12. 218
      src/main/resources/templates/user/book-reading.html
  13. 23
      src/main/resources/templates/user/book-workdesk.html
  14. 2
      src/main/resources/templates/user/bookinghistory.html
  15. 2
      src/main/resources/templates/user/qrpage.html
  16. 1
      src/main/resources/templates/user/razor-pay.html

216
src/main/java/com/gcc/coworkspace/controller/BookingController.java

@ -1,11 +1,10 @@
package com.gcc.coworkspace.controller; package com.gcc.coworkspace.controller;
import com.gcc.coworkspace.component.UserSession; import com.gcc.coworkspace.component.UserSession;
import com.gcc.coworkspace.configuration.AppConfig; import com.gcc.coworkspace.configuration.AppConfig;
import com.gcc.coworkspace.configuration.QrGenerator; import com.gcc.coworkspace.configuration.QrGenerator;
import com.gcc.coworkspace.constants.AppConstants; import com.gcc.coworkspace.constants.AppConstants;
import com.gcc.coworkspace.exception.NoSlotAvailable;
import com.gcc.coworkspace.service.BookingService; import com.gcc.coworkspace.service.BookingService;
import com.gcc.coworkspace.service.NormalSMS; import com.gcc.coworkspace.service.NormalSMS;
import com.gcc.coworkspace.service.PaymentService; import com.gcc.coworkspace.service.PaymentService;
@ -54,8 +53,39 @@ public class BookingController {
@Autowired @Autowired
private NormalSMS normalSMS; private NormalSMS normalSMS;
/*
* @PostMapping("/saveInTemp")
* public Map<String, Object> booking(@RequestParam("catId") int catId,
*
* @RequestParam("buildId") int buildId,
*
* @RequestParam("subId") int subId,
*
* @RequestParam("noOfPeople") int noOfPeople,
*
* @RequestParam("fromDate") LocalDate fromDate,
*
* @RequestParam("toDate") LocalDate toDate,
*
* @RequestParam("userName") String userName,
*
* @RequestParam("userMobile") long userMobile,
* // @RequestParam("amount") double amount,
*
* @RequestParam("slots") List<Integer> slots) {
*
* System.out.println(catId);
* System.out.println(slots);
* return bookingService.saveTempBooking(userName, userMobile, slots, fromDate,
* toDate, noOfPeople, catId, buildId,
* subId);
*
* }
*/
@PostMapping("/saveInTemp") @PostMapping("/saveInTemp")
public Map<String, Object> booking(@RequestParam("catId") int catId,
public ResponseEntity<Map<String, Object>> booking(
@RequestParam("catId") int catId,
@RequestParam("buildId") int buildId, @RequestParam("buildId") int buildId,
@RequestParam("subId") int subId, @RequestParam("subId") int subId,
@RequestParam("noOfPeople") int noOfPeople, @RequestParam("noOfPeople") int noOfPeople,
@ -63,13 +93,32 @@ public class BookingController {
@RequestParam("toDate") LocalDate toDate, @RequestParam("toDate") LocalDate toDate,
@RequestParam("userName") String userName, @RequestParam("userName") String userName,
@RequestParam("userMobile") long userMobile, @RequestParam("userMobile") long userMobile,
// @RequestParam("amount") double amount,
@RequestParam("slots") List<Integer> slots) { @RequestParam("slots") List<Integer> slots) {
System.out.println("buildId" + buildId);
System.out.println("catId" + catId);
Map<String, Object> response = new HashMap<>();
try {
Map<String, Object> result = bookingService.saveTempBooking(
userName, userMobile, slots,
fromDate, toDate, noOfPeople,
catId, buildId, subId);
response.put("status", "SUCCESS");
response.putAll(result);
return ResponseEntity.ok(response);
System.out.println(catId);
System.out.println(slots);
return bookingService.saveTempBooking(userName,userMobile, slots, fromDate, toDate,noOfPeople,catId,buildId,subId) ;
} catch (NoSlotAvailable e) {
response.put("status", "ERROR");
response.put("message", e.getMessage());
return ResponseEntity
.status(HttpStatus.BAD_REQUEST)
.body(response);
}
} }
// @PostMapping("/saveBooking") // @PostMapping("/saveBooking")
@ -78,11 +127,14 @@ public class BookingController {
// return bookingService.saveBooking(tempBookId); // return bookingService.saveBooking(tempBookId);
// } // }
/* /*
@GetMapping("/checkAvail")
public Boolean checkAvailability(int bid,int cid,LocalDate bDate,int scid,int noOfPerson,int slotId){
System.out.println("check Availability");
return bookingService.checkAvailabilityByBdate(bid,cid,bDate,scid,noOfPerson,slotId);
}
* @GetMapping("/checkAvail")
* public Boolean checkAvailability(int bid,int cid,LocalDate bDate,int scid,int
* noOfPerson,int slotId){
* System.out.println("check Availability");
* return
* bookingService.checkAvailabilityByBdate(bid,cid,bDate,scid,noOfPerson,slotId)
* ;
* }
*/ */
@GetMapping("/checkAvail") @GetMapping("/checkAvail")
@ -106,11 +158,9 @@ public class BookingController {
// Get data from the service // Get data from the service
Map<String, Object> tempBookingInfo = bookingService.getTempBookingByTempId(tempid); Map<String, Object> tempBookingInfo = bookingService.getTempBookingByTempId(tempid);
// Check if the list is not empty // Check if the list is not empty
if (tempBookingInfo != null && !tempBookingInfo.isEmpty()) { if (tempBookingInfo != null && !tempBookingInfo.isEmpty()) {
String tempbookid = tempBookingInfo.get("tempbookid").toString(); String tempbookid = tempBookingInfo.get("tempbookid").toString();
String amount = tempBookingInfo.get("amount").toString(); String amount = tempBookingInfo.get("amount").toString();
double amountDouble = 0.0; double amountDouble = 0.0;
@ -131,7 +181,6 @@ public class BookingController {
paymentService.saveorderLog(od.get("id").toString(), od.toString(), tempbookid); paymentService.saveorderLog(od.get("id").toString(), od.toString(), tempbookid);
return od.toString(); return od.toString();
} else { } else {
System.out.println("No data found for tempid: " + tempid); System.out.println("No data found for tempid: " + tempid);
return "No data found for tempid: " + tempid; return "No data found for tempid: " + tempid;
@ -142,7 +191,8 @@ public class BookingController {
@PostMapping("/Confirm") @PostMapping("/Confirm")
public String updateOrder(@RequestBody Map<String, Object> data) { public String updateOrder(@RequestBody Map<String, Object> data) {
String tempid=data.get("id").toString();;
String tempid = data.get("id").toString();
;
String pay_id = data.get("payment_id").toString(); String pay_id = data.get("payment_id").toString();
String order_id = data.get("order_id").toString(); String order_id = data.get("order_id").toString();
String status = data.get("status").toString(); String status = data.get("status").toString();
@ -158,7 +208,6 @@ public class BookingController {
System.out.println("Booking ID:- " + bookingId); System.out.println("Booking ID:- " + bookingId);
return bookingId + ""; return bookingId + "";
} catch (Exception e) { } catch (Exception e) {
System.out.println("error: " + e.getMessage()); System.out.println("error: " + e.getMessage());
System.out.println("No booking data found for tempid: " + tempid); System.out.println("No booking data found for tempid: " + tempid);
@ -167,7 +216,6 @@ public class BookingController {
} }
} }
// mobile app development // mobile app development
@GetMapping("/bookings") @GetMapping("/bookings")
public ResponseEntity<List<Map<String, Object>>> getBookingsByMobileNo(@RequestParam long mobileNo) { public ResponseEntity<List<Map<String, Object>>> getBookingsByMobileNo(@RequestParam long mobileNo) {
@ -177,6 +225,7 @@ public class BookingController {
} }
return ResponseEntity.ok(bookings); // Return 200 with the bookings data return ResponseEntity.ok(bookings); // Return 200 with the bookings data
} }
@GetMapping("/generate-qrcode") @GetMapping("/generate-qrcode")
public ResponseEntity<?> generateQRCode(@RequestParam(required = true) String booking_id) { public ResponseEntity<?> generateQRCode(@RequestParam(required = true) String booking_id) {
if (booking_id == null) { if (booking_id == null) {
@ -222,7 +271,6 @@ public class BookingController {
return bodyMessage; return bodyMessage;
} }
@GetMapping(value = "/verifyOTP") @GetMapping(value = "/verifyOTP")
@ResponseBody @ResponseBody
public Map<String, Object> verifyOtp(HttpServletRequest request, @RequestParam String otp) { public Map<String, Object> verifyOtp(HttpServletRequest request, @RequestParam String otp) {
@ -270,37 +318,40 @@ public class BookingController {
return response; return response;
} }
/* /*
@GetMapping(value = "/verifyOTP")
public String verifyOtp(HttpServletRequest request, @RequestParam String otp) {
HttpSession session = request.getSession();
try {
Integer session_otp = (Integer) session.getAttribute("otp");
System.out.println("session_otp---:" + session_otp);
Integer entered_otp = Integer.parseInt(otp);
if (session_otp != null && session_otp.equals(entered_otp)) {
System.out.println("Entered OTP Correct");
session.setAttribute("verifiedotp", "success");
userSession.setMobileno(Long.parseLong(session.getAttribute("mobileNo").toString()));
return "Success";
} else {
System.out.println("Incorrect OTP. Please enter correct OTPs.");
session.setAttribute("verifiedotp", "error");
return "Error";
}
} catch (NumberFormatException e) {
System.out.println("Invalid OTP format: " + otp);
return "Error";
} catch (Exception e) {
System.out.println("Error verifying OTP: " + e.getMessage());
return "Error";
}
}
* @GetMapping(value = "/verifyOTP")
* public String verifyOtp(HttpServletRequest request, @RequestParam String otp)
* {
* HttpSession session = request.getSession();
*
* try {
* Integer session_otp = (Integer) session.getAttribute("otp");
* System.out.println("session_otp---:" + session_otp);
* Integer entered_otp = Integer.parseInt(otp);
*
* if (session_otp != null && session_otp.equals(entered_otp)) {
* System.out.println("Entered OTP Correct");
* session.setAttribute("verifiedotp", "success");
* userSession.setMobileno(Long.parseLong(session.getAttribute("mobileNo").
* toString()));
* return "Success";
* } else {
* System.out.println("Incorrect OTP. Please enter correct OTPs.");
* session.setAttribute("verifiedotp", "error");
* return "Error";
* }
* } catch (NumberFormatException e) {
* System.out.println("Invalid OTP format: " + otp);
* return "Error";
* } catch (Exception e) {
* System.out.println("Error verifying OTP: " + e.getMessage());
* return "Error";
* }
* }
*/ */
// @PostMapping("/validatelogin") // @PostMapping("/validatelogin")
// public ResponseEntity<?> checkLogin(@RequestParam String usernametxt, @RequestParam String passwordtxt, HttpSession session) {
// public ResponseEntity<?> checkLogin(@RequestParam String usernametxt,
// @RequestParam String passwordtxt, HttpSession session) {
// try { // try {
// String userName = bookingser.validateLogin(usernametxt, passwordtxt); // String userName = bookingser.validateLogin(usernametxt, passwordtxt);
@ -316,11 +367,11 @@ public class BookingController {
// } // }
// } catch (Exception e) { // } catch (Exception e) {
// e.printStackTrace(); // e.printStackTrace();
// return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Internal server error occurred");
// return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Internal
// server error occurred");
// } // }
// } // }
// added by yogi // added by yogi
@PostMapping("/validatelogin") @PostMapping("/validatelogin")
public ResponseEntity<?> checkLogin( public ResponseEntity<?> checkLogin(
@ -349,7 +400,6 @@ public class BookingController {
response.put("user_name", userName); response.put("user_name", userName);
response.put("bid", bid); response.put("bid", bid);
System.out.println("Logged in user=" + userName + ", BID=" + bid); System.out.println("Logged in user=" + userName + ", BID=" + bid);
return ResponseEntity.ok(response); return ResponseEntity.ok(response);
@ -364,8 +414,6 @@ public class BookingController {
} }
} }
// ak // ak
@GetMapping("/bookinghistorydetails") @GetMapping("/bookinghistorydetails")
@ -389,10 +437,13 @@ public class BookingController {
// Replace with the actual view name // Replace with the actual view name
} }
/* @GetMapping("/getbookingdetailDashBoard")
public List<Map<String, Object>> getbookingdetailDashBoard(@RequestParam String fromDate, @RequestParam String toDate, @RequestParam String status) {
return bookingService.getbookingdetailDashBoard(fromDate,toDate, status);
}*/
/*
* @GetMapping("/getbookingdetailDashBoard")
* public List<Map<String, Object>> getbookingdetailDashBoard(@RequestParam
* String fromDate, @RequestParam String toDate, @RequestParam String status) {
* return bookingService.getbookingdetailDashBoard(fromDate,toDate, status);
* }
*/
// ak // ak
@GetMapping("/getbookingdetailDashBoard") @GetMapping("/getbookingdetailDashBoard")
public List<Map<String, Object>> getbookingdetailDashBoard( public List<Map<String, Object>> getbookingdetailDashBoard(
@ -408,15 +459,18 @@ public List<Map<String, Object>> getbookingdetailDashBoard(
return bookingService.getbookingdetailDashBoard(fromDate, toDate, status, bid); return bookingService.getbookingdetailDashBoard(fromDate, toDate, status, bid);
} }
/* @GetMapping("/amountCollected")
public List<Map<String, Object>> getAmountCollected(@RequestParam("fromDate") String fromDate,
@RequestParam("toDate") String toDate) {
// Convert the string dates to LocalDate
LocalDate parsedFromDate = LocalDate.parse(fromDate);
LocalDate parsedToDate = LocalDate.parse(toDate);
return bookingService.getAmountCollectedByDate(parsedFromDate, parsedToDate);
}*/
/*
* @GetMapping("/amountCollected")
* public List<Map<String, Object>> getAmountCollected(@RequestParam("fromDate")
* String fromDate,
*
* @RequestParam("toDate") String toDate) {
* // Convert the string dates to LocalDate
* LocalDate parsedFromDate = LocalDate.parse(fromDate);
* LocalDate parsedToDate = LocalDate.parse(toDate);
* return bookingService.getAmountCollectedByDate(parsedFromDate, parsedToDate);
* }
*/
@GetMapping("/amountCollected") @GetMapping("/amountCollected")
public List<Map<String, Object>> getAmountCollected( public List<Map<String, Object>> getAmountCollected(
@RequestParam("fromDate") String fromDate, @RequestParam("fromDate") String fromDate,
@ -429,13 +483,17 @@ public List<Map<String, Object>> getAmountCollected(
return bookingService.getAmountCollectedByDate(parsedFromDate, parsedToDate, bid); return bookingService.getAmountCollectedByDate(parsedFromDate, parsedToDate, bid);
} }
/*@GetMapping("/bookingCountByCategory")
public List<Map<String, Object>> getBookingCountsByCategory(@RequestParam("fromDate") String fromDate,
@RequestParam("toDate") String toDate,) {
// Call the service method to get the booking counts for the specified date range
return bookingService.getBookingCountsByCategory(fromDate, toDate);
}*/
/*
* @GetMapping("/bookingCountByCategory")
* public List<Map<String, Object>>
* getBookingCountsByCategory(@RequestParam("fromDate") String fromDate,
*
* @RequestParam("toDate") String toDate,) {
* // Call the service method to get the booking counts for the specified date
* range
* return bookingService.getBookingCountsByCategory(fromDate, toDate);
* }
*/
// ak // ak
@GetMapping("/bookingCountByCategory") @GetMapping("/bookingCountByCategory")
public List<Map<String, Object>> getBookingCountsByCategory( public List<Map<String, Object>> getBookingCountsByCategory(
@ -446,11 +504,14 @@ public List<Map<String, Object>> getBookingCountsByCategory(
return bookingService.getBookingCountsByCategory(fromDate, toDate, bid); return bookingService.getBookingCountsByCategory(fromDate, toDate, bid);
} }
/* @GetMapping("/totalBookingCounts")
public List<Map<String, Object>> getBookingCounts(@RequestParam("fromDate") String fromDate,@RequestParam("toDate")String toDate) {
// Call service method to get booking counts
return bookingService.getBookingCountsByDate(fromDate,toDate);
}*/
/*
* @GetMapping("/totalBookingCounts")
* public List<Map<String, Object>> getBookingCounts(@RequestParam("fromDate")
* String fromDate,@RequestParam("toDate")String toDate) {
* // Call service method to get booking counts
* return bookingService.getBookingCountsByDate(fromDate,toDate);
* }
*/
// ak // ak
@GetMapping("/totalBookingCounts") @GetMapping("/totalBookingCounts")
public List<Map<String, Object>> getBookingCounts( public List<Map<String, Object>> getBookingCounts(
@ -461,7 +522,6 @@ public List<Map<String, Object>> getBookingCounts(
return bookingService.getBookingCountsByDate(fromDate, toDate, bid); return bookingService.getBookingCountsByDate(fromDate, toDate, bid);
} }
@GetMapping("/bookinghistory") @GetMapping("/bookinghistory")
@ResponseBody @ResponseBody
public List<Map<String, Object>> getBookingHistory() { public List<Map<String, Object>> getBookingHistory() {

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

@ -1,4 +1,5 @@
package com.gcc.coworkspace.controller; package com.gcc.coworkspace.controller;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.List; import java.util.List;
@ -15,6 +16,7 @@ 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;
import com.gcc.coworkspace.exception.NoSlotAvailable;
import com.gcc.coworkspace.component.UserSession; import com.gcc.coworkspace.component.UserSession;
import com.gcc.coworkspace.service.BookingService; import com.gcc.coworkspace.service.BookingService;
@ -57,31 +59,37 @@ public class controller {
} }
/* /*
@GetMapping(value = {"/","","/home"})
public String viewHome(Model model) {
List<Map<String, Object>> spaces = homeService.getActiveCoWorkingSpaces();
List<Map<String, Object>> readingZoneDetails = homeService.getPricingDetailsByCid(1);
List<Map<String, Object>> deskSpaceDetails = homeService.getPricingDetailsByCid(2);
List<Map<String, Object>> conferenceHallDetails = homeService.getPricingDetailsByCid(3);
model.addAttribute("readingZoneDetails", readingZoneDetails);
model.addAttribute("deskSpaceDetails", deskSpaceDetails);
model.addAttribute("conferenceHallDetails", conferenceHallDetails);
model.addAttribute("homeImg",homeService.getImgByCid(0));
model.addAttribute("spaces", spaces);
return "user/home";
}
* @GetMapping(value = {"/","","/home"})
* public String viewHome(Model model) {
* List<Map<String, Object>> spaces = homeService.getActiveCoWorkingSpaces();
*
* List<Map<String, Object>> readingZoneDetails =
* homeService.getPricingDetailsByCid(1);
* List<Map<String, Object>> deskSpaceDetails =
* homeService.getPricingDetailsByCid(2);
* List<Map<String, Object>> conferenceHallDetails =
* homeService.getPricingDetailsByCid(3);
*
* model.addAttribute("readingZoneDetails", readingZoneDetails);
* model.addAttribute("deskSpaceDetails", deskSpaceDetails);
* model.addAttribute("conferenceHallDetails", conferenceHallDetails);
* model.addAttribute("homeImg",homeService.getImgByCid(0));
*
* model.addAttribute("spaces", spaces);
* return "user/home";
* }
*
*/ */
// @GetMapping(value = {"/", "", "/workspacelist"}) // @GetMapping(value = {"/", "", "/workspacelist"})
// public String viewWorkspaclist(@RequestParam(value = "cid", required = false) Integer cidParam, Model model) {
// public String viewWorkspaclist(@RequestParam(value = "cid", required = false)
// Integer cidParam, Model model) {
// List<Map<String, Object>> spaces = homeService.getActiveCoWorkingSpaces(bid); // List<Map<String, Object>> spaces = homeService.getActiveCoWorkingSpaces(bid);
// List<Map<String, Object>> readingZoneDetails = homeService.getPricingDetailsByCid(1);
// List<Map<String, Object>> deskSpaceDetails = homeService.getPricingDetailsByCid(2);
// List<Map<String, Object>> conferenceHallDetails = homeService.getPricingDetailsByCid(3);
// List<Map<String, Object>> readingZoneDetails =
// homeService.getPricingDetailsByCid(1);
// List<Map<String, Object>> deskSpaceDetails =
// homeService.getPricingDetailsByCid(2);
// List<Map<String, Object>> conferenceHallDetails =
// homeService.getPricingDetailsByCid(3);
// // Default to Learning Centre (cid = 1) // // Default to Learning Centre (cid = 1)
// Integer cid = (cidParam != null) ? cidParam : 2; // Integer cid = (cidParam != null) ? cidParam : 2;
@ -121,7 +129,8 @@ public String viewWorkspaceList(Model model) {
// ✅ Get all active buildings (for workspace list page) // ✅ Get all active buildings (for workspace list page)
List<Map<String, Object>> buildingList = buildingSer.getBuildingDetails(); List<Map<String, Object>> buildingList = buildingSer.getBuildingDetails();
// ✅ You can also fetch coworking space categories (if needed to show as tabs or filters)
// ✅ You can also fetch coworking space categories (if needed to show as tabs or
// filters)
List<Map<String, Object>> spaces = homeService.getActiveCoWorkingSpaces(); List<Map<String, Object>> spaces = homeService.getActiveCoWorkingSpaces();
// ✅ Add to model // ✅ Add to model
@ -132,20 +141,16 @@ public String viewWorkspaceList(Model model) {
return "user/workspacelist"; return "user/workspacelist";
} }
// @GetMapping(value = { "/home"}) // @GetMapping(value = { "/home"})
// public String viewHome(@RequestParam int bid,@RequestParam(value = "cid", required = false) Integer cidParam, Model model) {
// public String viewHome(@RequestParam int bid,@RequestParam(value = "cid",
// required = false) Integer cidParam, Model model) {
// List<Map<String, Object>> spaces = homeService.getActiveCoWorkingSpaces(); // List<Map<String, Object>> spaces = homeService.getActiveCoWorkingSpaces();
// List<Map<String, Object>> readingZoneDetails = homeService.getPricingDetailsByCid(1);
// List<Map<String, Object>> deskSpaceDetails = homeService.getPricingDetailsByCid(2);
// List<Map<String, Object>> conferenceHallDetails = homeService.getPricingDetailsByCid(3);
// List<Map<String, Object>> readingZoneDetails =
// homeService.getPricingDetailsByCid(1);
// List<Map<String, Object>> deskSpaceDetails =
// homeService.getPricingDetailsByCid(2);
// List<Map<String, Object>> conferenceHallDetails =
// homeService.getPricingDetailsByCid(3);
// // Default to Learning Centre (cid = 1) // // Default to Learning Centre (cid = 1)
// Integer cid = (cidParam != null) ? cidParam : 2; // Integer cid = (cidParam != null) ? cidParam : 2;
@ -180,8 +185,6 @@ public String viewWorkspaceList(Model model) {
// return "user/home"; // return "user/home";
// } // }
@GetMapping("/home") @GetMapping("/home")
public String viewHomeGet(@RequestParam(value = "bid", required = false) Integer 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,
@ -190,9 +193,9 @@ public String viewHomeGet(@RequestParam(value = "bid", required = false) Integer
return "redirect:/muthalvarpadaippagam"; // or show error page return "redirect:/muthalvarpadaippagam"; // or show error page
} }
return loadHomePage(bid, cidParam, model); return loadHomePage(bid, cidParam, model);
} }
// POST – used by hidden form (no URL params visible!) // POST – used by hidden form (no URL params visible!)
@PostMapping("/home") @PostMapping("/home")
public String viewHomePost(@RequestParam int bid, public String viewHomePost(@RequestParam int bid,
@ -201,8 +204,6 @@ public String viewHomeGet(@RequestParam(value = "bid", required = false) Integer
return loadHomePage(bid, cidParam, model); return loadHomePage(bid, cidParam, model);
} }
// previously used // previously used
// @GetMapping("/home") // @GetMapping("/home")
// public String viewHome(@RequestParam int bid, // public String viewHome(@RequestParam int bid,
@ -210,8 +211,8 @@ public String viewHomeGet(@RequestParam(value = "bid", required = false) Integer
// Model model) { // Model model) {
// // ✅ Get coworking spaces for this building // // ✅ Get coworking spaces for this building
// List<Map<String, Object>> spaces = homeService.getActiveCoWorkingSpacesByBuilding(bid);
// List<Map<String, Object>> spaces =
// homeService.getActiveCoWorkingSpacesByBuilding(bid);
// //System.out.println("home inside:" + spaces); // //System.out.println("home inside:" + spaces);
@ -234,9 +235,12 @@ public String viewHomeGet(@RequestParam(value = "bid", required = false) Integer
// /*List<Map<String, Object>> pricingDetails = (cid != null) // /*List<Map<String, Object>> pricingDetails = (cid != null)
// ? homeService.getPricingDetailsByCid(cid) // ? homeService.getPricingDetailsByCid(cid)
// : List.of();*/ // : 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);
// 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 // // ✅ Get category images for this category
// List<Map<String, Object>> homeImg = (cid != null) // List<Map<String, Object>> homeImg = (cid != null)
@ -250,8 +254,6 @@ public String viewHomeGet(@RequestParam(value = "bid", required = false) Integer
// .orElse(null); // .orElse(null);
// //ak // //ak
// // ✅ Add everything to model // // ✅ Add everything to model
// model.addAttribute("bid", bid); // model.addAttribute("bid", bid);
// model.addAttribute("cid", cid); // model.addAttribute("cid", cid);
@ -264,13 +266,9 @@ public String viewHomeGet(@RequestParam(value = "bid", required = false) Integer
// model.addAttribute("conferenceHallDetails", conferenceHallDetails); // model.addAttribute("conferenceHallDetails", conferenceHallDetails);
// model.addAttribute("homeImg", homeImg); // model.addAttribute("homeImg", homeImg);
// return "user/home"; // return "user/home";
// } // }
// 🔥 Reusable method // 🔥 Reusable method
private String loadHomePage(int bid, Integer cidParam, Model model) { private String loadHomePage(int bid, Integer cidParam, Model model) {
@ -282,8 +280,7 @@ public String viewHomeGet(@RequestParam(value = "bid", required = false) Integer
.collect(Collectors.toMap( .collect(Collectors.toMap(
m -> (Integer) m.get("cid"), m -> (Integer) m.get("cid"),
m -> m, m -> m,
(existing, replacement) -> existing
))
(existing, replacement) -> existing))
.values() .values()
.stream() .stream()
.toList(); .toList();
@ -329,36 +326,46 @@ public List<Map<String, Object>> getPricingDetails(@RequestParam int cid) {
return homeService.getPricingDetailsByCid(cid); return homeService.getPricingDetailsByCid(cid);
} }
// @GetMapping("/book") // @GetMapping("/book")
// public String showCategoryPage(@RequestParam int buildingId,@RequestParam int categoryId, Model model) {
// List<Map<String, Object>> buildingCategoryDetails = buildingSer.getBuildingCategoryDetailsById(buildingId,categoryId); // Retrieve data
// public String showCategoryPage(@RequestParam int buildingId,@RequestParam int
// categoryId, Model model) {
// List<Map<String, Object>> buildingCategoryDetails =
// buildingSer.getBuildingCategoryDetailsById(buildingId,categoryId); //
// Retrieve data
// model.addAttribute("homeImg",homeService.getImgByCid(categoryId)); // model.addAttribute("homeImg",homeService.getImgByCid(categoryId));
// //
// if (!buildingCategoryDetails.isEmpty()) { // if (!buildingCategoryDetails.isEmpty()) {
// model.addAttribute("details", buildingCategoryDetails.get(0)); // Pass the first item to the model
// // model.addAttribute("subcategories", buildingCategoryDetails.get(0).get("Subcategories")); // Assuming you have a list of subcategories
// model.addAttribute("details", buildingCategoryDetails.get(0)); // Pass the
// first item to the model
// // model.addAttribute("subcategories",
// buildingCategoryDetails.get(0).get("Subcategories")); // Assuming you have a
// list of subcategories
// } // }
// return "user/booking"; // Return the view // return "user/booking"; // Return the view
// } // }
// @GetMapping("/book") // @GetMapping("/book")
// public String showCategoryPage(@RequestParam int buildingId,@RequestParam int categoryId, Model model) {
// List<Map<String, Object>> buildingCategoryDetails = buildingSer.getBuildingCategoryDetailsById(buildingId,categoryId); // Retrieve data
// public String showCategoryPage(@RequestParam int buildingId,@RequestParam int
// categoryId, Model model) {
// List<Map<String, Object>> buildingCategoryDetails =
// buildingSer.getBuildingCategoryDetailsById(buildingId,categoryId); //
// Retrieve data
// model.addAttribute("homeImg",homeService.getImgByCid(categoryId)); // model.addAttribute("homeImg",homeService.getImgByCid(categoryId));
// //
// if (!buildingCategoryDetails.isEmpty()) { // if (!buildingCategoryDetails.isEmpty()) {
// model.addAttribute("details", buildingCategoryDetails.get(0)); // Pass the first item to the model
// // model.addAttribute("subcategories", buildingCategoryDetails.get(0).get("Subcategories")); // Assuming you have a list of subcategories
// model.addAttribute("details", buildingCategoryDetails.get(0)); // Pass the
// first item to the model
// // model.addAttribute("subcategories",
// buildingCategoryDetails.get(0).get("Subcategories")); // Assuming you have a
// list of subcategories
// } // }
// return "user/booking"; // Return the view // return "user/booking"; // Return the view
// } // }
// Endpoint to fetch space content for AJAX // Endpoint to fetch space content for AJAX
// @GetMapping("/home/space") // @GetMapping("/home/space")
// public String getSpaceFragment(@RequestParam("cid") Integer cid, Model model) {
// public String getSpaceFragment(@RequestParam("cid") Integer cid, Model model)
// {
// List<Map<String, Object>> spaces = homeService.getActiveCoWorkingSpaces(); // List<Map<String, Object>> spaces = homeService.getActiveCoWorkingSpaces();
// // Filter the selected space // // Filter the selected space
@ -371,8 +378,6 @@ public List<Map<String, Object>> getPricingDetails(@RequestParam int cid) {
// return "fragments/spaceContent :: content"; // return "fragments/spaceContent :: content";
// } // }
// @GetMapping("/home/space") // @GetMapping("/home/space")
// public String getSpaceFragment(@RequestParam("cid") Integer cid, // public String getSpaceFragment(@RequestParam("cid") Integer cid,
// @RequestParam("bid") Integer bid, // @RequestParam("bid") Integer bid,
@ -390,8 +395,6 @@ public List<Map<String, Object>> getPricingDetails(@RequestParam int cid) {
// return "fragments/spaceContent :: content"; // return "fragments/spaceContent :: content";
// } // }
@GetMapping("/home/space") @GetMapping("/home/space")
public String getSpaceFragment(@RequestParam("cid") Integer cid, public String getSpaceFragment(@RequestParam("cid") Integer cid,
@RequestParam("bid") Integer bid, @RequestParam("bid") Integer bid,
@ -415,13 +418,13 @@ public String getSpaceFragment(@RequestParam("cid") Integer cid,
return "fragments/spaceContent :: content"; return "fragments/spaceContent :: content";
} }
// @GetMapping("/home/space") // @GetMapping("/home/space")
// public String getSpaceFragment(@RequestParam("cid") Integer cid, // public String getSpaceFragment(@RequestParam("cid") Integer cid,
// @RequestParam("bid") Integer bid, // @RequestParam("bid") Integer bid,
// Model model) { // Model model) {
// List<Map<String, Object>> pricingDetails = homeService.getPricingDetailsByCid(cid);
// List<Map<String, Object>> pricingDetails =
// homeService.getPricingDetailsByCid(cid);
// List<Map<String, Object>> images = homeService.getImgByCid(cid); // List<Map<String, Object>> images = homeService.getImgByCid(cid);
// model.addAttribute("pricingDetails", pricingDetails); // model.addAttribute("pricingDetails", pricingDetails);
@ -430,10 +433,6 @@ public String getSpaceFragment(@RequestParam("cid") Integer cid,
// return "fragments/spaceContent :: content"; // return "fragments/spaceContent :: content";
// } // }
@GetMapping("/registercomplaint") @GetMapping("/registercomplaint")
public String registercomplaint(Model model, HttpSession session) { public String registercomplaint(Model model, HttpSession session) {
String userName = (String) session.getAttribute("user_name"); String userName = (String) session.getAttribute("user_name");
@ -476,7 +475,6 @@ public String getSpaceFragment(@RequestParam("cid") Integer cid,
} }
} }
model.addAttribute("complaintlist", complaintlist); model.addAttribute("complaintlist", complaintlist);
model.addAttribute("closedcomplaintlist", closedcomplaintlist); model.addAttribute("closedcomplaintlist", closedcomplaintlist);
@ -523,18 +521,19 @@ public String getSpaceFragment(@RequestParam("cid") Integer cid,
// checklist // checklist
/* /*
@GetMapping("/CheckList")
public String CheckList(Model model, HttpSession session) {
String userName = (String) session.getAttribute("user_name");
// Check if the user is logged in
if (userName != null && !userName.isEmpty()) {
model.addAttribute("user_name", userName);
return "caretaker/CheckList"; // Render the report page
} else {
return "redirect:/muthalvarpadaippagam/officiallogin"; // Redirect to login if not logged in
}
}
* @GetMapping("/CheckList")
* public String CheckList(Model model, HttpSession session) {
* String userName = (String) session.getAttribute("user_name");
*
* // Check if the user is logged in
* if (userName != null && !userName.isEmpty()) {
* model.addAttribute("user_name", userName);
* return "caretaker/CheckList"; // Render the report page
* } else {
* return "redirect:/muthalvarpadaippagam/officiallogin"; // Redirect to login
* if not logged in
* }
* }
*/ */
@GetMapping("/CheckList") @GetMapping("/CheckList")
public String CheckList(Model model, HttpSession session) { public String CheckList(Model model, HttpSession session) {
@ -553,6 +552,7 @@ public String getSpaceFragment(@RequestParam("cid") Integer cid,
return "redirect:/muthalvarpadaippagam/officiallogin"; // Redirect to login if not logged in return "redirect:/muthalvarpadaippagam/officiallogin"; // Redirect to login if not logged in
} }
} }
// CheckListReport // CheckListReport
@GetMapping("/CheckListReport") @GetMapping("/CheckListReport")
public String CheckListReport(Model model, HttpSession session) { public String CheckListReport(Model model, HttpSession session) {
@ -568,13 +568,17 @@ public String getSpaceFragment(@RequestParam("cid") Integer cid,
} }
// @GetMapping("/book") // @GetMapping("/book")
// public String showCategoryPage(@RequestParam int buildingId,@RequestParam int categoryId, Model model) {
// public String showCategoryPage(@RequestParam int buildingId,@RequestParam int
// categoryId, Model model) {
// String url=""; // String url="";
// List<Map<String, Object>> buildingCategoryDetails = buildingSer.getBuildingCategoryDetailsById(buildingId,categoryId); // Retrieve data
// List<Map<String, Object>> buildingCategoryDetails =
// buildingSer.getBuildingCategoryDetailsById(buildingId,categoryId); //
// Retrieve data
// model.addAttribute("homeImg",homeService.getImgByCid(categoryId)); // model.addAttribute("homeImg",homeService.getImgByCid(categoryId));
// if (!buildingCategoryDetails.isEmpty()) { // if (!buildingCategoryDetails.isEmpty()) {
// model.addAttribute("details", buildingCategoryDetails.get(0)); // Pass the first item to the model
// model.addAttribute("details", buildingCategoryDetails.get(0)); // Pass the
// first item to the model
// } // }
// // if(categoryId==1) { // Reading / Leaning Zone // // if(categoryId==1) { // Reading / Leaning Zone
// // url = "user/book-reading"; // Return the view // // url = "user/book-reading"; // Return the view
@ -594,7 +598,8 @@ public String getSpaceFragment(@RequestParam("cid") Integer cid,
// case 2 -> url = "user/book-workdesk"; // case 2 -> url = "user/book-workdesk";
// case 3 -> url = "user/book-conference"; // case 3 -> url = "user/book-conference";
// case 4 -> url = "user/book-learning"; // optional if you add more later // case 4 -> url = "user/book-learning"; // optional if you add more later
// default -> throw new IllegalArgumentException("Invalid category ID: " + categoryId);
// default -> throw new IllegalArgumentException("Invalid category ID: " +
// categoryId);
// } // }
// // ✅ Pass IDs for dynamic usage in JavaScript // // ✅ Pass IDs for dynamic usage in JavaScript
@ -604,12 +609,11 @@ public String getSpaceFragment(@RequestParam("cid") Integer cid,
// return url; // return url;
// } // }
////////// existing code for /book with subId handling ////////// existing code for /book with subId handling
// @GetMapping("/book") // @GetMapping("/book")
// public String getCategoryPageGet(@RequestParam(value = "buildingId", required = false) Integer buildingId,
// public String getCategoryPageGet(@RequestParam(value = "buildingId", required
// = false) Integer buildingId,
// @RequestParam(value = "categoryId", required = false) Integer categoryId, // @RequestParam(value = "categoryId", required = false) Integer categoryId,
// @RequestParam(value = "subId", required = false) Integer subId, // @RequestParam(value = "subId", required = false) Integer subId,
// Model model) { // Model model) {
@ -622,7 +626,6 @@ public String getSpaceFragment(@RequestParam("cid") Integer cid,
// return showCategoryPage(buildingId, categoryId, subId, model); // return showCategoryPage(buildingId, categoryId, subId, model);
// } // }
// //added by yogi // //added by yogi
// @PostMapping("/book") // @PostMapping("/book")
// public String showCategoryPagePost(@RequestParam int buildingId, // public String showCategoryPagePost(@RequestParam int buildingId,
@ -633,12 +636,6 @@ public String getSpaceFragment(@RequestParam("cid") Integer cid,
// return showCategoryPage(buildingId, categoryId, subId, model); // return showCategoryPage(buildingId, categoryId, subId, model);
// } // }
// @GetMapping("/book") // @GetMapping("/book")
// public String showCategoryPage(@RequestParam int buildingId, // public String showCategoryPage(@RequestParam int buildingId,
// @RequestParam int categoryId, // @RequestParam int categoryId,
@ -685,13 +682,13 @@ public String getSpaceFragment(@RequestParam("cid") Integer cid,
// case 2 -> "user/book-workdesk"; // case 2 -> "user/book-workdesk";
// case 3 -> "user/book-Conferance"; // case 3 -> "user/book-Conferance";
// case 4 -> "user/book-reading"; // case 4 -> "user/book-reading";
// default -> throw new IllegalArgumentException("Invalid category ID: " + categoryId);
// default -> throw new IllegalArgumentException("Invalid category ID: " +
// categoryId);
// }; // };
// return url; // return url;
// } // }
// --------------------- GET : Visible URL --------------------- // --------------------- GET : Visible URL ---------------------
@GetMapping("/book") @GetMapping("/book")
public String getCategoryPage(@RequestParam(value = "buildingId", required = false) Integer buildingId, public String getCategoryPage(@RequestParam(value = "buildingId", required = false) Integer buildingId,
@ -702,42 +699,47 @@ public String getCategoryPage(@RequestParam(value = "buildingId" ,required = fal
if (buildingId == null || categoryId == null) { if (buildingId == null || categoryId == null) {
return "redirect:/muthalvarpadaippagam"; return "redirect:/muthalvarpadaippagam";
} }
if (!bookingService.checkbuildingbycat(categoryId, buildingId, subId)) {
return "redirect:/muthalvarpadaippagam";
}
try {
return showCategoryPage(buildingId, categoryId, subId, model); return showCategoryPage(buildingId, categoryId, subId, model);
} catch (Exception e) {
e.printStackTrace(); // for debugging
return "redirect:/muthalvarpadaippagam";
} }
// return showCategoryPage(buildingId, categoryId, subId, model);
}
// --------------------- POST : Hidden Form (no URL params) ---------------------
// --------------------- POST : Hidden Form (no URL params)
// ---------------------
@PostMapping("/book") @PostMapping("/book")
public String postCategoryPage(@RequestParam Integer buildingId, public String postCategoryPage(@RequestParam Integer buildingId,
@RequestParam Integer categoryId, @RequestParam Integer categoryId,
@RequestParam(required = false) Integer subId, @RequestParam(required = false) Integer subId,
Model model) { Model model) {
if (!bookingService.checkbuildingbycat(categoryId, buildingId, subId)) {
return "redirect:/muthalvarpadaippagam";
}
return showCategoryPage(buildingId, categoryId, subId, model); return showCategoryPage(buildingId, categoryId, subId, model);
} }
// --------------------- COMMON LOADING METHOD --------------------- // --------------------- COMMON LOADING METHOD ---------------------
private String showCategoryPage(int buildingId, private String showCategoryPage(int buildingId,
int categoryId, int categoryId,
Integer subId, Integer subId,
Model model) { Model model) {
List<Map<String, Object>> buildingCategoryDetails =
buildingSer.getBuildingCategoryDetailsById(buildingId, categoryId);
List<Map<String, Object>> buildingCategoryDetails = buildingSer.getBuildingCategoryDetailsById(buildingId,
categoryId);
model.addAttribute("homeImg", homeService.getImgByCid(categoryId)); model.addAttribute("homeImg", homeService.getImgByCid(categoryId));
String displayName = null; 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"); displayName = (String) firstRecord.get("Category_Display_Name");
@ -765,11 +767,10 @@ private String showCategoryPage(int buildingId,
// case 2 -> "user/book-workdesk"; // case 2 -> "user/book-workdesk";
// case 3 -> "user/book-Conferance"; // case 3 -> "user/book-Conferance";
// case 4 -> "user/book-reading"; // case 4 -> "user/book-reading";
// default -> throw new IllegalArgumentException("Invalid category ID: " + categoryId);
// default -> throw new IllegalArgumentException("Invalid category ID: " +
// categoryId);
// }; // };
if (displayName == null) { if (displayName == null) {
throw new IllegalArgumentException("Category name not found"); throw new IllegalArgumentException("Category name not found");
} }
@ -784,9 +785,6 @@ private String showCategoryPage(int buildingId,
return url; return url;
} }
// @GetMapping("/book") // @GetMapping("/book")
// public String showCategoryPage( // public String showCategoryPage(
// @RequestParam int buildingId, // @RequestParam int buildingId,
@ -794,7 +792,8 @@ private String showCategoryPage(int buildingId,
// Model model) { // Model model) {
// // Fetch building + category + subcategory + slot info // // Fetch building + category + subcategory + slot info
// List<Map<String, Object>> buildingCategoryDetails = buildingSer.getBuildingCategoryDetailsById(buildingId, categoryId);
// List<Map<String, Object>> buildingCategoryDetails =
// buildingSer.getBuildingCategoryDetailsById(buildingId, categoryId);
// model.addAttribute("homeImg", homeService.getImgByCid(categoryId)); // model.addAttribute("homeImg", homeService.getImgByCid(categoryId));
// if (!buildingCategoryDetails.isEmpty()) { // if (!buildingCategoryDetails.isEmpty()) {
@ -812,7 +811,6 @@ private String showCategoryPage(int buildingId,
// return viewName; // return viewName;
// } // }
@GetMapping("/subcategory-display-names") @GetMapping("/subcategory-display-names")
public String showSubcategoryDisplayNames(@RequestParam Model model) { public String showSubcategoryDisplayNames(@RequestParam Model model) {
List<Map<String, Object>> displayNames = buildingSer.getSubcategoryDisplayNames(); List<Map<String, Object>> displayNames = buildingSer.getSubcategoryDisplayNames();
@ -820,7 +818,6 @@ private String showCategoryPage(int buildingId,
return "user/termsandconditions"; // Ensure this matches your Thymeleaf template file return "user/termsandconditions"; // Ensure this matches your Thymeleaf template file
} }
// @GetMapping("/bookingdetails") // @GetMapping("/bookingdetails")
// public String viewBookingDetails (Model model) { // public String viewBookingDetails (Model model) {
// return "user/bookingdetails";} // return "user/bookingdetails";}
@ -846,7 +843,6 @@ private String showCategoryPage(int buildingId,
} }
} }
@GetMapping("/officiallogin") @GetMapping("/officiallogin")
public String officiallogin(HttpServletResponse response, Model model) { public String officiallogin(HttpServletResponse response, Model model) {
setNoCacheHeaders(response); setNoCacheHeaders(response);
@ -888,7 +884,8 @@ private String showCategoryPage(int buildingId,
} }
// @GetMapping("/Dashboard") // @GetMapping("/Dashboard")
// public String Dashboard ( Model model,HttpSession httpSession, HttpServletResponse response) {
// public String Dashboard ( Model model,HttpSession httpSession,
// HttpServletResponse response) {
// String userName = (String) httpSession.getAttribute("user_name"); // String userName = (String) httpSession.getAttribute("user_name");
// Integer bid = bookingService.getBidByUserName(userName); // Integer bid = bookingService.getBidByUserName(userName);
@ -912,7 +909,8 @@ private String showCategoryPage(int buildingId,
// model.addAttribute("user_name", userName); // model.addAttribute("user_name", userName);
// return "caretaker/report"; // Render the report page // return "caretaker/report"; // Render the report page
// } else { // } else {
// return "redirect:/muthalvarpadaippagam/officiallogin"; // Redirect to login if not logged in
// return "redirect:/muthalvarpadaippagam/officiallogin"; // Redirect to login
// if not logged in
// } // }
// } // }
@ -925,11 +923,11 @@ private String showCategoryPage(int buildingId,
// model.addAttribute("user_name", userName); // model.addAttribute("user_name", userName);
// return "caretaker/abstract"; // Render the report page // return "caretaker/abstract"; // Render the report page
// } else { // } else {
// return "redirect:/muthalvarpadaippagam/officiallogin"; // Redirect to login if not logged in
// return "redirect:/muthalvarpadaippagam/officiallogin"; // Redirect to login
// if not logged in
// } // }
// } // }
// added by yogi // added by yogi
@GetMapping("/Dashboard") @GetMapping("/Dashboard")
public String Dashboard(Model model, HttpSession httpSession, HttpServletResponse response) { public String Dashboard(Model model, HttpSession httpSession, HttpServletResponse response) {

708
src/main/java/com/gcc/coworkspace/service/BookingService.java

@ -37,7 +37,6 @@ import java.time.format.DateTimeParseException;
import java.io.*; import java.io.*;
import javax.imageio.ImageIO; import javax.imageio.ImageIO;
import javax.imageio.ImageWriteParam; import javax.imageio.ImageWriteParam;
import javax.imageio.ImageWriter; import javax.imageio.ImageWriter;
@ -100,7 +99,6 @@ public class BookingService {
ORDER BY id DESC ORDER BY id DESC
"""; """;
try { try {
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
@ -165,37 +163,37 @@ public class BookingService {
sql, sql,
Integer.class, Integer.class,
today, today,
buildingid
);
buildingid);
return count != null && count > 0; return count != null && count > 0;
} }
/* /*
public Boolean checkAvailabilityByBdate(int bid,int cid,LocalDate Bdate,int scid,int noOfPerson,int slotId){
Map<String,Object> getcalendar = getCalendarBySlotId(bid,cid,Bdate,slotId);
Map<String,Object> capacity= getCapacity( scid, cid);
int capsint = Integer.parseInt(capacity.get("limits").toString());
int capacityint = Integer.parseInt(capacity.get("capacity").toString());
System.out.println("capsint: "+capsint);
System.out.println("capacityint: "+capacityint);
if(capacityint<1) {
return true;
}
if(!getcalendar.isEmpty()){
int count= Integer.parseInt(getcalendar.get("filed")+"") + noOfPerson;
System.out.println("count: "+count);
if(count > capacityint ){
return true;
}
return false;
}
return false;
}
* public Boolean checkAvailabilityByBdate(int bid,int cid,LocalDate Bdate,int
* scid,int noOfPerson,int slotId){
*
* Map<String,Object> getcalendar = getCalendarBySlotId(bid,cid,Bdate,slotId);
* Map<String,Object> capacity= getCapacity( scid, cid);
*
* int capsint = Integer.parseInt(capacity.get("limits").toString());
* int capacityint = Integer.parseInt(capacity.get("capacity").toString());
*
* System.out.println("capsint: "+capsint);
* System.out.println("capacityint: "+capacityint);
* if(capacityint<1) {
* return true;
* }
* if(!getcalendar.isEmpty()){
* int count= Integer.parseInt(getcalendar.get("filed")+"") + noOfPerson;
* System.out.println("count: "+count);
* if(count > capacityint ){
* return true;
* }
*
* return false;
* }
*
* return false;
* }
*/ */
private int getacountfromtable(int bid) { private int getacountfromtable(int bid) {
@ -222,7 +220,6 @@ public class BookingService {
int capsint = Integer.parseInt(capacity.get("limits").toString()); int capsint = Integer.parseInt(capacity.get("limits").toString());
int capacityint = Integer.parseInt(capacity.get("capacity").toString()); int capacityint = Integer.parseInt(capacity.get("capacity").toString());
System.out.println("capsint: " + capsint); System.out.println("capsint: " + capsint);
System.out.println("capacityint: " + capacityint); System.out.println("capacityint: " + capacityint);
if (capacityint < 1) { if (capacityint < 1) {
@ -257,16 +254,20 @@ public class BookingService {
return false; return false;
} }
public Map<String, Object> getCapacity(int sId, int catId) { public Map<String, Object> getCapacity(int sId, int catId) {
System.out.println("sid" + sId);
System.out.println("catId" + catId);
String sql = "select limits, capacity from subcategory where scid = ? and cid = ?"; String sql = "select limits, capacity from subcategory where scid = ? and cid = ?";
System.out.println("select limits, capacity from subcategory where scid = '"+sId+"' and cid = '"+catId+"'");
System.out.println(
"select limits, capacity from subcategory where scid = '" + sId + "' and cid = '" + catId + "'");
try { try {
return jdbcTemplate.queryForMap(sql, sId, catId); return jdbcTemplate.queryForMap(sql, sId, catId);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
return Collections.singletonMap("error", "An error occurred while getting capacity.");
return Collections.singletonMap("error",
"An error occurred while getting capacity.");
} }
} }
public Map<String, Object> getCalendarBySlotId(int bid, int cid, LocalDate Bdate, int slotId) { public Map<String, Object> getCalendarBySlotId(int bid, int cid, LocalDate Bdate, int slotId) {
@ -279,26 +280,27 @@ public class BookingService {
+ "group by bdate"; + "group by bdate";
System.out.println("select sum(bcount) as filed, bdate " System.out.println("select sum(bcount) as filed, bdate "
+ "from calendar where bdate = '"+Bdate+"' and cid = "+cid+" and bid = "+bid+" and slotId IN ("+slotId+",8,9) "
+ "from calendar where bdate = '" + Bdate + "' and cid = " + cid + " and bid = " + bid
+ " and slotId IN (" + slotId + ",8,9) "
+ "group by bdate"); + "group by bdate");
}
else {
} else {
sql = "select sum(bcount) as filed, bdate " sql = "select sum(bcount) as filed, bdate "
+ "from calendar where (bdate = ? and cid = ? and bid = ?) or (0=?) " + "from calendar where (bdate = ? and cid = ? and bid = ?) or (0=?) "
+ "group by bdate"; + "group by bdate";
System.out.println("select slotid, sum(bcount) as filed, bdate " System.out.println("select slotid, sum(bcount) as filed, bdate "
+ "from calendar where (bdate = '"+Bdate+"' and cid = "+cid+" and bid = "+bid+") or (0="+slotId+") "
+ "from calendar where (bdate = '" + Bdate + "' and cid = " + cid + " and bid = " + bid
+ ") or (0=" + slotId + ") "
+ "group by bdate"); + "group by bdate");
} }
}
else {
} else {
sql = "select sum(bcount) as filed, bdate " sql = "select sum(bcount) as filed, bdate "
+ "from calendar where bdate = ? and cid = ? and bid = ? and slotId = ? " + "from calendar where bdate = ? and cid = ? and bid = ? and slotId = ? "
+ "group by slotid, bdate"; + "group by slotid, bdate";
System.out.println("select sum(bcount) as filed, bdate " System.out.println("select sum(bcount) as filed, bdate "
+ "from calendar where bdate = '"+Bdate+"' and cid = '"+cid+"' and bid = '"+bid+"' and slotId = '"+slotId+"' "
+ "from calendar where bdate = '" + Bdate + "' and cid = '" + cid + "' and bid = '" + bid
+ "' and slotId = '" + slotId + "' "
+ "group by bdate"); + "group by bdate");
} }
@ -318,10 +320,127 @@ public class BookingService {
return result.get(0); // Return the first (and expected only) result return result.get(0); // Return the first (and expected only) result
} }
/*
* public boolean checkbuildingbycat(int cid, int bid,int subid) {
* String sql =
* "select count(bid) as total from category where (cid = ? and bid = ?) AND (isactive=1 and isdelete=0)"
* ;
* try {
* Map<String, Object> result = jdbcTemplate.queryForMap(sql, cid, bid);
* return Integer.parseInt(result.get("total") + "") > 0;
* } catch (Exception e) {
* e.printStackTrace();
* return false;
* }
* }
*/
public boolean checkCategoryAgainstSubCategory(int cid, int bid, int subid) {
String sql = "SELECT COUNT(*) " +
"FROM category c " +
"INNER JOIN subcategory sc ON sc.cid = c.cid " +
"WHERE c.cid = ? " +
"AND c.bid = ? " +
"AND sc.scid = ? " +
"AND c.isactive = 1 " +
"AND c.isdelete = 0 " +
"AND sc.isactive = 1 " +
"AND sc.isdelete = 0";
try {
Integer total = jdbcTemplate.queryForObject(
sql,
Integer.class,
cid,
bid,
subid);
return total != null && total > 0;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
public boolean checkbuildingbycat(int cid, int bid, int subid) {
String sql = "SELECT COUNT(*) " +
"FROM subcategory sc " +
"JOIN category c ON c.cid = sc.cid " +
"WHERE sc.scid = ? " +
"AND c.cid = ? " +
"AND c.bid = ? " +
"AND sc.isactive = 1 " +
"AND sc.isdelete = 0 " +
"AND c.isactive = 1 " +
"AND c.isdelete = 0";
try {
Integer total = jdbcTemplate.queryForObject(
sql,
Integer.class,
subid,
cid,
bid);
return total != null && total > 0;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
/*
* public boolean checkbuildingbycat(int cid, int bid, int subid) {
*
* String sql = "SELECT COUNT(c.bid) " +
* "FROM category c " +
* "INNER JOIN subcategory sc ON sc.cid = c.cid " +
* "WHERE c.cid = ? " +
* "AND c.bid = ? " +
* "AND sc.scid = ? " +
* "AND c.isactive = 1 " +
* "AND c.isdelete = 0";
*
* try {
* Integer total = jdbcTemplate.queryForObject(
* sql,
* Integer.class,
* cid,
* bid,
* subid);
*
* return total != null && total > 0;
*
* } catch (Exception e) {
* e.printStackTrace();
* return false;
* }
* }
*/
/*
* public boolean checkbuildingbycat(int cid, int bid) {
* String sql = "SELECT COUNT(bid) FROM category " +
* "WHERE cid = ? AND bid = ? AND isactive = 1 AND isdelete = 0";
*
* try {
* Integer total = jdbcTemplate.queryForObject(sql, Integer.class, cid, bid);
* return total != null && total > 0;
* } catch (Exception e) {
* e.printStackTrace();
* return false;
* }
* }
*/
public Map<String, Object> saveTempBooking(String userName, long userMobile, public Map<String, Object> saveTempBooking(String userName, long userMobile,
List<Integer> slots, LocalDate fromDate, LocalDate toDate, List<Integer> slots, LocalDate fromDate, LocalDate toDate,
int noOfPeople, int catId, int buildId, int subId) { int noOfPeople, int catId, int buildId, int subId) {
if (!checkbuildingbycat(catId, buildId, subId)) {
System.out.println("checkbuildingbycat(catId, buildId)" + checkbuildingbycat(catId, buildId, subId));
throw new NoSlotAvailable("Selected building is not available for this category");
}
List<LocalDate> btnDates = getDatesBetween(fromDate, toDate); List<LocalDate> btnDates = getDatesBetween(fromDate, toDate);
double amount = 0; double amount = 0;
@ -333,8 +452,7 @@ public class BookingService {
if (amt != null && !amt.isEmpty()) { if (amt != null && !amt.isEmpty()) {
if (catId != 3) { if (catId != 3) {
amount = amount + (Double.parseDouble(amt.get("amount") + "") * noOfPeople); amount = amount + (Double.parseDouble(amt.get("amount") + "") * noOfPeople);
}
else {
} else {
amount = amount + (Double.parseDouble(amt.get("amount") + "") * 1); amount = amount + (Double.parseDouble(amt.get("amount") + "") * 1);
} }
for (LocalDate date : btnDates) { for (LocalDate date : btnDates) {
@ -376,7 +494,6 @@ public class BookingService {
int noOfPeople, int catId, int buildId, int subId, double amount) { int noOfPeople, int catId, int buildId, int subId, double amount) {
// Join the slots with commas // Join the slots with commas
String sqlQuery = "INSERT INTO temp_booking (user_name, mobile, slotids, from_date, to_date, no_of_person, amount, cid, bid, sid) " String sqlQuery = "INSERT INTO temp_booking (user_name, mobile, slotids, from_date, to_date, no_of_person, amount, cid, bid, sid) "
+ "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ? )"; + "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ? )";
@ -487,6 +604,12 @@ public class BookingService {
if (affectedRows > 0) { if (affectedRows > 0) {
Number generatedId = keyHolder.getKey(); Number generatedId = keyHolder.getKey();
bookingId = (generatedId != null) ? generatedId.intValue() : 0; bookingId = (generatedId != null) ? generatedId.intValue() : 0;
// ak
Map<String, Object> buildingDetails = getBuildingDetails(bid);
System.out.println("buildingDetails :" + buildingDetails);
String smsename = buildingDetails.get("smsename").toString();
// String smstname = buildingDetails.get("smstname").toString();
paymentService.updateBookingIdInPayment( paymentService.updateBookingIdInPayment(
tempBooking.get("mobile").toString(), tempBooking.get("mobile").toString(),
@ -498,10 +621,12 @@ public class BookingService {
tempBooking.get("slotIds").toString(), tempBooking.get("slotIds").toString(),
tempBooking.get("bid").toString(), tempBooking.get("bid").toString(),
tempBooking.get("cid").toString(), tempBooking.get("cid").toString(),
tempBooking.get("sid").toString()
);
tempBooking.get("sid").toString());
sendMessage(user_name,mobile,slotIds,from_date,to_date,no_of_person,amount,cid,bid,sid,bookingId+""); // Sending Message to public
// sendMessage(user_name,mobile,slotIds,from_date,to_date,no_of_person,amount,cid,bid,sid,bookingId+"");
// // Sending Message to public
sendMessage(user_name, mobile, slotIds, from_date, to_date, no_of_person, amount, cid, bid, sid,
smsename, bookingId + ""); // Sending Message to public
return bookingId; return bookingId;
} else { } else {
@ -524,9 +649,16 @@ public class BookingService {
} }
} }
// ak
public Map<String, Object> getBuildingDetails(String bid) {
String sql = "SELECT smsename FROM buildings WHERE bid = ?";
return jdbcTemplate.queryForMap(sql, bid);
}
@Transactional @Transactional
public void sendMessage(String user_name, String mobile, String slotIds, String from_date, String to_date, public void sendMessage(String user_name, String mobile, String slotIds, String from_date, String to_date,
String no_of_person,String amount,String cid,String bid,String sid, String bookingId) {
String no_of_person, String amount, String cid, String bid, String sid, String smsename, String bookingId) {
// System.out.println("smsename :"+smsename);
String slottxt = ""; String slottxt = "";
slottxt = calendarService.getSlotText(slotIds); slottxt = calendarService.getSlotText(slotIds);
@ -534,29 +666,70 @@ public class BookingService {
// System.out.println("cid :"+cid); // System.out.println("cid :"+cid);
// System.out.println("sid :"+sid); // System.out.println("sid :"+sid);
// convert dates here
String fromDateFormatted = convertToDDMMYYYY(from_date);
String toDateFormatted = convertToDDMMYYYY(to_date);
/*
* if(cid.equals("1")|| cid.equals("4")) {
* whatsAppService.sendELearnNmsg(mobile, no_of_person, from_date, slottxt,
* amount, bookingId);
* whatsAppService.sendTLearnNmsg(mobile, no_of_person, from_date, slottxt,
* amount, bookingId);
* }
* else if(cid.equals("2")) {
* if(sid.equals("4")) {
* whatsAppService.sendEMonthDeskspaceNmsg(mobile, no_of_person, from_date,
* to_date, slottxt, amount, bookingId);
* whatsAppService.sendTMonthDeskspaceNmsg(mobile, no_of_person, from_date,
* to_date, slottxt, amount, bookingId);
* }
* else {
* whatsAppService.sendEDeskspaceNmsg(mobile, no_of_person, from_date, slottxt,
* amount, bookingId);
* whatsAppService.sendTDeskspaceNmsg(mobile, no_of_person, from_date, slottxt,
* amount, bookingId);
* }
* }
* else if(cid.equals("3")) {
* whatsAppService.sendEConfeNmsg(mobile, from_date, slottxt, amount,bookingId);
* whatsAppService.sendTConfeNmsg(mobile, from_date, slottxt, amount,bookingId);
* }
*/
if (cid.equals("1") || cid.equals("4")) { if (cid.equals("1") || cid.equals("4")) {
whatsAppService.sendELearnNmsg(mobile, no_of_person, from_date, slottxt, amount, bookingId);
whatsAppService.sendTLearnNmsg(mobile, no_of_person, from_date, slottxt, amount, bookingId);
}
else if(cid.equals("2")) {
whatsAppService.sendELearnNmsg(mobile, no_of_person, fromDateFormatted, slottxt, smsename, amount,
bookingId);
whatsAppService.sendTLearnNmsg(mobile, no_of_person, fromDateFormatted, slottxt, amount, bookingId);
} else if (cid.equals("2")) {
if (sid.equals("4")) { if (sid.equals("4")) {
whatsAppService.sendEMonthDeskspaceNmsg(mobile, no_of_person, from_date, to_date, slottxt, amount, bookingId);
whatsAppService.sendTMonthDeskspaceNmsg(mobile, no_of_person, from_date, to_date, slottxt, amount, bookingId);
whatsAppService.sendEMonthDeskspaceNmsg(mobile, no_of_person, fromDateFormatted, toDateFormatted,
slottxt, smsename, amount, bookingId);
whatsAppService.sendTMonthDeskspaceNmsg(mobile, no_of_person, fromDateFormatted, toDateFormatted,
slottxt, amount, bookingId);
} else {
whatsAppService.sendEDeskspaceNmsg(mobile, no_of_person, fromDateFormatted, slottxt, smsename, amount,
bookingId);
whatsAppService.sendTDeskspaceNmsg(mobile, no_of_person, fromDateFormatted, slottxt, amount, bookingId);
} }
else {
whatsAppService.sendEDeskspaceNmsg(mobile, no_of_person, from_date, slottxt, amount, bookingId);
whatsAppService.sendTDeskspaceNmsg(mobile, no_of_person, from_date, slottxt, amount, bookingId);
} else if (cid.equals("3")) {
whatsAppService.sendEConfeNmsg(mobile, fromDateFormatted, slottxt, smsename, amount, bookingId);
whatsAppService.sendTConfeNmsg(mobile, fromDateFormatted, slottxt, amount, bookingId);
} }
} }
else if(cid.equals("3")) {
whatsAppService.sendEConfeNmsg(mobile, from_date, slottxt, amount,bookingId);
whatsAppService.sendTConfeNmsg(mobile, from_date, slottxt, amount,bookingId);
// ak
private String convertToDDMMYYYY(String date) {
try {
LocalDate parsed = LocalDate.parse(date); // expects yyyy-MM-dd
return parsed.format(DateTimeFormatter.ofPattern("dd-MM-yyyy"));
} catch (Exception e) {
return date; // fallback if format is unexpected
} }
} }
@Transactional @Transactional
public void saveInBookingInCalendar(int bookingId,String fromDat,String toDat,String persons,String slotIds,String bid,String cid,String sid){
public void saveInBookingInCalendar(int bookingId, String fromDat, String toDat, String persons, String slotIds,
String bid, String cid, String sid) {
LocalDate fromDate = LocalDate.parse(fromDat); LocalDate fromDate = LocalDate.parse(fromDat);
LocalDate toDate = LocalDate.parse(toDat); LocalDate toDate = LocalDate.parse(toDat);
int noOfPeople = Integer.parseInt(persons); int noOfPeople = Integer.parseInt(persons);
@ -576,8 +749,7 @@ public class BookingService {
for (LocalDate date : btnDates) { for (LocalDate date : btnDates) {
if (checkAvailabilityByBdate(buildId, catId, date, subId, noOfPeople, slot)) { if (checkAvailabilityByBdate(buildId, catId, date, subId, noOfPeople, slot)) {
throw new NoSlotAvailable("Slot Occupied"); throw new NoSlotAvailable("Slot Occupied");
}
else {
} else {
saveInCalendar(buildId, catId, slot, bookingId, date, noOfPeople); saveInCalendar(buildId, catId, slot, bookingId, date, noOfPeople);
} }
} }
@ -587,7 +759,6 @@ public class BookingService {
updateBookingStatus(bookingId, "success"); updateBookingStatus(bookingId, "success");
} }
} }
public int saveInCalendar(int bid, int cid, int slotId, int bookId, LocalDate bDate, int noOfPeople) { public int saveInCalendar(int bid, int cid, int slotId, int bookId, LocalDate bDate, int noOfPeople) {
@ -639,7 +810,6 @@ public class BookingService {
} }
} }
@Transactional @Transactional
public int updateBookingStatus(int bookingId, String bookingStatus) { public int updateBookingStatus(int bookingId, String bookingStatus) {
// SQL UPDATE query with placeholders // SQL UPDATE query with placeholders
@ -702,12 +872,10 @@ public class BookingService {
"JOIN category c ON bd.cid = c.cid " + "JOIN category c ON bd.cid = c.cid " +
"WHERE bd.mobile = ? "; "WHERE bd.mobile = ? ";
return jdbcTemplate.queryForList(sqlQuery, mobile); return jdbcTemplate.queryForList(sqlQuery, mobile);
} }
// "AND (bd.from_date = CURDATE() OR bd.to_date = CURDATE()) "; // "AND (bd.from_date = CURDATE() OR bd.to_date = CURDATE()) ";
public List<Map<String, Object>> getBookingByMobileNo(long mobile) { public List<Map<String, Object>> getBookingByMobileNo(long mobile) {
String sqlQuery = "SELECT " + String sqlQuery = "SELECT " +
"DATE_FORMAT(bd.from_date, '%d-%m-%Y') AS from_date, " + "DATE_FORMAT(bd.from_date, '%d-%m-%Y') AS from_date, " +
@ -779,66 +947,68 @@ public class BookingService {
"JOIN category c ON bd.cid = c.cid " + "JOIN category c ON bd.cid = c.cid " +
"WHERE bd.booking_id = ?"; "WHERE bd.booking_id = ?";
return jdbcTemplate.queryForList(sqlQuery, booking_id); return jdbcTemplate.queryForList(sqlQuery, booking_id);
} }
/* /*
public List<Map<String, Object>> getQrPageByBookingId(int booking_id) {
String sqlQuery = "SELECT " +
"bd.from_date, " +
"bd.to_date, " +
"bd.booking_id, " +
"bd.user_name, " +
"bd.mobile, " +
"bd.amount, " +
"bd.payment_status, " +
"bd.no_of_person, " +
"bd.slotids, " +
"bu.name AS buildingname, " +
"st.name AS duration, " +
"c.name AS type, " +
"c.display_name AS type_name, " +
"SUBSTRING_INDEX(st.name, ' to ', 1) AS checkin, " +
"SUBSTRING_INDEX(st.name, ' to ', -1) AS checkout, " +
"TIMESTAMPDIFF(HOUR, " +
" STR_TO_DATE(SUBSTRING_INDEX(st.name, ' to ', 1), '%h:%i %p'), " +
" STR_TO_DATE(SUBSTRING_INDEX(st.name, ' to ', -1), '%h:%i %p')" +
") AS duration_hours, " +
"CASE " +
" WHEN bd.to_date < CURDATE() THEN 'Completed' " +
" WHEN (bd.from_date > CURDATE() or bd.to_date>CURDATE()) THEN 'Upcoming' " +
" ELSE 'Ongoing' " +
"END AS status " +
"FROM booking bd " +
"JOIN slots st ON bd.slotids = st.slotid " +
"JOIN buildings bu ON bd.bid = bu.bid " +
"JOIN category c ON bd.cid = c.cid " +
"WHERE bd.booking_id = ?";
return jdbcTemplate.queryForList(sqlQuery, booking_id);
}
* public List<Map<String, Object>> getQrPageByBookingId(int booking_id) {
* String sqlQuery = "SELECT " +
* "bd.from_date, " +
* "bd.to_date, " +
* "bd.booking_id, " +
* "bd.user_name, " +
* "bd.mobile, " +
* "bd.amount, " +
* "bd.payment_status, " +
* "bd.no_of_person, " +
* "bd.slotids, " +
* "bu.name AS buildingname, " +
* "st.name AS duration, " +
* "c.name AS type, " +
* "c.display_name AS type_name, " +
* "SUBSTRING_INDEX(st.name, ' to ', 1) AS checkin, " +
* "SUBSTRING_INDEX(st.name, ' to ', -1) AS checkout, " +
* "TIMESTAMPDIFF(HOUR, " +
* " STR_TO_DATE(SUBSTRING_INDEX(st.name, ' to ', 1), '%h:%i %p'), " +
* " STR_TO_DATE(SUBSTRING_INDEX(st.name, ' to ', -1), '%h:%i %p')" +
* ") AS duration_hours, " +
* "CASE " +
* " WHEN bd.to_date < CURDATE() THEN 'Completed' " +
* " WHEN (bd.from_date > CURDATE() or bd.to_date>CURDATE()) THEN 'Upcoming' "
* +
* " ELSE 'Ongoing' " +
* "END AS status " +
* "FROM booking bd " +
* "JOIN slots st ON bd.slotids = st.slotid " +
* "JOIN buildings bu ON bd.bid = bu.bid " +
* "JOIN category c ON bd.cid = c.cid " +
* "WHERE bd.booking_id = ?";
*
* return jdbcTemplate.queryForList(sqlQuery, booking_id);
* }
*
*/ */
// public String validateLogin(String usernametxt, String pin) { // public String validateLogin(String usernametxt, String pin) {
// // SQL query // // SQL query
// String sql = "SELECT * FROM login WHERE user_name = ? AND password = ? LIMIT 0,1";
// String sql = "SELECT * FROM login WHERE user_name = ? AND password = ? LIMIT
// 0,1";
// // Execute the query and pass mobileNo and pin as parameters // // Execute the query and pass mobileNo and pin as parameters
// List<Map<String, Object>> results = jdbcTemplate.queryForList(sql, usernametxt, pin);
// List<Map<String, Object>> results = jdbcTemplate.queryForList(sql,
// usernametxt, pin);
// // Check if any results were found // // Check if any results were found
// if (!results.isEmpty()) { // if (!results.isEmpty()) {
// Map<String, Object> login = results.get(0); // Map<String, Object> login = results.get(0);
// return (String) login.get("user_name"); // Assuming 'reference_name' is a column
// return (String) login.get("user_name"); // Assuming 'reference_name' is a
// column
// } else { // } else {
// return null; // Return null if no matching record was found // return null; // Return null if no matching record was found
// } // }
// } // }
public Map<String, Object> validateLogin(String username, String password) { public Map<String, Object> validateLogin(String username, String password) {
String sql = "SELECT user_name, bid FROM login WHERE user_name = ? AND password = ? LIMIT 1"; String sql = "SELECT user_name, bid FROM login WHERE user_name = ? AND password = ? LIMIT 1";
@ -860,57 +1030,60 @@ public class BookingService {
return jdbcTemplate.queryForList(sql, selectedDate, scid); return jdbcTemplate.queryForList(sql, selectedDate, scid);
} }
/*public List<Map<String, Object>> getbookingdetailDashBoard(String fromDate, String toDate, String status) {
StringBuilder sql = new StringBuilder(
"SELECT " +
"concat('#', bd.booking_id) AS booking_id, " +
"bd.user_name, " +
"bd.mobile, " +
"c.display_name AS type_name, " +
"st.name AS duration, " +
"DATE_FORMAT(bd.cdate, '%d-%m-%Y') AS booked_date, "+
"DATE_FORMAT(bd.from_date, '%d-%m-%Y') AS from_date, " +
"DATE_FORMAT(bd.to_date, '%d-%m-%Y') AS to_date, " +
"SUBSTRING_INDEX(st.name, ' to ', 1) AS checkin, " +
"SUBSTRING_INDEX(st.name, ' to ', -1) AS checkout, " +
"bd.no_of_person AS no_of_seats, " +
"bd.amount, " +
"CASE " +
" WHEN bd.to_date < CURDATE() THEN 'Completed' " +
" WHEN bd.from_date > CURDATE() THEN 'Upcoming' " +
" ELSE 'Ongoing' " +
"END AS status, " +
"TIMESTAMPDIFF(HOUR, " +
" STR_TO_DATE(SUBSTRING_INDEX(st.name, ' to ', 1), '%h:%i %p'), " +
" STR_TO_DATE(SUBSTRING_INDEX(st.name, ' to ', -1), '%h:%i %p') " +
") AS duration_hours " +
"FROM booking bd " +
"JOIN slots st ON bd.slotids = st.slotid " +
"JOIN buildings bu ON bd.bid = bu.bid " +
"JOIN category c ON bd.cid = c.cid " +
"WHERE DATE(bd.cdate) BETWEEN STR_TO_DATE(?, '%Y-%m-%d') AND STR_TO_DATE(?, '%Y-%m-%d') "
);
// Conditionally add the status filter
if (status != null && !status.isEmpty()) {
sql.append(" AND CASE " +
"WHEN bd.to_date < CURDATE() THEN 'Completed' " +
"WHEN bd.from_date > CURDATE() THEN 'Upcoming' " +
"ELSE 'Ongoing' END = ?");
}
// Prepare the parameters for the query
List<Object> params = new ArrayList<>();
params.add(fromDate);
params.add(toDate);
if (status != null && !status.isEmpty()) {
params.add(status);
}
// Execute the query with the constructed SQL and parameters
return jdbcTemplate.queryForList(sql.toString(), params.toArray());
}*/
/*
* public List<Map<String, Object>> getbookingdetailDashBoard(String fromDate,
* String toDate, String status) {
* StringBuilder sql = new StringBuilder(
* "SELECT " +
* "concat('#', bd.booking_id) AS booking_id, " +
* "bd.user_name, " +
* "bd.mobile, " +
* "c.display_name AS type_name, " +
* "st.name AS duration, " +
* "DATE_FORMAT(bd.cdate, '%d-%m-%Y') AS booked_date, "+
* "DATE_FORMAT(bd.from_date, '%d-%m-%Y') AS from_date, " +
* "DATE_FORMAT(bd.to_date, '%d-%m-%Y') AS to_date, " +
* "SUBSTRING_INDEX(st.name, ' to ', 1) AS checkin, " +
* "SUBSTRING_INDEX(st.name, ' to ', -1) AS checkout, " +
* "bd.no_of_person AS no_of_seats, " +
* "bd.amount, " +
* "CASE " +
* " WHEN bd.to_date < CURDATE() THEN 'Completed' " +
* " WHEN bd.from_date > CURDATE() THEN 'Upcoming' " +
* " ELSE 'Ongoing' " +
* "END AS status, " +
* "TIMESTAMPDIFF(HOUR, " +
* " STR_TO_DATE(SUBSTRING_INDEX(st.name, ' to ', 1), '%h:%i %p'), " +
* " STR_TO_DATE(SUBSTRING_INDEX(st.name, ' to ', -1), '%h:%i %p') " +
* ") AS duration_hours " +
* "FROM booking bd " +
* "JOIN slots st ON bd.slotids = st.slotid " +
* "JOIN buildings bu ON bd.bid = bu.bid " +
* "JOIN category c ON bd.cid = c.cid " +
* "WHERE DATE(bd.cdate) BETWEEN STR_TO_DATE(?, '%Y-%m-%d') AND STR_TO_DATE(?, '%Y-%m-%d') "
* );
*
* // Conditionally add the status filter
* if (status != null && !status.isEmpty()) {
* sql.append(" AND CASE " +
* "WHEN bd.to_date < CURDATE() THEN 'Completed' " +
* "WHEN bd.from_date > CURDATE() THEN 'Upcoming' " +
* "ELSE 'Ongoing' END = ?");
* }
*
* // Prepare the parameters for the query
* List<Object> params = new ArrayList<>();
* params.add(fromDate);
* params.add(toDate);
*
* if (status != null && !status.isEmpty()) {
* params.add(status);
* }
*
* // Execute the query with the constructed SQL and parameters
* return jdbcTemplate.queryForList(sql.toString(), params.toArray());
* }
*/
public List<Map<String, Object>> getbookingdetailDashBoard( public List<Map<String, Object>> getbookingdetailDashBoard(
String fromDate, String toDate, String status, int bid) { String fromDate, String toDate, String status, int bid) {
@ -966,26 +1139,35 @@ public class BookingService {
return jdbcTemplate.queryForList(sql.toString(), params.toArray()); return jdbcTemplate.queryForList(sql.toString(), params.toArray());
} }
/* public List<Map<String, Object>> getAmountCollectedByDate(LocalDate fromDate, LocalDate toDate) {
String sql = "SELECT COALESCE(SUM(b.amount), 0) AS overall_amount_collected, " +
"COALESCE(SUM(CASE WHEN b.sid = 1 THEN b.amount ELSE 0 END), 0) AS learning_zone_amount_collected, " +
"COALESCE(SUM(CASE WHEN b.sid IN (2, 3, 4) THEN b.amount ELSE 0 END), 0) AS desk_space_amount_collected, " +
"COALESCE(SUM(CASE WHEN b.sid IN (5, 6, 7) THEN b.amount ELSE 0 END), 0) AS meeting_room_amount_collected " +
"FROM booking b " +
"WHERE DATE(b.cdate) BETWEEN ? AND ? " +
"AND b.booking_status = 'success'";
System.err.println(sql + " " + fromDate + " to " + toDate);
return jdbcTemplate.queryForList(sql, fromDate, toDate);
}*/
/*
* public List<Map<String, Object>> getAmountCollectedByDate(LocalDate fromDate,
* LocalDate toDate) {
* String sql =
* "SELECT COALESCE(SUM(b.amount), 0) AS overall_amount_collected, " +
* "COALESCE(SUM(CASE WHEN b.sid = 1 THEN b.amount ELSE 0 END), 0) AS learning_zone_amount_collected, "
* +
* "COALESCE(SUM(CASE WHEN b.sid IN (2, 3, 4) THEN b.amount ELSE 0 END), 0) AS desk_space_amount_collected, "
* +
* "COALESCE(SUM(CASE WHEN b.sid IN (5, 6, 7) THEN b.amount ELSE 0 END), 0) AS meeting_room_amount_collected "
* +
* "FROM booking b " +
* "WHERE DATE(b.cdate) BETWEEN ? AND ? " +
* "AND b.booking_status = 'success'";
*
* System.err.println(sql + " " + fromDate + " to " + toDate);
* return jdbcTemplate.queryForList(sql, fromDate, toDate);
* }
*/
public List<Map<String, Object>> getAmountCollectedByDate(LocalDate fromDate, LocalDate toDate, int bid) { public List<Map<String, Object>> getAmountCollectedByDate(LocalDate fromDate, LocalDate toDate, int bid) {
String sql = "SELECT " + String sql = "SELECT " +
"b.bid, " + "b.bid, " +
"COALESCE(SUM(b.amount), 0) AS overall_amount_collected, " + "COALESCE(SUM(b.amount), 0) AS overall_amount_collected, " +
"COALESCE(SUM(CASE WHEN b.sid = 1 THEN b.amount ELSE 0 END), 0) AS learning_zone_amount_collected, " +
"COALESCE(SUM(CASE WHEN b.sid IN (2, 3, 4) THEN b.amount ELSE 0 END), 0) AS desk_space_amount_collected, " +
"COALESCE(SUM(CASE WHEN b.sid IN (5, 6, 7) THEN b.amount ELSE 0 END), 0) AS meeting_room_amount_collected " +
"COALESCE(SUM(CASE WHEN b.sid IN (1,8) THEN b.amount ELSE 0 END), 0) AS learning_zone_amount_collected, "
+
"COALESCE(SUM(CASE WHEN b.sid IN (2, 3, 4) THEN b.amount ELSE 0 END), 0) AS desk_space_amount_collected, "
+
"COALESCE(SUM(CASE WHEN b.sid IN (5, 6, 7) THEN b.amount ELSE 0 END), 0) AS meeting_room_amount_collected "
+
"FROM booking b " + "FROM booking b " +
"WHERE DATE(b.cdate) BETWEEN ? AND ? " + "WHERE DATE(b.cdate) BETWEEN ? AND ? " +
"AND b.booking_status = 'success' " + "AND b.booking_status = 'success' " +
@ -996,66 +1178,109 @@ public class BookingService {
return jdbcTemplate.queryForList(sql, fromDate, toDate, bid); return jdbcTemplate.queryForList(sql, fromDate, toDate, bid);
} }
/* /*
public List<Map<String, Object>> getBookingCountsByCategory(String fromDate, String toDate) {
String sql = "SELECT " +
"COALESCE(SUM(CASE WHEN sid = 1 AND slotids = 1 THEN no_of_person ELSE 0 END), 0) AS slotId_1_count, " +
"COALESCE(SUM(CASE WHEN sid = 1 AND slotids = 2 THEN no_of_person ELSE 0 END), 0) AS slotId_2_count, " +
"COALESCE(SUM(CASE WHEN sid = 1 AND slotids = 3 THEN no_of_person ELSE 0 END), 0) AS slotId_3_count, " +
"COALESCE(SUM(CASE WHEN sid = 1 AND slotids = 4 THEN no_of_person ELSE 0 END), 0) AS slotId_4_count, " +
"COALESCE(SUM(CASE WHEN sid = 1 AND slotids = 5 THEN no_of_person ELSE 0 END), 0) AS slotId_5_count, " +
"COALESCE(SUM(CASE WHEN sid IN (2, 3, 4) AND slotids IN (6, 7) THEN no_of_person ELSE 0 END), 0) AS half_day_count, " +
"COALESCE(SUM(CASE WHEN sid IN (2, 3, 4) AND slotids = 8 THEN no_of_person ELSE 0 END), 0) AS full_day_count, " +
"COALESCE(SUM(CASE WHEN sid IN (4) AND slotids = 9 THEN no_of_person ELSE 0 END), 0) AS monthly_count, " +
"COALESCE(SUM(CASE WHEN sid IN (5, 6, 7) AND slotids IN (10,11,12,13,14,15,16,17,18,19,20,21,22) THEN no_of_person ELSE 0 END), 0) AS RoomNo1_Count, " +
"COALESCE(SUM(CASE WHEN sid IN (5, 6, 7) AND slotids IN (23,24,25,26,27,28,29,30,31,32,33,34,35) THEN no_of_person ELSE 0 END), 0) AS RoomNo2_Count, " +
"COALESCE(SUM(CASE WHEN sid IN (5, 6, 7) AND slotids IN (36,37,38,39,40,41,42,43,44,45,46,47,48) THEN no_of_person ELSE 0 END), 0) AS RoomNo3_Count " +
"FROM booking " +
"WHERE booking_status = 'success' " +
"AND DATE(cdate) BETWEEN ? AND ?";
// Query and return result as a List of Maps
return jdbcTemplate.queryForList(sql, fromDate, toDate);
}
* public List<Map<String, Object>> getBookingCountsByCategory(String fromDate,
* String toDate) {
* String sql = "SELECT " +
* "COALESCE(SUM(CASE WHEN sid = 1 AND slotids = 1 THEN no_of_person ELSE 0 END), 0) AS slotId_1_count, "
* +
* "COALESCE(SUM(CASE WHEN sid = 1 AND slotids = 2 THEN no_of_person ELSE 0 END), 0) AS slotId_2_count, "
* +
* "COALESCE(SUM(CASE WHEN sid = 1 AND slotids = 3 THEN no_of_person ELSE 0 END), 0) AS slotId_3_count, "
* +
* "COALESCE(SUM(CASE WHEN sid = 1 AND slotids = 4 THEN no_of_person ELSE 0 END), 0) AS slotId_4_count, "
* +
* "COALESCE(SUM(CASE WHEN sid = 1 AND slotids = 5 THEN no_of_person ELSE 0 END), 0) AS slotId_5_count, "
* +
* "COALESCE(SUM(CASE WHEN sid IN (2, 3, 4) AND slotids IN (6, 7) THEN no_of_person ELSE 0 END), 0) AS half_day_count, "
* +
* "COALESCE(SUM(CASE WHEN sid IN (2, 3, 4) AND slotids = 8 THEN no_of_person ELSE 0 END), 0) AS full_day_count, "
* +
* "COALESCE(SUM(CASE WHEN sid IN (4) AND slotids = 9 THEN no_of_person ELSE 0 END), 0) AS monthly_count, "
* +
* "COALESCE(SUM(CASE WHEN sid IN (5, 6, 7) AND slotids IN (10,11,12,13,14,15,16,17,18,19,20,21,22) THEN no_of_person ELSE 0 END), 0) AS RoomNo1_Count, "
* +
* "COALESCE(SUM(CASE WHEN sid IN (5, 6, 7) AND slotids IN (23,24,25,26,27,28,29,30,31,32,33,34,35) THEN no_of_person ELSE 0 END), 0) AS RoomNo2_Count, "
* +
* "COALESCE(SUM(CASE WHEN sid IN (5, 6, 7) AND slotids IN (36,37,38,39,40,41,42,43,44,45,46,47,48) THEN no_of_person ELSE 0 END), 0) AS RoomNo3_Count "
* +
* "FROM booking " +
* "WHERE booking_status = 'success' " +
* "AND DATE(cdate) BETWEEN ? AND ?";
*
* // Query and return result as a List of Maps
* return jdbcTemplate.queryForList(sql, fromDate, toDate);
* }
*/ */
// previous // previous
/*public List<Map<String, Object>> getBookingCountsByCategory(String fromDate, String toDate) {
String sql = "SELECT " +
"COALESCE(SUM(CASE WHEN sid = 1 AND slotids = 1 THEN 1 ELSE 0 END), 0) AS slotId_1_count, " +
"COALESCE(SUM(CASE WHEN sid = 1 AND slotids = 2 THEN 1 ELSE 0 END), 0) AS slotId_2_count, " +
"COALESCE(SUM(CASE WHEN sid = 1 AND slotids = 3 THEN 1 ELSE 0 END), 0) AS slotId_3_count, " +
"COALESCE(SUM(CASE WHEN sid = 1 AND slotids = 4 THEN 1 ELSE 0 END), 0) AS slotId_4_count, " +
"COALESCE(SUM(CASE WHEN sid = 1 AND slotids = 5 THEN 1 ELSE 0 END), 0) AS slotId_5_count, " +
"COALESCE(SUM(CASE WHEN sid = 2 AND slotids IN (6, 7) THEN 1 ELSE 0 END), 0) AS half_day_count, " +
"COALESCE(SUM(CASE WHEN sid = 3 AND slotids = 8 THEN 1 ELSE 0 END), 0) AS full_day_count, " +
"COALESCE(SUM(CASE WHEN sid = 4 AND slotids = 9 THEN 1 ELSE 0 END), 0) AS monthly_count, " +
"COALESCE(SUM(CASE WHEN sid = 5 AND slotids IN (10,11,12,13,14,15,16,17,18,19,20,21,22) THEN 1 ELSE 0 END), 0) AS RoomNo1_Count, " +
"COALESCE(SUM(CASE WHEN sid = 6 AND slotids IN (23,24,25,26,27,28,29,30,31,32,33,34,35) THEN 1 ELSE 0 END), 0) AS RoomNo2_Count, " +
"COALESCE(SUM(CASE WHEN sid = 7 AND slotids IN (36,37,38,39,40,41,42,43,44,45,46,47,48) THEN 1 ELSE 0 END), 0) AS RoomNo3_Count " +
"FROM booking " +
"WHERE booking_status = 'success' " +
"AND DATE(cdate) BETWEEN ? AND ?";
/*
* public List<Map<String, Object>> getBookingCountsByCategory(String fromDate,
* String toDate) {
* String sql = "SELECT " +
* "COALESCE(SUM(CASE WHEN sid = 1 AND slotids = 1 THEN 1 ELSE 0 END), 0) AS slotId_1_count, "
* +
* "COALESCE(SUM(CASE WHEN sid = 1 AND slotids = 2 THEN 1 ELSE 0 END), 0) AS slotId_2_count, "
* +
* "COALESCE(SUM(CASE WHEN sid = 1 AND slotids = 3 THEN 1 ELSE 0 END), 0) AS slotId_3_count, "
* +
* "COALESCE(SUM(CASE WHEN sid = 1 AND slotids = 4 THEN 1 ELSE 0 END), 0) AS slotId_4_count, "
* +
* "COALESCE(SUM(CASE WHEN sid = 1 AND slotids = 5 THEN 1 ELSE 0 END), 0) AS slotId_5_count, "
* +
* "COALESCE(SUM(CASE WHEN sid = 2 AND slotids IN (6, 7) THEN 1 ELSE 0 END), 0) AS half_day_count, "
* +
* "COALESCE(SUM(CASE WHEN sid = 3 AND slotids = 8 THEN 1 ELSE 0 END), 0) AS full_day_count, "
* +
* "COALESCE(SUM(CASE WHEN sid = 4 AND slotids = 9 THEN 1 ELSE 0 END), 0) AS monthly_count, "
* +
* "COALESCE(SUM(CASE WHEN sid = 5 AND slotids IN (10,11,12,13,14,15,16,17,18,19,20,21,22) THEN 1 ELSE 0 END), 0) AS RoomNo1_Count, "
* +
* "COALESCE(SUM(CASE WHEN sid = 6 AND slotids IN (23,24,25,26,27,28,29,30,31,32,33,34,35) THEN 1 ELSE 0 END), 0) AS RoomNo2_Count, "
* +
* "COALESCE(SUM(CASE WHEN sid = 7 AND slotids IN (36,37,38,39,40,41,42,43,44,45,46,47,48) THEN 1 ELSE 0 END), 0) AS RoomNo3_Count "
* +
* "FROM booking " +
* "WHERE booking_status = 'success' " +
* "AND DATE(cdate) BETWEEN ? AND ?";
*
* // Query and return result as a List of Maps
* return jdbcTemplate.queryForList(sql, fromDate, toDate);
* }
*/
// Query and return result as a List of Maps
return jdbcTemplate.queryForList(sql, fromDate, toDate);
}*/
// working changed but build2 is not configured for charts
public List<Map<String, Object>> getBookingCountsByCategory(String fromDate, String toDate, int bid) { public List<Map<String, Object>> getBookingCountsByCategory(String fromDate, String toDate, int bid) {
String sql = "SELECT " + String sql = "SELECT " +
"COALESCE(SUM(CASE WHEN sid = 1 AND slotids = 1 THEN 1 ELSE 0 END), 0) AS slotId_1_count, " +
"COALESCE(SUM(CASE WHEN sid = 1 AND slotids = 2 THEN 1 ELSE 0 END), 0) AS slotId_2_count, " +
"COALESCE(SUM(CASE WHEN sid = 1 AND slotids = 3 THEN 1 ELSE 0 END), 0) AS slotId_3_count, " +
"COALESCE(SUM(CASE WHEN sid = 1 AND slotids = 4 THEN 1 ELSE 0 END), 0) AS slotId_4_count, " +
"COALESCE(SUM(CASE WHEN sid = 1 AND slotids = 5 THEN 1 ELSE 0 END), 0) AS slotId_5_count, " +
/*
* "COALESCE(SUM(CASE WHEN sid = 1 AND slotids = 1 THEN 1 ELSE 0 END), 0) AS slotId_1_count, "
* +
* "COALESCE(SUM(CASE WHEN sid = 1 AND slotids = 2 THEN 1 ELSE 0 END), 0) AS slotId_2_count, "
* +
* "COALESCE(SUM(CASE WHEN sid = 1 AND slotids = 3 THEN 1 ELSE 0 END), 0) AS slotId_3_count, "
* +
* "COALESCE(SUM(CASE WHEN sid = 1 AND slotids = 4 THEN 1 ELSE 0 END), 0) AS slotId_4_count, "
* +
* "COALESCE(SUM(CASE WHEN sid = 1 AND slotids = 5 THEN 1 ELSE 0 END), 0) AS slotId_5_count, "
* +
*/
"COALESCE(SUM(CASE WHEN sid in (1,8) AND slotids in (1,49) THEN 1 ELSE 0 END), 0) AS slotId_1_count, "
+
"COALESCE(SUM(CASE WHEN sid in (1,8) AND slotids in (2,50) THEN 1 ELSE 0 END), 0) AS slotId_2_count, " +
"COALESCE(SUM(CASE WHEN sid in (1,8) AND slotids in (3,51) THEN 1 ELSE 0 END), 0) AS slotId_3_count, " +
"COALESCE(SUM(CASE WHEN sid in (1,8) AND slotids in (4,52) THEN 1 ELSE 0 END), 0) AS slotId_4_count, " +
"COALESCE(SUM(CASE WHEN sid in (1,8) AND slotids in (5,53) THEN 1 ELSE 0 END), 0) AS slotId_5_count, " +
"COALESCE(SUM(CASE WHEN sid = 2 AND slotids IN (6,7) THEN 1 ELSE 0 END), 0) AS half_day_count, " + "COALESCE(SUM(CASE WHEN sid = 2 AND slotids IN (6,7) THEN 1 ELSE 0 END), 0) AS half_day_count, " +
"COALESCE(SUM(CASE WHEN sid = 3 AND slotids = 8 THEN 1 ELSE 0 END), 0) AS full_day_count, " + "COALESCE(SUM(CASE WHEN sid = 3 AND slotids = 8 THEN 1 ELSE 0 END), 0) AS full_day_count, " +
"COALESCE(SUM(CASE WHEN sid = 4 AND slotids = 9 THEN 1 ELSE 0 END), 0) AS monthly_count, " + "COALESCE(SUM(CASE WHEN sid = 4 AND slotids = 9 THEN 1 ELSE 0 END), 0) AS monthly_count, " +
"COALESCE(SUM(CASE WHEN sid = 5 AND slotids IN (10,11,12,13,14,15,16,17,18,19,20,21,22) THEN 1 ELSE 0 END), 0) AS RoomNo1_Count, " +
"COALESCE(SUM(CASE WHEN sid = 6 AND slotids IN (23,24,25,26,27,28,29,30,31,32,33,34,35) THEN 1 ELSE 0 END), 0) AS RoomNo2_Count, " +
"COALESCE(SUM(CASE WHEN sid = 7 AND slotids IN (36,37,38,39,40,41,42,43,44,45,46,47,48) THEN 1 ELSE 0 END), 0) AS RoomNo3_Count " +
"COALESCE(SUM(CASE WHEN sid = 5 AND slotids IN (10,11,12,13,14,15,16,17,18,19,20,21,22) THEN 1 ELSE 0 END), 0) AS RoomNo1_Count, "
+
"COALESCE(SUM(CASE WHEN sid = 6 AND slotids IN (23,24,25,26,27,28,29,30,31,32,33,34,35) THEN 1 ELSE 0 END), 0) AS RoomNo2_Count, "
+
"COALESCE(SUM(CASE WHEN sid = 7 AND slotids IN (36,37,38,39,40,41,42,43,44,45,46,47,48) THEN 1 ELSE 0 END), 0) AS RoomNo3_Count "
+
"FROM booking " + "FROM booking " +
"WHERE booking_status = 'success' " + "WHERE booking_status = 'success' " +
@ -1066,24 +1291,27 @@ public class BookingService {
} }
// previous // previous
/* public List<Map<String, Object>> getBookingCountsByDate(String fromDate, String toDate) {
// SQL query
String sql = "SELECT " +
"count(booking_id) AS Total_booking_count, " +
"SUM(CASE WHEN cid = 1 THEN 1 ELSE 0 END) AS Learning_zone_count, " +
"SUM(CASE WHEN cid = 2 THEN 1 ELSE 0 END) AS Desk_space_count, " +
"SUM(CASE WHEN cid = 3 THEN 1 ELSE 0 END) AS Meeting_room_count " +
"FROM booking " +
"WHERE booking_status = 'success' and DATE(cdate) BETWEEN ? AND ?";
// Query and return result as a Map
return jdbcTemplate.queryForList(sql,fromDate,toDate);
}*/
/*
* public List<Map<String, Object>> getBookingCountsByDate(String fromDate,
* String toDate) {
* // SQL query
* String sql = "SELECT " +
* "count(booking_id) AS Total_booking_count, " +
* "SUM(CASE WHEN cid = 1 THEN 1 ELSE 0 END) AS Learning_zone_count, " +
* "SUM(CASE WHEN cid = 2 THEN 1 ELSE 0 END) AS Desk_space_count, " +
* "SUM(CASE WHEN cid = 3 THEN 1 ELSE 0 END) AS Meeting_room_count " +
* "FROM booking " +
* "WHERE booking_status = 'success' and DATE(cdate) BETWEEN ? AND ?";
*
* // Query and return result as a Map
* return jdbcTemplate.queryForList(sql,fromDate,toDate);
* }
*/
public List<Map<String, Object>> getBookingCountsByDate(String fromDate, String toDate, int bid) { public List<Map<String, Object>> getBookingCountsByDate(String fromDate, String toDate, int bid) {
String sql = "SELECT " + String sql = "SELECT " +
"COUNT(booking_id) AS Total_booking_count, " + "COUNT(booking_id) AS Total_booking_count, " +
"SUM(CASE WHEN cid = 1 THEN 1 ELSE 0 END) AS Learning_zone_count, " +
"SUM(CASE WHEN cid in (1,4) THEN 1 ELSE 0 END) AS Learning_zone_count, " +
"SUM(CASE WHEN cid = 2 THEN 1 ELSE 0 END) AS Desk_space_count, " + "SUM(CASE WHEN cid = 2 THEN 1 ELSE 0 END) AS Desk_space_count, " +
"SUM(CASE WHEN cid = 3 THEN 1 ELSE 0 END) AS Meeting_room_count " + "SUM(CASE WHEN cid = 3 THEN 1 ELSE 0 END) AS Meeting_room_count " +
"FROM booking " + "FROM booking " +
@ -1095,10 +1323,12 @@ public class BookingService {
} }
// ak // ak
/* public List<Map<String, Object>> getBidByUserName(String userName) {
String sql = "SELECT bid FROM login WHERE user_name = ?";
return jdbcTemplate.queryForList(sql, userName);
}*/
/*
* public List<Map<String, Object>> getBidByUserName(String userName) {
* String sql = "SELECT bid FROM login WHERE user_name = ?";
* return jdbcTemplate.queryForList(sql, userName);
* }
*/
public Integer getBidByUserName(String userName) { public Integer getBidByUserName(String userName) {
try { try {
String sql = "SELECT bid FROM login WHERE user_name = ?"; String sql = "SELECT bid FROM login WHERE user_name = ?";

9
src/main/java/com/gcc/coworkspace/service/NormalSMS.java

@ -1,9 +1,10 @@
package com.gcc.coworkspace.service; package com.gcc.coworkspace.service;
import com.gcc.coworkspace.configuration.AppConfig;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.gcc.coworkspace.configuration.AppConfig;
@Service @Service
public class NormalSMS { public class NormalSMS {
@ -22,7 +23,10 @@ public class NormalSMS {
} }
public String sendELearnNsms(String MobileNo, String noOfPerson, String bdate, String slot, String amount) { public String sendELearnNsms(String MobileNo, String noOfPerson, String bdate, String slot, String amount) {
String generatedToken = "Dear Patron, \n" +
String generatedToken = "Dear Patrons \n" +
"Welcome to Muthalvar Padaippagam. \n" + "Welcome to Muthalvar Padaippagam. \n" +
"You have booked our Learning Centre for " + noOfPerson + " number of persons on " + bdate + " at time slot " + slot + ". Payment for the booking is Rs." + amount + " received. Please show your QR Code at Reception Desk for accessing Muthalvar Padaippagam. Have a Nice Day - GCC"; "You have booked our Learning Centre for " + noOfPerson + " number of persons on " + bdate + " at time slot " + slot + ". Payment for the booking is Rs." + amount + " received. Please show your QR Code at Reception Desk for accessing Muthalvar Padaippagam. Have a Nice Day - GCC";
String urlString = appConfig.getGetOtpUrl() + "from=GCCCRP&key=" + key + "&sender=GCCCRP&to=" + MobileNo + "&body=" + generatedToken + "&entityid=1401572690000011081&templateid=1407173027552104564"; String urlString = appConfig.getGetOtpUrl() + "from=GCCCRP&key=" + key + "&sender=GCCCRP&to=" + MobileNo + "&body=" + generatedToken + "&entityid=1401572690000011081&templateid=1407173027552104564";
@ -30,6 +34,7 @@ public class NormalSMS {
} }
public String sendTLearnNsms(String MobileNo, String noOfPerson, String bdate, String slot, String amount) { public String sendTLearnNsms(String MobileNo, String noOfPerson, String bdate, String slot, String amount) {
slot = "கொத்தூர்"+slot;
String generatedToken = "அன்பான வாடிக்கையாளரே,\n" + String generatedToken = "அன்பான வாடிக்கையாளரே,\n" +
"முதல்வர் படைப்பகம் தங்களை அன்புடன் வரவேற்கின்றது. தாங்கள் எங்களின் கற்றல் மையத்தை "+ noOfPerson +" எண்ணிக்கை நபர்களுக்கு "+bdate+" அன்று நேர இடைவெளி "+bdate+" ல் பயன்படுத்திக்கொள்ள முன்பதிவு செய்துள்ளீர்கள். இதற்கான கட்டணம் ரூ. "+amount+" பெறப்பட்டுள்ளது. முதல்வர் படைப்பகம் பயன்படுத்த உங்கள் QR குறியீட்டை வரவேற்பறையில் காட்டுங்கள் இந்நாள் இனிய நாளாய் அமையட்டும் - பெ.செ.மா"; "முதல்வர் படைப்பகம் தங்களை அன்புடன் வரவேற்கின்றது. தாங்கள் எங்களின் கற்றல் மையத்தை "+ noOfPerson +" எண்ணிக்கை நபர்களுக்கு "+bdate+" அன்று நேர இடைவெளி "+bdate+" ல் பயன்படுத்திக்கொள்ள முன்பதிவு செய்துள்ளீர்கள். இதற்கான கட்டணம் ரூ. "+amount+" பெறப்பட்டுள்ளது. முதல்வர் படைப்பகம் பயன்படுத்த உங்கள் QR குறியீட்டை வரவேற்பறையில் காட்டுங்கள் இந்நாள் இனிய நாளாய் அமையட்டும் - பெ.செ.மா";
String urlString = appConfig.getGetOtpUrl() + "from=GCCCRP&key=" + key + "&sender=GCCCRP&to=" + MobileNo + "&body=" + generatedToken + "&entityid=1401572690000011081&templateid=1407173027534475535"; String urlString = appConfig.getGetOtpUrl() + "from=GCCCRP&key=" + key + "&sender=GCCCRP&to=" + MobileNo + "&body=" + generatedToken + "&entityid=1401572690000011081&templateid=1407173027534475535";

26
src/main/java/com/gcc/coworkspace/service/WhatsAppService.java

@ -17,19 +17,29 @@ public class WhatsAppService {
return whatsappMsgService.sendMsg(msgContent); return whatsappMsgService.sendMsg(msgContent);
} }
public String sendELearnNmsg(String MobileNo, String noOfPerson, String bdate, String slot, String amount, String bookingId) {
public String sendELearnNmsg(String MobileNo, String noOfPerson, String bdate, String slot, String smsename,String amount, String bookingId) {
//slot = smsename+"+" + slot;
smsename = smsename.replace(" ", "%20");
slot = slot + "+(" + smsename + ")";
System.out.println("slot...12"+slot);
// String msgContent = "https://media.smsgupshup.com/GatewayAPI/rest?userid=2000233507&password="+password+"&send_to="+MobileNo+"&v=1.1&format=json&msg_type=TEXT&method=SENDMESSAGE&msg=Dear+Patron%2C%0AWelcome+to+Muthalvar+Padaippagam%F0%9F%99%8F++%0A%0AYou+have+booked+our+Learning+Centre+for+%2A"+noOfPerson+"%2A+number+of+persons+on+%2A"+bdate+"%2A+at+%0Atime+slot+%2A"+slot+"%2A+.%0A%0APayment+for+the+booking+is+%2ARs.+"+amount+"%2A+received.+%0A%0APlease+show+your+QR+Code+at+Reception+Desk+for+accessing+Muthalvar+Padaippagam.%0A%0AHave+a+Nice+Day%F0%9F%98%8A&isTemplate=true&buttonUrlParam=muthalvarpadaippagam%2FbookingQRCode%3Fbooking_id%3D"+bookingId;
String msgContent = "https://media.smsgupshup.com/GatewayAPI/rest?userid=2000233507&password="+password+"&send_to="+MobileNo+"&v=1.1&format=json&msg_type=TEXT&method=SENDMESSAGE&msg=Dear+Patron%2C%0AWelcome+to+Muthalvar+Padaippagam%F0%9F%99%8F++%0A%0AYou+have+booked+our+Learning+Centre+for+%2A"+noOfPerson+"%2A+number+of+persons+on+%2A"+bdate+"%2A+at+%0Atime+slot+%2A"+slot+"%2A+.%0A%0APayment+for+the+booking+is+%2ARs.+"+amount+"%2A+received.+%0A%0APlease+show+your+QR+Code+at+Reception+Desk+for+accessing+Muthalvar+Padaippagam.%0A%0AHave+a+Nice+Day%F0%9F%98%8A&isTemplate=true&buttonUrlParam=muthalvarpadaippagam%2FbookingQRCode%3Fbooking_id%3D"+bookingId; String msgContent = "https://media.smsgupshup.com/GatewayAPI/rest?userid=2000233507&password="+password+"&send_to="+MobileNo+"&v=1.1&format=json&msg_type=TEXT&method=SENDMESSAGE&msg=Dear+Patron%2C%0AWelcome+to+Muthalvar+Padaippagam%F0%9F%99%8F++%0A%0AYou+have+booked+our+Learning+Centre+for+%2A"+noOfPerson+"%2A+number+of+persons+on+%2A"+bdate+"%2A+at+%0Atime+slot+%2A"+slot+"%2A+.%0A%0APayment+for+the+booking+is+%2ARs.+"+amount+"%2A+received.+%0A%0APlease+show+your+QR+Code+at+Reception+Desk+for+accessing+Muthalvar+Padaippagam.%0A%0AHave+a+Nice+Day%F0%9F%98%8A&isTemplate=true&buttonUrlParam=muthalvarpadaippagam%2FbookingQRCode%3Fbooking_id%3D"+bookingId;
System.out.println(msgContent); System.out.println(msgContent);
return whatsappMsgService.sendMsg(msgContent); return whatsappMsgService.sendMsg(msgContent);
} }
public String sendTLearnNmsg(String MobileNo, String noOfPerson, String bdate, String slot,String amount, String bookingId) { public String sendTLearnNmsg(String MobileNo, String noOfPerson, String bdate, String slot,String amount, String bookingId) {
// slot = smstname+"+" + slot;
String msgContent = "https://media.smsgupshup.com/GatewayAPI/rest?userid=2000233507&password="+password+"&send_to="+MobileNo+"&v=1.1&format=json&msg_type=TEXT&method=SENDMESSAGE&msg=%E0%AE%85%E0%AE%A9%E0%AF%8D%E0%AE%AA%E0%AE%BE%E0%AE%A9+%E0%AE%B5%E0%AE%BE%E0%AE%9F%E0%AE%BF%E0%AE%95%E0%AF%8D%E0%AE%95%E0%AF%88%E0%AE%AF%E0%AE%BE%E0%AE%B3%E0%AE%B0%E0%AF%87%2C+%0A%E0%AE%AE%E0%AF%81%E0%AE%A4%E0%AE%B2%E0%AF%8D%E0%AE%B5%E0%AE%B0%E0%AF%8D+%E0%AE%AA%E0%AE%9F%E0%AF%88%E0%AE%AA%E0%AF%8D%E0%AE%AA%E0%AE%95%E0%AE%AE%E0%AF%8D+%E0%AE%A4%E0%AE%99%E0%AF%8D%E0%AE%95%E0%AE%B3%E0%AF%88+%E0%AE%85%E0%AE%A9%E0%AF%8D%E0%AE%AA%E0%AF%81%E0%AE%9F%E0%AE%A9%E0%AF%8D+%E0%AE%B5%E0%AE%B0%E0%AE%B5%E0%AF%87%E0%AE%B1%E0%AF%8D%E0%AE%95%E0%AE%BF%E0%AE%A9%E0%AF%8D%E0%AE%B1%E0%AE%A4%E0%AF%81+%F0%9F%99%8F++%0A%0A%E0%AE%A4%E0%AE%BE%E0%AE%99%E0%AF%8D%E0%AE%95%E0%AE%B3%E0%AF%8D+%E0%AE%8E%E0%AE%99%E0%AF%8D%E0%AE%95%E0%AE%B3%E0%AE%BF%E0%AE%A9%E0%AF%8D+%E0%AE%95%E0%AE%B1%E0%AF%8D%E0%AE%B1%E0%AE%B2%E0%AF%8D+%E0%AE%AE%E0%AF%88%E0%AE%AF%E0%AE%A4%E0%AF%8D%E0%AE%A4%E0%AF%88++%2A"+noOfPerson+"%2A+%E0%AE%8E%E0%AE%A3%E0%AF%8D%E0%AE%A3%E0%AE%BF%E0%AE%95%E0%AF%8D%E0%AE%95%E0%AF%88+%E0%AE%A8%E0%AE%AA%E0%AE%B0%E0%AF%8D%E0%AE%95%E0%AE%B3%E0%AF%81%E0%AE%95%E0%AF%8D%E0%AE%95%E0%AF%81++%2A"+bdate+"%2A+%E0%AE%85%E0%AE%A9%E0%AF%8D%E0%AE%B1%E0%AF%81++%E0%AE%A8%E0%AF%87%E0%AE%B0+%E0%AE%87%E0%AE%9F%E0%AF%88%E0%AE%B5%E0%AF%86%E0%AE%B3%E0%AE%BF+%2A"+slot+"%2A+%E0%AE%B2%E0%AF%8D+%E0%AE%AA%E0%AE%AF%E0%AE%A9%E0%AF%8D%E0%AE%AA%E0%AE%9F%E0%AF%81%E0%AE%A4%E0%AF%8D%E0%AE%A4%E0%AE%BF%E0%AE%95%E0%AF%8D%E0%AE%95%E0%AF%8A%E0%AE%B3%E0%AF%8D%E0%AE%B3+%E0%AE%AE%E0%AF%81%E0%AE%A9%E0%AF%8D%E0%AE%AA%E0%AE%A4%E0%AE%BF%E0%AE%B5%E0%AF%81+%E0%AE%9A%E0%AF%86%E0%AE%AF%E0%AF%8D%E0%AE%A4%E0%AF%81%E0%AE%B3%E0%AF%8D%E0%AE%B3%E0%AF%80%E0%AE%B0%E0%AF%8D%E0%AE%95%E0%AE%B3%E0%AF%8D.+.%0A%0A%E0%AE%87%E0%AE%A4%E0%AE%B1%E0%AF%8D%E0%AE%95%E0%AE%BE%E0%AE%A9++%E0%AE%95%E0%AE%9F%E0%AF%8D%E0%AE%9F%E0%AE%A3%E0%AE%AE%E0%AF%8D+%2A%E0%AE%B0%E0%AF%82.+"+amount+"%2A+%E0%AE%AA%E0%AF%86%E0%AE%B1%E0%AE%AA%E0%AF%8D%E0%AE%AA%E0%AE%9F%E0%AF%8D%E0%AE%9F%E0%AF%81%E0%AE%B3%E0%AF%8D%E0%AE%B3%E0%AE%A4%E0%AF%81.%0A%0A%E0%AE%AE%E0%AF%81%E0%AE%A4%E0%AE%B2%E0%AF%8D%E0%AE%B5%E0%AE%B0%E0%AF%8D+%E0%AE%AA%E0%AE%9F%E0%AF%88%E0%AE%AA%E0%AF%8D%E0%AE%AA%E0%AE%95%E0%AE%AE%E0%AF%8D+%E0%AE%AA%E0%AE%AF%E0%AE%A9%E0%AF%8D%E0%AE%AA%E0%AE%9F%E0%AF%81%E0%AE%A4%E0%AF%8D%E0%AE%A4+%E0%AE%89%E0%AE%99%E0%AF%8D%E0%AE%95%E0%AE%B3%E0%AF%8D+QR+%E0%AE%95%E0%AF%81%E0%AE%B1%E0%AE%BF%E0%AE%AF%E0%AF%80%E0%AE%9F%E0%AF%8D%E0%AE%9F%E0%AF%88+%E0%AE%B5%E0%AE%B0%E0%AE%B5%E0%AF%87%E0%AE%B1%E0%AF%8D%E0%AE%AA%E0%AE%B1%E0%AF%88%E0%AE%AF%E0%AE%BF%E0%AE%B2%E0%AF%8D+%E0%AE%95%E0%AE%BE%E0%AE%9F%E0%AF%8D%E0%AE%9F%E0%AF%81%E0%AE%99%E0%AF%8D%E0%AE%95%E0%AE%B3%E0%AF%8D.%0A%0A%E0%AE%87%E0%AE%A8%E0%AF%8D%E0%AE%A8%E0%AE%BE%E0%AE%B3%E0%AF%8D+%E0%AE%87%E0%AE%A9%E0%AE%BF%E0%AE%AF+%E0%AE%A8%E0%AE%BE%E0%AE%B3%E0%AE%BE%E0%AE%AF%E0%AF%8D+%E0%AE%85%E0%AE%AE%E0%AF%88%E0%AE%AF%E0%AE%9F%E0%AF%8D%E0%AE%9F%E0%AF%81%E0%AE%AE%E0%AF%8D%F0%9F%98%8A&isTemplate=true&buttonUrlParam=muthalvarpadaippagam%2FbookingQRCode%3Fbooking_id%3D"+bookingId; String msgContent = "https://media.smsgupshup.com/GatewayAPI/rest?userid=2000233507&password="+password+"&send_to="+MobileNo+"&v=1.1&format=json&msg_type=TEXT&method=SENDMESSAGE&msg=%E0%AE%85%E0%AE%A9%E0%AF%8D%E0%AE%AA%E0%AE%BE%E0%AE%A9+%E0%AE%B5%E0%AE%BE%E0%AE%9F%E0%AE%BF%E0%AE%95%E0%AF%8D%E0%AE%95%E0%AF%88%E0%AE%AF%E0%AE%BE%E0%AE%B3%E0%AE%B0%E0%AF%87%2C+%0A%E0%AE%AE%E0%AF%81%E0%AE%A4%E0%AE%B2%E0%AF%8D%E0%AE%B5%E0%AE%B0%E0%AF%8D+%E0%AE%AA%E0%AE%9F%E0%AF%88%E0%AE%AA%E0%AF%8D%E0%AE%AA%E0%AE%95%E0%AE%AE%E0%AF%8D+%E0%AE%A4%E0%AE%99%E0%AF%8D%E0%AE%95%E0%AE%B3%E0%AF%88+%E0%AE%85%E0%AE%A9%E0%AF%8D%E0%AE%AA%E0%AF%81%E0%AE%9F%E0%AE%A9%E0%AF%8D+%E0%AE%B5%E0%AE%B0%E0%AE%B5%E0%AF%87%E0%AE%B1%E0%AF%8D%E0%AE%95%E0%AE%BF%E0%AE%A9%E0%AF%8D%E0%AE%B1%E0%AE%A4%E0%AF%81+%F0%9F%99%8F++%0A%0A%E0%AE%A4%E0%AE%BE%E0%AE%99%E0%AF%8D%E0%AE%95%E0%AE%B3%E0%AF%8D+%E0%AE%8E%E0%AE%99%E0%AF%8D%E0%AE%95%E0%AE%B3%E0%AE%BF%E0%AE%A9%E0%AF%8D+%E0%AE%95%E0%AE%B1%E0%AF%8D%E0%AE%B1%E0%AE%B2%E0%AF%8D+%E0%AE%AE%E0%AF%88%E0%AE%AF%E0%AE%A4%E0%AF%8D%E0%AE%A4%E0%AF%88++%2A"+noOfPerson+"%2A+%E0%AE%8E%E0%AE%A3%E0%AF%8D%E0%AE%A3%E0%AE%BF%E0%AE%95%E0%AF%8D%E0%AE%95%E0%AF%88+%E0%AE%A8%E0%AE%AA%E0%AE%B0%E0%AF%8D%E0%AE%95%E0%AE%B3%E0%AF%81%E0%AE%95%E0%AF%8D%E0%AE%95%E0%AF%81++%2A"+bdate+"%2A+%E0%AE%85%E0%AE%A9%E0%AF%8D%E0%AE%B1%E0%AF%81++%E0%AE%A8%E0%AF%87%E0%AE%B0+%E0%AE%87%E0%AE%9F%E0%AF%88%E0%AE%B5%E0%AF%86%E0%AE%B3%E0%AE%BF+%2A"+slot+"%2A+%E0%AE%B2%E0%AF%8D+%E0%AE%AA%E0%AE%AF%E0%AE%A9%E0%AF%8D%E0%AE%AA%E0%AE%9F%E0%AF%81%E0%AE%A4%E0%AF%8D%E0%AE%A4%E0%AE%BF%E0%AE%95%E0%AF%8D%E0%AE%95%E0%AF%8A%E0%AE%B3%E0%AF%8D%E0%AE%B3+%E0%AE%AE%E0%AF%81%E0%AE%A9%E0%AF%8D%E0%AE%AA%E0%AE%A4%E0%AE%BF%E0%AE%B5%E0%AF%81+%E0%AE%9A%E0%AF%86%E0%AE%AF%E0%AF%8D%E0%AE%A4%E0%AF%81%E0%AE%B3%E0%AF%8D%E0%AE%B3%E0%AF%80%E0%AE%B0%E0%AF%8D%E0%AE%95%E0%AE%B3%E0%AF%8D.+.%0A%0A%E0%AE%87%E0%AE%A4%E0%AE%B1%E0%AF%8D%E0%AE%95%E0%AE%BE%E0%AE%A9++%E0%AE%95%E0%AE%9F%E0%AF%8D%E0%AE%9F%E0%AE%A3%E0%AE%AE%E0%AF%8D+%2A%E0%AE%B0%E0%AF%82.+"+amount+"%2A+%E0%AE%AA%E0%AF%86%E0%AE%B1%E0%AE%AA%E0%AF%8D%E0%AE%AA%E0%AE%9F%E0%AF%8D%E0%AE%9F%E0%AF%81%E0%AE%B3%E0%AF%8D%E0%AE%B3%E0%AE%A4%E0%AF%81.%0A%0A%E0%AE%AE%E0%AF%81%E0%AE%A4%E0%AE%B2%E0%AF%8D%E0%AE%B5%E0%AE%B0%E0%AF%8D+%E0%AE%AA%E0%AE%9F%E0%AF%88%E0%AE%AA%E0%AF%8D%E0%AE%AA%E0%AE%95%E0%AE%AE%E0%AF%8D+%E0%AE%AA%E0%AE%AF%E0%AE%A9%E0%AF%8D%E0%AE%AA%E0%AE%9F%E0%AF%81%E0%AE%A4%E0%AF%8D%E0%AE%A4+%E0%AE%89%E0%AE%99%E0%AF%8D%E0%AE%95%E0%AE%B3%E0%AF%8D+QR+%E0%AE%95%E0%AF%81%E0%AE%B1%E0%AE%BF%E0%AE%AF%E0%AF%80%E0%AE%9F%E0%AF%8D%E0%AE%9F%E0%AF%88+%E0%AE%B5%E0%AE%B0%E0%AE%B5%E0%AF%87%E0%AE%B1%E0%AF%8D%E0%AE%AA%E0%AE%B1%E0%AF%88%E0%AE%AF%E0%AE%BF%E0%AE%B2%E0%AF%8D+%E0%AE%95%E0%AE%BE%E0%AE%9F%E0%AF%8D%E0%AE%9F%E0%AF%81%E0%AE%99%E0%AF%8D%E0%AE%95%E0%AE%B3%E0%AF%8D.%0A%0A%E0%AE%87%E0%AE%A8%E0%AF%8D%E0%AE%A8%E0%AE%BE%E0%AE%B3%E0%AF%8D+%E0%AE%87%E0%AE%A9%E0%AE%BF%E0%AE%AF+%E0%AE%A8%E0%AE%BE%E0%AE%B3%E0%AE%BE%E0%AE%AF%E0%AF%8D+%E0%AE%85%E0%AE%AE%E0%AF%88%E0%AE%AF%E0%AE%9F%E0%AF%8D%E0%AE%9F%E0%AF%81%E0%AE%AE%E0%AF%8D%F0%9F%98%8A&isTemplate=true&buttonUrlParam=muthalvarpadaippagam%2FbookingQRCode%3Fbooking_id%3D"+bookingId;
System.out.println(msgContent); System.out.println(msgContent);
return whatsappMsgService.sendMsg(msgContent); return whatsappMsgService.sendMsg(msgContent);
} }
public String sendEDeskspaceNmsg(String MobileNo, String noOfPerson, String bdate, String slot, String amount, String bookingId) {
public String sendEDeskspaceNmsg(String MobileNo, String noOfPerson, String bdate, String slot,String smsename, String amount, String bookingId) {
// slot = smsename+"+" + slot;
smsename = smsename.replace(" ", "%20");
slot = slot + "+(" + smsename + ")";
String msgContent = "https://media.smsgupshup.com/GatewayAPI/rest?userid=2000233507&password="+password+"&send_to="+MobileNo+"&v=1.1&format=json&msg_type=TEXT&method=SENDMESSAGE&msg=Dear+Patron%2C%0AWelcome+to+Muthalvar+Padaippagam%F0%9F%99%8F++%0A%0AYou+have+booked+our+Desk+space+for+%2A"+noOfPerson+"%2A+number+of+persons+on+%2A"+bdate+"%2A+at+time+slot+%2A"+slot+"%2A+.%0A%0APayment+for+the+booking+is+%2ARs.+"+amount+"%2A+received.+%0A%0APlease+show+your+QR+Code+at+Reception+Desk+for+accessing+Muthalvar+Padaippagam.%0A%0AHave+a+Nice+Day%F0%9F%98%8A&isTemplate=true&buttonUrlParam=muthalvarpadaippagam%2FbookingQRCode%3Fbooking_id%3D"+bookingId; String msgContent = "https://media.smsgupshup.com/GatewayAPI/rest?userid=2000233507&password="+password+"&send_to="+MobileNo+"&v=1.1&format=json&msg_type=TEXT&method=SENDMESSAGE&msg=Dear+Patron%2C%0AWelcome+to+Muthalvar+Padaippagam%F0%9F%99%8F++%0A%0AYou+have+booked+our+Desk+space+for+%2A"+noOfPerson+"%2A+number+of+persons+on+%2A"+bdate+"%2A+at+time+slot+%2A"+slot+"%2A+.%0A%0APayment+for+the+booking+is+%2ARs.+"+amount+"%2A+received.+%0A%0APlease+show+your+QR+Code+at+Reception+Desk+for+accessing+Muthalvar+Padaippagam.%0A%0AHave+a+Nice+Day%F0%9F%98%8A&isTemplate=true&buttonUrlParam=muthalvarpadaippagam%2FbookingQRCode%3Fbooking_id%3D"+bookingId;
System.out.println(msgContent); System.out.println(msgContent);
return whatsappMsgService.sendMsg(msgContent); return whatsappMsgService.sendMsg(msgContent);
@ -41,7 +51,10 @@ public class WhatsAppService {
return whatsappMsgService.sendMsg(msgContent); return whatsappMsgService.sendMsg(msgContent);
} }
public String sendEMonthDeskspaceNmsg(String MobileNo, String noOfPerson, String bFromdate,String bTodate, String slot, String amount, String bookingId) {
public String sendEMonthDeskspaceNmsg(String MobileNo, String noOfPerson, String bFromdate,String bTodate, String slot,String smsename, String amount, String bookingId) {
// slot = smsename+"+" + slot;
smsename = smsename.replace(" ", "%20");
slot = slot + "+(" + smsename + ")";
String msgContent = "https://media.smsgupshup.com/GatewayAPI/rest?userid=2000233507&password="+password+"&send_to="+MobileNo+"&v=1.1&format=json&msg_type=TEXT&method=SENDMESSAGE&msg=Dear+Patron%2C%0AWelcome+to+Muthalvar+Padaippagam%F0%9F%99%8F++%0A%0AYou+have+booked+our+Desk+space+for+%2A"+noOfPerson+"%2A+number+of+persons+for+30+days+from+%2A"+bFromdate+"+to+"+bTodate+"%2A+at+time+slot+%2A"+slot+"%2A.%0A%0APayment+for+the+booking+is+%2ARs.+"+amount+"%2A+received.+%0A%0APlease+show+your+QR+Code+at+Reception+Desk+for+accessing+Muthalvar+Padaippagam.%0A%0AHave+a+Nice+Day%F0%9F%98%8A&isTemplate=true&buttonUrlParam=muthalvarpadaippagam%2FbookingQRCode%3Fbooking_id%3D"+bookingId; String msgContent = "https://media.smsgupshup.com/GatewayAPI/rest?userid=2000233507&password="+password+"&send_to="+MobileNo+"&v=1.1&format=json&msg_type=TEXT&method=SENDMESSAGE&msg=Dear+Patron%2C%0AWelcome+to+Muthalvar+Padaippagam%F0%9F%99%8F++%0A%0AYou+have+booked+our+Desk+space+for+%2A"+noOfPerson+"%2A+number+of+persons+for+30+days+from+%2A"+bFromdate+"+to+"+bTodate+"%2A+at+time+slot+%2A"+slot+"%2A.%0A%0APayment+for+the+booking+is+%2ARs.+"+amount+"%2A+received.+%0A%0APlease+show+your+QR+Code+at+Reception+Desk+for+accessing+Muthalvar+Padaippagam.%0A%0AHave+a+Nice+Day%F0%9F%98%8A&isTemplate=true&buttonUrlParam=muthalvarpadaippagam%2FbookingQRCode%3Fbooking_id%3D"+bookingId;
System.out.println(msgContent); System.out.println(msgContent);
return whatsappMsgService.sendMsg(msgContent); return whatsappMsgService.sendMsg(msgContent);
@ -53,7 +66,12 @@ public class WhatsAppService {
return whatsappMsgService.sendMsg(msgContent); return whatsappMsgService.sendMsg(msgContent);
} }
public String sendEConfeNmsg(String mobileNo, String bdate, String slot, String amount,String bookingId) {
public String sendEConfeNmsg(String mobileNo, String bdate, String slot,String smsename, String amount,String bookingId) {
// slot = smsename+"+" + slot;
smsename = smsename.replace(" ", "%20");
slot = slot + "+(" + smsename + ")";
System.out.println("Final Slot :"+slot);
String msgContent= "https://media.smsgupshup.com/GatewayAPI/rest?userid=2000233507&password=h2YjFNcJ&send_to="+mobileNo+"&v=1.1&format=json&msg_type=TEXT&method=SENDMESSAGE&msg=Dear+Patron%2C%0AWelcome+to+Muthalvar+Padaippagam%F0%9F%99%8F++%0A%0AYou+have+booked+our+Conference+Hall+on+%2A"+bdate+"%2A+at+time+slot+%2A"+slot+"%2A+.%0A%0APayment+for+the+booking+is+%2ARs.+"+amount+"%2A+received.+%0A%0APlease+show+your+QR+Code+at+Reception+Desk+for+accessing+Muthalvar+Padaippagam.%0A%0AHave+a+Nice+Day%F0%9F%98%8A&isTemplate=true&buttonUrlParam=muthalvarpadaippagam%2FbookingQRCode%3Fbooking_id%3D"+bookingId; String msgContent= "https://media.smsgupshup.com/GatewayAPI/rest?userid=2000233507&password=h2YjFNcJ&send_to="+mobileNo+"&v=1.1&format=json&msg_type=TEXT&method=SENDMESSAGE&msg=Dear+Patron%2C%0AWelcome+to+Muthalvar+Padaippagam%F0%9F%99%8F++%0A%0AYou+have+booked+our+Conference+Hall+on+%2A"+bdate+"%2A+at+time+slot+%2A"+slot+"%2A+.%0A%0APayment+for+the+booking+is+%2ARs.+"+amount+"%2A+received.+%0A%0APlease+show+your+QR+Code+at+Reception+Desk+for+accessing+Muthalvar+Padaippagam.%0A%0AHave+a+Nice+Day%F0%9F%98%8A&isTemplate=true&buttonUrlParam=muthalvarpadaippagam%2FbookingQRCode%3Fbooking_id%3D"+bookingId;
System.out.println(msgContent); System.out.println(msgContent);
return whatsappMsgService.sendMsg(msgContent); return whatsappMsgService.sendMsg(msgContent);

5
src/main/resources/templates/caretaker/abstract.html

@ -276,7 +276,8 @@
}); });
// Handle Reset Button // Handle Reset Button
$('#filterForm').on('reset', function () {
$('#filterForm').on('reset', function (e) {
e.preventDefault();
// Reset dates // Reset dates
$('#fromDate').val(currentDate); $('#fromDate').val(currentDate);
$('#toDate').val(currentDate); $('#toDate').val(currentDate);
@ -311,7 +312,7 @@
totalPersons += parseInt(row.NO_of_person || 0); totalPersons += parseInt(row.NO_of_person || 0);
}); });
excelData.push(['', '', 'Total', totalAmount.toFixed(2), totalPersons]);
excelData.push(['', '', '','','Total', totalAmount.toFixed(2), totalPersons]);
const ws = XLSX.utils.aoa_to_sheet(excelData); const ws = XLSX.utils.aoa_to_sheet(excelData);
const wb = XLSX.utils.book_new(); const wb = XLSX.utils.book_new();

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

@ -16,6 +16,9 @@
padding-left: 10px; /* Adjust padding to position icon */ padding-left: 10px; /* Adjust padding to position icon */
padding-right: 10px; padding-right: 10px;
} }
.modal-xl-custom {
max-width: 95%; /* or any size you prefer */
}
#mobileNo { #mobileNo {
border-left: none; /* Remove left border to merge with icon */ border-left: none; /* Remove left border to merge with icon */
@ -216,14 +219,16 @@
</div> </div>
</div> </div>
<!-- Modal for Booking Details --> <!-- Modal for Booking Details -->
<div class="modal fade" id="bookingDetailsModal" tabindex="-1" role="dialog" aria-labelledby="bookingDetailsModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal fade" id="bookingDetailsModal" tabindex="-2" role="dialog" aria-labelledby="bookingDetailsModalLabel" data-bs-backdrop="static" aria-hidden="true">
<div class="modal-dialog modal-xl-custom" role="document">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h5 class="modal-title" id="bookingDetailsModalLabel">Booking Details</h5> <h5 class="modal-title" id="bookingDetailsModalLabel">Booking Details</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<!-- <button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span> <span aria-hidden="true">&times;</span>
</button>
</button>-->
<button type="button" class="btn-close" data-bs-dismiss="modal"
aria-label="Close">&times;</button>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<iframe id="bookingDetailsIframe" src="" width="100%" height="500px" style="border:none;"></iframe> <iframe id="bookingDetailsIframe" src="" width="100%" height="500px" style="border:none;"></iframe>

2
src/main/resources/templates/caretaker/bookingdetails.html.29112024.html

@ -174,7 +174,7 @@
<div class="modal-dialog modal-lg" role="document"> <div class="modal-dialog modal-lg" role="document">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h5 class="modal-title" id="bookingDetailsModalLabel">Booking Details</h5>
<h5 class="modal-title" id="bookingDetailsModalLabel">Booking Details a</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> <button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span> <span aria-hidden="true">&times;</span>
</button> </button>

84
src/main/resources/templates/caretaker/officer-dashboard.html

@ -1,10 +1,10 @@
<!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 th:replace="~{fragments/user-head :: head}">
<title>Officer Dashboard</title> <title>Officer Dashboard</title>
<!-- DataTables CSS --> <!-- DataTables CSS -->
<link rel="stylesheet"
href="https://cdn.datatables.net/1.11.5/css/dataTables.bootstrap4.min.css">
<link rel="stylesheet" href="https://cdn.datatables.net/1.11.5/css/dataTables.bootstrap4.min.css">
<!-- AmCharts libraries --> <!-- AmCharts libraries -->
<script src="https://cdn.amcharts.com/lib/5/index.js"></script> <script src="https://cdn.amcharts.com/lib/5/index.js"></script>
<script src="https://cdn.amcharts.com/lib/5/percent.js"></script> <script src="https://cdn.amcharts.com/lib/5/percent.js"></script>
@ -74,9 +74,11 @@
.container1 { .container1 {
display: flex; display: flex;
flex-wrap: nowrap; /* force all cards in one row */
flex-wrap: nowrap;
/* force all cards in one row */
gap: 30px; gap: 30px;
overflow-x: auto; /* scroll on smaller screens */
overflow-x: auto;
/* scroll on smaller screens */
padding: 20px; padding: 20px;
max-width: 1300px; max-width: 1300px;
justify-content: flex-start; justify-content: flex-start;
@ -92,7 +94,8 @@
.card { .card {
width: 250px; width: 250px;
flex: 0 0 auto; /* Prevent from shrinking or stretching */
flex: 0 0 auto;
/* Prevent from shrinking or stretching */
} }
@ -145,27 +148,41 @@
/* margin: auto;*/ /* margin: auto;*/
/*}*/ /*}*/
.chart-container {
/* .chart-container {
width: 100%; width: 100%;
min-height: 240px; min-height: 240px;
display: flex; display: flex;
justify-content: flex-start; /* Align chart canvas to left */
justify-content: flex-start;
}*/
.chart-container {
width: 100%;
height: 240px;
display: flex;
justify-content: center;
align-items: center;
} }
.date-layout { .date-layout {
display: flex; display: flex;
gap: 20px; /* Space between the date pickers */
justify-content: flex-start; /* Aligns date pickers to the left */
gap: 20px;
/* Space between the date pickers */
justify-content: flex-start;
/* Aligns date pickers to the left */
align-items: center; align-items: center;
margin-bottom: 20px; /* Adds space below the date pickers */
margin-bottom: 20px;
/* Adds space below the date pickers */
padding-top: 40px; padding-top: 40px;
margin-top: 20px; margin-top: 20px;
margin-left: 195px; /* Shifts the layout slightly to the right */
margin-left: 195px;
/* Shifts the layout slightly to the right */
/*width: 100%; !* Ensures the layout stretches across the container *!*/ /*width: 100%; !* Ensures the layout stretches across the container *!*/
width: calc(100% - 80px); width: calc(100% - 80px);
/* Adjusts width so it stays within the viewport */ /* Adjusts width so it stays within the viewport */
} }
.hidden-card { .hidden-card {
display: none !important; display: none !important;
} }
@ -181,7 +198,8 @@
.date-picker { .date-picker {
display: flex; display: flex;
align-items: center; align-items: center;
gap: 10px; /* Space between label and input */
gap: 10px;
/* Space between label and input */
} }
.form-label { .form-label {
@ -193,7 +211,8 @@ input[type="date"] {
font-size: 14px; font-size: 14px;
border: 1px solid #ccc; border: 1px solid #ccc;
border-radius: 5px; border-radius: 5px;
width: 150px; /* Adjust width as needed */
width: 150px;
/* Adjust width as needed */
} }
.containers { .containers {
@ -203,9 +222,11 @@ input[type="date"] {
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
} }
.wrap { .wrap {
flex-wrap: wrap !important; flex-wrap: wrap !important;
} }
.hidden-card { .hidden-card {
display: none !important; display: none !important;
} }
@ -249,13 +270,12 @@ input[type="date"] {
<!-- Date Layout --> <!-- Date Layout -->
<div class="date-layout"> <div class="date-layout">
<div class="date-picker"> <div class="date-picker">
<label for="fromDate" class="form-label">From Date</label> <input
type="date" placeholder="from date" id="fromDate"
name="fromDate">
<label for="fromDate" class="form-label">From Date</label> <input type="date"
placeholder="from date" id="fromDate" name="fromDate">
</div> </div>
<div class="date-picker"> <div class="date-picker">
<label for="toDate" class="form-label">To Date</label> <input
type="date" placeholder="to date" id="toDate" name="toDate">
<label for="toDate" class="form-label">To Date</label> <input type="date"
placeholder="to date" id="toDate" name="toDate">
</div> </div>
</div> </div>
@ -342,15 +362,13 @@ input[type="date"] {
<div class="card filter-card"
style="width: 97%; height: 100%; background-color: white;">
<div class="card filter-card" style="width: 97%; height: 100%; background-color: white;">
<div class="row" <div class="row"
style="margin-left: auto; margin-right: 20px; display: flex; justify-content: flex-end;"> style="margin-left: auto; margin-right: 20px; display: flex; justify-content: flex-end;">
<div class="col-sm-12"> <div class="col-sm-12">
<label for="status" class="form-label" <label for="status" class="form-label"
style="margin-left: auto; margin-right: 0; display: flex; justify-content: flex-end;">Status</label> style="margin-left: auto; margin-right: 0; display: flex; justify-content: flex-end;">Status</label>
<select id="status" name="status"
class="form-control text-center">
<select id="status" name="status" class="form-control text-center">
<option value="" class="">select</option> <option value="" class="">select</option>
<option value="">All</option> <option value="">All</option>
<option value="Upcoming">Upcoming</option> <option value="Upcoming">Upcoming</option>
@ -376,10 +394,10 @@ input[type="date"] {
<!-- Filter container with date and type dropdowns and status buttons --> <!-- Filter container with date and type dropdowns and status buttons -->
<div class="col-md-12"> <div class="col-md-12">
<div class="card-table table-container mt-2"
id="nameinclusiontable">
<div class="card-table table-container mt-2" id="nameinclusiontable">
<div class="table-responsive"> <div class="table-responsive">
<table id="nameinclusion" class="table table-bordered nowrap" style="width:100%">
<table id="nameinclusion" class="table table-bordered nowrap"
style="width:100%">
<thead> <thead>
<tr> <tr>
<th>S.No</th> <th>S.No</th>
@ -420,12 +438,9 @@ input[type="date"] {
<script th:replace="~{fragments/user-script :: script}"></script> <script th:replace="~{fragments/user-script :: script}"></script>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script> <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<!-- DataTables JS --> <!-- DataTables JS -->
<script
src="https://cdn.datatables.net/1.11.5/js/jquery.dataTables.min.js"></script>
<script
src="https://cdn.datatables.net/1.11.5/js/dataTables.bootstrap4.min.js"></script>
<script
src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
<script src="https://cdn.datatables.net/1.11.5/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/1.11.5/js/dataTables.bootstrap4.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
<script> <script>
@ -554,6 +569,7 @@ input[type="date"] {
// Function to render amount collected // Function to render amount collected
function renderAmountCollected(data) { function renderAmountCollected(data) {
console.log("data", data)
if (data) { if (data) {
document.getElementById("overallAmount").innerText = document.getElementById("overallAmount").innerText =
"Rs. " + (data.overall_amount_collected || 0).toLocaleString(); "Rs. " + (data.overall_amount_collected || 0).toLocaleString();
@ -577,6 +593,7 @@ input[type="date"] {
//function to renderOverallBookingCounts //function to renderOverallBookingCounts
function renderOverallBookingCounts(data) { function renderOverallBookingCounts(data) {
console.log("data", data)
if (data) { if (data) {
// Update charts with the fetched data // Update charts with the fetched data
updateChart(overallDoughnutChart, [ updateChart(overallDoughnutChart, [
@ -618,6 +635,7 @@ input[type="date"] {
} }
} }
// Update chart data // Update chart data
function updateChart(chart, data) { function updateChart(chart, data) {
if (chart) { if (chart) {
@ -961,7 +979,8 @@ fromDateInput.addEventListener("change", updateToDateRange);
<td colspan="10" style="text-align:center;">No booking details available.</td> <td colspan="10" style="text-align:center;">No booking details available.</td>
</tr> </tr>
`; `;
bookingTableBody.empty().append(noDataRow);}
bookingTableBody.empty().append(noDataRow);
}
// dataTable.draw(); // Clear the DataTable // dataTable.draw(); // Clear the DataTable
// // dataTable.rows.add([]); // Add empty rows // // dataTable.rows.add([]); // Add empty rows
// // $('#nameinclusiontable').show(); // // $('#nameinclusiontable').show();
@ -1017,4 +1036,5 @@ const today1 = new Date().toISOString().split("T")[0];
</script> </script>
</body> </body>
</html> </html>

2
src/main/resources/templates/fragments/user-nav.html

@ -95,7 +95,7 @@
<!-- <a href="#" style="margin-right:2px;"> <!-- <a href="#" style="margin-right:2px;">
<img src="images/CMDA.png" alt="Second Image" style="width:40px;height:40px;background-color:white;border-radius:5px;"> <img src="images/CMDA.png" alt="Second Image" style="width:40px;height:40px;background-color:white;border-radius:5px;">
</a> --> </a> -->
<a href="#!" onclick="javascript:toggleFullScreen()" style="color:white;">
<a onclick="javascript:toggleFullScreen()" style="color:white;">
<i class="feather icon-maximize full-screen" style="font-size:20px;"></i> <i class="feather icon-maximize full-screen" style="font-size:20px;"></i>
</a> </a>
</li> </li>

249
src/main/resources/templates/user/book-Conferance.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,12 +122,14 @@
-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;
border-color: green !important; border-color: green !important;
} }
</style> </style>
<body> <body>
<!-- Pre-loader start --> <!-- Pre-loader start -->
<div th:replace="~{fragments/preloader :: div}"></div> <div th:replace="~{fragments/preloader :: div}"></div>
@ -146,7 +155,8 @@
<div class="d-inline"> <div class="d-inline">
<h4 style="font-weight:bold;">Book Meeting Room</h4> <h4 style="font-weight:bold;">Book Meeting Room</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>
@ -183,60 +193,92 @@
<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:</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="backBtn2" onclick="history.back()"
class="btn btn-primary">Back</button>
</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">Select Room :</label>
<label style="font-weight:bold;"
class="col-sm-4 col-form-label text-end">Select Room
:</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="5"> Room No:1 (4 Seater)
<label class="btn btn-primary2 me-2 mb-2"
style="margin: 5px;">
<input type="radio" name="booking_type"
id="booking_type" autocomplete="off"
value="5"> Room No:1 (4 Seater)
</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="6"> Room No:2 (4 Seater)
<label class="btn btn-primary2 me-2 mb-2"
style="margin: 5px;">
<input type="radio" name="booking_type"
id="booking_type" autocomplete="off"
value="6"> Room No:2 (4 Seater)
</label> </label>
<label class="btn btn-primary2 mb-2" style="margin: 5px;">
<input type="radio" name="booking_type" id="booking_type" autocomplete="off" value="7"> Room No:3 (6 Seater)
<label class="btn btn-primary2 mb-2"
style="margin: 5px;">
<input type="radio" name="booking_type"
id="booking_type" autocomplete="off"
value="7"> Room No:3 (6 Seater)
</label> </label>
</div> </div>
</div> </div>
@ -244,7 +286,9 @@
</div> </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" disabled> <select class="form-control" id="numSeats" disabled>
<option value="4">4 Seats</option> <option value="4">4 Seats</option>
@ -262,31 +306,43 @@
</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>
<input type="hidden" id="buildingId" th:value="${buildingId}">
<input type="hidden" id="categoryId" th:value="${categoryId}">
<input type="hidden" id="buildingId"
th:value="${buildingId}">
<input type="hidden" id="categoryId"
th:value="${categoryId}">
<input type="hidden" id="subId" th:value="${subId}"> <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>
<div class="col-sm-6"> <div class="col-sm-6">
<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">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-12"> <div class="col-sm-12">
<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 -->
@ -298,12 +354,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>
@ -313,16 +372,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>
@ -331,8 +399,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>
@ -364,53 +436,86 @@
<!-- 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>
<small>*The availability of amenities is subject to change.</small>
<small>*The availability of amenities is subject to
change.</small>
</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>
@ -432,7 +537,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">
@ -440,13 +546,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">
@ -778,10 +886,20 @@ let subId = document.getElementById("#subId")
$('#ackModal').modal('show'); $('#ackModal').modal('show');
} }
}, },
error: function(xhr, status, error) {
/* error: function(xhr, status, error) {
alert("Please select another slot. The selected slot is now full."); alert("Please select another slot. The selected slot is now full.");
console.log('Error sending data:', error); console.log('Error sending data:', error);
console.log('Response text:', xhr.responseText); // Log response text for debugging console.log('Response text:', xhr.responseText); // Log response text for debugging
}*/
error: function (xhr) {
let msg = "Booking failed. Please try again.";
if (xhr.responseJSON && xhr.responseJSON.message) {
msg = xhr.responseJSON.message;
}
alert(msg);
} }
}); });
} }
@ -907,4 +1025,5 @@ function showTourPopup1(link) {
</script> </script>
</div> </div>
</body> </body>
</html> </html>

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

@ -1,14 +1,17 @@
<!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>
<style> <style>
.border-img { .border-img {
border: 2px solid #0069d9; /* Set your desired border color */
padding: 2px; /* Optional: to create some space between the image and the border */
border: 2px solid #0069d9;
/* Set your desired border color */
padding: 2px;
/* Optional: to create some space between the image and the border */
} }
.carousel-inner img { .carousel-inner img {
height: 500px; height: 500px;
object-fit: cover; object-fit: cover;
@ -27,21 +30,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;
@ -83,6 +91,7 @@
background-color: #E29D25; background-color: #E29D25;
} }
</style> </style>
<body> <body>
<!-- Pre-loader start --> <!-- Pre-loader start -->
<div th:replace="~{fragments/preloader :: div}"></div> <div th:replace="~{fragments/preloader :: div}"></div>
@ -108,7 +117,8 @@
<div class="d-inline"> <div class="d-inline">
<h4 style="font-weight:bold;">Book Learning Centre</h4> <h4 style="font-weight:bold;">Book Learning Centre</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>
@ -148,52 +158,76 @@
<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 data-target="#carouselExampleIndicators" data-slide-to="3"></li> <li data-target="#carouselExampleIndicators" data-slide-to="3"></li>
<li data-target="#carouselExampleIndicators" data-slide-to="4"></li>--> <li data-target="#carouselExampleIndicators" data-slide-to="4"></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 Learning Centre Welcome to Learning Centre
</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</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="backBtn2" onclick="history.back()"
class="btn btn-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>
@ -212,30 +246,40 @@
</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">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-12"> <div class="col-sm-12">
<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 -->
@ -247,12 +291,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>
@ -262,16 +309,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">Phone Number :</label>
<label style="font-weight:bold;" for="personPhone"
class="col-sm-4 col-form-label text-end">Phone
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>
@ -280,8 +336,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: 15px"> <div style="margin-top: 15px">
@ -309,59 +369,88 @@
<br> <br>
<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;">
<h4 style="font-weight: bold;margin-bottom: 27px;">Timing Details</h4>
<h4 style="font-weight: bold;margin-bottom: 27px;">Timing
Details</h4>
<div class="row"> <div class="row">
<!-- 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 : 06:00 AM to 11: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 :
06:00 AM to 11: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/10.png" class="mr-1" width="15px;"> PC with internet access
<li style="margin-bottom: 21px;"><img
src="/co-workspaceDocuments/icons/10.png"
class="mr-1" width="15px;"> PC with internet
access
</li> </li>
<li style="margin-bottom: 21px;"><img src="/co-workspaceDocuments/icons/8.png" class="mr-1" width="15px;"> Air Conditioning
<li style="margin-bottom: 21px;"><img
src="/co-workspaceDocuments/icons/8.png"
class="mr-1" width="15px;"> Air Conditioning
</li> </li>
</ul> </ul>
</div> </div>
*The availability of amenities is subject to change. *The availability of amenities is subject to change.
</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>
@ -385,7 +474,8 @@
<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">
@ -393,14 +483,16 @@
<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">
@ -721,10 +813,21 @@ function loadTimeSlots(selectedDate) {
$('#ackModal').modal('show'); $('#ackModal').modal('show');
} }
}, },
error: function(xhr, status, error) {
/* error: function(xhr, status, error) {
alert("Please select another slot. The selected slot is now full."); alert("Please select another slot. The selected slot is now full.");
console.log('Error sending data:', error); console.log('Error sending data:', error);
console.log('Response text:', xhr.responseText); // Log response text for debugging console.log('Response text:', xhr.responseText); // Log response text for debugging
}*/
error: function (xhr) {
let msg = "Booking failed. Please try again.";
if (xhr.responseJSON && xhr.responseJSON.message) {
msg = xhr.responseJSON.message;
}
alert(msg);
} }
}); });
} }
@ -844,4 +947,5 @@ function showTourPopup1(link) {
</script> </script>
</div> </div>
</body> </body>
</html> </html>

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

@ -283,10 +283,13 @@
<!-- Enter Details --> <!-- Enter Details -->
<!-- <h5 class="mb-3" style="color:#E29D25">Select Your Preference: <button id="backBtn" class="btn btn-sm btn-outline-primary">Back </button></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>
<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>
<button id="backBtn2" onclick="history.back()"
class="btn btn-primary">Back</button>
</div> </div>
@ -659,7 +662,7 @@
}); });
$(document).on('click', '#backBtn', function () { $(document).on('click', '#backBtn', function () {
window.location.href = '/muthalvarpadaippagam/home';
//window.location.href = '/muthalvarpadaippagam/home';
}); });
@ -955,10 +958,20 @@
$('#ackModal').modal('show'); $('#ackModal').modal('show');
} }
}, },
error: function (xhr, status, error) {
/*error: function (xhr, status, error) {
alert("Please select another slot. The selected slot is now full."); alert("Please select another slot. The selected slot is now full.");
console.log('Error sending data:', error); console.log('Error sending data:', error);
console.log('Response text:', xhr.responseText); // Log response text for debugging console.log('Response text:', xhr.responseText); // Log response text for debugging
}*/
error: function (xhr) {
let msg = "Booking failed. Please try again.";
if (xhr.responseJSON && xhr.responseJSON.message) {
msg = xhr.responseJSON.message;
}
alert(msg);
} }
}); });
} }

2
src/main/resources/templates/user/bookinghistory.html

@ -305,7 +305,7 @@
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h5>Booking details.</h5>
<h5>Booking details</h5>
<!-- <button type="button" class="close" data-dismiss="modal" aria-label="Close" onclick="close_modal('#bookingDetailsModal')"><span aria-hidden="true">&times;</span> --> <!-- <button type="button" class="close" data-dismiss="modal" aria-label="Close" onclick="close_modal('#bookingDetailsModal')"><span aria-hidden="true">&times;</span> -->
<button type="button" class="btn-close" data-bs-dismiss="modal" <button type="button" class="btn-close" data-bs-dismiss="modal"
aria-label="Close">&times;</button> aria-label="Close">&times;</button>

2
src/main/resources/templates/user/qrpage.html

@ -271,7 +271,7 @@
</div> </div>
<div class="button-container"> <div class="button-container">
<button class="btn btn-success" onclick="backToHome()">Back To Home</button> <button class="btn btn-success" onclick="backToHome()">Back To Home</button>
<button class="btn btn-success" onclick="printDiv('printArea')">Print</button>
<!-- <button class="btn btn-success" onclick="printDiv('printArea')">Print</button>-->
</div> </div>
<footer th:replace="~{fragments/footer :: footer}"></footer> <footer th:replace="~{fragments/footer :: footer}"></footer>
</div> </div>

1
src/main/resources/templates/user/razor-pay.html

@ -92,4 +92,5 @@
}; };
</script> </script>
</header> </header>
</html> </html>
Loading…
Cancel
Save