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. 56
      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. 221
      src/main/resources/templates/admin/settlement-list.html
  20. 32
      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. 22
      src/main/resources/templates/caretaker/past-booking.html
  24. 22
      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. 34
      src/main/resources/templates/fragments/nav-usermenu.html
  32. 741
      src/main/resources/templates/headquarters/collection-pending.html
  33. 56
      src/main/resources/templates/headquarters/ongoingevents.html
  34. 109
      src/main/resources/templates/headquarters/refund-failedlist.html
  35. 44
      src/main/resources/templates/headquarters/settlement-completed.html
  36. 220
      src/main/resources/templates/headquarters/settlement-list.html
  37. 32
      src/main/resources/templates/headquarters/settlementlist.html
  38. 20
      src/main/resources/templates/officer/booking-list.html
  39. 741
      src/main/resources/templates/officer/collection-pending.html
  40. 61
      src/main/resources/templates/officer/report.html
  41. 41
      src/main/resources/templates/officer/settlement-completed.html
  42. 220
      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>

56
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,13 +121,17 @@
<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>
@ -137,7 +143,8 @@
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}"
<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>
@ -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,14 +209,17 @@
<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>
@ -219,7 +231,8 @@
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}"
<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,13 +298,17 @@
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>
@ -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],
@ -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;
@ -1011,7 +1029,7 @@
text: 'EB details saved successfully.',
icon: 'success',
confirmButtonText: 'OK'
}).then(function() {
}).then(function () {
// Reload the page after the alert is dismissed
location.reload();
});
@ -1022,9 +1040,9 @@
}
});
});
});
});
document.getElementById('EBdetailsModal').addEventListener('hide.bs.modal', function () {
document.getElementById('EBdetailsModal').addEventListener('hide.bs.modal', function () {
// Clear the startingReading input field
document.getElementById('startingReading').value = '';

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>

221
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,6 +97,7 @@
<th>Collection Pending</th>
<th>Refund Amount</th>
<th>Status</th>
<th>Remarks</th>
<th>Action</th>
</tr>
</thead>
@ -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,11 +612,12 @@
0</td>
</tr>
<tr id="collectionstatuscolumn">
<th id="label"
style="padding: 0.45rem 0.45rem;font-weight: normal">Collection Pending Status
<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>
@ -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],
@ -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,9 +1239,13 @@
$("#pendingcolumn").hide();
$("#collectionstatuscolumn").hide();
$("#td_settel_amt").css("color", "green"); // Set color to green for positive amounts
if (isOldBooking) {
$("#approvebutton").prop("disabled", true);
} else {
$("#approvebutton").prop("disabled", false);
}
}
}
function showDamageImage(damageImageUrl) {
document.getElementById('filePreview').src = damageImageUrl;
$('#fileModal').modal('show');
@ -1201,7 +1313,7 @@
},*/
error: function (xhr, textStatus, errorThrown) {
loadingSwal.close();
console.log("textstaus"+xhr.responseText);
console.log("textstaus" + xhr.responseText);
let responseData;
try {
@ -1234,7 +1346,7 @@
);
}
},
complete: function() {
complete: function () {
// Re-enable the button after request completes (success or error)
acceptButton.disabled = false;
}
@ -1243,7 +1355,7 @@
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);
}
@ -1576,7 +1707,7 @@
'error'
);
},
complete: function() {
complete: function () {
// Re-enable the button after request completes (success or error)
approveButton.disabled = false;
}
@ -1585,7 +1716,7 @@
Swal.fire('Changes are not saved', '', 'info');
}
});
}
}
document.addEventListener('DOMContentLoaded', function () {
var ddDetailsCheckbox = document.getElementById('ddDetailsCheckbox');

32
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>
@ -312,11 +316,12 @@
</td>
</tr>
<tr id="collectionstatuscolumn">
<th id="label"
style="padding: 0.45rem 0.45rem;font-weight: normal">Collection Pending Status
<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>
@ -365,8 +370,7 @@
</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">
@ -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;
@ -718,13 +722,13 @@
url: '/communityhall/careTaker/api/generateQRCode',
type: 'GET',
data: { bookingId: bookingId },
success: function(data) {
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) {
error: function (jqXHR, textStatus, errorThrown) {
console.error('Error fetching QR code:', textStatus, errorThrown);
}
});

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

22
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;
@ -599,7 +603,7 @@
// Convert canvas content to blob
canvas.toBlob(blob => {
resolve(new File([blob], file.name, {type: 'image/jpeg', lastModified: Date.now()}));
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;
@ -658,7 +662,7 @@
text: 'EB details saved successfully.',
icon: 'success',
confirmButtonText: 'OK'
}).then(function() {
}).then(function () {
// Reload the page after the alert is dismissed
location.reload();
});
@ -669,9 +673,9 @@
}
});
});
});
});
document.getElementById('EBdetailsModal').addEventListener('hide.bs.modal', function () {
document.getElementById('EBdetailsModal').addEventListener('hide.bs.modal', function () {
// Clear the startingReading input field
document.getElementById('startingReading').value = '';

22
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);
@ -473,7 +477,7 @@
// Convert canvas content to blob
canvas.toBlob(blob => {
resolve(new File([blob], file.name, {type: 'image/jpeg', lastModified: Date.now()}));
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;
@ -533,7 +537,7 @@
text: 'EB details saved successfully.',
icon: 'success',
confirmButtonText: 'OK'
}).then(function() {
}).then(function () {
// Reload the page after the alert is dismissed
location.reload();
});
@ -544,8 +548,8 @@
}
});
});
});
document.getElementById('EBdetailsModal').addEventListener('hide.bs.modal', function () {
});
document.getElementById('EBdetailsModal').addEventListener('hide.bs.modal', function () {
// Clear the startingReading input field
document.getElementById('startingReading').value = '';

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>

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

@ -50,22 +50,20 @@
<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"
<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 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>
@ -75,21 +73,19 @@
<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"
<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 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"
@ -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>

56
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,13 +122,18 @@
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>
@ -139,7 +145,8 @@
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}"
<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>
@ -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,13 +213,18 @@
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>
@ -223,7 +236,8 @@
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}"
<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>
@ -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,14 +303,18 @@
<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>
@ -574,8 +594,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>
@ -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],
@ -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();
});

