Browse Source

Hall creation and Gcc Blocking(New) concept implemented in the Admin, HQ and officer login

master
KaNi-04 3 months ago
parent
commit
d73cb87a15
  1. 6
      .classpath
  2. 1
      .gitignore
  3. 2
      jwtToken.txt
  4. 93
      src/main/java/com/gcc/communityHall/controller/AdminAPIController.java
  5. 379
      src/main/java/com/gcc/communityHall/controller/Admincontroller.java
  6. 1502
      src/main/java/com/gcc/communityHall/controller/HQAPIController.java
  7. 74
      src/main/java/com/gcc/communityHall/controller/HeadquartersController.java
  8. 399
      src/main/java/com/gcc/communityHall/controller/OfficerAPIController.java
  9. 20
      src/main/java/com/gcc/communityHall/controller/OfficerController.java
  10. 58
      src/main/java/com/gcc/communityHall/controller/UserAPIController.java
  11. 28
      src/main/java/com/gcc/communityHall/entity/FloorDetails.java
  12. 2
      src/main/java/com/gcc/communityHall/entity/HallDetails.java
  13. 57
      src/main/java/com/gcc/communityHall/paymentService/repository/TransactionResponseRepository.java
  14. 28
      src/main/java/com/gcc/communityHall/repository/BookingCalendarRepository.java
  15. 3
      src/main/java/com/gcc/communityHall/repository/BookingDetailsRepository.java
  16. 20
      src/main/java/com/gcc/communityHall/repository/FloorDetailsRepository.java
  17. 17
      src/main/java/com/gcc/communityHall/repository/GccBlockingDateRepository.java
  18. 84
      src/main/java/com/gcc/communityHall/service/BookingService.java
  19. 35
      src/main/java/com/gcc/communityHall/service/HallDetailService.java
  20. 250
      src/main/java/com/gcc/communityHall/service/Impl/BookingServiceImpl.java
  21. 130
      src/main/java/com/gcc/communityHall/service/Impl/HallDetailServiceImpl.java
  22. 2
      src/main/resources/paymentConfig.properties
  23. 9
      src/main/resources/templates/admin/developer.html
  24. 1033
      src/main/resources/templates/admin/gccblocking-new.html
  25. 81
      src/main/resources/templates/admin/halldetailslist.html
  26. 1543
      src/main/resources/templates/admin/login-creation.html
  27. 19
      src/main/resources/templates/fragments/adminMenu.html
  28. 18
      src/main/resources/templates/fragments/headquartersMenu.html
  29. 6
      src/main/resources/templates/fragments/menuOfficer.html
  30. 1044
      src/main/resources/templates/headquarters/gccblocking-new.html
  31. 1862
      src/main/resources/templates/headquarters/halldetailslist.html
  32. 1154
      src/main/resources/templates/officer/gccblocking-new.html
  33. 23
      src/main/resources/templates/officiallogin.html
  34. 132
      src/main/resources/templates/user/hallbookingform.html
  35. 102
      src/main/resources/templates/user/viewhallform.html
  36. 47
      src/main/resources/templates/user/viewhistory.html

6
.classpath

@ -39,17 +39,11 @@
<classpathentry kind="src" path="target/generated-sources/annotations"> <classpathentry kind="src" path="target/generated-sources/annotations">
<attributes> <attributes>
<attribute name="optional" value="true"/> <attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="ignore_optional_problems" value="true"/>
<attribute name="m2e-apt" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="src" output="target/test-classes" path="target/generated-test-sources/test-annotations"> <classpathentry kind="src" output="target/test-classes" path="target/generated-test-sources/test-annotations">
<attributes> <attributes>
<attribute name="optional" value="true"/> <attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="ignore_optional_problems" value="true"/>
<attribute name="m2e-apt" value="true"/>
<attribute name="test" value="true"/> <attribute name="test" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>

1
.gitignore

@ -5,3 +5,4 @@ target/classes/
target/classes/application-dev.properties target/classes/application-dev.properties
target/classes/application-prod.properties target/classes/application-prod.properties
/communityHallDocuments_test

2
jwtToken.txt

@ -1 +1 @@
eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyVHlwZSI6ImhlYWRxdWFydGVycyIsImhhbGxJZCI6MywiaGFsbElkcyI6IjMiLCJtb2JpbGVOdW1iZXIiOjEyMzQ1Njc4OTEsImVtcGxveWVlSWQiOiI2Iiwiem9uZSI6IjAwIiwiZXhwIjoxNzgxNTA2NDEwfQ.GsMmYYsPT_S2rsgB_q1hFaX-2uu3Z1HvKwijAbA1Ck5ruG9Q2JaV_ZGZGic-Jl0LLRUPHi5Xs_6jCvfg6UbiNA
eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyVHlwZSI6ImhlYWRxdWFydGVycyIsImhhbGxJZCI6MCwiaGFsbElkcyI6IiIsIm1vYmlsZU51bWJlciI6OTUxNzUzODUyNCwiem9uZSI6IjAwIiwiZXhwIjoxNzgzOTI4NDY4fQ.JDuWljfRXzemAjgmLj4MFq3DgmL9Z1hbE8_LoLpQQ0jLZp4wBbyvmEopk9BHmWtzh8SlDN6dxQHEJDsxTRt0_Q

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

