Browse Source

changed foodscheme report

master
AJITHKUMAR12 10 months ago
parent
commit
ca7fddf552
  1. 19
      .mvn/wrapper/maven-wrapper.properties
  2. 220
      hs_err_pid29312.log
  3. 60
      src/main/java/com/gcc/commissionerreview/configuration/AppConfig.java
  4. 123
      src/main/java/com/gcc/commissionerreview/configuration/DataSourceConfig.java
  5. 213
      src/main/java/com/gcc/commissionerreview/controller/FoodSchemeController.java
  6. 16
      src/main/java/com/gcc/commissionerreview/controller/MainController.java
  7. 1865
      src/main/java/com/gcc/commissionerreview/service/FoodSchemeService.java
  8. 4
      src/main/resources/application-dev.properties
  9. 430
      src/main/resources/templates/modules/food_scheme/driverreport.html
  10. 706
      src/main/resources/templates/modules/food_scheme/feedbackreport.html
  11. 1520
      src/main/resources/templates/modules/food_scheme/foodschemereport.html

19
.mvn/wrapper/maven-wrapper.properties

@ -1,19 +0,0 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
wrapperVersion=3.3.2
distributionType=only-script
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip

220
hs_err_pid29312.log

@ -0,0 +1,220 @@
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map 123731968 bytes for G1 virtual space
# Possible reasons:
# The system is out of physical RAM or swap space
# The process is running with CompressedOops enabled, and the Java Heap may be blocking the growth of the native heap
# Possible solutions:
# Reduce memory load on the system
# Increase physical memory or swap space
# Check if swap backing store is full
# Decrease Java heap size (-Xmx/-Xms)
# Decrease number of Java threads
# Decrease Java thread stack sizes (-Xss)
# Set larger code cache with -XX:ReservedCodeCacheSize=
# JVM is running with Unscaled Compressed Oops mode in which the Java heap is
# placed in the first 4GB address space. The Java Heap base address is the
# maximum limit for the native heap growth. Please use -XX:HeapBaseMinAddress
# to set the Java Heap base and to place the Java Heap above 4GB virtual address.
# This output file may be truncated or incomplete.
#
# Out of Memory Error (os_windows.cpp:3548), pid=29312, tid=28704
#
# JRE version: (17.0.12+8) (build )
# Java VM: Java HotSpot(TM) 64-Bit Server VM (17.0.12+8-LTS-286, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, windows-amd64)
# No core dump will be written. Minidumps are not enabled by default on client versions of Windows
#
--------------- S U M M A R Y ------------
Command Line: -XX:+ShowCodeDetailsInExceptionMessages com.gcc.commissionerreview.DashboardserviceApplication
Host: AMD Ryzen 3 5300U with Radeon Graphics , 8 cores, 7G, Windows 11 , 64 bit Build 22621 (10.0.22621.5415)
Time: Mon Dec 1 16:30:57 2025 India Standard Time elapsed time: 0.029072 seconds (0d 0h 0m 0s)
--------------- T H R E A D ---------------
Current thread (0x000001e9c9095530): JavaThread "Unknown thread" [_thread_in_vm, id=28704, stack(0x00000017b7800000,0x00000017b7900000)]
Stack: [0x00000017b7800000,0x00000017b7900000]
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V [jvm.dll+0x67a04a]
V [jvm.dll+0x7da4ed]
V [jvm.dll+0x7dbe33]
V [jvm.dll+0x7dc4a3]
V [jvm.dll+0x24508f]
V [jvm.dll+0x677089]
V [jvm.dll+0x66bd32]
V [jvm.dll+0x301fa6]
V [jvm.dll+0x309546]
V [jvm.dll+0x359d2e]
V [jvm.dll+0x359f5f]
V [jvm.dll+0x2d9078]
V [jvm.dll+0x2d9fe4]
V [jvm.dll+0x7aca21]
V [jvm.dll+0x367591]
V [jvm.dll+0x78b999]
V [jvm.dll+0x3ec83f]
V [jvm.dll+0x3ee471]
C [jli.dll+0x5297]
C [ucrtbase.dll+0x29333]
C [KERNEL32.DLL+0x1259d]
C [ntdll.dll+0x5af78]
--------------- P R O C E S S ---------------
Threads class SMR info:
_java_thread_list=0x00007ffd7e0b7a18, length=0, elements={
}
Java Threads: ( => current thread )
Other Threads:
0x000001e9c90f3fe0 GCTaskThread "GC Thread#0" [stack: 0x00000017b7900000,0x00000017b7a00000] [id=13928]
0x000001e9c91049c0 ConcurrentGCThread "G1 Main Marker" [stack: 0x00000017b7a00000,0x00000017b7b00000] [id=21488]
0x000001e9c91053d0 ConcurrentGCThread "G1 Conc#0" [stack: 0x00000017b7b00000,0x00000017b7c00000] [id=26372]
[error occurred during error reporting (printing all threads), id 0xc0000005, EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007ffd7d8e9b67]
VM state: not at safepoint (not fully initialized)
VM Mutex/Monitor currently owned by a thread: ([mutex/lock_event])
[0x000001e9c9090970] Heap_lock - owner thread: 0x000001e9c9095530
Heap address: 0x000000008ac00000, size: 1876 MB, Compressed Oops mode: 32-bit
CDS archive(s) mapped at: [0x0000000000000000-0x0000000000000000-0x0000000000000000), size 0, SharedBaseAddress: 0x0000000800000000, ArchiveRelocationMode: 1.
Narrow klass base: 0x0000000000000000, Narrow klass shift: 0, Narrow klass range: 0x0
GC Precious Log:
<Empty>
Heap:
garbage-first heap total 0K, used 0K [0x000000008ac00000, 0x0000000100000000)
region size 1024K, 0 young (0K), 0 survivors (0K)
[error occurred during error reporting (printing heap information), id 0xc0000005, EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007ffd7dcd3859]
GC Heap History (0 events):
No events
Deoptimization events (0 events):
No events
Classes unloaded (0 events):
No events
Classes redefined (0 events):
No events
Internal exceptions (0 events):
No events
VM Operations (0 events):
No events
Events (1 events):
Event: 0.014 Loaded shared library C:\Program Files\Java\jdk-17\bin\java.dll
Dynamic libraries:
0x00007ff678e90000 - 0x00007ff678ea0000 C:\Program Files\Java\jdk-17\bin\java.exe
0x00007ffe2f0d0000 - 0x00007ffe2f2e8000 C:\windows\SYSTEM32\ntdll.dll
0x00007ffe2e0f0000 - 0x00007ffe2e1b4000 C:\windows\System32\KERNEL32.DLL
0x00007ffe2c460000 - 0x00007ffe2c833000 C:\windows\System32\KERNELBASE.dll
0x00007ffe2cc60000 - 0x00007ffe2cd71000 C:\windows\System32\ucrtbase.dll
0x00007ffd7f2e0000 - 0x00007ffd7f2fb000 C:\Program Files\Java\jdk-17\bin\VCRUNTIME140.dll
0x00007ffd7f280000 - 0x00007ffd7f299000 C:\Program Files\Java\jdk-17\bin\jli.dll
0x00007ffe2ec00000 - 0x00007ffe2ecb1000 C:\windows\System32\ADVAPI32.dll
0x00007ffe2efe0000 - 0x00007ffe2f087000 C:\windows\System32\msvcrt.dll
0x00007ffe2e7b0000 - 0x00007ffe2e858000 C:\windows\System32\sechost.dll
0x00007ffe2c1f0000 - 0x00007ffe2c218000 C:\windows\System32\bcrypt.dll
0x00007ffe2ecc0000 - 0x00007ffe2edd8000 C:\windows\System32\RPCRT4.dll
0x00007ffe2d210000 - 0x00007ffe2d3c2000 C:\windows\System32\USER32.dll
0x00007ffe2c8c0000 - 0x00007ffe2c8e6000 C:\windows\System32\win32u.dll
0x00007ffe2ee00000 - 0x00007ffe2ee29000 C:\windows\System32\GDI32.dll
0x00007ffe2c220000 - 0x00007ffe2c33b000 C:\windows\System32\gdi32full.dll
0x00007ffe2c3c0000 - 0x00007ffe2c45a000 C:\windows\System32\msvcp_win.dll
0x00007ffe12620000 - 0x00007ffe128bc000 C:\windows\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.22621.6060_none_2712eda17382d24b\COMCTL32.dll
0x00007ffe22db0000 - 0x00007ffe22dba000 C:\windows\SYSTEM32\VERSION.dll
0x00007ffe2e0a0000 - 0x00007ffe2e0d1000 C:\windows\System32\IMM32.DLL
0x00007ffd7f2b0000 - 0x00007ffd7f2bc000 C:\Program Files\Java\jdk-17\bin\vcruntime140_1.dll
0x00007ffd7e7a0000 - 0x00007ffd7e82e000 C:\Program Files\Java\jdk-17\bin\msvcp140.dll
0x00007ffd7d600000 - 0x00007ffd7e1e0000 C:\Program Files\Java\jdk-17\bin\server\jvm.dll
0x00007ffe2de60000 - 0x00007ffe2de68000 C:\windows\System32\PSAPI.DLL
0x00007ffd7f270000 - 0x00007ffd7f279000 C:\windows\SYSTEM32\WSOCK32.dll
0x00007ffe2eea0000 - 0x00007ffe2ef11000 C:\windows\System32\WS2_32.dll
0x00007ffe27b70000 - 0x00007ffe27ba4000 C:\windows\SYSTEM32\WINMM.dll
0x00007ffe2b1d0000 - 0x00007ffe2b1e8000 C:\windows\SYSTEM32\kernel.appcore.dll
0x00007ffd7f260000 - 0x00007ffd7f26a000 C:\Program Files\Java\jdk-17\bin\jimage.dll
0x00007ffe242e0000 - 0x00007ffe24513000 C:\windows\SYSTEM32\DBGHELP.DLL
0x00007ffe2e860000 - 0x00007ffe2ebf1000 C:\windows\System32\combase.dll
0x00007ffe2d3d0000 - 0x00007ffe2d4a8000 C:\windows\System32\OLEAUT32.dll
0x00007ffe13910000 - 0x00007ffe13942000 C:\windows\SYSTEM32\dbgcore.DLL
0x00007ffe2c340000 - 0x00007ffe2c3bb000 C:\windows\System32\bcryptPrimitives.dll
0x00007ffd7f230000 - 0x00007ffd7f255000 C:\Program Files\Java\jdk-17\bin\java.dll
dbghelp: loaded successfully - version: 4.0.5 - missing functions: none
symbol engine: initialized successfully - sym options: 0x614 - pdb path: .;C:\Program Files\Java\jdk-17\bin;C:\windows\SYSTEM32;C:\windows\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.22621.6060_none_2712eda17382d24b;C:\Program Files\Java\jdk-17\bin\server
VM Arguments:
jvm_args: -XX:+ShowCodeDetailsInExceptionMessages
java_command: com.gcc.commissionerreview.DashboardserviceApplication
java_class_path (initial): C:\Commisoner review may 2025\commissioner_review_1_may2025\target\classes;C:\Users\Ajith\.m2\repository\org\springframework\boot\spring-boot-starter-data-jdbc\3.4.5\spring-boot-starter-data-jdbc-3.4.5.jar;C:\Users\Ajith\.m2\repository\org\springframework\boot\spring-boot-starter-jdbc\3.4.5\spring-boot-starter-jdbc-3.4.5.jar;C:\Users\Ajith\.m2\repository\com\zaxxer\HikariCP\5.1.0\HikariCP-5.1.0.jar;C:\Users\Ajith\.m2\repository\org\springframework\spring-jdbc\6.2.6\spring-jdbc-6.2.6.jar;C:\Users\Ajith\.m2\repository\org\springframework\data\spring-data-jdbc\3.4.5\spring-data-jdbc-3.4.5.jar;C:\Users\Ajith\.m2\repository\org\springframework\data\spring-data-relational\3.4.5\spring-data-relational-3.4.5.jar;C:\Users\Ajith\.m2\repository\org\springframework\data\spring-data-commons\3.4.5\spring-data-commons-3.4.5.jar;C:\Users\Ajith\.m2\repository\org\springframework\spring-tx\6.2.6\spring-tx-6.2.6.jar;C:\Users\Ajith\.m2\repository\org\springframework\spring-context\6.2.6\spring-context-6.2.6.jar;C:\Users\Ajith\.m2\repository\org\springframework\spring-beans\6.2.6\spring-beans-6.2.6.jar;C:\Users\Ajith\.m2\repository\org\slf4j\slf4j-api\2.0.17\slf4j-api-2.0.17.jar;C:\Users\Ajith\.m2\repository\org\springframework\boot\spring-boot-starter-thymeleaf\3.4.5\spring-boot-starter-thymeleaf-3.4.5.jar;C:\Users\Ajith\.m2\repository\org\springframework\boot\spring-boot-starter\3.4.5\spring-boot-starter-3.4.5.jar;C:\Users\Ajith\.m2\repository\org\springframework\boot\spring-boot-starter-logging\3.4.5\spring-boot-starter-logging-3.4.5.jar;C:\Users\Ajith\.m2\repository\ch\qos\logback\logback-classic\1.5.18\logback-classic-1.5.18.jar;C:\Users\Ajith\.m2\repository\ch\qos\logback\logback-core\1.5.18\logback-core-1.5.18.jar;C:\Users\Ajith\.m2\repository\org\apache\logging\log4j\log4j-to-slf4j\2.24.3\log4j-to-slf4j-2.24.3.jar;C:\Users\Ajith\.m2\repository\org\apache\logging\log4j\log4j-api\2.24.3\log4j-api-2.24.3.jar;C:\Users\Ajith\.m2\repository\org\slf4j\jul-t
Launcher Type: SUN_STANDARD
[Global flags]
intx CICompilerCount = 4 {product} {ergonomic}
uint ConcGCThreads = 2 {product} {ergonomic}
uint G1ConcRefinementThreads = 8 {product} {ergonomic}
size_t G1HeapRegionSize = 1048576 {product} {ergonomic}
uintx GCDrainStackTargetSize = 64 {product} {ergonomic}
size_t InitialHeapSize = 123731968 {product} {ergonomic}
size_t MarkStackSize = 4194304 {product} {ergonomic}
size_t MaxHeapSize = 1967128576 {product} {ergonomic}
size_t MinHeapDeltaBytes = 1048576 {product} {ergonomic}
size_t MinHeapSize = 8388608 {product} {ergonomic}
uintx NonNMethodCodeHeapSize = 5839372 {pd product} {ergonomic}
uintx NonProfiledCodeHeapSize = 122909434 {pd product} {ergonomic}
uintx ProfiledCodeHeapSize = 122909434 {pd product} {ergonomic}
uintx ReservedCodeCacheSize = 251658240 {pd product} {ergonomic}
bool SegmentedCodeCache = true {product} {ergonomic}
bool ShowCodeDetailsInExceptionMessages = true {manageable} {command line}
size_t SoftMaxHeapSize = 1967128576 {manageable} {ergonomic}
bool UseCompressedClassPointers = true {product lp64_product} {ergonomic}
bool UseCompressedOops = true {product lp64_product} {ergonomic}
bool UseG1GC = true {product} {ergonomic}
bool UseLargePagesIndividualAllocation = false {pd product} {ergonomic}
Logging:
Log output configuration:
#0: stdout all=warning uptime,level,tags
#1: stderr all=off uptime,level,tags
Environment Variables:
PATH=c:\Users\Ajith\AppData\Roaming\Code\User\globalStorage\github.copilot-chat\debugCommand;c:\Users\Ajith\AppData\Roaming\Code\User\globalStorage\github.copilot-chat\copilotCli;C:\Program Files\Common Files\Oracle\Java\javapath;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\windows\System32\OpenSSH\;C:\Program Files\Docker\Docker\resources\bin;C:\Program Files\Java\jdk-17\bin;C:\Program Files\nodejs\;C:\Program Files (x86)\Microsoft SQL Server\160\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\160\Tools\Binn\;C:\Program Files\Microsoft SQL Server\160\Tools\Binn\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\;C:\Program Files\Microsoft SQL Server\160\DTS\Binn\;C:\Program Files\Apache\Maven\apache-maven-3.9.11\bin;C:\Users\Ajith\AppData\Local\Programs\Python\Python313\Scripts\;C:\Users\Ajith\AppData\Local\Programs\Python\Python313\;C:\Users\Ajith\AppData\Local\Programs\Python\Python312\Scripts\;C:\Users\Ajith\AppData\Local\Programs\Python\Python312\;C:\Users\Ajith\AppData\Local\Programs\Python\Launcher\;C:\Users\Ajith\AppData\Local\Microsoft\WindowsApps;C:\Users\Ajith\AppData\Local\Programs\Git\cmd;C:\Users\Ajith\Desktop;C:\Users\Ajith\Desktop\demo\terraform;C:\Users\Ajith\AppData\Roaming\npm;C:\Users\Ajith\AppData\Local\GitHubDesktop\bin;C:\Users\Ajith\AppData\Local\Programs\Microsoft VS Code\bin;c:\Users\Ajith\.vscode\extensions\vscjava.vscode-java-debug-0.58.3\bundled\scripts\noConfigScripts
USERNAME=Ajith
LANG=en_US.UTF-8
OS=Windows_NT
PROCESSOR_IDENTIFIER=AMD64 Family 23 Model 104 Stepping 1, AuthenticAMD
--------------- S Y S T E M ---------------
OS:
Windows 11 , 64 bit Build 22621 (10.0.22621.5415)
OS uptime: 4 days 23:37 hours
Hyper-V role detected
CPU: total 8 (initial active 8) (8 cores per cpu, 2 threads per core) family 23 model 104 stepping 1 microcode 0x0, cx8, cmov, fxsr, ht, mmx, 3dnowpref, sse, sse2, sse3, ssse3, sse4a, sse4.1, sse4.2, popcnt, lzcnt, tsc, tscinvbit, avx, avx2, aes, clmul, bmi1, bmi2, adx, sha, fma, vzeroupper, clflush, clflushopt, hv
Memory: 4k page, system-wide physical 7502M (201M free)
TotalPageFile size 30030M (AvailPageFile size 94M)
current process WorkingSet (physical memory assigned to process): 11M, peak: 11M
current process commit charge ("private bytes"): 60M, peak: 178M
vm_info: Java HotSpot(TM) 64-Bit Server VM (17.0.12+8-LTS-286) for windows-amd64 JRE (17.0.12+8-LTS-286), built on Jun 5 2024 06:46:59 by "mach5one" with MS VC++ 17.6 (VS2022)
END.