109
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);
$('<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');
}
@ -1351,7 +1372,7 @@ $(document).ready(function () {
'error'
);
},
complete: function() {
complete: function () {
// Re-enable the button after request completes (success or error)
acceptButton.disabled = false;
}
@ -1360,7 +1381,7 @@ $(document).ready(function () {
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);
@ -1695,7 +1716,7 @@ $(document).ready(function () {
'error'
);
},
complete: function() {
complete: function () {
// Re-enable the button after request completes (success or error)
approveButton.disabled = false;
}
@ -1704,7 +1725,7 @@ $(document).ready(function () {
Swal.fire('Changes are not saved', '', 'info');
}
});
}
}
document.addEventListener('DOMContentLoaded', function () {
var ddDetailsCheckbox = document.getElementById('ddDetailsCheckbox');

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>

220
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,6 +97,7 @@
<th>Collection Pending</th>
<th>Refund Amount</th>
<th>Status</th>
<th>Remarks</th>
<th>Action</th>
</tr>
</thead>
@ -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>
@ -254,6 +321,7 @@
<th>Refund Amount</th>
<th>Status</th>
<th>Last Initade date</th>
<th>Remarks</th>
<th>Action</th>
</tr>
</thead>
@ -278,13 +346,31 @@
</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>
@ -521,11 +614,12 @@
0</td>
</tr>
<tr id="collectionstatuscolumn">
<th id="label"
style="padding: 0.45rem 0.45rem;font-weight: normal">Collection Pending Status
<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>
@ -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],
@ -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,9 +1244,13 @@
$("#pendingcolumn").hide();
$("#collectionstatuscolumn").hide();
$("#td_settel_amt").css("color", "green"); // Set color to green for positive amounts
if (isOldBooking) {
$("#approvebutton").prop("disabled", true);
} else {
$("#approvebutton").prop("disabled", false);
}
}
}
function showDamageImage(damageImageUrl) {
document.getElementById('filePreview').src = damageImageUrl;
$('#fileModal').modal('show');
@ -1205,7 +1318,7 @@
//ak for headquarters
error: function (xhr, textStatus, errorThrown) {
loadingSwal.close();
console.log("textstaus"+xhr.responseText);
console.log("textstaus" + xhr.responseText);
let responseData;
try {
@ -1240,7 +1353,7 @@
}
},
complete: function() {
complete: function () {
// Re-enable the button after request completes (success or error)
acceptButton.disabled = false;
}
@ -1249,7 +1362,7 @@
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);
}
@ -1582,7 +1714,7 @@
'error'
);
},
complete: function() {
complete: function () {
// Re-enable the button after request completes (success or error)
approveButton.disabled = false;
}
@ -1591,7 +1723,7 @@
Swal.fire('Changes are not saved', '', 'info');
}
});
}
}
document.addEventListener('DOMContentLoaded', function () {
var ddDetailsCheckbox = document.getElementById('ddDetailsCheckbox');

32
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>
@ -312,11 +316,12 @@
</td>
</tr>
<tr id="collectionstatuscolumn">
<th id="label"
style="padding: 0.45rem 0.45rem;font-weight: normal">Collection Pending Status
<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>
@ -365,8 +370,7 @@
</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">
@ -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;
@ -718,13 +722,13 @@
url: '/communityhall/careTaker/api/generateQRCode',
type: 'GET',
data: { bookingId: bookingId },
success: function(data) {
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) {
error: function (jqXHR, textStatus, errorThrown) {
console.error('Error fetching QR code:', textStatus, errorThrown);
}
});

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

@ -45,7 +45,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="bookingaccepetedtable">
<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>
@ -294,17 +295,20 @@
<div class="row" id="reasondetails">
<div class="col-md-6 mb-2">
<label class="form-label">Reason type :<span class="text-danger">*</span></label>
<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="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">
<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>
@ -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
@ -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;
@ -672,7 +676,7 @@
});
return false; // Prevent form submission
}
}
$(document).ready(
function () {
var buttons = [{

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>

61
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>
@ -106,7 +107,8 @@
<!-- 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}">
<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>
@ -151,11 +153,11 @@
</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}">
<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}"
<option th:each="hall : ${hallnames}" th:value="${hall.hallId}"
th:text="${hall.hallName}">
</option>
</select>
@ -179,6 +181,8 @@
<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>
@ -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>
@ -623,8 +631,8 @@
</div>
<div class="modal fade" id="fileModal" tabindex="-1" role="dialog"
aria-labelledby="fileModalLabel" aria-hidden="true">
<div class="modal fade" id="fileModal" tabindex="-1" role="dialog" aria-labelledby="fileModalLabel"
aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
@ -637,8 +645,7 @@
<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>
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
</div>
</div>
</div>
@ -824,15 +831,15 @@
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 () {
@ -881,7 +888,7 @@ document.addEventListener("DOMContentLoaded", function () {
$.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>

220
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,6 +87,7 @@
<th>Collection Pending</th>
<th>Refund Amount</th>
<th>Status</th>
<th>Remarks</th>
<th>Action</th>
</tr>
</thead>
@ -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>
@ -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>
@ -511,11 +604,12 @@
0</td>
</tr>
<tr id="collectionstatuscolumn">
<th id="label"
style="padding: 0.45rem 0.45rem;font-weight: normal">Collection Pending Status
<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>
@ -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],
@ -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,9 +1231,13 @@
$("#pendingcolumn").hide();
$("#collectionstatuscolumn").hide();
$("#td_settel_amt").css("color", "green"); // Set color to green for positive amounts
if (isOldBooking) {
$("#approvebutton").prop("disabled", true);
} else {
$("#approvebutton").prop("disabled", false);
}
}
}
function showDamageImage(damageImageUrl) {
document.getElementById('filePreview').src = damageImageUrl;
$('#fileModal').modal('show');
@ -1193,7 +1306,7 @@
error: function (xhr, textStatus, errorThrown) {
loadingSwal.close();
console.log("textstaus"+xhr.responseText);
console.log("textstaus" + xhr.responseText);
let responseData;
try {
@ -1227,7 +1340,7 @@
}
},
complete: function() {
complete: function () {
// Re-enable the button after request completes (success or error)
acceptButton.disabled = false;
}
@ -1236,7 +1349,7 @@
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);
}
@ -1569,7 +1701,7 @@
'error'
);
},
complete: function() {
complete: function () {
// Re-enable the button after request completes (success or error)
approveButton.disabled = false;
}
@ -1578,7 +1710,7 @@
Swal.fire('Changes are not saved', '', 'info');
}
});
}
}
document.addEventListener('DOMContentLoaded', function () {
var ddDetailsCheckbox = document.getElementById('ddDetailsCheckbox');

Loading…
Cancel
Save