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. 311
      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. 128
      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. 67
      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. 289
      src/main/resources/templates/admin/reports.html
  16. 4
      src/main/resources/templates/user/calculatehallamount.html
  17. 348
      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,

311
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;
@ -232,24 +233,24 @@ public class UserAPIController {
)
//SendOTP
@GetMapping(value = "/sendOTP")
public String sendOtp(HttpServletRequest request, @RequestParam Long mobileNo,@RequestParam String purpose) {
public String sendOtp(HttpServletRequest request, @RequestParam Long mobileNo, @RequestParam String purpose) {
Long MobileNo=mobileNo;
Long MobileNo = mobileNo;
//System.out.println(purpose);
//System.out.print("\n MobileNo---:"+mobileNo);
Random rand = new Random();
// int otp = rand.nextInt(90000) + 10000;
int otp = 11111;
System.out.print("\n otp---:"+otp);
System.out.print("\n otp---:" + otp);
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("dd-MMM-yyyy%20HH:mm");
LocalDateTime now = LocalDateTime.now();
//System.out.println(dtf.format(now));
String key="pfTEYN6H";
String generatedToken = "Welcome to GCC! Your OTP for GCC Community Centre is "+otp;
String urlString = "https://tmegov.onex-aura.com/api/sms?key=pfTEYN6H&to="+mobileNo+"&from=GCCCRP&body=Welcome to GCC! Your OTP for GCC Community Centre booking is "+otp+"&entityid=1401572690000011081&templateid=1407172346444550398";
String key = "pfTEYN6H";
String generatedToken = "Welcome to GCC! Your OTP for GCC Community Centre is " + otp;
String urlString = "https://tmegov.onex-aura.com/api/sms?key=pfTEYN6H&to=" + mobileNo + "&from=GCCCRP&body=Welcome to GCC! Your OTP for GCC Community Centre booking is " + otp + "&entityid=1401572690000011081&templateid=1407172346444550398";
System.out.println(urlString);
System.out.println("\n urlString---: "+urlString);
String bodyMessage = ""+otp;
System.out.println("\n urlString---: " + urlString);
String bodyMessage = "" + otp;
/*try {
RestTemplate restTemplate = new RestTemplate();
String Response = restTemplate.getForObject(urlString, String.class);
@ -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;
@ -280,7 +280,7 @@ public class UserAPIController {
)
//VerifyOTP
@GetMapping(value = "/verifyOTP")
public String verifyOtp(HttpServletRequest request, @RequestParam String otp,@RequestParam long mobileNo) {
public String verifyOtp(HttpServletRequest request, @RequestParam String otp, @RequestParam long mobileNo) {
HttpSession session = request.getSession();
try {
Integer session_otp = (Integer) session.getAttribute("otp");
@ -290,7 +290,7 @@ public class UserAPIController {
if (session_otp != null && session_otp.equals(entered_otp)) {
System.out.println("Entered OTP Correct user API");
Users user = userservice.findByMobileno(mobileNo);
if(user!=null) {
if (user != null) {
userSession.setMobileno(user.getMobileNo());
//userSession.setUserType(user.getUserType());
userSession.setDispayName(user.getName());
@ -303,9 +303,9 @@ public class UserAPIController {
} else {
System.out.println("Incorrect OTP. Please enter correct OTPs.");
session.setAttribute("user","");
session.setAttribute("user", "");
session.setAttribute("mobileNo", "");
session.setAttribute("id","");
session.setAttribute("id", "");
session.setAttribute("verifiedotp", "error");
return "Error";
}
@ -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);
@ -434,10 +434,10 @@ public class UserAPIController {
)
//Getting the Past Data from the Calendar
@GetMapping("/getPastData")
public List<BookingCalendar> getPastData(@RequestParam("hall_id") int hall_id){
public List<BookingCalendar> getPastData(@RequestParam("hall_id") int hall_id) {
List<BookingCalendar> data = new ArrayList();
data = bookingService.getPastData(hall_id);
if(data!=null) {
if (data != null) {
return data;
}
return data;
@ -452,7 +452,7 @@ public class UserAPIController {
public PensionerDetailsResponse getPensionerDetails(@RequestParam("pensionerId") String pensionerId) {
//System.out.println(pensionerId);
RestTemplate restTemplate = new RestTemplate();
String url = "https://erp.chennaicorporation.gov.in/pgr/external/mobileservice?serviceId=getPensionerDetailsList&pensionerId="+pensionerId;
String url = "https://erp.chennaicorporation.gov.in/pgr/external/mobileservice?serviceId=getPensionerDetailsList&pensionerId=" + pensionerId;
ResponseEntity<String> responseEntity = restTemplate.getForEntity(url, String.class);
@ -486,7 +486,7 @@ public class UserAPIController {
public EmployeeDetailsResponse getEmployeeDetails(@RequestParam("employeeId") Long employeeId) {
//System.out.println("Employee ID:"+employeeId);
RestTemplate restTemplate = new RestTemplate();
String url = "https://erp.chennaicorporation.gov.in/pgr/external/mobileservice?serviceId=getEmployeeDetail&EmployeeID="+employeeId;
String url = "https://erp.chennaicorporation.gov.in/pgr/external/mobileservice?serviceId=getEmployeeDetail&EmployeeID=" + employeeId;
ResponseEntity<String> responseEntity = restTemplate.getForEntity(url, String.class);
@ -520,7 +520,7 @@ public class UserAPIController {
@GetMapping("/FamilyPensionerDetail")
public FamilyPensionerDetailsResponse getFamilyPensionerDetails(@RequestParam("id") Long id) {
RestTemplate restTemplate = new RestTemplate();
String url = "https://erp.chennaicorporation.gov.in/pgr/external/mobileservice?serviceId=getFamPensionerDetailsList&familPensionId="+id;
String url = "https://erp.chennaicorporation.gov.in/pgr/external/mobileservice?serviceId=getFamPensionerDetailsList&familPensionId=" + id;
ResponseEntity<String> responseEntity = restTemplate.getForEntity(url, String.class);
@ -562,7 +562,7 @@ public class UserAPIController {
details.put("longitude", hallDetails.getLongitude());
details.put("hallId", String.valueOf(hallDetails.getHallId()));
details.put("hallName", hallDetails.getHallName());
details.put("seatingCapacity",String.valueOf(hallDetails.getSeatingCapacity()) );
details.put("seatingCapacity", String.valueOf(hallDetails.getSeatingCapacity()));
details.put("parkingCapacity", hallDetails.getParkingCapacity());
details.put("hallImage", hallDetails.getHallImagesList());
details.put("fullDayRent", hallDetails.getFullDayRent());
@ -585,7 +585,7 @@ public class UserAPIController {
public String CheckbookingLimitation(Model model) {
int userId = userSession.getUserId();
Users userById = userService.getUserById(userId);
if(userById!=null && userById.getUserstatus()==Users.userStatus.PENDING) {
if (userById != null && userById.getUserstatus() == Users.userStatus.PENDING) {
return "pending";
}
if (userById != null && userById.getUserstatus() == Users.userStatus.REJECTED) {
@ -671,7 +671,7 @@ public class UserAPIController {
@GetMapping(value = "/getZoneNo")
public String getZoneNo() {
String urlString = appConfig.getErpUrl()+"serviceId=getZones";
String urlString = appConfig.getErpUrl() + "serviceId=getZones";
ResponseEntity<String> response = null;
RestTemplate restTemplate = new RestTemplate();
String bodyMessage = "";
@ -696,7 +696,7 @@ public class UserAPIController {
// Rest Api From ERP for getting Divisions
@GetMapping(value = "/getDiv")
public String getDiv(@RequestParam String zoneId) {
String urlString = appConfig.getErpUrl()+"serviceId=getWards&Zoneid="+zoneId+"";
String urlString = appConfig.getErpUrl() + "serviceId=getWards&Zoneid=" + zoneId + "";
ResponseEntity<String> response = null;
RestTemplate restTemplate = new RestTemplate();
String bodyMessage = "";
@ -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 {
@ -917,8 +934,8 @@ public class UserAPIController {
@RequestParam(value = "area", required = false) String area,
@RequestParam(value = "location", required = false) String location,
@RequestParam(value = "usertype", required = false) String userType,
@RequestParam(value="pinCode", required = false) int pinCode,
@RequestParam(value="email", required = false) String email,
@RequestParam(value = "pinCode", required = false) int pinCode,
@RequestParam(value = "email", required = false) String email,
@RequestParam(value = "profilephoto", required = false) MultipartFile profilephoto) {
Users userDetails = new Users();
@ -969,8 +986,8 @@ public class UserAPIController {
)
//Retrive user details for counter
@GetMapping("/getuserforcounter")
public ResponseEntity<?> getCounterUserById(@RequestParam int userId){
if(userId == 0) {
public ResponseEntity<?> getCounterUserById(@RequestParam int userId) {
if (userId == 0) {
userId = userSession.getUserId();
// System.out.println("User ID retrieved from session: " + userId);
} else {
@ -978,7 +995,7 @@ public class UserAPIController {
}
Users user = userService.getUserById(userId);
if(user == null) {
if (user == null) {
return ResponseEntity.status(HttpStatus.NOT_FOUND).body("User not found");
}
return ResponseEntity.ok(user);
@ -996,7 +1013,7 @@ public class UserAPIController {
}
Users user = userService.getUserById(userId);
Map<String, Object> response = new HashMap<>();
response.put("userId",user.getUserId());
response.put("userId", user.getUserId());
response.put("name", user.getName());
response.put("email", user.getEmail());
response.put("mobileNo", user.getMobileNo());
@ -1027,15 +1044,15 @@ public class UserAPIController {
description = "REST API to Save the Booking Details"
)
//APi for Saving the Booking Details
@PostMapping(path = "/saveTheRequest2", consumes = { "multipart/form-data" })
@PostMapping(path = "/saveTheRequest2", consumes = {"multipart/form-data"})
public ResponseEntity<?> saveTheBookingDetails2(HttpServletRequest request) {
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
Map<String,Object> bookingDetails = splitFormData(multipartRequest);
Map<String, Object> bookingDetails = splitFormData(multipartRequest);
Map<String, Object> saveBookingDetails = bookingService.saveBookingDetails(bookingDetails);
return ResponseEntity.ok(saveBookingDetails);
}
public Map<String,Object> splitFormData(MultipartHttpServletRequest multipartRequest){
public Map<String, Object> splitFormData(MultipartHttpServletRequest multipartRequest) {
Map<String, Object> formData = new HashMap<>();
// Iterate through the request parameters
@ -1067,7 +1084,7 @@ public class UserAPIController {
)
//retrieving the Booking Details BY Booking ID
@GetMapping("/getBooking")
public ResponseEntity<?> getBookingByID(@RequestParam int bookingId){
public ResponseEntity<?> getBookingByID(@RequestParam int bookingId) {
return ResponseEntity.ok(bookingService.getBookingsById(bookingId));
}
@ -1077,24 +1094,24 @@ public class UserAPIController {
)
//Booking Cancelling by BookingId
//Booking Cancelling by BookingId
@GetMapping("/cancelBookingbyId")
@GetMapping("/cancelBookingbyId")
public ResponseEntity<?> cancelBooking(@RequestParam int bookingId,
@RequestParam BookingDetails.BookingStatus status,
@RequestParam String comments) {
log.info("Received request to cancel booking with ID: {}");
log.info("Status: {}, Comments: {}");
Optional<BookingDetails> bookings=bookingDetailsRepository.findById(bookingId);
BookingDetails bookingDetails=bookings.get();
Optional<BookingDetails> bookings = bookingDetailsRepository.findById(bookingId);
BookingDetails bookingDetails = bookings.get();
try {
BookingDetails cancelledBooking = bookingService.updateCancelledBookingStatus(bookingId, status, comments);
String cancelledbookingsms="Your booking ID "+bookingId+" on "+bookingDetails.getStartDate()+" has been cancelled successfully. The deposit amount will be refunded to your account within 3 to 15 days. Thanks for using the GCC Community Hall Booking System.";
String cancelledurlString ="https://tmegov.onex-aura.com/api/sms?key=pfTEYN6H&to="+bookingDetails.getUsers().getMobileNo()+"&from=GCCCRP&body="+cancelledbookingsms+"&entityid=1401572690000011081&templateid=1407172346829376988";
String cancelledwhatsupmsg = "https://media.smsgupshup.com/GatewayAPI/rest?userid=2000233507&password=h2YjFNcJ&send_to="+bookingDetails.getUsers().getMobileNo()+"&v=1.1&format=json&msg_type=TEXT&method=SENDMESSAGE&msg=Your+booking+with+ID+"+bookingId+"+on+"+bookingDetails.getStartDate()+"+has+been+cancelled+successfully.+%0AThe+deposit+amount+will+be+refunded+to+your+account+within+3+to+15+days.";
String cancelledbookingsms = "Your booking ID " + bookingId + " on " + bookingDetails.getStartDate() + " has been cancelled successfully. The deposit amount will be refunded to your account within 3 to 15 days. Thanks for using the GCC Community Hall Booking System.";
String cancelledurlString = "https://tmegov.onex-aura.com/api/sms?key=pfTEYN6H&to=" + bookingDetails.getUsers().getMobileNo() + "&from=GCCCRP&body=" + cancelledbookingsms + "&entityid=1401572690000011081&templateid=1407172346829376988";
String cancelledwhatsupmsg = "https://media.smsgupshup.com/GatewayAPI/rest?userid=2000233507&password=h2YjFNcJ&send_to=" + bookingDetails.getUsers().getMobileNo() + "&v=1.1&format=json&msg_type=TEXT&method=SENDMESSAGE&msg=Your+booking+with+ID+" + bookingId + "+on+" + bookingDetails.getStartDate() + "+has+been+cancelled+successfully.+%0AThe+deposit+amount+will+be+refunded+to+your+account+within+3+to+15+days.";
whatsappMsgServiceImpl.sendMsg(cancelledwhatsupmsg);
whatsappMsgServiceImpl.sendSMS(cancelledurlString);
Optional<BookingDetails> book=bookingDetailsRepository.findById(bookingDetails.getBookingId());
BookingDetails booking=book.get();
Optional<BookingDetails> book = bookingDetailsRepository.findById(bookingDetails.getBookingId());
BookingDetails booking = book.get();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
String formattedDate = LocalDateTime.now().format(formatter);
booking.setUpdatedDate(formattedDate);
@ -1106,7 +1123,7 @@ public class UserAPIController {
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
.body("Error cancelling booking: " + e.getMessage());
}
}
}
@Operation(
summary = "Family Pensioner Details from ERP REST API",
@ -1187,9 +1204,9 @@ public class UserAPIController {
//Long mobileNo = 8220798933l;
//System.out.println("step 1");
responseMap.put("EmployeeDetailsResult", employeeDetails );
}else {
responseMap.put("EmployeeDetailsResult", null );
responseMap.put("EmployeeDetailsResult", employeeDetails);
} else {
responseMap.put("EmployeeDetailsResult", null);
}
}
} catch (IOException e) {
@ -1251,99 +1268,94 @@ public class UserAPIController {
description = "REST API to save the Counter Details"
)
//Saving the Counter Details
@PostMapping(path = "/counter-booking", consumes = { "multipart/form-data" })
@PostMapping(path = "/counter-booking", consumes = {"multipart/form-data"})
public ResponseEntity<?> saveCounterBookingDetails(HttpServletRequest request) {
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
Map<String,Object> bookingDetails = splitFormData(multipartRequest);
Map<String, Object> bookingDetails = splitFormData(multipartRequest);
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,
@RequestParam("starting") String starting,
@RequestParam("ending") String ending,
@RequestParam(name = "hallId",required = false) String hallId){
@RequestParam(name = "hallId", required = false) String hallId) {
List<BookingCalendar> data = new ArrayList<>();
HashSet<Integer> removeHallId = new HashSet<Integer>();
int hallIdd=0;
if(hallId != null && !hallId.equals("")){
int hallIdd = 0;
if (hallId != null && !hallId.equals("")) {
hallIdd = Integer.parseInt(hallId);
}
if(!fromDate.equals(toDate) && (starting.equals(ending) || starting.equals("evening") && ending.equals("morning"))){
Map<String,String> mp =incrementAndDecrementAndDaysCount(fromDate,toDate);
long noOfDays= Long.parseLong(mp.get("NoOfDays").toString());
if(noOfDays>2){
data = calendarService.getCalendarByDateAndHallIdAndSlot(mp.get("fromDate"),mp.get("toDate"),starting,ending,hallIdd);
for(int i=0;i<data.size();i++){
if (!fromDate.equals(toDate) && (starting.equals(ending) || starting.equals("evening") && ending.equals("morning"))) {
Map<String, String> mp = incrementAndDecrementAndDaysCount(fromDate, toDate);
long noOfDays = Long.parseLong(mp.get("NoOfDays").toString());
if (noOfDays > 2) {
data = calendarService.getCalendarByDateAndHallIdAndSlot(mp.get("fromDate"), mp.get("toDate"), starting, ending, hallIdd);
for (int i = 0; i < data.size(); i++) {
removeHallId.add(data.get(i).getHallId());
}
}
}
data=calendarService.getCalendarByDateAndHallIdAndSlot(fromDate,toDate,starting,ending,hallIdd);
data = calendarService.getCalendarByDateAndHallIdAndSlot(fromDate, toDate, starting, ending, hallIdd);
//System.out.println("data size :-"+data.size());
if(starting!=null && ending != null ) {
boolean checkAvail =false;
int checkHallId=0;
for(int i=0;i<data.size();i++) {
if (starting != null && ending != null) {
boolean checkAvail = false;
int checkHallId = 0;
for (int i = 0; i < data.size(); i++) {
if((starting.equals("evening") || ending.equals("morning")) && fromDate.equals(data.get(i).getBdate().toString()) && toDate.equals(fromDate)) {
if(data.get(i).isEveningSlot()==false) {
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)) {
if(checkHallId==0 || checkHallId != data.get(i).getHallId()){
if (checkHallId == 0 || checkHallId != data.get(i).getHallId()) {
checkHallId = data.get(i).getHallId();
checkAvail=false;
checkAvail = false;
}
if(starting.equals("morning") && ending.equals("morning") ) {
if(fromDate.equals(data.get(i).getBdate().toString()) && data.get(i).isMorningSlot()==false){
if(checkHallId == data.get(i).getHallId()){
if (starting.equals("morning") && ending.equals("morning")) {
if (fromDate.equals(data.get(i).getBdate().toString()) && data.get(i).isMorningSlot() == false) {
if (checkHallId == data.get(i).getHallId()) {
continue;
}
}
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();
} 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;
}
}
}else if(starting.equals("evening") && ending.equals("morning") ) {
} else if (starting.equals("evening") && ending.equals("morning")) {
if(fromDate.equals(data.get(i).getBdate().toString()) && data.get(i).isEveningSlot()==false){
if(checkHallId == data.get(i).getHallId()){
if (fromDate.equals(data.get(i).getBdate().toString()) && data.get(i).isEveningSlot() == false) {
if (checkHallId == data.get(i).getHallId()) {
continue;
}
}
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();
} 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;
}
}
}else if(starting.equals("evening") && ending.equals("evening") ) {
if(fromDate.equals(data.get(i).getBdate().toString()) && data.get(i).isEveningSlot()==false){
if(checkHallId == data.get(i).getHallId()){
} else if (starting.equals("evening") && ending.equals("evening")) {
if (fromDate.equals(data.get(i).getBdate().toString()) && data.get(i).isEveningSlot() == false) {
if (checkHallId == data.get(i).getHallId()) {
continue;
}
}
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();
} 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{
if(checkHallId == data.get(i).getHallId()) {
} else {
if (checkHallId == data.get(i).getHallId()) {
checkAvail = true;
}
}
@ -1353,37 +1365,37 @@ public class UserAPIController {
}
}
List<HallDetails> removeHallByid = new ArrayList<>();
if(hallIdd!=0){
if(hallIdd!=data.get(0).getHallId()){
if (hallIdd != 0) {
if (hallIdd != data.get(0).getHallId()) {
HallDetails hallDetails = hallDetailService.getHallById(hallIdd);
removeHallByid.add(hallDetails);
}
}else {
} else {
removeHallByid = hallDetailService.removeHallById(removeHallId);
}
return removeHallByid;
}
Map<String,String> incrementAndDecrementAndDaysCount(String fromdate, String todate){
Map<String, String> incrementAndDecrementAndDaysCount(String fromdate, String todate) {
Map mp = new HashMap<>();
LocalDate increasement = LocalDate.parse(fromdate);
LocalDate decrement = LocalDate.parse(todate);
LocalDate outputDateFrom =increasement;
LocalDate outputDateFrom = increasement;
LocalDate outputDateToday = decrement;
long daysDifference = increasement.until(decrement).getDays();
daysDifference = Math.abs(daysDifference);
if(fromdate!=todate) {
if (fromdate != todate) {
outputDateFrom = increasement.plusDays(1);
outputDateToday = decrement.minusDays(1);
}
mp.put("fromDate", outputDateFrom.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
mp.put("toDate",outputDateToday.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
mp.put("NoOfDays",daysDifference+"");
mp.put("toDate", outputDateToday.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
mp.put("NoOfDays", daysDifference + "");
return mp;
}
@ -1475,7 +1487,7 @@ public class UserAPIController {
Map<String, Object> settlementRaisingDetail = new HashMap<>();
settlementRaisingDetail.put("status", "SETTLEMENT_RAISING");
settlementRaisingDetail.put("description", "Settlement Raising");
settlementRaisingDetail.put("dateTime", bookingDetails.getSettlement().getUpdatedDate() );
settlementRaisingDetail.put("dateTime", bookingDetails.getSettlement().getUpdatedDate());
trackingDetails.add(settlementRaisingDetail);
}
@ -1490,9 +1502,9 @@ public class UserAPIController {
}
if (bookingDetails.getBookingStatus() == BookingStatus.CANCELED){
Map<String ,Object> bookingCanceledDetail = new HashMap<>();
bookingCanceledDetail.put("status","CANCELED");
if (bookingDetails.getBookingStatus() == BookingStatus.CANCELED) {
Map<String, Object> bookingCanceledDetail = new HashMap<>();
bookingCanceledDetail.put("status", "CANCELED");
bookingCanceledDetail.put("description", "Booking Cancelled");
bookingCanceledDetail.put("dateTime", bookingDetails.getUpdatedDate()); // Assuming BookingDate is correct
trackingDetails.add(bookingCanceledDetail);
@ -1500,16 +1512,16 @@ public class UserAPIController {
if (bookingDetails.getBookingStatus() == BookingStatus.CANCELED
&& bookingDetails.getRefundStatus() == RefundStatus.WAITING){
Map<String ,Object> canceledRaisingDetail = new HashMap<>();
canceledRaisingDetail.put("status","SETTLEMENT_RAISING");
&& bookingDetails.getRefundStatus() == RefundStatus.WAITING) {
Map<String, Object> canceledRaisingDetail = new HashMap<>();
canceledRaisingDetail.put("status", "SETTLEMENT_RAISING");
canceledRaisingDetail.put("description", "Settlement Raising");
canceledRaisingDetail.put("dateTime", bookingDetails.getUpdatedDate()); // Assuming BookingDate is correct
trackingDetails.add(canceledRaisingDetail);
}
if (bookingDetails.getBookingStatus() == BookingStatus.CANCELED
&& bookingDetails.getRefundStatus() == BookingDetails.RefundStatus.COMPLETED){
&& bookingDetails.getRefundStatus() == BookingDetails.RefundStatus.COMPLETED) {
Map<String, Object> cancelRefundCompletedDetail = new HashMap<>();
cancelRefundCompletedDetail.put("status", "COMPLETED");
cancelRefundCompletedDetail.put("description", "Refund Completed");
@ -1517,9 +1529,9 @@ public class UserAPIController {
trackingDetails.add(cancelRefundCompletedDetail);
}
if (bookingDetails.getBookingStatus() == BookingStatus.REJECTED){
Map<String ,Object> bookingRejectedDetail = new HashMap<>();
bookingRejectedDetail.put("status","REJECTED");
if (bookingDetails.getBookingStatus() == BookingStatus.REJECTED) {
Map<String, Object> bookingRejectedDetail = new HashMap<>();
bookingRejectedDetail.put("status", "REJECTED");
bookingRejectedDetail.put("description", "Booking Rejected");
bookingRejectedDetail.put("dateTime", bookingDetails.getUpdatedDate()); // Assuming BookingDate is correct
trackingDetails.add(bookingRejectedDetail);
@ -1527,16 +1539,16 @@ public class UserAPIController {
if (bookingDetails.getBookingStatus() == BookingStatus.REJECTED
&& bookingDetails.getRefundStatus() == RefundStatus.WAITING){
Map<String ,Object> rejectedRaisingDetail = new HashMap<>();
rejectedRaisingDetail.put("status","SETTLEMENT_RAISING");
&& bookingDetails.getRefundStatus() == RefundStatus.WAITING) {
Map<String, Object> rejectedRaisingDetail = new HashMap<>();
rejectedRaisingDetail.put("status", "SETTLEMENT_RAISING");
rejectedRaisingDetail.put("description", "Settlement Raising");
rejectedRaisingDetail.put("dateTime", bookingDetails.getUpdatedDate()); // Assuming BookingDate is correct
trackingDetails.add(rejectedRaisingDetail);
}
if (bookingDetails.getBookingStatus() == BookingStatus.REJECTED
&& bookingDetails.getRefundStatus() == BookingDetails.RefundStatus.COMPLETED){
&& bookingDetails.getRefundStatus() == BookingDetails.RefundStatus.COMPLETED) {
Map<String, Object> rejectedRefundCompletedDetail = new HashMap<>();
rejectedRefundCompletedDetail.put("status", "COMPLETED");
rejectedRefundCompletedDetail.put("description", "Refund Completed");
@ -1545,10 +1557,9 @@ public class UserAPIController {
}
if (bookingDetails.getBookingStatus() == BookingStatus.GCC_BLOCKED){
Map<String ,Object> gccBlockedDetail = new HashMap<>();
gccBlockedDetail.put("status","GCC_BLOCKED");
if (bookingDetails.getBookingStatus() == BookingStatus.GCC_BLOCKED) {
Map<String, Object> gccBlockedDetail = new HashMap<>();
gccBlockedDetail.put("status", "GCC_BLOCKED");
gccBlockedDetail.put("description", "GCC Blocked");
gccBlockedDetail.put("dateTime", bookingDetails.getUpdatedDate());
trackingDetails.add(gccBlockedDetail);
@ -1559,8 +1570,8 @@ public class UserAPIController {
@GetMapping("/confirmstatebooking")
public String Confirmstatebookig(@RequestParam int bookingId ) {
String response=bookingService.confirmStateBooking(bookingId);
public String Confirmstatebookig(@RequestParam int bookingId) {
String response = bookingService.confirmStateBooking(bookingId);
return response;
}
@ -1734,22 +1745,22 @@ public class UserAPIController {
response.put("amount", amount);
response.put("totalAmount", totalAmount);
response.put("depositAmount", totalDepositAmount);
double gstValue =gstRate * amount / 100.0;
double gstValue = gstRate * amount / 100.0;
response.put("gst", gstValue);
response.put("discountAmount", amount);
} else {
if ("SGE".equals(reasonforBooking)) {
double cleaningCharges = hallDetails.getHallDetailsConcession().get(0).getFullDayCleaningcharges();
double pasystem=hallDetails.getHallDetailsConcession().get(0).getFulldayPAsystem();
double ebCharges=hallDetails.getHallDetailsConcession().get(0).getFulldayEBcharges();
double pasystem = hallDetails.getHallDetailsConcession().get(0).getFulldayPAsystem();
double ebCharges = hallDetails.getHallDetailsConcession().get(0).getFulldayEBcharges();
double halfcleaningCharges = hallDetails.getHallDetailsConcession().get(0).getHalfDayCleaningcharges();
double halfpasystem=hallDetails.getHallDetailsConcession().get(0).getHalfdayPAsystem();
double halfebCharges=hallDetails.getHallDetailsConcession().get(0).getHalfdayEBcharges();
double fulladditionalCharges = cleaningCharges+pasystem+ebCharges;
double halfadditionalCharges = halfcleaningCharges+halfpasystem+halfebCharges;
double fulldayhallAmount=hallDetails.getHallDetailsConcession().get(0).getFulldayhallamount();
double halfdayhallAmount=hallDetails.getHallDetailsConcession().get(0).getHalfdayhallamount();
double additionalCharges=calculateAmount(numDays, startPeriod, endPeriod, fulladditionalCharges, halfadditionalCharges);
double halfpasystem = hallDetails.getHallDetailsConcession().get(0).getHalfdayPAsystem();
double halfebCharges = hallDetails.getHallDetailsConcession().get(0).getHalfdayEBcharges();
double fulladditionalCharges = cleaningCharges + pasystem + ebCharges;
double halfadditionalCharges = halfcleaningCharges + halfpasystem + halfebCharges;
double fulldayhallAmount = hallDetails.getHallDetailsConcession().get(0).getFulldayhallamount();
double halfdayhallAmount = hallDetails.getHallDetailsConcession().get(0).getHalfdayhallamount();
double additionalCharges = calculateAmount(numDays, startPeriod, endPeriod, fulladditionalCharges, halfadditionalCharges);
totalAmount = additionalCharges + totalDepositAmount + (additionalCharges * gstRate / 100.0);
discountAmount = (fulldayhallAmount * hallDetails.getSGEdiscount()) / 100.0;
response.put("startperiod", startPeriod);
@ -1766,18 +1777,18 @@ public class UserAPIController {
response.put("discountAmount", discountAmount);
} else if ("CGE".equals(reasonforBooking)) {
double cleaningCharges = hallDetails.getHallDetailsConcession().get(0).getFullDayCleaningcharges();
double pasystem=hallDetails.getHallDetailsConcession().get(0).getFulldayPAsystem();
double ebCharges=hallDetails.getHallDetailsConcession().get(0).getFulldayEBcharges();
double pasystem = hallDetails.getHallDetailsConcession().get(0).getFulldayPAsystem();
double ebCharges = hallDetails.getHallDetailsConcession().get(0).getFulldayEBcharges();
double halfcleaningCharges = hallDetails.getHallDetailsConcession().get(0).getHalfDayCleaningcharges();
double halfpasystem=hallDetails.getHallDetailsConcession().get(0).getHalfdayPAsystem();
double halfebCharges=hallDetails.getHallDetailsConcession().get(0).getHalfdayEBcharges();
double fulladditionalCharges = cleaningCharges+pasystem+ebCharges;
double halfadditionalCharges = halfcleaningCharges+halfpasystem+halfebCharges;
double additionalCharges=calculateAmount(numDays, startPeriod, endPeriod, fulladditionalCharges, halfadditionalCharges);
double halfpasystem = hallDetails.getHallDetailsConcession().get(0).getHalfdayPAsystem();
double halfebCharges = hallDetails.getHallDetailsConcession().get(0).getHalfdayEBcharges();
double fulladditionalCharges = cleaningCharges + pasystem + ebCharges;
double halfadditionalCharges = halfcleaningCharges + halfpasystem + halfebCharges;
double additionalCharges = calculateAmount(numDays, startPeriod, endPeriod, fulladditionalCharges, halfadditionalCharges);
double rentAmount = (amount * hallDetails.getCGEdiscount()) / 100.0;
double netAmount = rentAmount + additionalCharges;
double gst = ((additionalCharges+rentAmount) * gstRate / 100.0);
totalAmount = Math.floor((netAmount + gst + totalDepositAmount) * 100) / 100.0 ;
double gst = ((additionalCharges + rentAmount) * gstRate / 100.0);
totalAmount = Math.floor((netAmount + gst + totalDepositAmount) * 100) / 100.0;
response.put("startperiod", startPeriod);
response.put("endPeriod", endPeriod);
response.put("fulldayhallAmount", fullDayAmount);
@ -1791,7 +1802,7 @@ public class UserAPIController {
response.put("totalAmount", totalAmount);
response.put("discountAmount", discountAmount);
} else {
double gstValue =(gstRate * amount) / 100.0;
double gstValue = (gstRate * amount) / 100.0;
totalAmount = Math.ceil((amount + gstValue + totalDepositAmount) * 100) / 100;
response.put("discount", 0);
response.put("amount", amount);
@ -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;
@ -1815,8 +1827,8 @@ public class UserAPIController {
amount = halfDayAmount;
} else if ("2".equals(startPeriod) && "2".equals(endPeriod)) {
amount = halfDayAmount;
}else {
amount=numDays;
} else {
amount = numDays;
}
} else {
// For multiple days
@ -1828,8 +1840,8 @@ public class UserAPIController {
amount = fullDayAmount * (numDays - 1) + halfDayAmount;
} else if ("2".equals(startPeriod) && "1".equals(endPeriod)) {
amount = fullDayAmount * (numDays - 2) + halfDayAmount * 2;
}else {
amount=numDays;
} else {
amount = numDays;
}
}
@ -1856,10 +1868,10 @@ public class UserAPIController {
@GetMapping("/collectionpendingacknowledgementsss")
public BookingDetails viewCollectionpendingAck(Model model,int bookingId){
public BookingDetails viewCollectionpendingAck(Model model, int bookingId) {
BookingDetails bookingsDetails = bookingService.getBookingsById(bookingId);
model.addAttribute("bookingsDetails",bookingsDetails); // Add single BookingDetails object
model.addAttribute("userName",userSession.getDispayName());
model.addAttribute("bookingsDetails", bookingsDetails); // Add single BookingDetails object
model.addAttribute("userName", userSession.getDispayName());
return bookingsDetails;
}
@ -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 +
'}';
}
}

128
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,7 +67,10 @@ public class PaymentStatusScheduler {
@Autowired
private PaymentGatewayServiceImpl paymentGatewayServiceImpl;
// @Scheduled(cron = "0 0 0 * * ?", zone = "Asia/Kolkata") //executed at 12:00 AM
@Autowired
private CalendarService calendarService;
// @Scheduled(cron = "0 0 0 * * ?", zone = "Asia/Kolkata") //executed at 12:00 AM
// @Scheduled(fixedRate = 900000)
@Scheduled(fixedRate = 30000)
public void fetchAndSavePaymentStatus() {
@ -93,7 +95,7 @@ public class PaymentStatusScheduler {
transaction.put("token", "");
transaction.put("reference", "");
System.out.println("====================================="+ transactionRecord.get("txansaction_id"));
System.out.println("=====================================" + transactionRecord.get("txansaction_id"));
System.out.println(merchant);
System.out.println(transaction);
System.out.println(status);
@ -107,7 +109,7 @@ public class PaymentStatusScheduler {
String[] dateParts = dateParts1[0].split("-");
String formattedDate = dateParts[2] + "-" + dateParts[1] + "-" + dateParts[0];
transaction.put("dateTime", formattedDate);
System.out.println("formattedDate"+formattedDate);
System.out.println("formattedDate" + formattedDate);
} else {
transaction.put("dateTime", "");
}
@ -115,7 +117,7 @@ public class PaymentStatusScheduler {
Gson gson = new Gson();
String json = gson.toJson(status);
System.out.println("Hello json "+json);
System.out.println("Hello json " + json);
String encryptHxRefund = paymentGatewayService.encryptHxRefund(json);
RestTemplate restTemplate = new RestTemplate();
@ -124,12 +126,12 @@ public class PaymentStatusScheduler {
String decryptHxTRefund = paymentGatewayService.decryptHxTRefund(postForEntity.getBody());
Map<String, Object> myObj = new ObjectMapper().readValue(decryptHxTRefund, Map.class);
Map<String, Object> paymentMethod = (Map<String, Object>)myObj.get("paymentMethod");
Map<String, Object> response = (Map<String, Object>)paymentMethod.get("paymentTransaction");
Map<String, Object> paymentMethod = (Map<String, Object>) myObj.get("paymentMethod");
Map<String, Object> response = (Map<String, Object>) paymentMethod.get("paymentTransaction");
System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
System.out.println("hello2" + response);
System.out.println("hello "+myObj);
System.out.println("hello " + myObj);
System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
TransactionStatusLog log = new TransactionStatusLog();
@ -163,8 +165,8 @@ public class PaymentStatusScheduler {
Payments payments = paymentsRepository.findByBookingId(Integer.valueOf(String.valueOf(transRes.getBookingId())));
System.out.println("payments hello"+payments);
if(payments!=null && response.get("statusCode").toString().equals("0300")) {
System.out.println("payments hello" + payments);
if (payments != null && response.get("statusCode").toString().equals("0300")) {
// payments.setBookingDetails(payments.getBookingDetails());
payments.setTransactionId(transRes.getTxansactionId());
@ -175,9 +177,9 @@ public class PaymentStatusScheduler {
//paymentsRepository.updatePaymentInfo(payments.getPaymentId(),payments.getTransactionId(),payments.getAmountReceived(),payments.getPaymentStatus(),transRes.getBookingId());
bookingService.updateBookingStatus(transRes.getBookingId(), BookingDetails.BookingStatus.REFUNDED, "Booking Not Confirmed. Amount will be refunded shortly.");
intiateRefund(transRes.getBookingId(),Integer.parseInt(transRes.getUserId()));
intiateRefund(transRes.getBookingId(), Integer.parseInt(transRes.getUserId()));
}else if(response.get("statusCode").toString().equals("0300")){
} else if (response.get("statusCode").toString().equals("0300")) {
payments = new Payments();
@ -191,13 +193,12 @@ public class PaymentStatusScheduler {
//paymentsRepository.insertPaymentinfo(payments.getPaymentId(),payments.getTransactionId(),payments.getAmountReceived(),payments.getPaymentStatus(),transRes.getBookingId(),payments.getCdate() );
bookingService.updateBookingStatus(transRes.getBookingId(), BookingDetails.BookingStatus.REFUNDED, "Booking Not Confirmed. Amount will be refunded shortly.");
intiateRefund(transRes.getBookingId(),Integer.parseInt(transRes.getUserId()));
}
else{
intiateRefund(transRes.getBookingId(), Integer.parseInt(transRes.getUserId()));
} 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);
@ -205,7 +206,7 @@ public class PaymentStatusScheduler {
}
updateRefundInfo(response,log);
updateRefundInfo(response, log);
} catch (Exception ex) {
System.err.println("Error processing transaction record: " + ex.getMessage());
@ -221,26 +222,31 @@ public class PaymentStatusScheduler {
}
public void updateRefundInfo(Map<String,Object> response,TransactionStatusLog log){
public void updateRefundInfo(Map<String, Object> response, TransactionStatusLog log) {
if(response.get("refundDdetails") != null ){
if (response.get("refundDdetails") != null) {
Map<String,Object> refundInfo= (Map<String, Object>) response.get("refundDdetails");
List<Map<String ,Object>> refundDetails = (List<Map<String, Object>>) refundInfo.get("RefundDetails");
System.out.println("inifcon :"+ refundDetails);
if(refundDetails != null && !refundDetails.isEmpty()){
Map<String, Object> refundInfo = (Map<String, Object>) response.get("refundDdetails");
List<Map<String, Object>> refundDetails = (List<Map<String, Object>>) refundInfo.get("RefundDetails");
System.out.println("inifcon :" + refundDetails);
if (refundDetails != null && !refundDetails.isEmpty()) {
RefundResponse refundResponse = new RefundResponse();
refundResponse.setAmount(response.get("amount")!=null?response.get("amount").toString():"");
refundResponse.setBalaceAmount(response.get("balanceAmount")!=null?response.get("balanceAmount").toString():"");
refundResponse.setAmount(response.get("amount") != null ? response.get("amount").toString() : "");
refundResponse.setBalaceAmount(response.get("balanceAmount") != null ? response.get("balanceAmount").toString() : "");
refundResponse.setTxansactionId(log.getTransactionId());
Map<String ,Object> mapRef = refundDetails.get(refundDetails.size()-1);
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")){
if (mapRef.get("STATUS") != null && mapRef.get("STATUS").toString().equals("INITIATED")) {
refundResponse.setStatusCode("0400");
}else{
} else {
refundResponse.setStatusCode("0399");
}
refundResponse.setResponse(refundDetails.toString());
@ -250,7 +256,7 @@ public class PaymentStatusScheduler {
Double amt = Double.parseDouble(response.get("amount").toString());
Double balAmt = Double.parseDouble(response.get("balanceAmount").toString());
if(amt != balAmt ) {
if (amt != balAmt) {
RefundTransaction refundTrans = transactionService.getRefundTrans(saverRefundResponse.getBookingId());
if (refundTrans != null) {
@ -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()));
refundTrans.setBookingDetails(bookingsById);
transactionService.saveRefundTransaction(refundTrans);
System.out.println("bookingsById"+bookingsById.getBookingId());
bookings.setBookingId(bookingsById.getBookingId());
refundTrans.setBookingDetails(bookings);
System.out.println(refundTrans.toString());
transactionService.saveRefundTransactionDetails(refundTrans);
}
bookingService.updateRefundStatus(saverRefundResponse.getBookingId(),BookingDetails.RefundStatus.COMPLETED); }
saveRefundClientInfo(refundDetails,log.getUserId() ,log.getBookingId(), log.getTransactionId());
// 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()) {
@ -301,13 +312,13 @@ public class PaymentStatusScheduler {
refundClientInfo.setUserId(Integer.parseInt(userId));
refundClientInfo.setBookingId(Integer.parseInt(bookingId));
refundClientInfo.setTransactionId(transactionId);
refundClientInfo.setClntRfndId(refund.get("clnt_rfnd_id")!=null?refund.get("clnt_rfnd_id").toString():"");
refundClientInfo.setArnNo(refund.get("ARN_Number")!=null?refund.get("ARN_Number").toString():"");
refundClientInfo.setGetRefTxnDate(refund.get("REF_TXN_DATE")!=null?refund.get("REF_TXN_DATE").toString():"");
refundClientInfo.setRefTxnAmt(refund.get("REF_TXN_AMT")!=null?refund.get("REF_TXN_AMT").toString():"");
refundClientInfo.setRefTxnId(refund.get("REF_TXN_ID")!=null?refund.get("REF_TXN_ID").toString():"");
refundClientInfo.setStatus(refund.get("STATUS")!=null?refund.get("STATUS").toString():"");
refundClientInfo.setSrno(refund.get("SR_NO")!=null?refund.get("SR_NO").toString():"");
refundClientInfo.setClntRfndId(refund.get("clnt_rfnd_id") != null ? refund.get("clnt_rfnd_id").toString() : "");
refundClientInfo.setArnNo(refund.get("ARN_Number") != null ? refund.get("ARN_Number").toString() : "");
refundClientInfo.setGetRefTxnDate(refund.get("REF_TXN_DATE") != null ? refund.get("REF_TXN_DATE").toString() : "");
refundClientInfo.setRefTxnAmt(refund.get("REF_TXN_AMT") != null ? refund.get("REF_TXN_AMT").toString() : "");
refundClientInfo.setRefTxnId(refund.get("REF_TXN_ID") != null ? refund.get("REF_TXN_ID").toString() : "");
refundClientInfo.setStatus(refund.get("STATUS") != null ? refund.get("STATUS").toString() : "");
refundClientInfo.setSrno(refund.get("SR_NO") != null ? refund.get("SR_NO").toString() : "");
refundClientInfoRepository.save(refundClientInfo);
@ -317,21 +328,22 @@ public class PaymentStatusScheduler {
}
@Transactional
public void intiateRefund(int bookingId,int userId) throws Exception {
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
if (s.equals("Refunded")) {
bookingService.updateRefundStatus(bookingId, BookingDetails.RefundStatus.COMPLETED);
}
{
bookingService.updateRefundStatus(bookingId,BookingDetails.RefundStatus.FAILURE);
} 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);
}

67
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);
@ -365,7 +367,7 @@ public class BookingServiceImpl implements BookingService {
@Transactional
public String processBookingStatusAndSendMessages(BookingDetails bookingDetails) {
try{
try {
String reason = bookingDetails.getReason();
ReasonMaster reasonDetails = reasonMasterRepository.findByReason(reason);
String reasonCode = (reasonDetails != null && reasonDetails.getReasoncode() != null) ? reasonDetails.getReasoncode() : "";
@ -408,7 +410,7 @@ public class BookingServiceImpl implements BookingService {
whatsappMsgServiceImpl.sendSMS(urlString);
return "Booking confirmed successfully";
}
}catch (Exception e){
} catch (Exception e) {
e.printStackTrace();
return "error";
}
@ -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);
}

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

@ -55,8 +55,8 @@
</style>
<body>
<!-- Page Container -->
<div id="page-container"
<!-- Page Container -->
<div id="page-container"
class="sidebar-o sidebar-dark enable-page-overlay side-scroll page-header-fixed page-header-dark">
<!-- Side Overlay aside (right)-->
<aside th:replace="~{fragments/aside-right :: aside}"></aside>
@ -84,14 +84,18 @@
<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>
<input type="date" th:value="${todate}" class="form-control" name="ToDate"
id="todate" placeholder="To Date" required="required"
data-date-format="yyyy-mm-dd" />
data-date-format="yyyy-mm-dd"/>
</div>
<div class="col-sm-3 mb-2">
<label class="form-label" for="request">Get Info:<span
@ -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>
@ -656,17 +673,19 @@
</tr>
<input type="hidden"
class="form-control text-center"
name="bookingid" id="bookingid" disabled />
name="bookingid" id="bookingid" disabled/>
<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>
@ -1145,14 +1251,14 @@
</main>
<footer th:replace="~{fragments/footer2 :: footer}"></footer>
</div>
</div>
<div th:replace="~{fragments/resetpassword :: div}"></div>
<script th:replace="~{fragments/loginscript :: script}"></script>
<div th:replace="~{fragments/resetpassword :: div}"></div>
<script th:replace="~{fragments/loginscript :: script}"></script>
<script>
<script>
$(document).ready(function () {
// Common buttons configuration
var buttons = [{
@ -1318,21 +1424,19 @@
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";
document.getElementById("hallContainer").style.display = "block";
} else if (requestValue === "7") {
document.getElementById("bookingcountbasedonDropdown").style.display = "block"
}else if (requestValue === "8") {
} else if (requestValue === "8") {
document.getElementById("zoneDropdown").style.display = "block";
document.getElementById("divisionContainer").style.display = "block";
document.getElementById("hallContainer").style.display = "block";
@ -1340,8 +1444,9 @@
}
}
document.addEventListener("DOMContentLoaded", function() {
document.getElementById("basedon").addEventListener("change", function() {
document.addEventListener("DOMContentLoaded", function () {
document.getElementById("basedon").addEventListener("change", function () {
const selectedValue = this.value;
document.getElementById("bookingcountbasedonDropdown").style.display = selectedValue ? "block" : "none";
});
@ -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>');
@ -1577,7 +1694,7 @@
var temp_total = parseFloat($("#td_settel_amt").html());
var settleAmount = temp_total - totalAmount;
if (settleAmount < 0) {
var pendingstatus=data.settlement.collectionStatus
var pendingstatus = data.settlement.collectionStatus
$("#td_settel_amt").html(0.00);
$("#pendingcolumn").show();
$("#collectionstatuscolumn").show();
@ -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');
@ -1922,7 +2041,7 @@
storeSelectedValues();
});
</script>
</script>
</body>
</html>

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;

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

@ -420,11 +420,12 @@
overflow-y: auto;
/* Enable vertical scrolling if needed */
}
body {
font-family: Arial, sans-serif;
}
}
.chat-icon {
.chat-icon {
position: fixed;
bottom: 20px;
right: 20px;
@ -436,14 +437,14 @@
display: flex;
align-items: center;
justify-content: center;
}
}
.chat-icon img {
.chat-icon img {
width: 30px;
height: 30px;
}
}
.chat-notification {
.chat-notification {
position: absolute;
top: -10px;
right: -10px;
@ -452,9 +453,9 @@
border-radius: 50%;
padding: 5px;
font-size: 12px;
}
}
.chat-box {
.chat-box {
position: fixed;
bottom: 90px;
right: 20px;
@ -465,49 +466,49 @@
display: none;
flex-direction: column;
box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.1);
}
}
.chat-header {
.chat-header {
background-color: #007bff;
color: white;
padding: 10px;
display: flex;
justify-content: space-between;
align-items: center;
}
}
.chat-body {
.chat-body {
flex-grow: 1;
padding: 10px;
overflow-y: scroll;
border-top: 1px solid #ccc;
border-bottom: 1px solid #ccc;
}
}
.chat-footer {
.chat-footer {
display: flex;
padding: 10px;
}
}
.chat-footer input {
.chat-footer input {
flex-grow: 1;
padding: 5px;
margin-right: 10px;
}
}
.chat-footer button {
.chat-footer button {
background-color: #007bff;
color: white;
border: none;
padding: 5px 10px;
cursor: pointer;
}
}
</style>
<body>
<!-- Pre-loader start -->
<div class="theme-loader">
<!-- Pre-loader start -->
<div class="theme-loader">
<div class="ball-scale">
<div class='contain'>
<div class="ring">
@ -542,10 +543,10 @@
</div>
</div>
</div>
</div>
<!-- Pre-loader end -->
</div>
<!-- Pre-loader end -->
<div id="pcoded" class="pcoded">
<div id="pcoded" class="pcoded">
<div class="pcoded-container">
<!-- Menu header start -->
<nav th:replace="~{fragments/nav-user :: nav}"></nav>
@ -573,7 +574,7 @@
th:onclick="'transactionHistory(' + ${userBookingspast[0].users_user_id} + ')'">
Transaction History
</button>
</div>
</div>
<div class="card-block">
<div class="table-responsive">
@ -613,7 +614,7 @@
<td
th:text="${booking.ending_slot == 1 ? 'morning' : (booking.ending_slot == 2 ? 'evening' : '')}">
</td>
<td th:text="${booking.reason}" ></td>
<td th:text="${booking.reason}"></td>
<td
th:text="${#strings.replace(booking.booking_status, '_', ' ')}">
</td>
@ -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>
@ -819,17 +844,19 @@
</tr>
<input type="hidden"
class="form-control text-center"
name="bookingid" id="bookingid" disabled />
name="bookingid" id="bookingid" disabled/>
<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>
@ -1322,7 +1433,7 @@
<button type="button" class="btn btn-secondary"
data-bs-dismiss="modal">Close
</button>
<button type="button" class="btn btn-primary" onclick="Reschedule()" >Save
<button type="button" class="btn btn-primary" onclick="Reschedule()">Save
Changes
</button>
</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>
@ -1425,12 +1537,13 @@
<!-- Data will be populated dynamically here -->
</tbody>
</table>
</div>
</div>
</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>');
@ -1883,7 +2009,7 @@
var temp_total = parseFloat($("#td_settel_amt").html());
var settleAmount = temp_total - totalAmount;
if (settleAmount < 0) {
var pendingstatus=data.settlement.collectionStatus
var pendingstatus = data.settlement.collectionStatus
$("#td_settel_amt").html(0.00);
$("#pendingcolumn").show();
$("#collectionstatuscolumn").show();
@ -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) {
@ -2112,7 +2244,7 @@
function initializeDatepickerWithColors(hallId, reason) { // Confirm hallId is passed here
$("#datepicker-container").datepicker("destroy");
const serverDate =new Date($("#serverDate").val() + "T00:00:00")
const serverDate = new Date($("#serverDate").val() + "T00:00:00")
// console.log(" view history Date:", serverDate);
const maxDate = new Date(serverDate);
@ -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,11 +2716,12 @@
$(document).on('change', '.nocfile', function () {
validateFile(this);
});
function transactionHistory(userId) {
$.ajax({
type: "GET",
url: '/communityhall/user/api/getTransactionDetails',
data: { 'userId': userId },
data: {'userId': userId},
success: function (data) {
// console.log("Full response:", data);
// console.log("Refund Details:", data.refundDetails);
@ -2603,9 +2739,9 @@
console.error("Error fetching transaction details", error);
}
});
}
}
function populateTransactionTable(transactions) {
function populateTransactionTable(transactions) {
const tableBody = $('#transactionTable tbody');
tableBody.empty(); // Clear any existing rows
@ -2626,9 +2762,9 @@ function populateTransactionTable(transactions) {
`;
tableBody.append(row); // Append the row to the table body
});
}
}
function populateRefundDetailsTable(refundDetails) {
function populateRefundDetailsTable(refundDetails) {
const refundTable = $('#refunddetails');
const tableBody = $('#refunddetailsTable tbody');
tableBody.empty(); // Clear any existing rows
@ -2652,17 +2788,17 @@ function populateRefundDetailsTable(refundDetails) {
} else {
refundTable.hide(); // Hide the refund details table
}
}
}
// Toggle Chat Box
function toggleChat() {
function toggleChat() {
const chatBox = document.getElementById('chat-box');
chatBox.style.display = (chatBox.style.display === 'block') ? 'none' : 'block';
}
}
// Send Message
function sendMessage() {
// Send Message
function sendMessage() {
const userInput = document.getElementById('userInput');
const message = userInput.value.trim();
@ -2682,7 +2818,7 @@ function sendMessage() {
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ message }),
body: JSON.stringify({message}),
})
.then(response => response.json())
.then(data => {
@ -2697,13 +2833,13 @@ function sendMessage() {
userInput.value = ''; // Clear input field
}
}
}
</script>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
Loading…
Cancel
Save