Browse Source

initial commit

master
surajksj2ee 2 years ago
commit
dc8a07d269
  1. 33
      .gitignore
  2. 308
      mvnw
  3. 205
      mvnw.cmd
  4. 138
      pom.xml
  5. 13
      src/main/java/ItAssetApplication.java
  6. 81
      src/main/java/com/feedback/it_asset/AppConfig.java
  7. 14
      src/main/java/com/feedback/it_asset/ItAssetApplication.java
  8. 23
      src/main/java/com/feedback/it_asset/JacksonConfiguration.java
  9. 42
      src/main/java/com/feedback/it_asset/QRCodeGenerator.java
  10. 14
      src/main/java/com/feedback/it_asset/ServletInitializer.java
  11. 41
      src/main/java/com/feedback/it_asset/UserSession.java
  12. 36
      src/main/java/com/feedback/it_asset/WebConfig.java
  13. 59
      src/main/java/com/feedback/it_asset/component/UserSessionInterceptor.java
  14. 1388
      src/main/java/com/feedback/it_asset/controller/APIController.java
  15. 123
      src/main/java/com/feedback/it_asset/controller/AssetController.java
  16. 25
      src/main/java/com/feedback/it_asset/controller/CommonAttributes.java
  17. 498
      src/main/java/com/feedback/it_asset/controller/FeedbackController.java
  18. 354
      src/main/java/com/feedback/it_asset/controller/MainController.java
  19. 75
      src/main/java/com/feedback/it_asset/dto/AssetDTO.java
  20. 495
      src/main/java/com/feedback/it_asset/dto/ComplaintForm.java
  21. 31
      src/main/java/com/feedback/it_asset/dto/GccAssetDetailsDto.java
  22. 92
      src/main/java/com/feedback/it_asset/entity/AssetCategory.java
  23. 164
      src/main/java/com/feedback/it_asset/entity/AssetCategoryQuestions.java
  24. 104
      src/main/java/com/feedback/it_asset/entity/AssetParameter.java
  25. 138
      src/main/java/com/feedback/it_asset/entity/AssetParameterQuestions.java
  26. 213
      src/main/java/com/feedback/it_asset/entity/GccAssetDetails.java
  27. 129
      src/main/java/com/feedback/it_asset/entity/GccFeedback.java
  28. 118
      src/main/java/com/feedback/it_asset/entity/GccFeedbackData.java
  29. 118
      src/main/java/com/feedback/it_asset/entity/GccFileData.java
  30. 43
      src/main/java/com/feedback/it_asset/entity/User.java
  31. 37
      src/main/java/com/feedback/it_asset/repository/AssetCategoryQuestionsRep.java
  32. 37
      src/main/java/com/feedback/it_asset/repository/AssetCategoryRep.java
  33. 42
      src/main/java/com/feedback/it_asset/repository/AssetParameterQuestionsRep.java
  34. 40
      src/main/java/com/feedback/it_asset/repository/AssetParameterRep.java
  35. 86
      src/main/java/com/feedback/it_asset/repository/GccAssetDetailsRep.java
  36. 59
      src/main/java/com/feedback/it_asset/repository/GccFeedbackDataRep.java
  37. 62
      src/main/java/com/feedback/it_asset/repository/GccFeedbackRep.java
  38. 18
      src/main/java/com/feedback/it_asset/repository/GccFileDataRep.java
  39. 17
      src/main/java/com/feedback/it_asset/repository/UserRepository.java
  40. 46
      src/main/java/com/feedback/it_asset/service/AssetCategoryService.java
  41. 72
      src/main/java/com/feedback/it_asset/service/AssetDetailsService.java
  42. 138
      src/main/java/com/feedback/it_asset/service/GccAssetService.java
  43. 30
      src/main/java/com/feedback/it_asset/service/MainService.java
  44. 43
      src/main/resources/application.properties
  45. BIN
      src/main/resources/static/assets/.DS_Store
  46. BIN
      src/main/resources/static/assets/._.DS_Store
  47. BIN
      src/main/resources/static/assets/.__js
  48. BIN
      src/main/resources/static/assets/.__scss
  49. BIN
      src/main/resources/static/assets/._css
  50. BIN
      src/main/resources/static/assets/._fonts
  51. BIN
      src/main/resources/static/assets/._js
  52. BIN
      src/main/resources/static/assets/._media
  53. BIN
      src/main/resources/static/assets/_js/._main
  54. BIN
      src/main/resources/static/assets/_js/._pages
  55. BIN
      src/main/resources/static/assets/_js/main/._app.js
  56. BIN
      src/main/resources/static/assets/_js/main/._modules
  57. 65
      src/main/resources/static/assets/_js/main/app.js
  58. BIN
      src/main/resources/static/assets/_js/main/modules/._helpers.js
  59. BIN
      src/main/resources/static/assets/_js/main/modules/._template.js
  60. 1110
      src/main/resources/static/assets/_js/main/modules/helpers.js
  61. 802
      src/main/resources/static/assets/_js/main/modules/template.js
  62. BIN
      src/main/resources/static/assets/_js/pages/._be_comp_calendar.js
  63. BIN
      src/main/resources/static/assets/_js/pages/._be_comp_charts.js
  64. BIN
      src/main/resources/static/assets/_js/pages/._be_comp_chat.js
  65. BIN
      src/main/resources/static/assets/_js/pages/._be_comp_dialogs.js
  66. BIN
      src/main/resources/static/assets/_js/pages/._be_comp_image_cropper.js
  67. BIN
      src/main/resources/static/assets/_js/pages/._be_comp_maps_vector.js
  68. BIN
      src/main/resources/static/assets/_js/pages/._be_comp_nestable.js
  69. BIN
      src/main/resources/static/assets/_js/pages/._be_comp_onboarding.js
  70. BIN
      src/main/resources/static/assets/_js/pages/._be_comp_rating.js
  71. BIN
      src/main/resources/static/assets/_js/pages/._be_forms_validation.js
  72. BIN
      src/main/resources/static/assets/_js/pages/._be_pages_dashboard.js
  73. BIN
      src/main/resources/static/assets/_js/pages/._be_pages_dashboard_v1.js
  74. BIN
      src/main/resources/static/assets/_js/pages/._be_pages_ecom_dashboard.js
  75. BIN
      src/main/resources/static/assets/_js/pages/._be_pages_projects_tasks.js
  76. BIN
      src/main/resources/static/assets/_js/pages/._be_tables_datatables.js
  77. BIN
      src/main/resources/static/assets/_js/pages/._be_ui_animations.js
  78. BIN
      src/main/resources/static/assets/_js/pages/._be_ui_icons.js
  79. BIN
      src/main/resources/static/assets/_js/pages/._be_ui_progress.js
  80. BIN
      src/main/resources/static/assets/_js/pages/._db_analytics.js
  81. BIN
      src/main/resources/static/assets/_js/pages/._db_corporate_slim.js
  82. BIN
      src/main/resources/static/assets/_js/pages/._db_crypto.js
  83. BIN
      src/main/resources/static/assets/_js/pages/._op_auth_lock.js
  84. BIN
      src/main/resources/static/assets/_js/pages/._op_auth_reminder.js
  85. BIN
      src/main/resources/static/assets/_js/pages/._op_auth_signin.js
  86. BIN
      src/main/resources/static/assets/_js/pages/._op_auth_signup.js
  87. BIN
      src/main/resources/static/assets/_js/pages/._op_coming_soon.js
  88. BIN
      src/main/resources/static/assets/_js/pages/._op_installation.js
  89. 179
      src/main/resources/static/assets/_js/pages/be_comp_calendar.js
  90. 143
      src/main/resources/static/assets/_js/pages/be_comp_charts.js
  91. 156
      src/main/resources/static/assets/_js/pages/be_comp_chat.js
  92. 106
      src/main/resources/static/assets/_js/pages/be_comp_dialogs.js
  93. 88
      src/main/resources/static/assets/_js/pages/be_comp_image_cropper.js
  94. 154
      src/main/resources/static/assets/_js/pages/be_comp_maps_vector.js
  95. 47
      src/main/resources/static/assets/_js/pages/be_comp_nestable.js
  96. 41
      src/main/resources/static/assets/_js/pages/be_comp_onboarding.js
  97. 50
      src/main/resources/static/assets/_js/pages/be_comp_rating.js
  98. 124
      src/main/resources/static/assets/_js/pages/be_forms_validation.js
  99. 89
      src/main/resources/static/assets/_js/pages/be_pages_dashboard.js
  100. 225
      src/main/resources/static/assets/_js/pages/be_pages_dashboard_v1.js

33
.gitignore

@ -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/

308
mvnw

@ -0,0 +1,308 @@
#!/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
#
# https://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.2.0
#
# Required ENV vars:
# ------------------
# JAVA_HOME - location of a JDK home dir
#
# Optional ENV vars
# -----------------
# MAVEN_OPTS - parameters passed to the Java VM when running Maven
# e.g. to debug Maven itself, use
# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
# ----------------------------------------------------------------------------
if [ -z "$MAVEN_SKIP_RC" ] ; then
if [ -f /usr/local/etc/mavenrc ] ; then
. /usr/local/etc/mavenrc
fi
if [ -f /etc/mavenrc ] ; then
. /etc/mavenrc
fi
if [ -f "$HOME/.mavenrc" ] ; then
. "$HOME/.mavenrc"
fi
fi
# OS specific support. $var _must_ be set to either true or false.
cygwin=false;
darwin=false;
mingw=false
case "$(uname)" in
CYGWIN*) cygwin=true ;;
MINGW*) mingw=true;;
Darwin*) darwin=true
# Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
# See https://developer.apple.com/library/mac/qa/qa1170/_index.html
if [ -z "$JAVA_HOME" ]; then
if [ -x "/usr/libexec/java_home" ]; then
JAVA_HOME="$(/usr/libexec/java_home)"; export JAVA_HOME
else
JAVA_HOME="/Library/Java/Home"; export JAVA_HOME
fi
fi
;;
esac
if [ -z "$JAVA_HOME" ] ; then
if [ -r /etc/gentoo-release ] ; then
JAVA_HOME=$(java-config --jre-home)
fi
fi
# For Cygwin, ensure paths are in UNIX format before anything is touched
if $cygwin ; then
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=$(cygpath --unix "$JAVA_HOME")
[ -n "$CLASSPATH" ] &&
CLASSPATH=$(cygpath --path --unix "$CLASSPATH")
fi
# For Mingw, ensure paths are in UNIX format before anything is touched
if $mingw ; then
[ -n "$JAVA_HOME" ] && [ -d "$JAVA_HOME" ] &&
JAVA_HOME="$(cd "$JAVA_HOME" || (echo "cannot cd into $JAVA_HOME."; exit 1); pwd)"
fi
if [ -z "$JAVA_HOME" ]; then
javaExecutable="$(which javac)"
if [ -n "$javaExecutable" ] && ! [ "$(expr "\"$javaExecutable\"" : '\([^ ]*\)')" = "no" ]; then
# readlink(1) is not available as standard on Solaris 10.
readLink=$(which readlink)
if [ ! "$(expr "$readLink" : '\([^ ]*\)')" = "no" ]; then
if $darwin ; then
javaHome="$(dirname "\"$javaExecutable\"")"
javaExecutable="$(cd "\"$javaHome\"" && pwd -P)/javac"
else
javaExecutable="$(readlink -f "\"$javaExecutable\"")"
fi
javaHome="$(dirname "\"$javaExecutable\"")"
javaHome=$(expr "$javaHome" : '\(.*\)/bin')
JAVA_HOME="$javaHome"
export JAVA_HOME
fi
fi
fi
if [ -z "$JAVACMD" ] ; then
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"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
else
JAVACMD="$(\unset -f command 2>/dev/null; \command -v java)"
fi
fi
if [ ! -x "$JAVACMD" ] ; then
echo "Error: JAVA_HOME is not defined correctly." >&2
echo " We cannot execute $JAVACMD" >&2
exit 1
fi
if [ -z "$JAVA_HOME" ] ; then
echo "Warning: JAVA_HOME environment variable is not set."
fi
# traverses directory structure from process work directory to filesystem root
# first directory with .mvn subdirectory is considered project base directory
find_maven_basedir() {
if [ -z "$1" ]
then
echo "Path not specified to find_maven_basedir"
return 1
fi
basedir="$1"
wdir="$1"
while [ "$wdir" != '/' ] ; do
if [ -d "$wdir"/.mvn ] ; then
basedir=$wdir
break
fi
# workaround for JBEAP-8937 (on Solaris 10/Sparc)
if [ -d "${wdir}" ]; then
wdir=$(cd "$wdir/.." || exit 1; pwd)
fi
# end of workaround
done
printf '%s' "$(cd "$basedir" || exit 1; pwd)"
}
# concatenates all lines of a file
concat_lines() {
if [ -f "$1" ]; then
# Remove \r in case we run on Windows within Git Bash
# and check out the repository with auto CRLF management
# enabled. Otherwise, we may read lines that are delimited with
# \r\n and produce $'-Xarg\r' rather than -Xarg due to word
# splitting rules.
tr -s '\r\n' ' ' < "$1"
fi
}
log() {
if [ "$MVNW_VERBOSE" = true ]; then
printf '%s\n' "$1"
fi
}
BASE_DIR=$(find_maven_basedir "$(dirname "$0")")
if [ -z "$BASE_DIR" ]; then
exit 1;
fi
MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}; export MAVEN_PROJECTBASEDIR
log "$MAVEN_PROJECTBASEDIR"
##########################################################################################
# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
# This allows using the maven wrapper in projects that prohibit checking in binary data.
##########################################################################################
wrapperJarPath="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar"
if [ -r "$wrapperJarPath" ]; then
log "Found $wrapperJarPath"
else
log "Couldn't find $wrapperJarPath, downloading it ..."
if [ -n "$MVNW_REPOURL" ]; then
wrapperUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar"
else
wrapperUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar"
fi
while IFS="=" read -r key value; do
# Remove '\r' from value to allow usage on windows as IFS does not consider '\r' as a separator ( considers space, tab, new line ('\n'), and custom '=' )
safeValue=$(echo "$value" | tr -d '\r')
case "$key" in (wrapperUrl) wrapperUrl="$safeValue"; break ;;
esac
done < "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties"
log "Downloading from: $wrapperUrl"
if $cygwin; then
wrapperJarPath=$(cygpath --path --windows "$wrapperJarPath")
fi
if command -v wget > /dev/null; then
log "Found wget ... using wget"
[ "$MVNW_VERBOSE" = true ] && QUIET="" || QUIET="--quiet"
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
wget $QUIET "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
else
wget $QUIET --http-user="$MVNW_USERNAME" --http-password="$MVNW_PASSWORD" "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
fi
elif command -v curl > /dev/null; then
log "Found curl ... using curl"
[ "$MVNW_VERBOSE" = true ] && QUIET="" || QUIET="--silent"
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
curl $QUIET -o "$wrapperJarPath" "$wrapperUrl" -f -L || rm -f "$wrapperJarPath"
else
curl $QUIET --user "$MVNW_USERNAME:$MVNW_PASSWORD" -o "$wrapperJarPath" "$wrapperUrl" -f -L || rm -f "$wrapperJarPath"
fi
else
log "Falling back to using Java to download"
javaSource="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/MavenWrapperDownloader.java"
javaClass="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/MavenWrapperDownloader.class"
# For Cygwin, switch paths to Windows format before running javac
if $cygwin; then
javaSource=$(cygpath --path --windows "$javaSource")
javaClass=$(cygpath --path --windows "$javaClass")
fi
if [ -e "$javaSource" ]; then
if [ ! -e "$javaClass" ]; then
log " - Compiling MavenWrapperDownloader.java ..."
("$JAVA_HOME/bin/javac" "$javaSource")
fi
if [ -e "$javaClass" ]; then
log " - Running MavenWrapperDownloader.java ..."
("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$wrapperUrl" "$wrapperJarPath") || rm -f "$wrapperJarPath"
fi
fi
fi
fi
##########################################################################################
# End of extension
##########################################################################################
# If specified, validate the SHA-256 sum of the Maven wrapper jar file
wrapperSha256Sum=""
while IFS="=" read -r key value; do
case "$key" in (wrapperSha256Sum) wrapperSha256Sum=$value; break ;;
esac
done < "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties"
if [ -n "$wrapperSha256Sum" ]; then
wrapperSha256Result=false
if command -v sha256sum > /dev/null; then
if echo "$wrapperSha256Sum $wrapperJarPath" | sha256sum -c > /dev/null 2>&1; then
wrapperSha256Result=true
fi
elif command -v shasum > /dev/null; then
if echo "$wrapperSha256Sum $wrapperJarPath" | shasum -a 256 -c > /dev/null 2>&1; then
wrapperSha256Result=true
fi
else
echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available."
echo "Please install either command, or disable validation by removing 'wrapperSha256Sum' from your maven-wrapper.properties."
exit 1
fi
if [ $wrapperSha256Result = false ]; then
echo "Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised." >&2
echo "Investigate or delete $wrapperJarPath to attempt a clean download." >&2
echo "If you updated your Maven version, you need to update the specified wrapperSha256Sum property." >&2
exit 1
fi
fi
MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
# For Cygwin, switch paths to Windows format before running java
if $cygwin; then
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=$(cygpath --path --windows "$JAVA_HOME")
[ -n "$CLASSPATH" ] &&
CLASSPATH=$(cygpath --path --windows "$CLASSPATH")
[ -n "$MAVEN_PROJECTBASEDIR" ] &&
MAVEN_PROJECTBASEDIR=$(cygpath --path --windows "$MAVEN_PROJECTBASEDIR")
fi
# Provide a "standardized" way to retrieve the CLI args that will
# work with both Windows and non-Windows executions.
MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $*"
export MAVEN_CMD_LINE_ARGS
WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
# shellcheck disable=SC2086 # safe args
exec "$JAVACMD" \
$MAVEN_OPTS \
$MAVEN_DEBUG_OPTS \
-classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
"-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"

205
mvnw.cmd

@ -0,0 +1,205 @@
@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 https://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.2.0
@REM
@REM Required ENV vars:
@REM JAVA_HOME - location of a JDK home dir
@REM
@REM Optional ENV vars
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
@REM e.g. to debug Maven itself, use
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
@REM ----------------------------------------------------------------------------
@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
@echo off
@REM set title of command window
title %0
@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
@REM set %HOME% to equivalent of $HOME
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
@REM Execute a user defined script before this one
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
@REM check for pre script, once with legacy .bat ending and once with .cmd ending
if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %*
if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %*
:skipRcPre
@setlocal
set ERROR_CODE=0
@REM To isolate internal variables from possible post scripts, we use another setlocal
@setlocal
@REM ==== START VALIDATION ====
if not "%JAVA_HOME%" == "" goto OkJHome
echo.
echo Error: JAVA_HOME not found in your environment. >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error
:OkJHome
if exist "%JAVA_HOME%\bin\java.exe" goto init
echo.
echo Error: JAVA_HOME is set to an invalid directory. >&2
echo JAVA_HOME = "%JAVA_HOME%" >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error
@REM ==== END VALIDATION ====
:init
@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
@REM Fallback to current working directory if not found.
set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
set EXEC_DIR=%CD%
set WDIR=%EXEC_DIR%
:findBaseDir
IF EXIST "%WDIR%"\.mvn goto baseDirFound
cd ..
IF "%WDIR%"=="%CD%" goto baseDirNotFound
set WDIR=%CD%
goto findBaseDir
:baseDirFound
set MAVEN_PROJECTBASEDIR=%WDIR%
cd "%EXEC_DIR%"
goto endDetectBaseDir
:baseDirNotFound
set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
cd "%EXEC_DIR%"
:endDetectBaseDir
IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
@setlocal EnableExtensions EnableDelayedExpansion
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
:endReadAdditionalConfig
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
set WRAPPER_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar"
FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
IF "%%A"=="wrapperUrl" SET WRAPPER_URL=%%B
)
@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
if exist %WRAPPER_JAR% (
if "%MVNW_VERBOSE%" == "true" (
echo Found %WRAPPER_JAR%
)
) else (
if not "%MVNW_REPOURL%" == "" (
SET WRAPPER_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar"
)
if "%MVNW_VERBOSE%" == "true" (
echo Couldn't find %WRAPPER_JAR%, downloading it ...
echo Downloading from: %WRAPPER_URL%
)
powershell -Command "&{"^
"$webclient = new-object System.Net.WebClient;"^
"if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
"$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
"}"^
"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%WRAPPER_URL%', '%WRAPPER_JAR%')"^
"}"
if "%MVNW_VERBOSE%" == "true" (
echo Finished downloading %WRAPPER_JAR%
)
)
@REM End of extension
@REM If specified, validate the SHA-256 sum of the Maven wrapper jar file
SET WRAPPER_SHA_256_SUM=""
FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
IF "%%A"=="wrapperSha256Sum" SET WRAPPER_SHA_256_SUM=%%B
)
IF NOT %WRAPPER_SHA_256_SUM%=="" (
powershell -Command "&{"^
"$hash = (Get-FileHash \"%WRAPPER_JAR%\" -Algorithm SHA256).Hash.ToLower();"^
"If('%WRAPPER_SHA_256_SUM%' -ne $hash){"^
" Write-Output 'Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised.';"^
" Write-Output 'Investigate or delete %WRAPPER_JAR% to attempt a clean download.';"^
" Write-Output 'If you updated your Maven version, you need to update the specified wrapperSha256Sum property.';"^
" exit 1;"^
"}"^
"}"
if ERRORLEVEL 1 goto error
)
@REM Provide a "standardized" way to retrieve the CLI args that will
@REM work with both Windows and non-Windows executions.
set MAVEN_CMD_LINE_ARGS=%*
%MAVEN_JAVA_EXE% ^
%JVM_CONFIG_MAVEN_PROPS% ^
%MAVEN_OPTS% ^
%MAVEN_DEBUG_OPTS% ^
-classpath %WRAPPER_JAR% ^
"-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^
%WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
if ERRORLEVEL 1 goto error
goto end
:error
set ERROR_CODE=1
:end
@endlocal & set ERROR_CODE=%ERROR_CODE%
if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost
@REM check for post script, once with legacy .bat ending and once with .cmd ending
if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat"
if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd"
:skipRcPost
@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
if "%MAVEN_BATCH_PAUSE%"=="on" pause
if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE%
cmd /C exit /B %ERROR_CODE%

138
pom.xml

@ -0,0 +1,138 @@
<?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.1.4</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.complaint</groupId>
<artifactId>it_asset</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>gccasset_feedback</name>
<description>Spring Boot Project for GCC IT Asset Feedback</description>
<properties>
<java.version>17</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<!-- optional, it brings userful tags to display spring security stuff -->
<dependency>
<groupId>org.thymeleaf.extras</groupId>
<artifactId>thymeleaf-extras-springsecurity6</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>
<!-- optional, it brings userful tags to display spring security stuff -->
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.4.0-b180830.0359</version>
</dependency>
<dependency>
<groupId>com.google.zxing</groupId>
<artifactId>core</artifactId>
<version>3.4.1</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/core-3.4.1.jar</systemPath>
</dependency>
<dependency>
<groupId>com.google.zxing</groupId>
<artifactId>javase</artifactId>
<version>3.4.1</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/javase-3.4.1.jar</systemPath>
</dependency>
<dependency>
<groupId>com.google.zxing</groupId>
<artifactId>javase</artifactId>
<version>3.5.1</version>
</dependency>
<dependency>
<groupId>com.google.zxing</groupId>
<artifactId>core</artifactId>
<version>3.5.1</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20210307</version>
</dependency>
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!-- Apache POI dependencies for working with Excel -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>4.1.2</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>4.1.2</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-text</artifactId>
<version>1.9</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

13
src/main/java/ItAssetApplication.java

@ -0,0 +1,13 @@
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class ItAssetApplication {
public static void main(String[] args) {
SpringApplication.run(ItAssetApplication.class, args);
}
}

81
src/main/java/com/feedback/it_asset/AppConfig.java

@ -0,0 +1,81 @@
package com.feedback.it_asset;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
@Component
@ConfigurationProperties(prefix = "app")
public class AppConfig{
private String title;
private String baseUrl;
private String qrcodeUrl;
private String getOtpUrl;
private String erpUrl;
private String erpPropertTaxUrl;
private String ptaxid;
private String ptaxRegMobile;
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getBaseUrl() {
return baseUrl;
}
public void setBaseUrl(String baseUrl) {
this.baseUrl = baseUrl;
}
public String getQrcodeUrl() {
return qrcodeUrl;
}
public void setQrcodeUrl(String qrcodeUrl) {
this.qrcodeUrl = qrcodeUrl;
}
public String getGetOtpUrl() {
return getOtpUrl;
}
public void setGetOtpUrl(String getOtpUrl) {
this.getOtpUrl = getOtpUrl;
}
public String getErpUrl() {
return erpUrl;
}
public void setErpUrl(String erpUrl) {
this.erpUrl = erpUrl;
}
public String getPtaxid() {
return ptaxid;
}
public void setPtaxid(String ptaxid) {
this.ptaxid = ptaxid;
}
public String getPtaxRegMobile() {
return ptaxRegMobile;
}
public void setPtaxRegMobile(String ptaxRegMobile) {
this.ptaxRegMobile = ptaxRegMobile;
}
public String getErpPropertTaxUrl() {
return erpPropertTaxUrl;
}
public void setErpPropertTaxUrl(String erpPropertTaxUrl) {
this.erpPropertTaxUrl = erpPropertTaxUrl;
}
}

14
src/main/java/com/feedback/it_asset/ItAssetApplication.java

@ -0,0 +1,14 @@
package com.feedback.it_asset;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class ItAssetApplication {
public static void main(String[] args) {
SpringApplication.run(ItAssetApplication.class, args);
}
}

23
src/main/java/com/feedback/it_asset/JacksonConfiguration.java

@ -0,0 +1,23 @@
package com.feedback.it_asset;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
@Configuration
public class JacksonConfiguration {
@Bean
public ObjectMapper objectMapper() {
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
// Debug log
System.out.println("Custom ObjectMapper configuration applied.");
return objectMapper;
}
}

42
src/main/java/com/feedback/it_asset/QRCodeGenerator.java

