From 74ef270367e4b111576c803f7728a7d17f0c7c62 Mon Sep 17 00:00:00 2001 From: Hariprasath S <113695067+Hariprasath4022@users.noreply.github.com> Date: Tue, 6 Oct 2026 19:42:32 +0530 Subject: [PATCH] added street images in roadwar and roadworks dashboards --- .../service/RoadWarService.java | 22 +- .../service/WorksService.java | 21 ++ .../roadwarweb/roadwarregisterdashboard.html | 225 ++++++++++++++++++ .../modules/works/roadworksdetails.html | 203 +++++++++++++++- 4 files changed, 464 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/gcc/commissionerreview/service/RoadWarService.java b/src/main/java/com/gcc/commissionerreview/service/RoadWarService.java index ee23089..87726f9 100644 --- a/src/main/java/com/gcc/commissionerreview/service/RoadWarService.java +++ b/src/main/java/com/gcc/commissionerreview/service/RoadWarService.java @@ -959,7 +959,27 @@ public class RoadWarService { } result.put("geolocdetails", geolocdetails); + + List> inspectiondetails=roadwarjdbcTemplate.queryForList( + "select ssd.road_id,ssd.start_latitude,ssd.start_longitude, CONCAT('" + fileBaseUrl + "/gccofficialapp/files',ssd.start_img) as start_img, " + + "CONCAT('" + fileBaseUrl + "/gccofficialapp/files',csd.centre_img) as centre_img, " + + "CONCAT('" + fileBaseUrl + "/gccofficialapp/files',esd.end_img) as end_img " + + "from start_street_details ssd " + + "left join centre_street_details csd on ssd.road_id = csd.road_id " + + "left join end_street_details esd on ssd.road_id = esd.road_id " + + "where ssd.road_id = ? and ssd.isactive = 1 and ssd.isdelete = 0 limit 1 ", + roadId + ); + for (Map row : inspectiondetails) { + for (Map.Entry entry : row.entrySet()) { + if (entry.getValue() == null) { + entry.setValue(""); + } + } + } + + result.put("inspectiondetails", inspectiondetails); result.put("message", "Fetched Details Successfully"); result.put("status", true); @@ -2217,7 +2237,7 @@ public class RoadWarService { result.putAll(road); String road_ref_Id = String.valueOf(road.get("ref_id")); - System.out.println("road_ref_Id>>>>>>."+road_ref_Id); + //System.out.println("road_ref_Id>>>>>>."+road_ref_Id); List> relayingDetails = jdbcTemplate.queryForList( diff --git a/src/main/java/com/gcc/commissionerreview/service/WorksService.java b/src/main/java/com/gcc/commissionerreview/service/WorksService.java index 03ff862..40a4161 100644 --- a/src/main/java/com/gcc/commissionerreview/service/WorksService.java +++ b/src/main/java/com/gcc/commissionerreview/service/WorksService.java @@ -1696,6 +1696,27 @@ public class WorksService { } result.put("geolocdetails", geolocdetails); + + List> inspectiondetails=jdbcRoadWarTemplate.queryForList( + "select ssd.road_id,ssd.start_latitude,ssd.start_longitude, CONCAT('" + fileBaseUrl + "/gccofficialapp/files',ssd.start_img) as start_img, " + + "CONCAT('" + fileBaseUrl + "/gccofficialapp/files',csd.centre_img) as centre_img, " + + "CONCAT('" + fileBaseUrl + "/gccofficialapp/files',esd.end_img) as end_img " + + "from start_street_details ssd " + + "left join centre_street_details csd on ssd.road_id = csd.road_id " + + "left join end_street_details esd on ssd.road_id = esd.road_id " + + "where ssd.road_id = ? and ssd.isactive = 1 and ssd.isdelete = 0 limit 1 ", + roadId + ); + + for (Map row : inspectiondetails) { + for (Map.Entry entry : row.entrySet()) { + if (entry.getValue() == null) { + entry.setValue(""); + } + } + } + + result.put("inspectiondetails", inspectiondetails); result.put("message", "Fetched Details Successfully"); diff --git a/src/main/resources/templates/modules/roadwarweb/roadwarregisterdashboard.html b/src/main/resources/templates/modules/roadwarweb/roadwarregisterdashboard.html index ddcf2ce..ef7496c 100644 --- a/src/main/resources/templates/modules/roadwarweb/roadwarregisterdashboard.html +++ b/src/main/resources/templates/modules/roadwarweb/roadwarregisterdashboard.html @@ -541,6 +541,28 @@ .timeline-clickable:hover { text-decoration: underline; } + +.pdf-file-box{ + height:60px; + display:flex; + align-items:center; + justify-content:center; + border:1px solid #ced4da; + border-radius:5px; + background:#f8f9fa; + color:#495057; + font-weight:bold; + cursor:pointer; + transition:all .3s ease; + } + + .pdf-file-box:hover{ + background:#007bff; + color:#fff; + border-color:#007bff; + transform:scale(1.03); + box-shadow:0 4px 10px rgba(0,0,0,.2); + } @@ -997,6 +1019,14 @@ + +
+ +
+ +
+ +
@@ -1082,7 +1112,30 @@ + @@ -2014,7 +2067,179 @@ function populateRoadDetails(data) { renderRelayingDetails( data.relayingDetails ); + + renderWebFileDetails(data.fileDetails); + + renderInspectionDetails(data.inspectiondetails); + +} + +function renderInspectionDetails(data) { + + let container = $("#InspectionFileContainer"); + container.empty(); + + if (data && data.length > 0) { + + let inspection = data[0]; + + let html = ` +
STREET IMAGES
+
+ `; + + let url = inspection.start_img; + + // Get latitude and longitude + let latitude = inspection.start_latitude; + let longitude = inspection.start_longitude; + + // Google Maps Embed URL + let mapUrl = ''; + + if (latitude && longitude) { + + /* mapUrl = + 'https://www.google.com/maps/embed/v1/view' + + '?key=AIzaSyCi7N6uW5MZaSkd50Kzw7ax2GkMN1vjE-E' + + '¢er=' + latitude + ',' + longitude + + '&zoom=16'; */ + + mapUrl = + "https://maps.google.com/maps?q=" + + latitude + "," + longitude + + "&z=18&output=embed"; + } + + + if (url) { + + let extension = url.split('?')[0].split('.').pop().toLowerCase(); + + if (extension === "pdf") { + + html += ` +
+
+ PDF File +
+
+ `; + + } else { + + html += ` +
+ +
+ `; + } + } + + + if (mapUrl) { + + html += ` +
+ + + +
+ `; + } + + html += `
`; + + container.html(html); + } +} + +function renderWebFileDetails(data) { + + let container =$("#viewFileContainer"); + + container.empty(); + + if (data && data.length > 0) { + + let html = ` +
ROADWAR REGISTER FILES
+
+ `; + + $.each(data, function(index, file) { + + let url = file.file_url; + let extension = url.split('.').pop().toLowerCase(); + + if (extension === "pdf") { + + html += ` +
+ +
+ + PDF File ${index + 1} + +
+ +
+ `; + + } else { + + html += ` +
+ + + +
+ `; + } + + }); + + html += "
"; + + container.html(html); + } + +} +function showPreview(fileUrl) { + + let extension = fileUrl.split('.').pop().toLowerCase(); + + if (extension === "pdf") { + + $("#previewImage").hide(); + $("#previewPdf").show(); + + $("#previewPdf").attr("src", fileUrl); + + } else { + + $("#previewPdf").hide(); + $("#previewImage").show(); + + $("#previewImage").attr("src", fileUrl); + } + $("#imagePreviewModal").modal("show"); } function valueOrDash(value, defaultValue = "-") { diff --git a/src/main/resources/templates/modules/works/roadworksdetails.html b/src/main/resources/templates/modules/works/roadworksdetails.html index 54c9600..9392840 100644 --- a/src/main/resources/templates/modules/works/roadworksdetails.html +++ b/src/main/resources/templates/modules/works/roadworksdetails.html @@ -609,27 +609,40 @@ font-weight: bold; .road-image-grid { display: grid; - grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); + grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 15px; + width: 100%; } -.road-image-card { +.road-image-card,.road-map-card { border: 1px solid #e5e7eb; border-radius: 8px; overflow: hidden; background: #f8f9fa; - height: 180px; - position: relative; + min-height: 180px; + /* position: relative; */ +} + +.road-image-card { + display: flex; + flex-direction: column; } .road-war-image { width: 100%; - height: 100%; + height: 180px; object-fit: cover; display: block; cursor: pointer; } +/* .road-image-label { + padding: 8px; + text-align: center; + font-size: 13px; + font-weight: 600; +} */ + .road-pdf-container { width: 100%; height: 100%; @@ -658,6 +671,16 @@ font-weight: bold; margin-top: 8px; font-size: 12px; } +.road-map-card { + min-width: 0; +} + +.road-war-map { + width: 100%; + height: 180px; + display: block; + border: 0; +} @@ -1578,6 +1601,9 @@ font-weight: bold; const fileDetails = response.fileDetails || []; + + const inspectiondetails = + response.inspectiondetails || []; let html = ` @@ -1871,6 +1897,10 @@ font-weight: bold; html += renderRoadWarImages( fileDetails ); + + html += renderInspectionImages( + inspectiondetails + ); $('#roadWarContainer').html(html); @@ -2027,7 +2057,7 @@ font-weight: bold;
- UPLOADED IMAGES / DOCUMENTS + ROADWAR REGISTER FILES
`; @@ -2148,6 +2178,167 @@ font-weight: bold; return html; } + + function renderInspectionImages(inspectiondetails) { + + let html = ` +
+ +
+ STREET IMAGES +
+ `; + + // Check inspection details + if (!inspectiondetails || inspectiondetails.length === 0) { + + html += ` +
+ No image +
+ `; + + html += `
`; + + return html; + } + + // Get single inspection object + const inspection = inspectiondetails[0]; + + // Only take start_img + const fileUrl = inspection.start_img; + + // Get latitude and longitude + let latitude = inspection.start_latitude; + let longitude = inspection.start_longitude; + + let mapUrl = ''; + + if (latitude && longitude) { + + mapUrl = + "https://maps.google.com/maps?q=" + + latitude + "," + longitude + + "&z=18&output=embed"; + } + + // Check start image + if (!fileUrl || fileUrl.trim() === "") { + + html += ` +
+ No image +
+ `; + + html += `
`; + + return html; + } + + // Remove query parameters before checking extension + const cleanUrl = fileUrl.split('?')[0].toLowerCase(); + + const isPdf = cleanUrl.endsWith('.pdf'); + + const isImage = + cleanUrl.endsWith('.jpg') || + cleanUrl.endsWith('.jpeg') || + cleanUrl.endsWith('.png'); + + html += ` +
+ `; + + + // ========================= + // IMAGE + // ========================= + + if (isImage) { + + html += ` + +
+ + Start Image + +
+ + `; + } + + + // ========================= + // PDF + // ========================= + + else if (isPdf) { + + html += ` + +
+ +
+ + + +
+ Start Image +
+ + + + + View PDF + + + +
+ +
+ + `; + } + + if (mapUrl) { + + html += ` +
+ + + +
+ `; + } + + + html += ` +
+ `; + + html += ` + + `; + + return html; + }