diff --git a/src/main/java/com/gcc/communityHall/controller/Admincontroller.java b/src/main/java/com/gcc/communityHall/controller/Admincontroller.java index a59c9eef..708fbb67 100644 --- a/src/main/java/com/gcc/communityHall/controller/Admincontroller.java +++ b/src/main/java/com/gcc/communityHall/controller/Admincontroller.java @@ -1376,4 +1376,18 @@ public class Admincontroller { return response; } + // Newly added for collection pending by kani + + @GetMapping("/collectionpending") + public String viewCollectionPending(Model model, HttpSession session) { + String userType = (String) session.getAttribute("usertype"); + if (userType != null) { + List collectionPendingList = bookingRepository.getAllCollectionPendingList(); + model.addAttribute("collectionPendingList", collectionPendingList); + return "admin/collection-pending"; + } else { + session.invalidate(); + return "redirect:/communityhall/login"; + } + } } diff --git a/src/main/java/com/gcc/communityHall/controller/CROController.java b/src/main/java/com/gcc/communityHall/controller/CROController.java index c1ff08cf..1ff4cfdc 100644 --- a/src/main/java/com/gcc/communityHall/controller/CROController.java +++ b/src/main/java/com/gcc/communityHall/controller/CROController.java @@ -23,13 +23,16 @@ public class CROController { @GetMapping("/booking-list") public String viewBookingList(Model model, HttpSession session) { String croname = (String) session.getAttribute("usertype"); + int rescheduleLimit = (int) session.getAttribute("rescheduleLimit"); // System.out.println("croname..." + croname); if (croname != null && "cro".equals(croname)) { long mobileno = (long) session.getAttribute("mobileno"); model.addAttribute("mobileno", mobileno); model.addAttribute("croname", croname); + model.addAttribute("rescheduleLimit", rescheduleLimit); List bookingList = bookingDetailsRepository.getApprovedBookingListforReschedule(); model.addAttribute("bookingList", bookingList); + return "cro/booking-list"; } else { session.invalidate(); // Invalidate the session to clear all session attributes diff --git a/src/main/java/com/gcc/communityHall/controller/CareTakerAPIController.java b/src/main/java/com/gcc/communityHall/controller/CareTakerAPIController.java index 021d328a..d32f9d10 100644 --- a/src/main/java/com/gcc/communityHall/controller/CareTakerAPIController.java +++ b/src/main/java/com/gcc/communityHall/controller/CareTakerAPIController.java @@ -25,6 +25,8 @@ import com.gcc.communityHall.dto.ErrorResponseDto; import com.gcc.communityHall.entity.ApplicationLogs; import com.gcc.communityHall.entity.BookingDetails; import com.gcc.communityHall.entity.Login; +import com.gcc.communityHall.entity.RescheduleConfig; +import com.gcc.communityHall.repository.RescheduleConfigRepository; import com.gcc.communityHall.entity.Users; import com.gcc.communityHall.others.AppConfig; import com.gcc.communityHall.repository.ApplicationLogsRepository; @@ -79,6 +81,9 @@ public class CareTakerAPIController { @Autowired private AppConfig appConfig; + @Autowired + private RescheduleConfigRepository rescheduleConfigRepository; + @Operation(summary = "Retrieving the User Details by bookingId REST API", description = "REST API for Retrieving the User Details by bookingId") @ApiResponses({ @ApiResponse(responseCode = "200", description = "HTTP Status OK", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Users.class) @@ -168,6 +173,9 @@ public class CareTakerAPIController { session.setAttribute("usertype", login.getUserType()); session.setAttribute("employeeId", login.getEmployeeId()); session.setAttribute("zone", login.getZone()); + RescheduleConfig rescheduleConfig = rescheduleConfigRepository.findAll() + .stream().filter(c -> c.getIs_active() == 1).findFirst().orElse(null); + session.setAttribute("rescheduleLimit", rescheduleConfig != null ? rescheduleConfig.getCro_limit() : 0); InetAddress inetAddress = InetAddress.getLocalHost(); String hostname = InetAddress.getLocalHost().getHostName(); // System.out.println("Hostname: " + hostname); diff --git a/src/main/java/com/gcc/communityHall/controller/CareTakerController.java b/src/main/java/com/gcc/communityHall/controller/CareTakerController.java index 3ea7cfbd..594d8b41 100644 --- a/src/main/java/com/gcc/communityHall/controller/CareTakerController.java +++ b/src/main/java/com/gcc/communityHall/controller/CareTakerController.java @@ -168,4 +168,23 @@ public class CareTakerController { return "redirect:/communityhall/login"; } + // Newly added for collection pending by kani + + @GetMapping("/collectionpending") + public String viewCollectionPending(Model model, HttpSession session) { + String caretakerName = (String) session.getAttribute("usertype"); + if (caretakerName != null && "caretaker".equals(caretakerName)) { + long mobileno = (long) session.getAttribute("mobileno"); + model.addAttribute("mobileno", mobileno); + Integer hallid = (Integer) session.getAttribute("hall_id"); + List collectionPendingList = bookingRepository.getCollectionPendingList(hallid); + model.addAttribute("caretakerName", caretakerName); + model.addAttribute("collectionPendingList", collectionPendingList); + return "caretaker/collection-pending"; + } else { + session.invalidate(); + return "redirect:/communityhall/login"; + } + } + } diff --git a/src/main/java/com/gcc/communityHall/controller/HeadquartersController.java b/src/main/java/com/gcc/communityHall/controller/HeadquartersController.java index 7e3fb207..faca0db4 100644 --- a/src/main/java/com/gcc/communityHall/controller/HeadquartersController.java +++ b/src/main/java/com/gcc/communityHall/controller/HeadquartersController.java @@ -1370,4 +1370,20 @@ public class HeadquartersController { return response; } + // Newly added for collection pending by kani + + @GetMapping("/collectionpending") + public String viewCollectionPending(Model model, HttpSession session) { + String headquartersname = (String) session.getAttribute("usertype"); + if (headquartersname != null && "headquarters".equals(headquartersname)) { + List collectionPendingList = bookingDetailsRepository.getAllCollectionPendingList(); + model.addAttribute("headquartersname", headquartersname); + model.addAttribute("collectionPendingList", collectionPendingList); + return "headquarters/collection-pending"; + } else { + session.invalidate(); + return "redirect:/communityhall/login"; + } + } + } diff --git a/src/main/java/com/gcc/communityHall/controller/OfficerController.java b/src/main/java/com/gcc/communityHall/controller/OfficerController.java index b0177247..acce277c 100644 --- a/src/main/java/com/gcc/communityHall/controller/OfficerController.java +++ b/src/main/java/com/gcc/communityHall/controller/OfficerController.java @@ -649,4 +649,26 @@ public class OfficerController { return "redirect:/communityhall/login"; } } + + // Newly added for collection pending by kani + + @GetMapping("/collectionpending") + public String viewCollectionPending(Model model, HttpSession session) { + String officername = (String) session.getAttribute("usertype"); + if (officername != null && "officer".equals(officername)) { + model.addAttribute("officername", officername); + long mobileno = (long) session.getAttribute("mobileno"); + model.addAttribute("mobileno", mobileno); + model.addAttribute("title", "bookinglist"); + List hallIds = (List) session.getAttribute("hall_ids"); + model.addAttribute("hallIds", hallIds); + List collectionPendingList = bookingDetailsRepository + .getCollectionPendingListByHallIds(hallIds); + model.addAttribute("collectionPendingList", collectionPendingList); + return "officer/collection-pending"; + } else { + session.invalidate(); + return "redirect:/communityhall/login"; + } + } } diff --git a/src/main/java/com/gcc/communityHall/controller/UserController.java b/src/main/java/com/gcc/communityHall/controller/UserController.java index 9290829b..ff05603a 100644 --- a/src/main/java/com/gcc/communityHall/controller/UserController.java +++ b/src/main/java/com/gcc/communityHall/controller/UserController.java @@ -324,6 +324,7 @@ public class UserController { BookingDetails bookingsDetails = bookingService.getBookingByRefId(refId); if (bookingsDetails == null) { + System.out.println("I'm in the acknowledgement error page condition"); model.addAttribute("errorMsg", "Invalid booking reference number."); return "user/error"; } diff --git a/src/main/java/com/gcc/communityHall/entity/BookingDetails.java b/src/main/java/com/gcc/communityHall/entity/BookingDetails.java index 9f79582f..cc2b5260 100644 --- a/src/main/java/com/gcc/communityHall/entity/BookingDetails.java +++ b/src/main/java/com/gcc/communityHall/entity/BookingDetails.java @@ -22,7 +22,7 @@ public class BookingDetails { } public enum RefundStatus { - APPROVED, WAITING, INITIATED, REJECTED, COMPLETED, NA, FAILURE, CLOSED + APPROVED, WAITING, INITIATED, REJECTED, COMPLETED, NA, FAILURE, CLOSED, COLLECTION_PENDING } public enum BookingType { diff --git a/src/main/java/com/gcc/communityHall/entity/RescheduleConfig.java b/src/main/java/com/gcc/communityHall/entity/RescheduleConfig.java new file mode 100644 index 00000000..e008f161 --- /dev/null +++ b/src/main/java/com/gcc/communityHall/entity/RescheduleConfig.java @@ -0,0 +1,82 @@ +package com.gcc.communityHall.entity; + +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.Table; + +@Entity +@Table(name = "reschedule_config") +public class RescheduleConfig { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id") + private int id; + + @Column(name = "user_limit") + private int user_limit; + + @Column(name = "cro_limit") + private int cro_limit; + + @Column(name = "is_active", nullable = false, columnDefinition = "INT DEFAULT 1") + private int is_active = 1; + + @Column(name = "is_delete", nullable = false, columnDefinition = "INT DEFAULT 0") + private int is_delete = 0; + + // Getters and Setters + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public int getUser_limit() { + return user_limit; + } + + public void setUser_limit(int user_limit) { + this.user_limit = user_limit; + } + + public int getCro_limit() { + return cro_limit; + } + + public void setCro_limit(int cro_limit) { + this.cro_limit = cro_limit; + } + + public int getIs_active() { + return is_active; + } + + public void setIs_active(int is_active) { + this.is_active = is_active; + } + + public int getIs_delete() { + return is_delete; + } + + public void setIs_delete(int is_delete) { + this.is_delete = is_delete; + } + + @Override + public String toString() { + return "RescheduleConfig{" + + "id=" + id + + ", user_limit=" + user_limit + + ", cro_limit=" + cro_limit + + ", is_active=" + is_active + + ", is_delete=" + is_delete + + '}'; + } +} diff --git a/src/main/java/com/gcc/communityHall/paymentService/controller/PaymentController.java b/src/main/java/com/gcc/communityHall/paymentService/controller/PaymentController.java index 3d5e2295..eac9c165 100644 --- a/src/main/java/com/gcc/communityHall/paymentService/controller/PaymentController.java +++ b/src/main/java/com/gcc/communityHall/paymentService/controller/PaymentController.java @@ -87,6 +87,7 @@ public class PaymentController { String salt = this.paymentConfig.getEncryptionKey(); String confirmToken = ""; String status = this.paymentConfig.getTransactionSuccessCode(); + String refId = ""; String[] res = msg.split("\\|"); String c = ""; @@ -154,7 +155,7 @@ public class PaymentController { } // Fetch OR Generate booking_ref_id - String refId = bookser.getBookingRefIdByBookingId(bookingId); + refId = bookser.getBookingRefIdByBookingId(bookingId); // encrypt bookingId (coworkspace logic) String encryptedId = encryptionUtil.encrypt(String.valueOf(bookingId)); @@ -174,22 +175,23 @@ public class PaymentController { bookingsDetails.setPayments(payment); paymentRepo.save(payment); + // 🔥 Fetch OR Generate booking_ref_id + refId = bookser.getBookingRefIdByBookingId(bookingId); + try { bookser.confirmBooking(bookingId); } catch (Exception e) { + e.printStackTrace(); + System.out.println("Exception Occured inside /response end point : " + e.getMessage()); // ignore } } - // 🔥 Fetch OR Generate booking_ref_id - String refId = bookser.getBookingRefIdByBookingId(bookingId); - // 🔐 Encrypt bookingId String encryptedId = encryptionUtil.encrypt(String.valueOf(bookingId)); model.addAttribute("ref_id", refId); model.addAttribute("encryptedId", encryptedId); - return "redirect:/communityhall/user/acknowledgement?ref_id=" + refId; } diff --git a/src/main/java/com/gcc/communityHall/paymentService/entity/RefundResponse.java b/src/main/java/com/gcc/communityHall/paymentService/entity/RefundResponse.java index 28d0d141..89cb3646 100644 --- a/src/main/java/com/gcc/communityHall/paymentService/entity/RefundResponse.java +++ b/src/main/java/com/gcc/communityHall/paymentService/entity/RefundResponse.java @@ -3,6 +3,8 @@ package com.gcc.communityHall.paymentService.entity; import java.time.LocalDate; import java.time.LocalDateTime; +import org.hibernate.annotations.CreationTimestamp; + import jakarta.persistence.Column; import jakarta.persistence.Entity; import jakarta.persistence.GeneratedValue; @@ -31,6 +33,7 @@ public class RefundResponse { private String arnNumber; @Column(name = "cdate") + @CreationTimestamp private LocalDateTime cdate; private String balaceAmount; diff --git a/src/main/java/com/gcc/communityHall/repository/BookingDetailsRepository.java b/src/main/java/com/gcc/communityHall/repository/BookingDetailsRepository.java index 2d158d12..e7eb7fb0 100644 --- a/src/main/java/com/gcc/communityHall/repository/BookingDetailsRepository.java +++ b/src/main/java/com/gcc/communityHall/repository/BookingDetailsRepository.java @@ -117,13 +117,13 @@ public interface BookingDetailsRepository extends JpaRepository getSettlementList(Integer hallId); - @Query(value = "SELECT * FROM booking_details WHERE DATE(start_date) <= CURRENT_DATE() AND hall_details_hall_id IN (:hallIds) AND booking_status='APPROVED' AND refund_status IN ('WAITING','REJECTED','APPROVED')", nativeQuery = true) + @Query(value = "SELECT * FROM booking_details WHERE DATE(start_date) <= CURRENT_DATE() AND hall_details_hall_id IN (:hallIds) AND booking_status='APPROVED' AND refund_status IN ('WAITING','REJECTED','APPROVED','COLLECTION_PENDING')", nativeQuery = true) public List getSettlementListByHallIds(@Param("hallIds") List hallIds); - @Query(value = "SELECT * FROM booking_details WHERE DATE(start_date) <= CURRENT_DATE() AND booking_status='APPROVED' AND refund_status IN ('WAITING','REJECTED','APPROVED')", nativeQuery = true) + @Query(value = "SELECT * FROM booking_details WHERE DATE(start_date) <= CURRENT_DATE() AND booking_status='APPROVED' AND refund_status IN ('WAITING','REJECTED','APPROVED','COLLECTION_PENDING')", nativeQuery = true) public List getAllSettlementList(); // yoga @@ -448,11 +448,11 @@ public interface BookingDetailsRepository extends JpaRepository findAllwithCompletedRefundStatus(); - @Query("SELECT b FROM BookingDetails b JOIN FETCH b.settlement s WHERE b.refundStatus = 'WAITING' and b.hallDetails.zone=:zone and b.hallDetails.hallId in (:hallIds)") + @Query("SELECT b FROM BookingDetails b JOIN FETCH b.settlement s WHERE b.refundStatus = 'WAITING' and b.hallDetails.zone=:zone and b.hallDetails.hallId in (:hallIds) ") List findSettlementPendingByZone(String zone, List hallIds); // ak - @Query("SELECT b FROM BookingDetails b JOIN FETCH b.settlement s WHERE b.refundStatus = 'FAILURE' and b.hallDetails.zone=:zone and b.hallDetails.hallId in (:hallIds)") + @Query("SELECT b FROM BookingDetails b JOIN FETCH b.settlement s WHERE b.refundStatus = 'FAILURE' and b.hallDetails.zone=:zone and b.hallDetails.hallId in (:hallIds) ") List findSettlementInitiatedPendingByZone(String zone, List hallIds); @Query("SELECT b FROM BookingDetails b JOIN FETCH b.settlement s WHERE b.refundStatus = 'FAILURE'") @@ -467,14 +467,14 @@ public interface BookingDetailsRepository extends JpaRepository findAllSettlementRejected(); - @Query("SELECT b FROM BookingDetails b WHERE b.refundStatus = 'WAITING' AND b.bookingStatus = 'CANCELED' AND b.hallDetails.zone = :zone and b.hallDetails.hallId in (:hallIds)") + @Query("SELECT b FROM BookingDetails b WHERE b.refundStatus = 'WAITING' AND b.bookingStatus = 'CANCELED' AND b.hallDetails.zone = :zone and b.hallDetails.hallId in (:hallIds) ") List findCancelledListByZone(@Param("zone") String zone, @Param("hallIds") List hallIds); @Query("SELECT b FROM BookingDetails b WHERE b.refundStatus = 'APPROVED' AND b.bookingStatus = 'CANCELED' AND b.hallDetails.zone = :zone and b.hallDetails.hallId in (:hallIds)") List findapprovedCancelledListByZone(String zone, @Param("hallIds") List hallIds); - @Query("SELECT b FROM BookingDetails b WHERE b.refundStatus = 'WAITING' AND b.bookingStatus IN ('GCC_BLOCKED', 'REJECTED') AND b.hallDetails.zone = :zone and b.hallDetails.hallId in (:hallIds)") + @Query("SELECT b FROM BookingDetails b WHERE b.refundStatus = 'WAITING' AND b.bookingStatus IN ('GCC_BLOCKED', 'REJECTED') AND b.hallDetails.zone = :zone and b.hallDetails.hallId in (:hallIds) ") List findRejectedListByZone(@Param("zone") String zone, @Param("hallIds") List hallIds); @@ -1585,16 +1585,22 @@ public interface BookingDetailsRepository extends JpaRepository findRejectedSettlementCompletedListbyzone(String zone, List hallIds); - @Query("SELECT b FROM BookingDetails b JOIN FETCH b.settlement s WHERE b.refundStatus = 'WAITING'") + @Query("SELECT b FROM BookingDetails b JOIN FETCH b.settlement s WHERE b.refundStatus = 'WAITING' ") + // @Query("SELECT b FROM BookingDetails b JOIN FETCH b.settlement s WHERE + // b.refundStatus = 'WAITING'") List findAllSettlementPending(); - @Query("SELECT b FROM BookingDetails b WHERE b.refundStatus = 'WAITING' AND b.bookingStatus = 'CANCELED'") + @Query("SELECT b FROM BookingDetails b WHERE b.refundStatus = 'WAITING' AND b.bookingStatus = 'CANCELED' ") + // @Query("SELECT b FROM BookingDetails b WHERE b.refundStatus = 'WAITING' AND + // b.bookingStatus = 'CANCELED'") List findAllSettlementCancelledList(); - @Query("SELECT b FROM BookingDetails b WHERE b.refundStatus = 'WAITING' AND b.bookingStatus IN ('REJECTED','GCC_BLOCKED')") + @Query("SELECT b FROM BookingDetails b WHERE b.refundStatus = 'WAITING' AND b.bookingStatus IN ('REJECTED','GCC_BLOCKED') ") + // @Query("SELECT b FROM BookingDetails b WHERE b.refundStatus = 'WAITING' AND + // b.bookingStatus IN ('REJECTED','GCC_BLOCKED')") List findAllSettlementRejectedList(); - @Query("SELECT b FROM BookingDetails b WHERE b.refundStatus = 'FAILURE' AND b.bookingStatus = 'APPROVED'") + @Query("SELECT b FROM BookingDetails b WHERE b.refundStatus = 'FAILURE' AND b.bookingStatus = 'APPROVED' ") List findAllSettlementRefundFailed(); @Query("SELECT b FROM BookingDetails b WHERE b.refundStatus = 'FAILURE' AND b.bookingStatus = 'CANCELED'") @@ -1848,4 +1854,16 @@ public interface BookingDetailsRepository extends JpaRepository getApprovedBookingListforReschedule(); + + // Newly added to get collection pending list alone for care taker, officer, HQ + // and Admin + + @Query(value = "SELECT * FROM booking_details WHERE DATE(start_date) <= CURRENT_DATE() AND hall_details_hall_id = :hallId and booking_status='APPROVED' and refund_status IN ('COLLECTION_PENDING')", nativeQuery = true) + public List getCollectionPendingList(Integer hallId); + + @Query(value = "SELECT * FROM booking_details WHERE DATE(start_date) <= CURRENT_DATE() AND hall_details_hall_id IN (:hallIds) AND booking_status='APPROVED' AND refund_status IN ('COLLECTION_PENDING')", nativeQuery = true) + public List getCollectionPendingListByHallIds(@Param("hallIds") List hallIds); + + @Query(value = "SELECT * FROM booking_details WHERE DATE(start_date) <= CURRENT_DATE() AND booking_status='APPROVED' AND refund_status IN ('COLLECTION_PENDING')", nativeQuery = true) + public List getAllCollectionPendingList(); } diff --git a/src/main/java/com/gcc/communityHall/repository/RescheduleConfigRepository.java b/src/main/java/com/gcc/communityHall/repository/RescheduleConfigRepository.java new file mode 100644 index 00000000..7561a24d --- /dev/null +++ b/src/main/java/com/gcc/communityHall/repository/RescheduleConfigRepository.java @@ -0,0 +1,10 @@ +package com.gcc.communityHall.repository; + +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +import com.gcc.communityHall.entity.RescheduleConfig; + +@Repository +public interface RescheduleConfigRepository extends JpaRepository { +} 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 c590ee3a..a16e0123 100644 --- a/src/main/java/com/gcc/communityHall/service/Impl/BookingServiceImpl.java +++ b/src/main/java/com/gcc/communityHall/service/Impl/BookingServiceImpl.java @@ -222,19 +222,39 @@ public class BookingServiceImpl implements BookingService { } // ak + // @Transactional + // public String getBookingRefIdByBookingId(int bookingId) { + + // String refId = bookingDetailsRepository.getRefIdByBookingId(bookingId); + + // // If missing → create new + // if (refId == null || refId.trim().isEmpty()) { + + // // Generate refId using coworkspace logic + // refId = UuidBookingUtil.generateRefIdForBooking(bookingId); + + // // Update using JPA repository + // bookingDetailsRepository.updateRefId(refId, bookingId); + // } + + // return refId; + // } + @Transactional public String getBookingRefIdByBookingId(int bookingId) { + Optional optBooking = bookingDetailsRepository.findById(bookingId); + if (!optBooking.isPresent()) { + return null; + } - String refId = bookingDetailsRepository.getRefIdByBookingId(bookingId); + BookingDetails booking = optBooking.get(); + String refId = booking.getBookingRefId(); - // If missing → create new + // If missing → generate, set on entity, and save if (refId == null || refId.trim().isEmpty()) { - - // Generate refId using coworkspace logic refId = UuidBookingUtil.generateRefIdForBooking(bookingId); - - // Update using JPA repository - bookingDetailsRepository.updateRefId(refId, bookingId); + booking.setBookingRefId(refId); + bookingDetailsRepository.save(booking); } return refId; @@ -1885,6 +1905,16 @@ public class BookingServiceImpl implements BookingService { settlement.setCollectionPending(0); } settlementRepository.save(settlement); + + if (settlement.getCollectionPending() == 0 && settlement.getRefundedAmount() == 0) { + book.setBookingStatus(BookingStatus.COMPLETED); + book.setRefundStatus(RefundStatus.COMPLETED); + } else if (settlement.getCollectionPending() > 0) { + book.setRefundStatus(RefundStatus.COLLECTION_PENDING); + } + + bookingDetailsRepository.save(book); + return "Success"; } @@ -2677,9 +2707,10 @@ public class BookingServiceImpl implements BookingService { && descriptions.length > 0) { int i = 0; for (MultipartFile document : documents) { - String filePath = uploadDirectory + "/" + gcc.getBlockingId() + "_" + i + "_" + String filePath = uploadDirectory + "/gccblockingdocs/" + gcc.getBlockingId() + "_" + i + + "_" + document.getOriginalFilename(); - String documentUrl = serverPath + "gccblockingdocs/" + gcc.getBlockingId() + "_" + i + String documentUrl = serverPath + "/gccblockingdocs/" + gcc.getBlockingId() + "_" + i + "_" + document.getOriginalFilename(); try (FileOutputStream fos = new FileOutputStream(filePath)) { @@ -2822,9 +2853,9 @@ public class BookingServiceImpl implements BookingService { if (descriptions != null && descriptions.length == documents.length) { int i = 0; for (MultipartFile document : documents) { - String filePath = uploadDirectory + "/" + gcc.getBlockingId() + "_" + i + "_" + String filePath = uploadDirectory + "/gccblockingdocs/" + gcc.getBlockingId() + "_" + i + "_" + document.getOriginalFilename(); - String documentUrl = serverPath + "gccblockingdocs/" + gcc.getBlockingId() + "_" + i + "_" + String documentUrl = serverPath + "/gccblockingdocs/" + gcc.getBlockingId() + "_" + i + "_" + document.getOriginalFilename(); try (FileOutputStream fos = new FileOutputStream(filePath)) { @@ -3407,9 +3438,9 @@ public class BookingServiceImpl implements BookingService { && descriptions.length == documents.length) { for (int i = 0; i < documents.length; i++) { MultipartFile document = documents[i]; - String filePath = uploadDirectory + "/" + savedGcc.getBlockingId() + "_" + i + "_" + String filePath = uploadDirectory + "/gccblockingdocs/" + savedGcc.getBlockingId() + "_" + i + "_" + document.getOriginalFilename(); - String documentUrl = serverPath + "gccblockingdocs/" + savedGcc.getBlockingId() + "_" + i + "_" + String documentUrl = serverPath + "/gccblockingdocs/" + savedGcc.getBlockingId() + "_" + i + "_" + document.getOriginalFilename(); try (FileOutputStream fos = new FileOutputStream(filePath)) { fos.write(document.getBytes()); diff --git a/src/main/resources/templates/admin/collection-pending.html b/src/main/resources/templates/admin/collection-pending.html new file mode 100644 index 00000000..e4554f75 --- /dev/null +++ b/src/main/resources/templates/admin/collection-pending.html @@ -0,0 +1,741 @@ + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + \ No newline at end of file diff --git a/src/main/resources/templates/admin/ongoingevents.html b/src/main/resources/templates/admin/ongoingevents.html index 019fea9e..513dafc6 100644 --- a/src/main/resources/templates/admin/ongoingevents.html +++ b/src/main/resources/templates/admin/ongoingevents.html @@ -94,6 +94,8 @@ Reason for Booking Caretaker Name/MobileNumber Action--> + Zone + Division Hall Name Booking Id Start Date @@ -119,14 +121,18 @@ --> + + - - - + + + + +

