Browse Source

Community hall updated code with the following changes

1. Admin login --> In Transaction response report temp transactions will be visible
2. Settlement Pending List --> If any error/issue occurs during settlement it will be moved to Refund Failed List
3. Admin Reports --> i) Users -> User Id added in ascending order
                                      ii) Users Booking List --> User Id added in ascending order
                                      iii) Hall Booking List --> Hall Id added in total bookings in descending order
4. Cancel Booking Enabled for booking status Waiting for NOC and Waiting for NOC Approval.
master
kanimozhi 1 year ago
parent
commit
aa384aae16
  1. 2
      src/main/java/com/gcc/communityHall/controller/OfficerAPIController.java
  2. 43
      src/main/java/com/gcc/communityHall/controller/UserAPIController.java
  3. 6
      src/main/java/com/gcc/communityHall/entity/BookingHistory.java
  4. 13
      src/main/java/com/gcc/communityHall/entity/RefundTransaction.java
  5. 52
      src/main/java/com/gcc/communityHall/paymentService/scheduler/PaymentStatusScheduler.java
  6. 2
      src/main/java/com/gcc/communityHall/repository/BookingCalendarRepository.java
  7. 3
      src/main/java/com/gcc/communityHall/repository/BookingDetailsRepository.java
  8. 13
      src/main/java/com/gcc/communityHall/repository/RefundTransactionRepository.java
  9. 2
      src/main/java/com/gcc/communityHall/service/BookingService.java
  10. 3
      src/main/java/com/gcc/communityHall/service/CalendarService.java
  11. 63
      src/main/java/com/gcc/communityHall/service/Impl/BookingServiceImpl.java
  12. 8
      src/main/java/com/gcc/communityHall/service/Impl/CalendarServiceImpl.java
  13. 16
      src/main/java/com/gcc/communityHall/service/Impl/TransactionServiceImpl.java
  14. 2
      src/main/java/com/gcc/communityHall/service/TransactionService.java
  15. 263
      src/main/resources/templates/admin/reports.html
  16. 4
      src/main/resources/templates/user/calculatehallamount.html
  17. 256
      src/main/resources/templates/user/viewhistory.html

2
src/main/java/com/gcc/communityHall/controller/OfficerAPIController.java

