Browse Source

changes in pages

master
yoganandhank 1 year ago
parent
commit
f09ddcf44e
  1. 36
      src/main/java/com/gcc/crslogs/controller/ApiController.java
  2. 4
      src/main/java/com/gcc/crslogs/controller/MainController.java
  3. 153
      src/main/resources/templates/modules/crslogspages/birthanddeath.html
  4. 19
      src/main/resources/templates/modules/crslogspages/loginpage.html

36
src/main/java/com/gcc/crslogs/controller/ApiController.java

@ -54,25 +54,8 @@ public class ApiController {
// Create an ObjectMapper instance // Create an ObjectMapper instance
ObjectMapper objectMapper = new ObjectMapper(); ObjectMapper objectMapper = new ObjectMapper();
// Check if mobile number is already registered
//List<WasteRegistration> registrations = wasteregistrationrepo.findByMobileNo(mobile);
// Create a response map
Map<String, Object> response = new HashMap<>(); Map<String, Object> response = new HashMap<>();
// if (registrations.isEmpty()) {
// // If mobile number is not registered
// response.put("status", "NOT_REGISTERED");
// response.put("mobile", mobile); // Return the mobile number
// try {
// return objectMapper.writeValueAsString(response); // Use the instance to convert map to JSON string
// } catch (Exception e) {
// // Handle JSON conversion error
// return "{\"status\": \"ERROR\", \"message\": \"Could not convert response to JSON.\"}";
// }
// }
String MobileNo=mobile; String MobileNo=mobile;
System.out.print("\n MobileNo---:"+mobile); System.out.print("\n MobileNo---:"+mobile);
Random rand = new Random(); Random rand = new Random();
@ -117,7 +100,7 @@ public class ApiController {
} }
/////////////////////verify otp method with session handling/////////////////////
@GetMapping(value = "/verifyOTP") @GetMapping(value = "/verifyOTP")
public Map<String, String> verifyOtp(HttpServletRequest request, @RequestParam String otp, public Map<String, String> verifyOtp(HttpServletRequest request, @RequestParam String otp,
@ -165,7 +148,7 @@ public class ApiController {
} }
///////////////////////birth details getting method///////////////////
@GetMapping("/birth-details") @GetMapping("/birth-details")
public ResponseEntity<?> fetchBirthCertificateSecurely( public ResponseEntity<?> fetchBirthCertificateSecurely(
@ -197,6 +180,7 @@ public class ApiController {
////////////////////////death details getting method///////////////////
@GetMapping("/death-details") @GetMapping("/death-details")
public ResponseEntity<?> fetchDeathCertificateSecurely( public ResponseEntity<?> fetchDeathCertificateSecurely(
@ -228,6 +212,7 @@ public class ApiController {
/////////////////save new user method/////////////////
@PostMapping("/saveNewUser") @PostMapping("/saveNewUser")
public ResponseEntity<?> saveNewUser (@RequestParam String user_name, @RequestParam(required = false) String user_address, @RequestParam String user_mobile) { public ResponseEntity<?> saveNewUser (@RequestParam String user_name, @RequestParam(required = false) String user_address, @RequestParam String user_mobile) {
@ -238,6 +223,7 @@ public class ApiController {
} }
/////////////////check existing or not method////////////
@PostMapping("/checkUser") @PostMapping("/checkUser")
public ResponseEntity<Map<String, Object>> checkUser(@RequestParam String mobile) { public ResponseEntity<Map<String, Object>> checkUser(@RequestParam String mobile) {
@ -253,7 +239,7 @@ public class ApiController {
} }
///////////////////////save certificate logs method///////////////////
@PostMapping("/saveCertificateLogs") @PostMapping("/saveCertificateLogs")
public ResponseEntity<?> saveCertificateLogs(HttpServletRequest request, @RequestParam String regNo, @RequestParam String eventDate, public ResponseEntity<?> saveCertificateLogs(HttpServletRequest request, @RequestParam String regNo, @RequestParam String eventDate,
@ -271,14 +257,4 @@ public class ApiController {
// @PostMapping("/checkUser")
// public ResponseEntity<?> checkUser(@RequestParam String user_mobile) {
// boolean exists = birthAndDeathDetailsService.isUserExists(user_mobile);
// if (exists) {
// return ResponseEntity.ok().body("User already registered.");
// } else {
// return ResponseEntity.ok().body("User not registered.");
// }
// }
} }

4
src/main/java/com/gcc/crslogs/controller/MainController.java

@ -21,6 +21,7 @@ public class MainController {
@GetMapping("/birthanddeath") @GetMapping("/birthanddeath")
public String birthform(HttpServletRequest request, Model model) { public String birthform(HttpServletRequest request, Model model) {
HttpSession session = request.getSession(); HttpSession session = request.getSession();
session.setMaxInactiveInterval(10 * 60);
//System.out.println("username.."+session.getAttribute("userName")); //System.out.println("username.."+session.getAttribute("userName"));
String username = (String) session.getAttribute("userName"); String username = (String) session.getAttribute("userName");
if (username==null || username.isEmpty()) { if (username==null || username.isEmpty()) {
@ -33,9 +34,12 @@ public class MainController {
return "modules/crslogspages/birthanddeath"; return "modules/crslogspages/birthanddeath";
} }
@GetMapping("/logout") @GetMapping("/logout")
public String logoutForm(HttpServletRequest request) { public String logoutForm(HttpServletRequest request) {
HttpSession session = request.getSession(); HttpSession session = request.getSession();
session.setMaxInactiveInterval(10 * 60);
session.invalidate(); session.invalidate();
return "modules/crslogspages/loginpage"; return "modules/crslogspages/loginpage";

153
src/main/resources/templates/modules/crslogspages/birthanddeath.html

@ -8,9 +8,10 @@
<title>GCC - Birth And Death</title> <title>GCC - Birth And Death</title>
<!-- Links to Bootstrap CSS and JS, jQuery, and SweetAlert --> <!-- Links to Bootstrap CSS and JS, jQuery, and SweetAlert -->
<!-- Bootstrap CSS --> <!-- Bootstrap CSS -->
<link
href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css"
rel="stylesheet">
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet">
<!-- Include Bootstrap Icons CDN in <head> if not already -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.5/font/bootstrap-icons.css">
<style> <style>
@ -55,7 +56,7 @@ label {
.header .center-text { .header .center-text {
position: absolute; /* Centered text */ position: absolute; /* Centered text */
left: 43%;
left: 50%;
transform: translateX(-50%); transform: translateX(-50%);
text-align: center; text-align: center;
font-size: 24px; font-size: 24px;
@ -330,13 +331,13 @@ body {
.user-info { .user-info {
position: absolute; position: absolute;
top: 20px; top: 20px;
right: 20px;
right: 71px;
font-weight: bold; font-weight: bold;
color: #333; color: #333;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
gap: 10px;
gap: 26px;
flex-wrap: wrap; flex-wrap: wrap;
} }
@ -367,14 +368,57 @@ body {
gap: 10px; gap: 10px;
} }
@media (max-width: 768px) { @media (max-width: 768px) {
.mobile-username {
/* display: block; */
font-size: 0.9rem;
}
.header .center-text{
margin-bottom:39px;
}
.mobile-logout {
display: block;
}
/* Hide desktop user-info on mobile */
.user-info {
display: none !important;
}
#logoutBtnMobile {
font-size: 0.9rem;
width: auto;
margin-top: 5px;
}
}
@media (min-width: 769px) {
.mobile-username,
.mobile-logout {
display: none;
}
.header .center-text{
transform: translateX(-80%);
/* left:47%; */
}
}
/* @media (max-width: 768px) {
.user-info { .user-info {
position: relative; position: relative;
top: auto; top: auto;
right: auto; right: auto;
flex-direction: column; flex-direction: column;
align-items: flex-start; align-items: flex-start;
padding: 10px;
padding: 0px;
} }
.user-name-wrapper { .user-name-wrapper {
@ -395,7 +439,7 @@ body {
margin-top: 5px; margin-top: 5px;
} }
} }
*/
</style> </style>
@ -410,18 +454,55 @@ body {
<div class="header d-flex justify-content-between align-items-center"> <div class="header d-flex justify-content-between align-items-center">
<!-- Left: Logo --> <!-- Left: Logo -->
<div class="logo"> <div class="logo">
<img src="https://gccservices.in/gcc/assets/images/logo.png"
alt="Logo">
<a href="https://chennaicorporation.gov.in/gcc/">
<img src="https://gccservices.in/gcc/assets/images/logo.png" alt="Logo">
</a>
</div> </div>
<!-- Center: Text --> <!-- Center: Text -->
<div class="center-text">GREATER CHENNAI CORPORATION</div> <div class="center-text">GREATER CHENNAI CORPORATION</div>
<div class="user-info d-flex align-items-center">
<!-- Mobile Username (below logo) -->
<!-- Mobile Username (below logo) -->
<div class="mobile-username d-md-none text-start mt-2 ms-2">
<span class="user-name-wrapper" title="Click to logout" style="margin-top: 58px;">
<i class="bi bi-person-circle me-1" style="color:#364d65"></i>
<span id="loggedUserNameMobile" class="user-name-text"></span>
</span>
</div>
<!-- Desktop User Info (hidden on mobile) -->
<div class="user-info d-md-flex align-items-center">
<span class="user-name-wrapper" title="Click to logout">
<i class="bi bi-person-circle me-1" style="color:#364d65"></i>
<span id="loggedUserNameDesktop" class="user-name-text"></span>
</span>
<div id="userNameWrapper" class="ms-2 p-1 rounded">
<button id="logoutBtn" class="btn btn-sm btn-danger" style="font-weight:6px;">LOG OUT</button>
</div>
</div>
<!-- Home Icon + Logout button (mobile logout under icon) -->
<div class="center">
<a href="https://chennaicorporation.gov.in/gcc/">
<i class="bi bi-house-fill" style="font-size: 40px; color:#93adc8"></i>
</a>
<!-- Mobile Logout -->
<div class="mobile-logout d-md-none text-center mt-1">
<button id="logoutBtnMobile" class="btn btn-sm btn-danger" style="font-weight:6px;">LOG OUT</button>
</div>
</div>
<!-- <div class="user-info d-flex align-items-center">
<div> <div>
<span id="userNameLogin" class="user-name-wrapper" title="Click to logout" > <span id="userNameLogin" class="user-name-wrapper" title="Click to logout" >
<i class="bi bi-person-circle me-1 text-primary"></i>
<i class="bi bi-person-circle me-1 " style="color:#364d65"></i>
<span id="loggedUserName" class="user-name-text"></span> <span id="loggedUserName" class="user-name-text"></span>
</span> </span>
@ -430,16 +511,15 @@ body {
<div id="userNameWrapper" class="ms-2 p-1 rounded"> <div id="userNameWrapper" class="ms-2 p-1 rounded">
<span id="loggedUserName" class="user-name-text me-2"></span> <span id="loggedUserName" class="user-name-text me-2"></span>
<button id="logoutBtn" class="btn btn-sm btn-danger" style="font-weight:6px;">LOG OUT</button> <button id="logoutBtn" class="btn btn-sm btn-danger" style="font-weight:6px;">LOG OUT</button>
</div>
</div>
</div>
</div>
</div> -->
</div>
@ -724,6 +804,29 @@ body {
<script> <script>
// Redirect after 60 seconds (1 minute) of inactivity
let timeoutDuration = 10 * 60 * 1000; // 60 seconds
let timeout;
function resetTimeout() {
clearTimeout(timeout);
timeout = setTimeout(() => {
// Optionally check if session is still active via an API
window.location.href = "/crs/loginpage";
}, timeoutDuration);
}
// Reset timeout on user interaction
['click', 'mousemove', 'keypress', 'scroll', 'touchstart'].forEach(evt => {
document.addEventListener(evt, resetTimeout, false);
});
// Start timer initially
resetTimeout();
$(document).ready(function () { $(document).ready(function () {
$('#birthModal, #deathModal').on('hidden.bs.modal', function () { $('#birthModal, #deathModal').on('hidden.bs.modal', function () {
@ -761,10 +864,24 @@ body {
if (userName) { if (userName) {
document.getElementById("loggedUserName").textContent = userName;
document.getElementById("userNameLogin").title = "Logged in as " + userName;
// Mobile
const mobileName = document.getElementById("loggedUserNameMobile");
const mobileWrapper = document.querySelector(".mobile-username .user-name-wrapper");
if (mobileName) mobileName.textContent = userName;
if (mobileWrapper) mobileWrapper.title = "Logged in as " + userName;
// Desktop
const desktopName = document.getElementById("loggedUserNameDesktop");
const desktopNameCopy = document.getElementById("loggedUserNameCopy");
const desktopWrapper = document.querySelector(".user-info .user-name-wrapper");
if (desktopName) desktopName.textContent = userName;
if (desktopNameCopy) desktopNameCopy.textContent = userName;
if (desktopWrapper) desktopWrapper.title = "Logged in as " + userName;
} }
$('#logoutBtn').click(function (e) { $('#logoutBtn').click(function (e) {
e.stopPropagation(); e.stopPropagation();

19
src/main/resources/templates/modules/crslogspages/loginpage.html

@ -7,6 +7,9 @@
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet"> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet">
<!-- Include Bootstrap Icons CDN in <head> if not already -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.5/font/bootstrap-icons.css">
<!-- jQuery (Only load it once) --> <!-- jQuery (Only load it once) -->
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
@ -179,18 +182,26 @@
<div class="header d-flex justify-content-between align-items-center"> <div class="header d-flex justify-content-between align-items-center">
<!-- Left: Logo --> <!-- Left: Logo -->
<div class="logo"> <div class="logo">
<a href="https://chennaicorporation.gov.in/gcc/" >
<img src="https://gccservices.in/gcc/assets/images/logo.png" alt="Logo"> <img src="https://gccservices.in/gcc/assets/images/logo.png" alt="Logo">
</a>
</div> </div>
<!-- Center: Text --> <!-- Center: Text -->
<div class="center-text"> <div class="center-text">
GREATER CHENNAI CORPORATION
GREATER CHENNAI
CORPORATION
</div> </div>
<!-- Right: Button for Menu -->
<div class="menu">
</div>
<div class="center">
<a href="https://chennaicorporation.gov.in/gcc/" >
<i class="bi bi-house-fill" style="font-size: 40px; color:#93adc8"></i>
</a>
</div>
</div> </div>

Loading…
Cancel
Save