@ -0,0 +1,42 @@
package com.feedback.it_asset;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.Base64;
import java.util.HashMap;
import java.util.Map;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.EncodeHintType;
import com.google.zxing.WriterException;
import com.google.zxing.client.j2se.MatrixToImageWriter;
import com.google.zxing.common.BitMatrix;
import com.google.zxing.qrcode.QRCodeWriter;
public class QRCodeGenerator {
public static String generateQRCode(String data) throws WriterException, IOException {
int width = 100; // width of the QR code image
int height = 100; // height of the QR code image
String format = "png"; // format of the QR code image
String charset = "UTF-8"; // character set used to encode the data
// create the QR code writer and hints
QRCodeWriter qrCodeWriter = new QRCodeWriter();
Map<EncodeHintType, Object> hints = new HashMap<>();
hints.put(EncodeHintType.CHARACTER_SET, charset);
// generate the QR code matrix
BitMatrix matrix = qrCodeWriter.encode(data, BarcodeFormat.QR_CODE, width, height, hints);
// create the QR code image as a byte array
ByteArrayOutputStream baos = new ByteArrayOutputStream();
MatrixToImageWriter.writeToStream(matrix, format, baos);
byte[] imageBytes = baos.toByteArray();
// encode the image data in base64 format
String base64EncodedImage = Base64.getEncoder().encodeToString(imageBytes);
return base64EncodedImage;
}
}

14
src/main/java/com/feedback/it_asset/ServletInitializer.java

@ -0,0 +1,14 @@
package com.feedback.it_asset;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
public class ServletInitializer extends SpringBootServletInitializer{
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(ItAssetApplication.class);
}
}

41
src/main/java/com/feedback/it_asset/UserSession.java

@ -0,0 +1,41 @@
package com.feedback.it_asset;
import org.springframework.context.annotation.Scope;
import org.springframework.context.annotation.ScopedProxyMode;
import org.springframework.stereotype.Component;
import org.springframework.web.context.WebApplicationContext;
@Component
@Scope(value = WebApplicationContext.SCOPE_SESSION, proxyMode = ScopedProxyMode.TARGET_CLASS)
public class UserSession {
private Integer userId;
private String userType;
private String dispayName;
public Integer getUserId() {
return userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
public String getUserType() {
return userType;
}
public void setUserType(String userType) {
this.userType = userType;
}
public String getDispayName() {
return dispayName;
}
public void setDispayName(String dispayName) {
this.dispayName = dispayName;
}
}

36
src/main/java/com/feedback/it_asset/WebConfig.java

@ -0,0 +1,36 @@
//package com.feedback.it_asset;
////
////import org.springframework.beans.factory.annotation.Autowired;
////import org.springframework.context.annotation.Configuration;
////import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
////import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
////
////import com.feedback.it_asset.component.UserSessionInterceptor;
////
////@Configuration
////public class WebConfig implements WebMvcConfigurer {
//// @Autowired
//// private UserSessionInterceptor userSessionInterceptor;
////
//// @Override
//// public void addInterceptors(InterceptorRegistry registry) {
//// registry.addInterceptor(userSessionInterceptor);
//// }
////}
//import org.springframework.context.annotation.Configuration;
//import org.springframework.web.servlet.config.annotation.CorsRegistry;
//import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
//
//@Configuration
//public class WebConfig implements WebMvcConfigurer {
//
// @Override
// public void addCorsMappings(CorsRegistry registry) {
// registry.addMapping("/**") // Apply to all endpoints
// .allowedOrigins("*") // Allow all origins, or you can restrict to specific IPs
// .allowedMethods("GET", "POST", "PUT", "DELETE") // Allowed HTTP methods
// .allowedHeaders("*") // Allow all headers
// .allowCredentials(true) // Allow credentials (cookies, etc.)
// .maxAge(3600); // Max age of the CORS pre-flight request
// }
//}

59
src/main/java/com/feedback/it_asset/component/UserSessionInterceptor.java

@ -0,0 +1,59 @@
package com.feedback.it_asset.component;
import java.util.Arrays;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;
import com.feedback.it_asset.AppConfig;
import com.feedback.it_asset.UserSession;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
@Component
public class UserSessionInterceptor implements HandlerInterceptor {
@Autowired
private UserSession userSession;
@Autowired
private AppConfig appConfig;
private static final List<String> EXCLUDED_URLS = Arrays.asList("/login", "/", "/api");
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
// Get the current request URL
String requestUrl = request.getRequestURI();
// Exclude static resources from the check
if (requestUrl.startsWith("/assets/") || requestUrl.startsWith("/css/") || requestUrl.startsWith("/js/") || requestUrl.startsWith("/images/") || requestUrl.startsWith("/api/")) {
return true; // Allow the request to proceed without checking the login status
}
// Exclude the login page from the check
// Exclude specific URLs from the check
if (EXCLUDED_URLS.contains(requestUrl)) {
return true; // Allow the request to proceed without checking the login status
}
// Check if the user is logged in
// If logged in, add the userSession to the model
// Return true to allow the request to proceed
//if (isLoggedIn()) {
if(userSession.getUserId() != null && userSession.getUserType() != null) {
request.setAttribute("userSession", userSession);
} else {
request.setAttribute("title", "Login");
request.setAttribute("baseURL", appConfig.getBaseUrl());
response.sendRedirect("/login");
return false; // Stop further processing of the request
}
return true; // Allow the request to proceed
}
private boolean isLoggedIn() {
// Implement your login check logic here
// For example, check if the userSession contains the necessary information
return userSession.getUserId() != null && userSession.getUserType() != null;
}
}

1388
src/main/java/com/feedback/it_asset/controller/APIController.java
File diff suppressed because it is too large
View File

123
src/main/java/com/feedback/it_asset/controller/AssetController.java

@ -0,0 +1,123 @@
package com.feedback.it_asset.controller;
import java.io.IOException;
import java.sql.Blob;
import java.sql.SQLException;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Base64;
import java.util.List;
import javax.sql.rowset.serial.SerialBlob;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;
import com.feedback.it_asset.AppConfig;
import com.feedback.it_asset.QRCodeGenerator;
import com.feedback.it_asset.dto.GccAssetDetailsDto;
import com.feedback.it_asset.entity.AssetCategory;
import com.feedback.it_asset.entity.GccAssetDetails;
import com.feedback.it_asset.entity.GccFileData;
import com.feedback.it_asset.repository.AssetCategoryRep;
import com.feedback.it_asset.repository.GccAssetDetailsRep;
import com.feedback.it_asset.repository.GccFileDataRep;
import com.feedback.it_asset.service.GccAssetService;
import com.google.zxing.WriterException;
@Controller
public class AssetController {
@Autowired
private AppConfig appConfig;
@Autowired
AssetCategoryRep assetCategoryRep;
@Autowired
GccAssetDetailsRep gccAssetDetailsRep;
@Autowired
GccAssetService gccAssetService;
@Autowired
GccFileDataRep gccFileDataRep;
@GetMapping("/gcc-asset-list")
public String ViewAssetlist(Model model) throws IOException, WriterException, SQLException {
List<AssetCategory> assetCategoryList = assetCategoryRep.showAll();
model.addAttribute("assetcategorylist",assetCategoryList);
model.addAttribute("title","Asset Master List");
List<GccAssetDetails> assetDetailsList = gccAssetDetailsRep.showAll();
assetDetailsList.forEach(mp -> {
});
List<GccAssetDetailsDto> assetDetailsDtoList = new ArrayList<>();
for (GccAssetDetails assetDetails : assetDetailsList) {
GccAssetDetailsDto assetDetailsDto = new GccAssetDetailsDto();
// Copy the properties from the entity to the DTO
BeanUtils.copyProperties(assetDetails, assetDetailsDto);
// Set the extra field
System.out.println("GCC Assets:"+appConfig.getQrcodeUrl()+"/"+assetDetails.getAssetCode());
assetDetailsDto.setQrcodeimg(QRCodeGenerator.generateQRCode(appConfig.getQrcodeUrl()+"/"+assetDetails.getAssetCode()));
List<GccFileData> fileDataList = gccFileDataRep.showFileDataByAssetId(assetDetails.getAssetId());
for (GccFileData fileData : fileDataList) {
System.out.println(fileData.getFileName() + " Asset Photo");
Blob imageBlob = fileData.getData();
byte[] imageBytes = imageBlob.getBytes(1, (int) imageBlob.length());
assetDetailsDto.setAssetimg(Base64.getEncoder().encodeToString(imageBytes));
}
assetDetailsDtoList.add(assetDetailsDto);
}
// for (AssetDetails assetDetails : assetDetailsList) {
// System.out.println(assetDetails.getAssetCode() +":"+QRCodeGenerator.generateQRCode(assetDetails.getAssetCode()));
// assetDetails.setAssetCode(QRCodeGenerator.generateQRCode(assetDetails.getAssetCode()));
// }
model.addAttribute("assetdetailslist",assetDetailsDtoList);
//model.addAttribute("qrcode","iVBORw0KGgoAAAANSUhEUgAAAMgAAADIAQAAAACFI5MzAAAB+0lEQVR4Xu2XUWoDMQxEBb6WwVc36FoCd5422aSF/EnQQk3T7OoFbI1G2sTOp2U/A/f6J7+ebLNx3F0Xc7jvkYF64oe4x/K99hxXoIPs4boUM1sZJtBDSPTsdWLsuRrJQcnrM3o1ESBKStOYypVAA8EQpHqvb96pI6wg2W1Iyu4Px9eSbfL4iBVTZbOp96l8O8iUnnvhDuxhZuhbTlQt5RjGtqre8dBxGkgewTiG3E4Tk24D0T0OxPESU9WjfA2EcCz4EUVQe3ZWKdGOhqJUD3kPlw1E3pjUa6Xd5ZCXorWEhlW6thhHOsVL61KiW80iNW7gEhwPqCfUCpNoLAFH0FcNJBMjSX0Gl2TiHSQffc77osmoYAd5PMU35bsG0vMEtUT/VTvRwCKmHqOL6wmTlVSJcpOFbCHBttlfO6PZwuVE7ghmUvB4kv+nZXuVk2CGj3SJ43uF/aFoKWE6yIM6waJ2OgonqSfkqJplZylZKcp1PaFa+fTToGAiSVF8WU4eY5Vvj2LvihaTwIQEguK9KVpMtDvEeElR4wtlA2GRneKaTaRLK9cTfOFk6HwN4gaD1BPnT5YnycXg0O2tQSXBG3jPUXOufU+KeqJLyShJmUvnOfnqSU7xnfHrh2UHAU68TtVUyfuXRC3BIZudGRNMpL38OkEt+bD+yV8lXx4SQZQ4zzw1AAAAAElFTkSuQmCC");
System.out.println("Get /gcc-asset-list");
return "gcc-asset-list";
}
@RequestMapping(value = "/saveAsset", method = RequestMethod.POST)
public String saveAsset(@ModelAttribute("saveAsset") GccAssetDetails ad, @RequestParam(name = "paramId[]") String[] paramId,@RequestParam("assetFile") MultipartFile file) throws IOException, SQLException {
//areaId,assetAddress,assetClosingTime,assetLatitude,assetLongitude,assetName,assetOpeningTime,assetCode,catId,divId,zoneId,paramId
String paramIdquery="";
paramIdquery+="[";
for (int i = 0; i < paramId.length; i++) {
paramIdquery += paramId[i];
if (i < paramId.length - 1) {
paramIdquery += ",";
}
}
paramIdquery += "]";
//Integer productId = assetService.saveAsset(ad.getAreaId(), ASSCAT_NAMEad.getAssetAddress(), ad.getAssetClosingTime(), ad.getAssetLatitude(), ad.getAssetLongitude(), ad.getAssetName(), ad.getAssetOpeningTime(), "PAR-001-0001-00001", ad.getAssetCategory().getcId(), ad.getDivId(), ad.getZoneId(), paramIdquery);
// String assetCode = String.format("PAR-001-0001-%5d", ad.getAssetCategory().getcId());
// System.out.println("ok-----------------"+ad.getAssetId().getClass());
String assetCode = String.format("%s-%04d",ad.getAssetName(), ad.getAssetCategory().getcId());
System.out.println(assetCode);
Integer productId = gccAssetDetailsRep.insertAsset(ad.getAssetLatitude(), ad.getAssetLongitude(), ad.getAssetName(), assetCode, ad.getAssetCategory().getcId(),ad.getDepartmentName(),ad.getPosition(), ad.getPerson(), paramIdquery,ad.getMaintenanceType(),ad.getAssetType(),ad.getHwSlno());
Integer lastInId = gccAssetDetailsRep.getLastInsertedId();
System.out.println("Last insert ID: " +lastInId);
GccAssetDetails gccAssetDetails = new GccAssetDetails();
gccAssetDetails.setAssetId(lastInId);
LocalDateTime cdate = LocalDateTime.now();
GccFileData fileData = new GccFileData();
fileData.setFileName(file.getOriginalFilename());
byte[] fileBytes = file.getBytes();
Blob fileBlob = new SerialBlob(fileBytes);
fileData.setData(fileBlob);
fileData.setGccAssetDetails(gccAssetDetails);
fileData.setcDate(cdate);
gccFileDataRep.save(fileData);
return "redirect:/gcc-asset-list";
}
}

25
src/main/java/com/feedback/it_asset/controller/CommonAttributes.java

@ -0,0 +1,25 @@
package com.feedback.it_asset.controller;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ModelAttribute;
import com.feedback.it_asset.AppConfig;
@ControllerAdvice
public class CommonAttributes {
private final AppConfig appConfig;
public CommonAttributes(AppConfig appConfig) {
this.appConfig=appConfig;
}
@ModelAttribute("baseurl")
public String baseUrl() {
return appConfig.getBaseUrl();
}
@ModelAttribute("title")
public String baseTitle() {
return appConfig.getTitle();
}
}

498
src/main/java/com/feedback/it_asset/controller/FeedbackController.java

@ -0,0 +1,498 @@
package com.feedback.it_asset.controller;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.lang.reflect.Field;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.aspectj.weaver.tools.Trace;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.util.MultiValueMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.client.RestTemplate;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.feedback.it_asset.AppConfig;
import com.feedback.it_asset.dto.ComplaintForm;
import com.feedback.it_asset.entity.AssetCategory;
import com.feedback.it_asset.entity.AssetCategoryQuestions;
import com.feedback.it_asset.entity.AssetParameterQuestions;
import com.feedback.it_asset.entity.GccAssetDetails;
import com.feedback.it_asset.repository.AssetCategoryQuestionsRep;
import com.feedback.it_asset.repository.AssetParameterQuestionsRep;
import com.feedback.it_asset.repository.GccAssetDetailsRep;
import com.feedback.it_asset.repository.GccFeedbackDataRep;
import com.feedback.it_asset.repository.GccFeedbackRep;
@Controller
public class FeedbackController {
@Autowired
private AppConfig appConfig;
@Autowired
private GccAssetDetailsRep gccAssetDetailsRep;
@Autowired
private AssetCategoryQuestionsRep assetCategoryQuestionsRep;
@Autowired
private AssetParameterQuestionsRep assetParameterQuestionsRep;
@Autowired
private GccFeedbackRep gccFeedbackRep;
@Autowired
private GccFeedbackDataRep gccfeedbackDataRep;
@GetMapping("/gcc_asset_details-0.0.1-SNAPSHOT/qr-feedback/feedback/entry/qrcode={qrcode}")
//testurl : http://localhost:8080/asset_details-0.0.1-SNAPSHOT/qr-feedback/feedback/entry/qrcode=PRK-01-001-00001
public String changeOldToNew(@PathVariable String qrcode){
return "redirect:/gcc-complaint/"+qrcode;
/*
String assetId = assetDetailsRep.findByAssetCode(qrcode);
if (assetId != null) {
return "redirect:/public-feedback/"+assetId;
} else {
return "redirect:/public-feedback/"+qrcode;
}
*/
}
// @GetMapping("/gcc-complaint/{qrcode}")
// public String viewPublicFeedbackForm(Model model, @PathVariable String qrcode) {
// String assetId = gccAssetDetailsRep.findByAssetCode(qrcode);
// Integer assetid = 0;
// if (assetId != null) {
// assetid = Integer.valueOf(assetId);
// }
//
// List<GccAssetDetails> assetDetailsList = gccAssetDetailsRep.findByAssetId(assetid);
// List<Integer> paramDbVal = new ArrayList<>();
// for (GccAssetDetails ad : assetDetailsList) {
// //Basic Asset Details
// model.addAttribute("assetId", ad.getAssetId());
// model.addAttribute("assetName", ad.getAssetName());
// /////////////////////
// List<AssetCategoryQuestions> assetCategoryQuestionList = assetCategoryQuestionsRep.findByCatId(ad.getAssetCategory().getcId());
// model.addAttribute("feedbackquestionlist", assetCategoryQuestionList);
// System.out.println(ad.getParamId());
// String paramDbStr = ad.getParamId().replaceAll("[\\[\\]\\s]", "");
// String[] paramIdStr = paramDbStr.split(",");
// for (String a : paramIdStr) {
// paramDbVal.add(Integer.parseInt(a));
// }
// List<AssetParameterQuestions> assetParameterQuestionList = assetParameterQuestionsRep.findByParameterId(paramDbVal);
// model.addAttribute("assetparameterquestionlist", assetParameterQuestionList);
// }
// model.addAttribute("title", "GCC Complaint Form");
// //model.addAttribute("baseurl", appConfig.getBaseUrl());
// return "gcc-complaint";
// }
// @GetMapping("/gcc-complaint/{qrcode}")
// public String viewPublicFeedbackForm(Model model, @PathVariable String qrcode) {
// String assetId = gccAssetDetailsRep.findByAssetCode(qrcode);
// Integer assetid = (assetId != null) ? Integer.valueOf(assetId) : null;
//
// List<GccAssetDetails> assetDetailsList = gccAssetDetailsRep.findByAssetId(assetid);
//
// for (GccAssetDetails ad : assetDetailsList) {
// // Basic Asset Details
// model.addAttribute("assetId", ad.getAssetId());
// model.addAttribute("assetName", ad.getAssetName());
// model.addAttribute("departmentName", ad.getDepartmentName());
// model.addAttribute("person", ad.getPerson());
// model.addAttribute("position", ad.getPosition());
// model.addAttribute("assetCode", ad.getAssetCode());
//
// // model.addAttribute("catName", ad.getAssetCategory());
//
//
// AssetCategory assetCategory = ad.getAssetCategory();
// if (assetCategory != null) {
// model.addAttribute("assetCategoryId", assetCategory.getcId());
// model.addAttribute("catName", assetCategory.getCatName());
//
//
//
// List<AssetCategoryQuestions> assetCategoryQuestionList = assetCategoryQuestionsRep.findByCatId(assetCategory.getcId());
// model.addAttribute("feedbackquestionlist", assetCategoryQuestionList);
//
// List<Integer> paramDbVal = new ArrayList<>();
// if (ad.getParamId() != null) {
// String paramDbStr = ad.getParamId().replaceAll("[\\[\\]\\s]", "");
// String[] paramIdStr = paramDbStr.split(",");
// for (String a : paramIdStr) {
// paramDbVal.add(Integer.parseInt(a));
// }
// }
// List<AssetParameterQuestions> assetParameterQuestionList = assetParameterQuestionsRep.findByParameterId(paramDbVal);
// model.addAttribute("assetparameterquestionlist", assetParameterQuestionList);
// }
// }
//
// model.addAttribute("title", "GCC Complaint Form");
// return "gcc-complaint";
//}
@GetMapping("/gcc-complaint/{qrcode}")
public String viewPublicFeedbackForm(Model model, @PathVariable String qrcode) {
String assetId = gccAssetDetailsRep.findByAssetCode(qrcode);
Integer assetid = null;
if (assetId != null && !assetId.equals("null")) {
try {
assetid = Integer.valueOf(assetId);
} catch (NumberFormatException e) {
// Handle invalid integer format
return "error"; // or appropriate error page
}
}
List<GccAssetDetails> assetDetailsList = gccAssetDetailsRep.findByAssetId(assetid);
if (assetDetailsList == null || assetDetailsList.isEmpty()) {
return "error"; // or appropriate error page
}
for (GccAssetDetails ad : assetDetailsList) {
// Basic Asset Details
model.addAttribute("assetId", ad.getAssetId());
model.addAttribute("assetName", ad.getAssetName());
model.addAttribute("departmentName", ad.getDepartmentName());
model.addAttribute("person", ad.getPerson());
model.addAttribute("position", ad.getPosition());
model.addAttribute("assetCode", ad.getAssetCode());
model.addAttribute("assetType", ad.getAssetType());
model.addAttribute("maintananceType", ad.getMaintenanceType());
model.addAttribute("hwSlno", ad.getHwSlno());
AssetCategory assetCategory = ad.getAssetCategory();
if (assetCategory != null) {
model.addAttribute("assetCategoryId", assetCategory.getcId());
model.addAttribute("catName", assetCategory.getCatName());
List<AssetCategoryQuestions> assetCategoryQuestionList = assetCategoryQuestionsRep.findByCatId(assetCategory.getcId());
model.addAttribute("feedbackquestionlist", assetCategoryQuestionList);
List<Integer> paramDbVal = new ArrayList<>();
if (ad.getParamId() != null) {
String paramDbStr = ad.getParamId().replaceAll("[\\[\\]\\s]", "");
String[] paramIdStr = paramDbStr.split(",");
for (String a : paramIdStr) {
try {
paramDbVal.add(Integer.parseInt(a));
} catch (NumberFormatException e) {
// Handle invalid integer format
// Possibly log or ignore this entry
}
}
}
List<AssetParameterQuestions> assetParameterQuestionList = assetParameterQuestionsRep.findByParameterId(paramDbVal);
model.addAttribute("assetparameterquestionlist", assetParameterQuestionList);
}
}
model.addAttribute("title", "GCC Complaint Form");
return "gcc-complaint";
}
@RequestMapping(value="/gcc-complaint/save", method = RequestMethod.POST)
public String savePublicFeedback(
@RequestParam MultiValueMap<String, String> formData,
@RequestParam(name = "uname") String name,
@RequestParam(name = "mobile") String mobile,
@RequestParam(name = "score" ) String rating,
@RequestParam(name = "assetId") Integer assetId,
@RequestParam(name = "ORGID",required = true) String ORGID,
@RequestParam(name = "EMPID",required = true) String EMPID,
@RequestParam(name = "COMPMODE",required = true) String COMPMODE,
@RequestParam(name = "LOCID",required = true) String LOCID,
@RequestParam(name = "DEPTID",required = true) String DEPTID,
@RequestParam(name = "SECTID",required = true) String SECTID,
@RequestParam(name = "SECUSERID",required = true) String SECUSERID,
@RequestParam(name = "COMP_DATE",required = false) String COMP_DATE,
@RequestParam(name = "COMP_TIME",required = false) String COMP_TIME,
@RequestParam(name = "COMP_TYPE",required = false) String COMP_TYPE,
@RequestParam(name = "COMPLAINANTNAME",required = true) String COMPLAINANTNAME,
@RequestParam(name = "COMPLAINANTCELL",required = true) String COMPLAINANTCELL,
@RequestParam(name = "COMPLAINANT",required = true) String COMPLAINANT,
@RequestParam(name = "COMP_USER",required = true) String COMP_USER,
@RequestParam(name = "ATTACHMENT_DATA",required = false) String ATTACHMENT_DATA,
@RequestParam(name = "ATTACHMENT_FILENAME",required = false) String ATTACHMENT_FILENAME,
@RequestParam(name = "BroadBand_No",required = false) String BroadBand_No,
@RequestParam(name = "BroadBand_At",required = false) String BroadBand_At,
@RequestParam(name = "BroadBand_Loc",required = false) String BroadBand_Loc,
@RequestParam(name = "BroadBand_Issue",required = false) String BroadBand_Issue,
@RequestParam(name = "HardWare_AssetID",required = false) String HardWare_AssetID,
@RequestParam(name = "LeaseLine_From",required = false) String LeaseLine_From,
@RequestParam(name = "LeaseLine_Issue",required = false) String LeaseLine_Issue,
@RequestParam(name = "SW_Module",required = false) String SW_Module,
@RequestParam(name = "SW_AttData",required = false) String SW_AttData,
@RequestParam(name = "SW_FileName",required = false) String SW_FileName,
@RequestParam(name = "HWCatID",required = false) String HWCatID,
@RequestParam(name = "UserCode",required = true) String UserCode,
@RequestParam(name = "UserType",required = false) String UserType,
@RequestParam(name = "InOutboundFlag",required = false) String InOutboundFlag,
@RequestParam(name = "InOutboundLocType",required = false) String InOutboundLocType,
@RequestParam(name = "Lat",required = false) String Lat,
@RequestParam(name = "Long",required = false) String Long,
Model model
) {
ComplaintForm cm = new ComplaintForm();
cm.setORGID(ORGID);
cm.setEMPID(EMPID);
cm.setCOMPMODE(COMPMODE);
cm.setLOCID(LOCID);
cm.setDEPTID(DEPTID);
cm.setSECTID(SECTID);
cm.setSECUSERID(SECUSERID);
cm.setCOMP_DATE(COMP_DATE);
cm.setCOMP_TIME(COMP_TIME);
cm.setCOMP_TYPE(COMP_TYPE);
cm.setATTACHMENT_FILENAME(ATTACHMENT_FILENAME);
cm.setATTACHMENT_DATA(ATTACHMENT_DATA);
cm.setBroadBand_At(BroadBand_At);
cm.setBroadBand_Issue(BroadBand_Issue);
cm.setBroadBand_Loc(BroadBand_Loc);
cm.setBroadBand_No(BroadBand_No);
cm.setCOMP_USER(COMP_USER);
cm.setCOMPMODE(COMPMODE);
cm.setUserType(UserType);
cm.setUserCode(UserCode);
cm.setCOMPLAINANTNAME(COMPLAINANTNAME);
cm.setCOMPLAINANTCELL(COMPLAINANTCELL);
cm.setCOMPLAINANT(COMPLAINANT);
cm.setHWCatID(HWCatID);
cm.setHardWare_AssetID(HardWare_AssetID);
cm.setSW_AttData(SW_AttData);
cm.setSW_FileName(SW_FileName);
cm.setSW_Module(SW_Module);
cm.setInOutboundFlag(InOutboundFlag);
cm.setInOutboundLocType(InOutboundLocType);
cm.setOutbound_LocID(LOCID);
cm.setLat(Lat);
cm.setLong(Long);
cm.setLeaseLine_From(LeaseLine_From);
cm.setLeaseLine_Issue(LeaseLine_Issue);
System.out.println(".............>>>>>>>>>>>><<<<<<<.............."+ORGID);
//System.out.println("the cm................>>>>>>>>>>>><><><>>>>><<>"+cm.getORGID());
String complaintNo ="0";
//formData.
System.out.println(formData.values().toString());
String feedback="[no]";
if(rating.isEmpty()){
rating = "0";
}
gccFeedbackRep.insertFeedback(assetId,name,mobile,rating);
Integer lastInId = gccFeedbackRep.getLastInsertedId();
// process the form data here
for (String key : formData.keySet()) {
if (!key.equals("uname")
&& !key.equals("mobile")
&& !key.equals("score")
&& !key.equals("assetId")
) {
List<String> values = formData.get(key);
// System.out.println("========================");
// System.out.println(values.toString());
// System.out.println("========================");
//int s= values.toString().length();
// remove empty values
List<String> filteredValues = values.stream()
.filter(value -> !value.isEmpty())
.map(String::trim)
.collect(Collectors.toList());
// System.out.println(filteredValues.toString());
//
// do something with the field values
if (!filteredValues.isEmpty()) {
System.out.println("Field " + key + " has values: " + filteredValues.get(0));
feedback = filteredValues.toString().trim();
System.out.println(feedback + "is the feedback value");
String[] parts = key.split("_");
if (parts.length == 2) {
Integer cmqid = null, apqid = null, aqid = null;
if ("cq".equals(parts[0])) {
try {
cmqid = Integer.parseInt(parts[1]);
} catch (NumberFormatException e) {}
} else if ("pq".equals(parts[0])) {
try {
apqid = Integer.parseInt(parts[1]);
} catch (NumberFormatException e) {}
} else if ("aq".equals(parts[0])) {
try {
aqid = Integer.parseInt(parts[1]);
} catch (NumberFormatException e) {}
}
if (cmqid != null || apqid != null || aqid != null) {
if(complaintNo.equals("0")) {
System.out.println("sub Field " + key + " has values: " + filteredValues.get(0) +"size :"+filteredValues.size());
complaintNo = handleComplaintForm1(cm);
System.out.println("////////////................"+complaintNo);
model.addAttribute("complaintNo",complaintNo);
}
gccfeedbackDataRep.insertFeedback(lastInId, cmqid, apqid, feedback, complaintNo);
}
}
}
}
}
// if(feedback.equals("[yes]")) {
// return "redirect:/gcc-feedback-thanks";
// }else {
// return "redirect:/gcc-asset-list";
//
// }
return "redirect:/gcc-feedback-thanks/"+complaintNo;
}
@RequestMapping(value={"gcc-feedback-thanks","gcc-feedback-thanks/{complaintNo}"})
public String showFeedbackThanks(@PathVariable(required=false) String complaintNo,Model model) {
String txt = "Thanks for your feedback.<br>We're constantly trying to improve our services, so your input is valuable. We'll look closely at what you've said and see how we can improve things.";
model.addAttribute("title","Thanks for your feedback.");
model.addAttribute("thankstxt",txt);
model.addAttribute("complaintNo",complaintNo);
System.out.println("//com no....com"+ complaintNo);
if (complaintNo != null && !complaintNo.equals("0")) {
String sweetAlertScript = "Swal.fire('Thanks!', 'Your feedback is appreciated. Your Complaint Id: " + complaintNo + "', 'success');";
model.addAttribute("sweetAlertScript", sweetAlertScript);
model.addAttribute("showSweetAlert", true);
} else {
String sweetAlertScript = "Swal.fire('Thanks!', 'Your feedback is appreciated.', 'success');";
model.addAttribute("sweetAlertScript", sweetAlertScript);
model.addAttribute("showSweetAlert", false); // Set showSweetAlert to false
}
return "gcc-feedback-thanks";
}
public String handleComplaintForm1(ComplaintForm complaintForm ) {
System.out.println("testing..............>>>>>>>>>>>>>>>>.");
try {
String urlString = "http://117.232.67.132/gcc_attendance/ser_callmnt_reg";
// RestTemplate restTemplate = new RestTemplate();
// restTemplate.postForEntity(appConfig.getErpUrl(),complaintForm ,String.class);
String payload = "{" +
"\"ORGID\":\"" + complaintForm.getORGID() + "\"," +
"\"EMPID\":\"" + complaintForm.getEMPID() + "\"," +
"\"COMPMODE\":\"" + complaintForm.getCOMPMODE() + "\"," +
"\"LOCID\":\"" + complaintForm.getLOCID() + "\"," +
"\"DEPTID\":\"" + complaintForm.getDEPTID() + "\"," +
"\"SECTID\":\"" + complaintForm.getSECTID() + "\"," +
"\"SECUSERID\":\"" + complaintForm.getSECUSERID() + "\"," +
"\"COMP_DATE\":\"" + complaintForm.getCOMP_DATE() + "\"," +
"\"COMP_TIME\":\"" + complaintForm.getCOMP_TIME() + "\"," +
"\"COMP_TYPE\":\"" + complaintForm.getCOMP_TYPE() + "\"," +
"\"COMPLAINANTNAME\":\"" + complaintForm.getCOMPLAINANTNAME() + "\"," +
"\"COMPLAINANTCELL\":\"" + complaintForm.getCOMPLAINANTCELL() + "\"," +
"\"COMPLAINANT\":\"" + complaintForm.getCOMPLAINANT() + "\"," +
"\"COMP_USER\":\"" + complaintForm.getCOMP_USER() + "\"," +
"\"ATTACHMENT_DATA\":\"" + complaintForm.getATTACHMENT_DATA() + "\"," +
"\"ATTACHMENT_FILENAME\":\"" + complaintForm.getATTACHMENT_FILENAME() + "\"," +
"\"BroadBand_No\":\"" + complaintForm.getBroadBand_No() + "\"," +
"\"BroadBand_At\":\"" + complaintForm.getBroadBand_At() + "\"," +
"\"BroadBand_Loc\":\"" + complaintForm.getBroadBand_Loc() + "\"," +
"\"BroadBand_Issue\":\"" + complaintForm.getBroadBand_Issue() + "\"," +
"\"HardWare_AssetID\":\"" + complaintForm.getHardWare_AssetID() + "\"," +
"\"HardWare_ID\":\"" + complaintForm.getHardWare_ID() + "\"," +
"\"LeaseLine_From\":\"" + complaintForm.getLeaseLine_From() + "\"," +
"\"LeaseLine_Issue\":\"" + complaintForm.getLeaseLine_Issue() + "\"," +
"\"SW_Module\":\"" + complaintForm.getSW_Module() + "\"," +
"\"SW_AttData\":\"" + complaintForm.getSW_AttData() + "\"," +
"\"SW_FileName\":\"" + complaintForm.getSW_FileName() + "\"," +
"\"HWCatID\":\"" + complaintForm.getHWCatID() + "\"," +
"\"UserCode\":\"" + complaintForm.getUserCode() + "\"," +
"\"UserType\":\"" + complaintForm.getUserType() + "\"," +
"\"InOutboundFlag\":\"" + complaintForm.getInOutboundFlag() + "\"," +
"\"InOutboundLocType\":\"" + complaintForm.getInOutboundLocType() + "\"," +
"\"Outbound_LocID\":\"" + complaintForm.getOutbound_LocID() + "\"," +
"\"Lat\":\"" + complaintForm.getLat() + "\"," +
"\"Long\":\"" + complaintForm.getLong() + "\"," +
"}";
System.out.println("///"+payload);
// URL encode the payload
String encodedPayload = URLEncoder.encode(payload, "UTF-8");
// Construct the complete URL with payload as parameters
urlString += "?ServiceID=SetCallMntReg&SetInput=" + encodedPayload;
URL url = new URL(urlString);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
System.out.println("This is the URL "+ connection);
// Set the necessary HTTP method and headers
connection.setRequestMethod("POST");
connection.setRequestProperty("Content-Type", "application/json");
connection.setDoOutput(true);
// Get the response from the server
StringBuilder response = new StringBuilder();
try (BufferedReader br = new BufferedReader(new InputStreamReader(connection.getInputStream(), "utf-8"))) {
String responseLine;
while ((responseLine = br.readLine()) != null) {
response.append(responseLine.trim());
}
}catch(Exception e) {
}
// Print the response to the server's console
System.out.println("Response from server: " + response.toString());
ObjectMapper objectMapper = new ObjectMapper();
JsonNode jsonResponse = objectMapper.readTree(response.toString());
// Extract the "ID" from the JSON response
String complaintNo = jsonResponse.get("ID").asText();
System.out.println("........./////////////////.................."+complaintNo);
return complaintNo;
}catch(Exception ee) {
return null;
}
}
}

