From 10f911d6a563e7433265bb03a0466000245f2c59 Mon Sep 17 00:00:00 2001 From: kanimozhi <136799210+KaNi-04@users.noreply.github.com> Date: Wed, 23 Jul 2025 10:32:51 +0530 Subject: [PATCH] Counter Report added for Admin login --- .../controller/Admincontroller.java | 17 +- .../controller/OfficerController.java | 900 +++++++++--------- .../controller/UserAPIController.java | 4 +- .../scheduler/PaymentStatusScheduler.java | 4 +- .../repository/BookingDetailsRepository.java | 28 +- .../communityHall/service/BookingService.java | 7 + .../service/Impl/BookingServiceImpl.java | 18 +- .../service/Impl/UserServiceImpl.java | 159 ++-- .../resources/templates/admin/reports.html | 494 +++++++++- .../templates/fragments/Details.html | 3 +- .../templates/fragments/logRegiOtpScript.html | 4 + .../templates/fragments/menuOfficer.html | 4 +- .../headquarters/refund-failedlist.html | 18 +- .../templates/headquarters/reports.html | 31 +- .../resources/templates/user/dashboard.html | 6 +- .../resources/templates/user/viewhistory.html | 11 +- 16 files changed, 1105 insertions(+), 603 deletions(-) diff --git a/src/main/java/com/gcc/communityHall/controller/Admincontroller.java b/src/main/java/com/gcc/communityHall/controller/Admincontroller.java index 550e9699..699d1ed3 100644 --- a/src/main/java/com/gcc/communityHall/controller/Admincontroller.java +++ b/src/main/java/com/gcc/communityHall/controller/Admincontroller.java @@ -13,6 +13,8 @@ import java.util.function.Function; import java.util.function.Predicate; import java.util.stream.Collectors; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; import com.gcc.communityHall.others.AppConfig; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.format.annotation.DateTimeFormat; @@ -564,7 +566,7 @@ public class Admincontroller { @RequestParam(name = "division1", required = false, defaultValue = "ALL") String division, @RequestParam(name = "hall1", required = false, defaultValue = "1000") Integer hallid, @RequestParam(name = "basedon", required = false) String basedon, - @RequestParam(name = "bookingId", required = false) Long bookingId, HttpSession session) { + @RequestParam(name = "bookingId", required = false) Long bookingId, HttpSession session) throws JsonProcessingException { String adminname = (String) session.getAttribute("usertype"); if (adminname != null) { long mobileno = (long) session.getAttribute("mobileno"); @@ -619,6 +621,19 @@ public class Admincontroller { model.addAttribute("totalBookings", totalBookings); List hallbookingList = handleBookingHallDetailsReportRequest(request, fromDate, toDate, filterby, zone, division, hallid); + List counterBookingList = request.equals("9") ? bookingService.getCounterWiseBookingCount(fromDate, toDate) : new ArrayList<>(); + model.addAttribute("counterBookingList",counterBookingList); + System.out.println("counterBookingList.."+counterBookingList); + + List hallBookingByCounter = bookingService.getHallWiseBookingDetails(fromDate, toDate); + // Convert to JSON for JS usage + String hallBookingJson = new ObjectMapper().writeValueAsString(hallBookingByCounter); + model.addAttribute("hallBookingJson", hallBookingJson); + + + List hallBookingDetails = bookingService.getBookingDetailsForAllHalls(fromDate, toDate); + String hallBookingDetailsJson = new ObjectMapper().writeValueAsString(hallBookingDetails); + model.addAttribute("hallBookingDetailsJson", hallBookingDetailsJson); model.addAttribute("filterby", filterby); model.addAttribute("users", userList); diff --git a/src/main/java/com/gcc/communityHall/controller/OfficerController.java b/src/main/java/com/gcc/communityHall/controller/OfficerController.java index 47c7d592..6880b4a9 100644 --- a/src/main/java/com/gcc/communityHall/controller/OfficerController.java +++ b/src/main/java/com/gcc/communityHall/controller/OfficerController.java @@ -35,504 +35,472 @@ import jakarta.servlet.http.HttpSession; @Controller @RequestMapping("/communityhall/officer") public class OfficerController { - @Autowired + @Autowired private AppConfig appConfig; - @Autowired - private BookingDetailsRepository bookingDetailsRepository; - - @Autowired - private PaymentsRepository paymentsRepository; - - @Autowired - private UsersRepository usersRepository; - - @Autowired - private SettlementRepository settlementRepository; - @Autowired - private CounterRefundListRepository counterRefundListRepository; - @Autowired - private BookingService bookingService; - @Autowired - private HallDetailsRepository hallDetailsRepository; - @Autowired - private HallDetailService hallDetailsService; - - - @GetMapping("/login") - public String viewLoginPage(Model model) { - String msg="Login to Your Account"; - model.addAttribute("errortxt",msg); - return "officiallogin"; - } - - @GetMapping("/officer-dashboard") - public String viewDashboard(Model model,HttpSession session) { - String officername = (String) session.getAttribute("usertype"); - if(officername!=null) { - String zone = (String) session.getAttribute("zone"); - model.addAttribute("officername", officername); - long mobileno = (long) session.getAttribute("mobileno"); - model.addAttribute("mobileno", mobileno); - - model.addAttribute("zone", zone); - - return "officer/officer-dashboard"; - }else { - session.invalidate(); - return "redirect:/communityhall/login"; - } - } + @Autowired + private BookingDetailsRepository bookingDetailsRepository; + + @Autowired + private PaymentsRepository paymentsRepository; + + @Autowired + private UsersRepository usersRepository; + + @Autowired + private SettlementRepository settlementRepository; + @Autowired + private CounterRefundListRepository counterRefundListRepository; + @Autowired + private BookingService bookingService; + @Autowired + private HallDetailsRepository hallDetailsRepository; + @Autowired + private HallDetailService hallDetailsService; + + + @GetMapping("/login") + public String viewLoginPage(Model model) { + String msg = "Login to Your Account"; + model.addAttribute("errortxt", msg); + return "officiallogin"; + } + + @GetMapping("/officer-dashboard") + public String viewDashboard(Model model, HttpSession session) { + String officername = (String) session.getAttribute("usertype"); + if (officername != null) { + String zone = (String) session.getAttribute("zone"); + model.addAttribute("officername", officername); + long mobileno = (long) session.getAttribute("mobileno"); + model.addAttribute("mobileno", mobileno); + + model.addAttribute("zone", zone); + + return "officer/officer-dashboard"; + } else { + session.invalidate(); + return "redirect:/communityhall/login"; + } + } @GetMapping("/booking-pending") - public String viewhall(Model model,HttpSession session) { - String officername = (String) session.getAttribute("usertype"); - if(officername!=null) { - model.addAttribute("officername", officername); - long mobileno = (long) session.getAttribute("mobileno"); - model.addAttribute("mobileno", mobileno); - model.addAttribute("title", "pending bookings"); - model.addAttribute("baseURL", appConfig.getBaseUrl()); - String zone = (String) session.getAttribute("zone"); - model.addAttribute("zone", zone); - List pendingbooking=bookingDetailsRepository.getPendingOrPaymentFailureBookings(zone); - model.addAttribute("pendingbooking",pendingbooking); - return "officer/booking-pending"; - }else { - session.invalidate(); - return "redirect:/communityhall/login"; - } -} + public String viewhall(Model model, HttpSession session) { + String officername = (String) session.getAttribute("usertype"); + if (officername != null) { + model.addAttribute("officername", officername); + long mobileno = (long) session.getAttribute("mobileno"); + model.addAttribute("mobileno", mobileno); + model.addAttribute("title", "pending bookings"); + model.addAttribute("baseURL", appConfig.getBaseUrl()); + String zone = (String) session.getAttribute("zone"); + model.addAttribute("zone", zone); + List pendingbooking = bookingDetailsRepository.getPendingOrPaymentFailureBookings(zone); + model.addAttribute("pendingbooking", pendingbooking); + return "officer/booking-pending"; + } else { + session.invalidate(); + return "redirect:/communityhall/login"; + } + } @GetMapping("/payment-list") - public String viewPayment(Model model,HttpSession session){ - String officername = (String) session.getAttribute("usertype"); - if(officername!=null) { - model.addAttribute("officername", officername); - long mobileno = (long) session.getAttribute("mobileno"); - model.addAttribute("mobileno", mobileno); - model.addAttribute("title","paymentlist"); - model.addAttribute("baseURL",appConfig.getBaseUrl()); - String zone = (String) session.getAttribute("zone"); - model.addAttribute("zone", zone); - // System.out.println(zone); - List pay=paymentsRepository.getPaymentListByzone(zone); - model.addAttribute("paymentlist",pay); - return "officer/payment-list"; - }else { - session.invalidate(); - return "redirect:/communityhall/login"; - } + public String viewPayment(Model model, HttpSession session) { + String officername = (String) session.getAttribute("usertype"); + if (officername != null) { + model.addAttribute("officername", officername); + long mobileno = (long) session.getAttribute("mobileno"); + model.addAttribute("mobileno", mobileno); + model.addAttribute("title", "paymentlist"); + model.addAttribute("baseURL", appConfig.getBaseUrl()); + String zone = (String) session.getAttribute("zone"); + model.addAttribute("zone", zone); + // System.out.println(zone); + List pay = paymentsRepository.getPaymentListByzone(zone); + model.addAttribute("paymentlist", pay); + return "officer/payment-list"; + } else { + session.invalidate(); + return "redirect:/communityhall/login"; + } } - + @GetMapping("/bookingwaitinglist") - public String viewWaitingBookings(Model model,HttpSession session) { - String officername = (String) session.getAttribute("usertype"); - if(officername!=null) { - model.addAttribute("officername", officername); - long mobileno = (long) session.getAttribute("mobileno"); - model.addAttribute("mobileno", mobileno); - model.addAttribute("title","bookinglist"); - model.addAttribute("baseURL",appConfig.getBaseUrl()); - String zone = (String) session.getAttribute("zone"); - model.addAttribute("zone", zone); - List bookingList = bookingDetailsRepository.getWaitinglist(zone); - model.addAttribute("bookingList", bookingList); - return "officer/booking-list"; // Assuming "officer/rejected-booking-list" is the name of your HTML template - }else { - session.invalidate(); - return "redirect:/communityhall/login"; - } - } + public String viewWaitingBookings(Model model, HttpSession session) { + String officername = (String) session.getAttribute("usertype"); + if (officername != null) { + model.addAttribute("officername", officername); + long mobileno = (long) session.getAttribute("mobileno"); + model.addAttribute("mobileno", mobileno); + model.addAttribute("title", "bookinglist"); + model.addAttribute("baseURL", appConfig.getBaseUrl()); + String zone = (String) session.getAttribute("zone"); + model.addAttribute("zone", zone); + List bookingList = bookingDetailsRepository.getWaitinglist(zone); + model.addAttribute("bookingList", bookingList); + return "officer/booking-list"; // Assuming "officer/rejected-booking-list" is the name of your HTML template + } else { + session.invalidate(); + return "redirect:/communityhall/login"; + } + } + @GetMapping("/booking-list") - public String viewBookingList(Model model,HttpSession session) { - String officername = (String) session.getAttribute("usertype"); - if(officername!=null) { - model.addAttribute("officername", officername); - long mobileno = (long) session.getAttribute("mobileno"); - model.addAttribute("mobileno", mobileno); - model.addAttribute("title","bookinglist"); - model.addAttribute("baseURL",appConfig.getBaseUrl()); - String zone = (String) session.getAttribute("zone"); - model.addAttribute("zone", zone); - List bookingList = bookingDetailsRepository.getApprovedlist(zone); - model.addAttribute("bookingList", bookingList); - return "officer/booking-list"; // Assuming "officer/rejected-booking-list" is the name of your HTML template - }else { - session.invalidate(); - return "redirect:/communityhall/login"; - } -} + public String viewBookingList(Model model, HttpSession session) { + String officername = (String) session.getAttribute("usertype"); + if (officername != null) { + model.addAttribute("officername", officername); + long mobileno = (long) session.getAttribute("mobileno"); + model.addAttribute("mobileno", mobileno); + model.addAttribute("title", "bookinglist"); + model.addAttribute("baseURL", appConfig.getBaseUrl()); + String zone = (String) session.getAttribute("zone"); + model.addAttribute("zone", zone); + List bookingList = bookingDetailsRepository.getApprovedlist(zone); + model.addAttribute("bookingList", bookingList); + return "officer/booking-list"; // Assuming "officer/rejected-booking-list" is the name of your HTML template + } else { + session.invalidate(); + return "redirect:/communityhall/login"; + } + } @GetMapping("/rejected-list") - public String viewRejectedBookings(Model model,HttpSession session) { - String officername = (String) session.getAttribute("usertype"); - if(officername!=null) { - model.addAttribute("officername", officername); - long mobileno = (long) session.getAttribute("mobileno"); - model.addAttribute("mobileno", mobileno); - model.addAttribute("title","rejectedlist"); - model.addAttribute("baseURL",appConfig.getBaseUrl()); - String zone = (String) session.getAttribute("zone"); - model.addAttribute("zone", zone); - List rejectedBookings = bookingDetailsRepository.getrejectedlist(zone); - model.addAttribute("rejectedBookings", rejectedBookings); - - return "officer/rejected-list"; - }else { - session.invalidate(); - return "redirect:/communityhall/login"; - } + public String viewRejectedBookings(Model model, HttpSession session) { + String officername = (String) session.getAttribute("usertype"); + if (officername != null) { + model.addAttribute("officername", officername); + long mobileno = (long) session.getAttribute("mobileno"); + model.addAttribute("mobileno", mobileno); + model.addAttribute("title", "rejectedlist"); + model.addAttribute("baseURL", appConfig.getBaseUrl()); + String zone = (String) session.getAttribute("zone"); + model.addAttribute("zone", zone); + List rejectedBookings = bookingDetailsRepository.getrejectedlist(zone); + model.addAttribute("rejectedBookings", rejectedBookings); + + return "officer/rejected-list"; + } else { + session.invalidate(); + return "redirect:/communityhall/login"; + } } - + @GetMapping("/settlement-list") - public String settlementPendingList(Model model,HttpSession session) { - String officername = (String) session.getAttribute("usertype"); - if(officername!=null) { - model.addAttribute("officername", officername); - long mobileno = (long) session.getAttribute("mobileno"); - model.addAttribute("mobileno", mobileno); - model.addAttribute("title","settlement Pending"); - model.addAttribute("baseURL",appConfig.getBaseUrl()); - String zone = (String) session.getAttribute("zone"); - model.addAttribute("zone", zone); - List settlement=bookingDetailsRepository.findSettlementPendingByZone(zone); - List cancelledbookings=bookingDetailsRepository.findCancelledListByZone(zone); - List rejectedbookings=bookingDetailsRepository.findRejectedListByZone(zone); - model.addAttribute("settlementlist",settlement); - model.addAttribute("cancelledbookings",cancelledbookings); - model.addAttribute("rejectedbookings",rejectedbookings); - return "officer/settlement-list"; - }else { - session.invalidate(); - return "redirect:/communityhall/login"; - } -} - + public String settlementPendingList(Model model, HttpSession session) { + String officername = (String) session.getAttribute("usertype"); + if (officername != null) { + model.addAttribute("officername", officername); + long mobileno = (long) session.getAttribute("mobileno"); + model.addAttribute("mobileno", mobileno); + model.addAttribute("title", "settlement Pending"); + model.addAttribute("baseURL", appConfig.getBaseUrl()); + String zone = (String) session.getAttribute("zone"); + model.addAttribute("zone", zone); + List settlement = bookingDetailsRepository.findSettlementPendingByZone(zone); + List cancelledbookings = bookingDetailsRepository.findCancelledListByZone(zone); + List rejectedbookings = bookingDetailsRepository.findRejectedListByZone(zone); + model.addAttribute("settlementlist", settlement); + model.addAttribute("cancelledbookings", cancelledbookings); + model.addAttribute("rejectedbookings", rejectedbookings); + return "officer/settlement-list"; + } else { + session.invalidate(); + return "redirect:/communityhall/login"; + } + } + @GetMapping("/refundfailed-list") -public String RefundFailedList(Model model,HttpSession session) { - String officername = (String) session.getAttribute("usertype"); - if(officername!=null) { - model.addAttribute("officername", officername); - long mobileno = (long) session.getAttribute("mobileno"); - model.addAttribute("mobileno", mobileno); - model.addAttribute("title","settlementapproved"); - model.addAttribute("baseURL",appConfig.getBaseUrl()); - String zone = (String) session.getAttribute("zone"); - model.addAttribute("zone", zone); - List settlementrefundfailed=bookingDetailsRepository.findSettlementRefundFailedByZone(zone); - List refundfailedcancelledbookings=bookingDetailsRepository.findRefundFaileCancelledListByZone(zone); - List refundfailedrejectedbookings=bookingDetailsRepository.findRefundFaileRejectedListByZone(zone); - model.addAttribute("settlementrefundfailed",settlementrefundfailed); - model.addAttribute("refundfailedcancelledbookings",refundfailedcancelledbookings); - model.addAttribute("refundfailedrejectedbookings",refundfailedrejectedbookings); - return "officer/refund-failedlist"; -} -else { - session.invalidate(); - return "redirect:/communityhall/login"; -} -} + public String RefundFailedList(Model model, HttpSession session) { + String officername = (String) session.getAttribute("usertype"); + if (officername != null) { + model.addAttribute("officername", officername); + long mobileno = (long) session.getAttribute("mobileno"); + model.addAttribute("mobileno", mobileno); + model.addAttribute("title", "settlementapproved"); + model.addAttribute("baseURL", appConfig.getBaseUrl()); + String zone = (String) session.getAttribute("zone"); + model.addAttribute("zone", zone); + List settlementrefundfailed = bookingDetailsRepository.findSettlementRefundFailedByZone(zone); + List refundfailedcancelledbookings = bookingDetailsRepository.findRefundFaileCancelledListByZone(zone); + List refundfailedrejectedbookings = bookingDetailsRepository.findRefundFaileRejectedListByZone(zone); + model.addAttribute("settlementrefundfailed", settlementrefundfailed); + model.addAttribute("refundfailedcancelledbookings", refundfailedcancelledbookings); + model.addAttribute("refundfailedrejectedbookings", refundfailedrejectedbookings); + return "officer/refund-failedlist"; + } else { + session.invalidate(); + return "redirect:/communityhall/login"; + } + } - @GetMapping("/settlement-approved") - public String settlementApprovedList(Model model,HttpSession session) { - String officername = (String) session.getAttribute("usertype"); - if(officername!=null) { - model.addAttribute("officername", officername); - long mobileno = (long) session.getAttribute("mobileno"); - model.addAttribute("mobileno", mobileno); - model.addAttribute("title","settlementapproved"); - model.addAttribute("baseURL",appConfig.getBaseUrl()); - String zone = (String) session.getAttribute("zone"); - model.addAttribute("zone", zone); - List settlement=bookingDetailsRepository.findSettlementApprovedByZone(zone); - List approvedcancelledbookings=bookingDetailsRepository.findapprovedCancelledListByZone(zone); - List approvedrejectedbookings=bookingDetailsRepository.findapprovedRejectedListByZone(zone); - model.addAttribute("approvedSettlementlist",settlement); - model.addAttribute("approvedcancelledbookings",approvedcancelledbookings); - model.addAttribute("approvedrejectedbookings",approvedrejectedbookings); - return "officer/settlement-approved"; - } - else { - session.invalidate(); - return "redirect:/communityhall/login"; - } - } - -@GetMapping("/settlement-reject") - public String settlementRejectedList(Model model,HttpSession session) { - String officername = (String) session.getAttribute("usertype"); - if(officername!=null) { - model.addAttribute("officername", officername); - long mobileno = (long) session.getAttribute("mobileno"); - model.addAttribute("mobileno", mobileno); - model.addAttribute("title","settlement rejected"); - model.addAttribute("baseURL",appConfig.getBaseUrl()); - String zone = (String) session.getAttribute("zone"); - model.addAttribute("zone", zone); - List settlement=bookingDetailsRepository.findSettlementRejectedByZone(zone); - model.addAttribute("rejectSettlementlist",settlement); - return "officer/settlement-reject"; - }else { - session.invalidate(); - return "redirect:/communityhall/login"; - } - } -@GetMapping("/settlement-completedlist") -public String viewSettlementcompletedMaster(Model model,HttpSession session) { - String officername = (String) session.getAttribute("usertype"); - if(officername != null) { - long mobileno = (long) session.getAttribute("mobileno"); - model.addAttribute("mobileno", mobileno); - String zone = (String) session.getAttribute("zone"); - model.addAttribute("zone", zone); - List completedlist=bookingDetailsRepository.findSettlementCompletedListbyzone(zone); - List cancelledcompletedlist=bookingDetailsRepository.findCancelledCompletedListbyzone(zone); - List rejectedcompletedlist=bookingDetailsRepository.findRejectedSettlementCompletedListbyzone(zone); - model.addAttribute("title","settlement initiate"); - model.addAttribute("officername", officername); - model.addAttribute("completedlist",completedlist); - model.addAttribute("cancelledcompletedlist",cancelledcompletedlist); - model.addAttribute("rejectedcompletedlist",rejectedcompletedlist); - return "officer/settlement-completed"; - }else { - session.invalidate(); // Invalidate the session to clear all session attributes - return "redirect:/communityhall/login"; - } -} -@GetMapping("/reports") -public String viewReports(Model model,HttpSession session) -{ - String officername = (String) session.getAttribute("usertype"); - if(officername!=null) { - String zone = (String) session.getAttribute("zone"); - model.addAttribute("officername", officername); - long mobileno = (long) session.getAttribute("mobileno"); - model.addAttribute("mobileno", mobileno); - model.addAttribute("zone", zone); - List hallnames=hallDetailsService.getHallNames(); - model.addAttribute("hallnames", hallnames); - return "officer/report"; -}else { - session.invalidate(); - return "redirect:/communityhall/login"; - } -} -@GetMapping("/getReport") -public String viewgetReports(Model model,HttpSession session) -{ - String officername = (String) session.getAttribute("usertype"); - if(officername!=null) { - String zone = (String) session.getAttribute("zone"); - model.addAttribute("officername", officername); - long mobileno = (long) session.getAttribute("mobileno"); - model.addAttribute("mobileno", mobileno); - model.addAttribute("zone", zone); - List hallnames=hallDetailsService.getHallNames(); - model.addAttribute("hallnames", hallnames); - return "officer/report"; -}else { - session.invalidate(); - return "redirect:/communityhall/login"; - } -} -@PostMapping("/getReport") -public String generateReport(Model model,HttpSession session, - @RequestParam(name = "FromDate") @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) String fromDate, - @RequestParam(name = "ToDate") @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) String toDate, - @RequestParam(name = "request") String request, - @RequestParam(name = "bookingStatus", required = false) String bookingStatus, - @RequestParam(name = "filterby", required = false) String filterby, - @RequestParam(name = "refundStatus", required = false) String refundStatus, - @RequestParam(name = "hallname", required = false,defaultValue = "0") Integer hallId) { - String officername = (String) session.getAttribute("usertype"); - if(officername!=null) { - String zone = (String) session.getAttribute("zone"); - model.addAttribute("zone", zone); - model.addAttribute("officername", officername); - long mobileno = (long) session.getAttribute("mobileno"); - model.addAttribute("mobileno", mobileno); - List hallnames=hallDetailsService.getHallNamesbyzone(zone); - model.addAttribute("hallnames", hallnames); - List bookingList = handleBookingRequest(request, fromDate, toDate, bookingStatus,zone,filterby); - List bookingSettlementList = handleBookingSettlementRequest(request, fromDate, toDate, refundStatus,zone,filterby); - List paymentList = request.equals("3") ? bookingService.getAllPaymentsDetailsByZone(fromDate, toDate,zone) : new ArrayList<>(); - List hallbookingList= handleHallBookingRequest(request, fromDate, toDate,zone,hallId,filterby); - model.addAttribute("bookings", bookingList); - model.addAttribute("bookingSettlementList", bookingSettlementList); - model.addAttribute("bookingStatus", bookingStatus); - model.addAttribute("refundStatus", refundStatus); - model.addAttribute("fromdate", fromDate); - model.addAttribute("todate", toDate); - model.addAttribute("request", request); - model.addAttribute("filterby", filterby); - model.addAttribute("paymentLists", paymentList); - model.addAttribute("hallbookingLists", hallbookingList); - - return "officer/report"; -}else { - session.invalidate(); - return "redirect:/communityhall/login"; -} -} + @GetMapping("/settlement-approved") + public String settlementApprovedList(Model model, HttpSession session) { + String officername = (String) session.getAttribute("usertype"); + if (officername != null) { + model.addAttribute("officername", officername); + long mobileno = (long) session.getAttribute("mobileno"); + model.addAttribute("mobileno", mobileno); + model.addAttribute("title", "settlementapproved"); + model.addAttribute("baseURL", appConfig.getBaseUrl()); + String zone = (String) session.getAttribute("zone"); + model.addAttribute("zone", zone); + List settlement = bookingDetailsRepository.findSettlementApprovedByZone(zone); + List approvedcancelledbookings = bookingDetailsRepository.findapprovedCancelledListByZone(zone); + List approvedrejectedbookings = bookingDetailsRepository.findapprovedRejectedListByZone(zone); + model.addAttribute("approvedSettlementlist", settlement); + model.addAttribute("approvedcancelledbookings", approvedcancelledbookings); + model.addAttribute("approvedrejectedbookings", approvedrejectedbookings); + return "officer/settlement-approved"; + } else { + session.invalidate(); + return "redirect:/communityhall/login"; + } + } + @GetMapping("/settlement-reject") + public String settlementRejectedList(Model model, HttpSession session) { + String officername = (String) session.getAttribute("usertype"); + if (officername != null) { + model.addAttribute("officername", officername); + long mobileno = (long) session.getAttribute("mobileno"); + model.addAttribute("mobileno", mobileno); + model.addAttribute("title", "settlement rejected"); + model.addAttribute("baseURL", appConfig.getBaseUrl()); + String zone = (String) session.getAttribute("zone"); + model.addAttribute("zone", zone); + List settlement = bookingDetailsRepository.findSettlementRejectedByZone(zone); + model.addAttribute("rejectSettlementlist", settlement); + return "officer/settlement-reject"; + } else { + session.invalidate(); + return "redirect:/communityhall/login"; + } + } -private List handleBookingRequest(String request, String fromDate, String toDate, String bookingStatus,String zone,String filterby) { - if (!request.equals("1")) { - return new ArrayList<>(); + @GetMapping("/settlement-completedlist") + public String viewSettlementcompletedMaster(Model model, HttpSession session) { + String officername = (String) session.getAttribute("usertype"); + if (officername != null) { + long mobileno = (long) session.getAttribute("mobileno"); + model.addAttribute("mobileno", mobileno); + String zone = (String) session.getAttribute("zone"); + model.addAttribute("zone", zone); + List completedlist = bookingDetailsRepository.findSettlementCompletedListbyzone(zone); + List cancelledcompletedlist = bookingDetailsRepository.findCancelledCompletedListbyzone(zone); + List rejectedcompletedlist = bookingDetailsRepository.findRejectedSettlementCompletedListbyzone(zone); + model.addAttribute("title", "settlement initiate"); + model.addAttribute("officername", officername); + model.addAttribute("completedlist", completedlist); + model.addAttribute("cancelledcompletedlist", cancelledcompletedlist); + model.addAttribute("rejectedcompletedlist", rejectedcompletedlist); + return "officer/settlement-completed"; + } else { + session.invalidate(); // Invalidate the session to clear all session attributes + return "redirect:/communityhall/login"; + } } - if (bookingStatus.isEmpty() && filterby.isEmpty()) { - return bookingService.getAllBookingDetailsBookingDateByZone(fromDate, toDate, zone); + + @GetMapping("/reports") + public String viewReports(Model model, HttpSession session) { + String officername = (String) session.getAttribute("usertype"); + if (officername != null) { + String zone = (String) session.getAttribute("zone"); + model.addAttribute("officername", officername); + long mobileno = (long) session.getAttribute("mobileno"); + model.addAttribute("mobileno", mobileno); + model.addAttribute("zone", zone); + List hallnames = hallDetailsService.getHallNames(); + model.addAttribute("hallnames", hallnames); + return "officer/report"; + } else { + session.invalidate(); + return "redirect:/communityhall/login"; + } } - if(filterby.isEmpty() && !bookingStatus.isEmpty()) - { - return bookingService.getAllBookingDetailsBookingDateByZoneWithStatus(fromDate, toDate, zone, bookingStatus); + + @GetMapping("/getReport") + public String viewgetReports(Model model, HttpSession session) { + String officername = (String) session.getAttribute("usertype"); + if (officername != null) { + String zone = (String) session.getAttribute("zone"); + model.addAttribute("officername", officername); + long mobileno = (long) session.getAttribute("mobileno"); + model.addAttribute("mobileno", mobileno); + model.addAttribute("zone", zone); + List hallnames = hallDetailsService.getHallNames(); + model.addAttribute("hallnames", hallnames); + return "officer/report"; + } else { + session.invalidate(); + return "redirect:/communityhall/login"; + } } - if(!filterby.isEmpty()) - { - - if ("1".equals(filterby)) - { - if(bookingStatus.isEmpty()) - { - return bookingService.getAllBookingDetailsBookingDateByZone(fromDate, toDate, zone); - } - else - { - return bookingService.getAllBookingDetailsBookingDateByZoneWithStatus(fromDate, toDate, zone, bookingStatus); - - } - - } - if ("2".equals(filterby)) - { - if(bookingStatus.isEmpty()) - { - return bookingService.getAllBookingDetailsEventDateByZone(fromDate, toDate, zone); - } - else - { - return bookingService.getAllBookingDetailsEventDateByZoneWithStatus(fromDate, toDate, zone, bookingStatus); - } - + + @PostMapping("/getReport") + public String generateReport(Model model, HttpSession session, + @RequestParam(name = "FromDate") @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) String fromDate, + @RequestParam(name = "ToDate") @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) String toDate, + @RequestParam(name = "request") String request, + @RequestParam(name = "bookingStatus", required = false) String bookingStatus, + @RequestParam(name = "filterby", required = false) String filterby, + @RequestParam(name = "refundStatus", required = false) String refundStatus, + @RequestParam(name = "hallname", required = false, defaultValue = "0") Integer hallId) { + String officername = (String) session.getAttribute("usertype"); + if (officername != null) { + String zone = (String) session.getAttribute("zone"); + model.addAttribute("zone", zone); + model.addAttribute("officername", officername); + long mobileno = (long) session.getAttribute("mobileno"); + model.addAttribute("mobileno", mobileno); + List hallnames = hallDetailsService.getHallNamesbyzone(zone); + model.addAttribute("hallnames", hallnames); + List bookingList = handleBookingRequest(request, fromDate, toDate, bookingStatus, zone, filterby); + List bookingSettlementList = handleBookingSettlementRequest(request, fromDate, toDate, refundStatus, zone, filterby); + List paymentList = request.equals("3") ? bookingService.getAllPaymentsDetailsByZone(fromDate, toDate, zone) : new ArrayList<>(); + List hallbookingList = handleHallBookingRequest(request, fromDate, toDate, zone, hallId, filterby); + model.addAttribute("bookings", bookingList); + model.addAttribute("bookingSettlementList", bookingSettlementList); + model.addAttribute("bookingStatus", bookingStatus); + model.addAttribute("refundStatus", refundStatus); + model.addAttribute("fromdate", fromDate); + model.addAttribute("todate", toDate); + model.addAttribute("request", request); + model.addAttribute("filterby", filterby); + model.addAttribute("paymentLists", paymentList); + model.addAttribute("hallbookingLists", hallbookingList); + + return "officer/report"; + } else { + session.invalidate(); + return "redirect:/communityhall/login"; } } - - return new ArrayList<>(); -} -private List handleBookingSettlementRequest(String request, String fromDate, String toDate, String refundStatus,String zone,String filterby) { - if (!request.equals("2")) { + + + private List handleBookingRequest(String request, String fromDate, String toDate, String bookingStatus, String zone, String filterby) { + if (!request.equals("1")) { + return new ArrayList<>(); + } + if (bookingStatus.isEmpty() && filterby.isEmpty()) { + return bookingService.getAllBookingDetailsBookingDateByZone(fromDate, toDate, zone); + } + if (filterby.isEmpty() && !bookingStatus.isEmpty()) { + return bookingService.getAllBookingDetailsBookingDateByZoneWithStatus(fromDate, toDate, zone, bookingStatus); + } + if (!filterby.isEmpty()) { + + if ("1".equals(filterby)) { + if (bookingStatus.isEmpty()) { + return bookingService.getAllBookingDetailsBookingDateByZone(fromDate, toDate, zone); + } else { + return bookingService.getAllBookingDetailsBookingDateByZoneWithStatus(fromDate, toDate, zone, bookingStatus); + + } + + } + if ("2".equals(filterby)) { + if (bookingStatus.isEmpty()) { + return bookingService.getAllBookingDetailsEventDateByZone(fromDate, toDate, zone); + } else { + return bookingService.getAllBookingDetailsEventDateByZoneWithStatus(fromDate, toDate, zone, bookingStatus); + } + + } + } + return new ArrayList<>(); } - if ((refundStatus == null || refundStatus.isEmpty()) && filterby.isEmpty()) - { - return bookingService.getAllBookingsettlementDetailsByZoneByBookingDate(fromDate, toDate, zone); - } - if ((refundStatus != null && !refundStatus.isEmpty()) && filterby.isEmpty()) - { - return bookingService.getAllBookingsettlementDetailsByZoneByBookingDateWithStatus(fromDate, toDate, zone, refundStatus); + + private List handleBookingSettlementRequest(String request, String fromDate, String toDate, String refundStatus, String zone, String filterby) { + if (!request.equals("2")) { + return new ArrayList<>(); + } + if ((refundStatus == null || refundStatus.isEmpty()) && filterby.isEmpty()) { + return bookingService.getAllBookingsettlementDetailsByZoneByBookingDate(fromDate, toDate, zone); + } + if ((refundStatus != null && !refundStatus.isEmpty()) && filterby.isEmpty()) { + return bookingService.getAllBookingsettlementDetailsByZoneByBookingDateWithStatus(fromDate, toDate, zone, refundStatus); + } + if (!filterby.isEmpty()) { + + if ("1".equals(filterby)) { + if (refundStatus.isEmpty() || refundStatus == null) { + return bookingService.getAllBookingsettlementDetailsByZoneByBookingDate(fromDate, toDate, zone); + } else { + return bookingService.getAllBookingsettlementDetailsByZoneByBookingDateWithStatus(fromDate, toDate, zone, refundStatus); + } + + } + if ("2".equals(filterby)) { + if (refundStatus.isEmpty() || refundStatus == null) { + return bookingService.getAllBookingsettlementDetailsByZoneByEventDate(fromDate, toDate, zone); + } else { + return bookingService.getAllBookingsettlementDetailsByZoneByEventDateWithStatus(fromDate, toDate, zone, refundStatus); + } + + } + } + + + return new ArrayList<>(); + } - if(!filterby.isEmpty()) - { - - if ("1".equals(filterby)) - { - if(refundStatus.isEmpty() || refundStatus==null) - { - return bookingService.getAllBookingsettlementDetailsByZoneByBookingDate(fromDate, toDate, zone); - } - else - { - return bookingService.getAllBookingsettlementDetailsByZoneByBookingDateWithStatus(fromDate, toDate, zone, refundStatus); - } - - } - if ("2".equals(filterby)) - { - if(refundStatus.isEmpty() || refundStatus==null) - { - return bookingService.getAllBookingsettlementDetailsByZoneByEventDate(fromDate, toDate, zone); - } - else - { - return bookingService.getAllBookingsettlementDetailsByZoneByEventDateWithStatus(fromDate, toDate, zone, refundStatus); - } - + + private List handleHallBookingRequest(String request, String fromDate, String toDate, String zone, Integer hallId, String filterby) { + if (!request.equals("4")) { + return new ArrayList<>(); + } + if (filterby.isEmpty() && hallId == 0) { + return bookingService.getBookingHallDetailsReportByZoneByBookingDate(fromDate, toDate, zone); + } + if (filterby.isEmpty() && hallId != 0) { + return bookingService.getBookingHallDetailsReportByZoneByBookingDateHallname(fromDate, toDate, zone, hallId); } + if (!filterby.isEmpty()) { + if ("1".equals(filterby)) { + if (hallId != 0) { + return bookingService.getBookingHallDetailsReportByZoneByBookingDateHallname(fromDate, toDate, zone, hallId); + } else { + return bookingService.getBookingHallDetailsReportByZoneByBookingDate(fromDate, toDate, zone); + } + } + if ("2".equals(filterby)) { + if (hallId != 0) { + return bookingService.getBookingHallDetailsReportByZoneByEventDateHallname(fromDate, toDate, zone, hallId); + } else { + return bookingService.getBookingHallDetailsReportByZoneByEventDate(fromDate, toDate, zone); + } + } + } + return new ArrayList<>(); } - - - return new ArrayList<>(); - -} -private List handleHallBookingRequest(String request, String fromDate, String toDate, String zone,Integer hallId,String filterby){ - if(!request.equals("4")) { - return new ArrayList<>(); - } - if(filterby.isEmpty() && hallId==0) - { - return bookingService.getBookingHallDetailsReportByZoneByBookingDate(fromDate, toDate, zone); - } - if(filterby.isEmpty() && hallId!=0) - { - return bookingService.getBookingHallDetailsReportByZoneByBookingDateHallname(fromDate, toDate, zone, hallId); - } - if(!filterby.isEmpty()) - { - if("1".equals(filterby) ) - - { - if(hallId != 0) - { - return bookingService.getBookingHallDetailsReportByZoneByBookingDateHallname(fromDate, toDate, zone, hallId); - } - else - { - return bookingService.getBookingHallDetailsReportByZoneByBookingDate(fromDate, toDate, zone); - } - } - if("2".equals(filterby) ) - - { - if(hallId != 0) - { - return bookingService.getBookingHallDetailsReportByZoneByEventDateHallname(fromDate, toDate, zone, hallId); - } - else - { - return bookingService.getBookingHallDetailsReportByZoneByEventDate(fromDate, toDate, zone); - } - } - } - return new ArrayList<>(); -} + @GetMapping("/counter-refund") + public String counterRefundList(Model model, HttpSession session) { + String officername = (String) session.getAttribute("usertype"); + if (officername != null) { + model.addAttribute("officername", officername); + long mobileno = (long) session.getAttribute("mobileno"); + model.addAttribute("mobileno", mobileno); + model.addAttribute("title", "settlement rejected"); + model.addAttribute("baseURL", appConfig.getBaseUrl()); + String zone = (String) session.getAttribute("zone"); + model.addAttribute("zone", zone); + List counterRefund = counterRefundListRepository.findCounterRefundList(zone); + model.addAttribute("counterRefund", counterRefund); + return "officer/counter-refund"; + } else { + session.invalidate(); + return "redirect:/communityhall/login"; + } + } -@GetMapping("/counter-refund") -public String counterRefundList(Model model,HttpSession session) { - String officername = (String) session.getAttribute("usertype"); - if(officername!=null) { - model.addAttribute("officername", officername); - long mobileno = (long) session.getAttribute("mobileno"); - model.addAttribute("mobileno", mobileno); - model.addAttribute("title","settlement rejected"); - model.addAttribute("baseURL",appConfig.getBaseUrl()); - String zone = (String) session.getAttribute("zone"); - model.addAttribute("zone", zone); - List counterRefund=counterRefundListRepository.findCounterRefundList(zone); - model.addAttribute("counterRefund",counterRefund); - return "officer/counter-refund"; -}else { - session.invalidate(); - return "redirect:/communityhall/login"; - } -} - @GetMapping("/logout") - public String viewLogout(Model model,HttpSession session) { - session.invalidate(); + public String viewLogout(Model model, HttpSession session) { + session.invalidate(); return "redirect:/communityhall/login"; } } diff --git a/src/main/java/com/gcc/communityHall/controller/UserAPIController.java b/src/main/java/com/gcc/communityHall/controller/UserAPIController.java index f4b27da7..ddf4e138 100644 --- a/src/main/java/com/gcc/communityHall/controller/UserAPIController.java +++ b/src/main/java/com/gcc/communityHall/controller/UserAPIController.java @@ -745,9 +745,9 @@ public class UserAPIController { LocalDateTime rescheduledUpdatedDate = null; BookingDetails bookingDetails = bookingService.getBookingsById(bookingId); - if (bookingDetails.getComments().equals( "slots Resheduled the Dates")) { + /*if (bookingDetails.getComments().equals("slots Resheduled the Dates")) { rescheduledUpdatedDate = LocalDateTime.parse(bookingDetails.getUpdatedDate()); - } /*else if(bookingDetails.getScheduleCount()==1){ + } else if(bookingDetails.getScheduleCount()==1){ List histories = bookingDetails.getBookingHistories(); if (histories != null && !histories.isEmpty()) { diff --git a/src/main/java/com/gcc/communityHall/paymentService/scheduler/PaymentStatusScheduler.java b/src/main/java/com/gcc/communityHall/paymentService/scheduler/PaymentStatusScheduler.java index d54d27f6..e230f8ad 100644 --- a/src/main/java/com/gcc/communityHall/paymentService/scheduler/PaymentStatusScheduler.java +++ b/src/main/java/com/gcc/communityHall/paymentService/scheduler/PaymentStatusScheduler.java @@ -1,4 +1,3 @@ -/* package com.gcc.communityHall.paymentService.scheduler; // Import necessary packages @@ -36,7 +35,7 @@ import java.time.LocalDate; import java.util.*; @Component -@EnableScheduling +//@EnableScheduling public class PaymentStatusScheduler { @Autowired @@ -347,4 +346,3 @@ public class PaymentStatusScheduler { -*/ diff --git a/src/main/java/com/gcc/communityHall/repository/BookingDetailsRepository.java b/src/main/java/com/gcc/communityHall/repository/BookingDetailsRepository.java index 530ff4c5..e89b74f6 100644 --- a/src/main/java/com/gcc/communityHall/repository/BookingDetailsRepository.java +++ b/src/main/java/com/gcc/communityHall/repository/BookingDetailsRepository.java @@ -1257,7 +1257,7 @@ public interface BookingDetailsRepository extends JpaRepository getAllwaitingNOC(); + + @Query(value = "SELECT bd.counter_id, COUNT(*) AS total_count " + + "FROM booking_details bd " + + "WHERE DATE(bd.booking_date) BETWEEN :fromDate AND :toDate " + + "AND bd.counter_id IS NOT NULL " + + "GROUP BY bd.counter_id", nativeQuery = true) + List getCounterWiseBookingCount(@Param("fromDate") String fromDate, @Param("toDate") String toDate); + + @Query(value = "SELECT bd.counter_id, h.zone, h. division, h.hall_name, COUNT(*) as total_bookings " + + "FROM booking_details bd " + + "JOIN hall_details h ON h.hall_id = bd.hall_details_hall_id " + + "WHERE DATE(bd.booking_date) BETWEEN :fromDate AND :toDate " + + "AND bd.counter_id IS NOT NULL " + + "GROUP BY bd.counter_id,h.zone, h. division, h.hall_name", nativeQuery = true) + List getHallWiseBookingDetails(@Param("fromDate") String fromDate, @Param("toDate") String toDate); + + @Query(value = "SELECT bd.booking_id,h.hall_name, bd.booking_date, bd.start_date, bd.end_date," + + "bd.starting_slot,bd.ending_slot,bd.no_of_days,bd.reason,bd.amount_received, " + + "bd.hall_amount,bd.deposit_amount,bd.gst, " + + "bd.booking_status,bd.booking_type " + + "FROM booking_details bd " + + "JOIN hall_details h ON h.hall_id = bd.hall_details_hall_id " + + "WHERE DATE(bd.booking_date) BETWEEN :fromDate AND :toDate " + + "AND bd.counter_id IS NOT NULL", nativeQuery = true) + List getBookingDetailsForAllHalls(@Param("fromDate") String fromDate, @Param("toDate") String toDate); + } diff --git a/src/main/java/com/gcc/communityHall/service/BookingService.java b/src/main/java/com/gcc/communityHall/service/BookingService.java index 68337aad..c236e4d6 100644 --- a/src/main/java/com/gcc/communityHall/service/BookingService.java +++ b/src/main/java/com/gcc/communityHall/service/BookingService.java @@ -204,4 +204,11 @@ public interface BookingService { List getBookingsByDateAndHall(String bookingDate, Long hallId); BookingDetails updateRefundStatusScheduler(int bookingId, RefundStatus status); + + List getCounterWiseBookingCount(String fromDate, String toDate); + + List getHallWiseBookingDetails(String fromDate, String toDate); + + List getBookingDetailsForAllHalls(String fromDate, String toDate); + } diff --git a/src/main/java/com/gcc/communityHall/service/Impl/BookingServiceImpl.java b/src/main/java/com/gcc/communityHall/service/Impl/BookingServiceImpl.java index 0a82dd53..51e24f66 100644 --- a/src/main/java/com/gcc/communityHall/service/Impl/BookingServiceImpl.java +++ b/src/main/java/com/gcc/communityHall/service/Impl/BookingServiceImpl.java @@ -631,6 +631,8 @@ public class BookingServiceImpl implements BookingService { Integer userId = userSession.getUserId(); String counterId = userSession.getCounter(); + System.out.println("counterId.."+counterId); + ReasonMaster reasonMaster = reasonMasterService.getReasonById(Integer.parseInt(formData.get("reasonId").toString())); HallDetails hallDetails = hallDetailService.getHallById(Integer.parseInt(formData.get("hallId").toString())); Users user = userService.getUserById(userId); @@ -1616,7 +1618,7 @@ public class BookingServiceImpl implements BookingService { bookingHistory.setBookingStatus(book.getBookingStatus()); bookingHistory.setUpdatedBy(adminname); bookingHistory.setCdate(new Date()); - bookingHistory.setRefundStatus(book.getRefundStatus()); + bookingHistory.setRefundStatus(book.getRefundStatus()); bookingHistoryRepository.save(bookingHistory); book.setComments("Refund status Updated to:-" + status); @@ -2446,5 +2448,19 @@ public class BookingServiceImpl implements BookingService { return null; } + @Override + public List getCounterWiseBookingCount(String fromDate, String toDate) { + return bookingDetailsRepository.getCounterWiseBookingCount(fromDate, toDate); + } + + @Override + public List getHallWiseBookingDetails(String fromDate, String toDate) { + return bookingDetailsRepository.getHallWiseBookingDetails(fromDate, toDate); + } + + @Override + public List getBookingDetailsForAllHalls(String fromDate, String toDate){ + return bookingDetailsRepository.getBookingDetailsForAllHalls(fromDate,toDate); + } } diff --git a/src/main/java/com/gcc/communityHall/service/Impl/UserServiceImpl.java b/src/main/java/com/gcc/communityHall/service/Impl/UserServiceImpl.java index ab1b987a..ce8e1a41 100644 --- a/src/main/java/com/gcc/communityHall/service/Impl/UserServiceImpl.java +++ b/src/main/java/com/gcc/communityHall/service/Impl/UserServiceImpl.java @@ -34,12 +34,11 @@ import jakarta.servlet.http.HttpSession; @Service public class UserServiceImpl implements UserService { - - + @Autowired UsersRepository usersRepository; - + @Autowired private CounsellorDetailsRepository counsellorDetailsRepository; @Autowired @@ -51,30 +50,31 @@ public class UserServiceImpl implements UserService { @PersistenceContext private EntityManager entityManager; - + @Value("${file.upload.directory}") - private String uploadDirectory; - @Value("${file.fullpath}") - private String serverPath; - + private String uploadDirectory; + @Value("${file.fullpath}") + private String serverPath; + @Override @Transactional public void approveUser(int userId) { entityManager.createQuery("UPDATE Users u SET u.userstatus = 'APPROVED' WHERE u.userId = :userId AND u.userstatus = 'PENDING'") - .setParameter("userId", userId) - .executeUpdate(); + .setParameter("userId", userId) + .executeUpdate(); } @Autowired UserHistoryRepository userHistoryRepository; - public UserServiceImpl(UsersRepository userRepo){ - this.usersRepository=userRepo; + + public UserServiceImpl(UsersRepository userRepo) { + this.usersRepository = userRepo; } - public UserServiceImpl(){ + public UserServiceImpl() { } - + @Override public Users user(Users user) { if (user.getUsertype() == null || !user.getUsertype().equals(Users.userType.PUBLIC)) { @@ -105,8 +105,8 @@ public class UserServiceImpl implements UserService { @Override public Users getUserById(int userId) { - Optional user= usersRepository.findById(userId); - if(user.isPresent()){ + Optional user = usersRepository.findById(userId); + if (user.isPresent()) { return user.get(); } return null; @@ -124,10 +124,10 @@ public class UserServiceImpl implements UserService { @Override public Users updateUserStatus(int userId, Users.userStatus status, String comments) { - Optional user= usersRepository.findById(userId); + Optional user = usersRepository.findById(userId); String adminname = (String) session.getAttribute("usertype"); Integer loginid = (Integer) session.getAttribute("id"); - if(user.isPresent()){ + if (user.isPresent()) { Users usr = user.get(); UserHistory userHistory = new UserHistory(); @@ -141,23 +141,23 @@ public class UserServiceImpl implements UserService { usr.setUserstatus(status); usr.setUpdatedBy(adminname); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); - String formattedDate = LocalDateTime.now().format(formatter); + String formattedDate = LocalDateTime.now().format(formatter); usr.setUpdatedDate(formattedDate); - Users users = usersRepository.save(usr); - ApplicationLogs logs=new ApplicationLogs(); - logs.setComments("Action by "+adminname); - logs.setLoginId(loginid); - logs.setLogType("User Status:-"+status.toString()); - InetAddress inetAddress; - try { - inetAddress = InetAddress.getLocalHost(); - String hostname = InetAddress.getLocalHost().getHostName(); - logs.setIpaddress(inetAddress.getHostAddress()); - logs.setSystemName(hostname); - } catch (UnknownHostException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + Users users = usersRepository.save(usr); + ApplicationLogs logs = new ApplicationLogs(); + logs.setComments("Action by " + adminname); + logs.setLoginId(loginid); + logs.setLogType("User Status:-" + status.toString()); + InetAddress inetAddress; + try { + inetAddress = InetAddress.getLocalHost(); + String hostname = InetAddress.getLocalHost().getHostName(); + logs.setIpaddress(inetAddress.getHostAddress()); + logs.setSystemName(hostname); + } catch (UnknownHostException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } applicationLogsRepository.save(logs); return users; @@ -165,36 +165,37 @@ public class UserServiceImpl implements UserService { } return null; } - @Override - public Users findByMobileno(Long mobileNo) { - // TODO Auto-generated method stub - return usersRepository.findByMobileNo(mobileNo); - } -//yoga - @Override - public List getAllUsers(String fromDate, String toDate) - { + + @Override + public Users findByMobileno(Long mobileNo) { + // TODO Auto-generated method stub + return usersRepository.findByMobileNo(mobileNo); + } + + //yoga + @Override + public List getAllUsers(String fromDate, String toDate) { return usersRepository.getAllUsers(fromDate, toDate); - } + } - @Override + @Override public List getAllUsersWithFilters(String fromDate, String toDate, String userStatus, String userType) { return usersRepository.getAllUsersWithFilters(fromDate, toDate, userStatus, userType); } - @Override - public List getAllUsersWithStatusFilters(String fromDate, String toDate, String userStatus) { - - return usersRepository.getAllUsersWithStatusFilters(fromDate, toDate, userStatus); - } + @Override + public List getAllUsersWithStatusFilters(String fromDate, String toDate, String userStatus) { - @Override - public List getAllUsersWithTypeFilters(String fromDate, String toDate, String userType) { - - return usersRepository.getAllUsersWithTypeFilters(fromDate, toDate, userType); - } + return usersRepository.getAllUsersWithStatusFilters(fromDate, toDate, userStatus); + } + + @Override + public List getAllUsersWithTypeFilters(String fromDate, String toDate, String userType) { + + return usersRepository.getAllUsersWithTypeFilters(fromDate, toDate, userType); + } public void updateProfile(Users userProfileRequest) { @@ -211,10 +212,10 @@ public class UserServiceImpl implements UserService { user.setEmail(userProfileRequest.getDoorNo()); usersRepository.save(user); } else { - System.out.println("User with ID " + userProfileRequest.getUserId() + " not found"); + System.out.println("User with ID " + userProfileRequest.getUserId() + " not found"); } } - + @Override public String updateUserDetails(Users userDetails) { Users existingUser = usersRepository.findById(userDetails.getUserId()).orElse(null); @@ -246,25 +247,27 @@ public class UserServiceImpl implements UserService { } - @Override - public void saveUsers(Users user) { - // TODO Auto-generated method stub - - } - public Counsellordetails findByMobile(long mobileno) { - return counsellorDetailsRepository.findByMobile(mobileno); - } - @Override - public Users getUserDetailsByMobileNo(long mobileNo) { - return usersRepository.findByMobileNo(mobileNo); - } - - public void toggleUserStatus(Integer userId, boolean active) { - Optional optionalUser = usersRepository.findById(userId); - if (optionalUser.isPresent()) { - Users user = optionalUser.get(); - user.setActive(active); - usersRepository.save(user); - } - } + @Override + public void saveUsers(Users user) { + // TODO Auto-generated method stub + + } + + public Counsellordetails findByMobile(long mobileno) { + return counsellorDetailsRepository.findByMobile(mobileno); + } + + @Override + public Users getUserDetailsByMobileNo(long mobileNo) { + return usersRepository.findByMobileNo(mobileNo); + } + + public void toggleUserStatus(Integer userId, boolean active) { + Optional optionalUser = usersRepository.findById(userId); + if (optionalUser.isPresent()) { + Users user = optionalUser.get(); + user.setActive(active); + usersRepository.save(user); + } + } } \ No newline at end of file diff --git a/src/main/resources/templates/admin/reports.html b/src/main/resources/templates/admin/reports.html index fff88ecb..71e8aa28 100644 --- a/src/main/resources/templates/admin/reports.html +++ b/src/main/resources/templates/admin/reports.html @@ -52,6 +52,21 @@ .hidden { display: none; } + + .modal-fullscreen-custom { + max-width: 98% !important; + width: 98%; + margin: 0 auto; + } + + /* Ensure second modal is on top of the first modal */ + .modal-backdrop.show:nth-of-type(2) { + z-index: 1055 !important; /* slightly above the first modal */ + } + + #showBookingDetails.modal { + z-index: 1060 !important; /* higher than .modal-backdrop */ + } @@ -111,8 +126,24 @@ + + + + - -

@@ -312,7 +331,6 @@ Address UserType UserStatus - @@ -600,7 +618,36 @@
- + +
+ + + + + + + + + + + + + + + +
S.NoCounter IDTotal Bookings
+ +
+
@@ -877,7 +924,7 @@ - + -->
- -
- -
+ +
+ +
@@ -1247,7 +1294,91 @@ + + + + +
@@ -1259,7 +1390,7 @@ diff --git a/src/main/resources/templates/fragments/Details.html b/src/main/resources/templates/fragments/Details.html index 2d722e9d..37e6268b 100644 --- a/src/main/resources/templates/fragments/Details.html +++ b/src/main/resources/templates/fragments/Details.html @@ -141,8 +141,7 @@ Booking Status: FAILURE

Refund Status: - Refund has to be initiated. Please contact - admin. + Refund has to be initiated.

diff --git a/src/main/resources/templates/fragments/logRegiOtpScript.html b/src/main/resources/templates/fragments/logRegiOtpScript.html index 1235c2dd..d5b1e20d 100644 --- a/src/main/resources/templates/fragments/logRegiOtpScript.html +++ b/src/main/resources/templates/fragments/logRegiOtpScript.html @@ -1141,11 +1141,15 @@ $('#cloginModal').on('shown.bs.modal', function () { $('#cusername').val(''); $('#cpassword').val(''); + // $("#error").text("").removeClass("text-danger"); }); // Unbind the modal shown event after it has been triggered once $('#cloginModal').one('hide.bs.modal', function () { $('#cloginModal').off('shown.bs.modal'); // Unbind the shown.bs.modal event + $("#error").text(""); + $('#cusername').val(''); + $('#cpassword').val(''); }); } diff --git a/src/main/resources/templates/fragments/menuOfficer.html b/src/main/resources/templates/fragments/menuOfficer.html index f33a7fc1..b16f5c99 100644 --- a/src/main/resources/templates/fragments/menuOfficer.html +++ b/src/main/resources/templates/fragments/menuOfficer.html @@ -24,12 +24,12 @@ Settlement Pending List -