diff --git a/src/main/java/com/gcc/commissionerreview/service/AttendanceService.java b/src/main/java/com/gcc/commissionerreview/service/AttendanceService.java index 07c342f..75b0ef2 100644 --- a/src/main/java/com/gcc/commissionerreview/service/AttendanceService.java +++ b/src/main/java/com/gcc/commissionerreview/service/AttendanceService.java @@ -29,11 +29,11 @@ public class AttendanceService { public List> getAbstractCounts() { String sql = "SELECT emp_type, COUNT(enrollment_id) AS totalCount, " - + "SUM(CASE WHEN facial_attendance = 1 THEN 1 ELSE 0 END) AS facialRegistered, " - + "SUM(CASE WHEN facial_attendance = 0 THEN 1 ELSE 0 END) AS facialNotRegistered " - + "FROM enrollment_table " - + "WHERE isactive = 1 AND isdelete = 0 AND zone != 0 " - + "GROUP BY emp_type"; + + "SUM(CASE WHEN facial_attendance = 1 THEN 1 ELSE 0 END) AS facialRegistered, " + + "SUM(CASE WHEN facial_attendance = 0 THEN 1 ELSE 0 END) AS facialNotRegistered " + + "FROM enrollment_table " + + "WHERE isactive = 1 AND isdelete = 0 AND zone != 0 and emp_type ='Park' " + + "GROUP BY emp_type"; return jdbcTemplate.queryForList(sql); } @@ -81,10 +81,12 @@ public class AttendanceService { + "GROUP BY et.zone, fd.facialRegistered, fd.facialNotRegistered " + "ORDER BY et.zone"; - return jdbcTemplate.queryForList(sql, new Object[] { empType, fromDateTime, toDateTime, fromDateTime, toDateTime, fromDateTime, toDateTime, empType }); + return jdbcTemplate.queryForList(sql, new Object[] { empType, fromDateTime, toDateTime, fromDateTime, + toDateTime, fromDateTime, toDateTime, empType }); } - public List> getDetailedList(String empType, String category, String fromDateStr, String toDateStr, Integer zone, String parkName) { + public List> getDetailedList(String empType, String category, String fromDateStr, + String toDateStr, Integer zone, String parkName) { LocalDate fromDate; LocalDate toDate; @@ -120,11 +122,11 @@ public class AttendanceService { } String sql = "SELECT et.enrollment_id, et.name, et.designation, et.department, et.incharge_name, et.incharge_phoneno, et.emp_id, et.park_name, " - + "ifnull(att.appversion,'') as appversion, ifnull(att.apptype,'')as apptype, ifnull(att.location,'') as location, " - + "DATE_FORMAT(att.indatetime, '%d-%m-%Y %h:%i %p') as intime, att.inphoto as inphoto, att.inby, " - + "DATE_FORMAT(att.outdatetime, '%d-%m-%Y %h:%i %p') as outtime, att.outphoto as outphoto, att.outby, " - + "DATE_FORMAT(att.oddatetime, '%d-%m-%Y %h:%i %p') as odtime, att.odby, et.zone, " - + "DATE_FORMAT(att.leavedatetime, '%d-%m-%Y %h:%i %p') as leavedatetime, att.leaveby " + + "ifnull(att.appversion,'') as appversion, ifnull(att.apptype,'')as apptype, ifnull(att.location,'') as location, " + + "DATE_FORMAT(att.indatetime, '%d-%m-%Y %h:%i %p') as intime, att.inphoto as inphoto, att.inby, " + + "DATE_FORMAT(att.outdatetime, '%d-%m-%Y %h:%i %p') as outtime, att.outphoto as outphoto, att.outby, " + + "DATE_FORMAT(att.oddatetime, '%d-%m-%Y %h:%i %p') as odtime, att.odby, et.zone, " + + "DATE_FORMAT(att.leavedatetime, '%d-%m-%Y %h:%i %p') as leavedatetime, att.leaveby " + "FROM enrollment_table et " + "inner join attendance att on et.enrollment_id = att.enrollment_id " + " and " + filterDateColumn + " >= ? and " + filterDateColumn + " <= ? " @@ -148,7 +150,8 @@ public class AttendanceService { sql += " order by " + dateColumn + " desc "; - System.out.println("EmpType: " + empType + ", Category: " + category + ", From: " + fromDateTime + ", To: " + toDateTime + ", Zone: " + zone + ", ParkName: " + parkName); + System.out.println("EmpType: " + empType + ", Category: " + category + ", From: " + fromDateTime + ", To: " + + toDateTime + ", Zone: " + zone + ", ParkName: " + parkName); return jdbcTemplate.queryForList(sql, params.toArray()); } @@ -167,7 +170,7 @@ public class AttendanceService { } else { toDate = LocalDate.parse(toDateStr, INPUT_FORMAT); } - + String fromDateTime = fromDate + " 00:00:00"; String toDateTime = toDate + " 23:59:59"; @@ -193,7 +196,7 @@ public class AttendanceService { + "GROUP BY et.park_name, fd.facialRegistered, fd.facialNotRegistered " + "ORDER BY et.park_name"; - return jdbcTemplate.queryForList(sql, new Object[] { zone, fromDateTime, toDateTime, fromDateTime, toDateTime, fromDateTime, toDateTime, zone }); + return jdbcTemplate.queryForList(sql, new Object[] { zone, fromDateTime, toDateTime, fromDateTime, toDateTime, + fromDateTime, toDateTime, zone }); } } - diff --git a/src/main/resources/templates/modules/attendance-dashboard.html b/src/main/resources/templates/modules/attendance-dashboard.html index f410ef9..f370217 100644 --- a/src/main/resources/templates/modules/attendance-dashboard.html +++ b/src/main/resources/templates/modules/attendance-dashboard.html @@ -25,7 +25,7 @@ .zone-summary-row { display: grid; - grid-template-columns: 1fr 1fr; + grid-template-columns: 1fr; gap: 20px; } @@ -87,6 +87,7 @@
+ @@ -257,11 +259,11 @@ const fromDate = toApiDdMmYyyy(rawFrom); const toDate = toApiDdMmYyyy(rawTo); const parkTarget = document.getElementById('zoneSummaryPark'); - const nulmTarget = document.getElementById('zoneSummaryNulm'); + // const nulmTarget = document.getElementById('zoneSummaryNulm'); // NULM commented out // Show loaders parkTarget.innerHTML = createLoader(); - nulmTarget.innerHTML = createLoader(); + // nulmTarget.innerHTML = createLoader(); // NULM commented out try { // Load Park independently @@ -283,27 +285,27 @@ parkTarget.innerHTML = `
Error: ${e.message}
`; }); - // Load NULM independently - fetch(`${apiBase}/zoneSummaryNULM?fromDate=${encodeURIComponent(fromDate)}&toDate=${encodeURIComponent(toDate)}`) - .then(res => { - if (!res.ok) { - console.error('NULM zoneSummary error', res.status); - nulmTarget.innerHTML = `
Error loading NULM summary (${res.status})
`; - return Promise.reject(new Error('NULM fetch failed')); - } - return res.json(); - }) - .then(nulmData => { - console.log('NULM data loaded:', nulmData); - renderTable(nulmTarget, nulmData, 'NULM'); - }) - .catch(e => { - console.error('NULM error:', e); - nulmTarget.innerHTML = `
Error: ${e.message}
`; - }); + // NULM loading commented out + // fetch(`${apiBase}/zoneSummaryNULM?fromDate=${encodeURIComponent(fromDate)}&toDate=${encodeURIComponent(toDate)}`) + // .then(res => { + // if (!res.ok) { + // console.error('NULM zoneSummary error', res.status); + // nulmTarget.innerHTML = `
Error loading NULM summary (${res.status})
`; + // return Promise.reject(new Error('NULM fetch failed')); + // } + // return res.json(); + // }) + // .then(nulmData => { + // console.log('NULM data loaded:', nulmData); + // renderTable(nulmTarget, nulmData, 'NULM'); + // }) + // .catch(e => { + // console.error('NULM error:', e); + // nulmTarget.innerHTML = `
Error: ${e.message}
`; + // }); } catch (e) { parkTarget.innerHTML = `
Error: ${e}
`; - nulmTarget.innerHTML = `
Error: ${e}
`; + // nulmTarget.innerHTML = `
Error: ${e}
`; // NULM commented out } } @@ -565,9 +567,11 @@ // For Park: show park-wise summary; For NULM: show employee details directly if (empType === 'Park') { loadParkWiseSummary(zone, category); - } else { - loadDetailed(empType, category, zone); } + // NULM branch commented out + // else { + // loadDetailed(empType, category, zone); + // } return; }