354
src/main/java/com/feedback/it_asset/controller/MainController.java

@ -0,0 +1,354 @@
package com.feedback.it_asset.controller;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import com.feedback.it_asset.AppConfig;
import com.feedback.it_asset.UserSession;
import com.feedback.it_asset.entity.AssetCategory;
import com.feedback.it_asset.entity.AssetCategoryQuestions;
import com.feedback.it_asset.entity.AssetParameter;
import com.feedback.it_asset.entity.AssetParameterQuestions;
import com.feedback.it_asset.entity.GccAssetDetails;
import com.feedback.it_asset.entity.GccFeedback;
import com.feedback.it_asset.entity.User;
import com.feedback.it_asset.repository.AssetCategoryQuestionsRep;
import com.feedback.it_asset.repository.AssetCategoryRep;
import com.feedback.it_asset.repository.AssetParameterQuestionsRep;
import com.feedback.it_asset.repository.AssetParameterRep;
import com.feedback.it_asset.repository.GccAssetDetailsRep;
import com.feedback.it_asset.repository.GccFeedbackDataRep;
import com.feedback.it_asset.repository.GccFeedbackRep;
import com.feedback.it_asset.repository.UserRepository;
import com.feedback.it_asset.service.GccAssetService;
@Controller
public class MainController {
@Autowired
private AppConfig appConfig;
@Autowired
private AssetCategoryRep assetCategoryRep;
@Autowired
private AssetCategoryQuestionsRep assetCategoryQuestionsRep;
@Autowired
private AssetParameterRep assetParameterRep;
@Autowired
private AssetParameterQuestionsRep assetParameterQuestionsRep;
@Autowired
private GccAssetDetailsRep gccAssetDetailsRep;
@Autowired
private GccFeedbackRep gccFeedbackRep;
@Autowired
private GccFeedbackDataRep gccFeedbackDataRep;
@Autowired
private UserRepository userRepository;
@Autowired
private UserSession userSession;
@Autowired
private GccAssetService gccAssetService;
@RequestMapping("/")
public String viewLogin(Model model){
model.addAttribute("title","Dashboard");
System.out.println("Get /");
// return "400";
return "login";
}
@PostMapping("/login")
public String login(Model model,@RequestParam String username,@RequestParam String password) {
System.out.println(username +" "+password);
Optional<User> usr =userRepository.checkUser(username,password);
// Userlogin usrlog = new Userlogin();
if(usr.isPresent()) {
userSession.setUserType(usr.get().getUsername());
userSession.setUserId(1);
return "redirect:/report";
}
return "login";
}
@RequestMapping("/dashboard")
public String viewHomePage(Model model){
List<Map<String, Object>> feedbackAnalysis = gccAssetService.getFeedbackAnalysis();
// model.addAttribute("months", months);
// model.addAttribute("closedValues", closedValues);
// model.addAttribute("pendingValues", pendingValues);
// model.addAttribute("totalValues", totalValues);
model.addAttribute("dashboard", feedbackAnalysis);
model.addAttribute("title","Dashboard");
model.addAttribute("totalAssets",gccAssetDetailsRep.countActiveAssets());
model.addAttribute("totalFeedbacks",gccFeedbackRep.count());
model.addAttribute("totalYesFeedbacks",gccFeedbackDataRep.onlyYesCount());
model.addAttribute("totalNoFeedbacks",gccFeedbackDataRep.onlyNoCount());
System.out.println("Get /");
// return "400";
return "dashboard";
}
@GetMapping("/base-file")
public String viewTestPage(Model model){
model.addAttribute("title","Base File");
System.out.println("base file /");
return "base";
}
@GetMapping("/login")
public String viewDashboard(Model model){
model.addAttribute("title","Login");
System.out.println("Get /login");
// return "400";
return "login";
}
// @RequestMapping(value = "/updateAsset", method = RequestMethod.POST)
// public String updateAsset(@RequestParam("assetId")Integer assetId,@RequestParam("assetName")String assetName,@RequestParam("departmentName")String departmentName,@RequestParam("person")String person,@RequestParam("position")String position) {
// //service.save(asse);
// System.out.println(assetId+ " --- " );
// gccAssetDetailsRep.updateAsset(assetId,assetName,departmentName,person,position);
//// return "400";
// return "redirect:/gcc-asset-list";
// }
@GetMapping("/asset-category")
public String viewMasterEntry(Model model){
List<AssetCategory> assetCategoryList = assetCategoryRep.showAll();
model.addAttribute("assetcategorylist",assetCategoryList);
model.addAttribute("title","Asset Category");
model.addAttribute("category", new AssetCategory());
System.out.println("Get /asset-category");
// return "400";
return "asset-category";
}
@RequestMapping(value = "/saveCategory", method = RequestMethod.POST)
public String saveCategory(@ModelAttribute("category") AssetCategory cat) {
//service.save(cat);
System.out.println(cat.getCatName() + " --- " +cat.getIsActive());
assetCategoryRep.insertCategory(cat.getCatName(),cat.getIsActive());
// return "400";
return "redirect:/asset-category";
}
@RequestMapping(value = "/updateCategory", method = RequestMethod.POST)
public String updateCategory(@ModelAttribute("category") AssetCategory cat) {
//service.save(cat);
System.out.println(cat.getCatName() + " --- " +cat.getIsActive());
assetCategoryRep.updateCategory(cat.getcId(),cat.getCatName(),cat.getIsActive());
// return "400";
return "redirect:/asset-category";
}
@GetMapping("/asset-category-questions")
public String viewMasterQuestionList(Model model){
List<AssetCategoryQuestions> assetCategoryQuestionList = assetCategoryQuestionsRep.showQuestionsAll();
model.addAttribute("assetcategoryquestionlist",assetCategoryQuestionList);
List<AssetCategory> assetCategoryList = assetCategoryRep.showAll();
model.addAttribute("assetcategorylist",assetCategoryList);
model.addAttribute("title","Asset Master Question");
model.addAttribute("categoryquestion", new AssetCategoryQuestions());
System.out.println("Get /asset-master-questions");
// return "400";
return "asset-category-questions";
}
@RequestMapping(value = "/saveCategoryQuestion", method = RequestMethod.POST)
public String saveMasterQuestion(@ModelAttribute("categoryquestion") AssetCategoryQuestions cmq) {
//service.save(cat);
System.out.println(cmq.getAssetCategory().getcId() + " --- " +cmq.getIsActive());
Integer catID = cmq.getAssetCategory().getcId();
System.out.println("Send Value:"+catID);
assetCategoryQuestionsRep.insertQuestionCategory(catID,cmq.getEngQuestion(),cmq.getTamilQuestion(),cmq.getIsActive());
// return "400";
return "redirect:/asset-category-questions";
}
@RequestMapping(value = "/updateCategoryQuestion", method = RequestMethod.POST)
public String updateMasterQuestion(@ModelAttribute("categoryquestion") AssetCategoryQuestions cmq) {
Integer catID = cmq.getAssetCategory().getcId();
System.out.println(cmq.getCmqId()+" -- "+catID+" -- "+cmq.getTamilQuestion());
assetCategoryQuestionsRep.updateQuestionCategory(cmq.getCmqId(),catID,cmq.getEngQuestion(),cmq.getTamilQuestion(),cmq.getIsActive());
//return "400";
return "redirect:/asset-category-questions";
}
@GetMapping("/asset-parameter")
public String viewMasterparameterist(Model model){
List<AssetParameter> assetParameterList = assetParameterRep.showAll();
model.addAttribute("assetparameterlist",assetParameterList);
List<AssetCategory> assetCategoryList = assetCategoryRep.showAll();
model.addAttribute("assetcategorylist",assetCategoryList);
model.addAttribute("title","Asset Master Question");
model.addAttribute("assetparameter", new AssetParameter());
System.out.println("Get /asset-parameter");
//return "400";//
return "asset-parameter";
}
@RequestMapping(value = "/saveParameter", method = RequestMethod.POST)
public String saveMasterParameter(@ModelAttribute("assetparameter") AssetParameter parameter) {
//service.save(cat);
System.out.println(parameter.getAssetCategory().getcId() + " --- " +parameter.getIsActive());
Integer catID = parameter.getAssetCategory().getcId();
System.out.println("Send Value:"+catID);
assetParameterRep.insertParametert(catID,parameter.getParamName(),parameter.getIsActive());
// return "400";
return "redirect:/asset-parameter";
}
@RequestMapping(value = "/updateParameter", method = RequestMethod.POST)
public String updateMasterParameter(@ModelAttribute("assetparameter") AssetParameter parameter) {
//service.save(cat);
System.out.println(parameter.getAssetCategory().getcId() + " --- " +parameter.getParamId());
Integer catID = parameter.getAssetCategory().getcId();
System.out.println("Send Value:"+catID);
assetParameterRep.updateParameter(parameter.getParamId(),catID,parameter.getParamName(),parameter.getIsActive());
//return "400";//
return "redirect:/asset-parameter";
}
@GetMapping("/asset-parameter-questions")
public String viewParameterQuestionList(Model model){
List<AssetParameterQuestions> assetParameterQuestionList = assetParameterQuestionsRep.showQuestionsAll();
model.addAttribute("assetparameterquestionlist",assetParameterQuestionList);
List<AssetParameter> assetParameterList = assetParameterRep.showAll();
model.addAttribute("parameterlist",assetParameterList);
model.addAttribute("title","Asset Master Question");
model.addAttribute("parameterquestion", new AssetParameterQuestions());
System.out.println("Get /asset-master-questions");
//return "400";//
return "asset-parameter-questions";
}
@RequestMapping(value = "/saveParameterQuestion", method = RequestMethod.POST)
public String saveParameterQuestion(@ModelAttribute("parameterquestion") AssetParameterQuestions apq) {
System.out.println(apq.getAssetParameter().getParamId() + " --- " +apq.getIsActive());
Integer parID = apq.getAssetParameter().getParamId();
System.out.println("Send Value:"+parID);
assetParameterQuestionsRep.insertParameterQuestion(parID,apq.getEngQuestion(),apq.getTamilQuestion(),apq.getIsActive());
// return "400";
return "redirect:/asset-parameter-questions";
}
@RequestMapping(value = "/updateParameterQuestion", method = RequestMethod.POST)
public String updateMasterQuestion(@ModelAttribute("parameterquestion") AssetParameterQuestions apq) {
Integer parID = apq.getAssetParameter().getParamId();
System.out.println(apq.getApqId()+" -- "+parID+" -- "+apq.getTamilQuestion());
assetParameterQuestionsRep.updateParameterQuestion(apq.getApqId(),parID,apq.getEngQuestion(),apq.getTamilQuestion(),apq.getIsActive());
//return "400";
return "redirect:/asset-parameter-questions";
}
@GetMapping("/complaint-list")
public String viewFeedbackList(Model model){
List<GccFeedback> gccFeedbackList = gccFeedbackRep.findAll();
model.addAttribute("feedbacklist",gccFeedbackList);
model.addAttribute("title","Asset - GCC Complaint List");
return "complaint-list";
}
@GetMapping("/closed-complaint")
public String viewPositiveFeedbackList(Model model){
List<GccFeedback> gccFeedbackList = gccFeedbackRep.findByfeedbackAllYes();
model.addAttribute("feedbacklist",gccFeedbackList);
model.addAttribute("title","Asset - GCC Closed Complaint List");
return "closed-complaint";
}
@GetMapping("/pending-complaint")
public String viewNegativeFeedbackList(Model model){
List<GccFeedback> gccFeedbackList = gccFeedbackRep.findByfeedbackAllNo();
model.addAttribute("feedbacklist",gccFeedbackList);
model.addAttribute("title","Asset - GCC Pending Complaint List");
return "pending-complaint";
}
@GetMapping("/gcc-services-water")
public String viewGccServiceWater(Model model) {
model.addAttribute("title","GCC-Service-Water");
model.addAttribute("pTax",appConfig.getPtaxid());
model.addAttribute("regMobile",appConfig.getPtaxRegMobile());
if("null".equals(appConfig.getPtaxid())){
return "redirect:/gcc-login";
}
return "gcc-services-2";
}
@GetMapping("/gcc-services-load")
public String viewifram(Model model, @RequestParam("url") String url) {
model.addAttribute("title","GCC-Service-Water");
model.addAttribute("url",url);
model.addAttribute("pTax",appConfig.getPtaxid());
model.addAttribute("regMobile",appConfig.getPtaxRegMobile());
if("null".equals(appConfig.getPtaxid())){
return "redirect:/gcc-login";
}
System.out.println(url);
return "gcc-service-ifram";
}
@GetMapping("/gcc-services-load2")
public String viewifram2(Model model, @RequestParam("url") String url) {
model.addAttribute("title","GCC-Service-Water");
model.addAttribute("url",url);
model.addAttribute("pTax",appConfig.getPtaxid());
model.addAttribute("regMobile",appConfig.getPtaxRegMobile());
System.out.println(url);
if("null".equals(appConfig.getPtaxid())){
return "redirect:/gcc-login";
}
return "gcc-service-ifram2";
}
@GetMapping("/gcc-login")
public String viewPubliclogin(Model model, @RequestParam(value = "ptaxid", defaultValue = "null") String ptaxNo) {
model.addAttribute("title","GCC-Login");
model.addAttribute("ptax",ptaxNo);
String msg="Login to Your Account";
if(ptaxNo.equals("null")){
msg = "<p class='text-danger'>Invalid Session<br>Scan QR code and try Again!</p>";
}
model.addAttribute("errortxt",msg);
return "gcc-login";
}
@GetMapping("/gcc-logout")
public String logout(Model model) {
return "redirect:/login";
}
@GetMapping("/totalchart.html")
public String showTotalChart() {
// Your logic here
return "totalchart"; // Assuming "closedchart" is the Thymeleaf template name
}
@GetMapping("/qrbulkgen")
public String qrbulk() {
// Your logic here
return "qrbulkgeneration"; // Assuming "closedchart" is the Thymeleaf template name
}
@GetMapping("/pendingchart.html")
public String showPendingChart() {
// Your logic here
return "pendingchart"; // Assuming "pendingchart" is the Thymeleaf template name
}
@GetMapping("/closedchart.html")
public String showClosedChart() {
// Your logic here
return "closedchart"; // Assuming "closedchart" is the Thymeleaf template name
}
@GetMapping("/categories")
private List<AssetCategory> categoryList(@RequestParam(name = "searchTerm", required = false) String searchTerm) {
if (searchTerm != null && !searchTerm.isEmpty()) {
return assetCategoryRep.showAll();
} else {
return assetCategoryRep.showAll();
}
}
}

75
src/main/java/com/feedback/it_asset/dto/AssetDTO.java

@ -0,0 +1,75 @@
//package com.feedback.it_asset.dto;
//
//public class AssetDTO {
//
// private Integer assetId;
// private String departmentName;
// private String position;
// private String paramId;
// private String assetName;
// private String assetCode;
// private String person;
// private String assetLatitude;
// private String assetLongitude;
// private Boolean isDelete;
// private Boolean isActive;
// private Integer createdBy;
// private String cDate;
// private String catName; // Assuming this field is present in your AssetCategory entity
// private String qrcodeimg; // Assuming this field is for QR code image in base64 format
// private String assetimg; // Assuming this field is for asset image in base64 format
//
// // Constructors, getters, and setters
//
// public AssetDTO() {
// }
//
// public AssetDTO(Integer assetId, String departmentName, String position, String paramId, String assetName,
// String assetCode, String person, String assetLatitude, String assetLongitude, Boolean isDelete,
// Boolean isActive, Integer createdBy, String cDate, String catName, String qrcodeimg, String assetimg) {
// this.assetId = assetId;
// this.departmentName = departmentName;
// this.position = position;
// this.paramId = paramId;
// this.assetName = assetName;
// this.assetCode = assetCode;
// this.person = person;
// this.assetLatitude = assetLatitude;
// this.assetLongitude = assetLongitude;
// this.isDelete = isDelete;
// this.isActive = isActive;
// this.createdBy = createdBy;
// this.cDate = cDate;
// this.catName = catName;
// this.qrcodeimg = qrcodeimg;
// this.assetimg = assetimg;
// }
//
// // Getters and setters
//
// // Additional getters and setters for catName, qrcodeimg, and assetimg
//
// public String getCatName() {
// return catName;
// }
//
// public void setCatName(String catName) {
// this.catName = catName;
// }
//
// public String getQrcodeimg() {
// return qrcodeimg;
// }
//
// public void setQrcodeimg(String qrcodeimg) {
// this.qrcodeimg = qrcodeimg;
// }
//
// public String getAssetimg() {
// return assetimg;
// }
//
// public void setAssetimg(String assetimg) {
// this.assetimg = assetimg;
// }
//}

495
src/main/java/com/feedback/it_asset/dto/ComplaintForm.java