@ -543,16 +543,8 @@ public class AdminAPIController {
@Operation(summary = " GCC Blocked Booking Details REST API", description = "REST API to get the GCC Blocked BookingDetails") @Operation(summary = " GCC Blocked Booking Details REST API", description = "REST API to get the GCC Blocked BookingDetails")
// retrieving the GCC Blocked BookingDetails // retrieving the GCC Blocked BookingDetails
@GetMapping("/blockedevents") @GetMapping("/blockedevents")
public ResponseEntity<List<GccBlockingDate>> getBlockedEvents(
@RequestParam("fromDate") @DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate fromDate,
@RequestParam("toDate") @DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate toDate,
@RequestParam("hallIds") List<Long> hallIds) {
// System.out.println("Blocked Events Request - fromDate: " + fromDate + ",
// toDate: " + toDate + ", hallIds: " + hallIds );
List<GccBlockingDate> blockedBookings = bookingService.getBlockedEvents(fromDate, toDate, hallIds);
// List<BookingDetails> bookingDetails =
// bookingService.getByBookingId(fromDate,toDate,hallIds,blockingId,bookingId);
public ResponseEntity<List<GccBlockingDate>> getBlockedEvents() {
List<GccBlockingDate> blockedBookings = bookingService.getBlockedEvents();
if (blockedBookings.isEmpty()) { if (blockedBookings.isEmpty()) {
// System.out.println("No blocked bookings found."); // System.out.println("No blocked bookings found.");
@ -579,17 +571,23 @@ public class AdminAPIController {
return ResponseEntity.status(HttpStatus.NOT_FOUND).body("Blocking ID not found."); return ResponseEntity.status(HttpStatus.NOT_FOUND).body("Blocking ID not found.");
} }
// Get the booking IDs from the blocking date entity
// Get the booking IDs from the blocking date entity (may be null/empty for
// block-only entries)
String bookingIds = blockingDate.getBookingIds(); String bookingIds = blockingDate.getBookingIds();
String hallIds = blockingDate.getHallId(); String hallIds = blockingDate.getHallId();
// Convert the booking IDs to a list of integers
List<Integer> bookingIdList = Arrays.stream(bookingIds.split(","))
// Parse booking IDs only if present
List<Integer> bookingIdList = (bookingIds != null && !bookingIds.trim().isEmpty())
? Arrays.stream(bookingIds.split(","))
.map(String::trim)
.filter(s -> !s.isEmpty())
.map(Integer::parseInt) .map(Integer::parseInt)
.collect(Collectors.toList());
.collect(Collectors.toList())
: Collections.emptyList();
// Convert the hall IDs to a list of longs if provided // Convert the hall IDs to a list of longs if provided
List<Long> hallIdList = hallIds != null ? Arrays.stream(hallIds.split(","))
List<Long> hallIdList = (hallIds != null && !hallIds.trim().isEmpty())
? Arrays.stream(hallIds.split(","))
.map(Long::parseLong) .map(Long::parseLong)
.collect(Collectors.toList()) .collect(Collectors.toList())
: Collections.emptyList(); : Collections.emptyList();
@ -597,34 +595,47 @@ public class AdminAPIController {
// Fetch the booking calendar entries within the date range // Fetch the booking calendar entries within the date range
List<BookingCalendar> bookingCalendars = bookingService.getBookedslots(fromDate, endDate, hallIdList); List<BookingCalendar> bookingCalendars = bookingService.getBookedslots(fromDate, endDate, hallIdList);
if (bookingCalendars.isEmpty()) {
return ResponseEntity.status(HttpStatus.NOT_FOUND)
.body("No booking slots found for the given date range and hall IDs.");
}
// Iterate over bookingCalendars and update them as needed
// ── Smart unblock: per-slot decision ──────────────────────────────────
// If morning+evening+is_blocked are all true AND an APPROVED user booking
// exists for that hall/date → only clear is_blocked (leave slots intact).
// Otherwise (GCC-owned slot) → clear everything.
for (BookingCalendar bookingslots : bookingCalendars) { for (BookingCalendar bookingslots : bookingCalendars) {
if (bookingslots.isMorningSlot() && bookingslots.isEveningSlot() && bookingslots.getIs_blocked()) {
List<BookingDetails> approvedBookings = bookingDetailsRepository.findByHallIdAndDate(
bookingslots.getBdate(), bookingslots.getHallId());
if (!approvedBookings.isEmpty()) {
// Approved user booking owns the slots — only remove gcc flag
bookingslots.setIs_blocked(false);
} else {
// GCC owned this slot fully — release everything
bookingslots.setBookingId_1(null); bookingslots.setBookingId_1(null);
bookingslots.setBookingId_2(null); bookingslots.setBookingId_2(null);
bookingslots.setMorningSlot(false); bookingslots.setMorningSlot(false);
bookingslots.setEveningSlot(false); bookingslots.setEveningSlot(false);
bookingslots.setIs_blocked(false); bookingslots.setIs_blocked(false);
}
} else {
// Partial slot scenario — only clear the gcc overlay flag
bookingslots.setIs_blocked(false);
}
bookingCalendarRepository.save(bookingslots); bookingCalendarRepository.save(bookingslots);
} }
blockingDate.setBlockedStatus(GccBlockingDate.BlockedStatus.UNBLOCKED); blockingDate.setBlockedStatus(GccBlockingDate.BlockedStatus.UNBLOCKED);
blockingDateRepository.save(blockingDate); blockingDateRepository.save(blockingDate);
// Process each bookingId and update the booking details
// Update GCC_BLOCKED booking_details entries back to GCC_UNBLOCKED
for (int bookingId : bookingIdList) { for (int bookingId : bookingIdList) {
Optional<BookingDetails> bookingDetails = bookingDetailsRepo.findById(bookingId); Optional<BookingDetails> bookingDetails = bookingDetailsRepo.findById(bookingId);
if (bookingDetails.isPresent()) { if (bookingDetails.isPresent()) {
BookingDetails bookings = bookingDetails.get(); BookingDetails bookings = bookingDetails.get();
if (bookings.getBookingStatus() == BookingDetails.BookingStatus.GCC_BLOCKED) {
bookings.setBookingStatus(BookingDetails.BookingStatus.GCC_UNBLOCKED); bookings.setBookingStatus(BookingDetails.BookingStatus.GCC_UNBLOCKED);
bookings.setRefundStatus(BookingDetails.RefundStatus.NA); bookings.setRefundStatus(BookingDetails.RefundStatus.NA);
bookingDetailsRepo.save(bookings); bookingDetailsRepo.save(bookings);
} }
} }
}
String adminname = (String) session.getAttribute("usertype"); String adminname = (String) session.getAttribute("usertype");
Integer loginid = (Integer) session.getAttribute("id"); Integer loginid = (Integer) session.getAttribute("id");
ApplicationLogs logs = new ApplicationLogs(); ApplicationLogs logs = new ApplicationLogs();
@ -755,6 +766,44 @@ public class AdminAPIController {
return hallService.getHallImages(hallId); return hallService.getHallImages(hallId);
} }
@Operation(summary = "GCC Block Without Cancelling REST API", description = "REST API to Block halls without cancelling existing bookings (smart slot logic)")
@PostMapping("/blockWithoutCancel")
public ResponseEntity<String> blockWithoutCancel(
@RequestParam("fromDate") String fromDate,
@RequestParam("toDate") String toDate,
@RequestParam("hallID") String hallID,
@RequestParam("reasonforblocking") String reasonforblocking,
@RequestParam(value = "description", required = false) String[] descriptions,
@RequestParam(value = "document", required = false) MultipartFile[] documents,
HttpSession session) {
String updatedBy = (String) session.getAttribute("employeeId");
List<Long> hallIdsList = Arrays.stream(hallID.split(","))
.map(Long::parseLong)
.collect(Collectors.toList());
bookingService.blockWithoutCancellingBookings(fromDate, toDate, hallIdsList, reasonforblocking,
updatedBy, descriptions, documents);
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.setLogType("Gcc Block Without Cancel for the Reason:-" + reasonforblocking);
InetAddress inetAddress;
try {
inetAddress = InetAddress.getLocalHost();
String hostname = InetAddress.getLocalHost().getHostName();
logs.setIpaddress(inetAddress.getHostAddress());
logs.setSystemName(hostname);
} catch (UnknownHostException e) {
e.printStackTrace();
}
applicationLogsRepository.save(logs);
return ResponseEntity.ok("Success");
}
@Operation(summary = "GCC Blocking REST API", description = "REST API to Block the Halls by Admin") @Operation(summary = "GCC Blocking REST API", description = "REST API to Block the Halls by Admin")
// GccBlocking Api // GccBlocking Api
@PostMapping("/cancelAll") @PostMapping("/cancelAll")

379
src/main/java/com/gcc/communityHall/controller/Admincontroller.java

@ -30,6 +30,7 @@ import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.method.annotation.MethodArgumentTypeMismatchException; import org.springframework.web.method.annotation.MethodArgumentTypeMismatchException;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
@ -43,6 +44,8 @@ import com.gcc.communityHall.entity.HallDetails;
import com.gcc.communityHall.entity.Notification; import com.gcc.communityHall.entity.Notification;
import com.gcc.communityHall.entity.Settlement; import com.gcc.communityHall.entity.Settlement;
import com.gcc.communityHall.entity.Users; import com.gcc.communityHall.entity.Users;
import com.gcc.communityHall.entity.Login;
import com.gcc.communityHall.entity.LoginHallId;
import com.gcc.communityHall.others.UserSession; import com.gcc.communityHall.others.UserSession;
import com.gcc.communityHall.paymentService.entity.TransactionResponse; import com.gcc.communityHall.paymentService.entity.TransactionResponse;
import com.gcc.communityHall.paymentService.repository.TransactionResponseRepository; import com.gcc.communityHall.paymentService.repository.TransactionResponseRepository;
@ -54,12 +57,15 @@ import com.gcc.communityHall.repository.HallDetailsRepository;
import com.gcc.communityHall.repository.NotificationRepository; import com.gcc.communityHall.repository.NotificationRepository;
import com.gcc.communityHall.repository.SettlementRepository; import com.gcc.communityHall.repository.SettlementRepository;
import com.gcc.communityHall.repository.UsersRepository; import com.gcc.communityHall.repository.UsersRepository;
import com.gcc.communityHall.repository.LoginHallIdRepository;
import com.gcc.communityHall.repository.LoginRepository;
import com.gcc.communityHall.service.BookingService; import com.gcc.communityHall.service.BookingService;
import com.gcc.communityHall.service.HallDetailService; import com.gcc.communityHall.service.HallDetailService;
import com.gcc.communityHall.service.ReasonMasterService; import com.gcc.communityHall.service.ReasonMasterService;
import com.gcc.communityHall.service.UserService; import com.gcc.communityHall.service.UserService;
import jakarta.servlet.http.HttpSession; import jakarta.servlet.http.HttpSession;
import jakarta.transaction.Transactional;
@Controller @Controller
@RequestMapping("/communityhall/admin") @RequestMapping("/communityhall/admin")
@ -110,6 +116,12 @@ public class Admincontroller {
@Autowired @Autowired
private TransactionResponseRepository transactionResponseRepository; private TransactionResponseRepository transactionResponseRepository;
@Autowired
private LoginRepository loginRepository;
@Autowired
private LoginHallIdRepository loginHallIdRepository;
@GetMapping("/dashboard") @GetMapping("/dashboard")
public String viewDashboard( public String viewDashboard(
@RequestParam(required = false, defaultValue = "all zones") String zone, @RequestParam(required = false, defaultValue = "all zones") String zone,
@ -147,7 +159,6 @@ public class Admincontroller {
} }
} }
@GetMapping("/Reports") @GetMapping("/Reports")
public String viewReports(Model model, HttpSession session) { public String viewReports(Model model, HttpSession session) {
String adminname = (String) session.getAttribute("usertype"); String adminname = (String) session.getAttribute("usertype");
@ -174,7 +185,6 @@ public class Admincontroller {
} }
} }
@GetMapping("/HallDetails") @GetMapping("/HallDetails")
public String viewHallDetails(Model model, HttpSession session) { public String viewHallDetails(Model model, HttpSession session) {
String adminname = (String) session.getAttribute("usertype"); String adminname = (String) session.getAttribute("usertype");
@ -287,8 +297,10 @@ public class Admincontroller {
String zone = (String) session.getAttribute("zone"); String zone = (String) session.getAttribute("zone");
model.addAttribute("zone", zone); model.addAttribute("zone", zone);
List<BookingDetails> settlementrefundfailed = bookingDetailsRepository.findAllSettlementRefundFailed(); List<BookingDetails> settlementrefundfailed = bookingDetailsRepository.findAllSettlementRefundFailed();
List<BookingDetails> refundfailedcancelledbookings = bookingDetailsRepository.findAllRefundFaileCancelledList();
List<BookingDetails> refundfailedrejectedbookings = bookingDetailsRepository.findAllRefundFaileRejectedList();
List<BookingDetails> refundfailedcancelledbookings = bookingDetailsRepository
.findAllRefundFaileCancelledList();
List<BookingDetails> refundfailedrejectedbookings = bookingDetailsRepository
.findAllRefundFaileRejectedList();
model.addAttribute("settlementrefundfailed", settlementrefundfailed); model.addAttribute("settlementrefundfailed", settlementrefundfailed);
model.addAttribute("refundfailedcancelledbookings", refundfailedcancelledbookings); model.addAttribute("refundfailedcancelledbookings", refundfailedcancelledbookings);
model.addAttribute("refundfailedrejectedbookings", refundfailedrejectedbookings); model.addAttribute("refundfailedrejectedbookings", refundfailedrejectedbookings);
@ -392,6 +404,20 @@ public class Admincontroller {
} }
} }
// ── New enhanced GCC Blocking page (does NOT affect the existing page) ──
@GetMapping("/GccblockingNew")
public String viewGccBlockingNew(Model model, HttpSession session) {
String adminname = (String) session.getAttribute("usertype");
if (adminname != null) {
long mobileno = (long) session.getAttribute("mobileno");
model.addAttribute("mobileno", mobileno);
model.addAttribute("adminname", adminname);
return "admin/gccblocking-new";
} else {
session.invalidate();
return "redirect:/communityhall/login";
}
}
// Utility method to ensure distinct by a key // Utility method to ensure distinct by a key
private static <T> Predicate<T> distinctByKey(Function<? super T, ?> keyExtractor) { private static <T> Predicate<T> distinctByKey(Function<? super T, ?> keyExtractor) {
@ -410,7 +436,7 @@ public class Admincontroller {
@RequestParam float hallArea, @RequestParam float hallArea,
@RequestParam String ebNumber, @RequestParam String ebNumber,
@RequestParam float ebCostPerUnit, @RequestParam float ebCostPerUnit,
@RequestParam int parkingCapacity,
@RequestParam String parkingCapacity,
@RequestParam int seatingCapacity, @RequestParam int seatingCapacity,
@RequestParam String doorNo, @RequestParam String doorNo,
@RequestParam String street, @RequestParam String street,
@ -426,8 +452,10 @@ public class Admincontroller {
@RequestParam long hallInchargeNo, @RequestParam long hallInchargeNo,
@RequestParam("hallImages") MultipartFile[] hallImages, HttpSession session) { @RequestParam("hallImages") MultipartFile[] hallImages, HttpSession session) {
String updatedId = (String) session.getAttribute("employeeId"); String updatedId = (String) session.getAttribute("employeeId");
hallDetailService.saveHall(hallName, depositAmount, halfDayAmt, fullDayAmt, gst, hallArea, ebNumber, ebCostPerUnit, parkingCapacity, seatingCapacity, doorNo,
street, area, zone, division, landMark, city, pinCode, latitude, longitude, hallInchargeName, hallInchargeNo, updatedId, hallImages, halfdepositAmt);
hallDetailService.saveHallByAdmin(hallName, depositAmount, halfDayAmt, fullDayAmt, gst, hallArea, ebNumber,
ebCostPerUnit, parkingCapacity, seatingCapacity, doorNo,
street, area, zone, division, landMark, city, pinCode, latitude, longitude, hallInchargeName,
hallInchargeNo, updatedId, hallImages, halfdepositAmt);
String adminname = (String) session.getAttribute("usertype"); String adminname = (String) session.getAttribute("usertype");
Integer loginid = (Integer) session.getAttribute("id"); Integer loginid = (Integer) session.getAttribute("id");
ApplicationLogs logs = new ApplicationLogs(); ApplicationLogs logs = new ApplicationLogs();
@ -444,7 +472,8 @@ public class Admincontroller {
e.printStackTrace(); e.printStackTrace();
} }
applicationLogsRepository.save(logs); applicationLogsRepository.save(logs);
// Redirect to a success page or return a ModelAndView as per your application flow
// Redirect to a success page or return a ModelAndView as per your application
// flow
return "redirect:/communityhall/admin/halldetailslist"; return "redirect:/communityhall/admin/halldetailslist";
} }
@ -573,33 +602,45 @@ public class Admincontroller {
@RequestParam(name = "basedon", required = false) String basedon, @RequestParam(name = "basedon", required = false) String basedon,
@RequestParam(name = "bookingId", required = false) Long bookingId, @RequestParam(name = "bookingId", required = false) Long bookingId,
@RequestParam(name = "reporttype", required = false) String reporttype, @RequestParam(name = "reporttype", required = false) String reporttype,
@RequestParam(name = "counterId", required = false) String counterId, HttpSession session) throws JsonProcessingException {
@RequestParam(name = "counterId", required = false) String counterId, HttpSession session)
throws JsonProcessingException {
String adminname = (String) session.getAttribute("usertype"); String adminname = (String) session.getAttribute("usertype");
if (adminname != null) { if (adminname != null) {
long mobileno = (long) session.getAttribute("mobileno"); long mobileno = (long) session.getAttribute("mobileno");
model.addAttribute("mobileno", mobileno); model.addAttribute("mobileno", mobileno);
List<Users> userList = handleUserRequest(request, fromDate, toDate, userstatus, usertype); 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[]> 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[]> paymentList = new ArrayList<>();
List<Object[]> extrapaymentList = new ArrayList<>(); List<Object[]> extrapaymentList = new ArrayList<>();
if (request.equals("3")) { if (request.equals("3")) {
if (paymentStatus == null || paymentStatus.isEmpty()) { if (paymentStatus == null || paymentStatus.isEmpty()) {
paymentList = bookingService.getAllPaymentsDetails(fromDate, toDate, null, zone, division, hallid); paymentList = bookingService.getAllPaymentsDetails(fromDate, toDate, null, zone, division, hallid);
} else { } else {
paymentList = bookingService.getAllPaymentsDetails(fromDate, toDate, paymentStatus, zone, division, hallid);
paymentList = bookingService.getAllPaymentsDetails(fromDate, toDate, paymentStatus, zone, division,
hallid);
} }
} }
if (request.equals("8")) { if (request.equals("8")) {
if (paymentStatus == null || paymentStatus.isEmpty()) { if (paymentStatus == null || paymentStatus.isEmpty()) {
extrapaymentList = bookingService.getAllExtraPaymentsDetails(fromDate, toDate, null, zone, division, hallid);
extrapaymentList = bookingService.getAllExtraPaymentsDetails(fromDate, toDate, null, zone, division,
hallid);
} else { } else {
extrapaymentList = bookingService.getAllExtraPaymentsDetails(fromDate, toDate, paymentStatus, zone, division, hallid);
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<>();
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 // In your controller method
// Fetch booking count by zone // Fetch booking count by zone
List<Object[]> totalcount = new ArrayList<>(); List<Object[]> totalcount = new ArrayList<>();
@ -626,7 +667,8 @@ public class Admincontroller {
model.addAttribute("basedon", basedon); model.addAttribute("basedon", basedon);
model.addAttribute("totalcount", totalcount); model.addAttribute("totalcount", totalcount);
model.addAttribute("totalBookings", totalBookings); model.addAttribute("totalBookings", totalBookings);
List<Object[]> hallbookingList = handleBookingHallDetailsReportRequest(request, fromDate, toDate, filterby, zone, division, hallid);
List<Object[]> hallbookingList = handleBookingHallDetailsReportRequest(request, fromDate, toDate, filterby,
zone, division, hallid);
if ("9".equals(request)) { if ("9".equals(request)) {
if ("abstract".equals(reporttype)) { if ("abstract".equals(reporttype)) {
@ -635,13 +677,14 @@ public class Admincontroller {
model.addAttribute("counterBookingList", counterBookingList); model.addAttribute("counterBookingList", counterBookingList);
System.out.println("counterBookingList.." + counterBookingList); System.out.println("counterBookingList.." + counterBookingList);
List<Object[]> hallBookingByCounter = bookingService.getHallWiseBookingDetails(fromDate, toDate, counterId);
List<Object[]> hallBookingByCounter = bookingService.getHallWiseBookingDetails(fromDate, toDate,
counterId);
// Convert to JSON for JS usage // Convert to JSON for JS usage
String hallBookingJson = new ObjectMapper().writeValueAsString(hallBookingByCounter); String hallBookingJson = new ObjectMapper().writeValueAsString(hallBookingByCounter);
model.addAttribute("hallBookingJson", hallBookingJson); model.addAttribute("hallBookingJson", hallBookingJson);
List<Object[]> hallBookingDetails = bookingService.getBookingDetailsForAllHalls(fromDate, toDate, counterId, hallid);
List<Object[]> hallBookingDetails = bookingService.getBookingDetailsForAllHalls(fromDate, toDate,
counterId, hallid);
String hallBookingDetailsJson = new ObjectMapper().writeValueAsString(hallBookingDetails); String hallBookingDetailsJson = new ObjectMapper().writeValueAsString(hallBookingDetails);
model.addAttribute("hallBookingDetailsJson", hallBookingDetailsJson); model.addAttribute("hallBookingDetailsJson", hallBookingDetailsJson);
@ -702,7 +745,6 @@ public class Admincontroller {
model.addAttribute("adminname", adminname); model.addAttribute("adminname", adminname);
System.out.println("request" + request); System.out.println("request" + request);
return "admin/reports"; return "admin/reports";
} else { } else {
session.invalidate(); // Invalidate the session to clear all session attributes session.invalidate(); // Invalidate the session to clear all session attributes
@ -710,7 +752,8 @@ public class Admincontroller {
} }
} }
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<>();
} }
@ -731,7 +774,8 @@ public class Admincontroller {
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) {
if (!request.equals("1")) { if (!request.equals("1")) {
return new ArrayList<>(); return new ArrayList<>();
} }
@ -747,8 +791,8 @@ public class Admincontroller {
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<>();
} }
@ -759,10 +803,12 @@ public class Admincontroller {
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()) {
@ -770,7 +816,8 @@ public class Admincontroller {
if (bookingStatus.isEmpty()) { if (bookingStatus.isEmpty()) {
return bookingService.getBookingDetailsByBookingDate(fromDate, toDate, zone, division, hallid); return bookingService.getBookingDetailsByBookingDate(fromDate, toDate, zone, division, hallid);
} else { } else {
return bookingService.getBookingDetailsByBookingDateWithStatus(fromDate, toDate, bookingStatus, zone, division, hallid);
return bookingService.getBookingDetailsByBookingDateWithStatus(fromDate, toDate, bookingStatus,
zone, division, hallid);
} }
} }
@ -778,7 +825,8 @@ public class Admincontroller {
if (bookingStatus.isEmpty()) { if (bookingStatus.isEmpty()) {
return bookingService.getBookingDetailsByEventDate(fromDate, toDate, zone, division, hallid); return bookingService.getBookingDetailsByEventDate(fromDate, toDate, zone, division, hallid);
} else { } else {
return bookingService.getBookingDetailsByEventDateWithStatus(fromDate, toDate, bookingStatus, zone, division, hallid);
return bookingService.getBookingDetailsByEventDateWithStatus(fromDate, toDate, bookingStatus, zone,
division, hallid);
} }
} }
@ -787,8 +835,8 @@ public class Admincontroller {
return new ArrayList<>(); 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<>();
} }
@ -804,7 +852,8 @@ public class Admincontroller {
if (refundStatus.isEmpty()) { if (refundStatus.isEmpty()) {
return bookingService.getAllBookingsettlementDetailsByBookingDate(fromDate, toDate); return bookingService.getAllBookingsettlementDetailsByBookingDate(fromDate, toDate);
} else { } else {
return bookingService.getAllBookingsettlementDetailsByBookingDateWithStatus(fromDate, toDate, refundStatus);
return bookingService.getAllBookingsettlementDetailsByBookingDateWithStatus(fromDate, toDate,
refundStatus);
} }
} }
@ -812,7 +861,8 @@ public class Admincontroller {
if (refundStatus.isEmpty()) { if (refundStatus.isEmpty()) {
return bookingService.getAllBookingsettlementDetailsByEventDate(fromDate, toDate); return bookingService.getAllBookingsettlementDetailsByEventDate(fromDate, toDate);
} else { } else {
return bookingService.getAllBookingsettlementDetailsByEventDateWithStatus(fromDate, toDate, refundStatus);
return bookingService.getAllBookingsettlementDetailsByEventDateWithStatus(fromDate, toDate,
refundStatus);
} }
} }
@ -897,7 +947,8 @@ public class Admincontroller {
// model.addAttribute("mobileno", mobileno); // model.addAttribute("mobileno", mobileno);
// return "admin/developer"; // return "admin/developer";
// }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";
// } // }
// } // }
@ -910,7 +961,6 @@ public class Admincontroller {
@RequestParam(name = "hallId", required = false) Long hallId, @RequestParam(name = "hallId", required = false) Long hallId,
@RequestParam(name = "hallName", required = false) String hallName, HttpSession session) { @RequestParam(name = "hallName", required = false) String hallName, HttpSession session) {
String adminname = (String) session.getAttribute("usertype"); String adminname = (String) session.getAttribute("usertype");
if (adminname != null) { if (adminname != null) {
long mobileno = (long) session.getAttribute("mobileno"); long mobileno = (long) session.getAttribute("mobileno");
@ -941,11 +991,13 @@ public class Admincontroller {
// if (hallName.isEmpty()) { // if (hallName.isEmpty()) {
// System.out.println("check1"); // System.out.println("check1");
// // Fetch all details for the given date range // // Fetch all details for the given date range
// BookingCalendar = bookingService.getBookingCalendarDetails(fromDate, toDate,hallName);
// BookingCalendar = bookingService.getBookingCalendarDetails(fromDate,
// toDate,hallName);
// } else { // } else {
// System.out.println("check2"); // System.out.println("check2");
// // Fetch filtered details based on hallName // // Fetch filtered details based on hallName
// BookingCalendar = bookingService.getBookingCalendarDetails(fromDate, toDate, hallName);
// BookingCalendar = bookingService.getBookingCalendarDetails(fromDate, toDate,
// hallName);
// } // }
BookingCalendar = bookingService.getBookingCalendarDetails(fromDate, toDate, bookingId, hallName); BookingCalendar = bookingService.getBookingCalendarDetails(fromDate, toDate, bookingId, hallName);
} }
@ -1045,7 +1097,6 @@ public class Admincontroller {
} }
} }
@GetMapping("/logout") @GetMapping("/logout")
public String viewLogout(Model model, HttpSession session) { public String viewLogout(Model model, HttpSession session) {
session.invalidate(); session.invalidate();
@ -1072,5 +1123,255 @@ public class Admincontroller {
} }
} }
// care taker, counter and officer login creation added by kanimozhi 15062026
@GetMapping("/login-creation")
public String viewLoginCreation(Model model, HttpSession session) {
String adminname = (String) session.getAttribute("usertype");
if (adminname != null && "admin".equals(adminname)) {
long mobileno = (long) session.getAttribute("mobileno");
model.addAttribute("mobileno", mobileno);
model.addAttribute("adminname", adminname);
// Fetch existing active non-admin logins (returns projection, not full entity)
List<Map<String, Object>> loginList = loginRepository.findActiveLogins();
model.addAttribute("loginList", loginList);
// Fetch hall details for the modal dropdown
List<Map<String, Object>> hallList = hallDetailsRepo.getAllHalls();
model.addAttribute("hallList", hallList);
return "admin/login-creation";
} else {
session.invalidate();
return "redirect:/communityhall/login";
}
} }
@PostMapping("/login-creation/save")
@ResponseBody
@Transactional
public Map<String, Object> saveLoginCreation(
@RequestParam("mobileNumber") long mobileNumber,
@RequestParam("name") String name,
@RequestParam("password") String password,
@RequestParam("userType") String userType,
@RequestParam("zone") String zone,
@RequestParam(value = "hallIds", required = false) List<Integer> hallIds,
HttpSession session) {
Map<String, Object> response = new HashMap<>();
String adminname = (String) session.getAttribute("usertype");
if (adminname == null && "admin".equals(adminname)) {
response.put("status", "error");
response.put("message", "Session expired. Please log in again.");
return response;
}
try {
/* -------- Duplicate hall check for counter / caretaker -------- */
boolean isSingleMode = "counter".equals(userType) || "caretaker".equals(userType);
boolean isMulitpleMode = "officer".equals(userType);
if (isSingleMode && hallIds != null && !hallIds.isEmpty()) {
int hallId = hallIds.get(0);
int existingCount = loginRepository.countActiveLoginsByHallId(hallId, userType);
if (existingCount > 0) {
// Fetch hall name for a clear message
String hallName = hallId + "";
try {
String fetched = hallDetailsRepo.findHallNameById(hallId);
if (fetched != null && !fetched.isBlank())
hallName = fetched;
} catch (Exception ignored) {
}
response.put("status", "error");
response.put("message", "A login already exists for hall \"" + hallName
+ "\". Only one counter/caretaker login is allowed per hall.");
return response;
}
}
/* -------- Duplicate hall check for officer -------- */
if (isMulitpleMode && hallIds != null && !hallIds.isEmpty()) {
int existingCount = loginRepository.getActiveLoginsByHallIds(hallIds, userType);
if (existingCount > 0) {
response.put("status", "error");
response.put("message",
"A login already exists for the selected hall(s). Only one officer login is allowed per hall.");
return response;
}
}
Login login = new Login();
login.setMobileNumber(mobileNumber);
login.setName(name);
login.setPassword(password);
login.setUserType(userType);
login.setZone(zone);
login.setActive(true);
login.setDelete(false);
if (hallIds == null || hallIds.isEmpty()) {
// HQ may have no hall assigned
loginRepository.save(login);
} else if (hallIds.size() == 1) {
// Single hall: store directly in login.hallId
login.setHallId(hallIds.get(0));
loginRepository.save(login);
} else {
// Multiple halls: store first in hallId, rest in login_hall_ids
login.setHallId(hallIds.get(0));
Login savedLogin = loginRepository.save(login);
for (int hallId : hallIds) {
LoginHallId loginHallId = new LoginHallId(savedLogin, hallId);
loginHallIdRepository.save(loginHallId);
}
}
response.put("status", "success");
response.put("message", "Login created successfully.");
} catch (Exception e) {
response.put("status", "error");
response.put("message", "Error creating login: " + e.getMessage());
}
return response;
}
@PostMapping("/login-creation/delete/{id}")
@ResponseBody
@Transactional
public Map<String, Object> deleteLogin(@PathVariable("id") int id, HttpSession session) {
Map<String, Object> response = new HashMap<>();
String adminname = (String) session.getAttribute("usertype");
if (adminname == null && "admin".equals(adminname)) {
response.put("status", "error");
response.put("message", "Session expired. Please log in again.");
return response;
}
try {
Login login = loginRepository.findLoginById(id);
if (login == null) {
response.put("status", "error");
response.put("message", "Login not found.");
return response;
}
// Soft delete: set is_active = 0, is_delete = 1
login.setActive(false);
login.setDelete(true);
loginRepository.save(login);
// Also soft-delete any related login_hall_ids
loginHallIdRepository.softDeleteByLoginId(id);
response.put("status", "success");
response.put("message", "Login deleted successfully.");
} catch (Exception e) {
response.put("status", "error");
response.put("message", "Error deleting login: " + e.getMessage());
}
return response;
}
@GetMapping("/login-creation/check-mobile")
@ResponseBody
public Map<String, Object> checkMobileExists(@RequestParam("mobileNumber") long mobileNumber, HttpSession session) {
Map<String, Object> response = new HashMap<>();
try {
int count = loginRepository.countByMobileNumber(mobileNumber);
response.put("exists", count > 0);
} catch (Exception e) {
response.put("exists", false);
response.put("error", e.getMessage());
}
return response;
}
@GetMapping("/login-creation/halls-by-zone")
@ResponseBody
public List<Map<String, Object>> getHallsByZone(@RequestParam("zone") String zone, HttpSession session) {
try {
return hallDetailsRepo.getHallsByZone(zone);
} catch (Exception e) {
return new java.util.ArrayList<>();
}
}
@GetMapping("/login-creation/get-login-halls")
@ResponseBody
public Map<String, Object> getLoginHalls(@RequestParam("loginId") int loginId, HttpSession session) {
Map<String, Object> response = new HashMap<>();
try {
Login login = loginRepository.findLoginById(loginId);
if (login == null) {
response.put("status", "error");
response.put("message", "Login not found.");
return response;
}
// Collect all assigned hall IDs
java.util.List<Integer> assignedHallIds = new java.util.ArrayList<>();
if (login.getHallId() != 0) {
assignedHallIds.add(login.getHallId());
}
loginHallIdRepository.findActiveByLoginId(loginId).forEach(lh -> assignedHallIds.add(lh.getHallId()));
response.put("status", "success");
response.put("loginId", loginId);
response.put("name", login.getName());
response.put("zone", login.getZone());
response.put("userType", login.getUserType());
response.put("assignedHallIds", assignedHallIds);
// Also return all halls for the zone
response.put("hallsForZone", hallDetailsRepo.getHallsByZone(login.getZone()));
} catch (Exception e) {
response.put("status", "error");
response.put("message", "Error fetching login halls: " + e.getMessage());
}
return response;
}
@PostMapping("/login-creation/update-halls")
@ResponseBody
@Transactional
public Map<String, Object> updateLoginHalls(
@RequestParam("loginId") int loginId,
@RequestParam("hallIds") java.util.List<Integer> hallIds,
HttpSession session) {
Map<String, Object> response = new HashMap<>();
try {
Login login = loginRepository.findLoginById(loginId);
if (login == null) {
response.put("status", "error");
response.put("message", "Login not found.");
return response;
}
if (hallIds == null || hallIds.isEmpty()) {
response.put("status", "error");
response.put("message", "At least one hall must be selected.");
return response;
}
// Clear all existing login_hall_ids rows for this login
loginHallIdRepository.softDeleteByLoginId(loginId);
if (hallIds.size() == 1) {
// Single hall: store in login.hall_id only
login.setHallId(hallIds.get(0));
loginRepository.save(login);
} else {
// Multiple halls: first goes to login.hall_id, rest to login_hall_ids
login.setHallId(hallIds.get(0));
loginRepository.save(login);
for (int i = 1; i < hallIds.size(); i++) {
LoginHallId lh = new LoginHallId(login, hallIds.get(i));
loginHallIdRepository.save(lh);
}
}
response.put("status", "success");
response.put("message", "Hall assignment updated successfully.");
} catch (Exception e) {
response.put("status", "error");
response.put("message", "Error updating halls: " + e.getMessage());
}
return response;
}
}

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

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

@ -24,8 +24,10 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import com.gcc.communityHall.entity.BookingDetails; import com.gcc.communityHall.entity.BookingDetails;
import com.gcc.communityHall.entity.HallDetails;
import com.gcc.communityHall.entity.Users; import com.gcc.communityHall.entity.Users;
import com.gcc.communityHall.repository.BookingDetailsRepository; import com.gcc.communityHall.repository.BookingDetailsRepository;
import com.gcc.communityHall.repository.HallDetailsRepository; import com.gcc.communityHall.repository.HallDetailsRepository;
@ -735,6 +737,21 @@ public class HeadquartersController {
} }
} }
// ── New enhanced GCC Blocking page (does NOT affect the existing page) ──
@GetMapping("/GccblockingNew")
public String viewGccBlockingNew(Model model, HttpSession session) {
String headquartersname = (String) session.getAttribute("usertype");
if (headquartersname != null && "headquarters".equals(headquartersname)) {
long mobileno = (long) session.getAttribute("mobileno");
model.addAttribute("mobileno", mobileno);
model.addAttribute("headquartersname", headquartersname);
return "headquarters/gccblocking-new";
} else {
session.invalidate();
return "redirect:/communityhall/login";
}
}
// Utility method to ensure distinct by a key // Utility method to ensure distinct by a key
private static <T> Predicate<T> distinctByKey(Function<? super T, ?> keyExtractor) { private static <T> Predicate<T> distinctByKey(Function<? super T, ?> keyExtractor) {
Set<Object> seen = new HashSet<>(); Set<Object> seen = new HashSet<>();
@ -1012,4 +1029,61 @@ public class HeadquartersController {
return response; return response;
} }
// hall creation newly added by kanimozhi 15062026
@PostMapping("/saveHallDetails")
public String saveHall(
@RequestParam String hallName,
@RequestParam float depositAmount,
@RequestParam float halfdepositAmt,
@RequestParam float halfDayAmt,
@RequestParam float fullDayAmt,
@RequestParam float gst,
@RequestParam float hallArea,
@RequestParam String ebNumber,
@RequestParam float ebCostPerUnit,
@RequestParam String parkingCapacity,
@RequestParam int seatingCapacity,
@RequestParam String doorNo,
@RequestParam String street,
@RequestParam String area,
@RequestParam String zone,
@RequestParam String division,
@RequestParam(required = false) String landMark,
@RequestParam String city,
@RequestParam int pinCode,
@RequestParam(required = false) String latitude,
@RequestParam(required = false) String longitude,
@RequestParam String hallInchargeName,
@RequestParam long hallInchargeNo,
@RequestParam("hallImages") MultipartFile[] hallImages,
@RequestParam(value = "floorName", required = false) List<String> floorNames,
@RequestParam(value = "floorCapacity", required = false) List<Double> floorCapacities,
HttpSession session) {
String updatedId = (String) session.getAttribute("employeeId");
hallDetailService.saveHallByHQ(hallName, depositAmount, halfDayAmt, fullDayAmt, gst, hallArea, ebNumber,
ebCostPerUnit, parkingCapacity, seatingCapacity, doorNo,
street, area, zone, division, landMark, city, pinCode, latitude, longitude, hallInchargeName,
hallInchargeNo, updatedId, hallImages, halfdepositAmt, floorNames, floorCapacities);
return "redirect:/communityhall/headquarters/halldetailslist";
}
@GetMapping("/halldetailslist")
public String viewhalldetailsList(Model model, HttpSession session) {
List<HallDetails> list = hallDetailsRepository.findAll();
String headquartersname = (String) session.getAttribute("usertype");
if (headquartersname != null) {
long mobileno = (long) session.getAttribute("mobileno");
model.addAttribute("mobileno", mobileno);
model.addAttribute("adminname", headquartersname);
model.addAttribute("halllist", list);
return "headquarters/halldetailslist";
} else {
session.invalidate(); // Invalidate the session to clear all session attributes
return "redirect:/communityhall/login";
}
}
} }

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

@ -1,19 +1,18 @@
package com.gcc.communityHall.controller; package com.gcc.communityHall.controller;
import java.io.FileOutputStream;
import java.net.InetAddress; import java.net.InetAddress;
import java.net.UnknownHostException; import java.net.UnknownHostException;
import java.time.Instant;
import java.time.LocalDate; import java.time.LocalDate;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional; import java.util.Optional;
import java.util.stream.Collectors;
import ch.qos.logback.core.CoreConstants;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
@ -21,31 +20,26 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import java.net.InetAddress;
import com.gcc.communityHall.dto.PaymentsDTO; import com.gcc.communityHall.dto.PaymentsDTO;
import com.gcc.communityHall.entity.ApplicationLogs; import com.gcc.communityHall.entity.ApplicationLogs;
import com.gcc.communityHall.entity.BookingCalendar; import com.gcc.communityHall.entity.BookingCalendar;
import com.gcc.communityHall.entity.BookingDetails; import com.gcc.communityHall.entity.BookingDetails;
import com.gcc.communityHall.entity.BookingDetails.BookingStatus; 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.Users.userType;
import com.gcc.communityHall.paymentService.entity.TransactionResponse;
import com.gcc.communityHall.entity.BookingHistory;
import com.gcc.communityHall.entity.CounterRefundList; import com.gcc.communityHall.entity.CounterRefundList;
import com.gcc.communityHall.entity.GccBlockingDate;
import com.gcc.communityHall.entity.Settlement; import com.gcc.communityHall.entity.Settlement;
import com.gcc.communityHall.entity.SettlementHistory;
import com.gcc.communityHall.entity.Users; import com.gcc.communityHall.entity.Users;
import com.gcc.communityHall.repository.ApplicationLogsRepository; import com.gcc.communityHall.repository.ApplicationLogsRepository;
import com.gcc.communityHall.repository.BookingCalendarRepository; import com.gcc.communityHall.repository.BookingCalendarRepository;
import com.gcc.communityHall.repository.BookingDetailsRepository; import com.gcc.communityHall.repository.BookingDetailsRepository;
import com.gcc.communityHall.repository.BookingHistoryRepository; import com.gcc.communityHall.repository.BookingHistoryRepository;
import com.gcc.communityHall.repository.CounterRefundListRepository; import com.gcc.communityHall.repository.CounterRefundListRepository;
import com.gcc.communityHall.repository.SettlementHistoryRepository;
import com.gcc.communityHall.repository.GccBlockingDateRepository;
import com.gcc.communityHall.repository.SettlementRepository; import com.gcc.communityHall.repository.SettlementRepository;
import com.gcc.communityHall.repository.UsersRepository; import com.gcc.communityHall.repository.UsersRepository;
import com.gcc.communityHall.service.BookingService; import com.gcc.communityHall.service.BookingService;
@ -55,7 +49,6 @@ import com.gcc.communityHall.service.ReasonMasterService;
import com.gcc.communityHall.service.SettlementService; import com.gcc.communityHall.service.SettlementService;
import com.gcc.communityHall.service.UserService; import com.gcc.communityHall.service.UserService;
import com.gcc.communityHall.service.Impl.BookingServiceImpl; import com.gcc.communityHall.service.Impl.BookingServiceImpl;
import com.gcc.communityHall.service.Impl.SettlementServiceImpl;
import com.gcc.communityHall.service.Impl.UserServiceImpl; import com.gcc.communityHall.service.Impl.UserServiceImpl;
import com.gcc.communityHall.service.Impl.WhatsappMsgServiceImpl; import com.gcc.communityHall.service.Impl.WhatsappMsgServiceImpl;
@ -65,20 +58,13 @@ import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpSession; import jakarta.servlet.http.HttpSession;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
@Tag(
name = "CRUD REST APIs for Officer in CommunityHall",
description = "CRUD REST APIs in CommunityHall to CREATE, UPDATE, FETCH AND DELETE Booking details"
)
@Tag(name = "CRUD REST APIs for Officer in CommunityHall", description = "CRUD REST APIs in CommunityHall to CREATE, UPDATE, FETCH AND DELETE Booking details")
@RestController @RestController
@RequestMapping("/communityhall/api/officer") @RequestMapping("/communityhall/api/officer")
@AllArgsConstructor @AllArgsConstructor
@Validated @Validated
public class OfficerAPIController { public class OfficerAPIController {
// ak// ak // ak// ak
@Autowired
private SettlementHistoryRepository settlementHistoryRepository;
@Autowired @Autowired
private UserService userService; private UserService userService;
@ -91,9 +77,6 @@ public class OfficerAPIController {
@Autowired @Autowired
private UserServiceImpl userServiceImpl; private UserServiceImpl userServiceImpl;
@Autowired
private SettlementServiceImpl settlementServiceImpl;
@Autowired @Autowired
private SettlementRepository settlementRepository; private SettlementRepository settlementRepository;
@ -119,8 +102,9 @@ public class OfficerAPIController {
private WhatsappMsgServiceImpl whatsappMsgServiceImpl; private WhatsappMsgServiceImpl whatsappMsgServiceImpl;
@Autowired @Autowired
private PaymentsService paymentsService; private PaymentsService paymentsService;
@Autowired @Autowired
private BookingHistoryRepository bookingHistoryRepository;
private GccBlockingDateRepository blockingDateRepository;
@Autowired @Autowired
private HttpSession session; private HttpSession session;
@ -128,10 +112,7 @@ public class OfficerAPIController {
@Autowired @Autowired
private ApplicationLogsRepository applicationLogsRepository; private ApplicationLogsRepository applicationLogsRepository;
@Operation(
summary = "Retriving the User Details by userId REST API",
description = "REST API for Retriving the User Details by UserId"
)
@Operation(summary = "Retriving the User Details by userId REST API", description = "REST API for Retriving the User Details by UserId")
// Getting User Details by User Id // Getting User Details by User Id
@GetMapping("/getUserDetails") @GetMapping("/getUserDetails")
public ResponseEntity<?> getUsersByID(HttpServletRequest request, @RequestParam String usersid) { public ResponseEntity<?> getUsersByID(HttpServletRequest request, @RequestParam String usersid) {
@ -139,39 +120,32 @@ public class OfficerAPIController {
return ResponseEntity.ok(user); return ResponseEntity.ok(user);
} }
@Operation(
summary = "Settlement List where the Refund Status is WAITING REST API",
description = "REST API for Retriving the Settlement List where the Refund Status is WAITING"
)
@Operation(summary = "Settlement List where the Refund Status is WAITING REST API", description = "REST API for Retriving the Settlement List where the Refund Status is WAITING")
// retrieving the Settlement List by Refund Status is WAITING // retrieving the Settlement List by Refund Status is WAITING
@GetMapping("/waiting-refund") @GetMapping("/waiting-refund")
public List<Settlement> getSettlementsWithWaitingRefund() { public List<Settlement> getSettlementsWithWaitingRefund() {
return settlementService.getSettlementListWithWaitingRefund(); return settlementService.getSettlementListWithWaitingRefund();
} }
@Operation(
summary = "Settlement List by Settlement Id REST API",
description = "REST API for Retriving the Settlement List by Settlement Id"
)
@Operation(summary = "Settlement List by Settlement Id REST API", description = "REST API for Retriving the Settlement List by Settlement Id")
// retrieving the Settlement List by Settlement Id // retrieving the Settlement List by Settlement Id
@GetMapping("/getSettlementList") @GetMapping("/getSettlementList")
public ResponseEntity<BookingDetails> getBookingDetailsWithSettlement(HttpServletRequest request, @RequestParam String settlementsid) {
BookingDetails bookingDetails = bookingServiceImpl.getBookingDetailsWithSettlement(Integer.parseInt(settlementsid));
public ResponseEntity<BookingDetails> getBookingDetailsWithSettlement(HttpServletRequest request,
@RequestParam String settlementsid) {
BookingDetails bookingDetails = bookingServiceImpl
.getBookingDetailsWithSettlement(Integer.parseInt(settlementsid));
System.out.println("bookingDetails:12 " + bookingDetails); System.out.println("bookingDetails:12 " + bookingDetails);
return ResponseEntity.ok(bookingDetails); return ResponseEntity.ok(bookingDetails);
} }
@GetMapping("/getsettlementListbyid") @GetMapping("/getsettlementListbyid")
public ResponseEntity<Optional<Settlement>> getsettlementlist(HttpServletRequest request, @RequestParam int settlementsid) {
public ResponseEntity<Optional<Settlement>> getsettlementlist(HttpServletRequest request,
@RequestParam int settlementsid) {
Optional<Settlement> settlementlist = settlementRepository.findById(settlementsid); Optional<Settlement> settlementlist = settlementRepository.findById(settlementsid);
return ResponseEntity.ok(settlementlist); return ResponseEntity.ok(settlementlist);
} }
@Operation(
summary = "Booking Details by Booking Id REST API",
description = "REST API for Retriving the Booking Details by Booking Id"
)
@Operation(summary = "Booking Details by Booking Id REST API", description = "REST API for Retriving the Booking Details by Booking Id")
// retrieving the Booking Details by Booking Id // retrieving the Booking Details by Booking Id
@GetMapping("/getBookingDetails") @GetMapping("/getBookingDetails")
public ResponseEntity<?> getBookingsById(HttpServletRequest request, @RequestParam String bookingsId) { public ResponseEntity<?> getBookingsById(HttpServletRequest request, @RequestParam String bookingsId) {
@ -179,11 +153,9 @@ public class OfficerAPIController {
return ResponseEntity.ok(book); return ResponseEntity.ok(book);
} }
@Operation(
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
@Operation(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
@PostMapping("/updateApprovedSettlementStatus/{settlementId}") // need to check this API for settlement approval @PostMapping("/updateApprovedSettlementStatus/{settlementId}") // need to check this API for settlement approval
public ResponseEntity<Object> updateApprovedSettlementStatus( public ResponseEntity<Object> updateApprovedSettlementStatus(
@PathVariable("settlementId") int settlementId, @PathVariable("settlementId") int settlementId,
@ -191,7 +163,6 @@ public class OfficerAPIController {
@RequestParam("comments") String comments) { @RequestParam("comments") String comments) {
Map<String, Object> response = new HashMap<>(); Map<String, Object> response = new HashMap<>();
try { try {
System.out.println("settlementId1: " + settlementId); System.out.println("settlementId1: " + settlementId);
System.out.println("status" + status); System.out.println("status" + status);
@ -231,7 +202,8 @@ public class OfficerAPIController {
applicationLogsRepository.save(logs); applicationLogsRepository.save(logs);
// Process refund request // Process refund request
String refundResponse = bookingServiceImpl.processRefundRequest(updateSettlement.getBookingDetails().getBookingId());
String refundResponse = bookingServiceImpl
.processRefundRequest(updateSettlement.getBookingDetails().getBookingId());
// ak // ak
// Prepare response map // Prepare response map
@ -246,14 +218,16 @@ public class OfficerAPIController {
} else { } else {
// Refund failure, update refund status to FAILURE // Refund failure, update refund status to FAILURE
bookingService.updateRefundStatus(updateSettlement.getBookingDetails().getBookingId(), BookingDetails.RefundStatus.FAILURE);
bookingService.updateRefundStatus(updateSettlement.getBookingDetails().getBookingId(),
BookingDetails.RefundStatus.FAILURE);
Map<String, Object> responses = new HashMap<>(); Map<String, Object> responses = new HashMap<>();
responses.put("approvedFlag", 1); responses.put("approvedFlag", 1);
responses.put("message", "Refund processing failed: " + refundResponse); responses.put("message", "Refund processing failed: " + refundResponse);
responses.put("status", "FAILURE"); responses.put("status", "FAILURE");
return new ResponseEntity<>(responses, HttpStatus.INTERNAL_SERVER_ERROR); return new ResponseEntity<>(responses, HttpStatus.INTERNAL_SERVER_ERROR);
//return new ResponseEntity<>("Refund processing failed: " + refundResponse, HttpStatus.INTERNAL_SERVER_ERROR);
// return new ResponseEntity<>("Refund processing failed: " + refundResponse,
// HttpStatus.INTERNAL_SERVER_ERROR);
} }
} catch (Exception e) { } catch (Exception e) {
@ -261,15 +235,15 @@ public class OfficerAPIController {
response.put("message", "Exception while approving settlement: " + e.getMessage()); response.put("message", "Exception while approving settlement: " + e.getMessage());
return new ResponseEntity<>(response, HttpStatus.INTERNAL_SERVER_ERROR); return new ResponseEntity<>(response, HttpStatus.INTERNAL_SERVER_ERROR);
//return new ResponseEntity<>("An error occurred while processing the settlement for Settlement ID: " + settlementId, HttpStatus.INTERNAL_SERVER_ERROR);
// return new ResponseEntity<>("An error occurred while processing the
// settlement for Settlement ID: " + settlementId,
// HttpStatus.INTERNAL_SERVER_ERROR);
} }
} }
@Operation(
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 Rejected by Settlement Id If the settlement is Rejected
@Operation(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 Rejected by Settlement Id If the settlement is
// Rejected
@PostMapping("/updateRejectSettlementStatus/{settlementId}") @PostMapping("/updateRejectSettlementStatus/{settlementId}")
public ResponseEntity<Settlement> updateRejectSettlementStatus( public ResponseEntity<Settlement> updateRejectSettlementStatus(
@PathVariable("settlementId") int settlementId, @PathVariable("settlementId") int settlementId,
@ -300,10 +274,7 @@ public class OfficerAPIController {
} }
} }
@Operation(
summary = "USER STATUS APPROVED REST API",
description = "REST API for Updating the user Status Approved"
)
@Operation(summary = "USER STATUS APPROVED REST API", description = "REST API for Updating the user Status Approved")
// Updating the user Status Approved // Updating the user Status Approved
@PostMapping("/updateApprovedStatus/{userId}") @PostMapping("/updateApprovedStatus/{userId}")
public ResponseEntity<Users> updateApprovedStatus( public ResponseEntity<Users> updateApprovedStatus(
@ -319,10 +290,7 @@ public class OfficerAPIController {
} }
} }
@Operation(
summary = "USER STATUS REJECTED REST API",
description = "REST API for Updating the user Status Rejected"
)
@Operation(summary = "USER STATUS REJECTED REST API", description = "REST API for Updating the user Status Rejected")
// Updating the user Status Rejected // Updating the user Status Rejected
@PostMapping("/updateRejectStatus/{userId}") @PostMapping("/updateRejectStatus/{userId}")
public ResponseEntity<Users> updateRejectStatus( public ResponseEntity<Users> updateRejectStatus(
@ -339,10 +307,7 @@ public class OfficerAPIController {
} }
} }
@Operation(
summary = "BOOKING STATUS APPROVED REST API",
description = "REST API for Updating the Booking Status Approved by Booking Id"
)
@Operation(summary = "BOOKING STATUS APPROVED REST API", description = "REST API for Updating the Booking Status Approved by Booking Id")
// 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(
@ -377,13 +342,12 @@ public class OfficerAPIController {
} }
// ak // ak
@PostMapping("/toggleStatus") @PostMapping("/toggleStatus")
public ResponseEntity<String> toggleUserStatus( public ResponseEntity<String> toggleUserStatus(
@RequestParam Integer userId, @RequestParam Integer userId,
@RequestParam boolean active
) {
//System.out.println("userID: " + userId + ", active or deactivate: " + active);
@RequestParam boolean active) {
// System.out.println("userID: " + userId + ", active or deactivate: " +
// active);
try { try {
userService.toggleUserStatus(userId, active); userService.toggleUserStatus(userId, active);
return ResponseEntity.ok("User status updated successfully"); return ResponseEntity.ok("User status updated successfully");
@ -392,11 +356,7 @@ public class OfficerAPIController {
} }
} }
@Operation(
summary = "BOOKING STATUS REJECTED REST API",
description = "REST API for Updating the Booking Status Rejected by Booking Id"
)
@Operation(summary = "BOOKING STATUS REJECTED REST API", description = "REST API for Updating the Booking Status Rejected by Booking Id")
// Updating the Booking Status Rejected by Booking Id // Updating the Booking Status Rejected by Booking Id
@PostMapping("/updateBookingReject/{bookingId}") @PostMapping("/updateBookingReject/{bookingId}")
public ResponseEntity<?> updateBookingReject( public ResponseEntity<?> updateBookingReject(
@ -410,7 +370,8 @@ public class OfficerAPIController {
BookingDetails result = book.get(); BookingDetails result = book.get();
result.setBookingStatus(BookingStatus.REJECTED); result.setBookingStatus(BookingStatus.REJECTED);
result.setRefundStatus(RefundStatus.NA); result.setRefundStatus(RefundStatus.NA);
List<BookingCalendar> bookingCalendarList = bookingCalendarRepository.getCancellingdata1(String.valueOf(result.getBookingId()));
List<BookingCalendar> bookingCalendarList = bookingCalendarRepository
.getCancellingdata1(String.valueOf(result.getBookingId()));
for (BookingCalendar calendar : bookingCalendarList) { for (BookingCalendar calendar : bookingCalendarList) {
boolean isUpdated = false; boolean isUpdated = false;
@ -458,10 +419,17 @@ public class OfficerAPIController {
BookingDetails rejectBooking = bookingService.updateCancelledBookingStatus(bookingId, status, comments); BookingDetails rejectBooking = bookingService.updateCancelledBookingStatus(bookingId, status, comments);
Optional<BookingDetails> book = bookingDetailsRepository.findById(bookingId); Optional<BookingDetails> book = bookingDetailsRepository.findById(bookingId);
BookingDetails bookingDetails = book.get(); BookingDetails bookingDetails = book.get();
String rejectionsms="Your booking ID "+bookingDetails.getBookingId()+" on "+bookingDetails.getStartDate()+" has been rejected by GCC due to insufficient details.";
String rejectedurlString ="https://tmegov.onex-aura.com/api/sms?key=pfTEYN6H&to="+bookingDetails.getUsers().getMobileNo()+"&from=GCCCRP&body="+rejectionsms+"&entityid=1401572690000011081&templateid=1407172346485956648";
//String rejectedwhatsupmsg="https://media.smsgupshup.com/GatewayAPI/rest?userid=2000233507&password=h2YjFNcJ&send_to="+bookingDetails.getUsers().getMobileNo()+"&v=1.1&format=json&msg_type=TEXT&method=SENDMESSAGE&msg=Your+booking+with+ID+"+bookingId+"+on+"+bookingDetails.getStartDate()+"+has+been+rejected+by+GCC+due+to+insufficient+details.+%0AThanks+for+using+GCC+Community+Hall+Booking+System.";
String rejectedwhatsupmsg="https://media.smsgupshup.com/GatewayAPI/rest?userid=2000233507&password=h2YjFNcJ&send_to="+bookingDetails.getUsers().getMobileNo()+"&v=1.1&format=json&msg_type=TEXT&method=SENDMESSAGE&msg=Your+booking+with+ID+"+bookingId+"+on+"+bookingDetails.getStartDate()+"+has+been+rejected+by+GCC+due+to+insufficient+details.";
String rejectionsms = "Your booking ID " + bookingDetails.getBookingId() + " on "
+ bookingDetails.getStartDate() + " has been rejected by GCC due to insufficient details.";
String rejectedurlString = "https://tmegov.onex-aura.com/api/sms?key=pfTEYN6H&to="
+ bookingDetails.getUsers().getMobileNo() + "&from=GCCCRP&body=" + rejectionsms
+ "&entityid=1401572690000011081&templateid=1407172346485956648";
// String
// rejectedwhatsupmsg="https://media.smsgupshup.com/GatewayAPI/rest?userid=2000233507&password=h2YjFNcJ&send_to="+bookingDetails.getUsers().getMobileNo()+"&v=1.1&format=json&msg_type=TEXT&method=SENDMESSAGE&msg=Your+booking+with+ID+"+bookingId+"+on+"+bookingDetails.getStartDate()+"+has+been+rejected+by+GCC+due+to+insufficient+details.+%0AThanks+for+using+GCC+Community+Hall+Booking+System.";
String rejectedwhatsupmsg = "https://media.smsgupshup.com/GatewayAPI/rest?userid=2000233507&password=h2YjFNcJ&send_to="
+ bookingDetails.getUsers().getMobileNo()
+ "&v=1.1&format=json&msg_type=TEXT&method=SENDMESSAGE&msg=Your+booking+with+ID+" + bookingId
+ "+on+" + bookingDetails.getStartDate() + "+has+been+rejected+by+GCC+due+to+insufficient+details.";
whatsappMsgServiceImpl.sendMsg(rejectedwhatsupmsg); whatsappMsgServiceImpl.sendMsg(rejectedwhatsupmsg);
whatsappMsgServiceImpl.sendSMS(rejectedurlString); whatsappMsgServiceImpl.sendSMS(rejectedurlString);
String adminname = (String) session.getAttribute("usertype"); String adminname = (String) session.getAttribute("usertype");
@ -487,10 +455,7 @@ public class OfficerAPIController {
} }
} }
@Operation(
summary = "Retrieving BOOKING STATUS APPROVED REST API",
description = "REST API for retrieving the Booking Status Approved"
)
@Operation(summary = "Retrieving BOOKING STATUS APPROVED REST API", description = "REST API for retrieving the Booking Status Approved")
// retrieving the Booking Status Approved // retrieving the Booking Status Approved
@GetMapping("/user-Approved") @GetMapping("/user-Approved")
public ResponseEntity<List<Users>> getUserApprovedList() { public ResponseEntity<List<Users>> getUserApprovedList() {
@ -498,10 +463,7 @@ public class OfficerAPIController {
return new ResponseEntity<>(userApproved, HttpStatus.OK); return new ResponseEntity<>(userApproved, HttpStatus.OK);
} }
@Operation(
summary = "Retrieving BOOKING STATUS REJECTED REST API",
description = "REST API for retrieving the Booking Status Rejected"
)
@Operation(summary = "Retrieving BOOKING STATUS REJECTED REST API", description = "REST API for retrieving the Booking Status Rejected")
// retrieving the Booking Status Rejected // retrieving the Booking Status Rejected
@GetMapping("/user-Reject") @GetMapping("/user-Reject")
public ResponseEntity<List<Users>> getUserRejectedList() { public ResponseEntity<List<Users>> getUserRejectedList() {
@ -509,11 +471,7 @@ public class OfficerAPIController {
return new ResponseEntity<>(userReject, HttpStatus.OK); return new ResponseEntity<>(userReject, HttpStatus.OK);
} }
@Operation(
summary = "Counter Refund Approval by Officer REST API",
description = "REST API to approve the Counter Refund by Officer"
)
@Operation(summary = "Counter Refund Approval by Officer REST API", description = "REST API to approve the Counter Refund by Officer")
// RefundApproval by Officer // RefundApproval by Officer
@PostMapping("/approveRefund/{id}") @PostMapping("/approveRefund/{id}")
public ResponseEntity<String> approveRefund(@PathVariable int id) { public ResponseEntity<String> approveRefund(@PathVariable int id) {
@ -529,10 +487,7 @@ public class OfficerAPIController {
} }
} }
@Operation(
summary = "Counter Refund Reject by Officer REST API",
description = "REST API to Reject the Counter Refund by Officer"
)
@Operation(summary = "Counter Refund Reject by Officer REST API", description = "REST API to Reject the Counter Refund by Officer")
// RefundReject by Officer // RefundReject by Officer
@PostMapping("/rejectRefund/{id}") @PostMapping("/rejectRefund/{id}")
public ResponseEntity<String> rejectRefund(@PathVariable int id) { public ResponseEntity<String> rejectRefund(@PathVariable int id) {
@ -548,10 +503,7 @@ public class OfficerAPIController {
} }
} }
@Operation(
summary = "Reason By reasonName REST API",
description = "REST API to get the Reason Details with the reason"
)
@Operation(summary = "Reason By reasonName REST API", description = "REST API to get the Reason Details with the reason")
// retrieving the Reason Details with the reason // retrieving the Reason Details with the reason
@GetMapping("/getReasonByName") @GetMapping("/getReasonByName")
public ResponseEntity<?> getReasonByName(@RequestParam String reasonName) { public ResponseEntity<?> getReasonByName(@RequestParam String reasonName) {
@ -591,9 +543,11 @@ public class OfficerAPIController {
@RequestParam("status") BookingDetails.RefundStatus status) { @RequestParam("status") BookingDetails.RefundStatus status) {
try { try {
// Update refund status preliminarily // Update refund status preliminarily
// //BookingDetails updatedBooking = bookingService.updateRefundStatus(bookingId, status);
// //BookingDetails updatedBooking =
// bookingService.updateRefundStatus(bookingId, status);
// if (updatedBooking == null) { // if (updatedBooking == null) {
// return new ResponseEntity<>("Booking not found for ID: " + bookingId, HttpStatus.NOT_FOUND);
// return new ResponseEntity<>("Booking not found for ID: " + bookingId,
// HttpStatus.NOT_FOUND);
// } // }
// Log the action // Log the action
@ -629,11 +583,11 @@ public class OfficerAPIController {
} }
} catch (Exception e) { } catch (Exception e) {
return new ResponseEntity<>("An error occurred while processing the refund for Booking ID: " + bookingId, HttpStatus.INTERNAL_SERVER_ERROR);
return new ResponseEntity<>("An error occurred while processing the refund for Booking ID: " + bookingId,
HttpStatus.INTERNAL_SERVER_ERROR);
} }
} }
@GetMapping("/bookingstatistics") @GetMapping("/bookingstatistics")
public ResponseEntity<Map<String, Map<String, Integer>>> getBookingStatistics( public ResponseEntity<Map<String, Map<String, Integer>>> getBookingStatistics(
@RequestParam(required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate fromDate, @RequestParam(required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate fromDate,
@ -643,18 +597,15 @@ public class OfficerAPIController {
@RequestParam(required = false, defaultValue = "1000") Integer hallid, @RequestParam(required = false, defaultValue = "1000") Integer hallid,
@RequestParam(required = false) String userType) { @RequestParam(required = false) String userType) {
String zone = (String) session.getAttribute("zone"); String zone = (String) session.getAttribute("zone");
Map<String, Map<String, Integer>> statistics = bookingService.getOfficerDashboard(fromDate, toDate, zone, division, hallid, userType);
Map<String, Map<String, Integer>> statistics = bookingService.getOfficerDashboard(fromDate, toDate, zone,
division, hallid, userType);
return ResponseEntity.ok(statistics); return ResponseEntity.ok(statistics);
} }
@GetMapping("/getHallsDetailsByZone") @GetMapping("/getHallsDetailsByZone")
public ResponseEntity<Map<String, Object>> getHallsDetailsByZone(@RequestParam String zone)
{
public ResponseEntity<Map<String, Object>> getHallsDetailsByZone(@RequestParam String zone) {
Map<String, Object> hallzones = hallDetailService.getHallsDetailsForOfficer(zone); Map<String, Object> hallzones = hallDetailService.getHallsDetailsForOfficer(zone);
return ResponseEntity.ok(hallzones); return ResponseEntity.ok(hallzones);
@ -676,6 +627,7 @@ public class OfficerAPIController {
public List<BookingDetails> getRejectedBookingDetails() { public List<BookingDetails> getRejectedBookingDetails() {
return bookingService.getRejectedBookingDetails(); return bookingService.getRejectedBookingDetails();
} }
@GetMapping("/getwaitingforNOCapproval") @GetMapping("/getwaitingforNOCapproval")
public List<BookingDetails> getWaitingforNOCapproval() { public List<BookingDetails> getWaitingforNOCapproval() {
return bookingService.getWaitingforNOCapproval(); return bookingService.getWaitingforNOCapproval();
@ -685,4 +637,219 @@ public class OfficerAPIController {
public List<PaymentsDTO> getAllPaymentList() { public List<PaymentsDTO> getAllPaymentList() {
return paymentsService.getAllPaymentDetails(); return paymentsService.getAllPaymentDetails();
} }
// Added for GCC Blocking(New) option
@Operation(summary = "GCC Blocking REST API", description = "REST API to Block the Halls by Admin")
// GccBlocking Api
@PostMapping("/cancelAll")
public ResponseEntity<String> cancelAllBookings(
@RequestParam("fromDate") String fromDate,
@RequestParam("toDate") String toDate,
@RequestParam("hallID") String hallID,
@RequestParam("reasonforblocking") String reasonforblocking,
@RequestParam(value = "selectedBookings", required = false) List<String> selectedBookings,
@RequestParam(value = "description", required = false) String[] descriptions, // Handle descriptions
@RequestParam(value = "document", required = false) MultipartFile[] documents, // Handle documents
HttpSession session) {
// Your existing logic
String updatedBy = (String) session.getAttribute("employeeId");
// Split and convert hall IDs
List<Long> hallIdsList = Arrays.stream(hallID.split(","))
.map(Long::parseLong)
.collect(Collectors.toList());
// Call the service with descriptions and documents
bookingService.cancelAllBookings(fromDate, toDate, hallIdsList, reasonforblocking, selectedBookings, updatedBy,
descriptions, documents);
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.setLogType("Gcc Blocking for the Reason:-" + reasonforblocking);
InetAddress inetAddress;
try {
inetAddress = InetAddress.getLocalHost();
String hostname = InetAddress.getLocalHost().getHostName();
logs.setIpaddress(inetAddress.getHostAddress());
logs.setSystemName(hostname);
} catch (UnknownHostException e) {
e.printStackTrace();
}
applicationLogsRepository.save(logs);
return ResponseEntity.ok("Success");
}
@Operation(summary = "GCC Block Without Cancelling REST API", description = "REST API to Block halls without cancelling existing bookings (smart slot logic)")
@PostMapping("/blockWithoutCancel")
public ResponseEntity<String> blockWithoutCancel(
@RequestParam("fromDate") String fromDate,
@RequestParam("toDate") String toDate,
@RequestParam("hallID") String hallID,
@RequestParam("reasonforblocking") String reasonforblocking,
@RequestParam(value = "description", required = false) String[] descriptions,
@RequestParam(value = "document", required = false) MultipartFile[] documents,
HttpSession session) {
String updatedBy = (String) session.getAttribute("employeeId");
List<Long> hallIdsList = Arrays.stream(hallID.split(","))
.map(Long::parseLong)
.collect(Collectors.toList());
bookingService.blockWithoutCancellingBookings(fromDate, toDate, hallIdsList, reasonforblocking,
updatedBy, descriptions, documents);
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.setLogType("Gcc Block Without Cancel for the Reason:-" + reasonforblocking);
InetAddress inetAddress;
try {
inetAddress = InetAddress.getLocalHost();
String hostname = InetAddress.getLocalHost().getHostName();
logs.setIpaddress(inetAddress.getHostAddress());
logs.setSystemName(hostname);
} catch (UnknownHostException e) {
e.printStackTrace();
}
applicationLogsRepository.save(logs);
return ResponseEntity.ok("Success");
}
@GetMapping("/filter")
public ResponseEntity<Map<String, Object>> getFilteredBookings(
@RequestParam("fromDate") @DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate fromDate,
@RequestParam("toDate") @DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate toDate,
@RequestParam("hallIds") List<Long> hallIds) {
List<BookingDetails> bookings = bookingService.getFilteredBookings(fromDate, toDate, hallIds);
List<GccBlockingDate> gccBlockedList = blockingDateRepository
.findByFromDateAndToDateBetweenAndHallIdIn(fromDate, toDate, hallIds);
Map<String, Object> response = new HashMap<>();
response.put("bookings", bookings);
response.put("blockedEvents", gccBlockedList);
return ResponseEntity.ok(response);
}
@Operation(summary = "UNBLOCK the gcc Blocked Event REST API", description = "REST API to unblocking the Gcc blocked Events for blocking")
@GetMapping("/cancelByid")
public ResponseEntity<String> cancellationById(@RequestParam int blockingId,
@RequestParam("fromDate") @DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate fromDate,
@RequestParam("endDate") @DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate endDate) {
// Fetch the blocking date entity
GccBlockingDate blockingDate = blockingDateRepository.findById(blockingId).orElse(null);
if (blockingDate == null) {
return ResponseEntity.status(HttpStatus.NOT_FOUND).body("Blocking ID not found.");
}
// Get the booking IDs from the blocking date entity (may be null/empty for
// block-only entries)
String bookingIds = blockingDate.getBookingIds();
String hallIds = blockingDate.getHallId();
// Parse booking IDs only if present
List<Integer> bookingIdList = (bookingIds != null && !bookingIds.trim().isEmpty())
? Arrays.stream(bookingIds.split(","))
.map(String::trim)
.filter(s -> !s.isEmpty())
.map(Integer::parseInt)
.collect(Collectors.toList())
: Collections.emptyList();
// Convert the hall IDs to a list of longs if provided
List<Long> hallIdList = (hallIds != null && !hallIds.trim().isEmpty())
? Arrays.stream(hallIds.split(","))
.map(Long::parseLong)
.collect(Collectors.toList())
: Collections.emptyList();
// Fetch the booking calendar entries within the date range
List<BookingCalendar> bookingCalendars = bookingService.getBookedslots(fromDate, endDate, hallIdList);
// ── Smart unblock: per-slot decision ──────────────────────────────────
// If morning+evening+is_blocked are all true AND an APPROVED user booking
// exists for that hall/date → only clear is_blocked (leave slots intact).
// Otherwise (GCC-owned slot) → clear everything.
for (BookingCalendar bookingslots : bookingCalendars) {
if (bookingslots.isMorningSlot() && bookingslots.isEveningSlot() && bookingslots.getIs_blocked()) {
List<BookingDetails> approvedBookings = bookingDetailsRepository.findByHallIdAndDate(
bookingslots.getBdate(), bookingslots.getHallId());
if (!approvedBookings.isEmpty()) {
// Approved user booking owns the slots — only remove gcc flag
bookingslots.setIs_blocked(false);
} else {
// GCC owned this slot fully — release everything
bookingslots.setBookingId_1(null);
bookingslots.setBookingId_2(null);
bookingslots.setMorningSlot(false);
bookingslots.setEveningSlot(false);
bookingslots.setIs_blocked(false);
}
} else {
// Partial slot scenario — only clear the gcc overlay flag
bookingslots.setIs_blocked(false);
}
bookingCalendarRepository.save(bookingslots);
}
blockingDate.setBlockedStatus(GccBlockingDate.BlockedStatus.UNBLOCKED);
blockingDateRepository.save(blockingDate);
// Update GCC_BLOCKED booking_details entries back to GCC_UNBLOCKED
for (int bookingId : bookingIdList) {
Optional<BookingDetails> bookingDetails = bookingDetailsRepository.findById(bookingId);
if (bookingDetails.isPresent()) {
BookingDetails bookings = bookingDetails.get();
if (bookings.getBookingStatus() == BookingDetails.BookingStatus.GCC_BLOCKED) {
bookings.setBookingStatus(BookingDetails.BookingStatus.GCC_UNBLOCKED);
bookings.setRefundStatus(BookingDetails.RefundStatus.NA);
bookingDetailsRepository.save(bookings);
}
}
}
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.setLogType("Gcc UnBlocking for the Id:-" + blockingDate.getBlockingId());
InetAddress inetAddress;
try {
inetAddress = InetAddress.getLocalHost();
String hostname = InetAddress.getLocalHost().getHostName();
logs.setIpaddress(inetAddress.getHostAddress());
logs.setSystemName(hostname);
} catch (UnknownHostException e) {
e.printStackTrace();
}
applicationLogsRepository.save(logs);
return ResponseEntity.ok("Success");
}
@Operation(summary = " GCC Blocked Booking Details REST API", description = "REST API to get the GCC Blocked BookingDetails")
// retrieving the GCC Blocked BookingDetails
@GetMapping("/blockedevents")
public ResponseEntity<List<GccBlockingDate>> getBlockedEvents() {
List<GccBlockingDate> blockedBookings = bookingService.getBlockedEvents();
if (blockedBookings.isEmpty()) {
// System.out.println("No blocked bookings found.");
return ResponseEntity.ok(blockedBookings);
}
for (GccBlockingDate blockedBooking : blockedBookings) {
// System.out.println("Blocked Event: " + blockedBooking);
}
return ResponseEntity.ok(blockedBookings);
}
} }

20
src/main/java/com/gcc/communityHall/controller/OfficerController.java

@ -629,4 +629,24 @@ public class OfficerController {
Set<Object> seen = new HashSet<>(); Set<Object> seen = new HashSet<>();
return t -> seen.add(keyExtractor.apply(t)); return t -> seen.add(keyExtractor.apply(t));
} }
// ── New enhanced GCC Blocking page (does NOT affect the existing page) ──
@GetMapping("/GccblockingNew")
public String viewGccBlockingNew(Model model, HttpSession session) {
String officername = (String) session.getAttribute("usertype");
if (officername != null && "officer".equals(officername)) {
long mobileno = (long) session.getAttribute("mobileno");
model.addAttribute("mobileno", mobileno);
model.addAttribute("officername", officername);
String zone = (String) session.getAttribute("zone");
List<Integer> hallIds = (List<Integer>) session.getAttribute("hall_ids");
model.addAttribute("zone", zone);
model.addAttribute("hallIds", hallIds);
System.out.println("zone" + zone + "\nhallIds.." + hallIds);
return "officer/gccblocking-new";
} else {
session.invalidate();
return "redirect:/communityhall/login";
}
}
} }

58
src/main/java/com/gcc/communityHall/controller/UserAPIController.java

@ -224,8 +224,8 @@ public class UserAPIController {
// System.out.println(purpose); // System.out.println(purpose);
// System.out.print("\n MobileNo---:"+mobileNo); // System.out.print("\n MobileNo---:"+mobileNo);
Random rand = new Random(); Random rand = new Random();
// int otp = rand.nextInt(90000) + 10000;
int otp = 11111;
int otp = rand.nextInt(90000) + 10000;
// int otp = 11111;
System.out.print("\n otp---:" + otp); System.out.print("\n otp---:" + otp);
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("dd-MMM-yyyy%20HH:mm"); DateTimeFormatter dtf = DateTimeFormatter.ofPattern("dd-MMM-yyyy%20HH:mm");
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now();
@ -238,31 +238,30 @@ public class UserAPIController {
System.out.println(urlString); System.out.println(urlString);
System.out.println("\n urlString---: " + urlString); System.out.println("\n urlString---: " + urlString);
String bodyMessage = "" + otp; String bodyMessage = "" + otp;
/*
* try {
* RestTemplate restTemplate = new RestTemplate();
* String Response = restTemplate.getForObject(urlString, String.class);
* bodyMessage = Response;
* SmsSender sms = new SmsSender();
* sms.setPhone(MobileNo);
* sms.setCdate(new Date());
* sms.setBodyMsg(bodyMessage);
* sms.setPurpose(purpose);
* smsSenderRepository.save(sms);
*
* String whatsappMsg =
* "https://media.smsgupshup.com/GatewayAPI/rest?userid=2000233507&password=h2YjFNcJ&send_to="
* + MobileNo
* +
* "&v=1.1&format=json&msg_type=TEXT&method=SENDMESSAGE&msg=Welcome+to+GCC%21+%0A%0AYour+OTP+for+GCC+Community+Centre+is+"
* + otp + "+.";
* String sendMsg = whatsappMsgServiceImpl.sendMsg(whatsappMsg);
* System.out.println("sendwhatsuprepsosne====" + sendMsg);
* } catch (Exception e) {
* // System.out.print("ERROR in Sending---: "+e);
* bodyMessage = "Error";
* }
*/
try {
RestTemplate restTemplate = new RestTemplate();
String Response = restTemplate.getForObject(urlString, String.class);
bodyMessage = Response;
SmsSender sms = new SmsSender();
sms.setPhone(MobileNo);
sms.setCdate(new Date());
sms.setBodyMsg(bodyMessage);
sms.setPurpose(purpose);
smsSenderRepository.save(sms);
String whatsappMsg = "https://media.smsgupshup.com/GatewayAPI/rest?userid=2000233507&password=h2YjFNcJ&send_to="
+ MobileNo
+
"&v=1.1&format=json&msg_type=TEXT&method=SENDMESSAGE&msg=Welcome+to+GCC%21+%0A%0AYour+OTP+for+GCC+Community+Centre+is+"
+ otp + "+.";
String sendMsg = whatsappMsgServiceImpl.sendMsg(whatsappMsg);
System.out.println("sendwhatsuprepsosne====" + sendMsg);
} catch (Exception e) {
// System.out.print("ERROR in Sending---: "+e);
bodyMessage = "Error";
}
HttpSession session = request.getSession(); HttpSession session = request.getSession();
session.setAttribute("otp", otp); session.setAttribute("otp", otp);
return bodyMessage; return bodyMessage;
@ -411,9 +410,8 @@ public class UserAPIController {
@Operation(summary = "Past Data from the booking Calendar Hall REST API", description = "REST API to Retrieve the Pat Data from booking calendar") @Operation(summary = "Past Data from the booking Calendar Hall REST API", description = "REST API to Retrieve the Pat Data from booking calendar")
// Getting the Past Data from the Calendar // Getting the Past Data from the Calendar
@GetMapping("/getPastData") @GetMapping("/getPastData")
public List<BookingCalendar> getPastData(@RequestParam("hall_id") int hall_id) {
List<BookingCalendar> data = new ArrayList();
data = bookingService.getPastData(hall_id);
public List<Map<String, Object>> getPastData(@RequestParam("hall_id") int hall_id) {
List<Map<String, Object>> data = bookingService.getPastData(hall_id);
if (data != null) { if (data != null) {
return data; return data;
} }

28
src/main/java/com/gcc/communityHall/entity/FloorDetails.java

@ -13,12 +13,14 @@ import jakarta.persistence.ManyToOne;
@Entity @Entity
public class FloorDetails { public class FloorDetails {
@Id @Id
@GeneratedValue(strategy = GenerationType.IDENTITY) @GeneratedValue(strategy = GenerationType.IDENTITY)
private int floorId; private int floorId;
@Column(name = "floor") @Column(name = "floor")
private String floor; private String floor;
@ManyToOne(cascade = CascadeType.PERSIST, fetch = FetchType.LAZY) @ManyToOne(cascade = CascadeType.PERSIST, fetch = FetchType.LAZY)
@JsonIgnore @JsonIgnore
private HallDetails hallDetails; private HallDetails hallDetails;
@ -26,6 +28,13 @@ public class FloorDetails {
@Column(name = "area") @Column(name = "area")
private double hallarea; private double hallarea;
@Column(name = "is_active", nullable = false, columnDefinition = "BOOLEAN DEFAULT true")
private boolean isActive = true;
@Column(name = "is_delete", nullable = false, columnDefinition = "BOOLEAN DEFAULT false")
private boolean isDelete = false;
// ── Getters & Setters ──────────────────────────────────────────────────────
public HallDetails getHallDetails() { public HallDetails getHallDetails() {
return hallDetails; return hallDetails;
@ -59,6 +68,24 @@ public class FloorDetails {
this.hallarea = hallarea; this.hallarea = hallarea;
} }
public boolean isActive() {
return isActive;
}
public void setActive(boolean isActive) {
this.isActive = isActive;
}
public boolean isDelete() {
return isDelete;
}
public void setDelete(boolean isDelete) {
this.isDelete = isDelete;
}
// ── Constructors ───────────────────────────────────────────────────────────
public FloorDetails(int floorId, String floor, HallDetails hallDetails, double hallarea) { public FloorDetails(int floorId, String floor, HallDetails hallDetails, double hallarea) {
super(); super();
this.floorId = floorId; this.floorId = floorId;
@ -70,5 +97,4 @@ public class FloorDetails {
public FloorDetails() { public FloorDetails() {
super(); super();
} }
} }

2
src/main/java/com/gcc/communityHall/entity/HallDetails.java

@ -5,6 +5,7 @@ import java.util.Date;
import java.util.List; import java.util.List;
import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnore;
import org.hibernate.annotations.SQLRestriction;
import jakarta.persistence.CascadeType; import jakarta.persistence.CascadeType;
import jakarta.persistence.Column; import jakarta.persistence.Column;
@ -45,6 +46,7 @@ public class HallDetails {
private List<HallImages> hallImagesList; private List<HallImages> hallImagesList;
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy = "hallDetails") @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy = "hallDetails")
@SQLRestriction("is_active = true AND is_delete = false")
private List<FloorDetails> floorDetailsList; private List<FloorDetails> floorDetailsList;
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy = "hallDetails") @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy = "hallDetails")

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

@ -11,30 +11,32 @@ import org.springframework.stereotype.Repository;
import com.gcc.communityHall.paymentService.entity.TransactionResponse; import com.gcc.communityHall.paymentService.entity.TransactionResponse;
@Repository @Repository
public interface TransactionResponseRepository extends JpaRepository<TransactionResponse, Integer> { public interface TransactionResponseRepository extends JpaRepository<TransactionResponse, Integer> {
Optional<TransactionResponse> findByBookingId(int bookingId); Optional<TransactionResponse> findByBookingId(int bookingId);
List<TransactionResponse> findByuserId(String userId); List<TransactionResponse> findByuserId(String userId);
Optional<TransactionResponse> findByTxansactionId(String txansactionId); Optional<TransactionResponse> findByTxansactionId(String txansactionId);
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 " +
@Query(value = "SELECT tr.booking_id, tr.hall_id, tr.amount, tr.status_code, tr.txansaction_id, tr.user_id, tr.tpsl_txn_id "
+
// ", p.payment_status " + // ", 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 " +
// "LEFT JOIN payments p ON tr.booking_id = p.booking_details_booking_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 " + "LEFT JOIN booking_details bd ON tr.booking_id = bd.booking_id " +
"WHERE DATE(STR_TO_DATE(tr.cdate, '%Y-%m-%d')) >= STR_TO_DATE(:fromDate, '%Y-%m-%d') " + "WHERE DATE(STR_TO_DATE(tr.cdate, '%Y-%m-%d')) >= STR_TO_DATE(:fromDate, '%Y-%m-%d') " +
// "WHERE DATE(STR_TO_DATE(tr.cdate, '%d-%m-%Y %H:%i:%s')) >= STR_TO_DATE(:fromDate, '%Y-%m-%d') " +
// "WHERE DATE(STR_TO_DATE(tr.cdate, '%d-%m-%Y %H:%i:%s')) >=
// STR_TO_DATE(:fromDate, '%Y-%m-%d') " +
"AND DATE(STR_TO_DATE(tr.cdate, '%Y-%m-%d')) <= STR_TO_DATE(:toDate, '%Y-%m-%d') " + "AND DATE(STR_TO_DATE(tr.cdate, '%Y-%m-%d')) <= STR_TO_DATE(:toDate, '%Y-%m-%d') " +
"AND (:bookingId IS NULL OR tr.booking_id = :bookingId) " + "AND (:bookingId IS NULL OR tr.booking_id = :bookingId) " +
"AND (:hallId IS NULL OR tr.hall_id = :hallId)", nativeQuery = true) "AND (:hallId IS NULL OR tr.hall_id = :hallId)", nativeQuery = true)
@ -43,19 +45,38 @@ public interface TransactionResponseRepository extends JpaRepository<Transaction
@Param("bookingId") Long bookingId, @Param("bookingId") Long bookingId,
@Param("hallId") Long hallId); @Param("hallId") Long hallId);
// @Transactional // @Transactional
// @Query (value = "UPDATE transaction_response SET amount = :amount, booking_id =:booking_id , date = :date, hall_id = :hall_id, response = :response, status_code = :status_code, tpsl_txn_id = :tpsl_txn_id, txansaction_id = :txansaction_id, user_id = :user_id WHERE (id = :id)",nativeQuery = true)
// void updateTransactionResponse ( @Param("id") Integer id, @Param("amount") String amount, @Param("booking_id") int booking_id ,@Param("date" ) String date,@Param("hall_id" ) int hall_id ,@Param("response")String response,@Param("status_code")String status_code,@Param("tpsl_txn_id")String tpsl_txn_id,@Param("txansaction_id")String txansaction_id,@Param("user_id")String user_id );
// TransactionResponse saveTransactionResponse(Integer id, String amount, int bookingId, String date, int hallId, String response,
// @Query (value = "UPDATE transaction_response SET amount = :amount, booking_id
// =:booking_id , date = :date, hall_id = :hall_id, response = :response,
// status_code = :status_code, tpsl_txn_id = :tpsl_txn_id, txansaction_id =
// :txansaction_id, user_id = :user_id WHERE (id = :id)",nativeQuery = true)
// void updateTransactionResponse ( @Param("id") Integer id, @Param("amount")
// String amount, @Param("booking_id") int booking_id ,@Param("date" ) String
// date,@Param("hall_id" ) int hall_id ,@Param("response")String
// response,@Param("status_code")String status_code,@Param("tpsl_txn_id")String
// tpsl_txn_id,@Param("txansaction_id")String
// txansaction_id,@Param("user_id")String user_id );
// TransactionResponse saveTransactionResponse(Integer id, String amount, int
// bookingId, String date, int hallId, String response,
// String statusCode, String tpslTxnId, String txansactionId, String userId); // String statusCode, String tpslTxnId, String txansactionId, String userId);
// @Query(value = "INSERT INTO transaction_response ('id','amount','booking_id','date','hall_id','response','status_code','tpsl_txn_id','txansaction_id','user_id') VALUES (:id, :amount, :booking_id, :date, :hall_id, :response, :status_code, :tpsl_txn_id, :txansaction_id, :user_id)", nativeQuery = true)
// void saveTransactionResponse(@Param("id") int id, @Param("amount") String amount, @Param("booking_id") int booking_id ,@Param("date" ) String date,@Param("hall_id" ) int hall_id ,@Param("response")String response,@Param("status_code")String status_code,@Param("tpsl_txn_id")String tpsl_txn_id,@Param("txansaction_id")String txansaction_id,@Param("user_id")String user_id );
// @Query(value = "INSERT INTO transaction_response
// ('id','amount','booking_id','date','hall_id','response','status_code','tpsl_txn_id','txansaction_id','user_id')
// VALUES (:id, :amount, :booking_id, :date, :hall_id, :response, :status_code,
// :tpsl_txn_id, :txansaction_id, :user_id)", nativeQuery = true)
// void saveTransactionResponse(@Param("id") int id, @Param("amount") String
// amount, @Param("booking_id") int booking_id ,@Param("date" ) String
// date,@Param("hall_id" ) int hall_id ,@Param("response")String
// response,@Param("status_code")String status_code,@Param("tpsl_txn_id")String
// tpsl_txn_id,@Param("txansaction_id")String
// txansaction_id,@Param("user_id")String user_id );
// //
//@Query (value = "UPDATE transaction_response SET 'amount' = :amount, 'booking_id' =:booking_id , 'date' = :date, 'hall_id' = :hall_id, 'response' = :response, 'status_code' = :status_code, 'tpsl_txn_id' = :tpsl_txn_id, 'txansaction_id' = :txansaction_id, 'user_id' = :user_id WHERE ('id' = :id)", nativeQuery = true)
// @Query (value = "UPDATE transaction_response SET 'amount' = :amount,
// 'booking_id' =:booking_id , 'date' = :date, 'hall_id' = :hall_id, 'response'
// = :response, 'status_code' = :status_code, 'tpsl_txn_id' = :tpsl_txn_id,
// 'txansaction_id' = :txansaction_id, 'user_id' = :user_id WHERE ('id' = :id)",
// nativeQuery = true)
@Query(value = "SELECT tr.id, tr.amount, tr.booking_id, tr.hall_id, tr.response, tr.status_code, " + @Query(value = "SELECT tr.id, tr.amount, tr.booking_id, tr.hall_id, tr.response, tr.status_code, " +
"tr.tpsl_txn_id, tr.txansaction_id, tr.user_id, bd.booking_date " + "tr.tpsl_txn_id, tr.txansaction_id, tr.user_id, bd.booking_date " +
@ -64,8 +85,8 @@ public interface TransactionResponseRepository extends JpaRepository<Transaction
"WHERE tr.status_code = ? AND bd.booking_date < DATE_SUB(CURDATE(), INTERVAL 2 DAY", nativeQuery = true) "WHERE tr.status_code = ? AND bd.booking_date < DATE_SUB(CURDATE(), INTERVAL 2 DAY", nativeQuery = true)
List<Map<String, Object>> getTransactionResponseByStatus(String status); List<Map<String, Object>> getTransactionResponseByStatus(String status);
@Query(value = "SELECT tr.id, tr.amount, tr.booking_id, tr.hall_id, tr.response, tr.tpsl_txn_id, tr.txansaction_id, tr.cdate, " +
@Query(value = "SELECT tr.id, tr.amount, tr.booking_id, tr.hall_id, tr.response, tr.tpsl_txn_id, tr.txansaction_id, tr.cdate, "
+
"tr.user_id, bd.booking_date FROM transaction_response tr " + "tr.user_id, bd.booking_date FROM transaction_response tr " +
"INNER JOIN booking_details bd ON tr.booking_id = bd.booking_id " + "INNER JOIN booking_details bd ON tr.booking_id = bd.booking_id " +
"WHERE tr.status_code = 'temp' AND tr.cdate < DATE_SUB(NOW(), INTERVAL 1 HOUR);", nativeQuery = true) "WHERE tr.status_code = 'temp' AND tr.cdate < DATE_SUB(NOW(), INTERVAL 1 HOUR);", nativeQuery = true)

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

@ -31,9 +31,18 @@ public interface BookingCalendarRepository extends JpaRepository<BookingCalendar
BookingCalendar findByBdateAndHallId(LocalDate bdate, int hallId); BookingCalendar findByBdateAndHallId(LocalDate bdate, int hallId);
@Query(value=" select * FROM booking_calendar where hall_id =:hall_id AND bdate BETWEEN CURDATE() AND DATE_ADD(CURDATE(), INTERVAL 6 MONTH)", nativeQuery = true)
List<BookingCalendar> getPastData(int hall_id);
// @Query(value=" select * FROM booking_calendar where hall_id =:hall_id AND
// bdate BETWEEN CURDATE() AND DATE_ADD(CURDATE(), INTERVAL 6 MONTH)",
// nativeQuery = true)
// List<BookingCalendar> getPastData(int hall_id);
@Query(value = "select bc.bdate, bc.morning_slot, bc.evening_slot, bc.is_blocked , ifnull(bd1.booking_status,'NA') as booking_status1, "
+
"ifnull(bd2.booking_status,'NA') as booking_status2 FROM booking_calendar bc " +
"left join booking_details bd1 on bc.booking_id_1 = bd1.booking_id " +
"left join booking_details bd2 on bc.booking_id_2 = bd2.booking_id " +
"where bc.hall_id =:hall_id AND bc.bdate BETWEEN CURDATE() AND DATE_ADD(CURDATE(), INTERVAL 6 MONTH)", nativeQuery = true)
List<Map<String, Object>> getPastData(int hall_id);
@Query(value = "SELECT hall_id FROM booking_calendar where (bdate BETWEEN DATE_FORMAT(:fromDate, '%Y-%m-%d') AND DATE_FORMAT(:toDate, '%Y-%m-%d')) AND hall_id = :hall_id group by hall_id", nativeQuery = true) @Query(value = "SELECT hall_id FROM booking_calendar where (bdate BETWEEN DATE_FORMAT(:fromDate, '%Y-%m-%d') AND DATE_FORMAT(:toDate, '%Y-%m-%d')) AND hall_id = :hall_id group by hall_id", nativeQuery = true)
List<Integer> groupByHallIdToRemov(String fromDate, String toDate, int hall_id); List<Integer> groupByHallIdToRemov(String fromDate, String toDate, int hall_id);
@ -53,21 +62,24 @@ public interface BookingCalendarRepository extends JpaRepository<BookingCalendar
List<Map<String, Object>> toatlBookingCount(); List<Map<String, Object>> toatlBookingCount();
@Query(value = "SELECT * FROM booking_calendar WHERE hall_id IN (:hallIdList) AND bdate BETWEEN :fromDate AND :endDate", nativeQuery = true) @Query(value = "SELECT * FROM booking_calendar WHERE hall_id IN (:hallIdList) AND bdate BETWEEN :fromDate AND :endDate", nativeQuery = true)
List<BookingCalendar> findByHallIdAndDateRange(@Param("fromDate") LocalDate fromDate, @Param("endDate") LocalDate endDate, @Param("hallIdList") List<Long> hallIdList);
List<BookingCalendar> findByHallIdAndDateRange(@Param("fromDate") LocalDate fromDate,
@Param("endDate") LocalDate endDate, @Param("hallIdList") List<Long> hallIdList);
@Modifying @Modifying
@Query("UPDATE BookingCalendar bc SET bc.bdate = :newDate WHERE (bc.bookingId_1 = :bookingId OR bc.bookingId_2 = :bookingId) AND bc.bdate = :currentDate") @Query("UPDATE BookingCalendar bc SET bc.bdate = :newDate WHERE (bc.bookingId_1 = :bookingId OR bc.bookingId_2 = :bookingId) AND bc.bdate = :currentDate")
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 " +
@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 " +
"WHERE bc.bdate >= :fromDate " + "WHERE bc.bdate >= :fromDate " +
"AND bc.bdate <= :toDate " + "AND bc.bdate <= :toDate " +
"AND (:bookingId IS NULL OR (bc.booking_id_1 = :bookingId OR bc.booking_id_2 = :bookingId)) " + "AND (:bookingId IS NULL OR (bc.booking_id_1 = :bookingId OR bc.booking_id_2 = :bookingId)) " +
"AND (:hallName = '' OR hd.hall_name = :hallName)",
nativeQuery = true)
"AND (:hallName = '' OR hd.hall_name = :hallName)", nativeQuery = true)
List<Object[]> findBookingCalendarDetails(@Param("fromDate") String fromDate, List<Object[]> findBookingCalendarDetails(@Param("fromDate") String fromDate,
@Param("toDate") String toDate, @Param("toDate") String toDate,
@Param("bookingId") Long bookingId, @Param("bookingId") Long bookingId,

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

@ -1718,4 +1718,7 @@ public interface BookingDetailsRepository extends JpaRepository<BookingDetails,
" AND bd.counter_id IS NOT NULL " + " AND bd.counter_id IS NOT NULL " +
"GROUP BY bd.counter_id, bd.hall_details_hall_id ", nativeQuery = true) "GROUP BY bd.counter_id, bd.hall_details_hall_id ", nativeQuery = true)
List<Object> getCounterWiseBookingList(String fromDate, String toDate); List<Object> getCounterWiseBookingList(String fromDate, String toDate);
@Query("select bd from BookingDetails bd where DATE(bd.startDate) = :date and bd.hallDetails.hallId = :hallId and bd.bookingStatus in ('APPROVED','WAITING_FOR_NOC','WAITING_FOR_NOC_APPROVAL') ")
List<BookingDetails> findByHallIdAndDate(@Param("date") LocalDate date, @Param("hallId") Integer hallId);
} }

20
src/main/java/com/gcc/communityHall/repository/FloorDetailsRepository.java

@ -1,10 +1,30 @@
package com.gcc.communityHall.repository; package com.gcc.communityHall.repository;
import java.util.List;
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.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import com.gcc.communityHall.entity.FloorDetails; import com.gcc.communityHall.entity.FloorDetails;
@Repository @Repository
public interface FloorDetailsRepository extends JpaRepository<FloorDetails, Integer> { public interface FloorDetailsRepository extends JpaRepository<FloorDetails, Integer> {
/** Fetch all rows (used internally only). */
List<FloorDetails> findByHallDetails_HallId(int hallId);
/** Fetch only active, non-deleted floor rows for a hall. */
List<FloorDetails> findByHallDetails_HallIdAndIsActiveAndIsDelete(int hallId, boolean isActive, boolean isDelete);
/** Soft-delete: mark existing active floors as inactive & deleted. */
@Modifying
@Query("UPDATE FloorDetails f SET f.isActive = false, f.isDelete = true " +
"WHERE f.hallDetails.hallId = :hallId AND f.isActive = true AND f.isDelete = false")
void softDeleteByHallId(@Param("hallId") int hallId);
/** Hard-delete (kept for backward-compat but no longer used in HQ flow). */
void deleteByHallDetails_HallId(int hallId);
} }

17
src/main/java/com/gcc/communityHall/repository/GccBlockingDateRepository.java

@ -17,22 +17,27 @@ import com.gcc.communityHall.entity.GccBlockingDate.BlockedStatus;
public interface GccBlockingDateRepository extends JpaRepository<GccBlockingDate, Integer> { public interface GccBlockingDateRepository extends JpaRepository<GccBlockingDate, Integer> {
@Query(value = "SELECT * FROM gcc_blocking_date WHERE hall_id IN (:hallIds) AND blocked_status = 'BLOCKED' AND start_date BETWEEN :fromDate AND :toDate ", nativeQuery = true) @Query(value = "SELECT * FROM gcc_blocking_date WHERE hall_id IN (:hallIds) AND blocked_status = 'BLOCKED' AND start_date BETWEEN :fromDate AND :toDate ", nativeQuery = true)
List<GccBlockingDate> findByFromDateAndToDateBetweenAndHallIdIn(LocalDate fromDate, LocalDate toDate, List<Long> hallIds);
List<GccBlockingDate> findByFromDateAndToDateBetweenAndHallIdIn(LocalDate fromDate, LocalDate toDate,
List<Long> hallIds);
@Query("SELECT g FROM GccBlockingDate g WHERE g.hallId = :hallId AND g.blockedStatus = :blockedStatus") @Query("SELECT g FROM GccBlockingDate g WHERE g.hallId = :hallId AND g.blockedStatus = :blockedStatus")
List<GccBlockingDate> findAllByHallIdAndBlockedStatus(@Param("hallId") String hallId, @Param("blockedStatus") GccBlockingDate.BlockedStatus blockedStatus);
List<GccBlockingDate> findAllByHallIdAndBlockedStatus(@Param("hallId") String hallId,
@Param("blockedStatus") GccBlockingDate.BlockedStatus blockedStatus);
@Query("SELECT g FROM GccBlockingDate g WHERE g.blockedStatus = 'BLOCKED' AND g.startDate >= CURRENT_DATE")
@Query("SELECT g FROM GccBlockingDate g WHERE g.blockedStatus = 'BLOCKED' AND g.endDate >= CURRENT_DATE")
List<GccBlockingDate> findAllBlocked(); List<GccBlockingDate> findAllBlocked();
@Query("SELECT g FROM GccBlockingDate g WHERE g.blockingReason = :blockingReason AND g.startDate <= :endDate AND g.endDate >= :startDate") @Query("SELECT g FROM GccBlockingDate g WHERE g.blockingReason = :blockingReason AND g.startDate <= :endDate AND g.endDate >= :startDate")
List<GccBlockingDate> findByBlockingReasonAndDateRange( @Param("blockingReason") String blockingReason,@Param("startDate") Date startDate,@Param("endDate") Date endDate);
List<GccBlockingDate> findByBlockingReasonAndDateRange(@Param("blockingReason") String blockingReason,
@Param("startDate") Date startDate, @Param("endDate") Date endDate);
@Query("SELECT COUNT(DISTINCT g.hallId) FROM GccBlockingDate g WHERE g.blockingReason = :blockingReason AND g.startDate <= :endDate AND g.endDate >= :startDate") @Query("SELECT COUNT(DISTINCT g.hallId) FROM GccBlockingDate g WHERE g.blockingReason = :blockingReason AND g.startDate <= :endDate AND g.endDate >= :startDate")
int countBlockedHallsInDateRange(@Param("blockingReason") String blockingReason,@Param("startDate") Date startDate,@Param("endDate") Date endDate);
int countBlockedHallsInDateRange(@Param("blockingReason") String blockingReason, @Param("startDate") Date startDate,
@Param("endDate") Date endDate);
@Query("SELECT COUNT(b) FROM GccBlockingDate b WHERE b.hallId = :hallId AND b.blockedStatus = 'BLOCKED' AND b.startDate BETWEEN :startDate AND :endDate") @Query("SELECT COUNT(b) FROM GccBlockingDate b WHERE b.hallId = :hallId AND b.blockedStatus = 'BLOCKED' AND b.startDate BETWEEN :startDate AND :endDate")
int countBlockedBookings(@Param("hallId") int hallId, @Param("startDate") Date startDate, @Param("endDate") Date endDate);
int countBlockedBookings(@Param("hallId") int hallId, @Param("startDate") Date startDate,
@Param("endDate") Date endDate);
@Query(value = "SELECT * FROM gcc_blocking_date WHERE FIND_IN_SET(:bookingId, booking_ids) > 0", nativeQuery = true) @Query(value = "SELECT * FROM gcc_blocking_date WHERE FIND_IN_SET(:bookingId, booking_ids) > 0", nativeQuery = true)
List<GccBlockingDate> getByBookingId(@Param("bookingId") int bookingId); List<GccBlockingDate> getByBookingId(@Param("bookingId") int bookingId);

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

@ -1,6 +1,5 @@
package com.gcc.communityHall.service; package com.gcc.communityHall.service;
import java.time.LocalDate; import java.time.LocalDate;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@ -19,14 +18,17 @@ import com.gcc.communityHall.entity.GccBlockingDate;
public interface BookingService { public interface BookingService {
BookingDetails getBookingsById(int BookingId); BookingDetails getBookingsById(int BookingId);
// ak // ak
BookingDetails getBookingByRefId(String refId); BookingDetails getBookingByRefId(String refId);
// ak // ak
void migrateOldBookingsToRefId(); void migrateOldBookingsToRefId();
BookingDetails updateBookingDetails(BookingDetails bd); BookingDetails updateBookingDetails(BookingDetails bd);
public String confirmTheDateAndSlot(String fromDate, String toDate, int days, int fromStartingSlot, int fromEndingSlot, int toStartingSlot, int toEndingSlot, int bookingId, int userId);
public String confirmTheDateAndSlot(String fromDate, String toDate, int days, int fromStartingSlot,
int fromEndingSlot, int toStartingSlot, int toEndingSlot, int bookingId, int userId);
public Map<String, Object> saveBookingDetails(Map<String, Object> formData); public Map<String, Object> saveBookingDetails(Map<String, Object> formData);
@ -45,7 +47,6 @@ public interface BookingService {
public BookingDetails getBookingDetailsWithSettlement(int settlementId); public BookingDetails getBookingDetailsWithSettlement(int settlementId);
// sreeja // sreeja
List<BookingDetails> getPresentsEventsByUserId(Integer hallId); List<BookingDetails> getPresentsEventsByUserId(Integer hallId);
@ -57,7 +58,7 @@ public interface BookingService {
public List<BookingDetails> getFilteredBookings(LocalDate fromDate, LocalDate toDate, List<Long> hallIds); public List<BookingDetails> getFilteredBookings(LocalDate fromDate, LocalDate toDate, List<Long> hallIds);
public List<BookingCalendar> getPastData(int hall_id);
public List<Map<String, Object>> getPastData(int hall_id);
public String processEbDetailsAndDamage( public String processEbDetailsAndDamage(
int bookingId, int ebId, int bookingId, int ebId,
@ -71,8 +72,8 @@ public interface BookingService {
List<Map<String, Object>> getAllBookingEventsByUserId(Integer userId); List<Map<String, Object>> getAllBookingEventsByUserId(Integer userId);
//List<BookingDetails> getAllBookingDetailsWithStatus(String fromDate, String toDate, String bookingStatus);
// List<BookingDetails> getAllBookingDetailsWithStatus(String fromDate, String
// toDate, String bookingStatus);
// List<Object[]> getAllPaymentsDetails( String fromDate, String toDate); // List<Object[]> getAllPaymentsDetails( String fromDate, String toDate);
@ -93,7 +94,8 @@ public interface BookingService {
// officer service // officer service
List<BookingDetails> getAllBookingDetailsByZone(String fromDate, String toDate, String zone); List<BookingDetails> getAllBookingDetailsByZone(String fromDate, String toDate, String zone);
List<BookingDetails> getAllBookingDetailsByZoneWithStatus(String fromDate, String toDate, String zone, String bookingStatus);
List<BookingDetails> getAllBookingDetailsByZoneWithStatus(String fromDate, String toDate, String zone,
String bookingStatus);
List<Object[]> getAllPaymentsDetailsByZone(String fromDate, String toDate, String zone); List<Object[]> getAllPaymentsDetailsByZone(String fromDate, String toDate, String zone);
@ -109,67 +111,91 @@ public interface BookingService {
@Transactional @Transactional
void cancelAllBookings(String fromDate, String toDate, List<Long> hallIdsList, void cancelAllBookings(String fromDate, String toDate, List<Long> hallIdsList,
String reasonforblocking, List<String> selectedBookings, String updatedBy, String[] descriptions, MultipartFile[] documents);
String reasonforblocking, List<String> selectedBookings, String updatedBy, String[] descriptions,
MultipartFile[] documents);
@Transactional
void blockWithoutCancellingBookings(String fromDate, String toDate, List<Long> hallIdsList,
String reasonforblocking, String updatedBy, String[] descriptions,
MultipartFile[] documents);
List<BookingDetails> findBookingDetailsByBookingId(Long bookingId); List<BookingDetails> findBookingDetailsByBookingId(Long bookingId);
// admin dashboard // admin dashboard
Map<String, Map<String, Integer>> getBookingStatistics(LocalDate fromDate, LocalDate toDate, String zone, String division, Integer hallid, String userType);
Map<String, Map<String, Integer>> getBookingStatistics(LocalDate fromDate, LocalDate toDate, String zone,
String division, Integer hallid, String userType);
public List<Map<String, Object>> getBookingDetailsByHallId(int hallId); public List<Map<String, Object>> getBookingDetailsByHallId(int hallId);
// officer dashboard // officer dashboard
Map<String, Map<String, Integer>> getOfficerDashboard(LocalDate fromDate, LocalDate toDate, String zone, String division, Integer hallid, String userType);
Map<String, Map<String, Integer>> getOfficerDashboard(LocalDate fromDate, LocalDate toDate, String zone,
String division, Integer hallid, String userType);
List<Map<String, Object>> getHallDetailsForOfficer(Integer hallIid); List<Map<String, Object>> getHallDetailsForOfficer(Integer hallIid);
//List<Object[]> getAllPaymentsDetails(String fromDate, String toDate, String paymentStatus);
// List<Object[]> getAllPaymentsDetails(String fromDate, String toDate, String
// paymentStatus);
// admin reports // admin reports
List<Object[]> getBookingDetailsByBookingDate(String fromDate, String toDate, String zone, String division, Integer hallid);
List<Object[]> getBookingDetailsByBookingDate(String fromDate, String toDate, String zone, String division,
Integer hallid);
List<Object[]> getBookingDetailsByEventDate(String fromDate, String toDate, String zone, String division, Integer hallid);
List<Object[]> getBookingDetailsByEventDate(String fromDate, String toDate, String zone, String division,
Integer hallid);
List<Object[]> getBookingDetailsByBookingDateWithStatus(String fromDate, String toDate, String bookingStatus, String zone, String division, Integer hallid);
List<Object[]> getBookingDetailsByBookingDateWithStatus(String fromDate, String toDate, String bookingStatus,
String zone, String division, Integer hallid);
List<Object[]> getBookingDetailsByEventDateWithStatus(String fromDate, String toDate, String bookingStatus, String zone, String division, Integer hallid);
List<Object[]> getBookingDetailsByEventDateWithStatus(String fromDate, String toDate, String bookingStatus,
String zone, String division, Integer hallid);
List<Object[]> getAllPaymentsDetails(String fromDate, String toDate, String paymentStatus, String zone, String division, Integer hallid);
List<Object[]> getAllPaymentsDetails(String fromDate, String toDate, String paymentStatus, String zone,
String division, Integer hallid);
List<Object[]> getBookingHallDetailsReportByBookingDate(String fromDate, String toDate, String zone, String division, Integer hallid);
List<Object[]> getBookingHallDetailsReportByBookingDate(String fromDate, String toDate, String zone, String division,
Integer hallid);
List<Object[]> getBookingHallDetailsReportByEventDate(String fromDate, String toDate, String zone, String division, Integer hallid);
List<Object[]> getBookingHallDetailsReportByEventDate(String fromDate, String toDate, String zone, String division,
Integer hallid);
List<BookingDetails> getAllBookingsettlementDetailsByBookingDate(String fromDate, String toDate); List<BookingDetails> getAllBookingsettlementDetailsByBookingDate(String fromDate, String toDate);
List<BookingDetails> getAllBookingsettlementDetailsByBookingDateWithStatus(String fromDate, String toDate, String refundStatus);
List<BookingDetails> getAllBookingsettlementDetailsByBookingDateWithStatus(String fromDate, String toDate,
String refundStatus);
List<BookingDetails> getAllBookingsettlementDetailsByEventDate(String fromDate, String toDate); List<BookingDetails> getAllBookingsettlementDetailsByEventDate(String fromDate, String toDate);
List<BookingDetails> getAllBookingsettlementDetailsByEventDateWithStatus(String fromDate, String toDate, String refundStatus);
List<BookingDetails> getAllBookingsettlementDetailsByEventDateWithStatus(String fromDate, String toDate,
String refundStatus);
List<BookingDetails> getAllBookingDetailsBookingDateByZone(String fromDate, String toDate, String zone); List<BookingDetails> getAllBookingDetailsBookingDateByZone(String fromDate, String toDate, String zone);
List<BookingDetails> getAllBookingDetailsEventDateByZone(String fromDate, String toDate, String zone); List<BookingDetails> getAllBookingDetailsEventDateByZone(String fromDate, String toDate, String zone);
List<BookingDetails> getAllBookingDetailsBookingDateByZoneWithStatus(String fromDate, String toDate, String zone, String bookingStatus);
List<BookingDetails> getAllBookingDetailsBookingDateByZoneWithStatus(String fromDate, String toDate, String zone,
String bookingStatus);
List<BookingDetails> getAllBookingDetailsEventDateByZoneWithStatus(String fromDate, String toDate, String zone, String bookingStatus);
List<BookingDetails> getAllBookingDetailsEventDateByZoneWithStatus(String fromDate, String toDate, String zone,
String bookingStatus);
List<BookingDetails> getAllBookingsettlementDetailsByZoneByBookingDate(String fromDate, String toDate, String zone); List<BookingDetails> getAllBookingsettlementDetailsByZoneByBookingDate(String fromDate, String toDate, String zone);
List<BookingDetails> getAllBookingsettlementDetailsByZoneByEventDate(String fromDate, String toDate, String zone); List<BookingDetails> getAllBookingsettlementDetailsByZoneByEventDate(String fromDate, String toDate, String zone);
List<BookingDetails> getAllBookingsettlementDetailsByZoneByBookingDateWithStatus(String fromDate, String toDate, String zone, String refundStatus);
List<BookingDetails> getAllBookingsettlementDetailsByZoneByBookingDateWithStatus(String fromDate, String toDate,
String zone, String refundStatus);
List<BookingDetails> getAllBookingsettlementDetailsByZoneByEventDateWithStatus(String fromDate, String toDate, String zone, String refundStatus);
List<BookingDetails> getAllBookingsettlementDetailsByZoneByEventDateWithStatus(String fromDate, String toDate,
String zone, String refundStatus);
List<Object[]> getBookingHallDetailsReportByZoneByBookingDate(String fromDate, String toDate, String zone); List<Object[]> getBookingHallDetailsReportByZoneByBookingDate(String fromDate, String toDate, String zone);
List<Object[]> getBookingHallDetailsReportByZoneByEventDate(String fromDate, String toDate, String zone); List<Object[]> getBookingHallDetailsReportByZoneByEventDate(String fromDate, String toDate, String zone);
List<Object[]> getBookingHallDetailsReportByZoneByBookingDateHallname(String fromDate, String toDate, String zone, Integer hallId);
List<Object[]> getBookingHallDetailsReportByZoneByBookingDateHallname(String fromDate, String toDate, String zone,
Integer hallId);
List<Object[]> getBookingHallDetailsReportByZoneByEventDateHallname(String fromDate, String toDate, String zone, Integer hallId);
List<Object[]> getBookingHallDetailsReportByZoneByEventDateHallname(String fromDate, String toDate, String zone,
Integer hallId);
BookingDetails saveebdetails(int bookingId, double startingReading, MultipartFile startingReadingimage); BookingDetails saveebdetails(int bookingId, double startingReading, MultipartFile startingReadingimage);
@ -196,7 +222,8 @@ public interface BookingService {
List<BookingDetails> getWaitingforNOCapproval(); List<BookingDetails> getWaitingforNOCapproval();
List<Object[]> getAllExtraPaymentsDetails(String fromDate, String toDate, String paymentStatus, String zone, String division, Integer hallid);
List<Object[]> getAllExtraPaymentsDetails(String fromDate, String toDate, String paymentStatus, String zone,
String division, Integer hallid);
// developer // developer
List<Object[]> getTransactionresponse(String fromDate, String toDate, Long bookingId, Long hallId); List<Object[]> getTransactionresponse(String fromDate, String toDate, Long bookingId, Long hallId);
@ -222,7 +249,10 @@ public interface BookingService {
List<Object> getAllHallWiseBookingList(String fromDate, String toDate); List<Object> getAllHallWiseBookingList(String fromDate, String toDate);
List<Object> getAllCounterWiseBookingList(String fromDate, String toDate); List<Object> getAllCounterWiseBookingList(String fromDate, String toDate);
// ak // ak
List<Object[]> getSettlementInitiatedReport(String fromDate, String toDate); List<Object[]> getSettlementInitiatedReport(String fromDate, String toDate);
List<GccBlockingDate> getBlockedEvents();
} }

35
src/main/java/com/gcc/communityHall/service/HallDetailService.java

@ -13,15 +13,17 @@ import com.gcc.communityHall.entity.HallImages;
public interface HallDetailService { public interface HallDetailService {
HallDetails saveHallDetails(HallDetails hallDetails, List<MultipartFile> hallImages); HallDetails saveHallDetails(HallDetails hallDetails, List<MultipartFile> hallImages);
HallDetails getHallById(int hallId); HallDetails getHallById(int hallId);
HallDetails deActivateHallById(int hallId); HallDetails deActivateHallById(int hallId);
HallDetails saveHall(
HallDetails saveHallByAdmin(
String hallName, String hallName,
float depositAmount, float depositAmount,
float halfDayAmt, float fullDayAmt, float halfDayAmt, float fullDayAmt,
float gst, float hallArea, String ebNumber, float ebCostPerUnit, float gst, float hallArea, String ebNumber, float ebCostPerUnit,
int parkingCapacity, int seatingCapacity,
String parkingCapacity, int seatingCapacity,
String doorNo, String street, String doorNo, String street,
String area, String zone, String area, String zone,
String division, String landMark, String division, String landMark,
@ -31,20 +33,49 @@ public interface HallDetailService {
long hallInchargeNo, long hallInchargeNo,
String updatedId, String updatedId,
MultipartFile hallImages[], float halfDepositAmt); MultipartFile hallImages[], float halfDepositAmt);
/** HQ-specific overload that also persists floor details. */
HallDetails saveHallByHQ(
String hallName,
float depositAmount,
float halfDayAmt, float fullDayAmt,
float gst, float hallArea, String ebNumber, float ebCostPerUnit,
String parkingCapacity, int seatingCapacity,
String doorNo, String street,
String area, String zone,
String division, String landMark,
String city,
int pinCode, String latitude,
String longitude, String hallInchargeName,
long hallInchargeNo,
String updatedId,
MultipartFile[] hallImages, float halfDepositAmt,
List<String> floorNames, List<Double> floorCapacities);
/** Replaces floor details for an existing hall (delete-and-re-insert). */
void updateFloorDetails(int hallId, List<String> floorNames, List<Double> floorCapacities);
List<HallImages> getHallImages(int hallId); List<HallImages> getHallImages(int hallId);
String updateHallDetail(HallDetails hallDetails, List<MultipartFile> images); String updateHallDetail(HallDetails hallDetails, List<MultipartFile> images);
List<HallDetails> removeHallById(HashSet<Integer> hallIds); List<HallDetails> removeHallById(HashSet<Integer> hallIds);
List<HallDetails> getHallNames(); List<HallDetails> getHallNames();
void saveHallImage(Long hallId, MultipartFile file) throws IOException; void saveHallImage(Long hallId, MultipartFile file) throws IOException;
List<HallImages> getHallImagesByHallId(Long hallId); List<HallImages> getHallImagesByHallId(Long hallId);
List<HallDetails> getHallNamesbyzone(String zone); List<HallDetails> getHallNamesbyzone(String zone);
public Map<String, Object> getHallsDetailsByZone(String zone); public Map<String, Object> getHallsDetailsByZone(String zone);
// officerDashboard // officerDashboard
public Map<String, Object> getHallsDetailsForOfficer(String zone); public Map<String, Object> getHallsDetailsForOfficer(String zone);
void updatenewHallImages(Integer hallId, MultipartFile[] newHallImages); void updatenewHallImages(Integer hallId, MultipartFile[] newHallImages);
String updateHallImage(Integer hallImageId, MultipartFile hallImage) throws IOException; String updateHallImage(Integer hallImageId, MultipartFile hallImage) throws IOException;
} }

250
src/main/java/com/gcc/communityHall/service/Impl/BookingServiceImpl.java

@ -1869,8 +1869,8 @@ public class BookingServiceImpl implements BookingService {
// sreeja // sreeja
@Override @Override
public List<BookingCalendar> getPastData(int hall_id) {
List<BookingCalendar> data = bookingCalendarRepository.getPastData(hall_id);
public List<Map<String, Object>> getPastData(int hall_id) {
List<Map<String, Object>> data = bookingCalendarRepository.getPastData(hall_id);
return data; return data;
} }
@ -2360,6 +2360,12 @@ public class BookingServiceImpl implements BookingService {
String reasonforblocking, List<String> selectedBookings, String updatedBy, String[] descriptions, String reasonforblocking, List<String> selectedBookings, String updatedBy, String[] descriptions,
MultipartFile[] documents) { MultipartFile[] documents) {
if (selectedBookings != null && !selectedBookings.isEmpty()) { if (selectedBookings != null && !selectedBookings.isEmpty()) {
// ── Collect cancelled user booking IDs (used later to build ONE GCC record) ──
List<Integer> cancelledBookingIds = new ArrayList<>();
// ── Phase 1: Cancel each selected booking (BookingDetails + BookingCalendar
// slots) ──
for (String bookingIdStr : selectedBookings) { for (String bookingIdStr : selectedBookings) {
Integer bookingId = Integer.parseInt(bookingIdStr); Integer bookingId = Integer.parseInt(bookingIdStr);
Optional<BookingDetails> optionalBooking = bookingDetailsRepository.findById(bookingId); Optional<BookingDetails> optionalBooking = bookingDetailsRepository.findById(bookingId);
@ -2387,7 +2393,33 @@ public class BookingServiceImpl implements BookingService {
updateBookingStatus(bb); updateBookingStatus(bb);
} }
// GCC blocking entry
updateBookingStatusById(booking.getBookingId(), BookingStatus.GCC_BLOCKED,
reasonforblocking);
// WhatsApp msg and SMS
String gccblockedsms = "Your booking ID " + bookingId + " on " + booking.getStartDate()
+ " has been blocked by GCC due to " + reasonforblocking
+ ". The entire amount paid will be refunded to your account with in 3 to 15 days.";
String gccblockedurlString = "https://tmegov.onex-aura.com/api/sms?key=pfTEYN6H&to="
+ booking.getUsers().getMobileNo() + "&from=GCCCRP&body=" + gccblockedsms
+ "&entityid=1401572690000011081&templateid=1407172346521513227";
// String
// gccblockedwhatsupmsg="https://media.smsgupshup.com/GatewayAPI/rest?userid=2000233507&password=h2YjFNcJ&send_to="+booking.getUsers().getMobileNo()+"&v=1.1&format=json&msg_type=TEXT&method=SENDMESSAGE&msg=Your+booking+with+ID+"+booking.getBookingId()+"+on+"+booking.getBookingDate()+"+has+been+blocked+by+GCC+due+to+"+reasonforblocking+".+%0AThanks+for+using+GCC+Community+Hall+Booking+System.";
String gccblockedwhatsupmsg = "https://media.smsgupshup.com/GatewayAPI/rest?userid=2000233507&password=h2YjFNcJ&send_to="
+ booking.getUsers().getMobileNo()
+ "&v=1.1&format=json&msg_type=TEXT&method=SENDMESSAGE&msg=Your+booking+with+ID+"
+ booking.getBookingId() + "+on+" + booking.getStartDate()
+ "+has+been+blocked+by+the+GCC+due+to+Goverment+event++.+%0AThe+entire+amount+paid+will+be+refunded+to+your+account+within+3+to+15+days.";
whatsappMsgServiceImpl.sendMsg(gccblockedwhatsupmsg);
whatsappMsgServiceImpl.sendSMS(gccblockedurlString);
bookingDetailsRepository.save(booking);
cancelledBookingIds.add(bookingId);
}
}
}
// ── Phase 2: Create ONE GccBlockingDate record for the entire operation ──
GccBlockingDate gcc = new GccBlockingDate(); GccBlockingDate gcc = new GccBlockingDate();
gcc.setStartDate(convertStringToDate(fromDate)); gcc.setStartDate(convertStringToDate(fromDate));
gcc.setEndDate(convertStringToDate(toDate)); gcc.setEndDate(convertStringToDate(toDate));
@ -2396,6 +2428,8 @@ public class BookingServiceImpl implements BookingService {
gcc.setUpdatedBy(updatedBy); gcc.setUpdatedBy(updatedBy);
gcc.setCdate(new Date()); gcc.setCdate(new Date());
gcc.setBlockingReason(reasonforblocking); gcc.setBlockingReason(reasonforblocking);
// Save document(s) if present
if (documents != null && documents.length > 0 && descriptions != null if (documents != null && documents.length > 0 && descriptions != null
&& descriptions.length > 0) { && descriptions.length > 0) {
int i = 0; int i = 0;
@ -2404,24 +2438,14 @@ public class BookingServiceImpl implements BookingService {
+ document.getOriginalFilename(); + document.getOriginalFilename();
String documentUrl = serverPath + "gccblockingdocs/" + gcc.getBlockingId() + "_" + i String documentUrl = serverPath + "gccblockingdocs/" + gcc.getBlockingId() + "_" + i
+ "_" + document.getOriginalFilename(); + "_" + document.getOriginalFilename();
try (FileOutputStream fos = new FileOutputStream(filePath)) { try (FileOutputStream fos = new FileOutputStream(filePath)) {
// Save document to the file system
byte[] bytes = document.getBytes(); byte[] bytes = document.getBytes();
fos.write(bytes); fos.write(bytes);
// Save document details along with description in the database
GccblockingDocuments documentDetails = new GccblockingDocuments(); // Assuming you
// have a
// DocumentDetails
// entity
documentDetails.setBlockingDate(gcc); // Assuming hallDetails is associated with the
// document
documentDetails.setBlockingDocument(documentUrl); // Save the URL of the uploaded
// document
documentDetails.setDescription(descriptions[i]); // Save corresponding description
gccblockingDocumentsRepo.save(documentDetails); // Save the document and description
// in the database
GccblockingDocuments documentDetails = new GccblockingDocuments();
documentDetails.setBlockingDate(gcc);
documentDetails.setBlockingDocument(documentUrl);
documentDetails.setDescription(descriptions[i]);
gccblockingDocumentsRepo.save(documentDetails);
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException("Failed to save document", e); throw new RuntimeException("Failed to save document", e);
} }
@ -2429,7 +2453,19 @@ public class BookingServiceImpl implements BookingService {
} }
} }
// GCC blocking History
// Save the single GCC blocking record
List<Integer> gccBookingIds = saveGCCBlockingDate(gcc);
// Store the actual cancelled user booking IDs on the gcc record
if (!cancelledBookingIds.isEmpty()) {
String cancelledIdsStr = cancelledBookingIds.stream()
.map(String::valueOf)
.collect(Collectors.joining(","));
gcc.setBookingIds(cancelledIdsStr);
gccBlockingDateRepository.save(gcc);
}
// GCC Blocking History — one entry for the whole operation
GccBlockingHistory gccblockinghistory = new GccBlockingHistory(); GccBlockingHistory gccblockinghistory = new GccBlockingHistory();
gccblockinghistory.setStartDate(convertStringToDate(fromDate)); gccblockinghistory.setStartDate(convertStringToDate(fromDate));
gccblockinghistory.setEndDate(convertStringToDate(toDate)); gccblockinghistory.setEndDate(convertStringToDate(toDate));
@ -2438,20 +2474,20 @@ public class BookingServiceImpl implements BookingService {
gccblockinghistory.setUpdatedBy(updatedBy); gccblockinghistory.setUpdatedBy(updatedBy);
gccblockinghistory.setCdate(new Date()); gccblockinghistory.setCdate(new Date());
gccblockinghistory.setBlockingReason(reasonforblocking); gccblockinghistory.setBlockingReason(reasonforblocking);
List<Integer> bookingIds = saveGCCBlockingDate(gcc);
gccblockinghistory.setBookingIds(bookingIds.toString());
gccblockinghistory.setBookingIds(cancelledBookingIds.stream()
.map(String::valueOf).collect(Collectors.joining(",")));
blockingHistoryRepository.save(gccblockinghistory); blockingHistoryRepository.save(gccblockinghistory);
// GCC calendar
// ── Phase 3: Update BookingCalendar (mark dates as GCC-blocked) ──
for (Long hallId : hallIdsList) { for (Long hallId : hallIdsList) {
LocalDate fDate = LocalDate.parse(fromDate); LocalDate fDate = LocalDate.parse(fromDate);
LocalDate tDate = LocalDate.parse(toDate); LocalDate tDate = LocalDate.parse(toDate);
List<LocalDate> dates = getDateRange(fDate, tDate); List<LocalDate> dates = getDateRange(fDate, tDate);
for (LocalDate aa : dates) { for (LocalDate aa : dates) {
String uniqueId = aa.format(DateTimeFormatter.ofPattern("yyyyMMdd")) + hallId; String uniqueId = aa.format(DateTimeFormatter.ofPattern("yyyyMMdd")) + hallId;
BookingCalendar data = getbyDates(aa, hallId.toString()); BookingCalendar data = getbyDates(aa, hallId.toString());
int userbookingbookingId = bookingIds.get(hallIdsList.indexOf(hallId));
int userbookingbookingId = gccBookingIds.get(hallIdsList.indexOf(hallId));
if (data != null) { if (data != null) {
System.out.println("uniqueId...1" + uniqueId); System.out.println("uniqueId...1" + uniqueId);
data.setBookingId_1(String.valueOf(userbookingbookingId)); data.setBookingId_1(String.valueOf(userbookingbookingId));
@ -2479,29 +2515,6 @@ public class BookingServiceImpl implements BookingService {
} }
} }
} }
updateBookingStatusById(booking.getBookingId(), booking.getBookingStatus().GCC_BLOCKED,
reasonforblocking);
// whatsup msg and SMS
String gccblockedsms = "Your booking ID " + bookingId + " on " + booking.getStartDate()
+ " has been blocked by GCC due to " + reasonforblocking
+ ". The entire amount paid will be refunded to your account with in 3 to 15 days.";
String gccblockedurlString = "https://tmegov.onex-aura.com/api/sms?key=pfTEYN6H&to="
+ booking.getUsers().getMobileNo() + "&from=GCCCRP&body=" + gccblockedsms
+ "&entityid=1401572690000011081&templateid=1407172346521513227";
// String
// gccblockedwhatsupmsg="https://media.smsgupshup.com/GatewayAPI/rest?userid=2000233507&password=h2YjFNcJ&send_to="+booking.getUsers().getMobileNo()+"&v=1.1&format=json&msg_type=TEXT&method=SENDMESSAGE&msg=Your+booking+with+ID+"+booking.getBookingId()+"+on+"+booking.getBookingDate()+"+has+been+blocked+by+GCC+due+to+"+reasonforblocking+".+%0AThanks+for+using+GCC+Community+Hall+Booking+System.";
String gccblockedwhatsupmsg = "https://media.smsgupshup.com/GatewayAPI/rest?userid=2000233507&password=h2YjFNcJ&send_to="
+ booking.getUsers().getMobileNo()
+ "&v=1.1&format=json&msg_type=TEXT&method=SENDMESSAGE&msg=Your+booking+with+ID+"
+ booking.getBookingId() + "+on+" + booking.getStartDate()
+ "+has+been+blocked+by+the+GCC+due+to+Goverment+event++.+%0AThe+entire+amount+paid+will+be+refunded+to+your+account+within+3+to+15+days.";
whatsappMsgServiceImpl.sendMsg(gccblockedwhatsupmsg);
whatsappMsgServiceImpl.sendSMS(gccblockedurlString);
bookingDetailsRepository.save(booking);
}
}
}
} else { } else {
// Create and save a new GCC blocking date record // Create and save a new GCC blocking date record
GccBlockingDate gcc = new GccBlockingDate(); GccBlockingDate gcc = new GccBlockingDate();
@ -2559,17 +2572,19 @@ public class BookingServiceImpl implements BookingService {
List<LocalDate> dates = getDateRange(fDate, tDate); List<LocalDate> dates = getDateRange(fDate, tDate);
for (LocalDate date : dates) { for (LocalDate date : dates) {
// BookingDetails bookingData =
// bookingDetailsRepository.findByHallIdAndDate(date, hallId.intValue());
BookingCalendar data = getbyDates(date, hallId.toString()); BookingCalendar data = getbyDates(date, hallId.toString());
String uniqueId = date.format(DateTimeFormatter.ofPattern("yyyyMMdd")) + hallId; String uniqueId = date.format(DateTimeFormatter.ofPattern("yyyyMMdd")) + hallId;
int userbookingbookingId = bookingIds.get(hallIdsList.indexOf(hallId)); int userbookingbookingId = bookingIds.get(hallIdsList.indexOf(hallId));
if (data != null) { if (data != null) {
System.out.println("uniqueId...11" + uniqueId); System.out.println("uniqueId...11" + uniqueId);
data.setBookingId_1(String.valueOf(userbookingbookingId));
data.setBookingId_2(String.valueOf(userbookingbookingId));
data.setMorningSlot(true);
data.setEveningSlot(true);
// data.setBookingId_1(String.valueOf(userbookingbookingId));
// data.setBookingId_2(String.valueOf(userbookingbookingId));
// data.setMorningSlot(true);
// data.setEveningSlot(true);
data.setIs_blocked(true); data.setIs_blocked(true);
data.setUnique_id(uniqueId);
// data.setUnique_id(uniqueId);
updateBookingStatus(data); updateBookingStatus(data);
} else { } else {
System.out.println("uniqueId...21" + uniqueId); System.out.println("uniqueId...21" + uniqueId);
@ -2638,6 +2653,7 @@ public class BookingServiceImpl implements BookingService {
String key = entry.get("key") != null ? (String) entry.get("key") : "total"; String key = entry.get("key") != null ? (String) entry.get("key") : "total";
Integer totalCount = entry.get("totalCount") != null ? ((Number) entry.get("totalCount")).intValue() : 0; Integer totalCount = entry.get("totalCount") != null ? ((Number) entry.get("totalCount")).intValue() : 0;
//
transformedData.putIfAbsent(category, new HashMap<>()); transformedData.putIfAbsent(category, new HashMap<>());
transformedData.get(category).put(key, totalCount); transformedData.get(category).put(key, totalCount);
@ -2664,6 +2680,7 @@ public class BookingServiceImpl implements BookingService {
: 0; : 0;
Integer futurebooking = entry.get("FUTURE_Events") != null Integer futurebooking = entry.get("FUTURE_Events") != null
? ((Number) entry.get("FUTURE_Events")).intValue() ? ((Number) entry.get("FUTURE_Events")).intValue()
//
: 0; : 0;
transformedData.get(category).put("PAST_Events", pastbooking); transformedData.get(category).put("PAST_Events", pastbooking);
transformedData.get(category).put("FUTURE_Events", futurebooking); transformedData.get(category).put("FUTURE_Events", futurebooking);
@ -2710,9 +2727,13 @@ public class BookingServiceImpl implements BookingService {
Integer mainRefundedAmount = entry.get("main_refunded_amount") != null Integer mainRefundedAmount = entry.get("main_refunded_amount") != null
? ((Number) entry.get("main_refunded_amount")).intValue() ? ((Number) entry.get("main_refunded_amount")).intValue()
: 0; : 0;
Integer mainGstAmount = entry.get("main_gst_amount") != null
? ((Number) entry.get("main_gst_amount")).intValue()
: 0;
transformedData.get(category).put("main_total_amount", mainTotalAmount); transformedData.get(category).put("main_total_amount", mainTotalAmount);
transformedData.get(category).put("main_net_amount", mainNetAmount); transformedData.get(category).put("main_net_amount", mainNetAmount);
transformedData.get(category).put("main_refunded_amount", mainRefundedAmount); transformedData.get(category).put("main_refunded_amount", mainRefundedAmount);
transformedData.get(category).put("main_gst_amount", mainGstAmount);
} }
if (category.equals("past_future")) { if (category.equals("past_future")) {
Integer pastbooking = entry.get("PAST_Events") != null ? ((Number) entry.get("PAST_Events")).intValue() Integer pastbooking = entry.get("PAST_Events") != null ? ((Number) entry.get("PAST_Events")).intValue()
@ -2726,6 +2747,7 @@ public class BookingServiceImpl implements BookingService {
} }
return transformedData; return transformedData;
} }
@Override @Override
@ -3078,4 +3100,128 @@ public class BookingServiceImpl implements BookingService {
return bookingDetailsRepository.getCounterWiseBookingList(fromDate, toDate); return bookingDetailsRepository.getCounterWiseBookingList(fromDate, toDate);
} }
@Override
public List<GccBlockingDate> getBlockedEvents() {
return blockingDateRepository.findAllBlocked();
}
@Override
@Transactional
public void blockWithoutCancellingBookings(String fromDate, String toDate, List<Long> hallIdsList,
String reasonforblocking, String updatedBy, String[] descriptions, MultipartFile[] documents) {
// 1. Create and save the GccBlockingDate record
GccBlockingDate gcc = new GccBlockingDate();
gcc.setStartDate(convertStringToDate(fromDate));
gcc.setEndDate(convertStringToDate(toDate));
gcc.setHallId(String.join(",", hallIdsList.stream().map(String::valueOf).collect(Collectors.toList())));
gcc.setUpdatedBy(updatedBy);
gcc.setCdate(new Date());
gcc.setBlockingReason(reasonforblocking);
// 2. Save documents if provided
GccBlockingDate savedGcc = gccBlockingDateRepository.save(gcc);
if (documents != null && documents.length > 0 && descriptions != null
&& descriptions.length == documents.length) {
for (int i = 0; i < documents.length; i++) {
MultipartFile document = documents[i];
String filePath = uploadDirectory + "/" + savedGcc.getBlockingId() + "_" + i + "_"
+ document.getOriginalFilename();
String documentUrl = serverPath + "gccblockingdocs/" + savedGcc.getBlockingId() + "_" + i + "_"
+ document.getOriginalFilename();
try (FileOutputStream fos = new FileOutputStream(filePath)) {
fos.write(document.getBytes());
GccblockingDocuments documentDetails = new GccblockingDocuments();
documentDetails.setBlockingDate(savedGcc);
documentDetails.setBlockingDocument(documentUrl);
documentDetails.setDescription(descriptions[i]);
gccblockingDocumentsRepo.save(documentDetails);
} catch (IOException e) {
throw new RuntimeException("Failed to save document: " + document.getOriginalFilename(), e);
}
}
}
// 3. Save GccBlockingDate entry for each hall (one booking_details row per
// hall)
// Reuse saveGCCBlockingDate so bookingIds are stored on the gcc record
List<Integer> bookingIds = saveGCCBlockingDate(gcc);
// 4. Save GccBlockingHistory
GccBlockingHistory gccblockinghistory = new GccBlockingHistory();
gccblockinghistory.setStartDate(convertStringToDate(fromDate));
gccblockinghistory.setEndDate(convertStringToDate(toDate));
gccblockinghistory
.setHallId(String.join(",", hallIdsList.stream().map(String::valueOf).collect(Collectors.toList())));
gccblockinghistory.setUpdatedBy(updatedBy);
gccblockinghistory.setCdate(new Date());
gccblockinghistory.setBlockingReason(reasonforblocking);
gccblockinghistory.setBookingIds(bookingIds.stream().map(String::valueOf).collect(Collectors.joining(",")));
blockingHistoryRepository.save(gccblockinghistory);
// 5. Iterate over each hall and each date — smart blocking per slot
for (Long hallId : hallIdsList) {
LocalDate fDate = LocalDate.parse(fromDate);
LocalDate tDate = LocalDate.parse(toDate);
List<LocalDate> dates = getDateRange(fDate, tDate);
int gccBookingId = bookingIds.get(hallIdsList.indexOf(hallId));
for (LocalDate date : dates) {
String uniqueId = date.format(DateTimeFormatter.ofPattern("yyyyMMdd")) + hallId;
// Check whether an APPROVED user booking already exists for this hall on this
// date
List<BookingDetails> approvedBookings = bookingDetailsRepository.findByHallIdAndDate(date,
hallId.intValue());
BookingCalendar calRow = getbyDates(date, hallId.toString());
if (!approvedBookings.isEmpty()) {
// ── APPROVED booking exists: only flag as blocked, leave slots intact ──
if (calRow != null) {
calRow.setIs_blocked(true);
updateBookingStatus(calRow);
} else {
// Defensive: calendar row missing for an approved booking — create minimal row
BookingCalendar minRow = new BookingCalendar();
minRow.setBdate(date);
minRow.setHallId(hallId.intValue());
minRow.setIs_blocked(true);
minRow.setIs_active(true);
minRow.setIs_booked(0);
minRow.setIs_delete(false);
minRow.setUnique_id(uniqueId);
updateBookingStatus(minRow);
}
} else {
// ── No APPROVED booking: GCC takes full slot ownership ──
if (calRow != null) {
calRow.setBookingId_1(String.valueOf(gccBookingId));
calRow.setBookingId_2(String.valueOf(gccBookingId));
calRow.setMorningSlot(true);
calRow.setEveningSlot(true);
calRow.setIs_blocked(true);
calRow.setUnique_id(uniqueId);
updateBookingStatus(calRow);
} else {
BookingCalendar book = new BookingCalendar();
book.setBdate(date);
book.setBookingId_1(String.valueOf(gccBookingId));
book.setBookingId_2(String.valueOf(gccBookingId));
book.setMorningSlot(true);
book.setEveningSlot(true);
book.setHallId(hallId.intValue());
book.setIs_active(true);
book.setIs_booked(2);
book.setIs_delete(false);
book.setIs_blocked(true);
book.setUnique_id(uniqueId);
updateBookingStatus(book);
}
}
}
}
}
} }

130
src/main/java/com/gcc/communityHall/service/Impl/HallDetailServiceImpl.java

@ -16,10 +16,13 @@ import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import com.gcc.communityHall.entity.FloorDetails;
import com.gcc.communityHall.entity.HallDetails; import com.gcc.communityHall.entity.HallDetails;
import com.gcc.communityHall.entity.HallImages; import com.gcc.communityHall.entity.HallImages;
import com.gcc.communityHall.repository.FloorDetailsRepository;
import com.gcc.communityHall.repository.HallDetailsRepository; import com.gcc.communityHall.repository.HallDetailsRepository;
import com.gcc.communityHall.repository.HallImagesRepository; import com.gcc.communityHall.repository.HallImagesRepository;
import com.gcc.communityHall.service.HallDetailService; import com.gcc.communityHall.service.HallDetailService;
@ -32,13 +35,20 @@ public class HallDetailServiceImpl implements HallDetailService {
private HallImagesRepository hallImagesRepository; private HallImagesRepository hallImagesRepository;
private final String hallDirectory; private final String hallDirectory;
private final String hallImageUrl; private final String hallImageUrl;
@Autowired
private FloorDetailsRepository floorDetailsRepository;
@Autowired @Autowired
HallDetailServiceImpl(HallDetailsRepository hallDetailsRepository, HallImagesRepository hallImagesRepository, @Value("${file.hall.upload.directory}") String hallDirectory, @Value("${file.hall.fullpath}") String hallImageUrl){
HallDetailServiceImpl(HallDetailsRepository hallDetailsRepository, HallImagesRepository hallImagesRepository,
@Value("${file.hall.upload.directory}") String hallDirectory,
@Value("${file.hall.fullpath}") String hallImageUrl) {
this.hallDetailsRepository = hallDetailsRepository; this.hallDetailsRepository = hallDetailsRepository;
this.hallDirectory = hallDirectory; this.hallDirectory = hallDirectory;
this.hallImageUrl = hallImageUrl; this.hallImageUrl = hallImageUrl;
this.hallImagesRepository = hallImagesRepository; this.hallImagesRepository = hallImagesRepository;
} }
@Override @Override
public HallDetails saveHallDetails(HallDetails hallDetails, List<MultipartFile> hallImages) { public HallDetails saveHallDetails(HallDetails hallDetails, List<MultipartFile> hallImages) {
if (hallImages.size() > 0) { if (hallImages.size() > 0) {
@ -63,10 +73,10 @@ public class HallDetailServiceImpl implements HallDetailService {
} }
@Override @Override
public HallDetails saveHall(
public HallDetails saveHallByAdmin(
String hallName, float depositAmount, float halfDayAmt, String hallName, float depositAmount, float halfDayAmt,
float fullDayAmt, float gst, float hallArea, String ebNumber, float ebCostPerUnit, float fullDayAmt, float gst, float hallArea, String ebNumber, float ebCostPerUnit,
int parkingCapacity, int seatingCapacity,
String parkingCapacity, int seatingCapacity,
String doorNo, String street, String area, String zone, String doorNo, String street, String area, String zone,
String division, String landMark, String city, int pinCode, String division, String landMark, String city, int pinCode,
String latitude, String longitude, String hallInchargeName, String latitude, String longitude, String hallInchargeName,
@ -102,8 +112,12 @@ public class HallDetailServiceImpl implements HallDetailService {
int i = 0; int i = 0;
for (MultipartFile hallImage : hallImages) { for (MultipartFile hallImage : hallImages) {
HallImages hallImages1 = new HallImages(); HallImages hallImages1 = new HallImages();
String filePath = hallDirectory+"/"+hallDetails.getHallId()+ "_"+i+"_" + hallImage.getOriginalFilename();
String imageUrl = hallImageUrl+"hallImages/"+hallDetails.getHallId()+ "_"+i+"_" + hallImage.getOriginalFilename();
String filePath = hallDirectory + "/" + hallDetails.getHallId() + "_" + i +
"_"
+ hallImage.getOriginalFilename();
String imageUrl = hallImageUrl + "hallImages/" + hallDetails.getHallId() +
"_" + i + "_"
+ hallImage.getOriginalFilename();
try (FileOutputStream fos = new FileOutputStream(filePath)) { try (FileOutputStream fos = new FileOutputStream(filePath)) {
byte[] bytes = hallImage.getBytes(); byte[] bytes = hallImage.getBytes();
fos.write(bytes); fos.write(bytes);
@ -118,6 +132,92 @@ public class HallDetailServiceImpl implements HallDetailService {
} }
return null; return null;
} }
/**
* HQ-specific overload: saves hall details + floor details in one call.
*/
@Override
public HallDetails saveHallByHQ(
String hallName, float depositAmount, float halfDayAmt,
float fullDayAmt, float gst, float hallArea, String ebNumber, float ebCostPerUnit,
String parkingCapacity, int seatingCapacity,
String doorNo, String street, String area, String zone,
String division, String landMark, String city, int pinCode,
String latitude, String longitude, String hallInchargeName,
long hallInchargeNo, String updatedId, MultipartFile[] hallImages, float halfDepositAmt,
List<String> floorNames, List<Double> floorCapacities) {
// Reuse the existing saveHall to persist the hall + images
saveHallByAdmin(hallName, depositAmount, halfDayAmt, fullDayAmt, gst, hallArea,
ebNumber, ebCostPerUnit, parkingCapacity, seatingCapacity,
doorNo, street, area, zone, division, landMark, city, pinCode,
latitude, longitude, hallInchargeName, hallInchargeNo,
updatedId, hallImages, halfDepositAmt);
// Fetch the just-saved hall to get its generated ID
// (the hall is the most recently inserted one with this name)
HallDetails savedHall = hallDetailsRepository
.findAll()
.stream()
.filter(h -> hallName.equals(h.getHallName()))
.reduce((first, second) -> second) // last inserted
.orElse(null);
if (savedHall != null && floorNames != null && !floorNames.isEmpty()) {
for (int i = 0; i < floorNames.size(); i++) {
String fname = floorNames.get(i);
if (fname == null || fname.trim().isEmpty())
continue;
double fcap = (floorCapacities != null && i < floorCapacities.size() && floorCapacities.get(i) != null)
? floorCapacities.get(i)
: 0.0;
FloorDetails fd = new FloorDetails();
fd.setFloor(fname.trim());
fd.setHallarea(fcap);
fd.setHallDetails(savedHall);
fd.setActive(true);
fd.setDelete(false);
floorDetailsRepository.save(fd);
}
}
return savedHall;
}
/**
* Soft-deletes existing active floor rows, then inserts new floor records.
* Existing rows get: is_active = false, is_delete = true.
* New rows get: is_active = true, is_delete = false.
*/
@Override
@Transactional
public void updateFloorDetails(int hallId, List<String> floorNames, List<Double> floorCapacities) {
// Soft-delete all currently active floor rows for this hall
floorDetailsRepository.softDeleteByHallId(hallId);
HallDetails hall = hallDetailsRepository.findById(hallId).orElse(null);
if (hall == null)
return;
if (floorNames == null || floorNames.isEmpty())
return;
// Insert new floor records
for (int i = 0; i < floorNames.size(); i++) {
String fname = floorNames.get(i);
if (fname == null || fname.trim().isEmpty())
continue;
double fcap = (floorCapacities != null && i < floorCapacities.size() && floorCapacities.get(i) != null)
? floorCapacities.get(i)
: 0.0;
FloorDetails fd = new FloorDetails();
fd.setFloor(fname.trim());
fd.setHallarea(fcap);
fd.setHallDetails(hall);
fd.setActive(true);
fd.setDelete(false);
floorDetailsRepository.save(fd);
}
}
public void updatenewHallImages(Integer hallId, MultipartFile[] newHallImages) { public void updatenewHallImages(Integer hallId, MultipartFile[] newHallImages) {
// Fetch the existing hall details from the database // Fetch the existing hall details from the database
HallDetails hallDetails = hallDetailsRepository.findById(hallId) HallDetails hallDetails = hallDetailsRepository.findById(hallId)
@ -127,8 +227,10 @@ public class HallDetailServiceImpl implements HallDetailService {
int i = hallDetails.getHallImagesList().size(); // Start index after existing images int i = hallDetails.getHallImagesList().size(); // Start index after existing images
for (MultipartFile hallImage : newHallImages) { for (MultipartFile hallImage : newHallImages) {
HallImages hallImageEntity = new HallImages(); HallImages hallImageEntity = new HallImages();
String filePath = hallDirectory + "/" + hallDetails.getHallId() + "_" + i + "_" + hallImage.getOriginalFilename();
String imageUrl = hallImageUrl + "hallImages/" + hallDetails.getHallId() + "_" + i + "_" + hallImage.getOriginalFilename();
String filePath = hallDirectory + "/" + hallDetails.getHallId() + "_" + i + "_"
+ hallImage.getOriginalFilename();
String imageUrl = hallImageUrl + "hallImages/" + hallDetails.getHallId() + "_" + i + "_"
+ hallImage.getOriginalFilename();
try (FileOutputStream fos = new FileOutputStream(filePath)) { try (FileOutputStream fos = new FileOutputStream(filePath)) {
byte[] bytes = hallImage.getBytes(); byte[] bytes = hallImage.getBytes();
@ -145,6 +247,7 @@ public class HallDetailServiceImpl implements HallDetailService {
} }
} }
} }
public String updateHallImage(Integer hallImageId, MultipartFile hallImage) throws IOException { public String updateHallImage(Integer hallImageId, MultipartFile hallImage) throws IOException {
Optional<HallImages> optionalHallImage = hallImagesRepository.findById(hallImageId); Optional<HallImages> optionalHallImage = hallImagesRepository.findById(hallImageId);
if (optionalHallImage.isPresent()) { if (optionalHallImage.isPresent()) {
@ -220,8 +323,10 @@ public class HallDetailServiceImpl implements HallDetailService {
HallImages hallImage = new HallImages(); HallImages hallImage = new HallImages();
try { try {
// Save image to storage location // Save image to storage location
String filePath = hallDirectory + "/" + existingHall.getHallId() + "_"+i+"_" + image.getOriginalFilename();
String imageUrl = hallImageUrl + "hall/" + existingHall.getHallId() + "_" +i+"_"+ image.getOriginalFilename();
String filePath = hallDirectory + "/" + existingHall.getHallId() + "_" + i + "_"
+ image.getOriginalFilename();
String imageUrl = hallImageUrl + "hall/" + existingHall.getHallId() + "_" + i + "_"
+ image.getOriginalFilename();
try (FileOutputStream fos = new FileOutputStream(filePath)) { try (FileOutputStream fos = new FileOutputStream(filePath)) {
byte[] bytes = image.getBytes(); byte[] bytes = image.getBytes();
fos.write(bytes); fos.write(bytes);
@ -252,6 +357,7 @@ public class HallDetailServiceImpl implements HallDetailService {
// System.out.println(hallIds); // System.out.println(hallIds);
return hallDetailsRepository.removeHallById(hallIds); return hallDetailsRepository.removeHallById(hallIds);
} }
public List<HallDetails> getHallNames() { public List<HallDetails> getHallNames() {
List<HallDetails> halls = hallDetailsRepository.findAll(); List<HallDetails> halls = hallDetailsRepository.findAll();
return halls.stream() return halls.stream()
@ -263,6 +369,7 @@ public class HallDetailServiceImpl implements HallDetailService {
}) })
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
@Override @Override
public void saveHallImage(Long hallId, MultipartFile file) throws IOException { public void saveHallImage(Long hallId, MultipartFile file) throws IOException {
try { try {
@ -270,7 +377,8 @@ public class HallDetailServiceImpl implements HallDetailService {
.orElseThrow(() -> new IllegalArgumentException("Invalid hall ID")); .orElseThrow(() -> new IllegalArgumentException("Invalid hall ID"));
HallImages hallImage = new HallImages(); HallImages hallImage = new HallImages();
hallImage.setHallImage(Arrays.toString(file.getBytes())); // Check if this line needs adjustment based on file handling
hallImage.setHallImage(Arrays.toString(file.getBytes())); // Check if this line needs adjustment based on
// file handling
hallImage.setHallDetails(hallDetails); hallImage.setHallDetails(hallDetails);
hallImagesRepository.save(hallImage); hallImagesRepository.save(hallImage);
} catch (Exception e) { } catch (Exception e) {
@ -279,11 +387,11 @@ public class HallDetailServiceImpl implements HallDetailService {
} }
} }
@Override @Override
public List<HallImages> getHallImagesByHallId(Long hallId) { public List<HallImages> getHallImagesByHallId(Long hallId) {
return hallImagesRepository.findByHallDetails_HallId(hallId); return hallImagesRepository.findByHallDetails_HallId(hallId);
} }
@Override @Override
public List<HallDetails> getHallNamesbyzone(String zone) { public List<HallDetails> getHallNamesbyzone(String zone) {
List<HallDetails> halls = hallDetailsRepository.findByZone(zone); List<HallDetails> halls = hallDetailsRepository.findByZone(zone);

2
src/main/resources/paymentConfig.properties

@ -6,7 +6,7 @@
#payment.worldline.transactionSuccessCode=0300 #payment.worldline.transactionSuccessCode=0300
#payment.worldline.refundSuccessCode=0400 #payment.worldline.refundSuccessCode=0400
payment.worldline.merchantId=T1037717
payment.worldline.merchantId=L1037717
payment.worldline.encryptionKey=6207149300MFLGNY payment.worldline.encryptionKey=6207149300MFLGNY
payment.worldline.encryptionIV=3422107798TKQCNG payment.worldline.encryptionIV=3422107798TKQCNG
payment.worldline.schemeCode=FIRST payment.worldline.schemeCode=FIRST

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

@ -74,8 +74,8 @@
<!-- Card Container --> <!-- Card Container -->
<div class="content"> <div class="content">
<div class="block block-rounded"> <div class="block block-rounded">
<form id="myForm" th:action="@{/communityhall/admin/getDeveloperdetails}" onsubmit="return validateme()"
method="post">
<form id="myForm" th:action="@{/communityhall/admin/getDeveloperdetails}"
onsubmit="return validateme()" method="post">
<div class="block-header bg-primary text-white"> <div class="block-header bg-primary text-white">
<h3 class="block-title">Community Hall Reports</h3> <h3 class="block-title">Community Hall Reports</h3>
</div> </div>
@ -122,8 +122,7 @@
<option th:value="${hallName}">--Select Hall--</option> <option th:value="${hallName}">--Select Hall--</option>
<!-- Initial population using Thymeleaf --> <!-- Initial population using Thymeleaf -->
<th:block th:each="hall : ${halls}"> <th:block th:each="hall : ${halls}">
<option th:value="${hall.hallName}"
th:text="${hall.hallName}">
<option th:value="${hall.hallName}" th:text="${hall.hallName}">
</option> </option>
</th:block> </th:block>
</select> </select>
@ -156,6 +155,7 @@
<th>Status Code</th> <th>Status Code</th>
<th>Transaction Id</th> <th>Transaction Id</th>
<th>User Id</th> <th>User Id</th>
<th>Tpsl Txn Id</th>
<!--<th>Payment Status</th>--> <!--<th>Payment Status</th>-->
</tr> </tr>
</thead> </thead>
@ -167,6 +167,7 @@
<td th:text="${transaction[3]}"></td> <td th:text="${transaction[3]}"></td>
<td th:text="${transaction[4]}"></td> <td th:text="${transaction[4]}"></td>
<td th:text="${transaction[5]}"></td> <td th:text="${transaction[5]}"></td>
<td th:text="${transaction[6]}"></td>
<!-- <!--
<td th:text="${transaction[6]}"></td> <td th:text="${transaction[6]}"></td>
--> -->

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

81
src/main/resources/templates/admin/halldetailslist.html

@ -182,8 +182,7 @@
<label class="form-label" for="halfDepositAmount">Half Day Deposit Amount:<span <label class="form-label" for="halfDepositAmount">Half Day Deposit Amount:<span
class="text-danger"></span></label> class="text-danger"></span></label>
<input type="text" class="form-control text-center" name="halfDepositAmount" <input type="text" class="form-control text-center" name="halfDepositAmount"
id="halfDepositAmount"
disabled/>
id="halfDepositAmount" disabled />
</div> </div>
<div class="col-sm-4"> <div class="col-sm-4">
<label class="form-label" for="fullDayAmount">FullDayAmount:<span <label class="form-label" for="fullDayAmount">FullDayAmount:<span
@ -297,14 +296,15 @@
<div class="col-sm-4"> <div class="col-sm-4">
<label class="form-label" for="latitude">Latitude:*<span <label class="form-label" for="latitude">Latitude:*<span
class="text-danger"></span></label> class="text-danger"></span></label>
<input type="text" class="form-control text-center" name="latitude" id="latitu" required
<input type="text" class="form-control text-center" name="latitude" id="latitu"
maxlength="10" required
oninput="this.value = this.value.replace(/[^0-9.\-]/g,'').replace(/(\..*)\./g,'$1');" /> oninput="this.value = this.value.replace(/[^0-9.\-]/g,'').replace(/(\..*)\./g,'$1');" />
</div> </div>
<div class="col-sm-4"> <div class="col-sm-4">
<label class="form-label" for="longitude">Longitude:*<span <label class="form-label" for="longitude">Longitude:*<span
class="text-danger"></span></label> class="text-danger"></span></label>
<input type="text" class="form-control text-center" name="longitude" id="longitu" <input type="text" class="form-control text-center" name="longitude" id="longitu"
required
maxlength="11" required
oninput="this.value = this.value.replace(/[^0-9.\-]/g,'').replace(/(\..*)\./g,'$1');" /> oninput="this.value = this.value.replace(/[^0-9.\-]/g,'').replace(/(\..*)\./g,'$1');" />
</div> </div>
<div class="col-sm-4"> <div class="col-sm-4">
@ -317,8 +317,8 @@
<label class="form-label" for="halfDepositAmount">Half Day Deposit Amount:*<span <label class="form-label" for="halfDepositAmount">Half Day Deposit Amount:*<span
class="text-danger"></span></label> class="text-danger"></span></label>
<input type="text" class="form-control text-center" name="halfDepositAmount" <input type="text" class="form-control text-center" name="halfDepositAmount"
id="halfDepositAmo"
required oninput="this.value = this.value.replace(/[^0-9]/g, '');"/>
id="halfDepositAmo" required
oninput="this.value = this.value.replace(/[^0-9]/g, '');" />
</div> </div>
<div class="col-sm-4"> <div class="col-sm-4">
<label class="form-label" for="fullDayAmount">Full Day Amount:*<span <label class="form-label" for="fullDayAmount">Full Day Amount:*<span
@ -336,8 +336,7 @@
<label class="form-label" for="parkingCapacity">Parking Capacity:*<span <label class="form-label" for="parkingCapacity">Parking Capacity:*<span
class="text-danger"></span></label> class="text-danger"></span></label>
<input type="text" class="form-control text-center" name="parkingCapacity" <input type="text" class="form-control text-center" name="parkingCapacity"
id="parkingCapaci" required inputmode="numeric"
oninput="this.value = this.value.replace(/[^0-9]/g, '');"/>
id="parkingCapaci" required />
</div> </div>
<div class="col-sm-4"> <div class="col-sm-4">
<label class="form-label" for="seatingCapaci">Seating Capacity:*<span <label class="form-label" for="seatingCapaci">Seating Capacity:*<span
@ -378,8 +377,7 @@
</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">
<button type="button" class="btn btn-sm btn-alt-secondary"
data-bs-dismiss="modal">Close
<button type="button" class="btn btn-sm btn-alt-secondary" data-bs-dismiss="modal">Close
</button> </button>
<button type="submit" class="btn btn-sm btn-primary">Update</button> <button type="submit" class="btn btn-sm btn-primary">Update</button>
</div> </div>
@ -429,21 +427,15 @@
<div class="col-md-4"> <div class="col-md-4">
<div class="form-group"> <div class="form-group">
<label for="hallName">Hall Name:*</label> <input type="text" class="form-control" <label for="hallName">Hall Name:*</label> <input type="text" class="form-control"
id="hallName" name="hallName"
placeholder="Hall Name" required>
id="hallName" name="hallName" placeholder="Hall Name" required>
</div> </div>
</div> </div>
<div class="col-md-4"> <div class="col-md-4">
<div class="form-group"> <div class="form-group">
<label for="hallArea">Hall Area (in square feet):*</label> <input type="text" <label for="hallArea">Hall Area (in square feet):*</label> <input type="text"
class="form-control"
id="hallArea"
name="hallArea"
placeholder="Hall Area"
pattern="\d*"
inputmode="numeric"
oninput="this.value = this.value.replace(/[^0-9]/g, '');"
required>
class="form-control" id="hallArea" name="hallArea" placeholder="Hall Area"
pattern="\d*" inputmode="numeric"
oninput="this.value = this.value.replace(/[^0-9]/g, '');" required>
</div> </div>
</div> </div>
<div class="col-md-4"> <div class="col-md-4">
@ -457,8 +449,7 @@
<div class="col-md-4"> <div class="col-md-4">
<div class="form-group"> <div class="form-group">
<label for="street">Street:*</label> <input type="text" class="form-control" <label for="street">Street:*</label> <input type="text" class="form-control"
id="street" name="street"
placeholder="Street" required>
id="street" name="street" placeholder="Street" required>
</div> </div>
</div> </div>
<div class="col-md-4"> <div class="col-md-4">
@ -525,48 +516,30 @@
<div class="col-md-4"> <div class="col-md-4">
<div class="form-group"> <div class="form-group">
<label for="parkingCapacity">Parking Capacity:*</label> <input type="text" <label for="parkingCapacity">Parking Capacity:*</label> <input type="text"
class="form-control"
id="parkingCapacity"
name="parkingCapacity"
placeholder="Parking Capacity"
pattern="\d*"
inputmode="numeric"
oninput="this.value = this.value.replace(/[^0-9]/g, '');"
required>
class="form-control" id="parkingCapacity" name="parkingCapacity"
placeholder="Parking Capacity" required>
</div> </div>
</div> </div>
<div class="col-md-4"> <div class="col-md-4">
<div class="form-group"> <div class="form-group">
<label for="seatingCapacity">Seating Capacity:*</label> <input type="text" <label for="seatingCapacity">Seating Capacity:*</label> <input type="text"
class="form-control"
id="seatingCapacity"
name="seatingCapacity"
placeholder="Seating Capacity"
pattern="\d*"
inputmode="numeric"
oninput="this.value = this.value.replace(/[^0-9]/g, '');"
required>
class="form-control" id="seatingCapacity" name="seatingCapacity"
placeholder="Seating Capacity" pattern="\d*" inputmode="numeric"
oninput="this.value = this.value.replace(/[^0-9]/g, '');" required>
</div> </div>
</div> </div>
<div class="col-md-4"> <div class="col-md-4">
<div class="form-group"> <div class="form-group">
<label for="ednumber">Consumer Number:*</label> <input type="text" <label for="ednumber">Consumer Number:*</label> <input type="text"
class="form-control"
id="ebNumber" name="ebNumber"
placeholder="Consumer Number"
minlength="9" maxlength="12"
pattern="^[0-9-+*#]{9,12}$"
required>
class="form-control" id="ebNumber" name="ebNumber" placeholder="Consumer Number"
minlength="9" maxlength="12" pattern="^[0-9-+*#]{9,12}$" required>
</div> </div>
</div> </div>
<div class="col-md-4"> <div class="col-md-4">
<div class="form-group"> <div class="form-group">
<label for="ebCostPerUnit">EB Cost Per Unit:*</label> <input type="text" <label for="ebCostPerUnit">EB Cost Per Unit:*</label> <input type="text"
class="form-control"
id="ebCostPerUnit"
name="ebCostPerUnit"
placeholder="EB Cost Per Unit"
required
class="form-control" id="ebCostPerUnit" name="ebCostPerUnit"
placeholder="EB Cost Per Unit" required
oninput="this.value = this.value.replace(/[^0-9]/g, '');"> oninput="this.value = this.value.replace(/[^0-9]/g, '');">
</div> </div>
</div> </div>
@ -612,11 +585,8 @@
<div class="col-md-4"> <div class="col-md-4">
<div class="form-group"> <div class="form-group">
<label for="halfDayAmt">Half Day Amount:*</label> <input type="text" <label for="halfDayAmt">Half Day Amount:*</label> <input type="text"
class="form-control"
id="halfDayAmt"
name="halfDayAmt"
placeholder="Half Day Amount"
required
class="form-control" id="halfDayAmt" name="halfDayAmt"
placeholder="Half Day Amount" required
oninput="this.value = this.value.replace(/[^0-9]/g, '');"> oninput="this.value = this.value.replace(/[^0-9]/g, '');">
</div> </div>
</div> </div>
@ -649,8 +619,7 @@
</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">
<button type="button" class="btn btn-danger" onclick="fieldsreset()" name="reset">Reset</button> <button type="button" class="btn btn-danger" onclick="fieldsreset()" name="reset">Reset</button>
<button type="button" class="btn btn-sm btn-alt-secondary"
data-bs-dismiss="modal">Close
<button type="button" class="btn btn-sm btn-alt-secondary" data-bs-dismiss="modal">Close
</button> </button>
<button type="submit" class="btn btn-sm btn-primary" onclick="submitForm()">Submit</button> <button type="submit" class="btn btn-sm btn-primary" onclick="submitForm()">Submit</button>
</div> </div>

1543
src/main/resources/templates/admin/login-creation.html
File diff suppressed because it is too large
View File

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

@ -40,6 +40,21 @@
<span class="nav-main-link-name">User Rejected List</span> <span class="nav-main-link-name">User Rejected List</span>
</a> </a>
</li> </li>
<li class="nav-main-item">
<a class="nav-main-link" href="/communityhall/admin/login-creation">
<i class="nav-main-link-icon fa fa-location-arrow"></i>
<span class="nav-main-link-name">Login Creation</span>
</a>
</li>
<li class="nav-main-item">
<a class="nav-main-link" href="/communityhall/admin/GccblockingNew">
<i class="nav-main-link-icon fa fa-location-arrow"></i>
<span class="nav-main-link-name">GCC Blocking (New)</span>
</a>
</li>
<li class="nav-main-item"> <li class="nav-main-item">
<a class="nav-main-link" href="/communityhall/admin/ongoingevents"> <a class="nav-main-link" href="/communityhall/admin/ongoingevents">
<i class="nav-main-link-icon fa fa-location-arrow"></i> <i class="nav-main-link-icon fa fa-location-arrow"></i>
@ -142,12 +157,12 @@
<span class="nav-main-link-name">Notifications</span> <span class="nav-main-link-name">Notifications</span>
</a> </a>
</li> </li>
<li class="nav-main-item">
<!-- <li class="nav-main-item">
<a class="nav-main-link" href="/communityhall/admin/Gccblocking"> <a class="nav-main-link" href="/communityhall/admin/Gccblocking">
<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">Gcc Blocking</span> <span class="nav-main-link-name">Gcc Blocking</span>
</a> </a>
</li>
</li> -->
<li class="nav-main-item"> <li class="nav-main-item">
<a class="nav-main-link" href="/communityhall/admin/Reports"> <a class="nav-main-link" href="/communityhall/admin/Reports">
<i class="nav-main-link-icon fa fa-location-arrow"></i> <i class="nav-main-link-icon fa fa-location-arrow"></i>

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

@ -3,7 +3,7 @@
<li class="nav-main-item"> <li class="nav-main-item">
<a class="nav-main-link" href="/communityhall/headquarters/dashboard"> <a class="nav-main-link" href="/communityhall/headquarters/dashboard">
<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">Dasboard</span>
<span class="nav-main-link-name">Dashboard</span>
</a> </a>
</li> </li>
<li class="nav-main-item"> <li class="nav-main-item">
@ -30,6 +30,18 @@
<span class="nav-main-link-name">Login Creation</span> <span class="nav-main-link-name">Login Creation</span>
</a> </a>
</li> </li>
<li class="nav-main-item">
<a class="nav-main-link" href="/communityhall/headquarters/halldetailslist">
<i class="nav-main-link-icon fa fa-location-arrow"></i>
<span class="nav-main-link-name">Hall Details List</span>
</a>
</li>
<li class="nav-main-item">
<a class="nav-main-link" href="/communityhall/headquarters/GccblockingNew">
<i class="nav-main-link-icon fa fa-location-arrow"></i>
<span class="nav-main-link-name">GCC Blocking (New)</span>
</a>
</li>
<li class="nav-main-item"> <li class="nav-main-item">
<a class="nav-main-link" href="/communityhall/headquarters/ongoingevents"> <a class="nav-main-link" href="/communityhall/headquarters/ongoingevents">
<i class="nav-main-link-icon fa fa-location-arrow"></i> <i class="nav-main-link-icon fa fa-location-arrow"></i>
@ -102,12 +114,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">
<!-- <li class="nav-main-item">
<a class="nav-main-link" href="/communityhall/headquarters/Gccblocking"> <a class="nav-main-link" href="/communityhall/headquarters/Gccblocking">
<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">Gcc Blocking</span> <span class="nav-main-link-name">Gcc Blocking</span>
</a> </a>
</li>
</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>

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

@ -60,6 +60,12 @@
<span class="nav-main-link-name">Payment List</span> <span class="nav-main-link-name">Payment List</span>
</a> </a>
</li> </li>
<li class="nav-main-item">
<a class="nav-main-link" href="/communityhall/officer/GccblockingNew">
<i class="nav-main-link-icon fa fa-location-arrow"></i>
<span class="nav-main-link-name">GCC Blocking (New)</span>
</a>
</li>
<!-- <li class="nav-main-item"> <!-- <li class="nav-main-item">
<a class="nav-main-link" href="/communityhall/officer/Gccblocking"> <a class="nav-main-link" href="/communityhall/officer/Gccblocking">
<i class="nav-main-link-icon fa fa-location-arrow"></i> <i class="nav-main-link-icon fa fa-location-arrow"></i>

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

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

1154
src/main/resources/templates/officer/gccblocking-new.html
File diff suppressed because it is too large
View File

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

@ -126,10 +126,14 @@
<i class="fa fa-asterisk"></i> <i class="fa fa-asterisk"></i>
</span> </span>
<input type="text" maxlength="5" minlength="5" class="form-control" <input type="text" maxlength="5" minlength="5" class="form-control"
id="loginOTP" placeholder="OTP" value="" required>
id="loginOTP" placeholder="OTP" value="" required inputmode="numeric"
oninput="this.value=this.value.replace(/[^0-9]/g,'')"
onkeydown="if(event.key==='Enter'){event.preventDefault();event.stopPropagation();return false;} if(!/[0-9]/.test(event.key)&&!['Backspace','Delete','ArrowLeft','ArrowRight','Tab'].includes(event.key)){event.preventDefault();}">
</div> </div>
</div> </div>
<div class="d-sm-flex justify-content-sm-between align-items-sm-center text-center text-sm-start mb-2 row">
<div
class="d-sm-flex justify-content-sm-between align-items-sm-center text-center text-sm-start mb-2 row">
<div class="col-12 fw-semibold fs-sm py-1 text-center"> <div class="col-12 fw-semibold fs-sm py-1 text-center">
<a href="javascript:newPinCall();">Forgot PIN?</a> <a href="javascript:newPinCall();">Forgot PIN?</a>
</div> </div>
@ -140,7 +144,8 @@
<i class="fa fa-fw fa-sign-in-alt opacity-50 me-1"></i> Send OTP <i class="fa fa-fw fa-sign-in-alt opacity-50 me-1"></i> Send OTP
</button> </button>
</div> </div>
<div class="text-center mb-2" id="verifyBtn" style="display:none" onclick="verifyOTP()">
<div class="text-center mb-2" id="verifyBtn" style="display:none"
onclick="verifyOTP()">
<button type="button" class="btn btn-hero btn-primary"> <button type="button" class="btn btn-hero btn-primary">
<i class="fa fa-fw fa-sign-in-alt opacity-50 me-1"></i> Verify OTP <i class="fa fa-fw fa-sign-in-alt opacity-50 me-1"></i> Verify OTP
</button> </button>
@ -203,8 +208,9 @@
<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" maxlength="4" class="form-control text-center" name="newPinNo"
id="updatedpassword" placeholder="Numbers Only" minlength="4" 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">
@ -237,7 +243,8 @@
</div> </div>
<div class="mb-0 text-center"> <div class="mb-0 text-center">
<h4>OTP Verification</h4> <h4>OTP Verification</h4>
<p class="text-mute">Enter the OTP sent to <b class="text-info" id="mobilenotxt"></b></p>
<p class="text-mute">Enter the OTP sent to <b class="text-info" id="mobilenotxt"></b>
</p>
<p class="text-danger" id="otperror"></p> <p class="text-danger" id="otperror"></p>
</div> </div>
<div class="mb-3 text-center"> <div class="mb-3 text-center">
@ -252,7 +259,8 @@
<div class="mb-3 text-center"> <div class="mb-3 text-center">
<div id="resend-container"> <div id="resend-container">
<p class="mb-0">Didn't receive OTP?</p> <p class="mb-0">Didn't receive OTP?</p>
<p class="mb-0 text-info" id="resendlink">Please wait..<span id="countdown">60</span>s
<p class="mb-0 text-info" id="resendlink">Please wait..<span
id="countdown">60</span>s
</p> </p>
</div> </div>
</div> </div>
@ -716,4 +724,3 @@
</body> </body>
</html> </html>

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

@ -63,6 +63,23 @@
/* Example: reduce opacity to indicate disabled state */ /* Example: reduce opacity to indicate disabled state */
} }
/* ── Custom datepicker tooltip (works even when .disabled has pointer-events:none) ── */
#dp-tooltip {
position: fixed;
z-index: 9999;
background: rgba(30, 30, 30, 0.92);
color: #fff;
padding: 5px 11px;
border-radius: 6px;
font-size: 12px;
font-weight: 600;
pointer-events: none;
white-space: nowrap;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
display: none;
transition: opacity 0.15s;
}
.ui-datepicker { .ui-datepicker {
width: 100%; width: 100%;
background-color: #333; background-color: #333;
@ -1497,6 +1514,23 @@
</div> --> </div> -->
</div> </div>
<br> <br>
<!-- Upload guidelines – Step 3 only -->
<div class="col-sm-12 col-lg-12 col-md-12"
style="margin-bottom: 8px;">
<p
style="color: red; font-weight: 600; margin-bottom: 4px;">
<i class="fa fa-exclamation-circle"></i>
Kindly upload the pdf document and image
within size of 1MB
(.jpg or .jpeg only acceptable).
</p>
<!-- <p
style="color: red; font-weight: 600; margin-bottom: 0;">
<i class="fa fa-exclamation-circle"></i>
Kindly upload the image within size of 1MB
(.jpg or .jpeg only acceptable).
</p> -->
</div>
<div id="reasonFieldsContainer"> <div id="reasonFieldsContainer">
</div> </div>
<input type="hidden" name="bookingId" id="bookingId" <input type="hidden" name="bookingId" id="bookingId"
@ -2058,6 +2092,15 @@
}).then(function () { }).then(function () {
location.reload(); location.reload();
}); });
} else if (response.status === 'gccBlocked') {
Swal.fire({
icon: 'error',
title: 'GCC Blocked',
text: 'One or more selected dates are blocked by GCC and cannot be booked. Please choose different dates.',
confirmButtonText: 'OK'
}).then(function () {
location.reload();
});
} else { } else {
userId = response.userId; userId = response.userId;
bookingId = response.bookingId; bookingId = response.bookingId;
@ -2382,7 +2425,11 @@
validateStep3(); validateStep3();
}); });
var isNavigating = false; // Guard flag to prevent double-click step skipping
$(".next-step").click(function () { $(".next-step").click(function () {
if (isNavigating) return; // Ignore click if navigation is already in progress
var valid = true; 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
@ -2413,14 +2460,18 @@
} }
if (currentStep < 4) { if (currentStep < 4) {
isNavigating = true; // Lock navigation
$(".step-" + currentStep).fadeOut(500, function () { $(".step-" + currentStep).fadeOut(500, function () {
if (currentStep === 3 && isLogin === false) { if (currentStep === 3 && isLogin === false) {
$(".step-" + currentStep).fadeIn(500); $(".step-" + currentStep).fadeIn(500);
updateProgressBar(); updateProgressBar();
isNavigating = false; // Unlock navigation
return ""; return "";
} else { } else {
currentStep++; currentStep++;
$(".step-" + currentStep).fadeIn(500);
$(".step-" + currentStep).fadeIn(500, function () {
isNavigating = false; // Unlock after fade-in completes
});
updateProgressBar(); updateProgressBar();
} }
}); });
@ -2852,7 +2903,8 @@
$("#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];
window.bookingResponse[dateString] = [response[i].morning_slot, response[i].evening_slot,
response[i].is_blocked, response[i].booking_status1, response[i].booking_status2];
} }
initializeDatepickerWithColors(hall_id); initializeDatepickerWithColors(hall_id);
@ -2878,9 +2930,8 @@
endDateInput.disabled = true; endDateInput.disabled = true;
var maxdays = $('#reasonMaxDates').val(); var maxdays = $('#reasonMaxDates').val();
// alert("maxdays:--- "+maxdays);
// Add options for next 7 days from the selected start date
// Add options for next N days from the selected start date
for (var i = 0; i < maxdays; i++) { for (var i = 0; i < maxdays; i++) {
var date = new Date(startDate); var date = new Date(startDate);
date.setDate(startDate.getDate() + i); date.setDate(startDate.getDate() + i);
@ -2893,8 +2944,11 @@
var bookingStatus = window.bookingResponse[formattedDate]; var bookingStatus = window.bookingResponse[formattedDate];
if (bookingStatus) { if (bookingStatus) {
// ── GCC-Blocked date: stop range here, do NOT include ──
if (bookingStatus[2]) {
break;
}
if (bookingStatus[0] && bookingStatus[1]) { if (bookingStatus[0] && bookingStatus[1]) {
//alert("slot fulled");
break; break;
} else if (bookingStatus[0]) { } else if (bookingStatus[0]) {
if (formatStartDate == formattedDate) { if (formatStartDate == formattedDate) {
@ -2917,7 +2971,6 @@
option.text = formattedDate; option.text = formattedDate;
endDateInput.appendChild(option); endDateInput.appendChild(option);
} }
} else { } else {
var option = document.createElement('option'); var option = document.createElement('option');
option.value = formattedDate; option.value = formattedDate;
@ -3202,11 +3255,36 @@
$('#datepicker-container').datepicker('show'); $('#datepicker-container').datepicker('show');
}); });
// ── Custom tooltip for calendar cells (handles pointer-events:none on .disabled) ──
// The <td> itself still receives mouse events even when its child has pointer-events:none.
// We read the title attribute that jQuery UI datepicker sets via beforeShowDay's 3rd return value.
if (!document.getElementById('dp-tooltip')) {
$('body').append('<div id="dp-tooltip"></div>');
}
$('#datepicker-container')
.off('mouseenter.dptt mouseleave.dptt', 'td[title]')
.on('mouseenter.dptt', 'td[title]', function (e) {
var tip = $(this).attr('title');
if (!tip) return;
$('#dp-tooltip').text(tip).css({
left: (e.clientX + 12) + 'px',
top: (e.clientY - 30) + 'px'
}).show();
})
.on('mousemove.dptt', 'td[title]', function (e) {
$('#dp-tooltip').css({
left: (e.clientX + 12) + 'px',
top: (e.clientY - 30) + 'px'
});
})
.on('mouseleave.dptt', 'td[title]', function () {
$('#dp-tooltip').hide();
});
// Handle changes in the start date input // Handle changes in the start date input
$("#startDateInput").on("change", function () { $("#startDateInput").on("change", function () {
const selectedDate = $(this).val(); const selectedDate = $(this).val();
const bookingStatus = window.bookingResponse[selectedDate] || {}; const bookingStatus = window.bookingResponse[selectedDate] || {};
// const currentDate = new Date();
const currentHours = new Date().getHours(); const currentHours = new Date().getHours();
const currentDateString = $("#serverDate").val(); const currentDateString = $("#serverDate").val();
@ -3234,11 +3312,17 @@
} }
function handleBookingStatus(bookingStatus, defaultMessage) { function handleBookingStatus(bookingStatus, defaultMessage) {
if (bookingStatus[2]) {
if (bookingStatus[2] && bookingStatus[0] && !bookingStatus[1]) {
return [true, "highlight-yellow disabled", "GCC Blocked"];
} else if (bookingStatus[2] && bookingStatus[1] && !bookingStatus[0]) {
return [true, "highlight-violet disabled", "GCC Blocked"];
} else if (bookingStatus[2] && bookingStatus[1] && bookingStatus[0] && bookingStatus[3] != 'GCC_BLOCKED' && bookingStatus[4] != 'GCC_BLOCKED') {
return [true, "highlight-pink disabled", "GCC Blocked"];
} else if (bookingStatus[2] && bookingStatus[1] && bookingStatus[0] && bookingStatus[3] == 'GCC_BLOCKED' && bookingStatus[4] == 'GCC_BLOCKED') {
return [true, "highlight-blue disabled", "GCC Blocked"];
} else if (bookingStatus[2]) {
return [true, "highlight-blue disabled", "GCC Blocked"]; return [true, "highlight-blue disabled", "GCC Blocked"];
} /*else if (bookingStatus[3]) {
return [true, "highlight-lightpink disabled", "Temporary Blocked"];
} */ else if (bookingStatus[0] && bookingStatus[1]) {
} else if (bookingStatus[0] && bookingStatus[1]) {
return [true, "highlight-pink disabled", "Slot Occupied"]; return [true, "highlight-pink disabled", "Slot Occupied"];
} else if (bookingStatus[0] && !bookingStatus[1]) { } else if (bookingStatus[0] && !bookingStatus[1]) {
return [true, "highlight-yellow", "Evening Slot Available"]; return [true, "highlight-yellow", "Evening Slot Available"];
@ -3250,7 +3334,18 @@
// Helper function: Handles logic after 2 PM // Helper function: Handles logic after 2 PM
function handleAfter2PM(bookingStatus) { function handleAfter2PM(bookingStatus) {
if (bookingStatus[2]) {
// if (bookingStatus[2]) {
// return [true, "highlight-blue disabled", "GCC Blocked"];
// }
if (bookingStatus[2] && bookingStatus[0] && !bookingStatus[1]) {
return [true, "highlight-yellow disabled", "GCC Blocked"];
} else if (bookingStatus[2] && bookingStatus[1] && !bookingStatus[0]) {
return [true, "highlight-violet disabled", "GCC Blocked"];
} else if (bookingStatus[2] && bookingStatus[1] && bookingStatus[0] && bookingStatus[3] != 'GCC_BLOCKED' && bookingStatus[4] != 'GCC_BLOCKED') {
return [true, "highlight-pink disabled", "GCC Blocked"];
} else if (bookingStatus[2] && bookingStatus[1] && bookingStatus[0] && bookingStatus[3] == 'GCC_BLOCKED' && bookingStatus[4] == 'GCC_BLOCKED') {
return [true, "highlight-blue disabled", "GCC Blocked"];
} else if (bookingStatus[2]) {
return [true, "highlight-blue disabled", "GCC Blocked"]; return [true, "highlight-blue disabled", "GCC Blocked"];
} else if (bookingStatus[0] || bookingStatus[1]) { } else if (bookingStatus[0] || bookingStatus[1]) {
return [true, "highlight-pink disabled", "Slot Occupied"]; return [true, "highlight-pink disabled", "Slot Occupied"];
@ -3260,7 +3355,18 @@
// Helper function: Handles morning slots between 6 AM and 2 PM // Helper function: Handles morning slots between 6 AM and 2 PM
function handleMorningSlots(bookingStatus) { function handleMorningSlots(bookingStatus) {
if (bookingStatus[2]) {
// if (bookingStatus[2]) {
// return [true, "highlight-blue disabled", "GCC Blocked"];
// }
if (bookingStatus[2] && bookingStatus[0] && !bookingStatus[1]) {
return [true, "highlight-yellow disabled", "GCC Blocked"];
} else if (bookingStatus[2] && bookingStatus[1] && !bookingStatus[0]) {
return [true, "highlight-violet disabled", "GCC Blocked"];
} else if (bookingStatus[2] && bookingStatus[1] && bookingStatus[0] && bookingStatus[3] != 'GCC_BLOCKED' && bookingStatus[4] != 'GCC_BLOCKED') {
return [true, "highlight-pink disabled", "GCC Blocked"];
} else if (bookingStatus[2] && bookingStatus[1] && bookingStatus[0] && bookingStatus[3] == 'GCC_BLOCKED' && bookingStatus[4] == 'GCC_BLOCKED') {
return [true, "highlight-blue disabled", "GCC Blocked"];
} else if (bookingStatus[2]) {
return [true, "highlight-blue disabled", "GCC Blocked"]; return [true, "highlight-blue disabled", "GCC Blocked"];
} else if (bookingStatus[0] && bookingStatus[1]) { } else if (bookingStatus[0] && bookingStatus[1]) {
return [true, "highlight-pink disabled", "Slot Occupied"]; return [true, "highlight-pink disabled", "Slot Occupied"];

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

@ -77,6 +77,23 @@
/* Example: reduce opacity to indicate disabled state */ /* Example: reduce opacity to indicate disabled state */
} }
/* ── Custom datepicker tooltip (works even when .disabled has pointer-events:none) ── */
#dp-tooltip {
position: fixed;
z-index: 9999;
background: rgba(30, 30, 30, 0.92);
color: #fff;
padding: 5px 11px;
border-radius: 6px;
font-size: 12px;
font-weight: 600;
pointer-events: none;
white-space: nowrap;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
display: none;
transition: opacity 0.15s;
}
.ui-datepicker { .ui-datepicker {
width: 100%; width: 100%;
background-color: #333; background-color: #333;
@ -958,6 +975,7 @@
bottom: 0; bottom: 0;
opacity: 0; opacity: 0;
} }
to { to {
bottom: 30px; bottom: 30px;
opacity: 1; opacity: 1;
@ -969,6 +987,7 @@
bottom: 30px; bottom: 30px;
opacity: 1; opacity: 1;
} }
to { to {
bottom: 0; bottom: 0;
opacity: 0; opacity: 0;
@ -1071,7 +1090,8 @@
<div id="hallDetailsContainer" style="display: none;"> <div id="hallDetailsContainer" style="display: none;">
<!-- Initially hidden--> <!-- Initially hidden-->
<div class="row"> <div class="row">
<input type="hidden" id="serverDate" th:value=${serverDate}>
<input type="hidden" id="serverDate"
th:value=${serverDate}>
<!--Hall Images Carousel --> <!--Hall Images Carousel -->
<div class="col-md-6 col-lg-6 col-sm-6"> <div class="col-md-6 col-lg-6 col-sm-6">
<h6>Hall Images:</h6> <h6>Hall Images:</h6>
@ -1118,14 +1138,16 @@
<button type="button" <button type="button"
class="btn btn-primary btn-square-md" class="btn btn-primary btn-square-md"
style="background-color: #ac2bac;"></button> style="background-color: #ac2bac;"></button>
<span style="margin-left: 14px;">Morning <br>
<span style="margin-left: 14px;">Morning
<br>
(Available)</span> (Available)</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:#FFEA00;"></button> style="background-color:#FFEA00;"></button>
<span style="margin-left: 14px;">Evening<br>
<span
style="margin-left: 14px;">Evening<br>
(Available)</span> (Available)</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">
@ -1223,12 +1245,14 @@
</div> </div>
</div> </div>
<!--Modal HTML for Bootstrap 5--> <!--Modal HTML for Bootstrap 5-->
<div class="modal fade" id="termsModal" tabindex="-1" aria-labelledby="termsModalLabel" aria-hidden="true">
<div class="modal fade" id="termsModal" tabindex="-1" aria-labelledby="termsModalLabel"
aria-hidden="true">
<div class="modal-dialog modal-lg"> <div class="modal-dialog modal-lg">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h5 class="modal-title" id="termsModalLabel">Terms and Conditions</h5> <h5 class="modal-title" id="termsModalLabel">Terms and Conditions</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
<button type="button" class="btn-close" data-bs-dismiss="modal"
aria-label="Close"></button>
</div> </div>
<div class="modal-content" style="height: 100vh;"> <div class="modal-content" style="height: 100vh;">
<iframe src="media/images/CC Rules & Regulations for Online _Tamil.pdf" width="100%" <iframe src="media/images/CC Rules & Regulations for Online _Tamil.pdf" width="100%"
@ -1324,7 +1348,7 @@
$('#seatingCapacity').html('<strong>' + response.seatingCapacity + '</strong>'); $('#seatingCapacity').html('<strong>' + response.seatingCapacity + '</strong>');
var parkingCapacity = response.parkingCapacity; var parkingCapacity = response.parkingCapacity;
var parkingAvailability = parkingCapacity > 0 ? "Yes" : "No"; var parkingAvailability = parkingCapacity > 0 ? "Yes" : "No";
$('#parkingCapacity').html('<strong>' + parkingAvailability + '</strong>');
$('#parkingCapacity').html('<strong>' + parkingCapacity + '</strong>');
$('#caretakerNumber').html('<strong>' + response.hallInchargeMobno + '</strong>'); $('#caretakerNumber').html('<strong>' + response.hallInchargeMobno + '</strong>');
$('#rentAmount').html('<strong>' + response.depositAmount + '</strong>'); $('#rentAmount').html('<strong>' + response.depositAmount + '</strong>');
$('#gst').html('<strong>' + response.gst + '</strong>'); $('#gst').html('<strong>' + response.gst + '</strong>');
@ -1442,7 +1466,8 @@
$("#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];
window.bookingResponse[dateString] = [response[i].morning_slot, response[i].evening_slot,
response[i].is_blocked, response[i].booking_status1, response[i].booking_status2];
} }
initializeDatepickerWithColors(hall_id); initializeDatepickerWithColors(hall_id);
@ -1586,6 +1611,30 @@
$('#datepicker-container').datepicker('show'); $('#datepicker-container').datepicker('show');
}); });
// ── Custom tooltip for calendar cells ──
if (!document.getElementById('dp-tooltip')) {
$('body').append('<div id="dp-tooltip"></div>');
}
$('#datepicker-container')
.off('mouseenter.dptt mouseleave.dptt mousemove.dptt', 'td[title]')
.on('mouseenter.dptt', 'td[title]', function (e) {
var tip = $(this).attr('title');
if (!tip) return;
$('#dp-tooltip').text(tip).css({
left: (e.clientX + 12) + 'px',
top: (e.clientY - 30) + 'px'
}).show();
})
.on('mousemove.dptt', 'td[title]', function (e) {
$('#dp-tooltip').css({
left: (e.clientX + 12) + 'px',
top: (e.clientY - 30) + 'px'
});
})
.on('mouseleave.dptt', 'td[title]', function () {
$('#dp-tooltip').hide();
});
// Handle changes in the start date input // Handle changes in the start date input
$("#startDateInput").on("change", function () { $("#startDateInput").on("change", function () {
const selectedDate = $(this).val(); const selectedDate = $(this).val();
@ -1618,11 +1667,17 @@
} }
function handleBookingStatus(bookingStatus, defaultMessage) { function handleBookingStatus(bookingStatus, defaultMessage) {
if (bookingStatus[2]) {
if (bookingStatus[2] && bookingStatus[0] && !bookingStatus[1]) {
return [true, "highlight-yellow disabled", "GCC Blocked"];
} else if (bookingStatus[2] && bookingStatus[1] && !bookingStatus[0]) {
return [true, "highlight-violet disabled", "GCC Blocked"];
} else if (bookingStatus[2] && bookingStatus[1] && bookingStatus[0] && bookingStatus[3] != 'GCC_BLOCKED' && bookingStatus[4] != 'GCC_BLOCKED') {
return [true, "highlight-pink disabled", "GCC Blocked"];
} else if (bookingStatus[2] && bookingStatus[1] && bookingStatus[0] && bookingStatus[3] == 'GCC_BLOCKED' && bookingStatus[4] == 'GCC_BLOCKED') {
return [true, "highlight-blue disabled", "GCC Blocked"];
} else if (bookingStatus[2]) {
return [true, "highlight-blue disabled", "GCC Blocked"]; return [true, "highlight-blue disabled", "GCC Blocked"];
} /*else if (bookingStatus[3]) {
return [true, "highlight-lightpink disabled", "Temporary Blocked"];
} */else if (bookingStatus[0] && bookingStatus[1]) {
} else if (bookingStatus[0] && bookingStatus[1]) {
return [true, "highlight-pink disabled", "Slot Occupied"]; return [true, "highlight-pink disabled", "Slot Occupied"];
} else if (bookingStatus[0] && !bookingStatus[1]) { } else if (bookingStatus[0] && !bookingStatus[1]) {
return [true, "highlight-yellow", "Evening Slot Available"]; return [true, "highlight-yellow", "Evening Slot Available"];
@ -1634,7 +1689,15 @@
// Helper function: Handles logic after 2 PM // Helper function: Handles logic after 2 PM
function handleAfter2PM(bookingStatus) { function handleAfter2PM(bookingStatus) {
if (bookingStatus[2]) {
if (bookingStatus[2] && bookingStatus[0] && !bookingStatus[1]) {
return [true, "highlight-yellow disabled", "GCC Blocked"];
} else if (bookingStatus[2] && bookingStatus[1] && !bookingStatus[0]) {
return [true, "highlight-violet disabled", "GCC Blocked"];
} else if (bookingStatus[2] && bookingStatus[1] && bookingStatus[0] && bookingStatus[3] != 'GCC_BLOCKED' && bookingStatus[4] != 'GCC_BLOCKED') {
return [true, "highlight-pink disabled", "GCC Blocked"];
} else if (bookingStatus[2] && bookingStatus[1] && bookingStatus[0] && bookingStatus[3] == 'GCC_BLOCKED' && bookingStatus[4] == 'GCC_BLOCKED') {
return [true, "highlight-blue disabled", "GCC Blocked"];
} else if (bookingStatus[2]) {
return [true, "highlight-blue disabled", "GCC Blocked"]; return [true, "highlight-blue disabled", "GCC Blocked"];
} else if (bookingStatus[0] || bookingStatus[1]) { } else if (bookingStatus[0] || bookingStatus[1]) {
return [true, "highlight-pink disabled", "Slot Occupied"]; return [true, "highlight-pink disabled", "Slot Occupied"];
@ -1644,7 +1707,15 @@
// Helper function: Handles morning slots between 6 AM and 2 PM // Helper function: Handles morning slots between 6 AM and 2 PM
function handleMorningSlots(bookingStatus) { function handleMorningSlots(bookingStatus) {
if (bookingStatus[2]) {
if (bookingStatus[2] && bookingStatus[0] && !bookingStatus[1]) {
return [true, "highlight-yellow disabled", "GCC Blocked"];
} else if (bookingStatus[2] && bookingStatus[1] && !bookingStatus[0]) {
return [true, "highlight-violet disabled", "GCC Blocked"];
} else if (bookingStatus[2] && bookingStatus[1] && bookingStatus[0] && bookingStatus[3] != 'GCC_BLOCKED' && bookingStatus[4] != 'GCC_BLOCKED') {
return [true, "highlight-pink disabled", "GCC Blocked"];
} else if (bookingStatus[2] && bookingStatus[1] && bookingStatus[0] && bookingStatus[3] == 'GCC_BLOCKED' && bookingStatus[4] == 'GCC_BLOCKED') {
return [true, "highlight-blue disabled", "GCC Blocked"];
} else if (bookingStatus[2]) {
return [true, "highlight-blue disabled", "GCC Blocked"]; return [true, "highlight-blue disabled", "GCC Blocked"];
} else if (bookingStatus[0] && bookingStatus[1]) { } else if (bookingStatus[0] && bookingStatus[1]) {
return [false, "highlight-pink disabled", "Slot Occupied"]; return [false, "highlight-pink disabled", "Slot Occupied"];
@ -1673,8 +1744,3 @@
</body> </body>
</html> </html>

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

@ -95,6 +95,11 @@
font-weight: bold; font-weight: bold;
} }
.highlight-blue .ui-state-default {
background: blue !important;
color: #FFF !important;
}
.highlight-greens .ui-state-default { .highlight-greens .ui-state-default {
background: green !important; background: green !important;
color: #FFF !important; color: #FFF !important;
@ -701,7 +706,6 @@
<!-- <a class="reschedule-button" <!-- <a class="reschedule-button"
th:if="${booking.booking_status == 'WAITING_FOR_NOC' and booking.schedule_count < 1}"> th:if="${booking.booking_status == 'WAITING_FOR_NOC' and booking.schedule_count < 1}">
&lt;!&ndash;th:if="${booking.booking_status == 'WAITING_FOR_NOC'}">&ndash;&gt;
<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}]], th:onclick="openRescheduleModal([[${booking.booking_id}]], [[${booking.start_date}]], [[${booking.end_date}]],[[${booking.no_of_days}]],
@ -1365,6 +1369,7 @@
</div> </div>
</div> </div>
</div> </div>
<!-- Reschedule Booking Modal -->
<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">
@ -1377,7 +1382,7 @@
<br> <br>
<div style="margin-bottom: -59px; margin-left: -185px;"> <div style="margin-bottom: -59px; margin-left: -185px;">
<!-- Adding margin-top for separation --> <!-- Adding margin-top for separation -->
<p style="font-size: 14px; color: #6c757d;"> the Start Date can be
<p style="font-size: 14px; color: #6c757d;"> the Start Date & Slot can be
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"
@ -2383,7 +2388,8 @@
$("#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];
window.bookingResponse[dateString] = [response[i].morning_slot, response[i].evening_slot,
response[i].is_blocked, response[i].booking_status1, response[i].booking_status2];
} }
initializeDatepickerWithColors(hall_id, reason); initializeDatepickerWithColors(hall_id, reason);
@ -2506,11 +2512,18 @@
} }
function handleBookingStatus(bookingStatus, defaultMessage) { function handleBookingStatus(bookingStatus, defaultMessage) {
if (bookingStatus[2]) {
console.log("bookingStatus.." + bookingStatus[0], bookingStatus[1], bookingStatus[2])
if (bookingStatus[2] && bookingStatus[0] && !bookingStatus[1]) {
return [true, "highlight-yellow disabled", "GCC Blocked"];
} else if (bookingStatus[2] && bookingStatus[1] && !bookingStatus[0]) {
return [true, "highlight-violet disabled", "GCC Blocked"];
} else if (bookingStatus[2] && bookingStatus[1] && bookingStatus[0] && bookingStatus[3] != 'GCC_BLOCKED' && bookingStatus[4] != 'GCC_BLOCKED') {
return [true, "highlight-pink disabled", "GCC Blocked"];
} else if (bookingStatus[2] && bookingStatus[1] && bookingStatus[0] && bookingStatus[3] == 'GCC_BLOCKED' && bookingStatus[4] == 'GCC_BLOCKED') {
return [true, "highlight-blue disabled", "GCC Blocked"];
} else if (bookingStatus[2]) {
return [true, "highlight-blue disabled", "GCC Blocked"]; return [true, "highlight-blue disabled", "GCC Blocked"];
} /*else if (bookingStatus[3]) {
return [true, "highlight-lightpink disabled", "Temporary Blocked"];
}*/ else if (bookingStatus[0] && bookingStatus[1]) {
} else if (bookingStatus[0] && bookingStatus[1]) {
return [true, "highlight-pink disabled", "Slot Occupied"]; return [true, "highlight-pink disabled", "Slot Occupied"];
} else if (bookingStatus[0] && !bookingStatus[1]) { } else if (bookingStatus[0] && !bookingStatus[1]) {
return [true, "highlight-yellow", "Evening Slot Available"]; return [true, "highlight-yellow", "Evening Slot Available"];
@ -2522,7 +2535,15 @@
// Helper function: Handles logic after 2 PM // Helper function: Handles logic after 2 PM
function handleAfter2PM(bookingStatus) { function handleAfter2PM(bookingStatus) {
if (bookingStatus[2]) {
if (bookingStatus[2] && bookingStatus[0] && !bookingStatus[1]) {
return [true, "highlight-yellow disabled", "GCC Blocked"];
} else if (bookingStatus[2] && bookingStatus[1] && !bookingStatus[0]) {
return [true, "highlight-violet disabled", "GCC Blocked"];
} else if (bookingStatus[2] && bookingStatus[1] && bookingStatus[0] && bookingStatus[3] != 'GCC_BLOCKED' && bookingStatus[4] != 'GCC_BLOCKED') {
return [true, "highlight-pink disabled", "GCC Blocked"];
} else if (bookingStatus[2] && bookingStatus[1] && bookingStatus[0] && bookingStatus[3] == 'GCC_BLOCKED' && bookingStatus[4] == 'GCC_BLOCKED') {
return [true, "highlight-blue disabled", "GCC Blocked"];
} else if (bookingStatus[2]) {
return [true, "highlight-blue disabled", "GCC Blocked"]; return [true, "highlight-blue disabled", "GCC Blocked"];
} else if (bookingStatus[0] || bookingStatus[1]) { } else if (bookingStatus[0] || bookingStatus[1]) {
return [true, "highlight-pink disabled", "Slot Occupied"]; return [true, "highlight-pink disabled", "Slot Occupied"];
@ -2532,7 +2553,15 @@
// Helper function: Handles morning slots between 6 AM and 2 PM // Helper function: Handles morning slots between 6 AM and 2 PM
function handleMorningSlots(bookingStatus) { function handleMorningSlots(bookingStatus) {
if (bookingStatus[2]) {
if (bookingStatus[2] && bookingStatus[0] && !bookingStatus[1]) {
return [true, "highlight-yellow disabled", "GCC Blocked"];
} else if (bookingStatus[2] && bookingStatus[1] && !bookingStatus[0]) {
return [true, "highlight-violet disabled", "GCC Blocked"];
} else if (bookingStatus[2] && bookingStatus[1] && bookingStatus[0] && bookingStatus[3] != 'GCC_BLOCKED' && bookingStatus[4] != 'GCC_BLOCKED') {
return [true, "highlight-pink disabled", "GCC Blocked"];
} else if (bookingStatus[2] && bookingStatus[1] && bookingStatus[0] && bookingStatus[3] == 'GCC_BLOCKED' && bookingStatus[4] == 'GCC_BLOCKED') {
return [true, "highlight-blue disabled", "GCC Blocked"];
} else if (bookingStatus[2]) {
return [true, "highlight-blue disabled", "GCC Blocked"]; return [true, "highlight-blue disabled", "GCC Blocked"];
} else if (bookingStatus[0] && bookingStatus[1]) { } else if (bookingStatus[0] && bookingStatus[1]) {
return [true, "highlight-pink disabled", "Slot Occupied"]; return [true, "highlight-pink disabled", "Slot Occupied"];

Loading…
Cancel
Save