60
src/main/java/com/gcc/commissionerreview/configuration/AppConfig.java

@ -0,0 +1,60 @@
package com.gcc.commissionerreview.configuration;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;
@Component
@ConfigurationProperties(prefix = "app")
public class AppConfig {
@Bean
public RestTemplate restTemplate() {
return new RestTemplate();
}
private String title;
private String baseUrl;
private String getOtpUrl;
private String erpUrl;
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getBaseUrl() {
return baseUrl;
}
public void setBaseUrl(String baseUrl) {
this.baseUrl = baseUrl;
}
public String getGetOtpUrl() {
return getOtpUrl;
}
public void setGetOtpUrl(String getOtpUrl) {
this.getOtpUrl = getOtpUrl;
}
public String getErpUrl() {
return erpUrl;
}
public void setErpUrl(String erpUrl) {
this.erpUrl = erpUrl;
}
}

123
src/main/java/com/gcc/commissionerreview/configuration/DataSourceConfig.java

@ -1,6 +1,5 @@
package com.gcc.commissionerreview.configuration;
import com.zaxxer.hikari.HikariConfig;
import com.zaxxer.hikari.HikariDataSource;
@ -19,66 +18,74 @@ import javax.sql.DataSource;
@Configuration
@EnableTransactionManagement
public class DataSourceConfig {
// private static String host = "localhost:3306";
// private static String dbpassword = "root";
private static String host = "gcc-facial-db-instance-1.cf48eqcciziq.ap-south-1.rds.amazonaws.com:3306";
private static String dbpassword = "gcc-facial-password";
public static class MyDataSourceConfig {
@Primary
@Bean(name = "mydatasource")
public DataSource MyDataSource() {
// DriverManagerDataSource dataSource = new DriverManagerDataSource();
// dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
// dataSource.setUrl("jdbc:mysql://"+host+"/dashboard_service");
// dataSource.setUsername("root");
// dataSource.setPassword("root");
// return dataSource;
DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setUrl("jdbc:mysql://"+host+"/commissioner_review");
//dataSource.setUrl("jdbc:mysql://"+host+"/dashboard_service");
dataSource.setUsername("root");
dataSource.setPassword(dbpassword);
dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
return dataSource;
}
@Primary
@Bean(name = "myTransactionManager")
public PlatformTransactionManager myTransactionManager(@Qualifier("mydatasource") DataSource dataSource) {
return new DataSourceTransactionManager(dataSource);
}
}
////////////////////////////// Domestic Waste Management ////////////////////////
@Bean(name = "mysqlSofaBedCollectionDataSource")
public DataSource mysqlSofaBedCollectionDataSource() {
DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
dataSource.setUrl("jdbc:mysql://"+host+"/domestic_waste_management");
dataSource.setUsername("root");
dataSource.setPassword(dbpassword);
return dataSource;
}
private static String host = "localhost:3306";
private static String dbpassword = "root";
// private static String host =
// "gcc-facial-db-instance-1.cf48eqcciziq.ap-south-1.rds.amazonaws.com:3306";
// private static String dbpassword = "gcc-facial-password";
public static class MyDataSourceConfig {
@Primary
@Bean(name = "mydatasource")
public DataSource MyDataSource() {
// DriverManagerDataSource dataSource = new DriverManagerDataSource();
// dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
// dataSource.setUrl("jdbc:mysql://"+host+"/dashboard_service");
// dataSource.setUsername("root");
// dataSource.setPassword("root");
// return dataSource;
//////////////////////////////ORACLE ////////////////////////
@Bean(name = "oracleDataSource")
public DataSource oracleDataSource() {
DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName("oracle.jdbc.OracleDriver");
dataSource.setUrl("jdbc:oracle:thin:@10.1.0.14:1521:chncorp");
dataSource.setUsername("FAS");
dataSource.setPassword("FAS");
dataSource.setUrl("jdbc:mysql://" + host + "/commissioner_review");
// dataSource.setUrl("jdbc:mysql://"+host+"/dashboard_service");
dataSource.setUsername("root");
dataSource.setPassword(dbpassword);
dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
return dataSource;
}
}
@Primary
@Bean(name = "myTransactionManager")
public PlatformTransactionManager myTransactionManager(@Qualifier("mydatasource") DataSource dataSource) {
return new DataSourceTransactionManager(dataSource);
}
}
////////////////////////////// Domestic Waste Management
////////////////////////////// ////////////////////////
@Bean(name = "mysqlSofaBedCollectionDataSource")
public DataSource mysqlSofaBedCollectionDataSource() {
DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
dataSource.setUrl("jdbc:mysql://" + host + "/domestic_waste_management");
dataSource.setUsername("root");
dataSource.setPassword(dbpassword);
return dataSource;
}
////////////////////////////// Food distribution ////////////////////////
@Bean(name = "mysqlFoodDistributionDataSource")
public DataSource mysqlFoodDistributionDataSource() {
DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
dataSource.setUrl("jdbc:mysql://" + host + "/gcc_food_distribution");
dataSource.setUsername("root");
dataSource.setPassword(dbpassword);
return dataSource;
}
////////////////////////////// ORACLE ////////////////////////
@Bean(name = "oracleDataSource")
public DataSource oracleDataSource() {
DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName("oracle.jdbc.OracleDriver");
dataSource.setUrl("jdbc:oracle:thin:@10.1.0.14:1521:chncorp");
dataSource.setUsername("FAS");
dataSource.setPassword("FAS");
return dataSource;
}
}