@ -0,0 +1,495 @@
package com.feedback.it_asset.dto;
import org.springframework.stereotype.Component;
import com.fasterxml.jackson.annotation.JsonProperty;
@Component
public class ComplaintForm {
@JsonProperty("ORGID")
private String ORGID;
@JsonProperty("EMPID")
private String EMPID;
@JsonProperty("COMPMODE")
private String COMPMODE;
@JsonProperty("LOCID")
private String LOCID;
@JsonProperty("DEPTID")
private String DEPTID;
@JsonProperty("SECTID")
private String SECTID;
@JsonProperty("SECUSERID")
private String SECUSERID;
@JsonProperty("COMP_DATE")
private String COMP_DATE;
@JsonProperty("COMP_TIME")
private String COMP_TIME;
@JsonProperty("COMP_TYPE")
private String COMP_TYPE;
@JsonProperty("COMPLAINANTNAME")
private String COMPLAINANTNAME;
@JsonProperty("COMPLAINANTCELL")
private String COMPLAINANTCELL;
@JsonProperty("COMPLAINANT")
private String COMPLAINANT;
@JsonProperty("COMP_USER")
private String COMP_USER;
@JsonProperty("ATTACHMENT_DATA")
private String ATTACHMENT_DATA;
@JsonProperty("ATTACHMENT_FILENAME")
private String ATTACHMENT_FILENAME;
@JsonProperty("BroadBand_No")
private String BroadBand_No;
@JsonProperty("BroadBand_At")
private String BroadBand_At;
@JsonProperty("BroadBand_Loc")
private String BroadBand_Loc;
@JsonProperty("BroadBand_Issue")
private String BroadBand_Issue;
@JsonProperty("HardWare_AssetID")
private String HardWare_AssetID;
@JsonProperty("HardWare_ID")
private String HardWare_ID;
@JsonProperty("LeaseLine_From")
private String LeaseLine_From;
@JsonProperty("LeaseLine_Issue")
private String LeaseLine_Issue;
@JsonProperty("SW_Module")
private String SW_Module;
@JsonProperty("SW_AttData")
private String SW_AttData;
@JsonProperty("SW_FileName")
private String SW_FileName;
@JsonProperty("HWCatID")
private String HWCatID;
@JsonProperty("UserCode")
private String UserCode;
@JsonProperty("UserType")
private String UserType;
@JsonProperty("InOutboundFlag")
private String InOutboundFlag;
@JsonProperty("InOutboundLocType")
private String InOutboundLocType;
@JsonProperty("Outbound_LocID")
private String Outbound_LocID;
@JsonProperty("Lat")
private String Lat;
@JsonProperty("Long")
private String Long;
private Integer assetId;
private Integer fbId;
private String name;
private Integer cmqId;
private String feedbackAns;
private String paramName;
private String mobileNo;
private Integer ratingVal;
public String getMobileNo() {
return mobileNo;
}
public void setMobileNo(String mobileNo) {
this.mobileNo = mobileNo;
}
public Integer getRatingVal() {
return ratingVal;
}
public void setRatingVal(Integer ratingVal) {
this.ratingVal = ratingVal;
}
public String getParamName() {
return paramName;
}
public void setParamName(String paramName) {
this.paramName = paramName;
}
public Integer getFbId() {
return fbId;
}
public void setFbId(Integer fbId) {
this.fbId = fbId;
}
public Integer getAssetId() {
return assetId;
}
public void setAssetId(Integer assetId) {
this.assetId = assetId;
}
public ComplaintForm() {
}
public String getORGID() {
return ORGID;
}
public void setORGID(String ORGID) {
this.ORGID = ORGID;
}
public String getEMPID() {
return EMPID;
}
public void setEMPID(String EMPID) {
this.EMPID = EMPID;
}
public String getCOMPMODE() {
return COMPMODE;
}
public void setCOMPMODE(String COMPMODE) {
this.COMPMODE = COMPMODE;
}
public String getLOCID() {
return LOCID;
}
public void setLOCID(String LOCID) {
this.LOCID = LOCID;
}
public String getDEPTID() {
return DEPTID;
}
public void setDEPTID(String DEPTID) {
this.DEPTID = DEPTID;
}
public String getSECTID() {
return SECTID;
}
public void setSECTID(String SECTID) {
this.SECTID = SECTID;
}
public String getSECUSERID() {
return SECUSERID;
}
public void setSECUSERID(String SECUSERID) {
this.SECUSERID = SECUSERID;
}
public String getCOMP_DATE() {
return COMP_DATE;
}
public void setCOMP_DATE(String COMP_DATE) {
this.COMP_DATE = COMP_DATE;
}
public String getCOMP_TIME() {
return COMP_TIME;
}
public void setCOMP_TIME(String COMP_TIME) {
this.COMP_TIME = COMP_TIME;
}
public String getCOMP_TYPE() {
return COMP_TYPE;
}
public void setCOMP_TYPE(String COMP_TYPE) {
this.COMP_TYPE = COMP_TYPE;
}
public String getCOMPLAINANTNAME() {
return COMPLAINANTNAME;
}
public void setCOMPLAINANTNAME(String COMPLAINANTNAME) {
this.COMPLAINANTNAME = COMPLAINANTNAME;
}
public String getCOMPLAINANTCELL() {
return COMPLAINANTCELL;
}
public void setCOMPLAINANTCELL(String COMPLAINANTCELL) {
this.COMPLAINANTCELL = COMPLAINANTCELL;
}
public String getCOMPLAINANT() {
return COMPLAINANT;
}
public void setCOMPLAINANT(String COMPLAINANT) {
this.COMPLAINANT = COMPLAINANT;
}
public String getCOMP_USER() {
return COMP_USER;
}
public void setCOMP_USER(String COMP_USER) {
this.COMP_USER = COMP_USER;
}
public String getATTACHMENT_DATA() {
return ATTACHMENT_DATA;
}
public void setATTACHMENT_DATA(String ATTACHMENT_DATA) {
this.ATTACHMENT_DATA = ATTACHMENT_DATA;
}
public String getATTACHMENT_FILENAME() {
return ATTACHMENT_FILENAME;
}
public void setATTACHMENT_FILENAME(String ATTACHMENT_FILENAME) {
this.ATTACHMENT_FILENAME = ATTACHMENT_FILENAME;
}
public String getBroadBand_No() {
return BroadBand_No;
}
public void setBroadBand_No(String broadBand_No) {
this.BroadBand_No = broadBand_No;
}
public String getBroadBand_At() {
return BroadBand_At;
}
public void setBroadBand_At(String broadBand_At) {
this.BroadBand_At = broadBand_At;
}
public String getBroadBand_Loc() {
return BroadBand_Loc;
}
public void setBroadBand_Loc(String broadBand_Loc) {
this.BroadBand_Loc = broadBand_Loc;
}
public String getBroadBand_Issue() {
return BroadBand_Issue;
}
public void setBroadBand_Issue(String broadBand_Issue) {
this.BroadBand_Issue = broadBand_Issue;
}
public String getHardWare_AssetID() {
return HardWare_AssetID;
}
public void setHardWare_AssetID(String hardWare_AssetID) {
this.HardWare_AssetID = hardWare_AssetID;
}
public String getHardWare_ID() {
return HardWare_ID;
}
public void setHardWare_ID(String hardWare_ID) {
this.HardWare_ID = hardWare_ID;
}
public String getLeaseLine_From() {
return LeaseLine_From;
}
public void setLeaseLine_From(String leaseLine_From) {
this.LeaseLine_From = leaseLine_From;
}
public String getLeaseLine_Issue() {
return LeaseLine_Issue;
}
public void setLeaseLine_Issue(String leaseLine_Issue) {
this.LeaseLine_Issue = leaseLine_Issue;
}
public String getSW_Module() {
return SW_Module;
}
public void setSW_Module(String SW_Module) {
this.SW_Module = SW_Module;
}
public String getSW_AttData() {
return SW_AttData;
}
public void setSW_AttData(String SW_AttData) {
this.SW_AttData = SW_AttData;
}
public String getSW_FileName() {
return SW_FileName;
}
public void setSW_FileName(String SW_FileName) {
this.SW_FileName = SW_FileName;
}
public String getHWCatID() {
return HWCatID;
}
public void setHWCatID(String HWCatID) {
this.HWCatID = HWCatID;
}
public String getUserCode() {
return UserCode;
}
public void setUserCode(String userCode) {
this.UserCode = userCode;
}
public String getUserType() {
return UserType;
}
public void setUserType(String userType) {
this.UserType = userType;
}
public String getInOutboundFlag() {
return InOutboundFlag;
}
public void setInOutboundFlag(String inOutboundFlag) {
this.InOutboundFlag = inOutboundFlag;
}
public String getInOutboundLocType() {
return InOutboundLocType;
}
public void setInOutboundLocType(String inOutboundLocType) {
this.InOutboundLocType = inOutboundLocType;
}
public String getOutbound_LocID() {
return Outbound_LocID;
}
public void setOutbound_LocID(String outbound_LocID) {
this.Outbound_LocID = outbound_LocID;
}
public String getLat() {
return Lat;
}
public void setLat(String lat) {
this.Lat = lat;
}
public String getLong() {
return Long;
}
public void setLong(String aLong) {
this.Long = aLong;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Integer getCmqId() {
return cmqId;
}
public void setCmqId(Integer cmqId) {
this.cmqId = cmqId;
}
public String getFeedbackAns() {
return feedbackAns;
}
public void setFeedbackAns(String feedbackAns) {
this.feedbackAns = feedbackAns;
}
@Override
public String toString() {
return "{" +
"\"ORGID\":\"" + ORGID + "\"," +
"\"EMPID\":\"" + EMPID + "\"," +
"\"COMPMODE\":\"" + COMPMODE + "\"," +
"\"LOCID\":\"" + LOCID + "\"," +
"\"DEPTID\":\"" + DEPTID + "\"," +
"\"SECTID\":\"" + SECTID + "\"," +
"\"SECUSERID\":\"" + SECUSERID + "\"," +
"\"COMP_DATE\":\"" + COMP_DATE + "\"," +
"\"COMP_TIME\":\"" + COMP_TIME + "\"," +
"\"COMP_TYPE\":\"" + COMP_TYPE + "\"," +
"\"COMPLAINANTNAME\":\"" + COMPLAINANTNAME + "\"," +
"\"COMPLAINANTCELL\":\"" + COMPLAINANTCELL + "\"," +
"\"COMPLAINANT\":\"" + COMPLAINANT + "\"," +
"\"COMP_USER\":\"" + COMP_USER + "\"," +
"\"ATTACHMENT_DATA\":\"" + ATTACHMENT_DATA + "\"," +
"\"ATTACHMENT_FILENAME\":\"" + ATTACHMENT_FILENAME + "\"," +
"\"BroadBand_No\":\"" + BroadBand_No + "\"," +
"\"BroadBand_At\":\"" + BroadBand_At + "\"," +
"\"BroadBand_Loc\":\"" + BroadBand_Loc + "\"," +
"\"BroadBand_Issue\":\"" + BroadBand_Issue + "\"," +
"\"HardWare_AssetID\":\"" + HardWare_AssetID + "\"," +
"\"HardWare_ID\":\"" + HardWare_ID + "\"," +
"\"LeaseLine_From\":\"" + LeaseLine_From + "\"," +
"\"LeaseLine_Issue\":\"" + LeaseLine_Issue + "\"," +
"\"SW_Module\":\"" + SW_Module + "\"," +
"\"SW_AttData\":\"" + SW_AttData + "\"," +
"\"SW_FileName\":\"" + SW_FileName + "\"," +
"\"HWCatID\":\"" + HWCatID + "\"," +
"\"UserCode\":\"" + UserCode + "\"," +
"\"UserType\":\"" + UserType + "\"," +
"\"InOutboundFlag\":\"" + InOutboundFlag + "\"," +
"\"InOutboundLocType\":\"" + InOutboundLocType + "\"," +
"\"Outbound_LocID\":\"" + Outbound_LocID + "\"," +
"\"Lat\":\"" + Lat + "\"," +
"\"Long\":\"" + Long + "\"" +
'}';
}
public Object getId() {
// TODO Auto-generated method stub
return null;
}
}

31
src/main/java/com/feedback/it_asset/dto/GccAssetDetailsDto.java

@ -0,0 +1,31 @@
package com.feedback.it_asset.dto;
import org.springframework.beans.factory.annotation.Autowired;
import com.feedback.it_asset.entity.GccAssetDetails;
import com.feedback.it_asset.repository.GccFileDataRep;
public class GccAssetDetailsDto extends GccAssetDetails {
@Autowired
GccFileDataRep gccFileDataRep;
private String qrcodeimg;
private String assetimg;
public String getQrcodeimg() {
return qrcodeimg;
}
public void setQrcodeimg(String qrcodeimg) {
this.qrcodeimg = qrcodeimg;
}
public String getAssetimg() {
return assetimg;
}
public void setAssetimg(String assetimg) {
this.assetimg = assetimg;
}
}

92
src/main/java/com/feedback/it_asset/entity/AssetCategory.java

@ -0,0 +1,92 @@
package com.feedback.it_asset.entity;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
@Entity
@Table(name = "asset_category")
@JsonIgnoreProperties({ "hibernateLazyInitializer", "handler"})
public class AssetCategory {
@Id
@GeneratedValue(strategy= GenerationType.IDENTITY)
@Column(name = "cat_id",nullable = true)
private Integer cId;
@Column(name = "name",nullable = true)
private String catName;
@Column(name = "isdelete",nullable = false, columnDefinition = "Boolean default false")
private Boolean isDelete;
@Column(name = "isactive",nullable = false, columnDefinition = "Boolean default true")
private Boolean isActive;
@Column(name = "created_by",nullable = false, columnDefinition = "Integer Default 0")
private Integer createdBy;
@Column(name = "cdate",nullable = false, columnDefinition = "DATETIME DEFAULT CURRENT_TIMESTAMP")
private String cDate;
public AssetCategory() {
}
public AssetCategory(Integer cId, String catName, Boolean isDelete, Boolean isActive, Integer createdBy, String cDate) {
this.cId = cId;
this.catName = catName;
this.isDelete = isDelete;
this.isActive = isActive;
this.createdBy = createdBy;
this.cDate = cDate;
}
public Integer getcId() {
return cId;
}
public void setcId(Integer cId) {
this.cId = cId;
}
public String getCatName() {
return catName;
}
public void setCatName(String catName) {
this.catName = catName;
}
public Boolean getIsDelete() {
return isDelete;
}
public void setIsDelete(Boolean delete) {
isDelete = delete;
}
public Boolean getIsActive() {
return isActive;
}
public void setIsActive(Boolean active) {
isActive = active;
}
public Integer getCreatedBy() {
return createdBy;
}
public void setCreatedBy(Integer createdBy) {
this.createdBy = createdBy;
}
public String getcDate() {
return cDate;
}
public void setcDate(String cDate) {
this.cDate = cDate;
}
}

164
src/main/java/com/feedback/it_asset/entity/AssetCategoryQuestions.java

@ -0,0 +1,164 @@
package com.feedback.it_asset.entity;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.Table;
@Entity
@JsonIgnoreProperties({ "hibernateLazyInitializer", "handler"})
@Table(name = "category_master_question")
public class AssetCategoryQuestions {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "cmq_id", nullable = true)
private Integer cmqId;
@ManyToOne
@JoinColumn(name="cat_id", nullable = true)
private AssetCategory assetCategory;
@Column(name = "eng_question", nullable = true)
private String engQuestion;
@Column(name = "tamil_question", nullable = true)
private String tamilQuestion;
@Column(name = "com_group_id", nullable = true)
private String comGroupId;
@Column(name = "com_subgroup_id", nullable = true)
private String comSubGroupId;
@Column(name = "com_subgroup_name", nullable = true)
private String comSubGroupName;
@Column(name = "qtype", nullable = false, columnDefinition = "VARCHAR(255) DEFAULT '1'")
private String qType;
@Column(name = "isactive", nullable = false, columnDefinition = "BOOLEAN DEFAULT true")
private boolean isActive;
@Column(name = "isdelete", nullable = false, columnDefinition = "BOOLEAN DEFAULT false")
private boolean isDelete;
@Column(name = "created_by", nullable = false, columnDefinition = "INTEGER DEFAULT 0")
private Integer createdBy;
@Column(name = "cdate", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
private String cDate;
public AssetCategoryQuestions(){
}
public Integer getCmqId() {
return cmqId;
}
public void setCmqId(Integer cmqId) {
this.cmqId = cmqId;
}
/*
public Integer getCatId() {
return catId;
}
public void setCatId(Integer catId) {
this.catId = catId;
}
*/
public AssetCategory getAssetCategory() {
return assetCategory;
}
public void setAssetCategory(AssetCategory assetCategory) {
this.assetCategory = assetCategory;
}
public String getEngQuestion() {
return engQuestion;
}
public void setEngQuestion(String engQuestion) {
this.engQuestion = engQuestion;
}
public String getTamilQuestion() {
return tamilQuestion;
}
public void setTamilQuestion(String tamilQuestion) {
this.tamilQuestion = tamilQuestion;
}
public String getqType() {
return qType;
}
public void setqType(String qType) {
this.qType = qType;
}
public Boolean getIsActive() {
return isActive;
}
public void setIsActive(Boolean active) {
isActive = active;
}
public Boolean getIsDelete() {
return isDelete;
}
public void setIsDelete(Boolean delete) {
isDelete = delete;
}
public Integer getCreatedBy() {
return createdBy;
}
public void setCreatedBy(Integer createdBy) {
this.createdBy = createdBy;
}
public String getcDate() {
return cDate;
}
public void setcDate(String cDate) {
this.cDate = cDate;
}
public String getComGroupId() {
return comGroupId;
}
public void setComGroupId(String comGroupId) {
this.comGroupId = comGroupId;
}
public String getComSubGroupId() {
return comSubGroupId;
}
public void setComSubGroupId(String comSubGroupId) {
this.comSubGroupId = comSubGroupId;
}
public String getComSubGroupName() {
return comSubGroupName;
}
public void setComSubGroupName(String comSubGroupName) {
this.comSubGroupName = comSubGroupName;
}
}

104
src/main/java/com/feedback/it_asset/entity/AssetParameter.java

@ -0,0 +1,104 @@
package com.feedback.it_asset.entity;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.Table;
@Entity
@JsonIgnoreProperties({ "hibernateLazyInitializer", "handler"})
@Table(name="asset_parameter")
public class AssetParameter {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "param_id",nullable = false)
private Integer paramId;
@ManyToOne
@JoinColumn(name="cat_id", nullable = false,columnDefinition = "integer Default 0")
private AssetCategory assetCategory;
@Column(name = "name",nullable = false)
private String paramName;
@Column(name = "isdelete",nullable = false, columnDefinition = "Boolean default false")
private Boolean isDelete;
@Column(name = "isactive",nullable = false, columnDefinition = "Boolean default true")
private Boolean isActive;
@Column(name = "created_by",nullable = false, columnDefinition = "Integer Default 0")
private Integer createdBy;
@Column(name = "cdate",nullable = false, columnDefinition = "DATETIME DEFAULT CURRENT_TIMESTAMP")
private String cDate;
public AssetParameter() {
}
public AssetParameter(Integer paramId, AssetCategory assetCategory, String paramName, Boolean isDelete, Boolean isActive, Integer createdBy, String cDate) {
this.paramId = paramId;
this.assetCategory = assetCategory;
this.paramName = paramName;
this.isDelete = isDelete;
this.isActive = isActive;
this.createdBy = createdBy;
this.cDate = cDate;
}
public Integer getParamId() {
return paramId;
}
public void setParamId(Integer paramId) {
this.paramId = paramId;
}
public AssetCategory getAssetCategory() {
return assetCategory;
}
public void setAssetCategory(AssetCategory assetCategory) {
this.assetCategory = assetCategory;
}
public String getParamName() {
return paramName;
}
public void setParamName(String paramName) {
this.paramName = paramName;
}
public Boolean getIsDelete() {
return isDelete;
}
public void setIsDelete(Boolean isdelete) {
isDelete = isdelete;
}
public Boolean getIsActive() {
return isActive;
}
public void setIsActive(Boolean isactive) {
isActive = isactive;
}
public Integer getCreatedBy() {
return createdBy;
}
public void setCreatedBy(Integer createdBy) {
this.createdBy = createdBy;
}
public String getcDate() {
return cDate;
}
public void setcDate(String cDate) {
this.cDate = cDate;
}
}

138
src/main/java/com/feedback/it_asset/entity/AssetParameterQuestions.java

@ -0,0 +1,138 @@
package com.feedback.it_asset.entity;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import jakarta.persistence.*;
@Entity
@JsonIgnoreProperties({ "hibernateLazyInitializer", "handler"})
@Table(name = "asset_parameter_question")
public class AssetParameterQuestions {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "apq_id", nullable = false)
private Integer apqId;
@ManyToOne
@JoinColumn(name="param_id", nullable = false,columnDefinition = "integer Default 0")
private AssetParameter assetParameter;
@Column(name = "eng_question",nullable = false)
private String engQuestion;
@Column(name = "tamil_question",nullable = false)
private String tamilQuestion;
@Column(name = "qtype",nullable = false,columnDefinition = "VARCHAR(255) Default '1'")
private String qType;
@Column(name = "isactive",nullable = false,columnDefinition = "Boolean Default 1")
private Boolean isActive;
@Column(name = "isdelete",nullable = false,columnDefinition = "Boolean Default 0")
private Boolean isDelete;
@Column(name = "created_by",nullable = false,columnDefinition = "Integer Default 0")
private Integer createdBy;
@Column(name = "cdate",nullable = false,columnDefinition = "DATETIME DEFAULT CURRENT_TIMESTAMP")
private String cDate;
@Column(name = "com_group_id", nullable = true)
private String comGroupId;
@Column(name = "com_subgroup_id", nullable = true)
private String comSubGroupId;
@Column(name = "com_subgroup_name", nullable = true)
private String comSubGroupName;
public AssetParameterQuestions(){
}
public Integer getApqId() {
return apqId;
}
public void setApqId(Integer apqId) {
this.apqId = apqId;
}
public AssetParameter getAssetParameter() {
return assetParameter;
}
public void setAssetParameter(AssetParameter assetParameter) {
this.assetParameter = assetParameter;
}
public String getEngQuestion() {
return engQuestion;
}
public void setEngQuestion(String engQuestion) {
this.engQuestion = engQuestion;
}
public String getTamilQuestion() {
return tamilQuestion;
}
public void setTamilQuestion(String tamilQuestion) {
this.tamilQuestion = tamilQuestion;
}
public String getqType() {
return qType;
}
public void setqType(String qType) {
this.qType = qType;
}
public Boolean getIsActive() {
return isActive;
}
public void setIsActive(Boolean active) {
isActive = active;
}
public Boolean getIsDelete() {
return isDelete;
}
public void setIsDelete(Boolean delete) {
isDelete = delete;
}
public Integer getCreatedBy() {
return createdBy;
}
public void setCreatedBy(Integer createdBy) {
this.createdBy = createdBy;
}
public String getcDate() {
return cDate;
}
public void setcDate(String cDate) {
this.cDate = cDate;
}
public String getComGroupId() {
return comGroupId;
}
public void setComGroupId(String comGroupId) {
this.comGroupId = comGroupId;
}
public String getComSubGroupId() {
return comSubGroupId;
}
public void setComSubGroupId(String comSubGroupId) {
this.comSubGroupId = comSubGroupId;
}
public String getComSubGroupName() {
return comSubGroupName;
}
public void setComSubGroupName(String comSubGroupName) {
this.comSubGroupName = comSubGroupName;
}
}

213
src/main/java/com/feedback/it_asset/entity/GccAssetDetails.java

@ -0,0 +1,213 @@
package com.feedback.it_asset.entity;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.Table;
@Entity
@JsonIgnoreProperties({ "hibernateLazyInitializer", "handler"})
@Table(name = "gcc_asset_details")
public class GccAssetDetails {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "asset_id")
private Integer assetId;
@ManyToOne
@JoinColumn(name="cat_id")
private AssetCategory assetCategory;
@Column(name="department_name")
private String departmentName;
@Column(name="position")
private String position;
@Column(name="param_id")
private String paramId;
@Column(name = "asset_name")
private String assetName;
@Column(name = "asset_code", nullable = false)
private String assetCode;
@Column(name = "assign_person", nullable = false)
private String person;
@Column(name = "asset_latitude", nullable = true)
private String assetLatitude;
@Column(name = "asset_longitude", nullable = true)
private String assetLongitude;
@Column(name = "maintenance_type")
private String maintenanceType;//
@Column(name = "asset_Type")
private String assetType;//
@Column(name = "hw_Slno")
private String hwSlno;
@Column(name = "isdelete", nullable = false, columnDefinition = "boolean default false")
private Boolean isDelete = false;
@Column(name = "isactive", nullable = false, columnDefinition = "boolean default true")
private Boolean isActive = true;
@Column(name = "created_by", nullable = false, columnDefinition = "integer default 0")
private Integer createdBy = 0;
@Column(name = "cdate", nullable = false, columnDefinition = "datetime default current_timestamp")
private String cDate;
public Integer getAssetId() {
return assetId;
}
public void setAssetId(Integer assetId) {
this.assetId = assetId;
}
public AssetCategory getAssetCategory() {
return assetCategory;
}
public void setAssetCategory(AssetCategory assetCategory) {
this.assetCategory = assetCategory;
}
public String getDepartmentName() {
return departmentName;
}
public void setDepartmentName(String departmentName) {
this.departmentName = departmentName;
}
public String getPosition() {
return position;
}
public void setPosition(String position) {
this.position = position;
}
public String getPerson() {
return person;
}
public void setPerson(String person) {
this.person = person;
}
public String getParamId() {
return paramId;
}
public void setParamId(String paramId) {
this.paramId = paramId;
}
public String getAssetName() {
return assetName;
}
public void setAssetName(String assetName) {
this.assetName = assetName;
}
public String getAssetCode() {
return assetCode;
}
public void setAssetCode(String assetCode) {
this.assetCode = assetCode;
}
public String getAssetLatitude() {
return assetLatitude;
}
public void setAssetLatitude(String assetLatitude) {
this.assetLatitude = assetLatitude;
}
public String getAssetLongitude() {
return assetLongitude;
}
public void setAssetLongitude(String assetLongitude) {
this.assetLongitude = assetLongitude;
}
public Boolean getIsDelete() {
return isDelete;
}
public void setIsDelete(Boolean delete) {
isDelete = delete;
}
public Boolean getIsActive() {
return isActive;
}
public void setIsActive(Boolean active) {
isActive = active;
}
public Integer getCreatedBy() {
return createdBy;
}
public void setCreatedBy(Integer createdBy) {
this.createdBy = createdBy;
}
public String getcDate() {
return cDate;
}
public void setcDate(String cDate) {
this.cDate = cDate;
}
public String getMaintenanceType() {
return maintenanceType;
}
public void setMaintenanceType(String maintenanceType) {
this.maintenanceType = maintenanceType;
}
public String getAssetType() {
return assetType;
}
public void setAssetType(String assetType) {
this.assetType = assetType;
}
public String getHwSlno() {
return hwSlno;
}
public void setHwSlno(String hwSlno) {
this.hwSlno = hwSlno;
}
}

129
src/main/java/com/feedback/it_asset/entity/GccFeedback.java

