Browse Source

Enhancement added and Bugs fixed

master
kanimozhi 2 years ago
parent
commit
3e6470ef67
  1. 1
      src/main/java/com/gcc/communityHall/controller/AdminAPIController.java
  2. 1253
      src/main/java/com/gcc/communityHall/controller/Admincontroller.java
  3. 641
      src/main/java/com/gcc/communityHall/controller/HeadquartersController.java
  4. 132
      src/main/java/com/gcc/communityHall/controller/OfficerAPIController.java
  5. 2319
      src/main/java/com/gcc/communityHall/controller/UserAPIController.java
  6. 506
      src/main/java/com/gcc/communityHall/controller/UserController.java
  7. 29
      src/main/java/com/gcc/communityHall/entity/BookingCalendar.java
  8. 104
      src/main/java/com/gcc/communityHall/paymentService/controller/PaymentAPIController.java
  9. 2
      src/main/java/com/gcc/communityHall/paymentService/controller/PaymentController.java
  10. 16
      src/main/java/com/gcc/communityHall/paymentService/repository/TransactionResponseRepository.java
  11. 11
      src/main/java/com/gcc/communityHall/paymentService/service/PaymentGatewayServiceImpl.java
  12. 19
      src/main/java/com/gcc/communityHall/repository/BookingCalendarRepository.java
  13. 2346
      src/main/java/com/gcc/communityHall/repository/BookingDetailsRepository.java
  14. 3
      src/main/java/com/gcc/communityHall/repository/HallDetailsRepository.java
  15. 5
      src/main/java/com/gcc/communityHall/service/BookingService.java
  16. 2936
      src/main/java/com/gcc/communityHall/service/Impl/BookingServiceImpl.java
  17. 2
      src/main/resources/templates/admin/adminpage.html
  18. 6
      src/main/resources/templates/admin/caretakerpage.html
  19. 360
      src/main/resources/templates/admin/developer.html
  20. 2555
      src/main/resources/templates/admin/gccblocking.html
  21. 6
      src/main/resources/templates/admin/ongoingevents.html
  22. 2
      src/main/resources/templates/admin/settlement-list.html
  23. 3
      src/main/resources/templates/admin/viewUploadNoc.html
  24. 25
      src/main/resources/templates/caretaker/caretakerpage.html
  25. 1
      src/main/resources/templates/caretaker/past-booking.html
  26. 8
      src/main/resources/templates/caretaker/present-booking.html
  27. 14
      src/main/resources/templates/fragments/PaymentScript.html
  28. 26
      src/main/resources/templates/fragments/adminMenu.html
  29. 44
      src/main/resources/templates/fragments/header-caretaker.html
  30. 6
      src/main/resources/templates/fragments/headquartersMenu.html
  31. 60
      src/main/resources/templates/fragments/logRegiOtpScript.html
  32. 2
      src/main/resources/templates/fragments/loginscript.html
  33. 4
      src/main/resources/templates/fragments/resetpassword.html
  34. 822
      src/main/resources/templates/headquarters/bookingwaiting.html
  35. 1387
      src/main/resources/templates/headquarters/gccblocking.html
  36. 2
      src/main/resources/templates/headquarters/headquarterspage.html
  37. 8
      src/main/resources/templates/headquarters/ongoingevents.html
  38. 1196
      src/main/resources/templates/headquarters/settlement-completed.html
  39. 3
      src/main/resources/templates/headquarters/viewUploadNoc.html
  40. 2
      src/main/resources/templates/officer/booking-list.html
  41. 2
      src/main/resources/templates/officer/rejected-list.html
  42. 4
      src/main/resources/templates/officiallogin.html
  43. 620
      src/main/resources/templates/user/calculatehallamount.html
  44. 20
      src/main/resources/templates/user/collectionpending.html
  45. 1985
      src/main/resources/templates/user/dashboard.html
  46. 537
      src/main/resources/templates/user/hallbookingform.html
  47. 212
      src/main/resources/templates/user/viewhallform.html
  48. 216
      src/main/resources/templates/user/viewhistory.html

1
src/main/java/com/gcc/communityHall/controller/AdminAPIController.java

@ -1486,7 +1486,6 @@ public class AdminAPIController {
} }
} }
@PostMapping("/uploadnoc") @PostMapping("/uploadnoc")
public ResponseEntity<String> uploadnoc(@RequestParam("nocFile") MultipartFile file, public ResponseEntity<String> uploadnoc(@RequestParam("nocFile") MultipartFile file,
@RequestParam("bookingid") int bookingId) { @RequestParam("bookingid") int bookingId) {

1253
src/main/java/com/gcc/communityHall/controller/Admincontroller.java
File diff suppressed because it is too large
View File

641
src/main/java/com/gcc/communityHall/controller/HeadquartersController.java

@ -1,10 +1,12 @@
package com.gcc.communityHall.controller; package com.gcc.communityHall.controller;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.gcc.communityHall.entity.GccBlockingDate;
import com.gcc.communityHall.others.AppConfig; import com.gcc.communityHall.others.AppConfig;
import com.gcc.communityHall.repository.GccBlockingDateRepository;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
@ -46,6 +48,9 @@ public class HeadquartersController {
@Autowired @Autowired
private BookingDetailsRepository bookingDetailsRepository; private BookingDetailsRepository bookingDetailsRepository;
@Autowired
private GccBlockingDateRepository blockingDateRepository;
@Autowired @Autowired
private AppConfig appConfig; private AppConfig appConfig;
@ -183,113 +188,113 @@ public class HeadquartersController {
@RequestParam(name = "hall1",required = false, defaultValue = "1000") Integer hallid, @RequestParam(name = "hall1",required = false, defaultValue = "1000") Integer hallid,
@RequestParam(name = "basedon", required = false) String basedon, @RequestParam(name = "basedon", required = false) String basedon,
@RequestParam(name = "bookingId", required = false) Long bookingId,HttpSession session) { @RequestParam(name = "bookingId", required = false) Long bookingId,HttpSession session) {
String headquartersname = (String) session.getAttribute("usertype");
if(headquartersname != null) {
long mobileno = (long) session.getAttribute("mobileno");
model.addAttribute("mobileno", mobileno);
List<Users> userList = handleUserRequest(request, fromDate, toDate, userstatus, usertype);
List<Object[]> bookingList = handleBookingRequest(request, fromDate, toDate, bookingStatus, filterby,bookingId,zone,division,hallid);
List<BookingDetails> bookingSettlementList = handleBookingSettlementRequest(request, fromDate, toDate, refundStatus,filterby);
//List<Object[]> paymentList = request.equals("3") ? bookingService.getAllPaymentsDetails(fromDate, toDate,zone,division,hallid) : new ArrayList<>();
List<Object[]> paymentList = new ArrayList<>();
List<Object[]> extrapaymentList = new ArrayList<>();
if (request.equals("3")) {
if (paymentStatus == null || paymentStatus.isEmpty()) {
paymentList = bookingService.getAllPaymentsDetails(fromDate, toDate, null,zone,division,hallid);
} else {
paymentList = bookingService.getAllPaymentsDetails(fromDate, toDate, paymentStatus,zone,division,hallid);
}
String headquartersname = (String) session.getAttribute("usertype");
if(headquartersname != null) {
long mobileno = (long) session.getAttribute("mobileno");
model.addAttribute("mobileno", mobileno);
List<Users> userList = handleUserRequest(request, fromDate, toDate, userstatus, usertype);
List<Object[]> bookingList = handleBookingRequest(request, fromDate, toDate, bookingStatus, filterby,bookingId,zone,division,hallid);
List<BookingDetails> bookingSettlementList = handleBookingSettlementRequest(request, fromDate, toDate, refundStatus,filterby);
//List<Object[]> paymentList = request.equals("3") ? bookingService.getAllPaymentsDetails(fromDate, toDate,zone,division,hallid) : new ArrayList<>();
List<Object[]> paymentList = new ArrayList<>();
List<Object[]> extrapaymentList = new ArrayList<>();
if (request.equals("3")) {
if (paymentStatus == null || paymentStatus.isEmpty()) {
paymentList = bookingService.getAllPaymentsDetails(fromDate, toDate, null,zone,division,hallid);
} else {
paymentList = bookingService.getAllPaymentsDetails(fromDate, toDate, paymentStatus,zone,division,hallid);
} }
if (request.equals("8")) {
if (paymentStatus == null || paymentStatus.isEmpty()) {
extrapaymentList = bookingService.getAllExtraPaymentsDetails(fromDate, toDate, null,zone,division,hallid);
} else {
extrapaymentList = bookingService.getAllExtraPaymentsDetails(fromDate, toDate, paymentStatus,zone,division,hallid);
}
}
if (request.equals("8")) {
if (paymentStatus == null || paymentStatus.isEmpty()) {
extrapaymentList = bookingService.getAllExtraPaymentsDetails(fromDate, toDate, null,zone,division,hallid);
} else {
extrapaymentList = bookingService.getAllExtraPaymentsDetails(fromDate, toDate, paymentStatus,zone,division,hallid);
} }
List<Object[]> userbookingList = request.equals("4") ? bookingService.getBookingUserDetailsReport(fromDate, toDate) : new ArrayList<>();
//List<Object[]> hallbookingList = request.equals("5") ? bookingService.getBookingHallDetailsReport(fromDate, toDate) : new ArrayList<>();
// In your controller method
// Fetch booking count by zone
List<Object[]> totalcount = new ArrayList<>();
int totalBookings = 0;
if ("7".equals(request)) {
if ("zone".equals(basedon)) {
totalcount = bookingDetailsRepository.countBookingsByZone();
// Format zone data
totalcount = totalcount.stream()
.map(data -> new Object[] { "Zone-" + data[0], data[1] })
.collect(Collectors.toList());
} else if ("division".equals(basedon)) {
totalcount = bookingDetailsRepository.countBookingsByDivisions();
// Format division data
totalcount = totalcount.stream()
.map(data -> new Object[] { "Division-" + data[0], data[1] })
.collect(Collectors.toList());
}
totalBookings = totalcount.stream()
.mapToInt(data -> ((Number) data[1]).intValue())
.sum();
}
List<Object[]> userbookingList = request.equals("4") ? bookingService.getBookingUserDetailsReport(fromDate, toDate) : new ArrayList<>();
//List<Object[]> hallbookingList = request.equals("5") ? bookingService.getBookingHallDetailsReport(fromDate, toDate) : new ArrayList<>();
// In your controller method
// Fetch booking count by zone
List<Object[]> totalcount = new ArrayList<>();
int totalBookings = 0;
if ("7".equals(request)) {
if ("zone".equals(basedon)) {
totalcount = bookingDetailsRepository.countBookingsByZone();
// Format zone data
totalcount = totalcount.stream()
.map(data -> new Object[] { "Zone-" + data[0], data[1] })
.collect(Collectors.toList());
} else if ("division".equals(basedon)) {
totalcount = bookingDetailsRepository.countBookingsByDivisions();
// Format division data
totalcount = totalcount.stream()
.map(data -> new Object[] { "Division-" + data[0], data[1] })
.collect(Collectors.toList());
} }
model.addAttribute("basedon", basedon);
model.addAttribute("totalcount", totalcount);
model.addAttribute("totalBookings", totalBookings);
List<Object[]> hallbookingList = handleBookingHallDetailsReportRequest(request, fromDate, toDate, filterby,zone,division,hallid);
model.addAttribute("filterby", filterby);
model.addAttribute("users", userList);
model.addAttribute("bookings", bookingList);
model.addAttribute("fromdate", fromDate);
model.addAttribute("todate", toDate);
model.addAttribute("userstatus", userstatus);
model.addAttribute("bookingSettlementList", bookingSettlementList);
model.addAttribute("usertype", usertype);
model.addAttribute("bookingStatus", bookingStatus);
model.addAttribute("refundStatus", refundStatus);
model.addAttribute("paymentStatus", paymentStatus);
model.addAttribute("request", request);
model.addAttribute("paymentLists", paymentList);
model.addAttribute("extrapaymentLists", extrapaymentList);
model.addAttribute("userbookingLists", userbookingList);
model.addAttribute("hallbookingLists", hallbookingList);
model.addAttribute("bookingId", bookingId);
model.addAttribute("zone1", zone);
model.addAttribute("division1", division);
model.addAttribute("hall1", hallid);
model.addAttribute("headquartersname", headquartersname);
return "headquarters/reports";
}else {
session.invalidate(); // Invalidate the session to clear all session attributes
return "redirect:/communityhall/login";
}
totalBookings = totalcount.stream()
.mapToInt(data -> ((Number) data[1]).intValue())
.sum();
}
model.addAttribute("basedon", basedon);
model.addAttribute("totalcount", totalcount);
model.addAttribute("totalBookings", totalBookings);
List<Object[]> hallbookingList = handleBookingHallDetailsReportRequest(request, fromDate, toDate, filterby,zone,division,hallid);
model.addAttribute("filterby", filterby);
model.addAttribute("users", userList);
model.addAttribute("bookings", bookingList);
model.addAttribute("fromdate", fromDate);
model.addAttribute("todate", toDate);
model.addAttribute("userstatus", userstatus);
model.addAttribute("bookingSettlementList", bookingSettlementList);
model.addAttribute("usertype", usertype);
model.addAttribute("bookingStatus", bookingStatus);
model.addAttribute("refundStatus", refundStatus);
model.addAttribute("paymentStatus", paymentStatus);
model.addAttribute("request", request);
model.addAttribute("paymentLists", paymentList);
model.addAttribute("extrapaymentLists", extrapaymentList);
model.addAttribute("userbookingLists", userbookingList);
model.addAttribute("hallbookingLists", hallbookingList);
model.addAttribute("bookingId", bookingId);
model.addAttribute("zone1", zone);
model.addAttribute("division1", division);
model.addAttribute("hall1", hallid);
model.addAttribute("headquartersname", headquartersname);
return "headquarters/reports";
}else {
session.invalidate(); // Invalidate the session to clear all session attributes
return "redirect:/communityhall/login";
} }
}
private List<Object[]> handleBookingHallDetailsReportRequest(String request, String fromDate, String toDate,String filterby,String zone,String division,Integer hallid) private List<Object[]> handleBookingHallDetailsReportRequest(String request, String fromDate, String toDate,String filterby,String zone,String division,Integer hallid)
{ {
if (!request.equals("5")) {
if (!request.equals("5")) {
return new ArrayList<>(); return new ArrayList<>();
} }
if(filterby.isEmpty())
if(filterby.isEmpty())
{
return bookingService.getBookingHallDetailsReportByBookingDate(fromDate, toDate,zone,division,hallid);
}
if ("1".equals(filterby))
{ {
return bookingService.getBookingHallDetailsReportByBookingDate(fromDate, toDate,zone,division,hallid);
return bookingService.getBookingHallDetailsReportByBookingDate(fromDate, toDate,zone,division,hallid);
} }
if ("1".equals(filterby))
if ("2".equals(filterby))
{ {
return bookingService.getBookingHallDetailsReportByBookingDate(fromDate, toDate,zone,division,hallid);
return bookingService.getBookingHallDetailsReportByEventDate(fromDate, toDate,zone,division,hallid);
} }
if ("2".equals(filterby))
{
return bookingService.getBookingHallDetailsReportByEventDate(fromDate, toDate,zone,division,hallid);
}
return new ArrayList<>();
return new ArrayList<>();
} }
private List<Users> handleUserRequest(String request, String fromDate, String toDate, String userstatus, String usertype) { private List<Users> handleUserRequest(String request, String fromDate, String toDate, String userstatus, String usertype) {
@ -308,101 +313,101 @@ public class HeadquartersController {
return userService.getAllUsers(fromDate, toDate); return userService.getAllUsers(fromDate, toDate);
} }
private List<Object[]> handleBookingRequest(String request, String fromDate, String toDate, String bookingStatus, String filterby,Long bookingId,String zone,String division,Integer hallid) { private List<Object[]> handleBookingRequest(String request, String fromDate, String toDate, String bookingStatus, String filterby,Long bookingId,String zone,String division,Integer hallid) {
if (!request.equals("2")) { if (!request.equals("2")) {
return new ArrayList<>(); return new ArrayList<>();
} }
if(filterby.isEmpty() && bookingStatus.isEmpty() && bookingId == null) if(filterby.isEmpty() && bookingStatus.isEmpty() && bookingId == null)
{ {
return bookingService.getBookingDetailsByBookingDate(fromDate, toDate,zone,division,hallid);
return bookingService.getBookingDetailsByBookingDate(fromDate, toDate,zone,division,hallid);
} }
if(bookingId!=null && bookingStatus.isEmpty()) if(bookingId!=null && bookingStatus.isEmpty())
{ {
return bookingDetailsRepo.getAllBookingDetailsWithBookingId(fromDate, toDate, bookingId);
return bookingDetailsRepo.getAllBookingDetailsWithBookingId(fromDate, toDate, bookingId);
} }
if(bookingId!=null && !bookingStatus.isEmpty()) if(bookingId!=null && !bookingStatus.isEmpty())
{ {
return bookingDetailsRepo.getAllBookingDetailsWithBookingIdwithbookingStatus(fromDate, toDate, bookingId,bookingStatus);
return bookingDetailsRepo.getAllBookingDetailsWithBookingIdwithbookingStatus(fromDate, toDate, bookingId,bookingStatus);
} }
if(bookingId==null && filterby.isEmpty() && !bookingStatus.isEmpty()) if(bookingId==null && filterby.isEmpty() && !bookingStatus.isEmpty())
{ {
return bookingService.getBookingDetailsByBookingDateWithStatus(fromDate, toDate, bookingStatus,zone,division,hallid);
return bookingService.getBookingDetailsByBookingDateWithStatus(fromDate, toDate, bookingStatus,zone,division,hallid);
} }
if(!filterby.isEmpty()) if(!filterby.isEmpty())
{ {
if ("1".equals(filterby))
{
if(bookingStatus.isEmpty())
{
return bookingService.getBookingDetailsByBookingDate(fromDate, toDate,zone,division,hallid);
}
else
{
return bookingService.getBookingDetailsByBookingDateWithStatus(fromDate, toDate, bookingStatus,zone,division,hallid);
}
}
if ("2".equals(filterby))
{
if(bookingStatus.isEmpty())
{
return bookingService.getBookingDetailsByEventDate(fromDate, toDate,zone,division,hallid);
}
else {
return bookingService.getBookingDetailsByEventDateWithStatus(fromDate, toDate, bookingStatus,zone,division,hallid);
}
}
}
// Handle default or error case
return new ArrayList<>();
if ("1".equals(filterby))
{
if(bookingStatus.isEmpty())
{
return bookingService.getBookingDetailsByBookingDate(fromDate, toDate,zone,division,hallid);
}
else
{
return bookingService.getBookingDetailsByBookingDateWithStatus(fromDate, toDate, bookingStatus,zone,division,hallid);
}
}
if ("2".equals(filterby))
{
if(bookingStatus.isEmpty())
{
return bookingService.getBookingDetailsByEventDate(fromDate, toDate,zone,division,hallid);
}
else {
return bookingService.getBookingDetailsByEventDateWithStatus(fromDate, toDate, bookingStatus,zone,division,hallid);
}
}
}
// Handle default or error case
return new ArrayList<>();
} }
private List<BookingDetails> handleBookingSettlementRequest(String request, String fromDate, String toDate, String refundStatus, String filterby) { private List<BookingDetails> handleBookingSettlementRequest(String request, String fromDate, String toDate, String refundStatus, String filterby) {
if (!request.equals("6")) { if (!request.equals("6")) {
return new ArrayList<>(); return new ArrayList<>();
} }
if(filterby.isEmpty() && refundStatus.isEmpty()) if(filterby.isEmpty() && refundStatus.isEmpty())
{ {
return bookingService.getAllBookingsettlementDetailsByBookingDate(fromDate, toDate);
return bookingService.getAllBookingsettlementDetailsByBookingDate(fromDate, toDate);
} }
if(filterby.isEmpty() && !refundStatus.isEmpty()) if(filterby.isEmpty() && !refundStatus.isEmpty())
{ {
return bookingService.getAllBookingsettlementDetailsByBookingDateWithStatus(fromDate, toDate, refundStatus);
return bookingService.getAllBookingsettlementDetailsByBookingDateWithStatus(fromDate, toDate, refundStatus);
} }
if(!filterby.isEmpty()) if(!filterby.isEmpty())
{ {
if ("1".equals(filterby))
{
if(refundStatus.isEmpty())
{
return bookingService.getAllBookingsettlementDetailsByBookingDate(fromDate, toDate);
}
else
{
return bookingService.getAllBookingsettlementDetailsByBookingDateWithStatus(fromDate, toDate, refundStatus);
}
}
if ("2".equals(filterby))
{
if(refundStatus.isEmpty())
{
return bookingService.getAllBookingsettlementDetailsByEventDate(fromDate, toDate);
}
else {
return bookingService.getAllBookingsettlementDetailsByEventDateWithStatus(fromDate, toDate, refundStatus);
}
}
}
// Handle default or error case
if ("1".equals(filterby))
{
if(refundStatus.isEmpty())
{
return bookingService.getAllBookingsettlementDetailsByBookingDate(fromDate, toDate);
}
else
{
return bookingService.getAllBookingsettlementDetailsByBookingDateWithStatus(fromDate, toDate, refundStatus);
}
}
if ("2".equals(filterby))
{
if(refundStatus.isEmpty())
{
return bookingService.getAllBookingsettlementDetailsByEventDate(fromDate, toDate);
}
else {
return bookingService.getAllBookingsettlementDetailsByEventDateWithStatus(fromDate, toDate, refundStatus);
}
}
}
// Handle default or error case
return new ArrayList<>(); return new ArrayList<>();
} }
@GetMapping("/ongoingevents") @GetMapping("/ongoingevents")
@ -425,165 +430,165 @@ public class HeadquartersController {
return "redirect:/communityhall/login"; return "redirect:/communityhall/login";
} }
} }
@GetMapping("/booking-list") @GetMapping("/booking-list")
public String viewBookingList(Model model,HttpSession session) { public String viewBookingList(Model model,HttpSession session) {
String headquartersname = (String) session.getAttribute("usertype");
if(headquartersname != null) {
long mobileno = (long) session.getAttribute("mobileno");
model.addAttribute("mobileno", mobileno);
model.addAttribute("headquartersname", headquartersname);
List<BookingDetails> bookingList = bookingDetailsRepository.getAllApprovedList();
model.addAttribute("bookingList", bookingList);
return "headquarters/booking-list"; // Assuming "officer/rejected-booking-list" is the name of your HTML template
}else {
session.invalidate(); // Invalidate the session to clear all session attributes
String headquartersname = (String) session.getAttribute("usertype");
if(headquartersname != null) {
long mobileno = (long) session.getAttribute("mobileno");
model.addAttribute("mobileno", mobileno);
model.addAttribute("headquartersname", headquartersname);
List<BookingDetails> bookingList = bookingDetailsRepository.getAllApprovedList();
model.addAttribute("bookingList", bookingList);
return "headquarters/booking-list"; // Assuming "officer/rejected-booking-list" is the name of your HTML template
}else {
session.invalidate(); // Invalidate the session to clear all session attributes
return "redirect:/communityhall/login"; return "redirect:/communityhall/login";
}
}
} }
@GetMapping("/rejected-list") @GetMapping("/rejected-list")
public String viewRejectedBookings(Model model,HttpSession session) { public String viewRejectedBookings(Model model,HttpSession session) {
String headquartersname = (String) session.getAttribute("usertype");
if(headquartersname != null) {
long mobileno = (long) session.getAttribute("mobileno");
model.addAttribute("mobileno", mobileno);
model.addAttribute("headquartersname", headquartersname);
List<BookingDetails> rejectedBookings = bookingDetailsRepository.getAllRejectingList();
model.addAttribute("rejectedBookings", rejectedBookings);
return "headquarters/rejected-list";
}else {
session.invalidate(); // Invalidate the session to clear all session attributes
String headquartersname = (String) session.getAttribute("usertype");
if(headquartersname != null) {
long mobileno = (long) session.getAttribute("mobileno");
model.addAttribute("mobileno", mobileno);
model.addAttribute("headquartersname", headquartersname);
List<BookingDetails> rejectedBookings = bookingDetailsRepository.getAllRejectingList();
model.addAttribute("rejectedBookings", rejectedBookings);
return "headquarters/rejected-list";
}else {
session.invalidate(); // Invalidate the session to clear all session attributes
return "redirect:/communityhall/login"; return "redirect:/communityhall/login";
}
}
} }
@GetMapping("/bookingwaitinglist") @GetMapping("/bookingwaitinglist")
public String viewWaitingBookings(Model model,HttpSession session) { public String viewWaitingBookings(Model model,HttpSession session) {
String headquartersname = (String) session.getAttribute("usertype");
if(headquartersname != null) {
long mobileno = (long) session.getAttribute("mobileno");
model.addAttribute("mobileno", mobileno);
model.addAttribute("headquartersname", headquartersname);
List<BookingDetails> waitingBookings = bookingDetailsRepository.getAllwaitingList();
model.addAttribute("waitingBookings", waitingBookings);
return "headquarters/bookingwaiting";
}else {
session.invalidate(); // Invalidate the session to clear all session attributes
String headquartersname = (String) session.getAttribute("usertype");
if(headquartersname != null) {
long mobileno = (long) session.getAttribute("mobileno");
model.addAttribute("mobileno", mobileno);
model.addAttribute("headquartersname", headquartersname);
List<BookingDetails> waitingBookings = bookingDetailsRepository.getAllwaitingList();
model.addAttribute("waitingBookings", waitingBookings);
return "headquarters/bookingwaiting";
}else {
session.invalidate(); // Invalidate the session to clear all session attributes
return "redirect:/communityhall/login"; return "redirect:/communityhall/login";
}
}
} }
@GetMapping("/settlement-approved") @GetMapping("/settlement-approved")
public String viewSettlementMaster(Model model, HttpSession session) { public String viewSettlementMaster(Model model, HttpSession session) {
String headquartersname = (String) session.getAttribute("usertype"); String headquartersname = (String) session.getAttribute("usertype");
if(headquartersname != null) { if(headquartersname != null) {
long mobileno = (long) session.getAttribute("mobileno");
model.addAttribute("mobileno", mobileno);
List<BookingDetails> approvedSettlements = bookingDetailsRepository.findAllWithApprovedRefundStatus();
long mobileno = (long) session.getAttribute("mobileno");
model.addAttribute("mobileno", mobileno);
List<BookingDetails> approvedSettlements = bookingDetailsRepository.findAllWithApprovedRefundStatus();
List<BookingDetails> settlements = new ArrayList<>(); List<BookingDetails> settlements = new ArrayList<>();
settlements.addAll(approvedSettlements);
List<BookingDetails> approvedcancelledbookings=bookingDetailsRepository.findCancelledList();
List<BookingDetails> approvedrejectedbookings=bookingDetailsRepository.findRejectedList();
model.addAttribute("headquartersname", headquartersname);
model.addAttribute("settlementlist", settlements);
model.addAttribute("approvedcancelledbookings",approvedcancelledbookings);
model.addAttribute("approvedrejectedbookings",approvedrejectedbookings);
return "headquarters/settlement-approved";
settlements.addAll(approvedSettlements);
List<BookingDetails> approvedcancelledbookings=bookingDetailsRepository.findCancelledList();
List<BookingDetails> approvedrejectedbookings=bookingDetailsRepository.findRejectedList();
model.addAttribute("headquartersname", headquartersname);
model.addAttribute("settlementlist", settlements);
model.addAttribute("approvedcancelledbookings",approvedcancelledbookings);
model.addAttribute("approvedrejectedbookings",approvedrejectedbookings);
return "headquarters/settlement-approved";
}else { }else {
session.invalidate(); // Invalidate the session to clear all session attributes
session.invalidate(); // Invalidate the session to clear all session attributes
return "redirect:/communityhall/login"; return "redirect:/communityhall/login";
} }
} }
@GetMapping("/settlement-initiatedlist") @GetMapping("/settlement-initiatedlist")
public String viewSettlementInitiatedMaster(Model model,HttpSession session) { public String viewSettlementInitiatedMaster(Model model,HttpSession session) {
String headquartersname = (String) session.getAttribute("usertype");
if(headquartersname != null) {
long mobileno = (long) session.getAttribute("mobileno");
model.addAttribute("mobileno", mobileno);
List<BookingDetails> settlement=bookingDetailsRepository.findByBookingDetailsRefundStatus();
List<BookingDetails> Initiatedcancelledbookings=bookingDetailsRepository.findInitiatedCancelledList();
List<BookingDetails> Initiatedrejectedbookings=bookingDetailsRepository.findInitiatedRejectedList();
model.addAttribute("title","settlement initiate");
model.addAttribute("headquartersname", headquartersname);
model.addAttribute("settlementlist",settlement);
model.addAttribute("Initiatedcancelledbookings",Initiatedcancelledbookings);
model.addAttribute("Initiatedrejectedbookings",Initiatedrejectedbookings);
return "headquarters/settlement-initiate";
}else {
session.invalidate(); // Invalidate the session to clear all session attributes
String headquartersname = (String) session.getAttribute("usertype");
if(headquartersname != null) {
long mobileno = (long) session.getAttribute("mobileno");
model.addAttribute("mobileno", mobileno);
List<BookingDetails> settlement=bookingDetailsRepository.findByBookingDetailsRefundStatus();
List<BookingDetails> Initiatedcancelledbookings=bookingDetailsRepository.findInitiatedCancelledList();
List<BookingDetails> Initiatedrejectedbookings=bookingDetailsRepository.findInitiatedRejectedList();
model.addAttribute("title","settlement initiate");
model.addAttribute("headquartersname", headquartersname);
model.addAttribute("settlementlist",settlement);
model.addAttribute("Initiatedcancelledbookings",Initiatedcancelledbookings);
model.addAttribute("Initiatedrejectedbookings",Initiatedrejectedbookings);
return "headquarters/settlement-initiate";
}else {
session.invalidate(); // Invalidate the session to clear all session attributes
return "redirect:/communityhall/login"; return "redirect:/communityhall/login";
}
}
} }
@GetMapping("/settlement-list") @GetMapping("/settlement-list")
public String settlementPendingList(Model model,HttpSession session) { public String settlementPendingList(Model model,HttpSession session) {
String headquartersname = (String) session.getAttribute("usertype");
if(headquartersname!=null) {
model.addAttribute("headquartersname", headquartersname);
long mobileno = (long) session.getAttribute("mobileno");
model.addAttribute("mobileno", mobileno);
model.addAttribute("title","settlement Pending");
String zone = (String) session.getAttribute("zone");
model.addAttribute("zone", zone);
List<BookingDetails> settlement=bookingDetailsRepository.findAllSettlementPending();
List<BookingDetails> cancelledbookings=bookingDetailsRepository.findAllSettlementCancelledList();
List<BookingDetails> rejectedbookings=bookingDetailsRepository.findAllSettlementRejectedList();
model.addAttribute("settlementlist",settlement);
model.addAttribute("cancelledbookings",cancelledbookings);
model.addAttribute("rejectedbookings",rejectedbookings);
return "headquarters/settlement-list";
}else {
session.invalidate();
return "redirect:/communityhall/login";
}
}
String headquartersname = (String) session.getAttribute("usertype");
if(headquartersname!=null) {
model.addAttribute("headquartersname", headquartersname);
long mobileno = (long) session.getAttribute("mobileno");
model.addAttribute("mobileno", mobileno);
model.addAttribute("title","settlement Pending");
String zone = (String) session.getAttribute("zone");
model.addAttribute("zone", zone);
List<BookingDetails> settlement=bookingDetailsRepository.findAllSettlementPending();
List<BookingDetails> cancelledbookings=bookingDetailsRepository.findAllSettlementCancelledList();
List<BookingDetails> rejectedbookings=bookingDetailsRepository.findAllSettlementRejectedList();
model.addAttribute("settlementlist",settlement);
model.addAttribute("cancelledbookings",cancelledbookings);
model.addAttribute("rejectedbookings",rejectedbookings);
return "headquarters/settlement-list";
}else {
session.invalidate();
return "redirect:/communityhall/login";
}
}
@GetMapping("/refundfailed-list") @GetMapping("/refundfailed-list")
public String RefundFailedList(Model model,HttpSession session) {
String headquartersname = (String) session.getAttribute("usertype");
if(headquartersname!=null) {
model.addAttribute("headquartersname", headquartersname);
long mobileno = (long) session.getAttribute("mobileno");
model.addAttribute("mobileno", mobileno);
model.addAttribute("title","settlementapproved");
String zone = (String) session.getAttribute("zone");
model.addAttribute("zone", zone);
List<BookingDetails> settlementrefundfailed=bookingDetailsRepository.findAllSettlementRefundFailed();
List<BookingDetails> refundfailedcancelledbookings=bookingDetailsRepository.findAllRefundFaileCancelledList();
List<BookingDetails> refundfailedrejectedbookings=bookingDetailsRepository.findAllRefundFaileRejectedList();
model.addAttribute("settlementrefundfailed",settlementrefundfailed);
model.addAttribute("refundfailedcancelledbookings",refundfailedcancelledbookings);
model.addAttribute("refundfailedrejectedbookings",refundfailedrejectedbookings);
return "headquarters/refund-failedlist";
}
else {
session.invalidate();
return "redirect:/communityhall/login";
}
}
public String RefundFailedList(Model model,HttpSession session) {
String headquartersname = (String) session.getAttribute("usertype");
if(headquartersname!=null) {
model.addAttribute("headquartersname", headquartersname);
long mobileno = (long) session.getAttribute("mobileno");
model.addAttribute("mobileno", mobileno);
model.addAttribute("title","settlementapproved");
String zone = (String) session.getAttribute("zone");
model.addAttribute("zone", zone);
List<BookingDetails> settlementrefundfailed=bookingDetailsRepository.findAllSettlementRefundFailed();
List<BookingDetails> refundfailedcancelledbookings=bookingDetailsRepository.findAllRefundFaileCancelledList();
List<BookingDetails> refundfailedrejectedbookings=bookingDetailsRepository.findAllRefundFaileRejectedList();
model.addAttribute("settlementrefundfailed",settlementrefundfailed);
model.addAttribute("refundfailedcancelledbookings",refundfailedcancelledbookings);
model.addAttribute("refundfailedrejectedbookings",refundfailedrejectedbookings);
return "headquarters/refund-failedlist";
}
else {
session.invalidate();
return "redirect:/communityhall/login";
}
}
@GetMapping("/settlement-completedlist") @GetMapping("/settlement-completedlist")
public String viewSettlementcompletedMaster(Model model,HttpSession session) { public String viewSettlementcompletedMaster(Model model,HttpSession session) {
String headquartersname = (String) session.getAttribute("usertype");
if(headquartersname != null) {
long mobileno = (long) session.getAttribute("mobileno");
model.addAttribute("mobileno", mobileno);
List<BookingDetails> completedlist=bookingDetailsRepository.findSettlementCompletedList();
List<BookingDetails> cancelledcompletedlist=bookingDetailsRepository.findCancelledCompletedList();
List<BookingDetails> rejectedcompletedlist=bookingDetailsRepository.findRejectedSettlementCompletedList();
model.addAttribute("title","settlement initiate");
model.addAttribute("headquartersname", headquartersname);
model.addAttribute("completedlist",completedlist);
model.addAttribute("cancelledcompletedlist",cancelledcompletedlist);
model.addAttribute("rejectedcompletedlist",rejectedcompletedlist);
return "headquarters/settlement-completed";
}else {
session.invalidate(); // Invalidate the session to clear all session attributes
String headquartersname = (String) session.getAttribute("usertype");
if(headquartersname != null) {
long mobileno = (long) session.getAttribute("mobileno");
model.addAttribute("mobileno", mobileno);
List<BookingDetails> completedlist=bookingDetailsRepository.findSettlementCompletedList();
List<BookingDetails> cancelledcompletedlist=bookingDetailsRepository.findCancelledCompletedList();
List<BookingDetails> rejectedcompletedlist=bookingDetailsRepository.findRejectedSettlementCompletedList();
model.addAttribute("title","settlement initiate");
model.addAttribute("headquartersname", headquartersname);
model.addAttribute("completedlist",completedlist);
model.addAttribute("cancelledcompletedlist",cancelledcompletedlist);
model.addAttribute("rejectedcompletedlist",rejectedcompletedlist);
return "headquarters/settlement-completed";
}else {
session.invalidate(); // Invalidate the session to clear all session attributes
return "redirect:/communityhall/login"; return "redirect:/communityhall/login";
}
}
} }
@GetMapping("/settlementlist") @GetMapping("/settlementlist")
@ -633,6 +638,62 @@ public class HeadquartersController {
} }
} }
@GetMapping("/logout")
public String viewLogout(Model model,HttpSession session) {
session.invalidate();
return "redirect:/communityhall/login";
}
@GetMapping("/Gccblocking")
public String viewGccBlocking(Model model, HttpSession session) {
String headquartersname = (String) session.getAttribute("usertype");
if(headquartersname != null) {
long mobileno = (long) session.getAttribute("mobileno");
model.addAttribute("mobileno", mobileno);
model.addAttribute("headquartersname", headquartersname);
// Fetch all blocked GCC dates
List<GccBlockingDate> gccBlocked = blockingDateRepository.findAllBlocked();
// Ensure distinct by hallId, blockingReason, startDate, and endDate
List<GccBlockingDate> uniqueGccBlockingDates = gccBlocked.stream()
.filter(distinctByKey(g -> Arrays.asList(
g.getHallId(),
g.getBlockingReason(),
g.getStartDate(),
g.getEndDate())))
.collect(Collectors.toList());
// Map to store the count of blocked halls for each GccBlockingDate
Map<Integer, Integer> hallCountMap = new HashMap<>();
for (GccBlockingDate blockedDate : uniqueGccBlockingDates) {
// Parse and count unique hall IDs
String hallIds = blockedDate.getHallId();
if (hallIds != null && !hallIds.isEmpty()) {
Set<String> uniqueHallIds = new HashSet<>(Arrays.asList(hallIds.split(",")));
int hallCount = uniqueHallIds.size();
hallCountMap.put(blockedDate.getBlockingId(), hallCount);
} else {
hallCountMap.put(blockedDate.getBlockingId(), 0); // No halls blocked
}
}
// Add attributes to the model for the view
model.addAttribute("gccblocked", uniqueGccBlockingDates);
model.addAttribute("hallCountMap", hallCountMap);
return "headquarters/gccblocking";
}else {
session.invalidate(); // Invalidate the session to clear all session attributes
return "redirect:/communityhall/login";
}
}
// Utility method to ensure distinct by a key
private static <T> Predicate<T> distinctByKey(Function<? super T, ?> keyExtractor) {
Set<Object> seen = new HashSet<>();
return t -> seen.add(keyExtractor.apply(t));
}
@GetMapping("/viewUploadNoc") @GetMapping("/viewUploadNoc")
public String viewUploadNoc(Model model, HttpSession session) { public String viewUploadNoc(Model model, HttpSession session) {
String headquartersname = (String) session.getAttribute("usertype"); String headquartersname = (String) session.getAttribute("usertype");
@ -653,11 +714,5 @@ public class HeadquartersController {
} }
} }
@GetMapping("/logout")
public String viewLogout(Model model,HttpSession session) {
session.invalidate();
return "redirect:/communityhall/login";
}
} }

