Browse Source

Following changes are implemented in this commit

1. Zone, Ward Values added in the following login for all Types of reports ( admin, HQ, officer and Care taker)
2. Collection Pending List menu newly added in the following logins ( admin, HQ, officer and Care taker)
3. Counter Login Disabled
master
KaNi-04 3 weeks ago
parent
commit
8b9262c9b6
  1. 14
      src/main/java/com/gcc/communityHall/controller/Admincontroller.java
  2. 3
      src/main/java/com/gcc/communityHall/controller/CROController.java
  3. 8
      src/main/java/com/gcc/communityHall/controller/CareTakerAPIController.java
  4. 19
      src/main/java/com/gcc/communityHall/controller/CareTakerController.java
  5. 16
      src/main/java/com/gcc/communityHall/controller/HeadquartersController.java
  6. 22
      src/main/java/com/gcc/communityHall/controller/OfficerController.java
  7. 1
      src/main/java/com/gcc/communityHall/controller/UserController.java
  8. 2
      src/main/java/com/gcc/communityHall/entity/BookingDetails.java
  9. 82
      src/main/java/com/gcc/communityHall/entity/RescheduleConfig.java
  10. 12
      src/main/java/com/gcc/communityHall/paymentService/controller/PaymentController.java
  11. 3
      src/main/java/com/gcc/communityHall/paymentService/entity/RefundResponse.java
  12. 40
      src/main/java/com/gcc/communityHall/repository/BookingDetailsRepository.java
  13. 10
      src/main/java/com/gcc/communityHall/repository/RescheduleConfigRepository.java
  14. 57
      src/main/java/com/gcc/communityHall/service/Impl/BookingServiceImpl.java
  15. 741
      src/main/resources/templates/admin/collection-pending.html
  16. 182
      src/main/resources/templates/admin/ongoingevents.html
  17. 8
      src/main/resources/templates/admin/refund-failedlist.html
  18. 44
      src/main/resources/templates/admin/settlement-completed.html
  19. 597
      src/main/resources/templates/admin/settlement-list.html
  20. 88
      src/main/resources/templates/admin/settlementlist.html
  21. 741
      src/main/resources/templates/caretaker/collection-pending.html
  22. 12
      src/main/resources/templates/caretaker/future-booking.html
  23. 338
      src/main/resources/templates/caretaker/past-booking.html
  24. 342
      src/main/resources/templates/caretaker/present-booking.html
  25. 4
      src/main/resources/templates/caretaker/settlementlist.html
  26. 7
      src/main/resources/templates/cro/booking-list.html
  27. 9
      src/main/resources/templates/fragments/adminMenu.html
  28. 9
      src/main/resources/templates/fragments/headquartersMenu.html
  29. 7
      src/main/resources/templates/fragments/menuCaretaker.html
  30. 8
      src/main/resources/templates/fragments/menuOfficer.html
  31. 64
      src/main/resources/templates/fragments/nav-usermenu.html
  32. 741
      src/main/resources/templates/headquarters/collection-pending.html
  33. 114
      src/main/resources/templates/headquarters/ongoingevents.html
  34. 401
      src/main/resources/templates/headquarters/refund-failedlist.html
  35. 44
      src/main/resources/templates/headquarters/settlement-completed.html
  36. 610
      src/main/resources/templates/headquarters/settlement-list.html
  37. 88
      src/main/resources/templates/headquarters/settlementlist.html
  38. 472
      src/main/resources/templates/officer/booking-list.html
  39. 741
      src/main/resources/templates/officer/collection-pending.html
  40. 145
      src/main/resources/templates/officer/report.html
  41. 41
      src/main/resources/templates/officer/settlement-completed.html
  42. 606
      src/main/resources/templates/officer/settlement-list.html

14
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<BookingDetails> collectionPendingList = bookingRepository.getAllCollectionPendingList();
model.addAttribute("collectionPendingList", collectionPendingList);
return "admin/collection-pending";
} else {
session.invalidate();
return "redirect:/communityhall/login";
}
}
}

3
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<BookingDetails> bookingList = bookingDetailsRepository.getApprovedBookingListforReschedule();
model.addAttribute("bookingList", bookingList);
return "cro/booking-list";
} else {
session.invalidate(); // Invalidate the session to clear all session attributes

8
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);

19
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<BookingDetails> collectionPendingList = bookingRepository.getCollectionPendingList(hallid);
model.addAttribute("caretakerName", caretakerName);
model.addAttribute("collectionPendingList", collectionPendingList);
return "caretaker/collection-pending";
} else {
session.invalidate();
return "redirect:/communityhall/login";
}
}
}

16
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<BookingDetails> collectionPendingList = bookingDetailsRepository.getAllCollectionPendingList();
model.addAttribute("headquartersname", headquartersname);
model.addAttribute("collectionPendingList", collectionPendingList);
return "headquarters/collection-pending";
} else {
session.invalidate();
return "redirect:/communityhall/login";
}
}
}

22
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<Integer> hallIds = (List<Integer>) session.getAttribute("hall_ids");
model.addAttribute("hallIds", hallIds);
List<BookingDetails> collectionPendingList = bookingDetailsRepository
.getCollectionPendingListByHallIds(hallIds);
model.addAttribute("collectionPendingList", collectionPendingList);
return "officer/collection-pending";
} else {
session.invalidate();
return "redirect:/communityhall/login";
}
}
}

1
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";
}

2
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 {

82
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 +
'}';
}
}

12
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;
}

3
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;

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