@ -0,0 +1,129 @@
package com.feedback.it_asset.entity;
import java.sql.Blob;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.Lob;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.Table;
@Entity
@JsonIgnoreProperties({ "hibernateLazyInitializer", "handler"})
@Table(name = "gcc_feedback")
public class GccFeedback {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "feedback_id",nullable = false)
private Integer fbId;
@ManyToOne
@JoinColumn(name="asset_id",columnDefinition = "integer Default NULL")
private GccAssetDetails gccAssetDetails;
@Column(name = "name",nullable = false)
private String paramName;
@Column(name = "mobile",nullable = false)
private String mobileNo;
@Column(name = "rating",nullable = false, columnDefinition = "Integer Default 0")
private Integer ratingVal;
@Lob
private Blob file;
@Column(name = "isdelete",nullable = false, columnDefinition = "Boolean default false")
private Boolean isDelete;
@Column(name = "isactive",nullable = false, columnDefinition = "Boolean default true")
private Boolean isActive;
@Column(name = "created_by",nullable = false, columnDefinition = "Integer Default 0")
private Integer createdBy;
@Column(name = "cdate",nullable = false, columnDefinition = "DATETIME DEFAULT CURRENT_TIMESTAMP")
private String cDate;
public GccFeedback() {
}
public Integer getFbId() {
return fbId;
}
public void setFbId(Integer fbId) {
this.fbId = fbId;
}
public GccAssetDetails getGccAssetDetails() {
return gccAssetDetails;
}
public void setGccAssetDetails(GccAssetDetails gccAssetDetails) {
this.gccAssetDetails = gccAssetDetails;
}
public String getParamName() {
return paramName;
}
public void setParamName(String paramName) {
this.paramName = paramName;
}
public String getMobileNo() {
return mobileNo;
}
public void setMobileNo(String mobileNo) {
this.mobileNo = mobileNo;
}
public Integer getRatingVal() {
return ratingVal;
}
public void setRatingVal(Integer ratingVal) {
this.ratingVal = ratingVal;
}
public Blob getFile() {
return file;
}
public void setFile(Blob file) {
this.file = file;
}
public Boolean getDelete() {
return isDelete;
}
public void setDelete(Boolean delete) {
isDelete = delete;
}
public Boolean getActive() {
return isActive;
}
public void setActive(Boolean active) {
isActive = active;
}
public Integer getCreatedBy() {
return createdBy;
}
public void setCreatedBy(Integer createdBy) {
this.createdBy = createdBy;
}
public String getcDate() {
return cDate;
}
public void setcDate(String cDate) {
this.cDate = cDate;
}
}

118
src/main/java/com/feedback/it_asset/entity/GccFeedbackData.java

@ -0,0 +1,118 @@
package com.feedback.it_asset.entity;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.Table;
@Entity
@JsonIgnoreProperties({ "hibernateLazyInitializer", "handler"})
@Table(name = "gcc_feedback_data")
public class GccFeedbackData {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "feedbackdata_id",nullable = false)
private Integer fbdId;
@ManyToOne
@JoinColumn(name="feedback_id")
private GccFeedback gccFeedback;
@ManyToOne
@JoinColumn(name="cmq_id")
private AssetCategoryQuestions assetCategoryQuestions;
@ManyToOne
@JoinColumn(name="apq_id")
private AssetParameterQuestions assetParameterQuestions;
@Column(name = "feedback")
private String feedbackAns;
@Column(name = "complaint_no")
private String complaintNo;
@Column(name = "isdelete",nullable = false, columnDefinition = "Boolean default false")
private Boolean isDelete;
@Column(name = "isactive",nullable = false, columnDefinition = "Boolean default true")
private Boolean isActive;
@Column(name = "cdate",nullable = false, columnDefinition = "DATETIME DEFAULT CURRENT_TIMESTAMP")
private String cDate;
public GccFeedbackData() {
}
public Integer getFbdId() {
return fbdId;
}
public void setFbdId(Integer fbdId) {
this.fbdId = fbdId;
}
public GccFeedback getGccFeedback() {
return gccFeedback;
}
public void setGccFeedback(GccFeedback gccFeedback) {
this.gccFeedback = gccFeedback;
}
public AssetCategoryQuestions getAssetCategoryQuestions() {
return assetCategoryQuestions;
}
public void setAssetCategoryQuestions(AssetCategoryQuestions assetCategoryQuestions) {
this.assetCategoryQuestions = assetCategoryQuestions;
}
public AssetParameterQuestions getAssetParameterQuestions() {
return assetParameterQuestions;
}
public void setAssetParameterQuestions(AssetParameterQuestions assetParameterQuestions) {
this.assetParameterQuestions = assetParameterQuestions;
}
public String getFeedbackAns() {
return feedbackAns;
}
public void setFeedbackAns(String feedbackAns) {
this.feedbackAns = feedbackAns;
}
public String getComplaintNo() {
return complaintNo;
}
public void setComplaintNo(String complaintNo) {
this.complaintNo = complaintNo;
}
public Boolean getDelete() {
return isDelete;
}
public void setDelete(Boolean delete) {
isDelete = delete;
}
public Boolean getActive() {
return isActive;
}
public void setActive(Boolean active) {
isActive = active;
}
public String getcDate() {
return cDate;
}
public void setcDate(String cDate) {
this.cDate = cDate;
}
}

118
src/main/java/com/feedback/it_asset/entity/GccFileData.java

@ -0,0 +1,118 @@
package com.feedback.it_asset.entity;
import java.sql.Blob;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.Lob;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.Table;
@Entity
@JsonIgnoreProperties({ "hibernateLazyInitializer", "handler"})
@Table(name = "gcc_file_Data")
public class GccFileData {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "file_id",nullable = false)
private Integer fileId;
@ManyToOne
@JoinColumn(name="asset_id", nullable = false,columnDefinition = "integer Default 0")
private GccAssetDetails gccAssetDetails;
@Column(name = "fileName", nullable = false)
private String fileName;
@Lob
private Blob data;
@Column(name = "isdelete", nullable = false, columnDefinition = "boolean default false")
private Boolean isdelete = false;
@Column(name = "isactive", nullable = false, columnDefinition = "boolean default true")
private Boolean isactive = true;
@Column(name = "created_by", nullable = false, columnDefinition = "integer default 0")
private Integer createdBy = 0;
@Column(name = "cdate", nullable = false, columnDefinition = "datetime default current_timestamp")
private java.time.LocalDateTime cDate;
public GccFileData() {
}
public Integer getFileId() {
return fileId;
}
public void setFileId(Integer fileId) {
this.fileId = fileId;
}
public GccAssetDetails getGccAssetDetails() {
return gccAssetDetails;
}
public void setGccAssetDetails(GccAssetDetails gccAssetDetails) {
this.gccAssetDetails = gccAssetDetails;
}
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
public Blob getData() {
return data;
}
public void setData(Blob data) {
this.data = data;
}
public Boolean getIsdelete() {
return isdelete;
}
public void setIsdelete(Boolean isdelete) {
this.isdelete = isdelete;
}
public Boolean getIsactive() {
return isactive;
}
public void setIsactive(Boolean isactive) {
this.isactive = isactive;
}
public Integer getCreatedBy() {
return createdBy;
}
public void setCreatedBy(Integer createdBy) {
this.createdBy = createdBy;
}
public java.time.LocalDateTime getcDate() {
return cDate;
}
public void setcDate(java.time.LocalDateTime cDate) {
this.cDate = cDate;
}
}

43
src/main/java/com/feedback/it_asset/entity/User.java

@ -0,0 +1,43 @@
package com.feedback.it_asset.entity;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
@Entity
public class User {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int id;
private String username;
private String password;
private String usertype;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getUsertype() {
return usertype;
}
public void setUsertype(String usertype) {
this.usertype = usertype;
}
}

37
src/main/java/com/feedback/it_asset/repository/AssetCategoryQuestionsRep.java

@ -0,0 +1,37 @@
package com.feedback.it_asset.repository;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import com.feedback.it_asset.entity.AssetCategoryQuestions;
import jakarta.transaction.Transactional;
@Repository
@Transactional
public interface AssetCategoryQuestionsRep extends JpaRepository<AssetCategoryQuestions, Integer> {
@Query(value = "SELECT LAST_INSERT_ID()", nativeQuery = true)
Long getLastInsertedId();
@Query(value = "SELECT * FROM `category_master_question` WHERE `isdelete`=0",nativeQuery = true)
List<AssetCategoryQuestions> showQuestionsAll();
@Query(value = "SELECT * FROM `category_master_question` WHERE `cmq_id`=:cmqid",nativeQuery = true)
List<AssetCategoryQuestions> findByQuestionId(@Param("cmqid") int cmqId);
@Query(value = "SELECT * FROM `category_master_question` WHERE `cat_id`=:cat_id",nativeQuery = true)
List<AssetCategoryQuestions> findByCatId(@Param("cat_id") int cat_id);
@Modifying
@Query(value ="insert into `category_master_question` (`cat_id`,`eng_question`,`tamil_question`,`isactive`) values (:cat_id, :eng_question, :tamil_question, :isactive)", nativeQuery = true)
void insertQuestionCategory(@Param("cat_id") Integer cat_id, @Param("eng_question") String engQuestion, @Param("tamil_question") String tamilQuestion, @Param("isactive") boolean isActive);
@Modifying
@Query(value ="UPDATE `category_master_question` SET `cat_id`=:cat_id,`eng_question`=:eng_question,`tamil_question`=:tamil_question,`isactive`=:isactive WHERE `cmq_id`=:cmq_id LIMIT 1", nativeQuery = true)
void updateQuestionCategory(@Param("cmq_id") Integer cmqId, @Param("cat_id") Integer cat_id, @Param("eng_question") String engQuestion, @Param("tamil_question") String tamilQuestion, @Param("isactive") boolean isActive);
@Modifying
@Query(value ="UPDATE `category_master_question` SET `com_group_id`=:comGroup, `com_subgroup_id`=:comSubGroup, `com_subgroup_name`=:comSubGroupName WHERE `cmq_id`=:cmq_id LIMIT 1", nativeQuery = true)
void updateComplaint(@Param("cmq_id") Integer cmqId, @Param("comGroup") String comGroup, @Param("comSubGroup") String comSubGroup, @Param("comSubGroupName") String comSubGroupName);
@Modifying
@Query(value="UPDATE `category_master_question` SET `isdelete`=1 WHERE `cmq_id`=:cmq_id LIMIT 1", nativeQuery = true)
int deleteQuestionCategory(@Param("cmq_id") Integer cmqId);
}

37
src/main/java/com/feedback/it_asset/repository/AssetCategoryRep.java

@ -0,0 +1,37 @@
package com.feedback.it_asset.repository;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import com.feedback.it_asset.entity.AssetCategory;
import jakarta.transaction.Transactional;
@Repository
@Transactional
public interface AssetCategoryRep extends JpaRepository<AssetCategory, Integer>{
@Query(value = "SELECT LAST_INSERT_ID()", nativeQuery = true)
Long getLastInsertedId();
@Query(value = "SELECT * FROM `asset_category` WHERE `isdelete`=0",nativeQuery = true)
List<AssetCategory> showAll();
@Query(value = "SELECT * FROM `asset_category` WHERE `isdelete`=0 AND LOWER(`catName`) LIKE LOWER(CONCAT('%', :searchTerm, '%'))", nativeQuery = true)
List<AssetCategory> showAll(@Param("searchTerm") String searchTerm);
@Query(value = "SELECT * FROM `asset_category` WHERE `cat_id`=:catid",nativeQuery = true)
List<AssetCategory> findByCategoryId(@Param("catid") int cId);
@Modifying
@Query(value ="INSERT INTO `asset_category` (`name`,`isactive`) VALUES (:name, :isactive)", nativeQuery = true)
void insertCategory(@Param("name") String catName,@Param("isactive") boolean isActive);
@Modifying
@Query(value ="UPDATE `asset_category` SET `name`= :name, `isactive`= :isactive WHERE `cat_id`=:catid LIMIT 1", nativeQuery = true)
int updateCategory(@Param("catid") int cId,@Param("name") String catName,@Param("isactive") boolean isActive);
@Modifying
@Query(value="UPDATE `asset_category` SET `isdelete`=1 WHERE `cat_id`=:catid LIMIT 1", nativeQuery = true)
int deleteCategory(@Param("catid") int cId);
}

42
src/main/java/com/feedback/it_asset/repository/AssetParameterQuestionsRep.java

@ -0,0 +1,42 @@
package com.feedback.it_asset.repository;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import com.feedback.it_asset.entity.AssetParameterQuestions;
import jakarta.transaction.Transactional;
@Repository
@Transactional
public interface AssetParameterQuestionsRep extends JpaRepository<AssetParameterQuestions, Integer>{
@Query(value = "SELECT LAST_INSERT_ID()", nativeQuery = true)
Long getLastInsertedId();
@Query(value = "SELECT * FROM `asset_parameter_question` WHERE `isdelete`=0",nativeQuery = true)
List<AssetParameterQuestions> showQuestionsAll();
@Query(value = "SELECT * FROM `asset_parameter_question` WHERE `apq_id`=:apqid",nativeQuery = true)
List<AssetParameterQuestions> findByQuestionId(@Param("apqid") int apqId);
@Query(value = "SELECT * FROM `asset_parameter_question` WHERE `param_id` IN (:paramid)",nativeQuery = true)
List<AssetParameterQuestions> findByParameterId(@Param("paramid") List<Integer> paramId);
@Modifying
@Query(value ="insert into `asset_parameter_question` (`param_id`,`eng_question`,`tamil_question`,`isactive`) values (:param_id, :eng_question, :tamil_question, :isactive)", nativeQuery = true)
Integer insertParameterQuestion(@Param("param_id") Integer paramId, @Param("eng_question") String engQuestion, @Param("tamil_question") String tamilQuestion, @Param("isactive") boolean isActive);
@Modifying
@Query(value ="UPDATE `asset_parameter_question` SET `param_id`=:param_id,`eng_question`=:eng_question,`tamil_question`=:tamil_question,`isactive`=:isactive WHERE `apq_id`=:apq_id LIMIT 1", nativeQuery = true)
Integer updateParameterQuestion(@Param("apq_id") Integer apqId, @Param("param_id") Integer paramId, @Param("eng_question") String engQuestion, @Param("tamil_question") String tamilQuestion, @Param("isactive") boolean isActive);
@Modifying
@Query(value ="UPDATE `asset_parameter_question` SET `com_group_id`=:comGroup, `com_subgroup_id`=:comSubGroup, `com_subgroup_name`=:comSubGroupName WHERE `apq_id`=:apq_id LIMIT 1", nativeQuery = true)
void updateComplaint(@Param("apq_id") Integer apqId, @Param("comGroup") String comGroup, @Param("comSubGroup") String comSubGroup, @Param("comSubGroupName") String comSubGroupName);
@Modifying
@Query(value="UPDATE `asset_parameter_question` SET `isdelete`=1 WHERE `apq_id`=:apq_id LIMIT 1", nativeQuery = true)
int deleteParameterQuestion(@Param("apq_id") Integer apqId);
}

40
src/main/java/com/feedback/it_asset/repository/AssetParameterRep.java

@ -0,0 +1,40 @@
package com.feedback.it_asset.repository;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import com.feedback.it_asset.entity.AssetParameter;
import jakarta.transaction.Transactional;
@Repository
@Transactional
public interface AssetParameterRep extends JpaRepository<AssetParameter, Integer>{
@Query(value = "SELECT LAST_INSERT_ID()", nativeQuery = true)
Long getLastInsertedId();
@Query(value = "SELECT * FROM `asset_parameter` WHERE `isdelete`=0",nativeQuery = true)
List<AssetParameter> showAll();
@Query(value = "SELECT * FROM `asset_parameter` WHERE `param_id`=:paramid",nativeQuery = true)
List<AssetParameter> findByParameterId(@Param("paramid") int paramId);
@Query(value = "SELECT * FROM `asset_parameter` WHERE `cat_id`=:catid",nativeQuery = true)
List<AssetParameter> findByCategoryId(@Param("catid") int catid);
@Modifying
@Query(value ="insert into `asset_parameter` (`cat_id`,`name`,`isactive`) values (:cat_id, :name, :isactive)", nativeQuery = true)
void insertParametert(@Param("cat_id") Integer catId, @Param("name") String paramName, @Param("isactive") boolean isActive);
@Modifying
@Query(value="UPDATE `asset_parameter` SET `cat_id`=:cat_id,`name`=:name,`isactive`=:isactive WHERE `param_id`=:paramid LIMIT 1", nativeQuery = true)
int updateParameter(@Param("paramid") Integer paramId,@Param("cat_id") Integer catId, @Param("name") String paramName, @Param("isactive") boolean isActive);
@Modifying
@Query(value = "UPDATE `asset_parameter` SET `isdelete`=1 WHERE `param_id`=:paramid LIMIT 1", nativeQuery = true)
int deleteParameter(@Param("paramid") Integer paramId);
}

86
src/main/java/com/feedback/it_asset/repository/GccAssetDetailsRep.java

@ -0,0 +1,86 @@
package com.feedback.it_asset.repository;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import com.feedback.it_asset.entity.GccAssetDetails;
import jakarta.transaction.Transactional;
@Repository
@Transactional
public interface GccAssetDetailsRep extends JpaRepository<GccAssetDetails, Integer>{
@Query(value = "SELECT LAST_INSERT_ID()", nativeQuery = true)
Integer getLastInsertedId();
@Query(value = "SELECT COUNT(*) FROM `gcc_asset_details` WHERE `isdelete`=0",nativeQuery = true)
long countActiveAssets();
@Query(value = "SELECT * FROM `gcc_asset_details` WHERE `isdelete`=0",nativeQuery = true)
List<GccAssetDetails> showAll();
@Query(value = "SELECT * FROM `gcc_asset_details` WHERE `asset_id`=:assetId",nativeQuery = true)
List<GccAssetDetails> findByAssetId(@Param("assetId") int assetId);
@Modifying
@Query(value = "INSERT INTO `gcc_asset_details`(`asset_latitude`, `asset_longitude`, `asset_name`, `asset_code`, `cat_id`, `department_name`, `position`, `assign_person`, `param_id`, `maintenance_type`, `asset_type`, `hw_slno`) " +
"VALUES (:asset_latitude, :asset_longitude, :asset_name, :asset_code, :cat_id, :department_name, :position, :assign_person, :param_id, :maintenance_type, :asset_type, :hw_slno)", nativeQuery = true)
Integer insertAsset(
@Param("asset_latitude") String assetLatitude,
@Param("asset_longitude") String assetLongitude,
@Param("asset_name") String assetName,
@Param("asset_code") String assetCode,
@Param("cat_id") int catId,
@Param("department_name") String departmentName,
@Param("position") String position,
@Param("assign_person") String assignPerson,
@Param("param_id") String paramId,
@Param("maintenance_type") String maintenanceType,
@Param("asset_type") String assetType,
@Param("hw_slno") String hwSlno);
// @Modifying
// @Query(value ="INSERT INTO `gcc_asset_details`(`asset_latitude`, `asset_longitude`, `asset_name`, `asset_code`, `cat_id`, `department_name`, `position`, `assign_person`, `param_id`) VALUES (:asset_latitude,:asset_longitude,:asset_name,:asset_code,:cat_id,:department_name,:position,:assign_person,:param_id)", nativeQuery = true)
// Integer insertAsset(@Param("asset_latitude") String assetLatitude, @Param("asset_longitude") String assetLongitude, @Param("asset_name") String assetName, @Param("asset_code") String assetCode, @Param("cat_id") int catId, @Param("department_name") String departmentName, @Param("position") String position, @Param("assign_person") String person, @Param("param_id") String paramId);
// @Modifying
@Query(value ="INSERT INTO `gcc_asset_details`(`asset_latitude`, `asset_longitude`, `asset_name`, `asset_code`, `cat_id`, `department_name`, `position`, `assign_person`, `param_id`) VALUES (:asset_latitude,:asset_longitude,:asset_name,:asset_code,:cat_id,:department_name,:position,:assign_person,:param_id)", nativeQuery = true)
Integer importAsset(@Param("asset_latitude") String assetLatitude, @Param("asset_longitude") String assetLongitude, @Param("asset_name") String assetName, @Param("asset_code") String assetCode, @Param("cat_id") int catId, @Param("department_name") String departmentName, @Param("position") String position, @Param("assign_person") String person, @Param("param_id") String paramId);
@Query(value = "SELECT `asset_id` FROM `gcc_asset_details` WHERE `asset_code`=:asset_code LIMIT 1", nativeQuery = true)
String findByAssetCode(@Param("asset_code") String assetCode);
// @Modifying
// @Query(value = "DELETE FROM `gcc_asset_details` WHERE `asset_id` = :assetId", nativeQuery = true)
// void deleteByAssetId(@Param("assetId") int assetId);
@Modifying
@Query(value = "UPDATE `gcc_asset_details` set isdelete = 1 WHERE `asset_id` = :assetId", nativeQuery = true)
int deleteByAssetId(@Param("assetId") int assetId);
@Modifying
@Query(value = "UPDATE `gcc_asset_details` SET `asset_name` = :asset_name, " +
"`department_name` = :department_name, `assign_person` = :assign_person, " +
"`position` = :position, `maintenance_type` = :maintenance_type, " +
"`asset_type` = :asset_type, `hw_slno` = :hw_slno " +
"WHERE `asset_id` = :assetid LIMIT 1", nativeQuery = true)
int updateAsset(@Param("assetid") int assetId,
@Param("asset_name") String assetName,
@Param("department_name") String departmentName,
@Param("assign_person") String person,
@Param("position") String position,
@Param("maintenance_type") String maintenanceType,
@Param("asset_type") String assetType,
@Param("hw_slno") String hwSlno);
//test API
//@Query(value ="INSERT INTO `gcc_asset_details`(`asset_latitude`, `asset_longitude`, `asset_name`, `asset_code`, `cat_id`, `department_name`, `position`, `assign_person`, `param_id`) VALUES (:asset_latitude,:asset_longitude,:asset_name,:asset_code,:cat_id,:department_name,:position,:assign_person,:param_id)", nativeQuery = true)
// Integer insertAsset(@Param("asset_latitude") String assetLatitude, @Param("asset_longitude") String assetLongitude, @Param("asset_name") String assetName, @Param("asset_code") String assetCode, @Param("cat_id") int catId, @Param("department_name") String departmentName, @Param("position") String position, @Param("assign_person") String person, @Param("param_id") String paramId);
@Query(value = "SELECT assign_person as person, COUNT(*) as count FROM `gcc_asset_details` WHERE `isdelete`=0 GROUP BY assign_person", nativeQuery = true)
List<Object[]> countPersons();
@Query(value = "SELECT * FROM `gcc_asset_details` WHERE `isdelete`=0 AND `cDate` BETWEEN :fromDate AND :toDate", nativeQuery = true)
List<GccAssetDetails> showByDateRang(@Param("fromDate") LocalDate fromDate, @Param("toDate") LocalDate toDate);
}

59
src/main/java/com/feedback/it_asset/repository/GccFeedbackDataRep.java

@ -0,0 +1,59 @@
package com.feedback.it_asset.repository;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import com.feedback.it_asset.dto.ComplaintForm;
import com.feedback.it_asset.entity.GccFeedbackData;
import jakarta.transaction.Transactional;
@Repository
@Transactional
public interface GccFeedbackDataRep extends JpaRepository<GccFeedbackData, Integer>{
@Query(value = "SELECT LAST_INSERT_ID()", nativeQuery = true)
Integer getLastInsertedId();
@Query(value = "SELECT * FROM `gcc_feedback_data` WHERE `isdelete`=0",nativeQuery = true)
List<GccFeedbackData> showAll();
// @Query(value = "SELECT * FROM `gcc_feedback_data` WHERE `isdelete` = 0 AND `complaintNo` = :complaintNo", nativeQuery = true)
// List<GccFeedbackData> findByComplaintNo(@Param("complaintNo") String complaintNo);
@Query(value = "SELECT * FROM `gcc_feedback_data` WHERE `complaint_no=complaintNo1",nativeQuery = true)
List<GccFeedbackData> findbycno(@Param("complaint_no") String complaintNo1);
@Modifying
@Query(value ="INSERT INTO `gcc_feedback_data`(`feedback_id`, `cmq_id`, `apq_id`, `feedback`, `complaint_no`) VALUES (:feedback_id, :cmq_id, :apq_id, :feedback, :complaint_no)", nativeQuery = true)
Integer insertFeedback(@Param("feedback_id") Object feedbackid, @Param("cmq_id") Object cmqid, @Param("apq_id") Integer apqId, @Param("feedback") String feedback, @Param("complaint_no") Object complaintNo1);
@Modifying
@Query(value = "INSERT INTO `gcc_feedback_data`(`complaint_no`) VALUES (:complaint_no)", nativeQuery = true)
Integer insertComplaintNo(@Param("complaint_no") String complaintNo);
@Query(value = "SELECT * FROM `gcc_feedback_data` WHERE `feedback_id`=:feedbackId",nativeQuery = true)
List<GccFeedbackData> findByfeedbackId(@Param("feedbackId") int feedbackId);
@Query(value = "SELECT COUNT(*) AS num_rows\n" +
"FROM (\n" +
" SELECT feedback_id\n" +
" FROM gcc_feedback_data\n" +
" GROUP BY feedback_id\n" +
" HAVING COUNT(*) = SUM(feedback = '[yes]')\n" +
") AS subquery;",nativeQuery = true)
Integer onlyYesCount();
@Query(value = "SELECT COUNT(*) AS num_rows\n" +
"FROM (\n" +
" SELECT feedback_id\n" +
" FROM gcc_feedback_data\n" +
" GROUP BY feedback_id\n" +
" HAVING COUNT(*) = SUM(feedback = '[no]')\n" +
") AS subquery;",nativeQuery = true)
Integer onlyNoCount();
@Query(value = "SELECT COUNT(DISTINCT feedback_id) AS num_rows FROM gcc_feedback_data WHERE feedback IN ('[yes]', '[no]')", nativeQuery = true)
Integer yesAndNoCount();
List<GccFeedbackData> findByComplaintNo(String complaintNo);
ComplaintForm save(ComplaintForm cm);
}

62
src/main/java/com/feedback/it_asset/repository/GccFeedbackRep.java

