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. 115
      src/main/java/com/gcc/communityHall/controller/AdminAPIController.java
  5. 487
      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. 1047
      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. 114
      src/main/java/com/gcc/communityHall/entity/FloorDetails.java
  12. 2
      src/main/java/com/gcc/communityHall/entity/HallDetails.java
  13. 85
      src/main/java/com/gcc/communityHall/paymentService/repository/TransactionResponseRepository.java
  14. 78
      src/main/java/com/gcc/communityHall/repository/BookingCalendarRepository.java
  15. 3
      src/main/java/com/gcc/communityHall/repository/BookingDetailsRepository.java
  16. 22
      src/main/java/com/gcc/communityHall/repository/FloorDetailsRepository.java
  17. 27
      src/main/java/com/gcc/communityHall/repository/GccBlockingDateRepository.java
  18. 258
      src/main/java/com/gcc/communityHall/service/BookingService.java
  19. 99
      src/main/java/com/gcc/communityHall/service/HallDetailService.java
  20. 350
      src/main/java/com/gcc/communityHall/service/Impl/BookingServiceImpl.java
  21. 252
      src/main/java/com/gcc/communityHall/service/Impl/HallDetailServiceImpl.java
  22. 2
      src/main/resources/paymentConfig.properties
  23. 467
      src/main/resources/templates/admin/developer.html
  24. 1033
      src/main/resources/templates/admin/gccblocking-new.html
  25. 2669
      src/main/resources/templates/admin/halldetailslist.html
  26. 1543
      src/main/resources/templates/admin/login-creation.html
  27. 21
      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. 1263
      src/main/resources/templates/officiallogin.html
  34. 132
      src/main/resources/templates/user/hallbookingform.html
  35. 1192
      src/main/resources/templates/user/viewhallform.html
  36. 61
      src/main/resources/templates/user/viewhistory.html

6
.classpath

@ -39,17 +39,11 @@
<classpathentry kind="src" path="target/generated-sources/annotations">
<attributes>
<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>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="target/generated-test-sources/test-annotations">
<attributes>
<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"/>
</attributes>
</classpathentry>

1
.gitignore

@ -5,3 +5,4 @@ target/classes/
target/classes/application-dev.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