@ -117,13 +117,13 @@ public interface BookingDetailsRepository extends JpaRepository<BookingDetails,
// + " WHERE hall_details_hall_id =:hallId and booking_status= 'APPROVED' and
// start_date < curdate() ", nativeQuery = true)
@Query(value = "SELECT * FROM booking_details WHERE DATE(start_date) <= CURRENT_DATE() AND hall_details_hall_id = :hallId and booking_status='APPROVED' and refund_status IN ('WAITING','REJECTED','APPROVED')", nativeQuery = true)
@Query(value = "SELECT * FROM booking_details WHERE DATE(start_date) <= CURRENT_DATE() AND hall_details_hall_id = :hallId and booking_status='APPROVED' and refund_status IN ('WAITING','REJECTED','APPROVED','COLLECTION_PENDING')", nativeQuery = true)
public List<BookingDetails> 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<BookingDetails> getSettlementListByHallIds(@Param("hallIds") List<Integer> 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<BookingDetails> getAllSettlementList();
// yoga
@ -448,11 +448,11 @@ public interface BookingDetailsRepository extends JpaRepository<BookingDetails,
@Query("SELECT b FROM BookingDetails b JOIN FETCH b.settlement s WHERE b.refundStatus = 'COMPLETED' AND b.bookingStatus='COMPLETED'")
List<BookingDetails> 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<BookingDetails> findSettlementPendingByZone(String zone, List<Integer> 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<BookingDetails> findSettlementInitiatedPendingByZone(String zone, List<Integer> 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<BookingDetails,
@Query("SELECT b FROM BookingDetails b JOIN FETCH b.settlement s WHERE b.refundStatus = 'REJECTED'")
List<BookingDetails> findAllSettlementRejected();
@Query("SELECT b FROM BookingDetails b WHERE b.refundStatus = 'WAITING' AND b.bookingStatus = 'CANCELED' AND b.hallDetails.zone = :zone 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<BookingDetails> findCancelledListByZone(@Param("zone") String zone,
@Param("hallIds") List<Integer> 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<BookingDetails> findapprovedCancelledListByZone(String zone, @Param("hallIds") List<Integer> 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<BookingDetails> findRejectedListByZone(@Param("zone") String zone,
@Param("hallIds") List<Integer> hallIds);
@ -1585,16 +1585,22 @@ public interface BookingDetailsRepository extends JpaRepository<BookingDetails,
@Query("SELECT b FROM BookingDetails b WHERE b.bookingStatus IN ('REJECTED','GCC_BLOCKED') AND b.refundStatus = 'COMPLETED' AND b.hallDetails.zone = :zone AND b.hallDetails.hallId IN (:hallIds)")
List<BookingDetails> findRejectedSettlementCompletedListbyzone(String zone, List<Integer> 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<BookingDetails> findAllSettlementPending();
@Query("SELECT b FROM BookingDetails b WHERE b.refundStatus = 'WAITING' AND b.bookingStatus = 'CANCELED'")
@Query("SELECT b FROM BookingDetails b WHERE b.refundStatus = 'WAITING' AND b.bookingStatus = 'CANCELED' ")
// @Query("SELECT b FROM BookingDetails b WHERE b.refundStatus = 'WAITING' AND
// b.bookingStatus = 'CANCELED'")
List<BookingDetails> findAllSettlementCancelledList();
@Query("SELECT b FROM BookingDetails b WHERE b.refundStatus = 'WAITING' AND b.bookingStatus IN ('REJECTED','GCC_BLOCKED')")
@Query("SELECT b FROM BookingDetails b WHERE b.refundStatus = 'WAITING' AND b.bookingStatus IN ('REJECTED','GCC_BLOCKED') ")
// @Query("SELECT b FROM BookingDetails b WHERE b.refundStatus = 'WAITING' AND
// b.bookingStatus IN ('REJECTED','GCC_BLOCKED')")
List<BookingDetails> findAllSettlementRejectedList();
@Query("SELECT b FROM BookingDetails b WHERE b.refundStatus = 'FAILURE' AND b.bookingStatus = 'APPROVED'")
@Query("SELECT b FROM BookingDetails b WHERE b.refundStatus = 'FAILURE' AND b.bookingStatus = 'APPROVED' ")
List<BookingDetails> findAllSettlementRefundFailed();
@Query("SELECT b FROM BookingDetails b WHERE b.refundStatus = 'FAILURE' AND b.bookingStatus = 'CANCELED'")
@ -1848,4 +1854,16 @@ public interface BookingDetailsRepository extends JpaRepository<BookingDetails,
@Query(value = "SELECT * FROM booking_details WHERE booking_status in ('APPROVED','WAITING_FOR_NOC') AND refund_status != 'COMPLETED'", nativeQuery = true)
List<BookingDetails> 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<BookingDetails> 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<BookingDetails> getCollectionPendingListByHallIds(@Param("hallIds") List<Integer> 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<BookingDetails> getAllCollectionPendingList();
}

10
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<RescheduleConfig, Integer> {
}

57
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<BookingDetails> 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());

741
src/main/resources/templates/admin/collection-pending.html

@ -0,0 +1,741 @@
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head th:replace="~{fragments/head-admin :: head}"></head>
<meta charset="ISO-8859-1">
<!-- Include DataTables CSS -->
</head>
<style>
.block-content {
padding-bottom: 10px;
}
.small-input {
width: 150px;
/* Adjust the width as needed */
}
.small-table th,
.small-table td {
font-size: 14px;
/* Adjust font size as needed */
}
/* Reduce padding for table cells */
.small-table td,
.small-table th {
padding: 5px;
/* Adjust padding as needed */
}
.card-body table {
width: 100%;
padding: 100px;
}
.card-body th,
td {
padding: 8px;
text-align: left;
}
.amount-cell {
text-align: right;
padding-right: 1rem;
/* Adjust padding as needed */
}
</style>
<body>
<div id="page-container"
class="sidebar-o sidebar-dark enable-page-overlay side-scroll page-header-fixed page-header-dark">
<aside th:replace="~{fragments/aside-right :: aside}"></aside>
<nav th:replace="~{fragments/nav-admin :: nav}"></nav>
<header th:replace="~{fragments/header-admin :: header}"></header>
<div class="content" style="margin-top: 77px;">
<div class="block block-rounded">
<div class="block-header bg-info text-white" style="background-color: #2c726c !important">
<h3 class="block-title">Settlement List</h3>
</div>
<div class="block-content">
<div class="table-responsive">
<table id="settlementListTable" class="table table-bordered table-vcenter">
<thead>
<tr>
<th>S.No</th>
<th>Zone</th>
<th>Division</th>
<th>Booking Id</th>
<th>Booking Date</th>
<th>Settlement id</th>
<th>Settlement Raised Date</th>
<th>Deposit Amount</th>
<th>Collection Pending(if any)</th>
<th>Refund Amount</th>
<th>Refund Status</th>
<th>View Details</th>
</tr>
</thead>
<tbody>
<!-- Iterate over past bookings and display them -->
<tr th:each="settlemetList,rowStat : ${collectionPendingList}"
th:if="${settlemetList.settlement != null}">
<td class="text-center" th:text="${rowStat.index + 1}"></td>
<td class="text-center" th:text="${settlemetList.hallDetails.zone}"></td>
<td class="text-center" th:text="${settlemetList.hallDetails.division}"></td>
<td class="text-center" th:text="${settlemetList.bookingId}"></td>
<td class="text-center" th:text="${settlemetList.bookingDate}"></td>
<td class="text-center" th:text="${settlemetList.settlement.settlementId}"></td>
<td class="text-center" th:text="${settlemetList.settlement.cdate}"></td>
<td class="text-center" th:text="${settlemetList.settlement.depositAmount}"></td>
<td class="text-center" th:text="${settlemetList.settlement.collectionPending}">
</td>
<td class="text-center" th:text="${settlemetList.settlement.refundedAmount}"></td>
<td class="text-center" th:text="${settlemetList.refundStatus}"></td>
<td>
<span class="badge bg-primary" style="cursor:pointer"
th:onclick="approve([[${settlemetList.settlement.settlementId}]])">View</span>
<!-- <span class="badge bg-warning" style="cursor: pointer;"
th:if="${#strings.trim(settlemetList.RefundStatus) == 'REJECTED'}"
th:onclick="settleTheAmount([[${settlemetList.bookingId}]])">Raise
Again</span> -->
<span class="badge bg-warning" style="cursor: pointer;"
th:if="${settlemetList.settlement.collectionPending > 0} and ${settlemetList.settlement.collectionStatus != 'paid'}"
th:onclick="|fetchQRCode(${settlemetList.bookingId})|">QR
</span>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div><br>
<br>
<br>
<br>
</div>
<!--modal for pending-->
<div class="modal fade backdrop" id="settlementinformation" data-backdrop="static" tabindex="-1" role="dialog"
aria-labelledby="staticBackdropLabel" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<form id="ownform">
<div class="block block-rounded block-themed block-transparent mb-0">
<div class="block-header bg-primary-dark">
<h3 class="block-title" id="2mtitle">Settlement Information</h3>
<div class="block-options">
<button type="button" class="btn-block-option" data-bs-dismiss="modal"
aria-label="Close">
<i class="fa fa-fw fa-times"></i>
</button>
</div>
</div>
<div class="block-content row">
<div class="col-md-12 col-lg-12 col-sm-12">
<input type="hidden" class="form-control text-center" name="settlementid"
id="settlementid" disabled />
<div class="card-body">
<table>
<tr>
<th colspan="10" style="background-color: #f2f2f2;">User Details</th>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal;">User Name:</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;" id="td_userName">
</td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal;">Mobile Number:
</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_mobileNumber"></td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal;">User Type:</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;" id="td_usertype">
</td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal;">User Address:</th>
<td colspan="5" class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_useraddress"></td>
</tr>
</table>
</div>
</div>
<div class="col-md-12 col-lg-12 col-sm-12">
<input type="hidden" class="form-control text-center" name="settlementid"
id="settlementid" disabled />
<div class="card-body">
<table>
<tr>
<th colspan="4" style="background-color: #f2f2f2;">Booking
Details(Booking Id:-<span id="booking_id" style="color:blue"></span>)
</th>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Booking Date:</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_bookingDate"></td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Deposit Amount:
</th>
<td class="fw-semibold amount-cell" style="padding: 0.45rem 0.45rem;"
id="td_depositeAmount"></td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Start Date:</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;" id="td_startDate">
</td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Hall Amount:</th>
<td class="fw-semibold amount-cell" style="padding: 0.45rem 0.45rem;"
id="td_hallAmount"></td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">END
Date:</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;" id="td_endDate">
</td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">GST @18%:</th>
<td class="fw-semibold amount-cell" style="padding: 0.45rem 0.45rem;"
id="td_gst"></td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Starting Slot:</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_startingSlot"></td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Total Amount:</th>
<td class="fw-semibold amount-cell" style="padding: 0.45rem 0.45rem;"
id="td_totalAmount"></td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Ending Slot:</th>
<td colspan="3" class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_endingSlot"></td>
</tr>
</table>
</div>
</div>
<div class="col-md-12 col-lg-12 col-sm-12">
<div class="card-body">
<table>
<tr>
<th colspan="6" style="background-color: #f2f2f2;">EB Details</th>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Consumer Number:
</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;" id="td_EBNumber">
</td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">EB Amount Per Unit:
</th>
<td class="fw-semibold amount-cell" style="padding: 0.45rem 0.45rem;"
id="td_ebamountperunit"></td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">MF DT Unit:</th>
<td class="fw-semibold amount-cell" style="padding: 0.45rem 0.45rem;"
id="td_mfDtUnit"></td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Start Reading:</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_startingReading"></td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">END Reading:</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_endingReading"></td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Unit Consumed:</th>
<td class="fw-semibold amount-cell" style="padding: 0.45rem 0.45rem;"
id="td_usedunit"></td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">EB Amount:</th>
<td colspan="5" class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_electricityamount"></td>
</tr>
</table>
</div>
</div>
<div id="damageDetails" style="margin-bottom: -17px;"></div>
<div class="col-md-12 col-lg-12 col-sm-12">
<div class="card-body">
<table>
<tr>
<th colspan="2" style="background-color: #f2f2f2;">Amount
to be Refunded</th>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Deposit Amount:
</th>
<td class="fw-semibold amount-cell" style="padding: 0.45rem 0.45rem;"
id="td_depositeamountforrefund">0</td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">EB Amount:</th>
<td class="fw-semibold amount-cell"
style="padding: 0.45rem 0.45rem;color:red" id="td_ebAmount">0</td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Damage(if any):
</th>
<td class="fw-semibold amount-cell"
style="padding: 0.45rem 0.45rem;color:red" id="td_damage">0</td>
</tr>
<tr id="pendingcolumn">
<th id="th_settel_label"
style="padding: 0.45rem 0.45rem;font-weight: normal">Collection Pending
Amount:</th>
<td class="fw-semibold amount-cell"
style="padding: 0.45rem 0.45rem; color: green;" id="td_pending_amt">0
</td>
</tr>
<tr id="collectionstatuscolumn">
<th id="label" style="padding: 0.45rem 0.45rem;font-weight: normal">
Collection Pending Status
:</th>
<td class="fw-semibold amount-cell"
style="padding: 0.45rem 0.45rem; color: green;"
id="td_collection_status">
</td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Actual refundable
Amount:</th>
<td class="fw-semibold amount-cell"
style="padding: 0.45rem 0.45rem; color: green;" id="td_settel_amt">0
</td>
</tr>
</table>
</div>
</div>
<!-- End damage detail -->
</div>
<div class="block-content block-content-full text-end bg-body" id="mbutton2">
<button type="button" class="btn btn-sm btn-alt-secondary"
data-bs-dismiss="modal">Close</button>
<a id="downloadLink" style="display: none;"></a>
</div>
</div>
</form>
</div>
</div>
</div>
<div class="modal fade" id="fileModal" tabindex="-1" role="dialog" aria-labelledby="fileModalLabel"
aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="fileModalLabel">File Preview</h5>
<button type="button" class="close" data-bs-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<embed id="filePreview" src="" width="100%" height="600px">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="qrview" tabindex="-1" role="dialog" aria-labelledby="fileModalLabel" aria-hidden="true">
<div class="modal-dialog modal-sm" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="qrview">QR Code for Collection Pending</h5>
</div>
<div class="modal-body">
<div>
<img style="border:4px solid #15455D;width: 256px; height: 260px;border-radius:10px;"
id="qrCodeImage" alt="QR Code">
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<div th:replace="~{fragments/resetpassword :: div}"></div>
<script th:replace="~{fragments/script :: script}"></script>
<footer th:replace="~{fragments/footer2 :: footer}"></footer>
<script th:replace="~{fragments/loginscript :: script}"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script>
<script>
$(document).ready(
function () {
// DataTables buttons configuration
var buttons = [{
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'
},
];
$('#settlementListTable').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']],
scrollY: '50vh',
fixedColumns: {
left: 1,
right: 1
},
buttons: [buttons],
responsive: true,
searching: true, // Enable search
select: false,
processing: false,
});
// Link the search input to DataTable
$('#searchInput').on('keyup', function () {
dataTable.search(this.value).draw();
});
});
function showDamageImage(imageUrl) {
document.getElementById('filePreview').src = imageUrl;
$('#fileModal').modal('show');
}
function settleTheAmount(bookingId) {
window.location.href = '/communityhall/caretaker/caretakerpage?bookingId=' + bookingId;
}
function approve(settlementId) {
$.ajax({
type: "GET",
url: '/communityhall/api/officer/getSettlementList',
data: {
'settlementsid': settlementId
},
success: function (x) {
showSettlementInfo(x)
showDamageDetails(x);
}
});
}
function showSettlementInfo(list) {
$('#settlementinformation').modal({
backdrop: 'static',
keyboard: false
});
$('#settlementinformation').modal('show');
document.getElementById("settlementid").value = list.settlement.settlementId;
document.getElementById("td_userName").innerHTML = list.users.name;
document.getElementById("td_mobileNumber").innerHTML = list.users.mobileNo;
document.getElementById("td_usertype").innerHTML = list.users.usertype;
var userDetails = list.users;
var userDetailsString =
userDetails.doorNo + ", " +
userDetails.street + ", " +
userDetails.area + ", " +
userDetails.location + " ,Chennai- " +
userDetails.pinCode;
document.getElementById("td_useraddress").innerHTML = userDetailsString;
document.getElementById("td_bookingDate").innerHTML = list.bookingDate;
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 formattedGst = gstcl.toFixed(2);
document.getElementById("td_gst").innerHTML = "₹ " + formattedGst;
document.getElementById("td_startDate").innerHTML = list.startDate;
document.getElementById("td_endDate").innerHTML = list.endDate;
document.getElementById("booking_id").innerHTML = list.bookingId;
function getTimeSlot(slotValue) {
var timeSlot;
var trimmedSlotValue = String(slotValue).trim(); // Convert to string and then trim
if (trimmedSlotValue === '1') {
timeSlot = 'Morning';
} else if (trimmedSlotValue === '2') {
timeSlot = 'Evening';
} else {
timeSlot = 'Unknown';
}
return timeSlot;
}
document.getElementById("td_startingSlot").innerHTML = getTimeSlot(list.startingSlot);
document.getElementById("td_endingSlot").innerHTML = getTimeSlot(list.endingSlot);
document.getElementById("td_EBNumber").innerHTML = list.hallDetails.ebNumber;
document.getElementById("td_startingReading").innerHTML = list.ebDetails.startingReading;
document.getElementById("td_endingReading").innerHTML = list.ebDetails.endingReading;
document.getElementById("td_usedunit").innerHTML = list.ebDetails.usedUnit;
document.getElementById("td_ebamountperunit").innerHTML = "₹ " + parseFloat(list.hallDetails.ebCostPerUnit).toFixed(2);
document.getElementById("td_mfDtUnit").innerHTML = "₹ " + parseFloat(list.hallDetails.mfDtUnit).toFixed(2);
document.getElementById("td_depositeamountforrefund").innerHTML = "₹ " + parseFloat(list.depositAmount).toFixed(2);
document.getElementById("td_ebAmount").innerHTML = "₹ " + parseFloat(list.ebDetails.ebAmount).toFixed(2);
document.getElementById("td_electricityamount").innerHTML = "₹ " + parseFloat(list.ebDetails.ebAmount).toFixed(2);
document.getElementById("td_damage").innerHTML = "₹ " + parseFloat(list.settlement.damageAmount).toFixed(2);
var eb_amt = list.ebDetails.ebAmount;
var deposit_amt = list.depositAmount;
var tem_total = deposit_amt - eb_amt;
$("#td_settel_amt").html('');
$("#td_settel_amt").html(tem_total);
}
function showDamageDetails(data) {
var damageFieldContainer = $('#damageDetails');
damageFieldContainer.empty();
// Create a div for table responsiveness
var tableResponsiveDiv = $('<div>').addClass('table-responsive').css('margin-right', '-24px');
// Create table with similar classes and styles to the modal table
var table = $('<table>').addClass('table table-bordered table-striped').css({ 'width': '97%', 'border-color': 'black', 'border-top-color': 'white' });
var thead = $('<thead>').addClass('thead-light');
var tbody = $('<tbody>');
// Create Damage Details header row
var headerRow = $('<tr>').appendTo(thead);
$('<th>').attr('colspan', '6').text('Damage Details (if any)').css({
'padding': '0.45rem 0.45rem',
'background-color': '#f2f2f2',
'font-weight': 'bold',
'color': 'black',
}).appendTo(headerRow);
// Create table header row
var columnHeadersRow = $('<tr>').css('background-color', '#f2f2f2').appendTo(thead);
$('<th>').text('S.No').css({ 'padding': '0.45rem 0.45rem', 'text-align': 'center' }).appendTo(columnHeadersRow);
$('<th>').text('Asset Name').css({ 'padding': '0.45rem 0.45rem', 'text-align': 'center' }).appendTo(columnHeadersRow);
$('<th>').text('Damage Img').css({ 'padding': '0.45rem 0.45rem', 'text-align': 'center' }).appendTo(columnHeadersRow);
$('<th>').text('Cost').css({ 'padding': '0.45rem 0.45rem', 'text-align': 'center' }).appendTo(columnHeadersRow);
$('<th>').text('Qty').css({ 'padding': '0.45rem 0.45rem', 'text-align': 'center' }).appendTo(columnHeadersRow);
$('<th>').text('Amount').css({ 'padding': '0.45rem 0.45rem', 'text-align': 'center' }).appendTo(columnHeadersRow);
var totalAmount = 0;
// Check if damageList is empty
if (data.damageList.length === 0) {
var row = $('<tr>').appendTo(tbody);
$('<td>').attr('colspan', '6').text('No Damaged Items').css({
'padding': '0.45rem 0.45rem',
'text-align': 'center',
'font-weight': 'bold',
'background-color': '#f2f2f2'
}).appendTo(row);
} else {
$.each(data.damageList, function (index, detail) {
var row = $('<tr>').appendTo(tbody);
$('<td>').text(index + 1).css({
'padding': '0.45rem 0.45rem',
'text-align': 'center'
}).appendTo(row);
$('<td>').text(detail.assetName).css({
'padding': '0.45rem 0.45rem',
'text-align': 'center'
}).appendTo(row);
var viewLink = $('<a>').attr('href', 'javascript:void(0)').text('View').on('click', function () {
showDamageImage(detail.damageImageUrl);
});
$('<td>').css({
'padding': '0.45rem 0.45rem',
'text-align': 'center'
}).append(viewLink).appendTo(row);
var assetamt = (detail.assetAmount / detail.quantity).toFixed(2);
$('<td>').text('₹ ' + assetamt).css({
'padding': '0.45rem 0.45rem',
'text-align': 'center'
}).appendTo(row);
$('<td>').text(detail.quantity).css({
'padding': '0.45rem 0.45rem',
'text-align': 'center'
}).appendTo(row);
var amount = detail.assetAmount;
totalAmount += amount;
$('<td>').text('₹ ' + amount.toFixed(2)).css({
'padding': '0.45rem 0.45rem',
'text-align': 'right'
}).appendTo(row);
});
// Add row for total amount
var totalRow = $('<tr>').appendTo(tbody);
$('<td>').attr('colspan', '5').text('Total Amount').css({
'padding': '0.45rem 0.45rem',
'font-weight': 'bold',
'background-color': '#f2f2f2'
}).appendTo(totalRow);
$('<td>').text('₹ ' + totalAmount.toFixed(2)).css({
'padding': '0.45rem 0.45rem',
'text-align': 'right'
}).appendTo(totalRow);
$("#td_dam_amt").html('₹ ' + totalAmount.toFixed(2));
}
// Append the table elements to the container div
table.append(thead, tbody);
tableResponsiveDiv.append(table);
damageFieldContainer.append(tableResponsiveDiv);
var temp_total = parseFloat($("#td_settel_amt").html());
var settleAmount = temp_total - totalAmount;
if (settleAmount < 0) {
var pendingstatus = data.settlement.collectionStatus;
$("#td_settel_amt").html(0);
$("#pendingcolumn").show();
$("#collectionstatuscolumn").show();
$('#td_collection_status').html(pendingstatus);
$("#td_pending_amt").html(Math.abs(settleAmount).toFixed(2));
$("#td_pending_amt").css("color", "red");
$("#approvebutton").show();
$("#rejectbutton").show();
} else {
$("#td_settel_amt").html('₹ ' + settleAmount.toFixed(2));
$("#pendingcolumn").hide();
$("#collectionstatuscolumn").hide();
$("#td_settel_amt").css("color", "green"); // Set color to green for positive amounts
$("#approvebutton").hide();
$("#rejectbutton").hide();
}
}
function showDamageImage(damageImageUrl) {
document.getElementById('filePreview').src = damageImageUrl;
$('#fileModal').modal('show');
}
function accept() {
let id = document.getElementById("settlementid").value;
Swal.fire({
title: 'Do you want to Approve this Settlement ?',
showDenyButton: true,
showCancelButton: true,
confirmButtonText: 'YES',
denyButtonText: 'NO',
}).then((result) => {
/* Read more about isConfirmed, isDenied below */
if (result.isConfirmed) {
$.ajax({
type: "POST",
url: '/communityhall/api/officer/updateApprovedSettlementStatus/' + id,
data: {
'status': 'COMPLETED',
'comments': 'Accepted',
'settlementId': id
},
success: function (data, textStatus, xhr) {
if (xhr.status === 200) { // Check if the response status is OK
Swal.fire(
'Done',
'Successfully Accepted to the ID:' + id,
'success'
).then(() => {
location.reload();
});
} else {
Swal.fire(
'Error',
'Failed to accept the user',
'error'
);
}
},
error: function (xhr, textStatus, errorThrown) {
Swal.fire(
'Error',
'Failed to accept the user',
'error'
);
}
});
} else if (result.isDenied) {
Swal.fire('Changes are not saved', '', 'info')
}
});
}
function fetchQRCode(bookingId) {
$.ajax({
url: '/communityhall/careTaker/api/generateQRCode',
type: 'GET',
data: { bookingId: bookingId },
success: function (data) {
// Set the QR code image source
$('#qrview').modal('show');
$('#qrCodeImage').attr('src', 'data:image/png;base64,' + data);
// console.log(data);
},
error: function (jqXHR, textStatus, errorThrown) {
console.error('Error fetching QR code:', textStatus, errorThrown);
}
});
}
</script>
</body>
</html>

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

@ -94,6 +94,8 @@
<th class="text-center">Reason for Booking</th>
<th class="text-center">Caretaker Name/MobileNumber</th>
<th class="text-center">Action</th>-->
<th>Zone</th>
<th>Division</th>
<th>Hall Name</th>
<th>Booking Id</th>
<th>Start Date</th>
@ -119,14 +121,18 @@
<td class="text-center"
th:text="${booking.hallDetails.hallInchargeName} + ' / ' + ${booking.hallDetails.hallInchargeMobno}">
</td>-->
<td th:text="${booking.hallDetails.zone}"></td>
<td th:text="${booking.hallDetails.division}"></td>
<td th:text="${booking.hallDetails.hallName}"></td>
<td th:text="${booking.bookingId}"></td>
<td th:text="${booking.startDate}"></td>
<td th:text="${booking.endDate}"></td>
<td th:text="${booking.noOfDays}"></td>
<td th:text="${booking.startingSlot == 1 ? 'Morning' : 'Evening'}"></td>
<td th:text="${booking.endingSlot == 1 ? 'Morning' : 'Evening'}"></td>
<td th:text="${booking.startingSlot == 1 ? 'Morning' : 'Evening'}">
</td>
<td th:text="${booking.endingSlot == 1 ? 'Morning' : 'Evening'}">
</td>
<td>
<p>
<span class="badge bg-warning" style="cursor: pointer;"
@ -134,12 +140,13 @@
</p>
<p>
<span type="button" class="btn btn-primary settlement"
th:if="${booking.ebDetails != null and booking.settlement == null}"
th:onclick="settleTheAmount([[${booking.bookingId}]])">Settlement</button>
th:if="${booking.ebDetails != null and booking.settlement == null}"
th:onclick="settleTheAmount([[${booking.bookingId}]])">Settlement</button>
</p>
<button type="button" class="btn btn-primary" th:if="${booking.ebDetails==null}"
th:onclick="enterStartingReading([[${booking.bookingId}]], '[[${booking.hallDetails.ebNumber}]]')"
id="ebDetails">EB</button>
<button type="button" class="btn btn-primary"
th:if="${booking.ebDetails==null}"
th:onclick="enterStartingReading([[${booking.bookingId}]], '[[${booking.hallDetails.ebNumber}]]')"
id="ebDetails">EB</button>
</td>
</tr>
</tbody>
@ -175,6 +182,8 @@
<th class="text-center">Reason for Booking</th>
<th class="text-center">Caretaker Name/MobileNumber</th>
<th class="text-center">Action</th>-->
<th>Zone</th>
<th>Division</th>
<th>Hall Name</th>
<th>Booking Id</th>
<th>Start Date</th>
@ -200,26 +209,30 @@
<td class="text-center"
th:text="${booking.hallDetails.hallInchargeName} + ' / ' + ${booking.hallDetails.hallInchargeMobno}">
</td>-->
<td th:text="${booking.hallDetails.zone}"></td>
<td th:text="${booking.hallDetails.division}"></td>
<td th:text="${booking.hallDetails.hallName}"></td>
<td th:text="${booking.bookingId}"></td>
<td th:text="${booking.startDate}"></td>
<td th:text="${booking.endDate}"></td>
<td th:text="${booking.noOfDays}"></td>
<td th:text="${booking.startingSlot == 1 ? 'Morning' : 'Evening'}"></td>
<td th:text="${booking.endingSlot == 1 ? 'Morning' : 'Evening'}"></td>
<td th:text="${booking.startingSlot == 1 ? 'Morning' : 'Evening'}">
</td>
<td th:text="${booking.endingSlot == 1 ? 'Morning' : 'Evening'}">
</td>
<td>
<p>
<span class="badge bg-warning" style="cursor: pointer;"
th:onclick="pendingbooking([[${booking.bookingId}]])">View</span>
</p>
<p>
<span type="button" class="btn btn-primary settlement"
th:if="${booking.ebDetails != null and booking.settlement == null}"
th:onclick="settleTheAmount([[${booking.bookingId}]])">Settlement</button>
</p>
<button type="button" class="btn btn-primary" th:if="${booking.ebDetails==null}"
<span type="button" class="btn btn-primary settlement"
th:if="${booking.ebDetails != null and booking.settlement == null}"
th:onclick="settleTheAmount([[${booking.bookingId}]])">Settlement</button>
</p>
<button type="button" class="btn btn-primary"
th:if="${booking.ebDetails==null}"
th:onclick="enterStartingReading([[${booking.bookingId}]], '[[${booking.hallDetails.ebNumber}]]')"
id="ebDetails">EB</button>
</td>
@ -257,7 +270,8 @@
<th class="text-center">Reason for Booking</th>
<th class="text-center">Caretaker Name/MobileNumber</th>
<th class="text-center">Action</th>-->
<th>Zone</th>
<th>Division</th>
<th>Hall Name</th>
<th>Booking Id</th>
<th>Start Date</th>
@ -284,14 +298,18 @@
th:text="${booking.hallDetails.hallInchargeName} + ' / ' + ${booking.hallDetails.hallInchargeMobno}">
</td>-->
<td th:text="${booking.hallDetails.zone}"></td>
<td th:text="${booking.hallDetails.division}"></td>
<td th:text="${booking.hallDetails.hallName}"></td>
<td th:text="${booking.bookingId}"></td>
<td th:text="${booking.startDate}"></td>
<td th:text="${booking.endDate}"></td>
<td th:text="${booking.noOfDays}"></td>
<td th:text="${booking.startingSlot == 1 ? 'Morning' : 'Evening'}"></td>
<td th:text="${booking.endingSlot == 1 ? 'Morning' : 'Evening'}"></td>
<td th:text="${booking.startingSlot == 1 ? 'Morning' : 'Evening'}">
</td>
<td th:text="${booking.endingSlot == 1 ? 'Morning' : 'Evening'}">
</td>
<td>
<p>
<span class="badge bg-warning" style="cursor: pointer;"
@ -513,7 +531,7 @@
</div>
</div>
</div>
<div class="modal fade" id="fileModal" tabindex="-1" role="dialog" aria-labelledby="fileModalLabel"
aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
@ -533,7 +551,7 @@
</div>
</div>
</div>
<div class="modal fade backdrop" id="EBdestailsModal" tabindex="-1" role="dialog"
aria-labelledby="staticBackdropLabel" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
@ -570,8 +588,8 @@
<div class="form-group">
<label for="startingReadingimage">Starting Reading Image<span
class="required"></span>:</label>
<input type="file" class="form-control text-center startreading-image" id="startingReadingimage"
name="startingReadingimage">
<input type="file" class="form-control text-center startreading-image"
id="startingReadingimage" name="startingReadingimage">
</div>
</div>
</div>
@ -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;
}
</script>

8
src/main/resources/templates/admin/refund-failedlist.html

@ -137,6 +137,8 @@
<thead class="thead-light">
<tr>
<th>S.no</th>
<th>Zone</th>
<th>Division</th>
<th>Booking Id</th>
<th>Booking Date</th>
<th>Hall Name</th>
@ -150,6 +152,8 @@
<tbody>
<tr th:each="cancelledbookings, rowStat : ${refundfailedcancelledbookings}">
<td class="text-center" th:text="${rowStat.index + 1}"></td>
<td th:text="${cancelledbookings.hallDetails.zone}"></td>
<td th:text="${cancelledbookings.hallDetails.division}"></td>
<td class="text-center" th:text="${cancelledbookings.bookingId}"></td>
<td class="text-center" th:text="${cancelledbookings.bookingDate}"></td>
<td class="text-center" th:text="${cancelledbookings.hallDetails.hallName}">
@ -185,6 +189,8 @@
<thead class="thead-light">
<tr>
<th>S.no</th>
<th>Zone</th>
<th>Division</th>
<th>Booking Id</th>
<th>Booking Date</th>
<th>Hall Name</th>
@ -199,6 +205,8 @@
<tbody>
<tr th:each="rejectedbookings, rowStat : ${refundfailedrejectedbookings}">
<td class="text-center" th:text="${rowStat.index + 1}"></td>
<td th:text="${rejectedbookings.hallDetails.zone}"></td>
<td th:text="${rejectedbookings.hallDetails.division}"></td>
<td class="text-center" th:text="${rejectedbookings.bookingId}"></td>
<td class="text-center" th:text="${rejectedbookings.bookingDate}"></td>
<td class="text-center" th:text="${rejectedbookings.hallDetails.hallName}">

44
src/main/resources/templates/admin/settlement-completed.html

@ -78,7 +78,8 @@
<thead class="thead-light">
<tr>
<th>S.no</th>
<th>Zone/Division</th>
<th>Zone</th>
<th>Division</th>
<th>Hall Name</th>
<th>Booking Id</th>
<th width="10%">Booking Date</th>
@ -95,8 +96,10 @@
<tr th:each="settlements, rowStat : ${completedlist}"
th:if="${settlements.settlement != null}">
<td class="text-center" th:text="${rowStat.index + 1}"></td>
<td class="text-center" th:text="${settlements.hallDetails.zone}">
</td>
<td class="text-center"
th:text="${settlements.hallDetails.zone + ' / ' + settlements.hallDetails.division}">
th:text="${settlements.hallDetails.division}">
</td>
<td class="text-center"
th:text="${settlements.hallDetails.hallName}"></td>
@ -144,6 +147,8 @@
<thead class="thead-light">
<tr>
<th>S.no</th>
<th>Zone</th>
<th>Division</th>
<th>Booking Id</th>
<th>Booking Date</th>
<th>Hall Name</th>
@ -157,6 +162,12 @@
<tbody>
<tr th:each="cancelledbookings, rowStat : ${cancelledcompletedlist}">
<td class="text-center" th:text="${rowStat.index + 1}"></td>
<td class="text-center"
th:text="${cancelledbookings.hallDetails.zone}">
</td>
<td class="text-center"
th:text="${cancelledbookings.hallDetails.division}">
</td>
<td class="text-center" th:text="${cancelledbookings.bookingId}">
</td>
<td class="text-center" th:text="${cancelledbookings.bookingDate}">
@ -199,6 +210,8 @@
<thead class="thead-light">
<tr>
<th>S.no</th>
<th>Zone</th>
<th>Division</th>
<th>Booking Id</th>
<th>Booking Date</th>
<th>Hall Name</th>
@ -213,6 +226,12 @@
<tbody>
<tr th:each="rejectedbookings, rowStat : ${rejectedcompletedlist}">
<td class="text-center" th:text="${rowStat.index + 1}"></td>
<td class="text-center"
th:text="${rejectedbookings.hallDetails.zone}">
</td>
<td class="text-center"
th:text="${rejectedbookings.hallDetails.division}">
</td>
<td class="text-center" th:text="${rejectedbookings.bookingId}">
</td>
<td class="text-center" th:text="${rejectedbookings.bookingDate}">
@ -385,26 +404,33 @@
<th colspan="6" style="background-color: #f2f2f2;">EB Details</th>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Consumer Number:
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Consumer
Number:
</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;" id="td_EBNumber">
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_EBNumber">
</td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">EB Amount Per Unit:
<th style="padding: 0.45rem 0.45rem;font-weight: normal">EB Amount Per
Unit:
</th>
<td class="fw-semibold amount-cell" style="padding: 0.45rem 0.45rem;"
id="td_ebamountperunit"></td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">MF DT Unit:</th>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">MF DT Unit:
</th>
<td class="fw-semibold amount-cell" style="padding: 0.45rem 0.45rem;"
id="td_mfDtUnit"></td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Start Reading:</th>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Start Reading:
</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_startingReading"></td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">END Reading:</th>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">END Reading:
</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_endingReading"></td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Unit Consumed:</th>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Unit Consumed:
</th>
<td class="fw-semibold amount-cell" style="padding: 0.45rem 0.45rem;"
id="td_usedunit"></td>
</tr>

597
src/main/resources/templates/admin/settlement-list.html

@ -63,14 +63,14 @@
<a class="nav-link" id="gcc-tab" data-toggle="tab" href="#gcc" role="tab" aria-controls="gcc"
aria-selected="false">GCC Blocked/Rejected Refund</a>
</li>
<li class="nav-item" role="presentation">
<!-- <li class="nav-item" role="presentation">
<a class="nav-link" id="settlement-initiated-tab"
data-toggle="tab"
href="#settlement-initiated"
role="tab"
aria-controls="settlement-initiated"
aria-selected="false">Settlement Initiated</a>
</li>
</li> -->
</ul>
<div class="tab-content" id="myTabContent">
<!-- Settlement Approval Tab -->
@ -81,7 +81,8 @@
<div class="block-content p-0">
<div class="p-sm-4 p-0">
<div class="table-responsive">
<table class="table table-bordered table-striped table-vcenter js-dataTable-responsive" id="SettlementApprovedListTable">
<table class="table table-bordered table-striped table-vcenter js-dataTable-responsive"
id="SettlementApprovedListTable">
<thead class="thead-light">
<tr>
<th>S.no</th>
@ -96,12 +97,13 @@
<th>Collection Pending</th>
<th>Refund Amount</th>
<th>Status</th>
<th>Remarks</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<!--<tr th:each="settlement, rowStat : ${settlementlist}">-->
<tr th:each="settlement, rowStat : ${settlementlist}"
<tr th:each="settlement, rowStat : ${settlementlist}"
th:if="${settlement.settlement.approvedFlag == 0 or settlement.settlement.approvedFlag == null}">
<td class="text-center" th:text="${rowStat.index + 1}"></td>
<td class="text-center" th:text="${settlement.hallDetails.zone}"></td>
@ -118,11 +120,28 @@
<td class="text-center" th:text="${settlement.settlement.refundedAmount}">
</td>
<td class="text-center" th:text="${settlement.refundStatus}"></td>
<td>
<p>
<td class="text-center">
<span
th:if="${settlement.bookingDate != null and settlement.bookingDate.isBefore(T(java.time.LocalDate).now().minusDays(180))}"
class="text-danger fw-semibold" style="font-size: 12px;">
more than 6 month old booking, so settlement not allowed. please
contact Revenue Department - Head Office.
</span>
<span
th:unless="${settlement.bookingDate != null and settlement.bookingDate.isBefore(T(java.time.LocalDate).now().minusDays(180))}">-</span>
</td>
<td class="text-center">
<p class="mb-0"
th:if="${settlement.bookingDate == null or not settlement.bookingDate.isBefore(T(java.time.LocalDate).now().minusDays(180))}">
<span class="badge bg-warning" style="cursor: pointer;"
th:onclick="pending([[${settlement.settlement.settlementId}]])">Approve</span>
</p>
<p class="mb-0"
th:if="${settlement.bookingDate != null and settlement.bookingDate.isBefore(T(java.time.LocalDate).now().minusDays(180))}">
<span class="badge bg-secondary"
style="cursor: not-allowed; opacity: 0.65;"
title="more than 6 month old booking, so settlement not allowed. please contact HQ">Disabled</span>
</p>
</td>
</tr>
</tbody>
@ -140,10 +159,13 @@
<div class="block-content p-0">
<div class="p-sm-4 p-0">
<div class="table-responsive">
<table class="table table-bordered table-striped table-vcenter js-dataTable-responsive" id="cancelledApprovedListTable">
<table class="table table-bordered table-striped table-vcenter js-dataTable-responsive"
id="cancelledApprovedListTable">
<thead class="thead-light">
<tr>
<th>S.no</th>
<th>Zone</th>
<th>Division</th>
<th>Booking Id</th>
<th>Booking Date</th>
<th>Hall Name</th>
@ -151,12 +173,17 @@
<th>User type</th>
<th>Reason for Booking</th>
<th>Refund Amount</th>
<th>Remarks</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<tr th:each="cancelledbookings, rowStat : ${cancelledbookings}">
<td class="text-center" th:text="${rowStat.index + 1}"></td>
<td class="text-center" th:text="${cancelledbookings.hallDetails.zone}">
</td>
<td class="text-center" th:text="${cancelledbookings.hallDetails.division}">
</td>
<td class="text-center" th:text="${cancelledbookings.bookingId}"></td>
<td class="text-center" th:text="${cancelledbookings.bookingDate}"></td>
<td class="text-center" th:text="${cancelledbookings.hallDetails.hallName}">
@ -164,13 +191,29 @@
<td class="text-center" th:text="${cancelledbookings.users.name}"></td>
<td class="text-center" th:text="${cancelledbookings.users.usertype}"></td>
<td class="text-center" th:text="${cancelledbookings.reason}"></td>
<td class="text-center"
th:text="${cancelledbookings.depositAmount}"></td>
<td>
<p>
<td class="text-center" th:text="${cancelledbookings.depositAmount}"></td>
<td class="text-center">
<span
th:if="${cancelledbookings.bookingDate != null and cancelledbookings.bookingDate.isBefore(T(java.time.LocalDate).now().minusDays(180))}"
class="text-danger fw-semibold" style="font-size: 12px;">
more than 6 month old booking, so settlement not allowed. please
contact Revenue Department - Head Office
</span>
<span
th:unless="${cancelledbookings.bookingDate != null and cancelledbookings.bookingDate.isBefore(T(java.time.LocalDate).now().minusDays(180))}">-</span>
</td>
<td class="text-center">
<p class="mb-0"
th:if="${cancelledbookings.bookingDate == null or not cancelledbookings.bookingDate.isBefore(T(java.time.LocalDate).now().minusDays(180))}">
<span class="badge bg-warning" style="cursor: pointer;"
th:onclick="cancelledbooking([[${cancelledbookings.bookingId}]])">Approve</span>
</p>
<p class="mb-0"
th:if="${cancelledbookings.bookingDate != null and cancelledbookings.bookingDate.isBefore(T(java.time.LocalDate).now().minusDays(180))}">
<span class="badge bg-secondary"
style="cursor: not-allowed; opacity: 0.65;"
title="more than 6 month old booking, so settlement not allowed. please contact HQ">Disabled</span>
</p>
</td>
</tr>
</tbody>
@ -188,10 +231,13 @@
<div class="block-content p-0">
<div class="p-sm-4 p-0">
<div class="table-responsive">
<table class="table table-bordered table-striped table-vcenter js-dataTable-responsive" id="rejectedApprovedListTable">
<table class="table table-bordered table-striped table-vcenter js-dataTable-responsive"
id="rejectedApprovedListTable">
<thead class="thead-light">
<tr>
<th>S.no</th>
<th>Zone</th>
<th>Division</th>
<th>Booking Id</th>
<th>Booking Date</th>
<th>Hall Name</th>
@ -200,12 +246,16 @@
<th>Reason for Booking</th>
<th>Reason for Rejection</th>
<th>Refund Amount</th>
<th>Remarks</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<tr th:each="rejectedbookings, rowStat : ${rejectedbookings}">
<td class="text-center" th:text="${rowStat.index + 1}"></td>
<td class="text-center" th:text="${rejectedbookings.hallDetails.zone}"></td>
<td class="text-center" th:text="${rejectedbookings.hallDetails.division}">
</td>
<td class="text-center" th:text="${rejectedbookings.bookingId}"></td>
<td class="text-center" th:text="${rejectedbookings.bookingDate}"></td>
<td class="text-center" th:text="${rejectedbookings.hallDetails.hallName}">
@ -215,11 +265,28 @@
<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>
<p>
<td class="text-center">
<span
th:if="${rejectedbookings.bookingDate != null and rejectedbookings.bookingDate.isBefore(T(java.time.LocalDate).now().minusDays(180))}"
class="text-danger fw-semibold" style="font-size: 12px;">
more than 6 month old booking, so settlement not allowed. please
contact Revenue Department - Head Office
</span>
<span
th:unless="${rejectedbookings.bookingDate != null and rejectedbookings.bookingDate.isBefore(T(java.time.LocalDate).now().minusDays(180))}">-</span>
</td>
<td class="text-center">
<p class="mb-0"
th:if="${rejectedbookings.bookingDate == null or not rejectedbookings.bookingDate.isBefore(T(java.time.LocalDate).now().minusDays(180))}">
<span class="badge bg-warning" style="cursor: pointer;"
th:onclick="rejectedbooking([[${rejectedbookings.bookingId}]])">Approve</span>
</p>
<p class="mb-0"
th:if="${rejectedbookings.bookingDate != null and rejectedbookings.bookingDate.isBefore(T(java.time.LocalDate).now().minusDays(180))}">
<span class="badge bg-secondary"
style="cursor: not-allowed; opacity: 0.65;"
title="more than 6 month old booking, so settlement not allowed. please contact HQ">Disabled</span>
</p>
</td>
</tr>
</tbody>
@ -242,7 +309,6 @@
<tr>
<th>S.nos</th>
<th>Zone</th>
<th>Division</th>
<th>Hall Name</th>
<th>Booking Id</th>
@ -254,6 +320,7 @@
<th>Refund Amount</th>
<th>Status</th>
<th>Last Initade date</th>
<th>Remarks</th>
<th>Action</th>
</tr>
</thead>
@ -277,13 +344,31 @@
<td class="text-center" th:text="${settlement.settlement.refundedAmount}">
</td>
<td class="text-center" th:text="${settlement.refundStatus}"></td>
<td th:text="${#dates.format(settlement.settlement.approvedFlagDate, 'yyyy-MM-dd')}"></td>
<td>
<p>
<td
th:text="${#dates.format(settlement.settlement.approvedFlagDate, 'yyyy-MM-dd')}">
</td>
<td class="text-center">
<span
th:if="${settlement.bookingDate != null and settlement.bookingDate.isBefore(T(java.time.LocalDate).now().minusDays(180))}"
class="text-danger fw-semibold" style="font-size: 12px;">
more than 6 month old booking, so settlement not allowed. please
contact Revenue Department - Head Office
</span>
<span
th:unless="${settlement.bookingDate != null and settlement.bookingDate.isBefore(T(java.time.LocalDate).now().minusDays(180))}">-</span>
</td>
<td class="text-center">
<p class="mb-0"
th:if="${settlement.bookingDate == null or not settlement.bookingDate.isBefore(T(java.time.LocalDate).now().minusDays(180))}">
<span class="badge bg-warning" style="cursor: pointer;"
th:onclick="pending([[${settlement.settlement.settlementId}]])">Approve</span>
</p>
<p class="mb-0"
th:if="${settlement.bookingDate != null and settlement.bookingDate.isBefore(T(java.time.LocalDate).now().minusDays(180))}">
<span class="badge bg-secondary"
style="cursor: not-allowed; opacity: 0.65;"
title="more than 6 month old booking, so settlement not allowed. please contact HQ">Disabled</span>
</p>
</td>
</tr>
</tbody>
@ -452,26 +537,33 @@
<th colspan="6" style="background-color: #f2f2f2;">EB Details</th>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Consumer Number:
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Consumer
Number:
</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;" id="td_EBNumber">
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_EBNumber">
</td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">EB Amount Per Unit:
<th style="padding: 0.45rem 0.45rem;font-weight: normal">EB Amount Per
Unit:
</th>
<td class="fw-semibold amount-cell" style="padding: 0.45rem 0.45rem;"
id="td_ebamountperunit"></td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">MF DT Unit:</th>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">MF DT Unit:
</th>
<td class="fw-semibold amount-cell" style="padding: 0.45rem 0.45rem;"
id="td_mfDtUnit"></td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Start Reading:</th>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Start Reading:
</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_startingReading"></td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">END Reading:</th>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">END Reading:
</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_endingReading"></td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Unit Consumed:</th>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Unit Consumed:
</th>
<td class="fw-semibold amount-cell" style="padding: 0.45rem 0.45rem;"
id="td_usedunit"></td>
</tr>
@ -520,12 +612,13 @@
0</td>
</tr>
<tr id="collectionstatuscolumn">
<th id="label"
style="padding: 0.45rem 0.45rem;font-weight: normal">Collection Pending Status
:</th>
<td class="fw-semibold amount-cell"
style="padding: 0.45rem 0.45rem; color: green;" id="td_collection_status">
</td>
<th id="label" style="padding: 0.45rem 0.45rem;font-weight: normal">
Collection Pending Status
:</th>
<td class="fw-semibold amount-cell"
style="padding: 0.45rem 0.45rem; color: green;"
id="td_collection_status">
</td>
</tr>
<tr>
<th
@ -794,7 +887,7 @@
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<script>
$(document).ready(function () {
$(document).ready(function () {
var buttons = [
{
extend: 'pageLength',
@ -858,7 +951,7 @@
$('#SettlementApprovedListTable').DataTable({
dom: 'Bftip',
columnDefs: [
{targets: 'no-sort', orderable: false}
{ targets: 'no-sort', orderable: false }
],
lengthMenu: [
[50, 100, 200, 500, -1],
@ -877,7 +970,7 @@
$('#cancelledApprovedListTable').DataTable({
dom: 'Bftip',
columnDefs: [
{targets: 'no-sort', orderable: false}
{ targets: 'no-sort', orderable: false }
],
lengthMenu: [
[50, 100, 200, 500, -1],
@ -896,7 +989,7 @@
$('#rejectedApprovedListTable').DataTable({
dom: 'Bftip',
columnDefs: [
{targets: 'no-sort', orderable: false}
{ targets: 'no-sort', orderable: false }
],
lengthMenu: [
[50, 100, 200, 500, -1],
@ -922,12 +1015,12 @@
showSettlementInfo(x)
showDamageDetails(x);
if (x.settlement && x.settlement.approvedFlag === 1) {
$("#approvebutton").hide();
$("#removebutton").hide();
} else {
$("#approvebutton").show();
$("#removebutton").show();
}
$("#approvebutton").hide();
$("#removebutton").hide();
} else {
$("#approvebutton").show();
$("#removebutton").show();
}
}
});
@ -1021,7 +1114,7 @@
var tableResponsiveDiv = $('<div>').addClass('table-responsive').css('margin-right', '0px');
// Create table with similar classes and styles to the modal table
var table = $('<table>').addClass('table table-bordered table-striped').css({'width': '97%', 'border-color': 'black', 'border-top-color': 'white'});
var table = $('<table>').addClass('table table-bordered table-striped').css({ 'width': '97%', 'border-color': 'black', 'border-top-color': 'white' });
var thead = $('<thead>').addClass('thead-light');
var tbody = $('<tbody>');
@ -1036,12 +1129,12 @@
// Create table header row
var columnHeadersRow = $('<tr>').css('background-color', '#f2f2f2').appendTo(thead);
$('<th>').text('S.No').css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(columnHeadersRow);
$('<th>').text('Asset Name').css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(columnHeadersRow);
$('<th>').text('Damage Img').css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(columnHeadersRow);
$('<th>').text('Cost').css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(columnHeadersRow);
$('<th>').text('Qty').css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(columnHeadersRow);
$('<th>').text('Amount').css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(columnHeadersRow);
$('<th>').text('S.No').css({ 'padding': '0.45rem 0.45rem', 'text-align': 'center' }).appendTo(columnHeadersRow);
$('<th>').text('Asset Name').css({ 'padding': '0.45rem 0.45rem', 'text-align': 'center' }).appendTo(columnHeadersRow);
$('<th>').text('Damage Img').css({ 'padding': '0.45rem 0.45rem', 'text-align': 'center' }).appendTo(columnHeadersRow);
$('<th>').text('Cost').css({ 'padding': '0.45rem 0.45rem', 'text-align': 'center' }).appendTo(columnHeadersRow);
$('<th>').text('Qty').css({ 'padding': '0.45rem 0.45rem', 'text-align': 'center' }).appendTo(columnHeadersRow);
$('<th>').text('Amount').css({ 'padding': '0.45rem 0.45rem', 'text-align': 'center' }).appendTo(columnHeadersRow);
var totalAmount = 0;
@ -1115,7 +1208,22 @@
var temp_total = parseFloat($("#td_settel_amt").html());
var settleAmount = temp_total - totalAmount;
var refundStatus = data.refundStatus;
var pendingstatus=data.settlement.collectionStatus
var pendingstatus = data.settlement.collectionStatus;
var isOldBooking = false;
if (data.bookingDate) {
var bDateParts = String(data.bookingDate).split('-');
if (bDateParts.length === 3) {
var bookingDateObj = new Date(parseInt(bDateParts[0]), parseInt(bDateParts[1]) - 1, parseInt(bDateParts[2]));
var cutoffDate = new Date();
cutoffDate.setHours(0, 0, 0, 0);
cutoffDate.setDate(cutoffDate.getDate() - 180);
if (bookingDateObj < cutoffDate) {
isOldBooking = true;
}
}
}
if (settleAmount < 0) {
// console.log(settleAmount);
$("#td_settel_amt").html(0.00);
@ -1131,7 +1239,11 @@
$("#pendingcolumn").hide();
$("#collectionstatuscolumn").hide();
$("#td_settel_amt").css("color", "green"); // Set color to green for positive amounts
$("#approvebutton").prop("disabled", false);
if (isOldBooking) {
$("#approvebutton").prop("disabled", true);
} else {
$("#approvebutton").prop("disabled", false);
}
}
}
function showDamageImage(damageImageUrl) {
@ -1140,110 +1252,110 @@
}
function accept() {
let id = document.getElementById("settlementid").value;
const acceptButton = document.getElementById("approvebutton"); // Add an ID to your button in the HTML
Swal.fire({
title: 'Do you want to Approve this Settlement?',
showDenyButton: true,
showCancelButton: true,
confirmButtonText: 'YES',
denyButtonText: 'NO',
}).then((result) => {
if (result.isConfirmed) {
// Disable the button to prevent multiple clicks
acceptButton.disabled = true;
// Show the loading screen
const loadingSwal = Swal.fire({
title: 'Processing...',
text: 'Please wait while we approve the settlement.',
allowOutsideClick: false, // Prevent closing the popup
didOpen: () => {
Swal.showLoading(); // Show the loading spinner
},
showConfirmButton: false, // Hide the confirm button during loading
});
$.ajax({
type: "POST",
url: '/communityhall/api/officer/updateApprovedSettlementStatus/' + id,
data: {
'status': 'APPROVED',
'comments': 'Accepted',
'settlementId': id
},
success: function (data, textStatus, xhr) {
loadingSwal.close(); // Close the loading popup
if (xhr.status === 200) {
Swal.fire(
'Done',
'Successfully Accepted to the ID: ' + id,
'success'
).then(() => {
location.reload(); // Reload the page after success
});
} else {
Swal.fire(
'Error',
'Failed to accept the user',
'error'
);
}
},
/*error: function (xhr, textStatus, errorThrown) {
loadingSwal.close(); // Close the loading popup
Swal.fire(
'Error',
'Failed to accept the user',
'error'
);
},*/
error: function (xhr, textStatus, errorThrown) {
loadingSwal.close();
console.log("textstaus"+xhr.responseText);
let responseData;
try {
responseData = JSON.parse(xhr.responseText);
} catch (e) {
responseData = null;
}
/* if (responseData && responseData.approvedFlag === 1) {
$("#approvebutton").hide(); // hide approve button if already approved
Swal.fire(
'Error',
'Failed to Approve the Settlement',
'error'
);*/
if (responseData && responseData.approvedFlag === 1) {
$("#approvebutton").hide(); // hide approve button if already approved
Swal.fire(
'Error',
'Failed to Approve the Settlement',
'error'
).then(() => {
location.reload(); // reload page after user closes the alert
});
} else {
Swal.fire(
'Error',
'Failed to Approve the Settlement',
'error'
);
}
},
complete: function() {
// Re-enable the button after request completes (success or error)
acceptButton.disabled = false;
}
});
} else if (result.isDenied) {
Swal.fire('Changes are not saved', '', 'info');
}
});
}
let id = document.getElementById("settlementid").value;
const acceptButton = document.getElementById("approvebutton"); // Add an ID to your button in the HTML
Swal.fire({
title: 'Do you want to Approve this Settlement?',
showDenyButton: true,
showCancelButton: true,
confirmButtonText: 'YES',
denyButtonText: 'NO',
}).then((result) => {
if (result.isConfirmed) {
// Disable the button to prevent multiple clicks
acceptButton.disabled = true;
// Show the loading screen
const loadingSwal = Swal.fire({
title: 'Processing...',
text: 'Please wait while we approve the settlement.',
allowOutsideClick: false, // Prevent closing the popup
didOpen: () => {
Swal.showLoading(); // Show the loading spinner
},
showConfirmButton: false, // Hide the confirm button during loading
});
$.ajax({
type: "POST",
url: '/communityhall/api/officer/updateApprovedSettlementStatus/' + id,
data: {
'status': 'APPROVED',
'comments': 'Accepted',
'settlementId': id
},
success: function (data, textStatus, xhr) {
loadingSwal.close(); // Close the loading popup
if (xhr.status === 200) {
Swal.fire(
'Done',
'Successfully Accepted to the ID: ' + id,
'success'
).then(() => {
location.reload(); // Reload the page after success
});
} else {
Swal.fire(
'Error',
'Failed to accept the user',
'error'
);
}
},
/*error: function (xhr, textStatus, errorThrown) {
loadingSwal.close(); // Close the loading popup
Swal.fire(
'Error',
'Failed to accept the user',
'error'
);
},*/
error: function (xhr, textStatus, errorThrown) {
loadingSwal.close();
console.log("textstaus" + xhr.responseText);
let responseData;
try {
responseData = JSON.parse(xhr.responseText);
} catch (e) {
responseData = null;
}
/* if (responseData && responseData.approvedFlag === 1) {
$("#approvebutton").hide(); // hide approve button if already approved
Swal.fire(
'Error',
'Failed to Approve the Settlement',
'error'
);*/
if (responseData && responseData.approvedFlag === 1) {
$("#approvebutton").hide(); // hide approve button if already approved
Swal.fire(
'Error',
'Failed to Approve the Settlement',
'error'
).then(() => {
location.reload(); // reload page after user closes the alert
});
} else {
Swal.fire(
'Error',
'Failed to Approve the Settlement',
'error'
);
}
},
complete: function () {
// Re-enable the button after request completes (success or error)
acceptButton.disabled = false;
}
});
} else if (result.isDenied) {
Swal.fire('Changes are not saved', '', 'info');
}
});
}
function rejectsubmit() {
let id = document.getElementById("settlementid").value;
@ -1309,7 +1421,7 @@
let textContent = "This is the content of the text file.";
// Create a Blob containing the text
let blob = new Blob([textContent], {type: "text/plain"});
let blob = new Blob([textContent], { type: "text/plain" });
// Create URL for the Blob
let url = URL.createObjectURL(blob);
@ -1428,6 +1540,25 @@
document.getElementById("payamountReceived").innerHTML = '₹ ' + list.payments.amountReceived;
document.getElementById("paymentStatus").innerHTML = list.payments.paymentStatus;
var isOldBooking = false;
if (list.bookingDate) {
var bDateParts = String(list.bookingDate).split('-');
if (bDateParts.length === 3) {
var bookingDateObj = new Date(parseInt(bDateParts[0]), parseInt(bDateParts[1]) - 1, parseInt(bDateParts[2]));
var cutoffDate = new Date();
cutoffDate.setHours(0, 0, 0, 0);
cutoffDate.setDate(cutoffDate.getDate() - 180);
if (bookingDateObj < cutoffDate) {
isOldBooking = true;
}
}
}
if (isOldBooking) {
$("#approvedButton").prop("disabled", true);
} else {
$("#approvedButton").prop("disabled", false);
}
showReasonDocuments(list);
}
@ -1514,78 +1645,78 @@
const fileURL = $(this).data('url');
openFileModal(fileURL);
});
function openFileModal(fileURL) {
$('#filePreview').attr('src', fileURL);
$('#fileModal').modal('show');
}
function openFileModal(fileURL) {
$('#filePreview').attr('src', fileURL);
$('#fileModal').modal('show');
}
function approverefund() {
let id = document.getElementById("booksId").value;
const approveButton = document.getElementById("approvedButton");
Swal.fire({
title: 'Do you want to Approve this Settlement?',
showDenyButton: true,
showCancelButton: true,
confirmButtonText: 'YES',
denyButtonText: 'NO',
}).then((result) => {
if (result.isConfirmed) {
// Disable the button after user confirms
approveButton.disabled = true;
// Show the loading popup
const loadingSwal = Swal.fire({
title: 'Processing...',
text: 'Please wait while we approve the settlement.',
allowOutsideClick: false, // Prevent closing the popup
didOpen: () => {
Swal.showLoading(); // Show the loading spinner
},
showConfirmButton: false, // Hide the confirm button during loading
});
$.ajax({
type: "POST",
url: '/communityhall/api/officer/approveCancelledBookingRefund/' + id,
data: {
'status': 'APPROVED',
},
success: function (data, textStatus, xhr) {
loadingSwal.close(); // Close the loading popup
if (xhr.status === 200) {
Swal.fire(
'Done',
'Successfully Accepted to the ID:' + id,
'success'
).then(() => {
location.reload(); // Reload page after success
});
} else {
Swal.fire(
'Error',
'Failed to Approve the Refund',
'error'
);
}
},
error: function (xhr, textStatus, errorThrown) {
loadingSwal.close(); // Close the loading popup
Swal.fire(
'Error',
'Failed to Approve the Refund',
'error'
);
},
complete: function() {
// Re-enable the button after request completes (success or error)
approveButton.disabled = false;
}
});
} else if (result.isDenied) {
Swal.fire('Changes are not saved', '', 'info');
}
});
}
let id = document.getElementById("booksId").value;
const approveButton = document.getElementById("approvedButton");
Swal.fire({
title: 'Do you want to Approve this Settlement?',
showDenyButton: true,
showCancelButton: true,
confirmButtonText: 'YES',
denyButtonText: 'NO',
}).then((result) => {
if (result.isConfirmed) {
// Disable the button after user confirms
approveButton.disabled = true;
// Show the loading popup
const loadingSwal = Swal.fire({
title: 'Processing...',
text: 'Please wait while we approve the settlement.',
allowOutsideClick: false, // Prevent closing the popup
didOpen: () => {
Swal.showLoading(); // Show the loading spinner
},
showConfirmButton: false, // Hide the confirm button during loading
});
$.ajax({
type: "POST",
url: '/communityhall/api/officer/approveCancelledBookingRefund/' + id,
data: {
'status': 'APPROVED',
},
success: function (data, textStatus, xhr) {
loadingSwal.close(); // Close the loading popup
if (xhr.status === 200) {
Swal.fire(
'Done',
'Successfully Accepted to the ID:' + id,
'success'
).then(() => {
location.reload(); // Reload page after success
});
} else {
Swal.fire(
'Error',
'Failed to Approve the Refund',
'error'
);
}
},
error: function (xhr, textStatus, errorThrown) {
loadingSwal.close(); // Close the loading popup
Swal.fire(
'Error',
'Failed to Approve the Refund',
'error'
);
},
complete: function () {
// Re-enable the button after request completes (success or error)
approveButton.disabled = false;
}
});
} else if (result.isDenied) {
Swal.fire('Changes are not saved', '', 'info');
}
});
}
document.addEventListener('DOMContentLoaded', function () {
var ddDetailsCheckbox = document.getElementById('ddDetailsCheckbox');
@ -1629,13 +1760,13 @@
event.stopPropagation();
});
});
$('#challonDetails').on('hidden.bs.modal', function () {
// Clear all input fields
$(this).find('form')[0].reset();
$('#challonDetails').on('hidden.bs.modal', function () {
// Clear all input fields
$(this).find('form')[0].reset();
// Optionally, reset any custom styling or classes
$(this).find('input').removeClass('is-valid is-invalid');
});
// Optionally, reset any custom styling or classes
$(this).find('input').removeClass('is-valid is-invalid');
});
</script>
</body>

88
src/main/resources/templates/admin/settlementlist.html

@ -71,6 +71,8 @@
<thead>
<tr>
<th>S.No</th>
<th>Zone</th>
<th>Division</th>
<th>Booking Id</th>
<th>Booking Date</th>
<th>Settlement id</th>
@ -87,6 +89,8 @@
<tr th:each="settlemetList,rowStat : ${settlemetList}"
th:if="${settlemetList.settlement != null}">
<td class="text-center" th:text="${rowStat.index + 1}"></td>
<td class="text-center" th:text="${settlemetList.hallDetails.zone}"></td>
<td class="text-center" th:text="${settlemetList.hallDetails.division}"></td>
<td class="text-center" th:text="${settlemetList.bookingId}"></td>
<td class="text-center" th:text="${settlemetList.bookingDate}"></td>
<td class="text-center" th:text="${settlemetList.settlement.settlementId}"></td>
@ -103,9 +107,9 @@
th:if="${#strings.trim(settlemetList.RefundStatus) == 'REJECTED'}"
th:onclick="settleTheAmount([[${settlemetList.bookingId}]])">Raise
Again</span>
<span class="badge bg-warning" style="cursor: pointer;"
th:if="${settlemetList.settlement.collectionPending > 0} and ${settlemetList.settlement.collectionStatus != 'paid'}"
th:onclick="|fetchQRCode(${settlemetList.bookingId})|">QR
<span class="badge bg-warning" style="cursor: pointer;"
th:if="${settlemetList.settlement.collectionPending > 0} and ${settlemetList.settlement.collectionStatus != 'paid'}"
th:onclick="|fetchQRCode(${settlemetList.bookingId})|">QR
</span>
</td>
</tr>
@ -311,12 +315,13 @@
style="padding: 0.45rem 0.45rem; color: green;" id="td_pending_amt">0
</td>
</tr>
<tr id="collectionstatuscolumn">
<th id="label"
style="padding: 0.45rem 0.45rem;font-weight: normal">Collection Pending Status
<tr id="collectionstatuscolumn">
<th id="label" style="padding: 0.45rem 0.45rem;font-weight: normal">
Collection Pending Status
:</th>
<td class="fw-semibold amount-cell"
style="padding: 0.45rem 0.45rem; color: green;" id="td_collection_status">
style="padding: 0.45rem 0.45rem; color: green;"
id="td_collection_status">
</td>
</tr>
<tr>
@ -364,19 +369,18 @@
</div>
</div>
</div>
<div class="modal fade" id="qrview" tabindex="-1" role="dialog" aria-labelledby="fileModalLabel"
aria-hidden="true">
<div class="modal fade" id="qrview" tabindex="-1" role="dialog" aria-labelledby="fileModalLabel" aria-hidden="true">
<div class="modal-dialog modal-sm" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="qrview">QR Code for Collection Pending</h5>
<h5 class="modal-title" id="qrview">QR Code for Collection Pending</h5>
</div>
<div class="modal-body">
<div>
<img style="border:4px solid #15455D;width: 256px; height: 260px;border-radius:10px;"
id="qrCodeImage" alt="QR Code">
</div>
<img style="border:4px solid #15455D;width: 256px; height: 260px;border-radius:10px;"
id="qrCodeImage" alt="QR Code">
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
@ -543,7 +547,7 @@
var tableResponsiveDiv = $('<div>').addClass('table-responsive').css('margin-right', '-24px');
// Create table with similar classes and styles to the modal table
var table = $('<table>').addClass('table table-bordered table-striped').css({'width': '97%', 'border-color': 'black', 'border-top-color': 'white'});
var table = $('<table>').addClass('table table-bordered table-striped').css({ 'width': '97%', 'border-color': 'black', 'border-top-color': 'white' });
var thead = $('<thead>').addClass('thead-light');
var tbody = $('<tbody>');
@ -558,12 +562,12 @@
// Create table header row
var columnHeadersRow = $('<tr>').css('background-color', '#f2f2f2').appendTo(thead);
$('<th>').text('S.No').css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(columnHeadersRow);
$('<th>').text('Asset Name').css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(columnHeadersRow);
$('<th>').text('Damage Img').css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(columnHeadersRow);
$('<th>').text('Cost').css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(columnHeadersRow);
$('<th>').text('Qty').css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(columnHeadersRow);
$('<th>').text('Amount').css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(columnHeadersRow);
$('<th>').text('S.No').css({ 'padding': '0.45rem 0.45rem', 'text-align': 'center' }).appendTo(columnHeadersRow);
$('<th>').text('Asset Name').css({ 'padding': '0.45rem 0.45rem', 'text-align': 'center' }).appendTo(columnHeadersRow);
$('<th>').text('Damage Img').css({ 'padding': '0.45rem 0.45rem', 'text-align': 'center' }).appendTo(columnHeadersRow);
$('<th>').text('Cost').css({ 'padding': '0.45rem 0.45rem', 'text-align': 'center' }).appendTo(columnHeadersRow);
$('<th>').text('Qty').css({ 'padding': '0.45rem 0.45rem', 'text-align': 'center' }).appendTo(columnHeadersRow);
$('<th>').text('Amount').css({ 'padding': '0.45rem 0.45rem', 'text-align': 'center' }).appendTo(columnHeadersRow);
var totalAmount = 0;
@ -638,8 +642,8 @@
var temp_total = parseFloat($("#td_settel_amt").html());
var settleAmount = temp_total - totalAmount;
if (settleAmount < 0) {
var pendingstatus = data.settlement.collectionStatus;
if (settleAmount < 0) {
var pendingstatus = data.settlement.collectionStatus;
$("#td_settel_amt").html(0);
$("#pendingcolumn").show();
$("#collectionstatuscolumn").show();
@ -660,7 +664,7 @@
function showDamageImage(damageImageUrl) {
document.getElementById('filePreview').src = damageImageUrl;
$('#fileModal').modal('show');
}
}
function accept() {
let id = document.getElementById("settlementid").value;
@ -711,24 +715,24 @@
}
});
}
function fetchQRCode(bookingId) {
$.ajax({
url: '/communityhall/careTaker/api/generateQRCode',
type: 'GET',
data: { bookingId: bookingId },
success: function(data) {
// Set the QR code image source
$('#qrview').modal('show');
$('#qrCodeImage').attr('src', 'data:image/png;base64,' + data);
// console.log(data);
},
error: function(jqXHR, textStatus, errorThrown) {
console.error('Error fetching QR code:', textStatus, errorThrown);
}
});
}
function fetchQRCode(bookingId) {
$.ajax({
url: '/communityhall/careTaker/api/generateQRCode',
type: 'GET',
data: { bookingId: bookingId },
success: function (data) {
// Set the QR code image source
$('#qrview').modal('show');
$('#qrCodeImage').attr('src', 'data:image/png;base64,' + data);
// console.log(data);
},
error: function (jqXHR, textStatus, errorThrown) {
console.error('Error fetching QR code:', textStatus, errorThrown);
}
});
}
</script>
</body>

741
src/main/resources/templates/caretaker/collection-pending.html

@ -0,0 +1,741 @@
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head th:replace="~{fragments/head-admin :: head}"></head>
<meta charset="ISO-8859-1">
<!-- Include DataTables CSS -->
</head>
<style>
.block-content {
padding-bottom: 10px;
}
.small-input {
width: 150px;
/* Adjust the width as needed */
}
.small-table th,
.small-table td {
font-size: 14px;
/* Adjust font size as needed */
}
/* Reduce padding for table cells */
.small-table td,
.small-table th {
padding: 5px;
/* Adjust padding as needed */
}
.card-body table {
width: 100%;
padding: 100px;
}
.card-body th,
td {
padding: 8px;
text-align: left;
}
.amount-cell {
text-align: right;
padding-right: 1rem;
/* Adjust padding as needed */
}
</style>
<body>
<div id="page-container"
class="sidebar-o sidebar-dark enable-page-overlay side-scroll page-header-fixed page-header-dark">
<aside th:replace="~{fragments/aside-right :: aside}"></aside>
<nav th:replace="~{fragments/nav-caretaker :: nav}"></nav>
<header th:replace="~{fragments/header-caretaker :: header}"></header>
<div class="content" style="margin-top: 77px;">
<div class="block block-rounded">
<div class="block-header bg-info text-white" style="background-color: #2c726c !important">
<h3 class="block-title">Settlement List</h3>
</div>
<div class="block-content">
<div class="table-responsive">
<table id="settlementListTable" class="table table-bordered table-vcenter">
<thead>
<tr>
<th>S.No</th>
<th>Zone</th>
<th>Division</th>
<th>Booking Id</th>
<th>Booking Date</th>
<th>Settlement id</th>
<th>Settlement Raised Date</th>
<th>Deposit Amount</th>
<th>Collection Pending(if any)</th>
<th>Refund Amount</th>
<th>Refund Status</th>
<th>View Details</th>
</tr>
</thead>
<tbody>
<!-- Iterate over past bookings and display them -->
<tr th:each="settlemetList,rowStat : ${collectionPendingList}"
th:if="${settlemetList.settlement != null}">
<td class="text-center" th:text="${rowStat.index + 1}"></td>
<td class="text-center" th:text="${settlemetList.hallDetails.zone}"></td>
<td class="text-center" th:text="${settlemetList.hallDetails.division}"></td>
<td class="text-center" th:text="${settlemetList.bookingId}"></td>
<td class="text-center" th:text="${settlemetList.bookingDate}"></td>
<td class="text-center" th:text="${settlemetList.settlement.settlementId}"></td>
<td class="text-center" th:text="${settlemetList.settlement.cdate}"></td>
<td class="text-center" th:text="${settlemetList.settlement.depositAmount}"></td>
<td class="text-center" th:text="${settlemetList.settlement.collectionPending}">
</td>
<td class="text-center" th:text="${settlemetList.settlement.refundedAmount}"></td>
<td class="text-center" th:text="${settlemetList.refundStatus}"></td>
<td>
<span class="badge bg-primary" style="cursor:pointer"
th:onclick="approve([[${settlemetList.settlement.settlementId}]])">View</span>
<!-- <span class="badge bg-warning" style="cursor: pointer;"
th:if="${#strings.trim(settlemetList.RefundStatus) == 'REJECTED'}"
th:onclick="settleTheAmount([[${settlemetList.bookingId}]])">Raise
Again</span> -->
<span class="badge bg-warning" style="cursor: pointer;"
th:if="${settlemetList.settlement.collectionPending > 0} and ${settlemetList.settlement.collectionStatus != 'paid'}"
th:onclick="|fetchQRCode(${settlemetList.bookingId})|">QR
</span>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div><br>
<br>
<br>
<br>
</div>
<!--modal for pending-->
<div class="modal fade backdrop" id="settlementinformation" data-backdrop="static" tabindex="-1" role="dialog"
aria-labelledby="staticBackdropLabel" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<form id="ownform">
<div class="block block-rounded block-themed block-transparent mb-0">
<div class="block-header bg-primary-dark">
<h3 class="block-title" id="2mtitle">Settlement Information</h3>
<div class="block-options">
<button type="button" class="btn-block-option" data-bs-dismiss="modal"
aria-label="Close">
<i class="fa fa-fw fa-times"></i>
</button>
</div>
</div>
<div class="block-content row">
<div class="col-md-12 col-lg-12 col-sm-12">
<input type="hidden" class="form-control text-center" name="settlementid"
id="settlementid" disabled />
<div class="card-body">
<table>
<tr>
<th colspan="10" style="background-color: #f2f2f2;">User Details</th>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal;">User Name:</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;" id="td_userName">
</td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal;">Mobile Number:
</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_mobileNumber"></td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal;">User Type:</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;" id="td_usertype">
</td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal;">User Address:</th>
<td colspan="5" class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_useraddress"></td>
</tr>
</table>
</div>
</div>
<div class="col-md-12 col-lg-12 col-sm-12">
<input type="hidden" class="form-control text-center" name="settlementid"
id="settlementid" disabled />
<div class="card-body">
<table>
<tr>
<th colspan="4" style="background-color: #f2f2f2;">Booking
Details(Booking Id:-<span id="booking_id" style="color:blue"></span>)
</th>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Booking Date:</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_bookingDate"></td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Deposit Amount:
</th>
<td class="fw-semibold amount-cell" style="padding: 0.45rem 0.45rem;"
id="td_depositeAmount"></td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Start Date:</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;" id="td_startDate">
</td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Hall Amount:</th>
<td class="fw-semibold amount-cell" style="padding: 0.45rem 0.45rem;"
id="td_hallAmount"></td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">END
Date:</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;" id="td_endDate">
</td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">GST @18%:</th>
<td class="fw-semibold amount-cell" style="padding: 0.45rem 0.45rem;"
id="td_gst"></td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Starting Slot:</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_startingSlot"></td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Total Amount:</th>
<td class="fw-semibold amount-cell" style="padding: 0.45rem 0.45rem;"
id="td_totalAmount"></td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Ending Slot:</th>
<td colspan="3" class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_endingSlot"></td>
</tr>
</table>
</div>
</div>
<div class="col-md-12 col-lg-12 col-sm-12">
<div class="card-body">
<table>
<tr>
<th colspan="6" style="background-color: #f2f2f2;">EB Details</th>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Consumer Number:
</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;" id="td_EBNumber">
</td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">EB Amount Per Unit:
</th>
<td class="fw-semibold amount-cell" style="padding: 0.45rem 0.45rem;"
id="td_ebamountperunit"></td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">MF DT Unit:</th>
<td class="fw-semibold amount-cell" style="padding: 0.45rem 0.45rem;"
id="td_mfDtUnit"></td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Start Reading:</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_startingReading"></td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">END Reading:</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_endingReading"></td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Unit Consumed:</th>
<td class="fw-semibold amount-cell" style="padding: 0.45rem 0.45rem;"
id="td_usedunit"></td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">EB Amount:</th>
<td colspan="5" class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_electricityamount"></td>
</tr>
</table>
</div>
</div>
<div id="damageDetails" style="margin-bottom: -17px;"></div>
<div class="col-md-12 col-lg-12 col-sm-12">
<div class="card-body">
<table>
<tr>
<th colspan="2" style="background-color: #f2f2f2;">Amount
to be Refunded</th>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Deposit Amount:
</th>
<td class="fw-semibold amount-cell" style="padding: 0.45rem 0.45rem;"
id="td_depositeamountforrefund">0</td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">EB Amount:</th>
<td class="fw-semibold amount-cell"
style="padding: 0.45rem 0.45rem;color:red" id="td_ebAmount">0</td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Damage(if any):
</th>
<td class="fw-semibold amount-cell"
style="padding: 0.45rem 0.45rem;color:red" id="td_damage">0</td>
</tr>
<tr id="pendingcolumn">
<th id="th_settel_label"
style="padding: 0.45rem 0.45rem;font-weight: normal">Collection Pending
Amount:</th>
<td class="fw-semibold amount-cell"
style="padding: 0.45rem 0.45rem; color: green;" id="td_pending_amt">0
</td>
</tr>
<tr id="collectionstatuscolumn">
<th id="label" style="padding: 0.45rem 0.45rem;font-weight: normal">
Collection Pending Status
:</th>
<td class="fw-semibold amount-cell"
style="padding: 0.45rem 0.45rem; color: green;"
id="td_collection_status">
</td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Actual refundable
Amount:</th>
<td class="fw-semibold amount-cell"
style="padding: 0.45rem 0.45rem; color: green;" id="td_settel_amt">0
</td>
</tr>
</table>
</div>
</div>
<!-- End damage detail -->
</div>
<div class="block-content block-content-full text-end bg-body" id="mbutton2">
<button type="button" class="btn btn-sm btn-alt-secondary"
data-bs-dismiss="modal">Close</button>
<a id="downloadLink" style="display: none;"></a>
</div>
</div>
</form>
</div>
</div>
</div>
<div class="modal fade" id="fileModal" tabindex="-1" role="dialog" aria-labelledby="fileModalLabel"
aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="fileModalLabel">File Preview</h5>
<button type="button" class="close" data-bs-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<embed id="filePreview" src="" width="100%" height="600px">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="qrview" tabindex="-1" role="dialog" aria-labelledby="fileModalLabel" aria-hidden="true">
<div class="modal-dialog modal-sm" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="qrview">QR Code for Collection Pending</h5>
</div>
<div class="modal-body">
<div>
<img style="border:4px solid #15455D;width: 256px; height: 260px;border-radius:10px;"
id="qrCodeImage" alt="QR Code">
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<div th:replace="~{fragments/resetpassword :: div}"></div>
<script th:replace="~{fragments/script :: script}"></script>
<footer th:replace="~{fragments/footer2 :: footer}"></footer>
<script th:replace="~{fragments/loginscript :: script}"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script>
<script>
$(document).ready(
function () {
// DataTables buttons configuration
var buttons = [{
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'
},
];
$('#settlementListTable').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']],
scrollY: '50vh',
fixedColumns: {
left: 1,
right: 1
},
buttons: [buttons],
responsive: true,
searching: true, // Enable search
select: false,
processing: false,
});
// Link the search input to DataTable
$('#searchInput').on('keyup', function () {
dataTable.search(this.value).draw();
});
});
function showDamageImage(imageUrl) {
document.getElementById('filePreview').src = imageUrl;
$('#fileModal').modal('show');
}
function settleTheAmount(bookingId) {
window.location.href = '/communityhall/caretaker/caretakerpage?bookingId=' + bookingId;
}
function approve(settlementId) {
$.ajax({
type: "GET",
url: '/communityhall/api/officer/getSettlementList',
data: {
'settlementsid': settlementId
},
success: function (x) {
showSettlementInfo(x)
showDamageDetails(x);
}
});
}
function showSettlementInfo(list) {
$('#settlementinformation').modal({
backdrop: 'static',
keyboard: false
});
$('#settlementinformation').modal('show');
document.getElementById("settlementid").value = list.settlement.settlementId;
document.getElementById("td_userName").innerHTML = list.users.name;
document.getElementById("td_mobileNumber").innerHTML = list.users.mobileNo;
document.getElementById("td_usertype").innerHTML = list.users.usertype;
var userDetails = list.users;
var userDetailsString =
userDetails.doorNo + ", " +
userDetails.street + ", " +
userDetails.area + ", " +
userDetails.location + " ,Chennai- " +
userDetails.pinCode;
document.getElementById("td_useraddress").innerHTML = userDetailsString;
document.getElementById("td_bookingDate").innerHTML = list.bookingDate;
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 formattedGst = gstcl.toFixed(2);
document.getElementById("td_gst").innerHTML = "₹ " + formattedGst;
document.getElementById("td_startDate").innerHTML = list.startDate;
document.getElementById("td_endDate").innerHTML = list.endDate;
document.getElementById("booking_id").innerHTML = list.bookingId;
function getTimeSlot(slotValue) {
var timeSlot;
var trimmedSlotValue = String(slotValue).trim(); // Convert to string and then trim
if (trimmedSlotValue === '1') {
timeSlot = 'Morning';
} else if (trimmedSlotValue === '2') {
timeSlot = 'Evening';
} else {
timeSlot = 'Unknown';
}
return timeSlot;
}
document.getElementById("td_startingSlot").innerHTML = getTimeSlot(list.startingSlot);
document.getElementById("td_endingSlot").innerHTML = getTimeSlot(list.endingSlot);
document.getElementById("td_EBNumber").innerHTML = list.hallDetails.ebNumber;
document.getElementById("td_startingReading").innerHTML = list.ebDetails.startingReading;
document.getElementById("td_endingReading").innerHTML = list.ebDetails.endingReading;
document.getElementById("td_usedunit").innerHTML = list.ebDetails.usedUnit;
document.getElementById("td_ebamountperunit").innerHTML = "₹ " + parseFloat(list.hallDetails.ebCostPerUnit).toFixed(2);
document.getElementById("td_mfDtUnit").innerHTML = "₹ " + parseFloat(list.hallDetails.mfDtUnit).toFixed(2);
document.getElementById("td_depositeamountforrefund").innerHTML = "₹ " + parseFloat(list.depositAmount).toFixed(2);
document.getElementById("td_ebAmount").innerHTML = "₹ " + parseFloat(list.ebDetails.ebAmount).toFixed(2);
document.getElementById("td_electricityamount").innerHTML = "₹ " + parseFloat(list.ebDetails.ebAmount).toFixed(2);
document.getElementById("td_damage").innerHTML = "₹ " + parseFloat(list.settlement.damageAmount).toFixed(2);
var eb_amt = list.ebDetails.ebAmount;
var deposit_amt = list.depositAmount;
var tem_total = deposit_amt - eb_amt;
$("#td_settel_amt").html('');
$("#td_settel_amt").html(tem_total);
}
function showDamageDetails(data) {
var damageFieldContainer = $('#damageDetails');
damageFieldContainer.empty();
// Create a div for table responsiveness
var tableResponsiveDiv = $('<div>').addClass('table-responsive').css('margin-right', '-24px');
// Create table with similar classes and styles to the modal table
var table = $('<table>').addClass('table table-bordered table-striped').css({ 'width': '97%', 'border-color': 'black', 'border-top-color': 'white' });
var thead = $('<thead>').addClass('thead-light');
var tbody = $('<tbody>');
// Create Damage Details header row
var headerRow = $('<tr>').appendTo(thead);
$('<th>').attr('colspan', '6').text('Damage Details (if any)').css({
'padding': '0.45rem 0.45rem',
'background-color': '#f2f2f2',
'font-weight': 'bold',
'color': 'black',
}).appendTo(headerRow);
// Create table header row
var columnHeadersRow = $('<tr>').css('background-color', '#f2f2f2').appendTo(thead);
$('<th>').text('S.No').css({ 'padding': '0.45rem 0.45rem', 'text-align': 'center' }).appendTo(columnHeadersRow);
$('<th>').text('Asset Name').css({ 'padding': '0.45rem 0.45rem', 'text-align': 'center' }).appendTo(columnHeadersRow);
$('<th>').text('Damage Img').css({ 'padding': '0.45rem 0.45rem', 'text-align': 'center' }).appendTo(columnHeadersRow);
$('<th>').text('Cost').css({ 'padding': '0.45rem 0.45rem', 'text-align': 'center' }).appendTo(columnHeadersRow);
$('<th>').text('Qty').css({ 'padding': '0.45rem 0.45rem', 'text-align': 'center' }).appendTo(columnHeadersRow);
$('<th>').text('Amount').css({ 'padding': '0.45rem 0.45rem', 'text-align': 'center' }).appendTo(columnHeadersRow);
var totalAmount = 0;
// Check if damageList is empty
if (data.damageList.length === 0) {
var row = $('<tr>').appendTo(tbody);
$('<td>').attr('colspan', '6').text('No Damaged Items').css({
'padding': '0.45rem 0.45rem',
'text-align': 'center',
'font-weight': 'bold',
'background-color': '#f2f2f2'
}).appendTo(row);
} else {
$.each(data.damageList, function (index, detail) {
var row = $('<tr>').appendTo(tbody);
$('<td>').text(index + 1).css({
'padding': '0.45rem 0.45rem',
'text-align': 'center'
}).appendTo(row);
$('<td>').text(detail.assetName).css({
'padding': '0.45rem 0.45rem',
'text-align': 'center'
}).appendTo(row);
var viewLink = $('<a>').attr('href', 'javascript:void(0)').text('View').on('click', function () {
showDamageImage(detail.damageImageUrl);
});
$('<td>').css({
'padding': '0.45rem 0.45rem',
'text-align': 'center'
}).append(viewLink).appendTo(row);
var assetamt = (detail.assetAmount / detail.quantity).toFixed(2);
$('<td>').text('₹ ' + assetamt).css({
'padding': '0.45rem 0.45rem',
'text-align': 'center'
}).appendTo(row);
$('<td>').text(detail.quantity).css({
'padding': '0.45rem 0.45rem',
'text-align': 'center'
}).appendTo(row);
var amount = detail.assetAmount;
totalAmount += amount;
$('<td>').text('₹ ' + amount.toFixed(2)).css({
'padding': '0.45rem 0.45rem',
'text-align': 'right'
}).appendTo(row);
});
// Add row for total amount
var totalRow = $('<tr>').appendTo(tbody);
$('<td>').attr('colspan', '5').text('Total Amount').css({
'padding': '0.45rem 0.45rem',
'font-weight': 'bold',
'background-color': '#f2f2f2'
}).appendTo(totalRow);
$('<td>').text('₹ ' + totalAmount.toFixed(2)).css({
'padding': '0.45rem 0.45rem',
'text-align': 'right'
}).appendTo(totalRow);
$("#td_dam_amt").html('₹ ' + totalAmount.toFixed(2));
}
// Append the table elements to the container div
table.append(thead, tbody);
tableResponsiveDiv.append(table);
damageFieldContainer.append(tableResponsiveDiv);
var temp_total = parseFloat($("#td_settel_amt").html());
var settleAmount = temp_total - totalAmount;
if (settleAmount < 0) {
var pendingstatus = data.settlement.collectionStatus;
$("#td_settel_amt").html(0);
$("#pendingcolumn").show();
$("#collectionstatuscolumn").show();
$('#td_collection_status').html(pendingstatus);
$("#td_pending_amt").html(Math.abs(settleAmount).toFixed(2));
$("#td_pending_amt").css("color", "red");
$("#approvebutton").show();
$("#rejectbutton").show();
} else {
$("#td_settel_amt").html('₹ ' + settleAmount.toFixed(2));
$("#pendingcolumn").hide();
$("#collectionstatuscolumn").hide();
$("#td_settel_amt").css("color", "green"); // Set color to green for positive amounts
$("#approvebutton").hide();
$("#rejectbutton").hide();
}
}
function showDamageImage(damageImageUrl) {
document.getElementById('filePreview').src = damageImageUrl;
$('#fileModal').modal('show');
}
function accept() {
let id = document.getElementById("settlementid").value;
Swal.fire({
title: 'Do you want to Approve this Settlement ?',
showDenyButton: true,
showCancelButton: true,
confirmButtonText: 'YES',
denyButtonText: 'NO',
}).then((result) => {
/* Read more about isConfirmed, isDenied below */
if (result.isConfirmed) {
$.ajax({
type: "POST",
url: '/communityhall/api/officer/updateApprovedSettlementStatus/' + id,
data: {
'status': 'COMPLETED',
'comments': 'Accepted',
'settlementId': id
},
success: function (data, textStatus, xhr) {
if (xhr.status === 200) { // Check if the response status is OK
Swal.fire(
'Done',
'Successfully Accepted to the ID:' + id,
'success'
).then(() => {
location.reload();
});
} else {
Swal.fire(
'Error',
'Failed to accept the user',
'error'
);
}
},
error: function (xhr, textStatus, errorThrown) {
Swal.fire(
'Error',
'Failed to accept the user',
'error'
);
}
});
} else if (result.isDenied) {
Swal.fire('Changes are not saved', '', 'info')
}
});
}
function fetchQRCode(bookingId) {
$.ajax({
url: '/communityhall/careTaker/api/generateQRCode',
type: 'GET',
data: { bookingId: bookingId },
success: function (data) {
// Set the QR code image source
$('#qrview').modal('show');
$('#qrCodeImage').attr('src', 'data:image/png;base64,' + data);
// console.log(data);
},
error: function (jqXHR, textStatus, errorThrown) {
console.error('Error fetching QR code:', textStatus, errorThrown);
}
});
}
</script>
</body>
</html>

12
src/main/resources/templates/caretaker/future-booking.html

@ -67,6 +67,8 @@
<thead>
<tr>
<th>Hall Name</th>
<th>Zone</th>
<th>Division</th>
<th>Booking Id</th>
<th>Reason for Booking</th>
<th>Start Date</th>
@ -81,6 +83,8 @@
<!-- Iterate over future bookings and display them -->
<tr th:each="booking : ${futureBookings}">
<td th:text="${booking.hallDetails.hallName}"></td>
<td th:text="${booking.hallDetails.zone}"></td>
<td th:text="${booking.hallDetails.division}"></td>
<td th:text="${booking.bookingId}"></td>
<td th:text="${booking.reason}"></td>
<td th:text="${booking.startDate}"></td>
@ -183,8 +187,8 @@
<div class="col-sm-4" style="margin-left:0%">
<div class="form-group">
<label for="userType">User Type<span class="required">*</span>:</label>
<input class="form-control" id="userType" name="userType"
placeholder="User Type" readonly>
<input class="form-control" id="userType" name="userType" placeholder="User Type"
readonly>
</div>
</div>
<div class="col-sm-4 hidden" id="employeeFields">
@ -208,7 +212,7 @@
<footer th:replace="~{fragments/footer2 :: footer}"></footer>
</div>
<div th:replace="~{fragments/resetpassword :: div}"></div>
<div th:replace="~{fragments/resetpassword :: div}"></div>
<script th:replace="~{fragments/script :: script}"></script>
<script th:replace="~{fragments/loginscript :: script}"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script>
@ -282,7 +286,7 @@
$.ajax({
url: '/communityhall/careTaker/api/viewuserDetails',
method: 'GET',
data: {bookingId: bookingId},
data: { bookingId: bookingId },
success: function (response) {
$('#name').val(response.users.name);
$('#mobileno').val(response.users.mobileNo);

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

@ -85,6 +85,8 @@
<thead>
<tr>
<th>Hall Name</th>
<th>Zone</th>
<th>Division</th>
<th>Booking Id</th>
<th>Reason for Booking</th>
<th>Start Date</th>
@ -99,6 +101,8 @@
<!-- Iterate over past bookings and display them -->
<tr th:each="booking : ${pastBookings}" class="${pastBookings}">
<td th:text="${booking.hallDetails.hallName}"></td>
<td th:text="${booking.hallDetails.zone}"></td>
<td th:text="${booking.hallDetails.division}"></td>
<td th:text="${booking.bookingId}"></td>
<td th:text="${booking.reason}"></td>
@ -209,8 +213,8 @@
<div class="col-sm-4" style="margin-left:0%">
<div class="form-group">
<label for="userType">User Type<span class="required">*</span>:</label>
<input class="form-control" id="usertype" name="usertype"
placeholder="User Type" readonly>
<input class="form-control" id="usertype" name="usertype" placeholder="User Type"
readonly>
</div>
</div>
<div class="col-sm-4 hidden" id="employeeFields">
@ -368,8 +372,8 @@
<div class="form-group">
<label for="startingReadingimage">Starting Reading Image<span
class="required"></span>:</label>
<input type="file" class="form-control text-center startreading-image" id="startingReadingimage"
name="startingReadingimage">
<input type="file" class="form-control text-center startreading-image"
id="startingReadingimage" name="startingReadingimage">
</div>
</div>
</div>
@ -459,7 +463,7 @@
$.ajax({
url: '/communityhall/careTaker/api/viewuserDetails',
method: 'GET',
data: {bookingId: bookingId},
data: { bookingId: bookingId },
success: function (response) {
var users = response.users;
var settlement = response.settlement;
@ -508,176 +512,176 @@
$('#EBdestailsModal').modal('show');
}
let isCompressing = false;
// Attach the validation function to file input change event
$(document).on('change', '.startreading-image', function () {
validateFile(this);
});
// Attach the validation function to file input change event
$(document).on('change', '.startreading-image', function () {
validateFile(this);
});
function validateFile(fileInput) {
const allowedExtensions = /(\.jpg|\.jpeg|\.pdf)$/i;
const file = fileInput.files[0];
const filePath = fileInput.value;
let errorMessage = '';
// Clear any previous error message
clearError(fileInput);
// Check for duplicate files
if (isDuplicateFile(file.name, fileInput)) {
errorMessage = 'This file has already been selected. Please choose a different file.';
fileInput.value = ''; // Clear the file input
displayError(fileInput, errorMessage);
return;
}
// Validate file type
if (!allowedExtensions.exec(filePath)) {
errorMessage = 'Only JPG, JPEG, and PDF files are allowed.';
fileInput.value = ''; // Clear the file input
displayError(fileInput, errorMessage);
}
// Handle image files separately
else if (/(\.jpg|\.jpeg)$/i.test(filePath) && file.size > 2097152) {
compressImage(file).then(compressedFile => {
const dataTransfer = new DataTransfer();
dataTransfer.items.add(compressedFile);
fileInput.files = dataTransfer.files;
// Validate file size after compression
validateFileSize(fileInput);
}).catch(error => {
errorMessage = 'Error compressing image.';
displayError(fileInput, errorMessage);
});
}
// Directly validate PDF file size
else if (/(\.pdf)$/i.test(filePath) && file.size > 2097152) {
errorMessage = 'PDF file size exceeds the 2MB limit.';
fileInput.value = ''; // Clear the file input
displayError(fileInput, errorMessage);
}
else {
// console.log('File size is within limit:', file.size, 'bytes');
clearError(fileInput);
}
}
function validateFile(fileInput) {
const allowedExtensions = /(\.jpg|\.jpeg|\.pdf)$/i;
const file = fileInput.files[0];
const filePath = fileInput.value;
let errorMessage = '';
// Clear any previous error message
clearError(fileInput);
// Check for duplicate files
if (isDuplicateFile(file.name, fileInput)) {
errorMessage = 'This file has already been selected. Please choose a different file.';
fileInput.value = ''; // Clear the file input
displayError(fileInput, errorMessage);
return;
}
// Validate file type
if (!allowedExtensions.exec(filePath)) {
errorMessage = 'Only JPG, JPEG, and PDF files are allowed.';
fileInput.value = ''; // Clear the file input
displayError(fileInput, errorMessage);
}
// Handle image files separately
else if (/(\.jpg|\.jpeg)$/i.test(filePath) && file.size > 2097152) {
compressImage(file).then(compressedFile => {
const dataTransfer = new DataTransfer();
dataTransfer.items.add(compressedFile);
fileInput.files = dataTransfer.files;
// Validate file size after compression
validateFileSize(fileInput);
}).catch(error => {
errorMessage = 'Error compressing image.';
displayError(fileInput, errorMessage);
});
}
// Directly validate PDF file size
else if (/(\.pdf)$/i.test(filePath) && file.size > 2097152) {
errorMessage = 'PDF file size exceeds the 2MB limit.';
fileInput.value = ''; // Clear the file input
displayError(fileInput, errorMessage);
}
else {
// console.log('File size is within limit:', file.size, 'bytes');
clearError(fileInput);
}
}
function isDuplicateFile(fileName, currentInput) {
const fileInputs = document.querySelectorAll('.file-upload-field');
for (let input of fileInputs) {
if (input !== currentInput && input.files.length > 0 && input.files[0].name === fileName) {
return true;
}
}
return false;
}
function isDuplicateFile(fileName, currentInput) {
const fileInputs = document.querySelectorAll('.file-upload-field');
for (let input of fileInputs) {
if (input !== currentInput && input.files.length > 0 && input.files[0].name === fileName) {
return true;
}
function clearError(fileInput) {
const errorElements = fileInput.parentNode.getElementsByClassName('error-message');
while (errorElements.length > 0) {
errorElements[0].remove();
}
}
// Function to compress image using canvas
function compressImage(file) {
return new Promise((resolve, reject) => {
const reader = new FileReader();
reader.onload = function (event) {
const img = new Image();
img.onload = function () {
const canvas = document.createElement('canvas');
const ctx = canvas.getContext('2d');
const maxSize = 2097152; // 2MB in bytes
let scale = 1;
if (file.size > maxSize) {
scale = Math.sqrt(maxSize / file.size);
}
return false;
}
canvas.width = img.width * scale;
canvas.height = img.height * scale;
ctx.drawImage(img, 0, 0, canvas.width, canvas.height);
// Convert canvas content to blob
canvas.toBlob(blob => {
resolve(new File([blob], file.name, { type: 'image/jpeg', lastModified: Date.now() }));
}, 'image/jpeg', 0.7); // Adjust JPEG quality as needed (0.7 is 70% quality)
};
img.src = event.target.result;
};
reader.readAsDataURL(file);
});
}
// Function to validate file size after compression
function validateFileSize(fileInput) {
const file = fileInput.files[0];
if (file && file.size > 2097152) {
//console.log('File size is still greater than 2MB after compression.');
// Handle the situation where the file size is still greater than 2MB
displayError(fileInput, 'File size is still greater than 2MB after compression.');
fileInput.value = ''; // Clear the file input
} else {
//console.log('File size is within limit after compression.');
// Handle the situation where the file size is within the limit
}
}
function clearError(fileInput) {
const errorElements = fileInput.parentNode.getElementsByClassName('error-message');
while (errorElements.length > 0) {
errorElements[0].remove();
}
}
// Function to compress image using canvas
function compressImage(file) {
return new Promise((resolve, reject) => {
const reader = new FileReader();
reader.onload = function (event) {
const img = new Image();
img.onload = function () {
const canvas = document.createElement('canvas');
const ctx = canvas.getContext('2d');
const maxSize = 2097152; // 2MB in bytes
let scale = 1;
if (file.size > maxSize) {
scale = Math.sqrt(maxSize / file.size);
}
canvas.width = img.width * scale;
canvas.height = img.height * scale;
ctx.drawImage(img, 0, 0, canvas.width, canvas.height);
// Convert canvas content to blob
canvas.toBlob(blob => {
resolve(new File([blob], file.name, {type: 'image/jpeg', lastModified: Date.now()}));
}, 'image/jpeg', 0.7); // Adjust JPEG quality as needed (0.7 is 70% quality)
};
img.src = event.target.result;
};
reader.readAsDataURL(file);
// Function to display error messages
function displayError(fileInput, errorMessage) {
// Example implementation: show error message near the file input
let errorContainer = fileInput.nextElementSibling;
if (!errorContainer || !errorContainer.classList.contains('error-message')) {
errorContainer = document.createElement('div');
errorContainer.classList.add('error-message');
fileInput.parentNode.insertBefore(errorContainer, fileInput.nextSibling);
}
errorContainer.textContent = errorMessage;
}
$(document).ready(function () {
$("#submitEbDetails").click(function () {
var bookid = parseInt($("#bookingId").val());
var startingReading = $("#startingReading").val();
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);
$.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.");
}
// Function to validate file size after compression
function validateFileSize(fileInput) {
const file = fileInput.files[0];
if (file && file.size > 2097152) {
//console.log('File size is still greater than 2MB after compression.');
// Handle the situation where the file size is still greater than 2MB
displayError(fileInput, 'File size is still greater than 2MB after compression.');
fileInput.value = ''; // Clear the file input
} else {
//console.log('File size is within limit after compression.');
// Handle the situation where the file size is within the limit
}
}
});
});
});
// Function to display error messages
function displayError(fileInput, errorMessage) {
// Example implementation: show error message near the file input
let errorContainer = fileInput.nextElementSibling;
if (!errorContainer || !errorContainer.classList.contains('error-message')) {
errorContainer = document.createElement('div');
errorContainer.classList.add('error-message');
fileInput.parentNode.insertBefore(errorContainer, fileInput.nextSibling);
}
errorContainer.textContent = errorMessage;
}
$(document).ready(function () {
$("#submitEbDetails").click(function () {
var bookid = parseInt($("#bookingId").val());
var startingReading = $("#startingReading").val();
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);
$.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.");
}
});
});
});
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 = '';
});
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 = '';
});
</script>
</body>

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