@ -0,0 +1,62 @@
package com.feedback.it_asset.repository;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import com.feedback.it_asset.entity.AssetCategory;
import com.feedback.it_asset.entity.GccFeedback;
import jakarta.transaction.Transactional;
@Repository
@Transactional
public interface GccFeedbackRep extends JpaRepository<GccFeedback, Integer>{
@Query(value = "SELECT LAST_INSERT_ID()", nativeQuery = true)
Integer getLastInsertedId();
@Query(value = "SELECT * FROM `asset_category` WHERE `isdelete`=0",nativeQuery = true)
List<AssetCategory> showAll();
@Query(value = "SELECT * FROM `gcc_feedback` WHERE `feedback_id`=:feedbackId",nativeQuery = true)
List<GccFeedback> findByFeedbackId(@Param("feedbackId") int feedbackId);
@Modifying
@Query(value ="INSERT INTO `gcc_feedback`(`asset_id`, `name`, `mobile`, `rating`) VALUES (:asset_id,:name,:mobile,:rating)", nativeQuery = true)
Integer insertFeedback(@Param("asset_id") int assetid, @Param("name") String name, @Param("mobile") String mobile,@Param("rating") String rating);
@Query(value = "SELECT gf.*\n" +
"FROM gcc_feedback gf\n" +
"INNER JOIN gcc_feedback_data gfd ON gf.feedback_id = gfd.feedback_id\n" +
"GROUP BY gf.feedback_id\n" +
"HAVING COUNT(*) = SUM(gfd.feedback = '[yes]');",nativeQuery = true)
List<GccFeedback> findByfeedbackAllYes();
@Query(value = "SELECT gf.*\n" +
"FROM gcc_feedback gf\n" +
"INNER JOIN gcc_feedback_data gfd ON gf.feedback_id = gfd.feedback_id\n" +
"GROUP BY gf.feedback_id\n" +
"HAVING COUNT(*) = SUM(gfd.feedback = '[no]');",nativeQuery = true)
List<GccFeedback> findByfeedbackAllNo();
@Query(value = "SELECT gf.*\n" +
"FROM gcc_feedback gf\n" +
"INNER JOIN gcc_feedback_data gfd ON gf.feedback_id = gfd.feedback_id\n" +
"GROUP BY gf.feedback_id\n" +
"HAVING COUNT(*) <> SUM(gfd.feedback = '[yes]')\n" +
"AND COUNT(*) <> SUM(gfd.feedback = '[no]');",nativeQuery = true)
List<GccFeedback> findByfeedbackAnyNo();
@Query(value = "SELECT * FROM `gcc_feedback` WHERE `isdelete`=0 AND WHERE `cdate` BETWEEN :startDate AND :endDate",nativeQuery = true)
List<GccFeedback> feedbackTotalByDate(@Param("startDate") String startDate, @Param("endDate") String endDate);
@Query(value = "SELECT * FROM gcc_feedback\n" +
"WHERE feedback_id = (\n" +
" SELECT feedback_id\n" +
" FROM gcc_feedback_data\n" +
" WHERE cdate BETWEEN :startDate AND :endDate\n" + // Add the date range condition
" GROUP BY feedback_id\n" +
" HAVING COUNT(*) = SUM(feedback = :option)\n" +
");",nativeQuery = true)
List<GccFeedback> feedbackTotalByOptionDate(@Param("option") String option,@Param("startDate") String startDate, @Param("endDate") String endDate);
}

18
src/main/java/com/feedback/it_asset/repository/GccFileDataRep.java

@ -0,0 +1,18 @@
package com.feedback.it_asset.repository;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import com.feedback.it_asset.entity.GccFileData;
import jakarta.transaction.Transactional;
@Repository
@Transactional
public interface GccFileDataRep extends JpaRepository<GccFileData, Integer> {
@Query(value = "SELECT * FROM `gcc_file_Data` WHERE `isdelete`=0 AND `asset_id`=:asset_id",nativeQuery = true)
List<GccFileData> showFileDataByAssetId(@Param("asset_id") int assetId);
}

17
src/main/java/com/feedback/it_asset/repository/UserRepository.java

@ -0,0 +1,17 @@
package com.feedback.it_asset.repository;
import java.util.Optional;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import com.feedback.it_asset.entity.User;
@Repository
public interface UserRepository extends JpaRepository<User, Integer>{
@Query(value = "SELECT * FROM user WHERE `username`=:username and `password`=:password",nativeQuery = true)
Optional<User> checkUser(String username, String password);
}

46
src/main/java/com/feedback/it_asset/service/AssetCategoryService.java

@ -0,0 +1,46 @@
package com.feedback.it_asset.service;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import org.springframework.stereotype.Service;
@Service
public class AssetCategoryService {
private static final String SOURCE_JDBC_URL = "jdbc:mysql://localhost:3306/gcc_asset_details";
private static final String DESTINATION_JDBC_URL = "jdbc:mysql://localhost:3306/it_demo";
private static final String SOURCE_USERNAME = "root";
private static final String SOURCE_PASSWORD = "Sha619!@";
private static final String DESTINATION_USERNAME = "root";
private static final String DESTINATION_PASSWORD = "Sha619!@";
public void migrateCategory() {
try {
Class.forName("com.mysql.cj.jdbc.Driver");
try (
Connection sourceConnection = DriverManager.getConnection(SOURCE_JDBC_URL, SOURCE_USERNAME, SOURCE_PASSWORD);
Connection destinationConnection = DriverManager.getConnection(DESTINATION_JDBC_URL, DESTINATION_USERNAME, DESTINATION_PASSWORD)
) {
String sqlQuery = "SELECT th.ASSCAT_ID, th.ASSCAT_NAME FROM tbl_mas_hwcategory th;";
try (PreparedStatement preparedStatementSource = sourceConnection.prepareStatement(sqlQuery)) {
try (var resultSet = preparedStatementSource.executeQuery()) {
String insertCategoryQuery = "INSERT INTO asset_category (cat_id, name) VALUES (?, ?)";
try (PreparedStatement preparedStatementDestination = destinationConnection.prepareStatement(insertCategoryQuery)) {
while (resultSet.next()) {
preparedStatementDestination.setString(1, resultSet.getString("ASSCAT_ID"));
preparedStatementDestination.setString(2, resultSet.getString("ASSCAT_NAME"));
preparedStatementDestination.executeUpdate();
}
}
}
}
}
} catch (ClassNotFoundException | SQLException e) {
e.printStackTrace(); // Handle the exception appropriately
}
}
}

72
src/main/java/com/feedback/it_asset/service/AssetDetailsService.java

@ -0,0 +1,72 @@
package com.feedback.it_asset.service;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import org.springframework.stereotype.Service;
@Service
public class AssetDetailsService {
private static final String SOURCE_JDBC_URL = "jdbc:mysql://localhost:3306/gcc_asset_details";
private static final String DESTINATION_JDBC_URL = "jdbc:mysql://localhost:3306/it_demo";
private static final String SOURCE_USERNAME = "root";
private static final String SOURCE_PASSWORD = "root";
private static final String DESTINATION_USERNAME = "root";
private static final String DESTINATION_PASSWORD = "root";
public void migrateData() {
try {
Class.forName("com.mysql.cj.jdbc.Driver");
try (Connection sourceConnection = DriverManager.getConnection(SOURCE_JDBC_URL, SOURCE_USERNAME, SOURCE_PASSWORD);
Connection destinationConnection = DriverManager.getConnection(DESTINATION_JDBC_URL, DESTINATION_USERNAME, DESTINATION_PASSWORD)) {
String sqlQuery = "SELECT ta.ASSET_ID, ta.ASSET_NO, td.DEPT_NAME, tl.LOC_NAME, tsu.SEC_USER_NAME, th.ASSCAT_NAME, ta.HW_ID, ta.MAINTENANCE_TYPE, ta.ASSET_TYPE, ta.HW_SLNO " +
"FROM tbl_asset ta " +
"JOIN tbl_mas_dept td ON ta.DEPT_ID = td.DEPT_ID " +
"JOIN tbl_mas_loc tl ON ta.LOC_ID = tl.LOC_ID " +
"JOIN tbl_mas_hwcategory th ON ta.HWCAT_ID = th.ASSCAT_ID " +
"JOIN tbl_mas_sec_user tsu ON ta.SECUSER_ID = tsu.SEC_USER_ID";
try (PreparedStatement preparedStatementSource = sourceConnection.prepareStatement(sqlQuery);
var resultSet = preparedStatementSource.executeQuery()) {
// Updated query with 12 placeholders for all the fields you are inserting
String insertAssetDataQuery = "INSERT INTO gcc_asset_details (asset_id, asset_code, department_name, position, assign_person, asset_name, cat_id, maintenance_type, asset_type, hw_slno) " +
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) " +
"ON DUPLICATE KEY UPDATE asset_code = VALUES(asset_code), department_name = VALUES(department_name), " +
"position = VALUES(position), assign_person = VALUES(assign_person), asset_name = VALUES(asset_name), " +
"cat_id = VALUES(cat_id), maintenance_type = VALUES(maintenance_type), asset_type = VALUES(asset_type), hw_slno = VALUES(hw_slno)";
try (PreparedStatement preparedStatementInsert = destinationConnection.prepareStatement(insertAssetDataQuery)) {
while (resultSet.next()) {
// Set each parameter for the INSERT query
preparedStatementInsert.setString(1, resultSet.getString("ASSET_ID"));
preparedStatementInsert.setString(2, resultSet.getString("ASSET_NO"));
preparedStatementInsert.setString(3, resultSet.getString("DEPT_NAME"));
preparedStatementInsert.setString(4, resultSet.getString("LOC_NAME"));
preparedStatementInsert.setString(5, resultSet.getString("SEC_USER_NAME"));
preparedStatementInsert.setString(6, resultSet.getString("ASSCAT_NAME"));
preparedStatementInsert.setString(7, resultSet.getString("HW_ID"));
preparedStatementInsert.setString(8, resultSet.getString("MAINTENANCE_TYPE"));
preparedStatementInsert.setString(9, resultSet.getString("ASSET_TYPE"));
preparedStatementInsert.setString(10, resultSet.getString("HW_SLNO"));
// Execute the insert or update query
int rowsAffected = preparedStatementInsert.executeUpdate();
System.out.println("Rows affected: " + rowsAffected);
}
}
}
}
} catch (ClassNotFoundException | SQLException e) {
e.printStackTrace();
}
}
}

138
src/main/java/com/feedback/it_asset/service/GccAssetService.java

@ -0,0 +1,138 @@
package com.feedback.it_asset.service;
import java.io.IOException;
import java.sql.SQLException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.feedback.it_asset.AppConfig;
import com.feedback.it_asset.QRCodeGenerator;
import com.feedback.it_asset.dto.ComplaintForm;
import com.feedback.it_asset.entity.GccAssetDetails;
import com.feedback.it_asset.entity.GccFeedbackData;
import com.feedback.it_asset.repository.GccAssetDetailsRep;
import com.feedback.it_asset.repository.GccFeedbackDataRep;
import com.google.zxing.WriterException;
import jakarta.transaction.Transactional;
@Service
public class GccAssetService {
@Autowired
GccAssetDetailsRep gccAssetDetailsRep;
@Autowired
GccFeedbackDataRep gccFeedbackDataRep;
@Autowired
private AppConfig appConfig;
public Integer saveAsset(
String assetLatitude,
String assetLongitude,
String assetName,
String assetCode,
int catId,
String departmentName,
String position,
String person,
String paramId,
String maintenanceType,
String assetType,
String hwSlno
) { // Add maintenanceType parameter here
return gccAssetDetailsRep.insertAsset(
assetLatitude,
assetLongitude,
assetName,
assetCode,
catId,
departmentName,
position,
person,
paramId,
maintenanceType,
assetType,
hwSlno); // Pass maintenanceType to the repository method
}
@Transactional
public void deleteByAssetName(int assetId) {
gccAssetDetailsRep.deleteByAssetId(assetId);
}
// Change the format of the output in getFeedbackAnalysis method
public List<Map<String, Object>> getFeedbackAnalysis() {
List<GccFeedbackData> feedbackDataList = gccFeedbackDataRep.findAll();
List<Map<String, Object>> output = feedbackDataList.stream()
.filter(feedback -> feedback.getFeedbackAns() != null && feedback.getcDate() != null)
.map(feedback -> {
Map<String, Object> entry = new HashMap<>();
entry.put("label", feedback.getFeedbackAns());
entry.put("data", Arrays.asList(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L));
entry.put("month", getMonth(feedback.getcDate()));
return entry;
})
.collect(Collectors.toList());
for (Map<String, Object> entry : output) {
int monthIndex = Integer.parseInt((String) entry.get("month")) - 1;
@SuppressWarnings("unchecked")
List<Long> counts = (List<Long>) entry.get("data");
counts.set(monthIndex, counts.get(monthIndex) + 1);
}
return output;
}
// Simplify the getMonth method
private static String getMonth(String date) {
try {
return new SimpleDateFormat("MM").format(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(date));
} catch (ParseException e) {
e.printStackTrace();
return date;
}
}
public List<Map<String, Object>> showQrcodesByDateRange(LocalDate fromDate, LocalDate toDate) throws IOException, WriterException, SQLException {
List<GccAssetDetails> assetDetailsList = gccAssetDetailsRep.showByDateRang(fromDate, toDate);
List<Map<String, Object>> simplifiedList = new ArrayList<>();
for (GccAssetDetails assetDetails : assetDetailsList) {
Map<String, Object> simplifiedMap = new HashMap<>();
simplifiedMap.put("assetId", assetDetails.getAssetId());
simplifiedMap.put("catName", assetDetails.getAssetCategory().getCatName());
simplifiedMap.put("departmentName", assetDetails.getDepartmentName());
simplifiedMap.put("assetCode", assetDetails.getAssetCode());
simplifiedMap.put("cDate", assetDetails.getcDate());
simplifiedMap.put("person", assetDetails.getPerson());
simplifiedMap.put("qrcodeimg", QRCodeGenerator.generateQRCode(appConfig.getQrcodeUrl() + "/" + assetDetails.getAssetCode()));
simplifiedList.add(simplifiedMap);
}
return simplifiedList;
}
public static String handleComplaintForm(ComplaintForm complaintForm) {
// Implement your logic here and return the complaint number
return "complaintNo";
}
}

30
src/main/java/com/feedback/it_asset/service/MainService.java

@ -0,0 +1,30 @@
package com.feedback.it_asset.service;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.feedback.it_asset.repository.AssetCategoryRep;
@Service
public class MainService {
@Autowired
private AssetCategoryRep repo;
public List<com.feedback.it_asset.entity.AssetCategory> listAll(){
return repo.findAll();
}
public void save(com.feedback.it_asset.entity.AssetCategory category) {
repo.save(category);
}
public com.feedback.it_asset.entity.AssetCategory get(Integer id){
return repo.findById(id).get();
}
public void delete(Integer id){
repo.deleteById(id);
}
}

43
src/main/resources/application.properties

@ -0,0 +1,43 @@
spring.datasource.url=jdbc:mysql://localhost:3306/it_demo
spring.datasource.username=root
spring.datasource.password=root
#spring.datasource.password=gccroot
app.title=GREATER CHENNAI CORPORATION
server.port = 8072
app.baseUrl=http://localhost:8072
app.qrcodeUrl=http://localhost:8072/gcc-complaint
app.getOtpUrl=https://api.onex-aura.com/api/sms?
app.erpUrl=https://erp.chennaicorporation.gov.in/pgr/external/mobileservice?
app.ptaxid=null
app.ptaxRegMobile=null
#Hibernate
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQLDialect
#spring.jpa.show-sql=true
#spring.jpa.properties.hibernate.format_sql=true
#logging.level.org.hibernate.SQL=DEBUG
logging.level.org.hibernate.type=TRACE
#logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE
#logging.level.org.hibernate.type.descriptor.sql=TRACE
logging.level.org.hibernate.SQL=DEBUG
logging.level.org.hibernate.orm.jdbc.bind=TRACE
logging.level.org.hibernate.type.descriptor.sql=TRACE
#logging.level.org.springframework.web=DEBUG
#Hibernate auto ddl
spring.jpa.hibernate.ddl-auto=update
spring.jackson.serialization.fail-on-empty-beans=false
#server.error.include-message= always
#server.error.include-binding-errors= always
#server.error.include-stacktrace=
#server.error.include-exception= false

BIN
src/main/resources/static/assets/.DS_Store

BIN
src/main/resources/static/assets/._.DS_Store

BIN
src/main/resources/static/assets/.__js

BIN
src/main/resources/static/assets/.__scss

BIN
src/main/resources/static/assets/._css

BIN
src/main/resources/static/assets/._fonts

BIN
src/main/resources/static/assets/._js

BIN
src/main/resources/static/assets/._media

BIN
src/main/resources/static/assets/_js/._main

BIN
src/main/resources/static/assets/_js/._pages

BIN
src/main/resources/static/assets/_js/main/._app.js

BIN
src/main/resources/static/assets/_js/main/._modules

65
src/main/resources/static/assets/_js/main/app.js

@ -0,0 +1,65 @@
/*
* Document : app.js
* Author : pixelcave
* Description: Main entry point
*
*/
// Import required modules
import Template from './modules/template';
// App extends Template
export default class App extends Template {
/*
* Auto called when creating a new instance
*
*/
constructor() {
super();
}
/*
* Here you can override or extend any function you want from Template class
* if you would like to change/extend/remove the default functionality.
*
* This way it will be easier for you to update the module files if a new update
* is released since all your changes will be in here overriding the original ones.
*
* Let's have a look at the _uiInit() function, the one that runs the first time
* we create an instance of Template class or App class which extends it. This function
* inits all vital functionality but you can change it to fit your own needs.
*
*/
/*
* EXAMPLE #1 - Removing default functionality by making it empty
*
*/
// _uiInit() {}
/*
* EXAMPLE #2 - Extending default functionality with additional code
*
*/
// _uiInit() {
// // Call original function
// super._uiInit();
//
// // Your extra JS code afterwards
// }
/*
* EXAMPLE #3 - Replacing default functionality by writing your own code
*
*/
// _uiInit() {
// // Your own JS code without ever calling the original function's code
// }
}
// Create a new instance of App
window.Dashmix = new App();

BIN
src/main/resources/static/assets/_js/main/modules/._helpers.js

BIN
src/main/resources/static/assets/_js/main/modules/._template.js

1110
src/main/resources/static/assets/_js/main/modules/helpers.js
File diff suppressed because it is too large
View File

802
src/main/resources/static/assets/_js/main/modules/template.js