115
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")
// retrieving the GCC Blocked BookingDetails
@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()) {
// System.out.println("No blocked bookings found.");
@ -579,50 +571,69 @@ public class AdminAPIController {
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 hallIds = blockingDate.getHallId();
// Convert the booking IDs to a list of integers
List<Integer> bookingIdList = Arrays.stream(bookingIds.split(","))
.map(Integer::parseInt)
.collect(Collectors.toList());
// 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 ? Arrays.stream(hallIds.split(","))
.map(Long::parseLong)
.collect(Collectors.toList())
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);
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) {
bookingslots.setBookingId_1(null);
bookingslots.setBookingId_2(null);
bookingslots.setMorningSlot(false);
bookingslots.setEveningSlot(false);
bookingslots.setIs_blocked(false);
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);
// Process each bookingId and update the booking details
// Update GCC_BLOCKED booking_details entries back to GCC_UNBLOCKED
for (int bookingId : bookingIdList) {
Optional<BookingDetails> bookingDetails = bookingDetailsRepo.findById(bookingId);
if (bookingDetails.isPresent()) {
BookingDetails bookings = bookingDetails.get();
bookings.setBookingStatus(BookingDetails.BookingStatus.GCC_UNBLOCKED);
bookings.setRefundStatus(BookingDetails.RefundStatus.NA);
bookingDetailsRepo.save(bookings);
if (bookings.getBookingStatus() == BookingDetails.BookingStatus.GCC_BLOCKED) {
bookings.setBookingStatus(BookingDetails.BookingStatus.GCC_UNBLOCKED);
bookings.setRefundStatus(BookingDetails.RefundStatus.NA);
bookingDetailsRepo.save(bookings);
}
}
}
String adminname = (String) session.getAttribute("usertype");
@ -755,6 +766,44 @@ public class AdminAPIController {
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")
// GccBlocking Api
@PostMapping("/cancelAll")

487
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.RequestMapping;
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.multipart.MultipartFile;
@ -43,6 +44,8 @@ import com.gcc.communityHall.entity.HallDetails;
import com.gcc.communityHall.entity.Notification;
import com.gcc.communityHall.entity.Settlement;
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.paymentService.entity.TransactionResponse;
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.SettlementRepository;
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.HallDetailService;
import com.gcc.communityHall.service.ReasonMasterService;
import com.gcc.communityHall.service.UserService;
import jakarta.servlet.http.HttpSession;
import jakarta.transaction.Transactional;
@Controller
@RequestMapping("/communityhall/admin")
@ -110,6 +116,12 @@ public class Admincontroller {
@Autowired
private TransactionResponseRepository transactionResponseRepository;
@Autowired
private LoginRepository loginRepository;
@Autowired
private LoginHallIdRepository loginHallIdRepository;
@GetMapping("/dashboard")
public String viewDashboard(
@RequestParam(required = false, defaultValue = "all zones") String zone,
@ -120,7 +132,7 @@ public class Admincontroller {
// Validate JWT token
if (token != null && jwtUtil.validateToken(token)) {
//System.out.println("tokennnnnnnnnnnnnnns"+token);
// System.out.println("tokennnnnnnnnnnnnnns"+token);
// Token is valid, proceed with dashboard logic
String adminName = (String) session.getAttribute("usertype");
long mobileno = (long) session.getAttribute("mobileno");
@ -147,7 +159,6 @@ public class Admincontroller {
}
}
@GetMapping("/Reports")
public String viewReports(Model model, HttpSession session) {
String adminname = (String) session.getAttribute("usertype");
@ -174,7 +185,6 @@ public class Admincontroller {
}
}
@GetMapping("/HallDetails")
public String viewHallDetails(Model model, HttpSession session) {
String adminname = (String) session.getAttribute("usertype");
@ -263,9 +273,9 @@ public class Admincontroller {
List<BookingDetails> cancelledbookings = bookingDetailsRepository.findAllSettlementCancelledList();
List<BookingDetails> rejectedbookings = bookingDetailsRepository.findAllSettlementRejectedList();
model.addAttribute("settlementlist", settlement);
//AKI
// AKI
List<BookingDetails> settlementIntiated = bookingDetailsRepository.findSettlementInitiatedPending();
model.addAttribute("settlementIntiated", settlementIntiated);
model.addAttribute("settlementIntiated", settlementIntiated);
model.addAttribute("cancelledbookings", cancelledbookings);
model.addAttribute("rejectedbookings", rejectedbookings);
System.out.println("Settlement List: " + settlement);
@ -287,8 +297,10 @@ public class Admincontroller {
String zone = (String) session.getAttribute("zone");
model.addAttribute("zone", zone);
List<BookingDetails> settlementrefundfailed = bookingDetailsRepository.findAllSettlementRefundFailed();
List<BookingDetails> refundfailedcancelledbookings = bookingDetailsRepository.findAllRefundFaileCancelledList();
List<BookingDetails> refundfailedrejectedbookings = bookingDetailsRepository.findAllRefundFaileRejectedList();
List<BookingDetails> refundfailedcancelledbookings = bookingDetailsRepository
.findAllRefundFaileCancelledList();
List<BookingDetails> refundfailedrejectedbookings = bookingDetailsRepository
.findAllRefundFaileRejectedList();
model.addAttribute("settlementrefundfailed", settlementrefundfailed);
model.addAttribute("refundfailedcancelledbookings", refundfailedcancelledbookings);
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
private static <T> Predicate<T> distinctByKey(Function<? super T, ?> keyExtractor) {
@ -410,7 +436,7 @@ public class Admincontroller {
@RequestParam float hallArea,
@RequestParam String ebNumber,
@RequestParam float ebCostPerUnit,
@RequestParam int parkingCapacity,
@RequestParam String parkingCapacity,
@RequestParam int seatingCapacity,
@RequestParam String doorNo,
@RequestParam String street,
@ -426,8 +452,10 @@ public class Admincontroller {
@RequestParam long hallInchargeNo,
@RequestParam("hallImages") MultipartFile[] hallImages, HttpSession session) {
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");
Integer loginid = (Integer) session.getAttribute("id");
ApplicationLogs logs = new ApplicationLogs();
@ -444,7 +472,8 @@ public class Admincontroller {
e.printStackTrace();
}
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";
}
@ -558,48 +587,60 @@ public class Admincontroller {
@PostMapping("/getReport")
public String generateReport(Model model,
@RequestParam(name = "FromDate") @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) String fromDate,
@RequestParam(name = "ToDate") @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) String toDate,
@RequestParam(name = "request") String request,
@RequestParam(name = "userstatus", required = false) String userstatus,
@RequestParam(name = "usertype", required = false) String usertype,
@RequestParam(name = "bookingStatus", required = false) String bookingStatus,
@RequestParam(name = "refundStatus", required = false) String refundStatus,
@RequestParam(name = "paymentStatus", required = false) String paymentStatus,
@RequestParam(name = "filterby", required = false) String filterby,
@RequestParam(name = "zone1", required = false, defaultValue = "ALL") String zone,
@RequestParam(name = "division1", required = false, defaultValue = "ALL") String division,
@RequestParam(name = "hall1", required = false) Integer hallid,
@RequestParam(name = "basedon", required = false) String basedon,
@RequestParam(name = "bookingId", required = false) Long bookingId,
@RequestParam(name = "reporttype", required = false) String reporttype,
@RequestParam(name = "counterId", required = false) String counterId, HttpSession session) throws JsonProcessingException {
@RequestParam(name = "FromDate") @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) String fromDate,
@RequestParam(name = "ToDate") @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) String toDate,
@RequestParam(name = "request") String request,
@RequestParam(name = "userstatus", required = false) String userstatus,
@RequestParam(name = "usertype", required = false) String usertype,
@RequestParam(name = "bookingStatus", required = false) String bookingStatus,
@RequestParam(name = "refundStatus", required = false) String refundStatus,
@RequestParam(name = "paymentStatus", required = false) String paymentStatus,
@RequestParam(name = "filterby", required = false) String filterby,
@RequestParam(name = "zone1", required = false, defaultValue = "ALL") String zone,
@RequestParam(name = "division1", required = false, defaultValue = "ALL") String division,
@RequestParam(name = "hall1", required = false) Integer hallid,
@RequestParam(name = "basedon", required = false) String basedon,
@RequestParam(name = "bookingId", required = false) Long bookingId,
@RequestParam(name = "reporttype", required = false) String reporttype,
@RequestParam(name = "counterId", required = false) String counterId, HttpSession session)
throws JsonProcessingException {
String adminname = (String) session.getAttribute("usertype");
if (adminname != null) {
long mobileno = (long) session.getAttribute("mobileno");
model.addAttribute("mobileno", mobileno);
List<Users> userList = handleUserRequest(request, fromDate, toDate, userstatus, usertype);
List<Object[]> bookingList = handleBookingRequest(request, fromDate, toDate, bookingStatus, filterby, bookingId, zone, division, hallid);
List<BookingDetails> bookingSettlementList = handleBookingSettlementRequest(request, fromDate, toDate, refundStatus, filterby);
//List<Object[]> paymentList = request.equals("3") ? bookingService.getAllPaymentsDetails(fromDate, toDate,zone,division,hallid) : new ArrayList<>();
List<Object[]> bookingList = handleBookingRequest(request, fromDate, toDate, bookingStatus, filterby,
bookingId, zone, division, hallid);
List<BookingDetails> bookingSettlementList = handleBookingSettlementRequest(request, fromDate, toDate,
refundStatus, filterby);
// List<Object[]> paymentList = request.equals("3") ?
// bookingService.getAllPaymentsDetails(fromDate, toDate,zone,division,hallid) :
// new ArrayList<>();
List<Object[]> paymentList = new ArrayList<>();
List<Object[]> extrapaymentList = new ArrayList<>();
if (request.equals("3")) {
if (paymentStatus == null || paymentStatus.isEmpty()) {
paymentList = bookingService.getAllPaymentsDetails(fromDate, toDate, null, zone, division, hallid);
} else {
paymentList = bookingService.getAllPaymentsDetails(fromDate, toDate, paymentStatus, zone, division, hallid);
paymentList = bookingService.getAllPaymentsDetails(fromDate, toDate, paymentStatus, zone, division,
hallid);
}
}
if (request.equals("8")) {
if (paymentStatus == null || paymentStatus.isEmpty()) {
extrapaymentList = bookingService.getAllExtraPaymentsDetails(fromDate, toDate, null, zone, division, hallid);
extrapaymentList = bookingService.getAllExtraPaymentsDetails(fromDate, toDate, null, zone, division,
hallid);
} 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
// Fetch booking count by zone
List<Object[]> totalcount = new ArrayList<>();
@ -609,13 +650,13 @@ public class Admincontroller {
totalcount = bookingDetailsRepository.countBookingsByZone();
// Format zone data
totalcount = totalcount.stream()
.map(data -> new Object[]{"Zone-" + data[0], data[1]})
.map(data -> new Object[] { "Zone-" + data[0], data[1] })
.collect(Collectors.toList());
} else if ("division".equals(basedon)) {
totalcount = bookingDetailsRepository.countBookingsByDivisions();
// Format division data
totalcount = totalcount.stream()
.map(data -> new Object[]{"Division-" + data[0], data[1]})
.map(data -> new Object[] { "Division-" + data[0], data[1] })
.collect(Collectors.toList());
}
@ -626,22 +667,24 @@ public class Admincontroller {
model.addAttribute("basedon", basedon);
model.addAttribute("totalcount", totalcount);
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("abstract".equals(reporttype)){
if ("abstract".equals(reporttype)) {
List<Object[]> counterBookingList = new ArrayList<>();
counterBookingList = bookingService.getCounterWiseBookingCount(fromDate, toDate);
model.addAttribute("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
String hallBookingJson = new ObjectMapper().writeValueAsString(hallBookingByCounter);
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);
model.addAttribute("hallBookingDetailsJson", hallBookingDetailsJson);
@ -669,15 +712,15 @@ public class Admincontroller {
String counterWiseBookingJson = new ObjectMapper().writeValueAsString(counterWiseBookingList);
model.addAttribute("counterWiseBookingList", counterWiseBookingJson);
}
//ak
// ak
if ("11".equals(request)) {
// Fetch Settlement Initiated Report details
List<Object[]> settlementInitiatedList = bookingService.getSettlementInitiatedReport(fromDate, toDate);
System.out.println("settlementInitatedList"+ settlementInitiatedList);
// Fetch Settlement Initiated Report details
List<Object[]> settlementInitiatedList = bookingService.getSettlementInitiatedReport(fromDate, toDate);
System.out.println("settlementInitatedList" + settlementInitiatedList);
// Add the list to the model
model.addAttribute("settlementInitiatedList", settlementInitiatedList);
}
// Add the list to the model
model.addAttribute("settlementInitiatedList", settlementInitiatedList);
}
model.addAttribute("filterby", filterby);
model.addAttribute("users", userList);
@ -702,7 +745,6 @@ public class Admincontroller {
model.addAttribute("adminname", adminname);
System.out.println("request" + request);
return "admin/reports";
} else {
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")) {
return new ArrayList<>();
}
@ -731,7 +774,8 @@ public class Admincontroller {
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")) {
return new ArrayList<>();
}
@ -747,8 +791,8 @@ public class Admincontroller {
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")) {
return new ArrayList<>();
}
@ -759,10 +803,12 @@ public class Admincontroller {
return bookingDetailsRepo.getAllBookingDetailsWithBookingId(fromDate, toDate, bookingId);
}
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()) {
return bookingService.getBookingDetailsByBookingDateWithStatus(fromDate, toDate, bookingStatus, zone, division, hallid);
return bookingService.getBookingDetailsByBookingDateWithStatus(fromDate, toDate, bookingStatus, zone,
division, hallid);
}
if (!filterby.isEmpty()) {
@ -770,7 +816,8 @@ public class Admincontroller {
if (bookingStatus.isEmpty()) {
return bookingService.getBookingDetailsByBookingDate(fromDate, toDate, zone, division, hallid);
} 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()) {
return bookingService.getBookingDetailsByEventDate(fromDate, toDate, zone, division, hallid);
} 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<>();
}
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")) {
return new ArrayList<>();
}
@ -804,7 +852,8 @@ public class Admincontroller {
if (refundStatus.isEmpty()) {
return bookingService.getAllBookingsettlementDetailsByBookingDate(fromDate, toDate);
} else {
return bookingService.getAllBookingsettlementDetailsByBookingDateWithStatus(fromDate, toDate, refundStatus);
return bookingService.getAllBookingsettlementDetailsByBookingDateWithStatus(fromDate, toDate,
refundStatus);
}
}
@ -812,7 +861,8 @@ public class Admincontroller {
if (refundStatus.isEmpty()) {
return bookingService.getAllBookingsettlementDetailsByEventDate(fromDate, toDate);
} else {
return bookingService.getAllBookingsettlementDetailsByEventDateWithStatus(fromDate, toDate, refundStatus);
return bookingService.getAllBookingsettlementDetailsByEventDateWithStatus(fromDate, toDate,
refundStatus);
}
}
@ -888,28 +938,28 @@ public class Admincontroller {
}
}
// @GetMapping("/getDeveloperdetails")
// public String getDetails(Model model,HttpSession session)
// {
// String adminname = (String) session.getAttribute("usertype");
// if(adminname != null) {
// long mobileno = (long) session.getAttribute("mobileno");
// model.addAttribute("mobileno", mobileno);
// return "admin/developer";
// }else {
// session.invalidate(); // Invalidate the session to clear all session attributes
// return "redirect:/communityhall/login";
// }
// }
// @GetMapping("/getDeveloperdetails")
// public String getDetails(Model model,HttpSession session)
// {
// String adminname = (String) session.getAttribute("usertype");
// if(adminname != null) {
// long mobileno = (long) session.getAttribute("mobileno");
// model.addAttribute("mobileno", mobileno);
// return "admin/developer";
// }else {
// session.invalidate(); // Invalidate the session to clear all session
// attributes
// return "redirect:/communityhall/login";
// }
// }
@PostMapping("/getDeveloperdetails")
public String generatedetails(Model model,
@RequestParam(name = "FromDate") @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) String fromDate,
@RequestParam(name = "ToDate") @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) String toDate,
@RequestParam(name = "request") String request,
@RequestParam(name = "bookingId", required = false) Long bookingId,
@RequestParam(name = "hallId", required = false) Long hallId,
@RequestParam(name = "hallName", required = false) String hallName, HttpSession session) {
@RequestParam(name = "FromDate") @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) String fromDate,
@RequestParam(name = "ToDate") @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) String toDate,
@RequestParam(name = "request") String request,
@RequestParam(name = "bookingId", required = false) Long bookingId,
@RequestParam(name = "hallId", required = false) Long hallId,
@RequestParam(name = "hallName", required = false) String hallName, HttpSession session) {
String adminname = (String) session.getAttribute("usertype");
if (adminname != null) {
@ -938,15 +988,17 @@ public class Admincontroller {
List<Object[]> BookingCalendar = new ArrayList<>();
if (request.equals("3")) {
System.out.println("outside");
// if (hallName.isEmpty()) {
// System.out.println("check1");
// // Fetch all details for the given date range
// BookingCalendar = bookingService.getBookingCalendarDetails(fromDate, toDate,hallName);
// } else {
// System.out.println("check2");
// // Fetch filtered details based on hallName
// BookingCalendar = bookingService.getBookingCalendarDetails(fromDate, toDate, hallName);
// }
// if (hallName.isEmpty()) {
// System.out.println("check1");
// // Fetch all details for the given date range
// BookingCalendar = bookingService.getBookingCalendarDetails(fromDate,
// toDate,hallName);
// } else {
// System.out.println("check2");
// // Fetch filtered details based on hallName
// BookingCalendar = bookingService.getBookingCalendarDetails(fromDate, toDate,
// hallName);
// }
BookingCalendar = bookingService.getBookingCalendarDetails(fromDate, toDate, bookingId, hallName);
}
@ -1045,7 +1097,6 @@ public class Admincontroller {
}
}
@GetMapping("/logout")
public String viewLogout(Model model, HttpSession session) {
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.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import com.gcc.communityHall.entity.BookingDetails;
import com.gcc.communityHall.entity.HallDetails;
import com.gcc.communityHall.entity.Users;
import com.gcc.communityHall.repository.BookingDetailsRepository;
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
private static <T> Predicate<T> distinctByKey(Function<? super T, ?> keyExtractor) {
Set<Object> seen = new HashSet<>();
@ -1012,4 +1029,61 @@ public class HeadquartersController {
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";
}
}
}

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

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

@ -629,4 +629,24 @@ public class OfficerController {
Set<Object> seen = new HashSet<>();
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.print("\n MobileNo---:"+mobileNo);
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);
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("dd-MMM-yyyy%20HH:mm");
LocalDateTime now = LocalDateTime.now();
@ -238,31 +238,30 @@ public class UserAPIController {
System.out.println(urlString);
System.out.println("\n urlString---: " + urlString);
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();
session.setAttribute("otp", otp);
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")
// Getting the Past Data from the Calendar
@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) {
return data;
}

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

@ -13,62 +13,88 @@ import jakarta.persistence.ManyToOne;
@Entity
public class FloorDetails {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int floorId;
@Column(name = "floor")
private String floor;
@ManyToOne(cascade = CascadeType.PERSIST,fetch = FetchType.LAZY)
@JsonIgnore
private HallDetails hallDetails;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int floorId;
@Column(name="area")
private double hallarea;
@Column(name = "floor")
private String floor;
@ManyToOne(cascade = CascadeType.PERSIST, fetch = FetchType.LAZY)
@JsonIgnore
private HallDetails hallDetails;
public HallDetails getHallDetails() {
return hallDetails;
}
@Column(name = "area")
private double hallarea;
public void setHallDetails(HallDetails hallDetails) {
this.hallDetails = hallDetails;
}
@Column(name = "is_active", nullable = false, columnDefinition = "BOOLEAN DEFAULT true")
private boolean isActive = true;
public int getFloorId() {
return floorId;
}
@Column(name = "is_delete", nullable = false, columnDefinition = "BOOLEAN DEFAULT false")
private boolean isDelete = false;
public void setFloorId(int floorId) {
this.floorId = floorId;
}
// ── Getters & Setters ──────────────────────────────────────────────────────
public String getFloor() {
return floor;
}
public HallDetails getHallDetails() {
return hallDetails;
}
public void setFloor(String floor) {
this.floor = floor;
}
public void setHallDetails(HallDetails hallDetails) {
this.hallDetails = hallDetails;
}
public double getHallarea() {
return hallarea;
}
public int getFloorId() {
return floorId;
}
public void setHallarea(double hallarea) {
this.hallarea = hallarea;
}
public void setFloorId(int floorId) {
this.floorId = floorId;
}
public FloorDetails(int floorId, String floor, HallDetails hallDetails, double hallarea) {
super();
this.floorId = floorId;
this.floor = floor;
this.hallDetails = hallDetails;
this.hallarea = hallarea;
}
public String getFloor() {
return floor;
}
public FloorDetails() {
super();
}
public void setFloor(String floor) {
this.floor = floor;
}
public double getHallarea() {
return hallarea;
}
public void setHallarea(double 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) {
super();
this.floorId = floorId;
this.floor = floor;
this.hallDetails = hallDetails;
this.hallarea = hallarea;
}
public FloorDetails() {
super();
}
}

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

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

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

@ -11,51 +11,72 @@ import org.springframework.stereotype.Repository;
import com.gcc.communityHall.paymentService.entity.TransactionResponse;
@Repository
public interface TransactionResponseRepository extends JpaRepository<TransactionResponse, Integer> {
Optional<TransactionResponse> findByBookingId(int bookingId);
List<TransactionResponse> findByuserId(String userId);
Optional<TransactionResponse> findByTxansactionId(String txansactionId);
@Repository
public interface TransactionResponseRepository extends JpaRepository<TransactionResponse,Integer>{
Optional<TransactionResponse> findByBookingId(int bookingId);
List<TransactionResponse> findByuserId(String userId);
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> findByBookingIdAndTxansactionIdAndStatusCode(int bookingId,String txansactionId, String statusCode);
Optional<TransactionResponse> findByBookingIdAndStatusCode(int bookingId, String statusCode);
Optional<TransactionResponse> findByBookingIdAndTxansactionIdAndStatusCode(int bookingId, String txansactionId,
String statusCode);
@Query(value = "SELECT tr.booking_id, tr.hall_id, tr.amount, tr.status_code, tr.txansaction_id, tr.user_id " +
// ", p.payment_status " +
@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 " +
"FROM transaction_response tr " +
"JOIN hall_details hd ON tr.hall_id = hd.hall_id " +
// "LEFT JOIN payments p ON tr.booking_id = p.booking_details_booking_id " +
// "LEFT JOIN payments p ON tr.booking_id = p.booking_details_booking_id " +
"LEFT JOIN booking_details bd ON tr.booking_id = bd.booking_id " +
"WHERE DATE(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 (:bookingId IS NULL OR tr.booking_id = :bookingId) " +
"AND (:hallId IS NULL OR tr.hall_id = :hallId)", nativeQuery = true)
List<Object[]> getTransactionResponseByBookingId(@Param("fromDate") String fromDate,
@Param("toDate") String toDate,
@Param("bookingId") Long bookingId,
@Param("hallId") Long hallId);
// @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,
// 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 = "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)
@Param("toDate") String toDate,
@Param("bookingId") Long bookingId,
@Param("hallId") Long hallId);
// @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,
// 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 = "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, " +
"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)
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 " +
"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)

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

@ -14,65 +14,77 @@ import org.springframework.stereotype.Repository;
import com.gcc.communityHall.entity.BookingCalendar;
@Repository
public interface BookingCalendarRepository extends JpaRepository<BookingCalendar,Integer> {
public interface BookingCalendarRepository extends JpaRepository<BookingCalendar, Integer> {
@Query(value="SELECT booking_id_1 , booking_id_2 FROM booking_calendar\r\n"
@Query(value = "SELECT booking_id_1 , booking_id_2 FROM booking_calendar\r\n"
+ "WHERE hall_id=:hallID AND bdate BETWEEN :fromDate AND :toDate", nativeQuery = true)
List<String> getCancelling(String fromDate, String toDate, String hallID);
@Query(value="select * from booking_calendar where hall_id=:hallID and bdate=:aa", nativeQuery = true)
@Query(value = "select * from booking_calendar where hall_id=:hallID and bdate=:aa", nativeQuery = true)
BookingCalendar getbyDates(LocalDate aa, String hallID);
@Query(value="SELECT * FROM booking_calendar WHERE (booking_id_1=:bookID or booking_id_2=:bookID)",nativeQuery = true)
@Query(value = "SELECT * FROM booking_calendar WHERE (booking_id_1=:bookID or booking_id_2=:bookID)", nativeQuery = true)
List<BookingCalendar> getCancellingdata1(String bookID);
@Query("SELECT c FROM BookingCalendar c WHERE c.bookingId_1 = :bookingId OR c.bookingId_2 = :bookingId")
BookingCalendar getSingleCancellingData(@Param("bookingId") String bookingId);
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);
@Query(value = " select * from booking_calendar where hall_id =:hallId and bdate BETWEEN :fromDate and :toDate order by hall_id", nativeQuery = true)
List<BookingCalendar> getCalendarByBDateAndHAllId(String fromDate, String toDate, int hallId);
List<BookingCalendar> getCalendarByBDateAndHAllId(String fromDate, String toDate, int hallId);
@Query(value = " select * from booking_calendar where bdate BETWEEN :fromDate and :toDate order by hall_id", nativeQuery = true)
List<BookingCalendar> getCalendarByBDate(String fromDate, String toDate);
@Query(value = "SELECT SUM(CASE WHEN booking_status = 'APPROVED' THEN 1 ELSE 0 END) AS approved_booking_count,\r\n"
+ "SUM(CASE WHEN booking_status = 'REJECTED' THEN 1 ELSE 0 END) AS rejected_booking_count,\r\n"
+ "SUM(CASE WHEN refund_status = 'WAITING' THEN 1 ELSE 0 END) AS waiting_settlement_count,\r\n"
+ "SUM(CASE WHEN refund_status = 'APPROVED' THEN 1 ELSE 0 END) AS approved_settlement_count,\r\n"
+ "SUM(CASE WHEN refund_status = 'REJECTED' THEN 1 ELSE 0 END) AS reject_settlement_count\r\n"
+ "FROM booking_details;",nativeQuery = true)
List<Map<String, Object>> toatlBookingCount();
@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);
@Modifying
@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);
List<BookingCalendar> getCalendarByBDate(String fromDate, String toDate);
@Query(value = "SELECT SUM(CASE WHEN booking_status = 'APPROVED' THEN 1 ELSE 0 END) AS approved_booking_count,\r\n"
+ "SUM(CASE WHEN booking_status = 'REJECTED' THEN 1 ELSE 0 END) AS rejected_booking_count,\r\n"
+ "SUM(CASE WHEN refund_status = 'WAITING' THEN 1 ELSE 0 END) AS waiting_settlement_count,\r\n"
+ "SUM(CASE WHEN refund_status = 'APPROVED' THEN 1 ELSE 0 END) AS approved_settlement_count,\r\n"
+ "SUM(CASE WHEN refund_status = 'REJECTED' THEN 1 ELSE 0 END) AS reject_settlement_count\r\n"
+ "FROM booking_details;", nativeQuery = true)
List<Map<String, Object>> toatlBookingCount();
@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);
@Modifying
@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);
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 " +
"JOIN hall_details hd ON bc.hall_id = hd.hall_id " +
"WHERE bc.bdate >= :fromDate " +
"AND bc.bdate <= :toDate " +
"AND (:bookingId IS NULL OR (bc.booking_id_1 = :bookingId OR bc.booking_id_2 = :bookingId)) " +
"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,
@Param("toDate") String toDate,
@Param("bookingId") Long bookingId,
@Param("hallName") String hallName);
@Param("toDate") String toDate,
@Param("bookingId") Long bookingId,
@Param("hallName") String hallName);
@Query(value="SELECT * from booking_calendar where booking_id_1 = :bookingId or booking_id_2 = :bookingId ", nativeQuery = true)
List<BookingCalendar> getCalendarByBookingId(int bookingId);
@Query(value = "SELECT * from booking_calendar where booking_id_1 = :bookingId or booking_id_2 = :bookingId ", nativeQuery = true)
List<BookingCalendar> getCalendarByBookingId(int 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 " +
"GROUP BY bd.counter_id, bd.hall_details_hall_id ", nativeQuery = true)
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);
}

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

@ -1,10 +1,30 @@
package com.gcc.communityHall.repository;
import java.util.List;
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 com.gcc.communityHall.entity.FloorDetails;
@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);
}

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

@ -14,26 +14,31 @@ import com.gcc.communityHall.entity.GccBlockingDate;
import com.gcc.communityHall.entity.GccBlockingDate.BlockedStatus;
@Repository
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)
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")
List<GccBlockingDate> findAllByHallIdAndBlockedStatus(@Param("hallId") String hallId, @Param("blockedStatus") GccBlockingDate.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);
@Query("SELECT g FROM GccBlockingDate g WHERE g.blockedStatus = 'BLOCKED' AND g.startDate >= CURRENT_DATE")
List<GccBlockingDate> findAllBlocked();
@Query("SELECT g FROM GccBlockingDate g WHERE g.blockedStatus = 'BLOCKED' AND g.endDate >= CURRENT_DATE")
List<GccBlockingDate> findAllBlocked();
@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")
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")
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)
List<GccBlockingDate> getByBookingId(@Param("bookingId") int bookingId);
@Query(value = "SELECT * FROM gcc_blocking_date WHERE FIND_IN_SET(:bookingId, booking_ids) > 0", nativeQuery = true)
List<GccBlockingDate> getByBookingId(@Param("bookingId") int bookingId);
}

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

@ -1,6 +1,5 @@
package com.gcc.communityHall.service;
import java.time.LocalDate;
import java.util.Date;
import java.util.List;
@ -18,211 +17,242 @@ import com.gcc.communityHall.entity.EbDetails;
import com.gcc.communityHall.entity.GccBlockingDate;
public interface BookingService {
BookingDetails getBookingsById(int BookingId);
//ak
BookingDetails getBookingByRefId(String refId);
//ak
void migrateOldBookingsToRefId();
BookingDetails getBookingsById(int BookingId);
// ak
BookingDetails getBookingByRefId(String refId);
// ak
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);
public BookingDetails updateBookingStatustoGCCBlocked(BookingDetails bookingDetails);
public BookingDetails updateBookingStatustoGCCBlocked(BookingDetails bookingDetails);
public BookingDetails updateBookingStatus(int bookingId, BookingDetails.BookingStatus status, String comments);
public BookingDetails updateBookingStatus(int bookingId, BookingDetails.BookingStatus status, String comments);
public BookingDetails updateBookingStatusById(int bookingId, BookingDetails.BookingStatus status, String comments);
public BookingDetails updateBookingStatusById(int bookingId, BookingDetails.BookingStatus status, String comments);
public EbDetails updateEbDetails(int bookingId, double startUnit, double endUnit, char status);
public EbDetails updateEbDetails(int bookingId, double startUnit, double endUnit, char status);
// typeOfCancel depends { }
String cancelBooking(int bookingId, BookingDetails.BookingStatus currentStatus, String comments);
//typeOfCancel depends { }
String cancelBooking(int bookingId, BookingDetails.BookingStatus currentStatus, String comments);
public String confirmBooking(int bookingId);
public String confirmBooking(int bookingId);
public BookingDetails getBookingDetailsWithSettlement(int settlementId);
public BookingDetails getBookingDetailsWithSettlement(int settlementId);
// sreeja
List<BookingDetails> getPresentsEventsByUserId(Integer hallId);
List<BookingDetails> getPastsEventsByUserId(Integer hallId);
//sreeja
List<BookingDetails> getPresentsEventsByUserId(Integer hallId);
List<BookingDetails> getFuturesEventsByUserId(Integer hallId);
List<BookingDetails> getPastsEventsByUserId(Integer hallId);
List<BookingDetails> getSettlementList(Integer hallId);
List<BookingDetails> getFuturesEventsByUserId(Integer hallId);
public List<BookingDetails> getFilteredBookings(LocalDate fromDate, LocalDate toDate, List<Long> hallIds);
List<BookingDetails> getSettlementList(Integer hallId);
public List<Map<String, Object>> getPastData(int hall_id);
public List<BookingDetails> getFilteredBookings(LocalDate fromDate, LocalDate toDate, List<Long> hallIds);
public String processEbDetailsAndDamage(
int bookingId, int ebId,
double startingReading, double endingReading,
float usedUnit, double ebAmount,
String assetNames[], String comments[], int quantities[], Double assetAmounts[], MultipartFile assetImages[]);
public List<BookingCalendar> getPastData(int hall_id);
public int checkUserBookinglimitation(int userId);
public String processEbDetailsAndDamage(
int bookingId, int ebId,
double startingReading, double endingReading,
float usedUnit, double ebAmount,
String assetNames[], String comments[], int quantities[], Double assetAmounts[], MultipartFile assetImages[]);
List<BookingDetails> getAllBookingsByUserId(Integer userId);
public int checkUserBookinglimitation(int userId);
List<Map<String, Object>> getAllBookingEventsByUserId(Integer userId);
List<BookingDetails> getAllBookingsByUserId(Integer userId);
// List<BookingDetails> getAllBookingDetailsWithStatus(String fromDate, String
// toDate, String bookingStatus);
List<Map<String, Object>> getAllBookingEventsByUserId(Integer userId);
// List<Object[]> getAllPaymentsDetails( String fromDate, String toDate);
List<Object[]> getBookingUserDetailsReport(String fromDate, String toDate);
//List<BookingDetails> getAllBookingDetailsWithStatus(String fromDate, String toDate, String bookingStatus);
List<Object[]> getBookingHallDetailsReport(String fromDate, String toDate);
//List<Object[]> getAllPaymentsDetails( String fromDate, String toDate);
List<GccBlockingDate> getBlockedEvents(LocalDate fromDate, LocalDate toDate, List<Long> hallIds);
List<Object[]> getBookingUserDetailsReport(String fromDate, String toDate);
List<Map<String, Object>> getOfflineBookings();
List<Object[]> getBookingHallDetailsReport(String fromDate, String toDate);
List<BookingCalendar> getBookedslots(LocalDate fromDate, LocalDate endDate, List<Long> hallIdList);
List<GccBlockingDate> getBlockedEvents(LocalDate fromDate, LocalDate toDate, List<Long> hallIds);
BookingDetails updateCancelledBookingStatus(int bookingId, BookingStatus status, String comments);
List<Map<String, Object>> getOfflineBookings();
BookingDetails updateRefundStatus(int bookingId, RefundStatus status);
List<BookingCalendar> getBookedslots(LocalDate fromDate, LocalDate endDate, List<Long> hallIdList);
// officer service
List<BookingDetails> getAllBookingDetailsByZone(String fromDate, String toDate, String zone);
BookingDetails updateCancelledBookingStatus(int bookingId, BookingStatus status, String comments);
List<BookingDetails> getAllBookingDetailsByZoneWithStatus(String fromDate, String toDate, String zone,
String bookingStatus);
BookingDetails updateRefundStatus(int bookingId, RefundStatus status);
List<Object[]> getAllPaymentsDetailsByZone(String fromDate, String toDate, String zone);
//officer service
List<BookingDetails> getAllBookingDetailsByZone(String fromDate, String toDate, String zone);
List<Object[]> getBookingHallDetailsReportByZone(String fromDate, String toDate, String zone);
List<BookingDetails> getAllBookingDetailsByZoneWithStatus(String fromDate, String toDate, String zone, String bookingStatus);
Optional<String> updateBookingDatesAndCalendar(int bookingId, String startDate, String endDate);
List<Object[]> getAllPaymentsDetailsByZone(String fromDate, String toDate, String zone);
List<Object[]> getBookingHallDetailsReportByZone1(String fromDate, String toDate, String zone, Integer hallId);
List<Object[]> getBookingHallDetailsReportByZone(String fromDate, String toDate, String zone);
List<Object> getGccBlockingEvents(String hallId);
Optional<String> updateBookingDatesAndCalendar(int bookingId, String startDate, String endDate);
int getBlockedHallCount(String blockingReason, Date startDate, Date endDate);
List<Object[]> getBookingHallDetailsReportByZone1(String fromDate, String toDate, String zone, Integer hallId);
@Transactional
void cancelAllBookings(String fromDate, String toDate, List<Long> hallIdsList,
String reasonforblocking, List<String> selectedBookings, String updatedBy, String[] descriptions,
MultipartFile[] documents);
List<Object> getGccBlockingEvents(String hallId);
@Transactional
void blockWithoutCancellingBookings(String fromDate, String toDate, List<Long> hallIdsList,
String reasonforblocking, String updatedBy, String[] descriptions,
MultipartFile[] documents);
int getBlockedHallCount(String blockingReason, Date startDate, Date endDate);
List<BookingDetails> findBookingDetailsByBookingId(Long bookingId);
@Transactional
void cancelAllBookings(String fromDate, String toDate, List<Long> hallIdsList,
String reasonforblocking, List<String> selectedBookings, String updatedBy, String[] descriptions, MultipartFile[] documents);
// admin dashboard
Map<String, Map<String, Integer>> getBookingStatistics(LocalDate fromDate, LocalDate toDate, String zone,
String division, Integer hallid, String userType);
List<BookingDetails> findBookingDetailsByBookingId(Long bookingId);
public List<Map<String, Object>> getBookingDetailsByHallId(int hallId);
//admin dashboard
Map<String, Map<String, Integer>> getBookingStatistics(LocalDate fromDate, LocalDate toDate, String zone, String division, Integer hallid, String userType);
// officer dashboard
Map<String, Map<String, Integer>> getOfficerDashboard(LocalDate fromDate, LocalDate toDate, String zone,
String division, Integer hallid, String userType);
public List<Map<String, Object>> getBookingDetailsByHallId(int hallId);
List<Map<String, Object>> getHallDetailsForOfficer(Integer hallIid);
// List<Object[]> getAllPaymentsDetails(String fromDate, String toDate, String
// paymentStatus);
// admin reports
//officer dashboard
Map<String, Map<String, Integer>> getOfficerDashboard(LocalDate fromDate, LocalDate toDate, String zone, String division, Integer hallid, String userType);
List<Object[]> getBookingDetailsByBookingDate(String fromDate, String toDate, String zone, String division,
Integer hallid);
List<Map<String, Object>> getHallDetailsForOfficer(Integer hallIid);
//List<Object[]> getAllPaymentsDetails(String fromDate, String toDate, String paymentStatus);
//admin reports
List<Object[]> getBookingDetailsByEventDate(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[]> getBookingDetailsByBookingDateWithStatus(String fromDate, String toDate, String bookingStatus,
String zone, String division, Integer hallid);
List<Object[]> getBookingDetailsByEventDate(String fromDate, String toDate, String zone, String division, Integer hallid);
List<Object[]> getBookingDetailsByEventDateWithStatus(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[]> getAllPaymentsDetails(String fromDate, String toDate, String paymentStatus, String zone,
String division, Integer hallid);
List<Object[]> getBookingDetailsByEventDateWithStatus(String fromDate, String toDate, String bookingStatus, String zone, String division, Integer hallid);
List<Object[]> getBookingHallDetailsReportByBookingDate(String fromDate, String toDate, String zone, String division,
Integer hallid);
List<Object[]> getAllPaymentsDetails(String fromDate, String toDate, String paymentStatus, String zone, String division, Integer hallid);
List<Object[]> getBookingHallDetailsReportByEventDate(String fromDate, String toDate, String zone, String division,
Integer hallid);
List<Object[]> getBookingHallDetailsReportByBookingDate(String fromDate, String toDate, String zone, String division, Integer hallid);
List<BookingDetails> getAllBookingsettlementDetailsByBookingDate(String fromDate, String toDate);
List<Object[]> getBookingHallDetailsReportByEventDate(String fromDate, String toDate, String zone, String division, Integer hallid);
List<BookingDetails> getAllBookingsettlementDetailsByBookingDateWithStatus(String fromDate, String toDate,
String refundStatus);
List<BookingDetails> getAllBookingsettlementDetailsByBookingDate(String fromDate, String toDate);
List<BookingDetails> getAllBookingsettlementDetailsByEventDate(String fromDate, String toDate);
List<BookingDetails> getAllBookingsettlementDetailsByBookingDateWithStatus(String fromDate, String toDate, String refundStatus);
List<BookingDetails> getAllBookingsettlementDetailsByEventDateWithStatus(String fromDate, String toDate,
String refundStatus);
List<BookingDetails> getAllBookingsettlementDetailsByEventDate(String fromDate, String toDate);
List<BookingDetails> getAllBookingDetailsBookingDateByZone(String fromDate, String toDate, String zone);
List<BookingDetails> getAllBookingsettlementDetailsByEventDateWithStatus(String fromDate, String toDate, String refundStatus);
List<BookingDetails> getAllBookingDetailsEventDateByZone(String fromDate, String toDate, String zone);
List<BookingDetails> getAllBookingDetailsBookingDateByZone(String fromDate, String toDate, String zone);
List<BookingDetails> getAllBookingDetailsBookingDateByZoneWithStatus(String fromDate, String toDate, String zone,
String bookingStatus);
List<BookingDetails> getAllBookingDetailsEventDateByZone(String fromDate, String toDate, String zone);
List<BookingDetails> getAllBookingDetailsEventDateByZoneWithStatus(String fromDate, String toDate, String zone,
String bookingStatus);
List<BookingDetails> getAllBookingDetailsBookingDateByZoneWithStatus(String fromDate, String toDate, String zone, String bookingStatus);
List<BookingDetails> getAllBookingsettlementDetailsByZoneByBookingDate(String fromDate, String toDate, String zone);
List<BookingDetails> getAllBookingDetailsEventDateByZoneWithStatus(String fromDate, String toDate, String zone, String bookingStatus);
List<BookingDetails> getAllBookingsettlementDetailsByZoneByEventDate(String fromDate, String toDate, String zone);
List<BookingDetails> getAllBookingsettlementDetailsByZoneByBookingDate(String fromDate, String toDate, String zone);
List<BookingDetails> getAllBookingsettlementDetailsByZoneByBookingDateWithStatus(String fromDate, String toDate,
String zone, String refundStatus);
List<BookingDetails> getAllBookingsettlementDetailsByZoneByEventDate(String fromDate, String toDate, String zone);
List<BookingDetails> getAllBookingsettlementDetailsByZoneByEventDateWithStatus(String fromDate, String toDate,
String zone, String refundStatus);
List<BookingDetails> getAllBookingsettlementDetailsByZoneByBookingDateWithStatus(String fromDate, String toDate, String zone, String refundStatus);
List<Object[]> getBookingHallDetailsReportByZoneByBookingDate(String fromDate, String toDate, String zone);
List<BookingDetails> getAllBookingsettlementDetailsByZoneByEventDateWithStatus(String fromDate, String toDate, String zone, String refundStatus);
List<Object[]> getBookingHallDetailsReportByZoneByEventDate(String fromDate, String toDate, String zone);
List<Object[]> getBookingHallDetailsReportByZoneByBookingDate(String fromDate, String toDate, String zone);
List<Object[]> getBookingHallDetailsReportByZoneByBookingDateHallname(String fromDate, String toDate, String zone,
Integer hallId);
List<Object[]> getBookingHallDetailsReportByZoneByEventDate(String fromDate, String toDate, String zone);
List<Object[]> getBookingHallDetailsReportByZoneByEventDateHallname(String fromDate, String toDate, String zone,
Integer hallId);
List<Object[]> getBookingHallDetailsReportByZoneByBookingDateHallname(String fromDate, String toDate, String zone, Integer hallId);
BookingDetails saveebdetails(int bookingId, double startingReading, MultipartFile startingReadingimage);
List<Object[]> getBookingHallDetailsReportByZoneByEventDateHallname(String fromDate, String toDate, String zone, Integer hallId);
String confirmStateBooking(int bookingId);
BookingDetails saveebdetails(int bookingId, double startingReading, MultipartFile startingReadingimage);
String uploadNOCFile(MultipartFile file, int bookingId);
String confirmStateBooking(int bookingId);
// gccapps
List<BookingDetails> getApprovedBookingDetails();
String uploadNOCFile(MultipartFile file, int bookingId);
List<BookingDetails> getRejectedBookingDetails();
//gccapps
List<BookingDetails> getApprovedBookingDetails();
List<Object[]> getAllPaymentsDetails(String fromDate, String toDate);
List<BookingDetails> getRejectedBookingDetails();
List<BookingDetails> getPastsEvents();
List<Object[]> getAllPaymentsDetails(String fromDate, String toDate);
List<BookingDetails> getPresentsEvents();
List<BookingDetails> getPastsEvents();
List<BookingDetails> getFuturesEvents();
List<BookingDetails> getPresentsEvents();
List<BookingDetails> getSettlementApprovedList();
List<BookingDetails> getFuturesEvents();
List<Map<String, Object>> getHallDetails(Integer hall_id);
List<BookingDetails> getSettlementApprovedList();
List<BookingDetails> getWaitingforNOCapproval();
List<Map<String, Object>> getHallDetails(Integer hall_id);
List<Object[]> getAllExtraPaymentsDetails(String fromDate, String toDate, String paymentStatus, String zone,
String division, Integer hallid);
List<BookingDetails> getWaitingforNOCapproval();
// developer
List<Object[]> getTransactionresponse(String fromDate, String toDate, Long bookingId, Long hallId);
List<Object[]> getAllExtraPaymentsDetails(String fromDate, String toDate, String paymentStatus, String zone, String division, Integer hallid);
List<Object[]> getRefundResponse(String fromDate, String toDate, Long bookingId);
//developer
List<Object[]> getTransactionresponse(String fromDate, String toDate, Long bookingId, Long hallId);
List<Object[]> getBookingCalendarDetails(String fromDate, String toDate, Long bookingId, String hallName);
List<Object[]> getRefundResponse(String fromDate, String toDate, Long bookingId);
List<BookingDetails> getBookingsByDateAndHall(String bookingDate, Long hallId);
List<Object[]> getBookingCalendarDetails(String fromDate, String toDate, Long bookingId, String hallName);
BookingDetails updateRefundStatusScheduler(int bookingId, RefundStatus status);
List<BookingDetails> getBookingsByDateAndHall(String bookingDate, Long hallId);
List<Object[]> getCounterWiseBookingCount(String fromDate, String toDate);
BookingDetails updateRefundStatusScheduler(int bookingId, RefundStatus status);
List<Object[]> getHallWiseBookingDetails(String fromDate, String toDate, String CounterId);
List<Object[]> getCounterWiseBookingCount(String fromDate, String toDate);
List<Object[]> getBookingDetailsForAllHalls(String fromDate, String toDate, String CounterId, Integer hallid);
List<Object[]> getHallWiseBookingDetails(String fromDate, String toDate, String CounterId);
List<Object[]> getCounterWiseBookingDetails(String fromDate, String toDate);
List<Object[]> getBookingDetailsForAllHalls(String fromDate, String toDate, String CounterId, Integer hallid);
List<Object> getZoneWiseBookingList(String fromDate, String toDate);
List<Object[]> getCounterWiseBookingDetails(String fromDate, String toDate);
List<Object> getAllHallWiseBookingList(String fromDate, String toDate);
List<Object> getZoneWiseBookingList(String fromDate, String toDate);
List<Object> getAllCounterWiseBookingList(String fromDate, String toDate);
List<Object> getAllHallWiseBookingList(String fromDate, String toDate);
// ak
List<Object[]> getSettlementInitiatedReport(String fromDate, String toDate);
List<Object> getAllCounterWiseBookingList(String fromDate, String toDate);
//ak
List<Object[]> getSettlementInitiatedReport(String fromDate, String toDate);
List<GccBlockingDate> getBlockedEvents();
}

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

@ -12,39 +12,70 @@ import com.gcc.communityHall.entity.HallImages;
public interface HallDetailService {
HallDetails saveHallDetails(HallDetails hallDetails, List<MultipartFile> hallImages);
HallDetails getHallById(int hallId);
HallDetails deActivateHallById(int hallId);
HallDetails saveHall(
String hallName,
float depositAmount,
float halfDayAmt, float fullDayAmt,
float gst ,float hallArea, String ebNumber, float ebCostPerUnit,
int 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<HallImages> getHallImages(int hallId);
String updateHallDetail(HallDetails hallDetails, List<MultipartFile> images);
List<HallDetails> removeHallById(HashSet<Integer> hallIds);
List<HallDetails> getHallNames();
void saveHallImage(Long hallId, MultipartFile file) throws IOException;
List<HallImages> getHallImagesByHallId(Long hallId);
List<HallDetails> getHallNamesbyzone(String zone);
public Map<String, Object> getHallsDetailsByZone(String zone);
//officerDashboard
public Map<String, Object> getHallsDetailsForOfficer(String zone);
void updatenewHallImages(Integer hallId, MultipartFile[] newHallImages);
String updateHallImage(Integer hallImageId, MultipartFile hallImage) throws IOException;
HallDetails saveHallDetails(HallDetails hallDetails, List<MultipartFile> hallImages);
HallDetails getHallById(int hallId);
HallDetails deActivateHallById(int hallId);
HallDetails saveHallByAdmin(
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);
/** 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);
String updateHallDetail(HallDetails hallDetails, List<MultipartFile> images);
List<HallDetails> removeHallById(HashSet<Integer> hallIds);
List<HallDetails> getHallNames();
void saveHallImage(Long hallId, MultipartFile file) throws IOException;
List<HallImages> getHallImagesByHallId(Long hallId);
List<HallDetails> getHallNamesbyzone(String zone);
public Map<String, Object> getHallsDetailsByZone(String zone);
// officerDashboard
public Map<String, Object> getHallsDetailsForOfficer(String zone);
void updatenewHallImages(Integer hallId, MultipartFile[] newHallImages);
String updateHallImage(Integer hallImageId, MultipartFile hallImage) throws IOException;
}

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

@ -1869,8 +1869,8 @@ public class BookingServiceImpl implements BookingService {
// sreeja
@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;
}
@ -2360,6 +2360,12 @@ public class BookingServiceImpl implements BookingService {
String reasonforblocking, List<String> selectedBookings, String updatedBy, String[] descriptions,
MultipartFile[] documents) {
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) {
Integer bookingId = Integer.parseInt(bookingIdStr);
Optional<BookingDetails> optionalBooking = bookingDetailsRepository.findById(bookingId);
@ -2387,102 +2393,10 @@ public class BookingServiceImpl implements BookingService {
updateBookingStatus(bb);
}
// GCC blocking entry
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);
if (documents != null && documents.length > 0 && descriptions != null
&& descriptions.length > 0) {
int i = 0;
for (MultipartFile document : documents) {
String filePath = uploadDirectory + "/" + gcc.getBlockingId() + "_" + i + "_"
+ document.getOriginalFilename();
String documentUrl = serverPath + "gccblockingdocs/" + gcc.getBlockingId() + "_" + i
+ "_" + document.getOriginalFilename();
try (FileOutputStream fos = new FileOutputStream(filePath)) {
// Save document to the file system
byte[] bytes = document.getBytes();
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
} catch (IOException e) {
throw new RuntimeException("Failed to save document", e);
}
i++;
}
}
// GCC blocking History
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);
List<Integer> bookingIds = saveGCCBlockingDate(gcc);
gccblockinghistory.setBookingIds(bookingIds.toString());
blockingHistoryRepository.save(gccblockinghistory);
// GCC calendar
for (Long hallId : hallIdsList) {
LocalDate fDate = LocalDate.parse(fromDate);
LocalDate tDate = LocalDate.parse(toDate);
List<LocalDate> dates = getDateRange(fDate, tDate);
for (LocalDate aa : dates) {
String uniqueId = aa.format(DateTimeFormatter.ofPattern("yyyyMMdd")) + hallId;
BookingCalendar data = getbyDates(aa, hallId.toString());
int userbookingbookingId = bookingIds.get(hallIdsList.indexOf(hallId));
if (data != null) {
System.out.println("uniqueId...1" + uniqueId);
data.setBookingId_1(String.valueOf(userbookingbookingId));
data.setBookingId_2(String.valueOf(userbookingbookingId));
data.setMorningSlot(true);
data.setEveningSlot(true);
data.setIs_blocked(true);
data.setUnique_id(uniqueId);
updateBookingStatus(data);
} else {
System.out.println("uniqueId...2" + uniqueId);
BookingCalendar book = new BookingCalendar();
book.setBdate(aa);
book.setBookingId_1(String.valueOf(userbookingbookingId));
book.setBookingId_2(String.valueOf(userbookingbookingId));
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);
}
}
}
updateBookingStatusById(booking.getBookingId(), booking.getBookingStatus().GCC_BLOCKED,
updateBookingStatusById(booking.getBookingId(), BookingStatus.GCC_BLOCKED,
reasonforblocking);
// whatsup msg and SMS
// 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.";
@ -2499,6 +2413,105 @@ public class BookingServiceImpl implements BookingService {
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();
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);
// Save document(s) if present
if (documents != null && documents.length > 0 && descriptions != null
&& descriptions.length > 0) {
int i = 0;
for (MultipartFile document : documents) {
String filePath = uploadDirectory + "/" + gcc.getBlockingId() + "_" + i + "_"
+ document.getOriginalFilename();
String documentUrl = serverPath + "gccblockingdocs/" + gcc.getBlockingId() + "_" + i
+ "_" + document.getOriginalFilename();
try (FileOutputStream fos = new FileOutputStream(filePath)) {
byte[] bytes = document.getBytes();
fos.write(bytes);
GccblockingDocuments documentDetails = new GccblockingDocuments();
documentDetails.setBlockingDate(gcc);
documentDetails.setBlockingDocument(documentUrl);
documentDetails.setDescription(descriptions[i]);
gccblockingDocumentsRepo.save(documentDetails);
} catch (IOException e) {
throw new RuntimeException("Failed to save document", e);
}
i++;
}
}
// 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.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(cancelledBookingIds.stream()
.map(String::valueOf).collect(Collectors.joining(",")));
blockingHistoryRepository.save(gccblockinghistory);
// ── Phase 3: Update BookingCalendar (mark dates as GCC-blocked) ──
for (Long hallId : hallIdsList) {
LocalDate fDate = LocalDate.parse(fromDate);
LocalDate tDate = LocalDate.parse(toDate);
List<LocalDate> dates = getDateRange(fDate, tDate);
for (LocalDate aa : dates) {
String uniqueId = aa.format(DateTimeFormatter.ofPattern("yyyyMMdd")) + hallId;
BookingCalendar data = getbyDates(aa, hallId.toString());
int userbookingbookingId = gccBookingIds.get(hallIdsList.indexOf(hallId));
if (data != null) {
System.out.println("uniqueId...1" + uniqueId);
data.setBookingId_1(String.valueOf(userbookingbookingId));
data.setBookingId_2(String.valueOf(userbookingbookingId));
data.setMorningSlot(true);
data.setEveningSlot(true);
data.setIs_blocked(true);
data.setUnique_id(uniqueId);
updateBookingStatus(data);
} else {
System.out.println("uniqueId...2" + uniqueId);
BookingCalendar book = new BookingCalendar();
book.setBdate(aa);
book.setBookingId_1(String.valueOf(userbookingbookingId));
book.setBookingId_2(String.valueOf(userbookingbookingId));
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);
}
}
}
@ -2559,17 +2572,19 @@ public class BookingServiceImpl implements BookingService {
List<LocalDate> dates = getDateRange(fDate, tDate);
for (LocalDate date : dates) {
// BookingDetails bookingData =
// bookingDetailsRepository.findByHallIdAndDate(date, hallId.intValue());
BookingCalendar data = getbyDates(date, hallId.toString());
String uniqueId = date.format(DateTimeFormatter.ofPattern("yyyyMMdd")) + hallId;
int userbookingbookingId = bookingIds.get(hallIdsList.indexOf(hallId));
if (data != null) {
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.setUnique_id(uniqueId);
// data.setUnique_id(uniqueId);
updateBookingStatus(data);
} else {
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";
Integer totalCount = entry.get("totalCount") != null ? ((Number) entry.get("totalCount")).intValue() : 0;
//
transformedData.putIfAbsent(category, new HashMap<>());
transformedData.get(category).put(key, totalCount);
@ -2664,6 +2680,7 @@ public class BookingServiceImpl implements BookingService {
: 0;
Integer futurebooking = entry.get("FUTURE_Events") != null
? ((Number) entry.get("FUTURE_Events")).intValue()
//
: 0;
transformedData.get(category).put("PAST_Events", pastbooking);
transformedData.get(category).put("FUTURE_Events", futurebooking);
@ -2710,9 +2727,13 @@ public class BookingServiceImpl implements BookingService {
Integer mainRefundedAmount = entry.get("main_refunded_amount") != null
? ((Number) entry.get("main_refunded_amount")).intValue()
: 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_net_amount", mainNetAmount);
transformedData.get(category).put("main_refunded_amount", mainRefundedAmount);
transformedData.get(category).put("main_gst_amount", mainGstAmount);
}
if (category.equals("past_future")) {
Integer pastbooking = entry.get("PAST_Events") != null ? ((Number) entry.get("PAST_Events")).intValue()
@ -2726,6 +2747,7 @@ public class BookingServiceImpl implements BookingService {
}
return transformedData;
}
@Override
@ -3078,4 +3100,128 @@ public class BookingServiceImpl implements BookingService {
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);
}
}
}
}
}
}

252
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.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import com.gcc.communityHall.entity.FloorDetails;
import com.gcc.communityHall.entity.HallDetails;
import com.gcc.communityHall.entity.HallImages;
import com.gcc.communityHall.repository.FloorDetailsRepository;
import com.gcc.communityHall.repository.HallDetailsRepository;
import com.gcc.communityHall.repository.HallImagesRepository;
import com.gcc.communityHall.service.HallDetailService;
@ -27,21 +30,28 @@ import com.gcc.communityHall.service.HallDetailService;
@Service
public class HallDetailServiceImpl implements HallDetailService {
// @Autowired
// @Autowired
private HallDetailsRepository hallDetailsRepository;
private HallImagesRepository hallImagesRepository;
private final String hallDirectory;
private final String hallImageUrl;
@Autowired
private FloorDetailsRepository floorDetailsRepository;
@Autowired
HallDetailServiceImpl(HallDetailsRepository hallDetailsRepository, HallImagesRepository hallImagesRepository, @Value("${file.hall.upload.directory}") String hallDirectory, @Value("${file.hall.fullpath}") String hallImageUrl){
this.hallDetailsRepository=hallDetailsRepository;
this.hallDirectory=hallDirectory;
this.hallImageUrl=hallImageUrl;
HallDetailServiceImpl(HallDetailsRepository hallDetailsRepository, HallImagesRepository hallImagesRepository,
@Value("${file.hall.upload.directory}") String hallDirectory,
@Value("${file.hall.fullpath}") String hallImageUrl) {
this.hallDetailsRepository = hallDetailsRepository;
this.hallDirectory = hallDirectory;
this.hallImageUrl = hallImageUrl;
this.hallImagesRepository = hallImagesRepository;
}
@Override
public HallDetails saveHallDetails(HallDetails hallDetails, List<MultipartFile> hallImages) {
if(hallImages.size()>0){
if (hallImages.size() > 0) {
}
return null;
@ -50,7 +60,7 @@ public class HallDetailServiceImpl implements HallDetailService {
@Override
public HallDetails getHallById(int hallId) {
Optional<HallDetails> hallDetails = hallDetailsRepository.findById(hallId);
if(hallDetails.isPresent()){
if (hallDetails.isPresent()) {
return hallDetails.get();
}
@ -63,14 +73,14 @@ public class HallDetailServiceImpl implements HallDetailService {
}
@Override
public HallDetails saveHall(
String hallName,float depositAmount, float halfDayAmt,
float fullDayAmt, float gst,float hallArea, String ebNumber, float ebCostPerUnit,
int 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) {
public HallDetails saveHallByAdmin(
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) {
HallDetails hall = new HallDetails();
hall.setHallName(hallName);
hall.setDoorNo(doorNo);
@ -98,14 +108,18 @@ public class HallDetailServiceImpl implements HallDetailService {
hall.setCreateddate(LocalDate.now());
hall.setHalfDepositAmount(halfDepositAmt);
HallDetails hallDetails = hallDetailsRepository.save(hall);
if(hallImages!=null && hallImages.length>0){
int i=0;
if (hallImages != null && hallImages.length > 0) {
int i = 0;
for (MultipartFile hallImage : hallImages) {
HallImages hallImages1 = new HallImages();
String filePath = hallDirectory+"/"+hallDetails.getHallId()+ "_"+i+"_" + hallImage.getOriginalFilename();
String imageUrl = hallImageUrl+"hallImages/"+hallDetails.getHallId()+ "_"+i+"_" + hallImage.getOriginalFilename();
try(FileOutputStream fos = new FileOutputStream(filePath)){
byte [] bytes = hallImage.getBytes();
String filePath = hallDirectory + "/" + hallDetails.getHallId() + "_" + i +
"_"
+ hallImage.getOriginalFilename();
String imageUrl = hallImageUrl + "hallImages/" + hallDetails.getHallId() +
"_" + i + "_"
+ hallImage.getOriginalFilename();
try (FileOutputStream fos = new FileOutputStream(filePath)) {
byte[] bytes = hallImage.getBytes();
fos.write(bytes);
hallImages1.setHallDetails(hallDetails);
hallImages1.setHallImage(imageUrl); // hall/imagename.jpg
@ -118,17 +132,105 @@ public class HallDetailServiceImpl implements HallDetailService {
}
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) {
// Fetch the existing hall details from the database
HallDetails hallDetails = hallDetailsRepository.findById(hallId)
.orElseThrow(() -> new RuntimeException("Hall not found with id: " + hallId));
if (newHallImages != null && newHallImages.length > 0) {
int i = hallDetails.getHallImagesList().size(); // Start index after existing images
int i = hallDetails.getHallImagesList().size(); // Start index after existing images
for (MultipartFile hallImage : newHallImages) {
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)) {
byte[] bytes = hallImage.getBytes();
@ -145,6 +247,7 @@ public class HallDetailServiceImpl implements HallDetailService {
}
}
}
public String updateHallImage(Integer hallImageId, MultipartFile hallImage) throws IOException {
Optional<HallImages> optionalHallImage = hallImagesRepository.findById(hallImageId);
if (optionalHallImage.isPresent()) {
@ -168,16 +271,16 @@ public class HallDetailServiceImpl implements HallDetailService {
}
}
@Override
public List<HallImages> getHallImages(int hallId) {
// TODO Auto-generated method stub
HallDetails hall = new HallDetails();
hall.setHallId(hallId);
@Override
public List<HallImages> getHallImages(int hallId) {
// TODO Auto-generated method stub
HallDetails hall = new HallDetails();
hall.setHallId(hallId);
return hallImagesRepository.findByHallDetails(hall);
}
return hallImagesRepository.findByHallDetails(hall);
}
@Override
@Override
public String updateHallDetail(HallDetails hallDetails, List<MultipartFile> images) {
HallDetails existingHall = hallDetailsRepository.findById(hallDetails.getHallId()).orElse(null);
@ -215,13 +318,15 @@ public class HallDetailServiceImpl implements HallDetailService {
} else {
hallImagesList.clear(); // Clear existing images
}
int i=0;
int i = 0;
for (MultipartFile image : images) {
HallImages hallImage = new HallImages();
try {
// 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)) {
byte[] bytes = image.getBytes();
fos.write(bytes);
@ -246,23 +351,25 @@ public class HallDetailServiceImpl implements HallDetailService {
@Override
public List<HallDetails> removeHallById(HashSet<Integer> hallIds) {
if(hallIds.isEmpty()){
if (hallIds.isEmpty()) {
hallIds.add(0);
}
//System.out.println(hallIds);
// System.out.println(hallIds);
return hallDetailsRepository.removeHallById(hallIds);
}
public List<HallDetails> getHallNames() {
List<HallDetails> halls = hallDetailsRepository.findAll();
return halls.stream()
.map(hall -> {
HallDetails hallDetails = new HallDetails();
hallDetails.setHallId(hall.getHallId());
hallDetails.setHallName(hall.getHallName());
return hallDetails;
})
.collect(Collectors.toList());
.map(hall -> {
HallDetails hallDetails = new HallDetails();
hallDetails.setHallId(hall.getHallId());
hallDetails.setHallName(hall.getHallName());
return hallDetails;
})
.collect(Collectors.toList());
}
@Override
public void saveHallImage(Long hallId, MultipartFile file) throws IOException {
try {
@ -270,7 +377,8 @@ public class HallDetailServiceImpl implements HallDetailService {
.orElseThrow(() -> new IllegalArgumentException("Invalid hall ID"));
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);
hallImagesRepository.save(hallImage);
} catch (Exception e) {
@ -279,25 +387,25 @@ public class HallDetailServiceImpl implements HallDetailService {
}
}
@Override
public List<HallImages> getHallImagesByHallId(Long hallId) {
return hallImagesRepository.findByHallDetails_HallId(hallId);
}
@Override
public List<HallDetails> getHallNamesbyzone(String zone) {
List<HallDetails> halls = hallDetailsRepository.findByZone(zone);
@Override
public List<HallDetails> getHallNamesbyzone(String zone) {
List<HallDetails> halls = hallDetailsRepository.findByZone(zone);
return halls.stream()
.map(hall -> {
HallDetails hallDetails = new HallDetails();
hallDetails.setHallId(hall.getHallId());
hallDetails.setHallName(hall.getHallName());
return hallDetails;
})
.collect(Collectors.toList());
}
@Override
.map(hall -> {
HallDetails hallDetails = new HallDetails();
hallDetails.setHallId(hall.getHallId());
hallDetails.setHallName(hall.getHallName());
return hallDetails;
})
.collect(Collectors.toList());
}
@Override
public Map<String, Object> getHallsDetailsByZone(String zone) {
// Get the total bookings and amount received by zone
Map<String, Object> halldetails = hallDetailsRepository.getTotalBookingsAndAmountReceivedByZone(zone);
@ -314,21 +422,21 @@ public class HallDetailServiceImpl implements HallDetailService {
return modifiableHalldetails;
}
//officer dashboard
@Override
public Map<String, Object> getHallsDetailsForOfficer(String zone) {
// Get the total bookings and amount received by zone
Map<String, Object> halldetails = hallDetailsRepository.getTotalCountsForOfficer(zone);
// officer dashboard
@Override
public Map<String, Object> getHallsDetailsForOfficer(String zone) {
// Get the total bookings and amount received by zone
Map<String, Object> halldetails = hallDetailsRepository.getTotalCountsForOfficer(zone);
// Create a new modifiable map and copy values from the unmodifiable map
Map<String, Object> modifiableHalldetails = new HashMap<>(halldetails);
// Create a new modifiable map and copy values from the unmodifiable map
Map<String, Object> modifiableHalldetails = new HashMap<>(halldetails);
// Get the details of each hall in the zone
List<Map<String, Object>> zonehalls = hallDetailsRepository.getHallCountsForOfficer(zone);
// Get the details of each hall in the zone
List<Map<String, Object>> zonehalls = hallDetailsRepository.getHallCountsForOfficer(zone);
// Add the list of hall details to the new modifiable map
modifiableHalldetails.put("zonehalls", zonehalls);
// Add the list of hall details to the new modifiable map
modifiableHalldetails.put("zonehalls", zonehalls);
return modifiableHalldetails;
}
return modifiableHalldetails;
}
}

2
src/main/resources/paymentConfig.properties

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

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

@ -55,197 +55,198 @@
</style>
<body>
<!-- Page Container -->
<div id="page-container"
class="sidebar-o sidebar-dark enable-page-overlay side-scroll page-header-fixed page-header-dark">
<!-- Side Overlay aside (right)-->
<aside th:replace="~{fragments/aside-right :: aside}"></aside>
<!-- END Side Overlay (right)-->
<!-- Sidebar Nav-->
<nav th:replace="~{fragments/nav-admin :: nav}"></nav>
<!-- END Sidebar -->
<!-- Header -->
<header th:replace="~{fragments/header-admin :: header}"></header>
<!-- END Header -->
<!-- Main Container -->
<main id="main-container">
<!-- Page Content -->
<!-- Card Container -->
<div class="content">
<div class="block block-rounded">
<form id="myForm" th:action="@{/communityhall/admin/getDeveloperdetails}" onsubmit="return validateme()"
method="post">
<div class="block-header bg-primary text-white">
<h3 class="block-title">Community Hall Reports</h3>
</div>
<div class="block-content">
<div class="row">
<div class="col-sm-3 mb-2">
<label class="form-label" for="fromdate">From:<span
class="text-danger">*</span></label> <input type="date"
th:value="${fromdate}" class="form-control" name="FromDate" id="fromdate"
placeholder="From Date" required="required" data-date-format="yyyy-mm-dd" />
</div>
<div class="col-sm-3 mb-2">
<label class="form-label" for="todate">To:<span class="text-danger">*</span></label>
<input type="date" th:value="${todate}" class="form-control" name="ToDate"
id="todate" placeholder="To Date" required="required"
data-date-format="yyyy-mm-dd" />
</div>
<div class="col-sm-3 mb-2">
<label class="form-label" for="request">Get Info:<span
class="text-danger">*</span></label>
<select type="text" class="form-control text-center" id="request" name="request"
<!-- Page Container -->
<div id="page-container"
class="sidebar-o sidebar-dark enable-page-overlay side-scroll page-header-fixed page-header-dark">
<!-- Side Overlay aside (right)-->
<aside th:replace="~{fragments/aside-right :: aside}"></aside>
<!-- END Side Overlay (right)-->
<!-- Sidebar Nav-->
<nav th:replace="~{fragments/nav-admin :: nav}"></nav>
<!-- END Sidebar -->
<!-- Header -->
<header th:replace="~{fragments/header-admin :: header}"></header>
<!-- END Header -->
<!-- Main Container -->
<main id="main-container">
<!-- Page Content -->
<!-- Card Container -->
<div class="content">
<div class="block block-rounded">
<form id="myForm" th:action="@{/communityhall/admin/getDeveloperdetails}"
onsubmit="return validateme()" method="post">
<div class="block-header bg-primary text-white">
<h3 class="block-title">Community Hall Reports</h3>
</div>
<div class="block-content">
<div class="row">
<div class="col-sm-3 mb-2">
<label class="form-label" for="fromdate">From:<span
class="text-danger">*</span></label> <input type="date"
th:value="${fromdate}" class="form-control" name="FromDate" id="fromdate"
placeholder="From Date" required="required" data-date-format="yyyy-mm-dd" />
</div>
<div class="col-sm-3 mb-2">
<label class="form-label" for="todate">To:<span class="text-danger">*</span></label>
<input type="date" th:value="${todate}" class="form-control" name="ToDate"
id="todate" placeholder="To Date" required="required"
data-date-format="yyyy-mm-dd" />
</div>
<div class="col-sm-3 mb-2">
<label class="form-label" for="request">Get Info:<span
class="text-danger">*</span></label>
<select type="text" class="form-control text-center" id="request" name="request"
onchange="myRequest()" required>
<option value="">Select</option>
<option value="1" th:selected="${request=='1'}">Transaction Response</option>
<option value="2" th:selected="${request=='2'}">Refund Response</option>
<option value="3" th:selected="${request=='3'}">Booking Calendar</option>
</select>
</div>
<!-- bookingDetailsDropdown1 -->
<div class="col-sm-3 mb-2" id="bookingDetailsDropdown1" style="display: none;">
<label class="form-label" for="bookingId">Booking Id: </label>
<input type="number" class="form-control" id="bookingId" name="bookingId"
th:value="${bookingId}" placeholder="BookingId">
</div>
<!-- bookingDetailsDropdown2 -->
<div class="col-sm-3 mb-2" id="bookingDetailsDropdown2" style="display: none;">
<label class="form-label" for="hallId">Hall Id: </label>
<input type="number" class="form-control" id="hallId" name="hallId"
th:value="${hallId}" placeholder="HallId">
</div>
<div class="col-sm-3 mb-2" id="bookingDetailsDropdown3" style="display: none;">
<label class="form-label" for="hallNameDropdown">Hall Name:</label>
<select class="form-select custom-select" name="hallName" id="hallNameDropdown">
<option th:value="${hallName}">--Select Hall--</option>
<!-- Initial population using Thymeleaf -->
<th:block th:each="hall : ${halls}">
<option th:value="${hall.hallName}"
th:text="${hall.hallName}">
</option>
</th:block>
</select>
</div>
<div class="col-sm-3">
<br>
<button type="submit" class="btn btn-sm btn-primary mt-2" name="submit"
<option value="">Select</option>
<option value="1" th:selected="${request=='1'}">Transaction Response</option>
<option value="2" th:selected="${request=='2'}">Refund Response</option>
<option value="3" th:selected="${request=='3'}">Booking Calendar</option>
</select>
</div>
<!-- bookingDetailsDropdown1 -->
<div class="col-sm-3 mb-2" id="bookingDetailsDropdown1" style="display: none;">
<label class="form-label" for="bookingId">Booking Id: </label>
<input type="number" class="form-control" id="bookingId" name="bookingId"
th:value="${bookingId}" placeholder="BookingId">
</div>
<!-- bookingDetailsDropdown2 -->
<div class="col-sm-3 mb-2" id="bookingDetailsDropdown2" style="display: none;">
<label class="form-label" for="hallId">Hall Id: </label>
<input type="number" class="form-control" id="hallId" name="hallId"
th:value="${hallId}" placeholder="HallId">
</div>
<div class="col-sm-3 mb-2" id="bookingDetailsDropdown3" style="display: none;">
<label class="form-label" for="hallNameDropdown">Hall Name:</label>
<select class="form-select custom-select" name="hallName" id="hallNameDropdown">
<option th:value="${hallName}">--Select Hall--</option>
<!-- Initial population using Thymeleaf -->
<th:block th:each="hall : ${halls}">
<option th:value="${hall.hallName}" th:text="${hall.hallName}">
</option>
</th:block>
</select>
</div>
<div class="col-sm-3">
<br>
<button type="submit" class="btn btn-sm btn-primary mt-2" name="submit"
id="submit">Submit</button>
<button class="btn btn-danger mt-2" onclick="resetDate()" name="reset"
<button class="btn btn-danger mt-2" onclick="resetDate()" name="reset"
type="reset">Reset</button>
</div>
</div>
</div>
</div>
</form>
</div>
<div class="table-responsive" id="requestTable1Container" th:if="${request}==1">
<table id="requestTable1" class="table table-striped table-bordered table-hover dataTable"
role="grid" width="99.5%">
<thead class="thead-dark">
<tr role="row">
<th>S.No</th>
<th>Booking Id</th>
<th>Hall Id</th>
<th>Amount</th>
<th>Status Code</th>
<th>Transaction Id</th>
<th>User Id</th>
<!--<th>Payment Status</th>-->
</tr>
</thead>
<tr th:each="transaction, iterStat : ${TransactionResponse}">
<td th:text="${iterStat.count}">0</td>
<td th:text="${transaction[0]}"></td>
<td th:text="${transaction[1]}"></td>
<td th:text="${transaction[2]}"></td>
<td th:text="${transaction[3]}"></td>
<td th:text="${transaction[4]}"></td>
<td th:text="${transaction[5]}"></td>
<!--
</form>
</div>
<div class="table-responsive" id="requestTable1Container" th:if="${request}==1">
<table id="requestTable1" class="table table-striped table-bordered table-hover dataTable"
role="grid" width="99.5%">
<thead class="thead-dark">
<tr role="row">
<th>S.No</th>
<th>Booking Id</th>
<th>Hall Id</th>
<th>Amount</th>
<th>Status Code</th>
<th>Transaction Id</th>
<th>User Id</th>
<th>Tpsl Txn Id</th>
<!--<th>Payment Status</th>-->
</tr>
</thead>
<tr th:each="transaction, iterStat : ${TransactionResponse}">
<td th:text="${iterStat.count}">0</td>
<td th:text="${transaction[0]}"></td>
<td th:text="${transaction[1]}"></td>
<td th:text="${transaction[2]}"></td>
<td th:text="${transaction[3]}"></td>
<td th:text="${transaction[4]}"></td>
<td th:text="${transaction[5]}"></td>
<td th:text="${transaction[6]}"></td>
<!--
<td th:text="${transaction[6]}"></td>
-->
</tr>
</tr>
</table>
</div>
<div class="table-responsive" id="requestTable2Container" th:if="${request}==2">
<table id="requestTable2" class="table table-striped table-bordered table-hover dataTable"
role="grid" width="99.5%">
<thead class="thead-dark">
<tr role="row">
<th>S.No</th>
<th>Booking Id</th>
<th>Booking Date</th>
<th>Refund Status</th>
<th>Amount</th>
<th>Transaction Id</th>
<th>User Id</th>
</tr>
</thead>
<tbody>
<tr th:each="refund, iterStat : ${RefundResponse}">
<td th:text="${iterStat.count}">0</td>
<td th:text="${refund[0]}"></td>
<td th:text="${refund[1] != null ? refund[1] : '-'}"></td>
<td th:text="${refund[2]}"></td>
<td th:text="${refund[3]}"></td>
<td th:text="${refund[4]}"></td>
<td th:text="${refund[5]}"></td>
</tr>
</tbody>
</table>
</div>
<div class="table-responsive" id="requestTable3Container" th:if="${request}==3">
<table id="requestTable3" class="table table-striped table-bordered table-hover dataTable"
role="grid" width="99.5%">
<thead class="thead-dark">
<tr role="row">
<th>S.No</th>
<th>Booking Date</th>
<th>Booking Id1</th>
<th>Booking Id2</th>
<th>Morning Slot</th>
<th>Evening Slot</th>
<th>Hall Name</th>
<th>Hall Id</th>
</tr>
</thead>
<tbody>
<tr th:each="booking, iterStat : ${BookingCalendar}">
<td th:text="${iterStat.count}">0</td>
<td th:text="${booking[0]}"></td>
<td th:text="${booking[1] != null ? booking[1] : '-'}"></td>
<td th:text="${booking[2] != null ? booking[2] : '-'}"></td>
<td th:text="${booking[3]}"></td>
<td th:text="${booking[4]}"></td>
<td th:text="${booking[5]}"></td>
<td th:text="${booking[6]}"></td>
</tr>
</tbody>
</table>
</div>
</table>
</div>
<div class="table-responsive" id="requestTable2Container" th:if="${request}==2">
<table id="requestTable2" class="table table-striped table-bordered table-hover dataTable"
role="grid" width="99.5%">
<thead class="thead-dark">
<tr role="row">
<th>S.No</th>
<th>Booking Id</th>
<th>Booking Date</th>
<th>Refund Status</th>
<th>Amount</th>
<th>Transaction Id</th>
<th>User Id</th>
</tr>
</thead>
<tbody>
<tr th:each="refund, iterStat : ${RefundResponse}">
<td th:text="${iterStat.count}">0</td>
<td th:text="${refund[0]}"></td>
<td th:text="${refund[1] != null ? refund[1] : '-'}"></td>
<td th:text="${refund[2]}"></td>
<td th:text="${refund[3]}"></td>
<td th:text="${refund[4]}"></td>
<td th:text="${refund[5]}"></td>
</tr>
</tbody>
</table>
</div>
<div class="table-responsive" id="requestTable3Container" th:if="${request}==3">
<table id="requestTable3" class="table table-striped table-bordered table-hover dataTable"
role="grid" width="99.5%">
<thead class="thead-dark">
<tr role="row">
<th>S.No</th>
<th>Booking Date</th>
<th>Booking Id1</th>
<th>Booking Id2</th>
<th>Morning Slot</th>
<th>Evening Slot</th>
<th>Hall Name</th>
<th>Hall Id</th>
</tr>
</thead>
<tbody>
<tr th:each="booking, iterStat : ${BookingCalendar}">
<td th:text="${iterStat.count}">0</td>
<td th:text="${booking[0]}"></td>
<td th:text="${booking[1] != null ? booking[1] : '-'}"></td>
<td th:text="${booking[2] != null ? booking[2] : '-'}"></td>
<td th:text="${booking[3]}"></td>
<td th:text="${booking[4]}"></td>
<td th:text="${booking[5]}"></td>
<td th:text="${booking[6]}"></td>
</tr>
</tbody>
</table>
</div>
</main>
<footer th:replace="~{fragments/footer2 :: footer}"></footer>
</div>
</div>
</main>
<footer th:replace="~{fragments/footer2 :: footer}"></footer>
</div>
<div th:replace="~{fragments/resetpassword :: div}"></div>
<script th:replace="~{fragments/loginscript :: script}"></script>
<script>
$(document).ready(function () {
<div th:replace="~{fragments/resetpassword :: div}"></div>
<script th:replace="~{fragments/loginscript :: script}"></script>
<script>
$(document).ready(function () {
// Common buttons configuration
var buttons = [{
extend: 'pageLength',
@ -356,60 +357,60 @@
});
});
function myRequest() {
// Hide all dropdowns initially
document.getElementById("bookingDetailsDropdown1").style.display = "none";
document.getElementById("bookingDetailsDropdown2").style.display = "none";
document.getElementById("bookingDetailsDropdown3").style.display = "none";
// Get the selected value from the 'Get Info' dropdown
var requestValue = document.getElementById("request").value;
// Show relevant dropdowns based on the selected value
if (requestValue === "1") {
document.getElementById("bookingDetailsDropdown1").style.display = "block";
document.getElementById("bookingDetailsDropdown2").style.display = "block";
} else if (requestValue === "2") {
document.getElementById("bookingDetailsDropdown1").style.display = "block";
} else if (requestValue === "3") {
document.getElementById("bookingDetailsDropdown1").style.display = "block";
document.getElementById("bookingDetailsDropdown3").style.display = "block";
// Fetch and populate Hall Names dropdown
fetch('/communityhall/user/api/gethallnames')
.then(response => response.json())
.then(data => {
// console.log('Hall Names Data:', data); // Debug log
const hallNameDropdown = document.getElementById('hallNameDropdown');
const selectedHall = hallNameDropdown.value; // Retain current selection
// Reset dropdown options
hallNameDropdown.innerHTML = '<option value="">--Select Hall--</option>';
// Populate options dynamically
data.forEach(hall => {
const option = document.createElement('option');
option.value = hall.hallName;
option.textContent = hall.hallName;
// Preserve selection
if (hall.hallName === selectedHall) {
option.selected = true;
}
hallNameDropdown.appendChild(option);
});
})
.catch(error => console.error('Error fetching hall names:', error));
}
}
document.addEventListener("DOMContentLoaded", function() {
document.getElementById("basedon").addEventListener("change", function() {
const selectedValue = this.value;
document.getElementById("bookingcountbasedonDropdown").style.display = selectedValue ? "block" : "none";
});
});
function myRequest() {
// Hide all dropdowns initially
document.getElementById("bookingDetailsDropdown1").style.display = "none";
document.getElementById("bookingDetailsDropdown2").style.display = "none";
document.getElementById("bookingDetailsDropdown3").style.display = "none";
// Get the selected value from the 'Get Info' dropdown
var requestValue = document.getElementById("request").value;
// Show relevant dropdowns based on the selected value
if (requestValue === "1") {
document.getElementById("bookingDetailsDropdown1").style.display = "block";
document.getElementById("bookingDetailsDropdown2").style.display = "block";
} else if (requestValue === "2") {
document.getElementById("bookingDetailsDropdown1").style.display = "block";
} else if (requestValue === "3") {
document.getElementById("bookingDetailsDropdown1").style.display = "block";
document.getElementById("bookingDetailsDropdown3").style.display = "block";
// Fetch and populate Hall Names dropdown
fetch('/communityhall/user/api/gethallnames')
.then(response => response.json())
.then(data => {
// console.log('Hall Names Data:', data); // Debug log
const hallNameDropdown = document.getElementById('hallNameDropdown');
const selectedHall = hallNameDropdown.value; // Retain current selection
// Reset dropdown options
hallNameDropdown.innerHTML = '<option value="">--Select Hall--</option>';
// Populate options dynamically
data.forEach(hall => {
const option = document.createElement('option');
option.value = hall.hallName;
option.textContent = hall.hallName;
// Preserve selection
if (hall.hallName === selectedHall) {
option.selected = true;
}
hallNameDropdown.appendChild(option);
});
})
.catch(error => console.error('Error fetching hall names:', error));
}
}
document.addEventListener("DOMContentLoaded", function () {
document.getElementById("basedon").addEventListener("change", function () {
const selectedValue = this.value;
document.getElementById("bookingcountbasedonDropdown").style.display = selectedValue ? "block" : "none";
});
});
// Function to reset date fields
function resetDate() {
@ -426,7 +427,7 @@ function myRequest() {
});
});
</script>
</script>
</body>
</html>

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

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

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

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

@ -40,6 +40,21 @@
<span class="nav-main-link-name">User Rejected List</span>
</a>
</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">
<a class="nav-main-link" href="/communityhall/admin/ongoingevents">
<i class="nav-main-link-icon fa fa-location-arrow"></i>
@ -82,7 +97,7 @@
<span class="nav-main-link-name">Discount Range</span>
</a>
</li>
<!-- <li class="nav-main-item">
<!-- <li class="nav-main-item">
<a class="nav-main-link" href="/communityhall/admin/settlement-approved">
<i class="nav-main-link-icon fa fa-location-arrow"></i>
<span class="nav-main-link-name">Settlement Approved List</span>
@ -142,12 +157,12 @@
<span class="nav-main-link-name">Notifications</span>
</a>
</li>
<li class="nav-main-item">
<!-- <li class="nav-main-item">
<a class="nav-main-link" href="/communityhall/admin/Gccblocking">
<i class="nav-main-link-icon fa fa-location-arrow"></i>
<span class="nav-main-link-name">Gcc Blocking</span>
</a>
</li>
</li> -->
<li class="nav-main-item">
<a class="nav-main-link" href="/communityhall/admin/Reports">
<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">
<a class="nav-main-link" href="/communityhall/headquarters/dashboard">
<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>
</li>
<li class="nav-main-item">
@ -30,6 +30,18 @@
<span class="nav-main-link-name">Login Creation</span>
</a>
</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">
<a class="nav-main-link" href="/communityhall/headquarters/ongoingevents">
<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>
</a>
</li>
<li class="nav-main-item">
<!-- <li class="nav-main-item">
<a class="nav-main-link" href="/communityhall/headquarters/Gccblocking">
<i class="nav-main-link-icon fa fa-location-arrow"></i>
<span class="nav-main-link-name">Gcc Blocking</span>
</a>
</li>
</li> -->
<li class="nav-main-item">
<a class="nav-main-link" href="/communityhall/headquarters/Reports">
<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>
</a>
</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">
<a class="nav-main-link" href="/communityhall/officer/Gccblocking">
<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

1263
src/main/resources/templates/officiallogin.html
File diff suppressed because it is too large
View File

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

@ -63,6 +63,23 @@
/* 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 {
width: 100%;
background-color: #333;
@ -1497,6 +1514,23 @@
</div> -->
</div>
<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>
<input type="hidden" name="bookingId" id="bookingId"
@ -2058,6 +2092,15 @@
}).then(function () {
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 {
userId = response.userId;
bookingId = response.bookingId;
@ -2382,7 +2425,11 @@
validateStep3();
});
var isNavigating = false; // Guard flag to prevent double-click step skipping
$(".next-step").click(function () {
if (isNavigating) return; // Ignore click if navigation is already in progress
var valid = true;
// Validate all required text inputs and file fields in Step 3
@ -2413,14 +2460,18 @@
}
if (currentStep < 4) {
isNavigating = true; // Lock navigation
$(".step-" + currentStep).fadeOut(500, function () {
if (currentStep === 3 && isLogin === false) {
$(".step-" + currentStep).fadeIn(500);
updateProgressBar();
isNavigating = false; // Unlock navigation
return "";
} else {
currentStep++;
$(".step-" + currentStep).fadeIn(500);
$(".step-" + currentStep).fadeIn(500, function () {
isNavigating = false; // Unlock after fade-in completes
});
updateProgressBar();
}
});
@ -2852,7 +2903,8 @@
$("#startDateInput").datepicker("destroy");
for (var i = 0; i < response.length; i++) {
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);
@ -2878,9 +2930,8 @@
endDateInput.disabled = true;
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++) {
var date = new Date(startDate);
date.setDate(startDate.getDate() + i);
@ -2893,8 +2944,11 @@
var bookingStatus = window.bookingResponse[formattedDate];
if (bookingStatus) {
// ── GCC-Blocked date: stop range here, do NOT include ──
if (bookingStatus[2]) {
break;
}
if (bookingStatus[0] && bookingStatus[1]) {
//alert("slot fulled");
break;
} else if (bookingStatus[0]) {
if (formatStartDate == formattedDate) {
@ -2917,7 +2971,6 @@
option.text = formattedDate;
endDateInput.appendChild(option);
}
} else {
var option = document.createElement('option');
option.value = formattedDate;
@ -3202,11 +3255,36 @@
$('#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
$("#startDateInput").on("change", function () {
const selectedDate = $(this).val();
const bookingStatus = window.bookingResponse[selectedDate] || {};
// const currentDate = new Date();
const currentHours = new Date().getHours();
const currentDateString = $("#serverDate").val();
@ -3234,11 +3312,17 @@
}
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[3]) {
return [true, "highlight-lightpink disabled", "Temporary Blocked"];
} */ else if (bookingStatus[0] && bookingStatus[1]) {
} else if (bookingStatus[2]) {
return [true, "highlight-blue disabled", "GCC Blocked"];
} else if (bookingStatus[0] && bookingStatus[1]) {
return [true, "highlight-pink disabled", "Slot Occupied"];
} else if (bookingStatus[0] && !bookingStatus[1]) {
return [true, "highlight-yellow", "Evening Slot Available"];
@ -3250,7 +3334,18 @@
// Helper function: Handles logic after 2 PM
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"];
} else if (bookingStatus[0] || bookingStatus[1]) {
return [true, "highlight-pink disabled", "Slot Occupied"];
@ -3260,7 +3355,18 @@
// Helper function: Handles morning slots between 6 AM and 2 PM
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"];
} else if (bookingStatus[0] && bookingStatus[1]) {
return [true, "highlight-pink disabled", "Slot Occupied"];

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

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

@ -95,6 +95,11 @@
font-weight: bold;
}
.highlight-blue .ui-state-default {
background: blue !important;
color: #FFF !important;
}
.highlight-greens .ui-state-default {
background: green !important;
color: #FFF !important;
@ -699,15 +704,14 @@
Booking</span>
</a>
<!--<a class="reschedule-button"
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"
style="cursor: pointer;"
th:onclick="openRescheduleModal([[${booking.booking_id}]], [[${booking.start_date}]], [[${booking.end_date}]],[[${booking.no_of_days}]],
<!-- <a class="reschedule-button"
th:if="${booking.booking_status == 'WAITING_FOR_NOC' and booking.schedule_count < 1}">
<span class="badge bg-danger"
style="cursor: pointer;"
th:onclick="openRescheduleModal([[${booking.booking_id}]], [[${booking.start_date}]], [[${booking.end_date}]],[[${booking.no_of_days}]],
[[${booking.hall_details_hall_id}]],[[${booking.starting_slot}]],[[${booking.ending_slot}]],[[${booking.reason}]])">Reschedule
Booking</span>
</a>-->
Booking</span>
</a> -->
</p>
<p th:case="'waitingfornocapproval'">
@ -1365,6 +1369,7 @@
</div>
</div>
</div>
<!-- Reschedule Booking Modal -->
<div class="modal fade" id="bookingRescheduleModal" tabindex="-1"
aria-labelledby="bookingModalLabel" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered modal-lg">
@ -1377,7 +1382,7 @@
<br>
<div style="margin-bottom: -59px; margin-left: -185px;">
<!-- 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>
</div>
<button type="button" class="btn-close" data-bs-dismiss="modal"
@ -2383,7 +2388,8 @@
$("#startDateInput").datepicker("destroy");
for (var i = 0; i < response.length; i++) {
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);
@ -2506,11 +2512,18 @@
}
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[3]) {
return [true, "highlight-lightpink disabled", "Temporary Blocked"];
}*/ else if (bookingStatus[0] && bookingStatus[1]) {
} else if (bookingStatus[2]) {
return [true, "highlight-blue disabled", "GCC Blocked"];
} else if (bookingStatus[0] && bookingStatus[1]) {
return [true, "highlight-pink disabled", "Slot Occupied"];
} else if (bookingStatus[0] && !bookingStatus[1]) {
return [true, "highlight-yellow", "Evening Slot Available"];
@ -2522,7 +2535,15 @@
// Helper function: Handles logic after 2 PM
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"];
} else if (bookingStatus[0] || bookingStatus[1]) {
return [true, "highlight-pink disabled", "Slot Occupied"];
@ -2532,7 +2553,15 @@
// Helper function: Handles morning slots between 6 AM and 2 PM
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"];
} else if (bookingStatus[0] && bookingStatus[1]) {
return [true, "highlight-pink disabled", "Slot Occupied"];

Loading…
Cancel
Save