213
src/main/java/com/gcc/commissionerreview/controller/FoodSchemeController.java

@ -0,0 +1,213 @@
package com.gcc.commissionerreview.controller;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.gcc.commissionerreview.service.FoodSchemeService;
@RestController
@RequestMapping("/commissionerreview/api")
public class FoodSchemeController {
@Autowired
private FoodSchemeService foodSchemeService;
/*
* @GetMapping("/feedback-summary")
* public List<Map<String, Object>> getFeedbackSummary(@RequestParam String
* date) {
* return feedbackService.getFeedbackSummary(date);
* }
*
* @GetMapping("/driver-report")
* public List<Map<String, Object>> getDriverReport(@RequestParam String date) {
* //System.out.println("Date received in controller: " + date);
* return feedbackService.getDriverReport(date);
* }
*/
// ak
@GetMapping("/feedback-summary")
public ResponseEntity<?> getFeedbackSummary(@RequestParam String date) {
try {
List<Map<String, Object>> data = foodSchemeService.getFeedbackSummary(date);
Map<String, Object> response = new HashMap<>();
response.put("status", "success");
response.put("date", date);
response.put("data", data);
return ResponseEntity.ok(response);
} catch (Exception e) {
Map<String, Object> error = new HashMap<>();
error.put("status", "error");
error.put("message", e.getMessage());
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(error);
}
}
// ak
@GetMapping("/zone-details")
public ResponseEntity<?> getZoneDetails(
@RequestParam int qid,
@RequestParam String column,
@RequestParam String date) {
try {
List<Map<String, Object>> data = foodSchemeService.getZoneDetails(qid, column, date);
Map<String, Object> response = new HashMap<>();
response.put("status", "success");
response.put("date", date);
response.put("data", data);
return ResponseEntity.ok(response);
} catch (Exception e) {
Map<String, Object> error = new HashMap<>();
error.put("status", "error");
error.put("message", e.getMessage());
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(error);
}
}
@GetMapping("/ward-details")
public ResponseEntity<?> getWardDetails(
@RequestParam int qid,
@RequestParam String column,
@RequestParam String date,
@RequestParam int zoneId) {
return ResponseEntity.ok(Map.of(
"status", "success",
"date", date,
"data", foodSchemeService.getWardDetails(qid, column, date, zoneId)));
}
@GetMapping("/driver-report")
public ResponseEntity<?> getDriverReport(@RequestParam String date, @RequestParam(required = false) Integer zone) {
try {
List<Map<String, Object>> data = foodSchemeService.getDriverReport(date, zone);
Map<String, Object> response = new HashMap<>();
response.put("status", "success");
response.put("date", date);
response.put("data", data);
return ResponseEntity.ok(response);
} catch (Exception e) {
Map<String, Object> error = new HashMap<>();
error.put("status", "error");
error.put("message", e.getMessage());
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(error);
}
}
@GetMapping("/zones")
public ResponseEntity<?> getZones() {
List<Map<String, Object>> data = foodSchemeService.getZones();
return ResponseEntity.ok(Map.of("data", data));
}
/// yogi
@GetMapping("/abstract")
public ResponseEntity<?> getAbstractReport(@RequestParam String date) {
try {
List<Map<String, Object>> report = foodSchemeService.getAbstractReport(date);
// System.out.println("report : " + report);
Map<String, Object> response = new HashMap<>();
response.put("status", "success");
response.put("date", date);
response.put("data", report);
return ResponseEntity.ok(response);
} catch (Exception e) {
Map<String, Object> error = new HashMap<>();
error.put("status", "error");
error.put("message", e.getMessage());
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(error);
}
}
@GetMapping("/zoneandshiftbasedreport")
public ResponseEntity<?> getZoneWiseShiftBasedReport(@RequestParam String date, @RequestParam Integer shiftId) {
try {
List<Map<String, Object>> report = foodSchemeService.getZoneWiseShiftBasedReport(date, shiftId);
// System.out.println("report : " + report);
Map<String, Object> response = new HashMap<>();
response.put("status", "success");
response.put("date", date);
response.put("data", report);
return ResponseEntity.ok(response);
} catch (Exception e) {
Map<String, Object> error = new HashMap<>();
error.put("status", "error");
error.put("message", e.getMessage());
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(error);
}
}
@GetMapping("/wardwiseShiftReport")
public ResponseEntity<?> getWardWiseShiftReport(
@RequestParam String date,
@RequestParam Integer shiftId,
@RequestParam Integer zone) {
try {
List<Map<String, Object>> data = foodSchemeService.getWardWiseShiftReport(shiftId, zone, date);
Map<String, Object> response = new HashMap<>();
response.put("status", "success");
response.put("zone", zone);
response.put("data", data);
return ResponseEntity.ok(response);
} catch (Exception e) {
Map<String, Object> error = new HashMap<>();
error.put("status", "error");
error.put("message", e.getMessage());
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(error);
}
}
@GetMapping("/wardlocationreport")
public ResponseEntity<?> getWardLocationReport(@RequestParam String date) {
try {
List<Map<String, Object>> report = foodSchemeService.getWardLocationWiseReport(date);
Map<String, Object> response = new HashMap<>();
response.put("status", "success");
response.put("date", date);
response.put("data", report);
return ResponseEntity.ok(response);
} catch (Exception e) {
Map<String, Object> error = new HashMap<>();
error.put("status", "error");
error.put("message", e.getMessage());
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(error);
}
}
}

