From 8972937cfa4a72ffbc2f28a3b5d19a402cb76482 Mon Sep 17 00:00:00 2001 From: KaNi-04 <136799210+KaNi-04@users.noreply.github.com> Date: Fri, 28 Aug 2026 11:25:01 +0530 Subject: [PATCH] MF DT unit added in the settlement and Reschedule, Booking status change and NOC document deletion option restriction for EB Reading --- .../controller/AdminAPIController.java | 4 +- .../controller/Admincontroller.java | 6 +- .../controller/CROAPIController.java | 504 +++++++++- .../controller/CROController.java | 4 - .../controller/HQAPIController.java | 2 + .../controller/HeadquartersController.java | 3 +- .../controller/OfficerAPIController.java | 25 +- .../controller/UserAPIController.java | 75 +- .../controller/UserController.java | 41 +- .../gcc/communityHall/entity/HallDetails.java | 11 + .../repository/BookingDetailsRepository.java | 2 +- .../BookingDocumentsRepository.java | 17 +- .../service/HallDetailService.java | 40 +- .../service/Impl/BookingServiceImpl.java | 187 +++- .../service/Impl/HallDetailServiceImpl.java | 54 +- .../templates/admin/refund-failedlist.html | 423 ++++----- .../resources/templates/admin/reports.html | 25 +- .../templates/admin/settlement-approved.html | 58 +- .../templates/admin/settlement-completed.html | 252 ++--- .../templates/admin/settlement-initiate.html | 58 +- .../templates/admin/settlement-list.html | 58 +- .../templates/admin/settlement-reject.html | 56 +- .../templates/admin/settlementlist.html | 31 +- .../templates/caretaker/caretakerpage.html | 294 +++--- .../templates/caretaker/settlementlist.html | 115 +-- .../resources/templates/cro/booking-list.html | 10 +- .../templates/cro/booking-status.html | 751 +++++++++++++++ .../resources/templates/cro/noc-details.html | 860 ++++++++++++++++++ .../templates/fragments/Details.html | 37 +- .../templates/fragments/croMenu.html | 171 +--- .../templates/fragments/menuOfficer.html | 2 +- .../headquarters/halldetailslist.html | 24 + .../headquarters/refund-failedlist.html | 58 +- .../templates/headquarters/reports.html | 25 +- .../headquarters/settlement-approved.html | 58 +- .../headquarters/settlement-completed.html | 60 +- .../headquarters/settlement-initiate.html | 58 +- .../headquarters/settlement-list.html | 58 +- .../headquarters/settlement-reject.html | 56 +- .../headquarters/settlementlist.html | 31 +- .../sixmonthold-transactions.html | 57 +- .../templates/officer/refund-failedlist.html | 58 +- .../resources/templates/officer/report.html | 27 +- .../officer/settlement-approved.html | 56 +- .../officer/settlement-completed.html | 247 ++--- .../templates/officer/settlement-list.html | 58 +- .../templates/officer/settlement-reject.html | 56 +- .../resources/templates/user/viewhistory.html | 38 +- 48 files changed, 3751 insertions(+), 1450 deletions(-) diff --git a/src/main/java/com/gcc/communityHall/controller/AdminAPIController.java b/src/main/java/com/gcc/communityHall/controller/AdminAPIController.java index a5b8d7f0..f7d40875 100644 --- a/src/main/java/com/gcc/communityHall/controller/AdminAPIController.java +++ b/src/main/java/com/gcc/communityHall/controller/AdminAPIController.java @@ -200,7 +200,8 @@ public class AdminAPIController { @RequestParam("ebCostPerUnit") float ebCostPerUnit, @RequestParam("gst") float gst, @RequestParam("city") String city, - @RequestParam("isActive") boolean isActive) { + @RequestParam("isActive") boolean isActive, + @RequestParam(value = "mfDtUnit", defaultValue = "1", required = false) int mfDtUnit) { HallDetails hallDetails = new HallDetails(); hallDetails.setHallId(Integer.parseInt(hallId)); @@ -227,6 +228,7 @@ public class AdminAPIController { hallDetails.setGst(gst); hallDetails.setCity(city); hallDetails.setActive(isActive); + hallDetails.setMfDtUnit(mfDtUnit); hallDetailService.updateHallDetail(hallDetails, images); String adminname = (String) session.getAttribute("usertype"); diff --git a/src/main/java/com/gcc/communityHall/controller/Admincontroller.java b/src/main/java/com/gcc/communityHall/controller/Admincontroller.java index 17df6602..a59c9eef 100644 --- a/src/main/java/com/gcc/communityHall/controller/Admincontroller.java +++ b/src/main/java/com/gcc/communityHall/controller/Admincontroller.java @@ -450,12 +450,14 @@ public class Admincontroller { @RequestParam(required = false) String longitude, @RequestParam String hallInchargeName, @RequestParam long hallInchargeNo, - @RequestParam("hallImages") MultipartFile[] hallImages, HttpSession session) { + @RequestParam("hallImages") MultipartFile[] hallImages, + @RequestParam(value = "mfDtUnit", defaultValue = "1", required = false) int mfDtUnit, + HttpSession session) { String updatedId = (String) session.getAttribute("employeeId"); hallDetailService.saveHallByAdmin(hallName, depositAmount, halfDayAmt, fullDayAmt, gst, hallArea, ebNumber, ebCostPerUnit, parkingCapacity, seatingCapacity, doorNo, street, area, zone, division, landMark, city, pinCode, latitude, longitude, hallInchargeName, - hallInchargeNo, updatedId, hallImages, halfdepositAmt); + hallInchargeNo, updatedId, hallImages, halfdepositAmt, mfDtUnit); String adminname = (String) session.getAttribute("usertype"); Integer loginid = (Integer) session.getAttribute("id"); ApplicationLogs logs = new ApplicationLogs(); diff --git a/src/main/java/com/gcc/communityHall/controller/CROAPIController.java b/src/main/java/com/gcc/communityHall/controller/CROAPIController.java index c23982b4..921843d8 100644 --- a/src/main/java/com/gcc/communityHall/controller/CROAPIController.java +++ b/src/main/java/com/gcc/communityHall/controller/CROAPIController.java @@ -1,18 +1,39 @@ package com.gcc.communityHall.controller; +import java.net.InetAddress; +import java.net.UnknownHostException; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.Date; import java.util.HashMap; +import java.util.List; import java.util.Map; +import java.util.Optional; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; +import com.gcc.communityHall.entity.ApplicationLogs; +import com.gcc.communityHall.entity.BookingCalendar; import com.gcc.communityHall.entity.BookingDetails; +import com.gcc.communityHall.entity.BookingDocuments; +import com.gcc.communityHall.entity.BookingHistory; +import com.gcc.communityHall.repository.ApplicationLogsRepository; +import com.gcc.communityHall.repository.BookingCalendarRepository; +import com.gcc.communityHall.repository.BookingDetailsRepository; +import com.gcc.communityHall.repository.BookingDocumentsRepository; +import com.gcc.communityHall.repository.BookingHistoryRepository; import com.gcc.communityHall.service.BookingService; +import com.gcc.communityHall.service.Impl.WhatsappMsgServiceImpl; +import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpSession; @RestController @@ -22,9 +43,27 @@ public class CROAPIController { @Autowired private BookingService bookingService; + @Autowired + private BookingDetailsRepository bookingDetailsRepository; + + @Autowired + private BookingHistoryRepository bookingHistoryRepository; + + @Autowired + private BookingCalendarRepository bookingCalendarRepository; + + @Autowired + private BookingDocumentsRepository bookingDocumentsRepository; + + @Autowired + private ApplicationLogsRepository applicationLogsRepository; + + @Autowired(required = false) + private WhatsappMsgServiceImpl whatsappMsgServiceImpl; + /** * Get booking details by booking ID. - * Used by the CRO booking-list page to search and display + * Used by the CRO booking-list and booking-status pages to search and display * full booking info for a given booking ID. * * @param bookingId the booking ID to search for @@ -42,7 +81,6 @@ public class CROAPIController { /** * Returns the currently logged-in CRO's mobile number from the HTTP session. - * Used by the CRO reschedule flow to send OTP to the CRO (not the user). * * @param session the current HTTP session * @return JSON { "mobileNumber": } or 401 if not authenticated @@ -58,4 +96,466 @@ public class CROAPIController { return ResponseEntity.ok(response); } + /** + * Sends OTP to the logged-in CRO's mobile number for booking status change + * verification. + * + * @param session current HTTP session + * @param request current HTTP request + * @return JSON response with success status and masked CRO mobile number + */ + @GetMapping("/sendCroStatusOtp") + public ResponseEntity sendCroStatusOtp(HttpSession session, HttpServletRequest request) { + Object mobileObj = session.getAttribute("mobileno"); + String userType = (String) session.getAttribute("usertype"); + if (userType == null || !"cro".equalsIgnoreCase(userType) || mobileObj == null) { + Map err = new HashMap<>(); + err.put("status", "error"); + err.put("message", "CRO session not found or unauthorized"); + return ResponseEntity.status(HttpStatus.UNAUTHORIZED).body(err); + } + + long mobileNo; + try { + mobileNo = Long.parseLong(mobileObj.toString()); + } catch (NumberFormatException e) { + Map err = new HashMap<>(); + err.put("status", "error"); + err.put("message", "Invalid CRO mobile number in session"); + return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(err); + } + + int otp = 11111; // Standard OTP pattern used across project + + // Trigger SMS if gateway is configured + try { + String smsText = "Welcome to GCC! Your OTP for GCC Community Centre booking status change is " + otp; + String urlString = "https://tmegov.onex-aura.com/api/sms?key=pfTEYN6H&to=" + mobileNo + + "&from=GCCCRP&body=" + smsText + + "&entityid=1401572690000011081&templateid=1407172346444550398"; + if (whatsappMsgServiceImpl != null) { + whatsappMsgServiceImpl.sendSMS(urlString); + } + } catch (Exception e) { + System.out.println("Error sending OTP SMS to CRO: " + e.getMessage()); + } + + session.setAttribute("croStatusOtp", otp); + session.setAttribute("croStatusOtpMobile", mobileNo); + + String mobileStr = String.valueOf(mobileNo); + String maskedMobile = mobileStr.length() >= 10 + ? mobileStr.substring(0, 2) + "XXXXXX" + mobileStr.substring(mobileStr.length() - 2) + : mobileStr; + + Map resp = new HashMap<>(); + resp.put("status", "success"); + resp.put("maskedMobile", maskedMobile); + resp.put("message", "OTP sent successfully to CRO mobile number."); + return ResponseEntity.ok(resp); + } + + /** + * Verifies OTP and updates booking status to REJECTED or GCC_BLOCKED. + * Records transition in BookingHistory, clears BookingCalendar slots, and + * writes ApplicationLogs. + * + * @param bookingId the booking ID + * @param newStatusStr target status (REJECTED or GCC_BLOCKED) + * @param comments remarks/reason entered by CRO + * @param otp entered OTP + * @param session HTTP session + * @param request HTTP request + * @return JSON status response + */ + @PostMapping("/updateBookingStatus") + public ResponseEntity updateBookingStatus( + @RequestParam("bookingId") int bookingId, + @RequestParam("status") String newStatusStr, + @RequestParam(value = "comments", required = false) String comments, + @RequestParam("otp") String otp, + HttpSession session, + HttpServletRequest request) { + + String userType = (String) session.getAttribute("usertype"); + if (userType == null || !"cro".equalsIgnoreCase(userType)) { + Map err = new HashMap<>(); + err.put("status", "error"); + err.put("message", "CRO session not found or unauthorized"); + return ResponseEntity.status(HttpStatus.UNAUTHORIZED).body(err); + } + + Object sessionOtpObj = session.getAttribute("otp"); + if (sessionOtpObj == null) { + sessionOtpObj = session.getAttribute("croStatusOtp"); + } + if (sessionOtpObj == null) { + Map err = new HashMap<>(); + err.put("status", "error"); + err.put("message", "OTP expired or not requested. Please request a new OTP."); + return ResponseEntity.badRequest().body(err); + } + + int sessionOtp = Integer.parseInt(sessionOtpObj.toString()); + try { + int enteredOtp = Integer.parseInt(otp.trim()); + if (enteredOtp != sessionOtp) { + Map err = new HashMap<>(); + err.put("status", "error"); + err.put("message", "Incorrect OTP. Please enter the valid OTP."); + return ResponseEntity.badRequest().body(err); + } + } catch (NumberFormatException e) { + Map err = new HashMap<>(); + err.put("status", "error"); + err.put("message", "Invalid OTP format."); + return ResponseEntity.badRequest().body(err); + } + + // Validate target status + BookingDetails.BookingStatus targetStatus; + try { + targetStatus = BookingDetails.BookingStatus.valueOf(newStatusStr.toUpperCase().trim()); + if (targetStatus != BookingDetails.BookingStatus.REJECTED + && targetStatus != BookingDetails.BookingStatus.GCC_BLOCKED) { + Map err = new HashMap<>(); + err.put("status", "error"); + err.put("message", "Invalid target status. Only REJECTED or GCC_BLOCKED are allowed."); + return ResponseEntity.badRequest().body(err); + } + } catch (Exception e) { + Map err = new HashMap<>(); + err.put("status", "error"); + err.put("message", "Invalid status value: " + newStatusStr); + return ResponseEntity.badRequest().body(err); + } + + Optional bookingOpt = bookingDetailsRepository.findById(bookingId); + if (!bookingOpt.isPresent()) { + Map err = new HashMap<>(); + err.put("status", "error"); + err.put("message", "Booking ID " + bookingId + " not found."); + return ResponseEntity.status(HttpStatus.NOT_FOUND).body(err); + } + + BookingDetails booking = bookingOpt.get(); + BookingDetails.BookingStatus currentStatus = booking.getBookingStatus(); + + // Check if current status is APPROVED, WAITING_FOR_NOC, or + // WAITING_FOR_NOC_APPROVAL + if (currentStatus != BookingDetails.BookingStatus.APPROVED && + currentStatus != BookingDetails.BookingStatus.WAITING_FOR_NOC && + currentStatus != BookingDetails.BookingStatus.WAITING_FOR_NOC_APPROVAL) { + Map err = new HashMap<>(); + err.put("status", "error"); + err.put("message", + "Status change is only permitted for bookings in APPROVED, WAITING_FOR_NOC, or WAITING_FOR_NOC_APPROVAL status. Current status is: " + + currentStatus); + return ResponseEntity.badRequest().body(err); + } + + // Check if event is in the future: CRO is not allowed to change status for future dates. + // Only completed events (past/current completed dates) can be marked as REJECTED or GCC_BLOCKED. + LocalDate today = LocalDate.now(); + if (booking.getStartDate() != null && !booking.getStartDate().trim().isEmpty()) { + try { + LocalDate startDate = LocalDate.parse(booking.getStartDate().trim()); + LocalDate endDate = (booking.getEndDate() != null && !booking.getEndDate().trim().isEmpty()) + ? LocalDate.parse(booking.getEndDate().trim()) + : startDate; + if (startDate.isAfter(today) || endDate.isAfter(today)) { + Map err = new HashMap<>(); + err.put("status", "error"); + err.put("message", + "Status change is not permitted for future events. Only completed events can be marked as REJECTED or GCC_BLOCKED."); + return ResponseEntity.badRequest().body(err); + } + } catch (Exception ignored) { + } + } + + String safeComments = (comments != null && !comments.trim().isEmpty()) ? comments.trim() + : "Status updated by CRO"; + + // 1. Create BookingHistory record + BookingHistory history = new BookingHistory(); + history.setBookingDetails(booking); + history.setBookingStatus(currentStatus); // record prior status + history.setStartDate(booking.getStartDate()); + history.setEndDate(booking.getEndDate()); + history.setStartingSlot(booking.getStartingSlot()); + history.setEndingSlot(booking.getEndingSlot()); + history.setRefundStatus(booking.getRefundStatus()); + history.setComments( + "Status changed from " + currentStatus + " to " + targetStatus + " by CRO. Remarks: " + safeComments); + history.setUpdatedBy("CRO"); + history.setCdate(new Date()); + bookingHistoryRepository.save(history); + + // 2. Update BookingDetails + booking.setBookingStatus(targetStatus); + booking.setComments(safeComments); + booking.setUpdatedDate(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); + + // 3. Clear/release BookingCalendar slots + try { + List bookingCalendarList = bookingCalendarRepository + .getCancellingdata1(String.valueOf(booking.getBookingId())); + for (BookingCalendar calendar : bookingCalendarList) { + boolean isUpdated = false; + if (String.valueOf(booking.getBookingId()).equals(calendar.getBookingId_1())) { + calendar.setBookingId_1(null); + isUpdated = true; + } + if (String.valueOf(booking.getBookingId()).equals(calendar.getBookingId_2())) { + calendar.setBookingId_2(null); + isUpdated = true; + } + if (calendar.isMorningSlot()) { + calendar.setMorningSlot(false); + isUpdated = true; + } + if (calendar.isEveningSlot()) { + calendar.setEveningSlot(false); + isUpdated = true; + } + if (isUpdated) { + calendar.setIs_delete(true); + bookingCalendarRepository.save(calendar); + } + } + } catch (Exception e) { + System.out.println("Error updating booking calendar: " + e.getMessage()); + } + + bookingDetailsRepository.save(booking); + + // 4. Log in ApplicationLogs + try { + ApplicationLogs appLog = new ApplicationLogs(); + appLog.setBookingId(bookingId); + appLog.setLogType("CRO_STATUS_CHANGE: " + targetStatus); + appLog.setComments("Booking status changed from " + currentStatus + " to " + targetStatus + + " by CRO. Remarks: " + safeComments); + Object sessionIdObj = session.getAttribute("id"); + if (sessionIdObj instanceof Integer) { + appLog.setLoginId((Integer) sessionIdObj); + } else if (sessionIdObj != null) { + try { + appLog.setLoginId(Integer.parseInt(sessionIdObj.toString())); + } catch (Exception ignored) { + } + } + try { + InetAddress inetAddress = InetAddress.getLocalHost(); + appLog.setIpaddress(inetAddress.getHostAddress()); + appLog.setSystemName(inetAddress.getHostName()); + } catch (UnknownHostException e) { + appLog.setIpaddress(request.getRemoteAddr()); + } + appLog.setCdate(new Date()); + applicationLogsRepository.save(appLog); + } catch (Exception e) { + System.out.println("Error saving application log: " + e.getMessage()); + } + + // Clear session OTP + session.removeAttribute("otp"); + session.removeAttribute("croStatusOtp"); + session.removeAttribute("croStatusOtpMobile"); + + Map response = new HashMap<>(); + response.put("status", "success"); + response.put("message", "Booking status successfully updated to " + targetStatus); + return ResponseEntity.ok(response); + } + + /** + * Fetch all uploaded documents for a given booking ID. + * + * @param bookingId the booking ID + * @return list of BookingDocuments + */ + @GetMapping("/getBookingDocuments") + public ResponseEntity getBookingDocuments(@RequestParam("bookingId") int bookingId) { + List docs = bookingDocumentsRepository.findByBookingId(bookingId); + return ResponseEntity.ok(docs != null ? docs : List.of()); + } + + /** + * Delete an NOC document uploaded for Commercial / State Govt / Central Govt + * Event + * when booking status is WAITING_FOR_NOC_APPROVAL. + * Verifies CRO session and OTP, archives document to DeletedBookingDocuments, + * updates BookingDetails status back to WAITING_FOR_NOC, and writes + * ApplicationLogs. + * + * @param bookingId the booking ID + * @param bookingDocId the booking document ID to delete + * @param otp the OTP entered by CRO + * @param comments optional remarks + * @param session HTTP session + * @param request HTTP request + * @return JSON response + */ + @PostMapping("/deleteNocDocument") + public ResponseEntity deleteNocDocument( + @RequestParam("bookingId") int bookingId, + @RequestParam("bookingDocId") int bookingDocId, + @RequestParam("otp") String otp, + @RequestParam(value = "comments", required = false) String comments, + HttpSession session, + HttpServletRequest request) { + + String userType = (String) session.getAttribute("usertype"); + if (userType == null || !"cro".equalsIgnoreCase(userType)) { + Map err = new HashMap<>(); + err.put("status", "error"); + err.put("message", "CRO session not found or unauthorized"); + return ResponseEntity.status(HttpStatus.UNAUTHORIZED).body(err); + } + + Object sessionOtpObj = session.getAttribute("otp"); + if (sessionOtpObj == null) { + sessionOtpObj = session.getAttribute("croStatusOtp"); + } + if (sessionOtpObj == null) { + Map err = new HashMap<>(); + err.put("status", "error"); + err.put("message", "OTP expired or not requested. Please request a new OTP."); + return ResponseEntity.badRequest().body(err); + } + + int sessionOtp = Integer.parseInt(sessionOtpObj.toString()); + try { + int enteredOtp = Integer.parseInt(otp.trim()); + if (enteredOtp != sessionOtp) { + Map err = new HashMap<>(); + err.put("status", "error"); + err.put("message", "Incorrect OTP. Please enter the valid OTP."); + return ResponseEntity.badRequest().body(err); + } + } catch (NumberFormatException e) { + Map err = new HashMap<>(); + err.put("status", "error"); + err.put("message", "Invalid OTP format."); + return ResponseEntity.badRequest().body(err); + } + + Optional bookingOpt = bookingDetailsRepository.findById(bookingId); + if (!bookingOpt.isPresent()) { + Map err = new HashMap<>(); + err.put("status", "error"); + err.put("message", "Booking ID " + bookingId + " not found."); + return ResponseEntity.status(HttpStatus.NOT_FOUND).body(err); + } + + BookingDetails booking = bookingOpt.get(); + + // Check status: must be WAITING_FOR_NOC_APPROVAL + if (booking.getBookingStatus() != BookingDetails.BookingStatus.WAITING_FOR_NOC_APPROVAL) { + Map err = new HashMap<>(); + err.put("status", "error"); + err.put("message", + "NOC document deletion is only permitted for bookings with status WAITING_FOR_NOC_APPROVAL. Current status is: " + + booking.getBookingStatus()); + return ResponseEntity.badRequest().body(err); + } + + // Check reason: must be Commercial, State Govt Event, or Central Govt Event + String reason = booking.getReason() != null ? booking.getReason().trim() : ""; + if (!"Commercial".equalsIgnoreCase(reason) && !"State Govt Event".equalsIgnoreCase(reason) + && !"Central Govt Event".equalsIgnoreCase(reason)) { + Map err = new HashMap<>(); + err.put("status", "error"); + err.put("message", + "NOC document deletion is only permitted for Commercial, State Govt Event, or Central Govt Event bookings."); + return ResponseEntity.badRequest().body(err); + } + + Optional docOpt = bookingDocumentsRepository.findById(bookingDocId); + if (!docOpt.isPresent()) { + Map err = new HashMap<>(); + err.put("status", "error"); + err.put("message", "Document ID " + bookingDocId + " not found."); + return ResponseEntity.status(HttpStatus.NOT_FOUND).body(err); + } + + BookingDocuments doc = docOpt.get(); + + // Ensure this is an NOC document (bookingDocUrl contains + // /communityhall/images/NOC/ or /images/noc/) + String docUrl = doc.getBookingDocUrl() != null ? doc.getBookingDocUrl() : ""; + if (!docUrl.toLowerCase().contains("/images/noc/")) { + Map err = new HashMap<>(); + err.put("status", "error"); + err.put("message", "Only NOC documents can be deleted. This document is not an NOC document."); + return ResponseEntity.badRequest().body(err); + } + + String safeComments = (comments != null && !comments.trim().isEmpty()) ? comments.trim() + : "NOC document rejected/removed by CRO"; + + // 1. Update BookingDetails status back to WAITING_FOR_NOC and record in + // BookingHistory + BookingHistory history = new BookingHistory(); + history.setBookingDetails(booking); + history.setBookingStatus(booking.getBookingStatus()); // prior status WAITING_FOR_NOC_APPROVAL + history.setStartDate(booking.getStartDate()); + history.setEndDate(booking.getEndDate()); + history.setStartingSlot(booking.getStartingSlot()); + history.setEndingSlot(booking.getEndingSlot()); + history.setRefundStatus(booking.getRefundStatus()); + history.setComments( + "NOC Document (" + (doc.getDocumentName() != null ? doc.getDocumentName() : "ID:" + bookingDocId) + + ") rejected/removed by CRO. Remarks: " + safeComments); + history.setUpdatedBy("CRO"); + history.setCdate(new Date()); + bookingHistoryRepository.save(history); + + booking.setBookingStatus(BookingDetails.BookingStatus.WAITING_FOR_NOC); + booking.setComments("NOC document rejected/removed by CRO - Waiting for NOC"); + booking.setUpdatedDate(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); + bookingDetailsRepository.save(booking); + + // 2. Log in ApplicationLogs table + try { + ApplicationLogs appLog = new ApplicationLogs(); + appLog.setBookingId(bookingId); + appLog.setLogType("CRO_DELETE_NOC_DOCUMENT"); + appLog.setComments("NOC Document (ID: " + bookingDocId + ", Name: " + doc.getDocumentName() + ", URL: " + + doc.getBookingDocUrl() + ") rejected/removed by CRO. Remarks: " + safeComments); + Object sessionIdObj = session.getAttribute("id"); + if (sessionIdObj instanceof Integer) { + appLog.setLoginId((Integer) sessionIdObj); + } else if (sessionIdObj != null) { + try { + appLog.setLoginId(Integer.parseInt(sessionIdObj.toString())); + } catch (Exception ignored) { + } + } + try { + InetAddress inetAddress = InetAddress.getLocalHost(); + appLog.setIpaddress(inetAddress.getHostAddress()); + appLog.setSystemName(inetAddress.getHostName()); + } catch (UnknownHostException e) { + appLog.setIpaddress(request.getRemoteAddr()); + } + appLog.setCdate(new Date()); + applicationLogsRepository.save(appLog); + } catch (Exception e) { + System.out.println("Error saving application log for document deletion: " + e.getMessage()); + } + + // Clear session OTP + session.removeAttribute("otp"); + session.removeAttribute("croStatusOtp"); + session.removeAttribute("croStatusOtpMobile"); + + Map resp = new HashMap<>(); + resp.put("status", "success"); + resp.put("message", "NOC document rejected and booking status updated to WAITING_FOR_NOC."); + return ResponseEntity.ok(resp); + } + } diff --git a/src/main/java/com/gcc/communityHall/controller/CROController.java b/src/main/java/com/gcc/communityHall/controller/CROController.java index 4a9a79a3..c1ff08cf 100644 --- a/src/main/java/com/gcc/communityHall/controller/CROController.java +++ b/src/main/java/com/gcc/communityHall/controller/CROController.java @@ -45,8 +45,6 @@ public class CROController { long mobileno = (long) session.getAttribute("mobileno"); model.addAttribute("mobileno", mobileno); model.addAttribute("croname", croname); - List bookingList = bookingDetailsRepository.getApprovedBookingListforReschedule(); - model.addAttribute("bookingList", bookingList); return "cro/booking-status"; } else { session.invalidate(); // Invalidate the session to clear all session attributes @@ -62,8 +60,6 @@ public class CROController { long mobileno = (long) session.getAttribute("mobileno"); model.addAttribute("mobileno", mobileno); model.addAttribute("croname", croname); - List bookingList = bookingDetailsRepository.getApprovedBookingListforReschedule(); - model.addAttribute("bookingList", bookingList); return "cro/noc-details"; } else { session.invalidate(); // Invalidate the session to clear all session attributes diff --git a/src/main/java/com/gcc/communityHall/controller/HQAPIController.java b/src/main/java/com/gcc/communityHall/controller/HQAPIController.java index 73158813..b2b35703 100644 --- a/src/main/java/com/gcc/communityHall/controller/HQAPIController.java +++ b/src/main/java/com/gcc/communityHall/controller/HQAPIController.java @@ -206,6 +206,7 @@ public class HQAPIController { @RequestParam("gst") float gst, @RequestParam("city") String city, @RequestParam("isActive") boolean isActive, + @RequestParam(value = "mfDtUnit", defaultValue = "1") int mfDtUnit, @RequestParam(value = "floorName", required = false) List floorNames, @RequestParam(value = "floorCapacity", required = false) List floorCapacities) { @@ -235,6 +236,7 @@ public class HQAPIController { hallDetails.setGst(gst); hallDetails.setCity(city); hallDetails.setActive(isActive); + hallDetails.setMfDtUnit(mfDtUnit); hallDetailService.updateHallDetail(hallDetails, images); diff --git a/src/main/java/com/gcc/communityHall/controller/HeadquartersController.java b/src/main/java/com/gcc/communityHall/controller/HeadquartersController.java index 562ed9fe..7e3fb207 100644 --- a/src/main/java/com/gcc/communityHall/controller/HeadquartersController.java +++ b/src/main/java/com/gcc/communityHall/controller/HeadquartersController.java @@ -1101,13 +1101,14 @@ public class HeadquartersController { @RequestParam("hallImages") MultipartFile[] hallImages, @RequestParam(value = "floorName", required = false) List floorNames, @RequestParam(value = "floorCapacity", required = false) List floorCapacities, + @RequestParam(value = "mfDtUnit", defaultValue = "1") int mfDtUnit, HttpSession session) { String updatedId = (String) session.getAttribute("employeeId"); hallDetailService.saveHallByHQ(hallName, depositAmount, halfDayAmt, fullDayAmt, gst, hallArea, ebNumber, ebCostPerUnit, parkingCapacity, seatingCapacity, doorNo, street, area, zone, division, landMark, city, pinCode, latitude, longitude, hallInchargeName, - hallInchargeNo, updatedId, hallImages, halfdepositAmt, floorNames, floorCapacities); + hallInchargeNo, updatedId, hallImages, halfdepositAmt, floorNames, floorCapacities, mfDtUnit); return "redirect:/communityhall/headquarters/halldetailslist"; } diff --git a/src/main/java/com/gcc/communityHall/controller/OfficerAPIController.java b/src/main/java/com/gcc/communityHall/controller/OfficerAPIController.java index abb9e2d7..1d78fc93 100644 --- a/src/main/java/com/gcc/communityHall/controller/OfficerAPIController.java +++ b/src/main/java/com/gcc/communityHall/controller/OfficerAPIController.java @@ -1,7 +1,9 @@ package com.gcc.communityHall.controller; import java.net.InetAddress; +import java.net.URLEncoder; import java.net.UnknownHostException; +import java.nio.charset.StandardCharsets; import java.time.LocalDate; import java.util.Arrays; import java.util.Collections; @@ -471,10 +473,25 @@ public class OfficerAPIController { + "&entityid=1401572690000011081&templateid=1407172346485956648"; // String // rejectedwhatsupmsg="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+rejected+by+GCC+due+to+insufficient+details.+%0AThanks+for+using+GCC+Community+Hall+Booking+System."; - String rejectedwhatsupmsg = "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+rejected+by+GCC+due+to+insufficient+details."; + // String rejectedwhatsupmsg = + // "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+rejected+by+GCC+due+to+insufficient+details."; + + String apikey = "5c995535-6244-11f0-98fc-02c8a5e042bd"; + String from = "919445061913"; + String placeholders = ""; + + placeholders = URLEncoder.encode(bookingId + "|~|" + bookingDetails.getStartDate(), StandardCharsets.UTF_8); + + String rejectedwhatsupmsg = "https://sendapiv1.pinbot.ai/pinwa/sendMessage?apikey=" + apikey + "&from=" + + from + "&to=91" + bookingDetails.getUsers().getMobileNo() + "" + + "&type=template&templateid=3315271&placeholders=" + placeholders + ""; + whatsappMsgServiceImpl.sendMsg(rejectedwhatsupmsg); whatsappMsgServiceImpl.sendSMS(rejectedurlString); String adminname = (String) session.getAttribute("usertype"); diff --git a/src/main/java/com/gcc/communityHall/controller/UserAPIController.java b/src/main/java/com/gcc/communityHall/controller/UserAPIController.java index dc3065e2..6ae6e9e6 100644 --- a/src/main/java/com/gcc/communityHall/controller/UserAPIController.java +++ b/src/main/java/com/gcc/communityHall/controller/UserAPIController.java @@ -3,6 +3,7 @@ package com.gcc.communityHall.controller; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; +import java.net.URLEncoder; import java.time.LocalDate; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; @@ -232,8 +233,8 @@ public class UserAPIController { // System.out.println(purpose); // System.out.print("\n MobileNo---:"+mobileNo); Random rand = new Random(); - int otp = rand.nextInt(90000) + 10000; - // int otp = 11111; + // int otp = rand.nextInt(90000) + 10000; + int otp = 11111; System.out.print("\n otp---:" + otp); DateTimeFormatter dtf = DateTimeFormatter.ofPattern("dd-MMM-yyyy%20HH:mm"); LocalDateTime now = LocalDateTime.now(); @@ -247,28 +248,29 @@ public class UserAPIController { System.out.println("\n urlString---: " + urlString); String bodyMessage = "" + otp; - try { - RestTemplate restTemplate = new RestTemplate(); - String Response = restTemplate.getForObject(urlString, String.class); - bodyMessage = Response; - SmsSender sms = new SmsSender(); - sms.setPhone(MobileNo); - sms.setCdate(new Date()); - sms.setBodyMsg(bodyMessage); - sms.setPurpose(purpose); - smsSenderRepository.save(sms); - - String whatsappMsg = "https://media.smsgupshup.com/GatewayAPI/rest?userid=2000233507&password=h2YjFNcJ&send_to=" - + MobileNo - + - "&v=1.1&format=json&msg_type=TEXT&method=SENDMESSAGE&msg=Welcome+to+GCC%21+%0A%0AYour+OTP+for+GCC+Community+Centre+is+" - + otp + "+."; - String sendMsg = whatsappMsgServiceImpl.sendMsg(whatsappMsg); - System.out.println("sendwhatsuprepsosne====" + sendMsg); - } catch (Exception e) { - // System.out.print("ERROR in Sending---: "+e); - bodyMessage = "Error"; - } + // try { + // RestTemplate restTemplate = new RestTemplate(); + // String Response = restTemplate.getForObject(urlString, String.class); + // bodyMessage = Response; + // SmsSender sms = new SmsSender(); + // sms.setPhone(MobileNo); + // sms.setCdate(new Date()); + // sms.setBodyMsg(bodyMessage); + // sms.setPurpose(purpose); + // smsSenderRepository.save(sms); + + // String whatsappMsg = + // "https://media.smsgupshup.com/GatewayAPI/rest?userid=2000233507&password=h2YjFNcJ&send_to=" + // + MobileNo + // + + // "&v=1.1&format=json&msg_type=TEXT&method=SENDMESSAGE&msg=Welcome+to+GCC%21+%0A%0AYour+OTP+for+GCC+Community+Centre+is+" + // + otp + "+."; + // String sendMsg = whatsappMsgServiceImpl.sendMsg(whatsappMsg); + // System.out.println("sendwhatsuprepsosne====" + sendMsg); + // } catch (Exception e) { + // // System.out.print("ERROR in Sending---: "+e); + // bodyMessage = "Error"; + // } HttpSession session = request.getSession(); session.setAttribute("otp", otp); @@ -1066,11 +1068,26 @@ public class UserAPIController { 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 apikey = "5c995535-6244-11f0-98fc-02c8a5e042bd"; + String from = "919445061913"; + String placeholders = ""; + + placeholders = URLEncoder.encode(bookingId + "|~|" + bookingDetails.getStartDate(), "UTF-8"); + + String cancelledwhatsupmsg = "https://sendapiv1.pinbot.ai/pinwa/sendMessage?apikey=" + apikey + "&from=" + + from + "&to=91" + bookingDetails.getUsers().getMobileNo() + + "&type=template&templateid=3315277&placeholders=" + placeholders; + + // 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 book = bookingDetailsRepository.findById(bookingDetails.getBookingId()); diff --git a/src/main/java/com/gcc/communityHall/controller/UserController.java b/src/main/java/com/gcc/communityHall/controller/UserController.java index 044897ba..9290829b 100644 --- a/src/main/java/com/gcc/communityHall/controller/UserController.java +++ b/src/main/java/com/gcc/communityHall/controller/UserController.java @@ -1,5 +1,7 @@ package com.gcc.communityHall.controller; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; import java.time.LocalDate; import java.util.ArrayList; import java.util.Collections; @@ -241,14 +243,30 @@ public class UserController { System.out.println("usetrtype==" + user.getUsertype().toString()); // System.out.println("employee id"+user.getGovernmentId()); // System.out.println("employee id"+user.getDepartment()); + + String apikey = "5c995535-6244-11f0-98fc-02c8a5e042bd"; + String from = "919445061913"; + String placeholders = ""; + String mobileNo = String.valueOf(user.getMobileNo()); + System.out.println("mobileNo>>>>>>>>>>>" + mobileNo); + if (user.getUsertype() == userType.PUBLIC) { String registersms = "Welcome to GCC, Your User Registration for booking Community Centre is successful."; String registerurlString = "https://tmegov.onex-aura.com/api/sms?key=pfTEYN6H&to=" + user.getMobileNo() + "&from=GCCCRP&body=" + registersms + "&entityid=1401572690000011081&templateid=1407172346621223019"; - String registerwhatsupmsg = "https://media.smsgupshup.com/GatewayAPI/rest?userid=2000233507&password=h2YjFNcJ&send_to=" - + user.getMobileNo() - + "&v=1.1&format=json&msg_type=TEXT&method=SENDMESSAGE&msg=Welcome+to+GCC%2C+%0A%0AYour+User+Registration+for+booking+Community+Centre+is+successful."; + + placeholders = URLEncoder.encode(mobileNo, StandardCharsets.UTF_8); + + String registerwhatsupmsg = "https://sendapiv1.pinbot.ai/pinwa/sendMessage?apikey=" + apikey + "&from=" + + from + "&to=91" + user.getMobileNo() + "" + + "&type=template&templateid=3315165 "; + + // String registerwhatsupmsg = + // "https://media.smsgupshup.com/GatewayAPI/rest?userid=2000233507&password=h2YjFNcJ&send_to=" + // + user.getMobileNo() + // + + // "&v=1.1&format=json&msg_type=TEXT&method=SENDMESSAGE&msg=Welcome+to+GCC%2C+%0A%0AYour+User+Registration+for+booking+Community+Centre+is+successful."; whatsappMsgServiceImpl.sendMsg(registerwhatsupmsg); whatsappMsgServiceImpl.sendSMS(registerurlString); } else { @@ -256,9 +274,20 @@ public class UserController { String registerpendingurlString = "https://tmegov.onex-aura.com/api/sms?key=pfTEYN6H&to=" + user.getMobileNo() + "&from=GCCCRP&body=" + registerpendingsms + "&entityid=1401572690000011081&templateid=1407172346629919381"; - String registerpendingwhatsupmsg = "https://media.smsgupshup.com/GatewayAPI/rest?userid=2000233507&password=h2YjFNcJ&send_to=" - + user.getMobileNo() - + "&v=1.1&format=json&msg_type=TEXT&method=SENDMESSAGE&msg=Welcome+to+GCC%2C+%0A%0AYour+User+Registration+request+for+booking+Community+Centre+submitted+successfully."; + + placeholders = URLEncoder.encode(mobileNo, StandardCharsets.UTF_8); + + String registerpendingwhatsupmsg = "https://sendapiv1.pinbot.ai/pinwa/sendMessage?apikey=" + apikey + + "&from=" + + from + "&to=91" + user.getMobileNo() + "" + + "&type=template&templateid=3315168 "; + + // String registerpendingwhatsupmsg = + // "https://media.smsgupshup.com/GatewayAPI/rest?userid=2000233507&password=h2YjFNcJ&send_to=" + // + user.getMobileNo() + // + + // "&v=1.1&format=json&msg_type=TEXT&method=SENDMESSAGE&msg=Welcome+to+GCC%2C+%0A%0AYour+User+Registration+request+for+booking+Community+Centre+submitted+successfully."; + whatsappMsgServiceImpl.sendMsg(registerpendingwhatsupmsg); whatsappMsgServiceImpl.sendSMS(registerpendingurlString); } diff --git a/src/main/java/com/gcc/communityHall/entity/HallDetails.java b/src/main/java/com/gcc/communityHall/entity/HallDetails.java index f3dbd901..3a73588e 100644 --- a/src/main/java/com/gcc/communityHall/entity/HallDetails.java +++ b/src/main/java/com/gcc/communityHall/entity/HallDetails.java @@ -92,6 +92,9 @@ public class HallDetails { @Column(name = "is_reason_restricted", nullable = false, columnDefinition = "BOOLEAN DEFAULT false") private boolean isReasonRestricted = false; + @Column(name = "mf_dt_unit", columnDefinition = "INT DEFAULT 1") + private int MfDtUnit = 1; + @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "hallDetails") @JsonIgnore private List hallReasonRestrictions; @@ -404,4 +407,12 @@ public class HallDetails { this.halfDepositAmount = halfDepositAmount; } + public int getMfDtUnit() { + return MfDtUnit; + } + + public void setMfDtUnit(int MfDtUnit) { + this.MfDtUnit = MfDtUnit; + } + } diff --git a/src/main/java/com/gcc/communityHall/repository/BookingDetailsRepository.java b/src/main/java/com/gcc/communityHall/repository/BookingDetailsRepository.java index 09a524bd..2d158d12 100644 --- a/src/main/java/com/gcc/communityHall/repository/BookingDetailsRepository.java +++ b/src/main/java/com/gcc/communityHall/repository/BookingDetailsRepository.java @@ -398,7 +398,7 @@ public interface BookingDetailsRepository extends JpaRepository CURDATE() THEN 'Reschedule'\r" - + " WHEN bd.reason IN ('State Govt Event','Central Govt Event','Commericial & Others') AND bd.booking_status='APPROVED' THEN 'noaction'" + + " WHEN bd.reason IN ('State Govt Event','Central Govt Event','Commericial & Others') AND bd.booking_status='APPROVED' THEN 'noaction'" + " ELSE 'Future' \r" + " END AS event_category,\r" + " users.*, \r" diff --git a/src/main/java/com/gcc/communityHall/repository/BookingDocumentsRepository.java b/src/main/java/com/gcc/communityHall/repository/BookingDocumentsRepository.java index 4d73a8ef..574396ca 100644 --- a/src/main/java/com/gcc/communityHall/repository/BookingDocumentsRepository.java +++ b/src/main/java/com/gcc/communityHall/repository/BookingDocumentsRepository.java @@ -1,19 +1,26 @@ package com.gcc.communityHall.repository; +import java.util.List; + import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; import org.springframework.stereotype.Repository; import org.springframework.transaction.annotation.Transactional; -import com.gcc.communityHall.entity.BookingDetails; import com.gcc.communityHall.entity.BookingDocuments; @Repository -public interface BookingDocumentsRepository extends JpaRepository { - +public interface BookingDocumentsRepository extends JpaRepository { + @Transactional @Modifying - @Query(value="delete from booking_documents where booking_details_booking_id = :bookingId",nativeQuery=true) - public void deleteByBookingId(int bookingId); + @Query(value = "delete from booking_documents where booking_details_booking_id = :bookingId", nativeQuery = true) + public void deleteByBookingId(@Param("bookingId") int bookingId); + + @Query(value = "select * from booking_documents where booking_details_booking_id = :bookingId order by booking_doc_id asc", nativeQuery = true) + public List findByBookingId(@Param("bookingId") int bookingId); + } + diff --git a/src/main/java/com/gcc/communityHall/service/HallDetailService.java b/src/main/java/com/gcc/communityHall/service/HallDetailService.java index 70d1274f..00168c5d 100644 --- a/src/main/java/com/gcc/communityHall/service/HallDetailService.java +++ b/src/main/java/com/gcc/communityHall/service/HallDetailService.java @@ -18,6 +18,22 @@ public interface HallDetailService { HallDetails deActivateHallById(int hallId); + // HallDetails saveHallByAdmin( + // String hallName, + // float depositAmount, + // float halfDayAmt, float fullDayAmt, + // float gst, float hallArea, String ebNumber, float ebCostPerUnit, + // String parkingCapacity, int seatingCapacity, + // String doorNo, String street, + // String area, String zone, + // String division, String landMark, + // String city, + // int pinCode, String latitude, + // String longitude, String hallInchargeName, + // long hallInchargeNo, + // String updatedId, + // MultipartFile hallImages[], float halfDepositAmt); + HallDetails saveHallByAdmin( String hallName, float depositAmount, @@ -32,9 +48,28 @@ public interface HallDetailService { String longitude, String hallInchargeName, long hallInchargeNo, String updatedId, - MultipartFile hallImages[], float halfDepositAmt); + MultipartFile hallImages[], float halfDepositAmt, + int mfDtUnit); /** HQ-specific overload that also persists floor details. */ + // HallDetails saveHallByHQ( + // String hallName, + // float depositAmount, + // float halfDayAmt, float fullDayAmt, + // float gst, float hallArea, String ebNumber, float ebCostPerUnit, + // String parkingCapacity, int seatingCapacity, + // String doorNo, String street, + // String area, String zone, + // String division, String landMark, + // String city, + // int pinCode, String latitude, + // String longitude, String hallInchargeName, + // long hallInchargeNo, + // String updatedId, + // MultipartFile[] hallImages, float halfDepositAmt, + // List floorNames, List floorCapacities); + + /** HQ-specific overload that also persists floor details and mfDtUnit. */ HallDetails saveHallByHQ( String hallName, float depositAmount, @@ -50,7 +85,8 @@ public interface HallDetailService { long hallInchargeNo, String updatedId, MultipartFile[] hallImages, float halfDepositAmt, - List floorNames, List floorCapacities); + List floorNames, List floorCapacities, + int mfDtUnit); /** Replaces floor details for an existing hall (delete-and-re-insert). */ void updateFloorDetails(int hallId, List floorNames, List floorCapacities); diff --git a/src/main/java/com/gcc/communityHall/service/Impl/BookingServiceImpl.java b/src/main/java/com/gcc/communityHall/service/Impl/BookingServiceImpl.java index add697ce..c590ee3a 100644 --- a/src/main/java/com/gcc/communityHall/service/Impl/BookingServiceImpl.java +++ b/src/main/java/com/gcc/communityHall/service/Impl/BookingServiceImpl.java @@ -5,6 +5,8 @@ import java.io.FileOutputStream; import java.io.IOException; import java.math.BigDecimal; import java.math.RoundingMode; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; import java.text.ParseException; import java.text.SimpleDateFormat; import java.time.LocalDate; @@ -480,6 +482,10 @@ public class BookingServiceImpl implements BookingService { String bookingconfirmationmsg, urlString, whatsupmsg; + String apikey = "5c995535-6244-11f0-98fc-02c8a5e042bd"; + String from = "919445061913"; + String placeholders = ""; + if (reasonCode.equals("CGE") || reasonCode.equals("CAO") || reasonCode.equals("SGE")) { updateBookingStatusById(bookingDetails.getBookingId(), BookingDetails.BookingStatus.WAITING_FOR_NOC, "Waiting For NOC Documents"); @@ -517,12 +523,21 @@ public class BookingServiceImpl implements BookingService { "&from=GCCCRP&body=" + bookingconfirmationmsg + "&entityid=1401572690000011081&templateid=1407172346459428987"; - whatsupmsg = "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+" + - bookingDetails.getBookingId() + "+on+" + bookingDetails.getStartDate() + - "+has+been+successfully+confirmed.+%0AThanks+for+using+GCC+Community+Hall+Booking+System."; + placeholders = URLEncoder.encode(bookingDetails.getBookingId() + "|~|" + bookingDetails.getStartDate(), + "UTF-8"); + + whatsupmsg = "https://sendapiv1.pinbot.ai/pinwa/sendMessage?apikey=" + apikey + "&from=" + + from + "&to=91" + bookingDetails.getUsers().getMobileNo() + "" + + "&type=template&templateid=3315197&placeholders=" + placeholders + ""; + + // whatsupmsg = + // "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+" + // + + // bookingDetails.getBookingId() + "+on+" + bookingDetails.getStartDate() + + // "+has+been+successfully+confirmed.+%0AThanks+for+using+GCC+Community+Hall+Booking+System."; whatsappMsgServiceImpl.sendMsg(whatsupmsg); whatsappMsgServiceImpl.sendSMS(urlString); @@ -1465,7 +1480,8 @@ public class BookingServiceImpl implements BookingService { double usedUnit = Math.floor((endUnit - startReading) * 100) / 100.0; ed.setUsedUnit(Float.parseFloat(usedUnit + "")); float costPerUnit = bd.getHallDetails().getEbCostPerUnit(); - double ebAmount = Math.floor((usedUnit * costPerUnit) * 100) / 100.0; + int mfDtUnit = bd.getHallDetails().getMfDtUnit(); + double ebAmount = Math.floor((usedUnit * mfDtUnit * costPerUnit) * 100) / 100.0; ed.setEbAmount(ebAmount); ed.setUpdatedDate(new Date()); return ebDetailsRepository.save(ed); @@ -2024,12 +2040,29 @@ public class BookingServiceImpl implements BookingService { String settlementrefundurlString = "https://tmegov.onex-aura.com/api/sms?key=pfTEYN6H&to=" + bookings.getUsers().getMobileNo() + "&from=GCCCRP&body=" + settlementrefundsms + "&entityid=1401572690000011081&templateid=1407172346804951524"; - String settlementrefundwhatsupmsg = "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+refund+of+Rs.+" - + bookingDetails.getSettlement().getRefundedAmount() + "+for+Booking+ID+" - + bookingDetails.getBookingId() - + "+has+been+initiated.+%0AThe+amount+will+be+credited+to+your+account+within+3+to+15+days."; + + String apikey = "5c995535-6244-11f0-98fc-02c8a5e042bd"; + String from = "919445061913"; + String placeholders = ""; + + placeholders = URLEncoder.encode( + bookingDetails.getBookingId() + "|~|" + bookingDetails.getSettlement().getRefundedAmount(), + "UTF-8"); + + String settlementrefundwhatsupmsg = "https://sendapiv1.pinbot.ai/pinwa/sendMessage?apikey=" + apikey + + "&from=" + + from + "&to=91" + bookingDetails.getUsers().getMobileNo() + "" + + "&type=template&templateid=3315255&placeholders=" + placeholders + ""; + + // String settlementrefundwhatsupmsg = + // "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+refund+of+Rs.+" + // + bookingDetails.getSettlement().getRefundedAmount() + "+for+Booking+ID+" + // + bookingDetails.getBookingId() + // + + // "+has+been+initiated.+%0AThe+amount+will+be+credited+to+your+account+within+3+to+15+days."; whatsappMsgServiceImpl.sendMsg(settlementrefundwhatsupmsg); whatsappMsgServiceImpl.sendSMS(settlementrefundurlString); return true; @@ -2054,11 +2087,28 @@ public class BookingServiceImpl implements BookingService { String rejectedrefundurlString = "https://tmegov.onex-aura.com/api/sms?key=pfTEYN6H&to=" + rejectedbookings.getUsers().getMobileNo() + "&from=GCCCRP&body=" + rejectedsms + "&entityid=1401572690000011081&templateid=1407172346804951524"; - String settlementrefundwhatsupmsg = "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+refund+of+Rs.+" - + bookingDetails.getAmountReceived() + "+for+Booking+ID+" + bookingDetails.getBookingId() - + "+has+been+initiated.+%0AThe+amount+will+be+credited+to+your+account+within+3+to+15+days."; + + String apikey = "5c995535-6244-11f0-98fc-02c8a5e042bd"; + String from = "919445061913"; + String placeholders = ""; + + placeholders = URLEncoder + .encode(bookingDetails.getBookingId() + "|~|" + bookingDetails.getAmountReceived(), "UTF-8"); + + String settlementrefundwhatsupmsg = "https://sendapiv1.pinbot.ai/pinwa/sendMessage?apikey=" + apikey + + "&from=" + + from + "&to=91" + bookingDetails.getUsers().getMobileNo() + "" + + "&type=template&templateid=3315255&placeholders=" + placeholders + ""; + + // String settlementrefundwhatsupmsg = + // "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+refund+of+Rs.+" + // + bookingDetails.getAmountReceived() + "+for+Booking+ID+" + + // bookingDetails.getBookingId() + // + + // "+has+been+initiated.+%0AThe+amount+will+be+credited+to+your+account+within+3+to+15+days."; whatsappMsgServiceImpl.sendMsg(settlementrefundwhatsupmsg); whatsappMsgServiceImpl.sendSMS(rejectedrefundurlString); return true; @@ -2085,11 +2135,28 @@ public class BookingServiceImpl implements BookingService { String cancelledrefundurlString = "https://tmegov.onex-aura.com/api/sms?key=pfTEYN6H&to=" + cancelledbookings.getUsers().getMobileNo() + "&from=GCCCRP&body=" + cancelledsms + "&entityid=1401572690000011081&templateid=1407172346804951524"; - String settlementrefundwhatsupmsg = "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+refund+of+Rs.+" - + bookingDetails.getDepositAmount() + "+for+Booking+ID+" + bookingDetails.getBookingId() - + "+has+been+initiated.+%0AThe+amount+will+be+credited+to+your+account+within+3+to+15+days."; + + String apikey = "5c995535-6244-11f0-98fc-02c8a5e042bd"; + String from = "919445061913"; + String placeholders = ""; + + placeholders = URLEncoder + .encode(bookingDetails.getBookingId() + "|~|" + bookingDetails.getDepositAmount(), "UTF-8"); + + String settlementrefundwhatsupmsg = "https://sendapiv1.pinbot.ai/pinwa/sendMessage?apikey=" + apikey + + "&from=" + + from + "&to=91" + bookingDetails.getUsers().getMobileNo() + "" + + "&type=template&templateid=3315255&placeholders=" + placeholders + ""; + + // String settlementrefundwhatsupmsg = + // "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+refund+of+Rs.+" + // + bookingDetails.getDepositAmount() + "+for+Booking+ID+" + + // bookingDetails.getBookingId() + // + + // "+has+been+initiated.+%0AThe+amount+will+be+credited+to+your+account+within+3+to+15+days."; whatsappMsgServiceImpl.sendMsg(settlementrefundwhatsupmsg); whatsappMsgServiceImpl.sendSMS(cancelledrefundurlString); return true; @@ -2282,17 +2349,31 @@ public class BookingServiceImpl implements BookingService { // transactionManager.rollback(status); updateResheduledBookingDetails(bookingId, startDat, endDat); + String apikey = "5c995535-6244-11f0-98fc-02c8a5e042bd"; + String from = "919445061913"; + String placeholders = ""; + String rescheduledmsg = "Your booking ID " + bookingId + " on " + starting + " has been successfully rescheduled to " + startDate + ". Thanks for using the GCC Community Hall Booking System."; String urlString = "https://tmegov.onex-aura.com/api/sms?key=pfTEYN6H&to=" + bookingDetails.getUsers().getMobileNo() + "&from=GCCCRP&body=" + rescheduledmsg + "&entityid=1401572690000011081&templateid=1407172346565044999"; - String rescheduleMsg = "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+" + starting + "+has+been+successfully+rescheduled+to+" + startDate - + "+.+%0AThank+you+for+using+the+GCC+Community+Hall+Booking+System."; + + placeholders = URLEncoder.encode(bookingId + "|~|" + starting + "|~|" + startDate, StandardCharsets.UTF_8); + + String rescheduleMsg = "https://sendapiv1.pinbot.ai/pinwa/sendMessage?apikey=" + apikey + "&from=" + + from + "&to=91" + bookingDetails.getUsers().getMobileNo() + "" + + "&type=template&templateid=3315236&placeholders=" + placeholders + ""; + + // String rescheduleMsg = + // "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+" + starting + "+has+been+successfully+rescheduled+to+" + startDate + // + "+.+%0AThank+you+for+using+the+GCC+Community+Hall+Booking+System."; whatsappMsgServiceImpl.sendMsg(rescheduleMsg); whatsappMsgServiceImpl.sendSMS(urlString); return Optional.of("Booking dates updated successfully."); @@ -2415,17 +2496,31 @@ public class BookingServiceImpl implements BookingService { // Persist new dates and slots updateResheduledBookingDetails(bookingId, startDat, endDat, startingSlot, endingSlot); + String apikey = "5c995535-6244-11f0-98fc-02c8a5e042bd"; + String from = "919445061913"; + String placeholders = ""; + String rescheduledmsg = "Your booking ID " + bookingId + " on " + starting + " has been successfully rescheduled to " + startDate + ". Thanks for using the GCC Community Hall Booking System."; String urlString = "https://tmegov.onex-aura.com/api/sms?key=pfTEYN6H&to=" + bookingDetails.getUsers().getMobileNo() + "&from=GCCCRP&body=" + rescheduledmsg + "&entityid=1401572690000011081&templateid=1407172346565044999"; - String rescheduleMsg = "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+" + starting + "+has+been+successfully+rescheduled+to+" + startDate - + "+.+%0AThank+you+for+using+the+GCC+Community+Hall+Booking+System."; + + placeholders = URLEncoder.encode(bookingId + "|~|" + starting + "|~|" + startDate, StandardCharsets.UTF_8); + + String rescheduleMsg = "https://sendapiv1.pinbot.ai/pinwa/sendMessage?apikey=" + apikey + "&from=" + + from + "&to=91" + bookingDetails.getUsers().getMobileNo() + "" + + "&type=template&templateid=3315236&placeholders=" + placeholders + ""; + + // String rescheduleMsg = + // "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+" + starting + "+has+been+successfully+rescheduled+to+" + startDate + // + "+.+%0AThank+you+for+using+the+GCC+Community+Hall+Booking+System."; whatsappMsgServiceImpl.sendMsg(rescheduleMsg); whatsappMsgServiceImpl.sendSMS(urlString); return Optional.of("Booking dates updated successfully."); @@ -2673,11 +2768,27 @@ public class BookingServiceImpl implements BookingService { + "&entityid=1401572690000011081&templateid=1407172346521513227"; // String // gccblockedwhatsupmsg="https://media.smsgupshup.com/GatewayAPI/rest?userid=2000233507&password=h2YjFNcJ&send_to="+booking.getUsers().getMobileNo()+"&v=1.1&format=json&msg_type=TEXT&method=SENDMESSAGE&msg=Your+booking+with+ID+"+booking.getBookingId()+"+on+"+booking.getBookingDate()+"+has+been+blocked+by+GCC+due+to+"+reasonforblocking+".+%0AThanks+for+using+GCC+Community+Hall+Booking+System."; - String gccblockedwhatsupmsg = "https://media.smsgupshup.com/GatewayAPI/rest?userid=2000233507&password=h2YjFNcJ&send_to=" - + booking.getUsers().getMobileNo() - + "&v=1.1&format=json&msg_type=TEXT&method=SENDMESSAGE&msg=Your+booking+with+ID+" - + booking.getBookingId() + "+on+" + booking.getStartDate() - + "+has+been+blocked+by+the+GCC+due+to+Goverment+event++.+%0AThe+entire+amount+paid+will+be+refunded+to+your+account+within+3+to+15+days."; + + String apikey = "5c995535-6244-11f0-98fc-02c8a5e042bd"; + String from = "919445061913"; + String placeholders = ""; + + placeholders = URLEncoder.encode(booking.getBookingId() + "|~|" + booking.getStartDate(), + StandardCharsets.UTF_8); + + String gccblockedwhatsupmsg = "https://sendapiv1.pinbot.ai/pinwa/sendMessage?apikey=" + apikey + + "&from=" + + from + "&to=91" + booking.getUsers().getMobileNo() + "" + + "&type=template&templateid=3315251&placeholders=" + placeholders + ""; + + // String gccblockedwhatsupmsg = + // "https://media.smsgupshup.com/GatewayAPI/rest?userid=2000233507&password=h2YjFNcJ&send_to=" + // + booking.getUsers().getMobileNo() + // + + // "&v=1.1&format=json&msg_type=TEXT&method=SENDMESSAGE&msg=Your+booking+with+ID+" + // + booking.getBookingId() + "+on+" + booking.getStartDate() + // + + // "+has+been+blocked+by+the+GCC+due+to+Goverment+event++.+%0AThe+entire+amount+paid+will+be+refunded+to+your+account+within+3+to+15+days."; whatsappMsgServiceImpl.sendMsg(gccblockedwhatsupmsg); whatsappMsgServiceImpl.sendSMS(gccblockedurlString); bookingDetailsRepository.save(booking); diff --git a/src/main/java/com/gcc/communityHall/service/Impl/HallDetailServiceImpl.java b/src/main/java/com/gcc/communityHall/service/Impl/HallDetailServiceImpl.java index 41a08840..4231e27c 100644 --- a/src/main/java/com/gcc/communityHall/service/Impl/HallDetailServiceImpl.java +++ b/src/main/java/com/gcc/communityHall/service/Impl/HallDetailServiceImpl.java @@ -72,6 +72,25 @@ public class HallDetailServiceImpl implements HallDetailService { return null; } + // @Override + // public HallDetails saveHallByAdmin( + // String hallName, float depositAmount, float halfDayAmt, + // float fullDayAmt, float gst, float hallArea, String ebNumber, float + // ebCostPerUnit, + // String parkingCapacity, int seatingCapacity, + // String doorNo, String street, String area, String zone, + // String division, String landMark, String city, int pinCode, + // String latitude, String longitude, String hallInchargeName, + // long hallInchargeNo, String updatedId, MultipartFile[] hallImages, float + // halfDepositAmt) { + // return saveHallByAdmin(hallName, depositAmount, halfDayAmt, fullDayAmt, gst, + // hallArea, ebNumber, ebCostPerUnit, + // parkingCapacity, seatingCapacity, doorNo, street, area, zone, division, + // landMark, city, pinCode, + // latitude, longitude, hallInchargeName, hallInchargeNo, updatedId, hallImages, + // halfDepositAmt, 1); + // } + @Override public HallDetails saveHallByAdmin( String hallName, float depositAmount, float halfDayAmt, @@ -80,7 +99,8 @@ public class HallDetailServiceImpl implements HallDetailService { String doorNo, String street, String area, String zone, String division, String landMark, String city, int pinCode, String latitude, String longitude, String hallInchargeName, - long hallInchargeNo, String updatedId, MultipartFile[] hallImages, float halfDepositAmt) { + long hallInchargeNo, String updatedId, MultipartFile[] hallImages, float halfDepositAmt, + int mfDtUnit) { HallDetails hall = new HallDetails(); hall.setHallName(hallName); hall.setDoorNo(doorNo); @@ -107,6 +127,7 @@ public class HallDetailServiceImpl implements HallDetailService { hall.setUpdatedId(updatedId); hall.setCreateddate(LocalDate.now()); hall.setHalfDepositAmount(halfDepositAmt); + hall.setMfDtUnit(mfDtUnit); HallDetails hallDetails = hallDetailsRepository.save(hall); if (hallImages != null && hallImages.length > 0) { int i = 0; @@ -136,6 +157,31 @@ public class HallDetailServiceImpl implements HallDetailService { /** * HQ-specific overload: saves hall details + floor details in one call. */ + // @Override + // public HallDetails saveHallByHQ( + // String hallName, float depositAmount, float halfDayAmt, + // float fullDayAmt, float gst, float hallArea, String ebNumber, float + // ebCostPerUnit, + // String parkingCapacity, int seatingCapacity, + // String doorNo, String street, String area, String zone, + // String division, String landMark, String city, int pinCode, + // String latitude, String longitude, String hallInchargeName, + // long hallInchargeNo, String updatedId, MultipartFile[] hallImages, float + // halfDepositAmt, + // List floorNames, List floorCapacities) { + // return saveHallByHQ(hallName, depositAmount, halfDayAmt, fullDayAmt, gst, + // hallArea, ebNumber, ebCostPerUnit, + // parkingCapacity, seatingCapacity, doorNo, street, area, zone, division, + // landMark, city, pinCode, + // latitude, longitude, hallInchargeName, hallInchargeNo, updatedId, hallImages, + // halfDepositAmt, + // floorNames, floorCapacities, 1); + // } + + /** + * HQ-specific overload: saves hall details + floor details + mfDtUnit in one + * call. + */ @Override public HallDetails saveHallByHQ( String hallName, float depositAmount, float halfDayAmt, @@ -145,14 +191,15 @@ public class HallDetailServiceImpl implements HallDetailService { String division, String landMark, String city, int pinCode, String latitude, String longitude, String hallInchargeName, long hallInchargeNo, String updatedId, MultipartFile[] hallImages, float halfDepositAmt, - List floorNames, List floorCapacities) { + List floorNames, List floorCapacities, + int mfDtUnit) { // Reuse the existing saveHall to persist the hall + images saveHallByAdmin(hallName, depositAmount, halfDayAmt, fullDayAmt, gst, hallArea, ebNumber, ebCostPerUnit, parkingCapacity, seatingCapacity, doorNo, street, area, zone, division, landMark, city, pinCode, latitude, longitude, hallInchargeName, hallInchargeNo, - updatedId, hallImages, halfDepositAmt); + updatedId, hallImages, halfDepositAmt, mfDtUnit); // Fetch the just-saved hall to get its generated ID // (the hall is the most recently inserted one with this name) @@ -310,6 +357,7 @@ public class HallDetailServiceImpl implements HallDetailService { existingHall.setEbCostPerUnit(hallDetails.getEbCostPerUnit()); existingHall.setActive(hallDetails.isActive()); existingHall.setEbNumber(hallDetails.getEbNumber()); + existingHall.setMfDtUnit(hallDetails.getMfDtUnit()); // Update images if (images != null) { diff --git a/src/main/resources/templates/admin/refund-failedlist.html b/src/main/resources/templates/admin/refund-failedlist.html index 15ec0c31..d691c7e4 100644 --- a/src/main/resources/templates/admin/refund-failedlist.html +++ b/src/main/resources/templates/admin/refund-failedlist.html @@ -74,7 +74,8 @@
- +
@@ -131,7 +132,8 @@
-
S.no
+
@@ -155,8 +157,7 @@ - + - +
S.no

- +
@@ -365,49 +367,53 @@ - +
S.no
Ending Slot:
+
+
+
+
+ - + - - + + - + + - - + + - - + - - - -
EB - DetailsEB Details
Consumer Number:Consumer + Number: + + EB Amount Per - Unit: + MF DT Unit: +
Start Reading: END Reading: + Unit Consumed: -
END Reading: - EB Amount:
@@ -795,7 +801,7 @@ -
+
@@ -803,7 +809,7 @@ diff --git a/src/main/resources/templates/admin/reports.html b/src/main/resources/templates/admin/reports.html index 453eab54..86a52bf2 100644 --- a/src/main/resources/templates/admin/reports.html +++ b/src/main/resources/templates/admin/reports.html @@ -1080,9 +1080,7 @@
- + - + + + + - - - -
EB - Details - EB Details
@@ -1093,8 +1091,11 @@ EB Amount Per Unit (in Rs): MF DT Unit:
@@ -1103,24 +1104,23 @@ - Unit Consumed: + END Reading: + Unit Consumed: +
- END Reading: - EB Amount (in Rs):
@@ -2008,6 +2008,7 @@ document.getElementById("td_endingReading").innerHTML = response.ebDetails.endingReading; document.getElementById("td_usedunit").innerHTML = response.ebDetails.usedUnit; document.getElementById("td_ebamountperunit").innerHTML = parseFloat(response.hallDetails.ebCostPerUnit).toFixed(2); + document.getElementById("td_mfDtUnit").innerHTML = (response.hallDetails && response.hallDetails.mfDtUnit != null) ? parseFloat(response.hallDetails.mfDtUnit).toFixed(2) : "0.00"; document.getElementById("td_electricityamount").innerHTML = parseFloat(response.ebDetails.ebAmount).toFixed(2); } else { diff --git a/src/main/resources/templates/admin/settlement-approved.html b/src/main/resources/templates/admin/settlement-approved.html index 592d5dd8..cf1e070b 100644 --- a/src/main/resources/templates/admin/settlement-approved.html +++ b/src/main/resources/templates/admin/settlement-approved.html @@ -400,49 +400,46 @@
Ending Slot:
+
+
+
+
+ - + - - - - + + + + - - - - - - + + + + - - - -
EB - DetailsEB Details
Consumer Number:EB Amount Per - Unit:Consumer Number: + + + EB Amount Per Unit: + MF DT Unit:
Start Reading: - Start Reading: + Unit Consumed: - - END Reading:Unit Consumed:
END Reading: - EB Amount:
@@ -933,6 +930,7 @@ document.getElementById("td_endingReading").innerHTML = list.ebDetails.endingReading; document.getElementById("td_usedunit").innerHTML = list.ebDetails.usedUnit; document.getElementById("td_ebamountperunit").innerHTML = '₹ ' + parseFloat(list.hallDetails.ebCostPerUnit).toFixed(2); + document.getElementById("td_mfDtUnit").innerHTML = '₹ ' + parseFloat(list.hallDetails.mfDtUnit).toFixed(2); document.getElementById("td_depositeamountforrefund").innerHTML = '₹ ' + parseFloat(list.depositAmount).toFixed(2); document.getElementById("td_electricityamount").innerHTML = '₹ ' + parseFloat(list.ebDetails.ebAmount).toFixed(2); document.getElementById("td_ebAmount").innerHTML = '₹ ' + parseFloat(list.ebDetails.ebAmount).toFixed(2); diff --git a/src/main/resources/templates/admin/settlement-completed.html b/src/main/resources/templates/admin/settlement-completed.html index 5393b63c..0f582933 100644 --- a/src/main/resources/templates/admin/settlement-completed.html +++ b/src/main/resources/templates/admin/settlement-completed.html @@ -1,22 +1,26 @@ + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/templates/cro/noc-details.html b/src/main/resources/templates/cro/noc-details.html index e69de29b..27195e9a 100644 --- a/src/main/resources/templates/cro/noc-details.html +++ b/src/main/resources/templates/cro/noc-details.html @@ -0,0 +1,860 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/templates/fragments/Details.html b/src/main/resources/templates/fragments/Details.html index 37e6268b..4d4013f2 100644 --- a/src/main/resources/templates/fragments/Details.html +++ b/src/main/resources/templates/fragments/Details.html @@ -46,8 +46,9 @@ style="font-weight: bold; background-color: #404E67; color: white; padding: 8px; border-radius: 5px;"> Payment Details: - -
+ +

Transaction Id:

- -
-

Transaction Id: NA

-

Payment Status: NA

-

Total Amount Paid: NA

+ +
+

Transaction Id: + +

+

Payment Status: + Payment Not Confirmed. +

+

+ If your amount is debited, it will be refunded with in 7 to 15 working days. +

@@ -139,18 +148,24 @@

Booking Status: - FAILURE

+ FAILURE

Refund Status: - Refund has to be initiated. + Refund + has to be initiated.

Booking Status: - FAILURE

+ FAILURE

Refund Status: - Refund Initiated. + Refund + Initiated.

diff --git a/src/main/resources/templates/fragments/croMenu.html b/src/main/resources/templates/fragments/croMenu.html index 25e061dd..0aed26f8 100644 --- a/src/main/resources/templates/fragments/croMenu.html +++ b/src/main/resources/templates/fragments/croMenu.html @@ -6,7 +6,7 @@ Reschedule Booking - - + th:if="${booking.booking_status == 'APPROVED' and booking.schedule_count < 1}"> + + - + - + + - - + id="td_endingReading"> - + id="td_usedunit"> + + - -
EB - Details - EB Details
EB Amount Per Unit (in Rs): + MF DT Unit: +
- Unit Consumed: + END Reading:
- END Reading: + Unit Consumed:
EB Amount (in Rs):
@@ -2036,6 +2041,7 @@ document.getElementById("td_endingReading").innerHTML = response.ebDetails.endingReading; document.getElementById("td_usedunit").innerHTML = response.ebDetails.usedUnit; document.getElementById("td_ebamountperunit").innerHTML = parseFloat(response.hallDetails.ebCostPerUnit).toFixed(2); + document.getElementById("td_mfDtUnit").innerHTML = (response.hallDetails && response.hallDetails.mfDtUnit != null) ? parseFloat(response.hallDetails.mfDtUnit).toFixed(2) : "0.00"; document.getElementById("td_electricityamount").innerHTML = parseFloat(response.ebDetails.ebAmount).toFixed(2); } else {