Settlement + th:if="${booking.ebDetails != null and booking.settlement == null}" + th:onclick="settleTheAmount([[${booking.bookingId}]])">Settlement

- + @@ -175,6 +182,8 @@ Reason for Booking Caretaker Name/MobileNumber Action--> + Zone + Division Hall Name Booking Id Start Date @@ -200,26 +209,30 @@ --> - + + - - - + + + + +

View

- Settlement -

- +

+ @@ -257,7 +270,8 @@ Reason for Booking Caretaker Name/MobileNumber Action--> - + Zone + Division Hall Name Booking Id Start Date @@ -284,14 +298,18 @@ th:text="${booking.hallDetails.hallInchargeName} + ' / ' + ${booking.hallDetails.hallInchargeMobno}"> --> + + - - - + + + + +

- +

- + @@ -642,7 +660,7 @@ $('#SettlementApprovedListTable').DataTable({ dom: 'Bftip', columnDefs: [ - {targets: 'no-sort', orderable: false} + { targets: 'no-sort', orderable: false } ], lengthMenu: [ [50, 100, 200, 500, -1], @@ -661,7 +679,7 @@ $('#cancelledApprovedListTable').DataTable({ dom: 'Bftip', columnDefs: [ - {targets: 'no-sort', orderable: false} + { targets: 'no-sort', orderable: false } ], lengthMenu: [ [50, 100, 200, 500, -1], @@ -680,7 +698,7 @@ $('#rejectedApprovedListTable').DataTable({ dom: 'Bftip', columnDefs: [ - {targets: 'no-sort', orderable: false} + { targets: 'no-sort', orderable: false } ], lengthMenu: [ [50, 100, 200, 500, -1], @@ -718,16 +736,16 @@ }); $('#pendingBookingForm').modal('show'); var todaydate = new Date().toISOString().split('T')[0]; - - // Convert startDate to YYYY-MM-DD format if needed - var startDate = new Date(list.startDate).toISOString().split('T')[0]; // Ensure this is in the correct format - if (startDate > todaydate) { - $('#reasondetails').show(); - $('#rejectbutton').show(); - } else { - $('#reasondetails').hide(); - $('#rejectbutton').hide(); - } + + // Convert startDate to YYYY-MM-DD format if needed + var startDate = new Date(list.startDate).toISOString().split('T')[0]; // Ensure this is in the correct format + if (startDate > todaydate) { + $('#reasondetails').show(); + $('#rejectbutton').show(); + } else { + $('#reasondetails').hide(); + $('#rejectbutton').hide(); + } document.getElementById("td_userName").innerHTML = list.users.name; document.getElementById("td_mobileNumber").innerHTML = list.users.mobileNo; document.getElementById("td_usertype").innerHTML = list.users.usertype; @@ -755,7 +773,7 @@ document.getElementById("td_depositeAmount").innerHTML = '₹ ' + parseFloat(list.depositAmount).toFixed(2); document.getElementById("td_hallAmount").innerHTML = '₹ ' + parseFloat(list.hallAmount).toFixed(2); document.getElementById("td_totalAmount").innerHTML = '₹ ' + parseFloat(list.amountReceived).toFixed(2); - var gstcl = (list.hallAmount * (list.hallDetails.gst/100)); + var gstcl = (list.hallAmount * (list.hallDetails.gst / 100)); var formattedGst = gstcl.toFixed(2); document.getElementById("td_gst").innerHTML = '₹ ' + formattedGst; document.getElementById("td_startDate").innerHTML = list.startDate; @@ -984,54 +1002,54 @@ $('#EBdestailsModal').modal('show'); } $(document).ready(function () { - $("#submitEbDetails").click(function () { - var bookid = parseInt($("#bookingId").val()); - // console.log("bookid = "+ bookid) - var startingReading = $("#startingReading").val(); - // console.log("startingReading = "+ startingReading) - var startingReadingimage = $("#startingReadingimage")[0].files[0]; // Get the file + $("#submitEbDetails").click(function () { + var bookid = parseInt($("#bookingId").val()); + // console.log("bookid = "+ bookid) + var startingReading = $("#startingReading").val(); + // console.log("startingReading = "+ startingReading) + var startingReadingimage = $("#startingReadingimage")[0].files[0]; // Get the file - var formData = new FormData(); - formData.append("bookingId", bookid); - formData.append("startingReading", startingReading); - formData.append("startingReadingimage", startingReadingimage); + var formData = new FormData(); + formData.append("bookingId", bookid); + formData.append("startingReading", startingReading); + formData.append("startingReadingimage", startingReadingimage); - $.ajax({ - type: "POST", - url: "/communityhall/careTaker/api/saveEbDetails", - data: formData, - contentType: false, // Prevent jQuery from setting content type - processData: false, // Prevent jQuery from processing the data - success: function (response) { - $("#EBdestailsModal").modal('hide'); + $.ajax({ + type: "POST", + url: "/communityhall/careTaker/api/saveEbDetails", + data: formData, + contentType: false, // Prevent jQuery from setting content type + processData: false, // Prevent jQuery from processing the data + success: function (response) { + $("#EBdestailsModal").modal('hide'); - // Show SweetAlert success message - Swal.fire({ - title: 'Success!', - text: 'EB details saved successfully.', - icon: 'success', - confirmButtonText: 'OK' - }).then(function() { - // Reload the page after the alert is dismissed - location.reload(); - }); - }, - error: function (xhr, status, error) { - console.error(xhr.responseText); - alert("Error occurred while saving EbDetails."); - } - }); - }); -}); + // Show SweetAlert success message + Swal.fire({ + title: 'Success!', + text: 'EB details saved successfully.', + icon: 'success', + confirmButtonText: 'OK' + }).then(function () { + // Reload the page after the alert is dismissed + location.reload(); + }); + }, + error: function (xhr, status, error) { + console.error(xhr.responseText); + alert("Error occurred while saving EbDetails."); + } + }); + }); + }); -document.getElementById('EBdetailsModal').addEventListener('hide.bs.modal', function () { - // Clear the startingReading input field - document.getElementById('startingReading').value = ''; + document.getElementById('EBdetailsModal').addEventListener('hide.bs.modal', function () { + // Clear the startingReading input field + document.getElementById('startingReading').value = ''; - // Clear the startingReadingimage file input field - document.getElementById('startingReadingimage').value = ''; - }); - function settleTheAmount(bookingId) { + // Clear the startingReadingimage file input field + document.getElementById('startingReadingimage').value = ''; + }); + function settleTheAmount(bookingId) { window.location.href = '/communityhall/admin/raisesettlement?bookingId=' + bookingId; } diff --git a/src/main/resources/templates/admin/refund-failedlist.html b/src/main/resources/templates/admin/refund-failedlist.html index d691c7e4..43a86706 100644 --- a/src/main/resources/templates/admin/refund-failedlist.html +++ b/src/main/resources/templates/admin/refund-failedlist.html @@ -137,6 +137,8 @@ S.no + Zone + Division Booking Id Booking Date Hall Name @@ -150,6 +152,8 @@ + + @@ -185,6 +189,8 @@ S.no + Zone + Division Booking Id Booking Date Hall Name @@ -199,6 +205,8 @@ + + diff --git a/src/main/resources/templates/admin/settlement-completed.html b/src/main/resources/templates/admin/settlement-completed.html index 0f582933..5a919936 100644 --- a/src/main/resources/templates/admin/settlement-completed.html +++ b/src/main/resources/templates/admin/settlement-completed.html @@ -78,7 +78,8 @@ S.no - Zone/Division + Zone + Division Hall Name Booking Id Booking Date @@ -95,8 +96,10 @@ + + + th:text="${settlements.hallDetails.division}"> @@ -144,6 +147,8 @@ S.no + Zone + Division Booking Id Booking Date Hall Name @@ -157,6 +162,12 @@ + + + + @@ -199,6 +210,8 @@ S.no + Zone + Division Booking Id Booking Date Hall Name @@ -213,6 +226,12 @@ + + + + @@ -385,26 +404,33 @@ EB Details - Consumer Number: + Consumer + Number: - + - EB Amount Per Unit: + EB Amount Per + Unit: - MF DT Unit: + MF DT Unit: + - Start Reading: + Start Reading: + - END Reading: + END Reading: + - Unit Consumed: + Unit Consumed: + diff --git a/src/main/resources/templates/admin/settlement-list.html b/src/main/resources/templates/admin/settlement-list.html index 8565244c..3345c49c 100644 --- a/src/main/resources/templates/admin/settlement-list.html +++ b/src/main/resources/templates/admin/settlement-list.html @@ -63,14 +63,14 @@ GCC Blocked/Rejected Refund -