@ -86,6 +86,8 @@
<thead>
<tr>
<th>Hall Name</th>
<th>Zone</th>
<th>Division</th>
<th>Booking Id</th>
<th>Reason for Booking</th>
<th>Start Date</th>
@ -99,6 +101,8 @@
<tbody>
<tr th:each="booking : ${bookings}">
<td th:text="${booking.hallDetails.hallName}"></td>
<td th:text="${booking.hallDetails.zone}"></td>
<td th:text="${booking.hallDetails.division}"></td>
<td th:text="${booking.bookingId}"></td>
<td th:text="${booking.reason}"></td>
<td th:text="${booking.startDate}"></td>
@ -204,8 +208,8 @@
<div class="col-sm-4" style="margin-left:0%">
<div class="form-group">
<label for="userType">User Type<span class="required">*</span>:</label>
<input class="form-control" id="usertype" name="usertype"
placeholder="User Type" readonly>
<input class="form-control" id="usertype" name="usertype" placeholder="User Type"
readonly>
</div>
</div>
<div class="col-sm-4 hidden" id="employeeFields">
@ -262,8 +266,8 @@
<div class="form-group">
<label for="startingReadingimage">Starting Reading Image<span
class="required"></span>:</label>
<input type="file" class="form-control text-center startreading-image" id="startingReadingimage"
name="startingReadingimage">
<input type="file" class="form-control text-center startreading-image"
id="startingReadingimage" name="startingReadingimage">
</div>
</div>
</div>
@ -354,7 +358,7 @@
$.ajax({
url: '/communityhall/careTaker/api/viewuserDetails',
method: 'GET',
data: {bookingId: bookingId},
data: { bookingId: bookingId },
success: function (response) {
$('#name').val(response.users.name);
$('#mobileno').val(response.users.mobileNo);
@ -380,178 +384,178 @@
$('#ebNumber').val(ebNumber);
$('#EBdestailsModal').modal('show');
}
let isCompressing = false;
// Attach the validation function to file input change event
$(document).on('change', '.startreading-image', function () {
validateFile(this);
});
function validateFile(fileInput) {
const allowedExtensions = /(\.jpg|\.jpeg|\.pdf)$/i;
const file = fileInput.files[0];
const filePath = fileInput.value;
let errorMessage = '';
// Clear any previous error message
clearError(fileInput);
// Check for duplicate files
if (isDuplicateFile(file.name, fileInput)) {
errorMessage = 'This file has already been selected. Please choose a different file.';
fileInput.value = ''; // Clear the file input
displayError(fileInput, errorMessage);
return;
}
// Validate file type
if (!allowedExtensions.exec(filePath)) {
errorMessage = 'Only JPG, JPEG, and PDF files are allowed.';
fileInput.value = ''; // Clear the file input
displayError(fileInput, errorMessage);
}
// Handle image files separately
else if (/(\.jpg|\.jpeg)$/i.test(filePath) && file.size > 2097152) {
compressImage(file).then(compressedFile => {
const dataTransfer = new DataTransfer();
dataTransfer.items.add(compressedFile);
fileInput.files = dataTransfer.files;
// Validate file size after compression
validateFileSize(fileInput);
}).catch(error => {
errorMessage = 'Error compressing image.';
displayError(fileInput, errorMessage);
});
}
// Directly validate PDF file size
else if (/(\.pdf)$/i.test(filePath) && file.size > 2097152) {
errorMessage = 'PDF file size exceeds the 2MB limit.';
fileInput.value = ''; // Clear the file input
displayError(fileInput, errorMessage);
}
else {
// console.log('File size is within limit:', file.size, 'bytes');
clearError(fileInput);
}
}
let isCompressing = false;
// Attach the validation function to file input change event
$(document).on('change', '.startreading-image', function () {
validateFile(this);
});
function validateFile(fileInput) {
const allowedExtensions = /(\.jpg|\.jpeg|\.pdf)$/i;
const file = fileInput.files[0];
const filePath = fileInput.value;
let errorMessage = '';
// Clear any previous error message
clearError(fileInput);
// Check for duplicate files
if (isDuplicateFile(file.name, fileInput)) {
errorMessage = 'This file has already been selected. Please choose a different file.';
fileInput.value = ''; // Clear the file input
displayError(fileInput, errorMessage);
return;
}
// Validate file type
if (!allowedExtensions.exec(filePath)) {
errorMessage = 'Only JPG, JPEG, and PDF files are allowed.';
fileInput.value = ''; // Clear the file input
displayError(fileInput, errorMessage);
}
// Handle image files separately
else if (/(\.jpg|\.jpeg)$/i.test(filePath) && file.size > 2097152) {
compressImage(file).then(compressedFile => {
const dataTransfer = new DataTransfer();
dataTransfer.items.add(compressedFile);
fileInput.files = dataTransfer.files;
// Validate file size after compression
validateFileSize(fileInput);
}).catch(error => {
errorMessage = 'Error compressing image.';
displayError(fileInput, errorMessage);
});
}
// Directly validate PDF file size
else if (/(\.pdf)$/i.test(filePath) && file.size > 2097152) {
errorMessage = 'PDF file size exceeds the 2MB limit.';
fileInput.value = ''; // Clear the file input
displayError(fileInput, errorMessage);
}
else {
// console.log('File size is within limit:', file.size, 'bytes');
clearError(fileInput);
}
}
function isDuplicateFile(fileName, currentInput) {
const fileInputs = document.querySelectorAll('.file-upload-field');
for (let input of fileInputs) {
if (input !== currentInput && input.files.length > 0 && input.files[0].name === fileName) {
return true;
}
}
return false;
}
function isDuplicateFile(fileName, currentInput) {
const fileInputs = document.querySelectorAll('.file-upload-field');
for (let input of fileInputs) {
if (input !== currentInput && input.files.length > 0 && input.files[0].name === fileName) {
return true;
}
}
return false;
}
function clearError(fileInput) {
const errorElements = fileInput.parentNode.getElementsByClassName('error-message');
while (errorElements.length > 0) {
errorElements[0].remove();
}
}
// Function to compress image using canvas
function compressImage(file) {
return new Promise((resolve, reject) => {
const reader = new FileReader();
reader.onload = function (event) {
const img = new Image();
img.onload = function () {
const canvas = document.createElement('canvas');
const ctx = canvas.getContext('2d');
const maxSize = 2097152; // 2MB in bytes
let scale = 1;
if (file.size > maxSize) {
scale = Math.sqrt(maxSize / file.size);
}
canvas.width = img.width * scale;
canvas.height = img.height * scale;
ctx.drawImage(img, 0, 0, canvas.width, canvas.height);
// Convert canvas content to blob
canvas.toBlob(blob => {
resolve(new File([blob], file.name, {type: 'image/jpeg', lastModified: Date.now()}));
}, 'image/jpeg', 0.7); // Adjust JPEG quality as needed (0.7 is 70% quality)
};
img.src = event.target.result;
};
reader.readAsDataURL(file);
});
}
// Function to validate file size after compression
function validateFileSize(fileInput) {
const file = fileInput.files[0];
if (file && file.size > 2097152) {
//console.log('File size is still greater than 2MB after compression.');
// Handle the situation where the file size is still greater than 2MB
displayError(fileInput, 'File size is still greater than 2MB after compression.');
fileInput.value = ''; // Clear the file input
} else {
//console.log('File size is within limit after compression.');
// Handle the situation where the file size is within the limit
function clearError(fileInput) {
const errorElements = fileInput.parentNode.getElementsByClassName('error-message');
while (errorElements.length > 0) {
errorElements[0].remove();
}
}
// Function to compress image using canvas
function compressImage(file) {
return new Promise((resolve, reject) => {
const reader = new FileReader();
reader.onload = function (event) {
const img = new Image();
img.onload = function () {
const canvas = document.createElement('canvas');
const ctx = canvas.getContext('2d');
const maxSize = 2097152; // 2MB in bytes
let scale = 1;
if (file.size > maxSize) {
scale = Math.sqrt(maxSize / file.size);
}
}
canvas.width = img.width * scale;
canvas.height = img.height * scale;
ctx.drawImage(img, 0, 0, canvas.width, canvas.height);
// Convert canvas content to blob
canvas.toBlob(blob => {
resolve(new File([blob], file.name, { type: 'image/jpeg', lastModified: Date.now() }));
}, 'image/jpeg', 0.7); // Adjust JPEG quality as needed (0.7 is 70% quality)
};
img.src = event.target.result;
};
reader.readAsDataURL(file);
});
}
// Function to validate file size after compression
function validateFileSize(fileInput) {
const file = fileInput.files[0];
if (file && file.size > 2097152) {
//console.log('File size is still greater than 2MB after compression.');
// Handle the situation where the file size is still greater than 2MB
displayError(fileInput, 'File size is still greater than 2MB after compression.');
fileInput.value = ''; // Clear the file input
} else {
//console.log('File size is within limit after compression.');
// Handle the situation where the file size is within the limit
}
}
// Function to display error messages
function displayError(fileInput, errorMessage) {
// Example implementation: show error message near the file input
let errorContainer = fileInput.nextElementSibling;
if (!errorContainer || !errorContainer.classList.contains('error-message')) {
errorContainer = document.createElement('div');
errorContainer.classList.add('error-message');
fileInput.parentNode.insertBefore(errorContainer, fileInput.nextSibling);
}
errorContainer.textContent = errorMessage;
}
// Function to display error messages
function displayError(fileInput, errorMessage) {
// Example implementation: show error message near the file input
let errorContainer = fileInput.nextElementSibling;
if (!errorContainer || !errorContainer.classList.contains('error-message')) {
errorContainer = document.createElement('div');
errorContainer.classList.add('error-message');
fileInput.parentNode.insertBefore(errorContainer, fileInput.nextSibling);
}
errorContainer.textContent = errorMessage;
}
$(document).ready(function () {
$("#submitEbDetails").click(function () {
var bookid = parseInt($("#bookingId").val());
var startingReading = $("#startingReading").val();
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);
$.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.");
}
});
});
});
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 = '';
});
$("#submitEbDetails").click(function () {
var bookid = parseInt($("#bookingId").val());
var startingReading = $("#startingReading").val();
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);
$.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.");
}
});
});
});
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 = '';
});
</script>
</body>