@ -176,7 +176,7 @@ public class OfficerAPIController {
description = "REST API for Updating the Refund Status to Approved by Settlement Id If the settlement is Approved"
)
//Updating the Refund Status to Approved by Settlement Id If the settlement is Approved
@PostMapping("/updateApprovedSettlementStatus/{settlementId}")
@PostMapping("/updateApprovedSettlementStatus/{settlementId}") // need to check this API for settlement approval
public ResponseEntity<Object> updateApprovedSettlementStatus(
@PathVariable("settlementId") int settlementId,
@RequestParam("status") BookingDetails.RefundStatus status,

43
src/main/java/com/gcc/communityHall/controller/UserAPIController.java

@ -1,7 +1,6 @@
package com.gcc.communityHall.controller;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
@ -101,7 +100,9 @@ import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpSession;
import lombok.AllArgsConstructor;
import static org.hibernate.query.sqm.tree.SqmNode.log;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
@ -268,7 +269,6 @@ public class UserAPIController {
// System.out.print("ERROR in Sending---: "+e);
bodyMessage = "Error";
}*/
HttpSession session = request.getSession();
session.setAttribute("otp", otp);
return bodyMessage;
@ -317,6 +317,7 @@ public class UserAPIController {
return "Error";
}
}
@GetMapping(value = "/verifyofficialOTP")
public String verifyOtp(HttpServletRequest request, @RequestParam String otp) {
HttpSession session = request.getSession();
@ -393,7 +394,6 @@ public class UserAPIController {
}
@GetMapping("/checkEmployee")
public Map<String, Boolean> checkEmployee(@RequestParam String id) {
boolean isRegistered = usersRepository.existsByGovernmentId(id);
@ -741,7 +741,24 @@ public class UserAPIController {
//retrieving the Booking Details based on BookingId
@GetMapping("/viewAllBookingDetails")
public ResponseEntity<?> getUserDetailsByBookingId(@RequestParam("bookingId") int bookingId) {
LocalDateTime rescheduledUpdatedDate = null;
BookingDetails bookingDetails = bookingService.getBookingsById(bookingId);
if (bookingDetails.getComments().equals( "slots Resheduled the Dates")) {
rescheduledUpdatedDate = LocalDateTime.parse(bookingDetails.getUpdatedDate());
} /*else if(bookingDetails.getScheduleCount()==1){
List<BookingHistory> histories = bookingDetails.getBookingHistories();
if (histories != null && !histories.isEmpty()) {
rescheduledUpdatedDate = histories.stream()
.filter(history -> "slots Resheduled the Dates".equals(history.getComments()))
.map(BookingHistory::getUpdatedDate)
.findFirst()
.orElse(null); }
}*/
if (bookingDetails != null) {
return ResponseEntity.ok(bookingDetails);
} else {
@ -1258,6 +1275,7 @@ public class UserAPIController {
Map<String, Object> saveCounterBooking = counterService.saveCounterBooking(bookingDetails);
return ResponseEntity.ok(saveCounterBooking);
}
@GetMapping("/checkAvail")
public List<HallDetails> checkAvail(@RequestParam("fromDate") String fromDate,
@RequestParam("toDate") String toDate,
@ -1292,8 +1310,7 @@ public class UserAPIController {
if ((starting.equals("evening") || ending.equals("morning")) && fromDate.equals(data.get(i).getBdate().toString()) && toDate.equals(fromDate)) {
if (data.get(i).isEveningSlot() == false) {
continue;
}
else if(data.get(i).isMorningSlot()==false) {
} else if (data.get(i).isMorningSlot() == false) {
continue;
}
} else if ((starting.equals(ending) || starting.equals("evening") && ending.equals("morning")) && !toDate.equals(fromDate)) {
@ -1308,8 +1325,7 @@ public class UserAPIController {
continue;
}
}
else if(toDate.equals(data.get(i).getBdate().toString()) && data.get(i).isMorningSlot()==false){
} else if (toDate.equals(data.get(i).getBdate().toString()) && data.get(i).isMorningSlot() == false) {
if (checkHallId == data.get(i).getHallId() && checkAvail == false) {
checkHallId = data.get(i).getHallId();
continue;
@ -1321,9 +1337,7 @@ public class UserAPIController {
if (checkHallId == data.get(i).getHallId()) {
continue;
}
}
else if(toDate.equals(data.get(i).getBdate().toString()) && data.get(i).isMorningSlot()==false){
} else if (toDate.equals(data.get(i).getBdate().toString()) && data.get(i).isMorningSlot() == false) {
if (checkHallId == data.get(i).getHallId() && checkAvail == false) {
checkHallId = data.get(i).getHallId();
continue;
@ -1334,15 +1348,13 @@ public class UserAPIController {
if (checkHallId == data.get(i).getHallId()) {
continue;
}
}
else if(toDate.equals(data.get(i).getBdate().toString()) && data.get(i).isEveningSlot()==false){
} else if (toDate.equals(data.get(i).getBdate().toString()) && data.get(i).isEveningSlot() == false) {
if (checkHallId == data.get(i).getHallId() && checkAvail == false) {
checkHallId = data.get(i).getHallId();
continue;
}
}
}
else{
} else {
if (checkHallId == data.get(i).getHallId()) {
checkAvail = true;
}
@ -1545,7 +1557,6 @@ public class UserAPIController {
}
if (bookingDetails.getBookingStatus() == BookingStatus.GCC_BLOCKED) {
Map<String, Object> gccBlockedDetail = new HashMap<>();
gccBlockedDetail.put("status", "GCC_BLOCKED");
@ -1804,6 +1815,7 @@ public class UserAPIController {
return ResponseEntity.ok(response);
}
public double calculateAmount(double numDays, String startPeriod, String endPeriod, double fullDayAmount, double halfDayAmount) {
double amount = 0;
@ -1908,6 +1920,5 @@ public class UserAPIController {
}
}

6
src/main/java/com/gcc/communityHall/entity/BookingHistory.java

@ -44,7 +44,11 @@ public class BookingHistory {
@Column(name="end_date")
private String endDate;
@ManyToOne(cascade = CascadeType.ALL,fetch = FetchType.EAGER)
/*@ManyToOne(cascade = CascadeType.ALL,fetch = FetchType.EAGER)
@JsonIgnore
private BookingDetails bookingDetails;*/
@ManyToOne(fetch = FetchType.EAGER)
@JsonIgnore
private BookingDetails bookingDetails;

13
src/main/java/com/gcc/communityHall/entity/RefundTransaction.java

@ -67,4 +67,17 @@ public class RefundTransaction {
public void setRefundIdentifier(String refundIdentifier) {
this.refundIdentifier = refundIdentifier;
}
@Override
public String toString() {
return "RefundTransaction{" +
"refundId=" + refundId +
", amountRefunded=" + amountRefunded +
", TransactionId='" + TransactionId + '\'' +
", refundStatus='" + refundStatus + '\'' +
", cdate=" + cdate +
", refundIdentifier='" + refundIdentifier + '\'' +
", bookingDetails=" + bookingDetails +
'}';
}
}

52
src/main/java/com/gcc/communityHall/paymentService/scheduler/PaymentStatusScheduler.java

@ -5,6 +5,7 @@ package com.gcc.communityHall.paymentService.scheduler;
//package com.gcc.communityHall.paymentService.Scheduler;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.gcc.communityHall.entity.BookingCalendar;
import com.gcc.communityHall.entity.BookingDetails;
import com.gcc.communityHall.entity.Payments;
import com.gcc.communityHall.entity.RefundTransaction;
@ -20,6 +21,7 @@ import com.gcc.communityHall.paymentService.repository.TransactionStatusLogRepos
import com.gcc.communityHall.paymentService.service.PaymentGatewayServiceImpl;
import com.gcc.communityHall.repository.PaymentsRepository;
import com.gcc.communityHall.service.BookingService;
import com.gcc.communityHall.service.CalendarService;
import com.gcc.communityHall.service.TransactionService;
import com.google.gson.Gson;
import jakarta.transaction.Transactional;
@ -31,10 +33,7 @@ import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;
import java.time.LocalDate;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
@Component
@EnableScheduling
@ -68,6 +67,9 @@ public class PaymentStatusScheduler {
@Autowired
private PaymentGatewayServiceImpl paymentGatewayServiceImpl;
@Autowired
private CalendarService calendarService;
// @Scheduled(cron = "0 0 0 * * ?", zone = "Asia/Kolkata") //executed at 12:00 AM
// @Scheduled(fixedRate = 900000)
@Scheduled(fixedRate = 30000)
@ -192,12 +194,11 @@ public class PaymentStatusScheduler {
bookingService.updateBookingStatus(transRes.getBookingId(), BookingDetails.BookingStatus.REFUNDED, "Booking Not Confirmed. Amount will be refunded shortly.");
intiateRefund(transRes.getBookingId(), Integer.parseInt(transRes.getUserId()));
}
else{
} else {
payments.setBookingDetails(payments.getBookingDetails());
payments.setTransactionId(transRes.getTxansactionId());
payments.setAmountReceived(Double.parseDouble(response.get("amount")!=null?response.get("amount").toString():"0")); payments.setPaymentStatus("Not Completed");
payments.setAmountReceived(Double.parseDouble(response.get("amount") != null ? response.get("amount").toString() : "0"));
payments.setPaymentStatus("Not Completed");
payments.setCdate(new Date());
paymentsRepository.save(payments);
@ -236,7 +237,12 @@ public class PaymentStatusScheduler {
Map<String, Object> mapRef = refundDetails.get(refundDetails.size() - 1);
LocalDate df = LocalDate.now();
try{df =LocalDate.parse(mapRef.get("REF_TXN_DATE").toString());}catch (Exception e){df = LocalDate.now();};
try {
df = LocalDate.parse(mapRef.get("REF_TXN_DATE").toString());
} catch (Exception e) {
df = LocalDate.now();
}
;
refundResponse.setDate(df);
if (mapRef.get("STATUS") != null && mapRef.get("STATUS").toString().equals("INITIATED")) {
refundResponse.setStatusCode("0400");
@ -263,31 +269,36 @@ public class PaymentStatusScheduler {
transactionService.saveRefundTransaction(refundTrans);
} else {
refundTrans = new RefundTransaction();
refundTrans.setAmountRefunded(amt - balAmt);
double refundAmt = amt - balAmt;
System.out.println("refundAmt.."+refundAmt);
refundTrans.setAmountRefunded(refundAmt);
refundTrans.setRefundStatus("0400");
refundTrans.setRefundIdentifier(response.get("refundIdentifier").toString());
refundTrans.setCdate(new Date());
refundTrans.setTransactionId(log.getTransactionId());
BookingDetails bookings = new BookingDetails();
BookingDetails bookingsById = bookingService.getBookingsById(Integer.parseInt(log.getBookingId()));
System.out.println("bookingsById"+bookingsById.getBookingId());
bookings.setBookingId(bookingsById.getBookingId());
refundTrans.setBookingDetails(bookings);
System.out.println(refundTrans.toString());
transactionService.saveRefundTransactionDetails(refundTrans);
refundTrans.setBookingDetails(bookingsById);
transactionService.saveRefundTransaction(refundTrans);
}
bookingService.updateRefundStatus(saverRefundResponse.getBookingId(),BookingDetails.RefundStatus.COMPLETED); }
// bookingService.updateRefundStatus(saverRefundResponse.getBookingId(), BookingDetails.RefundStatus.COMPLETED);
bookingService.updateRefundStatusScheduler(saverRefundResponse.getBookingId(), BookingDetails.RefundStatus.COMPLETED);
}
saveRefundClientInfo(refundDetails, log.getUserId(), log.getBookingId(), log.getTransactionId());
}
}
}
public String saveRefundClientInfo(List<Map<String, Object>> refundDetail,String userId,String bookingId,String transactionId) {
public String saveRefundClientInfo(List<Map<String, Object>> refundDetail, String userId, String bookingId, String transactionId) {
if (refundDetail == null || refundDetail.isEmpty()) {
@ -318,13 +329,14 @@ public class PaymentStatusScheduler {
@Transactional
public void intiateRefund(int bookingId, int userId) throws Exception {
List<BookingCalendar> bc = calendarService.getCalendarByBookingId(bookingId);
if (bc != null && bc.isEmpty()) {
String s = paymentGatewayServiceImpl.refundTheAmount(bookingId, userId);
if (s.equals("Refunded")) {
bookingService.updateRefundStatus(bookingId, BookingDetails.RefundStatus.COMPLETED);
}
}else
{
} else {
bookingService.updateRefundStatus(bookingId, BookingDetails.RefundStatus.FAILURE);
}

2
src/main/java/com/gcc/communityHall/repository/BookingCalendarRepository.java

@ -73,4 +73,6 @@ public interface BookingCalendarRepository extends JpaRepository<BookingCalendar
@Param("bookingId") Long bookingId,
@Param("hallName") String hallName);
@Query(value="SELECT * from booking_calendar where booking_id_1 = :bookingId or booking_id_2 = :bookingId ", nativeQuery = true)
List<BookingCalendar> getCalendarByBookingId(int bookingId);
}

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

@ -337,8 +337,7 @@ public interface BookingDetailsRepository extends JpaRepository<BookingDetails,
+ "LEFT JOIN counter_details cd ON cd.counter_id = bd.counterdetails_counter_id\r\n"
+ "LEFT JOIN payments pd ON bd.booking_id = pd.booking_details_booking_id \r\n"
+ "WHERE bd.users_user_id = :userId and booking_status IN ('GCC_BLOCKED', 'APPROVED','CANCELED','REJECTED','COMPLETED','WAITING_FOR_NOC','WAITING_FOR_NOC_APPROVAL') \r\n"
+ "ORDER BY bd.booking_id DESC;\r\n"
+ "", nativeQuery = true)
+ "ORDER BY bd.booking_id DESC\r\n", nativeQuery = true)
List<Map<String, Object>> getAllBookingEventsByUserId(Integer userId);
//counter

13
src/main/java/com/gcc/communityHall/repository/RefundTransactionRepository.java

@ -3,8 +3,10 @@ package com.gcc.communityHall.repository;
import com.gcc.communityHall.entity.RefundTransaction;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
@Repository
public interface RefundTransactionRepository extends JpaRepository<RefundTransaction,Integer> {
@ -13,4 +15,15 @@ public interface RefundTransactionRepository extends JpaRepository<RefundTransac
@Query(value = "select * from refund_transaction where booking_details_booking_id = ?",nativeQuery = true)
RefundTransaction findByBookingId(int bookingId);
@Modifying
@Transactional
@Query(value = "INSERT INTO refund_transaction (transaction_id, amount_refunded, cdate, refund_status, booking_details_booking_id, refund_identifier) " +
"VALUES (?, ?, ?, ?, ?, ?)", nativeQuery = true)
void insertRefundTransaction(String transactionId,
Double amountRefunded,
java.util.Date cdate,
String refundStatus,
Integer bookingId,
String refundIdentifier);
}

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

@ -202,4 +202,6 @@ public interface BookingService {
List<Object[]> getBookingCalendarDetails(String fromDate, String toDate, Long bookingId, String hallName);
List<BookingDetails> getBookingsByDateAndHall(String bookingDate, Long hallId);
BookingDetails updateRefundStatusScheduler(int bookingId, RefundStatus status);
}

3
src/main/java/com/gcc/communityHall/service/CalendarService.java

@ -10,4 +10,7 @@ public interface CalendarService {
List<BookingCalendar> getCalendarByDateAndHallIdAndSlot(
String fromDate,String toDate,String startingSlot,String endingSlot,
int hallId);
List<BookingCalendar> getCalendarByBookingId(int bookingId);
}

63
src/main/java/com/gcc/communityHall/service/Impl/BookingServiceImpl.java

@ -170,6 +170,7 @@ public class BookingServiceImpl implements BookingService {
@Override
public BookingDetails getBookingsById(int BookingId) {
Optional<BookingDetails> OPBookingDetails = bookingDetailsRepository.findById(BookingId);
if (OPBookingDetails.isPresent()) {
return OPBookingDetails.get();
}
@ -186,7 +187,7 @@ public class BookingServiceImpl implements BookingService {
Optional<BookingDetails> booking = bookingDetailsRepository.findById(bookingId);
if (booking.isPresent()) {
BookingDetails book = booking.get();
BookingHistory bookingHistory = new BookingHistory();
/*BookingHistory bookingHistory = new BookingHistory();
bookingHistory.setBookingDetails(book);
bookingHistory.setStartDate(book.getStartDate());
bookingHistory.setEndDate(book.getEndDate());
@ -194,7 +195,8 @@ public class BookingServiceImpl implements BookingService {
bookingHistory.setComments(book.getComments());
bookingHistory.setCdate(new Date());
bookingHistory.setRefundStatus(book.getRefundStatus());
bookingHistoryRepository.save(bookingHistory);
System.out.println("bookingHistory.."+bookingHistory);
bookingHistoryRepository.save(bookingHistory);*/
book.setBookingStatus(status);
book.setComments(comments);
@ -979,6 +981,9 @@ public class BookingServiceImpl implements BookingService {
bd.setBookingDetails(bookingDetails); // Set the associated booking details
bookingDetails.setBookingStatus(BookingStatus.WAITING_FOR_NOC_APPROVAL);
bookingDetails.setComments("Waiting for Admin Approval");
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
String formattedDate = LocalDateTime.now().format(formatter);
bookingDetails.setUpdatedDate(formattedDate);
// Save the file to the server
try (FileOutputStream fos = new FileOutputStream(filePath)) {
@ -1603,17 +1608,18 @@ public class BookingServiceImpl implements BookingService {
String adminname = (String) session.getAttribute("usertype");
BookingDetails book = booking.get();
book.setRefundStatus(status);
// BookingHistory bookingHistory=new BookingHistory();
// bookingHistory.setStartDate(book.getStartDate());
// bookingHistory.setEndDate(book.getEndDate());
// bookingHistory.setComments(book.getComments());
// bookingHistory.setBookingDetails(book);
// bookingHistory.setBookingStatus(book.getBookingStatus());
// bookingHistory.setUpdatedBy(adminname);
// bookingHistory.setCdate(new Date());
// bookingHistory.setRefundStatus(book.getRefundStatus());
BookingHistory bookingHistory = new BookingHistory();
bookingHistory.setStartDate(book.getStartDate());
bookingHistory.setEndDate(book.getEndDate());
bookingHistory.setComments(book.getComments());
bookingHistory.setBookingDetails(book);
bookingHistory.setBookingStatus(book.getBookingStatus());
bookingHistory.setUpdatedBy(adminname);
bookingHistory.setCdate(new Date());
bookingHistory.setRefundStatus(book.getRefundStatus());
bookingHistoryRepository.save(bookingHistory);
book.setComments("Refund status Updated to:-" + status);
// bookingHistoryRepository.save(bookingHistory);
BookingDetails bookings = bookingDetailsRepository.save(book);
return bookings;
}
@ -1778,6 +1784,9 @@ public class BookingServiceImpl implements BookingService {
Optional<BookingDetails> book = bookingDetailsRepository.findById(bookingId);
BookingDetails bookingDetails = book.get();
bookingDetails.setScheduleCount(bookingDetails.getScheduleCount() + 1);
if (bookingDetails.getReason().equals("Commercial")) {
bookingDetails.setBookingStatus(BookingStatus.WAITING_FOR_NOC);
}
//Updating Bookinghistory startDate and End Date
BookingHistory bookingHistory = new BookingHistory();
bookingHistory.setStartDate(bookingDetails.getStartDate());
@ -1791,6 +1800,9 @@ public class BookingServiceImpl implements BookingService {
bookingDetails.setEndDate(endDate);
bookingHistory.setRefundStatus(bookingDetails.getRefundStatus());
bookingDetails.setComments("slots Resheduled the Dates");
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
String formattedDate = LocalDateTime.now().format(formatter);
bookingDetails.setUpdatedDate(formattedDate);
bookingDetailsRepository.save(bookingDetails);
bookingHistoryRepository.save(bookingHistory);
}
@ -2396,5 +2408,32 @@ public class BookingServiceImpl implements BookingService {
return bookingDetailsRepository.findByBookingDateAndHallId(date, hallId);
}
@Override
@Transactional
public BookingDetails updateRefundStatusScheduler(int bookingId, RefundStatus status) {
Optional<BookingDetails> booking = bookingDetailsRepository.findById(bookingId);
if (booking.isPresent()) {
String adminname = "Refund Scheduler";
BookingDetails book = booking.get();
book.setRefundStatus(status);
book.setComments("Refund status Updated to:-" + status);
BookingDetails bookings = bookingDetailsRepository.save(book);
BookingHistory bookingHistory = new BookingHistory();
bookingHistory.setStartDate(book.getStartDate());
bookingHistory.setEndDate(book.getEndDate());
bookingHistory.setComments(book.getComments());
bookingHistory.setBookingDetails(book);
bookingHistory.setBookingStatus(book.getBookingStatus());
bookingHistory.setUpdatedBy(adminname);
bookingHistory.setCdate(new Date());
bookingHistory.setRefundStatus(book.getRefundStatus());
bookingHistoryRepository.save(bookingHistory);
return bookings;
}
return null;
}
}

8
src/main/java/com/gcc/communityHall/service/Impl/CalendarServiceImpl.java

@ -30,4 +30,12 @@ public class CalendarServiceImpl implements CalendarService {
}
}
@Override
public List<BookingCalendar> getCalendarByBookingId(int bookingId) {
if(bookingId!=0){
return bookingCalendarRepository.getCalendarByBookingId(bookingId);
}
return null;
}
}

16
src/main/java/com/gcc/communityHall/service/Impl/TransactionServiceImpl.java

@ -3,6 +3,7 @@ package com.gcc.communityHall.service.Impl;
import com.gcc.communityHall.entity.RefundTransaction;
import com.gcc.communityHall.repository.RefundTransactionRepository;
import com.gcc.communityHall.service.TransactionService;
import jakarta.transaction.Transactional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -21,4 +22,19 @@ public class TransactionServiceImpl implements TransactionService {
public RefundTransaction saveRefundTransaction(RefundTransaction refundTransaction) {
return refundTransactionRepository.save(refundTransaction);
}
@Transactional
@Override
public void saveRefundTransactionDetails(RefundTransaction refundTransaction) {
refundTransactionRepository.insertRefundTransaction(
refundTransaction.getTransactionId(),
refundTransaction.getAmountRefunded(),
refundTransaction.getCdate(),
refundTransaction.getRefundStatus(),
refundTransaction.getBookingDetails().getBookingId(),
refundTransaction.getRefundIdentifier()
);
// return refundTransaction; // returning the same object after manual insert
}
}

2
src/main/java/com/gcc/communityHall/service/TransactionService.java

@ -7,4 +7,6 @@ public interface TransactionService {
RefundTransaction getRefundTrans(int bookingId);
RefundTransaction saveRefundTransaction(RefundTransaction refundTransaction);
void saveRefundTransactionDetails(RefundTransaction refundTrans);
}

263
src/main/resources/templates/admin/reports.html

@ -84,8 +84,12 @@
<div class="col-sm-3 mb-2">
<label class="form-label" for="fromdate">From:<span
class="text-danger">*</span></label> <input type="date"
th:value="${fromdate}" class="form-control" name="FromDate" id="fromdate"
placeholder="From Date" required="required" data-date-format="yyyy-mm-dd" />
th:value="${fromdate}"
class="form-control" name="FromDate"
id="fromdate"
placeholder="From Date"
required="required"
data-date-format="yyyy-mm-dd"/>
</div>
<div class="col-sm-3 mb-2">
<label class="form-label" for="todate">To:<span class="text-danger">*</span></label>
@ -143,9 +147,6 @@
</div>
<!-- bookingDetailsDropdown1 -->
<div class="col-sm-3 mb-2" id="bookingDetailsDropdown1" style="display: none;">
<label class="form-label" for="bookingId">Booking Id: </label>
@ -217,22 +218,33 @@
<option value="COMPLETED" th:selected="${bookingStatus == 'COMPLETED'}">COMPLETED
</option>
<option value="PAYMENT_FAILURE"
th:selected="${bookingStatus == 'PAYMENT_FAILURE'}">PAYMENT_FAILURE</option>
th:selected="${bookingStatus == 'PAYMENT_FAILURE'}">PAYMENT_FAILURE
</option>
<option value="GCC_BLOCKED" th:selected="${bookingStatus == 'GCC_BLOCKED'}">
GCC_BLOCKED</option>
<option value="REFUNDED" th:selected="${bookingStatus == 'REFUNDED'}">REFUNDED</option>
<option value="WAITING_FOR_NOC" th:selected="${bookingStatus == 'WAITING_FOR_NOC'}">WAITING FOR NOC</option>
<option value="WAITING_FOR_NOC_APPROVAL" th:selected="${bookingStatus == 'WAITING_FOR_NOC_APPROVAL'}">WAITING FOR NOC APPROVAL</option>
GCC_BLOCKED
</option>
<option value="REFUNDED" th:selected="${bookingStatus == 'REFUNDED'}">REFUNDED
</option>
<option value="WAITING_FOR_NOC" th:selected="${bookingStatus == 'WAITING_FOR_NOC'}">
WAITING FOR NOC
</option>
<option value="WAITING_FOR_NOC_APPROVAL"
th:selected="${bookingStatus == 'WAITING_FOR_NOC_APPROVAL'}">WAITING FOR NOC
APPROVAL
</option>
</select>
</div>
<!--Payment Dropdown -->
<div class="col-sm-3" id="paymentInfoDropdown1" style="display: none;">
<label class="form-label" for="paymentStatus">Payment Status:</label>
<select class="form-control text-center" id="paymentStatus" name="paymentStatus" th:value="${paymentStatus}">
<select class="form-control text-center" id="paymentStatus" name="paymentStatus"
th:value="${paymentStatus}">
<option value="">Select Payment Status</option>
<option value="SUCCESS" th:selected="${paymentStatus == 'SUCCESS'}">SUCCESS</option>
<option value="NOT COMPLETED" th:selected="${paymentStatus == 'NOT COMPLETED'}">NOT COMPLETED</option>
<option value="NOT COMPLETED" th:selected="${paymentStatus == 'NOT COMPLETED'}">NOT
COMPLETED
</option>
</select>
</div>
@ -277,9 +289,11 @@
<div class="col-sm-3">
<br>
<button type="submit" class="btn btn-sm btn-primary mt-2" name="submit"
id="submit">Submit</button>
id="submit">Submit
</button>
<button class="btn btn-danger mt-2" onclick="resetDate()" name="reset"
type="reset">Reset</button>
type="reset">Reset
</button>
</div>
</div>
@ -370,7 +384,6 @@
</div>
<div class="table-responsive" id="Paymenttable" th:if="${request}==3">
<table id="requestTable3" class="table table-striped table-bordered table-hover dataTable"
role="grid" width="99.5%">
@ -589,7 +602,6 @@
</div>
</div>
<div class="modal fade backdrop" id="showBookingDetails" data-backdrop="static"
@ -621,25 +633,29 @@
<tr>
<th colspan="10"
style="background-color: lightgrey;">
User Details</th>
User Details
</th>
</tr>
<tr>
<th
style="padding: 0.45rem 0.45rem;font-weight: normal;">
User Name:</th>
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>
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>
User Type:
</th>
<td class="fw-semibold"
style="padding: 0.45rem 0.45rem;"
id="td_usertype"></td>
@ -648,7 +664,8 @@
<tr>
<th
style="padding: 0.45rem 0.45rem;font-weight: normal;">
User Address:</th>
User Address:
</th>
<td colspan="5" class="fw-semibold"
style="padding: 0.45rem 0.45rem;text-wrap: pretty;"
id="td_useraddress"></td>
@ -660,13 +677,15 @@
<tr>
<th colspan="10"
style="background-color: lightgrey;">
Hall Details</th>
Hall Details
</th>
</tr>
<tr>
<th
style="padding: 0.45rem 0.45rem;font-weight: normal;">
Hall Name:</th>
Hall Name:
</th>
<td colspan="10" class="fw-semibold"
style="padding: 0.45rem 0.45rem;text-wrap:pretty;"
id="td_hallName"></td>
@ -674,7 +693,8 @@
</tr>
<th
style="padding: 0.45rem 0.45rem;font-weight: normal;">
Hall Address:</th>
Hall Address:
</th>
<td colspan="10" class="fw-semibold"
style="padding: 0.45rem 0.45rem;text-wrap: pretty;"
id="td_halladdress"></td>
@ -683,13 +703,15 @@
<tr>
<th
style="padding: 0.45rem 0.45rem;font-weight: normal;">
Caretaker Name:</th>
Caretaker Name:
</th>
<td colspan="2" class="fw-semibold"
style="padding: 0.45rem 0.45rem;"
id="td_caretakername"></td>
<th
style="padding: 0.45rem 0.45rem;font-weight: normal;">
Caretaker Mobile Number:</th>
Caretaker Mobile Number:
</th>
<td colspan="2" class="fw-semibold"
style="padding: 0.45rem 0.45rem;"
id="td_caretakermobileNumber"></td>
@ -701,18 +723,21 @@
Booking
Details (Booking Id:-<span
id="booking_id"
style="color:blue"></span>)</th>
style="color:blue"></span>)
</th>
</tr>
<tr>
<th
style="padding: 0.45rem 0.45rem;font-weight: normal">
Booking Date:</th>
Booking Date:
</th>
<td colspan="2" 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 (in Rs):</th>
Deposit Amount (in Rs):
</th>
<td colspan="2"
class="fw-semibold amount-cell"
style="padding: 0.45rem 0.45rem;"
@ -721,13 +746,15 @@
<tr>
<th
style="padding: 0.45rem 0.45rem;font-weight: normal">
Start Date:</th>
Start Date:
</th>
<td colspan="2" 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 (in Rs):</th>
Hall Amount (in Rs):
</th>
<td colspan="2"
class="fw-semibold amount-cell"
style="padding: 0.45rem 0.45rem;"
@ -736,13 +763,15 @@
<tr>
<th
style="padding: 0.45rem 0.45rem;font-weight: normal">
END Date:</th>
END Date:
</th>
<td colspan="2" 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% (in Rs):</th>
GST @18% (in Rs):
</th>
<td colspan="2"
class="fw-semibold amount-cell"
style="padding: 0.45rem 0.45rem;"
@ -751,13 +780,15 @@
<tr>
<th
style="padding: 0.45rem 0.45rem;font-weight: normal">
Starting Slot:</th>
Starting Slot:
</th>
<td colspan="2" 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 (in Rs):</th>
Total Amount (in Rs):
</th>
<td colspan="2"
class="fw-semibold amount-cell"
style="padding: 0.45rem 0.45rem;"
@ -766,7 +797,8 @@
<tr>
<th
style="padding: 0.45rem 0.45rem;font-weight: normal">
Ending Slot:</th>
Ending Slot:
</th>
<td colspan="2" class="fw-semibold"
style="padding: 0.45rem 0.45rem;"
id="td_endingSlot"></td>
@ -788,7 +820,8 @@
<tr>
<th style="display:none;padding: 0.45rem 0.45rem;border:none"
id="rejectionreasondiv">Rejection
Reason:</th>
Reason:
</th>
<td class="fw-semibold"
style="padding: 0.45rem 0.45rem;text-wrap: pretty;"
id="reasonforrejection"></td>
@ -807,12 +840,14 @@
<tr>
<th colspan="10"
style="background-color: lightgrey;">
Booking Payment Details</th>
Booking Payment Details
</th>
</tr>
<tr>
<th
style="padding: 0.45rem 0.45rem;font-weight: normal;">
Transaction ID:</th>
Transaction ID:
</th>
<td colspan="10" class="fw-semibold"
style="padding: 0.45rem 0.45rem;"
id="td_transactionId"></td>
@ -820,7 +855,8 @@
</tr>
<th
style="padding: 0.45rem 0.45rem;font-weight: normal;">
Amount Received (in Rs):</th>
Amount Received (in Rs):
</th>
<td colspan="10" class="fw-semibold"
style="padding: 0.45rem 0.45rem;"
id="td_payamountReceived"></td>
@ -829,7 +865,8 @@
<tr>
<th
style="padding: 0.45rem 0.45rem;font-weight: normal;">
Transaction Status:</th>
Transaction Status:
</th>
<td class="fw-semibold"
style="padding: 0.45rem 0.45rem;"
id="td_paymentStatus"></td>
@ -837,6 +874,51 @@
</table>
</div>
</div>
<!--Newly added for Reschedule Details-->
<div class="row col-md-12 col-lg-12 col-sm-12"
id="rescheduleDetails"
style="display:none;margin-left: 0px;margin-top: -10px">
<div class="card-body">
<table>
<tr>
<th colspan="4"
style="background-color: lightgrey;">Reschedule
Details
</th>
</tr>
<tr>
<th
style="padding: 0.45rem 0.45rem;font-weight: normal">
Event Start Date:
</th>
<td class="fw-semibold"
style="padding: 0.45rem 0.45rem;"
id="td_res_start_date"></td>
<th
style="padding: 0.45rem 0.45rem;font-weight: normal">
Event End Date:
</th>
<td class="fw-semibold"
style="padding: 0.45rem 0.45rem;"
id="td_res_end_date"></td>
</tr>
<tr>
<th
style="padding: 0.45rem 0.45rem;font-weight: normal;text-wrap: pretty;">
Rescheduled Date:
</th>
<td class="fw-semibold" colspan="5"
style="padding: 0.45rem 0.45rem;"
id="td_res_date"></td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="row col-md-12 col-lg-12 col-sm-12"
id="ebdetails"
style="display:none;margin-left: 0px;margin-top: -10px">
@ -845,18 +927,21 @@
<tr>
<th colspan="4"
style="background-color: lightgrey;">EB
Details</th>
Details
</th>
</tr>
<tr>
<th
style="padding: 0.45rem 0.45rem;font-weight: normal">
Consumer Number:</th>
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 (in Rs):</th>
EB Amount Per Unit (in Rs):
</th>
<td class="fw-semibold"
style="padding: 0.45rem 0.45rem;"
id="td_ebamountperunit"></td>
@ -864,13 +949,15 @@
<tr>
<th
style="padding: 0.45rem 0.45rem;font-weight: normal">
Start Reading:</th>
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">
Unit Consumed:</th>
Unit Consumed:
</th>
<td class="fw-semibold"
style="padding: 0.45rem 0.45rem;"
id="td_usedunit"></td>
@ -878,13 +965,15 @@
<tr>
<th
style="padding: 0.45rem 0.45rem;font-weight: normal">
END Reading:</th>
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">
EB Amount (in Rs):</th>
EB Amount (in Rs):
</th>
<td class="fw-semibold"
style="padding: 0.45rem 0.45rem;"
id="td_electricityamount"></td>
@ -905,20 +994,24 @@
<tr>
<th colspan="2"
style="background-color: lightgrey;">
Amount to be Refunded (in Rs) </th>
Amount to be Refunded (in Rs)
</th>
</tr>
<tr>
<th
style="padding: 0.45rem 0.45rem;font-weight: normal">
Deposit Amount:</th>
Deposit Amount:
</th>
<td class="fw-semibold amount-cell"
style="padding: 0.45rem 0.45rem;"
id="td_depositeamountforrefund">0</td>
id="td_depositeamountforrefund">0
</td>
</tr>
<tr>
<th
style="padding: 0.45rem 0.45rem;font-weight: normal">
EB Amount:</th>
EB Amount:
</th>
<td class="fw-semibold amount-cell"
style="padding: 0.45rem 0.45rem;"
id="td_ebAmount"></td>
@ -926,7 +1019,8 @@
<tr>
<th
style="padding: 0.45rem 0.45rem;font-weight: normal">
Damage Amount:</th>
Damage Amount:
</th>
<td class="fw-semibold amount-cell"
style="padding: 0.45rem 0.45rem;"
id="td_damage"></td>
@ -934,26 +1028,33 @@
<tr id="pendingcolumn">
<th id="th_settel_label"
style="padding: 0.45rem 0.45rem; background-color: #f2f2f2;font-weight: normal">
Collection Pending Amount:</th>
Collection Pending Amount:
</th>
<td class="fw-semibold amount-cell"
style="padding: 0.45rem 0.45rem; color: green;"
id="td_pending_amt">0</td>
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>
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>
<th
style="padding: 0.45rem 0.45rem; background-color: #f2f2f2;font-weight: normal">
Actual refundable Amount:</th>
Actual refundable Amount:
</th>
<td class="fw-semibold amount-cell"
style="padding: 0.45rem 0.45rem; color: green;"
id="td_settel_amt">0</td>
id="td_settel_amt">0
</td>
</tr>
</table>
</div>
@ -966,18 +1067,21 @@
<tr>
<th colspan="4"
style="background-color: lightgrey;">
Refund Details</th>
Refund Details
</th>
</tr>
<tr>
<th
style="padding: 0.45rem 0.45rem;font-weight: normal">
Booking Status:</th>
Booking Status:
</th>
<td class="fw-semibold"
style="padding: 0.45rem 0.45rem;"
id="td_bookingStatus"></td>
<th
style="padding: 0.45rem 0.45rem;font-weight: normal">
Refund Status:</th>
Refund Status:
</th>
<td class="fw-semibold"
style="padding: 0.45rem 0.45rem;"
id="td_refundStatus"></td>
@ -985,7 +1089,8 @@
<tr>
<th
style="padding: 0.45rem 0.45rem;font-weight: normal;text-wrap: pretty;">
Refund amount:</th>
Refund amount:
</th>
<td class="fw-semibold" colspan="5"
style="padding: 0.45rem 0.45rem;"
id="td_refundamount"></td>
@ -1017,7 +1122,8 @@
<button type="button"
style="background-color: rgb(21,69,93);color: white;"
class="btn btn-sm btn-alt-secondary"
data-bs-dismiss="modal">Close</button>
data-bs-dismiss="modal">Close
</button>
</div>
</form>
</div>
@ -1318,14 +1424,12 @@
document.getElementById("refundDetailsDropdown").style.display = "block";
document.getElementById("bookingDetailsDropdown3").style.display = "block";
}
else if (requestValue === "3") {
} else if (requestValue === "3") {
document.getElementById("zoneDropdown").style.display = "block";
document.getElementById("divisionContainer").style.display = "block";
document.getElementById("hallContainer").style.display = "block";
document.getElementById("paymentInfoDropdown1").style.display = "block";
}
else if (requestValue === "5") {
} else if (requestValue === "5") {
document.getElementById("bookingDetailsDropdown3").style.display = "block";
document.getElementById("zoneDropdown").style.display = "block";
document.getElementById("divisionContainer").style.display = "block";
@ -1340,6 +1444,7 @@
}
}
document.addEventListener("DOMContentLoaded", function () {
document.getElementById("basedon").addEventListener("change", function () {
const selectedValue = this.value;
@ -1466,6 +1571,15 @@
document.getElementById("refunddetails").style.display = "none";
}
if (response.scheduleCount === 1) {
document.getElementById("rescheduleDetails").style.display = "block";
document.getElementById("td_res_start_date").innerHTML = response.startDate;
document.getElementById("td_res_end_date").innerHTML = response.endDate;
document.getElementById("td_res_date").innerHTML = response.updatedDate;
} else {
document.getElementById("rescheduleDetails").style.display = "none";
}
showDamageDetails(response);
if (response.bookingStatus === 'CANCELED' && ['WAITING', 'APPROVED', 'INITIATED'].includes(response.refundStatus)) {
document.getElementById("td_refundamount").innerHTML = `Your booking has been cancelled. Deposit amount of ₹ ${parseFloat(response.depositAmount).toFixed(2)} will be refund 3 to 15 Days`;
@ -1479,8 +1593,7 @@
document.getElementById("td_refundStatus").innerHTML = response.refundStatus;
} else if (response.bookingStatus === 'REJECTED' && ['WAITING', 'APPROVED', 'INITIATED'].includes(response.refundStatus) && response.amountReceived == 0) {
document.getElementById("refundamountDetails").style.display = "none";
}
else if (response.bookingStatus === 'REJECTED' && ['WAITING', 'APPROVED', 'INITIATED'].includes(response.refundStatus)) {
} else if (response.bookingStatus === 'REJECTED' && ['WAITING', 'APPROVED', 'INITIATED'].includes(response.refundStatus)) {
document.getElementById("td_refundamount").innerHTML = `Your booking has been Rejected by GCC. Full amount of ₹ ${parseFloat(response.amountReceived).toFixed(2)} will be refunded shortly`;
document.getElementById("refundamountDetails").style.display = "block";
document.getElementById("td_bookingStatus").innerHTML = response.bookingStatus;
@ -1525,7 +1638,11 @@
var tableResponsiveDiv = $('<div>').addClass('table-responsive').css({'width': '770px'});
// 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>');
@ -1591,6 +1708,7 @@
$("#td_settel_amt").css("color", "green"); // Set color to green for positive amounts
}
}
function showReasonDocuments(list) {
$.ajax({
type: "GET",
@ -1668,6 +1786,7 @@
//console.log(fileURL);
openFileModal(fileURL);
}
// Event delegation for dynamically added elements
$(document).on('click', '.view-document', function () {
const fileURL = $(this).data('url');

4
src/main/resources/templates/user/calculatehallamount.html

@ -503,8 +503,9 @@
var startPeriod = $('#startPeriodDropdown').val();
var endPeriod = $('#endPeriodDropdown').val();
var reasonForBooking = $('#reasonforBooking').val();
// console.log("reasonForBooking="+reasonForBooking);
if (reasonforBooking === '') {
if (reasonForBooking.trim() === '') {
$('#reasonforBooking')[0].setCustomValidity('Please select reason for booking.');
$('#reasonforBooking')[0].reportValidity();
return;
@ -514,6 +515,7 @@
// Validate input fields
if (isNaN(numDays) || numDays < 1 || numDays > 7) {
console.log("num of days")
$('#numDaysCount')[0].setCustomValidity('Please select a valid number of days.');
$('#numDaysCount')[0].reportValidity();
return;

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

@ -420,6 +420,7 @@
overflow-y: auto;
/* Enable vertical scrolling if needed */
}
body {
font-family: Arial, sans-serif;
}
@ -682,6 +683,16 @@
th:onclick="cancelBooking([[${booking.booking_id}]], [[${booking.mobile_no}]], [[${booking.booking_type}]])">Cancel
Booking</span>
</a>
<!--<a class="reschedule-button"
th:if="${booking.booking_status == 'WAITING_FOR_NOC' and booking.schedule_count < 1}">
&lt;!&ndash;th:if="${booking.booking_status == 'WAITING_FOR_NOC'}">&ndash;&gt;
<span class="badge bg-danger"
style="cursor: pointer;"
th:onclick="openRescheduleModal([[${booking.booking_id}]], [[${booking.start_date}]], [[${booking.end_date}]],[[${booking.no_of_days}]],
[[${booking.hall_details_hall_id}]],[[${booking.starting_slot}]],[[${booking.ending_slot}]],[[${booking.reason}]])">Reschedule
Booking</span>
</a>-->
</p>
<p th:case="'waitingfornocapproval'">
@ -731,6 +742,15 @@
[[${booking.hall_details_hall_id}]],[[${booking.starting_slot}]],[[${booking.ending_slot}]],[[${booking.reason}]])">Reschedule
Booking</span>
</a>
<a class="reschedule-button"
th:if="${booking.booking_status == 'WAITING_FOR_NOC'}">
<span class="badge bg-danger"
style="cursor: pointer;"
th:onclick="openRescheduleModal([[${booking.booking_id}]], [[${booking.start_date}]], [[${booking.end_date}]],[[${booking.no_of_days}]],
[[${booking.hall_details_hall_id}]],[[${booking.starting_slot}]],[[${booking.ending_slot}]],[[${booking.reason}]])">Reschedule
Booking</span>
</a>
</p>
</td>
@ -784,25 +804,29 @@
<tr>
<th colspan="10"
style="background-color: lightgrey;">
User Details</th>
User Details
</th>
</tr>
<tr>
<th
style="padding: 0.45rem 0.45rem;font-weight: normal;">
User Name:</th>
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>
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>
User Type:
</th>
<td class="fw-semibold"
style="padding: 0.45rem 0.45rem;"
id="td_usertype"></td>
@ -811,7 +835,8 @@
<tr>
<th
style="padding: 0.45rem 0.45rem;font-weight: normal;">
User Address:</th>
User Address:
</th>
<td colspan="5" class="fw-semibold"
style="padding: 0.45rem 0.45rem;text-wrap: pretty;"
id="td_useraddress"></td>
@ -823,13 +848,15 @@
<tr>
<th colspan="10"
style="background-color: lightgrey;">
Hall Details</th>
Hall Details
</th>
</tr>
<tr>
<th
style="padding: 0.45rem 0.45rem;font-weight: normal;">
Hall Name:</th>
Hall Name:
</th>
<td colspan="10" class="fw-semibold"
style="padding: 0.45rem 0.45rem;text-wrap:pretty;"
id="td_hallName"></td>
@ -837,7 +864,8 @@
</tr>
<th
style="padding: 0.45rem 0.45rem;font-weight: normal;">
Hall Address:</th>
Hall Address:
</th>
<td colspan="10" class="fw-semibold"
style="padding: 0.45rem 0.45rem;text-wrap: pretty;"
id="td_halladdress"></td>
@ -846,13 +874,15 @@
<tr>
<th
style="padding: 0.45rem 0.45rem;font-weight: normal;">
Caretaker Name:</th>
Caretaker Name:
</th>
<td colspan="2" class="fw-semibold"
style="padding: 0.45rem 0.45rem;"
id="td_caretakername"></td>
<th
style="padding: 0.45rem 0.45rem;font-weight: normal;">
Caretaker Mobile Number:</th>
Caretaker Mobile Number:
</th>
<td colspan="2" class="fw-semibold"
style="padding: 0.45rem 0.45rem;"
id="td_caretakermobileNumber"></td>
@ -864,18 +894,21 @@
Booking
Details (Booking Id:-<span
id="booking_id"
style="color:blue"></span>)</th>
style="color:blue"></span>)
</th>
</tr>
<tr>
<th
style="padding: 0.45rem 0.45rem;font-weight: normal">
Booking Date:</th>
Booking Date:
</th>
<td colspan="2" 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 (in Rs):</th>
Deposit Amount (in Rs):
</th>
<td colspan="2"
class="fw-semibold amount-cell"
style="padding: 0.45rem 0.45rem;"
@ -884,13 +917,15 @@
<tr>
<th
style="padding: 0.45rem 0.45rem;font-weight: normal">
Start Date:</th>
Start Date:
</th>
<td colspan="2" 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 (in Rs):</th>
Hall Amount (in Rs):
</th>
<td colspan="2"
class="fw-semibold amount-cell"
style="padding: 0.45rem 0.45rem;"
@ -899,13 +934,15 @@
<tr>
<th
style="padding: 0.45rem 0.45rem;font-weight: normal">
END Date:</th>
END Date:
</th>
<td colspan="2" 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% (in Rs):</th>
GST @18% (in Rs):
</th>
<td colspan="2"
class="fw-semibold amount-cell"
style="padding: 0.45rem 0.45rem;"
@ -914,13 +951,15 @@
<tr>
<th
style="padding: 0.45rem 0.45rem;font-weight: normal">
Starting Slot:</th>
Starting Slot:
</th>
<td colspan="2" 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 (in Rs):</th>
Total Amount (in Rs):
</th>
<td colspan="2"
class="fw-semibold amount-cell"
style="padding: 0.45rem 0.45rem;"
@ -929,7 +968,8 @@
<tr>
<th
style="padding: 0.45rem 0.45rem;font-weight: normal">
Ending Slot:</th>
Ending Slot:
</th>
<td colspan="2" class="fw-semibold"
style="padding: 0.45rem 0.45rem;"
id="td_endingSlot"></td>
@ -951,7 +991,8 @@
<tr>
<th style="display:none;padding: 0.45rem 0.45rem;border:none"
id="rejectionreasondiv">Rejection
Reason:</th>
Reason:
</th>
<td class="fw-semibold"
style="padding: 0.45rem 0.45rem;text-wrap: pretty;"
id="reasonforrejection"></td>
@ -971,12 +1012,14 @@
<tr>
<th colspan="10"
style="background-color: lightgrey;">
Booking Payment Details</th>
Booking Payment Details
</th>
</tr>
<tr>
<th
style="padding: 0.45rem 0.45rem;font-weight: normal;">
Transaction ID:</th>
Transaction ID:
</th>
<td colspan="10" class="fw-semibold"
style="padding: 0.45rem 0.45rem;"
id="td_transactionId"></td>
@ -984,7 +1027,8 @@
</tr>
<th
style="padding: 0.45rem 0.45rem;font-weight: normal;">
Amount Received (in Rs):</th>
Amount Received (in Rs):
</th>
<td colspan="10" class="fw-semibold"
style="padding: 0.45rem 0.45rem;"
id="td_payamountReceived"></td>
@ -993,7 +1037,8 @@
<tr>
<th
style="padding: 0.45rem 0.45rem;font-weight: normal;">
Transaction Status:</th>
Transaction Status:
</th>
<td class="fw-semibold"
style="padding: 0.45rem 0.45rem;"
id="td_paymentStatus"></td>
@ -1009,18 +1054,21 @@
<tr>
<th colspan="4"
style="background-color: lightgrey;">EB
Details</th>
Details
</th>
</tr>
<tr>
<th
style="padding: 0.45rem 0.45rem;font-weight: normal">
Consumer Number:</th>
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 (in Rs):</th>
EB Amount Per Unit (in Rs):
</th>
<td class="fw-semibold"
style="padding: 0.45rem 0.45rem;"
id="td_ebamountperunit"></td>
@ -1028,13 +1076,15 @@
<tr>
<th
style="padding: 0.45rem 0.45rem;font-weight: normal">
Start Reading:</th>
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">
Unit Consumed:</th>
Unit Consumed:
</th>
<td class="fw-semibold"
style="padding: 0.45rem 0.45rem;"
id="td_usedunit"></td>
@ -1042,13 +1092,15 @@
<tr>
<th
style="padding: 0.45rem 0.45rem;font-weight: normal">
END Reading:</th>
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">
EB Amount (in Rs):</th>
EB Amount (in Rs):
</th>
<td class="fw-semibold"
style="padding: 0.45rem 0.45rem;"
id="td_electricityamount"></td>
@ -1069,20 +1121,24 @@
<tr>
<th colspan="2"
style="background-color: lightgrey;">
Amount to be Refunded (in Rs) </th>
Amount to be Refunded (in Rs)
</th>
</tr>
<tr>
<th
style="padding: 0.45rem 0.45rem;font-weight: normal">
Deposit Amount:</th>
Deposit Amount:
</th>
<td class="fw-semibold amount-cell"
style="padding: 0.45rem 0.45rem;"
id="td_depositeamountforrefund">0</td>
id="td_depositeamountforrefund">0
</td>
</tr>
<tr>
<th
style="padding: 0.45rem 0.45rem;font-weight: normal">
EB Amount:</th>
EB Amount:
</th>
<td class="fw-semibold amount-cell"
style="padding: 0.45rem 0.45rem;"
id="td_ebAmount"></td>
@ -1090,7 +1146,8 @@
<tr>
<th
style="padding: 0.45rem 0.45rem;font-weight: normal">
Damage Amount:</th>
Damage Amount:
</th>
<td class="fw-semibold amount-cell"
style="padding: 0.45rem 0.45rem;"
id="td_damage"></td>
@ -1098,26 +1155,33 @@
<tr id="pendingcolumn">
<th id="th_settel_label"
style="padding: 0.45rem 0.45rem; background-color: #f2f2f2;font-weight: normal">
Collection Pending Amount:</th>
Collection Pending Amount:
</th>
<td class="fw-semibold amount-cell"
style="padding: 0.45rem 0.45rem; color: green;"
id="td_pending_amt">0</td>
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>
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>
<th
style="padding: 0.45rem 0.45rem; background-color: #f2f2f2;font-weight: normal">
Actual refundable Amount:</th>
Actual refundable Amount:
</th>
<td class="fw-semibold amount-cell"
style="padding: 0.45rem 0.45rem; color: green;"
id="td_settel_amt">0</td>
id="td_settel_amt">0
</td>
</tr>
</table>
</div>
@ -1130,18 +1194,21 @@
<tr>
<th colspan="4"
style="background-color: lightgrey;">
Refund Details</th>
Refund Details
</th>
</tr>
<tr>
<th
style="padding: 0.45rem 0.45rem;font-weight: normal">
Booking Status:</th>
Booking Status:
</th>
<td class="fw-semibold"
style="padding: 0.45rem 0.45rem;"
id="td_bookingStatus"></td>
<th
style="padding: 0.45rem 0.45rem;font-weight: normal">
Refund Status:</th>
Refund Status:
</th>
<td class="fw-semibold"
style="padding: 0.45rem 0.45rem;"
id="td_refundStatus"></td>
@ -1149,7 +1216,8 @@
<tr>
<th
style="padding: 0.45rem 0.45rem;font-weight: normal;text-wrap: pretty;">
Refund amount:</th>
Refund amount:
</th>
<td class="fw-semibold" colspan="5"
style="padding: 0.45rem 0.45rem;"
id="td_refundamount"></td>
@ -1172,6 +1240,46 @@
<h1 id="blockedrefundText"
style="font-size: 17px;margin-left: 20px;color: darkgreen;">
</h1>
</div>
<!--Newly added for Reschedule Details-->
<div class="row col-md-12 col-lg-12 col-sm-12"
id="rescheduleDetails"
style="display:none;margin-left: 0px;margin-top: -49px">
<div class="card-body">
<table>
<tr>
<th colspan="4"
style="background-color: lightgrey;">
Reschedule Details
</th>
</tr>
<tr>
<th
style="padding: 0.45rem 0.45rem;font-weight: normal">
Event Start Date:
</th>
<td class="fw-semibold"
style="padding: 0.45rem 0.45rem;"
id="td_res_start_date"></td>
<th
style="padding: 0.45rem 0.45rem;font-weight: normal">
Event End Date:
</th>
<td class="fw-semibold"
style="padding: 0.45rem 0.45rem;"
id="td_res_end_date"></td>
</tr>
<tr>
<th
style="padding: 0.45rem 0.45rem;font-weight: normal;text-wrap: pretty;">
Rescheduled Date:</th>
<td class="fw-semibold" colspan="5"
style="padding: 0.45rem 0.45rem;"
id="td_res_date"></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
@ -1181,11 +1289,13 @@
<button class="btn btn-success"
onclick="downloadAcknowledgment(event)"
style="background: #FB6340;">View
Aknowledgement</button>
Acknowledgement
</button>
<button type="button"
style="background-color: rgb(21,69,93);color: white;"
class="btn btn-sm btn-alt-secondary"
data-bs-dismiss="modal">Close</button>
data-bs-dismiss="modal">Close
</button>
</div>
</form>
</div>
@ -1213,7 +1323,8 @@
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary"
data-bs-dismiss="modal">Close</button>
data-bs-dismiss="modal">Close
</button>
</div>
</div>
</div>
@ -1372,7 +1483,8 @@
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary"
data-bs-dismiss="modal">Close</button>
data-bs-dismiss="modal">Close
</button>
<button type="button" class="btn btn-primary" id="submitNocButton">Submit</button>
</div>
</div>
@ -1430,7 +1542,8 @@
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary"
data-bs-dismiss="modal">Close</button>
data-bs-dismiss="modal">Close
</button>
</div>
</div>
</div>
@ -1531,7 +1644,6 @@
});
// Function to track booking
function trackBooking(bookingId) {
$.ajax({
@ -1704,6 +1816,7 @@
document.getElementById("td_endDate").innerHTML = response.endDate;
document.getElementById("booking_id").innerHTML = response.bookingId;
function getTimeSlot(slotValue) {
var timeSlot;
var trimmedSlotValue = String(slotValue).trim(); // Convert to string and then trim
@ -1785,8 +1898,7 @@
document.getElementById("td_refundStatus").innerHTML = response.refundStatus;
} else if (response.bookingStatus === 'REJECTED' && ['WAITING', 'APPROVED', 'INITIATED'].includes(response.refundStatus) && response.amountReceived == 0) {
document.getElementById("refundamountDetails").style.display = "none";
}
else if (response.bookingStatus === 'REJECTED' && ['WAITING', 'APPROVED', 'INITIATED'].includes(response.refundStatus)) {
} else if (response.bookingStatus === 'REJECTED' && ['WAITING', 'APPROVED', 'INITIATED'].includes(response.refundStatus)) {
document.getElementById("td_refundamount").innerHTML = `Your booking has been Rejected by GCC. Full amount of ₹ ${parseFloat(response.amountReceived).toFixed(2)} will be refunded shortly`;
document.getElementById("refundamountDetails").style.display = "block";
document.getElementById("td_bookingStatus").innerHTML = response.bookingStatus;
@ -1811,6 +1923,11 @@
document.getElementById("refundamountDetails").style.display = "block";
document.getElementById("td_bookingStatus").innerHTML = response.bookingStatus;
document.getElementById("td_refundStatus").innerHTML = response.refundStatus;
} else if(response.scheduleCount === 1){
document.getElementById("rescheduleDetails").style.display = "block";
document.getElementById("td_res_start_date").innerHTML = response.startDate;
document.getElementById("td_res_end_date").innerHTML = response.endDate;
document.getElementById("td_res_date").innerHTML = response.updatedDate;
} else {
document.getElementById("refundamountDetails").style.display = "none";
}
@ -1828,10 +1945,19 @@
damageFieldContainer.empty();
// Create a div for table responsiveness
var tableResponsiveDiv = $('<div>').addClass('table-responsive').css({'margin-top': '-19px', 'margin-left': '19px'});;
var tableResponsiveDiv = $('<div>').addClass('table-responsive').css({
'margin-top': '-19px',
'margin-left': '19px'
});
;
// 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>');
@ -1899,15 +2025,16 @@
}
function showDamageImage(damageImageUrl) {
document.getElementById('filePreview').src = damageImageUrl;
$('#fileModal').modal('show');
}
function showchallonimage(challanImgLink) {
document.getElementById('filePreview').src = challanImgLink;
$('#fileModal').modal('show');
}
function showReasonDocuments(list) {
$.ajax({
type: "GET",
@ -1930,7 +2057,10 @@
reasonFieldsContainer.empty();
// Create a responsive table container
var tableResponsiveDiv = $('<div>').addClass('table-responsive').css({'width': '729px', 'border': '1px solid black'});
var tableResponsiveDiv = $('<div>').addClass('table-responsive').css({
'width': '729px',
'border': '1px solid 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({
@ -1988,6 +2118,7 @@
function showDocumentImage(fileURL) {
openFileModal(fileURL);
}
// Event delegation for dynamically added elements
$(document).on('click', '.view-document', function () {
const fileURL = $(this).data('url');
@ -2042,6 +2173,7 @@
});
}
}
function openRescheduleModal(bookingId, startDate, endDate, noOfDays, hallId, startingSlot, endingSlot, reason) {
// Function to map slot values to their text representation
function getSlotText(slot) {
@ -2455,6 +2587,7 @@
document.getElementById('endDateInput').value = "";
}
}
function datepickerFormat(dateString) {
var dateObject = new Date(dateString);
var year = dateObject.getFullYear();
@ -2462,6 +2595,7 @@
var day = dateObject.getDate().toString().padStart(2, "0");
return `${year}-${month}-${day}`;
}
function printTables() {
// Get the printable content
var printableContent = document.getElementById('printableContent').innerHTML;
@ -2475,6 +2609,7 @@
printWindow.print();
printWindow.close();
}
function Reschedule() {
// Retrieve values from modal inputs
var bookingId = document.getElementById("bookingId").value;
@ -2581,6 +2716,7 @@
$(document).on('change', '.nocfile', function () {
validateFile(this);
});
function transactionHistory(userId) {
$.ajax({
type: "GET",

Loading…
Cancel
Save