132
src/main/java/com/gcc/communityHall/controller/OfficerAPIController.java

@ -170,63 +170,62 @@ public class OfficerAPIController {
BookingDetails book =bookingServiceImpl.getBookingsById(Integer.parseInt(bookingsId)); BookingDetails book =bookingServiceImpl.getBookingsById(Integer.parseInt(bookingsId));
return ResponseEntity.ok(book); return ResponseEntity.ok(book);
} }
@Operation( @Operation(
summary = "Settlement APPROVED REST API",
description = "REST API for Updating the Refund Status to Approved by Settlement Id If the settlement is Approved"
)
summary = "Settlement APPROVED REST API",
description = "REST API for Updating the Refund Status to Approved by Settlement Id If the settlement is Approved"
)
//Updating the Refund Status to Approved by Settlement Id If the settlement is Approved //Updating the Refund Status to Approved by Settlement Id If the settlement is Approved
@PostMapping("/updateApprovedSettlementStatus/{settlementId}") @PostMapping("/updateApprovedSettlementStatus/{settlementId}")
public ResponseEntity<Object> updateApprovedSettlementStatus( public ResponseEntity<Object> updateApprovedSettlementStatus(
@PathVariable("settlementId") int settlementId,
@RequestParam("status") BookingDetails.RefundStatus status,
@RequestParam("comments") String comments) {
try {
// Update settlement status
Settlement updateSettlement = settlementService.updateSettlementStatus(settlementId, status, comments);
if (updateSettlement == null) {
return new ResponseEntity<>(HttpStatus.NOT_FOUND);
}
@PathVariable("settlementId") int settlementId,
@RequestParam("status") BookingDetails.RefundStatus status,
@RequestParam("comments") String comments) {
// Log the action
String adminname = (String) session.getAttribute("usertype");
Integer loginid = (Integer) session.getAttribute("id");
ApplicationLogs logs = new ApplicationLogs();
logs.setComments("Action by " + adminname);
logs.setLoginId(loginid);
logs.setBookingId(updateSettlement.getBookingDetails().getBookingId());
logs.setLogType("Booking Status: " + status.toString());
try {
InetAddress inetAddress = InetAddress.getLocalHost();
String hostname = InetAddress.getLocalHost().getHostName();
logs.setIpaddress(inetAddress.getHostAddress());
logs.setSystemName(hostname);
} catch (UnknownHostException e) {
e.printStackTrace();
}
try {
// Update settlement status
Settlement updateSettlement = settlementService.updateSettlementStatus(settlementId, status, comments);
if (updateSettlement == null) {
return new ResponseEntity<>(HttpStatus.NOT_FOUND);
}
applicationLogsRepository.save(logs);
// Log the action
String adminname = (String) session.getAttribute("usertype");
Integer loginid = (Integer) session.getAttribute("id");
ApplicationLogs logs = new ApplicationLogs();
logs.setComments("Action by " + adminname);
logs.setLoginId(loginid);
logs.setBookingId(updateSettlement.getBookingDetails().getBookingId());
logs.setLogType("Booking Status: " + status.toString());
// Process refund request
String refundResponse = bookingServiceImpl.processRefundRequest(updateSettlement.getBookingDetails().getBookingId());
try {
InetAddress inetAddress = InetAddress.getLocalHost();
String hostname = InetAddress.getLocalHost().getHostName();
logs.setIpaddress(inetAddress.getHostAddress());
logs.setSystemName(hostname);
} catch (UnknownHostException e) {
e.printStackTrace();
}
if (refundResponse.contains("successful")) {
// Refund success, return updated settlement and status
return new ResponseEntity<>(updateSettlement, HttpStatus.OK);
} else {
// Refund failure, update refund status to FAILURE
bookingService.updateRefundStatus(updateSettlement.getBookingDetails().getBookingId(), BookingDetails.RefundStatus.FAILURE);
return new ResponseEntity<>("Refund processing failed: " + refundResponse, HttpStatus.INTERNAL_SERVER_ERROR);
}
applicationLogsRepository.save(logs);
} catch (Exception e) {
return new ResponseEntity<>("An error occurred while processing the settlement for Settlement ID: " + settlementId, HttpStatus.INTERNAL_SERVER_ERROR);
}
// Process refund request
String refundResponse = bookingServiceImpl.processRefundRequest(updateSettlement.getBookingDetails().getBookingId());
if (refundResponse.contains("successful")) {
// Refund success, return updated settlement and status
return new ResponseEntity<>(updateSettlement, HttpStatus.OK);
} else {
// Refund failure, update refund status to FAILURE
bookingService.updateRefundStatus(updateSettlement.getBookingDetails().getBookingId(), BookingDetails.RefundStatus.FAILURE);
return new ResponseEntity<>("Refund processing failed: " + refundResponse, HttpStatus.INTERNAL_SERVER_ERROR);
}
} catch (Exception e) {
return new ResponseEntity<>("An error occurred while processing the settlement for Settlement ID: " + settlementId, HttpStatus.INTERNAL_SERVER_ERROR);
}
} }
@Operation( @Operation(
summary = "Settlement APPROVED REST API", summary = "Settlement APPROVED REST API",
description = "REST API for Updating the Refund Status to Approved by Settlement Id If the settlement is Approved" description = "REST API for Updating the Refund Status to Approved by Settlement Id If the settlement is Approved"
@ -308,36 +307,35 @@ public class OfficerAPIController {
//Updating the Booking Status Approved by Booking Id //Updating the Booking Status Approved by Booking Id
@PostMapping("/updateBookingApproved/{bookingId}") @PostMapping("/updateBookingApproved/{bookingId}")
public ResponseEntity<BookingDetails> updateBookingApproved( public ResponseEntity<BookingDetails> updateBookingApproved(
@PathVariable("bookingId") int bookingId,
@RequestParam("status") BookingDetails.BookingStatus status,
@RequestParam("comments") String comments) {
@PathVariable("bookingId") int bookingId,
@RequestParam("status") BookingDetails.BookingStatus status,
@RequestParam("comments") String comments) {
BookingDetails updatedBooking = bookingService.updateBookingStatus(bookingId, status, comments);
String adminname = (String) session.getAttribute("usertype");
Integer loginid = (Integer) session.getAttribute("id");
ApplicationLogs logs=new ApplicationLogs();
logs.setComments("Action by " + adminname);
logs.setLoginId(loginid);
logs.setBookingId(bookingId);
logs.setLogType("Booking Status:-"+status.toString());
InetAddress inetAddress;
BookingDetails updatedBooking = bookingService.updateBookingStatus(bookingId, status, comments);
String adminname = (String) session.getAttribute("usertype");
Integer loginid = (Integer) session.getAttribute("id");
ApplicationLogs logs=new ApplicationLogs();
logs.setComments("Action by " + adminname);
logs.setLoginId(loginid);
logs.setBookingId(bookingId);
logs.setLogType("Booking Status:-"+status.toString());
InetAddress inetAddress;
try { try {
inetAddress = InetAddress.getLocalHost(); inetAddress = InetAddress.getLocalHost();
String hostname = InetAddress.getLocalHost().getHostName();
logs.setIpaddress(inetAddress.getHostAddress());
logs.setSystemName(hostname);
String hostname = InetAddress.getLocalHost().getHostName();
logs.setIpaddress(inetAddress.getHostAddress());
logs.setSystemName(hostname);
} catch (UnknownHostException e) { } catch (UnknownHostException e) {
e.printStackTrace(); e.printStackTrace();
} }
applicationLogsRepository.save(logs); applicationLogsRepository.save(logs);
if (updatedBooking != null) {
return new ResponseEntity<>(updatedBooking, HttpStatus.OK);
} else {
return new ResponseEntity<>(HttpStatus.NOT_FOUND);
}
if (updatedBooking != null) {
return new ResponseEntity<>(updatedBooking, HttpStatus.OK);
} else {
return new ResponseEntity<>(HttpStatus.NOT_FOUND);
}
} }
@PostMapping("/toggleStatus") @PostMapping("/toggleStatus")
public ResponseEntity<String> toggleUserStatus( public ResponseEntity<String> toggleUserStatus(
@RequestParam Integer userId, @RequestParam Integer userId,

2319
src/main/java/com/gcc/communityHall/controller/UserAPIController.java
File diff suppressed because it is too large
View File

506
src/main/java/com/gcc/communityHall/controller/UserController.java

@ -6,7 +6,6 @@ import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import jakarta.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.Model; import org.springframework.ui.Model;
@ -32,285 +31,284 @@ import com.gcc.communityHall.service.UserService;
import com.gcc.communityHall.service.Impl.WhatsappMsgServiceImpl; import com.gcc.communityHall.service.Impl.WhatsappMsgServiceImpl;
@Controller @Controller
@RequestMapping(value={"/communityhall/user","/communityhall","","/"})
@RequestMapping(value = {"/communityhall/user", "/communityhall", "", "/"})
public class UserController { public class UserController {
@Autowired UserSession userSession;
@Autowired
UserSession userSession;
@Autowired
private BookingService bookingService;
@Autowired
private HallDetailsRepository hallDetailsRepository;
@Autowired
private HallDetailService hallDetailsService;
@Autowired
private BookingService bookingService;
@Autowired
private HallDetailsRepository hallDetailsRepository;
@Autowired
private HallDetailService hallDetailsService;
@Autowired
private UserService userService;
@Autowired
private UserService userService;
@Autowired @Autowired
CalendarService calendarService; CalendarService calendarService;
@Autowired @Autowired
private WhatsappMsgServiceImpl whatsappMsgServiceImpl; private WhatsappMsgServiceImpl whatsappMsgServiceImpl;
@Autowired @Autowired
private HallDetailService hallDetailService; private HallDetailService hallDetailService;
@Autowired @Autowired
private NotificationRepository notificationRepository; private NotificationRepository notificationRepository;
@GetMapping(value = {"","/","/dashboard","/index"})
@GetMapping(value = {"", "/", "/dashboard", "/index"})
public String viewDashboard(Model model) { public String viewDashboard(Model model) {
List<HallDetails> halls=hallDetailsRepository.findActiveHalls();
List<HallDetails> hallnames=hallDetailsService.getHallNames();
for (HallDetails hall : halls) {
List<HallDetails> halls = hallDetailsRepository.findActiveHalls();
List<HallDetails> hallnames = hallDetailsService.getHallNames();
for (HallDetails hall : halls) {
if (hall.getHallImagesList() != null && !hall.getHallImagesList().isEmpty()) { if (hall.getHallImagesList() != null && !hall.getHallImagesList().isEmpty()) {
model.addAttribute("hasImages", true); model.addAttribute("hasImages", true);
break; break;
} }
} }
List<Notification> newnotification = notificationRepository.findActivenotifications();
List<Notification> newnotification = notificationRepository.findActivenotifications();
// Create a string to concatenate all notifications descriptions
StringBuilder notificationText = new StringBuilder();
for (Notification notification : newnotification) {
notificationText.append(notification.getNotification_description());
}
// Pass the concatenated string to the model
model.addAttribute("newnotification", notificationText.toString());
model.addAttribute("userName", userSession.getDispayName());
model.addAttribute("halls", halls);
model.addAttribute("hallnames", hallnames);
return "user/dashboard";
}
//Checkavilability Api
@GetMapping("/checkAvail")
public String checkAvail(@RequestParam("fromDate") String fromDate,
@RequestParam("toDate") String toDate,
@RequestParam("starting") String starting,
@RequestParam("ending") String ending,
@RequestParam(name = "hallId", required = false) String hallId,
@RequestParam(name = "zone", required = false) String zone,
Model model) {
List<Notification> newnotification = notificationRepository.findActivenotifications();
// Create a string to concatenate all notifications descriptions
StringBuilder notificationText = new StringBuilder();
// Create a string to concatenate all notifications descriptions
StringBuilder notificationText = new StringBuilder();
for (Notification notification : newnotification) {
notificationText.append(notification.getNotification_description());
}
// Pass the concatenated string to the model
model.addAttribute("newnotification", notificationText.toString());
List<HallDetails> hallnames = hallDetailService.getHallNames();
List<HallDetails> hallsByZone;
int hallIdd = 0;
// Parse hallId if provided
if (hallId != null && !hallId.isEmpty()) {
try {
hallIdd = Integer.parseInt(hallId);
} catch (NumberFormatException e) {
System.err.println("Invalid hallId: " + hallId);
}
}
// Fetch halls by zone if zone is provided
if (zone != null && !zone.isEmpty()) {
hallsByZone = hallDetailsRepository.findByZone(zone);
} else {
hallsByZone = hallDetailsRepository.findActiveHalls();
}
// Fetch calendar data based on provided parameters
List<BookingCalendar> data = calendarService.getCalendarByDateAndHallIdAndSlot(fromDate, toDate, starting, ending, hallIdd);
HashSet<Integer> removeHallId = new HashSet<>();
// Collect hall IDs to be removed
for (BookingCalendar calendar : data) {
boolean isSameDay = fromDate.equals(toDate) && fromDate.equals(calendar.getBdate().toString());
boolean isMorningStart = starting.equals("1");
boolean isMorningEnd = ending.equals("1");
boolean isEveningStart = starting.equals("2");
boolean isEveningEnd = ending.equals("2");
if (isSameDay) {
// Same day booking cases
if (isMorningStart && isMorningEnd && (calendar.getBdate().toString().equals(fromDate) && calendar.isMorningSlot())) {
// System.out.println("Same day morning-morning match found: hallId=" + calendar.getHallId());
removeHallId.add(calendar.getHallId());
} else if (isEveningStart && isEveningEnd && (calendar.getBdate().toString().equals(fromDate) && calendar.isEveningSlot())) {
// System.out.println("Same day evening-evening match found: hallId=" + calendar.getHallId());
removeHallId.add(calendar.getHallId());
} else if (isMorningStart && isEveningEnd &&
((calendar.getBdate().toString().equals(fromDate) && calendar.isMorningSlot()) ||
(calendar.getBdate().toString().equals(toDate) && calendar.isEveningSlot()))) {
// System.out.println("Same day morning-evening match found: hallId=" + calendar.getHallId());
removeHallId.add(calendar.getHallId());
}
} else {
// Multi-day booking cases
if ((isMorningStart && isMorningEnd) &&
((calendar.getBdate().toString().equals(fromDate) && calendar.isMorningSlot()) ||
(calendar.getBdate().toString().equals(toDate) && calendar.isMorningSlot()))) {
// System.out.println("Multi-day morning-morning match found: hallId=" + calendar.getHallId());
removeHallId.add(calendar.getHallId());
} else if ((isEveningStart && isEveningEnd) &&
((calendar.getBdate().toString().equals(fromDate) && calendar.isEveningSlot()) ||
(calendar.getBdate().toString().equals(toDate) && calendar.isEveningSlot()))) {
// System.out.println("Multi-day evening-evening match found: hallId=" + calendar.getHallId());
removeHallId.add(calendar.getHallId());
} else if (isMorningStart && isEveningEnd &&
((calendar.getBdate().toString().equals(fromDate) && calendar.isMorningSlot()) ||
(calendar.getBdate().toString().equals(toDate) && calendar.isEveningSlot()))) {
// System.out.println("Multi-day morning-evening match found: hallId=" + calendar.getHallId());
removeHallId.add(calendar.getHallId());
} else if (isEveningStart && isMorningEnd &&
((calendar.getBdate().toString().equals(fromDate) && calendar.isEveningSlot()) ||
(calendar.getBdate().toString().equals(toDate) && calendar.isMorningSlot()))) {
//System.out.println("Multi-day evening-morning match found: hallId=" + calendar.getHallId());
removeHallId.add(calendar.getHallId());
}
}
}
// Remove unavailable halls from the list
hallsByZone.removeIf(hall -> removeHallId.contains(hall.getHallId()));
List<HallDetails> removeHallById = new ArrayList<>();
if (hallIdd != 0) {
HallDetails hallDetails = hallDetailService.getHallById(hallIdd);
// Ensure the hall is available before adding it to the list
if (!removeHallId.contains(hallIdd)) {
removeHallById.add(hallDetails);
}
} else {
removeHallById = hallDetailService.removeHallById(removeHallId);
}
for (Notification notification : newnotification) {
notificationText.append(notification.getNotification_description());
}
// Populate the model attributes
model.addAttribute("userName", userSession.getDispayName());
model.addAttribute("hallnames", hallnames);
model.addAttribute("fromDate", fromDate);
model.addAttribute("toDate", toDate);
model.addAttribute("startingSlot", starting.equals("1") ? "Morning" : "Evening");
model.addAttribute("endingSlot", ending.equals("1") ? "Morning" : "Evening");
model.addAttribute("halls", (hallId != null && !hallId.isEmpty()) ? removeHallById : hallsByZone);
// Pass the concatenated string to the model
model.addAttribute("newnotification", notificationText.toString());
model.addAttribute("userName",userSession.getDispayName());
model.addAttribute("halls",halls);
model.addAttribute("hallnames",hallnames);
return "user/dashboard"; return "user/dashboard";
} }
//Checkavilability Api
@GetMapping("/checkAvail")
public String checkAvail(@RequestParam("fromDate") String fromDate,
@RequestParam("toDate") String toDate,
@RequestParam("starting") String starting,
@RequestParam("ending") String ending,
@RequestParam(name = "hallId", required = false) String hallId,
@RequestParam(name = "zone", required = false) String zone,
Model model) {
List<Notification> newnotification = notificationRepository.findActivenotifications();
// Create a string to concatenate all notifications descriptions
StringBuilder notificationText = new StringBuilder();
for (Notification notification : newnotification) {
notificationText.append(notification.getNotification_description());
}
// Pass the concatenated string to the model
model.addAttribute("newnotification", notificationText.toString());
List<HallDetails> hallnames = hallDetailService.getHallNames();
List<HallDetails> hallsByZone;
int hallIdd = 0;
// Parse hallId if provided
if (hallId != null && !hallId.isEmpty()) {
try {
hallIdd = Integer.parseInt(hallId);
} catch (NumberFormatException e) {
System.err.println("Invalid hallId: " + hallId);
}
}
// Fetch halls by zone if zone is provided
if (zone != null && !zone.isEmpty()) {
hallsByZone = hallDetailsRepository.findByZone(zone);
} else {
hallsByZone = hallDetailsRepository.findActiveHalls();
}
// Fetch calendar data based on provided parameters
List<BookingCalendar> data = calendarService.getCalendarByDateAndHallIdAndSlot(fromDate, toDate, starting, ending, hallIdd);
HashSet<Integer> removeHallId = new HashSet<>();
// Collect hall IDs to be removed
for (BookingCalendar calendar : data) {
boolean isSameDay = fromDate.equals(toDate) && fromDate.equals(calendar.getBdate().toString());
boolean isMorningStart = starting.equals("1");
boolean isMorningEnd = ending.equals("1");
boolean isEveningStart = starting.equals("2");
boolean isEveningEnd = ending.equals("2");
if (isSameDay) {
// Same day booking cases
if (isMorningStart && isMorningEnd && (calendar.getBdate().toString().equals(fromDate) && calendar.isMorningSlot())) {
// System.out.println("Same day morning-morning match found: hallId=" + calendar.getHallId());
removeHallId.add(calendar.getHallId());
} else if (isEveningStart && isEveningEnd && (calendar.getBdate().toString().equals(fromDate) && calendar.isEveningSlot())) {
// System.out.println("Same day evening-evening match found: hallId=" + calendar.getHallId());
removeHallId.add(calendar.getHallId());
} else if (isMorningStart && isEveningEnd &&
((calendar.getBdate().toString().equals(fromDate) && calendar.isMorningSlot()) ||
(calendar.getBdate().toString().equals(toDate) && calendar.isEveningSlot()))) {
// System.out.println("Same day morning-evening match found: hallId=" + calendar.getHallId());
removeHallId.add(calendar.getHallId());
}
} else {
// Multi-day booking cases
if ((isMorningStart && isMorningEnd) &&
((calendar.getBdate().toString().equals(fromDate) && calendar.isMorningSlot()) ||
(calendar.getBdate().toString().equals(toDate) && calendar.isMorningSlot()))) {
// System.out.println("Multi-day morning-morning match found: hallId=" + calendar.getHallId());
removeHallId.add(calendar.getHallId());
} else if ((isEveningStart && isEveningEnd) &&
((calendar.getBdate().toString().equals(fromDate) && calendar.isEveningSlot()) ||
(calendar.getBdate().toString().equals(toDate) && calendar.isEveningSlot()))) {
// System.out.println("Multi-day evening-evening match found: hallId=" + calendar.getHallId());
removeHallId.add(calendar.getHallId());
} else if (isMorningStart && isEveningEnd &&
((calendar.getBdate().toString().equals(fromDate) && calendar.isMorningSlot()) ||
(calendar.getBdate().toString().equals(toDate) && calendar.isEveningSlot()))) {
// System.out.println("Multi-day morning-evening match found: hallId=" + calendar.getHallId());
removeHallId.add(calendar.getHallId());
} else if (isEveningStart && isMorningEnd &&
((calendar.getBdate().toString().equals(fromDate) && calendar.isEveningSlot()) ||
(calendar.getBdate().toString().equals(toDate) && calendar.isMorningSlot()))) {
//System.out.println("Multi-day evening-morning match found: hallId=" + calendar.getHallId());
removeHallId.add(calendar.getHallId());
}
}
}
// Remove unavailable halls from the list
hallsByZone.removeIf(hall -> removeHallId.contains(hall.getHallId()));
List<HallDetails> removeHallById = new ArrayList<>();
if (hallIdd != 0) {
HallDetails hallDetails = hallDetailService.getHallById(hallIdd);
// Ensure the hall is available before adding it to the list
if (!removeHallId.contains(hallIdd)) {
removeHallById.add(hallDetails);
}
} else {
removeHallById = hallDetailService.removeHallById(removeHallId);
}
// Populate the model attributes
model.addAttribute("userName", userSession.getDispayName());
model.addAttribute("hallnames", hallnames);
model.addAttribute("fromDate", fromDate);
model.addAttribute("toDate", toDate);
model.addAttribute("startingSlot", starting.equals("1") ? "Morning" : "Evening");
model.addAttribute("endingSlot", ending.equals("1") ? "Morning" : "Evening");
model.addAttribute("halls", (hallId != null && !hallId.isEmpty()) ? removeHallById : hallsByZone);
return "user/dashboard";
}
@PostMapping("/newregistrationform")
public String showRegistrationForm(@ModelAttribute("newform") Users newform,Model model) {
Users user = userService.user(newform);
userSession.setMobileno(user.getMobileNo());
userSession.setDispayName(user.getName());
userSession.setUserId(user.getUserId());
userSession.setUserType(user.getUsertype().toString());
System.out.println("usetrtype=="+user.getUsertype().toString());
//System.out.println("employee id"+user.getGovernmentId());
//System.out.println("employee id"+user.getDepartment());
if (user.getUsertype() == userType.PUBLIC) {
String registersms="Welcome to GCC, Your User Registration for booking Community Centre is successful.";
String registerurlString ="https://tmegov.onex-aura.com/api/sms?key=pfTEYN6H&to="+user.getMobileNo()+"&from=GCCCRP&body="+registersms+"&entityid=1401572690000011081&templateid=1407172346621223019";
String registerwhatsupmsg="https://media.smsgupshup.com/GatewayAPI/rest?userid=2000233507&password=h2YjFNcJ&send_to="+user.getMobileNo()+"&v=1.1&format=json&msg_type=TEXT&method=SENDMESSAGE&msg=Welcome+to+GCC%2C+%0A%0AYour+User+Registration+for+booking+Community+Centre+is+successful.";
whatsappMsgServiceImpl.sendMsg(registerwhatsupmsg);
whatsappMsgServiceImpl.sendSMS(registerurlString);
}else {
String registerpendingsms="Welcome to GCC, Your User Registration request for booking Community Centre is submitted successfully.";
String registerpendingurlString ="https://tmegov.onex-aura.com/api/sms?key=pfTEYN6H&to="+user.getMobileNo()+"&from=GCCCRP&body="+registerpendingsms+"&entityid=1401572690000011081&templateid=1407172346629919381";
String registerpendingwhatsupmsg="https://media.smsgupshup.com/GatewayAPI/rest?userid=2000233507&password=h2YjFNcJ&send_to="+user.getMobileNo()+"&v=1.1&format=json&msg_type=TEXT&method=SENDMESSAGE&msg=Welcome+to+GCC%2C+%0A%0AYour+User+Registration+request+for+booking+Community+Centre+submitted+successfully.";
whatsappMsgServiceImpl.sendMsg(registerpendingwhatsupmsg);
whatsappMsgServiceImpl.sendSMS(registerpendingurlString);
}
return "redirect:/communityhall/dashboard";
}
@GetMapping("/hallbookingform")
public String viewform(Model model) {
String username = userSession.getDispayName();
if (username != null) {
model.addAttribute("userName", username);
return "user/hallbookingform";
} else {
return "redirect:/communityhall/dashboard";
}
}
@GetMapping("/viewhallform")
public String viewhallform(Model model) {
String username = userSession.getDispayName();
model.addAttribute("userName", username);
return "user/viewhallform";
}
@GetMapping("/acknowledgement")
public String viewakowledgement(Model model, int bookingId) {
BookingDetails bookingsDetails = bookingService.getBookingsById(bookingId);
model.addAttribute("bookingsDetails",bookingsDetails); // Add single BookingDetails object
model.addAttribute("userName",userSession.getDispayName());
return "user/acknowledgement";
}
@GetMapping("/logout")
public String logout(Model model) {
// Clear all login session (Check API Controller /gcc-login)
userSession.setUserId(null);
userSession.setMobileno(null);
userSession.setUserType(null);
userSession.setDispayName(null);
return "redirect:/communityhall/user/dashboard";
}
@GetMapping("/viewhistory")
public String viewBookingDetails(Model model,@RequestParam(name="bookingStatus",required = false)String bookingStatus) {
// Retrieve userId from session
Integer userId = userSession.getUserId();
model.addAttribute("userName", userSession.getDispayName());
//List<String> test = new ArrayList<>();
model.addAttribute("userName", userSession.getDispayName());
List<Map<String, Object>> bookingPast= bookingService.getAllBookingEventsByUserId(userId);
model.addAttribute("userBookingspast",bookingPast);
return "user/viewhistory";
}
@GetMapping("/CommunityHallList")
public String viewhalllist(Model model) {
model.addAttribute("userName",userSession.getDispayName());
return "user/communityHallList";
}
@GetMapping("/hallAmountCalculation")
public String viewCalculate(Model model){
model.addAttribute("userName",userSession.getDispayName());
return "user/calculatehallamount";
}
@GetMapping("/collectionpending")
public String viewCollectionpending(Model model,int bookingId){
BookingDetails bookingsDetails = bookingService.getBookingsById(bookingId);
model.addAttribute("bookingsDetails",bookingsDetails); // Add single BookingDetails object
model.addAttribute("userName",userSession.getDispayName());
return "user/collectionpending";
}
@GetMapping("/collectionpendingacknowledgement")
public String viewCollectionpendingAck(Model model,int bookingId){
BookingDetails bookingsDetails = bookingService.getBookingsById(bookingId);
model.addAttribute("bookingsDetails",bookingsDetails); // Add single BookingDetails object
model.addAttribute("userName",userSession.getDispayName());
return "user/extraebdamageamountack";
}
@PostMapping("/newregistrationform")
public String showRegistrationForm(@ModelAttribute("newform") Users newform, Model model) {
Users user = userService.user(newform);
userSession.setMobileno(user.getMobileNo());
userSession.setDispayName(user.getName());
userSession.setUserId(user.getUserId());
userSession.setUserType(user.getUsertype().toString());
System.out.println("usetrtype==" + user.getUsertype().toString());
//System.out.println("employee id"+user.getGovernmentId());
//System.out.println("employee id"+user.getDepartment());
if (user.getUsertype() == userType.PUBLIC) {
String registersms = "Welcome to GCC, Your User Registration for booking Community Centre is successful.";
String registerurlString = "https://tmegov.onex-aura.com/api/sms?key=pfTEYN6H&to=" + user.getMobileNo() + "&from=GCCCRP&body=" + registersms + "&entityid=1401572690000011081&templateid=1407172346621223019";
String registerwhatsupmsg = "https://media.smsgupshup.com/GatewayAPI/rest?userid=2000233507&password=h2YjFNcJ&send_to=" + user.getMobileNo() + "&v=1.1&format=json&msg_type=TEXT&method=SENDMESSAGE&msg=Welcome+to+GCC%2C+%0A%0AYour+User+Registration+for+booking+Community+Centre+is+successful.";
whatsappMsgServiceImpl.sendMsg(registerwhatsupmsg);
whatsappMsgServiceImpl.sendSMS(registerurlString);
} else {
String registerpendingsms = "Welcome to GCC, Your User Registration request for booking Community Centre is submitted successfully.";
String registerpendingurlString = "https://tmegov.onex-aura.com/api/sms?key=pfTEYN6H&to=" + user.getMobileNo() + "&from=GCCCRP&body=" + registerpendingsms + "&entityid=1401572690000011081&templateid=1407172346629919381";
String registerpendingwhatsupmsg = "https://media.smsgupshup.com/GatewayAPI/rest?userid=2000233507&password=h2YjFNcJ&send_to=" + user.getMobileNo() + "&v=1.1&format=json&msg_type=TEXT&method=SENDMESSAGE&msg=Welcome+to+GCC%2C+%0A%0AYour+User+Registration+request+for+booking+Community+Centre+submitted+successfully.";
whatsappMsgServiceImpl.sendMsg(registerpendingwhatsupmsg);
whatsappMsgServiceImpl.sendSMS(registerpendingurlString);
}
return "redirect:/communityhall/dashboard";
}
@GetMapping("/hallbookingform")
public String viewform(Model model) {
String username = userSession.getDispayName();
model.addAttribute("userName", username);
return "user/hallbookingform";
}
@GetMapping("/acknowledgement")
public String viewakowledgement(Model model, int bookingId) {
BookingDetails bookingsDetails = bookingService.getBookingsById(bookingId);
model.addAttribute("bookingsDetails", bookingsDetails); // Add single BookingDetails object
model.addAttribute("userName", userSession.getDispayName());
return "user/acknowledgement";
}
@GetMapping("/logout")
public String logout(Model model) {
// Clear all login session (Check API Controller /gcc-login)
userSession.setUserId(null);
userSession.setMobileno(null);
userSession.setUserType(null);
userSession.setDispayName(null);
return "redirect:/communityhall/user/dashboard";
}
@GetMapping("/viewhistory")
public String viewBookingDetails(Model model, @RequestParam(name = "bookingStatus", required = false) String bookingStatus) {
// Retrieve userId from session
Integer userId = userSession.getUserId();
model.addAttribute("userName", userSession.getDispayName());
//List<String> test = new ArrayList<>();
model.addAttribute("userName", userSession.getDispayName());
List<Map<String, Object>> bookingPast = bookingService.getAllBookingEventsByUserId(userId);
model.addAttribute("userBookingspast", bookingPast);
return "user/viewhistory";
}
@GetMapping("/CommunityHallList")
public String viewhalllist(Model model) {
model.addAttribute("userName", userSession.getDispayName());
return "user/communityHallList";
}
@GetMapping("/hallAmountCalculation")
public String viewCalculate(Model model) {
model.addAttribute("userName", userSession.getDispayName());
return "user/calculatehallamount";
}
@GetMapping("/collectionpending")
public String viewCollectionpending(Model model, int bookingId) {
BookingDetails bookingsDetails = bookingService.getBookingsById(bookingId);
model.addAttribute("bookingsDetails", bookingsDetails); // Add single BookingDetails object
model.addAttribute("userName", userSession.getDispayName());
return "user/collectionpending";
}
@GetMapping("/collectionpendingacknowledgement")
public String viewCollectionpendingAck(Model model, int bookingId) {
BookingDetails bookingsDetails = bookingService.getBookingsById(bookingId);
model.addAttribute("bookingsDetails", bookingsDetails); // Add single BookingDetails object
model.addAttribute("userName", userSession.getDispayName());
return "user/extraebdamageamountack";
}
@GetMapping("/viewhallform")
public String viewhallform(Model model) {
String username = userSession.getDispayName();
model.addAttribute("userName", username);
return "user/viewhallform";
}
} }

29
src/main/java/com/gcc/communityHall/entity/BookingCalendar.java

@ -20,9 +20,9 @@ public class BookingCalendar {
private boolean is_active; private boolean is_active;
private boolean is_delete; private boolean is_delete;
private int is_booked; private int is_booked;
private boolean is_blocked = false; private boolean is_blocked = false;
private boolean temp_blocked = false;
private int hallId; private int hallId;
public Integer getId() { public Integer getId() {
@ -33,14 +33,11 @@ public class BookingCalendar {
this.id = id; this.id = id;
} }
public boolean getIs_blocked() {
return is_blocked;
}
public void setIs_blocked(boolean is_blocked) {
this.is_blocked = is_blocked;
}
public LocalDate getBdate() {
public LocalDate getBdate() {
return bdate; return bdate;
} }
@ -112,22 +109,21 @@ public class BookingCalendar {
this.hallId = hallId; this.hallId = hallId;
} }
public boolean isTemp_blocked() {
return temp_blocked;
public boolean getIs_blocked() {
return is_blocked;
} }
public void setTemp_blocked(boolean temp_blocked) {
this.temp_blocked = temp_blocked;
public void setIs_blocked(boolean is_blocked) {
this.is_blocked = is_blocked;
} }
public BookingCalendar() {
public BookingCalendar() {
super(); super();
// TODO Auto-generated constructor stub // TODO Auto-generated constructor stub
} }
public BookingCalendar(Integer id, LocalDate bdate, boolean morningSlot, boolean eveningSlot, String bookingId_1, public BookingCalendar(Integer id, LocalDate bdate, boolean morningSlot, boolean eveningSlot, String bookingId_1,
String bookingId_2, boolean is_active, boolean is_delete, int is_booked,boolean is_blocked,
boolean temp_blocked, int hallId) {
String bookingId_2, boolean is_active, boolean is_delete, int is_booked, boolean is_blocked, int hallId) {
super(); super();
this.id = id; this.id = id;
this.bdate = bdate; this.bdate = bdate;
@ -139,7 +135,6 @@ public class BookingCalendar {
this.is_delete = is_delete; this.is_delete = is_delete;
this.is_booked = is_booked; this.is_booked = is_booked;
this.is_blocked = is_blocked; this.is_blocked = is_blocked;
this.temp_blocked = temp_blocked;
this.hallId = hallId; this.hallId = hallId;
} }

104
src/main/java/com/gcc/communityHall/paymentService/controller/PaymentAPIController.java

@ -5,7 +5,6 @@ import java.security.NoSuchAlgorithmException;
import java.util.HashMap; import java.util.HashMap;
import java.util.Optional; import java.util.Optional;
import com.gcc.communityHall.service.Impl.BookingServiceImpl;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.ui.Model; import org.springframework.ui.Model;
@ -60,9 +59,6 @@ public class PaymentAPIController {
@Autowired @Autowired
private TransactionNumberGenerator transactionNumber; private TransactionNumberGenerator transactionNumber;
@Autowired
private BookingServiceImpl bookingService;
// @Operation( // @Operation(
// summary = "Refund the Total Amount REST API", // summary = "Refund the Total Amount REST API",
@ -132,59 +128,53 @@ public class PaymentAPIController {
summary = "payment-request REST API", summary = "payment-request REST API",
description = "REST API payment-request" description = "REST API payment-request"
) )
@PostMapping(value = {"/payment-request"})
public HashMap<String, Object> startPayment(int userId, int bookingId) throws NoSuchAlgorithmException {
//System.out.println("I entered payment Service......"+bookingId+ "User Id :- "+userId);
HashMap<String, Object> hs = new HashMap<>();
Optional<BookingDetails> findById = bookRepo.findById(bookingId);
if (findById.isPresent()) {
//System.out.println("Success in finding booking Id");
BookingDetails booking = findById.get();
Users user = booking.getUsers();
int findUserId = user.getUserId();
boolean slotStatus = bookingService.isSlotOccupied(booking);
System.out.println("slot status: " + slotStatus);
//System.out.println("Merchant ID:-"+this.paymentConfig.getMerchantId());
if(!slotStatus){
String txnId = "CHB" + transactionNumber.generateTransactionNumber() + String.format("%05d", findUserId); //create transaction Id unique from our side
String totalAmt = String.valueOf(booking.getAmountReceived()); //Amount of Community Hall from our side
TransactionResponse response = new TransactionResponse();
response.setTxansactionId(txnId);
response.setHallId(booking.getHallDetails().getHallId());
response.setUserId(String.valueOf(findUserId));//make it dynamic
response.setStatusCode("temp");
response.setBookingId(bookingId);
this.paymentService.recordResponse(response);
String merchantId = this.paymentConfig.getMerchantId(); //This is Test Merchant ID from worldLine
String consumerId = String.format("%05d", findUserId); // Replace consumer ID in c964634 from our side
String consumerMobileNo = String.valueOf(user.getMobileNo()); //Replace consumer Mobile no in 9879879870 from our side
String consumerEmailId = user.getEmail(); //replace consumer email Id
String encryptedtoken = this.paymentService.getToken(merchantId + "|", txnId + "|", totalAmt + "|", "|", consumerId + "|", consumerMobileNo + "|", consumerEmailId + "|", "|", "|", "|", "|", "|", "|", "|", "|", "|", this.paymentConfig.getEncryptionKey());
hs.put("txansactionId", txnId);
hs.put("token", encryptedtoken);
hs.put("amount", totalAmt);
hs.put("merchantId", merchantId);
hs.put("consumerMobileNo", consumerMobileNo);
hs.put("consumerEmailId", consumerEmailId);
hs.put("consumerId", consumerId);
hs.put("error", false);
} else{
hs.put("status", "slotOccupied");
return hs;
}
} else {
hs.put("error", true);
}
return hs;
}
@PostMapping(value = {"/payment-request"})
public HashMap<String,Object> startPayment(int userId,int bookingId) throws NoSuchAlgorithmException {
//System.out.println("I entered payment Service......"+bookingId+ "User Id :- "+userId);
HashMap<String, Object> hs = new HashMap<>();
Optional<BookingDetails> findById = bookRepo.findById(bookingId);
if(findById.isPresent()) {
//System.out.println("Success in finding booking Id");
BookingDetails booking = findById.get();
Users user = booking.getUsers();
int findUserId=user.getUserId();
//System.out.println("Merchant ID:-"+this.paymentConfig.getMerchantId());
String txnId="CHB"+transactionNumber.generateTransactionNumber()+String.format("%05d", findUserId); //create transaction Id unique from our side
String totalAmt = String.valueOf(booking.getAmountReceived()); //Amount of Community Hall from our side
TransactionResponse response = new TransactionResponse();
response.setTxansactionId(txnId);
response.setHallId(booking.getHallDetails().getHallId());
response.setUserId(String.valueOf(findUserId));//make it dynamic
response.setStatusCode("temp");
response.setBookingId(bookingId);
this.paymentService.recordResponse(response);
String merchantId = this.paymentConfig.getMerchantId(); //This is Test Merchant ID from worldLine
String consumerId=String.format("%05d", findUserId); // Replace consumer ID in c964634 from our side
String consumerMobileNo=String.valueOf(user.getMobileNo()); //Replace consumer Mobile no in 9879879870 from our side
String consumerEmailId=user.getEmail(); //replace consumer email Id
String encryptedtoken = this.paymentService.getToken(merchantId+"|", txnId+"|", totalAmt+"|", "|", consumerId+"|", consumerMobileNo+"|", consumerEmailId+"|", "|", "|", "|", "|", "|", "|", "|", "|", "|", this.paymentConfig.getEncryptionKey());
hs.put("txansactionId",txnId);
hs.put("token",encryptedtoken);
hs.put("amount",totalAmt);
hs.put("merchantId",merchantId);
hs.put("consumerMobileNo",consumerMobileNo);
hs.put("consumerEmailId",consumerEmailId);
hs.put("consumerId",consumerId);
hs.put("error", false);
}
else {
hs.put("error", true);
}
return hs;
}
@Operation( @Operation(
summary = "Additional Damage payment-request REST API", summary = "Additional Damage payment-request REST API",

2
src/main/java/com/gcc/communityHall/paymentService/controller/PaymentController.java

@ -118,7 +118,6 @@ public class PaymentController {
TransactionResponse save = transactionResRepo.save(response); TransactionResponse save = transactionResRepo.save(response);
if(paymentService.generateToken(c).equals(confirmToken) && status.equals(res[0])){ if(paymentService.generateToken(c).equals(confirmToken) && status.equals(res[0])){
payment.setPaymentType(res[11]);
payment.setPaymentStatus("Success"); payment.setPaymentStatus("Success");
bookingsDetails.setPayments(payment); bookingsDetails.setPayments(payment);
String confirmBooking = bookser.confirmBooking(response.getBookingId()); String confirmBooking = bookser.confirmBooking(response.getBookingId());
@ -205,7 +204,6 @@ public class PaymentController {
if(paymentService.generateToken(c).equals(confirmToken) && status.equals(res[0])){ if(paymentService.generateToken(c).equals(confirmToken) && status.equals(res[0])){
payment.setPaymentStatus("Success"); payment.setPaymentStatus("Success");
payment.setPaymentType(res[11]);
bookingsDetails.setExtrapayments(payment); bookingsDetails.setExtrapayments(payment);
bookingsDetails.getSettlement().setCollectionStatus("Paid"); bookingsDetails.getSettlement().setCollectionStatus("Paid");
bookingsDetails.setBookingStatus(BookingStatus.COMPLETED); bookingsDetails.setBookingStatus(BookingStatus.COMPLETED);

16
src/main/java/com/gcc/communityHall/paymentService/repository/TransactionResponseRepository.java

@ -24,20 +24,8 @@ public interface TransactionResponseRepository extends JpaRepository<Transaction
Optional<TransactionResponse> findByTxansactionIdAndStatusCode(String txansactionId,String statusCode ); Optional<TransactionResponse> findByTxansactionIdAndStatusCode(String txansactionId,String statusCode );
Optional<TransactionResponse> findByBookingIdAndStatusCode(int bookingId, String statusCode); Optional<TransactionResponse> findByBookingIdAndStatusCode(int bookingId, String statusCode);
Optional<TransactionResponse> findByBookingIdAndTxansactionIdAndStatusCode(int bookingId,String txansactionId, String statusCode); Optional<TransactionResponse> findByBookingIdAndTxansactionIdAndStatusCode(int bookingId,String txansactionId, String statusCode);
@Query(value = "SELECT tr.booking_id, tr.hall_id, tr.amount, tr.status_code, tr.txansaction_id, tr.user_id, p.payment_status " +
"FROM transaction_response tr " +
"JOIN hall_details hd ON tr.hall_id = hd.hall_id " +
"LEFT JOIN payments p ON tr.booking_id = p.booking_details_booking_id " +
"LEFT JOIN booking_details bd ON tr.booking_id = bd.booking_id " +
"WHERE DATE(bd.booking_date) between :fromDate and :toDate " +
"AND (:bookingId IS NULL OR tr.booking_id = :bookingId) " +
"AND (:hallId IS NULL OR tr.hall_id = :hallId)", nativeQuery = true)
List<Object[]> getTransactionResponseByBookingId(@Param("fromDate") String fromDate,
@Param("toDate") String toDate,
@Param("bookingId") Long bookingId,
@Param("hallId") Long hallId);
/*
@Query(value = "SELECT tr.booking_id, tr.hall_id, tr.amount, tr.status_code, tr.txansaction_id, tr.user_id, p.payment_status " + @Query(value = "SELECT tr.booking_id, tr.hall_id, tr.amount, tr.status_code, tr.txansaction_id, tr.user_id, p.payment_status " +
"FROM transaction_response tr " + "FROM transaction_response tr " +
"JOIN hall_details hd ON tr.hall_id = hd.hall_id " + "JOIN hall_details hd ON tr.hall_id = hd.hall_id " +
@ -51,7 +39,7 @@ public interface TransactionResponseRepository extends JpaRepository<Transaction
@Param("toDate") String toDate, @Param("toDate") String toDate,
@Param("bookingId") Long bookingId, @Param("bookingId") Long bookingId,
@Param("hallId") Long hallId); @Param("hallId") Long hallId);
*/
// @Transactional // @Transactional

11
src/main/java/com/gcc/communityHall/paymentService/service/PaymentGatewayServiceImpl.java

@ -248,8 +248,7 @@ public class PaymentGatewayServiceImpl implements PaymentGatewayService {
recordRefundResponse.setBalaceAmount(myObject.getPaymentMethod().getPaymentTransaction().getBalanceAmount()); recordRefundResponse.setBalaceAmount(myObject.getPaymentMethod().getPaymentTransaction().getBalanceAmount());
this.recordRefund(recordRefundResponse); this.recordRefund(recordRefundResponse);
RefundTransaction refundTransaction=new RefundTransaction(); RefundTransaction refundTransaction=new RefundTransaction();
double refundAmount = Double.parseDouble(recordRefundResponse.getAmount()) - Double.parseDouble(recordRefundResponse.getBalaceAmount());
refundTransaction.setAmountRefunded(refundAmount);
refundTransaction.setAmountRefunded(Double.parseDouble(recordRefundResponse.getAmount()));
refundTransaction.setCdate(new Date()); refundTransaction.setCdate(new Date());
Optional<BookingDetails> bookingsDetails=bookingDetailsRepository.findById(bookingId); Optional<BookingDetails> bookingsDetails=bookingDetailsRepository.findById(bookingId);
BookingDetails bookingDetails=bookingsDetails.get(); BookingDetails bookingDetails=bookingsDetails.get();
@ -321,8 +320,7 @@ public class PaymentGatewayServiceImpl implements PaymentGatewayService {
recordRefundResponse.setBalaceAmount(myObject.getPaymentMethod().getPaymentTransaction().getBalanceAmount()); recordRefundResponse.setBalaceAmount(myObject.getPaymentMethod().getPaymentTransaction().getBalanceAmount());
this.recordRefund(recordRefundResponse); this.recordRefund(recordRefundResponse);
RefundTransaction refundTransaction=new RefundTransaction(); RefundTransaction refundTransaction=new RefundTransaction();
double refundAmount = Double.parseDouble(recordRefundResponse.getAmount()) - Double.parseDouble(recordRefundResponse.getBalaceAmount());
refundTransaction.setAmountRefunded(refundAmount);
refundTransaction.setAmountRefunded(Double.parseDouble(recordRefundResponse.getAmount()));
refundTransaction.setCdate(new Date()); refundTransaction.setCdate(new Date());
Optional<BookingDetails> bookingsDetails=bookingDetailsRepository.findById(bookingId); Optional<BookingDetails> bookingsDetails=bookingDetailsRepository.findById(bookingId);
BookingDetails bookingDetails=bookingsDetails.get(); BookingDetails bookingDetails=bookingsDetails.get();
@ -349,7 +347,7 @@ public class PaymentGatewayServiceImpl implements PaymentGatewayService {
Optional<BookingDetails> bookings=bookingDetailsRepository.findById(bookingId); Optional<BookingDetails> bookings=bookingDetailsRepository.findById(bookingId);
BookingDetails bookingdetails= null; BookingDetails bookingdetails= null;
if(bookings.isPresent()) { if(bookings.isPresent()) {
bookingdetails=bookings.get();
bookingdetails=bookings.get();
if((bookingdetails.getBookingStatus() == BookingDetails.BookingStatus.REFUNDED) && if((bookingdetails.getBookingStatus() == BookingDetails.BookingStatus.REFUNDED) &&
(bookingdetails.getRefundStatus() == RefundStatus.COMPLETED)) { (bookingdetails.getRefundStatus() == RefundStatus.COMPLETED)) {
return "Error"; return "Error";
@ -413,8 +411,7 @@ public class PaymentGatewayServiceImpl implements PaymentGatewayService {
bookingdetails.setRefundStatus(RefundStatus.COMPLETED); bookingdetails.setRefundStatus(RefundStatus.COMPLETED);
bookingDetailsRepository.save(bookingdetails); bookingDetailsRepository.save(bookingdetails);
RefundTransaction refundTransaction=new RefundTransaction(); RefundTransaction refundTransaction=new RefundTransaction();
double refundAmount = Double.parseDouble(recordRefundResponse.getAmount()) - Double.parseDouble(recordRefundResponse.getBalaceAmount());
refundTransaction.setAmountRefunded(refundAmount);
refundTransaction.setAmountRefunded(Double.parseDouble(recordRefundResponse.getAmount()));
refundTransaction.setCdate(new Date()); refundTransaction.setCdate(new Date());
refundTransaction.setBookingDetails(bookingdetails); refundTransaction.setBookingDetails(bookingdetails);
refundTransaction.setRefundIdentifier(myObject.getPaymentMethod().getPaymentTransaction().getRefundIdentifier()); refundTransaction.setRefundIdentifier(myObject.getPaymentMethod().getPaymentTransaction().getRefundIdentifier());

19
src/main/java/com/gcc/communityHall/repository/BookingCalendarRepository.java

@ -5,7 +5,6 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional; import java.util.Optional;
import jakarta.transaction.Transactional;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query; import org.springframework.data.jpa.repository.Query;
@ -13,7 +12,6 @@ import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import com.gcc.communityHall.entity.BookingCalendar; import com.gcc.communityHall.entity.BookingCalendar;
import com.gcc.communityHall.entity.BookingDetails;
@Repository @Repository
public interface BookingCalendarRepository extends JpaRepository<BookingCalendar,Integer> { public interface BookingCalendarRepository extends JpaRepository<BookingCalendar,Integer> {
@ -62,17 +60,6 @@ public interface BookingCalendarRepository extends JpaRepository<BookingCalendar
void updateBdateByBookingIdAndDate(@Param("newDate") LocalDate newDate, @Param("bookingId") String bookingId, @Param("currentDate") LocalDate currentDate); void updateBdateByBookingIdAndDate(@Param("newDate") LocalDate newDate, @Param("bookingId") String bookingId, @Param("currentDate") LocalDate currentDate);
Optional<BookingCalendar> findByBdate(LocalDate bdate); Optional<BookingCalendar> findByBdate(LocalDate bdate);
/* @Query(value = "SELECT bc.bdate, bc.booking_id_1, bc.booking_id_2, bc.morning_slot, bc.evening_slot, hd.hall_name, hd.hall_id " +
"FROM booking_calendar bc " +
"JOIN hall_details hd ON bc.hall_id = hd.hall_id " +
"WHERE bc.bdate >= :fromDate " +
"AND bc.bdate <= :toDate " +
"AND (:bookingId IS NULL OR (bc.booking_id_1 = :bookingId OR bc.booking_id_2 = :bookingId))",
nativeQuery = true)
List<Object[]> findBookingCalendarDetails(@Param("fromDate") String fromDate,
@Param("toDate") String toDate,
@Param("bookingId") Long bookingId);*/
@Query(value = "SELECT bc.bdate, bc.booking_id_1, bc.booking_id_2, bc.morning_slot, bc.evening_slot, hd.hall_name, hd.hall_id " + @Query(value = "SELECT bc.bdate, bc.booking_id_1, bc.booking_id_2, bc.morning_slot, bc.evening_slot, hd.hall_name, hd.hall_id " +
"FROM booking_calendar bc " + "FROM booking_calendar bc " +
"JOIN hall_details hd ON bc.hall_id = hd.hall_id " + "JOIN hall_details hd ON bc.hall_id = hd.hall_id " +
@ -86,10 +73,4 @@ List<Object[]> findBookingCalendarDetails(@Param("fromDate") String fromDate,
@Param("bookingId") Long bookingId, @Param("bookingId") Long bookingId,
@Param("hallName") String hallName); @Param("hallName") String hallName);
@Modifying
@Transactional
@Query("UPDATE BookingCalendar bc set bc.temp_blocked = :tempBlock WHERE (bc.id =:finalBcid)")
void updateTempBlocked(int finalBcid, boolean tempBlock);
} }

2346
src/main/java/com/gcc/communityHall/repository/BookingDetailsRepository.java
File diff suppressed because it is too large
View File

3
src/main/java/com/gcc/communityHall/repository/HallDetailsRepository.java

@ -42,7 +42,8 @@ public interface HallDetailsRepository extends JpaRepository<HallDetails,Integer
@Query(value = "SELECT * FROM hall_details WHERE is_active = 1 order by hall_name asc", nativeQuery = true) @Query(value = "SELECT * FROM hall_details WHERE is_active = 1 order by hall_name asc", nativeQuery = true)
List<HallDetails> findActiveHalls(); List<HallDetails> findActiveHalls();
//admin dashboard //admin dashboard
@Query(nativeQuery = true, value ="SELECT SUM(CASE WHEN b.booking_status = 'APPROVED' THEN 1 ELSE 0 END) AS approvedCount,\r\n" @Query(nativeQuery = true, value ="SELECT SUM(CASE WHEN b.booking_status = 'APPROVED' THEN 1 ELSE 0 END) AS approvedCount,\r\n"

5
src/main/java/com/gcc/communityHall/service/BookingService.java

@ -16,7 +16,6 @@ import com.gcc.communityHall.entity.BookingDetails.BookingStatus;
import com.gcc.communityHall.entity.BookingDetails.RefundStatus; import com.gcc.communityHall.entity.BookingDetails.RefundStatus;
import com.gcc.communityHall.entity.EbDetails; import com.gcc.communityHall.entity.EbDetails;
import com.gcc.communityHall.entity.GccBlockingDate; import com.gcc.communityHall.entity.GccBlockingDate;
import com.gcc.communityHall.paymentService.entity.TransactionResponse;
public interface BookingService { public interface BookingService {
BookingDetails getBookingsById(int BookingId); BookingDetails getBookingsById(int BookingId);
@ -150,5 +149,7 @@ List<Object[]> getAllExtraPaymentsDetails( String fromDate, String toDate,String
//developer //developer
List<Object[]> getTransactionresponse(String fromDate, String toDate, Long bookingId,Long hallId); List<Object[]> getTransactionresponse(String fromDate, String toDate, Long bookingId,Long hallId);
List<Object[]> getRefundResponse(String fromDate, String toDate, Long bookingId); List<Object[]> getRefundResponse(String fromDate, String toDate, Long bookingId);
List<Object[]> getBookingCalendarDetails(String fromDate, String toDate,Long bookingId ,String hallName);
List<Object[]> getBookingCalendarDetails(String fromDate, String toDate, Long bookingId,String hallName);
List<BookingDetails> getBookingsByDateAndHall(String bookingDate, Long hallId);
} }

2936
src/main/java/com/gcc/communityHall/service/Impl/BookingServiceImpl.java
File diff suppressed because it is too large
View File

2
src/main/resources/templates/admin/adminpage.html

@ -130,7 +130,7 @@
</div> </div>
<button type="button" class="btn btn-success mb-3" onclick="addMaterialRow()"><i <button type="button" class="btn btn-success mb-3" onclick="addMaterialRow()"><i
class="fas fa-plus"></i>Add class="fas fa-plus"></i>Add
</button>
Material</button>
<!-- Hidden input for total Damage Amount --> <!-- Hidden input for total Damage Amount -->
<input type="hidden" id="hiddenTotalDamageAmount" name="totalDamageAmount"> <input type="hidden" id="hiddenTotalDamageAmount" name="totalDamageAmount">

6
src/main/resources/templates/admin/caretakerpage.html

@ -314,15 +314,15 @@
let usedUnits = endReading - startReading; let usedUnits = endReading - startReading;
// Show total used units // Show total used units
document.getElementById("totalUsedUnits").style.display = "block"; document.getElementById("totalUsedUnits").style.display = "block";
document.getElementById("totalUsedUnits").innerText = usedUnits;
document.getElementById("hiddenTotalUsedUnits").value = usedUnits;
document.getElementById("totalUsedUnits").innerText = usedUnits.toFixed(2);
document.getElementById("hiddenTotalUsedUnits").value = usedUnits.toFixed(2);
let totalEBAmount = usedUnits * parseFloat(document.getElementById("ebCostPerUnit").value) || 0; let totalEBAmount = usedUnits * parseFloat(document.getElementById("ebCostPerUnit").value) || 0;
// Show total EB amount // Show total EB amount
document.getElementById("totalEBAmount").style.display = "block"; document.getElementById("totalEBAmount").style.display = "block";
document.getElementById("totalEBAmount").innerText = totalEBAmount.toFixed(2); document.getElementById("totalEBAmount").innerText = totalEBAmount.toFixed(2);
document.getElementById("hiddenTotalEBAmount").value = totalEBAmount;
document.getElementById("hiddenTotalEBAmount").value = totalEBAmount.toFixed(2);
calculateSettlementAmount(); calculateSettlementAmount();
} }

360
src/main/resources/templates/admin/developer.html

@ -55,195 +55,195 @@
</style> </style>
<body> <body>
<!-- Page Container -->
<div id="page-container"
class="sidebar-o sidebar-dark enable-page-overlay side-scroll page-header-fixed page-header-dark">
<!-- Side Overlay aside (right)-->
<aside th:replace="~{fragments/aside-right :: aside}"></aside>
<!-- END Side Overlay (right)-->
<!-- Sidebar Nav-->
<nav th:replace="~{fragments/nav-admin :: nav}"></nav>
<!-- END Sidebar -->
<!-- Header -->
<header th:replace="~{fragments/header-admin :: header}"></header>
<!-- END Header -->
<!-- Main Container -->
<main id="main-container">
<!-- Page Content -->
<!-- Card Container -->
<div class="content">
<div class="block block-rounded">
<form id="myForm" th:action="@{/communityhall/admin/getDeveloperdetails}" onsubmit="return validateme()"
method="post">
<div class="block-header bg-primary text-white">
<h3 class="block-title">Community Hall Reports</h3>
</div>
<div class="block-content">
<div class="row">
<div class="col-sm-3 mb-2">
<label class="form-label" for="fromdate">From:<span
class="text-danger">*</span></label> <input type="date"
th:value="${fromdate}" class="form-control" name="FromDate" id="fromdate"
placeholder="From Date" required="required" data-date-format="yyyy-mm-dd" />
</div>
<div class="col-sm-3 mb-2">
<label class="form-label" for="todate">To:<span class="text-danger">*</span></label>
<input type="date" th:value="${todate}" class="form-control" name="ToDate"
id="todate" placeholder="To Date" required="required"
data-date-format="yyyy-mm-dd" />
</div>
<div class="col-sm-3 mb-2">
<label class="form-label" for="request">Get Info:<span
class="text-danger">*</span></label>
<select type="text" class="form-control text-center" id="request" name="request"
<!-- Page Container -->
<div id="page-container"
class="sidebar-o sidebar-dark enable-page-overlay side-scroll page-header-fixed page-header-dark">
<!-- Side Overlay aside (right)-->
<aside th:replace="~{fragments/aside-right :: aside}"></aside>
<!-- END Side Overlay (right)-->
<!-- Sidebar Nav-->
<nav th:replace="~{fragments/nav-admin :: nav}"></nav>
<!-- END Sidebar -->
<!-- Header -->
<header th:replace="~{fragments/header-admin :: header}"></header>
<!-- END Header -->
<!-- Main Container -->
<main id="main-container">
<!-- Page Content -->
<!-- Card Container -->
<div class="content">
<div class="block block-rounded">
<form id="myForm" th:action="@{/communityhall/admin/getDeveloperdetails}" onsubmit="return validateme()"
method="post">
<div class="block-header bg-primary text-white">
<h3 class="block-title">Community Hall Reports</h3>
</div>
<div class="block-content">
<div class="row">
<div class="col-sm-3 mb-2">
<label class="form-label" for="fromdate">From:<span
class="text-danger">*</span></label> <input type="date"
th:value="${fromdate}" class="form-control" name="FromDate" id="fromdate"
placeholder="From Date" required="required" data-date-format="yyyy-mm-dd" />
</div>
<div class="col-sm-3 mb-2">
<label class="form-label" for="todate">To:<span class="text-danger">*</span></label>
<input type="date" th:value="${todate}" class="form-control" name="ToDate"
id="todate" placeholder="To Date" required="required"
data-date-format="yyyy-mm-dd" />
</div>
<div class="col-sm-3 mb-2">
<label class="form-label" for="request">Get Info:<span
class="text-danger">*</span></label>
<select type="text" class="form-control text-center" id="request" name="request"
onchange="myRequest()" required> onchange="myRequest()" required>
<option value="">Select</option>
<option value="1" th:selected="${request=='1'}">Transaction Response</option>
<option value="2" th:selected="${request=='2'}">Refund Response</option>
<option value="3" th:selected="${request=='3'}">Booking Calendar</option>
</select>
</div>
<!-- bookingDetailsDropdown1 -->
<div class="col-sm-3 mb-2" id="bookingDetailsDropdown1" style="display: none;">
<label class="form-label" for="bookingId">Booking Id: </label>
<input type="number" class="form-control" id="bookingId" name="bookingId"
th:value="${bookingId}" placeholder="BookingId">
</div>
<!-- bookingDetailsDropdown2 -->
<div class="col-sm-3 mb-2" id="bookingDetailsDropdown2" style="display: none;">
<label class="form-label" for="hallId">Hall Id: </label>
<input type="number" class="form-control" id="hallId" name="hallId"
th:value="${hallId}" placeholder="HallId">
</div>
<div class="col-sm-3 mb-2" id="bookingDetailsDropdown3" style="display: none;">
<label class="form-label" for="hallNameDropdown">Hall Name:</label>
<select class="form-select custom-select" name="hallName" id="hallNameDropdown">
<option th:value="${hallName}">--Select Hall--</option>
<!-- Initial population using Thymeleaf -->
<th:block th:each="hall : ${halls}">
<option th:value="${hall.hallName}"
th:text="${hall.hallName}">
</option>
</th:block>
</select>
</div>
<div class="col-sm-3">
<br>
<button type="submit" class="btn btn-sm btn-primary mt-2" name="submit"
<option value="">Select</option>
<option value="1" th:selected="${request=='1'}">Transaction Response</option>
<option value="2" th:selected="${request=='2'}">Refund Response</option>
<option value="3" th:selected="${request=='3'}">Booking Calendar</option>
</select>
</div>
<!-- bookingDetailsDropdown1 -->
<div class="col-sm-3 mb-2" id="bookingDetailsDropdown1" style="display: none;">
<label class="form-label" for="bookingId">Booking Id: </label>
<input type="number" class="form-control" id="bookingId" name="bookingId"
th:value="${bookingId}" placeholder="BookingId">
</div>
<!-- bookingDetailsDropdown2 -->
<div class="col-sm-3 mb-2" id="bookingDetailsDropdown2" style="display: none;">
<label class="form-label" for="hallId">Hall Id: </label>
<input type="number" class="form-control" id="hallId" name="hallId"
th:value="${hallId}" placeholder="HallId">
</div>
<div class="col-sm-3 mb-2" id="bookingDetailsDropdown3" style="display: none;">
<label class="form-label" for="hallNameDropdown">Hall Name:</label>
<select class="form-select custom-select" name="hallName" id="hallNameDropdown">
<option th:value="${hallName}">--Select Hall--</option>
<!-- Initial population using Thymeleaf -->
<th:block th:each="hall : ${halls}">
<option th:value="${hall.hallName}"
th:text="${hall.hallName}">
</option>
</th:block>
</select>
</div>
<div class="col-sm-3">
<br>
<button type="submit" class="btn btn-sm btn-primary mt-2" name="submit"
id="submit">Submit</button> id="submit">Submit</button>
<button class="btn btn-danger mt-2" onclick="resetDate()" name="reset"
<button class="btn btn-danger mt-2" onclick="resetDate()" name="reset"
type="reset">Reset</button> type="reset">Reset</button>
</div>
</div> </div>
</div> </div>
</form>
</div>
<div class="table-responsive" id="requestTable1Container" th:if="${request}==1">
<table id="requestTable1" class="table table-striped table-bordered table-hover dataTable"
role="grid" width="99.5%">
<thead class="thead-dark">
<tr role="row">
<th>S.No</th>
<th>Booking Id</th>
<th>Hall Id</th>
<th>Amount</th>
<th>Status Code</th>
<th>Transaction Id</th>
<th>User Id</th>
<!--<th>Payment Status</th>-->
</tr>
</thead>
<tr th:each="transaction, iterStat : ${TransactionResponse}">
<td th:text="${iterStat.count}">0</td>
<td th:text="${transaction[0]}"></td>
<td th:text="${transaction[1]}"></td>
<td th:text="${transaction[2]}"></td>
<td th:text="${transaction[3]}"></td>
<td th:text="${transaction[4]}"></td>
<td th:text="${transaction[5]}"></td>
<!--
<td th:text="${transaction[6]}"></td>
-->
</tr>
</table>
</div>
<div class="table-responsive" id="requestTable2Container" th:if="${request}==2">
<table id="requestTable2" class="table table-striped table-bordered table-hover dataTable"
role="grid" width="99.5%">
<thead class="thead-dark">
<tr role="row">
<th>S.No</th>
<th>Booking Id</th>
<th>Booking Date</th>
<th>Refund Status</th>
<th>Amount</th>
<th>Transaction Id</th>
<th>User Id</th>
</tr>
</thead>
<tbody>
<tr th:each="refund, iterStat : ${RefundResponse}">
<td th:text="${iterStat.count}">0</td>
<td th:text="${refund[0]}"></td>
<td th:text="${refund[1] != null ? refund[1] : '-'}"></td>
<td th:text="${refund[2]}"></td>
<td th:text="${refund[3]}"></td>
<td th:text="${refund[4]}"></td>
<td th:text="${refund[5]}"></td>
</tr>
</tbody>
</table>
</div>
<div class="table-responsive" id="requestTable3Container" th:if="${request}==3">
<table id="requestTable3" class="table table-striped table-bordered table-hover dataTable"
role="grid" width="99.5%">
<thead class="thead-dark">
<tr role="row">
<th>S.No</th>
<th>Booking Date</th>
<th>Booking Id1</th>
<th>Booking Id2</th>
<th>Morning Slot</th>
<th>Evening Slot</th>
<th>Hall Name</th>
<th>Hall Id</th>
</tr>
</thead>
<tbody>
<tr th:each="booking, iterStat : ${BookingCalendar}">
<td th:text="${iterStat.count}">0</td>
<td th:text="${booking[0]}"></td>
<td th:text="${booking[1] != null ? booking[1] : '-'}"></td>
<td th:text="${booking[2] != null ? booking[2] : '-'}"></td>
<td th:text="${booking[3]}"></td>
<td th:text="${booking[4]}"></td>
<td th:text="${booking[5]}"></td>
<td th:text="${booking[6]}"></td>
</tr>
</tbody>
</table>
</div>
</div>
</form>
</div>
<div class="table-responsive" id="requestTable1Container" th:if="${request}==1">
<table id="requestTable1" class="table table-striped table-bordered table-hover dataTable"
role="grid" width="99.5%">
<thead class="thead-dark">
<tr role="row">
<th>S.No</th>
<th>Booking Id</th>
<th>Hall Id</th>
<th>Amount</th>
<th>Status Code</th>
<th>Transaction Id</th>
<th>User Id</th>
<!--<th>Payment Status</th>-->
</tr>
</thead>
<tr th:each="transaction, iterStat : ${TransactionResponse}">
<td th:text="${iterStat.count}">0</td>
<td th:text="${transaction[0]}"></td>
<td th:text="${transaction[1]}"></td>
<td th:text="${transaction[2]}"></td>
<td th:text="${transaction[3]}"></td>
<td th:text="${transaction[4]}"></td>
<td th:text="${transaction[5]}"></td>
<!--
<td th:text="${transaction[6]}"></td>
-->
</tr>
</table>
</div> </div>
</main>
<footer th:replace="~{fragments/footer2 :: footer}"></footer>
</div>
<div class="table-responsive" id="requestTable2Container" th:if="${request}==2">
<table id="requestTable2" class="table table-striped table-bordered table-hover dataTable"
role="grid" width="99.5%">
<thead class="thead-dark">
<tr role="row">
<th>S.No</th>
<th>Booking Id</th>
<th>Booking Date</th>
<th>Refund Status</th>
<th>Amount</th>
<th>Transaction Id</th>
<th>User Id</th>
</tr>
</thead>
<tbody>
<tr th:each="refund, iterStat : ${RefundResponse}">
<td th:text="${iterStat.count}">0</td>
<td th:text="${refund[0]}"></td>
<td th:text="${refund[1] != null ? refund[1] : '-'}"></td>
<td th:text="${refund[2]}"></td>
<td th:text="${refund[3]}"></td>
<td th:text="${refund[4]}"></td>
<td th:text="${refund[5]}"></td>
</tr>
</tbody>
</table>
</div>
<div class="table-responsive" id="requestTable3Container" th:if="${request}==3">
<table id="requestTable3" class="table table-striped table-bordered table-hover dataTable"
role="grid" width="99.5%">
<thead class="thead-dark">
<tr role="row">
<th>S.No</th>
<th>Booking Date</th>
<th>Booking Id1</th>
<th>Booking Id2</th>
<th>Morning Slot</th>
<th>Evening Slot</th>
<th>Hall Name</th>
<th>Hall Id</th>
</tr>
</thead>
<tbody>
<tr th:each="booking, iterStat : ${BookingCalendar}">
<td th:text="${iterStat.count}">0</td>
<td th:text="${booking[0]}"></td>
<td th:text="${booking[1] != null ? booking[1] : '-'}"></td>
<td th:text="${booking[2] != null ? booking[2] : '-'}"></td>
<td th:text="${booking[3]}"></td>
<td th:text="${booking[4]}"></td>
<td th:text="${booking[5]}"></td>
<td th:text="${booking[6]}"></td>
</tr>
</tbody>
</table>
</div>
<div th:replace="~{fragments/resetpassword :: div}"></div>
<script th:replace="~{fragments/loginscript :: script}"></script>
</div>
</main>
<footer th:replace="~{fragments/footer2 :: footer}"></footer>
</div>
<div th:replace="~{fragments/resetpassword :: div}"></div>
<script th:replace="~{fragments/loginscript :: script}"></script>
<script> <script>
$(document).ready(function () { $(document).ready(function () {
// Common buttons configuration // Common buttons configuration
@ -420,7 +420,7 @@ function myRequest() {
document.getElementById('todate').value = ''; document.getElementById('todate').value = '';
} }
document.addEventListener('DOMContentLoaded', function () { document.addEventListener('DOMContentLoaded', function () {
document.getElementById('request').addEventListener('change', function () { document.getElementById('request').addEventListener('change', function () {
myRequest(); // Handle request change myRequest(); // Handle request change
}); });

2555
src/main/resources/templates/admin/gccblocking.html
File diff suppressed because it is too large
View File

6
src/main/resources/templates/admin/ongoingevents.html

@ -96,7 +96,6 @@
<th class="text-center">Action</th>--> <th class="text-center">Action</th>-->
<th>Hall Name</th> <th>Hall Name</th>
<th>Booking Id</th> <th>Booking Id</th>
<th>Reason for Booking</th>
<th>Start Date</th> <th>Start Date</th>
<th>End Date</th> <th>End Date</th>
<th>No of Days</th> <th>No of Days</th>
@ -122,7 +121,6 @@
</td>--> </td>-->
<td th:text="${booking.hallDetails.hallName}"></td> <td th:text="${booking.hallDetails.hallName}"></td>
<td th:text="${booking.bookingId}"></td> <td th:text="${booking.bookingId}"></td>
<td th:text="${booking.reason}"></td>
<td th:text="${booking.startDate}"></td> <td th:text="${booking.startDate}"></td>
<td th:text="${booking.endDate}"></td> <td th:text="${booking.endDate}"></td>
<td th:text="${booking.noOfDays}"></td> <td th:text="${booking.noOfDays}"></td>
@ -179,7 +177,6 @@
<th class="text-center">Action</th>--> <th class="text-center">Action</th>-->
<th>Hall Name</th> <th>Hall Name</th>
<th>Booking Id</th> <th>Booking Id</th>
<th>Reason for Booking</th>
<th>Start Date</th> <th>Start Date</th>
<th>End Date</th> <th>End Date</th>
<th>No of Days</th> <th>No of Days</th>
@ -206,7 +203,6 @@
<td th:text="${booking.hallDetails.hallName}"></td> <td th:text="${booking.hallDetails.hallName}"></td>
<td th:text="${booking.bookingId}"></td> <td th:text="${booking.bookingId}"></td>
<td th:text="${booking.reason}"></td>
<td th:text="${booking.startDate}"></td> <td th:text="${booking.startDate}"></td>
<td th:text="${booking.endDate}"></td> <td th:text="${booking.endDate}"></td>
<td th:text="${booking.noOfDays}"></td> <td th:text="${booking.noOfDays}"></td>
@ -264,7 +260,6 @@
<th>Hall Name</th> <th>Hall Name</th>
<th>Booking Id</th> <th>Booking Id</th>
<th>Reason for Booking</th>
<th>Start Date</th> <th>Start Date</th>
<th>End Date</th> <th>End Date</th>
<th>No of Days</th> <th>No of Days</th>
@ -291,7 +286,6 @@
<td th:text="${booking.hallDetails.hallName}"></td> <td th:text="${booking.hallDetails.hallName}"></td>
<td th:text="${booking.bookingId}"></td> <td th:text="${booking.bookingId}"></td>
<td th:text="${booking.reason}"></td>
<td th:text="${booking.startDate}"></td> <td th:text="${booking.startDate}"></td>
<td th:text="${booking.endDate}"></td> <td th:text="${booking.endDate}"></td>
<td th:text="${booking.noOfDays}"></td> <td th:text="${booking.noOfDays}"></td>

2
src/main/resources/templates/admin/settlement-list.html

@ -448,7 +448,7 @@
style="padding: 0.45rem 0.45rem; color: green;" id="td_pending_amt"> style="padding: 0.45rem 0.45rem; color: green;" id="td_pending_amt">
0</td> 0</td>
</tr> </tr>
<tr id="collectionstatuscolumn">
<tr id="collectionstatuscolumn">
<th id="label" <th id="label"
style="padding: 0.45rem 0.45rem;font-weight: normal">Collection Pending Status style="padding: 0.45rem 0.45rem;font-weight: normal">Collection Pending Status
:</th> :</th>

3
src/main/resources/templates/admin/viewUploadNoc.html

@ -422,6 +422,7 @@
icon: 'warning', icon: 'warning',
title: 'No File Selected', title: 'No File Selected',
text: 'Please select a file to upload.', text: 'Please select a file to upload.',
allowOutsideClick: false,
}); });
return; return;
} }
@ -449,6 +450,7 @@
icon: 'success', icon: 'success',
title: 'Success', title: 'Success',
text: 'NOC uploaded successfully!', text: 'NOC uploaded successfully!',
allowOutsideClick: false,
}).then(() => { }).then(() => {
$('#uploadNocModal').modal('hide'); // Close the modal $('#uploadNocModal').modal('hide'); // Close the modal
location.reload(); // Refresh the page location.reload(); // Refresh the page
@ -460,6 +462,7 @@
icon: 'error', icon: 'error',
title: 'Upload Failed', title: 'Upload Failed',
text: 'Failed to upload NOC: ' + xhr.responseText, text: 'Failed to upload NOC: ' + xhr.responseText,
allowOutsideClick: false,
}); });
} }
}); });

25
src/main/resources/templates/caretaker/caretakerpage.html

@ -130,7 +130,7 @@
</div> </div>
<button type="button" class="btn btn-success mb-3" onclick="addMaterialRow()"><i <button type="button" class="btn btn-success mb-3" onclick="addMaterialRow()"><i
class="fas fa-plus"></i>Add class="fas fa-plus"></i>Add
</button>
Material</button>
<!-- Hidden input for total Damage Amount --> <!-- Hidden input for total Damage Amount -->
<input type="hidden" id="hiddenTotalDamageAmount" name="totalDamageAmount"> <input type="hidden" id="hiddenTotalDamageAmount" name="totalDamageAmount">
@ -374,30 +374,12 @@
formData.append('ebAmount', ebAmount); formData.append('ebAmount', ebAmount);
var i = damageindex; var i = damageindex;
var isValid = true;
$('#damageDetailsbody tr').each(function () { $('#damageDetailsbody tr').each(function () {
var assetName = $("#materials" + i).val(); var assetName = $("#materials" + i).val();
var comments = $("#comments" + i).val(); var comments = $("#comments" + i).val();
var quantity = $("#quantity" + i).val(); var quantity = $("#quantity" + i).val();
var assetAmount = $("#totalDamageAmount" + i).html(); var assetAmount = $("#totalDamageAmount" + i).html();
var assetImageInput = $("#damagePhoto" + i)[0].files[0]; // Assuming input type is file for assetImage var assetImageInput = $("#damagePhoto" + i)[0].files[0]; // Assuming input type is file for assetImage
// Skip validation if no material is selected
if (!assetName) {
i = i - 1;
return true; // Continue to the next row
}
// Consolidated validation for selected material
if (!quantity || isNaN(quantity) || quantity <= 0 ||
!assetAmount || isNaN(assetAmount) || assetAmount <= 0 ||
!comments || !assetImageInput) {
alert("Please provide all valid details for row " + (i + 1) + ".");
isValid = false;
return false; // Exit the loop if validation fails
}
formData.append('assetName', assetName); formData.append('assetName', assetName);
formData.append('comments', comments); formData.append('comments', comments);
formData.append('quantity', quantity); formData.append('quantity', quantity);
@ -405,10 +387,6 @@
formData.append('assetImage', assetImageInput); formData.append('assetImage', assetImageInput);
i = i - 1; i = i - 1;
}); });
if (!isValid) {
//alert("Please fix the errors before submitting the form.");
return false;
}
$.ajax({ $.ajax({
url: '/communityhall/careTaker/api/processEbDetailsAndDamage', url: '/communityhall/careTaker/api/processEbDetailsAndDamage',
type: 'POST', type: 'POST',
@ -442,6 +420,7 @@
return false; return false;
} }
let isCompressing = false; let isCompressing = false;
// Attach the validation function to file input change event // Attach the validation function to file input change event
$(document).on('change', '.damage-image', function () { $(document).on('change', '.damage-image', function () {

1
src/main/resources/templates/caretaker/past-booking.html

@ -101,6 +101,7 @@
<td th:text="${booking.hallDetails.hallName}"></td> <td th:text="${booking.hallDetails.hallName}"></td>
<td th:text="${booking.bookingId}"></td> <td th:text="${booking.bookingId}"></td>
<td th:text="${booking.reason}"></td> <td th:text="${booking.reason}"></td>
<td th:text="${booking.startDate}"></td> <td th:text="${booking.startDate}"></td>
<td th:text="${booking.endDate}"></td> <td th:text="${booking.endDate}"></td>
<td th:text="${booking.noOfDays}"></td> <td th:text="${booking.noOfDays}"></td>

8
src/main/resources/templates/caretaker/present-booking.html

@ -2,6 +2,8 @@
<html xmlns:th="http://www.thymeleaf.org"> <html xmlns:th="http://www.thymeleaf.org">
<head th:replace="~{fragments/head-admin :: head}"></head> <head th:replace="~{fragments/head-admin :: head}"></head>
</head>
<style> <style>
.header-class { .header-class {
position: fixed; position: fixed;
@ -275,12 +277,11 @@
</div> </div>
<footer th:replace="~{fragments/footer2 :: footer}"></footer> <footer th:replace="~{fragments/footer2 :: footer}"></footer>
</div> </div>
<div th:replace="~{fragments/resetpassword :: div}"></div> <div th:replace="~{fragments/resetpassword :: div}"></div>
<script th:replace="~{fragments/script :: script}"></script> <script th:replace="~{fragments/script :: script}"></script>
<script th:replace="~{fragments/loginscript :: script}"></script> <script th:replace="~{fragments/loginscript :: script}"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script>
<script type="text/javascript"> <script type="text/javascript">
$(document).ready( $(document).ready(
function () { function () {
@ -507,7 +508,6 @@
} }
$(document).ready(function () { $(document).ready(function () {
$("#submitEbDetails").click(function () { $("#submitEbDetails").click(function () {
var bookid = parseInt($("#bookingId").val()); var bookid = parseInt($("#bookingId").val());
var startingReading = $("#startingReading").val(); var startingReading = $("#startingReading").val();
@ -545,7 +545,6 @@
}); });
}); });
}); });
document.getElementById('EBdetailsModal').addEventListener('hide.bs.modal', function () { document.getElementById('EBdetailsModal').addEventListener('hide.bs.modal', function () {
// Clear the startingReading input field // Clear the startingReading input field
document.getElementById('startingReading').value = ''; document.getElementById('startingReading').value = '';
@ -553,7 +552,6 @@ document.getElementById('EBdetailsModal').addEventListener('hide.bs.modal', func
// Clear the startingReadingimage file input field // Clear the startingReadingimage file input field
document.getElementById('startingReadingimage').value = ''; document.getElementById('startingReadingimage').value = '';
}); });
</script> </script>
</body> </body>

14
src/main/resources/templates/fragments/PaymentScript.html

@ -120,19 +120,7 @@
data: {'userId': userIdd, 'bookingId': bookingIdd}, data: {'userId': userIdd, 'bookingId': bookingIdd},
success: function (response) { success: function (response) {
console.log(response); console.log(response);
if (response.status === 'slotOccupied') {
Swal.fire({
icon: 'error',
title: 'Slot Occupied',
text: 'The selected slot is already occupied. Please choose a different slot.',
allowOutsideClick:false,
allowEscapeKey:false,
allowEnterKey:false,
confirmButtonText: 'OK'
}).then(function () {
location.reload(); // Example: reload the page
});
} else if (response.error) {
if (response.error) {
alert("please Contact Admin..") alert("please Contact Admin..")
} else { } else {

26
src/main/resources/templates/fragments/adminMenu.html

@ -46,7 +46,7 @@
<span class="nav-main-link-name">Recent Events</span> <span class="nav-main-link-name">Recent Events</span>
</a> </a>
</li> </li>
<li class="nav-main-item">
<li class="nav-main-item">
<a class="nav-main-link" href="/communityhall/admin/viewUploadNoc"> <a class="nav-main-link" href="/communityhall/admin/viewUploadNoc">
<i class="nav-main-link-icon fa fa-location-arrow"></i> <i class="nav-main-link-icon fa fa-location-arrow"></i>
<span class="nav-main-link-name">Waiting For NOC </span> <span class="nav-main-link-name">Waiting For NOC </span>
@ -82,18 +82,18 @@
<span class="nav-main-link-name">Discount Range</span> <span class="nav-main-link-name">Discount Range</span>
</a> </a>
</li> </li>
<!-- <li class="nav-main-item">
<a class="nav-main-link" href="/communityhall/admin/settlement-approved">
<i class="nav-main-link-icon fa fa-location-arrow"></i>
<span class="nav-main-link-name">Settlement Approved List</span>
</a>
</li>
<li class="nav-main-item">
<a class="nav-main-link" href="/communityhall/admin/settlement-initiatedlist">
<i class="nav-main-link-icon fa fa-location-arrow"></i>
<span class="nav-main-link-name">Settlement Initiated List</span>
</a>
</li>-->
<!-- <li class="nav-main-item">
<a class="nav-main-link" href="/communityhall/admin/settlement-approved">
<i class="nav-main-link-icon fa fa-location-arrow"></i>
<span class="nav-main-link-name">Settlement Approved List</span>
</a>
</li>
<li class="nav-main-item">
<a class="nav-main-link" href="/communityhall/admin/settlement-initiatedlist">
<i class="nav-main-link-icon fa fa-location-arrow"></i>
<span class="nav-main-link-name">Settlement Initiated List</span>
</a>
</li>-->
<li class="nav-main-item"> <li class="nav-main-item">
<a class="nav-main-link" href="/communityhall/admin/settlement-list"> <a class="nav-main-link" href="/communityhall/admin/settlement-list">
<i class="nav-main-link-icon fa fa-location-arrow"></i> <i class="nav-main-link-icon fa fa-location-arrow"></i>

44
src/main/resources/templates/fragments/header-caretaker.html

@ -34,28 +34,28 @@
<span class="d-none d-sm-inline ms-1" th:text="${caretakerName}"></span> <span class="d-none d-sm-inline ms-1" th:text="${caretakerName}"></span>
</button> </button>
</div>--> </div>-->
<div class="dropdown d-inline-block"> <div class="dropdown d-inline-block">
<button type="button" class="btn btn-alt-secondary dropdown-toggle" id="page-header-user-dropdown" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="far fa-fw fa-user me-1"></i>
<span class="d-none d-sm-inline ms-1" th:text="${caretakerName}"></span>
</button>
<div class="dropdown-menu dropdown-menu-end p-0" aria-labelledby="page-header-user-dropdown">
<div class="bg-primary-dark rounded-top fw-semibold text-white text-center p-3">
User Options
</div>
<div class="p-2">
<a class="dropdown-item" href="javascript:resetPassword();">
<i class="far fa-fw fa-user me-1"></i> Reset Password
</a>
<button type="button" class="btn btn-alt-secondary dropdown-toggle" id="page-header-user-dropdown" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="far fa-fw fa-user me-1"></i>
<span class="d-none d-sm-inline ms-1" th:text="${caretakerName}"></span>
</button>
<div class="dropdown-menu dropdown-menu-end p-0" aria-labelledby="page-header-user-dropdown">
<div class="bg-primary-dark rounded-top fw-semibold text-white text-center p-3">
User Options
</div>
<div class="p-2">
<a class="dropdown-item" href="javascript:resetPassword();">
<i class="far fa-fw fa-user me-1"></i> Reset Password
</a>
<div role="separator" class="dropdown-divider"></div>
<a class="dropdown-item" href="/communityhall/caretaker/logout">
<i class="far fa-fw fa-arrow-alt-circle-left me-1"></i> Sign Out
</a>
</div>
</div>
</div>
<div role="separator" class="dropdown-divider"></div>
<a class="dropdown-item" href="/communityhall/caretaker/logout">
<i class="far fa-fw fa-arrow-alt-circle-left me-1"></i> Sign Out
</a>
</div>
</div>
</div>
<!-- END User Dropdown --> <!-- END User Dropdown -->
@ -68,11 +68,11 @@
<div class="input-group"> <div class="input-group">
<!-- Layout API, functionality initialized in Template._uiApiLayout() --> <!-- Layout API, functionality initialized in Template._uiApiLayout() -->
<button type="button" class="btn btn-alt-primary" data-toggle="layout" <button type="button" class="btn btn-alt-primary" data-toggle="layout"
data-action="header_search_off">
data-action="header_search_off">
<i class="fa fa-fw fa-times-circle"></i> <i class="fa fa-fw fa-times-circle"></i>
</button> </button>
<input type="text" class="form-control border-0" placeholder="Search or hit ESC.." <input type="text" class="form-control border-0" placeholder="Search or hit ESC.."
id="page-header-search-input" name="page-header-search-input">
id="page-header-search-input" name="page-header-search-input">
</div> </div>
</form> </form>
</div> </div>

6
src/main/resources/templates/fragments/headquartersMenu.html

@ -96,6 +96,12 @@
<span class="nav-main-link-name">Refund Failed List</span> <span class="nav-main-link-name">Refund Failed List</span>
</a> </a>
</li> </li>
<li class="nav-main-item">
<a class="nav-main-link" href="/communityhall/headquarters/Gccblocking">
<i class="nav-main-link-icon fa fa-location-arrow"></i>
<span class="nav-main-link-name">Gcc Blocking</span>
</a>
</li>
<li class="nav-main-item"> <li class="nav-main-item">
<a class="nav-main-link" href="/communityhall/headquarters/Reports"> <a class="nav-main-link" href="/communityhall/headquarters/Reports">
<i class="nav-main-link-icon fa fa-location-arrow"></i> <i class="nav-main-link-icon fa fa-location-arrow"></i>

60
src/main/resources/templates/fragments/logRegiOtpScript.html

@ -17,32 +17,29 @@
document.getElementById("pds1").style.display = 'none'; document.getElementById("pds1").style.display = 'none';
document.getElementById("pds").style.display = 'block'; document.getElementById("pds").style.display = 'block';
} }
function checkLoginedIn(url, hallId) {
console.log('Hall ID being passed:', hallId); // Should print the actual hall ID value
if (isLogin == false) {
showloginpopup();
} else {
if (hallId != undefined && hallId != '' && hallId !=0) {
console.log('Navigating to hallbookingform with hallId:', hallId);
window.location.href = '/communityhall/hallbookingform?hallId=' + hallId;
function checkLoginedIn(url, hallId) { // Should print the actual hall ID value
if (isLogin == false) {
showloginpopup();
} else { } else {
if (url == 'hallbookingform') {
CheckBookingLimitation(function (success) {
if (success) {
if (url == 'hallbookingform' || url == 'book') {
CheckBookingLimitation(function (success) {
if (success) {
if (hallId != undefined && hallId != '' && hallId !=0) {
console.log('Navigating to hallbookingform with hallId:', hallId);
window.location.href = '/communityhall/hallbookingform?hallId=' + hallId;
} else{
window.location.href = '/communityhall/user/' + url;
}
}
});
} else {
if (url == 'viewhistory') {
window.location.href = '/communityhall/user/' + url; window.location.href = '/communityhall/user/' + url;
} }
});
} else {
if (url == 'viewhistory') {
window.location.href = '/communityhall/user/' + url;
} }
}
} }
return false;
} }
return false;
}
// Function to show login popup and reset mobile number field // Function to show login popup and reset mobile number field
function showloginpopup() { function showloginpopup() {
$('#loginModal').modal('show'); // Show the login modal $('#loginModal').modal('show'); // Show the login modal
@ -626,12 +623,13 @@ function checkLoginedIn(url, hallId) {
function validateNumber() { function validateNumber() {
var mobileNo = $("#mobileno").val(); var mobileNo = $("#mobileno").val();
//alert("validate number.."+mobileNo);
$.ajax({ $.ajax({
type: "GET", type: "GET",
url: '/communityhall/user/api/checkMobileExits', url: '/communityhall/user/api/checkMobileExits',
data: {'mobileno': mobileNo}, data: {'mobileno': mobileNo},
success: function (bodyMessage) { success: function (bodyMessage) {
if (bodyMessage == "success") {
if (bodyMessage == "success" ) {
var alertMessage = "This Mobile Number Is Already Registered!</a>"; var alertMessage = "This Mobile Number Is Already Registered!</a>";
$('#otpForm').modal('hide'); // Hide OTP form modal $('#otpForm').modal('hide'); // Hide OTP form modal
//$('#loginModal').modal('hide'); //$('#loginModal').modal('hide');
@ -663,16 +661,16 @@ function checkLoginedIn(url, hallId) {
var mobileNo = $("#mobileNumber"); var mobileNo = $("#mobileNumber");
// Check if the mobile number is provided // Check if the mobile number is provided
if (!mobileNo.val()) {
// Set custom validity message
mobileNo[0].setCustomValidity("Mobile Number is Mandatory.");
// Report validity to trigger the validation UI
mobileNo[0].reportValidity();
return; // Exit the function to prevent the AJAX call
} else {
// Clear the custom validity message
mobileNo[0].setCustomValidity("");
}
if (mobileNo.val().length !== 10) {
// Set custom validity message for incorrect mobile number length
mobileNo[0].setCustomValidity("Please enter a 10-digit mobile number.");
// Report validity to trigger the validation UI
mobileNo[0].reportValidity();
return; // Exit the function to prevent the AJAX call
} else {
// Clear the custom validity message
mobileNo[0].setCustomValidity("");
}
$.ajax({ $.ajax({
type: "GET", type: "GET",

2
src/main/resources/templates/fragments/loginscript.html

@ -75,7 +75,7 @@
success: function(bodyMessage) { success: function(bodyMessage) {
if (bodyMessage.trim() === "Success") { if (bodyMessage.trim() === "Success") {
Swal.fire( Swal.fire(
'PIN Updation!',
'PIN Registration!',
'Your New PIN Successfully Saved!<br>Now login with your new PIN.', 'Your New PIN Successfully Saved!<br>Now login with your new PIN.',
'success' 'success'
).then(() => { ).then(() => {

4
src/main/resources/templates/fragments/resetpassword.html

@ -18,11 +18,11 @@
</div> </div>
<div class="mb-4"> <div class="mb-4">
<label class="form-label">Old PIN<span class="text-danger">*</span></label> <label class="form-label">Old PIN<span class="text-danger">*</span></label>
<input type="password" minlength="4" maxlength="4" class="form-control text-center" name="oldpin" id="oldpin" placeholder="Numbers Only" required />
<input type="password" maxlength="4" class="form-control text-center" name="oldpin" id="oldpin" placeholder="Numbers Only" required />
</div> </div>
<div class="mb-4"> <div class="mb-4">
<label class="form-label">New 4 Digit PIN <span class="text-danger">*</span></label> <label class="form-label">New 4 Digit PIN <span class="text-danger">*</span></label>
<input type="password" minlength="4" maxlength="4" class="form-control text-center" name="newpin" id="newpin" placeholder="Numbers Only" required />
<input type="password" maxlength="4" class="form-control text-center" name="newpin" id="newpin" placeholder="Numbers Only" required />
</div> </div>
</div> </div>
<div class="block-content block-content-full text-end bg-body" id="mbutton"> <div class="block-content block-content-full text-end bg-body" id="mbutton">

822
src/main/resources/templates/headquarters/bookingwaiting.html

@ -25,30 +25,30 @@
} }
</style> </style>
<body> <body>
<!-- Page Container -->
<div id="page-container"
class="sidebar-o sidebar-dark enable-page-overlay side-scroll page-header-fixed page-header-dark">
<!-- Sidebar Nav-->
<aside th:replace="~{fragments/aside-right :: aside}"></aside>
<!-- END Side Overlay (right)-->
<!-- Sidebar Nav-->
<nav th:replace="~{fragments/nav-headquarters :: nav}"></nav>
<!-- END Sidebar -->
<!-- Header -->
<header th:replace="~{fragments/header-headquarters :: header}"></header>
<!-- END Header -->
<!-- Main Container -->
<main id="main-container">
<div class="content">
<div class="block block-rounded">
<div class="block-header block-header-default" >
<h3 class="block-title">List of Bookings Waiting for NOC Approval</h3>
</div>
<div class="block-content p-0">
<div class="p-sm-4 p-0">
<div class="table-responsive">
<table class="table table-bordered table-striped table-vcenter js-dataTable-responsive" id="bookingapprovedtable">
<thead class="thead-light">
<!-- Page Container -->
<div id="page-container"
class="sidebar-o sidebar-dark enable-page-overlay side-scroll page-header-fixed page-header-dark">
<!-- Sidebar Nav-->
<aside th:replace="~{fragments/aside-right :: aside}"></aside>
<!-- END Side Overlay (right)-->
<!-- Sidebar Nav-->
<nav th:replace="~{fragments/nav-headquarters :: nav}"></nav>
<!-- END Sidebar -->
<!-- Header -->
<header th:replace="~{fragments/header-headquarters :: header}"></header>
<!-- END Header -->
<!-- Main Container -->
<main id="main-container">
<div class="content">
<div class="block block-rounded">
<div class="block-header block-header-default" >
<h3 class="block-title">List of Bookings Waiting for NOC Approval</h3>
</div>
<div class="block-content p-0">
<div class="p-sm-4 p-0">
<div class="table-responsive">
<table class="table table-bordered table-striped table-vcenter js-dataTable-responsive" id="bookingapprovedtable">
<thead class="thead-light">
<tr> <tr>
<th class="text-center no-sort">S.No</th> <th class="text-center no-sort">S.No</th>
<th class="text-center">Zone</th> <th class="text-center">Zone</th>
@ -62,8 +62,8 @@
<th class="text-center">Caretaker Name/MobileNumber</th> <th class="text-center">Caretaker Name/MobileNumber</th>
<th class="text-center">Action</th> <th class="text-center">Action</th>
</tr> </tr>
</thead>
<tbody>
</thead>
<tbody>
<tr th:each="booking, rowStat : ${waitingBookings}"> <tr th:each="booking, rowStat : ${waitingBookings}">
<td class="text-center" th:text="${rowStat.index + 1}"></td> <td class="text-center" th:text="${rowStat.index + 1}"></td>
<td class="text-center" th:text="${booking.hallDetails.zone}"></td> <td class="text-center" th:text="${booking.hallDetails.zone}"></td>
@ -77,224 +77,222 @@
<td class="text-center" <td class="text-center"
th:text="${booking.hallDetails.hallInchargeName} + ' / ' + ${booking.hallDetails.hallInchargeMobno}"> th:text="${booking.hallDetails.hallInchargeName} + ' / ' + ${booking.hallDetails.hallInchargeMobno}">
</td> </td>
<td> <td>
<p> <p>
<span class="badge bg-warning" style="cursor: pointer;" <span class="badge bg-warning" style="cursor: pointer;"
th:onclick="pendingbooking([[${booking.bookingId}]])">Approve</span>
th:onclick="pendingbooking([[${booking.bookingId}]])">Approve</span>
</p> </p>
</td> </td>
</tr> </tr>
</tbody>
</table>
</div>
</tbody>
</table>
</div> </div>
</div> </div>
</div> </div>
</div>
</main>
<!-- END Main Container -->
<!--modal for pening-->
<div class="modal fade backdrop" id="pendingBookingForm" data-backdrop="static" tabindex="-1" role="dialog"
aria-labelledby="staticBackdropLabel" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<form id="ownform">
<div class="block block-rounded block-themed block-transparent mb-0">
<div class="block-header bg-primary-dark">
<h3 class="block-title" id="2mtitle">Booking Information</h3>
<div class="block-options">
<button type="button" class="btn-block-option" data-bs-dismiss="modal"
</div>
</div>
</main>
<!-- END Main Container -->
<!--modal for pening-->
<div class="modal fade backdrop" id="pendingBookingForm" data-backdrop="static" tabindex="-1" role="dialog"
aria-labelledby="staticBackdropLabel" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<form id="ownform">
<div class="block block-rounded block-themed block-transparent mb-0">
<div class="block-header bg-primary-dark">
<h3 class="block-title" id="2mtitle">Booking Information</h3>
<div class="block-options">
<button type="button" class="btn-block-option" data-bs-dismiss="modal"
aria-label="Close"> aria-label="Close">
<i class="fa fa-fw fa-times"></i>
</button>
</div>
</div>
<div class="block-content row">
<div class="col-md-12 col-lg-12 col-sm-12 mb-2">
<input type="hidden" class="form-control text-center" name="bookingid"
id="bookingid" disabled />
<div class="card-body">
<table>
<tr>
<th colspan="10" style="background-color: #f2f2f2;">User Details</th>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal;">User Name:
</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_userName"></td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal;">Mobile Number:
</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_mobileNumber"></td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal;">User Type:
</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_usertype"></td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal;">User Address:
</th>
<td colspan="5" class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_useraddress"></td>
</tr>
</table>
<i class="fa fa-fw fa-times"></i>
</button>
</div> </div>
</div> </div>
<div class="block-content row">
<div class="col-md-12 col-lg-12 col-sm-12 mb-2">
<input type="hidden" class="form-control text-center" name="bookingid"
id="bookingid" disabled />
<div class="card-body">
<table>
<tr>
<th colspan="10" style="background-color: #f2f2f2;">User Details</th>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal;">User Name:
</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_userName"></td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal;">Mobile Number:
</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_mobileNumber"></td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal;">User Type:
</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_usertype"></td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal;">User Address:
</th>
<td colspan="5" class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_useraddress"></td>
</tr>
</table>
</div>
</div>
<div class="col-md-12 col-lg-12 col-sm-12 mb-2">
<input type="hidden" class="form-control text-center" name="bookingid"
id="bookingid" disabled />
<div class="card-body">
<table>
<tr>
<th colspan="10" style="background-color: #f2f2f2;">Hall Details</th>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal;">Hall Name:
</th>
<div class="col-md-12 col-lg-12 col-sm-12 mb-2">
<input type="hidden" class="form-control text-center" name="bookingid"
id="bookingid" disabled />
<div class="card-body">
<table>
<tr>
<th colspan="10" style="background-color: #f2f2f2;">Hall Details</th>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal;">Hall Name:
</th>
<td colspan="10" class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_hallName"></td>
</tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal;">Hall Address:</th>
<td colspan="10" class="fw-semibold" style="padding: 0.45rem 0.45rem;" <td colspan="10" class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_hallName"></td>
</tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal;">Hall Address:</th>
<td colspan="10" class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_halladdress"></td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal;">Caretaker
Name:</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_caretakername"></td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal;">Caretaker
Mobile Number:</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_caretakermobileNumber"></td>
</tr>
</table>
id="td_halladdress"></td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal;">Caretaker
Name:</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_caretakername"></td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal;">Caretaker
Mobile Number:</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_caretakermobileNumber"></td>
</tr>
</table>
</div>
</div> </div>
</div>
<div class="col-md-12 col-lg-12 col-sm-12">
<input type="hidden" class="form-control text-center" name="settlementid"
id="settlementid" disabled />
<div class="card-body">
<table>
<tr>
<th colspan="4" style="background-color: #f2f2f2;">Booking
Details (Booking Id:-<span id="booking_id"
style="color:blue"></span>)</th>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Booking Date:
</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_bookingDate"></td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Booking Status:
</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_bookingStatus"></td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Start Date:
</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_startDate"></td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Deposit
Amount:</th>
<td class="fw-semibold amount-cell" style="padding: 0.45rem 0.45rem;"
id="td_depositeAmount"></td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">END
Date:</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_endDate"></td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Hall Amount:
</th>
<td class="fw-semibold amount-cell" style="padding: 0.45rem 0.45rem;"
id="td_hallAmount"></td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Starting Slot:
</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_startingSlot"></td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">GST @18%:</th>
<td class="fw-semibold amount-cell" style="padding: 0.45rem 0.45rem;"
id="td_gst"></td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Ending Slot:
</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_endingSlot"></td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Total Amount:
</th>
<td class="fw-semibold amount-cell" style="padding: 0.45rem 0.45rem;"
id="td_totalAmount"></td>
</tr>
</table>
<div class="col-md-12 col-lg-12 col-sm-12">
<input type="hidden" class="form-control text-center" name="settlementid"
id="settlementid" disabled />
<div class="card-body">
<table>
<tr>
<th colspan="4" style="background-color: #f2f2f2;">Booking
Details (Booking Id:-<span id="booking_id"
style="color:blue"></span>)</th>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Booking Date:
</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_bookingDate"></td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Booking Status:
</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_bookingStatus"></td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Start Date:
</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_startDate"></td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Deposit
Amount:</th>
<td class="fw-semibold amount-cell" style="padding: 0.45rem 0.45rem;"
id="td_depositeAmount"></td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">END
Date:</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_endDate"></td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Hall Amount:
</th>
<td class="fw-semibold amount-cell" style="padding: 0.45rem 0.45rem;"
id="td_hallAmount"></td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Starting Slot:
</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_startingSlot"></td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">GST @18%:</th>
<td class="fw-semibold amount-cell" style="padding: 0.45rem 0.45rem;"
id="td_gst"></td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Ending Slot:
</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_endingSlot"></td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Total Amount:
</th>
<td class="fw-semibold amount-cell" style="padding: 0.45rem 0.45rem;"
id="td_totalAmount"></td>
</tr>
</table>
</div>
</div> </div>
</div>
<div class="col-sm-12">
<!--<label class="form-label">Documents:<span class="text-danger"></span></label>-->
<div class="documents" id="documents"></div>
</div>
<div class="col-sm-12">
<!--<label class="form-label">Documents:<span class="text-danger"></span></label>-->
<div class="documents" id="documents"></div>
</div>
<div class="col-md-12 col-lg-12 col-sm-12 mb-2">
<input type="hidden" class="form-control text-center" name="bookingid"
id="bookingid" disabled />
<div class="card-body">
<table>
<tr>
<th colspan="10" style="background-color: #f2f2f2;">Booking Payment
Details</th>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal;">Transaction
ID:</th>
<div class="col-md-12 col-lg-12 col-sm-12 mb-2">
<input type="hidden" class="form-control text-center" name="bookingid"
id="bookingid" disabled />
<div class="card-body">
<table>
<tr>
<th colspan="10" style="background-color: #f2f2f2;">Booking Payment
Details</th>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal;">Transaction
ID:</th>
<td colspan="10" class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_transactionId"></td>
</tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal;">Amount Received:
</th>
<td colspan="10" class="fw-semibold" style="padding: 0.45rem 0.45rem;" <td colspan="10" class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_transactionId"></td>
</tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal;">Amount Received:
</th>
<td colspan="10" class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_payamountReceived"></td>
id="td_payamountReceived"></td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal;">Transaction
Status:</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_paymentStatus"></td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal;">Transaction
Status:</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_paymentStatus"></td>
</tr>
</tr>
</table>
</table>
</div>
</div> </div>
</div>
<div class="row" id="reasondetails">
<div class="row" id="reasondetails">
<div class="col-md-6 mb-2"> <div class="col-md-6 mb-2">
<label class="form-label">Reason type :<span class="text-danger">*</span></label> <label class="form-label">Reason type :<span class="text-danger">*</span></label>
<select class="form-control" id="reasontype"> <select class="form-control" id="reasontype">
<option value="0" >Select Reason type</option>
<option value="1">Illegal</option>
<option value="2">Others</option>
<option value="0" >Select Reason type</option>
<option value="1">Illegal</option>
<option value="2">Others</option>
</select> </select>
</div> </div>
<div class="col-md-6 mb-2"> <div class="col-md-6 mb-2">
@ -303,46 +301,42 @@
<div id="reasonValidationText" class="text-danger small mt-1" style="display:none"> <div id="reasonValidationText" class="text-danger small mt-1" style="display:none">
Reason is required.</div> Reason is required.</div>
</div> </div>
</div>
</div> </div>
</div> </div>
</div>
<div class="block-content block-content-full text-end bg-body" id="mbutton2">
<button type="button" class="btn btn-sm btn-alt-secondary"
<div class="block-content block-content-full text-end bg-body" id="mbutton2">
<button type="button" class="btn btn-sm btn-alt-secondary"
data-bs-dismiss="modal">Close</button> data-bs-dismiss="modal">Close</button>
<button type="button" class="btn btn-sm btn-primary" id="accepttbutton"
th:onclick="accept()">Approve</button>
<button type="button" class="btn btn-sm btn-primary" id="rejectbutton"
th:onclick="rejectsubmit()">Reject</button>
</div>
</form>
<button type="button" class="btn btn-sm btn-primary" id="accepttbutton"
th:onclick="accept()">Approve</button>
<button type="button" class="btn btn-sm btn-primary" id="rejectbutton"
th:onclick="rejectsubmit()">Reject</button>
</div>
</form>
</div>
</div> </div>
</div> </div>
</div>
<!-- End Modal User -->
<!-- Footer -->
<div class="modal fade" id="fileModal" tabindex="-1" role="dialog" aria-labelledby="fileModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="fileModalLabel">File Preview</h5>
<button type="button" class="close" data-bs-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<embed id="filePreview" src="" width="100%" height="600px">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
<!-- End Modal User -->
<!-- Footer -->
<div class="modal fade" id="fileModal" tabindex="-1" role="dialog" aria-labelledby="fileModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="fileModalLabel">File Preview</h5>
<button type="button" class="close" data-bs-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<embed id="filePreview" src="" width="100%" height="600px">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
</div>
</div> </div>
</div> </div>
</div> </div>
</div>
<div th:replace="~{fragments/resetpassword :: div}"></div> <div th:replace="~{fragments/resetpassword :: div}"></div>
<footer th:replace="~{fragments/footer2 :: footer}"></footer> <footer th:replace="~{fragments/footer2 :: footer}"></footer>
<script th:replace="~{fragments/loginscript :: script}"></script> <script th:replace="~{fragments/loginscript :: script}"></script>
@ -370,36 +364,36 @@
}); });
$('#pendingBookingForm').modal('show'); $('#pendingBookingForm').modal('show');
var todaydate = new Date().toISOString().split('T')[0]; var todaydate = new Date().toISOString().split('T')[0];
// Convert startDate to YYYY-MM-DD format if needed
var startDate = new Date(list.startDate).toISOString().split('T')[0]; // Ensure this is in the correct format
if (startDate > todaydate) {
$('#reasondetails').show();
$('#rejectbutton').show();
} else {
$('#reasondetails').hide();
$('#rejectbutton').hide();
}
// Convert startDate to YYYY-MM-DD format if needed
var startDate = new Date(list.startDate).toISOString().split('T')[0]; // Ensure this is in the correct format
if (startDate > todaydate) {
$('#reasondetails').show();
$('#rejectbutton').show();
} else {
$('#reasondetails').hide();
$('#rejectbutton').hide();
}
document.getElementById("td_userName").innerHTML = list.users.name; document.getElementById("td_userName").innerHTML = list.users.name;
document.getElementById("td_mobileNumber").innerHTML = list.users.mobileNo; document.getElementById("td_mobileNumber").innerHTML = list.users.mobileNo;
document.getElementById("td_usertype").innerHTML = list.users.usertype; document.getElementById("td_usertype").innerHTML = list.users.usertype;
document.getElementById("bookingid").value = list.bookingId; document.getElementById("bookingid").value = list.bookingId;
var userDetails = list.users; var userDetails = list.users;
var userDetailsString = var userDetailsString =
userDetails.doorNo + ", " +
userDetails.street + ", " +
userDetails.area + ", " +
userDetails.location + "- " +
userDetails.pinCode;
userDetails.doorNo + ", " +
userDetails.street + ", " +
userDetails.area + ", " +
userDetails.location + "- " +
userDetails.pinCode;
document.getElementById("td_useraddress").innerHTML = userDetailsString; document.getElementById("td_useraddress").innerHTML = userDetailsString;
document.getElementById("td_hallName").innerHTML = list.hallDetails.hallName; document.getElementById("td_hallName").innerHTML = list.hallDetails.hallName;
var hallDetails = list.hallDetails; var hallDetails = list.hallDetails;
var hallDetailsString = var hallDetailsString =
hallDetails.doorNo + ", " +
hallDetails.street + ", " +
hallDetails.area + ", " +
hallDetails.city + "- " +
hallDetails.pinCode;
hallDetails.doorNo + ", " +
hallDetails.street + ", " +
hallDetails.area + ", " +
hallDetails.city + "- " +
hallDetails.pinCode;
document.getElementById("td_halladdress").innerHTML = hallDetailsString; document.getElementById("td_halladdress").innerHTML = hallDetailsString;
document.getElementById("td_caretakername").innerHTML = list.hallDetails.hallInchargeName; document.getElementById("td_caretakername").innerHTML = list.hallDetails.hallInchargeName;
document.getElementById("td_caretakermobileNumber").innerHTML = list.hallDetails.hallInchargeMobno; document.getElementById("td_caretakermobileNumber").innerHTML = list.hallDetails.hallInchargeMobno;
@ -432,15 +426,16 @@
document.getElementById("td_bookingStatus").innerHTML = list.bookingStatus; document.getElementById("td_bookingStatus").innerHTML = list.bookingStatus;
// Check if transactionId is not null, otherwise set to "NA" // Check if transactionId is not null, otherwise set to "NA"
document.getElementById("td_transactionId").innerHTML = list.payments && list.payments.transactionId ? list.payments.transactionId : "NA"; document.getElementById("td_transactionId").innerHTML = list.payments && list.payments.transactionId ? list.payments.transactionId : "NA";
// Check if amountReceived is not null, otherwise set to "NA" // Check if amountReceived is not null, otherwise set to "NA"
document.getElementById("td_payamountReceived").innerHTML = list.payments && list.payments.amountReceived ? '₹ ' + list.payments.amountReceived : "NA"; document.getElementById("td_payamountReceived").innerHTML = list.payments && list.payments.amountReceived ? '₹ ' + list.payments.amountReceived : "NA";
// Check if paymentStatus is not null, otherwise set to "NA" // Check if paymentStatus is not null, otherwise set to "NA"
document.getElementById("td_paymentStatus").innerHTML = list.payments && list.payments.paymentStatus ? list.payments.paymentStatus : "NA"; document.getElementById("td_paymentStatus").innerHTML = list.payments && list.payments.paymentStatus ? list.payments.paymentStatus : "NA";
showReasonDocuments(list); showReasonDocuments(list);
} }
function showReasonDocuments(list) { function showReasonDocuments(list) {
console.log("Reason;;;"+list.reason);
$.ajax({ $.ajax({
type: "GET", type: "GET",
url: '/communityhall/api/officer/getReasonByName', url: '/communityhall/api/officer/getReasonByName',
@ -448,7 +443,7 @@
'reasonName': list.reason 'reasonName': list.reason
}, },
success: function (x) { success: function (x) {
//console.log(x);
console.log("getReasonByName:.."+x);
showReasonWithDocument(x, list); showReasonWithDocument(x, list);
} }
}); });
@ -489,24 +484,24 @@
// Iterate through the documents list and populate rows // Iterate through the documents list and populate rows
for (var i = 0; i < bookingDocumentsList.length; i++) { for (var i = 0; i < bookingDocumentsList.length; i++) {
(function (index) {
var row = $('<tr>').appendTo(tbody);
$('<td>').text(index + 1).appendTo(row);
// Determine the text content for the second cell
var name = bookingDocumentsList[index].name ? bookingDocumentsList[index].name : ''; // Empty string if name is null or undefined
var fieldText = reasonDocumentData[index].fieldName;
var fullText = name ? fieldText + ': ' + name : fieldText; // Include colon only if name is not empty
$('<td>').text(fullText).appendTo(row);
// Create a link to view document image
var viewLink = $('<a>').attr('href', 'javascript:void(0)').text(reasonDocumentData[index].docFieldName).on('click', function () {
showDocumentImage(bookingDocumentsList[index].bookingDocUrl);
});
$('<td>').append(viewLink).appendTo(row);
})(i);
}
(function (index) {
var row = $('<tr>').appendTo(tbody);
$('<td>').text(index + 1).appendTo(row);
// Determine the text content for the second cell
var name = bookingDocumentsList[index].name ? bookingDocumentsList[index].name : ''; // Empty string if name is null or undefined
var fieldText = reasonDocumentData[index].fieldName;
var fullText = name ? fieldText + ': ' + name : fieldText; // Include colon only if name is not empty
$('<td>').text(fullText).appendTo(row);
// Create a link to view document image
var viewLink = $('<a>').attr('href', 'javascript:void(0)').text(reasonDocumentData[index].docFieldName).on('click', function () {
showDocumentImage(bookingDocumentsList[index].bookingDocUrl);
});
$('<td>').append(viewLink).appendTo(row);
})(i);
}
// Append table to the responsive container // Append table to the responsive container
tableResponsiveDiv.append(table); tableResponsiveDiv.append(table);
// Append table to the container in the DOM // Append table to the container in the DOM
@ -529,67 +524,67 @@
} }
function accept() { function accept() {
let id = document.getElementById("bookingid").value;
Swal.fire({
title: 'Do you want to Accept this User?',
showDenyButton: true,
showCancelButton: true,
confirmButtonText: 'YES',
denyButtonText: 'NO',
}).then((result) => {
if (result.isConfirmed) {
// Show loading popup
const loadingSwal = Swal.fire({
title: 'Processing...',
text: 'Please wait while we process the acceptance.',
allowOutsideClick: false, // Prevent closing the popup
didOpen: () => {
Swal.showLoading(); // Show the loading spinner
},
showConfirmButton: false, // Hide the confirm button during loading
});
$.ajax({
type: "POST",
url: '/communityhall/api/officer/updateBookingApproved/' + id,
data: {
'status': 'APPROVED',
'comments': 'Accepted',
'bookingId': id
},
success: function (data, textStatus, xhr) {
loadingSwal.close(); // Close the loading popup
if (xhr.status === 200) {
Swal.fire(
'Done',
'Successfully Approved to the ID: ' + id,
'success'
).then(() => {
location.reload(); // Reload page after success
});
} else {
Swal.fire(
'Error',
'Failed to accept the Booking',
'error'
);
}
},
error: function (xhr, textStatus, errorThrown) {
loadingSwal.close(); // Close the loading popup
Swal.fire(
'Error',
'Failed to accept the Booking',
'error'
);
}
});
} else if (result.isDenied) {
Swal.fire('Changes are not saved', '', 'info');
}
});
}
let id = document.getElementById("bookingid").value;
Swal.fire({
title: 'Do you want to Accept this User?',
showDenyButton: true,
showCancelButton: true,
confirmButtonText: 'YES',
denyButtonText: 'NO',
}).then((result) => {
if (result.isConfirmed) {
// Show loading popup
const loadingSwal = Swal.fire({
title: 'Processing...',
text: 'Please wait while we process the acceptance.',
allowOutsideClick: false, // Prevent closing the popup
didOpen: () => {
Swal.showLoading(); // Show the loading spinner
},
showConfirmButton: false, // Hide the confirm button during loading
});
$.ajax({
type: "POST",
url: '/communityhall/api/officer/updateBookingApproved/' + id,
data: {
'status': 'APPROVED',
'comments': 'Accepted',
'bookingId': id
},
success: function (data, textStatus, xhr) {
loadingSwal.close(); // Close the loading popup
if (xhr.status === 200) {
Swal.fire(
'Done',
'Successfully Approved to the ID: ' + id,
'success'
).then(() => {
location.reload(); // Reload page after success
});
} else {
Swal.fire(
'Error',
'Failed to accept the Booking',
'error'
);
}
},
error: function (xhr, textStatus, errorThrown) {
loadingSwal.close(); // Close the loading popup
Swal.fire(
'Error',
'Failed to accept the Booking',
'error'
);
}
});
} else if (result.isDenied) {
Swal.fire('Changes are not saved', '', 'info');
}
});
}
function rejectsubmit() { function rejectsubmit() {
let id = document.getElementById("bookingid").value; let id = document.getElementById("bookingid").value;
@ -624,26 +619,26 @@
//console.log("Rejection successful"); //console.log("Rejection successful");
if (xhr.status === 200) { // Check if the response status is OK if (xhr.status === 200) { // Check if the response status is OK
Swal.fire( Swal.fire(
'Done',
'Successfully Rejected to the ID:' + id,
'success'
'Done',
'Successfully Rejected to the ID:' + id,
'success'
).then(() => { ).then(() => {
location.reload(); location.reload();
}); });
} else { } else {
Swal.fire( Swal.fire(
'Error',
'Failed to reject the user',
'error'
'Error',
'Failed to reject the user',
'error'
); );
} }
}, },
error: function (xhr, textStatus, errorThrown) { error: function (xhr, textStatus, errorThrown) {
console.error("Error:", errorThrown); console.error("Error:", errorThrown);
Swal.fire( Swal.fire(
'Error',
'Failed to reject the user',
'error'
'Error',
'Failed to reject the user',
'error'
); );
} }
}); });
@ -655,61 +650,60 @@
} }
$(document).ready( $(document).ready(
function () {
var buttons = [{
extend: 'pageLength',
className: 'btn btn-primary'
}, {
title: 'Data export',
extend: 'copyHtml5',
text: 'Copy',
className: 'btn btn-primary',
id: 'copyBtn'
}, {
extend: 'excelHtml5',
text: 'Excel',
className: 'btn btn-primary',
id: 'excelBtn'
}, {
extend: 'csvHtml5',
text: 'CSV',
className: 'btn btn-primary',
id: 'csvBtn'
}, {
extend: 'pdfHtml5',
text: 'PDF',
className: 'btn btn-primary',
id: 'pdfBtn'
},
];
$('#bookingapprovedtable').DataTable(
{
dom: 'Bftip',
columnDefs: [{
targets: 'no-sort',
orderable: false
}],
lengthMenu: [
[50, 100, 200, 500, -1],
['50 rows', '100 rows', '200 rows',
'500 rows', 'Show all']],
scrollY: '50vh',
fixedColumns: {
left: 1,
right: 1
},
buttons: [buttons],
responsive: true,
searching: true, // Enable search
select: false,
processing: false,
});
// Link the search input to DataTable
$('#searchInput').on('keyup', function () {
dataTable.search(this.value).draw();
function () {
var buttons = [{
extend: 'pageLength',
className: 'btn btn-primary'
}, {
title: 'Data export',
extend: 'copyHtml5',
text: 'Copy',
className: 'btn btn-primary',
id: 'copyBtn'
}, {
extend: 'excelHtml5',
text: 'Excel',
className: 'btn btn-primary',
id: 'excelBtn'
}, {
extend: 'csvHtml5',
text: 'CSV',
className: 'btn btn-primary',
id: 'csvBtn'
}, {
extend: 'pdfHtml5',
text: 'PDF',
className: 'btn btn-primary',
id: 'pdfBtn'
},
];
$('#bookingapprovedtable').DataTable(
{
dom: 'Bftip',
columnDefs: [{
targets: 'no-sort',
orderable: false
}],
lengthMenu: [
[50, 100, 200, 500, -1],
['50 rows', '100 rows', '200 rows',
'500 rows', 'Show all']],
scrollY: '50vh',
fixedColumns: {
left: 1,
right: 1
},
buttons: [buttons],
responsive: true,
searching: true, // Enable search
select: false,
processing: false,
}); });
// Link the search input to DataTable
$('#searchInput').on('keyup', function () {
dataTable.search(this.value).draw();
}); });
});
</script> </script>
</body> </body>
</html> </html>

1387
src/main/resources/templates/headquarters/gccblocking.html
File diff suppressed because it is too large
View File

2
src/main/resources/templates/headquarters/headquarterspage.html

@ -130,7 +130,7 @@
</div> </div>
<button type="button" class="btn btn-success mb-3" onclick="addMaterialRow()"><i <button type="button" class="btn btn-success mb-3" onclick="addMaterialRow()"><i
class="fas fa-plus"></i>Add class="fas fa-plus"></i>Add
</button>
Material</button>
<!-- Hidden input for total Damage Amount --> <!-- Hidden input for total Damage Amount -->
<input type="hidden" id="hiddenTotalDamageAmount" name="totalDamageAmount"> <input type="hidden" id="hiddenTotalDamageAmount" name="totalDamageAmount">

8
src/main/resources/templates/headquarters/ongoingevents.html

@ -97,7 +97,6 @@
<th>Hall Name</th> <th>Hall Name</th>
<th>Booking Id</th> <th>Booking Id</th>
<th>Reason for Booking</th>
<th>Start Date</th> <th>Start Date</th>
<th>End Date</th> <th>End Date</th>
<th>No of Days</th> <th>No of Days</th>
@ -124,7 +123,6 @@
<td th:text="${booking.hallDetails.hallName}"></td> <td th:text="${booking.hallDetails.hallName}"></td>
<td th:text="${booking.bookingId}"></td> <td th:text="${booking.bookingId}"></td>
<td th:text="${booking.reason}"></td>
<td th:text="${booking.startDate}"></td> <td th:text="${booking.startDate}"></td>
<td th:text="${booking.endDate}"></td> <td th:text="${booking.endDate}"></td>
<td th:text="${booking.noOfDays}"></td> <td th:text="${booking.noOfDays}"></td>
@ -160,7 +158,7 @@
<!-- Repeat similar structure for Cancelled Bookings Approved --> <!-- Repeat similar structure for Cancelled Bookings Approved -->
<div class="block block-rounded"> <div class="block block-rounded">
<div class="block-header block-header-default"> <div class="block-header block-header-default">
<h3 class="block-title">Past Events (2 Days)</h3>
<h3 class="block-title">Past Events</h3>
</div> </div>
<div class="block-content p-0"> <div class="block-content p-0">
<div class="p-sm-4 p-0"> <div class="p-sm-4 p-0">
@ -183,7 +181,6 @@
<th>Hall Name</th> <th>Hall Name</th>
<th>Booking Id</th> <th>Booking Id</th>
<th>Reason for Booking</th>
<th>Start Date</th> <th>Start Date</th>
<th>End Date</th> <th>End Date</th>
<th>No of Days</th> <th>No of Days</th>
@ -210,7 +207,6 @@
<td th:text="${booking.hallDetails.hallName}"></td> <td th:text="${booking.hallDetails.hallName}"></td>
<td th:text="${booking.bookingId}"></td> <td th:text="${booking.bookingId}"></td>
<td th:text="${booking.reason}"></td>
<td th:text="${booking.startDate}"></td> <td th:text="${booking.startDate}"></td>
<td th:text="${booking.endDate}"></td> <td th:text="${booking.endDate}"></td>
<td th:text="${booking.noOfDays}"></td> <td th:text="${booking.noOfDays}"></td>
@ -268,7 +264,6 @@
<th>Hall Name</th> <th>Hall Name</th>
<th>Booking Id</th> <th>Booking Id</th>
<th>Reason for Booking</th>
<th>Start Date</th> <th>Start Date</th>
<th>End Date</th> <th>End Date</th>
<th>No of Days</th> <th>No of Days</th>
@ -295,7 +290,6 @@
<td th:text="${booking.hallDetails.hallName}"></td> <td th:text="${booking.hallDetails.hallName}"></td>
<td th:text="${booking.bookingId}"></td> <td th:text="${booking.bookingId}"></td>
<td th:text="${booking.reason}"></td>
<td th:text="${booking.startDate}"></td> <td th:text="${booking.startDate}"></td>
<td th:text="${booking.endDate}"></td> <td th:text="${booking.endDate}"></td>
<td th:text="${booking.noOfDays}"></td> <td th:text="${booking.noOfDays}"></td>

1196
src/main/resources/templates/headquarters/settlement-completed.html
File diff suppressed because it is too large
View File

3
src/main/resources/templates/headquarters/viewUploadNoc.html

@ -422,6 +422,7 @@
icon: 'warning', icon: 'warning',
title: 'No File Selected', title: 'No File Selected',
text: 'Please select a file to upload.', text: 'Please select a file to upload.',
allowOutsideClick: false,
}); });
return; return;
} }
@ -449,6 +450,7 @@
icon: 'success', icon: 'success',
title: 'Success', title: 'Success',
text: 'NOC uploaded successfully!', text: 'NOC uploaded successfully!',
allowOutsideClick: false,
}).then(() => { }).then(() => {
$('#uploadNocModal').modal('hide'); // Close the modal $('#uploadNocModal').modal('hide'); // Close the modal
location.reload(); // Refresh the page location.reload(); // Refresh the page
@ -460,6 +462,7 @@
icon: 'error', icon: 'error',
title: 'Upload Failed', title: 'Upload Failed',
text: 'Failed to upload NOC: ' + xhr.responseText, text: 'Failed to upload NOC: ' + xhr.responseText,
allowOutsideClick: false,
}); });
} }
}); });

2
src/main/resources/templates/officer/booking-list.html

@ -1,7 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"> <html xmlns:th="http://www.thymeleaf.org">
<head th:replace="~{fragments/head-admin :: head}"></head>
<head th:replace="~{fragments/head-officer :: head}"></head>
<style> <style>
.card-body table { .card-body table {
width: 100%; width: 100%;

2
src/main/resources/templates/officer/rejected-list.html

@ -1,7 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"> <html xmlns:th="http://www.thymeleaf.org">
<head th:replace="~{fragments/head-admin :: head}"></head>
<head th:replace="~{fragments/head-officer :: head}"></head>
<style> <style>
.card-body table { .card-body table {
width: 100%; width: 100%;

4
src/main/resources/templates/officiallogin.html

@ -162,7 +162,7 @@
</div> </div>
<div class="mb-4"> <div class="mb-4">
<label class="form-label">New 4 Digit PIN <span class="text-danger">*</span></label> <label class="form-label">New 4 Digit PIN <span class="text-danger">*</span></label>
<input type="password" minlength="4" maxlength="4" class="form-control text-center" name="newPinNo" id="updatedpassword" placeholder="Numbers Only" required />
<input type="password" maxlength="4" class="form-control text-center" name="newPinNo" id="updatedpassword" placeholder="Numbers Only" minlength="4" required />
</div> </div>
</div> </div>
<div class="block-content block-content-full text-end bg-body" id="mbutton"> <div class="block-content block-content-full text-end bg-body" id="mbutton">
@ -449,7 +449,7 @@
success: function(bodyMessage) { success: function(bodyMessage) {
if(bodyMessage.trim() == "Success"){ if(bodyMessage.trim() == "Success"){
Swal.fire( Swal.fire(
'PIN Updation!',
'PIN Registration!',
'Your New PIN Successfully Saved!<br>Now login with your new PIN.', 'Your New PIN Successfully Saved!<br>Now login with your new PIN.',
'success' 'success'
).then(() => { ).then(() => {

620
src/main/resources/templates/user/calculatehallamount.html

@ -195,7 +195,7 @@
<select id="reasonforBooking" <select id="reasonforBooking"
name="reasonforBooking" class="form-control" name="reasonforBooking" class="form-control"
required> required>
<option value="">select</option>
<option value="">Select</option>
<option value="SGE">State Govt Event <option value="SGE">State Govt Event
</option> </option>
<option value="CGE">Central Govt Event <option value="CGE">Central Govt Event
@ -364,6 +364,7 @@
$(document).ready(function () { $(document).ready(function () {
if (hallId != null) { if (hallId != null) {
getHallDetails(hallId, function (response) { getHallDetails(hallId, function (response) {
$('#hallIdDuplicate').val(hallId); $('#hallIdDuplicate').val(hallId);
$('#selecthall').val(hallId); $('#selecthall').val(hallId);
$('#fullDayAmount').data('amount', response.fullDayRent); $('#fullDayAmount').data('amount', response.fullDayRent);
@ -400,21 +401,26 @@
// Event listener for the Select Hall dropdown change // Event listener for the Select Hall dropdown change
$('#selecthall').change(function () { $('#selecthall').change(function () {
localStorage.clear();
var hallId = $(this).val(); var hallId = $(this).val();
if (hallId) { if (hallId) {
getHallDetails(hallId, function (response) { getHallDetails(hallId, function (response) {
localStorage.setItem("isSGE",response.sge); // Fetch SGE status from the response
localStorage.setItem("isCGE",response.cge);
$('#fullDayAmount').text(response.fullDayRent.toFixed(2)); $('#fullDayAmount').text(response.fullDayRent.toFixed(2));
$('#halfDayAmount').text(response.halfDayRent.toFixed(2)); $('#halfDayAmount').text(response.halfDayRent.toFixed(2));
$('#depositAmount').text(response.depositAmount.toFixed(2)); $('#depositAmount').text(response.depositAmount.toFixed(2));
$('#gst').text(response.gst.toFixed(0) + '%'); $('#gst').text(response.gst.toFixed(0) + '%');
$('#reasonforBooking').val('');
$('#numDaysCount').val(''); // Clear the numDaysCount dropdown $('#numDaysCount').val(''); // Clear the numDaysCount dropdown
$('#selectedhallId').val(hallId); $('#selectedhallId').val(hallId);
// Reset the startDate and endDate fields // Reset the startDate and endDate fields
$('#startPeriodDropdown').val(''); $('#startPeriodDropdown').val('');
$('#endPeriodDropdown').val(''); $('#endPeriodDropdown').val('');
$('#totalAmountDiv').hide(); $('#totalAmountDiv').hide();
const isSGE = response.sge; // Fetch SGE status from the response
const isCGE = response.cge;
/*if (!isSGE) { /*if (!isSGE) {
$('#reasonforBookingdiv').hide(); $('#reasonforBookingdiv').hide();
}*/ }*/
@ -559,609 +565,65 @@
}); });
}); });
document.addEventListener("DOMContentLoaded", function () {
document.addEventListener("DOMContentLoaded", function () {
const reasonDropdown = document.getElementById("reasonforBooking"); const reasonDropdown = document.getElementById("reasonforBooking");
const numDaysDropdown = document.getElementById("numDaysCount"); const numDaysDropdown = document.getElementById("numDaysCount");
const startPeriodDropdown = document.getElementById("startPeriodDropdown");
const endPeriodDropdown = document.getElementById("endPeriodDropdown");
reasonDropdown.addEventListener("change", function () { reasonDropdown.addEventListener("change", function () {
const selectedValue = reasonDropdown.value; const selectedValue = reasonDropdown.value;
if (selectedValue === "MARRIAGE" || selectedValue === "COMMERCIAL") { if (selectedValue === "MARRIAGE" || selectedValue === "COMMERCIAL") {
// Enable dropdown for Marriage and Commercial
// Enable dropdowns for Marriage and Commercial
numDaysDropdown.disabled = false; numDaysDropdown.disabled = false;
numDaysDropdown.value = ""; // Allow the user to select numDaysDropdown.value = ""; // Allow the user to select
startPeriodDropdown.disabled = false;
startPeriodDropdown.value = ""; // Allow the user to select
endPeriodDropdown.disabled = false;
endPeriodDropdown.value = ""; // Allow the user to select
} else { } else {
// Set to one day and disable for other events // Set to one day and disable for other events
numDaysDropdown.value = "1"; numDaysDropdown.value = "1";
numDaysDropdown.disabled = true; numDaysDropdown.disabled = true;
// Reset and disable start and end period dropdowns
startPeriodDropdown.value = "";
startPeriodDropdown.disabled = false;
endPeriodDropdown.value = "";
endPeriodDropdown.disabled = false;
} }
}); });
}); });
$('#reasonforBooking').change(function () {
var isSGE = localStorage.getItem("isSGE") === "true";
var isCGE = localStorage.getItem("isCGE") === "true";
var reasonForBooking = $('#reasonforBooking').val();
</script>
</body>
</html>
<!--
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head th:replace="~{fragments/head :: head}">
<script src="https://maps.googleapis.com/maps/api/js?key="></script>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
</head>
<style>
/* Hide button and div2 on small screens */
@media only screen and (max-width: 576px) {
/* Adjust the font size for better readability on smaller screens */
body {
font-size: 14px;
padding: 0 10px;
}
/* Modify the layout of certain elements */
.col-sm-4 {
width: 85%;
margin-bottom: 10px;
}
.select2-container {
width: 100% !important;
margin-bottom: 10px;
}
.text-center {
text-align: center !important;
}
#toggleButton {
display: none;
}
#div2 {
display: none;
}
.table-container {
overflow-y: auto;
display: flex;
justify-content: center;
align-items: center;
height: 100%;
}
.table-responsive-md {
overflow-x: auto;
-webkit-overflow-scrolling: touch;
width: 100%;
}
/* Custom CSS for table */
#amountDetails {
margin-top: 26px;
width: 95%;
}
#amountDetails table {
width: 100%;
max-width: 100%;
margin: 0 auto;
border-collapse: collapse;
}
#amountDetails th,
#amountDetails td {
padding: 8px;
border: 1px solid #ddd;
text-align: left;
word-wrap: break-word;
white-space: normal;
}
/* Custom CSS for carousel */
.thumbnail {
cursor: pointer;
}
.carousel-item img {
width: 100%;
height: auto;
}
.carousel-image {
max-height: 300px;
width: auto;
margin: 0 auto;
}
.carousel-control-prev,
.carousel-control-next {
color: black;
}
/* Custom CSS for amount details */
#totalAmountDiv {
margin-top: 20px;
width: 100%;
text-align: center;
}
#totalAmount {
font-size: 18px;
font-weight: bold;
}
}
</style>
<body>
&lt;!&ndash; Pre-loader start &ndash;&gt;
<div class="theme-loader">
<div class="ball-scale">
<div class='contain'>
<div class="ring">
<div class="frame"></div>
</div>
<div class="ring">
<div class="frame"></div>
</div>
<div class="ring">
<div class="frame"></div>
</div>
<div class="ring">
<div class="frame"></div>
</div>
<div class="ring">
<div class="frame"></div>
</div>
<div class="ring">
<div class="frame"></div>
</div>
<div class="ring">
<div class="frame"></div>
</div>
<div class="ring">
<div class="frame"></div>
</div>
<div class="ring">
<div class="frame"></div>
</div>
<div class="ring">
<div class="frame"></div>
</div>
</div>
</div>
</div>
&lt;!&ndash; Pre-loader end &ndash;&gt;
<div id="pcoded" class="pcoded">
<div class="pcoded-container">
&lt;!&ndash; Menu header start &ndash;&gt;
<nav th:replace="~{fragments/nav-user :: nav}"></nav>
&lt;!&ndash; Menu header end &ndash;&gt;
<div class="pcoded-main-container">
<nav th:replace="~{fragments/nav-usermenu :: nav}"></nav>
<div class="pcoded-wrapper">
<div class="pcoded-content">
<div class="pcoded-inner-content">
&lt;!&ndash; Main-body start &ndash;&gt;
<div class="main-body">
<div class="page-wrapper">
&lt;!&ndash; Page-header start &ndash;&gt;
<div class="page-header m-t-20"></div>
&lt;!&ndash; Page-header end &ndash;&gt;
&lt;!&ndash; Page body start &ndash;&gt;
<div class="page-body">
<div class="content">
<div class="block block-rounded" style="width: 75%;margin-left: 12%;">
<div class="block-header block-header-default">
<h3 class="block-title">Calculate Rent Amount</h3>
</div>
<div class="block-content p-0">
<div class="p-sm-4 p-0">
<div class="row justify-content-center">
<div class="col-sm-4 col-lg-6 col-md-4">
<label for="selecthall">Select Hall:</label>
<select id="selecthall" class="form-control"
name="hallId" required>
<option value="">Select a hall</option>
&lt;!&ndash; Dynamically populated options will be inserted here &ndash;&gt;
</select>
</div>
<br>
<br>
<div id="amountDetails"
style="display:none; margin-top: 26px; width: 94%;">
<div class="row justify-content-center">
<div class="col-sm-4 col-lg-3 col-md-4"
style="display:none" id="reasonforBookingdiv">
<label for="reasonforBooking">Reason For
Booking:</label>
<select id="reasonforBooking"
name="reasonforBooking" class="form-control"
required>
<option value="">select</option>
<option value="SGE">State Govt Event
</option>
<option value="CGE">Central Govt Event
</option>
<option value="others">Others</option>
</select>
</div>
<div class="col-sm-4 col-lg-3 col-md-4">
<label for="numDaysCount">Number of
Days:</label>
<select class="form-control" id="numDaysCount"
name="days" required>
<option value="">Select</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
</select>
</div>
<div class="col-sm-4 col-lg-3 col-md-4"
id="startPeriodDropdowndiv"> <label
for="startPeriodDropdown">Start
Period:</label>
<select id="startPeriodDropdown"
name="startingSlot" class="form-control"
required>
<option value="">Select</option>
<option value="1">Morning (6:00 AM)</option>
<option value="2">Evening (2:00 PM)</option>
</select>
</div>
<div class="col-sm-4 col-lg-3 col-md-4"
id="endPeriodDropdowndiv"> <label
for="endPeriodDropdown">End Period:</label>
<select id="endPeriodDropdown" name="endingSlot"
class="form-control" required>
<option value="">Select</option>
<option value="1">Morning (2:00 PM)</option>
<option value="2">Evening (10:00 PM)
</option>
</select>
</div>
</div>
<br>
<div class="text-center">
<button id="calculateButton"
class="btn btn-primary">Calculate</button>
</div>
<input type="hidden" id="selectedhallId">
<div id="totalAmountDiv" class="text-center mt-3"
style="display:none;">
<table
class="table table-bordered center-table table-align">
<tbody>
<tr>
<td class="td-align"><strong> Hall
Amount:</strong>
</td>
<td><span
id="actualhallAmount_td">Rs</span>
</td>
</tr>
<tr>
<td class="td-align">
<strong>Discount:</strong>
</td>
<td><span id="discount_td">0%</span>
</td>
</tr>
<tr id="additionalcharges"
style="display:none">
<td class="td-align">
<strong>Rent Amount:</strong>
</td>
<td><span id="rentamount_td">0</span>
</td>
</tr>
<tr id="additionalcharges_tr"
style="display:none">
<td class="td-align">
<strong>Additional charges (Cleaning
+ P.A.
System + E.B):</strong>
</td>
<td><span
id="additionalcharges_td">0</span>
</td>
</tr>
<tr>
<td class="td-align"><strong>Net
Amount:</strong>
</td>
<td><span id="hallAmount_td">Rs</span>
</td>
</tr>
<tr>
<td class="td-align"><strong>GST
Amount:</strong></td>
<td><span id="gst_td">Rs</span></td>
</tr>
<tr>
<td class="td-align"><strong>Deposit
Amount:</strong></td>
<td><span
id="depositAmount_td">Rs</span>
</td>
</tr>
<tr>
<td class="td-align"><strong>Total
Amount:</strong>
</td>
<td><span id="totalAmount_td">Rs</span>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
&lt;!&ndash; Page body end &ndash;&gt;
</div>
</div>
&lt;!&ndash; Main-body end &ndash;&gt;
</div>
</div>
</div>
</div>
</div>
</div>
<footer th:replace="~{fragments/footer2 :: footer}"></footer>
&lt;!&ndash; Login Modal&ndash;&gt;
<div th:replace="~{fragments/loginreg :: div}"></div>
<script th:replace="~{fragments/script :: script}"></script>
<script th:replace="~{fragments/logRegiOtpScript :: script}"></script>
<script>
function getHallDetails(hallId, callback) {
$.ajax({
type: 'GET',
url: '/communityhall/user/api/gethalldetails/' + hallId,
success: function (response) {
callback(response);
},
error: function (xhr, status, error) {
//console.error('Error fetching hall details:', error);
}
});
}
// Get hallId from URL parameters and fetch hall details
const urlParams = new URLSearchParams(window.location.search);
const hallId = urlParams.get('hallId');
$(document).ready(function () {
if (hallId != null) {
getHallDetails(hallId, function (response) {
$('#selecthall').val(hallId);
$('#fullDayAmount').data('amount', response.fullDayRent);
$('#halfDayAmount').data('amount', response.halfDayRent);
$('#depositAmount').data('amount', response.depositAmount);
$('#gst').data('rate', response.gst);
});
}
});
// Populate the dropdown options with the received hall names
$(function () {
$("#selecthall").select2();
});
$.ajax({
type: 'GET',
url: '/communityhall/user/api/gethallnames',
success: function (response) {
var selectHallDropdown = $('#selecthall');
$.each(response, function (index, hall) {
selectHallDropdown.append($('<option></option>').attr('value', hall.hallId).text(hall.hallName));
if (hallId == hall.hallId) {
selectHallDropdown.find('option[value="' + hall.hallId + '"]').prop('selected', true);
}
});
},
error: function (xhr, status, error) {
console.error('Error fetching hall names:', error);
}
});
// Event listener for the Select Hall dropdown change
$('#selecthall').change(function () {
var hallId = $(this).val();
if (hallId) {
getHallDetails(hallId, function (response) {
$('#fullDayAmount').text(response.fullDayRent.toFixed(2));
$('#halfDayAmount').text(response.halfDayRent.toFixed(2));
$('#depositAmount').text(response.depositAmount.toFixed(2));
$('#gst').text(response.gst.toFixed(0) + '%');
$('#numDaysCount').val(''); // Clear the numDaysCount dropdown
$('#selectedhallId').val(hallId);
// Reset the startDate and endDate fields
$('#startPeriodDropdown').val('');
$('#endPeriodDropdown').val('');
$('#totalAmountDiv').hide();
const isSGE = response.sge; // Fetch SGE status from the response
const isCGE = response.cge;
if (!isSGE) {
$('#reasonforBookingdiv').hide();
} else {
$('#reasonforBookingdiv').show();
}
// Show the required amount details once hall is selected
$('#amountDetails').show();
});
} else {
// Hide the amount details if no hall is selected
$('#amountDetails').hide();
}
});
function calculateAmount(numDays, startPeriod, endPeriod, fullDayAmount, halfDayAmount) {
var amount = 0;
// If there is only one day
if (numDays === 1) {
if (startPeriod === "1" && endPeriod === "2") {
amount = fullDayAmount;
} else if (startPeriod === "1" && endPeriod === "1") {
amount = halfDayAmount;
} else if (startPeriod === "2" && endPeriod === "2") {
amount = halfDayAmount;
}
} else {
// For multiple days
if (startPeriod === "1" && endPeriod === "2") {
amount = fullDayAmount * numDays;
} else if (startPeriod === "1" && endPeriod === "1") {
amount = fullDayAmount * (numDays - 1) + halfDayAmount;
} else if (startPeriod === "2" && endPeriod === "2") {
amount = fullDayAmount * (numDays - 1) + halfDayAmount;
}
else if (startPeriod === "2" && endPeriod === "1") {
amount = fullDayAmount * (numDays - 2) + halfDayAmount * 2;
}
}
return amount;
}
function calculateGST(amount, gstRate) {
return parseFloat(((amount * gstRate) / 100).toFixed(2));
}
function handlePeriodDropdowns(numDays, startPeriod) {
if (numDays === 1 && startPeriod === "2") {
$('#endPeriodDropdown').val("2");
$('#endPeriodDropdown').prop('disabled', true);
} else {
$('#endPeriodDropdown').prop('disabled', false);
if ((reasonForBooking === 'SGE' && !isSGE) || (reasonForBooking === 'CGE' && !isCGE)) {
// Show popup for Government Events
Swal.fire({
title: 'Government Event',
text: 'Shenoy Nagar Community Center (Auditorium) full Mandapam (Amma Arangam) is available for state government events.',
icon: 'info',
confirmButtonText: 'OK'
}).then((result) => {
if (result.isConfirmed) {
window.location.reload();
} }
}
$('#numDaysCount').change(function () {
var numDays = parseInt($(this).val(), 10);
var startPeriod = $('#startPeriodDropdown').val();
handlePeriodDropdowns(numDays, startPeriod);
});
$('#startPeriodDropdown').change(function () {
var numDays = parseInt($('#numDaysCount').val(), 10);
var startPeriod = $(this).val();
handlePeriodDropdowns(numDays, startPeriod);
}); });
}
});
$('#calculateButton').click(function () {
var hallId = $('#selectedhallId').val();
var numDays = parseInt($('#numDaysCount').val(), 10);
var startPeriod = $('#startPeriodDropdown').val();
var endPeriod = $('#endPeriodDropdown').val();
var reasonForBooking = $('#reasonforBooking').val();
// Validate input fields
if (isNaN(numDays) || numDays < 1 || numDays > 7) {
$('#numDaysCount')[0].setCustomValidity('Please select a valid number of days.');
$('#numDaysCount')[0].reportValidity();
return;
}
if (reasonforBooking === 'SGE') {
var startPeriod = $('#startPeriodDropdown').val("1");
var endPeriod = $('#endPeriodDropdown').val("2");
}
$.ajax({
type: 'GET',
url: '/communityhall/user/api/calculatehallamount',
data: {
hallId: hallId,
numDays: numDays,
startPeriod: startPeriod,
endPeriod: endPeriod,
reasonforBooking: reasonForBooking
},
success: function (response) {
console.log(response);
// Update HTML elements with the response data
if (response.reasonforBooking === 'SGE') {
if(response.startperiod==='1' && response.endPeriod === '2'){
$('#actualhallAmount_td').text('₹' + response.fulldayhallAmount);
}else{
$('#actualhallAmount_td').text('₹' + response.halfdayhallAmount);
}
document.getElementById("additionalcharges").style.display = 'table-row'; // Show row
document.getElementById("additionalcharges_tr").style.display = 'table-row'
$('#discount_td').text(response.discount + '%');
$("#rentamount_td").html(response.rentAmount);
$("#additionalcharges_td").html('₹'+response.additionalCharges);
$('#hallAmount_td').text('₹' + response.netAmount);
$('#gst_td').text('₹' + response.gst);
$('#depositAmount_td').text('₹' + response.depositAmount);
$('#totalAmount_td').text('₹' + response.totalAmount);
$('#totalAmountDiv').show();
} else {
$('#actualhallAmount_td').text('₹' + response.amount);
$('#discount_td').text(response.discount + '%');
$('#hallAmount_td').text('₹' + response.discountAmount);
$('#gst_td').text('₹' + response.gst);
$('#depositAmount_td').text('₹' + response.depositAmount);
$('#totalAmount_td').text('₹' + response.totalAmount);
document.getElementById("additionalcharges").style.display = 'none'; // Hide row
document.getElementById("additionalcharges_tr").style.display = 'none'; // Hide row
</script>
// Show the total amount div
$('#totalAmountDiv').show();
}
},
error: function (xhr, status, error) {
console.error('Error occurred: ' + error);
}
});
});
</script>
</body> </body>
</html>-->
</html>

20
src/main/resources/templates/user/collectionpending.html

@ -5,6 +5,7 @@
<script src="https://maps.googleapis.com/maps/api/js?key="></script> <script src="https://maps.googleapis.com/maps/api/js?key="></script>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
</head> </head>
<body> <body>
<!-- Pre-loader start --> <!-- Pre-loader start -->
<div class="theme-loader"> <div class="theme-loader">
@ -116,12 +117,27 @@
</tr> </tr>
</tbody> </tbody>
</table> </table>
<div class="text-center">
<div class="text-center">
<button id="calculateButton" <button id="calculateButton"
class="btn btn-primary" th:onclick="|extrapaymentStart(${bookingsDetails.users.userId}, ${bookingsDetails.bookingId})|">Pay</button> class="btn btn-primary" th:onclick="|extrapaymentStart(${bookingsDetails.users.userId}, ${bookingsDetails.bookingId})|">Pay</button>
<input type="hidden" id="extrapaymentbtnSubmit"></input> <input type="hidden" id="extrapaymentbtnSubmit"></input>
</div> </div>
</div>
<!--<div class="text-center">
<div th:if="${bookingsDetails.settlement.collectionStatus} != 'Paid'">
<button id="calculateButton"
class="btn btn-primary"
th:onclick="|extrapaymentStart(${bookingsDetails.users.userId}, ${bookingsDetails.bookingId})|">
Pay
</button>
<input type="hidden" id="extrapaymentbtnSubmit">
</div>
<div th:if="${bookingsDetails.settlement.collectionStatus} == 'Paid'">
<button class="text-bg-danger"> Amount Paid </button>
</div>
</div>-->
</div>
</div> </div>
</div> </div>
</div> </div>

1985
src/main/resources/templates/user/dashboard.html
File diff suppressed because it is too large
View File

537
src/main/resources/templates/user/hallbookingform.html

@ -1,13 +1,9 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml" xmlns="http://www.w3.org/1999/html">
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head th:replace="~{fragments/head :: head}"></head> <head th:replace="~{fragments/head :: head}"></head>
<script src="https://cdn.jsdelivr.net/npm/compressorjs@5.0.3/dist/compressor.js"></script> <script src="https://cdn.jsdelivr.net/npm/compressorjs@5.0.3/dist/compressor.js"></script>
<script src="https://cdn.jsdelivr.net/npm/sockjs-client"></script>
<!--<script src="https://cdn.jsdelivr.net/npm/stompjs"></script>-->
<script src="https://cdn.jsdelivr.net/npm/stompjs@2.3.3/lib/stomp.min.js"></script>
<style> <style>
.table-align { .table-align {
width: 100%; width: 100%;
@ -51,29 +47,6 @@
color: #000 !important; color: #000 !important;
} }
.highlight-blue .ui-state-default {
background: blue !important;
color: #FFF !important;
}
.highlight-blue a {
background-color: blue;
color: white;
}
.highlight-lightpink .ui-state-default {
background: lightpink !important;
color: #FFF !important;
}
.highlight-lightpink a,
input[type=button]:disabled {
background-color: lightpink;
color: white;
}
.btn-square-md { .btn-square-md {
width: 16px !important; width: 16px !important;
max-width: 100% !important; max-width: 100% !important;
@ -973,6 +946,17 @@
opacity: 0; opacity: 0;
} }
} }
.highlight-blue .ui-state-default {
background: blue !important;
color: #FFF !important;
}
.highlight-blue a {
background-color: blue;
color: white;
}
</style> </style>
<body> <body>
@ -1142,12 +1126,6 @@
<span style="margin-left: 14px;">Gcc <span style="margin-left: 14px;">Gcc
Blocked</span> Blocked</span>
</div> </div>
<div class="col col-lg-2 col-sm-2 col-md-2">
<button type="button"
class="btn btn-primary btn-square-md"
style="background-color: lightpink"></button>
<span style="margin-left:-2px;">Temporary Blocked</span>
</div>
</div> </div>
</div> </div>
<br> <br>
@ -1278,14 +1256,13 @@
Blocked</p> Blocked</p>
</div> </div>
<div class="col col-lg-2 col-sm-2 col-md-2">
<!--<div class="col col-lg-2 col-sm-2 col-md-2">
<button type="button" <button type="button"
class="btn btn-primary btn-square-md" class="btn btn-primary btn-square-md"
style="background-color: lightpink"></button> style="background-color: lightpink"></button>
<p style="margin-left: 6px;">Temporary <p style="margin-left: 6px;">Temporary
Blocked</p> Blocked</p>
</div>
</div>-->
</div> </div>
<br> <br>
@ -1427,13 +1404,6 @@
style="padding: 20px; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); background-color: #FFFFFF; border: 1px solid #CCCCCC;"> style="padding: 20px; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); background-color: #FFFFFF; border: 1px solid #CCCCCC;">
<div> <div>
<div class="card-body"> <div class="card-body">
<div id="timer-container"
style="display: none; font-size: 20px; color: #d9534f; float:right;margin-right:10px; margin-bottom: 4px">
<span class="sand-clock"></span>Time left : <span
id="timer2">03:00</span>
</div>
<br>
<div class="col-md-12 col-sm-12 col-lg-12"> <div class="col-md-12 col-sm-12 col-lg-12">
<table <table
class="table table-bordered table-align center-table"> class="table table-bordered table-align center-table">
@ -1517,7 +1487,7 @@
<span id="timer" <span id="timer"
style="display: inline; float:right;margin-right:10px;"> style="display: inline; float:right;margin-right:10px;">
<span class="sand-clock"></span> <!-- Hourglass icon --> <span class="sand-clock"></span> <!-- Hourglass icon -->
<span id="timerText">Payment Closes in 03:00</span>
<span id="timerText">Payment Closes in 01:00</span>
<!-- Timer text --> <!-- Timer text -->
</span> </span>
</h6> </h6>
@ -1683,8 +1653,7 @@
<div class="col-md-12 text-center"> <div class="col-md-12 text-center">
<!-- Center align the button --> <!-- Center align the button -->
<button type="button" class="btn btn-primary prev-step" <button type="button" class="btn btn-primary prev-step"
style="background-color: #016d6f; color: white;"
id="previewbutton">
style="background-color: #016d6f; color: white;">
Previous Previous
</button> </button>
</div> </div>
@ -1738,7 +1707,6 @@
<script th:replace="~{fragments/logRegiOtpScript :: script}"></script> <script th:replace="~{fragments/logRegiOtpScript :: script}"></script>
<script th:replace="~{fragments/PaymentScript :: script}"></script> <script th:replace="~{fragments/PaymentScript :: script}"></script>
<script src="https://cdn.jsdelivr.net/npm/compressorjs@latest/dist/compressor.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/compressorjs@latest/dist/compressor.min.js"></script>
<!-- Payment script end--> <!-- Payment script end-->
<script> <script>
let reasonMaxData = new Map(); // in beginning let reasonMaxData = new Map(); // in beginning
@ -1762,9 +1730,9 @@
$("#selecthall").val(hallId); $("#selecthall").val(hallId);
} }
}); });
var countdown; // Global variable to hold the interval var countdown; // Global variable to hold the interval
var totalTime = 3 * 60; // 15 minutes in seconds
// var totalTime = 15 * 60; // 15 minutes in seconds
var totalTime = 1 * 60; // for testing
var timerElement = document.getElementById("timerText"); var timerElement = document.getElementById("timerText");
var confirmPaymentBtn = document.getElementById("confirmPaymentBtn"); var confirmPaymentBtn = document.getElementById("confirmPaymentBtn");
var checkInCheckbox = document.getElementById("checkin"); var checkInCheckbox = document.getElementById("checkin");
@ -1797,26 +1765,6 @@
confirmPaymentBtn.disabled = true; // Disable the Confirm Payment button when time is up confirmPaymentBtn.disabled = true; // Disable the Confirm Payment button when time is up
checkInCheckbox.disabled = true; // Disable the Check-in checkbox when time is up checkInCheckbox.disabled = true; // Disable the Check-in checkbox when time is up
timerElement.innerHTML = "Time expired"; // Optionally update the message timerElement.innerHTML = "Time expired"; // Optionally update the message
// Show SweetAlert2 popup
Swal.fire({
title: 'Time Expired',
text: 'The payment window has expired. Please proceed to the next step.',
icon: 'warning',
allowOutsideClick: false,
allowEscapeKey: false,
allowEnterKey: false,
confirmButtonText: 'OK'
}).then((result) => {
if (result.isConfirmed) {
// Ensure that any other actions don't conflict with visibility changes
document.getElementById("previewbutton").click();
}// Redirect to step 2 when "OK" is clicked
/* window.location.href = "/communityhall/hallbookingform";! */
});
} else { } else {
timerElement.innerHTML = "Payment Closes in " + formatTime(timeLeft); timerElement.innerHTML = "Payment Closes in " + formatTime(timeLeft);
confirmPaymentBtn.disabled = !checkInCheckbox.checked; confirmPaymentBtn.disabled = !checkInCheckbox.checked;
@ -1894,6 +1842,7 @@
return false; return false;
} }
// Function to show SweetAlert for login // Function to show SweetAlert for login
function showAlertForLogin() { function showAlertForLogin() {
Swal.fire({ Swal.fire({
@ -1998,19 +1947,9 @@
$("#endPeriodDropdown").prop("disabled", false); $("#endPeriodDropdown").prop("disabled", false);
var form = document.getElementById('booking'); var form = document.getElementById('booking');
var formData = new FormData(form); var formData = new FormData(form);
// Retrieve bcId from localStorage if it exists
var bcid = localStorage.getItem("bcid");
console.log("bcid......." + bcid);
if (bcid) {
formData.append("bcId", bcid); // Add bcId to the FormData object
}
// Debugging: Log each FormData entry // Debugging: Log each FormData entry
for (var pair of formData.entries()) { for (var pair of formData.entries()) {
console.log(pair[0] + ', ', pair[1]);
//console.log(pair[0] + ', ', pair[1]);
} }
$.ajax({ $.ajax({
url: '/communityhall/user/api/saveTheRequest2', url: '/communityhall/user/api/saveTheRequest2',
@ -2019,69 +1958,18 @@
processData: false, processData: false,
contentType: false, contentType: false,
success: function (response) { success: function (response) {
//alert("Bc Id........"+response.bcId);
console.log("bc ID 1" + response.bcId);
console.log("response:--" + response.status);
if (response.status === 'slotOccupied') { if (response.status === 'slotOccupied') {
Swal.fire({ Swal.fire({
icon: 'error', icon: 'error',
title: 'Slot Occupied', title: 'Slot Occupied',
text: 'The selected slot is already occupied. Please choose a different slot.', text: 'The selected slot is already occupied. Please choose a different slot.',
allowOutsideClick: false,
allowEscapeKey: false,
allowEnterKey: false,
confirmButtonText: 'OK'
}).then(function () {
location.reload(); // Example: reload the page
});
} else if (response.status == 'slotOccupiedbyAnotherUser') {
Swal.fire({
icon: 'error',
title: 'Slot Occupied',
text: 'The selected slot is occupied by another user. Please choose a different slot.',
allowOutsideClick: false,
allowEscapeKey: false,
allowEnterKey: false,
confirmButtonText: 'OK' confirmButtonText: 'OK'
}).then(function () { }).then(function () {
location.reload(); // Example: reload the page location.reload(); // Example: reload the page
}); });
} else if (response.status === 'slotLocked') {
Swal.fire({
icon: 'warning',
title: 'Slot Locked',
text: response.message,
allowOutsideClick: false,
allowEscapeKey: false,
allowEnterKey: false,
confirmButtonText: 'OK'
}).then(function () {
console.log("bc ID 2" + response.bcId);
localStorage.clear();
bcid = response.bcId;
localStorage.setItem("bcid", bcid);
slotFunction();
});
} else if (response.status === 'inQueue') { /*Written for user block in queue*/
Swal.fire({
icon: 'info',
title: 'inQueue',
text: response.message,
allowOutsideClick: false,
allowEscapeKey: false,
allowEnterKey: false,
confirmButtonText: 'OK'
}).then(function () {
slotFunction();
});
// Optionally show queue position
$("#queuePosition").html("Queue Position: " + response.queuePosition);
} else { } else {
console.log("bc ID 3" + response.bcId);
localStorage.clear();
bcid = response.bcId;
localStorage.setItem("bcid", bcid);
userId = response.userId; userId = response.userId;
bookingId = response.bookingId; bookingId = response.bookingId;
$("#bookingId").val(response.bookingId); $("#bookingId").val(response.bookingId);
@ -2104,9 +1992,27 @@
} }
$("#startingslot_td").html(getTimeOfDay(response.startingSlot) + " to " + getTimeOfDay(response.endingSlot)); $("#startingslot_td").html(getTimeOfDay(response.startingSlot) + " to " + getTimeOfDay(response.endingSlot));
/*$("#gst_td").html(response.gst);
$("#depositAmount_td").html(response.depositAmount);
$("#discount_td").html(response.discount + "%");
$("#actualhallAmount_td").html(response.actualhallamount);
$("#totalAmount_td").html(response.totalAmount);*/
$("#name_td").html(response.username); $("#name_td").html(response.username);
$("#mobileno_td").html(response.mobileNo); $("#mobileno_td").html(response.mobileNo);
$("#usertype_td").html(response.userType); $("#usertype_td").html(response.userType);
/*if (response.reasoncode === 'SGE') {
document.getElementById("additionalcharges").style.display = 'table-row'; // Show row
document.getElementById("additionalcharges_tr").style.display = 'table-row'
$("#additionalcharges_td").html(response.additionalcharges);
$("#rentamount_td").html(0);
$("#actualhallAmount_td").html(response.actualhallamount);
$("#hallAmount_td").html(response.additionalcharges);
$("#totalAmount_td").html(response.totalAmount);
} else {
document.getElementById("additionalcharges").style.display = 'none'; // Hide row
document.getElementById("additionalcharges_tr").style.display = 'none'; // Hide row
}*/
if (response.reasoncode === 'SGE') { if (response.reasoncode === 'SGE') {
document.getElementById("additionalcharges").style.display = 'table-row'; // Show row document.getElementById("additionalcharges").style.display = 'table-row'; // Show row
document.getElementById("additionalcharges_tr").style.display = 'table-row' document.getElementById("additionalcharges_tr").style.display = 'table-row'
@ -2154,66 +2060,6 @@
$("#endPeriodDropdown").prop("disabled", true); $("#endPeriodDropdown").prop("disabled", true);
} }
function slotFunction() {
$('.step-3').show();
$('.step-4').hide();
var progressPercentage = ((3 - 1) / 3) * 100;
$(".progress-bar").css("width", progressPercentage + "%");
$('#timer-container').show();
resetQueueTimer();
}
let queueTimerInterval;
// Timer logic
function resetQueueTimer() {
//let totalTime = 15 * 60; // 15 minutes in seconds
let totalTime = 3 * 60;
const timerDisplay = document.getElementById('timer2');
const nextButton3 = document.querySelector('.step-3 .next-step');
// Enable Next button only after the timer ends
nextButton3.disabled = true;
if (queueTimerInterval) clearInterval(queueTimerInterval);
// Countdown logic
queueTimerInterval = setInterval(function () {
if (totalTime >= 0) {
const minutes = Math.floor(totalTime / 60);
const seconds = totalTime % 60;
timerDisplay.textContent = `${minutes}:${seconds.toString().padStart(2, '0')}`;
totalTime--;
} else {
clearInterval(queueTimerInterval); // Clear the interval when time is 0
nextButton3.disabled = false; // Enable the Next button
}
}, 1000);
}
// Next button click logic
document.querySelector('.step-3 .next-step').addEventListener('click', function () {
if (queueTimerInterval) clearInterval(queueTimerInterval);
if (!this.disabled) { // Only proceed if button is enabled
if ($('.step-3').is(':visible')) {
var valid = validateStep3Fields();
if (!valid) return;
$('.step-3').hide();
$('.step-4').show();
// Update progress bar for Step 4
var progressPercentage = (3 / 3) * 100;
$(".progress-bar").css("width", progressPercentage + "%");
$('#timer-container').hide();
}
}
});
function displayDocumentDetails(uploadedDocs) { function displayDocumentDetails(uploadedDocs) {
const uploadedDocsList = $("#uploadedDocsList"); const uploadedDocsList = $("#uploadedDocsList");
@ -2447,12 +2293,34 @@
validateStep3(); validateStep3();
}); });
$(".next-step").click(function () { $(".next-step").click(function () {
var valid = true;
// Validate all required text inputs and file fields in Step 3 // Validate all required text inputs and file fields in Step 3
if (currentStep === 3) { if (currentStep === 3) {
var valid = validateStep3Fields();
if (!valid) return;
$('.step-3 input[required], .step-3 select[required]').each(function () {
if ($(this).val() === '') {
$(this).addClass('error'); // Add error class
valid = false;
return false; // Break the loop
} else {
$(this).removeClass('error'); // Remove error class if valid
}
});
$('.step-3 input[type="file"][required]').each(function () {
if ($(this)[0].files.length === 0) {
$(this).addClass('error'); // Add error class
valid = false;
return false; // Break the loop
} else {
$(this).removeClass('error'); // Remove error class if valid
}
});
}
if (!valid) {
return; // Stop if validation fails
} }
if (currentStep < 4) { if (currentStep < 4) {
@ -2582,34 +2450,15 @@
displayError(fileInput, errorMessage); displayError(fileInput, errorMessage);
} }
// Handle image files separately // Handle image files separately
if (/\.(jpg|jpeg)$/i.test(filePath) && file.size > 2097152) {
else if (/(\.jpg|\.jpeg)$/i.test(filePath) && file.size > 2097152) {
compressImage(file).then(compressedFile => { compressImage(file).then(compressedFile => {
const dataTransfer = new DataTransfer(); const dataTransfer = new DataTransfer();
dataTransfer.items.add(compressedFile); dataTransfer.items.add(compressedFile);
fileInput.files = dataTransfer.files; fileInput.files = dataTransfer.files;
// Validate file size after compression // Validate file size after compression
validateSize(fileInput, 'greater');
validateFileSize(fileInput);
}).catch(error => { }).catch(error => {
console.error('Compression error:', error);
errorMessage = 'Error compressing image.';
displayError(fileInput, errorMessage);
});
}
// Case 2: File is a JPG/JPEG and smaller than or equal to 2MB
else if (/\.(jpg|jpeg)$/i.test(filePath) && file.size <= 2097152) {
compressImage(file).then(compressedFile => {
const dataTransfer = new DataTransfer();
dataTransfer.items.add(compressedFile);
fileInput.files = dataTransfer.files;
// Validate file size after compression
validateSize(fileInput, 'smaller');
}).catch(error => {
console.error('Compression error:', error);
errorMessage = 'Error compressing image.'; errorMessage = 'Error compressing image.';
displayError(fileInput, errorMessage); displayError(fileInput, errorMessage);
}); });
@ -2625,18 +2474,6 @@
} }
} }
function validateSize(fileInput, condition) {
const file = fileInput.files[0];
if (condition === 'greater' && file && file.size > 2097152) {
displayError(fileInput, 'File size is still greater than 2MB after compression.');
fileInput.value = ''; // Clear the file input
} else if (condition === 'smaller' && file && file.size > 2097152) {
displayError(fileInput, 'Compressed file size exceeded 2MB limit.');
fileInput.value = ''; // Clear the file input
} else {
console.log('File size is within the limit after compression.');
}
}
function isDuplicateFile(fileName, currentInput) { function isDuplicateFile(fileName, currentInput) {
const fileInputs = document.querySelectorAll('.file-upload-field'); const fileInputs = document.querySelectorAll('.file-upload-field');
@ -2815,7 +2652,6 @@
initializeViewerJS(); initializeViewerJS();
getBookingCalendar(hallId); getBookingCalendar(hallId);
//connectToWebSocket(hallId);
// Set hall details in Step 2 and Step 3 // Set hall details in Step 2 and Step 3
$('#hallNameDisplayStep2').text(response.hallName); $('#hallNameDisplayStep2').text(response.hallName);
@ -2906,7 +2742,7 @@
$("#startDateInput").datepicker("destroy"); $("#startDateInput").datepicker("destroy");
for (var i = 0; i < response.length; i++) { for (var i = 0; i < response.length; i++) {
var dateString = datepickerFormat(response[i].bdate); var dateString = datepickerFormat(response[i].bdate);
window.bookingResponse[dateString] = [response[i].morningSlot, response[i].eveningSlot, response[i].is_blocked, response[i].temp_blocked];
window.bookingResponse[dateString] = [response[i].morningSlot, response[i].eveningSlot, response[i].is_blocked];
} }
initializeDatepickerWithColors(hall_id); initializeDatepickerWithColors(hall_id);
@ -2923,66 +2759,6 @@
}); });
} }
function connectToWebSocket(hall_id) {
//console.log("Connecting to WebSocket for hall_id:", hall_id);
const socket = new SockJS('/ws');
const stompClient = Stomp.over(socket);
stompClient.connect({}, function () {
//console.log("Connected to WebSocket");
// Subscribe to the topic specific to the hall_id
const topic = `/topic/bookingCalendar/${hall_id}`;
//console.log("Subscribing to topic:", topic);
stompClient.subscribe(topic, function (message) {
//console.log("Message received for hall_id:", hall_id, message);
try {
const response = JSON.parse(message.body); // Parse the response
processBookingData(response, hall_id); // Process and update the calendar
} catch (error) {
console.error("Failed to parse message body: ", error);
}
});
// Request initial data for the hall
requestBookingData(hall_id, stompClient);
}, function (error) {
// console.error("WebSocket connection failed: ", error);
});
}
function requestBookingData(hall_id, stompClient) {
//console.log("Requesting booking data for hall_id:", hall_id);
// Send hall_id as a JSON object
stompClient.send('/app/getPastData', {}, JSON.stringify({hall_id: hall_id}));
}
function processBookingData(response, hall_id) {
//console.log("Processing booking data for hall_id:", hall_id);
//console.log("Response: ", response);
window.bookingResponse = {};
if (response && Array.isArray(response)) {
$("#startDateInput").datepicker("destroy");
for (let i = 0; i < response.length; i++) {
const dateString = datepickerFormat(response[i].bdate);
window.bookingResponse[dateString] = [
response[i].morningSlot,
response[i].eveningSlot,
response[i].is_blocked,
response[i].temp_blocked,
];
}
initializeDatepickerWithColors(hall_id);
} else {
console.error("Invalid or empty response data.");
}
}
// Function to update the end date and slot availability // Function to update the end date and slot availability
function updateEndDate() { function updateEndDate() {
var startDate = new Date(document.getElementById("startDateInput").value); var startDate = new Date(document.getElementById("startDateInput").value);
@ -3253,72 +3029,135 @@
}); });
function initializeDatepickerWithColors(hallId) { function initializeDatepickerWithColors(hallId) {
//console.log("Initializing Datepicker with hallId:", hallId); // Confirm hallId is passed here
// Destroy existing datepicker to avoid duplicate initialization
$("#datepicker-container").datepicker("destroy"); $("#datepicker-container").datepicker("destroy");
// Initialize the datepicker
$("#startDateInput,#datepicker-container").datepicker({ $("#startDateInput,#datepicker-container").datepicker({
dateFormat: "yy-mm-dd", dateFormat: "yy-mm-dd",
minDate: "+7D",
minDate: 0,
maxDate: "+6M", maxDate: "+6M",
beforeShowDay: function (eDate) { beforeShowDay: function (eDate) {
var today = new Date();
var minDate = new Date();
minDate.setDate(today.getDate() + 6);
const dateString = $.datepicker.formatDate("yy-mm-dd", eDate);
const bookingStatus = window.bookingResponse[dateString] || {};
var dateString = $.datepicker.formatDate("yy-mm-dd", eDate);
var bookingStatus = window.bookingResponse[dateString];
const currentDate = new Date();
currentDate.setHours(0, 0, 0, 0); // Normalize current date to midnight
eDate.setHours(0, 0, 0, 0); // Normalize selected date to midnight
if (eDate < minDate) {
// Dates within the disabled range
// Logic for other dates
if (eDate < currentDate) {
return [false, "highlight-disabled", "Slot not Available"]; return [false, "highlight-disabled", "Slot not Available"];
} }
if (bookingStatus) {
if (bookingStatus[2] === true) {
return [true, "highlight-blue disabled", "GCC Blocked"];
} else if (bookingStatus[3] === true) {
return [true, "highlight-lightpink disabled", "Temporary Blocked"]
} else if (bookingStatus[0] === false && bookingStatus[1] === false) {
return [true, "highlight-greens", "Slot Available"];
} else if (bookingStatus[0] === true && bookingStatus[1] === true) {
return [true, "highlight-pink disabled", "Slot Occupied"];
} else if (bookingStatus[0] === true && bookingStatus[1] === false) {
return [true, "highlight-yellow", "Evening Slot Available"];
} else if (bookingStatus[0] === false && bookingStatus[1] === true) {
return [true, "highlight-violet", "Only Morning Slot Available"];
const isToday = eDate.getTime() === currentDate.getTime();
const currentHour = new Date().getHours();
const isBefore6AM = currentHour < 6;
const isAfter2PM = currentHour >= 14;
// Block 3-day logic for specific event types
const today = new Date();
const blockedDate = new Date(today);
blockedDate.setDate(today.getDate() + 2);
if (eDate <= blockedDate && window.isThreeDayBlock) {
return [false, "highlight-disabled", "Blocked due to event type"];
}
// Logic for today
if (isToday) {
if (isBefore6AM) {
// Before 6 AM: Allow full-day booking or adjust based on booking status
return handleBookingStatus(bookingStatus, "Full Day Available");
} else if (isAfter2PM) {
// After 2 PM: Block all bookings
return handleAfter2PM(bookingStatus);
} else {
// Between 6 AM and 2 PM: Check status and disable morning slots
return handleMorningSlots(bookingStatus);
} }
} }
return [true, "highlight-greens", "Slot Available"];
return handleBookingStatus(bookingStatus, "Slot Available");
}, },
}); });
$('#selecthall').on('click', function () {
// Show datepicker when hall is selected
$('#selecthall').off('click').on('click', function () {
$('#datepicker-container').datepicker('show'); $('#datepicker-container').datepicker('show');
}); });
// Handle changes in the start date input
$("#startDateInput").on("change", function () { $("#startDateInput").on("change", function () {
var selectedDate = $(this).val();
const selectedDate = $(this).val();
const bookingStatus = window.bookingResponse[selectedDate] || {};
const currentDate = new Date();
const currentHours = currentDate.getHours();
const currentDateString = currentDate.toISOString().split("T")[0];
$("#startPeriodDropdown").val(0).prop("disabled", false); $("#startPeriodDropdown").val(0).prop("disabled", false);
$("#endPeriodDropdown").val(0).prop("disabled", false); $("#endPeriodDropdown").val(0).prop("disabled", false);
$("#numDaysCount").val(''); $("#numDaysCount").val('');
validateForm(); validateForm();
var bookingStatus = window.bookingResponse[selectedDate];
if (bookingStatus) {
if (bookingStatus[0]) {
$("#startPeriodDropdown").val(2);
$("#startPeriodDropdown").prop("disabled", true);
} else if (bookingStatus[1]) {
$("#startPeriodDropdown").val(1);
$("#startPeriodDropdown").prop("disabled", true);
}
} else {
$("#startPeriodDropdown").prop("disabled", false);
if (selectedDate === currentDateString && currentHours >= 6) {
$("#startPeriodDropdown").val(2).prop("disabled", true);
} else if (bookingStatus[0]) {
$("#startPeriodDropdown").val(2).prop("disabled", true);
} else if (bookingStatus[1]) {
$("#startPeriodDropdown").val(1).prop("disabled", true);
} }
updateEndDate(selectedDate); updateEndDate(selectedDate);
}); });
// Event type change logic
$("#reasonforbooking").on("change", function () {
const selectedEventType = $(this).find("option:selected").text().trim();
window.isThreeDayBlock = ["Commercial", "State Govt Event", "Central Govt Event"].includes(selectedEventType);
$("#datepicker-container").datepicker("refresh");
});
} }
function handleBookingStatus(bookingStatus, defaultMessage) {
if (bookingStatus[2]) {
return [true, "highlight-blue disabled", "GCC Blocked"];
} else if (bookingStatus[3]) {
return [true, "highlight-lightpink disabled", "Temporary Blocked"];
} else if (bookingStatus[0] && bookingStatus[1]) {
return [true, "highlight-pink disabled", "Slot Occupied"];
} else if (bookingStatus[0] && !bookingStatus[1]) {
return [true, "highlight-yellow", "Evening Slot Available"];
} else if (!bookingStatus[0] && bookingStatus[1]) {
return [true, "highlight-violet", "Only Morning Slot Available"];
}
return [true, "highlight-greens", defaultMessage];
}
// Helper function: Handles logic after 2 PM
function handleAfter2PM(bookingStatus) {
if (bookingStatus[2]) {
return [true, "highlight-blue disabled", "GCC Blocked"];
} else if (bookingStatus[0] || bookingStatus[1]) {
return [true, "highlight-pink disabled", "Slot Occupied"];
}
return [false, "highlight-disabled", "Not Allowed to Book"];
}
// Helper function: Handles morning slots between 6 AM and 2 PM
function handleMorningSlots(bookingStatus) {
if (bookingStatus[2]) {
return [true, "highlight-blue disabled", "GCC Blocked"];
} else if (bookingStatus[0] && bookingStatus[1]) {
return [true, "highlight-pink disabled", "Slot Occupied"];
} else if (bookingStatus[0] && !bookingStatus[1]) {
return [true, "highlight-yellow", "Evening Slot Available"];
} else if (!bookingStatus[0] && bookingStatus[1]) {
return [false, "highlight-disabled", "Slot Occupied"];
}
return [true, "highlight-yellow", "Evening Slot Available"];
}
function datepickerFormat(dateString) { function datepickerFormat(dateString) {
var dateObject = new Date(dateString); var dateObject = new Date(dateString);
var year = dateObject.getFullYear(); var year = dateObject.getFullYear();
@ -3376,6 +3215,7 @@
$("#startDateInput")[0].setCustomValidity(""); // Clear custom validity if valid $("#startDateInput")[0].setCustomValidity(""); // Clear custom validity if valid
} }
}); });
$("#reasonforbooking").on("change", function () { $("#reasonforbooking").on("change", function () {
// Clear custom validity when a valid value is selected // Clear custom validity when a valid value is selected
this.setCustomValidity(""); this.setCustomValidity("");
@ -3465,39 +3305,22 @@
} }
} }
function validateStep3Fields() {
var valid = true;
// Confirm Payment button click event
$("#confirmPaymentBtn").on('click', function () {
// Disable the payment button
$('#confirmPaymentBtn').prop('disabled', true);
// Validate required text inputs and selects
$('.step-3 input[required], .step-3 select[required]').each(function () {
if ($(this).val() === '') {
$(this).addClass('error'); // Highlight error
valid = false;
return false; // Exit the loop
} else {
$(this).removeClass('error'); // Remove error class
}
});
// Validate required file inputs
$('.step-3 input[type="file"][required]').each(function () {
if ($(this)[0].files.length === 0) {
$(this).addClass('error'); // Highlight error
valid = false;
return false;
} else {
$(this).removeClass('error'); // Remove error class
}
});
stopTimer();
return valid;
}
window.addEventListener("beforeunload", function () {
localStorage.removeItem("bcid"); // Clear temp block when the page unloads
}); });
function stopTimer() {
if (countdown) {
clearInterval(countdown);
countdown = null; // Clear the countdown reference
}
timerElement.innerHTML = "Timer Stopped"; // Optionally update the message
}
</script> </script>
</body> </body>
</div> </div>

212
src/main/resources/templates/user/viewhallform.html

@ -4,6 +4,10 @@
<head th:replace="~{fragments/head :: head}"></head> <head th:replace="~{fragments/head :: head}"></head>
<script src="https://cdn.jsdelivr.net/npm/compressorjs@5.0.3/dist/compressor.js"></script> <script src="https://cdn.jsdelivr.net/npm/compressorjs@5.0.3/dist/compressor.js"></script>
<script src="https://cdn.jsdelivr.net/npm/sockjs-client"></script>
<!--<script src="https://cdn.jsdelivr.net/npm/stompjs"></script>-->
<script src="https://cdn.jsdelivr.net/npm/stompjs@2.3.3/lib/stomp.min.js"></script>
<style> <style>
.table-align { .table-align {
width: 100%; width: 100%;
@ -970,6 +974,17 @@
opacity: 0; opacity: 0;
} }
} }
.highlight-blue .ui-state-default {
background: blue !important;
color: #FFF !important;
}
.highlight-blue a {
background-color: blue;
color: white;
}
</style> </style>
<body> <body>
@ -1127,12 +1142,12 @@
<span style="margin-left: 14px;">Gcc <span style="margin-left: 14px;">Gcc
Blocked</span> Blocked</span>
</div> </div>
<div class="col col-lg-2 col-sm-2 col-md-2">
<!--<div class="col col-lg-2 col-sm-2 col-md-2">
<button type="button" <button type="button"
class="btn btn-primary btn-square-md" class="btn btn-primary btn-square-md"
style="background-color: lightpink"></button> style="background-color: lightpink"></button>
<span style="margin-left:-2px;">Temporary Blocked</span> <span style="margin-left:-2px;">Temporary Blocked</span>
</div>
</div>-->
</div> </div>
</div> </div>
<br> <br>
@ -1349,6 +1364,7 @@
initializeViewerJS(); initializeViewerJS();
getBookingCalendar(hallId); getBookingCalendar(hallId);
//connectToWebSocket(hallId);
// Set hall details in Step 2 and Step 3 // Set hall details in Step 2 and Step 3
$('#hallNameDisplayStep2').text(response.hallName); $('#hallNameDisplayStep2').text(response.hallName);
@ -1421,7 +1437,7 @@
$("#startDateInput").datepicker("destroy"); $("#startDateInput").datepicker("destroy");
for (var i = 0; i < response.length; i++) { for (var i = 0; i < response.length; i++) {
var dateString = datepickerFormat(response[i].bdate); var dateString = datepickerFormat(response[i].bdate);
window.bookingResponse[dateString] = [response[i].morningSlot, response[i].eveningSlot, response[i].is_blocked, response[i].temp_blocked];
window.bookingResponse[dateString] = [response[i].morningSlot, response[i].eveningSlot, response[i].is_blocked];
} }
initializeDatepickerWithColors(hall_id); initializeDatepickerWithColors(hall_id);
@ -1438,52 +1454,194 @@
}); });
} }
/*function connectToWebSocket(hall_id) {
//console.log("Connecting to WebSocket for hall_id:", hall_id);
const socket = new SockJS('/ws');
const stompClient = Stomp.over(socket);
stompClient.connect({}, function () {
//console.log("Connected to WebSocket");
// Subscribe to the topic specific to the hall_id
const topic = `/topic/bookingCalendar/${hall_id}`;
stompClient.subscribe(topic, function (message) {
try {
const response = JSON.parse(message.body); // Parse the response
processBookingData(response, hall_id); // Process and update the calendar
} catch (error) {
console.error("Failed to parse message body: ", error);
}
});
// Request initial data for the hall
requestBookingData(hall_id, stompClient);
}, function (error) {
// console.error("WebSocket connection failed: ", error);
});
}
function requestBookingData(hall_id, stompClient) {
//console.log("Requesting booking data for hall_id:", hall_id);
// Send hall_id as a JSON object
stompClient.send('/app/getPastData', {}, JSON.stringify({hall_id: hall_id}));
}
function processBookingData(response, hall_id) {
//console.log("Processing booking data for hall_id:", hall_id);
//console.log("Response: ", response);
window.bookingResponse = {};
if (response && Array.isArray(response)) {
$("#startDateInput").datepicker("destroy");
for (let i = 0; i < response.length; i++) {
const dateString = datepickerFormat(response[i].bdate);
window.bookingResponse[dateString] = [
response[i].morningSlot,
response[i].eveningSlot,
response[i].is_blocked,
response[i].temp_blocked,
];
}
initializeDatepickerWithColors(hall_id);
} else {
console.error("Invalid or empty response data.");
}
}*/
// Function to update the end date and slot availability // Function to update the end date and slot availability
function initializeDatepickerWithColors(hallId) { function initializeDatepickerWithColors(hallId) {
//console.log("Initializing Datepicker with hallId:", hallId); // Confirm hallId is passed here
// Destroy existing datepicker to avoid duplicate initialization
$("#datepicker-container").datepicker("destroy"); $("#datepicker-container").datepicker("destroy");
// Initialize the datepicker
$("#startDateInput,#datepicker-container").datepicker({ $("#startDateInput,#datepicker-container").datepicker({
dateFormat: "yy-mm-dd", dateFormat: "yy-mm-dd",
minDate: "+7D",
minDate: 0,
maxDate: "+6M", maxDate: "+6M",
beforeShowDay: function (eDate) { beforeShowDay: function (eDate) {
var today = new Date();
var minDate = new Date();
minDate.setDate(today.getDate() + 6);
const dateString = $.datepicker.formatDate("yy-mm-dd", eDate);
const bookingStatus = window.bookingResponse[dateString] || {};
var dateString = $.datepicker.formatDate("yy-mm-dd", eDate);
var bookingStatus = window.bookingResponse[dateString];
const currentDate = new Date();
currentDate.setHours(0, 0, 0, 0); // Normalize current date to midnight
eDate.setHours(0, 0, 0, 0); // Normalize selected date to midnight
if (eDate < minDate) {
// Dates within the disabled range
// Logic for other dates
if (eDate < currentDate) {
return [false, "highlight-disabled", "Slot not Available"]; return [false, "highlight-disabled", "Slot not Available"];
} }
if (bookingStatus) {
if (bookingStatus[2] === true) {
return [true, "highlight-blue", "GCC Blocked"];
} else if (bookingStatus[3] === true) {
return [true, "highlight-lightpink disabled", "Temporary Blocked"]
} else if (bookingStatus[0] === false && bookingStatus[1] === false) {
return [true, "highlight-greens", "Slot Available"];
} else if (bookingStatus[0] === true && bookingStatus[1] === true) {
return [true, "highlight-pink disabled", "Slot Occupied"];
} else if (bookingStatus[0] === true && bookingStatus[1] === false) {
return [true, "highlight-yellow", "Evening Slot Available"];
} else if (bookingStatus[0] === false && bookingStatus[1] === true) {
return [true, "highlight-violet", "Only Morning Slot Available"];
const isToday = eDate.getTime() === currentDate.getTime();
const currentHour = new Date().getHours();
const isBefore6AM = currentHour < 6;
const isAfter2PM = currentHour >= 14;
// Block 3-day logic for specific event types
const today = new Date();
const blockedDate = new Date(today);
blockedDate.setDate(today.getDate() + 2);
if (eDate <= blockedDate && window.isThreeDayBlock) {
return [false, "highlight-disabled", "Blocked due to event type"];
}
// Logic for today
if (isToday) {
if (isBefore6AM) {
// Before 6 AM: Allow full-day booking or adjust based on booking status
return handleBookingStatus(bookingStatus, "Full Day Available");
} else if (isAfter2PM) {
// After 2 PM: Block all bookings
return handleAfter2PM(bookingStatus);
} else {
// Between 6 AM and 2 PM: Check status and disable morning slots
return handleMorningSlots(bookingStatus);
} }
} }
return [true, "highlight-greens", "Slot Available"];
return handleBookingStatus(bookingStatus, "Slot Available");
}, },
}); });
$('#selecthall').on('click', function () {
// Show datepicker when hall is selected
$('#selecthall').off('click').on('click', function () {
$('#datepicker-container').datepicker('show'); $('#datepicker-container').datepicker('show');
}); });
// Handle changes in the start date input
$("#startDateInput").on("change", function () {
const selectedDate = $(this).val();
const bookingStatus = window.bookingResponse[selectedDate] || {};
const currentDate = new Date();
const currentHours = currentDate.getHours();
const currentDateString = currentDate.toISOString().split("T")[0];
$("#startPeriodDropdown").val(0).prop("disabled", false);
$("#endPeriodDropdown").val(0).prop("disabled", false);
$("#numDaysCount").val('');
validateForm();
if (selectedDate === currentDateString && currentHours >= 6) {
$("#startPeriodDropdown").val(2).prop("disabled", true);
} else if (bookingStatus[0]) {
$("#startPeriodDropdown").val(2).prop("disabled", true);
} else if (bookingStatus[1]) {
$("#startPeriodDropdown").val(1).prop("disabled", true);
}
updateEndDate(selectedDate);
});
// Event type change logic
$("#reasonforbooking").on("change", function () {
const selectedEventType = $(this).find("option:selected").text().trim();
window.isThreeDayBlock = ["Commercial", "State Govt Event", "Central Govt Event"].includes(selectedEventType);
$("#datepicker-container").datepicker("refresh");
});
}
function handleBookingStatus(bookingStatus, defaultMessage) {
if (bookingStatus[2]) {
return [true, "highlight-blue disabled", "GCC Blocked"];
} else if (bookingStatus[3]) {
return [true, "highlight-lightpink disabled", "Temporary Blocked"];
} else if (bookingStatus[0] && bookingStatus[1]) {
return [true, "highlight-pink disabled", "Slot Occupied"];
} else if (bookingStatus[0] && !bookingStatus[1]) {
return [true, "highlight-yellow", "Evening Slot Available"];
} else if (!bookingStatus[0] && bookingStatus[1]) {
return [true, "highlight-violet", "Only Morning Slot Available"];
}
return [true, "highlight-greens", defaultMessage];
}
// Helper function: Handles logic after 2 PM
function handleAfter2PM(bookingStatus) {
if (bookingStatus[2]) {
return [true, "highlight-blue disabled", "GCC Blocked"];
} else if (bookingStatus[0] || bookingStatus[1]) {
return [true, "highlight-pink disabled", "Slot Occupied"];
}
return [false, "highlight-disabled", "Not Allowed to Book"];
}
// Helper function: Handles morning slots between 6 AM and 2 PM
function handleMorningSlots(bookingStatus) {
if (bookingStatus[2]) {
return [true, "highlight-blue disabled", "GCC Blocked"];
} else if (bookingStatus[0] && bookingStatus[1]) {
return [false, "highlight-pink disabled", "Slot Occupied"];
} else if (bookingStatus[0] && !bookingStatus[1]) {
return [true, "highlight-yellow", "Evening Slot Available"];
} else if (!bookingStatus[0] && bookingStatus[1]) {
return [false, "highlight-disabled", "Slot Occupied"];
}
return [true, "highlight-yellow", "Evening Slot Available"];
} }
function datepickerFormat(dateString) { function datepickerFormat(dateString) {

216
src/main/resources/templates/user/viewhistory.html

@ -115,30 +115,6 @@
color: #000 !important; color: #000 !important;
} }
.highlight-blue .ui-state-default {
background: blue !important;
color: #FFF !important;
}
.highlight-lightpink .ui-state-default {
background: lightpink !important;
color: #FFF !important;
}
.highlight-lightpink a,
input[type=button]:disabled {
background-color: lightpink;
/* Pink highlight for disabled or booked dates */
color: white;
}
.highlight-blue a,
input[type=button]:disabled {
background-color: blue;
/* Pink highlight for disabled or booked dates */
color: white;
}
.form-control[readonly] { .form-control[readonly] {
background-color: white; background-color: white;
} }
@ -635,7 +611,7 @@
<td <td
th:text="${booking.ending_slot == 1 ? 'morning' : (booking.ending_slot == 2 ? 'evening' : '')}"> th:text="${booking.ending_slot == 1 ? 'morning' : (booking.ending_slot == 2 ? 'evening' : '')}">
</td> </td>
<td th:text="${booking.reason}"></td>
<td th:text="${booking.reason}" ></td>
<td <td
th:text="${#strings.replace(booking.booking_status, '_', ' ')}"> th:text="${#strings.replace(booking.booking_status, '_', ' ')}">
</td> </td>
@ -697,11 +673,25 @@
NOC</span> NOC</span>
</a> </a>
</p> </p>
<!--<p th:case="'noaction'">
<a class="view-button">
<span>&#45;&#45;No Action&#45;&#45;</span>
</a>
</p>-->
<p th:case="'noaction'"> <p th:case="'noaction'">
<a class="view-button"> <a class="view-button">
<span>--No Action--</span>
<a class="view-button"
th:if="${booking.booking_status == 'APPROVED'}">
<span class="badge bg-danger"
style="cursor: pointer;"
th:onclick="cancelBooking([[${booking.booking_id}]], [[${booking.mobile_no}]], [[${booking.booking_type}]])">Cancel
Booking</span>
</a>
</a> </a>
</p> </p>
<p th:case="''"> <p th:case="''">
<a class="view-button"> <a class="view-button">
<span>--No Action--</span> <span>--No Action--</span>
@ -719,7 +709,8 @@
th:if="${booking.booking_status == 'APPROVED'}"> th:if="${booking.booking_status == 'APPROVED'}">
<span class="badge bg-danger" <span class="badge bg-danger"
style="cursor: pointer;" style="cursor: pointer;"
th:onclick="openRescheduleModal([[${booking.booking_id}]], [[${booking.start_date}]], [[${booking.end_date}]],[[${booking.no_of_days}]],[[${booking.hall_details_hall_id}]],[[${booking.starting_slot}]],[[${booking.ending_slot}]])">Reschedule
th:onclick="openRescheduleModal([[${booking.booking_id}]], [[${booking.start_date}]], [[${booking.end_date}]],[[${booking.no_of_days}]],
[[${booking.hall_details_hall_id}]],[[${booking.starting_slot}]],[[${booking.ending_slot}]],[[${booking.reason}]])">Reschedule
Booking</span> Booking</span>
</a> </a>
</p> </p>
@ -1094,7 +1085,7 @@
style="padding: 0.45rem 0.45rem; color: green;" style="padding: 0.45rem 0.45rem; color: green;"
id="td_pending_amt">0</td> id="td_pending_amt">0</td>
</tr> </tr>
<tr id="collectionstatuscolumn">
<tr id="collectionstatuscolumn">
<th id="label" <th id="label"
style="padding: 0.45rem 0.45rem;font-weight: normal">Collection Pending Status style="padding: 0.45rem 0.45rem;font-weight: normal">Collection Pending Status
:</th> :</th>
@ -1211,7 +1202,7 @@
</div> </div>
</div> </div>
<div class="modal fade" id="bookingRescheduleModal" tabindex="-1" <div class="modal fade" id="bookingRescheduleModal" tabindex="-1"
aria-labelledby="bookingModalLabel" aria-hidden="true">
aria-labelledby="bookingModalLabel" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered modal-lg"> <div class="modal-dialog modal-dialog-centered modal-lg">
<div class="modal-content"> <div class="modal-content">
<!-- Modal Header --> <!-- Modal Header -->
@ -1226,7 +1217,7 @@
changed.</p> changed.</p>
</div> </div>
<button type="button" class="btn-close" data-bs-dismiss="modal" <button type="button" class="btn-close" data-bs-dismiss="modal"
aria-label="Close"></button>
aria-label="Close"></button>
</div> </div>
<!-- Modal Body --> <!-- Modal Body -->
@ -1239,22 +1230,22 @@
<!-- Start Date, End Date, Number of Days Inputs Column --> <!-- Start Date, End Date, Number of Days Inputs Column -->
<div class="col"> <div class="col">
<input type="hidden" class="form-control" id="bookingId" <input type="hidden" class="form-control" id="bookingId"
name="bookingId" required>
name="bookingId" required>
<label for="startDateInput" class="form-label">Start Date:</label> <label for="startDateInput" class="form-label">Start Date:</label>
<input type="text" class="form-control" id="startDateInput" <input type="text" class="form-control" id="startDateInput"
name="startDateInput" required>
name="startDateInput" required>
<input type="hidden" class="form-control" id="startDatetext" <input type="hidden" class="form-control" id="startDatetext"
name="startDatetext" required>
name="startDatetext" required>
</div> </div>
<div class="col"> <div class="col">
<label for="endDateInput" class="form-label">End Date:</label> <label for="endDateInput" class="form-label">End Date:</label>
<input type="date" class="form-control" id="endDateInput" <input type="date" class="form-control" id="endDateInput"
name="endDateInput" readonly>
name="endDateInput" readonly>
</div> </div>
<div class="col"> <div class="col">
<label for="noOfDaysInput" class="form-label">Number of Days:</label> <label for="noOfDaysInput" class="form-label">Number of Days:</label>
<input type="number" class="form-control" id="noOfDaysInput" <input type="number" class="form-control" id="noOfDaysInput"
name="noOfDaysInput" readonly>
name="noOfDaysInput" readonly>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
@ -1262,37 +1253,37 @@
<input type="hidden" id="daysDiff"> <input type="hidden" id="daysDiff">
<label for="startingSlot" class="form-label">Starting Slot:</label> <label for="startingSlot" class="form-label">Starting Slot:</label>
<input type="text" class="form-control" id="startingSlotText" <input type="text" class="form-control" id="startingSlotText"
name="startingSlot" readonly>
name="startingSlot" readonly>
<input type="hidden" class="form-control" id="startingSlot" <input type="hidden" class="form-control" id="startingSlot"
name="startingSlot" required>
name="startingSlot" required>
</div> </div>
<div class="col"> <div class="col">
<label for="endingSlot" class="form-label">Ending Slot:</label> <label for="endingSlot" class="form-label">Ending Slot:</label>
<input type="text" class="form-control" id="endingSlotText" <input type="text" class="form-control" id="endingSlotText"
name="endDateInput" readonly>
name="endDateInput" readonly>
<input type="hidden" class="form-control" id="endingSlot" <input type="hidden" class="form-control" id="endingSlot"
name="endDateInput" readonly>
name="endDateInput" readonly>
</div> </div>
</div> </div>
<div class="row" style="margin-top: 39px;"> <div class="row" style="margin-top: 39px;">
<div class="col col-lg-2 col-sm-2 col-md-2"> <div class="col col-lg-2 col-sm-2 col-md-2">
<button type="button" class="btn btn-primary btn-square-md" <button type="button" class="btn btn-primary btn-square-md"
style="background-color:#008000;"></button>
style="background-color:#008000;"></button>
<p style="margin-left: 14px;">Day<br>(Available)</p> <p style="margin-left: 14px;">Day<br>(Available)</p>
</div> </div>
<div class="col col-lg-2 col-sm-2 col-md-2"> <div class="col col-lg-2 col-sm-2 col-md-2">
<button type="button" class="btn btn-primary btn-square-md" <button type="button" class="btn btn-primary btn-square-md"
style="background-color: #ac2bac;"></button>
style="background-color: #ac2bac;"></button>
<p style="margin-left: 14px;">Morning<br>(Available)</p> <p style="margin-left: 14px;">Morning<br>(Available)</p>
</div> </div>
<div class="col col-lg-2 col-sm-2 col-md-2"> <div class="col col-lg-2 col-sm-2 col-md-2">
<button type="button" class="btn btn-primary btn-square-md" <button type="button" class="btn btn-primary btn-square-md"
style="background-color:#FFEA00;"></button>
style="background-color:#FFEA00;"></button>
<p style="margin-left: 14px;">Evening<br>(Available)</p> <p style="margin-left: 14px;">Evening<br>(Available)</p>
</div> </div>
<div class="col col-lg-2 col-sm-2 col-md-2"> <div class="col col-lg-2 col-sm-2 col-md-2">
<button type="button" class="btn btn-primary btn-square-md" <button type="button" class="btn btn-primary btn-square-md"
style="background-color: red;"></button>
style="background-color: red;"></button>
<p style="margin-left: 14px;">Not Available</p> <p style="margin-left: 14px;">Not Available</p>
</div> </div>
<div class="col col-lg-2 col-sm-2 col-md-2"> <div class="col col-lg-2 col-sm-2 col-md-2">
@ -1300,20 +1291,22 @@
style="background-color: blue;"></button> style="background-color: blue;"></button>
<p style="margin-left: 14px;">GCC Blocked</p> <p style="margin-left: 14px;">GCC Blocked</p>
</div> </div>
<div class="col col-lg-2 col-sm-2 col-md-2">
<!--<div class="col col-lg-2 col-sm-2 col-md-2">
<button type="button" class="btn btn-primary btn-square-md" <button type="button" class="btn btn-primary btn-square-md"
style="background-color: lightpink;"></button> style="background-color: lightpink;"></button>
<p style="margin-left: 14px;">Temporary Blocked</p> <p style="margin-left: 14px;">Temporary Blocked</p>
</div>
</div>-->
</div> </div>
</div> </div>
</div> </div>
<!-- Modal Footer --> <!-- Modal Footer -->
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-secondary" <button type="button" class="btn btn-secondary"
data-bs-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary" onclick="Reschedule()">Save
Changes</button>
data-bs-dismiss="modal">Close
</button>
<button type="button" class="btn btn-primary" onclick="Reschedule()" >Save
Changes
</button>
</div> </div>
</div> </div>
</div> </div>
@ -1385,8 +1378,8 @@
<thead> <thead>
<tr> <tr>
<th>S.NO</th> <th>S.NO</th>
<th>Booking ID</th>
<th>Amount</th>
<th>Booking ID</th>
<th>Amount</th>
<th>Date</th> <th>Date</th>
<th>Transaction ID</th> <th>Transaction ID</th>
<th>Status</th> <th>Status</th>
@ -1871,7 +1864,7 @@
var temp_total = parseFloat($("#td_settel_amt").html()); var temp_total = parseFloat($("#td_settel_amt").html());
var settleAmount = temp_total - totalAmount; var settleAmount = temp_total - totalAmount;
if (settleAmount < 0) {
if (settleAmount < 0) {
var pendingstatus=data.settlement.collectionStatus var pendingstatus=data.settlement.collectionStatus
$("#td_settel_amt").html(0.00); $("#td_settel_amt").html(0.00);
$("#pendingcolumn").show(); $("#pendingcolumn").show();
@ -1884,7 +1877,7 @@
$("#pendingcolumn").hide(); $("#pendingcolumn").hide();
$("#collectionstatuscolumn").hide(); $("#collectionstatuscolumn").hide();
$("#td_settel_amt").css("color", "green"); // Set color to green for positive amounts $("#td_settel_amt").css("color", "green"); // Set color to green for positive amounts
}
}
} }
@ -2031,7 +2024,7 @@
}); });
} }
} }
function openRescheduleModal(bookingId, startDate, endDate, noOfDays, hallId, startingSlot, endingSlot) {
function openRescheduleModal(bookingId, startDate, endDate, noOfDays, hallId, startingSlot, endingSlot, reason) {
// Function to map slot values to their text representation // Function to map slot values to their text representation
function getSlotText(slot) { function getSlotText(slot) {
return slot === 1 ? 'Morning' : 'Evening'; return slot === 1 ? 'Morning' : 'Evening';
@ -2060,14 +2053,14 @@
document.getElementById("endingSlotText").value = getSlotText(endingSlot); document.getElementById("endingSlotText").value = getSlotText(endingSlot);
// Optionally, fetch and update calendar or availability based on hallId // Optionally, fetch and update calendar or availability based on hallId
getBookingCalendar(hallId);
getBookingCalendar(hallId, reason);
// Show the modal // Show the modal
$('#bookingRescheduleModal').modal('show'); $('#bookingRescheduleModal').modal('show');
} }
function getBookingCalendar(hall_id) {
function getBookingCalendar(hall_id, reason) {
// Make an AJAX call to fetch booking data // Make an AJAX call to fetch booking data
$.ajax({ $.ajax({
type: 'GET', type: 'GET',
@ -2082,12 +2075,12 @@
$("#startDateInput").datepicker("destroy"); $("#startDateInput").datepicker("destroy");
for (var i = 0; i < response.length; i++) { for (var i = 0; i < response.length; i++) {
var dateString = datepickerFormat(response[i].bdate); var dateString = datepickerFormat(response[i].bdate);
window.bookingResponse[dateString] = [response[i].morningSlot, response[i].eveningSlot, response[i].is_blocked, response[i].temp_blocked ];
window.bookingResponse[dateString] = [response[i].morningSlot, response[i].eveningSlot];
} }
initializeDatepickerWithColors(hall_id);
initializeDatepickerWithColors(hall_id, reason);
if (response.length == 0) { if (response.length == 0) {
initializeDatepickerWithColors(hall_id);
initializeDatepickerWithColors(hall_id, reason);
} }
} else { } else {
console.error('Invalid or empty response data.'); console.error('Invalid or empty response data.');
@ -2098,42 +2091,57 @@
} }
}); });
} }
function initializeDatepickerWithColors(hallId) { // Confirm hallId is passed here
function initializeDatepickerWithColors(hallId, reason) { // Confirm hallId is passed here
$("#datepicker-container").datepicker("destroy"); $("#datepicker-container").datepicker("destroy");
$("#startDateInput,#datepicker-container").datepicker({ $("#startDateInput,#datepicker-container").datepicker({
dateFormat: "yy-mm-dd", dateFormat: "yy-mm-dd",
minDate: "+7D",
minDate:0,
maxDate: "+6M", maxDate: "+6M",
beforeShowDay: function (eDate) { beforeShowDay: function (eDate) {
var today = new Date();
var minDate = new Date();
minDate.setDate(today.getDate() + 6);
var dateString = $.datepicker.formatDate("yy-mm-dd", eDate);
var bookingStatus = window.bookingResponse[dateString];
const dateString = $.datepicker.formatDate("yy-mm-dd", eDate);
const bookingStatus = window.bookingResponse[dateString] || {};
if (eDate < minDate) {
// Dates within the disabled range
const currentDate = new Date();
currentDate.setHours(0, 0, 0, 0); // Normalize current date to midnight
eDate.setHours(0, 0, 0, 0); // Normalize selected date to midnight
// Logic for other dates
if (eDate < currentDate) {
return [false, "highlight-disabled", "Slot not Available"]; return [false, "highlight-disabled", "Slot not Available"];
} }
if (bookingStatus) {
if (bookingStatus[2] === true) {
return [true, "highlight-blue disabled", "GCC Blocked"];
} else if (bookingStatus[3] === true) {
return [true, "highlight-lightpink disabled", "Temporary Blocked"]
}else if (bookingStatus[0] === false && bookingStatus[1] === false) {
return [true, "highlight-greens", "Slot Available"];
} else if (bookingStatus[0] === true && bookingStatus[1] === true) {
return [true, "highlight-pink disabled", "Slot Occupied"];
} else if (bookingStatus[0] === true && bookingStatus[1] === false) {
return [true, "highlight-yellow", "Evening Slot Available"];
} else if (bookingStatus[0] === false && bookingStatus[1] === true) {
return [true, "highlight-violet", "Only Morning Slot Available"];
const isToday = eDate.getTime() === currentDate.getTime();
const currentHour = new Date().getHours();
const isBefore6AM = currentHour < 6;
const isAfter2PM = currentHour >= 14;
// Block 3-day logic for specific event types
const today = new Date();
const blockedDate = new Date(today);
blockedDate.setDate(today.getDate() + 2);
const isThreeDayBlock = ["Commercial", "State Govt Event", "Central Govt Event"].includes(reason);
if (eDate <= blockedDate && isThreeDayBlock) {
return [false, "highlight-disabled", "Blocked due to event type"];
}
// Logic for currentdate
if (isToday) {
if (isBefore6AM) {
// Before 6 AM: Allow full-day booking or adjust based on booking status
return handleBookingStatus(bookingStatus, "Full Day Available");
} else if (isAfter2PM) {
// After 2 PM: Block all bookings
return handleAfter2PM(bookingStatus);
} else {
// Between 6 AM and 2 PM: Check status and disable morning slots
return handleMorningSlots(bookingStatus);
} }
} }
return [true, "highlight-greens", "Slot Available"];
return handleBookingStatus(bookingStatus, "Slot Available");
}, },
}); });
@ -2145,6 +2153,46 @@
var noofdays = document.getElementById("noOfDaysInput").value; var noofdays = document.getElementById("noOfDaysInput").value;
updateEndDate(selectedDate, noofdays, startingSlot, endingSlot); updateEndDate(selectedDate, noofdays, startingSlot, endingSlot);
}); });
}
function handleBookingStatus(bookingStatus, defaultMessage) {
if (bookingStatus[2]) {
return [true, "highlight-blue disabled", "GCC Blocked"];
} else if (bookingStatus[3]) {
return [true, "highlight-lightpink disabled", "Temporary Blocked"];
} else if (bookingStatus[0] && bookingStatus[1]) {
return [true, "highlight-pink disabled", "Slot Occupied"];
} else if (bookingStatus[0] && !bookingStatus[1]) {
return [true, "highlight-yellow", "Evening Slot Available"];
} else if (!bookingStatus[0] && bookingStatus[1]) {
return [true, "highlight-violet", "Only Morning Slot Available"];
}
return [true, "highlight-greens", defaultMessage];
}
// Helper function: Handles logic after 2 PM
function handleAfter2PM(bookingStatus) {
if (bookingStatus[2]) {
return [true, "highlight-blue disabled", "GCC Blocked"];
} else if (bookingStatus[0] || bookingStatus[1]) {
return [true, "highlight-pink disabled", "Slot Occupied"];
}
return [false, "highlight-disabled", "Not Allowed to Book"];
}
// Helper function: Handles morning slots between 6 AM and 2 PM
function handleMorningSlots(bookingStatus) {
if (bookingStatus[2]) {
return [true, "highlight-blue disabled", "GCC Blocked"];
} else if (bookingStatus[0] && bookingStatus[1]) {
return [true, "highlight-pink disabled", "Slot Occupied"];
} else if (bookingStatus[0] && !bookingStatus[1]) {
return [true, "highlight-yellow", "Evening Slot Available"];
} else if (!bookingStatus[0] && bookingStatus[1]) {
return [false, "highlight-disabled", "Slot Occupied"];
}
return [true, "highlight-yellow", "Evening Slot Available"];
} }
function updateEndDate(startDate, noofdays, startingSlot, endingSlot) { function updateEndDate(startDate, noofdays, startingSlot, endingSlot) {
@ -2592,14 +2640,14 @@ function toggleChat() {
function sendMessage() { function sendMessage() {
const userInput = document.getElementById('userInput'); const userInput = document.getElementById('userInput');
const message = userInput.value.trim(); const message = userInput.value.trim();
if (message) { if (message) {
// Create message element // Create message element
const chatBody = document.getElementById('chat-body'); const chatBody = document.getElementById('chat-body');
const userMessage = document.createElement('div'); const userMessage = document.createElement('div');
userMessage.className = 'user-message'; userMessage.className = 'user-message';
userMessage.textContent = message; userMessage.textContent = message;
chatBody.appendChild(userMessage); chatBody.appendChild(userMessage);
chatBody.scrollTop = chatBody.scrollHeight; // Auto-scroll to bottom chatBody.scrollTop = chatBody.scrollHeight; // Auto-scroll to bottom
@ -2617,7 +2665,7 @@ function sendMessage() {
const responseMessage = document.createElement('div'); const responseMessage = document.createElement('div');
responseMessage.className = 'bot-message'; responseMessage.className = 'bot-message';
responseMessage.textContent = data.response; responseMessage.textContent = data.response;
chatBody.appendChild(responseMessage); chatBody.appendChild(responseMessage);
chatBody.scrollTop = chatBody.scrollHeight; chatBody.scrollTop = chatBody.scrollHeight;
}); });

Loading…
Cancel
Save