4
src/main/resources/templates/caretaker/settlementlist.html

@ -71,6 +71,8 @@
<thead>
<tr>
<th>S.No</th>
<th>Zone</th>
<th>Division</th>
<th>Booking Id</th>
<th>Booking Date</th>
<th>Settlement id</th>
@ -87,6 +89,8 @@
<tr th:each="settlemetList,rowStat : ${settlemetList}"
th:if="${settlemetList.settlement != null}">
<td class="text-center" th:text="${rowStat.index + 1}"></td>
<td class="text-center" th:text="${settlemetList.hallDetails.zone}"></td>
<td class="text-center" th:text="${settlemetList.hallDetails.division}"></td>
<td class="text-center" th:text="${settlemetList.bookingId}"></td>
<td class="text-center" th:text="${settlemetList.bookingDate}"></td>
<td class="text-center" th:text="${settlemetList.settlement.settlementId}"></td>

7
src/main/resources/templates/cro/booking-list.html

@ -449,6 +449,7 @@
<!-- ════ RESCHEDULE BOOKING MODAL (MATCHES user/viewhistory.html) ════ -->
<input type="hidden" id="croSessionMobile" th:value="${mobileno}" />
<input type="hidden" id="croRescheduleLimit" th:value="${rescheduleLimit}" />
<div class="modal fade" id="croBookingRescheduleModal" tabindex="-1" aria-labelledby="bookingModalLabel"
aria-hidden="true">
<div class="modal-dialog modal-dialog-centered modal-lg">
@ -1320,6 +1321,8 @@
var hd = list.hallDetails || {};
var py = list.payments || {};
var eb = list.ebDetails || {};
var rescheduleLimit = $('#croRescheduleLimit').val();
// console.log("rescheduleLimit..." + rescheduleLimit);
document.getElementById('res_userName').innerHTML = ud.name || 'N/A';
document.getElementById('res_mobileNumber').innerHTML = ud.mobileNo || 'N/A';
@ -1361,10 +1364,10 @@
$('#rescheduleActionDiv').hide();
$('#rescheduleNotAllowedMsg').hide();
if (scheduleCount >= 1) {
if (scheduleCount >= rescheduleLimit) {
// Already rescheduled once — block further reschedule
$('#rescheduleNotAllowedMsg')
.html('<div class="alert alert-danger mb-0" style="color: #b02a37; background-color: #f8d7da; border: 1px solid #f5c2c7; font-weight: bold; font-size: 14px;"><i class="fa fa-exclamation-triangle me-1"></i><strong>Reschedule limit exceeds: this booking has already been rescheduled once.</strong></div>')
.html('<div class="alert alert-danger mb-0" style="color: #b02a37; background-color: #f8d7da; border: 1px solid #f5c2c7; font-weight: bold; font-size: 14px;"><i class="fa fa-exclamation-triangle me-1"></i><strong>Reschedule limit exceeds: this booking has already been rescheduled.</strong></div>')
.show();
} else if (hasEbDetails) {
// Already rescheduled once — block further reschedule

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

@ -115,6 +115,15 @@
<span class="nav-main-link-name">Settlement Pending List</span>
</a>
</li>
<li class="nav-main-item">
<a class="nav-main-link" href="/communityhall/admin/collectionpending">
<i class="nav-main-link-icon fa fa-location-arrow"></i>
<span class="nav-main-link-name">Collection Pending List</span>
</a>
</li>
<li class="nav-main-item">
<a class="nav-main-link" href="/communityhall/admin/settlementlist">
<i class="nav-main-link-icon fa fa-location-arrow"></i>

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

@ -84,6 +84,15 @@
<span class="nav-main-link-name">Settlement Initiated List</span>
</a>
</li>-->
<li class="nav-main-item">
<a class="nav-main-link" href="/communityhall/headquarters/collectionpending">
<i class="nav-main-link-icon fa fa-location-arrow"></i>
<span class="nav-main-link-name">Collection Pending List</span>
</a>
</li>
<li class="nav-main-item">
<a class="nav-main-link" href="/communityhall/headquarters/settlement-list">
<i class="nav-main-link-icon fa fa-location-arrow"></i>

7
src/main/resources/templates/fragments/menuCaretaker.html

@ -34,6 +34,13 @@
</a>
</li>
<li class="nav-main-item">
<a class="nav-main-link" href="/communityhall/caretaker/collectionpending">
<i class="nav-main-link-icon fa fa-location-arrow"></i>
<span class="nav-main-link-name">Collection Pending List</span>
</a>
</li>
<!-- <li class="nav-main-item">
<a class="nav-main-link" href="/communityhall/caretaker/caretakerpage">
<i class="nav-main-link-icon fa fa-location-arrow"></i>

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

@ -18,6 +18,14 @@
<span class="nav-main-link-name">Booking Rejected List</span>
</a>
</li>
<li class="nav-main-item">
<a class="nav-main-link" href="/communityhall/officer/collectionpending">
<i class="nav-main-link-icon fa fa-location-arrow"></i>
<span class="nav-main-link-name">Collection Pending List</span>
</a>
</li>
<li class="nav-main-item">
<a class="nav-main-link" href="/communityhall/officer/settlement-list">
<i class="nav-main-link-icon fa fa-location-arrow"></i>

64
src/main/resources/templates/fragments/nav-usermenu.html

@ -50,50 +50,46 @@
<ul class="pcoded-item pcoded-right-item" th:if="${counterName != null}">
<li class="pcoded-hasmenu">
<div class="dropdown">
<button th:if="${counterName != null}" class="btn btn-primary dropdown-toggle"
type="button" id="counterloginDropdown"
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"
style="background-color: rgb(21,69,93); color: orange; font-weight: bold; border-color: white; margin-top: 6px;">
<span class="pcoded-micon">
<i class="fa fa-user" style="color: white;" aria-hidden="true"></i>
</span>
<span th:text="${counterName}" id="counterNameLogin"
style="cursor: not-allowed;" data-toggle="tooltip"
data-placement="bottom">
</span>
<button th:if="${counterName != null}" class="btn btn-primary dropdown-toggle" type="button"
id="counterloginDropdown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"
style="background-color: rgb(21,69,93); color: orange; font-weight: bold; border-color: white; margin-top: 6px;">
<span class="pcoded-micon">
<i class="fa fa-user" style="color: white;" aria-hidden="true"></i>
</span>
<span th:text="${counterName}" id="counterNameLogin" style="cursor: not-allowed;"
data-toggle="tooltip" data-placement="bottom">
</span>
</button>
<div class="dropdown-menu" aria-labelledby="counterLoginDropdown">
<a href="/communityhall/counter/logout" class="dropdown-item" id="counterlogout"
name="counterlogout" style="cursor: pointer;"><i
class="fa fa-sign-out"></i> Counter Logout</a>
name="counterlogout" style="cursor: pointer;"><i class="fa fa-sign-out"></i> Counter
Logout</a>
</div>
</div>
</li>
</ul>
<ul class="pcoded-item pcoded-right-item" id="pds1" style="display: none;">
<ul class="pcoded-item pcoded-right-item" id="pds1" style="display: none;">
<li class="pcoded-hasmenu">
<div class="dropdown">
<button class="btn btn-primary dropdown-toggle"
type="button" id="profilePopup1"
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"
style="background-color: rgb(21,69,93); font-weight: bold; border-color: white; margin-top: 6px;">
<span class="pcoded-micon">
<i class="fa fa-user" style="color: white;" aria-hidden="true"></i>
</span>
<span class="pcoded-mtext" th:text="${userName}" id="userNameLogin"
style="cursor: not-allowed;" data-toggle="tooltip"
data-placement="bottom" title="View/Edit Profile">
</span>
<button class="btn btn-primary dropdown-toggle" type="button" id="profilePopup1"
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"
style="background-color: rgb(21,69,93); font-weight: bold; border-color: white; margin-top: 6px;">
<span class="pcoded-micon">
<i class="fa fa-user" style="color: white;" aria-hidden="true"></i>
</span>
<span class="pcoded-mtext" th:text="${userName}" id="userNameLogin" style="cursor: not-allowed;"
data-toggle="tooltip" data-placement="bottom" title="View/Edit Profile">
</span>
</button>
<div class="dropdown-menu" aria-labelledby="profilePopup1">
<a class="dropdown-item" id="profilePopup"
name="profilePopup" style="cursor: pointer;" onclick="showprofilepopup()">
<a class="dropdown-item" id="profilePopup" name="profilePopup" style="cursor: pointer;"
onclick="showprofilepopup()">
<i class="fa fa-user-circle"></i> View Profile
</a>
<a href="/communityhall/user/logout" class="dropdown-item" id="userloginpopup"
name="userloginpopup" style="cursor: pointer;">
name="userloginpopup" style="cursor: pointer;">
<i class="fa fa-sign-out"></i> User Logout
</a>
</div>
@ -105,8 +101,8 @@
<li>
<div class="dropdown">
<button class="btn btn-primary dropdown-toggle" type="button" id="loginDropdown"
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"
style="background-color: white;color: black;border-color: white;">
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"
style="background-color: white;color: black;border-color: white;">
<span class="pcoded-micon"><i class="fa fa-sign-in" aria-hidden="true"></i></span>
<span class="pcoded-mtext">Login</span>
<span class="pcoded-mcaret"></span>
@ -114,10 +110,10 @@
<div class="dropdown-menu" aria-labelledby="loginDropdown">
<a class="dropdown-item" id="loginpopup" name="loginpopup" style="cursor: pointer;"><i
class="fa fa-user"></i> User Login</a>
<a th:if="${counterName == null}" class="dropdown-item" href="/communityhall/login" style="cursor: pointer;" target="_blank"><i
class="fa fa-lock"></i> Official Login</a>
<a th:if="${counterName == null}" class="dropdown-item" id="counterloginpopup" name="counterloginpopup" style="cursor: pointer;" target="_blank"><i
class="fa fa-lock"></i> Counter Login</a>
<a th:if="${counterName == null}" class="dropdown-item" href="/communityhall/login"
style="cursor: pointer;" target="_blank"><i class="fa fa-lock"></i> Official Login</a>
<!-- <a th:if="${counterName == null}" class="dropdown-item" id="counterloginpopup" name="counterloginpopup" style="cursor: pointer;" target="_blank"><i
class="fa fa-lock"></i> Counter Login</a> -->
</div>
</div>
</li>

741
src/main/resources/templates/headquarters/collection-pending.html

@ -0,0 +1,741 @@
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head th:replace="~{fragments/head-admin :: head}"></head>
<meta charset="ISO-8859-1">
<!-- Include DataTables CSS -->
</head>
<style>
.block-content {
padding-bottom: 10px;
}
.small-input {
width: 150px;
/* Adjust the width as needed */
}
.small-table th,
.small-table td {
font-size: 14px;
/* Adjust font size as needed */
}
/* Reduce padding for table cells */
.small-table td,
.small-table th {
padding: 5px;
/* Adjust padding as needed */
}
.card-body table {
width: 100%;
padding: 100px;
}
.card-body th,
td {
padding: 8px;
text-align: left;
}
.amount-cell {
text-align: right;
padding-right: 1rem;
/* Adjust padding as needed */
}
</style>
<body>
<div id="page-container"
class="sidebar-o sidebar-dark enable-page-overlay side-scroll page-header-fixed page-header-dark">
<aside th:replace="~{fragments/aside-right :: aside}"></aside>
<nav th:replace="~{fragments/nav-headquarters :: nav}"></nav>
<header th:replace="~{fragments/header-headquarters :: header}"></header>
<div class="content" style="margin-top: 77px;">
<div class="block block-rounded">
<div class="block-header bg-info text-white" style="background-color: #2c726c !important">
<h3 class="block-title">Settlement List</h3>
</div>
<div class="block-content">
<div class="table-responsive">
<table id="settlementListTable" class="table table-bordered table-vcenter">
<thead>
<tr>
<th>S.No</th>
<th>Zone</th>
<th>Division</th>
<th>Booking Id</th>
<th>Booking Date</th>
<th>Settlement id</th>
<th>Settlement Raised Date</th>
<th>Deposit Amount</th>
<th>Collection Pending(if any)</th>
<th>Refund Amount</th>
<th>Refund Status</th>
<th>View Details</th>
</tr>
</thead>
<tbody>
<!-- Iterate over past bookings and display them -->
<tr th:each="settlemetList,rowStat : ${collectionPendingList}"
th:if="${settlemetList.settlement != null}">
<td class="text-center" th:text="${rowStat.index + 1}"></td>
<td class="text-center" th:text="${settlemetList.hallDetails.zone}"></td>
<td class="text-center" th:text="${settlemetList.hallDetails.division}"></td>
<td class="text-center" th:text="${settlemetList.bookingId}"></td>
<td class="text-center" th:text="${settlemetList.bookingDate}"></td>
<td class="text-center" th:text="${settlemetList.settlement.settlementId}"></td>
<td class="text-center" th:text="${settlemetList.settlement.cdate}"></td>
<td class="text-center" th:text="${settlemetList.settlement.depositAmount}"></td>
<td class="text-center" th:text="${settlemetList.settlement.collectionPending}">
</td>
<td class="text-center" th:text="${settlemetList.settlement.refundedAmount}"></td>
<td class="text-center" th:text="${settlemetList.refundStatus}"></td>
<td>
<span class="badge bg-primary" style="cursor:pointer"
th:onclick="approve([[${settlemetList.settlement.settlementId}]])">View</span>
<!-- <span class="badge bg-warning" style="cursor: pointer;"
th:if="${#strings.trim(settlemetList.RefundStatus) == 'REJECTED'}"
th:onclick="settleTheAmount([[${settlemetList.bookingId}]])">Raise
Again</span> -->
<span class="badge bg-warning" style="cursor: pointer;"
th:if="${settlemetList.settlement.collectionPending > 0} and ${settlemetList.settlement.collectionStatus != 'paid'}"
th:onclick="|fetchQRCode(${settlemetList.bookingId})|">QR
</span>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div><br>
<br>
<br>
<br>
</div>
<!--modal for pending-->
<div class="modal fade backdrop" id="settlementinformation" data-backdrop="static" tabindex="-1" role="dialog"
aria-labelledby="staticBackdropLabel" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<form id="ownform">
<div class="block block-rounded block-themed block-transparent mb-0">
<div class="block-header bg-primary-dark">
<h3 class="block-title" id="2mtitle">Settlement Information</h3>
<div class="block-options">
<button type="button" class="btn-block-option" data-bs-dismiss="modal"
aria-label="Close">
<i class="fa fa-fw fa-times"></i>
</button>
</div>
</div>
<div class="block-content row">
<div class="col-md-12 col-lg-12 col-sm-12">
<input type="hidden" class="form-control text-center" name="settlementid"
id="settlementid" disabled />
<div class="card-body">
<table>
<tr>
<th colspan="10" style="background-color: #f2f2f2;">User Details</th>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal;">User Name:</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;" id="td_userName">
</td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal;">Mobile Number:
</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_mobileNumber"></td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal;">User Type:</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;" id="td_usertype">
</td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal;">User Address:</th>
<td colspan="5" class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_useraddress"></td>
</tr>
</table>
</div>
</div>
<div class="col-md-12 col-lg-12 col-sm-12">
<input type="hidden" class="form-control text-center" name="settlementid"
id="settlementid" disabled />
<div class="card-body">
<table>
<tr>
<th colspan="4" style="background-color: #f2f2f2;">Booking
Details(Booking Id:-<span id="booking_id" style="color:blue"></span>)
</th>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Booking Date:</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_bookingDate"></td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Deposit Amount:
</th>
<td class="fw-semibold amount-cell" style="padding: 0.45rem 0.45rem;"
id="td_depositeAmount"></td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Start Date:</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;" id="td_startDate">
</td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Hall Amount:</th>
<td class="fw-semibold amount-cell" style="padding: 0.45rem 0.45rem;"
id="td_hallAmount"></td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">END
Date:</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;" id="td_endDate">
</td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">GST @18%:</th>
<td class="fw-semibold amount-cell" style="padding: 0.45rem 0.45rem;"
id="td_gst"></td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Starting Slot:</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_startingSlot"></td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Total Amount:</th>
<td class="fw-semibold amount-cell" style="padding: 0.45rem 0.45rem;"
id="td_totalAmount"></td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Ending Slot:</th>
<td colspan="3" class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_endingSlot"></td>
</tr>
</table>
</div>
</div>
<div class="col-md-12 col-lg-12 col-sm-12">
<div class="card-body">
<table>
<tr>
<th colspan="6" style="background-color: #f2f2f2;">EB Details</th>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Consumer Number:
</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;" id="td_EBNumber">
</td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">EB Amount Per Unit:
</th>
<td class="fw-semibold amount-cell" style="padding: 0.45rem 0.45rem;"
id="td_ebamountperunit"></td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">MF DT Unit:</th>
<td class="fw-semibold amount-cell" style="padding: 0.45rem 0.45rem;"
id="td_mfDtUnit"></td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Start Reading:</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_startingReading"></td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">END Reading:</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_endingReading"></td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Unit Consumed:</th>
<td class="fw-semibold amount-cell" style="padding: 0.45rem 0.45rem;"
id="td_usedunit"></td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">EB Amount:</th>
<td colspan="5" class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_electricityamount"></td>
</tr>
</table>
</div>
</div>
<div id="damageDetails" style="margin-bottom: -17px;"></div>
<div class="col-md-12 col-lg-12 col-sm-12">
<div class="card-body">
<table>
<tr>
<th colspan="2" style="background-color: #f2f2f2;">Amount
to be Refunded</th>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Deposit Amount:
</th>
<td class="fw-semibold amount-cell" style="padding: 0.45rem 0.45rem;"
id="td_depositeamountforrefund">0</td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">EB Amount:</th>
<td class="fw-semibold amount-cell"
style="padding: 0.45rem 0.45rem;color:red" id="td_ebAmount">0</td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Damage(if any):
</th>
<td class="fw-semibold amount-cell"
style="padding: 0.45rem 0.45rem;color:red" id="td_damage">0</td>
</tr>
<tr id="pendingcolumn">
<th id="th_settel_label"
style="padding: 0.45rem 0.45rem;font-weight: normal">Collection Pending
Amount:</th>
<td class="fw-semibold amount-cell"
style="padding: 0.45rem 0.45rem; color: green;" id="td_pending_amt">0
</td>
</tr>
<tr id="collectionstatuscolumn">
<th id="label" style="padding: 0.45rem 0.45rem;font-weight: normal">
Collection Pending Status
:</th>
<td class="fw-semibold amount-cell"
style="padding: 0.45rem 0.45rem; color: green;"
id="td_collection_status">
</td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Actual refundable
Amount:</th>
<td class="fw-semibold amount-cell"
style="padding: 0.45rem 0.45rem; color: green;" id="td_settel_amt">0
</td>
</tr>
</table>
</div>
</div>
<!-- End damage detail -->
</div>
<div class="block-content block-content-full text-end bg-body" id="mbutton2">
<button type="button" class="btn btn-sm btn-alt-secondary"
data-bs-dismiss="modal">Close</button>
<a id="downloadLink" style="display: none;"></a>
</div>
</div>
</form>
</div>
</div>
</div>
<div class="modal fade" id="fileModal" tabindex="-1" role="dialog" aria-labelledby="fileModalLabel"
aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="fileModalLabel">File Preview</h5>
<button type="button" class="close" data-bs-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<embed id="filePreview" src="" width="100%" height="600px">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="qrview" tabindex="-1" role="dialog" aria-labelledby="fileModalLabel" aria-hidden="true">
<div class="modal-dialog modal-sm" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="qrview">QR Code for Collection Pending</h5>
</div>
<div class="modal-body">
<div>
<img style="border:4px solid #15455D;width: 256px; height: 260px;border-radius:10px;"
id="qrCodeImage" alt="QR Code">
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<div th:replace="~{fragments/resetpassword :: div}"></div>
<script th:replace="~{fragments/script :: script}"></script>
<footer th:replace="~{fragments/footer2 :: footer}"></footer>
<script th:replace="~{fragments/loginscript :: script}"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script>
<script>
$(document).ready(
function () {
// DataTables buttons configuration
var buttons = [{
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'
},
];
$('#settlementListTable').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']],
scrollY: '50vh',
fixedColumns: {
left: 1,
right: 1
},
buttons: [buttons],
responsive: true,
searching: true, // Enable search
select: false,
processing: false,
});
// Link the search input to DataTable
$('#searchInput').on('keyup', function () {
dataTable.search(this.value).draw();
});
});
function showDamageImage(imageUrl) {
document.getElementById('filePreview').src = imageUrl;
$('#fileModal').modal('show');
}
function settleTheAmount(bookingId) {
window.location.href = '/communityhall/caretaker/caretakerpage?bookingId=' + bookingId;
}
function approve(settlementId) {
$.ajax({
type: "GET",
url: '/communityhall/api/officer/getSettlementList',
data: {
'settlementsid': settlementId
},
success: function (x) {
showSettlementInfo(x)
showDamageDetails(x);
}
});
}
function showSettlementInfo(list) {
$('#settlementinformation').modal({
backdrop: 'static',
keyboard: false
});
$('#settlementinformation').modal('show');
document.getElementById("settlementid").value = list.settlement.settlementId;
document.getElementById("td_userName").innerHTML = list.users.name;
document.getElementById("td_mobileNumber").innerHTML = list.users.mobileNo;
document.getElementById("td_usertype").innerHTML = list.users.usertype;
var userDetails = list.users;
var userDetailsString =
userDetails.doorNo + ", " +
userDetails.street + ", " +
userDetails.area + ", " +
userDetails.location + " ,Chennai- " +
userDetails.pinCode;
document.getElementById("td_useraddress").innerHTML = userDetailsString;
document.getElementById("td_bookingDate").innerHTML = list.bookingDate;
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 formattedGst = gstcl.toFixed(2);
document.getElementById("td_gst").innerHTML = "₹ " + formattedGst;
document.getElementById("td_startDate").innerHTML = list.startDate;
document.getElementById("td_endDate").innerHTML = list.endDate;
document.getElementById("booking_id").innerHTML = list.bookingId;
function getTimeSlot(slotValue) {
var timeSlot;
var trimmedSlotValue = String(slotValue).trim(); // Convert to string and then trim
if (trimmedSlotValue === '1') {
timeSlot = 'Morning';
} else if (trimmedSlotValue === '2') {
timeSlot = 'Evening';
} else {
timeSlot = 'Unknown';
}
return timeSlot;
}
document.getElementById("td_startingSlot").innerHTML = getTimeSlot(list.startingSlot);
document.getElementById("td_endingSlot").innerHTML = getTimeSlot(list.endingSlot);
document.getElementById("td_EBNumber").innerHTML = list.hallDetails.ebNumber;
document.getElementById("td_startingReading").innerHTML = list.ebDetails.startingReading;
document.getElementById("td_endingReading").innerHTML = list.ebDetails.endingReading;
document.getElementById("td_usedunit").innerHTML = list.ebDetails.usedUnit;
document.getElementById("td_ebamountperunit").innerHTML = "₹ " + parseFloat(list.hallDetails.ebCostPerUnit).toFixed(2);
document.getElementById("td_mfDtUnit").innerHTML = "₹ " + parseFloat(list.hallDetails.mfDtUnit).toFixed(2);
document.getElementById("td_depositeamountforrefund").innerHTML = "₹ " + parseFloat(list.depositAmount).toFixed(2);
document.getElementById("td_ebAmount").innerHTML = "₹ " + parseFloat(list.ebDetails.ebAmount).toFixed(2);
document.getElementById("td_electricityamount").innerHTML = "₹ " + parseFloat(list.ebDetails.ebAmount).toFixed(2);
document.getElementById("td_damage").innerHTML = "₹ " + parseFloat(list.settlement.damageAmount).toFixed(2);
var eb_amt = list.ebDetails.ebAmount;
var deposit_amt = list.depositAmount;
var tem_total = deposit_amt - eb_amt;
$("#td_settel_amt").html('');
$("#td_settel_amt").html(tem_total);
}
function showDamageDetails(data) {
var damageFieldContainer = $('#damageDetails');
damageFieldContainer.empty();
// Create a div for table responsiveness
var tableResponsiveDiv = $('<div>').addClass('table-responsive').css('margin-right', '-24px');
// Create table with similar classes and styles to the modal table
var table = $('<table>').addClass('table table-bordered table-striped').css({ 'width': '97%', 'border-color': 'black', 'border-top-color': 'white' });
var thead = $('<thead>').addClass('thead-light');
var tbody = $('<tbody>');
// Create Damage Details header row
var headerRow = $('<tr>').appendTo(thead);
$('<th>').attr('colspan', '6').text('Damage Details (if any)').css({
'padding': '0.45rem 0.45rem',
'background-color': '#f2f2f2',
'font-weight': 'bold',
'color': 'black',
}).appendTo(headerRow);
// Create table header row
var columnHeadersRow = $('<tr>').css('background-color', '#f2f2f2').appendTo(thead);
$('<th>').text('S.No').css({ 'padding': '0.45rem 0.45rem', 'text-align': 'center' }).appendTo(columnHeadersRow);
$('<th>').text('Asset Name').css({ 'padding': '0.45rem 0.45rem', 'text-align': 'center' }).appendTo(columnHeadersRow);
$('<th>').text('Damage Img').css({ 'padding': '0.45rem 0.45rem', 'text-align': 'center' }).appendTo(columnHeadersRow);
$('<th>').text('Cost').css({ 'padding': '0.45rem 0.45rem', 'text-align': 'center' }).appendTo(columnHeadersRow);
$('<th>').text('Qty').css({ 'padding': '0.45rem 0.45rem', 'text-align': 'center' }).appendTo(columnHeadersRow);
$('<th>').text('Amount').css({ 'padding': '0.45rem 0.45rem', 'text-align': 'center' }).appendTo(columnHeadersRow);
var totalAmount = 0;
// Check if damageList is empty
if (data.damageList.length === 0) {
var row = $('<tr>').appendTo(tbody);
$('<td>').attr('colspan', '6').text('No Damaged Items').css({
'padding': '0.45rem 0.45rem',
'text-align': 'center',
'font-weight': 'bold',
'background-color': '#f2f2f2'
}).appendTo(row);
} else {
$.each(data.damageList, function (index, detail) {
var row = $('<tr>').appendTo(tbody);
$('<td>').text(index + 1).css({
'padding': '0.45rem 0.45rem',
'text-align': 'center'
}).appendTo(row);
$('<td>').text(detail.assetName).css({
'padding': '0.45rem 0.45rem',
'text-align': 'center'
}).appendTo(row);
var viewLink = $('<a>').attr('href', 'javascript:void(0)').text('View').on('click', function () {
showDamageImage(detail.damageImageUrl);
});
$('<td>').css({
'padding': '0.45rem 0.45rem',
'text-align': 'center'
}).append(viewLink).appendTo(row);
var assetamt = (detail.assetAmount / detail.quantity).toFixed(2);
$('<td>').text('₹ ' + assetamt).css({
'padding': '0.45rem 0.45rem',
'text-align': 'center'
}).appendTo(row);
$('<td>').text(detail.quantity).css({
'padding': '0.45rem 0.45rem',
'text-align': 'center'
}).appendTo(row);
var amount = detail.assetAmount;
totalAmount += amount;
$('<td>').text('₹ ' + amount.toFixed(2)).css({
'padding': '0.45rem 0.45rem',
'text-align': 'right'
}).appendTo(row);
});
// Add row for total amount
var totalRow = $('<tr>').appendTo(tbody);
$('<td>').attr('colspan', '5').text('Total Amount').css({
'padding': '0.45rem 0.45rem',
'font-weight': 'bold',
'background-color': '#f2f2f2'
}).appendTo(totalRow);
$('<td>').text('₹ ' + totalAmount.toFixed(2)).css({
'padding': '0.45rem 0.45rem',
'text-align': 'right'
}).appendTo(totalRow);
$("#td_dam_amt").html('₹ ' + totalAmount.toFixed(2));
}
// Append the table elements to the container div
table.append(thead, tbody);
tableResponsiveDiv.append(table);
damageFieldContainer.append(tableResponsiveDiv);
var temp_total = parseFloat($("#td_settel_amt").html());
var settleAmount = temp_total - totalAmount;
if (settleAmount < 0) {
var pendingstatus = data.settlement.collectionStatus;
$("#td_settel_amt").html(0);
$("#pendingcolumn").show();
$("#collectionstatuscolumn").show();
$('#td_collection_status').html(pendingstatus);
$("#td_pending_amt").html(Math.abs(settleAmount).toFixed(2));
$("#td_pending_amt").css("color", "red");
$("#approvebutton").show();
$("#rejectbutton").show();
} else {
$("#td_settel_amt").html('₹ ' + settleAmount.toFixed(2));
$("#pendingcolumn").hide();
$("#collectionstatuscolumn").hide();
$("#td_settel_amt").css("color", "green"); // Set color to green for positive amounts
$("#approvebutton").hide();
$("#rejectbutton").hide();
}
}
function showDamageImage(damageImageUrl) {
document.getElementById('filePreview').src = damageImageUrl;
$('#fileModal').modal('show');
}
function accept() {
let id = document.getElementById("settlementid").value;
Swal.fire({
title: 'Do you want to Approve this Settlement ?',
showDenyButton: true,
showCancelButton: true,
confirmButtonText: 'YES',
denyButtonText: 'NO',
}).then((result) => {
/* Read more about isConfirmed, isDenied below */
if (result.isConfirmed) {
$.ajax({
type: "POST",
url: '/communityhall/api/officer/updateApprovedSettlementStatus/' + id,
data: {
'status': 'COMPLETED',
'comments': 'Accepted',
'settlementId': id
},
success: function (data, textStatus, xhr) {
if (xhr.status === 200) { // Check if the response status is OK
Swal.fire(
'Done',
'Successfully Accepted to the ID:' + id,
'success'
).then(() => {
location.reload();
});
} else {
Swal.fire(
'Error',
'Failed to accept the user',
'error'
);
}
},
error: function (xhr, textStatus, errorThrown) {
Swal.fire(
'Error',
'Failed to accept the user',
'error'
);
}
});
} else if (result.isDenied) {
Swal.fire('Changes are not saved', '', 'info')
}
});
}
function fetchQRCode(bookingId) {
$.ajax({
url: '/communityhall/careTaker/api/generateQRCode',
type: 'GET',
data: { bookingId: bookingId },
success: function (data) {
// Set the QR code image source
$('#qrview').modal('show');
$('#qrCodeImage').attr('src', 'data:image/png;base64,' + data);
// console.log(data);
},
error: function (jqXHR, textStatus, errorThrown) {
console.error('Error fetching QR code:', textStatus, errorThrown);
}
});
}
</script>
</body>
</html>

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

