You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
76 lines
3.0 KiB
76 lines
3.0 KiB
package com.gcc.communityHall.controller;
|
|
|
|
import java.util.List;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Controller;
|
|
import org.springframework.ui.Model;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
import com.gcc.communityHall.entity.BookingDetails;
|
|
import com.gcc.communityHall.repository.BookingDetailsRepository;
|
|
|
|
import jakarta.servlet.http.HttpSession;
|
|
|
|
@Controller
|
|
@RequestMapping("/communityhall/cro")
|
|
public class CROController {
|
|
|
|
@Autowired
|
|
private BookingDetailsRepository bookingDetailsRepository;
|
|
|
|
@GetMapping("/booking-list")
|
|
public String viewBookingList(Model model, HttpSession session) {
|
|
String croname = (String) session.getAttribute("usertype");
|
|
// System.out.println("croname..." + croname);
|
|
if (croname != null && "cro".equals(croname)) {
|
|
long mobileno = (long) session.getAttribute("mobileno");
|
|
model.addAttribute("mobileno", mobileno);
|
|
model.addAttribute("croname", croname);
|
|
List<BookingDetails> bookingList = bookingDetailsRepository.getApprovedBookingListforReschedule();
|
|
model.addAttribute("bookingList", bookingList);
|
|
return "cro/booking-list";
|
|
} else {
|
|
session.invalidate(); // Invalidate the session to clear all session attributes
|
|
return "redirect:/communityhall/login";
|
|
}
|
|
}
|
|
|
|
@GetMapping("/booking-status")
|
|
public String viewBookingStatus(Model model, HttpSession session) {
|
|
String croname = (String) session.getAttribute("usertype");
|
|
// System.out.println("croname..." + croname);
|
|
if (croname != null && "cro".equals(croname)) {
|
|
long mobileno = (long) session.getAttribute("mobileno");
|
|
model.addAttribute("mobileno", mobileno);
|
|
model.addAttribute("croname", croname);
|
|
return "cro/booking-status";
|
|
} else {
|
|
session.invalidate(); // Invalidate the session to clear all session attributes
|
|
return "redirect:/communityhall/login";
|
|
}
|
|
}
|
|
|
|
@GetMapping("/nocdetails")
|
|
public String viewNOCDetails(Model model, HttpSession session) {
|
|
String croname = (String) session.getAttribute("usertype");
|
|
// System.out.println("croname..." + croname);
|
|
if (croname != null && "cro".equals(croname)) {
|
|
long mobileno = (long) session.getAttribute("mobileno");
|
|
model.addAttribute("mobileno", mobileno);
|
|
model.addAttribute("croname", croname);
|
|
return "cro/noc-details";
|
|
} else {
|
|
session.invalidate(); // Invalidate the session to clear all session attributes
|
|
return "redirect:/communityhall/login";
|
|
}
|
|
}
|
|
|
|
@GetMapping("/logout")
|
|
public String viewLogout(Model model, HttpSession session) {
|
|
session.invalidate();
|
|
return "redirect:/communityhall/login";
|
|
}
|
|
|
|
}
|