16
src/main/java/com/gcc/commissionerreview/controller/MainController.java

@ -1,7 +1,7 @@
package com.gcc.commissionerreview.controller;
import org.springframework.ui.Model;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
@ -163,6 +163,20 @@ public class MainController {
public String viewpendingdetails(Model model) {
return "modules/sofa_bed/pendingdetails";
}
@GetMapping("/foodSchemeReport")
public String foodSchemereport(Model model) {
return "modules/food_scheme/foodschemereport";
}
@GetMapping("/feedbackreport")
public String feedbackreport(Model model) {
return "modules/food_scheme/feedbackreport";
}
@GetMapping("/driverreport")
public String driverreport(Model model) {
return "modules/food_scheme/driverreport";
}
}

1865
src/main/java/com/gcc/commissionerreview/service/FoodSchemeService.java
File diff suppressed because it is too large
View File

4
src/main/resources/application-dev.properties

@ -13,6 +13,4 @@ server.port=8078
#secondary.datasource.username=FAS
#secondary.datasource.password=FAS
#secondary.datasource.driver-class-name=oracle.jdbc.OracleDriver
fileBaseUrl=https://gccservices.in

430
src/main/resources/templates/modules/food_scheme/driverreport.html

@ -0,0 +1,430 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<title>Food Scheme Operations Dashboard</title>
<!-- Bootstrap 5 CSS -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet">
<!-- DataTables CSS -->
<link href="https://cdn.datatables.net/1.13.4/css/jquery.dataTables.min.css" rel="stylesheet" />
<link href="https://cdn.datatables.net/buttons/2.3.6/css/buttons.dataTables.min.css" rel="stylesheet" />
<style>
table.dataTable th,
table.dataTable td {
text-align: center;
vertical-align: middle;
border: 1px solid #000;
}
table.dataTable th {
background-color: #003366 !important;
color: white;
}
.dataTables_wrapper .dt-buttons {
margin-bottom: 10px;
}
.dataTables_filter {
margin-bottom: 25px;
/* adjust as needed */
}
.page-header-title h4 {
margin: 20px 0;
text-align: center;
}
#zoneDetailsTable_wrapper .dataTables_scrollBody {
border: none !important;
}
#zoneDetailsTable td,
#zoneDetailsTable th {
vertical-align: middle;
text-align: center;
white-space: nowrap;
}
.time-column {
white-space: nowrap !important;
}
</style>
</head>
<body>
<div class="page-header-title">
<h4>Food Scheme Report</h4>
</div>
<div class="container mt-4">
<div class="card p-3 shadow-sm">
<div class="d-flex justify-content-between">
<h5><strong>Driver Logistics Report</strong></h5>
<!--<div class="d-flex gap-2">
<input type="date" id="driverDate" class="form-control" style="width: 160px;">
<button class="btn btn-primary" onclick="loadDriverReport()">Load Report</button>
<button class="btn btn-success" onclick="goToSchemereport()">
Back
</button>
</div>-->
<div class="d-flex gap-3 align-items-end">
<!-- DATE FIELD -->
<div class="d-flex flex-column">
<label class="form-label fw-bold mb-1">Date</label>
<input type="date" id="driverDate" class="form-control" style="width: 160px;">
</div>
<!-- ZONE FIELD -->
<div class="d-flex flex-column">
<label class="form-label fw-bold mb-1">Zone</label>
<select id="zoneFilter" class="form-control" style="width: 140px;">
<option value="">All Zones</option>
</select>
</div>
<!-- BUTTONS -->
<div class="d-flex gap-2">
<button class="btn btn-primary" onclick="loadDriverReport()">Load Report</button>
<button class="btn btn-success" onclick="goToSchemereport()">Back</button>
</div>
</div>
</div>
<table id="driverReportTable" class="table table-bordered table-hover mt-3 text-center"
style="display:none">
<thead class="table-primary">
<tr>
<th>Zone</th>
<th>Ward</th>
<th>Driver Name</th>
<th>Driver Mobile Number</th>
<th>Location Details</th>
<!-- <th>Current Location of the Driver</th>-->
<th>Start Image</th>
<th>Start Address</th>
<th>Start Time</th>
<th>End Address</th>
<th>End Time</th>
<th>End Image</th>
</tr>
</thead>
<tbody id="driverReportBody">
<!-- Rows inserted dynamically -->
</tbody>
</table>
</div>
</div>
<div class="modal fade" id="imagePreviewModal" tabindex="-1">
<div class="modal-dialog modal-dialog-centered modal-lg">
<div class="modal-content">
<!-- CLOSE BUTTON -->
<div class="modal-header border-0">
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
</div>
<div class="modal-body text-center">
<img id="fullImage" src="" style="width: 100%; border-radius: 5px;">
</div>
</div>
</div>
</div>
<div id="pageLoader"
style="display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(255, 255, 255, 0.8); z-index: 9999; text-align: center;">
<div style="position: relative; top: 50%; transform: translateY(-50%);">
<div class="spinner-border text-primary" role="status" style="width: 3rem; height: 3rem;">
<span class="sr-only"></span>
</div>
<!-- Add the 'Please wait' text below the spinner -->
<p style="margin-top: 1rem; font-size: 1.2rem; color: #007bff;">Please wait...</p>
</div>
</div>
<!-- Scripts -->
<script src="https://cdn.jsdelivr.net/npm/jquery@3.6.0/dist/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script>
<!-- DataTables JS -->
<script src="https://cdn.datatables.net/1.13.4/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.3.6/js/dataTables.buttons.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.3.6/js/buttons.html5.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.3.6/js/buttons.print.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.36/pdfmake.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.36/vfs_fonts.js"></script>
<!-- SweetAlert -->
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<script>
let today = new Date().toISOString().split("T")[0];
document.getElementById("driverDate").setAttribute("max", today);
document.getElementById("driverDate").value = today;
$('#pageLoader').show();
// Auto-load report for today
loadDriverReport();
loadZones();
function goToSchemereport() {
window.location.href = "/commissionerreview/foodSchemeReport";
}
$(document).on("click", ".preview-img", function () {
let imgSrc = $(this).attr("src");
$("#fullImage").attr("src", imgSrc);
$("#imagePreviewModal").modal("show");
});
function loadZones() {
$.ajax({
url: "/commissionerreview/api/zones",
method: "GET",
success: function (res) {
let zones = res.data; // <-- FIXED
let dropdown = $("#zoneFilter");
dropdown.empty();
dropdown.append(`<option value="">All Zones</option>`);
zones.forEach(z => {
dropdown.append(`<option value="${z.zone}">${z.zone}</option>`);
});
}
});
}
function loadDriverReport() {
let date = document.getElementById("driverDate").value;
let zone = $("#zoneFilter").val();
console.log(zone);
if (!date) {
Swal.fire("Required!", "Please select Date", "warning");
return;
}
let tbody = document.getElementById("driverReportBody");
if ($.fn.DataTable.isDataTable("#driverReportTable")) {
$("#driverReportTable").DataTable().clear().destroy();
}
tbody.innerHTML = "";
$.ajax({
url: "/commissionerreview/api/driver-report",
method: "GET",
//data: { date: date },
data: { date: date, zone: zone },
success: function (response) {
$('#pageLoader').hide();
// console.log(response);
// Build table rows
response.data.forEach(d => {
tbody.innerHTML += `
<tr>
<td>${d.Zone || ''}</td>
<td>${d.Ward || ''}</td>
<td>${d.DriverName || ''}</td>
<td>${d.DriverMobile || ''}</td>
<td>${d.LocationDescription || ''}</td>
<td> <img src="${d.StartImage || ''}" width="80" class="img-thumbnail preview-img"></td>
<td>${d.StartAddress || ''}</td>
<td>${d.StartTime || ''}</td>
<td>${d.EndAddress || ''}</td>
<td class="time-column">${d.EndTime || ''}</td>
<td> <img src="${d.EndImage || ''}" width="80" class="img-thumbnail preview-img"></td>
</tr>
`;
});
document.getElementById("driverReportTable").style.display = "table";
// Reinitialize DataTable WITH PDF & EXCEL
setTimeout(() => {
$("#driverReportTable").DataTable({
dom: 'Bfrtip',
paging: false,
searching: false,
ordering: false,
info: false,
buttons: [
{
extend: 'excelHtml5',
title: 'Driver_Report_' + date,
className: 'btn btn-success btn-sm',
text: 'Download Excel'
},
{
extend: 'pdfHtml5',
title: 'Driver_Report_' + date,
className: 'btn btn-danger btn-sm',
orientation: 'landscape',
pageSize: 'A4',
text: 'Download PDF'
}
]
});
}, 150);
},
error: function () {
Swal.fire("Error!", "Unable to fetch driver report.", "error");
}
});
}
// Allow TODAY + PAST only (Restrict future)
// Restrict future dates
/*let today = new Date().toISOString().split("T")[0];
document.getElementById("driverDate").setAttribute("max", today);
document.getElementById("driverDate").value = today;
// Auto-load report for today
loadDriverReport();
function loadDriverReport() {
let date = document.getElementById("driverDate").value;
if (!date) {
Swal.fire("Required!", "Please select Date", "warning");
return;
}
let tbody = document.getElementById("driverReportBody");
if ($.fn.DataTable.isDataTable("#driverReportTable")) {
$("#driverReportTable").DataTable().clear().destroy();
}
tbody.innerHTML = "";
$.ajax({
url: "/commissionerreview/api/feedback/driver-report",
method: "GET",
data: { date: date },
success: function(data) {
console.log(data);
// Build table rows
data.forEach(d => {
tbody.innerHTML += `
<tr>
<td>${d.DriverName || ''}</td>
<td>-</td>
<td>${d.LocationDescription || ''}</td>
<td><img src="${d.upload_image_url}" width="80" class="img-thumbnail"></td>
<td>${d.StartPoint || ''}</td>
<td>${d.StartTime || ''}</td>
<td>${d.EndPoint || ''}</td>
<td>${d.EndTime || ''}</td>
</tr>
`;
});
document.getElementById("driverReportTable").style.display = "table";
// Reinitialize DataTable WITH PDF & EXCEL
setTimeout(() => {
$("#driverReportTable").DataTable({
dom: 'Bfrtip',
paging: false,
searching: false,
ordering: false,
info: false,
buttons: [
{
extend: 'excelHtml5',
title: 'Driver_Report_' + date,
className: 'btn btn-success btn-sm',
text: 'Download Excel'
},
{
extend: 'pdfHtml5',
title: 'Driver_Report_' + date,
className: 'btn btn-danger btn-sm',
orientation: 'landscape',
pageSize: 'A4',
text: 'Download PDF'
}
]
});
}, 150);
},
error: function() {
Swal.fire("Error!", "Unable to fetch driver report.", "error");
}
});
}*/
</script>
</body>
</html>

