-
2.gitattributes
-
33.gitignore
-
3.mvn/wrapper/maven-wrapper.properties
-
BINgcc_mobile_service_uploads/street_vendor_files/2025/12/aadhar_back_19122025111222_duck-7406987.jpg
-
BINgcc_mobile_service_uploads/street_vendor_files/2025/12/aadhar_back_19122025154033_joban-khangura-hG8B9pKiilw-unsplash.jpg
-
BINgcc_mobile_service_uploads/street_vendor_files/2025/12/aadhar_front_19122025111222_vladislav-bychkov-88i07ldDamc-unsplash.jpg
-
BINgcc_mobile_service_uploads/street_vendor_files/2025/12/aadhar_front_19122025154033_duck-7406987.jpg
-
BINgcc_mobile_service_uploads/street_vendor_files/2025/12/street_vendor_bank_19122025111221_newuser.jpg
-
BINgcc_mobile_service_uploads/street_vendor_files/2025/12/street_vendor_bank_19122025154033_checklist_report_20251217_174232.pdf
-
BINgcc_mobile_service_uploads/street_vendor_files/2025/12/street_vendor_photo_19122025111221_joban-khangura-hG8B9pKiilw-unsplash.jpg
-
BINgcc_mobile_service_uploads/street_vendor_files/2025/12/street_vendor_photo_19122025154033_checklist_report_20251217_173554.pdf
-
BINgcc_mobile_service_uploads/street_vendor_files/2025/12/street_vendor_ration_19122025111221_janne-aspegren-2ozvYo7shSA-unsplash.jpg
-
BINgcc_mobile_service_uploads/street_vendor_files/2025/12/street_vendor_ration_19122025154033_bird.jpg
-
BINgcc_mobile_service_uploads/street_vendor_files/2026/01/aadhar_back_02012026144310_checklist_report_20251220_112845.pdf
-
BINgcc_mobile_service_uploads/street_vendor_files/2026/01/aadhar_back_02012026144459_checklist_report_20251220_112845.pdf
-
BINgcc_mobile_service_uploads/street_vendor_files/2026/01/aadhar_front_02012026144310_polling_personnel_details_20251129_132440.pdf
-
BINgcc_mobile_service_uploads/street_vendor_files/2026/01/aadhar_front_02012026144459_polling_personnel_details_20251129_132440.pdf
-
BINgcc_mobile_service_uploads/street_vendor_files/2026/01/street_vendor_bank_02012026144310_Hall.jpg
-
BINgcc_mobile_service_uploads/street_vendor_files/2026/01/street_vendor_bank_02012026144459_Hall.jpg
-
BINgcc_mobile_service_uploads/street_vendor_files/2026/01/street_vendor_photo_02012026144310_newuser.jpg
-
BINgcc_mobile_service_uploads/street_vendor_files/2026/01/street_vendor_photo_02012026144459_newuser.jpg
-
BINgcc_mobile_service_uploads/street_vendor_files/2026/01/street_vendor_ration_02012026144310_1st_order_report_20251220_110917.pdf
-
BINgcc_mobile_service_uploads/street_vendor_files/2026/01/street_vendor_ration_02012026144459_1st_order_report_20251220_110917.pdf
-
BINgcc_mobile_service_uploads/street_vendor_files/2026/02/aadhar_back_20022026095319_vladislav-bychkov-88i07ldDamc-unsplash.jpg
-
BINgcc_mobile_service_uploads/street_vendor_files/2026/02/aadhar_back_20022026095407_vladislav-bychkov-88i07ldDamc-unsplash.jpg
-
BINgcc_mobile_service_uploads/street_vendor_files/2026/02/aadhar_back_20022026152005_duck-7406987.jpg
-
BINgcc_mobile_service_uploads/street_vendor_files/2026/02/aadhar_back_21022026103321_duck-7406987.jpg
-
BINgcc_mobile_service_uploads/street_vendor_files/2026/02/aadhar_back_24022026174727_bird.jpg
-
BINgcc_mobile_service_uploads/street_vendor_files/2026/02/aadhar_front_20022026095319_bird.jpg
-
BINgcc_mobile_service_uploads/street_vendor_files/2026/02/aadhar_front_20022026095407_bird.jpg
-
BINgcc_mobile_service_uploads/street_vendor_files/2026/02/aadhar_front_20022026152005_bird.jpg
-
BINgcc_mobile_service_uploads/street_vendor_files/2026/02/aadhar_front_21022026103321_bird.jpg
-
BINgcc_mobile_service_uploads/street_vendor_files/2026/02/aadhar_front_24022026174727_bird.jpg
-
BINgcc_mobile_service_uploads/street_vendor_files/2026/02/street_vendor_bank_20022026152005_bird.jpg
-
BINgcc_mobile_service_uploads/street_vendor_files/2026/02/street_vendor_bank_24022026174727_bird.jpg
-
BINgcc_mobile_service_uploads/street_vendor_files/2026/02/street_vendor_photo_20022026095319_joban-khangura-hG8B9pKiilw-unsplash.jpg
-
BINgcc_mobile_service_uploads/street_vendor_files/2026/02/street_vendor_photo_20022026095407_joban-khangura-hG8B9pKiilw-unsplash.jpg
-
BINgcc_mobile_service_uploads/street_vendor_files/2026/02/street_vendor_photo_20022026152005_bird.jpg
-
BINgcc_mobile_service_uploads/street_vendor_files/2026/02/street_vendor_photo_21022026103321_bird.jpg
-
BINgcc_mobile_service_uploads/street_vendor_files/2026/02/street_vendor_photo_24022026174727_bird.jpg
-
BINgcc_mobile_service_uploads/street_vendor_files/2026/02/street_vendor_ration_20022026095319_joban-khangura-hG8B9pKiilw-unsplash.jpg
-
BINgcc_mobile_service_uploads/street_vendor_files/2026/02/street_vendor_ration_20022026095407_joban-khangura-hG8B9pKiilw-unsplash.jpg
-
BINgcc_mobile_service_uploads/street_vendor_files/2026/02/street_vendor_ration_20022026152005_bird.jpg
-
BINgcc_mobile_service_uploads/street_vendor_files/2026/02/street_vendor_ration_21022026103321_janne-aspegren-2ozvYo7shSA-unsplash.jpg
-
BINgcc_mobile_service_uploads/street_vendor_files/2026/02/street_vendor_ration_24022026174727_bird.jpg
-
295mvnw
-
189mvnw.cmd
-
87pom.xml
-
13src/main/java/com/gcc/streetvendorlicense/StreetvendorlicenseApplication.java
-
39src/main/java/com/gcc/streetvendorlicense/configuration/AppConfig.java
-
59src/main/java/com/gcc/streetvendorlicense/configuration/DataSourceConfig.java
-
18src/main/java/com/gcc/streetvendorlicense/configuration/GlobalAttributes.java
-
44src/main/java/com/gcc/streetvendorlicense/configuration/QrGenerator.java
-
109src/main/java/com/gcc/streetvendorlicense/controller/MainController.java
-
106src/main/java/com/gcc/streetvendorlicense/controller/OtpController.java
-
312src/main/java/com/gcc/streetvendorlicense/controller/licenseApicontroller.java
-
247src/main/java/com/gcc/streetvendorlicense/dto/VendorRequest.java
-
35src/main/java/com/gcc/streetvendorlicense/service/DateTimeUtil.java
-
838src/main/java/com/gcc/streetvendorlicense/service/licenseService.java
-
24src/main/resources/application-dev.properties
-
25src/main/resources/application-prod.properties
-
3src/main/resources/application.properties
-
BINsrc/main/resources/favicon.ico
-
65src/main/resources/static/assets/_js/main/app.js
-
1110src/main/resources/static/assets/_js/main/modules/helpers.js
-
802src/main/resources/static/assets/_js/main/modules/template.js
-
179src/main/resources/static/assets/_js/pages/be_comp_calendar.js
-
143src/main/resources/static/assets/_js/pages/be_comp_charts.js
-
156src/main/resources/static/assets/_js/pages/be_comp_chat.js
-
106src/main/resources/static/assets/_js/pages/be_comp_dialogs.js
-
88src/main/resources/static/assets/_js/pages/be_comp_image_cropper.js
-
154src/main/resources/static/assets/_js/pages/be_comp_maps_vector.js
-
47src/main/resources/static/assets/_js/pages/be_comp_nestable.js
-
41src/main/resources/static/assets/_js/pages/be_comp_onboarding.js
-
50src/main/resources/static/assets/_js/pages/be_comp_rating.js
-
124src/main/resources/static/assets/_js/pages/be_forms_validation.js
-
89src/main/resources/static/assets/_js/pages/be_pages_dashboard.js
-
225src/main/resources/static/assets/_js/pages/be_pages_dashboard_v1.js
-
104src/main/resources/static/assets/_js/pages/be_pages_ecom_dashboard.js
-
271src/main/resources/static/assets/_js/pages/be_pages_projects_tasks.js
-
101src/main/resources/static/assets/_js/pages/be_tables_datatables.js
-
45src/main/resources/static/assets/_js/pages/be_ui_animations.js
-
2184src/main/resources/static/assets/_js/pages/be_ui_icons.js
-
41src/main/resources/static/assets/_js/pages/be_ui_progress.js
-
73src/main/resources/static/assets/_js/pages/db_analytics.js
-
144src/main/resources/static/assets/_js/pages/db_corporate_slim.js
-
93src/main/resources/static/assets/_js/pages/db_crypto.js
-
42src/main/resources/static/assets/_js/pages/op_auth_lock.js
-
42src/main/resources/static/assets/_js/pages/op_auth_reminder.js
-
51src/main/resources/static/assets/_js/pages/op_auth_signin.js
-
69src/main/resources/static/assets/_js/pages/op_auth_signup.js
-
34src/main/resources/static/assets/_js/pages/op_coming_soon.js
-
78src/main/resources/static/assets/_js/pages/op_installation.js
-
149src/main/resources/static/assets/_scss/bootstrap/_accordion.scss
-
71src/main/resources/static/assets/_scss/bootstrap/_alert.scss
-
38src/main/resources/static/assets/_scss/bootstrap/_badge.scss
-
40src/main/resources/static/assets/_scss/bootstrap/_breadcrumb.scss
-
142src/main/resources/static/assets/_scss/bootstrap/_button-group.scss
-
207src/main/resources/static/assets/_scss/bootstrap/_buttons.scss
-
234src/main/resources/static/assets/_scss/bootstrap/_card.scss
@ -0,0 +1,2 @@ |
|||
/mvnw text eol=lf |
|||
*.cmd text eol=crlf |
|||
@ -0,0 +1,33 @@ |
|||
HELP.md |
|||
target/ |
|||
.mvn/wrapper/maven-wrapper.jar |
|||
!**/src/main/**/target/ |
|||
!**/src/test/**/target/ |
|||
|
|||
### STS ### |
|||
.apt_generated |
|||
.classpath |
|||
.factorypath |
|||
.project |
|||
.settings |
|||
.springBeans |
|||
.sts4-cache |
|||
|
|||
### IntelliJ IDEA ### |
|||
.idea |
|||
*.iws |
|||
*.iml |
|||
*.ipr |
|||
|
|||
### NetBeans ### |
|||
/nbproject/private/ |
|||
/nbbuild/ |
|||
/dist/ |
|||
/nbdist/ |
|||
/.nb-gradle/ |
|||
build/ |
|||
!**/src/main/**/build/ |
|||
!**/src/test/**/build/ |
|||
|
|||
### VS Code ### |
|||
.vscode/ |
|||
@ -0,0 +1,3 @@ |
|||
wrapperVersion=3.3.4 |
|||
distributionType=only-script |
|||
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.11/apache-maven-3.9.11-bin.zip |
|||
|
After Width: 5401 | Height: 3601 | Size: 3.2 MiB |
|
After Width: 2400 | Height: 3001 | Size: 2.5 MiB |
|
After Width: 3072 | Height: 4608 | Size: 1.7 MiB |
|
After Width: 5401 | Height: 3601 | Size: 3.2 MiB |
|
After Width: 1440 | Height: 1482 | Size: 102 KiB |
|
After Width: 2400 | Height: 3001 | Size: 2.5 MiB |
|
After Width: 2400 | Height: 3600 | Size: 915 KiB |
|
After Width: 1280 | Height: 897 | Size: 191 KiB |
|
After Width: 1771 | Height: 997 | Size: 1.6 MiB |
|
After Width: 1771 | Height: 997 | Size: 1.6 MiB |
|
After Width: 1440 | Height: 1482 | Size: 102 KiB |
|
After Width: 1440 | Height: 1482 | Size: 102 KiB |
|
After Width: 3072 | Height: 4608 | Size: 1.7 MiB |
|
After Width: 3072 | Height: 4608 | Size: 1.7 MiB |
|
After Width: 5401 | Height: 3601 | Size: 3.2 MiB |
|
After Width: 5401 | Height: 3601 | Size: 3.2 MiB |
|
After Width: 1280 | Height: 897 | Size: 191 KiB |
|
After Width: 1280 | Height: 897 | Size: 191 KiB |
|
After Width: 1280 | Height: 897 | Size: 191 KiB |
|
After Width: 1280 | Height: 897 | Size: 191 KiB |
|
After Width: 1280 | Height: 897 | Size: 191 KiB |
|
After Width: 1280 | Height: 897 | Size: 191 KiB |
|
After Width: 1280 | Height: 897 | Size: 191 KiB |
|
After Width: 1280 | Height: 897 | Size: 191 KiB |
|
After Width: 2400 | Height: 3001 | Size: 2.5 MiB |
|
After Width: 2400 | Height: 3001 | Size: 2.5 MiB |
|
After Width: 1280 | Height: 897 | Size: 191 KiB |
|
After Width: 1280 | Height: 897 | Size: 191 KiB |
|
After Width: 1280 | Height: 897 | Size: 191 KiB |
|
After Width: 2400 | Height: 3001 | Size: 2.5 MiB |
|
After Width: 2400 | Height: 3001 | Size: 2.5 MiB |
|
After Width: 1280 | Height: 897 | Size: 191 KiB |
|
After Width: 2400 | Height: 3600 | Size: 915 KiB |
|
After Width: 1280 | Height: 897 | Size: 191 KiB |
@ -0,0 +1,295 @@ |
|||
#!/bin/sh |
|||
# ---------------------------------------------------------------------------- |
|||
# Licensed to the Apache Software Foundation (ASF) under one |
|||
# or more contributor license agreements. See the NOTICE file |
|||
# distributed with this work for additional information |
|||
# regarding copyright ownership. The ASF licenses this file |
|||
# to you under the Apache License, Version 2.0 (the |
|||
# "License"); you may not use this file except in compliance |
|||
# with the License. You may obtain a copy of the License at |
|||
# |
|||
# http://www.apache.org/licenses/LICENSE-2.0 |
|||
# |
|||
# Unless required by applicable law or agreed to in writing, |
|||
# software distributed under the License is distributed on an |
|||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
|||
# KIND, either express or implied. See the License for the |
|||
# specific language governing permissions and limitations |
|||
# under the License. |
|||
# ---------------------------------------------------------------------------- |
|||
|
|||
# ---------------------------------------------------------------------------- |
|||
# Apache Maven Wrapper startup batch script, version 3.3.4 |
|||
# |
|||
# Optional ENV vars |
|||
# ----------------- |
|||
# JAVA_HOME - location of a JDK home dir, required when download maven via java source |
|||
# MVNW_REPOURL - repo url base for downloading maven distribution |
|||
# MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven |
|||
# MVNW_VERBOSE - true: enable verbose log; debug: trace the mvnw script; others: silence the output |
|||
# ---------------------------------------------------------------------------- |
|||
|
|||
set -euf |
|||
[ "${MVNW_VERBOSE-}" != debug ] || set -x |
|||
|
|||
# OS specific support. |
|||
native_path() { printf %s\\n "$1"; } |
|||
case "$(uname)" in |
|||
CYGWIN* | MINGW*) |
|||
[ -z "${JAVA_HOME-}" ] || JAVA_HOME="$(cygpath --unix "$JAVA_HOME")" |
|||
native_path() { cygpath --path --windows "$1"; } |
|||
;; |
|||
esac |
|||
|
|||
# set JAVACMD and JAVACCMD |
|||
set_java_home() { |
|||
# For Cygwin and MinGW, ensure paths are in Unix format before anything is touched |
|||
if [ -n "${JAVA_HOME-}" ]; then |
|||
if [ -x "$JAVA_HOME/jre/sh/java" ]; then |
|||
# IBM's JDK on AIX uses strange locations for the executables |
|||
JAVACMD="$JAVA_HOME/jre/sh/java" |
|||
JAVACCMD="$JAVA_HOME/jre/sh/javac" |
|||
else |
|||
JAVACMD="$JAVA_HOME/bin/java" |
|||
JAVACCMD="$JAVA_HOME/bin/javac" |
|||
|
|||
if [ ! -x "$JAVACMD" ] || [ ! -x "$JAVACCMD" ]; then |
|||
echo "The JAVA_HOME environment variable is not defined correctly, so mvnw cannot run." >&2 |
|||
echo "JAVA_HOME is set to \"$JAVA_HOME\", but \"\$JAVA_HOME/bin/java\" or \"\$JAVA_HOME/bin/javac\" does not exist." >&2 |
|||
return 1 |
|||
fi |
|||
fi |
|||
else |
|||
JAVACMD="$( |
|||
'set' +e |
|||
'unset' -f command 2>/dev/null |
|||
'command' -v java |
|||
)" || : |
|||
JAVACCMD="$( |
|||
'set' +e |
|||
'unset' -f command 2>/dev/null |
|||
'command' -v javac |
|||
)" || : |
|||
|
|||
if [ ! -x "${JAVACMD-}" ] || [ ! -x "${JAVACCMD-}" ]; then |
|||
echo "The java/javac command does not exist in PATH nor is JAVA_HOME set, so mvnw cannot run." >&2 |
|||
return 1 |
|||
fi |
|||
fi |
|||
} |
|||
|
|||
# hash string like Java String::hashCode |
|||
hash_string() { |
|||
str="${1:-}" h=0 |
|||
while [ -n "$str" ]; do |
|||
char="${str%"${str#?}"}" |
|||
h=$(((h * 31 + $(LC_CTYPE=C printf %d "'$char")) % 4294967296)) |
|||
str="${str#?}" |
|||
done |
|||
printf %x\\n $h |
|||
} |
|||
|
|||
verbose() { :; } |
|||
[ "${MVNW_VERBOSE-}" != true ] || verbose() { printf %s\\n "${1-}"; } |
|||
|
|||
die() { |
|||
printf %s\\n "$1" >&2 |
|||
exit 1 |
|||
} |
|||
|
|||
trim() { |
|||
# MWRAPPER-139: |
|||
# Trims trailing and leading whitespace, carriage returns, tabs, and linefeeds. |
|||
# Needed for removing poorly interpreted newline sequences when running in more |
|||
# exotic environments such as mingw bash on Windows. |
|||
printf "%s" "${1}" | tr -d '[:space:]' |
|||
} |
|||
|
|||
scriptDir="$(dirname "$0")" |
|||
scriptName="$(basename "$0")" |
|||
|
|||
# parse distributionUrl and optional distributionSha256Sum, requires .mvn/wrapper/maven-wrapper.properties |
|||
while IFS="=" read -r key value; do |
|||
case "${key-}" in |
|||
distributionUrl) distributionUrl=$(trim "${value-}") ;; |
|||
distributionSha256Sum) distributionSha256Sum=$(trim "${value-}") ;; |
|||
esac |
|||
done <"$scriptDir/.mvn/wrapper/maven-wrapper.properties" |
|||
[ -n "${distributionUrl-}" ] || die "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties" |
|||
|
|||
case "${distributionUrl##*/}" in |
|||
maven-mvnd-*bin.*) |
|||
MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ |
|||
case "${PROCESSOR_ARCHITECTURE-}${PROCESSOR_ARCHITEW6432-}:$(uname -a)" in |
|||
*AMD64:CYGWIN* | *AMD64:MINGW*) distributionPlatform=windows-amd64 ;; |
|||
:Darwin*x86_64) distributionPlatform=darwin-amd64 ;; |
|||
:Darwin*arm64) distributionPlatform=darwin-aarch64 ;; |
|||
:Linux*x86_64*) distributionPlatform=linux-amd64 ;; |
|||
*) |
|||
echo "Cannot detect native platform for mvnd on $(uname)-$(uname -m), use pure java version" >&2 |
|||
distributionPlatform=linux-amd64 |
|||
;; |
|||
esac |
|||
distributionUrl="${distributionUrl%-bin.*}-$distributionPlatform.zip" |
|||
;; |
|||
maven-mvnd-*) MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ ;; |
|||
*) MVN_CMD="mvn${scriptName#mvnw}" _MVNW_REPO_PATTERN=/org/apache/maven/ ;; |
|||
esac |
|||
|
|||
# apply MVNW_REPOURL and calculate MAVEN_HOME |
|||
# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-<version>,maven-mvnd-<version>-<platform>}/<hash> |
|||
[ -z "${MVNW_REPOURL-}" ] || distributionUrl="$MVNW_REPOURL$_MVNW_REPO_PATTERN${distributionUrl#*"$_MVNW_REPO_PATTERN"}" |
|||
distributionUrlName="${distributionUrl##*/}" |
|||
distributionUrlNameMain="${distributionUrlName%.*}" |
|||
distributionUrlNameMain="${distributionUrlNameMain%-bin}" |
|||
MAVEN_USER_HOME="${MAVEN_USER_HOME:-${HOME}/.m2}" |
|||
MAVEN_HOME="${MAVEN_USER_HOME}/wrapper/dists/${distributionUrlNameMain-}/$(hash_string "$distributionUrl")" |
|||
|
|||
exec_maven() { |
|||
unset MVNW_VERBOSE MVNW_USERNAME MVNW_PASSWORD MVNW_REPOURL || : |
|||
exec "$MAVEN_HOME/bin/$MVN_CMD" "$@" || die "cannot exec $MAVEN_HOME/bin/$MVN_CMD" |
|||
} |
|||
|
|||
if [ -d "$MAVEN_HOME" ]; then |
|||
verbose "found existing MAVEN_HOME at $MAVEN_HOME" |
|||
exec_maven "$@" |
|||
fi |
|||
|
|||
case "${distributionUrl-}" in |
|||
*?-bin.zip | *?maven-mvnd-?*-?*.zip) ;; |
|||
*) die "distributionUrl is not valid, must match *-bin.zip or maven-mvnd-*.zip, but found '${distributionUrl-}'" ;; |
|||
esac |
|||
|
|||
# prepare tmp dir |
|||
if TMP_DOWNLOAD_DIR="$(mktemp -d)" && [ -d "$TMP_DOWNLOAD_DIR" ]; then |
|||
clean() { rm -rf -- "$TMP_DOWNLOAD_DIR"; } |
|||
trap clean HUP INT TERM EXIT |
|||
else |
|||
die "cannot create temp dir" |
|||
fi |
|||
|
|||
mkdir -p -- "${MAVEN_HOME%/*}" |
|||
|
|||
# Download and Install Apache Maven |
|||
verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." |
|||
verbose "Downloading from: $distributionUrl" |
|||
verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" |
|||
|
|||
# select .zip or .tar.gz |
|||
if ! command -v unzip >/dev/null; then |
|||
distributionUrl="${distributionUrl%.zip}.tar.gz" |
|||
distributionUrlName="${distributionUrl##*/}" |
|||
fi |
|||
|
|||
# verbose opt |
|||
__MVNW_QUIET_WGET=--quiet __MVNW_QUIET_CURL=--silent __MVNW_QUIET_UNZIP=-q __MVNW_QUIET_TAR='' |
|||
[ "${MVNW_VERBOSE-}" != true ] || __MVNW_QUIET_WGET='' __MVNW_QUIET_CURL='' __MVNW_QUIET_UNZIP='' __MVNW_QUIET_TAR=v |
|||
|
|||
# normalize http auth |
|||
case "${MVNW_PASSWORD:+has-password}" in |
|||
'') MVNW_USERNAME='' MVNW_PASSWORD='' ;; |
|||
has-password) [ -n "${MVNW_USERNAME-}" ] || MVNW_USERNAME='' MVNW_PASSWORD='' ;; |
|||
esac |
|||
|
|||
if [ -z "${MVNW_USERNAME-}" ] && command -v wget >/dev/null; then |
|||
verbose "Found wget ... using wget" |
|||
wget ${__MVNW_QUIET_WGET:+"$__MVNW_QUIET_WGET"} "$distributionUrl" -O "$TMP_DOWNLOAD_DIR/$distributionUrlName" || die "wget: Failed to fetch $distributionUrl" |
|||
elif [ -z "${MVNW_USERNAME-}" ] && command -v curl >/dev/null; then |
|||
verbose "Found curl ... using curl" |
|||
curl ${__MVNW_QUIET_CURL:+"$__MVNW_QUIET_CURL"} -f -L -o "$TMP_DOWNLOAD_DIR/$distributionUrlName" "$distributionUrl" || die "curl: Failed to fetch $distributionUrl" |
|||
elif set_java_home; then |
|||
verbose "Falling back to use Java to download" |
|||
javaSource="$TMP_DOWNLOAD_DIR/Downloader.java" |
|||
targetZip="$TMP_DOWNLOAD_DIR/$distributionUrlName" |
|||
cat >"$javaSource" <<-END |
|||
public class Downloader extends java.net.Authenticator |
|||
{ |
|||
protected java.net.PasswordAuthentication getPasswordAuthentication() |
|||
{ |
|||
return new java.net.PasswordAuthentication( System.getenv( "MVNW_USERNAME" ), System.getenv( "MVNW_PASSWORD" ).toCharArray() ); |
|||
} |
|||
public static void main( String[] args ) throws Exception |
|||
{ |
|||
setDefault( new Downloader() ); |
|||
java.nio.file.Files.copy( java.net.URI.create( args[0] ).toURL().openStream(), java.nio.file.Paths.get( args[1] ).toAbsolutePath().normalize() ); |
|||
} |
|||
} |
|||
END |
|||
# For Cygwin/MinGW, switch paths to Windows format before running javac and java |
|||
verbose " - Compiling Downloader.java ..." |
|||
"$(native_path "$JAVACCMD")" "$(native_path "$javaSource")" || die "Failed to compile Downloader.java" |
|||
verbose " - Running Downloader.java ..." |
|||
"$(native_path "$JAVACMD")" -cp "$(native_path "$TMP_DOWNLOAD_DIR")" Downloader "$distributionUrl" "$(native_path "$targetZip")" |
|||
fi |
|||
|
|||
# If specified, validate the SHA-256 sum of the Maven distribution zip file |
|||
if [ -n "${distributionSha256Sum-}" ]; then |
|||
distributionSha256Result=false |
|||
if [ "$MVN_CMD" = mvnd.sh ]; then |
|||
echo "Checksum validation is not supported for maven-mvnd." >&2 |
|||
echo "Please disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 |
|||
exit 1 |
|||
elif command -v sha256sum >/dev/null; then |
|||
if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | sha256sum -c - >/dev/null 2>&1; then |
|||
distributionSha256Result=true |
|||
fi |
|||
elif command -v shasum >/dev/null; then |
|||
if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | shasum -a 256 -c >/dev/null 2>&1; then |
|||
distributionSha256Result=true |
|||
fi |
|||
else |
|||
echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." >&2 |
|||
echo "Please install either command, or disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 |
|||
exit 1 |
|||
fi |
|||
if [ $distributionSha256Result = false ]; then |
|||
echo "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised." >&2 |
|||
echo "If you updated your Maven version, you need to update the specified distributionSha256Sum property." >&2 |
|||
exit 1 |
|||
fi |
|||
fi |
|||
|
|||
# unzip and move |
|||
if command -v unzip >/dev/null; then |
|||
unzip ${__MVNW_QUIET_UNZIP:+"$__MVNW_QUIET_UNZIP"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -d "$TMP_DOWNLOAD_DIR" || die "failed to unzip" |
|||
else |
|||
tar xzf${__MVNW_QUIET_TAR:+"$__MVNW_QUIET_TAR"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -C "$TMP_DOWNLOAD_DIR" || die "failed to untar" |
|||
fi |
|||
|
|||
# Find the actual extracted directory name (handles snapshots where filename != directory name) |
|||
actualDistributionDir="" |
|||
|
|||
# First try the expected directory name (for regular distributions) |
|||
if [ -d "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" ]; then |
|||
if [ -f "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain/bin/$MVN_CMD" ]; then |
|||
actualDistributionDir="$distributionUrlNameMain" |
|||
fi |
|||
fi |
|||
|
|||
# If not found, search for any directory with the Maven executable (for snapshots) |
|||
if [ -z "$actualDistributionDir" ]; then |
|||
# enable globbing to iterate over items |
|||
set +f |
|||
for dir in "$TMP_DOWNLOAD_DIR"/*; do |
|||
if [ -d "$dir" ]; then |
|||
if [ -f "$dir/bin/$MVN_CMD" ]; then |
|||
actualDistributionDir="$(basename "$dir")" |
|||
break |
|||
fi |
|||
fi |
|||
done |
|||
set -f |
|||
fi |
|||
|
|||
if [ -z "$actualDistributionDir" ]; then |
|||
verbose "Contents of $TMP_DOWNLOAD_DIR:" |
|||
verbose "$(ls -la "$TMP_DOWNLOAD_DIR")" |
|||
die "Could not find Maven distribution directory in extracted archive" |
|||
fi |
|||
|
|||
verbose "Found extracted Maven distribution directory: $actualDistributionDir" |
|||
printf %s\\n "$distributionUrl" >"$TMP_DOWNLOAD_DIR/$actualDistributionDir/mvnw.url" |
|||
mv -- "$TMP_DOWNLOAD_DIR/$actualDistributionDir" "$MAVEN_HOME" || [ -d "$MAVEN_HOME" ] || die "fail to move MAVEN_HOME" |
|||
|
|||
clean || : |
|||
exec_maven "$@" |
|||
@ -0,0 +1,189 @@ |
|||
<# : batch portion |
|||
@REM ---------------------------------------------------------------------------- |
|||
@REM Licensed to the Apache Software Foundation (ASF) under one |
|||
@REM or more contributor license agreements. See the NOTICE file |
|||
@REM distributed with this work for additional information |
|||
@REM regarding copyright ownership. The ASF licenses this file |
|||
@REM to you under the Apache License, Version 2.0 (the |
|||
@REM "License"); you may not use this file except in compliance |
|||
@REM with the License. You may obtain a copy of the License at |
|||
@REM |
|||
@REM http://www.apache.org/licenses/LICENSE-2.0 |
|||
@REM |
|||
@REM Unless required by applicable law or agreed to in writing, |
|||
@REM software distributed under the License is distributed on an |
|||
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
|||
@REM KIND, either express or implied. See the License for the |
|||
@REM specific language governing permissions and limitations |
|||
@REM under the License. |
|||
@REM ---------------------------------------------------------------------------- |
|||
|
|||
@REM ---------------------------------------------------------------------------- |
|||
@REM Apache Maven Wrapper startup batch script, version 3.3.4 |
|||
@REM |
|||
@REM Optional ENV vars |
|||
@REM MVNW_REPOURL - repo url base for downloading maven distribution |
|||
@REM MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven |
|||
@REM MVNW_VERBOSE - true: enable verbose log; others: silence the output |
|||
@REM ---------------------------------------------------------------------------- |
|||
|
|||
@IF "%__MVNW_ARG0_NAME__%"=="" (SET __MVNW_ARG0_NAME__=%~nx0) |
|||
@SET __MVNW_CMD__= |
|||
@SET __MVNW_ERROR__= |
|||
@SET __MVNW_PSMODULEP_SAVE=%PSModulePath% |
|||
@SET PSModulePath= |
|||
@FOR /F "usebackq tokens=1* delims==" %%A IN (`powershell -noprofile "& {$scriptDir='%~dp0'; $script='%__MVNW_ARG0_NAME__%'; icm -ScriptBlock ([Scriptblock]::Create((Get-Content -Raw '%~f0'))) -NoNewScope}"`) DO @( |
|||
IF "%%A"=="MVN_CMD" (set __MVNW_CMD__=%%B) ELSE IF "%%B"=="" (echo %%A) ELSE (echo %%A=%%B) |
|||
) |
|||
@SET PSModulePath=%__MVNW_PSMODULEP_SAVE% |
|||
@SET __MVNW_PSMODULEP_SAVE= |
|||
@SET __MVNW_ARG0_NAME__= |
|||
@SET MVNW_USERNAME= |
|||
@SET MVNW_PASSWORD= |
|||
@IF NOT "%__MVNW_CMD__%"=="" ("%__MVNW_CMD__%" %*) |
|||
@echo Cannot start maven from wrapper >&2 && exit /b 1 |
|||
@GOTO :EOF |
|||
: end batch / begin powershell #> |
|||
|
|||
$ErrorActionPreference = "Stop" |
|||
if ($env:MVNW_VERBOSE -eq "true") { |
|||
$VerbosePreference = "Continue" |
|||
} |
|||
|
|||
# calculate distributionUrl, requires .mvn/wrapper/maven-wrapper.properties |
|||
$distributionUrl = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionUrl |
|||
if (!$distributionUrl) { |
|||
Write-Error "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties" |
|||
} |
|||
|
|||
switch -wildcard -casesensitive ( $($distributionUrl -replace '^.*/','') ) { |
|||
"maven-mvnd-*" { |
|||
$USE_MVND = $true |
|||
$distributionUrl = $distributionUrl -replace '-bin\.[^.]*$',"-windows-amd64.zip" |
|||
$MVN_CMD = "mvnd.cmd" |
|||
break |
|||
} |
|||
default { |
|||
$USE_MVND = $false |
|||
$MVN_CMD = $script -replace '^mvnw','mvn' |
|||
break |
|||
} |
|||
} |
|||
|
|||
# apply MVNW_REPOURL and calculate MAVEN_HOME |
|||
# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-<version>,maven-mvnd-<version>-<platform>}/<hash> |
|||
if ($env:MVNW_REPOURL) { |
|||
$MVNW_REPO_PATTERN = if ($USE_MVND -eq $False) { "/org/apache/maven/" } else { "/maven/mvnd/" } |
|||
$distributionUrl = "$env:MVNW_REPOURL$MVNW_REPO_PATTERN$($distributionUrl -replace "^.*$MVNW_REPO_PATTERN",'')" |
|||
} |
|||
$distributionUrlName = $distributionUrl -replace '^.*/','' |
|||
$distributionUrlNameMain = $distributionUrlName -replace '\.[^.]*$','' -replace '-bin$','' |
|||
|
|||
$MAVEN_M2_PATH = "$HOME/.m2" |
|||
if ($env:MAVEN_USER_HOME) { |
|||
$MAVEN_M2_PATH = "$env:MAVEN_USER_HOME" |
|||
} |
|||
|
|||
if (-not (Test-Path -Path $MAVEN_M2_PATH)) { |
|||
New-Item -Path $MAVEN_M2_PATH -ItemType Directory | Out-Null |
|||
} |
|||
|
|||
$MAVEN_WRAPPER_DISTS = $null |
|||
if ((Get-Item $MAVEN_M2_PATH).Target[0] -eq $null) { |
|||
$MAVEN_WRAPPER_DISTS = "$MAVEN_M2_PATH/wrapper/dists" |
|||
} else { |
|||
$MAVEN_WRAPPER_DISTS = (Get-Item $MAVEN_M2_PATH).Target[0] + "/wrapper/dists" |
|||
} |
|||
|
|||
$MAVEN_HOME_PARENT = "$MAVEN_WRAPPER_DISTS/$distributionUrlNameMain" |
|||
$MAVEN_HOME_NAME = ([System.Security.Cryptography.SHA256]::Create().ComputeHash([byte[]][char[]]$distributionUrl) | ForEach-Object {$_.ToString("x2")}) -join '' |
|||
$MAVEN_HOME = "$MAVEN_HOME_PARENT/$MAVEN_HOME_NAME" |
|||
|
|||
if (Test-Path -Path "$MAVEN_HOME" -PathType Container) { |
|||
Write-Verbose "found existing MAVEN_HOME at $MAVEN_HOME" |
|||
Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" |
|||
exit $? |
|||
} |
|||
|
|||
if (! $distributionUrlNameMain -or ($distributionUrlName -eq $distributionUrlNameMain)) { |
|||
Write-Error "distributionUrl is not valid, must end with *-bin.zip, but found $distributionUrl" |
|||
} |
|||
|
|||
# prepare tmp dir |
|||
$TMP_DOWNLOAD_DIR_HOLDER = New-TemporaryFile |
|||
$TMP_DOWNLOAD_DIR = New-Item -Itemtype Directory -Path "$TMP_DOWNLOAD_DIR_HOLDER.dir" |
|||
$TMP_DOWNLOAD_DIR_HOLDER.Delete() | Out-Null |
|||
trap { |
|||
if ($TMP_DOWNLOAD_DIR.Exists) { |
|||
try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } |
|||
catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } |
|||
} |
|||
} |
|||
|
|||
New-Item -Itemtype Directory -Path "$MAVEN_HOME_PARENT" -Force | Out-Null |
|||
|
|||
# Download and Install Apache Maven |
|||
Write-Verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." |
|||
Write-Verbose "Downloading from: $distributionUrl" |
|||
Write-Verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" |
|||
|
|||
$webclient = New-Object System.Net.WebClient |
|||
if ($env:MVNW_USERNAME -and $env:MVNW_PASSWORD) { |
|||
$webclient.Credentials = New-Object System.Net.NetworkCredential($env:MVNW_USERNAME, $env:MVNW_PASSWORD) |
|||
} |
|||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 |
|||
$webclient.DownloadFile($distributionUrl, "$TMP_DOWNLOAD_DIR/$distributionUrlName") | Out-Null |
|||
|
|||
# If specified, validate the SHA-256 sum of the Maven distribution zip file |
|||
$distributionSha256Sum = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionSha256Sum |
|||
if ($distributionSha256Sum) { |
|||
if ($USE_MVND) { |
|||
Write-Error "Checksum validation is not supported for maven-mvnd. `nPlease disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." |
|||
} |
|||
Import-Module $PSHOME\Modules\Microsoft.PowerShell.Utility -Function Get-FileHash |
|||
if ((Get-FileHash "$TMP_DOWNLOAD_DIR/$distributionUrlName" -Algorithm SHA256).Hash.ToLower() -ne $distributionSha256Sum) { |
|||
Write-Error "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised. If you updated your Maven version, you need to update the specified distributionSha256Sum property." |
|||
} |
|||
} |
|||
|
|||
# unzip and move |
|||
Expand-Archive "$TMP_DOWNLOAD_DIR/$distributionUrlName" -DestinationPath "$TMP_DOWNLOAD_DIR" | Out-Null |
|||
|
|||
# Find the actual extracted directory name (handles snapshots where filename != directory name) |
|||
$actualDistributionDir = "" |
|||
|
|||
# First try the expected directory name (for regular distributions) |
|||
$expectedPath = Join-Path "$TMP_DOWNLOAD_DIR" "$distributionUrlNameMain" |
|||
$expectedMvnPath = Join-Path "$expectedPath" "bin/$MVN_CMD" |
|||
if ((Test-Path -Path $expectedPath -PathType Container) -and (Test-Path -Path $expectedMvnPath -PathType Leaf)) { |
|||
$actualDistributionDir = $distributionUrlNameMain |
|||
} |
|||
|
|||
# If not found, search for any directory with the Maven executable (for snapshots) |
|||
if (!$actualDistributionDir) { |
|||
Get-ChildItem -Path "$TMP_DOWNLOAD_DIR" -Directory | ForEach-Object { |
|||
$testPath = Join-Path $_.FullName "bin/$MVN_CMD" |
|||
if (Test-Path -Path $testPath -PathType Leaf) { |
|||
$actualDistributionDir = $_.Name |
|||
} |
|||
} |
|||
} |
|||
|
|||
if (!$actualDistributionDir) { |
|||
Write-Error "Could not find Maven distribution directory in extracted archive" |
|||
} |
|||
|
|||
Write-Verbose "Found extracted Maven distribution directory: $actualDistributionDir" |
|||
Rename-Item -Path "$TMP_DOWNLOAD_DIR/$actualDistributionDir" -NewName $MAVEN_HOME_NAME | Out-Null |
|||
try { |
|||
Move-Item -Path "$TMP_DOWNLOAD_DIR/$MAVEN_HOME_NAME" -Destination $MAVEN_HOME_PARENT | Out-Null |
|||
} catch { |
|||
if (! (Test-Path -Path "$MAVEN_HOME" -PathType Container)) { |
|||
Write-Error "fail to move MAVEN_HOME" |
|||
} |
|||
} finally { |
|||
try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } |
|||
catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } |
|||
} |
|||
|
|||
Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" |
|||
@ -0,0 +1,87 @@ |
|||
<?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.3.3</version> |
|||
<relativePath/> <!-- lookup parent from repository --> |
|||
</parent> |
|||
<groupId>com.gcc</groupId> |
|||
<artifactId>streetvendorlicense</artifactId> |
|||
<version>0.0.1</version> |
|||
<name>streetvendorlicense</name> |
|||
<description>Street Vendor License project </description> |
|||
<url/> |
|||
<licenses> |
|||
<license/> |
|||
</licenses> |
|||
<developers> |
|||
<developer/> |
|||
</developers> |
|||
<scm> |
|||
<connection/> |
|||
<developerConnection/> |
|||
<tag/> |
|||
<url/> |
|||
</scm> |
|||
<properties> |
|||
<java.version>17</java.version> |
|||
</properties> |
|||
<dependencies> |
|||
<dependency> |
|||
<groupId>org.springframework.boot</groupId> |
|||
<artifactId>spring-boot-starter-data-jdbc</artifactId> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>org.springframework.boot</groupId> |
|||
<artifactId>spring-boot-starter-thymeleaf</artifactId> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>org.springframework.boot</groupId> |
|||
<artifactId>spring-boot-starter-web</artifactId> |
|||
</dependency> |
|||
|
|||
<dependency> |
|||
<groupId>org.springframework.boot</groupId> |
|||
<artifactId>spring-boot-devtools</artifactId> |
|||
<scope>runtime</scope> |
|||
<optional>true</optional> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>com.mysql</groupId> |
|||
<artifactId>mysql-connector-j</artifactId> |
|||
<scope>runtime</scope> |
|||
</dependency> |
|||
<!-- ZXing core library for generating QR codes --> |
|||
<dependency> |
|||
<groupId>com.google.zxing</groupId> |
|||
<artifactId>core</artifactId> |
|||
<version>3.4.1</version> |
|||
</dependency> |
|||
<!-- ZXing JavaSE library for encoding QR codes as images --> |
|||
<dependency> |
|||
<groupId>com.google.zxing</groupId> |
|||
<artifactId>javase</artifactId> |
|||
<version>3.4.1</version> |
|||
</dependency> |
|||
|
|||
|
|||
<!--<dependency> |
|||
<groupId>org.springframework.boot</groupId> |
|||
<artifactId>spring-boot-starter-test</artifactId> |
|||
<scope>test</scope> |
|||
</dependency>--> |
|||
</dependencies> |
|||
|
|||
<build> |
|||
<plugins> |
|||
<plugin> |
|||
<groupId>org.springframework.boot</groupId> |
|||
<artifactId>spring-boot-maven-plugin</artifactId> |
|||
</plugin> |
|||
</plugins> |
|||
</build> |
|||
|
|||
</project> |
|||
@ -0,0 +1,13 @@ |
|||
package com.gcc.streetvendorlicense; |
|||
|
|||
import org.springframework.boot.SpringApplication; |
|||
import org.springframework.boot.autoconfigure.SpringBootApplication; |
|||
|
|||
@SpringBootApplication |
|||
public class StreetvendorlicenseApplication { |
|||
|
|||
public static void main(String[] args) { |
|||
SpringApplication.run(StreetvendorlicenseApplication.class, args); |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,39 @@ |
|||
package com.gcc.streetvendorlicense.configuration; |
|||
|
|||
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 getOtpUrl; |
|||
|
|||
public String getTitle() { |
|||
return title; |
|||
} |
|||
|
|||
public void setTitle(String title) { |
|||
this.title = title; |
|||
} |
|||
|
|||
public String getBaseUrl() { |
|||
return baseUrl; |
|||
} |
|||
|
|||
public void setBaseUrl(String baseUrl) { |
|||
this.baseUrl = baseUrl; |
|||
} |
|||
|
|||
public String getGetOtpUrl() { |
|||
return getOtpUrl; |
|||
} |
|||
|
|||
public void setGetOtpUrl(String getOtpUrl) { |
|||
this.getOtpUrl = getOtpUrl; |
|||
} |
|||
|
|||
|
|||
} |
|||
@ -0,0 +1,59 @@ |
|||
package com.gcc.streetvendorlicense.configuration; |
|||
|
|||
import javax.sql.DataSource; |
|||
|
|||
import org.springframework.beans.factory.annotation.Qualifier; |
|||
import org.springframework.context.annotation.Bean; |
|||
import org.springframework.context.annotation.Configuration; |
|||
import org.springframework.context.annotation.Primary; |
|||
import org.springframework.jdbc.datasource.DataSourceTransactionManager; |
|||
import org.springframework.jdbc.datasource.DriverManagerDataSource; |
|||
import org.springframework.transaction.PlatformTransactionManager; |
|||
import org.springframework.transaction.annotation.EnableTransactionManagement; |
|||
|
|||
@Configuration |
|||
@EnableTransactionManagement |
|||
public class DataSourceConfig { |
|||
|
|||
|
|||
// private static String host = "localhost:3306"; |
|||
// private static String dbpassword = "root"; |
|||
|
|||
|
|||
private static String host = "gcc-facial-db-instance-1.cf48eqcciziq.ap-south-1.rds.amazonaws.com:3306"; |
|||
private static String dbpassword = "gcc-facial-password"; |
|||
|
|||
public static class MyDataSourceConfig { |
|||
@Primary |
|||
@Bean(name = "mydatasource") |
|||
public DataSource MyDataSource() { |
|||
|
|||
DriverManagerDataSource dataSource = new DriverManagerDataSource(); |
|||
dataSource.setUrl("jdbc:mysql://"+host+"/gcc_street_vendor"); |
|||
dataSource.setUsername("root"); |
|||
dataSource.setPassword(dbpassword); |
|||
dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver"); |
|||
return dataSource; |
|||
|
|||
|
|||
} |
|||
|
|||
@Primary |
|||
@Bean(name = "myTransactionManager") |
|||
public PlatformTransactionManager myTransactionManager(@Qualifier("mydatasource") DataSource dataSource) { |
|||
return new DataSourceTransactionManager(dataSource); |
|||
} |
|||
} |
|||
|
|||
////////////////////////////// Vending Committe //////////////////////// |
|||
@Bean(name = "mysqlVendingCommitteDataSource") |
|||
public DataSource mysqlVendingCommitteDataSource() { |
|||
DriverManagerDataSource dataSource = new DriverManagerDataSource(); |
|||
dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver"); |
|||
dataSource.setUrl("jdbc:mysql://"+host+"/vendingcommitte"); |
|||
dataSource.setUsername("root"); |
|||
dataSource.setPassword(dbpassword); |
|||
return dataSource; |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,18 @@ |
|||
package com.gcc.streetvendorlicense.configuration; |
|||
|
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.ControllerAdvice; |
|||
import org.springframework.web.bind.annotation.ModelAttribute; |
|||
|
|||
@ControllerAdvice |
|||
public class GlobalAttributes { |
|||
|
|||
@Autowired |
|||
private AppConfig appConfig; |
|||
|
|||
@ModelAttribute("baseURL") |
|||
public String baseURL() { |
|||
return appConfig.getBaseUrl(); |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,44 @@ |
|||
package com.gcc.streetvendorlicense.configuration; |
|||
|
|||
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 QrGenerator { |
|||
|
|||
|
|||
public static String generateQRCode(String baseUrl) 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(baseUrl, 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(); |
|||
|
|||
|
|||
// Return the QR code image as a Base64 string with the correct data URI prefix |
|||
String base64EncodedImage=Base64.getEncoder().encodeToString(imageBytes); |
|||
|
|||
return base64EncodedImage; |
|||
} |
|||
} |
|||
@ -0,0 +1,109 @@ |
|||
package com.gcc.streetvendorlicense.controller; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.http.ResponseEntity; |
|||
import org.springframework.stereotype.Controller; |
|||
import org.springframework.ui.Model; |
|||
import org.springframework.web.bind.annotation.GetMapping; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RequestParam; |
|||
|
|||
import com.gcc.streetvendorlicense.service.licenseService; |
|||
|
|||
import jakarta.servlet.http.HttpSession; |
|||
|
|||
|
|||
@Controller |
|||
@RequestMapping(value={"/streetvendorlicense"}) |
|||
public class MainController { |
|||
|
|||
@Autowired |
|||
private licenseService licenseservice; |
|||
|
|||
@GetMapping(value = {"", "/","/home"}) |
|||
public String requestform() { |
|||
return "modules/streetvendorlicense/home"; |
|||
} |
|||
|
|||
@PostMapping("/setViewFlag") |
|||
public ResponseEntity<?> setViewFlag(HttpSession session) { |
|||
session.setAttribute("viewMode", true); |
|||
return ResponseEntity.ok().build(); // nothing to render → no template issue! |
|||
} |
|||
|
|||
@GetMapping("/viewcertificate") |
|||
public String viewCertificateQr(@RequestParam("id") String id, HttpSession session) { |
|||
|
|||
// Set session attribute |
|||
session.setAttribute("viewMode", true); |
|||
|
|||
// Redirect WITHOUT exposing view=true |
|||
return "redirect:/streetvendorlicense/downloadcertificate?id=" + id; |
|||
} |
|||
|
|||
@GetMapping("/downloadcertificate") |
|||
public String downloadCertificate(@RequestParam("id") String id, HttpSession session,Model model) { |
|||
|
|||
Boolean view = (Boolean) session.getAttribute("viewMode"); |
|||
session.removeAttribute("viewMode"); // optional cleanup |
|||
|
|||
if (Boolean.TRUE.equals(view)) { |
|||
Map<String, Object> requestData = licenseservice.getiddetails(id); |
|||
model.addAttribute("reqNo", id); |
|||
model.addAttribute("requestData", requestData); |
|||
return "modules/streetvendorlicense/downloadcertificate"; |
|||
} else { |
|||
return "redirect:/streetvendorlicense/home"; |
|||
} |
|||
} |
|||
|
|||
|
|||
// @GetMapping("/downloadcertificate") |
|||
// public String downloadCertificate(@RequestParam("reqNo") String reqNo, Model model) { |
|||
// Map<String, Object> requestData = licenseservice.getiddetails(reqNo); |
|||
// |
|||
// // Add all response data to model (for view access) |
|||
// model.addAttribute("requestData", requestData); |
|||
// model.addAttribute("reqNo", reqNo); |
|||
// |
|||
// return "modules/streetvendorlicense/downloadcertificate"; |
|||
// } |
|||
|
|||
@GetMapping("/register") |
|||
public String registerpage(Model model) { |
|||
|
|||
List<Map<String, Object>>communities=licenseservice.fetchCommunities(); |
|||
//System.out.println("communities===="+communities); |
|||
model.addAttribute("communities", communities); |
|||
|
|||
|
|||
|
|||
List<Map<String, Object>>maritalStatuses=licenseservice.fetchMaritalStatus(); |
|||
//System.out.println("maritalStatuses===="+maritalStatuses); |
|||
model.addAttribute("maritalStatuses", maritalStatuses); |
|||
|
|||
|
|||
|
|||
List<Map<String, Object>>educationList=licenseservice.fetchEducationStatus(); |
|||
//System.out.println("educationList===="+educationList); |
|||
model.addAttribute("educationList", educationList); |
|||
|
|||
|
|||
|
|||
List<Map<String, Object>>vendingCategories=licenseservice.fetchvendingCategory(); |
|||
//System.out.println("vendingCategory===="+vendingCategories); |
|||
model.addAttribute("vendingCategories", vendingCategories); |
|||
|
|||
List<Map<String, Object>>tamilvendingCategories=licenseservice.fetchtamilvendingCategory(); |
|||
//System.out.println("tamilvendingCategories===="+tamilvendingCategories); |
|||
model.addAttribute("tamilvendingCategories", tamilvendingCategories); |
|||
|
|||
return "modules/streetvendorlicense/registerform"; |
|||
} |
|||
|
|||
|
|||
} |
|||
@ -0,0 +1,106 @@ |
|||
package com.gcc.streetvendorlicense.controller; |
|||
|
|||
import java.util.Random; |
|||
|
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.GetMapping; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RequestParam; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
import org.springframework.web.client.RestTemplate; |
|||
|
|||
import com.gcc.streetvendorlicense.configuration.AppConfig; |
|||
import com.gcc.streetvendorlicense.service.licenseService; |
|||
|
|||
import jakarta.servlet.http.HttpServletRequest; |
|||
import jakarta.servlet.http.HttpSession; |
|||
|
|||
@RestController |
|||
@RequestMapping("/streetvendorlicense/api/otp") |
|||
public class OtpController { |
|||
|
|||
@Autowired |
|||
private AppConfig appConfig; |
|||
|
|||
@Autowired |
|||
private licenseService liservice; |
|||
|
|||
@GetMapping(value = "/sendOTP") |
|||
public String sendOtp(HttpServletRequest request, @RequestParam String mobileNo) { |
|||
|
|||
|
|||
boolean allow=liservice.isMobileRegistered(mobileNo); |
|||
if(!allow) { |
|||
return "Error: This number is not registered."; |
|||
} |
|||
|
|||
|
|||
// Generate OTP logic as before |
|||
String MobileNo = mobileNo; |
|||
Random rand = new Random(); |
|||
int otp = rand.nextInt(90000) + 10000; |
|||
System.out.print("\n otp---:" + otp); |
|||
//System.out.println("appConfig.getGetOtpUrl() :_"+appConfig.getGetOtpUrl() ); |
|||
// String generatedToken = "Welcome to GCC! Your OTP for GCC Swimming Pool booking is " + otp; |
|||
// String key = "pfTEYN6H"; |
|||
// String urlString = appConfig.getGetOtpUrl() + "from=GCCCRP&key=" + key + "&sender=GCCCRP&to=" + MobileNo |
|||
// + "&body=" + generatedToken + "&entityid=1401572690000011081&templateid=1407172681010820867"; |
|||
String key = "pfTEYN6H"; |
|||
String entityId = "1401572690000011081"; |
|||
String templateId = "1407175765770900925"; |
|||
String appName="Street Vendor"; |
|||
|
|||
String generatedMessage = "Welcome to GCC! Your OTP for " + appName + " is " + otp + "."; |
|||
String urlString = appConfig.getGetOtpUrl() + "from=GCCCRP" + "&key=" + key + "&sender=GCCCRP" + "&to=" + MobileNo + "&body=" |
|||
+ generatedMessage + "&entityid=" + entityId + "&templateid=" + templateId; |
|||
|
|||
System.out.println("\n urlString---: " + urlString); |
|||
|
|||
String bodyMessage = ""; |
|||
try { |
|||
RestTemplate restTemplate = new RestTemplate(); |
|||
String Response = restTemplate.getForObject(urlString, String.class); |
|||
bodyMessage = Response; |
|||
//System.out.println("\n bodyMessage" + bodyMessage); |
|||
|
|||
System.out.println("OTP sent successfully!"); |
|||
|
|||
} catch (Exception e) { |
|||
System.out.print("ERROR---: " + e); |
|||
bodyMessage = "Error"; |
|||
} |
|||
|
|||
HttpSession session = request.getSession(); |
|||
session.setAttribute("otp", otp); |
|||
session.setAttribute("mobileNo", mobileNo); |
|||
return bodyMessage; |
|||
} |
|||
|
|||
@GetMapping(value = "/verifyOTP") |
|||
public String verifyOtp(HttpServletRequest request, @RequestParam String otp) { |
|||
HttpSession session = request.getSession(); |
|||
|
|||
try { |
|||
Integer session_otp = (Integer) session.getAttribute("otp"); |
|||
System.out.println("session_otp---:" + session_otp); |
|||
Integer entered_otp = Integer.parseInt(otp); |
|||
|
|||
if (session_otp != null && session_otp.equals(entered_otp)) { |
|||
System.out.println("Entered OTP Correct"); |
|||
session.setAttribute("verifiedotp", "success"); |
|||
return "Success"; |
|||
} else { |
|||
System.out.println("Incorrect OTP. Please enter correct OTPs."); |
|||
session.setAttribute("verifiedotp", "error"); |
|||
return "Error"; |
|||
} |
|||
} catch (NumberFormatException e) { |
|||
System.out.println("Invalid OTP format: " + otp); |
|||
return "Error"; |
|||
} catch (Exception e) { |
|||
System.out.println("Error verifying OTP: " + e.getMessage()); |
|||
return "Error"; |
|||
} |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,312 @@ |
|||
package com.gcc.streetvendorlicense.controller; |
|||
|
|||
import java.io.IOException; |
|||
import java.time.LocalDate; |
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.http.HttpStatusCode; |
|||
import org.springframework.http.ResponseEntity; |
|||
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.RequestParam; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
import org.springframework.web.multipart.MultipartFile; |
|||
|
|||
import com.gcc.streetvendorlicense.configuration.AppConfig; |
|||
import com.gcc.streetvendorlicense.configuration.QrGenerator; |
|||
import com.gcc.streetvendorlicense.dto.VendorRequest; |
|||
import com.gcc.streetvendorlicense.service.licenseService; |
|||
import com.google.zxing.WriterException; |
|||
|
|||
import jakarta.servlet.http.HttpServletRequest; |
|||
|
|||
@RestController |
|||
@RequestMapping("/streetvendorlicense/api") |
|||
public class licenseApicontroller { |
|||
|
|||
@Autowired |
|||
private AppConfig appconfig; |
|||
|
|||
@Autowired |
|||
private licenseService liservice; |
|||
|
|||
@GetMapping("/getstatusdetails") |
|||
public Map<String,Object> getstatusdetails(@RequestParam String reqNo){ |
|||
|
|||
return liservice.getstatusdetails(reqNo); |
|||
} |
|||
|
|||
@GetMapping("/generateQRCode") |
|||
public String generateQRCodeForUser(@RequestParam("reqNo") String reqNo) { |
|||
try { |
|||
|
|||
|
|||
// String qrurl = appconfig.getBaseUrl() + "downloadcertificate?id=" + reqNo; // Full URL |
|||
|
|||
String qrurl = appconfig.getBaseUrl() + "viewcertificate?id=" + reqNo; |
|||
|
|||
// Log the generated full URL for debugging |
|||
System.out.println("Generated Full URL for QR Code: " + qrurl); |
|||
|
|||
// Generate the QR code with the full URL |
|||
String qrCodeImage = QrGenerator.generateQRCode(qrurl); |
|||
|
|||
// Return the QR code image as a Base64 string |
|||
return qrCodeImage; |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
return "Error generating QR code"; |
|||
} |
|||
} |
|||
|
|||
|
|||
@GetMapping("/check-mobile") |
|||
public ResponseEntity<Map<String, Object>> checkMobile(@RequestParam String mobilenumber) { |
|||
|
|||
Map<String, Object> response = new HashMap<>(); |
|||
|
|||
// Step 1: streetVendorService → check vendor_details |
|||
Integer vdid = liservice.findLatestVendorIdByMobile(mobilenumber); |
|||
|
|||
if (vdid == null) { |
|||
// mobile not registered |
|||
response.put("exists", false); |
|||
response.put("blocked", false); |
|||
return ResponseEntity.ok(response); |
|||
} |
|||
|
|||
// Mobile exists |
|||
response.put("exists", true); |
|||
response.put("vdid", vdid); |
|||
|
|||
// Step 2: createventService → check vendor_request_list & vendor_postponed_list |
|||
Map<String, Object> vcStatus = liservice.checkVendorInVendingTables(vdid); |
|||
String status = vcStatus.get("status").toString(); |
|||
|
|||
switch (status) { |
|||
case "POSTPONED": |
|||
response.put("blocked", true); |
|||
break; |
|||
case "Approved": |
|||
response.put("blocked", true); |
|||
break; |
|||
case "Rejected": |
|||
response.put("blocked", false); |
|||
break; |
|||
case "NO_EVENT": // exists but never applied in vending committee |
|||
response.put("blocked", true); |
|||
break; |
|||
default: |
|||
response.put("blocked", true); |
|||
break; |
|||
} |
|||
|
|||
return ResponseEntity.ok(response); |
|||
} |
|||
|
|||
|
|||
|
|||
// @PostMapping("/saveDetails") |
|||
// public ResponseEntity<?> saveDetails(HttpServletRequest request) throws Exception { |
|||
// |
|||
// System.out.println("Total Parts: " + request.getParts().size()); |
|||
// |
|||
// return ResponseEntity.ok().build(); |
|||
// } |
|||
|
|||
|
|||
// @PostMapping("/saveDetails") |
|||
// public ResponseEntity<Map<String, Object>> saveVenderDetails( |
|||
// |
|||
// |
|||
// @RequestParam (required = false)String latitude, |
|||
// @RequestParam (required = false)String longitude, |
|||
// @RequestParam (required = false)String zone, |
|||
// @RequestParam (required = false)String ward, |
|||
// @RequestParam (required = false)String landmark, |
|||
// @RequestParam (required = false)String vending_district, |
|||
// @RequestParam (required = false)Integer vending_pincode, |
|||
// @RequestParam Integer vending_category, |
|||
// @RequestParam Integer tamilvending_category, |
|||
// @RequestParam (required = false)String vending_space, |
|||
// @RequestParam (required = false) Boolean pm_svanidhi_loan, |
|||
// @RequestParam (required = false) Boolean bank_acc_status, |
|||
// @RequestParam (required = false, name = "bank_passbook" )MultipartFile bank_passbook, |
|||
// @RequestParam (required = false) MultipartFile street_vendor_photo, |
|||
// @RequestParam String name, |
|||
// @RequestParam (required = false)String f_h_name, |
|||
// @RequestParam String mobile_number, |
|||
// @RequestParam (required = false)String dob, |
|||
// |
|||
// @RequestParam (required = false)String gender, |
|||
// @RequestParam (required = false)Integer social_category, |
|||
// @RequestParam (required = false)Boolean diff_abled, |
|||
// @RequestParam (required = false)Integer education_status, |
|||
// @RequestParam (required = false)Integer marital_status, |
|||
// @RequestParam (required = false)Integer no_of_fam_mem, |
|||
// @RequestParam (required = false)Boolean are_any_fam_mem_invol_str, |
|||
// |
|||
// @RequestParam (required = false)String door_no, |
|||
// @RequestParam (required = false)String streetname, |
|||
// @RequestParam (required = false)String areaname, |
|||
// @RequestParam (required = false)String present_district, |
|||
// @RequestParam (required = false)Integer present_pincode, |
|||
// @RequestParam (required = false)MultipartFile ration_card_photo, |
|||
// @RequestParam (required = false)MultipartFile aadhar_front_photo, |
|||
// @RequestParam (required = false)MultipartFile aadhar_back_photo, |
|||
// @RequestParam (required = false)String aadharNo, |
|||
// @RequestParam (required = false)String tamil_name, |
|||
// @RequestParam (required = false)String tamil_f_h_name, |
|||
// @RequestParam (required = false)String tamil_landmark, |
|||
// @RequestParam (required = false)String tamil_gender, |
|||
// @RequestParam (required = false)String tamil_present_district) |
|||
// { |
|||
|
|||
|
|||
|
|||
// @PostMapping("/saveDetails") |
|||
// public ResponseEntity<?> test(HttpServletRequest request) throws Exception { |
|||
// |
|||
// System.out.println("PART COUNT = " + request.getParts().size()); |
|||
// |
|||
// return ResponseEntity.ok().build(); |
|||
// } |
|||
|
|||
|
|||
|
|||
@PostMapping("/saveDetails") |
|||
public ResponseEntity<Map<String, Object>> saveVenderDetails ( |
|||
@ModelAttribute VendorRequest request, |
|||
|
|||
@RequestParam(required = false) MultipartFile bank_passbook, |
|||
@RequestParam(required = false) MultipartFile street_vendor_photo, |
|||
@RequestParam(required = false) MultipartFile ration_card_photo, |
|||
@RequestParam(required = false) MultipartFile aadhar_front_photo, |
|||
@RequestParam(required = false) MultipartFile aadhar_back_photo |
|||
) { |
|||
|
|||
|
|||
|
|||
//String presentAddress = door_no + ", " + streetname + ", " + areaname; |
|||
|
|||
//String data=tamil_name +"=="+tamil_f_h_name+"=="+tamil_landmark+"=="+tamil_gender+"=="+tamil_present_district; |
|||
|
|||
String data=request.getTamil_name() +"=="+request.getTamil_f_h_name()+"=="+request.getTamil_landmark()+"=="+request.getTamil_gender()+"=="+request.getTamil_present_district(); |
|||
|
|||
|
|||
System.out.println("data="+data); |
|||
|
|||
if(request.getDob()!= null) { |
|||
LocalDate dob = LocalDate.parse(request.getDob()); |
|||
if (dob.isAfter(LocalDate.now().minusYears(14))) { |
|||
return ResponseEntity.ok(Map.of( |
|||
"status", false, |
|||
"message", "failed", |
|||
"description", "Applicant must be at least 14 years old" |
|||
)); |
|||
} |
|||
} |
|||
|
|||
|
|||
// String doorNoVal = (door_no != null && !door_no.trim().isEmpty()) ? door_no : ""; |
|||
// String streetNameVal = (streetname != null && !streetname.trim().isEmpty()) ? streetname : ""; |
|||
// String areaNameVal = (areaname != null && !areaname.trim().isEmpty()) ? areaname : ""; |
|||
|
|||
String doorNoVal = (request.getDoor_no() != null && !request.getDoor_no().trim().isEmpty()) ? request.getDoor_no() : ""; |
|||
String streetNameVal = (request.getStreetname() != null && !request.getStreetname().trim().isEmpty()) ? request.getStreetname() : ""; |
|||
String areaNameVal = (request.getAreaname() != null && !request.getAreaname().trim().isEmpty()) ? request.getAreaname() : ""; |
|||
|
|||
|
|||
|
|||
String presentAddress = String.join(", ", doorNoVal, streetNameVal, areaNameVal); |
|||
|
|||
String bankPassbookPath = null; |
|||
|
|||
// Only upload passbook if status is true |
|||
//if (Boolean.TRUE.equals(bank_acc_status)) { |
|||
if (Boolean.TRUE.equals(request.getBank_acc_status())) { |
|||
|
|||
if (bank_passbook != null && !bank_passbook.isEmpty()) { |
|||
|
|||
bankPassbookPath = liservice.fileUpload (bank_passbook, "street_vendor_bank"); |
|||
} else { |
|||
return ResponseEntity.badRequest().body(Map.of( |
|||
"status", false, |
|||
"description", "Bank passbook is required when account status is Yes" |
|||
)); |
|||
} |
|||
} |
|||
|
|||
|
|||
String rationCardPath=null; |
|||
String streetVendorPhotoPath=null; |
|||
String aadharFrontPhotoPath=null; |
|||
String aadharBackPhotoPath=null; |
|||
|
|||
if(ration_card_photo != null && !ration_card_photo.isEmpty()) |
|||
{ |
|||
rationCardPath = liservice.fileUpload(ration_card_photo, "street_vendor_ration"); |
|||
} |
|||
if (street_vendor_photo != null && !street_vendor_photo.isEmpty()) |
|||
{ |
|||
streetVendorPhotoPath = liservice.fileUpload(street_vendor_photo, "street_vendor_photo"); |
|||
} |
|||
if (aadhar_front_photo != null && !aadhar_front_photo.isEmpty()) |
|||
{ |
|||
aadharFrontPhotoPath = liservice.fileUpload(aadhar_front_photo, "aadhar_front"); |
|||
} |
|||
if (aadhar_back_photo != null && !aadhar_back_photo.isEmpty()) |
|||
{ |
|||
aadharBackPhotoPath = liservice.fileUpload(aadhar_back_photo, "aadhar_back"); |
|||
} |
|||
|
|||
|
|||
// String saveStatus = liservice.saveStreetVendorDetails( |
|||
// latitude, longitude,zone, ward, landmark, vending_district, vending_pincode, vending_category, vending_space, |
|||
// pm_svanidhi_loan, bank_acc_status, bankPassbookPath, |
|||
// streetVendorPhotoPath, name, f_h_name, mobile_number,dob, |
|||
// gender, social_category, diff_abled, education_status, marital_status, |
|||
// no_of_fam_mem, are_any_fam_mem_invol_str,presentAddress, present_district, present_pincode, |
|||
// rationCardPath,aadharFrontPhotoPath, aadharBackPhotoPath,aadharNo,tamil_name,tamil_f_h_name,tamil_landmark,tamil_gender,tamil_present_district,tamilvending_category); |
|||
|
|||
|
|||
String saveStatus = liservice.saveStreetVendorDetails(request, |
|||
bankPassbookPath, |
|||
streetVendorPhotoPath, |
|||
presentAddress, |
|||
rationCardPath,aadharFrontPhotoPath, aadharBackPhotoPath); |
|||
|
|||
|
|||
if (saveStatus == null || saveStatus.equals("error")) { |
|||
return ResponseEntity.ok(Map.of( |
|||
"status", false, |
|||
"message", "failed", |
|||
"description", "Failed to save the details" |
|||
)); |
|||
} |
|||
|
|||
|
|||
return ResponseEntity.ok(Map.of( |
|||
"status", true, |
|||
"message", "success", |
|||
"description", "Details saved successfully", |
|||
"vendor_req_id", saveStatus |
|||
)); |
|||
} |
|||
|
|||
@GetMapping("/getdatabymobnum") |
|||
public ResponseEntity<?> getdatabymobnum(@RequestParam String mobileNum) { |
|||
return ResponseEntity.ok(liservice.getdatabymobnum(mobileNum)); |
|||
} |
|||
|
|||
@GetMapping("/iddetails") |
|||
public Map<String, Object> iddetails(@RequestParam String id) { |
|||
return liservice.getiddetails(id); |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,247 @@ |
|||
package com.gcc.streetvendorlicense.dto; |
|||
|
|||
public class VendorRequest { |
|||
|
|||
private String latitude; |
|||
private String longitude; |
|||
private String zone; |
|||
private String ward; |
|||
private String landmark; |
|||
private String vending_district; |
|||
private Integer vending_pincode; |
|||
private Integer vending_category; |
|||
private Integer tamilvending_category; |
|||
private String vending_space; |
|||
private Boolean pm_svanidhi_loan; |
|||
private Boolean bank_acc_status; |
|||
private String name; |
|||
private String f_h_name; |
|||
private String mobile_number; |
|||
private String dob; |
|||
private String gender; |
|||
private Integer social_category; |
|||
private Boolean diff_abled; |
|||
private Integer education_status; |
|||
private Integer marital_status; |
|||
private Integer no_of_fam_mem; |
|||
private Boolean are_any_fam_mem_invol_str; |
|||
private String door_no; |
|||
private String streetname; |
|||
private String areaname; |
|||
private String present_district; |
|||
private Integer present_pincode; |
|||
private String aadharNo; |
|||
private String tamil_name; |
|||
private String tamil_f_h_name; |
|||
private String tamil_landmark; |
|||
private String tamil_gender; |
|||
private String tamil_present_district; |
|||
public String getLatitude() { |
|||
return latitude; |
|||
} |
|||
public void setLatitude(String latitude) { |
|||
this.latitude = latitude; |
|||
} |
|||
public String getLongitude() { |
|||
return longitude; |
|||
} |
|||
public void setLongitude(String longitude) { |
|||
this.longitude = longitude; |
|||
} |
|||
public String getZone() { |
|||
return zone; |
|||
} |
|||
public void setZone(String zone) { |
|||
this.zone = zone; |
|||
} |
|||
public String getWard() { |
|||
return ward; |
|||
} |
|||
public void setWard(String ward) { |
|||
this.ward = ward; |
|||
} |
|||
public String getLandmark() { |
|||
return landmark; |
|||
} |
|||
public void setLandmark(String landmark) { |
|||
this.landmark = landmark; |
|||
} |
|||
public String getVending_district() { |
|||
return vending_district; |
|||
} |
|||
public void setVending_district(String vending_district) { |
|||
this.vending_district = vending_district; |
|||
} |
|||
public Integer getVending_pincode() { |
|||
return vending_pincode; |
|||
} |
|||
public void setVending_pincode(Integer vending_pincode) { |
|||
this.vending_pincode = vending_pincode; |
|||
} |
|||
public Integer getVending_category() { |
|||
return vending_category; |
|||
} |
|||
public void setVending_category(Integer vending_category) { |
|||
this.vending_category = vending_category; |
|||
} |
|||
public Integer getTamilvending_category() { |
|||
return tamilvending_category; |
|||
} |
|||
public void setTamilvending_category(Integer tamilvending_category) { |
|||
this.tamilvending_category = tamilvending_category; |
|||
} |
|||
public String getVending_space() { |
|||
return vending_space; |
|||
} |
|||
public void setVending_space(String vending_space) { |
|||
this.vending_space = vending_space; |
|||
} |
|||
public Boolean getPm_svanidhi_loan() { |
|||
return pm_svanidhi_loan; |
|||
} |
|||
public void setPm_svanidhi_loan(Boolean pm_svanidhi_loan) { |
|||
this.pm_svanidhi_loan = pm_svanidhi_loan; |
|||
} |
|||
public Boolean getBank_acc_status() { |
|||
return bank_acc_status; |
|||
} |
|||
public void setBank_acc_status(Boolean bank_acc_status) { |
|||
this.bank_acc_status = bank_acc_status; |
|||
} |
|||
public String getName() { |
|||
return name; |
|||
} |
|||
public void setName(String name) { |
|||
this.name = name; |
|||
} |
|||
public String getF_h_name() { |
|||
return f_h_name; |
|||
} |
|||
public void setF_h_name(String f_h_name) { |
|||
this.f_h_name = f_h_name; |
|||
} |
|||
public String getMobile_number() { |
|||
return mobile_number; |
|||
} |
|||
public void setMobile_number(String mobile_number) { |
|||
this.mobile_number = mobile_number; |
|||
} |
|||
public String getDob() { |
|||
return dob; |
|||
} |
|||
public void setDob(String dob) { |
|||
this.dob = dob; |
|||
} |
|||
public String getGender() { |
|||
return gender; |
|||
} |
|||
public void setGender(String gender) { |
|||
this.gender = gender; |
|||
} |
|||
public Integer getSocial_category() { |
|||
return social_category; |
|||
} |
|||
public void setSocial_category(Integer social_category) { |
|||
this.social_category = social_category; |
|||
} |
|||
public Boolean getDiff_abled() { |
|||
return diff_abled; |
|||
} |
|||
public void setDiff_abled(Boolean diff_abled) { |
|||
this.diff_abled = diff_abled; |
|||
} |
|||
public Integer getEducation_status() { |
|||
return education_status; |
|||
} |
|||
public void setEducation_status(Integer education_status) { |
|||
this.education_status = education_status; |
|||
} |
|||
public Integer getMarital_status() { |
|||
return marital_status; |
|||
} |
|||
public void setMarital_status(Integer marital_status) { |
|||
this.marital_status = marital_status; |
|||
} |
|||
public Integer getNo_of_fam_mem() { |
|||
return no_of_fam_mem; |
|||
} |
|||
public void setNo_of_fam_mem(Integer no_of_fam_mem) { |
|||
this.no_of_fam_mem = no_of_fam_mem; |
|||
} |
|||
public Boolean getAre_any_fam_mem_invol_str() { |
|||
return are_any_fam_mem_invol_str; |
|||
} |
|||
public void setAre_any_fam_mem_invol_str(Boolean are_any_fam_mem_invol_str) { |
|||
this.are_any_fam_mem_invol_str = are_any_fam_mem_invol_str; |
|||
} |
|||
public String getDoor_no() { |
|||
return door_no; |
|||
} |
|||
public void setDoor_no(String door_no) { |
|||
this.door_no = door_no; |
|||
} |
|||
public String getStreetname() { |
|||
return streetname; |
|||
} |
|||
public void setStreetname(String streetname) { |
|||
this.streetname = streetname; |
|||
} |
|||
public String getAreaname() { |
|||
return areaname; |
|||
} |
|||
public void setAreaname(String areaname) { |
|||
this.areaname = areaname; |
|||
} |
|||
public String getPresent_district() { |
|||
return present_district; |
|||
} |
|||
public void setPresent_district(String present_district) { |
|||
this.present_district = present_district; |
|||
} |
|||
public Integer getPresent_pincode() { |
|||
return present_pincode; |
|||
} |
|||
public void setPresent_pincode(Integer present_pincode) { |
|||
this.present_pincode = present_pincode; |
|||
} |
|||
public String getAadharNo() { |
|||
return aadharNo; |
|||
} |
|||
public void setAadharNo(String aadharNo) { |
|||
this.aadharNo = aadharNo; |
|||
} |
|||
public String getTamil_name() { |
|||
return tamil_name; |
|||
} |
|||
public void setTamil_name(String tamil_name) { |
|||
this.tamil_name = tamil_name; |
|||
} |
|||
public String getTamil_f_h_name() { |
|||
return tamil_f_h_name; |
|||
} |
|||
public void setTamil_f_h_name(String tamil_f_h_name) { |
|||
this.tamil_f_h_name = tamil_f_h_name; |
|||
} |
|||
public String getTamil_landmark() { |
|||
return tamil_landmark; |
|||
} |
|||
public void setTamil_landmark(String tamil_landmark) { |
|||
this.tamil_landmark = tamil_landmark; |
|||
} |
|||
public String getTamil_gender() { |
|||
return tamil_gender; |
|||
} |
|||
public void setTamil_gender(String tamil_gender) { |
|||
this.tamil_gender = tamil_gender; |
|||
} |
|||
public String getTamil_present_district() { |
|||
return tamil_present_district; |
|||
} |
|||
public void setTamil_present_district(String tamil_present_district) { |
|||
this.tamil_present_district = tamil_present_district; |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
} |
|||
@ -0,0 +1,35 @@ |
|||
package com.gcc.streetvendorlicense.service; |
|||
|
|||
import java.time.LocalDateTime; |
|||
import java.time.format.DateTimeFormatter; |
|||
|
|||
import org.springframework.stereotype.Component; |
|||
|
|||
@Component("streetvendorDateTimeUtil") |
|||
public class DateTimeUtil { |
|||
public static String getCurrentDateTime() { |
|||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("ddMMyyyyHHmmss"); |
|||
LocalDateTime now = LocalDateTime.now(); |
|||
return now.format(formatter); |
|||
} |
|||
public static String getCurrentYear() { |
|||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy"); |
|||
LocalDateTime now = LocalDateTime.now(); |
|||
return now.format(formatter); |
|||
} |
|||
public static String getCurrentMonth() { |
|||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM"); |
|||
LocalDateTime now = LocalDateTime.now(); |
|||
return now.format(formatter); |
|||
} |
|||
public static String getCurrentDay() { |
|||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd"); |
|||
LocalDateTime now = LocalDateTime.now(); |
|||
return now.format(formatter); |
|||
} |
|||
public static String getCurrentDateTimeMysql() { |
|||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); |
|||
LocalDateTime now = LocalDateTime.now(); |
|||
return now.format(formatter); |
|||
} |
|||
} |
|||
@ -0,0 +1,838 @@ |
|||
package com.gcc.streetvendorlicense.service; |
|||
|
|||
import java.io.IOException; |
|||
import java.nio.file.Files; |
|||
import java.nio.file.Path; |
|||
import java.nio.file.Paths; |
|||
import java.sql.PreparedStatement; |
|||
import java.time.LocalDate; |
|||
import java.time.format.DateTimeFormatter; |
|||
import java.util.ArrayList; |
|||
import java.util.HashMap; |
|||
import java.util.LinkedHashMap; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
import javax.sql.DataSource; |
|||
|
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.beans.factory.annotation.Qualifier; |
|||
import org.springframework.core.env.Environment; |
|||
import org.springframework.dao.EmptyResultDataAccessException; |
|||
import org.springframework.jdbc.core.JdbcTemplate; |
|||
import org.springframework.jdbc.support.GeneratedKeyHolder; |
|||
import org.springframework.jdbc.support.KeyHolder; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.web.bind.annotation.RequestParam; |
|||
import org.springframework.web.multipart.MultipartFile; |
|||
|
|||
import com.gcc.streetvendorlicense.dto.VendorRequest; |
|||
|
|||
|
|||
@Service |
|||
public class licenseService { |
|||
|
|||
|
|||
@Autowired |
|||
private JdbcTemplate gccstrTemplate; |
|||
|
|||
@Autowired |
|||
private JdbcTemplate vendingcommitteTemplate; |
|||
|
|||
@Autowired |
|||
@Qualifier("streetvendorDateTimeUtil") |
|||
private DateTimeUtil dateTimeUtil; |
|||
|
|||
|
|||
private final Environment environment; |
|||
|
|||
public licenseService (Environment environment) { |
|||
this.environment = environment; |
|||
} |
|||
|
|||
@Autowired |
|||
public void setDataSource1(@Qualifier("mysqlVendingCommitteDataSource") DataSource dataSource) { |
|||
this.vendingcommitteTemplate = new JdbcTemplate(dataSource); |
|||
} |
|||
|
|||
@Autowired |
|||
public void setDataSource2(@Qualifier("mydatasource") DataSource dataSource) { |
|||
this.gccstrTemplate = new JdbcTemplate(dataSource); |
|||
} |
|||
|
|||
public Map<String, Object> getstatusdetails(String reqNo) { |
|||
Map<String, Object> response = new HashMap<>(); |
|||
|
|||
String sql = "SELECT id FROM vendor_details WHERE vendor_req_id = ?"; |
|||
|
|||
try { |
|||
String idForReq = gccstrTemplate.queryForObject(sql, String.class, reqNo); |
|||
|
|||
if (idForReq == null || idForReq.trim().isEmpty()) { |
|||
response.put("status", "nodata"); |
|||
} else { |
|||
response.put("status", "Success"); |
|||
response.put("message", "Data Found In Vendor Details"); |
|||
|
|||
int idReq=Integer.parseInt(idForReq); |
|||
|
|||
System.out.println("idReq==="+idReq); |
|||
|
|||
// Create a list to hold all approval history |
|||
List<Map<String, Object>> approvedHistory = new ArrayList<>(); |
|||
|
|||
|
|||
String sql1="SELECT id,date(cdate) as date,remarks,cby,status FROM vendor_approval_level_1 WHERE vdid=?"; |
|||
List<Map<String, Object>> list1 =gccstrTemplate.queryForList(sql1,idReq); |
|||
|
|||
if(list1.isEmpty()) { |
|||
response.put("overall_status", "Your Request is waiting For LI Approval"); |
|||
} |
|||
else { |
|||
|
|||
boolean allApproved = true; |
|||
for (Map<String, Object> row : list1) { |
|||
Object statusObj = row.get("status"); |
|||
String status = (statusObj != null) ? statusObj.toString().trim() : ""; |
|||
|
|||
if (!status.equalsIgnoreCase("Approved")) { |
|||
allApproved = false; |
|||
break; |
|||
} |
|||
} |
|||
|
|||
// Set overall_status based on status values |
|||
if (allApproved) |
|||
{ |
|||
response.put("overall_status", "Your Request is waiting For ARO Approval"); |
|||
|
|||
for (Map<String, Object> row : list1) { |
|||
row.put("Name", "LI INSPECTION"); |
|||
} |
|||
approvedHistory.addAll(list1); |
|||
|
|||
String sql2="SELECT id,date(cdate) as date,remarks,cby,status FROM vendor_approval_level_2 WHERE vdid=?"; |
|||
List<Map<String, Object>> list2 =gccstrTemplate.queryForList(sql2,idReq); |
|||
|
|||
if(list2.isEmpty()) |
|||
{ |
|||
response.put("overall_status", "Your Request is waiting For ARO Approval"); |
|||
} |
|||
else |
|||
{ |
|||
|
|||
boolean allApproved1 = true; |
|||
for (Map<String, Object> row : list2) |
|||
{ |
|||
Object statusObj = row.get("status"); |
|||
String status = (statusObj != null) ? statusObj.toString().trim() : ""; |
|||
|
|||
if (!status.equalsIgnoreCase("Approved")) |
|||
{ |
|||
allApproved1 = false; |
|||
break; |
|||
} |
|||
} |
|||
|
|||
// Set overall_status based on status values |
|||
if (allApproved1) |
|||
{ |
|||
response.put("overall_status", "Your Request is waiting For SEE Approval"); |
|||
|
|||
for (Map<String, Object> row : list2) |
|||
{ |
|||
row.put("Name", "ARO INSPECTION"); |
|||
} |
|||
approvedHistory.addAll(list2); |
|||
|
|||
String sql3="SELECT id,date(cdate) as date,remarks,cby,status FROM vendor_approval_level_3 WHERE vdid=?"; |
|||
List<Map<String, Object>> list3 =gccstrTemplate.queryForList(sql3,idReq); |
|||
|
|||
if(list3.isEmpty()) |
|||
{ |
|||
response.put("overall_status", "Your Request is waiting For SEE Approval"); |
|||
} |
|||
else |
|||
{ |
|||
|
|||
boolean allApproved2 = true; |
|||
for (Map<String, Object> row : list3) |
|||
{ |
|||
Object statusObj = row.get("status"); |
|||
String status = (statusObj != null) ? statusObj.toString().trim() : ""; |
|||
|
|||
if (!status.equalsIgnoreCase("Approved")) { |
|||
allApproved2 = false; |
|||
break; |
|||
} |
|||
} |
|||
|
|||
// Set overall_status based on status values |
|||
if (allApproved2) |
|||
{ |
|||
response.put("overall_status", "Your Request is waiting For Vending Committe Approval"); |
|||
for (Map<String, Object> row : list3) { |
|||
row.put("Name", "SEE INSPECTION"); |
|||
} |
|||
approvedHistory.addAll(list3); |
|||
|
|||
String sql4="SELECT id,date(cdate) as date,remarks,status FROM vendor_request_list WHERE request_no=?"; |
|||
List<Map<String, Object>> list4 =vendingcommitteTemplate.queryForList(sql4,reqNo); |
|||
|
|||
if(list4.isEmpty()) { |
|||
response.put("overall_status", "Your Request is waiting For Vending Committe Approval"); |
|||
} |
|||
else |
|||
{ |
|||
|
|||
boolean allApproved3 = true; |
|||
for (Map<String, Object> row : list4) { |
|||
Object statusObj = row.get("status"); |
|||
String status = (statusObj != null) ? statusObj.toString().trim() : ""; |
|||
|
|||
if (!status.equalsIgnoreCase("Approved")) { |
|||
allApproved3 = false; |
|||
break; |
|||
} |
|||
} |
|||
|
|||
// Set overall_status based on status values |
|||
if (allApproved3) |
|||
{ |
|||
response.put("overall_status", "Your Request Process is Completed"); |
|||
for (Map<String, Object> row : list4) { |
|||
row.put("Name", "Vending Committe"); |
|||
} |
|||
approvedHistory.addAll(list4); |
|||
} |
|||
else |
|||
{ |
|||
response.put("overall_status", "Your Request is Rejected By Vending Committe"); |
|||
for (Map<String, Object> row : list4) { |
|||
row.put("Name", "Vending Committe"); |
|||
} |
|||
approvedHistory.addAll(list4); |
|||
} |
|||
|
|||
} |
|||
|
|||
} |
|||
else |
|||
{ |
|||
response.put("overall_status", "Your Request is Rejected By SEE"); |
|||
for (Map<String, Object> row : list3) { |
|||
row.put("Name", "SEE INSPECTION"); |
|||
} |
|||
approvedHistory.addAll(list3); |
|||
} |
|||
|
|||
} |
|||
|
|||
} |
|||
else |
|||
{ |
|||
response.put("overall_status", "Your Request is Rejected By ARO"); |
|||
|
|||
for (Map<String, Object> row : list2) |
|||
{ |
|||
row.put("Name", "ARO INSPECTION"); |
|||
} |
|||
approvedHistory.addAll(list2); |
|||
} |
|||
|
|||
} |
|||
|
|||
} |
|||
else |
|||
{ |
|||
response.put("overall_status", "Your Request is Rejected By LI"); |
|||
|
|||
for (Map<String, Object> row : list1) { |
|||
row.put("Name", "LI INSPECTION"); |
|||
} |
|||
|
|||
approvedHistory.addAll(list1); |
|||
} |
|||
|
|||
|
|||
} |
|||
|
|||
response.put("approved_history", approvedHistory); |
|||
|
|||
|
|||
} |
|||
|
|||
} catch (EmptyResultDataAccessException e) { |
|||
// No rows found |
|||
response.put("status", "nodata"); |
|||
response.put("message", "No Data Found For This Request Number"); |
|||
} catch (Exception e) { |
|||
// Other unexpected exceptions |
|||
response.put("status", "error"); |
|||
response.put("message", e.getMessage()); |
|||
} |
|||
|
|||
return response; |
|||
} |
|||
|
|||
public Map<String, Object> getiddetails(String id) { |
|||
String filebaseurl = "https://gccservices.in/gccofficialapp/files"; |
|||
|
|||
String sql = "SELECT vd.*, vcm.vending_category_name, vtm.vending_time AS vending_time, " + |
|||
" va1.vending_nature AS vending_nature, " + |
|||
"CONCAT(?, vd.street_vendor_photo) AS photo_url, " + |
|||
"DATE_FORMAT(vd.dob, '%d-%m-%Y') AS formatted_dob, " + |
|||
"TIMESTAMPDIFF(YEAR, vd.dob, CURDATE()) AS age, " + |
|||
"tvcm.tamil_vending_category_name AS tamil_cat_name " + |
|||
"FROM vendor_details vd " + |
|||
"LEFT JOIN vending_category_master vcm ON vcm.id = vd.vending_category " + |
|||
"LEFT JOIN vendor_approval_level_1 va1 ON va1.vdid = vd.id " + |
|||
" LEFT JOIN vending_time_master vtm ON vtm.id = va1.vendor_timing_id " + |
|||
"LEFT JOIN tamil_vending_category_master tvcm ON tvcm.id = vd.tamil_vending_category " + |
|||
"WHERE vd.id = ?"; |
|||
|
|||
|
|||
Map<String, Object> baseData = gccstrTemplate.queryForMap(sql, filebaseurl, id); |
|||
|
|||
String vcSql = |
|||
"SELECT uid_no, status, remarks, DATE_FORMAT(cdate, '%d-%m-%Y') AS cdate " + |
|||
"FROM vendor_request_list WHERE vdid = ? AND isactive = 1 ORDER BY id DESC LIMIT 1"; |
|||
|
|||
List<Map<String, Object>> vcList = vendingcommitteTemplate.queryForList(vcSql, id); |
|||
|
|||
String uid = ""; |
|||
String vcStatus = ""; |
|||
String vcRemarks = ""; |
|||
String vcDate = ""; |
|||
|
|||
if (!vcList.isEmpty()) { |
|||
Map<String, Object> vc = vcList.get(0); |
|||
|
|||
uid = vc.get("uid_no") == null ? "" : vc.get("uid_no").toString(); |
|||
vcStatus = vc.get("status") == null ? "" : vc.get("status").toString(); |
|||
vcRemarks = vc.get("remarks") == null ? "" : vc.get("remarks").toString(); |
|||
vcDate = vc.get("cdate") == null ? "" : vc.get("cdate").toString(); |
|||
} |
|||
|
|||
baseData.put("uid_no", uid); |
|||
baseData.put("vc_status", vcStatus); |
|||
// baseData.put("vc_remarks", vcRemarks); |
|||
baseData.put("issued_date", vcDate); |
|||
|
|||
return baseData; |
|||
} |
|||
|
|||
|
|||
public List<Map<String, Object>> fetchCommunities() { |
|||
String query = "SELECT id,category_name " + |
|||
"FROM social_category_master " + |
|||
"WHERE is_active=1 AND is_delete=0 "; |
|||
|
|||
|
|||
return gccstrTemplate.queryForList(query); |
|||
} |
|||
|
|||
|
|||
|
|||
public List<Map<String, Object>> fetchMaritalStatus() { |
|||
String query = "SELECT id,marital_status " + |
|||
"FROM marital_status_master " + |
|||
"WHERE is_active=1 AND is_delete=0 "; |
|||
|
|||
|
|||
return gccstrTemplate.queryForList(query); |
|||
} |
|||
|
|||
|
|||
|
|||
public List<Map<String, Object>> fetchEducationStatus() { |
|||
String query = "SELECT id,education " + |
|||
"FROM education_master " + |
|||
"WHERE is_active=1 AND is_delete=0 "; |
|||
|
|||
|
|||
return gccstrTemplate.queryForList(query); |
|||
} |
|||
|
|||
public List<Map<String, Object>> fetchvendingCategory() { |
|||
String query = "SELECT id,vending_category_name " + |
|||
"FROM vending_category_master " + |
|||
"WHERE is_active=1 AND is_delete=0 "; |
|||
|
|||
|
|||
return gccstrTemplate.queryForList(query); |
|||
} |
|||
|
|||
public List<Map<String, Object>> fetchtamilvendingCategory() { |
|||
String query = "SELECT id,tamil_vending_category_name " + |
|||
"FROM tamil_vending_category_master " + |
|||
"WHERE is_active=1 AND is_delete=0 "; |
|||
|
|||
|
|||
return gccstrTemplate.queryForList(query); |
|||
} |
|||
|
|||
public boolean isMobileRegistered(String mobilenumber) { |
|||
String sql = "SELECT COUNT(*) FROM vendor_details WHERE mob_no = ?"; |
|||
Integer count = gccstrTemplate.queryForObject(sql, new Object[]{mobilenumber}, Integer.class); |
|||
return count != null && count > 0; |
|||
} |
|||
|
|||
// public String saveStreetVendorDetails(String latitude,String longitude,String zone, String ward, String landmark, String vending_district, |
|||
// Integer vending_pincode, Integer vending_category, String vending_space, Boolean pm_svanidhi_loan, |
|||
// Boolean bank_acc_status, String bankPassbookPath, String streetVendorPhotoPath, String name, |
|||
// String f_h_name, String mobile_number, String dob, String gender, Integer social_category, Boolean diff_abled, |
|||
// Integer education_status, Integer marital_status, Integer no_of_fam_mem, Boolean are_any_fam_mem_invol_str, |
|||
// String presentAddress, String present_district, Integer present_pincode, String rationCardPath, |
|||
// String aadharFrontPhotoPath, String aadharBackPhotoPath,String aadharNo,String tamil_name,String tamil_f_h_name,String tamil_landmark, |
|||
// String tamil_gender,String tamil_present_district,@RequestParam Integer tamilvending_category) { |
|||
|
|||
|
|||
|
|||
|
|||
public String saveStreetVendorDetails( |
|||
VendorRequest request, |
|||
String bankPassbookPath, |
|||
String streetVendorPhotoPath, |
|||
String presentAddress, |
|||
String rationCardPath, |
|||
String aadharFrontPhotoPath, |
|||
String aadharBackPhotoPath |
|||
) { |
|||
|
|||
int isWeb=1; |
|||
// String latitudeVal = (latitude != null && !latitude.trim().isEmpty()) ? latitude : null; |
|||
// String longitudeVal = (longitude != null && !longitude.trim().isEmpty()) ? longitude : null; |
|||
// String zoneVal = (zone != null && !zone.trim().isEmpty()) ? zone : null; |
|||
// String wardVal = (ward != null && !ward.trim().isEmpty()) ? ward : null; |
|||
// String dobVal = (dob != null && !dob.trim().isEmpty()) ? dob : null; |
|||
// String vendingAddressVal = (landmark != null && !landmark.trim().isEmpty()) ? landmark : null; |
|||
|
|||
String latitudeVal = (request.getLatitude() != null && !request.getLatitude().trim().isEmpty()) ? request.getLatitude() : null; |
|||
String longitudeVal = (request.getLongitude() != null && !request.getLongitude().trim().isEmpty()) ? request.getLongitude() : null; |
|||
String zoneVal = (request.getZone() != null && !request.getZone().trim().isEmpty()) ? request.getZone() : null; |
|||
String wardVal = (request.getWard() != null && !request.getWard().trim().isEmpty()) ? request.getWard() : null; |
|||
String dobVal = (request.getDob() != null && !request.getDob().trim().isEmpty()) ? request.getDob() : null; |
|||
String vendingAddressVal = (request.getLandmark() != null && !request.getLandmark().trim().isEmpty()) ? request.getLandmark() : null; |
|||
|
|||
|
|||
|
|||
String sql = "INSERT INTO vendor_details (" |
|||
+ "latitude,longitude,zone, ward, vending_address,vending_district, vending_pincode, vending_category, vending_space, pm_svanidhi_loan, " |
|||
+ "bank_acc_status, bank_passbook, street_vendor_photo, name, f_h_name, mob_no, " |
|||
+ "dob,gender,social_category, diff_abled, education_status, marital_status,no_of_fam_mem, " |
|||
+ "are_any_fam_mem_invol_str_ven,present_address, present_district, present_pincode, ration_card_photo, aadhar_front_photo, " |
|||
+ "aadhar_back_photo,aadhar_no,is_web,tamil_name,tamil_f_h_name,tamil_landmark,tamil_gender,tamil_present_district,tamil_vending_category " |
|||
+ ") VALUES (?,?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,?,?,?,?,?,?,?,?,?,?)"; |
|||
|
|||
KeyHolder keyHolder = new GeneratedKeyHolder(); |
|||
|
|||
try { |
|||
int result = gccstrTemplate.update(connection -> { |
|||
PreparedStatement ps = connection.prepareStatement(sql, new String[] { "id" }); |
|||
ps.setString(1, latitudeVal); |
|||
ps.setString(2, longitudeVal); |
|||
ps.setString(3, zoneVal); |
|||
ps.setString(4, wardVal); |
|||
ps.setString(5, vendingAddressVal); |
|||
// ps.setString(6, vending_district); |
|||
// if (vending_pincode != null) ps.setInt(7, vending_pincode); |
|||
// else ps.setNull(7, java.sql.Types.INTEGER); |
|||
// |
|||
// if (vending_category != null) ps.setInt(8, vending_category); |
|||
// else ps.setNull(8, java.sql.Types.INTEGER); |
|||
// ps.setString(9, vending_space); |
|||
// if (pm_svanidhi_loan != null) ps.setBoolean(10, pm_svanidhi_loan); |
|||
// else ps.setNull(10, java.sql.Types.BOOLEAN); |
|||
// |
|||
// if (bank_acc_status != null) ps.setBoolean(11, bank_acc_status); |
|||
// else ps.setNull(11, java.sql.Types.BOOLEAN); |
|||
// ps.setString(12, bankPassbookPath); |
|||
// ps.setString(13, streetVendorPhotoPath); |
|||
// ps.setString(14, name); |
|||
// ps.setString(15, f_h_name); |
|||
// ps.setString(16, mobile_number); |
|||
// ps.setString(17, dobVal); |
|||
// ps.setString(18, gender); |
|||
// if (social_category != null) ps.setInt(19, social_category); |
|||
// else ps.setNull(19, java.sql.Types.INTEGER); |
|||
// if (diff_abled != null) ps.setBoolean(20, diff_abled); |
|||
// else ps.setNull(20, java.sql.Types.BOOLEAN); |
|||
// if (education_status != null) ps.setInt(21, education_status); |
|||
// else ps.setNull(21, java.sql.Types.INTEGER); |
|||
// |
|||
// if (marital_status != null) ps.setInt(22, marital_status); |
|||
// else ps.setNull(22, java.sql.Types.INTEGER); |
|||
// |
|||
// if (no_of_fam_mem != null) ps.setInt(23, no_of_fam_mem); |
|||
// else ps.setNull(23, java.sql.Types.INTEGER); |
|||
// if (are_any_fam_mem_invol_str != null) ps.setBoolean(24, are_any_fam_mem_invol_str); |
|||
// else ps.setNull(24, java.sql.Types.BOOLEAN); |
|||
// ps.setString(25, presentAddress); |
|||
// ps.setString(26, present_district); |
|||
// if (present_pincode != null) ps.setInt(27, present_pincode); |
|||
// else ps.setNull(27, java.sql.Types.INTEGER); |
|||
// ps.setString(28, rationCardPath); |
|||
// ps.setString(29, aadharFrontPhotoPath); |
|||
// ps.setString(30, aadharBackPhotoPath); |
|||
// ps.setString(31, aadharNo); |
|||
// ps.setInt(32, isWeb); |
|||
// ps.setString(33, tamil_name); |
|||
// ps.setString(34, tamil_f_h_name); |
|||
// ps.setString(35, tamil_landmark); |
|||
// ps.setString(36, tamil_gender); |
|||
// ps.setString(37, tamil_present_district); |
|||
// if (tamilvending_category != null) ps.setInt(38, tamilvending_category); |
|||
ps.setString(6, request.getVending_district()); |
|||
if (request.getVending_pincode() != null) ps.setInt(7, request.getVending_pincode()); |
|||
else ps.setNull(7, java.sql.Types.INTEGER); |
|||
|
|||
if (request.getVending_category() != null) ps.setInt(8, request.getVending_category()); |
|||
else ps.setNull(8, java.sql.Types.INTEGER); |
|||
ps.setString(9, request.getVending_space()); |
|||
if (request.getPm_svanidhi_loan() != null) ps.setBoolean(10, request.getPm_svanidhi_loan()); |
|||
else ps.setNull(10, java.sql.Types.BOOLEAN); |
|||
|
|||
if (request.getBank_acc_status() != null) ps.setBoolean(11, request.getBank_acc_status()); |
|||
else ps.setNull(11, java.sql.Types.BOOLEAN); |
|||
ps.setString(12, bankPassbookPath); |
|||
ps.setString(13, streetVendorPhotoPath); |
|||
ps.setString(14, request.getName()); |
|||
ps.setString(15, request.getF_h_name()); |
|||
ps.setString(16, request.getMobile_number()); |
|||
ps.setString(17, dobVal); |
|||
ps.setString(18, request.getGender()); |
|||
if (request.getSocial_category() != null) ps.setInt(19, request.getSocial_category()); |
|||
else ps.setNull(19, java.sql.Types.INTEGER); |
|||
if (request.getDiff_abled() != null) ps.setBoolean(20, request.getDiff_abled()); |
|||
else ps.setNull(20, java.sql.Types.BOOLEAN); |
|||
if (request.getEducation_status() != null) ps.setInt(21, request.getEducation_status()); |
|||
else ps.setNull(21, java.sql.Types.INTEGER); |
|||
|
|||
if (request.getMarital_status() != null) ps.setInt(22, request.getMarital_status()); |
|||
else ps.setNull(22, java.sql.Types.INTEGER); |
|||
|
|||
if (request.getNo_of_fam_mem() != null) ps.setInt(23, request.getNo_of_fam_mem()); |
|||
else ps.setNull(23, java.sql.Types.INTEGER); |
|||
if (request.getAre_any_fam_mem_invol_str() != null) ps.setBoolean(24, request.getAre_any_fam_mem_invol_str()); |
|||
else ps.setNull(24, java.sql.Types.BOOLEAN); |
|||
ps.setString(25, presentAddress); |
|||
ps.setString(26, request.getPresent_district()); |
|||
if (request.getPresent_pincode() != null) ps.setInt(27, request.getPresent_pincode()); |
|||
else ps.setNull(27, java.sql.Types.INTEGER); |
|||
ps.setString(28, rationCardPath); |
|||
ps.setString(29, aadharFrontPhotoPath); |
|||
ps.setString(30, aadharBackPhotoPath); |
|||
ps.setString(31, request.getAadharNo()); |
|||
ps.setInt(32, isWeb); |
|||
ps.setString(33, request.getTamil_name()); |
|||
ps.setString(34, request.getTamil_f_h_name()); |
|||
ps.setString(35, request.getTamil_landmark()); |
|||
ps.setString(36, request.getTamil_gender()); |
|||
ps.setString(37, request.getTamil_present_district()); |
|||
if (request.getTamilvending_category() != null) ps.setInt(38, request.getTamilvending_category()); |
|||
else ps.setNull(39, java.sql.Types.INTEGER); |
|||
return ps; |
|||
}, keyHolder); |
|||
//return keyHolder.getKey().intValue(); |
|||
if (result > 0) { |
|||
int generatedId = keyHolder.getKey().intValue(); |
|||
String prefix = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd")); |
|||
String refId = prefix + generatedId; |
|||
|
|||
String updateSql = " UPDATE vendor_details SET vendor_req_id = ? WHERE id = ? "; |
|||
gccstrTemplate.update(updateSql,refId, generatedId); |
|||
return refId; |
|||
} |
|||
//return "error"; |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
} |
|||
return "error"; |
|||
} |
|||
|
|||
|
|||
|
|||
public String fileUpload(MultipartFile file, String name) { |
|||
|
|||
// Set the file path where you want to save it |
|||
String uploadDirectory = environment.getProperty("file.upload.directory.mobile"); |
|||
String serviceFolderName = environment.getProperty("street_vendor_foldername"); |
|||
var year = DateTimeUtil.getCurrentYear(); |
|||
var month = DateTimeUtil.getCurrentMonth(); |
|||
|
|||
uploadDirectory = uploadDirectory + serviceFolderName + "/" + year + "/" + month; |
|||
|
|||
try { |
|||
// Create directory if it doesn't exist |
|||
Path directoryPath = Paths.get(uploadDirectory); |
|||
if (!Files.exists(directoryPath)) { |
|||
Files.createDirectories(directoryPath); |
|||
} |
|||
|
|||
// Datetime string |
|||
String datetimetxt = DateTimeUtil.getCurrentDateTime(); |
|||
|
|||
// File name |
|||
String fileName = name + "_" + datetimetxt + "_" + file.getOriginalFilename(); |
|||
fileName = fileName.replaceAll("\\s+", ""); // Remove space on filename |
|||
|
|||
String filePath = uploadDirectory + "/" + fileName; |
|||
|
|||
String filepath_txt = "/" + serviceFolderName + "/" + year + "/" + month + "/" + fileName; |
|||
|
|||
// Create a new Path object |
|||
Path path = Paths.get(filePath); |
|||
|
|||
// Get the bytes of the file |
|||
byte[] bytes = file.getBytes(); |
|||
|
|||
/* |
|||
* // Compress the image BufferedImage image = ImageIO.read(new |
|||
* ByteArrayInputStream(bytes)); byte[] compressedBytes = compressImage(image, |
|||
* 0.5f); // Compress with 50% quality |
|||
* |
|||
* // Write the bytes to the file |
|||
* Files.write(path, compressedBytes); |
|||
*/ |
|||
|
|||
Files.write(path, bytes); |
|||
|
|||
//System.out.println(filePath); |
|||
return filepath_txt; |
|||
|
|||
} catch (IOException e) { |
|||
e.printStackTrace(); |
|||
return "Failed to save file " + file.getOriginalFilename(); |
|||
} |
|||
} |
|||
|
|||
public Integer findLatestVendorIdByMobile(String mobile) { |
|||
String sql = "SELECT id FROM vendor_details WHERE mob_no = ? ORDER BY id DESC LIMIT 1"; |
|||
|
|||
try { |
|||
return gccstrTemplate.queryForObject(sql, new Object[]{mobile}, Integer.class); |
|||
} catch (Exception e) { |
|||
return null; // mobile not registered |
|||
} |
|||
} |
|||
|
|||
public Map<String, Object> checkVendorInVendingTables(Integer vdid) { |
|||
|
|||
Map<String, Object> result = new HashMap<>(); |
|||
|
|||
// 1. Check postponed table |
|||
String sqlPostponed = "SELECT COUNT(*) FROM vendor_postponed_list WHERE vdid=? AND isactive=1"; |
|||
Integer postponed = vendingcommitteTemplate.queryForObject(sqlPostponed, Integer.class, vdid); |
|||
if (postponed != null && postponed > 0) { |
|||
result.put("status", "POSTPONED"); |
|||
return result; |
|||
} |
|||
|
|||
// 2. Check vendor_request_list (latest status) |
|||
String sqlRequest = |
|||
"SELECT status FROM vendor_request_list WHERE vdid=? AND isactive=1 ORDER BY id DESC LIMIT 1"; |
|||
|
|||
List<Map<String, Object>> reqList = vendingcommitteTemplate.queryForList(sqlRequest, vdid); |
|||
if (reqList.isEmpty()) { |
|||
result.put("status", "NO_EVENT"); |
|||
return result; |
|||
} |
|||
|
|||
String status = reqList.get(0).get("status").toString(); |
|||
result.put("status", status); |
|||
|
|||
return result; |
|||
} |
|||
|
|||
public List<Map<String, Object>> getdatabymobnum(String mobileNum) { |
|||
|
|||
List<Map<String, Object>> resultList = new ArrayList<>(); |
|||
|
|||
String sql = "SELECT id, name, mob_no,DATE_FORMAT(cdate, '%d-%m-%Y %l:%i %p') as cdate FROM vendor_details WHERE mob_no = ?"; |
|||
List<Map<String, Object>> vendorList = gccstrTemplate.queryForList(sql, mobileNum); |
|||
|
|||
if (vendorList.isEmpty()) { |
|||
Map<String, Object> msg = new HashMap<>(); |
|||
msg.put("message", "No vendor found with this mobile number."); |
|||
return List.of(msg); |
|||
} |
|||
|
|||
for (Map<String, Object> vendor : vendorList) { |
|||
|
|||
int vdid = Integer.parseInt(vendor.get("id").toString()); |
|||
|
|||
Map<String, Object> finalObj = new LinkedHashMap<>(); |
|||
finalObj.put("vdid", vdid); |
|||
finalObj.put("name", vendor.get("name")); |
|||
finalObj.put("mobile", vendor.get("mob_no")); |
|||
finalObj.put("cdate", vendor.get("cdate")); |
|||
|
|||
/* -------------------------- |
|||
STEP 2: LI CHECK |
|||
-------------------------- */ |
|||
String liSql = |
|||
"SELECT status, remarks , DATE_FORMAT(cdate, '%d-%m-%Y %l:%i %p') as cdate " + |
|||
"FROM vendor_approval_level_1 WHERE vdid=? ORDER BY id DESC LIMIT 1"; |
|||
|
|||
List<Map<String, Object>> liList = gccstrTemplate.queryForList(liSql, vdid); |
|||
|
|||
if (!liList.isEmpty()) { |
|||
Map<String, Object> li = liList.get(0); |
|||
finalObj.put("LI_Status", li.get("status")); |
|||
finalObj.put("LI_Remarks", li.get("remarks")); |
|||
finalObj.put("LI_Cdate", li.get("cdate")); |
|||
} else { |
|||
finalObj.put("LI_Status", "Pending"); |
|||
finalObj.put("LI_Remarks", ""); |
|||
finalObj.put("LI_Cdate", ""); |
|||
} |
|||
|
|||
/* -------------------------- |
|||
STEP 3: ARO CHECK |
|||
-------------------------- */ |
|||
String aroSql = |
|||
"SELECT status, remarks, DATE_FORMAT(cdate, '%d-%m-%Y %l:%i %p') as cdate " + |
|||
"FROM vendor_approval_level_2 WHERE vdid=? ORDER BY id DESC LIMIT 1"; |
|||
|
|||
List<Map<String, Object>> aroList = gccstrTemplate.queryForList(aroSql, vdid); |
|||
|
|||
if (!aroList.isEmpty()) { |
|||
Map<String, Object> aro = aroList.get(0); |
|||
finalObj.put("ARO_Status", aro.get("status")); |
|||
finalObj.put("ARO_Remarks", aro.get("remarks")); |
|||
finalObj.put("ARO_Cdate", aro.get("cdate")); |
|||
} else { |
|||
finalObj.put("ARO_Status", "Pending"); |
|||
finalObj.put("ARO_Remarks", ""); |
|||
finalObj.put("ARO_Cdate", ""); |
|||
} |
|||
|
|||
/* -------------------------- |
|||
STEP 4: EE CHECK |
|||
-------------------------- */ |
|||
String eeSql = |
|||
"SELECT status, remarks, DATE_FORMAT(cdate, '%d-%m-%Y %l:%i %p') as cdate " + |
|||
"FROM vendor_approval_level_3 WHERE vdid=? ORDER BY id DESC LIMIT 1"; |
|||
|
|||
List<Map<String, Object>> eeList = gccstrTemplate.queryForList(eeSql, vdid); |
|||
|
|||
if (!eeList.isEmpty()) { |
|||
Map<String, Object> ee = eeList.get(0); |
|||
finalObj.put("EE_Status", ee.get("status")); |
|||
finalObj.put("EE_Remarks", ee.get("remarks")); |
|||
finalObj.put("EE_Cdate", ee.get("cdate")); |
|||
} else { |
|||
finalObj.put("EE_Status", "Pending"); |
|||
finalObj.put("EE_Remarks", ""); |
|||
finalObj.put("EE_Cdate", ""); |
|||
} |
|||
|
|||
/* -------------------------- |
|||
STEP 5: VENDING COMMITTEE |
|||
-------------------------- */ |
|||
|
|||
String vcSql = |
|||
"SELECT status, remarks, DATE_FORMAT(cdate, '%d-%m-%Y %l:%i %p') as cdate " + |
|||
"FROM vendor_request_list WHERE vdid=? AND isactive=1 ORDER BY id DESC LIMIT 1"; |
|||
|
|||
List<Map<String, Object>> vcList = vendingcommitteTemplate.queryForList(vcSql, vdid); |
|||
|
|||
String postSql = |
|||
"SELECT status, remarks, DATE_FORMAT(cdate, '%d-%m-%Y %l:%i %p') as cdate " + |
|||
"FROM vendor_postponed_list WHERE vdid=? AND isactive=1 ORDER BY id DESC LIMIT 1"; |
|||
|
|||
List<Map<String, Object>> postList = vendingcommitteTemplate.queryForList(postSql, vdid); |
|||
|
|||
String histSql = |
|||
"SELECT status, remarks, DATE_FORMAT(cdate, '%d-%m-%Y %l:%i %p') as cdate " + |
|||
"FROM postponed_history_log WHERE vdid=? ORDER BY cdate ASC"; |
|||
|
|||
List<Map<String, Object>> histList = vendingcommitteTemplate.queryForList(histSql, vdid); |
|||
|
|||
String vcStatus = "Pending"; |
|||
|
|||
if (!vcList.isEmpty()) { |
|||
vcStatus = vcList.get(0).get("status").toString(); |
|||
} else if (!postList.isEmpty()) { |
|||
vcStatus = postList.get(0).get("status").toString(); |
|||
} else if (!histList.isEmpty()) { |
|||
vcStatus = histList.get(histList.size() - 1).get("status").toString(); |
|||
} |
|||
|
|||
finalObj.put("VC_Status", vcStatus); |
|||
|
|||
/* Build Full VC History */ |
|||
List<Map<String, Object>> fullHistory = new ArrayList<>(); |
|||
|
|||
// HIST LIST |
|||
for (Map<String, Object> h : histList) { |
|||
fullHistory.add(safeHistoryRecord(h)); |
|||
} |
|||
|
|||
// POSTPONED LIST |
|||
if (!postList.isEmpty()) { |
|||
fullHistory.add(safeHistoryRecord(postList.get(0))); |
|||
} |
|||
|
|||
// REQUEST LIST (Approved / Rejected) |
|||
if (!vcList.isEmpty()) { |
|||
fullHistory.add(safeHistoryRecord(vcList.get(0))); |
|||
} |
|||
|
|||
finalObj.put("VC_History", fullHistory); |
|||
|
|||
/* Final Message */ |
|||
finalObj.put("message", generateMessage( |
|||
finalObj.get("LI_Status").toString(), |
|||
finalObj.get("ARO_Status").toString(), |
|||
finalObj.get("EE_Status").toString(), |
|||
vcStatus |
|||
)); |
|||
|
|||
resultList.add(finalObj); |
|||
} |
|||
|
|||
return resultList; |
|||
} |
|||
|
|||
private Map<String, Object> safeHistoryRecord(Map<String, Object> row) { |
|||
Map<String, Object> m = new LinkedHashMap<>(); |
|||
m.put("status", row.get("status") == null ? "" : row.get("status")); |
|||
m.put("remarks", row.get("remarks") == null ? "" : row.get("remarks")); |
|||
m.put("cdate", row.get("cdate") == null ? "" : row.get("cdate")); |
|||
return m; |
|||
} |
|||
|
|||
|
|||
private String generateMessage(String li, String aro, String ee, String vc) { |
|||
|
|||
// Step 1 → LI |
|||
if (li.equalsIgnoreCase("Pending")) |
|||
return "Your application is waiting for LI Approval"; |
|||
|
|||
// Step 2 → ARO |
|||
if (aro.equalsIgnoreCase("Pending")) |
|||
return "Your application is waiting for ARO Approval"; |
|||
|
|||
// Step 3 → EE |
|||
if (ee.equalsIgnoreCase("Pending")) |
|||
return "Your application is waiting for EE Approval"; |
|||
|
|||
// Step 4 → Vending Committee final status |
|||
if (vc.equalsIgnoreCase("Postponed")) |
|||
return "Your application is Postponed"; |
|||
|
|||
if (vc.equalsIgnoreCase("Approved")) |
|||
return "Your application is Approved"; |
|||
|
|||
if (vc.equalsIgnoreCase("Rejected")) |
|||
return "Your application is Rejected"; |
|||
|
|||
// Final fallback |
|||
return "Your application is waiting for Vending Committee Approval"; |
|||
} |
|||
|
|||
|
|||
|
|||
} |
|||
@ -0,0 +1,24 @@ |
|||
spring.application.name=streetvendorlicense |
|||
|
|||
server.port=8056 |
|||
|
|||
app.baseUrl=http://localhost:8056/ |
|||
|
|||
app.title=GCC STREET VENDOR LICENSE |
|||
|
|||
#////////// For street vendor //////////// |
|||
street_vendor_foldername=street_vendor_files |
|||
|
|||
file.upload.directory.mobile=${user.dir}/gcc_mobile_service_uploads/ |
|||
|
|||
app.getOtpUrl=https://tmegov.onex-aura.com/api/sms? |
|||
|
|||
spring.servlet.multipart.enabled=true |
|||
# Max file size |
|||
spring.servlet.multipart.max-file-size=20MB |
|||
spring.servlet.multipart.max-request-size=20MB |
|||
|
|||
# FIX for FileCountLimitExceededException |
|||
server.tomcat.max-swallow-size=-1 |
|||
server.tomcat.max-http-form-post-size=-1 |
|||
server.tomcat.max-file-count=50 |
|||
@ -0,0 +1,25 @@ |
|||
spring.application.name=streetvendorlicense |
|||
|
|||
server.port=8056 |
|||
|
|||
app.baseUrl=https://gccservices.in/streetvendorlicense/ |
|||
|
|||
app.title=GCC STREET VENDOR LICENSE |
|||
|
|||
app.getOtpUrl=https://tmegov.onex-aura.com/api/sms? |
|||
|
|||
#////////// For street vendor //////////// |
|||
street_vendor_foldername=street_vendor_files |
|||
|
|||
file.upload.directory.mobile=${user.dir}/gcc_mobile_service_uploads/ |
|||
|
|||
|
|||
spring.servlet.multipart.enabled=true |
|||
# Max file size |
|||
spring.servlet.multipart.max-file-size=20MB |
|||
spring.servlet.multipart.max-request-size=20MB |
|||
|
|||
# FIX for FileCountLimitExceededException |
|||
server.tomcat.max-swallow-size=-1 |
|||
server.tomcat.max-http-form-post-size=-1 |
|||
server.tomcat.max-file-count=50 |
|||
@ -0,0 +1,3 @@ |
|||
spring.application.name=streetvendorlicense |
|||
|
|||
spring.profiles.active=dev |
|||
@ -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(); |
|||
1110
src/main/resources/static/assets/_js/main/modules/helpers.js
File diff suppressed because it is too large
View File
@ -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)); |
|||
} |
|||
} |
|||
@ -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()); |
|||
@ -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()); |
|||
@ -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; |
|||
}); |
|||
@ -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()); |
|||
@ -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()); |
|||
@ -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()); |
|||
@ -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()); |
|||
@ -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()); |
|||
@ -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()); |
|||
@ -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()); |
|||
@ -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()); |
|||
@ -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(); |
|||
}); |
|||
@ -0,0 +1,104 @@ |
|||
/* |
|||
* Document : be_pages_ecom_dashboard.js |
|||
* Author : pixelcave |
|||
* Description: Custom JS code used in eCommerce Dashboard Page |
|||
*/ |
|||
|
|||
// Chart.js Charts, for more examples you can check out http://www.chartjs.org/docs
|
|||
class pageEcomDashboard { |
|||
/* |
|||
* Init Charts |
|||
* |
|||
*/ |
|||
static initOverviewChart() { |
|||
// 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.point.radius = 0; |
|||
Chart.defaults.elements.point.hoverRadius = 0; |
|||
Chart.defaults.plugins.tooltip.radius = 3; |
|||
Chart.defaults.plugins.legend.labels.boxWidth = 12; |
|||
|
|||
// Get Chart Container
|
|||
let chartOverviewCon = document.getElementById('js-chartjs-overview'); |
|||
|
|||
// Set Chart Variables
|
|||
let chartOverview, chartOverviewOptions, chartOverviewData; |
|||
|
|||
// Overview Chart Options
|
|||
chartOverviewOptions = { |
|||
responsive: true, |
|||
maintainAspectRatio: false, |
|||
tension: .4, |
|||
scales: { |
|||
y: { |
|||
suggestedMin: 0, |
|||
suggestedMax: 600 |
|||
} |
|||
}, |
|||
interaction: { |
|||
intersect: false, |
|||
}, |
|||
plugins: { |
|||
tooltip: { |
|||
callbacks: { |
|||
label: function (context) { |
|||
return '$ ' + context.parsed.y; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
}; |
|||
|
|||
// Overview Chart Data
|
|||
chartOverviewData = { |
|||
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: [369, 255, 420, 330, 460, 160, 350] |
|||
}, |
|||
{ |
|||
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: [270, 460, 290, 231, 419, 450, 280] |
|||
} |
|||
] |
|||
}; |
|||
|
|||
// Init Overview Chart
|
|||
if (chartOverviewCon !== null) { |
|||
chartOverview = new Chart(chartOverviewCon, { |
|||
type: 'line', |
|||
data: chartOverviewData, |
|||
options: chartOverviewOptions |
|||
}); |
|||
} |
|||
} |
|||
|
|||
/* |
|||
* Init functionality |
|||
* |
|||
*/ |
|||
static init() { |
|||
this.initOverviewChart(); |
|||
} |
|||
} |
|||
|
|||
// Initialize when page loads
|
|||
Dashmix.onLoad(() => pageEcomDashboard.init()); |
|||
@ -0,0 +1,271 @@ |
|||
/* |
|||
* Document : be_pages_projects_tasks.js |
|||
* Author : pixelcave |
|||
* Description: Custom JS code used in Project Tasks and Tasks Dashboard Page |
|||
*/ |
|||
|
|||
// Helper variables
|
|||
let taskIdNext, tasks, taskForm, taskInput, taskInputVal, |
|||
taskList, taskListStarred, taskListCompleted, |
|||
taskBadge, taskBadgeStarred, taskBadgeCompleted; |
|||
|
|||
class pageTasks { |
|||
/* |
|||
* Init Tasks |
|||
* |
|||
*/ |
|||
static initTasks() { |
|||
let self = this; |
|||
|
|||
// Set variables
|
|||
tasks = jQuery('.js-tasks'); |
|||
taskForm = jQuery('#js-task-form'); |
|||
taskInput = jQuery('#js-task-input'); |
|||
|
|||
taskList = jQuery('.js-task-list'); |
|||
taskListStarred = jQuery('.js-task-list-starred'); |
|||
taskListCompleted = jQuery('.js-task-list-completed'); |
|||
|
|||
taskBadge = jQuery('.js-task-badge'); |
|||
taskBadgeStarred = jQuery('.js-task-badge-starred'); |
|||
taskBadgeCompleted = jQuery('.js-task-badge-completed'); |
|||
|
|||
// Set your own next new task id based on your database setup
|
|||
taskIdNext = 10; |
|||
|
|||
// Update badges
|
|||
this.badgesUpdate(); |
|||
|
|||
// New task form submission
|
|||
taskForm.on('submit', e => { |
|||
e.preventDefault(); |
|||
|
|||
// Get input value
|
|||
taskInputVal = taskInput.prop('value'); |
|||
|
|||
// Check if the user entered something
|
|||
if (taskInputVal) { |
|||
// Add Task
|
|||
self.taskAdd(taskInputVal); |
|||
|
|||
// Clear and focus input field
|
|||
taskInput.prop('value', '').focus(); |
|||
} |
|||
}); |
|||
|
|||
// Task status update on checkbox click
|
|||
let stask, staskId; |
|||
|
|||
tasks.on('click', '.js-task-status', e => { |
|||
stask = jQuery(e.currentTarget).closest('.js-task'); |
|||
staskId = stask.data('task-id'); |
|||
|
|||
// Check task status and toggle it
|
|||
if (stask.data('task-completed')) { |
|||
self.taskSetActive(staskId); |
|||
} else { |
|||
self.taskSetCompleted(staskId); |
|||
} |
|||
}); |
|||
|
|||
// Task starred status update on star click
|
|||
let ftask, ftaskId; |
|||
|
|||
tasks.on('click', '.js-task-star', e => { |
|||
ftask = jQuery(e.currentTarget).closest('.js-task'); |
|||
ftaskId = ftask.data('task-id'); |
|||
|
|||
// Check task starred status and toggle it
|
|||
if (ftask.data('task-starred')) { |
|||
self.taskStarRemove(ftaskId); |
|||
} else { |
|||
self.taskStarAdd(ftaskId); |
|||
} |
|||
}); |
|||
|
|||
// Remove task on remove button click
|
|||
tasks.on('click', '.js-task-remove', e => { |
|||
ftask = jQuery(e.currentTarget).closest('.js-task'); |
|||
ftaskId = ftask.data('task-id'); |
|||
|
|||
// Remove task
|
|||
self.taskRemove(ftaskId); |
|||
}); |
|||
} |
|||
|
|||
/* |
|||
* Update Badges |
|||
* |
|||
*/ |
|||
static badgesUpdate() { |
|||
taskBadge.text(taskList.children().length || ''); |
|||
taskBadgeStarred.text(taskListStarred.children().length || ''); |
|||
taskBadgeCompleted.text(taskListCompleted.children().length || ''); |
|||
} |
|||
|
|||
/* |
|||
* Add a new task |
|||
* |
|||
*/ |
|||
static taskAdd(taskContent) { |
|||
// Add it to the task list
|
|||
taskList.prepend(`
|
|||
<div class="js-task block block-rounded mb-2 animated fadeIn" data-task-id="${taskIdNext}" data-task-completed="false" data-task-starred="false"> |
|||
<table class="table table-borderless table-vcenter mb-0"> |
|||
<tr> |
|||
<td class="text-center pe-0" style="width: 38px;"> |
|||
<div class="js-task-status form-check"> |
|||
<input type="checkbox" class="form-check-input" id="tasks-cb-id${taskIdNext}" name="tasks-cb-id${taskIdNext}"> |
|||
<label class="form-check-label" for="tasks-cb-id${taskIdNext}"></label> |
|||
</div> |
|||
</td> |
|||
<td class="js-task-content fw-semibold ps-0"> |
|||
${jQuery('<span />').text(taskContent).html()} |
|||
</td> |
|||
<td class="text-end" style="width: 100px;"> |
|||
<button type="button" class="js-task-star btn btn-sm btn-link text-warning"> |
|||
<i class="far fa-star fa-fw"></i> |
|||
</button> |
|||
<button type="button" class="js-task-remove btn btn-sm btn-link text-danger"> |
|||
<i class="fa fa-times fa-fw"></i> |
|||
</button> |
|||
</td> |
|||
</tr> |
|||
</table> |
|||
</div> |
|||
`);
|
|||
|
|||
// Update badges
|
|||
this.badgesUpdate(); |
|||
|
|||
// Save the task based on your database setup
|
|||
// ..
|
|||
|
|||
// Update task next id
|
|||
taskIdNext++; |
|||
} |
|||
|
|||
/* |
|||
* Remove a task |
|||
* |
|||
*/ |
|||
static taskRemove(taskId) { |
|||
jQuery('.js-task[data-task-id="' + taskId + '"]').remove(); |
|||
|
|||
// Update badges
|
|||
this.badgesUpdate(); |
|||
|
|||
// Remove the task based on your database setup
|
|||
// ..
|
|||
} |
|||
|
|||
/* |
|||
* Star a task |
|||
* |
|||
*/ |
|||
static taskStarAdd(taskId) { |
|||
let task = jQuery('.js-task[data-task-id="' + taskId + '"]'); |
|||
|
|||
// Check if exists and update accordignly the markup
|
|||
if (task.length > 0) { |
|||
task.data('task-starred', true); |
|||
task.find('.js-task-star > i').toggleClass('fa far'); |
|||
|
|||
if (!task.data('task-completed')) { |
|||
task.prependTo(taskListStarred); |
|||
} |
|||
|
|||
// Update badges
|
|||
this.badgesUpdate(); |
|||
|
|||
// Star the task based on your database setup
|
|||
// ..
|
|||
} |
|||
} |
|||
|
|||
/* |
|||
* Unstar a task |
|||
* |
|||
*/ |
|||
static taskStarRemove(taskId) { |
|||
let task = jQuery('.js-task[data-task-id="' + taskId + '"]'); |
|||
|
|||
// Check if exists and update accordignly the markup
|
|||
if (task.length > 0) { |
|||
task.data('task-starred', false); |
|||
task.find('.js-task-star > i').toggleClass('fa far'); |
|||
|
|||
if (!task.data('task-completed')) { |
|||
task.prependTo(taskList); |
|||
} |
|||
|
|||
// Update badges
|
|||
this.badgesUpdate(); |
|||
|
|||
// Unstar the task based on your database setup
|
|||
// ..
|
|||
} |
|||
} |
|||
|
|||
/* |
|||
* Set a task to active |
|||
* |
|||
*/ |
|||
static taskSetActive(taskId) { |
|||
let task = jQuery('.js-task[data-task-id="' + taskId + '"]'); |
|||
|
|||
// Check if exists and update accordignly
|
|||
if (task.length > 0) { |
|||
task.data('task-completed', false); |
|||
task.find('.table').toggleClass('bg-body'); |
|||
task.find('.js-task-status > input').prop('checked', false); |
|||
task.find('.js-task-content > del').contents().unwrap(); |
|||
|
|||
if (task.data('task-starred')) { |
|||
task.prependTo(taskListStarred); |
|||
} else { |
|||
task.prependTo(taskList); |
|||
} |
|||
|
|||
// Update badges
|
|||
this.badgesUpdate(); |
|||
|
|||
// Update task status based on your database setup
|
|||
// ..
|
|||
} |
|||
} |
|||
|
|||
/* |
|||
* Set a task to completed |
|||
* |
|||
*/ |
|||
static taskSetCompleted(taskId) { |
|||
let task = jQuery('.js-task[data-task-id="' + taskId + '"]'); |
|||
|
|||
// Check if exists and update accordignly
|
|||
if (task.length > 0) { |
|||
task.data('task-completed', true); |
|||
task.find('.table').toggleClass('bg-body'); |
|||
task.find('.js-task-status > input').prop('checked', true); |
|||
task.find('.js-task-content').wrapInner('<del></del>'); |
|||
task.prependTo(taskListCompleted); |
|||
|
|||
// Update badges
|
|||
this.badgesUpdate(); |
|||
|
|||
// Update task status based on your database setup
|
|||
// ..
|
|||
} |
|||
} |
|||
|
|||
/* |
|||
* Init functionality |
|||
* |
|||
*/ |
|||
static init() { |
|||
this.initTasks(); |
|||
} |
|||
} |
|||
|
|||
// Initialize when page loads
|
|||
Dashmix.onLoad(() => pageTasks.init()); |
|||
@ -0,0 +1,101 @@ |
|||
/* |
|||
* Document : be_tables_datatables.js |
|||
* Author : pixelcave |
|||
* Description: Custom JS code used in DataTables Page |
|||
*/ |
|||
|
|||
// DataTables, for more examples you can check out https://www.datatables.net/
|
|||
class pageTablesDatatables { |
|||
/* |
|||
* Init DataTables functionality |
|||
* |
|||
*/ |
|||
static initDataTables() { |
|||
// Override a few default classes
|
|||
jQuery.extend(jQuery.fn.dataTable.ext.classes, { |
|||
sWrapper: "dataTables_wrapper dt-bootstrap5", |
|||
sFilterInput: "form-control", |
|||
sLengthSelect: "form-select" |
|||
}); |
|||
|
|||
// Override a few defaults
|
|||
jQuery.extend(true, jQuery.fn.dataTable.defaults, { |
|||
language: { |
|||
lengthMenu: "_MENU_", |
|||
search: "_INPUT_", |
|||
searchPlaceholder: "Search..", |
|||
info: "Page <strong>_PAGE_</strong> of <strong>_PAGES_</strong>", |
|||
paginate: { |
|||
first: '<i class="fa fa-angle-double-left"></i>', |
|||
previous: '<i class="fa fa-angle-left"></i>', |
|||
next: '<i class="fa fa-angle-right"></i>', |
|||
last: '<i class="fa fa-angle-double-right"></i>' |
|||
} |
|||
} |
|||
}); |
|||
|
|||
// Override buttons default classes
|
|||
jQuery.extend(true, jQuery.fn.DataTable.Buttons.defaults, { |
|||
dom: { |
|||
button: { |
|||
className: 'btn btn-sm btn-primary' |
|||
}, |
|||
} |
|||
}); |
|||
|
|||
// Init full DataTable
|
|||
jQuery('.js-dataTable-full').DataTable({ |
|||
pageLength: 5, |
|||
lengthMenu: [[5, 10, 20], [5, 10, 20]], |
|||
autoWidth: false |
|||
}); |
|||
|
|||
// Init DataTable with Buttons
|
|||
jQuery('.js-dataTable-buttons').DataTable({ |
|||
pageLength: 5, |
|||
lengthMenu: [[5, 10, 20], [5, 10, 20]], |
|||
autoWidth: false, |
|||
buttons: ['copy', 'csv', 'excel', 'pdf', 'print'], |
|||
dom: "<'row'<'col-sm-12'<'text-center bg-body-light py-2 mb-2'B>>>" + |
|||
"<'row'<'col-sm-12 col-md-6'l><'col-sm-12 col-md-6'f>><'row'<'col-sm-12'tr>><'row'<'col-sm-12 col-md-5'i><'col-sm-12 col-md-7'p>>" |
|||
}); |
|||
|
|||
// Init full extra DataTable
|
|||
jQuery('.js-dataTable-full-pagination').DataTable({ |
|||
pagingType: "full_numbers", |
|||
pageLength: 5, |
|||
lengthMenu: [[5, 10, 20], [5, 10, 20]], |
|||
autoWidth: false |
|||
}); |
|||
|
|||
// Init simple DataTable
|
|||
jQuery('.js-dataTable-simple').DataTable({ |
|||
pageLength: 5, |
|||
lengthMenu: false, |
|||
searching: false, |
|||
autoWidth: false, |
|||
dom: "<'row'<'col-sm-12'tr>>" + |
|||
"<'row'<'col-sm-6'i><'col-sm-6'p>>" |
|||
}); |
|||
|
|||
// Init responsive DataTable
|
|||
jQuery('.js-dataTable-responsive').DataTable({ |
|||
pagingType: "full_numbers", |
|||
pageLength: 5, |
|||
lengthMenu: [[5, 10, 20], [5, 10, 20]], |
|||
autoWidth: false, |
|||
responsive: true |
|||
}); |
|||
} |
|||
|
|||
/* |
|||
* Init functionality |
|||
* |
|||
*/ |
|||
static init() { |
|||
this.initDataTables(); |
|||
} |
|||
} |
|||
|
|||
// Initialize when page loads
|
|||
Dashmix.onLoad(() => pageTablesDatatables.init()); |
|||
@ -0,0 +1,45 @@ |
|||
/* |
|||
* Document : be_ui_animations.js |
|||
* Author : pixelcave |
|||
* Description: Custom JS code used in Animations Page |
|||
*/ |
|||
|
|||
class pageAnimations { |
|||
/* |
|||
* Animation toggle functionality |
|||
* |
|||
*/ |
|||
static animationsToggle() { |
|||
let animationClass, animationButton, currentSection; |
|||
|
|||
// On button click
|
|||
document.querySelectorAll('.js-animation-section button').forEach(btn => { |
|||
btn.addEventListener('click', e => { |
|||
animationClass = btn.dataset.animationClass; |
|||
currentSection = btn.closest('.js-animation-section'); |
|||
|
|||
// Update class preview
|
|||
currentSection.querySelector('.js-animation-preview').textContent = animationClass; |
|||
|
|||
// Update animation object classes
|
|||
let animationObject = currentSection.querySelector('.js-animation-object') |
|||
|
|||
animationObject.classList = ''; |
|||
animationObject.classList.add('js-animation-object'); |
|||
animationObject.classList.add('animated'); |
|||
animationObject.classList.add(animationClass); |
|||
}); |
|||
}); |
|||
} |
|||
|
|||
/* |
|||
* Init functionality |
|||
* |
|||
*/ |
|||
static init() { |
|||
this.animationsToggle(); |
|||
} |
|||
} |
|||
|
|||
// Initialize when page loads
|
|||
Dashmix.onLoad(() => pageAnimations.init()); |
|||
2184
src/main/resources/static/assets/_js/pages/be_ui_icons.js
File diff suppressed because it is too large
View File
@ -0,0 +1,41 @@ |
|||
/* |
|||
* Document : be_ui_progress.js |
|||
* Author : pixelcave |
|||
* Description: Custom JS code used in Progress Page |
|||
*/ |
|||
|
|||
class pageProgress { |
|||
/* |
|||
* Bars randomize functionality |
|||
* |
|||
*/ |
|||
static barsRandomize() { |
|||
document.querySelectorAll('.js-bar-randomize').forEach(item => { |
|||
item.addEventListener('click', e => { |
|||
item.closest('.block').querySelectorAll('.progress-bar').forEach(bar => { |
|||
let random = Math.floor((Math.random() * 91) + 10); |
|||
let content = bar.querySelector('span'); |
|||
|
|||
// Update progress width
|
|||
bar.style.width = random + '%'; |
|||
|
|||
// Update progress label
|
|||
if (content) { |
|||
content.textContent = random + '%'; |
|||
} |
|||
}); |
|||
}); |
|||
}); |
|||
} |
|||
|
|||
/* |
|||
* Init functionality |
|||
* |
|||
*/ |
|||
static init() { |
|||
this.barsRandomize(); |
|||
} |
|||
} |
|||
|
|||
// Initialize when page loads
|
|||
Dashmix.onLoad(() => pageProgress.init()); |
|||
@ -0,0 +1,73 @@ |
|||
/* |
|||
* Document : db_analytics.js |
|||
* Author : pixelcave |
|||
* Description: Custom JS code used in Analytics Dashboard Page |
|||
*/ |
|||
|
|||
// Chart.js Charts, for more examples you can check out http://www.chartjs.org/docs
|
|||
class pageDashboardAnalytics { |
|||
/* |
|||
* 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(103, 114, 229, .75)', |
|||
borderColor: 'rgba(103, 114, 229, 1)', |
|||
pointBackgroundColor: 'rgba(103, 114, 229, 1)', |
|||
pointBorderColor: '#fff', |
|||
pointHoverBackgroundColor: '#fff', |
|||
pointHoverBorderColor: 'rgba(103, 114, 229, 1)', |
|||
data: [500, 750, 650, 570, 582, 480, 680] |
|||
}, |
|||
{ |
|||
label: 'Last Week', |
|||
fill: true, |
|||
backgroundColor: 'rgba(108, 117, 125, .15)', |
|||
borderColor: 'rgba(108, 117, 125, .75)', |
|||
pointBackgroundColor: 'rgba(108, 117, 125, 1)', |
|||
pointBorderColor: '#fff', |
|||
pointHoverBackgroundColor: '#fff', |
|||
pointHoverBorderColor: 'rgba(108, 117, 125, 1)', |
|||
data: [352, 530, 541, 521, 410, 395, 460] |
|||
} |
|||
] |
|||
}; |
|||
|
|||
// Init Chart
|
|||
if (chartBarsCon !== null) { |
|||
chartBars = new Chart(chartBarsCon, {type: 'bar', data: chartLinesBarsData, options: { responsive: true, maintainAspectRatio: false }}); |
|||
} |
|||
} |
|||
|
|||
/* |
|||
* Init functionality |
|||
* |
|||
*/ |
|||
static init() { |
|||
this.initChartsBars(); |
|||
} |
|||
} |
|||
|
|||
// Initialize when page loads
|
|||
Dashmix.onLoad(() => pageDashboardAnalytics.init()); |
|||
@ -0,0 +1,144 @@ |
|||
/* |
|||
* Document : db_corporate_slim.js |
|||
* Author : pixelcave |
|||
* Description: Custom JS code used in Corporate Slim Dashboard Page |
|||
*/ |
|||
|
|||
// Chart.js Charts, for more examples you can check out http://www.chartjs.org/docs
|
|||
class DbCorporateSlim { |
|||
/* |
|||
* Init Charts |
|||
* |
|||
*/ |
|||
static initCorporateChartJS() { |
|||
// Set Global Chart.js configuration
|
|||
Chart.defaults.color = '#7c7c7c'; |
|||
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.line.borderWidth = 2; |
|||
Chart.defaults.elements.point.radius = 6; |
|||
Chart.defaults.elements.point.hoverRadius = 10; |
|||
Chart.defaults.plugins.tooltip.radius = 3; |
|||
Chart.defaults.plugins.legend.display = false; |
|||
|
|||
// Chart Containers
|
|||
let chartCorporateSlimProjectsCon = document.getElementById('js-chartjs-corporate-slim-projects'); |
|||
let chartCorporateSlimTicketsCon = document.getElementById('js-chartjs-corporate-slim-tickets'); |
|||
|
|||
// Chart Variables
|
|||
let chartCorporateSlimProjects, chartCorporateSlimTickets; |
|||
|
|||
// Lines Charts Data
|
|||
let chartCorporateSlimProjectsData = { |
|||
labels: ['MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT', 'SUN'], |
|||
datasets: [ |
|||
{ |
|||
label: 'This Week', |
|||
fill: true, |
|||
backgroundColor: 'rgba(73, 80, 87, .1)', |
|||
borderColor: 'rgba(73, 80, 87, .35)', |
|||
pointBackgroundColor: 'rgba(73, 80, 87, .5)', |
|||
pointBorderColor: '#fff', |
|||
pointHoverBackgroundColor: '#fff', |
|||
pointHoverBorderColor: 'rgba(73, 80, 87, .5)', |
|||
data: [14, 16, 6, 14, 10, 19, 12] |
|||
} |
|||
] |
|||
}; |
|||
|
|||
let chartCorporateSlimProjectsOptions = { |
|||
responsive: true, |
|||
maintainAspectRatio: false, |
|||
tension: .4, |
|||
scales: { |
|||
y: { |
|||
suggestedMin: 0, |
|||
suggestedMax: 22 |
|||
} |
|||
}, |
|||
interaction: { |
|||
intersect: false, |
|||
}, |
|||
plugins: { |
|||
tooltip: { |
|||
callbacks: { |
|||
label: function (context) { |
|||
return ' ' + context.parsed.y + ' Sales'; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
}; |
|||
|
|||
let chartCorporateSlimTicketsData = { |
|||
labels: ['MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT', 'SUN'], |
|||
datasets: [ |
|||
{ |
|||
label: 'This Week', |
|||
fill: true, |
|||
backgroundColor: 'rgba(130, 181, 75, .1)', |
|||
borderColor: 'rgba(130, 181, 75, .35)', |
|||
pointBackgroundColor: 'rgba(130, 181, 75, .5)', |
|||
pointBorderColor: '#fff', |
|||
pointHoverBackgroundColor: '#fff', |
|||
pointHoverBorderColor: 'rgba(130, 181, 75, .5)', |
|||
data: [35, 20, 29, 20, 40, 34, 45] |
|||
} |
|||
] |
|||
}; |
|||
|
|||
let chartCorporateSlimTicketsOptions = { |
|||
responsive: true, |
|||
maintainAspectRatio: false, |
|||
tension: .4, |
|||
scales: { |
|||
y: { |
|||
suggestedMin: 0, |
|||
suggestedMax: 50 |
|||
} |
|||
}, |
|||
interaction: { |
|||
intersect: false, |
|||
}, |
|||
plugins: { |
|||
tooltip: { |
|||
callbacks: { |
|||
label: function (context) { |
|||
return ' ' + context.parsed.y + ' Tickets'; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
}; |
|||
|
|||
// Init Charts
|
|||
if (chartCorporateSlimProjectsCon !== null) { |
|||
chartCorporateSlimProjects = new Chart(chartCorporateSlimProjectsCon, { |
|||
type: 'line', |
|||
data: chartCorporateSlimProjectsData, |
|||
options: chartCorporateSlimProjectsOptions |
|||
}); |
|||
} |
|||
|
|||
if (chartCorporateSlimTicketsCon !== null) { |
|||
chartCorporateSlimTickets = new Chart(chartCorporateSlimTicketsCon, { |
|||
type: 'line', |
|||
data: chartCorporateSlimTicketsData, |
|||
options: chartCorporateSlimTicketsOptions |
|||
}); |
|||
} |
|||
} |
|||
|
|||
/* |
|||
* Init functionality |
|||
* |
|||
*/ |
|||
static init() { |
|||
this.initCorporateChartJS(); |
|||
} |
|||
} |
|||
|
|||
// Initialize when page loads
|
|||
Dashmix.onLoad(() => DbCorporateSlim.init()); |
|||
@ -0,0 +1,93 @@ |
|||
/* |
|||
* Document : db_crypto.js |
|||
* Author : pixelcave |
|||
* Description: Custom JS code used in Crypto Dashboard Page |
|||
*/ |
|||
|
|||
// Chart.js Charts, for more examples you can check out http://www.chartjs.org/docs
|
|||
class pageDashboardCrypto { |
|||
/* |
|||
* Init Charts |
|||
* |
|||
*/ |
|||
static initChartsBitcoin() { |
|||
// 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.point.radius = 0; |
|||
Chart.defaults.elements.point.hoverRadius = 0; |
|||
Chart.defaults.plugins.tooltip.radius = 3; |
|||
Chart.defaults.plugins.legend.display = false; |
|||
|
|||
// Get Chart Container
|
|||
let chartBitcoinCon = document.getElementById('js-chartjs-bitcoin'); |
|||
|
|||
// Set up labels
|
|||
let chartBitcoinlabels = []; |
|||
for (let i = 0; i < 30; i++) { |
|||
chartBitcoinlabels[i] = (i === 29) ? '1 day ago' : (30 - i) + ' days ago'; |
|||
} |
|||
|
|||
// Crypto Data
|
|||
let chartBitcoinData = [10500, 10400, 9500, 8268, 10218, 8250, 8707, 9284, 9718, 9950, 9879, 10147, 10883, 11071, 11332, 11584, 11878, 13540, 16501, 16007, 15142, 14869, 16762, 17276, 16808, 16678, 16771, 12900, 13100, 14000]; |
|||
|
|||
// Init Chart
|
|||
if (chartBitcoinCon !== null) { |
|||
let chartBitcoin = new Chart(chartBitcoinCon, { |
|||
type: 'line', |
|||
data: { |
|||
labels: chartBitcoinlabels, |
|||
datasets: [ |
|||
{ |
|||
label: 'Bitcoin Price', |
|||
fill: true, |
|||
backgroundColor: 'rgba(255,193,7,.25)', |
|||
borderColor: 'rgba(255,193,7,1)', |
|||
pointBackgroundColor: 'rgba(255,193,7,1)', |
|||
pointBorderColor: '#fff', |
|||
pointHoverBackgroundColor: '#fff', |
|||
pointHoverBorderColor: 'rgba(255,193,7,1)', |
|||
data: chartBitcoinData |
|||
} |
|||
] |
|||
}, |
|||
options: { |
|||
responsive: true, |
|||
maintainAspectRatio: false, |
|||
tension: .4, |
|||
scales: { |
|||
y: { |
|||
suggestedMin: 6000, |
|||
suggestedMax: 20000 |
|||
} |
|||
}, |
|||
interaction: { |
|||
intersect: false, |
|||
}, |
|||
plugins: { |
|||
tooltip: { |
|||
callbacks: { |
|||
label: function (context) { |
|||
return ' $' + context.parsed.y; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
}); |
|||
} |
|||
} |
|||
|
|||
/* |
|||
* Init functionality |
|||
* |
|||
*/ |
|||
static init() { |
|||
this.initChartsBitcoin(); |
|||
} |
|||
} |
|||
|
|||
// Initialize when page loads
|
|||
Dashmix.onLoad(() => pageDashboardCrypto.init()); |
|||
@ -0,0 +1,42 @@ |
|||
/* |
|||
* Document : op_auth_lock.js |
|||
* Author : pixelcave |
|||
* Description: Custom JS code used in Lock Page |
|||
*/ |
|||
|
|||
class pageAuthLock { |
|||
/* |
|||
* Init Lock Form Validation, for more examples you can check out https://github.com/jzaefferer/jquery-validation
|
|||
* |
|||
*/ |
|||
static initValidation() { |
|||
// Load default options for jQuery Validation plugin
|
|||
Dashmix.helpers('jq-validation'); |
|||
|
|||
// Init Form Validation
|
|||
jQuery('.js-validation-lock').validate({ |
|||
rules: { |
|||
'lock-password': { |
|||
required: true, |
|||
minlength: 3 |
|||
} |
|||
}, |
|||
messages: { |
|||
'lock-password': { |
|||
required: 'Please enter your valid password' |
|||
} |
|||
} |
|||
}); |
|||
} |
|||
|
|||
/* |
|||
* Init functionality |
|||
* |
|||
*/ |
|||
static init() { |
|||
this.initValidation(); |
|||
} |
|||
} |
|||
|
|||
// Initialize when page loads
|
|||
Dashmix.onLoad(() => pageAuthLock.init()); |
|||
@ -0,0 +1,42 @@ |
|||
/* |
|||
* Document : op_auth_reminder.js |
|||
* Author : pixelcave |
|||
* Description: Custom JS code used in Password Reminder Page |
|||
*/ |
|||
|
|||
class pageAuthReminder { |
|||
/* |
|||
* Init Password Reminder Form Validation, for more examples you can check out https://github.com/jzaefferer/jquery-validation
|
|||
* |
|||
*/ |
|||
static initValidation() { |
|||
// Load default options for jQuery Validation plugin
|
|||
Dashmix.helpers('jq-validation'); |
|||
|
|||
// Init Form Validation
|
|||
jQuery('.js-validation-reminder').validate({ |
|||
rules: { |
|||
'reminder-credential': { |
|||
required: true, |
|||
minlength: 3 |
|||
} |
|||
}, |
|||
messages: { |
|||
'reminder-credential': { |
|||
required: 'Please enter a valid credential' |
|||
} |
|||
} |
|||
}); |
|||
} |
|||
|
|||
/* |
|||
* Init functionality |
|||
* |
|||
*/ |
|||
static init() { |
|||
this.initValidation(); |
|||
} |
|||
} |
|||
|
|||
// Initialize when page loads
|
|||
Dashmix.onLoad(() => pageAuthReminder.init()); |
|||
@ -0,0 +1,51 @@ |
|||
/* |
|||
* Document : op_auth_signin.js |
|||
* Author : pixelcave |
|||
* Description: Custom JS code used in Sign In Page |
|||
*/ |
|||
|
|||
class pageAuthSignIn { |
|||
/* |
|||
* Init Sign In Form Validation, for more examples you can check out https://github.com/jzaefferer/jquery-validation
|
|||
* |
|||
*/ |
|||
static initValidation() { |
|||
// Load default options for jQuery Validation plugin
|
|||
Dashmix.helpers('jq-validation'); |
|||
|
|||
// Init Form Validation
|
|||
jQuery('.js-validation-signin').validate({ |
|||
rules: { |
|||
'login-username': { |
|||
required: true, |
|||
minlength: 3 |
|||
}, |
|||
'login-password': { |
|||
required: true, |
|||
minlength: 5 |
|||
} |
|||
}, |
|||
messages: { |
|||
'login-username': { |
|||
required: 'Please enter a username', |
|||
minlength: 'Your username must consist of at least 3 characters' |
|||
}, |
|||
'login-password': { |
|||
required: 'Please provide a password', |
|||
minlength: 'Your password must be at least 5 characters long' |
|||
} |
|||
} |
|||
}); |
|||
} |
|||
|
|||
/* |
|||
* Init functionality |
|||
* |
|||
*/ |
|||
static init() { |
|||
this.initValidation(); |
|||
} |
|||
} |
|||
|
|||
// Initialize when page loads
|
|||
Dashmix.onLoad(() => pageAuthSignIn.init()); |
|||
@ -0,0 +1,69 @@ |
|||
/* |
|||
* Document : op_auth_signup.js |
|||
* Author : pixelcave |
|||
* Description: Custom JS code used in Sign Up Page |
|||
*/ |
|||
|
|||
class pageAuthSignUp { |
|||
/* |
|||
* Init Sign Up Form Validation, for more examples you can check out https://github.com/jzaefferer/jquery-validation
|
|||
* |
|||
*/ |
|||
static initValidation() { |
|||
// Load default options for jQuery Validation plugin
|
|||
Dashmix.helpers('jq-validation'); |
|||
|
|||
// Init Form Validation
|
|||
jQuery('.js-validation-signup').validate({ |
|||
rules: { |
|||
'signup-username': { |
|||
required: true, |
|||
minlength: 3 |
|||
}, |
|||
'signup-email': { |
|||
required: true, |
|||
emailWithDot: true |
|||
}, |
|||
'signup-password': { |
|||
required: true, |
|||
minlength: 5 |
|||
}, |
|||
'signup-password-confirm': { |
|||
required: true, |
|||
equalTo: '#signup-password' |
|||
}, |
|||
'signup-terms': { |
|||
required: true |
|||
} |
|||
}, |
|||
messages: { |
|||
'signup-username': { |
|||
required: 'Please enter a username', |
|||
minlength: 'Your username must consist of at least 3 characters' |
|||
}, |
|||
'signup-email': 'Please enter a valid email address', |
|||
'signup-password': { |
|||
required: 'Please provide a password', |
|||
minlength: 'Your password must be at least 5 characters long' |
|||
}, |
|||
'signup-password-confirm': { |
|||
required: 'Please provide a password', |
|||
minlength: 'Your password must be at least 5 characters long', |
|||
equalTo: 'Please enter the same password as above' |
|||
}, |
|||
'signup-terms': 'You must agree to the service terms!' |
|||
} |
|||
}); |
|||
} |
|||
|
|||
/* |
|||
* Init functionality |
|||
* |
|||
*/ |
|||
static init() { |
|||
this.initValidation(); |
|||
} |
|||
} |
|||
|
|||
// Initialize when page loads
|
|||
Dashmix.onLoad(() => pageAuthSignUp.init()); |
|||
@ -0,0 +1,34 @@ |
|||
/* |
|||
* Document : op_coming_soon.js |
|||
* Author : pixelcave |
|||
* Description: Custom JS code used in Coming Soon Page |
|||
*/ |
|||
|
|||
class pageComingSoon { |
|||
/* |
|||
* Init Countdown.js, for more examples you can check out https://github.com/hilios/jQuery.countdown
|
|||
* |
|||
*/ |
|||
static countdown() { |
|||
jQuery('.js-countdown').countdown((new Date().getFullYear() + 2) + '/02/01', e => { |
|||
jQuery(e.currentTarget).html(e.strftime('<div class="row items-push push text-center">' |
|||
+ '<div class="col-6 col-md-3"><div class="fs-1 fw-bold text-white">%-D</div><div class="fs-sm fw-bold text-muted">DAYS</div></div>' |
|||
+ '<div class="col-6 col-md-3"><div class="fs-1 fw-bold text-white">%H</div><div class="fs-sm fw-bold text-muted">HOURS</div></div>' |
|||
+ '<div class="col-6 col-md-3"><div class="fs-1 fw-bold text-white">%M</div><div class="fs-sm fw-bold text-muted">MINUTES</div></div>' |
|||
+ '<div class="col-6 col-md-3"><div class="fs-1 fw-bold text-white">%S</div><div class="fs-sm fw-bold text-muted">SECONDS</div></div>' |
|||
+ '</div>' |
|||
)); |
|||
}); |
|||
} |
|||
|
|||
/* |
|||
* Init functionality |
|||
* |
|||
*/ |
|||
static init() { |
|||
this.countdown(); |
|||
} |
|||
} |
|||
|
|||
// Initialize when page loads
|
|||
Dashmix.onLoad(() => pageComingSoon.init()); |
|||
@ -0,0 +1,78 @@ |
|||
/* |
|||
* Document : op_installation.js |
|||
* Author : pixelcave |
|||
* Description: Custom JS code used in Installation Page |
|||
*/ |
|||
|
|||
// Form Validation, for more examples you can check out https://github.com/jzaefferer/jquery-validation
|
|||
class pageInstallation { |
|||
/* |
|||
* Init Installation Form Validation |
|||
* |
|||
*/ |
|||
static initValidationInstallation() { |
|||
// Load default options for jQuery Validation plugin
|
|||
Dashmix.helpers('jq-validation'); |
|||
|
|||
// Init Form Validation
|
|||
jQuery('.js-validation-installation').validate({ |
|||
rules: { |
|||
'install-db-name': { |
|||
required: true |
|||
}, |
|||
'install-db-username': { |
|||
required: true |
|||
}, |
|||
'install-db-password': { |
|||
required: true |
|||
}, |
|||
'install-admin-email': { |
|||
required: true, |
|||
emailWithDot: true |
|||
}, |
|||
'install-admin-password': { |
|||
required: true, |
|||
minlength: 5 |
|||
}, |
|||
'install-admin-password-confirm': { |
|||
required: true, |
|||
equalTo: '#install-admin-password' |
|||
} |
|||
}, |
|||
messages: { |
|||
'install-db-name': { |
|||
required: 'Please provide the name of your database' |
|||
}, |
|||
'install-db-username': { |
|||
required: 'Please provide the username with access to your database' |
|||
}, |
|||
'install-db-password': { |
|||
required: 'Please provide the password of your database user' |
|||
}, |
|||
'install-admin-email': { |
|||
required: 'Please enter your email' |
|||
}, |
|||
'install-admin-password': { |
|||
required: 'Please provide a password', |
|||
minlength: 'Your password must be at least 5 characters long' |
|||
}, |
|||
'install-admin-password-confirm': { |
|||
required: 'Please provide a password', |
|||
minlength: 'Your password must be at least 5 characters long', |
|||
equalTo: 'Please enter the same password as above' |
|||
} |
|||
} |
|||
}); |
|||
} |
|||
|
|||
/* |
|||
* Init functionality |
|||
* |
|||
*/ |
|||
static init() { |
|||
this.initValidationInstallation(); |
|||
} |
|||
} |
|||
|
|||
// Initialize when page loads
|
|||
Dashmix.onLoad(() => pageInstallation.init()); |
|||
@ -0,0 +1,149 @@ |
|||
// |
|||
// Base styles |
|||
// |
|||
|
|||
.accordion { |
|||
// scss-docs-start accordion-css-vars |
|||
--#{$prefix}accordion-color: #{$accordion-color}; |
|||
--#{$prefix}accordion-bg: #{$accordion-bg}; |
|||
--#{$prefix}accordion-transition: #{$accordion-transition}; |
|||
--#{$prefix}accordion-border-color: #{$accordion-border-color}; |
|||
--#{$prefix}accordion-border-width: #{$accordion-border-width}; |
|||
--#{$prefix}accordion-border-radius: #{$accordion-border-radius}; |
|||
--#{$prefix}accordion-inner-border-radius: #{$accordion-inner-border-radius}; |
|||
--#{$prefix}accordion-btn-padding-x: #{$accordion-button-padding-x}; |
|||
--#{$prefix}accordion-btn-padding-y: #{$accordion-button-padding-y}; |
|||
--#{$prefix}accordion-btn-color: #{$accordion-button-color}; |
|||
--#{$prefix}accordion-btn-bg: #{$accordion-button-bg}; |
|||
--#{$prefix}accordion-btn-icon: #{escape-svg($accordion-button-icon)}; |
|||
--#{$prefix}accordion-btn-icon-width: #{$accordion-icon-width}; |
|||
--#{$prefix}accordion-btn-icon-transform: #{$accordion-icon-transform}; |
|||
--#{$prefix}accordion-btn-icon-transition: #{$accordion-icon-transition}; |
|||
--#{$prefix}accordion-btn-active-icon: #{escape-svg($accordion-button-active-icon)}; |
|||
--#{$prefix}accordion-btn-focus-border-color: #{$accordion-button-focus-border-color}; |
|||
--#{$prefix}accordion-btn-focus-box-shadow: #{$accordion-button-focus-box-shadow}; |
|||
--#{$prefix}accordion-body-padding-x: #{$accordion-body-padding-x}; |
|||
--#{$prefix}accordion-body-padding-y: #{$accordion-body-padding-y}; |
|||
--#{$prefix}accordion-active-color: #{$accordion-button-active-color}; |
|||
--#{$prefix}accordion-active-bg: #{$accordion-button-active-bg}; |
|||
// scss-docs-end accordion-css-vars |
|||
} |
|||
|
|||
.accordion-button { |
|||
position: relative; |
|||
display: flex; |
|||
align-items: center; |
|||
width: 100%; |
|||
padding: var(--#{$prefix}accordion-btn-padding-y) var(--#{$prefix}accordion-btn-padding-x); |
|||
@include font-size($font-size-base); |
|||
color: var(--#{$prefix}accordion-btn-color); |
|||
text-align: left; // Reset button style |
|||
background-color: var(--#{$prefix}accordion-btn-bg); |
|||
border: 0; |
|||
@include border-radius(0); |
|||
overflow-anchor: none; |
|||
@include transition(var(--#{$prefix}accordion-transition)); |
|||
|
|||
&:not(.collapsed) { |
|||
color: var(--#{$prefix}accordion-active-color); |
|||
background-color: var(--#{$prefix}accordion-active-bg); |
|||
box-shadow: inset 0 calc(-1 * var(--#{$prefix}accordion-border-width)) 0 var(--#{$prefix}accordion-border-color); // stylelint-disable-line function-disallowed-list |
|||
|
|||
&::after { |
|||
background-image: var(--#{$prefix}accordion-btn-active-icon); |
|||
transform: var(--#{$prefix}accordion-btn-icon-transform); |
|||
} |
|||
} |
|||
|
|||
// Accordion icon |
|||
&::after { |
|||
flex-shrink: 0; |
|||
width: var(--#{$prefix}accordion-btn-icon-width); |
|||
height: var(--#{$prefix}accordion-btn-icon-width); |
|||
margin-left: auto; |
|||
content: ""; |
|||
background-image: var(--#{$prefix}accordion-btn-icon); |
|||
background-repeat: no-repeat; |
|||
background-size: var(--#{$prefix}accordion-btn-icon-width); |
|||
@include transition(var(--#{$prefix}accordion-btn-icon-transition)); |
|||
} |
|||
|
|||
&:hover { |
|||
z-index: 2; |
|||
} |
|||
|
|||
&:focus { |
|||
z-index: 3; |
|||
border-color: var(--#{$prefix}accordion-btn-focus-border-color); |
|||
outline: 0; |
|||
box-shadow: var(--#{$prefix}accordion-btn-focus-box-shadow); |
|||
} |
|||
} |
|||
|
|||
.accordion-header { |
|||
margin-bottom: 0; |
|||
} |
|||
|
|||
.accordion-item { |
|||
color: var(--#{$prefix}accordion-color); |
|||
background-color: var(--#{$prefix}accordion-bg); |
|||
border: var(--#{$prefix}accordion-border-width) solid var(--#{$prefix}accordion-border-color); |
|||
|
|||
&:first-of-type { |
|||
@include border-top-radius(var(--#{$prefix}accordion-border-radius)); |
|||
|
|||
.accordion-button { |
|||
@include border-top-radius(var(--#{$prefix}accordion-inner-border-radius)); |
|||
} |
|||
} |
|||
|
|||
&:not(:first-of-type) { |
|||
border-top: 0; |
|||
} |
|||
|
|||
// Only set a border-radius on the last item if the accordion is collapsed |
|||
&:last-of-type { |
|||
@include border-bottom-radius(var(--#{$prefix}accordion-border-radius)); |
|||
|
|||
.accordion-button { |
|||
&.collapsed { |
|||
@include border-bottom-radius(var(--#{$prefix}accordion-inner-border-radius)); |
|||
} |
|||
} |
|||
|
|||
.accordion-collapse { |
|||
@include border-bottom-radius(var(--#{$prefix}accordion-border-radius)); |
|||
} |
|||
} |
|||
} |
|||
|
|||
.accordion-body { |
|||
padding: var(--#{$prefix}accordion-body-padding-y) var(--#{$prefix}accordion-body-padding-x); |
|||
} |
|||
|
|||
|
|||
// Flush accordion items |
|||
// |
|||
// Remove borders and border-radius to keep accordion items edge-to-edge. |
|||
|
|||
.accordion-flush { |
|||
.accordion-collapse { |
|||
border-width: 0; |
|||
} |
|||
|
|||
.accordion-item { |
|||
border-right: 0; |
|||
border-left: 0; |
|||
@include border-radius(0); |
|||
|
|||
&:first-child { border-top: 0; } |
|||
&:last-child { border-bottom: 0; } |
|||
|
|||
.accordion-button { |
|||
&, |
|||
&.collapsed { |
|||
@include border-radius(0); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,71 @@ |
|||
// |
|||
// Base styles |
|||
// |
|||
|
|||
.alert { |
|||
// scss-docs-start alert-css-vars |
|||
--#{$prefix}alert-bg: transparent; |
|||
--#{$prefix}alert-padding-x: #{$alert-padding-x}; |
|||
--#{$prefix}alert-padding-y: #{$alert-padding-y}; |
|||
--#{$prefix}alert-margin-bottom: #{$alert-margin-bottom}; |
|||
--#{$prefix}alert-color: inherit; |
|||
--#{$prefix}alert-border-color: transparent; |
|||
--#{$prefix}alert-border: #{$alert-border-width} solid var(--#{$prefix}alert-border-color); |
|||
--#{$prefix}alert-border-radius: #{$alert-border-radius}; |
|||
// scss-docs-end alert-css-vars |
|||
|
|||
position: relative; |
|||
padding: var(--#{$prefix}alert-padding-y) var(--#{$prefix}alert-padding-x); |
|||
margin-bottom: var(--#{$prefix}alert-margin-bottom); |
|||
color: var(--#{$prefix}alert-color); |
|||
background-color: var(--#{$prefix}alert-bg); |
|||
border: var(--#{$prefix}alert-border); |
|||
@include border-radius(var(--#{$prefix}alert-border-radius)); |
|||
} |
|||
|
|||
// Headings for larger alerts |
|||
.alert-heading { |
|||
// Specified to prevent conflicts of changing $headings-color |
|||
color: inherit; |
|||
} |
|||
|
|||
// Provide class for links that match alerts |
|||
.alert-link { |
|||
font-weight: $alert-link-font-weight; |
|||
} |
|||
|
|||
|
|||
// Dismissible alerts |
|||
// |
|||
// Expand the right padding and account for the close button's positioning. |
|||
|
|||
.alert-dismissible { |
|||
padding-right: $alert-dismissible-padding-r; |
|||
|
|||
// Adjust close link position |
|||
.btn-close { |
|||
position: absolute; |
|||
top: 0; |
|||
right: 0; |
|||
z-index: $stretched-link-z-index + 1; |
|||
padding: $alert-padding-y * 1.25 $alert-padding-x; |
|||
} |
|||
} |
|||
|
|||
|
|||
// scss-docs-start alert-modifiers |
|||
// Generate contextual modifier classes for colorizing the alert. |
|||
|
|||
@each $state, $value in $theme-colors { |
|||
$alert-background: shift-color($value, $alert-bg-scale); |
|||
$alert-border: shift-color($value, $alert-border-scale); |
|||
$alert-color: shift-color($value, $alert-color-scale); |
|||
|
|||
@if (contrast-ratio($alert-background, $alert-color) < $min-contrast-ratio) { |
|||
$alert-color: mix($value, color-contrast($alert-background), abs($alert-color-scale)); |
|||
} |
|||
.alert-#{$state} { |
|||
@include alert-variant($alert-background, $alert-border, $alert-color); |
|||
} |
|||
} |
|||
// scss-docs-end alert-modifiers |
|||
@ -0,0 +1,38 @@ |
|||
// Base class |
|||
// |
|||
// Requires one of the contextual, color modifier classes for `color` and |
|||
// `background-color`. |
|||
|
|||
.badge { |
|||
// scss-docs-start badge-css-vars |
|||
--#{$prefix}badge-padding-x: #{$badge-padding-x}; |
|||
--#{$prefix}badge-padding-y: #{$badge-padding-y}; |
|||
@include rfs($badge-font-size, --#{$prefix}badge-font-size); |
|||
--#{$prefix}badge-font-weight: #{$badge-font-weight}; |
|||
--#{$prefix}badge-color: #{$badge-color}; |
|||
--#{$prefix}badge-border-radius: #{$badge-border-radius}; |
|||
// scss-docs-end badge-css-vars |
|||
|
|||
display: inline-block; |
|||
padding: var(--#{$prefix}badge-padding-y) var(--#{$prefix}badge-padding-x); |
|||
@include font-size(var(--#{$prefix}badge-font-size)); |
|||
font-weight: var(--#{$prefix}badge-font-weight); |
|||
line-height: 1; |
|||
color: var(--#{$prefix}badge-color); |
|||
text-align: center; |
|||
white-space: nowrap; |
|||
vertical-align: baseline; |
|||
@include border-radius(var(--#{$prefix}badge-border-radius)); |
|||
@include gradient-bg(); |
|||
|
|||
// Empty badges collapse automatically |
|||
&:empty { |
|||
display: none; |
|||
} |
|||
} |
|||
|
|||
// Quick fix for badges in buttons |
|||
.btn .badge { |
|||
position: relative; |
|||
top: -1px; |
|||
} |
|||
@ -0,0 +1,40 @@ |
|||
.breadcrumb { |
|||
// scss-docs-start breadcrumb-css-vars |
|||
--#{$prefix}breadcrumb-padding-x: #{$breadcrumb-padding-x}; |
|||
--#{$prefix}breadcrumb-padding-y: #{$breadcrumb-padding-y}; |
|||
--#{$prefix}breadcrumb-margin-bottom: #{$breadcrumb-margin-bottom}; |
|||
@include rfs($breadcrumb-font-size, --#{$prefix}breadcrumb-font-size); |
|||
--#{$prefix}breadcrumb-bg: #{$breadcrumb-bg}; |
|||
--#{$prefix}breadcrumb-border-radius: #{$breadcrumb-border-radius}; |
|||
--#{$prefix}breadcrumb-divider-color: #{$breadcrumb-divider-color}; |
|||
--#{$prefix}breadcrumb-item-padding-x: #{$breadcrumb-item-padding-x}; |
|||
--#{$prefix}breadcrumb-item-active-color: #{$breadcrumb-active-color}; |
|||
// scss-docs-end breadcrumb-css-vars |
|||
|
|||
display: flex; |
|||
flex-wrap: wrap; |
|||
padding: var(--#{$prefix}breadcrumb-padding-y) var(--#{$prefix}breadcrumb-padding-x); |
|||
margin-bottom: var(--#{$prefix}breadcrumb-margin-bottom); |
|||
@include font-size(var(--#{$prefix}breadcrumb-font-size)); |
|||
list-style: none; |
|||
background-color: var(--#{$prefix}breadcrumb-bg); |
|||
@include border-radius(var(--#{$prefix}breadcrumb-border-radius)); |
|||
} |
|||
|
|||
.breadcrumb-item { |
|||
// The separator between breadcrumbs (by default, a forward-slash: "/") |
|||
+ .breadcrumb-item { |
|||
padding-left: var(--#{$prefix}breadcrumb-item-padding-x); |
|||
|
|||
&::before { |
|||
float: left; // Suppress inline spacings and underlining of the separator |
|||
padding-right: var(--#{$prefix}breadcrumb-item-padding-x); |
|||
color: var(--#{$prefix}breadcrumb-divider-color); |
|||
content: var(--#{$prefix}breadcrumb-divider, escape-svg($breadcrumb-divider)) #{"/* rtl:"} var(--#{$prefix}breadcrumb-divider, escape-svg($breadcrumb-divider-flipped)) #{"*/"}; |
|||
} |
|||
} |
|||
|
|||
&.active { |
|||
color: var(--#{$prefix}breadcrumb-item-active-color); |
|||
} |
|||
} |
|||
@ -0,0 +1,142 @@ |
|||
// Make the div behave like a button |
|||
.btn-group, |
|||
.btn-group-vertical { |
|||
position: relative; |
|||
display: inline-flex; |
|||
vertical-align: middle; // match .btn alignment given font-size hack above |
|||
|
|||
> .btn { |
|||
position: relative; |
|||
flex: 1 1 auto; |
|||
} |
|||
|
|||
// Bring the hover, focused, and "active" buttons to the front to overlay |
|||
// the borders properly |
|||
> .btn-check:checked + .btn, |
|||
> .btn-check:focus + .btn, |
|||
> .btn:hover, |
|||
> .btn:focus, |
|||
> .btn:active, |
|||
> .btn.active { |
|||
z-index: 1; |
|||
} |
|||
} |
|||
|
|||
// Optional: Group multiple button groups together for a toolbar |
|||
.btn-toolbar { |
|||
display: flex; |
|||
flex-wrap: wrap; |
|||
justify-content: flex-start; |
|||
|
|||
.input-group { |
|||
width: auto; |
|||
} |
|||
} |
|||
|
|||
.btn-group { |
|||
@include border-radius($btn-border-radius); |
|||
|
|||
// Prevent double borders when buttons are next to each other |
|||
> :not(.btn-check:first-child) + .btn, |
|||
> .btn-group:not(:first-child) { |
|||
margin-left: -$btn-border-width; |
|||
} |
|||
|
|||
// Reset rounded corners |
|||
> .btn:not(:last-child):not(.dropdown-toggle), |
|||
> .btn.dropdown-toggle-split:first-child, |
|||
> .btn-group:not(:last-child) > .btn { |
|||
@include border-end-radius(0); |
|||
} |
|||
|
|||
// The left radius should be 0 if the button is: |
|||
// - the "third or more" child |
|||
// - the second child and the previous element isn't `.btn-check` (making it the first child visually) |
|||
// - part of a btn-group which isn't the first child |
|||
> .btn:nth-child(n + 3), |
|||
> :not(.btn-check) + .btn, |
|||
> .btn-group:not(:first-child) > .btn { |
|||
@include border-start-radius(0); |
|||
} |
|||
} |
|||
|
|||
// Sizing |
|||
// |
|||
// Remix the default button sizing classes into new ones for easier manipulation. |
|||
|
|||
.btn-group-sm > .btn { @extend .btn-sm; } |
|||
.btn-group-lg > .btn { @extend .btn-lg; } |
|||
|
|||
|
|||
// |
|||
// Split button dropdowns |
|||
// |
|||
|
|||
.dropdown-toggle-split { |
|||
padding-right: $btn-padding-x * .75; |
|||
padding-left: $btn-padding-x * .75; |
|||
|
|||
&::after, |
|||
.dropup &::after, |
|||
.dropend &::after { |
|||
margin-left: 0; |
|||
} |
|||
|
|||
.dropstart &::before { |
|||
margin-right: 0; |
|||
} |
|||
} |
|||
|
|||
.btn-sm + .dropdown-toggle-split { |
|||
padding-right: $btn-padding-x-sm * .75; |
|||
padding-left: $btn-padding-x-sm * .75; |
|||
} |
|||
|
|||
.btn-lg + .dropdown-toggle-split { |
|||
padding-right: $btn-padding-x-lg * .75; |
|||
padding-left: $btn-padding-x-lg * .75; |
|||
} |
|||
|
|||
|
|||
// The clickable button for toggling the menu |
|||
// Set the same inset shadow as the :active state |
|||
.btn-group.show .dropdown-toggle { |
|||
@include box-shadow($btn-active-box-shadow); |
|||
|
|||
// Show no shadow for `.btn-link` since it has no other button styles. |
|||
&.btn-link { |
|||
@include box-shadow(none); |
|||
} |
|||
} |
|||
|
|||
|
|||
// |
|||
// Vertical button groups |
|||
// |
|||
|
|||
.btn-group-vertical { |
|||
flex-direction: column; |
|||
align-items: flex-start; |
|||
justify-content: center; |
|||
|
|||
> .btn, |
|||
> .btn-group { |
|||
width: 100%; |
|||
} |
|||
|
|||
> .btn:not(:first-child), |
|||
> .btn-group:not(:first-child) { |
|||
margin-top: -$btn-border-width; |
|||
} |
|||
|
|||
// Reset rounded corners |
|||
> .btn:not(:last-child):not(.dropdown-toggle), |
|||
> .btn-group:not(:last-child) > .btn { |
|||
@include border-bottom-radius(0); |
|||
} |
|||
|
|||
> .btn ~ .btn, |
|||
> .btn-group:not(:first-child) > .btn { |
|||
@include border-top-radius(0); |
|||
} |
|||
} |
|||
@ -0,0 +1,207 @@ |
|||
// |
|||
// Base styles |
|||
// |
|||
|
|||
.btn { |
|||
// scss-docs-start btn-css-vars |
|||
--#{$prefix}btn-padding-x: #{$btn-padding-x}; |
|||
--#{$prefix}btn-padding-y: #{$btn-padding-y}; |
|||
--#{$prefix}btn-font-family: #{$btn-font-family}; |
|||
@include rfs($btn-font-size, --#{$prefix}btn-font-size); |
|||
--#{$prefix}btn-font-weight: #{$btn-font-weight}; |
|||
--#{$prefix}btn-line-height: #{$btn-line-height}; |
|||
--#{$prefix}btn-color: #{$body-color}; |
|||
--#{$prefix}btn-bg: transparent; |
|||
--#{$prefix}btn-border-width: #{$btn-border-width}; |
|||
--#{$prefix}btn-border-color: transparent; |
|||
--#{$prefix}btn-border-radius: #{$btn-border-radius}; |
|||
--#{$prefix}btn-hover-border-color: transparent; |
|||
--#{$prefix}btn-box-shadow: #{$btn-box-shadow}; |
|||
--#{$prefix}btn-disabled-opacity: #{$btn-disabled-opacity}; |
|||
--#{$prefix}btn-focus-box-shadow: 0 0 0 #{$btn-focus-width} rgba(var(--#{$prefix}btn-focus-shadow-rgb), .5); |
|||
// scss-docs-end btn-css-vars |
|||
|
|||
display: inline-block; |
|||
padding: var(--#{$prefix}btn-padding-y) var(--#{$prefix}btn-padding-x); |
|||
font-family: var(--#{$prefix}btn-font-family); |
|||
@include font-size(var(--#{$prefix}btn-font-size)); |
|||
font-weight: var(--#{$prefix}btn-font-weight); |
|||
line-height: var(--#{$prefix}btn-line-height); |
|||
color: var(--#{$prefix}btn-color); |
|||
text-align: center; |
|||
text-decoration: if($link-decoration == none, null, none); |
|||
white-space: $btn-white-space; |
|||
vertical-align: middle; |
|||
cursor: if($enable-button-pointers, pointer, null); |
|||
user-select: none; |
|||
border: var(--#{$prefix}btn-border-width) solid var(--#{$prefix}btn-border-color); |
|||
@include border-radius(var(--#{$prefix}btn-border-radius)); |
|||
@include gradient-bg(var(--#{$prefix}btn-bg)); |
|||
@include box-shadow(var(--#{$prefix}btn-box-shadow)); |
|||
@include transition($btn-transition); |
|||
|
|||
&:hover { |
|||
color: var(--#{$prefix}btn-hover-color); |
|||
text-decoration: if($link-hover-decoration == underline, none, null); |
|||
background-color: var(--#{$prefix}btn-hover-bg); |
|||
border-color: var(--#{$prefix}btn-hover-border-color); |
|||
} |
|||
|
|||
.btn-check + &:hover { |
|||
// override for the checkbox/radio buttons |
|||
color: var(--#{$prefix}btn-color); |
|||
background-color: var(--#{$prefix}btn-bg); |
|||
border-color: var(--#{$prefix}btn-border-color); |
|||
} |
|||
|
|||
&:focus-visible { |
|||
color: var(--#{$prefix}btn-hover-color); |
|||
@include gradient-bg(var(--#{$prefix}btn-hover-bg)); |
|||
border-color: var(--#{$prefix}btn-hover-border-color); |
|||
outline: 0; |
|||
// Avoid using mixin so we can pass custom focus shadow properly |
|||
@if $enable-shadows { |
|||
box-shadow: var(--#{$prefix}btn-box-shadow), var(--#{$prefix}btn-focus-box-shadow); |
|||
} @else { |
|||
box-shadow: var(--#{$prefix}btn-focus-box-shadow); |
|||
} |
|||
} |
|||
|
|||
.btn-check:focus-visible + & { |
|||
border-color: var(--#{$prefix}btn-hover-border-color); |
|||
outline: 0; |
|||
// Avoid using mixin so we can pass custom focus shadow properly |
|||
@if $enable-shadows { |
|||
box-shadow: var(--#{$prefix}btn-box-shadow), var(--#{$prefix}btn-focus-box-shadow); |
|||
} @else { |
|||
box-shadow: var(--#{$prefix}btn-focus-box-shadow); |
|||
} |
|||
} |
|||
|
|||
.btn-check:checked + &, |
|||
:not(.btn-check) + &:active, |
|||
&:first-child:active, |
|||
&.active, |
|||
&.show { |
|||
color: var(--#{$prefix}btn-active-color); |
|||
background-color: var(--#{$prefix}btn-active-bg); |
|||
// Remove CSS gradients if they're enabled |
|||
background-image: if($enable-gradients, none, null); |
|||
border-color: var(--#{$prefix}btn-active-border-color); |
|||
@include box-shadow(var(--#{$prefix}btn-active-shadow)); |
|||
|
|||
&:focus-visible { |
|||
// Avoid using mixin so we can pass custom focus shadow properly |
|||
@if $enable-shadows { |
|||
box-shadow: var(--#{$prefix}btn-active-shadow), var(--#{$prefix}btn-focus-box-shadow); |
|||
} @else { |
|||
box-shadow: var(--#{$prefix}btn-focus-box-shadow); |
|||
} |
|||
} |
|||
} |
|||
|
|||
&:disabled, |
|||
&.disabled, |
|||
fieldset:disabled & { |
|||
color: var(--#{$prefix}btn-disabled-color); |
|||
pointer-events: none; |
|||
background-color: var(--#{$prefix}btn-disabled-bg); |
|||
background-image: if($enable-gradients, none, null); |
|||
border-color: var(--#{$prefix}btn-disabled-border-color); |
|||
opacity: var(--#{$prefix}btn-disabled-opacity); |
|||
@include box-shadow(none); |
|||
} |
|||
} |
|||
|
|||
|
|||
// |
|||
// Alternate buttons |
|||
// |
|||
|
|||
// scss-docs-start btn-variant-loops |
|||
@each $color, $value in $theme-colors { |
|||
.btn-#{$color} { |
|||
@if $color == "light" { |
|||
@include button-variant( |
|||
$value, |
|||
$value, |
|||
$hover-background: shade-color($value, $btn-hover-bg-shade-amount), |
|||
$hover-border: shade-color($value, $btn-hover-border-shade-amount), |
|||
$active-background: shade-color($value, $btn-active-bg-shade-amount), |
|||
$active-border: shade-color($value, $btn-active-border-shade-amount) |
|||
); |
|||
} @else if $color == "dark" { |
|||
@include button-variant( |
|||
$value, |
|||
$value, |
|||
$hover-background: tint-color($value, $btn-hover-bg-tint-amount), |
|||
$hover-border: tint-color($value, $btn-hover-border-tint-amount), |
|||
$active-background: tint-color($value, $btn-active-bg-tint-amount), |
|||
$active-border: tint-color($value, $btn-active-border-tint-amount) |
|||
); |
|||
} @else { |
|||
@include button-variant($value, $value); |
|||
} |
|||
} |
|||
} |
|||
|
|||
@each $color, $value in $theme-colors { |
|||
.btn-outline-#{$color} { |
|||
@include button-outline-variant($value); |
|||
} |
|||
} |
|||
// scss-docs-end btn-variant-loops |
|||
|
|||
|
|||
// |
|||
// Link buttons |
|||
// |
|||
|
|||
// Make a button look and behave like a link |
|||
.btn-link { |
|||
--#{$prefix}btn-font-weight: #{$font-weight-normal}; |
|||
--#{$prefix}btn-color: #{$btn-link-color}; |
|||
--#{$prefix}btn-bg: transparent; |
|||
--#{$prefix}btn-border-color: transparent; |
|||
--#{$prefix}btn-hover-color: #{$btn-link-hover-color}; |
|||
--#{$prefix}btn-hover-border-color: transparent; |
|||
--#{$prefix}btn-active-color: #{$btn-link-hover-color}; |
|||
--#{$prefix}btn-active-border-color: transparent; |
|||
--#{$prefix}btn-disabled-color: #{$btn-link-disabled-color}; |
|||
--#{$prefix}btn-disabled-border-color: transparent; |
|||
--#{$prefix}btn-box-shadow: none; |
|||
--#{$prefix}btn-focus-shadow-rgb: #{to-rgb(mix(color-contrast($primary), $primary, 15%))}; |
|||
|
|||
text-decoration: $link-decoration; |
|||
@if $enable-gradients { |
|||
background-image: none; |
|||
} |
|||
|
|||
&:hover, |
|||
&:focus-visible { |
|||
text-decoration: $link-hover-decoration; |
|||
} |
|||
|
|||
&:focus-visible { |
|||
color: var(--#{$prefix}btn-color); |
|||
} |
|||
|
|||
&:hover { |
|||
color: var(--#{$prefix}btn-hover-color); |
|||
} |
|||
|
|||
// No need for an active state here |
|||
} |
|||
|
|||
|
|||
// |
|||
// Button Sizes |
|||
// |
|||
|
|||
.btn-lg { |
|||
@include button-size($btn-padding-y-lg, $btn-padding-x-lg, $btn-font-size-lg, $btn-border-radius-lg); |
|||
} |
|||
|
|||
.btn-sm { |
|||
@include button-size($btn-padding-y-sm, $btn-padding-x-sm, $btn-font-size-sm, $btn-border-radius-sm); |
|||
} |
|||
@ -0,0 +1,234 @@ |
|||
// |
|||
// Base styles |
|||
// |
|||
|
|||
.card { |
|||
// scss-docs-start card-css-vars |
|||
--#{$prefix}card-spacer-y: #{$card-spacer-y}; |
|||
--#{$prefix}card-spacer-x: #{$card-spacer-x}; |
|||
--#{$prefix}card-title-spacer-y: #{$card-title-spacer-y}; |
|||
--#{$prefix}card-border-width: #{$card-border-width}; |
|||
--#{$prefix}card-border-color: #{$card-border-color}; |
|||
--#{$prefix}card-border-radius: #{$card-border-radius}; |
|||
--#{$prefix}card-box-shadow: #{$card-box-shadow}; |
|||
--#{$prefix}card-inner-border-radius: #{$card-inner-border-radius}; |
|||
--#{$prefix}card-cap-padding-y: #{$card-cap-padding-y}; |
|||
--#{$prefix}card-cap-padding-x: #{$card-cap-padding-x}; |
|||
--#{$prefix}card-cap-bg: #{$card-cap-bg}; |
|||
--#{$prefix}card-cap-color: #{$card-cap-color}; |
|||
--#{$prefix}card-height: #{$card-height}; |
|||
--#{$prefix}card-color: #{$card-color}; |
|||
--#{$prefix}card-bg: #{$card-bg}; |
|||
--#{$prefix}card-img-overlay-padding: #{$card-img-overlay-padding}; |
|||
--#{$prefix}card-group-margin: #{$card-group-margin}; |
|||
// scss-docs-end card-css-vars |
|||
|
|||
position: relative; |
|||
display: flex; |
|||
flex-direction: column; |
|||
min-width: 0; // See https://github.com/twbs/bootstrap/pull/22740#issuecomment-305868106 |
|||
height: var(--#{$prefix}card-height); |
|||
word-wrap: break-word; |
|||
background-color: var(--#{$prefix}card-bg); |
|||
background-clip: border-box; |
|||
border: var(--#{$prefix}card-border-width) solid var(--#{$prefix}card-border-color); |
|||
@include border-radius(var(--#{$prefix}card-border-radius)); |
|||
@include box-shadow(var(--#{$prefix}card-box-shadow)); |
|||
|
|||
> hr { |
|||
margin-right: 0; |
|||
margin-left: 0; |
|||
} |
|||
|
|||
> .list-group { |
|||
border-top: inherit; |
|||
border-bottom: inherit; |
|||
|
|||
&:first-child { |
|||
border-top-width: 0; |
|||
@include border-top-radius(var(--#{$prefix}card-inner-border-radius)); |
|||
} |
|||
|
|||
&:last-child { |
|||
border-bottom-width: 0; |
|||
@include border-bottom-radius(var(--#{$prefix}card-inner-border-radius)); |
|||
} |
|||
} |
|||
|
|||
// Due to specificity of the above selector (`.card > .list-group`), we must |
|||
// use a child selector here to prevent double borders. |
|||
> .card-header + .list-group, |
|||
> .list-group + .card-footer { |
|||
border-top: 0; |
|||
} |
|||
} |
|||
|
|||
.card-body { |
|||
// Enable `flex-grow: 1` for decks and groups so that card blocks take up |
|||
// as much space as possible, ensuring footers are aligned to the bottom. |
|||
flex: 1 1 auto; |
|||
padding: var(--#{$prefix}card-spacer-y) var(--#{$prefix}card-spacer-x); |
|||
color: var(--#{$prefix}card-color); |
|||
} |
|||
|
|||
.card-title { |
|||
margin-bottom: var(--#{$prefix}card-title-spacer-y); |
|||
} |
|||
|
|||
.card-subtitle { |
|||
margin-top: calc(-.5 * var(--#{$prefix}card-title-spacer-y)); // stylelint-disable-line function-disallowed-list |
|||
margin-bottom: 0; |
|||
} |
|||
|
|||
.card-text:last-child { |
|||
margin-bottom: 0; |
|||
} |
|||
|
|||
.card-link { |
|||
&:hover { |
|||
text-decoration: if($link-hover-decoration == underline, none, null); |
|||
} |
|||
|
|||
+ .card-link { |
|||
margin-left: var(--#{$prefix}card-spacer-x); |
|||
} |
|||
} |
|||
|
|||
// |
|||
// Optional textual caps |
|||
// |
|||
|
|||
.card-header { |
|||
padding: var(--#{$prefix}card-cap-padding-y) var(--#{$prefix}card-cap-padding-x); |
|||
margin-bottom: 0; // Removes the default margin-bottom of <hN> |
|||
color: var(--#{$prefix}card-cap-color); |
|||
background-color: var(--#{$prefix}card-cap-bg); |
|||
border-bottom: var(--#{$prefix}card-border-width) solid var(--#{$prefix}card-border-color); |
|||
|
|||
&:first-child { |
|||
@include border-radius(var(--#{$prefix}card-inner-border-radius) var(--#{$prefix}card-inner-border-radius) 0 0); |
|||
} |
|||
} |
|||
|
|||
.card-footer { |
|||
padding: var(--#{$prefix}card-cap-padding-y) var(--#{$prefix}card-cap-padding-x); |
|||
color: var(--#{$prefix}card-cap-color); |
|||
background-color: var(--#{$prefix}card-cap-bg); |
|||
border-top: var(--#{$prefix}card-border-width) solid var(--#{$prefix}card-border-color); |
|||
|
|||
&:last-child { |
|||
@include border-radius(0 0 var(--#{$prefix}card-inner-border-radius) var(--#{$prefix}card-inner-border-radius)); |
|||
} |
|||
} |
|||
|
|||
|
|||
// |
|||
// Header navs |
|||
// |
|||
|
|||
.card-header-tabs { |
|||
margin-right: calc(-.5 * var(--#{$prefix}card-cap-padding-x)); // stylelint-disable-line function-disallowed-list |
|||
margin-bottom: calc(-1 * var(--#{$prefix}card-cap-padding-y)); // stylelint-disable-line function-disallowed-list |
|||
margin-left: calc(-.5 * var(--#{$prefix}card-cap-padding-x)); // stylelint-disable-line function-disallowed-list |
|||
border-bottom: 0; |
|||
|
|||
.nav-link.active { |
|||
background-color: var(--#{$prefix}card-bg); |
|||
border-bottom-color: var(--#{$prefix}card-bg); |
|||
} |
|||
} |
|||
|
|||
.card-header-pills { |
|||
margin-right: calc(-.5 * var(--#{$prefix}card-cap-padding-x)); // stylelint-disable-line function-disallowed-list |
|||
margin-left: calc(-.5 * var(--#{$prefix}card-cap-padding-x)); // stylelint-disable-line function-disallowed-list |
|||
} |
|||
|
|||
// Card image |
|||
.card-img-overlay { |
|||
position: absolute; |
|||
top: 0; |
|||
right: 0; |
|||
bottom: 0; |
|||
left: 0; |
|||
padding: var(--#{$prefix}card-img-overlay-padding); |
|||
@include border-radius(var(--#{$prefix}card-inner-border-radius)); |
|||
} |
|||
|
|||
.card-img, |
|||
.card-img-top, |
|||
.card-img-bottom { |
|||
width: 100%; // Required because we use flexbox and this inherently applies align-self: stretch |
|||
} |
|||
|
|||
.card-img, |
|||
.card-img-top { |
|||
@include border-top-radius(var(--#{$prefix}card-inner-border-radius)); |
|||
} |
|||
|
|||
.card-img, |
|||
.card-img-bottom { |
|||
@include border-bottom-radius(var(--#{$prefix}card-inner-border-radius)); |
|||
} |
|||
|
|||
|
|||
// |
|||
// Card groups |
|||
// |
|||
|
|||
.card-group { |
|||
// The child selector allows nested `.card` within `.card-group` |
|||
// to display properly. |
|||
> .card { |
|||
margin-bottom: var(--#{$prefix}card-group-margin); |
|||
} |
|||
|
|||
@include media-breakpoint-up(sm) { |
|||
display: flex; |
|||
flex-flow: row wrap; |
|||
// The child selector allows nested `.card` within `.card-group` |
|||
// to display properly. |
|||
> .card { |
|||
// Flexbugs #4: https://github.com/philipwalton/flexbugs#flexbug-4 |
|||
flex: 1 0 0%; |
|||
margin-bottom: 0; |
|||
|
|||
+ .card { |
|||
margin-left: 0; |
|||
border-left: 0; |
|||
} |
|||
|
|||
// Handle rounded corners |
|||
@if $enable-rounded { |
|||
&:not(:last-child) { |
|||
@include border-end-radius(0); |
|||
|
|||
.card-img-top, |
|||
.card-header { |
|||
// stylelint-disable-next-line property-disallowed-list |
|||
border-top-right-radius: 0; |
|||
} |
|||
.card-img-bottom, |
|||
.card-footer { |
|||
// stylelint-disable-next-line property-disallowed-list |
|||
border-bottom-right-radius: 0; |
|||
} |
|||
} |
|||
|
|||
&:not(:first-child) { |
|||
@include border-start-radius(0); |
|||
|
|||
.card-img-top, |
|||
.card-header { |
|||
// stylelint-disable-next-line property-disallowed-list |
|||
border-top-left-radius: 0; |
|||
} |
|||
.card-img-bottom, |
|||
.card-footer { |
|||
// stylelint-disable-next-line property-disallowed-list |
|||
border-bottom-left-radius: 0; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||