Browse Source

Changes in NULM/Park and vtrack

main
Hariprasath S 7 months ago
parent
commit
dc313fb7dc
  1. 92
      gcc_officer_portal/src/main/java/in/gov/chennaicorporation/gccoffice/cdwaste/service/OfficerService.java
  2. 13
      gcc_officer_portal/src/main/java/in/gov/chennaicorporation/gccoffice/nulm/controller/NulmAPIController.java
  3. 112
      gcc_officer_portal/src/main/java/in/gov/chennaicorporation/gccoffice/nulm/controller/NulmController.java
  4. 161
      gcc_officer_portal/src/main/java/in/gov/chennaicorporation/gccoffice/nulm/service/NulmService.java
  5. 23
      gcc_officer_portal/src/main/java/in/gov/chennaicorporation/gccoffice/vtrack/service/VehicleService.java
  6. 552
      gcc_officer_portal/src/main/resources/templates/modules/nulm/attendance-report-park.html
  7. 4
      gcc_officer_portal/src/main/resources/templates/modules/nulm/attendance-report.html
  8. 380
      gcc_officer_portal/src/main/resources/templates/modules/nulm/updated-staff-park.html
  9. 430
      gcc_officer_portal/src/main/resources/templates/modules/nulm/zone-wise-report-park.html

92
gcc_officer_portal/src/main/java/in/gov/chennaicorporation/gccoffice/cdwaste/service/OfficerService.java

@ -77,38 +77,72 @@ public class OfficerService {
// public void sendWhatsappMessage(String refId, double actualWeight, double totalCharge, String mobileNumber) {
// try {
// String message = String.format(
// "Your request (Request ID: *%s*) has been processed. Please proceed with the payment.\n\nActual Weight: *%.0f kg*\nAmount Payable: *%.0f*",
// refId, actualWeight, totalCharge
// );
//
// String encodedMessage = URLEncoder.encode(message, StandardCharsets.UTF_8);
// String encodedHeader = URLEncoder.encode("C&D Waste Collection – Payment Request", StandardCharsets.UTF_8);
// String encodedFooter = URLEncoder.encode("Greater Chennai Corporation", StandardCharsets.UTF_8);
//
// String redirectUrlParam = URLEncoder.encode("dumpregistration/paymentform?requestId=" + refId, StandardCharsets.UTF_8);
//
// String apiUrl = "https://media.smsgupshup.com/GatewayAPI/rest?userid=2000233507" +
// "&password=h2YjFNcJ" +
// "&send_to=" + mobileNumber +
// "&v=1.1&format=json&msg_type=TEXT&method=SENDMESSAGE" +
// "&msg=" + encodedMessage +
// "&isTemplate=true" +
// "&header=" + encodedHeader +
// "&footer=" + encodedFooter +
// "&buttonUrlParam=" + redirectUrlParam;
//
// // Optional: log URL before hitting for debugging
// System.out.println("WhatsApp API URL: " + apiUrl);
//
// // Make API call
// // restTemplate.getForObject(apiUrl, String.class);
// smsService.sendMsg(apiUrl);
// } catch (Exception e) {
// e.printStackTrace();
// // Optionally log or alert failure
// }
// }
public void sendWhatsappMessage(String refId, double actualWeight, double totalCharge, String mobileNumber) { public void sendWhatsappMessage(String refId, double actualWeight, double totalCharge, String mobileNumber) {
try { try {
String message = String.format(
"Your request (Request ID: *%s*) has been processed. Please proceed with the payment.\n\nActual Weight: *%.0f kg*\nAmount Payable: *%.0f*",
refId, actualWeight, totalCharge
);
String encodedMessage = URLEncoder.encode(message, StandardCharsets.UTF_8);
String encodedHeader = URLEncoder.encode("C&D Waste Collection – Payment Request", StandardCharsets.UTF_8);
String encodedFooter = URLEncoder.encode("Greater Chennai Corporation", StandardCharsets.UTF_8);
String redirectUrlParam = URLEncoder.encode("dumpregistration/paymentform?requestId=" + refId, StandardCharsets.UTF_8);
String apiUrl = "https://media.smsgupshup.com/GatewayAPI/rest?userid=2000233507" +
"&password=h2YjFNcJ" +
"&send_to=" + mobileNumber +
"&v=1.1&format=json&msg_type=TEXT&method=SENDMESSAGE" +
"&msg=" + encodedMessage +
"&isTemplate=true" +
"&header=" + encodedHeader +
"&footer=" + encodedFooter +
"&buttonUrlParam=" + redirectUrlParam;
// Optional: log URL before hitting for debugging
System.out.println("WhatsApp API URL: " + apiUrl);
// Make API call
// restTemplate.getForObject(apiUrl, String.class);
smsService.sendMsg(apiUrl);
} catch (Exception e) {
String apikey = "5c995535-6244-11f0-98fc-02c8a5e042bd";
String from = "919445061913";
String placeholders = "";
String button_placeholder="";
// String apiUrl ="https://media.smsgupshup.com/GatewayAPI/rest?userid=2000233507&password=h2YjFNcJ&send_to="+mobileNumber+"&v=1.1&format=json&msg_type=TEXT&method=SENDMESSAGE&msg=Thank+you%21+Your+request+has+been+successfully+submitted.%0ARequest+Id+%3A+"+refId+"&isTemplate=true&header=C%26D+Waste+Collection+Request+Registered&footer=Greater+Chennai+Corporation";
// placeholders = URLEncoder.encode(refId, "UTF-8");
placeholders = URLEncoder.encode(refId + "|~|" + actualWeight + "|~|" + totalCharge, "UTF-8");
button_placeholder=URLEncoder.encode(refId, "UTF-8");
String whatsappMsg = "https://sendapiv1.pinbot.ai/pinwa/sendMessage?apikey=" + apikey + "&from="
+ from + "&to=91" + mobileNumber + ""
+ "&type=template&templateid=3037264&placeholders=" + placeholders + ""
+ "&button_placeholder=dumpregistration/paymentform?requestId=" +button_placeholder + "" ;
System.out.println("WhatsApp API URL: " + whatsappMsg);
smsService.sendMsg(whatsappMsg);
}catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
// Optionally log or alert failure
} }
} }

13
gcc_officer_portal/src/main/java/in/gov/chennaicorporation/gccoffice/nulm/controller/NulmAPIController.java

