Browse Source

Counter Report added for Admin login

master
kanimozhi 1 year ago
parent
commit
10f911d6a5
  1. 17
      src/main/java/com/gcc/communityHall/controller/Admincontroller.java
  2. 106
      src/main/java/com/gcc/communityHall/controller/OfficerController.java
  3. 4
      src/main/java/com/gcc/communityHall/controller/UserAPIController.java
  4. 4
      src/main/java/com/gcc/communityHall/paymentService/scheduler/PaymentStatusScheduler.java
  5. 26
      src/main/java/com/gcc/communityHall/repository/BookingDetailsRepository.java
  6. 7
      src/main/java/com/gcc/communityHall/service/BookingService.java
  7. 16
      src/main/java/com/gcc/communityHall/service/Impl/BookingServiceImpl.java
  8. 9
      src/main/java/com/gcc/communityHall/service/Impl/UserServiceImpl.java
  9. 476
      src/main/resources/templates/admin/reports.html
  10. 3
      src/main/resources/templates/fragments/Details.html
  11. 4
      src/main/resources/templates/fragments/logRegiOtpScript.html
  12. 4
      src/main/resources/templates/fragments/menuOfficer.html
  13. 18
      src/main/resources/templates/headquarters/refund-failedlist.html
  14. 31
      src/main/resources/templates/headquarters/reports.html
  15. 6
      src/main/resources/templates/user/dashboard.html
  16. 11
      src/main/resources/templates/user/viewhistory.html

17
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<Object[]> hallbookingList = handleBookingHallDetailsReportRequest(request, fromDate, toDate, filterby, zone, division, hallid);
List<Object[]> counterBookingList = request.equals("9") ? bookingService.getCounterWiseBookingCount(fromDate, toDate) : new ArrayList<>();
model.addAttribute("counterBookingList",counterBookingList);
System.out.println("counterBookingList.."+counterBookingList);
List<Object[]> hallBookingByCounter = bookingService.getHallWiseBookingDetails(fromDate, toDate);
// Convert to JSON for JS usage
String hallBookingJson = new ObjectMapper().writeValueAsString(hallBookingByCounter);
model.addAttribute("hallBookingJson", hallBookingJson);
List<Object[]> hallBookingDetails = bookingService.getBookingDetailsForAllHalls(fromDate, toDate);
String hallBookingDetailsJson = new ObjectMapper().writeValueAsString(hallBookingDetails);
model.addAttribute("hallBookingDetailsJson", hallBookingDetailsJson);
model.addAttribute("filterby", filterby);
model.addAttribute("users", userList);

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