706
src/main/resources/templates/modules/food_scheme/feedbackreport.html

@ -0,0 +1,706 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<title>Feedback Summary Report</title>
<!-- Bootstrap 5 -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet">
<style>
table th,
table td {
text-align: center;
vertical-align: middle;
border: 1px solid #000;
}
table th {
background-color: #003366 !important;
color: white;
}
.page-header-title h4 {
margin-top: 20px;
text-align: center;
}
.summary-title {
background: #f4a460;
padding: 6px;
font-weight: bold;
margin-top: 30px;
border-radius: 4px;
text-align: center;
}
.tables-row {
display: flex;
justify-content: space-between;
gap: 20px;
}
.table-block {
width: 32%;
}
/* Same column width across all tables */
table td:nth-child(1),
table th:nth-child(1) {
width: 65%;
}
table td:nth-child(2),
table th:nth-child(2) {
width: 35%;
}
/* Bold border above Grand Total */
.total-row td {
border-top: 3px solid black !important;
font-weight: bold;
}
.total-row td {
border-top: 3px solid #000 !important;
border-bottom: 3px solid #000 !important;
/* ADD THIS */
font-weight: bold;
}
#detailModal table tfoot th {
background-color: white !important;
color: black !important;
border-top: 3px solid black !important;
}
#detailModal tfoot tr th {
border-top: 3px solid black !important;
border-bottom: 3px solid black !important;
}
#imagePreviewModal .modal-dialog {
max-width: 300px;
/* you can change this */
}
#wardModal table tfoot tr th {
background-color: white !important;
color: black !important;
font-weight: bold !important;
border-top: 3px solid black !important;
border-bottom: 3px solid black !important;
text-align: center !important;
}
.table img {
display: block;
margin: auto;
padding: 3px;
/* gives spacing so border becomes visible */
border: 1px solid #ccc;
border-radius: 4px;
}
/* FIX COLUMN WIDTHS ONLY INSIDE WARD MODAL */
#wardModal table th:nth-child(1),
#wardModal table td:nth-child(1) {
width: 60px !important;
}
/* Location column */
#wardModal table th:nth-child(2),
#wardModal table td:nth-child(2) {
width: 60px !important;
text-align: left !important;
}
/* Count column */
#wardModal table th:nth-child(3),
#wardModal table td:nth-child(3) {
width: 350px !important;
}
/* Image column */
#wardModal table th:nth-child(4),
#wardModal table td:nth-child(4) {
width: 120px !important;
}
#wardModal table {
border-bottom: 3px solid #000 !important;
}
.export-btn-container {
text-align: right;
margin-bottom: 10px;
}
</style>
</head>
<body>
<div class="page-header-title">
<h4><strong>Food Scheme – Feedback Summary</strong></h4>
</div>
<div class="container mt-4">
<div class="card shadow-sm p-3">
<div class="d-flex justify-content-between align-items-center mb-3">
<h5 class="mb-0"><strong>Feedback Summary</strong></h5>
<div class="d-flex align-items-center gap-2">
<input type="date" id="reportDate" class="form-control" style="width: 200px;">
<button class="btn btn-success" onclick="goToSchemereport()">Back</button>
</div>
</div>
<div class="tables-row">
<div class="table-block">
<div class="summary-title">Feedback - Food Distribution Time</div>
<table class="table table-bordered mt-2">
<thead>
<tr>
<th>Category</th>
<th>Count</th>
</tr>
</thead>
<tbody id="tableTime">
</tbody>
</table>
</div>
<div class="table-block">
<div class="summary-title">Feedback - Food Taste</div>
<table class="table table-bordered mt-2">
<thead>
<tr>
<th>Category</th>
<th>Count</th>
</tr>
</thead>
<tbody id="tableTaste"></tbody>
</table>
</div>
<div class="table-block">
<div class="summary-title">Feedback - Food Quantity</div>
<table class="table table-bordered mt-2">
<thead>
<tr>
<th>Category</th>
<th>Count</th>
</tr>
</thead>
<tbody id="tableQuantity"></tbody>
</table>
</div>
</div>
</div>
</div>
<!-- Modal -->
<div class="modal fade" id="detailModal" tabindex="-1">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Feedback Details</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
</div>
<div class="modal-body">
<!-- Dynamic Title -->
<h5 id="modalTitle" class="text-center mb-3"></h5>
<div id="ModalExportContainer" class="mt-2"></div>
<table id="detailModalTable" class="table table-bordered table-hover mt-3 text-center">
<thead>
<tr>
<th>Zone</th>
<th>Count</th>
</tr>
</thead>
<tbody id="modalTableBody"></tbody>
<!-- <tfoot>
<tr>
<th>Grand Total</th>
<th id="modalGrandTotal"></th>
</tr>
</tfoot>-->
</table>
</div>
<div class="modal-footer">
<button class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<!-- Ward Modal (second popup) -->
<div class="modal fade" id="wardModal" tabindex="-1">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<!--<h5 class="modal-title">Ward Details</h5>-->
<h5 class="modal-title" id="wardModalMainTitle">Ward Details</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
</div>
<div class="modal-body">
<h5 id="wardModalTitle" class="text-center mb-3"></h5>
<table id="wardModalTable" class="table table-bordered table-hover mt-3 text-center">
<thead>
<tr>
<th>S.No</th>
<th>Ward</th>
<th>Location</th>
<th>Image</th>
</tr>
</thead>
<tbody id="wardModalTableBody"></tbody>
<tfoot>
<tr>
<!-- <th></th>
<th>Grand Total</th>
<th id="wardModalGrandTotal"></th>
<th></th>-->
</tr>
</tfoot>
</table>
</div>
<div class="modal-footer">
<button class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="imagePreviewModal" tabindex="-1">
<div class="modal-dialog modal-dialog-centered modal-lg">
<div class="modal-content">
<!-- CLOSE BUTTON -->
<div class="modal-header border-0">
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
</div>
<div class="modal-body text-center">
<img id="fullImage" src="" style="width: 100%; border-radius: 5px;">
</div>
</div>
</div>
</div>
<div id="pageLoader"
style="display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(255,255,255,0.8); z-index: 9999; text-align: center;">
<div style="position: relative; top: 50%; transform: translateY(-50%);">
<div class="spinner-border text-primary" style="width: 3rem; height: 3rem;"></div>
<p style="margin-top: 1rem; font-size: 1.2rem; color: #007bff;">Please wait...</p>
</div>
</div>
<!-- jQuery -->
<script src="https://cdn.jsdelivr.net/npm/jquery@3.6.0/dist/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
<!-- DataTables JS -->
<script src="https://cdn.datatables.net/1.13.4/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.3.6/js/dataTables.buttons.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.3.6/js/buttons.html5.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.3.6/js/buttons.print.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.36/pdfmake.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.36/vfs_fonts.js"></script>
<script>
$(document).ready(function () {
$('#pageLoader').show();
let today = new Date().toISOString().split("T")[0];
$("#reportDate").val(today);
$("#reportDate").attr("max", today);
loadSummary(today);
$("#reportDate").on("change", function () {
loadSummary(this.value);
});
});
$(document).on("click", ".preview-img", function () {
let imgSrc = $(this).attr("src");
$("#fullImage").attr("src", imgSrc);
$("#imagePreviewModal").modal("show");
});
//excel and pdf
function goToSchemereport() {
window.location.href = "/commissionerreview/foodSchemeReport";
}
$(document).on("click", ".clickable", function () {
let qid = $(this).data("qid");
let column = $(this).data("column");
let count = $(this).data("value");
let date = $("#reportDate").val();
let category = column.replace(/_/g, " ").toUpperCase();
if ($.fn.DataTable.isDataTable("#detailModalTable")) {
$("#detailModalTable").DataTable().clear().destroy();
}
// Title: Question + Category
$("#modalTitle").text("");
$.ajax({
url: "/commissionerreview/api/zone-details",
method: "GET",
data: { qid, column, date },
success: function (res) {
console.log(res);
let rows = res.data;
let tbody = $("#modalTableBody");
tbody.empty();
let grandTotal = 0;
if (rows.length > 0) {
// Set Title
$("#modalTitle").text(rows[0].question + " – " + category);
rows.forEach(r => {
tbody.append(`
<tr>
<td>${r.zone}</td>
<td class="zoneCountClickable"
data-zone="${r.zone}"
data-qid="${qid}"
data-column="${column}"
style="cursor:pointer;color:blue;text-decoration:underline;">
${r.count_value}
</td>
</tr>
`);
grandTotal += r.count_value;
});
}
tbody.append(`
<tr class="total-row">
<td><b>Grand Total</b></td>
<td><b>${grandTotal}</b></td>
</tr>
`);
// Destroy existing DataTable instance if exists
document.getElementById("detailModalTable").style.display = "table";
// Reinitialize DataTable WITH PDF & EXCEL
setTimeout(() => {
$("#detailModalTable").DataTable({
dom: 'Bfrtip',
paging: false,
searching: false,
ordering: false,
info: false,
buttons: [
{
extend: 'excelHtml5',
title: 'zone_report',
// className: 'btn btn-success btn-sm',
text: 'Download Excel'
},
{
extend: 'pdfHtml5',
title: 'zone_report',
// className: 'btn btn-danger btn-sm',
orientation: 'landscape',
pageSize: 'A4',
text: 'Download PDF'
}
]
});
}, 150);
new bootstrap.Modal(document.getElementById("detailModal")).show();
}
});
});
$(document).on("click", ".zoneCountClickable", function () {
let zoneId = $(this).data("zone");
let qid = $(this).data("qid");
let column = $(this).data("column");
let date = $("#reportDate").val();
let label = column.replace(/_/g, " ").toUpperCase();
if ($.fn.DataTable.isDataTable("#wardModalTable")) {
$("#wardModalTable").DataTable().clear().destroy();
}
$("#wardModalMainTitle").text("Zone " + zoneId + " – Ward Details");
$.ajax({
url: "/commissionerreview/api/ward-details",
method: "GET",
data: { qid, column, date, zoneId },
success: function (res) {
console.log(res);
let rows = res.data;
let tbody = $("#wardModalTableBody");
tbody.empty();
let grandTotal = 0;
if (rows.length > 0) {
$("#wardModalTitle").text(rows[0].question + " – " + label);
rows.forEach((r, index) => {
tbody.append(`
<tr>
<td>${index + 1}</td>
<td>${r.ward}</td>
<td>${r.location}</td>
<td>
<img src="${r.feedbackImage}" width="80" height="80" class="img-thumbnail preview-img">
</td>
</tr>
`);
});
}
$("#wardModalGrandTotal").text(grandTotal);
document.getElementById("wardModalTable").style.display = "table";
// Reinitialize DataTable WITH PDF & EXCEL
setTimeout(() => {
$("#wardModalTable").DataTable({
dom: 'Bfrtip',
paging: false,
searching: false,
ordering: false,
info: false,
buttons: [
{
extend: 'excelHtml5',
title: 'ward_report',
text: 'Download Excel'
},
{
extend: 'pdfHtml5',
title: 'ward_report',
orientation: 'landscape',
pageSize: 'A4',
text: 'Download PDF'
}
]
});
}, 150);
new bootstrap.Modal(document.getElementById("wardModal")).show();
}
});
});
/* $(document).on("click", ".clickable", function () {
let qid = $(this).data("qid");
let column = $(this).data("column");
let count = $(this).data("value");
let date = $("#reportDate").val();
$("#mCategory").text(column.replace(/_/g, " ").toUpperCase());
$("#mCount").text(count);
$.ajax({
url: "/commissionerreview/api/zone-details",
method: "GET",
data: { qid, column, date },
success: function (res) {
console.log("Modal Data:", res);
if (res.data && res.data.length > 0) {
let row = res.data[0];
$("#mZone").text(row.zone);
$("#mQuestion").text(row.question);
} else {
$("#mZone").text("No Data");
$("#mQuestion").text("No Data");
}
new bootstrap.Modal(document.getElementById("detailModal")).show();
}
});
});*/
/* --------------------------------
LOAD 3 FEEDBACK BLOCKS
--------------------------------- */
function loadSummary(date) {
$.ajax({
url: "/commissionerreview/api/feedback-summary",
method: "GET",
data: { date: date },
success: function (response) {
$('#pageLoader').hide();
// Extract the array
let rows = response.data;
// Clear tables
$("#tableTime").empty();
$("#tableTaste").empty();
$("#tableQuantity").empty();
// qid → table mapping
const tableMap = {
1: { body: $("#tableTime"), titleIndex: 0 },
2: { body: $("#tableTaste"), titleIndex: 1 },
3: { body: $("#tableQuantity"), titleIndex: 2 }
};
rows.forEach(row => {
let tbl = tableMap[row.qid];
if (!tbl) return;
// Set dynamic title
$(".summary-title").eq(tbl.titleIndex).text(row.question);
let keys = [];
let total = 0;
// Keys based on qid
if (row.qid === 1) {
keys = ["on_time_distribution", "delayeded"];
} else if (row.qid === 2) {
keys = ["good", "average"];
} else if (row.qid === 3) {
keys = ["sufficient_food_quantity", "less_quantity"];
}
// Add rows
keys.forEach(key => {
let value = row[key];
/* tbl.body.append(`
<tr>
<td>${key.replace(/_/g, " ").toUpperCase()}</td>
<td>${value}</td>
</tr>
`);*/
/*tbl.body.append(`
<tr>
<td>${key.replace(/_/g, " ").toUpperCase()}</td>
<td class="clickable"
data-qid="${row.qid}"
data-column="${key}"
data-value="${value}"
style="cursor:pointer;color:blue;text-decoration:underline;">
${value}
</td>
</tr>
`);*/
let clickableClass = value > 0 ? "clickable" : "";
let clickableStyle = value > 0 ? "cursor:pointer;color:blue;text-decoration:underline;" : "color:black;cursor:default;";
tbl.body.append(`
<tr>
<td>${key.replace(/_/g, " ").toUpperCase()}</td>
<td class="${clickableClass}"
data-qid="${row.qid}"
data-column="${key}"
data-value="${value}"
style="${clickableStyle}">
${value}
</td>
</tr>
`);
total += value;
});
// Add total row
tbl.body.append(`
<tr class="total-row">
<td>Grand Total</td>
<td>${total}</td>
</tr>
`);
});
}
});
}
</script>
</body>
</html>

1520
src/main/resources/templates/modules/food_scheme/foodschemereport.html
File diff suppressed because it is too large
View File

Loading…
Cancel
Save