commit
fc1b2be09b
23 changed files with 7370 additions and 0 deletions
-
2.gitattributes
-
33.gitignore
-
19.mvn/wrapper/maven-wrapper.properties
-
259mvnw
-
149mvnw.cmd
-
83pom.xml
-
13src/main/java/com/gcc/commissionerreviewII/CommissionerreviewIiApplication.java
-
53src/main/java/com/gcc/commissionerreviewII/configuration/DataSourceConfig.java
-
55src/main/java/com/gcc/commissionerreviewII/controller/EnforcementApiController.java
-
101src/main/java/com/gcc/commissionerreviewII/controller/EnforcementPendencyApiController.java
-
38src/main/java/com/gcc/commissionerreviewII/controller/MainController.java
-
77src/main/java/com/gcc/commissionerreviewII/controller/SofaBedCollectionApiController.java
-
769src/main/java/com/gcc/commissionerreviewII/service/EnforcementPendencyService.java
-
304src/main/java/com/gcc/commissionerreviewII/service/EnforcementService.java
-
621src/main/java/com/gcc/commissionerreviewII/service/SofaBedCollectionService.java
-
3src/main/resources/application.properties
-
919src/main/resources/templates/modules/enforcement/Zonewise.html
-
857src/main/resources/templates/modules/enforcement/form2pendency.html
-
857src/main/resources/templates/modules/enforcement/form3Pendency.html
-
796src/main/resources/templates/modules/enforcement/form7pendency.html
-
662src/main/resources/templates/modules/sofa_bed/zonewise.html
-
687src/main/resources/templates/modules/sofa_bed/zonewise1.html
-
13src/test/java/com/gcc/commissionerreviewII/CommissionerreviewIiApplicationTests.java
@ -0,0 +1,2 @@ |
|||
/mvnw text eol=lf |
|||
*.cmd text eol=crlf |
|||
@ -0,0 +1,33 @@ |
|||
HELP.md |
|||
target/ |
|||
.mvn/wrapper/maven-wrapper.jar |
|||
!**/src/main/**/target/ |
|||
!**/src/test/**/target/ |
|||
|
|||
### STS ### |
|||
.apt_generated |
|||
.classpath |
|||
.factorypath |
|||
.project |
|||
.settings |
|||
.springBeans |
|||
.sts4-cache |
|||
|
|||
### IntelliJ IDEA ### |
|||
.idea |
|||
*.iws |
|||
*.iml |
|||
*.ipr |
|||
|
|||
### NetBeans ### |
|||
/nbproject/private/ |
|||
/nbbuild/ |
|||
/dist/ |
|||
/nbdist/ |
|||
/.nb-gradle/ |
|||
build/ |
|||
!**/src/main/**/build/ |
|||
!**/src/test/**/build/ |
|||
|
|||
### VS Code ### |
|||
.vscode/ |
|||
@ -0,0 +1,19 @@ |
|||
# 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 |
|||
@ -0,0 +1,259 @@ |
|||
#!/bin/sh |
|||
# ---------------------------------------------------------------------------- |
|||
# 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. |
|||
# ---------------------------------------------------------------------------- |
|||
|
|||
# ---------------------------------------------------------------------------- |
|||
# Apache Maven Wrapper startup batch script, version 3.3.2 |
|||
# |
|||
# Optional ENV vars |
|||
# ----------------- |
|||
# JAVA_HOME - location of a JDK home dir, required when download maven via java source |
|||
# MVNW_REPOURL - repo url base for downloading maven distribution |
|||
# MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven |
|||
# MVNW_VERBOSE - true: enable verbose log; debug: trace the mvnw script; others: silence the output |
|||
# ---------------------------------------------------------------------------- |
|||
|
|||
set -euf |
|||
[ "${MVNW_VERBOSE-}" != debug ] || set -x |
|||
|
|||
# OS specific support. |
|||
native_path() { printf %s\\n "$1"; } |
|||
case "$(uname)" in |
|||
CYGWIN* | MINGW*) |
|||
[ -z "${JAVA_HOME-}" ] || JAVA_HOME="$(cygpath --unix "$JAVA_HOME")" |
|||
native_path() { cygpath --path --windows "$1"; } |
|||
;; |
|||
esac |
|||
|
|||
# set JAVACMD and JAVACCMD |
|||
set_java_home() { |
|||
# For Cygwin and MinGW, ensure paths are in Unix format before anything is touched |
|||
if [ -n "${JAVA_HOME-}" ]; then |
|||
if [ -x "$JAVA_HOME/jre/sh/java" ]; then |
|||
# IBM's JDK on AIX uses strange locations for the executables |
|||
JAVACMD="$JAVA_HOME/jre/sh/java" |
|||
JAVACCMD="$JAVA_HOME/jre/sh/javac" |
|||
else |
|||
JAVACMD="$JAVA_HOME/bin/java" |
|||
JAVACCMD="$JAVA_HOME/bin/javac" |
|||
|
|||
if [ ! -x "$JAVACMD" ] || [ ! -x "$JAVACCMD" ]; then |
|||
echo "The JAVA_HOME environment variable is not defined correctly, so mvnw cannot run." >&2 |
|||
echo "JAVA_HOME is set to \"$JAVA_HOME\", but \"\$JAVA_HOME/bin/java\" or \"\$JAVA_HOME/bin/javac\" does not exist." >&2 |
|||
return 1 |
|||
fi |
|||
fi |
|||
else |
|||
JAVACMD="$( |
|||
'set' +e |
|||
'unset' -f command 2>/dev/null |
|||
'command' -v java |
|||
)" || : |
|||
JAVACCMD="$( |
|||
'set' +e |
|||
'unset' -f command 2>/dev/null |
|||
'command' -v javac |
|||
)" || : |
|||
|
|||
if [ ! -x "${JAVACMD-}" ] || [ ! -x "${JAVACCMD-}" ]; then |
|||
echo "The java/javac command does not exist in PATH nor is JAVA_HOME set, so mvnw cannot run." >&2 |
|||
return 1 |
|||
fi |
|||
fi |
|||
} |
|||
|
|||
# hash string like Java String::hashCode |
|||
hash_string() { |
|||
str="${1:-}" h=0 |
|||
while [ -n "$str" ]; do |
|||
char="${str%"${str#?}"}" |
|||
h=$(((h * 31 + $(LC_CTYPE=C printf %d "'$char")) % 4294967296)) |
|||
str="${str#?}" |
|||
done |
|||
printf %x\\n $h |
|||
} |
|||
|
|||
verbose() { :; } |
|||
[ "${MVNW_VERBOSE-}" != true ] || verbose() { printf %s\\n "${1-}"; } |
|||
|
|||
die() { |
|||
printf %s\\n "$1" >&2 |
|||
exit 1 |
|||
} |
|||
|
|||
trim() { |
|||
# MWRAPPER-139: |
|||
# Trims trailing and leading whitespace, carriage returns, tabs, and linefeeds. |
|||
# Needed for removing poorly interpreted newline sequences when running in more |
|||
# exotic environments such as mingw bash on Windows. |
|||
printf "%s" "${1}" | tr -d '[:space:]' |
|||
} |
|||
|
|||
# parse distributionUrl and optional distributionSha256Sum, requires .mvn/wrapper/maven-wrapper.properties |
|||
while IFS="=" read -r key value; do |
|||
case "${key-}" in |
|||
distributionUrl) distributionUrl=$(trim "${value-}") ;; |
|||
distributionSha256Sum) distributionSha256Sum=$(trim "${value-}") ;; |
|||
esac |
|||
done <"${0%/*}/.mvn/wrapper/maven-wrapper.properties" |
|||
[ -n "${distributionUrl-}" ] || die "cannot read distributionUrl property in ${0%/*}/.mvn/wrapper/maven-wrapper.properties" |
|||
|
|||
case "${distributionUrl##*/}" in |
|||
maven-mvnd-*bin.*) |
|||
MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ |
|||
case "${PROCESSOR_ARCHITECTURE-}${PROCESSOR_ARCHITEW6432-}:$(uname -a)" in |
|||
*AMD64:CYGWIN* | *AMD64:MINGW*) distributionPlatform=windows-amd64 ;; |
|||
:Darwin*x86_64) distributionPlatform=darwin-amd64 ;; |
|||
:Darwin*arm64) distributionPlatform=darwin-aarch64 ;; |
|||
:Linux*x86_64*) distributionPlatform=linux-amd64 ;; |
|||
*) |
|||
echo "Cannot detect native platform for mvnd on $(uname)-$(uname -m), use pure java version" >&2 |
|||
distributionPlatform=linux-amd64 |
|||
;; |
|||
esac |
|||
distributionUrl="${distributionUrl%-bin.*}-$distributionPlatform.zip" |
|||
;; |
|||
maven-mvnd-*) MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ ;; |
|||
*) MVN_CMD="mvn${0##*/mvnw}" _MVNW_REPO_PATTERN=/org/apache/maven/ ;; |
|||
esac |
|||
|
|||
# apply MVNW_REPOURL and calculate MAVEN_HOME |
|||
# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-<version>,maven-mvnd-<version>-<platform>}/<hash> |
|||
[ -z "${MVNW_REPOURL-}" ] || distributionUrl="$MVNW_REPOURL$_MVNW_REPO_PATTERN${distributionUrl#*"$_MVNW_REPO_PATTERN"}" |
|||
distributionUrlName="${distributionUrl##*/}" |
|||
distributionUrlNameMain="${distributionUrlName%.*}" |
|||
distributionUrlNameMain="${distributionUrlNameMain%-bin}" |
|||
MAVEN_USER_HOME="${MAVEN_USER_HOME:-${HOME}/.m2}" |
|||
MAVEN_HOME="${MAVEN_USER_HOME}/wrapper/dists/${distributionUrlNameMain-}/$(hash_string "$distributionUrl")" |
|||
|
|||
exec_maven() { |
|||
unset MVNW_VERBOSE MVNW_USERNAME MVNW_PASSWORD MVNW_REPOURL || : |
|||
exec "$MAVEN_HOME/bin/$MVN_CMD" "$@" || die "cannot exec $MAVEN_HOME/bin/$MVN_CMD" |
|||
} |
|||
|
|||
if [ -d "$MAVEN_HOME" ]; then |
|||
verbose "found existing MAVEN_HOME at $MAVEN_HOME" |
|||
exec_maven "$@" |
|||
fi |
|||
|
|||
case "${distributionUrl-}" in |
|||
*?-bin.zip | *?maven-mvnd-?*-?*.zip) ;; |
|||
*) die "distributionUrl is not valid, must match *-bin.zip or maven-mvnd-*.zip, but found '${distributionUrl-}'" ;; |
|||
esac |
|||
|
|||
# prepare tmp dir |
|||
if TMP_DOWNLOAD_DIR="$(mktemp -d)" && [ -d "$TMP_DOWNLOAD_DIR" ]; then |
|||
clean() { rm -rf -- "$TMP_DOWNLOAD_DIR"; } |
|||
trap clean HUP INT TERM EXIT |
|||
else |
|||
die "cannot create temp dir" |
|||
fi |
|||
|
|||
mkdir -p -- "${MAVEN_HOME%/*}" |
|||
|
|||
# Download and Install Apache Maven |
|||
verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." |
|||
verbose "Downloading from: $distributionUrl" |
|||
verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" |
|||
|
|||
# select .zip or .tar.gz |
|||
if ! command -v unzip >/dev/null; then |
|||
distributionUrl="${distributionUrl%.zip}.tar.gz" |
|||
distributionUrlName="${distributionUrl##*/}" |
|||
fi |
|||
|
|||
# verbose opt |
|||
__MVNW_QUIET_WGET=--quiet __MVNW_QUIET_CURL=--silent __MVNW_QUIET_UNZIP=-q __MVNW_QUIET_TAR='' |
|||
[ "${MVNW_VERBOSE-}" != true ] || __MVNW_QUIET_WGET='' __MVNW_QUIET_CURL='' __MVNW_QUIET_UNZIP='' __MVNW_QUIET_TAR=v |
|||
|
|||
# normalize http auth |
|||
case "${MVNW_PASSWORD:+has-password}" in |
|||
'') MVNW_USERNAME='' MVNW_PASSWORD='' ;; |
|||
has-password) [ -n "${MVNW_USERNAME-}" ] || MVNW_USERNAME='' MVNW_PASSWORD='' ;; |
|||
esac |
|||
|
|||
if [ -z "${MVNW_USERNAME-}" ] && command -v wget >/dev/null; then |
|||
verbose "Found wget ... using wget" |
|||
wget ${__MVNW_QUIET_WGET:+"$__MVNW_QUIET_WGET"} "$distributionUrl" -O "$TMP_DOWNLOAD_DIR/$distributionUrlName" || die "wget: Failed to fetch $distributionUrl" |
|||
elif [ -z "${MVNW_USERNAME-}" ] && command -v curl >/dev/null; then |
|||
verbose "Found curl ... using curl" |
|||
curl ${__MVNW_QUIET_CURL:+"$__MVNW_QUIET_CURL"} -f -L -o "$TMP_DOWNLOAD_DIR/$distributionUrlName" "$distributionUrl" || die "curl: Failed to fetch $distributionUrl" |
|||
elif set_java_home; then |
|||
verbose "Falling back to use Java to download" |
|||
javaSource="$TMP_DOWNLOAD_DIR/Downloader.java" |
|||
targetZip="$TMP_DOWNLOAD_DIR/$distributionUrlName" |
|||
cat >"$javaSource" <<-END |
|||
public class Downloader extends java.net.Authenticator |
|||
{ |
|||
protected java.net.PasswordAuthentication getPasswordAuthentication() |
|||
{ |
|||
return new java.net.PasswordAuthentication( System.getenv( "MVNW_USERNAME" ), System.getenv( "MVNW_PASSWORD" ).toCharArray() ); |
|||
} |
|||
public static void main( String[] args ) throws Exception |
|||
{ |
|||
setDefault( new Downloader() ); |
|||
java.nio.file.Files.copy( java.net.URI.create( args[0] ).toURL().openStream(), java.nio.file.Paths.get( args[1] ).toAbsolutePath().normalize() ); |
|||
} |
|||
} |
|||
END |
|||
# For Cygwin/MinGW, switch paths to Windows format before running javac and java |
|||
verbose " - Compiling Downloader.java ..." |
|||
"$(native_path "$JAVACCMD")" "$(native_path "$javaSource")" || die "Failed to compile Downloader.java" |
|||
verbose " - Running Downloader.java ..." |
|||
"$(native_path "$JAVACMD")" -cp "$(native_path "$TMP_DOWNLOAD_DIR")" Downloader "$distributionUrl" "$(native_path "$targetZip")" |
|||
fi |
|||
|
|||
# If specified, validate the SHA-256 sum of the Maven distribution zip file |
|||
if [ -n "${distributionSha256Sum-}" ]; then |
|||
distributionSha256Result=false |
|||
if [ "$MVN_CMD" = mvnd.sh ]; then |
|||
echo "Checksum validation is not supported for maven-mvnd." >&2 |
|||
echo "Please disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 |
|||
exit 1 |
|||
elif command -v sha256sum >/dev/null; then |
|||
if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | sha256sum -c >/dev/null 2>&1; then |
|||
distributionSha256Result=true |
|||
fi |
|||
elif command -v shasum >/dev/null; then |
|||
if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | shasum -a 256 -c >/dev/null 2>&1; then |
|||
distributionSha256Result=true |
|||
fi |
|||
else |
|||
echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." >&2 |
|||
echo "Please install either command, or disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 |
|||
exit 1 |
|||
fi |
|||
if [ $distributionSha256Result = false ]; then |
|||
echo "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised." >&2 |
|||
echo "If you updated your Maven version, you need to update the specified distributionSha256Sum property." >&2 |
|||
exit 1 |
|||
fi |
|||
fi |
|||
|
|||
# unzip and move |
|||
if command -v unzip >/dev/null; then |
|||
unzip ${__MVNW_QUIET_UNZIP:+"$__MVNW_QUIET_UNZIP"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -d "$TMP_DOWNLOAD_DIR" || die "failed to unzip" |
|||
else |
|||
tar xzf${__MVNW_QUIET_TAR:+"$__MVNW_QUIET_TAR"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -C "$TMP_DOWNLOAD_DIR" || die "failed to untar" |
|||
fi |
|||
printf %s\\n "$distributionUrl" >"$TMP_DOWNLOAD_DIR/$distributionUrlNameMain/mvnw.url" |
|||
mv -- "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" "$MAVEN_HOME" || [ -d "$MAVEN_HOME" ] || die "fail to move MAVEN_HOME" |
|||
|
|||
clean || : |
|||
exec_maven "$@" |
|||
@ -0,0 +1,149 @@ |
|||
<# : batch portion |
|||
@REM ---------------------------------------------------------------------------- |
|||
@REM Licensed to the Apache Software Foundation (ASF) under one |
|||
@REM or more contributor license agreements. See the NOTICE file |
|||
@REM distributed with this work for additional information |
|||
@REM regarding copyright ownership. The ASF licenses this file |
|||
@REM to you under the Apache License, Version 2.0 (the |
|||
@REM "License"); you may not use this file except in compliance |
|||
@REM with the License. You may obtain a copy of the License at |
|||
@REM |
|||
@REM http://www.apache.org/licenses/LICENSE-2.0 |
|||
@REM |
|||
@REM Unless required by applicable law or agreed to in writing, |
|||
@REM software distributed under the License is distributed on an |
|||
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
|||
@REM KIND, either express or implied. See the License for the |
|||
@REM specific language governing permissions and limitations |
|||
@REM under the License. |
|||
@REM ---------------------------------------------------------------------------- |
|||
|
|||
@REM ---------------------------------------------------------------------------- |
|||
@REM Apache Maven Wrapper startup batch script, version 3.3.2 |
|||
@REM |
|||
@REM Optional ENV vars |
|||
@REM MVNW_REPOURL - repo url base for downloading maven distribution |
|||
@REM MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven |
|||
@REM MVNW_VERBOSE - true: enable verbose log; others: silence the output |
|||
@REM ---------------------------------------------------------------------------- |
|||
|
|||
@IF "%__MVNW_ARG0_NAME__%"=="" (SET __MVNW_ARG0_NAME__=%~nx0) |
|||
@SET __MVNW_CMD__= |
|||
@SET __MVNW_ERROR__= |
|||
@SET __MVNW_PSMODULEP_SAVE=%PSModulePath% |
|||
@SET PSModulePath= |
|||
@FOR /F "usebackq tokens=1* delims==" %%A IN (`powershell -noprofile "& {$scriptDir='%~dp0'; $script='%__MVNW_ARG0_NAME__%'; icm -ScriptBlock ([Scriptblock]::Create((Get-Content -Raw '%~f0'))) -NoNewScope}"`) DO @( |
|||
IF "%%A"=="MVN_CMD" (set __MVNW_CMD__=%%B) ELSE IF "%%B"=="" (echo %%A) ELSE (echo %%A=%%B) |
|||
) |
|||
@SET PSModulePath=%__MVNW_PSMODULEP_SAVE% |
|||
@SET __MVNW_PSMODULEP_SAVE= |
|||
@SET __MVNW_ARG0_NAME__= |
|||
@SET MVNW_USERNAME= |
|||
@SET MVNW_PASSWORD= |
|||
@IF NOT "%__MVNW_CMD__%"=="" (%__MVNW_CMD__% %*) |
|||
@echo Cannot start maven from wrapper >&2 && exit /b 1 |
|||
@GOTO :EOF |
|||
: end batch / begin powershell #> |
|||
|
|||
$ErrorActionPreference = "Stop" |
|||
if ($env:MVNW_VERBOSE -eq "true") { |
|||
$VerbosePreference = "Continue" |
|||
} |
|||
|
|||
# calculate distributionUrl, requires .mvn/wrapper/maven-wrapper.properties |
|||
$distributionUrl = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionUrl |
|||
if (!$distributionUrl) { |
|||
Write-Error "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties" |
|||
} |
|||
|
|||
switch -wildcard -casesensitive ( $($distributionUrl -replace '^.*/','') ) { |
|||
"maven-mvnd-*" { |
|||
$USE_MVND = $true |
|||
$distributionUrl = $distributionUrl -replace '-bin\.[^.]*$',"-windows-amd64.zip" |
|||
$MVN_CMD = "mvnd.cmd" |
|||
break |
|||
} |
|||
default { |
|||
$USE_MVND = $false |
|||
$MVN_CMD = $script -replace '^mvnw','mvn' |
|||
break |
|||
} |
|||
} |
|||
|
|||
# apply MVNW_REPOURL and calculate MAVEN_HOME |
|||
# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-<version>,maven-mvnd-<version>-<platform>}/<hash> |
|||
if ($env:MVNW_REPOURL) { |
|||
$MVNW_REPO_PATTERN = if ($USE_MVND) { "/org/apache/maven/" } else { "/maven/mvnd/" } |
|||
$distributionUrl = "$env:MVNW_REPOURL$MVNW_REPO_PATTERN$($distributionUrl -replace '^.*'+$MVNW_REPO_PATTERN,'')" |
|||
} |
|||
$distributionUrlName = $distributionUrl -replace '^.*/','' |
|||
$distributionUrlNameMain = $distributionUrlName -replace '\.[^.]*$','' -replace '-bin$','' |
|||
$MAVEN_HOME_PARENT = "$HOME/.m2/wrapper/dists/$distributionUrlNameMain" |
|||
if ($env:MAVEN_USER_HOME) { |
|||
$MAVEN_HOME_PARENT = "$env:MAVEN_USER_HOME/wrapper/dists/$distributionUrlNameMain" |
|||
} |
|||
$MAVEN_HOME_NAME = ([System.Security.Cryptography.MD5]::Create().ComputeHash([byte[]][char[]]$distributionUrl) | ForEach-Object {$_.ToString("x2")}) -join '' |
|||
$MAVEN_HOME = "$MAVEN_HOME_PARENT/$MAVEN_HOME_NAME" |
|||
|
|||
if (Test-Path -Path "$MAVEN_HOME" -PathType Container) { |
|||
Write-Verbose "found existing MAVEN_HOME at $MAVEN_HOME" |
|||
Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" |
|||
exit $? |
|||
} |
|||
|
|||
if (! $distributionUrlNameMain -or ($distributionUrlName -eq $distributionUrlNameMain)) { |
|||
Write-Error "distributionUrl is not valid, must end with *-bin.zip, but found $distributionUrl" |
|||
} |
|||
|
|||
# prepare tmp dir |
|||
$TMP_DOWNLOAD_DIR_HOLDER = New-TemporaryFile |
|||
$TMP_DOWNLOAD_DIR = New-Item -Itemtype Directory -Path "$TMP_DOWNLOAD_DIR_HOLDER.dir" |
|||
$TMP_DOWNLOAD_DIR_HOLDER.Delete() | Out-Null |
|||
trap { |
|||
if ($TMP_DOWNLOAD_DIR.Exists) { |
|||
try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } |
|||
catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } |
|||
} |
|||
} |
|||
|
|||
New-Item -Itemtype Directory -Path "$MAVEN_HOME_PARENT" -Force | Out-Null |
|||
|
|||
# Download and Install Apache Maven |
|||
Write-Verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." |
|||
Write-Verbose "Downloading from: $distributionUrl" |
|||
Write-Verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" |
|||
|
|||
$webclient = New-Object System.Net.WebClient |
|||
if ($env:MVNW_USERNAME -and $env:MVNW_PASSWORD) { |
|||
$webclient.Credentials = New-Object System.Net.NetworkCredential($env:MVNW_USERNAME, $env:MVNW_PASSWORD) |
|||
} |
|||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 |
|||
$webclient.DownloadFile($distributionUrl, "$TMP_DOWNLOAD_DIR/$distributionUrlName") | Out-Null |
|||
|
|||
# If specified, validate the SHA-256 sum of the Maven distribution zip file |
|||
$distributionSha256Sum = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionSha256Sum |
|||
if ($distributionSha256Sum) { |
|||
if ($USE_MVND) { |
|||
Write-Error "Checksum validation is not supported for maven-mvnd. `nPlease disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." |
|||
} |
|||
Import-Module $PSHOME\Modules\Microsoft.PowerShell.Utility -Function Get-FileHash |
|||
if ((Get-FileHash "$TMP_DOWNLOAD_DIR/$distributionUrlName" -Algorithm SHA256).Hash.ToLower() -ne $distributionSha256Sum) { |
|||
Write-Error "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised. If you updated your Maven version, you need to update the specified distributionSha256Sum property." |
|||
} |
|||
} |
|||
|
|||
# unzip and move |
|||
Expand-Archive "$TMP_DOWNLOAD_DIR/$distributionUrlName" -DestinationPath "$TMP_DOWNLOAD_DIR" | Out-Null |
|||
Rename-Item -Path "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" -NewName $MAVEN_HOME_NAME | Out-Null |
|||
try { |
|||
Move-Item -Path "$TMP_DOWNLOAD_DIR/$MAVEN_HOME_NAME" -Destination $MAVEN_HOME_PARENT | Out-Null |
|||
} catch { |
|||
if (! (Test-Path -Path "$MAVEN_HOME" -PathType Container)) { |
|||
Write-Error "fail to move MAVEN_HOME" |
|||
} |
|||
} finally { |
|||
try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } |
|||
catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } |
|||
} |
|||
|
|||
Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" |
|||
@ -0,0 +1,83 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|||
<modelVersion>4.0.0</modelVersion> |
|||
<parent> |
|||
<groupId>org.springframework.boot</groupId> |
|||
<artifactId>spring-boot-starter-parent</artifactId> |
|||
<version>3.5.0</version> |
|||
<relativePath/> <!-- lookup parent from repository --> |
|||
</parent> |
|||
<groupId>com.gcc</groupId> |
|||
<artifactId>commissionerreviewII</artifactId> |
|||
<version>0.0.1-SNAPSHOT</version> |
|||
<name>commissionerreviewII</name> |
|||
<description>Demo project for Spring Boot</description> |
|||
<url/> |
|||
<licenses> |
|||
<license/> |
|||
</licenses> |
|||
<developers> |
|||
<developer/> |
|||
</developers> |
|||
<scm> |
|||
<connection/> |
|||
<developerConnection/> |
|||
<tag/> |
|||
<url/> |
|||
</scm> |
|||
<properties> |
|||
<java.version>17</java.version> |
|||
</properties> |
|||
<dependencies> |
|||
|
|||
<dependency> |
|||
<groupId>org.springframework.boot</groupId> |
|||
<artifactId>spring-boot-starter-data-jdbc</artifactId> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>org.springframework.boot</groupId> |
|||
<artifactId>spring-boot-starter-thymeleaf</artifactId> |
|||
</dependency> |
|||
|
|||
<dependency> |
|||
<groupId>org.springframework.boot</groupId> |
|||
<artifactId>spring-boot-starter-web</artifactId> |
|||
</dependency> |
|||
|
|||
<dependency> |
|||
<groupId>org.springframework.boot</groupId> |
|||
<artifactId>spring-boot-devtools</artifactId> |
|||
<scope>runtime</scope> |
|||
<optional>true</optional> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>org.springframework.boot</groupId> |
|||
<artifactId>spring-boot-starter-test</artifactId> |
|||
<scope>test</scope> |
|||
</dependency> |
|||
|
|||
<dependency> |
|||
<groupId>com.oracle.database.jdbc</groupId> |
|||
<artifactId>ojdbc8</artifactId> |
|||
<scope>runtime</scope> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>com.mysql</groupId> |
|||
<artifactId>mysql-connector-j</artifactId> |
|||
<version>8.4.0</version> <!-- or latest version --> |
|||
<scope>runtime</scope> |
|||
</dependency> |
|||
|
|||
</dependencies> |
|||
|
|||
<build> |
|||
<plugins> |
|||
<plugin> |
|||
<groupId>org.springframework.boot</groupId> |
|||
<artifactId>spring-boot-maven-plugin</artifactId> |
|||
</plugin> |
|||
</plugins> |
|||
</build> |
|||
|
|||
</project> |
|||
@ -0,0 +1,13 @@ |
|||
package com.gcc.commissionerreviewII; |
|||
|
|||
import org.springframework.boot.SpringApplication; |
|||
import org.springframework.boot.autoconfigure.SpringBootApplication; |
|||
|
|||
@SpringBootApplication |
|||
public class CommissionerreviewIiApplication { |
|||
|
|||
public static void main(String[] args) { |
|||
SpringApplication.run(CommissionerreviewIiApplication.class, args); |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,53 @@ |
|||
package com.gcc.commissionerreviewII.configuration; |
|||
|
|||
import javax.sql.DataSource; |
|||
|
|||
import org.springframework.beans.factory.annotation.Qualifier; |
|||
import org.springframework.context.annotation.Bean; |
|||
import org.springframework.context.annotation.Configuration; |
|||
import org.springframework.context.annotation.Primary; |
|||
import org.springframework.jdbc.core.JdbcTemplate; |
|||
import org.springframework.jdbc.datasource.DriverManagerDataSource; |
|||
|
|||
@Configuration |
|||
public class DataSourceConfig { |
|||
|
|||
|
|||
|
|||
@Configuration |
|||
public static class MyDataSourceConfig { |
|||
|
|||
private static final String host = "localhost"; |
|||
private static final String dbpassword = "root"; |
|||
@Primary |
|||
@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; |
|||
} |
|||
|
|||
@Bean(name = "mySqlDataSourceSofaBed") |
|||
public DataSource mySqlDataSourceSofaBed() { |
|||
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; |
|||
} |
|||
|
|||
@Bean(name = "jdbcDomesticWasteTemplate") |
|||
public JdbcTemplate jdbcDomesticWasteTemplate(@Qualifier("mySqlDataSourceSofaBed") DataSource ds) { |
|||
return new JdbcTemplate(ds); |
|||
} |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
} |
|||
@ -0,0 +1,55 @@ |
|||
package com.gcc.commissionerreviewII.controller; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
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.commissionerreviewII.service.EnforcementService; |
|||
|
|||
|
|||
@RestController |
|||
@RequestMapping("/commissionerreview/api/enforcement") |
|||
public class EnforcementApiController { |
|||
|
|||
@Autowired |
|||
private EnforcementService enforcementService; |
|||
|
|||
|
|||
@GetMapping("/getZoneWiseDetails") |
|||
public List<Map<String, Object>> getZonewisedetails() |
|||
{ |
|||
return enforcementService.getzonewisedetails(); |
|||
} |
|||
|
|||
@GetMapping("/getWardWiseDetails") |
|||
public List<Map<String, Object>> getWardwisedetails(@RequestParam String zone) |
|||
{ |
|||
return enforcementService.getwardwisedetails(zone); |
|||
} |
|||
|
|||
@GetMapping("/getFormDetails") |
|||
public List<Map<String, Object>> getFormdetails(@RequestParam String ward,@RequestParam String zone,@RequestParam String formtype,@RequestParam String status) |
|||
{ |
|||
return enforcementService.getformdetailswithzone(zone,ward,formtype,status); |
|||
} |
|||
|
|||
@GetMapping("/getFormDetailsWithoutWard") |
|||
public List<Map<String, Object>> getFormdetailsWithoutWard(@RequestParam String zone,@RequestParam String formtype,@RequestParam String status) |
|||
{ |
|||
return enforcementService.getformdetailswithoutward(zone,formtype,status); |
|||
} |
|||
|
|||
|
|||
@GetMapping("/getFormId") |
|||
public List<Map<String, Object>> getFormIddetails(@RequestParam String formid) |
|||
{ |
|||
return enforcementService.getformiddetails(formid); |
|||
} |
|||
|
|||
|
|||
} |
|||
@ -0,0 +1,101 @@ |
|||
package com.gcc.commissionerreviewII.controller; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
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.commissionerreviewII.service.EnforcementPendencyService; |
|||
|
|||
@RestController |
|||
@RequestMapping("/commissionerreview/api/pendency") |
|||
public class EnforcementPendencyApiController { |
|||
|
|||
@Autowired |
|||
private EnforcementPendencyService enforcementPendencyService; |
|||
|
|||
|
|||
|
|||
@GetMapping("/getZoneWisePendencyDetails") |
|||
public List<Map<String, Object>> getZoneWisePendencyDetails() |
|||
{ |
|||
return enforcementPendencyService.getzonewisependencydetails(); |
|||
} |
|||
|
|||
|
|||
@GetMapping("/getWardWisePendencyDetails") |
|||
public List<Map<String, Object>> getWardWisePendencyDetails(@RequestParam String zone) |
|||
{ |
|||
return enforcementPendencyService.getwardwisependencydetails(zone); |
|||
} |
|||
|
|||
|
|||
@GetMapping("/getPendencyDetailReport") |
|||
public List<Map<String, Object>> getPendencyDetailReport(@RequestParam String zone,@RequestParam String status) |
|||
{ |
|||
return enforcementPendencyService.getpendencydetailreport(zone,status); |
|||
} |
|||
|
|||
@GetMapping("/getPendencyDetailReportByWard") |
|||
public List<Map<String, Object>> getPendencyDetailReportByWard(@RequestParam String zone,@RequestParam String status,@RequestParam String ward) |
|||
{ |
|||
return enforcementPendencyService.getpendencydetailreportbyward(zone,status,ward); |
|||
} |
|||
|
|||
|
|||
// for form 3 |
|||
|
|||
@GetMapping("/getZoneWiseForm3PendencyDetails") |
|||
public List<Map<String, Object>> getZoneWiseForm3PendencyDetails() |
|||
{ |
|||
return enforcementPendencyService.getZoneWiseForm3PendencyDetails(); |
|||
} |
|||
|
|||
|
|||
@GetMapping("/getWardWiseForm3PendencyDetails") |
|||
public List<Map<String, Object>> getWardWiseForm3PendencyDetails(@RequestParam String zone) |
|||
{ |
|||
return enforcementPendencyService.getWardWiseForm3PendencyDetails(zone); |
|||
} |
|||
|
|||
|
|||
@GetMapping("/getForm3PendencyDetailReport") |
|||
public List<Map<String, Object>> getForm3PendencyDetailReport(@RequestParam String zone,@RequestParam String status) |
|||
{ |
|||
return enforcementPendencyService.getForm3PendencyDetailReport(zone,status); |
|||
} |
|||
|
|||
@GetMapping("/getForm3PendencyDetailReportByWard") |
|||
public List<Map<String, Object>> getForm3PendencyDetailReportByWard(@RequestParam String zone,@RequestParam String status,@RequestParam String ward) |
|||
{ |
|||
return enforcementPendencyService.getForm3PendencyDetailReportByWard(zone,status,ward); |
|||
} |
|||
|
|||
// for form 7 |
|||
|
|||
@GetMapping("/getZoneWiseForm7PendencyDetails") |
|||
public List<Map<String, Object>> getZoneWiseForm7PendencyDetails() { |
|||
return enforcementPendencyService.getZoneWiseForm7PendencyDetails(); |
|||
} |
|||
|
|||
|
|||
@GetMapping("/getWardWiseForm7PendencyDetails") |
|||
public List<Map<String, Object>> getWardWiseForm7PendencyDetails(@RequestParam String zone) { |
|||
return enforcementPendencyService.getWardWiseForm7PendencyDetails(zone); |
|||
} |
|||
|
|||
|
|||
@GetMapping("/getForm7PendencyDetailReportByZone") |
|||
public List<Map<String, Object>> getForm7PendencyDetailReportByZone(@RequestParam String zone, @RequestParam String status) { |
|||
return enforcementPendencyService.getForm7PendencyDetailReportByZone(zone, status); |
|||
} |
|||
|
|||
@GetMapping("/getForm7PendencyDetailReportByWard") |
|||
public List<Map<String, Object>> getForm7PendencyDetailReportByWard(@RequestParam String zone, @RequestParam String status, @RequestParam String ward) { |
|||
return enforcementPendencyService.getForm7PendencyDetailReportByWard(zone, status, ward); |
|||
} |
|||
} |
|||
@ -0,0 +1,38 @@ |
|||
package com.gcc.commissionerreviewII.controller; |
|||
|
|||
import org.springframework.stereotype.Controller; |
|||
import org.springframework.ui.Model; |
|||
import org.springframework.web.bind.annotation.GetMapping; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
|
|||
@Controller |
|||
@RequestMapping(value = {"/commissionerreview"}) |
|||
public class MainController { |
|||
|
|||
@GetMapping("/enforcement") |
|||
public String viewenforcementpage(Model model) { |
|||
return "modules/enforcement/Zonewise"; |
|||
} |
|||
|
|||
@GetMapping("/pendency") |
|||
public String viewpendencypage(Model model) { |
|||
return "modules/enforcement/form2pendency"; |
|||
} |
|||
|
|||
@GetMapping("/pendencyform3") |
|||
public String viewpendencypage2(Model model) { |
|||
return "modules/enforcement/form3Pendency"; |
|||
} |
|||
|
|||
@GetMapping("/pendencyform7") |
|||
public String viewform7pendencypage(Model model) { |
|||
return "modules/enforcement/form7pendency"; |
|||
} |
|||
|
|||
|
|||
@GetMapping("/sofacollection") |
|||
public String sofaZoneReport(Model model) { |
|||
return "modules/sofa_bed/zonewise1"; |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,77 @@ |
|||
package com.gcc.commissionerreviewII.controller; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
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.commissionerreviewII.service.SofaBedCollectionService; |
|||
|
|||
@RestController |
|||
@RequestMapping("/commissionerreview/api/sofabedcollection") |
|||
public class SofaBedCollectionApiController { |
|||
|
|||
@Autowired |
|||
private SofaBedCollectionService sofaBedCollectionService; |
|||
|
|||
@GetMapping("/getZoneWiseDetails") |
|||
public Map<String, Object> getZonewisedetails() |
|||
{ |
|||
return sofaBedCollectionService.getzonewisedetails(); |
|||
} |
|||
|
|||
@GetMapping("/getWardDetails") |
|||
public Map<String, Object> getWardDetails(@RequestParam String zone) |
|||
{ |
|||
return sofaBedCollectionService.getwarddetails(zone); |
|||
} |
|||
|
|||
@GetMapping("/getWardStatusDetails") |
|||
public Map<String, Object> getWardStatusDetails(@RequestParam String ward,@RequestParam String status) |
|||
{ |
|||
return sofaBedCollectionService.getwardstatusdetails(ward,status); |
|||
} |
|||
|
|||
// @GetMapping("/getZoneReport") |
|||
// public List<Map<String, Object>> getZoneReport(@RequestParam String fromDate,@RequestParam String toDate) |
|||
// { |
|||
// return sofaBedCollectionService.getZoneReport(fromDate,toDate); |
|||
// } |
|||
|
|||
@GetMapping("/getZoneReport") |
|||
public List<Map<String, Object>> getZoneReport() |
|||
{ |
|||
return sofaBedCollectionService.getZoneReport(); |
|||
} |
|||
|
|||
|
|||
// @GetMapping("/getWardReport") |
|||
// public List<Map<String, Object>> getWardReport(@RequestParam String fromDate,@RequestParam String toDate,@RequestParam String zone) |
|||
// { |
|||
// return sofaBedCollectionService.getWardReport(fromDate,toDate,zone); |
|||
// } |
|||
|
|||
@GetMapping("/getWardReport") |
|||
public List<Map<String, Object>> getWardReport(@RequestParam String zone) |
|||
{ |
|||
return sofaBedCollectionService.getWardReport(zone); |
|||
} |
|||
|
|||
// @GetMapping("/getWardStatusReport") |
|||
// public List<Map<String, Object>> getWardStatusDetails(@RequestParam String fromDate,@RequestParam String toDate,@RequestParam String ward,@RequestParam String status) |
|||
// { |
|||
// return sofaBedCollectionService.getWardStatusDetails(fromDate,toDate,ward,status); |
|||
// } |
|||
|
|||
|
|||
|
|||
@GetMapping("/getWardStatusReport") |
|||
public List<Map<String, Object>> getWardStatusDetail(@RequestParam String ward,@RequestParam String status) |
|||
{ |
|||
return sofaBedCollectionService.getWardStatusDetails(ward,status); |
|||
} |
|||
} |
|||
@ -0,0 +1,769 @@ |
|||
package com.gcc.commissionerreviewII.service; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
import javax.sql.DataSource; |
|||
|
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.beans.factory.annotation.Qualifier; |
|||
import org.springframework.jdbc.core.JdbcTemplate; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
@Service |
|||
public class EnforcementPendencyService { |
|||
|
|||
@Autowired |
|||
private JdbcTemplate jdbcTemplate; |
|||
|
|||
@Autowired |
|||
public void setDataSource(@Qualifier("oracleDataSource") DataSource dataSource) { |
|||
this.jdbcTemplate = new JdbcTemplate(dataSource); |
|||
} |
|||
|
|||
|
|||
public List<Map<String, Object>> getzonewisependencydetails() { |
|||
String sql = |
|||
"WITH latest_form1 AS (\r\n" |
|||
+ " SELECT \r\n" |
|||
+ " form_parentid,\r\n" |
|||
+ " MAX(id) AS max_id\r\n" |
|||
+ " FROM \r\n" |
|||
+ " EGBPA_FORM_RULES@erp\r\n" |
|||
+ " WHERE \r\n" |
|||
+ " formtype = 'Form 1'\r\n" |
|||
+ " GROUP BY \r\n" |
|||
+ " form_parentid\r\n" |
|||
+ "),\r\n" |
|||
+ "form1_data AS (\r\n" |
|||
+ " SELECT \r\n" |
|||
+ " a.form_parentid,\r\n" |
|||
+ " a.approveddate AS form1_date,\r\n" |
|||
+ " zone.name AS zone\r\n" |
|||
+ " FROM \r\n" |
|||
+ " EGBPA_FORM_RULES@erp a\r\n" |
|||
+ " JOIN latest_form1 lf ON a.id = lf.max_id\r\n" |
|||
+ " JOIN eg_boundary@erp zone ON zone.id_bndry = a.zoneid\r\n" |
|||
+ "),\r\n" |
|||
+ "form2_data AS (\r\n" |
|||
+ " SELECT \r\n" |
|||
+ " form_parentid,\r\n" |
|||
+ " MIN(approveddate) AS form2_date\r\n" |
|||
+ " FROM \r\n" |
|||
+ " EGBPA_FORM_RULES@erp\r\n" |
|||
+ " WHERE \r\n" |
|||
+ " formtype = 'Form 2'\r\n" |
|||
+ " GROUP BY \r\n" |
|||
+ " form_parentid\r\n" |
|||
+ ")\r\n" |
|||
+ "SELECT \r\n" |
|||
+ " f1.zone,\r\n" |
|||
+ " \r\n" |
|||
+ " COUNT(CASE \r\n" |
|||
+ " WHEN f2.form2_date IS NULL AND f1.form1_date <= SYSDATE - 7 \r\n" |
|||
+ " THEN 1 \r\n" |
|||
+ " END) AS \"Form 2 Not Initiated\",\r\n" |
|||
+ " \r\n" |
|||
+ " COUNT(CASE \r\n" |
|||
+ " WHEN f2.form2_date is not null and f2.form2_date > f1.form1_date + INTERVAL '7' DAY \r\n" |
|||
+ " THEN 1 \r\n" |
|||
+ " END) AS \"Form 2 Initiated After 7 Days\",\r\n" |
|||
+ " \r\n" |
|||
+ " COUNT(CASE \r\n" |
|||
+ " WHEN f2.form2_date is not null and f2.form2_date <= f1.form1_date + INTERVAL '7' DAY \r\n" |
|||
+ " THEN 1 \r\n" |
|||
+ " END) AS \"Form 2 Initiated Within 7 Days\"\r\n" |
|||
+ "\r\n" |
|||
+ "FROM \r\n" |
|||
+ " form1_data f1\r\n" |
|||
+ "LEFT JOIN \r\n" |
|||
+ " form2_data f2 ON f1.form_parentid = f2.form_parentid\r\n" |
|||
+ "GROUP BY \r\n" |
|||
+ " f1.zone\r\n" |
|||
+ "ORDER BY \r\n" |
|||
+ " f1.zone"; |
|||
|
|||
return jdbcTemplate.queryForList(sql); |
|||
} |
|||
|
|||
|
|||
|
|||
public List<Map<String, Object>> getwardwisependencydetails(String zone) { |
|||
System.out.println("openZoneModal.."+zone); |
|||
String sql = |
|||
"WITH latest_form1 AS (\r\n" |
|||
+ " SELECT \r\n" |
|||
+ " form_parentid,\r\n" |
|||
+ " MAX(id) AS max_id\r\n" |
|||
+ " FROM \r\n" |
|||
+ " EGBPA_FORM_RULES@erp\r\n" |
|||
+ " WHERE \r\n" |
|||
+ " formtype = 'Form 1'\r\n" |
|||
+ " GROUP BY \r\n" |
|||
+ " form_parentid\r\n" |
|||
+ "),\r\n" |
|||
+ "form1_data AS (\r\n" |
|||
+ " SELECT \r\n" |
|||
+ " a.form_parentid,\r\n" |
|||
+ " a.approveddate AS form1_date,\r\n" |
|||
+ " zone.name AS zone,\r\n" |
|||
+ " ward.name AS ward\r\n" |
|||
+ " FROM \r\n" |
|||
+ " EGBPA_FORM_RULES@erp a\r\n" |
|||
+ " JOIN latest_form1 lf ON a.id = lf.max_id\r\n" |
|||
+ " JOIN eg_boundary@erp zone ON zone.id_bndry = a.zoneid\r\n" |
|||
+ " JOIN eg_boundary@erp ward ON ward.id_bndry = a.wardid\r\n" |
|||
+ " WHERE zone.name = ? \r\n" |
|||
+ "),\r\n" |
|||
+ "form2_data AS (\r\n" |
|||
+ " SELECT \r\n" |
|||
+ " form_parentid,\r\n" |
|||
+ " MIN(approveddate) AS form2_date\r\n" |
|||
+ " FROM \r\n" |
|||
+ " EGBPA_FORM_RULES@erp\r\n" |
|||
+ " WHERE \r\n" |
|||
+ " formtype = 'Form 2'\r\n" |
|||
+ " GROUP BY \r\n" |
|||
+ " form_parentid\r\n" |
|||
+ ")\r\n" |
|||
+ "SELECT \r\n" |
|||
+ " f1.ward,\r\n" |
|||
+ " \r\n" |
|||
+ " COUNT(CASE \r\n" |
|||
+ " WHEN f2.form2_date IS NULL AND f1.form1_date <= SYSDATE - 7 \r\n" |
|||
+ " THEN 1 \r\n" |
|||
+ " END) AS \"Form 2 Not Initiated\",\r\n" |
|||
+ " \r\n" |
|||
+ " COUNT(CASE \r\n" |
|||
+ " WHEN f2.form2_date > f1.form1_date + INTERVAL '7' DAY \r\n" |
|||
+ " THEN 1 \r\n" |
|||
+ " END) AS \"Form 2 Initiated After 7 Days\",\r\n" |
|||
+ " \r\n" |
|||
+ " COUNT(CASE \r\n" |
|||
+ " WHEN f2.form2_date <= f1.form1_date + INTERVAL '7' DAY \r\n" |
|||
+ " THEN 1 \r\n" |
|||
+ " END) AS \"Form 2 Initiated Within 7 Days\"\r\n" |
|||
+ "\r\n" |
|||
+ "FROM \r\n" |
|||
+ " form1_data f1\r\n" |
|||
+ "LEFT JOIN \r\n" |
|||
+ " form2_data f2 ON f1.form_parentid = f2.form_parentid\r\n" |
|||
+ "GROUP BY \r\n" |
|||
+ " f1.ward\r\n" |
|||
+ "ORDER BY \r\n" |
|||
+ " f1.ward"; |
|||
|
|||
return jdbcTemplate.queryForList(sql, zone ); |
|||
} |
|||
|
|||
|
|||
|
|||
public List<Map<String, Object>> getpendencydetailreport(String zone,String status) { |
|||
String sql = "SELECT * FROM \r\n" |
|||
+ "(SELECT \r\n" |
|||
+ " zone.name AS zone,\r\n" |
|||
+ " ward.name AS ward,\r\n" |
|||
+ " addr.formid,\r\n" |
|||
+ " addr.applicant_name,\r\n" |
|||
+ " addr.area,\r\n" |
|||
+ " addr.address,\r\n" |
|||
+ " addr.pincode,\r\n" |
|||
+ " CASE \r\n" |
|||
+ " WHEN f2.form2_date IS NULL AND f1.form1_date <= SYSDATE - 7 THEN 'Form 2 Not Initiated'\r\n" |
|||
+ " WHEN f2.form2_date IS NULL AND f1.form1_date > SYSDATE - 7 THEN 'Form 2 Not Yet Due'\r\n" |
|||
+ " WHEN f2.form2_date > f1.form1_date + INTERVAL '7' DAY THEN 'Form 2 Initiated After 7 Days'\r\n" |
|||
+ " WHEN f2.form2_date <= f1.form1_date + INTERVAL '7' DAY THEN 'Form 2 Initiated Within 7 Days'\r\n" |
|||
+ " END AS form2_status\r\n" |
|||
+ "FROM \r\n" |
|||
+ " (\r\n" |
|||
+ " SELECT form_parentid, MIN(approveddate) AS form1_date\r\n" |
|||
+ " FROM EGBPA_FORM_RULES@erp\r\n" |
|||
+ " WHERE formtype = 'Form 1'\r\n" |
|||
+ " GROUP BY form_parentid\r\n" |
|||
+ " ) f1\r\n" |
|||
+ "LEFT JOIN \r\n" |
|||
+ " (\r\n" |
|||
+ " SELECT form_parentid, MIN(approveddate) AS form2_date\r\n" |
|||
+ " FROM EGBPA_FORM_RULES@erp\r\n" |
|||
+ " WHERE formtype = 'Form 2'\r\n" |
|||
+ " GROUP BY form_parentid\r\n" |
|||
+ " ) f2 ON f2.form_parentid = f1.form_parentid\r\n" |
|||
+ "JOIN \r\n" |
|||
+ " EGBPA_FORM_RULES@erp a ON a.form_parentid = f1.form_parentid\r\n" |
|||
+ "JOIN \r\n" |
|||
+ " eg_wf_states@erp b ON a.state_id = b.id\r\n" |
|||
+ "JOIN \r\n" |
|||
+ " eg_boundary@erp zone ON zone.id_bndry = a.zoneid\r\n" |
|||
+ "JOIN \r\n" |
|||
+ " eg_boundary@erp ward ON ward.id_bndry = a.wardid\r\n" |
|||
+ "LEFT JOIN \r\n" |
|||
+ " EGBPA_ENF_APP_ADDRESS@erp addr ON addr.formid = f1.form_parentid\r\n" |
|||
+ "WHERE \r\n" |
|||
+ " a.id = (\r\n" |
|||
+ " SELECT MAX(id) \r\n" |
|||
+ " FROM EGBPA_FORM_RULES@erp \r\n" |
|||
+ " WHERE form_parentid = a.form_parentid AND formtype = 'Form 1'\r\n" |
|||
+ " )" |
|||
+ " AND a.formtype = 'Form 1' " |
|||
+ " AND zone.name = ? " |
|||
+ " ORDER BY CASE " |
|||
+ " WHEN f2.form2_date IS NULL AND f1.form1_date <= SYSDATE - 7 THEN 1 " |
|||
+ " WHEN f2.form2_date IS NULL AND f1.form1_date > SYSDATE - 7 THEN 2 " |
|||
+ " WHEN f2.form2_date > f1.form1_date + INTERVAL '7' DAY THEN 3 " |
|||
+ " WHEN f2.form2_date <= f1.form1_date + INTERVAL '7' DAY THEN 4 " |
|||
+ " ELSE 5 " |
|||
+ " END " |
|||
+ ") " |
|||
+ "WHERE FORM2_STATUS = ? "; |
|||
|
|||
return jdbcTemplate.queryForList(sql,zone,status); |
|||
} |
|||
|
|||
|
|||
public List<Map<String, Object>> getpendencydetailreportbyward(String zone, String status, String ward) { |
|||
|
|||
String sql = "SELECT * FROM \r\n" |
|||
+ "(SELECT \r\n" |
|||
+ " zone.name AS zone,\r\n" |
|||
+ " ward.name AS ward,\r\n" |
|||
+ " addr.formid,\r\n" |
|||
+ " addr.applicant_name,\r\n" |
|||
+ " addr.area,\r\n" |
|||
+ " addr.address,\r\n" |
|||
+ " addr.pincode,\r\n" |
|||
+ " CASE \r\n" |
|||
+ " WHEN f2.form2_date IS NULL AND f1.form1_date <= SYSDATE - 7 THEN 'Form 2 Not Initiated'\r\n" |
|||
+ " WHEN f2.form2_date IS NULL AND f1.form1_date > SYSDATE - 7 THEN 'Form 2 Not Yet Due'\r\n" |
|||
+ " WHEN f2.form2_date > f1.form1_date + INTERVAL '7' DAY THEN 'Form 2 Initiated After 7 Days'\r\n" |
|||
+ " WHEN f2.form2_date <= f1.form1_date + INTERVAL '7' DAY THEN 'Form 2 Initiated Within 7 Days'\r\n" |
|||
+ " END AS form2_status\r\n" |
|||
+ "FROM \r\n" |
|||
+ " (\r\n" |
|||
+ " SELECT form_parentid, MIN(approveddate) AS form1_date\r\n" |
|||
+ " FROM EGBPA_FORM_RULES@erp\r\n" |
|||
+ " WHERE formtype = 'Form 1'\r\n" |
|||
+ " GROUP BY form_parentid\r\n" |
|||
+ " ) f1\r\n" |
|||
+ "LEFT JOIN \r\n" |
|||
+ " (\r\n" |
|||
+ " SELECT form_parentid, MIN(approveddate) AS form2_date\r\n" |
|||
+ " FROM EGBPA_FORM_RULES@erp\r\n" |
|||
+ " WHERE formtype = 'Form 2'\r\n" |
|||
+ " GROUP BY form_parentid\r\n" |
|||
+ " ) f2 ON f2.form_parentid = f1.form_parentid\r\n" |
|||
+ "JOIN \r\n" |
|||
+ " EGBPA_FORM_RULES@erp a ON a.form_parentid = f1.form_parentid\r\n" |
|||
+ "JOIN \r\n" |
|||
+ " eg_wf_states@erp b ON a.state_id = b.id\r\n" |
|||
+ "JOIN \r\n" |
|||
+ " eg_boundary@erp zone ON zone.id_bndry = a.zoneid\r\n" |
|||
+ "JOIN \r\n" |
|||
+ " eg_boundary@erp ward ON ward.id_bndry = a.wardid\r\n" |
|||
+ "LEFT JOIN \r\n" |
|||
+ " EGBPA_ENF_APP_ADDRESS@erp addr ON addr.formid = f1.form_parentid\r\n" |
|||
+ "WHERE \r\n" |
|||
+ " a.id = (\r\n" |
|||
+ " SELECT MAX(id) \r\n" |
|||
+ " FROM EGBPA_FORM_RULES@erp \r\n" |
|||
+ " WHERE form_parentid = a.form_parentid AND formtype = 'Form 1'\r\n" |
|||
+ " )" |
|||
+ " AND a.formtype = 'Form 1' " |
|||
+ " AND zone.name = ? " |
|||
+ " AND ward.name = ? " |
|||
+ " ORDER BY CASE " |
|||
+ " WHEN f2.form2_date IS NULL AND f1.form1_date <= SYSDATE - 7 THEN 1 " |
|||
+ " WHEN f2.form2_date IS NULL AND f1.form1_date > SYSDATE - 7 THEN 2 " |
|||
+ " WHEN f2.form2_date > f1.form1_date + INTERVAL '7' DAY THEN 3 " |
|||
+ " WHEN f2.form2_date <= f1.form1_date + INTERVAL '7' DAY THEN 4 " |
|||
+ " ELSE 5 " |
|||
+ " END " |
|||
+ ") " |
|||
+ "WHERE FORM2_STATUS = ? "; |
|||
|
|||
return jdbcTemplate.queryForList(sql,zone,ward,status); |
|||
} |
|||
|
|||
|
|||
////////////////////////////////////////////////////////////////////// |
|||
|
|||
public List<Map<String, Object>> getZoneWiseForm3PendencyDetails() { |
|||
|
|||
String sql = "WITH latest_form2 AS (\r\n" |
|||
+ " SELECT \r\n" |
|||
+ " form_parentid,\r\n" |
|||
+ " MAX(id) AS max_id\r\n" |
|||
+ " FROM \r\n" |
|||
+ " EGBPA_FORM_RULES@erp\r\n" |
|||
+ " WHERE \r\n" |
|||
+ " formtype = 'Form 2'\r\n" |
|||
+ " GROUP BY \r\n" |
|||
+ " form_parentid\r\n" |
|||
+ "),\r\n" |
|||
+ "form2_data AS (\r\n" |
|||
+ " SELECT \r\n" |
|||
+ " a.form_parentid,\r\n" |
|||
+ " a.approveddate AS form2_date,\r\n" |
|||
+ " zone.name AS zone\r\n" |
|||
+ " FROM \r\n" |
|||
+ " EGBPA_FORM_RULES@erp a\r\n" |
|||
+ " JOIN latest_form2 lf ON a.id = lf.max_id\r\n" |
|||
+ " JOIN eg_boundary@erp zone ON zone.id_bndry = a.zoneid\r\n" |
|||
+ "),\r\n" |
|||
+ "form3_4_data AS (\r\n" |
|||
+ " SELECT \r\n" |
|||
+ " form_parentid,\r\n" |
|||
+ " MIN(approveddate) AS form3_4_date\r\n" |
|||
+ " FROM \r\n" |
|||
+ " EGBPA_FORM_RULES@erp\r\n" |
|||
+ " WHERE \r\n" |
|||
+ " formtype IN ('Form 3', 'Form 4')\r\n" |
|||
+ " GROUP BY \r\n" |
|||
+ " form_parentid\r\n" |
|||
+ ")\r\n" |
|||
+ "\r\n" |
|||
+ "SELECT \r\n" |
|||
+ " f2.zone,\r\n" |
|||
+ " \r\n" |
|||
+ " COUNT(CASE \r\n" |
|||
+ " WHEN f34.form3_4_date IS NULL AND f2.form2_date <= SYSDATE - 15 \r\n" |
|||
+ " THEN 1 \r\n" |
|||
+ " END) AS \"Not Initiated\",\r\n" |
|||
+ " \r\n" |
|||
+ " COUNT(CASE \r\n" |
|||
+ " WHEN f34.form3_4_date > f2.form2_date + INTERVAL '15' DAY \r\n" |
|||
+ " THEN 1 \r\n" |
|||
+ " END) AS \"After 15 Days\",\r\n" |
|||
+ " \r\n" |
|||
+ " COUNT(CASE \r\n" |
|||
+ " WHEN f34.form3_4_date <= f2.form2_date + INTERVAL '15' DAY \r\n" |
|||
+ " THEN 1 \r\n" |
|||
+ " END) AS \"Within 15 Days\"\r\n" |
|||
+ "\r\n" |
|||
+ "FROM \r\n" |
|||
+ " form2_data f2\r\n" |
|||
+ "LEFT JOIN \r\n" |
|||
+ " form3_4_data f34 ON f2.form_parentid = f34.form_parentid\r\n" |
|||
+ "GROUP BY \r\n" |
|||
+ " f2.zone\r\n" |
|||
+ "ORDER BY \r\n" |
|||
+ " f2.zone"; |
|||
|
|||
|
|||
return jdbcTemplate.queryForList(sql); |
|||
} |
|||
|
|||
|
|||
public List<Map<String, Object>> getWardWiseForm3PendencyDetails(String zone) { |
|||
String sql="WITH latest_form2 AS (\r\n" |
|||
+ " SELECT \r\n" |
|||
+ " form_parentid,\r\n" |
|||
+ " MAX(id) AS max_id\r\n" |
|||
+ " FROM \r\n" |
|||
+ " EGBPA_FORM_RULES@erp\r\n" |
|||
+ " WHERE \r\n" |
|||
+ " formtype = 'Form 2'\r\n" |
|||
+ " GROUP BY \r\n" |
|||
+ " form_parentid\r\n" |
|||
+ "),\r\n" |
|||
+ "form2_data AS (\r\n" |
|||
+ " SELECT \r\n" |
|||
+ " a.form_parentid,\r\n" |
|||
+ " a.approveddate AS form2_date,\r\n" |
|||
+ " zone.name AS zone,\r\n" |
|||
+ " ward.name AS ward\r\n" |
|||
+ " FROM \r\n" |
|||
+ " EGBPA_FORM_RULES@erp a\r\n" |
|||
+ " JOIN latest_form2 lf ON a.id = lf.max_id\r\n" |
|||
+ " JOIN eg_boundary@erp zone ON zone.id_bndry = a.zoneid\r\n" |
|||
+ " JOIN eg_boundary@erp ward ON ward.id_bndry = a.wardid\r\n" |
|||
+ "),\r\n" |
|||
+ "form3_4_data AS (\r\n" |
|||
+ " SELECT \r\n" |
|||
+ " form_parentid,\r\n" |
|||
+ " MIN(approveddate) AS form3_4_date\r\n" |
|||
+ " FROM \r\n" |
|||
+ " EGBPA_FORM_RULES@erp\r\n" |
|||
+ " WHERE \r\n" |
|||
+ " formtype IN ('Form 3', 'Form 4')\r\n" |
|||
+ " GROUP BY \r\n" |
|||
+ " form_parentid\r\n" |
|||
+ ")\r\n" |
|||
+ "\r\n" |
|||
+ "SELECT \r\n" |
|||
+ " f2.zone,\r\n" |
|||
+ " f2.ward,\r\n" |
|||
+ " \r\n" |
|||
+ " COUNT(CASE \r\n" |
|||
+ " WHEN f34.form3_4_date IS NULL AND f2.form2_date <= SYSDATE - 15 \r\n" |
|||
+ " THEN 1 \r\n" |
|||
+ " END) AS \"Not Initiated\",\r\n" |
|||
+ " \r\n" |
|||
+ " COUNT(CASE \r\n" |
|||
+ " WHEN f34.form3_4_date > f2.form2_date + INTERVAL '15' DAY \r\n" |
|||
+ " THEN 1 \r\n" |
|||
+ " END) AS \"After 15 Days\",\r\n" |
|||
+ " \r\n" |
|||
+ " COUNT(CASE \r\n" |
|||
+ " WHEN f34.form3_4_date <= f2.form2_date + INTERVAL '15' DAY \r\n" |
|||
+ " THEN 1 \r\n" |
|||
+ " END) AS \"Within 15 Days\"\r\n" |
|||
+ "\r\n" |
|||
+ "FROM \r\n" |
|||
+ " form2_data f2\r\n" |
|||
+ "LEFT JOIN \r\n" |
|||
+ " form3_4_data f34 ON f2.form_parentid = f34.form_parentid\r\n" |
|||
+ "WHERE \r\n" |
|||
+ " f2.zone = ? \r\n" |
|||
+ "GROUP BY \r\n" |
|||
+ " f2.zone, f2.ward\r\n" |
|||
+ "ORDER BY \r\n" |
|||
+ " f2.zone, f2.ward"; |
|||
|
|||
return jdbcTemplate.queryForList(sql,zone); |
|||
} |
|||
|
|||
|
|||
public List<Map<String, Object>> getForm3PendencyDetailReport(String zone, String status) { |
|||
|
|||
String sql="SELECT * FROM \r\n" |
|||
+ "(\r\n" |
|||
+ " SELECT \r\n" |
|||
+ " zone.name AS zone,\r\n" |
|||
+ " ward.name AS ward,\r\n" |
|||
+ " addr.formid,\r\n" |
|||
+ " addr.applicant_name,\r\n" |
|||
+ " addr.area,\r\n" |
|||
+ " addr.address,\r\n" |
|||
+ " addr.pincode,\r\n" |
|||
+ " \r\n" |
|||
+ " CASE \r\n" |
|||
+ " WHEN f34.form3_4_date IS NULL AND f2.form2_date <= SYSDATE - 15 THEN 'Form 3/4 Not Initiated'\r\n" |
|||
+ " WHEN f34.form3_4_date IS NULL AND f2.form2_date > SYSDATE - 15 THEN 'Form 3/4 Not Yet Due'\r\n" |
|||
+ " WHEN f34.form3_4_date > f2.form2_date + INTERVAL '15' DAY THEN 'Form 3/4 Initiated After 15 Days'\r\n" |
|||
+ " WHEN f34.form3_4_date <= f2.form2_date + INTERVAL '15' DAY THEN 'Form 3/4 Initiated Within 15 Days'\r\n" |
|||
+ " ELSE 'Unknown Status'\r\n" |
|||
+ " END AS form3_4_status\r\n" |
|||
+ "\r\n" |
|||
+ " FROM \r\n" |
|||
+ " (\r\n" |
|||
+ " SELECT form_parentid, MIN(approveddate) AS form2_date\r\n" |
|||
+ " FROM EGBPA_FORM_RULES@erp\r\n" |
|||
+ " WHERE formtype = 'Form 2'\r\n" |
|||
+ " GROUP BY form_parentid\r\n" |
|||
+ " ) f2\r\n" |
|||
+ " LEFT JOIN \r\n" |
|||
+ " (\r\n" |
|||
+ " SELECT form_parentid, MIN(approveddate) AS form3_4_date\r\n" |
|||
+ " FROM EGBPA_FORM_RULES@erp\r\n" |
|||
+ " WHERE formtype IN ('Form 3', 'Form 4')\r\n" |
|||
+ " GROUP BY form_parentid\r\n" |
|||
+ " ) f34 ON f34.form_parentid = f2.form_parentid\r\n" |
|||
+ "\r\n" |
|||
+ " JOIN \r\n" |
|||
+ " EGBPA_FORM_RULES@erp a ON a.form_parentid = f2.form_parentid\r\n" |
|||
+ " JOIN \r\n" |
|||
+ " eg_wf_states@erp b ON a.state_id = b.id\r\n" |
|||
+ " JOIN \r\n" |
|||
+ " eg_boundary@erp zone ON zone.id_bndry = a.zoneid\r\n" |
|||
+ " JOIN \r\n" |
|||
+ " eg_boundary@erp ward ON ward.id_bndry = a.wardid\r\n" |
|||
+ " LEFT JOIN \r\n" |
|||
+ " EGBPA_ENF_APP_ADDRESS@erp addr ON addr.formid = f2.form_parentid\r\n" |
|||
+ "\r\n" |
|||
+ " WHERE \r\n" |
|||
+ " a.id = (\r\n" |
|||
+ " SELECT MAX(id) \r\n" |
|||
+ " FROM EGBPA_FORM_RULES@erp \r\n" |
|||
+ " WHERE form_parentid = a.form_parentid AND formtype = 'Form 2'\r\n" |
|||
+ " )\r\n" |
|||
+ " AND a.formtype = 'Form 2'\r\n" |
|||
+ " AND zone.name = ? -- Change to your required zone\r\n" |
|||
+ "\r\n" |
|||
+ " ORDER BY \r\n" |
|||
+ " CASE \r\n" |
|||
+ " WHEN f34.form3_4_date IS NULL AND f2.form2_date <= SYSDATE - 15 THEN 1\r\n" |
|||
+ " WHEN f34.form3_4_date IS NULL AND f2.form2_date > SYSDATE - 15 THEN 2\r\n" |
|||
+ " WHEN f34.form3_4_date > f2.form2_date + INTERVAL '15' DAY THEN 3\r\n" |
|||
+ " WHEN f34.form3_4_date <= f2.form2_date + INTERVAL '15' DAY THEN 4\r\n" |
|||
+ " ELSE 5\r\n" |
|||
+ " END\r\n" |
|||
+ ")\r\n" |
|||
+ "WHERE form3_4_status = ? "; |
|||
|
|||
return jdbcTemplate.queryForList(sql,zone,status); |
|||
} |
|||
|
|||
|
|||
public List<Map<String, Object>> getForm3PendencyDetailReportByWard(String zone, String status, String ward) { |
|||
|
|||
String sql="SELECT * FROM \r\n" |
|||
+ "(\r\n" |
|||
+ " SELECT \r\n" |
|||
+ " zone.name AS zone,\r\n" |
|||
+ " ward.name AS ward,\r\n" |
|||
+ " addr.formid,\r\n" |
|||
+ " addr.applicant_name,\r\n" |
|||
+ " addr.area,\r\n" |
|||
+ " addr.address,\r\n" |
|||
+ " addr.pincode,\r\n" |
|||
+ " \r\n" |
|||
+ " CASE \r\n" |
|||
+ " WHEN f34.form3_4_date IS NULL AND f2.form2_date <= SYSDATE - 15 THEN 'Form 3/4 Not Initiated'\r\n" |
|||
+ " WHEN f34.form3_4_date IS NULL AND f2.form2_date > SYSDATE - 15 THEN 'Form 3/4 Not Yet Due'\r\n" |
|||
+ " WHEN f34.form3_4_date > f2.form2_date + INTERVAL '15' DAY THEN 'Form 3/4 Initiated After 15 Days'\r\n" |
|||
+ " WHEN f34.form3_4_date <= f2.form2_date + INTERVAL '15' DAY THEN 'Form 3/4 Initiated Within 15 Days'\r\n" |
|||
+ " ELSE 'Unknown Status'\r\n" |
|||
+ " END AS form3_4_status\r\n" |
|||
+ "\r\n" |
|||
+ " FROM \r\n" |
|||
+ " (\r\n" |
|||
+ " SELECT form_parentid, MIN(approveddate) AS form2_date\r\n" |
|||
+ " FROM EGBPA_FORM_RULES@erp\r\n" |
|||
+ " WHERE formtype = 'Form 2'\r\n" |
|||
+ " GROUP BY form_parentid\r\n" |
|||
+ " ) f2\r\n" |
|||
+ " LEFT JOIN \r\n" |
|||
+ " (\r\n" |
|||
+ " SELECT form_parentid, MIN(approveddate) AS form3_4_date\r\n" |
|||
+ " FROM EGBPA_FORM_RULES@erp\r\n" |
|||
+ " WHERE formtype IN ('Form 3', 'Form 4')\r\n" |
|||
+ " GROUP BY form_parentid\r\n" |
|||
+ " ) f34 ON f34.form_parentid = f2.form_parentid\r\n" |
|||
+ "\r\n" |
|||
+ " JOIN \r\n" |
|||
+ " EGBPA_FORM_RULES@erp a ON a.form_parentid = f2.form_parentid\r\n" |
|||
+ " JOIN \r\n" |
|||
+ " eg_wf_states@erp b ON a.state_id = b.id\r\n" |
|||
+ " JOIN \r\n" |
|||
+ " eg_boundary@erp zone ON zone.id_bndry = a.zoneid\r\n" |
|||
+ " JOIN \r\n" |
|||
+ " eg_boundary@erp ward ON ward.id_bndry = a.wardid\r\n" |
|||
+ " LEFT JOIN \r\n" |
|||
+ " EGBPA_ENF_APP_ADDRESS@erp addr ON addr.formid = f2.form_parentid\r\n" |
|||
+ "\r\n" |
|||
+ " WHERE \r\n" |
|||
+ " a.id = (\r\n" |
|||
+ " SELECT MAX(id) \r\n" |
|||
+ " FROM EGBPA_FORM_RULES@erp \r\n" |
|||
+ " WHERE form_parentid = a.form_parentid AND formtype = 'Form 2'\r\n" |
|||
+ " )\r\n" |
|||
+ " AND a.formtype = 'Form 2'\r\n" |
|||
+ " AND zone.name = ? -- Change to your required zone\r\n" |
|||
+ " AND ward.name = ? \r\n" |
|||
+ "\r\n" |
|||
+ " ORDER BY \r\n" |
|||
+ " CASE \r\n" |
|||
+ " WHEN f34.form3_4_date IS NULL AND f2.form2_date <= SYSDATE - 15 THEN 1\r\n" |
|||
+ " WHEN f34.form3_4_date IS NULL AND f2.form2_date > SYSDATE - 15 THEN 2\r\n" |
|||
+ " WHEN f34.form3_4_date > f2.form2_date + INTERVAL '15' DAY THEN 3\r\n" |
|||
+ " WHEN f34.form3_4_date <= f2.form2_date + INTERVAL '15' DAY THEN 4\r\n" |
|||
+ " ELSE 5\r\n" |
|||
+ " END\r\n" |
|||
+ ")\r\n" |
|||
+ "WHERE form3_4_status = ?"; |
|||
|
|||
return jdbcTemplate.queryForList(sql,zone,ward,status); |
|||
} |
|||
|
|||
////////////////////////////////////////////////////////////////////////////////// |
|||
|
|||
|
|||
public List<Map<String, Object>> getZoneWiseForm7PendencyDetails() { |
|||
String sql = "WITH latest_form3_4 AS (\r\n" |
|||
+ " SELECT form_parentid, MIN(approveddate) AS form3_4_date\r\n" |
|||
+ " FROM EGBPA_FORM_RULES@erp\r\n" |
|||
+ " WHERE formtype IN ('Form 3', 'Form 4')\r\n" |
|||
+ " GROUP BY form_parentid\r\n" |
|||
+ "),\r\n" |
|||
+ "latest_form7 AS (\r\n" |
|||
+ " SELECT form_parentid, MIN(approveddate) AS form7_date\r\n" |
|||
+ " FROM EGBPA_FORM_RULES@erp\r\n" |
|||
+ " WHERE formtype = 'Form 7'\r\n" |
|||
+ " GROUP BY form_parentid\r\n" |
|||
+ "),\r\n" |
|||
+ "combined_data AS (\r\n" |
|||
+ " SELECT\r\n" |
|||
+ " f3_4.form_parentid,\r\n" |
|||
+ " f3_4.form3_4_date,\r\n" |
|||
+ " f7.form7_date\r\n" |
|||
+ " FROM latest_form3_4 f3_4\r\n" |
|||
+ " LEFT JOIN latest_form7 f7 ON f3_4.form_parentid = f7.form_parentid\r\n" |
|||
+ "),\r\n" |
|||
+ "zone_data AS (\r\n" |
|||
+ " SELECT\r\n" |
|||
+ " a.zoneid,\r\n" |
|||
+ " zone.name AS zone,\r\n" |
|||
+ " cd.form3_4_date,\r\n" |
|||
+ " cd.form7_date\r\n" |
|||
+ " FROM combined_data cd\r\n" |
|||
+ " JOIN EGBPA_FORM_RULES@erp a ON a.form_parentid = cd.form_parentid AND a.formtype IN ('Form 3', 'Form 4')\r\n" |
|||
+ " JOIN eg_boundary@erp zone ON zone.id_bndry = a.zoneid\r\n" |
|||
+ " WHERE a.id = (\r\n" |
|||
+ " SELECT MAX(id) \r\n" |
|||
+ " FROM EGBPA_FORM_RULES@erp \r\n" |
|||
+ " WHERE form_parentid = a.form_parentid AND formtype IN ('Form 3', 'Form 4')\r\n" |
|||
+ " )\r\n" |
|||
+ ")\r\n" |
|||
+ "SELECT\r\n" |
|||
+ " zone,\r\n" |
|||
+ " COUNT(CASE WHEN form7_date IS NULL AND form3_4_date <= SYSDATE - 30 THEN 1 END) AS \"F7 Not Initiated After 30 Days\",\r\n" |
|||
+ " COUNT(CASE WHEN form7_date > form3_4_date + INTERVAL '30' DAY THEN 1 END) AS \"F7 Initiated After 30 Days\",\r\n" |
|||
+ " COUNT(CASE WHEN form7_date IS NOT NULL AND form7_date <= form3_4_date + INTERVAL '30' DAY THEN 1 END) AS \"F7 Initiated Within 30 Days\"\r\n" |
|||
+ "FROM zone_data\r\n" |
|||
+ "GROUP BY zone\r\n" |
|||
+ "ORDER BY zone"; |
|||
return jdbcTemplate.queryForList(sql); |
|||
} |
|||
|
|||
public List<Map<String, Object>> getWardWiseForm7PendencyDetails(String zone) { |
|||
String sql = "WITH form3_4 AS (\r\n" |
|||
+ " SELECT form_parentid, MIN(approveddate) AS form3_4_date\r\n" |
|||
+ " FROM EGBPA_FORM_RULES@erp\r\n" |
|||
+ " WHERE formtype IN ('Form 3', 'Form 4')\r\n" |
|||
+ " GROUP BY form_parentid\r\n" |
|||
+ "),\r\n" |
|||
+ "form7 AS (\r\n" |
|||
+ " SELECT form_parentid, MIN(approveddate) AS form7_date\r\n" |
|||
+ " FROM EGBPA_FORM_RULES@erp\r\n" |
|||
+ " WHERE formtype = 'Form 7'\r\n" |
|||
+ " GROUP BY form_parentid\r\n" |
|||
+ "),\r\n" |
|||
+ "combined AS (\r\n" |
|||
+ " SELECT\r\n" |
|||
+ " f34.form_parentid,\r\n" |
|||
+ " f34.form3_4_date,\r\n" |
|||
+ " f7.form7_date\r\n" |
|||
+ " FROM form3_4 f34\r\n" |
|||
+ " LEFT JOIN form7 f7 ON f34.form_parentid = f7.form_parentid\r\n" |
|||
+ "),\r\n" |
|||
+ "ward_data AS (\r\n" |
|||
+ " SELECT\r\n" |
|||
+ " ward.name AS ward,\r\n" |
|||
+ " zone.name AS zone,\r\n" |
|||
+ " c.form3_4_date,\r\n" |
|||
+ " c.form7_date\r\n" |
|||
+ " FROM combined c\r\n" |
|||
+ " JOIN EGBPA_FORM_RULES@erp a ON a.form_parentid = c.form_parentid\r\n" |
|||
+ " JOIN eg_boundary@erp zone ON zone.id_bndry = a.zoneid\r\n" |
|||
+ " JOIN eg_boundary@erp ward ON ward.id_bndry = a.wardid\r\n" |
|||
+ " WHERE a.id = (\r\n" |
|||
+ " SELECT MAX(id) FROM EGBPA_FORM_RULES@erp \r\n" |
|||
+ " WHERE form_parentid = a.form_parentid AND formtype IN ('Form 3', 'Form 4')\r\n" |
|||
+ " )\r\n" |
|||
+ " AND a.formtype IN ('Form 3', 'Form 4')\r\n" |
|||
+ " AND zone.name = ? \r\n" |
|||
+ ")\r\n" |
|||
+ "SELECT\r\n" |
|||
+ " ward,\r\n" |
|||
+ " COUNT(CASE WHEN form7_date IS NULL AND form3_4_date <= SYSDATE - 30 THEN 1 END) AS \"F7 Not Initiated After 30 Days\",\r\n" |
|||
+ " COUNT(CASE WHEN form7_date > form3_4_date + INTERVAL '30' DAY THEN 1 END) AS \"F7 Initiated After 30 Days\",\r\n" |
|||
+ " COUNT(CASE WHEN form7_date IS NOT NULL AND form7_date <= form3_4_date + INTERVAL '30' DAY THEN 1 END) AS \"F7 Initiated Within 30 Days\"\r\n" |
|||
+ "FROM ward_data\r\n" |
|||
+ "GROUP BY ward\r\n" |
|||
+ "ORDER BY ward"; |
|||
return jdbcTemplate.queryForList(sql, zone); |
|||
} |
|||
|
|||
public List<Map<String, Object>> getForm7PendencyDetailReportByZone(String zone, String status) { |
|||
String sql = "SELECT *\r\n" |
|||
+ "FROM (\r\n" |
|||
+ " SELECT \r\n" |
|||
+ " zone.name AS zone,\r\n" |
|||
+ " ward.name AS ward,\r\n" |
|||
+ " addr.formid,\r\n" |
|||
+ " addr.applicant_name,\r\n" |
|||
+ " addr.area,\r\n" |
|||
+ " addr.address,\r\n" |
|||
+ " addr.pincode,\r\n" |
|||
+ " f34.form3_4_date,\r\n" |
|||
+ " f7.form7_date,\r\n" |
|||
+ " CASE \r\n" |
|||
+ " WHEN f7.form7_date IS NULL AND f34.form3_4_date <= SYSDATE - 30 THEN 'Form 7 Not Initiated After 30 Days'\r\n" |
|||
+ " WHEN f7.form7_date IS NULL AND f34.form3_4_date > SYSDATE - 30 THEN 'Form 7 Not Yet Due'\r\n" |
|||
+ " WHEN f7.form7_date > f34.form3_4_date + INTERVAL '30' DAY THEN 'Form 7 Initiated After 30 Days'\r\n" |
|||
+ " WHEN f7.form7_date <= f34.form3_4_date + INTERVAL '30' DAY THEN 'Form 7 Initiated Within 30 Days'\r\n" |
|||
+ " ELSE 'Unknown'\r\n" |
|||
+ " END AS form7_status\r\n" |
|||
+ " FROM (\r\n" |
|||
+ " SELECT form_parentid, MIN(approveddate) AS form3_4_date\r\n" |
|||
+ " FROM EGBPA_FORM_RULES@erp\r\n" |
|||
+ " WHERE formtype IN ('Form 3', 'Form 4')\r\n" |
|||
+ " GROUP BY form_parentid\r\n" |
|||
+ " ) f34\r\n" |
|||
+ " LEFT JOIN (\r\n" |
|||
+ " SELECT form_parentid, MIN(approveddate) AS form7_date\r\n" |
|||
+ " FROM EGBPA_FORM_RULES@erp\r\n" |
|||
+ " WHERE formtype = 'Form 7'\r\n" |
|||
+ " GROUP BY form_parentid\r\n" |
|||
+ " ) f7 ON f34.form_parentid = f7.form_parentid\r\n" |
|||
+ " JOIN EGBPA_FORM_RULES@erp a ON a.form_parentid = f34.form_parentid\r\n" |
|||
+ " JOIN eg_boundary@erp zone ON zone.id_bndry = a.zoneid\r\n" |
|||
+ " JOIN eg_boundary@erp ward ON ward.id_bndry = a.wardid\r\n" |
|||
+ " LEFT JOIN EGBPA_ENF_APP_ADDRESS@erp addr ON addr.formid = f34.form_parentid\r\n" |
|||
+ " WHERE a.id = (\r\n" |
|||
+ " SELECT MAX(id)\r\n" |
|||
+ " FROM EGBPA_FORM_RULES@erp\r\n" |
|||
+ " WHERE form_parentid = a.form_parentid AND formtype IN ('Form 3', 'Form 4')\r\n" |
|||
+ " )\r\n" |
|||
+ " AND a.formtype IN ('Form 3', 'Form 4')" + |
|||
" AND zone.name = ? " + |
|||
" ) " + |
|||
"WHERE form7_status = ? "+ |
|||
" ORDER BY form7_status, form3_4_date" ; |
|||
return jdbcTemplate.queryForList(sql, zone, status); |
|||
} |
|||
|
|||
public List<Map<String, Object>> getForm7PendencyDetailReportByWard(String zone, String status, String ward) { |
|||
String sql = "SELECT *\r\n" |
|||
+ "FROM (\r\n" |
|||
+ " SELECT \r\n" |
|||
+ " zone.name AS zone,\r\n" |
|||
+ " ward.name AS ward,\r\n" |
|||
+ " addr.formid,\r\n" |
|||
+ " addr.applicant_name,\r\n" |
|||
+ " addr.area,\r\n" |
|||
+ " addr.address,\r\n" |
|||
+ " addr.pincode,\r\n" |
|||
+ " f34.form3_4_date,\r\n" |
|||
+ " f7.form7_date,\r\n" |
|||
+ " CASE \r\n" |
|||
+ " WHEN f7.form7_date IS NULL AND f34.form3_4_date <= SYSDATE - 30 THEN 'Form 7 Not Initiated After 30 Days'\r\n" |
|||
+ " WHEN f7.form7_date IS NULL AND f34.form3_4_date > SYSDATE - 30 THEN 'Form 7 Not Yet Due'\r\n" |
|||
+ " WHEN f7.form7_date > f34.form3_4_date + INTERVAL '30' DAY THEN 'Form 7 Initiated After 30 Days'\r\n" |
|||
+ " WHEN f7.form7_date <= f34.form3_4_date + INTERVAL '30' DAY THEN 'Form 7 Initiated Within 30 Days'\r\n" |
|||
+ " ELSE 'Unknown'\r\n" |
|||
+ " END AS form7_status\r\n" |
|||
+ " FROM (\r\n" |
|||
+ " SELECT form_parentid, MIN(approveddate) AS form3_4_date\r\n" |
|||
+ " FROM EGBPA_FORM_RULES@erp\r\n" |
|||
+ " WHERE formtype IN ('Form 3', 'Form 4')\r\n" |
|||
+ " GROUP BY form_parentid\r\n" |
|||
+ " ) f34\r\n" |
|||
+ " LEFT JOIN (\r\n" |
|||
+ " SELECT form_parentid, MIN(approveddate) AS form7_date\r\n" |
|||
+ " FROM EGBPA_FORM_RULES@erp\r\n" |
|||
+ " WHERE formtype = 'Form 7'\r\n" |
|||
+ " GROUP BY form_parentid\r\n" |
|||
+ " ) f7 ON f34.form_parentid = f7.form_parentid\r\n" |
|||
+ " JOIN EGBPA_FORM_RULES@erp a ON a.form_parentid = f34.form_parentid\r\n" |
|||
+ " JOIN eg_boundary@erp zone ON zone.id_bndry = a.zoneid\r\n" |
|||
+ " JOIN eg_boundary@erp ward ON ward.id_bndry = a.wardid\r\n" |
|||
+ " LEFT JOIN EGBPA_ENF_APP_ADDRESS@erp addr ON addr.formid = f34.form_parentid\r\n" |
|||
+ " WHERE a.id = (\r\n" |
|||
+ " SELECT MAX(id)\r\n" |
|||
+ " FROM EGBPA_FORM_RULES@erp\r\n" |
|||
+ " WHERE form_parentid = a.form_parentid AND formtype IN ('Form 3', 'Form 4')\r\n" |
|||
+ " )\r\n" |
|||
+ " AND a.formtype IN ('Form 3', 'Form 4')" + |
|||
" AND zone.name = ? " + |
|||
" AND ward.name = ? " + |
|||
") " + |
|||
"WHERE form7_status = ? "+ |
|||
"ORDER BY form7_status, form3_4_date "; |
|||
; |
|||
return jdbcTemplate.queryForList(sql, zone, ward, status); |
|||
} |
|||
|
|||
|
|||
|
|||
} |
|||
@ -0,0 +1,304 @@ |
|||
package com.gcc.commissionerreviewII.service; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
import javax.sql.DataSource; |
|||
|
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.beans.factory.annotation.Qualifier; |
|||
import org.springframework.http.ResponseEntity; |
|||
import org.springframework.jdbc.core.JdbcTemplate; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
@Service |
|||
public class EnforcementService { |
|||
|
|||
@Autowired |
|||
private JdbcTemplate jdbcTemplate; |
|||
|
|||
@Autowired |
|||
public void setDataSource(@Qualifier("oracleDataSource") DataSource dataSource) { |
|||
this.jdbcTemplate = new JdbcTemplate(dataSource); |
|||
} |
|||
|
|||
public List<Map<String, Object>> getzonewisedetails() |
|||
{ |
|||
|
|||
String sql="select zone.name zone,\r\n" |
|||
+ "sum(case when formtype='Form 1' then 1 else 0 end) form1_recieved,\r\n" |
|||
+ "sum(case when formtype='Form 1' and b.value!='END' then 1 else 0 end) form1_inprogress,\r\n" |
|||
+ "sum(case when formtype='Form 1' and b.value='END' then 1 else 0 end) form1_completed,\r\n" |
|||
+ "sum(case when formtype='Form 2' then 1 else 0 end) form2_recieved,\r\n" |
|||
+ "sum(case when formtype='Form 2' and b.value!='END' then 1 else 0 end) form2_inprogress,\r\n" |
|||
+ "sum(case when formtype='Form 2' and b.value='END' then 1 else 0 end) form2_completed,\r\n" |
|||
+ "sum(case when formtype='Form 3' then 1 else 0 end) form3_recieved,\r\n" |
|||
+ "sum(case when formtype='Form 3' and b.value!='END' then 1 else 0 end) form3_inprogress,\r\n" |
|||
+ "sum(case when formtype='Form 3' and b.value='END' then 1 else 0 end) form3_completed,\r\n" |
|||
+ "sum(case when formtype='Form 4' then 1 else 0 end) form4_recieved,\r\n" |
|||
+ "sum(case when formtype='Form 4' and b.value!='END' then 1 else 0 end) form4_inprogress,\r\n" |
|||
+ "sum(case when formtype='Form 4' and b.value='END' then 1 else 0 end) form4_completed,\r\n" |
|||
+ "sum(case when formtype='Form 5' then 1 else 0 end) form5_recieved,\r\n" |
|||
+ "sum(case when formtype='Form 5' and b.value!='END' then 1 else 0 end) form5_inprogress,\r\n" |
|||
+ "sum(case when formtype='Form 5' and b.value='END' then 1 else 0 end) form5_completed,\r\n" |
|||
+ "sum(case when formtype='Form 6' then 1 else 0 end) form6_recieved,\r\n" |
|||
+ "sum(case when formtype='Form 6' and b.value!='END' then 1 else 0 end) form6_inprogress,\r\n" |
|||
+ "sum(case when formtype='Form 6' and b.value='END' then 1 else 0 end) form6_completed,\r\n" |
|||
+ "sum(case when formtype='Form 7' then 1 else 0 end) form7_recieved,\r\n" |
|||
+ "sum(case when formtype='Form 7' and b.value!='END' then 1 else 0 end) form7_inprogress,\r\n" |
|||
+ "sum(case when formtype='Form 7' and b.value='END' then 1 else 0 end) form7_completed\r\n" |
|||
+ "from EGBPA_FORM_RULES@erp a,eg_wf_states@erp b,eg_boundary@erp zone\r\n" |
|||
+ "where a.state_id=b.id and zone.id_bndry=a.zoneid and\r\n" |
|||
+ " a.id = (SELECT MAX(id) FROM EGBPA_FORM_RULES@erp WHERE form_parentid = a.form_parentid)\r\n" |
|||
+ "group by zone.name order by name"; |
|||
|
|||
|
|||
|
|||
return jdbcTemplate.queryForList(sql); |
|||
|
|||
} |
|||
|
|||
|
|||
public List<Map<String, Object>> getwardwisedetails(String zone) |
|||
{ |
|||
String sql="select zone.name zone,ward.name ward,\r\n" |
|||
+ "sum(case when formtype='Form 1' then 1 else 0 end) form1_recieved,\r\n" |
|||
+ "sum(case when formtype='Form 1' and b.value!='END' then 1 else 0 end) form1_inprogress,\r\n" |
|||
+ "sum(case when formtype='Form 1' and b.value='END' then 1 else 0 end) form1_completed,\r\n" |
|||
+ "sum(case when formtype='Form 2' then 1 else 0 end) form2_recieved,\r\n" |
|||
+ "sum(case when formtype='Form 2' and b.value!='END' then 1 else 0 end) form2_inprogress,\r\n" |
|||
+ "sum(case when formtype='Form 2' and b.value='END' then 1 else 0 end) form2_completed,\r\n" |
|||
+ "sum(case when formtype='Form 3' then 1 else 0 end) form3_recieved,\r\n" |
|||
+ "sum(case when formtype='Form 3' and b.value!='END' then 1 else 0 end) form3_inprogress,\r\n" |
|||
+ "sum(case when formtype='Form 3' and b.value='END' then 1 else 0 end) form3_completed,\r\n" |
|||
+ "sum(case when formtype='Form 4' then 1 else 0 end) form4_recieved,\r\n" |
|||
+ "sum(case when formtype='Form 4' and b.value!='END' then 1 else 0 end) form4_inprogress,\r\n" |
|||
+ "sum(case when formtype='Form 4' and b.value='END' then 1 else 0 end) form4_completed,\r\n" |
|||
+ "sum(case when formtype='Form 5' then 1 else 0 end) form5_recieved,\r\n" |
|||
+ "sum(case when formtype='Form 5' and b.value!='END' then 1 else 0 end) form5_inprogress,\r\n" |
|||
+ "sum(case when formtype='Form 5' and b.value='END' then 1 else 0 end) form5_completed,\r\n" |
|||
+ "sum(case when formtype='Form 6' then 1 else 0 end) form6_recieved,\r\n" |
|||
+ "sum(case when formtype='Form 6' and b.value!='END' then 1 else 0 end) form6_inprogress,\r\n" |
|||
+ "sum(case when formtype='Form 6' and b.value='END' then 1 else 0 end) form6_completed,\r\n" |
|||
+ "sum(case when formtype='Form 7' then 1 else 0 end) form7_recieved,\r\n" |
|||
+ "sum(case when formtype='Form 7' and b.value!='END' then 1 else 0 end) form7_inprogress,\r\n" |
|||
+ "sum(case when formtype='Form 7' and b.value='END' then 1 else 0 end) form7_completed\r\n" |
|||
+ "from EGBPA_FORM_RULES@erp a,eg_wf_states@erp b,eg_boundary@erp zone,eg_boundary@erp ward\r\n" |
|||
+ "where a.state_id=b.id and zone.id_bndry=a.zoneid and ward.id_bndry=a.wardid and\r\n" |
|||
+ " a.id = (SELECT MAX(id) FROM EGBPA_FORM_RULES@erp WHERE form_parentid = a.form_parentid) and zone.name=? \r\n" |
|||
+ "group by zone.name,ward.name order by zone.name,ward.name"; |
|||
|
|||
return jdbcTemplate.queryForList(sql,zone); |
|||
} |
|||
|
|||
public List<Map<String, Object>> getformdetailswithzone(String zone, String ward, String formtype, String status) { |
|||
|
|||
String sql=""; |
|||
List<Map<String, Object>> result = new ArrayList<>();; |
|||
|
|||
if("Received".equalsIgnoreCase(status)) { |
|||
sql="SELECT " |
|||
+ " zone.name zone,ward.name ward," |
|||
+ " addr.applicant_name," |
|||
+ " addr.formid," |
|||
+ " addr.area," |
|||
+ " addr.address," |
|||
+ " addr.pincode " |
|||
+ "FROM" |
|||
+ " EGBPA_FORM_RULES@erp a" |
|||
+ " JOIN eg_wf_states@erp b ON a.state_id = b.id" |
|||
+ " JOIN eg_boundary@erp zone ON zone.id_bndry = a.zoneid" |
|||
+ " JOIN eg_boundary@erp ward ON ward.id_bndry = a.wardid" |
|||
+ " LEFT JOIN EGBPA_ENF_APP_ADDRESS@erp addr ON addr.formid = a.form_parentid " |
|||
+ "WHERE" |
|||
+ " a.id = (" |
|||
+ " SELECT MAX(id)" |
|||
+ " FROM EGBPA_FORM_RULES@erp" |
|||
+ " WHERE form_parentid = a.form_parentid" |
|||
+ " )" |
|||
+ " AND a.formtype = ? " |
|||
+ " AND zone.name = ? " |
|||
+ " AND ward.name = ? "; |
|||
|
|||
result = jdbcTemplate.queryForList(sql, formtype, zone, ward); |
|||
} |
|||
|
|||
if("Inprogress".equalsIgnoreCase(status)) { |
|||
|
|||
sql="SELECT" |
|||
+ " zone.name zone,ward.name ward," |
|||
+ " addr.applicant_name," |
|||
+ " addr.formid," |
|||
+ " addr.area," |
|||
+ " addr.address," |
|||
+ " addr.pincode " |
|||
+ "FROM" |
|||
+ " EGBPA_FORM_RULES@erp a" |
|||
+ " JOIN eg_wf_states@erp b ON a.state_id = b.id" |
|||
+ " JOIN eg_boundary@erp zone ON zone.id_bndry = a.zoneid" |
|||
+ " JOIN eg_boundary@erp ward ON ward.id_bndry = a.wardid" |
|||
+ " LEFT JOIN EGBPA_ENF_APP_ADDRESS@erp addr ON addr.formid = a.form_parentid" |
|||
+ " WHERE" |
|||
+ " a.id = (" |
|||
+ " SELECT MAX(id)" |
|||
+ " FROM EGBPA_FORM_RULES@erp" |
|||
+ " WHERE form_parentid = a.form_parentid" |
|||
+ " )" |
|||
+ " AND a.formtype = ?" |
|||
+ " AND zone.name = ?" |
|||
+ " AND ward.name = ?" |
|||
+ " and formtype=? and b.value!='END'"; |
|||
|
|||
result=jdbcTemplate.queryForList(sql,formtype,zone,ward,formtype); |
|||
} |
|||
|
|||
if("Completed".equalsIgnoreCase(status)) { |
|||
|
|||
sql="SELECT" |
|||
+ " zone.name zone,ward.name ward," |
|||
+ " addr.applicant_name," |
|||
+ " addr.formid," |
|||
+ " addr.area," |
|||
+ " addr.address," |
|||
+ " addr.pincode " |
|||
+ "FROM " |
|||
+ " EGBPA_FORM_RULES@erp a" |
|||
+ " JOIN eg_wf_states@erp b ON a.state_id = b.id" |
|||
+ " JOIN eg_boundary@erp zone ON zone.id_bndry = a.zoneid" |
|||
+ " JOIN eg_boundary@erp ward ON ward.id_bndry = a.wardid" |
|||
+ " LEFT JOIN EGBPA_ENF_APP_ADDRESS@erp addr ON addr.formid = a.form_parentid " |
|||
+ "WHERE" |
|||
+ " a.id = (" |
|||
+ " SELECT MAX(id)" |
|||
+ " FROM EGBPA_FORM_RULES@erp" |
|||
+ " WHERE form_parentid = a.form_parentid" |
|||
+ " )" |
|||
+ " AND a.formtype = ? " |
|||
+ " AND zone.name = ? " |
|||
+ " AND ward.name = ? " |
|||
+ " and formtype=? and b.value='END'"; |
|||
|
|||
result=jdbcTemplate.queryForList(sql,formtype,zone,ward,formtype); |
|||
} |
|||
|
|||
return result; |
|||
} |
|||
|
|||
public List<Map<String, Object>> getformiddetails(String formid) { |
|||
|
|||
String sql="SELECT" |
|||
+ " m.ENCLOSEMENTNAME," |
|||
+ " TO_CHAR(f.CREATEDDATE, 'YYYY/MM/DD HH24:MI') || ' 00:00:00.0' AS cdate," |
|||
+ " 'https://erp.chennaicorporation.gov.in/bpa/search/registrationForm!viewFile.action?formParentId=' || d.FORMID ||" |
|||
+ " CHR(38) || 'fileName=' || d.DOCNAME ||" |
|||
+ " CHR(38) || 'contentType=' || d.DOCTYPE ||" |
|||
+ " CHR(38) || 'fileCreatedDate=' || TO_CHAR(f.CREATEDDATE, 'YYYY-MM-DD') || ' 00:00:00.0' AS fileUrl" |
|||
+ " FROM" |
|||
+ " EGBPA_FORM_ENCLOSEMENT_DET@erp d " |
|||
+ "INNER JOIN " |
|||
+ " EGBPA_FORM_ENCLOSEMENT@erp m ON d.TYPEID = m.ID " |
|||
+ "INNER JOIN" |
|||
+ " EGBPA_FORM_RULES@erp f ON f.ID = d.APPID " |
|||
+ "WHERE" |
|||
+ " d.FORMID = ? " |
|||
+ "ORDER BY" |
|||
+ " m.FORMTYPE DESC"; |
|||
|
|||
return jdbcTemplate.queryForList(sql,formid); |
|||
} |
|||
|
|||
public List<Map<String, Object>> getformdetailswithoutward(String zone, String formtype, String status) { |
|||
String sql=""; |
|||
List<Map<String, Object>> result = new ArrayList<>();; |
|||
|
|||
if("Received".equalsIgnoreCase(status)) { |
|||
sql="SELECT " |
|||
+ " zone.name zone,ward.name ward," |
|||
+ " addr.applicant_name," |
|||
+ " addr.formid," |
|||
+ " addr.area," |
|||
+ " addr.address," |
|||
+ " addr.pincode " |
|||
+ "FROM" |
|||
+ " EGBPA_FORM_RULES@erp a" |
|||
+ " JOIN eg_wf_states@erp b ON a.state_id = b.id" |
|||
+ " JOIN eg_boundary@erp zone ON zone.id_bndry = a.zoneid" |
|||
+ " JOIN eg_boundary@erp ward ON ward.id_bndry = a.wardid" |
|||
+ " LEFT JOIN EGBPA_ENF_APP_ADDRESS@erp addr ON addr.formid = a.form_parentid " |
|||
+ "WHERE" |
|||
+ " a.id = (" |
|||
+ " SELECT MAX(id)" |
|||
+ " FROM EGBPA_FORM_RULES@erp" |
|||
+ " WHERE form_parentid = a.form_parentid" |
|||
+ " )" |
|||
+ " AND a.formtype = ? " |
|||
+ " AND zone.name = ? " |
|||
+" ORDER BY ward.name"; |
|||
|
|||
result = jdbcTemplate.queryForList(sql, formtype, zone); |
|||
} |
|||
|
|||
if("Inprogress".equalsIgnoreCase(status)) { |
|||
|
|||
sql="SELECT" |
|||
+ " zone.name zone,ward.name ward," |
|||
+ " addr.applicant_name," |
|||
+ " addr.formid," |
|||
+ " addr.area," |
|||
+ " addr.address," |
|||
+ " addr.pincode, " |
|||
+ "FROM" |
|||
+ " EGBPA_FORM_RULES@erp a" |
|||
+ " JOIN eg_wf_states@erp b ON a.state_id = b.id" |
|||
+ " JOIN eg_boundary@erp zone ON zone.id_bndry = a.zoneid" |
|||
+ " JOIN eg_boundary@erp ward ON ward.id_bndry = a.wardid" |
|||
+ " LEFT JOIN EGBPA_ENF_APP_ADDRESS@erp addr ON addr.formid = a.form_parentid" |
|||
+ " WHERE" |
|||
+ " a.id = (" |
|||
+ " SELECT MAX(id)" |
|||
+ " FROM EGBPA_FORM_RULES@erp" |
|||
+ " WHERE form_parentid = a.form_parentid" |
|||
+ " )" |
|||
+ " AND a.formtype = ?" |
|||
+ " AND zone.name = ?" |
|||
+ " and formtype=? and b.value!='END'" |
|||
+" ORDER BY ward.name"; |
|||
|
|||
result=jdbcTemplate.queryForList(sql,formtype,zone,formtype); |
|||
} |
|||
|
|||
if("Completed".equalsIgnoreCase(status)) { |
|||
|
|||
sql="SELECT" |
|||
+ " zone.name zone,ward.name ward," |
|||
+ " addr.applicant_name," |
|||
+ " addr.formid," |
|||
+ " addr.area," |
|||
+ " addr.address," |
|||
+ " addr.pincode, " |
|||
+ "'https://erp.chennaicorporation.gov.in/bpa/search/registrationForm!printRule.action?appId='||id as notice_url" |
|||
+ " FROM " |
|||
+ " EGBPA_FORM_RULES@erp a" |
|||
+ " JOIN eg_wf_states@erp b ON a.state_id = b.id" |
|||
+ " JOIN eg_boundary@erp zone ON zone.id_bndry = a.zoneid" |
|||
+ " JOIN eg_boundary@erp ward ON ward.id_bndry = a.wardid" |
|||
+ " LEFT JOIN EGBPA_ENF_APP_ADDRESS@erp addr ON addr.formid = a.form_parentid " |
|||
+ "WHERE" |
|||
+ " a.id = (" |
|||
+ " SELECT MAX(id)" |
|||
+ " FROM EGBPA_FORM_RULES@erp" |
|||
+ " WHERE form_parentid = a.form_parentid" |
|||
+ " )" |
|||
+ " AND a.formtype = ? " |
|||
+ " AND zone.name = ? " |
|||
+ " and formtype=? and b.value='END'" |
|||
+" ORDER BY ward.name"; |
|||
|
|||
result=jdbcTemplate.queryForList(sql,formtype,zone,formtype); |
|||
} |
|||
|
|||
return result; |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,621 @@ |
|||
package com.gcc.commissionerreviewII.service; |
|||
|
|||
import java.time.LocalDate; |
|||
import java.time.format.DateTimeFormatter; |
|||
import java.util.ArrayList; |
|||
import java.util.Collections; |
|||
import java.util.HashMap; |
|||
import java.util.LinkedHashMap; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
import javax.sql.DataSource; |
|||
|
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.beans.factory.annotation.Qualifier; |
|||
import org.springframework.context.annotation.Bean; |
|||
import org.springframework.http.ResponseEntity; |
|||
import org.springframework.jdbc.core.JdbcTemplate; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
import org.springframework.web.client.RestTemplate; |
|||
|
|||
import com.fasterxml.jackson.core.type.TypeReference; |
|||
import com.fasterxml.jackson.databind.JsonNode; |
|||
import com.fasterxml.jackson.databind.ObjectMapper; |
|||
|
|||
@Service |
|||
public class SofaBedCollectionService { |
|||
|
|||
@Autowired |
|||
@Qualifier("jdbcDomesticWasteTemplate") |
|||
private JdbcTemplate jdbcDomesticWasteTemplate; |
|||
|
|||
|
|||
public Map<String, Object> getzonewisedetails() { |
|||
|
|||
Map<String, Object> response = new HashMap<>(); |
|||
|
|||
try { |
|||
|
|||
// Formatter for output |
|||
DateTimeFormatter outputFormat = DateTimeFormatter.ofPattern("dd-MM-yyyy"); |
|||
|
|||
// Fixed start date |
|||
String formattedStartDate = "03-10-2025"; |
|||
|
|||
// Current date as end date |
|||
String formattedEndDate = LocalDate.now().format(outputFormat); |
|||
|
|||
String apiUrl ="https://gccservices.in/gccofficialapp/api/domesticwaste/getZoneReport?fromDate="+formattedStartDate+"&toDate="+formattedEndDate; |
|||
|
|||
System.out.println("apiUrl=" + apiUrl); |
|||
|
|||
// Call the external API |
|||
RestTemplate restTemplate = new RestTemplate(); |
|||
ResponseEntity<String> apiResponse = restTemplate.getForEntity(apiUrl, String.class); |
|||
|
|||
if (apiResponse.getStatusCode().is2xxSuccessful() && apiResponse.getBody() != null) { |
|||
|
|||
ObjectMapper mapper = new ObjectMapper(); |
|||
|
|||
// Parse full JSON |
|||
JsonNode rootNode = mapper.readTree(apiResponse.getBody()); |
|||
|
|||
if (rootNode.isArray() && rootNode.size() > 0) { |
|||
JsonNode firstObject = rootNode.get(0); // Get first object |
|||
JsonNode reportNode = firstObject.path("data"); |
|||
|
|||
if (reportNode.isMissingNode() || !reportNode.isArray() || reportNode.size() == 0) { |
|||
response.put("status", "nodata"); |
|||
response.put("data", Collections.emptyList()); |
|||
} else { |
|||
// Convert JSON array → List<Map<String, Object>> |
|||
List<Map<String, Object>> reportList = mapper.convertValue( |
|||
reportNode, |
|||
new TypeReference<List<Map<String, Object>>>() {} |
|||
); |
|||
|
|||
response.put("status", "success"); |
|||
response.put("data", reportList); |
|||
|
|||
} |
|||
|
|||
} else { |
|||
response.put("status", "nodata"); |
|||
response.put("data", Collections.emptyList()); |
|||
} |
|||
} else { |
|||
response.put("status", "nodata"); |
|||
response.put("data", Collections.emptyList()); |
|||
|
|||
} |
|||
|
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
response.put("status", "error"); |
|||
response.put("message", e.getMessage()); |
|||
} |
|||
|
|||
return response; |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
public Map<String, Object> getwarddetails(String zone) { |
|||
|
|||
Map<String, Object> response = new HashMap<>(); |
|||
|
|||
try { |
|||
|
|||
// Formatter for output |
|||
DateTimeFormatter outputFormat = DateTimeFormatter.ofPattern("dd-MM-yyyy"); |
|||
|
|||
// Fixed start date |
|||
String formattedStartDate = "03-10-2025"; |
|||
|
|||
// Current date as end date |
|||
String formattedEndDate = LocalDate.now().format(outputFormat); |
|||
|
|||
String apiUrl ="https://gccservices.in/gccofficialapp/api/domesticwaste/getWardReport?fromDate="+formattedStartDate+"&toDate="+formattedEndDate+"&zone="+zone; |
|||
|
|||
System.out.println("apiUrl=" + apiUrl); |
|||
|
|||
// Call the external API |
|||
RestTemplate restTemplate = new RestTemplate(); |
|||
ResponseEntity<String> apiResponse = restTemplate.getForEntity(apiUrl, String.class); |
|||
|
|||
if (apiResponse.getStatusCode().is2xxSuccessful() && apiResponse.getBody() != null) { |
|||
|
|||
ObjectMapper mapper = new ObjectMapper(); |
|||
|
|||
// Parse full JSON |
|||
JsonNode rootNode = mapper.readTree(apiResponse.getBody()); |
|||
|
|||
if (rootNode.isArray() && rootNode.size() > 0) { |
|||
JsonNode firstObject = rootNode.get(0); // Get first object |
|||
JsonNode reportNode = firstObject.path("data"); |
|||
|
|||
if (reportNode.isMissingNode() || !reportNode.isArray() || reportNode.size() == 0) { |
|||
response.put("status", "nodata"); |
|||
response.put("data", Collections.emptyList()); |
|||
} else { |
|||
// Convert JSON array → List<Map<String, Object>> |
|||
List<Map<String, Object>> reportList = mapper.convertValue( |
|||
reportNode, |
|||
new TypeReference<List<Map<String, Object>>>() {} |
|||
); |
|||
|
|||
response.put("status", "success"); |
|||
response.put("data", reportList); |
|||
|
|||
} |
|||
|
|||
} else { |
|||
response.put("status", "nodata"); |
|||
response.put("data", Collections.emptyList()); |
|||
} |
|||
} else { |
|||
response.put("status", "nodata"); |
|||
response.put("data", Collections.emptyList()); |
|||
|
|||
} |
|||
|
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
response.put("status", "error"); |
|||
response.put("message", e.getMessage()); |
|||
} |
|||
|
|||
return response; |
|||
|
|||
} |
|||
|
|||
public Map<String, Object> getwardstatusdetails(String ward, String status) { |
|||
|
|||
Map<String, Object> response = new HashMap<>(); |
|||
|
|||
try { |
|||
|
|||
// Formatter for output |
|||
DateTimeFormatter outputFormat = DateTimeFormatter.ofPattern("dd-MM-yyyy"); |
|||
|
|||
// Fixed start date |
|||
String formattedStartDate = "03-10-2025"; |
|||
|
|||
// Current date as end date |
|||
String formattedEndDate = LocalDate.now().format(outputFormat); |
|||
|
|||
String apiUrl="https://gccservices.in/gccofficialapp/api/domesticwaste/getWardStatusDetails?fromDate="+formattedStartDate+"&toDate="+formattedEndDate+"&ward="+ward+"&status="+status; |
|||
|
|||
System.out.println("apiUrl=" + apiUrl); |
|||
|
|||
// Call the external API |
|||
RestTemplate restTemplate = new RestTemplate(); |
|||
ResponseEntity<String> apiResponse = restTemplate.getForEntity(apiUrl, String.class); |
|||
|
|||
if (apiResponse.getStatusCode().is2xxSuccessful() && apiResponse.getBody() != null) { |
|||
|
|||
ObjectMapper mapper = new ObjectMapper(); |
|||
|
|||
// Parse full JSON |
|||
JsonNode rootNode = mapper.readTree(apiResponse.getBody()); |
|||
|
|||
if (rootNode.isArray() && rootNode.size() > 0) { |
|||
JsonNode firstObject = rootNode.get(0); // Get first object |
|||
JsonNode reportNode = firstObject.path("data"); |
|||
|
|||
if (reportNode.isMissingNode() || !reportNode.isArray() || reportNode.size() == 0) { |
|||
response.put("status", "nodata"); |
|||
response.put("data", Collections.emptyList()); |
|||
} else { |
|||
// Convert JSON array → List<Map<String, Object>> |
|||
List<Map<String, Object>> reportList = mapper.convertValue( |
|||
reportNode, |
|||
new TypeReference<List<Map<String, Object>>>() {} |
|||
); |
|||
|
|||
response.put("status", "success"); |
|||
response.put("data", reportList); |
|||
|
|||
} |
|||
|
|||
} else { |
|||
response.put("status", "nodata"); |
|||
response.put("data", Collections.emptyList()); |
|||
} |
|||
} else { |
|||
response.put("status", "nodata"); |
|||
response.put("data", Collections.emptyList()); |
|||
|
|||
} |
|||
|
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
response.put("status", "error"); |
|||
response.put("message", e.getMessage()); |
|||
} |
|||
|
|||
return response; |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
//yogi |
|||
|
|||
|
|||
@Transactional(readOnly = true) |
|||
public List<Map<String, Object>> getZoneReport() { |
|||
|
|||
String sql = """ |
|||
WITH date_limits AS ( |
|||
SELECT |
|||
DATE_SUB(CURDATE(), INTERVAL (DAYOFWEEK(CURDATE()) - 1) DAY) AS week_start, |
|||
DATE_ADD(DATE_SUB(CURDATE(), INTERVAL (DAYOFWEEK(CURDATE()) - 1) DAY), INTERVAL 7 DAY) AS week_end |
|||
) |
|||
SELECT |
|||
COALESCE(ur.zone, 'TOTAL') AS zone, |
|||
COUNT(*) AS total_request, |
|||
|
|||
-- Requests created this week |
|||
SUM(CASE WHEN ur.cdate >= d.week_start AND ur.cdate < d.week_end THEN 1 ELSE 0 END) AS this_week_requests, |
|||
|
|||
-- Older requests |
|||
SUM(CASE WHEN ur.cdate < d.week_start THEN 1 ELSE 0 END) AS older_requests, |
|||
|
|||
-- Status-based counts |
|||
SUM(CASE WHEN ur.status = 2 THEN 1 ELSE 0 END) AS completed, |
|||
SUM(CASE WHEN ur.status = 4 THEN 1 ELSE 0 END) AS user_cancel, |
|||
SUM(CASE WHEN ur.status = 5 THEN 1 ELSE 0 END) AS officer_cancel, |
|||
|
|||
-- Pending = older_requests - (completed + cancels) |
|||
( |
|||
SUM(CASE WHEN ur.cdate < d.week_start THEN 1 ELSE 0 END) |
|||
- SUM(CASE WHEN ur.status IN (2,4,5) THEN 1 ELSE 0 END) |
|||
) AS pending |
|||
|
|||
FROM |
|||
user_request_table ur |
|||
CROSS JOIN date_limits d |
|||
WHERE |
|||
ur.is_active = 1 |
|||
AND ur.is_delete = 0 |
|||
GROUP BY |
|||
ur.zone WITH ROLLUP |
|||
ORDER BY |
|||
CASE WHEN ur.zone IS NULL THEN 999 ELSE ur.zone END; |
|||
"""; |
|||
|
|||
List<Map<String, Object>> reportList = jdbcDomesticWasteTemplate.queryForList(sql); |
|||
|
|||
Map<String, Object> response = new LinkedHashMap<>(); |
|||
response.put("status", "Success"); |
|||
response.put("message", "Zone-wise Report (All Dates)"); |
|||
response.put("data", reportList); |
|||
|
|||
return Collections.singletonList(response); |
|||
} |
|||
|
|||
|
|||
|
|||
// @Transactional |
|||
// public List<Map<String, Object>> getZoneReport(String fromDate, String toDate) { |
|||
|
|||
// String sql = """ |
|||
// WITH date_limits AS ( |
|||
// SELECT |
|||
// STR_TO_DATE(?, '%d-%m-%Y') AS start_date, |
|||
// STR_TO_DATE(?, '%d-%m-%Y') AS end_date, |
|||
// DATE_SUB(CURDATE(), INTERVAL (DAYOFWEEK(CURDATE()) - 1) DAY) AS week_start, |
|||
// DATE_ADD(DATE_SUB(CURDATE(), INTERVAL (DAYOFWEEK(CURDATE()) - 1) DAY), INTERVAL 7 DAY) AS week_end |
|||
// ) |
|||
// SELECT |
|||
// COALESCE(ur.zone, 'TOTAL') AS zone, |
|||
// COUNT(*) AS total_request, |
|||
|
|||
// -- Requests created this week |
|||
// SUM(CASE WHEN ur.cdate >= d.week_start AND ur.cdate < d.week_end THEN 1 ELSE 0 END) AS this_week_requests, |
|||
|
|||
// -- Older requests |
|||
// SUM(CASE WHEN ur.cdate < d.week_start THEN 1 ELSE 0 END) AS older_requests, |
|||
|
|||
// -- Status-based counts |
|||
// SUM(CASE WHEN ur.status = 2 THEN 1 ELSE 0 END) AS completed, |
|||
// SUM(CASE WHEN ur.status = 4 THEN 1 ELSE 0 END) AS user_cancel, |
|||
// SUM(CASE WHEN ur.status = 5 THEN 1 ELSE 0 END) AS officer_cancel, |
|||
|
|||
// -- Pending = older_requests - (completed + cancels) |
|||
// ( |
|||
// SUM(CASE WHEN ur.cdate < d.week_start THEN 1 ELSE 0 END) |
|||
// - SUM(CASE WHEN ur.status IN (2,4,5) THEN 1 ELSE 0 END) |
|||
// ) AS pending |
|||
|
|||
// FROM |
|||
// user_request_table ur |
|||
// CROSS JOIN date_limits d |
|||
// WHERE |
|||
// ur.is_active = 1 |
|||
// AND ur.is_delete = 0 |
|||
// AND ur.cdate BETWEEN d.start_date AND d.end_date |
|||
// GROUP BY |
|||
// ur.zone WITH ROLLUP |
|||
// ORDER BY |
|||
// CASE WHEN ur.zone IS NULL THEN 999 ELSE ur.zone END; |
|||
// """; |
|||
|
|||
// List<Map<String, Object>> reportList = jdbcDomesticWasteTemplate.queryForList(sql, fromDate, toDate); |
|||
|
|||
// Map<String, Object> response = new LinkedHashMap<>(); |
|||
// response.put("status", "Success"); |
|||
// response.put("message", "Zone-wise Report"); |
|||
// response.put("data", reportList); |
|||
|
|||
// return Collections.singletonList(response); |
|||
// } |
|||
|
|||
|
|||
|
|||
// @Transactional(readOnly = true) |
|||
// public List<Map<String, Object>> getWardReport(String fromDate, String toDate, String zone) { |
|||
// String sql = |
|||
// "(" |
|||
// + " SELECT " |
|||
// + " ur.division AS division, " |
|||
// + " COUNT(*) AS total_request, " |
|||
// + " SUM(CASE WHEN ur.status = 1 THEN 1 ELSE 0 END) AS open, " |
|||
// + " SUM(CASE WHEN ur.status = 2 THEN 1 ELSE 0 END) AS completed, " |
|||
// + " SUM(CASE WHEN ur.status = 3 THEN 1 ELSE 0 END) AS pending, " |
|||
// + " SUM(CASE WHEN ur.status = 4 THEN 1 ELSE 0 END) AS user_cancel, " |
|||
// + " SUM(CASE WHEN ur.status = 5 THEN 1 ELSE 0 END) AS officer_cancel " |
|||
// + " FROM user_request_table ur " |
|||
// + " WHERE ur.is_active = 1 AND ur.is_delete = 0 AND ur.zone = ? " |
|||
// + " GROUP BY ur.division " |
|||
// + ") " |
|||
// + "UNION ALL " |
|||
// + "(" |
|||
// + " SELECT " |
|||
// + " 'TOTAL' AS division, " |
|||
// + " COUNT(*) AS total_request, " |
|||
// + " SUM(CASE WHEN ur.status = 1 THEN 1 ELSE 0 END) AS open, " |
|||
// + " SUM(CASE WHEN ur.status = 2 THEN 1 ELSE 0 END) AS completed, " |
|||
// + " SUM(CASE WHEN ur.status = 3 THEN 1 ELSE 0 END) AS pending, " |
|||
// + " SUM(CASE WHEN ur.status = 4 THEN 1 ELSE 0 END) AS user_cancel, " |
|||
// + " SUM(CASE WHEN ur.status = 5 THEN 1 ELSE 0 END) AS officer_cancel " |
|||
// + " FROM user_request_table ur " |
|||
// + " WHERE ur.is_active = 1 AND ur.is_delete = 0 AND ur.zone = ? " |
|||
// + ") " |
|||
// + "ORDER BY " |
|||
// + " CASE WHEN division = 'TOTAL' THEN 999 ELSE CAST(division AS UNSIGNED) END"; |
|||
|
|||
// List<Map<String, Object>> reportList = jdbcDomesticWasteTemplate.queryForList(sql, zone, zone); |
|||
|
|||
// Map<String, Object> response = new LinkedHashMap<>(); |
|||
// response.put("status", "Success"); |
|||
// response.put("message", "Ward-wise Report"); |
|||
// response.put("data", reportList); |
|||
|
|||
// return Collections.singletonList(response); |
|||
// } |
|||
|
|||
|
|||
|
|||
@Transactional(readOnly = true) |
|||
public List<Map<String, Object>> getWardReport(String zone) { |
|||
|
|||
String sql = """ |
|||
WITH date_limits AS ( |
|||
SELECT |
|||
DATE_SUB(CURDATE(), INTERVAL (DAYOFWEEK(CURDATE()) - 1) DAY) AS week_start, |
|||
DATE_ADD(DATE_SUB(CURDATE(), INTERVAL (DAYOFWEEK(CURDATE()) - 1) DAY), INTERVAL 7 DAY) AS week_end |
|||
) |
|||
SELECT |
|||
COALESCE(ur.division, 'TOTAL') AS division, |
|||
COUNT(*) AS total_request, |
|||
|
|||
-- Requests created this week |
|||
SUM(CASE WHEN ur.cdate >= d.week_start AND ur.cdate < d.week_end THEN 1 ELSE 0 END) AS this_week_requests, |
|||
|
|||
-- Older requests |
|||
SUM(CASE WHEN ur.cdate < d.week_start THEN 1 ELSE 0 END) AS older_requests, |
|||
|
|||
-- Status-based counts |
|||
SUM(CASE WHEN ur.status = 2 THEN 1 ELSE 0 END) AS completed, |
|||
SUM(CASE WHEN ur.status = 4 THEN 1 ELSE 0 END) AS user_cancel, |
|||
SUM(CASE WHEN ur.status = 5 THEN 1 ELSE 0 END) AS officer_cancel, |
|||
|
|||
-- Pending = older_requests - (completed + cancels) |
|||
( |
|||
SUM(CASE WHEN ur.cdate < d.week_start THEN 1 ELSE 0 END) |
|||
- SUM(CASE WHEN ur.status IN (2,4,5) THEN 1 ELSE 0 END) |
|||
) AS pending |
|||
|
|||
FROM |
|||
user_request_table ur |
|||
CROSS JOIN date_limits d |
|||
WHERE |
|||
ur.is_active = 1 |
|||
AND ur.is_delete = 0 |
|||
AND ur.zone = ? |
|||
GROUP BY |
|||
ur.division WITH ROLLUP |
|||
ORDER BY |
|||
CASE WHEN ur.division IS NULL THEN 999 ELSE CAST(ur.division AS UNSIGNED) END; |
|||
"""; |
|||
|
|||
List<Map<String, Object>> reportList = jdbcDomesticWasteTemplate.queryForList(sql, zone); |
|||
|
|||
Map<String, Object> response = new LinkedHashMap<>(); |
|||
response.put("status", "Success"); |
|||
response.put("message", "Ward-wise Report with Weekly and Pending Breakdown"); |
|||
response.put("data", reportList); |
|||
|
|||
return Collections.singletonList(response); |
|||
} |
|||
|
|||
|
|||
|
|||
// @Transactional(readOnly = true) |
|||
// public List<Map<String, Object>> getWardStatusDetails( |
|||
// String fromDate, String toDate, |
|||
// String ward, String status) { |
|||
|
|||
// // ✅ Base URL for images |
|||
// String fileBaseUrl = "https://gccservices.in"; // or your configured value |
|||
|
|||
// // ✅ SQL query with ward + status filters |
|||
// String sql = |
|||
// "SELECT " + |
|||
// " u.id, u.request_id, u.user_name, u.mobile, u.address, " + |
|||
// " u.latitude, u.longitude, u.zone, u.division, u.street_name, " + |
|||
// " u.quantity AS main_quantity, u.remarks, " + |
|||
// " CONCAT('" + fileBaseUrl + "/gccofficialapp/files', u.image_url) AS image_url, " + |
|||
// " DATE_FORMAT(u.cdate, '%d-%m-%Y') AS cdate, " + |
|||
// " sm.status_master AS status, " + |
|||
// " DATE_FORMAT(u.close_date, '%d-%m-%Y') AS close_date, " + |
|||
// " CONCAT('" + fileBaseUrl + "/gccofficialapp/files', u.officer_upload_url) AS officer_upload_url, " + |
|||
// " im.item_name, itm.quantity " + |
|||
// "FROM user_request_table u " + |
|||
// "LEFT JOIN items itm ON u.id = itm.req_table_id " + |
|||
// "LEFT JOIN item_master im ON itm.iteam_id = im.id AND im.is_active = 1 " + |
|||
// "LEFT JOIN status_master sm ON sm.id = u.status AND sm.is_active = 1 AND sm.is_delete = 0 " + |
|||
// "WHERE u.is_active = 1 AND u.is_delete = 0 " + |
|||
// " AND u.division = ? " + |
|||
// " AND u.status = ? " + |
|||
// "ORDER BY u.cdate DESC"; |
|||
|
|||
// // ✅ Execute query |
|||
// List<Map<String, Object>> reportList = jdbcDomesticWasteTemplate.queryForList(sql, ward, status); |
|||
|
|||
|
|||
// Map<String, Object> response = new LinkedHashMap<>(); |
|||
// response.put("status", "Success"); |
|||
// response.put("message", "Ward-status-wise - Report"); |
|||
// response.put("data", reportList); |
|||
|
|||
// return Collections.singletonList(response); |
|||
|
|||
// //return groupRequestsWithItems(reportList); |
|||
|
|||
// } |
|||
|
|||
|
|||
|
|||
@Transactional(readOnly = true) |
|||
public List<Map<String, Object>> getWardStatusDetails(String ward, String status) { |
|||
|
|||
// ✅ Base URL for images (you can move to application.properties later) |
|||
String fileBaseUrl = "https://gccservices.in"; |
|||
|
|||
// ✅ SQL query using only ward + status |
|||
String sql = """ |
|||
SELECT |
|||
u.id, |
|||
u.request_id, |
|||
u.user_name, |
|||
u.mobile, |
|||
u.address, |
|||
u.latitude, |
|||
u.longitude, |
|||
u.zone, |
|||
u.division, |
|||
u.street_name, |
|||
u.quantity AS main_quantity, |
|||
u.remarks, |
|||
CONCAT(?, u.image_url) AS image_url, |
|||
DATE_FORMAT(u.cdate, '%d-%m-%Y') AS cdate, |
|||
sm.status_master AS status, |
|||
DATE_FORMAT(u.close_date, '%d-%m-%Y') AS close_date, |
|||
CONCAT(?, u.officer_upload_url) AS officer_upload_url, |
|||
itm.iteam_id, |
|||
im.item_name, |
|||
itm.quantity |
|||
FROM user_request_table u |
|||
LEFT JOIN items itm ON u.id = itm.req_table_id |
|||
LEFT JOIN item_master im ON itm.iteam_id = im.id AND im.is_active = 1 |
|||
LEFT JOIN status_master sm ON sm.id = u.status AND sm.is_active = 1 AND sm.is_delete = 0 |
|||
WHERE |
|||
u.is_active = 1 |
|||
AND u.is_delete = 0 |
|||
AND u.division = ? |
|||
AND u.status = ? |
|||
ORDER BY u.cdate DESC |
|||
"""; |
|||
|
|||
// ✅ Execute query |
|||
List<Map<String, Object>> reportList = jdbcDomesticWasteTemplate.queryForList( |
|||
sql, |
|||
fileBaseUrl + "/gccofficialapp/files", |
|||
fileBaseUrl + "/gccofficialapp/files", |
|||
ward, |
|||
status |
|||
); |
|||
|
|||
Map<Integer, Map<String, Object>> groupedMap = new LinkedHashMap<>(); |
|||
|
|||
for (Map<String, Object> row : reportList) { |
|||
Integer id = (Integer) row.get("id"); |
|||
|
|||
Map<String, Object> item = null; |
|||
if (row.get("item_name") != null) { |
|||
item = new LinkedHashMap<>(); |
|||
item.put("item_name", row.get("item_name")); |
|||
item.put("quantity", row.get("quantity")); |
|||
} |
|||
|
|||
if (groupedMap.containsKey(id)) { |
|||
if (item != null) { |
|||
((List<Map<String, Object>>) groupedMap.get(id).get("items")).add(item); |
|||
} |
|||
} else { |
|||
Map<String, Object> newEntry = new LinkedHashMap<>(); |
|||
newEntry.put("id", id); |
|||
newEntry.put("request_id", row.get("request_id")); |
|||
newEntry.put("user_name", row.get("user_name")); |
|||
newEntry.put("mobile", row.get("mobile")); |
|||
newEntry.put("address", row.get("address")); |
|||
newEntry.put("latitude", row.get("latitude")); |
|||
newEntry.put("longitude", row.get("longitude")); |
|||
newEntry.put("zone", row.get("zone")); |
|||
newEntry.put("division", row.get("division")); |
|||
newEntry.put("street_name", row.get("street_name")); |
|||
newEntry.put("main_quantity", row.get("main_quantity")); |
|||
newEntry.put("remarks", row.get("remarks")); |
|||
newEntry.put("image_url", row.get("image_url")); |
|||
newEntry.put("cdate", row.get("cdate")); |
|||
newEntry.put("is_active", row.get("is_active")); |
|||
newEntry.put("is_delete", row.get("is_delete")); |
|||
newEntry.put("street_id", row.get("street_id")); |
|||
newEntry.put("status", row.get("status")); // Now this is human-readable |
|||
newEntry.put("is_app", row.get("is_app")); |
|||
newEntry.put("close_date", row.get("close_date")); |
|||
newEntry.put("officer_upload_url", row.get("officer_upload_url")); |
|||
|
|||
List<Map<String, Object>> items = new ArrayList<>(); |
|||
if (item != null) { |
|||
items.add(item); |
|||
} |
|||
newEntry.put("items", items); |
|||
|
|||
groupedMap.put(id, newEntry); |
|||
} |
|||
} |
|||
|
|||
|
|||
// ✅ Wrap response |
|||
Map<String, Object> response = new LinkedHashMap<>(); |
|||
response.put("status", "Success"); |
|||
response.put("message", "Ward-status-wise Report"); |
|||
response.put("data", groupedMap.values()); |
|||
|
|||
return Collections.singletonList(response); |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
} |
|||
@ -0,0 +1,3 @@ |
|||
spring.application.name=commissionerreviewII |
|||
|
|||
server.port=8075 |
|||
@ -0,0 +1,919 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="en" xmlns:th="http://www.thymeleaf.org"> |
|||
<head> |
|||
<title>Enforcement Zonewise Report Summary</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; |
|||
} |
|||
|
|||
</style> |
|||
</head> |
|||
<body> |
|||
|
|||
<div class="page-header-title"> |
|||
<h4>Enforcement - Zonewise Report</h4> |
|||
</div> |
|||
|
|||
<div id="opSummaryTable" style="display: block;" class="container"> |
|||
<table id="ZoneOpDatatable" class="table table-striped table-bordered display nowrap w-100"> |
|||
<thead> |
|||
<tr> |
|||
<th rowspan="2" class="text-center">ZONE</th> |
|||
<th colspan="3" class="text-center">NOTICE 1</th> |
|||
<th colspan="3" class="text-center">NOTICE 2</th> |
|||
<th colspan="3" class="text-center">NOTICE 3</th> |
|||
<th colspan="3" class="text-center">NOTICE 4</th> |
|||
<th colspan="3" class="text-center">NOTICE 5</th> |
|||
<th colspan="3" class="text-center">NOTICE 6</th> |
|||
<th colspan="3" class="text-center">NOTICE 7</th> |
|||
</tr> |
|||
<tr> |
|||
<th class="text-center">Generated </th> |
|||
<th class="text-center">Inprogress</th> |
|||
<th class="text-center">Issued </th> |
|||
<th class="text-center">Generated </th> |
|||
<th class="text-center">Inprogress</th> |
|||
<th class="text-center">Issued </th> |
|||
<th class="text-center">Generated </th> |
|||
<th class="text-center">Inprogress</th> |
|||
<th class="text-center">Issued </th> |
|||
<th class="text-center">Generated </th> |
|||
<th class="text-center">Inprogress</th> |
|||
<th class="text-center">Issued </th> |
|||
<th class="text-center">Generated </th> |
|||
<th class="text-center">Inprogress</th> |
|||
<th class="text-center">Issued </th> |
|||
<th class="text-center">Generated </th> |
|||
<th class="text-center">Inprogress</th> |
|||
<th class="text-center">Issued </th> |
|||
<th class="text-center">Generated </th> |
|||
<th class="text-center">Inprogress</th> |
|||
<th class="text-center">Issued </th> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
|
|||
|
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
|
|||
<div class="modal fade" id="zoneDetailsModal" tabindex="-1" aria-labelledby="zoneDetailsLabel" aria-hidden="true"> |
|||
<div class="modal-dialog modal-xl"> |
|||
<div class="modal-content"> |
|||
<div class="modal-header"> |
|||
<h5 class="modal-title" id="zoneModalTitle">Zone Details</h5> |
|||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> |
|||
</div> |
|||
<div class="modal-body"> |
|||
|
|||
<table id="WardDatatable" class="table table-striped table-bordered display nowrap w-100"> |
|||
<thead> |
|||
<tr> |
|||
<th rowspan="2" class="text-center">WARD</th> |
|||
<th colspan="3" class="text-center">NOTICE 1</th> |
|||
<th colspan="3" class="text-center">NOTICE 2</th> |
|||
<th colspan="3" class="text-center">NOTICE 3</th> |
|||
<th colspan="3" class="text-center">NOTICE 4</th> |
|||
<th colspan="3" class="text-center">NOTICE 5</th> |
|||
<th colspan="3" class="text-center">NOTICE 6</th> |
|||
<th colspan="3" class="text-center">NOTICE 7</th> |
|||
</tr> |
|||
<tr> |
|||
<th class="text-center">Generated </th> |
|||
<th class="text-center">Inprogress</th> |
|||
<th class="text-center">Issued </th> |
|||
<th class="text-center">Generated </th> |
|||
<th class="text-center">Inprogress</th> |
|||
<th class="text-center">Issued </th> |
|||
<th class="text-center">Generated </th> |
|||
<th class="text-center">Inprogress</th> |
|||
<th class="text-center">Issued </th> |
|||
<th class="text-center">Generated </th> |
|||
<th class="text-center">Inprogress</th> |
|||
<th class="text-center">Issued </th> |
|||
<th class="text-center">Generated </th> |
|||
<th class="text-center">Inprogress</th> |
|||
<th class="text-center">Issued </th> |
|||
<th class="text-center">Generated </th> |
|||
<th class="text-center">Inprogress</th> |
|||
<th class="text-center">Issued </th> |
|||
<th class="text-center">Generated </th> |
|||
<th class="text-center">Inprogress</th> |
|||
<th class="text-center">Issued </th> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
|
|||
|
|||
</tbody> |
|||
</table> |
|||
|
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<div class="modal fade" id="DetailsModal" tabindex="-1" aria-labelledby="DetailsLabel" aria-hidden="true"> |
|||
<div class="modal-dialog modal-xl"> |
|||
<div class="modal-content"> |
|||
<div class="modal-header"> |
|||
<h5 class="modal-title" id="DeatilsModalTitle">Details</h5> |
|||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> |
|||
</div> |
|||
<div class="modal-body"> |
|||
|
|||
<table id="DetailsDatatable" class="table table-striped table-bordered display nowrap w-100"> |
|||
<thead> |
|||
<tr> |
|||
<th class="text-center">ZONE</th> |
|||
<th class="text-center">WARD</th> |
|||
<th class="text-center">APPLICANT NAME</th> |
|||
<th class="text-center">ADDRESS</th> |
|||
<th class="text-center">AREA</th> |
|||
<th class="text-center">PINCODE</th> |
|||
|
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
|
|||
|
|||
</tbody> |
|||
</table> |
|||
|
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div class="modal fade" id="ApplicantDetailsModal" tabindex="-1" aria-labelledby="ApplicantDetailsLabel" aria-hidden="true"> |
|||
<div class="modal-dialog modal-xl"> |
|||
<div class="modal-content"> |
|||
<div class="modal-header"> |
|||
<h5 class="modal-title">Enforcement Details</h5> |
|||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> |
|||
</div> |
|||
<div class="modal-body"> |
|||
|
|||
<table id="FormDatatable" class="table table-striped table-bordered display nowrap w-100"> |
|||
<thead> |
|||
<tr> |
|||
<th class="text-center">ENCLOSEMENT NAME</th> |
|||
<th class="text-center">DATE</th> |
|||
<th class="text-center">FILE URL</th> |
|||
|
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
|
|||
|
|||
</tbody> |
|||
</table> |
|||
|
|||
</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> |
|||
$(document).ready(function () { |
|||
$('#pageLoader').show(); |
|||
$.ajax({ |
|||
url: '/commissionerreview/api/enforcement/getZoneWiseDetails', |
|||
method: 'GET', |
|||
success: function(response) { |
|||
$('#pageLoader').hide(); |
|||
if (Array.isArray(response) && response.length > 0){ |
|||
console.log("Details Array:", response); |
|||
|
|||
|
|||
let table = $('#ZoneOpDatatable').DataTable({ |
|||
destroy: true, |
|||
autoWidth: true, |
|||
info: true, |
|||
data: response, // using response directly |
|||
columns: [ |
|||
{ |
|||
data: 'ZONE', |
|||
title: 'Zone', |
|||
render: function (data, type, row, meta) { |
|||
const serial = meta.row + 1; |
|||
return `<a href="#" onclick="openZoneModal('${data}')" style="text-decoration: underline;">${serial}</a>`; |
|||
} |
|||
}, |
|||
...[ |
|||
'FORM1_RECIEVED', 'FORM1_INPROGRESS', 'FORM1_COMPLETED', |
|||
'FORM2_RECIEVED', 'FORM2_INPROGRESS', 'FORM2_COMPLETED', |
|||
'FORM3_RECIEVED', 'FORM3_INPROGRESS', 'FORM3_COMPLETED', |
|||
'FORM4_RECIEVED', 'FORM4_INPROGRESS', 'FORM4_COMPLETED', |
|||
'FORM5_RECIEVED', 'FORM5_INPROGRESS', 'FORM5_COMPLETED', |
|||
'FORM6_RECIEVED', 'FORM6_INPROGRESS', 'FORM6_COMPLETED', |
|||
'FORM7_RECIEVED', 'FORM7_INPROGRESS', 'FORM7_COMPLETED' |
|||
].map(field => ({ |
|||
data: field, |
|||
createdCell: function (td, cellData) { |
|||
if (parseInt(cellData) > 0) { |
|||
$(td).css({ |
|||
color: 'blue', |
|||
textDecoration: 'underline', |
|||
cursor: 'pointer' |
|||
}); |
|||
$(td).addClass('zoneclickable-cell'); |
|||
} |
|||
} |
|||
})) |
|||
], |
|||
dom: 'frtip', |
|||
lengthMenu: [ |
|||
[50, 100, 200, 500, -1], |
|||
['50 rows', '100 rows', '200 rows', 'Show all'] |
|||
], |
|||
scrollY: 'auto', |
|||
scrollX: true, |
|||
responsive: false, |
|||
searching: false, |
|||
ordering: false |
|||
}); |
|||
|
|||
|
|||
const formTypeMap1 = { |
|||
1: "Form 1", 2: "Form 1", 3: "Form 1", |
|||
4: "Form 2", 5: "Form 2", 6: "Form 2", |
|||
7: "Form 3", 8: "Form 3", 9: "Form 3", |
|||
10: "Form 4",11: "Form 4",12: "Form 4", |
|||
13: "Form 5",14: "Form 5",15: "Form 5", |
|||
16: "Form 6",17: "Form 6",18: "Form 6", |
|||
19: "Form 7",20: "Form 7",21: "Form 7" |
|||
}; |
|||
|
|||
const statusMap1 = { |
|||
0: "Received", 1: "Inprogress", 2: "Completed" |
|||
}; |
|||
|
|||
// Add click listener on table body cells |
|||
$('#ZoneOpDatatable tbody').off('click').on('click', 'td.zoneclickable-cell', function () { |
|||
|
|||
$('#pageLoader').show(); |
|||
|
|||
const table1 = $('#ZoneOpDatatable').DataTable(); |
|||
const cellIndex1 = table1.cell(this).index(); // { row: x, column: y } |
|||
const columnIndex1 = cellIndex1.column; |
|||
|
|||
// Ignore clicks on the first column (WARD) |
|||
if (columnIndex1 === 0) return; |
|||
|
|||
const rowData1 = table1.row(cellIndex1.row).data(); |
|||
|
|||
const zone1 = rowData1['ZONE']; |
|||
|
|||
// Calculate form type and status |
|||
const formType1 = formTypeMap1[columnIndex1]; |
|||
const positionInSet1 = (columnIndex1 - 1) % 3; // 0,1,2 for each formtype |
|||
const status1 = statusMap1[positionInSet1]; |
|||
|
|||
console.log("Clicked on -> Zone:", zone1, "| FormType:", formType1, "| Status:", status1); |
|||
|
|||
openZoneDetails(zone1,formType1,status1); |
|||
|
|||
}); |
|||
|
|||
|
|||
} |
|||
else if (Array.isArray(response) && response.length === 0) { |
|||
$('#pageLoader').hide(); |
|||
//alert("No data available."); |
|||
|
|||
Swal.fire({ |
|||
icon: 'info', |
|||
title: 'No Data', |
|||
text: 'No data available.', |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
|
|||
} |
|||
else { |
|||
$('#pageLoader').hide(); |
|||
//alert("Error: " + response.message); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: response.message, |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
|
|||
|
|||
} |
|||
}, |
|||
error: function(xhr, status, error) { |
|||
$('#pageLoader').hide(); |
|||
// alert("Request failed: " + error); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: error, |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
|
|||
|
|||
} |
|||
}); |
|||
|
|||
|
|||
$('#DetailsDatatable tbody').off('click').on('click', '.applicant-name', function () { |
|||
const formId = $(this).data('formid'); |
|||
|
|||
openApplicantModal(formId); |
|||
|
|||
|
|||
}); |
|||
|
|||
|
|||
}); |
|||
|
|||
|
|||
function openZoneDetails(zone1,formType1,status1){ |
|||
|
|||
$('#pageLoader').show(); |
|||
|
|||
$.ajax({ |
|||
url: '/commissionerreview/api/enforcement/getFormDetailsWithoutWard', |
|||
method: 'GET', |
|||
data: { |
|||
zone: zone1, |
|||
formtype: formType1, |
|||
status: status1 |
|||
}, |
|||
success: function (response) { |
|||
|
|||
$('#pageLoader').hide(); |
|||
console.log("Details:", response); |
|||
if (Array.isArray(response) && response.length > 0){ |
|||
|
|||
|
|||
let table = $('#DetailsDatatable').DataTable({ |
|||
destroy: true, |
|||
autoWidth: true, |
|||
info: true, |
|||
data: response, // using response directly |
|||
columns: [ |
|||
{ data: 'ZONE', |
|||
render: function (data, type, row) { |
|||
return data ? data.replace("N", "") : ''; |
|||
} |
|||
}, |
|||
{ data: 'WARD', |
|||
render: function (data, type, row) { |
|||
return data ? data.replace("N", "") : ''; |
|||
} |
|||
}, |
|||
{ |
|||
data: 'APPLICANT_NAME', |
|||
render: function (data, type, row) { |
|||
return `<span class="applicant-name" data-formid="${row.FORMID}" style="color: blue; text-decoration: underline; cursor: pointer;">${data}</span>`; |
|||
} |
|||
}, |
|||
{ data: 'AREA' }, |
|||
{ data: 'ADDRESS' }, |
|||
{ data: 'PINCODE' }, |
|||
|
|||
], |
|||
dom: 'frtip', |
|||
lengthMenu: [ |
|||
[50, 100, 200, 500, -1], |
|||
['50 rows', '100 rows', '200 rows', 'Show all'] |
|||
], |
|||
scrollY: '400px', |
|||
scrollX: true, |
|||
responsive: true, |
|||
searching: false, |
|||
ordering: false |
|||
}); |
|||
|
|||
$('#DeatilsModalTitle').text('Enforcement '+status1 +' Details'); |
|||
$('#DetailsModal').modal('show'); |
|||
$('#DetailsModal').on('shown.bs.modal', function () { |
|||
$.fn.dataTable.tables({ visible: true, api: true }).columns.adjust(); |
|||
}); |
|||
} |
|||
else if (response.length === 0) { |
|||
$('#pageLoader').hide(); |
|||
//alert("No data available."); |
|||
Swal.fire({ |
|||
icon: 'info', |
|||
title: 'No Data', |
|||
text: 'No data available.', |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
|
|||
} |
|||
|
|||
else { |
|||
$('#pageLoader').hide(); |
|||
//alert("Error: " + response.message); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: response.message, |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
|
|||
|
|||
} |
|||
|
|||
}, |
|||
error: function (xhr, status, error) { |
|||
$('#pageLoader').hide(); |
|||
//alert("Request failed: " + error); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: error, |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
|
|||
|
|||
} |
|||
}); |
|||
} |
|||
|
|||
|
|||
function openZoneModal(zoneCode) { |
|||
console.log("Opening modal for zone:", zoneCode); |
|||
|
|||
$('#pageLoader').show(); |
|||
|
|||
// Set data in modal (example) |
|||
$('#zoneModalTitle').text('Zone ' + zoneCode.replace("N", "") + ' Enforcement Details'); |
|||
|
|||
|
|||
$.ajax({ |
|||
url: '/commissionerreview/api/enforcement/getWardWiseDetails', |
|||
method: 'GET', |
|||
data:{zone:zoneCode}, |
|||
success: function(response) { |
|||
$('#pageLoader').hide(); |
|||
if (Array.isArray(response) && response.length > 0){ |
|||
console.log("Details Array:", response); |
|||
|
|||
|
|||
let table = $('#WardDatatable').DataTable({ |
|||
destroy: true, |
|||
autoWidth: true, |
|||
info: true, |
|||
data: response, // using response directly |
|||
columns: [ |
|||
{ |
|||
data: 'WARD', |
|||
render: function (data, type, row) { |
|||
return data ? data.replace("N", "") : ''; |
|||
} |
|||
}, |
|||
...[ |
|||
'FORM1_RECIEVED', 'FORM1_INPROGRESS', 'FORM1_COMPLETED', |
|||
'FORM2_RECIEVED', 'FORM2_INPROGRESS', 'FORM2_COMPLETED', |
|||
'FORM3_RECIEVED', 'FORM3_INPROGRESS', 'FORM3_COMPLETED', |
|||
'FORM4_RECIEVED', 'FORM4_INPROGRESS', 'FORM4_COMPLETED', |
|||
'FORM5_RECIEVED', 'FORM5_INPROGRESS', 'FORM5_COMPLETED', |
|||
'FORM6_RECIEVED', 'FORM6_INPROGRESS', 'FORM6_COMPLETED', |
|||
'FORM7_RECIEVED', 'FORM7_INPROGRESS', 'FORM7_COMPLETED' |
|||
].map(field => ({ |
|||
data: field, |
|||
createdCell: function (td, cellData) { |
|||
if (parseInt(cellData) > 0) { |
|||
$(td).css({ |
|||
color: 'blue', |
|||
textDecoration: 'underline', |
|||
cursor: 'pointer' |
|||
}); |
|||
$(td).addClass('clickable-cell'); |
|||
} |
|||
} |
|||
})) |
|||
], |
|||
dom: 'frtip', |
|||
lengthMenu: [ |
|||
[50, 100, 200, 500, -1], |
|||
['50 rows', '100 rows', '200 rows', 'Show all'] |
|||
], |
|||
scrollY: '400px', |
|||
scrollX: true, |
|||
responsive: false, |
|||
searching: false, |
|||
ordering: false |
|||
}); |
|||
$('#zoneDetailsModal').modal('show'); |
|||
} |
|||
else if (Array.isArray(response) && response.length === 0) { |
|||
$('#pageLoader').hide(); |
|||
//alert("No data available."); |
|||
|
|||
Swal.fire({ |
|||
icon: 'info', |
|||
title: 'No Data', |
|||
text: 'No data available.', |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
|
|||
} |
|||
else { |
|||
$('#pageLoader').hide(); |
|||
//alert("Error: " + response.message); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: response.message, |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
|
|||
|
|||
} |
|||
}, |
|||
error: function(xhr, status, error) { |
|||
$('#pageLoader').hide(); |
|||
//alert("Request failed: " + error); |
|||
|
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: error, |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
|
|||
|
|||
} |
|||
}); |
|||
|
|||
|
|||
const formTypeMap = { |
|||
1: "Form 1", 2: "Form 1", 3: "Form 1", |
|||
4: "Form 2", 5: "Form 2", 6: "Form 2", |
|||
7: "Form 3", 8: "Form 3", 9: "Form 3", |
|||
10: "Form 4",11: "Form 4",12: "Form 4", |
|||
13: "Form 5",14: "Form 5",15: "Form 5", |
|||
16: "Form 6",17: "Form 6",18: "Form 6", |
|||
19: "Form 7",20: "Form 7",21: "Form 7" |
|||
}; |
|||
|
|||
const statusMap = { |
|||
0: "Received", 1: "Inprogress", 2: "Completed" |
|||
}; |
|||
|
|||
// Add click listener on table body cells |
|||
$('#WardDatatable tbody').off('click').on('click', 'td.clickable-cell', function () { |
|||
|
|||
$('#pageLoader').show(); |
|||
|
|||
const table = $('#WardDatatable').DataTable(); |
|||
const cellIndex = table.cell(this).index(); // { row: x, column: y } |
|||
const columnIndex = cellIndex.column; |
|||
|
|||
// Ignore clicks on the first column (WARD) |
|||
if (columnIndex === 0) return; |
|||
|
|||
const rowData = table.row(cellIndex.row).data(); |
|||
const ward = rowData['WARD']; |
|||
const zone = zoneCode; |
|||
|
|||
// Calculate form type and status |
|||
const formType = formTypeMap[columnIndex]; |
|||
const positionInSet = (columnIndex - 1) % 3; // 0,1,2 for each formtype |
|||
const status = statusMap[positionInSet]; |
|||
|
|||
console.log("Clicked on -> Ward:", ward, "| Zone:", zone, "| FormType:", formType, "| Status:", status); |
|||
|
|||
openWardDetails(ward,zone,formType,status); |
|||
|
|||
}); |
|||
|
|||
|
|||
} |
|||
|
|||
function openWardDetails(ward,zone,formType,status){ |
|||
// Optional: show in a modal or send AJAX |
|||
$.ajax({ |
|||
url: '/commissionerreview/api/enforcement/getFormDetails', |
|||
method: 'GET', |
|||
data: { |
|||
ward: ward, |
|||
zone: zone, |
|||
formtype: formType, |
|||
status: status |
|||
}, |
|||
success: function (response) { |
|||
|
|||
$('#pageLoader').hide(); |
|||
console.log("Details:", response); |
|||
if (Array.isArray(response) && response.length > 0){ |
|||
|
|||
|
|||
let table = $('#DetailsDatatable').DataTable({ |
|||
destroy: true, |
|||
autoWidth: true, |
|||
info: true, |
|||
data: response, // using response directly |
|||
columns: [ |
|||
{ data: 'ZONE', |
|||
render: function (data, type, row) { |
|||
return data ? data.replace("N", "") : ''; |
|||
} |
|||
}, |
|||
{ data: 'WARD', |
|||
render: function (data, type, row) { |
|||
return data ? data.replace("N", "") : ''; |
|||
} |
|||
}, |
|||
{ |
|||
data: 'APPLICANT_NAME', |
|||
render: function (data, type, row) { |
|||
return `<span class="applicant-name" data-formid="${row.FORMID}" style="color: blue; text-decoration: underline; cursor: pointer;">${data}</span>`; |
|||
} |
|||
}, |
|||
{ data: 'AREA' }, |
|||
{ data: 'ADDRESS' }, |
|||
{ data: 'PINCODE' }, |
|||
|
|||
], |
|||
dom: 'frtip', |
|||
lengthMenu: [ |
|||
[50, 100, 200, 500, -1], |
|||
['50 rows', '100 rows', '200 rows', 'Show all'] |
|||
], |
|||
scrollY: '400px', |
|||
scrollX: true, |
|||
responsive: true, |
|||
searching: false, |
|||
ordering: false |
|||
}); |
|||
|
|||
$('#DeatilsModalTitle').text('Enforcement '+status +' Details'); |
|||
$('#DetailsModal').modal('show'); |
|||
$('#DetailsModal').on('shown.bs.modal', function () { |
|||
$.fn.dataTable.tables({ visible: true, api: true }).columns.adjust(); |
|||
}); |
|||
} |
|||
else if (response.length === 0) { |
|||
$('#pageLoader').hide(); |
|||
//alert("No data available."); |
|||
Swal.fire({ |
|||
icon: 'info', |
|||
title: 'No Data', |
|||
text: 'No data available.', |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
|
|||
} |
|||
|
|||
else { |
|||
$('#pageLoader').hide(); |
|||
//alert("Error: " + response.message); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: response.message, |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
|
|||
|
|||
} |
|||
|
|||
}, |
|||
error: function (xhr, status, error) { |
|||
$('#pageLoader').hide(); |
|||
//alert("Request failed: " + error); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: error, |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
|
|||
|
|||
} |
|||
}); |
|||
} |
|||
|
|||
function openApplicantModal(formId) { |
|||
console.log("Opening modal for FORMID:", formId); |
|||
|
|||
|
|||
$('#pageLoader').show(); |
|||
|
|||
$.ajax({ |
|||
url: '/commissionerreview/api/enforcement/getFormId', |
|||
method: 'GET', |
|||
data:{formid:formId}, |
|||
success: function(response) { |
|||
$('#pageLoader').hide(); |
|||
if (Array.isArray(response) && response.length > 0){ |
|||
console.log("Details Array:", response); |
|||
|
|||
|
|||
let table = $('#FormDatatable').DataTable({ |
|||
destroy: true, |
|||
autoWidth: true, |
|||
info: true, |
|||
data: response, // using response directly |
|||
columns: [ |
|||
{ data: 'ENCLOSEMENTNAME' }, |
|||
{ |
|||
data: 'CDATE', |
|||
render: function (data, type, row) { |
|||
if (!data) return ''; |
|||
let parts = data.split(' ')[0].split('/'); // ["2025", "05", "27"] |
|||
if (parts.length === 3) { |
|||
return `${parts[2]}/${parts[1]}/${parts[0]}`; // 27/05/2025 |
|||
} |
|||
return data; // fallback |
|||
} |
|||
}, |
|||
{ |
|||
data: 'FILEURL', |
|||
render: function (data, type, row) { |
|||
return `<button class="btn btn-primary btn-sm btn-view" data-url="${data}">View</button>`; |
|||
}, |
|||
className: 'text-center' |
|||
}, |
|||
], |
|||
dom: 'frtip', |
|||
lengthMenu: [ |
|||
[50, 100, 200, 500, -1], |
|||
['50 rows', '100 rows', '200 rows', 'Show all'] |
|||
], |
|||
scrollY: '400px', |
|||
scrollX: true, |
|||
responsive: false, |
|||
searching: false, |
|||
ordering: false |
|||
}); |
|||
|
|||
|
|||
$('#FormDatatable').off('click').on('click', '.btn-view', function () { |
|||
var fileUrl = $(this).data('url'); |
|||
if (fileUrl) { |
|||
window.open(fileUrl, '_blank'); // Open in new tab |
|||
} else { |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Missing File URL', |
|||
text: 'No file URL provided.', |
|||
showConfirmButton: true |
|||
}); |
|||
} |
|||
}); |
|||
|
|||
$('#ApplicantDetailsModal').modal('show'); |
|||
$('#ApplicantDetailsModal').on('shown.bs.modal', function () { |
|||
$.fn.dataTable.tables({ visible: true, api: true }).columns.adjust(); |
|||
}); |
|||
} |
|||
else if (response.length === 0) { |
|||
$('#pageLoader').hide(); |
|||
//alert("No data available."); |
|||
Swal.fire({ |
|||
icon: 'info', |
|||
title: 'No Data', |
|||
text: 'No data available.', |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
|
|||
} |
|||
else { |
|||
$('#pageLoader').hide(); |
|||
//alert("Error: " + response.message); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: response.message, |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
|
|||
|
|||
} |
|||
}, |
|||
error: function(xhr, status, error) { |
|||
$('#pageLoader').hide(); |
|||
//alert("Request failed: " + error); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: error, |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
|
|||
|
|||
} |
|||
|
|||
|
|||
|
|||
}); |
|||
|
|||
} |
|||
|
|||
|
|||
|
|||
</script> |
|||
|
|||
</body> |
|||
</html> |
|||
@ -0,0 +1,857 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="en" xmlns:th="http://www.thymeleaf.org"> |
|||
<head> |
|||
<title>Enforcement Zonewise Report Summary</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; |
|||
} |
|||
</style> |
|||
</head> |
|||
<body> |
|||
|
|||
<div class="page-header-title"> |
|||
<h4>Pendency - Notice 2 Zonewise Report</h4> |
|||
</div> |
|||
|
|||
<div id="opSummaryTable" style="display: block;" class="container"> |
|||
<table id="ZoneOpDatatable" class="table table-striped table-bordered display nowrap w-100"> |
|||
<thead> |
|||
<tr> |
|||
<th class="text-center">ZONE</th> |
|||
<th class="text-center">Notice 2 Not Initiated</th> |
|||
<th class="text-center">Notice 2 Initiated After 7 Days</th> |
|||
<th class="text-center">Notice 2 Initiated Within 7 Days</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody></tbody> |
|||
</table> |
|||
</div> |
|||
|
|||
|
|||
|
|||
|
|||
<div class="modal fade" id="zoneDetailsModal" tabindex="-1" |
|||
aria-labelledby="zoneDetailsLabel" aria-hidden="true"> |
|||
<div class="modal-dialog modal-xl"> |
|||
<div class="modal-content"> |
|||
<div class="modal-header"> |
|||
<h5 class="modal-title" id="zoneModalTitle">Pendency Ward-Wise Details</h5> |
|||
<button type="button" class="btn-close" data-bs-dismiss="modal" |
|||
aria-label="Close"></button> |
|||
</div> |
|||
<div class="modal-body"> |
|||
|
|||
<table id="WardDatatable" |
|||
class="table table-striped table-bordered display nowrap w-100"> |
|||
<thead> |
|||
<tr> |
|||
<th class="text-center">WARD</th> |
|||
<th class="text-center">NOTICE 2 NOT INITIATED</th> |
|||
<th class="text-center">NOTICE 2 INITIATED |
|||
AFTER 7 DAYS</th> |
|||
<th class="text-center">NOTICE 2 INITIATED |
|||
WITHIN 7 DAYS</th> |
|||
</tr> |
|||
|
|||
</thead> |
|||
<tbody> |
|||
|
|||
|
|||
</tbody> |
|||
</table> |
|||
|
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<div class="modal fade" id="DetailsModal" tabindex="-1" |
|||
aria-labelledby="DetailsLabel" aria-hidden="true"> |
|||
<div class="modal-dialog modal-xl"> |
|||
<div class="modal-content"> |
|||
<div class="modal-header"> |
|||
<h5 class="modal-title" id="DeatilsModalTitle">Details</h5> |
|||
<button type="button" class="btn-close" data-bs-dismiss="modal" |
|||
aria-label="Close"></button> |
|||
</div> |
|||
<div class="modal-body"> |
|||
|
|||
<table id="DetailsDatatable" |
|||
class="table table-striped table-bordered display nowrap w-100"> |
|||
<thead> |
|||
<tr> |
|||
<th class="text-center">ZONE</th> |
|||
<th class="text-center">WARD</th> |
|||
<th class="text-center">APPLICANT NAME</th> |
|||
<th class="text-center">ADDRESS</th> |
|||
<th class="text-center">AREA</th> |
|||
<th class="text-center">PINCODE</th> |
|||
|
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
|
|||
|
|||
</tbody> |
|||
</table> |
|||
|
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<div class="modal fade" id="ApplicantDetailsModal" tabindex="-1" |
|||
aria-labelledby="ApplicantDetailsLabel" aria-hidden="true"> |
|||
<div class="modal-dialog modal-xl"> |
|||
<div class="modal-content"> |
|||
<div class="modal-header"> |
|||
<h5 class="modal-title">Enforcement Details</h5> |
|||
<button type="button" class="btn-close" data-bs-dismiss="modal" |
|||
aria-label="Close"></button> |
|||
</div> |
|||
<div class="modal-body"> |
|||
|
|||
<table id="FormDatatable" |
|||
class="table table-striped table-bordered display nowrap w-100"> |
|||
<thead> |
|||
<tr> |
|||
<th class="text-center">ENCLOSEMENT NAME</th> |
|||
<th class="text-center">DATE</th> |
|||
<th class="text-center">FILE URL</th> |
|||
|
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
|
|||
|
|||
</tbody> |
|||
</table> |
|||
|
|||
</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> |
|||
$(document).ready(function () { |
|||
$('#pageLoader').show(); |
|||
$.ajax({ |
|||
url: '/commissionerreview/api/pendency/getZoneWisePendencyDetails', |
|||
method: 'GET', |
|||
success: function(response) { |
|||
$('#pageLoader').hide(); |
|||
if (Array.isArray(response) && response.length > 0){ |
|||
console.log("Details Array:", response); |
|||
|
|||
|
|||
let table = $('#ZoneOpDatatable').DataTable({ |
|||
destroy: true, |
|||
autoWidth: false, |
|||
info: true, |
|||
data: response, // using response directly |
|||
columns: [ |
|||
{ |
|||
data: 'ZONE', |
|||
title: 'Zone', |
|||
render: function (data, type, row, meta) { |
|||
const serial = meta.row + 1; |
|||
return `<a href="#" onclick="openZoneModal('${data}')" style="text-decoration: underline;">${serial}</a>`; |
|||
} |
|||
}, |
|||
...[ |
|||
'Form 2 Not Initiated', 'Form 2 Initiated After 7 Days', 'Form 2 Initiated Within 7 Days' |
|||
|
|||
].map(field => ({ |
|||
data: field, |
|||
createdCell: function (td, cellData) { |
|||
if (parseInt(cellData) > 0) { |
|||
$(td).css({ |
|||
color: 'blue', |
|||
textDecoration: 'underline', |
|||
cursor: 'pointer' |
|||
}); |
|||
$(td).addClass('zoneclickable-cell'); |
|||
} |
|||
} |
|||
})) |
|||
], |
|||
dom: 'frtip', |
|||
lengthMenu: [ |
|||
[50, 100, 200, 500, -1], |
|||
['50 rows', '100 rows', '200 rows', 'Show all'] |
|||
], |
|||
scrollY: 'auto', |
|||
scrollX: true, |
|||
responsive: false, |
|||
searching: false, |
|||
ordering: false |
|||
}); |
|||
|
|||
const formTypeMap1 = { |
|||
1: "Form 2 Not Initiated", |
|||
2: "Form 2 Initiated After 7 Days", |
|||
3: "Form 2 Initiated Within 7 Days" |
|||
}; |
|||
|
|||
|
|||
// Add click listener on table body cells |
|||
$('#ZoneOpDatatable tbody').off('click').on('click', 'td.zoneclickable-cell', function () { |
|||
|
|||
$('#pageLoader').show(); |
|||
|
|||
const table1 = $('#ZoneOpDatatable').DataTable(); |
|||
const cellIndex1 = table1.cell(this).index(); // { row: x, column: y } |
|||
const columnIndex1 = cellIndex1.column; |
|||
|
|||
// Ignore clicks on the first column (WARD) |
|||
if (columnIndex1 === 0) return; |
|||
|
|||
const rowData1 = table1.row(cellIndex1.row).data(); |
|||
|
|||
const zone1 = rowData1['ZONE']; |
|||
|
|||
// Calculate form type and status |
|||
const formType1 = formTypeMap1[columnIndex1]; |
|||
|
|||
console.log("Clicked on -> Zone:", zone1, "| FormType:", formType1); |
|||
|
|||
openZoneDetails(zone1,formType1); |
|||
|
|||
}); |
|||
|
|||
} |
|||
else if (Array.isArray(response) && response.length === 0) { |
|||
$('#pageLoader').hide(); |
|||
//alert("No data available."); |
|||
|
|||
Swal.fire({ |
|||
icon: 'info', |
|||
title: 'No Data', |
|||
text: 'No data available.', |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
|
|||
} |
|||
else { |
|||
$('#pageLoader').hide(); |
|||
//alert("Error: " + response.message); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: response.message, |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
|
|||
|
|||
} |
|||
}, |
|||
error: function(xhr, status, error) { |
|||
$('#pageLoader').hide(); |
|||
// alert("Request failed: " + error); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: error, |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
|
|||
|
|||
} |
|||
}); |
|||
|
|||
|
|||
$('#DetailsDatatable tbody').off('click').on('click', '.applicant-name', function () { |
|||
const formId = $(this).data('formid'); |
|||
|
|||
openApplicantModal(formId); |
|||
|
|||
|
|||
}); |
|||
|
|||
|
|||
}); |
|||
|
|||
|
|||
function openZoneDetails(zone,formType){ |
|||
// Optional: show in a modal or send AJAX |
|||
$.ajax({ |
|||
url: '/commissionerreview/api/pendency/getPendencyDetailReport', |
|||
method: 'GET', |
|||
data: { |
|||
zone: zone, |
|||
status: formType |
|||
}, |
|||
success: function (response) { |
|||
|
|||
$('#pageLoader').hide(); |
|||
console.log("Details:", response); |
|||
if (Array.isArray(response) && response.length > 0){ |
|||
|
|||
|
|||
let table = $('#DetailsDatatable').DataTable({ |
|||
destroy: true, |
|||
autoWidth: true, |
|||
info: true, |
|||
data: response, // using response directly |
|||
columns: [ |
|||
{ data: 'ZONE', |
|||
render: function (data, type, row) { |
|||
return data ? data.replace("N", "") : ''; |
|||
} |
|||
}, |
|||
{ data: 'WARD', |
|||
render: function (data, type, row) { |
|||
return data ? data.replace("N", "") : ''; |
|||
} |
|||
}, |
|||
{ |
|||
data: 'APPLICANT_NAME' |
|||
|
|||
}, |
|||
{ data: 'AREA' }, |
|||
{ data: 'ADDRESS' }, |
|||
{ data: 'PINCODE' }, |
|||
|
|||
], |
|||
dom: 'frtip', |
|||
lengthMenu: [ |
|||
[50, 100, 200, 500, -1], |
|||
['50 rows', '100 rows', '200 rows', 'Show all'] |
|||
], |
|||
scrollY: '400px', |
|||
scrollX: true, |
|||
responsive: true, |
|||
searching: false, |
|||
ordering: false |
|||
}); |
|||
|
|||
$('#DeatilsModalTitle').text('Enforcement Pendency Details'); |
|||
$('#DetailsModal').modal('show'); |
|||
$('#DetailsModal').on('shown.bs.modal', function () { |
|||
$.fn.dataTable.tables({ visible: true, api: true }).columns.adjust(); |
|||
}); |
|||
} |
|||
else if (response.length === 0) { |
|||
$('#pageLoader').hide(); |
|||
//alert("No data available."); |
|||
Swal.fire({ |
|||
icon: 'info', |
|||
title: 'No Data', |
|||
text: 'No data available.', |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
|
|||
} |
|||
|
|||
else { |
|||
$('#pageLoader').hide(); |
|||
//alert("Error: " + response.message); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: response.message, |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
|
|||
|
|||
} |
|||
|
|||
}, |
|||
error: function (xhr, status, error) { |
|||
$('#pageLoader').hide(); |
|||
//alert("Request failed: " + error); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: error, |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
|
|||
|
|||
} |
|||
}); |
|||
} |
|||
|
|||
|
|||
function openZoneModal(zoneCode) { |
|||
console.log("Opening modal for zone:", zoneCode); |
|||
|
|||
$('#pageLoader').show(); |
|||
|
|||
// Set data in modal (example) |
|||
$('#zoneModalTitle').text('Zone ' + zoneCode.replace("N", "") + ' Pendency Details'); |
|||
|
|||
|
|||
$.ajax({ |
|||
url: '/commissionerreview/api/pendency/getWardWisePendencyDetails', |
|||
method: 'GET', |
|||
data:{zone:zoneCode}, |
|||
success: function(response) { |
|||
$('#pageLoader').hide(); |
|||
if (Array.isArray(response) && response.length > 0){ |
|||
console.log("Details Array ward:", response); |
|||
|
|||
|
|||
let table = $('#WardDatatable').DataTable({ |
|||
destroy: true, |
|||
autoWidth: true, |
|||
info: true, |
|||
data: response, // using response directly |
|||
columns: [ |
|||
{ |
|||
data: 'WARD', |
|||
render: function (data, type, row) { |
|||
return data ? data.replace("N", "") : ''; |
|||
} |
|||
}, |
|||
...[ |
|||
'Form 2 Not Initiated', 'Form 2 Initiated After 7 Days', 'Form 2 Initiated Within 7 Days' |
|||
|
|||
].map(field => ({ |
|||
data: field, |
|||
createdCell: function (td, cellData) { |
|||
if (parseInt(cellData) > 0) { |
|||
$(td).css({ |
|||
color: 'blue', |
|||
textDecoration: 'underline', |
|||
cursor: 'pointer' |
|||
}); |
|||
$(td).addClass('clickable-cell'); |
|||
} |
|||
} |
|||
})) |
|||
], |
|||
dom: 'frtip', |
|||
lengthMenu: [ |
|||
[50, 100, 200, 500, -1], |
|||
['50 rows', '100 rows', '200 rows', 'Show all'] |
|||
], |
|||
scrollY: '400px', |
|||
scrollX: true, |
|||
responsive: false, |
|||
searching: false, |
|||
ordering: false |
|||
}); |
|||
$('#zoneDetailsModal').modal('show'); |
|||
|
|||
$('#zoneDetailsModal').on('shown.bs.modal', function () { |
|||
$.fn.dataTable.tables({ visible: true, api: true }).columns.adjust(); |
|||
}); |
|||
} |
|||
else if (Array.isArray(response) && response.length === 0) { |
|||
$('#pageLoader').hide(); |
|||
//alert("No data available."); |
|||
|
|||
Swal.fire({ |
|||
icon: 'info', |
|||
title: 'No Data', |
|||
text: 'No data available.', |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
|
|||
} |
|||
else { |
|||
$('#pageLoader').hide(); |
|||
//alert("Error: " + response.message); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: response.message, |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
|
|||
|
|||
} |
|||
}, |
|||
error: function(xhr, status, error) { |
|||
$('#pageLoader').hide(); |
|||
//alert("Request failed: " + error); |
|||
|
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: error, |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
|
|||
|
|||
} |
|||
}); |
|||
|
|||
|
|||
const formTypeMap = { |
|||
1: "Form 2 Not Initiated", |
|||
2: "Form 2 Initiated After 7 Days", |
|||
3: "Form 2 Initiated Within 7 Days" |
|||
}; |
|||
|
|||
// Add click listener on table body cells |
|||
$('#WardDatatable tbody').off('click').on('click', 'td.clickable-cell', function () { |
|||
|
|||
$('#pageLoader').show(); |
|||
|
|||
const table = $('#WardDatatable').DataTable(); |
|||
const cellIndex = table.cell(this).index(); // { row: x, column: y } |
|||
const columnIndex = cellIndex.column; |
|||
|
|||
// Ignore clicks on the first column (WARD) |
|||
if (columnIndex === 0) return; |
|||
|
|||
const rowData = table.row(cellIndex.row).data(); |
|||
const ward = rowData['WARD']; |
|||
const zone = zoneCode; |
|||
|
|||
// Calculate form type and status |
|||
const formType = formTypeMap[columnIndex]; |
|||
|
|||
console.log("Clicked on -> Ward:", ward, "| Zone:", zone, "| FormType:", formType); |
|||
|
|||
openWardDetails(ward,zone,formType); |
|||
|
|||
}); |
|||
|
|||
|
|||
} |
|||
|
|||
function openWardDetails(ward,zone,formType){ |
|||
// Optional: show in a modal or send AJAX |
|||
$.ajax({ |
|||
url: '/commissionerreview/api/pendency/getPendencyDetailReportByWard', |
|||
method: 'GET', |
|||
data: { |
|||
ward: ward, |
|||
zone: zone, |
|||
status: formType |
|||
}, |
|||
success: function (response) { |
|||
|
|||
$('#pageLoader').hide(); |
|||
console.log("Details:", response); |
|||
if (Array.isArray(response) && response.length > 0){ |
|||
|
|||
|
|||
let table = $('#DetailsDatatable').DataTable({ |
|||
destroy: true, |
|||
autoWidth: true, |
|||
info: true, |
|||
data: response, // using response directly |
|||
columns: [ |
|||
{ data: 'ZONE', |
|||
render: function (data, type, row) { |
|||
return data ? data.replace("N", "") : ''; |
|||
} |
|||
}, |
|||
{ data: 'WARD', |
|||
render: function (data, type, row) { |
|||
return data ? data.replace("N", "") : ''; |
|||
} |
|||
}, |
|||
{ |
|||
data: 'APPLICANT_NAME' |
|||
|
|||
}, |
|||
{ data: 'AREA' }, |
|||
{ data: 'ADDRESS' }, |
|||
{ data: 'PINCODE' }, |
|||
|
|||
], |
|||
dom: 'frtip', |
|||
lengthMenu: [ |
|||
[50, 100, 200, 500, -1], |
|||
['50 rows', '100 rows', '200 rows', 'Show all'] |
|||
], |
|||
scrollY: '400px', |
|||
scrollX: true, |
|||
responsive: true, |
|||
searching: false, |
|||
ordering: false |
|||
}); |
|||
|
|||
$('#DeatilsModalTitle').text('Enforcement Pendency Details'); |
|||
$('#DetailsModal').modal('show'); |
|||
$('#DetailsModal').on('shown.bs.modal', function () { |
|||
$.fn.dataTable.tables({ visible: true, api: true }).columns.adjust(); |
|||
}); |
|||
} |
|||
else if (response.length === 0) { |
|||
$('#pageLoader').hide(); |
|||
//alert("No data available."); |
|||
Swal.fire({ |
|||
icon: 'info', |
|||
title: 'No Data', |
|||
text: 'No data available.', |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
|
|||
} |
|||
|
|||
else { |
|||
$('#pageLoader').hide(); |
|||
//alert("Error: " + response.message); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: response.message, |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
|
|||
|
|||
} |
|||
|
|||
}, |
|||
error: function (xhr, status, error) { |
|||
$('#pageLoader').hide(); |
|||
//alert("Request failed: " + error); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: error, |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
|
|||
|
|||
} |
|||
}); |
|||
} |
|||
|
|||
function openApplicantModal(formId) { |
|||
console.log("Opening modal for FORMID:", formId); |
|||
|
|||
|
|||
$('#pageLoader').show(); |
|||
|
|||
$.ajax({ |
|||
url: '/commissionerreview/api/enforcement/getFormId', |
|||
method: 'GET', |
|||
data:{formid:formId}, |
|||
success: function(response) { |
|||
$('#pageLoader').hide(); |
|||
if (Array.isArray(response) && response.length > 0){ |
|||
console.log("Details Array:", response); |
|||
|
|||
|
|||
let table = $('#FormDatatable').DataTable({ |
|||
destroy: true, |
|||
autoWidth: true, |
|||
info: true, |
|||
data: response, // using response directly |
|||
columns: [ |
|||
{ data: 'ENCLOSEMENTNAME' }, |
|||
{ |
|||
data: 'CDATE', |
|||
render: function (data, type, row) { |
|||
if (!data) return ''; |
|||
let parts = data.split(' ')[0].split('/'); // ["2025", "05", "27"] |
|||
if (parts.length === 3) { |
|||
return `${parts[2]}/${parts[1]}/${parts[0]}`; // 27/05/2025 |
|||
} |
|||
return data; // fallback |
|||
} |
|||
}, |
|||
{ |
|||
data: 'FILEURL', |
|||
render: function (data, type, row) { |
|||
return `<button class="btn btn-primary btn-sm btn-view" data-url="${data}">View</button>`; |
|||
}, |
|||
className: 'text-center' |
|||
}, |
|||
], |
|||
dom: 'frtip', |
|||
lengthMenu: [ |
|||
[50, 100, 200, 500, -1], |
|||
['50 rows', '100 rows', '200 rows', 'Show all'] |
|||
], |
|||
scrollY: '400px', |
|||
scrollX: true, |
|||
responsive: false, |
|||
searching: false, |
|||
ordering: false |
|||
}); |
|||
|
|||
|
|||
$('#FormDatatable').off('click').on('click', '.btn-view', function () { |
|||
var fileUrl = $(this).data('url'); |
|||
if (fileUrl) { |
|||
window.open(fileUrl, '_blank'); // Open in new tab |
|||
} else { |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Missing File URL', |
|||
text: 'No file URL provided.', |
|||
showConfirmButton: true |
|||
}); |
|||
} |
|||
}); |
|||
|
|||
$('#ApplicantDetailsModal').modal('show'); |
|||
$('#ApplicantDetailsModal').on('shown.bs.modal', function () { |
|||
$.fn.dataTable.tables({ visible: true, api: true }).columns.adjust(); |
|||
}); |
|||
} |
|||
else if (response.length === 0) { |
|||
$('#pageLoader').hide(); |
|||
//alert("No data available."); |
|||
Swal.fire({ |
|||
icon: 'info', |
|||
title: 'No Data', |
|||
text: 'No data available.', |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
|
|||
} |
|||
else { |
|||
$('#pageLoader').hide(); |
|||
//alert("Error: " + response.message); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: response.message, |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
|
|||
|
|||
} |
|||
}, |
|||
error: function(xhr, status, error) { |
|||
$('#pageLoader').hide(); |
|||
//alert("Request failed: " + error); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: error, |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
|
|||
|
|||
} |
|||
|
|||
|
|||
|
|||
}); |
|||
|
|||
} |
|||
|
|||
|
|||
|
|||
</script> |
|||
|
|||
</body> |
|||
</html> |
|||
@ -0,0 +1,857 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="en" xmlns:th="http://www.thymeleaf.org"> |
|||
<head> |
|||
<title>Enforcement Pendency Zone wise Report Summary</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; |
|||
} |
|||
</style> |
|||
</head> |
|||
<body> |
|||
|
|||
<div class="page-header-title"> |
|||
<h4>Pendency - Notice 3 and 4 Zone wise Report</h4> |
|||
</div> |
|||
|
|||
<div id="opSummaryTable" style="display: block;" class="container"> |
|||
<table id="ZoneOpDatatable" class="table table-striped table-bordered display nowrap w-100"> |
|||
<thead> |
|||
<tr> |
|||
<th class="text-center">ZONE</th> |
|||
<th class="text-center">Notice 3 Not Initiated</th> |
|||
<th class="text-center">Notice 3 Initiated After 7 Days</th> |
|||
<th class="text-center">Notice 3 Initiated Within 7 Days</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody></tbody> |
|||
</table> |
|||
</div> |
|||
|
|||
|
|||
|
|||
|
|||
<div class="modal fade" id="zoneDetailsModal" tabindex="-1" |
|||
aria-labelledby="zoneDetailsLabel" aria-hidden="true"> |
|||
<div class="modal-dialog modal-xl"> |
|||
<div class="modal-content"> |
|||
<div class="modal-header"> |
|||
<h5 class="modal-title" id="zoneModalTitle">Pendency Ward-Wise Details</h5> |
|||
<button type="button" class="btn-close" data-bs-dismiss="modal" |
|||
aria-label="Close"></button> |
|||
</div> |
|||
<div class="modal-body"> |
|||
|
|||
<table id="WardDatatable" |
|||
class="table table-striped table-bordered display nowrap w-100"> |
|||
<thead> |
|||
<tr> |
|||
<th class="text-center">WARD</th> |
|||
<th class="text-center">NOTICE 3 NOT INITIATED</th> |
|||
<th class="text-center">NOTICE 3 INITIATED |
|||
AFTER 7 DAYS</th> |
|||
<th class="text-center">NOTICE 3 INITIATED |
|||
WITHIN 7 DAYS</th> |
|||
</tr> |
|||
|
|||
</thead> |
|||
<tbody> |
|||
|
|||
|
|||
</tbody> |
|||
</table> |
|||
|
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<div class="modal fade" id="DetailsModal" tabindex="-1" |
|||
aria-labelledby="DetailsLabel" aria-hidden="true"> |
|||
<div class="modal-dialog modal-xl"> |
|||
<div class="modal-content"> |
|||
<div class="modal-header"> |
|||
<h5 class="modal-title" id="DeatilsModalTitle">Details</h5> |
|||
<button type="button" class="btn-close" data-bs-dismiss="modal" |
|||
aria-label="Close"></button> |
|||
</div> |
|||
<div class="modal-body"> |
|||
|
|||
<table id="DetailsDatatable" |
|||
class="table table-striped table-bordered display nowrap w-100"> |
|||
<thead> |
|||
<tr> |
|||
<th class="text-center">ZONE</th> |
|||
<th class="text-center">WARD</th> |
|||
<th class="text-center">APPLICANT NAME</th> |
|||
<th class="text-center">ADDRESS</th> |
|||
<th class="text-center">AREA</th> |
|||
<th class="text-center">PINCODE</th> |
|||
|
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
|
|||
|
|||
</tbody> |
|||
</table> |
|||
|
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<div class="modal fade" id="ApplicantDetailsModal" tabindex="-1" |
|||
aria-labelledby="ApplicantDetailsLabel" aria-hidden="true"> |
|||
<div class="modal-dialog modal-xl"> |
|||
<div class="modal-content"> |
|||
<div class="modal-header"> |
|||
<h5 class="modal-title">Enforcement Details</h5> |
|||
<button type="button" class="btn-close" data-bs-dismiss="modal" |
|||
aria-label="Close"></button> |
|||
</div> |
|||
<div class="modal-body"> |
|||
|
|||
<table id="FormDatatable" |
|||
class="table table-striped table-bordered display nowrap w-100"> |
|||
<thead> |
|||
<tr> |
|||
<th class="text-center">ENCLOSEMENT NAME</th> |
|||
<th class="text-center">DATE</th> |
|||
<th class="text-center">FILE URL</th> |
|||
|
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
|
|||
|
|||
</tbody> |
|||
</table> |
|||
|
|||
</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> |
|||
$(document).ready(function () { |
|||
$('#pageLoader').show(); |
|||
$.ajax({ |
|||
url: '/commissionerreview/api/pendency/getZoneWiseForm3PendencyDetails', |
|||
method: 'GET', |
|||
success: function(response) { |
|||
$('#pageLoader').hide(); |
|||
if (Array.isArray(response) && response.length > 0){ |
|||
console.log("Details Array:", response); |
|||
|
|||
|
|||
let table = $('#ZoneOpDatatable').DataTable({ |
|||
destroy: true, |
|||
autoWidth: false, |
|||
info: true, |
|||
data: response, // using response directly |
|||
columns: [ |
|||
{ |
|||
data: 'ZONE', |
|||
title: 'Zone', |
|||
render: function (data, type, row, meta) { |
|||
const serial = meta.row + 1; |
|||
return `<a href="#" onclick="openZoneModal('${data}')" style="text-decoration: underline;">${serial}</a>`; |
|||
} |
|||
}, |
|||
...[ |
|||
'Not Initiated', 'After 15 Days', 'Within 15 Days' |
|||
|
|||
].map(field => ({ |
|||
data: field, |
|||
createdCell: function (td, cellData) { |
|||
if (parseInt(cellData) > 0) { |
|||
$(td).css({ |
|||
color: 'blue', |
|||
textDecoration: 'underline', |
|||
cursor: 'pointer' |
|||
}); |
|||
$(td).addClass('zoneclickable-cell'); |
|||
} |
|||
} |
|||
})) |
|||
], |
|||
dom: 'frtip', |
|||
lengthMenu: [ |
|||
[50, 100, 200, 500, -1], |
|||
['50 rows', '100 rows', '200 rows', 'Show all'] |
|||
], |
|||
scrollY: 'auto', |
|||
scrollX: true, |
|||
responsive: false, |
|||
searching: false, |
|||
ordering: false |
|||
}); |
|||
|
|||
const formTypeMap1 = { |
|||
1: "Form 3/4 Not Initiated", |
|||
2: "Form 3/4 Initiated After 15 Days", |
|||
3: "Form 3/4 Initiated Within 15 Days" |
|||
}; |
|||
|
|||
|
|||
// Add click listener on table body cells |
|||
$('#ZoneOpDatatable tbody').off('click').on('click', 'td.zoneclickable-cell', function () { |
|||
|
|||
$('#pageLoader').show(); |
|||
|
|||
const table1 = $('#ZoneOpDatatable').DataTable(); |
|||
const cellIndex1 = table1.cell(this).index(); // { row: x, column: y } |
|||
const columnIndex1 = cellIndex1.column; |
|||
|
|||
// Ignore clicks on the first column (WARD) |
|||
if (columnIndex1 === 0) return; |
|||
|
|||
const rowData1 = table1.row(cellIndex1.row).data(); |
|||
|
|||
const zone1 = rowData1['ZONE']; |
|||
|
|||
// Calculate form type and status |
|||
const formType1 = formTypeMap1[columnIndex1]; |
|||
|
|||
console.log("Clicked on -> Zone:", zone1, "| FormType:", formType1); |
|||
|
|||
openZoneDetails(zone1,formType1); |
|||
|
|||
}); |
|||
|
|||
} |
|||
else if (Array.isArray(response) && response.length === 0) { |
|||
$('#pageLoader').hide(); |
|||
//alert("No data available."); |
|||
|
|||
Swal.fire({ |
|||
icon: 'info', |
|||
title: 'No Data', |
|||
text: 'No data available.', |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
|
|||
} |
|||
else { |
|||
$('#pageLoader').hide(); |
|||
//alert("Error: " + response.message); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: response.message, |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
|
|||
|
|||
} |
|||
}, |
|||
error: function(xhr, status, error) { |
|||
$('#pageLoader').hide(); |
|||
// alert("Request failed: " + error); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: error, |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
|
|||
|
|||
} |
|||
}); |
|||
|
|||
|
|||
$('#DetailsDatatable tbody').off('click').on('click', '.applicant-name', function () { |
|||
const formId = $(this).data('formid'); |
|||
|
|||
openApplicantModal(formId); |
|||
|
|||
|
|||
}); |
|||
|
|||
|
|||
}); |
|||
|
|||
|
|||
function openZoneDetails(zone,formType){ |
|||
// Optional: show in a modal or send AJAX |
|||
$.ajax({ |
|||
url: '/commissionerreview/api/pendency/getForm3PendencyDetailReport', |
|||
method: 'GET', |
|||
data: { |
|||
zone: zone, |
|||
status: formType |
|||
}, |
|||
success: function (response) { |
|||
|
|||
$('#pageLoader').hide(); |
|||
console.log("Details:", response); |
|||
if (Array.isArray(response) && response.length > 0){ |
|||
|
|||
|
|||
let table = $('#DetailsDatatable').DataTable({ |
|||
destroy: true, |
|||
autoWidth: true, |
|||
info: true, |
|||
data: response, // using response directly |
|||
columns: [ |
|||
{ data: 'ZONE', |
|||
render: function (data, type, row) { |
|||
return data ? data.replace("N", "") : ''; |
|||
} |
|||
}, |
|||
{ data: 'WARD', |
|||
render: function (data, type, row) { |
|||
return data ? data.replace("N", "") : ''; |
|||
} |
|||
}, |
|||
{ |
|||
data: 'APPLICANT_NAME' |
|||
|
|||
}, |
|||
{ data: 'AREA' }, |
|||
{ data: 'ADDRESS' }, |
|||
{ data: 'PINCODE' }, |
|||
|
|||
], |
|||
dom: 'frtip', |
|||
lengthMenu: [ |
|||
[50, 100, 200, 500, -1], |
|||
['50 rows', '100 rows', '200 rows', 'Show all'] |
|||
], |
|||
scrollY: '400px', |
|||
scrollX: true, |
|||
responsive: true, |
|||
searching: false, |
|||
ordering: false |
|||
}); |
|||
|
|||
$('#DeatilsModalTitle').text('Enforcement Form 3 Pendency Details'); |
|||
$('#DetailsModal').modal('show'); |
|||
$('#DetailsModal').on('shown.bs.modal', function () { |
|||
$.fn.dataTable.tables({ visible: true, api: true }).columns.adjust(); |
|||
}); |
|||
} |
|||
else if (response.length === 0) { |
|||
$('#pageLoader').hide(); |
|||
//alert("No data available."); |
|||
Swal.fire({ |
|||
icon: 'info', |
|||
title: 'No Data', |
|||
text: 'No data available.', |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
|
|||
} |
|||
|
|||
else { |
|||
$('#pageLoader').hide(); |
|||
//alert("Error: " + response.message); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: response.message, |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
|
|||
|
|||
} |
|||
|
|||
}, |
|||
error: function (xhr, status, error) { |
|||
$('#pageLoader').hide(); |
|||
//alert("Request failed: " + error); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: error, |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
|
|||
|
|||
} |
|||
}); |
|||
} |
|||
|
|||
|
|||
function openZoneModal(zoneCode) { |
|||
console.log("Opening modal for zone:", zoneCode); |
|||
|
|||
$('#pageLoader').show(); |
|||
|
|||
// Set data in modal (example) |
|||
$('#zoneModalTitle').text('Zone ' + zoneCode.replace("N", "") + ' Pendency Details'); |
|||
|
|||
|
|||
$.ajax({ |
|||
url: '/commissionerreview/api/pendency/getWardWiseForm3PendencyDetails', |
|||
method: 'GET', |
|||
data:{zone:zoneCode}, |
|||
success: function(response) { |
|||
$('#pageLoader').hide(); |
|||
if (Array.isArray(response) && response.length > 0){ |
|||
console.log("Details Array ward:", response); |
|||
|
|||
|
|||
let table = $('#WardDatatable').DataTable({ |
|||
destroy: true, |
|||
autoWidth: true, |
|||
info: true, |
|||
data: response, // using response directly |
|||
columns: [ |
|||
{ |
|||
data: 'WARD', |
|||
render: function (data, type, row) { |
|||
return data ? data.replace("N", "") : ''; |
|||
} |
|||
}, |
|||
...[ |
|||
'Not Initiated', 'After 15 Days', 'Within 15 Days' |
|||
|
|||
].map(field => ({ |
|||
data: field, |
|||
createdCell: function (td, cellData) { |
|||
if (parseInt(cellData) > 0) { |
|||
$(td).css({ |
|||
color: 'blue', |
|||
textDecoration: 'underline', |
|||
cursor: 'pointer' |
|||
}); |
|||
$(td).addClass('clickable-cell'); |
|||
} |
|||
} |
|||
})) |
|||
], |
|||
dom: 'frtip', |
|||
lengthMenu: [ |
|||
[50, 100, 200, 500, -1], |
|||
['50 rows', '100 rows', '200 rows', 'Show all'] |
|||
], |
|||
scrollY: '400px', |
|||
scrollX: true, |
|||
responsive: false, |
|||
searching: false, |
|||
ordering: false |
|||
}); |
|||
$('#zoneDetailsModal').modal('show'); |
|||
|
|||
$('#zoneDetailsModal').on('shown.bs.modal', function () { |
|||
$.fn.dataTable.tables({ visible: true, api: true }).columns.adjust(); |
|||
}); |
|||
} |
|||
else if (Array.isArray(response) && response.length === 0) { |
|||
$('#pageLoader').hide(); |
|||
//alert("No data available."); |
|||
|
|||
Swal.fire({ |
|||
icon: 'info', |
|||
title: 'No Data', |
|||
text: 'No data available.', |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
|
|||
} |
|||
else { |
|||
$('#pageLoader').hide(); |
|||
//alert("Error: " + response.message); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: response.message, |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
|
|||
|
|||
} |
|||
}, |
|||
error: function(xhr, status, error) { |
|||
$('#pageLoader').hide(); |
|||
//alert("Request failed: " + error); |
|||
|
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: error, |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
|
|||
|
|||
} |
|||
}); |
|||
|
|||
|
|||
const formTypeMap = { |
|||
1: "Form 3/4 Not Initiated", |
|||
2: "Form 3/4 Initiated After 15 Days", |
|||
3: "Form 3/4 Initiated Within 15 Days" |
|||
}; |
|||
|
|||
// Add click listener on table body cells |
|||
$('#WardDatatable tbody').off('click').on('click', 'td.clickable-cell', function () { |
|||
|
|||
$('#pageLoader').show(); |
|||
|
|||
const table = $('#WardDatatable').DataTable(); |
|||
const cellIndex = table.cell(this).index(); // { row: x, column: y } |
|||
const columnIndex = cellIndex.column; |
|||
|
|||
// Ignore clicks on the first column (WARD) |
|||
if (columnIndex === 0) return; |
|||
|
|||
const rowData = table.row(cellIndex.row).data(); |
|||
const ward = rowData['WARD']; |
|||
const zone = zoneCode; |
|||
|
|||
// Calculate form type and status |
|||
const formType = formTypeMap[columnIndex]; |
|||
|
|||
console.log("Clicked on -> Ward:", ward, "| Zone:", zone, "| FormType:", formType); |
|||
|
|||
openWardDetails(ward,zone,formType); |
|||
|
|||
}); |
|||
|
|||
|
|||
} |
|||
|
|||
function openWardDetails(ward,zone,formType){ |
|||
// Optional: show in a modal or send AJAX |
|||
$.ajax({ |
|||
url: '/commissionerreview/api/pendency/getForm3PendencyDetailReportByWard', |
|||
method: 'GET', |
|||
data: { |
|||
ward: ward, |
|||
zone: zone, |
|||
status: formType |
|||
}, |
|||
success: function (response) { |
|||
|
|||
$('#pageLoader').hide(); |
|||
console.log("Details:", response); |
|||
if (Array.isArray(response) && response.length > 0){ |
|||
|
|||
|
|||
let table = $('#DetailsDatatable').DataTable({ |
|||
destroy: true, |
|||
autoWidth: true, |
|||
info: true, |
|||
data: response, // using response directly |
|||
columns: [ |
|||
{ data: 'ZONE', |
|||
render: function (data, type, row) { |
|||
return data ? data.replace("N", "") : ''; |
|||
} |
|||
}, |
|||
{ data: 'WARD', |
|||
render: function (data, type, row) { |
|||
return data ? data.replace("N", "") : ''; |
|||
} |
|||
}, |
|||
{ |
|||
data: 'APPLICANT_NAME' |
|||
|
|||
}, |
|||
{ data: 'AREA' }, |
|||
{ data: 'ADDRESS' }, |
|||
{ data: 'PINCODE' }, |
|||
|
|||
], |
|||
dom: 'frtip', |
|||
lengthMenu: [ |
|||
[50, 100, 200, 500, -1], |
|||
['50 rows', '100 rows', '200 rows', 'Show all'] |
|||
], |
|||
scrollY: '400px', |
|||
scrollX: true, |
|||
responsive: true, |
|||
searching: false, |
|||
ordering: false |
|||
}); |
|||
|
|||
$('#DeatilsModalTitle').text('Enforcement Form 3 Pendency Details'); |
|||
$('#DetailsModal').modal('show'); |
|||
$('#DetailsModal').on('shown.bs.modal', function () { |
|||
$.fn.dataTable.tables({ visible: true, api: true }).columns.adjust(); |
|||
}); |
|||
} |
|||
else if (response.length === 0) { |
|||
$('#pageLoader').hide(); |
|||
//alert("No data available."); |
|||
Swal.fire({ |
|||
icon: 'info', |
|||
title: 'No Data', |
|||
text: 'No data available.', |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
|
|||
} |
|||
|
|||
else { |
|||
$('#pageLoader').hide(); |
|||
//alert("Error: " + response.message); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: response.message, |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
|
|||
|
|||
} |
|||
|
|||
}, |
|||
error: function (xhr, status, error) { |
|||
$('#pageLoader').hide(); |
|||
//alert("Request failed: " + error); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: error, |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
|
|||
|
|||
} |
|||
}); |
|||
} |
|||
|
|||
function openApplicantModal(formId) { |
|||
console.log("Opening modal for FORMID:", formId); |
|||
|
|||
|
|||
$('#pageLoader').show(); |
|||
|
|||
$.ajax({ |
|||
url: '/commissionerreview/api/enforcement/getFormId', |
|||
method: 'GET', |
|||
data:{formid:formId}, |
|||
success: function(response) { |
|||
$('#pageLoader').hide(); |
|||
if (Array.isArray(response) && response.length > 0){ |
|||
console.log("Details Array:", response); |
|||
|
|||
|
|||
let table = $('#FormDatatable').DataTable({ |
|||
destroy: true, |
|||
autoWidth: true, |
|||
info: true, |
|||
data: response, // using response directly |
|||
columns: [ |
|||
{ data: 'ENCLOSEMENTNAME' }, |
|||
{ |
|||
data: 'CDATE', |
|||
render: function (data, type, row) { |
|||
if (!data) return ''; |
|||
let parts = data.split(' ')[0].split('/'); // ["2025", "05", "27"] |
|||
if (parts.length === 3) { |
|||
return `${parts[2]}/${parts[1]}/${parts[0]}`; // 27/05/2025 |
|||
} |
|||
return data; // fallback |
|||
} |
|||
}, |
|||
{ |
|||
data: 'FILEURL', |
|||
render: function (data, type, row) { |
|||
return `<button class="btn btn-primary btn-sm btn-view" data-url="${data}">View</button>`; |
|||
}, |
|||
className: 'text-center' |
|||
}, |
|||
], |
|||
dom: 'frtip', |
|||
lengthMenu: [ |
|||
[50, 100, 200, 500, -1], |
|||
['50 rows', '100 rows', '200 rows', 'Show all'] |
|||
], |
|||
scrollY: '400px', |
|||
scrollX: true, |
|||
responsive: false, |
|||
searching: false, |
|||
ordering: false |
|||
}); |
|||
|
|||
|
|||
$('#FormDatatable').off('click').on('click', '.btn-view', function () { |
|||
var fileUrl = $(this).data('url'); |
|||
if (fileUrl) { |
|||
window.open(fileUrl, '_blank'); // Open in new tab |
|||
} else { |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Missing File URL', |
|||
text: 'No file URL provided.', |
|||
showConfirmButton: true |
|||
}); |
|||
} |
|||
}); |
|||
|
|||
$('#ApplicantDetailsModal').modal('show'); |
|||
$('#ApplicantDetailsModal').on('shown.bs.modal', function () { |
|||
$.fn.dataTable.tables({ visible: true, api: true }).columns.adjust(); |
|||
}); |
|||
} |
|||
else if (response.length === 0) { |
|||
$('#pageLoader').hide(); |
|||
//alert("No data available."); |
|||
Swal.fire({ |
|||
icon: 'info', |
|||
title: 'No Data', |
|||
text: 'No data available.', |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
|
|||
} |
|||
else { |
|||
$('#pageLoader').hide(); |
|||
//alert("Error: " + response.message); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: response.message, |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
|
|||
|
|||
} |
|||
}, |
|||
error: function(xhr, status, error) { |
|||
$('#pageLoader').hide(); |
|||
//alert("Request failed: " + error); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: error, |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
|
|||
|
|||
} |
|||
|
|||
|
|||
|
|||
}); |
|||
|
|||
} |
|||
|
|||
|
|||
|
|||
</script> |
|||
|
|||
</body> |
|||
</html> |
|||
@ -0,0 +1,796 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="en" xmlns:th="http://www.thymeleaf.org"> |
|||
<head> |
|||
<title>Enforcement Pendency Zone wise Report Summary</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; |
|||
} |
|||
</style> |
|||
</head> |
|||
<body> |
|||
|
|||
<div class="page-header-title"> |
|||
<h4>Pendency - Notice 7 Zone wise Report</h4> |
|||
</div> |
|||
|
|||
<div id="opSummaryTable" style="display: block;" class="container"> |
|||
<table id="ZoneOpDatatable" class="table table-striped table-bordered display nowrap w-100"> |
|||
<thead> |
|||
<tr> |
|||
<th class="text-center">ZONE</th> |
|||
<th class="text-center">Notice 7 Not Initiated After 30 Days</th> |
|||
<th class="text-center">Notice 7 Initiated After 30 Days</th> |
|||
<th class="text-center">Notice 7 Initiated Within 30 Days</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody></tbody> |
|||
</table> |
|||
</div> |
|||
|
|||
|
|||
<div class="modal fade" id="zoneDetailsModal" tabindex="-1" |
|||
aria-labelledby="zoneDetailsLabel" aria-hidden="true"> |
|||
<div class="modal-dialog modal-xl"> |
|||
<div class="modal-content"> |
|||
<div class="modal-header"> |
|||
<h5 class="modal-title" id="zoneModalTitle">Pendency Ward-Wise Details</h5> |
|||
<button type="button" class="btn-close" data-bs-dismiss="modal" |
|||
aria-label="Close"></button> |
|||
</div> |
|||
<div class="modal-body"> |
|||
|
|||
<table id="WardDatatable" |
|||
class="table table-striped table-bordered display nowrap w-100"> |
|||
<thead> |
|||
<tr> |
|||
<th class="text-center">WARD</th> |
|||
<th class="text-center">Notice 7 Not Initiated After 30 Days</th> |
|||
<th class="text-center">Notice 7 Initiated After 30 Days</th> |
|||
<th class="text-center">Notice 7 Initiated Within 30 Days</th> |
|||
</tr> |
|||
|
|||
</thead> |
|||
<tbody> |
|||
|
|||
|
|||
</tbody> |
|||
</table> |
|||
|
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<div class="modal fade" id="DetailsModal" tabindex="-1" |
|||
aria-labelledby="DetailsLabel" aria-hidden="true"> |
|||
<div class="modal-dialog modal-xl"> |
|||
<div class="modal-content"> |
|||
<div class="modal-header"> |
|||
<h5 class="modal-title" id="DeatilsModalTitle">Details</h5> |
|||
<button type="button" class="btn-close" data-bs-dismiss="modal" |
|||
aria-label="Close"></button> |
|||
</div> |
|||
<div class="modal-body"> |
|||
|
|||
<table id="DetailsDatatable" |
|||
class="table table-striped table-bordered display nowrap w-100"> |
|||
<thead> |
|||
<tr> |
|||
<th class="text-center">ZONE</th> |
|||
<th class="text-center">WARD</th> |
|||
<th class="text-center">APPLICANT NAME</th> |
|||
<th class="text-center">ADDRESS</th> |
|||
<th class="text-center">AREA</th> |
|||
<th class="text-center">PINCODE</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
</tbody> |
|||
</table> |
|||
|
|||
</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> |
|||
$(document).ready(function () { |
|||
$('#pageLoader').show(); |
|||
$.ajax({ |
|||
url: '/commissionerreview/api/pendency/getZoneWiseForm7PendencyDetails', |
|||
method: 'GET', |
|||
success: function (response) { |
|||
$('#pageLoader').hide(); |
|||
if (Array.isArray(response) && response.length > 0) { |
|||
console.log("Details Array:", response); |
|||
|
|||
|
|||
let table = $('#ZoneOpDatatable').DataTable({ |
|||
destroy: true, |
|||
autoWidth: false, |
|||
info: true, |
|||
data: response, // using response directly |
|||
columns: [ |
|||
{ |
|||
data: 'ZONE', |
|||
title: 'Zone', |
|||
render: function (data, type, row, meta) { |
|||
const serial = meta.row + 1; |
|||
return `<a href="#" onclick="openZoneModal('${data}')" style="text-decoration: underline;">${serial}</a>`; |
|||
} |
|||
}, |
|||
...[ |
|||
'F7 Not Initiated After 30 Days', 'F7 Initiated After 30 Days', 'F7 Initiated Within 30 Days' |
|||
|
|||
].map(field => ({ |
|||
data: field, |
|||
createdCell: function (td, cellData) { |
|||
if (parseInt(cellData) > 0) { |
|||
$(td).css({ |
|||
color: 'blue', |
|||
textDecoration: 'underline', |
|||
cursor: 'pointer' |
|||
}); |
|||
$(td).addClass('zoneclickable-cell'); |
|||
} |
|||
} |
|||
})) |
|||
], |
|||
dom: 'frtip', |
|||
lengthMenu: [ |
|||
[50, 100, 200, 500, -1], |
|||
['50 rows', '100 rows', '200 rows', 'Show all'] |
|||
], |
|||
scrollY: 'auto', |
|||
scrollX: true, |
|||
responsive: false, |
|||
searching: false, |
|||
ordering: false |
|||
}); |
|||
|
|||
const formTypeMap1 = { |
|||
1: "Form 7 Not Initiated After 30 Days", |
|||
2: "Form 7 Initiated After 30 Days", |
|||
3: "Form 7 Initiated Within 30 Days" |
|||
}; |
|||
|
|||
|
|||
// Add click listener on table body cells |
|||
$('#ZoneOpDatatable tbody').off('click').on('click', 'td.zoneclickable-cell', function () { |
|||
|
|||
$('#pageLoader').show(); |
|||
|
|||
const table1 = $('#ZoneOpDatatable').DataTable(); |
|||
const cellIndex1 = table1.cell(this).index(); // { row: x, column: y } |
|||
const columnIndex1 = cellIndex1.column; |
|||
|
|||
// Ignore clicks on the first column (WARD) |
|||
if (columnIndex1 === 0) return; |
|||
|
|||
const rowData1 = table1.row(cellIndex1.row).data(); |
|||
|
|||
const zone1 = rowData1['ZONE']; |
|||
|
|||
// Calculate form type and status |
|||
const formType1 = formTypeMap1[columnIndex1]; |
|||
|
|||
console.log("Clicked on -> Zone:", zone1, "| FormType:", formType1); |
|||
|
|||
openZoneDetails(zone1, formType1); |
|||
|
|||
}); |
|||
|
|||
} else if (Array.isArray(response) && response.length === 0) { |
|||
$('#pageLoader').hide(); |
|||
//alert("No data available."); |
|||
|
|||
Swal.fire({ |
|||
icon: 'info', |
|||
title: 'No Data', |
|||
text: 'No data available.', |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
|
|||
} else { |
|||
$('#pageLoader').hide(); |
|||
//alert("Error: " + response.message); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: response.message, |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
|
|||
} |
|||
}, |
|||
error: function (xhr, status, error) { |
|||
$('#pageLoader').hide(); |
|||
// alert("Request failed: " + error); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: error, |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
|
|||
} |
|||
}); |
|||
|
|||
|
|||
$('#DetailsDatatable tbody').off('click').on('click', '.applicant-name', function () { |
|||
const formId = $(this).data('formid'); |
|||
|
|||
openApplicantModal(formId); |
|||
|
|||
|
|||
}); |
|||
|
|||
|
|||
}); |
|||
|
|||
|
|||
function openZoneDetails(zone, formType) { |
|||
// Optional: show in a modal or send AJAX |
|||
$.ajax({ |
|||
url: '/commissionerreview/api/pendency/getForm7PendencyDetailReportByZone', |
|||
method: 'GET', |
|||
data: { |
|||
zone: zone, |
|||
status: formType |
|||
}, |
|||
success: function (response) { |
|||
|
|||
$('#pageLoader').hide(); |
|||
console.log("Details:", response); |
|||
if (Array.isArray(response) && response.length > 0) { |
|||
|
|||
|
|||
let table = $('#DetailsDatatable').DataTable({ |
|||
destroy: true, |
|||
autoWidth: true, |
|||
info: true, |
|||
data: response, // using response directly |
|||
columns: [ |
|||
{ |
|||
data: 'ZONE', |
|||
render: function (data, type, row) { |
|||
return data ? data.replace("N", "") : ''; |
|||
} |
|||
}, |
|||
{ |
|||
data: 'WARD', |
|||
render: function (data, type, row) { |
|||
return data ? data.replace("N", "") : ''; |
|||
} |
|||
}, |
|||
{ |
|||
data: 'APPLICANT_NAME' |
|||
|
|||
}, |
|||
{data: 'AREA'}, |
|||
{data: 'ADDRESS'}, |
|||
{data: 'PINCODE'}, |
|||
|
|||
], |
|||
dom: 'frtip', |
|||
lengthMenu: [ |
|||
[50, 100, 200, 500, -1], |
|||
['50 rows', '100 rows', '200 rows', 'Show all'] |
|||
], |
|||
scrollY: '400px', |
|||
scrollX: true, |
|||
responsive: true, |
|||
searching: false, |
|||
ordering: false |
|||
}); |
|||
|
|||
$('#DeatilsModalTitle').text('Enforcement Form 7 Pendency Details'); |
|||
$('#DetailsModal').modal('show'); |
|||
$('#DetailsModal').on('shown.bs.modal', function () { |
|||
$.fn.dataTable.tables({visible: true, api: true}).columns.adjust(); |
|||
}); |
|||
} else if (response.length === 0) { |
|||
$('#pageLoader').hide(); |
|||
//alert("No data available."); |
|||
Swal.fire({ |
|||
icon: 'info', |
|||
title: 'No Data', |
|||
text: 'No data available.', |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
|
|||
} else { |
|||
$('#pageLoader').hide(); |
|||
//alert("Error: " + response.message); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: response.message, |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
|
|||
} |
|||
|
|||
}, |
|||
error: function (xhr, status, error) { |
|||
$('#pageLoader').hide(); |
|||
//alert("Request failed: " + error); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: error, |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
|
|||
} |
|||
}); |
|||
} |
|||
|
|||
|
|||
function openZoneModal(zoneCode) { |
|||
console.log("Opening modal for zone:", zoneCode); |
|||
|
|||
$('#pageLoader').show(); |
|||
|
|||
// Set data in modal (example) |
|||
$('#zoneModalTitle').text('Zone ' + zoneCode.replace("N", "") + ' Pendency Details'); |
|||
|
|||
|
|||
$.ajax({ |
|||
url: '/commissionerreview/api/pendency/getWardWiseForm7PendencyDetails', |
|||
method: 'GET', |
|||
data: {zone: zoneCode}, |
|||
success: function (response) { |
|||
$('#pageLoader').hide(); |
|||
if (Array.isArray(response) && response.length > 0) { |
|||
console.log("Details Array ward:", response); |
|||
|
|||
|
|||
let table = $('#WardDatatable').DataTable({ |
|||
destroy: true, |
|||
autoWidth: true, |
|||
info: true, |
|||
data: response, // using response directly |
|||
columns: [ |
|||
{ |
|||
data: 'WARD', |
|||
render: function (data, type, row) { |
|||
return data ? data.replace("N", "") : ''; |
|||
} |
|||
}, |
|||
...[ |
|||
'F7 Not Initiated After 30 Days', 'F7 Initiated After 30 Days', 'F7 Initiated Within 30 Days' |
|||
|
|||
].map(field => ({ |
|||
data: field, |
|||
createdCell: function (td, cellData) { |
|||
if (parseInt(cellData) > 0) { |
|||
$(td).css({ |
|||
color: 'blue', |
|||
textDecoration: 'underline', |
|||
cursor: 'pointer' |
|||
}); |
|||
$(td).addClass('clickable-cell'); |
|||
} |
|||
} |
|||
})) |
|||
], |
|||
dom: 'frtip', |
|||
lengthMenu: [ |
|||
[50, 100, 200, 500, -1], |
|||
['50 rows', '100 rows', '200 rows', 'Show all'] |
|||
], |
|||
scrollY: '400px', |
|||
scrollX: true, |
|||
responsive: false, |
|||
searching: false, |
|||
ordering: false |
|||
}); |
|||
$('#zoneDetailsModal').modal('show'); |
|||
|
|||
$('#zoneDetailsModal').on('shown.bs.modal', function () { |
|||
$.fn.dataTable.tables({visible: true, api: true}).columns.adjust(); |
|||
}); |
|||
} else if (Array.isArray(response) && response.length === 0) { |
|||
$('#pageLoader').hide(); |
|||
//alert("No data available."); |
|||
|
|||
Swal.fire({ |
|||
icon: 'info', |
|||
title: 'No Data', |
|||
text: 'No data available.', |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
|
|||
} else { |
|||
$('#pageLoader').hide(); |
|||
//alert("Error: " + response.message); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: response.message, |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
|
|||
} |
|||
}, |
|||
error: function (xhr, status, error) { |
|||
$('#pageLoader').hide(); |
|||
//alert("Request failed: " + error); |
|||
|
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: error, |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
|
|||
} |
|||
}); |
|||
|
|||
const formTypeMap = { |
|||
1: "Form 7 Not Initiated After 30 Days", |
|||
2: "Form 7 Initiated After 30 Days", |
|||
3: "Form 7 Initiated Within 30 Days" |
|||
}; |
|||
|
|||
// Add click listener on table body cells |
|||
$('#WardDatatable tbody').off('click').on('click', 'td.clickable-cell', function () { |
|||
|
|||
$('#pageLoader').show(); |
|||
|
|||
const table = $('#WardDatatable').DataTable(); |
|||
const cellIndex = table.cell(this).index(); // { row: x, column: y } |
|||
const columnIndex = cellIndex.column; |
|||
|
|||
// Ignore clicks on the first column (WARD) |
|||
if (columnIndex === 0) return; |
|||
|
|||
const rowData = table.row(cellIndex.row).data(); |
|||
const ward = rowData['WARD']; |
|||
const zone = zoneCode; |
|||
|
|||
// Calculate form type and status |
|||
const formType = formTypeMap[columnIndex]; |
|||
|
|||
console.log("Clicked on -> Ward:", ward, "| Zone:", zone, "| FormType:", formType); |
|||
|
|||
openWardDetails(ward, zone, formType); |
|||
|
|||
}); |
|||
|
|||
|
|||
} |
|||
|
|||
function openWardDetails(ward, zone, formType) { |
|||
// Optional: show in a modal or send AJAX |
|||
$.ajax({ |
|||
url: '/commissionerreview/api/pendency/getForm7PendencyDetailReportByWard', |
|||
method: 'GET', |
|||
data: { |
|||
ward: ward, |
|||
zone: zone, |
|||
status: formType |
|||
}, |
|||
success: function (response) { |
|||
|
|||
$('#pageLoader').hide(); |
|||
console.log("Details:", response); |
|||
if (Array.isArray(response) && response.length > 0) { |
|||
|
|||
|
|||
let table = $('#DetailsDatatable').DataTable({ |
|||
destroy: true, |
|||
autoWidth: true, |
|||
info: true, |
|||
data: response, // using response directly |
|||
columns: [ |
|||
{ |
|||
data: 'ZONE', |
|||
render: function (data, type, row) { |
|||
return data ? data.replace("N", "") : ''; |
|||
} |
|||
}, |
|||
{ |
|||
data: 'WARD', |
|||
render: function (data, type, row) { |
|||
return data ? data.replace("N", "") : ''; |
|||
} |
|||
}, |
|||
{ |
|||
data: 'APPLICANT_NAME' |
|||
|
|||
}, |
|||
{data: 'AREA'}, |
|||
{data: 'ADDRESS'}, |
|||
{data: 'PINCODE'}, |
|||
|
|||
], |
|||
dom: 'frtip', |
|||
lengthMenu: [ |
|||
[50, 100, 200, 500, -1], |
|||
['50 rows', '100 rows', '200 rows', 'Show all'] |
|||
], |
|||
scrollY: '400px', |
|||
scrollX: true, |
|||
responsive: true, |
|||
searching: false, |
|||
ordering: false |
|||
}); |
|||
|
|||
$('#DeatilsModalTitle').text('Enforcement Form 7 Pendency Details'); |
|||
$('#DetailsModal').modal('show'); |
|||
$('#DetailsModal').on('shown.bs.modal', function () { |
|||
$.fn.dataTable.tables({visible: true, api: true}).columns.adjust(); |
|||
}); |
|||
} else if (response.length === 0) { |
|||
$('#pageLoader').hide(); |
|||
//alert("No data available."); |
|||
Swal.fire({ |
|||
icon: 'info', |
|||
title: 'No Data', |
|||
text: 'No data available.', |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
|
|||
} else { |
|||
$('#pageLoader').hide(); |
|||
//alert("Error: " + response.message); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: response.message, |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
|
|||
} |
|||
|
|||
}, |
|||
error: function (xhr, status, error) { |
|||
$('#pageLoader').hide(); |
|||
//alert("Request failed: " + error); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: error, |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
|
|||
} |
|||
}); |
|||
} |
|||
|
|||
function openApplicantModal(formId) { |
|||
console.log("Opening modal for FORMID:", formId); |
|||
|
|||
|
|||
$('#pageLoader').show(); |
|||
|
|||
$.ajax({ |
|||
url: '/commissionerreview/api/enforcement/getFormId', |
|||
method: 'GET', |
|||
data: {formid: formId}, |
|||
success: function (response) { |
|||
$('#pageLoader').hide(); |
|||
if (Array.isArray(response) && response.length > 0) { |
|||
console.log("Details Array:", response); |
|||
|
|||
|
|||
let table = $('#FormDatatable').DataTable({ |
|||
destroy: true, |
|||
autoWidth: true, |
|||
info: true, |
|||
data: response, // using response directly |
|||
columns: [ |
|||
{data: 'ENCLOSEMENTNAME'}, |
|||
{ |
|||
data: 'CDATE', |
|||
render: function (data, type, row) { |
|||
if (!data) return ''; |
|||
let parts = data.split(' ')[0].split('/'); // ["2025", "05", "27"] |
|||
if (parts.length === 3) { |
|||
return `${parts[2]}/${parts[1]}/${parts[0]}`; // 27/05/2025 |
|||
} |
|||
return data; // fallback |
|||
} |
|||
}, |
|||
{ |
|||
data: 'FILEURL', |
|||
render: function (data, type, row) { |
|||
return `<button class="btn btn-primary btn-sm btn-view" data-url="${data}">View</button>`; |
|||
}, |
|||
className: 'text-center' |
|||
}, |
|||
], |
|||
dom: 'frtip', |
|||
lengthMenu: [ |
|||
[50, 100, 200, 500, -1], |
|||
['50 rows', '100 rows', '200 rows', 'Show all'] |
|||
], |
|||
scrollY: '400px', |
|||
scrollX: true, |
|||
responsive: false, |
|||
searching: false, |
|||
ordering: false |
|||
}); |
|||
|
|||
|
|||
$('#FormDatatable').off('click').on('click', '.btn-view', function () { |
|||
var fileUrl = $(this).data('url'); |
|||
if (fileUrl) { |
|||
window.open(fileUrl, '_blank'); // Open in new tab |
|||
} else { |
|||
Swal.fire({ |
|||
icon: 'warning', |
|||
title: 'Missing File URL', |
|||
text: 'No file URL provided.', |
|||
showConfirmButton: true |
|||
}); |
|||
} |
|||
}); |
|||
|
|||
$('#ApplicantDetailsModal').modal('show'); |
|||
$('#ApplicantDetailsModal').on('shown.bs.modal', function () { |
|||
$.fn.dataTable.tables({visible: true, api: true}).columns.adjust(); |
|||
}); |
|||
} else if (response.length === 0) { |
|||
$('#pageLoader').hide(); |
|||
//alert("No data available."); |
|||
Swal.fire({ |
|||
icon: 'info', |
|||
title: 'No Data', |
|||
text: 'No data available.', |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
|
|||
} else { |
|||
$('#pageLoader').hide(); |
|||
//alert("Error: " + response.message); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: response.message, |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
|
|||
} |
|||
}, |
|||
error: function (xhr, status, error) { |
|||
$('#pageLoader').hide(); |
|||
//alert("Request failed: " + error); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: error, |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
|
|||
} |
|||
|
|||
|
|||
}); |
|||
|
|||
} |
|||
|
|||
|
|||
</script> |
|||
|
|||
</body> |
|||
</html> |
|||
@ -0,0 +1,662 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="en" xmlns:th="http://www.thymeleaf.org"> |
|||
<head> |
|||
<title>Sofa Bed collection Zonewise Report Summary</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; |
|||
} |
|||
#DetailsModal .modal-body{ |
|||
max-height: 70vh; |
|||
overflow-y: auto; |
|||
} |
|||
|
|||
</style> |
|||
</head> |
|||
<body> |
|||
|
|||
<div class="page-header-title"> |
|||
<h4>Sofa and Bed Collection - Zonewise Report</h4> |
|||
</div> |
|||
|
|||
<div id="opSummaryTable" style="display: block;" class="container"> |
|||
<table id="ZoneOpDatatable" class="table table-striped table-bordered display nowrap w-100"> |
|||
<thead> |
|||
<tr> |
|||
<th class="text-center">Zone</th> |
|||
<th class="text-center">Total Request</th> |
|||
<th class="text-center">This week</th> |
|||
|
|||
<th class="text-center">Completed</th> |
|||
<th class="text-center">User Cancelled </th> |
|||
<th class="text-center">Officer Cancelled</th> |
|||
<th class="text-center">Over The week</th> |
|||
|
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
|
|||
|
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
|
|||
<div class="modal fade" id="zoneDetailsModal" tabindex="-1" aria-labelledby="zoneDetailsLabel" aria-hidden="true" data-bs-keyboard="false" data-bs-backdrop="static"> |
|||
<div class="modal-dialog modal-xl"> |
|||
<div class="modal-content"> |
|||
<div class="modal-header"> |
|||
<h5 class="modal-title" id="zoneModalTitle">Zone Details</h5> |
|||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> |
|||
</div> |
|||
<div class="modal-body"> |
|||
|
|||
<table id="WardDatatable" class="table table-striped table-bordered display nowrap w-100"> |
|||
<thead> |
|||
<tr> |
|||
<th class="text-center">Ward </th> |
|||
<th class="text-center">Total Request</th> |
|||
<th class="text-center">This week</th> |
|||
<th class="text-center">Completed</th> |
|||
<th class="text-center">User Cancelled </th> |
|||
<th class="text-center">Officer Cancelled</th> |
|||
<th class="text-center">Over The week</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
|
|||
|
|||
</tbody> |
|||
</table> |
|||
|
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<div class="modal fade" id="DetailsModal" tabindex="-1" aria-labelledby="DetailsLabel" aria-hidden="true" data-bs-keyboard="false" data-bs-backdrop="static"> |
|||
<div class="modal-dialog modal-xl"> |
|||
<div class="modal-content"> |
|||
<div class="modal-header"> |
|||
<h5 class="modal-title" id="DeatilsModalTitle">Details</h5> |
|||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> |
|||
</div> |
|||
<div class="modal-body" id="detailscontent"> |
|||
|
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
<!-- Image Modal --> |
|||
<div class="modal fade" id="imageModal" tabindex="-1" role="dialog" aria-hidden="true"> |
|||
<div class="modal-dialog modal-dialog-centered modal-lg" role="document"> |
|||
<div class="modal-content"> |
|||
<div class="modal-body text-center p-0"> |
|||
<img id="modalImage" src="" class="img-fluid" alt="Preview" style="max-height: 80vh;"/> |
|||
</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> |
|||
|
|||
$(document).on('click', '.preview-img', function() { |
|||
const src = $(this).attr('src'); |
|||
$('#modalImage').attr('src', src); |
|||
$('#imageModal').modal('show'); |
|||
}); |
|||
|
|||
$(document).ready(function () { |
|||
$('#pageLoader').show(); |
|||
$.ajax({ |
|||
url: '/commissionerreview/api/sofabedcollection/getZoneWiseDetails', |
|||
method: 'GET', |
|||
success: function(response) { |
|||
$('#pageLoader').hide(); |
|||
|
|||
if (response.status === "success") { |
|||
|
|||
if (Array.isArray(response.data) && response.data.length > 0) { |
|||
console.log("Details Array:", response); |
|||
|
|||
let table = $('#ZoneOpDatatable').DataTable({ |
|||
destroy: true, |
|||
autoWidth: true, |
|||
info: true, |
|||
data: response.data, // using response directly |
|||
columns: [ |
|||
{ |
|||
data: 'zone', |
|||
render: function (data, type, row) { |
|||
// Skip last row |
|||
if (row === response.data[response.data.length - 1]) { |
|||
return data; // just plain text |
|||
} else { |
|||
return `<a href="#" onclick="openZoneModal('${data}')" style="text-decoration: underline;">${data}</a>`; |
|||
} |
|||
} |
|||
}, |
|||
{ data: 'total_request', defaultContent: '-', className: 'text-center' }, |
|||
{ data: 'open', defaultContent: '-', className: 'text-center' }, |
|||
{ data: 'completed', defaultContent: '-', className: 'text-center' }, |
|||
{ data: 'user_cancel', defaultContent: '-', className: 'text-center' }, |
|||
{ data: 'officer_cancel', defaultContent: '-', className: 'text-center' }, |
|||
{ data: 'pending', defaultContent: '-', className: 'text-center' } |
|||
], |
|||
dom: 'frtip', |
|||
lengthMenu: [ |
|||
[50, 100, 200, 500, -1], |
|||
['50 rows', '100 rows', '200 rows', 'Show all'] |
|||
], |
|||
scrollY: 'auto', |
|||
scrollX: true, |
|||
responsive: false, |
|||
searching: false, |
|||
ordering: false |
|||
}); |
|||
|
|||
} |
|||
|
|||
else if(Array.isArray(response.data) && response.data.length === 0) { |
|||
$('#pageLoader').hide(); |
|||
//alert("No data available."); |
|||
|
|||
Swal.fire({ |
|||
icon: 'info', |
|||
title: 'No Data', |
|||
text: 'No data available.', |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
} |
|||
|
|||
else { |
|||
$('#pageLoader').hide(); |
|||
//alert("Error: " + response.message); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: 'Error', |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
} |
|||
|
|||
} |
|||
|
|||
else if(response.status === "nodata") { |
|||
$('#pageLoader').hide(); |
|||
//alert("No data available."); |
|||
|
|||
Swal.fire({ |
|||
icon: 'info', |
|||
title: 'No Data', |
|||
text: 'No data available.', |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
} |
|||
|
|||
else { |
|||
$('#pageLoader').hide(); |
|||
//alert("Error: " + response.message); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: response.message, |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
|
|||
|
|||
} |
|||
}, |
|||
error: function(xhr, status, error) { |
|||
$('#pageLoader').hide(); |
|||
// alert("Request failed: " + error); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: error, |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
|
|||
|
|||
} |
|||
}); |
|||
|
|||
$('#zoneDetailsModal').on('shown.bs.modal', function () { |
|||
if ($.fn.DataTable.isDataTable('#WardDatatable')) { |
|||
let questionDatatable = $('#WardDatatable').DataTable(); |
|||
questionDatatable.columns.adjust().draw(); |
|||
} |
|||
}); |
|||
|
|||
}); |
|||
|
|||
|
|||
function openZoneModal(zoneCode) { |
|||
console.log("Opening modal for zone:", zoneCode); |
|||
|
|||
$('#pageLoader').show(); |
|||
|
|||
// Set data in modal (example) |
|||
$('#zoneModalTitle').text('Zone ' + zoneCode + ' Details'); |
|||
|
|||
|
|||
$.ajax({ |
|||
url: '/commissionerreview/api/sofabedcollection/getWardDetails', |
|||
method: 'GET', |
|||
data:{zone:zoneCode}, |
|||
success: function(response) { |
|||
$('#pageLoader').hide(); |
|||
|
|||
if (response.status === "success") { |
|||
|
|||
if (Array.isArray(response.data) && response.data.length > 0){ |
|||
console.log("Details Array:", response); |
|||
|
|||
|
|||
let table = $('#WardDatatable').DataTable({ |
|||
destroy: true, |
|||
autoWidth: true, |
|||
info: true, |
|||
data: response.data, // using response directly |
|||
columns: [ |
|||
{ data: 'division', defaultContent: '-', className: 'text-center' }, |
|||
{ data: 'total_request', defaultContent: '-', className: 'text-center' }, |
|||
{ data: 'open', defaultContent: '-', className: 'text-center' }, |
|||
{ data: 'completed', defaultContent: '-', className: 'text-center' }, |
|||
{ data: 'user_cancel', defaultContent: '-', className: 'text-center' }, |
|||
{ data: 'officer_cancel', defaultContent: '-', className: 'text-center' }, |
|||
{ data: 'pending', defaultContent: '-', className: 'text-center' } |
|||
], |
|||
dom: 'frtip', |
|||
lengthMenu: [ |
|||
[50, 100, 200, 500, -1], |
|||
['50 rows', '100 rows', '200 rows', 'Show all'] |
|||
], |
|||
scrollY: '400px', |
|||
scrollX: true, |
|||
responsive: false, |
|||
searching: false, |
|||
ordering: false, |
|||
createdRow: function (row, data, dataIndex) { |
|||
// Skip last row |
|||
if (dataIndex === response.data.length - 1) { |
|||
return; |
|||
} |
|||
|
|||
const clickableCols = ['open', 'completed', 'user_cancel', 'officer_cancel', 'pending']; |
|||
|
|||
clickableCols.forEach((col, index) => { |
|||
const value = parseInt(data[col]); |
|||
if (!isNaN(value) && value > 0) { |
|||
$('td:eq(' + (index + 2) + ')', row).css({ |
|||
'color': '#007bff', |
|||
'text-decoration': 'underline', |
|||
'cursor': 'pointer' |
|||
}); |
|||
} |
|||
}); |
|||
} |
|||
}); |
|||
|
|||
|
|||
|
|||
$('#zoneDetailsModal').modal('show'); |
|||
} |
|||
else if (Array.isArray(response.data) && response.data.length === 0){ |
|||
$('#pageLoader').hide(); |
|||
//alert("No data available."); |
|||
|
|||
Swal.fire({ |
|||
icon: 'info', |
|||
title: 'No Data', |
|||
text: 'No data available.', |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
} |
|||
else{ |
|||
$('#pageLoader').hide(); |
|||
//alert("Error: " + response.message); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: response.message, |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
} |
|||
} |
|||
else if (response.status === "nodata") { |
|||
$('#pageLoader').hide(); |
|||
//alert("No data available."); |
|||
|
|||
Swal.fire({ |
|||
icon: 'info', |
|||
title: 'No Data', |
|||
text: 'No data available.', |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
|
|||
} |
|||
else { |
|||
$('#pageLoader').hide(); |
|||
//alert("Error: " + response.message); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: response.message, |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
|
|||
|
|||
} |
|||
|
|||
// Attach click handler after DataTable initialization |
|||
$('#WardDatatable tbody').off('click').on('click', 'td', function () { |
|||
let table = $('#WardDatatable').DataTable(); |
|||
let rowData = table.row($(this).closest('tr')).data(); |
|||
let columnIndex = table.cell(this).index().column; |
|||
|
|||
// Define column-to-status mapping (based on your requirement) |
|||
const columnMap = { |
|||
2: 1, // open |
|||
3: 2, // completed |
|||
6: 3, // pending |
|||
4: 4, // user_cancel |
|||
5: 5 // officer_cancel |
|||
}; |
|||
|
|||
// Get column name using column index |
|||
let columnName = table.column(columnIndex).dataSrc(); |
|||
|
|||
// If clicked column is one of the target columns |
|||
if (columnMap[columnIndex]) { |
|||
let status = columnMap[columnIndex]; |
|||
let value = rowData[columnName]; |
|||
let division = rowData['division']; |
|||
|
|||
// Proceed only if value > 0 |
|||
if (parseInt(value) > 0) { |
|||
openWardDetails(division, status); |
|||
} |
|||
} |
|||
}); |
|||
|
|||
}, |
|||
error: function(xhr, status, error) { |
|||
$('#pageLoader').hide(); |
|||
//alert("Request failed: " + error); |
|||
|
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: error, |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
|
|||
|
|||
} |
|||
}); |
|||
|
|||
|
|||
} |
|||
|
|||
function openWardDetails(division, status){ |
|||
console.log("division:",division," status:",status); |
|||
// Optional: show in a modal or send AJAX |
|||
$.ajax({ |
|||
url: '/commissionerreview/api/sofabedcollection/getWardStatusDetails', |
|||
method: 'GET', |
|||
data: { |
|||
ward: division, |
|||
status: status |
|||
}, |
|||
success: function (response) { |
|||
|
|||
$('#pageLoader').hide(); |
|||
console.log("Details:", response); |
|||
if(response.status === "success"){ |
|||
|
|||
let modalBody = $("#detailscontent"); |
|||
modalBody.empty(); // Clear previous content |
|||
|
|||
if (Array.isArray(response.data) && response.data.length > 0){ |
|||
|
|||
response.data.forEach(item => { |
|||
// Create a container div for each record |
|||
let streetDiv = $('<div class="mb-4 p-3 border rounded shadow-sm bg-light"></div>'); |
|||
|
|||
// Info section (2 columns layout) |
|||
let infoHtml = ` |
|||
<div class="container-fluid"> |
|||
<div class="row mb-2"> |
|||
<div class="col-md-4"><strong>Zone:</strong> ${item.zone || '-'}</div> |
|||
<div class="col-md-4"><strong>Ward:</strong> ${item.division || '-'}</div> |
|||
<div class="col-md-4"><strong>Request ID:</strong> ${item.request_id || '-'}</div> |
|||
</div> |
|||
<div class="row mb-2"> |
|||
<div class="col-md-4"><strong>User Name:</strong> ${item.user_name || '-'}</div> |
|||
<div class="col-md-4"><strong>Status:</strong> ${item.status || '-'}</div> |
|||
<div class="col-md-4"><strong>Mobile Number:</strong> ${item.mobile || '-'}</div> |
|||
</div> |
|||
<div class="row mb-2"> |
|||
<div class="col-md-8"><strong>Address:</strong> ${item.address || '-'}</div> |
|||
<div class="col-md-4"><strong>Created Date:</strong> ${item.cdate || '-'}</div> |
|||
</div> |
|||
</div> |
|||
`; |
|||
streetDiv.append(infoHtml); |
|||
|
|||
|
|||
// 🧾 Items section (as divs) |
|||
let itemsHtml = ` |
|||
<div class="mt-3"> |
|||
<p><strong>Items:</strong></p> |
|||
${ |
|||
Array.isArray(item.items) && item.items.length > 0 |
|||
? item.items.map((it, idx) => ` |
|||
<div class="d-flex flex-wrap border rounded p-2 mb-2 "> |
|||
<div class="flex-fill"><strong>Item ${idx + 1}:</strong> ${it.item_name || '-'}</div> |
|||
<div class="flex-fill"><strong>Quantity:</strong> ${it.quantity ?? '-'}</div> |
|||
</div> |
|||
`).join("") |
|||
: `<p class="text-muted">No items available.</p>` |
|||
} |
|||
</div> |
|||
`; |
|||
streetDiv.append(itemsHtml); |
|||
|
|||
|
|||
// Image section |
|||
let imagesHtml = ` |
|||
<hr> |
|||
<div class="mt-2" style="text-align:center;"> |
|||
<p><strong>Image:</strong></p> |
|||
${ |
|||
item.image_url |
|||
? (() => { |
|||
// Handle multiple comma-separated images |
|||
return item.image_url.split(",").map(img => { |
|||
let trimmed = img.trim(); |
|||
return ` |
|||
<img src="${trimmed}" |
|||
alt="Image" |
|||
class="img-thumbnail me-2 mb-2 preview-img" |
|||
style="width: 250px; height: 200px; object-fit: contain; cursor: pointer;" |
|||
data-bs-toggle="modal" |
|||
data-bs-target="#imageModal" |
|||
/> |
|||
`; |
|||
}).join(""); |
|||
})() |
|||
: `<p class="text-muted">No images available.</p>` |
|||
} |
|||
</div> |
|||
`; |
|||
streetDiv.append(imagesHtml); |
|||
|
|||
modalBody.append(streetDiv); |
|||
}); |
|||
|
|||
|
|||
$('#DeatilsModalTitle').text('Division '+division +' Details'); |
|||
$('#DetailsModal').modal('show'); |
|||
} |
|||
|
|||
else if (Array.isArray(response.data) && response.data.length === 0){ |
|||
$('#pageLoader').hide(); |
|||
//alert("No data available."); |
|||
Swal.fire({ |
|||
icon: 'info', |
|||
title: 'No Data', |
|||
text: 'No data available.', |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
} |
|||
|
|||
else{ |
|||
$('#pageLoader').hide(); |
|||
//alert("Error: " + response.message); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: response.message, |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
} |
|||
} |
|||
|
|||
else if (response.status === "nodata") { |
|||
$('#pageLoader').hide(); |
|||
//alert("No data available."); |
|||
Swal.fire({ |
|||
icon: 'info', |
|||
title: 'No Data', |
|||
text: 'No data available.', |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
} |
|||
|
|||
else { |
|||
$('#pageLoader').hide(); |
|||
//alert("Error: " + response.message); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: response.message, |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
} |
|||
|
|||
}, |
|||
error: function (xhr, status, error) { |
|||
$('#pageLoader').hide(); |
|||
//alert("Request failed: " + error); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: error, |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
|
|||
|
|||
} |
|||
}); |
|||
} |
|||
|
|||
|
|||
</script> |
|||
|
|||
</body> |
|||
</html> |
|||
@ -0,0 +1,687 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="en" xmlns:th="http://www.thymeleaf.org"> |
|||
<head> |
|||
<title>Sofa Bed collection Zonewise Report Summary</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; |
|||
} |
|||
#DetailsModal .modal-body{ |
|||
max-height: 70vh; |
|||
overflow-y: auto; |
|||
} |
|||
|
|||
</style> |
|||
</head> |
|||
<body> |
|||
|
|||
<div class="page-header-title"> |
|||
<h4>Sofa and Bed Collection - Zonewise Report</h4> |
|||
</div> |
|||
|
|||
<div id="opSummaryTable" style="display: block;" class="container"> |
|||
<table id="ZoneOpDatatable" class="table table-striped table-bordered display nowrap w-100"> |
|||
<thead> |
|||
<tr> |
|||
<th class="text-center">Zone</th> |
|||
<th class="text-center">Total Request</th> |
|||
<th class="text-center">This week Requests</th> |
|||
<th class="text-center">Older Requests</th> |
|||
<th class="text-center">Completed</th> |
|||
<th class="text-center">User Cancelled </th> |
|||
<th class="text-center">Officer Cancelled</th> |
|||
<th class="text-center">Pending</th> |
|||
|
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
|
|||
|
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
|
|||
<div class="modal fade" id="zoneDetailsModal" tabindex="-1" aria-labelledby="zoneDetailsLabel" aria-hidden="true" data-bs-keyboard="false" data-bs-backdrop="static"> |
|||
<div class="modal-dialog modal-xl"> |
|||
<div class="modal-content"> |
|||
<div class="modal-header"> |
|||
<h5 class="modal-title" id="zoneModalTitle">Zone Details</h5> |
|||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> |
|||
</div> |
|||
<div class="modal-body"> |
|||
|
|||
<table id="WardDatatable" class="table table-striped table-bordered display nowrap w-100"> |
|||
<thead> |
|||
<tr> |
|||
<th class="text-center">Ward </th> |
|||
<th class="text-center">Total Request</th> |
|||
<th class="text-center">This Week Request</th> |
|||
<th class="text-center">Older Requests</th> |
|||
<th class="text-center">Completed</th> |
|||
<th class="text-center">User Cancelled </th> |
|||
<th class="text-center">Officer Cancelled</th> |
|||
<th class="text-center">Pending</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
|
|||
|
|||
</tbody> |
|||
</table> |
|||
|
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<div class="modal fade" id="DetailsModal" tabindex="-1" aria-labelledby="DetailsLabel" aria-hidden="true" data-bs-keyboard="false" data-bs-backdrop="static"> |
|||
<div class="modal-dialog modal-xl"> |
|||
<div class="modal-content"> |
|||
<div class="modal-header"> |
|||
<h5 class="modal-title" id="DeatilsModalTitle">Details</h5> |
|||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> |
|||
</div> |
|||
<div class="modal-body" id="detailscontent"> |
|||
|
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
<!-- Image Modal --> |
|||
<div class="modal fade" id="imageModal" tabindex="-1" role="dialog" aria-hidden="true"> |
|||
<div class="modal-dialog modal-dialog-centered modal-lg" role="document"> |
|||
<div class="modal-content"> |
|||
<div class="modal-body text-center p-0"> |
|||
<img id="modalImage" src="" class="img-fluid" alt="Preview" style="max-height: 80vh;"/> |
|||
</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> |
|||
|
|||
$(document).on('click', '.preview-img', function() { |
|||
const src = $(this).attr('src'); |
|||
$('#modalImage').attr('src', src); |
|||
$('#imageModal').modal('show'); |
|||
}); |
|||
|
|||
$(document).ready(function () { |
|||
|
|||
$('#pageLoader').show(); |
|||
$.ajax({ |
|||
url: '/commissionerreview/api/sofabedcollection/getZoneReport', |
|||
method: 'GET', |
|||
success: function(response) { |
|||
|
|||
// Safely extract data whether it's an array or an object |
|||
var res = Array.isArray(response) ? response[0] : response; |
|||
console.log("Response:", res); |
|||
|
|||
$('#pageLoader').hide(); |
|||
|
|||
if (res.status === "Success") { |
|||
|
|||
if (Array.isArray(res.data) && res.data.length > 0) { |
|||
console.log("Details Array:", response); |
|||
|
|||
let table = $('#ZoneOpDatatable').DataTable({ |
|||
destroy: true, |
|||
autoWidth: true, |
|||
info: true, |
|||
data: res.data, // using response directly |
|||
columns: [ |
|||
{ |
|||
data: 'zone', |
|||
render: function (data, type, row) { |
|||
// Skip last row |
|||
if (row === res.data[res.data.length - 1]) { |
|||
return data; // just plain text |
|||
} else { |
|||
return `<a href="#" onclick="openZoneModal('${data}')" style="text-decoration: underline;">${data}</a>`; |
|||
} |
|||
} |
|||
}, |
|||
{ data: 'total_request', defaultContent: '-', className: 'text-center' }, |
|||
{ data: 'this_week_requests', defaultContent: '-', className: 'text-center' }, |
|||
{ data: 'older_requests', defaultContent: '-', className: 'text-center' }, |
|||
{ data: 'completed', defaultContent: '-', className: 'text-center' }, |
|||
{ data: 'user_cancel', defaultContent: '-', className: 'text-center' }, |
|||
{ data: 'officer_cancel', defaultContent: '-', className: 'text-center' }, |
|||
{ data: 'pending', defaultContent: '-', className: 'text-center' } |
|||
], |
|||
dom: 'frtip', |
|||
lengthMenu: [ |
|||
[50, 100, 200, 500, -1], |
|||
['50 rows', '100 rows', '200 rows', 'Show all'] |
|||
], |
|||
scrollY: 'auto', |
|||
scrollX: true, |
|||
responsive: false, |
|||
searching: false, |
|||
ordering: false |
|||
}); |
|||
|
|||
} |
|||
|
|||
else if(Array.isArray(res.data) && res.data.length === 0) { |
|||
$('#pageLoader').hide(); |
|||
//alert("No data available."); |
|||
|
|||
Swal.fire({ |
|||
icon: 'info', |
|||
title: 'No Data', |
|||
text: 'No data available.', |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
} |
|||
|
|||
else { |
|||
$('#pageLoader').hide(); |
|||
//alert("Error: " + response.message); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: 'Error', |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
} |
|||
|
|||
} |
|||
|
|||
else if(res.status === "nodata") { |
|||
$('#pageLoader').hide(); |
|||
//alert("No data available."); |
|||
|
|||
Swal.fire({ |
|||
icon: 'info', |
|||
title: 'No Data', |
|||
text: 'No data available.', |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
} |
|||
|
|||
else { |
|||
$('#pageLoader').hide(); |
|||
//alert("Error: " + response.message); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: res.message, |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
|
|||
|
|||
} |
|||
}, |
|||
error: function(xhr, status, error) { |
|||
$('#pageLoader').hide(); |
|||
// alert("Request failed: " + error); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: error, |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
|
|||
|
|||
} |
|||
}); |
|||
|
|||
$('#zoneDetailsModal').on('shown.bs.modal', function () { |
|||
if ($.fn.DataTable.isDataTable('#WardDatatable')) { |
|||
let questionDatatable = $('#WardDatatable').DataTable(); |
|||
questionDatatable.columns.adjust().draw(); |
|||
} |
|||
}); |
|||
|
|||
}); |
|||
|
|||
|
|||
function openZoneModal(zoneCode) { |
|||
console.log("Opening modal for zone:", zoneCode); |
|||
|
|||
$('#pageLoader').show(); |
|||
|
|||
// Set data in modal (example) |
|||
$('#zoneModalTitle').text('Zone ' + zoneCode + ' Details'); |
|||
|
|||
|
|||
$.ajax({ |
|||
url: '/commissionerreview/api/sofabedcollection/getWardReport', |
|||
method: 'GET', |
|||
data:{zone:zoneCode}, |
|||
success: function(response) { |
|||
|
|||
var res = Array.isArray(response) ? response[0] : response; |
|||
console.log("Response:", res); |
|||
|
|||
$('#pageLoader').hide(); |
|||
|
|||
if (res.status === "Success") { |
|||
|
|||
if (Array.isArray(res.data) && res.data.length > 0){ |
|||
console.log("Details Array:", response); |
|||
|
|||
|
|||
let table = $('#WardDatatable').DataTable({ |
|||
destroy: true, |
|||
autoWidth: true, |
|||
info: true, |
|||
data: res.data, // using response directly |
|||
columns: [ |
|||
{ data: 'division', defaultContent: '-', className: 'text-center' }, |
|||
{ data: 'total_request', defaultContent: '-', className: 'text-center' }, |
|||
{ data: 'this_week_requests', defaultContent: '-', className: 'text-center' }, |
|||
{ data: 'older_requests', defaultContent: '-', className: 'text-center' }, |
|||
{ data: 'completed', defaultContent: '-', className: 'text-center' }, |
|||
{ data: 'user_cancel', defaultContent: '-', className: 'text-center' }, |
|||
{ data: 'officer_cancel', defaultContent: '-', className: 'text-center' }, |
|||
{ data: 'pending', defaultContent: '-', className: 'text-center' } |
|||
], |
|||
dom: 'frtip', |
|||
lengthMenu: [ |
|||
[50, 100, 200, 500, -1], |
|||
['50 rows', '100 rows', '200 rows', 'Show all'] |
|||
], |
|||
scrollY: '400px', |
|||
scrollX: true, |
|||
responsive: false, |
|||
searching: false, |
|||
ordering: false, |
|||
createdRow: function (row, data, dataIndex) { |
|||
if (dataIndex === res.data.length - 1) return; |
|||
|
|||
const clickableCols = ['this_week_requests', 'completed', 'user_cancel', 'officer_cancel']; |
|||
|
|||
clickableCols.forEach((col) => { |
|||
const value = parseInt(data[col]); |
|||
if (!isNaN(value) && value > 0) { |
|||
const colIndex = { |
|||
this_week_requests: 2, |
|||
completed: 4, |
|||
user_cancel: 5, |
|||
officer_cancel: 6 |
|||
}[col]; |
|||
|
|||
$('td:eq(' + colIndex + ')', row).css({ |
|||
'color': '#007bff', |
|||
'text-decoration': 'underline', |
|||
'cursor': 'pointer' |
|||
}); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
}); |
|||
|
|||
|
|||
|
|||
$('#zoneDetailsModal').modal('show'); |
|||
} |
|||
else if (Array.isArray(res.data) && res.data.length === 0){ |
|||
$('#pageLoader').hide(); |
|||
//alert("No data available."); |
|||
|
|||
Swal.fire({ |
|||
icon: 'info', |
|||
title: 'No Data', |
|||
text: 'No data available.', |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
} |
|||
else{ |
|||
$('#pageLoader').hide(); |
|||
//alert("Error: " + response.message); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: res.message, |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
} |
|||
} |
|||
else if (res.status === "nodata") { |
|||
$('#pageLoader').hide(); |
|||
//alert("No data available."); |
|||
|
|||
Swal.fire({ |
|||
icon: 'info', |
|||
title: 'No Data', |
|||
text: 'No data available.', |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
|
|||
} |
|||
else { |
|||
$('#pageLoader').hide(); |
|||
//alert("Error: " + response.message); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: res.message, |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
|
|||
|
|||
} |
|||
|
|||
// Attach click handler after DataTable initialization |
|||
$('#WardDatatable tbody').off('click').on('click', 'td', function () { |
|||
let table = $('#WardDatatable').DataTable(); |
|||
let rowData = table.row($(this).closest('tr')).data(); |
|||
let columnIndex = table.cell(this).index().column; |
|||
|
|||
// Define column-to-status mapping (based on your requirement) |
|||
const columnMap = { |
|||
2: 1, // open |
|||
4: 2, // completed |
|||
5: 4, // user_cancel |
|||
6: 5 // officer_cancel |
|||
}; |
|||
|
|||
// Get column name using column index |
|||
let columnName = table.column(columnIndex).dataSrc(); |
|||
|
|||
// If clicked column is one of the target columns |
|||
if (columnMap[columnIndex]) { |
|||
let status = columnMap[columnIndex]; |
|||
let value = rowData[columnName]; |
|||
let division = rowData['division']; |
|||
|
|||
// Proceed only if value > 0 |
|||
if (parseInt(value) > 0) { |
|||
openWardDetails(division, status); |
|||
} |
|||
} |
|||
}); |
|||
|
|||
}, |
|||
error: function(xhr, status, error) { |
|||
$('#pageLoader').hide(); |
|||
//alert("Request failed: " + error); |
|||
|
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: error, |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
|
|||
|
|||
} |
|||
}); |
|||
|
|||
|
|||
} |
|||
|
|||
function openWardDetails(division, status){ |
|||
console.log("division:",division," status:",status); |
|||
// Optional: show in a modal or send AJAX |
|||
|
|||
$('#pageLoader').show(); |
|||
$.ajax({ |
|||
url: '/commissionerreview/api/sofabedcollection/getWardStatusReport', |
|||
method: 'GET', |
|||
data: { |
|||
ward: division, |
|||
status: status |
|||
}, |
|||
success: function (response) { |
|||
$('#pageLoader').hide(); |
|||
var res = Array.isArray(response) ? response[0] : response; |
|||
//console.log("Response:", res); |
|||
|
|||
$('#pageLoader').hide(); |
|||
console.log("Details:", res); |
|||
if(res.status === "Success"){ |
|||
|
|||
let modalBody = $("#detailscontent"); |
|||
modalBody.empty(); // Clear previous content |
|||
|
|||
|
|||
|
|||
if (Array.isArray(res.data) && res.data.length > 0){ |
|||
|
|||
res.data.forEach(item => { |
|||
// Create a container div for each record |
|||
let streetDiv = $('<div class="mb-4 p-3 border rounded shadow-sm bg-light"></div>'); |
|||
|
|||
// Info section (2 columns layout) |
|||
let infoHtml = ` |
|||
<div class="container-fluid"> |
|||
<div class="row mb-2"> |
|||
<div class="col-md-4"><strong>Zone:</strong> ${item.zone || '-'}</div> |
|||
<div class="col-md-4"><strong>Ward:</strong> ${item.division || '-'}</div> |
|||
<div class="col-md-4"><strong>Request ID:</strong> ${item.request_id || '-'}</div> |
|||
</div> |
|||
<div class="row mb-2"> |
|||
<div class="col-md-4"><strong>User Name:</strong> ${item.user_name || '-'}</div> |
|||
<div class="col-md-4"><strong>Status:</strong> ${item.status || '-'}</div> |
|||
<div class="col-md-4"><strong>Mobile Number:</strong> ${item.mobile || '-'}</div> |
|||
</div> |
|||
<div class="row mb-2"> |
|||
<div class="col-md-8"><strong>Address:</strong> ${item.address || '-'}</div> |
|||
<div class="col-md-4"><strong>Created Date:</strong> ${item.cdate || '-'}</div> |
|||
</div> |
|||
</div> |
|||
`; |
|||
streetDiv.append(infoHtml); |
|||
|
|||
|
|||
// 🧾 Items section (as divs) |
|||
let itemsHtml = ` |
|||
<div class="mt-3"> |
|||
<p><strong>Items:</strong></p> |
|||
${ |
|||
Array.isArray(item.items) && item.items.length > 0 |
|||
? item.items.map((it, idx) => ` |
|||
<div class="d-flex flex-wrap border rounded p-2 mb-2 "> |
|||
<div class="flex-fill"><strong>Item ${idx + 1}:</strong> ${it.item_name || '-'}</div> |
|||
<div class="flex-fill"><strong>Quantity:</strong> ${it.quantity ?? '-'}</div> |
|||
</div> |
|||
`).join("") |
|||
: `<p class="text-muted">No items available.</p>` |
|||
} |
|||
</div> |
|||
`; |
|||
streetDiv.append(itemsHtml); |
|||
|
|||
|
|||
// Image section |
|||
let imagesHtml = ` |
|||
<hr> |
|||
<div class="mt-2" style="text-align:center;"> |
|||
<p><strong>Image:</strong></p> |
|||
${ |
|||
item.image_url |
|||
? (() => { |
|||
// Handle multiple comma-separated images |
|||
return item.image_url.split(",").map(img => { |
|||
let trimmed = img.trim(); |
|||
return ` |
|||
<img src="${trimmed}" |
|||
alt="Image" |
|||
class="img-thumbnail me-2 mb-2 preview-img" |
|||
style="width: 250px; height: 200px; object-fit: contain; cursor: pointer;" |
|||
data-bs-toggle="modal" |
|||
data-bs-target="#imageModal" |
|||
/> |
|||
`; |
|||
}).join(""); |
|||
})() |
|||
: `<p class="text-muted">No images available.</p>` |
|||
} |
|||
</div> |
|||
`; |
|||
streetDiv.append(imagesHtml); |
|||
|
|||
modalBody.append(streetDiv); |
|||
}); |
|||
|
|||
|
|||
$('#DeatilsModalTitle').text('Division '+division +' Details'); |
|||
$('#DetailsModal').modal('show'); |
|||
} |
|||
|
|||
else if (Array.isArray(res.data) && res.data.length === 0){ |
|||
$('#pageLoader').hide(); |
|||
//alert("No data available."); |
|||
Swal.fire({ |
|||
icon: 'info', |
|||
title: 'No Data', |
|||
text: 'No data available.', |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
} |
|||
|
|||
else{ |
|||
$('#pageLoader').hide(); |
|||
//alert("Error: " + response.message); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: response.message, |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
} |
|||
} |
|||
|
|||
else if (res.status === "nodata") { |
|||
$('#pageLoader').hide(); |
|||
//alert("No data available."); |
|||
Swal.fire({ |
|||
icon: 'info', |
|||
title: 'No Data', |
|||
text: 'No data available.', |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
} |
|||
|
|||
else { |
|||
$('#pageLoader').hide(); |
|||
//alert("Error: " + response.message); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: res.message, |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
} |
|||
|
|||
}, |
|||
error: function (xhr, status, error) { |
|||
$('#pageLoader').hide(); |
|||
//alert("Request failed: " + error); |
|||
Swal.fire({ |
|||
icon: 'error', |
|||
title: 'Error', |
|||
text: error, |
|||
showConfirmButton: true, |
|||
timer: 3000 |
|||
}); |
|||
|
|||
|
|||
|
|||
} |
|||
}); |
|||
|
|||
} |
|||
|
|||
|
|||
</script> |
|||
|
|||
</body> |
|||
</html> |
|||
@ -0,0 +1,13 @@ |
|||
package com.gcc.commissionerreviewII; |
|||
|
|||
import org.junit.jupiter.api.Test; |
|||
import org.springframework.boot.test.context.SpringBootTest; |
|||
|
|||
@SpringBootTest |
|||
class CommissionerreviewIiApplicationTests { |
|||
|
|||
@Test |
|||
void contextLoads() { |
|||
} |
|||
|
|||
} |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue