Browse Source

Enhancement added and Bugs fixed

master
kanimozhi 2 years ago
parent
commit
3e6470ef67
  1. 1
      src/main/java/com/gcc/communityHall/controller/AdminAPIController.java
  2. 95
      src/main/java/com/gcc/communityHall/controller/Admincontroller.java
  3. 85
      src/main/java/com/gcc/communityHall/controller/HeadquartersController.java
  4. 2
      src/main/java/com/gcc/communityHall/controller/OfficerAPIController.java
  5. 505
      src/main/java/com/gcc/communityHall/controller/UserAPIController.java
  6. 84
      src/main/java/com/gcc/communityHall/controller/UserController.java
  7. 25
      src/main/java/com/gcc/communityHall/entity/BookingCalendar.java
  8. 50
      src/main/java/com/gcc/communityHall/paymentService/controller/PaymentAPIController.java
  9. 2
      src/main/java/com/gcc/communityHall/paymentService/controller/PaymentController.java
  10. 16
      src/main/java/com/gcc/communityHall/paymentService/repository/TransactionResponseRepository.java
  11. 9
      src/main/java/com/gcc/communityHall/paymentService/service/PaymentGatewayServiceImpl.java
  12. 19
      src/main/java/com/gcc/communityHall/repository/BookingCalendarRepository.java
  13. 310
      src/main/java/com/gcc/communityHall/repository/BookingDetailsRepository.java
  14. 1
      src/main/java/com/gcc/communityHall/repository/HallDetailsRepository.java
  15. 5
      src/main/java/com/gcc/communityHall/service/BookingService.java
  16. 918
      src/main/java/com/gcc/communityHall/service/Impl/BookingServiceImpl.java
  17. 2
      src/main/resources/templates/admin/adminpage.html
  18. 6
      src/main/resources/templates/admin/caretakerpage.html
  19. 14
      src/main/resources/templates/admin/developer.html
  20. 67
      src/main/resources/templates/admin/gccblocking.html
  21. 6
      src/main/resources/templates/admin/ongoingevents.html
  22. 3
      src/main/resources/templates/admin/viewUploadNoc.html
  23. 25
      src/main/resources/templates/caretaker/caretakerpage.html
  24. 1
      src/main/resources/templates/caretaker/past-booking.html
  25. 8
      src/main/resources/templates/caretaker/present-booking.html
  26. 14
      src/main/resources/templates/fragments/PaymentScript.html
  27. 6
      src/main/resources/templates/fragments/headquartersMenu.html
  28. 26
      src/main/resources/templates/fragments/logRegiOtpScript.html
  29. 2
      src/main/resources/templates/fragments/loginscript.html
  30. 4
      src/main/resources/templates/fragments/resetpassword.html
  31. 16
      src/main/resources/templates/headquarters/bookingwaiting.html
  32. 1387
      src/main/resources/templates/headquarters/gccblocking.html
  33. 2
      src/main/resources/templates/headquarters/headquarterspage.html
  34. 8
      src/main/resources/templates/headquarters/ongoingevents.html
  35. 12
      src/main/resources/templates/headquarters/settlement-completed.html
  36. 3
      src/main/resources/templates/headquarters/viewUploadNoc.html
  37. 2
      src/main/resources/templates/officer/booking-list.html
  38. 2
      src/main/resources/templates/officer/rejected-list.html
  39. 4
      src/main/resources/templates/officiallogin.html
  40. 622
      src/main/resources/templates/user/calculatehallamount.html
  41. 16
      src/main/resources/templates/user/collectionpending.html
  42. 49
      src/main/resources/templates/user/dashboard.html
  43. 533
      src/main/resources/templates/user/hallbookingform.html
  44. 212
      src/main/resources/templates/user/viewhallform.html
  45. 170
      src/main/resources/templates/user/viewhistory.html

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

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

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

@ -151,7 +151,6 @@ public class Admincontroller {
String adminname = (String) session.getAttribute("usertype"); String adminname = (String) session.getAttribute("usertype");
if(adminname != null) { if(adminname != null) {
long mobileno = (long) session.getAttribute("mobileno"); long mobileno = (long) session.getAttribute("mobileno");
model.addAttribute("adminname", adminname);
model.addAttribute("mobileno", mobileno); model.addAttribute("mobileno", mobileno);
return "admin/reports"; return "admin/reports";
}else { }else {
@ -186,7 +185,7 @@ public class Admincontroller {
}else { }else {
session.invalidate(); // Invalidate the session to clear all session attributes session.invalidate(); // Invalidate the session to clear all session attributes
return "redirect:/communityhall/login"; return "redirect:/communityhall/login";
}
}
} }
@GetMapping("/halldetailslist") @GetMapping("/halldetailslist")
@ -270,10 +269,10 @@ public class Admincontroller {
session.invalidate(); session.invalidate();
return "redirect:/communityhall/login"; return "redirect:/communityhall/login";
} }
}
}
@GetMapping("/refundfailed-list") @GetMapping("/refundfailed-list")
public String RefundFailedList(Model model,HttpSession session) {
public String RefundFailedList(Model model,HttpSession session) {
String adminname = (String) session.getAttribute("usertype"); String adminname = (String) session.getAttribute("usertype");
if(adminname!=null) { if(adminname!=null) {
model.addAttribute("adminname", adminname); model.addAttribute("adminname", adminname);
@ -289,12 +288,12 @@ public class Admincontroller {
model.addAttribute("refundfailedcancelledbookings",refundfailedcancelledbookings); model.addAttribute("refundfailedcancelledbookings",refundfailedcancelledbookings);
model.addAttribute("refundfailedrejectedbookings",refundfailedrejectedbookings); model.addAttribute("refundfailedrejectedbookings",refundfailedrejectedbookings);
return "admin/refund-failedlist"; return "admin/refund-failedlist";
}
else {
}
else {
session.invalidate(); session.invalidate();
return "redirect:/communityhall/login"; return "redirect:/communityhall/login";
}
}
}
}
@GetMapping("/settlement-completedlist") @GetMapping("/settlement-completedlist")
public String viewSettlementcompletedMaster(Model model,HttpSession session) { public String viewSettlementcompletedMaster(Model model,HttpSession session) {
String adminname = (String) session.getAttribute("usertype"); String adminname = (String) session.getAttribute("usertype");
@ -327,7 +326,7 @@ public class Admincontroller {
session.invalidate(); // Invalidate the session to clear all session attributes session.invalidate(); // Invalidate the session to clear all session attributes
return "redirect:/communityhall/login"; return "redirect:/communityhall/login";
} }
}
}
@GetMapping("/userdeactive") @GetMapping("/userdeactive")
public String viewuserDetails(Model model,HttpSession session) { public String viewuserDetails(Model model,HttpSession session) {
String adminname = (String) session.getAttribute("usertype"); String adminname = (String) session.getAttribute("usertype");
@ -531,26 +530,6 @@ public class Admincontroller {
} }
} }
/* @GetMapping("/viewUploadNoc")
public String viewUploadNoc(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);
// Fetch waiting bookings
List<BookingDetails> waitingBookings = bookingDetailsRepository.getAllwaitingNOC();
System.out.println("Waiting Bookings: " + waitingBookings.size());
model.addAttribute("waitingBookings", waitingBookings);
return "admin/viewUploadNoc";
} else {
session.invalidate(); // Invalidate the session to clear all session attributes
return "redirect:/communityhall/login";
}
}*/
@GetMapping("/bookingwaitinglist") @GetMapping("/bookingwaitinglist")
public String viewWaitingBookings(Model model,HttpSession session) { public String viewWaitingBookings(Model model,HttpSession session) {
String adminname = (String) session.getAttribute("usertype"); String adminname = (String) session.getAttribute("usertype");
@ -568,25 +547,6 @@ public class Admincontroller {
} }
} }
@GetMapping("/viewUploadNoc")
public String viewUploadNoc(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);
// Fetch waiting bookings
List<BookingDetails> waitingBookings = bookingDetailsRepository.getAllwaitingNOC();
System.out.println("Waiting Bookings: " + waitingBookings.size());
model.addAttribute("waitingBookings", waitingBookings);
return "admin/viewUploadNoc";
} else {
session.invalidate(); // Invalidate the session to clear all session attributes
return "redirect:/communityhall/login";
}
}
@PostMapping("/getReport") @PostMapping("/getReport")
public String generateReport(Model model, public String generateReport(Model model,
@RequestParam(name = "FromDate") @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) String fromDate, @RequestParam(name = "FromDate") @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) String fromDate,
@ -891,7 +851,7 @@ public class Admincontroller {
return "redirect:/communityhall/login"; return "redirect:/communityhall/login";
} }
} }
// @GetMapping("/getDeveloperdetails")
// @GetMapping("/getDeveloperdetails")
// public String getDetails(Model model,HttpSession session) // public String getDetails(Model model,HttpSession session)
// { // {
// String adminname = (String) session.getAttribute("usertype"); // String adminname = (String) session.getAttribute("usertype");
@ -904,8 +864,8 @@ public class Admincontroller {
// return "redirect:/communityhall/login"; // return "redirect:/communityhall/login";
// } // }
// } // }
@PostMapping("/getDeveloperdetails")
public String generatedetails(Model model,
@PostMapping("/getDeveloperdetails")
public String generatedetails(Model model,
@RequestParam(name = "FromDate") @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) String fromDate, @RequestParam(name = "FromDate") @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) String fromDate,
@RequestParam(name = "ToDate") @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) String toDate, @RequestParam(name = "ToDate") @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) String toDate,
@RequestParam(name = "request") String request, @RequestParam(name = "request") String request,
@ -969,7 +929,7 @@ public class Admincontroller {
session.invalidate(); // Invalidate the session to clear all session attributes session.invalidate(); // Invalidate the session to clear all session attributes
return "redirect:/communityhall/login"; return "redirect:/communityhall/login";
} }
}
}
@GetMapping("/notification") @GetMapping("/notification")
public String viewNotificationPage(Model model,HttpSession session) { public String viewNotificationPage(Model model,HttpSession session) {
@ -1005,12 +965,10 @@ public class Admincontroller {
@GetMapping("/settlementlist") @GetMapping("/settlementlist")
public String viewSettlementList(Model model, HttpSession session) { public String viewSettlementList(Model model, HttpSession session) {
String adminname = (String) session.getAttribute("usertype");
if (adminname != null) {
String userType = (String) session.getAttribute("usertype");
if (userType != null) {
List<BookingDetails> settlemetList = bookingRepository.getAllSettlementList(); List<BookingDetails> settlemetList = bookingRepository.getAllSettlementList();
model.addAttribute("settlemetList", settlemetList); model.addAttribute("settlemetList", settlemetList);
model.addAttribute("adminname", adminname);
return "admin/settlementlist"; return "admin/settlementlist";
} else { } else {
session.invalidate(); session.invalidate();
@ -1038,11 +996,10 @@ public class Admincontroller {
@GetMapping("/settlement-reject") @GetMapping("/settlement-reject")
public String settlementRejectedList(Model model, HttpSession session) { public String settlementRejectedList(Model model, HttpSession session) {
String adminname = (String) session.getAttribute("usertype");
if (adminname != null) {
String userType = (String) session.getAttribute("usertype");
if (userType != null) {
List<BookingDetails> settlement = bookingDetailsRepository.findAllSettlementRejected(); List<BookingDetails> settlement = bookingDetailsRepository.findAllSettlementRejected();
model.addAttribute("title", "Settlement Rejected"); model.addAttribute("title", "Settlement Rejected");
model.addAttribute("adminname", adminname);
model.addAttribute("rejectSettlementlist", settlement); model.addAttribute("rejectSettlementlist", settlement);
return "admin/settlement-reject"; return "admin/settlement-reject";
} else { } else {
@ -1058,5 +1015,25 @@ public class Admincontroller {
return "redirect:/communityhall/login"; return "redirect:/communityhall/login";
} }
@GetMapping("/viewUploadNoc")
public String viewUploadNoc(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);
// Fetch waiting bookings
List<BookingDetails> waitingBookings = bookingDetailsRepository.getAllwaitingNOC();
System.out.println("Waiting Bookings: " + waitingBookings.size());
model.addAttribute("waitingBookings", waitingBookings);
return "admin/viewUploadNoc";
} else {
session.invalidate(); // Invalidate the session to clear all session attributes
return "redirect:/communityhall/login";
}
}
} }

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

@ -1,10 +1,12 @@
package com.gcc.communityHall.controller; package com.gcc.communityHall.controller;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.gcc.communityHall.entity.GccBlockingDate;
import com.gcc.communityHall.others.AppConfig; import com.gcc.communityHall.others.AppConfig;
import com.gcc.communityHall.repository.GccBlockingDateRepository;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
@ -46,6 +48,9 @@ public class HeadquartersController {
@Autowired @Autowired
private BookingDetailsRepository bookingDetailsRepository; private BookingDetailsRepository bookingDetailsRepository;
@Autowired
private GccBlockingDateRepository blockingDateRepository;
@Autowired @Autowired
private AppConfig appConfig; private AppConfig appConfig;
@ -540,10 +545,10 @@ public class HeadquartersController {
session.invalidate(); session.invalidate();
return "redirect:/communityhall/login"; return "redirect:/communityhall/login";
} }
}
}
@GetMapping("/refundfailed-list") @GetMapping("/refundfailed-list")
public String RefundFailedList(Model model,HttpSession session) {
public String RefundFailedList(Model model,HttpSession session) {
String headquartersname = (String) session.getAttribute("usertype"); String headquartersname = (String) session.getAttribute("usertype");
if(headquartersname!=null) { if(headquartersname!=null) {
model.addAttribute("headquartersname", headquartersname); model.addAttribute("headquartersname", headquartersname);
@ -559,12 +564,12 @@ public class HeadquartersController {
model.addAttribute("refundfailedcancelledbookings",refundfailedcancelledbookings); model.addAttribute("refundfailedcancelledbookings",refundfailedcancelledbookings);
model.addAttribute("refundfailedrejectedbookings",refundfailedrejectedbookings); model.addAttribute("refundfailedrejectedbookings",refundfailedrejectedbookings);
return "headquarters/refund-failedlist"; return "headquarters/refund-failedlist";
}
else {
}
else {
session.invalidate(); session.invalidate();
return "redirect:/communityhall/login"; return "redirect:/communityhall/login";
}
}
}
}
@GetMapping("/settlement-completedlist") @GetMapping("/settlement-completedlist")
public String viewSettlementcompletedMaster(Model model,HttpSession session) { public String viewSettlementcompletedMaster(Model model,HttpSession session) {
String headquartersname = (String) session.getAttribute("usertype"); String headquartersname = (String) session.getAttribute("usertype");
@ -633,6 +638,62 @@ public class HeadquartersController {
} }
} }
@GetMapping("/logout")
public String viewLogout(Model model,HttpSession session) {
session.invalidate();
return "redirect:/communityhall/login";
}
@GetMapping("/Gccblocking")
public String viewGccBlocking(Model model, HttpSession session) {
String headquartersname = (String) session.getAttribute("usertype");
if(headquartersname != null) {
long mobileno = (long) session.getAttribute("mobileno");
model.addAttribute("mobileno", mobileno);
model.addAttribute("headquartersname", headquartersname);
// Fetch all blocked GCC dates
List<GccBlockingDate> gccBlocked = blockingDateRepository.findAllBlocked();
// Ensure distinct by hallId, blockingReason, startDate, and endDate
List<GccBlockingDate> uniqueGccBlockingDates = gccBlocked.stream()
.filter(distinctByKey(g -> Arrays.asList(
g.getHallId(),
g.getBlockingReason(),
g.getStartDate(),
g.getEndDate())))
.collect(Collectors.toList());
// Map to store the count of blocked halls for each GccBlockingDate
Map<Integer, Integer> hallCountMap = new HashMap<>();
for (GccBlockingDate blockedDate : uniqueGccBlockingDates) {
// Parse and count unique hall IDs
String hallIds = blockedDate.getHallId();
if (hallIds != null && !hallIds.isEmpty()) {
Set<String> uniqueHallIds = new HashSet<>(Arrays.asList(hallIds.split(",")));
int hallCount = uniqueHallIds.size();
hallCountMap.put(blockedDate.getBlockingId(), hallCount);
} else {
hallCountMap.put(blockedDate.getBlockingId(), 0); // No halls blocked
}
}
// Add attributes to the model for the view
model.addAttribute("gccblocked", uniqueGccBlockingDates);
model.addAttribute("hallCountMap", hallCountMap);
return "headquarters/gccblocking";
}else {
session.invalidate(); // Invalidate the session to clear all session attributes
return "redirect:/communityhall/login";
}
}
// Utility method to ensure distinct by a key
private static <T> Predicate<T> distinctByKey(Function<? super T, ?> keyExtractor) {
Set<Object> seen = new HashSet<>();
return t -> seen.add(keyExtractor.apply(t));
}
@GetMapping("/viewUploadNoc") @GetMapping("/viewUploadNoc")
public String viewUploadNoc(Model model, HttpSession session) { public String viewUploadNoc(Model model, HttpSession session) {
String headquartersname = (String) session.getAttribute("usertype"); String headquartersname = (String) session.getAttribute("usertype");
@ -653,11 +714,5 @@ public class HeadquartersController {
} }
} }
@GetMapping("/logout")
public String viewLogout(Model model,HttpSession session) {
session.invalidate();
return "redirect:/communityhall/login";
}
} }

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

@ -226,7 +226,6 @@ public class OfficerAPIController {
} }
} }
@Operation( @Operation(
summary = "Settlement APPROVED REST API", summary = "Settlement APPROVED REST API",
description = "REST API for Updating the Refund Status to Approved by Settlement Id If the settlement is Approved" description = "REST API for Updating the Refund Status to Approved by Settlement Id If the settlement is Approved"
@ -337,7 +336,6 @@ public class OfficerAPIController {
return new ResponseEntity<>(HttpStatus.NOT_FOUND); return new ResponseEntity<>(HttpStatus.NOT_FOUND);
} }
} }
@PostMapping("/toggleStatus") @PostMapping("/toggleStatus")
public ResponseEntity<String> toggleUserStatus( public ResponseEntity<String> toggleUserStatus(
@RequestParam Integer userId, @RequestParam Integer userId,

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

@ -1,6 +1,7 @@
package com.gcc.communityHall.controller; package com.gcc.communityHall.controller;
import java.io.File; import java.io.File;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
@ -27,9 +28,6 @@ import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod; import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.messaging.handler.annotation.MessageMapping;
import org.springframework.messaging.handler.annotation.SendTo;
import org.springframework.messaging.simp.SimpMessagingTemplate;
import org.springframework.ui.Model; import org.springframework.ui.Model;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
@ -45,8 +43,6 @@ import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest; import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.thymeleaf.context.Context; import org.thymeleaf.context.Context;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.gcc.communityHall.dto.BookingDetailsDTO; import com.gcc.communityHall.dto.BookingDetailsDTO;
import com.gcc.communityHall.dto.EmployeeDetails; import com.gcc.communityHall.dto.EmployeeDetails;
@ -105,9 +101,7 @@ import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpSession; import jakarta.servlet.http.HttpSession;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import static org.hibernate.query.sqm.tree.SqmNode.log; import static org.hibernate.query.sqm.tree.SqmNode.log;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
@ -181,14 +175,9 @@ public class UserAPIController {
@Autowired @Autowired
private TransRefundResRepository transRefundResRepository; private TransRefundResRepository transRefundResRepository;
private final SimpMessagingTemplate messagingTemplate;
@Autowired @Autowired
public UserAPIController(@Value("${file.upload.directory}") String uploadDirectory,
SimpMessagingTemplate messagingTemplate, BookingService bookingService) {
public UserAPIController(@Value("${file.upload.directory}") String uploadDirectory) {
this.uploadDirectory = uploadDirectory; this.uploadDirectory = uploadDirectory;
this.messagingTemplate = messagingTemplate;
// this.bookingService = bookingService;
} }
@Operation( @Operation(
@ -243,27 +232,28 @@ public class UserAPIController {
) )
//SendOTP //SendOTP
@GetMapping(value = "/sendOTP") @GetMapping(value = "/sendOTP")
public String sendOtp(HttpServletRequest request, @RequestParam Long mobileNo, @RequestParam String purpose) {
public String sendOtp(HttpServletRequest request, @RequestParam Long mobileNo,@RequestParam String purpose) {
Long MobileNo = mobileNo;
Long MobileNo=mobileNo;
//System.out.println(purpose); //System.out.println(purpose);
//System.out.print("\n MobileNo---:"+mobileNo); //System.out.print("\n MobileNo---:"+mobileNo);
Random rand = new Random(); Random rand = new Random();
int otp = rand.nextInt(90000) + 10000;
System.out.print("\n otp---:" + otp);
// int otp = rand.nextInt(90000) + 10000;
int otp = 11111;
System.out.print("\n otp---:"+otp);
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("dd-MMM-yyyy%20HH:mm"); DateTimeFormatter dtf = DateTimeFormatter.ofPattern("dd-MMM-yyyy%20HH:mm");
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now();
//System.out.println(dtf.format(now)); //System.out.println(dtf.format(now));
String key = "pfTEYN6H";
String generatedToken = "Welcome to GCC! Your OTP for GCC Community Centre is " + otp;
String urlString = "https://tmegov.onex-aura.com/api/sms?key=pfTEYN6H&to=" + mobileNo + "&from=GCCCRP&body=Welcome to GCC! Your OTP for GCC Community Centre booking is " + otp + "&entityid=1401572690000011081&templateid=1407172346444550398";
String key="pfTEYN6H";
String generatedToken = "Welcome to GCC! Your OTP for GCC Community Centre is "+otp;
String urlString = "https://tmegov.onex-aura.com/api/sms?key=pfTEYN6H&to="+mobileNo+"&from=GCCCRP&body=Welcome to GCC! Your OTP for GCC Community Centre booking is "+otp+"&entityid=1401572690000011081&templateid=1407172346444550398";
System.out.println(urlString); System.out.println(urlString);
System.out.print("\n urlString---: " + urlString);
System.out.print("\n urlString---: "+urlString);
String bodyMessage = ""; String bodyMessage = "";
try {
/*try {
RestTemplate restTemplate = new RestTemplate(); RestTemplate restTemplate = new RestTemplate();
String Response = restTemplate.getForObject(urlString, String.class); String Response = restTemplate.getForObject(urlString, String.class);
bodyMessage = Response;
bodyMessage=Response;
SmsSender sms = new SmsSender(); SmsSender sms = new SmsSender();
sms.setPhone(MobileNo); sms.setPhone(MobileNo);
sms.setCdate(new Date()); sms.setCdate(new Date());
@ -271,13 +261,13 @@ public class UserAPIController {
sms.setPurpose(purpose); sms.setPurpose(purpose);
smsSenderRepository.save(sms); 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 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); String sendMsg = whatsappMsgServiceImpl.sendMsg(whatsappMsg);
System.out.println("sendwhatsuprepsosne====" + sendMsg);
System.out.println("sendwhatsuprepsosne===="+sendMsg);
} catch (Exception e) { } catch (Exception e) {
// System.out.print("ERROR in Sending---: "+e); // System.out.print("ERROR in Sending---: "+e);
bodyMessage = "Error"; bodyMessage = "Error";
}
}*/
HttpSession session = request.getSession(); HttpSession session = request.getSession();
session.setAttribute("otp", otp); session.setAttribute("otp", otp);
@ -290,7 +280,7 @@ public class UserAPIController {
) )
//VerifyOTP //VerifyOTP
@GetMapping(value = "/verifyOTP") @GetMapping(value = "/verifyOTP")
public String verifyOtp(HttpServletRequest request, @RequestParam String otp, @RequestParam long mobileNo) {
public String verifyOtp(HttpServletRequest request, @RequestParam String otp,@RequestParam long mobileNo) {
HttpSession session = request.getSession(); HttpSession session = request.getSession();
try { try {
Integer session_otp = (Integer) session.getAttribute("otp"); Integer session_otp = (Integer) session.getAttribute("otp");
@ -300,7 +290,7 @@ public class UserAPIController {
if (session_otp != null && session_otp.equals(entered_otp)) { if (session_otp != null && session_otp.equals(entered_otp)) {
System.out.println("Entered OTP Correct user API"); System.out.println("Entered OTP Correct user API");
Users user = userservice.findByMobileno(mobileNo); Users user = userservice.findByMobileno(mobileNo);
if (user != null) {
if(user!=null) {
userSession.setMobileno(user.getMobileNo()); userSession.setMobileno(user.getMobileNo());
//userSession.setUserType(user.getUserType()); //userSession.setUserType(user.getUserType());
userSession.setDispayName(user.getName()); userSession.setDispayName(user.getName());
@ -313,9 +303,9 @@ public class UserAPIController {
} else { } else {
System.out.println("Incorrect OTP. Please enter correct OTPs."); System.out.println("Incorrect OTP. Please enter correct OTPs.");
session.setAttribute("user", "");
session.setAttribute("user","");
session.setAttribute("mobileNo", ""); session.setAttribute("mobileNo", "");
session.setAttribute("id", "");
session.setAttribute("id","");
session.setAttribute("verifiedotp", "error"); session.setAttribute("verifiedotp", "error");
return "Error"; return "Error";
} }
@ -327,7 +317,6 @@ public class UserAPIController {
return "Error"; return "Error";
} }
} }
@GetMapping(value = "/verifyofficialOTP") @GetMapping(value = "/verifyofficialOTP")
public String verifyOtp(HttpServletRequest request, @RequestParam String otp) { public String verifyOtp(HttpServletRequest request, @RequestParam String otp) {
HttpSession session = request.getSession(); HttpSession session = request.getSession();
@ -404,6 +393,7 @@ public class UserAPIController {
} }
@GetMapping("/checkEmployee") @GetMapping("/checkEmployee")
public Map<String, Boolean> checkEmployee(@RequestParam String id) { public Map<String, Boolean> checkEmployee(@RequestParam String id) {
boolean isRegistered = usersRepository.existsByGovernmentId(id); boolean isRegistered = usersRepository.existsByGovernmentId(id);
@ -444,30 +434,15 @@ public class UserAPIController {
) )
//Getting the Past Data from the Calendar //Getting the Past Data from the Calendar
@GetMapping("/getPastData") @GetMapping("/getPastData")
public List<BookingCalendar> getPastData(@RequestParam("hall_id") int hall_id) {
public List<BookingCalendar> getPastData(@RequestParam("hall_id") int hall_id){
List<BookingCalendar> data = new ArrayList(); List<BookingCalendar> data = new ArrayList();
data = bookingService.getPastData(hall_id); data = bookingService.getPastData(hall_id);
if (data != null) {
if(data!=null) {
return data; return data;
} }
return data; return data;
} }
/*@MessageMapping("/getPastData")
@SendTo("/topic/bookingCalendar")
public List<BookingCalendar> getPastData(String payload) throws JsonProcessingException {
ObjectMapper objectMapper = new ObjectMapper();
JsonNode jsonNode = objectMapper.readTree(payload);
int hall_id = jsonNode.get("hall_id").asInt();
List<BookingCalendar> data = bookingService.getPastData(hall_id);
//System.out.println("Broadcasting data for hall_id " + hall_id + ": " + data);
//messagingTemplate.convertAndSend("/topic/bookingCalendar", data);
messagingTemplate.convertAndSend("/topic/bookingCalendar/" + hall_id, data);
return data;
}*/
@Operation( @Operation(
summary = "Pensioner Details ERP REST API", summary = "Pensioner Details ERP REST API",
description = "REST API to retrieving the Pensioner Details From ERP" description = "REST API to retrieving the Pensioner Details From ERP"
@ -477,7 +452,7 @@ public class UserAPIController {
public PensionerDetailsResponse getPensionerDetails(@RequestParam("pensionerId") String pensionerId) { public PensionerDetailsResponse getPensionerDetails(@RequestParam("pensionerId") String pensionerId) {
//System.out.println(pensionerId); //System.out.println(pensionerId);
RestTemplate restTemplate = new RestTemplate(); RestTemplate restTemplate = new RestTemplate();
String url = "https://erp.chennaicorporation.gov.in/pgr/external/mobileservice?serviceId=getPensionerDetailsList&pensionerId=" + pensionerId;
String url = "https://erp.chennaicorporation.gov.in/pgr/external/mobileservice?serviceId=getPensionerDetailsList&pensionerId="+pensionerId;
ResponseEntity<String> responseEntity = restTemplate.getForEntity(url, String.class); ResponseEntity<String> responseEntity = restTemplate.getForEntity(url, String.class);
@ -511,7 +486,7 @@ public class UserAPIController {
public EmployeeDetailsResponse getEmployeeDetails(@RequestParam("employeeId") Long employeeId) { public EmployeeDetailsResponse getEmployeeDetails(@RequestParam("employeeId") Long employeeId) {
//System.out.println("Employee ID:"+employeeId); //System.out.println("Employee ID:"+employeeId);
RestTemplate restTemplate = new RestTemplate(); RestTemplate restTemplate = new RestTemplate();
String url = "https://erp.chennaicorporation.gov.in/pgr/external/mobileservice?serviceId=getEmployeeDetail&EmployeeID=" + employeeId;
String url = "https://erp.chennaicorporation.gov.in/pgr/external/mobileservice?serviceId=getEmployeeDetail&EmployeeID="+employeeId;
ResponseEntity<String> responseEntity = restTemplate.getForEntity(url, String.class); ResponseEntity<String> responseEntity = restTemplate.getForEntity(url, String.class);
@ -545,7 +520,7 @@ public class UserAPIController {
@GetMapping("/FamilyPensionerDetail") @GetMapping("/FamilyPensionerDetail")
public FamilyPensionerDetailsResponse getFamilyPensionerDetails(@RequestParam("id") Long id) { public FamilyPensionerDetailsResponse getFamilyPensionerDetails(@RequestParam("id") Long id) {
RestTemplate restTemplate = new RestTemplate(); RestTemplate restTemplate = new RestTemplate();
String url = "https://erp.chennaicorporation.gov.in/pgr/external/mobileservice?serviceId=getFamPensionerDetailsList&familPensionId=" + id;
String url = "https://erp.chennaicorporation.gov.in/pgr/external/mobileservice?serviceId=getFamPensionerDetailsList&familPensionId="+id;
ResponseEntity<String> responseEntity = restTemplate.getForEntity(url, String.class); ResponseEntity<String> responseEntity = restTemplate.getForEntity(url, String.class);
@ -587,7 +562,7 @@ public class UserAPIController {
details.put("longitude", hallDetails.getLongitude()); details.put("longitude", hallDetails.getLongitude());
details.put("hallId", String.valueOf(hallDetails.getHallId())); details.put("hallId", String.valueOf(hallDetails.getHallId()));
details.put("hallName", hallDetails.getHallName()); details.put("hallName", hallDetails.getHallName());
details.put("seatingCapacity", String.valueOf(hallDetails.getSeatingCapacity()));
details.put("seatingCapacity",String.valueOf(hallDetails.getSeatingCapacity()) );
details.put("parkingCapacity", hallDetails.getParkingCapacity()); details.put("parkingCapacity", hallDetails.getParkingCapacity());
details.put("hallImage", hallDetails.getHallImagesList()); details.put("hallImage", hallDetails.getHallImagesList());
details.put("fullDayRent", hallDetails.getFullDayRent()); details.put("fullDayRent", hallDetails.getFullDayRent());
@ -610,16 +585,16 @@ public class UserAPIController {
public String CheckbookingLimitation(Model model) { public String CheckbookingLimitation(Model model) {
int userId = userSession.getUserId(); int userId = userSession.getUserId();
Users userById = userService.getUserById(userId); Users userById = userService.getUserById(userId);
if (userById != null && userById.getUserstatus() == Users.userStatus.PENDING) {
if(userById!=null && userById.getUserstatus()==Users.userStatus.PENDING) {
return "pending"; return "pending";
} }
if (userById != null && userById.getUserstatus() == Users.userStatus.REJECTED) { if (userById != null && userById.getUserstatus() == Users.userStatus.REJECTED) {
return "rejected"; return "rejected";
} }
int checkUserBookingLimitation = bookingService.checkUserBookinglimitation(userId); int checkUserBookingLimitation = bookingService.checkUserBookinglimitation(userId);
// System.out.println("checkUserBookingLimitation="+checkUserBookingLimitation);
// System.out.println("checkUserBookingLimitation="+checkUserBookingLimitation);
if (checkUserBookingLimitation < 2) { if (checkUserBookingLimitation < 2) {
//System.out.println("checkUserBookingLimitationss="+checkUserBookingLimitation);
// System.out.println("checkUserBookingLimitationss="+checkUserBookingLimitation);
return "success"; return "success";
} }
return "failure"; return "failure";
@ -696,7 +671,7 @@ public class UserAPIController {
@GetMapping(value = "/getZoneNo") @GetMapping(value = "/getZoneNo")
public String getZoneNo() { public String getZoneNo() {
String urlString = appConfig.getErpUrl() + "serviceId=getZones";
String urlString = appConfig.getErpUrl()+"serviceId=getZones";
ResponseEntity<String> response = null; ResponseEntity<String> response = null;
RestTemplate restTemplate = new RestTemplate(); RestTemplate restTemplate = new RestTemplate();
String bodyMessage = ""; String bodyMessage = "";
@ -721,7 +696,7 @@ public class UserAPIController {
// Rest Api From ERP for getting Divisions // Rest Api From ERP for getting Divisions
@GetMapping(value = "/getDiv") @GetMapping(value = "/getDiv")
public String getDiv(@RequestParam String zoneId) { public String getDiv(@RequestParam String zoneId) {
String urlString = appConfig.getErpUrl() + "serviceId=getWards&Zoneid=" + zoneId + "";
String urlString = appConfig.getErpUrl()+"serviceId=getWards&Zoneid="+zoneId+"";
ResponseEntity<String> response = null; ResponseEntity<String> response = null;
RestTemplate restTemplate = new RestTemplate(); RestTemplate restTemplate = new RestTemplate();
String bodyMessage = ""; String bodyMessage = "";
@ -942,8 +917,8 @@ public class UserAPIController {
@RequestParam(value = "area", required = false) String area, @RequestParam(value = "area", required = false) String area,
@RequestParam(value = "location", required = false) String location, @RequestParam(value = "location", required = false) String location,
@RequestParam(value = "usertype", required = false) String userType, @RequestParam(value = "usertype", required = false) String userType,
@RequestParam(value = "pinCode", required = false) int pinCode,
@RequestParam(value = "email", required = false) String email,
@RequestParam(value="pinCode", required = false) int pinCode,
@RequestParam(value="email", required = false) String email,
@RequestParam(value = "profilephoto", required = false) MultipartFile profilephoto) { @RequestParam(value = "profilephoto", required = false) MultipartFile profilephoto) {
Users userDetails = new Users(); Users userDetails = new Users();
@ -994,8 +969,8 @@ public class UserAPIController {
) )
//Retrive user details for counter //Retrive user details for counter
@GetMapping("/getuserforcounter") @GetMapping("/getuserforcounter")
public ResponseEntity<?> getCounterUserById(@RequestParam int userId) {
if (userId == 0) {
public ResponseEntity<?> getCounterUserById(@RequestParam int userId){
if(userId == 0) {
userId = userSession.getUserId(); userId = userSession.getUserId();
// System.out.println("User ID retrieved from session: " + userId); // System.out.println("User ID retrieved from session: " + userId);
} else { } else {
@ -1003,7 +978,7 @@ public class UserAPIController {
} }
Users user = userService.getUserById(userId); Users user = userService.getUserById(userId);
if (user == null) {
if(user == null) {
return ResponseEntity.status(HttpStatus.NOT_FOUND).body("User not found"); return ResponseEntity.status(HttpStatus.NOT_FOUND).body("User not found");
} }
return ResponseEntity.ok(user); return ResponseEntity.ok(user);
@ -1021,7 +996,7 @@ public class UserAPIController {
} }
Users user = userService.getUserById(userId); Users user = userService.getUserById(userId);
Map<String, Object> response = new HashMap<>(); Map<String, Object> response = new HashMap<>();
response.put("userId", user.getUserId());
response.put("userId",user.getUserId());
response.put("name", user.getName()); response.put("name", user.getName());
response.put("email", user.getEmail()); response.put("email", user.getEmail());
response.put("mobileNo", user.getMobileNo()); response.put("mobileNo", user.getMobileNo());
@ -1052,16 +1027,15 @@ public class UserAPIController {
description = "REST API to Save the Booking Details" description = "REST API to Save the Booking Details"
) )
//APi for Saving the Booking Details //APi for Saving the Booking Details
@PostMapping(path = "/saveTheRequest2", consumes = {"multipart/form-data"})
@PostMapping(path = "/saveTheRequest2", consumes = { "multipart/form-data" })
public ResponseEntity<?> saveTheBookingDetails2(HttpServletRequest request) { public ResponseEntity<?> saveTheBookingDetails2(HttpServletRequest request) {
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
Map<String, Object> bookingDetails = splitFormData(multipartRequest);
// System.out.println("Bc Id 1..............."+bookingDetails.get("bcId"));
Map<String,Object> bookingDetails = splitFormData(multipartRequest);
Map<String, Object> saveBookingDetails = bookingService.saveBookingDetails(bookingDetails); Map<String, Object> saveBookingDetails = bookingService.saveBookingDetails(bookingDetails);
return ResponseEntity.ok(saveBookingDetails); return ResponseEntity.ok(saveBookingDetails);
} }
public Map<String, Object> splitFormData(MultipartHttpServletRequest multipartRequest) {
public Map<String,Object> splitFormData(MultipartHttpServletRequest multipartRequest){
Map<String, Object> formData = new HashMap<>(); Map<String, Object> formData = new HashMap<>();
// Iterate through the request parameters // Iterate through the request parameters
@ -1093,7 +1067,7 @@ public class UserAPIController {
) )
//retrieving the Booking Details BY Booking ID //retrieving the Booking Details BY Booking ID
@GetMapping("/getBooking") @GetMapping("/getBooking")
public ResponseEntity<?> getBookingByID(@RequestParam int bookingId) {
public ResponseEntity<?> getBookingByID(@RequestParam int bookingId){
return ResponseEntity.ok(bookingService.getBookingsById(bookingId)); return ResponseEntity.ok(bookingService.getBookingsById(bookingId));
} }
@ -1103,24 +1077,24 @@ public class UserAPIController {
) )
//Booking Cancelling by BookingId //Booking Cancelling by BookingId
//Booking Cancelling by BookingId //Booking Cancelling by BookingId
@GetMapping("/cancelBookingbyId")
@GetMapping("/cancelBookingbyId")
public ResponseEntity<?> cancelBooking(@RequestParam int bookingId, public ResponseEntity<?> cancelBooking(@RequestParam int bookingId,
@RequestParam BookingDetails.BookingStatus status, @RequestParam BookingDetails.BookingStatus status,
@RequestParam String comments) { @RequestParam String comments) {
log.info("Received request to cancel booking with ID: {}"); log.info("Received request to cancel booking with ID: {}");
log.info("Status: {}, Comments: {}"); log.info("Status: {}, Comments: {}");
Optional<BookingDetails> bookings = bookingDetailsRepository.findById(bookingId);
BookingDetails bookingDetails = bookings.get();
Optional<BookingDetails> bookings=bookingDetailsRepository.findById(bookingId);
BookingDetails bookingDetails=bookings.get();
try { try {
BookingDetails cancelledBooking = bookingService.updateCancelledBookingStatus(bookingId, status, comments); BookingDetails cancelledBooking = bookingService.updateCancelledBookingStatus(bookingId, status, comments);
String cancelledbookingsms = "Your booking ID " + bookingId + " on " + bookingDetails.getStartDate() + " has been cancelled successfully. The deposit amount will be refunded to your account within 3 to 15 days. Thanks for using the GCC Community Hall Booking System.";
String cancelledurlString = "https://tmegov.onex-aura.com/api/sms?key=pfTEYN6H&to=" + bookingDetails.getUsers().getMobileNo() + "&from=GCCCRP&body=" + cancelledbookingsms + "&entityid=1401572690000011081&templateid=1407172346829376988";
String cancelledwhatsupmsg = "https://media.smsgupshup.com/GatewayAPI/rest?userid=2000233507&password=h2YjFNcJ&send_to=" + bookingDetails.getUsers().getMobileNo() + "&v=1.1&format=json&msg_type=TEXT&method=SENDMESSAGE&msg=Your+booking+with+ID+" + bookingId + "+on+" + bookingDetails.getStartDate() + "+has+been+cancelled+successfully.+%0AThe+deposit+amount+will+be+refunded+to+your+account+within+3+to+15+days.";
String cancelledbookingsms="Your booking ID "+bookingId+" on "+bookingDetails.getStartDate()+" has been cancelled successfully. The deposit amount will be refunded to your account within 3 to 15 days. Thanks for using the GCC Community Hall Booking System.";
String cancelledurlString ="https://tmegov.onex-aura.com/api/sms?key=pfTEYN6H&to="+bookingDetails.getUsers().getMobileNo()+"&from=GCCCRP&body="+cancelledbookingsms+"&entityid=1401572690000011081&templateid=1407172346829376988";
String cancelledwhatsupmsg = "https://media.smsgupshup.com/GatewayAPI/rest?userid=2000233507&password=h2YjFNcJ&send_to="+bookingDetails.getUsers().getMobileNo()+"&v=1.1&format=json&msg_type=TEXT&method=SENDMESSAGE&msg=Your+booking+with+ID+"+bookingId+"+on+"+bookingDetails.getStartDate()+"+has+been+cancelled+successfully.+%0AThe+deposit+amount+will+be+refunded+to+your+account+within+3+to+15+days.";
whatsappMsgServiceImpl.sendMsg(cancelledwhatsupmsg); whatsappMsgServiceImpl.sendMsg(cancelledwhatsupmsg);
whatsappMsgServiceImpl.sendSMS(cancelledurlString); whatsappMsgServiceImpl.sendSMS(cancelledurlString);
Optional<BookingDetails> book = bookingDetailsRepository.findById(bookingDetails.getBookingId());
BookingDetails booking = book.get();
Optional<BookingDetails> book=bookingDetailsRepository.findById(bookingDetails.getBookingId());
BookingDetails booking=book.get();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
String formattedDate = LocalDateTime.now().format(formatter); String formattedDate = LocalDateTime.now().format(formatter);
booking.setUpdatedDate(formattedDate); booking.setUpdatedDate(formattedDate);
@ -1132,7 +1106,7 @@ public class UserAPIController {
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
.body("Error cancelling booking: " + e.getMessage()); .body("Error cancelling booking: " + e.getMessage());
} }
}
}
@Operation( @Operation(
summary = "Family Pensioner Details from ERP REST API", summary = "Family Pensioner Details from ERP REST API",
@ -1213,9 +1187,9 @@ public class UserAPIController {
//Long mobileNo = 8220798933l; //Long mobileNo = 8220798933l;
//System.out.println("step 1"); //System.out.println("step 1");
responseMap.put("EmployeeDetailsResult", employeeDetails);
} else {
responseMap.put("EmployeeDetailsResult", null);
responseMap.put("EmployeeDetailsResult", employeeDetails );
}else {
responseMap.put("EmployeeDetailsResult", null );
} }
} }
} catch (IOException e) { } catch (IOException e) {
@ -1277,94 +1251,99 @@ public class UserAPIController {
description = "REST API to save the Counter Details" description = "REST API to save the Counter Details"
) )
//Saving the Counter Details //Saving the Counter Details
@PostMapping(path = "/counter-booking", consumes = {"multipart/form-data"})
@PostMapping(path = "/counter-booking", consumes = { "multipart/form-data" })
public ResponseEntity<?> saveCounterBookingDetails(HttpServletRequest request) { public ResponseEntity<?> saveCounterBookingDetails(HttpServletRequest request) {
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
Map<String, Object> bookingDetails = splitFormData(multipartRequest);
Map<String,Object> bookingDetails = splitFormData(multipartRequest);
Map<String, Object> saveCounterBooking = counterService.saveCounterBooking(bookingDetails); Map<String, Object> saveCounterBooking = counterService.saveCounterBooking(bookingDetails);
return ResponseEntity.ok(saveCounterBooking); return ResponseEntity.ok(saveCounterBooking);
} }
@GetMapping("/checkAvail") @GetMapping("/checkAvail")
public List<HallDetails> checkAvail(@RequestParam("fromDate") String fromDate, public List<HallDetails> checkAvail(@RequestParam("fromDate") String fromDate,
@RequestParam("toDate") String toDate, @RequestParam("toDate") String toDate,
@RequestParam("starting") String starting, @RequestParam("starting") String starting,
@RequestParam("ending") String ending, @RequestParam("ending") String ending,
@RequestParam(name = "hallId", required = false) String hallId) {
@RequestParam(name = "hallId",required = false) String hallId){
List<BookingCalendar> data = new ArrayList<>(); List<BookingCalendar> data = new ArrayList<>();
HashSet<Integer> removeHallId = new HashSet<Integer>(); HashSet<Integer> removeHallId = new HashSet<Integer>();
int hallIdd = 0;
if (hallId != null && !hallId.equals("")) {
int hallIdd=0;
if(hallId != null && !hallId.equals("")){
hallIdd = Integer.parseInt(hallId); hallIdd = Integer.parseInt(hallId);
} }
if (!fromDate.equals(toDate) && (starting.equals(ending) || starting.equals("evening") && ending.equals("morning"))) {
Map<String, String> mp = incrementAndDecrementAndDaysCount(fromDate, toDate);
long noOfDays = Long.parseLong(mp.get("NoOfDays").toString());
if (noOfDays > 2) {
data = calendarService.getCalendarByDateAndHallIdAndSlot(mp.get("fromDate"), mp.get("toDate"), starting, ending, hallIdd);
for (int i = 0; i < data.size(); i++) {
if(!fromDate.equals(toDate) && (starting.equals(ending) || starting.equals("evening") && ending.equals("morning"))){
Map<String,String> mp =incrementAndDecrementAndDaysCount(fromDate,toDate);
long noOfDays= Long.parseLong(mp.get("NoOfDays").toString());
if(noOfDays>2){
data = calendarService.getCalendarByDateAndHallIdAndSlot(mp.get("fromDate"),mp.get("toDate"),starting,ending,hallIdd);
for(int i=0;i<data.size();i++){
removeHallId.add(data.get(i).getHallId()); removeHallId.add(data.get(i).getHallId());
} }
} }
} }
data = calendarService.getCalendarByDateAndHallIdAndSlot(fromDate, toDate, starting, ending, hallIdd);
data=calendarService.getCalendarByDateAndHallIdAndSlot(fromDate,toDate,starting,ending,hallIdd);
//System.out.println("data size :-"+data.size()); //System.out.println("data size :-"+data.size());
if (starting != null && ending != null) {
boolean checkAvail = false;
int checkHallId = 0;
for (int i = 0; i < data.size(); i++) {
if(starting!=null && ending != null ) {
boolean checkAvail =false;
int checkHallId=0;
for(int i=0;i<data.size();i++) {
if ((starting.equals("evening") || ending.equals("morning")) && fromDate.equals(data.get(i).getBdate().toString()) && toDate.equals(fromDate)) {
if (data.get(i).isEveningSlot() == false) {
if((starting.equals("evening") || ending.equals("morning")) && fromDate.equals(data.get(i).getBdate().toString()) && toDate.equals(fromDate)) {
if(data.get(i).isEveningSlot()==false) {
continue; continue;
} else if (data.get(i).isMorningSlot() == false) {
}
else if(data.get(i).isMorningSlot()==false) {
continue; continue;
} }
} else if ((starting.equals(ending) || starting.equals("evening") && ending.equals("morning")) && !toDate.equals(fromDate)) { } else if ((starting.equals(ending) || starting.equals("evening") && ending.equals("morning")) && !toDate.equals(fromDate)) {
if (checkHallId == 0 || checkHallId != data.get(i).getHallId()) {
if(checkHallId==0 || checkHallId != data.get(i).getHallId()){
checkHallId = data.get(i).getHallId(); checkHallId = data.get(i).getHallId();
checkAvail = false;
checkAvail=false;
} }
if (starting.equals("morning") && ending.equals("morning")) {
if (fromDate.equals(data.get(i).getBdate().toString()) && data.get(i).isMorningSlot() == false) {
if (checkHallId == data.get(i).getHallId()) {
if(starting.equals("morning") && ending.equals("morning") ) {
if(fromDate.equals(data.get(i).getBdate().toString()) && data.get(i).isMorningSlot()==false){
if(checkHallId == data.get(i).getHallId()){
continue; continue;
} }
} else if (toDate.equals(data.get(i).getBdate().toString()) && data.get(i).isMorningSlot() == false) {
if (checkHallId == data.get(i).getHallId() && checkAvail == false) {
checkHallId = data.get(i).getHallId();
}
else if(toDate.equals(data.get(i).getBdate().toString()) && data.get(i).isMorningSlot()==false){
if(checkHallId == data.get(i).getHallId() && checkAvail==false){
checkHallId=data.get(i).getHallId();
continue; continue;
} }
} }
} else if (starting.equals("evening") && ending.equals("morning")) {
}else if(starting.equals("evening") && ending.equals("morning") ) {
if (fromDate.equals(data.get(i).getBdate().toString()) && data.get(i).isEveningSlot() == false) {
if (checkHallId == data.get(i).getHallId()) {
if(fromDate.equals(data.get(i).getBdate().toString()) && data.get(i).isEveningSlot()==false){
if(checkHallId == data.get(i).getHallId()){
continue; continue;
} }
} else if (toDate.equals(data.get(i).getBdate().toString()) && data.get(i).isMorningSlot() == false) {
if (checkHallId == data.get(i).getHallId() && checkAvail == false) {
checkHallId = data.get(i).getHallId();
}
else if(toDate.equals(data.get(i).getBdate().toString()) && data.get(i).isMorningSlot()==false){
if(checkHallId == data.get(i).getHallId() && checkAvail==false){
checkHallId=data.get(i).getHallId();
continue; continue;
} }
} }
} else if (starting.equals("evening") && ending.equals("evening")) {
if (fromDate.equals(data.get(i).getBdate().toString()) && data.get(i).isEveningSlot() == false) {
if (checkHallId == data.get(i).getHallId()) {
}else if(starting.equals("evening") && ending.equals("evening") ) {
if(fromDate.equals(data.get(i).getBdate().toString()) && data.get(i).isEveningSlot()==false){
if(checkHallId == data.get(i).getHallId()){
continue; continue;
} }
} else if (toDate.equals(data.get(i).getBdate().toString()) && data.get(i).isEveningSlot() == false) {
if (checkHallId == data.get(i).getHallId() && checkAvail == false) {
checkHallId = data.get(i).getHallId();
}
else if(toDate.equals(data.get(i).getBdate().toString()) && data.get(i).isEveningSlot()==false){
if(checkHallId == data.get(i).getHallId() && checkAvail==false){
checkHallId=data.get(i).getHallId();
continue; continue;
} }
} }
} else {
if (checkHallId == data.get(i).getHallId()) {
}
else{
if(checkHallId == data.get(i).getHallId()) {
checkAvail = true; checkAvail = true;
} }
} }
@ -1374,37 +1353,37 @@ public class UserAPIController {
} }
} }
List<HallDetails> removeHallByid = new ArrayList<>(); List<HallDetails> removeHallByid = new ArrayList<>();
if (hallIdd != 0) {
if (hallIdd != data.get(0).getHallId()) {
if(hallIdd!=0){
if(hallIdd!=data.get(0).getHallId()){
HallDetails hallDetails = hallDetailService.getHallById(hallIdd); HallDetails hallDetails = hallDetailService.getHallById(hallIdd);
removeHallByid.add(hallDetails); removeHallByid.add(hallDetails);
} }
} else {
}else {
removeHallByid = hallDetailService.removeHallById(removeHallId); removeHallByid = hallDetailService.removeHallById(removeHallId);
} }
return removeHallByid; return removeHallByid;
} }
Map<String, String> incrementAndDecrementAndDaysCount(String fromdate, String todate) {
Map<String,String> incrementAndDecrementAndDaysCount(String fromdate, String todate){
Map mp = new HashMap<>(); Map mp = new HashMap<>();
LocalDate increasement = LocalDate.parse(fromdate); LocalDate increasement = LocalDate.parse(fromdate);
LocalDate decrement = LocalDate.parse(todate); LocalDate decrement = LocalDate.parse(todate);
LocalDate outputDateFrom = increasement;
LocalDate outputDateFrom =increasement;
LocalDate outputDateToday = decrement; LocalDate outputDateToday = decrement;
long daysDifference = increasement.until(decrement).getDays(); long daysDifference = increasement.until(decrement).getDays();
daysDifference = Math.abs(daysDifference); daysDifference = Math.abs(daysDifference);
if (fromdate != todate) {
if(fromdate!=todate) {
outputDateFrom = increasement.plusDays(1); outputDateFrom = increasement.plusDays(1);
outputDateToday = decrement.minusDays(1); outputDateToday = decrement.minusDays(1);
} }
mp.put("fromDate", outputDateFrom.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); mp.put("fromDate", outputDateFrom.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
mp.put("toDate", outputDateToday.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
mp.put("NoOfDays", daysDifference + "");
mp.put("toDate",outputDateToday.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
mp.put("NoOfDays",daysDifference+"");
return mp; return mp;
} }
@ -1496,7 +1475,7 @@ public class UserAPIController {
Map<String, Object> settlementRaisingDetail = new HashMap<>(); Map<String, Object> settlementRaisingDetail = new HashMap<>();
settlementRaisingDetail.put("status", "SETTLEMENT_RAISING"); settlementRaisingDetail.put("status", "SETTLEMENT_RAISING");
settlementRaisingDetail.put("description", "Settlement Raising"); settlementRaisingDetail.put("description", "Settlement Raising");
settlementRaisingDetail.put("dateTime", bookingDetails.getSettlement().getUpdatedDate());
settlementRaisingDetail.put("dateTime", bookingDetails.getSettlement().getUpdatedDate() );
trackingDetails.add(settlementRaisingDetail); trackingDetails.add(settlementRaisingDetail);
} }
@ -1511,9 +1490,9 @@ public class UserAPIController {
} }
if (bookingDetails.getBookingStatus() == BookingStatus.CANCELED) {
Map<String, Object> bookingCanceledDetail = new HashMap<>();
bookingCanceledDetail.put("status", "CANCELED");
if (bookingDetails.getBookingStatus() == BookingStatus.CANCELED){
Map<String ,Object> bookingCanceledDetail = new HashMap<>();
bookingCanceledDetail.put("status","CANCELED");
bookingCanceledDetail.put("description", "Booking Cancelled"); bookingCanceledDetail.put("description", "Booking Cancelled");
bookingCanceledDetail.put("dateTime", bookingDetails.getUpdatedDate()); // Assuming BookingDate is correct bookingCanceledDetail.put("dateTime", bookingDetails.getUpdatedDate()); // Assuming BookingDate is correct
trackingDetails.add(bookingCanceledDetail); trackingDetails.add(bookingCanceledDetail);
@ -1521,16 +1500,16 @@ public class UserAPIController {
if (bookingDetails.getBookingStatus() == BookingStatus.CANCELED if (bookingDetails.getBookingStatus() == BookingStatus.CANCELED
&& bookingDetails.getRefundStatus() == RefundStatus.WAITING) {
Map<String, Object> canceledRaisingDetail = new HashMap<>();
canceledRaisingDetail.put("status", "SETTLEMENT_RAISING");
&& bookingDetails.getRefundStatus() == RefundStatus.WAITING){
Map<String ,Object> canceledRaisingDetail = new HashMap<>();
canceledRaisingDetail.put("status","SETTLEMENT_RAISING");
canceledRaisingDetail.put("description", "Settlement Raising"); canceledRaisingDetail.put("description", "Settlement Raising");
canceledRaisingDetail.put("dateTime", bookingDetails.getUpdatedDate()); // Assuming BookingDate is correct canceledRaisingDetail.put("dateTime", bookingDetails.getUpdatedDate()); // Assuming BookingDate is correct
trackingDetails.add(canceledRaisingDetail); trackingDetails.add(canceledRaisingDetail);
} }
if (bookingDetails.getBookingStatus() == BookingStatus.CANCELED if (bookingDetails.getBookingStatus() == BookingStatus.CANCELED
&& bookingDetails.getRefundStatus() == BookingDetails.RefundStatus.COMPLETED) {
&& bookingDetails.getRefundStatus() == BookingDetails.RefundStatus.COMPLETED){
Map<String, Object> cancelRefundCompletedDetail = new HashMap<>(); Map<String, Object> cancelRefundCompletedDetail = new HashMap<>();
cancelRefundCompletedDetail.put("status", "COMPLETED"); cancelRefundCompletedDetail.put("status", "COMPLETED");
cancelRefundCompletedDetail.put("description", "Refund Completed"); cancelRefundCompletedDetail.put("description", "Refund Completed");
@ -1538,9 +1517,9 @@ public class UserAPIController {
trackingDetails.add(cancelRefundCompletedDetail); trackingDetails.add(cancelRefundCompletedDetail);
} }
if (bookingDetails.getBookingStatus() == BookingStatus.REJECTED) {
Map<String, Object> bookingRejectedDetail = new HashMap<>();
bookingRejectedDetail.put("status", "REJECTED");
if (bookingDetails.getBookingStatus() == BookingStatus.REJECTED){
Map<String ,Object> bookingRejectedDetail = new HashMap<>();
bookingRejectedDetail.put("status","REJECTED");
bookingRejectedDetail.put("description", "Booking Rejected"); bookingRejectedDetail.put("description", "Booking Rejected");
bookingRejectedDetail.put("dateTime", bookingDetails.getUpdatedDate()); // Assuming BookingDate is correct bookingRejectedDetail.put("dateTime", bookingDetails.getUpdatedDate()); // Assuming BookingDate is correct
trackingDetails.add(bookingRejectedDetail); trackingDetails.add(bookingRejectedDetail);
@ -1548,16 +1527,16 @@ public class UserAPIController {
if (bookingDetails.getBookingStatus() == BookingStatus.REJECTED if (bookingDetails.getBookingStatus() == BookingStatus.REJECTED
&& bookingDetails.getRefundStatus() == RefundStatus.WAITING) {
Map<String, Object> rejectedRaisingDetail = new HashMap<>();
rejectedRaisingDetail.put("status", "SETTLEMENT_RAISING");
&& bookingDetails.getRefundStatus() == RefundStatus.WAITING){
Map<String ,Object> rejectedRaisingDetail = new HashMap<>();
rejectedRaisingDetail.put("status","SETTLEMENT_RAISING");
rejectedRaisingDetail.put("description", "Settlement Raising"); rejectedRaisingDetail.put("description", "Settlement Raising");
rejectedRaisingDetail.put("dateTime", bookingDetails.getUpdatedDate()); // Assuming BookingDate is correct rejectedRaisingDetail.put("dateTime", bookingDetails.getUpdatedDate()); // Assuming BookingDate is correct
trackingDetails.add(rejectedRaisingDetail); trackingDetails.add(rejectedRaisingDetail);
} }
if (bookingDetails.getBookingStatus() == BookingStatus.REJECTED if (bookingDetails.getBookingStatus() == BookingStatus.REJECTED
&& bookingDetails.getRefundStatus() == BookingDetails.RefundStatus.COMPLETED) {
&& bookingDetails.getRefundStatus() == BookingDetails.RefundStatus.COMPLETED){
Map<String, Object> rejectedRefundCompletedDetail = new HashMap<>(); Map<String, Object> rejectedRefundCompletedDetail = new HashMap<>();
rejectedRefundCompletedDetail.put("status", "COMPLETED"); rejectedRefundCompletedDetail.put("status", "COMPLETED");
rejectedRefundCompletedDetail.put("description", "Refund Completed"); rejectedRefundCompletedDetail.put("description", "Refund Completed");
@ -1566,9 +1545,10 @@ public class UserAPIController {
} }
if (bookingDetails.getBookingStatus() == BookingStatus.GCC_BLOCKED) {
Map<String, Object> gccBlockedDetail = new HashMap<>();
gccBlockedDetail.put("status", "GCC_BLOCKED");
if (bookingDetails.getBookingStatus() == BookingStatus.GCC_BLOCKED){
Map<String ,Object> gccBlockedDetail = new HashMap<>();
gccBlockedDetail.put("status","GCC_BLOCKED");
gccBlockedDetail.put("description", "GCC Blocked"); gccBlockedDetail.put("description", "GCC Blocked");
gccBlockedDetail.put("dateTime", bookingDetails.getUpdatedDate()); gccBlockedDetail.put("dateTime", bookingDetails.getUpdatedDate());
trackingDetails.add(gccBlockedDetail); trackingDetails.add(gccBlockedDetail);
@ -1579,8 +1559,8 @@ public class UserAPIController {
@GetMapping("/confirmstatebooking") @GetMapping("/confirmstatebooking")
public String Confirmstatebookig(@RequestParam int bookingId) {
String response = bookingService.confirmStateBooking(bookingId);
public String Confirmstatebookig(@RequestParam int bookingId ) {
String response=bookingService.confirmStateBooking(bookingId);
return response; return response;
} }
@ -1594,9 +1574,7 @@ public class UserAPIController {
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("File upload failed: " + e.getMessage()); return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("File upload failed: " + e.getMessage());
} }
} }
@GetMapping("/calculatehallamount")
/*@GetMapping("/calculatehallamount")
public ResponseEntity<Map<String, Object>> getHallDetailsConcession( public ResponseEntity<Map<String, Object>> getHallDetailsConcession(
@RequestParam int numDays, @RequestParam int numDays,
@RequestParam(value = "startPeriod", required = false) String startPeriod, @RequestParam(value = "startPeriod", required = false) String startPeriod,
@ -1633,22 +1611,22 @@ public class UserAPIController {
response.put("amount", amount); response.put("amount", amount);
response.put("totalAmount", totalAmount); response.put("totalAmount", totalAmount);
response.put("depositAmount", totalDepositAmount); response.put("depositAmount", totalDepositAmount);
double gstValue = gstRate * amount / 100.0;
double gstValue =gstRate * amount / 100.0;
response.put("gst", gstValue); response.put("gst", gstValue);
response.put("discountAmount", amount); response.put("discountAmount", amount);
} else { } else {
if ("SGE".equals(reasonforBooking)) { if ("SGE".equals(reasonforBooking)) {
double cleaningCharges = hallDetails.getHallDetailsConcession().get(0).getFullDayCleaningcharges(); double cleaningCharges = hallDetails.getHallDetailsConcession().get(0).getFullDayCleaningcharges();
double pasystem = hallDetails.getHallDetailsConcession().get(0).getFulldayPAsystem();
double ebCharges = hallDetails.getHallDetailsConcession().get(0).getFulldayEBcharges();
double pasystem=hallDetails.getHallDetailsConcession().get(0).getFulldayPAsystem();
double ebCharges=hallDetails.getHallDetailsConcession().get(0).getFulldayEBcharges();
double halfcleaningCharges = hallDetails.getHallDetailsConcession().get(0).getHalfDayCleaningcharges(); double halfcleaningCharges = hallDetails.getHallDetailsConcession().get(0).getHalfDayCleaningcharges();
double halfpasystem = hallDetails.getHallDetailsConcession().get(0).getHalfdayPAsystem();
double halfebCharges = hallDetails.getHallDetailsConcession().get(0).getHalfdayEBcharges();
double fulladditionalCharges = cleaningCharges + pasystem + ebCharges;
double halfadditionalCharges = halfcleaningCharges + halfpasystem + halfebCharges;
double fulldayhallAmount = hallDetails.getHallDetailsConcession().get(0).getFulldayhallamount();
double halfdayhallAmount = hallDetails.getHallDetailsConcession().get(0).getHalfdayhallamount();
double additionalCharges = calculateAmount(numDays, startPeriod, endPeriod, fulladditionalCharges, halfadditionalCharges);
double halfpasystem=hallDetails.getHallDetailsConcession().get(0).getHalfdayPAsystem();
double halfebCharges=hallDetails.getHallDetailsConcession().get(0).getHalfdayEBcharges();
double fulladditionalCharges = cleaningCharges+pasystem+ebCharges;
double halfadditionalCharges = halfcleaningCharges+halfpasystem+halfebCharges;
double fulldayhallAmount=hallDetails.getHallDetailsConcession().get(0).getFulldayhallamount();
double halfdayhallAmount=hallDetails.getHallDetailsConcession().get(0).getHalfdayhallamount();
double additionalCharges=calculateAmount(numDays, startPeriod, endPeriod, fulladditionalCharges, halfadditionalCharges);
totalAmount = additionalCharges + totalDepositAmount + (additionalCharges * gstRate / 100.0); totalAmount = additionalCharges + totalDepositAmount + (additionalCharges * gstRate / 100.0);
discountAmount = (fulldayhallAmount * hallDetails.getSGEdiscount()) / 100.0; discountAmount = (fulldayhallAmount * hallDetails.getSGEdiscount()) / 100.0;
response.put("startperiod", startPeriod); response.put("startperiod", startPeriod);
@ -1664,7 +1642,7 @@ public class UserAPIController {
response.put("totalAmount", totalAmount); response.put("totalAmount", totalAmount);
response.put("discountAmount", discountAmount); response.put("discountAmount", discountAmount);
} else if ("CGE".equals(reasonforBooking)) { } else if ("CGE".equals(reasonforBooking)) {
/*response.put("discount", hallDetails.getCGEdiscount());
response.put("discount", hallDetails.getCGEdiscount());
discountAmount = (amount * hallDetails.getCGEdiscount()) / 100.0; discountAmount = (amount * hallDetails.getCGEdiscount()) / 100.0;
totalAmount = discountAmount + totalDepositAmount + (discountAmount * gstRate / 100); totalAmount = discountAmount + totalDepositAmount + (discountAmount * gstRate / 100);
response.put("amount", amount); response.put("amount", amount);
@ -1672,21 +1650,134 @@ public class UserAPIController {
response.put("depositAmount", totalDepositAmount); response.put("depositAmount", totalDepositAmount);
double gstValue = gstRate * discountAmount / 100; double gstValue = gstRate * discountAmount / 100;
response.put("gst", gstValue); response.put("gst", gstValue);
response.put("discountAmount", discountAmount);*/
response.put("discountAmount", discountAmount);
} else {
totalAmount = amount + (amount * gstRate / 100) + totalDepositAmount;
response.put("discount", 0);
response.put("amount", amount);
response.put("totalAmount", totalAmount);
response.put("depositAmount", totalDepositAmount);
double gstValue =gstRate * amount / 100.0;
response.put("gst", gstValue);
response.put("discountAmount", amount);
}
}
return ResponseEntity.ok(response);
}
public double calculateAmount(double numDays, String startPeriod, String endPeriod, double fullDayAmount, double halfDayAmount) {
double amount = 0;
// If there is only one day
if (numDays == 1) {
if ("1".equals(startPeriod) && "2".equals(endPeriod)) {
amount = fullDayAmount;
} else if ("1".equals(startPeriod) && "1".equals(endPeriod)) {
amount = halfDayAmount;
} else if ("2".equals(startPeriod) && "2".equals(endPeriod)) {
amount = halfDayAmount;
}else {
amount=numDays;
}
} else {
// For multiple days
if ("1".equals(startPeriod) && "2".equals(endPeriod)) {
amount = fullDayAmount * numDays;
} else if ("1".equals(startPeriod) && "1".equals(endPeriod)) {
amount = fullDayAmount * (numDays - 1) + halfDayAmount;
} else if ("2".equals(startPeriod) && "2".equals(endPeriod)) {
amount = fullDayAmount * (numDays - 1) + halfDayAmount;
} else if ("2".equals(startPeriod) && "1".equals(endPeriod)) {
amount = fullDayAmount * (numDays - 2) + halfDayAmount * 2;
}else {
amount=numDays;
}
}
return amount;
}*/
@GetMapping("/calculatehallamount")
public ResponseEntity<Map<String, Object>> getHallDetailsConcession(
@RequestParam int numDays,
@RequestParam(value = "startPeriod", required = false) String startPeriod,
@RequestParam(value = "endPeriod", required = false) String endPeriod,
@RequestParam(value = "reasonforBooking", required = false) String reasonforBooking,
@RequestParam int hallId) {
Optional<HallDetails> hallDetailsOpt = hallDetailsRepository.findById(hallId);
if (!hallDetailsOpt.isPresent()) {
return ResponseEntity.status(404).body(null); // Handle not found
}
HallDetails hallDetails = hallDetailsOpt.get();
boolean isSGE = hallDetails.isSGE();
boolean isCGE = hallDetails.isCGE();
double fullDayAmount = hallDetails.getFullDayRent();
double halfDayAmount = hallDetails.getHalfDayRent();
double depositAmount = hallDetails.getDepositAmount();
double gstRate = hallDetails.getGst();
Map<String, Object> response = new HashMap<>();
double amount = calculateAmount(numDays, startPeriod, endPeriod, fullDayAmount, halfDayAmount);
double totalDepositAmount = calculateDepositAmount(numDays, startPeriod, endPeriod, depositAmount);
double totalAmount;
double discountAmount = 0.0;
response.put("reasonforBooking", reasonforBooking);
if (!isSGE) {
totalAmount = amount + (amount * gstRate / 100) + totalDepositAmount;
response.put("discount", 0);
response.put("amount", amount);
response.put("totalAmount", totalAmount);
response.put("depositAmount", totalDepositAmount);
double gstValue =gstRate * amount / 100.0;
response.put("gst", gstValue);
response.put("discountAmount", amount);
} else {
if ("SGE".equals(reasonforBooking)) {
double cleaningCharges = hallDetails.getHallDetailsConcession().get(0).getFullDayCleaningcharges(); double cleaningCharges = hallDetails.getHallDetailsConcession().get(0).getFullDayCleaningcharges();
double pasystem = hallDetails.getHallDetailsConcession().get(0).getFulldayPAsystem();
double ebCharges = hallDetails.getHallDetailsConcession().get(0).getFulldayEBcharges();
double pasystem=hallDetails.getHallDetailsConcession().get(0).getFulldayPAsystem();
double ebCharges=hallDetails.getHallDetailsConcession().get(0).getFulldayEBcharges();
double halfcleaningCharges = hallDetails.getHallDetailsConcession().get(0).getHalfDayCleaningcharges(); double halfcleaningCharges = hallDetails.getHallDetailsConcession().get(0).getHalfDayCleaningcharges();
double halfpasystem = hallDetails.getHallDetailsConcession().get(0).getHalfdayPAsystem();
double halfebCharges = hallDetails.getHallDetailsConcession().get(0).getHalfdayEBcharges();
double fulladditionalCharges = cleaningCharges + pasystem + ebCharges;
double halfadditionalCharges = halfcleaningCharges + halfpasystem + halfebCharges;
double additionalCharges = calculateAmount(numDays, startPeriod, endPeriod, fulladditionalCharges, halfadditionalCharges);
double halfpasystem=hallDetails.getHallDetailsConcession().get(0).getHalfdayPAsystem();
double halfebCharges=hallDetails.getHallDetailsConcession().get(0).getHalfdayEBcharges();
double fulladditionalCharges = cleaningCharges+pasystem+ebCharges;
double halfadditionalCharges = halfcleaningCharges+halfpasystem+halfebCharges;
double fulldayhallAmount=hallDetails.getHallDetailsConcession().get(0).getFulldayhallamount();
double halfdayhallAmount=hallDetails.getHallDetailsConcession().get(0).getHalfdayhallamount();
double additionalCharges=calculateAmount(numDays, startPeriod, endPeriod, fulladditionalCharges, halfadditionalCharges);
totalAmount = additionalCharges + totalDepositAmount + (additionalCharges * gstRate / 100.0);
discountAmount = (fulldayhallAmount * hallDetails.getSGEdiscount()) / 100.0;
response.put("startperiod", startPeriod);
response.put("endPeriod", endPeriod);
response.put("fulldayhallAmount", fulldayhallAmount);
response.put("halfdayhallAmount", halfdayhallAmount);
response.put("discount", hallDetails.getSGEdiscount());
response.put("rentAmount", 0);
response.put("additionalCharges", additionalCharges);
response.put("netAmount", additionalCharges);
response.put("gst", gstRate * additionalCharges / 100);
response.put("depositAmount", totalDepositAmount);
response.put("totalAmount", totalAmount);
response.put("discountAmount", discountAmount);
} else if ("CGE".equals(reasonforBooking)) {
double cleaningCharges = hallDetails.getHallDetailsConcession().get(0).getFullDayCleaningcharges();
double pasystem=hallDetails.getHallDetailsConcession().get(0).getFulldayPAsystem();
double ebCharges=hallDetails.getHallDetailsConcession().get(0).getFulldayEBcharges();
double halfcleaningCharges = hallDetails.getHallDetailsConcession().get(0).getHalfDayCleaningcharges();
double halfpasystem=hallDetails.getHallDetailsConcession().get(0).getHalfdayPAsystem();
double halfebCharges=hallDetails.getHallDetailsConcession().get(0).getHalfdayEBcharges();
double fulladditionalCharges = cleaningCharges+pasystem+ebCharges;
double halfadditionalCharges = halfcleaningCharges+halfpasystem+halfebCharges;
double additionalCharges=calculateAmount(numDays, startPeriod, endPeriod, fulladditionalCharges, halfadditionalCharges);
double rentAmount = (amount * hallDetails.getCGEdiscount()) / 100.0; double rentAmount = (amount * hallDetails.getCGEdiscount()) / 100.0;
double netAmount = rentAmount + additionalCharges; double netAmount = rentAmount + additionalCharges;
double gst = ((additionalCharges + rentAmount) * gstRate / 100.0);
totalAmount = Math.floor((netAmount + gst + totalDepositAmount) * 100) / 100.0;
double gst = ((additionalCharges+rentAmount) * gstRate / 100.0);
totalAmount = Math.floor((netAmount + gst + totalDepositAmount) * 100) / 100.0 ;
response.put("startperiod", startPeriod); response.put("startperiod", startPeriod);
response.put("endPeriod", endPeriod); response.put("endPeriod", endPeriod);
response.put("fulldayhallAmount", fullDayAmount); response.put("fulldayhallAmount", fullDayAmount);
@ -1700,12 +1791,12 @@ public class UserAPIController {
response.put("totalAmount", totalAmount); response.put("totalAmount", totalAmount);
response.put("discountAmount", discountAmount); response.put("discountAmount", discountAmount);
} else { } else {
totalAmount = amount + (amount * gstRate / 100) + totalDepositAmount;
double gstValue =(gstRate * amount) / 100.0;
totalAmount = Math.ceil((amount + gstValue + totalDepositAmount) * 100) / 100;
response.put("discount", 0); response.put("discount", 0);
response.put("amount", amount); response.put("amount", amount);
response.put("totalAmount", totalAmount); response.put("totalAmount", totalAmount);
response.put("depositAmount", totalDepositAmount); response.put("depositAmount", totalDepositAmount);
double gstValue = gstRate * amount / 100.0;
response.put("gst", gstValue); response.put("gst", gstValue);
response.put("discountAmount", amount); response.put("discountAmount", amount);
} }
@ -1713,7 +1804,6 @@ public class UserAPIController {
return ResponseEntity.ok(response); return ResponseEntity.ok(response);
} }
public double calculateAmount(double numDays, String startPeriod, String endPeriod, double fullDayAmount, double halfDayAmount) { public double calculateAmount(double numDays, String startPeriod, String endPeriod, double fullDayAmount, double halfDayAmount) {
double amount = 0; double amount = 0;
@ -1725,8 +1815,8 @@ public class UserAPIController {
amount = halfDayAmount; amount = halfDayAmount;
} else if ("2".equals(startPeriod) && "2".equals(endPeriod)) { } else if ("2".equals(startPeriod) && "2".equals(endPeriod)) {
amount = halfDayAmount; amount = halfDayAmount;
} else {
amount = numDays;
}else {
amount=numDays;
} }
} else { } else {
// For multiple days // For multiple days
@ -1738,8 +1828,8 @@ public class UserAPIController {
amount = fullDayAmount * (numDays - 1) + halfDayAmount; amount = fullDayAmount * (numDays - 1) + halfDayAmount;
} else if ("2".equals(startPeriod) && "1".equals(endPeriod)) { } else if ("2".equals(startPeriod) && "1".equals(endPeriod)) {
amount = fullDayAmount * (numDays - 2) + halfDayAmount * 2; amount = fullDayAmount * (numDays - 2) + halfDayAmount * 2;
} else {
amount = numDays;
}else {
amount=numDays;
} }
} }
@ -1766,11 +1856,58 @@ public class UserAPIController {
@GetMapping("/collectionpendingacknowledgementsss") @GetMapping("/collectionpendingacknowledgementsss")
public BookingDetails viewCollectionpendingAck(Model model, int bookingId) {
public BookingDetails viewCollectionpendingAck(Model model,int bookingId){
BookingDetails bookingsDetails = bookingService.getBookingsById(bookingId); BookingDetails bookingsDetails = bookingService.getBookingsById(bookingId);
model.addAttribute("bookingsDetails", bookingsDetails); // Add single BookingDetails object
model.addAttribute("userName", userSession.getDispayName());
model.addAttribute("bookingsDetails",bookingsDetails); // Add single BookingDetails object
model.addAttribute("userName",userSession.getDispayName());
return bookingsDetails; return bookingsDetails;
} }
@GetMapping("/checkQueue")
public ResponseEntity<List<BookingDetails>> checkQueue(
@RequestParam String bookingDate,
@RequestParam Long hallId) {
try {
List<BookingDetails> bookings = bookingService.getBookingsByDateAndHall(bookingDate, hallId);
return ResponseEntity.ok(bookings);
} catch (Exception e) {
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).build();
}
}
public double calculateDepositAmount(double numDays, String startPeriod, String endPeriod, double depositAmount) {
double damount = 0;
// If there is only one day
if (numDays == 1) {
if ("1".equals(startPeriod) && "2".equals(endPeriod)) {
damount = depositAmount;
} else if ("1".equals(startPeriod) && "1".equals(endPeriod)) {
damount = depositAmount;
} else if ("2".equals(startPeriod) && "2".equals(endPeriod)) {
damount = depositAmount;
} else {
damount = numDays;
}
} else {
// For multiple days
if ("1".equals(startPeriod) && "2".equals(endPeriod)) {
damount = depositAmount * numDays;
} else if ("1".equals(startPeriod) && "1".equals(endPeriod)) {
damount = depositAmount * (numDays - 1) + depositAmount;
} else if ("2".equals(startPeriod) && "2".equals(endPeriod)) {
damount = depositAmount * (numDays - 1) + depositAmount;
} else if ("2".equals(startPeriod) && "1".equals(endPeriod)) {
damount = depositAmount * (numDays - 2) + depositAmount;
} else {
damount = numDays;
}
}
return damount;
}
} }

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

@ -6,7 +6,6 @@ import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import jakarta.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.Model; import org.springframework.ui.Model;
@ -32,10 +31,11 @@ import com.gcc.communityHall.service.UserService;
import com.gcc.communityHall.service.Impl.WhatsappMsgServiceImpl; import com.gcc.communityHall.service.Impl.WhatsappMsgServiceImpl;
@Controller @Controller
@RequestMapping(value={"/communityhall/user","/communityhall","","/"})
@RequestMapping(value = {"/communityhall/user", "/communityhall", "", "/"})
public class UserController { public class UserController {
@Autowired UserSession userSession;
@Autowired
UserSession userSession;
@Autowired @Autowired
private BookingService bookingService; private BookingService bookingService;
@ -60,10 +60,10 @@ public class UserController {
@Autowired @Autowired
private NotificationRepository notificationRepository; private NotificationRepository notificationRepository;
@GetMapping(value = {"","/","/dashboard","/index"})
@GetMapping(value = {"", "/", "/dashboard", "/index"})
public String viewDashboard(Model model) { public String viewDashboard(Model model) {
List<HallDetails> halls=hallDetailsRepository.findActiveHalls();
List<HallDetails> hallnames=hallDetailsService.getHallNames();
List<HallDetails> halls = hallDetailsRepository.findActiveHalls();
List<HallDetails> hallnames = hallDetailsService.getHallNames();
for (HallDetails hall : halls) { for (HallDetails hall : halls) {
if (hall.getHallImagesList() != null && !hall.getHallImagesList().isEmpty()) { if (hall.getHallImagesList() != null && !hall.getHallImagesList().isEmpty()) {
model.addAttribute("hasImages", true); model.addAttribute("hasImages", true);
@ -81,9 +81,9 @@ public class UserController {
// Pass the concatenated string to the model // Pass the concatenated string to the model
model.addAttribute("newnotification", notificationText.toString()); model.addAttribute("newnotification", notificationText.toString());
model.addAttribute("userName",userSession.getDispayName());
model.addAttribute("halls",halls);
model.addAttribute("hallnames",hallnames);
model.addAttribute("userName", userSession.getDispayName());
model.addAttribute("halls", halls);
model.addAttribute("hallnames", hallnames);
return "user/dashboard"; return "user/dashboard";
} }
@ -208,25 +208,25 @@ public class UserController {
@PostMapping("/newregistrationform") @PostMapping("/newregistrationform")
public String showRegistrationForm(@ModelAttribute("newform") Users newform,Model model) {
public String showRegistrationForm(@ModelAttribute("newform") Users newform, Model model) {
Users user = userService.user(newform); Users user = userService.user(newform);
userSession.setMobileno(user.getMobileNo()); userSession.setMobileno(user.getMobileNo());
userSession.setDispayName(user.getName()); userSession.setDispayName(user.getName());
userSession.setUserId(user.getUserId()); userSession.setUserId(user.getUserId());
userSession.setUserType(user.getUsertype().toString()); userSession.setUserType(user.getUsertype().toString());
System.out.println("usetrtype=="+user.getUsertype().toString());
System.out.println("usetrtype==" + user.getUsertype().toString());
//System.out.println("employee id"+user.getGovernmentId()); //System.out.println("employee id"+user.getGovernmentId());
//System.out.println("employee id"+user.getDepartment()); //System.out.println("employee id"+user.getDepartment());
if (user.getUsertype() == userType.PUBLIC) { if (user.getUsertype() == userType.PUBLIC) {
String registersms="Welcome to GCC, Your User Registration for booking Community Centre is successful.";
String registerurlString ="https://tmegov.onex-aura.com/api/sms?key=pfTEYN6H&to="+user.getMobileNo()+"&from=GCCCRP&body="+registersms+"&entityid=1401572690000011081&templateid=1407172346621223019";
String registerwhatsupmsg="https://media.smsgupshup.com/GatewayAPI/rest?userid=2000233507&password=h2YjFNcJ&send_to="+user.getMobileNo()+"&v=1.1&format=json&msg_type=TEXT&method=SENDMESSAGE&msg=Welcome+to+GCC%2C+%0A%0AYour+User+Registration+for+booking+Community+Centre+is+successful.";
String registersms = "Welcome to GCC, Your User Registration for booking Community Centre is successful.";
String registerurlString = "https://tmegov.onex-aura.com/api/sms?key=pfTEYN6H&to=" + user.getMobileNo() + "&from=GCCCRP&body=" + registersms + "&entityid=1401572690000011081&templateid=1407172346621223019";
String registerwhatsupmsg = "https://media.smsgupshup.com/GatewayAPI/rest?userid=2000233507&password=h2YjFNcJ&send_to=" + user.getMobileNo() + "&v=1.1&format=json&msg_type=TEXT&method=SENDMESSAGE&msg=Welcome+to+GCC%2C+%0A%0AYour+User+Registration+for+booking+Community+Centre+is+successful.";
whatsappMsgServiceImpl.sendMsg(registerwhatsupmsg); whatsappMsgServiceImpl.sendMsg(registerwhatsupmsg);
whatsappMsgServiceImpl.sendSMS(registerurlString); whatsappMsgServiceImpl.sendSMS(registerurlString);
}else {
String registerpendingsms="Welcome to GCC, Your User Registration request for booking Community Centre is submitted successfully.";
String registerpendingurlString ="https://tmegov.onex-aura.com/api/sms?key=pfTEYN6H&to="+user.getMobileNo()+"&from=GCCCRP&body="+registerpendingsms+"&entityid=1401572690000011081&templateid=1407172346629919381";
String registerpendingwhatsupmsg="https://media.smsgupshup.com/GatewayAPI/rest?userid=2000233507&password=h2YjFNcJ&send_to="+user.getMobileNo()+"&v=1.1&format=json&msg_type=TEXT&method=SENDMESSAGE&msg=Welcome+to+GCC%2C+%0A%0AYour+User+Registration+request+for+booking+Community+Centre+submitted+successfully.";
} else {
String registerpendingsms = "Welcome to GCC, Your User Registration request for booking Community Centre is submitted successfully.";
String registerpendingurlString = "https://tmegov.onex-aura.com/api/sms?key=pfTEYN6H&to=" + user.getMobileNo() + "&from=GCCCRP&body=" + registerpendingsms + "&entityid=1401572690000011081&templateid=1407172346629919381";
String registerpendingwhatsupmsg = "https://media.smsgupshup.com/GatewayAPI/rest?userid=2000233507&password=h2YjFNcJ&send_to=" + user.getMobileNo() + "&v=1.1&format=json&msg_type=TEXT&method=SENDMESSAGE&msg=Welcome+to+GCC%2C+%0A%0AYour+User+Registration+request+for+booking+Community+Centre+submitted+successfully.";
whatsappMsgServiceImpl.sendMsg(registerpendingwhatsupmsg); whatsappMsgServiceImpl.sendMsg(registerpendingwhatsupmsg);
whatsappMsgServiceImpl.sendSMS(registerpendingurlString); whatsappMsgServiceImpl.sendSMS(registerpendingurlString);
} }
@ -236,26 +236,15 @@ public class UserController {
@GetMapping("/hallbookingform") @GetMapping("/hallbookingform")
public String viewform(Model model) { public String viewform(Model model) {
String username = userSession.getDispayName(); String username = userSession.getDispayName();
if (username != null) {
model.addAttribute("userName", username); model.addAttribute("userName", username);
return "user/hallbookingform"; return "user/hallbookingform";
} else {
return "redirect:/communityhall/dashboard";
}
} }
@GetMapping("/viewhallform")
public String viewhallform(Model model) {
String username = userSession.getDispayName();
model.addAttribute("userName", username);
return "user/viewhallform";
}
@GetMapping("/acknowledgement") @GetMapping("/acknowledgement")
public String viewakowledgement(Model model, int bookingId) { public String viewakowledgement(Model model, int bookingId) {
BookingDetails bookingsDetails = bookingService.getBookingsById(bookingId); BookingDetails bookingsDetails = bookingService.getBookingsById(bookingId);
model.addAttribute("bookingsDetails",bookingsDetails); // Add single BookingDetails object
model.addAttribute("userName",userSession.getDispayName());
model.addAttribute("bookingsDetails", bookingsDetails); // Add single BookingDetails object
model.addAttribute("userName", userSession.getDispayName());
return "user/acknowledgement"; return "user/acknowledgement";
} }
@ -270,7 +259,7 @@ public class UserController {
} }
@GetMapping("/viewhistory") @GetMapping("/viewhistory")
public String viewBookingDetails(Model model,@RequestParam(name="bookingStatus",required = false)String bookingStatus) {
public String viewBookingDetails(Model model, @RequestParam(name = "bookingStatus", required = false) String bookingStatus) {
// Retrieve userId from session // Retrieve userId from session
Integer userId = userSession.getUserId(); Integer userId = userSession.getUserId();
model.addAttribute("userName", userSession.getDispayName()); model.addAttribute("userName", userSession.getDispayName());
@ -278,39 +267,48 @@ public class UserController {
//List<String> test = new ArrayList<>(); //List<String> test = new ArrayList<>();
model.addAttribute("userName", userSession.getDispayName()); model.addAttribute("userName", userSession.getDispayName());
List<Map<String, Object>> bookingPast= bookingService.getAllBookingEventsByUserId(userId);
List<Map<String, Object>> bookingPast = bookingService.getAllBookingEventsByUserId(userId);
model.addAttribute("userBookingspast",bookingPast);
model.addAttribute("userBookingspast", bookingPast);
return "user/viewhistory"; return "user/viewhistory";
} }
@GetMapping("/CommunityHallList") @GetMapping("/CommunityHallList")
public String viewhalllist(Model model) { public String viewhalllist(Model model) {
model.addAttribute("userName",userSession.getDispayName());
model.addAttribute("userName", userSession.getDispayName());
return "user/communityHallList"; return "user/communityHallList";
} }
@GetMapping("/hallAmountCalculation") @GetMapping("/hallAmountCalculation")
public String viewCalculate(Model model){
model.addAttribute("userName",userSession.getDispayName());
public String viewCalculate(Model model) {
model.addAttribute("userName", userSession.getDispayName());
return "user/calculatehallamount"; return "user/calculatehallamount";
} }
@GetMapping("/collectionpending") @GetMapping("/collectionpending")
public String viewCollectionpending(Model model,int bookingId){
public String viewCollectionpending(Model model, int bookingId) {
BookingDetails bookingsDetails = bookingService.getBookingsById(bookingId); BookingDetails bookingsDetails = bookingService.getBookingsById(bookingId);
model.addAttribute("bookingsDetails",bookingsDetails); // Add single BookingDetails object
model.addAttribute("userName",userSession.getDispayName());
model.addAttribute("bookingsDetails", bookingsDetails); // Add single BookingDetails object
model.addAttribute("userName", userSession.getDispayName());
return "user/collectionpending"; return "user/collectionpending";
} }
@GetMapping("/collectionpendingacknowledgement") @GetMapping("/collectionpendingacknowledgement")
public String viewCollectionpendingAck(Model model,int bookingId){
public String viewCollectionpendingAck(Model model, int bookingId) {
BookingDetails bookingsDetails = bookingService.getBookingsById(bookingId); BookingDetails bookingsDetails = bookingService.getBookingsById(bookingId);
model.addAttribute("bookingsDetails",bookingsDetails); // Add single BookingDetails object
model.addAttribute("userName",userSession.getDispayName());
model.addAttribute("bookingsDetails", bookingsDetails); // Add single BookingDetails object
model.addAttribute("userName", userSession.getDispayName());
return "user/extraebdamageamountack"; return "user/extraebdamageamountack";
} }
@GetMapping("/viewhallform")
public String viewhallform(Model model) {
String username = userSession.getDispayName();
model.addAttribute("userName", username);
return "user/viewhallform";
}
} }

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

@ -20,9 +20,9 @@ public class BookingCalendar {
private boolean is_active; private boolean is_active;
private boolean is_delete; private boolean is_delete;
private int is_booked; private int is_booked;
private boolean is_blocked = false; private boolean is_blocked = false;
private boolean temp_blocked = false;
private int hallId; private int hallId;
public Integer getId() { public Integer getId() {
@ -33,13 +33,10 @@ public class BookingCalendar {
this.id = id; this.id = id;
} }
public boolean getIs_blocked() {
return is_blocked;
}
public void setIs_blocked(boolean is_blocked) {
this.is_blocked = is_blocked;
}
public LocalDate getBdate() { public LocalDate getBdate() {
return bdate; return bdate;
} }
@ -112,12 +109,12 @@ public class BookingCalendar {
this.hallId = hallId; this.hallId = hallId;
} }
public boolean isTemp_blocked() {
return temp_blocked;
public boolean getIs_blocked() {
return is_blocked;
} }
public void setTemp_blocked(boolean temp_blocked) {
this.temp_blocked = temp_blocked;
public void setIs_blocked(boolean is_blocked) {
this.is_blocked = is_blocked;
} }
public BookingCalendar() { public BookingCalendar() {
@ -126,8 +123,7 @@ public class BookingCalendar {
} }
public BookingCalendar(Integer id, LocalDate bdate, boolean morningSlot, boolean eveningSlot, String bookingId_1, public BookingCalendar(Integer id, LocalDate bdate, boolean morningSlot, boolean eveningSlot, String bookingId_1,
String bookingId_2, boolean is_active, boolean is_delete, int is_booked,boolean is_blocked,
boolean temp_blocked, int hallId) {
String bookingId_2, boolean is_active, boolean is_delete, int is_booked, boolean is_blocked, int hallId) {
super(); super();
this.id = id; this.id = id;
this.bdate = bdate; this.bdate = bdate;
@ -139,7 +135,6 @@ public class BookingCalendar {
this.is_delete = is_delete; this.is_delete = is_delete;
this.is_booked = is_booked; this.is_booked = is_booked;
this.is_blocked = is_blocked; this.is_blocked = is_blocked;
this.temp_blocked = temp_blocked;
this.hallId = hallId; this.hallId = hallId;
} }

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

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

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

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

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

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

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

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

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

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

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

@ -13,27 +13,25 @@ import org.springframework.stereotype.Repository;
import com.gcc.communityHall.entity.BookingDetails; import com.gcc.communityHall.entity.BookingDetails;
import com.gcc.communityHall.entity.BookingDetails.BookingStatus; import com.gcc.communityHall.entity.BookingDetails.BookingStatus;
import com.gcc.communityHall.entity.CounterRefundList;
import com.gcc.communityHall.entity.HallDetails; import com.gcc.communityHall.entity.HallDetails;
import com.gcc.communityHall.entity.Users;
@Repository @Repository
public interface BookingDetailsRepository extends JpaRepository<BookingDetails,Integer> {
public interface BookingDetailsRepository extends JpaRepository<BookingDetails, Integer> {
@Query(value = "SELECT * FROM booking_details where booking_status='GCC_BLOCKED'", nativeQuery = true) @Query(value = "SELECT * FROM booking_details where booking_status='GCC_BLOCKED'", nativeQuery = true)
List<BookingDetails> getGccBlockedList(); List<BookingDetails> getGccBlockedList();
@Query(value = "SELECT * FROM booking_details where booking_status='APPROVED'", nativeQuery = true) @Query(value = "SELECT * FROM booking_details where booking_status='APPROVED'", nativeQuery = true)
List<BookingDetails> getAllApprovedList(); List<BookingDetails> getAllApprovedList();
@Query(value = "SELECT * FROM booking_details where booking_status='REJECTED'", nativeQuery = true) @Query(value = "SELECT * FROM booking_details where booking_status='REJECTED'", nativeQuery = true)
List<BookingDetails> getAllRejectingList(); List<BookingDetails> getAllRejectingList();
@Query(value = "SELECT * FROM booking_details where booking_status='WAITING_FOR_NOC' order by booking_id", nativeQuery = true)
List<BookingDetails> getAllwaitingNOC();
@Query(value = "SELECT * FROM booking_details where booking_status='WAITING_FOR_NOC_APPROVAL'", nativeQuery = true) @Query(value = "SELECT * FROM booking_details where booking_status='WAITING_FOR_NOC_APPROVAL'", nativeQuery = true)
List<BookingDetails> getAllwaitingList(); List<BookingDetails> getAllwaitingList();
@Query(value = "SELECT * FROM booking_details WHERE hall_details_hall_id IN (:hallIds) AND booking_status IN ('APPROVED') AND start_date BETWEEN :fromDate AND :toDate ", nativeQuery = true)
@Query(value = "SELECT * FROM booking_details WHERE hall_details_hall_id IN (:hallIds) AND " +
"booking_status IN ('APPROVED','WAITING_FOR_NOC','WAITING_FOR_NOC_APPROVAL') AND " +
"((start_date BETWEEN :fromDate AND :toDate) or (end_date BETWEEN :fromDate AND :toDate))", nativeQuery = true)
List<BookingDetails> findByFromDateBetweenAndToDateBetweenAndHallIdIn(LocalDate fromDate, LocalDate toDate, List<Long> hallIds); List<BookingDetails> findByFromDateBetweenAndToDateBetweenAndHallIdIn(LocalDate fromDate, LocalDate toDate, List<Long> hallIds);
@ -57,12 +55,14 @@ public interface BookingDetailsRepository extends JpaRepository<BookingDetails,I
List<BookingDetails> findPresentsEventsByUserId(Integer hallId); List<BookingDetails> findPresentsEventsByUserId(Integer hallId);
//List<Booking> findpresentseventsByHallid(Integer hallId); //List<Booking> findpresentseventsByHallid(Integer hallId);
// @Query(value = "SELECT * FROM booking_details WHERE DATE(start_date) < CURRENT_DATE() AND hall_details_hall_id = :hallId and booking_status='APPROVED'", nativeQuery = true)
// @Query(value = "SELECT * FROM booking_details WHERE DATE(start_date) < CURRENT_DATE() AND hall_details_hall_id = :hallId and booking_status='APPROVED'", nativeQuery = true)
// List<BookingDetails> findPastsEventsByUserId(Integer hallId); // List<BookingDetails> findPastsEventsByUserId(Integer hallId);
// @Query(value = "SELECT * FROM booking_details WHERE DATE(start_date) < CURRENT_DATE() AND hall_details_hall_id = :hallId AND booking_status = 'APPROVED'", nativeQuery = true) // @Query(value = "SELECT * FROM booking_details WHERE DATE(start_date) < CURRENT_DATE() AND hall_details_hall_id = :hallId AND booking_status = 'APPROVED'", nativeQuery = true)
// List<BookingDetails> findPastEventsByHallId(Integer hallId); // List<BookingDetails> findPastEventsByHallId(Integer hallId);
@Query(value = "SELECT * FROM booking_details WHERE DATE(start_date) < CURRENT_DATE() AND hall_details_hall_id = :hallId AND booking_status = 'APPROVED'", nativeQuery = true)
List<BookingDetails> findPastEventsByHallId(@Param("hallId") Integer hallId);
/* @Query(value = "SELECT * FROM booking_details WHERE DATE(start_date) BETWEEN DATE_SUB(CURRENT_DATE(), INTERVAL 2 DAY) AND CURRENT_DATE() - INTERVAL 1 DAY AND hall_details_hall_id = :hallId AND booking_status = 'APPROVED'", nativeQuery = true)
List<BookingDetails> findPastEventsByHallId(@Param("hallId") Integer hallId);*/
@Query(value = "SELECT * FROM booking_details WHERE DATE(start_date) < CURRENT_DATE() AND hall_details_hall_id = :hallId AND booking_status = 'APPROVED'", nativeQuery = true)
List<BookingDetails> findPastEventsByHallId(@Param("hallId") Integer hallId);
@Query(value = "SELECT * FROM booking_details " + @Query(value = "SELECT * FROM booking_details " +
@ -78,18 +78,24 @@ List<BookingDetails> findPastEventsByHallId(@Param("hallId") Integer hallId);
@Query(value = "select count(users_user_id), us.user_status from booking_details bd inner join users us on us.user_id = bd.users_user_id \r\n" @Query(value = "select count(users_user_id), us.user_status from booking_details bd inner join users us on us.user_id = bd.users_user_id \r\n"
+ "where users_user_id=:userId and booking_status in ('APPROVED','COMPLETED','WAITING_FOR_NOC') and DATE_SUB(CURDATE(), INTERVAL 1 YEAR) \r\n"
+ "where users_user_id=:userId and booking_status in ('APPROVED','COMPLETED','WAITING_FOR_NOC','WAITING_FOR_NOC_APPROVAL') and DATE_SUB(CURDATE(), INTERVAL 1 YEAR) \r\n"
+ "and us.user_status not in ('PENDING')", nativeQuery = true) + "and us.user_status not in ('PENDING')", nativeQuery = true)
int checkUserBookinglimitation(int userId); int checkUserBookinglimitation(int userId);
@Query(value = "SELECT * FROM booking_details WHERE users_user_id = :userId AND booking_status NOT IN ('PENDING')", nativeQuery = true) @Query(value = "SELECT * FROM booking_details WHERE users_user_id = :userId AND booking_status NOT IN ('PENDING')", nativeQuery = true)
List<BookingDetails> getAllBookingsByUserId(Integer userId); List<BookingDetails> getAllBookingsByUserId(Integer userId);
@Query(value="select * from booking_details WHERE booking_id =:bookID", nativeQuery = true)
@Query(value = "select * from booking_details WHERE booking_id =:bookID", nativeQuery = true)
BookingDetails getByBookingId(String bookID); BookingDetails getByBookingId(String bookID);
// + " WHERE hall_details_hall_id =:hallId and booking_status= 'APPROVED' and start_date < curdate() ", nativeQuery = true) // + " WHERE hall_details_hall_id =:hallId and booking_status= 'APPROVED' and start_date < curdate() ", nativeQuery = true)
@Query(value = "SELECT * FROM booking_details WHERE DATE(start_date) <= CURRENT_DATE() AND hall_details_hall_id = :hallId and booking_status='APPROVED' and refund_status IN ('WAITING','REJECTED','APPROVED')", nativeQuery = true) @Query(value = "SELECT * FROM booking_details WHERE DATE(start_date) <= CURRENT_DATE() AND hall_details_hall_id = :hallId and booking_status='APPROVED' and refund_status IN ('WAITING','REJECTED','APPROVED')", nativeQuery = true)
public List<BookingDetails> getSettlementList(Integer hallId); public List<BookingDetails> getSettlementList(Integer hallId);
@Query(value = "SELECT * FROM booking_details WHERE DATE(start_date) <= CURRENT_DATE() AND booking_status='APPROVED' AND refund_status IN ('WAITING','REJECTED','APPROVED')", nativeQuery = true)
public List<BookingDetails> getAllSettlementList();
//yoga //yoga
@Query(value = "SELECT " + @Query(value = "SELECT " +
"u.user_id AS userId, " + "u.user_id AS userId, " +
@ -105,15 +111,14 @@ List<BookingDetails> findPastEventsByHallId(@Param("hallId") Integer hallId);
"booking_details bd " + "booking_details bd " +
"JOIN " + "JOIN " +
"users u ON bd.users_user_id = u.user_id " + "users u ON bd.users_user_id = u.user_id " +
"WHERE DATE(bd.booking_date) >= :fromDate "+
"WHERE DATE(bd.booking_date) >= :fromDate " +
"AND DATE(bd.booking_date) <= :toDate " + "AND DATE(bd.booking_date) <= :toDate " +
"AND bd.booking_status NOT IN ('PENDING')"+
"AND bd.booking_status NOT IN ('PENDING')" +
"GROUP BY " + "GROUP BY " +
"bd.users_user_id", nativeQuery = true) "bd.users_user_id", nativeQuery = true)
List<Object[]> getBookingUserDetailsReport(@Param("fromDate") String fromDate, @Param("toDate") String toDate); List<Object[]> getBookingUserDetailsReport(@Param("fromDate") String fromDate, @Param("toDate") String toDate);
@Query(value = "SELECT " + @Query(value = "SELECT " +
"h.hall_name AS HallName, " + "h.hall_name AS HallName, " +
"h.hall_Incharge_name AS InchargeName, " + "h.hall_Incharge_name AS InchargeName, " +
@ -127,18 +132,18 @@ List<BookingDetails> findPastEventsByHallId(@Param("hallId") Integer hallId);
"booking_details bd " + "booking_details bd " +
"JOIN " + "JOIN " +
"hall_details h ON bd.hall_details_hall_id = h.hall_id " + "hall_details h ON bd.hall_details_hall_id = h.hall_id " +
"LEFT JOIN users u ON bd.users_user_id = u.user_id "+
"LEFT JOIN users u ON bd.users_user_id = u.user_id " +
"JOIN " + "JOIN " +
"payments p ON bd.booking_id = p.booking_details_booking_id " + "payments p ON bd.booking_id = p.booking_details_booking_id " +
"LEFT JOIN refund_response r ON bd.booking_id = r.booking_id " + "LEFT JOIN refund_response r ON bd.booking_id = r.booking_id " +
"WHERE DATE(bd.booking_date) >= :fromDate " + "WHERE DATE(bd.booking_date) >= :fromDate " +
"AND DATE(bd.booking_date) <= :toDate " + "AND DATE(bd.booking_date) <= :toDate " +
"AND bd.booking_status NOT IN ('PENDING')"+
"AND bd.booking_status NOT IN ('PENDING')" +
"GROUP BY " + "GROUP BY " +
"bd.hall_details_hall_id", nativeQuery = true) "bd.hall_details_hall_id", nativeQuery = true)
List<Object[]> getBookingHallDetailsReport(@Param("fromDate") String fromDate, @Param("toDate") String toDate); List<Object[]> getBookingHallDetailsReport(@Param("fromDate") String fromDate, @Param("toDate") String toDate);
@Query(value="SELECT \r\n"
@Query(value = "SELECT \r\n"
+ " COALESCE( SUM(\r\n" + " COALESCE( SUM(\r\n"
+ " CASE \r\n" + " CASE \r\n"
+ " WHEN start_date = CURDATE() THEN 1\r\n" + " WHEN start_date = CURDATE() THEN 1\r\n"
@ -161,7 +166,7 @@ List<BookingDetails> findPastEventsByHallId(@Param("hallId") Integer hallId);
+ " ),0) AS FUTURE\r\n" + " ),0) AS FUTURE\r\n"
+ "FROM \r\n" + "FROM \r\n"
+ " booking_details hall\r\n" + " booking_details hall\r\n"
+ " where hall_details_hall_id= :hall_id and booking_status='APPROVED'",nativeQuery = true)
+ " where hall_details_hall_id= :hall_id and booking_status='APPROVED'", nativeQuery = true)
List<Map<String, Object>> pieChartCount(int hall_id); List<Map<String, Object>> pieChartCount(int hall_id);
//@Query(value = "SELECT * FROM booking_details WHERE DATE(booking_date) >= :fromDate AND DATE(booking_date) <= :toDate AND (:bookingStatus IS NULL OR booking_status = :bookingStatus)", nativeQuery = true) //@Query(value = "SELECT * FROM booking_details WHERE DATE(booking_date) >= :fromDate AND DATE(booking_date) <= :toDate AND (:bookingStatus IS NULL OR booking_status = :bookingStatus)", nativeQuery = true)
@ -255,7 +260,7 @@ List<BookingDetails> findPastEventsByHallId(@Param("hallId") Integer hallId);
+ " SUM(CASE WHEN bd.booking_status = 'GCC_BLOCKED' THEN 1 ELSE 0 END) AS GCC_BLOCKED\r\n" + " SUM(CASE WHEN bd.booking_status = 'GCC_BLOCKED' THEN 1 ELSE 0 END) AS GCC_BLOCKED\r\n"
+ "FROM booking_details bd " + "FROM booking_details bd "
+ "JOIN hall_details hd ON bd.hall_details_hall_id = hd.hall_id " + "JOIN hall_details hd ON bd.hall_details_hall_id = hd.hall_id "
+ "WHERE hd.zone = :zone",nativeQuery = true)
+ "WHERE hd.zone = :zone", nativeQuery = true)
List<Map<String, Object>> getCount(String zone); List<Map<String, Object>> getCount(String zone);
@ -265,7 +270,7 @@ List<BookingDetails> findPastEventsByHallId(@Param("hallId") Integer hallId);
+ "FROM booking_details bd JOIN hall_details hd ON bd.hall_details_hall_id = hd.hall_id \r\n" + "FROM booking_details bd JOIN hall_details hd ON bd.hall_details_hall_id = hd.hall_id \r\n"
+ "WHERE bd.start_date >= DATE_SUB(CURDATE(), INTERVAL 6 MONTH)\r\n" + "WHERE bd.start_date >= DATE_SUB(CURDATE(), INTERVAL 6 MONTH)\r\n"
+ " AND bd.start_date <= DATE_ADD(CURDATE(), INTERVAL 6 MONTH) AND hd.zone = :zone \r\n" + " AND bd.start_date <= DATE_ADD(CURDATE(), INTERVAL 6 MONTH) AND hd.zone = :zone \r\n"
+ " group by months order by months ASC",nativeQuery = true)
+ " group by months order by months ASC", nativeQuery = true)
List<Map<String, Object>> getmounthcount(String zone); List<Map<String, Object>> getmounthcount(String zone);
@ -276,11 +281,10 @@ List<BookingDetails> findPastEventsByHallId(@Param("hallId") Integer hallId);
+ "WHERE bd.start_date >= DATE_SUB(CURDATE(), INTERVAL 6 MONTH)\r\n" + "WHERE bd.start_date >= DATE_SUB(CURDATE(), INTERVAL 6 MONTH)\r\n"
+ " AND bd.start_date <= DATE_ADD(CURDATE(), INTERVAL 6 MONTH) \r\n" + " AND bd.start_date <= DATE_ADD(CURDATE(), INTERVAL 6 MONTH) \r\n"
+ "AND (:zone = 'all zones' OR hd.zone = :zone)\r\n " + "AND (:zone = 'all zones' OR hd.zone = :zone)\r\n "
+ " group by months order by months ASC",nativeQuery = true)
+ " group by months order by months ASC", nativeQuery = true)
List<Map<String, Object>> getAllAdminmonthcount(@Param("zone") String zone); List<Map<String, Object>> getAllAdminmonthcount(@Param("zone") String zone);
@Query(value = " SELECT SUM(CASE WHEN booking_status = 'APPROVED' THEN 1 ELSE 0 END) AS approved_count,\r\n" @Query(value = " SELECT SUM(CASE WHEN booking_status = 'APPROVED' THEN 1 ELSE 0 END) AS approved_count,\r\n"
+ " SUM(CASE WHEN bd.booking_status = 'REJECTED' THEN 1 ELSE 0 END) AS rejected_count,\r\n" + " SUM(CASE WHEN bd.booking_status = 'REJECTED' THEN 1 ELSE 0 END) AS rejected_count,\r\n"
+ " SUM(CASE WHEN bd.booking_status = 'PENDING' THEN 1 ELSE 0 END) AS pending_count,\r\n" + " SUM(CASE WHEN bd.booking_status = 'PENDING' THEN 1 ELSE 0 END) AS pending_count,\r\n"
@ -289,7 +293,7 @@ List<BookingDetails> findPastEventsByHallId(@Param("hallId") Integer hallId);
+ " SUM(CASE WHEN bd.booking_status = 'GCC_BLOCKED' THEN 1 ELSE 0 END) AS GCC_BLOCKED\r\n" + " SUM(CASE WHEN bd.booking_status = 'GCC_BLOCKED' THEN 1 ELSE 0 END) AS GCC_BLOCKED\r\n"
+ "FROM booking_details bd " + "FROM booking_details bd "
+ "JOIN hall_details hd ON bd.hall_details_hall_id = hd.hall_id " + "JOIN hall_details hd ON bd.hall_details_hall_id = hd.hall_id "
+ "WHERE (:zone = 'all zones' OR hd.zone = :zone)",nativeQuery = true)
+ "WHERE (:zone = 'all zones' OR hd.zone = :zone)", nativeQuery = true)
List<Map<String, Object>> getAdmincount(@Param("zone") String zone); List<Map<String, Object>> getAdmincount(@Param("zone") String zone);
@Query(value = "SELECT CONCAT(YEAR(bd.start_date), '-', LPAD(MONTH(bd.start_date), 2, '0')) AS months, SUM(CASE WHEN booking_status = 'APPROVED' THEN 1 ELSE 0 END) AS approved_count,\r\n" @Query(value = "SELECT CONCAT(YEAR(bd.start_date), '-', LPAD(MONTH(bd.start_date), 2, '0')) AS months, SUM(CASE WHEN booking_status = 'APPROVED' THEN 1 ELSE 0 END) AS approved_count,\r\n"
@ -298,7 +302,7 @@ List<BookingDetails> findPastEventsByHallId(@Param("hallId") Integer hallId);
+ "FROM booking_details bd JOIN hall_details hd ON bd.hall_details_hall_id = hd.hall_id \r\n" + "FROM booking_details bd JOIN hall_details hd ON bd.hall_details_hall_id = hd.hall_id \r\n"
+ "WHERE bd.start_date >= DATE_SUB(CURDATE(), INTERVAL 6 MONTH)\r\n" + "WHERE bd.start_date >= DATE_SUB(CURDATE(), INTERVAL 6 MONTH)\r\n"
+ " AND bd.start_date <= DATE_ADD(CURDATE(), INTERVAL 6 MONTH) AND hd.hall_id=:hall_id \r\n" + " AND bd.start_date <= DATE_ADD(CURDATE(), INTERVAL 6 MONTH) AND hd.hall_id=:hall_id \r\n"
+ " group by months order by months ASC",nativeQuery = true)
+ " group by months order by months ASC", nativeQuery = true)
List<Map<String, Object>> getCartakermounthcount(int hall_id); List<Map<String, Object>> getCartakermounthcount(int hall_id);
@ -309,17 +313,17 @@ List<BookingDetails> findPastEventsByHallId(@Param("hallId") Integer hallId);
+ " SUM(CASE WHEN bd.booking_status = 'PAYMENT_FAILURE' THEN 1 ELSE 0 END) AS PAYMENT_FAILURE,\r\n" + " SUM(CASE WHEN bd.booking_status = 'PAYMENT_FAILURE' THEN 1 ELSE 0 END) AS PAYMENT_FAILURE,\r\n"
+ " SUM(CASE WHEN bd.booking_status = 'GCC_BLOCKED' THEN 1 ELSE 0 END) AS GCC_BLOCKED\r\n" + " SUM(CASE WHEN bd.booking_status = 'GCC_BLOCKED' THEN 1 ELSE 0 END) AS GCC_BLOCKED\r\n"
+ "FROM booking_details bd " + "FROM booking_details bd "
+ "JOIN hall_details hd ON bd.hall_details_hall_id = hd.hall_id where hd.hall_id=:hall_id",nativeQuery = true)
+ "JOIN hall_details hd ON bd.hall_details_hall_id = hd.hall_id where hd.hall_id=:hall_id", nativeQuery = true)
List<Map<String, Object>> getcartakecount(int hall_id); List<Map<String, Object>> getcartakecount(int hall_id);
@Query(value ="SELECT \r\n"
@Query(value = "SELECT \r\n"
+ " bd.*, \r\n" + " bd.*, \r\n"
+ " CASE \r\n" + " CASE \r\n"
+ " WHEN bd.start_date < CURDATE() THEN 'Past'\r\n" + " WHEN bd.start_date < CURDATE() THEN 'Past'\r\n"
+ " WHEN bd.start_date = CURDATE() THEN 'Current'\r\n" + " WHEN bd.start_date = CURDATE() THEN 'Current'\r\n"
+ " WHEN bd.reason IN ('State Govt Event','Central Govt Event','Commericial & Others') AND bd.booking_status='APPROVED' THEN 'noaction'"
+ " WHEN bd.booking_status = 'WAITING_FOR_NOC' THEN 'waitingfornoc'\r\n" + " WHEN bd.booking_status = 'WAITING_FOR_NOC' THEN 'waitingfornoc'\r\n"
+ " WHEN bd.schedule_count = 0 AND bd.start_date > CURDATE() THEN 'Reschedule'\r\n" + " WHEN bd.schedule_count = 0 AND bd.start_date > CURDATE() THEN 'Reschedule'\r\n"
+ " WHEN bd.reason IN ('State Govt Event','Central Govt Event','Commericial & Others') AND bd.booking_status='APPROVED' THEN 'noaction'"
+ " ELSE 'Future' \r\n" + " ELSE 'Future' \r\n"
+ " END AS event_category,\r\n" + " END AS event_category,\r\n"
+ " users.*, \r\n" + " users.*, \r\n"
@ -335,7 +339,8 @@ List<BookingDetails> findPastEventsByHallId(@Param("hallId") Integer hallId);
+ "ORDER BY bd.start_date DESC;\r\n" + "ORDER BY bd.start_date DESC;\r\n"
+ "", nativeQuery = true) + "", nativeQuery = true)
List<Map<String, Object>> getAllBookingEventsByUserId(Integer userId); List<Map<String, Object>> getAllBookingEventsByUserId(Integer userId);
//counter
//counter
@Query(value = "SELECT bd.*, " + @Query(value = "SELECT bd.*, " +
"hd.zone AS hall_zone, " + "hd.zone AS hall_zone, " +
"hd.division AS hall_division, " + "hd.division AS hall_division, " +
@ -353,10 +358,10 @@ List<BookingDetails> findPastEventsByHallId(@Param("hallId") Integer hallId);
List<Map<String, Object>> findAllByBookingType(); List<Map<String, Object>> findAllByBookingType();
@Query(value="select bdud.* from booking_details bdud inner Join counter_refund_list crl on bdud.counterdetails_counter_id = crl.counterdetails_counter_id where crl.counterdetails_counter_id = :counterId", nativeQuery = true)
@Query(value = "select bdud.* from booking_details bdud inner Join counter_refund_list crl on bdud.counterdetails_counter_id = crl.counterdetails_counter_id where crl.counterdetails_counter_id = :counterId", nativeQuery = true)
List<BookingDetails> getCounterDetailsbycounterId(int counterId); List<BookingDetails> getCounterDetailsbycounterId(int counterId);
@Query(value="select *from booking_details where counterdetails_counter_id = :counterId", nativeQuery = true)
@Query(value = "select *from booking_details where counterdetails_counter_id = :counterId", nativeQuery = true)
List<BookingDetails> findByCounterId(int counterId); List<BookingDetails> findByCounterId(int counterId);
@Query("SELECT b FROM BookingDetails b LEFT JOIN FETCH b.bookingHistories WHERE b.bookingId = :bookingId") @Query("SELECT b FROM BookingDetails b LEFT JOIN FETCH b.bookingHistories WHERE b.bookingId = :bookingId")
@ -364,6 +369,7 @@ List<BookingDetails> findPastEventsByHallId(@Param("hallId") Integer hallId);
@Query("SELECT b FROM BookingDetails b JOIN FETCH b.settlement s WHERE b.refundStatus = 'APPROVED'") @Query("SELECT b FROM BookingDetails b JOIN FETCH b.settlement s WHERE b.refundStatus = 'APPROVED'")
List<BookingDetails> findAllWithApprovedRefundStatus(); List<BookingDetails> findAllWithApprovedRefundStatus();
@Query("SELECT b FROM BookingDetails b JOIN FETCH b.settlement s WHERE b.refundStatus = 'INITIATED'") @Query("SELECT b FROM BookingDetails b JOIN FETCH b.settlement s WHERE b.refundStatus = 'INITIATED'")
List<BookingDetails> findByBookingDetailsRefundStatus(); List<BookingDetails> findByBookingDetailsRefundStatus();
@ -379,6 +385,10 @@ List<BookingDetails> findPastEventsByHallId(@Param("hallId") Integer hallId);
@Query("SELECT b FROM BookingDetails b JOIN FETCH b.settlement s WHERE b.refundStatus = 'REJECTED' and b.hallDetails.zone=:zone") @Query("SELECT b FROM BookingDetails b JOIN FETCH b.settlement s WHERE b.refundStatus = 'REJECTED' and b.hallDetails.zone=:zone")
List<BookingDetails> findSettlementRejectedByZone(String zone); List<BookingDetails> findSettlementRejectedByZone(String zone);
@Query("SELECT b FROM BookingDetails b JOIN FETCH b.settlement s WHERE b.refundStatus = 'REJECTED'")
List<BookingDetails> findAllSettlementRejected();
@Query("SELECT b FROM BookingDetails b WHERE b.refundStatus = 'WAITING' AND b.bookingStatus = 'CANCELED' AND b.hallDetails.zone = :zone") @Query("SELECT b FROM BookingDetails b WHERE b.refundStatus = 'WAITING' AND b.bookingStatus = 'CANCELED' AND b.hallDetails.zone = :zone")
List<BookingDetails> findCancelledListByZone(@Param("zone") String zone); List<BookingDetails> findCancelledListByZone(@Param("zone") String zone);
@ -397,37 +407,41 @@ List<BookingDetails> findPastEventsByHallId(@Param("hallId") Integer hallId);
@Query(value = "SELECT * FROM booking_details WHERE refund_status = 'APPROVED' AND booking_status IN ('GCC_BLOCKED', 'REJECTED')", nativeQuery = true) @Query(value = "SELECT * FROM booking_details WHERE refund_status = 'APPROVED' AND booking_status IN ('GCC_BLOCKED', 'REJECTED')", nativeQuery = true)
List<BookingDetails> findRejectedList(); List<BookingDetails> findRejectedList();
@Query(value = "SELECT * FROM booking_details WHERE refund_status = 'INITIATED' AND booking_status = 'CANCELED'", nativeQuery = true) @Query(value = "SELECT * FROM booking_details WHERE refund_status = 'INITIATED' AND booking_status = 'CANCELED'", nativeQuery = true)
List<BookingDetails> findInitiatedCancelledList(); List<BookingDetails> findInitiatedCancelledList();
@Query(value = "SELECT * FROM booking_details WHERE refund_status = 'INITIATED' AND booking_status IN ('GCC_BLOCKED', 'REJECTED')", nativeQuery = true) @Query(value = "SELECT * FROM booking_details WHERE refund_status = 'INITIATED' AND booking_status IN ('GCC_BLOCKED', 'REJECTED')", nativeQuery = true)
List<BookingDetails> findInitiatedRejectedList(); List<BookingDetails> findInitiatedRejectedList();
@Query(value = "SELECT * FROM booking_details WHERE refund_status IN ('COMPLETED','CLOSED') AND booking_status = 'COMPLETED'", nativeQuery = true) @Query(value = "SELECT * FROM booking_details WHERE refund_status IN ('COMPLETED','CLOSED') AND booking_status = 'COMPLETED'", nativeQuery = true)
List<BookingDetails> findSettlementCompletedList(); List<BookingDetails> findSettlementCompletedList();
@Query(value = "SELECT * FROM booking_details WHERE refund_status = 'COMPLETED' AND booking_status = 'CANCELED'", nativeQuery = true) @Query(value = "SELECT * FROM booking_details WHERE refund_status = 'COMPLETED' AND booking_status = 'CANCELED'", nativeQuery = true)
List<BookingDetails> findCancelledCompletedList(); List<BookingDetails> findCancelledCompletedList();
@Query(value = "SELECT * FROM booking_details WHERE refund_status = 'COMPLETED' AND booking_status IN ('GCC_BLOCKED', 'REJECTED')", nativeQuery = true) @Query(value = "SELECT * FROM booking_details WHERE refund_status = 'COMPLETED' AND booking_status IN ('GCC_BLOCKED', 'REJECTED')", nativeQuery = true)
List<BookingDetails> findRejectedSettlementCompletedList(); List<BookingDetails> findRejectedSettlementCompletedList();
//officer reports //officer reports
@Query(value ="SELECT bd.*, hd.hall_name, us.name, us.usertype "+
"FROM booking_details bd "+
"JOIN hall_details hd ON bd.hall_details_hall_id = hd.hall_id "+
"JOIN users us ON bd.users_user_id = us.user_id "+
"WHERE DATE(bd.booking_date) >= :fromDate "+
@Query(value = "SELECT bd.*, hd.hall_name, us.name, us.usertype " +
"FROM booking_details bd " +
"JOIN hall_details hd ON bd.hall_details_hall_id = hd.hall_id " +
"JOIN users us ON bd.users_user_id = us.user_id " +
"WHERE DATE(bd.booking_date) >= :fromDate " +
"AND DATE(bd.booking_date) <= :toDate " + "AND DATE(bd.booking_date) <= :toDate " +
"AND hd.zone = :zone ",nativeQuery=true)
"AND hd.zone = :zone ", nativeQuery = true)
List<BookingDetails> getAllBookingDetailsByZone(@Param("fromDate") String fromDate, @Param("toDate") String toDate, @Param("zone") String zone); List<BookingDetails> getAllBookingDetailsByZone(@Param("fromDate") String fromDate, @Param("toDate") String toDate, @Param("zone") String zone);
@Query(value ="SELECT bd.*, hd.hall_name, us.name, us.usertype " +
@Query(value = "SELECT bd.*, hd.hall_name, us.name, us.usertype " +
"FROM booking_details bd " + "FROM booking_details bd " +
"JOIN hall_details hd ON bd.hall_details_hall_id = hd.hall_id "+
"JOIN hall_details hd ON bd.hall_details_hall_id = hd.hall_id " +
"JOIN users us ON bd.users_user_id = us.user_id " + "JOIN users us ON bd.users_user_id = us.user_id " +
"WHERE DATE(bd.booking_date) >= :fromDate " + "WHERE DATE(bd.booking_date) >= :fromDate " +
"AND DATE(bd.booking_date) <= :toDate " + "AND DATE(bd.booking_date) <= :toDate " +
"AND hd.zone = :zone " + "AND hd.zone = :zone " +
"AND (:bookingStatus IS NULL OR bd.booking_status = :bookingStatus)",nativeQuery=true)
List<BookingDetails> getAllBookingDetailsByZoneWithStatus(@Param("fromDate") String fromDate, @Param("toDate") String toDate, @Param("zone") String zone,@Param("bookingStatus") String bookingStatus);
"AND (:bookingStatus IS NULL OR bd.booking_status = :bookingStatus)", nativeQuery = true)
List<BookingDetails> getAllBookingDetailsByZoneWithStatus(@Param("fromDate") String fromDate, @Param("toDate") String toDate, @Param("zone") String zone, @Param("bookingStatus") String bookingStatus);
@Query(value = "SELECT " + @Query(value = "SELECT " +
"h.hall_name AS HallName, " + "h.hall_name AS HallName, " +
@ -446,38 +460,38 @@ List<BookingDetails> findPastEventsByHallId(@Param("hallId") Integer hallId);
"payments p ON bd.booking_id = p.booking_details_booking_id " + "payments p ON bd.booking_id = p.booking_details_booking_id " +
"LEFT JOIN " + "LEFT JOIN " +
"refund_transaction r ON p.transaction_id = r.transaction_id " + "refund_transaction r ON p.transaction_id = r.transaction_id " +
"WHERE DATE(bd.booking_date) >= :fromDate "+
"WHERE DATE(bd.booking_date) >= :fromDate " +
"AND DATE(bd.booking_date) <= :toDate " + "AND DATE(bd.booking_date) <= :toDate " +
"AND h.zone = :zone " + "AND h.zone = :zone " +
"GROUP BY " + "GROUP BY " +
"bd.hall_details_hall_id", nativeQuery = true) "bd.hall_details_hall_id", nativeQuery = true)
List<Object[]> getBookingHallDetailsReportByZone(@Param("fromDate") String fromDate, @Param("toDate") String toDate, @Param("zone") String zone); List<Object[]> getBookingHallDetailsReportByZone(@Param("fromDate") String fromDate, @Param("toDate") String toDate, @Param("zone") String zone);
@Query(value ="SELECT bd.*, hd.hall_name, us.name, us.usertype " +
@Query(value = "SELECT bd.*, hd.hall_name, us.name, us.usertype " +
"FROM booking_details bd " + "FROM booking_details bd " +
"JOIN hall_details hd ON bd.hall_details_hall_id = hd.hall_id " + "JOIN hall_details hd ON bd.hall_details_hall_id = hd.hall_id " +
"LEFT JOIN users us ON bd.users_user_id = us.user_id " + "LEFT JOIN users us ON bd.users_user_id = us.user_id " +
"LEFT JOIN settlement st ON bd.booking_id=st.booking_details_booking_id " + "LEFT JOIN settlement st ON bd.booking_id=st.booking_details_booking_id " +
"WHERE DATE(bd.booking_date) >= :fromDate " + "WHERE DATE(bd.booking_date) >= :fromDate " +
"AND DATE(bd.booking_date) <= :toDate " + "AND DATE(bd.booking_date) <= :toDate " +
"AND bd.booking_status NOT IN ('PENDING')"+
"AND hd.zone = :zone ",nativeQuery=true)
"AND bd.booking_status NOT IN ('PENDING')" +
"AND hd.zone = :zone ", nativeQuery = true)
List<BookingDetails> getAllBookingsettlementDetailsByZone(@Param("fromDate") String fromDate, @Param("toDate") String toDate, @Param("zone") String zone); List<BookingDetails> getAllBookingsettlementDetailsByZone(@Param("fromDate") String fromDate, @Param("toDate") String toDate, @Param("zone") String zone);
@Query(value ="SELECT bd.*, hd.hall_name, us.name, us.usertype " +
@Query(value = "SELECT bd.*, hd.hall_name, us.name, us.usertype " +
"FROM booking_details bd " + "FROM booking_details bd " +
"JOIN hall_details hd ON bd.hall_details_hall_id = hd.hall_id " + "JOIN hall_details hd ON bd.hall_details_hall_id = hd.hall_id " +
"LEFT JOIN users us ON bd.users_user_id = us.user_id " + "LEFT JOIN users us ON bd.users_user_id = us.user_id " +
"LEFT JOIN settlement st ON bd.booking_id=st.booking_details_booking_id " + "LEFT JOIN settlement st ON bd.booking_id=st.booking_details_booking_id " +
"WHERE DATE(bd.booking_date) >= :fromDate " + "WHERE DATE(bd.booking_date) >= :fromDate " +
"AND DATE(bd.booking_date) <= :toDate " + "AND DATE(bd.booking_date) <= :toDate " +
"AND bd.booking_status NOT IN ('PENDING')"+
"AND bd.booking_status NOT IN ('PENDING')" +
"AND hd.zone = :zone " + "AND hd.zone = :zone " +
"AND (:refundStatus IS NULL OR bd.refund_status = :refundStatus) ",nativeQuery=true)
List<BookingDetails> getAllBookingsettlementDetailsByZoneWithStatus(@Param("fromDate") String fromDate, @Param("toDate") String toDate, @Param("zone") String zone,@Param("refundStatus") String refundStatus);
"AND (:refundStatus IS NULL OR bd.refund_status = :refundStatus) ", nativeQuery = true)
List<BookingDetails> getAllBookingsettlementDetailsByZoneWithStatus(@Param("fromDate") String fromDate, @Param("toDate") String toDate, @Param("zone") String zone, @Param("refundStatus") String refundStatus);
@Query(value = "SELECT " +
@Query(value = "SELECT " +
"h.hall_name AS HallName, " + "h.hall_name AS HallName, " +
"h.hall_Incharge_name AS InchargeName, " + "h.hall_Incharge_name AS InchargeName, " +
"h.hall_Incharge_no AS hallInchargeMobno, " + "h.hall_Incharge_no AS hallInchargeMobno, " +
@ -490,18 +504,18 @@ List<BookingDetails> findPastEventsByHallId(@Param("hallId") Integer hallId);
"booking_details bd " + "booking_details bd " +
"JOIN " + "JOIN " +
"hall_details h ON bd.hall_details_hall_id = h.hall_id " + "hall_details h ON bd.hall_details_hall_id = h.hall_id " +
"LEFT JOIN users u ON bd.users_user_id = u.user_id "+
"LEFT JOIN users u ON bd.users_user_id = u.user_id " +
"JOIN " + "JOIN " +
"payments p ON bd.booking_id = p.booking_details_booking_id " + "payments p ON bd.booking_id = p.booking_details_booking_id " +
"LEFT JOIN refund_response r ON bd.booking_id = r.booking_id " + "LEFT JOIN refund_response r ON bd.booking_id = r.booking_id " +
"WHERE DATE(bd.booking_date) >= :fromDate " + "WHERE DATE(bd.booking_date) >= :fromDate " +
"AND DATE(bd.booking_date) <= :toDate " + "AND DATE(bd.booking_date) <= :toDate " +
"AND bd.booking_status NOT IN ('PENDING')"+
"AND bd.booking_status NOT IN ('PENDING')" +
"AND h.zone = :zone " + "AND h.zone = :zone " +
"AND bd.hall_details_hall_id = :hall_id " + "AND bd.hall_details_hall_id = :hall_id " +
"GROUP BY " + "GROUP BY " +
"bd.hall_details_hall_id", nativeQuery = true) "bd.hall_details_hall_id", nativeQuery = true)
List<Object[]> getBookingHallDetailsReportByZone1(@Param("fromDate") String fromDate, @Param("toDate") String toDate, @Param("zone") String zone,@Param("hall_id") Integer hallId);
List<Object[]> getBookingHallDetailsReportByZone1(@Param("fromDate") String fromDate, @Param("toDate") String toDate, @Param("zone") String zone, @Param("hall_id") Integer hallId);
List<BookingDetails> findByHallDetailsAndBookingStatus(HallDetails hallDetails, BookingStatus gccBlocked); List<BookingDetails> findByHallDetailsAndBookingStatus(HallDetails hallDetails, BookingStatus gccBlocked);
@ -517,25 +531,25 @@ List<BookingDetails> findPastEventsByHallId(@Param("hallId") Integer hallId);
@Query(value = "SELECT booking_id FROM booking_details WHERE hall_details_hall_id = :hallId AND start_date BETWEEN :startDate AND :endDate AND booking_status='GCC_BLOCKED'", nativeQuery = true) @Query(value = "SELECT booking_id FROM booking_details WHERE hall_details_hall_id = :hallId AND start_date BETWEEN :startDate AND :endDate AND booking_status='GCC_BLOCKED'", nativeQuery = true)
List<Integer> findBookingIdsByHallIdAndBookingDateBetween(@Param("hallId") int hallId, @Param("startDate") LocalDate startDate, @Param("endDate") LocalDate endDate); List<Integer> findBookingIdsByHallIdAndBookingDateBetween(@Param("hallId") int hallId, @Param("startDate") LocalDate startDate, @Param("endDate") LocalDate endDate);
@Query(value ="SELECT bd.*, hd.hall_name, us.name, us.usertype " +
@Query(value = "SELECT bd.*, hd.hall_name, us.name, us.usertype " +
"FROM booking_details bd " + "FROM booking_details bd " +
"JOIN hall_details hd ON bd.hall_details_hall_id = hd.hall_id " + "JOIN hall_details hd ON bd.hall_details_hall_id = hd.hall_id " +
"LEFT JOIN users us ON bd.users_user_id = us.user_id " + "LEFT JOIN users us ON bd.users_user_id = us.user_id " +
"LEFT JOIN settlement st ON bd.booking_id=st.booking_details_booking_id " + "LEFT JOIN settlement st ON bd.booking_id=st.booking_details_booking_id " +
"WHERE DATE(bd.booking_date) >= :fromDate " + "WHERE DATE(bd.booking_date) >= :fromDate " +
"AND DATE(bd.booking_date) <= :toDate " + "AND DATE(bd.booking_date) <= :toDate " +
"AND bd.booking_status NOT IN ('PENDING')"+
"AND (:refundStatus IS NULL OR bd.refund_status = :refundStatus) ",nativeQuery=true)
List<BookingDetails> getAllBookingsettlementDetailsWithStatus(@Param("fromDate") String fromDate, @Param("toDate") String toDate,@Param("refundStatus") String refundStatus);
"AND bd.booking_status NOT IN ('PENDING')" +
"AND (:refundStatus IS NULL OR bd.refund_status = :refundStatus) ", nativeQuery = true)
List<BookingDetails> getAllBookingsettlementDetailsWithStatus(@Param("fromDate") String fromDate, @Param("toDate") String toDate, @Param("refundStatus") String refundStatus);
@Query(value ="SELECT bd.*, hd.hall_name, us.name, us.usertype " +
@Query(value = "SELECT bd.*, hd.hall_name, us.name, us.usertype " +
"FROM booking_details bd " + "FROM booking_details bd " +
"JOIN hall_details hd ON bd.hall_details_hall_id = hd.hall_id " + "JOIN hall_details hd ON bd.hall_details_hall_id = hd.hall_id " +
"LEFT JOIN users us ON bd.users_user_id = us.user_id " + "LEFT JOIN users us ON bd.users_user_id = us.user_id " +
"LEFT JOIN settlement st ON bd.booking_id=st.booking_details_booking_id " + "LEFT JOIN settlement st ON bd.booking_id=st.booking_details_booking_id " +
"WHERE DATE(bd.booking_date) >= :fromDate " + "WHERE DATE(bd.booking_date) >= :fromDate " +
"AND bd.booking_status NOT IN ('PENDING')"+
"AND DATE(bd.booking_date) <= :toDate ",nativeQuery=true)
"AND bd.booking_status NOT IN ('PENDING')" +
"AND DATE(bd.booking_date) <= :toDate ", nativeQuery = true)
List<BookingDetails> getAllBookingsettlementDetails(@Param("fromDate") String fromDate, @Param("toDate") String toDate); List<BookingDetails> getAllBookingsettlementDetails(@Param("fromDate") String fromDate, @Param("toDate") String toDate);
@ -579,7 +593,6 @@ List<BookingDetails> findPastEventsByHallId(@Param("hallId") Integer hallId);
"UNION ALL " + "UNION ALL " +
"SELECT 'bookingStatus' AS category, b.booking_status AS `key`, COUNT(*) AS totalCount, NULL AS main_total_amount, NULL AS main_refunded_amount, NULL AS main_net_amount,NULL AS main_gst_amount, NULL AS PAST_Events, NULL AS FUTURE_Events " + "SELECT 'bookingStatus' AS category, b.booking_status AS `key`, COUNT(*) AS totalCount, NULL AS main_total_amount, NULL AS main_refunded_amount, NULL AS main_net_amount,NULL AS main_gst_amount, NULL AS PAST_Events, NULL AS FUTURE_Events " +
"FROM booking_details b " + "FROM booking_details b " +
@ -600,14 +613,13 @@ List<BookingDetails> findPastEventsByHallId(@Param("hallId") Integer hallId);
"AND (:userType IS NULL OR :userType = 'ALL' OR u.usertype = :userType) " + "AND (:userType IS NULL OR :userType = 'ALL' OR u.usertype = :userType) " +
"AND b.booking_status != 'PENDING'"+
"AND b.booking_status != 'PENDING'" +
"GROUP BY b.booking_status " + "GROUP BY b.booking_status " +
"UNION ALL " + "UNION ALL " +
"SELECT 'refundStatus' AS category, b.refund_status AS `key`, COUNT(*) AS totalCount, NULL AS main_total_amount, NULL AS main_refunded_amount, NULL AS main_net_amount,NULL AS main_gst_amount, NULL AS PAST_Events, NULL AS FUTURE_Events " + "SELECT 'refundStatus' AS category, b.refund_status AS `key`, COUNT(*) AS totalCount, NULL AS main_total_amount, NULL AS main_refunded_amount, NULL AS main_net_amount,NULL AS main_gst_amount, NULL AS PAST_Events, NULL AS FUTURE_Events " +
"FROM booking_details b " + "FROM booking_details b " +
@ -628,14 +640,13 @@ List<BookingDetails> findPastEventsByHallId(@Param("hallId") Integer hallId);
"AND (:userType IS NULL OR :userType = 'ALL' OR u.usertype = :userType) " + "AND (:userType IS NULL OR :userType = 'ALL' OR u.usertype = :userType) " +
"AND b.booking_status != 'PENDING'"+
"AND b.booking_status != 'PENDING'" +
"GROUP BY b.refund_status " + "GROUP BY b.refund_status " +
"UNION ALL " + "UNION ALL " +
"SELECT 'reason' AS category, b.reason AS `key`, COUNT(*) AS totalCount, NULL AS main_total_amount, NULL AS main_net_amount, NULL AS main_refunded_amount,NULL AS main_gst_amount, NULL AS PAST_Events, NULL AS FUTURE_Events " + "SELECT 'reason' AS category, b.reason AS `key`, COUNT(*) AS totalCount, NULL AS main_total_amount, NULL AS main_net_amount, NULL AS main_refunded_amount,NULL AS main_gst_amount, NULL AS PAST_Events, NULL AS FUTURE_Events " +
"FROM booking_details b " + "FROM booking_details b " +
@ -656,14 +667,13 @@ List<BookingDetails> findPastEventsByHallId(@Param("hallId") Integer hallId);
"AND (:userType IS NULL OR :userType = 'ALL' OR u.usertype = :userType) " + "AND (:userType IS NULL OR :userType = 'ALL' OR u.usertype = :userType) " +
"AND b.booking_status != 'PENDING'"+
"AND b.booking_status != 'PENDING'" +
"GROUP BY b.reason " + "GROUP BY b.reason " +
"UNION ALL " + "UNION ALL " +
"SELECT 'zonewise' AS category, h.zone AS `key`, SUM(CASE WHEN b.hall_details_hall_id IS NOT NULL AND b.booking_status != 'PENDING' THEN 1 ELSE 0 END) AS totalCount, " + "SELECT 'zonewise' AS category, h.zone AS `key`, SUM(CASE WHEN b.hall_details_hall_id IS NOT NULL AND b.booking_status != 'PENDING' THEN 1 ELSE 0 END) AS totalCount, " +
"NULL AS main_total_amount, NULL AS main_refunded_amount, NULL AS main_net_amount,NULL AS main_gst_amount, NULL AS PAST_Events, NULL AS FUTURE_Events " + "NULL AS main_total_amount, NULL AS main_refunded_amount, NULL AS main_net_amount,NULL AS main_gst_amount, NULL AS PAST_Events, NULL AS FUTURE_Events " +
@ -689,7 +699,6 @@ List<BookingDetails> findPastEventsByHallId(@Param("hallId") Integer hallId);
"UNION ALL " + "UNION ALL " +
"SELECT 'paymentStatus' AS category, " + "SELECT 'paymentStatus' AS category, " +
" p.payment_status AS `key`, " + " p.payment_status AS `key`, " +
@ -702,7 +711,7 @@ List<BookingDetails> findPastEventsByHallId(@Param("hallId") Integer hallId);
" NULL AS main_net_amount, " + " NULL AS main_net_amount, " +
" NULL AS main_gst_amount,"+
" NULL AS main_gst_amount," +
" NULL AS PAST_Events, " + " NULL AS PAST_Events, " +
@ -735,9 +744,8 @@ List<BookingDetails> findPastEventsByHallId(@Param("hallId") Integer hallId);
"UNION ALL " + "UNION ALL " +
"SELECT 'past_future' AS category, NULL AS `key`, NULL AS totalCount, NULL AS main_total_amount, NULL AS main_refunded_amount, NULL AS main_net_amount, " + "SELECT 'past_future' AS category, NULL AS `key`, NULL AS totalCount, NULL AS main_total_amount, NULL AS main_refunded_amount, NULL AS main_net_amount, " +
"NULL AS main_gst_amount,"+
"NULL AS main_gst_amount," +
"COALESCE(SUM(PAST_Booking), 0) AS PAST_Events, " + "COALESCE(SUM(PAST_Booking), 0) AS PAST_Events, " +
"COALESCE(SUM(FUTURE_Booking), 0) AS FUTURE_Events " + "COALESCE(SUM(FUTURE_Booking), 0) AS FUTURE_Events " +
"FROM ( " + "FROM ( " +
@ -817,7 +825,7 @@ List<BookingDetails> findPastEventsByHallId(@Param("hallId") Integer hallId);
"AND (:division IS NULL OR :division = 'ALL' OR h.division = :division) " + "AND (:division IS NULL OR :division = 'ALL' OR h.division = :division) " +
"AND (:hall_id IS NULL OR :hall_id = '1000' OR h.hall_id = :hall_id) " + "AND (:hall_id IS NULL OR :hall_id = '1000' OR h.hall_id = :hall_id) " +
"AND (:userType IS NULL OR :userType = 'ALL' OR u.usertype = :userType) " + "AND (:userType IS NULL OR :userType = 'ALL' OR u.usertype = :userType) " +
"AND b.booking_status != 'PENDING'"+
"AND b.booking_status != 'PENDING'" +
"GROUP BY b.booking_status " + "GROUP BY b.booking_status " +
"UNION ALL " + "UNION ALL " +
@ -831,7 +839,7 @@ List<BookingDetails> findPastEventsByHallId(@Param("hallId") Integer hallId);
"AND (:division IS NULL OR :division = 'ALL' OR h.division = :division) " + "AND (:division IS NULL OR :division = 'ALL' OR h.division = :division) " +
"AND (:hall_id IS NULL OR :hall_id = '1000' OR h.hall_id = :hall_id) " + "AND (:hall_id IS NULL OR :hall_id = '1000' OR h.hall_id = :hall_id) " +
"AND (:userType IS NULL OR :userType = 'ALL' OR u.usertype = :userType) " + "AND (:userType IS NULL OR :userType = 'ALL' OR u.usertype = :userType) " +
"AND b.booking_status != 'PENDING'"+
"AND b.booking_status != 'PENDING'" +
"GROUP BY b.refund_status " + "GROUP BY b.refund_status " +
"UNION ALL " + "UNION ALL " +
@ -845,7 +853,7 @@ List<BookingDetails> findPastEventsByHallId(@Param("hallId") Integer hallId);
"AND (:division IS NULL OR :division = 'ALL' OR h.division = :division) " + "AND (:division IS NULL OR :division = 'ALL' OR h.division = :division) " +
"AND (:hall_id IS NULL OR :hall_id = '1000' OR h.hall_id = :hall_id) " + "AND (:hall_id IS NULL OR :hall_id = '1000' OR h.hall_id = :hall_id) " +
"AND (:userType IS NULL OR :userType = 'ALL' OR u.usertype = :userType) " + "AND (:userType IS NULL OR :userType = 'ALL' OR u.usertype = :userType) " +
"AND b.booking_status != 'PENDING'"+
"AND b.booking_status != 'PENDING'" +
"GROUP BY b.reason " + "GROUP BY b.reason " +
"UNION ALL " + "UNION ALL " +
@ -931,67 +939,67 @@ List<BookingDetails> findPastEventsByHallId(@Param("hallId") Integer hallId);
+ "LEFT JOIN refund_response r ON b.booking_id = r.booking_id\r\n" + "LEFT JOIN refund_response r ON b.booking_id = r.booking_id\r\n"
+ "LEFT JOIN refund_transaction rt ON b.booking_id = rt.booking_details_booking_id\r\n" + "LEFT JOIN refund_transaction rt ON b.booking_id = rt.booking_details_booking_id\r\n"
+ "WHERE h.hall_id = :hallId AND b.booking_status != 'PENDING' ", nativeQuery = true) + "WHERE h.hall_id = :hallId AND b.booking_status != 'PENDING' ", nativeQuery = true)
List<Map<String, Object>> getHallDetailsForOfficer( @Param("hallId") Integer hallIid);
List<Map<String, Object>> getHallDetailsForOfficer(@Param("hallId") Integer hallIid);
@Query(value ="SELECT bd.*, hd.hall_name, us.name, us.usertype "+
"FROM booking_details bd "+
"JOIN hall_details hd ON bd.hall_details_hall_id = hd.hall_id "+
"JOIN users us ON bd.users_user_id = us.user_id "+
"WHERE DATE(bd.booking_date) >= :fromDate "+
@Query(value = "SELECT bd.*, hd.hall_name, us.name, us.usertype " +
"FROM booking_details bd " +
"JOIN hall_details hd ON bd.hall_details_hall_id = hd.hall_id " +
"JOIN users us ON bd.users_user_id = us.user_id " +
"WHERE DATE(bd.booking_date) >= :fromDate " +
"AND DATE(bd.booking_date) <= :toDate " + "AND DATE(bd.booking_date) <= :toDate " +
"AND hd.zone = :zone ",nativeQuery=true)
"AND hd.zone = :zone ", nativeQuery = true)
List<BookingDetails> getAllBookingDetailsBookingDateByZone(@Param("fromDate") String fromDate, @Param("toDate") String toDate, @Param("zone") String zone); List<BookingDetails> getAllBookingDetailsBookingDateByZone(@Param("fromDate") String fromDate, @Param("toDate") String toDate, @Param("zone") String zone);
@Query(value ="SELECT bd.*, hd.hall_name, us.name, us.usertype "+
"FROM booking_details bd "+
"JOIN hall_details hd ON bd.hall_details_hall_id = hd.hall_id "+
"JOIN users us ON bd.users_user_id = us.user_id "+
"WHERE DATE(bd.start_date) >= :fromDate "+
@Query(value = "SELECT bd.*, hd.hall_name, us.name, us.usertype " +
"FROM booking_details bd " +
"JOIN hall_details hd ON bd.hall_details_hall_id = hd.hall_id " +
"JOIN users us ON bd.users_user_id = us.user_id " +
"WHERE DATE(bd.start_date) >= :fromDate " +
"AND DATE(bd.end_date) <= :toDate " + "AND DATE(bd.end_date) <= :toDate " +
"AND hd.zone = :zone ",nativeQuery=true)
"AND hd.zone = :zone ", nativeQuery = true)
List<BookingDetails> getAllBookingDetailsEventDateByZone(@Param("fromDate") String fromDate, @Param("toDate") String toDate, @Param("zone") String zone); List<BookingDetails> getAllBookingDetailsEventDateByZone(@Param("fromDate") String fromDate, @Param("toDate") String toDate, @Param("zone") String zone);
@Query(value ="SELECT bd.*, hd.hall_name, us.name, us.usertype " +
@Query(value = "SELECT bd.*, hd.hall_name, us.name, us.usertype " +
"FROM booking_details bd " + "FROM booking_details bd " +
"JOIN hall_details hd ON bd.hall_details_hall_id = hd.hall_id "+
"JOIN hall_details hd ON bd.hall_details_hall_id = hd.hall_id " +
"JOIN users us ON bd.users_user_id = us.user_id " + "JOIN users us ON bd.users_user_id = us.user_id " +
"WHERE DATE(bd.booking_date) >= :fromDate " + "WHERE DATE(bd.booking_date) >= :fromDate " +
"AND DATE(bd.booking_date) <= :toDate " + "AND DATE(bd.booking_date) <= :toDate " +
"AND hd.zone = :zone " + "AND hd.zone = :zone " +
"AND (:bookingStatus IS NULL OR bd.booking_status = :bookingStatus)",nativeQuery=true)
List<BookingDetails> getAllBookingDetailsBookingDateByZoneWithStatus(@Param("fromDate") String fromDate, @Param("toDate") String toDate, @Param("zone") String zone,@Param("bookingStatus") String bookingStatus);
"AND (:bookingStatus IS NULL OR bd.booking_status = :bookingStatus)", nativeQuery = true)
List<BookingDetails> getAllBookingDetailsBookingDateByZoneWithStatus(@Param("fromDate") String fromDate, @Param("toDate") String toDate, @Param("zone") String zone, @Param("bookingStatus") String bookingStatus);
@Query(value ="SELECT bd.*, hd.hall_name, us.name, us.usertype " +
@Query(value = "SELECT bd.*, hd.hall_name, us.name, us.usertype " +
"FROM booking_details bd " + "FROM booking_details bd " +
"JOIN hall_details hd ON bd.hall_details_hall_id = hd.hall_id "+
"JOIN hall_details hd ON bd.hall_details_hall_id = hd.hall_id " +
"JOIN users us ON bd.users_user_id = us.user_id " + "JOIN users us ON bd.users_user_id = us.user_id " +
"WHERE DATE(bd.start_date) >= :fromDate " + "WHERE DATE(bd.start_date) >= :fromDate " +
"AND DATE(bd.end_date) <= :toDate " + "AND DATE(bd.end_date) <= :toDate " +
"AND hd.zone = :zone " + "AND hd.zone = :zone " +
"AND (:bookingStatus IS NULL OR bd.booking_status = :bookingStatus)",nativeQuery=true)
List<BookingDetails> getAllBookingDetailsEventDateByZoneWithStatus(@Param("fromDate") String fromDate, @Param("toDate") String toDate, @Param("zone") String zone,@Param("bookingStatus") String bookingStatus);
"AND (:bookingStatus IS NULL OR bd.booking_status = :bookingStatus)", nativeQuery = true)
List<BookingDetails> getAllBookingDetailsEventDateByZoneWithStatus(@Param("fromDate") String fromDate, @Param("toDate") String toDate, @Param("zone") String zone, @Param("bookingStatus") String bookingStatus);
@Query(value ="SELECT bd.*, hd.hall_name, us.name, us.usertype " +
@Query(value = "SELECT bd.*, hd.hall_name, us.name, us.usertype " +
"FROM booking_details bd " + "FROM booking_details bd " +
"JOIN hall_details hd ON bd.hall_details_hall_id = hd.hall_id " + "JOIN hall_details hd ON bd.hall_details_hall_id = hd.hall_id " +
"JOIN users us ON bd.users_user_id = us.user_id " + "JOIN users us ON bd.users_user_id = us.user_id " +
"JOIN settlement st ON bd.booking_id=st.booking_details_booking_id " + "JOIN settlement st ON bd.booking_id=st.booking_details_booking_id " +
"WHERE DATE(bd.booking_date) >= :fromDate " + "WHERE DATE(bd.booking_date) >= :fromDate " +
"AND DATE(bd.booking_date) <= :toDate " + "AND DATE(bd.booking_date) <= :toDate " +
"AND hd.zone = :zone ",nativeQuery=true)
"AND hd.zone = :zone ", nativeQuery = true)
List<BookingDetails> getAllBookingsettlementDetailsByZoneByBookingDate(@Param("fromDate") String fromDate, @Param("toDate") String toDate, @Param("zone") String zone); List<BookingDetails> getAllBookingsettlementDetailsByZoneByBookingDate(@Param("fromDate") String fromDate, @Param("toDate") String toDate, @Param("zone") String zone);
@Query(value ="SELECT bd.*, hd.hall_name, us.name, us.usertype " +
@Query(value = "SELECT bd.*, hd.hall_name, us.name, us.usertype " +
"FROM booking_details bd " + "FROM booking_details bd " +
"JOIN hall_details hd ON bd.hall_details_hall_id = hd.hall_id " + "JOIN hall_details hd ON bd.hall_details_hall_id = hd.hall_id " +
"JOIN users us ON bd.users_user_id = us.user_id " + "JOIN users us ON bd.users_user_id = us.user_id " +
"JOIN settlement st ON bd.booking_id=st.booking_details_booking_id " + "JOIN settlement st ON bd.booking_id=st.booking_details_booking_id " +
"WHERE DATE(bd.start_date) >= :fromDate " + "WHERE DATE(bd.start_date) >= :fromDate " +
"AND DATE(bd.end_date) <= :toDate " + "AND DATE(bd.end_date) <= :toDate " +
"AND hd.zone = :zone ",nativeQuery=true)
"AND hd.zone = :zone ", nativeQuery = true)
List<BookingDetails> getAllBookingsettlementDetailsByZoneByEventDate(@Param("fromDate") String fromDate, @Param("toDate") String toDate, @Param("zone") String zone); List<BookingDetails> getAllBookingsettlementDetailsByZoneByEventDate(@Param("fromDate") String fromDate, @Param("toDate") String toDate, @Param("zone") String zone);
@Query(value ="SELECT bd.*, hd.hall_name, us.name, us.usertype " +
@Query(value = "SELECT bd.*, hd.hall_name, us.name, us.usertype " +
"FROM booking_details bd " + "FROM booking_details bd " +
"JOIN hall_details hd ON bd.hall_details_hall_id = hd.hall_id " + "JOIN hall_details hd ON bd.hall_details_hall_id = hd.hall_id " +
"JOIN users us ON bd.users_user_id = us.user_id " + "JOIN users us ON bd.users_user_id = us.user_id " +
@ -999,10 +1007,10 @@ List<BookingDetails> findPastEventsByHallId(@Param("hallId") Integer hallId);
"WHERE DATE(bd.booking_date) >= :fromDate " + "WHERE DATE(bd.booking_date) >= :fromDate " +
"AND DATE(bd.booking_date) <= :toDate " + "AND DATE(bd.booking_date) <= :toDate " +
"AND hd.zone = :zone " + "AND hd.zone = :zone " +
"AND (:refundStatus IS NULL OR bd.refund_status = :refundStatus) ",nativeQuery=true)
List<BookingDetails> getAllBookingsettlementDetailsByZoneByBookingDateWithStatus(@Param("fromDate") String fromDate, @Param("toDate") String toDate, @Param("zone") String zone,@Param("refundStatus") String refundStatus);
"AND (:refundStatus IS NULL OR bd.refund_status = :refundStatus) ", nativeQuery = true)
List<BookingDetails> getAllBookingsettlementDetailsByZoneByBookingDateWithStatus(@Param("fromDate") String fromDate, @Param("toDate") String toDate, @Param("zone") String zone, @Param("refundStatus") String refundStatus);
@Query(value ="SELECT bd.*, hd.hall_name, us.name, us.usertype " +
@Query(value = "SELECT bd.*, hd.hall_name, us.name, us.usertype " +
"FROM booking_details bd " + "FROM booking_details bd " +
"JOIN hall_details hd ON bd.hall_details_hall_id = hd.hall_id " + "JOIN hall_details hd ON bd.hall_details_hall_id = hd.hall_id " +
"JOIN users us ON bd.users_user_id = us.user_id " + "JOIN users us ON bd.users_user_id = us.user_id " +
@ -1010,10 +1018,10 @@ List<BookingDetails> findPastEventsByHallId(@Param("hallId") Integer hallId);
"WHERE DATE(bd.start_date) >= :fromDate " + "WHERE DATE(bd.start_date) >= :fromDate " +
"AND DATE(bd.end_date) <= :toDate " + "AND DATE(bd.end_date) <= :toDate " +
"AND hd.zone = :zone " + "AND hd.zone = :zone " +
"AND (:refundStatus IS NULL OR bd.refund_status = :refundStatus) ",nativeQuery=true)
List<BookingDetails> getAllBookingsettlementDetailsByZoneByEventDateWithStatus(@Param("fromDate") String fromDate, @Param("toDate") String toDate, @Param("zone") String zone,@Param("refundStatus") String refundStatus);
"AND (:refundStatus IS NULL OR bd.refund_status = :refundStatus) ", nativeQuery = true)
List<BookingDetails> getAllBookingsettlementDetailsByZoneByEventDateWithStatus(@Param("fromDate") String fromDate, @Param("toDate") String toDate, @Param("zone") String zone, @Param("refundStatus") String refundStatus);
@Query(value ="SELECT bd.booking_id, bd.booking_date, hd.hall_name, us.name, us.usertype, p.transaction_id, p.payment_type, p.amount_received, bd.reason, bd.start_date, bd.end_date, p.payment_status " +
@Query(value = "SELECT bd.booking_id, bd.booking_date, hd.hall_name, us.name, us.usertype, p.transaction_id, p.payment_type, p.amount_received, bd.reason, bd.start_date, bd.end_date, p.payment_status " +
"FROM booking_details bd " + "FROM booking_details bd " +
"JOIN hall_details hd ON bd.hall_details_hall_id = hd.hall_id " + "JOIN hall_details hd ON bd.hall_details_hall_id = hd.hall_id " +
"JOIN users us ON bd.users_user_id = us.user_id " + "JOIN users us ON bd.users_user_id = us.user_id " +
@ -1021,9 +1029,10 @@ List<BookingDetails> findPastEventsByHallId(@Param("hallId") Integer hallId);
"WHERE DATE(bd.booking_date) >= :fromDate " + "WHERE DATE(bd.booking_date) >= :fromDate " +
"AND DATE(bd.booking_date) <= :toDate " + "AND DATE(bd.booking_date) <= :toDate " +
"AND hd.zone = :zone " + "AND hd.zone = :zone " +
"AND p.payment_status='Success' ",nativeQuery=true)
"AND p.payment_status='Success' ", nativeQuery = true)
List<Object[]> getAllPaymentsDetailsByZone(@Param("fromDate") String fromDate, @Param("toDate") String toDate, @Param("zone") String zone); List<Object[]> getAllPaymentsDetailsByZone(@Param("fromDate") String fromDate, @Param("toDate") String toDate, @Param("zone") String zone);
@Query(value = "SELECT " +
@Query(value = "SELECT " +
"h.hall_name AS HallName, " + "h.hall_name AS HallName, " +
"h.zone AS Zone, " + "h.zone AS Zone, " +
"h.division AS Division, " + "h.division AS Division, " +
@ -1040,7 +1049,7 @@ List<BookingDetails> findPastEventsByHallId(@Param("hallId") Integer hallId);
"payments p ON bd.booking_id = p.booking_details_booking_id " + "payments p ON bd.booking_id = p.booking_details_booking_id " +
"LEFT JOIN " + "LEFT JOIN " +
"refund_transaction r ON p.transaction_id = r.transaction_id " + "refund_transaction r ON p.transaction_id = r.transaction_id " +
"WHERE DATE(bd.booking_date) >= :fromDate "+
"WHERE DATE(bd.booking_date) >= :fromDate " +
"AND DATE(bd.booking_date) <= :toDate " + "AND DATE(bd.booking_date) <= :toDate " +
"AND h.zone = :zone " + "AND h.zone = :zone " +
"GROUP BY " + "GROUP BY " +
@ -1048,7 +1057,6 @@ List<BookingDetails> findPastEventsByHallId(@Param("hallId") Integer hallId);
List<Object[]> getBookingHallDetailsReportByZoneByBookingDate(@Param("fromDate") String fromDate, @Param("toDate") String toDate, @Param("zone") String zone); List<Object[]> getBookingHallDetailsReportByZoneByBookingDate(@Param("fromDate") String fromDate, @Param("toDate") String toDate, @Param("zone") String zone);
@Query(value = "SELECT " + @Query(value = "SELECT " +
"h.hall_name AS HallName, " + "h.hall_name AS HallName, " +
"h.zone AS Zone, " + "h.zone AS Zone, " +
@ -1066,7 +1074,7 @@ List<BookingDetails> findPastEventsByHallId(@Param("hallId") Integer hallId);
"payments p ON bd.booking_id = p.booking_details_booking_id " + "payments p ON bd.booking_id = p.booking_details_booking_id " +
"LEFT JOIN " + "LEFT JOIN " +
"refund_transaction r ON p.transaction_id = r.transaction_id " + "refund_transaction r ON p.transaction_id = r.transaction_id " +
"WHERE DATE(bd.start_date) >= :fromDate "+
"WHERE DATE(bd.start_date) >= :fromDate " +
"AND DATE(bd.end_date) <= :toDate " + "AND DATE(bd.end_date) <= :toDate " +
"AND h.zone = :zone " + "AND h.zone = :zone " +
"GROUP BY " + "GROUP BY " +
@ -1090,13 +1098,13 @@ List<BookingDetails> findPastEventsByHallId(@Param("hallId") Integer hallId);
"payments p ON bd.booking_id = p.booking_details_booking_id " + "payments p ON bd.booking_id = p.booking_details_booking_id " +
"LEFT JOIN " + "LEFT JOIN " +
"refund_transaction r ON p.transaction_id = r.transaction_id " + "refund_transaction r ON p.transaction_id = r.transaction_id " +
"WHERE DATE(bd.booking_date) >= :fromDate "+
"WHERE DATE(bd.booking_date) >= :fromDate " +
"AND DATE(bd.booking_date) <= :toDate " + "AND DATE(bd.booking_date) <= :toDate " +
"AND h.zone = :zone " + "AND h.zone = :zone " +
"AND (:hall_id = '0' OR h.hall_id = :hall_id) " + "AND (:hall_id = '0' OR h.hall_id = :hall_id) " +
"GROUP BY " + "GROUP BY " +
"h.hall_id", nativeQuery = true) "h.hall_id", nativeQuery = true)
List<Object[]> getBookingHallDetailsReportByZoneByBookingDateHallname(@Param("fromDate") String fromDate, @Param("toDate") String toDate, @Param("zone") String zone,@Param("hall_id") Integer hallId);
List<Object[]> getBookingHallDetailsReportByZoneByBookingDateHallname(@Param("fromDate") String fromDate, @Param("toDate") String toDate, @Param("zone") String zone, @Param("hall_id") Integer hallId);
@Query(value = "SELECT " + @Query(value = "SELECT " +
@ -1116,13 +1124,13 @@ List<BookingDetails> findPastEventsByHallId(@Param("hallId") Integer hallId);
"payments p ON bd.booking_id = p.booking_details_booking_id " + "payments p ON bd.booking_id = p.booking_details_booking_id " +
"LEFT JOIN " + "LEFT JOIN " +
"refund_transaction r ON p.transaction_id = r.transaction_id " + "refund_transaction r ON p.transaction_id = r.transaction_id " +
"WHERE DATE(bd.start_date) >= :fromDate "+
"WHERE DATE(bd.start_date) >= :fromDate " +
"AND DATE(bd.end_date) <= :toDate " + "AND DATE(bd.end_date) <= :toDate " +
"AND h.zone = :zone " + "AND h.zone = :zone " +
"AND (:hall_id = '0' OR h.hall_id = :hall_id) " + "AND (:hall_id = '0' OR h.hall_id = :hall_id) " +
"GROUP BY " + "GROUP BY " +
"h.hall_id", nativeQuery = true) "h.hall_id", nativeQuery = true)
List<Object[]> getBookingHallDetailsReportByZoneByEventDateHallname(@Param("fromDate") String fromDate, @Param("toDate") String toDate, @Param("zone") String zone,@Param("hall_id") Integer hallId);
List<Object[]> getBookingHallDetailsReportByZoneByEventDateHallname(@Param("fromDate") String fromDate, @Param("toDate") String toDate, @Param("zone") String zone, @Param("hall_id") Integer hallId);
// Present Events: Fetch today's events // Present Events: Fetch today's events
@Query(value = "SELECT * FROM booking_details WHERE DATE(start_date) = CURRENT_DATE() AND booking_status='APPROVED'", nativeQuery = true) @Query(value = "SELECT * FROM booking_details WHERE DATE(start_date) = CURRENT_DATE() AND booking_status='APPROVED'", nativeQuery = true)
@ -1138,7 +1146,7 @@ List<BookingDetails> findPastEventsByHallId(@Param("hallId") Integer hallId);
@Query(value = "SELECT * FROM booking_details " + @Query(value = "SELECT * FROM booking_details " +
"WHERE start_date BETWEEN CURDATE() + INTERVAL 1 DAY AND CURDATE() + INTERVAL 2 DAY " + "WHERE start_date BETWEEN CURDATE() + INTERVAL 1 DAY AND CURDATE() + INTERVAL 2 DAY " +
"AND booking_status = 'APPROVED'", nativeQuery = true) "AND booking_status = 'APPROVED'", nativeQuery = true)
List<BookingDetails> findFutureEventsList();
List<BookingDetails> findFutureEventsList();
//admin reports //admin reports
@Query(value = "SELECT bd.booking_id, bd.booking_date, hd.hall_name, us.name, us.mobile_no, " + @Query(value = "SELECT bd.booking_id, bd.booking_date, hd.hall_name, us.name, us.mobile_no, " +
@ -1149,13 +1157,13 @@ List<BookingDetails> findFutureEventsList();
"JOIN hall_details hd ON bd.hall_details_hall_id = hd.hall_id " + "JOIN hall_details hd ON bd.hall_details_hall_id = hd.hall_id " +
"JOIN users us ON bd.users_user_id = us.user_id " + "JOIN users us ON bd.users_user_id = us.user_id " +
"WHERE DATE(bd.booking_date) >= :fromDate " + "WHERE DATE(bd.booking_date) >= :fromDate " +
"AND DATE(bd.booking_date) <= :toDate "+
"AND DATE(bd.booking_date) <= :toDate " +
"AND (:zone IS NULL OR :zone = 'ALL' OR hd.zone = :zone) " + "AND (:zone IS NULL OR :zone = 'ALL' OR hd.zone = :zone) " +
"AND (:division IS NULL OR :division = 'ALL' OR hd.division = :division) " + "AND (:division IS NULL OR :division = 'ALL' OR hd.division = :division) " +
"AND (:hallid IS NULL OR :hallid = '1000' OR hd.hall_id = :hallid) " + "AND (:hallid IS NULL OR :hallid = '1000' OR hd.hall_id = :hallid) " +
"AND bd.booking_status!='PENDING' ",nativeQuery = true)
"AND bd.booking_status!='PENDING' ", nativeQuery = true)
List<Object[]> getBookingDetailsByBookingDate(@Param("fromDate") String fromDate, List<Object[]> getBookingDetailsByBookingDate(@Param("fromDate") String fromDate,
@Param("toDate") String toDate,@Param("zone") String zone,@Param("division") String division,@Param("hallid") Integer hallid);
@Param("toDate") String toDate, @Param("zone") String zone, @Param("division") String division, @Param("hallid") Integer hallid);
@Query(value = "SELECT bd.booking_id, bd.booking_date, hd.hall_name, us.name, us.mobile_no, " + @Query(value = "SELECT bd.booking_id, bd.booking_date, hd.hall_name, us.name, us.mobile_no, " +
"CONCAT(us.doorno, ', ', us.street, ', ', us.area, ', ', us.location, ', ', us.pin_code) AS address, " + "CONCAT(us.doorno, ', ', us.street, ', ', us.area, ', ', us.location, ', ', us.pin_code) AS address, " +
@ -1169,10 +1177,10 @@ List<BookingDetails> findFutureEventsList();
"AND (:zone IS NULL OR :zone = 'ALL' OR hd.zone = :zone) " + "AND (:zone IS NULL OR :zone = 'ALL' OR hd.zone = :zone) " +
"AND (:division IS NULL OR :division = 'ALL' OR hd.division = :division) " + "AND (:division IS NULL OR :division = 'ALL' OR hd.division = :division) " +
"AND (:hallid IS NULL OR :hallid = '1000' OR hd.hall_id = :hallid) " + "AND (:hallid IS NULL OR :hallid = '1000' OR hd.hall_id = :hallid) " +
"AND bd.booking_status = :bookingStatus ",nativeQuery = true)
"AND bd.booking_status = :bookingStatus ", nativeQuery = true)
List<Object[]> getBookingDetailsByBookingDateWithStatus(@Param("fromDate") String fromDate, List<Object[]> getBookingDetailsByBookingDateWithStatus(@Param("fromDate") String fromDate,
@Param("toDate") String toDate, @Param("toDate") String toDate,
@Param("bookingStatus") String bookingStatus,@Param("zone") String zone,@Param("division") String division,@Param("hallid") Integer hallid);
@Param("bookingStatus") String bookingStatus, @Param("zone") String zone, @Param("division") String division, @Param("hallid") Integer hallid);
@Query(value = "SELECT bd.booking_id, bd.booking_date, hd.hall_name, us.name, us.mobile_no, " + @Query(value = "SELECT bd.booking_id, bd.booking_date, hd.hall_name, us.name, us.mobile_no, " +
@ -1187,9 +1195,9 @@ List<BookingDetails> findFutureEventsList();
"AND (:zone IS NULL OR :zone = 'ALL' OR hd.zone = :zone) " + "AND (:zone IS NULL OR :zone = 'ALL' OR hd.zone = :zone) " +
"AND (:division IS NULL OR :division = 'ALL' OR hd.division = :division) " + "AND (:division IS NULL OR :division = 'ALL' OR hd.division = :division) " +
"AND (:hallid IS NULL OR :hallid = '1000' OR hd.hall_id = :hallid) " + "AND (:hallid IS NULL OR :hallid = '1000' OR hd.hall_id = :hallid) " +
"AND bd.booking_status!='PENDING' ",nativeQuery = true)
"AND bd.booking_status!='PENDING' ", nativeQuery = true)
List<Object[]> getBookingDetailsByEventDate(@Param("fromDate") String fromDate, List<Object[]> getBookingDetailsByEventDate(@Param("fromDate") String fromDate,
@Param("toDate") String toDate,@Param("zone") String zone,@Param("division") String division,@Param("hallid") Integer hallid);
@Param("toDate") String toDate, @Param("zone") String zone, @Param("division") String division, @Param("hallid") Integer hallid);
@Query(value = "SELECT bd.booking_id, bd.booking_date, hd.hall_name, us.name, us.mobile_no, " + @Query(value = "SELECT bd.booking_id, bd.booking_date, hd.hall_name, us.name, us.mobile_no, " +
"CONCAT(us.doorno, ', ', us.street, ', ', us.area, ', ', us.location, ', ', us.pin_code) AS address, " + "CONCAT(us.doorno, ', ', us.street, ', ', us.area, ', ', us.location, ', ', us.pin_code) AS address, " +
@ -1203,10 +1211,10 @@ List<BookingDetails> findFutureEventsList();
"AND (:zone IS NULL OR :zone = 'ALL' OR hd.zone = :zone) " + "AND (:zone IS NULL OR :zone = 'ALL' OR hd.zone = :zone) " +
"AND (:division IS NULL OR :division = 'ALL' OR hd.division = :division) " + "AND (:division IS NULL OR :division = 'ALL' OR hd.division = :division) " +
"AND (:hallid IS NULL OR :hallid = '1000' OR hd.hall_id = :hallid) " + "AND (:hallid IS NULL OR :hallid = '1000' OR hd.hall_id = :hallid) " +
"AND bd.booking_status = :bookingStatus",nativeQuery = true)
"AND bd.booking_status = :bookingStatus", nativeQuery = true)
List<Object[]> getBookingDetailsByEventDateWithStatus(@Param("fromDate") String fromDate, List<Object[]> getBookingDetailsByEventDateWithStatus(@Param("fromDate") String fromDate,
@Param("toDate") String toDate, @Param("toDate") String toDate,
@Param("bookingStatus") String bookingStatus,@Param("zone") String zone,@Param("division") String division,@Param("hallid") Integer hallid);
@Param("bookingStatus") String bookingStatus, @Param("zone") String zone, @Param("division") String division, @Param("hallid") Integer hallid);
@Query(value = "SELECT bd.booking_id, bd.booking_date, hd.hall_name, us.name, us.usertype, p.transaction_id, p.payment_type, bd.deposit_amount, bd.hall_amount, bd.gst, p.amount_received, bd.reason, bd.start_date, bd.end_date, p.payment_status " + @Query(value = "SELECT bd.booking_id, bd.booking_date, hd.hall_name, us.name, us.usertype, p.transaction_id, p.payment_type, bd.deposit_amount, bd.hall_amount, bd.gst, p.amount_received, bd.reason, bd.start_date, bd.end_date, p.payment_status " +
"FROM booking_details bd " + "FROM booking_details bd " +
@ -1220,7 +1228,7 @@ List<BookingDetails> findFutureEventsList();
"AND (:division IS NULL OR :division = 'ALL' OR hd.division = :division) " + "AND (:division IS NULL OR :division = 'ALL' OR hd.division = :division) " +
"AND (:hallid IS NULL OR :hallid = '1000' OR hd.hall_id = :hallid) ", "AND (:hallid IS NULL OR :hallid = '1000' OR hd.hall_id = :hallid) ",
nativeQuery = true) nativeQuery = true)
List<Object[]> getAllPaymentsDetails(@Param("fromDate") String fromDate, @Param("toDate") String toDate,@Param("paymentStatus") String paymentStatus,@Param("zone") String zone,@Param("division") String division,@Param("hallid") Integer hallid);
List<Object[]> getAllPaymentsDetails(@Param("fromDate") String fromDate, @Param("toDate") String toDate, @Param("paymentStatus") String paymentStatus, @Param("zone") String zone, @Param("division") String division, @Param("hallid") Integer hallid);
@Query(value = "SELECT bd.booking_id, bd.booking_date, hd.hall_name, us.name, us.usertype, p.transaction_id, p.payment_type, bd.deposit_amount, bd.hall_amount, bd.gst, p.amount_received, bd.reason, bd.start_date, bd.end_date, p.payment_status " + @Query(value = "SELECT bd.booking_id, bd.booking_date, hd.hall_name, us.name, us.usertype, p.transaction_id, p.payment_type, bd.deposit_amount, bd.hall_amount, bd.gst, p.amount_received, bd.reason, bd.start_date, bd.end_date, p.payment_status " +
"FROM booking_details bd " + "FROM booking_details bd " +
@ -1234,7 +1242,7 @@ List<BookingDetails> findFutureEventsList();
"AND (:division IS NULL OR :division = 'ALL' OR hd.division = :division) " + "AND (:division IS NULL OR :division = 'ALL' OR hd.division = :division) " +
"AND (:hallid IS NULL OR :hallid = '1000' OR hd.hall_id = :hallid) ", "AND (:hallid IS NULL OR :hallid = '1000' OR hd.hall_id = :hallid) ",
nativeQuery = true) nativeQuery = true)
List<Object[]> getAllExtraPaymentsDetails(@Param("fromDate") String fromDate, @Param("toDate") String toDate,@Param("paymentStatus") String paymentStatus,@Param("zone") String zone,@Param("division") String division,@Param("hallid") Integer hallid);
List<Object[]> getAllExtraPaymentsDetails(@Param("fromDate") String fromDate, @Param("toDate") String toDate, @Param("paymentStatus") String paymentStatus, @Param("zone") String zone, @Param("division") String division, @Param("hallid") Integer hallid);
@Query(value = "SELECT " + @Query(value = "SELECT " +
@ -1263,7 +1271,7 @@ List<BookingDetails> findFutureEventsList();
"AND (:hallid IS NULL OR :hallid = '1000' OR h.hall_id = :hallid) " + "AND (:hallid IS NULL OR :hallid = '1000' OR h.hall_id = :hallid) " +
"GROUP BY " + "GROUP BY " +
"bd.hall_details_hall_id", nativeQuery = true) "bd.hall_details_hall_id", nativeQuery = true)
List<Object[]> getBookingHallDetailsReportByBookingDate(@Param("fromDate") String fromDate, @Param("toDate") String toDate,@Param("zone") String zone,@Param("division") String division,@Param("hallid") Integer hallid);
List<Object[]> getBookingHallDetailsReportByBookingDate(@Param("fromDate") String fromDate, @Param("toDate") String toDate, @Param("zone") String zone, @Param("division") String division, @Param("hallid") Integer hallid);
@Query(value = "SELECT " + @Query(value = "SELECT " +
@ -1292,46 +1300,47 @@ List<BookingDetails> findFutureEventsList();
"AND (:hallid IS NULL OR :hallid = '1000' OR h.hall_id = :hallid) " + "AND (:hallid IS NULL OR :hallid = '1000' OR h.hall_id = :hallid) " +
"GROUP BY " + "GROUP BY " +
"bd.hall_details_hall_id", nativeQuery = true) "bd.hall_details_hall_id", nativeQuery = true)
List<Object[]> getBookingHallDetailsReportByEventDate(@Param("fromDate") String fromDate, @Param("toDate") String toDate,@Param("zone") String zone,@Param("division") String division,@Param("hallid") Integer hallid);
List<Object[]> getBookingHallDetailsReportByEventDate(@Param("fromDate") String fromDate, @Param("toDate") String toDate, @Param("zone") String zone, @Param("division") String division, @Param("hallid") Integer hallid);
@Query(value ="SELECT bd.*, hd.hall_name, us.name, us.usertype " +
@Query(value = "SELECT bd.*, hd.hall_name, us.name, us.usertype " +
"FROM booking_details bd " + "FROM booking_details bd " +
"JOIN hall_details hd ON bd.hall_details_hall_id = hd.hall_id " + "JOIN hall_details hd ON bd.hall_details_hall_id = hd.hall_id " +
"JOIN users us ON bd.users_user_id = us.user_id " + "JOIN users us ON bd.users_user_id = us.user_id " +
"left JOIN settlement st ON bd.booking_id=st.booking_details_booking_id " + "left JOIN settlement st ON bd.booking_id=st.booking_details_booking_id " +
"WHERE DATE(bd.booking_date) >= :fromDate " + "WHERE DATE(bd.booking_date) >= :fromDate " +
"AND DATE(bd.booking_date) <= :toDate ",nativeQuery=true)
"AND DATE(bd.booking_date) <= :toDate ", nativeQuery = true)
List<BookingDetails> getAllBookingsettlementDetailsByBookingDate(@Param("fromDate") String fromDate, @Param("toDate") String toDate); List<BookingDetails> getAllBookingsettlementDetailsByBookingDate(@Param("fromDate") String fromDate, @Param("toDate") String toDate);
@Query(value ="SELECT bd.*, hd.hall_name, us.name, us.usertype " +
@Query(value = "SELECT bd.*, hd.hall_name, us.name, us.usertype " +
"FROM booking_details bd " + "FROM booking_details bd " +
"JOIN hall_details hd ON bd.hall_details_hall_id = hd.hall_id " + "JOIN hall_details hd ON bd.hall_details_hall_id = hd.hall_id " +
"JOIN users us ON bd.users_user_id = us.user_id " + "JOIN users us ON bd.users_user_id = us.user_id " +
"left JOIN settlement st ON bd.booking_id=st.booking_details_booking_id " + "left JOIN settlement st ON bd.booking_id=st.booking_details_booking_id " +
"WHERE DATE(bd.booking_date) >= :fromDate " + "WHERE DATE(bd.booking_date) >= :fromDate " +
"AND DATE(bd.booking_date) <= :toDate " + "AND DATE(bd.booking_date) <= :toDate " +
"AND (:refundStatus IS NULL OR bd.refund_status = :refundStatus) ",nativeQuery=true)
List<BookingDetails> getAllBookingsettlementDetailsByBookingDateWithStatus(@Param("fromDate") String fromDate, @Param("toDate") String toDate,@Param("refundStatus") String refundStatus);
"AND (:refundStatus IS NULL OR bd.refund_status = :refundStatus) ", nativeQuery = true)
List<BookingDetails> getAllBookingsettlementDetailsByBookingDateWithStatus(@Param("fromDate") String fromDate, @Param("toDate") String toDate, @Param("refundStatus") String refundStatus);
@Query(value ="SELECT bd.*, hd.hall_name, us.name, us.usertype " +
@Query(value = "SELECT bd.*, hd.hall_name, us.name, us.usertype " +
"FROM booking_details bd " + "FROM booking_details bd " +
"JOIN hall_details hd ON bd.hall_details_hall_id = hd.hall_id " + "JOIN hall_details hd ON bd.hall_details_hall_id = hd.hall_id " +
"JOIN users us ON bd.users_user_id = us.user_id " + "JOIN users us ON bd.users_user_id = us.user_id " +
"left JOIN settlement st ON bd.booking_id=st.booking_details_booking_id " + "left JOIN settlement st ON bd.booking_id=st.booking_details_booking_id " +
"WHERE DATE(bd.start_date) >= :fromDate " + "WHERE DATE(bd.start_date) >= :fromDate " +
"AND DATE(bd.end_date) <= :toDate ",nativeQuery=true)
"AND DATE(bd.end_date) <= :toDate ", nativeQuery = true)
List<BookingDetails> getAllBookingsettlementDetailsByEventDate(@Param("fromDate") String fromDate, @Param("toDate") String toDate); List<BookingDetails> getAllBookingsettlementDetailsByEventDate(@Param("fromDate") String fromDate, @Param("toDate") String toDate);
@Query(value ="SELECT bd.*, hd.hall_name, us.name, us.usertype " +
@Query(value = "SELECT bd.*, hd.hall_name, us.name, us.usertype " +
"FROM booking_details bd " + "FROM booking_details bd " +
"JOIN hall_details hd ON bd.hall_details_hall_id = hd.hall_id " + "JOIN hall_details hd ON bd.hall_details_hall_id = hd.hall_id " +
"JOIN users us ON bd.users_user_id = us.user_id " + "JOIN users us ON bd.users_user_id = us.user_id " +
"left JOIN settlement st ON bd.booking_id=st.booking_details_booking_id " + "left JOIN settlement st ON bd.booking_id=st.booking_details_booking_id " +
"WHERE DATE(bd.start_date) >= :fromDate " + "WHERE DATE(bd.start_date) >= :fromDate " +
"AND DATE(bd.end_date) <= :toDate " + "AND DATE(bd.end_date) <= :toDate " +
"AND (:refundStatus IS NULL OR bd.refund_status = :refundStatus) ",nativeQuery=true)
List<BookingDetails> getAllBookingsettlementDetailsByEventDateWithStatus(@Param("fromDate") String fromDate, @Param("toDate") String toDate,@Param("refundStatus") String refundStatus);
"AND (:refundStatus IS NULL OR bd.refund_status = :refundStatus) ", nativeQuery = true)
List<BookingDetails> getAllBookingsettlementDetailsByEventDateWithStatus(@Param("fromDate") String fromDate, @Param("toDate") String toDate, @Param("refundStatus") String refundStatus);
// In BookingDetailsRepository.java // In BookingDetailsRepository.java
// In BookingDetailsRepository.java // In BookingDetailsRepository.java
@Query("SELECT h.zone, COUNT(b) FROM BookingDetails b JOIN b.hallDetails h WHERE b.bookingStatus = 'APPROVED' GROUP BY h.zone") @Query("SELECT h.zone, COUNT(b) FROM BookingDetails b JOIN b.hallDetails h WHERE b.bookingStatus = 'APPROVED' GROUP BY h.zone")
@ -1381,31 +1390,46 @@ List<BookingDetails> findFutureEventsList();
@Query("SELECT b FROM BookingDetails b WHERE b.refundStatus = 'FAILURE' AND b.bookingStatus = 'APPROVED' AND b.hallDetails.zone = :zone") @Query("SELECT b FROM BookingDetails b WHERE b.refundStatus = 'FAILURE' AND b.bookingStatus = 'APPROVED' AND b.hallDetails.zone = :zone")
List<BookingDetails> findSettlementRefundFailedByZone(String zone); List<BookingDetails> findSettlementRefundFailedByZone(String zone);
@Query("SELECT b FROM BookingDetails b WHERE b.refundStatus = 'FAILURE' AND b.bookingStatus = 'CANCELED' AND b.hallDetails.zone = :zone") @Query("SELECT b FROM BookingDetails b WHERE b.refundStatus = 'FAILURE' AND b.bookingStatus = 'CANCELED' AND b.hallDetails.zone = :zone")
List<BookingDetails> findRefundFaileCancelledListByZone(String zone); List<BookingDetails> findRefundFaileCancelledListByZone(String zone);
@Query("SELECT b FROM BookingDetails b WHERE b.refundStatus = 'FAILURE' AND b.bookingStatus IN ('REJECTED','GCC_BLOCKED') AND b.hallDetails.zone = :zone") @Query("SELECT b FROM BookingDetails b WHERE b.refundStatus = 'FAILURE' AND b.bookingStatus IN ('REJECTED','GCC_BLOCKED') AND b.hallDetails.zone = :zone")
List<BookingDetails> findRefundFaileRejectedListByZone(String zone); List<BookingDetails> findRefundFaileRejectedListByZone(String zone);
@Query("SELECT b FROM BookingDetails b WHERE b.bookingStatus = 'COMPLETED' AND b.refundStatus IN ('COMPLETED','CLOSED') AND b.hallDetails.zone = :zone") @Query("SELECT b FROM BookingDetails b WHERE b.bookingStatus = 'COMPLETED' AND b.refundStatus IN ('COMPLETED','CLOSED') AND b.hallDetails.zone = :zone")
List<BookingDetails> findSettlementCompletedListbyzone(String zone); List<BookingDetails> findSettlementCompletedListbyzone(String zone);
@Query("SELECT b FROM BookingDetails b WHERE b.bookingStatus = 'CANCELED' AND b.refundStatus = 'COMPLETED' AND b.hallDetails.zone = :zone") @Query("SELECT b FROM BookingDetails b WHERE b.bookingStatus = 'CANCELED' AND b.refundStatus = 'COMPLETED' AND b.hallDetails.zone = :zone")
List<BookingDetails> findCancelledCompletedListbyzone(String zone); List<BookingDetails> findCancelledCompletedListbyzone(String zone);
@Query("SELECT b FROM BookingDetails b WHERE b.bookingStatus IN ('REJECTED','GCC_BLOCKED') AND b.refundStatus = 'COMPLETED' AND b.hallDetails.zone = :zone") @Query("SELECT b FROM BookingDetails b WHERE b.bookingStatus IN ('REJECTED','GCC_BLOCKED') AND b.refundStatus = 'COMPLETED' AND b.hallDetails.zone = :zone")
List<BookingDetails> findRejectedSettlementCompletedListbyzone(String zone); List<BookingDetails> findRejectedSettlementCompletedListbyzone(String zone);
@Query("SELECT b FROM BookingDetails b JOIN FETCH b.settlement s WHERE b.refundStatus = 'WAITING'") @Query("SELECT b FROM BookingDetails b JOIN FETCH b.settlement s WHERE b.refundStatus = 'WAITING'")
List<BookingDetails> findAllSettlementPending(); List<BookingDetails> findAllSettlementPending();
@Query("SELECT b FROM BookingDetails b WHERE b.refundStatus = 'WAITING' AND b.bookingStatus = 'CANCELED'") @Query("SELECT b FROM BookingDetails b WHERE b.refundStatus = 'WAITING' AND b.bookingStatus = 'CANCELED'")
List<BookingDetails> findAllSettlementCancelledList(); List<BookingDetails> findAllSettlementCancelledList();
@Query("SELECT b FROM BookingDetails b WHERE b.refundStatus = 'WAITING' AND b.bookingStatus IN ('REJECTED','GCC_BLOCKED')") @Query("SELECT b FROM BookingDetails b WHERE b.refundStatus = 'WAITING' AND b.bookingStatus IN ('REJECTED','GCC_BLOCKED')")
List<BookingDetails> findAllSettlementRejectedList(); List<BookingDetails> findAllSettlementRejectedList();
@Query("SELECT b FROM BookingDetails b WHERE b.refundStatus = 'FAILURE' AND b.bookingStatus = 'APPROVED'") @Query("SELECT b FROM BookingDetails b WHERE b.refundStatus = 'FAILURE' AND b.bookingStatus = 'APPROVED'")
List<BookingDetails> findAllSettlementRefundFailed(); List<BookingDetails> findAllSettlementRefundFailed();
@Query("SELECT b FROM BookingDetails b WHERE b.refundStatus = 'FAILURE' AND b.bookingStatus = 'CANCELED'") @Query("SELECT b FROM BookingDetails b WHERE b.refundStatus = 'FAILURE' AND b.bookingStatus = 'CANCELED'")
List<BookingDetails> findAllRefundFaileCancelledList(); List<BookingDetails> findAllRefundFaileCancelledList();
@Query("SELECT b FROM BookingDetails b WHERE b.refundStatus = 'FAILURE' AND b.bookingStatus IN ('REJECTED','GCC_BLOCKED')") @Query("SELECT b FROM BookingDetails b WHERE b.refundStatus = 'FAILURE' AND b.bookingStatus IN ('REJECTED','GCC_BLOCKED')")
List<BookingDetails> findAllRefundFaileRejectedList(); List<BookingDetails> findAllRefundFaileRejectedList();
@Query("SELECT b FROM BookingDetails b JOIN FETCH b.settlement s WHERE b.refundStatus = 'REJECTED'")
List<BookingDetails> findAllSettlementRejected();
@Query(value = "SELECT * FROM booking_details WHERE DATE(start_date) <= CURRENT_DATE() AND booking_status='APPROVED' AND refund_status IN ('WAITING','REJECTED','APPROVED')", nativeQuery = true)
public List<BookingDetails> getAllSettlementList();}
@Query(value = "SELECT * FROM booking_details WHERE booking_date = :bookingDate AND hall_details_hall_id = :hallId", nativeQuery = true)
List<BookingDetails> findByBookingDateAndHallId(@Param("bookingDate") LocalDate bookingDate,
@Param("hallId") Long hallId);
@Query(value = "SELECT * FROM booking_details where booking_status='WAITING_FOR_NOC' order by booking_id", nativeQuery = true)
List<BookingDetails> getAllwaitingNOC();
}

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

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

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

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

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

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

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

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

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

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

@ -55,8 +55,8 @@
</style> </style>
<body> <body>
<!-- Page Container -->
<div id="page-container"
<!-- Page Container -->
<div id="page-container"
class="sidebar-o sidebar-dark enable-page-overlay side-scroll page-header-fixed page-header-dark"> class="sidebar-o sidebar-dark enable-page-overlay side-scroll page-header-fixed page-header-dark">
<!-- Side Overlay aside (right)--> <!-- Side Overlay aside (right)-->
<aside th:replace="~{fragments/aside-right :: aside}"></aside> <aside th:replace="~{fragments/aside-right :: aside}"></aside>
@ -167,9 +167,9 @@
<td th:text="${transaction[3]}"></td> <td th:text="${transaction[3]}"></td>
<td th:text="${transaction[4]}"></td> <td th:text="${transaction[4]}"></td>
<td th:text="${transaction[5]}"></td> <td th:text="${transaction[5]}"></td>
<!--
<!--
<td th:text="${transaction[6]}"></td> <td th:text="${transaction[6]}"></td>
-->
-->
</tr> </tr>
</table> </table>
@ -239,11 +239,11 @@
</main> </main>
<footer th:replace="~{fragments/footer2 :: footer}"></footer> <footer th:replace="~{fragments/footer2 :: footer}"></footer>
</div>
</div>
<div th:replace="~{fragments/resetpassword :: div}"></div>
<script th:replace="~{fragments/loginscript :: script}"></script>
<div th:replace="~{fragments/resetpassword :: div}"></div>
<script th:replace="~{fragments/loginscript :: script}"></script>
<script> <script>
$(document).ready(function () { $(document).ready(function () {
// Common buttons configuration // Common buttons configuration

67
src/main/resources/templates/admin/gccblocking.html

@ -110,7 +110,7 @@
</style> </style>
<body> <body>
<div id="page-container"
<div id="page-container"
class="sidebar-o sidebar-dark enable-page-overlay side-scroll page-header-fixed page-header-dark"> class="sidebar-o sidebar-dark enable-page-overlay side-scroll page-header-fixed page-header-dark">
<aside th:replace="~{fragments/aside-right :: aside}"></aside> <aside th:replace="~{fragments/aside-right :: aside}"></aside>
<nav th:replace="~{fragments/nav-admin :: nav}"></nav> <nav th:replace="~{fragments/nav-admin :: nav}"></nav>
@ -122,7 +122,8 @@
<h3 class="block-title"> List of Blocked Halls</h3> <h3 class="block-title"> List of Blocked Halls</h3>
<div class="block-options"> <div class="block-options">
<button type="button" class="btn btn-primary" id="addButton"><i <button type="button" class="btn btn-primary" id="addButton"><i
class="far fa-plus-square"></i> Block the Halls</button>
class="far fa-plus-square"></i> Block the Halls
</button>
</div> </div>
</div> </div>
<div class="block-content p-0"> <div class="block-content p-0">
@ -315,7 +316,6 @@
</div> </div>
<div class="row"> <div class="row">
<div class="col-sm"> <div class="col-sm">
<label for="fromDate">From Date:</label> <label for="fromDate">From Date:</label>
@ -358,7 +358,8 @@
<!-- Button at left end corner --> <!-- Button at left end corner -->
<div class="col text-left"> <div class="col text-left">
<button type="button" class="btn btn-primary" id="viewButton" style="margin-left:46%" <button type="button" class="btn btn-primary" id="viewButton" style="margin-left:46%"
onclick="getBlockedevents()">View</button>
onclick="getBlockedevents()">View
</button>
</div> </div>
</div> </div>
@ -393,7 +394,8 @@
<!-- Button at left end corner --> <!-- Button at left end corner -->
<div class="col text-left"> <div class="col text-left">
<button type="button" class="btn btn-primary" id="cancelAll" <button type="button" class="btn btn-primary" id="cancelAll"
style="margin-left:46%">Block All</button>
style="margin-left:46%">Block All
</button>
</div> </div>
</div> </div>
</div> </div>
@ -411,13 +413,13 @@
</div> </div>
</div> </div>
</div> </div>
</div>
<div th:replace="~{fragments/resetpassword :: div}"></div>
<footer th:replace="~{fragments/footer2 :: footer}"></footer>
</div>
</div>
<div th:replace="~{fragments/resetpassword :: div}"></div>
<footer th:replace="~{fragments/footer2 :: footer}"></footer>
</div>
<script th:replace="~{fragments/loginscript :: script}"></script>
<script>
<script th:replace="~{fragments/loginscript :: script}"></script>
<script>
$(document).ready(function () { $(document).ready(function () {
let fieldIndex = 1; // To uniquely identify each field set let fieldIndex = 1; // To uniquely identify each field set
@ -635,8 +637,16 @@
var endDate = new Date(event.endDate); var endDate = new Date(event.endDate);
var noOfDays = Math.ceil((endDate - startDate) / (1000 * 3600 * 24)) + 1; var noOfDays = Math.ceil((endDate - startDate) / (1000 * 3600 * 24)) + 1;
var formattedStartDate = startDate.toLocaleDateString('en-GB', {year: 'numeric', month: '2-digit', day: '2-digit'}).replace(/\//g, '-');
var formattedEndDate = endDate.toLocaleDateString('en-GB', {year: 'numeric', month: '2-digit', day: '2-digit'}).replace(/\//g, '-');
var formattedStartDate = startDate.toLocaleDateString('en-GB', {
year: 'numeric',
month: '2-digit',
day: '2-digit'
}).replace(/\//g, '-');
var formattedEndDate = endDate.toLocaleDateString('en-GB', {
year: 'numeric',
month: '2-digit',
day: '2-digit'
}).replace(/\//g, '-');
var rowHtml = '<tr>' + var rowHtml = '<tr>' +
'<td class="text-center">' + formattedStartDate + '</td>' + '<td class="text-center">' + formattedStartDate + '</td>' +
@ -651,8 +661,6 @@
}); });
// Booking details click handler // Booking details click handler
$(document).on('click', '.view-booking-details', function () { $(document).on('click', '.view-booking-details', function () {
var bookingId = $(this).data('booking-id'); var bookingId = $(this).data('booking-id');
@ -736,7 +744,7 @@
if ($(this).data('additional-value') === hallId) { if ($(this).data('additional-value') === hallId) {
$(this).prop('checked', isChecked); $(this).prop('checked', isChecked);
} }
updateHallCheckboxes();
//updateHallCheckboxes();
updateHallDisplay(); updateHallDisplay();
}); });
}); });
@ -753,10 +761,11 @@
$("#selectAllCheckbox").click(function () { $("#selectAllCheckbox").click(function () {
var isChecked = $(this).prop('checked'); var isChecked = $(this).prop('checked');
$("#bookingTableBody input[type='checkbox']").prop('checked', isChecked); $("#bookingTableBody input[type='checkbox']").prop('checked', isChecked);
updateHallCheckboxes();
//updateHallCheckboxes();
updateHallDisplay(); // Update hall display based on selected hall IDs updateHallDisplay(); // Update hall display based on selected hall IDs
}); });
// Event handler for the Cancel All button
$("#cancelAll").click(function () { $("#cancelAll").click(function () {
var fromDate = $("#fromDate").val(); var fromDate = $("#fromDate").val();
var toDate = $("#toDate").val(); var toDate = $("#toDate").val();
@ -780,13 +789,23 @@
return; return;
} }
var allCheckboxes = $("#bookingTableBody input[type='checkbox']"); // Get all checkboxes
var selectedCheckboxes = $("#bookingTableBody input[type='checkbox']:checked"); // Get all checked checkboxes
if (allCheckboxes.length !== selectedCheckboxes.length) {
Swal.fire({
icon: "warning",
title: "Incomplete Selection",
text: "Please select all checkboxes before blocking.",
});
return; // Stop further execution
}
// Get selected checkboxes and their values and additional values // Get selected checkboxes and their values and additional values
var selectedBookings = Array.from(document.querySelectorAll('#bookingTableBody input[type="checkbox"]:checked')) var selectedBookings = Array.from(document.querySelectorAll('#bookingTableBody input[type="checkbox"]:checked'))
.map(cb => ({ .map(cb => ({
value: cb.value, value: cb.value,
additionalValue: cb.getAttribute('data-additional-value') additionalValue: cb.getAttribute('data-additional-value')
})); }));
// Separate arrays for values and additional values // Separate arrays for values and additional values
var selectedValues = selectedBookings.map(booking => booking.value); var selectedValues = selectedBookings.map(booking => booking.value);
var selectedDataHallIds = selectedBookings.map(booking => booking.additionalValue); var selectedDataHallIds = selectedBookings.map(booking => booking.additionalValue);
@ -823,6 +842,8 @@
.filter(value => !isNaN(value)) .filter(value => !isNaN(value))
.join(','); .join(',');
console.log("hallIds: "+hallIds);
// Create FormData for AJAX // Create FormData for AJAX
var formData = new FormData(); var formData = new FormData();
formData.append('fromDate', fromDate); formData.append('fromDate', fromDate);
@ -960,6 +981,7 @@
updateSelectOptions(selectedHallIds); updateSelectOptions(selectedHallIds);
}); });
// Function to update the display of selected hall IDs // Function to update the display of selected hall IDs
function updateHallDisplay() { function updateHallDisplay() {
var checkedHallIds = Array.from(document.querySelectorAll('#hallSelectOptions input[type="checkbox"]:checked')) var checkedHallIds = Array.from(document.querySelectorAll('#hallSelectOptions input[type="checkbox"]:checked'))
@ -982,7 +1004,6 @@
var fromDate = $("#fromDate").val(); var fromDate = $("#fromDate").val();
var toDate = $("#toDate").val(); var toDate = $("#toDate").val();
var reasonforBlocking = $("#reasonforBlocking").val(); var reasonforBlocking = $("#reasonforBlocking").val();
if (!reasonforBlocking) { if (!reasonforBlocking) {
Swal.fire( Swal.fire(
'Error!', 'Error!',
@ -1042,6 +1063,7 @@
} }
}); });
} }
function unblockSpecificBlockedevent(blockingId, bookingId, fromDate, hallId) { function unblockSpecificBlockedevent(blockingId, bookingId, fromDate, hallId) {
Swal.fire({ Swal.fire({
title: 'Are you sure?', title: 'Are you sure?',
@ -1073,6 +1095,7 @@
} }
}); });
} }
function formatDate(date) { function formatDate(date) {
var d = new Date(date), var d = new Date(date),
month = '' + (d.getMonth() + 1), month = '' + (d.getMonth() + 1),
@ -1195,6 +1218,7 @@
checkboxStatusChange('hallSelectOptions', 'hallSelectLabel'); checkboxStatusChange('hallSelectOptions', 'hallSelectLabel');
}); });
} }
// Function to load halls based on selected zones // Function to load halls based on selected zones
function loadHallsbyzone() { function loadHallsbyzone() {
const selectedZones = Array.from(document.querySelectorAll('#zoneSelectOptions input[type="checkbox"]:checked')).map(cb => cb.value); const selectedZones = Array.from(document.querySelectorAll('#zoneSelectOptions input[type="checkbox"]:checked')).map(cb => cb.value);
@ -1244,6 +1268,7 @@
}); });
checkboxStatusChange('hallSelectOptions', 'hallSelectLabel'); checkboxStatusChange('hallSelectOptions', 'hallSelectLabel');
} }
function checkboxStatusChange(optionsId, labelId) { function checkboxStatusChange(optionsId, labelId) {
var multiselect = document.getElementById(labelId); var multiselect = document.getElementById(labelId);
var multiselectOption = multiselect.getElementsByTagName('option')[0]; var multiselectOption = multiselect.getElementsByTagName('option')[0];
@ -1275,7 +1300,6 @@
} }
window.onload = function () { window.onload = function () {
document.addEventListener("click", function (evt) { document.addEventListener("click", function (evt) {
var zoneFlyoutElement = document.getElementById('zoneMultiselect'), var zoneFlyoutElement = document.getElementById('zoneMultiselect'),
@ -1326,6 +1350,7 @@
// Event listener for when the modal is hidden // Event listener for when the modal is hidden
document.getElementById('viewdetails').addEventListener('hidden.bs.modal', clearModalFields); document.getElementById('viewdetails').addEventListener('hidden.bs.modal', clearModalFields);
}); });
function formatDate(date) { function formatDate(date) {
let d = new Date(date), let d = new Date(date),
month = '' + (d.getMonth() + 1), month = '' + (d.getMonth() + 1),
@ -1353,7 +1378,7 @@
toDateInput.setAttribute('min', selectedFromDate); toDateInput.setAttribute('min', selectedFromDate);
toDateInput.value = ''; // Reset the value of toDate toDateInput.value = ''; // Reset the value of toDate
}); });
</script>
</script>
</body> </body>
</html> </html>

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -25,8 +25,8 @@
} }
</style> </style>
<body> <body>
<!-- Page Container -->
<div id="page-container"
<!-- Page Container -->
<div id="page-container"
class="sidebar-o sidebar-dark enable-page-overlay side-scroll page-header-fixed page-header-dark"> class="sidebar-o sidebar-dark enable-page-overlay side-scroll page-header-fixed page-header-dark">
<!-- Sidebar Nav--> <!-- Sidebar Nav-->
<aside th:replace="~{fragments/aside-right :: aside}"></aside> <aside th:replace="~{fragments/aside-right :: aside}"></aside>
@ -77,7 +77,6 @@
<td class="text-center" <td class="text-center"
th:text="${booking.hallDetails.hallInchargeName} + ' / ' + ${booking.hallDetails.hallInchargeMobno}"> th:text="${booking.hallDetails.hallInchargeName} + ' / ' + ${booking.hallDetails.hallInchargeMobno}">
</td> </td>
<td> <td>
<p> <p>
<span class="badge bg-warning" style="cursor: pointer;" <span class="badge bg-warning" style="cursor: pointer;"
@ -93,7 +92,6 @@
</div> </div>
</div> </div>
</main> </main>
<!-- END Main Container --> <!-- END Main Container -->
<!--modal for pening--> <!--modal for pening-->
<div class="modal fade backdrop" id="pendingBookingForm" data-backdrop="static" tabindex="-1" role="dialog" <div class="modal fade backdrop" id="pendingBookingForm" data-backdrop="static" tabindex="-1" role="dialog"
@ -323,22 +321,18 @@
<div class="modal fade" id="fileModal" tabindex="-1" role="dialog" aria-labelledby="fileModalLabel" aria-hidden="true"> <div class="modal fade" id="fileModal" tabindex="-1" role="dialog" aria-labelledby="fileModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document"> <div class="modal-dialog modal-lg" role="document">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h5 class="modal-title" id="fileModalLabel">File Preview</h5> <h5 class="modal-title" id="fileModalLabel">File Preview</h5>
<button type="button" class="close" data-bs-dismiss="modal" aria-label="Close"> <button type="button" class="close" data-bs-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span> <span aria-hidden="true">&times;</span>
</button> </button>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<embed id="filePreview" src="" width="100%" height="600px"> <embed id="filePreview" src="" width="100%" height="600px">
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button> <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
@ -441,6 +435,7 @@
showReasonDocuments(list); showReasonDocuments(list);
} }
function showReasonDocuments(list) { function showReasonDocuments(list) {
console.log("Reason;;;"+list.reason);
$.ajax({ $.ajax({
type: "GET", type: "GET",
url: '/communityhall/api/officer/getReasonByName', url: '/communityhall/api/officer/getReasonByName',
@ -448,7 +443,7 @@
'reasonName': list.reason 'reasonName': list.reason
}, },
success: function (x) { success: function (x) {
//console.log(x);
console.log("getReasonByName:.."+x);
showReasonWithDocument(x, list); showReasonWithDocument(x, list);
} }
}); });
@ -589,7 +584,7 @@
Swal.fire('Changes are not saved', '', 'info'); Swal.fire('Changes are not saved', '', 'info');
} }
}); });
}
}
function rejectsubmit() { function rejectsubmit() {
let id = document.getElementById("bookingid").value; let id = document.getElementById("bookingid").value;
@ -702,7 +697,6 @@
responsive: true, responsive: true,
searching: true, // Enable search searching: true, // Enable search
select: false, select: false,
processing: false, processing: false,
}); });
// Link the search input to DataTable // Link the search input to DataTable

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

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

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

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

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

12
src/main/resources/templates/headquarters/settlement-completed.html

@ -31,8 +31,8 @@
integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO"
crossorigin="anonymous"></script> crossorigin="anonymous"></script>
<body> <body>
<!-- Page Container -->
<div id="page-container"
<!-- Page Container -->
<div id="page-container"
class="sidebar-o sidebar-dark enable-page-overlay side-scroll page-header-fixed page-header-dark"> class="sidebar-o sidebar-dark enable-page-overlay side-scroll page-header-fixed page-header-dark">
<!-- Side Overlay aside (right)--> <!-- Side Overlay aside (right)-->
<aside th:replace="~{fragments/aside-right :: aside}"></aside> <aside th:replace="~{fragments/aside-right :: aside}"></aside>
@ -686,10 +686,10 @@
</div> </div>
<footer th:replace="~{fragments/footer2 :: footer}"></footer> <footer th:replace="~{fragments/footer2 :: footer}"></footer>
<!-- END Footer --> <!-- END Footer -->
</div>
<div th:replace="~{fragments/resetpassword :: div}"></div>
<script th:replace="~{fragments/loginscript :: script}"></script>
<script>
</div>
<div th:replace="~{fragments/resetpassword :: div}"></div>
<script th:replace="~{fragments/loginscript :: script}"></script>
<script>
$(document).ready(function () { $(document).ready(function () {
$('#myTab a').click(function (e) { $('#myTab a').click(function (e) {
e.preventDefault(); e.preventDefault();

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

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

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

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

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

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

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

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

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

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

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

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

49
src/main/resources/templates/user/dashboard.html

@ -181,8 +181,8 @@
</style> </style>
<body> <body>
<!-- Pre-loader start -->
<div class="theme-loader">
<!-- Pre-loader start -->
<div class="theme-loader">
<div class="ball-scale"> <div class="ball-scale">
<div class='contain'> <div class='contain'>
<div class="ring"> <div class="ring">
@ -217,9 +217,9 @@
</div> </div>
</div> </div>
</div> </div>
</div>
<!-- Pre-loader end -->
<div id="pcoded" class="pcoded">
</div>
<!-- Pre-loader end -->
<div id="pcoded" class="pcoded">
<div class="pcoded-container"> <div class="pcoded-container">
<!-- Menu header start --> <!-- Menu header start -->
@ -507,9 +507,9 @@
th:onclick="viewHallImages([[${hall.hallId}]])">View</span></a> th:onclick="viewHallImages([[${hall.hallId}]])">View</span></a>
</td> </td>
<td><a
th:href="'/communityhall/hallbookingform?hallId=' + ${hall.hallId}"><span
<td><a href="javascript:void(0);"><span
class="badge bg-success" class="badge bg-success"
th:onclick="return checkLoginedIn('book',[[${hall.hallId}]]);"
style="cursor: pointer;">Book</span></a> style="cursor: pointer;">Book</span></a>
</td> </td>
</tr> </tr>
@ -656,21 +656,21 @@
</div> </div>
</div> </div>
</div><!-- end of Model Map--> </div><!-- end of Model Map-->
</div>
</div>
<div th:replace="~{fragments/loginreg :: div}"></div>
<script th:replace="~{fragments/script :: script}"></script>
<script th:replace="~{fragments/logRegiOtpScript :: script}"></script>
<div th:replace="~{fragments/loginreg :: div}"></div>
<script th:replace="~{fragments/script :: script}"></script>
<script th:replace="~{fragments/logRegiOtpScript :: script}"></script>
<script src="https://cdn.datatables.net/1.13.4/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.4.1/js/dataTables.buttons.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.4.1/js/buttons.html5.min.js"></script>
<script>
<script src="https://cdn.datatables.net/1.13.4/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.4.1/js/dataTables.buttons.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.4.1/js/buttons.html5.min.js"></script>
<script>
$('.carousel').carousel({ $('.carousel').carousel({
interval: 6000 interval: 6000
}) })
</script>
<script>
</script>
<script>
$(document).ready(function () { $(document).ready(function () {
$('#simpletable').DataTable({ $('#simpletable').DataTable({
responsive: true, responsive: true,
@ -690,11 +690,11 @@
] ]
}); });
}); });
</script>
</script>
<!--Model Script End-->
<!--script to show next seven days from selected from from date-->
<script>
<!--Model Script End-->
<!--script to show next seven days from selected from from date-->
<script>
$(document).ready(function () { $(document).ready(function () {
// Populate 'todate' options based on 'fromdate' // Populate 'todate' options based on 'fromdate'
// Function to format date as dd-mm-yyyy // Function to format date as dd-mm-yyyy
@ -787,8 +787,8 @@
} }
document.getElementById('toggleButton').addEventListener('click', toggleButtonClicked); document.getElementById('toggleButton').addEventListener('click', toggleButtonClicked);
</script>
<script>
</script>
<script>
window.dataLayer = window.dataLayer || []; window.dataLayer = window.dataLayer || [];
function gtag() {dataLayer.push(arguments);} function gtag() {dataLayer.push(arguments);}
@ -1287,6 +1287,7 @@
} }
function redirectToPage(hallId) { function redirectToPage(hallId) {
alert(hallId);
window.location.href = '/communityhall/hallbookingform?hallId=' + hallId; window.location.href = '/communityhall/hallbookingform?hallId=' + hallId;
} }
@ -1403,7 +1404,7 @@
}, 100); // Delay to ensure the map container is rendered }, 100); // Delay to ensure the map container is rendered
} }
} }
</script>
</script>
</body> </body>

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

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

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

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

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

@ -115,30 +115,6 @@
color: #000 !important; color: #000 !important;
} }
.highlight-blue .ui-state-default {
background: blue !important;
color: #FFF !important;
}
.highlight-lightpink .ui-state-default {
background: lightpink !important;
color: #FFF !important;
}
.highlight-lightpink a,
input[type=button]:disabled {
background-color: lightpink;
/* Pink highlight for disabled or booked dates */
color: white;
}
.highlight-blue a,
input[type=button]:disabled {
background-color: blue;
/* Pink highlight for disabled or booked dates */
color: white;
}
.form-control[readonly] { .form-control[readonly] {
background-color: white; background-color: white;
} }
@ -635,7 +611,7 @@
<td <td
th:text="${booking.ending_slot == 1 ? 'morning' : (booking.ending_slot == 2 ? 'evening' : '')}"> th:text="${booking.ending_slot == 1 ? 'morning' : (booking.ending_slot == 2 ? 'evening' : '')}">
</td> </td>
<td th:text="${booking.reason}"></td>
<td th:text="${booking.reason}" ></td>
<td <td
th:text="${#strings.replace(booking.booking_status, '_', ' ')}"> th:text="${#strings.replace(booking.booking_status, '_', ' ')}">
</td> </td>
@ -697,11 +673,25 @@
NOC</span> NOC</span>
</a> </a>
</p> </p>
<!--<p th:case="'noaction'">
<a class="view-button">
<span>&#45;&#45;No Action&#45;&#45;</span>
</a>
</p>-->
<p th:case="'noaction'"> <p th:case="'noaction'">
<a class="view-button"> <a class="view-button">
<span>--No Action--</span>
<a class="view-button"
th:if="${booking.booking_status == 'APPROVED'}">
<span class="badge bg-danger"
style="cursor: pointer;"
th:onclick="cancelBooking([[${booking.booking_id}]], [[${booking.mobile_no}]], [[${booking.booking_type}]])">Cancel
Booking</span>
</a>
</a> </a>
</p> </p>
<p th:case="''"> <p th:case="''">
<a class="view-button"> <a class="view-button">
<span>--No Action--</span> <span>--No Action--</span>
@ -719,7 +709,8 @@
th:if="${booking.booking_status == 'APPROVED'}"> th:if="${booking.booking_status == 'APPROVED'}">
<span class="badge bg-danger" <span class="badge bg-danger"
style="cursor: pointer;" style="cursor: pointer;"
th:onclick="openRescheduleModal([[${booking.booking_id}]], [[${booking.start_date}]], [[${booking.end_date}]],[[${booking.no_of_days}]],[[${booking.hall_details_hall_id}]],[[${booking.starting_slot}]],[[${booking.ending_slot}]])">Reschedule
th:onclick="openRescheduleModal([[${booking.booking_id}]], [[${booking.start_date}]], [[${booking.end_date}]],[[${booking.no_of_days}]],
[[${booking.hall_details_hall_id}]],[[${booking.starting_slot}]],[[${booking.ending_slot}]],[[${booking.reason}]])">Reschedule
Booking</span> Booking</span>
</a> </a>
</p> </p>
@ -1300,20 +1291,22 @@
style="background-color: blue;"></button> style="background-color: blue;"></button>
<p style="margin-left: 14px;">GCC Blocked</p> <p style="margin-left: 14px;">GCC Blocked</p>
</div> </div>
<div class="col col-lg-2 col-sm-2 col-md-2">
<!--<div class="col col-lg-2 col-sm-2 col-md-2">
<button type="button" class="btn btn-primary btn-square-md" <button type="button" class="btn btn-primary btn-square-md"
style="background-color: lightpink;"></button> style="background-color: lightpink;"></button>
<p style="margin-left: 14px;">Temporary Blocked</p> <p style="margin-left: 14px;">Temporary Blocked</p>
</div>
</div>-->
</div> </div>
</div> </div>
</div> </div>
<!-- Modal Footer --> <!-- Modal Footer -->
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-secondary" <button type="button" class="btn btn-secondary"
data-bs-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary" onclick="Reschedule()">Save
Changes</button>
data-bs-dismiss="modal">Close
</button>
<button type="button" class="btn btn-primary" onclick="Reschedule()" >Save
Changes
</button>
</div> </div>
</div> </div>
</div> </div>
@ -2031,7 +2024,7 @@
}); });
} }
} }
function openRescheduleModal(bookingId, startDate, endDate, noOfDays, hallId, startingSlot, endingSlot) {
function openRescheduleModal(bookingId, startDate, endDate, noOfDays, hallId, startingSlot, endingSlot, reason) {
// Function to map slot values to their text representation // Function to map slot values to their text representation
function getSlotText(slot) { function getSlotText(slot) {
return slot === 1 ? 'Morning' : 'Evening'; return slot === 1 ? 'Morning' : 'Evening';
@ -2060,14 +2053,14 @@
document.getElementById("endingSlotText").value = getSlotText(endingSlot); document.getElementById("endingSlotText").value = getSlotText(endingSlot);
// Optionally, fetch and update calendar or availability based on hallId // Optionally, fetch and update calendar or availability based on hallId
getBookingCalendar(hallId);
getBookingCalendar(hallId, reason);
// Show the modal // Show the modal
$('#bookingRescheduleModal').modal('show'); $('#bookingRescheduleModal').modal('show');
} }
function getBookingCalendar(hall_id) {
function getBookingCalendar(hall_id, reason) {
// Make an AJAX call to fetch booking data // Make an AJAX call to fetch booking data
$.ajax({ $.ajax({
type: 'GET', type: 'GET',
@ -2082,12 +2075,12 @@
$("#startDateInput").datepicker("destroy"); $("#startDateInput").datepicker("destroy");
for (var i = 0; i < response.length; i++) { for (var i = 0; i < response.length; i++) {
var dateString = datepickerFormat(response[i].bdate); var dateString = datepickerFormat(response[i].bdate);
window.bookingResponse[dateString] = [response[i].morningSlot, response[i].eveningSlot, response[i].is_blocked, response[i].temp_blocked ];
window.bookingResponse[dateString] = [response[i].morningSlot, response[i].eveningSlot];
} }
initializeDatepickerWithColors(hall_id);
initializeDatepickerWithColors(hall_id, reason);
if (response.length == 0) { if (response.length == 0) {
initializeDatepickerWithColors(hall_id);
initializeDatepickerWithColors(hall_id, reason);
} }
} else { } else {
console.error('Invalid or empty response data.'); console.error('Invalid or empty response data.');
@ -2098,42 +2091,57 @@
} }
}); });
} }
function initializeDatepickerWithColors(hallId) { // Confirm hallId is passed here
function initializeDatepickerWithColors(hallId, reason) { // Confirm hallId is passed here
$("#datepicker-container").datepicker("destroy"); $("#datepicker-container").datepicker("destroy");
$("#startDateInput,#datepicker-container").datepicker({ $("#startDateInput,#datepicker-container").datepicker({
dateFormat: "yy-mm-dd", dateFormat: "yy-mm-dd",
minDate: "+7D",
minDate:0,
maxDate: "+6M", maxDate: "+6M",
beforeShowDay: function (eDate) { beforeShowDay: function (eDate) {
var today = new Date();
var minDate = new Date();
minDate.setDate(today.getDate() + 6);
var dateString = $.datepicker.formatDate("yy-mm-dd", eDate);
var bookingStatus = window.bookingResponse[dateString];
const dateString = $.datepicker.formatDate("yy-mm-dd", eDate);
const bookingStatus = window.bookingResponse[dateString] || {};
if (eDate < minDate) {
// Dates within the disabled range
const currentDate = new Date();
currentDate.setHours(0, 0, 0, 0); // Normalize current date to midnight
eDate.setHours(0, 0, 0, 0); // Normalize selected date to midnight
// Logic for other dates
if (eDate < currentDate) {
return [false, "highlight-disabled", "Slot not Available"]; return [false, "highlight-disabled", "Slot not Available"];
} }
if (bookingStatus) {
if (bookingStatus[2] === true) {
return [true, "highlight-blue disabled", "GCC Blocked"];
} else if (bookingStatus[3] === true) {
return [true, "highlight-lightpink disabled", "Temporary Blocked"]
}else if (bookingStatus[0] === false && bookingStatus[1] === false) {
return [true, "highlight-greens", "Slot Available"];
} else if (bookingStatus[0] === true && bookingStatus[1] === true) {
return [true, "highlight-pink disabled", "Slot Occupied"];
} else if (bookingStatus[0] === true && bookingStatus[1] === false) {
return [true, "highlight-yellow", "Evening Slot Available"];
} else if (bookingStatus[0] === false && bookingStatus[1] === true) {
return [true, "highlight-violet", "Only Morning Slot Available"];
const isToday = eDate.getTime() === currentDate.getTime();
const currentHour = new Date().getHours();
const isBefore6AM = currentHour < 6;
const isAfter2PM = currentHour >= 14;
// Block 3-day logic for specific event types
const today = new Date();
const blockedDate = new Date(today);
blockedDate.setDate(today.getDate() + 2);
const isThreeDayBlock = ["Commercial", "State Govt Event", "Central Govt Event"].includes(reason);
if (eDate <= blockedDate && isThreeDayBlock) {
return [false, "highlight-disabled", "Blocked due to event type"];
}
// Logic for currentdate
if (isToday) {
if (isBefore6AM) {
// Before 6 AM: Allow full-day booking or adjust based on booking status
return handleBookingStatus(bookingStatus, "Full Day Available");
} else if (isAfter2PM) {
// After 2 PM: Block all bookings
return handleAfter2PM(bookingStatus);
} else {
// Between 6 AM and 2 PM: Check status and disable morning slots
return handleMorningSlots(bookingStatus);
} }
} }
return [true, "highlight-greens", "Slot Available"];
return handleBookingStatus(bookingStatus, "Slot Available");
}, },
}); });
@ -2145,6 +2153,46 @@
var noofdays = document.getElementById("noOfDaysInput").value; var noofdays = document.getElementById("noOfDaysInput").value;
updateEndDate(selectedDate, noofdays, startingSlot, endingSlot); updateEndDate(selectedDate, noofdays, startingSlot, endingSlot);
}); });
}
function handleBookingStatus(bookingStatus, defaultMessage) {
if (bookingStatus[2]) {
return [true, "highlight-blue disabled", "GCC Blocked"];
} else if (bookingStatus[3]) {
return [true, "highlight-lightpink disabled", "Temporary Blocked"];
} else if (bookingStatus[0] && bookingStatus[1]) {
return [true, "highlight-pink disabled", "Slot Occupied"];
} else if (bookingStatus[0] && !bookingStatus[1]) {
return [true, "highlight-yellow", "Evening Slot Available"];
} else if (!bookingStatus[0] && bookingStatus[1]) {
return [true, "highlight-violet", "Only Morning Slot Available"];
}
return [true, "highlight-greens", defaultMessage];
}
// Helper function: Handles logic after 2 PM
function handleAfter2PM(bookingStatus) {
if (bookingStatus[2]) {
return [true, "highlight-blue disabled", "GCC Blocked"];
} else if (bookingStatus[0] || bookingStatus[1]) {
return [true, "highlight-pink disabled", "Slot Occupied"];
}
return [false, "highlight-disabled", "Not Allowed to Book"];
}
// Helper function: Handles morning slots between 6 AM and 2 PM
function handleMorningSlots(bookingStatus) {
if (bookingStatus[2]) {
return [true, "highlight-blue disabled", "GCC Blocked"];
} else if (bookingStatus[0] && bookingStatus[1]) {
return [true, "highlight-pink disabled", "Slot Occupied"];
} else if (bookingStatus[0] && !bookingStatus[1]) {
return [true, "highlight-yellow", "Evening Slot Available"];
} else if (!bookingStatus[0] && bookingStatus[1]) {
return [false, "highlight-disabled", "Slot Occupied"];
}
return [true, "highlight-yellow", "Evening Slot Available"];
} }
function updateEndDate(startDate, noofdays, startingSlot, endingSlot) { function updateEndDate(startDate, noofdays, startingSlot, endingSlot) {

Loading…
Cancel
Save