@ -1,4 +1,5 @@
package com.gcc.communityHall.controller ;
package com.gcc.communityHall.controller ;
import java.net.InetAddress ;
import java.net.InetAddress ;
import java.net.UnknownHostException ;
import java.net.UnknownHostException ;
import java.util.ArrayList ;
import java.util.ArrayList ;
@ -146,28 +147,26 @@ public class Admincontroller {
@GetMapping ( "/Reports" )
@GetMapping ( "/Reports" )
public String viewReports ( Model model , HttpSession session )
{
public String viewReports ( Model model , HttpSession session ) {
String adminname = ( String ) session . getAttribute ( "usertype" ) ;
String adminname = ( String ) session . getAttribute ( "usertype" ) ;
if ( adminname ! = null ) {
if ( adminname ! = null ) {
long mobileno = ( long ) session . getAttribute ( "mobileno" ) ;
long mobileno = ( long ) session . getAttribute ( "mobileno" ) ;
model . addAttribute ( "mobileno" , mobileno ) ;
model . addAttribute ( "mobileno" , mobileno ) ;
return "admin/reports" ;
return "admin/reports" ;
} else {
} else {
session . invalidate ( ) ; / / Invalidate the session to clear all session attributes
session . invalidate ( ) ; / / Invalidate the session to clear all session attributes
return "redirect:/communityhall/login" ;
return "redirect:/communityhall/login" ;
}
}
}
}
@GetMapping ( "/getReport" )
@GetMapping ( "/getReport" )
public String getReports ( Model model , HttpSession session )
{
public String getReports ( Model model , HttpSession session ) {
String adminname = ( String ) session . getAttribute ( "usertype" ) ;
String adminname = ( String ) session . getAttribute ( "usertype" ) ;
if ( adminname ! = null ) {
if ( adminname ! = null ) {
long mobileno = ( long ) session . getAttribute ( "mobileno" ) ;
long mobileno = ( long ) session . getAttribute ( "mobileno" ) ;
model . addAttribute ( "mobileno" , mobileno ) ;
model . addAttribute ( "mobileno" , mobileno ) ;
return "admin/reports" ;
return "admin/reports" ;
} else {
} else {
session . invalidate ( ) ; / / Invalidate the session to clear all session attributes
session . invalidate ( ) ; / / Invalidate the session to clear all session attributes
return "redirect:/communityhall/login" ;
return "redirect:/communityhall/login" ;
}
}
@ -175,30 +174,30 @@ public class Admincontroller {
@GetMapping ( "/HallDetails" )
@GetMapping ( "/HallDetails" )
public String viewHallDetails ( Model model , HttpSession session )
{
public String viewHallDetails ( Model model , HttpSession session ) {
String adminname = ( String ) session . getAttribute ( "usertype" ) ;
String adminname = ( String ) session . getAttribute ( "usertype" ) ;
if ( adminname ! = null ) {
if ( adminname ! = null ) {
long mobileno = ( long ) session . getAttribute ( "mobileno" ) ;
long mobileno = ( long ) session . getAttribute ( "mobileno" ) ;
model . addAttribute ( "mobileno" , mobileno ) ;
model . addAttribute ( "mobileno" , mobileno ) ;
return "admin/halldetailslist" ;
return "admin/halldetailslist" ;
} else {
} else {
session . invalidate ( ) ; / / Invalidate the session to clear all session attributes
session . invalidate ( ) ; / / Invalidate the session to clear all session attributes
return "redirect:/communityhall/login" ;
return "redirect:/communityhall/login" ;
}
}
}
}
@GetMapping ( "/halldetailslist" )
@GetMapping ( "/halldetailslist" )
public String viewhalldetailsList ( Model model , HttpSession session ) {
List < HallDetails > list = hallDetailsRepo . findAll ( ) ;
public String viewhalldetailsList ( Model model , HttpSession session ) {
List < HallDetails > list = hallDetailsRepo . findAll ( ) ;
String adminname = ( String ) session . getAttribute ( "usertype" ) ;
String adminname = ( String ) session . getAttribute ( "usertype" ) ;
if ( adminname ! = null ) {
if ( adminname ! = null ) {
long mobileno = ( long ) session . getAttribute ( "mobileno" ) ;
long mobileno = ( long ) session . getAttribute ( "mobileno" ) ;
model . addAttribute ( "mobileno" , mobileno ) ;
model . addAttribute ( "mobileno" , mobileno ) ;
model . addAttribute ( "adminname" , adminname ) ;
model . addAttribute ( "adminname" , adminname ) ;
model . addAttribute ( "halllist" , list ) ;
model . addAttribute ( "halllist" , list ) ;
return "admin/halldetailslist" ;
return "admin/halldetailslist" ;
} else {
} else {
session . invalidate ( ) ; / / Invalidate the session to clear all session attributes
session . invalidate ( ) ; / / Invalidate the session to clear all session attributes
return "redirect:/communityhall/login" ;
return "redirect:/communityhall/login" ;
}
}
@ -208,142 +207,145 @@ public class Admincontroller {
@GetMapping ( "/settlement-approved" )
@GetMapping ( "/settlement-approved" )
public String viewSettlementMaster ( Model model , HttpSession session ) {
public String viewSettlementMaster ( Model model , HttpSession session ) {
String adminname = ( String ) session . getAttribute ( "usertype" ) ;
String adminname = ( String ) session . getAttribute ( "usertype" ) ;
if ( adminname ! = null ) {
if ( adminname ! = null ) {
long mobileno = ( long ) session . getAttribute ( "mobileno" ) ;
long mobileno = ( long ) session . getAttribute ( "mobileno" ) ;
model . addAttribute ( "mobileno" , mobileno ) ;
model . addAttribute ( "mobileno" , mobileno ) ;
List < BookingDetails > approvedSettlements = bookingDetailsRepository . findAllWithApprovedRefundStatus ( ) ;
List < BookingDetails > approvedSettlements = bookingDetailsRepository . findAllWithApprovedRefundStatus ( ) ;
List < BookingDetails > settlements = new ArrayList < > ( ) ;
List < BookingDetails > settlements = new ArrayList < > ( ) ;
settlements . addAll ( approvedSettlements ) ;
settlements . addAll ( approvedSettlements ) ;
List < BookingDetails > approvedcancelledbookings = bookingDetailsRepository . findCancelledList ( ) ;
List < BookingDetails > approvedrejectedbookings = bookingDetailsRepository . findRejectedList ( ) ;
List < BookingDetails > approvedcancelledbookings = bookingDetailsRepository . findCancelledList ( ) ;
List < BookingDetails > approvedrejectedbookings = bookingDetailsRepository . findRejectedList ( ) ;
model . addAttribute ( "adminname" , adminname ) ;
model . addAttribute ( "adminname" , adminname ) ;
model . addAttribute ( "settlementlist" , settlements ) ;
model . addAttribute ( "settlementlist" , settlements ) ;
model . addAttribute ( "approvedcancelledbookings" , approvedcancelledbookings ) ;
model . addAttribute ( "approvedrejectedbookings" , approvedrejectedbookings ) ;
model . addAttribute ( "approvedcancelledbookings" , approvedcancelledbookings ) ;
model . addAttribute ( "approvedrejectedbookings" , approvedrejectedbookings ) ;
return "admin/settlement-approved" ;
return "admin/settlement-approved" ;
} else {
} else {
session . invalidate ( ) ; / / Invalidate the session to clear all session attributes
session . invalidate ( ) ; / / Invalidate the session to clear all session attributes
return "redirect:/communityhall/login" ;
return "redirect:/communityhall/login" ;
}
}
}
}
@GetMapping ( "/settlement-initiatedlist" )
@GetMapping ( "/settlement-initiatedlist" )
public String viewSettlementInitiatedMaster ( Model model , HttpSession session ) {
public String viewSettlementInitiatedMaster ( Model model , HttpSession session ) {
String adminname = ( String ) session . getAttribute ( "usertype" ) ;
String adminname = ( String ) session . getAttribute ( "usertype" ) ;
if ( adminname ! = null ) {
if ( adminname ! = null ) {
long mobileno = ( long ) session . getAttribute ( "mobileno" ) ;
long mobileno = ( long ) session . getAttribute ( "mobileno" ) ;
model . addAttribute ( "mobileno" , mobileno ) ;
model . addAttribute ( "mobileno" , mobileno ) ;
List < BookingDetails > settlement = bookingDetailsRepository . findByBookingDetailsRefundStatus ( ) ;
List < BookingDetails > Initiatedcancelledbookings = bookingDetailsRepository . findInitiatedCancelledList ( ) ;
List < BookingDetails > Initiatedrejectedbookings = bookingDetailsRepository . findInitiatedRejectedList ( ) ;
model . addAttribute ( "title" , "settlement initiate" ) ;
List < BookingDetails > settlement = bookingDetailsRepository . findByBookingDetailsRefundStatus ( ) ;
List < BookingDetails > Initiatedcancelledbookings = bookingDetailsRepository . findInitiatedCancelledList ( ) ;
List < BookingDetails > Initiatedrejectedbookings = bookingDetailsRepository . findInitiatedRejectedList ( ) ;
model . addAttribute ( "title" , "settlement initiate" ) ;
model . addAttribute ( "adminname" , adminname ) ;
model . addAttribute ( "adminname" , adminname ) ;
model . addAttribute ( "settlementlist" , settlement ) ;
model . addAttribute ( "Initiatedcancelledbookings" , Initiatedcancelledbookings ) ;
model . addAttribute ( "Initiatedrejectedbookings" , Initiatedrejectedbookings ) ;
model . addAttribute ( "settlementlist" , settlement ) ;
model . addAttribute ( "Initiatedcancelledbookings" , Initiatedcancelledbookings ) ;
model . addAttribute ( "Initiatedrejectedbookings" , Initiatedrejectedbookings ) ;
return "admin/settlement-initiate" ;
return "admin/settlement-initiate" ;
} else {
} else {
session . invalidate ( ) ; / / Invalidate the session to clear all session attributes
session . invalidate ( ) ; / / Invalidate the session to clear all session attributes
return "redirect:/communityhall/login" ;
return "redirect:/communityhall/login" ;
}
}
}
}
@GetMapping ( "/settlement-list" )
@GetMapping ( "/settlement-list" )
public String settlementPendingList ( Model model , HttpSession session ) {
public String settlementPendingList ( Model model , HttpSession session ) {
String adminname = ( String ) session . getAttribute ( "usertype" ) ;
String adminname = ( String ) session . getAttribute ( "usertype" ) ;
if ( adminname ! = null ) {
if ( adminname ! = null ) {
model . addAttribute ( "adminname" , adminname ) ;
model . addAttribute ( "adminname" , adminname ) ;
long mobileno = ( long ) session . getAttribute ( "mobileno" ) ;
long mobileno = ( long ) session . getAttribute ( "mobileno" ) ;
model . addAttribute ( "mobileno" , mobileno ) ;
model . addAttribute ( "mobileno" , mobileno ) ;
model . addAttribute ( "title" , "settlement Pending" ) ;
model . addAttribute ( "title" , "settlement Pending" ) ;
String zone = ( String ) session . getAttribute ( "zone" ) ;
String zone = ( String ) session . getAttribute ( "zone" ) ;
model . addAttribute ( "zone" , zone ) ;
model . addAttribute ( "zone" , zone ) ;
List < BookingDetails > settlement = bookingDetailsRepository . findAllSettlementPending ( ) ;
List < BookingDetails > cancelledbookings = bookingDetailsRepository . findAllSettlementCancelledList ( ) ;
List < BookingDetails > rejectedbookings = bookingDetailsRepository . findAllSettlementRejectedList ( ) ;
model . addAttribute ( "settlementlist" , settlement ) ;
model . addAttribute ( "cancelledbookings" , cancelledbookings ) ;
model . addAttribute ( "rejectedbookings" , rejectedbookings ) ;
List < BookingDetails > settlement = bookingDetailsRepository . findAllSettlementPending ( ) ;
List < BookingDetails > cancelledbookings = bookingDetailsRepository . findAllSettlementCancelledList ( ) ;
List < BookingDetails > rejectedbookings = bookingDetailsRepository . findAllSettlementRejectedList ( ) ;
model . addAttribute ( "settlementlist" , settlement ) ;
model . addAttribute ( "cancelledbookings" , cancelledbookings ) ;
model . addAttribute ( "rejectedbookings" , rejectedbookings ) ;
return "admin/settlement-list" ;
return "admin/settlement-list" ;
} else {
} else {
session . invalidate ( ) ;
session . invalidate ( ) ;
return "redirect:/communityhall/login" ;
return "redirect:/communityhall/login" ;
}
}
}
}
@GetMapping ( "/refundfailed-list" )
@GetMapping ( "/refundfailed-list" )
public String RefundFailedList ( Model model , HttpSession session ) {
public String RefundFailedList ( Model model , HttpSession session ) {
String adminname = ( String ) session . getAttribute ( "usertype" ) ;
String adminname = ( String ) session . getAttribute ( "usertype" ) ;
if ( adminname ! = null ) {
if ( adminname ! = null ) {
model . addAttribute ( "adminname" , adminname ) ;
model . addAttribute ( "adminname" , adminname ) ;
long mobileno = ( long ) session . getAttribute ( "mobileno" ) ;
long mobileno = ( long ) session . getAttribute ( "mobileno" ) ;
model . addAttribute ( "mobileno" , mobileno ) ;
model . addAttribute ( "mobileno" , mobileno ) ;
model . addAttribute ( "title" , "settlementapproved" ) ;
model . addAttribute ( "title" , "settlementapproved" ) ;
String zone = ( String ) session . getAttribute ( "zone" ) ;
String zone = ( String ) session . getAttribute ( "zone" ) ;
model . addAttribute ( "zone" , zone ) ;
model . addAttribute ( "zone" , zone ) ;
List < BookingDetails > settlementrefundfailed = bookingDetailsRepository . findAllSettlementRefundFailed ( ) ;
List < BookingDetails > refundfailedcancelledbookings = bookingDetailsRepository . findAllRefundFaileCancelledList ( ) ;
List < BookingDetails > refundfailedrejectedbookings = bookingDetailsRepository . findAllRefundFaileRejectedList ( ) ;
model . addAttribute ( "settlementrefundfailed" , settlementrefundfailed ) ;
model . addAttribute ( "refundfailedcancelledbookings" , refundfailedcancelledbookings ) ;
model . addAttribute ( "refundfailedrejectedbookings" , refundfailedrejectedbookings ) ;
List < BookingDetails > settlementrefundfailed = bookingDetailsRepository . findAllSettlementRefundFailed ( ) ;
List < BookingDetails > refundfailedcancelledbookings = bookingDetailsRepository . findAllRefundFaileCancelledList ( ) ;
List < BookingDetails > refundfailedrejectedbookings = bookingDetailsRepository . findAllRefundFaileRejectedList ( ) ;
model . addAttribute ( "settlementrefundfailed" , settlementrefundfailed ) ;
model . addAttribute ( "refundfailedcancelledbookings" , refundfailedcancelledbookings ) ;
model . addAttribute ( "refundfailedrejectedbookings" , refundfailedrejectedbookings ) ;
return "admin/refund-failedlist" ;
return "admin/refund-failedlist" ;
}
else {
} else {
session . invalidate ( ) ;
session . invalidate ( ) ;
return "redirect:/communityhall/login" ;
return "redirect:/communityhall/login" ;
}
}
}
}
@GetMapping ( "/settlement-completedlist" )
@GetMapping ( "/settlement-completedlist" )
public String viewSettlementcompletedMaster ( Model model , HttpSession session ) {
public String viewSettlementcompletedMaster ( Model model , HttpSession session ) {
String adminname = ( String ) session . getAttribute ( "usertype" ) ;
String adminname = ( String ) session . getAttribute ( "usertype" ) ;
if ( adminname ! = null ) {
if ( adminname ! = null ) {
long mobileno = ( long ) session . getAttribute ( "mobileno" ) ;
long mobileno = ( long ) session . getAttribute ( "mobileno" ) ;
model . addAttribute ( "mobileno" , mobileno ) ;
model . addAttribute ( "mobileno" , mobileno ) ;
List < BookingDetails > completedlist = bookingDetailsRepository . findSettlementCompletedList ( ) ;
List < BookingDetails > cancelledcompletedlist = bookingDetailsRepository . findCancelledCompletedList ( ) ;
List < BookingDetails > rejectedcompletedlist = bookingDetailsRepository . findRejectedSettlementCompletedList ( ) ;
model . addAttribute ( "title" , "settlement initiate" ) ;
List < BookingDetails > completedlist = bookingDetailsRepository . findSettlementCompletedList ( ) ;
List < BookingDetails > cancelledcompletedlist = bookingDetailsRepository . findCancelledCompletedList ( ) ;
List < BookingDetails > rejectedcompletedlist = bookingDetailsRepository . findRejectedSettlementCompletedList ( ) ;
model . addAttribute ( "title" , "settlement initiate" ) ;
model . addAttribute ( "adminname" , adminname ) ;
model . addAttribute ( "adminname" , adminname ) ;
model . addAttribute ( "completedlist" , completedlist ) ;
model . addAttribute ( "cancelledcompletedlist" , cancelledcompletedlist ) ;
model . addAttribute ( "rejectedcompletedlist" , rejectedcompletedlist ) ;
model . addAttribute ( "completedlist" , completedlist ) ;
model . addAttribute ( "cancelledcompletedlist" , cancelledcompletedlist ) ;
model . addAttribute ( "rejectedcompletedlist" , rejectedcompletedlist ) ;
return "admin/settlement-completed" ;
return "admin/settlement-completed" ;
} else {
} else {
session . invalidate ( ) ; / / Invalidate the session to clear all session attributes
session . invalidate ( ) ; / / Invalidate the session to clear all session attributes
return "redirect:/communityhall/login" ;
return "redirect:/communityhall/login" ;
}
}
}
}
@GetMapping ( "/ReasonMaster" )
@GetMapping ( "/ReasonMaster" )
public String viewreasonMaster ( Model model , HttpSession session ) {
public String viewreasonMaster ( Model model , HttpSession session ) {
String adminname = ( String ) session . getAttribute ( "usertype" ) ;
String adminname = ( String ) session . getAttribute ( "usertype" ) ;
if ( adminname ! = null ) {
if ( adminname ! = null ) {
long mobileno = ( long ) session . getAttribute ( "mobileno" ) ;
long mobileno = ( long ) session . getAttribute ( "mobileno" ) ;
model . addAttribute ( "mobileno" , mobileno ) ;
model . addAttribute ( "mobileno" , mobileno ) ;
model . addAttribute ( "adminname" , adminname ) ;
model . addAttribute ( "adminname" , adminname ) ;
return "admin/reasonmaster" ;
return "admin/reasonmaster" ;
} else {
} else {
session . invalidate ( ) ; / / Invalidate the session to clear all session attributes
session . invalidate ( ) ; / / Invalidate the session to clear all session attributes
return "redirect:/communityhall/login" ;
return "redirect:/communityhall/login" ;
}
}
}
}
@GetMapping ( "/userdeactive" )
@GetMapping ( "/userdeactive" )
public String viewuserDetails ( Model model , HttpSession session ) {
public String viewuserDetails ( Model model , HttpSession session ) {
String adminname = ( String ) session . getAttribute ( "usertype" ) ;
String adminname = ( String ) session . getAttribute ( "usertype" ) ;
if ( adminname ! = null ) {
if ( adminname ! = null ) {
long mobileno = ( long ) session . getAttribute ( "mobileno" ) ;
long mobileno = ( long ) session . getAttribute ( "mobileno" ) ;
model . addAttribute ( "mobileno" , mobileno ) ;
model . addAttribute ( "mobileno" , mobileno ) ;
model . addAttribute ( "adminname" , adminname ) ;
model . addAttribute ( "adminname" , adminname ) ;
return "admin/userdetails" ;
return "admin/userdetails" ;
} else {
} else {
session . invalidate ( ) ; / / Invalidate the session to clear all session attributes
session . invalidate ( ) ; / / Invalidate the session to clear all session attributes
return "redirect:/communityhall/login" ;
return "redirect:/communityhall/login" ;
}
}
}
}
@GetMapping ( "/Gccblocking" )
@GetMapping ( "/Gccblocking" )
public String viewGccBlocking ( Model model , HttpSession session ) {
public String viewGccBlocking ( Model model , HttpSession session ) {
String adminname = ( String ) session . getAttribute ( "usertype" ) ;
String adminname = ( String ) session . getAttribute ( "usertype" ) ;
if ( adminname ! = null ) {
if ( adminname ! = null ) {
long mobileno = ( long ) session . getAttribute ( "mobileno" ) ;
long mobileno = ( long ) session . getAttribute ( "mobileno" ) ;
model . addAttribute ( "mobileno" , mobileno ) ;
model . addAttribute ( "mobileno" , mobileno ) ;
model . addAttribute ( "adminname" , adminname ) ;
model . addAttribute ( "adminname" , adminname ) ;
@ -378,15 +380,13 @@ else {
model . addAttribute ( "hallCountMap" , hallCountMap ) ;
model . addAttribute ( "hallCountMap" , hallCountMap ) ;
return "admin/gccblocking" ;
return "admin/gccblocking" ;
} else {
} else {
session . invalidate ( ) ; / / Invalidate the session to clear all session attributes
session . invalidate ( ) ; / / Invalidate the session to clear all session attributes
return "redirect:/communityhall/login" ;
return "redirect:/communityhall/login" ;
}
}
}
}
/ / Utility method to ensure distinct by a key
/ / Utility method to ensure distinct by a key
private static < T > Predicate < T > distinctByKey ( Function < ? super T , ? > keyExtractor ) {
private static < T > Predicate < T > distinctByKey ( Function < ? super T , ? > keyExtractor ) {
Set < Object > seen = new HashSet < > ( ) ;
Set < Object > seen = new HashSet < > ( ) ;
@ -417,16 +417,16 @@ else {
@RequestParam ( required = false ) String longitude ,
@RequestParam ( required = false ) String longitude ,
@RequestParam String hallInchargeName ,
@RequestParam String hallInchargeName ,
@RequestParam long hallInchargeNo ,
@RequestParam long hallInchargeNo ,
@RequestParam ( "hallImages" ) MultipartFile [ ] hallImages , HttpSession session ) {
@RequestParam ( "hallImages" ) MultipartFile [ ] hallImages , HttpSession session ) {
String updatedId = ( String ) session . getAttribute ( "employeeId" ) ;
String updatedId = ( String ) session . getAttribute ( "employeeId" ) ;
hallDetailService . saveHall ( hallName , depositAmount , halfDayAmt , fullDayAmt , gst , hallArea , ebNumber , ebCostPerUnit , parkingCapacity , seatingCapacity , doorNo ,
hallDetailService . saveHall ( hallName , depositAmount , halfDayAmt , fullDayAmt , gst , hallArea , ebNumber , ebCostPerUnit , parkingCapacity , seatingCapacity , doorNo ,
street , area , zone , division , landMark , city , pinCode , latitude , longitude , hallInchargeName , hallInchargeNo , updatedId , hallImages ) ;
street , area , zone , division , landMark , city , pinCode , latitude , longitude , hallInchargeName , hallInchargeNo , updatedId , hallImages ) ;
String adminname = ( String ) session . getAttribute ( "usertype" ) ;
String adminname = ( String ) session . getAttribute ( "usertype" ) ;
Integer loginid = ( Integer ) session . getAttribute ( "id" ) ;
Integer loginid = ( Integer ) session . getAttribute ( "id" ) ;
ApplicationLogs logs = new ApplicationLogs ( ) ;
ApplicationLogs logs = new ApplicationLogs ( ) ;
logs . setComments ( "Action by " + adminname ) ;
logs . setComments ( "Action by " + adminname ) ;
logs . setLoginId ( loginid ) ;
logs . setLoginId ( loginid ) ;
logs . setLogType ( "Adding New Hall:-" + hallName ) ;
logs . setLogType ( "Adding New Hall:-" + hallName ) ;
InetAddress inetAddress ;
InetAddress inetAddress ;
try {
try {
inetAddress = InetAddress . getLocalHost ( ) ;
inetAddress = InetAddress . getLocalHost ( ) ;
@ -440,83 +440,85 @@ else {
/ / Redirect to a success page or return a ModelAndView as per your application flow
/ / Redirect to a success page or return a ModelAndView as per your application flow
return "redirect:/communityhall/admin/halldetailslist" ;
return "redirect:/communityhall/admin/halldetailslist" ;
}
}
@GetMapping ( "/approval-history" )
@GetMapping ( "/approval-history" )
public String viewApproval ( Model model , HttpSession session ) {
public String viewApproval ( Model model , HttpSession session ) {
String adminname = ( String ) session . getAttribute ( "usertype" ) ;
String adminname = ( String ) session . getAttribute ( "usertype" ) ;
if ( adminname ! = null ) {
if ( adminname ! = null ) {
long mobileno = ( long ) session . getAttribute ( "mobileno" ) ;
long mobileno = ( long ) session . getAttribute ( "mobileno" ) ;
model . addAttribute ( "mobileno" , mobileno ) ;
model . addAttribute ( "mobileno" , mobileno ) ;
model . addAttribute ( "adminname" , adminname ) ;
model . addAttribute ( "adminname" , adminname ) ;
model . addAttribute ( "adminname" , adminname ) ;
model . addAttribute ( "adminname" , adminname ) ;
model . addAttribute ( "title" , "approvalcontrol" ) ;
model . addAttribute ( "title" , "approvalcontrol" ) ;
List < Users > Pending = usersRepository . getPendingList ( ) ;
List < Users > Pending = usersRepository . getPendingList ( ) ;
String zone = ( String ) session . getAttribute ( "zone" ) ;
String zone = ( String ) session . getAttribute ( "zone" ) ;
model . addAttribute ( "zone" , zone ) ;
model . addAttribute ( "zone" , zone ) ;
model . addAttribute ( "pendinglist" , Pending ) ;
model . addAttribute ( "pendinglist" , Pending ) ;
return "admin/approval-history" ;
return "admin/approval-history" ;
} else {
} else {
session . invalidate ( ) ; / / Invalidate the session to clear all session attributes
session . invalidate ( ) ; / / Invalidate the session to clear all session attributes
return "redirect:/communityhall/login" ;
return "redirect:/communityhall/login" ;
}
}
}
}
@GetMapping ( "/user-approved" )
@GetMapping ( "/user-approved" )
public String viewUserApproved ( Model model , HttpSession session ) {
public String viewUserApproved ( Model model , HttpSession session ) {
String adminname = ( String ) session . getAttribute ( "usertype" ) ;
String adminname = ( String ) session . getAttribute ( "usertype" ) ;
if ( adminname ! = null ) {
if ( adminname ! = null ) {
long mobileno = ( long ) session . getAttribute ( "mobileno" ) ;
long mobileno = ( long ) session . getAttribute ( "mobileno" ) ;
model . addAttribute ( "mobileno" , mobileno ) ;
model . addAttribute ( "mobileno" , mobileno ) ;
model . addAttribute ( "adminname" , adminname ) ;
model . addAttribute ( "adminname" , adminname ) ;
model . addAttribute ( "title" , "reasondetails" ) ;
List < Users > approved = usersRepository . getUserApproved ( ) ;
model . addAttribute ( "title" , "reasondetails" ) ;
List < Users > approved = usersRepository . getUserApproved ( ) ;
String zone = ( String ) session . getAttribute ( "zone" ) ;
String zone = ( String ) session . getAttribute ( "zone" ) ;
model . addAttribute ( "zone" , zone ) ;
model . addAttribute ( "zone" , zone ) ;
model . addAttribute ( "approvedlist" , approved ) ;
model . addAttribute ( "approvedlist" , approved ) ;
return "admin/user-approved" ;
return "admin/user-approved" ;
} else {
} else {
session . invalidate ( ) ; / / Invalidate the session to clear all session attributes
session . invalidate ( ) ; / / Invalidate the session to clear all session attributes
return "redirect:/communityhall/login" ;
return "redirect:/communityhall/login" ;
}
}
}
}
@GetMapping ( "/user-reject" )
@GetMapping ( "/user-reject" )
public String viewUserReject ( Model model , HttpSession session ) {
public String viewUserReject ( Model model , HttpSession session ) {
String adminname = ( String ) session . getAttribute ( "usertype" ) ;
String adminname = ( String ) session . getAttribute ( "usertype" ) ;
if ( adminname ! = null ) {
if ( adminname ! = null ) {
long mobileno = ( long ) session . getAttribute ( "mobileno" ) ;
long mobileno = ( long ) session . getAttribute ( "mobileno" ) ;
model . addAttribute ( "mobileno" , mobileno ) ;
model . addAttribute ( "mobileno" , mobileno ) ;
model . addAttribute ( "adminname" , adminname ) ;
model . addAttribute ( "adminname" , adminname ) ;
model . addAttribute ( "title" , "reasondetails" ) ;
List < Users > reject = usersRepository . getUserReject ( ) ;
model . addAttribute ( "title" , "reasondetails" ) ;
List < Users > reject = usersRepository . getUserReject ( ) ;
String zone = ( String ) session . getAttribute ( "zone" ) ;
String zone = ( String ) session . getAttribute ( "zone" ) ;
model . addAttribute ( "zone" , zone ) ;
model . addAttribute ( "zone" , zone ) ;
model . addAttribute ( "rejectedlist" , reject ) ;
model . addAttribute ( "rejectedlist" , reject ) ;
return "admin/user-reject" ;
return "admin/user-reject" ;
} else {
} else {
session . invalidate ( ) ; / / Invalidate the session to clear all session attributes
session . invalidate ( ) ; / / Invalidate the session to clear all session attributes
return "redirect:/communityhall/login" ;
return "redirect:/communityhall/login" ;
}
}
}
}
@GetMapping ( "/booking-list" )
@GetMapping ( "/booking-list" )
public String viewBookingList ( Model model , HttpSession session ) {
public String viewBookingList ( Model model , HttpSession session ) {
String adminname = ( String ) session . getAttribute ( "usertype" ) ;
String adminname = ( String ) session . getAttribute ( "usertype" ) ;
if ( adminname ! = null ) {
if ( adminname ! = null ) {
long mobileno = ( long ) session . getAttribute ( "mobileno" ) ;
long mobileno = ( long ) session . getAttribute ( "mobileno" ) ;
model . addAttribute ( "mobileno" , mobileno ) ;
model . addAttribute ( "mobileno" , mobileno ) ;
model . addAttribute ( "adminname" , adminname ) ;
model . addAttribute ( "adminname" , adminname ) ;
List < BookingDetails > bookingList = bookingDetailsRepository . getAllApprovedList ( ) ;
List < BookingDetails > bookingList = bookingDetailsRepository . getAllApprovedList ( ) ;
model . addAttribute ( "bookingList" , bookingList ) ;
model . addAttribute ( "bookingList" , bookingList ) ;
return "admin/booking-list" ; / / Assuming "officer/rejected-booking-list" is the name of your HTML template
return "admin/booking-list" ; / / Assuming "officer/rejected-booking-list" is the name of your HTML template
} else {
} else {
session . invalidate ( ) ; / / Invalidate the session to clear all session attributes
session . invalidate ( ) ; / / Invalidate the session to clear all session attributes
return "redirect:/communityhall/login" ;
return "redirect:/communityhall/login" ;
}
}
}
}
@GetMapping ( "/rejected-list" )
@GetMapping ( "/rejected-list" )
public String viewRejectedBookings ( Model model , HttpSession session ) {
public String viewRejectedBookings ( Model model , HttpSession session ) {
String adminname = ( String ) session . getAttribute ( "usertype" ) ;
String adminname = ( String ) session . getAttribute ( "usertype" ) ;
if ( adminname ! = null ) {
if ( adminname ! = null ) {
long mobileno = ( long ) session . getAttribute ( "mobileno" ) ;
long mobileno = ( long ) session . getAttribute ( "mobileno" ) ;
model . addAttribute ( "mobileno" , mobileno ) ;
model . addAttribute ( "mobileno" , mobileno ) ;
model . addAttribute ( "adminname" , adminname ) ;
model . addAttribute ( "adminname" , adminname ) ;
@ -524,16 +526,16 @@ else {
model . addAttribute ( "rejectedBookings" , rejectedBookings ) ;
model . addAttribute ( "rejectedBookings" , rejectedBookings ) ;
return "admin/rejected-list" ;
return "admin/rejected-list" ;
} else {
} else {
session . invalidate ( ) ; / / Invalidate the session to clear all session attributes
session . invalidate ( ) ; / / Invalidate the session to clear all session attributes
return "redirect:/communityhall/login" ;
return "redirect:/communityhall/login" ;
}
}
}
}
@GetMapping ( "/bookingwaitinglist" )
@GetMapping ( "/bookingwaitinglist" )
public String viewWaitingBookings ( Model model , HttpSession session ) {
public String viewWaitingBookings ( Model model , HttpSession session ) {
String adminname = ( String ) session . getAttribute ( "usertype" ) ;
String adminname = ( String ) session . getAttribute ( "usertype" ) ;
if ( adminname ! = null ) {
if ( adminname ! = null ) {
long mobileno = ( long ) session . getAttribute ( "mobileno" ) ;
long mobileno = ( long ) session . getAttribute ( "mobileno" ) ;
model . addAttribute ( "mobileno" , mobileno ) ;
model . addAttribute ( "mobileno" , mobileno ) ;
model . addAttribute ( "adminname" , adminname ) ;
model . addAttribute ( "adminname" , adminname ) ;
@ -541,7 +543,7 @@ else {
model . addAttribute ( "waitingBookings" , waitingBookings ) ;
model . addAttribute ( "waitingBookings" , waitingBookings ) ;
return "admin/bookingwaiting" ;
return "admin/bookingwaiting" ;
} else {
} else {
session . invalidate ( ) ; / / Invalidate the session to clear all session attributes
session . invalidate ( ) ; / / Invalidate the session to clear all session attributes
return "redirect:/communityhall/login" ;
return "redirect:/communityhall/login" ;
}
}
@ -558,33 +560,33 @@ else {
@RequestParam ( name = "refundStatus" , required = false ) String refundStatus ,
@RequestParam ( name = "refundStatus" , required = false ) String refundStatus ,
@RequestParam ( name = "paymentStatus" , required = false ) String paymentStatus ,
@RequestParam ( name = "paymentStatus" , required = false ) String paymentStatus ,
@RequestParam ( name = "filterby" , required = false ) String filterby ,
@RequestParam ( name = "filterby" , required = false ) String filterby ,
@RequestParam ( name = "zone1" , required = false , defaultValue = "ALL" ) String zone ,
@RequestParam ( name = "division1" , required = false , defaultValue = "ALL" ) String division ,
@RequestParam ( name = "hall1" , required = false , defaultValue = "1000" ) Integer hallid ,
@RequestParam ( name = "zone1" , required = false , defaultValue = "ALL" ) String zone ,
@RequestParam ( name = "division1" , required = false , defaultValue = "ALL" ) String division ,
@RequestParam ( name = "hall1" , required = false , defaultValue = "1000" ) Integer hallid ,
@RequestParam ( name = "basedon" , required = false ) String basedon ,
@RequestParam ( name = "basedon" , required = false ) String basedon ,
@RequestParam ( name = "bookingId" , required = false ) Long bookingId , HttpSession session ) {
@RequestParam ( name = "bookingId" , required = false ) Long bookingId , HttpSession session ) {
String adminname = ( String ) session . getAttribute ( "usertype" ) ;
String adminname = ( String ) session . getAttribute ( "usertype" ) ;
if ( adminname ! = null ) {
if ( adminname ! = null ) {
long mobileno = ( long ) session . getAttribute ( "mobileno" ) ;
long mobileno = ( long ) session . getAttribute ( "mobileno" ) ;
model . addAttribute ( "mobileno" , mobileno ) ;
model . addAttribute ( "mobileno" , mobileno ) ;
List < Users > userList = handleUserRequest ( request , fromDate , toDate , userstatus , usertype ) ;
List < Users > userList = handleUserRequest ( request , fromDate , toDate , userstatus , usertype ) ;
List < Object [ ] > bookingList = handleBookingRequest ( request , fromDate , toDate , bookingStatus , filterby , bookingId , zone , division , hallid ) ;
List < BookingDetails > bookingSettlementList = handleBookingSettlementRequest ( request , fromDate , toDate , refundStatus , filterby ) ;
List < Object [ ] > bookingList = handleBookingRequest ( request , fromDate , toDate , bookingStatus , filterby , bookingId , zone , division , hallid ) ;
List < BookingDetails > bookingSettlementList = handleBookingSettlementRequest ( request , fromDate , toDate , refundStatus , filterby ) ;
/ / List < Object [ ] > paymentList = request . equals ( "3" ) ? bookingService . getAllPaymentsDetails ( fromDate , toDate , zone , division , hallid ) : new ArrayList < > ( ) ;
/ / List < Object [ ] > paymentList = request . equals ( "3" ) ? bookingService . getAllPaymentsDetails ( fromDate , toDate , zone , division , hallid ) : new ArrayList < > ( ) ;
List < Object [ ] > paymentList = new ArrayList < > ( ) ;
List < Object [ ] > paymentList = new ArrayList < > ( ) ;
List < Object [ ] > extrapaymentList = new ArrayList < > ( ) ;
List < Object [ ] > extrapaymentList = new ArrayList < > ( ) ;
if ( request . equals ( "3" ) ) {
if ( request . equals ( "3" ) ) {
if ( paymentStatus = = null | | paymentStatus . isEmpty ( ) ) {
if ( paymentStatus = = null | | paymentStatus . isEmpty ( ) ) {
paymentList = bookingService . getAllPaymentsDetails ( fromDate , toDate , null , zone , division , hallid ) ;
paymentList = bookingService . getAllPaymentsDetails ( fromDate , toDate , null , zone , division , hallid ) ;
} else {
} else {
paymentList = bookingService . getAllPaymentsDetails ( fromDate , toDate , paymentStatus , zone , division , hallid ) ;
paymentList = bookingService . getAllPaymentsDetails ( fromDate , toDate , paymentStatus , zone , division , hallid ) ;
}
}
}
}
if ( request . equals ( "8" ) ) {
if ( request . equals ( "8" ) ) {
if ( paymentStatus = = null | | paymentStatus . isEmpty ( ) ) {
if ( paymentStatus = = null | | paymentStatus . isEmpty ( ) ) {
extrapaymentList = bookingService . getAllExtraPaymentsDetails ( fromDate , toDate , null , zone , division , hallid ) ;
extrapaymentList = bookingService . getAllExtraPaymentsDetails ( fromDate , toDate , null , zone , division , hallid ) ;
} else {
} else {
extrapaymentList = bookingService . getAllExtraPaymentsDetails ( fromDate , toDate , paymentStatus , zone , division , hallid ) ;
extrapaymentList = bookingService . getAllExtraPaymentsDetails ( fromDate , toDate , paymentStatus , zone , division , hallid ) ;
}
}
}
}
List < Object [ ] > userbookingList = request . equals ( "4" ) ? bookingService . getBookingUserDetailsReport ( fromDate , toDate ) : new ArrayList < > ( ) ;
List < Object [ ] > userbookingList = request . equals ( "4" ) ? bookingService . getBookingUserDetailsReport ( fromDate , toDate ) : new ArrayList < > ( ) ;
@ -598,13 +600,13 @@ else {
totalcount = bookingDetailsRepository . countBookingsByZone ( ) ;
totalcount = bookingDetailsRepository . countBookingsByZone ( ) ;
/ / Format zone data
/ / Format zone data
totalcount = totalcount . stream ( )
totalcount = totalcount . stream ( )
. map ( data - > new Object [ ] { "Zone-" + data [ 0 ] , data [ 1 ] } )
. map ( data - > new Object [ ] { "Zone-" + data [ 0 ] , data [ 1 ] } )
. collect ( Collectors . toList ( ) ) ;
. collect ( Collectors . toList ( ) ) ;
} else if ( "division" . equals ( basedon ) ) {
} else if ( "division" . equals ( basedon ) ) {
totalcount = bookingDetailsRepository . countBookingsByDivisions ( ) ;
totalcount = bookingDetailsRepository . countBookingsByDivisions ( ) ;
/ / Format division data
/ / Format division data
totalcount = totalcount . stream ( )
totalcount = totalcount . stream ( )
. map ( data - > new Object [ ] { "Division-" + data [ 0 ] , data [ 1 ] } )
. map ( data - > new Object [ ] { "Division-" + data [ 0 ] , data [ 1 ] } )
. collect ( Collectors . toList ( ) ) ;
. collect ( Collectors . toList ( ) ) ;
}
}
@ -615,7 +617,7 @@ else {
model . addAttribute ( "basedon" , basedon ) ;
model . addAttribute ( "basedon" , basedon ) ;
model . addAttribute ( "totalcount" , totalcount ) ;
model . addAttribute ( "totalcount" , totalcount ) ;
model . addAttribute ( "totalBookings" , totalBookings ) ;
model . addAttribute ( "totalBookings" , totalBookings ) ;
List < Object [ ] > hallbookingList = handleBookingHallDetailsReportRequest ( request , fromDate , toDate , filterby , zone , division , hallid ) ;
List < Object [ ] > hallbookingList = handleBookingHallDetailsReportRequest ( request , fromDate , toDate , filterby , zone , division , hallid ) ;
model . addAttribute ( "filterby" , filterby ) ;
model . addAttribute ( "filterby" , filterby ) ;
@ -641,31 +643,27 @@ else {
model . addAttribute ( "adminname" , adminname ) ;
model . addAttribute ( "adminname" , adminname ) ;
return "admin/reports" ;
return "admin/reports" ;
} else {
} else {
session . invalidate ( ) ; / / Invalidate the session to clear all session attributes
session . invalidate ( ) ; / / Invalidate the session to clear all session attributes
return "redirect:/communityhall/login" ;
return "redirect:/communityhall/login" ;
}
}
}
}
private List < Object [ ] > handleBookingHallDetailsReportRequest ( String request , String fromDate , String toDate , String filterby , String zone , String division , Integer hallid )
{
private List < Object [ ] > handleBookingHallDetailsReportRequest ( String request , String fromDate , String toDate , String filterby , String zone , String division , Integer hallid ) {
if ( ! request . equals ( "5" ) ) {
if ( ! request . equals ( "5" ) ) {
return new ArrayList < > ( ) ;
return new ArrayList < > ( ) ;
}
}
if ( filterby . isEmpty ( ) )
{
return bookingService . getBookingHallDetailsReportByBookingDate ( fromDate , toDate , zone , division , hallid ) ;
if ( filterby . isEmpty ( ) ) {
return bookingService . getBookingHallDetailsReportByBookingDate ( fromDate , toDate , zone , division , hallid ) ;
}
}
if ( "1" . equals ( filterby ) )
{
if ( "1" . equals ( filterby ) ) {
return bookingService . getBookingHallDetailsReportByBookingDate ( fromDate , toDate , zone , division , hallid ) ;
return bookingService . getBookingHallDetailsReportByBookingDate ( fromDate , toDate , zone , division , hallid ) ;
}
}
if ( "2" . equals ( filterby ) )
{
if ( "2" . equals ( filterby ) ) {
return bookingService . getBookingHallDetailsReportByEventDate ( fromDate , toDate , zone , division , hallid ) ;
return bookingService . getBookingHallDetailsReportByEventDate ( fromDate , toDate , zone , division , hallid ) ;
}
}
@ -689,50 +687,37 @@ else {
}
}
private List < Object [ ] > handleBookingRequest ( String request , String fromDate , String toDate , String bookingStatus , String filterby , Long bookingId , String zone , String division , Integer hallid ) {
private List < Object [ ] > handleBookingRequest ( String request , String fromDate , String toDate , String bookingStatus , String filterby , Long bookingId , String zone , String division , Integer hallid ) {
if ( ! request . equals ( "2" ) ) {
if ( ! request . equals ( "2" ) ) {
return new ArrayList < > ( ) ;
return new ArrayList < > ( ) ;
}
}
if ( filterby . isEmpty ( ) & & bookingStatus . isEmpty ( ) & & bookingId = = null )
{
return bookingService . getBookingDetailsByBookingDate ( fromDate , toDate , zone , division , hallid ) ;
if ( filterby . isEmpty ( ) & & bookingStatus . isEmpty ( ) & & bookingId = = null ) {
return bookingService . getBookingDetailsByBookingDate ( fromDate , toDate , zone , division , hallid ) ;
}
}
if ( bookingId ! = null & & bookingStatus . isEmpty ( ) )
{
if ( bookingId ! = null & & bookingStatus . isEmpty ( ) ) {
return bookingDetailsRepo . getAllBookingDetailsWithBookingId ( fromDate , toDate , bookingId ) ;
return bookingDetailsRepo . getAllBookingDetailsWithBookingId ( fromDate , toDate , bookingId ) ;
}
}
if ( bookingId ! = null & & ! bookingStatus . isEmpty ( ) )
{
return bookingDetailsRepo . getAllBookingDetailsWithBookingIdwithbookingStatus ( fromDate , toDate , bookingId , bookingStatus ) ;
if ( bookingId ! = null & & ! bookingStatus . isEmpty ( ) ) {
return bookingDetailsRepo . getAllBookingDetailsWithBookingIdwithbookingStatus ( fromDate , toDate , bookingId , bookingStatus ) ;
}
}
if ( bookingId = = null & & filterby . isEmpty ( ) & & ! bookingStatus . isEmpty ( ) )
{
return bookingService . getBookingDetailsByBookingDateWithStatus ( fromDate , toDate , bookingStatus , zone , division , hallid ) ;
if ( bookingId = = null & & filterby . isEmpty ( ) & & ! bookingStatus . isEmpty ( ) ) {
return bookingService . getBookingDetailsByBookingDateWithStatus ( fromDate , toDate , bookingStatus , zone , division , hallid ) ;
}
}
if ( ! filterby . isEmpty ( ) )
{
if ( ! filterby . isEmpty ( ) ) {
if ( "1" . equals ( filterby ) )
{
if ( bookingStatus . isEmpty ( ) )
{
return bookingService . getBookingDetailsByBookingDate ( fromDate , toDate , zone , division , hallid ) ;
}
else
{
return bookingService . getBookingDetailsByBookingDateWithStatus ( fromDate , toDate , bookingStatus , zone , division , hallid ) ;
if ( "1" . equals ( filterby ) ) {
if ( bookingStatus . isEmpty ( ) ) {
return bookingService . getBookingDetailsByBookingDate ( fromDate , toDate , zone , division , hallid ) ;
} else {
return bookingService . getBookingDetailsByBookingDateWithStatus ( fromDate , toDate , bookingStatus , zone , division , hallid ) ;
}
}
}
}
if ( "2" . equals ( filterby ) )
{
if ( bookingStatus . isEmpty ( ) )
{
return bookingService . getBookingDetailsByEventDate ( fromDate , toDate , zone , division , hallid ) ;
}
else {
return bookingService . getBookingDetailsByEventDateWithStatus ( fromDate , toDate , bookingStatus , zone , division , hallid ) ;
if ( "2" . equals ( filterby ) ) {
if ( bookingStatus . isEmpty ( ) ) {
return bookingService . getBookingDetailsByEventDate ( fromDate , toDate , zone , division , hallid ) ;
} else {
return bookingService . getBookingDetailsByEventDateWithStatus ( fromDate , toDate , bookingStatus , zone , division , hallid ) ;
}
}
}
}
@ -746,36 +731,26 @@ else {
if ( ! request . equals ( "6" ) ) {
if ( ! request . equals ( "6" ) ) {
return new ArrayList < > ( ) ;
return new ArrayList < > ( ) ;
}
}
if ( filterby . isEmpty ( ) & & refundStatus . isEmpty ( ) )
{
if ( filterby . isEmpty ( ) & & refundStatus . isEmpty ( ) ) {
return bookingService . getAllBookingsettlementDetailsByBookingDate ( fromDate , toDate ) ;
return bookingService . getAllBookingsettlementDetailsByBookingDate ( fromDate , toDate ) ;
}
}
if ( filterby . isEmpty ( ) & & ! refundStatus . isEmpty ( ) )
{
if ( filterby . isEmpty ( ) & & ! refundStatus . isEmpty ( ) ) {
return bookingService . getAllBookingsettlementDetailsByBookingDateWithStatus ( fromDate , toDate , refundStatus ) ;
return bookingService . getAllBookingsettlementDetailsByBookingDateWithStatus ( fromDate , toDate , refundStatus ) ;
}
}
if ( ! filterby . isEmpty ( ) )
{
if ( ! filterby . isEmpty ( ) ) {
if ( "1" . equals ( filterby ) )
{
if ( refundStatus . isEmpty ( ) )
{
if ( "1" . equals ( filterby ) ) {
if ( refundStatus . isEmpty ( ) ) {
return bookingService . getAllBookingsettlementDetailsByBookingDate ( fromDate , toDate ) ;
return bookingService . getAllBookingsettlementDetailsByBookingDate ( fromDate , toDate ) ;
}
else
{
} else {
return bookingService . getAllBookingsettlementDetailsByBookingDateWithStatus ( fromDate , toDate , refundStatus ) ;
return bookingService . getAllBookingsettlementDetailsByBookingDateWithStatus ( fromDate , toDate , refundStatus ) ;
}
}
}
}
if ( "2" . equals ( filterby ) )
{
if ( refundStatus . isEmpty ( ) )
{
if ( "2" . equals ( filterby ) ) {
if ( refundStatus . isEmpty ( ) ) {
return bookingService . getAllBookingsettlementDetailsByEventDate ( fromDate , toDate ) ;
return bookingService . getAllBookingsettlementDetailsByEventDate ( fromDate , toDate ) ;
}
else {
} else {
return bookingService . getAllBookingsettlementDetailsByEventDateWithStatus ( fromDate , toDate , refundStatus ) ;
return bookingService . getAllBookingsettlementDetailsByEventDateWithStatus ( fromDate , toDate , refundStatus ) ;
}
}
@ -787,9 +762,9 @@ else {
}
}
@GetMapping ( "/DiscountRange" )
@GetMapping ( "/DiscountRange" )
public String viewDiscountRange ( Model model , HttpSession session ) {
public String viewDiscountRange ( Model model , HttpSession session ) {
String adminname = ( String ) session . getAttribute ( "usertype" ) ;
String adminname = ( String ) session . getAttribute ( "usertype" ) ;
if ( adminname ! = null ) {
if ( adminname ! = null ) {
long mobileno = ( long ) session . getAttribute ( "mobileno" ) ;
long mobileno = ( long ) session . getAttribute ( "mobileno" ) ;
model . addAttribute ( "mobileno" , mobileno ) ;
model . addAttribute ( "mobileno" , mobileno ) ;
List < DiscountRange > discountRanges = discountRangeRepo . findAll ( ) ;
List < DiscountRange > discountRanges = discountRangeRepo . findAll ( ) ;
@ -797,61 +772,62 @@ else {
model . addAttribute ( "discountRanges" , discountRanges ) ;
model . addAttribute ( "discountRanges" , discountRanges ) ;
model . addAttribute ( "adminname" , adminname ) ;
model . addAttribute ( "adminname" , adminname ) ;
return "admin/discountrange" ;
return "admin/discountrange" ;
} else {
} else {
session . invalidate ( ) ; / / Invalidate the session to clear all session attributes
session . invalidate ( ) ; / / Invalidate the session to clear all session attributes
return "redirect:/communityhall/login" ;
return "redirect:/communityhall/login" ;
}
}
}
}
@GetMapping ( "/ongoingevents" )
@GetMapping ( "/ongoingevents" )
public String viewRecentevents ( Model model , HttpSession session ) {
public String viewRecentevents ( Model model , HttpSession session ) {
String adminname = ( String ) session . getAttribute ( "usertype" ) ;
String adminname = ( String ) session . getAttribute ( "usertype" ) ;
if ( adminname ! = null ) {
if ( adminname ! = null ) {
long mobileno = ( long ) session . getAttribute ( "mobileno" ) ;
long mobileno = ( long ) session . getAttribute ( "mobileno" ) ;
model . addAttribute ( "mobileno" , mobileno ) ;
model . addAttribute ( "mobileno" , mobileno ) ;
List < BookingDetails > presenteventslist = bookingDetailsRepository . findPresentBookingList ( ) ;
List < BookingDetails > pasteventslist = bookingDetailsRepository . findPastEventsList ( ) ;
List < BookingDetails > futureeventslist = bookingDetailsRepository . findFutureEventsList ( ) ;
model . addAttribute ( "title" , "settlement initiate" ) ;
List < BookingDetails > presenteventslist = bookingDetailsRepository . findPresentBookingList ( ) ;
List < BookingDetails > pasteventslist = bookingDetailsRepository . findPastEventsList ( ) ;
List < BookingDetails > futureeventslist = bookingDetailsRepository . findFutureEventsList ( ) ;
model . addAttribute ( "title" , "settlement initiate" ) ;
model . addAttribute ( "adminname" , adminname ) ;
model . addAttribute ( "adminname" , adminname ) ;
model . addAttribute ( "presenteventslist" , presenteventslist ) ;
model . addAttribute ( "pasteventslist" , pasteventslist ) ;
model . addAttribute ( "futureeventslist" , futureeventslist ) ;
model . addAttribute ( "presenteventslist" , presenteventslist ) ;
model . addAttribute ( "pasteventslist" , pasteventslist ) ;
model . addAttribute ( "futureeventslist" , futureeventslist ) ;
return "admin/ongoingevents" ;
return "admin/ongoingevents" ;
} else {
} else {
session . invalidate ( ) ; / / Invalidate the session to clear all session attributes
session . invalidate ( ) ; / / Invalidate the session to clear all session attributes
return "redirect:/communityhall/login" ;
return "redirect:/communityhall/login" ;
}
}
}
}
@GetMapping ( "/manualrefund" )
@GetMapping ( "/manualrefund" )
public String viewManualRefund ( Model model , HttpSession session ) {
public String viewManualRefund ( Model model , HttpSession session ) {
String adminname = ( String ) session . getAttribute ( "usertype" ) ;
String adminname = ( String ) session . getAttribute ( "usertype" ) ;
if ( adminname ! = null ) {
if ( adminname ! = null ) {
long mobileno = ( long ) session . getAttribute ( "mobileno" ) ;
long mobileno = ( long ) session . getAttribute ( "mobileno" ) ;
model . addAttribute ( "mobileno" , mobileno ) ;
model . addAttribute ( "mobileno" , mobileno ) ;
model . addAttribute ( "adminname" , adminname ) ;
model . addAttribute ( "adminname" , adminname ) ;
return "admin/manualrefund" ;
return "admin/manualrefund" ;
} else {
} else {
session . invalidate ( ) ; / / Invalidate the session to clear all session attributes
session . invalidate ( ) ; / / Invalidate the session to clear all session attributes
return "redirect:/communityhall/login" ;
return "redirect:/communityhall/login" ;
}
}
}
}
@GetMapping ( "/developer" )
@GetMapping ( "/developer" )
public String viewDeveloper ( Model model , HttpSession session ) {
public String viewDeveloper ( Model model , HttpSession session ) {
String adminname = ( String ) session . getAttribute ( "usertype" ) ;
String adminname = ( String ) session . getAttribute ( "usertype" ) ;
if ( adminname ! = null ) {
if ( adminname ! = null ) {
long mobileno = ( long ) session . getAttribute ( "mobileno" ) ;
long mobileno = ( long ) session . getAttribute ( "mobileno" ) ;
model . addAttribute ( "mobileno" , mobileno ) ;
model . addAttribute ( "mobileno" , mobileno ) ;
model . addAttribute ( "adminname" , adminname ) ;
model . addAttribute ( "adminname" , adminname ) ;
return "admin/developer" ;
return "admin/developer" ;
} else {
} else {
session . invalidate ( ) ; / / Invalidate the session to clear all session attributes
session . invalidate ( ) ; / / Invalidate the session to clear all session attributes
return "redirect:/communityhall/login" ;
return "redirect:/communityhall/login" ;
}
}
}
}
/ / @GetMapping ( "/getDeveloperdetails" )
/ / @GetMapping ( "/getDeveloperdetails" )
/ / public String getDetails ( Model model , HttpSession session )
/ / public String getDetails ( Model model , HttpSession session )
/ / {
/ / {
/ / String adminname = ( String ) session . getAttribute ( "usertype" ) ;
/ / String adminname = ( String ) session . getAttribute ( "usertype" ) ;
@ -864,18 +840,18 @@ else {
/ / return "redirect:/communityhall/login" ;
/ / return "redirect:/communityhall/login" ;
/ / }
/ / }
/ / }
/ / }
@PostMapping ( "/getDeveloperdetails" )
public String generatedetails ( Model model ,
@PostMapping ( "/getDeveloperdetails" )
public String generatedetails ( Model model ,
@RequestParam ( name = "FromDate" ) @DateTimeFormat ( iso = DateTimeFormat . ISO . DATE ) String fromDate ,
@RequestParam ( name = "FromDate" ) @DateTimeFormat ( iso = DateTimeFormat . ISO . DATE ) String fromDate ,
@RequestParam ( name = "ToDate" ) @DateTimeFormat ( iso = DateTimeFormat . ISO . DATE ) String toDate ,
@RequestParam ( name = "ToDate" ) @DateTimeFormat ( iso = DateTimeFormat . ISO . DATE ) String toDate ,
@RequestParam ( name = "request" ) String request ,
@RequestParam ( name = "request" ) String request ,
@RequestParam ( name = "bookingId" , required = false ) Long bookingId ,
@RequestParam ( name = "bookingId" , required = false ) Long bookingId ,
@RequestParam ( name = "hallId" , required = false ) Long hallId ,
@RequestParam ( name = "hallId" , required = false ) Long hallId ,
@RequestParam ( name = "hallName" , required = false ) String hallName , HttpSession session ) {
@RequestParam ( name = "hallName" , required = false ) String hallName , HttpSession session ) {
String adminname = ( String ) session . getAttribute ( "usertype" ) ;
String adminname = ( String ) session . getAttribute ( "usertype" ) ;
if ( adminname ! = null ) {
if ( adminname ! = null ) {
long mobileno = ( long ) session . getAttribute ( "mobileno" ) ;
long mobileno = ( long ) session . getAttribute ( "mobileno" ) ;
model . addAttribute ( "mobileno" , mobileno ) ;
model . addAttribute ( "mobileno" , mobileno ) ;
List < Object [ ] > TransactionResponse = new ArrayList < > ( ) ;
List < Object [ ] > TransactionResponse = new ArrayList < > ( ) ;
@ -893,9 +869,9 @@ public String generatedetails(Model model,
List < Object [ ] > RefundResponse = new ArrayList < > ( ) ;
List < Object [ ] > RefundResponse = new ArrayList < > ( ) ;
if ( request . equals ( "2" ) ) {
if ( request . equals ( "2" ) ) {
if ( bookingId = = null ) {
if ( bookingId = = null ) {
RefundResponse = bookingService . getRefundResponse ( fromDate , toDate , null ) ;
RefundResponse = bookingService . getRefundResponse ( fromDate , toDate , null ) ;
} else {
} else {
RefundResponse = bookingService . getRefundResponse ( fromDate , toDate , bookingId ) ;
RefundResponse = bookingService . getRefundResponse ( fromDate , toDate , bookingId ) ;
}
}
}
}
List < Object [ ] > BookingCalendar = new ArrayList < > ( ) ;
List < Object [ ] > BookingCalendar = new ArrayList < > ( ) ;
@ -910,7 +886,7 @@ public String generatedetails(Model model,
/ / / / Fetch filtered details based on hallName
/ / / / Fetch filtered details based on hallName
/ / BookingCalendar = bookingService . getBookingCalendarDetails ( fromDate , toDate , hallName ) ;
/ / BookingCalendar = bookingService . getBookingCalendarDetails ( fromDate , toDate , hallName ) ;
/ / }
/ / }
BookingCalendar = bookingService . getBookingCalendarDetails ( fromDate , toDate , bookingId , hallName ) ;
BookingCalendar = bookingService . getBookingCalendarDetails ( fromDate , toDate , bookingId , hallName ) ;
}
}
model . addAttribute ( "fromdate" , fromDate ) ;
model . addAttribute ( "fromdate" , fromDate ) ;
@ -925,39 +901,39 @@ public String generatedetails(Model model,
model . addAttribute ( "adminname" , adminname ) ;
model . addAttribute ( "adminname" , adminname ) ;
return "admin/developer" ;
return "admin/developer" ;
} else {
} else {
session . invalidate ( ) ; / / Invalidate the session to clear all session attributes
session . invalidate ( ) ; / / Invalidate the session to clear all session attributes
return "redirect:/communityhall/login" ;
return "redirect:/communityhall/login" ;
}
}
}
}
@GetMapping ( "/notification" )
@GetMapping ( "/notification" )
public String viewNotificationPage ( Model model , HttpSession session ) {
public String viewNotificationPage ( Model model , HttpSession session ) {
String adminname = ( String ) session . getAttribute ( "usertype" ) ;
String adminname = ( String ) session . getAttribute ( "usertype" ) ;
if ( adminname ! = null ) {
if ( adminname ! = null ) {
long mobileno = ( long ) session . getAttribute ( "mobileno" ) ;
long mobileno = ( long ) session . getAttribute ( "mobileno" ) ;
List < Notification > newnotifications = notificationRepository . findActivenotifications ( ) ;
List < Notification > newnotifications = notificationRepository . findActivenotifications ( ) ;
model . addAttribute ( "newnotifications" , newnotifications ) ;
model . addAttribute ( "newnotifications" , newnotifications ) ;
model . addAttribute ( "mobileno" , mobileno ) ;
model . addAttribute ( "mobileno" , mobileno ) ;
model . addAttribute ( "adminname" , adminname ) ;
model . addAttribute ( "adminname" , adminname ) ;
return "admin/notification" ;
return "admin/notification" ;
} else {
} else {
session . invalidate ( ) ; / / Invalidate the session to clear all session attributes
session . invalidate ( ) ; / / Invalidate the session to clear all session attributes
return "redirect:/communityhall/login" ;
return "redirect:/communityhall/login" ;
}
}
}
}
@GetMapping ( "/raisesettlement" )
@GetMapping ( "/raisesettlement" )
public String viewcaretakerpage ( Model model , HttpSession session , @RequestParam ( "bookingId" ) int bookingId ) {
public String viewcaretakerpage ( Model model , HttpSession session , @RequestParam ( "bookingId" ) int bookingId ) {
String adminname = ( String ) session . getAttribute ( "usertype" ) ;
String adminname = ( String ) session . getAttribute ( "usertype" ) ;
if ( adminname ! = null ) {
if ( adminname ! = null ) {
long mobileno = ( long ) session . getAttribute ( "mobileno" ) ;
long mobileno = ( long ) session . getAttribute ( "mobileno" ) ;
model . addAttribute ( "mobileno" , mobileno ) ;
model . addAttribute ( "mobileno" , mobileno ) ;
model . addAttribute ( "adminname" , adminname ) ;
model . addAttribute ( "adminname" , adminname ) ;
BookingDetails booking = bookingService . getBookingsById ( bookingId ) ;
BookingDetails booking = bookingService . getBookingsById ( bookingId ) ;
model . addAttribute ( "booking" , booking ) ;
model . addAttribute ( "booking" , booking ) ;
return "admin/caretakerpage" ;
return "admin/caretakerpage" ;
} else {
} else {
session . invalidate ( ) ;
session . invalidate ( ) ;
return "redirect:/communityhall/login" ;
return "redirect:/communityhall/login" ;
}
}
@ -977,18 +953,18 @@ public String generatedetails(Model model,
}
}
@GetMapping ( "/adminpage" )
@GetMapping ( "/adminpage" )
public String viewcaretaker ( Model model , HttpSession session , @RequestParam ( "bookingId" ) int bookingId ) {
public String viewcaretaker ( Model model , HttpSession session , @RequestParam ( "bookingId" ) int bookingId ) {
String adminname = ( String ) session . getAttribute ( "usertype" ) ;
String adminname = ( String ) session . getAttribute ( "usertype" ) ;
if ( adminname ! = null ) {
if ( adminname ! = null ) {
long mobileno = ( long ) session . getAttribute ( "mobileno" ) ;
long mobileno = ( long ) session . getAttribute ( "mobileno" ) ;
model . addAttribute ( "mobileno" , mobileno ) ;
model . addAttribute ( "mobileno" , mobileno ) ;
model . addAttribute ( "adminname" , adminname ) ;
model . addAttribute ( "adminname" , adminname ) ;
model . addAttribute ( "title" , "Admin" ) ;
model . addAttribute ( "title" , "Admin" ) ;
model . addAttribute ( "baseURL" , appConfig . getBaseUrl ( ) ) ;
model . addAttribute ( "baseURL" , appConfig . getBaseUrl ( ) ) ;
BookingDetails booking = bookingService . getBookingsById ( bookingId ) ;
BookingDetails booking = bookingService . getBookingsById ( bookingId ) ;
model . addAttribute ( "booking" , booking ) ;
model . addAttribute ( "booking" , booking ) ;
return "admin/adminpage" ;
return "admin/adminpage" ;
} else {
} else {
session . invalidate ( ) ;
session . invalidate ( ) ;
return "redirect:/communityhall/login" ;
return "redirect:/communityhall/login" ;
}
}
@ -1010,7 +986,7 @@ public String generatedetails(Model model,
@GetMapping ( "/logout" )
@GetMapping ( "/logout" )
public String viewLogout ( Model model , HttpSession session ) {
public String viewLogout ( Model model , HttpSession session ) {
session . invalidate ( ) ;
session . invalidate ( ) ;
return "redirect:/communityhall/login" ;
return "redirect:/communityhall/login" ;
}
}