@ -94,7 +94,8 @@
<th class="text-center">Reason for Booking</th>
<th class="text-center">Caretaker Name/MobileNumber</th>
<th class="text-center">Action</th>-->
<th>Zone</th>
<th>Division</th>
<th>Hall Name</th>
<th>Booking Id</th>
<th>Start Date</th>
@ -121,27 +122,33 @@
th:text="${booking.hallDetails.hallInchargeName} + ' / ' + ${booking.hallDetails.hallInchargeMobno}">
</td>-->
<td class="text-center" th:text="${booking.hallDetails.zone}"></td>
<td class="text-center" th:text="${booking.hallDetails.division}">
</td>
<td th:text="${booking.hallDetails.hallName}"></td>
<td th:text="${booking.bookingId}"></td>
<td th:text="${booking.startDate}"></td>
<td th:text="${booking.endDate}"></td>
<td th:text="${booking.noOfDays}"></td>
<td th:text="${booking.startingSlot == 1 ? 'Morning' : 'Evening'}"></td>
<td th:text="${booking.endingSlot == 1 ? 'Morning' : 'Evening'}"></td>
<td th:text="${booking.startingSlot == 1 ? 'Morning' : 'Evening'}">
</td>
<td th:text="${booking.endingSlot == 1 ? 'Morning' : 'Evening'}">
</td>
<td>
<p>
<span class="badge bg-warning" style="cursor: pointer;"
th:onclick="pendingbooking([[${booking.bookingId}]])">View</span>
</p>
<p>
<span type="button" class="btn btn-primary settlement"
th:if="${booking.ebDetails != null and booking.settlement == null}"
th:onclick="settleTheAmount([[${booking.bookingId}]])">Settlement</button>
<span type="button" class="btn btn-primary settlement"
th:if="${booking.ebDetails != null and booking.settlement == null}"
th:onclick="settleTheAmount([[${booking.bookingId}]])">Settlement</button>
</p>
<button type="button" class="btn btn-primary" th:if="${booking.ebDetails==null}"
th:onclick="enterStartingReading([[${booking.bookingId}]], '[[${booking.hallDetails.ebNumber}]]')"
id="ebDetails">EB</button>
<button type="button" class="btn btn-primary"
th:if="${booking.ebDetails==null}"
th:onclick="enterStartingReading([[${booking.bookingId}]], '[[${booking.hallDetails.ebNumber}]]')"
id="ebDetails">EB</button>
</td>
</tr>
</tbody>
@ -178,7 +185,8 @@
<th class="text-center">Reason for Booking</th>
<th class="text-center">Caretaker Name/MobileNumber</th>
<th class="text-center">Action</th>-->
<th>Zone</th>
<th>Division</th>
<th>Hall Name</th>
<th>Booking Id</th>
<th>Start Date</th>
@ -205,27 +213,33 @@
th:text="${booking.hallDetails.hallInchargeName} + ' / ' + ${booking.hallDetails.hallInchargeMobno}">
</td>-->
<td class="text-center" th:text="${booking.hallDetails.zone}"></td>
<td class="text-center" th:text="${booking.hallDetails.division}">
</td>
<td th:text="${booking.hallDetails.hallName}"></td>
<td th:text="${booking.bookingId}"></td>
<td th:text="${booking.startDate}"></td>
<td th:text="${booking.endDate}"></td>
<td th:text="${booking.noOfDays}"></td>
<td th:text="${booking.startingSlot == 1 ? 'Morning' : 'Evening'}"></td>
<td th:text="${booking.endingSlot == 1 ? 'Morning' : 'Evening'}"></td>
<td th:text="${booking.startingSlot == 1 ? 'Morning' : 'Evening'}">
</td>
<td th:text="${booking.endingSlot == 1 ? 'Morning' : 'Evening'}">
</td>
<td>
<p>
<span class="badge bg-warning" style="cursor: pointer;"
th:onclick="pendingbooking([[${booking.bookingId}]])">View</span>
</p>
<p>
<span type="button" class="btn btn-primary settlement"
th:if="${booking.ebDetails != null and booking.settlement == null}"
th:onclick="settleTheAmount([[${booking.bookingId}]])">Settlement</button>
<span type="button" class="btn btn-primary settlement"
th:if="${booking.ebDetails != null and booking.settlement == null}"
th:onclick="settleTheAmount([[${booking.bookingId}]])">Settlement</button>
</p>
<button type="button" class="btn btn-primary" th:if="${booking.ebDetails==null}"
th:onclick="enterStartingReading([[${booking.bookingId}]], '[[${booking.hallDetails.ebNumber}]]')"
id="ebDetails">EB</button>
<button type="button" class="btn btn-primary"
th:if="${booking.ebDetails==null}"
th:onclick="enterStartingReading([[${booking.bookingId}]], '[[${booking.hallDetails.ebNumber}]]')"
id="ebDetails">EB</button>
</td>
</tr>
</tbody>
@ -262,6 +276,8 @@
<th class="text-center">Caretaker Name/MobileNumber</th>
<th class="text-center">Action</th>-->
<th>Zone</th>
<th>Division</th>
<th>Hall Name</th>
<th>Booking Id</th>
<th>Start Date</th>
@ -287,15 +303,19 @@
<td class="text-center"
th:text="${booking.hallDetails.hallInchargeName} + ' / ' + ${booking.hallDetails.hallInchargeMobno}">
</td>-->
<td class="text-center" th:text="${booking.hallDetails.zone}"></td>
<td class="text-center" th:text="${booking.hallDetails.division}">
</td>
<td th:text="${booking.hallDetails.hallName}"></td>
<td th:text="${booking.bookingId}"></td>
<td th:text="${booking.startDate}"></td>
<td th:text="${booking.endDate}"></td>
<td th:text="${booking.noOfDays}"></td>
<td th:text="${booking.startingSlot == 1 ? 'Morning' : 'Evening'}"></td>
<td th:text="${booking.endingSlot == 1 ? 'Morning' : 'Evening'}"></td>
<td th:text="${booking.startingSlot == 1 ? 'Morning' : 'Evening'}">
</td>
<td th:text="${booking.endingSlot == 1 ? 'Morning' : 'Evening'}">
</td>
<td>
<p>
<span class="badge bg-warning" style="cursor: pointer;"
@ -517,7 +537,7 @@
</div>
</div>
</div>
<div class="modal fade" id="fileModal" tabindex="-1" role="dialog" aria-labelledby="fileModalLabel"
aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
@ -539,7 +559,7 @@
</div>
<div class="modal fade backdrop" id="EBdestailsModal" tabindex="-1" role="dialog"
aria-labelledby="staticBackdropLabel" aria-hidden="true">
aria-labelledby="staticBackdropLabel" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="block block-rounded block-themed block-transparent mb-0">
@ -547,19 +567,19 @@
<h3 class="block-title">EB Details</h3>
<div class="block-options">
<button type="button" class="btn-block-option" data-bs-dismiss="modal"
aria-label="Close">
aria-label="Close">
<i class="fa fa-fw fa-times"></i>
</button>
</div>
</div>
<div class="block-content row">
<input type="hidden" class="form-control text-center" id="bookingId" name="bookingId"
readonly>
readonly>
<div class="col-sm-6">
<div class="form-group">
<label for="ebNumber">Consumer Number<span class="required">*</span>:</label>
<input type="text" class="form-control text-center" id="ebNumber" name="ebNumber"
placeholder="EB Number" readonly>
placeholder="EB Number" readonly>
</div>
</div>
<div class="col-sm-6">
@ -567,15 +587,15 @@
<label for="startingReading">Starting Reading<span
class="required">*</span>:</label>
<input type="text" class="form-control text-center" id="startingReading"
name="startingReading">
name="startingReading">
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<label for="startingReadingimage">Starting Reading Image<span
class="required"></span>:</label>
<input type="file" class="form-control text-center startreading-image" id="startingReadingimage"
name="startingReadingimage">
<input type="file" class="form-control text-center startreading-image"
id="startingReadingimage" name="startingReadingimage">
</div>
</div>
</div>
@ -647,7 +667,7 @@
$('#SettlementApprovedListTable').DataTable({
dom: 'Bftip',
columnDefs: [
{targets: 'no-sort', orderable: false}
{ targets: 'no-sort', orderable: false }
],
lengthMenu: [
[50, 100, 200, 500, -1],
@ -666,7 +686,7 @@
$('#cancelledApprovedListTable').DataTable({
dom: 'Bftip',
columnDefs: [
{targets: 'no-sort', orderable: false}
{ targets: 'no-sort', orderable: false }
],
lengthMenu: [
[50, 100, 200, 500, -1],
@ -685,7 +705,7 @@
$('#rejectedApprovedListTable').DataTable({
dom: 'Bftip',
columnDefs: [
{targets: 'no-sort', orderable: false}
{ targets: 'no-sort', orderable: false }
],
lengthMenu: [
[50, 100, 200, 500, -1],
@ -723,16 +743,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;
@ -760,7 +780,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;
@ -1016,7 +1036,7 @@
text: 'EB details saved successfully.',
icon: 'success',
confirmButtonText: 'OK'
}).then(function() {
}).then(function () {
// Reload the page after the alert is dismissed
location.reload();
});

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

@ -74,7 +74,8 @@
<div class="block-content p-0">
<div class="p-sm-4 p-0">
<div class="table-responsive">
<table class="table table-bordered table-striped table-vcenter js-dataTable-responsive" id="SettlementApprovedListTable">
<table class="table table-bordered table-striped table-vcenter js-dataTable-responsive"
id="SettlementApprovedListTable">
<thead class="thead-light">
<tr>
<th>S.no</th>
@ -131,10 +132,13 @@
<div class="block-content p-0">
<div class="p-sm-4 p-0">
<div class="table-responsive">
<table class="table table-bordered table-striped table-vcenter js-dataTable-responsive" id="cancelledApprovedListTable">
<table class="table table-bordered table-striped table-vcenter js-dataTable-responsive"
id="cancelledApprovedListTable">
<thead class="thead-light">
<tr>
<th>S.no</th>
<th>Zone</th>
<th>Division</th>
<th>Booking Id</th>
<th>Booking Date</th>
<th>Hall Name</th>
@ -148,6 +152,10 @@
<tbody>
<tr th:each="cancelledbookings, rowStat : ${refundfailedcancelledbookings}">
<td class="text-center" th:text="${rowStat.index + 1}"></td>
<td class="text-center" th:text="${cancelledbookings.hallDetails.zone}">
</td>
<td class="text-center" th:text="${cancelledbookings.hallDetails.division}">
</td>
<td class="text-center" th:text="${cancelledbookings.bookingId}"></td>
<td class="text-center" th:text="${cancelledbookings.bookingDate}"></td>
<td class="text-center" th:text="${cancelledbookings.hallDetails.hallName}">
@ -155,8 +163,7 @@
<td class="text-center" th:text="${cancelledbookings.users.name}"></td>
<td class="text-center" th:text="${cancelledbookings.users.usertype}"></td>
<td class="text-center" th:text="${cancelledbookings.reason}"></td>
<td class="text-center"
th:text="${cancelledbookings.depositAmount}"></td>
<td class="text-center" th:text="${cancelledbookings.depositAmount}"></td>
<!--<td>
<p>
<span class="badge bg-warning" style="cursor: pointer;"
@ -179,10 +186,13 @@
<div class="block-content p-0">
<div class="p-sm-4 p-0">
<div class="table-responsive">
<table class="table table-bordered table-striped table-vcenter js-dataTable-responsive" id="rejectedApprovedListTable">
<table class="table table-bordered table-striped table-vcenter js-dataTable-responsive"
id="rejectedApprovedListTable">
<thead class="thead-light">
<tr>
<th>S.no</th>
<th>Zone</th>
<th>Division</th>
<th>Booking Id</th>
<th>Booking Date</th>
<th>Hall Name</th>
@ -197,6 +207,10 @@
<tbody>
<tr th:each="rejectedbookings, rowStat : ${refundfailedrejectedbookings}">
<td class="text-center" th:text="${rowStat.index + 1}"></td>
<td class="text-center" th:text="${rejectedbookings.hallDetails.zone}">
</td>
<td class="text-center" th:text="${rejectedbookings.hallDetails.division}">
</td>
<td class="text-center" th:text="${rejectedbookings.bookingId}"></td>
<td class="text-center" th:text="${rejectedbookings.bookingDate}"></td>
<td class="text-center" th:text="${rejectedbookings.hallDetails.hallName}">
@ -379,26 +393,33 @@
<th colspan="6" style="background-color: #f2f2f2;">EB Details</th>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Consumer Number:
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Consumer
Number:
</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;" id="td_EBNumber">
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_EBNumber">
</td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">EB Amount Per Unit:
<th style="padding: 0.45rem 0.45rem;font-weight: normal">EB Amount Per
Unit:
</th>
<td class="fw-semibold amount-cell" style="padding: 0.45rem 0.45rem;"
id="td_ebamountperunit"></td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">MF DT Unit:</th>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">MF DT Unit:
</th>
<td class="fw-semibold amount-cell" style="padding: 0.45rem 0.45rem;"
id="td_mfDtUnit"></td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Start Reading:</th>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Start Reading:
</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_startingReading"></td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">END Reading:</th>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">END Reading:
</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_endingReading"></td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Unit Consumed:</th>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Unit Consumed:
</th>
<td class="fw-semibold amount-cell" style="padding: 0.45rem 0.45rem;"
id="td_usedunit"></td>
</tr>
@ -792,7 +813,7 @@
<!-- Scripts -->
<div th:replace="~{fragments/resetpassword :: div}"></div>
<div th:replace="~{fragments/resetpassword :: div}"></div>
<script th:replace="~{fragments/loginscript :: script}"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
@ -800,7 +821,7 @@
<script>
$(document).ready(function () {
$(document).ready(function () {
// DataTables buttons configuration
var buttons = [
{
@ -844,7 +865,7 @@ $(document).ready(function () {
$('#SettlementApprovedListTable').DataTable({
dom: 'Bftip',
columnDefs: [
{targets: 'no-sort', orderable: false}
{ targets: 'no-sort', orderable: false }
],
lengthMenu: [
[50, 100, 200, 500, -1],
@ -863,7 +884,7 @@ $(document).ready(function () {
$('#cancelledApprovedListTable').DataTable({
dom: 'Bftip',
columnDefs: [
{targets: 'no-sort', orderable: false}
{ targets: 'no-sort', orderable: false }
],
lengthMenu: [
[50, 100, 200, 500, -1],
@ -882,7 +903,7 @@ $(document).ready(function () {
$('#rejectedApprovedListTable').DataTable({
dom: 'Bftip',
columnDefs: [
{targets: 'no-sort', orderable: false}
{ targets: 'no-sort', orderable: false }
],
lengthMenu: [
[50, 100, 200, 500, -1],
@ -1000,7 +1021,7 @@ $(document).ready(function () {
var tableResponsiveDiv = $('<div>').addClass('table-responsive').css('margin-right', '0px');
// Create table with similar classes and styles to the modal table
var table = $('<table>').addClass('table table-bordered table-striped').css({'width': '97%', 'border-color': 'black', 'border-top-color': 'white'});
var table = $('<table>').addClass('table table-bordered table-striped').css({ 'width': '97%', 'border-color': 'black', 'border-top-color': 'white' });
var thead = $('<thead>').addClass('thead-light');
var tbody = $('<tbody>');
@ -1015,12 +1036,12 @@ $(document).ready(function () {
// Create table header row
var columnHeadersRow = $('<tr>').css('background-color', '#f2f2f2').appendTo(thead);
$('<th>').text('S.No').css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(columnHeadersRow);
$('<th>').text('Asset Name').css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(columnHeadersRow);
$('<th>').text('Damage Img').css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(columnHeadersRow);
$('<th>').text('Cost').css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(columnHeadersRow);
$('<th>').text('Qty').css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(columnHeadersRow);
$('<th>').text('Amount').css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(columnHeadersRow);
$('<th>').text('S.No').css({ 'padding': '0.45rem 0.45rem', 'text-align': 'center' }).appendTo(columnHeadersRow);
$('<th>').text('Asset Name').css({ 'padding': '0.45rem 0.45rem', 'text-align': 'center' }).appendTo(columnHeadersRow);
$('<th>').text('Damage Img').css({ 'padding': '0.45rem 0.45rem', 'text-align': 'center' }).appendTo(columnHeadersRow);
$('<th>').text('Cost').css({ 'padding': '0.45rem 0.45rem', 'text-align': 'center' }).appendTo(columnHeadersRow);
$('<th>').text('Qty').css({ 'padding': '0.45rem 0.45rem', 'text-align': 'center' }).appendTo(columnHeadersRow);
$('<th>').text('Amount').css({ 'padding': '0.45rem 0.45rem', 'text-align': 'center' }).appendTo(columnHeadersRow);
var totalAmount = 0;
@ -1121,7 +1142,7 @@ $(document).ready(function () {
var tableResponsiveDiv = $('<div>').addClass('table-responsive').css('margin-right', '-24px');
// Create table with similar classes and styles to the modal table
var table = $('<table>').addClass('table table-bordered table-striped').css({'width': '100%', 'border-color': 'black', 'border-top-color': 'white'});
var table = $('<table>').addClass('table table-bordered table-striped').css({ 'width': '100%', 'border-color': 'black', 'border-top-color': 'white' });
var thead = $('<thead>').addClass('thead-light');
var tbody = $('<tbody>');
var headerRow = $('<tr>').appendTo(thead);
@ -1134,20 +1155,20 @@ $(document).ready(function () {
var columnRow = $('<tr>').css('background-color', '#f2f2f2').appendTo(thead);
//$('<th>').text('DD Number').css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(columnRow);
//$('<th>').text('DD Date').css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(columnRow);
$('<th>').text('Challan Number').css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(columnRow);
$('<th>').text('Challan Amount').css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(columnRow);
$('<th>').text('Challan Image').css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(columnRow);
$('<th>').text('Challan Number').css({ 'padding': '0.45rem 0.45rem', 'text-align': 'center' }).appendTo(columnRow);
$('<th>').text('Challan Amount').css({ 'padding': '0.45rem 0.45rem', 'text-align': 'center' }).appendTo(columnRow);
$('<th>').text('Challan Image').css({ 'padding': '0.45rem 0.45rem', 'text-align': 'center' }).appendTo(columnRow);
var row = $('<tr>').appendTo(tbody);
//$('<td>').text(data.settlement.ddnumber).css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(row);
//$('<td>').text(data.settlement.ddnumber).css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(row);
$('<td>').text(data.settlement.challonnumber).css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(row);
$('<td>').text(data.settlement.challonamount).css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(row);
$('<td>').text(data.settlement.challonnumber).css({ 'padding': '0.45rem 0.45rem', 'text-align': 'center' }).appendTo(row);
$('<td>').text(data.settlement.challonamount).css({ 'padding': '0.45rem 0.45rem', 'text-align': 'center' }).appendTo(row);
//$('<td>').text(data.settlement.dddate).css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(row);
var challanImgLink = $('<a>').attr('href', 'javascript:void(0)').text('View Image').on('click', function () {
showchallonimage(data.settlement.challon);
});
$('<td>').css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).append(challanImgLink).appendTo(row);
var challanImgLink = $('<a>').attr('href', 'javascript:void(0)').text('View Image').on('click', function () {
showchallonimage(data.settlement.challon);
});
$('<td>').css({ 'padding': '0.45rem 0.45rem', 'text-align': 'center' }).append(challanImgLink).appendTo(row);
table.append(thead, tbody);
challonTableContainer.append(table);
@ -1170,7 +1191,7 @@ $(document).ready(function () {
var tableResponsiveDiv = $('<div>').addClass('table-responsive').css('margin-right', '-24px');
// Create table with similar classes and styles to the modal table
var table = $('<table>').addClass('table table-bordered table-striped').css({'width': '100%', 'border-color': 'black', 'border-top-color': 'white'});
var table = $('<table>').addClass('table table-bordered table-striped').css({ 'width': '100%', 'border-color': 'black', 'border-top-color': 'white' });
var thead = $('<thead>').addClass('thead-light');
var tbody = $('<tbody>');
var headerRow = $('<tr>').appendTo(thead);
@ -1181,15 +1202,15 @@ $(document).ready(function () {
'color': 'black',
}).appendTo(headerRow);
var columnRow = $('<tr>').css('background-color', '#f2f2f2').appendTo(thead);
$('<th>').text('DD Number').css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(columnRow);
$('<th>').text('DD Amount').css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(columnRow);
$('<th>').text('DD Date').css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(columnRow);
$('<th>').text('DD Number').css({ 'padding': '0.45rem 0.45rem', 'text-align': 'center' }).appendTo(columnRow);
$('<th>').text('DD Amount').css({ 'padding': '0.45rem 0.45rem', 'text-align': 'center' }).appendTo(columnRow);
$('<th>').text('DD Date').css({ 'padding': '0.45rem 0.45rem', 'text-align': 'center' }).appendTo(columnRow);
var row = $('<tr>').appendTo(tbody);
$('<td>').text(data.settlement.ddnumber).css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(row);
$('<td>').text(data.settlement.ddamount).css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(row);
$('<td>').text(data.settlement.ddnumber).css({ 'padding': '0.45rem 0.45rem', 'text-align': 'center' }).appendTo(row);
$('<td>').text(data.settlement.ddamount).css({ 'padding': '0.45rem 0.45rem', 'text-align': 'center' }).appendTo(row);
$('<td>').text(data.settlement.dddate).css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(row);
$('<td>').text(data.settlement.dddate).css({ 'padding': '0.45rem 0.45rem', 'text-align': 'center' }).appendTo(row);
table.append(thead, tbody);
ddTableContainer.append(table);
@ -1207,7 +1228,7 @@ $(document).ready(function () {
document.getElementById('filePreview').src = damageImageUrl;
$('#fileModal').modal('show');
}
function showchallonimage(challanImgLink){
function showchallonimage(challanImgLink) {
document.getElementById('filePreview').src = challanImgLink;
$('#fileModal').modal('show');
}
@ -1291,76 +1312,76 @@ $(document).ready(function () {
function accept() {
let id = document.getElementById("settlementid").value;
const acceptButton = document.getElementById("approvebutton"); // Add an ID to your button in the HTML
Swal.fire({
title: 'Do you want to Approve this Settlement?',
showDenyButton: true,
showCancelButton: true,
confirmButtonText: 'YES',
denyButtonText: 'NO',
}).then((result) => {
if (result.isConfirmed) {
// Disable the button to prevent multiple clicks
acceptButton.disabled = true;
// Show the loading screen
const loadingSwal = Swal.fire({
title: 'Processing...',
text: 'Please wait while we approve the settlement.',
allowOutsideClick: false, // Prevent closing the popup
didOpen: () => {
Swal.showLoading(); // Show the loading spinner
},
showConfirmButton: false, // Hide the confirm button during loading
});
$.ajax({
type: "POST",
url: '/communityhall/api/officer/updateApprovedSettlementStatus/' + id,
data: {
'status': 'APPROVED',
'comments': 'Accepted',
'settlementId': id
},
success: function (data, textStatus, xhr) {
loadingSwal.close(); // Close the loading popup
if (xhr.status === 200) {
Swal.fire(
'Done',
'Successfully Accepted to the ID: ' + id,
'success'
).then(() => {
location.reload(); // Reload the page after success
});
} else {
Swal.fire(
'Error',
'Failed to accept the user',
'error'
);
}
},
error: function (xhr, textStatus, errorThrown) {
loadingSwal.close(); // Close the loading popup
Swal.fire(
'Error',
'Failed to accept the user',
'error'
);
},
complete: function() {
// Re-enable the button after request completes (success or error)
acceptButton.disabled = false;
}
});
} else if (result.isDenied) {
Swal.fire('Changes are not saved', '', 'info');
}
});
}
function accept() {
let id = document.getElementById("settlementid").value;
const acceptButton = document.getElementById("approvebutton"); // Add an ID to your button in the HTML
Swal.fire({
title: 'Do you want to Approve this Settlement?',
showDenyButton: true,
showCancelButton: true,
confirmButtonText: 'YES',
denyButtonText: 'NO',
}).then((result) => {
if (result.isConfirmed) {
// Disable the button to prevent multiple clicks
acceptButton.disabled = true;
// Show the loading screen
const loadingSwal = Swal.fire({
title: 'Processing...',
text: 'Please wait while we approve the settlement.',
allowOutsideClick: false, // Prevent closing the popup
didOpen: () => {
Swal.showLoading(); // Show the loading spinner
},
showConfirmButton: false, // Hide the confirm button during loading
});
$.ajax({
type: "POST",
url: '/communityhall/api/officer/updateApprovedSettlementStatus/' + id,
data: {
'status': 'APPROVED',
'comments': 'Accepted',
'settlementId': id
},
success: function (data, textStatus, xhr) {
loadingSwal.close(); // Close the loading popup
if (xhr.status === 200) {
Swal.fire(
'Done',
'Successfully Accepted to the ID: ' + id,
'success'
).then(() => {
location.reload(); // Reload the page after success
});
} else {
Swal.fire(
'Error',
'Failed to accept the user',
'error'
);
}
},
error: function (xhr, textStatus, errorThrown) {
loadingSwal.close(); // Close the loading popup
Swal.fire(
'Error',
'Failed to accept the user',
'error'
);
},
complete: function () {
// Re-enable the button after request completes (success or error)
acceptButton.disabled = false;
}
});
} else if (result.isDenied) {
Swal.fire('Changes are not saved', '', 'info');
}
});
}
@ -1428,7 +1449,7 @@ $(document).ready(function () {
let textContent = "This is the content of the text file.";
// Create a Blob containing the text
let blob = new Blob([textContent], {type: "text/plain"});
let blob = new Blob([textContent], { type: "text/plain" });
// Create URL for the Blob
let url = URL.createObjectURL(blob);
@ -1633,78 +1654,78 @@ $(document).ready(function () {
const fileURL = $(this).data('url');
openFileModal(fileURL);
});
function openFileModal(fileURL) {
$('#filePreview').attr('src', fileURL);
$('#fileModal').modal('show');
}
function openFileModal(fileURL) {
$('#filePreview').attr('src', fileURL);
$('#fileModal').modal('show');
}
function approverefund() {
let id = document.getElementById("booksId").value;
const approveButton = document.getElementById("approvedButton");
Swal.fire({
title: 'Do you want to Approve this Settlement?',
showDenyButton: true,
showCancelButton: true,
confirmButtonText: 'YES',
denyButtonText: 'NO',
}).then((result) => {
if (result.isConfirmed) {
// Disable the button after user confirms
approveButton.disabled = true;
// Show the loading popup
const loadingSwal = Swal.fire({
title: 'Processing...',
text: 'Please wait while we approve the settlement.',
allowOutsideClick: false, // Prevent closing the popup
didOpen: () => {
Swal.showLoading(); // Show the loading spinner
},
showConfirmButton: false, // Hide the confirm button during loading
});
$.ajax({
type: "POST",
url: '/communityhall/api/officer/approveCancelledBookingRefund/' + id,
data: {
'status': 'APPROVED',
},
success: function (data, textStatus, xhr) {
loadingSwal.close(); // Close the loading popup
if (xhr.status === 200) {
Swal.fire(
'Done',
'Successfully Accepted to the ID:' + id,
'success'
).then(() => {
location.reload(); // Reload page after success
});
} else {
Swal.fire(
'Error',
'Failed to Approve the Refund',
'error'
);
}
},
error: function (xhr, textStatus, errorThrown) {
loadingSwal.close(); // Close the loading popup
Swal.fire(
'Error',
'Failed to Approve the Refund',
'error'
);
},
complete: function() {
// Re-enable the button after request completes (success or error)
approveButton.disabled = false;
}
});
} else if (result.isDenied) {
Swal.fire('Changes are not saved', '', 'info');
}
});
}
let id = document.getElementById("booksId").value;
const approveButton = document.getElementById("approvedButton");
Swal.fire({
title: 'Do you want to Approve this Settlement?',
showDenyButton: true,
showCancelButton: true,
confirmButtonText: 'YES',
denyButtonText: 'NO',
}).then((result) => {
if (result.isConfirmed) {
// Disable the button after user confirms
approveButton.disabled = true;
// Show the loading popup
const loadingSwal = Swal.fire({
title: 'Processing...',
text: 'Please wait while we approve the settlement.',
allowOutsideClick: false, // Prevent closing the popup
didOpen: () => {
Swal.showLoading(); // Show the loading spinner
},
showConfirmButton: false, // Hide the confirm button during loading
});
$.ajax({
type: "POST",
url: '/communityhall/api/officer/approveCancelledBookingRefund/' + id,
data: {
'status': 'APPROVED',
},
success: function (data, textStatus, xhr) {
loadingSwal.close(); // Close the loading popup
if (xhr.status === 200) {
Swal.fire(
'Done',
'Successfully Accepted to the ID:' + id,
'success'
).then(() => {
location.reload(); // Reload page after success
});
} else {
Swal.fire(
'Error',
'Failed to Approve the Refund',
'error'
);
}
},
error: function (xhr, textStatus, errorThrown) {
loadingSwal.close(); // Close the loading popup
Swal.fire(
'Error',
'Failed to Approve the Refund',
'error'
);
},
complete: function () {
// Re-enable the button after request completes (success or error)
approveButton.disabled = false;
}
});
} else if (result.isDenied) {
Swal.fire('Changes are not saved', '', 'info');
}
});
}
document.addEventListener('DOMContentLoaded', function () {
var ddDetailsCheckbox = document.getElementById('ddDetailsCheckbox');
@ -1747,13 +1768,13 @@ $(document).ready(function () {
event.stopPropagation();
});
});
$('#challonDetails').on('hidden.bs.modal', function () {
// Clear all input fields
$(this).find('form')[0].reset();
$('#challonDetails').on('hidden.bs.modal', function () {
// Clear all input fields
$(this).find('form')[0].reset();
// Optionally, reset any custom styling or classes
$(this).find('input').removeClass('is-valid is-invalid');
});
// Optionally, reset any custom styling or classes
$(this).find('input').removeClass('is-valid is-invalid');
});
</script>
</body>

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

@ -78,7 +78,8 @@
<thead class="thead-light">
<tr>
<th>S.no</th>
<th>Zone/Division</th>
<th>Zone</th>
<th>Division</th>
<th>Hall Name</th>
<th>Booking Id</th>
<th width="10%">Booking Date</th>
@ -95,8 +96,10 @@
<tr th:each="settlements, rowStat : ${completedlist}"
th:if="${settlements.settlement != null}">
<td class="text-center" th:text="${rowStat.index + 1}"></td>
<td class="text-center" th:text="${settlements.hallDetails.zone}">
</td>
<td class="text-center"
th:text="${settlements.hallDetails.zone + ' / ' + settlements.hallDetails.division}">
th:text="${settlements.hallDetails.division}">
</td>
<td class="text-center"
th:text="${settlements.hallDetails.hallName}"></td>
@ -144,6 +147,8 @@
<thead class="thead-light">
<tr>
<th>S.no</th>
<th>Zone</th>
<th>Division</th>
<th>Booking Id</th>
<th>Booking Date</th>
<th>Hall Name</th>
@ -157,6 +162,12 @@
<tbody>
<tr th:each="cancelledbookings, rowStat : ${cancelledcompletedlist}">
<td class="text-center" th:text="${rowStat.index + 1}"></td>
<td class="text-center"
th:text="${cancelledbookings.hallDetails.zone}">
</td>
<td class="text-center"
th:text="${cancelledbookings.hallDetails.division}">
</td>
<td class="text-center" th:text="${cancelledbookings.bookingId}">
</td>
<td class="text-center" th:text="${cancelledbookings.bookingDate}">
@ -199,6 +210,8 @@
<thead class="thead-light">
<tr>
<th>S.no</th>
<th>Zone</th>
<th>Division</th>
<th>Booking Id</th>
<th>Booking Date</th>
<th>Hall Name</th>
@ -213,6 +226,12 @@
<tbody>
<tr th:each="rejectedbookings, rowStat : ${rejectedcompletedlist}">
<td class="text-center" th:text="${rowStat.index + 1}"></td>
<td class="text-center"
th:text="${rejectedbookings.hallDetails.zone}">
</td>
<td class="text-center"
th:text="${rejectedbookings.hallDetails.division}">
</td>
<td class="text-center" th:text="${rejectedbookings.bookingId}">
</td>
<td class="text-center" th:text="${rejectedbookings.bookingDate}">
@ -385,26 +404,33 @@
<th colspan="6" style="background-color: #f2f2f2;">EB Details</th>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Consumer Number:
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Consumer
Number:
</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;" id="td_EBNumber">
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_EBNumber">
</td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">EB Amount Per Unit:
<th style="padding: 0.45rem 0.45rem;font-weight: normal">EB Amount Per
Unit:
</th>
<td class="fw-semibold amount-cell" style="padding: 0.45rem 0.45rem;"
id="td_ebamountperunit"></td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">MF DT Unit:</th>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">MF DT Unit:
</th>
<td class="fw-semibold amount-cell" style="padding: 0.45rem 0.45rem;"
id="td_mfDtUnit"></td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Start Reading:</th>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Start Reading:
</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_startingReading"></td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">END Reading:</th>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">END Reading:
</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_endingReading"></td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Unit Consumed:</th>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Unit Consumed:
</th>
<td class="fw-semibold amount-cell" style="padding: 0.45rem 0.45rem;"
id="td_usedunit"></td>
</tr>

610
src/main/resources/templates/headquarters/settlement-list.html

@ -63,14 +63,14 @@
<a class="nav-link" id="gcc-tab" data-toggle="tab" href="#gcc" role="tab" aria-controls="gcc"
aria-selected="false">GCC Blocked/Rejected Refund</a>
</li>
<li class="nav-item" role="presentation">
<!-- <li class="nav-item" role="presentation">
<a class="nav-link" id="settlement-initiated-tab"
data-toggle="tab"
href="#settlement-initiated"
role="tab"
aria-controls="settlement-initiated"
aria-selected="false">Settlement Initiated</a>
</li>
</li> -->
</ul>
<div class="tab-content" id="myTabContent">
<!-- Settlement Approval Tab -->
@ -81,7 +81,8 @@
<div class="block-content p-0">
<div class="p-sm-4 p-0">
<div class="table-responsive">
<table class="table table-bordered table-striped table-vcenter js-dataTable-responsive" id="SettlementApprovedListTable">
<table class="table table-bordered table-striped table-vcenter js-dataTable-responsive"
id="SettlementApprovedListTable">
<thead class="thead-light">
<tr>
<th>S.no</th>
@ -96,12 +97,13 @@
<th>Collection Pending</th>
<th>Refund Amount</th>
<th>Status</th>
<th>Remarks</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<!--<tr th:each="settlement, rowStat : ${settlementlist}">-->
<tr th:each="settlement, rowStat : ${settlementlist}"
<tr th:each="settlement, rowStat : ${settlementlist}"
th:if="${settlement.settlement.approvedFlag == 0 or settlement.settlement.approvedFlag == null}">
<td class="text-center" th:text="${rowStat.index + 1}"></td>
<td class="text-center" th:text="${settlement.hallDetails.zone}"></td>
@ -118,11 +120,28 @@
<td class="text-center" th:text="${settlement.settlement.refundedAmount}">
</td>
<td class="text-center" th:text="${settlement.refundStatus}"></td>
<td>
<p>
<td class="text-center">
<span
th:if="${settlement.bookingDate != null and settlement.bookingDate.isBefore(T(java.time.LocalDate).now().minusDays(180))}"
class="text-danger fw-semibold" style="font-size: 12px;">
more than 6 month old booking, so settlement not allowed. please
contact Revenue Department - Head Office.
</span>
<span
th:unless="${settlement.bookingDate != null and settlement.bookingDate.isBefore(T(java.time.LocalDate).now().minusDays(180))}">-</span>
</td>
<td class="text-center">
<p class="mb-0"
th:if="${settlement.bookingDate == null or not settlement.bookingDate.isBefore(T(java.time.LocalDate).now().minusDays(180))}">
<span class="badge bg-warning" style="cursor: pointer;"
th:onclick="pending([[${settlement.settlement.settlementId}]])">Approve</span>
</p>
<p class="mb-0"
th:if="${settlement.bookingDate != null and settlement.bookingDate.isBefore(T(java.time.LocalDate).now().minusDays(180))}">
<span class="badge bg-secondary"
style="cursor: not-allowed; opacity: 0.65;"
title="more than 6 month old booking, so settlement not allowed. please contact HQ">Disabled</span>
</p>
</td>
</tr>
</tbody>
@ -140,10 +159,13 @@
<div class="block-content p-0">
<div class="p-sm-4 p-0">
<div class="table-responsive">
<table class="table table-bordered table-striped table-vcenter js-dataTable-responsive" id="cancelledApprovedListTable">
<table class="table table-bordered table-striped table-vcenter js-dataTable-responsive"
id="cancelledApprovedListTable">
<thead class="thead-light">
<tr>
<th>S.no</th>
<th>Zone</th>
<th>Division</th>
<th>Booking Id</th>
<th>Booking Date</th>
<th>Hall Name</th>
@ -151,12 +173,17 @@
<th>User type</th>
<th>Reason for Booking</th>
<th>Refund Amount</th>
<th>Remarks</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<tr th:each="cancelledbookings, rowStat : ${cancelledbookings}">
<td class="text-center" th:text="${rowStat.index + 1}"></td>
<td class="text-center" th:text="${cancelledbookings.hallDetails.zone}">
</td>
<td class="text-center" th:text="${cancelledbookings.hallDetails.division}">
</td>
<td class="text-center" th:text="${cancelledbookings.bookingId}"></td>
<td class="text-center" th:text="${cancelledbookings.bookingDate}"></td>
<td class="text-center" th:text="${cancelledbookings.hallDetails.hallName}">
@ -164,13 +191,29 @@
<td class="text-center" th:text="${cancelledbookings.users.name}"></td>
<td class="text-center" th:text="${cancelledbookings.users.usertype}"></td>
<td class="text-center" th:text="${cancelledbookings.reason}"></td>
<td class="text-center"
th:text="${cancelledbookings.depositAmount}"></td>
<td>
<p>
<td class="text-center" th:text="${cancelledbookings.depositAmount}"></td>
<td class="text-center">
<span
th:if="${cancelledbookings.bookingDate != null and cancelledbookings.bookingDate.isBefore(T(java.time.LocalDate).now().minusDays(180))}"
class="text-danger fw-semibold" style="font-size: 12px;">
more than 6 month old booking, so settlement not allowed. please
contact Revenue Department - Head Office
</span>
<span
th:unless="${cancelledbookings.bookingDate != null and cancelledbookings.bookingDate.isBefore(T(java.time.LocalDate).now().minusDays(180))}">-</span>
</td>
<td class="text-center">
<p class="mb-0"
th:if="${cancelledbookings.bookingDate == null or not cancelledbookings.bookingDate.isBefore(T(java.time.LocalDate).now().minusDays(180))}">
<span class="badge bg-warning" style="cursor: pointer;"
th:onclick="cancelledbooking([[${cancelledbookings.bookingId}]])">Approve</span>
</p>
<p class="mb-0"
th:if="${cancelledbookings.bookingDate != null and cancelledbookings.bookingDate.isBefore(T(java.time.LocalDate).now().minusDays(180))}">
<span class="badge bg-secondary"
style="cursor: not-allowed; opacity: 0.65;"
title="more than 6 month old booking, so settlement not allowed. please contact HQ">Disabled</span>
</p>
</td>
</tr>
</tbody>
@ -188,10 +231,13 @@
<div class="block-content p-0">
<div class="p-sm-4 p-0">
<div class="table-responsive">
<table class="table table-bordered table-striped table-vcenter js-dataTable-responsive" id="rejectedApprovedListTable">
<table class="table table-bordered table-striped table-vcenter js-dataTable-responsive"
id="rejectedApprovedListTable">
<thead class="thead-light">
<tr>
<th>S.no</th>
<th>Zone</th>
<th>Division</th>
<th>Booking Id</th>
<th>Booking Date</th>
<th>Hall Name</th>
@ -200,12 +246,16 @@
<th>Reason for Booking</th>
<th>Reason for Rejection</th>
<th>Refund Amount</th>
<th>Remarks</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<tr th:each="rejectedbookings, rowStat : ${rejectedbookings}">
<td class="text-center" th:text="${rowStat.index + 1}"></td>
<td class="text-center" th:text="${rejectedbookings.hallDetails.zone}"></td>
<td class="text-center" th:text="${rejectedbookings.hallDetails.division}">
</td>
<td class="text-center" th:text="${rejectedbookings.bookingId}"></td>
<td class="text-center" th:text="${rejectedbookings.bookingDate}"></td>
<td class="text-center" th:text="${rejectedbookings.hallDetails.hallName}">
@ -215,11 +265,28 @@
<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>
<p>
<td class="text-center">
<span
th:if="${rejectedbookings.bookingDate != null and rejectedbookings.bookingDate.isBefore(T(java.time.LocalDate).now().minusDays(180))}"
class="text-danger fw-semibold" style="font-size: 12px;">
more than 6 month old booking, so settlement not allowed. please
contact Revenue Department - Head Office
</span>
<span
th:unless="${rejectedbookings.bookingDate != null and rejectedbookings.bookingDate.isBefore(T(java.time.LocalDate).now().minusDays(180))}">-</span>
</td>
<td class="text-center">
<p class="mb-0"
th:if="${rejectedbookings.bookingDate == null or not rejectedbookings.bookingDate.isBefore(T(java.time.LocalDate).now().minusDays(180))}">
<span class="badge bg-warning" style="cursor: pointer;"
th:onclick="rejectedbooking([[${rejectedbookings.bookingId}]])">Approve</span>
</p>
<p class="mb-0"
th:if="${rejectedbookings.bookingDate != null and rejectedbookings.bookingDate.isBefore(T(java.time.LocalDate).now().minusDays(180))}">
<span class="badge bg-secondary"
style="cursor: not-allowed; opacity: 0.65;"
title="more than 6 month old booking, so settlement not allowed. please contact HQ">Disabled</span>
</p>
</td>
</tr>
</tbody>
@ -242,7 +309,7 @@
<tr>
<th>S.nos</th>
<th>Zone</th>
<th>Division</th>
<th>Hall Name</th>
<th>Booking Id</th>
@ -254,6 +321,7 @@
<th>Refund Amount</th>
<th>Status</th>
<th>Last Initade date</th>
<th>Remarks</th>
<th>Action</th>
</tr>
</thead>
@ -277,14 +345,32 @@
<td class="text-center" th:text="${settlement.settlement.refundedAmount}">
</td>
<td class="text-center" th:text="${settlement.refundStatus}"></td>
<td th:text="${#dates.format(settlement.settlement.approvedFlagDate, 'yyyy-MM-dd')}"></td>
<td>
<p>
<td
th:text="${#dates.format(settlement.settlement.approvedFlagDate, 'yyyy-MM-dd')}">
</td>
<td class="text-center">
<span
th:if="${settlement.bookingDate != null and settlement.bookingDate.isBefore(T(java.time.LocalDate).now().minusDays(180))}"
class="text-danger fw-semibold" style="font-size: 12px;">
more than 6 month old booking, so settlement not allowed. please
contact Revenue Department - Head Office
</span>
<span
th:unless="${settlement.bookingDate != null and settlement.bookingDate.isBefore(T(java.time.LocalDate).now().minusDays(180))}">-</span>
</td>
<td class="text-center">
<p class="mb-0"
th:if="${settlement.bookingDate == null or not settlement.bookingDate.isBefore(T(java.time.LocalDate).now().minusDays(180))}">
<span class="badge bg-warning" style="cursor: pointer;"
th:onclick="pending([[${settlement.settlement.settlementId}]])">Approve</span>
</p>
<p class="mb-0"
th:if="${settlement.bookingDate != null and settlement.bookingDate.isBefore(T(java.time.LocalDate).now().minusDays(180))}">
<span class="badge bg-secondary"
style="cursor: not-allowed; opacity: 0.65;"
title="more than 6 month old booking, so settlement not allowed. please contact HQ">Disabled</span>
</p>
</td>
</tr>
</tbody>
@ -453,26 +539,33 @@
<th colspan="6" style="background-color: #f2f2f2;">EB Details</th>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Consumer Number:
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Consumer
Number:
</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;" id="td_EBNumber">
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_EBNumber">
</td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">EB Amount Per Unit:
<th style="padding: 0.45rem 0.45rem;font-weight: normal">EB Amount Per
Unit:
</th>
<td class="fw-semibold amount-cell" style="padding: 0.45rem 0.45rem;"
id="td_ebamountperunit"></td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">MF DT Unit:</th>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">MF DT Unit:
</th>
<td class="fw-semibold amount-cell" style="padding: 0.45rem 0.45rem;"
id="td_mfDtUnit"></td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Start Reading:</th>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Start Reading:
</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_startingReading"></td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">END Reading:</th>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">END Reading:
</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_endingReading"></td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Unit Consumed:</th>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Unit Consumed:
</th>
<td class="fw-semibold amount-cell" style="padding: 0.45rem 0.45rem;"
id="td_usedunit"></td>
</tr>
@ -520,13 +613,14 @@
style="padding: 0.45rem 0.45rem; color: green;" id="td_pending_amt">
0</td>
</tr>
<tr id="collectionstatuscolumn">
<th id="label"
style="padding: 0.45rem 0.45rem;font-weight: normal">Collection Pending Status
:</th>
<td class="fw-semibold amount-cell"
style="padding: 0.45rem 0.45rem; color: green;" id="td_collection_status">
</td>
<tr id="collectionstatuscolumn">
<th id="label" style="padding: 0.45rem 0.45rem;font-weight: normal">
Collection Pending Status
:</th>
<td class="fw-semibold amount-cell"
style="padding: 0.45rem 0.45rem; color: green;"
id="td_collection_status">
</td>
</tr>
<tr>
<th
@ -795,7 +889,7 @@
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<script>
$(document).ready(function () {
$(document).ready(function () {
var buttons = [
{
extend: 'pageLength',
@ -859,7 +953,7 @@
$('#SettlementApprovedListTable').DataTable({
dom: 'Bftip',
columnDefs: [
{targets: 'no-sort', orderable: false}
{ targets: 'no-sort', orderable: false }
],
lengthMenu: [
[50, 100, 200, 500, -1],
@ -878,7 +972,7 @@
$('#cancelledApprovedListTable').DataTable({
dom: 'Bftip',
columnDefs: [
{targets: 'no-sort', orderable: false}
{ targets: 'no-sort', orderable: false }
],
lengthMenu: [
[50, 100, 200, 500, -1],
@ -897,7 +991,7 @@
$('#rejectedApprovedListTable').DataTable({
dom: 'Bftip',
columnDefs: [
{targets: 'no-sort', orderable: false}
{ targets: 'no-sort', orderable: false }
],
lengthMenu: [
[50, 100, 200, 500, -1],
@ -924,15 +1018,15 @@
showDamageDetails(x);
//ak for headquarters
if (x.settlement && x.settlement.approvedFlag === 1) {
$("#approvebutton").hide();
$("#removebutton").hide();
} else {
$("#approvebutton").show();
$("#removebutton").show();
}
$("#approvebutton").hide();
$("#removebutton").hide();
} else {
$("#approvebutton").show();
$("#removebutton").show();
}
}
});
}
@ -1025,7 +1119,7 @@
var tableResponsiveDiv = $('<div>').addClass('table-responsive').css('margin-right', '0px');
// Create table with similar classes and styles to the modal table
var table = $('<table>').addClass('table table-bordered table-striped').css({'width': '97%', 'border-color': 'black', 'border-top-color': 'white'});
var table = $('<table>').addClass('table table-bordered table-striped').css({ 'width': '97%', 'border-color': 'black', 'border-top-color': 'white' });
var thead = $('<thead>').addClass('thead-light');
var tbody = $('<tbody>');
@ -1040,12 +1134,12 @@
// Create table header row
var columnHeadersRow = $('<tr>').css('background-color', '#f2f2f2').appendTo(thead);
$('<th>').text('S.No').css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(columnHeadersRow);
$('<th>').text('Asset Name').css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(columnHeadersRow);
$('<th>').text('Damage Img').css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(columnHeadersRow);
$('<th>').text('Cost').css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(columnHeadersRow);
$('<th>').text('Qty').css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(columnHeadersRow);
$('<th>').text('Amount').css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(columnHeadersRow);
$('<th>').text('S.No').css({ 'padding': '0.45rem 0.45rem', 'text-align': 'center' }).appendTo(columnHeadersRow);
$('<th>').text('Asset Name').css({ 'padding': '0.45rem 0.45rem', 'text-align': 'center' }).appendTo(columnHeadersRow);
$('<th>').text('Damage Img').css({ 'padding': '0.45rem 0.45rem', 'text-align': 'center' }).appendTo(columnHeadersRow);
$('<th>').text('Cost').css({ 'padding': '0.45rem 0.45rem', 'text-align': 'center' }).appendTo(columnHeadersRow);
$('<th>').text('Qty').css({ 'padding': '0.45rem 0.45rem', 'text-align': 'center' }).appendTo(columnHeadersRow);
$('<th>').text('Amount').css({ 'padding': '0.45rem 0.45rem', 'text-align': 'center' }).appendTo(columnHeadersRow);
var totalAmount = 0;
@ -1119,7 +1213,22 @@
var temp_total = parseFloat($("#td_settel_amt").html());
var settleAmount = temp_total - totalAmount;
var refundStatus = data.refundStatus;
var pendingstatus=data.settlement.collectionStatus
var pendingstatus = data.settlement.collectionStatus;
var isOldBooking = false;
if (data.bookingDate) {
var bDateParts = String(data.bookingDate).split('-');
if (bDateParts.length === 3) {
var bookingDateObj = new Date(parseInt(bDateParts[0]), parseInt(bDateParts[1]) - 1, parseInt(bDateParts[2]));
var cutoffDate = new Date();
cutoffDate.setHours(0, 0, 0, 0);
cutoffDate.setDate(cutoffDate.getDate() - 180);
if (bookingDateObj < cutoffDate) {
isOldBooking = true;
}
}
}
if (settleAmount < 0) {
// console.log(settleAmount);
$("#td_settel_amt").html(0.00);
@ -1135,7 +1244,11 @@
$("#pendingcolumn").hide();
$("#collectionstatuscolumn").hide();
$("#td_settel_amt").css("color", "green"); // Set color to green for positive amounts
$("#approvebutton").prop("disabled", false);
if (isOldBooking) {
$("#approvebutton").prop("disabled", true);
} else {
$("#approvebutton").prop("disabled", false);
}
}
}
function showDamageImage(damageImageUrl) {
@ -1144,112 +1257,112 @@
}
function accept() {
let id = document.getElementById("settlementid").value;
const acceptButton = document.getElementById("approvebutton"); // Add an ID to your button in the HTML
Swal.fire({
title: 'Do you want to Approve this Settlement?',
showDenyButton: true,
showCancelButton: true,
confirmButtonText: 'YES',
denyButtonText: 'NO',
}).then((result) => {
if (result.isConfirmed) {
// Disable the button to prevent multiple clicks
acceptButton.disabled = true;
// Show the loading screen
const loadingSwal = Swal.fire({
title: 'Processing...',
text: 'Please wait while we approve the settlement.',
allowOutsideClick: false, // Prevent closing the popup
didOpen: () => {
Swal.showLoading(); // Show the loading spinner
},
showConfirmButton: false, // Hide the confirm button during loading
});
$.ajax({
type: "POST",
url: '/communityhall/api/officer/updateApprovedSettlementStatus/' + id,
data: {
'status': 'APPROVED',
'comments': 'Accepted',
'settlementId': id
},
success: function (data, textStatus, xhr) {
loadingSwal.close(); // Close the loading popup
if (xhr.status === 200) {
Swal.fire(
'Done',
'Successfully Accepted to the ID: ' + id,
'success'
).then(() => {
location.reload(); // Reload the page after success
});
} else {
Swal.fire(
'Error',
'Failed to accept the user',
'error'
);
}
},
/*error: function (xhr, textStatus, errorThrown) {
loadingSwal.close(); // Close the loading popup
Swal.fire(
'Error',
'Failed to accept the user',
'error'
);*/
//ak for headquarters
error: function (xhr, textStatus, errorThrown) {
loadingSwal.close();
console.log("textstaus"+xhr.responseText);
let responseData;
try {
responseData = JSON.parse(xhr.responseText);
} catch (e) {
responseData = null;
}
console.log("Response Data:", responseData);
/* if (responseData && responseData.approvedFlag === 1) {
$("#approvebutton").hide(); // hide approve button if already approved
Swal.fire(
'Error',
'Failed to Approve the Settlement',
'error'
);*/
if (responseData && responseData.approvedFlag === 1) {
$("#approvebutton").hide(); // hide approve button if already approved
Swal.fire(
'Error',
'Failed to Approve the Settlement',
'error'
).then(() => {
location.reload(); // reload page after user closes the alert
});
} else {
Swal.fire(
'Error',
'Failed to Approve24 the Settlement',
'error'
);
}
},
complete: function() {
// Re-enable the button after request completes (success or error)
acceptButton.disabled = false;
}
});
} else if (result.isDenied) {
Swal.fire('Changes are not saved', '', 'info');
}
});
}
let id = document.getElementById("settlementid").value;
const acceptButton = document.getElementById("approvebutton"); // Add an ID to your button in the HTML
Swal.fire({
title: 'Do you want to Approve this Settlement?',
showDenyButton: true,
showCancelButton: true,
confirmButtonText: 'YES',
denyButtonText: 'NO',
}).then((result) => {
if (result.isConfirmed) {
// Disable the button to prevent multiple clicks
acceptButton.disabled = true;
// Show the loading screen
const loadingSwal = Swal.fire({
title: 'Processing...',
text: 'Please wait while we approve the settlement.',
allowOutsideClick: false, // Prevent closing the popup
didOpen: () => {
Swal.showLoading(); // Show the loading spinner
},
showConfirmButton: false, // Hide the confirm button during loading
});
$.ajax({
type: "POST",
url: '/communityhall/api/officer/updateApprovedSettlementStatus/' + id,
data: {
'status': 'APPROVED',
'comments': 'Accepted',
'settlementId': id
},
success: function (data, textStatus, xhr) {
loadingSwal.close(); // Close the loading popup
if (xhr.status === 200) {
Swal.fire(
'Done',
'Successfully Accepted to the ID: ' + id,
'success'
).then(() => {
location.reload(); // Reload the page after success
});
} else {
Swal.fire(
'Error',
'Failed to accept the user',
'error'
);
}
},
/*error: function (xhr, textStatus, errorThrown) {
loadingSwal.close(); // Close the loading popup
Swal.fire(
'Error',
'Failed to accept the user',
'error'
);*/
//ak for headquarters
error: function (xhr, textStatus, errorThrown) {
loadingSwal.close();
console.log("textstaus" + xhr.responseText);
let responseData;
try {
responseData = JSON.parse(xhr.responseText);
} catch (e) {
responseData = null;
}
console.log("Response Data:", responseData);
/* if (responseData && responseData.approvedFlag === 1) {
$("#approvebutton").hide(); // hide approve button if already approved
Swal.fire(
'Error',
'Failed to Approve the Settlement',
'error'
);*/
if (responseData && responseData.approvedFlag === 1) {
$("#approvebutton").hide(); // hide approve button if already approved
Swal.fire(
'Error',
'Failed to Approve the Settlement',
'error'
).then(() => {
location.reload(); // reload page after user closes the alert
});
} else {
Swal.fire(
'Error',
'Failed to Approve24 the Settlement',
'error'
);
}
},
complete: function () {
// Re-enable the button after request completes (success or error)
acceptButton.disabled = false;
}
});
} else if (result.isDenied) {
Swal.fire('Changes are not saved', '', 'info');
}
});
}
function rejectsubmit() {
let id = document.getElementById("settlementid").value;
@ -1315,7 +1428,7 @@
let textContent = "This is the content of the text file.";
// Create a Blob containing the text
let blob = new Blob([textContent], {type: "text/plain"});
let blob = new Blob([textContent], { type: "text/plain" });
// Create URL for the Blob
let url = URL.createObjectURL(blob);
@ -1434,6 +1547,25 @@
document.getElementById("payamountReceived").innerHTML = '₹ ' + list.payments.amountReceived;
document.getElementById("paymentStatus").innerHTML = list.payments.paymentStatus;
var isOldBooking = false;
if (list.bookingDate) {
var bDateParts = String(list.bookingDate).split('-');
if (bDateParts.length === 3) {
var bookingDateObj = new Date(parseInt(bDateParts[0]), parseInt(bDateParts[1]) - 1, parseInt(bDateParts[2]));
var cutoffDate = new Date();
cutoffDate.setHours(0, 0, 0, 0);
cutoffDate.setDate(cutoffDate.getDate() - 180);
if (bookingDateObj < cutoffDate) {
isOldBooking = true;
}
}
}
if (isOldBooking) {
$("#approvedButton").prop("disabled", true);
} else {
$("#approvedButton").prop("disabled", false);
}
showReasonDocuments(list);
}
@ -1520,78 +1652,78 @@
const fileURL = $(this).data('url');
openFileModal(fileURL);
});
function openFileModal(fileURL) {
$('#filePreview').attr('src', fileURL);
$('#fileModal').modal('show');
}
function openFileModal(fileURL) {
$('#filePreview').attr('src', fileURL);
$('#fileModal').modal('show');
}
function approverefund() {
let id = document.getElementById("booksId").value;
const approveButton = document.getElementById("approvedButton");
Swal.fire({
title: 'Do you want to Approve this Settlement?',
showDenyButton: true,
showCancelButton: true,
confirmButtonText: 'YES',
denyButtonText: 'NO',
}).then((result) => {
if (result.isConfirmed) {
// Disable the button after user confirms
approveButton.disabled = true;
// Show the loading popup
const loadingSwal = Swal.fire({
title: 'Processing...',
text: 'Please wait while we approve the settlement.',
allowOutsideClick: false, // Prevent closing the popup
didOpen: () => {
Swal.showLoading(); // Show the loading spinner
},
showConfirmButton: false, // Hide the confirm button during loading
});
$.ajax({
type: "POST",
url: '/communityhall/api/officer/approveCancelledBookingRefund/' + id,
data: {
'status': 'APPROVED',
},
success: function (data, textStatus, xhr) {
loadingSwal.close(); // Close the loading popup
if (xhr.status === 200) {
Swal.fire(
'Done',
'Successfully Accepted to the ID:' + id,
'success'
).then(() => {
location.reload(); // Reload page after success
});
} else {
Swal.fire(
'Error',
'Failed to Approve the Refund',
'error'
);
}
},
error: function (xhr, textStatus, errorThrown) {
loadingSwal.close(); // Close the loading popup
Swal.fire(
'Error',
'Failed to Approve the Refund',
'error'
);
},
complete: function() {
// Re-enable the button after request completes (success or error)
approveButton.disabled = false;
}
});
} else if (result.isDenied) {
Swal.fire('Changes are not saved', '', 'info');
}
});
}
let id = document.getElementById("booksId").value;
const approveButton = document.getElementById("approvedButton");
Swal.fire({
title: 'Do you want to Approve this Settlement?',
showDenyButton: true,
showCancelButton: true,
confirmButtonText: 'YES',
denyButtonText: 'NO',
}).then((result) => {
if (result.isConfirmed) {
// Disable the button after user confirms
approveButton.disabled = true;
// Show the loading popup
const loadingSwal = Swal.fire({
title: 'Processing...',
text: 'Please wait while we approve the settlement.',
allowOutsideClick: false, // Prevent closing the popup
didOpen: () => {
Swal.showLoading(); // Show the loading spinner
},
showConfirmButton: false, // Hide the confirm button during loading
});
$.ajax({
type: "POST",
url: '/communityhall/api/officer/approveCancelledBookingRefund/' + id,
data: {
'status': 'APPROVED',
},
success: function (data, textStatus, xhr) {
loadingSwal.close(); // Close the loading popup
if (xhr.status === 200) {
Swal.fire(
'Done',
'Successfully Accepted to the ID:' + id,
'success'
).then(() => {
location.reload(); // Reload page after success
});
} else {
Swal.fire(
'Error',
'Failed to Approve the Refund',
'error'
);
}
},
error: function (xhr, textStatus, errorThrown) {
loadingSwal.close(); // Close the loading popup
Swal.fire(
'Error',
'Failed to Approve the Refund',
'error'
);
},
complete: function () {
// Re-enable the button after request completes (success or error)
approveButton.disabled = false;
}
});
} else if (result.isDenied) {
Swal.fire('Changes are not saved', '', 'info');
}
});
}
document.addEventListener('DOMContentLoaded', function () {
var ddDetailsCheckbox = document.getElementById('ddDetailsCheckbox');
@ -1635,13 +1767,13 @@
event.stopPropagation();
});
});
$('#challonDetails').on('hidden.bs.modal', function () {
// Clear all input fields
$(this).find('form')[0].reset();
$('#challonDetails').on('hidden.bs.modal', function () {
// Clear all input fields
$(this).find('form')[0].reset();
// Optionally, reset any custom styling or classes
$(this).find('input').removeClass('is-valid is-invalid');
});
// Optionally, reset any custom styling or classes
$(this).find('input').removeClass('is-valid is-invalid');
});
</script>
</body>

88
src/main/resources/templates/headquarters/settlementlist.html

@ -71,6 +71,8 @@
<thead>
<tr>
<th>S.No</th>
<th>Zone</th>
<th>Division</th>
<th>Booking Id</th>
<th>Booking Date</th>
<th>Settlement id</th>
@ -87,6 +89,8 @@
<tr th:each="settlemetList,rowStat : ${settlemetList}"
th:if="${settlemetList.settlement != null}">
<td class="text-center" th:text="${rowStat.index + 1}"></td>
<td class="text-center" th:text="${settlemetList.hallDetails.zone}"></td>
<td class="text-center" th:text="${settlemetList.hallDetails.division}"></td>
<td class="text-center" th:text="${settlemetList.bookingId}"></td>
<td class="text-center" th:text="${settlemetList.bookingDate}"></td>
<td class="text-center" th:text="${settlemetList.settlement.settlementId}"></td>
@ -103,9 +107,9 @@
th:if="${#strings.trim(settlemetList.RefundStatus) == 'REJECTED'}"
th:onclick="settleTheAmount([[${settlemetList.bookingId}]])">Raise
Again</span>
<span class="badge bg-warning" style="cursor: pointer;"
th:if="${settlemetList.settlement.collectionPending > 0} and ${settlemetList.settlement.collectionStatus != 'paid'}"
th:onclick="|fetchQRCode(${settlemetList.bookingId})|">QR
<span class="badge bg-warning" style="cursor: pointer;"
th:if="${settlemetList.settlement.collectionPending > 0} and ${settlemetList.settlement.collectionStatus != 'paid'}"
th:onclick="|fetchQRCode(${settlemetList.bookingId})|">QR
</span>
</td>
</tr>
@ -311,12 +315,13 @@
style="padding: 0.45rem 0.45rem; color: green;" id="td_pending_amt">0
</td>
</tr>
<tr id="collectionstatuscolumn">
<th id="label"
style="padding: 0.45rem 0.45rem;font-weight: normal">Collection Pending Status
<tr id="collectionstatuscolumn">
<th id="label" style="padding: 0.45rem 0.45rem;font-weight: normal">
Collection Pending Status
:</th>
<td class="fw-semibold amount-cell"
style="padding: 0.45rem 0.45rem; color: green;" id="td_collection_status">
style="padding: 0.45rem 0.45rem; color: green;"
id="td_collection_status">
</td>
</tr>
<tr>
@ -364,19 +369,18 @@
</div>
</div>
</div>
<div class="modal fade" id="qrview" tabindex="-1" role="dialog" aria-labelledby="fileModalLabel"
aria-hidden="true">
<div class="modal fade" id="qrview" tabindex="-1" role="dialog" aria-labelledby="fileModalLabel" aria-hidden="true">
<div class="modal-dialog modal-sm" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="qrview">QR Code for Collection Pending</h5>
<h5 class="modal-title" id="qrview">QR Code for Collection Pending</h5>
</div>
<div class="modal-body">
<div>
<img style="border:4px solid #15455D;width: 256px; height: 260px;border-radius:10px;"
id="qrCodeImage" alt="QR Code">
</div>
<img style="border:4px solid #15455D;width: 256px; height: 260px;border-radius:10px;"
id="qrCodeImage" alt="QR Code">
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
@ -543,7 +547,7 @@
var tableResponsiveDiv = $('<div>').addClass('table-responsive').css('margin-right', '-24px');
// Create table with similar classes and styles to the modal table
var table = $('<table>').addClass('table table-bordered table-striped').css({'width': '97%', 'border-color': 'black', 'border-top-color': 'white'});
var table = $('<table>').addClass('table table-bordered table-striped').css({ 'width': '97%', 'border-color': 'black', 'border-top-color': 'white' });
var thead = $('<thead>').addClass('thead-light');
var tbody = $('<tbody>');
@ -558,12 +562,12 @@
// Create table header row
var columnHeadersRow = $('<tr>').css('background-color', '#f2f2f2').appendTo(thead);
$('<th>').text('S.No').css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(columnHeadersRow);
$('<th>').text('Asset Name').css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(columnHeadersRow);
$('<th>').text('Damage Img').css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(columnHeadersRow);
$('<th>').text('Cost').css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(columnHeadersRow);
$('<th>').text('Qty').css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(columnHeadersRow);
$('<th>').text('Amount').css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(columnHeadersRow);
$('<th>').text('S.No').css({ 'padding': '0.45rem 0.45rem', 'text-align': 'center' }).appendTo(columnHeadersRow);
$('<th>').text('Asset Name').css({ 'padding': '0.45rem 0.45rem', 'text-align': 'center' }).appendTo(columnHeadersRow);
$('<th>').text('Damage Img').css({ 'padding': '0.45rem 0.45rem', 'text-align': 'center' }).appendTo(columnHeadersRow);
$('<th>').text('Cost').css({ 'padding': '0.45rem 0.45rem', 'text-align': 'center' }).appendTo(columnHeadersRow);
$('<th>').text('Qty').css({ 'padding': '0.45rem 0.45rem', 'text-align': 'center' }).appendTo(columnHeadersRow);
$('<th>').text('Amount').css({ 'padding': '0.45rem 0.45rem', 'text-align': 'center' }).appendTo(columnHeadersRow);
var totalAmount = 0;
@ -638,8 +642,8 @@
var temp_total = parseFloat($("#td_settel_amt").html());
var settleAmount = temp_total - totalAmount;
if (settleAmount < 0) {
var pendingstatus = data.settlement.collectionStatus;
if (settleAmount < 0) {
var pendingstatus = data.settlement.collectionStatus;
$("#td_settel_amt").html(0);
$("#pendingcolumn").show();
$("#collectionstatuscolumn").show();
@ -660,7 +664,7 @@
function showDamageImage(damageImageUrl) {
document.getElementById('filePreview').src = damageImageUrl;
$('#fileModal').modal('show');
}
}
function accept() {
let id = document.getElementById("settlementid").value;
@ -711,24 +715,24 @@
}
});
}
function fetchQRCode(bookingId) {
$.ajax({
url: '/communityhall/careTaker/api/generateQRCode',
type: 'GET',
data: { bookingId: bookingId },
success: function(data) {
// Set the QR code image source
$('#qrview').modal('show');
$('#qrCodeImage').attr('src', 'data:image/png;base64,' + data);
// console.log(data);
},
error: function(jqXHR, textStatus, errorThrown) {
console.error('Error fetching QR code:', textStatus, errorThrown);
}
});
}
function fetchQRCode(bookingId) {
$.ajax({
url: '/communityhall/careTaker/api/generateQRCode',
type: 'GET',
data: { bookingId: bookingId },
success: function (data) {
// Set the QR code image source
$('#qrview').modal('show');
$('#qrCodeImage').attr('src', 'data:image/png;base64,' + data);
// console.log(data);
},
error: function (jqXHR, textStatus, errorThrown) {
console.error('Error fetching QR code:', textStatus, errorThrown);
}
});
}
</script>
</body>

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

@ -37,64 +37,65 @@
<!-- END Header -->
<!-- Main Container -->
<main id="main-container">
<div class="content">
<div class="content">
<div class="block block-rounded">
<div class="block-header block-header-default">
<h3 class="block-title">List of Bookings Approved</h3>
</div>
<div class="block-content p-0">
<div class="p-sm-4 p-0">
<div class="table-responsive">
<table class="table table-bordered table-striped table-vcenter js-dataTable-responsive" id="bookingaccepetedtable">
<thead class="thead-light">
<tr>
<th class="text-center no-sort">S.No</th>
<th class="text-center">Booking Id</th>
<th class="text-center">Zone</th>
<th class="text-center">Division</th>
<th class="text-center" width="20%">Hall Name</th>
<th class="text-center">User Name</th>
<th class="text-center">User type</th>
<th class="text-center" width="10%">Booking Date</th>
<th class="text-center">Number of days</th>
<th class="text-center">Reason for Booking</th>
<th class="text-center">Caretaker Name/MobileNumber</th>
<th class="text-center">Action</th>
</tr>
</thead>
<tbody>
<!--<tbody th:each="registration, i : ${registrations}">-->
<!--<tr>-->
<tr th:each="booking, rowStat : ${bookingList}">
<td class="text-center" th:text="${rowStat.index + 1}"></td>
<td class="text-center" th:text="${booking.bookingId}"></td>
<td class="text-center" th:text="${booking.hallDetails.zone}"></td>
<td class="text-center" th:text="${booking.hallDetails.division}"></td>
<td class="text-center" th:text="${booking.hallDetails.hallName}"></td>
<td class="text-center" th:text="${booking.users.name}"></td>
<td class="text-center" th:text="${booking.users.usertype}"></td>
<td class="text-center" th:text="${booking.bookingDate}"></td>
<td class="text-center" th:text="${booking.noOfDays}"></td>
<td class="text-center" th:text="${booking.reason}"></td>
<td class="text-center"
th:text="${booking.hallDetails.hallInchargeName} + ' / ' + ${booking.hallDetails.hallInchargeMobno}">
</td>
<td>
<p>
<span class="badge bg-warning" style="cursor: pointer;"
th:onclick="pendingbooking([[${booking.bookingId}]])">Approved</span>
</p>
</td>
</tr>
</tbody>
</table>
<div class="block-header block-header-default">
<h3 class="block-title">List of Bookings Approved</h3>
</div>
<div class="block-content p-0">
<div class="p-sm-4 p-0">
<div class="table-responsive">
<table class="table table-bordered table-striped table-vcenter js-dataTable-responsive"
id="bookingaccepetedtable">
<thead class="thead-light">
<tr>
<th class="text-center no-sort">S.No</th>
<th class="text-center">Booking Id</th>
<th class="text-center">Zone</th>
<th class="text-center">Division</th>
<th class="text-center" width="20%">Hall Name</th>
<th class="text-center">User Name</th>
<th class="text-center">User type</th>
<th class="text-center" width="10%">Booking Date</th>
<th class="text-center">Number of days</th>
<th class="text-center">Reason for Booking</th>
<th class="text-center">Caretaker Name/MobileNumber</th>
<th class="text-center">Action</th>
</tr>
</thead>
<tbody>
<!--<tbody th:each="registration, i : ${registrations}">-->
<!--<tr>-->
<tr th:each="booking, rowStat : ${bookingList}">
<td class="text-center" th:text="${rowStat.index + 1}"></td>
<td class="text-center" th:text="${booking.bookingId}"></td>
<td class="text-center" th:text="${booking.hallDetails.zone}"></td>
<td class="text-center" th:text="${booking.hallDetails.division}"></td>
<td class="text-center" th:text="${booking.hallDetails.hallName}"></td>
<td class="text-center" th:text="${booking.users.name}"></td>
<td class="text-center" th:text="${booking.users.usertype}"></td>
<td class="text-center" th:text="${booking.bookingDate}"></td>
<td class="text-center" th:text="${booking.noOfDays}"></td>
<td class="text-center" th:text="${booking.reason}"></td>
<td class="text-center"
th:text="${booking.hallDetails.hallInchargeName} + ' / ' + ${booking.hallDetails.hallInchargeMobno}">
</td>
<td>
<p>
<span class="badge bg-warning" style="cursor: pointer;"
th:onclick="pendingbooking([[${booking.bookingId}]])">Approved</span>
</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</main>
<!-- END Main Container -->
@ -293,20 +294,23 @@
</div>
<div class="row" id="reasondetails">
<div class="col-md-6 mb-2">
<label class="form-label">Reason type :<span class="text-danger">*</span></label>
<select class="form-control" id="reasontype">
<option value="0" >Select Reason type</option>
<option value="1">Illegal</option>
<option value="2">Others</option>
</select>
</div>
<div class="col-md-6 mb-2">
<label class="form-label">Reason:<span class="text-danger">*</span></label>
<textarea class="form-control " name="reason" id="reason" required style="height: 9px;"></textarea>
<div id="reasonValidationText" class="text-danger small mt-1" style="display:none">
Reason is required.</div>
</div>
<div class="col-md-6 mb-2">
<label class="form-label">Reason type :<span
class="text-danger">*</span></label>
<select class="form-control" id="reasontype">
<option value="0">Select Reason type</option>
<option value="1">Illegal</option>
<option value="2">Others</option>
</select>
</div>
<div class="col-md-6 mb-2">
<label class="form-label">Reason:<span class="text-danger">*</span></label>
<textarea class="form-control " name="reason" id="reason" required
style="height: 9px;"></textarea>
<div id="reasonValidationText" class="text-danger small mt-1"
style="display:none">
Reason is required.</div>
</div>
</div>
</div>
@ -347,7 +351,7 @@
<!-- END Footer -->
</div>
<!-- Scripts -->
<div th:replace="~{fragments/resetpassword :: div}"></div>
<div th:replace="~{fragments/resetpassword :: div}"></div>
<script th:replace="~{fragments/loginscript :: script}"></script>
<script>
//script to open pending form
@ -371,7 +375,7 @@
keyboard: false
});
$('#pendingBookingForm').modal('show');
document.getElementById("td_userName").innerHTML = list.users.name;
document.getElementById("td_mobileNumber").innerHTML = list.users.mobileNo;
document.getElementById("td_usertype").innerHTML = list.users.usertype;
@ -400,7 +404,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;
@ -423,33 +427,33 @@
document.getElementById("td_startingSlot").innerHTML = getTimeSlot(list.startingSlot);
document.getElementById("td_endingSlot").innerHTML = getTimeSlot(list.endingSlot);
document.getElementById("td_bookingStatus").innerHTML = list.bookingStatus;
document.getElementById("td_transactionId").innerHTML = list.payments && list.payments.transactionId ? list.payments.transactionId : "NA";
document.getElementById("td_transactionId").innerHTML = list.payments && list.payments.transactionId ? list.payments.transactionId : "NA";
// Check if amountReceived is not null, otherwise set to "NA"
document.getElementById("td_payamountReceived").innerHTML = list.payments && list.payments.amountReceived ? '₹ ' + list.payments.amountReceived : "NA";
// Check if paymentStatus is not null, otherwise set to "NA"
document.getElementById("td_paymentStatus").innerHTML = list.payments && list.payments.paymentStatus ? list.payments.paymentStatus : "NA";
showReasonDocuments(list);
if (list.reason === 'State Govt Event' || list.reason === 'Central Govt Event' || list.reason === 'Commercial & Others') {
// Disable the reject button
document.getElementById('rejectbutton').disabled = true;
// Hide the reasondetails div
$('#reasondetails').hide();
// Disable the reject button
document.getElementById('rejectbutton').disabled = true;
// Hide the reasondetails div
$('#reasondetails').hide();
} else {
// Enable the reject button
document.getElementById('rejectbutton').disabled = false;
// Show the reasondetails div (if it was hidden before)
$('#reasondetails').show();
// Enable the reject button
document.getElementById('rejectbutton').disabled = false;
// Show the reasondetails div (if it was hidden before)
$('#reasondetails').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();
}
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();
}
}
function showReasonDocuments(list) {
@ -504,24 +508,24 @@
// Iterate through the documents list and populate rows
for (var i = 0; i < bookingDocumentsList.length; i++) {
(function (index) {
var row = $('<tr>').appendTo(tbody);
$('<td>').text(index + 1).appendTo(row);
// Determine the text content for the second cell
var name = bookingDocumentsList[index].name ? bookingDocumentsList[index].name : ''; // Empty string if name is null or undefined
var fieldText = reasonDocumentData[index].fieldName;
var fullText = name ? fieldText + ': ' + name : fieldText; // Include colon only if name is not empty
$('<td>').text(fullText).appendTo(row);
// Create a link to view document image
var viewLink = $('<a>').attr('href', 'javascript:void(0)').text(reasonDocumentData[index].docFieldName).on('click', function () {
showDocumentImage(bookingDocumentsList[index].bookingDocUrl);
});
$('<td>').append(viewLink).appendTo(row);
})(i);
}
(function (index) {
var row = $('<tr>').appendTo(tbody);
$('<td>').text(index + 1).appendTo(row);
// Determine the text content for the second cell
var name = bookingDocumentsList[index].name ? bookingDocumentsList[index].name : ''; // Empty string if name is null or undefined
var fieldText = reasonDocumentData[index].fieldName;
var fullText = name ? fieldText + ': ' + name : fieldText; // Include colon only if name is not empty
$('<td>').text(fullText).appendTo(row);
// Create a link to view document image
var viewLink = $('<a>').attr('href', 'javascript:void(0)').text(reasonDocumentData[index].docFieldName).on('click', function () {
showDocumentImage(bookingDocumentsList[index].bookingDocUrl);
});
$('<td>').append(viewLink).appendTo(row);
})(i);
}
// Append table to the responsive container
tableResponsiveDiv.append(table);
@ -599,133 +603,133 @@
}
function rejectsubmit() {
let id = document.getElementById("bookingid").value;
let reason = document.getElementById("reason").value.trim();
let reasontype = document.getElementById("reasontype").value;
// Check if reason is empty only when rejecting
if (reason === "" || reason.length === 0) {
document.getElementById("reasonValidationText").style.display = "block";
return false; // Prevent form submission
} else {
document.getElementById("reasonValidationText").style.display = "none";
}
Swal.fire({
title: 'Do you want to Reject this User?',
showDenyButton: true,
showCancelButton: true,
confirmButtonText: 'YES',
denyButtonText: 'NO',
}).then((result) => {
if (result.isConfirmed) {
// Show loading popup
const loadingSwal = Swal.fire({
title: 'Processing...',
text: 'Please wait while we process the rejection.',
allowOutsideClick: false, // Prevent closing the popup
didOpen: () => {
Swal.showLoading(); // Show the loading spinner
},
showConfirmButton: false, // Hide the confirm button during loading
});
$.ajax({
type: "POST",
url: '/communityhall/api/officer/updateBookingReject/' + id,
data: {
'status': 'REJECTED',
'comments': reason,
'bookingId': id,
'reasontype': reasontype
},
success: function (data, textStatus, xhr) {
loadingSwal.close(); // Close the loading popup
if (xhr.status === 200) {
Swal.fire(
'Done',
'Successfully Rejected to the ID: ' + id,
'success'
).then(() => {
location.reload(); // Reload page after success
});
} else {
Swal.fire(
'Error',
'Failed to reject the user',
'error'
);
}
},
error: function (xhr, textStatus, errorThrown) {
loadingSwal.close(); // Close the loading popup
Swal.fire(
'Error',
'Failed to reject the user',
'error'
);
}
});
} else if (result.isDenied) {
Swal.fire('Changes are not saved', '', 'info');
}
});
return false; // Prevent form submission
}
let id = document.getElementById("bookingid").value;
let reason = document.getElementById("reason").value.trim();
let reasontype = document.getElementById("reasontype").value;
// Check if reason is empty only when rejecting
if (reason === "" || reason.length === 0) {
document.getElementById("reasonValidationText").style.display = "block";
return false; // Prevent form submission
} else {
document.getElementById("reasonValidationText").style.display = "none";
}
Swal.fire({
title: 'Do you want to Reject this User?',
showDenyButton: true,
showCancelButton: true,
confirmButtonText: 'YES',
denyButtonText: 'NO',
}).then((result) => {
if (result.isConfirmed) {
// Show loading popup
const loadingSwal = Swal.fire({
title: 'Processing...',
text: 'Please wait while we process the rejection.',
allowOutsideClick: false, // Prevent closing the popup
didOpen: () => {
Swal.showLoading(); // Show the loading spinner
},
showConfirmButton: false, // Hide the confirm button during loading
});
$.ajax({
type: "POST",
url: '/communityhall/api/officer/updateBookingReject/' + id,
data: {
'status': 'REJECTED',
'comments': reason,
'bookingId': id,
'reasontype': reasontype
},
success: function (data, textStatus, xhr) {
loadingSwal.close(); // Close the loading popup
if (xhr.status === 200) {
Swal.fire(
'Done',
'Successfully Rejected to the ID: ' + id,
'success'
).then(() => {
location.reload(); // Reload page after success
});
} else {
Swal.fire(
'Error',
'Failed to reject the user',
'error'
);
}
},
error: function (xhr, textStatus, errorThrown) {
loadingSwal.close(); // Close the loading popup
Swal.fire(
'Error',
'Failed to reject the user',
'error'
);
}
});
} else if (result.isDenied) {
Swal.fire('Changes are not saved', '', 'info');
}
});
return false; // Prevent form submission
}
$(document).ready(
function () {
var buttons = [{
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'
},
];
$('#bookingaccepetedtable').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']],
scrollY: '50vh',
fixedColumns: {
left: 1,
right: 1
},
buttons: [buttons],
responsive: true,
searching: true, // Enable search
select: false,
processing: false,
});
});
function () {
var buttons = [{
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'
},
];
$('#bookingaccepetedtable').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']],
scrollY: '50vh',
fixedColumns: {
left: 1,
right: 1
},
buttons: [buttons],
responsive: true,
searching: true, // Enable search
select: false,
processing: false,
});
});
</script>
</body>

741
src/main/resources/templates/officer/collection-pending.html

@ -0,0 +1,741 @@
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head th:replace="~{fragments/head-admin :: head}"></head>
<meta charset="ISO-8859-1">
<!-- Include DataTables CSS -->
</head>
<style>
.block-content {
padding-bottom: 10px;
}
.small-input {
width: 150px;
/* Adjust the width as needed */
}
.small-table th,
.small-table td {
font-size: 14px;
/* Adjust font size as needed */
}
/* Reduce padding for table cells */
.small-table td,
.small-table th {
padding: 5px;
/* Adjust padding as needed */
}
.card-body table {
width: 100%;
padding: 100px;
}
.card-body th,
td {
padding: 8px;
text-align: left;
}
.amount-cell {
text-align: right;
padding-right: 1rem;
/* Adjust padding as needed */
}
</style>
<body>
<div id="page-container"
class="sidebar-o sidebar-dark enable-page-overlay side-scroll page-header-fixed page-header-dark">
<aside th:replace="~{fragments/aside-right :: aside}"></aside>
<nav th:replace="~{fragments/nav-officer :: nav}"></nav>
<header th:replace="~{fragments/header-officer :: header}"></header>
<div class="content" style="margin-top: 77px;">
<div class="block block-rounded">
<div class="block-header bg-info text-white" style="background-color: #2c726c !important">
<h3 class="block-title">Settlement List</h3>
</div>
<div class="block-content">
<div class="table-responsive">
<table id="settlementListTable" class="table table-bordered table-vcenter">
<thead>
<tr>
<th>S.No</th>
<th>Zone</th>
<th>Division</th>
<th>Booking Id</th>
<th>Booking Date</th>
<th>Settlement id</th>
<th>Settlement Raised Date</th>
<th>Deposit Amount</th>
<th>Collection Pending(if any)</th>
<th>Refund Amount</th>
<th>Refund Status</th>
<th>View Details</th>
</tr>
</thead>
<tbody>
<!-- Iterate over past bookings and display them -->
<tr th:each="settlemetList,rowStat : ${collectionPendingList}"
th:if="${settlemetList.settlement != null}">
<td class="text-center" th:text="${rowStat.index + 1}"></td>
<td class="text-center" th:text="${settlemetList.hallDetails.zone}"></td>
<td class="text-center" th:text="${settlemetList.hallDetails.division}"></td>
<td class="text-center" th:text="${settlemetList.bookingId}"></td>
<td class="text-center" th:text="${settlemetList.bookingDate}"></td>
<td class="text-center" th:text="${settlemetList.settlement.settlementId}"></td>
<td class="text-center" th:text="${settlemetList.settlement.cdate}"></td>
<td class="text-center" th:text="${settlemetList.settlement.depositAmount}"></td>
<td class="text-center" th:text="${settlemetList.settlement.collectionPending}">
</td>
<td class="text-center" th:text="${settlemetList.settlement.refundedAmount}"></td>
<td class="text-center" th:text="${settlemetList.refundStatus}"></td>
<td>
<span class="badge bg-primary" style="cursor:pointer"
th:onclick="approve([[${settlemetList.settlement.settlementId}]])">View</span>
<!-- <span class="badge bg-warning" style="cursor: pointer;"
th:if="${#strings.trim(settlemetList.RefundStatus) == 'REJECTED'}"
th:onclick="settleTheAmount([[${settlemetList.bookingId}]])">Raise
Again</span> -->
<span class="badge bg-warning" style="cursor: pointer;"
th:if="${settlemetList.settlement.collectionPending > 0} and ${settlemetList.settlement.collectionStatus != 'paid'}"
th:onclick="|fetchQRCode(${settlemetList.bookingId})|">QR
</span>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div><br>
<br>
<br>
<br>
</div>
<!--modal for pending-->
<div class="modal fade backdrop" id="settlementinformation" data-backdrop="static" tabindex="-1" role="dialog"
aria-labelledby="staticBackdropLabel" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<form id="ownform">
<div class="block block-rounded block-themed block-transparent mb-0">
<div class="block-header bg-primary-dark">
<h3 class="block-title" id="2mtitle">Settlement Information</h3>
<div class="block-options">
<button type="button" class="btn-block-option" data-bs-dismiss="modal"
aria-label="Close">
<i class="fa fa-fw fa-times"></i>
</button>
</div>
</div>
<div class="block-content row">
<div class="col-md-12 col-lg-12 col-sm-12">
<input type="hidden" class="form-control text-center" name="settlementid"
id="settlementid" disabled />
<div class="card-body">
<table>
<tr>
<th colspan="10" style="background-color: #f2f2f2;">User Details</th>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal;">User Name:</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;" id="td_userName">
</td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal;">Mobile Number:
</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_mobileNumber"></td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal;">User Type:</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;" id="td_usertype">
</td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal;">User Address:</th>
<td colspan="5" class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_useraddress"></td>
</tr>
</table>
</div>
</div>
<div class="col-md-12 col-lg-12 col-sm-12">
<input type="hidden" class="form-control text-center" name="settlementid"
id="settlementid" disabled />
<div class="card-body">
<table>
<tr>
<th colspan="4" style="background-color: #f2f2f2;">Booking
Details(Booking Id:-<span id="booking_id" style="color:blue"></span>)
</th>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Booking Date:</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_bookingDate"></td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Deposit Amount:
</th>
<td class="fw-semibold amount-cell" style="padding: 0.45rem 0.45rem;"
id="td_depositeAmount"></td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Start Date:</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;" id="td_startDate">
</td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Hall Amount:</th>
<td class="fw-semibold amount-cell" style="padding: 0.45rem 0.45rem;"
id="td_hallAmount"></td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">END
Date:</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;" id="td_endDate">
</td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">GST @18%:</th>
<td class="fw-semibold amount-cell" style="padding: 0.45rem 0.45rem;"
id="td_gst"></td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Starting Slot:</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_startingSlot"></td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Total Amount:</th>
<td class="fw-semibold amount-cell" style="padding: 0.45rem 0.45rem;"
id="td_totalAmount"></td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Ending Slot:</th>
<td colspan="3" class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_endingSlot"></td>
</tr>
</table>
</div>
</div>
<div class="col-md-12 col-lg-12 col-sm-12">
<div class="card-body">
<table>
<tr>
<th colspan="6" style="background-color: #f2f2f2;">EB Details</th>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Consumer Number:
</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;" id="td_EBNumber">
</td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">EB Amount Per Unit:
</th>
<td class="fw-semibold amount-cell" style="padding: 0.45rem 0.45rem;"
id="td_ebamountperunit"></td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">MF DT Unit:</th>
<td class="fw-semibold amount-cell" style="padding: 0.45rem 0.45rem;"
id="td_mfDtUnit"></td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Start Reading:</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_startingReading"></td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">END Reading:</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_endingReading"></td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Unit Consumed:</th>
<td class="fw-semibold amount-cell" style="padding: 0.45rem 0.45rem;"
id="td_usedunit"></td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">EB Amount:</th>
<td colspan="5" class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_electricityamount"></td>
</tr>
</table>
</div>
</div>
<div id="damageDetails" style="margin-bottom: -17px;"></div>
<div class="col-md-12 col-lg-12 col-sm-12">
<div class="card-body">
<table>
<tr>
<th colspan="2" style="background-color: #f2f2f2;">Amount
to be Refunded</th>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Deposit Amount:
</th>
<td class="fw-semibold amount-cell" style="padding: 0.45rem 0.45rem;"
id="td_depositeamountforrefund">0</td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">EB Amount:</th>
<td class="fw-semibold amount-cell"
style="padding: 0.45rem 0.45rem;color:red" id="td_ebAmount">0</td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Damage(if any):
</th>
<td class="fw-semibold amount-cell"
style="padding: 0.45rem 0.45rem;color:red" id="td_damage">0</td>
</tr>
<tr id="pendingcolumn">
<th id="th_settel_label"
style="padding: 0.45rem 0.45rem;font-weight: normal">Collection Pending
Amount:</th>
<td class="fw-semibold amount-cell"
style="padding: 0.45rem 0.45rem; color: green;" id="td_pending_amt">0
</td>
</tr>
<tr id="collectionstatuscolumn">
<th id="label" style="padding: 0.45rem 0.45rem;font-weight: normal">
Collection Pending Status
:</th>
<td class="fw-semibold amount-cell"
style="padding: 0.45rem 0.45rem; color: green;"
id="td_collection_status">
</td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Actual refundable
Amount:</th>
<td class="fw-semibold amount-cell"
style="padding: 0.45rem 0.45rem; color: green;" id="td_settel_amt">0
</td>
</tr>
</table>
</div>
</div>
<!-- End damage detail -->
</div>
<div class="block-content block-content-full text-end bg-body" id="mbutton2">
<button type="button" class="btn btn-sm btn-alt-secondary"
data-bs-dismiss="modal">Close</button>
<a id="downloadLink" style="display: none;"></a>
</div>
</div>
</form>
</div>
</div>
</div>
<div class="modal fade" id="fileModal" tabindex="-1" role="dialog" aria-labelledby="fileModalLabel"
aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="fileModalLabel">File Preview</h5>
<button type="button" class="close" data-bs-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<embed id="filePreview" src="" width="100%" height="600px">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="qrview" tabindex="-1" role="dialog" aria-labelledby="fileModalLabel" aria-hidden="true">
<div class="modal-dialog modal-sm" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="qrview">QR Code for Collection Pending</h5>
</div>
<div class="modal-body">
<div>
<img style="border:4px solid #15455D;width: 256px; height: 260px;border-radius:10px;"
id="qrCodeImage" alt="QR Code">
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<div th:replace="~{fragments/resetpassword :: div}"></div>
<script th:replace="~{fragments/script :: script}"></script>
<footer th:replace="~{fragments/footer2 :: footer}"></footer>
<script th:replace="~{fragments/loginscript :: script}"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script>
<script>
$(document).ready(
function () {
// DataTables buttons configuration
var buttons = [{
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'
},
];
$('#settlementListTable').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']],
scrollY: '50vh',
fixedColumns: {
left: 1,
right: 1
},
buttons: [buttons],
responsive: true,
searching: true, // Enable search
select: false,
processing: false,
});
// Link the search input to DataTable
$('#searchInput').on('keyup', function () {
dataTable.search(this.value).draw();
});
});
function showDamageImage(imageUrl) {
document.getElementById('filePreview').src = imageUrl;
$('#fileModal').modal('show');
}
function settleTheAmount(bookingId) {
window.location.href = '/communityhall/caretaker/caretakerpage?bookingId=' + bookingId;
}
function approve(settlementId) {
$.ajax({
type: "GET",
url: '/communityhall/api/officer/getSettlementList',
data: {
'settlementsid': settlementId
},
success: function (x) {
showSettlementInfo(x)
showDamageDetails(x);
}
});
}
function showSettlementInfo(list) {
$('#settlementinformation').modal({
backdrop: 'static',
keyboard: false
});
$('#settlementinformation').modal('show');
document.getElementById("settlementid").value = list.settlement.settlementId;
document.getElementById("td_userName").innerHTML = list.users.name;
document.getElementById("td_mobileNumber").innerHTML = list.users.mobileNo;
document.getElementById("td_usertype").innerHTML = list.users.usertype;
var userDetails = list.users;
var userDetailsString =
userDetails.doorNo + ", " +
userDetails.street + ", " +
userDetails.area + ", " +
userDetails.location + " ,Chennai- " +
userDetails.pinCode;
document.getElementById("td_useraddress").innerHTML = userDetailsString;
document.getElementById("td_bookingDate").innerHTML = list.bookingDate;
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 formattedGst = gstcl.toFixed(2);
document.getElementById("td_gst").innerHTML = "₹ " + formattedGst;
document.getElementById("td_startDate").innerHTML = list.startDate;
document.getElementById("td_endDate").innerHTML = list.endDate;
document.getElementById("booking_id").innerHTML = list.bookingId;
function getTimeSlot(slotValue) {
var timeSlot;
var trimmedSlotValue = String(slotValue).trim(); // Convert to string and then trim
if (trimmedSlotValue === '1') {
timeSlot = 'Morning';
} else if (trimmedSlotValue === '2') {
timeSlot = 'Evening';
} else {
timeSlot = 'Unknown';
}
return timeSlot;
}
document.getElementById("td_startingSlot").innerHTML = getTimeSlot(list.startingSlot);
document.getElementById("td_endingSlot").innerHTML = getTimeSlot(list.endingSlot);
document.getElementById("td_EBNumber").innerHTML = list.hallDetails.ebNumber;
document.getElementById("td_startingReading").innerHTML = list.ebDetails.startingReading;
document.getElementById("td_endingReading").innerHTML = list.ebDetails.endingReading;
document.getElementById("td_usedunit").innerHTML = list.ebDetails.usedUnit;
document.getElementById("td_ebamountperunit").innerHTML = "₹ " + parseFloat(list.hallDetails.ebCostPerUnit).toFixed(2);
document.getElementById("td_mfDtUnit").innerHTML = "₹ " + parseFloat(list.hallDetails.mfDtUnit).toFixed(2);
document.getElementById("td_depositeamountforrefund").innerHTML = "₹ " + parseFloat(list.depositAmount).toFixed(2);
document.getElementById("td_ebAmount").innerHTML = "₹ " + parseFloat(list.ebDetails.ebAmount).toFixed(2);
document.getElementById("td_electricityamount").innerHTML = "₹ " + parseFloat(list.ebDetails.ebAmount).toFixed(2);
document.getElementById("td_damage").innerHTML = "₹ " + parseFloat(list.settlement.damageAmount).toFixed(2);
var eb_amt = list.ebDetails.ebAmount;
var deposit_amt = list.depositAmount;
var tem_total = deposit_amt - eb_amt;
$("#td_settel_amt").html('');
$("#td_settel_amt").html(tem_total);
}
function showDamageDetails(data) {
var damageFieldContainer = $('#damageDetails');
damageFieldContainer.empty();
// Create a div for table responsiveness
var tableResponsiveDiv = $('<div>').addClass('table-responsive').css('margin-right', '-24px');
// Create table with similar classes and styles to the modal table
var table = $('<table>').addClass('table table-bordered table-striped').css({ 'width': '97%', 'border-color': 'black', 'border-top-color': 'white' });
var thead = $('<thead>').addClass('thead-light');
var tbody = $('<tbody>');
// Create Damage Details header row
var headerRow = $('<tr>').appendTo(thead);
$('<th>').attr('colspan', '6').text('Damage Details (if any)').css({
'padding': '0.45rem 0.45rem',
'background-color': '#f2f2f2',
'font-weight': 'bold',
'color': 'black',
}).appendTo(headerRow);
// Create table header row
var columnHeadersRow = $('<tr>').css('background-color', '#f2f2f2').appendTo(thead);
$('<th>').text('S.No').css({ 'padding': '0.45rem 0.45rem', 'text-align': 'center' }).appendTo(columnHeadersRow);
$('<th>').text('Asset Name').css({ 'padding': '0.45rem 0.45rem', 'text-align': 'center' }).appendTo(columnHeadersRow);
$('<th>').text('Damage Img').css({ 'padding': '0.45rem 0.45rem', 'text-align': 'center' }).appendTo(columnHeadersRow);
$('<th>').text('Cost').css({ 'padding': '0.45rem 0.45rem', 'text-align': 'center' }).appendTo(columnHeadersRow);
$('<th>').text('Qty').css({ 'padding': '0.45rem 0.45rem', 'text-align': 'center' }).appendTo(columnHeadersRow);
$('<th>').text('Amount').css({ 'padding': '0.45rem 0.45rem', 'text-align': 'center' }).appendTo(columnHeadersRow);
var totalAmount = 0;
// Check if damageList is empty
if (data.damageList.length === 0) {
var row = $('<tr>').appendTo(tbody);
$('<td>').attr('colspan', '6').text('No Damaged Items').css({
'padding': '0.45rem 0.45rem',
'text-align': 'center',
'font-weight': 'bold',
'background-color': '#f2f2f2'
}).appendTo(row);
} else {
$.each(data.damageList, function (index, detail) {
var row = $('<tr>').appendTo(tbody);
$('<td>').text(index + 1).css({
'padding': '0.45rem 0.45rem',
'text-align': 'center'
}).appendTo(row);
$('<td>').text(detail.assetName).css({
'padding': '0.45rem 0.45rem',
'text-align': 'center'
}).appendTo(row);
var viewLink = $('<a>').attr('href', 'javascript:void(0)').text('View').on('click', function () {
showDamageImage(detail.damageImageUrl);
});
$('<td>').css({
'padding': '0.45rem 0.45rem',
'text-align': 'center'
}).append(viewLink).appendTo(row);
var assetamt = (detail.assetAmount / detail.quantity).toFixed(2);
$('<td>').text('₹ ' + assetamt).css({
'padding': '0.45rem 0.45rem',
'text-align': 'center'
}).appendTo(row);
$('<td>').text(detail.quantity).css({
'padding': '0.45rem 0.45rem',
'text-align': 'center'
}).appendTo(row);
var amount = detail.assetAmount;
totalAmount += amount;
$('<td>').text('₹ ' + amount.toFixed(2)).css({
'padding': '0.45rem 0.45rem',
'text-align': 'right'
}).appendTo(row);
});
// Add row for total amount
var totalRow = $('<tr>').appendTo(tbody);
$('<td>').attr('colspan', '5').text('Total Amount').css({
'padding': '0.45rem 0.45rem',
'font-weight': 'bold',
'background-color': '#f2f2f2'
}).appendTo(totalRow);
$('<td>').text('₹ ' + totalAmount.toFixed(2)).css({
'padding': '0.45rem 0.45rem',
'text-align': 'right'
}).appendTo(totalRow);
$("#td_dam_amt").html('₹ ' + totalAmount.toFixed(2));
}
// Append the table elements to the container div
table.append(thead, tbody);
tableResponsiveDiv.append(table);
damageFieldContainer.append(tableResponsiveDiv);
var temp_total = parseFloat($("#td_settel_amt").html());
var settleAmount = temp_total - totalAmount;
if (settleAmount < 0) {
var pendingstatus = data.settlement.collectionStatus;
$("#td_settel_amt").html(0);
$("#pendingcolumn").show();
$("#collectionstatuscolumn").show();
$('#td_collection_status').html(pendingstatus);
$("#td_pending_amt").html(Math.abs(settleAmount).toFixed(2));
$("#td_pending_amt").css("color", "red");
$("#approvebutton").show();
$("#rejectbutton").show();
} else {
$("#td_settel_amt").html('₹ ' + settleAmount.toFixed(2));
$("#pendingcolumn").hide();
$("#collectionstatuscolumn").hide();
$("#td_settel_amt").css("color", "green"); // Set color to green for positive amounts
$("#approvebutton").hide();
$("#rejectbutton").hide();
}
}
function showDamageImage(damageImageUrl) {
document.getElementById('filePreview').src = damageImageUrl;
$('#fileModal').modal('show');
}
function accept() {
let id = document.getElementById("settlementid").value;
Swal.fire({
title: 'Do you want to Approve this Settlement ?',
showDenyButton: true,
showCancelButton: true,
confirmButtonText: 'YES',
denyButtonText: 'NO',
}).then((result) => {
/* Read more about isConfirmed, isDenied below */
if (result.isConfirmed) {
$.ajax({
type: "POST",
url: '/communityhall/api/officer/updateApprovedSettlementStatus/' + id,
data: {
'status': 'COMPLETED',
'comments': 'Accepted',
'settlementId': id
},
success: function (data, textStatus, xhr) {
if (xhr.status === 200) { // Check if the response status is OK
Swal.fire(
'Done',
'Successfully Accepted to the ID:' + id,
'success'
).then(() => {
location.reload();
});
} else {
Swal.fire(
'Error',
'Failed to accept the user',
'error'
);
}
},
error: function (xhr, textStatus, errorThrown) {
Swal.fire(
'Error',
'Failed to accept the user',
'error'
);
}
});
} else if (result.isDenied) {
Swal.fire('Changes are not saved', '', 'info')
}
});
}
function fetchQRCode(bookingId) {
$.ajax({
url: '/communityhall/careTaker/api/generateQRCode',
type: 'GET',
data: { bookingId: bookingId },
success: function (data) {
// Set the QR code image source
$('#qrview').modal('show');
$('#qrCodeImage').attr('src', 'data:image/png;base64,' + data);
// console.log(data);
},
error: function (jqXHR, textStatus, errorThrown) {
console.error('Error fetching QR code:', textStatus, errorThrown);
}
});
}
</script>
</body>
</html>

145
src/main/resources/templates/officer/report.html

@ -4,7 +4,7 @@
<head th:replace="~{fragments/head-officer :: head}">
</head>
<style>
.block-content {
.block-content {
padding-bottom: 10px;
}
@ -70,7 +70,8 @@
<!-- Page Content -->
<div class="content">
<div class="block block-rounded">
<form id="myForm" th:action="@{/communityhall/officer/getReport}" onsubmit="return validateme()" method="post">
<form id="myForm" th:action="@{/communityhall/officer/getReport}" onsubmit="return validateme()"
method="post">
<div class="block-header bg-primary text-white">
<h3 class="block-title">Zone:<span th:text="${zone} + ' - '"></span>Community Hall Reports
</h3>
@ -105,14 +106,15 @@
<!-- bookingDetailsDropdown -->
<div class="col-sm-3 mb-2" id="bookingDetailsDropdown2" style="display: none;">
<label class="form-label" for="filterby">Filter by:</label>
<select class="form-control text-center" id="filterby" name="filterby" th:value="${filterby}">
<option value="">Select Filterby</option>
<option value="1" th:selected="${filterby == '1'}">Booking Date</option>
<option value="2" th:selected="${filterby == '2'}">Event Date</option>
<!-- Add more options as needed -->
</select>
</div>
<label class="form-label" for="filterby">Filter by:</label>
<select class="form-control text-center" id="filterby" name="filterby"
th:value="${filterby}">
<option value="">Select Filterby</option>
<option value="1" th:selected="${filterby == '1'}">Booking Date</option>
<option value="2" th:selected="${filterby == '2'}">Event Date</option>
<!-- Add more options as needed -->
</select>
</div>
<div class="col-sm-3" id="bookingDetailsDropdown" style="display: none;">
<label class="form-label" for="bookingStatus">Booking Status: </label>
<select class="form-control text-center" id="bookingStatus" name="bookingStatus"
@ -150,15 +152,15 @@
</select>
</div>
<div class="col-sm-3" id="hallBookinglistDropdown" style="display: none;">
<label class="form-label" for="hallname">Hallname: </label>
<select class="form-control text-center" id="hallname" name="hallname" th:value="${hallnames}">
<option value="0">Select Hall name</option>
<!-- Iterate over hallnames and create an option for each -->
<option th:each="hall : ${hallnames}"
th:value="${hall.hallId}"
th:text="${hall.hallName}">
</option>
</select>
<label class="form-label" for="hallname">Hallname: </label>
<select class="form-control text-center" id="hallname" name="hallname"
th:value="${hallnames}">
<option value="0">Select Hall name</option>
<!-- Iterate over hallnames and create an option for each -->
<option th:each="hall : ${hallnames}" th:value="${hall.hallId}"
th:text="${hall.hallName}">
</option>
</select>
</div>
<div class="col-sm-3">
<br>
@ -176,9 +178,11 @@
<div class="table-responsive" id="Bookingtable" th:if="${request}==1">
<table id="requestTable1" class="table table-striped table-bordered table-hover dataTable"
role="grid" width="99.5%">
<thead class="thead-dark">
<thead class="thead-dark">
<tr role="row">
<th>S.No</th>
<th>Zone</th>
<th>Divsion</th>
<th>Booking Id</th>
<th>Booking Date</th>
<th>Hall Name</th>
@ -195,6 +199,8 @@
<tr th:each="booking, iterStat : ${bookings}">
<td th:text="${iterStat.count}">0</td>
<td th:text="${booking.hallDetails.zone}"></td>
<td th:text="${booking.hallDetails.division}"></td>
<td th:text="${booking.bookingId}"></td>
<td th:text="${booking.bookingDate}"></td>
<td th:text="${booking.hallDetails.hallName}"></td>
@ -207,15 +213,15 @@
<td th:text="${booking.bookingStatus}"></td>
<td>
<p>
<span class="badge bg-warning" style="cursor: pointer;"
th:onclick="viewDetails([[${booking.bookingId}]])">View</span>
</p>
<span class="badge bg-warning" style="cursor: pointer;"
th:onclick="viewDetails([[${booking.bookingId}]])">View</span>
</p>
</td>
</tr>
</table>
</div>
<div class="table-responsive" id="BookingSettlementtable" th:if="${request}==2">
<table id="requestTable2" class="table table-striped table-bordered table-hover dataTable"
role="grid" width="99.5%">
@ -330,7 +336,7 @@
</div>
<div class="modal fade backdrop" id="showBookingDetails" data-backdrop="static" tabindex="-1" role="dialog"
<div class="modal fade backdrop" id="showBookingDetails" data-backdrop="static" tabindex="-1" role="dialog"
aria-labelledby="staticBackdropLabel" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content" id="printableContent">
@ -527,11 +533,12 @@
id="td_EBNumber"></td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">
EB Amount Per Unit (in Rs):</th>
<td class="fw-semibold amount-cell" style="padding: 0.45rem 0.45rem;"
id="td_ebamountperunit"></td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">MF DT Unit:</th>
<td class="fw-semibold amount-cell" style="padding: 0.45rem 0.45rem;"
id="td_mfDtUnit"></td>
<td class="fw-semibold amount-cell"
style="padding: 0.45rem 0.45rem;" id="td_ebamountperunit"></td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">MF DT Unit:
</th>
<td class="fw-semibold amount-cell"
style="padding: 0.45rem 0.45rem;" id="td_mfDtUnit"></td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">
@ -544,14 +551,15 @@
id="td_endingReading"></td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">
Unit Consumed:</th>
<td class="fw-semibold amount-cell" style="padding: 0.45rem 0.45rem;"
id="td_usedunit"></td>
<td class="fw-semibold amount-cell"
style="padding: 0.45rem 0.45rem;" id="td_usedunit"></td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">
EB Amount (in Rs):</th>
<td colspan="5" class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_electricityamount"></td>
<td colspan="5" class="fw-semibold"
style="padding: 0.45rem 0.45rem;" id="td_electricityamount">
</td>
</tr>
</table>
</div>
@ -621,28 +629,27 @@
</div>
</div>
</div>
<div class="modal fade" id="fileModal" tabindex="-1" role="dialog"
aria-labelledby="fileModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="fileModalLabel">File Preview</h5>
<button type="button" class="close" data-bs-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<embed id="filePreview" src="" width="100%" height="600px">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary"
data-bs-dismiss="modal">Close</button>
</div>
</div>
</div>
<div class="modal fade" id="fileModal" tabindex="-1" role="dialog" aria-labelledby="fileModalLabel"
aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="fileModalLabel">File Preview</h5>
<button type="button" class="close" data-bs-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<embed id="filePreview" src="" width="100%" height="600px">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
</main>
<!-- END Main Container -->
<footer th:replace="~{fragments/footer2 :: footer}"></footer>
@ -711,7 +718,7 @@
select: false,
processing: false,
});
$('#requestTable2').DataTable(
$('#requestTable2').DataTable(
{
dom: 'Bftip',
columnDefs: [{
@ -824,23 +831,23 @@
document.addEventListener("DOMContentLoaded", function () {
myRequest(); // Initial call to set dropdowns based on initial value
});
document.addEventListener("DOMContentLoaded", function () {
document.addEventListener("DOMContentLoaded", function () {
var today = new Date();
var sixMonthsLater = new Date();
sixMonthsLater.setMonth(today.getMonth() + 6);
var minDate = today.toISOString().split('T')[0];
var maxDate = sixMonthsLater.toISOString().split('T')[0];
let fromDateInput=document.getElementById('fromdate');
let toDateInput=document.getElementById('todate');
let fromDateInput = document.getElementById('fromdate');
let toDateInput = document.getElementById('todate');
fromDateInput.setAttribute('max', maxDate);
toDateInput.setAttribute('max', maxDate);
fromDateInput.addEventListener('change', function () {
let selectedFromDate = this.value;
let toDateInput = document.getElementById('todate');
toDateInput.setAttribute('min', selectedFromDate);
toDateInput.value = ''; // Reset the value of toDate
});
let selectedFromDate = this.value;
let toDateInput = document.getElementById('todate');
toDateInput.setAttribute('min', selectedFromDate);
toDateInput.value = ''; // Reset the value of toDate
});
});
// Function to manage the display of dropdowns based on the request type
function myRequest() {
@ -876,12 +883,12 @@ document.addEventListener("DOMContentLoaded", function () {
document.getElementById('fromdate').value = '';
document.getElementById('todate').value = '';
}
function viewDetails(bookingId) {
$.ajax({
url: '/communityhall/user/api/viewAllBookingDetails',
method: 'GET',
data: {bookingId: bookingId},
data: { bookingId: bookingId },
success: function (response) {
document.getElementById("td_userName").innerHTML = response.users.name;
document.getElementById("td_mobileNumber").innerHTML = response.users.mobileNo;
@ -1010,10 +1017,10 @@ document.addEventListener("DOMContentLoaded", function () {
damageFieldContainer.empty();
// Create a div for table responsiveness
var tableResponsiveDiv = $('<div>').addClass('table-responsive').css({'margin-top': '0px', 'margin-left': '20px', 'width': '730px'});;
var tableResponsiveDiv = $('<div>').addClass('table-responsive').css({ 'margin-top': '0px', 'margin-left': '20px', 'width': '730px' });;
// Create table with similar classes and styles to the modal table
var table = $('<table>').addClass('table table-bordered table-striped').css({'width': '97%', 'border-color': 'black', 'border-top-color': 'white', 'width': ' 730px'});
var table = $('<table>').addClass('table table-bordered table-striped').css({ 'width': '97%', 'border-color': 'black', 'border-top-color': 'white', 'width': ' 730px' });
var thead = $('<thead>').addClass('thead-light');
var tbody = $('<tbody>');
@ -1105,7 +1112,7 @@ document.addEventListener("DOMContentLoaded", function () {
reasonFieldsContainer.empty();
// Create a responsive table container
var tableResponsiveDiv = $('<div>').addClass('table-responsive').css({'width': '730px', 'border': 'black'});
var tableResponsiveDiv = $('<div>').addClass('table-responsive').css({ 'width': '730px', 'border': 'black' });
// Create the table with Bootstrap classes and custom styles
var table = $('<table>').addClass('table table-bordered table-striped table-vcenter js-dataTable-responsive').css({

41
src/main/resources/templates/officer/settlement-completed.html

@ -70,7 +70,8 @@
<thead class="thead-light">
<tr>
<th>S.no</th>
<th>Zone/Division</th>
<th>Zone</th>
<th>Division</th>
<th>Hall Name</th>
<th>Booking Id</th>
<th width="10%">Booking Date</th>
@ -87,8 +88,10 @@
<tr th:each="settlements, rowStat : ${completedlist}"
th:if="${settlements.settlement != null}">
<td class="text-center" th:text="${rowStat.index + 1}"></td>
<td class="text-center" th:text="${settlements.hallDetails.zone}">
</td>
<td class="text-center"
th:text="${settlements.hallDetails.zone + ' / ' + settlements.hallDetails.division}">
th:text="${settlements.hallDetails.division}">
</td>
<td class="text-center"
th:text="${settlements.hallDetails.hallName}"></td>
@ -136,6 +139,8 @@
<thead class="thead-light">
<tr>
<th>S.no</th>
<th>Zone</th>
<th>Division</th>
<th>Booking Id</th>
<th>Booking Date</th>
<th>Hall Name</th>
@ -149,6 +154,10 @@
<tbody>
<tr th:each="cancelledbookings, rowStat : ${cancelledcompletedlist}">
<td class="text-center" th:text="${rowStat.index + 1}"></td>
<td class="text-center"
th:text="${cancelledbookings.hallDetails.zone}"></td>
<td class="text-center"
th:text="${cancelledbookings.hallDetails.division}"></td>
<td class="text-center" th:text="${cancelledbookings.bookingId}">
</td>
<td class="text-center" th:text="${cancelledbookings.bookingDate}">
@ -191,6 +200,8 @@
<thead class="thead-light">
<tr>
<th>S.no</th>
<th>Zone</th>
<th>Division</th>
<th>Booking Id</th>
<th>Booking Date</th>
<th>Hall Name</th>
@ -205,6 +216,11 @@
<tbody>
<tr th:each="rejectedbookings, rowStat : ${rejectedcompletedlist}">
<td class="text-center" th:text="${rowStat.index + 1}"></td>
<td class="text-center"
th:text="${rejectedbookings.hallDetails.zone}"></td>
<td class="text-center"
th:text="${rejectedbookings.hallDetails.division}">
</td>
<td class="text-center" th:text="${rejectedbookings.bookingId}">
</td>
<td class="text-center" th:text="${rejectedbookings.bookingDate}">
@ -377,26 +393,33 @@
<th colspan="6" style="background-color: #f2f2f2;">EB Details</th>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Consumer Number:
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Consumer
Number:
</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;" id="td_EBNumber">
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_EBNumber">
</td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">EB Amount Per Unit:
<th style="padding: 0.45rem 0.45rem;font-weight: normal">EB Amount Per
Unit:
</th>
<td class="fw-semibold amount-cell" style="padding: 0.45rem 0.45rem;"
id="td_ebamountperunit"></td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">MF DT Unit:</th>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">MF DT Unit:
</th>
<td class="fw-semibold amount-cell" style="padding: 0.45rem 0.45rem;"
id="td_mfDtUnit"></td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Start Reading:</th>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Start Reading:
</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_startingReading"></td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">END Reading:</th>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">END Reading:
</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_endingReading"></td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Unit Consumed:</th>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Unit Consumed:
</th>
<td class="fw-semibold amount-cell" style="padding: 0.45rem 0.45rem;"
id="td_usedunit"></td>
</tr>

606
src/main/resources/templates/officer/settlement-list.html

@ -53,14 +53,14 @@
<a class="nav-link" id="gcc-tab" data-toggle="tab" href="#gcc" role="tab" aria-controls="gcc"
aria-selected="false">GCC Blocked/Rejected Refund</a>
</li>
<li class="nav-item" role="presentation">
<!-- <li class="nav-item" role="presentation">
<a class="nav-link" id="settlement-initiated-tab"
data-toggle="tab"
href="#settlement-initiated"
role="tab"
aria-controls="settlement-initiated"
aria-selected="false">Settlement Initiated</a>
</li>
</li> -->
</ul>
<div class="tab-content" id="myTabContent">
<!-- Settlement Approval Tab -->
@ -71,7 +71,8 @@
<div class="block-content p-0">
<div class="p-sm-4 p-0">
<div class="table-responsive">
<table class="table table-bordered table-striped table-vcenter js-dataTable-responsive" id="SettlementApprovedListTable">
<table class="table table-bordered table-striped table-vcenter js-dataTable-responsive"
id="SettlementApprovedListTable">
<thead class="thead-light">
<tr>
<th>S.no</th>
@ -86,12 +87,13 @@
<th>Collection Pending</th>
<th>Refund Amount</th>
<th>Status</th>
<th>Remarks</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<!-- <tr th:each="settlement, rowStat : ${settlementlist}">-->
<tr th:each="settlement, rowStat : ${settlementlist}"
<!-- <tr th:each="settlement, rowStat : ${settlementlist}">-->
<tr th:each="settlement, rowStat : ${settlementlist}"
th:if="${settlement.settlement.approvedFlag == 0 or settlement.settlement.approvedFlag == null}">
<td class="text-center" th:text="${rowStat.index + 1}"></td>
<td class="text-center" th:text="${settlement.hallDetails.zone}"></td>
@ -108,11 +110,28 @@
<td class="text-center" th:text="${settlement.settlement.refundedAmount}">
</td>
<td class="text-center" th:text="${settlement.refundStatus}"></td>
<td>
<p>
<td class="text-center">
<span
th:if="${settlement.bookingDate != null and settlement.bookingDate.isBefore(T(java.time.LocalDate).now().minusDays(180))}"
class="text-danger fw-semibold" style="font-size: 12px;">
more than 6 month old booking, so settlement not allowed. please
contact Revenue Department - Head Office.
</span>
<span
th:unless="${settlement.bookingDate != null and settlement.bookingDate.isBefore(T(java.time.LocalDate).now().minusDays(180))}">-</span>
</td>
<td class="text-center">
<p class="mb-0"
th:if="${settlement.bookingDate == null or not settlement.bookingDate.isBefore(T(java.time.LocalDate).now().minusDays(180))}">
<span class="badge bg-warning" style="cursor: pointer;"
th:onclick="pending([[${settlement.settlement.settlementId}]])">Approve</span>
</p>
<p class="mb-0"
th:if="${settlement.bookingDate != null and settlement.bookingDate.isBefore(T(java.time.LocalDate).now().minusDays(180))}">
<span class="badge bg-secondary"
style="cursor: not-allowed; opacity: 0.65;"
title="more than 6 month old booking, so settlement not allowed. please contact HQ">Disabled</span>
</p>
</td>
</tr>
</tbody>
@ -130,10 +149,13 @@
<div class="block-content p-0">
<div class="p-sm-4 p-0">
<div class="table-responsive">
<table class="table table-bordered table-striped table-vcenter js-dataTable-responsive" id="cancelledApprovedListTable">
<table class="table table-bordered table-striped table-vcenter js-dataTable-responsive"
id="cancelledApprovedListTable">
<thead class="thead-light">
<tr>
<th>S.no</th>
<th>Zone</th>
<th>Division</th>
<th>Booking Id</th>
<th>Booking Date</th>
<th>Hall Name</th>
@ -141,12 +163,17 @@
<th>User type</th>
<th>Reason for Booking</th>
<th>Refund Amount</th>
<th>Remarks</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<tr th:each="cancelledbookings, rowStat : ${cancelledbookings}">
<td class="text-center" th:text="${rowStat.index + 1}"></td>
<td class="text-center" th:text="${cancelledbookings.hallDetails.zone}">
</td>
<td class="text-center" th:text="${cancelledbookings.hallDetails.division}">
</td>
<td class="text-center" th:text="${cancelledbookings.bookingId}"></td>
<td class="text-center" th:text="${cancelledbookings.bookingDate}"></td>
<td class="text-center" th:text="${cancelledbookings.hallDetails.hallName}">
@ -154,13 +181,29 @@
<td class="text-center" th:text="${cancelledbookings.users.name}"></td>
<td class="text-center" th:text="${cancelledbookings.users.usertype}"></td>
<td class="text-center" th:text="${cancelledbookings.reason}"></td>
<td class="text-center"
th:text="${cancelledbookings.depositAmount}"></td>
<td>
<p>
<td class="text-center" th:text="${cancelledbookings.depositAmount}"></td>
<td class="text-center">
<span
th:if="${cancelledbookings.bookingDate != null and cancelledbookings.bookingDate.isBefore(T(java.time.LocalDate).now().minusDays(180))}"
class="text-danger fw-semibold" style="font-size: 12px;">
more than 6 month old booking, so settlement not allowed. please
contact Revenue Department - Head Office
</span>
<span
th:unless="${cancelledbookings.bookingDate != null and cancelledbookings.bookingDate.isBefore(T(java.time.LocalDate).now().minusDays(180))}">-</span>
</td>
<td class="text-center">
<p class="mb-0"
th:if="${cancelledbookings.bookingDate == null or not cancelledbookings.bookingDate.isBefore(T(java.time.LocalDate).now().minusDays(180))}">
<span class="badge bg-warning" style="cursor: pointer;"
th:onclick="cancelledbooking([[${cancelledbookings.bookingId}]])">Approve</span>
</p>
<p class="mb-0"
th:if="${cancelledbookings.bookingDate != null and cancelledbookings.bookingDate.isBefore(T(java.time.LocalDate).now().minusDays(180))}">
<span class="badge bg-secondary"
style="cursor: not-allowed; opacity: 0.65;"
title="more than 6 month old booking, so settlement not allowed. please contact HQ">Disabled</span>
</p>
</td>
</tr>
</tbody>
@ -178,10 +221,13 @@
<div class="block-content p-0">
<div class="p-sm-4 p-0">
<div class="table-responsive">
<table class="table table-bordered table-striped table-vcenter js-dataTable-responsive" id="rejectedApprovedListTable">
<table class="table table-bordered table-striped table-vcenter js-dataTable-responsive"
id="rejectedApprovedListTable">
<thead class="thead-light">
<tr>
<th>S.no</th>
<th>Zone</th>
<th>Division</th>
<th>Booking Id</th>
<th>Booking Date</th>
<th>Hall Name</th>
@ -190,12 +236,16 @@
<th>Reason for Booking</th>
<th>Reason for Rejection</th>
<th>Refund Amount</th>
<th>Remarks</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<tr th:each="rejectedbookings, rowStat : ${rejectedbookings}">
<td class="text-center" th:text="${rowStat.index + 1}"></td>
<td class="text-center" th:text="${rejectedbookings.hallDetails.zone}"></td>
<td class="text-center" th:text="${rejectedbookings.hallDetails.division}">
</td>
<td class="text-center" th:text="${rejectedbookings.bookingId}"></td>
<td class="text-center" th:text="${rejectedbookings.bookingDate}"></td>
<td class="text-center" th:text="${rejectedbookings.hallDetails.hallName}">
@ -205,11 +255,28 @@
<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>
<p>
<td class="text-center">
<span
th:if="${rejectedbookings.bookingDate != null and rejectedbookings.bookingDate.isBefore(T(java.time.LocalDate).now().minusDays(180))}"
class="text-danger fw-semibold" style="font-size: 12px;">
more than 6 month old booking, so settlement not allowed. please
contact Revenue Department - Head Office
</span>
<span
th:unless="${rejectedbookings.bookingDate != null and rejectedbookings.bookingDate.isBefore(T(java.time.LocalDate).now().minusDays(180))}">-</span>
</td>
<td class="text-center">
<p class="mb-0"
th:if="${rejectedbookings.bookingDate == null or not rejectedbookings.bookingDate.isBefore(T(java.time.LocalDate).now().minusDays(180))}">
<span class="badge bg-warning" style="cursor: pointer;"
th:onclick="rejectedbooking([[${rejectedbookings.bookingId}]])">Approve</span>
</p>
<p class="mb-0"
th:if="${rejectedbookings.bookingDate != null and rejectedbookings.bookingDate.isBefore(T(java.time.LocalDate).now().minusDays(180))}">
<span class="badge bg-secondary"
style="cursor: not-allowed; opacity: 0.65;"
title="more than 6 month old booking, so settlement not allowed. please contact HQ">Disabled</span>
</p>
</td>
</tr>
</tbody>
@ -233,7 +300,7 @@
<tr>
<th>S.nos</th>
<th>Zone</th>
<th>Division</th>
<th>Hall Name</th>
<th>Booking Id</th>
@ -245,6 +312,7 @@
<th>Refund Amount</th>
<th>Status</th>
<th>Last Initade date</th>
<th>Remarks</th>
<th>Action</th>
</tr>
</thead>
@ -268,13 +336,31 @@
<td class="text-center" th:text="${settlement.settlement.refundedAmount}">
</td>
<td class="text-center" th:text="${settlement.refundStatus}"></td>
<td th:text="${#dates.format(settlement.settlement.approvedFlagDate, 'yyyy-MM-dd')}"></td>
<td>
<p>
<td
th:text="${#dates.format(settlement.settlement.approvedFlagDate, 'yyyy-MM-dd')}">
</td>
<td class="text-center">
<span
th:if="${settlement.bookingDate != null and settlement.bookingDate.isBefore(T(java.time.LocalDate).now().minusDays(180))}"
class="text-danger fw-semibold" style="font-size: 12px;">
more than 6 month old booking, so settlement not allowed. please
contact Revenue Department - Head Office
</span>
<span
th:unless="${settlement.bookingDate != null and settlement.bookingDate.isBefore(T(java.time.LocalDate).now().minusDays(180))}">-</span>
</td>
<td class="text-center">
<p class="mb-0"
th:if="${settlement.bookingDate == null or not settlement.bookingDate.isBefore(T(java.time.LocalDate).now().minusDays(180))}">
<span class="badge bg-warning" style="cursor: pointer;"
th:onclick="pending([[${settlement.settlement.settlementId}]])">Approve</span>
</p>
<p class="mb-0"
th:if="${settlement.bookingDate != null and settlement.bookingDate.isBefore(T(java.time.LocalDate).now().minusDays(180))}">
<span class="badge bg-secondary"
style="cursor: not-allowed; opacity: 0.65;"
title="more than 6 month old booking, so settlement not allowed. please contact HQ">Disabled</span>
</p>
</td>
</tr>
</tbody>
@ -443,26 +529,33 @@
<th colspan="6" style="background-color: #f2f2f2;">EB Details</th>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Consumer Number:
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Consumer
Number:
</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;" id="td_EBNumber">
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_EBNumber">
</td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">EB Amount Per Unit:
<th style="padding: 0.45rem 0.45rem;font-weight: normal">EB Amount Per
Unit:
</th>
<td class="fw-semibold amount-cell" style="padding: 0.45rem 0.45rem;"
id="td_ebamountperunit"></td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">MF DT Unit:</th>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">MF DT Unit:
</th>
<td class="fw-semibold amount-cell" style="padding: 0.45rem 0.45rem;"
id="td_mfDtUnit"></td>
</tr>
<tr>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Start Reading:</th>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Start Reading:
</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_startingReading"></td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">END Reading:</th>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">END Reading:
</th>
<td class="fw-semibold" style="padding: 0.45rem 0.45rem;"
id="td_endingReading"></td>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Unit Consumed:</th>
<th style="padding: 0.45rem 0.45rem;font-weight: normal">Unit Consumed:
</th>
<td class="fw-semibold amount-cell" style="padding: 0.45rem 0.45rem;"
id="td_usedunit"></td>
</tr>
@ -510,13 +603,14 @@
style="padding: 0.45rem 0.45rem; color: green;" id="td_pending_amt">
0</td>
</tr>
<tr id="collectionstatuscolumn">
<th id="label"
style="padding: 0.45rem 0.45rem;font-weight: normal">Collection Pending Status
:</th>
<td class="fw-semibold amount-cell"
style="padding: 0.45rem 0.45rem; color: green;" id="td_collection_status">
</td>
<tr id="collectionstatuscolumn">
<th id="label" style="padding: 0.45rem 0.45rem;font-weight: normal">
Collection Pending Status
:</th>
<td class="fw-semibold amount-cell"
style="padding: 0.45rem 0.45rem; color: green;"
id="td_collection_status">
</td>
</tr>
<tr>
<th
@ -785,7 +879,7 @@
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<script>
$(document).ready(function () {
$(document).ready(function () {
var buttons = [
{
extend: 'pageLength',
@ -848,7 +942,7 @@
$('#SettlementApprovedListTable').DataTable({
dom: 'Bftip',
columnDefs: [
{targets: 'no-sort', orderable: false}
{ targets: 'no-sort', orderable: false }
],
lengthMenu: [
[50, 100, 200, 500, -1],
@ -867,7 +961,7 @@
$('#cancelledApprovedListTable').DataTable({
dom: 'Bftip',
columnDefs: [
{targets: 'no-sort', orderable: false}
{ targets: 'no-sort', orderable: false }
],
lengthMenu: [
[50, 100, 200, 500, -1],
@ -886,7 +980,7 @@
$('#rejectedApprovedListTable').DataTable({
dom: 'Bftip',
columnDefs: [
{targets: 'no-sort', orderable: false}
{ targets: 'no-sort', orderable: false }
],
lengthMenu: [
[50, 100, 200, 500, -1],
@ -912,13 +1006,13 @@
showSettlementInfo(x)
showDamageDetails(x);
//ak for officer
if (x.settlement && x.settlement.approvedFlag === 1) {
$("#approvebutton").hide();
$("#removebutton").hide();
} else {
$("#approvebutton").show();
$("#removebutton").show();
}
if (x.settlement && x.settlement.approvedFlag === 1) {
$("#approvebutton").hide();
$("#removebutton").hide();
} else {
$("#approvebutton").show();
$("#removebutton").show();
}
}
});
@ -1012,7 +1106,7 @@
var tableResponsiveDiv = $('<div>').addClass('table-responsive').css('margin-right', '0px');
// Create table with similar classes and styles to the modal table
var table = $('<table>').addClass('table table-bordered table-striped').css({'width': '97%', 'border-color': 'black', 'border-top-color': 'white'});
var table = $('<table>').addClass('table table-bordered table-striped').css({ 'width': '97%', 'border-color': 'black', 'border-top-color': 'white' });
var thead = $('<thead>').addClass('thead-light');
var tbody = $('<tbody>');
@ -1027,12 +1121,12 @@
// Create table header row
var columnHeadersRow = $('<tr>').css('background-color', '#f2f2f2').appendTo(thead);
$('<th>').text('S.No').css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(columnHeadersRow);
$('<th>').text('Asset Name').css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(columnHeadersRow);
$('<th>').text('Damage Img').css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(columnHeadersRow);
$('<th>').text('Cost').css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(columnHeadersRow);
$('<th>').text('Qty').css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(columnHeadersRow);
$('<th>').text('Amount').css({'padding': '0.45rem 0.45rem', 'text-align': 'center'}).appendTo(columnHeadersRow);
$('<th>').text('S.No').css({ 'padding': '0.45rem 0.45rem', 'text-align': 'center' }).appendTo(columnHeadersRow);
$('<th>').text('Asset Name').css({ 'padding': '0.45rem 0.45rem', 'text-align': 'center' }).appendTo(columnHeadersRow);
$('<th>').text('Damage Img').css({ 'padding': '0.45rem 0.45rem', 'text-align': 'center' }).appendTo(columnHeadersRow);
$('<th>').text('Cost').css({ 'padding': '0.45rem 0.45rem', 'text-align': 'center' }).appendTo(columnHeadersRow);
$('<th>').text('Qty').css({ 'padding': '0.45rem 0.45rem', 'text-align': 'center' }).appendTo(columnHeadersRow);
$('<th>').text('Amount').css({ 'padding': '0.45rem 0.45rem', 'text-align': 'center' }).appendTo(columnHeadersRow);
var totalAmount = 0;
@ -1106,7 +1200,22 @@
var temp_total = parseFloat($("#td_settel_amt").html());
var settleAmount = temp_total - totalAmount;
var refundStatus = data.refundStatus;
var pendingstatus=data.settlement.collectionStatus
var pendingstatus = data.settlement.collectionStatus;
var isOldBooking = false;
if (data.bookingDate) {
var bDateParts = String(data.bookingDate).split('-');
if (bDateParts.length === 3) {
var bookingDateObj = new Date(parseInt(bDateParts[0]), parseInt(bDateParts[1]) - 1, parseInt(bDateParts[2]));
var cutoffDate = new Date();
cutoffDate.setHours(0, 0, 0, 0);
cutoffDate.setDate(cutoffDate.getDate() - 180);
if (bookingDateObj < cutoffDate) {
isOldBooking = true;
}
}
}
if (settleAmount < 0) {
// console.log(settleAmount);
$("#td_settel_amt").html(0.00);
@ -1122,7 +1231,11 @@
$("#pendingcolumn").hide();
$("#collectionstatuscolumn").hide();
$("#td_settel_amt").css("color", "green"); // Set color to green for positive amounts
$("#approvebutton").prop("disabled", false);
if (isOldBooking) {
$("#approvebutton").prop("disabled", true);
} else {
$("#approvebutton").prop("disabled", false);
}
}
}
function showDamageImage(damageImageUrl) {
@ -1131,112 +1244,112 @@
}
function accept() {
let id = document.getElementById("settlementid").value;
const acceptButton = document.getElementById("approvebutton"); // Add an ID to your button in the HTML
Swal.fire({
title: 'Do you want to Approve this Settlement?',
showDenyButton: true,
showCancelButton: true,
confirmButtonText: 'YES',
denyButtonText: 'NO',
}).then((result) => {
if (result.isConfirmed) {
// Disable the button to prevent multiple clicks
acceptButton.disabled = true;
// Show the loading screen
const loadingSwal = Swal.fire({
title: 'Processing...',
text: 'Please wait while we approve the settlement.',
allowOutsideClick: false, // Prevent closing the popup
didOpen: () => {
Swal.showLoading(); // Show the loading spinner
},
showConfirmButton: false, // Hide the confirm button during loading
});
$.ajax({
type: "POST",
url: '/communityhall/api/officer/updateApprovedSettlementStatus/' + id,
data: {
'status': 'APPROVED',
'comments': 'Accepted',
'settlementId': id
},
success: function (data, textStatus, xhr) {
loadingSwal.close(); // Close the loading popup
if (xhr.status === 200) {
Swal.fire(
'Done',
'Successfully Accepted to the ID: ' + id,
'success'
).then(() => {
location.reload(); // Reload the page after success
});
} else {
Swal.fire(
'Error',
'Failed to Approve the Settlement',
'error'
);
}
},
/* error: function (xhr, textStatus, errorThrown) {
loadingSwal.close(); // Close the loading popup
Swal.fire(
'Error',
'Failed to Approve the Settlement',
'error'
);*/
//ak for officer
let id = document.getElementById("settlementid").value;
const acceptButton = document.getElementById("approvebutton"); // Add an ID to your button in the HTML
Swal.fire({
title: 'Do you want to Approve this Settlement?',
showDenyButton: true,
showCancelButton: true,
confirmButtonText: 'YES',
denyButtonText: 'NO',
}).then((result) => {
if (result.isConfirmed) {
// Disable the button to prevent multiple clicks
acceptButton.disabled = true;
// Show the loading screen
const loadingSwal = Swal.fire({
title: 'Processing...',
text: 'Please wait while we approve the settlement.',
allowOutsideClick: false, // Prevent closing the popup
didOpen: () => {
Swal.showLoading(); // Show the loading spinner
},
showConfirmButton: false, // Hide the confirm button during loading
});
$.ajax({
type: "POST",
url: '/communityhall/api/officer/updateApprovedSettlementStatus/' + id,
data: {
'status': 'APPROVED',
'comments': 'Accepted',
'settlementId': id
},
success: function (data, textStatus, xhr) {
loadingSwal.close(); // Close the loading popup
if (xhr.status === 200) {
Swal.fire(
'Done',
'Successfully Accepted to the ID: ' + id,
'success'
).then(() => {
location.reload(); // Reload the page after success
});
} else {
Swal.fire(
'Error',
'Failed to Approve the Settlement',
'error'
);
}
},
/* error: function (xhr, textStatus, errorThrown) {
loadingSwal.close(); // Close the loading popup
Swal.fire(
'Error',
'Failed to Approve the Settlement',
'error'
);*/
//ak for officer
error: function (xhr, textStatus, errorThrown) {
loadingSwal.close();
console.log("textstaus" + xhr.responseText);
let responseData;
try {
responseData = JSON.parse(xhr.responseText);
} catch (e) {
responseData = null;
}
error: function (xhr, textStatus, errorThrown) {
loadingSwal.close();
console.log("textstaus"+xhr.responseText);
let responseData;
try {
responseData = JSON.parse(xhr.responseText);
} catch (e) {
responseData = null;
}
/* if (responseData && responseData.approvedFlag === 1) {
$("#approvebutton").hide(); // hide approve button if already approved
Swal.fire(
'Error',
'Failed to Approve the Settlement',
'error'
);*/
if (responseData && responseData.approvedFlag === 1) {
$("#approvebutton").hide(); // hide approve button if already approved
Swal.fire(
'Error',
'Failed to Approve the Settlement',
'error'
).then(() => {
location.reload(); // reload page after user closes the alert
});
} else {
Swal.fire(
'Error',
'Failed to Approve the Settlement',
'error'
);
}
},
complete: function() {
// Re-enable the button after request completes (success or error)
acceptButton.disabled = false;
}
});
} else if (result.isDenied) {
Swal.fire('Changes are not saved', '', 'info');
}
});
}
/* if (responseData && responseData.approvedFlag === 1) {
$("#approvebutton").hide(); // hide approve button if already approved
Swal.fire(
'Error',
'Failed to Approve the Settlement',
'error'
);*/
if (responseData && responseData.approvedFlag === 1) {
$("#approvebutton").hide(); // hide approve button if already approved
Swal.fire(
'Error',
'Failed to Approve the Settlement',
'error'
).then(() => {
location.reload(); // reload page after user closes the alert
});
} else {
Swal.fire(
'Error',
'Failed to Approve the Settlement',
'error'
);
}
},
complete: function () {
// Re-enable the button after request completes (success or error)
acceptButton.disabled = false;
}
});
} else if (result.isDenied) {
Swal.fire('Changes are not saved', '', 'info');
}
});
}
function rejectsubmit() {
let id = document.getElementById("settlementid").value;
@ -1302,7 +1415,7 @@
let textContent = "This is the content of the text file.";
// Create a Blob containing the text
let blob = new Blob([textContent], {type: "text/plain"});
let blob = new Blob([textContent], { type: "text/plain" });
// Create URL for the Blob
let url = URL.createObjectURL(blob);
@ -1421,6 +1534,25 @@
document.getElementById("payamountReceived").innerHTML = '₹ ' + list.payments.amountReceived;
document.getElementById("paymentStatus").innerHTML = list.payments.paymentStatus;
var isOldBooking = false;
if (list.bookingDate) {
var bDateParts = String(list.bookingDate).split('-');
if (bDateParts.length === 3) {
var bookingDateObj = new Date(parseInt(bDateParts[0]), parseInt(bDateParts[1]) - 1, parseInt(bDateParts[2]));
var cutoffDate = new Date();
cutoffDate.setHours(0, 0, 0, 0);
cutoffDate.setDate(cutoffDate.getDate() - 180);
if (bookingDateObj < cutoffDate) {
isOldBooking = true;
}
}
}
if (isOldBooking) {
$("#approvedButton").prop("disabled", true);
} else {
$("#approvedButton").prop("disabled", false);
}
showReasonDocuments(list);
}
@ -1507,78 +1639,78 @@
const fileURL = $(this).data('url');
openFileModal(fileURL);
});
function openFileModal(fileURL) {
$('#filePreview').attr('src', fileURL);
$('#fileModal').modal('show');
}
function openFileModal(fileURL) {
$('#filePreview').attr('src', fileURL);
$('#fileModal').modal('show');
}
function approverefund() {
let id = document.getElementById("booksId").value;
const approveButton = document.getElementById("approvedButton");
Swal.fire({
title: 'Do you want to Approve this Settlement?',
showDenyButton: true,
showCancelButton: true,
confirmButtonText: 'YES',
denyButtonText: 'NO',
}).then((result) => {
if (result.isConfirmed) {
// Disable the button after user confirms
approveButton.disabled = true;
// Show the loading popup
const loadingSwal = Swal.fire({
title: 'Processing...',
text: 'Please wait while we approve the settlement.',
allowOutsideClick: false, // Prevent closing the popup
didOpen: () => {
Swal.showLoading(); // Show the loading spinner
},
showConfirmButton: false, // Hide the confirm button during loading
});
$.ajax({
type: "POST",
url: '/communityhall/api/officer/approveCancelledBookingRefund/' + id,
data: {
'status': 'APPROVED',
},
success: function (data, textStatus, xhr) {
loadingSwal.close(); // Close the loading popup
if (xhr.status === 200) {
Swal.fire(
'Done',
'Successfully Accepted to the ID:' + id,
'success'
).then(() => {
location.reload(); // Reload page after success
});
} else {
Swal.fire(
'Error',
'Failed to Approve the Refund',
'error'
);
}
},
error: function (xhr, textStatus, errorThrown) {
loadingSwal.close(); // Close the loading popup
Swal.fire(
'Error',
'Failed to Approve the Refund',
'error'
);
},
complete: function() {
// Re-enable the button after request completes (success or error)
approveButton.disabled = false;
}
});
} else if (result.isDenied) {
Swal.fire('Changes are not saved', '', 'info');
}
});
}
let id = document.getElementById("booksId").value;
const approveButton = document.getElementById("approvedButton");
Swal.fire({
title: 'Do you want to Approve this Settlement?',
showDenyButton: true,
showCancelButton: true,
confirmButtonText: 'YES',
denyButtonText: 'NO',
}).then((result) => {
if (result.isConfirmed) {
// Disable the button after user confirms
approveButton.disabled = true;
// Show the loading popup
const loadingSwal = Swal.fire({
title: 'Processing...',
text: 'Please wait while we approve the settlement.',
allowOutsideClick: false, // Prevent closing the popup
didOpen: () => {
Swal.showLoading(); // Show the loading spinner
},
showConfirmButton: false, // Hide the confirm button during loading
});
$.ajax({
type: "POST",
url: '/communityhall/api/officer/approveCancelledBookingRefund/' + id,
data: {
'status': 'APPROVED',
},
success: function (data, textStatus, xhr) {
loadingSwal.close(); // Close the loading popup
if (xhr.status === 200) {
Swal.fire(
'Done',
'Successfully Accepted to the ID:' + id,
'success'
).then(() => {
location.reload(); // Reload page after success
});
} else {
Swal.fire(
'Error',
'Failed to Approve the Refund',
'error'
);
}
},
error: function (xhr, textStatus, errorThrown) {
loadingSwal.close(); // Close the loading popup
Swal.fire(
'Error',
'Failed to Approve the Refund',
'error'
);
},
complete: function () {
// Re-enable the button after request completes (success or error)
approveButton.disabled = false;
}
});
} else if (result.isDenied) {
Swal.fire('Changes are not saved', '', 'info');
}
});
}
document.addEventListener('DOMContentLoaded', function () {
var ddDetailsCheckbox = document.getElementById('ddDetailsCheckbox');
@ -1622,13 +1754,13 @@
event.stopPropagation();
});
});
$('#challonDetails').on('hidden.bs.modal', function () {
// Clear all input fields
$(this).find('form')[0].reset();
$('#challonDetails').on('hidden.bs.modal', function () {
// Clear all input fields
$(this).find('form')[0].reset();
// Optionally, reset any custom styling or classes
$(this).find('input').removeClass('is-valid is-invalid');
});
// Optionally, reset any custom styling or classes
$(this).find('input').removeClass('is-valid is-invalid');
});
</script>
</body>
Loading…
Cancel
Save