@ -0,0 +1,802 @@
/*
* Document : template.js
* Author : pixelcave
* Description: UI Framework custom functionality
*
*/
// Imports
import * as bootstrap from 'bootstrap';
import SimpleBar from 'simplebar';
import Helpers from './helpers';
// Assignments
window.bootstrap = bootstrap;
window.SimpleBar = SimpleBar;
// Template
export default class Template {
/*
* Auto called when creating a new instance
*
*/
constructor() {
this.onLoad(() => this._uiInit());
}
/*
* Init all vital functionality
*
*/
_uiInit() {
// Layout variables
this._lHtml = document.documentElement;
this._lBody = document.body;
this._lpageLoader = document.getElementById('page-loader');
this._lPage = document.getElementById('page-container');
this._lSidebar = document.getElementById('sidebar');
this._lSidebarScrollCon = this._lSidebar && this._lSidebar.querySelector('.js-sidebar-scroll');
this._lSideOverlay = document.getElementById('side-overlay');
this._lResize = false;
this._lHeader = document.getElementById('page-header');
this._lHeaderSearch = document.getElementById('page-header-search');
this._lHeaderSearchInput = document.getElementById('page-header-search-input');
this._lHeaderLoader = document.getElementById('page-header-loader');
this._lMain = document.getElementById('main-container');
this._lFooter = document.getElementById('page-footer');
// Helper variables
this._lSidebarScroll = false;
this._lSideOverlayScroll = false;
// Base UI Init
this._uiHandleTheme();
this._uiHandleDarkMode();
this._uiHandleSidebars();
this._uiHandleHeader();
this._uiHandleNav();
// API Init
this._uiApiLayout();
this._uiApiBlocks();
// Init the following helpers by default
this.helpers([
'bs-tooltip',
'bs-popover',
'dm-toggle-class',
'dm-year-copy',
'dm-ripple',
]);
// Page Loader (hide it)
this._uiHandlePageLoader();
}
/*
* Handles sidebar and side overlay scrolling functionality/styles
*
*/
_uiHandleSidebars(mode = 'init') {
let self = this;
if (self._lSidebar || self._lSideOverlay) {
if (mode === 'init') {
// Add 'side-trans-enabled' class to #page-container (enables sidebar and side overlay transition on open/close)
// Fixes IE10, IE11 and Edge bug in which animation was executed on each page load
self._lPage.classList.add('side-trans-enabled');
// Remove side transitions on window resizing
window.addEventListener('resize', () => {
clearTimeout(self._lResize);
self._lPage.classList.remove('side-trans-enabled');
self._lResize = setTimeout(() => { self._lPage.classList.add('side-trans-enabled'); }, 500);
});
// Init custom scrolling
this._uiHandleSidebars('custom-scroll');
} else if (mode = 'custom-scroll') {
// If .side-scroll is added to #page-container, enable custom scrolling
if (self._lPage.classList.contains('side-scroll')) {
// Init custom scrolling on Sidebar
if ((self._lSidebar) && !self._lSidebarScroll) {
self._lSidebarScroll = new SimpleBar(self._lSidebarScrollCon);
}
// Init custom scrolling on Side Overlay
if ((self._lSideOverlay) && !self._lSideOverlayScroll) {
self._lSideOverlayScroll = new SimpleBar(self._lSideOverlay);
}
}
}
}
}
/*
* Handles header related classes
*
*/
_uiHandleHeader() {
let self = this;
// If the header is fixed and has the glass style, add the related class on scrolling to add a background color to the header
if (self._lPage.classList.contains('page-header-glass') && self._lPage.classList.contains('page-header-fixed')) {
window.addEventListener('scroll', e => {
if (window.scrollY > 60) {
self._lPage.classList.add('page-header-scroll');
} else {
self._lPage.classList.remove('page-header-scroll');
}
});
window.dispatchEvent(new CustomEvent('scroll'));
}
}
/*
* Toggle Submenu functionality
*
*/
_uiHandleNav() {
let links = document.querySelectorAll('[data-toggle="submenu"]');
// When a submenu link is clicked
if (links) {
links.forEach(link => {
link.addEventListener('click', e => {
e.preventDefault();
// Get main navigation
let mainNav = link.closest('.nav-main');
// Check if we are in horizontal navigation, large screen and hover is enabled
if (
!(
(window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth) > 991
&& mainNav.classList.contains('nav-main-horizontal')
&& mainNav.classList.contains('nav-main-hover')
)
) {
// Get link's parent
let parentLi = link.closest('li');
if (parentLi.classList.contains('open')) {
// If submenu is open, close it..
parentLi.classList.remove('open');
link.setAttribute('aria-expanded', 'false');
} else {
// .. else if submenu is closed, close all other (same level) submenus first before open it
Array.from(link.closest('ul').children).forEach(el => {
el.classList.remove('open');
});
parentLi.classList.add('open');
link.setAttribute('aria-expanded', 'true');
}
}
return false;
});
});
}
}
/*
* Page loading screen functionality
*
*/
_uiHandlePageLoader(mode = 'hide', colorClass) {
if (mode === 'show') {
if (this._lpageLoader) {
if (colorClass) {
this._lpageLoader.className = '';
this._lpageLoader.classList.add(colorClass);
}
this._lpageLoader.classList.add('show');
} else {
let pageLoader = document.createElement('div');
pageLoader.id = 'page-loader';
if (colorClass) {
pageLoader.classList.add(colorClass);
}
pageLoader.classList.add('show');
this._lPage.insertBefore(pageLoader, this._lPage.firstChild);
this._lpageLoader = document.getElementById('page-loader');
}
} else if (mode === 'hide') {
if (this._lpageLoader) {
this._lpageLoader.classList.remove('show');
}
}
}
/*
* Saves/Retrieves Dark Mode preference to local storage
*
*/
_uiHandleDarkMode(mode = 'init') {
let self = this;
// If dark mode is not enabled by default remember default sidebar
// and header style to return to after any possible dark mode disabling
if (mode === 'init' && !self._lPage.classList.contains('dark-mode')) {
if (self._lPage.classList.contains('sidebar-dark')) {
localStorage.setItem('dashmixDefaultsSidebarDark', true);
} else {
localStorage.removeItem('dashmixDefaultsSidebarDark');
}
if (self._lPage.classList.contains('page-header-dark')) {
localStorage.setItem('dashmixDefaultsPageHeaderDark', true);
} else {
localStorage.removeItem('dashmixDefaultsPageHeaderDark');
}
}
// If remember-theme class is added in #page-container
if (self._lPage.classList.contains('remember-theme')) {
let darkMode = localStorage.getItem('dashmixDarkMode') || false;
if (mode === 'init') {
if (darkMode) {
self._lPage.classList.add('sidebar-dark');
self._lPage.classList.add('page-header-dark');
self._lPage.classList.add('dark-mode');
} else if (mode === 'init') {
self._lPage.classList.remove('dark-mode');
}
} else if (mode === 'on') {
localStorage.setItem('dashmixDarkMode', true);
} else if (mode === 'off') {
localStorage.removeItem('dashmixDarkMode');
}
} else if (mode === 'init') {
localStorage.removeItem('dashmixDarkMode');
}
}
/*
* Set active color theme functionality
*
*/
_uiHandleTheme() {
let self = this;
let themeEl = document.getElementById('css-theme');
let rememberTheme = this._lPage.classList.contains('remember-theme') ? true : false;
// If remember theme is enabled
if (rememberTheme) {
let themeName = localStorage.getItem('dashmixThemeName') || false;
// Update color theme
if (themeName) {
self._uiUpdateTheme(themeEl, themeName);
}
// Update theme element
themeEl = document.getElementById('css-theme');
} else {
localStorage.removeItem('dashmixThemeName');
}
// Set the active color theme link as active
document.querySelectorAll('[data-toggle="theme"][data-theme="' + (themeEl ? themeEl.getAttribute('href') : 'default') + '"]').forEach(link => {
link.classList.add('active');
});
// When a color theme link is clicked
document.querySelectorAll('[data-toggle="theme"]').forEach(el => {
el.addEventListener('click', e => {
e.preventDefault();
// Get element's data
let themeName = el.dataset.theme;
// Set this color theme link as active
document.querySelectorAll('[data-toggle="theme"]').forEach(link => {
link.classList.remove('active');
});
document.querySelector('[data-toggle="theme"][data-theme="' + themeName + '"]').classList.add('active');
// Update color theme
self._uiUpdateTheme(themeEl, themeName);
// Update theme element
themeEl = document.getElementById('css-theme');
// If remember theme is enabled, save the new active color theme
if (rememberTheme) {
localStorage.setItem('dashmixThemeName', themeName);
}
});
});
}
/*
* Updates the color theme
*
*/
_uiUpdateTheme(themeEl, themeName) {
if (themeName === 'default') {
if (themeEl) {
themeEl.parentNode.removeChild(themeEl);
}
} else {
if (themeEl) {
themeEl.setAttribute('href', themeName);
} else {
let themeLink = document.createElement('link');
themeLink.id = 'css-theme';
themeLink.setAttribute('rel', 'stylesheet');
themeLink.setAttribute('href', themeName);
document.getElementById('css-main').insertAdjacentElement('afterend', themeLink);
}
}
}
/*
* Layout API
*
*/
_uiApiLayout(mode = 'init') {
let self = this;
// API with object literals
let layoutAPI = {
init: () => {
let buttons = document.querySelectorAll('[data-toggle="layout"]');
// Call layout API on button click
if (buttons) {
buttons.forEach(btn => {
btn.addEventListener('click', e => {
self._uiApiLayout(btn.dataset.action);
});
})
}
// Prepend Page Overlay div if enabled (used when Side Overlay opens)
if (self._lPage.classList.contains('enable-page-overlay')) {
let pageOverlay = document.createElement('div');
pageOverlay.id = 'page-overlay';
self._lPage.insertBefore(pageOverlay, self._lPage.firstChild);
document.getElementById('page-overlay').addEventListener('click', e => {
self._uiApiLayout('side_overlay_close');
});
}
},
sidebar_pos_toggle: () => {
self._lPage.classList.toggle('sidebar-r');
},
sidebar_pos_left: () => {
self._lPage.classList.remove('sidebar-r');
},
sidebar_pos_right: () => {
self._lPage.classList.add('sidebar-r');
},
sidebar_toggle: () => {
if (window.innerWidth > 991) {
self._lPage.classList.toggle('sidebar-o');
} else {
self._lPage.classList.toggle('sidebar-o-xs');
}
},
sidebar_open: () => {
if (window.innerWidth > 991) {
self._lPage.classList.add('sidebar-o');
} else {
self._lPage.classList.add('sidebar-o-xs');
}
},
sidebar_close: () => {
if (window.innerWidth > 991) {
self._lPage.classList.remove('sidebar-o');
} else {
self._lPage.classList.remove('sidebar-o-xs');
}
},
sidebar_mini_toggle: () => {
if (window.innerWidth > 991) {
self._lPage.classList.toggle('sidebar-mini');
}
},
sidebar_mini_on: () => {
if (window.innerWidth > 991) {
self._lPage.classList.add('sidebar-mini');
}
},
sidebar_mini_off: () => {
if (window.innerWidth > 991) {
self._lPage.classList.remove('sidebar-mini');
}
},
sidebar_style_toggle: () => {
if (self._lPage.classList.contains('sidebar-dark')) {
self._uiApiLayout('sidebar_style_light');
} else {
self._uiApiLayout('sidebar_style_dark');
}
},
sidebar_style_dark: () => {
self._lPage.classList.add('sidebar-dark');
localStorage.setItem('dashmixDefaultsSidebarDark', true);
},
sidebar_style_light: () => {
self._lPage.classList.remove('sidebar-dark');
self._lPage.classList.remove('dark-mode');
localStorage.removeItem('dashmixDefaultsSidebarDark');
},
side_overlay_toggle: () => {
if (self._lPage.classList.contains('side-overlay-o')) {
self._uiApiLayout('side_overlay_close');
} else {
self._uiApiLayout('side_overlay_open');
}
},
side_overlay_open: () => {
// When ESCAPE key is hit close the side overlay
document.addEventListener('keydown', e => {
if (e.key === 'Esc' || e.key === 'Escape') {
self._uiApiLayout('side_overlay_close');
}
});
self._lPage.classList.add('side-overlay-o');
},
side_overlay_close: () => {
self._lPage.classList.remove('side-overlay-o');
},
side_overlay_mode_hover_toggle: () => {
self._lPage.classList.toggle('side-overlay-hover');
},
side_overlay_mode_hover_on: () => {
self._lPage.classList.add('side-overlay-hover');
},
side_overlay_mode_hover_off: () => {
self._lPage.classList.remove('side-overlay-hover');
},
header_glass_toggle: () => {
self._lPage.classList.toggle('page-header-glass');
self._uiHandleHeader();
},
header_glass_on: () => {
self._lPage.classList.add('page-header-glass');
self._uiHandleHeader();
},
header_glass_off: () => {
self._lPage.classList.remove('page-header-glass');
self._uiHandleHeader();
},
header_mode_toggle: () => {
self._lPage.classList.toggle('page-header-fixed');
},
header_mode_static: () => {
self._lPage.classList.remove('page-header-fixed');
},
header_mode_fixed: () => {
self._lPage.classList.add('page-header-fixed');
},
header_style_toggle: () => {
if (self._lPage.classList.contains('page-header-dark')) {
self._uiApiLayout('header_style_light');
} else {
self._uiApiLayout('header_style_dark');
}
},
header_style_dark: () => {
self._lPage.classList.add('page-header-dark');
localStorage.setItem('dashmixDefaultsPageHeaderDark', true);
},
header_style_light: () => {
self._lPage.classList.remove('page-header-dark');
self._lPage.classList.remove('dark-mode');
localStorage.removeItem('dashmixDefaultsPageHeaderDark');
},
header_search_on: () => {
self._lHeaderSearch.classList.add('show');
self._lHeaderSearchInput.focus();
// When ESCAPE key is hit close the search section
document.addEventListener('keydown', e => {
if (e.key === 'Esc' || e.key === 'Escape') {
self._uiApiLayout('header_search_off');
}
});
},
header_search_off: () => {
self._lHeaderSearch.classList.remove('show');
self._lHeaderSearchInput.blur();
},
header_loader_on: () => {
self._lHeaderLoader.classList.add('show');
},
header_loader_off: () => {
self._lHeaderLoader.classList.remove('show');
},
dark_mode_toggle: () => {
if (self._lPage.classList.contains('dark-mode')) {
self._uiApiLayout('dark_mode_off');
} else {
self._uiApiLayout('dark_mode_on');
}
},
dark_mode_on: () => {
self._lPage.classList.add('sidebar-dark');
self._lPage.classList.add('page-header-dark');
self._lPage.classList.add('dark-mode');
this._uiHandleDarkMode('on');
},
dark_mode_off: () => {
if (!localStorage.getItem('dashmixDefaultsSidebarDark')) {
self._lPage.classList.remove('sidebar-dark');
}
if (!localStorage.getItem('dashmixDefaultsPageHeaderDark')) {
self._lPage.classList.remove('page-header-dark');
}
self._lPage.classList.remove('dark-mode');
this._uiHandleDarkMode('off');
},
content_layout_toggle: () => {
if (self._lPage.classList.contains('main-content-boxed')) {
self._uiApiLayout('content_layout_narrow');
} else if (self._lPage.classList.contains('main-content-narrow')) {
self._uiApiLayout('content_layout_full_width');
} else {
self._uiApiLayout('content_layout_boxed');
}
},
content_layout_boxed: () => {
self._lPage.classList.remove('main-content-narrow');
self._lPage.classList.add('main-content-boxed');
},
content_layout_narrow: () => {
self._lPage.classList.remove('main-content-boxed');
self._lPage.classList.add('main-content-narrow');
},
content_layout_full_width: () => {
self._lPage.classList.remove('main-content-boxed');
self._lPage.classList.remove('main-content-narrow');
}
};
// Call layout API
if (layoutAPI[mode]) {
layoutAPI[mode]();
}
}
/*
* Blocks API
*
*/
_uiApiBlocks(mode = 'init', block = false) {
let self = this;
// Helper variables
let elBlock, btnFullscreen, btnContentToggle;
// Set default icons for fullscreen and content toggle buttons
let iconBase = 'si';
let iconFullscreen = 'si-size-fullscreen';
let iconFullscreenActive = 'si-size-actual';
let iconContent = 'si-arrow-up';
let iconContentActive = 'si-arrow-down';
// API with object literals
let blockAPI = {
init: () => {
// Auto add the default toggle icons to fullscreen and content toggle buttons
document.querySelectorAll('[data-toggle="block-option"][data-action="fullscreen_toggle"]').forEach(btn => {
btn.innerHTML = '<i class="' + iconBase + ' ' + (btn.closest('.block').classList.contains('block-mode-fullscreen') ? iconFullscreenActive : iconFullscreen) + '"></i>';
});
document.querySelectorAll('[data-toggle="block-option"][data-action="content_toggle"]').forEach(btn => {
btn.innerHTML = '<i class="' + iconBase + ' ' + (btn.closest('.block').classList.contains('block-mode-hidden') ? iconContentActive : iconContent) + '"></i>';
});
// Call blocks API on option button click
document.querySelectorAll('[data-toggle="block-option"]').forEach(btn => {
btn.addEventListener('click', e => {
this._uiApiBlocks(btn.dataset.action, btn.closest('.block'));
});
});
},
fullscreen_toggle: () => {
elBlock.classList.remove('block-mode-pinned');
elBlock.classList.toggle('block-mode-fullscreen');
// Update block option icon
if (btnFullscreen) {
if (elBlock.classList.contains('block-mode-fullscreen')) {
btnFullscreen && btnFullscreen.querySelector('i').classList.replace(iconFullscreen, iconFullscreenActive);
} else {
btnFullscreen && btnFullscreen.querySelector('i').classList.replace(iconFullscreenActive, iconFullscreen);
}
}
},
fullscreen_on: () => {
elBlock.classList.remove('block-mode-pinned')
elBlock.classList.add('block-mode-fullscreen');
// Update block option icon
btnFullscreen && btnFullscreen.querySelector('i').classList.replace(iconFullscreen, iconFullscreenActive);
},
fullscreen_off: () => {
elBlock.classList.remove('block-mode-fullscreen');
// Update block option icon
btnFullscreen && btnFullscreen.querySelector('i').classList.replace(iconFullscreenActive, iconFullscreen);
},
content_toggle: () => {
elBlock.classList.toggle('block-mode-hidden');
// Update block option icon
if (btnContentToggle) {
if (elBlock.classList.contains('block-mode-hidden')) {
btnContentToggle.querySelector('i').classList.replace(iconContent, iconContentActive);
} else {
btnContentToggle.querySelector('i').classList.replace(iconContentActive, iconContent);
}
}
},
content_hide: () => {
elBlock.classList.add('block-mode-hidden');
// Update block option icon
btnContentToggle && btnContentToggle.querySelector('i').classList.replace(iconContent, iconContentActive);
},
content_show: () => {
elBlock.classList.remove('block-mode-hidden');
// Update block option icon
btnContentToggle && btnContentToggle.querySelector('i').classList.replace(iconContentActive, iconContent);
},
state_toggle: () => {
elBlock.classList.toggle('block-mode-loading');
// Return block to normal state if the demostration mode is on in the refresh option button - data-action-mode="demo"
if (elBlock.querySelector('[data-toggle="block-option"][data-action="state_toggle"][data-action-mode="demo"]')) {
setTimeout(() => {
elBlock.classList.remove('block-mode-loading');
}, 2000);
}
},
state_loading: () => {
elBlock.classList.add('block-mode-loading');
},
state_normal: () => {
elBlock.classList.remove('block-mode-loading');
},
pinned_toggle: () => {
elBlock.classList.remove('block-mode-fullscreen');
elBlock.classList.toggle('block-mode-pinned');
},
pinned_on: () => {
elBlock.classList.remove('block-mode-fullscreen');
elBlock.classList.add('block-mode-pinned');
},
pinned_off: () => {
elBlock.classList.remove('block-mode-pinned');
},
close: () => {
elBlock.classList.add('d-none');
},
open: () => {
elBlock.classList.remove('d-none');
}
};
if (mode === 'init') {
// Call Block API
blockAPI[mode]();
} else {
// Get block element
elBlock = (block instanceof Element) ? block : document.querySelector(`${block}`);
// If element exists, procceed with block functionality
if (elBlock) {
// Get block option buttons if exist (need them to update their icons)
btnFullscreen = elBlock.querySelector('[data-toggle="block-option"][data-action="fullscreen_toggle"]');
btnContentToggle = elBlock.querySelector('[data-toggle="block-option"][data-action="content_toggle"]');
// Call Block API
if (blockAPI[mode]) {
blockAPI[mode]();
}
}
}
}
/*
********************************************************************************************
*
* Helpers
*
*********************************************************************************************
*/
/*
* On DOM content loaded
*
*/
onLoad(fn) {
if (document.readyState != 'loading') {
fn();
} else {
document.addEventListener('DOMContentLoaded', fn);
}
}
/*
********************************************************************************************
*
* Create aliases for easier/quicker access to vital methods
*
*********************************************************************************************
*/
/*
* Init base functionality
*
*/
init() {
this._uiInit();
}
/*
* Layout API
*
*/
layout(mode) {
this._uiApiLayout(mode);
}
/*
* Blocks API
*
*/
block(mode, block) {
this._uiApiBlocks(mode, block);
}
/*
* Handle Page Loader
*
*/
loader(mode, colorClass) {
this._uiHandlePageLoader(mode, colorClass);
}
/*
* Run Helpers
*
*/
helpers(helpers, options = {}) {
Helpers.run(helpers, options);
}
/*
* Run Helpers on DOM content loaded
*
*/
helpersOnLoad(helpers, options = {}) {
this.onLoad(() => Helpers.run(helpers, options));
}
}

BIN
src/main/resources/static/assets/_js/pages/._be_comp_calendar.js

BIN
src/main/resources/static/assets/_js/pages/._be_comp_charts.js

BIN
src/main/resources/static/assets/_js/pages/._be_comp_chat.js

BIN
src/main/resources/static/assets/_js/pages/._be_comp_dialogs.js

BIN
src/main/resources/static/assets/_js/pages/._be_comp_image_cropper.js

BIN
src/main/resources/static/assets/_js/pages/._be_comp_maps_vector.js

BIN
src/main/resources/static/assets/_js/pages/._be_comp_nestable.js

BIN
src/main/resources/static/assets/_js/pages/._be_comp_onboarding.js

BIN
src/main/resources/static/assets/_js/pages/._be_comp_rating.js

BIN
src/main/resources/static/assets/_js/pages/._be_forms_validation.js

BIN
src/main/resources/static/assets/_js/pages/._be_pages_dashboard.js

BIN
src/main/resources/static/assets/_js/pages/._be_pages_dashboard_v1.js

BIN
src/main/resources/static/assets/_js/pages/._be_pages_ecom_dashboard.js

BIN
src/main/resources/static/assets/_js/pages/._be_pages_projects_tasks.js

BIN
src/main/resources/static/assets/_js/pages/._be_tables_datatables.js

BIN
src/main/resources/static/assets/_js/pages/._be_ui_animations.js

BIN
src/main/resources/static/assets/_js/pages/._be_ui_icons.js

BIN
src/main/resources/static/assets/_js/pages/._be_ui_progress.js

BIN
src/main/resources/static/assets/_js/pages/._db_analytics.js

BIN
src/main/resources/static/assets/_js/pages/._db_corporate_slim.js

BIN
src/main/resources/static/assets/_js/pages/._db_crypto.js

BIN
src/main/resources/static/assets/_js/pages/._op_auth_lock.js

BIN
src/main/resources/static/assets/_js/pages/._op_auth_reminder.js

BIN
src/main/resources/static/assets/_js/pages/._op_auth_signin.js

BIN
src/main/resources/static/assets/_js/pages/._op_auth_signup.js

BIN
src/main/resources/static/assets/_js/pages/._op_coming_soon.js

BIN
src/main/resources/static/assets/_js/pages/._op_installation.js

179
src/main/resources/static/assets/_js/pages/be_comp_calendar.js

@ -0,0 +1,179 @@
/*
* Document : be_comp_calendar.js
* Author : pixelcave
* Description: Custom JS code used in Calendar Page
*/
// Full Calendar, for more examples you can check out http://fullcalendar.io/
class pageCompCalendar {
/*
* Add event to the events list
*
*/
static addEvent() {
let eventInput = document.querySelector('.js-add-event');
let eventInputVal = '';
// When the add event form is submitted
document.querySelector('.js-form-add-event').addEventListener('submit', e => {
e.preventDefault();
// Get input value
eventInputVal = eventInput.value;
// Check if the user entered something
if (eventInputVal) {
let eventList = document.getElementById('js-events');
let newEvent = document.createElement('li');
let newEventDiv = document.createElement('div');
// Prepare new event div
newEventDiv.classList.add('js-event');
newEventDiv.classList.add('p-2');
newEventDiv.classList.add('fs-sm');
newEventDiv.classList.add('fw-medium');
newEventDiv.classList.add('rounded');
newEventDiv.classList.add('bg-info-light');
newEventDiv.classList.add('text-info');
newEventDiv.textContent = eventInputVal;
// Prepare new event li
newEvent.appendChild(newEventDiv);
// Add it to the events list
eventList.insertBefore(newEvent, eventList.firstChild);
// Clear input field
eventInput.value = '';
}
});
}
/*
* Init drag and drop event functionality
*
*/
static initEvents() {
new FullCalendar.Draggable(document.getElementById('js-events'), {
itemSelector: '.js-event',
eventData: function (eventEl) {
return {
title: eventEl.textContent,
backgroundColor: getComputedStyle(eventEl).color,
borderColor: getComputedStyle(eventEl).color
};
}
});
}
/*
* Init calendar demo functionality
*
*/
static initCalendar() {
let date = new Date();
let d = date.getDate();
let m = date.getMonth();
let y = date.getFullYear();
let calendar = new FullCalendar.Calendar(document.getElementById('js-calendar'), {
themeSystem: 'standard',
firstDay: 1,
editable: true,
droppable: true,
headerToolbar: {
left: 'title',
right: 'prev,next today dayGridMonth,timeGridWeek,timeGridDay,listWeek'
},
drop: function (info) {
info.draggedEl.parentNode.remove();
},
events: [
{
title: 'Gaming Day',
start: new Date(y, m, 1),
allDay: true
},
{
title: 'Skype Meeting',
start: new Date(y, m, 3)
},
{
title: 'Project X',
start: new Date(y, m, 9),
end: new Date(y, m, 12),
allDay: true,
color: '#e04f1a'
},
{
title: 'Work',
start: new Date(y, m, 17),
end: new Date(y, m, 19),
allDay: true,
color: '#82b54b'
},
{
id: 999,
title: 'Hiking (repeated)',
start: new Date(y, m, d - 1, 15, 0)
},
{
id: 999,
title: 'Hiking (repeated)',
start: new Date(y, m, d + 3, 15, 0)
},
{
title: 'Landing Template',
start: new Date(y, m, d - 3),
end: new Date(y, m, d - 3),
allDay: true,
color: '#ffb119'
},
{
title: 'Lunch',
start: new Date(y, m, d + 7, 15, 0),
color: '#82b54b'
},
{
title: 'Coding',
start: new Date(y, m, d, 8, 0),
end: new Date(y, m, d, 14, 0),
},
{
title: 'Trip',
start: new Date(y, m, 25),
end: new Date(y, m, 27),
allDay: true,
color: '#ffb119'
},
{
title: 'Reading',
start: new Date(y, m, d + 8, 20, 0),
end: new Date(y, m, d + 8, 22, 0)
},
{
title: 'Follow us on Twitter',
start: new Date(y, m, 22),
allDay: true,
url: 'http://twitter.com/pixelcave',
color: '#3c90df'
}
]
});
calendar.render();
}
/*
* Init functionality
*
*/
static init() {
this.addEvent();
this.initEvents();
this.initCalendar();
}
}
// Initialize when page loads
Dashmix.onLoad(() => pageCompCalendar.init());

143
src/main/resources/static/assets/_js/pages/be_comp_charts.js

@ -0,0 +1,143 @@
/*
* Document : be_comp_charts.js
* Author : pixelcave
* Description: Custom JS code used in Charts Page
*/
// Chart.js Charts, for more examples you can check out http://www.chartjs.org/docs
class pageCompCharts {
/*
* Init Charts
*
*/
static initChartsChartJS() {
// Set Global Chart.js configuration
Chart.defaults.color = '#818d96';
Chart.defaults.scale.grid.color = "rgba(0,0,0,.04)";
Chart.defaults.scale.grid.zeroLineColor = "rgba(0,0,0,.1)";
Chart.defaults.scale.beginAtZero = true;
Chart.defaults.elements.line.borderWidth = 2;
Chart.defaults.elements.point.radius = 5;
Chart.defaults.elements.point.hoverRadius = 7;
Chart.defaults.plugins.tooltip.radius = 3;
Chart.defaults.plugins.legend.labels.boxWidth = 12;
// Get Chart Containers
let chartLinesCon = document.getElementById('js-chartjs-lines');
let chartBarsCon = document.getElementById('js-chartjs-bars');
let chartRadarCon = document.getElementById('js-chartjs-radar');
let chartPolarCon = document.getElementById('js-chartjs-polar');
let chartPieCon = document.getElementById('js-chartjs-pie');
let chartDonutCon = document.getElementById('js-chartjs-donut');
// Set Chart and Chart Data variables
let chartLines, chartBars, chartRadar, chartPolar, chartPie, chartDonut;
let chartLinesBarsRadarData, chartPolarPieDonutData;
// Lines/Bar/Radar Chart Data
chartLinesBarsRadarData = {
labels: ['MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT', 'SUN'],
datasets: [
{
label: 'This Week',
fill: true,
backgroundColor: 'rgba(6, 101, 208, .75)',
borderColor: 'rgba(6, 101, 208, 1)',
pointBackgroundColor: 'rgba(6, 101, 208, 1)',
pointBorderColor: '#fff',
pointHoverBackgroundColor: '#fff',
pointHoverBorderColor: 'rgba(6, 101, 208, 1)',
data: [34, 42, 62, 78, 39, 83, 98]
},
{
label: 'Last Week',
fill: true,
backgroundColor: 'rgba(108, 117, 125, .25)',
borderColor: 'rgba(108, 117, 125, .75)',
pointBackgroundColor: 'rgba(108, 117, 125, 1)',
pointBorderColor: '#fff',
pointHoverBackgroundColor: '#fff',
pointHoverBorderColor: 'rgba(108, 117, 125, 1)',
data: [130, 95, 125, 160, 187, 110, 143]
}
]
};
// Polar/Pie/Donut Data
chartPolarPieDonutData = {
labels: [
'Earnings',
'Sales',
'Tickets'
],
datasets: [{
data: [
65,
15,
20
],
backgroundColor: [
'rgba(141, 196, 81, 1)',
'rgba(255, 177, 25, 1)',
'rgba(224, 79, 26, 1)'
],
hoverBackgroundColor: [
'rgba(141, 196, 81, .5)',
'rgba(255, 177, 25, .5)',
'rgba(224, 79, 26, .5)'
]
}]
};
// Init Charts
if (chartLinesCon !== null) {
chartLines = new Chart(chartLinesCon, {type: 'line', data: chartLinesBarsRadarData, options: { responsive: true, maintainAspectRatio: false, tension: .4 }});
}
if (chartBarsCon !== null) {
chartBars = new Chart(chartBarsCon, {type: 'bar', data: chartLinesBarsRadarData, options: { responsive: true, maintainAspectRatio: false }});
}
if (chartRadarCon !== null) {
chartRadar = new Chart(chartRadarCon, {type: 'radar', data: chartLinesBarsRadarData, options: { responsive: true, maintainAspectRatio: false }});
}
if (chartPolarCon !== null) {
chartPolar = new Chart(chartPolarCon, {type: 'polarArea', data: chartPolarPieDonutData, options: { responsive: true, maintainAspectRatio: false }});
}
if (chartPieCon !== null) {
chartPie = new Chart(chartPieCon, {type: 'pie', data: chartPolarPieDonutData, options: { responsive: true, maintainAspectRatio: false }});
}
if (chartDonutCon !== null) {
chartDonut = new Chart(chartDonutCon, {type: 'doughnut', data: chartPolarPieDonutData, options: { responsive: true, maintainAspectRatio: false }});
}
}
/*
* Randomize Easy Pie Chart values
*
*/
static initRandomEasyPieChart() {
document.querySelectorAll('.js-pie-randomize').forEach(btn => {
btn.addEventListener('click', e => {
btn.closest('.block').querySelectorAll('.pie-chart').forEach(chart => {
jQuery(chart).data('easyPieChart').update(Math.floor((Math.random() * 100) + 1));
});
});
});
}
/*
* Init functionality
*
*/
static init() {
this.initChartsChartJS();
this.initRandomEasyPieChart();
}
}
// Initialize when page loads
Dashmix.onLoad(() => pageCompCharts.init());

156
src/main/resources/static/assets/_js/pages/be_comp_chat.js

@ -0,0 +1,156 @@
/*
* Document : be_comp_chat.js
* Author : pixelcave
* Description: Custom JS code used in Chat Page
*/
// Message Classes
let classesMsgBase = ['fs-sm', 'd-inline-block', 'fw-medium', 'animated', 'fadeIn', 'bg-body-light', 'border-3', 'px-3', 'py-2', 'mb-2', 'shadow-sm', 'mw-100'],
classesMsgSelf = ['border-end', 'border-primary', 'rounded-start', 'text-start'],
classesMsgOther = ['border-start', 'border-dark', 'rounded-end'],
classesMsgHeader = ['fs-sm', 'text-muted', 'animated', 'fadeIn', 'my-2'];
class pageCompChat {
/*
* Init chat
*
*/
static initChat() {
let self = this;
// Set variables
let chatForms = document.querySelectorAll('.js-chat-form form');
// Init form submission
chatForms.forEach(form => {
form.addEventListener('submit', e => {
// Stop form submission
e.preventDefault();
// Get chat input
let chatInput = e.currentTarget.querySelector('.js-chat-input');
// Add message
self.chatAddMessage(parseInt(chatInput.dataset.targetChatId), chatInput.value, 'self', chatInput);
});
});
}
/*
* Add a header message to a chat window
*
*/
static chatAddHeader(chatId, chatMsg, chatMsgLevel) {
// Get chat messages window
let chatWindow = document.querySelector('.js-chat-messages[data-chat-id="' + chatId + '"]');
// If header and chat window exists
if (chatMsg && chatWindow !== null) {
// Create new message elements and add the correct classes
let newChatMsgCon = document.createElement('div');
let newChatMsg = document.createElement('div');
classesMsgHeader.forEach(cls => {
newChatMsg.classList.add(cls);
});
if (chatMsgLevel === 'self') {
newChatMsg.classList.add('text-end');
newChatMsgCon.classList.add('ms-4');
} else {
newChatMsgCon.classList.add('me-4');
}
// Set text message
newChatMsg.innerText = chatMsg;
// Append message to chat window
newChatMsgCon.appendChild(newChatMsg);
chatWindow.appendChild(newChatMsgCon);
// Scroll the message list to the bottom
chatWindow.scrollTop = chatWindow.scrollHeight;
}
}
/*
* Add a message to a chat window
*
*/
static chatAddMessage(chatId, chatMsg, chatMsgLevel, chatInput) {
// Get chat messages window
let chatWindow = document.querySelector('.js-chat-messages[data-chat-id="' + chatId + '"]');
// If message and chat window exists
if (chatMsg && chatWindow !== null) {
// Create new message elements and add the correct classes
let newChatMsgCon = document.createElement('div');
let newChatMsg = document.createElement('div');
classesMsgBase.forEach(cls => {
newChatMsg.classList.add(cls);
});
if (chatMsgLevel === 'self') {
newChatMsgCon.classList.add('text-end');
newChatMsgCon.classList.add('ms-4');
classesMsgSelf.forEach(cls => {
newChatMsg.classList.add(cls);
});
} else {
newChatMsgCon.classList.add('me-4');
classesMsgOther.forEach(cls => {
newChatMsg.classList.add(cls);
});
}
// Set text message
newChatMsg.innerText = chatMsg;
// Append message to chat window
newChatMsgCon.appendChild(newChatMsg);
chatWindow.appendChild(newChatMsgCon);
// Scroll the message list to the bottom
chatWindow.scrollTop = chatWindow.scrollHeight;
// If input is set, reset it
if (chatInput !== null) {
chatInput.value = '';
}
}
}
/*
* Init functionality
*
*/
static init() {
this.initChat();
}
/*
* Add header
*
*/
static addHeader(chatId, chatMsg, chatMsgLevel = '') {
this.chatAddHeader(chatId, chatMsg, chatMsgLevel);
}
/*
* Add message
*
*/
static addMessage(chatId, chatMsg, chatMsgLevel = '') {
this.chatAddMessage(chatId, chatMsg, chatMsgLevel, null);
}
}
// Initialize when page loads
Dashmix.onLoad(() => {
pageCompChat.init();
window.Chat = pageCompChat;
});