@ -144,6 +144,7 @@ public class OfficerController {
return "redirect:/communityhall/login";
}
}
@GetMapping("/booking-list")
public String viewBookingList(Model model, HttpSession session) {
String officername = (String) session.getAttribute("usertype");
@ -228,8 +229,7 @@ public String RefundFailedList(Model model,HttpSession session) {
model.addAttribute("refundfailedcancelledbookings", refundfailedcancelledbookings);
model.addAttribute("refundfailedrejectedbookings", refundfailedrejectedbookings);
return "officer/refund-failedlist";
}
else {
} else {
session.invalidate();
return "redirect:/communityhall/login";
}
@ -253,8 +253,7 @@ else {
model.addAttribute("approvedcancelledbookings", approvedcancelledbookings);
model.addAttribute("approvedrejectedbookings", approvedrejectedbookings);
return "officer/settlement-approved";
}
else {
} else {
session.invalidate();
return "redirect:/communityhall/login";
}
@ -279,6 +278,7 @@ else {
return "redirect:/communityhall/login";
}
}
@GetMapping("/settlement-completedlist")
public String viewSettlementcompletedMaster(Model model, HttpSession session) {
String officername = (String) session.getAttribute("usertype");
@ -301,9 +301,9 @@ public String viewSettlementcompletedMaster(Model model,HttpSession session) {
return "redirect:/communityhall/login";
}
}
@GetMapping("/reports")
public String viewReports(Model model,HttpSession session)
{
public String viewReports(Model model, HttpSession session) {
String officername = (String) session.getAttribute("usertype");
if (officername != null) {
String zone = (String) session.getAttribute("zone");
@ -319,9 +319,9 @@ public String viewReports(Model model,HttpSession session)
return "redirect:/communityhall/login";
}
}
@GetMapping("/getReport")
public String viewgetReports(Model model,HttpSession session)
{
public String viewgetReports(Model model, HttpSession session) {
String officername = (String) session.getAttribute("usertype");
if (officername != null) {
String zone = (String) session.getAttribute("zone");
@ -337,6 +337,7 @@ public String viewgetReports(Model model,HttpSession session)
return "redirect:/communityhall/login";
}
}
@PostMapping("/getReport")
public String generateReport(Model model, HttpSession session,
@RequestParam(name = "FromDate") @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) String fromDate,
@ -385,34 +386,24 @@ private List<BookingDetails> handleBookingRequest(String request, String fromDat
if (bookingStatus.isEmpty() && filterby.isEmpty()) {
return bookingService.getAllBookingDetailsBookingDateByZone(fromDate, toDate, zone);
}
if(filterby.isEmpty() && !bookingStatus.isEmpty())
{
if (filterby.isEmpty() && !bookingStatus.isEmpty()) {
return bookingService.getAllBookingDetailsBookingDateByZoneWithStatus(fromDate, toDate, zone, bookingStatus);
}
if(!filterby.isEmpty())
{
if (!filterby.isEmpty()) {
if ("1".equals(filterby))
{
if(bookingStatus.isEmpty())
{
if ("1".equals(filterby)) {
if (bookingStatus.isEmpty()) {
return bookingService.getAllBookingDetailsBookingDateByZone(fromDate, toDate, zone);
}
else
{
} else {
return bookingService.getAllBookingDetailsBookingDateByZoneWithStatus(fromDate, toDate, zone, bookingStatus);
}
}
if ("2".equals(filterby))
{
if(bookingStatus.isEmpty())
{
if ("2".equals(filterby)) {
if (bookingStatus.isEmpty()) {
return bookingService.getAllBookingDetailsEventDateByZone(fromDate, toDate, zone);
}
else
{
} else {
return bookingService.getAllBookingDetailsEventDateByZoneWithStatus(fromDate, toDate, zone, bookingStatus);
}
@ -421,41 +412,31 @@ private List<BookingDetails> handleBookingRequest(String request, String fromDat
return new ArrayList<>();
}
private List<BookingDetails> 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())
{
if ((refundStatus == null || refundStatus.isEmpty()) && filterby.isEmpty()) {
return bookingService.getAllBookingsettlementDetailsByZoneByBookingDate(fromDate, toDate, zone);
}
if ((refundStatus != null && !refundStatus.isEmpty()) && filterby.isEmpty())
{
if ((refundStatus != null && !refundStatus.isEmpty()) && filterby.isEmpty()) {
return bookingService.getAllBookingsettlementDetailsByZoneByBookingDateWithStatus(fromDate, toDate, zone, refundStatus);
}
if(!filterby.isEmpty())
{
if (!filterby.isEmpty()) {
if ("1".equals(filterby))
{
if(refundStatus.isEmpty() || refundStatus==null)
{
if ("1".equals(filterby)) {
if (refundStatus.isEmpty() || refundStatus == null) {
return bookingService.getAllBookingsettlementDetailsByZoneByBookingDate(fromDate, toDate, zone);
}
else
{
} else {
return bookingService.getAllBookingsettlementDetailsByZoneByBookingDateWithStatus(fromDate, toDate, zone, refundStatus);
}
}
if ("2".equals(filterby))
{
if(refundStatus.isEmpty() || refundStatus==null)
{
if ("2".equals(filterby)) {
if (refundStatus.isEmpty() || refundStatus == null) {
return bookingService.getAllBookingsettlementDetailsByZoneByEventDate(fromDate, toDate, zone);
}
else
{
} else {
return bookingService.getAllBookingsettlementDetailsByZoneByEventDateWithStatus(fromDate, toDate, zone, refundStatus);
}
@ -466,41 +447,29 @@ private List<BookingDetails> handleBookingSettlementRequest(String request, Stri
return new ArrayList<>();
}
private List<Object[]> 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)
{
if (filterby.isEmpty() && hallId == 0) {
return bookingService.getBookingHallDetailsReportByZoneByBookingDate(fromDate, toDate, zone);
}
if(filterby.isEmpty() && hallId!=0)
{
if (filterby.isEmpty() && hallId != 0) {
return bookingService.getBookingHallDetailsReportByZoneByBookingDateHallname(fromDate, toDate, zone, hallId);
}
if(!filterby.isEmpty())
{
if("1".equals(filterby) )
{
if(hallId != 0)
{
if (!filterby.isEmpty()) {
if ("1".equals(filterby)) {
if (hallId != 0) {
return bookingService.getBookingHallDetailsReportByZoneByBookingDateHallname(fromDate, toDate, zone, hallId);
}
else
{
} else {
return bookingService.getBookingHallDetailsReportByZoneByBookingDate(fromDate, toDate, zone);
}
}
if("2".equals(filterby) )
{
if(hallId != 0)
{
if ("2".equals(filterby)) {
if (hallId != 0) {
return bookingService.getBookingHallDetailsReportByZoneByEventDateHallname(fromDate, toDate, zone, hallId);
}
else
{
} else {
return bookingService.getBookingHallDetailsReportByZoneByEventDate(fromDate, toDate, zone);
}
}
@ -509,7 +478,6 @@ private List<Object[]> handleHallBookingRequest(String request, String fromDate,
}
@GetMapping("/counter-refund")
public String counterRefundList(Model model, HttpSession session) {
String officername = (String) session.getAttribute("usertype");

4
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<BookingHistory> histories = bookingDetails.getBookingHistories();
if (histories != null && !histories.isEmpty()) {

4
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 {
*/

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

@ -1433,4 +1433,30 @@ public interface BookingDetailsRepository extends JpaRepository<BookingDetails,
@Query(value = "SELECT * FROM booking_details where booking_status='WAITING_FOR_NOC' order by booking_id", nativeQuery = true)
List<BookingDetails> 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<Object[]> 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<Object[]> 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<Object[]> getBookingDetailsForAllHalls(@Param("fromDate") String fromDate, @Param("toDate") String toDate);
}

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

@ -204,4 +204,11 @@ public interface BookingService {
List<BookingDetails> getBookingsByDateAndHall(String bookingDate, Long hallId);
BookingDetails updateRefundStatusScheduler(int bookingId, RefundStatus status);
List<Object[]> getCounterWiseBookingCount(String fromDate, String toDate);
List<Object[]> getHallWiseBookingDetails(String fromDate, String toDate);
List<Object[]> getBookingDetailsForAllHalls(String fromDate, String toDate);
}

16
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);
@ -2446,5 +2448,19 @@ public class BookingServiceImpl implements BookingService {
return null;
}
@Override
public List<Object[]> getCounterWiseBookingCount(String fromDate, String toDate) {
return bookingDetailsRepository.getCounterWiseBookingCount(fromDate, toDate);
}
@Override
public List<Object[]> getHallWiseBookingDetails(String fromDate, String toDate) {
return bookingDetailsRepository.getHallWiseBookingDetails(fromDate, toDate);
}
@Override
public List<Object[]> getBookingDetailsForAllHalls(String fromDate, String toDate){
return bookingDetailsRepository.getBookingDetailsForAllHalls(fromDate,toDate);
}
}

9
src/main/java/com/gcc/communityHall/service/Impl/UserServiceImpl.java

@ -36,7 +36,6 @@ import jakarta.servlet.http.HttpSession;
public class UserServiceImpl implements UserService {
@Autowired
UsersRepository usersRepository;
@ -67,6 +66,7 @@ public class UserServiceImpl implements UserService {
@Autowired
UserHistoryRepository userHistoryRepository;
public UserServiceImpl(UsersRepository userRepo) {
this.usersRepository = userRepo;
}
@ -165,15 +165,16 @@ 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<Users> getAllUsers(String fromDate, String toDate)
{
public List<Users> getAllUsers(String fromDate, String toDate) {
return usersRepository.getAllUsers(fromDate, toDate);
}
@ -251,9 +252,11 @@ public class UserServiceImpl implements UserService {
// TODO Auto-generated method stub
}
public Counsellordetails findByMobile(long mobileno) {
return counsellorDetailsRepository.findByMobile(mobileno);
}
@Override
public Users getUserDetailsByMobileNo(long mobileNo) {
return usersRepository.findByMobileNo(mobileNo);

476
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 */
}
</style>
<body>
@ -111,8 +126,24 @@
<option value="5" th:selected="${request=='5'}">Hall Booking List</option>
<option value="6" th:selected="${request=='6'}">Refund Details</option>
<option value="7" th:selected="${request=='7'}">Total Count</option>
<option value="9" th:selected="${request=='9'}">Counter Details</option>
</select>
</div>
<div class="col-sm-3 mb-2" id="bookingcountbasedonDropdown" style="display: none;">
<label class="form-label" for="basedon" >Based On: <span
class="text-danger">*</span></label>
<select class="form-control text-center" id="basedon" name="basedon"
th:value="${basedon}">
<option value="">Select</option>
<option value="zone" th:selected="${basedon == 'zone'}">Zone
</option>
<option value="division" th:selected="${basedon == 'division'}">Division
</option>
</select>
<span id="basedonError" class="text-danger"></span>
</div>
<!-- UsersDropdown2 -->
<div class="col-sm-3 mb-2" id="userDropdown2" style="display: none;">
<label class="form-label" for="usertype">User Type: </label>
@ -273,18 +304,6 @@
</select>
</div>
<div class="col-sm-3 mb-2" id="bookingcountbasedonDropdown" style="display: none;">
<label class="form-label" for="basedon">Based On: </label>
<select class="form-control text-center" id="basedon" name="basedon"
th:value="${basedon}">
<option value="">Select</option>
<option value="zone" th:selected="${basedon == 'zone'}">Zone
</option>
<option value="division" th:selected="${basedon == 'division'}">Division
</option>
</select>
</div>
<div class="col-sm-3">
<br>
@ -312,7 +331,6 @@
<th>Address</th>
<th>UserType</th>
<th>UserStatus</th>
</tr>
</thead>
<tr th:each="user, iterStat : ${users}">
@ -600,7 +618,36 @@
</tfoot>
</table>
</div>
<!--<div class="table-responsive" id="countertable" th:if="${request == '9'}">-->
<div class="table-responsive" id="countertable" th:if="${request}==9">
<table id="requestTable9" class="table table-striped table-bordered table-hover dataTable"
role="grid" width="99.5%">
<thead class="thead-dark">
<tr role="row">
<th>S.No</th>
<th>Counter ID</th>
<th>Total Bookings</th>
</tr>
</thead>
<tbody>
<tr th:each="counterdata, iterstat : ${counterBookingList}">
<td th:text="${iterstat.index + 1}"></td>
<td th:text="${counterdata[0]}"></td>
<td>
<button href="#"
th:attr="data-counter-id=${counterdata[0]}"
data-bs-toggle="modal"
data-bs-target="#bookingModal"
style="background-color: #2a807f; color: white; border: none; padding: 6px 12px; border-radius: 4px;"
onclick="showCounterTable(this)">
<span th:text="${counterdata[1]}"></span>
</button>
</td>
</tr>
</tbody>
</table>
</div>
</div>
@ -877,7 +924,7 @@
<!--Newly added for Reschedule Details-->
<div class="row col-md-12 col-lg-12 col-sm-12"
<!--<div class="row col-md-12 col-lg-12 col-sm-12"
id="rescheduleDetails"
style="display:none;margin-left: 0px;margin-top: -10px">
<div class="card-body">
@ -916,7 +963,7 @@
</tbody>
</table>
</div>
</div>
</div>-->
<div class="row col-md-12 col-lg-12 col-sm-12"
@ -1247,7 +1294,91 @@
</div>
</div>
</div>
<!-- Modal -->
<div class="modal fade" id="bookingModal" tabindex="-1" aria-labelledby="bookingModalLabel" aria-hidden="true">
<div class="modal-dialog modal-xl modal-dialog-scrollable">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Hall-wise Booking Details</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<!--
<table id="modalBookingTable" class="table table-bordered table-striped dataTable" style="width: 100%;">
-->
<table id="modalBookingTable" class="table table-striped table-bordered table-hover dataTable"
role="grid" width="99.5%">
<input type="hidden" id="hallBookingJsonInput" th:value="${hallBookingJson}">
<thead>
<tr>
<th>S.No</th>
<th>Zone</th>
<th>Division</th>
<th>Hall Name</th>
<th>Total Bookings</th>
</tr>
</thead>
<tbody id="modalBookingDetails"></tbody>
</table>
</div>
</div>
</div>
</div>
<div class="modal fade" id="hallDetailModal" tabindex="-1" aria-hidden="true">
<div class="modal-dialog modal-fullscreen-custom modal-dialog-scrollable">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Booking Details for Hall</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
</div>
<div class="modal-body">
<table id="hallDetailsTable" class="table table-bordered table-striped">
<input type="hidden" id="hallBookingDetailsJsonInput" th:value="${hallBookingDetailsJson}">
<thead>
<tr>
<th>S.No</th>
<th>Booking ID</th>
<th>Hall Name</th>
<th>Booking Date</th>
<th>Start Date</th>
<th>End Date</th>
<th>Starting Slot</th>
<th>Ending Slot</th>
<th>No.of.Days</th>
<th>Reason for Booking</th>
<th>Hall Amount</th>
<th>Deposit Amount</th>
<th>GSt</th>
<th>Amount Received</th>
<th>Booking Status</th>
<th>Booking Type</th>
<th>View</th>
</tr>
</thead>
<tbody id="hallDetailsTableBody"></tbody>
</table>
</div>
</div>
</div>
</div>
<div class="modal fade" id="bookingInfoModal" tabindex="-1" aria-labelledby="bookingInfoModalLabel"
aria-hidden="true">
<div class="modal-dialog modal-xl">
<div class="modal-content">
<div class="modal-header bg-dark text-white">
<h5 class="modal-title">Booking Information</h5>
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal"></button>
</div>
<div class="modal-body" id="bookingInfoContent">
<!-- Filled by JS -->
</div>
</div>
</div>
</div>
</main>
<footer th:replace="~{fragments/footer2 :: footer}"></footer>
@ -1259,7 +1390,7 @@
<script>
$(document).ready(function () {
/*$(document).ready(function () {
// Common buttons configuration
var buttons = [{
extend: 'pageLength',
@ -1288,7 +1419,7 @@
}];
// DataTables initialization
$('#requestTable1, #requestTable2, #requestTable3, #requestTable8, #requestTable4, #requestTable5, #requestTable6, #requestTable7').DataTable({
$('#requestTable1, #requestTable2, #requestTable3, #requestTable8, #requestTable4, #requestTable5, #requestTable6, #requestTable7,#requestTable9,#modalBookingTable,#hallDetailsTable').DataTable({
dom: 'Bftip',
columnDefs: [{
targets: 'no-sort',
@ -1298,7 +1429,7 @@
[50, 100, 200, 500, -1],
['50 rows', '100 rows', '200 rows', '500 rows', 'Show all']
],
scrollY: '50vh',
// scrollY: '50vh',
fixedColumns: {
left: 1,
right: 1
@ -1311,6 +1442,126 @@
order: [] // Remove any default sorting
});
// Link the search input to DataTable
$('#searchInput').on('keyup', function () {
$('#bookinglistdataTable').DataTable().search(this.value).draw();
});
});*/
$(document).ready(function () {
// Common buttons (default for most tables)
var commonButtons = [{
extend: 'pageLength',
className: 'btn btn-primary'
}, {
title: 'Data export',
extend: 'copyHtml5',
text: 'Copy',
className: 'btn btn-primary',
id: 'copyBtn'
}, {
extend: 'excelHtml5',
text: 'Excel',
className: 'btn btn-primary',
id: 'excelBtn'
}, {
extend: 'csvHtml5',
text: 'CSV',
className: 'btn btn-primary',
id: 'csvBtn'
}, {
extend: 'pdfHtml5',
text: 'PDF',
className: 'btn btn-primary',
id: 'pdfBtn'
}];
// Custom PDF buttons for specific tables
function getCustomButtons(tableId) {
let orientation = 'portrait';
let pageSize = 'A4';
if (tableId === 'modalBookingTable') {
orientation = 'landscape';
pageSize = 'A4';
} else if (tableId === 'hallDetailsTable') {
orientation = 'landscape';
pageSize = 'A3';
}
return [{
extend: 'pageLength',
className: 'btn btn-primary'
}, {
title: 'Data export',
extend: 'copyHtml5',
text: 'Copy',
className: 'btn btn-primary'
}, {
extend: 'excelHtml5',
text: 'Excel',
className: 'btn btn-primary'
}, {
extend: 'csvHtml5',
text: 'CSV',
className: 'btn btn-primary'
}, {
extend: 'pdfHtml5',
text: 'PDF',
className: 'btn btn-primary',
orientation: orientation,
pageSize: pageSize
}];
}
// Tables using default buttons
$('#requestTable1, #requestTable2, #requestTable3, #requestTable8, #requestTable4, #requestTable5, #requestTable6, #requestTable7').DataTable({
dom: 'Bftip',
columnDefs: [{
targets: 'no-sort',
orderable: false
}],
lengthMenu: [
[50, 100, 200, 500, -1],
['50 rows', '100 rows', '200 rows', '500 rows', 'Show all']
],
fixedColumns: {
left: 1,
right: 1
},
buttons: commonButtons,
responsive: true,
searching: true,
select: false,
processing: false,
order: []
});
// Tables with custom PDF buttons
['requestTable9', 'modalBookingTable', 'hallDetailsTable'].forEach(function (tableId) {
$('#' + tableId).DataTable({
dom: 'Bftip',
columnDefs: [{
targets: 'no-sort',
orderable: false
}],
lengthMenu: [
[50, 100, 200, 500, -1],
['50 rows', '100 rows', '200 rows', '500 rows', 'Show all']
],
fixedColumns: {
left: 1,
right: 1
},
buttons: getCustomButtons(tableId),
responsive: true,
searching: true,
select: false,
processing: false,
order: []
});
});
// Link the search input to DataTable
$('#searchInput').on('keyup', function () {
$('#bookinglistdataTable').DataTable().search(this.value).draw();
@ -1319,6 +1570,7 @@
function validateme() {
// checkTodateCon();
return true;
}
@ -1336,6 +1588,7 @@
fromdate.onchange = validateDate;
todate.onchange = validateDate;
$(document).ready(function () {
var today = new Date();
$('.datepicker').datepicker({
@ -1348,10 +1601,16 @@
}
});
});
document.addEventListener("DOMContentLoaded", function () {
myRequest(); // Initial call to set dropdowns based on initial value
});
document.addEventListener("DOMContentLoaded", function () {
checkTodateCon();
});
function checkTodateCon(){
var today = new Date();
var sixMonthsLater = new Date();
sixMonthsLater.setMonth(today.getMonth() + 6);
@ -1360,7 +1619,9 @@
var maxDate = sixMonthsLater.toISOString().split('T')[0];
let fromDateInput = document.getElementById('fromdate');
let toDateInput = document.getElementById('todate');
let selectedFromDate = document.getElementById('fromdate').value;
fromDateInput.setAttribute('max', maxDate);
toDateInput.setAttribute('min', selectedFromDate);
toDateInput.setAttribute('max', maxDate);
fromDateInput.addEventListener('change', function () {
let selectedFromDate = this.value;
@ -1368,8 +1629,66 @@
toDateInput.setAttribute('min', selectedFromDate);
toDateInput.value = ''; // Reset the value of toDate
});
}
// document.addEventListener("DOMContentLoaded", function () {
// const form = document.getElementById('myForm'); // Change selector if needed
// var requestValue = document.getElementById("request").value;
// if(requestValue ==="7"){
// console.log("inside 7");
// const basedonSelect = document.getElementById('basedon');
// const errorSpan = document.getElementById('basedonError');
//
// form.addEventListener("submit", function (event) {
// console.log("basedonSelect.value====="+basedonSelect.value);
// if (basedonSelect.value === "") {
// event.preventDefault(); // Stop form submission
// errorSpan.textContent = "Please select a value.";
// basedonSelect.classList.add("is-invalid"); // Optional: Bootstrap styling
// }
// else {
// errorSpan.textContent = "";
// basedonSelect.classList.remove("is-invalid");
// }
// });
// }
//
// });
document.addEventListener("DOMContentLoaded", function () {
const form = document.getElementById('myForm');
const basedonSelect = document.getElementById('basedon');
const errorSpan = document.getElementById('basedonError');
const request = document.getElementById('request');
form.addEventListener("submit", function (event) {
const requestValue = request.value;
if (requestValue === "7") {
console.log("inside 7");
console.log("basedonSelect.value=====" + basedonSelect.value);
if (basedonSelect.value === "") {
event.preventDefault(); // Stop form submission
errorSpan.textContent = "Please select a value.";
basedonSelect.classList.add("is-invalid");
} else {
errorSpan.textContent = "";
basedonSelect.classList.remove("is-invalid");
}
}
});
document.getElementById("basedon").addEventListener("change", function () {
this.classList.remove("is-invalid");
document.getElementById("basedonError").textContent = "";
});
});
// Function to manage the display of dropdowns based on the request type
function myRequest() {
var requestValue = document.getElementById("request").value;
@ -1435,7 +1754,7 @@
document.getElementById("divisionContainer").style.display = "block";
document.getElementById("hallContainer").style.display = "block";
} else if (requestValue === "7") {
document.getElementById("bookingcountbasedonDropdown").style.display = "block"
document.getElementById("bookingcountbasedonDropdown").style.display = "block";
} else if (requestValue === "8") {
document.getElementById("zoneDropdown").style.display = "block";
document.getElementById("divisionContainer").style.display = "block";
@ -1520,6 +1839,8 @@
document.getElementById("td_endingSlot").innerHTML = getTimeSlot(response.endingSlot);
document.getElementById("bookingstatus_td").innerHTML = response.bookingStatus;
console.log("before comments admin...");
console.log("Comments..." + response.comments);
if (response.bookingStatus === 'REJECTED' && response.comments) {
document.getElementById("rejectionreasondiv").style.display = "block";
const rejectionCell = document.getElementById("reasonforrejection");
@ -1571,14 +1892,14 @@
document.getElementById("refunddetails").style.display = "none";
}
if (response.scheduleCount === 1) {
/*if (response.scheduleCount === 1) {
document.getElementById("rescheduleDetails").style.display = "block";
document.getElementById("td_res_start_date").innerHTML = response.startDate;
document.getElementById("td_res_end_date").innerHTML = response.endDate;
document.getElementById("td_res_date").innerHTML = response.updatedDate;
} else {
document.getElementById("rescheduleDetails").style.display = "none";
}
}*/
showDamageDetails(response);
if (response.bookingStatus === 'CANCELED' && ['WAITING', 'APPROVED', 'INITIATED'].includes(response.refundStatus)) {
@ -1798,6 +2119,16 @@
$('#fileModal').modal('show');
}
$('#fileModal').on('shown.bs.modal', function () {
// boost the last backdrop above everything else
$('.modal-backdrop').last().css({
'z-index': 1095,
'pointer-events': 'none'
});
// boost this modal
$(this).css('z-index', 1100);
});
function viewbookingDetails(userId) {
$.ajax({
type: "GET",
@ -2041,6 +2372,107 @@
storeSelectedValues();
});
let hallBookingData = [];
let hallDetailsData = [];
window.addEventListener("DOMContentLoaded", () => {
try {
const jsonString1 = document.getElementById("hallBookingJsonInput")?.value;
if (jsonString1) {
hallBookingData = JSON.parse(jsonString1);
console.log("Parsed hallBookingData:", hallBookingData);
}
const jsonString2 = document.getElementById("hallBookingDetailsJsonInput")?.value;
if (jsonString2) {
hallDetailsData = JSON.parse(jsonString2);
console.log("Parsed hallDetailsData:", hallDetailsData);
}
} catch (e) {
console.error("Failed to parse JSON inputs", e);
}
// Delegate click event for dynamically added booking links
$(document).on('click', '.hall-detail-link', function (e) {
e.preventDefault();
const hallName = $(this).data('hall-name');
showHallBookingDetails(hallName);
});
});
function showCounterTable(elem) {
const counterId = elem.getAttribute("data-counter-id");
const filtered = hallBookingData.filter(row => row[0] == counterId);
const table = $('#modalBookingTable').DataTable();
table.clear();
filtered.forEach((row, index) => {
table.row.add([
index + 1,
row[1], // Zone
row[2], // Division
row[3], // Hall Name
`<button href="#" class="hall-detail-link"
style="background-color: #2a807f; color: white; border: none; padding: 6px 12px; border-radius: 4px;"
data-hall-name="${row[3]}">${row[4]}</button>`
]);
});
table.draw();
table.columns.adjust().responsive.recalc();
// Show modal after data is loaded
$('#bookingModal').modal('show');
}
function formatDateFromTimestamp(timestamp) {
const date = new Date(parseInt(timestamp));
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
return `${year}-${month}-${day}`;
}
function getSlotLabel(slot) {
return slot === 1 ? 'Morning' : (slot === 2 ? 'Evening' : '');
}
function showHallBookingDetails(hallName) {
const filtered = hallDetailsData.filter(row => row[1] === hallName);
const table = $('#hallDetailsTable').DataTable();
table.clear();
filtered.forEach((row, index) => {
table.row.add([
index + 1,
row[0],
row[1],
formatDateFromTimestamp(row[2]),
row[3],
row[4],
getSlotLabel(row[5]),
getSlotLabel(row[6]),
row[7],
row[8],
row[9],
row[10],
row[11],
row[12],
row[13],
row[14],
` <button class="btn btn-sm btn-primary" onclick="viewDetails('${row[0]}')">View</button>`
]);
});
table.draw();
table.columns.adjust().responsive.recalc();
$('#hallDetailModal').modal('show');
}
function viewCounterBookingDetails(bookingId) {
viewDetails(bookingId);
}
</script>
</body>

3
src/main/resources/templates/fragments/Details.html

@ -141,8 +141,7 @@
<strong>Booking Status:</strong>
<span style="background-color: red;font-weight: bold; padding: 2px 5px;color:white">FAILURE</span><br><br>
<strong>Refund Status:</strong>
<span style="background-color: yellow; font-weight: bold; padding: 2px 5px;">Refund has to be initiated. Please contact
admin.</span>
<span style="background-color: yellow; font-weight: bold; padding: 2px 5px;">Refund has to be initiated.</span>
</p>
<!-- If booking status is 'Refunded' and refund status is 'Completed', display refund initiated message -->

4
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('');
});
}

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

@ -24,12 +24,12 @@
<span class="nav-main-link-name">Settlement Pending List</span>
</a>
</li>
<li class="nav-main-item">
<!--<li class="nav-main-item">
<a class="nav-main-link" href="/communityhall/officer/refundfailed-list">
<i class="nav-main-link-icon fa fa-location-arrow"></i>
<span class="nav-main-link-name">Refund Failed List</span>
</a>
</li>
</li>-->
<!-- <li class="nav-main-item">
<a class="nav-main-link" href="/communityhall/officer/settlement-approved">
<i class="nav-main-link-icon fa fa-location-arrow"></i>

18
src/main/resources/templates/headquarters/refund-failedlist.html

@ -89,7 +89,7 @@
<th>Collection Pending</th>
<th>Refund Amount</th>
<th>Status</th>
<th>Action</th>
<!--<th>Action</th>-->
</tr>
</thead>
<tbody>
@ -109,12 +109,12 @@
<td class="text-center" th:text="${settlement.settlement.refundedAmount}">
</td>
<td class="text-center" th:text="${settlement.refundStatus}"></td>
<td>
<!--<td>
<p>
<span class="badge bg-warning" style="cursor: pointer;"
th:onclick="pending([[${settlement.settlement.settlementId}]])">Approve</span>
</p>
</td>
</td>-->
</tr>
</tbody>
</table>
@ -142,7 +142,7 @@
<th>User type</th>
<th>Reason for Booking</th>
<th>Refund Amount</th>
<th>Action</th>
<!--<th>Action</th>-->
</tr>
</thead>
<tbody>
@ -157,12 +157,12 @@
<td class="text-center" th:text="${cancelledbookings.reason}"></td>
<td class="text-center"
th:text="${cancelledbookings.depositAmount}"></td>
<td>
<!--<td>
<p>
<span class="badge bg-warning" style="cursor: pointer;"
th:onclick="cancelledbooking([[${cancelledbookings.bookingId}]])">Approve</span>
</p>
</td>
</td>-->
</tr>
</tbody>
</table>
@ -191,7 +191,7 @@
<th>Reason for Booking</th>
<th>Reason for Rejection</th>
<th>Refund Amount</th>
<th>Action</th>
<!--<th>Action</th>-->
</tr>
</thead>
<tbody>
@ -206,12 +206,12 @@
<td class="text-center" th:text="${rejectedbookings.reason}"></td>
<td class="text-center" th:text="${rejectedbookings.comments}"></td>
<td class="text-center" th:text="${rejectedbookings.amountReceived}"></td>
<td>
<!--<td>
<p>
<span class="badge bg-warning" style="cursor: pointer;"
th:onclick="rejectedbooking([[${rejectedbookings.bookingId}]])">Approve</span>
</p>
</td>
</td>-->
</tr>
</tbody>
</table>

31
src/main/resources/templates/headquarters/reports.html

@ -106,6 +106,7 @@
<option value="6" th:selected="${request=='6'}">Refund Details</option>
<option value="7" th:selected="${request=='7'}">Total Count</option>
<option value="8" th:selected="${request=='8'}">Extra Payments Info</option>
<option value="9" th:selected="${request=='9'}">Counter Details</option>
</select>
</div>
<!-- UsersDropdown2 -->
@ -586,7 +587,35 @@
</table>
</div>
<div class="table-responsive" id="countertable" th:if="${request}==9">
<table id="requestTable9" class="table table-striped table-bordered table-hover dataTable"
role="grid" width="99.5%">
<thead class="thead-dark">
<tr role="row">
<th>S.No</th>
<th>Counter ID</th>
<th>Total Bookings</th>
</tr>
</thead>
<tbody>
<tr th:each="counterdata, iterstat : ${counterBookingList}">
<td th:text="${iterstat.index + 1}"></td>
<td th:text="${counterdata[0]}"></td>
<td>
<button href="#"
th:attr="data-counter-id=${counterdata[0]}"
data-bs-toggle="modal"
data-bs-target="#bookingModal"
style="background-color: #2a807f; color: white; border: none; padding: 6px 12px; border-radius: 4px;"
onclick="showCounterTable(this)">
<span th:text="${counterdata[1]}"></span>
</button>
</td>
</tr>
</tbody>
</table>
</div>
</div>

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

@ -294,7 +294,8 @@
</div>
<div class="col-sm-2">
<label for="startingslot">Starting Slot:</label>
<label for="startingslot">Starting Slot:<span
class="required-field">*</span></label>
<select class="form-control" id="startingslot"
name="startingslot"
aria-label="Starting Slot">
@ -310,7 +311,8 @@
</select>
</div>
<div class="col-sm-2">
<label for="endingslot">Ending Slot:</label>
<label for="endingslot">Ending Slot:<span
class="required-field">*</span></label>
<select class="form-control" id="endingslot"
name="endingslot" aria-label="Ending Slot">
<option value="0"

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

@ -1242,7 +1242,7 @@
</h1>
</div>
<!--Newly added for Reschedule Details-->
<div class="row col-md-12 col-lg-12 col-sm-12"
<!--<div class="row col-md-12 col-lg-12 col-sm-12"
id="rescheduleDetails"
style="display:none;margin-left: 0px;margin-top: -49px">
<div class="card-body">
@ -1280,7 +1280,7 @@
</tbody>
</table>
</div>
</div>
</div>-->
</div>
</div>
@ -1834,6 +1834,9 @@
document.getElementById("td_endingSlot").innerHTML = getTimeSlot(response.endingSlot);
document.getElementById("bookingstatus_td").innerHTML = response.bookingStatus;
console.log("before comments user view history...");
console.log("Comments..."+response.comments);
if (response.bookingStatus === 'REJECTED' && response.comments) {
document.getElementById("rejectionreasondiv").style.display = "block";
const rejectionCell = document.getElementById("reasonforrejection");
@ -1923,12 +1926,12 @@
document.getElementById("refundamountDetails").style.display = "block";
document.getElementById("td_bookingStatus").innerHTML = response.bookingStatus;
document.getElementById("td_refundStatus").innerHTML = response.refundStatus;
} else if(response.scheduleCount === 1){
} /*else if(response.scheduleCount === 1){
document.getElementById("rescheduleDetails").style.display = "block";
document.getElementById("td_res_start_date").innerHTML = response.startDate;
document.getElementById("td_res_end_date").innerHTML = response.endDate;
document.getElementById("td_res_date").innerHTML = response.updatedDate;
} else {
}*/ else {
document.getElementById("refundamountDetails").style.display = "none";
}
// Show the modal

Loading…
Cancel
Save