diff --git a/backend/pensioner/service/DashboardApiService.java b/backend/pensioner/service/DashboardApiService.java index ffd9c1c..aa56c1e 100644 --- a/backend/pensioner/service/DashboardApiService.java +++ b/backend/pensioner/service/DashboardApiService.java @@ -4,7 +4,10 @@ import java.util.Collections; import java.util.List; import java.util.Map; +import javax.sql.DataSource; + import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.stereotype.Service; @@ -14,13 +17,17 @@ public class DashboardApiService { @Autowired private JdbcTemplate jdbcTemplate; + @Autowired + public void setDataSource(@Qualifier("mysqlPensionerDataSource") DataSource dataSource) { + this.jdbcTemplate = new JdbcTemplate(dataSource); + } public List> getTempEmpDetails(String tempId) { System.out.println("service"); System.out.println(tempId); - String sql = "SELECT MH.file_moved_date,sm.file_status,MH.remarks FROM gcc_pensioner.file_movement_history MH" - + " inner join gcc_pensioner.file_status_master sm on MH.file_status= sm.id where temp_id=? order by MH.file_moved_date desc "; + String sql = "SELECT MH.file_moved_date,sm.file_status,MH.remarks FROM file_movement_history MH" + + " inner join file_status_master sm on MH.file_status= sm.id where temp_id=? order by MH.file_moved_date desc "; return jdbcTemplate.queryForList(sql, tempId); } @@ -32,19 +39,19 @@ public class DashboardApiService { System.out.println(empNo); String sql = "SELECT dm.dept_name,fm.file_name, sm.file_status ,pd.temp_id " + - "FROM gcc_pensioner.pensioner_details pd " + - "INNER JOIN gcc_pensioner.file_category_master fm ON pd.file_category = fm.id " + - "INNER JOIN gcc_pensioner.file_status_master sm ON sm.id = pd.file_status " + - "inner join gcc_pensioner.department_master dm on dm.id=pd.dept_id "+ + "FROM pensioner_details pd " + + "INNER JOIN file_category_master fm ON pd.file_category = fm.id " + + "INNER JOIN file_status_master sm ON sm.id = pd.file_status " + + "inner join department_master dm on dm.id=pd.dept_id "+ "WHERE pd.emp_no = ? " + "UNION " + "SELECT dm.dept_name,fm.file_name, sm.file_status ,cps.temp_id " + - "FROM gcc_pensioner.cps_pensioner_details cps " + - "INNER JOIN gcc_pensioner.file_category_master fm ON cps.file_category = fm.id " + - "INNER JOIN gcc_pensioner.file_status_master sm ON sm.id = cps.file_status " + - "inner join gcc_pensioner.department_master dm on dm.id=cps.dept_id "+ + "FROM cps_pensioner_details cps " + + "INNER JOIN file_category_master fm ON cps.file_category = fm.id " + + "INNER JOIN file_status_master sm ON sm.id = cps.file_status " + + "inner join department_master dm on dm.id=cps.dept_id "+ "WHERE cps.emp_no = ?"; @@ -56,17 +63,17 @@ public class DashboardApiService { System.out.println(empNo); String sql = "SELECT dm.dept_name,fm.file_name, sm.file_status ,pd.temp_id " + - "FROM gcc_pensioner.pensioner_details pd " + - "INNER JOIN gcc_pensioner.file_category_master fm ON pd.file_category = fm.id " + - "INNER JOIN gcc_pensioner.file_status_master sm ON sm.id = pd.file_status " + - "inner join gcc_pensioner.department_master dm on dm.id=pd.dept_id "+ + "FROM pensioner_details pd " + + "INNER JOIN file_category_master fm ON pd.file_category = fm.id " + + "INNER JOIN file_status_master sm ON sm.id = pd.file_status " + + "inner join department_master dm on dm.id=pd.dept_id "+ "WHERE pd.emp_no = ? " + "UNION " + "SELECT dm.dept_name,fm.file_name, sm.file_status ,cps.temp_id " + - "FROM gcc_pensioner.cps_pensioner_details cps " + - "INNER JOIN gcc_pensioner.file_category_master fm ON cps.file_category = fm.id " + - "INNER JOIN gcc_pensioner.file_status_master sm ON sm.id = cps.file_status " + - "inner join gcc_pensioner.department_master dm on dm.id=cps.dept_id "+ + "FROM cps_pensioner_details cps " + + "INNER JOIN file_category_master fm ON cps.file_category = fm.id " + + "INNER JOIN file_status_master sm ON sm.id = cps.file_status " + + "inner join department_master dm on dm.id=cps.dept_id "+ "WHERE cps.emp_no = ?"; return jdbcTemplate.queryForList(sql, empNo, empNo); @@ -129,16 +136,16 @@ public class DashboardApiService { case "4": case "5": query = "SELECT pd.emp_no " + - "FROM gcc_pensioner.pensioner_details pd " + - "INNER JOIN gcc_pensioner.file_category_master cm " + + "FROM pensioner_details pd " + + "INNER JOIN file_category_master cm " + "ON pd.file_category = cm.id " + "WHERE cm.id = ?"; break; case "6": query = "SELECT cps.emp_no " + - "FROM gcc_pensioner.cps_pensioner_details cps " + - "INNER JOIN gcc_pensioner.file_category_master cm " + + "FROM cps_pensioner_details cps " + + "INNER JOIN file_category_master cm " + "ON cps.file_category = cm.id " + "WHERE cm.id = ?"; break; @@ -155,8 +162,8 @@ public class DashboardApiService { String sql = "SELECT file_name, id, COALESCE(SUM(category_count), 0) AS category_count " + "FROM ( " + " SELECT cm.file_name, cm.id,COUNT(pd.file_category) AS category_count " + - " FROM gcc_pensioner.file_category_master cm " + - " LEFT JOIN gcc_pensioner.pensioner_details pd " + + " FROM file_category_master cm " + + " LEFT JOIN pensioner_details pd " + " ON pd.file_category = cm.id " + " AND pd.is_closed='0' " + @@ -164,8 +171,8 @@ public class DashboardApiService { " GROUP BY cm.file_name,cm.id" + " UNION ALL " + " SELECT cm.file_name, cm.id,COUNT(cps.file_category) AS category_count " + - " FROM gcc_pensioner.file_category_master cm " + - " LEFT JOIN gcc_pensioner.cps_pensioner_details cps " + + " FROM file_category_master cm " + + " LEFT JOIN cps_pensioner_details cps " + " ON cps.file_category = cm.id " + @@ -217,7 +224,7 @@ public class DashboardApiService { }//department*/ public List> getDepartment() { - String sql = "SELECT dept_id,dept_name FROM gcc_pensioner.department_master;"; + String sql = "SELECT dept_id,dept_name FROM department_master WHERE dept_id <> 2000"; return jdbcTemplate.queryForList(sql); } @@ -225,17 +232,17 @@ public class DashboardApiService { public List> DepartmenfetchCategoryCounts(String deptId) { String sql = "SELECT cm.file_name, cm.id, " + " COALESCE(pd.category_count, 0) + COALESCE(cps.category_count, 0) AS category_count " + - "FROM gcc_pensioner.file_category_master cm " + + "FROM file_category_master cm " + "LEFT JOIN ( " + " SELECT file_category, COUNT(*) AS category_count " + - " FROM gcc_pensioner.pensioner_details " + + " FROM pensioner_details " + " WHERE (? IS NULL OR dept_id = ?) " + " AND is_closed='0' " + " GROUP BY file_category " + ") pd ON cm.id = pd.file_category " + "LEFT JOIN ( " + " SELECT file_category, COUNT(*) AS category_count " + - " FROM gcc_pensioner.cps_pensioner_details " + + " FROM cps_pensioner_details " + " WHERE (? IS NULL OR dept_id = ?) " + " GROUP BY file_category " + ") cps ON cm.id = cps.file_category"; @@ -246,10 +253,10 @@ public class DashboardApiService { } public List> fetchchartCategoryCounts(String deptId, String startDate, String endDate) { String sql = "SELECT cm.file_name, cm.id, " + " COALESCE(pd.category_count, 0) + COALESCE(cps.category_count, 0) AS category_count " + - "FROM gcc_pensioner.file_category_master cm " + + "FROM file_category_master cm " + "LEFT JOIN ( " + " SELECT file_category, COUNT(*) AS category_count " + - " FROM gcc_pensioner.pensioner_details " + + " FROM pensioner_details " + " WHERE (? IS NULL OR dept_id = ?) " + " AND (? IS NULL OR date(created_date) >= ?) " + " AND (? IS NULL OR date(created_date) <= ?) " + diff --git a/backend/pensioner/service/ReportApiService.java b/backend/pensioner/service/ReportApiService.java index ce133e4..2d3ff0c 100644 --- a/backend/pensioner/service/ReportApiService.java +++ b/backend/pensioner/service/ReportApiService.java @@ -39,7 +39,7 @@ public class ReportApiService { } public List> getFileCategories() { - String sql = "SELECT id,file_name FROM gcc_pensioner.file_category_master"; + String sql = "SELECT id,file_name FROM file_category_master"; return jdbcTemplate.queryForList(sql); } @@ -62,51 +62,51 @@ public class ReportApiService { " fm.file_name AS file_name, " + // Audit Pending Count - " (SELECT COUNT(*) FROM gcc_pensioner.pensioner_details pd " + + " (SELECT COUNT(*) FROM pensioner_details pd " + " WHERE pd.file_status IN (1,3) AND pd.dept_id = ? " + " AND pd.file_category=fm.id "+ " AND pd.is_closed = 0 " + " AND DATE(pd.created_date) BETWEEN DATE(?) AND DATE(?)) AS audit_pending, " + // Department Pending Count - " (SELECT COUNT(*) FROM gcc_pensioner.pensioner_details pd " + + " (SELECT COUNT(*) FROM pensioner_details pd " + " WHERE pd.file_status IN (2,5,6,9) AND pd.dept_id = ? " + " AND pd.file_category=fm.id "+ " AND pd.is_closed = 0 " + " AND DATE(pd.created_date) BETWEEN DATE(?) AND DATE(?)) AS department_pending, " + // Pension Pending Count - " (SELECT COUNT(*) FROM gcc_pensioner.pensioner_details pd " + + " (SELECT COUNT(*) FROM pensioner_details pd " + " WHERE pd.file_status IN (4,7,8,10) AND pd.dept_id = ? " + " AND pd.file_category=fm.id "+ " AND pd.is_closed = 0 " + " AND DATE(pd.created_date) BETWEEN DATE(?) AND DATE(?)) AS pension_pending, " + // Completed Count (SUM of two tables) - " (COALESCE((SELECT COUNT(*) FROM gcc_pensioner.pensioner_details pd " + + " (COALESCE((SELECT COUNT(*) FROM pensioner_details pd " + " WHERE pd.file_status = 11 AND pd.dept_id = ? " + " AND pd.file_category=fm.id "+ " AND pd.is_closed = 0 " + " AND DATE(pd.created_date) BETWEEN DATE(?) AND DATE(?)), 0) " + " + " + - " COALESCE((SELECT COUNT(*) FROM gcc_pensioner.cps_pensioner_details cps " + + " COALESCE((SELECT COUNT(*) FROM cps_pensioner_details cps " + " WHERE cps.file_status = 11 AND cps.dept_id = ? " + " AND cps.file_category=fm.id "+ " AND DATE(cps.created_date) BETWEEN DATE(?) AND DATE(?)), 0)) AS completed, " + // Total Files Count (SUM of two tables) - " (COALESCE((SELECT COUNT(*) FROM gcc_pensioner.pensioner_details pd " + + " (COALESCE((SELECT COUNT(*) FROM pensioner_details pd " + " WHERE pd.dept_id = ? " + " AND pd.file_category=fm.id "+ " AND pd.is_closed = 0 " + " AND DATE(pd.created_date) BETWEEN DATE(?) AND DATE(?)), 0) " + " + " + - " COALESCE((SELECT COUNT(*) FROM gcc_pensioner.cps_pensioner_details cps " + + " COALESCE((SELECT COUNT(*) FROM cps_pensioner_details cps " + " WHERE cps.dept_id = ? " + " AND cps.file_category=fm.id "+ " AND DATE(cps.created_date) BETWEEN DATE(?) AND DATE(?)), 0)) AS total_files " + - "FROM gcc_pensioner.file_category_master fm " + + "FROM file_category_master fm " + "GROUP BY fm.id, fm.file_name " + // Correct placement of GROUP BY "ORDER BY fm.id"; // ORDER BY after GROUP BY @@ -181,12 +181,12 @@ public class ReportApiService { //pensioner side reorts methods public List> getstatus() { - String sql = "select id , file_status from gcc_pensioner.file_status_master"; + String sql = "select id , file_status from file_status_master"; return jdbcTemplate.queryForList(sql); } public List> getdepartment() { - String sql = "select id ,dept_name from gcc_pensioner.department_master"; + String sql = "select dept_id ,dept_name from department_master WHERE dept_id <> 2000"; return jdbcTemplate.queryForList(sql); } @@ -232,51 +232,51 @@ public class ReportApiService { " dm.dept_name AS dept_name, " + // Audit Pending Count - " (SELECT COUNT(*) FROM gcc_pensioner.pensioner_details pd " + + " (SELECT COUNT(*) FROM pensioner_details pd " + " WHERE pd.file_status IN (1,3) AND pd.dept_id = dm.dept_id " + " AND pd.is_closed = 0 " + // Added condition " AND ( ? IS NULL OR pd.file_category = ? ) " + " AND DATE(pd.created_date) BETWEEN DATE(?) AND DATE(?)) AS audit_pending, " + // Department Pending Count - " (SELECT COUNT(*) FROM gcc_pensioner.pensioner_details pd " + + " (SELECT COUNT(*) FROM pensioner_details pd " + " WHERE pd.file_status IN (2,5,6,9) AND pd.dept_id = dm.dept_id " + " AND pd.is_closed = 0 " + // Added condition " AND ( ? IS NULL OR pd.file_category = ? ) " + " AND DATE(pd.created_date) BETWEEN DATE(?) AND DATE(?)) AS department_pending, " + // Pension Pending Count - " (SELECT COUNT(*) FROM gcc_pensioner.pensioner_details pd " + + " (SELECT COUNT(*) FROM pensioner_details pd " + " WHERE pd.file_status IN (4,7,8,10) AND pd.dept_id = dm.dept_id " + " AND pd.is_closed = 0 " + // Added condition " AND ( ? IS NULL OR pd.file_category = ? ) " + " AND DATE(pd.created_date) BETWEEN DATE(?) AND DATE(?)) AS pension_pending, " + // Completed Count - " (SELECT COUNT(*) FROM gcc_pensioner.pensioner_details pd " + + " (SELECT COUNT(*) FROM pensioner_details pd " + " WHERE pd.file_status = 11 AND pd.dept_id = dm.dept_id " + " AND pd.is_closed = 0 " + // Added condition " AND ( ? IS NULL OR pd.file_category = ? ) " + " AND DATE(pd.created_date) BETWEEN DATE(?) AND DATE(?)) " + " + " + - " (SELECT COUNT(*) FROM gcc_pensioner.cps_pensioner_details cps " + + " (SELECT COUNT(*) FROM cps_pensioner_details cps " + " WHERE cps.file_status = 11 AND cps.dept_id = dm.dept_id " + " AND ( ? IS NULL OR cps.file_category = ? ) " + " AND DATE(cps.created_date) BETWEEN DATE(?) AND DATE(?)) AS completed, " + // Total Files Count - " (SELECT COUNT(*) FROM gcc_pensioner.pensioner_details pd " + + " (SELECT COUNT(*) pensioner_details pd " + " WHERE pd.dept_id = dm.dept_id " + " AND pd.is_closed = 0 " + // Added condition " AND ( ? IS NULL OR pd.file_category = ? ) " + " AND DATE(pd.created_date) BETWEEN DATE(?) AND DATE(?)) " + " + " + - " (SELECT COUNT(*) FROM gcc_pensioner.cps_pensioner_details cps " + + " (SELECT COUNT(*) FROM cps_pensioner_details cps " + " WHERE cps.dept_id = dm.dept_id " + " AND ( ? IS NULL OR cps.file_category = ? ) " + " AND DATE(cps.created_date) BETWEEN DATE(?) AND DATE(?)) AS total_files " + - "FROM gcc_pensioner.department_master dm " + + "FROM department_master dm " + "ORDER BY dm.dept_id"; System.out.println("Executing SQL: " + sql); diff --git a/frontend/pensioner/department/completed/familypension.html b/frontend/pensioner/department/completed/familypension.html index 03f3c5d..b8b94e6 100644 --- a/frontend/pensioner/department/completed/familypension.html +++ b/frontend/pensioner/department/completed/familypension.html @@ -73,8 +73,8 @@ color: #007bff; } /* Make the modal body scrollable */ - #detailsModal .modal-body { - max-height: 70vh; /* Limit the height to 70% of the viewport */ + #returnretrieddetailsModal .modal-body { + max-height: 80vh; /* Limit the height to 70% of the viewport */ overflow-y: auto; /* Enable vertical scrolling */ } diff --git a/frontend/pensioner/department/completed/pendency.html b/frontend/pensioner/department/completed/pendency.html index ce62294..83d2c5c 100644 --- a/frontend/pensioner/department/completed/pendency.html +++ b/frontend/pensioner/department/completed/pendency.html @@ -73,8 +73,8 @@ color: #007bff; } /* Make the modal body scrollable */ - #detailsModal .modal-body { - max-height: 70vh; /* Limit the height to 70% of the viewport */ + #returnretrieddetailsModal .modal-body { + max-height: 80vh; /* Limit the height to 70% of the viewport */ overflow-y: auto; /* Enable vertical scrolling */ } diff --git a/frontend/pensioner/department/completed/retirement.html b/frontend/pensioner/department/completed/retirement.html index ae40e10..f57eedd 100644 --- a/frontend/pensioner/department/completed/retirement.html +++ b/frontend/pensioner/department/completed/retirement.html @@ -73,8 +73,8 @@ color: #007bff; } /* Make the modal body scrollable */ - #detailsModal .modal-body { - max-height: 70vh; /* Limit the height to 70% of the viewport */ + #returnretrieddetailsModal .modal-body { + max-height: 80vh; /* Limit the height to 70% of the viewport */ overflow-y: auto; /* Enable vertical scrolling */ } @@ -93,10 +93,6 @@ cursor: pointer; /* Change cursor to hand symbol */ } -#receivedprovisionalModal .modal-body{ - max-height:80vh; - overflow-y:auto; -} .file-history-list { margin-top: 10px; diff --git a/frontend/pensioner/department/reports.html b/frontend/pensioner/department/reports.html index cc4098c..5ede251 100644 --- a/frontend/pensioner/department/reports.html +++ b/frontend/pensioner/department/reports.html @@ -629,7 +629,7 @@ td, th { { title: "Name", data: "emp_name", className: "text-center" }, { title: "Designation", data: "designation", className: "text-center" }, { title: "Type of Retirement", data: "type_of_retirement", className: "text-center" }, - { title: "Date of Retire", data: "retirement_date", className: "text-center" }, + { title: "Date of Retirement", data: "retirement_date", className: "text-center" }, { title: "File Status", data: "fst", className: "text-center" }, { title: "File Category", data: "file_category_name", className: "text-center" }, { title: "File Moved Date", data: "file_moved_date", className: "text-center" }, @@ -712,7 +712,7 @@ td, th { { title: "Name", data: "emp_name", className: "text-center" }, { title: "Designation", data: "designation", className: "text-center" }, { title: "Type of Retirement", data: "type_of_retirement", className: "text-center" }, - { title: "Date of Retire", data: "retirement_date", className: "text-center" }, + { title: "Date of Retirement", data: "retirement_date", className: "text-center" }, { title: "Pending Duration", data: "reason_for_pending", className: "text-center" }, { title: "File Status", data: "fst", className: "text-center" }, { title: "File Category", data: "file_category_name", className: "text-center" }, @@ -795,7 +795,7 @@ td, th { { title: "Name", data: "emp_name", className: "text-center" }, { title: "Designation", data: "designation", className: "text-center" }, { title: "Type of Retirement", data: "type_of_retirement", className: "text-center" }, - { title: "Date of Retire", data: "retirement_date", className: "text-center" }, + { title: "Date of Retirement", data: "retirement_date", className: "text-center" }, { title: "File Category", data: "file_category_name", className: "text-center" }, { title: "File Status", data: "fst", className: "text-center" }, { title: "File Moved Date", data: "file_moved_date", className: "text-center" }, @@ -848,29 +848,7 @@ td, th { }); - $('#startdate').on('change', function () { - const fromDate = $(this).val(); - $('#enddate').attr('min', fromDate); // Update min attribute for To Date - - // If To Date is earlier than the new From Date, adjust it - const toDate = $('#enddate').val(); - if (new Date(toDate) < new Date(fromDate)) { - $('#enddate').val(fromDate); - } - }); - // Update From Date's max attribute when To Date changes - $('#enddate').on('change', function () { - const toDate = $(this).val(); - $('#startdate').attr('max', toDate); // Update max attribute for From Date - - // If From Date is later than the new To Date, adjust it - const fromDate = $('#startdate').val(); - if (new Date(fromDate) > new Date(toDate)) { - $('#startdate').val(toDate); - } - }); - /* $('#statusDropdown').on('change', function () { let selectedValue = $(this).val(); let statusArray = selectedValue ? JSON.parse(selectedValue) : []; // Convert string to array @@ -1144,6 +1122,32 @@ td, th { }); + + $('#startdate').on('change', function () { + const fromDate = $(this).val(); + $('#enddate').attr('min', fromDate); // Update min attribute for To Date + + // If To Date is earlier than the new From Date, adjust it + const toDate = $('#enddate').val(); + if (new Date(toDate) < new Date(fromDate)) { + $('#enddate').val(fromDate); + } + }); + + // Update From Date's max attribute when To Date changes + $('#enddate').on('change', function () { + const toDate = $(this).val(); + $('#startdate').attr('max', toDate); // Update max attribute for From Date + + // If From Date is later than the new To Date, adjust it + const fromDate = $('#startdate').val(); + if (new Date(fromDate) > new Date(toDate)) { + $('#startdate').val(toDate); + } + }); + + + //disable future dates document.addEventListener("DOMContentLoaded", function () { let today = new Date().toISOString().split("T")[0]; // Get today's date in YYYY-MM-DD format diff --git a/frontend/pensioner/pensioner/completed/familypension.html b/frontend/pensioner/pensioner/completed/familypension.html index bd54080..1b14588 100644 --- a/frontend/pensioner/pensioner/completed/familypension.html +++ b/frontend/pensioner/pensioner/completed/familypension.html @@ -73,8 +73,8 @@ color: #007bff; } /* Make the modal body scrollable */ - #detailsModal .modal-body { - max-height: 70vh; /* Limit the height to 70% of the viewport */ + #returnretrieddetailsModal .modal-body { + max-height: 80vh; /* Limit the height to 70% of the viewport */ overflow-y: auto; /* Enable vertical scrolling */ } diff --git a/frontend/pensioner/pensioner/completed/pendency.html b/frontend/pensioner/pensioner/completed/pendency.html index afdab63..de57d9f 100644 --- a/frontend/pensioner/pensioner/completed/pendency.html +++ b/frontend/pensioner/pensioner/completed/pendency.html @@ -73,8 +73,8 @@ color: #007bff; } /* Make the modal body scrollable */ - #detailsModal .modal-body { - max-height: 70vh; /* Limit the height to 70% of the viewport */ + #returnretrieddetailsModal .modal-body { + max-height: 80vh; /* Limit the height to 70% of the viewport */ overflow-y: auto; /* Enable vertical scrolling */ } diff --git a/frontend/pensioner/pensioner/completed/retirement.html b/frontend/pensioner/pensioner/completed/retirement.html index 5e3b8cc..4361ca2 100644 --- a/frontend/pensioner/pensioner/completed/retirement.html +++ b/frontend/pensioner/pensioner/completed/retirement.html @@ -73,8 +73,8 @@ color: #007bff; } /* Make the modal body scrollable */ - #detailsModal .modal-body { - max-height: 70vh; /* Limit the height to 70% of the viewport */ + #returnretrieddetailsModal .modal-body { + max-height: 80vh; /* Limit the height to 70% of the viewport */ overflow-y: auto; /* Enable vertical scrolling */ }