From 00abf260238af87ae6a19bf0adb1a73578389d50 Mon Sep 17 00:00:00 2001 From: yoganandhan Date: Mon, 16 Feb 2026 17:32:05 +0530 Subject: [PATCH] changes in pages and service --- .../controller/FlagPoleApiController.java | 32 ++- .../flagpoles/service/RdoService.java | 205 ++++++++++++++++-- .../modules/flagpole/adminreports.html | 62 +++++- .../flagpole/approvedandrejectedlist.html | 61 +++++- .../modules/flagpole/requestlist.html | 43 ++-- 5 files changed, 341 insertions(+), 62 deletions(-) diff --git a/src/main/java/com/gcc/flagpoles_services/flagpoles/controller/FlagPoleApiController.java b/src/main/java/com/gcc/flagpoles_services/flagpoles/controller/FlagPoleApiController.java index 28459bb..04d0f43 100644 --- a/src/main/java/com/gcc/flagpoles_services/flagpoles/controller/FlagPoleApiController.java +++ b/src/main/java/com/gcc/flagpoles_services/flagpoles/controller/FlagPoleApiController.java @@ -13,7 +13,6 @@ import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.client.RestTemplate; -import com.gcc.flagpoles_services.configuration.AppConfig; import com.gcc.flagpoles_services.flagpoles.service.FlagpoleSMSService; import com.gcc.flagpoles_services.flagpoles.service.RdoService; @@ -28,12 +27,10 @@ public class FlagPoleApiController { private FlagpoleSMSService flagpoleSMSService; private final RestTemplate restTemplate; - private final AppConfig appConfig; @Autowired - public FlagPoleApiController(RestTemplate restTemplate, AppConfig appConfig) { + public FlagPoleApiController(RestTemplate restTemplate) { this.restTemplate = restTemplate; - this.appConfig = appConfig; } @GetMapping("/getAllDetails") @@ -127,14 +124,14 @@ public class FlagPoleApiController { try { - /* 🔥 Normalize username OR id → gccuserid */ + /* Normalize username OR id → gccuserid */ gccUserId = rdoService.resolveGccUserId(gccUserId); - /* 🔥 Fetch approved & rejected records */ + /* Fetch approved & rejected records */ List> result = rdoService.getRdoApprovedRequestDetailsByUserLogin( gccUserId, startDate, endDate, null); - /* 🔥 Attach officer feedback history per refid */ + /* Attach officer feedback history per refid */ for (Map record : result) { String refid = (String) record.get("refid"); @@ -160,17 +157,18 @@ public class FlagPoleApiController { } } - @GetMapping("/sendApprovedMessage") - public String sendApprovedMessage(@RequestParam String mobileNo, - @RequestParam String refid) { + // @GetMapping("/sendApprovedMessage") + // public String sendApprovedMessage(@RequestParam String mobileNo, + // @RequestParam String refid) { - return flagpoleSMSService.userrequestApprovedsms(mobileNo, refid); - } + // return flagpoleSMSService.userrequestApprovedsms(mobileNo, refid); + // } - @GetMapping("/sendRejectMessage") - public String sendRejectMessage(@RequestParam String mobileNo, @RequestParam String refid) { - return flagpoleSMSService.userrequestRejectedsms(mobileNo, refid); - } + // @GetMapping("/sendRejectMessage") + // public String sendRejectMessage(@RequestParam String mobileNo, @RequestParam + // String refid) { + // return flagpoleSMSService.userrequestRejectedsms(mobileNo, refid); + // } // @GetMapping("/sendUnauthorizedMessage") // public String sendUnauthorizedMessage(@RequestParam String mobileNo, @@ -198,7 +196,7 @@ public class FlagPoleApiController { @RequestParam(required = false) String status) { try { - /* 🔥 Normalize username OR id → gccuserid */ + /* Normalize username OR id → gccuserid */ gccUserId = rdoService.resolveGccUserId(gccUserId); List> result = rdoService.getAdminReportDetails(gccUserId, startDate, diff --git a/src/main/java/com/gcc/flagpoles_services/flagpoles/service/RdoService.java b/src/main/java/com/gcc/flagpoles_services/flagpoles/service/RdoService.java index 7b9d53b..10c2a63 100644 --- a/src/main/java/com/gcc/flagpoles_services/flagpoles/service/RdoService.java +++ b/src/main/java/com/gcc/flagpoles_services/flagpoles/service/RdoService.java @@ -256,7 +256,7 @@ public class RdoService { public List> getUserAccess(Long appUserId) { String sql = """ - SELECT lmu.zone,lmu.ward,lmu.zonearray, lmu.wardarray + SELECT lmu.zone,lmu.ward,lmu.zonearray, lmu.wardarray, lmu.unit FROM login_mapping_user lmu WHERE lmu.appuser_id = ? """; @@ -323,7 +323,7 @@ public class RdoService { public Map getOfficerDetailsByUserId(String gccUserId) { String sql = """ - SELECT dpid, zlsc_members, dlc_members, gcc_user_id, dro_member, final_authority_permanent + SELECT dpid, zlsc_members, dlc_members, gcc_user_id, dro_member, final_authority_permanent, documents_view FROM department_login WHERE gcc_user_id = ? AND is_active = 1 @@ -445,15 +445,22 @@ public class RdoService { /* Resolve access */ List> access = getUserAccess(appUserId); - String zone = null, zoneArray = null, wardArray = null; - boolean isRdo = false, isZonalOfficer = false; + /* 🔥 Documents View Permission */ + Integer documentsView = (Integer) officerDetails.get("documents_view"); + boolean canViewLandDocs = (documentsView != null && documentsView == 1); + + String zone = null, zoneArray = null, wardArray = null, unit = null; + boolean isRdo = false, isZonalOfficer = false, isUnitOfficer = false; if (!access.isEmpty()) { zone = (String) access.get(0).get("zone"); zoneArray = (String) access.get(0).get("zonearray"); wardArray = (String) access.get(0).get("wardarray"); + unit = (String) access.get(0).get("unit"); - if (hasValue(zoneArray) && hasValue(wardArray)) { + if (hasValue(unit) && hasValue(wardArray)) { + isUnitOfficer = true; + } else if (hasValue(zoneArray) && hasValue(wardArray)) { isRdo = true; } else if (hasValue(zone)) { isZonalOfficer = true; @@ -581,8 +588,15 @@ public class RdoService { params.add(applicationType); } + /* Unit Officer (AEE) */ + if (isUnitOfficer) { + /* Only Temporary Requests */ + sql.append(" AND urd.application_type = 1 "); + sql.append(" AND FIND_IN_SET(sd.ward, ?) "); + params.add(wardArray); + } /* RDO */ - if (isRdo) { + else if (isRdo) { sql.append(" AND FIND_IN_SET(sd.zone, ?) AND FIND_IN_SET(sd.ward, ?) "); params.add(zoneArray); params.add(wardArray); @@ -678,6 +692,7 @@ public class RdoService { List> rows = mysqlFlagPoleJdbcTemplate.queryForList(sql.toString(), params.toArray()); /* GROUP BY REFID */ + final boolean isUnitOfficerFinal = isUnitOfficer; Map> resultMap = new LinkedHashMap<>(); for (Map row : rows) { @@ -702,11 +717,21 @@ public class RdoService { map.put("event_name", row.get("event_name")); map.put("total_cost", row.get("total_cost")); - map.put("patta_image_url", isFinalAuthorityPermanent ? null : row.get("patta_image_url")); - map.put("affidavit_image_url", isFinalAuthorityPermanent ? null : row.get("affidavit_image_url")); - map.put("ec_image_url", isFinalAuthorityPermanent ? null : row.get("ec_image_url")); - map.put("fmb_sketch_url", isFinalAuthorityPermanent ? null : row.get("fmb_sketch_url")); - map.put("aadhaar_image_url", isFinalAuthorityPermanent ? null : row.get("aadhaar_image_url")); + map.put("patta_image_url", + ((isFinalAuthorityPermanent || isUnitOfficerFinal) && !canViewLandDocs) ? null + : row.get("patta_image_url")); + map.put("affidavit_image_url", + ((isFinalAuthorityPermanent || isUnitOfficerFinal) && !canViewLandDocs) ? null + : row.get("affidavit_image_url")); + map.put("ec_image_url", + ((isFinalAuthorityPermanent || isUnitOfficerFinal) && !canViewLandDocs) ? null + : row.get("ec_image_url")); + map.put("fmb_sketch_url", + ((isFinalAuthorityPermanent || isUnitOfficerFinal) && !canViewLandDocs) ? null + : row.get("fmb_sketch_url")); + map.put("aadhaar_image_url", + ((isFinalAuthorityPermanent || isUnitOfficerFinal) && !canViewLandDocs) ? null + : row.get("aadhaar_image_url")); map.put("application_type_id", row.get("application_type_id")); map.put("application_type_name", row.get("application_type_name")); @@ -718,12 +743,14 @@ public class RdoService { map.put("streets", new ArrayList<>()); map.put("history", new ArrayList<>()); - if ((isZlscMember || isDlcMember || isDro) + if (!isUnitOfficerFinal && (isZlscMember || isDlcMember || isDro) && "PERMANENT".equalsIgnoreCase((String) row.get("application_type_name"))) { map.put("verification_questions", verificationQuestions); } map.put("is_final_authority_perm", isFinalAuthorityPermanent); + map.put("is_unit_officer", isUnitOfficerFinal); + map.put("can_view_land_docs", canViewLandDocs); return map; }); @@ -1078,6 +1105,9 @@ public class RdoService { Integer droMember = (Integer) officerDetails.get("dro_member"); boolean isDro = (droMember != null && droMember == 1); + Integer finalAuthPerm = (Integer) officerDetails.get("final_authority_permanent"); + boolean isFinalAuthorityPermanent = (finalAuthPerm != null && finalAuthPerm == 1); + Integer gccUserQuestionsView = (Integer) officerDetails.get("gcc_user_id"); // System.out.println("gccUserQuestionsView: " + gccUserQuestionsView); @@ -1091,19 +1121,28 @@ public class RdoService { /* Resolve access */ List> access = getUserAccess(appUserId); + /* Documents View Permission */ + Integer documentsView = (Integer) officerDetails.get("documents_view"); + boolean canViewLandDocs = (documentsView != null && documentsView == 1); + String zone = null; String zoneArray = null; String wardArray = null; + String unit = null; boolean isRdo = false; boolean isZonalOfficer = false; + boolean isUnitOfficer = false; if (!access.isEmpty()) { zone = (String) access.get(0).get("zone"); zoneArray = (String) access.get(0).get("zonearray"); wardArray = (String) access.get(0).get("wardarray"); + unit = (String) access.get(0).get("unit"); - if (hasValue(zoneArray) && hasValue(wardArray)) { + if (hasValue(unit) && hasValue(wardArray)) { + isUnitOfficer = true; + } else if (hasValue(zoneArray) && hasValue(wardArray)) { isRdo = true; } else if (hasValue(zone)) { isZonalOfficer = true; @@ -1140,6 +1179,17 @@ public class RdoService { sd.street_cost, sd.height, + CASE WHEN urd.patta_image_path IS NOT NULL + THEN CONCAT(?,'/gcc/files',urd.patta_image_path) END AS patta_image_url, + CASE WHEN urd.affidavit_image_path IS NOT NULL + THEN CONCAT(?,'/gcc/files',urd.affidavit_image_path) END AS affidavit_image_url, + CASE WHEN urd.ec_image_path IS NOT NULL + THEN CONCAT(?,'/gcc/files',urd.ec_image_path) END AS ec_image_url, + CASE WHEN urd.fmb_sketch_path IS NOT NULL + THEN CONCAT(?,'/gcc/files',urd.fmb_sketch_path) END AS fmb_sketch_url, + CASE WHEN urd.aadhaar_image_path IS NOT NULL + THEN CONCAT(?,'/gcc/files',urd.aadhaar_image_path) END AS aadhaar_image_url, + fm.flag_material_name AS flag_material, pm.pole_material_name AS pole_material, sm.statue_material_type, @@ -1173,6 +1223,14 @@ public class RdoService { """); List params = new ArrayList<>(); + + /* Add base URL params for image paths */ + params.add(fileBaseUrlImages); + params.add(fileBaseUrlImages); + params.add(fileBaseUrlImages); + params.add(fileBaseUrlImages); + params.add(fileBaseUrlImages); + params.add(deptId); /* Optional status */ @@ -1181,8 +1239,15 @@ public class RdoService { params.add(status); } + /* Unit Officer (AEE) */ + if (isUnitOfficer) { + /* Only Temporary Requests */ + sql.append(" AND urd.application_type = 1 "); + sql.append(" AND FIND_IN_SET(sd.ward, ?) "); + params.add(wardArray); + } /* RDO → zone + ward */ - if (isRdo) { + else if (isRdo) { sql.append(" AND FIND_IN_SET(sd.zone, ?) "); sql.append(" AND FIND_IN_SET(sd.ward, ?) "); params.add(zoneArray); @@ -1212,6 +1277,7 @@ public class RdoService { List> rows = mysqlFlagPoleJdbcTemplate.queryForList(sql.toString(), params.toArray()); /* GROUP BY REFID */ + final boolean isUnitOfficerFinal = isUnitOfficer; Map> resultMap = new LinkedHashMap<>(); for (Map row : rows) { @@ -1235,21 +1301,41 @@ public class RdoService { map.put("total_cost", row.get("total_cost")); map.put("officer_status", row.get("officer_status")); map.put("officer_remarks", row.get("officer_remarks")); - map.put("others_specify_statue_material", row.get("others_specify_statue_material")); - map.put("place_of_erection", row.get("place_of_erection")); - map.put("application_type_name", row.get("application_type_name")); - map.put("application_type_id", row.get("application_type_id")); - map.put("option_name", row.get("option_name")); map.put("installation_name", row.get("installation_name")); map.put("streets", new ArrayList<>()); // Add verification questions for Permanent requests if user is ZLSC OR DRO // member - if ((isZlscMember || isDlcMember || isDro) + if (!isUnitOfficerFinal && (isZlscMember || isDlcMember || isDro) && "PERMANENT".equalsIgnoreCase((String) row.get("application_type_name"))) { map.put("verification_questions", verificationQuestions); } + boolean isTemporary = "TEMPORARY".equalsIgnoreCase((String) row.get("application_type_name")); + + map.put("patta_image_url", + (((isFinalAuthorityPermanent || isUnitOfficerFinal) && !canViewLandDocs) || isTemporary) ? null + : row.get("patta_image_url")); + map.put("affidavit_image_url", + (((isFinalAuthorityPermanent || isUnitOfficerFinal) && !canViewLandDocs) || isTemporary) ? null + : row.get("affidavit_image_url")); + map.put("ec_image_url", + (((isFinalAuthorityPermanent || isUnitOfficerFinal) && !canViewLandDocs) || isTemporary) ? null + : row.get("ec_image_url")); + map.put("fmb_sketch_url", + (((isFinalAuthorityPermanent || isUnitOfficerFinal) && !canViewLandDocs) || isTemporary) ? null + : row.get("fmb_sketch_url")); + map.put("aadhaar_image_url", + ((isFinalAuthorityPermanent || isUnitOfficerFinal) && !canViewLandDocs) ? null + : row.get("aadhaar_image_url")); + + map.put("is_unit_officer", isUnitOfficerFinal); + map.put("can_view_land_docs", canViewLandDocs); + + map.put("is_unit_officer", isUnitOfficerFinal); + map.put("can_view_land_docs", canViewLandDocs); + map.put("application_type_name", row.get("application_type_name")); + return map; }); @@ -1310,8 +1396,22 @@ public class RdoService { sd.no_of_poles, sd.no_of_statue, sd.street_cost, + sd.street_cost, sd.height, + sd.height, + + CASE WHEN urd.patta_image_path IS NOT NULL + THEN CONCAT(?,'/gcc/files',urd.patta_image_path) END AS patta_image_url, + CASE WHEN urd.affidavit_image_path IS NOT NULL + THEN CONCAT(?,'/gcc/files',urd.affidavit_image_path) END AS affidavit_image_url, + CASE WHEN urd.ec_image_path IS NOT NULL + THEN CONCAT(?,'/gcc/files',urd.ec_image_path) END AS ec_image_url, + CASE WHEN urd.fmb_sketch_path IS NOT NULL + THEN CONCAT(?,'/gcc/files',urd.fmb_sketch_path) END AS fmb_sketch_url, + CASE WHEN urd.aadhaar_image_path IS NOT NULL + THEN CONCAT(?,'/gcc/files',urd.aadhaar_image_path) END AS aadhaar_image_url, + fm.flag_material_name AS flag_material, pm.pole_material_name AS pole_material, sm.statue_material_type, @@ -1347,8 +1447,52 @@ public class RdoService { WHERE 1 = 1 """); + /* Resolve department details for permissions */ + Map officerDetails = getOfficerDetailsByUserId(gccUserId); + Integer documentsView = 0; + if (officerDetails != null && officerDetails.get("documents_view") != null) { + documentsView = (Integer) officerDetails.get("documents_view"); + } + final boolean canViewLandDocs = (documentsView != null && documentsView == 1); + + // Similar login permissions logic (if needed for admin reports, usually admins + // see all but following same pattern) + // Assuming Admin Reports might be accessed by various officers + // Determining if restrictions apply essentially like getRdoApproved... + // For Admin Reports, let's stick to the documents_view restriction mainly if + // implied? + // "getAdminReportDetails this method also and adminreports.html page also" + // Let's reuse the isUnitOfficer/FinalAuthority logic if possible, or just + // strict documents_view? + // User said: "like same logic want to implement" + // So I'll infer flags from officerDetails. + + Integer unitOff = (Integer) officerDetails.get("dlc_members"); // No, unit officer is via unit mapping + Long appUserId = getAppUserIdByGccUserId(gccUserId); + List> access = getUserAccess(appUserId); + + boolean isUnitOfficer = false; + if (access != null && !access.isEmpty()) { + String unit = (String) access.get(0).get("unit"); + String wardArray = (String) access.get(0).get("wardarray"); + if (hasValue(unit) && hasValue(wardArray)) { + isUnitOfficer = true; + } + } + + Integer finalAuthPerm = (Integer) officerDetails.get("final_authority_permanent"); + final boolean isFinalAuthorityPermanent = (finalAuthPerm != null && finalAuthPerm == 1); + final boolean isUnitOfficerFinal = isUnitOfficer; + List params = new ArrayList<>(); + /* Add base URL params for image paths */ + params.add(fileBaseUrlImages); + params.add(fileBaseUrlImages); + params.add(fileBaseUrlImages); + params.add(fileBaseUrlImages); + params.add(fileBaseUrlImages); + if (hasValue(status)) { sql.append(" AND ofb.status = ? "); params.add(status); @@ -1388,6 +1532,27 @@ public class RdoService { map.put("event_name", row.get("event_name")); map.put("total_cost", row.get("total_cost")); map.put("others_specify_statue_material", row.get("others_specify_statue_material")); + + boolean isTemporary = "TEMPORARY".equalsIgnoreCase((String) row.get("application_type_name")); + + map.put("patta_image_url", + (((isFinalAuthorityPermanent || isUnitOfficerFinal) && !canViewLandDocs) || isTemporary) ? null + : row.get("patta_image_url")); + map.put("affidavit_image_url", + (((isFinalAuthorityPermanent || isUnitOfficerFinal) && !canViewLandDocs) || isTemporary) ? null + : row.get("affidavit_image_url")); + map.put("ec_image_url", + (((isFinalAuthorityPermanent || isUnitOfficerFinal) && !canViewLandDocs) || isTemporary) ? null + : row.get("ec_image_url")); + map.put("fmb_sketch_url", + (((isFinalAuthorityPermanent || isUnitOfficerFinal) && !canViewLandDocs) || isTemporary) ? null + : row.get("fmb_sketch_url")); + map.put("aadhaar_image_url", + ((isFinalAuthorityPermanent || isUnitOfficerFinal) && !canViewLandDocs) ? null + : row.get("aadhaar_image_url")); + + map.put("can_view_land_docs", canViewLandDocs); + map.put("place_of_erection", row.get("place_of_erection")); map.put("application_type_name", row.get("application_type_name")); map.put("application_type_id", row.get("application_type_id")); diff --git a/src/main/resources/templates/modules/flagpole/adminreports.html b/src/main/resources/templates/modules/flagpole/adminreports.html index ada3984..c72a9fa 100644 --- a/src/main/resources/templates/modules/flagpole/adminreports.html +++ b/src/main/resources/templates/modules/flagpole/adminreports.html @@ -287,6 +287,21 @@ + + @@ -309,6 +324,13 @@ }); }); + $(document).on("click", ".view-doc-btn", function (e) { + e.preventDefault(); + const src = $(this).data("src"); + $("#previewImage").attr("src", src); + $("#imagePreviewModal").modal("show"); + }); + function loadTable() { //let officer_name = $("#userName").val(); @@ -528,6 +550,24 @@ $("#detailsModal").modal("show"); }); + function renderImage(label, url) { + if (!url) { + return ` +
+
${label}
+
Not Uploaded
+
`; + } + + return ` +
+
${label}
+ +
`; + } + // ----------------------------- // VIEW BUTTON → OPEN MODAL @@ -596,9 +636,8 @@
Height
-
${s.height || '-'}
-
- +
${s.height ? `${s.height} meters` : '-'}
+ `; @@ -737,6 +776,23 @@ ${historyHtml} `; + if (record.can_view_land_docs === true) { + html += ` +
+
Uploaded Documents:
+
+ ${record.application_type_name === "PERMANENT" ? ` + ${renderImage("Land Patta", record.patta_image_url)} + ${renderImage("Affidavit", record.affidavit_image_url)} + ${renderImage("EC", record.ec_image_url)} + ${renderImage("FMB Sketch", record.fmb_sketch_url)} + ` : ''} + ${renderImage("Aadhaar", record.aadhaar_image_url)} +
+
+ `; + } + $("#modalContent").html(html); } diff --git a/src/main/resources/templates/modules/flagpole/approvedandrejectedlist.html b/src/main/resources/templates/modules/flagpole/approvedandrejectedlist.html index a59b166..969931b 100644 --- a/src/main/resources/templates/modules/flagpole/approvedandrejectedlist.html +++ b/src/main/resources/templates/modules/flagpole/approvedandrejectedlist.html @@ -290,6 +290,22 @@ + + + @@ -313,6 +329,13 @@ }); }); + $(document).on("click", ".view-doc-btn", function (e) { + e.preventDefault(); + const src = $(this).data("src"); + $("#previewImage").attr("src", src); + $("#imagePreviewModal").modal("show"); + }); + function loadTable() { //let officer_name = $("#userName").val(); @@ -533,6 +556,24 @@ $("#detailsModal").modal("show"); }); + function renderImage(label, url) { + if (!url) { + return ` +
+
${label}
+
Not Uploaded
+
`; + } + + return ` +
+
${label}
+ +
`; + } + // ----------------------------- // VIEW BUTTON → OPEN MODAL @@ -601,7 +642,8 @@
Height
-
${s.height || '-'}
+
${s.height ? `${s.height} meters` : '-'}
+
@@ -742,6 +784,23 @@ ${historyHtml} `; + if (record.can_view_land_docs === true) { + html += ` +
+
Uploaded Documents:
+
+ ${record.application_type_name === "PERMANENT" ? ` + ${renderImage("Land Patta", record.patta_image_url)} + ${renderImage("Affidavit", record.affidavit_image_url)} + ${renderImage("EC", record.ec_image_url)} + ${renderImage("FMB Sketch", record.fmb_sketch_url)} + ` : ''} + ${renderImage("Aadhaar", record.aadhaar_image_url)} +
+
+ `; + } + $("#modalContent").html(html); } diff --git a/src/main/resources/templates/modules/flagpole/requestlist.html b/src/main/resources/templates/modules/flagpole/requestlist.html index 053406a..4dccb3b 100644 --- a/src/main/resources/templates/modules/flagpole/requestlist.html +++ b/src/main/resources/templates/modules/flagpole/requestlist.html @@ -305,7 +305,7 @@ - @@ -342,12 +342,10 @@ }); }); - $(document).on("click", ".zoom-img", function () { - + $(document).on("click", ".view-doc-btn", function (e) { + e.preventDefault(); const src = $(this).data("src"); - $("#previewImage").attr("src", src); - $("#imagePreviewModal").modal("show"); }); @@ -663,11 +661,11 @@ } return ` -
-
${label}
- +
+
${label}
+
`; } @@ -737,7 +735,8 @@
Height
-
${s.height || '-'}
+
${s.height ? `${s.height} meters` : '-'}
+
`; @@ -787,22 +786,24 @@ let documentsHtml = ""; - if (record.is_final_authority_perm === true) { - // 🔥 Final Authority Permanent → Hide ALL Documents (including Aadhaar) - documentsHtml = ""; - } else { - // 🔥 Normal Flow + if (record.can_view_land_docs === true) { + // Can View Land Documents documentsHtml = `
-
Land Related Documents
+
Uploaded Documents
- ${renderImage("Land Patta", record.patta_image_url)} - ${renderImage("Affidavit", record.affidavit_image_url)} - ${renderImage("EC", record.ec_image_url)} - ${renderImage("FMB Sketch", record.fmb_sketch_url)} + ${record.application_type_name === "PERMANENT" ? ` + ${renderImage("Land Patta", record.patta_image_url)} + ${renderImage("Affidavit", record.affidavit_image_url)} + ${renderImage("EC", record.ec_image_url)} + ${renderImage("FMB Sketch", record.fmb_sketch_url)} + ` : ''} ${renderImage("Aadhaar", record.aadhaar_image_url)}
`; + } else { + // Hide Land Documents + documentsHtml = ""; } // let documentsHtml = `