diff --git a/gcc_officer_portal/src/main/java/in/gov/chennaicorporation/gccoffice/childrensurvey/Service/ChildrenSurveyService.java b/gcc_officer_portal/src/main/java/in/gov/chennaicorporation/gccoffice/childrensurvey/Service/ChildrenSurveyService.java index 2c170623..14a2fea5 100644 --- a/gcc_officer_portal/src/main/java/in/gov/chennaicorporation/gccoffice/childrensurvey/Service/ChildrenSurveyService.java +++ b/gcc_officer_portal/src/main/java/in/gov/chennaicorporation/gccoffice/childrensurvey/Service/ChildrenSurveyService.java @@ -242,6 +242,7 @@ public class ChildrenSurveyService { : ""; String finalAnswer = resolveAnswer( + qid, questionType, masterTable, rawAnswer); @@ -319,8 +320,8 @@ public class ChildrenSurveyService { } } - finalResponse.put("personalInformation", personalInfo); finalResponse.put("locationDetails", locationInfo); + finalResponse.put("personalInformation", personalInfo); finalResponse.put("educationDetails", educationInfo); finalResponse.put("healthDetails", healthInfo); finalResponse.put("documentDetails", documentInfo); @@ -330,6 +331,183 @@ public class ChildrenSurveyService { } private String resolveAnswer( + Integer qid, + String questionType, + String masterTable, + String rawAnswer) { + + try { + + if (rawAnswer == null || rawAnswer.trim().isEmpty()) { + return ""; + } + + // TEXT TYPES + if ("text".equalsIgnoreCase(questionType) + || "textarea".equalsIgnoreCase(questionType) + || "number".equalsIgnoreCase(questionType) + || "number_text".equalsIgnoreCase(questionType) + || "number_mobile".equalsIgnoreCase(questionType) + || "number_aadhar".equalsIgnoreCase(questionType) + || "date".equalsIgnoreCase(questionType)) { + + return rawAnswer; + } + + boolean isNumeric = rawAnswer.matches("\\d+(,\\d+)*"); + + // RADIO + if ("radio".equalsIgnoreCase(questionType)) { + + if (!isNumeric) { + return rawAnswer; + } + + String sql = """ + SELECT english_name + FROM child_survey_answer_master + WHERE aid = ? + """; + + return jdbcTemplate.queryForObject( + sql, + String.class, + Integer.parseInt(rawAnswer)); + } + + // MULTICHECK + // ================= MULTICHECK ================= + if ("multicheck".equalsIgnoreCase(questionType)) { + + if (!isNumeric) { + return rawAnswer; + } + + String[] ids = rawAnswer.split(","); + + List values = new ArrayList<>(); + + // ====================================== + // FIRST CHECK child_survey_answer_master + // ====================================== + + String childSql = """ + SELECT english_name + FROM child_survey_answer_master + WHERE qid = ? + AND aid = ? + LIMIT 1 + """; + + // ====================================== + // MASTER TABLE SQL + // ====================================== + + String dynamicSql = null; + + if (masterTable != null && !masterTable.trim().isEmpty()) { + + dynamicSql = "SELECT english_name FROM " + + masterTable + + " WHERE id = ?"; + } + + for (String id : ids) { + + Integer answerId = Integer.parseInt(id.trim()); + + // CHECK child answer first + List> childResult = jdbcTemplate.queryForList( + childSql, + qid, + answerId); + + if (!childResult.isEmpty()) { + + values.add( + childResult.get(0) + .get("english_name") + .toString()); + + } else if (dynamicSql != null) { + + // CHECK MASTER TABLE + List> masterResult = jdbcTemplate.queryForList( + dynamicSql, + answerId); + + if (!masterResult.isEmpty()) { + + values.add( + masterResult.get(0) + .get("english_name") + .toString()); + } + } + } + + return String.join(", ", values); + } + // DROPDOWN + if ("dropdown".equalsIgnoreCase(questionType)) { + + if (!isNumeric) { + return rawAnswer; + } + + Integer answerId = Integer.parseInt(rawAnswer); + + // FIRST CHECK child_survey_answer_master + String childSql = """ + SELECT english_name + FROM child_survey_answer_master + WHERE qid = ? + AND aid = ? + LIMIT 1 + """; + + List> childResult = jdbcTemplate.queryForList( + childSql, + qid, + answerId); + + if (!childResult.isEmpty()) { + + return childResult.get(0) + .get("english_name") + .toString(); + } + + // MASTER TABLE CHECK + if (masterTable != null + && !masterTable.trim().isEmpty()) { + + String dynamicSql = "SELECT english_name FROM " + + masterTable + + " WHERE id = ?"; + + List> masterResult = jdbcTemplate.queryForList( + dynamicSql, + answerId); + + if (!masterResult.isEmpty()) { + + return masterResult.get(0) + .get("english_name") + .toString(); + } + } + } + + } catch (Exception e) { + + e.printStackTrace(); + } + + return rawAnswer; + } + + private String resolveAnswer1( String questionType, String masterTable, String rawAnswer) { @@ -1237,6 +1415,8 @@ public class ChildrenSurveyService { isactive, isdelete FROM education_master + WHERE isactive = 1 + AND isdelete = 0 ORDER BY orderby """; @@ -1244,6 +1424,64 @@ public class ChildrenSurveyService { } public void saveEducation(Map req) { + Integer id = req.get("id") != null + ? Integer.parseInt(req.get("id").toString()) + : 0; + + // UPDATE + if (id > 0) { + + String updateSql = """ + UPDATE education_master + SET english_name = ? + WHERE id = ? + """; + + jdbcTemplate.update( + updateSql, + req.get("english_name"), + id); + + } + + // INSERT + else { + + Integer nextOrder = jdbcTemplate.queryForObject( + """ + SELECT IFNULL(MAX(orderby),0) + 1 + FROM education_master + """, + Integer.class); + + String insertSql = """ + INSERT INTO education_master + ( + english_name, + orderby, + cdate, + isactive, + isdelete + ) + VALUES + ( + ?, + ?, + NOW(), + 1, + 0 + ) + """; + + jdbcTemplate.update( + insertSql, + req.get("english_name"), + nextOrder); + } + + } + + public void saveEducation1(Map req) { Integer nextOrder = jdbcTemplate.queryForObject( """ @@ -1310,6 +1548,8 @@ public class ChildrenSurveyService { isactive, isdelete FROM location_master + WHERE isactive = 1 + AND isdelete = 0 ORDER BY orderby """; @@ -1318,6 +1558,63 @@ public class ChildrenSurveyService { public void saveLocation(Map req) { + Integer id = req.get("id") != null + ? Integer.parseInt(req.get("id").toString()) + : 0; + + // UPDATE + if (id > 0) { + + String updateSql = """ + UPDATE location_master + SET english_name = ? + WHERE id = ? + """; + + jdbcTemplate.update( + updateSql, + req.get("english_name"), + id); + } + + // INSERT + else { + + Integer nextOrder = jdbcTemplate.queryForObject( + """ + SELECT IFNULL(MAX(orderby),0) + 1 + FROM location_master + """, + Integer.class); + + String insertSql = """ + INSERT INTO location_master + ( + english_name, + orderby, + cdate, + isactive, + isdelete + ) + VALUES + ( + ?, + ?, + NOW(), + 1, + 0 + ) + """; + + jdbcTemplate.update( + insertSql, + req.get("english_name"), + nextOrder); + } + } + + public void saveLocation1(Map req) { + Integer nextOrder = jdbcTemplate.queryForObject( """ SELECT IFNULL(MAX(orderby),0) + 1 @@ -1383,6 +1680,8 @@ public class ChildrenSurveyService { isactive, isdelete FROM gender_master + WHERE isactive = 1 + AND isdelete = 0 ORDER BY orderby """; @@ -1391,14 +1690,37 @@ public class ChildrenSurveyService { public void saveGender(Map req) { - Integer nextOrder = jdbcTemplate.queryForObject( - """ + Integer id = req.get("id") != null + ? Integer.parseInt(req.get("id").toString()) + : 0; + + // UPDATE + if (id > 0) { + + String updateSql = """ + UPDATE gender_master + SET english_name = ? + WHERE id = ? + """; + + jdbcTemplate.update( + updateSql, + req.get("english_name"), + id); + + } + + // INSERT + else { + + Integer nextOrder = jdbcTemplate.queryForObject( + """ SELECT IFNULL(MAX(orderby),0) + 1 FROM gender_master - """, - Integer.class); + """, + Integer.class); - String sql = """ + String insertSql = """ INSERT INTO gender_master ( english_name, @@ -1415,14 +1737,51 @@ public class ChildrenSurveyService { 1, 0 ) - """; + """; - jdbcTemplate.update( - sql, - req.get("english_name"), - nextOrder); + jdbcTemplate.update( + insertSql, + req.get("english_name"), + nextOrder); + } } + /* + * public void saveGender(Map req) { + * + * Integer nextOrder = jdbcTemplate.queryForObject( + * """ + * SELECT IFNULL(MAX(orderby),0) + 1 + * FROM gender_master + * """, + * Integer.class); + * + * String sql = """ + * INSERT INTO gender_master + * ( + * english_name, + * orderby, + * cdate, + * isactive, + * isdelete + * ) + * VALUES + * ( + * ?, + * ?, + * NOW(), + * 1, + * 0 + * ) + * """; + * + * jdbcTemplate.update( + * sql, + * req.get("english_name"), + * nextOrder); + * } + */ + public void updateGenderStatus( Map req) { @@ -1456,6 +1815,8 @@ public class ChildrenSurveyService { isactive, isdelete FROM caste_master + WHERE isactive = 1 + AND isdelete = 0 ORDER BY orderby """; @@ -1464,6 +1825,63 @@ public class ChildrenSurveyService { public void saveCaste(Map req) { + Integer id = req.get("id") != null + ? Integer.parseInt(req.get("id").toString()) + : 0; + + // UPDATE + if (id > 0) { + + String updateSql = """ + UPDATE caste_master + SET english_name = ? + WHERE id = ? + """; + + jdbcTemplate.update( + updateSql, + req.get("english_name"), + id); + } + + // INSERT + else { + + Integer nextOrder = jdbcTemplate.queryForObject( + """ + SELECT IFNULL(MAX(orderby),0) + 1 + FROM caste_master + """, + Integer.class); + + String insertSql = """ + INSERT INTO caste_master + ( + english_name, + orderby, + cdate, + isactive, + isdelete + ) + VALUES + ( + ?, + ?, + NOW(), + 1, + 0 + ) + """; + + jdbcTemplate.update( + insertSql, + req.get("english_name"), + nextOrder); + } + } + + public void saveCaste1(Map req) { + Integer nextOrder = jdbcTemplate.queryForObject( """ SELECT IFNULL(MAX(orderby),0) + 1 @@ -1523,28 +1941,52 @@ public class ChildrenSurveyService { public List> getLivingList() { String sql = """ - SELECT - id, - english_name, - isactive, - isdelete - FROM child_living_master - ORDER BY orderby - """; + SELECT + id, + english_name, + isactive, + isdelete + FROM child_living_master + WHERE isactive = 1 + AND isdelete = 0 + ORDER BY orderby + """; return jdbcTemplate.queryForList(sql); } public void saveLiving(Map req) { - Integer nextOrder = jdbcTemplate.queryForObject( - """ + Integer id = req.get("id") != null + ? Integer.parseInt(req.get("id").toString()) + : 0; + + // UPDATE + if (id > 0) { + + String updateSql = """ + UPDATE child_living_master + SET english_name = ? + WHERE id = ? + """; + + jdbcTemplate.update( + updateSql, + req.get("english_name"), + id); + } + + // INSERT + else { + + Integer nextOrder = jdbcTemplate.queryForObject( + """ SELECT IFNULL(MAX(orderby),0) + 1 FROM child_living_master - """, - Integer.class); + """, + Integer.class); - String sql = """ + String insertSql = """ INSERT INTO child_living_master ( english_name, @@ -1561,22 +2003,57 @@ public class ChildrenSurveyService { 1, 0 ) - """; + """; - jdbcTemplate.update( - sql, - req.get("english_name"), - nextOrder); + jdbcTemplate.update( + insertSql, + req.get("english_name"), + nextOrder); + } } - public void updateLivingStatus( - Map req) { - - Integer id = Integer.parseInt( - req.get("id").toString()); - - Integer status = Integer.parseInt( - req.get("status").toString()); + public void saveLiving1(Map req) { + + Integer nextOrder = jdbcTemplate.queryForObject( + """ + SELECT IFNULL(MAX(orderby),0) + 1 + FROM child_living_master + """, + Integer.class); + + String sql = """ + INSERT INTO child_living_master + ( + english_name, + orderby, + cdate, + isactive, + isdelete + ) + VALUES + ( + ?, + ?, + NOW(), + 1, + 0 + ) + """; + + jdbcTemplate.update( + sql, + req.get("english_name"), + nextOrder); + } + + public void updateLivingStatus( + Map req) { + + Integer id = Integer.parseInt( + req.get("id").toString()); + + Integer status = Integer.parseInt( + req.get("status").toString()); String sql = """ UPDATE child_living_master @@ -1602,6 +2079,8 @@ public class ChildrenSurveyService { isactive, isdelete FROM document_correction_master + WHERE isactive = 1 + AND isdelete = 0 ORDER BY orderby """; @@ -1610,6 +2089,63 @@ public class ChildrenSurveyService { public void saveDocumentCreation(Map req) { + Integer id = req.get("id") != null + ? Integer.parseInt(req.get("id").toString()) + : 0; + + // UPDATE + if (id > 0) { + + String updateSql = """ + UPDATE document_correction_master + SET english_name = ? + WHERE id = ? + """; + + jdbcTemplate.update( + updateSql, + req.get("english_name"), + id); + } + + // INSERT + else { + + Integer nextOrder = jdbcTemplate.queryForObject( + """ + SELECT IFNULL(MAX(orderby),0) + 1 + FROM document_correction_master + """, + Integer.class); + + String insertSql = """ + INSERT INTO document_correction_master + ( + english_name, + orderby, + cdate, + isactive, + isdelete + ) + VALUES + ( + ?, + ?, + NOW(), + 1, + 0 + ) + """; + + jdbcTemplate.update( + insertSql, + req.get("english_name"), + nextOrder); + } + } + + public void saveDocumentCreation1(Map req) { + Integer nextOrder = jdbcTemplate.queryForObject( """ SELECT IFNULL(MAX(orderby),0) + 1 @@ -1675,6 +2211,8 @@ public class ChildrenSurveyService { isactive, isdelete FROM dropout_reason_master + WHERE isactive = 1 + AND isdelete = 0 ORDER BY orderby """; @@ -1683,6 +2221,63 @@ public class ChildrenSurveyService { public void saveDropoutReason(Map req) { + Integer id = req.get("id") != null + ? Integer.parseInt(req.get("id").toString()) + : 0; + + // UPDATE + if (id > 0) { + + String updateSql = """ + UPDATE dropout_reason_master + SET english_name = ? + WHERE id = ? + """; + + jdbcTemplate.update( + updateSql, + req.get("english_name"), + id); + } + + // INSERT + else { + + Integer nextOrder = jdbcTemplate.queryForObject( + """ + SELECT IFNULL(MAX(orderby),0) + 1 + FROM dropout_reason_master + """, + Integer.class); + + String insertSql = """ + INSERT INTO dropout_reason_master + ( + english_name, + orderby, + cdate, + isactive, + isdelete + ) + VALUES + ( + ?, + ?, + NOW(), + 1, + 0 + ) + """; + + jdbcTemplate.update( + insertSql, + req.get("english_name"), + nextOrder); + } + } + + public void saveDropoutReason1(Map req) { + Integer nextOrder = jdbcTemplate.queryForObject( """ SELECT IFNULL(MAX(orderby),0) + 1 @@ -1748,6 +2343,8 @@ public class ChildrenSurveyService { isactive, isdelete FROM income_master + WHERE isactive = 1 + AND isdelete = 0 ORDER BY orderby """; @@ -1756,6 +2353,63 @@ public class ChildrenSurveyService { public void saveIncome(Map req) { + Integer id = req.get("id") != null + ? Integer.parseInt(req.get("id").toString()) + : 0; + + // UPDATE + if (id > 0) { + + String updateSql = """ + UPDATE income_master + SET english_name = ? + WHERE id = ? + """; + + jdbcTemplate.update( + updateSql, + req.get("english_name"), + id); + } + + // INSERT + else { + + Integer nextOrder = jdbcTemplate.queryForObject( + """ + SELECT IFNULL(MAX(orderby),0) + 1 + FROM income_master + """, + Integer.class); + + String insertSql = """ + INSERT INTO income_master + ( + english_name, + orderby, + cdate, + isactive, + isdelete + ) + VALUES + ( + ?, + ?, + NOW(), + 1, + 0 + ) + """; + + jdbcTemplate.update( + insertSql, + req.get("english_name"), + nextOrder); + } + } + + public void saveIncome1(Map req) { + Integer nextOrder = jdbcTemplate.queryForObject( """ SELECT IFNULL(MAX(orderby),0) + 1 @@ -1821,6 +2475,8 @@ public class ChildrenSurveyService { isactive, isdelete FROM interest_field_master + WHERE isactive = 1 + AND isdelete = 0 ORDER BY orderby """; @@ -1829,6 +2485,63 @@ public class ChildrenSurveyService { public void saveInterestField(Map req) { + Integer id = req.get("id") != null + ? Integer.parseInt(req.get("id").toString()) + : 0; + + // UPDATE + if (id > 0) { + + String updateSql = """ + UPDATE interest_field_master + SET english_name = ? + WHERE id = ? + """; + + jdbcTemplate.update( + updateSql, + req.get("english_name"), + id); + } + + // INSERT + else { + + Integer nextOrder = jdbcTemplate.queryForObject( + """ + SELECT IFNULL(MAX(orderby),0) + 1 + FROM interest_field_master + """, + Integer.class); + + String insertSql = """ + INSERT INTO interest_field_master + ( + english_name, + orderby, + cdate, + isactive, + isdelete + ) + VALUES + ( + ?, + ?, + NOW(), + 1, + 0 + ) + """; + + jdbcTemplate.update( + insertSql, + req.get("english_name"), + nextOrder); + } + } + + public void saveInterestField1(Map req) { + Integer nextOrder = jdbcTemplate.queryForObject( """ SELECT IFNULL(MAX(orderby),0) + 1 @@ -1894,6 +2607,8 @@ public class ChildrenSurveyService { isactive, isdelete FROM ownership_master + WHERE isactive = 1 + AND isdelete = 0 ORDER BY orderby """; @@ -1902,6 +2617,63 @@ public class ChildrenSurveyService { public void saveOwner(Map req) { + Integer id = req.get("id") != null + ? Integer.parseInt(req.get("id").toString()) + : 0; + + // UPDATE + if (id > 0) { + + String updateSql = """ + UPDATE ownership_master + SET english_name = ? + WHERE id = ? + """; + + jdbcTemplate.update( + updateSql, + req.get("english_name"), + id); + } + + // INSERT + else { + + Integer nextOrder = jdbcTemplate.queryForObject( + """ + SELECT IFNULL(MAX(orderby),0) + 1 + FROM ownership_master + """, + Integer.class); + + String insertSql = """ + INSERT INTO ownership_master + ( + english_name, + orderby, + cdate, + isactive, + isdelete + ) + VALUES + ( + ?, + ?, + NOW(), + 1, + 0 + ) + """; + + jdbcTemplate.update( + insertSql, + req.get("english_name"), + nextOrder); + } + } + + public void saveOwner1(Map req) { + Integer nextOrder = jdbcTemplate.queryForObject( """ SELECT IFNULL(MAX(orderby),0) + 1 @@ -1967,6 +2739,8 @@ public class ChildrenSurveyService { isactive, isdelete FROM religion_master + WHERE isactive = 1 + AND isdelete = 0 ORDER BY orderby """; @@ -1975,6 +2749,63 @@ public class ChildrenSurveyService { public void saveReligion(Map req) { + Integer id = req.get("id") != null + ? Integer.parseInt(req.get("id").toString()) + : 0; + + // UPDATE + if (id > 0) { + + String updateSql = """ + UPDATE religion_master + SET english_name = ? + WHERE id = ? + """; + + jdbcTemplate.update( + updateSql, + req.get("english_name"), + id); + } + + // INSERT + else { + + Integer nextOrder = jdbcTemplate.queryForObject( + """ + SELECT IFNULL(MAX(orderby),0) + 1 + FROM religion_master + """, + Integer.class); + + String insertSql = """ + INSERT INTO religion_master + ( + english_name, + orderby, + cdate, + isactive, + isdelete + ) + VALUES + ( + ?, + ?, + NOW(), + 1, + 0 + ) + """; + + jdbcTemplate.update( + insertSql, + req.get("english_name"), + nextOrder); + } + } + + public void saveReligion1(Map req) { + Integer nextOrder = jdbcTemplate.queryForObject( """ SELECT IFNULL(MAX(orderby),0) + 1 @@ -2040,6 +2871,8 @@ public class ChildrenSurveyService { isactive, isdelete FROM vulnerability_master + WHERE isactive = 1 + AND isdelete = 0 ORDER BY orderby """; @@ -2048,6 +2881,63 @@ public class ChildrenSurveyService { public void saveVulnerability(Map req) { + Integer id = req.get("id") != null + ? Integer.parseInt(req.get("id").toString()) + : 0; + + // UPDATE + if (id > 0) { + + String updateSql = """ + UPDATE vulnerability_master + SET english_name = ? + WHERE id = ? + """; + + jdbcTemplate.update( + updateSql, + req.get("english_name"), + id); + } + + // INSERT + else { + + Integer nextOrder = jdbcTemplate.queryForObject( + """ + SELECT IFNULL(MAX(orderby),0) + 1 + FROM vulnerability_master + """, + Integer.class); + + String insertSql = """ + INSERT INTO vulnerability_master + ( + english_name, + orderby, + cdate, + isactive, + isdelete + ) + VALUES + ( + ?, + ?, + NOW(), + 1, + 0 + ) + """; + + jdbcTemplate.update( + insertSql, + req.get("english_name"), + nextOrder); + } + } + + public void saveVulnerability1(Map req) { + Integer nextOrder = jdbcTemplate.queryForObject( """ SELECT IFNULL(MAX(orderby),0) + 1 @@ -2113,6 +3003,8 @@ public class ChildrenSurveyService { isactive, isdelete FROM where_about_master + WHERE isactive = 1 + AND isdelete = 0 ORDER BY orderby """; @@ -2121,6 +3013,63 @@ public class ChildrenSurveyService { public void saveWhereabout(Map req) { + Integer id = req.get("id") != null + ? Integer.parseInt(req.get("id").toString()) + : 0; + + // UPDATE + if (id > 0) { + + String updateSql = """ + UPDATE where_about_master + SET english_name = ? + WHERE id = ? + """; + + jdbcTemplate.update( + updateSql, + req.get("english_name"), + id); + } + + // INSERT + else { + + Integer nextOrder = jdbcTemplate.queryForObject( + """ + SELECT IFNULL(MAX(orderby),0) + 1 + FROM where_about_master + """, + Integer.class); + + String insertSql = """ + INSERT INTO where_about_master + ( + english_name, + orderby, + cdate, + isactive, + isdelete + ) + VALUES + ( + ?, + ?, + NOW(), + 1, + 0 + ) + """; + + jdbcTemplate.update( + insertSql, + req.get("english_name"), + nextOrder); + } + } + + public void saveWhereabout1(Map req) { + Integer nextOrder = jdbcTemplate.queryForObject( """ SELECT IFNULL(MAX(orderby),0) + 1 @@ -2186,6 +3135,8 @@ public class ChildrenSurveyService { isactive, isdelete FROM document_reason_master + WHERE isactive = 1 + AND isdelete = 0 ORDER BY orderby """; @@ -2194,6 +3145,63 @@ public class ChildrenSurveyService { public void saveDocumentReason(Map req) { + Integer id = req.get("id") != null + ? Integer.parseInt(req.get("id").toString()) + : 0; + + // UPDATE + if (id > 0) { + + String updateSql = """ + UPDATE document_reason_master + SET english_name = ? + WHERE id = ? + """; + + jdbcTemplate.update( + updateSql, + req.get("english_name"), + id); + } + + // INSERT + else { + + Integer nextOrder = jdbcTemplate.queryForObject( + """ + SELECT IFNULL(MAX(orderby),0) + 1 + FROM document_reason_master + """, + Integer.class); + + String insertSql = """ + INSERT INTO document_reason_master + ( + english_name, + orderby, + cdate, + isactive, + isdelete + ) + VALUES + ( + ?, + ?, + NOW(), + 1, + 0 + ) + """; + + jdbcTemplate.update( + insertSql, + req.get("english_name"), + nextOrder); + } + } + + public void saveDocumentReason1(Map req) { + Integer nextOrder = jdbcTemplate.queryForObject( """ SELECT IFNULL(MAX(orderby),0) + 1 diff --git a/gcc_officer_portal/src/main/resources/templates/modules/childrensurvey/castemaster.html b/gcc_officer_portal/src/main/resources/templates/modules/childrensurvey/castemaster.html index 5e45275b..7016eb31 100644 --- a/gcc_officer_portal/src/main/resources/templates/modules/childrensurvey/castemaster.html +++ b/gcc_officer_portal/src/main/resources/templates/modules/childrensurvey/castemaster.html @@ -237,10 +237,11 @@ - ID - Caste Name + Slno + Caste Name Status - Action + Delete + Edit @@ -388,18 +389,22 @@ loadEducationTable(); }); + let editId = 0; function openAddModal() { + editId = 0; + $("#educationName").val(''); + $(".modal-title").text("Add Caste"); + let modal = new bootstrap.Modal( document.getElementById('educationModal') ); modal.show(); } - function loadEducationTable() { $.ajax({ @@ -411,11 +416,9 @@ let tbody = ""; - data.forEach(function (row) { + data.forEach(function (row, index) { - let statusBadge = row.isactive == 1 - ? `Active` - : `Disabled`; + let statusBadge = `Active`; let actionButton = row.isactive == 1 ? ` @@ -434,13 +437,24 @@ tbody += ` - ${row.id} + ${index + 1} ${row.english_name} ${statusBadge} - ${actionButton} + + + + + + `; @@ -462,6 +476,20 @@ } }); } + function editEducation(id, name) { + + editId = id; + + $("#educationName").val(name); + + $(".modal-title").text("Edit Caste"); + + let modal = new bootstrap.Modal( + document.getElementById('educationModal') + ); + + modal.show(); + } function saveEducation() { @@ -474,6 +502,7 @@ contentType: "application/json", data: JSON.stringify({ + id: editId, english_name: $("#educationName").val() diff --git a/gcc_officer_portal/src/main/resources/templates/modules/childrensurvey/childlist.html b/gcc_officer_portal/src/main/resources/templates/modules/childrensurvey/childlist.html index 89779b5b..ed9bc3cd 100644 --- a/gcc_officer_portal/src/main/resources/templates/modules/childrensurvey/childlist.html +++ b/gcc_officer_portal/src/main/resources/templates/modules/childrensurvey/childlist.html @@ -604,10 +604,12 @@ } }); + let allQuestions = { - ...surveyData.personalInformation, + ...surveyData.locationDetails, + ...surveyData.personalInformation, ...surveyData.educationDetails, ...surveyData.healthDetails, ...surveyData.documentDetails, @@ -631,7 +633,100 @@ } // CREATE WORKSHEET - const worksheet = XLSX.utils.json_to_sheet(excelData); + //const worksheet = XLSX.utils.json_to_sheet(excelData); + // FIXED COLUMN ORDER + const headers = [ + + "S.No", + "Survey ID", + + // LOCATION + "Select the Area", + "Type of House Ownership", + "How Long You Have Been Staying Here?", + "Block No", + "House No", + + // PERSONAL + "Name of the Child Name", + "Gender", + "Do you know DOB?", + "Date of Birth", + "Age", + "Place of Birth", + "Hospital of Birth", + "Religion", + "Caste", + "Sub Caste", + "Child Living With", + "Father Name", + "Mother Name", + "Where abouts", + "Guardian Name", + "Relationship", + "Occupation", + "Family Monthly Income", + "Contact Number", + + // EDUCATION + "Are they Currently Studying", + "Education Status", + "School Name", + "School Location", + "Which standard they stopped", + "Which year did they stopped", + "Reason for Dropout", + "Is The Child Interested In Continuing Education?", + "What are you Interested In?", + "Are you Staying in any Educational Hostel", + "Name of the Hostel?", + "Location of the Hostel?", + + // HEALTH + "Does the child have any history of health issues?", + "Health Details", + + // DOCUMENT + "Documents Available", + "Aadhar card", + "Aadhar No", + "Community Certificate", + "Birth Certificate", + "Any corrections to be made in the document?", + "If Not Why?", + + // VULNERABILITY + "Vulnerability Assessment", + "Any Other Support Needed?", + "Comments & Remarks", + "Where about of Father?", + "Where about of Mother?" + ]; + + // CREATE NEW ORDERED DATA + let orderedExcelData = []; + + excelData.forEach(function (row) { + + let orderedRow = {}; + + headers.forEach(function (header) { + + orderedRow[header] = row[header] || ''; + + }); + + orderedExcelData.push(orderedRow); + + }); + + // CREATE SHEET + const worksheet = XLSX.utils.json_to_sheet( + orderedExcelData, + { + header: headers + } + ); // AUTO COLUMN WIDTH //const columns = []; @@ -812,15 +907,16 @@ return sectionHtml; }*/ - html += buildSection( - "Personal Information", - data.personalInformation - ); + html += buildSection( "Location Details", data.locationDetails ); + html += buildSection( + "Personal Information", + data.personalInformation + ); html += buildSection( "Education Details", diff --git a/gcc_officer_portal/src/main/resources/templates/modules/childrensurvey/documentcorrectionmaster.html b/gcc_officer_portal/src/main/resources/templates/modules/childrensurvey/documentcorrectionmaster.html index e9afb865..420c0b94 100644 --- a/gcc_officer_portal/src/main/resources/templates/modules/childrensurvey/documentcorrectionmaster.html +++ b/gcc_officer_portal/src/main/resources/templates/modules/childrensurvey/documentcorrectionmaster.html @@ -237,10 +237,11 @@ - ID + Sl No Document Correction Name Status - Action + Delete + Edit @@ -389,10 +390,25 @@ }); + /*function openAddModal() { + + $("#educationName").val(''); + + let modal = new bootstrap.Modal( + document.getElementById('educationModal') + ); + + modal.show(); + }*/ + let editId = 0; function openAddModal() { + editId = 0; + $("#educationName").val(''); + $(".modal-title").text("Add Document Correction"); + let modal = new bootstrap.Modal( document.getElementById('educationModal') ); @@ -411,11 +427,8 @@ let tbody = ""; - data.forEach(function (row) { - - let statusBadge = row.isactive == 1 - ? `Active` - : `Disabled`; + data.forEach(function (row, index) { + let statusBadge = `Active`; let actionButton = row.isactive == 1 ? ` @@ -434,13 +447,25 @@ tbody += ` - ${row.id} + ${index + 1} ${row.english_name} ${statusBadge} - ${actionButton} + + + + + + + `; @@ -462,6 +487,20 @@ } }); } + function editEducation(id, name) { + + editId = id; + + $("#educationName").val(name); + + $(".modal-title").text("Edit Document Correction"); + + let modal = new bootstrap.Modal( + document.getElementById('educationModal') + ); + + modal.show(); + } function saveEducation() { @@ -475,6 +514,7 @@ data: JSON.stringify({ + id: editId, english_name: $("#educationName").val() }), diff --git a/gcc_officer_portal/src/main/resources/templates/modules/childrensurvey/documentreasonmaster.html b/gcc_officer_portal/src/main/resources/templates/modules/childrensurvey/documentreasonmaster.html index 27e942fc..50b422a5 100644 --- a/gcc_officer_portal/src/main/resources/templates/modules/childrensurvey/documentreasonmaster.html +++ b/gcc_officer_portal/src/main/resources/templates/modules/childrensurvey/documentreasonmaster.html @@ -237,10 +237,11 @@ - ID + Sl No Document Reason Name Status - Action + Delete + Edit @@ -389,10 +390,25 @@ }); + /*function openAddModal() { + + $("#educationName").val(''); + + let modal = new bootstrap.Modal( + document.getElementById('educationModal') + ); + + modal.show(); + }*/ + let editId = 0; function openAddModal() { + editId = 0; + $("#educationName").val(''); + $(".modal-title").text("Add Document Reason"); + let modal = new bootstrap.Modal( document.getElementById('educationModal') ); @@ -400,6 +416,7 @@ modal.show(); } + function loadEducationTable() { $.ajax({ @@ -411,11 +428,9 @@ let tbody = ""; - data.forEach(function (row) { + data.forEach(function (row, index) { - let statusBadge = row.isactive == 1 - ? `Active` - : `Disabled`; + let statusBadge = `Active`; let actionButton = row.isactive == 1 ? ` @@ -440,7 +455,19 @@ ${statusBadge} - ${actionButton} + + + + + + + `; @@ -462,6 +489,20 @@ } }); } + function editEducation(id, name) { + + editId = id; + + $("#educationName").val(name); + + $(".modal-title").text("Edit Document Reason"); + + let modal = new bootstrap.Modal( + document.getElementById('educationModal') + ); + + modal.show(); + } function saveEducation() { @@ -475,6 +516,7 @@ data: JSON.stringify({ + id: editId, english_name: $("#educationName").val() }), diff --git a/gcc_officer_portal/src/main/resources/templates/modules/childrensurvey/dropoutreasonmaster.html b/gcc_officer_portal/src/main/resources/templates/modules/childrensurvey/dropoutreasonmaster.html index 8ead6461..30278936 100644 --- a/gcc_officer_portal/src/main/resources/templates/modules/childrensurvey/dropoutreasonmaster.html +++ b/gcc_officer_portal/src/main/resources/templates/modules/childrensurvey/dropoutreasonmaster.html @@ -237,10 +237,11 @@ - ID + Sl No Dropout Reason Name Status - Action + Delete + Edit @@ -389,10 +390,25 @@ }); + /*function openAddModal() { + + $("#educationName").val(''); + + let modal = new bootstrap.Modal( + document.getElementById('educationModal') + ); + + modal.show(); + }*/ + let editId = 0; function openAddModal() { + editId = 0; + $("#educationName").val(''); + $(".modal-title").text("Add Dropout Reason"); + let modal = new bootstrap.Modal( document.getElementById('educationModal') ); @@ -411,11 +427,9 @@ let tbody = ""; - data.forEach(function (row) { + data.forEach(function (row, index) { - let statusBadge = row.isactive == 1 - ? `Active` - : `Disabled`; + let statusBadge = `Active`; let actionButton = row.isactive == 1 ? ` @@ -440,7 +454,20 @@ ${statusBadge} - ${actionButton} + + + + + + + + `; @@ -462,6 +489,20 @@ } }); } + function editEducation(id, name) { + + editId = id; + + $("#educationName").val(name); + + $(".modal-title").text("Edit Dropout Reason"); + + let modal = new bootstrap.Modal( + document.getElementById('educationModal') + ); + + modal.show(); + } function saveEducation() { @@ -475,6 +516,7 @@ data: JSON.stringify({ + id: editId, english_name: $("#educationName").val() }), diff --git a/gcc_officer_portal/src/main/resources/templates/modules/childrensurvey/educationmaster.html b/gcc_officer_portal/src/main/resources/templates/modules/childrensurvey/educationmaster.html index 595a59ae..55ff15e3 100644 --- a/gcc_officer_portal/src/main/resources/templates/modules/childrensurvey/educationmaster.html +++ b/gcc_officer_portal/src/main/resources/templates/modules/childrensurvey/educationmaster.html @@ -237,10 +237,11 @@ - ID + Slno Education Name Status Action + Edit @@ -390,13 +391,19 @@ }); function openAddModal() { + editId = 0; $("#educationName").val(''); + $(".modal-title").text("Add Education"); + let modal = new bootstrap.Modal( document.getElementById('educationModal') ); + + + modal.show(); } @@ -411,17 +418,15 @@ let tbody = ""; - data.forEach(function (row) { + data.forEach(function (row, index) { - let statusBadge = row.isactive == 1 - ? `Active` - : `Disabled`; + let statusBadge = `Active`; let actionButton = row.isactive == 1 ? ` ` : ` @@ -434,7 +439,7 @@ tbody += ` - ${row.id} + ${index + 1} ${row.english_name} @@ -442,6 +447,13 @@ ${actionButton} + + + + `; }); @@ -462,6 +474,22 @@ } }); } + let editId = 0; + + function editEducation(id, name) { + + editId = id; + + $("#educationName").val(name); + + $(".modal-title").text("Edit Education"); + + let modal = new bootstrap.Modal( + document.getElementById('educationModal') + ); + + modal.show(); + } function saveEducation() { @@ -474,12 +502,14 @@ contentType: "application/json", data: JSON.stringify({ + id: editId, english_name: $("#educationName").val() }), success: function () { + editId = 0; Swal.fire({ icon: 'success', diff --git a/gcc_officer_portal/src/main/resources/templates/modules/childrensurvey/gendermaster.html b/gcc_officer_portal/src/main/resources/templates/modules/childrensurvey/gendermaster.html index 77e0afa8..b2955a35 100644 --- a/gcc_officer_portal/src/main/resources/templates/modules/childrensurvey/gendermaster.html +++ b/gcc_officer_portal/src/main/resources/templates/modules/childrensurvey/gendermaster.html @@ -237,10 +237,12 @@ - ID + Slno Gender Name Status - Action + Delete + Edit + @@ -388,11 +390,14 @@ loadEducationTable(); }); - function openAddModal() { + editId = 0; + $("#educationName").val(''); + $(".modal-title").text("Add Gender"); + let modal = new bootstrap.Modal( document.getElementById('educationModal') ); @@ -400,6 +405,17 @@ modal.show(); } + /*function openAddModal() { + + $("#educationName").val(''); + + let modal = new bootstrap.Modal( + document.getElementById('educationModal') + ); + + modal.show(); + }*/ + function loadEducationTable() { $.ajax({ @@ -411,17 +427,15 @@ let tbody = ""; - data.forEach(function (row) { + data.forEach(function (row, index) { - let statusBadge = row.isactive == 1 - ? `Active` - : `Disabled`; + let statusBadge = `Active`; let actionButton = row.isactive == 1 ? ` ` : ` @@ -434,7 +448,7 @@ tbody += ` - ${row.id} + ${index + 1} ${row.english_name} @@ -442,6 +456,13 @@ ${actionButton} + + + + `; }); @@ -463,6 +484,25 @@ }); } + //update logic + let editId = 0; + + function editEducation(id, name) { + + editId = id; + + $("#educationName").val(name); + + $(".modal-title").text("Edit Gender"); + + let modal = new bootstrap.Modal( + document.getElementById('educationModal') + ); + + modal.show(); + } + + function saveEducation() { $.ajax({ @@ -474,12 +514,14 @@ contentType: "application/json", data: JSON.stringify({ + id: editId, english_name: $("#educationName").val() }), success: function () { + editId = 0; Swal.fire({ icon: 'success', diff --git a/gcc_officer_portal/src/main/resources/templates/modules/childrensurvey/incomemaster.html b/gcc_officer_portal/src/main/resources/templates/modules/childrensurvey/incomemaster.html index 4ff6a883..7e8413c8 100644 --- a/gcc_officer_portal/src/main/resources/templates/modules/childrensurvey/incomemaster.html +++ b/gcc_officer_portal/src/main/resources/templates/modules/childrensurvey/incomemaster.html @@ -237,10 +237,11 @@ - ID + Sl No Income Name Status - Action + Delete + Edit @@ -388,9 +389,24 @@ loadEducationTable(); }); - + let editId = 0; function openAddModal() { + editId = 0; + + $("#educationName").val(''); + + $(".modal-title").text("Add Income"); + + let modal = new bootstrap.Modal( + document.getElementById('educationModal') + ); + + modal.show(); + } + + function openAddModal1() { + $("#educationName").val(''); let modal = new bootstrap.Modal( @@ -411,11 +427,9 @@ let tbody = ""; - data.forEach(function (row) { + data.forEach(function (row, index) { - let statusBadge = row.isactive == 1 - ? `Active` - : `Disabled`; + let statusBadge = `Active`; let actionButton = row.isactive == 1 ? ` @@ -434,13 +448,25 @@ tbody += ` - ${row.id} + ${index + 1} ${row.english_name} ${statusBadge} - ${actionButton} + + + + + + + `; @@ -462,6 +488,20 @@ } }); } + function editEducation(id, name) { + + editId = id; + + $("#educationName").val(name); + + $(".modal-title").text("Edit Income"); + + let modal = new bootstrap.Modal( + document.getElementById('educationModal') + ); + + modal.show(); + } function saveEducation() { @@ -474,6 +514,7 @@ contentType: "application/json", data: JSON.stringify({ + id: editId, english_name: $("#educationName").val() diff --git a/gcc_officer_portal/src/main/resources/templates/modules/childrensurvey/interestfieldmaster.html b/gcc_officer_portal/src/main/resources/templates/modules/childrensurvey/interestfieldmaster.html index e7d27498..1670a0c4 100644 --- a/gcc_officer_portal/src/main/resources/templates/modules/childrensurvey/interestfieldmaster.html +++ b/gcc_officer_portal/src/main/resources/templates/modules/childrensurvey/interestfieldmaster.html @@ -237,10 +237,11 @@ - ID + Sl No Interest Field Name Status - Action + Delete + Edit @@ -389,10 +390,25 @@ }); + /*function openAddModal() { + + $("#educationName").val(''); + + let modal = new bootstrap.Modal( + document.getElementById('educationModal') + ); + + modal.show(); + }*/ + let editId = 0; function openAddModal() { + editId = 0; + $("#educationName").val(''); + $(".modal-title").text("Add Interest Field"); + let modal = new bootstrap.Modal( document.getElementById('educationModal') ); @@ -411,11 +427,9 @@ let tbody = ""; - data.forEach(function (row) { + data.forEach(function (row, index) { - let statusBadge = row.isactive == 1 - ? `Active` - : `Disabled`; + let statusBadge = `Active`; let actionButton = row.isactive == 1 ? ` @@ -434,13 +448,25 @@ tbody += ` - ${row.id} + ${index + 1} ${row.english_name} ${statusBadge} - ${actionButton} + + + + + + + `; @@ -462,6 +488,20 @@ } }); } + function editEducation(id, name) { + + editId = id; + + $("#educationName").val(name); + + $(".modal-title").text("Edit Interest Field"); + + let modal = new bootstrap.Modal( + document.getElementById('educationModal') + ); + + modal.show(); + } function saveEducation() { @@ -474,9 +514,8 @@ contentType: "application/json", data: JSON.stringify({ - + id: editId, english_name: $("#educationName").val() - }), success: function () { diff --git a/gcc_officer_portal/src/main/resources/templates/modules/childrensurvey/livingmaster.html b/gcc_officer_portal/src/main/resources/templates/modules/childrensurvey/livingmaster.html index 61fe1217..ccbe0360 100644 --- a/gcc_officer_portal/src/main/resources/templates/modules/childrensurvey/livingmaster.html +++ b/gcc_officer_portal/src/main/resources/templates/modules/childrensurvey/livingmaster.html @@ -237,10 +237,12 @@ - ID + Sl.No Living Type Name Status - Action + Delete + edit + @@ -389,10 +391,25 @@ }); + /*function openAddModal() { + + $("#educationName").val(''); + + let modal = new bootstrap.Modal( + document.getElementById('educationModal') + ); + + modal.show(); + }*/ + let editId = 0; function openAddModal() { + editId = 0; + $("#educationName").val(''); + $(".modal-title").text("Add Living"); + let modal = new bootstrap.Modal( document.getElementById('educationModal') ); @@ -411,11 +428,9 @@ let tbody = ""; - data.forEach(function (row) { + data.forEach(function (row, index) { - let statusBadge = row.isactive == 1 - ? `Active` - : `Disabled`; + let statusBadge = `Active`; let actionButton = row.isactive == 1 ? ` @@ -434,13 +449,25 @@ tbody += ` - ${row.id} + ${index + 1} ${row.english_name} ${statusBadge} - ${actionButton} + + + + + + + `; @@ -462,6 +489,20 @@ } }); } + function editEducation(id, name) { + + editId = id; + + $("#educationName").val(name); + + $(".modal-title").text("Edit Living"); + + let modal = new bootstrap.Modal( + document.getElementById('educationModal') + ); + + modal.show(); + } function saveEducation() { @@ -474,6 +515,7 @@ contentType: "application/json", data: JSON.stringify({ + id: editId, english_name: $("#educationName").val() diff --git a/gcc_officer_portal/src/main/resources/templates/modules/childrensurvey/locationmaster.html b/gcc_officer_portal/src/main/resources/templates/modules/childrensurvey/locationmaster.html index 1da35c78..01f5ef35 100644 --- a/gcc_officer_portal/src/main/resources/templates/modules/childrensurvey/locationmaster.html +++ b/gcc_officer_portal/src/main/resources/templates/modules/childrensurvey/locationmaster.html @@ -237,10 +237,12 @@ - ID + Slno Location Name Status - Action + + Delete + Edit @@ -389,10 +391,24 @@ }); + /*function openAddModal() { + + $("#educationName").val(''); + + let modal = new bootstrap.Modal( + document.getElementById('educationModal') + ); + + modal.show(); + }*/ function openAddModal() { + editId = 0; + $("#educationName").val(''); + $(".modal-title").text("Add Location"); + let modal = new bootstrap.Modal( document.getElementById('educationModal') ); @@ -400,6 +416,7 @@ modal.show(); } + function loadEducationTable() { $.ajax({ @@ -411,7 +428,7 @@ let tbody = ""; - data.forEach(function (row) { + data.forEach(function (row, index) { let statusBadge = row.isactive == 1 ? `Active` @@ -434,13 +451,24 @@ tbody += ` - ${row.id} + ${index + 1} ${row.english_name} ${statusBadge} - - ${actionButton} + + + + + + + `; @@ -462,6 +490,20 @@ } }); } + function editEducation(id, name) { + + editId = id; + + $("#educationName").val(name); + + $(".modal-title").text("Edit Location"); + + let modal = new bootstrap.Modal( + document.getElementById('educationModal') + ); + + modal.show(); + } function saveEducation() { @@ -474,6 +516,7 @@ contentType: "application/json", data: JSON.stringify({ + id: editId, english_name: $("#educationName").val() diff --git a/gcc_officer_portal/src/main/resources/templates/modules/childrensurvey/ownermaster.html b/gcc_officer_portal/src/main/resources/templates/modules/childrensurvey/ownermaster.html index 21fc0e92..2828c206 100644 --- a/gcc_officer_portal/src/main/resources/templates/modules/childrensurvey/ownermaster.html +++ b/gcc_officer_portal/src/main/resources/templates/modules/childrensurvey/ownermaster.html @@ -237,10 +237,11 @@ - ID + Sl.No Owner Name Status - Action + Delete + Edit @@ -389,10 +390,25 @@ }); + /*function openAddModal() { + + $("#educationName").val(''); + + let modal = new bootstrap.Modal( + document.getElementById('educationModal') + ); + + modal.show(); + }*/ + let editId = 0; function openAddModal() { + editId = 0; + $("#educationName").val(''); + $(".modal-title").text("Add Owner"); + let modal = new bootstrap.Modal( document.getElementById('educationModal') ); @@ -411,11 +427,9 @@ let tbody = ""; - data.forEach(function (row) { + data.forEach(function (row, index) { - let statusBadge = row.isactive == 1 - ? `Active` - : `Disabled`; + let statusBadge = `Active`; let actionButton = row.isactive == 1 ? ` @@ -440,7 +454,19 @@ ${statusBadge} - ${actionButton} + + + + + + + `; @@ -462,6 +488,20 @@ } }); } + function editEducation(id, name) { + + editId = id; + + $("#educationName").val(name); + + $(".modal-title").text("Edit Owner"); + + let modal = new bootstrap.Modal( + document.getElementById('educationModal') + ); + + modal.show(); + } function saveEducation() { @@ -474,6 +514,7 @@ contentType: "application/json", data: JSON.stringify({ + id: editId, english_name: $("#educationName").val() diff --git a/gcc_officer_portal/src/main/resources/templates/modules/childrensurvey/religionmaster.html b/gcc_officer_portal/src/main/resources/templates/modules/childrensurvey/religionmaster.html index cce275fd..9fb7d144 100644 --- a/gcc_officer_portal/src/main/resources/templates/modules/childrensurvey/religionmaster.html +++ b/gcc_officer_portal/src/main/resources/templates/modules/childrensurvey/religionmaster.html @@ -237,10 +237,11 @@ - ID + Sl.No Religion Name Status - Action + Delete + Edit @@ -389,10 +390,25 @@ }); + /*function openAddModal() { + + $("#educationName").val(''); + + let modal = new bootstrap.Modal( + document.getElementById('educationModal') + ); + + modal.show(); + }*/ + let editId = 0; function openAddModal() { + editId = 0; + $("#educationName").val(''); + $(".modal-title").text("Add Religion"); + let modal = new bootstrap.Modal( document.getElementById('educationModal') ); @@ -411,11 +427,9 @@ let tbody = ""; - data.forEach(function (row) { + data.forEach(function (row, index) { - let statusBadge = row.isactive == 1 - ? `Active` - : `Disabled`; + let statusBadge = `Active`; let actionButton = row.isactive == 1 ? ` @@ -434,13 +448,25 @@ tbody += ` - ${row.id} + ${index + 1} ${row.english_name} ${statusBadge} - ${actionButton} + + + + + + + `; @@ -462,6 +488,20 @@ } }); } + function editEducation(id, name) { + + editId = id; + + $("#educationName").val(name); + + $(".modal-title").text("Edit Religion"); + + let modal = new bootstrap.Modal( + document.getElementById('educationModal') + ); + + modal.show(); + } function saveEducation() { @@ -474,6 +514,7 @@ contentType: "application/json", data: JSON.stringify({ + id: editId, english_name: $("#educationName").val() diff --git a/gcc_officer_portal/src/main/resources/templates/modules/childrensurvey/surveylist.html b/gcc_officer_portal/src/main/resources/templates/modules/childrensurvey/surveylist.html index 05379e80..7c2c175c 100644 --- a/gcc_officer_portal/src/main/resources/templates/modules/childrensurvey/surveylist.html +++ b/gcc_officer_portal/src/main/resources/templates/modules/childrensurvey/surveylist.html @@ -518,16 +518,17 @@ return sectionHtml; } + html += buildSection( + "Location Details", + data.locationDetails + ); html += buildSection( "Personal Information", data.personalInformation ); - html += buildSection( - "Location Details", - data.locationDetails - ); + html += buildSection( "Education Details", diff --git a/gcc_officer_portal/src/main/resources/templates/modules/childrensurvey/vulnerabilitymaster.html b/gcc_officer_portal/src/main/resources/templates/modules/childrensurvey/vulnerabilitymaster.html index 3cea475a..abcf27f5 100644 --- a/gcc_officer_portal/src/main/resources/templates/modules/childrensurvey/vulnerabilitymaster.html +++ b/gcc_officer_portal/src/main/resources/templates/modules/childrensurvey/vulnerabilitymaster.html @@ -237,10 +237,11 @@ - ID + S.No Vulnerability Name Status - Action + Delete + Edit @@ -389,10 +390,25 @@ }); + /*function openAddModal() { + + $("#educationName").val(''); + + let modal = new bootstrap.Modal( + document.getElementById('educationModal') + ); + + modal.show(); + }*/ + let editId = 0; function openAddModal() { + editId = 0; + $("#educationName").val(''); + $(".modal-title").text("Add Vulnerability"); + let modal = new bootstrap.Modal( document.getElementById('educationModal') ); @@ -411,11 +427,9 @@ let tbody = ""; - data.forEach(function (row) { + data.forEach(function (row, index) { - let statusBadge = row.isactive == 1 - ? `Active` - : `Disabled`; + let statusBadge = `Active`; let actionButton = row.isactive == 1 ? ` @@ -440,7 +454,19 @@ ${statusBadge} - ${actionButton} + + + + + + + `; @@ -462,6 +488,20 @@ } }); } + function editEducation(id, name) { + + editId = id; + + $("#educationName").val(name); + + $(".modal-title").text("Edit Vulnerability"); + + let modal = new bootstrap.Modal( + document.getElementById('educationModal') + ); + + modal.show(); + } function saveEducation() { @@ -474,6 +514,7 @@ contentType: "application/json", data: JSON.stringify({ + id: editId, english_name: $("#educationName").val() diff --git a/gcc_officer_portal/src/main/resources/templates/modules/childrensurvey/whereaboutmaster.html b/gcc_officer_portal/src/main/resources/templates/modules/childrensurvey/whereaboutmaster.html index 49d8df20..bcb72968 100644 --- a/gcc_officer_portal/src/main/resources/templates/modules/childrensurvey/whereaboutmaster.html +++ b/gcc_officer_portal/src/main/resources/templates/modules/childrensurvey/whereaboutmaster.html @@ -237,10 +237,11 @@ - ID + S.No Where About Name Status - Action + delete + Edit @@ -389,10 +390,25 @@ }); + /*function openAddModal() { + + $("#educationName").val(''); + + let modal = new bootstrap.Modal( + document.getElementById('educationModal') + ); + + modal.show(); + }*/ + let editId = 0; function openAddModal() { + editId = 0; + $("#educationName").val(''); + $(".modal-title").text("Add Where About"); + let modal = new bootstrap.Modal( document.getElementById('educationModal') ); @@ -411,11 +427,8 @@ let tbody = ""; - data.forEach(function (row) { - - let statusBadge = row.isactive == 1 - ? `Active` - : `Disabled`; + data.forEach(function (row, index) { + let statusBadge = `Active`; let actionButton = row.isactive == 1 ? ` @@ -440,7 +453,19 @@ ${statusBadge} - ${actionButton} + + + + + + + `; @@ -462,6 +487,20 @@ } }); } + function editEducation(id, name) { + + editId = id; + + $("#educationName").val(name); + + $(".modal-title").text("Edit Where About"); + + let modal = new bootstrap.Modal( + document.getElementById('educationModal') + ); + + modal.show(); + } function saveEducation() { @@ -474,6 +513,7 @@ contentType: "application/json", data: JSON.stringify({ + id: editId, english_name: $("#educationName").val()