106
src/main/resources/static/assets/_js/pages/be_comp_dialogs.js

@ -0,0 +1,106 @@
/*
* Document : be_comp_dialogs.js
* Author : pixelcave
* Description: Custom JS code used in Dialogs Page
*/
// SweetAlert2, for more examples you can check out https://github.com/sweetalert2/sweetalert2
class pageDialogs {
/*
* SweetAlert2 demo functionality
*
*/
static sweetAlert2() {
// Set default properties
let toast = Swal.mixin({
buttonsStyling: false,
target: '#page-container',
customClass: {
confirmButton: 'btn btn-success m-1',
cancelButton: 'btn btn-danger m-1',
input: 'form-control'
}
});
// Init a simple dialog on button click
document.querySelector('.js-swal-simple').addEventListener('click', e => {
toast.fire('Hi, this is just a simple message!');
});
// Init an success dialog on button click
document.querySelector('.js-swal-success').addEventListener('click', e => {
toast.fire('Success', 'Everything was updated perfectly!', 'success');
});
// Init an info dialog on button click
document.querySelector('.js-swal-info').addEventListener('click', e => {
toast.fire('Info', 'Just an informational message!', 'info');
});
// Init an warning dialog on button click
document.querySelector('.js-swal-warning').addEventListener('click', e => {
toast.fire('Warning', 'Something needs your attention!', 'warning');
});
// Init an error dialog on button click
document.querySelector('.js-swal-error').addEventListener('click', e => {
toast.fire('Oops...', 'Something went wrong!', 'error');
});
// Init an question dialog on button click
document.querySelector('.js-swal-question').addEventListener('click', e => {
toast.fire('Question', 'Are you sure about that?', 'question');
});
// Init an example confirm dialog on button click
document.querySelector('.js-swal-confirm').addEventListener('click', e => {
toast.fire({
title: 'Are you sure?',
text: 'You will not be able to recover this imaginary file!',
icon: 'warning',
showCancelButton: true,
customClass: {
confirmButton: 'btn btn-danger m-1',
cancelButton: 'btn btn-secondary m-1'
},
confirmButtonText: 'Yes, delete it!',
html: false,
preConfirm: e => {
return new Promise(resolve => {
setTimeout(() => {
resolve();
}, 50);
});
}
}).then(result => {
if (result.value) {
toast.fire('Deleted!', 'Your imaginary file has been deleted.', 'success');
// result.dismiss can be 'overlay', 'cancel', 'close', 'esc', 'timer'
} else if (result.dismiss === 'cancel') {
toast.fire('Cancelled', 'Your imaginary file is safe :)', 'error');
}
});
});
// Init an example confirm alert on button click
document.querySelector('.js-swal-custom-position').addEventListener('click', e => {
toast.fire({
position: 'top-end',
title: 'Perfect!',
text: 'Nice Position!',
icon: 'success'
});
});
}
/*
* Init functionality
*
*/
static init() {
this.sweetAlert2();
}
}
// Initialize when page loads
Dashmix.onLoad(() => pageDialogs.init());

88
src/main/resources/static/assets/_js/pages/be_comp_image_cropper.js

@ -0,0 +1,88 @@
/*
* Document : be_comp_image_cropper.js
* Author : pixelcave
* Description: Custom JS code used in Image Cropper Page
*/
// Image Cropper, for more examples you can check out https://fengyuanchen.github.io/cropperjs/
class pageCompImageCropper {
/*
* Init image cropper demo functionality
*
*/
static initImageCropper() {
// Get Image Container
let image = document.getElementById('js-img-cropper');
// Set Options
Cropper.setDefaults({
aspectRatio: 4 / 3,
preview: '.js-img-cropper-preview'
});
// Init Image Cropper
let cropper = new Cropper(image, {
crop: function (e) {
// e.detail contains all data required to crop the image server side
// You will have to send it to your custom server side script and crop the image there
// Since this event is fired each time you set the crop section, you could also use getData()
// method on demand. Please check out https://fengyuanchen.github.io/cropperjs/ for more info
// console.log(e.detail);
}
});
// Mini Cropper API
document.querySelectorAll('[data-toggle="cropper"]').forEach(btn => {
btn.addEventListener('click', e => {
let method = btn.dataset.method || false;
let option = btn.dataset.option || false;
// Method selection with object literals
let cropperAPI = {
zoom: () => {
cropper.zoom(option);
},
setDragMode: () => {
cropper.setDragMode(option);
},
rotate: () => {
cropper.rotate(option);
},
scaleX: () => {
cropper.scaleX(option);
btn.dataset.option = -(option);
},
scaleY: () => {
cropper.scaleY(option);
btn.dataset.option = -(option);
},
setAspectRatio: () => {
cropper.setAspectRatio(option);
},
crop: () => {
cropper.crop();
},
clear: () => {
cropper.clear();
}
};
// If method exists, execute it
if (cropperAPI[method]) {
cropperAPI[method]();
}
});
});
}
/*
* Init functionality
*
*/
static init() {
this.initImageCropper();
}
}
// Initialize when page loads
Dashmix.onLoad(() => pageCompImageCropper.init());

154
src/main/resources/static/assets/_js/pages/be_comp_maps_vector.js

@ -0,0 +1,154 @@
/*
* Document : be_comp_maps_vector.js
* Author : pixelcave
* Description: Custom JS code used in Vector Maps Page
*/
// Set default options for all maps
let mapOptions = {
map: '',
backgroundColor: '#ffffff',
regionStyle: {
initial: {
fill: '#1F75D5',
'fill-opacity': 1,
stroke: 'none',
'stroke-width': 0,
'stroke-opacity': 1
},
hover: {
'fill-opacity': .8,
cursor: 'pointer'
}
}
};
// jVectorMap, for more examples you can check out http://jvectormap.com/documentation/
class pageCompMapsVector {
/*
* Init World Map
*
*/
static initMapWorld() {
// Set Active Map
mapOptions['map'] = 'world_mill_en';
// Init Map
jQuery('.js-vector-map-world').vectorMap(mapOptions);
}
/*
* Init Europe Map
*
*/
static initMapEurope() {
// Set Active Map
mapOptions['map'] = 'europe_mill_en';
// Init Map
jQuery('.js-vector-map-europe').vectorMap(mapOptions);
}
/*
* Init USA Map
*
*/
static initMapUsa() {
// Set Active Map
mapOptions['map'] = 'us_aea_en';
// Init Map
jQuery('.js-vector-map-usa').vectorMap(mapOptions);
}
/*
* Init India Map
*
*/
static initMapIndia() {
// Set Active Map
mapOptions['map'] = 'in_mill_en';
// Init Map
jQuery('.js-vector-map-india').vectorMap(mapOptions);
}
/*
* Init China Map
*
*/
static initMapChina() {
// Set Active Map
mapOptions['map'] = 'cn_mill_en';
// Init Map
jQuery('.js-vector-map-china').vectorMap(mapOptions);
}
/*
* Init Australia Map
*
*/
static initMapAustralia() {
// Set Active Map
mapOptions['map'] = 'au_mill_en';
// Init Map
jQuery('.js-vector-map-australia').vectorMap(mapOptions);
}
/*
* Init South Africa Map
*
*/
static initMapSouthAfrica() {
// Set Active Map
mapOptions['map'] = 'za_mill_en';
// Init Map
jQuery('.js-vector-map-south-africa').vectorMap(mapOptions);
}
/*
* Init France Map
*
*/
static initMapFrance() {
// Set Active Map
mapOptions['map'] = 'fr_mill_en';
// Init Map
jQuery('.js-vector-map-france').vectorMap(mapOptions);
}
/*
* Init Germany Map
*
*/
static initMapGermany() {
// Set Active Map
mapOptions['map'] = 'de_mill_en';
// Init Map
jQuery('.js-vector-map-germany').vectorMap(mapOptions);
}
/*
* Init functionality
*
*/
static init() {
this.initMapWorld();
this.initMapEurope();
this.initMapUsa();
this.initMapIndia();
this.initMapChina();
this.initMapAustralia();
this.initMapSouthAfrica();
this.initMapFrance();
this.initMapGermany();
}
}
// Initialize when page loads
Dashmix.onLoad(() => pageCompMapsVector.init());

47
src/main/resources/static/assets/_js/pages/be_comp_nestable.js

@ -0,0 +1,47 @@
/*
* Document : be_comp_nestable.js
* Author : pixelcave
* Description: Custom JS code used in Nestable Page
*/
// Nestable2, for more examples you can check out https://github.com/RamonSmit/Nestable2
class pageCompNestable {
/*
* Nestable2 demo functionality
*
*/
static nestable2() {
// Init Connected Lists
jQuery('.js-nestable-connected-simple').
add('.js-nestable-connected-icons').
add('.js-nestable-connected-treeview').nestable({
group: 0
});
// Init Simple List
jQuery('.js-nestable-simple').nestable({
group: 1
});
// Init Icons List
jQuery('.js-nestable-icons').nestable({
group: 2
});
// Init Tree View List
jQuery('.js-nestable-treeview').nestable({
group: 3
});
}
/*
* Init functionality
*
*/
static init() {
this.nestable2();
}
}
// Initialize when page loads
Dashmix.onLoad(() => pageCompNestable.init());

41
src/main/resources/static/assets/_js/pages/be_comp_onboarding.js

@ -0,0 +1,41 @@
/*
* Document : be_comp_onboarding.js
* Author : pixelcave
* Description: Custom JS code used in Onboarding Page
*/
// Onboarding Modal using Bootstrap Modal and Slick slider
class pageCompOnboarding {
/*
* Init example onboarding modal functionality
*
*/
static initOnboardingModal() {
// Get onboarding modal
let modalEl = document.getElementById('modal-onboarding');
let modal = new bootstrap.Modal(modalEl);
// Show Onboarding Modal by default
modal.show();
// Re-init Slick Slider every time the modal is shown
modalEl.addEventListener('shown.bs.modal', e => {
// Remove enabled class added by the helper to prevent re-init
document.querySelector('#modal-onboarding .js-slider').classList.remove('js-slider-enabled');
// Re-init Slick Slider
Dashmix.helpers('jq-slick');
});
}
/*
* Init functionality
*
*/
static init() {
this.initOnboardingModal();
}
}
// Initialize when page loads
Dashmix.onLoad(() => pageCompOnboarding.init());

50
src/main/resources/static/assets/_js/pages/be_comp_rating.js

@ -0,0 +1,50 @@
/*
* Document : be_comp_rating.js
* Author : pixelcave
* Description: Custom JS code used in Rating Page
*/
// jQuery Raty, for more examples you can check out https://github.com/wbotelhos/raty
class pageCompRating {
/*
* Init demo rating functionality
*
*/
static initRating() {
// Init Raty on .js-rating class
jQuery('.js-rating').each((index, element) => {
let el = jQuery(element);
el.raty({
score: el.data('score') || 0,
number: el.data('number') || 5,
cancel: el.data('cancel') || false,
target: el.data('target') || false,
targetScore: el.data('target-score') || false,
precision: el.data('precision') || false,
cancelOff: el.data('cancel-off') || 'fa fa-fw fa-times-circle text-danger',
cancelOn: el.data('cancel-on') || 'fa fa-fw fa-times-circle',
starHalf: el.data('star-half') || 'fa fa-fw fa-star-half text-warning',
starOff: el.data('star-off') || 'fa fa-fw fa-star text-muted',
starOn: el.data('star-on') || 'fa fa-fw fa-star text-warning',
starType: 'i',
hints: ['Just Bad!', 'Almost There!', 'It’s ok!', 'That’s nice!', 'Incredible!'],
click: function (score, evt) {
// Here you could add your logic on rating click
// console.log('ID: ' + this.id + "\nscore: " + score + "\nevent: " + evt);
}
});
});
}
/*
* Init functionality
*
*/
static init() {
this.initRating();
}
}
// Initialize when page loads
Dashmix.onLoad(() => pageCompRating.init());

124
src/main/resources/static/assets/_js/pages/be_forms_validation.js

@ -0,0 +1,124 @@
/*
* Document : be_forms_validation.js
* Author : pixelcave
* Description: Custom JS code used in Forms Validation Page
*/
// Form Validation, for more examples you can check out https://github.com/jzaefferer/jquery-validation
class pageFormsValidation {
/*
* Init Validation functionality
*
*/
static initValidation() {
// Load default options for jQuery Validation plugin
Dashmix.helpers('jq-validation');
// Init Form Validation
jQuery('.js-validation').validate({
ignore: [],
rules: {
'val-username': {
required: true,
minlength: 3
},
'val-email': {
required: true,
emailWithDot: true
},
'val-password': {
required: true,
minlength: 5
},
'val-confirm-password': {
required: true,
equalTo: '#val-password'
},
'val-suggestions': {
required: true,
minlength: 5
},
'val-skill': {
required: true
},
'val-currency': {
required: true,
currency: ['$', true]
},
'val-website': {
required: true,
url: true
},
'val-phoneus': {
required: true,
phoneUS: true
},
'val-digits': {
required: true,
digits: true
},
'val-number': {
required: true,
number: true
},
'val-range': {
required: true,
range: [1, 5]
},
'val-terms': {
required: true
},
'val-select2': {
required: true
},
'val-select2-multiple': {
required: true,
minlength: 2
}
},
messages: {
'val-username': {
required: 'Please enter a username',
minlength: 'Your username must consist of at least 3 characters'
},
'val-email': 'Please enter a valid email address',
'val-password': {
required: 'Please provide a password',
minlength: 'Your password must be at least 5 characters long'
},
'val-confirm-password': {
required: 'Please provide a password',
minlength: 'Your password must be at least 5 characters long',
equalTo: 'Please enter the same password as above'
},
'val-select2': 'Please select a value!',
'val-select2-multiple': 'Please select at least 2 values!',
'val-suggestions': 'What can we do to become better?',
'val-skill': 'Please select a skill!',
'val-currency': 'Please enter a price!',
'val-website': 'Please enter your website!',
'val-phoneus': 'Please enter a US phone!',
'val-digits': 'Please enter only digits!',
'val-number': 'Please enter a number!',
'val-range': 'Please enter a number between 1 and 5!',
'val-terms': 'You must agree to the service terms!'
}
});
// Init Validation on Select2 change
jQuery('.js-select2').on('change', e => {
jQuery(e.currentTarget).valid();
});
}
/*
* Init functionality
*
*/
static init() {
this.initValidation();
}
}
// Initialize when page loads
Dashmix.onLoad(() => pageFormsValidation.init());

89
src/main/resources/static/assets/_js/pages/be_pages_dashboard.js

@ -0,0 +1,89 @@
/*
* Document : be_pages_dashboard.js
* Author : pixelcave
* Description: Custom JS code used in Default Dashboard Page
*/
// Chart.js Charts, for more examples you can check out http://www.chartjs.org/docs
class pageDashboard {
/*
* Init Charts
*
*/
static initChartsBars() {
// Set Global Chart.js configuration
Chart.defaults.color = '#818d96';
Chart.defaults.scale.grid.color = 'transparent';
Chart.defaults.scale.grid.zeroLineColor = 'transparent';
Chart.defaults.scale.beginAtZero = true;
Chart.defaults.elements.line.borderWidth = 1;
Chart.defaults.plugins.legend.labels.boxWidth = 12;
// Get Chart Containers
let chartBarsCon = document.getElementById('js-chartjs-analytics-bars');
// Set Chart and Chart Data variables
let chartBars, chartLinesBarsData;
// Bars Chart Data
chartLinesBarsData = {
labels: ['MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT', 'SUN'],
datasets: [
{
label: 'This Week',
fill: true,
backgroundColor: 'rgba(6, 101, 208, .6)',
borderColor: 'transparent',
pointBackgroundColor: 'rgba(6, 101, 208, 1)',
pointBorderColor: '#fff',
pointHoverBackgroundColor: '#fff',
pointHoverBorderColor: 'rgba(6, 101, 208, 1)',
data: [73, 68, 69, 53, 60, 72, 82]
},
{
label: 'Last Week',
fill: true,
backgroundColor: 'rgba(6, 101, 208, .2)',
borderColor: 'transparent',
pointBackgroundColor: 'rgba(6, 101, 208, .2)',
pointBorderColor: '#fff',
pointHoverBackgroundColor: '#fff',
pointHoverBorderColor: 'rgba(6, 101, 208, .2)',
data: [62, 32, 59, 55, 52, 56, 73]
}
]
};
// Init Chart
if (chartBarsCon !== null) {
chartBars = new Chart(chartBarsCon, {
type: 'bar',
data: chartLinesBarsData,
options: {
responsive: true,
maintainAspectRatio: false,
plugins: {
tooltip: {
callbacks: {
label: function (context) {
return context.dataset.label + ': ' + context.parsed.y + ' Customers';
}
}
}
}
}
});
}
}
/*
* Init functionality
*
*/
static init() {
this.initChartsBars();
}
}
// Initialize when page loads
Dashmix.onLoad(() => pageDashboard.init());

225
src/main/resources/static/assets/_js/pages/be_pages_dashboard_v1.js

@ -0,0 +1,225 @@
/*
* Document : be_pages_dashboard.js
* Author : pixelcave
* Description: Custom JS code used in default Dashboard v1 Page
*/
// Chart.js Charts, for more examples you can check out http://www.chartjs.org/docs
class pageDashboardv1 {
/*
* Init Charts
*
*/
static initChartsMain() {
// Set Global Chart.js configuration
Chart.defaults.color = '#818d96';
Chart.defaults.scale.grid.color = 'transparent';
Chart.defaults.scale.grid.zeroLineColor = 'transparent';
Chart.defaults.scale.display = false;
Chart.defaults.scale.beginAtZero = true;
Chart.defaults.elements.point.radius = 0;
Chart.defaults.elements.point.hoverRadius = 0;
Chart.defaults.plugins.tooltip.radius = 3;
Chart.defaults.plugins.legend.labels.boxWidth = 12;
// Get Chart Containers
let chartMainCon = document.getElementById('js-chartjs-dashboard-earnings');
// Set Main Chart variables
let chartMain, chartMainOptions, chartMainData, chartMainDataYear, chartMainDataMonth, chartMainDataWeek;
// Main Chart Options
chartMainOptions = {
responsive: true,
maintainAspectRatio: false,
tension: .4,
scales: {
y: {
suggestedMin: 0,
suggestedMax: 260
}
},
interaction: {
intersect: false,
},
plugins: {
tooltip: {
callbacks: {
label: function (context) {
return ' ' + context.parsed.y + ' Sales';
}
}
}
}
};
// Main Chart Default Data
chartMainData = {
labels: ['JAN', 'FEB', 'MAR', 'APR', 'MAY', 'JUN', 'JUL', 'AUG', 'SEP', 'OCT', 'NOV', 'DEC'],
datasets: [
{
label: 'This Year',
fill: true,
backgroundColor: 'rgba(6, 101, 208, .5)',
borderColor: 'transparent',
pointBackgroundColor: 'rgba(6, 101, 208, 1)',
pointBorderColor: '#fff',
pointHoverBackgroundColor: '#fff',
pointHoverBorderColor: 'rgba(6, 101, 208, 1)',
data: [50, 210, 110, 90, 230, 130, 190, 75, 155, 120, 140, 230]
},
{
label: 'Last Year',
fill: true,
backgroundColor: 'rgba(6, 101, 208, .2)',
borderColor: 'transparent',
pointBackgroundColor: 'rgba(6, 101, 208, .2)',
pointBorderColor: '#fff',
pointHoverBackgroundColor: '#fff',
pointHoverBorderColor: 'rgba(6, 101, 208, .2)',
data: [210, 150, 90, 220, 150, 216, 143, 150, 240, 230, 136, 150]
}
]
};
// Main Chart for Year
chartMainDataYear = {
labels: ['JAN', 'FEB', 'MAR', 'APR', 'MAY', 'JUN', 'JUL', 'AUG', 'SEP', 'OCT', 'NOV', 'DEC'],
datasets: [
{
label: 'This Year',
fill: true,
backgroundColor: 'rgba(6, 101, 208, .5)',
borderColor: 'transparent',
pointBackgroundColor: 'rgba(6, 101, 208, 1)',
pointBorderColor: '#fff',
pointHoverBackgroundColor: '#fff',
pointHoverBorderColor: 'rgba(6, 101, 208, 1)',
data: [50, 210, 110, 90, 230, 130, 190, 75, 155, 120, 140, 230]
},
{
label: 'Last Year',
fill: true,
backgroundColor: 'rgba(6, 101, 208, .2)',
borderColor: 'transparent',
pointBackgroundColor: 'rgba(6, 101, 208, .2)',
pointBorderColor: '#fff',
pointHoverBackgroundColor: '#fff',
pointHoverBorderColor: 'rgba(6, 101, 208, .2)',
data: [210, 150, 90, 220, 150, 216, 143, 150, 240, 230, 136, 150]
}
]
};
// Set up month labels
let chartMainDataMonthLabels = [];
for (let i = 0; i < 30; i++) {
chartMainDataMonthLabels[i] = (i === 29) ? '1 day ago' : (30 - i) + ' days ago';
}
// Main Chart Data for Month
chartMainDataMonth = {
labels: chartMainDataMonthLabels,
datasets: [
{
label: 'This Month',
fill: true,
backgroundColor: 'rgba(6, 101, 208, .5)',
borderColor: 'transparent',
pointBackgroundColor: 'rgba(6, 101, 208, 1)',
pointBorderColor: '#fff',
pointHoverBackgroundColor: '#fff',
pointHoverBorderColor: 'rgba(6, 101, 208, 1)',
data: [50, 210, 110, 90, 230, 130, 190, 75, 155, 120, 140, 230, 50, 210, 110, 90, 230, 130, 155, 120, 140, 230, 50, 210, 110, 90, 230, 130, 190, 75]
},
{
label: 'Last Month',
fill: true,
backgroundColor: 'rgba(6, 101, 208, .2)',
borderColor: 'transparent',
pointBackgroundColor: 'rgba(6, 101, 208, .2)',
pointBorderColor: '#fff',
pointHoverBackgroundColor: '#fff',
pointHoverBorderColor: 'rgba(6, 101, 208, .2)',
data: [210, 150, 90, 220, 150, 216, 143, 150, 136, 150, 210, 150, 90, 220, 150, 216, 240, 230, 136, 150, 210, 150, 90, 220, 150, 216, 143, 150, 240, 230]
}
]
};
// Main Chart Data for Week
chartMainDataWeek = {
labels: ['MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT', 'SUN'],
datasets: [
{
label: 'This Week',
fill: true,
backgroundColor: 'rgba(6, 101, 208, .5)',
borderColor: 'transparent',
pointBackgroundColor: 'rgba(6, 101, 208, 1)',
pointBorderColor: '#fff',
pointHoverBackgroundColor: '#fff',
pointHoverBorderColor: 'rgba(6, 101, 208, 1)',
data: [34, 42, 62, 78, 39, 83, 98]
},
{
label: 'Last Week',
fill: true,
backgroundColor: 'rgba(6, 101, 208, .2)',
borderColor: 'transparent',
pointBackgroundColor: 'rgba(6, 101, 208, .2)',
pointBorderColor: '#fff',
pointHoverBackgroundColor: '#fff',
pointHoverBorderColor: 'rgba(6, 101, 208, .2)',
data: [130, 95, 125, 160, 187, 110, 143]
}
]
};
// Init Main Chart
if (chartMainCon !== null) {
chartMain = new Chart(chartMainCon, {
type: 'line',
data: chartMainData,
options: chartMainOptions
});
}
// Toggle to Week data
document.querySelector('[data-toggle="dashboard-chart-set-week"]').addEventListener('click', () => {
chartMain.data.labels = chartMainDataWeek.labels;
chartMain.data.datasets[0] = chartMainDataWeek.datasets[0];
chartMain.data.datasets[1] = chartMainDataWeek.datasets[1];
chartMain.update();
});
// Toggle to Month data
document.querySelector('[data-toggle="dashboard-chart-set-month"]').addEventListener('click', () => {
chartMain.data.labels = chartMainDataMonth.labels;
chartMain.data.datasets[0] = chartMainDataMonth.datasets[0];
chartMain.data.datasets[1] = chartMainDataMonth.datasets[1];
chartMain.update();
});
// Toggle to Year data
document.querySelector('[data-toggle="dashboard-chart-set-year"]').addEventListener('click', () => {
chartMain.data.labels = chartMainDataYear.labels;
chartMain.data.datasets[0] = chartMainDataYear.datasets[0];
chartMain.data.datasets[1] = chartMainDataYear.datasets[1];
chartMain.update();
});
}
/*
* Init functionality
*
*/
static init() {
this.initChartsMain();
}
}
// Initialize when page loads
jQuery(() => {
pageDashboardv1.init();
});

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save