@ -24,6 +24,7 @@ import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
@ -98,6 +99,18 @@ public class NulmAPIController {
} }
} }
@GetMapping("/attendance-dates") // need to add
public ResponseEntity<Map<String, List<String>>> getAttendanceDates(
@RequestParam(required = false) String enrollmentId,
@RequestParam(required = false) String fromdate,
@RequestParam(required = false) String todate,
@RequestParam(required = false) String type,
Model model) {
return ResponseEntity.ok(nulmService.fetchAttendanceDates(enrollmentId, fromdate, todate, type));
}
/* /*
* @PostMapping("/saveOrder") * @PostMapping("/saveOrder")
* public ResponseEntity<String> saveOrderDetails(@RequestBody Map<String, * public ResponseEntity<String> saveOrderDetails(@RequestBody Map<String,

112
gcc_officer_portal/src/main/java/in/gov/chennaicorporation/gccoffice/nulm/controller/NulmController.java

@ -7,6 +7,7 @@ import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.net.URLDecoder; import java.net.URLDecoder;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
@ -72,6 +73,27 @@ public class NulmController {
return "modules/nulm/updated-staff"; return "modules/nulm/updated-staff";
} }
///
@GetMapping("/updateStaffPark")
public String viewUpdateScreenPark(
@RequestParam(value = "department", required = false) String department,
@RequestParam(value = "division", required = false) String division,
Model model) {
// Fetch the full list or filtered list based on parameters
List<Map<String, Object>> enrollments = nulmService.getEnrollmentsForPark(department, null);
// Add the list to the model to be accessed in the view
model.addAttribute("enrollments", enrollments);
model.addAttribute("selectedDepartment", department); // Pass the selected department
// Return the view name
return "modules/nulm/updated-staff-park";
}
///
@GetMapping("/salaryDetails") @GetMapping("/salaryDetails")
public String getSalaryDetails( public String getSalaryDetails(
@RequestParam(value = "month", required = false) String month, @RequestParam(value = "month", required = false) String month,
@ -261,6 +283,35 @@ public class NulmController {
return "modules/nulm/zone-wise-report"; // Returns the view 'salary-zonereport' return "modules/nulm/zone-wise-report"; // Returns the view 'salary-zonereport'
} }
///
@GetMapping("/salary-zonereport-park")
public String viewParkZoneWiseReport(
@RequestParam(required = false) String month,
@RequestParam(required = false) Integer year,
@RequestParam(required = false) String salaryStatus,
@RequestParam(required = false) String groupName,
@RequestParam(required = false) String zone,
@RequestParam(required = false) String division,
Model model) {
// System.out.println("Zone: "+zone);
// Initialize an empty salaryReport list
List<Map<String, Object>> zoneWiseReport = new ArrayList<>();
// Only fetch the report if month, year and zone are provided
if (month != null && year != null && zone != null) {
zoneWiseReport = nulmService.getZoneWiseReportPark(month, year, salaryStatus, groupName, zone, division);
}
// Add the fetched data to the model
model.addAttribute("zonewiseReport", zoneWiseReport);
return "modules/nulm/zone-wise-report-park"; // Returns the view 'salary-zonereport'
}
///
@GetMapping("/attendance-report") @GetMapping("/attendance-report")
public String viewAttendanceReport( public String viewAttendanceReport(
@RequestParam(required = false) String fromdate, @RequestParam(required = false) String fromdate,
@ -310,7 +361,39 @@ public class NulmController {
return "modules/nulm/attendance-report"; return "modules/nulm/attendance-report";
} }
///
@GetMapping("/consolidated-attendance-report-park") // need to add
public String viewParkConsolidatedAttendanceReport(
@RequestParam(required = false) String fromdate,
@RequestParam(required = false) String todate,
@RequestParam(required = false) String groupName,
@RequestParam(required = false) String zone,
@RequestParam(required = false) String division,
Model model) {
// Initialize an empty salaryReport list
List<Map<String, Object>> consolidatedAttendanceReport = new ArrayList<>();
// Only fetch the report if month, year and zone are provided
if (division != null && zone != null) {
consolidatedAttendanceReport = nulmService.getParkConsolidatedAttendanceReport(fromdate, todate, groupName,
zone, division);
}
// Add the fetched data to the model
model.addAttribute("consolidatedAttendanceReport", consolidatedAttendanceReport);
model.addAttribute("fromdate", fromdate);
model.addAttribute("todate", todate);
return "modules/nulm/attendance-report-park";
}
///
@GetMapping("/attendance-dates") // need to add @GetMapping("/attendance-dates") // need to add
@ResponseBody
public ResponseEntity<Map<String, List<String>>> getAttendanceDates( public ResponseEntity<Map<String, List<String>>> getAttendanceDates(
@RequestParam(required = false) String enrollmentId, @RequestParam(required = false) String enrollmentId,
@RequestParam(required = false) String fromdate, @RequestParam(required = false) String fromdate,
@ -322,6 +405,8 @@ public class NulmController {
} }
///
@GetMapping("/self-help-group") // need to add @GetMapping("/self-help-group") // need to add
public String viewSelfHelpGroup(Model model) { public String viewSelfHelpGroup(Model model) {
@ -357,6 +442,33 @@ public class NulmController {
return "modules/nulm/salary-nonInitiatedreport"; return "modules/nulm/salary-nonInitiatedreport";
} }
///
@GetMapping("/salary-nonInitiated-park")
public String viewParkSalaryNotInitiatedReport(
@RequestParam(required = false) String month,
@RequestParam(required = false) Integer year,
@RequestParam(required = false) String groupName,
Model model) {
System.out.println(" salary-nonInitiated groupname====" + groupName);
if (groupName != null && !groupName.isEmpty()) {
groupName = URLDecoder.decode(groupName, StandardCharsets.UTF_8);
}
List<Map<String, Object>> salaryNotInitiatedReport = new ArrayList<>();
if (month != null && year != null) {
salaryNotInitiatedReport = nulmService.getSalaryNotInitiatedReportPark(month, year, groupName);
}
model.addAttribute("salaryNonInitiatedReport", salaryNotInitiatedReport);
return "modules/nulm/salary-nonInitiatedreport-park";
}
///
@GetMapping("/staffupdate") @GetMapping("/staffupdate")
public String staffupdate(Model model) { public String staffupdate(Model model) {

161
gcc_officer_portal/src/main/java/in/gov/chennaicorporation/gccoffice/nulm/service/NulmService.java

@ -360,7 +360,7 @@ public class NulmService {
"FROM enrollment_table e " + "FROM enrollment_table e " +
"LEFT JOIN order_details o ON e.order_id = o.order_id " + "LEFT JOIN order_details o ON e.order_id = o.order_id " +
"LEFT JOIN suyaudavi_kuzhu s ON e.group_id = s.group_id " + "LEFT JOIN suyaudavi_kuzhu s ON e.group_id = s.group_id " +
"WHERE e.appointed = '1' AND e.isactive = '1' AND e.isdelete = '0'");
"WHERE e.appointed = '1' AND e.isactive = '1' AND e.isdelete = '0' AND e.emp_type='NULM' ");
if (department != null && !department.isEmpty()) { if (department != null && !department.isEmpty()) {
sql.append(" AND e.department = '").append(department).append("'"); sql.append(" AND e.department = '").append(department).append("'");
@ -372,6 +372,25 @@ public class NulmService {
return jdbcTemplate.queryForList(sql.toString()); return jdbcTemplate.queryForList(sql.toString());
} }
///
public List<Map<String, Object>> getEnrollmentsForPark(String department, String division) {
StringBuilder sql = new StringBuilder("SELECT e.*, o.order_number, s.group_name " +
"FROM enrollment_table e " +
"LEFT JOIN order_details o ON e.order_id = o.order_id " +
"LEFT JOIN suyaudavi_kuzhu s ON e.group_id = s.group_id " +
"WHERE e.appointed = '1' AND e.isactive = '1' AND e.isdelete = '0' AND e.emp_type='Park' ");
if (department != null && !department.isEmpty()) {
sql.append(" AND e.department = '").append(department).append("'");
}
if (division != null && !division.isEmpty()) {
sql.append(" AND e.division = '").append(division).append("'");
}
return jdbcTemplate.queryForList(sql.toString());
}
///
public List<Map<String, Object>> getDepartment() { public List<Map<String, Object>> getDepartment() {
String sql = "SELECT DISTINCT department FROM enrollment_table WHERE isactive = 1 AND isdelete = 0"; String sql = "SELECT DISTINCT department FROM enrollment_table WHERE isactive = 1 AND isdelete = 0";
return jdbcTemplate.queryForList(sql); return jdbcTemplate.queryForList(sql);
@ -2428,7 +2447,7 @@ public class NulmService {
+ "DAY(LAST_DAY(STR_TO_DATE(CONCAT(s.year, '-', s.month, '-01'), '%Y-%M-%d'))) AS total_days from salary_details s " + "DAY(LAST_DAY(STR_TO_DATE(CONCAT(s.year, '-', s.month, '-01'), '%Y-%M-%d'))) AS total_days from salary_details s "
+ "left join enrollment_table en on s.enrollment_id = en.enrollment_id " + "left join enrollment_table en on s.enrollment_id = en.enrollment_id "
+ "left join suyaudavi_kuzhu sk on s.group_id = sk.group_id " + "left join suyaudavi_kuzhu sk on s.group_id = sk.group_id "
+ "where s.month = ? and s.year =? "
+ "where s.month = ? and s.year =? AND en.emp_type='NULM' "
+ "AND (s.salary_status = 'Initiated' OR s.salary_status = 'Approved') " + "AND (s.salary_status = 'Initiated' OR s.salary_status = 'Approved') "
+ (salaryStatus != null && !salaryStatus.isEmpty() ? "AND s.salary_status = ? " : "") + (salaryStatus != null && !salaryStatus.isEmpty() ? "AND s.salary_status = ? " : "")
+ (groupName != null && !groupName.isEmpty() ? "AND sk.group_name = ? " : "") + (groupName != null && !groupName.isEmpty() ? "AND sk.group_name = ? " : "")
@ -2456,6 +2475,45 @@ public class NulmService {
return results; return results;
} }
///
public List<Map<String, Object>> getZoneWiseReportPark(String month, Integer year, String salaryStatus,
String groupName, String zone, String division) {
String sql = "select en.zone,en.division, en.emp_id, en.name, en.incharge_name, en.incharge_designation, sk.group_name, s.total_days_present, s.total_days_od, "
+ "s.total_days_absent, s.total_days_salary, s.month as imonth,s.year as iyear, s.salary_status, s.salary_amount as total_salary, "
+ "DAY(LAST_DAY(STR_TO_DATE(CONCAT(s.year, '-', s.month, '-01'), '%Y-%M-%d'))) AS total_days from salary_details_park s "
+ "left join enrollment_table en on s.enrollment_id = en.enrollment_id "
+ "left join suyaudavi_kuzhu sk on s.group_id = sk.group_id "
+ "where s.month = ? and s.year =? AND en.emp_type='Park' "
+ "AND (s.salary_status = 'Initiated' OR s.salary_status = 'Approved') "
+ (salaryStatus != null && !salaryStatus.isEmpty() ? "AND s.salary_status = ? " : "")
+ (groupName != null && !groupName.isEmpty() ? "AND sk.group_name = ? " : "")
+ (zone != null && !zone.isEmpty() ? "AND en.zone = ? " : "")
+ (division != null && !division.isEmpty() ? "AND en.division = ? " : "");
// Prepare the query parameters based on provided inputs
List<Object> params = new ArrayList<>();
params.add(month);
params.add(year);
if (salaryStatus != null && !salaryStatus.isEmpty()) {
params.add(salaryStatus);
}
if (groupName != null && !groupName.isEmpty()) {
params.add(groupName);
}
if (zone != null && !zone.isEmpty()) {
params.add(zone);
}
if (division != null && !division.isEmpty()) {
params.add(division);
}
List<Map<String, Object>> results = jdbcTemplate.queryForList(sql.toString(), params.toArray());
return results;
}
///
public List<Map<String, Object>> getAttendanceReport(String fromdate, String todate, String groupName, String zone, public List<Map<String, Object>> getAttendanceReport(String fromdate, String todate, String groupName, String zone,
String division) { String division) {
String sql = "select date_format(coalesce(att.indatetime, att.oddatetime, att.leavedatetime),'%d-%m-%Y') as attendance_date, et.emp_id, et.name, " String sql = "select date_format(coalesce(att.indatetime, att.oddatetime, att.leavedatetime),'%d-%m-%Y') as attendance_date, et.emp_id, et.name, "
@ -2756,7 +2814,55 @@ public class NulmService {
"et.incharge_name, et.incharge_phoneno, et.incharge_designation, et.zone, " + "et.incharge_name, et.incharge_phoneno, et.incharge_designation, et.zone, " +
"et.division, et.department, sk.group_name from attendance att " "et.division, et.department, sk.group_name from attendance att "
+ " left join enrollment_table et on att.enrollment_id = et.enrollment_id " + " left join enrollment_table et on att.enrollment_id = et.enrollment_id "
+ " left join suyaudavi_kuzhu sk on et.group_id = sk.group_id where "
+ " left join suyaudavi_kuzhu sk on et.group_id = sk.group_id where et.emp_type='NULM' AND "
+ " (DATE(att.indatetime) BETWEEN STR_TO_DATE('" + fromdate + "', '%Y-%m-%d') AND STR_TO_DATE('"
+ todate + "', '%Y-%m-%d') "
+ " OR DATE(att.oddatetime) BETWEEN STR_TO_DATE('" + fromdate + "', '%Y-%m-%d') AND STR_TO_DATE('"
+ todate + "', '%Y-%m-%d')"
+ " OR DATE(att.leavedatetime) BETWEEN STR_TO_DATE('" + fromdate + "', '%Y-%m-%d') AND STR_TO_DATE('"
+ todate + "', '%Y-%m-%d')) "
+ (zone != null && !zone.isEmpty() ? " and et.zone = ? " : "")
+ (division != null && !division.isEmpty() ? " and et.division = ? " : "")
+ (groupName != null && !groupName.isEmpty() ? " and sk.group_name = ? " : "")
+ " group by et.emp_id, et.enrollment_id, et.name, et.incharge_name, et.incharge_phoneno, et.incharge_designation, et.zone, "
+ " et.division, et.department, sk.group_name";
// Prepare the query parameters based on provided inputs
List<Object> params = new ArrayList<>();
// params.add(fromdate);
// params.add(todate);
if (groupName != null && !groupName.isEmpty()) {
params.add(groupName);
}
if (zone != null && !zone.isEmpty()) {
params.add(zone);
}
if (division != null && !division.isEmpty()) {
params.add(division);
}
List<Map<String, Object>> results = jdbcTemplate.queryForList(sql.toString(), params.toArray());
return results;
}
///
public List<Map<String, Object>> getParkConsolidatedAttendanceReport(String fromdate, String todate, String groupName,
String zone, String division) { // newly added
String sql = "select \n" +
"et.emp_id, et.enrollment_id, et.name, " +
"MAX(DAY(LAST_DAY(COALESCE(att.indatetime, att.leavedatetime, att.oddatetime)))) AS total_days, " +
"count(distinct date(att.indatetime)) as totaldayspresent, " +
"count(distinct case when att.indatetime is null then date(att.oddatetime) end) as totaldaysod, " +
"count(distinct date(att.leavedatetime)) as totaldaysleave, " +
"MAX(DAY(LAST_DAY(COALESCE(att.indatetime, att.leavedatetime, att.oddatetime)))) - " +
"((count(distinct date(att.indatetime)) + " +
"count(distinct case when att.indatetime is null then date(att.oddatetime) end) + " +
"count(distinct date(att.leavedatetime)))) as totaldaysabsent, " +
"et.incharge_name, et.incharge_phoneno, et.incharge_designation, et.zone, " +
"et.division, et.department, sk.group_name from attendance att "
+ " left join enrollment_table et on att.enrollment_id = et.enrollment_id "
+ " left join suyaudavi_kuzhu sk on et.group_id = sk.group_id where et.emp_type='Park' AND "
+ " (DATE(att.indatetime) BETWEEN STR_TO_DATE('" + fromdate + "', '%Y-%m-%d') AND STR_TO_DATE('" + " (DATE(att.indatetime) BETWEEN STR_TO_DATE('" + fromdate + "', '%Y-%m-%d') AND STR_TO_DATE('"
+ todate + "', '%Y-%m-%d') " + todate + "', '%Y-%m-%d') "
+ " OR DATE(att.oddatetime) BETWEEN STR_TO_DATE('" + fromdate + "', '%Y-%m-%d') AND STR_TO_DATE('" + " OR DATE(att.oddatetime) BETWEEN STR_TO_DATE('" + fromdate + "', '%Y-%m-%d') AND STR_TO_DATE('"
@ -2787,11 +2893,15 @@ public class NulmService {
return results; return results;
} }
///
public Map<String, List<String>> fetchAttendanceDates(String enrollmentId, String fromdate, String todate, public Map<String, List<String>> fetchAttendanceDates(String enrollmentId, String fromdate, String todate,
String type) { // newly added String type) { // newly added
Map<String, List<String>> attendanceData = new HashMap<>(); Map<String, List<String>> attendanceData = new HashMap<>();
if (type.equals("present")) {
if ("present".equals(type)) {
String presentQuery = "SELECT DISTINCT DATE_FORMAT(DATE(indatetime), '%d-%m-%Y') AS PresentDates " + String presentQuery = "SELECT DISTINCT DATE_FORMAT(DATE(indatetime), '%d-%m-%Y') AS PresentDates " +
"FROM attendance WHERE enrollment_id = ? AND DATE(indatetime) BETWEEN STR_TO_DATE(? , '%Y-%m-%d') AND " "FROM attendance WHERE enrollment_id = ? AND DATE(indatetime) BETWEEN STR_TO_DATE(? , '%Y-%m-%d') AND "
+ +
@ -2799,17 +2909,17 @@ public class NulmService {
attendanceData.put("presentDates", attendanceData.put("presentDates",
jdbcTemplate.queryForList(presentQuery, String.class, enrollmentId, fromdate, todate)); jdbcTemplate.queryForList(presentQuery, String.class, enrollmentId, fromdate, todate));
} else if (type.equals("od")) {
} else if ("od".equals(type)) {
String odQuery = "SELECT DISTINCT DATE_FORMAT(DATE(oddatetime), '%d-%m-%Y') AS OdDates " + String odQuery = "SELECT DISTINCT DATE_FORMAT(DATE(oddatetime), '%d-%m-%Y') AS OdDates " +
"FROM attendance WHERE enrollment_id = ? AND DATE(oddatetime) BETWEEN STR_TO_DATE(?, '%Y-%m-%d') AND STR_TO_DATE(?, '%Y-%m-%d')"; "FROM attendance WHERE enrollment_id = ? AND DATE(oddatetime) BETWEEN STR_TO_DATE(?, '%Y-%m-%d') AND STR_TO_DATE(?, '%Y-%m-%d')";
attendanceData.put("odDates", attendanceData.put("odDates",
jdbcTemplate.queryForList(odQuery, String.class, enrollmentId, fromdate, todate)); jdbcTemplate.queryForList(odQuery, String.class, enrollmentId, fromdate, todate));
} else if (type.equals("leave")) {
} else if ("leave".equals(type)) {
String leaveQuery = "SELECT DISTINCT DATE_FORMAT(DATE(leavedatetime), '%d-%m-%Y') AS LeaveDates " + String leaveQuery = "SELECT DISTINCT DATE_FORMAT(DATE(leavedatetime), '%d-%m-%Y') AS LeaveDates " +
"FROM attendance WHERE enrollment_id = ? AND DATE(leavedatetime) BETWEEN STR_TO_DATE(?, '%Y-%m-%d') AND STR_TO_DATE(?, '%Y-%m-%d')"; "FROM attendance WHERE enrollment_id = ? AND DATE(leavedatetime) BETWEEN STR_TO_DATE(?, '%Y-%m-%d') AND STR_TO_DATE(?, '%Y-%m-%d')";
attendanceData.put("leaveDates", attendanceData.put("leaveDates",
jdbcTemplate.queryForList(leaveQuery, String.class, enrollmentId, fromdate, todate)); jdbcTemplate.queryForList(leaveQuery, String.class, enrollmentId, fromdate, todate));
} else if (type.equals("absent")) {
} else if ("absent".equals(type)) {
String absentQuery = ""; String absentQuery = "";
} }
@ -2817,6 +2927,12 @@ public class NulmService {
return attendanceData; return attendanceData;
} }
///
///
public List<Map<String, Object>> getSelfHelpGroupDetails() { // newly added public List<Map<String, Object>> getSelfHelpGroupDetails() { // newly added
String sql = "select * from suyaudavi_kuzhu where isactive = 1 and isdelete =0 order by group_name asc"; String sql = "select * from suyaudavi_kuzhu where isactive = 1 and isdelete =0 order by group_name asc";
List<Map<String, Object>> results = jdbcTemplate.queryForList(sql); List<Map<String, Object>> results = jdbcTemplate.queryForList(sql);
@ -2829,7 +2945,7 @@ public class NulmService {
+ +
"FROM enrollment_table e " + "FROM enrollment_table e " +
"left join suyaudavi_kuzhu sk on e.group_id = sk.group_id " + "left join suyaudavi_kuzhu sk on e.group_id = sk.group_id " +
"WHERE NOT EXISTS ( SELECT 1 " +
"WHERE e.emp_type='NULM' AND NOT EXISTS ( SELECT 1 " +
" FROM salary_details s " + " FROM salary_details s " +
" WHERE e.enrollment_id = s.enrollment_id " + " WHERE e.enrollment_id = s.enrollment_id " +
" AND s.month = ? " + " AND s.month = ? " +
@ -2848,6 +2964,35 @@ public class NulmService {
return jdbcTemplate.queryForList(sql, params.toArray()); return jdbcTemplate.queryForList(sql, params.toArray());
} }
///
public List<Map<String, Object>> getSalaryNotInitiatedReportPark(String month, Integer year, String groupName) {
String sql = "SELECT e.emp_id, e.name, e.designation, e.incharge_name, e.incharge_designation, e.incharge_phoneno, sk.group_name "
+
"FROM enrollment_table e " +
"left join suyaudavi_kuzhu sk on e.group_id = sk.group_id " +
"WHERE e.emp_type='Park' AND NOT EXISTS ( SELECT 1 " +
" FROM salary_details_park s " +
" WHERE e.enrollment_id = s.enrollment_id " +
" AND s.month = ? " +
" AND s.year = ? )"
+ (groupName != null && !groupName.isEmpty() ? " and sk.group_name = ? " : "");
List<Object> params = new ArrayList<>();
params.add(month);
params.add(year);
if (groupName != null && !groupName.isEmpty()) {
params.add(groupName);
}
return jdbcTemplate.queryForList(sql, params.toArray());
}
///
public boolean checkSalaryDetails(int enrollmentId, String month, int year) { public boolean checkSalaryDetails(int enrollmentId, String month, int year) {
String sql = "select enrollment_id from salary_details where enrollment_id =? and month = ? and year = ?"; String sql = "select enrollment_id from salary_details where enrollment_id =? and month = ? and year = ?";
// boolean result = jdbcTemplate.update(sql, enrollmentId, month, year) == 1; // boolean result = jdbcTemplate.update(sql, enrollmentId, month, year) == 1;

23
gcc_officer_portal/src/main/java/in/gov/chennaicorporation/gccoffice/vtrack/service/VehicleService.java

@ -739,6 +739,29 @@ public class VehicleService {
break; break;
case "26":
System.out.println("TempID is 26 (1590940 - Health - Tobacco seizures - IMAGE - STATIC)");
urlString = "https://media.smsgupshup.com/GatewayAPI/rest?"
+ "userid=" + username
+ "&password=" + password
+ "&send_to=" + sendTo
+ "&v=1.1&format=json"
+ "&msg_type=IMAGE"
+ "&method=SENDMEDIAMESSAGE"
+ "&caption=%2AGCC+Enforcement+Team+Monitoring%2A%0A%0AToday%27s+%28" + msgDate
+ "%29+Zone+wise+Enforcement+Team+activity+details+shared+above+for+your+reference.%0A%0AFor+more+details%2C+please+click+the+link+below."
+ "&media_url=" + fileURL
+ "&isTemplate=true&footer=GCC+-+IT+Cell";
urlString = "https://sendapiv1.pinbot.ai/pinwa/sendMessage?type=template"
+ "&apikey=" + apikey
+ "&from=" + from
+ "&to={{to}}&templateid=2784943"
+ "&url=" + fileURL
+ "&placeholders=Health-%20Tobacco%20seizures";
break;
default: default:
System.out.println("TempID (" + tempid + ") is unknown"); System.out.println("TempID (" + tempid + ") is unknown");
} }

552
gcc_officer_portal/src/main/resources/templates/modules/nulm/attendance-report-park.html

@ -0,0 +1,552 @@
<!DOCTYPE html>
<html lang="en" dir="" xmlns="http://www.w3.org/1999/html">
<html xmlns:th="http://www.thymeleaf.org">
<head th:replace="~{fragments/modules/base/head :: head}">
<style>
/* Modal Styles */
.modal {
display: none;
position: fixed;
z-index: 1;
left: 0;
top: 0;
width: 100%;
height: 100%;
background-color: rgba(0,0,0,0.5);
}
.modal-content {
background-color: white;
margin: 15% auto;
padding: 20px;
border: 1px solid #888;
width: 40%;
text-align: center;
}
.close {
color: red;
float: right;
font-size: 28px;
font-weight: bold;
cursor: pointer;
}
</style>
</head>
<body>
<div class="wrapper">
<header th:replace="~{fragments/modules/base/header :: header}"></header>
<div class="page-wrap">
<div th:replace="~{fragments/modules/base/menu :: menu}"></div>
<div class="main-content">
<div class="container-fluid">
<div class="page-header">
<div class="row align-items-end">
<div class="col-lg-6">
<div class="page-header-title">
<i class="ik ik-thumbs-up bg-blue"></i>
<div class="d-inline">
<h5>Park STAFF</h5>
<span>Park Attendance Report</span>
</div>
</div>
</div>
<div class="col-lg-6">
<nav class="breadcrumb-container" aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item">
<a href="/index"><i class="ik ik-home"></i></a>
</li>
<li class="breadcrumb-item active" aria-current="page">Park Attendance Report</li>
</ol>
</nav>
</div>
</div>
</div>
<hr>
<!-- Filters Section -->
<div class="row">
<div class="col-sm-3">
<label for="zone">Zone</label>
<select id="zone" class="form-control">
<option value="">Select</option>
<option value="1">Zone 01</option>
<option value="2">Zone 02</option>
<option value="3">Zone 03</option>
<option value="4">Zone 04</option>
<option value="5">Zone 05</option>
<option value="6">Zone 06</option>
<option value="7">Zone 07</option>
<option value="8">Zone 08</option>
<option value="9">Zone 09</option>
<option value="10">Zone 10</option>
<option value="11">Zone 11</option>
<option value="12">Zone 12</option>
<option value="13">Zone 13</option>
<option value="14">Zone 14</option>
<option value="15">Zone 15</option>
</select>
</div>
<!-- Division -->
<div class="col-md-3 form-group">
<label for="division">Division</label>
<select class="form-control" id="division" name="division" required>
<option value="">Select Division</option>
<option th:each="division : ${divisionList}" th:value="${division.division}" th:text="${division.division}"
th:selected="${division.division == selectedDivision}">
</option>
</select>
</div>
<!-- Year -->
<!--<div class="col-md-3 form-group">
<label for="year">Year</label>
<select class="form-control" id="year" name="year" required>
<option value="">Select Year</option>
<option th:each="year : ${yearList}" th:value="${year.year}" th:text="${year.year}"
th:selected="${year.year == selectedYear}">
</option>
</select>
</div>
Month
<div class="col-md-3 form-group">
<label for="month">Month</label>
<select id="month" class="form-control" name="month" required>
<option value="">Select Month</option>
<option th:each="month : ${monthList}" th:value="${month.month}" th:text="${month.month}"
th:selected="${month.month == selectedMonth}">
</option>
</select>
</div>-->
<div class="col-sm-3">
<label for="fromdate">From Date</label>
<input type ='date' id = 'fromdate' name= 'fromdate' class="form-control">
</div>
<div class="col-sm-3">
<label for="todate">To Date</label>
<input type ='date' id = 'todate' name= 'todate' class="form-control">
</div>
<div class="col-sm-3" style="display: none;">
<label for="selfhelp">Self Help Group </label>
<select id="selfhelp" class="form-control">
<option value="">Select</option>
<!-- Group names will be populated here -->
</select>
</div>
<div class="col-sm-3">
<button class="btn btn-primary mt-4" onclick="fetchAttendanceReport()">Get Attendance Details</button>
</div>
<div class="col-sm-3">
<!--<label style="font-weight: bold;"> Month: </label>-->
<span class="btn btn-primary mt-4" id = "from_date" th:text="${fromdate}"></span>
</div>
<div class="col-sm-3">
<!--<label style="font-weight: bold">Year: </label>-->
<span class="btn btn-primary mt-4" id= "to_date" th:text="${todate}"></span>
</div>
</div>
<!-- Salary Report Table -->
<div class="card-block mt-3">
<table id="attendancereporttable" class="table table-striped table-bordered">
<thead class="thead-dark">
<tr>
<th>S.No</th>
<!-- <th>Date</th>-->
<th>Employee Id</th>
<th>Employee Name</th>
<th>Total no.of Days</th>
<th>Present Days</th>
<th>OD Days</th>
<th>Leave Days</th>
<th>Absent Days</th>
<!-- <th>Attendance Status</th>-->
<th>Incharge Name</th>
<th>Incharge Mobile Number</th>
<th>Incharge Designation</th>
<th>Zone</th>
<th>Division</th>
<th>Department</th>
<th>Self Help Group</th>
</tr>
</thead>
<tbody>
<tr th:each="attendance, i : ${consolidatedAttendanceReport}">
<td th:text="${i.count}">1</td>
<!-- <td th:text="${attendance.attendance_date}"></td>-->
<td th:text="${attendance.emp_id}"></td>
<!-- <td th:hidden="${attendance.enrollment_id}" ></td>-->
<td th:text="${attendance.name}"></td>
<td th:text="${attendance.total_days}"></td>
<td th:text="${attendance.totaldayspresent}"
th:onclick="fetchAttendanceDates('present', [[${attendance.enrollment_id}]], [[${fromdate}]], [[${todate}]], [[${attendance.name}]])"></td>
<td th:text="${attendance.totaldaysod}"
th:onclick="fetchAttendanceDates('od', [[${attendance.enrollment_id}]], [[${fromdate}]], [[${todate}]], [[${attendance.name}]])"></td>
<td th:text="${attendance.totaldaysleave}"
th:onclick="fetchAttendanceDates('leave', [[${attendance.enrollment_id}]], [[${fromdate}]], [[${todate}]], [[${attendance.name}]])"></td>
<td th:text="${attendance.totaldaysabsent}"></td>
<!-- <td th:text="${attendance.attendance_status}"></td>-->
<td th:text="${attendance.incharge_name}"></td>
<td th:text="${attendance.incharge_phoneno}"></td>
<td th:text="${attendance.incharge_designation}"></td>
<td th:text="${attendance.zone}"></td>
<td th:text="${attendance.division}"></td>
<td th:text="${attendance.department}"></td>
<td th:text="${attendance.group_name}"></td>
</tr>
</tbody>
<tfoot class="thead-dark">
<tr>
<th>S.No</th>
<!-- <th>Date</th>-->
<th>Employee Id</th>
<th>Employee Name</th>
<th>Total no.of Days</th>
<th>Present Days</th>
<th>OD Days</th>
<th>Leave Days</th>
<th>Absent Days</th>
<!-- <th>Attendance Status</th>-->
<th>Incharge Name</th>
<th>Incharge Mobile Number</th>
<th>Incharge Designation</th>
<th>Zone</th>
<th>Division</th>
<th>Department</th>
<th>Self Help Group</th>
</tr>
</tfoot>
</table>
</div>
<div id="myModal" class="modal" style="display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.5);">
<div class="modal-content" style="position: relative; width: 50%; margin: 10% auto; background: white; padding: 20px; border-radius: 10px;">
<!-- Close Button -->
<button type="button" class="btn btn-danger close-btn" onclick="closeModal()" style="position: absolute; top: 10px; right: 10px;">&times;</button>
<h4 id="modalTitle"></h4>
<!-- Scrollable Table -->
<div style="max-height: 300px; overflow-y: auto; border: 1px solid #ddd; padding: 5px;">
<table class="table table-striped table-bordered">
<thead class="thead-dark">
<tr>
<th>S.No</th>
<th>Dates</th>
</tr>
</thead>
<tbody id="modalTableBody">
<!-- Dynamic rows will be added here -->
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<footer th:replace="~{fragments/modules/base/footer :: footer}"></footer>
</div>
</div>
<div th:replace="~{fragments/modules/base/script :: script}"></div>
<script th:inline="javascript">
/*function loadYear(selectedYear) {
$.ajax({
url: '/gcc/api/nulm/getYear',
type: 'GET',
success: function (response) {
const yearDropdown = $('#year');
yearDropdown.empty(); // Clear existing options
yearDropdown.append('<option value="">Select Year</option>');
response.forEach(function (year) {
const yearName = year.year; // Correct the attribute name if necessary
const isSelected = yearName === selectedYear ? 'selected' : '';
yearDropdown.append(new Option(yearName, yearName, false, isSelected));
});
// If no department selected, show "Select Zone"
if (!selectedYear) {
yearDropdown.val('');
}
},
error: function (xhr, status, error) {
console.error('Error fetching departments:', error);
}
});
}*/
//const selectedYear = /*[[${selectedYear}]]*/ ''; // Get this from Thymeleaf or other server-side context
//loadYear(selectedYear);
/*function loadMonth(selectedMonth) {
const year = document.getElementById('year').value; // Get the selected year
if (!year) {
$('#month').empty().append('<option value="">Select Month</option>'); // Clear month dropdown if no year selected
return; // Exit if no year is selected
}
$.ajax({
url: `/gcc/api/nulm/getMonth?year=${year}`,
type: 'GET',
success: function (response) {
const monthDropdown = $('#month');
monthDropdown.empty(); // Clear existing options
monthDropdown.append('<option value="">Select Month</option>');
response.forEach(function (month) {
const monthName = month.month;
monthDropdown.append(new Option(monthName, monthName));
});
},
error: function (xhr, status, error) {
console.error('Error fetching months:', error);
}
});
}
// Load months when the year changes
document.getElementById('year').addEventListener('change', function () {
loadMonth(); // Call loadMonth when the year is selected
});*/
function loadDivision(selectedDivision) {
const zone=document.getElementById('zone').value;
console.log(zone);
$.ajax({
url: '/gcc/api/nulm/getDivisionList',
type: 'GET',
data: {
zone: zone
},
success: function (response) {
const divisionDropdown = $('#division');
divisionDropdown.empty(); // Clear existing options
divisionDropdown.append('<option value="">Select Division</option>');
response.forEach(function (division) {
const divisionName = division.division; // Correct the attribute name if necessary
const isSelected = divisionName === selectedDivision ? 'selected' : '';
divisionDropdown.append(new Option(divisionName, divisionName, false, isSelected));
});
// If no department selected, show "Select Zone"
if (!selectedDivision) {
divisionDropdown.val('');
}
},
error: function (xhr, status, error) {
console.error('Error fetching zone:', error);
}
});
}
// Load division when zone selected
document.getElementById('zone').addEventListener('change', function () {
loadDivision(); // Call loadDivision when the zone is selected
});
function fetchAttendanceReport() {
const zone=document.getElementById('zone').value;
const division=document.getElementById('division').value;
//const month = document.getElementById('month').value;
//const year = document.getElementById('year').value;
const groupName=document.getElementById('selfhelp').value;
const fromdate=document.getElementById('fromdate').value;
const todate=document.getElementById('todate').value;
console.log(fromdate);
console.log(todate);
if (fromdate && todate) {
// window.location.href = `/gcc/nulm/attendance-report?groupName=${groupName}&zone=${zone}&division=${division}&fromdate=${fromdate}
// &todate=${todate}`;
window.location.href = `/gcc/nulm/consolidated-attendance-report-park?groupName=${groupName}&zone=${zone}&division=${division}&fromdate=${fromdate}
&todate=${todate}`;
} else {
alert("Please select both From date and To date.");
}
}
$(document).ready(function () {
function clearUrlParams() {
const currentUrl = window.location.href;
const urlWithoutParams = currentUrl.split('?')[0]; // Remove the query parameters
window.history.replaceState({}, document.title, urlWithoutParams); // Replace the current URL without params
}
// Call this on page load to reset the URL
clearUrlParams();
// Initialize DataTable
var table = $('#attendancereporttable').DataTable({
dom: 'Bftip',
columnDefs: [
{targets: 'no-sort', orderable: false}
],
lengthMenu: [
[50, 100, 200, 500, -1],
['50 rows', '100 rows', '200 rows', 'Show all']
],
scrollY: '50vh',
fixedColumns: {
left: 1,
right: 1
},
buttons: [
{
extend: 'pageLength',
className: 'btn btn-warning'
},
{
title: 'Data export',
extend: 'copyHtml5',
text: 'Copy',
className: 'btn btn-secondary',
id: 'copyBtn'
},
{
extend: 'pdfHtml5',
text: 'PDF',
className: 'btn btn-secondary',
id: 'pdfBtn',
exportOptions: {
columns: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
},
orientation: 'landscape', // Change to landscape for more horizontal space
pageSize: 'A3', // You can change to A4 or A3 depending on your needs
customize: function (doc) {
// Custom column widths for better fit
doc.content[1].table.widths = ['4%', '8%', '9%', '6%', '6%', '6%', '6%', '6%', '5%', '9%', '9%', '4%', '8%', '8%', '8%'];
// Optional: Adjust font size if needed
doc.styles.tableBodyEven.alignment = 'center';
doc.styles.tableBodyOdd.alignment = 'center';
}
},
{
extend: 'excelHtml5',
text: 'EXCEL',
className: 'btn btn-secondary',
id: 'excelBtn'
},
{
extend: 'csvHtml5',
text: 'CSV',
className: 'btn btn-secondary',
id: 'csvBtn'
}
],
fixedHeader: true,
autoWidth: true,
responsive: true,
searching: true,
select: false,
processing: false
});
});
$(document).ready(function () {
$.ajax({
url: '/gcc/api/nulm/selfHelpGroups',
type: 'GET',
success: function (data) {
// Clear existing options (if any)
$('#selfhelp').empty().append('<option value="">Select</option>');
// Check if data is an array and iterate through it
if (Array.isArray(data)) {
let options = '';
data.forEach(function (group) {
// Access the correct properties
options += `<option value="${group.groupName}">${group.groupName}</option>`;
});
$('#selfhelp').append(options);
} else {
console.error("Data is not an array:", data);
}
},
error: function (xhr, status, error) {
console.error("Error fetching self-help groups:", error);
}
});
});
function fetchAttendanceDates(type, enrollmentId, fromdate, todate, name) {
const apiUrl = `/gcc/api/nulm/attendance-dates?enrollmentId=${enrollmentId}&fromdate=${fromdate}&todate=${todate}&type=${type}`;
console.log("type="+type);
fetch(apiUrl)
.then(response => response.json())
.then(data => {
let dates = data[`${type}Dates`] || [];
showModal(type, dates, fromdate, todate, name);
})
.catch(error => {
console.error("Error fetching data:", error);
alert("Failed to fetch attendance data.");
});
}
function showModal(type, dates, fromdate, todate, name) {
document.getElementById("modalTitle").innerText = `${type.toUpperCase()} Dates for ${name}, ${fromdate} to ${todate}`;
let tableBody = document.getElementById("modalTableBody");
tableBody.innerHTML = ""; // Clear previous data
if (dates.length > 0) {
dates.forEach((date, index) => {
let row = `<tr>
<td>${index + 1}</td>
<td>${date}</td>
</tr>`;
tableBody.innerHTML += row;
});
} else {
tableBody.innerHTML = `<tr><td colspan="2">No data available.</td></tr>`;
}
document.getElementById("myModal").style.display = "block";
}
function closeModal() {
document.getElementById("myModal").style.display = "none";
}
// Function to open the modal
function openModal() {
document.getElementById("myModal").style.display = "block";
}
</script>
</body>
</html>

4
gcc_officer_portal/src/main/resources/templates/modules/nulm/attendance-report.html

@ -494,12 +494,14 @@
}); });
function fetchAttendanceDates(type, enrollmentId, fromdate, todate, name) { function fetchAttendanceDates(type, enrollmentId, fromdate, todate, name) {
const apiUrl = `/gcc/nulm/attendance-dates?enrollmentId=${enrollmentId}&fromdate=${fromdate}&todate=${todate}&type=${type}`;
const apiUrl = `/gcc/api/nulm/attendance-dates?enrollmentId=${enrollmentId}&fromdate=${fromdate}&todate=${todate}&type=${type}`;
console.log("type="+type);
fetch(apiUrl) fetch(apiUrl)
.then(response => response.json()) .then(response => response.json())
.then(data => { .then(data => {
let dates = data[`${type}Dates`] || []; let dates = data[`${type}Dates`] || [];
console.log("dates="+dates);
showModal(type, dates, fromdate, todate, name); showModal(type, dates, fromdate, todate, name);
}) })
.catch(error => { .catch(error => {

380
gcc_officer_portal/src/main/resources/templates/modules/nulm/updated-staff-park.html

@ -0,0 +1,380 @@
<!DOCTYPE html>
<html lang="en" dir="">
<html xmlns:th="http://www.thymeleaf.org">
<head th:replace="~{fragments/modules/base/head :: head}">
</head>
<body>
<!--[if lt IE 8]>
<p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
<![endif]-->
<div class="wrapper">
<!-- header top menu Start -->
<header th:replace="~{fragments/modules/base/header :: header}"></header>
<!-- header top menu end -->
<div class="page-wrap">
<!--=============== Left Menu side Start ================-->
<div th:replace="~{fragments/modules/base/menu :: menu}"></div>
<!--=============== Left side End ================-->
<div class="main-content">
<div class="container-fluid">
<div class="page-header">
<div class="row align-items-end">
<div class="col-lg-6">
<div class="page-header-title">
<i class="ik ik-thumbs-up bg-blue"></i>
<div class="d-inline">
<h5>NULM STAFF</h5>
<span>Staff Details Updation Park</span>
</div>
</div>
</div>
<div class="col-lg-6">
<nav class="breadcrumb-container" aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item">
<a href="/index"><i class="ik ik-home"></i></a>
</li>
<li class="breadcrumb-item active" aria-current="page">Park StaffDetails Updation</li>
</ol>
</nav>
</div>
</div>
</div>
<hr>
<div class="card-block">
<div>
<form id="departmentFilterForm" method="GET" action="/gcc/nulm/updateStaffPark">
<div class="form-group">
<label for="zone">Zone (Department)</label>
<select class="form-control" id="zone" name="department" style="width: 300px;" onchange="this.form.submit()">
<option value="">Select Zone</option>
<option th:each="department : ${departments}"
th:value="${department.department}"
th:text="${department.department}"
th:selected="${department.department == selectedDepartment}">
</option>
</select>
</div>
</form>
<table id="salaryDatatable" class="table table-striped table-bordered table-hover dataTable" role="grid" width="99.5%">
<thead class="thead-dark">
<tr role="row">
<th>S.No</th>
<th>Employee ID</th>
<th>Employee Name</th>
<th>Designation</th>
<th>Gender</th>
<th>Date Of Birth</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<tr th:each="enrollments, i : ${enrollments}">
<td th:text="${i.count}">0</td>
<td th:text="${enrollments.emp_id}"></td>
<td th:text="${enrollments.name}"></td>
<td th:text="${enrollments.designation}"></td>
<td th:text="${enrollments.gender}"></td>
<td th:text="${enrollments.date_of_birth}"></td>
<td class="text-center">
<a href="#" th:onclick="return callEdit([[${enrollments.enrollment_id}]])" data-animation="true" data-toggle="tooltip" data-placement="top" title="Edit" data-original-title="Edit"><i class="ik ik-edit f-16 mr-15 text-green"></i></a>
</td>
</tr>
</tbody>
<tfoot class="thead-dark">
<tr role="row">
<th>S.No</th>
<th>Employee ID</th>
<th>Employee Name</th>
<th>Designation</th>
<th>Gender</th>
<th>Date Of Birth</th>
<th>Action</th>
</tr>
</tfoot>
</table>
</div>
</div>
<!-- Enrollment Edit Modal -->
<div class="modal fade" id="editEnrollmentModal" tabindex="-1" role="dialog" aria-labelledby="editEnrollmentModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="editEnrollmentModalLabel">Edit Enrollment Details</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<!-- Form for Editing Enrollment -->
<form id="editEnrollmentForm">
<input type="hidden" id="enrollmentId" name="enrollmentId">
<div class="form-group">
<label for="name">Name</label>
<input type="text" class="form-control" id="name" name="name" disabled style="color: black;">
</div>
<div class="form-group">
<label for="dateOfBirth">Date of Birth</label>
<input type="date" class="form-control" id="dateOfBirth" name="dateOfBirth" required>
</div>
<div class="form-group">
<label for="gender">Gender</label>
<input type="text" class="form-control" id="gender" name="gender" required>
</div>
<div class="form-group">
<label for="gender">Designation</label>
<input type="text" class="form-control" id="designation" name="designation" disabled style="color: black;">
</div>
<div class="form-group">
<label for="inchargeName">Incharge Name</label>
<input type="text" class="form-control" id="inchargename" name="inchargename" disabled style="color: black;">
</div>
<div class="form-group">
<label for="phoneNumber">Incharge Number</label>
<input type="number" class="form-control" id="inchargeno" name="inchargeno" disabled style="color: black;">
</div>
<div class="form-group">
<label for="shg">Self Help Group</label>
<select class="form-control" id="shg" name="shg" required>
<!-- Dropdown options will be populated dynamically via JavaScript -->
</select>
</div>
<div class="form-group">
<label for="orderNumber">Order Number</label>
<select class="form-control" id="orderNumber" name="orderNumber" required>
<!-- Dropdown options will be populated dynamically via JavaScript -->
</select>
</div>
<!-- Add more fields as needed -->
<button type="button" class="btn btn-primary" id="updateEnrollmentButton">Save Changes</button>
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
<footer th:replace="~{fragments/modules/base/footer :: footer}"></footer>
</div>
</div>
<div th:replace="~{fragments/modules/pgr/modal-box :: div}"></div>
<div th:replace="~{fragments/modules/base/app_module_menu_box :: div}"></div>
<script th:replace="~{fragments/modules/base/script :: script}"></script>
<script th:replace="~{fragments/modules/pgr/script :: script}"></script>
<script th:inline="javascript">
$(document).ready(function () {
// Initialize DataTable
const table = $('#salaryDatatable').DataTable({
dom: 'Bftip',
columnDefs: [
{ targets: 'no-sort', orderable: false }
],
lengthMenu: [
[50, 100, 200, 500, -1],
['50 rows', '100 rows', '200 rows', 'Show all']
],
scrollY: '50vh',
fixedColumns: {
left: 1,
right: 1
},
buttons: [
{ extend: 'pageLength', className: 'btn btn-warning' },
{ title: 'Data export', extend: 'copyHtml5', text: 'Copy', className: 'btn btn-secondary', id: 'copyBtn' },
{ extend: 'excelHtml5', text: 'Excel', className: 'btn btn-secondary', id: 'excelBtn' },
{ extend: 'csvHtml5', text: 'CSV', className: 'btn btn-secondary', id: 'csvBtn' },
{ extend: 'pdfHtml5', text: 'PDF', className: 'btn btn-secondary', id: 'pdfBtn' }
],
fixedHeader: true,
autoWidth: true,
responsive: true,
searching: true,
select: false,
processing: false
});
// Function to open the edit modal and populate data
window.callEdit = function (enrollmentId) {
fetchEnrollmentDetails(enrollmentId);
return false; // Prevent default anchor click behavior
};
function loadDepartments(selectedDepartment) {
$.ajax({
url: '/gcc/api/nulm/getDepartment',
type: 'GET',
success: function (response) {
const departmentDropdown = $('#zone');
departmentDropdown.empty(); // Clear existing options
departmentDropdown.append('<option value="">Select Zone</option>');
response.forEach(function (department) {
const departmentName = department.department; // Correct the attribute name if necessary
const isSelected = departmentName === selectedDepartment ? 'selected' : '';
departmentDropdown.append(new Option(departmentName, departmentName, false, isSelected));
});
// If no department selected, show "Select Zone"
if (!selectedDepartment) {
departmentDropdown.val('');
}
},
error: function (xhr, status, error) {
console.error('Error fetching departments:', error);
}
});
}
// Load departments on page load
const selectedDepartment = /*[[${selectedDepartment}]]*/ ''; // Get this from Thymeleaf or other server-side context
loadDepartments(selectedDepartment);
function fetchEnrollmentDetails(enrollmentId) {
$.ajax({
url: `/gcc/api/nulm/getEnrollmentdeatilsByID/${enrollmentId}`,
type: 'GET',
success: function (response) {
if (response && response.length > 0) {
const enrollment = response[0];
// Populate modal fields with data
$('#enrollmentId').val(enrollment.enrollment_id);
$('#name').val(enrollment.name);
$('#dateOfBirth').val(enrollment.date_of_birth);
$('#gender').val(enrollment.gender);
$('#designation').val(enrollment.designation);
$('#inchargename').val(enrollment.incharge_name);
$('#inchargeno').val(enrollment.incharge_phoneno);
// Call fetchDropdownData and pass the existing group and order values
fetchDropdownData(enrollment.group_id, enrollment.order_id);
// Open the modal
$('#editEnrollmentModal').modal('show');
} else {
alert('Enrollment details not found.');
}
},
error: function (xhr, status, error) {
console.error('Error fetching enrollment details:', error);
alert('An error occurred while fetching enrollment details.');
}
});
}
function fetchDropdownData(selectedGroupId, selectedOrderId) {
// Fetch Self Help Group dropdown
$.ajax({
url: '/gcc/api/nulm/selfHelpGroups',
type: 'GET',
success: function (response) {
const selfHelpGroupDropdown = $('#shg');
selfHelpGroupDropdown.empty(); // Clear existing options
selfHelpGroupDropdown.append('<option value="">Select Self Help Group</option>');
response.forEach(function (item) {
const isSelected = item.groupId == selectedGroupId ? 'selected' : ''; // Check if this option should be selected
selfHelpGroupDropdown.append(new Option(item.groupName, item.groupId, false, isSelected));
});
// If no group selected, show "Select Self Help Group"
if (!selectedGroupId) {
selfHelpGroupDropdown.val('');
}
},
error: function (xhr, status, error) {
console.error('Error fetching self-help groups:', error);
}
});
// Fetch Order Number dropdown
$.ajax({
url: '/gcc/api/nulm/orderNumbers',
type: 'GET',
success: function (response) {
const orderNumberDropdown = $('#orderNumber');
orderNumberDropdown.empty(); // Clear existing options
orderNumberDropdown.append('<option value="">Select Order Number</option>');
response.forEach(function (item) {
const isSelected = item.orderId == selectedOrderId ? 'selected' : ''; // Check if this option should be selected
orderNumberDropdown.append(new Option(item.orderNumber, item.orderId, false, isSelected));
});
// If no order selected, show "Select Order Number"
if (!selectedOrderId) {
orderNumberDropdown.val('');
}
},
error: function (xhr, status, error) {
console.error('Error fetching order numbers:', error);
}
});
}
$('#updateEnrollmentButton').on('click', function () {
const enrollmentId = $('#enrollmentId').val();
const updatedData = {
name: $('#name').val(),
dateOfBirth: $('#dateOfBirth').val(),
gender: $('#gender').val(),
groupId: $('#shg').val(), // Get the selected group_id from dropdown
orderId: $('#orderNumber').val() // Get the selected order_id from dropdown
};
$.ajax({
url: `/gcc/api/nulm/updateEnrollment/${enrollmentId}`,
type: 'POST',
data: updatedData,
success: function (response) {
Swal.fire({
title: 'Success!',
text: 'Enrollment updated successfully!',
icon: 'success',
confirmButtonText: 'OK'
}).then((result) => {
if (result.isConfirmed) {
$('#editEnrollmentModal').modal('hide'); // Hide the modal
location.reload(); // Optionally reload the page to refresh the data
}
});
},
error: function (xhr, status, error) {
console.error('Error updating enrollment details:', error);
alert('An error occurred while updating enrollment details.');
}
});
});
});
</script>
</body>
</html>

430
gcc_officer_portal/src/main/resources/templates/modules/nulm/zone-wise-report-park.html

@ -0,0 +1,430 @@
<!DOCTYPE html>
<html lang="en" dir="">
<html xmlns:th="http://www.thymeleaf.org">
<head th:replace="~{fragments/modules/base/head :: head}"></head>
<body>
<div class="wrapper">
<header th:replace="~{fragments/modules/base/header :: header}"></header>
<div class="page-wrap">
<div th:replace="~{fragments/modules/base/menu :: menu}"></div>
<div class="main-content">
<div class="container-fluid">
<div class="page-header">
<div class="row align-items-end">
<div class="col-lg-6">
<div class="page-header-title">
<i class="ik ik-thumbs-up bg-blue"></i>
<div class="d-inline">
<h5>Park STAFF</h5>
<span>Park Zone wise Report</span>
</div>
</div>
</div>
<div class="col-lg-6">
<nav class="breadcrumb-container" aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item">
<a href="/index"><i class="ik ik-home"></i></a>
</li>
<li class="breadcrumb-item active" aria-current="page">Park Zonewise Report</li>
</ol>
</nav>
</div>
</div>
</div>
<hr>
<!-- Filters Section -->
<div class="row">
<div class="col-sm-3">
<label for="zone">Zone</label>
<select id="zone" class="form-control">
<option value="">Select</option>
<option value="1">Zone 01</option>
<option value="2">Zone 02</option>
<option value="3">Zone 03</option>
<option value="4">Zone 04</option>
<option value="5">Zone 05</option>
<option value="6">Zone 06</option>
<option value="7">Zone 07</option>
<option value="8">Zone 08</option>
<option value="9">Zone 09</option>
<option value="10">Zone 10</option>
<option value="11">Zone 11</option>
<option value="12">Zone 12</option>
<option value="13">Zone 13</option>
<option value="14">Zone 14</option>
<option value="15">Zone 15</option>
</select>
</div>
<!-- Division -->
<div class="col-md-3 form-group">
<label for="division">Division</label>
<select class="form-control" id="division" name="division" required>
<option value="">Select Division</option>
<option th:each="division : ${divisionList}" th:value="${division.division}" th:text="${division.division}"
th:selected="${division.division == selectedDivision}">
</option>
</select>
</div>
<!-- Year -->
<div class="col-md-3 form-group">
<label for="year">Year</label>
<select class="form-control" id="year" name="year" required>
<option value="">Select Year</option>
<option th:each="year : ${yearList}" th:value="${year.year}" th:text="${year.year}"
th:selected="${year.year == selectedYear}">
</option>
</select>
</div>
<!-- Month -->
<div class="col-md-3 form-group">
<label for="month">Month</label>
<select id="month" class="form-control" name="month" required>
<option value="">Select Month</option>
<option th:each="month : ${monthList}" th:value="${month.month}" th:text="${month.month}"
th:selected="${month.month == selectedMonth}">
</option>
</select>
</div>
<div class="col-sm-3">
<label for="salaryStatus">Salary Status:</label>
<select id="salaryStatus" class="form-control">
<option value="">Select</option>
<option value="Initiated">Initiated</option>
<option value="Approved">Approved</option>
</select>
</div>
<div class="col-sm-3" style="display: none;">
<label for="selfhelp">Self Help Group:</label>
<select id="selfhelp" class="form-control">
<option value="">Select</option>
<!-- Group names will be populated here -->
</select>
</div>
<div class="col-sm-3">
<button class="btn btn-primary mt-4" onclick="fetchZoneReport()">Get Salary Info</button>
</div>
</div>
<!-- Salary Report Table -->
<div class="card-block mt-3">
<table id="salaryreporttable" class="table table-striped table-bordered">
<thead class="thead-dark">
<tr>
<th>S.No</th>
<th>Employee Id</th>
<th>Employee Name</th>
<th>Incharge Name</th>
<th>Incharge Designation</th>
<th>Zone</th>
<th>Division</th>
<th>Self Help Group</th>
<th>Days Present</th>
<th>OD</th>
<th>Total Days for Salary</th>
<th>Total Days</th>
<th>Total Days Absent</th>
<th>Month</th>
<th>Year</th>
<th>Salary Amount</th>
<th>Salary Status</th>
</tr>
</thead>
<tbody>
<tr th:each="zone, i : ${zonewiseReport}">
<td th:text="${i.count}">1</td>
<td th:text="${zone.emp_id}"></td>
<td th:text="${zone.name}"></td>
<td th:text="${zone.incharge_name}"></td>
<td th:text="${zone.incharge_designation}"></td>
<td th:text="${zone.zone}"></td>
<td th:text="${zone.division}"></td>
<td th:text="${zone.group_name}"></td>
<td th:text="${zone.total_days_present}"></td>
<td th:text="${zone.total_days_od}"></td>
<td th:text="${zone.total_days_salary}"></td>
<td th:text="${zone.total_days}"></td>
<td th:text="${zone.total_days_absent}"></td>
<td th:text="${zone.imonth}"></td>
<td th:text="${zone.iyear}"></td>
<td th:text="${zone.total_salary}"></td>
<td th:text="${zone.salary_status}"></td>
</tr>
</tbody>
<tfoot class="thead-dark">
<tr>
<th>S.No</th>
<th>Employee Id</th>
<th>Employee Name</th>
<th>Incharge Name</th>
<th>Incharge Designation</th>
<th>Zone</th>
<th>Division</th>
<th>Self Help Group</th>
<th>Days Present</th>
<th>OD</th>
<th>Total Days for Salary</th>
<th>Total Days</th>
<th>Total Days Absent</th>
<th>Month</th>
<th>Year</th>
<th>Salary Amount</th>
<th>Salary Status</th>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
<footer th:replace="~{fragments/modules/base/footer :: footer}"></footer>
</div>
</div>
<div th:replace="~{fragments/modules/base/script :: script}"></div>
<script th:inline="javascript">
function loadYear(selectedYear) {
$.ajax({
url: '/gcc/api/nulm/getYear',
type: 'GET',
success: function (response) {
const yearDropdown = $('#year');
yearDropdown.empty(); // Clear existing options
yearDropdown.append('<option value="">Select Year</option>');
response.forEach(function (year) {
const yearName = year.year; // Correct the attribute name if necessary
const isSelected = yearName === selectedYear ? 'selected' : '';
yearDropdown.append(new Option(yearName, yearName, false, isSelected));
});
// If no department selected, show "Select Zone"
if (!selectedYear) {
yearDropdown.val('');
}
},
error: function (xhr, status, error) {
console.error('Error fetching departments:', error);
}
});
}
const selectedYear = /*[[${selectedYear}]]*/ ''; // Get this from Thymeleaf or other server-side context
loadYear(selectedYear);
function loadMonth(selectedMonth) {
const year = document.getElementById('year').value; // Get the selected year
if (!year) {
$('#month').empty().append('<option value="">Select Month</option>'); // Clear month dropdown if no year selected
return; // Exit if no year is selected
}
$.ajax({
url: `/gcc/api/nulm/getMonth?year=${year}`,
type: 'GET',
success: function (response) {
const monthDropdown = $('#month');
monthDropdown.empty(); // Clear existing options
monthDropdown.append('<option value="">Select Month</option>');
response.forEach(function (month) {
const monthName = month.month;
monthDropdown.append(new Option(monthName, monthName));
});
},
error: function (xhr, status, error) {
console.error('Error fetching months:', error);
}
});
}
// Load months when the year changes
document.getElementById('year').addEventListener('change', function () {
loadMonth(); // Call loadMonth when the year is selected
});
function loadDivision(selectedDivision) {
const zone=document.getElementById('zone').value;
console.log(zone);
$.ajax({
url: '/gcc/api/nulm/getDivisionList',
type: 'GET',
data: {
zone: zone
},
success: function (response) {
const divisionDropdown = $('#division');
divisionDropdown.empty(); // Clear existing options
divisionDropdown.append('<option value="">Select Division</option>');
response.forEach(function (division) {
const divisionName = division.division; // Correct the attribute name if necessary
const isSelected = divisionName === selectedDivision ? 'selected' : '';
divisionDropdown.append(new Option(divisionName, divisionName, false, isSelected));
});
// If no department selected, show "Select Zone"
if (!selectedDivision) {
divisionDropdown.val('');
}
},
error: function (xhr, status, error) {
console.error('Error fetching zone:', error);
}
});
}
// Load division when zone selected
document.getElementById('zone').addEventListener('change', function () {
loadDivision(); // Call loadDivision when the zone is selected
});
function fetchZoneReport() {
const month = document.getElementById('month').value;
const year = document.getElementById('year').value;
const salaryStatus = document.getElementById('salaryStatus').value;
const groupName=document.getElementById('selfhelp').value;
const zone=document.getElementById('zone').value;
const division=document.getElementById('division').value;
if (month && year) {
window.location.href = `/gcc/nulm/salary-zonereport-park?month=${month}&year=${year}&salaryStatus=${salaryStatus}
&groupName=${groupName}&zone=${zone}&division=${division}`;
} else {
alert("Please select both month and year.");
}
}
$(document).ready(function () {
function clearUrlParams() {
const currentUrl = window.location.href;
const urlWithoutParams = currentUrl.split('?')[0]; // Remove the query parameters
window.history.replaceState({}, document.title, urlWithoutParams); // Replace the current URL without params
}
// Call this on page load to reset the URL
clearUrlParams();
// Initialize DataTable
var table = $('#salaryreporttable').DataTable({
dom: 'Bftip',
columnDefs: [
{targets: 'no-sort', orderable: false}
],
lengthMenu: [
[50, 100, 200, 500, -1],
['50 rows', '100 rows', '200 rows', 'Show all']
],
scrollY: '50vh',
fixedColumns: {
left: 1,
right: 1
},
buttons: [
{
extend: 'pageLength',
className: 'btn btn-warning'
},
{
title: 'Data export',
extend: 'copyHtml5',
text: 'Copy',
className: 'btn btn-secondary',
id: 'copyBtn'
},
{
extend: 'pdfHtml5',
text: 'PDF',
className: 'btn btn-secondary',
id: 'pdfBtn',
exportOptions: {
columns: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]
},
orientation: 'landscape', // Change to landscape for more horizontal space
pageSize: 'A3', // You can change to A4 or A3 depending on your needs
customize: function (doc) {
// Custom column widths for better fit
doc.content[1].table.widths = ['4%', '8%', '8%', '8%', '9%', '4%', '6%', '8%', '7%', '6%', '6%', '6%', '6%', '9%', '9%', '7%','6%'];
// Optional: Adjust font size if needed
doc.styles.tableBodyEven.alignment = 'center';
doc.styles.tableBodyOdd.alignment = 'center';
}
},
{
extend: 'excelHtml5',
text: 'EXCEL',
className: 'btn btn-secondary',
id: 'excelBtn'
},
{
extend: 'csvHtml5',
text: 'CSV',
className: 'btn btn-secondary',
id: 'csvBtn'
}
],
fixedHeader: true,
autoWidth: true,
responsive: true,
searching: true,
select: false,
processing: false
});
});
$(document).ready(function () {
$.ajax({
url: '/gcc/api/nulm/selfHelpGroups',
type: 'GET',
success: function (data) {
// Clear existing options (if any)
$('#selfhelp').empty().append('<option value="">Select</option>');
// Check if data is an array and iterate through it
if (Array.isArray(data)) {
let options = '';
data.forEach(function (group) {
// Access the correct properties
options += `<option value="${group.groupName}">${group.groupName}</option>`;
});
$('#selfhelp').append(options);
} else {
console.error("Data is not an array:", data);
}
},
error: function (xhr, status, error) {
console.error("Error fetching self-help groups:", error);
}
});
});
</script>
</body>
</html>
Loading…
Cancel
Save